ue-softphone-sdk 3.0.2 → 3.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.
- package/.gitlab-ci.yml +1 -1
- package/Dockerfile +7 -1
- package/dist/{lib/types → types}/index.d.ts +3 -0
- package/dist/ue-softphone-sdk.js +7 -0
- package/package.json +1 -1
- package/rollup.config.js +1 -1
- package/sdkdemo/hangup.wav +0 -0
- package/sdkdemo/ring.wav +0 -0
- package/sdkdemo/ue-load.min.js +116 -0
- package/sdkdemo/ue.global.js +15361 -0
- package/sdkdemo/ue.lib.css +1 -0
- package/sdkdemo/ue.min.js +41 -0
- package/src/config.ts +6 -0
- package/src/index.ts +70 -10
- /package/dist/{lib/types → types}/config.d.ts +0 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: Wangtao
|
|
3
|
+
* @Date: 2023-10-17 15:30:52
|
|
4
|
+
* @LastEditors: Wangtao
|
|
5
|
+
* @LastEditTime: 2023-11-14 19:50:09
|
|
6
|
+
*/
|
|
7
|
+
(function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t(require("vue")):"function"===typeof define&&define.amd?define([],t):"object"===typeof exports?exports["myLib"]=t(require("vue")):e["myLib"]=t(e["Vue"])})("undefined"!==typeof self?self:this,(function(__WEBPACK_EXTERNAL_MODULE__203__){return function(){var __webpack_modules__={670:function(e,t,n){var r=n(111);e.exports=function(e){if(!r(e))throw TypeError(String(e)+" is not an object");return e}},781:function(e,t,n){var r=n(293);e.exports=!r((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},317:function(e,t,n){var r=n(854),o=n(111),i=r.document,s=o(i)&&o(i.createElement);e.exports=function(e){return s?i.createElement(e):{}}},293:function(e){e.exports=function(e){try{return!!e()}catch(t){return!0}}},854:function(e,t,n){var r=function(e){return e&&e.Math==Math&&e};e.exports=r("object"==typeof globalThis&&globalThis)||r("object"==typeof window&&window)||r("object"==typeof self&&self)||r("object"==typeof n.g&&n.g)||function(){return this}()||Function("return this")()},664:function(e,t,n){var r=n(781),o=n(293),i=n(317);e.exports=!r&&!o((function(){return 7!=Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a}))},111:function(e){e.exports=function(e){return"object"===typeof e?null!==e:"function"===typeof e}},70:function(e,t,n){var r=n(781),o=n(664),i=n(670),s=n(593),a=Object.defineProperty;t.f=r?a:function(e,t,n){if(i(e),t=s(t,!0),i(n),o)try{return a(e,t,n)}catch(r){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");return"value"in n&&(e[t]=n.value),e}},66:function(e,t,n){"use strict";var r=n(670);e.exports=function(){var e=r(this),t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.sticky&&(t+="y"),t}},999:function(e,t,n){"use strict";var r=n(293);function o(e,t){return RegExp(e,t)}t.J=r((function(){var e=o("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),r((function(){var e=o("^r","gy");return e.lastIndex=2,null!=e.exec("str")}))},593:function(e,t,n){var r=n(111);e.exports=function(e,t){if(!r(e))return e;var n,o;if(t&&"function"==typeof(n=e.toString)&&!r(o=n.call(e)))return o;if("function"==typeof(n=e.valueOf)&&!r(o=n.call(e)))return o;if(!t&&"function"==typeof(n=e.toString)&&!r(o=n.call(e)))return o;throw TypeError("Can't convert object to primitive value")}},87:function(e,t,n){var r=n(781),o=n(70),i=n(66),s=n(999).J;r&&("g"!=/./g.flags||s)&&o.f(RegExp.prototype,"flags",{configurable:!0,get:i})},825:function(e,t,n){(function(t,n){e.exports=n()})("undefined"!==typeof self?self:"undefined"!==typeof window?window:"undefined"!==typeof n.g&&n.g,(function(){"use strict";var e="3.7.5",t=e,n="function"===typeof atob,r="function"===typeof btoa,o="function"===typeof Buffer,i="function"===typeof TextDecoder?new TextDecoder:void 0,s="function"===typeof TextEncoder?new TextEncoder:void 0,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",c=Array.prototype.slice.call(a),l=function(e){var t={};return e.forEach((function(e,n){return t[e]=n})),t}(c),u=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,d=String.fromCharCode.bind(String),p="function"===typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):function(e){return new Uint8Array(Array.prototype.slice.call(e,0))},h=function(e){return e.replace(/=/g,"").replace(/[+\/]/g,(function(e){return"+"==e?"-":"_"}))},f=function(e){return e.replace(/[^A-Za-z0-9\+\/]/g,"")},g=function(e){for(var t,n,r,o,i="",s=e.length%3,a=0;a<e.length;){if((n=e.charCodeAt(a++))>255||(r=e.charCodeAt(a++))>255||(o=e.charCodeAt(a++))>255)throw new TypeError("invalid character found");t=n<<16|r<<8|o,i+=c[t>>18&63]+c[t>>12&63]+c[t>>6&63]+c[63&t]}return s?i.slice(0,s-3)+"===".substring(s):i},m=r?function(e){return btoa(e)}:o?function(e){return Buffer.from(e,"binary").toString("base64")}:g,v=o?function(e){return Buffer.from(e).toString("base64")}:function(e){for(var t=4096,n=[],r=0,o=e.length;r<o;r+=t)n.push(d.apply(null,e.subarray(r,r+t)));return m(n.join(""))},y=function(e,t){return void 0===t&&(t=!1),t?h(v(e)):v(e)},b=function(e){if(e.length<2){var t=e.charCodeAt(0);return t<128?e:t<2048?d(192|t>>>6)+d(128|63&t):d(224|t>>>12&15)+d(128|t>>>6&63)+d(128|63&t)}t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return d(240|t>>>18&7)+d(128|t>>>12&63)+d(128|t>>>6&63)+d(128|63&t)},w=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,S=function(e){return e.replace(w,b)},T=o?function(e){return Buffer.from(e,"utf8").toString("base64")}:s?function(e){return v(s.encode(e))}:function(e){return m(S(e))},C=function(e,t){return void 0===t&&(t=!1),t?h(T(e)):T(e)},E=function(e){return C(e,!0)},k=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,x=function(e){switch(e.length){case 4:var t=(7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3),n=t-65536;return d(55296+(n>>>10))+d(56320+(1023&n));case 3:return d((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return d((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},I=function(e){return e.replace(k,x)},R=function(e){if(e=e.replace(/\s+/g,""),!u.test(e))throw new TypeError("malformed base64.");e+="==".slice(2-(3&e.length));for(var t,n,r,o="",i=0;i<e.length;)t=l[e.charAt(i++)]<<18|l[e.charAt(i++)]<<12|(n=l[e.charAt(i++)])<<6|(r=l[e.charAt(i++)]),o+=64===n?d(t>>16&255):64===r?d(t>>16&255,t>>8&255):d(t>>16&255,t>>8&255,255&t);return o},_=n?function(e){return atob(f(e))}:o?function(e){return Buffer.from(e,"base64").toString("binary")}:R,N=o?function(e){return p(Buffer.from(e,"base64"))}:function(e){return p(_(e).split("").map((function(e){return e.charCodeAt(0)})))},A=function(e){return N(P(e))},O=o?function(e){return Buffer.from(e,"base64").toString("utf8")}:i?function(e){return i.decode(N(e))}:function(e){return I(_(e))},P=function(e){return f(e.replace(/[-_]/g,(function(e){return"-"==e?"+":"/"})))},D=function(e){return O(P(e))},B=function(e){if("string"!==typeof e)return!1;var t=e.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(t)||!/[^\s0-9a-zA-Z\-_]/.test(t)},j=function(e){return{value:e,enumerable:!1,writable:!0,configurable:!0}},H=function(){var e=function(e,t){return Object.defineProperty(String.prototype,e,j(t))};e("fromBase64",(function(){return D(this)})),e("toBase64",(function(e){return C(this,e)})),e("toBase64URI",(function(){return C(this,!0)})),e("toBase64URL",(function(){return C(this,!0)})),e("toUint8Array",(function(){return A(this)}))},M=function(){var e=function(e,t){return Object.defineProperty(Uint8Array.prototype,e,j(t))};e("toBase64",(function(e){return y(this,e)})),e("toBase64URI",(function(){return y(this,!0)})),e("toBase64URL",(function(){return y(this,!0)}))},L=function(){H(),M()},q={version:e,VERSION:t,atob:_,atobPolyfill:R,btoa:m,btoaPolyfill:g,fromBase64:D,toBase64:C,encode:C,encodeURI:E,encodeURL:E,utob:S,btou:I,decode:D,isValid:B,fromUint8Array:y,toUint8Array:A,extendString:H,extendUint8Array:M,extendBuiltins:L,Base64:{}};return Object.keys(q).forEach((function(e){return q.Base64[e]=q[e]})),q}))},756:function(module,exports,__webpack_require__){var __WEBPACK_AMD_DEFINE_RESULT__;
|
|
8
|
+
/**
|
|
9
|
+
* [js-md5]{@link https://github.com/emn178/js-md5}
|
|
10
|
+
*
|
|
11
|
+
* @namespace md5
|
|
12
|
+
* @version 0.7.3
|
|
13
|
+
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
|
14
|
+
* @copyright Chen, Yi-Cyuan 2014-2017
|
|
15
|
+
* @license MIT
|
|
16
|
+
*/(function(){"use strict";var ERROR="input is invalid type",WINDOW="object"===typeof window,root=WINDOW?window:{};root.JS_MD5_NO_WINDOW&&(WINDOW=!1);var WEB_WORKER=!WINDOW&&"object"===typeof self,NODE_JS=!root.JS_MD5_NO_NODE_JS&&"object"===typeof process&&process.versions&&process.versions.node;NODE_JS?root=__webpack_require__.g:WEB_WORKER&&(root=self);var COMMON_JS=!root.JS_MD5_NO_COMMON_JS&&module.exports,AMD=__webpack_require__.amdO,ARRAY_BUFFER=!root.JS_MD5_NO_ARRAY_BUFFER&&"undefined"!==typeof ArrayBuffer,HEX_CHARS="0123456789abcdef".split(""),EXTRA=[128,32768,8388608,-2147483648],SHIFT=[0,8,16,24],OUTPUT_TYPES=["hex","array","digest","buffer","arrayBuffer","base64"],BASE64_ENCODE_CHAR="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),blocks=[],buffer8;if(ARRAY_BUFFER){var buffer=new ArrayBuffer(68);buffer8=new Uint8Array(buffer),blocks=new Uint32Array(buffer)}!root.JS_MD5_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!ARRAY_BUFFER||!root.JS_MD5_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(e){return"object"===typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});var createOutputMethod=function(e){return function(t){return new Md5(!0).update(t)[e]()}},createMethod=function(){var e=createOutputMethod("hex");NODE_JS&&(e=nodeWrap(e)),e.create=function(){return new Md5},e.update=function(t){return e.create().update(t)};for(var t=0;t<OUTPUT_TYPES.length;++t){var n=OUTPUT_TYPES[t];e[n]=createOutputMethod(n)}return e},nodeWrap=function(method){var crypto=eval("require('crypto')"),Buffer=eval("require('buffer').Buffer"),nodeMethod=function(e){if("string"===typeof e)return crypto.createHash("md5").update(e,"utf8").digest("hex");if(null===e||void 0===e)throw ERROR;return e.constructor===ArrayBuffer&&(e=new Uint8Array(e)),Array.isArray(e)||ArrayBuffer.isView(e)||e.constructor===Buffer?crypto.createHash("md5").update(new Buffer(e)).digest("hex"):method(e)};return nodeMethod};function Md5(e){if(e)blocks[0]=blocks[16]=blocks[1]=blocks[2]=blocks[3]=blocks[4]=blocks[5]=blocks[6]=blocks[7]=blocks[8]=blocks[9]=blocks[10]=blocks[11]=blocks[12]=blocks[13]=blocks[14]=blocks[15]=0,this.blocks=blocks,this.buffer8=buffer8;else if(ARRAY_BUFFER){var t=new ArrayBuffer(68);this.buffer8=new Uint8Array(t),this.blocks=new Uint32Array(t)}else this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.h0=this.h1=this.h2=this.h3=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0}Md5.prototype.update=function(e){if(!this.finalized){var t,n=typeof e;if("string"!==n){if("object"!==n)throw ERROR;if(null===e)throw ERROR;if(ARRAY_BUFFER&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!Array.isArray(e)&&(!ARRAY_BUFFER||!ArrayBuffer.isView(e)))throw ERROR;t=!0}var r,o,i=0,s=e.length,a=this.blocks,c=this.buffer8;while(i<s){if(this.hashed&&(this.hashed=!1,a[0]=a[16],a[16]=a[1]=a[2]=a[3]=a[4]=a[5]=a[6]=a[7]=a[8]=a[9]=a[10]=a[11]=a[12]=a[13]=a[14]=a[15]=0),t)if(ARRAY_BUFFER)for(o=this.start;i<s&&o<64;++i)c[o++]=e[i];else for(o=this.start;i<s&&o<64;++i)a[o>>2]|=e[i]<<SHIFT[3&o++];else if(ARRAY_BUFFER)for(o=this.start;i<s&&o<64;++i)r=e.charCodeAt(i),r<128?c[o++]=r:r<2048?(c[o++]=192|r>>6,c[o++]=128|63&r):r<55296||r>=57344?(c[o++]=224|r>>12,c[o++]=128|r>>6&63,c[o++]=128|63&r):(r=65536+((1023&r)<<10|1023&e.charCodeAt(++i)),c[o++]=240|r>>18,c[o++]=128|r>>12&63,c[o++]=128|r>>6&63,c[o++]=128|63&r);else for(o=this.start;i<s&&o<64;++i)r=e.charCodeAt(i),r<128?a[o>>2]|=r<<SHIFT[3&o++]:r<2048?(a[o>>2]|=(192|r>>6)<<SHIFT[3&o++],a[o>>2]|=(128|63&r)<<SHIFT[3&o++]):r<55296||r>=57344?(a[o>>2]|=(224|r>>12)<<SHIFT[3&o++],a[o>>2]|=(128|r>>6&63)<<SHIFT[3&o++],a[o>>2]|=(128|63&r)<<SHIFT[3&o++]):(r=65536+((1023&r)<<10|1023&e.charCodeAt(++i)),a[o>>2]|=(240|r>>18)<<SHIFT[3&o++],a[o>>2]|=(128|r>>12&63)<<SHIFT[3&o++],a[o>>2]|=(128|r>>6&63)<<SHIFT[3&o++],a[o>>2]|=(128|63&r)<<SHIFT[3&o++]);this.lastByteIndex=o,this.bytes+=o-this.start,o>=64?(this.start=o-64,this.hash(),this.hashed=!0):this.start=o}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},Md5.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex;e[t>>2]|=EXTRA[3&t],t>=56&&(this.hashed||this.hash(),e[0]=e[16],e[16]=e[1]=e[2]=e[3]=e[4]=e[5]=e[6]=e[7]=e[8]=e[9]=e[10]=e[11]=e[12]=e[13]=e[14]=e[15]=0),e[14]=this.bytes<<3,e[15]=this.hBytes<<3|this.bytes>>>29,this.hash()}},Md5.prototype.hash=function(){var e,t,n,r,o,i,s=this.blocks;this.first?(e=s[0]-680876937,e=(e<<7|e>>>25)-271733879<<0,r=(-1732584194^2004318071&e)+s[1]-117830708,r=(r<<12|r>>>20)+e<<0,n=(-271733879^r&(-271733879^e))+s[2]-1126478375,n=(n<<17|n>>>15)+r<<0,t=(e^n&(r^e))+s[3]-1316259209,t=(t<<22|t>>>10)+n<<0):(e=this.h0,t=this.h1,n=this.h2,r=this.h3,e+=(r^t&(n^r))+s[0]-680876936,e=(e<<7|e>>>25)+t<<0,r+=(n^e&(t^n))+s[1]-389564586,r=(r<<12|r>>>20)+e<<0,n+=(t^r&(e^t))+s[2]+606105819,n=(n<<17|n>>>15)+r<<0,t+=(e^n&(r^e))+s[3]-1044525330,t=(t<<22|t>>>10)+n<<0),e+=(r^t&(n^r))+s[4]-176418897,e=(e<<7|e>>>25)+t<<0,r+=(n^e&(t^n))+s[5]+1200080426,r=(r<<12|r>>>20)+e<<0,n+=(t^r&(e^t))+s[6]-1473231341,n=(n<<17|n>>>15)+r<<0,t+=(e^n&(r^e))+s[7]-45705983,t=(t<<22|t>>>10)+n<<0,e+=(r^t&(n^r))+s[8]+1770035416,e=(e<<7|e>>>25)+t<<0,r+=(n^e&(t^n))+s[9]-1958414417,r=(r<<12|r>>>20)+e<<0,n+=(t^r&(e^t))+s[10]-42063,n=(n<<17|n>>>15)+r<<0,t+=(e^n&(r^e))+s[11]-1990404162,t=(t<<22|t>>>10)+n<<0,e+=(r^t&(n^r))+s[12]+1804603682,e=(e<<7|e>>>25)+t<<0,r+=(n^e&(t^n))+s[13]-40341101,r=(r<<12|r>>>20)+e<<0,n+=(t^r&(e^t))+s[14]-1502002290,n=(n<<17|n>>>15)+r<<0,t+=(e^n&(r^e))+s[15]+1236535329,t=(t<<22|t>>>10)+n<<0,e+=(n^r&(t^n))+s[1]-165796510,e=(e<<5|e>>>27)+t<<0,r+=(t^n&(e^t))+s[6]-1069501632,r=(r<<9|r>>>23)+e<<0,n+=(e^t&(r^e))+s[11]+643717713,n=(n<<14|n>>>18)+r<<0,t+=(r^e&(n^r))+s[0]-373897302,t=(t<<20|t>>>12)+n<<0,e+=(n^r&(t^n))+s[5]-701558691,e=(e<<5|e>>>27)+t<<0,r+=(t^n&(e^t))+s[10]+38016083,r=(r<<9|r>>>23)+e<<0,n+=(e^t&(r^e))+s[15]-660478335,n=(n<<14|n>>>18)+r<<0,t+=(r^e&(n^r))+s[4]-405537848,t=(t<<20|t>>>12)+n<<0,e+=(n^r&(t^n))+s[9]+568446438,e=(e<<5|e>>>27)+t<<0,r+=(t^n&(e^t))+s[14]-1019803690,r=(r<<9|r>>>23)+e<<0,n+=(e^t&(r^e))+s[3]-187363961,n=(n<<14|n>>>18)+r<<0,t+=(r^e&(n^r))+s[8]+1163531501,t=(t<<20|t>>>12)+n<<0,e+=(n^r&(t^n))+s[13]-1444681467,e=(e<<5|e>>>27)+t<<0,r+=(t^n&(e^t))+s[2]-51403784,r=(r<<9|r>>>23)+e<<0,n+=(e^t&(r^e))+s[7]+1735328473,n=(n<<14|n>>>18)+r<<0,t+=(r^e&(n^r))+s[12]-1926607734,t=(t<<20|t>>>12)+n<<0,o=t^n,e+=(o^r)+s[5]-378558,e=(e<<4|e>>>28)+t<<0,r+=(o^e)+s[8]-2022574463,r=(r<<11|r>>>21)+e<<0,i=r^e,n+=(i^t)+s[11]+1839030562,n=(n<<16|n>>>16)+r<<0,t+=(i^n)+s[14]-35309556,t=(t<<23|t>>>9)+n<<0,o=t^n,e+=(o^r)+s[1]-1530992060,e=(e<<4|e>>>28)+t<<0,r+=(o^e)+s[4]+1272893353,r=(r<<11|r>>>21)+e<<0,i=r^e,n+=(i^t)+s[7]-155497632,n=(n<<16|n>>>16)+r<<0,t+=(i^n)+s[10]-1094730640,t=(t<<23|t>>>9)+n<<0,o=t^n,e+=(o^r)+s[13]+681279174,e=(e<<4|e>>>28)+t<<0,r+=(o^e)+s[0]-358537222,r=(r<<11|r>>>21)+e<<0,i=r^e,n+=(i^t)+s[3]-722521979,n=(n<<16|n>>>16)+r<<0,t+=(i^n)+s[6]+76029189,t=(t<<23|t>>>9)+n<<0,o=t^n,e+=(o^r)+s[9]-640364487,e=(e<<4|e>>>28)+t<<0,r+=(o^e)+s[12]-421815835,r=(r<<11|r>>>21)+e<<0,i=r^e,n+=(i^t)+s[15]+530742520,n=(n<<16|n>>>16)+r<<0,t+=(i^n)+s[2]-995338651,t=(t<<23|t>>>9)+n<<0,e+=(n^(t|~r))+s[0]-198630844,e=(e<<6|e>>>26)+t<<0,r+=(t^(e|~n))+s[7]+1126891415,r=(r<<10|r>>>22)+e<<0,n+=(e^(r|~t))+s[14]-1416354905,n=(n<<15|n>>>17)+r<<0,t+=(r^(n|~e))+s[5]-57434055,t=(t<<21|t>>>11)+n<<0,e+=(n^(t|~r))+s[12]+1700485571,e=(e<<6|e>>>26)+t<<0,r+=(t^(e|~n))+s[3]-1894986606,r=(r<<10|r>>>22)+e<<0,n+=(e^(r|~t))+s[10]-1051523,n=(n<<15|n>>>17)+r<<0,t+=(r^(n|~e))+s[1]-2054922799,t=(t<<21|t>>>11)+n<<0,e+=(n^(t|~r))+s[8]+1873313359,e=(e<<6|e>>>26)+t<<0,r+=(t^(e|~n))+s[15]-30611744,r=(r<<10|r>>>22)+e<<0,n+=(e^(r|~t))+s[6]-1560198380,n=(n<<15|n>>>17)+r<<0,t+=(r^(n|~e))+s[13]+1309151649,t=(t<<21|t>>>11)+n<<0,e+=(n^(t|~r))+s[4]-145523070,e=(e<<6|e>>>26)+t<<0,r+=(t^(e|~n))+s[11]-1120210379,r=(r<<10|r>>>22)+e<<0,n+=(e^(r|~t))+s[2]+718787259,n=(n<<15|n>>>17)+r<<0,t+=(r^(n|~e))+s[9]-343485551,t=(t<<21|t>>>11)+n<<0,this.first?(this.h0=e+1732584193<<0,this.h1=t-271733879<<0,this.h2=n-1732584194<<0,this.h3=r+271733878<<0,this.first=!1):(this.h0=this.h0+e<<0,this.h1=this.h1+t<<0,this.h2=this.h2+n<<0,this.h3=this.h3+r<<0)},Md5.prototype.hex=function(){this.finalize();var e=this.h0,t=this.h1,n=this.h2,r=this.h3;return HEX_CHARS[e>>4&15]+HEX_CHARS[15&e]+HEX_CHARS[e>>12&15]+HEX_CHARS[e>>8&15]+HEX_CHARS[e>>20&15]+HEX_CHARS[e>>16&15]+HEX_CHARS[e>>28&15]+HEX_CHARS[e>>24&15]+HEX_CHARS[t>>4&15]+HEX_CHARS[15&t]+HEX_CHARS[t>>12&15]+HEX_CHARS[t>>8&15]+HEX_CHARS[t>>20&15]+HEX_CHARS[t>>16&15]+HEX_CHARS[t>>28&15]+HEX_CHARS[t>>24&15]+HEX_CHARS[n>>4&15]+HEX_CHARS[15&n]+HEX_CHARS[n>>12&15]+HEX_CHARS[n>>8&15]+HEX_CHARS[n>>20&15]+HEX_CHARS[n>>16&15]+HEX_CHARS[n>>28&15]+HEX_CHARS[n>>24&15]+HEX_CHARS[r>>4&15]+HEX_CHARS[15&r]+HEX_CHARS[r>>12&15]+HEX_CHARS[r>>8&15]+HEX_CHARS[r>>20&15]+HEX_CHARS[r>>16&15]+HEX_CHARS[r>>28&15]+HEX_CHARS[r>>24&15]},Md5.prototype.toString=Md5.prototype.hex,Md5.prototype.digest=function(){this.finalize();var e=this.h0,t=this.h1,n=this.h2,r=this.h3;return[255&e,e>>8&255,e>>16&255,e>>24&255,255&t,t>>8&255,t>>16&255,t>>24&255,255&n,n>>8&255,n>>16&255,n>>24&255,255&r,r>>8&255,r>>16&255,r>>24&255]},Md5.prototype.array=Md5.prototype.digest,Md5.prototype.arrayBuffer=function(){this.finalize();var e=new ArrayBuffer(16),t=new Uint32Array(e);return t[0]=this.h0,t[1]=this.h1,t[2]=this.h2,t[3]=this.h3,e},Md5.prototype.buffer=Md5.prototype.arrayBuffer,Md5.prototype.base64=function(){for(var e,t,n,r="",o=this.array(),i=0;i<15;)e=o[i++],t=o[i++],n=o[i++],r+=BASE64_ENCODE_CHAR[e>>>2]+BASE64_ENCODE_CHAR[63&(e<<4|t>>>4)]+BASE64_ENCODE_CHAR[63&(t<<2|n>>>6)]+BASE64_ENCODE_CHAR[63&n];return e=o[i],r+=BASE64_ENCODE_CHAR[e>>>2]+BASE64_ENCODE_CHAR[e<<4&63]+"==",r};var exports=createMethod();COMMON_JS?module.exports=exports:(root.md5=exports,AMD&&(__WEBPACK_AMD_DEFINE_RESULT__=function(){return exports}.call(exports,__webpack_require__,exports,module),void 0===__WEBPACK_AMD_DEFINE_RESULT__||(module.exports=__WEBPACK_AMD_DEFINE_RESULT__)))})()},411:function(e,t,n){"use strict";n.r(t),n.d(t,{JSEncrypt:function(){return be},default:function(){return we}});var r="0123456789abcdefghijklmnopqrstuvwxyz";function o(e){return r.charAt(e)}function i(e,t){return e&t}function s(e,t){return e|t}function a(e,t){return e^t}function c(e,t){return e&~t}function l(e){if(0==e)return-1;var t=0;return 0==(65535&e)&&(e>>=16,t+=16),0==(255&e)&&(e>>=8,t+=8),0==(15&e)&&(e>>=4,t+=4),0==(3&e)&&(e>>=2,t+=2),0==(1&e)&&++t,t}function u(e){var t=0;while(0!=e)e&=e-1,++t;return t}var d,p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",h="=";function f(e){var t,n,r="";for(t=0;t+3<=e.length;t+=3)n=parseInt(e.substring(t,t+3),16),r+=p.charAt(n>>6)+p.charAt(63&n);t+1==e.length?(n=parseInt(e.substring(t,t+1),16),r+=p.charAt(n<<2)):t+2==e.length&&(n=parseInt(e.substring(t,t+2),16),r+=p.charAt(n>>2)+p.charAt((3&n)<<4));while((3&r.length)>0)r+=h;return r}function g(e){var t,n="",r=0,i=0;for(t=0;t<e.length;++t){if(e.charAt(t)==h)break;var s=p.indexOf(e.charAt(t));s<0||(0==r?(n+=o(s>>2),i=3&s,r=1):1==r?(n+=o(i<<2|s>>4),i=15&s,r=2):2==r?(n+=o(i),n+=o(s>>2),i=3&s,r=3):(n+=o(i<<2|s>>4),n+=o(15&s),r=0))}return 1==r&&(n+=o(i<<2)),n}var m,v={decode:function(e){var t;if(void 0===d){var n="0123456789ABCDEF",r=" \f\n\r\t \u2028\u2029";for(d={},t=0;t<16;++t)d[n.charAt(t)]=t;for(n=n.toLowerCase(),t=10;t<16;++t)d[n.charAt(t)]=t;for(t=0;t<r.length;++t)d[r.charAt(t)]=-1}var o=[],i=0,s=0;for(t=0;t<e.length;++t){var a=e.charAt(t);if("="==a)break;if(a=d[a],-1!=a){if(void 0===a)throw new Error("Illegal character at offset "+t);i|=a,++s>=2?(o[o.length]=i,i=0,s=0):i<<=4}}if(s)throw new Error("Hex encoding incomplete: 4 bits missing");return o}},y={decode:function(e){var t;if(void 0===m){var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r="= \f\n\r\t \u2028\u2029";for(m=Object.create(null),t=0;t<64;++t)m[n.charAt(t)]=t;for(m["-"]=62,m["_"]=63,t=0;t<r.length;++t)m[r.charAt(t)]=-1}var o=[],i=0,s=0;for(t=0;t<e.length;++t){var a=e.charAt(t);if("="==a)break;if(a=m[a],-1!=a){if(void 0===a)throw new Error("Illegal character at offset "+t);i|=a,++s>=4?(o[o.length]=i>>16,o[o.length]=i>>8&255,o[o.length]=255&i,i=0,s=0):i<<=6}}switch(s){case 1:throw new Error("Base64 encoding incomplete: at least 2 bits missing");case 2:o[o.length]=i>>10;break;case 3:o[o.length]=i>>16,o[o.length]=i>>8&255;break}return o},re:/-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,unarmor:function(e){var t=y.re.exec(e);if(t)if(t[1])e=t[1];else{if(!t[2])throw new Error("RegExp out of sync");e=t[2]}return y.decode(e)}},b=1e13,w=function(){function e(e){this.buf=[+e||0]}return e.prototype.mulAdd=function(e,t){var n,r,o=this.buf,i=o.length;for(n=0;n<i;++n)r=o[n]*e+t,r<b?t=0:(t=0|r/b,r-=t*b),o[n]=r;t>0&&(o[n]=t)},e.prototype.sub=function(e){var t,n,r=this.buf,o=r.length;for(t=0;t<o;++t)n=r[t]-e,n<0?(n+=b,e=1):e=0,r[t]=n;while(0===r[r.length-1])r.pop()},e.prototype.toString=function(e){if(10!=(e||10))throw new Error("only base 10 is supported");for(var t=this.buf,n=t[t.length-1].toString(),r=t.length-2;r>=0;--r)n+=(b+t[r]).toString().substring(1);return n},e.prototype.valueOf=function(){for(var e=this.buf,t=0,n=e.length-1;n>=0;--n)t=t*b+e[n];return t},e.prototype.simplify=function(){var e=this.buf;return 1==e.length?e[0]:this},e}(),S="…",T=/^(\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/,C=/^(\d\d\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/;function E(e,t){return e.length>t&&(e=e.substring(0,t)+S),e}var k,x=function(){function e(t,n){this.hexDigits="0123456789ABCDEF",t instanceof e?(this.enc=t.enc,this.pos=t.pos):(this.enc=t,this.pos=n)}return e.prototype.get=function(e){if(void 0===e&&(e=this.pos++),e>=this.enc.length)throw new Error("Requesting byte offset ".concat(e," on a stream of length ").concat(this.enc.length));return"string"===typeof this.enc?this.enc.charCodeAt(e):this.enc[e]},e.prototype.hexByte=function(e){return this.hexDigits.charAt(e>>4&15)+this.hexDigits.charAt(15&e)},e.prototype.hexDump=function(e,t,n){for(var r="",o=e;o<t;++o)if(r+=this.hexByte(this.get(o)),!0!==n)switch(15&o){case 7:r+=" ";break;case 15:r+="\n";break;default:r+=" "}return r},e.prototype.isASCII=function(e,t){for(var n=e;n<t;++n){var r=this.get(n);if(r<32||r>176)return!1}return!0},e.prototype.parseStringISO=function(e,t){for(var n="",r=e;r<t;++r)n+=String.fromCharCode(this.get(r));return n},e.prototype.parseStringUTF=function(e,t){for(var n="",r=e;r<t;){var o=this.get(r++);n+=o<128?String.fromCharCode(o):o>191&&o<224?String.fromCharCode((31&o)<<6|63&this.get(r++)):String.fromCharCode((15&o)<<12|(63&this.get(r++))<<6|63&this.get(r++))}return n},e.prototype.parseStringBMP=function(e,t){for(var n,r,o="",i=e;i<t;)n=this.get(i++),r=this.get(i++),o+=String.fromCharCode(n<<8|r);return o},e.prototype.parseTime=function(e,t,n){var r=this.parseStringISO(e,t),o=(n?T:C).exec(r);return o?(n&&(o[1]=+o[1],o[1]+=+o[1]<70?2e3:1900),r=o[1]+"-"+o[2]+"-"+o[3]+" "+o[4],o[5]&&(r+=":"+o[5],o[6]&&(r+=":"+o[6],o[7]&&(r+="."+o[7]))),o[8]&&(r+=" UTC","Z"!=o[8]&&(r+=o[8],o[9]&&(r+=":"+o[9]))),r):"Unrecognized time: "+r},e.prototype.parseInteger=function(e,t){var n,r=this.get(e),o=r>127,i=o?255:0,s="";while(r==i&&++e<t)r=this.get(e);if(n=t-e,0===n)return o?-1:0;if(n>4){s=r,n<<=3;while(0==(128&(+s^i)))s=+s<<1,--n;s="("+n+" bit)\n"}o&&(r-=256);for(var a=new w(r),c=e+1;c<t;++c)a.mulAdd(256,this.get(c));return s+a.toString()},e.prototype.parseBitString=function(e,t,n){for(var r=this.get(e),o=(t-e-1<<3)-r,i="("+o+" bit)\n",s="",a=e+1;a<t;++a){for(var c=this.get(a),l=a==t-1?r:0,u=7;u>=l;--u)s+=c>>u&1?"1":"0";if(s.length>n)return i+E(s,n)}return i+s},e.prototype.parseOctetString=function(e,t,n){if(this.isASCII(e,t))return E(this.parseStringISO(e,t),n);var r=t-e,o="("+r+" byte)\n";n/=2,r>n&&(t=e+n);for(var i=e;i<t;++i)o+=this.hexByte(this.get(i));return r>n&&(o+=S),o},e.prototype.parseOID=function(e,t,n){for(var r="",o=new w,i=0,s=e;s<t;++s){var a=this.get(s);if(o.mulAdd(128,127&a),i+=7,!(128&a)){if(""===r)if(o=o.simplify(),o instanceof w)o.sub(80),r="2."+o.toString();else{var c=o<80?o<40?0:1:2;r=c+"."+(o-40*c)}else r+="."+o.toString();if(r.length>n)return E(r,n);o=new w,i=0}}return i>0&&(r+=".incomplete"),r},e}(),I=function(){function e(e,t,n,r,o){if(!(r instanceof R))throw new Error("Invalid tag value.");this.stream=e,this.header=t,this.length=n,this.tag=r,this.sub=o}return e.prototype.typeName=function(){switch(this.tag.tagClass){case 0:switch(this.tag.tagNumber){case 0:return"EOC";case 1:return"BOOLEAN";case 2:return"INTEGER";case 3:return"BIT_STRING";case 4:return"OCTET_STRING";case 5:return"NULL";case 6:return"OBJECT_IDENTIFIER";case 7:return"ObjectDescriptor";case 8:return"EXTERNAL";case 9:return"REAL";case 10:return"ENUMERATED";case 11:return"EMBEDDED_PDV";case 12:return"UTF8String";case 16:return"SEQUENCE";case 17:return"SET";case 18:return"NumericString";case 19:return"PrintableString";case 20:return"TeletexString";case 21:return"VideotexString";case 22:return"IA5String";case 23:return"UTCTime";case 24:return"GeneralizedTime";case 25:return"GraphicString";case 26:return"VisibleString";case 27:return"GeneralString";case 28:return"UniversalString";case 30:return"BMPString"}return"Universal_"+this.tag.tagNumber.toString();case 1:return"Application_"+this.tag.tagNumber.toString();case 2:return"["+this.tag.tagNumber.toString()+"]";case 3:return"Private_"+this.tag.tagNumber.toString()}},e.prototype.content=function(e){if(void 0===this.tag)return null;void 0===e&&(e=1/0);var t=this.posContent(),n=Math.abs(this.length);if(!this.tag.isUniversal())return null!==this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(t,t+n,e);switch(this.tag.tagNumber){case 1:return 0===this.stream.get(t)?"false":"true";case 2:return this.stream.parseInteger(t,t+n);case 3:return this.sub?"("+this.sub.length+" elem)":this.stream.parseBitString(t,t+n,e);case 4:return this.sub?"("+this.sub.length+" elem)":this.stream.parseOctetString(t,t+n,e);case 6:return this.stream.parseOID(t,t+n,e);case 16:case 17:return null!==this.sub?"("+this.sub.length+" elem)":"(no elem)";case 12:return E(this.stream.parseStringUTF(t,t+n),e);case 18:case 19:case 20:case 21:case 22:case 26:return E(this.stream.parseStringISO(t,t+n),e);case 30:return E(this.stream.parseStringBMP(t,t+n),e);case 23:case 24:return this.stream.parseTime(t,t+n,23==this.tag.tagNumber)}return null},e.prototype.toString=function(){return this.typeName()+"@"+this.stream.pos+"[header:"+this.header+",length:"+this.length+",sub:"+(null===this.sub?"null":this.sub.length)+"]"},e.prototype.toPrettyString=function(e){void 0===e&&(e="");var t=e+this.typeName()+" @"+this.stream.pos;if(this.length>=0&&(t+="+"),t+=this.length,this.tag.tagConstructed?t+=" (constructed)":!this.tag.isUniversal()||3!=this.tag.tagNumber&&4!=this.tag.tagNumber||null===this.sub||(t+=" (encapsulates)"),t+="\n",null!==this.sub){e+=" ";for(var n=0,r=this.sub.length;n<r;++n)t+=this.sub[n].toPrettyString(e)}return t},e.prototype.posStart=function(){return this.stream.pos},e.prototype.posContent=function(){return this.stream.pos+this.header},e.prototype.posEnd=function(){return this.stream.pos+this.header+Math.abs(this.length)},e.prototype.toHexString=function(){return this.stream.hexDump(this.posStart(),this.posEnd(),!0)},e.decodeLength=function(e){var t=e.get(),n=127&t;if(n==t)return n;if(n>6)throw new Error("Length over 48 bits not supported at position "+(e.pos-1));if(0===n)return null;t=0;for(var r=0;r<n;++r)t=256*t+e.get();return t},e.prototype.getHexStringValue=function(){var e=this.toHexString(),t=2*this.header,n=2*this.length;return e.substr(t,n)},e.decode=function(t){var n;n=t instanceof x?t:new x(t,0);var r=new x(n),o=new R(n),i=e.decodeLength(n),s=n.pos,a=s-r.pos,c=null,l=function(){var t=[];if(null!==i){var r=s+i;while(n.pos<r)t[t.length]=e.decode(n);if(n.pos!=r)throw new Error("Content size is not correct for container starting at offset "+s)}else try{for(;;){var o=e.decode(n);if(o.tag.isEOC())break;t[t.length]=o}i=s-n.pos}catch(a){throw new Error("Exception while decoding undefined length content: "+a)}return t};if(o.tagConstructed)c=l();else if(o.isUniversal()&&(3==o.tagNumber||4==o.tagNumber))try{if(3==o.tagNumber&&0!=n.get())throw new Error("BIT STRINGs with unused bits cannot encapsulate.");c=l();for(var u=0;u<c.length;++u)if(c[u].tag.isEOC())throw new Error("EOC is not supposed to be actual content.")}catch(d){c=null}if(null===c){if(null===i)throw new Error("We can't skip over an invalid tag with undefined length at offset "+s);n.pos=s+Math.abs(i)}return new e(r,a,i,o,c)},e}(),R=function(){function e(e){var t=e.get();if(this.tagClass=t>>6,this.tagConstructed=0!==(32&t),this.tagNumber=31&t,31==this.tagNumber){var n=new w;do{t=e.get(),n.mulAdd(128,127&t)}while(128&t);this.tagNumber=n.simplify()}}return e.prototype.isUniversal=function(){return 0===this.tagClass},e.prototype.isEOC=function(){return 0===this.tagClass&&0===this.tagNumber},e}(),_=0xdeadbeefcafe,N=15715070==(16777215&_),A=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],O=(1<<26)/A[A.length-1],P=function(){function e(e,t,n){null!=e&&("number"==typeof e?this.fromNumber(e,t,n):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}return e.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var n,r=(1<<t)-1,i=!1,s="",a=this.t,c=this.DB-a*this.DB%t;if(a-- >0){c<this.DB&&(n=this[a]>>c)>0&&(i=!0,s=o(n));while(a>=0)c<t?(n=(this[a]&(1<<c)-1)<<t-c,n|=this[--a]>>(c+=this.DB-t)):(n=this[a]>>(c-=t)&r,c<=0&&(c+=this.DB,--a)),n>0&&(i=!0),i&&(s+=o(n))}return i?s:"0"},e.prototype.negate=function(){var t=M();return e.ZERO.subTo(this,t),t},e.prototype.abs=function(){return this.s<0?this.negate():this},e.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var n=this.t;if(t=n-e.t,0!=t)return this.s<0?-t:t;while(--n>=0)if(0!=(t=this[n]-e[n]))return t;return 0},e.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+W(this[this.t-1]^this.s&this.DM)},e.prototype.mod=function(t){var n=M();return this.abs().divRemTo(t,null,n),this.s<0&&n.compareTo(e.ZERO)>0&&t.subTo(n,n),n},e.prototype.modPowInt=function(e,t){var n;return n=e<256||t.isEven()?new B(t):new j(t),this.exp(e,n)},e.prototype.clone=function(){var e=M();return this.copyTo(e),e},e.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},e.prototype.byteValue=function(){return 0==this.t?this.s:this[0]<<24>>24},e.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},e.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},e.prototype.toByteArray=function(){var e=this.t,t=[];t[0]=this.s;var n,r=this.DB-e*this.DB%8,o=0;if(e-- >0){r<this.DB&&(n=this[e]>>r)!=(this.s&this.DM)>>r&&(t[o++]=n|this.s<<this.DB-r);while(e>=0)r<8?(n=(this[e]&(1<<r)-1)<<8-r,n|=this[--e]>>(r+=this.DB-8)):(n=this[e]>>(r-=8)&255,r<=0&&(r+=this.DB,--e)),0!=(128&n)&&(n|=-256),0==o&&(128&this.s)!=(128&n)&&++o,(o>0||n!=this.s)&&(t[o++]=n)}return t},e.prototype.equals=function(e){return 0==this.compareTo(e)},e.prototype.min=function(e){return this.compareTo(e)<0?this:e},e.prototype.max=function(e){return this.compareTo(e)>0?this:e},e.prototype.and=function(e){var t=M();return this.bitwiseTo(e,i,t),t},e.prototype.or=function(e){var t=M();return this.bitwiseTo(e,s,t),t},e.prototype.xor=function(e){var t=M();return this.bitwiseTo(e,a,t),t},e.prototype.andNot=function(e){var t=M();return this.bitwiseTo(e,c,t),t},e.prototype.not=function(){for(var e=M(),t=0;t<this.t;++t)e[t]=this.DM&~this[t];return e.t=this.t,e.s=~this.s,e},e.prototype.shiftLeft=function(e){var t=M();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t},e.prototype.shiftRight=function(e){var t=M();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t},e.prototype.getLowestSetBit=function(){for(var e=0;e<this.t;++e)if(0!=this[e])return e*this.DB+l(this[e]);return this.s<0?this.t*this.DB:-1},e.prototype.bitCount=function(){for(var e=0,t=this.s&this.DM,n=0;n<this.t;++n)e+=u(this[n]^t);return e},e.prototype.testBit=function(e){var t=Math.floor(e/this.DB);return t>=this.t?0!=this.s:0!=(this[t]&1<<e%this.DB)},e.prototype.setBit=function(e){return this.changeBit(e,s)},e.prototype.clearBit=function(e){return this.changeBit(e,c)},e.prototype.flipBit=function(e){return this.changeBit(e,a)},e.prototype.add=function(e){var t=M();return this.addTo(e,t),t},e.prototype.subtract=function(e){var t=M();return this.subTo(e,t),t},e.prototype.multiply=function(e){var t=M();return this.multiplyTo(e,t),t},e.prototype.divide=function(e){var t=M();return this.divRemTo(e,t,null),t},e.prototype.remainder=function(e){var t=M();return this.divRemTo(e,null,t),t},e.prototype.divideAndRemainder=function(e){var t=M(),n=M();return this.divRemTo(e,t,n),[t,n]},e.prototype.modPow=function(e,t){var n,r,o=e.bitLength(),i=K(1);if(o<=0)return i;n=o<18?1:o<48?3:o<144?4:o<768?5:6,r=o<8?new B(t):t.isEven()?new H(t):new j(t);var s=[],a=3,c=n-1,l=(1<<n)-1;if(s[1]=r.convert(this),n>1){var u=M();r.sqrTo(s[1],u);while(a<=l)s[a]=M(),r.mulTo(u,s[a-2],s[a]),a+=2}var d,p,h=e.t-1,f=!0,g=M();o=W(e[h])-1;while(h>=0){o>=c?d=e[h]>>o-c&l:(d=(e[h]&(1<<o+1)-1)<<c-o,h>0&&(d|=e[h-1]>>this.DB+o-c)),a=n;while(0==(1&d))d>>=1,--a;if((o-=a)<0&&(o+=this.DB,--h),f)s[d].copyTo(i),f=!1;else{while(a>1)r.sqrTo(i,g),r.sqrTo(g,i),a-=2;a>0?r.sqrTo(i,g):(p=i,i=g,g=p),r.mulTo(g,s[d],i)}while(h>=0&&0==(e[h]&1<<o))r.sqrTo(i,g),p=i,i=g,g=p,--o<0&&(o=this.DB-1,--h)}return r.revert(i)},e.prototype.modInverse=function(t){var n=t.isEven();if(this.isEven()&&n||0==t.signum())return e.ZERO;var r=t.clone(),o=this.clone(),i=K(1),s=K(0),a=K(0),c=K(1);while(0!=r.signum()){while(r.isEven())r.rShiftTo(1,r),n?(i.isEven()&&s.isEven()||(i.addTo(this,i),s.subTo(t,s)),i.rShiftTo(1,i)):s.isEven()||s.subTo(t,s),s.rShiftTo(1,s);while(o.isEven())o.rShiftTo(1,o),n?(a.isEven()&&c.isEven()||(a.addTo(this,a),c.subTo(t,c)),a.rShiftTo(1,a)):c.isEven()||c.subTo(t,c),c.rShiftTo(1,c);r.compareTo(o)>=0?(r.subTo(o,r),n&&i.subTo(a,i),s.subTo(c,s)):(o.subTo(r,o),n&&a.subTo(i,a),c.subTo(s,c))}return 0!=o.compareTo(e.ONE)?e.ZERO:c.compareTo(t)>=0?c.subtract(t):c.signum()<0?(c.addTo(t,c),c.signum()<0?c.add(t):c):c},e.prototype.pow=function(e){return this.exp(e,new D)},e.prototype.gcd=function(e){var t=this.s<0?this.negate():this.clone(),n=e.s<0?e.negate():e.clone();if(t.compareTo(n)<0){var r=t;t=n,n=r}var o=t.getLowestSetBit(),i=n.getLowestSetBit();if(i<0)return t;o<i&&(i=o),i>0&&(t.rShiftTo(i,t),n.rShiftTo(i,n));while(t.signum()>0)(o=t.getLowestSetBit())>0&&t.rShiftTo(o,t),(o=n.getLowestSetBit())>0&&n.rShiftTo(o,n),t.compareTo(n)>=0?(t.subTo(n,t),t.rShiftTo(1,t)):(n.subTo(t,n),n.rShiftTo(1,n));return i>0&&n.lShiftTo(i,n),n},e.prototype.isProbablePrime=function(e){var t,n=this.abs();if(1==n.t&&n[0]<=A[A.length-1]){for(t=0;t<A.length;++t)if(n[0]==A[t])return!0;return!1}if(n.isEven())return!1;t=1;while(t<A.length){var r=A[t],o=t+1;while(o<A.length&&r<O)r*=A[o++];r=n.modInt(r);while(t<o)if(r%A[t++]==0)return!1}return n.millerRabin(e)},e.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s},e.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0},e.prototype.fromString=function(t,n){var r;if(16==n)r=4;else if(8==n)r=3;else if(256==n)r=8;else if(2==n)r=1;else if(32==n)r=5;else{if(4!=n)return void this.fromRadix(t,n);r=2}this.t=0,this.s=0;var o=t.length,i=!1,s=0;while(--o>=0){var a=8==r?255&+t[o]:z(t,o);a<0?"-"==t.charAt(o)&&(i=!0):(i=!1,0==s?this[this.t++]=a:s+r>this.DB?(this[this.t-1]|=(a&(1<<this.DB-s)-1)<<s,this[this.t++]=a>>this.DB-s):this[this.t-1]|=a<<s,s+=r,s>=this.DB&&(s-=this.DB))}8==r&&0!=(128&+t[0])&&(this.s=-1,s>0&&(this[this.t-1]|=(1<<this.DB-s)-1<<s)),this.clamp(),i&&e.ZERO.subTo(this,this)},e.prototype.clamp=function(){var e=this.s&this.DM;while(this.t>0&&this[this.t-1]==e)--this.t},e.prototype.dlShiftTo=function(e,t){var n;for(n=this.t-1;n>=0;--n)t[n+e]=this[n];for(n=e-1;n>=0;--n)t[n]=0;t.t=this.t+e,t.s=this.s},e.prototype.drShiftTo=function(e,t){for(var n=e;n<this.t;++n)t[n-e]=this[n];t.t=Math.max(this.t-e,0),t.s=this.s},e.prototype.lShiftTo=function(e,t){for(var n=e%this.DB,r=this.DB-n,o=(1<<r)-1,i=Math.floor(e/this.DB),s=this.s<<n&this.DM,a=this.t-1;a>=0;--a)t[a+i+1]=this[a]>>r|s,s=(this[a]&o)<<n;for(a=i-1;a>=0;--a)t[a]=0;t[i]=s,t.t=this.t+i+1,t.s=this.s,t.clamp()},e.prototype.rShiftTo=function(e,t){t.s=this.s;var n=Math.floor(e/this.DB);if(n>=this.t)t.t=0;else{var r=e%this.DB,o=this.DB-r,i=(1<<r)-1;t[0]=this[n]>>r;for(var s=n+1;s<this.t;++s)t[s-n-1]|=(this[s]&i)<<o,t[s-n]=this[s]>>r;r>0&&(t[this.t-n-1]|=(this.s&i)<<o),t.t=this.t-n,t.clamp()}},e.prototype.subTo=function(e,t){var n=0,r=0,o=Math.min(e.t,this.t);while(n<o)r+=this[n]-e[n],t[n++]=r&this.DM,r>>=this.DB;if(e.t<this.t){r-=e.s;while(n<this.t)r+=this[n],t[n++]=r&this.DM,r>>=this.DB;r+=this.s}else{r+=this.s;while(n<e.t)r-=e[n],t[n++]=r&this.DM,r>>=this.DB;r-=e.s}t.s=r<0?-1:0,r<-1?t[n++]=this.DV+r:r>0&&(t[n++]=r),t.t=n,t.clamp()},e.prototype.multiplyTo=function(t,n){var r=this.abs(),o=t.abs(),i=r.t;n.t=i+o.t;while(--i>=0)n[i]=0;for(i=0;i<o.t;++i)n[i+r.t]=r.am(0,o[i],n,i,0,r.t);n.s=0,n.clamp(),this.s!=t.s&&e.ZERO.subTo(n,n)},e.prototype.squareTo=function(e){var t=this.abs(),n=e.t=2*t.t;while(--n>=0)e[n]=0;for(n=0;n<t.t-1;++n){var r=t.am(n,t[n],e,2*n,0,1);(e[n+t.t]+=t.am(n+1,2*t[n],e,2*n+1,r,t.t-n-1))>=t.DV&&(e[n+t.t]-=t.DV,e[n+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(n,t[n],e,2*n,0,1)),e.s=0,e.clamp()},e.prototype.divRemTo=function(t,n,r){var o=t.abs();if(!(o.t<=0)){var i=this.abs();if(i.t<o.t)return null!=n&&n.fromInt(0),void(null!=r&&this.copyTo(r));null==r&&(r=M());var s=M(),a=this.s,c=t.s,l=this.DB-W(o[o.t-1]);l>0?(o.lShiftTo(l,s),i.lShiftTo(l,r)):(o.copyTo(s),i.copyTo(r));var u=s.t,d=s[u-1];if(0!=d){var p=d*(1<<this.F1)+(u>1?s[u-2]>>this.F2:0),h=this.FV/p,f=(1<<this.F1)/p,g=1<<this.F2,m=r.t,v=m-u,y=null==n?M():n;s.dlShiftTo(v,y),r.compareTo(y)>=0&&(r[r.t++]=1,r.subTo(y,r)),e.ONE.dlShiftTo(u,y),y.subTo(s,s);while(s.t<u)s[s.t++]=0;while(--v>=0){var b=r[--m]==d?this.DM:Math.floor(r[m]*h+(r[m-1]+g)*f);if((r[m]+=s.am(0,b,r,v,0,u))<b){s.dlShiftTo(v,y),r.subTo(y,r);while(r[m]<--b)r.subTo(y,r)}}null!=n&&(r.drShiftTo(u,n),a!=c&&e.ZERO.subTo(n,n)),r.t=u,r.clamp(),l>0&&r.rShiftTo(l,r),a<0&&e.ZERO.subTo(r,r)}}},e.prototype.invDigit=function(){if(this.t<1)return 0;var e=this[0];if(0==(1&e))return 0;var t=3&e;return t=t*(2-(15&e)*t)&15,t=t*(2-(255&e)*t)&255,t=t*(2-((65535&e)*t&65535))&65535,t=t*(2-e*t%this.DV)%this.DV,t>0?this.DV-t:-t},e.prototype.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},e.prototype.exp=function(t,n){if(t>4294967295||t<1)return e.ONE;var r=M(),o=M(),i=n.convert(this),s=W(t)-1;i.copyTo(r);while(--s>=0)if(n.sqrTo(r,o),(t&1<<s)>0)n.mulTo(o,i,r);else{var a=r;r=o,o=a}return n.revert(r)},e.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},e.prototype.toRadix=function(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),n=Math.pow(e,t),r=K(n),o=M(),i=M(),s="";this.divRemTo(r,o,i);while(o.signum()>0)s=(n+i.intValue()).toString(e).substr(1)+s,o.divRemTo(r,o,i);return i.intValue().toString(e)+s},e.prototype.fromRadix=function(t,n){this.fromInt(0),null==n&&(n=10);for(var r=this.chunkSize(n),o=Math.pow(n,r),i=!1,s=0,a=0,c=0;c<t.length;++c){var l=z(t,c);l<0?"-"==t.charAt(c)&&0==this.signum()&&(i=!0):(a=n*a+l,++s>=r&&(this.dMultiply(o),this.dAddOffset(a,0),s=0,a=0))}s>0&&(this.dMultiply(Math.pow(n,s)),this.dAddOffset(a,0)),i&&e.ZERO.subTo(this,this)},e.prototype.fromNumber=function(t,n,r){if("number"==typeof n)if(t<2)this.fromInt(1);else{this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(e.ONE.shiftLeft(t-1),s,this),this.isEven()&&this.dAddOffset(1,0);while(!this.isProbablePrime(n))this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(e.ONE.shiftLeft(t-1),this)}else{var o=[],i=7&t;o.length=1+(t>>3),n.nextBytes(o),i>0?o[0]&=(1<<i)-1:o[0]=0,this.fromString(o,256)}},e.prototype.bitwiseTo=function(e,t,n){var r,o,i=Math.min(e.t,this.t);for(r=0;r<i;++r)n[r]=t(this[r],e[r]);if(e.t<this.t){for(o=e.s&this.DM,r=i;r<this.t;++r)n[r]=t(this[r],o);n.t=this.t}else{for(o=this.s&this.DM,r=i;r<e.t;++r)n[r]=t(o,e[r]);n.t=e.t}n.s=t(this.s,e.s),n.clamp()},e.prototype.changeBit=function(t,n){var r=e.ONE.shiftLeft(t);return this.bitwiseTo(r,n,r),r},e.prototype.addTo=function(e,t){var n=0,r=0,o=Math.min(e.t,this.t);while(n<o)r+=this[n]+e[n],t[n++]=r&this.DM,r>>=this.DB;if(e.t<this.t){r+=e.s;while(n<this.t)r+=this[n],t[n++]=r&this.DM,r>>=this.DB;r+=this.s}else{r+=this.s;while(n<e.t)r+=e[n],t[n++]=r&this.DM,r>>=this.DB;r+=e.s}t.s=r<0?-1:0,r>0?t[n++]=r:r<-1&&(t[n++]=this.DV+r),t.t=n,t.clamp()},e.prototype.dMultiply=function(e){this[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},e.prototype.dAddOffset=function(e,t){if(0!=e){while(this.t<=t)this[this.t++]=0;this[t]+=e;while(this[t]>=this.DV)this[t]-=this.DV,++t>=this.t&&(this[this.t++]=0),++this[t]}},e.prototype.multiplyLowerTo=function(e,t,n){var r=Math.min(this.t+e.t,t);n.s=0,n.t=r;while(r>0)n[--r]=0;for(var o=n.t-this.t;r<o;++r)n[r+this.t]=this.am(0,e[r],n,r,0,this.t);for(o=Math.min(e.t,t);r<o;++r)this.am(0,e[r],n,r,0,t-r);n.clamp()},e.prototype.multiplyUpperTo=function(e,t,n){--t;var r=n.t=this.t+e.t-t;n.s=0;while(--r>=0)n[r]=0;for(r=Math.max(t-this.t,0);r<e.t;++r)n[this.t+r-t]=this.am(t-r,e[r],n,0,0,this.t+r-t);n.clamp(),n.drShiftTo(1,n)},e.prototype.modInt=function(e){if(e<=0)return 0;var t=this.DV%e,n=this.s<0?e-1:0;if(this.t>0)if(0==t)n=this[0]%e;else for(var r=this.t-1;r>=0;--r)n=(t*n+this[r])%e;return n},e.prototype.millerRabin=function(t){var n=this.subtract(e.ONE),r=n.getLowestSetBit();if(r<=0)return!1;var o=n.shiftRight(r);t=t+1>>1,t>A.length&&(t=A.length);for(var i=M(),s=0;s<t;++s){i.fromInt(A[Math.floor(Math.random()*A.length)]);var a=i.modPow(o,this);if(0!=a.compareTo(e.ONE)&&0!=a.compareTo(n)){var c=1;while(c++<r&&0!=a.compareTo(n))if(a=a.modPowInt(2,this),0==a.compareTo(e.ONE))return!1;if(0!=a.compareTo(n))return!1}}return!0},e.prototype.square=function(){var e=M();return this.squareTo(e),e},e.prototype.gcda=function(e,t){var n=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(n.compareTo(r)<0){var o=n;n=r,r=o}var i=n.getLowestSetBit(),s=r.getLowestSetBit();if(s<0)t(n);else{i<s&&(s=i),s>0&&(n.rShiftTo(s,n),r.rShiftTo(s,r));var a=function(){(i=n.getLowestSetBit())>0&&n.rShiftTo(i,n),(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),n.compareTo(r)>=0?(n.subTo(r,n),n.rShiftTo(1,n)):(r.subTo(n,r),r.rShiftTo(1,r)),n.signum()>0?setTimeout(a,0):(s>0&&r.lShiftTo(s,r),setTimeout((function(){t(r)}),0))};setTimeout(a,10)}},e.prototype.fromNumberAsync=function(t,n,r,o){if("number"==typeof n)if(t<2)this.fromInt(1);else{this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(e.ONE.shiftLeft(t-1),s,this),this.isEven()&&this.dAddOffset(1,0);var i=this,a=function(){i.dAddOffset(2,0),i.bitLength()>t&&i.subTo(e.ONE.shiftLeft(t-1),i),i.isProbablePrime(n)?setTimeout((function(){o()}),0):setTimeout(a,0)};setTimeout(a,0)}else{var c=[],l=7&t;c.length=1+(t>>3),n.nextBytes(c),l>0?c[0]&=(1<<l)-1:c[0]=0,this.fromString(c,256)}},e}(),D=function(){function e(){}return e.prototype.convert=function(e){return e},e.prototype.revert=function(e){return e},e.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n)},e.prototype.sqrTo=function(e,t){e.squareTo(t)},e}(),B=function(){function e(e){this.m=e}return e.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},e.prototype.revert=function(e){return e},e.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},e.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n),this.reduce(n)},e.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},e}(),j=function(){function e(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}return e.prototype.convert=function(e){var t=M();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(P.ZERO)>0&&this.m.subTo(t,t),t},e.prototype.revert=function(e){var t=M();return e.copyTo(t),this.reduce(t),t},e.prototype.reduce=function(e){while(e.t<=this.mt2)e[e.t++]=0;for(var t=0;t<this.m.t;++t){var n=32767&e[t],r=n*this.mpl+((n*this.mph+(e[t]>>15)*this.mpl&this.um)<<15)&e.DM;n=t+this.m.t,e[n]+=this.m.am(0,r,e,t,0,this.m.t);while(e[n]>=e.DV)e[n]-=e.DV,e[++n]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},e.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n),this.reduce(n)},e.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},e}(),H=function(){function e(e){this.m=e,this.r2=M(),this.q3=M(),P.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e)}return e.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=M();return e.copyTo(t),this.reduce(t),t},e.prototype.revert=function(e){return e},e.prototype.reduce=function(e){e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);while(e.compareTo(this.r2)<0)e.dAddOffset(1,this.m.t+1);e.subTo(this.r2,e);while(e.compareTo(this.m)>=0)e.subTo(this.m,e)},e.prototype.mulTo=function(e,t,n){e.multiplyTo(t,n),this.reduce(n)},e.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},e}();function M(){return new P(null)}function L(e,t){return new P(e,t)}var q="undefined"!==typeof navigator;q&&N&&"Microsoft Internet Explorer"==navigator.appName?(P.prototype.am=function(e,t,n,r,o,i){var s=32767&t,a=t>>15;while(--i>=0){var c=32767&this[e],l=this[e++]>>15,u=a*c+l*s;c=s*c+((32767&u)<<15)+n[r]+(1073741823&o),o=(c>>>30)+(u>>>15)+a*l+(o>>>30),n[r++]=1073741823&c}return o},k=30):q&&N&&"Netscape"!=navigator.appName?(P.prototype.am=function(e,t,n,r,o,i){while(--i>=0){var s=t*this[e++]+n[r]+o;o=Math.floor(s/67108864),n[r++]=67108863&s}return o},k=26):(P.prototype.am=function(e,t,n,r,o,i){var s=16383&t,a=t>>14;while(--i>=0){var c=16383&this[e],l=this[e++]>>14,u=a*c+l*s;c=s*c+((16383&u)<<14)+n[r]+o,o=(c>>28)+(u>>14)+a*l,n[r++]=268435455&c}return o},k=28),P.prototype.DB=k,P.prototype.DM=(1<<k)-1,P.prototype.DV=1<<k;var $=52;P.prototype.FV=Math.pow(2,$),P.prototype.F1=$-k,P.prototype.F2=2*k-$;var V,F,U=[];for(V="0".charCodeAt(0),F=0;F<=9;++F)U[V++]=F;for(V="a".charCodeAt(0),F=10;F<36;++F)U[V++]=F;for(V="A".charCodeAt(0),F=10;F<36;++F)U[V++]=F;function z(e,t){var n=U[e.charCodeAt(t)];return null==n?-1:n}function K(e){var t=M();return t.fromInt(e),t}function W(e){var t,n=1;return 0!=(t=e>>>16)&&(e=t,n+=16),0!=(t=e>>8)&&(e=t,n+=8),0!=(t=e>>4)&&(e=t,n+=4),0!=(t=e>>2)&&(e=t,n+=2),0!=(t=e>>1)&&(e=t,n+=1),n}P.ZERO=K(0),P.ONE=K(1);var G=function(){function e(){this.i=0,this.j=0,this.S=[]}return e.prototype.init=function(e){var t,n,r;for(t=0;t<256;++t)this.S[t]=t;for(n=0,t=0;t<256;++t)n=n+this.S[t]+e[t%e.length]&255,r=this.S[t],this.S[t]=this.S[n],this.S[n]=r;this.i=0,this.j=0},e.prototype.next=function(){var e;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,e=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=e,this.S[e+this.S[this.i]&255]},e}();function Y(){return new G}var J,Z,X=256,Q=null;if(null==Q){Q=[],Z=0;var ee=void 0;if("undefined"!==typeof window&&window.crypto&&window.crypto.getRandomValues){var te=new Uint32Array(256);for(window.crypto.getRandomValues(te),ee=0;ee<te.length;++ee)Q[Z++]=255&te[ee]}var ne=0,re=function(e){if(ne=ne||0,ne>=256||Z>=X)window.removeEventListener?window.removeEventListener("mousemove",re,!1):window.detachEvent&&window.detachEvent("onmousemove",re);else try{var t=e.x+e.y;Q[Z++]=255&t,ne+=1}catch(n){}};"undefined"!==typeof window&&(window.addEventListener?window.addEventListener("mousemove",re,!1):window.attachEvent&&window.attachEvent("onmousemove",re))}function oe(){if(null==J){J=Y();while(Z<X){var e=Math.floor(65536*Math.random());Q[Z++]=255&e}for(J.init(Q),Z=0;Z<Q.length;++Z)Q[Z]=0;Z=0}return J.next()}var ie=function(){function e(){}return e.prototype.nextBytes=function(e){for(var t=0;t<e.length;++t)e[t]=oe()},e}();function se(e,t){if(t<e.length+22)return console.error("Message too long for RSA"),null;for(var n=t-e.length-6,r="",o=0;o<n;o+=2)r+="ff";var i="0001"+r+"00"+e;return L(i,16)}function ae(e,t){if(t<e.length+11)return console.error("Message too long for RSA"),null;var n=[],r=e.length-1;while(r>=0&&t>0){var o=e.charCodeAt(r--);o<128?n[--t]=o:o>127&&o<2048?(n[--t]=63&o|128,n[--t]=o>>6|192):(n[--t]=63&o|128,n[--t]=o>>6&63|128,n[--t]=o>>12|224)}n[--t]=0;var i=new ie,s=[];while(t>2){s[0]=0;while(0==s[0])i.nextBytes(s);n[--t]=s[0]}return n[--t]=2,n[--t]=0,new P(n)}var ce=function(){function e(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}return e.prototype.doPublic=function(e){return e.modPowInt(this.e,this.n)},e.prototype.doPrivate=function(e){if(null==this.p||null==this.q)return e.modPow(this.d,this.n);var t=e.mod(this.p).modPow(this.dmp1,this.p),n=e.mod(this.q).modPow(this.dmq1,this.q);while(t.compareTo(n)<0)t=t.add(this.p);return t.subtract(n).multiply(this.coeff).mod(this.p).multiply(this.q).add(n)},e.prototype.setPublic=function(e,t){null!=e&&null!=t&&e.length>0&&t.length>0?(this.n=L(e,16),this.e=parseInt(t,16)):console.error("Invalid RSA public key")},e.prototype.encrypt=function(e){var t=this.n.bitLength()+7>>3,n=ae(e,t);if(null==n)return null;var r=this.doPublic(n);if(null==r)return null;for(var o=r.toString(16),i=o.length,s=0;s<2*t-i;s++)o="0"+o;return o},e.prototype.setPrivate=function(e,t,n){null!=e&&null!=t&&e.length>0&&t.length>0?(this.n=L(e,16),this.e=parseInt(t,16),this.d=L(n,16)):console.error("Invalid RSA private key")},e.prototype.setPrivateEx=function(e,t,n,r,o,i,s,a){null!=e&&null!=t&&e.length>0&&t.length>0?(this.n=L(e,16),this.e=parseInt(t,16),this.d=L(n,16),this.p=L(r,16),this.q=L(o,16),this.dmp1=L(i,16),this.dmq1=L(s,16),this.coeff=L(a,16)):console.error("Invalid RSA private key")},e.prototype.generate=function(e,t){var n=new ie,r=e>>1;this.e=parseInt(t,16);for(var o=new P(t,16);;){for(;;)if(this.p=new P(e-r,1,n),0==this.p.subtract(P.ONE).gcd(o).compareTo(P.ONE)&&this.p.isProbablePrime(10))break;for(;;)if(this.q=new P(r,1,n),0==this.q.subtract(P.ONE).gcd(o).compareTo(P.ONE)&&this.q.isProbablePrime(10))break;if(this.p.compareTo(this.q)<=0){var i=this.p;this.p=this.q,this.q=i}var s=this.p.subtract(P.ONE),a=this.q.subtract(P.ONE),c=s.multiply(a);if(0==c.gcd(o).compareTo(P.ONE)){this.n=this.p.multiply(this.q),this.d=o.modInverse(c),this.dmp1=this.d.mod(s),this.dmq1=this.d.mod(a),this.coeff=this.q.modInverse(this.p);break}}},e.prototype.decrypt=function(e){var t=L(e,16),n=this.doPrivate(t);return null==n?null:le(n,this.n.bitLength()+7>>3)},e.prototype.generateAsync=function(e,t,n){var r=new ie,o=e>>1;this.e=parseInt(t,16);var i=new P(t,16),s=this,a=function(){var t=function(){if(s.p.compareTo(s.q)<=0){var e=s.p;s.p=s.q,s.q=e}var t=s.p.subtract(P.ONE),r=s.q.subtract(P.ONE),o=t.multiply(r);0==o.gcd(i).compareTo(P.ONE)?(s.n=s.p.multiply(s.q),s.d=i.modInverse(o),s.dmp1=s.d.mod(t),s.dmq1=s.d.mod(r),s.coeff=s.q.modInverse(s.p),setTimeout((function(){n()}),0)):setTimeout(a,0)},c=function(){s.q=M(),s.q.fromNumberAsync(o,1,r,(function(){s.q.subtract(P.ONE).gcda(i,(function(e){0==e.compareTo(P.ONE)&&s.q.isProbablePrime(10)?setTimeout(t,0):setTimeout(c,0)}))}))},l=function(){s.p=M(),s.p.fromNumberAsync(e-o,1,r,(function(){s.p.subtract(P.ONE).gcda(i,(function(e){0==e.compareTo(P.ONE)&&s.p.isProbablePrime(10)?setTimeout(c,0):setTimeout(l,0)}))}))};setTimeout(l,0)};setTimeout(a,0)},e.prototype.sign=function(e,t,n){var r=de(n),o=r+t(e).toString(),i=se(o,this.n.bitLength()/4);if(null==i)return null;var s=this.doPrivate(i);if(null==s)return null;var a=s.toString(16);return 0==(1&a.length)?a:"0"+a},e.prototype.verify=function(e,t,n){var r=L(t,16),o=this.doPublic(r);if(null==o)return null;var i=o.toString(16).replace(/^1f+00/,""),s=pe(i);return s==n(e).toString()},e}();function le(e,t){var n=e.toByteArray(),r=0;while(r<n.length&&0==n[r])++r;if(n.length-r!=t-1||2!=n[r])return null;++r;while(0!=n[r])if(++r>=n.length)return null;var o="";while(++r<n.length){var i=255&n[r];i<128?o+=String.fromCharCode(i):i>191&&i<224?(o+=String.fromCharCode((31&i)<<6|63&n[r+1]),++r):(o+=String.fromCharCode((15&i)<<12|(63&n[r+1])<<6|63&n[r+2]),r+=2)}return o}var ue={md2:"3020300c06082a864886f70d020205000410",md5:"3020300c06082a864886f70d020505000410",sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",ripemd160:"3021300906052b2403020105000414"};function de(e){return ue[e]||""}function pe(e){for(var t in ue)if(ue.hasOwnProperty(t)){var n=ue[t],r=n.length;if(e.substr(0,r)==n)return e.substr(r)}return e}
|
|
17
|
+
/*!
|
|
18
|
+
Copyright (c) 2011, Yahoo! Inc. All rights reserved.
|
|
19
|
+
Code licensed under the BSD License:
|
|
20
|
+
http://developer.yahoo.com/yui/license.html
|
|
21
|
+
version: 2.9.0
|
|
22
|
+
*/
|
|
23
|
+
var he={};he.lang={extend:function(e,t,n){if(!t||!e)throw new Error("YAHOO.lang.extend failed, please check that all dependencies are included.");var r=function(){};if(r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e,e.superclass=t.prototype,t.prototype.constructor==Object.prototype.constructor&&(t.prototype.constructor=t),n){var o;for(o in n)e.prototype[o]=n[o];var i=function(){},s=["toString","valueOf"];try{/MSIE/.test(navigator.userAgent)&&(i=function(e,t){for(o=0;o<s.length;o+=1){var n=s[o],r=t[n];"function"===typeof r&&r!=Object.prototype[n]&&(e[n]=r)}})}catch(a){}i(e.prototype,n)}}};
|
|
24
|
+
/**
|
|
25
|
+
* @fileOverview
|
|
26
|
+
* @name asn1-1.0.js
|
|
27
|
+
* @author Kenji Urushima kenji.urushima@gmail.com
|
|
28
|
+
* @version asn1 1.0.13 (2017-Jun-02)
|
|
29
|
+
* @since jsrsasign 2.1
|
|
30
|
+
* @license <a href="https://kjur.github.io/jsrsasign/license/">MIT License</a>
|
|
31
|
+
*/
|
|
32
|
+
var fe={};"undefined"!=typeof fe.asn1&&fe.asn1||(fe.asn1={}),fe.asn1.ASN1Util=new function(){this.integerToByteHex=function(e){var t=e.toString(16);return t.length%2==1&&(t="0"+t),t},this.bigIntToMinTwosComplementsHex=function(e){var t=e.toString(16);if("-"!=t.substr(0,1))t.length%2==1?t="0"+t:t.match(/^[0-7]/)||(t="00"+t);else{var n=t.substr(1),r=n.length;r%2==1?r+=1:t.match(/^[0-7]/)||(r+=2);for(var o="",i=0;i<r;i++)o+="f";var s=new P(o,16),a=s.xor(e).add(P.ONE);t=a.toString(16).replace(/^-/,"")}return t},this.getPEMStringFromHex=function(e,t){return hextopem(e,t)},this.newObject=function(e){var t=fe,n=t.asn1,r=n.DERBoolean,o=n.DERInteger,i=n.DERBitString,s=n.DEROctetString,a=n.DERNull,c=n.DERObjectIdentifier,l=n.DEREnumerated,u=n.DERUTF8String,d=n.DERNumericString,p=n.DERPrintableString,h=n.DERTeletexString,f=n.DERIA5String,g=n.DERUTCTime,m=n.DERGeneralizedTime,v=n.DERSequence,y=n.DERSet,b=n.DERTaggedObject,w=n.ASN1Util.newObject,S=Object.keys(e);if(1!=S.length)throw"key of param shall be only one.";var T=S[0];if(-1==":bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:seq:set:tag:".indexOf(":"+T+":"))throw"undefined key: "+T;if("bool"==T)return new r(e[T]);if("int"==T)return new o(e[T]);if("bitstr"==T)return new i(e[T]);if("octstr"==T)return new s(e[T]);if("null"==T)return new a(e[T]);if("oid"==T)return new c(e[T]);if("enum"==T)return new l(e[T]);if("utf8str"==T)return new u(e[T]);if("numstr"==T)return new d(e[T]);if("prnstr"==T)return new p(e[T]);if("telstr"==T)return new h(e[T]);if("ia5str"==T)return new f(e[T]);if("utctime"==T)return new g(e[T]);if("gentime"==T)return new m(e[T]);if("seq"==T){for(var C=e[T],E=[],k=0;k<C.length;k++){var x=w(C[k]);E.push(x)}return new v({array:E})}if("set"==T){for(C=e[T],E=[],k=0;k<C.length;k++){x=w(C[k]);E.push(x)}return new y({array:E})}if("tag"==T){var I=e[T];if("[object Array]"===Object.prototype.toString.call(I)&&3==I.length){var R=w(I[2]);return new b({tag:I[0],explicit:I[1],obj:R})}var _={};if(void 0!==I.explicit&&(_.explicit=I.explicit),void 0!==I.tag&&(_.tag=I.tag),void 0===I.obj)throw"obj shall be specified for 'tag'.";return _.obj=w(I.obj),new b(_)}},this.jsonToASN1HEX=function(e){var t=this.newObject(e);return t.getEncodedHex()}},fe.asn1.ASN1Util.oidHexToInt=function(e){for(var t="",n=parseInt(e.substr(0,2),16),r=Math.floor(n/40),o=n%40,i=(t=r+"."+o,""),s=2;s<e.length;s+=2){var a=parseInt(e.substr(s,2),16),c=("00000000"+a.toString(2)).slice(-8);if(i+=c.substr(1,7),"0"==c.substr(0,1)){var l=new P(i,2);t=t+"."+l.toString(10),i=""}}return t},fe.asn1.ASN1Util.oidIntToHex=function(e){var t=function(e){var t=e.toString(16);return 1==t.length&&(t="0"+t),t},n=function(e){var n="",r=new P(e,10),o=r.toString(2),i=7-o.length%7;7==i&&(i=0);for(var s="",a=0;a<i;a++)s+="0";o=s+o;for(a=0;a<o.length-1;a+=7){var c=o.substr(a,7);a!=o.length-7&&(c="1"+c),n+=t(parseInt(c,2))}return n};if(!e.match(/^[0-9.]+$/))throw"malformed oid string: "+e;var r="",o=e.split("."),i=40*parseInt(o[0])+parseInt(o[1]);r+=t(i),o.splice(0,2);for(var s=0;s<o.length;s++)r+=n(o[s]);return r},fe.asn1.ASN1Object=function(){var e="";this.getLengthHexFromValue=function(){if("undefined"==typeof this.hV||null==this.hV)throw"this.hV is null or undefined.";if(this.hV.length%2==1)throw"value hex must be even length: n="+e.length+",v="+this.hV;var t=this.hV.length/2,n=t.toString(16);if(n.length%2==1&&(n="0"+n),t<128)return n;var r=n.length/2;if(r>15)throw"ASN.1 length too long to represent by 8x: n = "+t.toString(16);var o=128+r;return o.toString(16)+n},this.getEncodedHex=function(){return(null==this.hTLV||this.isModified)&&(this.hV=this.getFreshValueHex(),this.hL=this.getLengthHexFromValue(),this.hTLV=this.hT+this.hL+this.hV,this.isModified=!1),this.hTLV},this.getValueHex=function(){return this.getEncodedHex(),this.hV},this.getFreshValueHex=function(){return""}},fe.asn1.DERAbstractString=function(e){fe.asn1.DERAbstractString.superclass.constructor.call(this);this.getString=function(){return this.s},this.setString=function(e){this.hTLV=null,this.isModified=!0,this.s=e,this.hV=stohex(this.s)},this.setStringHex=function(e){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=e},this.getFreshValueHex=function(){return this.hV},"undefined"!=typeof e&&("string"==typeof e?this.setString(e):"undefined"!=typeof e["str"]?this.setString(e["str"]):"undefined"!=typeof e["hex"]&&this.setStringHex(e["hex"]))},he.lang.extend(fe.asn1.DERAbstractString,fe.asn1.ASN1Object),fe.asn1.DERAbstractTime=function(e){fe.asn1.DERAbstractTime.superclass.constructor.call(this);this.localDateToUTC=function(e){utc=e.getTime()+6e4*e.getTimezoneOffset();var t=new Date(utc);return t},this.formatDate=function(e,t,n){var r=this.zeroPadding,o=this.localDateToUTC(e),i=String(o.getFullYear());"utc"==t&&(i=i.substr(2,2));var s=r(String(o.getMonth()+1),2),a=r(String(o.getDate()),2),c=r(String(o.getHours()),2),l=r(String(o.getMinutes()),2),u=r(String(o.getSeconds()),2),d=i+s+a+c+l+u;if(!0===n){var p=o.getMilliseconds();if(0!=p){var h=r(String(p),3);h=h.replace(/[0]+$/,""),d=d+"."+h}}return d+"Z"},this.zeroPadding=function(e,t){return e.length>=t?e:new Array(t-e.length+1).join("0")+e},this.getString=function(){return this.s},this.setString=function(e){this.hTLV=null,this.isModified=!0,this.s=e,this.hV=stohex(e)},this.setByDateValue=function(e,t,n,r,o,i){var s=new Date(Date.UTC(e,t-1,n,r,o,i,0));this.setByDate(s)},this.getFreshValueHex=function(){return this.hV}},he.lang.extend(fe.asn1.DERAbstractTime,fe.asn1.ASN1Object),fe.asn1.DERAbstractStructured=function(e){fe.asn1.DERAbstractString.superclass.constructor.call(this);this.setByASN1ObjectArray=function(e){this.hTLV=null,this.isModified=!0,this.asn1Array=e},this.appendASN1Object=function(e){this.hTLV=null,this.isModified=!0,this.asn1Array.push(e)},this.asn1Array=new Array,"undefined"!=typeof e&&"undefined"!=typeof e["array"]&&(this.asn1Array=e["array"])},he.lang.extend(fe.asn1.DERAbstractStructured,fe.asn1.ASN1Object),fe.asn1.DERBoolean=function(){fe.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV="0101ff"},he.lang.extend(fe.asn1.DERBoolean,fe.asn1.ASN1Object),fe.asn1.DERInteger=function(e){fe.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.setByBigInteger=function(e){this.hTLV=null,this.isModified=!0,this.hV=fe.asn1.ASN1Util.bigIntToMinTwosComplementsHex(e)},this.setByInteger=function(e){var t=new P(String(e),10);this.setByBigInteger(t)},this.setValueHex=function(e){this.hV=e},this.getFreshValueHex=function(){return this.hV},"undefined"!=typeof e&&("undefined"!=typeof e["bigint"]?this.setByBigInteger(e["bigint"]):"undefined"!=typeof e["int"]?this.setByInteger(e["int"]):"number"==typeof e?this.setByInteger(e):"undefined"!=typeof e["hex"]&&this.setValueHex(e["hex"]))},he.lang.extend(fe.asn1.DERInteger,fe.asn1.ASN1Object),fe.asn1.DERBitString=function(e){if(void 0!==e&&"undefined"!==typeof e.obj){var t=fe.asn1.ASN1Util.newObject(e.obj);e.hex="00"+t.getEncodedHex()}fe.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(e){this.hTLV=null,this.isModified=!0,this.hV=e},this.setUnusedBitsAndHexValue=function(e,t){if(e<0||7<e)throw"unused bits shall be from 0 to 7: u = "+e;var n="0"+e;this.hTLV=null,this.isModified=!0,this.hV=n+t},this.setByBinaryString=function(e){e=e.replace(/0+$/,"");var t=8-e.length%8;8==t&&(t=0);for(var n=0;n<=t;n++)e+="0";var r="";for(n=0;n<e.length-1;n+=8){var o=e.substr(n,8),i=parseInt(o,2).toString(16);1==i.length&&(i="0"+i),r+=i}this.hTLV=null,this.isModified=!0,this.hV="0"+t+r},this.setByBooleanArray=function(e){for(var t="",n=0;n<e.length;n++)1==e[n]?t+="1":t+="0";this.setByBinaryString(t)},this.newFalseArray=function(e){for(var t=new Array(e),n=0;n<e;n++)t[n]=!1;return t},this.getFreshValueHex=function(){return this.hV},"undefined"!=typeof e&&("string"==typeof e&&e.toLowerCase().match(/^[0-9a-f]+$/)?this.setHexValueIncludingUnusedBits(e):"undefined"!=typeof e["hex"]?this.setHexValueIncludingUnusedBits(e["hex"]):"undefined"!=typeof e["bin"]?this.setByBinaryString(e["bin"]):"undefined"!=typeof e["array"]&&this.setByBooleanArray(e["array"]))},he.lang.extend(fe.asn1.DERBitString,fe.asn1.ASN1Object),fe.asn1.DEROctetString=function(e){if(void 0!==e&&"undefined"!==typeof e.obj){var t=fe.asn1.ASN1Util.newObject(e.obj);e.hex=t.getEncodedHex()}fe.asn1.DEROctetString.superclass.constructor.call(this,e),this.hT="04"},he.lang.extend(fe.asn1.DEROctetString,fe.asn1.DERAbstractString),fe.asn1.DERNull=function(){fe.asn1.DERNull.superclass.constructor.call(this),this.hT="05",this.hTLV="0500"},he.lang.extend(fe.asn1.DERNull,fe.asn1.ASN1Object),fe.asn1.DERObjectIdentifier=function(e){var t=function(e){var t=e.toString(16);return 1==t.length&&(t="0"+t),t},n=function(e){var n="",r=new P(e,10),o=r.toString(2),i=7-o.length%7;7==i&&(i=0);for(var s="",a=0;a<i;a++)s+="0";o=s+o;for(a=0;a<o.length-1;a+=7){var c=o.substr(a,7);a!=o.length-7&&(c="1"+c),n+=t(parseInt(c,2))}return n};fe.asn1.DERObjectIdentifier.superclass.constructor.call(this),this.hT="06",this.setValueHex=function(e){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=e},this.setValueOidString=function(e){if(!e.match(/^[0-9.]+$/))throw"malformed oid string: "+e;var r="",o=e.split("."),i=40*parseInt(o[0])+parseInt(o[1]);r+=t(i),o.splice(0,2);for(var s=0;s<o.length;s++)r+=n(o[s]);this.hTLV=null,this.isModified=!0,this.s=null,this.hV=r},this.setValueName=function(e){var t=fe.asn1.x509.OID.name2oid(e);if(""===t)throw"DERObjectIdentifier oidName undefined: "+e;this.setValueOidString(t)},this.getFreshValueHex=function(){return this.hV},void 0!==e&&("string"===typeof e?e.match(/^[0-2].[0-9.]+$/)?this.setValueOidString(e):this.setValueName(e):void 0!==e.oid?this.setValueOidString(e.oid):void 0!==e.hex?this.setValueHex(e.hex):void 0!==e.name&&this.setValueName(e.name))},he.lang.extend(fe.asn1.DERObjectIdentifier,fe.asn1.ASN1Object),fe.asn1.DEREnumerated=function(e){fe.asn1.DEREnumerated.superclass.constructor.call(this),this.hT="0a",this.setByBigInteger=function(e){this.hTLV=null,this.isModified=!0,this.hV=fe.asn1.ASN1Util.bigIntToMinTwosComplementsHex(e)},this.setByInteger=function(e){var t=new P(String(e),10);this.setByBigInteger(t)},this.setValueHex=function(e){this.hV=e},this.getFreshValueHex=function(){return this.hV},"undefined"!=typeof e&&("undefined"!=typeof e["int"]?this.setByInteger(e["int"]):"number"==typeof e?this.setByInteger(e):"undefined"!=typeof e["hex"]&&this.setValueHex(e["hex"]))},he.lang.extend(fe.asn1.DEREnumerated,fe.asn1.ASN1Object),fe.asn1.DERUTF8String=function(e){fe.asn1.DERUTF8String.superclass.constructor.call(this,e),this.hT="0c"},he.lang.extend(fe.asn1.DERUTF8String,fe.asn1.DERAbstractString),fe.asn1.DERNumericString=function(e){fe.asn1.DERNumericString.superclass.constructor.call(this,e),this.hT="12"},he.lang.extend(fe.asn1.DERNumericString,fe.asn1.DERAbstractString),fe.asn1.DERPrintableString=function(e){fe.asn1.DERPrintableString.superclass.constructor.call(this,e),this.hT="13"},he.lang.extend(fe.asn1.DERPrintableString,fe.asn1.DERAbstractString),fe.asn1.DERTeletexString=function(e){fe.asn1.DERTeletexString.superclass.constructor.call(this,e),this.hT="14"},he.lang.extend(fe.asn1.DERTeletexString,fe.asn1.DERAbstractString),fe.asn1.DERIA5String=function(e){fe.asn1.DERIA5String.superclass.constructor.call(this,e),this.hT="16"},he.lang.extend(fe.asn1.DERIA5String,fe.asn1.DERAbstractString),fe.asn1.DERUTCTime=function(e){fe.asn1.DERUTCTime.superclass.constructor.call(this,e),this.hT="17",this.setByDate=function(e){this.hTLV=null,this.isModified=!0,this.date=e,this.s=this.formatDate(this.date,"utc"),this.hV=stohex(this.s)},this.getFreshValueHex=function(){return"undefined"==typeof this.date&&"undefined"==typeof this.s&&(this.date=new Date,this.s=this.formatDate(this.date,"utc"),this.hV=stohex(this.s)),this.hV},void 0!==e&&(void 0!==e.str?this.setString(e.str):"string"==typeof e&&e.match(/^[0-9]{12}Z$/)?this.setString(e):void 0!==e.hex?this.setStringHex(e.hex):void 0!==e.date&&this.setByDate(e.date))},he.lang.extend(fe.asn1.DERUTCTime,fe.asn1.DERAbstractTime),fe.asn1.DERGeneralizedTime=function(e){fe.asn1.DERGeneralizedTime.superclass.constructor.call(this,e),this.hT="18",this.withMillis=!1,this.setByDate=function(e){this.hTLV=null,this.isModified=!0,this.date=e,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=stohex(this.s)},this.getFreshValueHex=function(){return void 0===this.date&&void 0===this.s&&(this.date=new Date,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=stohex(this.s)),this.hV},void 0!==e&&(void 0!==e.str?this.setString(e.str):"string"==typeof e&&e.match(/^[0-9]{14}Z$/)?this.setString(e):void 0!==e.hex?this.setStringHex(e.hex):void 0!==e.date&&this.setByDate(e.date),!0===e.millis&&(this.withMillis=!0))},he.lang.extend(fe.asn1.DERGeneralizedTime,fe.asn1.DERAbstractTime),fe.asn1.DERSequence=function(e){fe.asn1.DERSequence.superclass.constructor.call(this,e),this.hT="30",this.getFreshValueHex=function(){for(var e="",t=0;t<this.asn1Array.length;t++){var n=this.asn1Array[t];e+=n.getEncodedHex()}return this.hV=e,this.hV}},he.lang.extend(fe.asn1.DERSequence,fe.asn1.DERAbstractStructured),fe.asn1.DERSet=function(e){fe.asn1.DERSet.superclass.constructor.call(this,e),this.hT="31",this.sortFlag=!0,this.getFreshValueHex=function(){for(var e=new Array,t=0;t<this.asn1Array.length;t++){var n=this.asn1Array[t];e.push(n.getEncodedHex())}return 1==this.sortFlag&&e.sort(),this.hV=e.join(""),this.hV},"undefined"!=typeof e&&"undefined"!=typeof e.sortflag&&0==e.sortflag&&(this.sortFlag=!1)},he.lang.extend(fe.asn1.DERSet,fe.asn1.DERAbstractStructured),fe.asn1.DERTaggedObject=function(e){fe.asn1.DERTaggedObject.superclass.constructor.call(this),this.hT="a0",this.hV="",this.isExplicit=!0,this.asn1Object=null,this.setASN1Object=function(e,t,n){this.hT=t,this.isExplicit=e,this.asn1Object=n,this.isExplicit?(this.hV=this.asn1Object.getEncodedHex(),this.hTLV=null,this.isModified=!0):(this.hV=null,this.hTLV=n.getEncodedHex(),this.hTLV=this.hTLV.replace(/^../,t),this.isModified=!1)},this.getFreshValueHex=function(){return this.hV},"undefined"!=typeof e&&("undefined"!=typeof e["tag"]&&(this.hT=e["tag"]),"undefined"!=typeof e["explicit"]&&(this.isExplicit=e["explicit"]),"undefined"!=typeof e["obj"]&&(this.asn1Object=e["obj"],this.setASN1Object(this.isExplicit,this.hT,this.asn1Object)))},he.lang.extend(fe.asn1.DERTaggedObject,fe.asn1.ASN1Object);var ge,me=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!==typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),ve=function(e){function t(n){var r=e.call(this)||this;return n&&("string"===typeof n?r.parseKey(n):(t.hasPrivateKeyProperty(n)||t.hasPublicKeyProperty(n))&&r.parsePropertiesFrom(n)),r}return me(t,e),t.prototype.parseKey=function(e){try{var t=0,n=0,r=/^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/,o=r.test(e)?v.decode(e):y.unarmor(e),i=I.decode(o);if(3===i.sub.length&&(i=i.sub[2].sub[0]),9===i.sub.length){t=i.sub[1].getHexStringValue(),this.n=L(t,16),n=i.sub[2].getHexStringValue(),this.e=parseInt(n,16);var s=i.sub[3].getHexStringValue();this.d=L(s,16);var a=i.sub[4].getHexStringValue();this.p=L(a,16);var c=i.sub[5].getHexStringValue();this.q=L(c,16);var l=i.sub[6].getHexStringValue();this.dmp1=L(l,16);var u=i.sub[7].getHexStringValue();this.dmq1=L(u,16);var d=i.sub[8].getHexStringValue();this.coeff=L(d,16)}else{if(2!==i.sub.length)return!1;if(i.sub[0].sub){var p=i.sub[1],h=p.sub[0];t=h.sub[0].getHexStringValue(),this.n=L(t,16),n=h.sub[1].getHexStringValue(),this.e=parseInt(n,16)}else t=i.sub[0].getHexStringValue(),this.n=L(t,16),n=i.sub[1].getHexStringValue(),this.e=parseInt(n,16)}return!0}catch(f){return!1}},t.prototype.getPrivateBaseKey=function(){var e={array:[new fe.asn1.DERInteger({int:0}),new fe.asn1.DERInteger({bigint:this.n}),new fe.asn1.DERInteger({int:this.e}),new fe.asn1.DERInteger({bigint:this.d}),new fe.asn1.DERInteger({bigint:this.p}),new fe.asn1.DERInteger({bigint:this.q}),new fe.asn1.DERInteger({bigint:this.dmp1}),new fe.asn1.DERInteger({bigint:this.dmq1}),new fe.asn1.DERInteger({bigint:this.coeff})]},t=new fe.asn1.DERSequence(e);return t.getEncodedHex()},t.prototype.getPrivateBaseKeyB64=function(){return f(this.getPrivateBaseKey())},t.prototype.getPublicBaseKey=function(){var e=new fe.asn1.DERSequence({array:[new fe.asn1.DERObjectIdentifier({oid:"1.2.840.113549.1.1.1"}),new fe.asn1.DERNull]}),t=new fe.asn1.DERSequence({array:[new fe.asn1.DERInteger({bigint:this.n}),new fe.asn1.DERInteger({int:this.e})]}),n=new fe.asn1.DERBitString({hex:"00"+t.getEncodedHex()}),r=new fe.asn1.DERSequence({array:[e,n]});return r.getEncodedHex()},t.prototype.getPublicBaseKeyB64=function(){return f(this.getPublicBaseKey())},t.wordwrap=function(e,t){if(t=t||64,!e)return e;var n="(.{1,"+t+"})( +|$\n?)|(.{1,"+t+"})";return e.match(RegExp(n,"g")).join("\n")},t.prototype.getPrivateKey=function(){var e="-----BEGIN RSA PRIVATE KEY-----\n";return e+=t.wordwrap(this.getPrivateBaseKeyB64())+"\n",e+="-----END RSA PRIVATE KEY-----",e},t.prototype.getPublicKey=function(){var e="-----BEGIN PUBLIC KEY-----\n";return e+=t.wordwrap(this.getPublicBaseKeyB64())+"\n",e+="-----END PUBLIC KEY-----",e},t.hasPublicKeyProperty=function(e){return e=e||{},e.hasOwnProperty("n")&&e.hasOwnProperty("e")},t.hasPrivateKeyProperty=function(e){return e=e||{},e.hasOwnProperty("n")&&e.hasOwnProperty("e")&&e.hasOwnProperty("d")&&e.hasOwnProperty("p")&&e.hasOwnProperty("q")&&e.hasOwnProperty("dmp1")&&e.hasOwnProperty("dmq1")&&e.hasOwnProperty("coeff")},t.prototype.parsePropertiesFrom=function(e){this.n=e.n,this.e=e.e,e.hasOwnProperty("d")&&(this.d=e.d,this.p=e.p,this.q=e.q,this.dmp1=e.dmp1,this.dmq1=e.dmq1,this.coeff=e.coeff)},t}(ce),ye="undefined"!==typeof process?null===(ge={NODE_ENV:"production",BASE_URL:"/"})||void 0===ge?void 0:ge.npm_package_version:void 0,be=function(){function e(e){void 0===e&&(e={}),e=e||{},this.default_key_size=e.default_key_size?parseInt(e.default_key_size,10):1024,this.default_public_exponent=e.default_public_exponent||"010001",this.log=e.log||!1,this.key=null}return e.prototype.setKey=function(e){this.log&&this.key&&console.warn("A key was already set, overriding existing."),this.key=new ve(e)},e.prototype.setPrivateKey=function(e){this.setKey(e)},e.prototype.setPublicKey=function(e){this.setKey(e)},e.prototype.decrypt=function(e){try{return this.getKey().decrypt(g(e))}catch(t){return!1}},e.prototype.encrypt=function(e){try{return f(this.getKey().encrypt(e))}catch(t){return!1}},e.prototype.sign=function(e,t,n){try{return f(this.getKey().sign(e,t,n))}catch(r){return!1}},e.prototype.verify=function(e,t,n){try{return this.getKey().verify(e,g(t),n)}catch(r){return!1}},e.prototype.getKey=function(e){if(!this.key){if(this.key=new ve,e&&"[object Function]"==={}.toString.call(e))return void this.key.generateAsync(this.default_key_size,this.default_public_exponent,e);this.key.generate(this.default_key_size,this.default_public_exponent)}return this.key},e.prototype.getPrivateKey=function(){return this.getKey().getPrivateKey()},e.prototype.getPrivateKeyB64=function(){return this.getKey().getPrivateBaseKeyB64()},e.prototype.getPublicKey=function(){return this.getKey().getPublicKey()},e.prototype.getPublicKeyB64=function(){return this.getKey().getPublicBaseKeyB64()},e.version=ye,e}(),we=be},167:function(e,t,n){"use strict";n(87);var r=n(964),o=n(825),i=n(756),s=n(411),a=function(){return a=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},a.apply(this,arguments)};function c(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))}function l(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&a[0]?r.return:a[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(o=s.trys,!((o=o.length>0&&o[o.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}"function"==typeof SuppressedError&&SuppressedError;
|
|
33
|
+
/*!
|
|
34
|
+
* Socket.IO v4.7.2
|
|
35
|
+
* (c) 2014-2023 Guillermo Rauch
|
|
36
|
+
* Released under the MIT License.
|
|
37
|
+
*/
|
|
38
|
+
const u=Object.create(null);u.open="0",u.close="1",u.ping="2",u.pong="3",u.message="4",u.upgrade="5",u.noop="6";const d=Object.create(null);Object.keys(u).forEach((e=>{d[u[e]]=e}));const p={type:"error",data:"parser error"},h="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),f="function"==typeof ArrayBuffer,g=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,m=({type:e,data:t},n,r)=>h&&t instanceof Blob?n?r(t):v(t,r):f&&(t instanceof ArrayBuffer||g(t))?n?r(t):v(new Blob([t]),r):r(u[e]+(t||"")),v=(e,t)=>{const n=new FileReader;return n.onload=function(){const e=n.result.split(",")[1];t("b"+(e||""))},n.readAsDataURL(e)};function y(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let b;const w="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let je=0;je<64;je++)w["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charCodeAt(je)]=je;const S="function"==typeof ArrayBuffer,T=(e,t)=>{if("string"!=typeof e)return{type:"message",data:E(e,t)};const n=e.charAt(0);return"b"===n?{type:"message",data:C(e.substring(1),t)}:d[n]?e.length>1?{type:d[n],data:e.substring(1)}:{type:d[n]}:p},C=(e,t)=>{if(S){const n=(e=>{let t,n,r,o,i,s=.75*e.length,a=e.length,c=0;"="===e[e.length-1]&&(s--,"="===e[e.length-2]&&s--);const l=new ArrayBuffer(s),u=new Uint8Array(l);for(t=0;t<a;t+=4)n=w[e.charCodeAt(t)],r=w[e.charCodeAt(t+1)],o=w[e.charCodeAt(t+2)],i=w[e.charCodeAt(t+3)],u[c++]=n<<2|r>>4,u[c++]=(15&r)<<4|o>>2,u[c++]=(3&o)<<6|63&i;return l})(e);return E(n,t)}return{base64:!0,data:e}},E=(e,t)=>"blob"===t?e instanceof Blob?e:new Blob([e]):e instanceof ArrayBuffer?e:e.buffer,k=String.fromCharCode(30);function x(){return new TransformStream({transform(e,t){!function(e,t){h&&e.data instanceof Blob?e.data.arrayBuffer().then(y).then(t):f&&(e.data instanceof ArrayBuffer||g(e.data))?t(y(e.data)):m(e,!1,(e=>{b||(b=new TextEncoder),t(b.encode(e))}))}(e,(n=>{const r=n.length;let o;if(r<126)o=new Uint8Array(1),new DataView(o.buffer).setUint8(0,r);else if(r<65536){o=new Uint8Array(3);const e=new DataView(o.buffer);e.setUint8(0,126),e.setUint16(1,r)}else{o=new Uint8Array(9);const e=new DataView(o.buffer);e.setUint8(0,127),e.setBigUint64(1,BigInt(r))}e.data&&"string"!=typeof e.data&&(o[0]|=128),t.enqueue(o),t.enqueue(n)}))}})}let I;function R(e){return e.reduce(((e,t)=>e+t.length),0)}function _(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let r=0;for(let o=0;o<t;o++)n[o]=e[0][r++],r===e[0].length&&(e.shift(),r=0);return e.length&&r<e[0].length&&(e[0]=e[0].slice(r)),n}function N(e){if(e)return function(e){for(var t in N.prototype)e[t]=N.prototype[t];return e}(e)}N.prototype.on=N.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},N.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},N.prototype.off=N.prototype.removeListener=N.prototype.removeAllListeners=N.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,r=this._callbacks["$"+e];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var o=0;o<r.length;o++)if((n=r[o])===t||n.fn===t){r.splice(o,1);break}return 0===r.length&&delete this._callbacks["$"+e],this},N.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){r=0;for(var o=(n=n.slice(0)).length;r<o;++r)n[r].apply(this,t)}return this},N.prototype.emitReserved=N.prototype.emit,N.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},N.prototype.hasListeners=function(e){return!!this.listeners(e).length};const A="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")();function O(e,...t){return t.reduce(((t,n)=>(e.hasOwnProperty(n)&&(t[n]=e[n]),t)),{})}const P=A.setTimeout,D=A.clearTimeout;function B(e,t){t.useNativeTimers?(e.setTimeoutFn=P.bind(A),e.clearTimeoutFn=D.bind(A)):(e.setTimeoutFn=A.setTimeout.bind(A),e.clearTimeoutFn=A.clearTimeout.bind(A))}class j extends Error{constructor(e,t,n){super(e),this.description=t,this.context=n,this.type="TransportError"}}class H extends N{constructor(e){super(),this.writable=!1,B(this,e),this.opts=e,this.query=e.query,this.socket=e.socket}onError(e,t,n){return super.emitReserved("error",new j(e,t,n)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this}send(e){"open"===this.readyState&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=T(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){const e=this.opts.hostname;return-1===e.indexOf(":")?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(443!==this.opts.port)||!this.opts.secure&&80!==Number(this.opts.port))?":"+this.opts.port:""}_query(e){const t=function(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}(e);return t.length?"?"+t:""}}const M="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),L=64,q={};let $,V=0,F=0;function U(e){let t="";do{t=M[e%L]+t,e=Math.floor(e/L)}while(e>0);return t}function z(){const e=U(+new Date);return e!==$?(V=0,$=e):e+"."+U(V++)}for(;F<L;F++)q[M[F]]=F;let K=!1;try{K="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(u){}const W=K;function G(e){const t=e.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!t||W))return new XMLHttpRequest}catch(e){}if(!t)try{return new(A[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(e){}}function Y(){}const J=null!=new G({xdomain:!1}).responseType;class Z extends N{constructor(e,t){super(),B(this,t),this.opts=t,this.method=t.method||"GET",this.uri=e,this.data=void 0!==t.data?t.data:null,this.create()}create(){var e;const t=O(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this.opts.xd;const n=this.xhr=new G(t);try{n.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){n.setDisableHeaderCheck&&n.setDisableHeaderCheck(!0);for(let e in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(e)&&n.setRequestHeader(e,this.opts.extraHeaders[e])}}catch(e){}if("POST"===this.method)try{n.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(e){}try{n.setRequestHeader("Accept","*/*")}catch(e){}null===(e=this.opts.cookieJar)||void 0===e||e.addCookies(n),"withCredentials"in n&&(n.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(n.timeout=this.opts.requestTimeout),n.onreadystatechange=()=>{var e;3===n.readyState&&(null===(e=this.opts.cookieJar)||void 0===e||e.parseCookies(n)),4===n.readyState&&(200===n.status||1223===n.status?this.onLoad():this.setTimeoutFn((()=>{this.onError("number"==typeof n.status?n.status:0)}),0))},n.send(this.data)}catch(e){return void this.setTimeoutFn((()=>{this.onError(e)}),0)}"undefined"!=typeof document&&(this.index=Z.requestsCount++,Z.requests[this.index]=this)}onError(e){this.emitReserved("error",e,this.xhr),this.cleanup(!0)}cleanup(e){if(void 0!==this.xhr&&null!==this.xhr){if(this.xhr.onreadystatechange=Y,e)try{this.xhr.abort()}catch(e){}"undefined"!=typeof document&&delete Z.requests[this.index],this.xhr=null}}onLoad(){const e=this.xhr.responseText;null!==e&&(this.emitReserved("data",e),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}function X(){for(let e in Z.requests)Z.requests.hasOwnProperty(e)&&Z.requests[e].abort()}Z.requestsCount=0,Z.requests={},"undefined"!=typeof document&&("function"==typeof attachEvent?attachEvent("onunload",X):"function"==typeof addEventListener&&addEventListener("onpagehide"in A?"pagehide":"unload",X,!1));const Q="function"==typeof Promise&&"function"==typeof Promise.resolve?e=>Promise.resolve().then(e):(e,t)=>t(e,0),ee=A.WebSocket||A.MozWebSocket,te="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase(),ne={websocket:class extends H{constructor(e){super(e),this.supportsBinary=!e.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const e=this.uri(),t=this.opts.protocols,n=te?{}:O(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=te?new ee(e,t,n):t?new ee(e,t):new ee(e)}catch(e){return this.emitReserved("error",e)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const n=e[t],r=t===e.length-1;m(n,this.supportsBinary,(e=>{try{this.ws.send(e)}catch(e){}r&&Q((()=>{this.writable=!0,this.emitReserved("drain")}),this.setTimeoutFn)}))}}doClose(){void 0!==this.ws&&(this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=z()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}check(){return!!ee}},webtransport:class extends H{get name(){return"webtransport"}doOpen(){"function"==typeof WebTransport&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then((()=>{this.onClose()})).catch((e=>{this.onError("webtransport error",e)})),this.transport.ready.then((()=>{this.transport.createBidirectionalStream().then((e=>{const t=function(e,t){I||(I=new TextDecoder);const n=[];let r=0,o=-1,i=!1;return new TransformStream({transform(s,a){for(n.push(s);;){if(0===r){if(R(n)<1)break;const e=_(n,1);i=128==(128&e[0]),o=127&e[0],r=o<126?3:126===o?1:2}else if(1===r){if(R(n)<2)break;const e=_(n,2);o=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),r=3}else if(2===r){if(R(n)<8)break;const e=_(n,8),t=new DataView(e.buffer,e.byteOffset,e.length),i=t.getUint32(0);if(i>Math.pow(2,21)-1){a.enqueue(p);break}o=i*Math.pow(2,32)+t.getUint32(4),r=3}else{if(R(n)<o)break;const e=_(n,o);a.enqueue(T(i?e:I.decode(e),t)),r=0}if(0===o||o>e){a.enqueue(p);break}}}})}(Number.MAX_SAFE_INTEGER,this.socket.binaryType),n=e.readable.pipeThrough(t).getReader(),r=x();r.readable.pipeTo(e.writable),this.writer=r.writable.getWriter();const o=()=>{n.read().then((({done:e,value:t})=>{e||(this.onPacket(t),o())})).catch((e=>{}))};o();const i={type:"open"};this.query.sid&&(i.data=`{"sid":"${this.query.sid}"}`),this.writer.write(i).then((()=>this.onOpen()))}))})))}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const n=e[t],r=t===e.length-1;this.writer.write(n).then((()=>{r&&Q((()=>{this.writable=!0,this.emitReserved("drain")}),this.setTimeoutFn)}))}}doClose(){var e;null===(e=this.transport)||void 0===e||e.close()}},polling:class extends H{constructor(e){if(super(e),this.polling=!1,"undefined"!=typeof location){const t="https:"===location.protocol;let n=location.port;n||(n=t?"443":"80"),this.xd="undefined"!=typeof location&&e.hostname!==location.hostname||n!==e.port}const t=e&&e.forceBase64;this.supportsBinary=J&&!t,this.opts.withCredentials&&(this.cookieJar=void 0)}get name(){return"polling"}doOpen(){this.poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this.polling||!this.writable){let e=0;this.polling&&(e++,this.once("pollComplete",(function(){--e||t()}))),this.writable||(e++,this.once("drain",(function(){--e||t()})))}else t()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){((e,t)=>{const n=e.split(k),r=[];for(let o=0;o<n.length;o++){const e=T(n[o],t);if(r.push(e),"error"===e.type)break}return r})(e,this.socket.binaryType).forEach((e=>{if("opening"===this.readyState&&"open"===e.type&&this.onOpen(),"close"===e.type)return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(e)})),"closed"!==this.readyState&&(this.polling=!1,this.emitReserved("pollComplete"),"open"===this.readyState&&this.poll())}doClose(){const e=()=>{this.write([{type:"close"}])};"open"===this.readyState?e():this.once("open",e)}write(e){this.writable=!1,((e,t)=>{const n=e.length,r=new Array(n);let o=0;e.forEach(((e,i)=>{m(e,!1,(e=>{r[i]=e,++o===n&&t(r.join(k))}))}))})(e,(e=>{this.doWrite(e,(()=>{this.writable=!0,this.emitReserved("drain")}))}))}uri(){const e=this.opts.secure?"https":"http",t=this.query||{};return!1!==this.opts.timestampRequests&&(t[this.opts.timestampParam]=z()),this.supportsBinary||t.sid||(t.b64=1),this.createUri(e,t)}request(e={}){return Object.assign(e,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new Z(this.uri(),e)}doWrite(e,t){const n=this.request({method:"POST",data:e});n.on("success",t),n.on("error",((e,t)=>{this.onError("xhr post error",e,t)}))}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",((e,t)=>{this.onError("xhr poll error",e,t)})),this.pollXhr=e}}},re=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,oe=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function ie(e){const t=e,n=e.indexOf("["),r=e.indexOf("]");-1!=n&&-1!=r&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let o=re.exec(e||""),i={},s=14;for(;s--;)i[oe[s]]=o[s]||"";return-1!=n&&-1!=r&&(i.source=t,i.host=i.host.substring(1,i.host.length-1).replace(/;/g,":"),i.authority=i.authority.replace("[","").replace("]","").replace(/;/g,":"),i.ipv6uri=!0),i.pathNames=function(e,t){const n=t.replace(/\/{2,9}/g,"/").split("/");return"/"!=t.slice(0,1)&&0!==t.length||n.splice(0,1),"/"==t.slice(-1)&&n.splice(n.length-1,1),n}(0,i.path),i.queryKey=function(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,(function(e,t,r){t&&(n[t]=r)})),n}(0,i.query),i}class se extends N{constructor(e,t={}){super(),this.binaryType="arraybuffer",this.writeBuffer=[],e&&"object"==typeof e&&(t=e,e=null),e?(e=ie(e),t.hostname=e.host,t.secure="https"===e.protocol||"wss"===e.protocol,t.port=e.port,e.query&&(t.query=e.query)):t.host&&(t.hostname=ie(t.host).host),B(this,t),this.secure=null!=t.secure?t.secure:"undefined"!=typeof location&&"https:"===location.protocol,t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=t.port||("undefined"!=typeof location&&location.port?location.port:this.secure?"443":"80"),this.transports=t.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),"string"==typeof this.opts.query&&(this.opts.query=function(e){let t={},n=e.split("&");for(let r=0,o=n.length;r<o;r++){let e=n[r].split("=");t[decodeURIComponent(e[0])]=decodeURIComponent(e[1])}return t}(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,"function"==typeof addEventListener&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),"localhost"!==this.hostname&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=4,t.transport=e,this.id&&(t.sid=this.id);const n=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new ne[e](n)}open(){let e;if(this.opts.rememberUpgrade&&se.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))e="websocket";else{if(0===this.transports.length)return void this.setTimeoutFn((()=>{this.emitReserved("error","No transports available")}),0);e=this.transports[0]}this.readyState="opening";try{e=this.createTransport(e)}catch(e){return this.transports.shift(),void this.open()}e.open(),this.setTransport(e)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",(e=>this.onClose("transport close",e)))}probe(e){let t=this.createTransport(e),n=!1;se.priorWebsocketSuccess=!1;const r=()=>{n||(t.send([{type:"ping",data:"probe"}]),t.once("packet",(e=>{if(!n)if("pong"===e.type&&"probe"===e.data){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;se.priorWebsocketSuccess="websocket"===t.name,this.transport.pause((()=>{n||"closed"!==this.readyState&&(l(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())}))}else{const e=new Error("probe error");e.transport=t.name,this.emitReserved("upgradeError",e)}})))};function o(){n||(n=!0,l(),t.close(),t=null)}const i=e=>{const n=new Error("probe error: "+e);n.transport=t.name,o(),this.emitReserved("upgradeError",n)};function s(){i("transport closed")}function a(){i("socket closed")}function c(e){t&&e.name!==t.name&&o()}const l=()=>{t.removeListener("open",r),t.removeListener("error",i),t.removeListener("close",s),this.off("close",a),this.off("upgrading",c)};t.once("open",r),t.once("error",i),t.once("close",s),this.once("close",a),this.once("upgrading",c),-1!==this.upgrades.indexOf("webtransport")&&"webtransport"!==e?this.setTimeoutFn((()=>{n||t.open()}),200):t.open()}onOpen(){if(this.readyState="open",se.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush(),"open"===this.readyState&&this.opts.upgrade){let e=0;const t=this.upgrades.length;for(;e<t;e++)this.probe(this.upgrades[e])}}onPacket(e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),this.resetPingTimeout(),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this.sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong");break;case"error":const t=new Error("server error");t.code=e.data,this.onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data)}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this.upgrades=this.filterUpgrades(e.upgrades),this.pingInterval=e.pingInterval,this.pingTimeout=e.pingTimeout,this.maxPayload=e.maxPayload,this.onOpen(),"closed"!==this.readyState&&this.resetPingTimeout()}resetPingTimeout(){this.clearTimeoutFn(this.pingTimeoutTimer),this.pingTimeoutTimer=this.setTimeoutFn((()=>{this.onClose("ping timeout")}),this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,0===this.writeBuffer.length?this.emitReserved("drain"):this.flush()}flush(){if("closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this.getWritablePackets();this.transport.send(e),this.prevBufferLen=e.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&"polling"===this.transport.name&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let n=0;n<this.writeBuffer.length;n++){const r=this.writeBuffer[n].data;if(r&&(e+="string"==typeof(t=r)?function(e){let t=0,n=0;for(let r=0,o=e.length;r<o;r++)t=e.charCodeAt(r),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(r++,n+=4);return n}(t):Math.ceil(1.33*(t.byteLength||t.size))),n>0&&e>this.maxPayload)return this.writeBuffer.slice(0,n);e+=2}var t;return this.writeBuffer}write(e,t,n){return this.sendPacket("message",e,t,n),this}send(e,t,n){return this.sendPacket("message",e,t,n),this}sendPacket(e,t,n,r){if("function"==typeof t&&(r=t,t=void 0),"function"==typeof n&&(r=n,n=null),"closing"===this.readyState||"closed"===this.readyState)return;(n=n||{}).compress=!1!==n.compress;const o={type:e,data:t,options:n};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),r&&this.once("flush",r),this.flush()}close(){const e=()=>{this.onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},n=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return"opening"!==this.readyState&&"open"!==this.readyState||(this.readyState="closing",this.writeBuffer.length?this.once("drain",(()=>{this.upgrading?n():e()})):this.upgrading?n():e()),this}onError(e){se.priorWebsocketSuccess=!1,this.emitReserved("error",e),this.onClose("transport error",e)}onClose(e,t){"opening"!==this.readyState&&"open"!==this.readyState&&"closing"!==this.readyState||(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),"function"==typeof removeEventListener&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(e){const t=[];let n=0;const r=e.length;for(;n<r;n++)~this.transports.indexOf(e[n])&&t.push(e[n]);return t}}se.protocol=4;const ae="function"==typeof ArrayBuffer,ce=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,le=Object.prototype.toString,ue="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===le.call(Blob),de="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===le.call(File);function pe(e){return ae&&(e instanceof ArrayBuffer||ce(e))||ue&&e instanceof Blob||de&&e instanceof File}function he(e,t){if(!e||"object"!=typeof e)return!1;if(Array.isArray(e)){for(let t=0,n=e.length;t<n;t++)if(he(e[t]))return!0;return!1}if(pe(e))return!0;if(e.toJSON&&"function"==typeof e.toJSON&&1===arguments.length)return he(e.toJSON(),!0);for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&he(e[n]))return!0;return!1}function fe(e){const t=[],n=e.data,r=e;return r.data=ge(n,t),r.attachments=t.length,{packet:r,buffers:t}}function ge(e,t){if(!e)return e;if(pe(e)){const n={_placeholder:!0,num:t.length};return t.push(e),n}if(Array.isArray(e)){const n=new Array(e.length);for(let r=0;r<e.length;r++)n[r]=ge(e[r],t);return n}if("object"==typeof e&&!(e instanceof Date)){const n={};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=ge(e[r],t));return n}return e}function me(e,t){return e.data=ve(e.data,t),delete e.attachments,e}function ve(e,t){if(!e)return e;if(e&&!0===e._placeholder){if("number"==typeof e.num&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=ve(e[n],t);else if("object"==typeof e)for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=ve(e[n],t));return e}const ye=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var be;function we(e){return"[object Object]"===Object.prototype.toString.call(e)}!function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"}(be||(be={}));class Se extends N{constructor(e){super(),this.reviver=e}add(e){let t;if("string"==typeof e){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);const n=t.type===be.BINARY_EVENT;n||t.type===be.BINARY_ACK?(t.type=n?be.EVENT:be.ACK,this.reconstructor=new Te(t),0===t.attachments&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else{if(!pe(e)&&!e.base64)throw new Error("Unknown type: "+e);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t))}}decodeString(e){let t=0;const n={type:Number(e.charAt(0))};if(void 0===be[n.type])throw new Error("unknown packet type "+n.type);if(n.type===be.BINARY_EVENT||n.type===be.BINARY_ACK){const r=t+1;for(;"-"!==e.charAt(++t)&&t!=e.length;);const o=e.substring(r,t);if(o!=Number(o)||"-"!==e.charAt(t))throw new Error("Illegal attachments");n.attachments=Number(o)}if("/"===e.charAt(t+1)){const r=t+1;for(;++t&&","!==e.charAt(t)&&t!==e.length;);n.nsp=e.substring(r,t)}else n.nsp="/";const r=e.charAt(t+1);if(""!==r&&Number(r)==r){const r=t+1;for(;++t;){const n=e.charAt(t);if(null==n||Number(n)!=n){--t;break}if(t===e.length)break}n.id=Number(e.substring(r,t+1))}if(e.charAt(++t)){const r=this.tryParse(e.substr(t));if(!Se.isPayloadValid(n.type,r))throw new Error("invalid payload");n.data=r}return n}tryParse(e){try{return JSON.parse(e,this.reviver)}catch(e){return!1}}static isPayloadValid(e,t){switch(e){case be.CONNECT:return we(t);case be.DISCONNECT:return void 0===t;case be.CONNECT_ERROR:return"string"==typeof t||we(t);case be.EVENT:case be.BINARY_EVENT:return Array.isArray(t)&&("number"==typeof t[0]||"string"==typeof t[0]&&-1===ye.indexOf(t[0]));case be.ACK:case be.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Te{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const e=me(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}var Ce=Object.freeze({__proto__:null,protocol:5,get PacketType(){return be},Encoder:class{constructor(e){this.replacer=e}encode(e){return e.type!==be.EVENT&&e.type!==be.ACK||!he(e)?[this.encodeAsString(e)]:this.encodeAsBinary({type:e.type===be.EVENT?be.BINARY_EVENT:be.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id})}encodeAsString(e){let t=""+e.type;return e.type!==be.BINARY_EVENT&&e.type!==be.BINARY_ACK||(t+=e.attachments+"-"),e.nsp&&"/"!==e.nsp&&(t+=e.nsp+","),null!=e.id&&(t+=e.id),null!=e.data&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){const t=fe(e),n=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(n),r}},Decoder:Se});function Ee(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const ke=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class xe extends N{constructor(e,t,n){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,n&&n.auth&&(this.auth=n.auth),this._opts=Object.assign({},n),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[Ee(e,"open",this.onopen.bind(this)),Ee(e,"packet",this.onpacket.bind(this)),Ee(e,"error",this.onerror.bind(this)),Ee(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected||(this.subEvents(),this.io._reconnecting||this.io.open(),"open"===this.io._readyState&&this.onopen()),this}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){if(ke.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;const n={type:be.EVENT,data:t,options:{}};if(n.options.compress=!1!==this.flags.compress,"function"==typeof t[t.length-1]){const e=this.ids++,r=t.pop();this._registerAckCallback(e,r),n.id=e}const r=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!r||!this.connected)||(this.connected?(this.notifyOutgoingListeners(n),this.packet(n)):this.sendBuffer.push(n)),this.flags={},this}_registerAckCallback(e,t){var n;const r=null!==(n=this.flags.timeout)&&void 0!==n?n:this._opts.ackTimeout;if(void 0===r)return void(this.acks[e]=t);const o=this.io.setTimeoutFn((()=>{delete this.acks[e];for(let t=0;t<this.sendBuffer.length;t++)this.sendBuffer[t].id===e&&this.sendBuffer.splice(t,1);t.call(this,new Error("operation has timed out"))}),r);this.acks[e]=(...e)=>{this.io.clearTimeoutFn(o),t.apply(this,[null,...e])}}emitWithAck(e,...t){const n=void 0!==this.flags.timeout||void 0!==this._opts.ackTimeout;return new Promise(((r,o)=>{t.push(((e,t)=>n?e?o(e):r(t):r(e))),this.emit(e,...t)}))}_addToQueue(e){let t;"function"==typeof e[e.length-1]&&(t=e.pop());const n={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push(((e,...r)=>{if(n===this._queue[0])return null!==e?n.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(e)):(this._queue.shift(),t&&t(null,...r)),n.pending=!1,this._drainQueue()})),this._queue.push(n),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||0===this._queue.length)return;const t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){"function"==typeof this.auth?this.auth((e=>{this._sendConnectPacket(e)})):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:be.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t)}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case be.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case be.EVENT:case be.BINARY_EVENT:this.onevent(e);break;case be.ACK:case be.BINARY_ACK:this.onack(e);break;case be.DISCONNECT:this.ondisconnect();break;case be.CONNECT_ERROR:this.destroy();const t=new Error(e.data.message);t.data=e.data.data,this.emitReserved("connect_error",t)}}onevent(e){const t=e.data||[];null!=e.id&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const n of t)n.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&"string"==typeof e[e.length-1]&&(this._lastOffset=e[e.length-1])}ack(e){const t=this;let n=!1;return function(...r){n||(n=!0,t.packet({type:be.ACK,id:e,data:r}))}}onack(e){const t=this.acks[e.id];"function"==typeof t&&(t.apply(this,e.data),delete this.acks[e.id])}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach((e=>this.emitEvent(e))),this.receiveBuffer=[],this.sendBuffer.forEach((e=>{this.notifyOutgoingListeners(e),this.packet(e)})),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach((e=>e())),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:be.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const t=this._anyOutgoingListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const t=this._anyOutgoingListeners.slice();for(const n of t)n.apply(this,e.data)}}}function Ie(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}Ie.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=0==(1&Math.floor(10*t))?e-n:e+n}return 0|Math.min(e,this.max)},Ie.prototype.reset=function(){this.attempts=0},Ie.prototype.setMin=function(e){this.ms=e},Ie.prototype.setMax=function(e){this.max=e},Ie.prototype.setJitter=function(e){this.jitter=e};class Re extends N{constructor(e,t){var n;super(),this.nsps={},this.subs=[],e&&"object"==typeof e&&(t=e,e=void 0),(t=t||{}).path=t.path||"/socket.io",this.opts=t,B(this,t),this.reconnection(!1!==t.reconnection),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(null!==(n=t.randomizationFactor)&&void 0!==n?n:.5),this.backoff=new Ie({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this._readyState="closed",this.uri=e;const r=t.parser||Ce;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this._autoConnect=!1!==t.autoConnect,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection}reconnectionAttempts(e){return void 0===e?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return void 0===e?this._reconnectionDelay:(this._reconnectionDelay=e,null===(t=this.backoff)||void 0===t||t.setMin(e),this)}randomizationFactor(e){var t;return void 0===e?this._randomizationFactor:(this._randomizationFactor=e,null===(t=this.backoff)||void 0===t||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return void 0===e?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,null===(t=this.backoff)||void 0===t||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new se(this.uri,this.opts);const t=this.engine,n=this;this._readyState="opening",this.skipReconnect=!1;const r=Ee(t,"open",(function(){n.onopen(),e&&e()})),o=t=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",t),e?e(t):this.maybeReconnectOnOpen()},i=Ee(t,"error",o);if(!1!==this._timeout){const e=this._timeout,n=this.setTimeoutFn((()=>{r(),o(new Error("timeout")),t.close()}),e);this.opts.autoUnref&&n.unref(),this.subs.push((()=>{this.clearTimeoutFn(n)}))}return this.subs.push(r),this.subs.push(i),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(Ee(e,"ping",this.onping.bind(this)),Ee(e,"data",this.ondata.bind(this)),Ee(e,"error",this.onerror.bind(this)),Ee(e,"close",this.onclose.bind(this)),Ee(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(e){this.onclose("parse error",e)}}ondecoded(e){Q((()=>{this.emitReserved("packet",e)}),this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let n=this.nsps[e];return n?this._autoConnect&&!n.active&&n.connect():(n=new xe(this,e,t),this.nsps[e]=n),n}_destroy(e){const t=Object.keys(this.nsps);for(const n of t)if(this.nsps[n].active)return;this._close()}_packet(e){const t=this.encoder.encode(e);for(let n=0;n<t.length;n++)this.engine.write(t[n],e.options)}cleanup(){this.subs.forEach((e=>e())),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(e,t){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const n=this.setTimeoutFn((()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),e.skipReconnect||e.open((t=>{t?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",t)):e.onreconnect()})))}),t);this.opts.autoUnref&&n.unref(),this.subs.push((()=>{this.clearTimeoutFn(n)}))}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const _e={};function Ne(e,t){"object"==typeof e&&(t=e,e=void 0);const n=function(e,t="",n){let r=e;n=n||"undefined"!=typeof location&&location,null==e&&(e=n.protocol+"//"+n.host),"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?n.protocol+e:n.host+e),/^(https?|wss?):\/\//.test(e)||(e=void 0!==n?n.protocol+"//"+e:"https://"+e),r=ie(e)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const o=-1!==r.host.indexOf(":")?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+o+":"+r.port+t,r.href=r.protocol+"://"+o+(n&&n.port===r.port?"":":"+r.port),r}(e,(t=t||{}).path||"/socket.io"),r=n.source,o=n.id,i=n.path,s=_e[o]&&i in _e[o].nsps;let a;return t.forceNew||t["force new connection"]||!1===t.multiplex||s?a=new Re(r,t):(_e[o]||(_e[o]=new Re(r,t)),a=_e[o]),n.query&&!t.query&&(t.query=n.queryKey),a.socket(n.path,t)}Object.assign(Ne,{Manager:Re,Socket:xe,io:Ne,connect:Ne});var Ae={notOpenAudioMsg:"麦克风没有开启",notOpenAudioCode:403,notOpenAudioMsgEn:"Permission dismissed"},Oe={forbiddenAudioMsg:"请先检查您的麦克风是否开启",forbiddenAudioCode:0,forbiddenAudioMsgEn:"Permission denied"},Pe=function(){function e(e){var n=this;void 0===e&&(e={}),this.getWebrtcInfo=function(e,n){t.request(e+"/call/api/sip/webrtc/config/query",{verb:"GET",loginToken:t.loginToken,sessionId:t.agentInfo._id,success:function(e){e.success&&e.data?(t.agentextras=e.data,t.initWebrtcEvent(e.data)):n.error(a({},e))},error:function(e){n.error({error:e})}})},this.initAttachEvent=function(e,r,o,i,s){n.attachEventCallbacks&&t.request(e+"/platform/action/refreshWsToken",{verb:"GET",loginToken:t.loginToken,sessionId:t.agentInfo._id,success:function(e){if(e&&e.data){var a="";o.forEach((function(e){"KF"===e.id&&(a=e.url)})),n.attachEventCallbacks.serve=a,n.attachEventCallbacks.SocketOptions={query:{accountId:i.accountId,agentNumber:i.agentNumber,agentId:i._id,token:e.data.wsToken,wsExtra:JSON.stringify({loginType:r,channelType:"SDK",ability:["call"]}),timestamp:e.data.timestamp,clientType:1},reconnectionDelay:3e3,"force new connection":!0,transports:["websocket"],timeout:5e3},n.attachEventCallbacks.suc=s,t.createEventHandle(n.attachEventCallbacks)}},error:function(e){o.error({error:e})}})},this.openMediaAudio=function(e,t){var n=navigator,r=n.mediaDevices,o=n.getUserMedia,i=n.webkitGetUserMedia,s=n.mozGetUserMedia,a=n.msGetUserMedia,c=(o||i||s||a).bind(navigator);return r?navigator.mediaDevices.getUserMedia({audio:!0}).catch((function(n){var r=n.message.includes("denied");return t?(r&&alert(Oe.forbiddenAudioMsg),e&&!r&&alert(e),r?Oe:Ae):r?Oe:Ae})):new Promise((function(n,r){c?c({audio:!0},(function(e){n(!0)}),(function(n){t&&e&&alert(e),r(Ae)})):r(Ae)}))},this.listenCallEvent=function(e){n.attachEventCallbacks=e},this._callApi=function(){var e,r,o=n;return{callout:function(n){return c(this,void 0,void 0,(function(){var i,s,c,u,d,p;return l(this,(function(l){switch(l.label){case 0:if(n.success=n&&"function"==typeof n.success?n.success:t.noop,n.fail=n&&"function"==typeof n.fail?n.fail:t.noop,null===t.loginToken||void 0===t.loginToken)return n.fail({success:!1,message:"initialization not complete!"}),[2];if(null===t.agentInfo||void 0===t.agentInfo)return n.fail({success:!1,message:"initialization not complete!"}),[2];if(null===n.customerNumber||void 0===n.customerNumber)return n.fail({success:!1,message:"Parameter customerNumber is required!"}),[2];if("WEBRTC"!==t.initOptions.loginType)return[3,4];l.label=1;case 1:return l.trys.push([1,3,,4]),[4,navigator.mediaDevices.getUserMedia({audio:!0})];case 2:return l.sent(),[3,4];case 3:return l.sent(),n.fail({success:!1,message:"无麦克风权限!"}),[2];case 4:if(i=t.initOptions.server||t.callApiUrl,s={customerNumber:n.customerNumber,agentNumber:t.agentInfo.agentNumber,accountId:t.agentInfo.accountId,agentId:t.agentInfo._id,loginType:n.loginType||t.agentInfo.loginType||t.initOptions.loginType},n.agentTimeout&&(s.agentTimeout=n.agentTimeout),n.customerTimeout&&(s.customerTimeout=n.customerTimeout),n.agentDisNumber&&(s.agentDisNumber=n.agentDisNumber),n.customerDisNumber&&(s.customerDisNumber=n.customerDisNumber),n.extras&&(s.extras=n.extras),n.numberGroupId&&(s.numberGroupId=n.numberGroupId),n.numberGroupName&&(s.numberGroupName=n.numberGroupName),c=t.initOptions,u=!0,"WEBRTC"!==c.loginType)return[3,8];l.label=5;case 5:return l.trys.push([5,7,,8]),[4,o.openMediaAudio("请打开麦克风权限!",u)];case 6:return d=l.sent()||{},[3,8];case 7:return p=l.sent(),console.log(p),[3,8];case 8:return t.request(i+"/call/api/call/call/out",{verb:"POST",body:s,loginToken:t.loginToken,sessionId:t.agentInfo._id,encryptionAlgorithm:e,encryptionFields:r,success:function(e){e.success?n.success(a({success:!0,message:"callout success"},d)):n.fail(a({success:!1,message:e.message,code:e.code},d))}}),[2]}}))}))},hangup:function(n){if(n.success=n&&"function"==typeof n.success?n.success:t.noop,n.fail=n&&"function"==typeof n.fail?n.fail:t.noop,null!==t.loginToken&&void 0!==t.loginToken)if(null!==t.agentInfo&&void 0!==t.agentInfo){var o=t.initOptions.server||t.callApiUrl;t.request(o+"/call/api/call/hangup",{verb:"POST",body:{},loginToken:t.loginToken,sessionId:t.agentInfo._id,accountId:t.agentInfo.accountId,encryptionAlgorithm:e,encryptionFields:r,success:function(e){e.success?n.success({success:!0,message:"hangup success",data:e.data.response.data}):n.fail({success:!1,message:e.message,code:e.code})}})}else n.fail({success:!1,message:"initialization not complete!"});else n.fail({success:!1,message:"initialization not complete!"})},holdOrUnHold:function(n){if(n.success=n&&"function"==typeof n.success?n.success:t.noop,n.fail=n&&"function"==typeof n.fail?n.fail:t.noop,null!==t.loginToken&&void 0!==t.loginToken)if(null!==t.agentInfo&&void 0!==t.agentInfo)if(null!==n.type&&void 0!==n.type){var o=t.initOptions.server||t.callApiUrl,i={type:n.type};t.request(o+"/call/api/call/hold",{verb:"POST",body:i,loginToken:t.loginToken,sessionId:t.agentInfo._id,accountId:t.agentInfo.accountId,encryptionAlgorithm:e,encryptionFields:r,success:function(e){e.success?n.success({success:!0,message:"holdOrUnHold success"}):n.fail({success:!1,message:e.message,code:e.code})}})}else n.fail({success:!1,message:"Parameter type is required!"});else n.fail({success:!1,message:"initialization not complete!"});else n.fail({success:!1,message:"initialization not complete!"})},muteOrUnMute:function(n){if(n.success=n&&"function"==typeof n.success?n.success:t.noop,n.fail=n&&"function"==typeof n.fail?n.fail:t.noop,null!==t.loginToken&&void 0!==t.loginToken)if(null!==t.agentInfo&&void 0!==t.agentInfo)if(null!==n.type&&void 0!==n.type){var o=t.initOptions.server||t.callApiUrl,i={type:n.type,direction:n.direction||"all"};t.request(o+"/call/api/call/mute",{verb:"POST",body:i,loginToken:t.loginToken,sessionId:t.agentInfo._id,accountId:t.agentInfo.accountId,encryptionAlgorithm:e,encryptionFields:r,success:function(e){e.success?n.success({success:!0,message:"muteOrUnMute success"}):n.fail({success:!1,message:e.message,code:e.code})}})}else n.fail({success:!1,message:"Parameter type is required!"});else n.fail({success:!1,message:"initialization not complete!"});else n.fail({success:!1,message:"initialization not complete!"})},transfer:function(n){if(n.success=n&&"function"==typeof n.success?n.success:t.noop,n.fail=n&&"function"==typeof n.fail?n.fail:t.noop,null!==t.loginToken&&void 0!==t.loginToken)if(null!==t.agentInfo&&void 0!==t.agentInfo)if(null!==n.type&&void 0!==n.type)if(null!==n.number&&void 0!==n.number){var o=t.initOptions.server||t.callApiUrl;t.request(o+"/call/api/call/transfer",{verb:"POST",body:n,loginToken:t.loginToken,sessionId:t.agentInfo._id,accountId:t.agentInfo.accountId,encryptionAlgorithm:e,encryptionFields:r,success:function(e){e.success?n.success({success:!0,message:"transfer success",data:e.data.response.data}):n.fail({success:!1,message:e.message,code:e.code})}})}else n.fail({success:!1,message:"Parameter number is required!"});else n.fail({success:!1,message:"Parameter type is required!"});else n.fail({success:!1,message:"initialization not complete!"});else n.fail({success:!1,message:"initialization not complete!"})},consult:function(n){if(n.success=n&&"function"==typeof n.success?n.success:t.noop,n.fail=n&&"function"==typeof n.fail?n.fail:t.noop,null!==t.loginToken&&void 0!==t.loginToken)if(null!==t.agentInfo&&void 0!==t.agentInfo)if(null!==n.mode&&void 0!==n.mode)if(null!==n.number&&void 0!==n.number){n.agentNumber=t.agentInfo.agentNumber;var o=t.initOptions.server||t.callApiUrl;t.request(o+"/call/api/call/consult",{verb:"POST",body:n,loginToken:t.loginToken,sessionId:t.agentInfo._id,accountId:t.agentInfo.accountId,encryptionAlgorithm:e,encryptionFields:r,success:function(e){e.success?n.success({success:!0,message:"consult success",data:e.data.response.data}):n.fail({success:!1,message:e.message,code:e.code})}})}else n.fail({success:!1,message:"Parameter number is required!"});else n.fail({success:!1,message:"Parameter mode is required!"});else n.fail({success:!1,message:"initialization not complete!"});else n.fail({success:!1,message:"initialization not complete!"})},cancelconsult:function(n){if(n.success=n&&"function"==typeof n.success?n.success:t.noop,n.fail=n&&"function"==typeof n.fail?n.fail:t.noop,null!==t.loginToken&&void 0!==t.loginToken)if(null!==t.agentInfo&&void 0!==t.agentInfo){var o=t.initOptions.server||t.callApiUrl;t.request(o+"/call/api/call/consult/cancel",{verb:"POST",body:n,loginToken:t.loginToken,sessionId:t.agentInfo._id,accountId:t.agentInfo.accountId,encryptionAlgorithm:e,encryptionFields:r,success:function(e){e.success?n.success({success:!0,message:"cancelconsult success",data:e.data.response.data}):n.fail({success:!1,message:e.message,code:e.code})}})}else n.fail({success:!1,message:"initialization not complete!"});else n.fail({success:!1,message:"initialization not complete!"})},endConsult:function(n){if(n.success=n&&"function"==typeof n.success?n.success:t.noop,n.fail=n&&"function"==typeof n.fail?n.fail:t.noop,null!==t.loginToken&&void 0!==t.loginToken)if(null!==t.agentInfo&&void 0!==t.agentInfo){var o=t.initOptions.server||t.callApiUrl;t.request(o+"/call/api/call/consult/stop",{verb:"POST",body:n,loginToken:t.loginToken,sessionId:t.agentInfo._id,accountId:t.agentInfo.accountId,encryptionAlgorithm:e,encryptionFields:r,success:function(e){e.success?n.success({success:!0,message:"endConsult success",data:e.data.response.data}):n.fail({success:!1,message:e.message,code:e.code})}})}else n.fail({success:!1,message:"initialization not complete!"});else n.fail({success:!1,message:"initialization not complete!"})},callbackConsult:function(n){if(n.success=n&&"function"==typeof n.success?n.success:t.noop,n.fail=n&&"function"==typeof n.fail?n.fail:t.noop,null!==t.loginToken&&void 0!==t.loginToken)if(null!==t.agentInfo&&void 0!==t.agentInfo){var o=t.initOptions.server||t.callApiUrl;t.request(o+"/call/api/call/consult/resume",{verb:"POST",body:n,loginToken:t.loginToken,sessionId:t.agentInfo._id,accountId:t.agentInfo.accountId,encryptionAlgorithm:e,encryptionFields:r,success:function(e){e.success?n.success({success:!0,message:"resumeConsult success",data:e.data.response.data}):n.fail({success:!1,message:e.message,code:e.code})}})}else n.fail({success:!1,message:"initialization not complete!"});else n.fail({success:!1,message:"initialization not complete!"})},consultTransfer:function(n){if(n.success=n&&"function"==typeof n.success?n.success:t.noop,n.fail=n&&"function"==typeof n.fail?n.fail:t.noop,null!==t.loginToken&&void 0!==t.loginToken)if(null!==t.agentInfo&&void 0!==t.agentInfo){var o=t.initOptions.server||t.callApiUrl;t.request(o+"/call/api/call/consult/transfer",{verb:"POST",body:n,loginToken:t.loginToken,sessionId:t.agentInfo._id,accountId:t.agentInfo.accountId,encryptionAlgorithm:e,encryptionFields:r,success:function(e){e.success?n.success({success:!0,message:"consultTransfer success",data:e.data.response.data}):n.fail({success:!1,message:e.message,code:e.code})}})}else n.fail({success:!1,message:"initialization not complete!"});else n.fail({success:!1,message:"initialization not complete!"})},threeWayCall:function(n){if(n.success=n&&"function"==typeof n.success?n.success:t.noop,n.fail=n&&"function"==typeof n.fail?n.fail:t.noop,null!==t.loginToken&&void 0!==t.loginToken)if(null!==t.agentInfo&&void 0!==t.agentInfo){var o=t.initOptions.server||t.callApiUrl;t.request(o+"/call/api/call/threeway",{verb:"POST",body:n,loginToken:t.loginToken,sessionId:t.agentInfo._id,accountId:t.agentInfo.accountId,encryptionAlgorithm:e,encryptionFields:r,success:function(e){e.success?n.success({success:!0,message:"threeWayCall success",data:e.data.response.data}):n.fail({success:!1,message:e.message,code:e.code})}})}else n.fail({success:!1,message:"initialization not complete!"});else n.fail({success:!1,message:"initialization not complete!"})},evaluate:function(n){if(n.success=n&&"function"==typeof n.success?n.success:t.noop,n.fail=n&&"function"==typeof n.fail?n.fail:t.noop,null!==t.loginToken&&void 0!==t.loginToken)if(null!==t.agentInfo&&void 0!==t.agentInfo)if(null!==n.type&&void 0!==n.type){var o=t.initOptions.server||t.callApiUrl;t.request(o+"/call/api/call/evaluate",{verb:"POST",body:n,loginToken:t.loginToken,sessionId:t.agentInfo._id,accountId:t.agentInfo.accountId,encryptionAlgorithm:e,encryptionFields:r,success:function(e){e.success?n.success({success:!0,message:"evaluate success",data:e.data.response.data}):n.fail({success:!1,message:e.message,code:e.code})}})}else n.fail({success:!1,message:"Parameter type is required!"});else n.fail({success:!1,message:"initialization not complete!"});else n.fail({success:!1,message:"initialization not complete!"})},meeting:function(n){if(n.success=n&&"function"==typeof n.success?n.success:t.noop,n.fail=n&&"function"==typeof n.fail?n.fail:t.noop,null!==t.loginToken&&void 0!==t.loginToken)if(null!==t.agentInfo&&void 0!==t.agentInfo)if(null!==n.number&&void 0!==n.number){var o=t.initOptions.server||t.callApiUrl;t.request(o+"/call/api/call/meeting",{verb:"POST",body:{meetingType:"phone",number:n.number},loginToken:t.loginToken,sessionId:t.agentInfo._id,accountId:t.agentInfo.accountId,encryptionAlgorithm:e,encryptionFields:r,success:function(e){e.success?n.success({success:!0,message:"meeting success",data:e.data.response.data}):n.fail({success:!1,message:e.message,code:e.code})}})}else n.fail({success:!1,message:"Parameter number is required!"});else n.fail({success:!1,message:"initialization not complete!"});else n.fail({success:!1,message:"initialization not complete!"})}}},this._agentApi=function(){var e=n;return{switchLoginType:function(n){return c(this,void 0,void 0,(function(){var r,o,i,s,u,d,p=this;return l(this,(function(h){switch(h.label){case 0:if(r=null,n.success=n&&"function"==typeof n.success?n.success:t.noop,n.fail=n&&"function"==typeof n.fail?n.fail:t.noop,null===n.loginType||void 0===n.loginType)return n.fail({success:!1,message:"Parameter loginType is required!"}),[2];if(null===t.agentInfo||void 0===t.agentInfo)return n.fail({success:!1,message:"initialization not complete!"}),[2];if(null!==n.loginNumber&&void 0!==n.loginNumber&&(r=n.loginNumber),"PSTN"===n.loginType&&!(r=r||t.agentInfo.mobile))return alert("请给座席绑定手机号,或者传入号码参数!"),n.fail({success:!1,message:"Please bind your mobile number"}),[2];if("SIP"===n.loginType&&(r=r||t.agentInfo.sipNumber),"WEBRTC"===n.loginType&&(r=t.agentInfo.webrtcSipNumber),o=t.initOptions.server||t.callApiUrl,i={loginType:n.loginType,loginNumber:r},t.initOptions,u=!0,"WEBRTC"!==n.loginType)return[3,4];h.label=1;case 1:return h.trys.push([1,3,,4]),[4,e.openMediaAudio("请打开麦克风权限!",u)];case 2:return s=h.sent()||{},[3,4];case 3:return d=h.sent(),console.log(d),[3,4];case 4:return t.request(o+"/call/api/agent/v1/login-type/change",{verb:"POST",body:i,loginToken:t.loginToken,sessionId:t.agentInfo._id,accountId:t.agentInfo.accountId,success:function(r){return c(p,void 0,void 0,(function(){return l(this,(function(i){switch(i.label){case 0:return r.success?(n.success(a({success:!0,message:"updateLoginType success"},s)),t.agentInfo.loginType=n.loginType,t.initOptions.loginType=n.loginType,"WEBRTC"!==n.loginType?[3,1]:(e._webPhoneApi().connect(),[3,4])):[3,5];case 1:return"PSTN"!==n.loginType?[3,3]:[4,t.request(o+"/platform/action/updateCallConfig",{verb:"POST",body:{agentCallConfig:{},mobile:n.loginNumber},loginToken:t.loginToken,sessionId:t.agentInfo._id,accountId:t.agentInfo.accountId})];case 2:return i.sent(),e._webPhoneApi().disconnect(),[3,4];case 3:e._webPhoneApi().disconnect(),i.label=4;case 4:return[3,6];case 5:n.fail(a({success:!1,message:r.message,code:r.code},s)),i.label=6;case 6:return[2]}}))}))}}),[2]}}))}))},findPhoneBarList:function(e){if(e.success=e&&"function"==typeof e.success?e.success:t.noop,e.fail=e&&"function"==typeof e.fail?e.fail:t.noop,null!==t.agentInfo&&void 0!==t.agentInfo){var n=t.initOptions.server||t.callApiUrl;t.request(n+"/call/api/phone/bar/all",{verb:"GET",loginToken:t.loginToken,sessionId:t.agentInfo._id,accountId:t.agentInfo.accountId,success:function(t){if(t.success){var n=[];t.data.forEach((function(e){var t={name:e.name,number:e.number};n.push(t)})),e.success({success:!0,data:n})}else e.fail({success:!1,message:t.message,code:t.code})}})}else e.fail({success:!1,message:"initialization not complete!"})},switchPhoneBar:function(e){if(e.success=e&&"function"==typeof e.success?e.success:t.noop,e.fail=e&&"function"==typeof e.fail?e.fail:t.noop,null!==e.stateNumber&&void 0!==e.stateNumber)if(null!==t.agentInfo&&void 0!==t.agentInfo){var n=t.initOptions.server||t.callApiUrl,r={stateNumber:e.stateNumber,accountId:t.agentInfo.accountId,agentNumber:t.agentInfo.agentNumber};t.request(n+"/call/api/agent/status/switch",{verb:"POST",body:r,loginToken:t.loginToken,sessionId:t.agentInfo._id,success:function(t){t.success?e.success({success:!0}):e.fail({success:!1,message:t.message,code:t.code})}})}else e.fail({success:!1,message:"initialization not complete!"});else e.fail({success:!1,message:"Parameter stateNumber is required!"})},logout:function(e){if(e.success=e&&"function"==typeof e.success?e.success:t.noop,e.fail=e&&"function"==typeof e.fail?e.fail:t.noop,null!==t.agentInfo&&void 0!==t.agentInfo){null!==e.toAnswerOffline&&void 0!==e.toAnswerOffline||(e.toAnswerOffline="1");var n=t.initOptions.server||t.callApiUrl,r={toAnswerOffline:e.toAnswerOffline};t.request(n+"/call/api/sdk/agent/logout",{verb:"POST",body:r,loginToken:t.loginToken,sessionId:t.agentInfo._id,accountId:t.agentInfo.accountId,success:function(n){n.success?e&&(t.Socketinstance.disconnect(),"WEBRTC"===t.agentInfo.loginType&&t.webPhone.disconnect(),e.success({success:!0})):e&&e.fail({success:!1,message:n.message,code:n.code})}})}else e.fail({success:!1,message:"initialization not complete!"})},findIdleAgentsForQueue:function(e){if(e.success=e&&"function"==typeof e.success?e.success:t.noop,e.fail=e&&"function"==typeof e.fail?e.fail:t.noop,null!==t.agentInfo&&void 0!==t.agentInfo){var n=t.initOptions.server||t.callApiUrl;t.request(n+"/call/api/queue/acountFreeAgent/find",{verb:"POST",body:{},loginToken:t.loginToken,sessionId:t.agentInfo._id,accountId:t.agentInfo.accountId,success:function(t){t.success?e&&e.success({success:!0,dataList:t.data||[]}):e&&e.fail({success:!1,message:t.message,code:t.code})}})}else e.fail({success:!1,message:"initialization not complete!"})},getAvailableSipNumberList:function(e){if(e.success=e&&"function"==typeof e.success?e.success:t.noop,e.fail=e&&"function"==typeof e.fail?e.fail:t.noop,null!==t.agentInfo&&void 0!==t.agentInfo){var n=t.initOptions.server||t.callApiUrl;t.request(n+"/call/api/sip/avaliable/query",{verb:"POST",body:{},loginToken:t.loginToken,sessionId:t.agentInfo._id,success:function(t){if(t.success&&t.data){var n=[];t.data.forEach((function(e){var t={number:e.id,numberName:e.number};n.push(t)})),e.success({success:!0,data:n})}else e.fail({success:!1,message:t.message,code:t.code})}})}else e.fail({success:!1,message:"initialization not complete!"})}}},this._webPhoneApi=function(){return{accept:function(){t.webPhone.accept()},connect:function(){t.webPhone&&this.isConnected()||t.initWebrtcEvent(t.agentextras)},disconnect:function(){t.webPhone&&this.isConnected()&&t.webPhone.disconnect()},isConnected:function(){return t.webPhone.isConnected()},sendDTMF:function(e){t.webPhone.sendDTMF(e)}}},e.error="function"==typeof e.error?e.error:t.noop,e.success="function"==typeof e.success?e.success:t.noop,null!==e.agentNumber&&void 0!==e.agentNumber?(null!==e.loginType&&void 0!==e.loginType||(e.loginType="PSTN"),this.init(e)):e.error({message:"Invalid agentNumber"})}var t;return e.noop=function(){},e.prototype.init=function(e){if(void 0===e&&(e={}),t.trace=t.noop,t.debug=t.noop,t.log=t.noop,t.warn=t.noop,t.error=t.noop,!0===e.debug||"all"===e.debug)t.trace=console.trace.bind(console),t.debug=console.debug.bind(console),t.log=console.log.bind(console),t.warn=console.warn.bind(console),t.error=console.error.bind(console);else if(Array.isArray(e.debug))for(var n in e.debug){var r=e.debug[n];switch(r){case"trace":t.trace=console.trace.bind(console);break;case"debug":t.debug=console.debug.bind(console);break;case"log":t.log=console.log.bind(console);break;case"warn":t.warn=console.warn.bind(console);break;case"error":t.error=console.error.bind(console);break;default:console.error("Unknown debugging option '"+r+"' (supported: 'trace', 'debug', 'log', warn', 'error')")}}t.log("Initializing library");var o=t.useDefaultDependencies({WebSocket:De});t.newWebSocket=o.newWebSocket,t.request=o.request,this.login(e)},e.prototype.login=function(e){return c(this,void 0,void 0,(function(){var n,r,c,u,d,p,h,f=this;return l(this,(function(l){switch(l.label){case 0:if(n=e.server||t.callApiUrl,r=e.agentNumber+"@"+e.accountId,c=e.loginType,u={loginName:r,loginType:c,loginChannel:"SDK",password:""},d=!0,"WEBRTC"!==c)return[3,4];l.label=1;case 1:return l.trys.push([1,3,,4]),[4,this.openMediaAudio("请打开麦克风权限!",d)];case 2:return p=l.sent()||{},[3,4];case 3:return h=l.sent(),console.log(h),console.log("授权失败================================"),[3,4];case 4:return e.password&&(u.password=e.password),t.request(n+"/platform/public/loginPre",{verb:"GET",success:function(r){if(r&&r.success&&r.data){var l=decodeURIComponent(o.Base64.decode(r.data.pk)),d=new s.JSEncrypt;d.setPublicKey(l);var h=i(u.password),g=d.encrypt(h);u.password=g,t.request(n+"/platform/public/login",{verb:"POST",body:u,success:function(r){r.success?t.request(n+"/platform/action/loginInfo",{verb:"GET",loginToken:r.data.loginToken,sessionId:r.data.sessionId,success:function(r){r.success?(r.data.agent&&(t.agentInfo=r.data.agent,t.loginToken=r.data.loginToken,t.initOptions=a(a({},e),{audioInfo:p})),f.initAttachEvent(n,c,r.data.pushServer,r.data.agent,e.success),"WEBRTC"===c&&f.getWebrtcInfo(n,e)):e.error(a(a({},r),p))},error:function(t){e.error(a({error:t},p))}}):e.error(a(a({},r),p))},error:function(t){e.error(a({error:t},p))}})}else e.error(a(a({},r),p))},error:function(t){e.error(a({error:t},p))}}),[2]}}))}))},e.createEventHandle=function(e){var n=this;void 0===e&&(e={}),e.success="function"==typeof e.success?e.success:t.noop,e.error="function"==typeof e.error?e.error:t.noop,e.message="function"==typeof e.message?e.message:t.noop,e.event="function"==typeof e.event?e.event:t.noop,e.server=null===e.serve||void 0===e.serve?"ws://152.136.72.209:3201/phoneBarGateway":e.serve,null!==e.SocketOptions&&void 0!==e.SocketOptions||(e.SocketOptions={},t.error({message:"login response error!"})),this.Socketinstance=t.newWebSocket(e.server,e.SocketOptions),this.Socketinstance.on("connect",(function(){e.success("connect event serve success!"),e.suc()})),this.Socketinstance.on("error",(function(t,n){e.error({type:"socketError",error:t}),n&&"function"==typeof n&&n("error")})),this.Socketinstance.on("message",(function(n,r){e.message({subtype:n.subType,data:n.data}),console.log({subtype:n.subType,data:n.data},"lllllllllllllllllll222"),"WEBRTC"===t.initOptions.loginType&&(n.data&&n.data.callType&&"callin"===n.data.callType&&n.data.eventType&&"ring"===n.data.eventType?(t.AudioTask||(t.AudioTask=new Be("https://softphone.useasy.cn/ring.wav")),t.AudioTask.ringAudioPlay()):t.AudioTask&&t.AudioTask.ringAudioPause()),r&&"function"==typeof r&&r("success")})),this.Socketinstance.on("event",(function(r){if("KICK_OFF"===r.subType){n.Socketinstance.disconnect();try{t.webPhone.disconnect()}catch(e){}e.event({message:"坐席账户在其他地方登录"})}}))},e.useDefaultDependencies=function(e){var n=e&&e.fetch||fetch,r=e&&e.Promise||Promise,o=e&&e.WebSocket||WebSocket;return{newWebSocket:function(e,t){return new o(e,t)},request:function(e,o){var i={method:o.verb,cache:"no-cache",headers:{"Content-Type":"application/json",loginToken:o.loginToken||"",sessionId:o.sessionId||"",clienttype:0}};o.encryptionFields&&(i.headers["ue-encryption-algorithm"]=o.encryptionAlgorithm||"aes",i.headers["ue-encryption-fields"]=o.encryptionFields),void 0!==o.withCredentials&&(i.credentials=!0===o.withCredentials?"include":o.withCredentials?o.withCredentials:"omit"),void 0!==o.body&&(i.body=JSON.stringify(o.body));var s=n(e,i).catch((function(e){return r.reject({message:"Probably a network error, is the gateway down?",error:e})}));if(void 0!==o.timeout){var a=new r((function(e,t){var n=window.setTimeout((function(){return clearTimeout(n),o.error({message:"Request timed out",timeout:o.timeout}),t({message:"Request timed out",timeout:o.timeout})}),o.timeout)}));s=r.race([s,a])}return s.then((function(e){return e.ok?typeof o.success==typeof t.noop?e.json().then((function(e){o.success(e)})).catch((function(t){return o.error({message:"Failed to parse response body",error:t,response:e}),r.reject({message:"Failed to parse response body",error:t,response:e})})):void 0:(o.error({message:"API call failed",response:e}),r.reject({message:"API call failed",response:e}))})).catch((function(e){typeof o.error==typeof t.noop&&o.error(e.message||"<< internal error >>",e)})),s}}},Object.defineProperty(e.prototype,"agent",{get:function(){return this._agentApi()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"webrtc",{get:function(){return this._webPhoneApi()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"call",{get:function(){return this._callApi()},enumerable:!1,configurable:!0}),t=e,e.callApiUrl="https://app.useasy.cn/api",e.Socketinstance=null,e.AudioTask=null,e.initWebrtcEvent=function(e){return c(void 0,void 0,void 0,(function(){return l(t,(function(n){switch(n.label){case 0:return t.webPhone=new r.UeWebrtc({server:e.wssUrl,sip:e.sip,secret:e.password}),[4,this.webPhone.connect()];case 1:return n.sent(),this.webPhone.register(),[2]}}))}))},e}(),De=function(){function e(e,t){delete t.path,delete t.hostname,delete t.port,this.ws=Ne.connect("wss://".concat(e),t)}return e.prototype.on=function(e,t){"connect"===e&&this.ws.on(e,t),"error"===e&&(this.ws.on("connect_error",t),this.ws.on("error",t),this.ws.on("disconnect",t),this.ws.on("reconnect_failed",t)),"message"===e&&this.ws.on("call",t),"event"===e&&this.ws.on("event",t)},e.prototype.emit=function(e,t,n){this.ws.emit(e,t,n)},e.prototype.disconnect=function(){this.ws.disconnect()},e}(),Be=function(){function e(e){this.ringAudio=new Audio(e),this.ringAudio.loop=!0,this.ringAudioRunning=!1}return e.prototype.ringAudioPlay=function(){return c(this,void 0,void 0,(function(){return l(this,(function(e){switch(e.label){case 0:return this.ringAudioRunning?[2]:[3,1];case 1:return[4,this.ringAudio.play()];case 2:e.sent(),this.ringAudioRunning=!0,e.label=3;case 3:return[2]}}))}))},e.prototype.ringAudioPause=function(){return c(this,void 0,void 0,(function(){return l(this,(function(e){switch(e.label){case 0:return this.ringAudio.paused?[3,2]:[4,this.ringAudio.pause()];case 1:e.sent(),this.ringAudioRunning=!1,e.label=2;case 2:return[2]}}))}))},e}();e.exports=Pe},964:function(e,t,n){"use strict";n.r(t),n.d(t,{UeWebrtc:function(){return yt}});var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},r(e,t)};function o(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var i=function(){return i=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},i.apply(this,arguments)};function s(e,t,n,r){function o(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,i){function s(e){try{c(r.next(e))}catch(t){i(t)}}function a(e){try{c(r["throw"](e))}catch(t){i(t)}}function c(e){e.done?n(e.value):o(e.value).then(s,a)}c((r=r.apply(e,t||[])).next())}))}function a(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"===typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(e){return function(t){return c([e,t])}}function c(a){if(n)throw new TypeError("Generator is already executing.");while(i&&(i=0,a[0]&&(s=0)),s)try{if(n=1,r&&(o=2&a[0]?r["return"]:a[0]?r["throw"]||((o=r["return"])&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;switch(r=0,o&&(a=[2&a[0],o.value]),a[0]){case 0:case 1:o=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(o=s.trys,!(o=o.length>0&&o[o.length-1])&&(6===a[0]||2===a[0])){s=0;continue}if(3===a[0]&&(!o||a[1]>o[0]&&a[1]<o[3])){s.label=a[1];break}if(6===a[0]&&s.label<o[1]){s.label=o[1],o=a;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(a);break}o[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(c){a=[6,c],r=0}finally{n=o=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}}"function"===typeof SuppressedError&&SuppressedError;var c="0.20.0",l=function(){function e(e){for(var t in this.parameters={},e)e.hasOwnProperty(t)&&this.setParam(t,e[t])}return e.prototype.setParam=function(e,t){e&&(this.parameters[e.toLowerCase()]="undefined"===typeof t||null===t?null:t.toString())},e.prototype.getParam=function(e){if(e)return this.parameters[e.toLowerCase()]},e.prototype.hasParam=function(e){return!(!e||void 0===this.parameters[e.toLowerCase()])},e.prototype.deleteParam=function(e){if(e=e.toLowerCase(),this.hasParam(e)){var t=this.parameters[e];return delete this.parameters[e],t}},e.prototype.clearParams=function(){this.parameters={}},e}(),u=function(e){function t(t,n,r){var o=e.call(this,r)||this;return o.uri=t,o._displayName=n,o}return o(t,e),Object.defineProperty(t.prototype,"friendlyName",{get:function(){return this.displayName||this.uri.aor},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"displayName",{get:function(){return this._displayName},set:function(e){this._displayName=e},enumerable:!1,configurable:!0}),t.prototype.clone=function(){return new t(this.uri.clone(),this._displayName,JSON.parse(JSON.stringify(this.parameters)))},t.prototype.toString=function(){var e=this.displayName||"0"===this.displayName?'"'+this.displayName+'" ':"";for(var t in e+="<"+this.uri.toString()+">",this.parameters)this.parameters.hasOwnProperty(t)&&(e+=";"+t,null!==this.parameters[t]&&(e+="="+this.parameters[t]));return e},t}(l),d=function(e){function t(t,n,r,o,i,s){void 0===t&&(t="sip");var a=e.call(this,i||{})||this;if(a.headers={},!r)throw new TypeError('missing or invalid "host" parameter');for(var c in s)s.hasOwnProperty(c)&&a.setHeader(c,s[c]);return a.raw={scheme:t,user:n,host:r,port:o},a.normal={scheme:t.toLowerCase(),user:n,host:r.toLowerCase(),port:o},a}return o(t,e),Object.defineProperty(t.prototype,"scheme",{get:function(){return this.normal.scheme},set:function(e){this.raw.scheme=e,this.normal.scheme=e.toLowerCase()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"user",{get:function(){return this.normal.user},set:function(e){this.normal.user=this.raw.user=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"host",{get:function(){return this.normal.host},set:function(e){this.raw.host=e,this.normal.host=e.toLowerCase()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"aor",{get:function(){return this.normal.user+"@"+this.normal.host},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"port",{get:function(){return this.normal.port},set:function(e){this.normal.port=this.raw.port=e},enumerable:!1,configurable:!0}),t.prototype.setHeader=function(e,t){this.headers[this.headerize(e)]=t instanceof Array?t:[t]},t.prototype.getHeader=function(e){if(e)return this.headers[this.headerize(e)]},t.prototype.hasHeader=function(e){return!!e&&!!this.headers.hasOwnProperty(this.headerize(e))},t.prototype.deleteHeader=function(e){if(e=this.headerize(e),this.headers.hasOwnProperty(e)){var t=this.headers[e];return delete this.headers[e],t}},t.prototype.clearHeaders=function(){this.headers={}},t.prototype.clone=function(){return new t(this._raw.scheme,this._raw.user||"",this._raw.host,this._raw.port,JSON.parse(JSON.stringify(this.parameters)),JSON.parse(JSON.stringify(this.headers)))},t.prototype.toRaw=function(){return this._toString(this._raw)},t.prototype.toString=function(){return this._toString(this._normal)},Object.defineProperty(t.prototype,"_normal",{get:function(){return this.normal},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_raw",{get:function(){return this.raw},enumerable:!1,configurable:!0}),t.prototype._toString=function(e){var t=e.scheme+":";for(var n in e.scheme.toLowerCase().match("^sips?$")||(t+="//"),e.user&&(t+=this.escapeUser(e.user)+"@"),t+=e.host,(e.port||0===e.port)&&(t+=":"+e.port),this.parameters)this.parameters.hasOwnProperty(n)&&(t+=";"+n,null!==this.parameters[n]&&(t+="="+this.parameters[n]));var r=[];for(var o in this.headers)if(this.headers.hasOwnProperty(o))for(var i in this.headers[o])this.headers[o].hasOwnProperty(i)&&r.push(o+"="+this.headers[o][i]);return r.length>0&&(t+="?"+r.join("&")),t},t.prototype.escapeUser=function(e){var t;try{t=decodeURIComponent(e)}catch(n){throw n}return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%2B/gi,"+").replace(/%3F/gi,"?").replace(/%2F/gi,"/")},t.prototype.headerize=function(e){for(var t={"Call-Id":"Call-ID",Cseq:"CSeq","Min-Se":"Min-SE",Rack:"RAck",Rseq:"RSeq","Www-Authenticate":"WWW-Authenticate"},n=e.toLowerCase().replace(/_/g,"-").split("-"),r=n.length,o="",i=0;i<r;i++)0!==i&&(o+="-"),o+=n[i].charAt(0).toUpperCase()+n[i].substring(1);return t[o]&&(o=t[o]),o},t}(l);function p(e,t){if(e.scheme!==t.scheme)return!1;if(e.user!==t.user||e.host!==t.host||e.port!==t.port)return!1;function n(e,t){var n=Object.keys(e.parameters),r=Object.keys(t.parameters),o=n.filter((function(e){return r.includes(e)}));return!!o.every((function(n){return e.parameters[n]===t.parameters[n]}))&&(!!["user","ttl","method","transport"].every((function(n){return e.hasParam(n)&&t.hasParam(n)||!e.hasParam(n)&&!t.hasParam(n)}))&&!!["maddr"].every((function(n){return e.hasParam(n)&&t.hasParam(n)||!e.hasParam(n)&&!t.hasParam(n)})))}if(!n(e,t))return!1;var r=Object.keys(e.headers),o=Object.keys(t.headers);if(0!==r.length||0!==o.length){if(r.length!==o.length)return!1;var i=r.filter((function(e){return o.includes(e)}));if(i.length!==o.length)return!1;if(!i.every((function(n){return e.headers[n].length&&t.headers[n].length&&e.headers[n][0]===t.headers[n][0]})))return!1}return!0}var h=function(e){function t(n,r,o,i){var s=e.call(this)||this;return s.message=n,s.expected=r,s.found=o,s.location=i,s.name="SyntaxError","function"===typeof Error.captureStackTrace&&Error.captureStackTrace(s,t),s}return o(t,e),t.buildMessage=function(e,t){function n(e){return e.charCodeAt(0).toString(16).toUpperCase()}function r(e){return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(e){return"\\x0"+n(e)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(e){return"\\x"+n(e)}))}function o(e){return e.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,(function(e){return"\\x0"+n(e)})).replace(/[\x10-\x1F\x7F-\x9F]/g,(function(e){return"\\x"+n(e)}))}function i(e){switch(e.type){case"literal":return'"'+r(e.text)+'"';case"class":var t=e.parts.map((function(e){return Array.isArray(e)?o(e[0])+"-"+o(e[1]):o(e)}));return"["+(e.inverted?"^":"")+t+"]";case"any":return"any character";case"end":return"end of input";case"other":return e.description}}function s(e){var t,n,r=e.map(i);if(r.sort(),r.length>0){for(t=1,n=1;t<r.length;t++)r[t-1]!==r[t]&&(r[n]=r[t],n++);r.length=n}switch(r.length){case 1:return r[0];case 2:return r[0]+" or "+r[1];default:return r.slice(0,-1).join(", ")+", or "+r[r.length-1]}}function a(e){return e?'"'+r(e)+'"':"end of input"}return"Expected "+s(e)+" but "+a(t)+" found."},t}(Error);function f(e,t){t=void 0!==t?t:{};var n,r={},o={Contact:119,Name_Addr_Header:156,Record_Route:176,Request_Response:81,SIP_URI:45,Subscription_State:186,Supported:191,Require:182,Via:194,absoluteURI:84,Call_ID:118,Content_Disposition:130,Content_Length:135,Content_Type:136,CSeq:146,displayName:122,Event:149,From:151,host:52,Max_Forwards:154,Min_SE:213,Proxy_Authenticate:157,quoted_string:40,Refer_To:178,Replaces:179,Session_Expires:210,stun_URI:217,To:192,turn_URI:223,uuid:226,WWW_Authenticate:209,challenge:158,sipfrag:230,Referred_By:231},i=119,s=["\r\n",b("\r\n",!1),/^[0-9]/,w([["0","9"]],!1,!1),/^[a-zA-Z]/,w([["a","z"],["A","Z"]],!1,!1),/^[0-9a-fA-F]/,w([["0","9"],["a","f"],["A","F"]],!1,!1),/^[\0-\xFF]/,w([["\0","ÿ"]],!1,!1),/^["]/,w(['"'],!1,!1)," ",b(" ",!1),"\t",b("\t",!1),/^[a-zA-Z0-9]/,w([["a","z"],["A","Z"],["0","9"]],!1,!1),";",b(";",!1),"/",b("/",!1),"?",b("?",!1),":",b(":",!1),"@",b("@",!1),"&",b("&",!1),"=",b("=",!1),"+",b("+",!1),"$",b("$",!1),",",b(",",!1),"-",b("-",!1),"_",b("_",!1),".",b(".",!1),"!",b("!",!1),"~",b("~",!1),"*",b("*",!1),"'",b("'",!1),"(",b("(",!1),")",b(")",!1),"%",b("%",!1),function(){return" "},function(){return":"},/^[!-~]/,w([["!","~"]],!1,!1),/^[\x80-\uFFFF]/,w([["",""]],!1,!1),/^[\x80-\xBF]/,w([["","¿"]],!1,!1),/^[a-f]/,w([["a","f"]],!1,!1),"`",b("`",!1),"<",b("<",!1),">",b(">",!1),"\\",b("\\",!1),"[",b("[",!1),"]",b("]",!1),"{",b("{",!1),"}",b("}",!1),function(){return"*"},function(){return"/"},function(){return"="},function(){return"("},function(){return")"},function(){return">"},function(){return"<"},function(){return","},function(){return";"},function(){return":"},function(){return'"'},/^[!-']/,w([["!","'"]],!1,!1),/^[*-[]/,w([["*","["]],!1,!1),/^[\]-~]/,w([["]","~"]],!1,!1),function(e){return e},/^[#-[]/,w([["#","["]],!1,!1),/^[\0-\t]/,w([["\0","\t"]],!1,!1),/^[\x0B-\f]/,w([["\v","\f"]],!1,!1),/^[\x0E-\x7F]/,w([["",""]],!1,!1),function(){t=t||{data:{}},t.data.uri=new d(t.data.scheme,t.data.user,t.data.host,t.data.port),delete t.data.scheme,delete t.data.user,delete t.data.host,delete t.data.host_type,delete t.data.port},function(){t=t||{data:{}},t.data.uri=new d(t.data.scheme,t.data.user,t.data.host,t.data.port,t.data.uri_params,t.data.uri_headers),delete t.data.scheme,delete t.data.user,delete t.data.host,delete t.data.host_type,delete t.data.port,delete t.data.uri_params,"SIP_URI"===t.startRule&&(t.data=t.data.uri)},"sips",b("sips",!0),"sip",b("sip",!0),function(e){t=t||{data:{}},t.data.scheme=e},function(){t=t||{data:{}},t.data.user=decodeURIComponent(v().slice(0,-1))},function(){t=t||{data:{}},t.data.password=v()},function(){return t=t||{data:{}},t.data.host=v(),t.data.host},function(){return t=t||{data:{}},t.data.host_type="domain",v()},/^[a-zA-Z0-9_\-]/,w([["a","z"],["A","Z"],["0","9"],"_","-"],!1,!1),/^[a-zA-Z0-9\-]/,w([["a","z"],["A","Z"],["0","9"],"-"],!1,!1),function(){return t=t||{data:{}},t.data.host_type="IPv6",v()},"::",b("::",!1),function(){return t=t||{data:{}},t.data.host_type="IPv6",v()},function(){return t=t||{data:{}},t.data.host_type="IPv4",v()},"25",b("25",!1),/^[0-5]/,w([["0","5"]],!1,!1),"2",b("2",!1),/^[0-4]/,w([["0","4"]],!1,!1),"1",b("1",!1),/^[1-9]/,w([["1","9"]],!1,!1),function(e){return t=t||{data:{}},e=parseInt(e.join("")),t.data.port=e,e},"transport=",b("transport=",!0),"udp",b("udp",!0),"tcp",b("tcp",!0),"sctp",b("sctp",!0),"tls",b("tls",!0),function(e){t=t||{data:{}},t.data.uri_params||(t.data.uri_params={}),t.data.uri_params["transport"]=e.toLowerCase()},"user=",b("user=",!0),"phone",b("phone",!0),"ip",b("ip",!0),function(e){t=t||{data:{}},t.data.uri_params||(t.data.uri_params={}),t.data.uri_params["user"]=e.toLowerCase()},"method=",b("method=",!0),function(e){t=t||{data:{}},t.data.uri_params||(t.data.uri_params={}),t.data.uri_params["method"]=e},"ttl=",b("ttl=",!0),function(e){t=t||{data:{}},t.data.params||(t.data.params={}),t.data.params["ttl"]=e},"maddr=",b("maddr=",!0),function(e){t=t||{data:{}},t.data.uri_params||(t.data.uri_params={}),t.data.uri_params["maddr"]=e},"lr",b("lr",!0),function(){t=t||{data:{}},t.data.uri_params||(t.data.uri_params={}),t.data.uri_params["lr"]=void 0},function(e,n){t=t||{data:{}},t.data.uri_params||(t.data.uri_params={}),n=null===n?void 0:n[1],t.data.uri_params[e.toLowerCase()]=n},function(e,n){e=e.join("").toLowerCase(),n=n.join(""),t=t||{data:{}},t.data.uri_headers||(t.data.uri_headers={}),t.data.uri_headers[e]?t.data.uri_headers[e].push(n):t.data.uri_headers[e]=[n]},function(){t=t||{data:{}},"Refer_To"===t.startRule&&(t.data.uri=new d(t.data.scheme,t.data.user,t.data.host,t.data.port,t.data.uri_params,t.data.uri_headers),delete t.data.scheme,delete t.data.user,delete t.data.host,delete t.data.host_type,delete t.data.port,delete t.data.uri_params)},"//",b("//",!1),function(){t=t||{data:{}},t.data.scheme=v()},b("SIP",!0),function(){t=t||{data:{}},t.data.sip_version=v()},"INVITE",b("INVITE",!1),"ACK",b("ACK",!1),"VXACH",b("VXACH",!1),"OPTIONS",b("OPTIONS",!1),"BYE",b("BYE",!1),"CANCEL",b("CANCEL",!1),"REGISTER",b("REGISTER",!1),"SUBSCRIBE",b("SUBSCRIBE",!1),"NOTIFY",b("NOTIFY",!1),"REFER",b("REFER",!1),"PUBLISH",b("PUBLISH",!1),function(){return t=t||{data:{}},t.data.method=v(),t.data.method},function(e){t=t||{data:{}},t.data.status_code=parseInt(e.join(""))},function(){t=t||{data:{}},t.data.reason_phrase=v()},function(){t=t||{data:{}},t.data=v()},function(){var e,n;for(t=t||{data:{}},n=t.data.multi_header.length,e=0;e<n;e++)if(null===t.data.multi_header[e].parsed){t.data=null;break}null!==t.data?t.data=t.data.multi_header:t.data=-1},function(){var e;t=t||{data:{}},t.data.multi_header||(t.data.multi_header=[]);try{e=new u(t.data.uri,t.data.displayName,t.data.params),delete t.data.uri,delete t.data.displayName,delete t.data.params}catch(n){e=null}t.data.multi_header.push({position:c,offset:y().start.offset,parsed:e})},function(e){e=v().trim(),'"'===e[0]&&(e=e.substring(1,e.length-1)),t=t||{data:{}},t.data.displayName=e},"q",b("q",!0),function(e){t=t||{data:{}},t.data.params||(t.data.params={}),t.data.params["q"]=e},"expires",b("expires",!0),function(e){t=t||{data:{}},t.data.params||(t.data.params={}),t.data.params["expires"]=e},function(e){return parseInt(e.join(""))},"0",b("0",!1),function(){return parseFloat(v())},function(e,n){t=t||{data:{}},t.data.params||(t.data.params={}),n=null===n?void 0:n[1],t.data.params[e.toLowerCase()]=n},"render",b("render",!0),"session",b("session",!0),"icon",b("icon",!0),"alert",b("alert",!0),function(){t=t||{data:{}},"Content_Disposition"===t.startRule&&(t.data.type=v().toLowerCase())},"handling",b("handling",!0),"optional",b("optional",!0),"required",b("required",!0),function(e){t=t||{data:{}},t.data=parseInt(e.join(""))},function(){t=t||{data:{}},t.data=v()},"text",b("text",!0),"image",b("image",!0),"audio",b("audio",!0),"video",b("video",!0),"application",b("application",!0),"message",b("message",!0),"multipart",b("multipart",!0),"x-",b("x-",!0),function(e){t=t||{data:{}},t.data.value=parseInt(e.join(""))},function(e){t=t||{data:{}},t.data=e},function(e){t=t||{data:{}},t.data.event=e.toLowerCase()},function(){t=t||{data:{}};var e=t.data.tag;t.data=new u(t.data.uri,t.data.displayName,t.data.params),e&&t.data.setParam("tag",e)},"tag",b("tag",!0),function(e){t=t||{data:{}},t.data.tag=e},function(e){t=t||{data:{}},t.data=parseInt(e.join(""))},function(e){t=t||{data:{}},t.data=e},function(){t=t||{data:{}},t.data=new u(t.data.uri,t.data.displayName,t.data.params)},"digest",b("Digest",!0),"realm",b("realm",!0),function(e){t=t||{data:{}},t.data.realm=e},"domain",b("domain",!0),"nonce",b("nonce",!0),function(e){t=t||{data:{}},t.data.nonce=e},"opaque",b("opaque",!0),function(e){t=t||{data:{}},t.data.opaque=e},"stale",b("stale",!0),"true",b("true",!0),function(){t=t||{data:{}},t.data.stale=!0},"false",b("false",!0),function(){t=t||{data:{}},t.data.stale=!1},"algorithm",b("algorithm",!0),"md5",b("MD5",!0),"md5-sess",b("MD5-sess",!0),function(e){t=t||{data:{}},t.data.algorithm=e.toUpperCase()},"qop",b("qop",!0),"auth-int",b("auth-int",!0),"auth",b("auth",!0),function(e){t=t||{data:{}},t.data.qop||(t.data.qop=[]),t.data.qop.push(e.toLowerCase())},function(e){t=t||{data:{}},t.data.value=parseInt(e.join(""))},function(){var e,n;for(t=t||{data:{}},n=t.data.multi_header.length,e=0;e<n;e++)if(null===t.data.multi_header[e].parsed){t.data=null;break}null!==t.data?t.data=t.data.multi_header:t.data=-1},function(){var e;t=t||{data:{}},t.data.multi_header||(t.data.multi_header=[]);try{e=new u(t.data.uri,t.data.displayName,t.data.params),delete t.data.uri,delete t.data.displayName,delete t.data.params}catch(n){e=null}t.data.multi_header.push({position:c,offset:y().start.offset,parsed:e})},function(){t=t||{data:{}},t.data=new u(t.data.uri,t.data.displayName,t.data.params)},function(){t=t||{data:{}},t.data.replaces_from_tag&&t.data.replaces_to_tag||(t.data=-1)},function(){t=t||{data:{}},t.data={call_id:t.data}},"from-tag",b("from-tag",!0),function(e){t=t||{data:{}},t.data.replaces_from_tag=e},"to-tag",b("to-tag",!0),function(e){t=t||{data:{}},t.data.replaces_to_tag=e},"early-only",b("early-only",!0),function(){t=t||{data:{}},t.data.early_only=!0},function(e,t){return t},function(e,t){return R(e,t)},function(e){t=t||{data:{}},"Require"===t.startRule&&(t.data=e||[])},function(e){t=t||{data:{}},t.data.value=parseInt(e.join(""))},"active",b("active",!0),"pending",b("pending",!0),"terminated",b("terminated",!0),function(){t=t||{data:{}},t.data.state=v()},"reason",b("reason",!0),function(e){t=t||{data:{}},"undefined"!==typeof e&&(t.data.reason=e)},function(e){t=t||{data:{}},"undefined"!==typeof e&&(t.data.expires=e)},"retry_after",b("retry_after",!0),function(e){t=t||{data:{}},"undefined"!==typeof e&&(t.data.retry_after=e)},"deactivated",b("deactivated",!0),"probation",b("probation",!0),"rejected",b("rejected",!0),"timeout",b("timeout",!0),"giveup",b("giveup",!0),"noresource",b("noresource",!0),"invariant",b("invariant",!0),function(e){t=t||{data:{}},"Supported"===t.startRule&&(t.data=e||[])},function(){t=t||{data:{}};var e=t.data.tag;t.data=new u(t.data.uri,t.data.displayName,t.data.params),e&&t.data.setParam("tag",e)},"ttl",b("ttl",!0),function(e){t=t||{data:{}},t.data.ttl=e},"maddr",b("maddr",!0),function(e){t=t||{data:{}},t.data.maddr=e},"received",b("received",!0),function(e){t=t||{data:{}},t.data.received=e},"branch",b("branch",!0),function(e){t=t||{data:{}},t.data.branch=e},"rport",b("rport",!0),function(e){t=t||{data:{}},"undefined"!==typeof e&&(t.data.rport=e.join(""))},function(e){t=t||{data:{}},t.data.protocol=e},b("UDP",!0),b("TCP",!0),b("TLS",!0),b("SCTP",!0),function(e){t=t||{data:{}},t.data.transport=e},function(){t=t||{data:{}},t.data.host=v()},function(e){t=t||{data:{}},t.data.port=parseInt(e.join(""))},function(e){return parseInt(e.join(""))},function(e){t=t||{data:{}},"Session_Expires"===t.startRule&&(t.data.deltaSeconds=e)},"refresher",b("refresher",!1),"uas",b("uas",!1),"uac",b("uac",!1),function(e){t=t||{data:{}},"Session_Expires"===t.startRule&&(t.data.refresher=e)},function(e){t=t||{data:{}},"Min_SE"===t.startRule&&(t.data=e)},"stuns",b("stuns",!0),"stun",b("stun",!0),function(e){t=t||{data:{}},t.data.scheme=e},function(e){t=t||{data:{}},t.data.host=e},"?transport=",b("?transport=",!1),"turns",b("turns",!0),"turn",b("turn",!0),function(e){t=t||{data:{}},t.data.transport=e},function(){t=t||{data:{}},t.data=v()},"Referred-By",b("Referred-By",!1),"b",b("b",!1),"cid",b("cid",!1)],a=[x('2 ""6 7!'),x('4"""5!7#'),x('4$""5!7%'),x('4&""5!7\''),x(";'.# &;("),x('4(""5!7)'),x('4*""5!7+'),x('2,""6,7-'),x('2.""6.7/'),x('40""5!71'),x('22""6273. &24""6475.} &26""6677.q &28""6879.e &2:""6:7;.Y &2<""6<7=.M &2>""6>7?.A &2@""6@7A.5 &2B""6B7C.) &2D""6D7E'),x(";).# &;,"),x('2F""6F7G.} &2H""6H7I.q &2J""6J7K.e &2L""6L7M.Y &2N""6N7O.M &2P""6P7Q.A &2R""6R7S.5 &2T""6T7U.) &2V""6V7W'),x('%%2X""6X7Y/5#;#/,$;#/#$+#)(#\'#("\'#&\'#/"!&,)'),x('%%$;$0#*;$&/,#; /#$+")("\'#&\'#." &"/=#$;$/�#*;$&&&#/\'$8":Z" )("\'#&\'#'),x(';.." &"'),x("%$;'.# &;(0)*;'.# &;(&/?#28\"\"6879/0$;//'$8#:[# )(#'#(\"'#&'#"),x('%%$;2/�#*;2&&&#/g#$%$;.0#*;.&/,#;2/#$+")("\'#&\'#0=*%$;.0#*;.&/,#;2/#$+")("\'#&\'#&/#$+")("\'#&\'#/"!&,)'),x('4\\""5!7].# &;3'),x('4^""5!7_'),x('4`""5!7a'),x(';!.) &4b""5!7c'),x('%$;). &2F""6F7G. &2J""6J7K.} &2L""6L7M.q &2X""6X7Y.e &2P""6P7Q.Y &2H""6H7I.M &2@""6@7A.A &2d""6d7e.5 &2R""6R7S.) &2N""6N7O/#0*;). &2F""6F7G. &2J""6J7K.} &2L""6L7M.q &2X""6X7Y.e &2P""6P7Q.Y &2H""6H7I.M &2@""6@7A.A &2d""6d7e.5 &2R""6R7S.) &2N""6N7O&&&#/"!&,)'),x('%$;). &2F""6F7G.} &2L""6L7M.q &2X""6X7Y.e &2P""6P7Q.Y &2H""6H7I.M &2@""6@7A.A &2d""6d7e.5 &2R""6R7S.) &2N""6N7O/#0*;). &2F""6F7G.} &2L""6L7M.q &2X""6X7Y.e &2P""6P7Q.Y &2H""6H7I.M &2@""6@7A.A &2d""6d7e.5 &2R""6R7S.) &2N""6N7O&&&#/"!&,)'),x('2T""6T7U.ã &2V""6V7W.× &2f""6f7g.Ë &2h""6h7i.¿ &2:""6:7;.³ &2D""6D7E.§ &22""6273. &28""6879. &2j""6j7k. &;&.} &24""6475.q &2l""6l7m.e &2n""6n7o.Y &26""6677.M &2>""6>7?.A &2p""6p7q.5 &2r""6r7s.) &;\'.# &;('),x('%$;).ī &2F""6F7G.ğ &2J""6J7K.ē &2L""6L7M.ć &2X""6X7Y.û &2P""6P7Q.ï &2H""6H7I.ã &2@""6@7A.× &2d""6d7e.Ë &2R""6R7S.¿ &2N""6N7O.³ &2T""6T7U.§ &2V""6V7W. &2f""6f7g. &2h""6h7i. &28""6879.w &2j""6j7k.k &;&.e &24""6475.Y &2l""6l7m.M &2n""6n7o.A &26""6677.5 &2p""6p7q.) &2r""6r7s/Ĵ#0ı*;).ī &2F""6F7G.ğ &2J""6J7K.ē &2L""6L7M.ć &2X""6X7Y.û &2P""6P7Q.ï &2H""6H7I.ã &2@""6@7A.× &2d""6d7e.Ë &2R""6R7S.¿ &2N""6N7O.³ &2T""6T7U.§ &2V""6V7W. &2f""6f7g. &2h""6h7i. &28""6879.w &2j""6j7k.k &;&.e &24""6475.Y &2l""6l7m.M &2n""6n7o.A &26""6677.5 &2p""6p7q.) &2r""6r7s&&&#/"!&,)'),x("%;//?#2P\"\"6P7Q/0$;//'$8#:t# )(#'#(\"'#&'#"),x("%;//?#24\"\"6475/0$;//'$8#:u# )(#'#(\"'#&'#"),x("%;//?#2>\"\"6>7?/0$;//'$8#:v# )(#'#(\"'#&'#"),x("%;//?#2T\"\"6T7U/0$;//'$8#:w# )(#'#(\"'#&'#"),x("%;//?#2V\"\"6V7W/0$;//'$8#:x# )(#'#(\"'#&'#"),x('%2h""6h7i/0#;//\'$8":y" )("\'#&\'#'),x('%;//6#2f""6f7g/\'$8":z" )("\'#&\'#'),x("%;//?#2D\"\"6D7E/0$;//'$8#:{# )(#'#(\"'#&'#"),x("%;//?#22\"\"6273/0$;//'$8#:|# )(#'#(\"'#&'#"),x("%;//?#28\"\"6879/0$;//'$8#:}# )(#'#(\"'#&'#"),x("%;//0#;&/'$8\":~\" )(\"'#&'#"),x("%;&/0#;//'$8\":~\" )(\"'#&'#"),x("%;=/T#$;G.) &;K.# &;F0/*;G.) &;K.# &;F&/,$;>/#$+#)(#'#(\"'#&'#"),x('4""5!7.A &4""5!7.5 &4""5!7.) &;3.# &;.'),x("%%;//Q#;&/H$$;J.# &;K0)*;J.# &;K&/,$;&/#$+$)($'#(#'#(\"'#&'#/\"!&,)"),x("%;//]#;&/T$%$;J.# &;K0)*;J.# &;K&/\"!&,)/1$;&/($8$:
$!!)($'#(#'#(\"'#&'#"),x(';..G &2L""6L7M.; &4""5!7./ &4""5!7.# &;3'),x('%2j""6j7k/J#4""5!7.5 &4""5!7.) &4""5!7/#$+")("\'#&\'#'),x("%;N/M#28\"\"6879/>$;O.\" &\"/0$;S/'$8$:$ )($'#(#'#(\"'#&'#"),x("%;N/d#28\"\"6879/U$;O.\" &\"/G$;S/>$;_/5$;l.\" &\"/'$8&:& )(&'#(%'#($'#(#'#(\"'#&'#"),x('%3""5$7.) &3""5#7/\' 8!:!! )'),x('%;P/]#%28""6879/,#;R/#$+")("\'#&\'#." &"/6$2:""6:7;/\'$8#:# )(#\'#("\'#&\'#'),x("$;+.) &;-.# &;Q/2#0/*;+.) &;-.# &;Q&&&#"),x('2<""6<7=.q &2>""6>7?.e &2@""6@7A.Y &2B""6B7C.M &2D""6D7E.A &22""6273.5 &26""6677.) &24""6475'),x('%$;+._ &;-.Y &2<""6<7=.M &2>""6>7?.A &2@""6@7A.5 &2B""6B7C.) &2D""6D7E0e*;+._ &;-.Y &2<""6<7=.M &2>""6>7?.A &2@""6@7A.5 &2B""6B7C.) &2D""6D7E&/& 8!:! )'),x('%;T/J#%28""6879/,#;^/#$+")("\'#&\'#." &"/#$+")("\'#&\'#'),x("%;U.) &;\\.# &;X/& 8!:! )"),x('%$%;V/2#2J""6J7K/#$+")("\'#&\'#0<*%;V/2#2J""6J7K/#$+")("\'#&\'#&/D#;W/;$2J""6J7K." &"/\'$8#:# )(#\'#("\'#&\'#'),x('$4""5!7/,#0)*4""5!7&&&#'),x('%4$""5!7%/?#$4""5!70)*4""5!7&/#$+")("\'#&\'#'),x('%2l""6l7m/?#;Y/6$2n""6n7o/\'$8#:# )(#\'#("\'#&\'#'),x('%%;Z/³#28""6879/¤$;Z/$28""6879/$;Z/$28""6879/t$;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+-)(-\'#(,\'#(+\'#(*\'#()\'#((\'#(\'\'#(&\'#(%\'#($\'#(#\'#("\'#&\'#.ސ &%2""67/¤#;Z/$28""6879/$;Z/$28""6879/t$;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+,)(,\'#(+\'#(*\'#()\'#((\'#(\'\'#(&\'#(%\'#($\'#(#\'#("\'#&\'#.۹ &%2""67/#;Z/$28""6879/t$;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+*)(*\'#()\'#((\'#(\'\'#(&\'#(%\'#($\'#(#\'#("\'#&\'#.ٺ &%2""67/t#;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+()((\'#(\'\'#(&\'#(%\'#($\'#(#\'#("\'#&\'#.ؓ &%2""67/\\#;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+&)(&\'#(%\'#($\'#(#\'#("\'#&\'#.ׄ &%2""67/D#;Z/;$28""6879/,$;[/#$+$)($\'#(#\'#("\'#&\'#.֍ &%2""67/,#;[/#$+")("\'#&\'#.ծ &%2""67/,#;Z/#$+")("\'#&\'#.Տ &%;Z/#2""67/$;Z/$28""6879/t$;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$++)(+\'#(*\'#()\'#((\'#(\'\'#(&\'#(%\'#($\'#(#\'#("\'#&\'#.Ӈ &%;Z/ª#%28""6879/,#;Z/#$+")("\'#&\'#." &"/$2""67/t$;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+*)(*\'#()\'#((\'#(\'\'#(&\'#(%\'#($\'#(#\'#("\'#&\'#.а &%;Z/¹#%28""6879/,#;Z/#$+")("\'#&\'#." &"/$%28""6879/,#;Z/#$+")("\'#&\'#." &"/k$2""67/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+))()\'#((\'#(\'\'#(&\'#(%\'#($\'#(#\'#("\'#&\'#.Ί &%;Z/È#%28""6879/,#;Z/#$+")("\'#&\'#." &"/¡$%28""6879/,#;Z/#$+")("\'#&\'#." &"/z$%28""6879/,#;Z/#$+")("\'#&\'#." &"/S$2""67/D$;Z/;$28""6879/,$;[/#$+()((\'#(\'\'#(&\'#(%\'#($\'#(#\'#("\'#&\'#.˕ &%;Z/×#%28""6879/,#;Z/#$+")("\'#&\'#." &"/°$%28""6879/,#;Z/#$+")("\'#&\'#." &"/$%28""6879/,#;Z/#$+")("\'#&\'#." &"/b$%28""6879/,#;Z/#$+")("\'#&\'#." &"/;$2""67/,$;[/#$+\')(\'\'#(&\'#(%\'#($\'#(#\'#("\'#&\'#.ȑ &%;Z/þ#%28""6879/,#;Z/#$+")("\'#&\'#." &"/×$%28""6879/,#;Z/#$+")("\'#&\'#." &"/°$%28""6879/,#;Z/#$+")("\'#&\'#." &"/$%28""6879/,#;Z/#$+")("\'#&\'#." &"/b$%28""6879/,#;Z/#$+")("\'#&\'#." &"/;$2""67/,$;Z/#$+()((\'#(\'\'#(&\'#(%\'#($\'#(#\'#("\'#&\'#.Ħ &%;Z/Ĝ#%28""6879/,#;Z/#$+")("\'#&\'#." &"/õ$%28""6879/,#;Z/#$+")("\'#&\'#." &"/Î$%28""6879/,#;Z/#$+")("\'#&\'#." &"/§$%28""6879/,#;Z/#$+")("\'#&\'#." &"/$%28""6879/,#;Z/#$+")("\'#&\'#." &"/Y$%28""6879/,#;Z/#$+")("\'#&\'#." &"/2$2""67/#$+()((\'#(\'\'#(&\'#(%\'#($\'#(#\'#("\'#&\'#/& 8!: ! )'),x('%;#/M#;#." &"/?$;#." &"/1$;#." &"/#$+$)($\'#(#\'#("\'#&\'#'),x("%;Z/;#28\"\"6879/,$;Z/#$+#)(#'#(\"'#&'#.# &;\\"),x("%;]/o#2J\"\"6J7K/`$;]/W$2J\"\"6J7K/H$;]/?$2J\"\"6J7K/0$;]/'$8':¡' )(''#(&'#(%'#($'#(#'#(\"'#&'#"),x('%2¢""6¢7£/2#4¤""5!7¥/#$+")("\'#&\'#. &%2¦""6¦7§/;#4¨""5!7©/,$;!/#$+#)(#\'#("\'#&\'#.j &%2ª""6ª7«/5#;!/,$;!/#$+#)(#\'#("\'#&\'#.B &%4¬""5!7/,#;!/#$+")("\'#&\'#.# &;!'),x('%%;!." &"/[#;!." &"/M$;!." &"/?$;!." &"/1$;!." &"/#$+%)(%\'#($\'#(#\'#("\'#&\'#/\' 8!:®!! )'),x('$%22""6273/,#;`/#$+")("\'#&\'#0<*%22""6273/,#;`/#$+")("\'#&\'#&'),x(";a.A &;b.; &;c.5 &;d./ &;e.) &;f.# &;g"),x('%3¯""5*7°/a#3±""5#7².G &3³""5#7´.; &3µ""5$7¶./ &3·""5#7¸.# &;6/($8":¹"! )("\'#&\'#'),x('%3º""5%7»/I#3¼""5%7½./ &3¾""5"7¿.# &;6/($8":À"! )("\'#&\'#'),x('%3Á""5\'7Â/1#;/($8":Ã"! )("\'#&\'#'),x('%3Ä""5$7Å/1#;ð/($8":Æ"! )("\'#&\'#'),x('%3Ç""5&7È/1#;T/($8":É"! )("\'#&\'#'),x('%3Ê""5"7Ë/N#%2>""6>7?/,#;6/#$+")("\'#&\'#." &"/\'$8":Ì" )("\'#&\'#'),x('%;h/P#%2>""6>7?/,#;i/#$+")("\'#&\'#." &"/)$8":Í""! )("\'#&\'#'),x('%$;j/�#*;j&&&#/"!&,)'),x('%$;j/�#*;j&&&#/"!&,)'),x(";k.) &;+.# &;-"),x('2l""6l7m.e &2n""6n7o.Y &24""6475.M &28""6879.A &2<""6<7=.5 &2@""6@7A.) &2B""6B7C'),x('%26""6677/n#;m/e$$%2<""6<7=/,#;m/#$+")("\'#&\'#0<*%2<""6<7=/,#;m/#$+")("\'#&\'#&/#$+#)(#\'#("\'#&\'#'),x('%;n/A#2>""6>7?/2$;o/)$8#:Î#"" )(#\'#("\'#&\'#'),x("$;p.) &;+.# &;-/2#0/*;p.) &;+.# &;-&&&#"),x("$;p.) &;+.# &;-0/*;p.) &;+.# &;-&"),x('2l""6l7m.e &2n""6n7o.Y &24""6475.M &26""6677.A &28""6879.5 &2@""6@7A.) &2B""6B7C'),x(";.# &;r"),x("%;/G#;'/>$;s/5$;'/,$;/#$+%)(%'#($'#(#'#(\"'#&'#"),x(";M.# &;t"),x("%;/E#28\"\"6879/6$;u.# &;x/'$8#:Ï# )(#'#(\"'#&'#"),x('%;v.# &;w/J#%26""6677/,#;/#$+")("\'#&\'#." &"/#$+")("\'#&\'#'),x('%2Ð""6Ð7Ñ/:#;/1$;w." &"/#$+#)(#\'#("\'#&\'#'),x('%24""6475/,#;{/#$+")("\'#&\'#'),x("%;z/3#$;y0#*;y&/#$+\")(\"'#&'#"),x(";*.) &;+.# &;-"),x(';+. &;-. &22""6273.} &26""6677.q &28""6879.e &2:""6:7;.Y &2<""6<7=.M &2>""6>7?.A &2@""6@7A.5 &2B""6B7C.) &2D""6D7E'),x('%;|/e#$%24""6475/,#;|/#$+")("\'#&\'#0<*%24""6475/,#;|/#$+")("\'#&\'#&/#$+")("\'#&\'#'),x('%$;~0#*;~&/e#$%22""6273/,#;}/#$+")("\'#&\'#0<*%22""6273/,#;}/#$+")("\'#&\'#&/#$+")("\'#&\'#'),x("$;~0#*;~&"),x(';+.w &;-.q &28""6879.e &2:""6:7;.Y &2<""6<7=.M &2>""6>7?.A &2@""6@7A.5 &2B""6B7C.) &2D""6D7E'),x('%%;"/#$;".G &;!.A &2@""6@7A.5 &2F""6F7G.) &2J""6J7K0M*;".G &;!.A &2@""6@7A.5 &2F""6F7G.) &2J""6J7K&/#$+")("\'#&\'#/& 8!:Ò! )'),x(";.# &;"),x('%%;O/2#2:""6:7;/#$+")("\'#&\'#." &"/,#;S/#$+")("\'#&\'#." &"'),x('$;+. &;-.} &2B""6B7C.q &2D""6D7E.e &22""6273.Y &28""6879.M &2:""6:7;.A &2<""6<7=.5 &2>""6>7?.) &2@""6@7A/#0*;+. &;-.} &2B""6B7C.q &2D""6D7E.e &22""6273.Y &28""6879.M &2:""6:7;.A &2<""6<7=.5 &2>""6>7?.) &2@""6@7A&&&#'),x("$;y0#*;y&"),x('%3""5#7Ó/q#24""6475/b$$;!/�#*;!&&&#/L$2J""6J7K/=$$;!/�#*;!&&&#/\'$8%:Ô% )(%\'#($\'#(#\'#("\'#&\'#'),x('2Õ""6Õ7Ö'),x('2×""6×7Ø'),x('2Ù""6Ù7Ú'),x('2Û""6Û7Ü'),x('2Ý""6Ý7Þ'),x('2ß""6ß7à'),x('2á""6á7â'),x('2ã""6ã7ä'),x('2å""6å7æ'),x('2ç""6ç7è'),x('2é""6é7ê'),x("%;
.Y &;.S &;.M &;.G &;.A &;.; &;.5 &;./ &;.) &;.# &;6/& 8!:ë! )"),x("%;/G#;'/>$;/5$;'/,$;/#$+%)(%'#($'#(#'#(\"'#&'#"),x("%;/' 8!:ì!! )"),x("%;!/5#;!/,$;!/#$+#)(#'#(\"'#&'#"),x("%$;*.A &;+.; &;-.5 &;3./ &;4.) &;'.# &;(0G*;*.A &;+.; &;-.5 &;3./ &;4.) &;'.# &;(&/& 8!:í! )"),x("%;¶/Y#$%;A/,#;¶/#$+\")(\"'#&'#06*%;A/,#;¶/#$+\")(\"'#&'#&/#$+\")(\"'#&'#"),x('%;9/N#%2:""6:7;/,#;9/#$+")("\'#&\'#." &"/\'$8":î" )("\'#&\'#'),x("%;:.c &%;/Y#$%;A/,#;/#$+\")(\"'#&'#06*%;A/,#;/#$+\")(\"'#&'#&/#$+\")(\"'#&'#/& 8!:ï! )"),x("%;L.# &;/]#$%;B/,#;/#$+\")(\"'#&'#06*%;B/,#;/#$+\")(\"'#&'#&/'$8\":ð\" )(\"'#&'#"),x("%;.\" &\"/>#;@/5$;M/,$;?/#$+$)($'#(#'#(\"'#&'#"),x("%%;6/Y#$%;./,#;6/#$+\")(\"'#&'#06*%;./,#;6/#$+\")(\"'#&'#&/#$+\")(\"'#&'#.# &;H/' 8!:ñ!! )"),x(";.) &;.# &; "),x("%3ò\"\"5!7ó/:#;</1$;/($8#:ô#! )(#'#(\"'#&'#"),x("%3õ\"\"5'7ö/:#;</1$;/($8#:÷#! )(#'#(\"'#&'#"),x("%$;!/�#*;!&&&#/' 8!:ø!! )"),x('%2ù""6ù7ú/o#%2J""6J7K/M#;!." &"/?$;!." &"/1$;!." &"/#$+$)($\'#(#\'#("\'#&\'#." &"/\'$8":û" )("\'#&\'#'),x('%;6/J#%;</,#;¡/#$+")("\'#&\'#." &"/)$8":ü""! )("\'#&\'#'),x(";6.) &;T.# &;H"),x("%;£/Y#$%;B/,#;¤/#$+\")(\"'#&'#06*%;B/,#;¤/#$+\")(\"'#&'#&/#$+\")(\"'#&'#"),x('%3ý""5&7þ.G &3ÿ""5\'7Ā.; &3ā""5$7Ă./ &3ă""5%7Ą.# &;6/& 8!:ą! )'),x(";¥.# &; "),x('%3Ć""5(7ć/M#;</D$3Ĉ""5(7ĉ./ &3Ċ""5(7ċ.# &;6/#$+#)(#\'#("\'#&\'#'),x("%;6/Y#$%;A/,#;6/#$+\")(\"'#&'#06*%;A/,#;6/#$+\")(\"'#&'#&/#$+\")(\"'#&'#"),x("%$;!/�#*;!&&&#/' 8!:Č!! )"),x("%;©/& 8!:č! )"),x("%;ª/k#;;/b$;¯/Y$$%;B/,#;°/#$+\")(\"'#&'#06*%;B/,#;°/#$+\")(\"'#&'#&/#$+$)($'#(#'#(\"'#&'#"),x(";«.# &;¬"),x('3Ď""5$7ď.S &3Đ""5%7đ.G &3Ē""5%7ē.; &3Ĕ""5%7ĕ./ &3Ė""5+7ė.# &;'),x('3Ę""5\'7ę./ &3Ě""5)7ě.# &;'),x(";6.# &;®"),x('%3Ĝ""5"7ĝ/,#;6/#$+")("\'#&\'#'),x(";.# &;6"),x("%;6/5#;</,$;±/#$+#)(#'#(\"'#&'#"),x(";6.# &;H"),x("%;³/5#;./,$;/#$+#)(#'#(\"'#&'#"),x("%$;!/�#*;!&&&#/' 8!:Ğ!! )"),x("%;/' 8!:ğ!! )"),x('%;¶/^#$%;B/,#; /#$+")("\'#&\'#06*%;B/,#; /#$+")("\'#&\'#&/($8":Ġ"!!)("\'#&\'#'),x('%%;7/e#$%2J""6J7K/,#;7/#$+")("\'#&\'#0<*%2J""6J7K/,#;7/#$+")("\'#&\'#&/#$+")("\'#&\'#/"!&,)'),x("%;L.# &;/]#$%;B/,#;¸/#$+\")(\"'#&'#06*%;B/,#;¸/#$+\")(\"'#&'#&/'$8\":ġ\" )(\"'#&'#"),x(";¹.# &; "),x("%3Ģ\"\"5#7ģ/:#;</1$;6/($8#:Ĥ#! )(#'#(\"'#&'#"),x("%$;!/�#*;!&&&#/' 8!:ĥ!! )"),x("%;/' 8!:Ħ!! )"),x("%$;0#*;&/x#;@/o$;M/f$;?/]$$%;B/,#; /#$+\")(\"'#&'#06*%;B/,#; /#$+\")(\"'#&'#&/'$8%:ħ% )(%'#($'#(#'#(\"'#&'#"),x(";¾"),x("%3Ĩ\"\"5&7ĩ/k#;./b$;Á/Y$$%;A/,#;Á/#$+\")(\"'#&'#06*%;A/,#;Á/#$+\")(\"'#&'#&/#$+$)($'#(#'#(\"'#&'#.# &;¿"),x("%;6/k#;./b$;À/Y$$%;A/,#;À/#$+\")(\"'#&'#06*%;A/,#;À/#$+\")(\"'#&'#&/#$+$)($'#(#'#(\"'#&'#"),x("%;6/;#;</2$;6.# &;H/#$+#)(#'#(\"'#&'#"),x(";Â.G &;Ä.A &;Æ.; &;È.5 &;É./ &;Ê.) &;Ë.# &;À"),x("%3Ī\"\"5%7ī/5#;</,$;Ã/#$+#)(#'#(\"'#&'#"),x("%;I/' 8!:Ĭ!! )"),x("%3ĭ\"\"5&7Į/#;</$;D/
$;Å/|$$%$;'/�#*;'&&&#/,#;Å/#$+\")(\"'#&'#0C*%$;'/�#*;'&&&#/,#;Å/#$+\")(\"'#&'#&/,$;E/#$+&)(&'#(%'#($'#(#'#(\"'#&'#"),x(";t.# &;w"),x("%3į\"\"5%7İ/5#;</,$;Ç/#$+#)(#'#(\"'#&'#"),x("%;I/' 8!:ı!! )"),x("%3IJ\"\"5&7ij/:#;</1$;I/($8#:Ĵ#! )(#'#(\"'#&'#"),x('%3ĵ""5%7Ķ/]#;</T$%3ķ""5$7ĸ/& 8!:Ĺ! ).4 &%3ĺ""5%7Ļ/& 8!:ļ! )/#$+#)(#\'#("\'#&\'#'),x('%3Ľ""5)7ľ/R#;</I$3Ŀ""5#7ŀ./ &3Ł""5(7ł.# &;6/($8#:Ń#! )(#\'#("\'#&\'#'),x('%3ń""5#7Ņ/#;</$;D/$%;Ì/e#$%2D""6D7E/,#;Ì/#$+")("\'#&\'#0<*%2D""6D7E/,#;Ì/#$+")("\'#&\'#&/#$+")("\'#&\'#/,$;E/#$+%)(%\'#($\'#(#\'#("\'#&\'#'),x('%3ņ""5(7Ň./ &3ň""5$7ʼn.# &;6/\' 8!:Ŋ!! )'),x("%;6/Y#$%;A/,#;6/#$+\")(\"'#&'#06*%;A/,#;6/#$+\")(\"'#&'#&/#$+\")(\"'#&'#"),x("%;Ï/G#;./>$;Ï/5$;./,$;/#$+%)(%'#($'#(#'#(\"'#&'#"),x("%$;!/�#*;!&&&#/' 8!:ŋ!! )"),x("%;Ñ/]#$%;A/,#;Ñ/#$+\")(\"'#&'#06*%;A/,#;Ñ/#$+\")(\"'#&'#&/'$8\":Ō\" )(\"'#&'#"),x("%;/]#$%;B/,#; /#$+\")(\"'#&'#06*%;B/,#; /#$+\")(\"'#&'#&/'$8\":ō\" )(\"'#&'#"),x('%;L.O &;.I &%;@." &"/:#;t/1$;?." &"/#$+#)(#\'#("\'#&\'#/]#$%;B/,#; /#$+")("\'#&\'#06*%;B/,#; /#$+")("\'#&\'#&/\'$8":Ŏ" )("\'#&\'#'),x("%;Ô/]#$%;B/,#;Õ/#$+\")(\"'#&'#06*%;B/,#;Õ/#$+\")(\"'#&'#&/'$8\":ŏ\" )(\"'#&'#"),x("%;/& 8!:Ő! )"),x('%3ő""5(7Œ/:#;</1$;6/($8#:œ#! )(#\'#("\'#&\'#.g &%3Ŕ""5&7ŕ/:#;</1$;6/($8#:Ŗ#! )(#\'#("\'#&\'#.: &%3ŗ""5*7Ř/& 8!:ř! ).# &; '),x('%%;6/k#$%;A/2#;6/)$8":Ś""$ )("\'#&\'#0<*%;A/2#;6/)$8":Ś""$ )("\'#&\'#&/)$8":ś""! )("\'#&\'#." &"/\' 8!:Ŝ!! )'),x("%;Ø/Y#$%;A/,#;Ø/#$+\")(\"'#&'#06*%;A/,#;Ø/#$+\")(\"'#&'#&/#$+\")(\"'#&'#"),x("%;/Y#$%;B/,#; /#$+\")(\"'#&'#06*%;B/,#; /#$+\")(\"'#&'#&/#$+\")(\"'#&'#"),x("%$;!/�#*;!&&&#/' 8!:ŝ!! )"),x("%;Û/Y#$%;B/,#;Ü/#$+\")(\"'#&'#06*%;B/,#;Ü/#$+\")(\"'#&'#&/#$+\")(\"'#&'#"),x('%3Ş""5&7ş.; &3Š""5\'7š./ &3Ţ""5*7ţ.# &;6/& 8!:Ť! )'),x("%3ť\"\"5&7Ŧ/:#;</1$;Ý/($8#:ŧ#! )(#'#(\"'#&'#.} &%3õ\"\"5'7ö/:#;</1$;/($8#:Ũ#! )(#'#(\"'#&'#.P &%3ũ\"\"5+7Ū/:#;</1$;/($8#:ū#! )(#'#(\"'#&'#.# &; "),x('3Ŭ""5+7ŭ.k &3Ů""5)7ů._ &3Ű""5(7ű.S &3Ų""5\'7ų.G &3Ŵ""5&7ŵ.; &3Ŷ""5*7ŷ./ &3Ÿ""5)7Ź.# &;6'),x(';1." &"'),x('%%;6/k#$%;A/2#;6/)$8":Ś""$ )("\'#&\'#0<*%;A/2#;6/)$8":Ś""$ )("\'#&\'#&/)$8":ś""! )("\'#&\'#." &"/\' 8!:ź!! )'),x("%;L.# &;/]#$%;B/,#;á/#$+\")(\"'#&'#06*%;B/,#;á/#$+\")(\"'#&'#&/'$8\":Ż\" )(\"'#&'#"),x(";¹.# &; "),x("%;ã/Y#$%;A/,#;ã/#$+\")(\"'#&'#06*%;A/,#;ã/#$+\")(\"'#&'#&/#$+\")(\"'#&'#"),x("%;ê/k#;./b$;í/Y$$%;B/,#;ä/#$+\")(\"'#&'#06*%;B/,#;ä/#$+\")(\"'#&'#&/#$+$)($'#(#'#(\"'#&'#"),x(";å.; &;æ.5 &;ç./ &;è.) &;é.# &; "),x("%3ż\"\"5#7Ž/:#;</1$;ð/($8#:ž#! )(#'#(\"'#&'#"),x("%3ſ\"\"5%7ƀ/:#;</1$;T/($8#:Ɓ#! )(#'#(\"'#&'#"),x("%3Ƃ\"\"5(7ƃ/F#;</=$;\\.) &;Y.# &;X/($8#:Ƅ#! )(#'#(\"'#&'#"),x("%3ƅ\"\"5&7Ɔ/:#;</1$;6/($8#:Ƈ#! )(#'#(\"'#&'#"),x("%3ƈ\"\"5%7Ɖ/A#;</8$$;!0#*;!&/($8#:Ɗ#! )(#'#(\"'#&'#"),x("%;ë/G#;;/>$;6/5$;;/,$;ì/#$+%)(%'#($'#(#'#(\"'#&'#"),x('%3""5#7Ó.# &;6/\' 8!:Ƌ!! )'),x('%3±""5#7ƌ.G &3³""5#7ƍ.; &3·""5#7Ǝ./ &3µ""5$7Ə.# &;6/\' 8!:Ɛ!! )'),x('%;î/D#%;C/,#;ï/#$+")("\'#&\'#." &"/#$+")("\'#&\'#'),x("%;U.) &;\\.# &;X/& 8!:Ƒ! )"),x('%%;!." &"/[#;!." &"/M$;!." &"/?$;!." &"/1$;!." &"/#$+%)(%\'#($\'#(#\'#("\'#&\'#/\' 8!:ƒ!! )'),x('%%;!/?#;!." &"/1$;!." &"/#$+#)(#\'#("\'#&\'#/\' 8!:Ɠ!! )'),x(";¾"),x('%;/^#$%;B/,#;ó/#$+")("\'#&\'#06*%;B/,#;ó/#$+")("\'#&\'#&/($8":Ɣ"!!)("\'#&\'#'),x(";ô.# &; "),x('%2ƕ""6ƕ7Ɩ/L#;</C$2Ɨ""6Ɨ7Ƙ.) &2ƙ""6ƙ7ƚ/($8#:ƛ#! )(#\'#("\'#&\'#'),x('%;/^#$%;B/,#; /#$+")("\'#&\'#06*%;B/,#; /#$+")("\'#&\'#&/($8":Ɯ"!!)("\'#&\'#'),x("%;6/5#;0/,$;÷/#$+#)(#'#(\"'#&'#"),x("$;2.) &;4.# &;.0/*;2.) &;4.# &;.&"),x("$;%0#*;%&"),x("%;ú/;#28\"\"6879/,$;û/#$+#)(#'#(\"'#&'#"),x('%3Ɲ""5%7ƞ.) &3Ɵ""5$7Ơ/\' 8!:ơ!! )'),x('%;ü/J#%28""6879/,#;^/#$+")("\'#&\'#." &"/#$+")("\'#&\'#'),x("%;\\.) &;X.# &;/' 8!:Ƣ!! )"),x(';".S &;!.M &2F""6F7G.A &2J""6J7K.5 &2H""6H7I.) &2N""6N7O'),x('2L""6L7M. &2B""6B7C. &2<""6<7=.} &2R""6R7S.q &2T""6T7U.e &2V""6V7W.Y &2P""6P7Q.M &2@""6@7A.A &2D""6D7E.5 &22""6273.) &2>""6>7?'),x('%;Ā/b#28""6879/S$;û/J$%2ƣ""6ƣ7Ƥ/,#;ì/#$+")("\'#&\'#." &"/#$+$)($\'#(#\'#("\'#&\'#'),x('%3ƥ""5%7Ʀ.) &3Ƨ""5$7ƨ/\' 8!:ơ!! )'),x('%3±""5#7².6 &3³""5#7´.* &$;+0#*;+&/\' 8!:Ʃ!! )'),x("%;Ą/#2F\"\"6F7G/x$;ă/o$2F\"\"6F7G/`$;ă/W$2F\"\"6F7G/H$;ă/?$2F\"\"6F7G/0$;ą/'$8):ƪ) )()'#(('#(''#(&'#(%'#($'#(#'#(\"'#&'#"),x("%;#/>#;#/5$;#/,$;#/#$+$)($'#(#'#(\"'#&'#"),x("%;ă/,#;ă/#$+\")(\"'#&'#"),x("%;ă/5#;ă/,$;ă/#$+#)(#'#(\"'#&'#"),x("%;q/T#$;m0#*;m&/D$%; /,#;ø/#$+\")(\"'#&'#.\" &\"/#$+#)(#'#(\"'#&'#"),x('%2ƫ""6ƫ7Ƭ.) &2ƭ""6ƭ7Ʈ/w#;0/n$;Ĉ/e$$%;B/2#;ĉ.# &; /#$+")("\'#&\'#0<*%;B/2#;ĉ.# &; /#$+")("\'#&\'#&/#$+$)($\'#(#\'#("\'#&\'#'),x(";.# &;L"),x("%2Ư\"\"6Ư7ư/5#;</,$;Ċ/#$+#)(#'#(\"'#&'#"),x("%;D/S#;,/J$2:\"\"6:7;/;$;,.# &;T/,$;E/#$+%)(%'#($'#(#'#(\"'#&'#")],c=0,l=0,p=[{line:1,column:1}],f=0,g=[],m=0;if(void 0!==t.startRule){if(!(t.startRule in o))throw new Error("Can't start parsing from rule \""+t.startRule+'".');i=o[t.startRule]}function v(){return e.substring(l,c)}function y(){return C(l,c)}function b(e,t){return{type:"literal",text:e,ignoreCase:t}}function w(e,t,n){return{type:"class",parts:e,inverted:t,ignoreCase:n}}function S(){return{type:"end"}}function T(t){var n,r=p[t];if(r)return r;n=t-1;while(!p[n])n--;r=p[n],r={line:r.line,column:r.column};while(n<t)10===e.charCodeAt(n)?(r.line++,r.column=1):r.column++,n++;return p[t]=r,r}function C(e,t){var n=T(e),r=T(t);return{start:{offset:e,line:n.line,column:n.column},end:{offset:t,line:r.line,column:r.column}}}function E(e){c<f||(c>f&&(f=c,g=[]),g.push(e))}function k(e,t,n){return new h(h.buildMessage(e,t),e,t,n)}function x(e){return e.split("").map((function(e){return e.charCodeAt(0)-32}))}function I(t){var n,o=a[t],i=0,u=[],d=o.length,p=[],h=[];while(1){while(i<d)switch(o[i]){case 0:h.push(s[o[i+1]]),i+=2;break;case 1:h.push(void 0),i++;break;case 2:h.push(null),i++;break;case 3:h.push(r),i++;break;case 4:h.push([]),i++;break;case 5:h.push(c),i++;break;case 6:h.pop(),i++;break;case 7:c=h.pop(),i++;break;case 8:h.length-=o[i+1],i+=2;break;case 9:h.splice(-2,1),i++;break;case 10:h[h.length-2].push(h.pop()),i++;break;case 11:h.push(h.splice(h.length-o[i+1],o[i+1])),i+=2;break;case 12:h.push(e.substring(h.pop(),c)),i++;break;case 13:p.push(d),u.push(i+3+o[i+1]+o[i+2]),h[h.length-1]?(d=i+3+o[i+1],i+=3):(d=i+3+o[i+1]+o[i+2],i+=3+o[i+1]);break;case 14:p.push(d),u.push(i+3+o[i+1]+o[i+2]),h[h.length-1]===r?(d=i+3+o[i+1],i+=3):(d=i+3+o[i+1]+o[i+2],i+=3+o[i+1]);break;case 15:p.push(d),u.push(i+3+o[i+1]+o[i+2]),h[h.length-1]!==r?(d=i+3+o[i+1],i+=3):(d=i+3+o[i+1]+o[i+2],i+=3+o[i+1]);break;case 16:h[h.length-1]!==r?(p.push(d),u.push(i),d=i+2+o[i+1],i+=2):i+=2+o[i+1];break;case 17:p.push(d),u.push(i+3+o[i+1]+o[i+2]),e.length>c?(d=i+3+o[i+1],i+=3):(d=i+3+o[i+1]+o[i+2],i+=3+o[i+1]);break;case 18:p.push(d),u.push(i+4+o[i+2]+o[i+3]),e.substr(c,s[o[i+1]].length)===s[o[i+1]]?(d=i+4+o[i+2],i+=4):(d=i+4+o[i+2]+o[i+3],i+=4+o[i+2]);break;case 19:p.push(d),u.push(i+4+o[i+2]+o[i+3]),e.substr(c,s[o[i+1]].length).toLowerCase()===s[o[i+1]]?(d=i+4+o[i+2],i+=4):(d=i+4+o[i+2]+o[i+3],i+=4+o[i+2]);break;case 20:p.push(d),u.push(i+4+o[i+2]+o[i+3]),s[o[i+1]].test(e.charAt(c))?(d=i+4+o[i+2],i+=4):(d=i+4+o[i+2]+o[i+3],i+=4+o[i+2]);break;case 21:h.push(e.substr(c,o[i+1])),c+=o[i+1],i+=2;break;case 22:h.push(s[o[i+1]]),c+=s[o[i+1]].length,i+=2;break;case 23:h.push(r),0===m&&E(s[o[i+1]]),i+=2;break;case 24:l=h[h.length-1-o[i+1]],i+=2;break;case 25:l=c,i++;break;case 26:n=o.slice(i+4,i+4+o[i+3]).map((function(e){return h[h.length-1-e]})),h.splice(h.length-o[i+2],o[i+2],s[o[i+1]].apply(null,n)),i+=4+o[i+3];break;case 27:h.push(I(o[i+1])),i+=2;break;case 28:m++,i++;break;case 29:m--,i++;break;default:throw new Error("Invalid opcode: "+o[i]+".")}if(!(p.length>0))break;d=p.pop(),i=u.pop()}return h[0]}function R(e,t){return[e].concat(t)}if(t.data={},n=I(i),n!==r&&c===e.length)return n;throw n!==r&&c<e.length&&E(S()),k(g,f<e.length?e.charAt(f):null,f<e.length?C(f,f+1):C(f,f))}var g,m,v=f;(function(e){function t(e,t){var n={startRule:t};try{v(e,n)}catch(r){n.data=-1}return n.data}function n(t){var n=e.parse(t,"Name_Addr_Header");return-1!==n?n:void 0}function r(t){var n=e.parse(t,"SIP_URI");return-1!==n?n:void 0}e.parse=t,e.nameAddrHeaderParse=n,e.URIParse=r})(g||(g={})),function(e){e.ACK="ACK",e.BYE="BYE",e.CANCEL="CANCEL",e.INFO="INFO",e.INVITE="INVITE",e.MESSAGE="MESSAGE",e.NOTIFY="NOTIFY",e.OPTIONS="OPTIONS",e.REGISTER="REGISTER",e.UPDATE="UPDATE",e.SUBSCRIBE="SUBSCRIBE",e.PUBLISH="PUBLISH",e.REFER="REFER",e.PRACK="PRACK"}(m||(m={}));var y={100:"Trying",180:"Ringing",181:"Call Is Being Forwarded",182:"Queued",183:"Session Progress",199:"Early Dialog Terminated",200:"OK",202:"Accepted",204:"No Notification",300:"Multiple Choices",301:"Moved Permanently",302:"Moved Temporarily",305:"Use Proxy",380:"Alternative Service",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",410:"Gone",412:"Conditional Request Failed",413:"Request Entity Too Large",414:"Request-URI Too Long",415:"Unsupported Media Type",416:"Unsupported URI Scheme",417:"Unknown Resource-Priority",420:"Bad Extension",421:"Extension Required",422:"Session Interval Too Small",423:"Interval Too Brief",428:"Use Identity Header",429:"Provide Referrer Identity",430:"Flow Failed",433:"Anonymity Disallowed",436:"Bad Identity-Info",437:"Unsupported Certificate",438:"Invalid Identity Header",439:"First Hop Lacks Outbound Support",440:"Max-Breadth Exceeded",469:"Bad Info Package",470:"Consent Needed",478:"Unresolvable Destination",480:"Temporarily Unavailable",481:"Call/Transaction Does Not Exist",482:"Loop Detected",483:"Too Many Hops",484:"Address Incomplete",485:"Ambiguous",486:"Busy Here",487:"Request Terminated",488:"Not Acceptable Here",489:"Bad Event",491:"Request Pending",493:"Undecipherable",494:"Security Agreement Required",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Server Time-out",505:"Version Not Supported",513:"Message Too Large",580:"Precondition Failure",600:"Busy Everywhere",603:"Decline",604:"Does Not Exist Anywhere",606:"Not Acceptable"};function b(e,t){void 0===t&&(t=32);for(var n="",r=0;r<e;r++){var o=Math.floor(Math.random()*t);n+=o.toString(t)}return n}function w(e){return y[e]||""}function S(){return b(10)}function T(e){for(var t={"Call-Id":"Call-ID",Cseq:"CSeq","Min-Se":"Min-SE",Rack:"RAck",Rseq:"RSeq","Www-Authenticate":"WWW-Authenticate"},n=e.toLowerCase().replace(/_/g,"-").split("-"),r=n.length,o="",i=0;i<r;i++)0!==i&&(o+="-"),o+=n[i].charAt(0).toUpperCase()+n[i].substring(1);return t[o]&&(o=t[o]),o}function C(e){return encodeURIComponent(e).replace(/%[A-F\d]{2}/g,"U").length}var E=function(){function e(){this.headers={}}return e.prototype.addHeader=function(e,t){var n={raw:t};e=T(e),this.headers[e]?this.headers[e].push(n):this.headers[e]=[n]},e.prototype.getHeader=function(e){var t=this.headers[T(e)];if(t)return t[0]?t[0].raw:void 0},e.prototype.getHeaders=function(e){var t=this.headers[T(e)],n=[];if(!t)return[];for(var r=0,o=t;r<o.length;r++){var i=o[r];n.push(i.raw)}return n},e.prototype.hasHeader=function(e){return!!this.headers[T(e)]},e.prototype.parseHeader=function(e,t){if(void 0===t&&(t=0),e=T(e),this.headers[e]&&!(t>=this.headers[e].length)){var n=this.headers[e][t],r=n.raw;if(n.parsed)return n.parsed;var o=g.parse(r,e.replace(/-/g,"_"));return-1===o?void this.headers[e].splice(t,1):(n.parsed=o,o)}},e.prototype.s=function(e,t){return void 0===t&&(t=0),this.parseHeader(e,t)},e.prototype.setHeader=function(e,t){this.headers[T(e)]=[{raw:t}]},e.prototype.toString=function(){return this.data},e}(),k=function(e){function t(){return e.call(this)||this}return o(t,e),t}(E),x=function(e){function t(){return e.call(this)||this}return o(t,e),t}(E),I=function(){function e(t,n,r,o,s,a,c){this.headers={},this.extraHeaders=[],this.options=e.getDefaultOptions(),s&&(this.options=i(i({},this.options),s),this.options.optionTags&&this.options.optionTags.length&&(this.options.optionTags=this.options.optionTags.slice()),this.options.routeSet&&this.options.routeSet.length&&(this.options.routeSet=this.options.routeSet.slice())),a&&a.length&&(this.extraHeaders=a.slice()),c&&(this.body={body:c.content,contentType:c.contentType}),this.method=t,this.ruri=n.clone(),this.fromURI=r.clone(),this.fromTag=this.options.fromTag?this.options.fromTag:S(),this.from=e.makeNameAddrHeader(this.fromURI,this.options.fromDisplayName,this.fromTag),this.toURI=o.clone(),this.toTag=this.options.toTag,this.to=e.makeNameAddrHeader(this.toURI,this.options.toDisplayName,this.toTag),this.callId=this.options.callId?this.options.callId:this.options.callIdPrefix+b(15),this.cseq=this.options.cseq,this.setHeader("route",this.options.routeSet),this.setHeader("via",""),this.setHeader("to",this.to.toString()),this.setHeader("from",this.from.toString()),this.setHeader("cseq",this.cseq+" "+this.method),this.setHeader("call-id",this.callId),this.setHeader("max-forwards","70")}return e.getDefaultOptions=function(){return{callId:"",callIdPrefix:"",cseq:1,toDisplayName:"",toTag:"",fromDisplayName:"",fromTag:"",forceRport:!1,hackViaTcp:!1,optionTags:["outbound"],routeSet:[],userAgentString:"sip.js",viaHost:""}},e.makeNameAddrHeader=function(e,t,n){var r={};return n&&(r.tag=n),new u(e,t,r)},e.prototype.getHeader=function(e){var t=this.headers[T(e)];if(t){if(t[0])return t[0]}else for(var n=new RegExp("^\\s*"+e+"\\s*:","i"),r=0,o=this.extraHeaders;r<o.length;r++){var i=o[r];if(n.test(i))return i.substring(i.indexOf(":")+1).trim()}},e.prototype.getHeaders=function(e){var t=[],n=this.headers[T(e)];if(n)for(var r=0,o=n;r<o.length;r++){var i=o[r];t.push(i)}else for(var s=new RegExp("^\\s*"+e+"\\s*:","i"),a=0,c=this.extraHeaders;a<c.length;a++){var l=c[a];s.test(l)&&t.push(l.substring(l.indexOf(":")+1).trim())}return t},e.prototype.hasHeader=function(e){if(this.headers[T(e)])return!0;for(var t=new RegExp("^\\s*"+e+"\\s*:","i"),n=0,r=this.extraHeaders;n<r.length;n++){var o=r[n];if(t.test(o))return!0}return!1},e.prototype.setHeader=function(e,t){this.headers[T(e)]=t instanceof Array?t:[t]},e.prototype.setViaHeader=function(e,t){this.options.hackViaTcp&&(t="TCP");var n="SIP/2.0/"+t;n+=" "+this.options.viaHost+";branch="+e,this.options.forceRport&&(n+=";rport"),this.setHeader("via",n),this.branch=e},e.prototype.toString=function(){var e="";for(var t in e+=this.method+" "+this.ruri.toRaw()+" SIP/2.0\r\n",this.headers)if(this.headers[t])for(var n=0,r=this.headers[t];n<r.length;n++){var o=r[n];e+=t+": "+o+"\r\n"}for(var i=0,s=this.extraHeaders;i<s.length;i++){t=s[i];e+=t.trim()+"\r\n"}return e+="Supported: "+this.options.optionTags.join(", ")+"\r\n",e+="User-Agent: "+this.options.userAgentString+"\r\n",this.body?"string"===typeof this.body?(e+="Content-Length: "+C(this.body)+"\r\n\r\n",e+=this.body):this.body.body&&this.body.contentType?(e+="Content-Type: "+this.body.contentType+"\r\n",e+="Content-Length: "+C(this.body.body)+"\r\n\r\n",e+=this.body.body):e+="Content-Length: 0\r\n\r\n":e+="Content-Length: 0\r\n\r\n",e},e}();function R(e){return"application/sdp"===e?"session":"render"}function _(e){var t="string"===typeof e?e:e.body,n="string"===typeof e?"application/sdp":e.contentType,r=R(n),o={contentDisposition:r,contentType:n,content:t};return o}function N(e){return!(!e||"string"!==typeof e.content||"string"!==typeof e.contentType||void 0!==e.contentDisposition)||"string"===typeof e.contentDisposition}function A(e){var t,n,r;if(e instanceof k&&e.body){var o=e.parseHeader("Content-Disposition");t=o?o.type:void 0,n=e.parseHeader("Content-Type"),r=e.body}if(e instanceof x&&e.body){o=e.parseHeader("Content-Disposition");t=o?o.type:void 0,n=e.parseHeader("Content-Type"),r=e.body}if(e instanceof I&&e.body)if(t=e.getHeader("Content-Disposition"),n=e.getHeader("Content-Type"),"string"===typeof e.body){if(!n)throw new Error("Header content type header does not equal body content type.");r=e.body}else{if(n&&n!==e.body.contentType)throw new Error("Header content type header does not equal body content type.");n=e.body.contentType,r=e.body.body}if(N(e)&&(t=e.contentDisposition,n=e.contentType,r=e.content),r){if(n&&!t&&(t=R(n)),!t)throw new Error("Content disposition undefined.");if(!n)throw new Error("Content type undefined.");return{contentDisposition:t,contentType:n,content:r}}}var O=function(){function e(){this._dataLength=0,this._bufferLength=0,this._state=new Int32Array(4),this._buffer=new ArrayBuffer(68),this._buffer8=new Uint8Array(this._buffer,0,68),this._buffer32=new Uint32Array(this._buffer,0,17),this.start()}return e.hashStr=function(e,t){return void 0===t&&(t=!1),this.onePassHasher.start().appendStr(e).end(t)},e.hashAsciiStr=function(e,t){return void 0===t&&(t=!1),this.onePassHasher.start().appendAsciiStr(e).end(t)},e._hex=function(t){var n,r,o,i,s=e.hexChars,a=e.hexOut;for(i=0;i<4;i+=1)for(r=8*i,n=t[i],o=0;o<8;o+=2)a[r+1+o]=s.charAt(15&n),n>>>=4,a[r+0+o]=s.charAt(15&n),n>>>=4;return a.join("")},e._md5cycle=function(e,t){var n=e[0],r=e[1],o=e[2],i=e[3];n+=(r&o|~r&i)+t[0]-680876936|0,n=(n<<7|n>>>25)+r|0,i+=(n&r|~n&o)+t[1]-389564586|0,i=(i<<12|i>>>20)+n|0,o+=(i&n|~i&r)+t[2]+606105819|0,o=(o<<17|o>>>15)+i|0,r+=(o&i|~o&n)+t[3]-1044525330|0,r=(r<<22|r>>>10)+o|0,n+=(r&o|~r&i)+t[4]-176418897|0,n=(n<<7|n>>>25)+r|0,i+=(n&r|~n&o)+t[5]+1200080426|0,i=(i<<12|i>>>20)+n|0,o+=(i&n|~i&r)+t[6]-1473231341|0,o=(o<<17|o>>>15)+i|0,r+=(o&i|~o&n)+t[7]-45705983|0,r=(r<<22|r>>>10)+o|0,n+=(r&o|~r&i)+t[8]+1770035416|0,n=(n<<7|n>>>25)+r|0,i+=(n&r|~n&o)+t[9]-1958414417|0,i=(i<<12|i>>>20)+n|0,o+=(i&n|~i&r)+t[10]-42063|0,o=(o<<17|o>>>15)+i|0,r+=(o&i|~o&n)+t[11]-1990404162|0,r=(r<<22|r>>>10)+o|0,n+=(r&o|~r&i)+t[12]+1804603682|0,n=(n<<7|n>>>25)+r|0,i+=(n&r|~n&o)+t[13]-40341101|0,i=(i<<12|i>>>20)+n|0,o+=(i&n|~i&r)+t[14]-1502002290|0,o=(o<<17|o>>>15)+i|0,r+=(o&i|~o&n)+t[15]+1236535329|0,r=(r<<22|r>>>10)+o|0,n+=(r&i|o&~i)+t[1]-165796510|0,n=(n<<5|n>>>27)+r|0,i+=(n&o|r&~o)+t[6]-1069501632|0,i=(i<<9|i>>>23)+n|0,o+=(i&r|n&~r)+t[11]+643717713|0,o=(o<<14|o>>>18)+i|0,r+=(o&n|i&~n)+t[0]-373897302|0,r=(r<<20|r>>>12)+o|0,n+=(r&i|o&~i)+t[5]-701558691|0,n=(n<<5|n>>>27)+r|0,i+=(n&o|r&~o)+t[10]+38016083|0,i=(i<<9|i>>>23)+n|0,o+=(i&r|n&~r)+t[15]-660478335|0,o=(o<<14|o>>>18)+i|0,r+=(o&n|i&~n)+t[4]-405537848|0,r=(r<<20|r>>>12)+o|0,n+=(r&i|o&~i)+t[9]+568446438|0,n=(n<<5|n>>>27)+r|0,i+=(n&o|r&~o)+t[14]-1019803690|0,i=(i<<9|i>>>23)+n|0,o+=(i&r|n&~r)+t[3]-187363961|0,o=(o<<14|o>>>18)+i|0,r+=(o&n|i&~n)+t[8]+1163531501|0,r=(r<<20|r>>>12)+o|0,n+=(r&i|o&~i)+t[13]-1444681467|0,n=(n<<5|n>>>27)+r|0,i+=(n&o|r&~o)+t[2]-51403784|0,i=(i<<9|i>>>23)+n|0,o+=(i&r|n&~r)+t[7]+1735328473|0,o=(o<<14|o>>>18)+i|0,r+=(o&n|i&~n)+t[12]-1926607734|0,r=(r<<20|r>>>12)+o|0,n+=(r^o^i)+t[5]-378558|0,n=(n<<4|n>>>28)+r|0,i+=(n^r^o)+t[8]-2022574463|0,i=(i<<11|i>>>21)+n|0,o+=(i^n^r)+t[11]+1839030562|0,o=(o<<16|o>>>16)+i|0,r+=(o^i^n)+t[14]-35309556|0,r=(r<<23|r>>>9)+o|0,n+=(r^o^i)+t[1]-1530992060|0,n=(n<<4|n>>>28)+r|0,i+=(n^r^o)+t[4]+1272893353|0,i=(i<<11|i>>>21)+n|0,o+=(i^n^r)+t[7]-155497632|0,o=(o<<16|o>>>16)+i|0,r+=(o^i^n)+t[10]-1094730640|0,r=(r<<23|r>>>9)+o|0,n+=(r^o^i)+t[13]+681279174|0,n=(n<<4|n>>>28)+r|0,i+=(n^r^o)+t[0]-358537222|0,i=(i<<11|i>>>21)+n|0,o+=(i^n^r)+t[3]-722521979|0,o=(o<<16|o>>>16)+i|0,r+=(o^i^n)+t[6]+76029189|0,r=(r<<23|r>>>9)+o|0,n+=(r^o^i)+t[9]-640364487|0,n=(n<<4|n>>>28)+r|0,i+=(n^r^o)+t[12]-421815835|0,i=(i<<11|i>>>21)+n|0,o+=(i^n^r)+t[15]+530742520|0,o=(o<<16|o>>>16)+i|0,r+=(o^i^n)+t[2]-995338651|0,r=(r<<23|r>>>9)+o|0,n+=(o^(r|~i))+t[0]-198630844|0,n=(n<<6|n>>>26)+r|0,i+=(r^(n|~o))+t[7]+1126891415|0,i=(i<<10|i>>>22)+n|0,o+=(n^(i|~r))+t[14]-1416354905|0,o=(o<<15|o>>>17)+i|0,r+=(i^(o|~n))+t[5]-57434055|0,r=(r<<21|r>>>11)+o|0,n+=(o^(r|~i))+t[12]+1700485571|0,n=(n<<6|n>>>26)+r|0,i+=(r^(n|~o))+t[3]-1894986606|0,i=(i<<10|i>>>22)+n|0,o+=(n^(i|~r))+t[10]-1051523|0,o=(o<<15|o>>>17)+i|0,r+=(i^(o|~n))+t[1]-2054922799|0,r=(r<<21|r>>>11)+o|0,n+=(o^(r|~i))+t[8]+1873313359|0,n=(n<<6|n>>>26)+r|0,i+=(r^(n|~o))+t[15]-30611744|0,i=(i<<10|i>>>22)+n|0,o+=(n^(i|~r))+t[6]-1560198380|0,o=(o<<15|o>>>17)+i|0,r+=(i^(o|~n))+t[13]+1309151649|0,r=(r<<21|r>>>11)+o|0,n+=(o^(r|~i))+t[4]-145523070|0,n=(n<<6|n>>>26)+r|0,i+=(r^(n|~o))+t[11]-1120210379|0,i=(i<<10|i>>>22)+n|0,o+=(n^(i|~r))+t[2]+718787259|0,o=(o<<15|o>>>17)+i|0,r+=(i^(o|~n))+t[9]-343485551|0,r=(r<<21|r>>>11)+o|0,e[0]=n+e[0]|0,e[1]=r+e[1]|0,e[2]=o+e[2]|0,e[3]=i+e[3]|0},e.prototype.start=function(){return this._dataLength=0,this._bufferLength=0,this._state.set(e.stateIdentity),this},e.prototype.appendStr=function(t){var n,r,o=this._buffer8,i=this._buffer32,s=this._bufferLength;for(r=0;r<t.length;r+=1){if(n=t.charCodeAt(r),n<128)o[s++]=n;else if(n<2048)o[s++]=192+(n>>>6),o[s++]=63&n|128;else if(n<55296||n>56319)o[s++]=224+(n>>>12),o[s++]=n>>>6&63|128,o[s++]=63&n|128;else{if(n=1024*(n-55296)+(t.charCodeAt(++r)-56320)+65536,n>1114111)throw new Error("Unicode standard supports code points up to U+10FFFF");o[s++]=240+(n>>>18),o[s++]=n>>>12&63|128,o[s++]=n>>>6&63|128,o[s++]=63&n|128}s>=64&&(this._dataLength+=64,e._md5cycle(this._state,i),s-=64,i[0]=i[16])}return this._bufferLength=s,this},e.prototype.appendAsciiStr=function(t){for(var n,r=this._buffer8,o=this._buffer32,i=this._bufferLength,s=0;;){n=Math.min(t.length-s,64-i);while(n--)r[i++]=t.charCodeAt(s++);if(i<64)break;this._dataLength+=64,e._md5cycle(this._state,o),i=0}return this._bufferLength=i,this},e.prototype.appendByteArray=function(t){for(var n,r=this._buffer8,o=this._buffer32,i=this._bufferLength,s=0;;){n=Math.min(t.length-s,64-i);while(n--)r[i++]=t[s++];if(i<64)break;this._dataLength+=64,e._md5cycle(this._state,o),i=0}return this._bufferLength=i,this},e.prototype.getState=function(){var e=this,t=e._state;return{buffer:String.fromCharCode.apply(null,e._buffer8),buflen:e._bufferLength,length:e._dataLength,state:[t[0],t[1],t[2],t[3]]}},e.prototype.setState=function(e){var t,n=e.buffer,r=e.state,o=this._state;for(this._dataLength=e.length,this._bufferLength=e.buflen,o[0]=r[0],o[1]=r[1],o[2]=r[2],o[3]=r[3],t=0;t<n.length;t+=1)this._buffer8[t]=n.charCodeAt(t)},e.prototype.end=function(t){void 0===t&&(t=!1);var n,r=this._bufferLength,o=this._buffer8,i=this._buffer32,s=1+(r>>2);if(this._dataLength+=r,o[r]=128,o[r+1]=o[r+2]=o[r+3]=0,i.set(e.buffer32Identity.subarray(s),s),r>55&&(e._md5cycle(this._state,i),i.set(e.buffer32Identity)),n=8*this._dataLength,n<=4294967295)i[14]=n;else{var a=n.toString(16).match(/(.*?)(.{0,8})$/);if(null===a)return;var c=parseInt(a[2],16),l=parseInt(a[1],16)||0;i[14]=c,i[15]=l}return e._md5cycle(this._state,i),t?this._state:e._hex(this._state)},e.stateIdentity=new Int32Array([1732584193,-271733879,-1732584194,271733878]),e.buffer32Identity=new Int32Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),e.hexChars="0123456789abcdef",e.hexOut=[],e.onePassHasher=new e,e}();function P(e){return O.hashStr(e)}"5d41402abc4b2a76b9719d911017c592"!==O.hashStr("hello")&&console.error("Md5 self test failed.");var D,B=function(){function e(e,t,n,r){this.logger=e.getLogger("sipjs.digestauthentication"),this.username=n,this.password=r,this.ha1=t,this.nc=0,this.ncHex="00000000"}return e.prototype.authenticate=function(e,t,n){if(this.algorithm=t.algorithm,this.realm=t.realm,this.nonce=t.nonce,this.opaque=t.opaque,this.stale=t.stale,this.algorithm){if("MD5"!==this.algorithm)return this.logger.warn("challenge with Digest algorithm different than 'MD5', authentication aborted"),!1}else this.algorithm="MD5";if(!this.realm)return this.logger.warn("challenge without Digest realm, authentication aborted"),!1;if(!this.nonce)return this.logger.warn("challenge without Digest nonce, authentication aborted"),!1;if(t.qop)if(t.qop.indexOf("auth")>-1)this.qop="auth";else{if(!(t.qop.indexOf("auth-int")>-1))return this.logger.warn("challenge without Digest qop different than 'auth' or 'auth-int', authentication aborted"),!1;this.qop="auth-int"}else this.qop=void 0;return this.method=e.method,this.uri=e.ruri,this.cnonce=b(12),this.nc+=1,this.updateNcHex(),4294967296===this.nc&&(this.nc=1,this.ncHex="00000001"),this.calculateResponse(n),!0},e.prototype.toString=function(){var e=[];if(!this.response)throw new Error("response field does not exist, cannot generate Authorization header");return e.push("algorithm="+this.algorithm),e.push('username="'+this.username+'"'),e.push('realm="'+this.realm+'"'),e.push('nonce="'+this.nonce+'"'),e.push('uri="'+this.uri+'"'),e.push('response="'+this.response+'"'),this.opaque&&e.push('opaque="'+this.opaque+'"'),this.qop&&(e.push("qop="+this.qop),e.push('cnonce="'+this.cnonce+'"'),e.push("nc="+this.ncHex)),"Digest "+e.join(", ")},e.prototype.updateNcHex=function(){var e=Number(this.nc).toString(16);this.ncHex="00000000".substr(0,8-e.length)+e},e.prototype.calculateResponse=function(e){var t,n;t=this.ha1,""!==t&&void 0!==t||(t=P(this.username+":"+this.realm+":"+this.password)),"auth"===this.qop?(n=P(this.method+":"+this.uri),this.response=P(t+":"+this.nonce+":"+this.ncHex+":"+this.cnonce+":auth:"+n)):"auth-int"===this.qop?(n=P(this.method+":"+this.uri+":"+P(e||"")),this.response=P(t+":"+this.nonce+":"+this.ncHex+":"+this.cnonce+":auth-int:"+n)):void 0===this.qop&&(n=P(this.method+":"+this.uri),this.response=P(t+":"+this.nonce+":"+n))},e}();function j(e,t){var n="\r\n";if(t.statusCode<100||t.statusCode>699)throw new TypeError("Invalid statusCode: "+t.statusCode);var r=t.reasonPhrase?t.reasonPhrase:w(t.statusCode),o="SIP/2.0 "+t.statusCode+" "+r+n;t.statusCode>=100&&t.statusCode,t.statusCode;var i="From: "+e.getHeader("From")+n,s="Call-ID: "+e.callId+n,a="CSeq: "+e.cseq+" "+e.method+n,c=e.getHeaders("via").reduce((function(e,t){return e+"Via: "+t+n}),""),l="To: "+e.getHeader("to");if(t.statusCode>100&&!e.parseHeader("to").hasParam("tag")){var u=t.toTag;u||(u=S()),l+=";tag="+u}l+=n;var d="";t.supported&&(d="Supported: "+t.supported.join(", ")+n);var p="";t.userAgent&&(p="User-Agent: "+t.userAgent+n);var h="";return t.extraHeaders&&(h=t.extraHeaders.reduce((function(e,t){return e+t.trim()+n}),"")),o+=c,o+=i,o+=l,o+=a,o+=s,o+=d,o+=p,o+=h,t.body?(o+="Content-Type: "+t.body.contentType+n,o+="Content-Length: "+C(t.body.content)+n+n,o+=t.body.content):o+="Content-Length: 0"+n+n,{message:o}}(function(e){function t(e,t){var n=t,r=0,o=0;if(e.substring(n,n+2).match(/(^\r\n)/))return-2;while(0===r){if(o=e.indexOf("\r\n",n),-1===o)return o;!e.substring(o+2,o+4).match(/(^\r\n)/)&&e.charAt(o+2).match(/(^\s+)/)?n=o+2:r=o}return r}function n(e,t,n,r){var o,i=t.indexOf(":",n),s=t.substring(n,i).trim(),a=t.substring(i+1,r).trim();switch(s.toLowerCase()){case"via":case"v":e.addHeader("via",a),1===e.getHeaders("via").length?(o=e.parseHeader("Via"),o&&(e.via=o,e.viaBranch=o.branch)):o=0;break;case"from":case"f":e.setHeader("from",a),o=e.parseHeader("from"),o&&(e.from=o,e.fromTag=o.getParam("tag"));break;case"to":case"t":e.setHeader("to",a),o=e.parseHeader("to"),o&&(e.to=o,e.toTag=o.getParam("tag"));break;case"record-route":if(o=g.parse(a,"Record_Route"),-1===o){o=void 0;break}if(!(o instanceof Array)){o=void 0;break}o.forEach((function(t){e.addHeader("record-route",a.substring(t.position,t.offset)),e.headers["Record-Route"][e.getHeaders("record-route").length-1].parsed=t.parsed}));break;case"call-id":case"i":e.setHeader("call-id",a),o=e.parseHeader("call-id"),o&&(e.callId=a);break;case"contact":case"m":if(o=g.parse(a,"Contact"),-1===o){o=void 0;break}if(!(o instanceof Array)){o=void 0;break}o.forEach((function(t){e.addHeader("contact",a.substring(t.position,t.offset)),e.headers.Contact[e.getHeaders("contact").length-1].parsed=t.parsed}));break;case"content-length":case"l":e.setHeader("content-length",a),o=e.parseHeader("content-length");break;case"content-type":case"c":e.setHeader("content-type",a),o=e.parseHeader("content-type");break;case"cseq":e.setHeader("cseq",a),o=e.parseHeader("cseq"),o&&(e.cseq=o.value),e instanceof x&&(e.method=o.method);break;case"max-forwards":e.setHeader("max-forwards",a),o=e.parseHeader("max-forwards");break;case"www-authenticate":e.setHeader("www-authenticate",a),o=e.parseHeader("www-authenticate");break;case"proxy-authenticate":e.setHeader("proxy-authenticate",a),o=e.parseHeader("proxy-authenticate");break;case"refer-to":case"r":e.setHeader("refer-to",a),o=e.parseHeader("refer-to"),o&&(e.referTo=o);break;default:e.addHeader(s.toLowerCase(),a),o=0}return void 0!==o||{error:"error parsing header '"+s+"'"}}function r(e,r){var o=0,i=e.indexOf("\r\n");if(-1!==i){var s,a=e.substring(0,i),c=g.parse(a,"Request_Response");if(-1!==c){var l;c.status_code?(s=new x,s.statusCode=c.status_code,s.reasonPhrase=c.reason_phrase):(s=new k,s.method=c.method,s.ruri=c.uri),s.data=e,o=i+2;while(1){if(i=t(e,o),-2===i){l=o+2;break}if(-1===i)return void r.error("malformed message");var u=n(s,e,o,i);if(u&&!0!==u)return void r.error(u.error);o=i+2}return s.hasHeader("content-length")?s.body=e.substr(l,Number(s.getHeader("content-length"))):s.body=e.substring(l),s}r.warn('error parsing first line of SIP message: "'+a+'"')}else r.warn("no CRLF found, not a SIP message, discarded")}e.getHeader=t,e.parseHeader=n,e.parseMessage=r})(D||(D={}));var H,M,L=function(){function e(e,t){this.core=e,this.dialogState=t,this.core.dialogs.set(this.id,this)}return e.initialDialogStateForUserAgentClient=function(e,t){var n=!1,r=t.getHeaders("record-route").reverse(),o=t.parseHeader("contact");if(!o)throw new Error("Contact undefined.");if(!(o instanceof u))throw new Error("Contact not instance of NameAddrHeader.");var i=o.uri,s=e.cseq,a=void 0,c=e.callId,l=e.fromTag,d=t.toTag;if(!c)throw new Error("Call id undefined.");if(!l)throw new Error("From tag undefined.");if(!d)throw new Error("To tag undefined.");if(!e.from)throw new Error("From undefined.");if(!e.to)throw new Error("To undefined.");var p=e.from.uri,h=e.to.uri;if(!t.statusCode)throw new Error("Incoming response status code undefined.");var f=t.statusCode<200,g={id:c+l+d,early:f,callId:c,localTag:l,remoteTag:d,localSequenceNumber:s,remoteSequenceNumber:a,localURI:p,remoteURI:h,remoteTarget:i,routeSet:r,secure:n};return g},e.initialDialogStateForUserAgentServer=function(e,t,n){void 0===n&&(n=!1);var r=!1,o=e.getHeaders("record-route"),i=e.parseHeader("contact");if(!i)throw new Error("Contact undefined.");if(!(i instanceof u))throw new Error("Contact not instance of NameAddrHeader.");var s=i.uri,a=e.cseq,c=void 0,l=e.callId,d=t,p=e.fromTag,h=e.from.uri,f=e.to.uri,g={id:l+d+p,early:n,callId:l,localTag:d,remoteTag:p,localSequenceNumber:c,remoteSequenceNumber:a,localURI:f,remoteURI:h,remoteTarget:s,routeSet:o,secure:r};return g},e.prototype.dispose=function(){this.core.dialogs.delete(this.id)},Object.defineProperty(e.prototype,"id",{get:function(){return this.dialogState.id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"early",{get:function(){return this.dialogState.early},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"callId",{get:function(){return this.dialogState.callId},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"localTag",{get:function(){return this.dialogState.localTag},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"remoteTag",{get:function(){return this.dialogState.remoteTag},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"localSequenceNumber",{get:function(){return this.dialogState.localSequenceNumber},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"remoteSequenceNumber",{get:function(){return this.dialogState.remoteSequenceNumber},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"localURI",{get:function(){return this.dialogState.localURI},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"remoteURI",{get:function(){return this.dialogState.remoteURI},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"remoteTarget",{get:function(){return this.dialogState.remoteTarget},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"routeSet",{get:function(){return this.dialogState.routeSet},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"secure",{get:function(){return this.dialogState.secure},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"userAgentCore",{get:function(){return this.core},enumerable:!1,configurable:!0}),e.prototype.confirm=function(){this.dialogState.early=!1},e.prototype.receiveRequest=function(e){if(e.method!==m.ACK){if(this.remoteSequenceNumber){if(e.cseq<=this.remoteSequenceNumber)throw new Error("Out of sequence in dialog request. Did you forget to call sequenceGuard()?");this.dialogState.remoteSequenceNumber=e.cseq}this.remoteSequenceNumber||(this.dialogState.remoteSequenceNumber=e.cseq)}},e.prototype.recomputeRouteSet=function(e){this.dialogState.routeSet=e.getHeaders("record-route").reverse()},e.prototype.createOutgoingRequestMessage=function(e,t){var n,r=this.remoteURI,o=this.remoteTag,i=this.localURI,s=this.localTag,a=this.callId;n=t&&t.cseq?t.cseq:this.dialogState.localSequenceNumber?this.dialogState.localSequenceNumber+=1:this.dialogState.localSequenceNumber=1;var c=this.remoteTarget,l=this.routeSet,u=t&&t.extraHeaders,d=t&&t.body,p=this.userAgentCore.makeOutgoingRequestMessage(e,c,i,r,{callId:a,cseq:n,fromTag:s,toTag:o,routeSet:l},u,d);return p},e.prototype.incrementLocalSequenceNumber=function(){if(!this.dialogState.localSequenceNumber)throw new Error("Local sequence number undefined.");this.dialogState.localSequenceNumber+=1},e.prototype.sequenceGuard=function(e){return e.method===m.ACK||(!(this.remoteSequenceNumber&&e.cseq<=this.remoteSequenceNumber)||(this.core.replyStateless(e,{statusCode:500}),!1))},e}();(function(e){e["Initial"]="Initial",e["Early"]="Early",e["AckWait"]="AckWait",e["Confirmed"]="Confirmed",e["Terminated"]="Terminated"})(H||(H={})),function(e){e["Initial"]="Initial",e["HaveLocalOffer"]="HaveLocalOffer",e["HaveRemoteOffer"]="HaveRemoteOffer",e["Stable"]="Stable",e["Closed"]="Closed"}(M||(M={}));var q,$=500,V=4e3,F=5e3,U={T1:$,T2:V,T4:F,TIMER_B:64*$,TIMER_D:0*$,TIMER_F:6*$,TIMER_H:64*$,TIMER_I:0*F,TIMER_J:0*$,TIMER_K:0*F,TIMER_L:64*$,TIMER_M:64*$,TIMER_N:64*$,PROVISIONAL_RESPONSE_INTERVAL:6e4},z=function(e){function t(t){var n=this.constructor,r=e.call(this,t)||this;return Object.setPrototypeOf(r,n.prototype),r}return o(t,e),t}(Error),K=function(e){function t(t){return e.call(this,t||"Transaction state error.")||this}return o(t,e),t}(z),W=function(e){function t(t){return e.call(this,t||"Unspecified transport error.")||this}return o(t,e),t}(z),G=function(){function e(e,t,n,r,o){this._transport=e,this._user=t,this._id=n,this._state=r,this.listeners=new Array,this.logger=t.loggerFactory.getLogger(o,n),this.logger.debug("Constructing ".concat(this.typeToString()," with id ").concat(this.id,"."))}return e.prototype.dispose=function(){this.logger.debug("Destroyed ".concat(this.typeToString()," with id ").concat(this.id,"."))},Object.defineProperty(e.prototype,"id",{get:function(){return this._id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"kind",{get:function(){throw new Error("Invalid kind.")},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transport",{get:function(){return this._transport},enumerable:!1,configurable:!0}),e.prototype.addStateChangeListener=function(e,t){var n=this,r=function(){n.removeStateChangeListener(r),e()};!0===(null===t||void 0===t?void 0:t.once)?this.listeners.push(r):this.listeners.push(e)},e.prototype.notifyStateChangeListeners=function(){this.listeners.slice().forEach((function(e){return e()}))},e.prototype.removeStateChangeListener=function(e){this.listeners=this.listeners.filter((function(t){return t!==e}))},e.prototype.logTransportError=function(e,t){this.logger.error(e.message),this.logger.error("Transport error occurred in ".concat(this.typeToString()," with id ").concat(this.id,".")),this.logger.error(t)},e.prototype.send=function(e){var t=this;return this.transport.send(e).catch((function(e){if(e instanceof W)throw t.onTransportError(e),e;var n;throw n=e&&"string"===typeof e.message?new W(e.message):new W,t.onTransportError(n),n}))},e.prototype.setState=function(e){this.logger.debug('State change to "'.concat(e,'" on ').concat(this.typeToString()," with id ").concat(this.id,".")),this._state=e,this._user.onStateChange&&this._user.onStateChange(e),this.notifyStateChangeListeners()},e.prototype.typeToString=function(){return"UnknownType"},e}(),Y=function(e){function t(n,r,o,i,s){var a=e.call(this,r,o,t.makeId(n),i,s)||this;return a._request=n,a.user=o,n.setViaHeader(a.id,r.protocol),a}return o(t,e),t.makeId=function(e){if("CANCEL"===e.method){if(!e.branch)throw new Error("Outgoing CANCEL request without a branch.");return e.branch}return"z9hG4bK"+Math.floor(1e7*Math.random())},Object.defineProperty(t.prototype,"request",{get:function(){return this._request},enumerable:!1,configurable:!0}),t.prototype.onRequestTimeout=function(){this.user.onRequestTimeout&&this.user.onRequestTimeout()},t}(G);(function(e){e["Accepted"]="Accepted",e["Calling"]="Calling",e["Completed"]="Completed",e["Confirmed"]="Confirmed",e["Proceeding"]="Proceeding",e["Terminated"]="Terminated",e["Trying"]="Trying"})(q||(q={}));var J=function(e){function t(t,n,r){var o=e.call(this,t,n,r,q.Calling,"sip.transaction.ict")||this;return o.ackRetransmissionCache=new Map,o.B=setTimeout((function(){return o.timerB()}),U.TIMER_B),o.send(t.toString()).catch((function(e){o.logTransportError(e,"Failed to send initial outgoing request.")})),o}return o(t,e),t.prototype.dispose=function(){this.B&&(clearTimeout(this.B),this.B=void 0),this.D&&(clearTimeout(this.D),this.D=void 0),this.M&&(clearTimeout(this.M),this.M=void 0),e.prototype.dispose.call(this)},Object.defineProperty(t.prototype,"kind",{get:function(){return"ict"},enumerable:!1,configurable:!0}),t.prototype.ackResponse=function(e){var t=this,n=e.toTag;if(!n)throw new Error("To tag undefined.");var r="z9hG4bK"+Math.floor(1e7*Math.random());e.setViaHeader(r,this.transport.protocol),this.ackRetransmissionCache.set(n,e),this.send(e.toString()).catch((function(e){t.logTransportError(e,"Failed to send ACK to 2xx response.")}))},t.prototype.receiveResponse=function(e){var t=this,n=e.statusCode;if(!n||n<100||n>699)throw new Error("Invalid status code ".concat(n));switch(this.state){case q.Calling:if(n>=100&&n<=199)return this.stateTransition(q.Proceeding),void(this.user.receiveResponse&&this.user.receiveResponse(e));if(n>=200&&n<=299)return this.ackRetransmissionCache.set(e.toTag,void 0),this.stateTransition(q.Accepted),void(this.user.receiveResponse&&this.user.receiveResponse(e));if(n>=300&&n<=699)return this.stateTransition(q.Completed),this.ack(e),void(this.user.receiveResponse&&this.user.receiveResponse(e));break;case q.Proceeding:if(n>=100&&n<=199)return void(this.user.receiveResponse&&this.user.receiveResponse(e));if(n>=200&&n<=299)return this.ackRetransmissionCache.set(e.toTag,void 0),this.stateTransition(q.Accepted),void(this.user.receiveResponse&&this.user.receiveResponse(e));if(n>=300&&n<=699)return this.stateTransition(q.Completed),this.ack(e),void(this.user.receiveResponse&&this.user.receiveResponse(e));break;case q.Accepted:if(n>=200&&n<=299){if(!this.ackRetransmissionCache.has(e.toTag))return this.ackRetransmissionCache.set(e.toTag,void 0),void(this.user.receiveResponse&&this.user.receiveResponse(e));var r=this.ackRetransmissionCache.get(e.toTag);return r?void this.send(r.toString()).catch((function(e){t.logTransportError(e,"Failed to send retransmission of ACK to 2xx response.")})):void 0}break;case q.Completed:if(n>=300&&n<=699)return void this.ack(e);break;case q.Terminated:break;default:throw new Error("Invalid state ".concat(this.state))}var o="Received unexpected ".concat(n," response while in state ").concat(this.state,".");this.logger.warn(o)},t.prototype.onTransportError=function(e){this.user.onTransportError&&this.user.onTransportError(e),this.stateTransition(q.Terminated,!0)},t.prototype.typeToString=function(){return"INVITE client transaction"},t.prototype.ack=function(e){var t=this,n=this.request.ruri,r=this.request.callId,o=this.request.cseq,i=this.request.getHeader("from"),s=e.getHeader("to"),a=this.request.getHeader("via"),c=this.request.getHeader("route");if(!i)throw new Error("From undefined.");if(!s)throw new Error("To undefined.");if(!a)throw new Error("Via undefined.");var l="ACK ".concat(n," SIP/2.0\r\n");c&&(l+="Route: ".concat(c,"\r\n")),l+="Via: ".concat(a,"\r\n"),l+="To: ".concat(s,"\r\n"),l+="From: ".concat(i,"\r\n"),l+="Call-ID: ".concat(r,"\r\n"),l+="CSeq: ".concat(o," ACK\r\n"),l+="Max-Forwards: 70\r\n",l+="Content-Length: 0\r\n\r\n",this.send(l).catch((function(e){t.logTransportError(e,"Failed to send ACK to non-2xx response.")}))},t.prototype.stateTransition=function(e,t){var n=this;void 0===t&&(t=!1);var r=function(){throw new Error("Invalid state transition from ".concat(n.state," to ").concat(e))};switch(e){case q.Calling:r();break;case q.Proceeding:this.state!==q.Calling&&r();break;case q.Accepted:case q.Completed:this.state!==q.Calling&&this.state!==q.Proceeding&&r();break;case q.Terminated:this.state!==q.Calling&&this.state!==q.Accepted&&this.state!==q.Completed&&(t||r());break;default:r()}this.B&&(clearTimeout(this.B),this.B=void 0),q.Proceeding,e===q.Completed&&(this.D=setTimeout((function(){return n.timerD()}),U.TIMER_D)),e===q.Accepted&&(this.M=setTimeout((function(){return n.timerM()}),U.TIMER_M)),e===q.Terminated&&this.dispose(),this.setState(e)},t.prototype.timerA=function(){},t.prototype.timerB=function(){this.logger.debug("Timer B expired for INVITE client transaction ".concat(this.id,".")),this.state===q.Calling&&(this.onRequestTimeout(),this.stateTransition(q.Terminated))},t.prototype.timerD=function(){this.logger.debug("Timer D expired for INVITE client transaction ".concat(this.id,".")),this.state===q.Completed&&this.stateTransition(q.Terminated)},t.prototype.timerM=function(){this.logger.debug("Timer M expired for INVITE client transaction ".concat(this.id,".")),this.state===q.Accepted&&this.stateTransition(q.Terminated)},t}(Y),Z=function(e){function t(t,n,r,o,i){var s=e.call(this,n,r,t.viaBranch,o,i)||this;return s._request=t,s.user=r,s}return o(t,e),Object.defineProperty(t.prototype,"request",{get:function(){return this._request},enumerable:!1,configurable:!0}),t}(G),X=function(e){function t(t,n,r){return e.call(this,t,n,r,q.Proceeding,"sip.transaction.ist")||this}return o(t,e),t.prototype.dispose=function(){this.stopProgressExtensionTimer(),this.H&&(clearTimeout(this.H),this.H=void 0),this.I&&(clearTimeout(this.I),this.I=void 0),this.L&&(clearTimeout(this.L),this.L=void 0),e.prototype.dispose.call(this)},Object.defineProperty(t.prototype,"kind",{get:function(){return"ist"},enumerable:!1,configurable:!0}),t.prototype.receiveRequest=function(e){var t=this;switch(this.state){case q.Proceeding:if(e.method===m.INVITE)return void(this.lastProvisionalResponse&&this.send(this.lastProvisionalResponse).catch((function(e){t.logTransportError(e,"Failed to send retransmission of provisional response.")})));break;case q.Accepted:if(e.method===m.INVITE)return;break;case q.Completed:if(e.method===m.INVITE){if(!this.lastFinalResponse)throw new Error("Last final response undefined.");return void this.send(this.lastFinalResponse).catch((function(e){t.logTransportError(e,"Failed to send retransmission of final response.")}))}if(e.method===m.ACK)return void this.stateTransition(q.Confirmed);break;case q.Confirmed:if(e.method===m.INVITE||e.method===m.ACK)return;break;case q.Terminated:if(e.method===m.INVITE||e.method===m.ACK)return;break;default:throw new Error("Invalid state ".concat(this.state))}var n="INVITE server transaction received unexpected ".concat(e.method," request while in state ").concat(this.state,".");this.logger.warn(n)},t.prototype.receiveResponse=function(e,t){var n=this;if(e<100||e>699)throw new Error("Invalid status code ".concat(e));switch(this.state){case q.Proceeding:if(e>=100&&e<=199)return this.lastProvisionalResponse=t,e>100&&this.startProgressExtensionTimer(),void this.send(t).catch((function(e){n.logTransportError(e,"Failed to send 1xx response.")}));if(e>=200&&e<=299)return this.lastFinalResponse=t,this.stateTransition(q.Accepted),void this.send(t).catch((function(e){n.logTransportError(e,"Failed to send 2xx response.")}));if(e>=300&&e<=699)return this.lastFinalResponse=t,this.stateTransition(q.Completed),void this.send(t).catch((function(e){n.logTransportError(e,"Failed to send non-2xx final response.")}));break;case q.Accepted:if(e>=200&&e<=299)return void this.send(t).catch((function(e){n.logTransportError(e,"Failed to send 2xx response.")}));break;case q.Completed:break;case q.Confirmed:break;case q.Terminated:break;default:throw new Error("Invalid state ".concat(this.state))}var r="INVITE server transaction received unexpected ".concat(e," response from TU while in state ").concat(this.state,".");throw this.logger.error(r),new Error(r)},t.prototype.retransmitAcceptedResponse=function(){var e=this;this.state===q.Accepted&&this.lastFinalResponse&&this.send(this.lastFinalResponse).catch((function(t){e.logTransportError(t,"Failed to send 2xx response.")}))},t.prototype.onTransportError=function(e){this.user.onTransportError&&this.user.onTransportError(e)},t.prototype.typeToString=function(){return"INVITE server transaction"},t.prototype.stateTransition=function(e){var t=this,n=function(){throw new Error("Invalid state transition from ".concat(t.state," to ").concat(e))};switch(e){case q.Proceeding:n();break;case q.Accepted:case q.Completed:this.state!==q.Proceeding&&n();break;case q.Confirmed:this.state!==q.Completed&&n();break;case q.Terminated:this.state!==q.Accepted&&this.state!==q.Completed&&this.state!==q.Confirmed&&n();break;default:n()}this.stopProgressExtensionTimer(),e===q.Accepted&&(this.L=setTimeout((function(){return t.timerL()}),U.TIMER_L)),e===q.Completed&&(this.H=setTimeout((function(){return t.timerH()}),U.TIMER_H)),e===q.Confirmed&&(this.I=setTimeout((function(){return t.timerI()}),U.TIMER_I)),e===q.Terminated&&this.dispose(),this.setState(e)},t.prototype.startProgressExtensionTimer=function(){var e=this;void 0===this.progressExtensionTimer&&(this.progressExtensionTimer=setInterval((function(){if(e.logger.debug("Progress extension timer expired for INVITE server transaction ".concat(e.id,".")),!e.lastProvisionalResponse)throw new Error("Last provisional response undefined.");e.send(e.lastProvisionalResponse).catch((function(t){e.logTransportError(t,"Failed to send retransmission of provisional response.")}))}),U.PROVISIONAL_RESPONSE_INTERVAL))},t.prototype.stopProgressExtensionTimer=function(){void 0!==this.progressExtensionTimer&&(clearInterval(this.progressExtensionTimer),this.progressExtensionTimer=void 0)},t.prototype.timerG=function(){},t.prototype.timerH=function(){this.logger.debug("Timer H expired for INVITE server transaction ".concat(this.id,".")),this.state===q.Completed&&(this.logger.warn("ACK to negative final response was never received, terminating transaction."),this.stateTransition(q.Terminated))},t.prototype.timerI=function(){this.logger.debug("Timer I expired for INVITE server transaction ".concat(this.id,".")),this.stateTransition(q.Terminated)},t.prototype.timerL=function(){this.logger.debug("Timer L expired for INVITE server transaction ".concat(this.id,".")),this.state===q.Accepted&&this.stateTransition(q.Terminated)},t}(Z),Q=function(e){function t(t,n,r){var o=e.call(this,t,n,r,q.Trying,"sip.transaction.nict")||this;return o.F=setTimeout((function(){return o.timerF()}),U.TIMER_F),o.send(t.toString()).catch((function(e){o.logTransportError(e,"Failed to send initial outgoing request.")})),o}return o(t,e),t.prototype.dispose=function(){this.F&&(clearTimeout(this.F),this.F=void 0),this.K&&(clearTimeout(this.K),this.K=void 0),e.prototype.dispose.call(this)},Object.defineProperty(t.prototype,"kind",{get:function(){return"nict"},enumerable:!1,configurable:!0}),t.prototype.receiveResponse=function(e){var t=e.statusCode;if(!t||t<100||t>699)throw new Error("Invalid status code ".concat(t));switch(this.state){case q.Trying:if(t>=100&&t<=199)return this.stateTransition(q.Proceeding),void(this.user.receiveResponse&&this.user.receiveResponse(e));if(t>=200&&t<=699)return this.stateTransition(q.Completed),408===t?void this.onRequestTimeout():void(this.user.receiveResponse&&this.user.receiveResponse(e));break;case q.Proceeding:if(t>=100&&t<=199&&this.user.receiveResponse)return this.user.receiveResponse(e);if(t>=200&&t<=699)return this.stateTransition(q.Completed),408===t?void this.onRequestTimeout():void(this.user.receiveResponse&&this.user.receiveResponse(e));break;case q.Completed:return;case q.Terminated:return;default:throw new Error("Invalid state ".concat(this.state))}var n="Non-INVITE client transaction received unexpected ".concat(t," response while in state ").concat(this.state,".");this.logger.warn(n)},t.prototype.onTransportError=function(e){this.user.onTransportError&&this.user.onTransportError(e),this.stateTransition(q.Terminated,!0)},t.prototype.typeToString=function(){return"non-INVITE client transaction"},t.prototype.stateTransition=function(e,t){var n=this;void 0===t&&(t=!1);var r=function(){throw new Error("Invalid state transition from ".concat(n.state," to ").concat(e))};switch(e){case q.Trying:r();break;case q.Proceeding:this.state!==q.Trying&&r();break;case q.Completed:this.state!==q.Trying&&this.state!==q.Proceeding&&r();break;case q.Terminated:this.state!==q.Trying&&this.state!==q.Proceeding&&this.state!==q.Completed&&(t||r());break;default:r()}e===q.Completed&&(this.F&&(clearTimeout(this.F),this.F=void 0),this.K=setTimeout((function(){return n.timerK()}),U.TIMER_K)),e===q.Terminated&&this.dispose(),this.setState(e)},t.prototype.timerF=function(){this.logger.debug("Timer F expired for non-INVITE client transaction ".concat(this.id,".")),this.state!==q.Trying&&this.state!==q.Proceeding||(this.onRequestTimeout(),this.stateTransition(q.Terminated))},t.prototype.timerK=function(){this.state===q.Completed&&this.stateTransition(q.Terminated)},t}(Y),ee=function(e){function t(t,n,r){return e.call(this,t,n,r,q.Trying,"sip.transaction.nist")||this}return o(t,e),t.prototype.dispose=function(){this.J&&(clearTimeout(this.J),this.J=void 0),e.prototype.dispose.call(this)},Object.defineProperty(t.prototype,"kind",{get:function(){return"nist"},enumerable:!1,configurable:!0}),t.prototype.receiveRequest=function(e){var t=this;switch(this.state){case q.Trying:break;case q.Proceeding:if(!this.lastResponse)throw new Error("Last response undefined.");this.send(this.lastResponse).catch((function(e){t.logTransportError(e,"Failed to send retransmission of provisional response.")}));break;case q.Completed:if(!this.lastResponse)throw new Error("Last response undefined.");this.send(this.lastResponse).catch((function(e){t.logTransportError(e,"Failed to send retransmission of final response.")}));break;case q.Terminated:break;default:throw new Error("Invalid state ".concat(this.state))}},t.prototype.receiveResponse=function(e,t){var n=this;if(e<100||e>699)throw new Error("Invalid status code ".concat(e));if(e>100&&e<=199)throw new Error("Provisional response other than 100 not allowed.");switch(this.state){case q.Trying:if(this.lastResponse=t,e>=100&&e<200)return this.stateTransition(q.Proceeding),void this.send(t).catch((function(e){n.logTransportError(e,"Failed to send provisional response.")}));if(e>=200&&e<=699)return this.stateTransition(q.Completed),void this.send(t).catch((function(e){n.logTransportError(e,"Failed to send final response.")}));break;case q.Proceeding:if(this.lastResponse=t,e>=200&&e<=699)return this.stateTransition(q.Completed),void this.send(t).catch((function(e){n.logTransportError(e,"Failed to send final response.")}));break;case q.Completed:return;case q.Terminated:break;default:throw new Error("Invalid state ".concat(this.state))}var r="Non-INVITE server transaction received unexpected ".concat(e," response from TU while in state ").concat(this.state,".");throw this.logger.error(r),new Error(r)},t.prototype.onTransportError=function(e){this.user.onTransportError&&this.user.onTransportError(e),this.stateTransition(q.Terminated,!0)},t.prototype.typeToString=function(){return"non-INVITE server transaction"},t.prototype.stateTransition=function(e,t){var n=this;void 0===t&&(t=!1);var r=function(){throw new Error("Invalid state transition from ".concat(n.state," to ").concat(e))};switch(e){case q.Trying:r();break;case q.Proceeding:this.state!==q.Trying&&r();break;case q.Completed:this.state!==q.Trying&&this.state!==q.Proceeding&&r();break;case q.Terminated:this.state!==q.Proceeding&&this.state!==q.Completed&&(t||r());break;default:r()}e===q.Completed&&(this.J=setTimeout((function(){return n.timerJ()}),U.TIMER_J)),e===q.Terminated&&this.dispose(),this.setState(e)},t.prototype.timerJ=function(){this.logger.debug("Timer J expired for NON-INVITE server transaction ".concat(this.id,".")),this.state===q.Completed&&this.stateTransition(q.Terminated)},t}(Z),te=function(){function e(e,t,n,r){this.transactionConstructor=e,this.core=t,this.message=n,this.delegate=r,this.challenged=!1,this.stale=!1,this.logger=this.loggerFactory.getLogger("sip.user-agent-client"),this.init()}return e.prototype.dispose=function(){this.transaction.dispose()},Object.defineProperty(e.prototype,"loggerFactory",{get:function(){return this.core.loggerFactory},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transaction",{get:function(){if(!this._transaction)throw new Error("Transaction undefined.");return this._transaction},enumerable:!1,configurable:!0}),e.prototype.cancel=function(t,n){var r=this;if(void 0===n&&(n={}),!this.transaction)throw new Error("Transaction undefined.");if(!this.message.to)throw new Error("To undefined.");if(!this.message.from)throw new Error("From undefined.");var o=this.core.makeOutgoingRequestMessage(m.CANCEL,this.message.ruri,this.message.from.uri,this.message.to.uri,{toTag:this.message.toTag,fromTag:this.message.fromTag,callId:this.message.callId,cseq:this.message.cseq},n.extraHeaders);return o.branch=this.message.branch,this.message.headers.Route&&(o.headers.Route=this.message.headers.Route),t&&o.setHeader("Reason",t),this.transaction.state===q.Proceeding?new e(Q,this.core,o):this.transaction.addStateChangeListener((function(){r.transaction&&r.transaction.state===q.Proceeding&&new e(Q,r.core,o)}),{once:!0}),o},e.prototype.authenticationGuard=function(e,t){var n,r,o=e.statusCode;if(!o)throw new Error("Response status code undefined.");if(401!==o&&407!==o)return!0;if(401===o?(n=e.parseHeader("www-authenticate"),r="authorization"):(n=e.parseHeader("proxy-authenticate"),r="proxy-authorization"),!n)return this.logger.warn(o+" with wrong or missing challenge, cannot authenticate"),!0;if(this.challenged&&(this.stale||!0!==n.stale))return this.logger.warn(o+" apparently in authentication loop, cannot authenticate"),!0;if(!this.credentials&&(this.credentials=this.core.configuration.authenticationFactory(),!this.credentials))return this.logger.warn("Unable to obtain credentials, cannot authenticate"),!0;if(!this.credentials.authenticate(this.message,n))return!0;this.challenged=!0,n.stale&&(this.stale=!0);var i=this.message.cseq+=1;return t&&t.localSequenceNumber&&(t.incrementLocalSequenceNumber(),i=this.message.cseq=t.localSequenceNumber),this.message.setHeader("cseq",i+" "+this.message.method),this.message.setHeader(r,this.credentials.toString()),this.init(),!1},e.prototype.onRequestTimeout=function(){this.logger.warn("User agent client request timed out. Generating internal 408 Request Timeout.");var e=new x;e.statusCode=408,e.reasonPhrase="Request Timeout",this.receiveResponse(e)},e.prototype.onTransportError=function(e){this.logger.error(e.message),this.logger.error("User agent client request transport error. Generating internal 503 Service Unavailable.");var t=new x;t.statusCode=503,t.reasonPhrase="Service Unavailable",this.receiveResponse(t)},e.prototype.receiveResponse=function(e){if(this.authenticationGuard(e)){var t=e.statusCode?e.statusCode.toString():"";if(!t)throw new Error("Response status code undefined.");switch(!0){case/^100$/.test(t):this.delegate&&this.delegate.onTrying&&this.delegate.onTrying({message:e});break;case/^1[0-9]{2}$/.test(t):this.delegate&&this.delegate.onProgress&&this.delegate.onProgress({message:e});break;case/^2[0-9]{2}$/.test(t):this.delegate&&this.delegate.onAccept&&this.delegate.onAccept({message:e});break;case/^3[0-9]{2}$/.test(t):this.delegate&&this.delegate.onRedirect&&this.delegate.onRedirect({message:e});break;case/^[4-6][0-9]{2}$/.test(t):this.delegate&&this.delegate.onReject&&this.delegate.onReject({message:e});break;default:throw new Error("Invalid status code ".concat(t))}}},e.prototype.init=function(){var e=this,t={loggerFactory:this.loggerFactory,onRequestTimeout:function(){return e.onRequestTimeout()},onStateChange:function(t){t===q.Terminated&&(e.core.userAgentClients.delete(r),n===e._transaction&&e.dispose())},onTransportError:function(t){return e.onTransportError(t)},receiveResponse:function(t){return e.receiveResponse(t)}},n=new this.transactionConstructor(this.message,this.core.transport,t);this._transaction=n;var r=n.id+n.request.method;this.core.userAgentClients.set(r,this)},e}(),ne=function(e){function t(t,n,r){var o=this,i=t.createOutgoingRequestMessage(m.BYE,r);return o=e.call(this,Q,t.userAgentCore,i,n)||this,t.dispose(),o}return o(t,e),t}(te),re=function(){function e(e,t,n,r){this.transactionConstructor=e,this.core=t,this.message=n,this.delegate=r,this.logger=this.loggerFactory.getLogger("sip.user-agent-server"),this.toTag=n.toTag?n.toTag:S(),this.init()}return e.prototype.dispose=function(){this.transaction.dispose()},Object.defineProperty(e.prototype,"loggerFactory",{get:function(){return this.core.loggerFactory},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transaction",{get:function(){if(!this._transaction)throw new Error("Transaction undefined.");return this._transaction},enumerable:!1,configurable:!0}),e.prototype.accept=function(e){if(void 0===e&&(e={statusCode:200}),!this.acceptable)throw new K("".concat(this.message.method," not acceptable in state ").concat(this.transaction.state,"."));var t=e.statusCode;if(t<200||t>299)throw new TypeError("Invalid statusCode: ".concat(t));var n=this.reply(e);return n},e.prototype.progress=function(e){if(void 0===e&&(e={statusCode:180}),!this.progressable)throw new K("".concat(this.message.method," not progressable in state ").concat(this.transaction.state,"."));var t=e.statusCode;if(t<101||t>199)throw new TypeError("Invalid statusCode: ".concat(t));var n=this.reply(e);return n},e.prototype.redirect=function(e,t){if(void 0===t&&(t={statusCode:302}),!this.redirectable)throw new K("".concat(this.message.method," not redirectable in state ").concat(this.transaction.state,"."));var n=t.statusCode;if(n<300||n>399)throw new TypeError("Invalid statusCode: ".concat(n));var r=new Array;e.forEach((function(e){return r.push("Contact: ".concat(e.toString()))})),t.extraHeaders=(t.extraHeaders||[]).concat(r);var o=this.reply(t);return o},e.prototype.reject=function(e){if(void 0===e&&(e={statusCode:480}),!this.rejectable)throw new K("".concat(this.message.method," not rejectable in state ").concat(this.transaction.state,"."));var t=e.statusCode;if(t<400||t>699)throw new TypeError("Invalid statusCode: ".concat(t));var n=this.reply(e);return n},e.prototype.trying=function(e){if(!this.tryingable)throw new K("".concat(this.message.method," not tryingable in state ").concat(this.transaction.state,"."));var t=this.reply({statusCode:100});return t},e.prototype.receiveCancel=function(e){this.delegate&&this.delegate.onCancel&&this.delegate.onCancel(e)},Object.defineProperty(e.prototype,"acceptable",{get:function(){if(this.transaction instanceof X)return this.transaction.state===q.Proceeding||this.transaction.state===q.Accepted;if(this.transaction instanceof ee)return this.transaction.state===q.Trying||this.transaction.state===q.Proceeding;throw new Error("Unknown transaction type.")},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"progressable",{get:function(){if(this.transaction instanceof X)return this.transaction.state===q.Proceeding;if(this.transaction instanceof ee)return!1;throw new Error("Unknown transaction type.")},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"redirectable",{get:function(){if(this.transaction instanceof X)return this.transaction.state===q.Proceeding;if(this.transaction instanceof ee)return this.transaction.state===q.Trying||this.transaction.state===q.Proceeding;throw new Error("Unknown transaction type.")},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rejectable",{get:function(){if(this.transaction instanceof X)return this.transaction.state===q.Proceeding;if(this.transaction instanceof ee)return this.transaction.state===q.Trying||this.transaction.state===q.Proceeding;throw new Error("Unknown transaction type.")},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"tryingable",{get:function(){if(this.transaction instanceof X)return this.transaction.state===q.Proceeding;if(this.transaction instanceof ee)return this.transaction.state===q.Trying;throw new Error("Unknown transaction type.")},enumerable:!1,configurable:!0}),e.prototype.reply=function(e){e.toTag||100===e.statusCode||(e.toTag=this.toTag),e.userAgent=e.userAgent||this.core.configuration.userAgentHeaderFieldValue,e.supported=e.supported||this.core.configuration.supportedOptionTagsResponse;var t=j(this.message,e);return this.transaction.receiveResponse(e.statusCode,t.message),t},e.prototype.init=function(){var e=this,t={loggerFactory:this.loggerFactory,onStateChange:function(t){t===q.Terminated&&(e.core.userAgentServers.delete(r),e.dispose())},onTransportError:function(t){e.logger.error(t.message),e.delegate&&e.delegate.onTransportError?e.delegate.onTransportError(t):e.logger.error("User agent server response transport error.")}},n=new this.transactionConstructor(this.message,this.core.transport,t);this._transaction=n;var r=n.id;this.core.userAgentServers.set(n.id,this)},e}(),oe=function(e){function t(t,n,r){return e.call(this,ee,t.userAgentCore,n,r)||this}return o(t,e),t}(re),ie=function(e){function t(t,n,r){var o=t.createOutgoingRequestMessage(m.INFO,r);return e.call(this,Q,t.userAgentCore,o,n)||this}return o(t,e),t}(te),se=function(e){function t(t,n,r){return e.call(this,ee,t.userAgentCore,n,r)||this}return o(t,e),t}(re),ae=function(e){function t(t,n,r){return e.call(this,Q,t,n,r)||this}return o(t,e),t}(te),ce=function(e){function t(t,n,r){return e.call(this,ee,t,n,r)||this}return o(t,e),t}(re),le=function(e){function t(t,n,r){var o=t.createOutgoingRequestMessage(m.NOTIFY,r);return e.call(this,Q,t.userAgentCore,o,n)||this}return o(t,e),t}(te);function ue(e){return void 0!==e.userAgentCore}var de=function(e){function t(t,n,r){var o=ue(t)?t.userAgentCore:t;return e.call(this,ee,o,n,r)||this}return o(t,e),t}(re),pe=function(e){function t(t,n,r){var o=this,i=t.createOutgoingRequestMessage(m.PRACK,r);return o=e.call(this,Q,t.userAgentCore,i,n)||this,t.signalingStateTransition(i),o}return o(t,e),t}(te),he=function(e){function t(t,n,r){var o=e.call(this,ee,t.userAgentCore,n,r)||this;return t.signalingStateTransition(n),o.dialog=t,o}return o(t,e),t.prototype.accept=function(t){return void 0===t&&(t={statusCode:200}),t.body&&this.dialog.signalingStateTransition(t.body),e.prototype.accept.call(this,t)},t}(re),fe=function(e){function t(t,n,r){var o=this,i=t.createOutgoingRequestMessage(m.INVITE,r);return o=e.call(this,J,t.userAgentCore,i,n)||this,o.delegate=n,t.signalingStateTransition(i),t.reinviteUserAgentClient=o,o.dialog=t,o}return o(t,e),t.prototype.receiveResponse=function(e){var t=this;if(this.authenticationGuard(e,this.dialog)){var n=e.statusCode?e.statusCode.toString():"";if(!n)throw new Error("Response status code undefined.");switch(!0){case/^100$/.test(n):this.delegate&&this.delegate.onTrying&&this.delegate.onTrying({message:e});break;case/^1[0-9]{2}$/.test(n):this.delegate&&this.delegate.onProgress&&this.delegate.onProgress({message:e,session:this.dialog,prack:function(e){throw new Error("Unimplemented.")}});break;case/^2[0-9]{2}$/.test(n):this.dialog.signalingStateTransition(e),this.delegate&&this.delegate.onAccept&&this.delegate.onAccept({message:e,session:this.dialog,ack:function(e){var n=t.dialog.ack(e);return n}});break;case/^3[0-9]{2}$/.test(n):this.dialog.signalingStateRollback(),this.dialog.reinviteUserAgentClient=void 0,this.delegate&&this.delegate.onRedirect&&this.delegate.onRedirect({message:e});break;case/^[4-6][0-9]{2}$/.test(n):this.dialog.signalingStateRollback(),this.dialog.reinviteUserAgentClient=void 0,this.delegate&&this.delegate.onReject&&this.delegate.onReject({message:e});break;default:throw new Error("Invalid status code ".concat(n))}}},t}(te),ge=function(e){function t(t,n,r){var o=e.call(this,X,t.userAgentCore,n,r)||this;return t.reinviteUserAgentServer=o,o.dialog=t,o}return o(t,e),t.prototype.accept=function(t){void 0===t&&(t={statusCode:200}),t.extraHeaders=t.extraHeaders||[],t.extraHeaders=t.extraHeaders.concat(this.dialog.routeSet.map((function(e){return"Record-Route: ".concat(e)})));var n=e.prototype.accept.call(this,t),r=this.dialog,o=i(i({},n),{session:r});return t.body&&this.dialog.signalingStateTransition(t.body),this.dialog.reConfirm(),o},t.prototype.progress=function(t){void 0===t&&(t={statusCode:180});var n=e.prototype.progress.call(this,t),r=this.dialog,o=i(i({},n),{session:r});return t.body&&this.dialog.signalingStateTransition(t.body),o},t.prototype.redirect=function(e,t){throw this.dialog.signalingStateRollback(),this.dialog.reinviteUserAgentServer=void 0,new Error("Unimplemented.")},t.prototype.reject=function(t){return void 0===t&&(t={statusCode:488}),this.dialog.signalingStateRollback(),this.dialog.reinviteUserAgentServer=void 0,e.prototype.reject.call(this,t)},t}(re),me=function(e){function t(t,n,r){var o=t.createOutgoingRequestMessage(m.REFER,r);return e.call(this,Q,t.userAgentCore,o,n)||this}return o(t,e),t}(te);function ve(e){return void 0!==e.userAgentCore}var ye,be=function(e){function t(t,n,r){var o=ve(t)?t.userAgentCore:t;return e.call(this,ee,o,n,r)||this}return o(t,e),t}(re),we=function(e){function t(t,n,r,o){var i=e.call(this,n,r)||this;return i.initialTransaction=t,i._signalingState=M.Initial,i.ackWait=!1,i.ackProcessing=!1,i.delegate=o,t instanceof X&&(i.ackWait=!0),i.early||i.start2xxRetransmissionTimer(),i.signalingStateTransition(t.request),i.logger=n.loggerFactory.getLogger("sip.invite-dialog"),i.logger.log("INVITE dialog ".concat(i.id," constructed")),i}return o(t,e),t.prototype.dispose=function(){e.prototype.dispose.call(this),this._signalingState=M.Closed,this._offer=void 0,this._answer=void 0,this.invite2xxTimer&&(clearTimeout(this.invite2xxTimer),this.invite2xxTimer=void 0),this.logger.log("INVITE dialog ".concat(this.id," destroyed"))},Object.defineProperty(t.prototype,"sessionState",{get:function(){return this.early?H.Early:this.ackWait?H.AckWait:this._signalingState===M.Closed?H.Terminated:H.Confirmed},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"signalingState",{get:function(){return this._signalingState},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"offer",{get:function(){return this._offer},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"answer",{get:function(){return this._answer},enumerable:!1,configurable:!0}),t.prototype.confirm=function(){this.early&&this.start2xxRetransmissionTimer(),e.prototype.confirm.call(this)},t.prototype.reConfirm=function(){this.reinviteUserAgentServer&&this.startReInvite2xxRetransmissionTimer()},t.prototype.ack=function(e){var t;if(void 0===e&&(e={}),this.logger.log("INVITE dialog ".concat(this.id," sending ACK request")),this.reinviteUserAgentClient){if(!(this.reinviteUserAgentClient.transaction instanceof J))throw new Error("Transaction not instance of InviteClientTransaction.");t=this.reinviteUserAgentClient.transaction,this.reinviteUserAgentClient=void 0}else{if(!(this.initialTransaction instanceof J))throw new Error("Initial transaction not instance of InviteClientTransaction.");t=this.initialTransaction}var n=this.createOutgoingRequestMessage(m.ACK,{cseq:t.request.cseq,extraHeaders:e.extraHeaders,body:e.body});return t.ackResponse(n),this.signalingStateTransition(n),{message:n}},t.prototype.bye=function(e,t){if(this.logger.log("INVITE dialog ".concat(this.id," sending BYE request")),this.initialTransaction instanceof X){if(this.early)throw new Error("UAS MUST NOT send a BYE on early dialogs.");if(this.ackWait&&this.initialTransaction.state!==q.Terminated)throw new Error("UAS MUST NOT send a BYE on a confirmed dialog until it has received an ACK for its 2xx response or until the server transaction times out.")}return new ne(this,e,t)},t.prototype.info=function(e,t){if(this.logger.log("INVITE dialog ".concat(this.id," sending INFO request")),this.early)throw new Error("Dialog not confirmed.");return new ie(this,e,t)},t.prototype.invite=function(e,t){if(this.logger.log("INVITE dialog ".concat(this.id," sending INVITE request")),this.early)throw new Error("Dialog not confirmed.");if(this.reinviteUserAgentClient)throw new Error("There is an ongoing re-INVITE client transaction.");if(this.reinviteUserAgentServer)throw new Error("There is an ongoing re-INVITE server transaction.");return new fe(this,e,t)},t.prototype.message=function(e,t){if(this.logger.log("INVITE dialog ".concat(this.id," sending MESSAGE request")),this.early)throw new Error("Dialog not confirmed.");var n=this.createOutgoingRequestMessage(m.MESSAGE,t);return new ae(this.core,n,e)},t.prototype.notify=function(e,t){if(this.logger.log("INVITE dialog ".concat(this.id," sending NOTIFY request")),this.early)throw new Error("Dialog not confirmed.");return new le(this,e,t)},t.prototype.prack=function(e,t){return this.logger.log("INVITE dialog ".concat(this.id," sending PRACK request")),new pe(this,e,t)},t.prototype.refer=function(e,t){if(this.logger.log("INVITE dialog ".concat(this.id," sending REFER request")),this.early)throw new Error("Dialog not confirmed.");return new me(this,e,t)},t.prototype.receiveRequest=function(t){var n=this;if(this.logger.log("INVITE dialog ".concat(this.id," received ").concat(t.method," request")),t.method!==m.ACK)if(this.sequenceGuard(t)){if(e.prototype.receiveRequest.call(this,t),t.method===m.INVITE){var r=function(){var e=n.ackWait?"waiting for initial ACK":"processing initial ACK";n.logger.warn("INVITE dialog ".concat(n.id," received re-INVITE while ").concat(e));var t="RFC 5407 suggests the following to avoid this race condition... ";t+=" Note: Implementation issues are outside the scope of this document,",t+=" but the following tip is provided for avoiding race conditions of",t+=" this type. The caller can delay sending re-INVITE F6 for some period",t+=" of time (2 seconds, perhaps), after which the caller can reasonably",t+=" assume that its ACK has been received. Implementors can decouple the",t+=" actions of the user (e.g., pressing the hold button) from the actions",t+=" of the protocol (the sending of re-INVITE F6), so that the UA can",t+=" behave like this. In this case, it is the implementor's choice as to",t+=" how long to wait. In most cases, such an implementation may be",t+=" useful to prevent the type of race condition shown in this section.",t+=" This document expresses no preference about whether or not they",t+=" should wait for an ACK to be delivered. After considering the impact",t+=" on user experience, implementors should decide whether or not to wait",t+=" for a while, because the user experience depends on the",t+=" implementation and has no direct bearing on protocol behavior.",n.logger.warn(t)},o=Math.floor(10*Math.random())+1,i=["Retry-After: ".concat(o)];if(this.ackProcessing)return this.core.replyStateless(t,{statusCode:500,extraHeaders:i}),void r();if(this.ackWait&&this.signalingState!==M.Stable)return this.core.replyStateless(t,{statusCode:500,extraHeaders:i}),void r();if(this.reinviteUserAgentServer)return void this.core.replyStateless(t,{statusCode:500,extraHeaders:i});if(this.reinviteUserAgentClient)return void this.core.replyStateless(t,{statusCode:491})}if(t.method===m.INVITE){var s=t.parseHeader("contact");if(!s)throw new Error("Contact undefined.");if(!(s instanceof u))throw new Error("Contact not instance of NameAddrHeader.");this.dialogState.remoteTarget=s.uri}switch(t.method){case m.BYE:var a=new oe(this,t);this.delegate&&this.delegate.onBye?this.delegate.onBye(a):a.accept(),this.dispose();break;case m.INFO:a=new se(this,t);this.delegate&&this.delegate.onInfo?this.delegate.onInfo(a):a.reject({statusCode:469,extraHeaders:["Recv-Info:"]});break;case m.INVITE:a=new ge(this,t);this.signalingStateTransition(t),this.delegate&&this.delegate.onInvite?this.delegate.onInvite(a):a.reject({statusCode:488});break;case m.MESSAGE:a=new ce(this.core,t);this.delegate&&this.delegate.onMessage?this.delegate.onMessage(a):a.accept();break;case m.NOTIFY:a=new de(this,t);this.delegate&&this.delegate.onNotify?this.delegate.onNotify(a):a.accept();break;case m.PRACK:a=new he(this,t);this.delegate&&this.delegate.onPrack?this.delegate.onPrack(a):a.accept();break;case m.REFER:a=new be(this,t);this.delegate&&this.delegate.onRefer?this.delegate.onRefer(a):a.reject();break;default:this.logger.log("INVITE dialog ".concat(this.id," received unimplemented ").concat(t.method," request")),this.core.replyStateless(t,{statusCode:501});break}}else this.logger.log("INVITE dialog ".concat(this.id," rejected out of order ").concat(t.method," request."));else{if(this.ackWait){if(this.initialTransaction instanceof J)return void this.logger.warn("INVITE dialog ".concat(this.id," received unexpected ").concat(t.method," request, dropping."));if(this.initialTransaction.request.cseq!==t.cseq)return void this.logger.warn("INVITE dialog ".concat(this.id," received unexpected ").concat(t.method," request, dropping."));this.ackWait=!1}else{if(!this.reinviteUserAgentServer)return void this.logger.warn("INVITE dialog ".concat(this.id," received unexpected ").concat(t.method," request, dropping."));if(this.reinviteUserAgentServer.transaction.request.cseq!==t.cseq)return void this.logger.warn("INVITE dialog ".concat(this.id," received unexpected ").concat(t.method," request, dropping."));this.reinviteUserAgentServer=void 0}if(this.signalingStateTransition(t),this.delegate&&this.delegate.onAck){var c=this.delegate.onAck({message:t});c instanceof Promise&&(this.ackProcessing=!0,c.then((function(){return n.ackProcessing=!1})).catch((function(){return n.ackProcessing=!1})))}}},t.prototype.reliableSequenceGuard=function(e){var t=e.statusCode;if(!t)throw new Error("Status code undefined");if(t>100&&t<200){var n=e.getHeader("require"),r=e.getHeader("rseq"),o=n&&n.includes("100rel")&&r?Number(r):void 0;if(o){if(this.rseq&&this.rseq+1!==o)return!1;this.rseq=this.rseq?this.rseq+1:o}}return!0},t.prototype.signalingStateRollback=function(){this._signalingState!==M.HaveLocalOffer&&this.signalingState!==M.HaveRemoteOffer||this._rollbackOffer&&this._rollbackAnswer&&(this._signalingState=M.Stable,this._offer=this._rollbackOffer,this._answer=this._rollbackAnswer)},t.prototype.signalingStateTransition=function(e){var t=A(e);if(t&&"session"===t.contentDisposition){if(this._signalingState===M.Stable&&(this._rollbackOffer=this._offer,this._rollbackAnswer=this._answer),e instanceof k)switch(this._signalingState){case M.Initial:case M.Stable:this._signalingState=M.HaveRemoteOffer,this._offer=t,this._answer=void 0;break;case M.HaveLocalOffer:this._signalingState=M.Stable,this._answer=t;break;case M.HaveRemoteOffer:break;case M.Closed:break;default:throw new Error("Unexpected signaling state.")}if(e instanceof x)switch(this._signalingState){case M.Initial:case M.Stable:this._signalingState=M.HaveRemoteOffer,this._offer=t,this._answer=void 0;break;case M.HaveLocalOffer:this._signalingState=M.Stable,this._answer=t;break;case M.HaveRemoteOffer:break;case M.Closed:break;default:throw new Error("Unexpected signaling state.")}if(e instanceof I)switch(this._signalingState){case M.Initial:case M.Stable:this._signalingState=M.HaveLocalOffer,this._offer=t,this._answer=void 0;break;case M.HaveLocalOffer:break;case M.HaveRemoteOffer:this._signalingState=M.Stable,this._answer=t;break;case M.Closed:break;default:throw new Error("Unexpected signaling state.")}if(N(e))switch(this._signalingState){case M.Initial:case M.Stable:this._signalingState=M.HaveLocalOffer,this._offer=t,this._answer=void 0;break;case M.HaveLocalOffer:break;case M.HaveRemoteOffer:this._signalingState=M.Stable,this._answer=t;break;case M.Closed:break;default:throw new Error("Unexpected signaling state.")}}},t.prototype.start2xxRetransmissionTimer=function(){var e=this;if(this.initialTransaction instanceof X){var t=this.initialTransaction,n=U.T1,r=function(){e.ackWait?(e.logger.log("No ACK for 2xx response received, attempting retransmission"),t.retransmitAcceptedResponse(),n=Math.min(2*n,U.T2),e.invite2xxTimer=setTimeout(r,n)):e.invite2xxTimer=void 0};this.invite2xxTimer=setTimeout(r,n);var o=function(){t.state===q.Terminated&&(t.removeStateChangeListener(o),e.invite2xxTimer&&(clearTimeout(e.invite2xxTimer),e.invite2xxTimer=void 0),e.ackWait&&(e.delegate&&e.delegate.onAckTimeout?e.delegate.onAckTimeout():e.bye()))};t.addStateChangeListener(o)}},t.prototype.startReInvite2xxRetransmissionTimer=function(){var e=this;if(this.reinviteUserAgentServer&&this.reinviteUserAgentServer.transaction instanceof X){var t=this.reinviteUserAgentServer.transaction,n=U.T1,r=function(){e.reinviteUserAgentServer?(e.logger.log("No ACK for 2xx response received, attempting retransmission"),t.retransmitAcceptedResponse(),n=Math.min(2*n,U.T2),e.invite2xxTimer=setTimeout(r,n)):e.invite2xxTimer=void 0};this.invite2xxTimer=setTimeout(r,n);var o=function(){t.state===q.Terminated&&(t.removeStateChangeListener(o),e.invite2xxTimer&&(clearTimeout(e.invite2xxTimer),e.invite2xxTimer=void 0),e.reinviteUserAgentServer)};t.addStateChangeListener(o)}},t}(L);(function(e){e["Initial"]="Initial",e["NotifyWait"]="NotifyWait",e["Pending"]="Pending",e["Active"]="Active",e["Terminated"]="Terminated"})(ye||(ye={}));var Se,Te=[m.ACK,m.BYE,m.CANCEL,m.INFO,m.INVITE,m.MESSAGE,m.NOTIFY,m.OPTIONS,m.PRACK,m.REFER,m.REGISTER,m.SUBSCRIBE],Ce=function(e){function t(t,n,r){var o=this,i=t.createOutgoingRequestMessage(m.SUBSCRIBE,r);return o=e.call(this,Q,t.userAgentCore,i,n)||this,o.dialog=t,o}return o(t,e),t.prototype.waitNotifyStop=function(){},t.prototype.receiveResponse=function(t){if(t.statusCode&&t.statusCode>=200&&t.statusCode<300){var n=t.getHeader("Expires");if(n){var r=Number(n);this.dialog.subscriptionExpires>r&&(this.dialog.subscriptionExpires=r)}else this.logger.warn("Expires header missing in a 200-class response to SUBSCRIBE")}if(t.statusCode&&t.statusCode>=400&&t.statusCode<700){var o=[404,405,410,416,480,481,482,483,484,485,489,501,604];o.includes(t.statusCode)&&this.dialog.terminate()}e.prototype.receiveResponse.call(this,t)},t}(te),Ee=function(e){function t(t,n,r,o,i,s){var a=e.call(this,o,i)||this;return a.delegate=s,a._autoRefresh=!1,a._subscriptionEvent=t,a._subscriptionExpires=n,a._subscriptionExpiresInitial=n,a._subscriptionExpiresLastSet=Math.floor(Date.now()/1e3),a._subscriptionRefresh=void 0,a._subscriptionRefreshLastSet=void 0,a._subscriptionState=r,a.logger=o.loggerFactory.getLogger("sip.subscribe-dialog"),a.logger.log("SUBSCRIBE dialog ".concat(a.id," constructed")),a}return o(t,e),t.initialDialogStateForSubscription=function(e,t){var n=!1,r=t.getHeaders("record-route"),o=t.parseHeader("contact");if(!o)throw new Error("Contact undefined.");if(!(o instanceof u))throw new Error("Contact not instance of NameAddrHeader.");var i=o.uri,s=e.cseq,a=void 0,c=e.callId,l=e.fromTag,d=t.fromTag;if(!c)throw new Error("Call id undefined.");if(!l)throw new Error("From tag undefined.");if(!d)throw new Error("To tag undefined.");if(!e.from)throw new Error("From undefined.");if(!e.to)throw new Error("To undefined.");var p=e.from.uri,h=e.to.uri,f=!1,g={id:c+l+d,early:f,callId:c,localTag:l,remoteTag:d,localSequenceNumber:s,remoteSequenceNumber:a,localURI:p,remoteURI:h,remoteTarget:i,routeSet:r,secure:n};return g},t.prototype.dispose=function(){e.prototype.dispose.call(this),this.N&&(clearTimeout(this.N),this.N=void 0),this.refreshTimerClear(),this.logger.log("SUBSCRIBE dialog ".concat(this.id," destroyed"))},Object.defineProperty(t.prototype,"autoRefresh",{get:function(){return this._autoRefresh},set:function(e){this._autoRefresh=!0,this.refreshTimerSet()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"subscriptionEvent",{get:function(){return this._subscriptionEvent},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"subscriptionExpires",{get:function(){var e=Math.floor(Date.now()/1e3)-this._subscriptionExpiresLastSet,t=this._subscriptionExpires-e;return Math.max(t,0)},set:function(e){if(e<0)throw new Error("Expires must be greater than or equal to zero.");if(this._subscriptionExpires=e,this._subscriptionExpiresLastSet=Math.floor(Date.now()/1e3),this.autoRefresh){var t=this.subscriptionRefresh;(void 0===t||t>=e)&&this.refreshTimerSet()}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"subscriptionExpiresInitial",{get:function(){return this._subscriptionExpiresInitial},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"subscriptionRefresh",{get:function(){if(void 0!==this._subscriptionRefresh&&void 0!==this._subscriptionRefreshLastSet){var e=Math.floor(Date.now()/1e3)-this._subscriptionRefreshLastSet,t=this._subscriptionRefresh-e;return Math.max(t,0)}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"subscriptionState",{get:function(){return this._subscriptionState},enumerable:!1,configurable:!0}),t.prototype.receiveRequest=function(t){if(this.logger.log("SUBSCRIBE dialog ".concat(this.id," received ").concat(t.method," request")),this.sequenceGuard(t))switch(e.prototype.receiveRequest.call(this,t),t.method){case m.NOTIFY:this.onNotify(t);break;default:this.logger.log("SUBSCRIBE dialog ".concat(this.id," received unimplemented ").concat(t.method," request")),this.core.replyStateless(t,{statusCode:501});break}else this.logger.log("SUBSCRIBE dialog ".concat(this.id," rejected out of order ").concat(t.method," request."))},t.prototype.refresh=function(){var e="Allow: "+Te.toString(),t={};return t.extraHeaders=(t.extraHeaders||[]).slice(),t.extraHeaders.push(e),t.extraHeaders.push("Event: "+this.subscriptionEvent),t.extraHeaders.push("Expires: "+this.subscriptionExpiresInitial),t.extraHeaders.push("Contact: "+this.core.configuration.contact.toString()),this.subscribe(void 0,t)},t.prototype.subscribe=function(e,t){var n=this;if(void 0===t&&(t={}),this.subscriptionState!==ye.Pending&&this.subscriptionState!==ye.Active)throw new Error("Invalid state ".concat(this.subscriptionState,'. May only re-subscribe while in state "pending" or "active".'));this.logger.log("SUBSCRIBE dialog ".concat(this.id," sending SUBSCRIBE request"));var r=new Ce(this,e,t);return this.N&&(clearTimeout(this.N),this.N=void 0),this.N=setTimeout((function(){return n.timerN()}),U.TIMER_N),r},t.prototype.terminate=function(){this.stateTransition(ye.Terminated),this.onTerminated()},t.prototype.unsubscribe=function(){var e="Allow: "+Te.toString(),t={};return t.extraHeaders=(t.extraHeaders||[]).slice(),t.extraHeaders.push(e),t.extraHeaders.push("Event: "+this.subscriptionEvent),t.extraHeaders.push("Expires: 0"),t.extraHeaders.push("Contact: "+this.core.configuration.contact.toString()),this.subscribe(void 0,t)},t.prototype.onNotify=function(e){var t=e.parseHeader("Event").event;if(t&&t===this.subscriptionEvent){this.N&&(clearTimeout(this.N),this.N=void 0);var n=e.parseHeader("Subscription-State");if(n&&n.state){var r=n.state,o=n.expires?Math.max(n.expires,0):void 0;switch(r){case"pending":this.stateTransition(ye.Pending,o);break;case"active":this.stateTransition(ye.Active,o);break;case"terminated":this.stateTransition(ye.Terminated,o);break;default:this.logger.warn("Unrecognized subscription state.");break}var i=new de(this,e);this.delegate&&this.delegate.onNotify?this.delegate.onNotify(i):i.accept()}else this.core.replyStateless(e,{statusCode:489})}else this.core.replyStateless(e,{statusCode:489})},t.prototype.onRefresh=function(e){this.delegate&&this.delegate.onRefresh&&this.delegate.onRefresh(e)},t.prototype.onTerminated=function(){this.delegate&&this.delegate.onTerminated&&this.delegate.onTerminated()},t.prototype.refreshTimerClear=function(){this.refreshTimer&&(clearTimeout(this.refreshTimer),this.refreshTimer=void 0)},t.prototype.refreshTimerSet=function(){var e=this;if(this.refreshTimerClear(),this.autoRefresh&&this.subscriptionExpires>0){var t=900*this.subscriptionExpires;this._subscriptionRefresh=Math.floor(t/1e3),this._subscriptionRefreshLastSet=Math.floor(Date.now()/1e3),this.refreshTimer=setTimeout((function(){e.refreshTimer=void 0,e._subscriptionRefresh=void 0,e._subscriptionRefreshLastSet=void 0,e.onRefresh(e.refresh())}),t)}},t.prototype.stateTransition=function(e,t){var n=this,r=function(){n.logger.warn("Invalid subscription state transition from ".concat(n.subscriptionState," to ").concat(e))};switch(e){case ye.Initial:return void r();case ye.NotifyWait:return void r();case ye.Pending:if(this.subscriptionState!==ye.NotifyWait&&this.subscriptionState!==ye.Pending)return void r();break;case ye.Active:if(this.subscriptionState!==ye.NotifyWait&&this.subscriptionState!==ye.Pending&&this.subscriptionState!==ye.Active)return void r();break;case ye.Terminated:if(this.subscriptionState!==ye.NotifyWait&&this.subscriptionState!==ye.Pending&&this.subscriptionState!==ye.Active)return void r();break;default:return void r()}e===ye.Pending&&t&&(this.subscriptionExpires=t),e===ye.Active&&t&&(this.subscriptionExpires=t),e===ye.Terminated&&this.dispose(),this._subscriptionState=e},t.prototype.timerN=function(){this.logger.warn("Timer N expired for SUBSCRIBE dialog. Timed out waiting for NOTIFY."),this.subscriptionState!==ye.Terminated&&(this.stateTransition(ye.Terminated),this.onTerminated())},t}(L);(function(e){e[e["error"]=0]="error",e[e["warn"]=1]="warn",e[e["log"]=2]="log",e[e["debug"]=3]="debug"})(Se||(Se={}));var ke=function(){function e(e,t,n){this.logger=e,this.category=t,this.label=n}return e.prototype.error=function(e){this.genericLog(Se.error,e)},e.prototype.warn=function(e){this.genericLog(Se.warn,e)},e.prototype.log=function(e){this.genericLog(Se.log,e)},e.prototype.debug=function(e){this.genericLog(Se.debug,e)},e.prototype.genericLog=function(e,t){this.logger.genericLog(e,this.category,this.label,t)},Object.defineProperty(e.prototype,"level",{get:function(){return this.logger.level},set:function(e){this.logger.level=e},enumerable:!1,configurable:!0}),e}(),xe=function(){function e(){this.builtinEnabled=!0,this._level=Se.log,this.loggers={},this.logger=this.getLogger("sip:loggerfactory")}return Object.defineProperty(e.prototype,"level",{get:function(){return this._level},set:function(e){e>=0&&e<=3?this._level=e:e>3?this._level=3:Se.hasOwnProperty(e)?this._level=e:this.logger.error("invalid 'level' parameter value: "+JSON.stringify(e))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"connector",{get:function(){return this._connector},set:function(e){e?"function"===typeof e?this._connector=e:this.logger.error("invalid 'connector' parameter value: "+JSON.stringify(e)):this._connector=void 0},enumerable:!1,configurable:!0}),e.prototype.getLogger=function(e,t){if(t&&3===this.level)return new ke(this,e,t);if(this.loggers[e])return this.loggers[e];var n=new ke(this,e);return this.loggers[e]=n,n},e.prototype.genericLog=function(e,t,n,r){this.level>=e&&this.builtinEnabled&&this.print(e,t,n,r),this.connector&&this.connector(Se[e],t,n,r)},e.prototype.print=function(e,t,n,r){if("string"===typeof r){var o=[new Date,t];n&&o.push(n),r=o.concat(r).join(" | ")}switch(e){case Se.error:console.error(r);break;case Se.warn:console.warn(r);break;case Se.log:console.log(r);break;case Se.debug:console.debug(r);break}},e}();(function(e){function t(t,n,r){return e.call(this,Q,t,n,r)||this}o(t,e)})(te);var Ie=function(e){function t(t,n,r){var o=e.call(this,J,t,n,r)||this;return o.confirmedDialogAcks=new Map,o.confirmedDialogs=new Map,o.earlyDialogs=new Map,o.delegate=r,o}return o(t,e),t.prototype.dispose=function(){this.earlyDialogs.forEach((function(e){return e.dispose()})),this.earlyDialogs.clear(),e.prototype.dispose.call(this)},t.prototype.onTransportError=function(t){if(this.transaction.state===q.Calling)return e.prototype.onTransportError.call(this,t);this.logger.error(t.message),this.logger.error("User agent client request transport error while sending ACK.")},t.prototype.receiveResponse=function(e){var t=this;if(this.authenticationGuard(e)){var n=e.statusCode?e.statusCode.toString():"";if(!n)throw new Error("Response status code undefined.");switch(!0){case/^100$/.test(n):return void(this.delegate&&this.delegate.onTrying&&this.delegate.onTrying({message:e}));case/^1[0-9]{2}$/.test(n):if(!e.toTag)return void this.logger.warn("Non-100 1xx INVITE response received without a to tag, dropping.");var r=e.parseHeader("contact");if(!r)return void this.logger.error("Non-100 1xx INVITE response received without a Contact header field, dropping.");var o=L.initialDialogStateForUserAgentClient(this.message,e),i=this.earlyDialogs.get(o.id);if(!i){var s=this.transaction;if(!(s instanceof J))throw new Error("Transaction not instance of InviteClientTransaction.");i=new we(s,this.core,o),this.earlyDialogs.set(i.id,i)}if(!i.reliableSequenceGuard(e))return void this.logger.warn("1xx INVITE reliable response received out of order or is a retransmission, dropping.");i.signalingState!==M.Initial&&i.signalingState!==M.HaveLocalOffer||i.signalingStateTransition(e);var a=i;return void(this.delegate&&this.delegate.onProgress&&this.delegate.onProgress({message:e,session:a,prack:function(e){var t=a.prack(void 0,e);return t}}));case/^2[0-9]{2}$/.test(n):if(!e.toTag)return void this.logger.error("2xx INVITE response received without a to tag, dropping.");r=e.parseHeader("contact");if(!r)return void this.logger.error("2xx INVITE response received without a Contact header field, dropping.");o=L.initialDialogStateForUserAgentClient(this.message,e);var c=this.confirmedDialogs.get(o.id);if(c){var l=this.confirmedDialogAcks.get(o.id);if(l){s=this.transaction;if(!(s instanceof J))throw new Error("Client transaction not instance of InviteClientTransaction.");s.ackResponse(l.message)}return}if(c=this.earlyDialogs.get(o.id),c)c.confirm(),c.recomputeRouteSet(e),this.earlyDialogs.delete(c.id),this.confirmedDialogs.set(c.id,c);else{s=this.transaction;if(!(s instanceof J))throw new Error("Transaction not instance of InviteClientTransaction.");c=new we(s,this.core,o),this.confirmedDialogs.set(c.id,c)}c.signalingState!==M.Initial&&c.signalingState!==M.HaveLocalOffer||c.signalingStateTransition(e);var u=c;if(this.delegate&&this.delegate.onAccept)this.delegate.onAccept({message:e,session:u,ack:function(e){var n=u.ack(e);return t.confirmedDialogAcks.set(u.id,n),n}});else{l=u.ack();this.confirmedDialogAcks.set(u.id,l)}return;case/^3[0-9]{2}$/.test(n):return this.earlyDialogs.forEach((function(e){return e.dispose()})),this.earlyDialogs.clear(),void(this.delegate&&this.delegate.onRedirect&&this.delegate.onRedirect({message:e}));case/^[4-6][0-9]{2}$/.test(n):return this.earlyDialogs.forEach((function(e){return e.dispose()})),this.earlyDialogs.clear(),void(this.delegate&&this.delegate.onReject&&this.delegate.onReject({message:e}));default:throw new Error("Invalid status code ".concat(n))}}},t}(te),Re=function(e){function t(t,n,r){var o=e.call(this,X,t,n,r)||this;return o.core=t,o}return o(t,e),t.prototype.dispose=function(){this.earlyDialog&&this.earlyDialog.dispose(),e.prototype.dispose.call(this)},t.prototype.accept=function(t){if(void 0===t&&(t={statusCode:200}),!this.acceptable)throw new K("".concat(this.message.method," not acceptable in state ").concat(this.transaction.state,"."));if(!this.confirmedDialog)if(this.earlyDialog)this.earlyDialog.confirm(),this.confirmedDialog=this.earlyDialog,this.earlyDialog=void 0;else{var n=this.transaction;if(!(n instanceof X))throw new Error("Transaction not instance of InviteClientTransaction.");var r=L.initialDialogStateForUserAgentServer(this.message,this.toTag);this.confirmedDialog=new we(n,this.core,r)}var o=this.message.getHeaders("record-route").map((function(e){return"Record-Route: ".concat(e)})),s="Contact: ".concat(this.core.configuration.contact.toString()),a="Allow: "+Te.toString();if(!t.body)if(this.confirmedDialog.signalingState===M.Stable)t.body=this.confirmedDialog.answer;else if(this.confirmedDialog.signalingState===M.Initial||this.confirmedDialog.signalingState===M.HaveRemoteOffer)throw new Error("Response must have a body.");t.statusCode=t.statusCode||200,t.extraHeaders=t.extraHeaders||[],t.extraHeaders=t.extraHeaders.concat(o),t.extraHeaders.push(a),t.extraHeaders.push(s);var c=e.prototype.accept.call(this,t),l=this.confirmedDialog,u=i(i({},c),{session:l});return t.body&&this.confirmedDialog.signalingState!==M.Stable&&this.confirmedDialog.signalingStateTransition(t.body),u},t.prototype.progress=function(t){if(void 0===t&&(t={statusCode:180}),!this.progressable)throw new K("".concat(this.message.method," not progressable in state ").concat(this.transaction.state,"."));if(!this.earlyDialog){var n=this.transaction;if(!(n instanceof X))throw new Error("Transaction not instance of InviteClientTransaction.");var r=L.initialDialogStateForUserAgentServer(this.message,this.toTag,!0);this.earlyDialog=new we(n,this.core,r)}var o=this.message.getHeaders("record-route").map((function(e){return"Record-Route: ".concat(e)})),s="Contact: ".concat(this.core.configuration.contact);t.extraHeaders=t.extraHeaders||[],t.extraHeaders=t.extraHeaders.concat(o),t.extraHeaders.push(s);var a=e.prototype.progress.call(this,t),c=this.earlyDialog,l=i(i({},a),{session:c});return t.body&&this.earlyDialog.signalingState!==M.Stable&&this.earlyDialog.signalingStateTransition(t.body),l},t.prototype.redirect=function(t,n){return void 0===n&&(n={statusCode:302}),e.prototype.redirect.call(this,t,n)},t.prototype.reject=function(t){return void 0===t&&(t={statusCode:486}),e.prototype.reject.call(this,t)},t}(re),_e=function(e){function t(t,n,r){return e.call(this,Q,t,n,r)||this}return o(t,e),t}(te);(function(e){function t(t,n,r){return e.call(this,ee,t.userAgentCore,n,r)||this}o(t,e)})(re);var Ne,Ae=function(e){function t(t,n,r){return e.call(this,Q,t,n,r)||this}return o(t,e),t}(te),Oe=function(e){function t(t,n,r){var o=e.call(this,ee,t,n,r)||this;return o.core=t,o}return o(t,e),t}(re),Pe=function(e){function t(t,n,r){var o=this,i=n.getHeader("Event");if(!i)throw new Error("Event undefined");var s=n.getHeader("Expires");if(!s)throw new Error("Expires undefined");return o=e.call(this,Q,t,n,r)||this,o.delegate=r,o.subscriberId=n.callId+n.fromTag+i,o.subscriptionExpiresRequested=o.subscriptionExpires=Number(s),o.subscriptionEvent=i,o.subscriptionState=ye.NotifyWait,o.waitNotifyStart(),o}return o(t,e),t.prototype.dispose=function(){e.prototype.dispose.call(this)},t.prototype.onNotify=function(e){var t=e.message.parseHeader("Event").event;if(!t||t!==this.subscriptionEvent)return this.logger.warn("Failed to parse event."),void e.reject({statusCode:489});var n=e.message.parseHeader("Subscription-State");if(!n||!n.state)return this.logger.warn("Failed to parse subscription state."),void e.reject({statusCode:489});var r=n.state;switch(r){case"pending":break;case"active":break;case"terminated":break;default:return this.logger.warn("Invalid subscription state ".concat(r)),void e.reject({statusCode:489})}if("terminated"!==r){var o=e.message.parseHeader("contact");if(!o)return this.logger.warn("Failed to parse contact."),void e.reject({statusCode:489})}if(this.dialog)throw new Error("Dialog already created. This implementation only supports install of single subscriptions.");switch(this.waitNotifyStop(),this.subscriptionExpires=n.expires?Math.min(this.subscriptionExpires,Math.max(n.expires,0)):this.subscriptionExpires,r){case"pending":this.subscriptionState=ye.Pending;break;case"active":this.subscriptionState=ye.Active;break;case"terminated":this.subscriptionState=ye.Terminated;break;default:throw new Error("Unrecognized state ".concat(r,"."))}if(this.subscriptionState!==ye.Terminated){var i=Ee.initialDialogStateForSubscription(this.message,e.message);this.dialog=new Ee(this.subscriptionEvent,this.subscriptionExpires,this.subscriptionState,this.core,i)}if(this.delegate&&this.delegate.onNotify){var s=e,a=this.dialog;this.delegate.onNotify({request:s,subscription:a})}else e.accept()},t.prototype.waitNotifyStart=function(){var e=this;this.N||(this.core.subscribers.set(this.subscriberId,this),this.N=setTimeout((function(){return e.timerN()}),U.TIMER_N))},t.prototype.waitNotifyStop=function(){this.N&&(this.core.subscribers.delete(this.subscriberId),clearTimeout(this.N),this.N=void 0)},t.prototype.receiveResponse=function(t){if(this.authenticationGuard(t)){if(t.statusCode&&t.statusCode>=200&&t.statusCode<300){var n=t.getHeader("Expires");if(n){var r=Number(n);r>this.subscriptionExpiresRequested&&this.logger.warn("Expires header in a 200-class response to SUBSCRIBE with a higher value than the one in the request"),r<this.subscriptionExpires&&(this.subscriptionExpires=r)}else this.logger.warn("Expires header missing in a 200-class response to SUBSCRIBE");this.dialog&&this.dialog.subscriptionExpires>this.subscriptionExpires&&(this.dialog.subscriptionExpires=this.subscriptionExpires)}t.statusCode&&t.statusCode>=300&&t.statusCode<700&&this.waitNotifyStop(),e.prototype.receiveResponse.call(this,t)}},t.prototype.timerN=function(){this.logger.warn("Timer N expired for SUBSCRIBE user agent client. Timed out waiting for NOTIFY."),this.waitNotifyStop(),this.delegate&&this.delegate.onNotifyTimeout&&this.delegate.onNotifyTimeout()},t}(te),De=function(e){function t(t,n,r){var o=e.call(this,ee,t,n,r)||this;return o.core=t,o}return o(t,e),t}(re),Be=["application/sdp","application/dtmf-relay"],je=function(){function e(e,t){void 0===t&&(t={}),this.userAgentClients=new Map,this.userAgentServers=new Map,this.configuration=e,this.delegate=t,this.dialogs=new Map,this.subscribers=new Map,this.logger=e.loggerFactory.getLogger("sip.user-agent-core")}return e.prototype.dispose=function(){this.reset()},e.prototype.reset=function(){this.dialogs.forEach((function(e){return e.dispose()})),this.dialogs.clear(),this.subscribers.forEach((function(e){return e.dispose()})),this.subscribers.clear(),this.userAgentClients.forEach((function(e){return e.dispose()})),this.userAgentClients.clear(),this.userAgentServers.forEach((function(e){return e.dispose()})),this.userAgentServers.clear()},Object.defineProperty(e.prototype,"loggerFactory",{get:function(){return this.configuration.loggerFactory},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transport",{get:function(){var e=this.configuration.transportAccessor();if(!e)throw new Error("Transport undefined.");return e},enumerable:!1,configurable:!0}),e.prototype.invite=function(e,t){return new Ie(this,e,t)},e.prototype.message=function(e,t){return new ae(this,e,t)},e.prototype.publish=function(e,t){return new _e(this,e,t)},e.prototype.register=function(e,t){return new Ae(this,e,t)},e.prototype.subscribe=function(e,t){return new Pe(this,e,t)},e.prototype.request=function(e,t){return new te(Q,this,e,t)},e.prototype.makeOutgoingRequestMessage=function(e,t,n,r,o,s,a){var c=this.configuration.sipjsId,l=this.configuration.displayName,u=this.configuration.viaForceRport,d=this.configuration.hackViaTcp,p=this.configuration.supportedOptionTags.slice();e===m.REGISTER&&p.push("path","gruu"),e===m.INVITE&&(this.configuration.contact.pubGruu||this.configuration.contact.tempGruu)&&p.push("gruu");var h=this.configuration.routeSet,f=this.configuration.userAgentHeaderFieldValue,g=this.configuration.viaHost,v={callIdPrefix:c,forceRport:u,fromDisplayName:l,hackViaTcp:d,optionTags:p,routeSet:h,userAgentString:f,viaHost:g},y=i(i({},v),o);return new I(e,t,n,r,y,s,a)},e.prototype.receiveIncomingRequestFromTransport=function(e){this.receiveRequestFromTransport(e)},e.prototype.receiveIncomingResponseFromTransport=function(e){this.receiveResponseFromTransport(e)},e.prototype.replyStateless=function(e,t){var n=this,r=this.configuration.userAgentHeaderFieldValue,o=this.configuration.supportedOptionTagsResponse;t=i(i({},t),{userAgent:r,supported:o});var s=j(e,t);return this.transport.send(s.message).catch((function(t){t instanceof Error&&n.logger.error(t.message),n.logger.error("Transport error occurred sending stateless reply to ".concat(e.method," request."))})),s},e.prototype.receiveRequestFromTransport=function(e){var t=e.viaBranch,n=this.userAgentServers.get(t);e.method===m.ACK&&n&&n.transaction.state===q.Accepted&&n instanceof Re?this.logger.warn("Discarding out of dialog ACK after 2xx response sent on transaction ".concat(t,".")):e.method!==m.CANCEL?n?n.transaction.receiveRequest(e):this.receiveRequest(e):n?(this.replyStateless(e,{statusCode:200}),n.transaction instanceof X&&n.transaction.state===q.Proceeding&&n instanceof Re&&n.receiveCancel(e)):this.replyStateless(e,{statusCode:481})},e.prototype.receiveRequest=function(e){if(Te.includes(e.method)){if(!e.ruri)throw new Error("Request-URI undefined.");if("sip"===e.ruri.scheme){var t=e.ruri,n=function(e){return!!e&&e.user===t.user};if(!n(this.configuration.aor)&&!(n(this.configuration.contact.uri)||n(this.configuration.contact.pubGruu)||n(this.configuration.contact.tempGruu)))return this.logger.warn("Request-URI does not point to us."),void(e.method!==m.ACK&&this.replyStateless(e,{statusCode:404}));if(e.method!==m.INVITE||e.hasHeader("Contact")){if(!e.toTag){var r=e.viaBranch;if(!this.userAgentServers.has(r)){var o=Array.from(this.userAgentServers.values()).some((function(t){return t.transaction.request.fromTag===e.fromTag&&t.transaction.request.callId===e.callId&&t.transaction.request.cseq===e.cseq}));if(o)return void this.replyStateless(e,{statusCode:482})}}e.toTag?this.receiveInsideDialogRequest(e):this.receiveOutsideDialogRequest(e)}else this.replyStateless(e,{statusCode:400,reasonPhrase:"Missing Contact Header"})}else this.replyStateless(e,{statusCode:416})}else{var i="Allow: "+Te.toString();this.replyStateless(e,{statusCode:405,extraHeaders:[i]})}},e.prototype.receiveInsideDialogRequest=function(e){if(e.method===m.NOTIFY){var t=e.parseHeader("Event");if(!t||!t.event)return void this.replyStateless(e,{statusCode:489});var n=e.callId+e.toTag+t.event,r=this.subscribers.get(n);if(r){var o=new de(this,e);return void r.onNotify(o)}}var i=e.callId+e.toTag+e.fromTag,s=this.dialogs.get(i);if(s){if(e.method===m.OPTIONS){var a="Allow: "+Te.toString(),c="Accept: "+Be.toString();return void this.replyStateless(e,{statusCode:200,extraHeaders:[a,c]})}s.receiveRequest(e)}else e.method!==m.ACK&&this.replyStateless(e,{statusCode:481})},e.prototype.receiveOutsideDialogRequest=function(e){switch(e.method){case m.ACK:break;case m.BYE:this.replyStateless(e,{statusCode:481});break;case m.CANCEL:throw new Error("Unexpected out of dialog request method ".concat(e.method,"."));case m.INFO:this.replyStateless(e,{statusCode:405});break;case m.INVITE:var t=new Re(this,e);this.delegate.onInvite?this.delegate.onInvite(t):t.reject();break;case m.MESSAGE:t=new ce(this,e);this.delegate.onMessage?this.delegate.onMessage(t):t.accept();break;case m.NOTIFY:t=new de(this,e);this.delegate.onNotify?this.delegate.onNotify(t):t.reject({statusCode:405});break;case m.OPTIONS:var n="Allow: "+Te.toString(),r="Accept: "+Be.toString();this.replyStateless(e,{statusCode:200,extraHeaders:[n,r]});break;case m.REFER:t=new be(this,e);this.delegate.onRefer?this.delegate.onRefer(t):t.reject({statusCode:405});break;case m.REGISTER:t=new Oe(this,e);this.delegate.onRegister?this.delegate.onRegister(t):t.reject({statusCode:405});break;case m.SUBSCRIBE:t=new De(this,e);this.delegate.onSubscribe?this.delegate.onSubscribe(t):t.reject({statusCode:480});break;default:throw new Error("Unexpected out of dialog request method ".concat(e.method,"."))}},e.prototype.receiveResponseFromTransport=function(e){if(e.getHeaders("via").length>1)this.logger.warn("More than one Via header field present in the response, dropping");else{var t=e.viaBranch+e.method,n=this.userAgentClients.get(t);n?n.transaction.receiveResponse(e):this.logger.warn("Discarding unmatched ".concat(e.statusCode," response to ").concat(e.method," ").concat(t,"."))}},e}(),He=function(e){function t(t){return e.call(this,t||"Unsupported content type.")||this}return o(t,e),t}(z),Me=function(e){function t(t){return e.call(this,t||"Request pending.")||this}return o(t,e),t}(z),Le=function(e){function t(t){return e.call(this,t||"Unspecified session description handler error.")||this}return o(t,e),t}(z),qe=function(e){function t(){return e.call(this,"The session has terminated.")||this}return o(t,e),t}(z),$e=function(e){function t(t){return e.call(this,t||"An error occurred during state transition.")||this}return o(t,e),t}(z),Ve=function(){function e(e){this.incomingAckRequest=e}return Object.defineProperty(e.prototype,"request",{get:function(){return this.incomingAckRequest.message},enumerable:!1,configurable:!0}),e}(),Fe=function(){function e(e){this.incomingByeRequest=e}return Object.defineProperty(e.prototype,"request",{get:function(){return this.incomingByeRequest.message},enumerable:!1,configurable:!0}),e.prototype.accept=function(e){return this.incomingByeRequest.accept(e),Promise.resolve()},e.prototype.reject=function(e){return this.incomingByeRequest.reject(e),Promise.resolve()},e}(),Ue=function(){function e(){this.listeners=new Array}return e.prototype.addListener=function(e,t){var n=this,r=function(t){n.removeListener(r),e(t)};!0===(null===t||void 0===t?void 0:t.once)?this.listeners.push(r):this.listeners.push(e)},e.prototype.emit=function(e){this.listeners.slice().forEach((function(t){return t(e)}))},e.prototype.removeAllListeners=function(){this.listeners=[]},e.prototype.removeListener=function(e){this.listeners=this.listeners.filter((function(t){return t!==e}))},e.prototype.on=function(e){return this.addListener(e)},e.prototype.off=function(e){return this.removeListener(e)},e.prototype.once=function(e){return this.addListener(e,{once:!0})},e}(),ze=function(){function e(e){this.incomingInfoRequest=e}return Object.defineProperty(e.prototype,"request",{get:function(){return this.incomingInfoRequest.message},enumerable:!1,configurable:!0}),e.prototype.accept=function(e){return this.incomingInfoRequest.accept(e),Promise.resolve()},e.prototype.reject=function(e){return this.incomingInfoRequest.reject(e),Promise.resolve()},e}(),Ke=function(){function e(e){this.incomingMessageRequest=e}return Object.defineProperty(e.prototype,"request",{get:function(){return this.incomingMessageRequest.message},enumerable:!1,configurable:!0}),e.prototype.accept=function(e){return this.incomingMessageRequest.accept(e),Promise.resolve()},e.prototype.reject=function(e){return this.incomingMessageRequest.reject(e),Promise.resolve()},e}(),We=function(){function e(e){this.incomingNotifyRequest=e}return Object.defineProperty(e.prototype,"request",{get:function(){return this.incomingNotifyRequest.message},enumerable:!1,configurable:!0}),e.prototype.accept=function(e){return this.incomingNotifyRequest.accept(e),Promise.resolve()},e.prototype.reject=function(e){return this.incomingNotifyRequest.reject(e),Promise.resolve()},e}(),Ge=function(){function e(e,t){this.incomingReferRequest=e,this.session=t}return Object.defineProperty(e.prototype,"referTo",{get:function(){var e=this.incomingReferRequest.message.parseHeader("refer-to");if(!(e instanceof u))throw new Error("Failed to parse Refer-To header.");return e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"referredBy",{get:function(){return this.incomingReferRequest.message.getHeader("referred-by")},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"replaces",{get:function(){var e=this.referTo.uri.getHeader("replaces");return e instanceof Array?e[0]:e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"request",{get:function(){return this.incomingReferRequest.message},enumerable:!1,configurable:!0}),e.prototype.accept=function(e){return void 0===e&&(e={statusCode:202}),this.incomingReferRequest.accept(e),Promise.resolve()},e.prototype.reject=function(e){return this.incomingReferRequest.reject(e),Promise.resolve()},e.prototype.makeInviter=function(e){if(this.inviter)return this.inviter;var t=this.referTo.uri.clone();t.clearHeaders(),e=e||{};var n=(e.extraHeaders||[]).slice(),r=this.replaces;r&&n.push("Replaces: "+decodeURIComponent(r));var o=this.referredBy;return o&&n.push("Referred-By: "+o),e.extraHeaders=n,this.inviter=this.session.userAgent._makeInviter(t,e),this.inviter._referred=this.session,this.session._referral=this.inviter,this.inviter},e}();(function(e){e["Initial"]="Initial",e["Establishing"]="Establishing",e["Established"]="Established",e["Terminating"]="Terminating",e["Terminated"]="Terminated"})(Ne||(Ne={}));var Ye,Je=function(){function e(e,t){void 0===t&&(t={}),this.pendingReinvite=!1,this.pendingReinviteAck=!1,this._state=Ne.Initial,this.delegate=t.delegate,this._stateEventEmitter=new Ue,this._userAgent=e}return e.prototype.dispose=function(){var e=this;switch(this.logger.log("Session ".concat(this.id," in state ").concat(this._state," is being disposed")),delete this.userAgent._sessions[this.id],this._sessionDescriptionHandler&&this._sessionDescriptionHandler.close(),this.state){case Ne.Initial:break;case Ne.Establishing:break;case Ne.Established:return new Promise((function(t){e._bye({onAccept:function(){return t()},onRedirect:function(){return t()},onReject:function(){return t()}})}));case Ne.Terminating:break;case Ne.Terminated:break;default:throw new Error("Unknown state.")}return Promise.resolve()},Object.defineProperty(e.prototype,"assertedIdentity",{get:function(){return this._assertedIdentity},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"dialog",{get:function(){return this._dialog},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"id",{get:function(){return this._id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"replacee",{get:function(){return this._replacee},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sessionDescriptionHandler",{get:function(){return this._sessionDescriptionHandler},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sessionDescriptionHandlerFactory",{get:function(){return this.userAgent.configuration.sessionDescriptionHandlerFactory},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sessionDescriptionHandlerModifiers",{get:function(){return this._sessionDescriptionHandlerModifiers||[]},set:function(e){this._sessionDescriptionHandlerModifiers=e.slice()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sessionDescriptionHandlerOptions",{get:function(){return this._sessionDescriptionHandlerOptions||{}},set:function(e){this._sessionDescriptionHandlerOptions=i({},e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sessionDescriptionHandlerModifiersReInvite",{get:function(){return this._sessionDescriptionHandlerModifiersReInvite||[]},set:function(e){this._sessionDescriptionHandlerModifiersReInvite=e.slice()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sessionDescriptionHandlerOptionsReInvite",{get:function(){return this._sessionDescriptionHandlerOptionsReInvite||{}},set:function(e){this._sessionDescriptionHandlerOptionsReInvite=i({},e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stateChange",{get:function(){return this._stateEventEmitter},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"userAgent",{get:function(){return this._userAgent},enumerable:!1,configurable:!0}),e.prototype.bye=function(e){void 0===e&&(e={});var t="Session.bye() may only be called if established session.";switch(this.state){case Ne.Initial:"function"===typeof this.cancel?(t+=" However Inviter.invite() has not yet been called.",t+=" Perhaps you should have called Inviter.cancel()?"):"function"===typeof this.reject&&(t+=" However Invitation.accept() has not yet been called.",t+=" Perhaps you should have called Invitation.reject()?");break;case Ne.Establishing:"function"===typeof this.cancel?(t+=" However a dialog does not yet exist.",t+=" Perhaps you should have called Inviter.cancel()?"):"function"===typeof this.reject&&(t+=" However Invitation.accept() has not yet been called (or not yet resolved).",t+=" Perhaps you should have called Invitation.reject()?");break;case Ne.Established:var n=e.requestDelegate,r=this.copyRequestOptions(e.requestOptions);return this._bye(n,r);case Ne.Terminating:t+=" However this session is already terminating.","function"===typeof this.cancel?t+=" Perhaps you have already called Inviter.cancel()?":"function"===typeof this.reject&&(t+=" Perhaps you have already called Session.bye()?");break;case Ne.Terminated:t+=" However this session is already terminated.";break;default:throw new Error("Unknown state")}return this.logger.error(t),Promise.reject(new Error("Invalid session state ".concat(this.state)))},e.prototype.info=function(e){if(void 0===e&&(e={}),this.state!==Ne.Established){var t="Session.info() may only be called if established session.";return this.logger.error(t),Promise.reject(new Error("Invalid session state ".concat(this.state)))}var n=e.requestDelegate,r=this.copyRequestOptions(e.requestOptions);return this._info(n,r)},e.prototype.invite=function(e){var t=this;if(void 0===e&&(e={}),this.logger.log("Session.invite"),this.state!==Ne.Established)return Promise.reject(new Error("Invalid session state ".concat(this.state)));if(this.pendingReinvite)return Promise.reject(new Me("Reinvite in progress. Please wait until complete, then try again."));this.pendingReinvite=!0,e.sessionDescriptionHandlerModifiers&&(this.sessionDescriptionHandlerModifiersReInvite=e.sessionDescriptionHandlerModifiers),e.sessionDescriptionHandlerOptions&&(this.sessionDescriptionHandlerOptionsReInvite=e.sessionDescriptionHandlerOptions);var n={onAccept:function(n){var r=A(n.message);if(!r)return t.logger.error("Received 2xx response to re-INVITE without a session description"),t.ackAndBye(n,400,"Missing session description"),t.stateTransition(Ne.Terminated),void(t.pendingReinvite=!1);if(e.withoutSdp){var o={sessionDescriptionHandlerOptions:t.sessionDescriptionHandlerOptionsReInvite,sessionDescriptionHandlerModifiers:t.sessionDescriptionHandlerModifiersReInvite};t.setOfferAndGetAnswer(r,o).then((function(e){n.ack({body:e})})).catch((function(e){t.logger.error("Failed to handle offer in 2xx response to re-INVITE"),t.logger.error(e.message),t.state===Ne.Terminated?n.ack():(t.ackAndBye(n,488,"Bad Media Description"),t.stateTransition(Ne.Terminated))})).then((function(){t.pendingReinvite=!1,e.requestDelegate&&e.requestDelegate.onAccept&&e.requestDelegate.onAccept(n)}))}else{o={sessionDescriptionHandlerOptions:t.sessionDescriptionHandlerOptionsReInvite,sessionDescriptionHandlerModifiers:t.sessionDescriptionHandlerModifiersReInvite};t.setAnswer(r,o).then((function(){n.ack()})).catch((function(e){t.logger.error("Failed to handle answer in 2xx response to re-INVITE"),t.logger.error(e.message),t.state!==Ne.Terminated?(t.ackAndBye(n,488,"Bad Media Description"),t.stateTransition(Ne.Terminated)):n.ack()})).then((function(){t.pendingReinvite=!1,e.requestDelegate&&e.requestDelegate.onAccept&&e.requestDelegate.onAccept(n)}))}},onProgress:function(e){},onRedirect:function(e){},onReject:function(n){t.logger.warn("Received a non-2xx response to re-INVITE"),t.pendingReinvite=!1,e.withoutSdp?e.requestDelegate&&e.requestDelegate.onReject&&e.requestDelegate.onReject(n):t.rollbackOffer().catch((function(e){if(t.logger.error("Failed to rollback offer on non-2xx response to re-INVITE"),t.logger.error(e.message),t.state!==Ne.Terminated){if(!t.dialog)throw new Error("Dialog undefined.");var n=[];n.push("Reason: "+t.getReasonHeaderValue(500,"Internal Server Error")),t.dialog.bye(void 0,{extraHeaders:n}),t.stateTransition(Ne.Terminated)}})).then((function(){e.requestDelegate&&e.requestDelegate.onReject&&e.requestDelegate.onReject(n)}))},onTrying:function(e){}},r=e.requestOptions||{};if(r.extraHeaders=(r.extraHeaders||[]).slice(),r.extraHeaders.push("Allow: "+Te.toString()),r.extraHeaders.push("Contact: "+this._contact),e.withoutSdp){if(!this.dialog)throw this.pendingReinvite=!1,new Error("Dialog undefined.");return Promise.resolve(this.dialog.invite(n,r))}var o={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptionsReInvite,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiersReInvite};return this.getOffer(o).then((function(e){if(!t.dialog)throw t.pendingReinvite=!1,new Error("Dialog undefined.");return r.body=e,t.dialog.invite(n,r)})).catch((function(e){throw t.logger.error(e.message),t.logger.error("Failed to send re-INVITE"),t.pendingReinvite=!1,e}))},e.prototype.message=function(e){if(void 0===e&&(e={}),this.state!==Ne.Established){var t="Session.message() may only be called if established session.";return this.logger.error(t),Promise.reject(new Error("Invalid session state ".concat(this.state)))}var n=e.requestDelegate,r=this.copyRequestOptions(e.requestOptions);return this._message(n,r)},e.prototype.refer=function(e,t){if(void 0===t&&(t={}),this.state!==Ne.Established){var n="Session.refer() may only be called if established session.";return this.logger.error(n),Promise.reject(new Error("Invalid session state ".concat(this.state)))}var r=t.requestDelegate,o=this.copyRequestOptions(t.requestOptions);return o.extraHeaders=o.extraHeaders?o.extraHeaders.concat(this.referExtraHeaders(this.referToString(e))):this.referExtraHeaders(this.referToString(e)),this._refer(t.onNotify,r,o)},e.prototype._bye=function(e,t){var n=this;if(!this.dialog)return Promise.reject(new Error("Session dialog undefined."));var r=this.dialog;switch(r.sessionState){case H.Initial:throw new Error("Invalid dialog state ".concat(r.sessionState));case H.Early:throw new Error("Invalid dialog state ".concat(r.sessionState));case H.AckWait:return this.stateTransition(Ne.Terminating),new Promise((function(o){r.delegate={onAck:function(){var i=r.bye(e,t);return n.stateTransition(Ne.Terminated),o(i),Promise.resolve()},onAckTimeout:function(){var i=r.bye(e,t);n.stateTransition(Ne.Terminated),o(i)}}}));case H.Confirmed:var o=r.bye(e,t);return this.stateTransition(Ne.Terminated),Promise.resolve(o);case H.Terminated:throw new Error("Invalid dialog state ".concat(r.sessionState));default:throw new Error("Unrecognized state.")}},e.prototype._info=function(e,t){return this.dialog?Promise.resolve(this.dialog.info(e,t)):Promise.reject(new Error("Session dialog undefined."))},e.prototype._message=function(e,t){return this.dialog?Promise.resolve(this.dialog.message(e,t)):Promise.reject(new Error("Session dialog undefined."))},e.prototype._refer=function(e,t,n){return this.dialog?(this.onNotify=e,Promise.resolve(this.dialog.refer(t,n))):Promise.reject(new Error("Session dialog undefined."))},e.prototype.ackAndBye=function(e,t,n){e.ack();var r=[];t&&r.push("Reason: "+this.getReasonHeaderValue(t,n)),e.session.bye(void 0,{extraHeaders:r})},e.prototype.onAckRequest=function(e){var t=this;if(this.logger.log("Session.onAckRequest"),this.state!==Ne.Established&&this.state!==Ne.Terminating)return this.logger.error("ACK received while in state ".concat(this.state,", dropping request")),Promise.resolve();var n=this.dialog;if(!n)throw new Error("Dialog undefined.");var r={sessionDescriptionHandlerOptions:this.pendingReinviteAck?this.sessionDescriptionHandlerOptionsReInvite:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.pendingReinviteAck?this._sessionDescriptionHandlerModifiersReInvite:this._sessionDescriptionHandlerModifiers};if(this.delegate&&this.delegate.onAck){var o=new Ve(e);this.delegate.onAck(o)}switch(this.pendingReinviteAck=!1,n.signalingState){case M.Initial:this.logger.error("Invalid signaling state ".concat(n.signalingState,"."));var i=["Reason: "+this.getReasonHeaderValue(488,"Bad Media Description")];return n.bye(void 0,{extraHeaders:i}),this.stateTransition(Ne.Terminated),Promise.resolve();case M.Stable:var s=A(e.message);return s?"render"===s.contentDisposition?(this._renderbody=s.content,this._rendertype=s.contentType,Promise.resolve()):"session"!==s.contentDisposition?Promise.resolve():this.setAnswer(s,r).catch((function(e){t.logger.error(e.message);var r=["Reason: "+t.getReasonHeaderValue(488,"Bad Media Description")];n.bye(void 0,{extraHeaders:r}),t.stateTransition(Ne.Terminated)})):Promise.resolve();case M.HaveLocalOffer:this.logger.error("Invalid signaling state ".concat(n.signalingState,"."));i=["Reason: "+this.getReasonHeaderValue(488,"Bad Media Description")];return n.bye(void 0,{extraHeaders:i}),this.stateTransition(Ne.Terminated),Promise.resolve();case M.HaveRemoteOffer:this.logger.error("Invalid signaling state ".concat(n.signalingState,"."));i=["Reason: "+this.getReasonHeaderValue(488,"Bad Media Description")];return n.bye(void 0,{extraHeaders:i}),this.stateTransition(Ne.Terminated),Promise.resolve();case M.Closed:throw new Error("Invalid signaling state ".concat(n.signalingState,"."));default:throw new Error("Invalid signaling state ".concat(n.signalingState,"."))}},e.prototype.onByeRequest=function(e){if(this.logger.log("Session.onByeRequest"),this.state===Ne.Established){if(this.delegate&&this.delegate.onBye){var t=new Fe(e);this.delegate.onBye(t)}else e.accept();this.stateTransition(Ne.Terminated)}else this.logger.error("BYE received while in state ".concat(this.state,", dropping request"))},e.prototype.onInfoRequest=function(e){if(this.logger.log("Session.onInfoRequest"),this.state===Ne.Established)if(this.delegate&&this.delegate.onInfo){var t=new ze(e);this.delegate.onInfo(t)}else e.accept();else this.logger.error("INFO received while in state ".concat(this.state,", dropping request"))},e.prototype.onInviteRequest=function(e){var t=this;if(this.logger.log("Session.onInviteRequest"),this.state===Ne.Established){this.pendingReinviteAck=!0;var n=["Contact: "+this._contact];if(e.message.hasHeader("P-Asserted-Identity")){var r=e.message.getHeader("P-Asserted-Identity");if(!r)throw new Error("Header undefined.");this._assertedIdentity=g.nameAddrHeaderParse(r)}var o={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptionsReInvite,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiersReInvite};this.generateResponseOfferAnswerInDialog(o).then((function(r){var o=e.accept({statusCode:200,extraHeaders:n,body:r});t.delegate&&t.delegate.onInvite&&t.delegate.onInvite(e.message,o.message,200)})).catch((function(r){if(t.logger.error(r.message),t.logger.error("Failed to handle to re-INVITE request"),!t.dialog)throw new Error("Dialog undefined.");if(t.logger.error(t.dialog.signalingState),t.dialog.signalingState!==M.Stable)t.rollbackOffer().then((function(){var n=e.reject({statusCode:488});t.delegate&&t.delegate.onInvite&&t.delegate.onInvite(e.message,n.message,488)})).catch((function(r){t.logger.error(r.message),t.logger.error("Failed to rollback offer on re-INVITE request");var o=e.reject({statusCode:488});if(t.state!==Ne.Terminated){if(!t.dialog)throw new Error("Dialog undefined.");var i=[];i.push("Reason: "+t.getReasonHeaderValue(500,"Internal Server Error")),t.dialog.bye(void 0,{extraHeaders:n}),t.stateTransition(Ne.Terminated)}t.delegate&&t.delegate.onInvite&&t.delegate.onInvite(e.message,o.message,488)}));else{var o=e.reject({statusCode:488});t.delegate&&t.delegate.onInvite&&t.delegate.onInvite(e.message,o.message,488)}}))}else this.logger.error("INVITE received while in state ".concat(this.state,", dropping request"))},e.prototype.onMessageRequest=function(e){if(this.logger.log("Session.onMessageRequest"),this.state===Ne.Established)if(this.delegate&&this.delegate.onMessage){var t=new Ke(e);this.delegate.onMessage(t)}else e.accept();else this.logger.error("MESSAGE received while in state ".concat(this.state,", dropping request"))},e.prototype.onNotifyRequest=function(e){if(this.logger.log("Session.onNotifyRequest"),this.state===Ne.Established)if(this.onNotify){var t=new We(e);this.onNotify(t)}else if(this.delegate&&this.delegate.onNotify){t=new We(e);this.delegate.onNotify(t)}else e.accept();else this.logger.error("NOTIFY received while in state ".concat(this.state,", dropping request"))},e.prototype.onPrackRequest=function(e){if(this.logger.log("Session.onPrackRequest"),this.state===Ne.Established)throw new Error("Unimplemented.");this.logger.error("PRACK received while in state ".concat(this.state,", dropping request"))},e.prototype.onReferRequest=function(e){var t=this;if(this.logger.log("Session.onReferRequest"),this.state===Ne.Established){if(!e.message.hasHeader("refer-to"))return this.logger.warn("Invalid REFER packet. A refer-to header is required. Rejecting."),void e.reject();var n=new Ge(e,this);this.delegate&&this.delegate.onRefer?this.delegate.onRefer(n):(this.logger.log("No delegate available to handle REFER, automatically accepting and following."),n.accept().then((function(){return n.makeInviter(t._referralInviterOptions).invite()})).catch((function(e){t.logger.error(e.message)})))}else this.logger.error("REFER received while in state ".concat(this.state,", dropping request"))},e.prototype.generateResponseOfferAnswer=function(e,t){if(this.dialog)return this.generateResponseOfferAnswerInDialog(t);var n=A(e.message);return n&&"session"===n.contentDisposition?this.setOfferAndGetAnswer(n,t):this.getOffer(t)},e.prototype.generateResponseOfferAnswerInDialog=function(e){if(!this.dialog)throw new Error("Dialog undefined.");switch(this.dialog.signalingState){case M.Initial:return this.getOffer(e);case M.HaveLocalOffer:return Promise.resolve(void 0);case M.HaveRemoteOffer:if(!this.dialog.offer)throw new Error("Session offer undefined in signaling state ".concat(this.dialog.signalingState,"."));return this.setOfferAndGetAnswer(this.dialog.offer,e);case M.Stable:return this.state!==Ne.Established?Promise.resolve(void 0):this.getOffer(e);case M.Closed:throw new Error("Invalid signaling state ".concat(this.dialog.signalingState,"."));default:throw new Error("Invalid signaling state ".concat(this.dialog.signalingState,"."))}},e.prototype.getOffer=function(e){var t=this,n=this.setupSessionDescriptionHandler(),r=e.sessionDescriptionHandlerOptions,o=e.sessionDescriptionHandlerModifiers;try{return n.getDescription(r,o).then((function(e){return _(e)})).catch((function(e){t.logger.error("Session.getOffer: SDH getDescription rejected...");var n=e instanceof Error?e:new Error("Session.getOffer unknown error.");throw t.logger.error(n.message),n}))}catch(s){this.logger.error("Session.getOffer: SDH getDescription threw...");var i=s instanceof Error?s:new Error(s);return this.logger.error(i.message),Promise.reject(i)}},e.prototype.rollbackOffer=function(){var e=this,t=this.setupSessionDescriptionHandler();if(void 0===t.rollbackDescription)return Promise.resolve();try{return t.rollbackDescription().catch((function(t){e.logger.error("Session.rollbackOffer: SDH rollbackDescription rejected...");var n=t instanceof Error?t:new Error("Session.rollbackOffer unknown error.");throw e.logger.error(n.message),n}))}catch(r){this.logger.error("Session.rollbackOffer: SDH rollbackDescription threw...");var n=r instanceof Error?r:new Error(r);return this.logger.error(n.message),Promise.reject(n)}},e.prototype.setAnswer=function(e,t){var n=this,r=this.setupSessionDescriptionHandler(),o=t.sessionDescriptionHandlerOptions,i=t.sessionDescriptionHandlerModifiers;try{if(!r.hasDescription(e.contentType))return Promise.reject(new He)}catch(a){this.logger.error("Session.setAnswer: SDH hasDescription threw...");var s=a instanceof Error?a:new Error(a);return this.logger.error(s.message),Promise.reject(s)}try{return r.setDescription(e.content,o,i).catch((function(e){n.logger.error("Session.setAnswer: SDH setDescription rejected...");var t=e instanceof Error?e:new Error("Session.setAnswer unknown error.");throw n.logger.error(t.message),t}))}catch(a){this.logger.error("Session.setAnswer: SDH setDescription threw...");s=a instanceof Error?a:new Error(a);return this.logger.error(s.message),Promise.reject(s)}},e.prototype.setOfferAndGetAnswer=function(e,t){var n=this,r=this.setupSessionDescriptionHandler(),o=t.sessionDescriptionHandlerOptions,i=t.sessionDescriptionHandlerModifiers;try{if(!r.hasDescription(e.contentType))return Promise.reject(new He)}catch(a){this.logger.error("Session.setOfferAndGetAnswer: SDH hasDescription threw...");var s=a instanceof Error?a:new Error(a);return this.logger.error(s.message),Promise.reject(s)}try{return r.setDescription(e.content,o,i).then((function(){return r.getDescription(o,i)})).then((function(e){return _(e)})).catch((function(e){n.logger.error("Session.setOfferAndGetAnswer: SDH setDescription or getDescription rejected...");var t=e instanceof Error?e:new Error("Session.setOfferAndGetAnswer unknown error.");throw n.logger.error(t.message),t}))}catch(a){this.logger.error("Session.setOfferAndGetAnswer: SDH setDescription or getDescription threw...");s=a instanceof Error?a:new Error(a);return this.logger.error(s.message),Promise.reject(s)}},e.prototype.setSessionDescriptionHandler=function(e){if(this._sessionDescriptionHandler)throw new Error("Session description handler defined.");this._sessionDescriptionHandler=e},e.prototype.setupSessionDescriptionHandler=function(){var e;return this._sessionDescriptionHandler||(this._sessionDescriptionHandler=this.sessionDescriptionHandlerFactory(this,this.userAgent.configuration.sessionDescriptionHandlerFactoryOptions),(null===(e=this.delegate)||void 0===e?void 0:e.onSessionDescriptionHandler)&&this.delegate.onSessionDescriptionHandler(this._sessionDescriptionHandler,!1)),this._sessionDescriptionHandler},e.prototype.stateTransition=function(e){var t=this,n=function(){throw new Error("Invalid state transition from ".concat(t._state," to ").concat(e))};switch(this._state){case Ne.Initial:e!==Ne.Establishing&&e!==Ne.Established&&e!==Ne.Terminating&&e!==Ne.Terminated&&n();break;case Ne.Establishing:e!==Ne.Established&&e!==Ne.Terminating&&e!==Ne.Terminated&&n();break;case Ne.Established:e!==Ne.Terminating&&e!==Ne.Terminated&&n();break;case Ne.Terminating:e!==Ne.Terminated&&n();break;case Ne.Terminated:n();break;default:throw new Error("Unrecognized state.")}this._state=e,this.logger.log("Session ".concat(this.id," transitioned to state ").concat(this._state)),this._stateEventEmitter.emit(this._state),e===Ne.Terminated&&this.dispose()},e.prototype.copyRequestOptions=function(e){void 0===e&&(e={});var t=e.extraHeaders?e.extraHeaders.slice():void 0,n=e.body?{contentDisposition:e.body.contentDisposition||"render",contentType:e.body.contentType||"text/plain",content:e.body.content||""}:void 0;return{extraHeaders:t,body:n}},e.prototype.getReasonHeaderValue=function(e,t){var n=e,r=w(e);return!r&&t&&(r=t),"SIP;cause="+n+';text="'+r+'"'},e.prototype.referExtraHeaders=function(e){var t=[];return t.push("Referred-By: <"+this.userAgent.configuration.uri+">"),t.push("Contact: "+this._contact),t.push("Allow: "+["ACK","CANCEL","INVITE","MESSAGE","BYE","OPTIONS","INFO","NOTIFY","REFER"].toString()),t.push("Refer-To: "+e),t},e.prototype.referToString=function(e){var t;if(e instanceof d)t=e.toString();else{if(!e.dialog)throw new Error("Dialog undefined.");var n=e.remoteIdentity.friendlyName,r=e.dialog.remoteTarget.toString(),o=e.dialog.callId,i=e.dialog.remoteTag,s=e.dialog.localTag,a=encodeURIComponent("".concat(o,";to-tag=").concat(i,";from-tag=").concat(s));t='"'.concat(n,'" <').concat(r,"?Replaces=").concat(a,">")}return t},e}();(function(e){e["Required"]="Required",e["Supported"]="Supported",e["Unsupported"]="Unsupported"})(Ye||(Ye={}));var Ze,Xe,Qe={"100rel":!0,199:!0,answermode:!0,"early-session":!0,eventlist:!0,explicitsub:!0,"from-change":!0,"geolocation-http":!0,"geolocation-sip":!0,gin:!0,gruu:!0,histinfo:!0,ice:!0,join:!0,"multiple-refer":!0,norefersub:!0,nosub:!0,outbound:!0,path:!0,policy:!0,precondition:!0,pref:!0,privacy:!0,"recipient-list-invite":!0,"recipient-list-message":!0,"recipient-list-subscribe":!0,replaces:!0,"resource-priority":!0,"sdp-anat":!0,"sec-agree":!0,tdialog:!0,timer:!0,uui:!0},et=function(e){function t(t,n){var r=e.call(this,t)||this;r.incomingInviteRequest=n,r.disposed=!1,r.expiresTimer=void 0,r.isCanceled=!1,r.rel100="none",r.rseq=Math.floor(1e4*Math.random()),r.userNoAnswerTimer=void 0,r.waitingForPrack=!1,r.logger=t.getLogger("sip.Invitation");var o=r.incomingInviteRequest.message,i=o.getHeader("require");i&&i.toLowerCase().includes("100rel")&&(r.rel100="required");var s=o.getHeader("supported");if(s&&s.toLowerCase().includes("100rel")&&(r.rel100="supported"),o.toTag=n.toTag,"string"!==typeof o.toTag)throw new TypeError("toTag should have been a string.");if(r.userNoAnswerTimer=setTimeout((function(){n.reject({statusCode:480}),r.stateTransition(Ne.Terminated)}),r.userAgent.configuration.noAnswerTimeout?1e3*r.userAgent.configuration.noAnswerTimeout:6e4),o.hasHeader("expires")){var a=1e3*Number(o.getHeader("expires")||0);r.expiresTimer=setTimeout((function(){r.state===Ne.Initial&&(n.reject({statusCode:487}),r.stateTransition(Ne.Terminated))}),a)}var c=r.request.getHeader("P-Asserted-Identity");c&&(r._assertedIdentity=g.nameAddrHeaderParse(c)),r._contact=r.userAgent.contact.toString();var l=o.parseHeader("Content-Disposition");return l&&"render"===l.type&&(r._renderbody=o.body,r._rendertype=o.getHeader("Content-Type")),r._id=o.callId+o.fromTag,r.userAgent._sessions[r._id]=r,r}return o(t,e),t.prototype.dispose=function(){var t=this;if(this.disposed)return Promise.resolve();switch(this.disposed=!0,this.expiresTimer&&(clearTimeout(this.expiresTimer),this.expiresTimer=void 0),this.userNoAnswerTimer&&(clearTimeout(this.userNoAnswerTimer),this.userNoAnswerTimer=void 0),this.prackNeverArrived(),this.state){case Ne.Initial:return this.reject().then((function(){return e.prototype.dispose.call(t)}));case Ne.Establishing:return this.reject().then((function(){return e.prototype.dispose.call(t)}));case Ne.Established:return e.prototype.dispose.call(this);case Ne.Terminating:return e.prototype.dispose.call(this);case Ne.Terminated:return e.prototype.dispose.call(this);default:throw new Error("Unknown state.")}},Object.defineProperty(t.prototype,"autoSendAnInitialProvisionalResponse",{get:function(){return"required"!==this.rel100&&this.userAgent.configuration.sendInitialProvisionalResponse},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"body",{get:function(){return this.incomingInviteRequest.message.body},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localIdentity",{get:function(){return this.request.to},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"remoteIdentity",{get:function(){return this.request.from},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"request",{get:function(){return this.incomingInviteRequest.message},enumerable:!1,configurable:!0}),t.prototype.accept=function(e){var t=this;if(void 0===e&&(e={}),this.logger.log("Invitation.accept"),this.state!==Ne.Initial){var n=new Error("Invalid session state ".concat(this.state));return this.logger.error(n.message),Promise.reject(n)}return e.sessionDescriptionHandlerModifiers&&(this.sessionDescriptionHandlerModifiers=e.sessionDescriptionHandlerModifiers),e.sessionDescriptionHandlerOptions&&(this.sessionDescriptionHandlerOptions=e.sessionDescriptionHandlerOptions),this.stateTransition(Ne.Establishing),this.sendAccept(e).then((function(e){e.message;var n=e.session;n.delegate={onAck:function(e){return t.onAckRequest(e)},onAckTimeout:function(){return t.onAckTimeout()},onBye:function(e){return t.onByeRequest(e)},onInfo:function(e){return t.onInfoRequest(e)},onInvite:function(e){return t.onInviteRequest(e)},onMessage:function(e){return t.onMessageRequest(e)},onNotify:function(e){return t.onNotifyRequest(e)},onPrack:function(e){return t.onPrackRequest(e)},onRefer:function(e){return t.onReferRequest(e)}},t._dialog=n,t.stateTransition(Ne.Established),t._replacee&&t._replacee._bye()})).catch((function(e){return t.handleResponseError(e)}))},t.prototype.progress=function(e){var t=this;if(void 0===e&&(e={}),this.logger.log("Invitation.progress"),this.state!==Ne.Initial){var n=new Error("Invalid session state ".concat(this.state));return this.logger.error(n.message),Promise.reject(n)}var r=e.statusCode||180;if(r<100||r>199)throw new TypeError("Invalid statusCode: "+r);return e.sessionDescriptionHandlerModifiers&&(this.sessionDescriptionHandlerModifiers=e.sessionDescriptionHandlerModifiers),e.sessionDescriptionHandlerOptions&&(this.sessionDescriptionHandlerOptions=e.sessionDescriptionHandlerOptions),this.waitingForPrack?(this.logger.warn("Unexpected call for progress while waiting for prack, ignoring"),Promise.resolve()):100===e.statusCode?this.sendProgressTrying().then((function(){})).catch((function(e){return t.handleResponseError(e)})):"required"===this.rel100||"supported"===this.rel100&&e.rel100||"supported"===this.rel100&&this.userAgent.configuration.sipExtension100rel===Ye.Required?this.sendProgressReliableWaitForPrack(e).then((function(){})).catch((function(e){return t.handleResponseError(e)})):this.sendProgress(e).then((function(){})).catch((function(e){return t.handleResponseError(e)}))},t.prototype.reject=function(e){if(void 0===e&&(e={}),this.logger.log("Invitation.reject"),this.state!==Ne.Initial&&this.state!==Ne.Establishing){var t=new Error("Invalid session state ".concat(this.state));return this.logger.error(t.message),Promise.reject(t)}var n=e.statusCode||480,r=e.reasonPhrase?e.reasonPhrase:w(n),o=e.extraHeaders||[];if(n<300||n>699)throw new TypeError("Invalid statusCode: "+n);var i=e.body?_(e.body):void 0;return n<400?this.incomingInviteRequest.redirect([],{statusCode:n,reasonPhrase:r,extraHeaders:o,body:i}):this.incomingInviteRequest.reject({statusCode:n,reasonPhrase:r,extraHeaders:o,body:i}),this.stateTransition(Ne.Terminated),Promise.resolve()},t.prototype._onCancel=function(e){this.logger.log("Invitation._onCancel"),this.state===Ne.Initial||this.state===Ne.Establishing?(this.isCanceled=!0,this.incomingInviteRequest.reject({statusCode:487}),this.stateTransition(Ne.Terminated)):this.logger.error("CANCEL received while in state ".concat(this.state,", dropping request"))},t.prototype.handlePrackOfferAnswer=function(e){if(!this.dialog)throw new Error("Dialog undefined.");var t=A(e.message);if(!t||"session"!==t.contentDisposition)return Promise.resolve(void 0);var n={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers};switch(this.dialog.signalingState){case M.Initial:throw new Error("Invalid signaling state ".concat(this.dialog.signalingState,"."));case M.Stable:return this.setAnswer(t,n).then((function(){}));case M.HaveLocalOffer:throw new Error("Invalid signaling state ".concat(this.dialog.signalingState,"."));case M.HaveRemoteOffer:return this.setOfferAndGetAnswer(t,n);case M.Closed:throw new Error("Invalid signaling state ".concat(this.dialog.signalingState,"."));default:throw new Error("Invalid signaling state ".concat(this.dialog.signalingState,"."))}},t.prototype.handleResponseError=function(e){var t=480;if(e instanceof Error?this.logger.error(e.message):this.logger.error(e),e instanceof He?(this.logger.error("A session description handler occurred while sending response (content type unsupported"),t=415):e instanceof Le?this.logger.error("A session description handler occurred while sending response"):e instanceof qe?this.logger.error("Session ended before response could be formulated and sent (while waiting for PRACK)"):e instanceof K&&this.logger.error("Session changed state before response could be formulated and sent"),this.state===Ne.Initial||this.state===Ne.Establishing)try{this.incomingInviteRequest.reject({statusCode:t}),this.stateTransition(Ne.Terminated)}catch(n){throw this.logger.error("An error occurred attempting to reject the request while handling another error"),n}if(!this.isCanceled)throw e;this.logger.warn("An error occurred while attempting to formulate and send a response to an incoming INVITE. However a CANCEL was received and processed while doing so which can (and often does) result in errors occurring as the session terminates in the meantime. Said error is being ignored.")},t.prototype.onAckTimeout=function(){if(this.logger.log("Invitation.onAckTimeout"),!this.dialog)throw new Error("Dialog undefined.");this.logger.log("No ACK received for an extended period of time, terminating session"),this.dialog.bye(),this.stateTransition(Ne.Terminated)},t.prototype.sendAccept=function(e){var t=this;void 0===e&&(e={});var n={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers},r=e.extraHeaders||[];return this.waitingForPrack?this.waitForArrivalOfPrack().then((function(){return clearTimeout(t.userNoAnswerTimer)})).then((function(){return t.generateResponseOfferAnswer(t.incomingInviteRequest,n)})).then((function(e){return t.incomingInviteRequest.accept({statusCode:200,body:e,extraHeaders:r})})):(clearTimeout(this.userNoAnswerTimer),this.generateResponseOfferAnswer(this.incomingInviteRequest,n).then((function(e){return t.incomingInviteRequest.accept({statusCode:200,body:e,extraHeaders:r})})))},t.prototype.sendProgress=function(e){void 0===e&&(e={});var t=e.statusCode||180,n=e.reasonPhrase,r=(e.extraHeaders||[]).slice(),o=e.body?_(e.body):void 0;if(183===t&&!o)return this.sendProgressWithSDP(e);try{var i=this.incomingInviteRequest.progress({statusCode:t,reasonPhrase:n,extraHeaders:r,body:o});return this._dialog=i.session,Promise.resolve(i)}catch(s){return Promise.reject(s)}},t.prototype.sendProgressWithSDP=function(e){var t=this;void 0===e&&(e={});var n={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers},r=e.statusCode||183,o=e.reasonPhrase,i=(e.extraHeaders||[]).slice();return this.generateResponseOfferAnswer(this.incomingInviteRequest,n).then((function(e){return t.incomingInviteRequest.progress({statusCode:r,reasonPhrase:o,extraHeaders:i,body:e})})).then((function(e){return t._dialog=e.session,e}))},t.prototype.sendProgressReliable=function(e){return void 0===e&&(e={}),e.extraHeaders=(e.extraHeaders||[]).slice(),e.extraHeaders.push("Require: 100rel"),e.extraHeaders.push("RSeq: "+Math.floor(1e4*Math.random())),this.sendProgressWithSDP(e)},t.prototype.sendProgressReliableWaitForPrack=function(e){var t=this;void 0===e&&(e={});var n,r={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers},o=e.statusCode||183,i=e.reasonPhrase,s=(e.extraHeaders||[]).slice();return s.push("Require: 100rel"),s.push("RSeq: "+this.rseq++),new Promise((function(e,a){t.waitingForPrack=!0,t.generateResponseOfferAnswer(t.incomingInviteRequest,r).then((function(e){return n=e,t.incomingInviteRequest.progress({statusCode:o,reasonPhrase:i,extraHeaders:s,body:n})})).then((function(r){var c,l;t._dialog=r.session,r.session.delegate={onPrack:function(n){c=n,clearTimeout(d),clearTimeout(f),t.waitingForPrack&&(t.waitingForPrack=!1,t.handlePrackOfferAnswer(c).then((function(n){try{l=c.accept({statusCode:200,body:n}),t.prackArrived(),e({prackRequest:c,prackResponse:l,progressResponse:r})}catch(o){a(o)}})).catch((function(e){return a(e)})))}};var u=function(){t.waitingForPrack&&(t.waitingForPrack=!1,t.logger.warn("No PRACK received, rejecting INVITE."),clearTimeout(f),t.reject({statusCode:504}).then((function(){return a(new qe)})).catch((function(e){return a(e)})))},d=setTimeout(u,64*U.T1),p=function(){try{t.incomingInviteRequest.progress({statusCode:o,reasonPhrase:i,extraHeaders:s,body:n})}catch(e){return t.waitingForPrack=!1,void a(e)}f=setTimeout(p,h*=2)},h=U.T1,f=setTimeout(p,h)})).catch((function(e){t.waitingForPrack=!1,a(e)}))}))},t.prototype.sendProgressTrying=function(){try{var e=this.incomingInviteRequest.trying();return Promise.resolve(e)}catch(t){return Promise.reject(t)}},t.prototype.waitForArrivalOfPrack=function(){var e=this;if(this.waitingForPrackPromise)throw new Error("Already waiting for PRACK");return this.waitingForPrackPromise=new Promise((function(t,n){e.waitingForPrackResolve=t,e.waitingForPrackReject=n})),this.waitingForPrackPromise},t.prototype.prackArrived=function(){this.waitingForPrackResolve&&this.waitingForPrackResolve(),this.waitingForPrackPromise=void 0,this.waitingForPrackResolve=void 0,this.waitingForPrackReject=void 0},t.prototype.prackNeverArrived=function(){this.waitingForPrackReject&&this.waitingForPrackReject(new qe),this.waitingForPrackPromise=void 0,this.waitingForPrackResolve=void 0,this.waitingForPrackReject=void 0},t}(Je),tt=function(e){function t(t,n,r){void 0===r&&(r={});var o=e.call(this,t,r)||this;o.disposed=!1,o.earlyMedia=!1,o.earlyMediaSessionDescriptionHandlers=new Map,o.isCanceled=!1,o.inviteWithoutSdp=!1,o.logger=t.getLogger("sip.Inviter"),o.earlyMedia=void 0!==r.earlyMedia?r.earlyMedia:o.earlyMedia,o.fromTag=S(),o.inviteWithoutSdp=void 0!==r.inviteWithoutSdp?r.inviteWithoutSdp:o.inviteWithoutSdp;var s=i({},r);s.params=i({},r.params);var a=r.anonymous||!1,c=t.contact.toString({anonymous:a,outbound:a?!t.contact.tempGruu:!t.contact.pubGruu});a&&t.configuration.uri&&(s.params.fromDisplayName="Anonymous",s.params.fromUri="sip:anonymous@anonymous.invalid");var l=t.userAgentCore.configuration.aor;if(s.params.fromUri&&(l="string"===typeof s.params.fromUri?g.URIParse(s.params.fromUri):s.params.fromUri),!l)throw new TypeError("Invalid from URI: "+s.params.fromUri);var u=n;if(s.params.toUri&&(u="string"===typeof s.params.toUri?g.URIParse(s.params.toUri):s.params.toUri),!u)throw new TypeError("Invalid to URI: "+s.params.toUri);var d=i({},s.params);d.fromTag=o.fromTag;var p=(s.extraHeaders||[]).slice();a&&t.configuration.uri&&(p.push("P-Preferred-Identity: "+t.configuration.uri.toString()),p.push("Privacy: id")),p.push("Contact: "+c),p.push("Allow: "+["ACK","CANCEL","INVITE","MESSAGE","BYE","OPTIONS","INFO","NOTIFY","REFER"].toString()),t.configuration.sipExtension100rel===Ye.Required&&p.push("Require: 100rel"),t.configuration.sipExtensionReplaces===Ye.Required&&p.push("Require: replaces"),s.extraHeaders=p;var h=void 0;return o.outgoingRequestMessage=t.userAgentCore.makeOutgoingRequestMessage(m.INVITE,n,l,u,d,p,h),o._contact=c,o._referralInviterOptions=s,o._renderbody=r.renderbody,o._rendertype=r.rendertype,r.sessionDescriptionHandlerModifiers&&(o.sessionDescriptionHandlerModifiers=r.sessionDescriptionHandlerModifiers),r.sessionDescriptionHandlerOptions&&(o.sessionDescriptionHandlerOptions=r.sessionDescriptionHandlerOptions),r.sessionDescriptionHandlerModifiersReInvite&&(o.sessionDescriptionHandlerModifiersReInvite=r.sessionDescriptionHandlerModifiersReInvite),r.sessionDescriptionHandlerOptionsReInvite&&(o.sessionDescriptionHandlerOptionsReInvite=r.sessionDescriptionHandlerOptionsReInvite),o._id=o.outgoingRequestMessage.callId+o.fromTag,o.userAgent._sessions[o._id]=o,o}return o(t,e),t.prototype.dispose=function(){var t=this;if(this.disposed)return Promise.resolve();switch(this.disposed=!0,this.disposeEarlyMedia(),this.state){case Ne.Initial:return this.cancel().then((function(){return e.prototype.dispose.call(t)}));case Ne.Establishing:return this.cancel().then((function(){return e.prototype.dispose.call(t)}));case Ne.Established:return e.prototype.dispose.call(this);case Ne.Terminating:return e.prototype.dispose.call(this);case Ne.Terminated:return e.prototype.dispose.call(this);default:throw new Error("Unknown state.")}},Object.defineProperty(t.prototype,"body",{get:function(){return this.outgoingRequestMessage.body},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localIdentity",{get:function(){return this.outgoingRequestMessage.from},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"remoteIdentity",{get:function(){return this.outgoingRequestMessage.to},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"request",{get:function(){return this.outgoingRequestMessage},enumerable:!1,configurable:!0}),t.prototype.cancel=function(e){if(void 0===e&&(e={}),this.logger.log("Inviter.cancel"),this.state!==Ne.Initial&&this.state!==Ne.Establishing){var t=new Error("Invalid session state ".concat(this.state));return this.logger.error(t.message),Promise.reject(t)}function n(e,t){if(e&&e<200||e>699)throw new TypeError("Invalid statusCode: "+e);if(e){var n=e,r=w(e)||t;return"SIP;cause="+n+';text="'+r+'"'}}if(this.isCanceled=!0,this.stateTransition(Ne.Terminating),this.outgoingInviteRequest){var r=void 0;e.statusCode&&e.reasonPhrase&&(r=n(e.statusCode,e.reasonPhrase)),this.outgoingInviteRequest.cancel(r,e)}else this.logger.warn("Canceled session before INVITE was sent"),this.stateTransition(Ne.Terminated);return Promise.resolve()},t.prototype.invite=function(t){var n=this;if(void 0===t&&(t={}),this.logger.log("Inviter.invite"),this.state!==Ne.Initial)return e.prototype.invite.call(this,t);if(t.sessionDescriptionHandlerModifiers&&(this.sessionDescriptionHandlerModifiers=t.sessionDescriptionHandlerModifiers),t.sessionDescriptionHandlerOptions&&(this.sessionDescriptionHandlerOptions=t.sessionDescriptionHandlerOptions),t.withoutSdp||this.inviteWithoutSdp)return this._renderbody&&this._rendertype&&(this.outgoingRequestMessage.body={contentType:this._rendertype,body:this._renderbody}),this.stateTransition(Ne.Establishing),Promise.resolve(this.sendInvite(t));var r={sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers,sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions};return this.getOffer(r).then((function(e){return n.outgoingRequestMessage.body={body:e.content,contentType:e.contentType},n.stateTransition(Ne.Establishing),n.sendInvite(t)})).catch((function(e){throw n.logger.log(e.message),n.stateTransition(Ne.Terminated),e}))},t.prototype.sendInvite=function(e){var t=this;return void 0===e&&(e={}),this.outgoingInviteRequest=this.userAgent.userAgentCore.invite(this.outgoingRequestMessage,{onAccept:function(n){return t.dialog?(t.logger.log("Additional confirmed dialog, sending ACK and BYE"),void t.ackAndBye(n)):t.isCanceled?(t.logger.log("Canceled session accepted, sending ACK and BYE"),t.ackAndBye(n),void t.stateTransition(Ne.Terminated)):(t.notifyReferer(n),void t.onAccept(n).then((function(){t.disposeEarlyMedia()})).catch((function(){t.disposeEarlyMedia()})).then((function(){e.requestDelegate&&e.requestDelegate.onAccept&&e.requestDelegate.onAccept(n)})))},onProgress:function(n){t.isCanceled||(t.notifyReferer(n),t.onProgress(n).catch((function(){t.disposeEarlyMedia()})).then((function(){e.requestDelegate&&e.requestDelegate.onProgress&&e.requestDelegate.onProgress(n)})))},onRedirect:function(n){t.notifyReferer(n),t.onRedirect(n),e.requestDelegate&&e.requestDelegate.onRedirect&&e.requestDelegate.onRedirect(n)},onReject:function(n){t.notifyReferer(n),t.onReject(n),e.requestDelegate&&e.requestDelegate.onReject&&e.requestDelegate.onReject(n)},onTrying:function(n){t.notifyReferer(n),t.onTrying(n),e.requestDelegate&&e.requestDelegate.onTrying&&e.requestDelegate.onTrying(n)}}),this.outgoingInviteRequest},t.prototype.disposeEarlyMedia=function(){this.earlyMediaSessionDescriptionHandlers.forEach((function(e){e.close()})),this.earlyMediaSessionDescriptionHandlers.clear()},t.prototype.notifyReferer=function(e){var t=this;if(this._referred){if(!(this._referred instanceof Je))throw new Error("Referred session not instance of session");if(this._referred.dialog){if(!e.message.statusCode)throw new Error("Status code undefined.");if(!e.message.reasonPhrase)throw new Error("Reason phrase undefined.");var n=e.message.statusCode,r=e.message.reasonPhrase,o="SIP/2.0 ".concat(n," ").concat(r).trim(),i=this._referred.dialog.notify(void 0,{extraHeaders:["Event: refer","Subscription-State: terminated"],body:{contentDisposition:"render",contentType:"message/sipfrag",content:o}});i.delegate={onReject:function(){t._referred=void 0}}}}},t.prototype.onAccept=function(e){var t=this;if(this.logger.log("Inviter.onAccept"),this.state!==Ne.Establishing)return this.logger.error("Accept received while in state ".concat(this.state,", dropping response")),Promise.reject(new Error("Invalid session state ".concat(this.state)));var n=e.message,r=e.session;switch(n.hasHeader("P-Asserted-Identity")&&(this._assertedIdentity=g.nameAddrHeaderParse(n.getHeader("P-Asserted-Identity"))),r.delegate={onAck:function(e){return t.onAckRequest(e)},onBye:function(e){return t.onByeRequest(e)},onInfo:function(e){return t.onInfoRequest(e)},onInvite:function(e){return t.onInviteRequest(e)},onMessage:function(e){return t.onMessageRequest(e)},onNotify:function(e){return t.onNotifyRequest(e)},onPrack:function(e){return t.onPrackRequest(e)},onRefer:function(e){return t.onReferRequest(e)}},this._dialog=r,r.signalingState){case M.Initial:return this.logger.error("Received 2xx response to INVITE without a session description"),this.ackAndBye(e,400,"Missing session description"),this.stateTransition(Ne.Terminated),Promise.reject(new Error("Bad Media Description"));case M.HaveLocalOffer:return this.logger.error("Received 2xx response to INVITE without a session description"),this.ackAndBye(e,400,"Missing session description"),this.stateTransition(Ne.Terminated),Promise.reject(new Error("Bad Media Description"));case M.HaveRemoteOffer:if(!this._dialog.offer)throw new Error("Session offer undefined in signaling state ".concat(this._dialog.signalingState,"."));var o={sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers,sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions};return this.setOfferAndGetAnswer(this._dialog.offer,o).then((function(n){e.ack({body:n}),t.stateTransition(Ne.Established)})).catch((function(n){throw t.ackAndBye(e,488,"Invalid session description"),t.stateTransition(Ne.Terminated),n}));case M.Stable:if(this.earlyMediaSessionDescriptionHandlers.size>0){var i=this.earlyMediaSessionDescriptionHandlers.get(r.id);if(!i)throw new Error("Session description handler undefined.");return this.setSessionDescriptionHandler(i),this.earlyMediaSessionDescriptionHandlers.delete(r.id),e.ack(),this.stateTransition(Ne.Established),Promise.resolve()}if(this.earlyMediaDialog){if(this.earlyMediaDialog!==r){if(this.earlyMedia){var s="You have set the 'earlyMedia' option to 'true' which requires that your INVITE requests do not fork and yet this INVITE request did in fact fork. Consequentially and not surprisingly the end point which accepted the INVITE (confirmed dialog) does not match the end point with which early media has been setup (early dialog) and thus this session is unable to proceed. In accordance with the SIP specifications, the SIP servers your end point is connected to determine if an INVITE forks and the forking behavior of those servers cannot be controlled by this library. If you wish to use early media with this library you must configure those servers accordingly. Alternatively you may set the 'earlyMedia' to 'false' which will allow this library to function with any INVITE requests which do fork.";this.logger.error(s)}var a=new Error("Early media dialog does not equal confirmed dialog, terminating session");return this.logger.error(a.message),this.ackAndBye(e,488,"Not Acceptable Here"),this.stateTransition(Ne.Terminated),Promise.reject(a)}return e.ack(),this.stateTransition(Ne.Established),Promise.resolve()}var c=r.answer;if(!c)throw new Error("Answer is undefined.");o={sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers,sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions};return this.setAnswer(c,o).then((function(){var n;t._renderbody&&t._rendertype&&(n={body:{contentDisposition:"render",contentType:t._rendertype,content:t._renderbody}}),e.ack(n),t.stateTransition(Ne.Established)})).catch((function(n){throw t.logger.error(n.message),t.ackAndBye(e,488,"Not Acceptable Here"),t.stateTransition(Ne.Terminated),n}));case M.Closed:return Promise.reject(new Error("Terminated."));default:throw new Error("Unknown session signaling state.")}},t.prototype.onProgress=function(e){var t,n=this;if(this.logger.log("Inviter.onProgress"),this.state!==Ne.Establishing)return this.logger.error("Progress received while in state ".concat(this.state,", dropping response")),Promise.reject(new Error("Invalid session state ".concat(this.state)));if(!this.outgoingInviteRequest)throw new Error("Outgoing INVITE request undefined.");var r=e.message,o=e.session;r.hasHeader("P-Asserted-Identity")&&(this._assertedIdentity=g.nameAddrHeaderParse(r.getHeader("P-Asserted-Identity")));var i=r.getHeader("require"),s=r.getHeader("rseq"),a=i&&i.includes("100rel")&&s?Number(s):void 0,c=!!a,l=[];switch(c&&l.push("RAck: "+r.getHeader("rseq")+" "+r.getHeader("cseq")),o.signalingState){case M.Initial:return c&&(this.logger.warn("First reliable provisional response received MUST contain an offer when INVITE does not contain an offer."),e.prack({extraHeaders:l})),Promise.resolve();case M.HaveLocalOffer:return c&&e.prack({extraHeaders:l}),Promise.resolve();case M.HaveRemoteOffer:if(!c)return this.logger.warn("Non-reliable provisional response MUST NOT contain an initial offer, discarding response."),Promise.resolve();var u=this.sessionDescriptionHandlerFactory(this,this.userAgent.configuration.sessionDescriptionHandlerFactoryOptions||{});return(null===(t=this.delegate)||void 0===t?void 0:t.onSessionDescriptionHandler)&&this.delegate.onSessionDescriptionHandler(u,!0),this.earlyMediaSessionDescriptionHandlers.set(o.id,u),u.setDescription(r.body,this.sessionDescriptionHandlerOptions,this.sessionDescriptionHandlerModifiers).then((function(){return u.getDescription(n.sessionDescriptionHandlerOptions,n.sessionDescriptionHandlerModifiers)})).then((function(t){var n={contentDisposition:"session",contentType:t.contentType,content:t.body};e.prack({extraHeaders:l,body:n})})).catch((function(e){throw n.stateTransition(Ne.Terminated),e}));case M.Stable:if(c&&e.prack({extraHeaders:l}),this.earlyMedia&&!this.earlyMediaDialog){this.earlyMediaDialog=o;var d=o.answer;if(!d)throw new Error("Answer is undefined.");var p={sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers,sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions};return this.setAnswer(d,p).catch((function(e){throw n.stateTransition(Ne.Terminated),e}))}return Promise.resolve();case M.Closed:return Promise.reject(new Error("Terminated."));default:throw new Error("Unknown session signaling state.")}},t.prototype.onRedirect=function(e){this.logger.log("Inviter.onRedirect"),this.state===Ne.Establishing||this.state===Ne.Terminating?this.stateTransition(Ne.Terminated):this.logger.error("Redirect received while in state ".concat(this.state,", dropping response"))},t.prototype.onReject=function(e){this.logger.log("Inviter.onReject"),this.state===Ne.Establishing||this.state===Ne.Terminating?this.stateTransition(Ne.Terminated):this.logger.error("Reject received while in state ".concat(this.state,", dropping response"))},t.prototype.onTrying=function(e){this.logger.log("Inviter.onTrying"),this.state===Ne.Establishing||this.logger.error("Trying received while in state ".concat(this.state,", dropping response"))},t}(Je),nt=function(){function e(e,t,n,r,o){void 0===r&&(r="text/plain"),void 0===o&&(o={}),this.logger=e.getLogger("sip.Messager"),o.params=o.params||{};var s=e.userAgentCore.configuration.aor;if(o.params.fromUri&&(s="string"===typeof o.params.fromUri?g.URIParse(o.params.fromUri):o.params.fromUri),!s)throw new TypeError("Invalid from URI: "+o.params.fromUri);var a=t;if(o.params.toUri&&(a="string"===typeof o.params.toUri?g.URIParse(o.params.toUri):o.params.toUri),!a)throw new TypeError("Invalid to URI: "+o.params.toUri);var c=o.params?i({},o.params):{},l=(o.extraHeaders||[]).slice(),u="render",d={contentDisposition:u,contentType:r,content:n};this.request=e.userAgentCore.makeOutgoingRequestMessage(m.MESSAGE,t,s,a,c,l,d),this.userAgent=e}return e.prototype.message=function(e){return void 0===e&&(e={}),this.userAgent.userAgentCore.request(this.request,e.requestDelegate),Promise.resolve()},e}();(function(e){e["Initial"]="Initial",e["Published"]="Published",e["Unpublished"]="Unpublished",e["Terminated"]="Terminated"})(Ze||(Ze={})),function(){function e(e,t,n,r){void 0===r&&(r={}),this.disposed=!1,this._state=Ze.Initial,this._stateEventEmitter=new Ue,this.userAgent=e,r.extraHeaders=(r.extraHeaders||[]).slice(),r.contentType=r.contentType||"text/plain","number"!==typeof r.expires||r.expires%1!==0?r.expires=3600:r.expires=Number(r.expires),"boolean"!==typeof r.unpublishOnClose&&(r.unpublishOnClose=!0),this.target=t,this.event=n,this.options=r,this.pubRequestExpires=r.expires,this.logger=e.getLogger("sip.Publisher");var o,i=r.params||{},s=i.fromUri?i.fromUri:e.userAgentCore.configuration.aor,a=i.toUri?i.toUri:t;if(r.body&&r.contentType){var c="render",l=r.contentType,u=r.body;o={contentDisposition:c,contentType:l,content:u}}var d=(r.extraHeaders||[]).slice();this.request=e.userAgentCore.makeOutgoingRequestMessage(m.PUBLISH,t,s,a,i,d,o),this.id=this.target.toString()+":"+this.event,this.userAgent._publishers[this.id]=this}e.prototype.dispose=function(){return this.disposed?Promise.resolve():(this.disposed=!0,this.logger.log("Publisher ".concat(this.id," in state ").concat(this.state," is being disposed")),delete this.userAgent._publishers[this.id],this.options.unpublishOnClose&&this.state===Ze.Published?this.unpublish():(this.publishRefreshTimer&&(clearTimeout(this.publishRefreshTimer),this.publishRefreshTimer=void 0),this.pubRequestBody=void 0,this.pubRequestExpires=0,this.pubRequestEtag=void 0,Promise.resolve()))},Object.defineProperty(e.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stateChange",{get:function(){return this._stateEventEmitter},enumerable:!1,configurable:!0}),e.prototype.publish=function(e,t){if(this.publishRefreshTimer&&(clearTimeout(this.publishRefreshTimer),this.publishRefreshTimer=void 0),this.options.body=e,this.pubRequestBody=this.options.body,0===this.pubRequestExpires){if(void 0===this.options.expires)throw new Error("Expires undefined.");this.pubRequestExpires=this.options.expires,this.pubRequestEtag=void 0}return this.sendPublishRequest(),Promise.resolve()},e.prototype.unpublish=function(e){return this.publishRefreshTimer&&(clearTimeout(this.publishRefreshTimer),this.publishRefreshTimer=void 0),this.pubRequestBody=void 0,this.pubRequestExpires=0,void 0!==this.pubRequestEtag&&this.sendPublishRequest(),Promise.resolve()},e.prototype.receiveResponse=function(e){var t=this,n=e.statusCode||0;switch(!0){case/^1[0-9]{2}$/.test(n.toString()):break;case/^2[0-9]{2}$/.test(n.toString()):if(e.hasHeader("SIP-ETag")?this.pubRequestEtag=e.getHeader("SIP-ETag"):this.logger.warn("SIP-ETag header missing in a 200-class response to PUBLISH"),e.hasHeader("Expires")){var r=Number(e.getHeader("Expires"));"number"===typeof r&&r>=0&&r<=this.pubRequestExpires?this.pubRequestExpires=r:this.logger.warn("Bad Expires header in a 200-class response to PUBLISH")}else this.logger.warn("Expires header missing in a 200-class response to PUBLISH");0!==this.pubRequestExpires?(this.publishRefreshTimer=setTimeout((function(){return t.refreshRequest()}),900*this.pubRequestExpires),this._state!==Ze.Published&&this.stateTransition(Ze.Published)):this.stateTransition(Ze.Unpublished);break;case/^412$/.test(n.toString()):if(void 0!==this.pubRequestEtag&&0!==this.pubRequestExpires){if(this.logger.warn("412 response to PUBLISH, recovering"),this.pubRequestEtag=void 0,void 0===this.options.body)throw new Error("Body undefined.");this.publish(this.options.body)}else this.logger.warn("412 response to PUBLISH, recovery failed"),this.pubRequestExpires=0,this.stateTransition(Ze.Unpublished),this.stateTransition(Ze.Terminated);break;case/^423$/.test(n.toString()):if(0!==this.pubRequestExpires&&e.hasHeader("Min-Expires")){var o=Number(e.getHeader("Min-Expires"));if("number"===typeof o||o>this.pubRequestExpires){if(this.logger.warn("423 code in response to PUBLISH, adjusting the Expires value and trying to recover"),this.pubRequestExpires=o,void 0===this.options.body)throw new Error("Body undefined.");this.publish(this.options.body)}else this.logger.warn("Bad 423 response Min-Expires header received for PUBLISH"),this.pubRequestExpires=0,this.stateTransition(Ze.Unpublished),this.stateTransition(Ze.Terminated)}else this.logger.warn("423 response to PUBLISH, recovery failed"),this.pubRequestExpires=0,this.stateTransition(Ze.Unpublished),this.stateTransition(Ze.Terminated);break;default:this.pubRequestExpires=0,this.stateTransition(Ze.Unpublished),this.stateTransition(Ze.Terminated);break}0===this.pubRequestExpires&&(this.publishRefreshTimer&&(clearTimeout(this.publishRefreshTimer),this.publishRefreshTimer=void 0),this.pubRequestBody=void 0,this.pubRequestEtag=void 0)},e.prototype.send=function(){var e=this;return this.userAgent.userAgentCore.publish(this.request,{onAccept:function(t){return e.receiveResponse(t.message)},onProgress:function(t){return e.receiveResponse(t.message)},onRedirect:function(t){return e.receiveResponse(t.message)},onReject:function(t){return e.receiveResponse(t.message)},onTrying:function(t){return e.receiveResponse(t.message)}})},e.prototype.refreshRequest=function(){if(this.publishRefreshTimer&&(clearTimeout(this.publishRefreshTimer),this.publishRefreshTimer=void 0),this.pubRequestBody=void 0,void 0===this.pubRequestEtag)throw new Error("Etag undefined");if(0===this.pubRequestExpires)throw new Error("Expires zero");this.sendPublishRequest()},e.prototype.sendPublishRequest=function(){var e=i({},this.options);e.extraHeaders=(this.options.extraHeaders||[]).slice(),e.extraHeaders.push("Event: "+this.event),e.extraHeaders.push("Expires: "+this.pubRequestExpires),void 0!==this.pubRequestEtag&&e.extraHeaders.push("SIP-If-Match: "+this.pubRequestEtag);var t,n,r=this.target,o=this.options.params||{};if(void 0!==this.pubRequestBody){if(void 0===this.options.contentType)throw new Error("Content type undefined.");t={body:this.pubRequestBody,contentType:this.options.contentType}}return t&&(n=_(t)),this.request=this.userAgent.userAgentCore.makeOutgoingRequestMessage(m.PUBLISH,r,o.fromUri?o.fromUri:this.userAgent.userAgentCore.configuration.aor,o.toUri?o.toUri:this.target,o,e.extraHeaders,n),this.send()},e.prototype.stateTransition=function(e){var t=this,n=function(){throw new Error("Invalid state transition from ".concat(t._state," to ").concat(e))};switch(this._state){case Ze.Initial:e!==Ze.Published&&e!==Ze.Unpublished&&e!==Ze.Terminated&&n();break;case Ze.Published:e!==Ze.Unpublished&&e!==Ze.Terminated&&n();break;case Ze.Unpublished:e!==Ze.Published&&e!==Ze.Terminated&&n();break;case Ze.Terminated:n();break;default:throw new Error("Unrecognized state.")}this._state=e,this.logger.log("Publication transitioned to state ".concat(this._state)),this._stateEventEmitter.emit(this._state),e===Ze.Terminated&&this.dispose()}}(),function(e){e["Initial"]="Initial",e["Registered"]="Registered",e["Unregistered"]="Unregistered",e["Terminated"]="Terminated"}(Xe||(Xe={}));var rt,ot=function(){function e(t,n){var r=this;void 0===n&&(n={}),this.disposed=!1,this._contacts=[],this._retryAfter=void 0,this._state=Xe.Initial,this._waiting=!1,this._stateEventEmitter=new Ue,this._waitingEventEmitter=new Ue,this.userAgent=t;var o=t.configuration.uri.clone();if(o.user=void 0,this.options=i(i(i({},e.defaultOptions()),{registrar:o}),e.stripUndefinedProperties(n)),this.options.extraContactHeaderParams=(this.options.extraContactHeaderParams||[]).slice(),this.options.extraHeaders=(this.options.extraHeaders||[]).slice(),!this.options.registrar)throw new Error("Registrar undefined.");if(this.options.registrar=this.options.registrar.clone(),this.options.regId&&!this.options.instanceId?this.options.instanceId=e.newUUID():!this.options.regId&&this.options.instanceId&&(this.options.regId=1),this.options.instanceId&&-1===g.parse(this.options.instanceId,"uuid"))throw new Error("Invalid instanceId.");if(this.options.regId&&this.options.regId<0)throw new Error("Invalid regId.");var s=this.options.registrar,a=this.options.params&&this.options.params.fromUri||t.userAgentCore.configuration.aor,c=this.options.params&&this.options.params.toUri||t.configuration.uri,l=this.options.params||{},u=(n.extraHeaders||[]).slice();if(this.request=t.userAgentCore.makeOutgoingRequestMessage(m.REGISTER,s,a,c,l,u,void 0),this.expires=this.options.expires||e.defaultExpires,this.expires<0)throw new Error("Invalid expires.");if(this.refreshFrequency=this.options.refreshFrequency||e.defaultRefreshFrequency,this.refreshFrequency<50||this.refreshFrequency>99)throw new Error("Invalid refresh frequency. The value represents a percentage of the expiration time and should be between 50 and 99.");this.logger=t.getLogger("sip.Registerer"),this.options.logConfiguration&&(this.logger.log("Configuration:"),Object.keys(this.options).forEach((function(e){var t=r.options[e];switch(e){case"registrar":r.logger.log("· "+e+": "+t);break;default:r.logger.log("· "+e+": "+JSON.stringify(t))}}))),this.id=this.request.callId+this.request.from.parameters.tag,this.userAgent._registerers[this.id]=this}return e.defaultOptions=function(){return{expires:e.defaultExpires,extraContactHeaderParams:[],extraHeaders:[],logConfiguration:!0,instanceId:"",params:{},regId:0,registrar:new d("sip","anonymous","anonymous.invalid"),refreshFrequency:e.defaultRefreshFrequency}},e.newUUID=function(){var e="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=Math.floor(16*Math.random()),n="x"===e?t:t%4+8;return n.toString(16)}));return e},e.stripUndefinedProperties=function(e){return Object.keys(e).reduce((function(t,n){return void 0!==e[n]&&(t[n]=e[n]),t}),{})},Object.defineProperty(e.prototype,"contacts",{get:function(){return this._contacts.slice()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"retryAfter",{get:function(){return this._retryAfter},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stateChange",{get:function(){return this._stateEventEmitter},enumerable:!1,configurable:!0}),e.prototype.dispose=function(){var e=this;return this.disposed?Promise.resolve():(this.disposed=!0,this.logger.log("Registerer ".concat(this.id," in state ").concat(this.state," is being disposed")),delete this.userAgent._registerers[this.id],new Promise((function(t){var n=function(){if(!e.waiting&&e._state===Xe.Registered)return e.stateChange.addListener((function(){e.terminated(),t()}),{once:!0}),void e.unregister();e.terminated(),t()};e.waiting?e.waitingChange.addListener((function(){n()}),{once:!0}):n()})))},e.prototype.register=function(e){var t=this;if(void 0===e&&(e={}),this.state===Xe.Terminated)throw this.stateError(),new Error("Registerer terminated. Unable to register.");if(this.disposed)throw this.stateError(),new Error("Registerer disposed. Unable to register.");if(this.waiting){this.waitingWarning();var n=new Me("REGISTER request already in progress, waiting for final response");return Promise.reject(n)}e.requestOptions&&(this.options=i(i({},this.options),e.requestOptions));var r=(this.options.extraHeaders||[]).slice();r.push("Contact: "+this.generateContactHeader(this.expires)),r.push("Allow: "+["ACK","CANCEL","INVITE","MESSAGE","BYE","OPTIONS","INFO","NOTIFY","REFER"].toString()),this.request.cseq++,this.request.setHeader("cseq",this.request.cseq+" REGISTER"),this.request.extraHeaders=r,this.waitingToggle(!0);var o=this.userAgent.userAgentCore.register(this.request,{onAccept:function(n){var r;n.message.hasHeader("expires")&&(r=Number(n.message.getHeader("expires"))),t._contacts=n.message.getHeaders("contact");var o,i=t._contacts.length;if(!i)return t.logger.error("No Contact header in response to REGISTER, dropping response."),void t.unregistered();while(i--){if(o=n.message.parseHeader("contact",i),!o)throw new Error("Contact undefined");if(t.userAgent.contact.pubGruu&&p(o.uri,t.userAgent.contact.pubGruu)){r=Number(o.getParam("expires"));break}if(""===t.userAgent.configuration.contactName){if(o.uri.user===t.userAgent.contact.uri.user){r=Number(o.getParam("expires"));break}}else if(p(o.uri,t.userAgent.contact.uri)){r=Number(o.getParam("expires"));break}o=void 0}if(void 0===o)return t.logger.error("No Contact header pointing to us, dropping response"),t.unregistered(),void t.waitingToggle(!1);if(void 0===r)return t.logger.error("Contact pointing to us is missing expires parameter, dropping response"),t.unregistered(),void t.waitingToggle(!1);if(o.hasParam("temp-gruu")){var s=o.getParam("temp-gruu");s&&(t.userAgent.contact.tempGruu=g.URIParse(s.replace(/"/g,"")))}if(o.hasParam("pub-gruu")){s=o.getParam("pub-gruu");s&&(t.userAgent.contact.pubGruu=g.URIParse(s.replace(/"/g,"")))}t.registered(r),e.requestDelegate&&e.requestDelegate.onAccept&&e.requestDelegate.onAccept(n),t.waitingToggle(!1)},onProgress:function(t){e.requestDelegate&&e.requestDelegate.onProgress&&e.requestDelegate.onProgress(t)},onRedirect:function(n){t.logger.error("Redirect received. Not supported."),t.unregistered(),e.requestDelegate&&e.requestDelegate.onRedirect&&e.requestDelegate.onRedirect(n),t.waitingToggle(!1)},onReject:function(n){if(423===n.message.statusCode)return n.message.hasHeader("min-expires")?(t.expires=Number(n.message.getHeader("min-expires")),t.waitingToggle(!1),void t.register()):(t.logger.error("423 response received for REGISTER without Min-Expires, dropping response"),t.unregistered(),void t.waitingToggle(!1));t.logger.warn("Failed to register, status code ".concat(n.message.statusCode));var r=NaN;if(500===n.message.statusCode||503===n.message.statusCode){var o=n.message.getHeader("retry-after");o&&(r=Number.parseInt(o,void 0))}t._retryAfter=isNaN(r)?void 0:r,t.unregistered(),e.requestDelegate&&e.requestDelegate.onReject&&e.requestDelegate.onReject(n),t._retryAfter=void 0,t.waitingToggle(!1)},onTrying:function(t){e.requestDelegate&&e.requestDelegate.onTrying&&e.requestDelegate.onTrying(t)}});return Promise.resolve(o)},e.prototype.unregister=function(e){var t=this;if(void 0===e&&(e={}),this.state===Xe.Terminated)throw this.stateError(),new Error("Registerer terminated. Unable to register.");if(this.disposed&&this.state!==Xe.Registered)throw this.stateError(),new Error("Registerer disposed. Unable to register.");if(this.waiting){this.waitingWarning();var n=new Me("REGISTER request already in progress, waiting for final response");return Promise.reject(n)}this._state===Xe.Registered||e.all||this.logger.warn("Not currently registered, but sending an unregister anyway.");var r=(e.requestOptions&&e.requestOptions.extraHeaders||[]).slice();this.request.extraHeaders=r,e.all?(r.push("Contact: *"),r.push("Expires: 0")):r.push("Contact: "+this.generateContactHeader(0)),this.request.cseq++,this.request.setHeader("cseq",this.request.cseq+" REGISTER"),void 0!==this.registrationTimer&&(clearTimeout(this.registrationTimer),this.registrationTimer=void 0),this.waitingToggle(!0);var o=this.userAgent.userAgentCore.register(this.request,{onAccept:function(n){t._contacts=n.message.getHeaders("contact"),t.unregistered(),e.requestDelegate&&e.requestDelegate.onAccept&&e.requestDelegate.onAccept(n),t.waitingToggle(!1)},onProgress:function(t){e.requestDelegate&&e.requestDelegate.onProgress&&e.requestDelegate.onProgress(t)},onRedirect:function(n){t.logger.error("Unregister redirected. Not currently supported."),t.unregistered(),e.requestDelegate&&e.requestDelegate.onRedirect&&e.requestDelegate.onRedirect(n),t.waitingToggle(!1)},onReject:function(n){t.logger.error("Unregister rejected with status code ".concat(n.message.statusCode)),t.unregistered(),e.requestDelegate&&e.requestDelegate.onReject&&e.requestDelegate.onReject(n),t.waitingToggle(!1)},onTrying:function(t){e.requestDelegate&&e.requestDelegate.onTrying&&e.requestDelegate.onTrying(t)}});return Promise.resolve(o)},e.prototype.clearTimers=function(){void 0!==this.registrationTimer&&(clearTimeout(this.registrationTimer),this.registrationTimer=void 0),void 0!==this.registrationExpiredTimer&&(clearTimeout(this.registrationExpiredTimer),this.registrationExpiredTimer=void 0)},e.prototype.generateContactHeader=function(e){var t=this.userAgent.contact.toString();return this.options.regId&&this.options.instanceId&&(t+=";reg-id="+this.options.regId,t+=';+sip.instance="<urn:uuid:'+this.options.instanceId+'>"'),this.options.extraContactHeaderParams&&this.options.extraContactHeaderParams.forEach((function(e){t+=";"+e})),t+=";expires="+e,t},e.prototype.registered=function(e){var t=this;this.clearTimers(),this.registrationTimer=setTimeout((function(){t.registrationTimer=void 0,t.register()}),this.refreshFrequency/100*e*1e3),this.registrationExpiredTimer=setTimeout((function(){t.logger.warn("Registration expired"),t.unregistered()}),1e3*e),this._state!==Xe.Registered&&this.stateTransition(Xe.Registered)},e.prototype.unregistered=function(){this.clearTimers(),this._state!==Xe.Unregistered&&this.stateTransition(Xe.Unregistered)},e.prototype.terminated=function(){this.clearTimers(),this._state!==Xe.Terminated&&this.stateTransition(Xe.Terminated)},e.prototype.stateTransition=function(e){var t=this,n=function(){throw new Error("Invalid state transition from ".concat(t._state," to ").concat(e))};switch(this._state){case Xe.Initial:e!==Xe.Registered&&e!==Xe.Unregistered&&e!==Xe.Terminated&&n();break;case Xe.Registered:e!==Xe.Unregistered&&e!==Xe.Terminated&&n();break;case Xe.Unregistered:e!==Xe.Registered&&e!==Xe.Terminated&&n();break;case Xe.Terminated:n();break;default:throw new Error("Unrecognized state.")}this._state=e,this.logger.log("Registration transitioned to state ".concat(this._state)),this._stateEventEmitter.emit(this._state),e===Xe.Terminated&&this.dispose()},Object.defineProperty(e.prototype,"waiting",{get:function(){return this._waiting},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"waitingChange",{get:function(){return this._waitingEventEmitter},enumerable:!1,configurable:!0}),e.prototype.waitingToggle=function(e){if(this._waiting===e)throw new Error("Invalid waiting transition from ".concat(this._waiting," to ").concat(e));this._waiting=e,this.logger.log("Waiting toggled to ".concat(this._waiting)),this._waitingEventEmitter.emit(this._waiting)},e.prototype.waitingWarning=function(){var e="An attempt was made to send a REGISTER request while a prior one was still in progress.";e+=" RFC 3261 requires UAs MUST NOT send a new registration until they have received a final response",e+=" from the registrar for the previous one or the previous REGISTER request has timed out.",e+=" Note that if the transport disconnects, you still must wait for the prior request to time out before",e+=" sending a new REGISTER request or alternatively dispose of the current Registerer and create a new Registerer.",this.logger.warn(e)},e.prototype.stateError=function(){var e=this.state===Xe.Terminated?"is in 'Terminated' state":"has been disposed",t="An attempt was made to send a REGISTER request when the Registerer ".concat(e,".");t+=" The Registerer transitions to 'Terminated' when Registerer.dispose() is called.",t+=" Perhaps you called UserAgent.stop() which dipsoses of all Registerers?",this.logger.error(t)},e.defaultExpires=600,e.defaultRefreshFrequency=99,e}();(function(e){e["Initial"]="Initial",e["NotifyWait"]="NotifyWait",e["Subscribed"]="Subscribed",e["Terminated"]="Terminated"})(rt||(rt={}));var it=function(){function e(e,t){void 0===t&&(t={}),this._disposed=!1,this._state=rt.Initial,this._logger=e.getLogger("sip.Subscription"),this._stateEventEmitter=new Ue,this._userAgent=e,this.delegate=t.delegate}return e.prototype.dispose=function(){return this._disposed||(this._disposed=!0,this._stateEventEmitter.removeAllListeners()),Promise.resolve()},Object.defineProperty(e.prototype,"dialog",{get:function(){return this._dialog},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"disposed",{get:function(){return this._disposed},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stateChange",{get:function(){return this._stateEventEmitter},enumerable:!1,configurable:!0}),e.prototype.stateTransition=function(e){var t=this,n=function(){throw new Error("Invalid state transition from ".concat(t._state," to ").concat(e))};switch(this._state){case rt.Initial:e!==rt.NotifyWait&&e!==rt.Terminated&&n();break;case rt.NotifyWait:e!==rt.Subscribed&&e!==rt.Terminated&&n();break;case rt.Subscribed:e!==rt.Terminated&&n();break;case rt.Terminated:n();break;default:throw new Error("Unrecognized state.")}this._state!==e&&(this._state=e,this._logger.log("Subscription ".concat(this._dialog?this._dialog.id:void 0," transitioned to ").concat(this._state)),this._stateEventEmitter.emit(this._state),e===rt.Terminated&&this.dispose())},e}();(function(e){function t(t,n,r,o){void 0===o&&(o={});var i=e.call(this,t,o)||this;return i.body=void 0,i.logger=t.getLogger("sip.Subscriber"),o.body&&(i.body={body:o.body,contentType:o.contentType?o.contentType:"application/sdp"}),i.targetURI=n,i.event=r,void 0===o.expires?i.expires=3600:"number"!==typeof o.expires?(i.logger.warn('Option "expires" must be a number. Using default of 3600.'),i.expires=3600):i.expires=o.expires,i.extraHeaders=(o.extraHeaders||[]).slice(),i.subscriberRequest=i.initSubscriberRequest(),i.outgoingRequestMessage=i.subscriberRequest.message,i.id=i.outgoingRequestMessage.callId+i.outgoingRequestMessage.from.parameters.tag+i.event,i._userAgent._subscriptions[i.id]=i,i}o(t,e),t.prototype.dispose=function(){var t=this;return this.disposed?Promise.resolve():(this.logger.log("Subscription ".concat(this.id," in state ").concat(this.state," is being disposed")),delete this._userAgent._subscriptions[this.id],this.retryAfterTimer&&(clearTimeout(this.retryAfterTimer),this.retryAfterTimer=void 0),this.subscriberRequest.dispose(),e.prototype.dispose.call(this).then((function(){if(t.state===rt.Subscribed){if(!t._dialog)throw new Error("Dialog undefined.");if(t._dialog.subscriptionState===ye.Pending||t._dialog.subscriptionState===ye.Active){var e=t._dialog;return new Promise((function(t,n){e.delegate={onTerminated:function(){return t()}},e.unsubscribe()}))}}})))},t.prototype.subscribe=function(e){var t=this;switch(this.subscriberRequest.state){case ye.Initial:this.state===rt.Initial&&this.stateTransition(rt.NotifyWait),this.subscriberRequest.subscribe().then((function(e){e.success?(e.success.subscription&&(t._dialog=e.success.subscription,t._dialog.delegate={onNotify:function(e){return t.onNotify(e)},onRefresh:function(e){return t.onRefresh(e)},onTerminated:function(){t.state!==rt.Terminated&&t.stateTransition(rt.Terminated)}}),t.onNotify(e.success.request)):e.failure&&t.unsubscribe()}));break;case ye.NotifyWait:break;case ye.Pending:break;case ye.Active:if(this._dialog){var n=this._dialog.refresh();n.delegate={onAccept:function(e){return t.onAccepted(e)},onRedirect:function(e){return t.unsubscribe()},onReject:function(e){return t.unsubscribe()}}}break;case ye.Terminated:break}return Promise.resolve()},t.prototype.unsubscribe=function(e){if(this.disposed)return Promise.resolve();switch(this.subscriberRequest.state){case ye.Initial:break;case ye.NotifyWait:break;case ye.Pending:this._dialog&&this._dialog.unsubscribe();break;case ye.Active:this._dialog&&this._dialog.unsubscribe();break;case ye.Terminated:break;default:throw new Error("Unknown state.")}return this.stateTransition(rt.Terminated),Promise.resolve()},t.prototype._refresh=function(){return this.subscriberRequest.state===ye.Active?this.subscribe():Promise.resolve()},t.prototype.onAccepted=function(e){},t.prototype.onNotify=function(e){var t=this;if(this.disposed)e.accept();else{if(this.state!==rt.Subscribed&&this.stateTransition(rt.Subscribed),this.delegate&&this.delegate.onNotify){var n=new We(e);this.delegate.onNotify(n)}else e.accept();var r=e.message.parseHeader("Subscription-State");if(r&&r.state)switch(r.state){case"terminated":if(r.reason)switch(this.logger.log("Terminated subscription with reason ".concat(r.reason)),r.reason){case"deactivated":case"timeout":return this.initSubscriberRequest(),void this.subscribe();case"probation":case"giveup":return this.initSubscriberRequest(),void(r.params&&r.params["retry-after"]?this.retryAfterTimer=setTimeout((function(){t.subscribe()}),r.params["retry-after"]):this.subscribe())}this.unsubscribe();break}}},t.prototype.onRefresh=function(e){var t=this;e.delegate={onAccept:function(e){return t.onAccepted(e)}}},t.prototype.initSubscriberRequest=function(){var e=this,t={extraHeaders:this.extraHeaders,body:this.body?_(this.body):void 0};return this.subscriberRequest=new ct(this._userAgent.userAgentCore,this.targetURI,this.event,this.expires,t),this.subscriberRequest.delegate={onAccept:function(t){return e.onAccepted(t)}},this.subscriberRequest}})(it);var st,at,ct=function(){function e(e,t,n,r,o,i){this.core=e,this.target=t,this.event=n,this.expires=r,this.subscribed=!1,this.logger=e.loggerFactory.getLogger("sip.Subscriber"),this.delegate=i;var s="Allow: "+Te.toString(),a=(o&&o.extraHeaders||[]).slice();a.push(s),a.push("Event: "+this.event),a.push("Expires: "+this.expires),a.push("Contact: "+this.core.configuration.contact.toString());var c=o&&o.body;this.message=e.makeOutgoingRequestMessage(m.SUBSCRIBE,this.target,this.core.configuration.aor,this.target,{},a,c)}return e.prototype.dispose=function(){this.request&&(this.request.waitNotifyStop(),this.request.dispose(),this.request=void 0)},Object.defineProperty(e.prototype,"state",{get:function(){return this.subscription?this.subscription.subscriptionState:this.subscribed?ye.NotifyWait:ye.Initial},enumerable:!1,configurable:!0}),e.prototype.subscribe=function(){var e=this;return this.subscribed?Promise.reject(new Error("Not in initial state. Did you call subscribe more than once?")):(this.subscribed=!0,new Promise((function(t){if(!e.message)throw new Error("Message undefined.");e.request=e.core.subscribe(e.message,{onAccept:function(t){e.delegate&&e.delegate.onAccept&&e.delegate.onAccept(t)},onNotify:function(n){e.subscription=n.subscription,e.subscription&&(e.subscription.autoRefresh=!0),t({success:n})},onNotifyTimeout:function(){t({failure:{}})},onRedirect:function(e){t({failure:{response:e}})},onReject:function(e){t({failure:{response:e}})}})})))},e}();function lt(){return function(e){return e.audio||e.video?void 0===navigator.mediaDevices?Promise.reject(new Error("Media devices not available in insecure contexts.")):navigator.mediaDevices.getUserMedia.call(navigator.mediaDevices,e):Promise.resolve(new MediaStream)}}function ut(){var e={bundlePolicy:"balanced",certificates:void 0,iceCandidatePoolSize:0,iceServers:[{urls:"stun:stun.l.google.com:19302"}],iceTransportPolicy:"all",peerIdentity:void 0,rtcpMuxPolicy:"require"};return e}(function(e){e["Connecting"]="Connecting",e["Connected"]="Connected",e["Disconnecting"]="Disconnecting",e["Disconnected"]="Disconnected"})(st||(st={})),function(e){e["Started"]="Started",e["Stopped"]="Stopped"}(at||(at={}));var dt=function(){function e(e,t,n){e.debug("SessionDescriptionHandler.constructor"),this.logger=e,this.mediaStreamFactory=t,this.sessionDescriptionHandlerConfiguration=n,this._localMediaStream=new MediaStream,this._remoteMediaStream=new MediaStream,this._peerConnection=new RTCPeerConnection(null===n||void 0===n?void 0:n.peerConnectionConfiguration),this.initPeerConnectionEventHandlers()}return Object.defineProperty(e.prototype,"localMediaStream",{get:function(){return this._localMediaStream},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"remoteMediaStream",{get:function(){return this._remoteMediaStream},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"dataChannel",{get:function(){return this._dataChannel},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"peerConnection",{get:function(){return this._peerConnection},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"peerConnectionDelegate",{get:function(){return this._peerConnectionDelegate},set:function(e){this._peerConnectionDelegate=e},enumerable:!1,configurable:!0}),e.dispatchAddTrackEvent=function(e,t){e.dispatchEvent(new MediaStreamTrackEvent("addtrack",{track:t}))},e.dispatchRemoveTrackEvent=function(e,t){e.dispatchEvent(new MediaStreamTrackEvent("removetrack",{track:t}))},e.prototype.close=function(){this.logger.debug("SessionDescriptionHandler.close"),void 0!==this._peerConnection&&(this._peerConnection.getReceivers().forEach((function(e){e.track&&e.track.stop()})),this._peerConnection.getSenders().forEach((function(e){e.track&&e.track.stop()})),this._dataChannel&&this._dataChannel.close(),this._peerConnection.close(),this._peerConnection=void 0)},e.prototype.getDescription=function(e,t){var n,r,o=this;if(this.logger.debug("SessionDescriptionHandler.getDescription"),void 0===this._peerConnection)return Promise.reject(new Error("Peer connection closed."));this.onDataChannel=null===e||void 0===e?void 0:e.onDataChannel;var i=null===(n=null===e||void 0===e?void 0:e.offerOptions)||void 0===n?void 0:n.iceRestart,s=void 0===(null===e||void 0===e?void 0:e.iceGatheringTimeout)?null===(r=this.sessionDescriptionHandlerConfiguration)||void 0===r?void 0:r.iceGatheringTimeout:null===e||void 0===e?void 0:e.iceGatheringTimeout;return this.getLocalMediaStream(e).then((function(){return o.updateDirection(e)})).then((function(){return o.createDataChannel(e)})).then((function(){return o.createLocalOfferOrAnswer(e)})).then((function(e){return o.applyModifiers(e,t)})).then((function(e){return o.setLocalSessionDescription(e)})).then((function(){return o.waitForIceGatheringComplete(i,s)})).then((function(){return o.getLocalSessionDescription()})).then((function(e){return{body:e.sdp,contentType:"application/sdp"}})).catch((function(e){throw o.logger.error("SessionDescriptionHandler.getDescription failed - "+e),e}))},e.prototype.hasDescription=function(e){return this.logger.debug("SessionDescriptionHandler.hasDescription"),"application/sdp"===e},e.prototype.sendDtmf=function(e,t){if(this.logger.debug("SessionDescriptionHandler.sendDtmf"),void 0===this._peerConnection)return this.logger.error("SessionDescriptionHandler.sendDtmf failed - peer connection closed"),!1;var n=this._peerConnection.getSenders();if(0===n.length)return this.logger.error("SessionDescriptionHandler.sendDtmf failed - no senders"),!1;var r=n[0].dtmf;if(!r)return this.logger.error("SessionDescriptionHandler.sendDtmf failed - no DTMF sender"),!1;var o=null===t||void 0===t?void 0:t.duration,i=null===t||void 0===t?void 0:t.interToneGap;try{r.insertDTMF(e,o,i)}catch(s){return this.logger.error(s),!1}return this.logger.log("SessionDescriptionHandler.sendDtmf sent via RTP: "+e.toString()),!0},e.prototype.setDescription=function(e,t,n){var r=this;if(this.logger.debug("SessionDescriptionHandler.setDescription"),void 0===this._peerConnection)return Promise.reject(new Error("Peer connection closed."));this.onDataChannel=null===t||void 0===t?void 0:t.onDataChannel;var o="have-local-offer"===this._peerConnection.signalingState?"answer":"offer";return this.getLocalMediaStream(t).then((function(){return r.applyModifiers({sdp:e,type:o},n)})).then((function(e){return r.setRemoteSessionDescription(e)})).catch((function(e){throw r.logger.error("SessionDescriptionHandler.setDescription failed - "+e),e}))},e.prototype.applyModifiers=function(e,t){var n=this;return this.logger.debug("SessionDescriptionHandler.applyModifiers"),t&&0!==t.length?t.reduce((function(e,t){return e.then(t)}),Promise.resolve(e)).then((function(e){if(n.logger.debug("SessionDescriptionHandler.applyModifiers - modified sdp"),!e.sdp||!e.type)throw new Error("Invalid SDP.");return{sdp:e.sdp,type:e.type}})):Promise.resolve(e)},e.prototype.createDataChannel=function(e){if(void 0===this._peerConnection)return Promise.reject(new Error("Peer connection closed."));if(!0!==(null===e||void 0===e?void 0:e.dataChannel))return Promise.resolve();if(this._dataChannel)return Promise.resolve();switch(this._peerConnection.signalingState){case"stable":this.logger.debug("SessionDescriptionHandler.createDataChannel - creating data channel");try{return this._dataChannel=this._peerConnection.createDataChannel((null===e||void 0===e?void 0:e.dataChannelLabel)||"",null===e||void 0===e?void 0:e.dataChannelOptions),this.onDataChannel&&this.onDataChannel(this._dataChannel),Promise.resolve()}catch(t){return Promise.reject(t)}case"have-remote-offer":return Promise.resolve();case"have-local-offer":case"have-local-pranswer":case"have-remote-pranswer":case"closed":default:return Promise.reject(new Error("Invalid signaling state "+this._peerConnection.signalingState))}},e.prototype.createLocalOfferOrAnswer=function(e){if(void 0===this._peerConnection)return Promise.reject(new Error("Peer connection closed."));switch(this._peerConnection.signalingState){case"stable":return this.logger.debug("SessionDescriptionHandler.createLocalOfferOrAnswer - creating SDP offer"),this._peerConnection.createOffer(null===e||void 0===e?void 0:e.offerOptions);case"have-remote-offer":return this.logger.debug("SessionDescriptionHandler.createLocalOfferOrAnswer - creating SDP answer"),this._peerConnection.createAnswer(null===e||void 0===e?void 0:e.answerOptions);case"have-local-offer":case"have-local-pranswer":case"have-remote-pranswer":case"closed":default:return Promise.reject(new Error("Invalid signaling state "+this._peerConnection.signalingState))}},e.prototype.getLocalMediaStream=function(e){var t=this;if(this.logger.debug("SessionDescriptionHandler.getLocalMediaStream"),void 0===this._peerConnection)return Promise.reject(new Error("Peer connection closed."));var n=i({},null===e||void 0===e?void 0:e.constraints);if(this.localMediaStreamConstraints){if(n.audio=n.audio||this.localMediaStreamConstraints.audio,n.video=n.video||this.localMediaStreamConstraints.video,JSON.stringify(this.localMediaStreamConstraints.audio)===JSON.stringify(n.audio)&&JSON.stringify(this.localMediaStreamConstraints.video)===JSON.stringify(n.video))return Promise.resolve()}else void 0===n.audio&&void 0===n.video&&(n={audio:!0});return this.localMediaStreamConstraints=n,this.mediaStreamFactory(n,this).then((function(e){return t.setLocalMediaStream(e)}))},e.prototype.setLocalMediaStream=function(t){var n=this;if(this.logger.debug("SessionDescriptionHandler.setLocalMediaStream"),!this._peerConnection)throw new Error("Peer connection undefined.");var r=this._peerConnection,o=this._localMediaStream,i=[],s=function(t){var s=t.kind;if("audio"!==s&&"video"!==s)throw new Error("Unknown new track kind ".concat(s,"."));var a=r.getSenders().find((function(e){return e.track&&e.track.kind===s}));a?i.push(new Promise((function(e){n.logger.debug("SessionDescriptionHandler.setLocalMediaStream - replacing sender ".concat(s," track")),e()})).then((function(){return a.replaceTrack(t).then((function(){var n=o.getTracks().find((function(e){return e.kind===s}));n&&(n.stop(),o.removeTrack(n),e.dispatchRemoveTrackEvent(o,n)),o.addTrack(t),e.dispatchAddTrackEvent(o,t)})).catch((function(e){throw n.logger.error("SessionDescriptionHandler.setLocalMediaStream - failed to replace sender ".concat(s," track")),e}))}))):i.push(new Promise((function(e){n.logger.debug("SessionDescriptionHandler.setLocalMediaStream - adding sender ".concat(s," track")),e()})).then((function(){try{r.addTrack(t,o)}catch(i){throw n.logger.error("SessionDescriptionHandler.setLocalMediaStream - failed to add sender ".concat(s," track")),i}o.addTrack(t),e.dispatchAddTrackEvent(o,t)})))},a=t.getAudioTracks();a.length&&s(a[0]);var c=t.getVideoTracks();return c.length&&s(c[0]),i.reduce((function(e,t){return e.then((function(){return t}))}),Promise.resolve())},e.prototype.getLocalSessionDescription=function(){if(this.logger.debug("SessionDescriptionHandler.getLocalSessionDescription"),void 0===this._peerConnection)return Promise.reject(new Error("Peer connection closed."));var e=this._peerConnection.localDescription;return e?Promise.resolve(e):Promise.reject(new Error("Failed to get local session description"))},e.prototype.setLocalSessionDescription=function(e){return this.logger.debug("SessionDescriptionHandler.setLocalSessionDescription"),void 0===this._peerConnection?Promise.reject(new Error("Peer connection closed.")):this._peerConnection.setLocalDescription(e)},e.prototype.setRemoteSessionDescription=function(e){if(this.logger.debug("SessionDescriptionHandler.setRemoteSessionDescription"),void 0===this._peerConnection)return Promise.reject(new Error("Peer connection closed."));var t,n=e.sdp;switch(this._peerConnection.signalingState){case"stable":t="offer";break;case"have-local-offer":t="answer";break;case"have-local-pranswer":case"have-remote-offer":case"have-remote-pranswer":case"closed":default:return Promise.reject(new Error("Invalid signaling state "+this._peerConnection.signalingState))}return n?this._peerConnection.setRemoteDescription({sdp:n,type:t}):(this.logger.error("SessionDescriptionHandler.setRemoteSessionDescription failed - cannot set null sdp"),Promise.reject(new Error("SDP is undefined")))},e.prototype.setRemoteTrack=function(t){this.logger.debug("SessionDescriptionHandler.setRemoteTrack");var n=this._remoteMediaStream;n.getTrackById(t.id)?this.logger.debug("SessionDescriptionHandler.setRemoteTrack - have remote ".concat(t.kind," track")):"audio"===t.kind?(this.logger.debug("SessionDescriptionHandler.setRemoteTrack - adding remote ".concat(t.kind," track")),n.getAudioTracks().forEach((function(t){t.stop(),n.removeTrack(t),e.dispatchRemoveTrackEvent(n,t)})),n.addTrack(t),e.dispatchAddTrackEvent(n,t)):"video"===t.kind&&(this.logger.debug("SessionDescriptionHandler.setRemoteTrack - adding remote ".concat(t.kind," track")),n.getVideoTracks().forEach((function(t){t.stop(),n.removeTrack(t),e.dispatchRemoveTrackEvent(n,t)})),n.addTrack(t),e.dispatchAddTrackEvent(n,t))},e.prototype.updateDirection=function(e){var t=this;if(void 0===this._peerConnection)return Promise.reject(new Error("Peer connection closed."));switch(this._peerConnection.signalingState){case"stable":this.logger.debug("SessionDescriptionHandler.updateDirection - setting offer direction");var n=function(t){switch(t){case"inactive":return(null===e||void 0===e?void 0:e.hold)?"inactive":"recvonly";case"recvonly":return(null===e||void 0===e?void 0:e.hold)?"inactive":"recvonly";case"sendonly":return(null===e||void 0===e?void 0:e.hold)?"sendonly":"sendrecv";case"sendrecv":return(null===e||void 0===e?void 0:e.hold)?"sendonly":"sendrecv";case"stopped":return"stopped";default:throw new Error("Should never happen")}};this._peerConnection.getTransceivers().forEach((function(e){if(e.direction){var t=n(e.direction);e.direction!==t&&(e.direction=t)}}));break;case"have-remote-offer":this.logger.debug("SessionDescriptionHandler.updateDirection - setting answer direction");var r=function(){var e=t._peerConnection.remoteDescription;if(!e)throw new Error("Failed to read remote offer");var n=/a=sendrecv\r\n|a=sendonly\r\n|a=recvonly\r\n|a=inactive\r\n/.exec(e.sdp);if(n)switch(n[0]){case"a=inactive\r\n":return"inactive";case"a=recvonly\r\n":return"recvonly";case"a=sendonly\r\n":return"sendonly";case"a=sendrecv\r\n":return"sendrecv";default:throw new Error("Should never happen")}return"sendrecv"}(),o=function(){switch(r){case"inactive":return"inactive";case"recvonly":return"sendonly";case"sendonly":return(null===e||void 0===e?void 0:e.hold)?"inactive":"recvonly";case"sendrecv":return(null===e||void 0===e?void 0:e.hold)?"sendonly":"sendrecv";default:throw new Error("Should never happen")}}();this._peerConnection.getTransceivers().forEach((function(e){e.direction&&"stopped"!==e.direction&&e.direction!==o&&(e.direction=o)}));break;case"have-local-offer":case"have-local-pranswer":case"have-remote-pranswer":case"closed":default:return Promise.reject(new Error("Invalid signaling state "+this._peerConnection.signalingState))}return Promise.resolve()},e.prototype.iceGatheringComplete=function(){this.logger.debug("SessionDescriptionHandler.iceGatheringComplete"),void 0!==this.iceGatheringCompleteTimeoutId&&(this.logger.debug("SessionDescriptionHandler.iceGatheringComplete - clearing timeout"),clearTimeout(this.iceGatheringCompleteTimeoutId),this.iceGatheringCompleteTimeoutId=void 0),void 0!==this.iceGatheringCompletePromise&&(this.logger.debug("SessionDescriptionHandler.iceGatheringComplete - resolving promise"),this.iceGatheringCompleteResolve&&this.iceGatheringCompleteResolve(),this.iceGatheringCompletePromise=void 0,this.iceGatheringCompleteResolve=void 0,this.iceGatheringCompleteReject=void 0)},e.prototype.waitForIceGatheringComplete=function(e,t){var n=this;return void 0===e&&(e=!1),void 0===t&&(t=0),this.logger.debug("SessionDescriptionHandler.waitForIceGatheringToComplete"),void 0===this._peerConnection?Promise.reject("Peer connection closed."):e||"complete"!==this._peerConnection.iceGatheringState?(void 0!==this.iceGatheringCompletePromise&&(this.logger.debug("SessionDescriptionHandler.waitForIceGatheringToComplete - rejecting prior waiting promise"),this.iceGatheringCompleteReject&&this.iceGatheringCompleteReject(new Error("Promise superseded.")),this.iceGatheringCompletePromise=void 0,this.iceGatheringCompleteResolve=void 0,this.iceGatheringCompleteReject=void 0),this.iceGatheringCompletePromise=new Promise((function(e,r){n.iceGatheringCompleteResolve=e,n.iceGatheringCompleteReject=r,t>0&&(n.logger.debug("SessionDescriptionHandler.waitForIceGatheringToComplete - timeout in "+t),n.iceGatheringCompleteTimeoutId=setTimeout((function(){n.logger.debug("SessionDescriptionHandler.waitForIceGatheringToComplete - timeout"),n.iceGatheringComplete()}),t))})),this.iceGatheringCompletePromise):(this.logger.debug("SessionDescriptionHandler.waitForIceGatheringToComplete - already complete"),Promise.resolve())},e.prototype.initPeerConnectionEventHandlers=function(){var e=this;if(this.logger.debug("SessionDescriptionHandler.initPeerConnectionEventHandlers"),!this._peerConnection)throw new Error("Peer connection undefined.");var t=this._peerConnection;t.onconnectionstatechange=function(n){var r,o=t.connectionState;e.logger.debug("SessionDescriptionHandler.onconnectionstatechange ".concat(o)),(null===(r=e._peerConnectionDelegate)||void 0===r?void 0:r.onconnectionstatechange)&&e._peerConnectionDelegate.onconnectionstatechange(n)},t.ondatachannel=function(t){var n;e.logger.debug("SessionDescriptionHandler.ondatachannel"),e._dataChannel=t.channel,e.onDataChannel&&e.onDataChannel(e._dataChannel),(null===(n=e._peerConnectionDelegate)||void 0===n?void 0:n.ondatachannel)&&e._peerConnectionDelegate.ondatachannel(t)},t.onicecandidate=function(t){var n;e.logger.debug("SessionDescriptionHandler.onicecandidate"),(null===(n=e._peerConnectionDelegate)||void 0===n?void 0:n.onicecandidate)&&e._peerConnectionDelegate.onicecandidate(t)},t.onicecandidateerror=function(t){var n;e.logger.debug("SessionDescriptionHandler.onicecandidateerror"),(null===(n=e._peerConnectionDelegate)||void 0===n?void 0:n.onicecandidateerror)&&e._peerConnectionDelegate.onicecandidateerror(t)},t.oniceconnectionstatechange=function(n){var r,o=t.iceConnectionState;e.logger.debug("SessionDescriptionHandler.oniceconnectionstatechange ".concat(o)),(null===(r=e._peerConnectionDelegate)||void 0===r?void 0:r.oniceconnectionstatechange)&&e._peerConnectionDelegate.oniceconnectionstatechange(n)},t.onicegatheringstatechange=function(n){var r,o=t.iceGatheringState;e.logger.debug("SessionDescriptionHandler.onicegatheringstatechange ".concat(o)),"complete"===o&&e.iceGatheringComplete(),(null===(r=e._peerConnectionDelegate)||void 0===r?void 0:r.onicegatheringstatechange)&&e._peerConnectionDelegate.onicegatheringstatechange(n)},t.onnegotiationneeded=function(t){var n;e.logger.debug("SessionDescriptionHandler.onnegotiationneeded"),(null===(n=e._peerConnectionDelegate)||void 0===n?void 0:n.onnegotiationneeded)&&e._peerConnectionDelegate.onnegotiationneeded(t)},t.onsignalingstatechange=function(n){var r,o=t.signalingState;e.logger.debug("SessionDescriptionHandler.onsignalingstatechange ".concat(o)),(null===(r=e._peerConnectionDelegate)||void 0===r?void 0:r.onsignalingstatechange)&&e._peerConnectionDelegate.onsignalingstatechange(n)},t.onstatsended=function(t){var n;e.logger.debug("SessionDescriptionHandler.onstatsended"),(null===(n=e._peerConnectionDelegate)||void 0===n?void 0:n.onstatsended)&&e._peerConnectionDelegate.onstatsended(t)},t.ontrack=function(t){var n,r=t.track.kind,o=t.track.enabled?"enabled":"disabled";e.logger.debug("SessionDescriptionHandler.ontrack ".concat(r," ").concat(o)),e.setRemoteTrack(t.track),(null===(n=e._peerConnectionDelegate)||void 0===n?void 0:n.ontrack)&&e._peerConnectionDelegate.ontrack(t)}},e}();function pt(e){return function(t,n){void 0===e&&(e=lt());var r=void 0!==(null===n||void 0===n?void 0:n.iceGatheringTimeout)?null===n||void 0===n?void 0:n.iceGatheringTimeout:5e3,o={iceGatheringTimeout:r,peerConnectionConfiguration:i(i({},ut()),null===n||void 0===n?void 0:n.peerConnectionConfiguration)},s=t.userAgent.getLogger("sip.SessionDescriptionHandler");return new dt(s,e,o)}}var ht=function(){function e(t,n){if(this._state=st.Disconnected,this.transitioningState=!1,this._stateEventEmitter=new Ue,this.logger=t,n){var r=n,o=null===r||void 0===r?void 0:r.wsServers,s=null===r||void 0===r?void 0:r.maxReconnectionAttempts;if(void 0!==o){var a='The transport option "wsServers" as has apparently been specified and has been deprecated. It will no longer be available starting with SIP.js release 0.16.0. Please update accordingly.';this.logger.warn(a)}if(void 0!==s){a='The transport option "maxReconnectionAttempts" as has apparently been specified and has been deprecated. It will no longer be available starting with SIP.js release 0.16.0. Please update accordingly.';this.logger.warn(a)}o&&!n.server&&("string"===typeof o&&(n.server=o),o instanceof Array&&(n.server=o[0]))}this.configuration=i(i({},e.defaultOptions),n);var c=this.configuration.server,l=g.parse(c,"absoluteURI");if(-1===l)throw this.logger.error('Invalid WebSocket Server URL "'.concat(c,'"')),new Error("Invalid WebSocket Server URL");if(!["wss","ws","udp"].includes(l.scheme))throw this.logger.error('Invalid scheme in WebSocket Server URL "'.concat(c,'"')),new Error("Invalid scheme in WebSocket Server URL");this._protocol=l.scheme.toUpperCase()}return e.prototype.dispose=function(){return this.disconnect()},Object.defineProperty(e.prototype,"protocol",{get:function(){return this._protocol},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"server",{get:function(){return this.configuration.server},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stateChange",{get:function(){return this._stateEventEmitter},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"ws",{get:function(){return this._ws},enumerable:!1,configurable:!0}),e.prototype.connect=function(){return this._connect()},e.prototype.disconnect=function(){return this._disconnect()},e.prototype.isConnected=function(){return this.state===st.Connected},e.prototype.send=function(e){return this._send(e)},e.prototype._connect=function(){var e,t=this;switch(this.logger.log("Connecting ".concat(this.server)),this.state){case st.Connecting:if(this.transitioningState)return Promise.reject(this.transitionLoopDetectedError(st.Connecting));if(!this.connectPromise)throw new Error("Connect promise must be defined.");return this.connectPromise;case st.Connected:if(this.transitioningState)return Promise.reject(this.transitionLoopDetectedError(st.Connecting));if(this.connectPromise)throw new Error("Connect promise must not be defined.");return Promise.resolve();case st.Disconnecting:if(this.connectPromise)throw new Error("Connect promise must not be defined.");try{this.transitionState(st.Connecting)}catch(n){if(n instanceof $e)return Promise.reject(n);throw n}break;case st.Disconnected:if(this.connectPromise)throw new Error("Connect promise must not be defined.");try{this.transitionState(st.Connecting)}catch(n){if(n instanceof $e)return Promise.reject(n);throw n}break;default:throw new Error("Unknown state")}try{e=new WebSocket(this.server,"sip"),e.binaryType="arraybuffer",e.addEventListener("close",(function(n){return t.onWebSocketClose(n,e)})),e.addEventListener("error",(function(n){return t.onWebSocketError(n,e)})),e.addEventListener("open",(function(n){return t.onWebSocketOpen(n,e)})),e.addEventListener("message",(function(n){return t.onWebSocketMessage(n,e)})),this._ws=e}catch(r){return this._ws=void 0,this.logger.error("WebSocket construction failed."),this.logger.error(r),new Promise((function(e,n){t.connectResolve=e,t.connectReject=n,t.transitionState(st.Disconnected,r)}))}return this.connectPromise=new Promise((function(n,r){t.connectResolve=n,t.connectReject=r,t.connectTimeout=setTimeout((function(){t.logger.warn("Connect timed out. Exceeded time set in configuration.connectionTimeout: "+t.configuration.connectionTimeout+"s."),e.close(1e3)}),1e3*t.configuration.connectionTimeout)})),this.connectPromise},e.prototype._disconnect=function(){var e=this;switch(this.logger.log("Disconnecting ".concat(this.server)),this.state){case st.Connecting:if(this.disconnectPromise)throw new Error("Disconnect promise must not be defined.");try{this.transitionState(st.Disconnecting)}catch(n){if(n instanceof $e)return Promise.reject(n);throw n}break;case st.Connected:if(this.disconnectPromise)throw new Error("Disconnect promise must not be defined.");try{this.transitionState(st.Disconnecting)}catch(n){if(n instanceof $e)return Promise.reject(n);throw n}break;case st.Disconnecting:if(this.transitioningState)return Promise.reject(this.transitionLoopDetectedError(st.Disconnecting));if(!this.disconnectPromise)throw new Error("Disconnect promise must be defined.");return this.disconnectPromise;case st.Disconnected:if(this.transitioningState)return Promise.reject(this.transitionLoopDetectedError(st.Disconnecting));if(this.disconnectPromise)throw new Error("Disconnect promise must not be defined.");return Promise.resolve();default:throw new Error("Unknown state")}if(!this._ws)throw new Error("WebSocket must be defined.");var t=this._ws;return this.disconnectPromise=new Promise((function(n,r){e.disconnectResolve=n,e.disconnectReject=r;try{t.close(1e3)}catch(o){throw e.logger.error("WebSocket close failed."),e.logger.error(o),o}})),this.disconnectPromise},e.prototype._send=function(e){if(!0===this.configuration.traceSip&&this.logger.log("Sending WebSocket message:\n\n"+e+"\n"),this._state!==st.Connected)return Promise.reject(new Error("Not connected."));if(!this._ws)throw new Error("WebSocket undefined.");try{this._ws.send(e)}catch(t){return t instanceof Error?Promise.reject(t):Promise.reject(new Error("WebSocket send failed."))}return Promise.resolve()},e.prototype.onWebSocketClose=function(e,t){if(t===this._ws){var n="WebSocket closed ".concat(this.server," (code: ").concat(e.code,")"),r=this.disconnectPromise?void 0:new Error(n);r&&this.logger.warn("WebSocket closed unexpectedly"),this.logger.log(n),this._ws=void 0,this.transitionState(st.Disconnected,r)}},e.prototype.onWebSocketError=function(e,t){t===this._ws&&this.logger.error("WebSocket error occurred.")},e.prototype.onWebSocketMessage=function(e,t){if(t===this._ws){var n,r=e.data;if(/^(\r\n)+$/.test(r))return this.clearKeepAliveTimeout(),void(!0===this.configuration.traceSip&&this.logger.log("Received WebSocket message with CRLF Keep Alive response"));if(r){if("string"!==typeof r){try{n=(new TextDecoder).decode(new Uint8Array(r))}catch(o){return this.logger.error(o),void this.logger.error("Received WebSocket binary message failed to be converted into string, message discarded")}!0===this.configuration.traceSip&&this.logger.log("Received WebSocket binary message:\n\n"+n+"\n")}else n=r,!0===this.configuration.traceSip&&this.logger.log("Received WebSocket text message:\n\n"+n+"\n");if(this.state===st.Connected){if(this.onMessage)try{this.onMessage(n)}catch(i){throw this.logger.error(i),this.logger.error("Exception thrown by onMessage callback"),i}}else this.logger.warn("Received message while not connected, discarding...")}else this.logger.warn("Received empty message, discarding...")}},e.prototype.onWebSocketOpen=function(e,t){t===this._ws&&this._state===st.Connecting&&(this.logger.log("WebSocket opened ".concat(this.server)),this.transitionState(st.Connected))},e.prototype.transitionLoopDetectedError=function(e){var t="A state transition loop has been detected.";return t+=" An attempt to transition from ".concat(this._state," to ").concat(e," before the prior transition completed."),t+=" Perhaps you are synchronously calling connect() or disconnect() from a callback or state change handler?",this.logger.error(t),new $e("Loop detected.")},e.prototype.transitionState=function(e,t){var n=this,r=function(){throw new Error("Invalid state transition from ".concat(n._state," to ").concat(e))};if(this.transitioningState)throw this.transitionLoopDetectedError(e);switch(this.transitioningState=!0,this._state){case st.Connecting:e!==st.Connected&&e!==st.Disconnecting&&e!==st.Disconnected&&r();break;case st.Connected:e!==st.Disconnecting&&e!==st.Disconnected&&r();break;case st.Disconnecting:e!==st.Connecting&&e!==st.Disconnected&&r();break;case st.Disconnected:e!==st.Connecting&&r();break;default:throw new Error("Unknown state.")}var o=this._state;this._state=e;var i=this.connectResolve,s=this.connectReject;o===st.Connecting&&(this.connectPromise=void 0,this.connectResolve=void 0,this.connectReject=void 0);var a=this.disconnectResolve,c=this.disconnectReject;if(o===st.Disconnecting&&(this.disconnectPromise=void 0,this.disconnectResolve=void 0,this.disconnectReject=void 0),this.connectTimeout&&(clearTimeout(this.connectTimeout),this.connectTimeout=void 0),this.logger.log("Transitioned from ".concat(o," to ").concat(this._state)),this._stateEventEmitter.emit(this._state),e===st.Connected&&(this.startSendingKeepAlives(),this.onConnect))try{this.onConnect()}catch(l){throw this.logger.error(l),this.logger.error("Exception thrown by onConnect callback"),l}if(o===st.Connected&&(this.stopSendingKeepAlives(),this.onDisconnect))try{t?this.onDisconnect(t):this.onDisconnect()}catch(l){throw this.logger.error(l),this.logger.error("Exception thrown by onDisconnect callback"),l}if(o===st.Connecting){if(!i)throw new Error("Connect resolve undefined.");if(!s)throw new Error("Connect reject undefined.");e===st.Connected?i():s(t||new Error("Connect aborted."))}if(o===st.Disconnecting){if(!a)throw new Error("Disconnect resolve undefined.");if(!c)throw new Error("Disconnect reject undefined.");e===st.Disconnected?a():c(t||new Error("Disconnect aborted."))}this.transitioningState=!1},e.prototype.clearKeepAliveTimeout=function(){this.keepAliveDebounceTimeout&&clearTimeout(this.keepAliveDebounceTimeout),this.keepAliveDebounceTimeout=void 0},e.prototype.sendKeepAlive=function(){var e=this;return this.keepAliveDebounceTimeout?Promise.resolve():(this.keepAliveDebounceTimeout=setTimeout((function(){e.clearKeepAliveTimeout()}),1e3*this.configuration.keepAliveDebounce),this.send("\r\n\r\n"))},e.prototype.startSendingKeepAlives=function(){var e=this,t=function(e){var t=.8*e;return 1e3*(Math.random()*(e-t)+t)};this.configuration.keepAliveInterval&&!this.keepAliveInterval&&(this.keepAliveInterval=setInterval((function(){e.sendKeepAlive(),e.startSendingKeepAlives()}),t(this.configuration.keepAliveInterval)))},e.prototype.stopSendingKeepAlives=function(){this.keepAliveInterval&&clearInterval(this.keepAliveInterval),this.keepAliveDebounceTimeout&&clearTimeout(this.keepAliveDebounceTimeout),this.keepAliveInterval=void 0,this.keepAliveDebounceTimeout=void 0},e.defaultOptions={server:"",connectionTimeout:5,keepAliveInterval:0,keepAliveDebounce:10,traceSip:!0},e}(),ft=function(){function e(t){var n=this;if(void 0===t&&(t={}),this._publishers={},this._registerers={},this._sessions={},this._subscriptions={},this._state=at.Stopped,this.unloadListener=function(){n.stop()},this._stateEventEmitter=new Ue,this.delegate=t.delegate,this.options=i(i(i(i(i({},e.defaultOptions()),{sipjsId:b(5)}),{uri:new d("sip","anonymous."+b(6),"anonymous.invalid")}),{viaHost:b(12)+".invalid"}),e.stripUndefinedProperties(t)),this.options.hackIpInContact)if("boolean"===typeof this.options.hackIpInContact&&this.options.hackIpInContact){var r=1,o=254,s=Math.floor(Math.random()*(o-r+1)+r);this.options.viaHost="192.0.2."+s}else this.options.hackIpInContact&&(this.options.viaHost=this.options.hackIpInContact);switch(this.loggerFactory=new xe,this.logger=this.loggerFactory.getLogger("sip.UserAgent"),this.loggerFactory.builtinEnabled=this.options.logBuiltinEnabled,this.loggerFactory.connector=this.options.logConnector,this.options.logLevel){case"error":this.loggerFactory.level=Se.error;break;case"warn":this.loggerFactory.level=Se.warn;break;case"log":this.loggerFactory.level=Se.log;break;case"debug":this.loggerFactory.level=Se.debug;break}if(this.options.logConfiguration&&(this.logger.log("Configuration:"),Object.keys(this.options).forEach((function(e){var t=n.options[e];switch(e){case"uri":case"sessionDescriptionHandlerFactory":n.logger.log("· "+e+": "+t);break;case"authorizationPassword":n.logger.log("· "+e+": NOT SHOWN");break;case"transportConstructor":n.logger.log("· "+e+": "+t.name);break;default:n.logger.log("· "+e+": "+JSON.stringify(t))}}))),this.options.transportOptions){var a=this.options.transportOptions,c=a.maxReconnectionAttempts,l=a.reconnectionTimeout;if(void 0!==c){var u='The transport option "maxReconnectionAttempts" as has apparently been specified and has been deprecated. It will no longer be available starting with SIP.js release 0.16.0. Please update accordingly.';this.logger.warn(u)}if(void 0!==l){u='The transport option "reconnectionTimeout" as has apparently been specified and has been deprecated. It will no longer be available starting with SIP.js release 0.16.0. Please update accordingly.';this.logger.warn(u)}void 0===t.reconnectionDelay&&void 0!==l&&(this.options.reconnectionDelay=l),void 0===t.reconnectionAttempts&&void 0!==c&&(this.options.reconnectionAttempts=c)}if(void 0!==t.reconnectionDelay){u='The user agent option "reconnectionDelay" as has apparently been specified and has been deprecated. It will no longer be available starting with SIP.js release 0.16.0. Please update accordingly.';this.logger.warn(u)}if(void 0!==t.reconnectionAttempts){u='The user agent option "reconnectionAttempts" as has apparently been specified and has been deprecated. It will no longer be available starting with SIP.js release 0.16.0. Please update accordingly.';this.logger.warn(u)}this._transport=new this.options.transportConstructor(this.getLogger("sip.Transport"),this.options.transportOptions),this.initTransportCallbacks(),this._contact=this.initContact(),this._userAgentCore=this.initCore(),this.options.autoStart&&this.start()}return e.makeURI=function(e){return g.URIParse(e)},e.defaultOptions=function(){return{allowLegacyNotifications:!1,authorizationHa1:"",authorizationPassword:"",authorizationUsername:"",autoStart:!1,autoStop:!0,delegate:{},contactName:"",contactParams:{transport:"ws"},displayName:"",forceRport:!1,hackAllowUnregisteredOptionTags:!1,hackIpInContact:!1,hackViaTcp:!1,logBuiltinEnabled:!0,logConfiguration:!0,logConnector:function(){},logLevel:"log",noAnswerTimeout:60,preloadedRouteSet:[],reconnectionAttempts:0,reconnectionDelay:4,sendInitialProvisionalResponse:!0,sessionDescriptionHandlerFactory:pt(),sessionDescriptionHandlerFactoryOptions:{},sipExtension100rel:Ye.Unsupported,sipExtensionReplaces:Ye.Unsupported,sipExtensionExtraSupported:[],sipjsId:"",transportConstructor:ht,transportOptions:{},uri:new d("sip","anonymous","anonymous.invalid"),userAgentString:"SIP.js/"+c,viaHost:""}},e.stripUndefinedProperties=function(e){return Object.keys(e).reduce((function(t,n){return void 0!==e[n]&&(t[n]=e[n]),t}),{})},Object.defineProperty(e.prototype,"configuration",{get:function(){return this.options},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"contact",{get:function(){return this._contact},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"stateChange",{get:function(){return this._stateEventEmitter},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transport",{get:function(){return this._transport},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"userAgentCore",{get:function(){return this._userAgentCore},enumerable:!1,configurable:!0}),e.prototype.getLogger=function(e,t){return this.loggerFactory.getLogger(e,t)},e.prototype.getLoggerFactory=function(){return this.loggerFactory},e.prototype.isConnected=function(){return this.transport.isConnected()},e.prototype.reconnect=function(){var e=this;return this.state===at.Stopped?Promise.reject(new Error("User agent stopped.")):Promise.resolve().then((function(){return e.transport.connect()}))},e.prototype.start=function(){if(this.state===at.Started)return this.logger.warn("User agent already started"),Promise.resolve();if(this.logger.log("Starting ".concat(this.configuration.uri)),this.transitionState(at.Started),this.options.autoStop){var e=!("undefined"===typeof chrome||!chrome.app||!chrome.app.runtime);"undefined"===typeof window||"function"!==typeof window.addEventListener||e||window.addEventListener("unload",this.unloadListener)}return this.transport.connect()},e.prototype.stop=function(){return s(this,void 0,void 0,(function(){var e,t,n,r,o,s,c,l,u,d,p,h,f,g,m,v,y,b,w,S,T,C,E,k,x,I,R,_,N=this;return a(this,(function(A){switch(A.label){case 0:if(this.state===at.Stopped)return this.logger.warn("User agent already stopped"),[2,Promise.resolve()];for(p in this.logger.log("Stopping ".concat(this.configuration.uri)),this.transitionState(at.Stopped),this.options.autoStop&&(e=!("undefined"===typeof chrome||!chrome.app||!chrome.app.runtime),"undefined"!==typeof window&&window.removeEventListener&&!e&&window.removeEventListener("unload",this.unloadListener)),t=i({},this._publishers),n=i({},this._registerers),r=i({},this._sessions),o=i({},this._subscriptions),s=this.transport,c=this.userAgentCore,this.logger.log("Dispose of registerers"),l=function(e){return a(this,(function(t){switch(t.label){case 0:return n[e]?[4,n[e].dispose().catch((function(t){throw N.logger.error(t.message),delete N._registerers[e],t}))]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}}))},u=n,d=[],u)d.push(p);h=0,A.label=1;case 1:return h<d.length?(p=d[h],p in u?(_=p,[5,l(_)]):[3,3]):[3,4];case 2:A.sent(),A.label=3;case 3:return h++,[3,1];case 4:for(v in this.logger.log("Dispose of sessions"),f=function(e){return a(this,(function(t){switch(t.label){case 0:return r[e]?[4,r[e].dispose().catch((function(t){throw N.logger.error(t.message),delete N._sessions[e],t}))]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}}))},g=r,m=[],g)m.push(v);y=0,A.label=5;case 5:return y<m.length?(v=m[y],v in g?(_=v,[5,f(_)]):[3,7]):[3,8];case 6:A.sent(),A.label=7;case 7:return y++,[3,5];case 8:for(T in this.logger.log("Dispose of subscriptions"),b=function(e){return a(this,(function(t){switch(t.label){case 0:return o[e]?[4,o[e].dispose().catch((function(t){throw N.logger.error(t.message),delete N._subscriptions[e],t}))]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}}))},w=o,S=[],w)S.push(T);C=0,A.label=9;case 9:return C<S.length?(T=S[C],T in w?(_=T,[5,b(_)]):[3,11]):[3,12];case 10:A.sent(),A.label=11;case 11:return C++,[3,9];case 12:for(I in this.logger.log("Dispose of publishers"),E=function(e){return a(this,(function(n){switch(n.label){case 0:return t[e]?[4,t[e].dispose().catch((function(t){throw N.logger.error(t.message),delete N._publishers[e],t}))]:[3,2];case 1:n.sent(),n.label=2;case 2:return[2]}}))},k=t,x=[],k)x.push(I);R=0,A.label=13;case 13:return R<x.length?(I=x[R],I in k?(_=I,[5,E(_)]):[3,15]):[3,16];case 14:A.sent(),A.label=15;case 15:return R++,[3,13];case 16:return this.logger.log("Dispose of transport"),[4,s.dispose().catch((function(e){throw N.logger.error(e.message),e}))];case 17:return A.sent(),this.logger.log("Dispose of core"),c.dispose(),[2]}}))}))},e.prototype._makeInviter=function(e,t){return new tt(this,e,t)},e.prototype.attemptReconnection=function(e){var t=this;void 0===e&&(e=1);var n=this.options.reconnectionAttempts,r=this.options.reconnectionDelay;e>n?this.logger.log("Maximum reconnection attempts reached"):(this.logger.log("Reconnection attempt ".concat(e," of ").concat(n," - trying")),setTimeout((function(){t.reconnect().then((function(){t.logger.log("Reconnection attempt ".concat(e," of ").concat(n," - succeeded"))})).catch((function(r){t.logger.error(r.message),t.logger.log("Reconnection attempt ".concat(e," of ").concat(n," - failed")),t.attemptReconnection(++e)}))}),1===e?0:1e3*r))},e.prototype.initContact=function(){var e=this,t=""!==this.options.contactName?this.options.contactName:b(8),n=this.options.contactParams,r={pubGruu:void 0,tempGruu:void 0,uri:new d("sip",t,this.options.viaHost,void 0,n),toString:function(t){void 0===t&&(t={});var r=t.anonymous||!1,o=t.outbound||!1,i="<";return i+=r?e.contact.tempGruu||"sip:anonymous@anonymous.invalid;transport=".concat(n.transport?n.transport:"ws"):e.contact.pubGruu||e.contact.uri,o&&(i+=";ob"),i+=">",i}};return r},e.prototype.initCore=function(){var e=this,t=[];t.push("outbound"),this.options.sipExtension100rel===Ye.Supported&&t.push("100rel"),this.options.sipExtensionReplaces===Ye.Supported&&t.push("replaces"),this.options.sipExtensionExtraSupported&&t.push.apply(t,this.options.sipExtensionExtraSupported),this.options.hackAllowUnregisteredOptionTags||(t=t.filter((function(e){return Qe[e]}))),t=Array.from(new Set(t));var n=t.slice();(this.contact.pubGruu||this.contact.tempGruu)&&n.push("gruu");var r={aor:this.options.uri,contact:this.contact,displayName:this.options.displayName,loggerFactory:this.loggerFactory,hackViaTcp:this.options.hackViaTcp,routeSet:this.options.preloadedRouteSet,supportedOptionTags:t,supportedOptionTagsResponse:n,sipjsId:this.options.sipjsId,userAgentHeaderFieldValue:this.options.userAgentString,viaForceRport:this.options.forceRport,viaHost:this.options.viaHost,authenticationFactory:function(){var t=e.options.authorizationUsername?e.options.authorizationUsername:e.options.uri.user,n=e.options.authorizationPassword?e.options.authorizationPassword:void 0,r=e.options.authorizationHa1?e.options.authorizationHa1:void 0;return new B(e.getLoggerFactory(),r,t,n)},transportAccessor:function(){return e.transport}},o={onInvite:function(t){var n,r=new et(e,t);if(t.delegate={onCancel:function(e){r._onCancel(e)},onTransportError:function(t){e.logger.error("A transport error has occurred while handling an incoming INVITE request.")}},t.trying(),e.options.sipExtensionReplaces!==Ye.Unsupported){var o=t.message,i=o.parseHeader("replaces");if(i){var s=i.call_id;if("string"!==typeof s)throw new Error("Type of call id is not string");var a=i.replaces_to_tag;if("string"!==typeof a)throw new Error("Type of to tag is not string");var c=i.replaces_from_tag;if("string"!==typeof c)throw new Error("type of from tag is not string");var l=s+a+c,u=e.userAgentCore.dialogs.get(l);if(!u)return void r.reject({statusCode:481});if(!u.early&&!0===i.early_only)return void r.reject({statusCode:486});var d=e._sessions[s+c]||e._sessions[s+a]||void 0;if(!d)throw new Error("Session does not exist.");r._replacee=d}}if(null===(n=e.delegate)||void 0===n?void 0:n.onInvite)return r.autoSendAnInitialProvisionalResponse?void r.progress().then((function(){var t;if(void 0===(null===(t=e.delegate)||void 0===t?void 0:t.onInvite))throw new Error("onInvite undefined.");e.delegate.onInvite(r)})):void e.delegate.onInvite(r);r.reject({statusCode:486})},onMessage:function(t){if(e.delegate&&e.delegate.onMessage){var n=new Ke(t);e.delegate.onMessage(n)}else t.accept()},onNotify:function(t){if(e.delegate&&e.delegate.onNotify){var n=new We(t);e.delegate.onNotify(n)}else e.options.allowLegacyNotifications?t.accept():t.reject({statusCode:481})},onRefer:function(t){e.logger.warn("Received an out of dialog REFER request"),e.delegate&&e.delegate.onReferRequest?e.delegate.onReferRequest(t):t.reject({statusCode:405})},onRegister:function(t){e.logger.warn("Received an out of dialog REGISTER request"),e.delegate&&e.delegate.onRegisterRequest?e.delegate.onRegisterRequest(t):t.reject({statusCode:405})},onSubscribe:function(t){e.logger.warn("Received an out of dialog SUBSCRIBE request"),e.delegate&&e.delegate.onSubscribeRequest?e.delegate.onSubscribeRequest(t):t.reject({statusCode:405})}};return new je(r,o)},e.prototype.initTransportCallbacks=function(){var e=this;this.transport.onConnect=function(){return e.onTransportConnect()},this.transport.onDisconnect=function(t){return e.onTransportDisconnect(t)},this.transport.onMessage=function(t){return e.onTransportMessage(t)}},e.prototype.onTransportConnect=function(){this.state!==at.Stopped&&this.delegate&&this.delegate.onConnect&&this.delegate.onConnect()},e.prototype.onTransportDisconnect=function(e){this.state!==at.Stopped&&(this.delegate&&this.delegate.onDisconnect&&this.delegate.onDisconnect(e),e&&this.options.reconnectionAttempts>0&&this.attemptReconnection())},e.prototype.onTransportMessage=function(e){var t=this,n=D.parseMessage(e,this.getLogger("sip.Parser"));if(n)if(this.state===at.Stopped&&n instanceof k)this.logger.warn("Received ".concat(n.method," request while stopped. Dropping."));else{var r=function(){for(var e=["from","to","call_id","cseq","via"],r=0,o=e;r<o.length;r++){var i=o[r];if(!n.hasHeader(i))return t.logger.warn("Missing mandatory header field : ".concat(i,".")),!1}return!0};if(n instanceof k){if(!r())return void this.logger.warn("Request missing mandatory header field. Dropping.");if(!n.toTag&&n.callId.substr(0,5)===this.options.sipjsId)return void this.userAgentCore.replyStateless(n,{statusCode:482});var o=C(n.body),i=n.getHeader("content-length");if(i&&o<Number(i))return void this.userAgentCore.replyStateless(n,{statusCode:400})}if(n instanceof x){if(!r())return void this.logger.warn("Response missing mandatory header field. Dropping.");if(n.getHeaders("via").length>1)return void this.logger.warn("More than one Via header field present in the response. Dropping.");if(n.via.host!==this.options.viaHost||void 0!==n.via.port)return void this.logger.warn("Via sent-by in the response does not match UA Via host value. Dropping.");o=C(n.body),i=n.getHeader("content-length");if(i&&o<Number(i))return void this.logger.warn("Message body length is lower than the value in Content-Length header field. Dropping.")}if(n instanceof k)this.userAgentCore.receiveIncomingRequestFromTransport(n);else{if(!(n instanceof x))throw new Error("Invalid message type.");this.userAgentCore.receiveIncomingResponseFromTransport(n)}}else this.logger.warn("Failed to parse incoming message. Dropping.")},e.prototype.transitionState=function(e,t){var n=this,r=function(){throw new Error("Invalid state transition from ".concat(n._state," to ").concat(e))};switch(this._state){case at.Started:e!==at.Stopped&&r();break;case at.Stopped:e!==at.Started&&r();break;default:throw new Error("Unknown state.")}this.logger.log("Transitioned from ".concat(this._state," to ").concat(e)),this._state=e,this._stateEventEmitter.emit(this._state)},e}();function gt(e,t){t.autoplay=!0,t.srcObject=e,t.play().catch((function(e){console.error(e)})),e.onaddtrack=function(){t.load(),t.play().catch((function(e){console.error("Failed to play remote media on add track"),console.error(e)}))},e.onremovetrack=function(){t.load(),t.play().catch((function(e){console.error("Failed to play remote media on remove track"),console.error(e)}))}}function mt(e){var t=document.getElementById(e);if(t instanceof HTMLAudioElement)return t;var n=new Audio;return n.controls=!0,n.autoplay=!0,n.id="m7remoteAudio",n.style.display="none",document.body.appendChild(n),document.getElementById(e)}(function(){function e(e,t){var n=this;void 0===t&&(t={}),this.attemptingReconnection=!1,this.connectRequested=!1,this.held=!1,this.muted=!1,this.registerer=void 0,this.registerRequested=!1,this.session=void 0,this.delegate=t.delegate,this.options=i({},t);var r=i({},t.userAgentOptions);if(r.transportConstructor||(r.transportConstructor=ht),r.transportOptions||(r.transportOptions={server:e}),!r.uri&&t.aor){var o=ft.makeURI(t.aor);if(!o)throw new Error("Failed to create valid URI from ".concat(t.aor));r.uri=o}this.userAgent=new ft(r),this.userAgent.delegate={onConnect:function(){n.logger.log("[".concat(n.id,"] Connected")),n.delegate&&n.delegate.onServerConnect&&n.delegate.onServerConnect(),n.registerer&&n.registerRequested&&(n.logger.log("[".concat(n.id,"] Registering...")),n.registerer.register().catch((function(e){n.logger.error("[".concat(n.id,"] Error occurred registering after connection with server was obtained.")),n.logger.error(e.toString())})))},onDisconnect:function(e){n.logger.log("[".concat(n.id,"] Disconnected")),n.delegate&&n.delegate.onServerDisconnect&&n.delegate.onServerDisconnect(e),n.session&&(n.logger.log("[".concat(n.id,"] Hanging up...")),n.hangup().catch((function(e){n.logger.error("[".concat(n.id,"] Error occurred hanging up call after connection with server was lost.")),n.logger.error(e.toString())}))),n.registerer&&(n.logger.log("[".concat(n.id,"] Unregistering...")),n.registerer.unregister().catch((function(e){n.logger.error("[".concat(n.id,"] Error occurred unregistering after connection with server was lost.")),n.logger.error(e.toString())}))),e&&n.attemptReconnection()},onInvite:function(e){if(n.logger.log("[".concat(n.id,"] Received INVITE")),n.session)return n.logger.warn("[".concat(n.id,"] Session already in progress, rejecting INVITE...")),void e.reject().then((function(){n.logger.log("[".concat(n.id,"] Rejected INVITE"))})).catch((function(e){n.logger.error("[".concat(n.id,"] Failed to reject INVITE")),n.logger.error(e.toString())}));var t={sessionDescriptionHandlerOptions:{constraints:n.constraints}};n.initSession(e,t),n.delegate&&n.delegate.onCallReceived?n.delegate.onCallReceived():(n.logger.warn("[".concat(n.id,"] No handler available, rejecting INVITE...")),e.reject().then((function(){n.logger.log("[".concat(n.id,"] Rejected INVITE"))})).catch((function(e){n.logger.error("[".concat(n.id,"] Failed to reject INVITE")),n.logger.error(e.toString())})))},onMessage:function(e){e.accept().then((function(){n.delegate&&n.delegate.onMessageReceived&&n.delegate.onMessageReceived(e.request.body)}))}},this.logger=this.userAgent.getLogger("sip.SimpleUser"),window.addEventListener("online",(function(){n.logger.log("[".concat(n.id,"] Online")),n.attemptReconnection()}))}Object.defineProperty(e.prototype,"id",{get:function(){return this.options.userAgentOptions&&this.options.userAgentOptions.displayName||"Anonymous"},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"localMediaStream",{get:function(){var e,t=null===(e=this.session)||void 0===e?void 0:e.sessionDescriptionHandler;if(t){if(!(t instanceof dt))throw new Error("Session description handler not instance of web SessionDescriptionHandler");return t.localMediaStream}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"remoteMediaStream",{get:function(){var e,t=null===(e=this.session)||void 0===e?void 0:e.sessionDescriptionHandler;if(t){if(!(t instanceof dt))throw new Error("Session description handler not instance of web SessionDescriptionHandler");return t.remoteMediaStream}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"localAudioTrack",{get:function(){var e;return null===(e=this.localMediaStream)||void 0===e?void 0:e.getTracks().find((function(e){return"audio"===e.kind}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"localVideoTrack",{get:function(){var e;return null===(e=this.localMediaStream)||void 0===e?void 0:e.getTracks().find((function(e){return"video"===e.kind}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"remoteAudioTrack",{get:function(){var e;return null===(e=this.remoteMediaStream)||void 0===e?void 0:e.getTracks().find((function(e){return"audio"===e.kind}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"remoteVideoTrack",{get:function(){var e;return null===(e=this.remoteMediaStream)||void 0===e?void 0:e.getTracks().find((function(e){return"video"===e.kind}))},enumerable:!1,configurable:!0}),e.prototype.connect=function(){return this.logger.log("[".concat(this.id,"] Connecting UserAgent...")),this.connectRequested=!0,this.userAgent.state!==at.Started?this.userAgent.start():this.userAgent.reconnect()},e.prototype.disconnect=function(){return this.logger.log("[".concat(this.id,"] Disconnecting UserAgent...")),this.connectRequested=!1,this.userAgent.stop()},e.prototype.isConnected=function(){return this.userAgent.isConnected()},e.prototype.register=function(e,t){var n=this;return this.logger.log("[".concat(this.id,"] Registering UserAgent...")),this.registerRequested=!0,this.registerer||(this.registerer=new ot(this.userAgent,e),this.registerer.stateChange.addListener((function(e){switch(e){case Xe.Initial:break;case Xe.Registered:n.delegate&&n.delegate.onRegistered&&n.delegate.onRegistered();break;case Xe.Unregistered:n.delegate&&n.delegate.onUnregistered&&n.delegate.onUnregistered();break;case Xe.Terminated:n.registerer=void 0;break;default:throw new Error("Unknown registerer state.")}}))),this.registerer.register(t).then((function(){}))},e.prototype.unregister=function(e){return this.logger.log("[".concat(this.id,"] Unregistering UserAgent...")),this.registerRequested=!1,this.registerer?this.registerer.unregister(e).then((function(){})):Promise.resolve()},e.prototype.call=function(e,t,n){if(this.logger.log("[".concat(this.id,"] Beginning Session...")),this.session)return Promise.reject(new Error("Session already exists."));var r=ft.makeURI(e);if(!r)return Promise.reject(new Error('Failed to create a valid URI from "'.concat(e,'"')));t||(t={}),t.sessionDescriptionHandlerOptions||(t.sessionDescriptionHandlerOptions={}),t.sessionDescriptionHandlerOptions.constraints||(t.sessionDescriptionHandlerOptions.constraints=this.constraints);var o=new tt(this.userAgent,r,t);return this.sendInvite(o,t,n).then((function(){}))},e.prototype.hangup=function(){return this.logger.log("[".concat(this.id,"] Hangup...")),this.terminate()},e.prototype.answer=function(e){return this.logger.log("[".concat(this.id,"] Accepting Invitation...")),this.session?this.session instanceof et?(e||(e={}),e.sessionDescriptionHandlerOptions||(e.sessionDescriptionHandlerOptions={}),e.sessionDescriptionHandlerOptions.constraints||(e.sessionDescriptionHandlerOptions.constraints=this.constraints),this.session.accept(e)):Promise.reject(new Error("Session not instance of Invitation.")):Promise.reject(new Error("Session does not exist."))},e.prototype.decline=function(){return this.logger.log("[".concat(this.id,"] rejecting Invitation...")),this.session?this.session instanceof et?this.session.reject():Promise.reject(new Error("Session not instance of Invitation.")):Promise.reject(new Error("Session does not exist."))},e.prototype.hold=function(){return this.logger.log("[".concat(this.id,"] holding session...")),this.setHold(!0)},e.prototype.unhold=function(){return this.logger.log("[".concat(this.id,"] unholding session...")),this.setHold(!1)},e.prototype.isHeld=function(){return this.held},e.prototype.mute=function(){this.logger.log("[".concat(this.id,"] disabling media tracks...")),this.setMute(!0)},e.prototype.unmute=function(){this.logger.log("[".concat(this.id,"] enabling media tracks...")),this.setMute(!1)},e.prototype.isMuted=function(){return this.muted},e.prototype.sendDTMF=function(e){if(this.logger.log("[".concat(this.id,"] sending DTMF...")),!/^[0-9A-D#*,]$/.exec(e))return Promise.reject(new Error("Invalid DTMF tone."));if(!this.session)return Promise.reject(new Error("Session does not exist."));this.logger.log("[".concat(this.id,"] Sending DTMF tone: ").concat(e));var t=e,n=2e3,r={contentDisposition:"render",contentType:"application/dtmf-relay",content:"Signal="+t+"\r\nDuration="+n},o={body:r};return this.session.info({requestOptions:o}).then((function(){}))},e.prototype.message=function(e,t){this.logger.log("[".concat(this.id,"] sending message..."));var n=ft.makeURI(e);return n?new nt(this.userAgent,n,t).message():Promise.reject(new Error('Failed to create a valid URI from "'.concat(e,'"')))},Object.defineProperty(e.prototype,"constraints",{get:function(){var e,t={audio:!0,video:!1};return(null===(e=this.options.media)||void 0===e?void 0:e.constraints)&&(t=i({},this.options.media.constraints)),t},enumerable:!1,configurable:!0}),e.prototype.attemptReconnection=function(e){var t=this;void 0===e&&(e=1);var n=this.options.reconnectionAttempts||3,r=this.options.reconnectionDelay||4;this.connectRequested?(this.attemptingReconnection&&this.logger.log("[".concat(this.id,"] Reconnection attempt already in progress")),e>n?this.logger.log("[".concat(this.id,"] Reconnection maximum attempts reached")):(1===e?this.logger.log("[".concat(this.id,"] Reconnection attempt ").concat(e," of ").concat(n," - trying")):this.logger.log("[".concat(this.id,"] Reconnection attempt ").concat(e," of ").concat(n," - trying in ").concat(r," seconds")),this.attemptingReconnection=!0,setTimeout((function(){if(!t.connectRequested)return t.logger.log("[".concat(t.id,"] Reconnection attempt ").concat(e," of ").concat(n," - aborted")),void(t.attemptingReconnection=!1);t.userAgent.reconnect().then((function(){t.logger.log("[".concat(t.id,"] Reconnection attempt ").concat(e," of ").concat(n," - succeeded")),t.attemptingReconnection=!1})).catch((function(r){t.logger.log("[".concat(t.id,"] Reconnection attempt ").concat(e," of ").concat(n," - failed")),t.logger.error(r.message),t.attemptingReconnection=!1,t.attemptReconnection(++e)}))}),1===e?0:1e3*r))):this.logger.log("[".concat(this.id,"] Reconnection not currently desired"))},e.prototype.cleanupMedia=function(){this.options.media&&(this.options.media.local&&this.options.media.local.video&&(this.options.media.local.video.srcObject=null,this.options.media.local.video.pause()),this.options.media.remote&&(this.options.media.remote.audio&&(this.options.media.remote.audio.srcObject=null,this.options.media.remote.audio.pause()),this.options.media.remote.video&&(this.options.media.remote.video.srcObject=null,this.options.media.remote.video.pause())))},e.prototype.enableReceiverTracks=function(e){if(!this.session)throw new Error("Session does not exist.");var t=this.session.sessionDescriptionHandler;if(!(t instanceof dt))throw new Error("Session's session description handler not instance of SessionDescriptionHandler.");var n=t.peerConnection;if(!n)throw new Error("Peer connection closed.");n.getReceivers().forEach((function(t){t.track&&(t.track.enabled=e)}))},e.prototype.enableSenderTracks=function(e){if(!this.session)throw new Error("Session does not exist.");var t=this.session.sessionDescriptionHandler;if(!(t instanceof dt))throw new Error("Session's session description handler not instance of SessionDescriptionHandler.");var n=t.peerConnection;if(!n)throw new Error("Peer connection closed.");n.getSenders().forEach((function(t){t.track&&(t.track.enabled=e)}))},e.prototype.initSession=function(e,t){var n=this;this.session=e,this.delegate&&this.delegate.onCallCreated&&this.delegate.onCallCreated(),this.session.stateChange.addListener((function(t){if(n.session===e)switch(n.logger.log("[".concat(n.id,"] session state changed to ").concat(t)),t){case Ne.Initial:break;case Ne.Establishing:break;case Ne.Established:n.setupLocalMedia(),n.setupRemoteMedia(),n.delegate&&n.delegate.onCallAnswered&&n.delegate.onCallAnswered();break;case Ne.Terminating:case Ne.Terminated:n.session=void 0,n.cleanupMedia(),n.delegate&&n.delegate.onCallHangup&&n.delegate.onCallHangup();break;default:throw new Error("Unknown session state.")}})),this.session.delegate={onInfo:function(e){var t;if(void 0!==(null===(t=n.delegate)||void 0===t?void 0:t.onCallDTMFReceived)){var r=e.request.getHeader("content-type");if(r&&/^application\/dtmf-relay/i.exec(r)){var o=e.request.body.split("\r\n",2);if(2===o.length){var i,s=/^(Signal\s*?=\s*?)([0-9A-D#*]{1})(\s)?.*/;if(s.test(o[0])&&(i=o[0].replace(s,"$2")),i){var a,c=/^(Duration\s?=\s?)([0-9]{1,4})(\s)?.*/;c.test(o[1])&&(a=parseInt(o[1].replace(c,"$2"),10)),a?e.accept().then((function(){if(n.delegate&&n.delegate.onCallDTMFReceived){if(!i||!a)throw new Error("Tone or duration undefined.");n.delegate.onCallDTMFReceived(i,a)}})).catch((function(e){n.logger.error(e.message)})):e.reject()}else e.reject()}else e.reject()}else e.reject()}else e.reject()},onRefer:function(e){e.accept().then((function(){return n.sendInvite(e.makeInviter(t),t)})).catch((function(e){n.logger.error(e.message)}))}}},e.prototype.sendInvite=function(e,t,n){var r=this;return this.initSession(e,t),e.invite(n).then((function(){r.logger.log("[".concat(r.id,"] sent INVITE"))}))},e.prototype.setHold=function(e){var t=this;if(!this.session)return Promise.reject(new Error("Session does not exist."));var n=this.session;if(this.held===e)return Promise.resolve();var r=this.session.sessionDescriptionHandler;if(!(r instanceof dt))throw new Error("Session's session description handler not instance of SessionDescriptionHandler.");var o={requestDelegate:{onAccept:function(){t.held=e,t.enableReceiverTracks(!t.held),t.enableSenderTracks(!t.held&&!t.muted),t.delegate&&t.delegate.onCallHold&&t.delegate.onCallHold(t.held)},onReject:function(){t.logger.warn("[".concat(t.id,"] re-invite request was rejected")),t.enableReceiverTracks(!t.held),t.enableSenderTracks(!t.held&&!t.muted),t.delegate&&t.delegate.onCallHold&&t.delegate.onCallHold(t.held)}}},i=n.sessionDescriptionHandlerOptionsReInvite;return i.hold=e,n.sessionDescriptionHandlerOptionsReInvite=i,this.session.invite(o).then((function(){t.enableReceiverTracks(!e),t.enableSenderTracks(!e&&!t.muted)})).catch((function(e){throw e instanceof Me&&t.logger.error("[".concat(t.id,"] A hold request is already in progress.")),e}))},e.prototype.setMute=function(e){this.session?this.session.state===Ne.Established?(this.muted=e,this.enableSenderTracks(!this.held&&!this.muted)):this.logger.warn("[".concat(this.id,"] An established session is required to enable/disable media tracks")):this.logger.warn("[".concat(this.id,"] A session is required to enabled/disable media tracks"))},e.prototype.setupLocalMedia=function(){var e,t,n=this;if(!this.session)throw new Error("Session does not exist.");var r=null===(t=null===(e=this.options.media)||void 0===e?void 0:e.local)||void 0===t?void 0:t.video;if(r){var o=this.localMediaStream;if(!o)throw new Error("Local media stream undefiend.");r.srcObject=o,r.volume=0,r.play().catch((function(e){n.logger.error("[".concat(n.id,"] Failed to play local media")),n.logger.error(e.message)}))}},e.prototype.setupRemoteMedia=function(){var e,t,n,r,o=this;if(!this.session)throw new Error("Session does not exist.");var i=(null===(t=null===(e=this.options.media)||void 0===e?void 0:e.remote)||void 0===t?void 0:t.video)||(null===(r=null===(n=this.options.media)||void 0===n?void 0:n.remote)||void 0===r?void 0:r.audio);if(i){var s=this.remoteMediaStream;if(!s)throw new Error("Remote media stream undefiend.");i.autoplay=!0,i.srcObject=s,i.play().catch((function(e){o.logger.error("[".concat(o.id,"] Failed to play remote media")),o.logger.error(e.message)})),s.onaddtrack=function(){o.logger.log("[".concat(o.id,"] Remote media onaddtrack")),i.load(),i.play().catch((function(e){o.logger.error("[".concat(o.id,"] Failed to play remote media")),o.logger.error(e.message)}))}}},e.prototype.terminate=function(){var e=this;if(this.logger.log("[".concat(this.id,"] Terminating...")),!this.session)return Promise.reject(new Error("Session does not exist."));switch(this.session.state){case Ne.Initial:if(this.session instanceof tt)return this.session.cancel().then((function(){e.logger.log("[".concat(e.id,"] Inviter never sent INVITE (canceled)"))}));if(this.session instanceof et)return this.session.reject().then((function(){e.logger.log("[".concat(e.id,"] Invitation rejected (sent 480)"))}));throw new Error("Unknown session type.");case Ne.Establishing:if(this.session instanceof tt)return this.session.cancel().then((function(){e.logger.log("[".concat(e.id,"] Inviter canceled (sent CANCEL)"))}));if(this.session instanceof et)return this.session.reject().then((function(){e.logger.log("[".concat(e.id,"] Invitation rejected (sent 480)"))}));throw new Error("Unknown session type.");case Ne.Established:return this.session.bye().then((function(){e.logger.log("[".concat(e.id,"] Session ended (sent BYE)"))}));case Ne.Terminating:break;case Ne.Terminated:break;default:throw new Error("Unknown state")}return this.logger.log("[".concat(this.id,"] Terminating in state ").concat(this.session.state,", no action taken")),Promise.resolve()}})();var vt=mt("m7remoteAudio"),yt=function(){function e(e){var t=this;this.registerRequested=!1,this.attemptingReconnection=!1,this.connectRequested=!1,this.requestDelegate={onAccept:function(e){},onProgress:function(e){},onRedirect:function(e){},onReject:function(e){return s(t,void 0,void 0,(function(){return a(this,(function(e){switch(e.label){case 0:return[4,this.disconnect()];case 1:return e.sent(),[4,this.connect()];case 2:return e.sent(),this.register(),[2]}}))}))},onTrying:function(e){}},this.accept=function(){return s(t,void 0,void 0,(function(){var e,t;return a(this,(function(n){return e={audio:!0,video:!1},t={sessionDescriptionHandlerOptions:{constraints:e}},[2,this.Ginvitation.accept(t)]}))}))};var n=ft.makeURI("sip:"+e.sip+"@"+e.server);if(!n)throw new Error("Failed to create URI");var r={onConnect:function(){return s(t,void 0,void 0,(function(){return a(this,(function(e){return this.registerer&&this.registerRequested&&this.registerer.register().catch((function(e){})),[2]}))}))},onDisconnect:function(e){t.registerer&&t.registerer.unregister().catch((function(e){})),e&&t.attemptReconnection()},onInvite:function(e){t.Ginvitation=e;var n=e;n.delegate={onRefer:function(e){}},n.stateChange.addListener((function(e){switch(e){case Ne.Initial:break;case Ne.Establishing:break;case Ne.Established:var t=n.sessionDescriptionHandler;if(!t||!(t instanceof dt))throw new Error("Invalid session description handler.");vt&>(t.remoteMediaStream,vt);break;case Ne.Terminating:break;case Ne.Terminated:break;default:throw new Error("Unknown session state.")}}));var r={audio:!0,video:!1},o={sessionDescriptionHandlerOptions:{constraints:r}},i=t.Ginvitation.incomingInviteRequest.message.headers["X-Calltype"][0].raw;"callout"!==i&&"callTask"!==i||e.accept(o).then((function(){})).catch((function(e){}))}},o={logBuiltinEnabled:!1,delegate:r,displayName:"webrtc",uri:n,transportOptions:{server:"wss://"+e.server},authorizationUsername:e.sip,authorizationHa1:e.secret,reconnectionDelay:0};this.userAgent=new ft(o),window.addEventListener("online",(function(){return s(t,void 0,void 0,(function(){return a(this,(function(e){switch(e.label){case 0:return[4,this.attemptReconnection()];case 1:return e.sent(),this.register(),[2]}}))}))}))}return e.prototype.register=function(){var e=this;return this.registerRequested=!0,this.registerer||(this.registerer=new ot(this.userAgent,{expires:10}),this.registerer.stateChange.addListener((function(t){switch(t){case Xe.Initial:break;case Xe.Registered:break;case Xe.Unregistered:break;case Xe.Terminated:e.registerer=void 0;break;default:throw new Error("Unknown registerer state.")}}))),this.registerer.register({requestDelegate:this.requestDelegate}).then((function(){}))},e.prototype.unregister=function(e){return this.registerRequested=!1,this.registerer?this.registerer.unregister(e).then((function(){})):Promise.resolve()},e.prototype.attemptReconnection=function(e){var t=this;void 0===e&&(e=1);var n=1,r=0;this.connectRequested&&(e>n||(this.attemptingReconnection=!0,setTimeout((function(){t.connectRequested?t.userAgent.reconnect().then((function(){t.attemptingReconnection=!1})).catch((function(n){t.attemptingReconnection=!1,t.attemptReconnection(++e)})):t.attemptingReconnection=!1}),1===e?0:1e3*r)))},e.prototype.sendDTMF=function(e){if(!/^[0-9A-D#*,]$/.exec(e))return Promise.reject(new Error("Invalid DTMF tone."));if(!this.Ginvitation)return Promise.reject(new Error("Session does not exist."));var t=e,n=2e3,r={contentDisposition:"render",contentType:"application/dtmf-relay",content:"Signal="+t+"\r\nDuration="+n},o={body:r};return this.Ginvitation.info({requestOptions:o}).then((function(){}))},e.prototype.disconnect=function(){return this.connectRequested=!1,this.userAgent.stop()},e.prototype.connect=function(){return this.connectRequested=!0,this.userAgent.state!==at.Started?this.userAgent.start():this.userAgent.reconnect()},e.prototype.isConnected=function(){return this.userAgent.isConnected()},e}()},769:function(e,t){"use strict";t.Z=(e,t)=>{const n=e.__vccOpts||e;for(const[r,o]of t)n[r]=o;return n}},203:function(e){"use strict";e.exports=__WEBPACK_EXTERNAL_MODULE__203__}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var n=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e].call(n.exports,n,n.exports,__webpack_require__),n.exports}!function(){__webpack_require__.amdO={}}(),function(){__webpack_require__.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return __webpack_require__.d(t,{a:t}),t}}(),function(){__webpack_require__.d=function(e,t){for(var n in t)__webpack_require__.o(t,n)&&!__webpack_require__.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}}(),function(){__webpack_require__.g=function(){if("object"===typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"===typeof window)return window}}()}(),function(){__webpack_require__.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}}(),function(){__webpack_require__.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}}(),function(){__webpack_require__.p=""}();var __webpack_exports__={};return function(){"use strict";if(__webpack_require__.d(__webpack_exports__,{default:function(){return FE}}),"undefined"!==typeof window){var e=window.document.currentScript,t=e&&e.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);t&&(__webpack_require__.p=t[1])}var n=__webpack_require__(203);const r=Symbol(),o="el",i="is-",s=(e,t,n,r,o)=>{let i=`${e}-${t}`;return n&&(i+=`-${n}`),r&&(i+=`__${r}`),o&&(i+=`--${o}`),i},a=Symbol("namespaceContextKey"),c=e=>{const t=e||((0,n.getCurrentInstance)()?(0,n.inject)(a,(0,n.ref)(o)):(0,n.ref)(o)),r=(0,n.computed)((()=>(0,n.unref)(t)||o));return r},l=(e,t)=>{const n=c(t),r=(t="")=>s(n.value,e,t,"",""),o=t=>t?s(n.value,e,"",t,""):"",a=t=>t?s(n.value,e,"","",t):"",l=(t,r)=>t&&r?s(n.value,e,t,r,""):"",u=(t,r)=>t&&r?s(n.value,e,"",t,r):"",d=(t,r)=>t&&r?s(n.value,e,t,"",r):"",p=(t,r,o)=>t&&r&&o?s(n.value,e,t,r,o):"",h=(e,...t)=>{const n=!(t.length>=1)||t[0];return e&&n?`${i}${e}`:""},f=e=>{const t={};for(const r in e)e[r]&&(t[`--${n.value}-${r}`]=e[r]);return t},g=t=>{const r={};for(const o in t)t[o]&&(r[`--${n.value}-${e}-${o}`]=t[o]);return r},m=e=>`--${n.value}-${e}`,v=t=>`--${n.value}-${e}-${t}`;return{namespace:n,b:r,e:o,m:a,be:l,em:u,bm:d,bem:p,is:h,cssVar:f,cssVarName:m,cssVarBlock:g,cssVarBlockName:v}};var u=Array.isArray,d=u,p="object"==typeof global&&global&&global.Object===Object&&global,h=p,f="object"==typeof self&&self&&self.Object===Object&&self,g=h||f||Function("return this")(),m=g,v=m.Symbol,y=v,b=Object.prototype,w=b.hasOwnProperty,S=b.toString,T=y?y.toStringTag:void 0;function C(e){var t=w.call(e,T),n=e[T];try{e[T]=void 0;var r=!0}catch(i){}var o=S.call(e);return r&&(t?e[T]=n:delete e[T]),o}var E=C,k=Object.prototype,x=k.toString;function I(e){return x.call(e)}var R=I,_="[object Null]",N="[object Undefined]",A=y?y.toStringTag:void 0;function O(e){return null==e?void 0===e?N:_:A&&A in Object(e)?E(e):R(e)}var P=O;function D(e){return null!=e&&"object"==typeof e}var B=D,j="[object Symbol]";function H(e){return"symbol"==typeof e||B(e)&&P(e)==j}var M=H,L=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,q=/^\w*$/;function $(e,t){if(d(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!M(e))||(q.test(e)||!L.test(e)||null!=t&&e in Object(t))}var V=$;function F(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}var U=F,z="[object AsyncFunction]",K="[object Function]",W="[object GeneratorFunction]",G="[object Proxy]";function Y(e){if(!U(e))return!1;var t=P(e);return t==K||t==W||t==z||t==G}var J=Y,Z=m["__core-js_shared__"],X=Z,Q=function(){var e=/[^.]+$/.exec(X&&X.keys&&X.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function ee(e){return!!Q&&Q in e}var te=ee,ne=Function.prototype,re=ne.toString;function oe(e){if(null!=e){try{return re.call(e)}catch(t){}try{return e+""}catch(t){}}return""}var ie=oe,se=/[\\^$.*+?()[\]{}|]/g,ae=/^\[object .+?Constructor\]$/,ce=Function.prototype,le=Object.prototype,ue=ce.toString,de=le.hasOwnProperty,pe=RegExp("^"+ue.call(de).replace(se,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function he(e){if(!U(e)||te(e))return!1;var t=J(e)?pe:ae;return t.test(ie(e))}var fe=he;function ge(e,t){return null==e?void 0:e[t]}var me=ge;function ve(e,t){var n=me(e,t);return fe(n)?n:void 0}var ye=ve,be=ye(Object,"create"),we=be;function Se(){this.__data__=we?we(null):{},this.size=0}var Te=Se;function Ce(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var Ee=Ce,ke="__lodash_hash_undefined__",xe=Object.prototype,Ie=xe.hasOwnProperty;function Re(e){var t=this.__data__;if(we){var n=t[e];return n===ke?void 0:n}return Ie.call(t,e)?t[e]:void 0}var _e=Re,Ne=Object.prototype,Ae=Ne.hasOwnProperty;function Oe(e){var t=this.__data__;return we?void 0!==t[e]:Ae.call(t,e)}var Pe=Oe,De="__lodash_hash_undefined__";function Be(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=we&&void 0===t?De:t,this}var je=Be;function He(e){var t=-1,n=null==e?0:e.length;this.clear();while(++t<n){var r=e[t];this.set(r[0],r[1])}}He.prototype.clear=Te,He.prototype["delete"]=Ee,He.prototype.get=_e,He.prototype.has=Pe,He.prototype.set=je;var Me=He;function Le(){this.__data__=[],this.size=0}var qe=Le;function $e(e,t){return e===t||e!==e&&t!==t}var Ve=$e;function Fe(e,t){var n=e.length;while(n--)if(Ve(e[n][0],t))return n;return-1}var Ue=Fe,ze=Array.prototype,Ke=ze.splice;function We(e){var t=this.__data__,n=Ue(t,e);if(n<0)return!1;var r=t.length-1;return n==r?t.pop():Ke.call(t,n,1),--this.size,!0}var Ge=We;function Ye(e){var t=this.__data__,n=Ue(t,e);return n<0?void 0:t[n][1]}var Je=Ye;function Ze(e){return Ue(this.__data__,e)>-1}var Xe=Ze;function Qe(e,t){var n=this.__data__,r=Ue(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}var et=Qe;function tt(e){var t=-1,n=null==e?0:e.length;this.clear();while(++t<n){var r=e[t];this.set(r[0],r[1])}}tt.prototype.clear=qe,tt.prototype["delete"]=Ge,tt.prototype.get=Je,tt.prototype.has=Xe,tt.prototype.set=et;var nt=tt,rt=ye(m,"Map"),ot=rt;function it(){this.size=0,this.__data__={hash:new Me,map:new(ot||nt),string:new Me}}var st=it;function at(e){var t=typeof e;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==e:null===e}var ct=at;function lt(e,t){var n=e.__data__;return ct(t)?n["string"==typeof t?"string":"hash"]:n.map}var ut=lt;function dt(e){var t=ut(this,e)["delete"](e);return this.size-=t?1:0,t}var pt=dt;function ht(e){return ut(this,e).get(e)}var ft=ht;function gt(e){return ut(this,e).has(e)}var mt=gt;function vt(e,t){var n=ut(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}var yt=vt;function bt(e){var t=-1,n=null==e?0:e.length;this.clear();while(++t<n){var r=e[t];this.set(r[0],r[1])}}bt.prototype.clear=st,bt.prototype["delete"]=pt,bt.prototype.get=ft,bt.prototype.has=mt,bt.prototype.set=yt;var wt=bt,St="Expected a function";function Tt(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new TypeError(St);var n=function(){var r=arguments,o=t?t.apply(this,r):r[0],i=n.cache;if(i.has(o))return i.get(o);var s=e.apply(this,r);return n.cache=i.set(o,s)||i,s};return n.cache=new(Tt.Cache||wt),n}Tt.Cache=wt;var Ct=Tt,Et=500;function kt(e){var t=Ct(e,(function(e){return n.size===Et&&n.clear(),e})),n=t.cache;return t}var xt=kt,It=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Rt=/\\(\\)?/g,_t=xt((function(e){var t=[];return 46===e.charCodeAt(0)&&t.push(""),e.replace(It,(function(e,n,r,o){t.push(r?o.replace(Rt,"$1"):n||e)})),t})),Nt=_t;function At(e,t){var n=-1,r=null==e?0:e.length,o=Array(r);while(++n<r)o[n]=t(e[n],n,e);return o}var Ot=At,Pt=1/0,Dt=y?y.prototype:void 0,Bt=Dt?Dt.toString:void 0;function jt(e){if("string"==typeof e)return e;if(d(e))return Ot(e,jt)+"";if(M(e))return Bt?Bt.call(e):"";var t=e+"";return"0"==t&&1/e==-Pt?"-0":t}var Ht=jt;function Mt(e){return null==e?"":Ht(e)}var Lt=Mt;function qt(e,t){return d(e)?e:V(e,t)?[e]:Nt(Lt(e))}var $t=qt,Vt=1/0;function Ft(e){if("string"==typeof e||M(e))return e;var t=e+"";return"0"==t&&1/e==-Vt?"-0":t}var Ut=Ft;function zt(e,t){t=$t(t,e);var n=0,r=t.length;while(null!=e&&n<r)e=e[Ut(t[n++])];return n&&n==r?e:void 0}var Kt=zt;function Wt(e,t,n){var r=null==e?void 0:Kt(e,t);return void 0===r?n:r}var Gt=Wt,Yt={name:"en",el:{colorpicker:{confirm:"OK",clear:"Clear",defaultLabel:"color picker",description:"current color is {color}. press enter to select a new color."},datepicker:{now:"Now",today:"Today",cancel:"Cancel",clear:"Clear",confirm:"OK",dateTablePrompt:"Use the arrow keys and enter to select the day of the month",monthTablePrompt:"Use the arrow keys and enter to select the month",yearTablePrompt:"Use the arrow keys and enter to select the year",selectedDate:"Selected date",selectDate:"Select date",selectTime:"Select time",startDate:"Start Date",startTime:"Start Time",endDate:"End Date",endTime:"End Time",prevYear:"Previous Year",nextYear:"Next Year",prevMonth:"Previous Month",nextMonth:"Next Month",year:"",month1:"January",month2:"February",month3:"March",month4:"April",month5:"May",month6:"June",month7:"July",month8:"August",month9:"September",month10:"October",month11:"November",month12:"December",week:"week",weeks:{sun:"Sun",mon:"Mon",tue:"Tue",wed:"Wed",thu:"Thu",fri:"Fri",sat:"Sat"},weeksFull:{sun:"Sunday",mon:"Monday",tue:"Tuesday",wed:"Wednesday",thu:"Thursday",fri:"Friday",sat:"Saturday"},months:{jan:"Jan",feb:"Feb",mar:"Mar",apr:"Apr",may:"May",jun:"Jun",jul:"Jul",aug:"Aug",sep:"Sep",oct:"Oct",nov:"Nov",dec:"Dec"}},inputNumber:{decrease:"decrease number",increase:"increase number"},select:{loading:"Loading",noMatch:"No matching data",noData:"No data",placeholder:"Select"},dropdown:{toggleDropdown:"Toggle Dropdown"},cascader:{noMatch:"No matching data",loading:"Loading",placeholder:"Select",noData:"No data"},pagination:{goto:"Go to",pagesize:"/page",total:"Total {total}",pageClassifier:"",page:"Page",prev:"Go to previous page",next:"Go to next page",currentPage:"page {pager}",prevPages:"Previous {pager} pages",nextPages:"Next {pager} pages",deprecationWarning:"Deprecated usages detected, please refer to the el-pagination documentation for more details"},dialog:{close:"Close this dialog"},drawer:{close:"Close this dialog"},messagebox:{title:"Message",confirm:"OK",cancel:"Cancel",error:"Illegal input",close:"Close this dialog"},upload:{deleteTip:"press delete to remove",delete:"Delete",preview:"Preview",continue:"Continue"},slider:{defaultLabel:"slider between {min} and {max}",defaultRangeStartLabel:"pick start value",defaultRangeEndLabel:"pick end value"},table:{emptyText:"No Data",confirmFilter:"Confirm",resetFilter:"Reset",clearFilter:"All",sumText:"Sum"},tree:{emptyText:"No Data"},transfer:{noMatch:"No matching data",noData:"No data",titles:["List 1","List 2"],filterPlaceholder:"Enter keyword",noCheckedFormat:"{total} items",hasCheckedFormat:"{checked}/{total} checked"},image:{error:"FAILED"},pageHeader:{title:"Back"},popconfirm:{confirmButtonText:"Yes",cancelButtonText:"No"}}};const Jt=e=>(t,r)=>Zt(t,r,(0,n.unref)(e)),Zt=(e,t,n)=>Gt(n,e,e).replace(/\{(\w+)\}/g,((e,n)=>{var r;return`${null!=(r=null==t?void 0:t[n])?r:`{${n}}`}`})),Xt=e=>{const t=(0,n.computed)((()=>(0,n.unref)(e).name)),r=(0,n.isRef)(e)?e:(0,n.ref)(e);return{lang:t,locale:r,t:Jt(e)}},Qt=Symbol("localeContextKey"),en=e=>{const t=e||(0,n.inject)(Qt,(0,n.ref)());return Xt((0,n.computed)((()=>t.value||Yt)))};const tn=()=>{},nn=(Object.assign,Object.prototype.hasOwnProperty),rn=(e,t)=>nn.call(e,t),on=Array.isArray,sn=e=>"function"===typeof e,an=e=>"string"===typeof e,cn=e=>null!==e&&"object"===typeof e,ln=Object.prototype.toString,un=e=>ln.call(e),dn=e=>un(e).slice(8,-1),pn=e=>{const t=Object.create(null);return n=>{const r=t[n];return r||(t[n]=e(n))}},hn=/-(\w)/g,fn=(pn((e=>e.replace(hn,((e,t)=>t?t.toUpperCase():"")))),/\B([A-Z])/g),gn=(pn((e=>e.replace(fn,"-$1").toLowerCase())),pn((e=>e.charAt(0).toUpperCase()+e.slice(1))));pn((e=>e?`on${gn(e)}`:""));const mn=e=>void 0===e,vn=e=>"boolean"===typeof e,yn=e=>"number"===typeof e,bn=e=>"undefined"!==typeof Element&&e instanceof Element,wn=e=>!!an(e)&&!Number.isNaN(Number(e)),Sn=(0,n.ref)(0),Tn=2e3,Cn=Symbol("zIndexContextKey"),En=e=>{const t=e||((0,n.getCurrentInstance)()?(0,n.inject)(Cn,void 0):void 0),r=(0,n.computed)((()=>{const e=(0,n.unref)(t);return yn(e)?e:Tn})),o=(0,n.computed)((()=>r.value+Sn.value)),i=()=>(Sn.value++,o.value);return{initialZIndex:r,currentZIndex:o,nextZIndex:i}};class kn extends Error{constructor(e){super(e),this.name="ElementPlusError"}}function xn(e,t){throw new kn(`[${e}] ${t}`)}function In(e,t){0}function Rn(e){var t=-1,n=null==e?0:e.length,r={};while(++t<n){var o=e[t];r[o[0]]=o[1]}return r}var _n=Rn;const Nn="__epPropKey",An=e=>e,On=e=>cn(e)&&!!e[Nn],Pn=(e,t)=>{if(!cn(e)||On(e))return e;const{values:r,required:o,default:i,type:s,validator:a}=e,c=r||a?o=>{let s=!1,c=[];if(r&&(c=Array.from(r),rn(e,"default")&&c.push(i),s||(s=c.includes(o))),a&&(s||(s=a(o))),!s&&c.length>0){const e=[...new Set(c)].map((e=>JSON.stringify(e))).join(", ");(0,n.warn)(`Invalid prop: validation failed${t?` for prop "${t}"`:""}. Expected one of [${e}], got value ${JSON.stringify(o)}.`)}return s}:void 0,l={type:s,required:!!o,validator:c,[Nn]:!0};return rn(e,"default")&&(l.default=i),l},Dn=e=>_n(Object.entries(e).map((([e,t])=>[e,Pn(t,e)]))),Bn=["","default","small","large"],jn={large:40,default:32,small:24},Hn=Pn({type:String,values:Bn,required:!1}),Mn=Symbol("size"),Ln=()=>{const e=(0,n.inject)(Mn,{});return(0,n.computed)((()=>(0,n.unref)(e.size)||""))},qn=e=>Object.keys(e),$n=(0,n.ref)();function Vn(e,t=void 0){const o=(0,n.getCurrentInstance)()?(0,n.inject)(r,$n):$n;return e?(0,n.computed)((()=>{var n,r;return null!=(r=null==(n=o.value)?void 0:n[e])?r:t})):o}function Fn(e,t){const r=Vn(),i=l(e,(0,n.computed)((()=>{var e;return(null==(e=r.value)?void 0:e.namespace)||o}))),s=en((0,n.computed)((()=>{var e;return null==(e=r.value)?void 0:e.locale}))),a=En((0,n.computed)((()=>{var e;return(null==(e=r.value)?void 0:e.zIndex)||Tn}))),c=(0,n.computed)((()=>{var e;return(0,n.unref)(t)||(null==(e=r.value)?void 0:e.size)||""}));return Un((0,n.computed)((()=>(0,n.unref)(r)||{}))),{ns:i,locale:s,zIndex:a,size:c}}const Un=(e,t,o=!1)=>{var i;const s=!!(0,n.getCurrentInstance)(),c=s?Vn():void 0,l=null!=(i=null==t?void 0:t.provide)?i:s?n.provide:void 0;if(!l)return void In("provideGlobalConfig","provideGlobalConfig() can only be used inside setup().");const u=(0,n.computed)((()=>{const t=(0,n.unref)(e);return(null==c?void 0:c.value)?zn(c.value,t):t}));return l(r,u),l(Qt,(0,n.computed)((()=>u.value.locale))),l(a,(0,n.computed)((()=>u.value.namespace))),l(Cn,(0,n.computed)((()=>u.value.zIndex))),l(Mn,{size:(0,n.computed)((()=>u.value.size||""))}),!o&&$n.value||($n.value=u.value),u},zn=(e,t)=>{var n;const r=[...new Set([...qn(e),...qn(t)])],o={};for(const i of r)o[i]=null!=(n=t[i])?n:e[i];return o},Kn=Dn({a11y:{type:Boolean,default:!0},locale:{type:An(Object)},size:Hn,button:{type:An(Object)},experimentalFeatures:{type:An(Object)},keyboardNavigation:{type:Boolean,default:!0},message:{type:An(Object)},zIndex:Number,namespace:{type:String,default:"el"}}),Wn={},Gn=(0,n.defineComponent)({name:"ElConfigProvider",props:Kn,setup(e,{slots:t}){(0,n.watch)((()=>e.message),(e=>{Object.assign(Wn,null!=e?e:{})}),{immediate:!0,deep:!0});const r=Un(e);return()=>(0,n.renderSlot)(t,"default",{config:null==r?void 0:r.value})}}),Yn=(e,t)=>{if(e.install=n=>{for(const r of[e,...Object.values(null!=t?t:{})])n.component(r.name,r)},t)for(const[n,r]of Object.entries(t))e[n]=r;return e},Jn=(e,t)=>(e.install=n=>{e._context=n._context,n.config.globalProperties[t]=e},e),Zn=e=>(e.install=tn,e),Xn=Yn(Gn);function Qn(e,t,r,o,i,s){const a=(0,n.resolveComponent)("telephoneStrip"),c=Xn;return(0,n.openBlock)(),(0,n.createElementBlock)("div",null,[(0,n.createVNode)(c,{namespace:"ue"},{default:(0,n.withCtx)((()=>[(0,n.createVNode)(a)])),_:1})])}const er=Dn({size:{type:An([Number,String])},color:{type:String}});var tr=(e,t)=>{const n=e.__vccOpts||e;for(const[r,o]of t)n[r]=o;return n};const nr="utils/dom/style",rr=(e="")=>e.split(" ").filter((e=>!!e.trim())),or=(e,t)=>{e&&t.trim()&&e.classList.add(...rr(t))},ir=(e,t)=>{e&&t.trim()&&e.classList.remove(...rr(t))};function sr(e,t="px"){return e?yn(e)||wn(e)?`${e}${t}`:an(e)?e:void In(nr,"binding value must be a string or number"):""}const ar=(0,n.defineComponent)({name:"ElIcon",inheritAttrs:!1}),cr=(0,n.defineComponent)({...ar,props:er,setup(e){const t=e,r=l("icon"),o=(0,n.computed)((()=>{const{size:e,color:n}=t;return e||n?{fontSize:mn(e)?void 0:sr(e),"--color":n}:{}}));return(e,t)=>((0,n.openBlock)(),(0,n.createElementBlock)("i",(0,n.mergeProps)({class:(0,n.unref)(r).b(),style:(0,n.unref)(o)},e.$attrs),[(0,n.renderSlot)(e.$slots,"default")],16))}});var lr=tr(cr,[["__file","/home/runner/work/element-plus/element-plus/packages/components/icon/src/icon.vue"]]);const ur=Yn(lr),dr=Symbol("buttonGroupContextKey"),pr=({from:e,replacement:t,scope:r,version:o,ref:i,type:s="API"},a)=>{(0,n.watch)((()=>(0,n.unref)(a)),(n=>{n&&In(r,`[${s}] ${e} is about to be deprecated in version ${o}, please use ${t} instead.\nFor more detail, please visit: ${i}\n`)}),{immediate:!0})},hr=Symbol("formContextKey"),fr=Symbol("formItemContextKey");var gr,mr=Object.defineProperty,vr=Object.defineProperties,yr=Object.getOwnPropertyDescriptors,br=Object.getOwnPropertySymbols,wr=Object.prototype.hasOwnProperty,Sr=Object.prototype.propertyIsEnumerable,Tr=(e,t,n)=>t in e?mr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Cr=(e,t)=>{for(var n in t||(t={}))wr.call(t,n)&&Tr(e,n,t[n]);if(br)for(var n of br(t))Sr.call(t,n)&&Tr(e,n,t[n]);return e},Er=(e,t)=>vr(e,yr(t));function kr(e,t){var r;const o=(0,n.shallowRef)();return(0,n.watchEffect)((()=>{o.value=e()}),Er(Cr({},t),{flush:null!=(r=null==t?void 0:t.flush)?r:"sync"})),(0,n.readonly)(o)}const xr="undefined"!==typeof window,Ir=(Object.prototype.toString,e=>"string"===typeof e),Rr=()=>{},_r=xr&&(null==(gr=null==window?void 0:window.navigator)?void 0:gr.userAgent)&&/iP(ad|hone|od)/.test(window.navigator.userAgent);function Nr(e){return"function"===typeof e?e():(0,n.unref)(e)}function Ar(e){return e}function Or(e){return!!(0,n.getCurrentScope)()&&((0,n.onScopeDispose)(e),!0)}Object.defineProperty,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;Object.defineProperty,Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;function Pr(e,t=!0){(0,n.getCurrentInstance)()?(0,n.onMounted)(e):t?e():(0,n.nextTick)(e)}Object.defineProperty,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;function Dr(e,t,r={}){const{immediate:o=!0}=r,i=(0,n.ref)(!1);let s=null;function a(){s&&(clearTimeout(s),s=null)}function c(){i.value=!1,a()}function l(...n){a(),i.value=!0,s=setTimeout((()=>{i.value=!1,s=null,e(...n)}),Nr(t))}return o&&(i.value=!0,xr&&l()),Or(c),{isPending:(0,n.readonly)(i),start:l,stop:c}}Object.defineProperty,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;Object.defineProperty,Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;Object.defineProperty,Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;Object.defineProperty,Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;Object.defineProperty,Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;Object.defineProperty,Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;const Br={prefix:Math.floor(1e4*Math.random()),current:0},jr=Symbol("elIdInjection"),Hr=()=>(0,n.getCurrentInstance)()?(0,n.inject)(jr,Br):Br,Mr=e=>{const t=Hr();xr||t!==Br||In("IdInjection","Looks like you are using server rendering, you must provide a id provider to ensure the hydration process to be succeed\nusage: app.provide(ID_INJECTION_KEY, {\n prefix: number,\n current: number,\n})");const r=c(),o=(0,n.computed)((()=>(0,n.unref)(e)||`${r.value}-id-${t.prefix}-${t.current++}`));return o},Lr=()=>{const e=(0,n.inject)(hr,void 0),t=(0,n.inject)(fr,void 0);return{form:e,formItem:t}},qr=(e,{formItemContext:t,disableIdGeneration:r,disableIdManagement:o})=>{r||(r=(0,n.ref)(!1)),o||(o=(0,n.ref)(!1));const i=(0,n.ref)();let s;const a=(0,n.computed)((()=>{var n;return!!(!e.label&&t&&t.inputIds&&(null==(n=t.inputIds)?void 0:n.length)<=1)}));return(0,n.onMounted)((()=>{s=(0,n.watch)([(0,n.toRef)(e,"id"),r],(([e,n])=>{const r=null!=e?e:n?void 0:Mr().value;r!==i.value&&((null==t?void 0:t.removeInputId)&&(i.value&&t.removeInputId(i.value),(null==o?void 0:o.value)||n||!r||t.addInputId(r)),i.value=r)}),{immediate:!0})})),(0,n.onUnmounted)((()=>{s&&s(),(null==t?void 0:t.removeInputId)&&i.value&&t.removeInputId(i.value)})),{isLabeledByFormItem:a,inputId:i}},$r=e=>{const t=(0,n.getCurrentInstance)();return(0,n.computed)((()=>{var n,r;return null==(r=null==(n=null==t?void 0:t.proxy)?void 0:n.$props)?void 0:r[e]}))},Vr=(e,t={})=>{const r=(0,n.ref)(void 0),o=t.prop?r:$r("size"),i=t.global?r:Ln(),s=t.form?{size:void 0}:(0,n.inject)(hr,void 0),a=t.formItem?{size:void 0}:(0,n.inject)(fr,void 0);return(0,n.computed)((()=>o.value||(0,n.unref)(e)||(null==a?void 0:a.size)||(null==s?void 0:s.size)||i.value||""))},Fr=e=>{const t=$r("disabled"),r=(0,n.inject)(hr,void 0);return(0,n.computed)((()=>t.value||(0,n.unref)(e)||(null==r?void 0:r.disabled)||!1))},Ur=(e,t)=>{pr({from:"type.text",replacement:"link",version:"3.0.0",scope:"props",ref:"https://element-plus.org/en-US/component/button.html#button-attributes"},(0,n.computed)((()=>"text"===e.type)));const r=(0,n.inject)(dr,void 0),o=Vn("button"),{form:i}=Lr(),s=Vr((0,n.computed)((()=>null==r?void 0:r.size))),a=Fr(),c=(0,n.ref)(),l=(0,n.useSlots)(),u=(0,n.computed)((()=>e.type||(null==r?void 0:r.type)||"")),d=(0,n.computed)((()=>{var t,n,r;return null!=(r=null!=(n=e.autoInsertSpace)?n:null==(t=o.value)?void 0:t.autoInsertSpace)&&r})),p=(0,n.computed)((()=>"button"===e.tag?{ariaDisabled:a.value||e.loading,disabled:a.value||e.loading,autofocus:e.autofocus,type:e.nativeType}:{})),h=(0,n.computed)((()=>{var e;const t=null==(e=l.default)?void 0:e.call(l);if(d.value&&1===(null==t?void 0:t.length)){const e=t[0];if((null==e?void 0:e.type)===n.Text){const t=e.children;return/^\p{Unified_Ideograph}{2}$/u.test(t.trim())}}return!1})),f=n=>{"reset"===e.nativeType&&(null==i||i.resetFields()),t("click",n)};return{_disabled:a,_size:s,_type:u,_ref:c,_props:p,shouldAddSpace:h,handleClick:f}};
|
|
39
|
+
/*! Element Plus Icons Vue v2.1.0 */
|
|
40
|
+
var zr=(e,t)=>{let n=e.__vccOpts||e;for(let[r,o]of t)n[r]=o;return n};var Kr={name:"ArrowDown"},Wr={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},Gr=(0,n.createElementVNode)("path",{fill:"currentColor",d:"M831.872 340.864 512 652.672 192.128 340.864a30.592 30.592 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.712a29.12 29.12 0 0 0 0-41.728 30.592 30.592 0 0 0-42.752 0z"},null,-1),Yr=[Gr];function Jr(e,t,r,o,i,s){return(0,n.openBlock)(),(0,n.createElementBlock)("svg",Wr,Yr)}var Zr=zr(Kr,[["render",Jr],["__file","arrow-down.vue"]]);var Xr={name:"ArrowLeft"},Qr={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},eo=(0,n.createElementVNode)("path",{fill:"currentColor",d:"M609.408 149.376 277.76 489.6a32 32 0 0 0 0 44.672l331.648 340.352a29.12 29.12 0 0 0 41.728 0 30.592 30.592 0 0 0 0-42.752L339.264 511.936l311.872-319.872a30.592 30.592 0 0 0 0-42.688 29.12 29.12 0 0 0-41.728 0z"},null,-1),to=[eo];function no(e,t,r,o,i,s){return(0,n.openBlock)(),(0,n.createElementBlock)("svg",Qr,to)}var ro=zr(Xr,[["render",no],["__file","arrow-left.vue"]]);var oo={name:"ArrowRight"},io={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},so=(0,n.createElementVNode)("path",{fill:"currentColor",d:"M340.864 149.312a30.592 30.592 0 0 0 0 42.752L652.736 512 340.864 831.872a30.592 30.592 0 0 0 0 42.752 29.12 29.12 0 0 0 41.728 0L714.24 534.336a32 32 0 0 0 0-44.672L382.592 149.376a29.12 29.12 0 0 0-41.728 0z"},null,-1),ao=[so];function co(e,t,r,o,i,s){return(0,n.openBlock)(),(0,n.createElementBlock)("svg",io,ao)}var lo=zr(oo,[["render",co],["__file","arrow-right.vue"]]);var uo={name:"ArrowUp"},po={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},ho=(0,n.createElementVNode)("path",{fill:"currentColor",d:"m488.832 344.32-339.84 356.672a32 32 0 0 0 0 44.16l.384.384a29.44 29.44 0 0 0 42.688 0l320-335.872 319.872 335.872a29.44 29.44 0 0 0 42.688 0l.384-.384a32 32 0 0 0 0-44.16L535.168 344.32a32 32 0 0 0-46.336 0z"},null,-1),fo=[ho];function go(e,t,r,o,i,s){return(0,n.openBlock)(),(0,n.createElementBlock)("svg",po,fo)}var mo=zr(uo,[["render",go],["__file","arrow-up.vue"]]);var vo={name:"CaretRight"},yo={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},bo=(0,n.createElementVNode)("path",{fill:"currentColor",d:"M384 192v640l384-320.064z"},null,-1),wo=[bo];function So(e,t,r,o,i,s){return(0,n.openBlock)(),(0,n.createElementBlock)("svg",yo,wo)}var To=zr(vo,[["render",So],["__file","caret-right.vue"]]);var Co={name:"CircleCheck"},Eo={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},ko=(0,n.createElementVNode)("path",{fill:"currentColor",d:"M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768zm0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896z"},null,-1),xo=(0,n.createElementVNode)("path",{fill:"currentColor",d:"M745.344 361.344a32 32 0 0 1 45.312 45.312l-288 288a32 32 0 0 1-45.312 0l-160-160a32 32 0 1 1 45.312-45.312L480 626.752l265.344-265.408z"},null,-1),Io=[ko,xo];function Ro(e,t,r,o,i,s){return(0,n.openBlock)(),(0,n.createElementBlock)("svg",Eo,Io)}var _o=zr(Co,[["render",Ro],["__file","circle-check.vue"]]),No={name:"CircleCloseFilled"},Ao={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},Oo=(0,n.createElementVNode)("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm0 393.664L407.936 353.6a38.4 38.4 0 1 0-54.336 54.336L457.664 512 353.6 616.064a38.4 38.4 0 1 0 54.336 54.336L512 566.336 616.064 670.4a38.4 38.4 0 1 0 54.336-54.336L566.336 512 670.4 407.936a38.4 38.4 0 1 0-54.336-54.336L512 457.664z"},null,-1),Po=[Oo];function Do(e,t,r,o,i,s){return(0,n.openBlock)(),(0,n.createElementBlock)("svg",Ao,Po)}var Bo=zr(No,[["render",Do],["__file","circle-close-filled.vue"]]),jo={name:"CircleClose"},Ho={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},Mo=(0,n.createElementVNode)("path",{fill:"currentColor",d:"m466.752 512-90.496-90.496a32 32 0 0 1 45.248-45.248L512 466.752l90.496-90.496a32 32 0 1 1 45.248 45.248L557.248 512l90.496 90.496a32 32 0 1 1-45.248 45.248L512 557.248l-90.496 90.496a32 32 0 0 1-45.248-45.248L466.752 512z"},null,-1),Lo=(0,n.createElementVNode)("path",{fill:"currentColor",d:"M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768zm0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896z"},null,-1),qo=[Mo,Lo];function $o(e,t,r,o,i,s){return(0,n.openBlock)(),(0,n.createElementBlock)("svg",Ho,qo)}var Vo=zr(jo,[["render",$o],["__file","circle-close.vue"]]);var Fo={name:"Close"},Uo={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},zo=(0,n.createElementVNode)("path",{fill:"currentColor",d:"M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"},null,-1),Ko=[zo];function Wo(e,t,r,o,i,s){return(0,n.openBlock)(),(0,n.createElementBlock)("svg",Uo,Ko)}var Go=zr(Fo,[["render",Wo],["__file","close.vue"]]);var Yo={name:"Hide"},Jo={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},Zo=(0,n.createElementVNode)("path",{fill:"currentColor",d:"M876.8 156.8c0-9.6-3.2-16-9.6-22.4-6.4-6.4-12.8-9.6-22.4-9.6-9.6 0-16 3.2-22.4 9.6L736 220.8c-64-32-137.6-51.2-224-60.8-160 16-288 73.6-377.6 176C44.8 438.4 0 496 0 512s48 73.6 134.4 176c22.4 25.6 44.8 48 73.6 67.2l-86.4 89.6c-6.4 6.4-9.6 12.8-9.6 22.4 0 9.6 3.2 16 9.6 22.4 6.4 6.4 12.8 9.6 22.4 9.6 9.6 0 16-3.2 22.4-9.6l704-710.4c3.2-6.4 6.4-12.8 6.4-22.4Zm-646.4 528c-76.8-70.4-128-128-153.6-172.8 28.8-48 80-105.6 153.6-172.8C304 272 400 230.4 512 224c64 3.2 124.8 19.2 176 44.8l-54.4 54.4C598.4 300.8 560 288 512 288c-64 0-115.2 22.4-160 64s-64 96-64 160c0 48 12.8 89.6 35.2 124.8L256 707.2c-9.6-6.4-19.2-16-25.6-22.4Zm140.8-96c-12.8-22.4-19.2-48-19.2-76.8 0-44.8 16-83.2 48-112 32-28.8 67.2-48 112-48 28.8 0 54.4 6.4 73.6 19.2L371.2 588.8ZM889.599 336c-12.8-16-28.8-28.8-41.6-41.6l-48 48c73.6 67.2 124.8 124.8 150.4 169.6-28.8 48-80 105.6-153.6 172.8-73.6 67.2-172.8 108.8-284.8 115.2-51.2-3.2-99.2-12.8-140.8-28.8l-48 48c57.6 22.4 118.4 38.4 188.8 44.8 160-16 288-73.6 377.6-176C979.199 585.6 1024 528 1024 512s-48.001-73.6-134.401-176Z"},null,-1),Xo=(0,n.createElementVNode)("path",{fill:"currentColor",d:"M511.998 672c-12.8 0-25.6-3.2-38.4-6.4l-51.2 51.2c28.8 12.8 57.6 19.2 89.6 19.2 64 0 115.2-22.4 160-64 41.6-41.6 64-96 64-160 0-32-6.4-64-19.2-89.6l-51.2 51.2c3.2 12.8 6.4 25.6 6.4 38.4 0 44.8-16 83.2-48 112-32 28.8-67.2 48-112 48Z"},null,-1),Qo=[Zo,Xo];function ei(e,t,r,o,i,s){return(0,n.openBlock)(),(0,n.createElementBlock)("svg",Jo,Qo)}var ti=zr(Yo,[["render",ei],["__file","hide.vue"]]);var ni={name:"InfoFilled"},ri={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},oi=(0,n.createElementVNode)("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896.064A448 448 0 0 1 512 64zm67.2 275.072c33.28 0 60.288-23.104 60.288-57.344s-27.072-57.344-60.288-57.344c-33.28 0-60.16 23.104-60.16 57.344s26.88 57.344 60.16 57.344zM590.912 699.2c0-6.848 2.368-24.64 1.024-34.752l-52.608 60.544c-10.88 11.456-24.512 19.392-30.912 17.28a12.992 12.992 0 0 1-8.256-14.72l87.68-276.992c7.168-35.136-12.544-67.2-54.336-71.296-44.096 0-108.992 44.736-148.48 101.504 0 6.784-1.28 23.68.064 33.792l52.544-60.608c10.88-11.328 23.552-19.328 29.952-17.152a12.8 12.8 0 0 1 7.808 16.128L388.48 728.576c-10.048 32.256 8.96 63.872 55.04 71.04 67.84 0 107.904-43.648 147.456-100.416z"},null,-1),ii=[oi];function si(e,t,r,o,i,s){return(0,n.openBlock)(),(0,n.createElementBlock)("svg",ri,ii)}var ai=zr(ni,[["render",si],["__file","info-filled.vue"]]);var ci={name:"Loading"},li={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},ui=(0,n.createElementVNode)("path",{fill:"currentColor",d:"M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32zm0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32zm448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32zm-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32zM195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248zm452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248zM828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0zm-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0z"},null,-1),di=[ui];function pi(e,t,r,o,i,s){return(0,n.openBlock)(),(0,n.createElementBlock)("svg",li,di)}var hi=zr(ci,[["render",pi],["__file","loading.vue"]]);var fi={name:"Minus"},gi={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},mi=(0,n.createElementVNode)("path",{fill:"currentColor",d:"M128 544h768a32 32 0 1 0 0-64H128a32 32 0 0 0 0 64z"},null,-1),vi=[mi];function yi(e,t,r,o,i,s){return(0,n.openBlock)(),(0,n.createElementBlock)("svg",gi,vi)}var bi=zr(fi,[["render",yi],["__file","minus.vue"]]);var wi={name:"Plus"},Si={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},Ti=(0,n.createElementVNode)("path",{fill:"currentColor",d:"M480 480V128a32 32 0 0 1 64 0v352h352a32 32 0 1 1 0 64H544v352a32 32 0 1 1-64 0V544H128a32 32 0 0 1 0-64h352z"},null,-1),Ci=[Ti];function Ei(e,t,r,o,i,s){return(0,n.openBlock)(),(0,n.createElementBlock)("svg",Si,Ci)}var ki=zr(wi,[["render",Ei],["__file","plus.vue"]]);var xi={name:"SuccessFilled"},Ii={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},Ri=(0,n.createElementVNode)("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm-55.808 536.384-99.52-99.584a38.4 38.4 0 1 0-54.336 54.336l126.72 126.72a38.272 38.272 0 0 0 54.336 0l262.4-262.464a38.4 38.4 0 1 0-54.272-54.336L456.192 600.384z"},null,-1),_i=[Ri];function Ni(e,t,r,o,i,s){return(0,n.openBlock)(),(0,n.createElementBlock)("svg",Ii,_i)}var Ai=zr(xi,[["render",Ni],["__file","success-filled.vue"]]);var Oi={name:"View"},Pi={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},Di=(0,n.createElementVNode)("path",{fill:"currentColor",d:"M512 160c320 0 512 352 512 352S832 864 512 864 0 512 0 512s192-352 512-352zm0 64c-225.28 0-384.128 208.064-436.8 288 52.608 79.872 211.456 288 436.8 288 225.28 0 384.128-208.064 436.8-288-52.608-79.872-211.456-288-436.8-288zm0 64a224 224 0 1 1 0 448 224 224 0 0 1 0-448zm0 64a160.192 160.192 0 0 0-160 160c0 88.192 71.744 160 160 160s160-71.808 160-160-71.744-160-160-160z"},null,-1),Bi=[Di];function ji(e,t,r,o,i,s){return(0,n.openBlock)(),(0,n.createElementBlock)("svg",Pi,Bi)}var Hi=zr(Oi,[["render",ji],["__file","view.vue"]]);var Mi={name:"WarningFilled"},Li={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1024 1024"},qi=(0,n.createElementVNode)("path",{fill:"currentColor",d:"M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm0 192a58.432 58.432 0 0 0-58.24 63.744l23.36 256.384a35.072 35.072 0 0 0 69.76 0l23.296-256.384A58.432 58.432 0 0 0 512 256zm0 512a51.2 51.2 0 1 0 0-102.4 51.2 51.2 0 0 0 0 102.4z"},null,-1),$i=[qi];function Vi(e,t,r,o,i,s){return(0,n.openBlock)(),(0,n.createElementBlock)("svg",Li,$i)}var Fi=zr(Mi,[["render",Vi],["__file","warning-filled.vue"]]);const Ui=An([String,Object,Function]),zi={Close:Go,SuccessFilled:Ai,InfoFilled:ai,WarningFilled:Fi,CircleCloseFilled:Bo},Ki={success:Ai,warning:Fi,error:Bo,info:ai},Wi={validating:hi,success:_o,error:Vo},Gi=["default","primary","success","warning","info","danger","text",""],Yi=["button","submit","reset"],Ji=Dn({size:Hn,disabled:Boolean,type:{type:String,values:Gi,default:""},icon:{type:Ui},nativeType:{type:String,values:Yi,default:"button"},loading:Boolean,loadingIcon:{type:Ui,default:()=>hi},plain:Boolean,text:Boolean,link:Boolean,bg:Boolean,autofocus:Boolean,round:Boolean,circle:Boolean,color:String,dark:Boolean,autoInsertSpace:{type:Boolean,default:void 0},tag:{type:An([String,Object]),default:"button"}}),Zi={click:e=>e instanceof MouseEvent};function Xi(e,t){es(e)&&(e="100%");var n=ts(e);return e=360===t?e:Math.min(t,Math.max(0,parseFloat(e))),n&&(e=parseInt(String(e*t),10)/100),Math.abs(e-t)<1e-6?1:(e=360===t?(e<0?e%t+t:e%t)/parseFloat(String(t)):e%t/parseFloat(String(t)),e)}function Qi(e){return Math.min(1,Math.max(0,e))}function es(e){return"string"===typeof e&&-1!==e.indexOf(".")&&1===parseFloat(e)}function ts(e){return"string"===typeof e&&-1!==e.indexOf("%")}function ns(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function rs(e){return e<=1?"".concat(100*Number(e),"%"):e}function os(e){return 1===e.length?"0"+e:String(e)}function is(e,t,n){return{r:255*Xi(e,255),g:255*Xi(t,255),b:255*Xi(n,255)}}function ss(e,t,n){e=Xi(e,255),t=Xi(t,255),n=Xi(n,255);var r=Math.max(e,t,n),o=Math.min(e,t,n),i=0,s=0,a=(r+o)/2;if(r===o)s=0,i=0;else{var c=r-o;switch(s=a>.5?c/(2-r-o):c/(r+o),r){case e:i=(t-n)/c+(t<n?6:0);break;case t:i=(n-e)/c+2;break;case n:i=(e-t)/c+4;break;default:break}i/=6}return{h:i,s:s,l:a}}function as(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*n*(t-e):n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function cs(e,t,n){var r,o,i;if(e=Xi(e,360),t=Xi(t,100),n=Xi(n,100),0===t)o=n,i=n,r=n;else{var s=n<.5?n*(1+t):n+t-n*t,a=2*n-s;r=as(a,s,e+1/3),o=as(a,s,e),i=as(a,s,e-1/3)}return{r:255*r,g:255*o,b:255*i}}function ls(e,t,n){e=Xi(e,255),t=Xi(t,255),n=Xi(n,255);var r=Math.max(e,t,n),o=Math.min(e,t,n),i=0,s=r,a=r-o,c=0===r?0:a/r;if(r===o)i=0;else{switch(r){case e:i=(t-n)/a+(t<n?6:0);break;case t:i=(n-e)/a+2;break;case n:i=(e-t)/a+4;break;default:break}i/=6}return{h:i,s:c,v:s}}function us(e,t,n){e=6*Xi(e,360),t=Xi(t,100),n=Xi(n,100);var r=Math.floor(e),o=e-r,i=n*(1-t),s=n*(1-o*t),a=n*(1-(1-o)*t),c=r%6,l=[n,s,i,i,a,n][c],u=[a,n,n,s,i,i][c],d=[i,i,a,n,n,s][c];return{r:255*l,g:255*u,b:255*d}}function ds(e,t,n,r){var o=[os(Math.round(e).toString(16)),os(Math.round(t).toString(16)),os(Math.round(n).toString(16))];return r&&o[0].startsWith(o[0].charAt(1))&&o[1].startsWith(o[1].charAt(1))&&o[2].startsWith(o[2].charAt(1))?o[0].charAt(0)+o[1].charAt(0)+o[2].charAt(0):o.join("")}function ps(e,t,n,r,o){var i=[os(Math.round(e).toString(16)),os(Math.round(t).toString(16)),os(Math.round(n).toString(16)),os(hs(r))];return o&&i[0].startsWith(i[0].charAt(1))&&i[1].startsWith(i[1].charAt(1))&&i[2].startsWith(i[2].charAt(1))&&i[3].startsWith(i[3].charAt(1))?i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0)+i[3].charAt(0):i.join("")}function hs(e){return Math.round(255*parseFloat(e)).toString(16)}function fs(e){return gs(e)/255}function gs(e){return parseInt(e,16)}function ms(e){return{r:e>>16,g:(65280&e)>>8,b:255&e}}var vs={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",goldenrod:"#daa520",gold:"#ffd700",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavenderblush:"#fff0f5",lavender:"#e6e6fa",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};function ys(e){var t={r:0,g:0,b:0},n=1,r=null,o=null,i=null,s=!1,a=!1;return"string"===typeof e&&(e=ks(e)),"object"===typeof e&&(xs(e.r)&&xs(e.g)&&xs(e.b)?(t=is(e.r,e.g,e.b),s=!0,a="%"===String(e.r).substr(-1)?"prgb":"rgb"):xs(e.h)&&xs(e.s)&&xs(e.v)?(r=rs(e.s),o=rs(e.v),t=us(e.h,r,o),s=!0,a="hsv"):xs(e.h)&&xs(e.s)&&xs(e.l)&&(r=rs(e.s),i=rs(e.l),t=cs(e.h,r,i),s=!0,a="hsl"),Object.prototype.hasOwnProperty.call(e,"a")&&(n=e.a)),n=ns(n),{ok:s,format:e.format||a,r:Math.min(255,Math.max(t.r,0)),g:Math.min(255,Math.max(t.g,0)),b:Math.min(255,Math.max(t.b,0)),a:n}}var bs="[-\\+]?\\d+%?",ws="[-\\+]?\\d*\\.\\d+%?",Ss="(?:".concat(ws,")|(?:").concat(bs,")"),Ts="[\\s|\\(]+(".concat(Ss,")[,|\\s]+(").concat(Ss,")[,|\\s]+(").concat(Ss,")\\s*\\)?"),Cs="[\\s|\\(]+(".concat(Ss,")[,|\\s]+(").concat(Ss,")[,|\\s]+(").concat(Ss,")[,|\\s]+(").concat(Ss,")\\s*\\)?"),Es={CSS_UNIT:new RegExp(Ss),rgb:new RegExp("rgb"+Ts),rgba:new RegExp("rgba"+Cs),hsl:new RegExp("hsl"+Ts),hsla:new RegExp("hsla"+Cs),hsv:new RegExp("hsv"+Ts),hsva:new RegExp("hsva"+Cs),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/};function ks(e){if(e=e.trim().toLowerCase(),0===e.length)return!1;var t=!1;if(vs[e])e=vs[e],t=!0;else if("transparent"===e)return{r:0,g:0,b:0,a:0,format:"name"};var n=Es.rgb.exec(e);return n?{r:n[1],g:n[2],b:n[3]}:(n=Es.rgba.exec(e),n?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=Es.hsl.exec(e),n?{h:n[1],s:n[2],l:n[3]}:(n=Es.hsla.exec(e),n?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=Es.hsv.exec(e),n?{h:n[1],s:n[2],v:n[3]}:(n=Es.hsva.exec(e),n?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=Es.hex8.exec(e),n?{r:gs(n[1]),g:gs(n[2]),b:gs(n[3]),a:fs(n[4]),format:t?"name":"hex8"}:(n=Es.hex6.exec(e),n?{r:gs(n[1]),g:gs(n[2]),b:gs(n[3]),format:t?"name":"hex"}:(n=Es.hex4.exec(e),n?{r:gs(n[1]+n[1]),g:gs(n[2]+n[2]),b:gs(n[3]+n[3]),a:fs(n[4]+n[4]),format:t?"name":"hex8"}:(n=Es.hex3.exec(e),!!n&&{r:gs(n[1]+n[1]),g:gs(n[2]+n[2]),b:gs(n[3]+n[3]),format:t?"name":"hex"})))))))))}function xs(e){return Boolean(Es.CSS_UNIT.exec(String(e)))}var Is=function(){function e(t,n){var r;if(void 0===t&&(t=""),void 0===n&&(n={}),t instanceof e)return t;"number"===typeof t&&(t=ms(t)),this.originalInput=t;var o=ys(t);this.originalInput=t,this.r=o.r,this.g=o.g,this.b=o.b,this.a=o.a,this.roundA=Math.round(100*this.a)/100,this.format=null!==(r=n.format)&&void 0!==r?r:o.format,this.gradientType=n.gradientType,this.r<1&&(this.r=Math.round(this.r)),this.g<1&&(this.g=Math.round(this.g)),this.b<1&&(this.b=Math.round(this.b)),this.isValid=o.ok}return e.prototype.isDark=function(){return this.getBrightness()<128},e.prototype.isLight=function(){return!this.isDark()},e.prototype.getBrightness=function(){var e=this.toRgb();return(299*e.r+587*e.g+114*e.b)/1e3},e.prototype.getLuminance=function(){var e,t,n,r=this.toRgb(),o=r.r/255,i=r.g/255,s=r.b/255;return e=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),t=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),n=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),.2126*e+.7152*t+.0722*n},e.prototype.getAlpha=function(){return this.a},e.prototype.setAlpha=function(e){return this.a=ns(e),this.roundA=Math.round(100*this.a)/100,this},e.prototype.isMonochrome=function(){var e=this.toHsl().s;return 0===e},e.prototype.toHsv=function(){var e=ls(this.r,this.g,this.b);return{h:360*e.h,s:e.s,v:e.v,a:this.a}},e.prototype.toHsvString=function(){var e=ls(this.r,this.g,this.b),t=Math.round(360*e.h),n=Math.round(100*e.s),r=Math.round(100*e.v);return 1===this.a?"hsv(".concat(t,", ").concat(n,"%, ").concat(r,"%)"):"hsva(".concat(t,", ").concat(n,"%, ").concat(r,"%, ").concat(this.roundA,")")},e.prototype.toHsl=function(){var e=ss(this.r,this.g,this.b);return{h:360*e.h,s:e.s,l:e.l,a:this.a}},e.prototype.toHslString=function(){var e=ss(this.r,this.g,this.b),t=Math.round(360*e.h),n=Math.round(100*e.s),r=Math.round(100*e.l);return 1===this.a?"hsl(".concat(t,", ").concat(n,"%, ").concat(r,"%)"):"hsla(".concat(t,", ").concat(n,"%, ").concat(r,"%, ").concat(this.roundA,")")},e.prototype.toHex=function(e){return void 0===e&&(e=!1),ds(this.r,this.g,this.b,e)},e.prototype.toHexString=function(e){return void 0===e&&(e=!1),"#"+this.toHex(e)},e.prototype.toHex8=function(e){return void 0===e&&(e=!1),ps(this.r,this.g,this.b,this.a,e)},e.prototype.toHex8String=function(e){return void 0===e&&(e=!1),"#"+this.toHex8(e)},e.prototype.toHexShortString=function(e){return void 0===e&&(e=!1),1===this.a?this.toHexString(e):this.toHex8String(e)},e.prototype.toRgb=function(){return{r:Math.round(this.r),g:Math.round(this.g),b:Math.round(this.b),a:this.a}},e.prototype.toRgbString=function(){var e=Math.round(this.r),t=Math.round(this.g),n=Math.round(this.b);return 1===this.a?"rgb(".concat(e,", ").concat(t,", ").concat(n,")"):"rgba(".concat(e,", ").concat(t,", ").concat(n,", ").concat(this.roundA,")")},e.prototype.toPercentageRgb=function(){var e=function(e){return"".concat(Math.round(100*Xi(e,255)),"%")};return{r:e(this.r),g:e(this.g),b:e(this.b),a:this.a}},e.prototype.toPercentageRgbString=function(){var e=function(e){return Math.round(100*Xi(e,255))};return 1===this.a?"rgb(".concat(e(this.r),"%, ").concat(e(this.g),"%, ").concat(e(this.b),"%)"):"rgba(".concat(e(this.r),"%, ").concat(e(this.g),"%, ").concat(e(this.b),"%, ").concat(this.roundA,")")},e.prototype.toName=function(){if(0===this.a)return"transparent";if(this.a<1)return!1;for(var e="#"+ds(this.r,this.g,this.b,!1),t=0,n=Object.entries(vs);t<n.length;t++){var r=n[t],o=r[0],i=r[1];if(e===i)return o}return!1},e.prototype.toString=function(e){var t=Boolean(e);e=null!==e&&void 0!==e?e:this.format;var n=!1,r=this.a<1&&this.a>=0,o=!t&&r&&(e.startsWith("hex")||"name"===e);return o?"name"===e&&0===this.a?this.toName():this.toRgbString():("rgb"===e&&(n=this.toRgbString()),"prgb"===e&&(n=this.toPercentageRgbString()),"hex"!==e&&"hex6"!==e||(n=this.toHexString()),"hex3"===e&&(n=this.toHexString(!0)),"hex4"===e&&(n=this.toHex8String(!0)),"hex8"===e&&(n=this.toHex8String()),"name"===e&&(n=this.toName()),"hsl"===e&&(n=this.toHslString()),"hsv"===e&&(n=this.toHsvString()),n||this.toHexString())},e.prototype.toNumber=function(){return(Math.round(this.r)<<16)+(Math.round(this.g)<<8)+Math.round(this.b)},e.prototype.clone=function(){return new e(this.toString())},e.prototype.lighten=function(t){void 0===t&&(t=10);var n=this.toHsl();return n.l+=t/100,n.l=Qi(n.l),new e(n)},e.prototype.brighten=function(t){void 0===t&&(t=10);var n=this.toRgb();return n.r=Math.max(0,Math.min(255,n.r-Math.round(-t/100*255))),n.g=Math.max(0,Math.min(255,n.g-Math.round(-t/100*255))),n.b=Math.max(0,Math.min(255,n.b-Math.round(-t/100*255))),new e(n)},e.prototype.darken=function(t){void 0===t&&(t=10);var n=this.toHsl();return n.l-=t/100,n.l=Qi(n.l),new e(n)},e.prototype.tint=function(e){return void 0===e&&(e=10),this.mix("white",e)},e.prototype.shade=function(e){return void 0===e&&(e=10),this.mix("black",e)},e.prototype.desaturate=function(t){void 0===t&&(t=10);var n=this.toHsl();return n.s-=t/100,n.s=Qi(n.s),new e(n)},e.prototype.saturate=function(t){void 0===t&&(t=10);var n=this.toHsl();return n.s+=t/100,n.s=Qi(n.s),new e(n)},e.prototype.greyscale=function(){return this.desaturate(100)},e.prototype.spin=function(t){var n=this.toHsl(),r=(n.h+t)%360;return n.h=r<0?360+r:r,new e(n)},e.prototype.mix=function(t,n){void 0===n&&(n=50);var r=this.toRgb(),o=new e(t).toRgb(),i=n/100,s={r:(o.r-r.r)*i+r.r,g:(o.g-r.g)*i+r.g,b:(o.b-r.b)*i+r.b,a:(o.a-r.a)*i+r.a};return new e(s)},e.prototype.analogous=function(t,n){void 0===t&&(t=6),void 0===n&&(n=30);var r=this.toHsl(),o=360/n,i=[this];for(r.h=(r.h-(o*t>>1)+720)%360;--t;)r.h=(r.h+o)%360,i.push(new e(r));return i},e.prototype.complement=function(){var t=this.toHsl();return t.h=(t.h+180)%360,new e(t)},e.prototype.monochromatic=function(t){void 0===t&&(t=6);var n=this.toHsv(),r=n.h,o=n.s,i=n.v,s=[],a=1/t;while(t--)s.push(new e({h:r,s:o,v:i})),i=(i+a)%1;return s},e.prototype.splitcomplement=function(){var t=this.toHsl(),n=t.h;return[this,new e({h:(n+72)%360,s:t.s,l:t.l}),new e({h:(n+216)%360,s:t.s,l:t.l})]},e.prototype.onBackground=function(t){var n=this.toRgb(),r=new e(t).toRgb(),o=n.a+r.a*(1-n.a);return new e({r:(n.r*n.a+r.r*r.a*(1-n.a))/o,g:(n.g*n.a+r.g*r.a*(1-n.a))/o,b:(n.b*n.a+r.b*r.a*(1-n.a))/o,a:o})},e.prototype.triad=function(){return this.polyad(3)},e.prototype.tetrad=function(){return this.polyad(4)},e.prototype.polyad=function(t){for(var n=this.toHsl(),r=n.h,o=[this],i=360/t,s=1;s<t;s++)o.push(new e({h:(r+s*i)%360,s:n.s,l:n.l}));return o},e.prototype.equals=function(t){return this.toRgbString()===new e(t).toRgbString()},e}();function Rs(e,t=20){return e.mix("#141414",t).toString()}function _s(e){const t=Fr(),r=l("button");return(0,n.computed)((()=>{let n={};const o=e.color;if(o){const i=new Is(o),s=e.dark?i.tint(20).toString():Rs(i,20);if(e.plain)n=r.cssVarBlock({"bg-color":e.dark?Rs(i,90):i.tint(90).toString(),"text-color":o,"border-color":e.dark?Rs(i,50):i.tint(50).toString(),"hover-text-color":`var(${r.cssVarName("color-white")})`,"hover-bg-color":o,"hover-border-color":o,"active-bg-color":s,"active-text-color":`var(${r.cssVarName("color-white")})`,"active-border-color":s}),t.value&&(n[r.cssVarBlockName("disabled-bg-color")]=e.dark?Rs(i,90):i.tint(90).toString(),n[r.cssVarBlockName("disabled-text-color")]=e.dark?Rs(i,50):i.tint(50).toString(),n[r.cssVarBlockName("disabled-border-color")]=e.dark?Rs(i,80):i.tint(80).toString());else{const a=e.dark?Rs(i,30):i.tint(30).toString(),c=i.isDark()?`var(${r.cssVarName("color-white")})`:`var(${r.cssVarName("color-black")})`;if(n=r.cssVarBlock({"bg-color":o,"text-color":c,"border-color":o,"hover-bg-color":a,"hover-text-color":c,"hover-border-color":a,"active-bg-color":s,"active-border-color":s}),t.value){const t=e.dark?Rs(i,50):i.tint(50).toString();n[r.cssVarBlockName("disabled-bg-color")]=t,n[r.cssVarBlockName("disabled-text-color")]=e.dark?"rgba(255, 255, 255, 0.5)":`var(${r.cssVarName("color-white")})`,n[r.cssVarBlockName("disabled-border-color")]=t}}}return n}))}const Ns=(0,n.defineComponent)({name:"ElButton"}),As=(0,n.defineComponent)({...Ns,props:Ji,emits:Zi,setup(e,{expose:t,emit:r}){const o=e,i=_s(o),s=l("button"),{_ref:a,_size:c,_type:u,_disabled:d,_props:p,shouldAddSpace:h,handleClick:f}=Ur(o,r);return t({ref:a,size:c,type:u,disabled:d,shouldAddSpace:h}),(e,t)=>((0,n.openBlock)(),(0,n.createBlock)((0,n.resolveDynamicComponent)(e.tag),(0,n.mergeProps)({ref_key:"_ref",ref:a},(0,n.unref)(p),{class:[(0,n.unref)(s).b(),(0,n.unref)(s).m((0,n.unref)(u)),(0,n.unref)(s).m((0,n.unref)(c)),(0,n.unref)(s).is("disabled",(0,n.unref)(d)),(0,n.unref)(s).is("loading",e.loading),(0,n.unref)(s).is("plain",e.plain),(0,n.unref)(s).is("round",e.round),(0,n.unref)(s).is("circle",e.circle),(0,n.unref)(s).is("text",e.text),(0,n.unref)(s).is("link",e.link),(0,n.unref)(s).is("has-bg",e.bg)],style:(0,n.unref)(i),onClick:(0,n.unref)(f)}),{default:(0,n.withCtx)((()=>[e.loading?((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:0},[e.$slots.loading?(0,n.renderSlot)(e.$slots,"loading",{key:0}):((0,n.openBlock)(),(0,n.createBlock)((0,n.unref)(ur),{key:1,class:(0,n.normalizeClass)((0,n.unref)(s).is("loading"))},{default:(0,n.withCtx)((()=>[((0,n.openBlock)(),(0,n.createBlock)((0,n.resolveDynamicComponent)(e.loadingIcon)))])),_:1},8,["class"]))],64)):e.icon||e.$slots.icon?((0,n.openBlock)(),(0,n.createBlock)((0,n.unref)(ur),{key:1},{default:(0,n.withCtx)((()=>[e.icon?((0,n.openBlock)(),(0,n.createBlock)((0,n.resolveDynamicComponent)(e.icon),{key:0})):(0,n.renderSlot)(e.$slots,"icon",{key:1})])),_:3})):(0,n.createCommentVNode)("v-if",!0),e.$slots.default?((0,n.openBlock)(),(0,n.createElementBlock)("span",{key:2,class:(0,n.normalizeClass)({[(0,n.unref)(s).em("text","expand")]:(0,n.unref)(h)})},[(0,n.renderSlot)(e.$slots,"default")],2)):(0,n.createCommentVNode)("v-if",!0)])),_:3},16,["class","style","onClick"]))}});var Os=tr(As,[["__file","/home/runner/work/element-plus/element-plus/packages/components/button/src/button.vue"]]);const Ps={size:Ji.size,type:Ji.type},Ds=(0,n.defineComponent)({name:"ElButtonGroup"}),Bs=(0,n.defineComponent)({...Ds,props:Ps,setup(e){const t=e;(0,n.provide)(dr,(0,n.reactive)({size:(0,n.toRef)(t,"size"),type:(0,n.toRef)(t,"type")}));const r=l("button");return(e,t)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{class:(0,n.normalizeClass)(`${(0,n.unref)(r).b("group")}`)},[(0,n.renderSlot)(e.$slots,"default")],2))}});var js=tr(Bs,[["__file","/home/runner/work/element-plus/element-plus/packages/components/button/src/button-group.vue"]]);const Hs=Yn(Os,{ButtonGroup:js});Zn(js);function Ms(e){return null==e}var Ls=Ms;function qs(e){var t;const n=Nr(e);return null!=(t=null==n?void 0:n.$el)?t:n}const $s=xr?window:void 0,Vs=xr?window.document:void 0;xr&&window.navigator,xr&&window.location;function Fs(...e){let t,r,o,i;if(Ir(e[0])||Array.isArray(e[0])?([r,o,i]=e,t=$s):[t,r,o,i]=e,!t)return Rr;Array.isArray(r)||(r=[r]),Array.isArray(o)||(o=[o]);const s=[],a=()=>{s.forEach((e=>e())),s.length=0},c=(e,t,n,r)=>(e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)),l=(0,n.watch)((()=>[qs(t),Nr(i)]),(([e,t])=>{a(),e&&s.push(...r.flatMap((n=>o.map((r=>c(e,n,r,t))))))}),{immediate:!0,flush:"post"}),u=()=>{l(),a()};return Or(u),u}let Us=!1;function zs(e,t,n={}){const{window:r=$s,ignore:o=[],capture:i=!0,detectIframe:s=!1}=n;if(!r)return;_r&&!Us&&(Us=!0,Array.from(r.document.body.children).forEach((e=>e.addEventListener("click",Rr))));let a=!0;const c=e=>o.some((t=>{if("string"===typeof t)return Array.from(r.document.querySelectorAll(t)).some((t=>t===e.target||e.composedPath().includes(t)));{const n=qs(t);return n&&(e.target===n||e.composedPath().includes(n))}})),l=n=>{const r=qs(e);r&&r!==n.target&&!n.composedPath().includes(r)&&(0===n.detail&&(a=!c(n)),a?t(n):a=!0)},u=[Fs(r,"click",l,{passive:!0,capture:i}),Fs(r,"pointerdown",(t=>{const n=qs(e);n&&(a=!t.composedPath().includes(n)&&!c(t))}),{passive:!0}),s&&Fs(r,"blur",(n=>{var o;const i=qs(e);"IFRAME"!==(null==(o=r.document.activeElement)?void 0:o.tagName)||(null==i?void 0:i.contains(r.document.activeElement))||t(n)}))].filter(Boolean),d=()=>u.forEach((e=>e()));return d}Object.defineProperty,Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;function Ks(e,t=!1){const r=(0,n.ref)(),o=()=>r.value=Boolean(e());return o(),Pr(o,t),r}Object.defineProperty,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;Object.defineProperty,Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;const Ws="undefined"!==typeof globalThis?globalThis:"undefined"!==typeof window?window:"undefined"!==typeof global?global:"undefined"!==typeof self?self:{},Gs="__vueuse_ssr_handlers__";Ws[Gs]=Ws[Gs]||{};Ws[Gs];Object.defineProperty,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;Object.defineProperty,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;Object.defineProperty,Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;Object.defineProperty,Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;Object.defineProperty,Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;function Ys({document:e=Vs}={}){if(!e)return(0,n.ref)("visible");const t=(0,n.ref)(e.visibilityState);return Fs(e,"visibilitychange",(()=>{t.value=e.visibilityState})),t}Object.defineProperty,Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;var Js=Object.getOwnPropertySymbols,Zs=Object.prototype.hasOwnProperty,Xs=Object.prototype.propertyIsEnumerable,Qs=(e,t)=>{var n={};for(var r in e)Zs.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&Js)for(var r of Js(e))t.indexOf(r)<0&&Xs.call(e,r)&&(n[r]=e[r]);return n};function ea(e,t,r={}){const o=r,{window:i=$s}=o,s=Qs(o,["window"]);let a;const c=Ks((()=>i&&"ResizeObserver"in i)),l=()=>{a&&(a.disconnect(),a=void 0)},u=(0,n.watch)((()=>qs(e)),(e=>{l(),c.value&&i&&e&&(a=new ResizeObserver(t),a.observe(e,s))}),{immediate:!0,flush:"post"}),d=()=>{l(),u()};return Or(d),{isSupported:c,stop:d}}Object.defineProperty,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;new Map;Object.defineProperty,Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;Object.defineProperty,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;Object.defineProperty,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;Object.defineProperty,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;Object.defineProperty,Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;Object.defineProperty,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;Object.defineProperty,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;Object.defineProperty,Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;var ta;(function(e){e["UP"]="UP",e["RIGHT"]="RIGHT",e["DOWN"]="DOWN",e["LEFT"]="LEFT",e["NONE"]="NONE"})(ta||(ta={}));Object.defineProperty,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;Object.defineProperty,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;Object.defineProperty,Object.defineProperties,Object.getOwnPropertyDescriptors,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;Object.defineProperty,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;Object.defineProperty,Object.getOwnPropertySymbols,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;var na=Object.defineProperty,ra=Object.getOwnPropertySymbols,oa=Object.prototype.hasOwnProperty,ia=Object.prototype.propertyIsEnumerable,sa=(e,t,n)=>t in e?na(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,aa=(e,t)=>{for(var n in t||(t={}))oa.call(t,n)&&sa(e,n,t[n]);if(ra)for(var n of ra(t))ia.call(t,n)&&sa(e,n,t[n]);return e};const ca={easeInSine:[.12,0,.39,0],easeOutSine:[.61,1,.88,1],easeInOutSine:[.37,0,.63,1],easeInQuad:[.11,0,.5,0],easeOutQuad:[.5,1,.89,1],easeInOutQuad:[.45,0,.55,1],easeInCubic:[.32,0,.67,0],easeOutCubic:[.33,1,.68,1],easeInOutCubic:[.65,0,.35,1],easeInQuart:[.5,0,.75,0],easeOutQuart:[.25,1,.5,1],easeInOutQuart:[.76,0,.24,1],easeInQuint:[.64,0,.78,0],easeOutQuint:[.22,1,.36,1],easeInOutQuint:[.83,0,.17,1],easeInExpo:[.7,0,.84,0],easeOutExpo:[.16,1,.3,1],easeInOutExpo:[.87,0,.13,1],easeInCirc:[.55,0,1,.45],easeOutCirc:[0,.55,.45,1],easeInOutCirc:[.85,0,.15,1],easeInBack:[.36,0,.66,-.56],easeOutBack:[.34,1.56,.64,1],easeInOutBack:[.68,-.6,.32,1.6]};aa({linear:Ar},ca);function la({window:e=$s}={}){if(!e)return(0,n.ref)(!1);const t=(0,n.ref)(e.document.hasFocus());return Fs(e,"blur",(()=>{t.value=!1})),Fs(e,"focus",(()=>{t.value=!0})),t}const ua=()=>xr&&/firefox/i.test(window.navigator.userAgent);let da;const pa=`\n height:0 !important;\n visibility:hidden !important;\n ${ua()?"":"overflow:hidden !important;"}\n position:absolute !important;\n z-index:-1000 !important;\n top:0 !important;\n right:0 !important;\n`,ha=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing"];function fa(e){const t=window.getComputedStyle(e),n=t.getPropertyValue("box-sizing"),r=Number.parseFloat(t.getPropertyValue("padding-bottom"))+Number.parseFloat(t.getPropertyValue("padding-top")),o=Number.parseFloat(t.getPropertyValue("border-bottom-width"))+Number.parseFloat(t.getPropertyValue("border-top-width")),i=ha.map((e=>`${e}:${t.getPropertyValue(e)}`)).join(";");return{contextStyle:i,paddingSize:r,borderSize:o,boxSizing:n}}function ga(e,t=1,n){var r;da||(da=document.createElement("textarea"),document.body.appendChild(da));const{paddingSize:o,borderSize:i,boxSizing:s,contextStyle:a}=fa(e);da.setAttribute("style",`${a};${pa}`),da.value=e.value||e.placeholder||"";let c=da.scrollHeight;const l={};"border-box"===s?c+=i:"content-box"===s&&(c-=o),da.value="";const u=da.scrollHeight-o;if(yn(t)){let e=u*t;"border-box"===s&&(e=e+o+i),c=Math.max(e,c),l.minHeight=`${e}px`}if(yn(n)){let e=u*n;"border-box"===s&&(e=e+o+i),c=Math.min(e,c)}return l.height=`${c}px`,null==(r=da.parentNode)||r.removeChild(da),da=void 0,l}const ma=e=>e,va="update:modelValue",ya="change",ba="input",wa=Dn({id:{type:String,default:void 0},size:Hn,disabled:Boolean,modelValue:{type:An([String,Number,Object]),default:""},type:{type:String,default:"text"},resize:{type:String,values:["none","both","horizontal","vertical"]},autosize:{type:An([Boolean,Object]),default:!1},autocomplete:{type:String,default:"off"},formatter:{type:Function},parser:{type:Function},placeholder:{type:String},form:{type:String},readonly:{type:Boolean,default:!1},clearable:{type:Boolean,default:!1},showPassword:{type:Boolean,default:!1},showWordLimit:{type:Boolean,default:!1},suffixIcon:{type:Ui},prefixIcon:{type:Ui},containerRole:{type:String,default:void 0},label:{type:String,default:void 0},tabindex:{type:[String,Number],default:0},validateEvent:{type:Boolean,default:!0},inputStyle:{type:An([Object,Array,String]),default:()=>ma({})},autofocus:{type:Boolean,default:!1}}),Sa={[va]:e=>an(e),input:e=>an(e),change:e=>an(e),focus:e=>e instanceof FocusEvent,blur:e=>e instanceof FocusEvent,clear:()=>!0,mouseleave:e=>e instanceof MouseEvent,mouseenter:e=>e instanceof MouseEvent,keydown:e=>e instanceof Event,compositionstart:e=>e instanceof CompositionEvent,compositionupdate:e=>e instanceof CompositionEvent,compositionend:e=>e instanceof CompositionEvent},Ta=["class","style"],Ca=/^on[A-Z]/,Ea=(e={})=>{const{excludeListeners:t=!1,excludeKeys:r}=e,o=(0,n.computed)((()=>((null==r?void 0:r.value)||[]).concat(Ta))),i=(0,n.getCurrentInstance)();return i?(0,n.computed)((()=>{var e;return _n(Object.entries(null==(e=i.proxy)?void 0:e.$attrs).filter((([e])=>!o.value.includes(e)&&!(t&&Ca.test(e)))))})):(In("use-attrs","getCurrentInstance() returned null. useAttrs() must be called at the top of a setup function"),(0,n.computed)((()=>({}))))};function ka(e,{afterFocus:t,afterBlur:r}={}){const o=(0,n.getCurrentInstance)(),{emit:i}=o,s=(0,n.shallowRef)(),a=(0,n.ref)(!1),c=e=>{a.value||(a.value=!0,i("focus",e),null==t||t())},l=e=>{var t;e.relatedTarget&&(null==(t=s.value)?void 0:t.contains(e.relatedTarget))||(a.value=!1,i("blur",e),null==r||r())},u=()=>{var t;null==(t=e.value)||t.focus()};return(0,n.watch)(s,(e=>{e&&e.setAttribute("tabindex","-1")})),Fs(s,"click",u),{wrapperRef:s,isFocused:a,handleFocus:c,handleBlur:l}}function xa(e){const t=(0,n.ref)();function r(){if(void 0==e.value)return;const{selectionStart:n,selectionEnd:r,value:o}=e.value;if(null==n||null==r)return;const i=o.slice(0,Math.max(0,n)),s=o.slice(Math.max(0,r));t.value={selectionStart:n,selectionEnd:r,value:o,beforeTxt:i,afterTxt:s}}function o(){if(void 0==e.value||void 0==t.value)return;const{value:n}=e.value,{beforeTxt:r,afterTxt:o,selectionStart:i}=t.value;if(void 0==r||void 0==o||void 0==i)return;let s=n.length;if(n.endsWith(o))s=n.length-o.length;else if(n.startsWith(r))s=r.length;else{const e=r[i-1],t=n.indexOf(e,i-1);-1!==t&&(s=t+1)}e.value.setSelectionRange(s,s)}return[r,o]}const Ia=e=>/([\uAC00-\uD7AF\u3130-\u318F])+/gi.test(e),Ra=["role"],_a=["id","type","disabled","formatter","parser","readonly","autocomplete","tabindex","aria-label","placeholder","form","autofocus"],Na=["id","tabindex","disabled","readonly","autocomplete","aria-label","placeholder","form","autofocus"],Aa=(0,n.defineComponent)({name:"ElInput",inheritAttrs:!1}),Oa=(0,n.defineComponent)({...Aa,props:wa,emits:Sa,setup(e,{expose:t,emit:r}){const o=e,i=(0,n.useAttrs)(),s=(0,n.useSlots)(),a=(0,n.computed)((()=>{const e={};return"combobox"===o.containerRole&&(e["aria-haspopup"]=i["aria-haspopup"],e["aria-owns"]=i["aria-owns"],e["aria-expanded"]=i["aria-expanded"]),e})),c=(0,n.computed)((()=>["textarea"===o.type?y.b():v.b(),v.m(g.value),v.is("disabled",m.value),v.is("exceed",V.value),{[v.b("group")]:s.prepend||s.append,[v.bm("group","append")]:s.append,[v.bm("group","prepend")]:s.prepend,[v.m("prefix")]:s.prefix||o.prefixIcon,[v.m("suffix")]:s.suffix||o.suffixIcon||o.clearable||o.showPassword,[v.bm("suffix","password-clear")]:M.value&&L.value},i.class])),u=(0,n.computed)((()=>[v.e("wrapper"),v.is("focus",R.value)])),d=Ea({excludeKeys:(0,n.computed)((()=>Object.keys(a.value)))}),{form:p,formItem:h}=Lr(),{inputId:f}=qr(o,{formItemContext:h}),g=Vr(),m=Fr(),v=l("input"),y=l("textarea"),b=(0,n.shallowRef)(),w=(0,n.shallowRef)(),S=(0,n.ref)(!1),T=(0,n.ref)(!1),C=(0,n.ref)(!1),E=(0,n.ref)(),k=(0,n.shallowRef)(o.inputStyle),x=(0,n.computed)((()=>b.value||w.value)),{wrapperRef:I,isFocused:R,handleFocus:_,handleBlur:N}=ka(x,{afterBlur(){var e;o.validateEvent&&(null==(e=null==h?void 0:h.validate)||e.call(h,"blur").catch((e=>In(e))))}}),A=(0,n.computed)((()=>{var e;return null!=(e=null==p?void 0:p.statusIcon)&&e})),O=(0,n.computed)((()=>(null==h?void 0:h.validateState)||"")),P=(0,n.computed)((()=>O.value&&Wi[O.value])),D=(0,n.computed)((()=>C.value?Hi:ti)),B=(0,n.computed)((()=>[i.style,o.inputStyle])),j=(0,n.computed)((()=>[o.inputStyle,k.value,{resize:o.resize}])),H=(0,n.computed)((()=>Ls(o.modelValue)?"":String(o.modelValue))),M=(0,n.computed)((()=>o.clearable&&!m.value&&!o.readonly&&!!H.value&&(R.value||S.value))),L=(0,n.computed)((()=>o.showPassword&&!m.value&&!o.readonly&&!!H.value&&(!!H.value||R.value))),q=(0,n.computed)((()=>o.showWordLimit&&!!d.value.maxlength&&("text"===o.type||"textarea"===o.type)&&!m.value&&!o.readonly&&!o.showPassword)),$=(0,n.computed)((()=>H.value.length)),V=(0,n.computed)((()=>!!q.value&&$.value>Number(d.value.maxlength))),F=(0,n.computed)((()=>!!s.suffix||!!o.suffixIcon||M.value||o.showPassword||q.value||!!O.value&&A.value)),[U,z]=xa(b);ea(w,(e=>{if(G(),!q.value||"both"!==o.resize)return;const t=e[0],{width:n}=t.contentRect;E.value={right:`calc(100% - ${n+15+6}px)`}}));const K=()=>{const{type:e,autosize:t}=o;if(xr&&"textarea"===e&&w.value)if(t){const e=cn(t)?t.minRows:void 0,r=cn(t)?t.maxRows:void 0,o=ga(w.value,e,r);k.value={overflowY:"hidden",...o},(0,n.nextTick)((()=>{w.value.offsetHeight,k.value=o}))}else k.value={minHeight:ga(w.value).minHeight}},W=e=>{let t=!1;return()=>{var n;if(t||!o.autosize)return;const r=null===(null==(n=w.value)?void 0:n.offsetParent);r||(e(),t=!0)}},G=W(K),Y=()=>{const e=x.value,t=o.formatter?o.formatter(H.value):H.value;e&&e.value!==t&&(e.value=t)},J=async e=>{U();let{value:t}=e.target;o.formatter&&(t=o.parser?o.parser(t):t),T.value||(t!==H.value?(r(va,t),r("input",t),await(0,n.nextTick)(),Y(),z()):Y())},Z=e=>{r("change",e.target.value)},X=e=>{r("compositionstart",e),T.value=!0},Q=e=>{var t;r("compositionupdate",e);const n=null==(t=e.target)?void 0:t.value,o=n[n.length-1]||"";T.value=!Ia(o)},ee=e=>{r("compositionend",e),T.value&&(T.value=!1,J(e))},te=()=>{C.value=!C.value,ne()},ne=async()=>{var e;await(0,n.nextTick)(),null==(e=x.value)||e.focus()},re=()=>{var e;return null==(e=x.value)?void 0:e.blur()},oe=e=>{S.value=!1,r("mouseleave",e)},ie=e=>{S.value=!0,r("mouseenter",e)},se=e=>{r("keydown",e)},ae=()=>{var e;null==(e=x.value)||e.select()},ce=()=>{r(va,""),r("change",""),r("clear"),r("input","")};return(0,n.watch)((()=>o.modelValue),(()=>{var e;(0,n.nextTick)((()=>K())),o.validateEvent&&(null==(e=null==h?void 0:h.validate)||e.call(h,"change").catch((e=>In(e))))})),(0,n.watch)(H,(()=>Y())),(0,n.watch)((()=>o.type),(async()=>{await(0,n.nextTick)(),Y(),K()})),(0,n.onMounted)((()=>{!o.formatter&&o.parser&&In("ElInput","If you set the parser, you also need to set the formatter."),Y(),(0,n.nextTick)(K)})),t({input:b,textarea:w,ref:x,textareaStyle:j,autosize:(0,n.toRef)(o,"autosize"),focus:ne,blur:re,select:ae,clear:ce,resizeTextarea:K}),(e,t)=>(0,n.withDirectives)(((0,n.openBlock)(),(0,n.createElementBlock)("div",(0,n.mergeProps)((0,n.unref)(a),{class:(0,n.unref)(c),style:(0,n.unref)(B),role:e.containerRole,onMouseenter:ie,onMouseleave:oe}),[(0,n.createCommentVNode)(" input "),"textarea"!==e.type?((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:0},[(0,n.createCommentVNode)(" prepend slot "),e.$slots.prepend?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:0,class:(0,n.normalizeClass)((0,n.unref)(v).be("group","prepend"))},[(0,n.renderSlot)(e.$slots,"prepend")],2)):(0,n.createCommentVNode)("v-if",!0),(0,n.createElementVNode)("div",{ref_key:"wrapperRef",ref:I,class:(0,n.normalizeClass)((0,n.unref)(u))},[(0,n.createCommentVNode)(" prefix slot "),e.$slots.prefix||e.prefixIcon?((0,n.openBlock)(),(0,n.createElementBlock)("span",{key:0,class:(0,n.normalizeClass)((0,n.unref)(v).e("prefix"))},[(0,n.createElementVNode)("span",{class:(0,n.normalizeClass)((0,n.unref)(v).e("prefix-inner"))},[(0,n.renderSlot)(e.$slots,"prefix"),e.prefixIcon?((0,n.openBlock)(),(0,n.createBlock)((0,n.unref)(ur),{key:0,class:(0,n.normalizeClass)((0,n.unref)(v).e("icon"))},{default:(0,n.withCtx)((()=>[((0,n.openBlock)(),(0,n.createBlock)((0,n.resolveDynamicComponent)(e.prefixIcon)))])),_:1},8,["class"])):(0,n.createCommentVNode)("v-if",!0)],2)],2)):(0,n.createCommentVNode)("v-if",!0),(0,n.createElementVNode)("input",(0,n.mergeProps)({id:(0,n.unref)(f),ref_key:"input",ref:b,class:(0,n.unref)(v).e("inner")},(0,n.unref)(d),{type:e.showPassword?C.value?"text":"password":e.type,disabled:(0,n.unref)(m),formatter:e.formatter,parser:e.parser,readonly:e.readonly,autocomplete:e.autocomplete,tabindex:e.tabindex,"aria-label":e.label,placeholder:e.placeholder,style:e.inputStyle,form:o.form,autofocus:o.autofocus,onCompositionstart:X,onCompositionupdate:Q,onCompositionend:ee,onInput:J,onFocus:t[0]||(t[0]=(...e)=>(0,n.unref)(_)&&(0,n.unref)(_)(...e)),onBlur:t[1]||(t[1]=(...e)=>(0,n.unref)(N)&&(0,n.unref)(N)(...e)),onChange:Z,onKeydown:se}),null,16,_a),(0,n.createCommentVNode)(" suffix slot "),(0,n.unref)(F)?((0,n.openBlock)(),(0,n.createElementBlock)("span",{key:1,class:(0,n.normalizeClass)((0,n.unref)(v).e("suffix"))},[(0,n.createElementVNode)("span",{class:(0,n.normalizeClass)((0,n.unref)(v).e("suffix-inner"))},[(0,n.unref)(M)&&(0,n.unref)(L)&&(0,n.unref)(q)?(0,n.createCommentVNode)("v-if",!0):((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:0},[(0,n.renderSlot)(e.$slots,"suffix"),e.suffixIcon?((0,n.openBlock)(),(0,n.createBlock)((0,n.unref)(ur),{key:0,class:(0,n.normalizeClass)((0,n.unref)(v).e("icon"))},{default:(0,n.withCtx)((()=>[((0,n.openBlock)(),(0,n.createBlock)((0,n.resolveDynamicComponent)(e.suffixIcon)))])),_:1},8,["class"])):(0,n.createCommentVNode)("v-if",!0)],64)),(0,n.unref)(M)?((0,n.openBlock)(),(0,n.createBlock)((0,n.unref)(ur),{key:1,class:(0,n.normalizeClass)([(0,n.unref)(v).e("icon"),(0,n.unref)(v).e("clear")]),onMousedown:(0,n.withModifiers)((0,n.unref)(tn),["prevent"]),onClick:ce},{default:(0,n.withCtx)((()=>[(0,n.createVNode)((0,n.unref)(Vo))])),_:1},8,["class","onMousedown"])):(0,n.createCommentVNode)("v-if",!0),(0,n.unref)(L)?((0,n.openBlock)(),(0,n.createBlock)((0,n.unref)(ur),{key:2,class:(0,n.normalizeClass)([(0,n.unref)(v).e("icon"),(0,n.unref)(v).e("password")]),onClick:te},{default:(0,n.withCtx)((()=>[((0,n.openBlock)(),(0,n.createBlock)((0,n.resolveDynamicComponent)((0,n.unref)(D))))])),_:1},8,["class"])):(0,n.createCommentVNode)("v-if",!0),(0,n.unref)(q)?((0,n.openBlock)(),(0,n.createElementBlock)("span",{key:3,class:(0,n.normalizeClass)((0,n.unref)(v).e("count"))},[(0,n.createElementVNode)("span",{class:(0,n.normalizeClass)((0,n.unref)(v).e("count-inner"))},(0,n.toDisplayString)((0,n.unref)($))+" / "+(0,n.toDisplayString)((0,n.unref)(d).maxlength),3)],2)):(0,n.createCommentVNode)("v-if",!0),(0,n.unref)(O)&&(0,n.unref)(P)&&(0,n.unref)(A)?((0,n.openBlock)(),(0,n.createBlock)((0,n.unref)(ur),{key:4,class:(0,n.normalizeClass)([(0,n.unref)(v).e("icon"),(0,n.unref)(v).e("validateIcon"),(0,n.unref)(v).is("loading","validating"===(0,n.unref)(O))])},{default:(0,n.withCtx)((()=>[((0,n.openBlock)(),(0,n.createBlock)((0,n.resolveDynamicComponent)((0,n.unref)(P))))])),_:1},8,["class"])):(0,n.createCommentVNode)("v-if",!0)],2)],2)):(0,n.createCommentVNode)("v-if",!0)],2),(0,n.createCommentVNode)(" append slot "),e.$slots.append?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:1,class:(0,n.normalizeClass)((0,n.unref)(v).be("group","append"))},[(0,n.renderSlot)(e.$slots,"append")],2)):(0,n.createCommentVNode)("v-if",!0)],64)):((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:1},[(0,n.createCommentVNode)(" textarea "),(0,n.createElementVNode)("textarea",(0,n.mergeProps)({id:(0,n.unref)(f),ref_key:"textarea",ref:w,class:(0,n.unref)(y).e("inner")},(0,n.unref)(d),{tabindex:e.tabindex,disabled:(0,n.unref)(m),readonly:e.readonly,autocomplete:e.autocomplete,style:(0,n.unref)(j),"aria-label":e.label,placeholder:e.placeholder,form:o.form,autofocus:o.autofocus,onCompositionstart:X,onCompositionupdate:Q,onCompositionend:ee,onInput:J,onFocus:t[2]||(t[2]=(...e)=>(0,n.unref)(_)&&(0,n.unref)(_)(...e)),onBlur:t[3]||(t[3]=(...e)=>(0,n.unref)(N)&&(0,n.unref)(N)(...e)),onChange:Z,onKeydown:se}),null,16,Na),(0,n.unref)(q)?((0,n.openBlock)(),(0,n.createElementBlock)("span",{key:0,style:(0,n.normalizeStyle)(E.value),class:(0,n.normalizeClass)((0,n.unref)(v).e("count"))},(0,n.toDisplayString)((0,n.unref)($))+" / "+(0,n.toDisplayString)((0,n.unref)(d).maxlength),7)):(0,n.createCommentVNode)("v-if",!0)],64))],16,Ra)),[[n.vShow,"hidden"!==e.type]])}});var Pa=tr(Oa,[["__file","/home/runner/work/element-plus/element-plus/packages/components/input/src/input.vue"]]);const Da=Yn(Pa),Ba=Dn({id:{type:String,default:void 0},step:{type:Number,default:1},stepStrictly:Boolean,max:{type:Number,default:Number.POSITIVE_INFINITY},min:{type:Number,default:Number.NEGATIVE_INFINITY},modelValue:Number,readonly:Boolean,disabled:Boolean,size:Hn,controls:{type:Boolean,default:!0},controlsPosition:{type:String,default:"",values:["","right"]},valueOnClear:{type:[String,Number,null],validator:e=>null===e||yn(e)||["min","max"].includes(e),default:null},name:String,label:String,placeholder:String,precision:{type:Number,validator:e=>e>=0&&e===Number.parseInt(`${e}`,10)},validateEvent:{type:Boolean,default:!0}}),ja={[ya]:(e,t)=>t!==e,blur:e=>e instanceof FocusEvent,focus:e=>e instanceof FocusEvent,[ba]:e=>yn(e)||Ls(e),[va]:e=>yn(e)||Ls(e)},Ha=100,Ma=600,La={beforeMount(e,t){const n=t.value,{interval:r=Ha,delay:o=Ma}=sn(n)?{}:n;let i,s;const a=()=>sn(n)?n():n.handler(),c=()=>{s&&(clearTimeout(s),s=void 0),i&&(clearInterval(i),i=void 0)};e.addEventListener("mousedown",(e=>{0===e.button&&(c(),a(),document.addEventListener("mouseup",(()=>c()),{once:!0}),s=setTimeout((()=>{i=setInterval((()=>{a()}),r)}),o))}))}},qa=["aria-label","onKeydown"],$a=["aria-label","onKeydown"],Va=(0,n.defineComponent)({name:"ElInputNumber"}),Fa=(0,n.defineComponent)({...Va,props:Ba,emits:ja,setup(e,{expose:t,emit:r}){const o=e,{t:i}=en(),s=l("input-number"),a=(0,n.ref)(),c=(0,n.reactive)({currentValue:o.modelValue,userInput:null}),{formItem:u}=Lr(),d=(0,n.computed)((()=>yn(o.modelValue)&&o.modelValue<=o.min)),p=(0,n.computed)((()=>yn(o.modelValue)&&o.modelValue>=o.max)),h=(0,n.computed)((()=>{const e=b(o.step);return mn(o.precision)?Math.max(b(o.modelValue),e):(e>o.precision&&In("InputNumber","precision should not be less than the decimal places of step"),o.precision)})),f=(0,n.computed)((()=>o.controls&&"right"===o.controlsPosition)),g=Vr(),m=Fr(),v=(0,n.computed)((()=>{if(null!==c.userInput)return c.userInput;let e=c.currentValue;if(Ls(e))return"";if(yn(e)){if(Number.isNaN(e))return"";mn(o.precision)||(e=e.toFixed(o.precision))}return e})),y=(e,t)=>{if(mn(t)&&(t=h.value),0===t)return Math.round(e);let n=String(e);const r=n.indexOf(".");if(-1===r)return e;const o=n.replace(".","").split(""),i=o[r+t];if(!i)return e;const s=n.length;return"5"===n.charAt(s-1)&&(n=`${n.slice(0,Math.max(0,s-1))}6`),Number.parseFloat(Number(n).toFixed(t))},b=e=>{if(Ls(e))return 0;const t=e.toString(),n=t.indexOf(".");let r=0;return-1!==n&&(r=t.length-n-1),r},w=(e,t=1)=>yn(e)?y(e+o.step*t):c.currentValue,S=()=>{if(o.readonly||m.value||p.value)return;const e=Number(v.value)||0,t=w(e);E(t),r(ba,c.currentValue)},T=()=>{if(o.readonly||m.value||d.value)return;const e=Number(v.value)||0,t=w(e,-1);E(t),r(ba,c.currentValue)},C=(e,t)=>{const{max:n,min:i,step:s,precision:a,stepStrictly:c,valueOnClear:l}=o;n<i&&xn("InputNumber","min should not be greater than max.");let u=Number(e);if(Ls(e)||Number.isNaN(u))return null;if(""===e){if(null===l)return null;u=an(l)?{min:i,max:n}[l]:l}return c&&(u=y(Math.round(u/s)*s,a)),mn(a)||(u=y(u,a)),(u>n||u<i)&&(u=u>n?n:i,t&&r(va,u)),u},E=(e,t=!0)=>{var n;const i=c.currentValue,s=C(e);t?i!==s&&(c.userInput=null,r(va,s),r(ya,s,i),o.validateEvent&&(null==(n=null==u?void 0:u.validate)||n.call(u,"change").catch((e=>In(e)))),c.currentValue=s):r(va,s)},k=e=>{c.userInput=e;const t=""===e?null:Number(e);r(ba,t),E(t,!1)},x=e=>{const t=""!==e?Number(e):"";(yn(t)&&!Number.isNaN(t)||""===e)&&E(t),c.userInput=null},I=()=>{var e,t;null==(t=null==(e=a.value)?void 0:e.focus)||t.call(e)},R=()=>{var e,t;null==(t=null==(e=a.value)?void 0:e.blur)||t.call(e)},_=e=>{r("focus",e)},N=e=>{var t;r("blur",e),o.validateEvent&&(null==(t=null==u?void 0:u.validate)||t.call(u,"blur").catch((e=>In(e))))};return(0,n.watch)((()=>o.modelValue),(e=>{const t=C(c.userInput),n=C(e,!0);yn(t)||t&&t===n||(c.currentValue=n,c.userInput=null)}),{immediate:!0}),(0,n.onMounted)((()=>{var e;const{min:t,max:n,modelValue:i}=o,s=null==(e=a.value)?void 0:e.input;if(s.setAttribute("role","spinbutton"),Number.isFinite(n)?s.setAttribute("aria-valuemax",String(n)):s.removeAttribute("aria-valuemax"),Number.isFinite(t)?s.setAttribute("aria-valuemin",String(t)):s.removeAttribute("aria-valuemin"),s.setAttribute("aria-valuenow",c.currentValue||0===c.currentValue?String(c.currentValue):""),s.setAttribute("aria-disabled",String(m.value)),!yn(i)&&null!=i){let e=Number(i);Number.isNaN(e)&&(e=null),r(va,e)}})),(0,n.onUpdated)((()=>{var e,t;const n=null==(e=a.value)?void 0:e.input;null==n||n.setAttribute("aria-valuenow",`${null!=(t=c.currentValue)?t:""}`)})),t({focus:I,blur:R}),(e,t)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{class:(0,n.normalizeClass)([(0,n.unref)(s).b(),(0,n.unref)(s).m((0,n.unref)(g)),(0,n.unref)(s).is("disabled",(0,n.unref)(m)),(0,n.unref)(s).is("without-controls",!e.controls),(0,n.unref)(s).is("controls-right",(0,n.unref)(f))]),onDragstart:t[1]||(t[1]=(0,n.withModifiers)((()=>{}),["prevent"]))},[e.controls?(0,n.withDirectives)(((0,n.openBlock)(),(0,n.createElementBlock)("span",{key:0,role:"button","aria-label":(0,n.unref)(i)("el.inputNumber.decrease"),class:(0,n.normalizeClass)([(0,n.unref)(s).e("decrease"),(0,n.unref)(s).is("disabled",(0,n.unref)(d))]),onKeydown:(0,n.withKeys)(T,["enter"])},[(0,n.createVNode)((0,n.unref)(ur),null,{default:(0,n.withCtx)((()=>[(0,n.unref)(f)?((0,n.openBlock)(),(0,n.createBlock)((0,n.unref)(Zr),{key:0})):((0,n.openBlock)(),(0,n.createBlock)((0,n.unref)(bi),{key:1}))])),_:1})],42,qa)),[[(0,n.unref)(La),T]]):(0,n.createCommentVNode)("v-if",!0),e.controls?(0,n.withDirectives)(((0,n.openBlock)(),(0,n.createElementBlock)("span",{key:1,role:"button","aria-label":(0,n.unref)(i)("el.inputNumber.increase"),class:(0,n.normalizeClass)([(0,n.unref)(s).e("increase"),(0,n.unref)(s).is("disabled",(0,n.unref)(p))]),onKeydown:(0,n.withKeys)(S,["enter"])},[(0,n.createVNode)((0,n.unref)(ur),null,{default:(0,n.withCtx)((()=>[(0,n.unref)(f)?((0,n.openBlock)(),(0,n.createBlock)((0,n.unref)(mo),{key:0})):((0,n.openBlock)(),(0,n.createBlock)((0,n.unref)(ki),{key:1}))])),_:1})],42,$a)),[[(0,n.unref)(La),S]]):(0,n.createCommentVNode)("v-if",!0),(0,n.createVNode)((0,n.unref)(Da),{id:e.id,ref_key:"input",ref:a,type:"number",step:e.step,"model-value":(0,n.unref)(v),placeholder:e.placeholder,readonly:e.readonly,disabled:(0,n.unref)(m),size:(0,n.unref)(g),max:e.max,min:e.min,name:e.name,label:e.label,"validate-event":!1,onWheel:t[0]||(t[0]=(0,n.withModifiers)((()=>{}),["prevent"])),onKeydown:[(0,n.withKeys)((0,n.withModifiers)(S,["prevent"]),["up"]),(0,n.withKeys)((0,n.withModifiers)(T,["prevent"]),["down"])],onBlur:N,onFocus:_,onInput:k,onChange:x},null,8,["id","step","model-value","placeholder","readonly","disabled","size","max","min","name","label","onKeydown"])],34))}});var Ua=tr(Fa,[["__file","/home/runner/work/element-plus/element-plus/packages/components/input-number/src/input-number.vue"]]);const za=Yn(Ua),Ka={modelValue:{type:[Number,String,Boolean],default:void 0},label:{type:[String,Boolean,Number,Object]},indeterminate:Boolean,disabled:Boolean,checked:Boolean,name:{type:String,default:void 0},trueLabel:{type:[String,Number],default:void 0},falseLabel:{type:[String,Number],default:void 0},id:{type:String,default:void 0},controls:{type:String,default:void 0},border:Boolean,size:Hn,tabindex:[String,Number],validateEvent:{type:Boolean,default:!0}},Wa={[va]:e=>an(e)||yn(e)||vn(e),change:e=>an(e)||yn(e)||vn(e)},Ga=Symbol("checkboxGroupContextKey"),Ya=({model:e,isChecked:t})=>{const r=(0,n.inject)(Ga,void 0),o=(0,n.computed)((()=>{var n,o;const i=null==(n=null==r?void 0:r.max)?void 0:n.value,s=null==(o=null==r?void 0:r.min)?void 0:o.value;return!mn(i)&&e.value.length>=i&&!t.value||!mn(s)&&e.value.length<=s&&t.value})),i=Fr((0,n.computed)((()=>(null==r?void 0:r.disabled.value)||o.value)));return{isDisabled:i,isLimitDisabled:o}},Ja=(e,{model:t,isLimitExceeded:r,hasOwnLabel:o,isDisabled:i,isLabeledByFormItem:s})=>{const a=(0,n.inject)(Ga,void 0),{formItem:c}=Lr(),{emit:l}=(0,n.getCurrentInstance)();function u(t){var n,r;return t===e.trueLabel||!0===t?null==(n=e.trueLabel)||n:null!=(r=e.falseLabel)&&r}function d(e,t){l("change",u(e),t)}function p(e){if(r.value)return;const t=e.target;l("change",u(t.checked),e)}async function h(a){if(!r.value&&!o.value&&!i.value&&s.value){const r=a.composedPath(),o=r.some((e=>"LABEL"===e.tagName));o||(t.value=u([!1,e.falseLabel].includes(t.value)),await(0,n.nextTick)(),d(t.value,a))}}const f=(0,n.computed)((()=>(null==a?void 0:a.validateEvent)||e.validateEvent));return(0,n.watch)((()=>e.modelValue),(()=>{f.value&&(null==c||c.validate("change").catch((e=>In(e))))})),{handleChange:p,onClickRoot:h}},Za=e=>{const t=(0,n.ref)(!1),{emit:r}=(0,n.getCurrentInstance)(),o=(0,n.inject)(Ga,void 0),i=(0,n.computed)((()=>!1===mn(o))),s=(0,n.ref)(!1),a=(0,n.computed)({get(){var n,r;return i.value?null==(n=null==o?void 0:o.modelValue)?void 0:n.value:null!=(r=e.modelValue)?r:t.value},set(e){var n,a;i.value&&on(e)?(s.value=void 0!==(null==(n=null==o?void 0:o.max)?void 0:n.value)&&e.length>(null==o?void 0:o.max.value),!1===s.value&&(null==(a=null==o?void 0:o.changeEvent)||a.call(o,e))):(r(va,e),t.value=e)}});return{model:a,isGroup:i,isLimitExceeded:s}};function Xa(){this.__data__=new nt,this.size=0}var Qa=Xa;function ec(e){var t=this.__data__,n=t["delete"](e);return this.size=t.size,n}var tc=ec;function nc(e){return this.__data__.get(e)}var rc=nc;function oc(e){return this.__data__.has(e)}var ic=oc,sc=200;function ac(e,t){var n=this.__data__;if(n instanceof nt){var r=n.__data__;if(!ot||r.length<sc-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new wt(r)}return n.set(e,t),this.size=n.size,this}var cc=ac;function lc(e){var t=this.__data__=new nt(e);this.size=t.size}lc.prototype.clear=Qa,lc.prototype["delete"]=tc,lc.prototype.get=rc,lc.prototype.has=ic,lc.prototype.set=cc;var uc=lc,dc="__lodash_hash_undefined__";function pc(e){return this.__data__.set(e,dc),this}var hc=pc;function fc(e){return this.__data__.has(e)}var gc=fc;function mc(e){var t=-1,n=null==e?0:e.length;this.__data__=new wt;while(++t<n)this.add(e[t])}mc.prototype.add=mc.prototype.push=hc,mc.prototype.has=gc;var vc=mc;function yc(e,t){var n=-1,r=null==e?0:e.length;while(++n<r)if(t(e[n],n,e))return!0;return!1}var bc=yc;function wc(e,t){return e.has(t)}var Sc=wc,Tc=1,Cc=2;function Ec(e,t,n,r,o,i){var s=n&Tc,a=e.length,c=t.length;if(a!=c&&!(s&&c>a))return!1;var l=i.get(e),u=i.get(t);if(l&&u)return l==t&&u==e;var d=-1,p=!0,h=n&Cc?new vc:void 0;i.set(e,t),i.set(t,e);while(++d<a){var f=e[d],g=t[d];if(r)var m=s?r(g,f,d,t,e,i):r(f,g,d,e,t,i);if(void 0!==m){if(m)continue;p=!1;break}if(h){if(!bc(t,(function(e,t){if(!Sc(h,t)&&(f===e||o(f,e,n,r,i)))return h.push(t)}))){p=!1;break}}else if(f!==g&&!o(f,g,n,r,i)){p=!1;break}}return i["delete"](e),i["delete"](t),p}var kc=Ec,xc=m.Uint8Array,Ic=xc;function Rc(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}var _c=Rc;function Nc(e){var t=-1,n=Array(e.size);return e.forEach((function(e){n[++t]=e})),n}var Ac=Nc,Oc=1,Pc=2,Dc="[object Boolean]",Bc="[object Date]",jc="[object Error]",Hc="[object Map]",Mc="[object Number]",Lc="[object RegExp]",qc="[object Set]",$c="[object String]",Vc="[object Symbol]",Fc="[object ArrayBuffer]",Uc="[object DataView]",zc=y?y.prototype:void 0,Kc=zc?zc.valueOf:void 0;function Wc(e,t,n,r,o,i,s){switch(n){case Uc:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case Fc:return!(e.byteLength!=t.byteLength||!i(new Ic(e),new Ic(t)));case Dc:case Bc:case Mc:return Ve(+e,+t);case jc:return e.name==t.name&&e.message==t.message;case Lc:case $c:return e==t+"";case Hc:var a=_c;case qc:var c=r&Oc;if(a||(a=Ac),e.size!=t.size&&!c)return!1;var l=s.get(e);if(l)return l==t;r|=Pc,s.set(e,t);var u=kc(a(e),a(t),r,o,i,s);return s["delete"](e),u;case Vc:if(Kc)return Kc.call(e)==Kc.call(t)}return!1}var Gc=Wc;function Yc(e,t){var n=-1,r=t.length,o=e.length;while(++n<r)e[o+n]=t[n];return e}var Jc=Yc;function Zc(e,t,n){var r=t(e);return d(e)?r:Jc(r,n(e))}var Xc=Zc;function Qc(e,t){var n=-1,r=null==e?0:e.length,o=0,i=[];while(++n<r){var s=e[n];t(s,n,e)&&(i[o++]=s)}return i}var el=Qc;function tl(){return[]}var nl=tl,rl=Object.prototype,ol=rl.propertyIsEnumerable,il=Object.getOwnPropertySymbols,sl=il?function(e){return null==e?[]:(e=Object(e),el(il(e),(function(t){return ol.call(e,t)})))}:nl,al=sl;function cl(e,t){var n=-1,r=Array(e);while(++n<e)r[n]=t(n);return r}var ll=cl,ul="[object Arguments]";function dl(e){return B(e)&&P(e)==ul}var pl=dl,hl=Object.prototype,fl=hl.hasOwnProperty,gl=hl.propertyIsEnumerable,ml=pl(function(){return arguments}())?pl:function(e){return B(e)&&fl.call(e,"callee")&&!gl.call(e,"callee")},vl=ml;function yl(){return!1}var bl=yl,wl="object"==typeof exports&&exports&&!exports.nodeType&&exports,Sl=wl&&"object"==typeof module&&module&&!module.nodeType&&module,Tl=Sl&&Sl.exports===wl,Cl=Tl?m.Buffer:void 0,El=Cl?Cl.isBuffer:void 0,kl=El||bl,xl=kl,Il=9007199254740991,Rl=/^(?:0|[1-9]\d*)$/;function _l(e,t){var n=typeof e;return t=null==t?Il:t,!!t&&("number"==n||"symbol"!=n&&Rl.test(e))&&e>-1&&e%1==0&&e<t}var Nl=_l,Al=9007199254740991;function Ol(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=Al}var Pl=Ol,Dl="[object Arguments]",Bl="[object Array]",jl="[object Boolean]",Hl="[object Date]",Ml="[object Error]",Ll="[object Function]",ql="[object Map]",$l="[object Number]",Vl="[object Object]",Fl="[object RegExp]",Ul="[object Set]",zl="[object String]",Kl="[object WeakMap]",Wl="[object ArrayBuffer]",Gl="[object DataView]",Yl="[object Float32Array]",Jl="[object Float64Array]",Zl="[object Int8Array]",Xl="[object Int16Array]",Ql="[object Int32Array]",eu="[object Uint8Array]",tu="[object Uint8ClampedArray]",nu="[object Uint16Array]",ru="[object Uint32Array]",ou={};function iu(e){return B(e)&&Pl(e.length)&&!!ou[P(e)]}ou[Yl]=ou[Jl]=ou[Zl]=ou[Xl]=ou[Ql]=ou[eu]=ou[tu]=ou[nu]=ou[ru]=!0,ou[Dl]=ou[Bl]=ou[Wl]=ou[jl]=ou[Gl]=ou[Hl]=ou[Ml]=ou[Ll]=ou[ql]=ou[$l]=ou[Vl]=ou[Fl]=ou[Ul]=ou[zl]=ou[Kl]=!1;var su=iu;function au(e){return function(t){return e(t)}}var cu=au,lu="object"==typeof exports&&exports&&!exports.nodeType&&exports,uu=lu&&"object"==typeof module&&module&&!module.nodeType&&module,du=uu&&uu.exports===lu,pu=du&&h.process,hu=function(){try{var e=uu&&uu.require&&uu.require("util").types;return e||pu&&pu.binding&&pu.binding("util")}catch(t){}}(),fu=hu,gu=fu&&fu.isTypedArray,mu=gu?cu(gu):su,vu=mu,yu=Object.prototype,bu=yu.hasOwnProperty;function wu(e,t){var n=d(e),r=!n&&vl(e),o=!n&&!r&&xl(e),i=!n&&!r&&!o&&vu(e),s=n||r||o||i,a=s?ll(e.length,String):[],c=a.length;for(var l in e)!t&&!bu.call(e,l)||s&&("length"==l||o&&("offset"==l||"parent"==l)||i&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||Nl(l,c))||a.push(l);return a}var Su=wu,Tu=Object.prototype;function Cu(e){var t=e&&e.constructor,n="function"==typeof t&&t.prototype||Tu;return e===n}var Eu=Cu;function ku(e,t){return function(n){return e(t(n))}}var xu=ku,Iu=xu(Object.keys,Object),Ru=Iu,_u=Object.prototype,Nu=_u.hasOwnProperty;function Au(e){if(!Eu(e))return Ru(e);var t=[];for(var n in Object(e))Nu.call(e,n)&&"constructor"!=n&&t.push(n);return t}var Ou=Au;function Pu(e){return null!=e&&Pl(e.length)&&!J(e)}var Du=Pu;function Bu(e){return Du(e)?Su(e):Ou(e)}var ju=Bu;function Hu(e){return Xc(e,ju,al)}var Mu=Hu,Lu=1,qu=Object.prototype,$u=qu.hasOwnProperty;function Vu(e,t,n,r,o,i){var s=n&Lu,a=Mu(e),c=a.length,l=Mu(t),u=l.length;if(c!=u&&!s)return!1;var d=c;while(d--){var p=a[d];if(!(s?p in t:$u.call(t,p)))return!1}var h=i.get(e),f=i.get(t);if(h&&f)return h==t&&f==e;var g=!0;i.set(e,t),i.set(t,e);var m=s;while(++d<c){p=a[d];var v=e[p],y=t[p];if(r)var b=s?r(y,v,p,t,e,i):r(v,y,p,e,t,i);if(!(void 0===b?v===y||o(v,y,n,r,i):b)){g=!1;break}m||(m="constructor"==p)}if(g&&!m){var w=e.constructor,S=t.constructor;w==S||!("constructor"in e)||!("constructor"in t)||"function"==typeof w&&w instanceof w&&"function"==typeof S&&S instanceof S||(g=!1)}return i["delete"](e),i["delete"](t),g}var Fu=Vu,Uu=ye(m,"DataView"),zu=Uu,Ku=ye(m,"Promise"),Wu=Ku,Gu=ye(m,"Set"),Yu=Gu,Ju=ye(m,"WeakMap"),Zu=Ju,Xu="[object Map]",Qu="[object Object]",ed="[object Promise]",td="[object Set]",nd="[object WeakMap]",rd="[object DataView]",od=ie(zu),id=ie(ot),sd=ie(Wu),ad=ie(Yu),cd=ie(Zu),ld=P;(zu&&ld(new zu(new ArrayBuffer(1)))!=rd||ot&&ld(new ot)!=Xu||Wu&&ld(Wu.resolve())!=ed||Yu&&ld(new Yu)!=td||Zu&&ld(new Zu)!=nd)&&(ld=function(e){var t=P(e),n=t==Qu?e.constructor:void 0,r=n?ie(n):"";if(r)switch(r){case od:return rd;case id:return Xu;case sd:return ed;case ad:return td;case cd:return nd}return t});var ud=ld,dd=1,pd="[object Arguments]",hd="[object Array]",fd="[object Object]",gd=Object.prototype,md=gd.hasOwnProperty;function vd(e,t,n,r,o,i){var s=d(e),a=d(t),c=s?hd:ud(e),l=a?hd:ud(t);c=c==pd?fd:c,l=l==pd?fd:l;var u=c==fd,p=l==fd,h=c==l;if(h&&xl(e)){if(!xl(t))return!1;s=!0,u=!1}if(h&&!u)return i||(i=new uc),s||vu(e)?kc(e,t,n,r,o,i):Gc(e,t,c,n,r,o,i);if(!(n&dd)){var f=u&&md.call(e,"__wrapped__"),g=p&&md.call(t,"__wrapped__");if(f||g){var m=f?e.value():e,v=g?t.value():t;return i||(i=new uc),o(m,v,n,r,i)}}return!!h&&(i||(i=new uc),Fu(e,t,n,r,o,i))}var yd=vd;function bd(e,t,n,r,o){return e===t||(null==e||null==t||!B(e)&&!B(t)?e!==e&&t!==t:yd(e,t,n,r,bd,o))}var wd=bd;function Sd(e,t){return wd(e,t)}var Td=Sd;const Cd=(e,t,{model:r})=>{const o=(0,n.inject)(Ga,void 0),i=(0,n.ref)(!1),s=(0,n.computed)((()=>{const t=r.value;return vn(t)?t:on(t)?cn(e.label)?t.map(n.toRaw).some((t=>Td(t,e.label))):t.map(n.toRaw).includes(e.label):null!==t&&void 0!==t?t===e.trueLabel:!!t})),a=Vr((0,n.computed)((()=>{var e;return null==(e=null==o?void 0:o.size)?void 0:e.value})),{prop:!0}),c=Vr((0,n.computed)((()=>{var e;return null==(e=null==o?void 0:o.size)?void 0:e.value}))),l=(0,n.computed)((()=>!(!t.default&&!e.label)));return{checkboxButtonSize:a,isChecked:s,isFocused:i,checkboxSize:c,hasOwnLabel:l}},Ed=(e,{model:t})=>{function n(){on(t.value)&&!t.value.includes(e.label)?t.value.push(e.label):t.value=e.trueLabel||!0}e.checked&&n()},kd=(e,t)=>{const{formItem:n}=Lr(),{model:r,isGroup:o,isLimitExceeded:i}=Za(e),{isFocused:s,isChecked:a,checkboxButtonSize:c,checkboxSize:l,hasOwnLabel:u}=Cd(e,t,{model:r}),{isDisabled:d}=Ya({model:r,isChecked:a}),{inputId:p,isLabeledByFormItem:h}=qr(e,{formItemContext:n,disableIdGeneration:u,disableIdManagement:o}),{handleChange:f,onClickRoot:g}=Ja(e,{model:r,isLimitExceeded:i,hasOwnLabel:u,isDisabled:d,isLabeledByFormItem:h});return Ed(e,{model:r}),{inputId:p,isLabeledByFormItem:h,isChecked:a,isDisabled:d,isFocused:s,checkboxButtonSize:c,checkboxSize:l,hasOwnLabel:u,model:r,handleChange:f,onClickRoot:g}},xd=["tabindex","role","aria-checked"],Id=["id","aria-hidden","name","tabindex","disabled","true-value","false-value"],Rd=["id","aria-hidden","disabled","value","name","tabindex"],_d=(0,n.defineComponent)({name:"ElCheckbox"}),Nd=(0,n.defineComponent)({..._d,props:Ka,emits:Wa,setup(e){const t=e,r=(0,n.useSlots)(),{inputId:o,isLabeledByFormItem:i,isChecked:s,isDisabled:a,isFocused:c,checkboxSize:u,hasOwnLabel:d,model:p,handleChange:h,onClickRoot:f}=kd(t,r),g=l("checkbox"),m=(0,n.computed)((()=>[g.b(),g.m(u.value),g.is("disabled",a.value),g.is("bordered",t.border),g.is("checked",s.value)])),v=(0,n.computed)((()=>[g.e("input"),g.is("disabled",a.value),g.is("checked",s.value),g.is("indeterminate",t.indeterminate),g.is("focus",c.value)]));return(e,t)=>((0,n.openBlock)(),(0,n.createBlock)((0,n.resolveDynamicComponent)(!(0,n.unref)(d)&&(0,n.unref)(i)?"span":"label"),{class:(0,n.normalizeClass)((0,n.unref)(m)),"aria-controls":e.indeterminate?e.controls:null,onClick:(0,n.unref)(f)},{default:(0,n.withCtx)((()=>[(0,n.createElementVNode)("span",{class:(0,n.normalizeClass)((0,n.unref)(v)),tabindex:e.indeterminate?0:void 0,role:e.indeterminate?"checkbox":void 0,"aria-checked":e.indeterminate?"mixed":void 0},[e.trueLabel||e.falseLabel?(0,n.withDirectives)(((0,n.openBlock)(),(0,n.createElementBlock)("input",{key:0,id:(0,n.unref)(o),"onUpdate:modelValue":t[0]||(t[0]=e=>(0,n.isRef)(p)?p.value=e:null),class:(0,n.normalizeClass)((0,n.unref)(g).e("original")),type:"checkbox","aria-hidden":e.indeterminate?"true":"false",name:e.name,tabindex:e.tabindex,disabled:(0,n.unref)(a),"true-value":e.trueLabel,"false-value":e.falseLabel,onChange:t[1]||(t[1]=(...e)=>(0,n.unref)(h)&&(0,n.unref)(h)(...e)),onFocus:t[2]||(t[2]=e=>c.value=!0),onBlur:t[3]||(t[3]=e=>c.value=!1),onClick:t[4]||(t[4]=(0,n.withModifiers)((()=>{}),["stop"]))},null,42,Id)),[[n.vModelCheckbox,(0,n.unref)(p)]]):(0,n.withDirectives)(((0,n.openBlock)(),(0,n.createElementBlock)("input",{key:1,id:(0,n.unref)(o),"onUpdate:modelValue":t[5]||(t[5]=e=>(0,n.isRef)(p)?p.value=e:null),class:(0,n.normalizeClass)((0,n.unref)(g).e("original")),type:"checkbox","aria-hidden":e.indeterminate?"true":"false",disabled:(0,n.unref)(a),value:e.label,name:e.name,tabindex:e.tabindex,onChange:t[6]||(t[6]=(...e)=>(0,n.unref)(h)&&(0,n.unref)(h)(...e)),onFocus:t[7]||(t[7]=e=>c.value=!0),onBlur:t[8]||(t[8]=e=>c.value=!1),onClick:t[9]||(t[9]=(0,n.withModifiers)((()=>{}),["stop"]))},null,42,Rd)),[[n.vModelCheckbox,(0,n.unref)(p)]]),(0,n.createElementVNode)("span",{class:(0,n.normalizeClass)((0,n.unref)(g).e("inner"))},null,2)],10,xd),(0,n.unref)(d)?((0,n.openBlock)(),(0,n.createElementBlock)("span",{key:0,class:(0,n.normalizeClass)((0,n.unref)(g).e("label"))},[(0,n.renderSlot)(e.$slots,"default"),e.$slots.default?(0,n.createCommentVNode)("v-if",!0):((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:0},[(0,n.createTextVNode)((0,n.toDisplayString)(e.label),1)],64))],2)):(0,n.createCommentVNode)("v-if",!0)])),_:3},8,["class","aria-controls","onClick"]))}});var Ad=tr(Nd,[["__file","/home/runner/work/element-plus/element-plus/packages/components/checkbox/src/checkbox.vue"]]);const Od=["name","tabindex","disabled","true-value","false-value"],Pd=["name","tabindex","disabled","value"],Dd=(0,n.defineComponent)({name:"ElCheckboxButton"}),Bd=(0,n.defineComponent)({...Dd,props:Ka,emits:Wa,setup(e){const t=e,r=(0,n.useSlots)(),{isFocused:o,isChecked:i,isDisabled:s,checkboxButtonSize:a,model:c,handleChange:u}=kd(t,r),d=(0,n.inject)(Ga,void 0),p=l("checkbox"),h=(0,n.computed)((()=>{var e,t,n,r;const o=null!=(t=null==(e=null==d?void 0:d.fill)?void 0:e.value)?t:"";return{backgroundColor:o,borderColor:o,color:null!=(r=null==(n=null==d?void 0:d.textColor)?void 0:n.value)?r:"",boxShadow:o?`-1px 0 0 0 ${o}`:void 0}})),f=(0,n.computed)((()=>[p.b("button"),p.bm("button",a.value),p.is("disabled",s.value),p.is("checked",i.value),p.is("focus",o.value)]));return(e,t)=>((0,n.openBlock)(),(0,n.createElementBlock)("label",{class:(0,n.normalizeClass)((0,n.unref)(f))},[e.trueLabel||e.falseLabel?(0,n.withDirectives)(((0,n.openBlock)(),(0,n.createElementBlock)("input",{key:0,"onUpdate:modelValue":t[0]||(t[0]=e=>(0,n.isRef)(c)?c.value=e:null),class:(0,n.normalizeClass)((0,n.unref)(p).be("button","original")),type:"checkbox",name:e.name,tabindex:e.tabindex,disabled:(0,n.unref)(s),"true-value":e.trueLabel,"false-value":e.falseLabel,onChange:t[1]||(t[1]=(...e)=>(0,n.unref)(u)&&(0,n.unref)(u)(...e)),onFocus:t[2]||(t[2]=e=>o.value=!0),onBlur:t[3]||(t[3]=e=>o.value=!1),onClick:t[4]||(t[4]=(0,n.withModifiers)((()=>{}),["stop"]))},null,42,Od)),[[n.vModelCheckbox,(0,n.unref)(c)]]):(0,n.withDirectives)(((0,n.openBlock)(),(0,n.createElementBlock)("input",{key:1,"onUpdate:modelValue":t[5]||(t[5]=e=>(0,n.isRef)(c)?c.value=e:null),class:(0,n.normalizeClass)((0,n.unref)(p).be("button","original")),type:"checkbox",name:e.name,tabindex:e.tabindex,disabled:(0,n.unref)(s),value:e.label,onChange:t[6]||(t[6]=(...e)=>(0,n.unref)(u)&&(0,n.unref)(u)(...e)),onFocus:t[7]||(t[7]=e=>o.value=!0),onBlur:t[8]||(t[8]=e=>o.value=!1),onClick:t[9]||(t[9]=(0,n.withModifiers)((()=>{}),["stop"]))},null,42,Pd)),[[n.vModelCheckbox,(0,n.unref)(c)]]),e.$slots.default||e.label?((0,n.openBlock)(),(0,n.createElementBlock)("span",{key:2,class:(0,n.normalizeClass)((0,n.unref)(p).be("button","inner")),style:(0,n.normalizeStyle)((0,n.unref)(i)?(0,n.unref)(h):void 0)},[(0,n.renderSlot)(e.$slots,"default",{},(()=>[(0,n.createTextVNode)((0,n.toDisplayString)(e.label),1)]))],6)):(0,n.createCommentVNode)("v-if",!0)],2))}});var jd=tr(Bd,[["__file","/home/runner/work/element-plus/element-plus/packages/components/checkbox/src/checkbox-button.vue"]]),Hd=function(){try{var e=ye(Object,"defineProperty");return e({},"",{}),e}catch(t){}}(),Md=Hd;function Ld(e,t,n){"__proto__"==t&&Md?Md(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var qd=Ld,$d=Object.prototype,Vd=$d.hasOwnProperty;function Fd(e,t,n){var r=e[t];Vd.call(e,t)&&Ve(r,n)&&(void 0!==n||t in e)||qd(e,t,n)}var Ud=Fd;function zd(e,t,n,r){if(!U(e))return e;t=$t(t,e);var o=-1,i=t.length,s=i-1,a=e;while(null!=a&&++o<i){var c=Ut(t[o]),l=n;if("__proto__"===c||"constructor"===c||"prototype"===c)return e;if(o!=s){var u=a[c];l=r?r(u,c,a):void 0,void 0===l&&(l=U(u)?u:Nl(t[o+1])?[]:{})}Ud(a,c,l),a=a[c]}return e}var Kd=zd;function Wd(e,t,n){var r=-1,o=t.length,i={};while(++r<o){var s=t[r],a=Kt(e,s);n(a,s)&&Kd(i,$t(s,e),a)}return i}var Gd=Wd;function Yd(e,t){return null!=e&&t in Object(e)}var Jd=Yd;function Zd(e,t,n){t=$t(t,e);var r=-1,o=t.length,i=!1;while(++r<o){var s=Ut(t[r]);if(!(i=null!=e&&n(e,s)))break;e=e[s]}return i||++r!=o?i:(o=null==e?0:e.length,!!o&&Pl(o)&&Nl(s,o)&&(d(e)||vl(e)))}var Xd=Zd;function Qd(e,t){return null!=e&&Xd(e,t,Jd)}var ep=Qd;function tp(e,t){return Gd(e,t,(function(t,n){return ep(e,n)}))}var np=tp,rp=y?y.isConcatSpreadable:void 0;function op(e){return d(e)||vl(e)||!!(rp&&e&&e[rp])}var ip=op;function sp(e,t,n,r,o){var i=-1,s=e.length;n||(n=ip),o||(o=[]);while(++i<s){var a=e[i];t>0&&n(a)?t>1?sp(a,t-1,n,r,o):Jc(o,a):r||(o[o.length]=a)}return o}var ap=sp;function cp(e){var t=null==e?0:e.length;return t?ap(e,1):[]}var lp=cp;function up(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}var dp=up,pp=Math.max;function hp(e,t,n){return t=pp(void 0===t?e.length-1:t,0),function(){var r=arguments,o=-1,i=pp(r.length-t,0),s=Array(i);while(++o<i)s[o]=r[t+o];o=-1;var a=Array(t+1);while(++o<t)a[o]=r[o];return a[t]=n(s),dp(e,this,a)}}var fp=hp;function gp(e){return function(){return e}}var mp=gp;function vp(e){return e}var yp=vp,bp=Md?function(e,t){return Md(e,"toString",{configurable:!0,enumerable:!1,value:mp(t),writable:!0})}:yp,wp=bp,Sp=800,Tp=16,Cp=Date.now;function Ep(e){var t=0,n=0;return function(){var r=Cp(),o=Tp-(r-n);if(n=r,o>0){if(++t>=Sp)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var kp=Ep,xp=kp(wp),Ip=xp;function Rp(e){return Ip(fp(e,void 0,lp),e+"")}var _p=Rp,Np=_p((function(e,t){return null==e?{}:np(e,t)})),Ap=Np;const Op=Dn({modelValue:{type:An(Array),default:()=>[]},disabled:Boolean,min:Number,max:Number,size:Hn,label:String,fill:String,textColor:String,tag:{type:String,default:"div"},validateEvent:{type:Boolean,default:!0}}),Pp={[va]:e=>on(e),change:e=>on(e)},Dp=(0,n.defineComponent)({name:"ElCheckboxGroup"}),Bp=(0,n.defineComponent)({...Dp,props:Op,emits:Pp,setup(e,{emit:t}){const r=e,o=l("checkbox"),{formItem:i}=Lr(),{inputId:s,isLabeledByFormItem:a}=qr(r,{formItemContext:i}),c=async e=>{t(va,e),await(0,n.nextTick)(),t("change",e)},u=(0,n.computed)({get(){return r.modelValue},set(e){c(e)}});return(0,n.provide)(Ga,{...Ap((0,n.toRefs)(r),["size","min","max","disabled","validateEvent","fill","textColor"]),modelValue:u,changeEvent:c}),(0,n.watch)((()=>r.modelValue),(()=>{r.validateEvent&&(null==i||i.validate("change").catch((e=>In(e))))})),(e,t)=>{var r;return(0,n.openBlock)(),(0,n.createBlock)((0,n.resolveDynamicComponent)(e.tag),{id:(0,n.unref)(s),class:(0,n.normalizeClass)((0,n.unref)(o).b("group")),role:"group","aria-label":(0,n.unref)(a)?void 0:e.label||"checkbox-group","aria-labelledby":(0,n.unref)(a)?null==(r=(0,n.unref)(i))?void 0:r.labelId:void 0},{default:(0,n.withCtx)((()=>[(0,n.renderSlot)(e.$slots,"default")])),_:3},8,["id","class","aria-label","aria-labelledby"])}}});var jp=tr(Bp,[["__file","/home/runner/work/element-plus/element-plus/packages/components/checkbox/src/checkbox-group.vue"]]);const Hp=Yn(Ad,{CheckboxButton:jd,CheckboxGroup:jp});Zn(jd),Zn(jp);var Mp="top",Lp="bottom",qp="right",$p="left",Vp="auto",Fp=[Mp,Lp,qp,$p],Up="start",zp="end",Kp="clippingParents",Wp="viewport",Gp="popper",Yp="reference",Jp=Fp.reduce((function(e,t){return e.concat([t+"-"+Up,t+"-"+zp])}),[]),Zp=[].concat(Fp,[Vp]).reduce((function(e,t){return e.concat([t,t+"-"+Up,t+"-"+zp])}),[]),Xp="beforeRead",Qp="read",eh="afterRead",th="beforeMain",nh="main",rh="afterMain",oh="beforeWrite",ih="write",sh="afterWrite",ah=[Xp,Qp,eh,th,nh,rh,oh,ih,sh];function ch(e){return e?(e.nodeName||"").toLowerCase():null}function lh(e){if(null==e)return window;if("[object Window]"!==e.toString()){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function uh(e){var t=lh(e).Element;return e instanceof t||e instanceof Element}function dh(e){var t=lh(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function ph(e){if("undefined"==typeof ShadowRoot)return!1;var t=lh(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function hh(e){var t=e.state;Object.keys(t.elements).forEach((function(e){var n=t.styles[e]||{},r=t.attributes[e]||{},o=t.elements[e];!dh(o)||!ch(o)||(Object.assign(o.style,n),Object.keys(r).forEach((function(e){var t=r[e];!1===t?o.removeAttribute(e):o.setAttribute(e,!0===t?"":t)})))}))}function fh(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach((function(e){var r=t.elements[e],o=t.attributes[e]||{},i=Object.keys(t.styles.hasOwnProperty(e)?t.styles[e]:n[e]),s=i.reduce((function(e,t){return e[t]="",e}),{});!dh(r)||!ch(r)||(Object.assign(r.style,s),Object.keys(o).forEach((function(e){r.removeAttribute(e)})))}))}}var gh={name:"applyStyles",enabled:!0,phase:"write",fn:hh,effect:fh,requires:["computeStyles"]};function mh(e){return e.split("-")[0]}var vh=Math.max,yh=Math.min,bh=Math.round;function wh(e,t){void 0===t&&(t=!1);var n=e.getBoundingClientRect(),r=1,o=1;if(dh(e)&&t){var i=e.offsetHeight,s=e.offsetWidth;s>0&&(r=bh(n.width)/s||1),i>0&&(o=bh(n.height)/i||1)}return{width:n.width/r,height:n.height/o,top:n.top/o,right:n.right/r,bottom:n.bottom/o,left:n.left/r,x:n.left/r,y:n.top/o}}function Sh(e){var t=wh(e),n=e.offsetWidth,r=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-r)<=1&&(r=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:r}}function Th(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&ph(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function Ch(e){return lh(e).getComputedStyle(e)}function Eh(e){return["table","td","th"].indexOf(ch(e))>=0}function kh(e){return((uh(e)?e.ownerDocument:e.document)||window.document).documentElement}function xh(e){return"html"===ch(e)?e:e.assignedSlot||e.parentNode||(ph(e)?e.host:null)||kh(e)}function Ih(e){return dh(e)&&"fixed"!==Ch(e).position?e.offsetParent:null}function Rh(e){var t=-1!==navigator.userAgent.toLowerCase().indexOf("firefox"),n=-1!==navigator.userAgent.indexOf("Trident");if(n&&dh(e)){var r=Ch(e);if("fixed"===r.position)return null}var o=xh(e);for(ph(o)&&(o=o.host);dh(o)&&["html","body"].indexOf(ch(o))<0;){var i=Ch(o);if("none"!==i.transform||"none"!==i.perspective||"paint"===i.contain||-1!==["transform","perspective"].indexOf(i.willChange)||t&&"filter"===i.willChange||t&&i.filter&&"none"!==i.filter)return o;o=o.parentNode}return null}function _h(e){for(var t=lh(e),n=Ih(e);n&&Eh(n)&&"static"===Ch(n).position;)n=Ih(n);return n&&("html"===ch(n)||"body"===ch(n)&&"static"===Ch(n).position)?t:n||Rh(e)||t}function Nh(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function Ah(e,t,n){return vh(e,yh(t,n))}function Oh(e,t,n){var r=Ah(e,t,n);return r>n?n:r}function Ph(){return{top:0,right:0,bottom:0,left:0}}function Dh(e){return Object.assign({},Ph(),e)}function Bh(e,t){return t.reduce((function(t,n){return t[n]=e,t}),{})}var jh=function(e,t){return e="function"==typeof e?e(Object.assign({},t.rects,{placement:t.placement})):e,Dh("number"!=typeof e?e:Bh(e,Fp))};function Hh(e){var t,n=e.state,r=e.name,o=e.options,i=n.elements.arrow,s=n.modifiersData.popperOffsets,a=mh(n.placement),c=Nh(a),l=[$p,qp].indexOf(a)>=0,u=l?"height":"width";if(i&&s){var d=jh(o.padding,n),p=Sh(i),h="y"===c?Mp:$p,f="y"===c?Lp:qp,g=n.rects.reference[u]+n.rects.reference[c]-s[c]-n.rects.popper[u],m=s[c]-n.rects.reference[c],v=_h(i),y=v?"y"===c?v.clientHeight||0:v.clientWidth||0:0,b=g/2-m/2,w=d[h],S=y-p[u]-d[f],T=y/2-p[u]/2+b,C=Ah(w,T,S),E=c;n.modifiersData[r]=(t={},t[E]=C,t.centerOffset=C-T,t)}}function Mh(e){var t=e.state,n=e.options,r=n.element,o=void 0===r?"[data-popper-arrow]":r;null!=o&&("string"==typeof o&&(o=t.elements.popper.querySelector(o),!o)||!Th(t.elements.popper,o)||(t.elements.arrow=o))}var Lh={name:"arrow",enabled:!0,phase:"main",fn:Hh,effect:Mh,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function qh(e){return e.split("-")[1]}var $h={top:"auto",right:"auto",bottom:"auto",left:"auto"};function Vh(e){var t=e.x,n=e.y,r=window,o=r.devicePixelRatio||1;return{x:bh(t*o)/o||0,y:bh(n*o)/o||0}}function Fh(e){var t,n=e.popper,r=e.popperRect,o=e.placement,i=e.variation,s=e.offsets,a=e.position,c=e.gpuAcceleration,l=e.adaptive,u=e.roundOffsets,d=e.isFixed,p=s.x,h=void 0===p?0:p,f=s.y,g=void 0===f?0:f,m="function"==typeof u?u({x:h,y:g}):{x:h,y:g};h=m.x,g=m.y;var v=s.hasOwnProperty("x"),y=s.hasOwnProperty("y"),b=$p,w=Mp,S=window;if(l){var T=_h(n),C="clientHeight",E="clientWidth";if(T===lh(n)&&(T=kh(n),"static"!==Ch(T).position&&"absolute"===a&&(C="scrollHeight",E="scrollWidth")),o===Mp||(o===$p||o===qp)&&i===zp){w=Lp;var k=d&&T===S&&S.visualViewport?S.visualViewport.height:T[C];g-=k-r.height,g*=c?1:-1}if(o===$p||(o===Mp||o===Lp)&&i===zp){b=qp;var x=d&&T===S&&S.visualViewport?S.visualViewport.width:T[E];h-=x-r.width,h*=c?1:-1}}var I,R=Object.assign({position:a},l&&$h),_=!0===u?Vh({x:h,y:g}):{x:h,y:g};return h=_.x,g=_.y,c?Object.assign({},R,(I={},I[w]=y?"0":"",I[b]=v?"0":"",I.transform=(S.devicePixelRatio||1)<=1?"translate("+h+"px, "+g+"px)":"translate3d("+h+"px, "+g+"px, 0)",I)):Object.assign({},R,(t={},t[w]=y?g+"px":"",t[b]=v?h+"px":"",t.transform="",t))}function Uh(e){var t=e.state,n=e.options,r=n.gpuAcceleration,o=void 0===r||r,i=n.adaptive,s=void 0===i||i,a=n.roundOffsets,c=void 0===a||a,l={placement:mh(t.placement),variation:qh(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:o,isFixed:"fixed"===t.options.strategy};null!=t.modifiersData.popperOffsets&&(t.styles.popper=Object.assign({},t.styles.popper,Fh(Object.assign({},l,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:s,roundOffsets:c})))),null!=t.modifiersData.arrow&&(t.styles.arrow=Object.assign({},t.styles.arrow,Fh(Object.assign({},l,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:c})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}var zh={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:Uh,data:{}},Kh={passive:!0};function Wh(e){var t=e.state,n=e.instance,r=e.options,o=r.scroll,i=void 0===o||o,s=r.resize,a=void 0===s||s,c=lh(t.elements.popper),l=[].concat(t.scrollParents.reference,t.scrollParents.popper);return i&&l.forEach((function(e){e.addEventListener("scroll",n.update,Kh)})),a&&c.addEventListener("resize",n.update,Kh),function(){i&&l.forEach((function(e){e.removeEventListener("scroll",n.update,Kh)})),a&&c.removeEventListener("resize",n.update,Kh)}}var Gh={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:Wh,data:{}},Yh={left:"right",right:"left",bottom:"top",top:"bottom"};function Jh(e){return e.replace(/left|right|bottom|top/g,(function(e){return Yh[e]}))}var Zh={start:"end",end:"start"};function Xh(e){return e.replace(/start|end/g,(function(e){return Zh[e]}))}function Qh(e){var t=lh(e),n=t.pageXOffset,r=t.pageYOffset;return{scrollLeft:n,scrollTop:r}}function ef(e){return wh(kh(e)).left+Qh(e).scrollLeft}function tf(e){var t=lh(e),n=kh(e),r=t.visualViewport,o=n.clientWidth,i=n.clientHeight,s=0,a=0;return r&&(o=r.width,i=r.height,/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||(s=r.offsetLeft,a=r.offsetTop)),{width:o,height:i,x:s+ef(e),y:a}}function nf(e){var t,n=kh(e),r=Qh(e),o=null==(t=e.ownerDocument)?void 0:t.body,i=vh(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),s=vh(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),a=-r.scrollLeft+ef(e),c=-r.scrollTop;return"rtl"===Ch(o||n).direction&&(a+=vh(n.clientWidth,o?o.clientWidth:0)-i),{width:i,height:s,x:a,y:c}}function rf(e){var t=Ch(e),n=t.overflow,r=t.overflowX,o=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+o+r)}function of(e){return["html","body","#document"].indexOf(ch(e))>=0?e.ownerDocument.body:dh(e)&&rf(e)?e:of(xh(e))}function sf(e,t){var n;void 0===t&&(t=[]);var r=of(e),o=r===(null==(n=e.ownerDocument)?void 0:n.body),i=lh(r),s=o?[i].concat(i.visualViewport||[],rf(r)?r:[]):r,a=t.concat(s);return o?a:a.concat(sf(xh(s)))}function af(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function cf(e){var t=wh(e);return t.top=t.top+e.clientTop,t.left=t.left+e.clientLeft,t.bottom=t.top+e.clientHeight,t.right=t.left+e.clientWidth,t.width=e.clientWidth,t.height=e.clientHeight,t.x=t.left,t.y=t.top,t}function lf(e,t){return t===Wp?af(tf(e)):uh(t)?cf(t):af(nf(kh(e)))}function uf(e){var t=sf(xh(e)),n=["absolute","fixed"].indexOf(Ch(e).position)>=0,r=n&&dh(e)?_h(e):e;return uh(r)?t.filter((function(e){return uh(e)&&Th(e,r)&&"body"!==ch(e)})):[]}function df(e,t,n){var r="clippingParents"===t?uf(e):[].concat(t),o=[].concat(r,[n]),i=o[0],s=o.reduce((function(t,n){var r=lf(e,n);return t.top=vh(r.top,t.top),t.right=yh(r.right,t.right),t.bottom=yh(r.bottom,t.bottom),t.left=vh(r.left,t.left),t}),lf(e,i));return s.width=s.right-s.left,s.height=s.bottom-s.top,s.x=s.left,s.y=s.top,s}function pf(e){var t,n=e.reference,r=e.element,o=e.placement,i=o?mh(o):null,s=o?qh(o):null,a=n.x+n.width/2-r.width/2,c=n.y+n.height/2-r.height/2;switch(i){case Mp:t={x:a,y:n.y-r.height};break;case Lp:t={x:a,y:n.y+n.height};break;case qp:t={x:n.x+n.width,y:c};break;case $p:t={x:n.x-r.width,y:c};break;default:t={x:n.x,y:n.y}}var l=i?Nh(i):null;if(null!=l){var u="y"===l?"height":"width";switch(s){case Up:t[l]=t[l]-(n[u]/2-r[u]/2);break;case zp:t[l]=t[l]+(n[u]/2-r[u]/2);break}}return t}function hf(e,t){void 0===t&&(t={});var n=t,r=n.placement,o=void 0===r?e.placement:r,i=n.boundary,s=void 0===i?Kp:i,a=n.rootBoundary,c=void 0===a?Wp:a,l=n.elementContext,u=void 0===l?Gp:l,d=n.altBoundary,p=void 0!==d&&d,h=n.padding,f=void 0===h?0:h,g=Dh("number"!=typeof f?f:Bh(f,Fp)),m=u===Gp?Yp:Gp,v=e.rects.popper,y=e.elements[p?m:u],b=df(uh(y)?y:y.contextElement||kh(e.elements.popper),s,c),w=wh(e.elements.reference),S=pf({reference:w,element:v,strategy:"absolute",placement:o}),T=af(Object.assign({},v,S)),C=u===Gp?T:w,E={top:b.top-C.top+g.top,bottom:C.bottom-b.bottom+g.bottom,left:b.left-C.left+g.left,right:C.right-b.right+g.right},k=e.modifiersData.offset;if(u===Gp&&k){var x=k[o];Object.keys(E).forEach((function(e){var t=[qp,Lp].indexOf(e)>=0?1:-1,n=[Mp,Lp].indexOf(e)>=0?"y":"x";E[e]+=x[n]*t}))}return E}function ff(e,t){void 0===t&&(t={});var n=t,r=n.placement,o=n.boundary,i=n.rootBoundary,s=n.padding,a=n.flipVariations,c=n.allowedAutoPlacements,l=void 0===c?Zp:c,u=qh(r),d=u?a?Jp:Jp.filter((function(e){return qh(e)===u})):Fp,p=d.filter((function(e){return l.indexOf(e)>=0}));0===p.length&&(p=d);var h=p.reduce((function(t,n){return t[n]=hf(e,{placement:n,boundary:o,rootBoundary:i,padding:s})[mh(n)],t}),{});return Object.keys(h).sort((function(e,t){return h[e]-h[t]}))}function gf(e){if(mh(e)===Vp)return[];var t=Jh(e);return[Xh(e),t,Xh(t)]}function mf(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._skip){for(var o=n.mainAxis,i=void 0===o||o,s=n.altAxis,a=void 0===s||s,c=n.fallbackPlacements,l=n.padding,u=n.boundary,d=n.rootBoundary,p=n.altBoundary,h=n.flipVariations,f=void 0===h||h,g=n.allowedAutoPlacements,m=t.options.placement,v=mh(m),y=v===m,b=c||(y||!f?[Jh(m)]:gf(m)),w=[m].concat(b).reduce((function(e,n){return e.concat(mh(n)===Vp?ff(t,{placement:n,boundary:u,rootBoundary:d,padding:l,flipVariations:f,allowedAutoPlacements:g}):n)}),[]),S=t.rects.reference,T=t.rects.popper,C=new Map,E=!0,k=w[0],x=0;x<w.length;x++){var I=w[x],R=mh(I),_=qh(I)===Up,N=[Mp,Lp].indexOf(R)>=0,A=N?"width":"height",O=hf(t,{placement:I,boundary:u,rootBoundary:d,altBoundary:p,padding:l}),P=N?_?qp:$p:_?Lp:Mp;S[A]>T[A]&&(P=Jh(P));var D=Jh(P),B=[];if(i&&B.push(O[R]<=0),a&&B.push(O[P]<=0,O[D]<=0),B.every((function(e){return e}))){k=I,E=!1;break}C.set(I,B)}if(E)for(var j=f?3:1,H=function(e){var t=w.find((function(t){var n=C.get(t);if(n)return n.slice(0,e).every((function(e){return e}))}));if(t)return k=t,"break"},M=j;M>0;M--){var L=H(M);if("break"===L)break}t.placement!==k&&(t.modifiersData[r]._skip=!0,t.placement=k,t.reset=!0)}}var vf={name:"flip",enabled:!0,phase:"main",fn:mf,requiresIfExists:["offset"],data:{_skip:!1}};function yf(e,t,n){return void 0===n&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function bf(e){return[Mp,qp,Lp,$p].some((function(t){return e[t]>=0}))}function wf(e){var t=e.state,n=e.name,r=t.rects.reference,o=t.rects.popper,i=t.modifiersData.preventOverflow,s=hf(t,{elementContext:"reference"}),a=hf(t,{altBoundary:!0}),c=yf(s,r),l=yf(a,o,i),u=bf(c),d=bf(l);t.modifiersData[n]={referenceClippingOffsets:c,popperEscapeOffsets:l,isReferenceHidden:u,hasPopperEscaped:d},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":d})}var Sf={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:wf};function Tf(e,t,n){var r=mh(e),o=[$p,Mp].indexOf(r)>=0?-1:1,i="function"==typeof n?n(Object.assign({},t,{placement:e})):n,s=i[0],a=i[1];return s=s||0,a=(a||0)*o,[$p,qp].indexOf(r)>=0?{x:a,y:s}:{x:s,y:a}}function Cf(e){var t=e.state,n=e.options,r=e.name,o=n.offset,i=void 0===o?[0,0]:o,s=Zp.reduce((function(e,n){return e[n]=Tf(n,t.rects,i),e}),{}),a=s[t.placement],c=a.x,l=a.y;null!=t.modifiersData.popperOffsets&&(t.modifiersData.popperOffsets.x+=c,t.modifiersData.popperOffsets.y+=l),t.modifiersData[r]=s}var Ef={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:Cf};function kf(e){var t=e.state,n=e.name;t.modifiersData[n]=pf({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})}var xf={name:"popperOffsets",enabled:!0,phase:"read",fn:kf,data:{}};function If(e){return"x"===e?"y":"x"}function Rf(e){var t=e.state,n=e.options,r=e.name,o=n.mainAxis,i=void 0===o||o,s=n.altAxis,a=void 0!==s&&s,c=n.boundary,l=n.rootBoundary,u=n.altBoundary,d=n.padding,p=n.tether,h=void 0===p||p,f=n.tetherOffset,g=void 0===f?0:f,m=hf(t,{boundary:c,rootBoundary:l,padding:d,altBoundary:u}),v=mh(t.placement),y=qh(t.placement),b=!y,w=Nh(v),S=If(w),T=t.modifiersData.popperOffsets,C=t.rects.reference,E=t.rects.popper,k="function"==typeof g?g(Object.assign({},t.rects,{placement:t.placement})):g,x="number"==typeof k?{mainAxis:k,altAxis:k}:Object.assign({mainAxis:0,altAxis:0},k),I=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,R={x:0,y:0};if(T){if(i){var _,N="y"===w?Mp:$p,A="y"===w?Lp:qp,O="y"===w?"height":"width",P=T[w],D=P+m[N],B=P-m[A],j=h?-E[O]/2:0,H=y===Up?C[O]:E[O],M=y===Up?-E[O]:-C[O],L=t.elements.arrow,q=h&&L?Sh(L):{width:0,height:0},$=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:Ph(),V=$[N],F=$[A],U=Ah(0,C[O],q[O]),z=b?C[O]/2-j-U-V-x.mainAxis:H-U-V-x.mainAxis,K=b?-C[O]/2+j+U+F+x.mainAxis:M+U+F+x.mainAxis,W=t.elements.arrow&&_h(t.elements.arrow),G=W?"y"===w?W.clientTop||0:W.clientLeft||0:0,Y=null!=(_=null==I?void 0:I[w])?_:0,J=P+z-Y-G,Z=P+K-Y,X=Ah(h?yh(D,J):D,P,h?vh(B,Z):B);T[w]=X,R[w]=X-P}if(a){var Q,ee="x"===w?Mp:$p,te="x"===w?Lp:qp,ne=T[S],re="y"===S?"height":"width",oe=ne+m[ee],ie=ne-m[te],se=-1!==[Mp,$p].indexOf(v),ae=null!=(Q=null==I?void 0:I[S])?Q:0,ce=se?oe:ne-C[re]-E[re]-ae+x.altAxis,le=se?ne+C[re]+E[re]-ae-x.altAxis:ie,ue=h&&se?Oh(ce,ne,le):Ah(h?ce:oe,ne,h?le:ie);T[S]=ue,R[S]=ue-ne}t.modifiersData[r]=R}}var _f={name:"preventOverflow",enabled:!0,phase:"main",fn:Rf,requiresIfExists:["offset"]};function Nf(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function Af(e){return e!==lh(e)&&dh(e)?Nf(e):Qh(e)}function Of(e){var t=e.getBoundingClientRect(),n=bh(t.width)/e.offsetWidth||1,r=bh(t.height)/e.offsetHeight||1;return 1!==n||1!==r}function Pf(e,t,n){void 0===n&&(n=!1);var r=dh(t),o=dh(t)&&Of(t),i=kh(t),s=wh(e,o),a={scrollLeft:0,scrollTop:0},c={x:0,y:0};return(r||!r&&!n)&&(("body"!==ch(t)||rf(i))&&(a=Af(t)),dh(t)?(c=wh(t,!0),c.x+=t.clientLeft,c.y+=t.clientTop):i&&(c.x=ef(i))),{x:s.left+a.scrollLeft-c.x,y:s.top+a.scrollTop-c.y,width:s.width,height:s.height}}function Df(e){var t=new Map,n=new Set,r=[];function o(e){n.add(e.name);var i=[].concat(e.requires||[],e.requiresIfExists||[]);i.forEach((function(e){if(!n.has(e)){var r=t.get(e);r&&o(r)}})),r.push(e)}return e.forEach((function(e){t.set(e.name,e)})),e.forEach((function(e){n.has(e.name)||o(e)})),r}function Bf(e){var t=Df(e);return ah.reduce((function(e,n){return e.concat(t.filter((function(e){return e.phase===n})))}),[])}function jf(e){var t;return function(){return t||(t=new Promise((function(n){Promise.resolve().then((function(){t=void 0,n(e())}))}))),t}}function Hf(e){var t=e.reduce((function(e,t){var n=e[t.name];return e[t.name]=n?Object.assign({},n,t,{options:Object.assign({},n.options,t.options),data:Object.assign({},n.data,t.data)}):t,e}),{});return Object.keys(t).map((function(e){return t[e]}))}var Mf={placement:"bottom",modifiers:[],strategy:"absolute"};function Lf(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return!t.some((function(e){return!(e&&"function"==typeof e.getBoundingClientRect)}))}function qf(e){void 0===e&&(e={});var t=e,n=t.defaultModifiers,r=void 0===n?[]:n,o=t.defaultOptions,i=void 0===o?Mf:o;return function(e,t,n){void 0===n&&(n=i);var o={placement:"bottom",orderedModifiers:[],options:Object.assign({},Mf,i),modifiersData:{},elements:{reference:e,popper:t},attributes:{},styles:{}},s=[],a=!1,c={state:o,setOptions:function(n){var s="function"==typeof n?n(o.options):n;u(),o.options=Object.assign({},i,o.options,s),o.scrollParents={reference:uh(e)?sf(e):e.contextElement?sf(e.contextElement):[],popper:sf(t)};var a=Bf(Hf([].concat(r,o.options.modifiers)));return o.orderedModifiers=a.filter((function(e){return e.enabled})),l(),c.update()},forceUpdate:function(){if(!a){var e=o.elements,t=e.reference,n=e.popper;if(Lf(t,n)){o.rects={reference:Pf(t,_h(n),"fixed"===o.options.strategy),popper:Sh(n)},o.reset=!1,o.placement=o.options.placement,o.orderedModifiers.forEach((function(e){return o.modifiersData[e.name]=Object.assign({},e.data)}));for(var r=0;r<o.orderedModifiers.length;r++)if(!0!==o.reset){var i=o.orderedModifiers[r],s=i.fn,l=i.options,u=void 0===l?{}:l,d=i.name;"function"==typeof s&&(o=s({state:o,options:u,name:d,instance:c})||o)}else o.reset=!1,r=-1}}},update:jf((function(){return new Promise((function(e){c.forceUpdate(),e(o)}))})),destroy:function(){u(),a=!0}};if(!Lf(e,t))return c;function l(){o.orderedModifiers.forEach((function(e){var t=e.name,n=e.options,r=void 0===n?{}:n,i=e.effect;if("function"==typeof i){var a=i({state:o,name:t,instance:c,options:r}),l=function(){};s.push(a||l)}}))}function u(){s.forEach((function(e){return e()})),s=[]}return c.setOptions(n).then((function(e){!a&&n.onFirstUpdate&&n.onFirstUpdate(e)})),c}}qf();var $f=[Gh,xf,zh,gh],Vf=(qf({defaultModifiers:$f}),[Gh,xf,zh,gh,Ef,vf,_f,Lh,Sf]),Ff=qf({defaultModifiers:Vf});const Uf=Symbol("popper"),zf=Symbol("popperContent"),Kf=["dialog","grid","group","listbox","menu","navigation","tooltip","tree"],Wf=Dn({role:{type:String,values:Kf,default:"tooltip"}}),Gf=(0,n.defineComponent)({name:"ElPopper",inheritAttrs:!1}),Yf=(0,n.defineComponent)({...Gf,props:Wf,setup(e,{expose:t}){const r=e,o=(0,n.ref)(),i=(0,n.ref)(),s=(0,n.ref)(),a=(0,n.ref)(),c=(0,n.computed)((()=>r.role)),l={triggerRef:o,popperInstanceRef:i,contentRef:s,referenceRef:a,role:c};return t(l),(0,n.provide)(Uf,l),(e,t)=>(0,n.renderSlot)(e.$slots,"default")}});var Jf=tr(Yf,[["__file","/home/runner/work/element-plus/element-plus/packages/components/popper/src/popper.vue"]]);const Zf=Yn(Jf),Xf=Symbol("elTooltip");function Qf(){let e;const t=(t,r)=>{n(),e=window.setTimeout(t,r)},n=()=>window.clearTimeout(e);return Or((()=>n())),{registerTimeout:t,cancelTimeout:n}}const eg=Dn({showAfter:{type:Number,default:0},hideAfter:{type:Number,default:200},autoClose:{type:Number,default:0}}),tg=({showAfter:e,hideAfter:t,autoClose:r,open:o,close:i})=>{const{registerTimeout:s}=Qf(),{registerTimeout:a,cancelTimeout:c}=Qf(),l=t=>{s((()=>{o(t);const e=(0,n.unref)(r);yn(e)&&e>0&&a((()=>{i(t)}),e)}),(0,n.unref)(e))},u=e=>{c(),s((()=>{i(e)}),(0,n.unref)(t))};return{onOpen:l,onClose:u}},ng=["fixed","absolute"],rg=Dn({boundariesPadding:{type:Number,default:0},fallbackPlacements:{type:An(Array),default:void 0},gpuAcceleration:{type:Boolean,default:!0},offset:{type:Number,default:12},placement:{type:String,values:Zp,default:"bottom"},popperOptions:{type:An(Object),default:()=>({})},strategy:{type:String,values:ng,default:"absolute"}}),og=Dn({...rg,id:String,style:{type:An([String,Array,Object])},className:{type:An([String,Array,Object])},effect:{type:String,default:"dark"},visible:Boolean,enterable:{type:Boolean,default:!0},pure:Boolean,focusOnShow:{type:Boolean,default:!1},trapping:{type:Boolean,default:!1},popperClass:{type:An([String,Array,Object])},popperStyle:{type:An([String,Array,Object])},referenceEl:{type:An(Object)},triggerTargetEl:{type:An(Object)},stopPopperMouseEvent:{type:Boolean,default:!0},ariaLabel:{type:String,default:void 0},virtualTriggering:Boolean,zIndex:Number}),ig={mouseenter:e=>e instanceof MouseEvent,mouseleave:e=>e instanceof MouseEvent,focus:()=>!0,blur:()=>!0,close:()=>!0},sg=Dn({...eg,...og,appendTo:{type:An([String,Object])},content:{type:String,default:""},rawContent:{type:Boolean,default:!1},persistent:Boolean,ariaLabel:String,visible:{type:An(Boolean),default:null},transition:String,teleported:{type:Boolean,default:!0},disabled:Boolean}),ag=Dn({virtualRef:{type:An(Object)},virtualTriggering:Boolean,onMouseenter:{type:An(Function)},onMouseleave:{type:An(Function)},onClick:{type:An(Function)},onKeydown:{type:An(Function)},onFocus:{type:An(Function)},onBlur:{type:An(Function)},onContextmenu:{type:An(Function)},id:String,open:Boolean}),cg={tab:"Tab",enter:"Enter",space:"Space",left:"ArrowLeft",up:"ArrowUp",right:"ArrowRight",down:"ArrowDown",esc:"Escape",delete:"Delete",backspace:"Backspace",numpadEnter:"NumpadEnter",pageUp:"PageUp",pageDown:"PageDown",home:"Home",end:"End"},lg=Dn({...ag,disabled:Boolean,trigger:{type:An([String,Array]),default:"hover"},triggerKeys:{type:An(Array),default:()=>[cg.enter,cg.space]}}),ug=Pn({type:An(Boolean),default:null}),dg=Pn({type:An(Function)}),pg=e=>{const t=`update:${e}`,r=`onUpdate:${e}`,o=[t],i={[e]:ug,[r]:dg},s=({indicator:o,toggleReason:i,shouldHideWhenRouteChanges:s,shouldProceed:a,onShow:c,onHide:l})=>{const u=(0,n.getCurrentInstance)(),{emit:d}=u,p=u.props,h=(0,n.computed)((()=>sn(p[r]))),f=(0,n.computed)((()=>null===p[e])),g=e=>{!0!==o.value&&(o.value=!0,i&&(i.value=e),sn(c)&&c(e))},m=e=>{!1!==o.value&&(o.value=!1,i&&(i.value=e),sn(l)&&l(e))},v=e=>{if(!0===p.disabled||sn(a)&&!a())return;const n=h.value&&xr;n&&d(t,!0),!f.value&&n||g(e)},y=e=>{if(!0===p.disabled||!xr)return;const n=h.value&&xr;n&&d(t,!1),!f.value&&n||m(e)},b=e=>{vn(e)&&(p.disabled&&e?h.value&&d(t,!1):o.value!==e&&(e?g():m()))},w=()=>{o.value?y():v()};return(0,n.watch)((()=>p[e]),b),s&&void 0!==u.appContext.config.globalProperties.$route&&(0,n.watch)((()=>({...u.proxy.$route})),(()=>{s.value&&o.value&&y()})),(0,n.onMounted)((()=>{b(p[e])})),{hide:y,show:v,toggle:w,hasUpdateHandler:h}};return{useModelToggle:s,useModelToggleProps:i,useModelToggleEmits:o}},{useModelToggle:hg,useModelToggleProps:fg,useModelToggleEmits:gg}=pg("modelValue"),mg=Dn({arrowOffset:{type:Number,default:5}}),{useModelToggleProps:vg,useModelToggleEmits:yg,useModelToggle:bg}=pg("visible"),wg=Dn({...Wf,...vg,...sg,...lg,...mg,showArrow:{type:Boolean,default:!0}}),Sg=[...yg,"before-show","before-hide","show","hide","open","close"],Tg=(e,t)=>on(e)?e.includes(t):e===t,Cg=(e,t,r)=>o=>{Tg((0,n.unref)(e),t)&&r(o)},Eg=(e,t,{checkForDefaultPrevented:n=!0}={})=>{const r=r=>{const o=null==e?void 0:e(r);if(!1===n||!o)return null==t?void 0:t(r)};return r},kg=e=>t=>"mouse"===t.pointerType?e(t):void 0,xg=Symbol("elForwardRef"),Ig=e=>{const t=t=>{e.value=t};(0,n.provide)(xg,{setForwardRef:t})},Rg=e=>({mounted(t){e(t)},updated(t){e(t)},unmounted(){e(null)}}),_g="ElOnlyChild",Ng=(0,n.defineComponent)({name:_g,setup(e,{slots:t,attrs:r}){var o;const i=(0,n.inject)(xg),s=Rg(null!=(o=null==i?void 0:i.setForwardRef)?o:tn);return()=>{var e;const o=null==(e=t.default)?void 0:e.call(t,r);if(!o)return null;if(o.length>1)return In(_g,"requires exact only one valid child."),null;const i=Ag(o);return i?(0,n.withDirectives)((0,n.cloneVNode)(i,r),[[s]]):(In(_g,"no valid child node found"),null)}}});function Ag(e){if(!e)return null;const t=e;for(const r of t){if(cn(r))switch(r.type){case n.Comment:continue;case n.Text:case"svg":return Og(r);case n.Fragment:return Ag(r.children);default:return r}return Og(r)}return null}function Og(e){const t=l("only-child");return(0,n.createVNode)("span",{class:t.e("content")},[e])}const Pg=(0,n.defineComponent)({name:"ElPopperTrigger",inheritAttrs:!1}),Dg=(0,n.defineComponent)({...Pg,props:ag,setup(e,{expose:t}){const r=e,{role:o,triggerRef:i}=(0,n.inject)(Uf,void 0);Ig(i);const s=(0,n.computed)((()=>c.value?r.id:void 0)),a=(0,n.computed)((()=>{if(o&&"tooltip"===o.value)return r.open&&r.id?r.id:void 0})),c=(0,n.computed)((()=>{if(o&&"tooltip"!==o.value)return o.value})),l=(0,n.computed)((()=>c.value?`${r.open}`:void 0));let u;return(0,n.onMounted)((()=>{(0,n.watch)((()=>r.virtualRef),(e=>{e&&(i.value=qs(e))}),{immediate:!0}),(0,n.watch)(i,((e,t)=>{null==u||u(),u=void 0,bn(e)&&(["onMouseenter","onMouseleave","onClick","onKeydown","onFocus","onBlur","onContextmenu"].forEach((n=>{var o;const i=r[n];i&&(e.addEventListener(n.slice(2).toLowerCase(),i),null==(o=null==t?void 0:t.removeEventListener)||o.call(t,n.slice(2).toLowerCase(),i))})),u=(0,n.watch)([s,a,c,l],(t=>{["aria-controls","aria-describedby","aria-haspopup","aria-expanded"].forEach(((n,r)=>{Ls(t[r])?e.removeAttribute(n):e.setAttribute(n,t[r])}))}),{immediate:!0})),bn(t)&&["aria-controls","aria-describedby","aria-haspopup","aria-expanded"].forEach((e=>t.removeAttribute(e)))}),{immediate:!0})})),(0,n.onBeforeUnmount)((()=>{null==u||u(),u=void 0})),t({triggerRef:i}),(e,t)=>e.virtualTriggering?(0,n.createCommentVNode)("v-if",!0):((0,n.openBlock)(),(0,n.createBlock)((0,n.unref)(Ng),(0,n.mergeProps)({key:0},e.$attrs,{"aria-controls":(0,n.unref)(s),"aria-describedby":(0,n.unref)(a),"aria-expanded":(0,n.unref)(l),"aria-haspopup":(0,n.unref)(c)}),{default:(0,n.withCtx)((()=>[(0,n.renderSlot)(e.$slots,"default")])),_:3},16,["aria-controls","aria-describedby","aria-expanded","aria-haspopup"]))}});var Bg=tr(Dg,[["__file","/home/runner/work/element-plus/element-plus/packages/components/popper/src/trigger.vue"]]);const jg=(0,n.defineComponent)({name:"ElTooltipTrigger"}),Hg=(0,n.defineComponent)({...jg,props:lg,setup(e,{expose:t}){const r=e,o=l("tooltip"),{controlled:i,id:s,open:a,onOpen:c,onClose:u,onToggle:d}=(0,n.inject)(Xf,void 0),p=(0,n.ref)(null),h=()=>{if((0,n.unref)(i)||r.disabled)return!0},f=(0,n.toRef)(r,"trigger"),g=Eg(h,Cg(f,"hover",c)),m=Eg(h,Cg(f,"hover",u)),v=Eg(h,Cg(f,"click",(e=>{0===e.button&&d(e)}))),y=Eg(h,Cg(f,"focus",c)),b=Eg(h,Cg(f,"focus",u)),w=Eg(h,Cg(f,"contextmenu",(e=>{e.preventDefault(),d(e)}))),S=Eg(h,(e=>{const{code:t}=e;r.triggerKeys.includes(t)&&(e.preventDefault(),d(e))}));return t({triggerRef:p}),(e,t)=>((0,n.openBlock)(),(0,n.createBlock)((0,n.unref)(Bg),{id:(0,n.unref)(s),"virtual-ref":e.virtualRef,open:(0,n.unref)(a),"virtual-triggering":e.virtualTriggering,class:(0,n.normalizeClass)((0,n.unref)(o).e("trigger")),onBlur:(0,n.unref)(b),onClick:(0,n.unref)(v),onContextmenu:(0,n.unref)(w),onFocus:(0,n.unref)(y),onMouseenter:(0,n.unref)(g),onMouseleave:(0,n.unref)(m),onKeydown:(0,n.unref)(S)},{default:(0,n.withCtx)((()=>[(0,n.renderSlot)(e.$slots,"default")])),_:3},8,["id","virtual-ref","open","virtual-triggering","class","onBlur","onClick","onContextmenu","onFocus","onMouseenter","onMouseleave","onKeydown"]))}});var Mg=tr(Hg,[["__file","/home/runner/work/element-plus/element-plus/packages/components/tooltip/src/trigger.vue"]]);let Lg;const qg=()=>{const e=c(),t=Hr(),r=(0,n.computed)((()=>`${e.value}-popper-container-${t.prefix}`)),o=(0,n.computed)((()=>`#${r.value}`));return{id:r,selector:o}},$g=e=>{const t=document.createElement("div");return t.id=e,document.body.appendChild(t),t},Vg=()=>{const{id:e,selector:t}=qg();return(0,n.onBeforeMount)((()=>{xr&&(Lg||document.body.querySelector(t.value)||(Lg=$g(e.value)))})),{id:e,selector:t}},Fg=(e,t)=>{const r=(0,n.ref)(!1),o=(0,n.ref)(),i=()=>{t("focus")},s=e=>{var n;"pointer"!==(null==(n=e.detail)?void 0:n.focusReason)&&(o.value="first",t("blur"))},a=t=>{e.visible&&!r.value&&(t.target&&(o.value=t.target),r.value=!0)},c=t=>{e.trapping||("pointer"===t.detail.focusReason&&t.preventDefault(),r.value=!1)},l=()=>{r.value=!1,t("close")};return{focusStartRef:o,trapped:r,onFocusAfterReleased:s,onFocusAfterTrapped:i,onFocusInTrap:a,onFocusoutPrevented:c,onReleaseRequested:l}};function Ug(e){return void 0===e}var zg=Ug;const Kg=(e,t=[])=>{const{placement:n,strategy:r,popperOptions:o}=e,i={placement:n,strategy:r,...o,modifiers:[...Gg(e),...t]};return Yg(i,null==o?void 0:o.modifiers),i},Wg=e=>{if(xr)return qs(e)};function Gg(e){const{offset:t,gpuAcceleration:n,fallbackPlacements:r}=e;return[{name:"offset",options:{offset:[0,null!=t?t:12]}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5,fallbackPlacements:r}},{name:"computeStyles",options:{gpuAcceleration:n}}]}function Yg(e,t){t&&(e.modifiers=[...e.modifiers,...null!=t?t:[]])}const Jg=(e,t,r={})=>{const o={name:"updateState",enabled:!0,phase:"write",fn:({state:e})=>{const t=Zg(e);Object.assign(a.value,t)},requires:["computeStyles"]},i=(0,n.computed)((()=>{const{onFirstUpdate:e,placement:t,strategy:i,modifiers:s}=(0,n.unref)(r);return{onFirstUpdate:e,placement:t||"bottom",strategy:i||"absolute",modifiers:[...s||[],o,{name:"applyStyles",enabled:!1}]}})),s=(0,n.shallowRef)(),a=(0,n.ref)({styles:{popper:{position:(0,n.unref)(i).strategy,left:"0",top:"0"},arrow:{position:"absolute"}},attributes:{}}),c=()=>{s.value&&(s.value.destroy(),s.value=void 0)};return(0,n.watch)(i,(e=>{const t=(0,n.unref)(s);t&&t.setOptions(e)}),{deep:!0}),(0,n.watch)([e,t],(([e,t])=>{c(),e&&t&&(s.value=Ff(e,t,(0,n.unref)(i)))})),(0,n.onBeforeUnmount)((()=>{c()})),{state:(0,n.computed)((()=>{var e;return{...(null==(e=(0,n.unref)(s))?void 0:e.state)||{}}})),styles:(0,n.computed)((()=>(0,n.unref)(a).styles)),attributes:(0,n.computed)((()=>(0,n.unref)(a).attributes)),update:()=>{var e;return null==(e=(0,n.unref)(s))?void 0:e.update()},forceUpdate:()=>{var e;return null==(e=(0,n.unref)(s))?void 0:e.forceUpdate()},instanceRef:(0,n.computed)((()=>(0,n.unref)(s)))}};function Zg(e){const t=Object.keys(e.elements),n=_n(t.map((t=>[t,e.styles[t]||{}]))),r=_n(t.map((t=>[t,e.attributes[t]])));return{styles:n,attributes:r}}const Xg=0,Qg=e=>{const{popperInstanceRef:t,contentRef:r,triggerRef:o,role:i}=(0,n.inject)(Uf,void 0),s=(0,n.ref)(),a=(0,n.ref)(),c=(0,n.computed)((()=>({name:"eventListeners",enabled:!!e.visible}))),l=(0,n.computed)((()=>{var e;const t=(0,n.unref)(s),r=null!=(e=(0,n.unref)(a))?e:Xg;return{name:"arrow",enabled:!zg(t),options:{element:t,padding:r}}})),u=(0,n.computed)((()=>({onFirstUpdate:()=>{g()},...Kg(e,[(0,n.unref)(l),(0,n.unref)(c)])}))),d=(0,n.computed)((()=>Wg(e.referenceEl)||(0,n.unref)(o))),{attributes:p,state:h,styles:f,update:g,forceUpdate:m,instanceRef:v}=Jg(d,r,u);return(0,n.watch)(v,(e=>t.value=e)),(0,n.onMounted)((()=>{(0,n.watch)((()=>{var e;return null==(e=(0,n.unref)(d))?void 0:e.getBoundingClientRect()}),(()=>{g()}))})),{attributes:p,arrowRef:s,contentRef:r,instanceRef:v,state:h,styles:f,role:i,forceUpdate:m,update:g}},em=(e,{attributes:t,styles:r,role:o})=>{const{nextZIndex:i}=En(),s=l("popper"),a=(0,n.computed)((()=>(0,n.unref)(t).popper)),c=(0,n.ref)(e.zIndex||i()),u=(0,n.computed)((()=>[s.b(),s.is("pure",e.pure),s.is(e.effect),e.popperClass])),d=(0,n.computed)((()=>[{zIndex:(0,n.unref)(c)},(0,n.unref)(r).popper,e.popperStyle||{}])),p=(0,n.computed)((()=>"dialog"===o.value?"false":void 0)),h=(0,n.computed)((()=>(0,n.unref)(r).arrow||{})),f=()=>{c.value=e.zIndex||i()};return{ariaModal:p,arrowStyle:h,contentAttrs:a,contentClass:u,contentStyle:d,contentZIndex:c,updateZIndex:f}},tm="focus-trap.focus-after-trapped",nm="focus-trap.focus-after-released",rm="focus-trap.focusout-prevented",om={cancelable:!0,bubbles:!1},im={cancelable:!0,bubbles:!1},sm="focusAfterTrapped",am="focusAfterReleased",cm=Symbol("elFocusTrap"),lm=(0,n.ref)(),um=(0,n.ref)(0),dm=(0,n.ref)(0);let pm=0;const hm=e=>{const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{const t="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0||e===document.activeElement?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});while(n.nextNode())t.push(n.currentNode);return t},fm=(e,t)=>{for(const n of e)if(!gm(n,t))return n},gm=(e,t)=>{if("hidden"===getComputedStyle(e).visibility)return!0;while(e){if(t&&e===t)return!1;if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1},mm=e=>{const t=hm(e),n=fm(t,e),r=fm(t.reverse(),e);return[n,r]},vm=e=>e instanceof HTMLInputElement&&"select"in e,ym=(e,t)=>{if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),dm.value=window.performance.now(),e!==n&&vm(e)&&t&&e.select()}};function bm(e,t){const n=[...e],r=e.indexOf(t);return-1!==r&&n.splice(r,1),n}const wm=()=>{let e=[];const t=t=>{const n=e[0];n&&t!==n&&n.pause(),e=bm(e,t),e.unshift(t)},n=t=>{var n,r;e=bm(e,t),null==(r=null==(n=e[0])?void 0:n.resume)||r.call(n)};return{push:t,remove:n}},Sm=(e,t=!1)=>{const n=document.activeElement;for(const r of e)if(ym(r,t),document.activeElement!==n)return},Tm=wm(),Cm=()=>um.value>dm.value,Em=()=>{lm.value="pointer",um.value=window.performance.now()},km=()=>{lm.value="keyboard",um.value=window.performance.now()},xm=()=>((0,n.onMounted)((()=>{0===pm&&(document.addEventListener("mousedown",Em),document.addEventListener("touchstart",Em),document.addEventListener("keydown",km)),pm++})),(0,n.onBeforeUnmount)((()=>{pm--,pm<=0&&(document.removeEventListener("mousedown",Em),document.removeEventListener("touchstart",Em),document.removeEventListener("keydown",km))})),{focusReason:lm,lastUserFocusTimestamp:um,lastAutomatedFocusTimestamp:dm}),Im=e=>new CustomEvent(rm,{...im,detail:e});let Rm=[];const _m=e=>{const t=e;t.key===cg.esc&&Rm.forEach((e=>e(t)))},Nm=e=>{(0,n.onMounted)((()=>{0===Rm.length&&document.addEventListener("keydown",_m),xr&&Rm.push(e)})),(0,n.onBeforeUnmount)((()=>{Rm=Rm.filter((t=>t!==e)),0===Rm.length&&xr&&document.removeEventListener("keydown",_m)}))},Am=(0,n.defineComponent)({name:"ElFocusTrap",inheritAttrs:!1,props:{loop:Boolean,trapped:Boolean,focusTrapEl:Object,focusStartEl:{type:[Object,String],default:"first"}},emits:[sm,am,"focusin","focusout","focusout-prevented","release-requested"],setup(e,{emit:t}){const r=(0,n.ref)();let o,i;const{focusReason:s}=xm();Nm((n=>{e.trapped&&!a.paused&&t("release-requested",n)}));const a={paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}},c=n=>{if(!e.loop&&!e.trapped)return;if(a.paused)return;const{key:r,altKey:o,ctrlKey:i,metaKey:c,currentTarget:l,shiftKey:u}=n,{loop:d}=e,p=r===cg.tab&&!o&&!i&&!c,h=document.activeElement;if(p&&h){const e=l,[r,o]=mm(e),i=r&&o;if(i)if(u||h!==o){if(u&&[r,e].includes(h)){const e=Im({focusReason:s.value});t("focusout-prevented",e),e.defaultPrevented||(n.preventDefault(),d&&ym(o,!0))}}else{const e=Im({focusReason:s.value});t("focusout-prevented",e),e.defaultPrevented||(n.preventDefault(),d&&ym(r,!0))}else if(h===e){const e=Im({focusReason:s.value});t("focusout-prevented",e),e.defaultPrevented||n.preventDefault()}}};(0,n.provide)(cm,{focusTrapRef:r,onKeydown:c}),(0,n.watch)((()=>e.focusTrapEl),(e=>{e&&(r.value=e)}),{immediate:!0}),(0,n.watch)([r],(([e],[t])=>{e&&(e.addEventListener("keydown",c),e.addEventListener("focusin",d),e.addEventListener("focusout",p)),t&&(t.removeEventListener("keydown",c),t.removeEventListener("focusin",d),t.removeEventListener("focusout",p))}));const l=e=>{t(sm,e)},u=e=>t(am,e),d=s=>{const c=(0,n.unref)(r);if(!c)return;const l=s.target,u=s.relatedTarget,d=l&&c.contains(l);if(!e.trapped){const e=u&&c.contains(u);e||(o=u)}d&&t("focusin",s),a.paused||e.trapped&&(d?i=l:ym(i,!0))},p=o=>{const c=(0,n.unref)(r);if(!a.paused&&c)if(e.trapped){const n=o.relatedTarget;Ls(n)||c.contains(n)||setTimeout((()=>{if(!a.paused&&e.trapped){const e=Im({focusReason:s.value});t("focusout-prevented",e),e.defaultPrevented||ym(i,!0)}}),0)}else{const e=o.target,n=e&&c.contains(e);n||t("focusout",o)}};async function h(){await(0,n.nextTick)();const t=(0,n.unref)(r);if(t){Tm.push(a);const r=t.contains(document.activeElement)?o:document.activeElement;o=r;const i=t.contains(r);if(!i){const o=new Event(tm,om);t.addEventListener(tm,l),t.dispatchEvent(o),o.defaultPrevented||(0,n.nextTick)((()=>{let n=e.focusStartEl;an(n)||(ym(n),document.activeElement!==n&&(n="first")),"first"===n&&Sm(hm(t),!0),document.activeElement!==r&&"container"!==n||ym(t)}))}}}function f(){const e=(0,n.unref)(r);if(e){e.removeEventListener(tm,l);const t=new CustomEvent(nm,{...om,detail:{focusReason:s.value}});e.addEventListener(nm,u),e.dispatchEvent(t),t.defaultPrevented||"keyboard"!=s.value&&Cm()&&!e.contains(document.activeElement)||ym(null!=o?o:document.body),e.removeEventListener(nm,u),Tm.remove(a)}}return(0,n.onMounted)((()=>{e.trapped&&h(),(0,n.watch)((()=>e.trapped),(e=>{e?h():f()}))})),(0,n.onBeforeUnmount)((()=>{e.trapped&&f()})),{onKeydown:c}}});function Om(e,t,r,o,i,s){return(0,n.renderSlot)(e.$slots,"default",{handleKeydown:e.onKeydown})}var Pm=tr(Am,[["render",Om],["__file","/home/runner/work/element-plus/element-plus/packages/components/focus-trap/src/focus-trap.vue"]]);const Dm=(0,n.defineComponent)({name:"ElPopperContent"}),Bm=(0,n.defineComponent)({...Dm,props:og,emits:ig,setup(e,{expose:t,emit:r}){const o=e,{focusStartRef:i,trapped:s,onFocusAfterReleased:a,onFocusAfterTrapped:c,onFocusInTrap:l,onFocusoutPrevented:u,onReleaseRequested:d}=Fg(o,r),{attributes:p,arrowRef:h,contentRef:f,styles:g,instanceRef:m,role:v,update:y}=Qg(o),{ariaModal:b,arrowStyle:w,contentAttrs:S,contentClass:T,contentStyle:C,updateZIndex:E}=em(o,{styles:g,attributes:p,role:v}),k=(0,n.inject)(fr,void 0),x=(0,n.ref)();let I;(0,n.provide)(zf,{arrowStyle:w,arrowRef:h,arrowOffset:x}),k&&(k.addInputId||k.removeInputId)&&(0,n.provide)(fr,{...k,addInputId:tn,removeInputId:tn});const R=(e=!0)=>{y(),e&&E()},_=()=>{R(!1),o.visible&&o.focusOnShow?s.value=!0:!1===o.visible&&(s.value=!1)};return(0,n.onMounted)((()=>{(0,n.watch)((()=>o.triggerTargetEl),((e,t)=>{null==I||I(),I=void 0;const r=(0,n.unref)(e||f.value),i=(0,n.unref)(t||f.value);bn(r)&&(I=(0,n.watch)([v,()=>o.ariaLabel,b,()=>o.id],(e=>{["role","aria-label","aria-modal","id"].forEach(((t,n)=>{Ls(e[n])?r.removeAttribute(t):r.setAttribute(t,e[n])}))}),{immediate:!0})),i!==r&&bn(i)&&["role","aria-label","aria-modal","id"].forEach((e=>{i.removeAttribute(e)}))}),{immediate:!0}),(0,n.watch)((()=>o.visible),_,{immediate:!0})})),(0,n.onBeforeUnmount)((()=>{null==I||I(),I=void 0})),t({popperContentRef:f,popperInstanceRef:m,updatePopper:R,contentStyle:C}),(e,t)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",(0,n.mergeProps)({ref_key:"contentRef",ref:f},(0,n.unref)(S),{style:(0,n.unref)(C),class:(0,n.unref)(T),tabindex:"-1",onMouseenter:t[0]||(t[0]=t=>e.$emit("mouseenter",t)),onMouseleave:t[1]||(t[1]=t=>e.$emit("mouseleave",t))}),[(0,n.createVNode)((0,n.unref)(Pm),{trapped:(0,n.unref)(s),"trap-on-focus-in":!0,"focus-trap-el":(0,n.unref)(f),"focus-start-el":(0,n.unref)(i),onFocusAfterTrapped:(0,n.unref)(c),onFocusAfterReleased:(0,n.unref)(a),onFocusin:(0,n.unref)(l),onFocusoutPrevented:(0,n.unref)(u),onReleaseRequested:(0,n.unref)(d)},{default:(0,n.withCtx)((()=>[(0,n.renderSlot)(e.$slots,"default")])),_:3},8,["trapped","focus-trap-el","focus-start-el","onFocusAfterTrapped","onFocusAfterReleased","onFocusin","onFocusoutPrevented","onReleaseRequested"])],16))}});var jm=tr(Bm,[["__file","/home/runner/work/element-plus/element-plus/packages/components/popper/src/content.vue"]]);const Hm=(0,n.defineComponent)({name:"ElTooltipContent",inheritAttrs:!1}),Mm=(0,n.defineComponent)({...Hm,props:sg,setup(e,{expose:t}){const r=e,{selector:o}=qg(),i=l("tooltip"),s=(0,n.ref)(null),a=(0,n.ref)(!1),{controlled:c,id:u,open:d,trigger:p,onClose:h,onOpen:f,onShow:g,onHide:m,onBeforeShow:v,onBeforeHide:y}=(0,n.inject)(Xf,void 0),b=(0,n.computed)((()=>r.transition||`${i.namespace.value}-fade-in-linear`)),w=(0,n.computed)((()=>r.persistent));(0,n.onBeforeUnmount)((()=>{a.value=!0}));const S=(0,n.computed)((()=>!!(0,n.unref)(w)||(0,n.unref)(d))),T=(0,n.computed)((()=>!r.disabled&&(0,n.unref)(d))),C=(0,n.computed)((()=>r.appendTo||o.value)),E=(0,n.computed)((()=>{var e;return null!=(e=r.style)?e:{}})),k=(0,n.computed)((()=>!(0,n.unref)(d))),x=()=>{m()},I=()=>{if((0,n.unref)(c))return!0},R=Eg(I,(()=>{r.enterable&&"hover"===(0,n.unref)(p)&&f()})),_=Eg(I,(()=>{"hover"===(0,n.unref)(p)&&h()})),N=()=>{var e,t;null==(t=null==(e=s.value)?void 0:e.updatePopper)||t.call(e),null==v||v()},A=()=>{null==y||y()},O=()=>{g(),D=zs((0,n.computed)((()=>{var e;return null==(e=s.value)?void 0:e.popperContentRef})),(()=>{if((0,n.unref)(c))return;const e=(0,n.unref)(p);"hover"!==e&&h()}))},P=()=>{r.virtualTriggering||h()};let D;return(0,n.watch)((()=>(0,n.unref)(d)),(e=>{e||null==D||D()}),{flush:"post"}),(0,n.watch)((()=>r.content),(()=>{var e,t;null==(t=null==(e=s.value)?void 0:e.updatePopper)||t.call(e)})),t({contentRef:s}),(e,t)=>((0,n.openBlock)(),(0,n.createBlock)(n.Teleport,{disabled:!e.teleported,to:(0,n.unref)(C)},[(0,n.createVNode)(n.Transition,{name:(0,n.unref)(b),onAfterLeave:x,onBeforeEnter:N,onAfterEnter:O,onBeforeLeave:A},{default:(0,n.withCtx)((()=>[(0,n.unref)(S)?(0,n.withDirectives)(((0,n.openBlock)(),(0,n.createBlock)((0,n.unref)(jm),(0,n.mergeProps)({key:0,id:(0,n.unref)(u),ref_key:"contentRef",ref:s},e.$attrs,{"aria-label":e.ariaLabel,"aria-hidden":(0,n.unref)(k),"boundaries-padding":e.boundariesPadding,"fallback-placements":e.fallbackPlacements,"gpu-acceleration":e.gpuAcceleration,offset:e.offset,placement:e.placement,"popper-options":e.popperOptions,strategy:e.strategy,effect:e.effect,enterable:e.enterable,pure:e.pure,"popper-class":e.popperClass,"popper-style":[e.popperStyle,(0,n.unref)(E)],"reference-el":e.referenceEl,"trigger-target-el":e.triggerTargetEl,visible:(0,n.unref)(T),"z-index":e.zIndex,onMouseenter:(0,n.unref)(R),onMouseleave:(0,n.unref)(_),onBlur:P,onClose:(0,n.unref)(h)}),{default:(0,n.withCtx)((()=>[a.value?(0,n.createCommentVNode)("v-if",!0):(0,n.renderSlot)(e.$slots,"default",{key:0})])),_:3},16,["id","aria-label","aria-hidden","boundaries-padding","fallback-placements","gpu-acceleration","offset","placement","popper-options","strategy","effect","enterable","pure","popper-class","popper-style","reference-el","trigger-target-el","visible","z-index","onMouseenter","onMouseleave","onClose"])),[[n.vShow,(0,n.unref)(T)]]):(0,n.createCommentVNode)("v-if",!0)])),_:3},8,["name"])],8,["disabled","to"]))}});var Lm=tr(Mm,[["__file","/home/runner/work/element-plus/element-plus/packages/components/tooltip/src/content.vue"]]);const qm=(0,n.defineComponent)({name:"ElPopperArrow",inheritAttrs:!1}),$m=(0,n.defineComponent)({...qm,props:mg,setup(e,{expose:t}){const r=e,o=l("popper"),{arrowOffset:i,arrowRef:s,arrowStyle:a}=(0,n.inject)(zf,void 0);return(0,n.watch)((()=>r.arrowOffset),(e=>{i.value=e})),(0,n.onBeforeUnmount)((()=>{s.value=void 0})),t({arrowRef:s}),(e,t)=>((0,n.openBlock)(),(0,n.createElementBlock)("span",{ref_key:"arrowRef",ref:s,class:(0,n.normalizeClass)((0,n.unref)(o).e("arrow")),style:(0,n.normalizeStyle)((0,n.unref)(a)),"data-popper-arrow":""},null,6))}});var Vm=tr($m,[["__file","/home/runner/work/element-plus/element-plus/packages/components/popper/src/arrow.vue"]]);const Fm=["innerHTML"],Um={key:1},zm=(0,n.defineComponent)({name:"ElTooltip"}),Km=(0,n.defineComponent)({...zm,props:wg,emits:Sg,setup(e,{expose:t,emit:r}){const o=e;Vg();const i=Mr(),s=(0,n.ref)(),a=(0,n.ref)(),c=()=>{var e;const t=(0,n.unref)(s);t&&(null==(e=t.popperInstanceRef)||e.update())},l=(0,n.ref)(!1),u=(0,n.ref)(),{show:d,hide:p,hasUpdateHandler:h}=bg({indicator:l,toggleReason:u}),{onOpen:f,onClose:g}=tg({showAfter:(0,n.toRef)(o,"showAfter"),hideAfter:(0,n.toRef)(o,"hideAfter"),autoClose:(0,n.toRef)(o,"autoClose"),open:d,close:p}),m=(0,n.computed)((()=>vn(o.visible)&&!h.value));(0,n.provide)(Xf,{controlled:m,id:i,open:(0,n.readonly)(l),trigger:(0,n.toRef)(o,"trigger"),onOpen:e=>{f(e)},onClose:e=>{g(e)},onToggle:e=>{(0,n.unref)(l)?g(e):f(e)},onShow:()=>{r("show",u.value)},onHide:()=>{r("hide",u.value)},onBeforeShow:()=>{r("before-show",u.value)},onBeforeHide:()=>{r("before-hide",u.value)},updatePopper:c}),(0,n.watch)((()=>o.disabled),(e=>{e&&l.value&&(l.value=!1)}));const v=e=>{var t,n;const r=null==(n=null==(t=a.value)?void 0:t.contentRef)?void 0:n.popperContentRef,o=(null==e?void 0:e.relatedTarget)||document.activeElement;return r&&r.contains(o)};return(0,n.onDeactivated)((()=>l.value&&p())),t({popperRef:s,contentRef:a,isFocusInsideContent:v,updatePopper:c,onOpen:f,onClose:g,hide:p}),(e,t)=>((0,n.openBlock)(),(0,n.createBlock)((0,n.unref)(Zf),{ref_key:"popperRef",ref:s,role:e.role},{default:(0,n.withCtx)((()=>[(0,n.createVNode)(Mg,{disabled:e.disabled,trigger:e.trigger,"trigger-keys":e.triggerKeys,"virtual-ref":e.virtualRef,"virtual-triggering":e.virtualTriggering},{default:(0,n.withCtx)((()=>[e.$slots.default?(0,n.renderSlot)(e.$slots,"default",{key:0}):(0,n.createCommentVNode)("v-if",!0)])),_:3},8,["disabled","trigger","trigger-keys","virtual-ref","virtual-triggering"]),(0,n.createVNode)(Lm,{ref_key:"contentRef",ref:a,"aria-label":e.ariaLabel,"boundaries-padding":e.boundariesPadding,content:e.content,disabled:e.disabled,effect:e.effect,enterable:e.enterable,"fallback-placements":e.fallbackPlacements,"hide-after":e.hideAfter,"gpu-acceleration":e.gpuAcceleration,offset:e.offset,persistent:e.persistent,"popper-class":e.popperClass,"popper-style":e.popperStyle,placement:e.placement,"popper-options":e.popperOptions,pure:e.pure,"raw-content":e.rawContent,"reference-el":e.referenceEl,"trigger-target-el":e.triggerTargetEl,"show-after":e.showAfter,strategy:e.strategy,teleported:e.teleported,transition:e.transition,"virtual-triggering":e.virtualTriggering,"z-index":e.zIndex,"append-to":e.appendTo},{default:(0,n.withCtx)((()=>[(0,n.renderSlot)(e.$slots,"content",{},(()=>[e.rawContent?((0,n.openBlock)(),(0,n.createElementBlock)("span",{key:0,innerHTML:e.content},null,8,Fm)):((0,n.openBlock)(),(0,n.createElementBlock)("span",Um,(0,n.toDisplayString)(e.content),1))])),e.showArrow?((0,n.openBlock)(),(0,n.createBlock)((0,n.unref)(Vm),{key:0,"arrow-offset":e.arrowOffset},null,8,["arrow-offset"])):(0,n.createCommentVNode)("v-if",!0)])),_:3},8,["aria-label","boundaries-padding","content","disabled","effect","enterable","fallback-placements","hide-after","gpu-acceleration","offset","persistent","popper-class","popper-style","placement","popper-options","pure","raw-content","reference-el","trigger-target-el","show-after","strategy","teleported","transition","virtual-triggering","z-index","append-to"])])),_:3},8,["role"]))}});var Wm=tr(Km,[["__file","/home/runner/work/element-plus/element-plus/packages/components/tooltip/src/tooltip.vue"]]);const Gm=Yn(Wm),Ym=4,Jm={vertical:{offset:"offsetHeight",scroll:"scrollTop",scrollSize:"scrollHeight",size:"height",key:"vertical",axis:"Y",client:"clientY",direction:"top"},horizontal:{offset:"offsetWidth",scroll:"scrollLeft",scrollSize:"scrollWidth",size:"width",key:"horizontal",axis:"X",client:"clientX",direction:"left"}},Zm=({move:e,size:t,bar:n})=>({[n.size]:t,transform:`translate${n.axis}(${e}%)`}),Xm=Symbol("scrollbarContextKey"),Qm=Dn({vertical:Boolean,size:String,move:Number,ratio:{type:Number,required:!0},always:Boolean}),ev="Thumb",tv=(0,n.defineComponent)({__name:"thumb",props:Qm,setup(e){const t=e,r=(0,n.inject)(Xm),o=l("scrollbar");r||xn(ev,"can not inject scrollbar context");const i=(0,n.ref)(),s=(0,n.ref)(),a=(0,n.ref)({}),c=(0,n.ref)(!1);let u=!1,d=!1,p=xr?document.onselectstart:null;const h=(0,n.computed)((()=>Jm[t.vertical?"vertical":"horizontal"])),f=(0,n.computed)((()=>Zm({size:t.size,move:t.move,bar:h.value}))),g=(0,n.computed)((()=>i.value[h.value.offset]**2/r.wrapElement[h.value.scrollSize]/t.ratio/s.value[h.value.offset])),m=e=>{var t;if(e.stopPropagation(),e.ctrlKey||[1,2].includes(e.button))return;null==(t=window.getSelection())||t.removeAllRanges(),y(e);const n=e.currentTarget;n&&(a.value[h.value.axis]=n[h.value.offset]-(e[h.value.client]-n.getBoundingClientRect()[h.value.direction]))},v=e=>{if(!s.value||!i.value||!r.wrapElement)return;const t=Math.abs(e.target.getBoundingClientRect()[h.value.direction]-e[h.value.client]),n=s.value[h.value.offset]/2,o=100*(t-n)*g.value/i.value[h.value.offset];r.wrapElement[h.value.scroll]=o*r.wrapElement[h.value.scrollSize]/100},y=e=>{e.stopImmediatePropagation(),u=!0,document.addEventListener("mousemove",b),document.addEventListener("mouseup",w),p=document.onselectstart,document.onselectstart=()=>!1},b=e=>{if(!i.value||!s.value)return;if(!1===u)return;const t=a.value[h.value.axis];if(!t)return;const n=-1*(i.value.getBoundingClientRect()[h.value.direction]-e[h.value.client]),o=s.value[h.value.offset]-t,c=100*(n-o)*g.value/i.value[h.value.offset];r.wrapElement[h.value.scroll]=c*r.wrapElement[h.value.scrollSize]/100},w=()=>{u=!1,a.value[h.value.axis]=0,document.removeEventListener("mousemove",b),document.removeEventListener("mouseup",w),C(),d&&(c.value=!1)},S=()=>{d=!1,c.value=!!t.size},T=()=>{d=!0,c.value=u};(0,n.onBeforeUnmount)((()=>{C(),document.removeEventListener("mouseup",w)}));const C=()=>{document.onselectstart!==p&&(document.onselectstart=p)};return Fs((0,n.toRef)(r,"scrollbarElement"),"mousemove",S),Fs((0,n.toRef)(r,"scrollbarElement"),"mouseleave",T),(e,t)=>((0,n.openBlock)(),(0,n.createBlock)(n.Transition,{name:(0,n.unref)(o).b("fade"),persisted:""},{default:(0,n.withCtx)((()=>[(0,n.withDirectives)((0,n.createElementVNode)("div",{ref_key:"instance",ref:i,class:(0,n.normalizeClass)([(0,n.unref)(o).e("bar"),(0,n.unref)(o).is((0,n.unref)(h).key)]),onMousedown:v},[(0,n.createElementVNode)("div",{ref_key:"thumb",ref:s,class:(0,n.normalizeClass)((0,n.unref)(o).e("thumb")),style:(0,n.normalizeStyle)((0,n.unref)(f)),onMousedown:m},null,38)],34),[[n.vShow,e.always||c.value]])])),_:1},8,["name"]))}});var nv=tr(tv,[["__file","/home/runner/work/element-plus/element-plus/packages/components/scrollbar/src/thumb.vue"]]);const rv=Dn({always:{type:Boolean,default:!0},width:String,height:String,ratioX:{type:Number,default:1},ratioY:{type:Number,default:1}}),ov=(0,n.defineComponent)({__name:"bar",props:rv,setup(e,{expose:t}){const r=e,o=(0,n.ref)(0),i=(0,n.ref)(0),s=e=>{if(e){const t=e.offsetHeight-Ym,n=e.offsetWidth-Ym;i.value=100*e.scrollTop/t*r.ratioY,o.value=100*e.scrollLeft/n*r.ratioX}};return t({handleScroll:s}),(e,t)=>((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,null,[(0,n.createVNode)(nv,{move:o.value,ratio:e.ratioX,size:e.width,always:e.always},null,8,["move","ratio","size","always"]),(0,n.createVNode)(nv,{move:i.value,ratio:e.ratioY,size:e.height,vertical:"",always:e.always},null,8,["move","ratio","size","always"])],64))}});var iv=tr(ov,[["__file","/home/runner/work/element-plus/element-plus/packages/components/scrollbar/src/bar.vue"]]);const sv=Dn({height:{type:[String,Number],default:""},maxHeight:{type:[String,Number],default:""},native:{type:Boolean,default:!1},wrapStyle:{type:An([String,Object,Array]),default:""},wrapClass:{type:[String,Array],default:""},viewClass:{type:[String,Array],default:""},viewStyle:{type:[String,Array,Object],default:""},noresize:Boolean,tag:{type:String,default:"div"},always:Boolean,minSize:{type:Number,default:20}}),av={scroll:({scrollTop:e,scrollLeft:t})=>[e,t].every(yn)},cv="ElScrollbar",lv=(0,n.defineComponent)({name:cv}),uv=(0,n.defineComponent)({...lv,props:sv,emits:av,setup(e,{expose:t,emit:r}){const o=e,i=l("scrollbar");let s,a;const c=(0,n.ref)(),u=(0,n.ref)(),d=(0,n.ref)(),p=(0,n.ref)("0"),h=(0,n.ref)("0"),f=(0,n.ref)(),g=(0,n.ref)(1),m=(0,n.ref)(1),v=(0,n.computed)((()=>{const e={};return o.height&&(e.height=sr(o.height)),o.maxHeight&&(e.maxHeight=sr(o.maxHeight)),[o.wrapStyle,e]})),y=(0,n.computed)((()=>[o.wrapClass,i.e("wrap"),{[i.em("wrap","hidden-default")]:!o.native}])),b=(0,n.computed)((()=>[i.e("view"),o.viewClass])),w=()=>{var e;u.value&&(null==(e=f.value)||e.handleScroll(u.value),r("scroll",{scrollTop:u.value.scrollTop,scrollLeft:u.value.scrollLeft}))};function S(e,t){cn(e)?u.value.scrollTo(e):yn(e)&&yn(t)&&u.value.scrollTo(e,t)}const T=e=>{yn(e)?u.value.scrollTop=e:In(cv,"value must be a number")},C=e=>{yn(e)?u.value.scrollLeft=e:In(cv,"value must be a number")},E=()=>{if(!u.value)return;const e=u.value.offsetHeight-Ym,t=u.value.offsetWidth-Ym,n=e**2/u.value.scrollHeight,r=t**2/u.value.scrollWidth,i=Math.max(n,o.minSize),s=Math.max(r,o.minSize);g.value=n/(e-n)/(i/(e-i)),m.value=r/(t-r)/(s/(t-s)),h.value=i+Ym<e?`${i}px`:"",p.value=s+Ym<t?`${s}px`:""};return(0,n.watch)((()=>o.noresize),(e=>{e?(null==s||s(),null==a||a()):(({stop:s}=ea(d,E)),a=Fs("resize",E))}),{immediate:!0}),(0,n.watch)((()=>[o.maxHeight,o.height]),(()=>{o.native||(0,n.nextTick)((()=>{var e;E(),u.value&&(null==(e=f.value)||e.handleScroll(u.value))}))})),(0,n.provide)(Xm,(0,n.reactive)({scrollbarElement:c,wrapElement:u})),(0,n.onMounted)((()=>{o.native||(0,n.nextTick)((()=>{E()}))})),(0,n.onUpdated)((()=>E())),t({wrapRef:u,update:E,scrollTo:S,setScrollTop:T,setScrollLeft:C,handleScroll:w}),(e,t)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{ref_key:"scrollbarRef",ref:c,class:(0,n.normalizeClass)((0,n.unref)(i).b())},[(0,n.createElementVNode)("div",{ref_key:"wrapRef",ref:u,class:(0,n.normalizeClass)((0,n.unref)(y)),style:(0,n.normalizeStyle)((0,n.unref)(v)),onScroll:w},[((0,n.openBlock)(),(0,n.createBlock)((0,n.resolveDynamicComponent)(e.tag),{ref_key:"resizeRef",ref:d,class:(0,n.normalizeClass)((0,n.unref)(b)),style:(0,n.normalizeStyle)(e.viewStyle)},{default:(0,n.withCtx)((()=>[(0,n.renderSlot)(e.$slots,"default")])),_:3},8,["class","style"]))],38),e.native?(0,n.createCommentVNode)("v-if",!0):((0,n.openBlock)(),(0,n.createBlock)(iv,{key:0,ref_key:"barRef",ref:f,height:h.value,width:p.value,always:e.always,"ratio-x":m.value,"ratio-y":g.value},null,8,["height","width","always","ratio-x","ratio-y"]))],2))}});var dv=tr(uv,[["__file","/home/runner/work/element-plus/element-plus/packages/components/scrollbar/src/scrollbar.vue"]]);const pv=Yn(dv),hv=Dn({type:{type:String,values:["success","info","warning","danger",""],default:""},closable:Boolean,disableTransitions:Boolean,hit:Boolean,color:{type:String,default:""},size:{type:String,values:Bn,default:""},effect:{type:String,values:["dark","light","plain"],default:"light"},round:Boolean}),fv={close:e=>e instanceof MouseEvent,click:e=>e instanceof MouseEvent},gv=(0,n.defineComponent)({name:"ElTag"}),mv=(0,n.defineComponent)({...gv,props:hv,emits:fv,setup(e,{emit:t}){const r=e,o=Vr(),i=l("tag"),s=(0,n.computed)((()=>{const{type:e,hit:t,effect:n,closable:s,round:a}=r;return[i.b(),i.is("closable",s),i.m(e),i.m(o.value),i.m(n),i.is("hit",t),i.is("round",a)]})),a=e=>{t("close",e)},c=e=>{t("click",e)};return(e,t)=>e.disableTransitions?((0,n.openBlock)(),(0,n.createElementBlock)("span",{key:0,class:(0,n.normalizeClass)((0,n.unref)(s)),style:(0,n.normalizeStyle)({backgroundColor:e.color}),onClick:c},[(0,n.createElementVNode)("span",{class:(0,n.normalizeClass)((0,n.unref)(i).e("content"))},[(0,n.renderSlot)(e.$slots,"default")],2),e.closable?((0,n.openBlock)(),(0,n.createBlock)((0,n.unref)(ur),{key:0,class:(0,n.normalizeClass)((0,n.unref)(i).e("close")),onClick:(0,n.withModifiers)(a,["stop"])},{default:(0,n.withCtx)((()=>[(0,n.createVNode)((0,n.unref)(Go))])),_:1},8,["class","onClick"])):(0,n.createCommentVNode)("v-if",!0)],6)):((0,n.openBlock)(),(0,n.createBlock)(n.Transition,{key:1,name:`${(0,n.unref)(i).namespace.value}-zoom-in-center`,appear:""},{default:(0,n.withCtx)((()=>[(0,n.createElementVNode)("span",{class:(0,n.normalizeClass)((0,n.unref)(s)),style:(0,n.normalizeStyle)({backgroundColor:e.color}),onClick:c},[(0,n.createElementVNode)("span",{class:(0,n.normalizeClass)((0,n.unref)(i).e("content"))},[(0,n.renderSlot)(e.$slots,"default")],2),e.closable?((0,n.openBlock)(),(0,n.createBlock)((0,n.unref)(ur),{key:0,class:(0,n.normalizeClass)((0,n.unref)(i).e("close")),onClick:(0,n.withModifiers)(a,["stop"])},{default:(0,n.withCtx)((()=>[(0,n.createVNode)((0,n.unref)(Go))])),_:1},8,["class","onClick"])):(0,n.createCommentVNode)("v-if",!0)],6)])),_:3},8,["name"]))}});var vv=tr(mv,[["__file","/home/runner/work/element-plus/element-plus/packages/components/tag/src/tag.vue"]]);const yv=Yn(vv),bv=Symbol("ElSelectGroup"),wv=Symbol("ElSelect"),Sv=(e="")=>e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d"),Tv=e=>gn(e);function Cv(e,t){const r=(0,n.inject)(wv),o=(0,n.inject)(bv,{disabled:!1}),i=(0,n.computed)((()=>"[object object]"===Object.prototype.toString.call(e.value).toLowerCase())),s=(0,n.computed)((()=>r.props.multiple?p(r.props.modelValue,e.value):h(e.value,r.props.modelValue))),a=(0,n.computed)((()=>{if(r.props.multiple){const e=r.props.modelValue||[];return!s.value&&e.length>=r.props.multipleLimit&&r.props.multipleLimit>0}return!1})),c=(0,n.computed)((()=>e.label||(i.value?"":e.value))),l=(0,n.computed)((()=>e.value||e.label||"")),u=(0,n.computed)((()=>e.disabled||t.groupDisabled||a.value)),d=(0,n.getCurrentInstance)(),p=(e=[],t)=>{if(i.value){const o=r.props.valueKey;return e&&e.some((e=>(0,n.toRaw)(Gt(e,o))===Gt(t,o)))}return e&&e.includes(t)},h=(e,t)=>{if(i.value){const{valueKey:n}=r.props;return Gt(e,n)===Gt(t,n)}return e===t},f=()=>{e.disabled||o.disabled||(r.hoverIndex=r.optionsArray.indexOf(d.proxy))};(0,n.watch)((()=>c.value),(()=>{e.created||r.props.remote||r.setSelected()})),(0,n.watch)((()=>e.value),((t,n)=>{const{remote:o,valueKey:i}=r.props;if(Object.is(t,n)||(r.onOptionDestroy(n,d.proxy),r.onOptionCreate(d.proxy)),!e.created&&!o){if(i&&"object"===typeof t&&"object"===typeof n&&t[i]===n[i])return;r.setSelected()}})),(0,n.watch)((()=>o.disabled),(()=>{t.groupDisabled=o.disabled}),{immediate:!0});const{queryChange:g}=(0,n.toRaw)(r);return(0,n.watch)(g,(o=>{const{query:i}=(0,n.unref)(o),s=new RegExp(Sv(i),"i");t.visible=s.test(c.value)||e.created,t.visible||r.filteredOptionsCount--}),{immediate:!0}),{select:r,currentLabel:c,currentValue:l,itemSelected:s,isDisabled:u,hoverItem:f}}const Ev=(0,n.defineComponent)({name:"ElOption",componentName:"ElOption",props:{value:{required:!0,type:[String,Number,Boolean,Object]},label:[String,Number],created:Boolean,disabled:Boolean},setup(e){const t=l("select"),r=(0,n.computed)((()=>[t.be("dropdown","item"),t.is("disabled",(0,n.unref)(a)),{selected:(0,n.unref)(s),hover:(0,n.unref)(p)}])),o=(0,n.reactive)({index:-1,groupDisabled:!1,visible:!0,hitState:!1,hover:!1}),{currentLabel:i,itemSelected:s,isDisabled:a,select:c,hoverItem:u}=Cv(e,o),{visible:d,hover:p}=(0,n.toRefs)(o),h=(0,n.getCurrentInstance)().proxy;function f(){!0!==e.disabled&&!0!==o.groupDisabled&&c.handleOptionSelect(h)}return c.onOptionCreate(h),(0,n.onBeforeUnmount)((()=>{const e=h.value,{selected:t}=c,r=c.props.multiple?t:[t],o=r.some((e=>e.value===h.value));(0,n.nextTick)((()=>{c.cachedOptions.get(e)!==h||o||c.cachedOptions.delete(e)})),c.onOptionDestroy(e,h)})),{ns:t,containerKls:r,currentLabel:i,itemSelected:s,isDisabled:a,select:c,hoverItem:u,visible:d,hover:p,selectOptionClick:f,states:o}}});function kv(e,t,r,o,i,s){return(0,n.withDirectives)(((0,n.openBlock)(),(0,n.createElementBlock)("li",{class:(0,n.normalizeClass)(e.containerKls),onMouseenter:t[0]||(t[0]=(...t)=>e.hoverItem&&e.hoverItem(...t)),onClick:t[1]||(t[1]=(0,n.withModifiers)(((...t)=>e.selectOptionClick&&e.selectOptionClick(...t)),["stop"]))},[(0,n.renderSlot)(e.$slots,"default",{},(()=>[(0,n.createElementVNode)("span",null,(0,n.toDisplayString)(e.currentLabel),1)]))],34)),[[n.vShow,e.visible]])}var xv=tr(Ev,[["render",kv],["__file","/home/runner/work/element-plus/element-plus/packages/components/select/src/option.vue"]]);const Iv=(0,n.defineComponent)({name:"ElSelectDropdown",componentName:"ElSelectDropdown",setup(){const e=(0,n.inject)(wv),t=l("select"),r=(0,n.computed)((()=>e.props.popperClass)),o=(0,n.computed)((()=>e.props.multiple)),i=(0,n.computed)((()=>e.props.fitInputWidth)),s=(0,n.ref)("");function a(){var t;s.value=`${null==(t=e.selectWrapper)?void 0:t.offsetWidth}px`}return(0,n.onMounted)((()=>{a(),ea(e.selectWrapper,a)})),{ns:t,minWidth:s,popperClass:r,isMultiple:o,isFitInputWidth:i}}});function Rv(e,t,r,o,i,s){return(0,n.openBlock)(),(0,n.createElementBlock)("div",{class:(0,n.normalizeClass)([e.ns.b("dropdown"),e.ns.is("multiple",e.isMultiple),e.popperClass]),style:(0,n.normalizeStyle)({[e.isFitInputWidth?"width":"minWidth"]:e.minWidth})},[(0,n.renderSlot)(e.$slots,"default")],6)}var _v=tr(Iv,[["render",Rv],["__file","/home/runner/work/element-plus/element-plus/packages/components/select/src/select-dropdown.vue"]]),Nv=function(){return m.Date.now()},Av=Nv,Ov=/\s/;function Pv(e){var t=e.length;while(t--&&Ov.test(e.charAt(t)));return t}var Dv=Pv,Bv=/^\s+/;function jv(e){return e?e.slice(0,Dv(e)+1).replace(Bv,""):e}var Hv=jv,Mv=NaN,Lv=/^[-+]0x[0-9a-f]+$/i,qv=/^0b[01]+$/i,$v=/^0o[0-7]+$/i,Vv=parseInt;function Fv(e){if("number"==typeof e)return e;if(M(e))return Mv;if(U(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=U(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Hv(e);var n=qv.test(e);return n||$v.test(e)?Vv(e.slice(2),n?2:8):Lv.test(e)?Mv:+e}var Uv=Fv,zv="Expected a function",Kv=Math.max,Wv=Math.min;function Gv(e,t,n){var r,o,i,s,a,c,l=0,u=!1,d=!1,p=!0;if("function"!=typeof e)throw new TypeError(zv);function h(t){var n=r,i=o;return r=o=void 0,l=t,s=e.apply(i,n),s}function f(e){return l=e,a=setTimeout(v,t),u?h(e):s}function g(e){var n=e-c,r=e-l,o=t-n;return d?Wv(o,i-r):o}function m(e){var n=e-c,r=e-l;return void 0===c||n>=t||n<0||d&&r>=i}function v(){var e=Av();if(m(e))return y(e);a=setTimeout(v,g(e))}function y(e){return a=void 0,p&&r?h(e):(r=o=void 0,s)}function b(){void 0!==a&&clearTimeout(a),l=0,r=c=o=a=void 0}function w(){return void 0===a?s:y(Av())}function S(){var e=Av(),n=m(e);if(r=arguments,o=this,c=e,n){if(void 0===a)return f(c);if(d)return clearTimeout(a),a=setTimeout(v,t),h(c)}return void 0===a&&(a=setTimeout(v,t)),s}return t=Uv(t)||0,U(n)&&(u=!!n.leading,d="maxWait"in n,i=d?Kv(Uv(n.maxWait)||0,t):i,p="trailing"in n?!!n.trailing:p),S.cancel=b,S.flush=w,S}var Yv=Gv;function Jv(e,t,n,r){var o=e.length,i=n+(r?1:-1);while(r?i--:++i<o)if(t(e[i],i,e))return i;return-1}var Zv=Jv,Xv=1,Qv=2;function ey(e,t,n,r){var o=n.length,i=o,s=!r;if(null==e)return!i;e=Object(e);while(o--){var a=n[o];if(s&&a[2]?a[1]!==e[a[0]]:!(a[0]in e))return!1}while(++o<i){a=n[o];var c=a[0],l=e[c],u=a[1];if(s&&a[2]){if(void 0===l&&!(c in e))return!1}else{var d=new uc;if(r)var p=r(l,u,c,e,t,d);if(!(void 0===p?wd(u,l,Xv|Qv,r,d):p))return!1}}return!0}var ty=ey;function ny(e){return e===e&&!U(e)}var ry=ny;function oy(e){var t=ju(e),n=t.length;while(n--){var r=t[n],o=e[r];t[n]=[r,o,ry(o)]}return t}var iy=oy;function sy(e,t){return function(n){return null!=n&&(n[e]===t&&(void 0!==t||e in Object(n)))}}var ay=sy;function cy(e){var t=iy(e);return 1==t.length&&t[0][2]?ay(t[0][0],t[0][1]):function(n){return n===e||ty(n,e,t)}}var ly=cy,uy=1,dy=2;function py(e,t){return V(e)&&ry(t)?ay(Ut(e),t):function(n){var r=Gt(n,e);return void 0===r&&r===t?ep(n,e):wd(t,r,uy|dy)}}var hy=py;function fy(e){return function(t){return null==t?void 0:t[e]}}var gy=fy;function my(e){return function(t){return Kt(t,e)}}var vy=my;function yy(e){return V(e)?gy(Ut(e)):vy(e)}var by=yy;function wy(e){return"function"==typeof e?e:null==e?yp:"object"==typeof e?d(e)?hy(e[0],e[1]):ly(e):by(e)}var Sy=wy,Ty=1/0,Cy=17976931348623157e292;function Ey(e){if(!e)return 0===e?e:0;if(e=Uv(e),e===Ty||e===-Ty){var t=e<0?-1:1;return t*Cy}return e===e?e:0}var ky=Ey;function xy(e){var t=ky(e),n=t%1;return t===t?n?t-n:t:0}var Iy=xy,Ry=Math.max,_y=Math.min;function Ny(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r-1;return void 0!==n&&(o=Iy(n),o=n<0?Ry(r+o,0):_y(o,r-1)),Zv(e,Sy(t,3),o,!0)}var Ay=Ny;const Oy=e=>jn[e||"default"];function Py(e,t){if(!xr)return;if(!t)return void(e.scrollTop=0);const n=[];let r=t.offsetParent;while(null!==r&&e!==r&&e.contains(r))n.push(r),r=r.offsetParent;const o=t.offsetTop+n.reduce(((e,t)=>e+t.offsetTop),0),i=o+t.offsetHeight,s=e.scrollTop,a=s+e.clientHeight;o<s?e.scrollTop=o:i>a&&(e.scrollTop=i-e.clientHeight)}function Dy(e){const{t:t}=en();return(0,n.reactive)({options:new Map,cachedOptions:new Map,disabledOptions:new Map,createdLabel:null,createdSelected:!1,selected:e.multiple?[]:{},inputLength:20,inputWidth:0,optionsCount:0,filteredOptionsCount:0,visible:!1,selectedLabel:"",hoverIndex:-1,query:"",previousQuery:null,inputHovering:!1,cachedPlaceHolder:"",currentPlaceholder:t("el.select.placeholder"),menuVisibleOnFocus:!1,isOnComposition:!1,prefixWidth:11,mouseEnter:!1,focused:!1})}const By=(e,t,r)=>{const{t:o}=en(),i=l("select");pr({from:"suffixTransition",replacement:"override style scheme",version:"2.3.0",scope:"props",ref:"https://element-plus.org/en-US/component/select.html#select-attributes"},(0,n.computed)((()=>!1===e.suffixTransition)));const s=(0,n.ref)(null),a=(0,n.ref)(null),c=(0,n.ref)(null),u=(0,n.ref)(null),d=(0,n.ref)(null),p=(0,n.ref)(null),h=(0,n.ref)(null),f=(0,n.ref)(null),g=(0,n.ref)(-1),m=(0,n.shallowRef)({query:""}),v=(0,n.shallowRef)(""),y=(0,n.ref)([]);let b=0;const{form:w,formItem:S}=Lr(),T=(0,n.computed)((()=>!e.filterable||e.multiple||!t.visible)),C=(0,n.computed)((()=>e.disabled||(null==w?void 0:w.disabled))),E=(0,n.computed)((()=>{const n=e.multiple?Array.isArray(e.modelValue)&&e.modelValue.length>0:void 0!==e.modelValue&&null!==e.modelValue&&""!==e.modelValue,r=e.clearable&&!C.value&&t.inputHovering&&n;return r})),k=(0,n.computed)((()=>e.remote&&e.filterable&&!e.remoteShowSuffix?"":e.suffixIcon)),x=(0,n.computed)((()=>i.is("reverse",k.value&&t.visible&&e.suffixTransition))),I=(0,n.computed)((()=>(null==w?void 0:w.statusIcon)&&(null==S?void 0:S.validateState)&&Wi[null==S?void 0:S.validateState])),R=(0,n.computed)((()=>e.remote?300:0)),_=(0,n.computed)((()=>e.loading?e.loadingText||o("el.select.loading"):(!e.remote||""!==t.query||0!==t.options.size)&&(e.filterable&&t.query&&t.options.size>0&&0===t.filteredOptionsCount?e.noMatchText||o("el.select.noMatch"):0===t.options.size?e.noDataText||o("el.select.noData"):null))),N=(0,n.computed)((()=>{const e=Array.from(t.options.values()),n=[];return y.value.forEach((t=>{const r=e.findIndex((e=>e.currentLabel===t));r>-1&&n.push(e[r])})),n.length>=e.length?n:e})),A=(0,n.computed)((()=>Array.from(t.cachedOptions.values()))),O=(0,n.computed)((()=>{const n=N.value.filter((e=>!e.created)).some((e=>e.currentLabel===t.query));return e.filterable&&e.allowCreate&&""!==t.query&&!n})),P=Vr(),D=(0,n.computed)((()=>["small"].includes(P.value)?"small":"default")),B=(0,n.computed)({get(){return t.visible&&!1!==_.value},set(e){t.visible=e}});(0,n.watch)([()=>C.value,()=>P.value,()=>null==w?void 0:w.size],(()=>{(0,n.nextTick)((()=>{j()}))})),(0,n.watch)((()=>e.placeholder),(n=>{t.cachedPlaceHolder=t.currentPlaceholder=n;const r=e.multiple&&Array.isArray(e.modelValue)&&e.modelValue.length>0;r&&(t.currentPlaceholder="")})),(0,n.watch)((()=>e.modelValue),((n,r)=>{e.multiple&&(j(),n&&n.length>0||a.value&&""!==t.query?t.currentPlaceholder="":t.currentPlaceholder=t.cachedPlaceHolder,e.filterable&&!e.reserveKeyword&&(t.query="",H(t.query))),q(),e.filterable&&!e.multiple&&(t.inputLength=20),!Td(n,r)&&e.validateEvent&&(null==S||S.validate("change").catch((e=>In(e))))}),{flush:"post",deep:!0}),(0,n.watch)((()=>t.visible),(o=>{var i,s,l,d,p;o?(null==(s=null==(i=u.value)?void 0:i.updatePopper)||s.call(i),e.filterable&&(t.filteredOptionsCount=t.optionsCount,t.query=e.remote?"":t.selectedLabel,null==(d=null==(l=c.value)?void 0:l.focus)||d.call(l),e.multiple?null==(p=a.value)||p.focus():t.selectedLabel&&(t.currentPlaceholder=`${t.selectedLabel}`,t.selectedLabel=""),H(t.query),e.multiple||e.remote||(m.value.query="",(0,n.triggerRef)(m),(0,n.triggerRef)(v)))):(e.filterable&&(sn(e.filterMethod)&&e.filterMethod(""),sn(e.remoteMethod)&&e.remoteMethod("")),t.query="",t.previousQuery=null,t.selectedLabel="",t.inputLength=20,t.menuVisibleOnFocus=!1,V(),(0,n.nextTick)((()=>{a.value&&""===a.value.value&&0===t.selected.length&&(t.currentPlaceholder=t.cachedPlaceHolder)})),e.multiple||(t.selected&&(e.filterable&&e.allowCreate&&t.createdSelected&&t.createdLabel?t.selectedLabel=t.createdLabel:t.selectedLabel=t.selected.currentLabel,e.filterable&&(t.query=t.selectedLabel)),e.filterable&&(t.currentPlaceholder=t.cachedPlaceHolder))),r.emit("visible-change",o)})),(0,n.watch)((()=>t.options.entries()),(()=>{var n,r,o;if(!xr)return;null==(r=null==(n=u.value)?void 0:n.updatePopper)||r.call(n),e.multiple&&j();const i=(null==(o=h.value)?void 0:o.querySelectorAll("input"))||[];(e.filterable||e.defaultFirstOption||mn(e.modelValue))&&Array.from(i).includes(document.activeElement)||q(),e.defaultFirstOption&&(e.filterable||e.remote)&&t.filteredOptionsCount&&L()}),{flush:"post"}),(0,n.watch)((()=>t.hoverIndex),(e=>{yn(e)&&e>-1?g.value=N.value[e]||{}:g.value={},N.value.forEach((e=>{e.hover=g.value===e}))}));const j=()=>{(0,n.nextTick)((()=>{var e,n;if(!s.value)return;const r=s.value.$el.querySelector("input");b=b||(r.clientHeight>0?r.clientHeight+2:0);const o=p.value,i=Oy(P.value||(null==w?void 0:w.size)),a=P.value||i===b||b<=0?i:b,c=null===r.offsetParent;!c&&(r.style.height=(0===t.selected.length?a:Math.max(o?o.clientHeight+(o.clientHeight>a?6:0):0,a))-2+"px"),t.visible&&!1!==_.value&&(null==(n=null==(e=u.value)?void 0:e.updatePopper)||n.call(e))}))},H=async r=>{t.previousQuery===r||t.isOnComposition||(null!==t.previousQuery||!sn(e.filterMethod)&&!sn(e.remoteMethod)?(t.previousQuery=r,(0,n.nextTick)((()=>{var e,n;t.visible&&(null==(n=null==(e=u.value)?void 0:e.updatePopper)||n.call(e))})),t.hoverIndex=-1,e.multiple&&e.filterable&&(0,n.nextTick)((()=>{if(!C.value){const n=15*a.value.value.length+20;t.inputLength=e.collapseTags?Math.min(50,n):n,M()}j()})),e.remote&&sn(e.remoteMethod)?(t.hoverIndex=-1,e.remoteMethod(r)):sn(e.filterMethod)?(e.filterMethod(r),(0,n.triggerRef)(v)):(t.filteredOptionsCount=t.optionsCount,m.value.query=r,(0,n.triggerRef)(m),(0,n.triggerRef)(v)),e.defaultFirstOption&&(e.filterable||e.remote)&&t.filteredOptionsCount&&(await(0,n.nextTick)(),L())):t.previousQuery=r)},M=()=>{""!==t.currentPlaceholder&&(t.currentPlaceholder=a.value.value?"":t.cachedPlaceHolder)},L=()=>{const e=N.value.filter((e=>e.visible&&!e.disabled&&!e.states.groupDisabled)),n=e.find((e=>e.created)),r=e[0];t.hoverIndex=ee(N.value,n||r)},q=()=>{var r;if(!e.multiple){const n=$(e.modelValue);return(null==(r=n.props)?void 0:r.created)?(t.createdLabel=n.props.value,t.createdSelected=!0):t.createdSelected=!1,t.selectedLabel=n.currentLabel,t.selected=n,void(e.filterable&&(t.query=t.selectedLabel))}t.selectedLabel="";const o=[];Array.isArray(e.modelValue)&&e.modelValue.forEach((e=>{o.push($(e))})),t.selected=o,(0,n.nextTick)((()=>{j()}))},$=n=>{let r;const o="object"===dn(n).toLowerCase(),i="null"===dn(n).toLowerCase(),s="undefined"===dn(n).toLowerCase();for(let l=t.cachedOptions.size-1;l>=0;l--){const t=A.value[l],i=o?Gt(t.value,e.valueKey)===Gt(n,e.valueKey):t.value===n;if(i){r={value:n,currentLabel:t.currentLabel,isDisabled:t.isDisabled};break}}if(r)return r;const a=o?n.label:i||s?"":n,c={value:n,currentLabel:a};return e.multiple&&(c.hitState=!1),c},V=()=>{setTimeout((()=>{const n=e.valueKey;e.multiple?t.selected.length>0?t.hoverIndex=Math.min.apply(null,t.selected.map((e=>N.value.findIndex((t=>Gt(t,n)===Gt(e,n)))))):t.hoverIndex=-1:t.hoverIndex=N.value.findIndex((e=>ye(e)===ye(t.selected)))}),300)},F=()=>{var t,n;U(),null==(n=null==(t=u.value)?void 0:t.updatePopper)||n.call(t),e.multiple&&j()},U=()=>{var e;t.inputWidth=null==(e=s.value)?void 0:e.$el.offsetWidth},z=()=>{e.filterable&&t.query!==t.selectedLabel&&(t.query=t.selectedLabel,H(t.query))},K=Yv((()=>{z()}),R.value),W=Yv((e=>{H(e.target.value)}),R.value),G=t=>{Td(e.modelValue,t)||r.emit(ya,t)},Y=e=>Ay(e,(e=>!t.disabledOptions.has(e))),J=n=>{if(n.code!==cg.delete){if(n.target.value.length<=0&&!se()){const t=e.modelValue.slice(),n=Y(t);if(n<0)return;t.splice(n,1),r.emit(va,t),G(t)}1===n.target.value.length&&0===e.modelValue.length&&(t.currentPlaceholder=t.cachedPlaceHolder)}},Z=(n,o)=>{const i=t.selected.indexOf(o);if(i>-1&&!C.value){const t=e.modelValue.slice();t.splice(i,1),r.emit(va,t),G(t),r.emit("remove-tag",o.value)}n.stopPropagation(),ue()},X=n=>{n.stopPropagation();const o=e.multiple?[]:"";if(!an(o))for(const e of t.selected)e.isDisabled&&o.push(e.value);r.emit(va,o),G(o),t.hoverIndex=-1,t.visible=!1,r.emit("clear"),ue()},Q=o=>{var i;if(e.multiple){const n=(e.modelValue||[]).slice(),s=ee(n,o.value);s>-1?n.splice(s,1):(e.multipleLimit<=0||n.length<e.multipleLimit)&&n.push(o.value),r.emit(va,n),G(n),o.created&&(t.query="",H(""),t.inputLength=20),e.filterable&&(null==(i=a.value)||i.focus())}else r.emit(va,o.value),G(o.value),t.visible=!1;te(),t.visible||(0,n.nextTick)((()=>{ne(o)}))},ee=(t=[],r)=>{if(!cn(r))return t.indexOf(r);const o=e.valueKey;let i=-1;return t.some(((e,t)=>(0,n.toRaw)(Gt(e,o))===Gt(r,o)&&(i=t,!0))),i},te=()=>{const e=a.value||s.value;e&&(null==e||e.focus())},ne=e=>{var t,n,r,o,s;const a=Array.isArray(e)?e[0]:e;let c=null;if(null==a?void 0:a.value){const e=N.value.filter((e=>e.value===a.value));e.length>0&&(c=e[0].$el)}if(u.value&&c){const e=null==(o=null==(r=null==(n=null==(t=u.value)?void 0:t.popperRef)?void 0:n.contentRef)?void 0:r.querySelector)?void 0:o.call(r,`.${i.be("dropdown","wrap")}`);e&&Py(e,c)}null==(s=f.value)||s.handleScroll()},re=e=>{t.optionsCount++,t.filteredOptionsCount++,t.options.set(e.value,e),t.cachedOptions.set(e.value,e),e.disabled&&t.disabledOptions.set(e.value,e)},oe=(e,n)=>{t.options.get(e)===n&&(t.optionsCount--,t.filteredOptionsCount--,t.options.delete(e))},ie=e=>{e.code!==cg.backspace&&se(!1),t.inputLength=15*a.value.value.length+20,j()},se=e=>{if(!Array.isArray(t.selected))return;const n=Y(t.selected.map((e=>e.value))),r=t.selected[n];return r?!0===e||!1===e?(r.hitState=e,e):(r.hitState=!r.hitState,r.hitState):void 0},ae=e=>{const r=e.target.value;if("compositionend"===e.type)t.isOnComposition=!1,(0,n.nextTick)((()=>H(r)));else{const e=r[r.length-1]||"";t.isOnComposition=!Ia(e)}},ce=()=>{(0,n.nextTick)((()=>ne(t.selected)))},le=n=>{t.focused||((e.automaticDropdown||e.filterable)&&(e.filterable&&!t.visible&&(t.menuVisibleOnFocus=!0),t.visible=!0),t.focused=!0,r.emit("focus",n))},ue=()=>{var e,n;t.visible?null==(e=a.value||s.value)||e.focus():null==(n=s.value)||n.focus()},de=()=>{var e,n,r;t.visible=!1,null==(e=s.value)||e.blur(),null==(r=null==(n=c.value)?void 0:n.blur)||r.call(n)},pe=e=>{var n,o,i;(null==(n=u.value)?void 0:n.isFocusInsideContent(e))||(null==(o=d.value)?void 0:o.isFocusInsideContent(e))||(null==(i=h.value)?void 0:i.contains(e.relatedTarget))||(t.visible&&fe(),t.focused=!1,r.emit("blur",e))},he=e=>{X(e)},fe=()=>{t.visible=!1},ge=e=>{t.visible&&(e.preventDefault(),e.stopPropagation(),t.visible=!1)},me=e=>{e&&!t.mouseEnter||C.value||(t.menuVisibleOnFocus?t.menuVisibleOnFocus=!1:u.value&&u.value.isFocusInsideContent()||(t.visible=!t.visible),ue())},ve=()=>{t.visible?N.value[t.hoverIndex]&&Q(N.value[t.hoverIndex]):me()},ye=t=>cn(t.value)?Gt(t.value,e.valueKey):t.value,be=(0,n.computed)((()=>N.value.filter((e=>e.visible)).every((e=>e.disabled)))),we=(0,n.computed)((()=>e.multiple?t.selected.slice(0,e.maxCollapseTags):[])),Se=(0,n.computed)((()=>e.multiple?t.selected.slice(e.maxCollapseTags):[])),Te=e=>{if(t.visible){if(0!==t.options.size&&0!==t.filteredOptionsCount&&!t.isOnComposition&&!be.value){"next"===e?(t.hoverIndex++,t.hoverIndex===t.options.size&&(t.hoverIndex=0)):"prev"===e&&(t.hoverIndex--,t.hoverIndex<0&&(t.hoverIndex=t.options.size-1));const r=N.value[t.hoverIndex];!0!==r.disabled&&!0!==r.states.groupDisabled&&r.visible||Te(e),(0,n.nextTick)((()=>ne(g.value)))}}else t.visible=!0},Ce=()=>{t.mouseEnter=!0},Ee=()=>{t.mouseEnter=!1},ke=(e,t)=>{var n,r;Z(e,t),null==(r=null==(n=d.value)?void 0:n.updatePopper)||r.call(n)},xe=(0,n.computed)((()=>({maxWidth:(0,n.unref)(t.inputWidth)-32-(I.value?22:0)+"px",width:"100%"})));return{optionList:y,optionsArray:N,selectSize:P,handleResize:F,debouncedOnInputChange:K,debouncedQueryChange:W,deletePrevTag:J,deleteTag:Z,deleteSelected:X,handleOptionSelect:Q,scrollToOption:ne,readonly:T,resetInputHeight:j,showClose:E,iconComponent:k,iconReverse:x,showNewOption:O,collapseTagSize:D,setSelected:q,managePlaceholder:M,selectDisabled:C,emptyText:_,toggleLastOptionHitState:se,resetInputState:ie,handleComposition:ae,onOptionCreate:re,onOptionDestroy:oe,handleMenuEnter:ce,handleFocus:le,focus:ue,blur:de,handleBlur:pe,handleClearClick:he,handleClose:fe,handleKeydownEscape:ge,toggleMenu:me,selectOption:ve,getValueKey:ye,navigateOptions:Te,handleDeleteTooltipTag:ke,dropMenuVisible:B,queryChange:m,groupQueryChange:v,showTagList:we,collapseTagList:Se,selectTagsStyle:xe,reference:s,input:a,iOSInput:c,tooltipRef:u,tagTooltipRef:d,tags:p,selectWrapper:h,scrollbar:f,handleMouseEnter:Ce,handleMouseLeave:Ee}};var jy=(0,n.defineComponent)({name:"ElOptions",emits:["update-options"],setup(e,{slots:t,emit:n}){let r=[];function o(e,t){if(e.length!==t.length)return!1;for(const[n]of e.entries())if(e[n]!=t[n])return!1;return!0}return()=>{var e,i;const s=null==(e=t.default)?void 0:e.call(t),a=[];function c(e){Array.isArray(e)&&e.forEach((e=>{var t,n,r,o;const i=null==(t=(null==e?void 0:e.type)||{})?void 0:t.name;"ElOptionGroup"===i?c(an(e.children)||Array.isArray(e.children)||!sn(null==(n=e.children)?void 0:n.default)?e.children:null==(r=e.children)?void 0:r.default()):"ElOption"===i?a.push(null==(o=e.props)?void 0:o.label):Array.isArray(e.children)&&c(e.children)}))}return s.length&&c(null==(i=s[0])?void 0:i.children),o(a,r)||(r=a,n("update-options",a)),s}}});const Hy=new Map;let My;function Ly(e,t){let n=[];return Array.isArray(t.arg)?n=t.arg:bn(t.arg)&&n.push(t.arg),function(r,o){const i=t.instance.popperRef,s=r.target,a=null==o?void 0:o.target,c=!t||!t.instance,l=!s||!a,u=e.contains(s)||e.contains(a),d=e===s,p=n.length&&n.some((e=>null==e?void 0:e.contains(s)))||n.length&&n.includes(a),h=i&&(i.contains(s)||i.contains(a));c||l||u||d||p||h||t.value(r,o)}}xr&&(document.addEventListener("mousedown",(e=>My=e)),document.addEventListener("mouseup",(e=>{for(const t of Hy.values())for(const{documentHandler:n}of t)n(e,My)})));const qy={beforeMount(e,t){Hy.has(e)||Hy.set(e,[]),Hy.get(e).push({documentHandler:Ly(e,t),bindingFn:t.value})},updated(e,t){Hy.has(e)||Hy.set(e,[]);const n=Hy.get(e),r=n.findIndex((e=>e.bindingFn===t.oldValue)),o={documentHandler:Ly(e,t),bindingFn:t.value};r>=0?n.splice(r,1,o):n.push(o)},unmounted(e){Hy.delete(e)}},$y=e=>["",...Bn].includes(e),Vy="ElSelect",Fy=(0,n.defineComponent)({name:Vy,componentName:Vy,components:{ElInput:Da,ElSelectMenu:_v,ElOption:xv,ElOptions:jy,ElTag:yv,ElScrollbar:pv,ElTooltip:Gm,ElIcon:ur},directives:{ClickOutside:qy},props:{name:String,id:String,modelValue:{type:[Array,String,Number,Boolean,Object],default:void 0},autocomplete:{type:String,default:"off"},automaticDropdown:Boolean,size:{type:String,validator:$y},effect:{type:String,default:"light"},disabled:Boolean,clearable:Boolean,filterable:Boolean,allowCreate:Boolean,loading:Boolean,popperClass:{type:String,default:""},popperOptions:{type:Object,default:()=>({})},remote:Boolean,loadingText:String,noMatchText:String,noDataText:String,remoteMethod:Function,filterMethod:Function,multiple:Boolean,multipleLimit:{type:Number,default:0},placeholder:{type:String},defaultFirstOption:Boolean,reserveKeyword:{type:Boolean,default:!0},valueKey:{type:String,default:"value"},collapseTags:Boolean,collapseTagsTooltip:Boolean,maxCollapseTags:{type:Number,default:1},teleported:sg.teleported,persistent:{type:Boolean,default:!0},clearIcon:{type:Ui,default:Vo},fitInputWidth:Boolean,suffixIcon:{type:Ui,default:Zr},tagType:{...hv.type,default:"info"},validateEvent:{type:Boolean,default:!0},remoteShowSuffix:Boolean,suffixTransition:{type:Boolean,default:!0},placement:{type:String,values:Zp,default:"bottom-start"},ariaLabel:{type:String,default:void 0}},emits:[va,ya,"remove-tag","clear","visible-change","focus","blur"],setup(e,t){const r=l("select"),o=l("input"),{t:i}=en(),s=Dy(e),{optionList:a,optionsArray:c,selectSize:u,readonly:d,handleResize:p,collapseTagSize:h,debouncedOnInputChange:f,debouncedQueryChange:g,deletePrevTag:m,deleteTag:v,deleteSelected:y,handleOptionSelect:b,scrollToOption:w,setSelected:S,resetInputHeight:T,managePlaceholder:C,showClose:E,selectDisabled:k,iconComponent:x,iconReverse:I,showNewOption:R,emptyText:_,toggleLastOptionHitState:N,resetInputState:A,handleComposition:O,onOptionCreate:P,onOptionDestroy:D,handleMenuEnter:B,handleFocus:j,focus:H,blur:M,handleBlur:L,handleClearClick:q,handleClose:$,handleKeydownEscape:V,toggleMenu:F,selectOption:U,getValueKey:z,navigateOptions:K,handleDeleteTooltipTag:W,dropMenuVisible:G,reference:Y,input:J,iOSInput:Z,tooltipRef:X,tagTooltipRef:Q,tags:ee,selectWrapper:te,scrollbar:ne,queryChange:re,groupQueryChange:oe,handleMouseEnter:ie,handleMouseLeave:se,showTagList:ae,collapseTagList:ce,selectTagsStyle:le}=By(e,s,t),{inputWidth:ue,selected:de,inputLength:pe,filteredOptionsCount:he,visible:fe,selectedLabel:ge,hoverIndex:me,query:ve,inputHovering:ye,currentPlaceholder:be,menuVisibleOnFocus:we,isOnComposition:Se,options:Te,cachedOptions:Ce,optionsCount:Ee,prefixWidth:ke}=(0,n.toRefs)(s),xe=(0,n.computed)((()=>{const t=[r.b()],o=(0,n.unref)(u);return o&&t.push(r.m(o)),e.disabled&&t.push(r.m("disabled")),t})),Ie=(0,n.computed)((()=>[r.e("tags"),r.is("disabled",(0,n.unref)(k))])),Re=(0,n.computed)((()=>[r.b("tags-wrapper"),{"has-prefix":(0,n.unref)(ke)&&(0,n.unref)(de).length}])),_e=(0,n.computed)((()=>[r.e("input"),r.is((0,n.unref)(u)),r.is("disabled",(0,n.unref)(k))])),Ne=(0,n.computed)((()=>[r.e("input"),r.is((0,n.unref)(u)),r.em("input","iOS")])),Ae=(0,n.computed)((()=>[r.is("empty",!e.allowCreate&&Boolean((0,n.unref)(ve))&&0===(0,n.unref)(he))])),Oe=(0,n.computed)((()=>{const e=(0,n.unref)(ue)>123?(0,n.unref)(ue)-123:(0,n.unref)(ue)-75;return{maxWidth:`${e}px`}})),Pe=(0,n.computed)((()=>({marginLeft:`${(0,n.unref)(ke)}px`,flexGrow:1,width:(0,n.unref)(pe)/((0,n.unref)(ue)-32)+"%",maxWidth:(0,n.unref)(ue)-42+"px"})));(0,n.provide)(wv,(0,n.reactive)({props:e,options:Te,optionsArray:c,cachedOptions:Ce,optionsCount:Ee,filteredOptionsCount:he,hoverIndex:me,handleOptionSelect:b,onOptionCreate:P,onOptionDestroy:D,selectWrapper:te,selected:de,setSelected:S,queryChange:re,groupQueryChange:oe})),(0,n.onMounted)((()=>{s.cachedPlaceHolder=be.value=e.placeholder||(()=>i("el.select.placeholder")),e.multiple&&Array.isArray(e.modelValue)&&e.modelValue.length>0&&(be.value=""),ea(te,p),e.remote&&e.multiple&&T(),(0,n.nextTick)((()=>{const e=Y.value&&Y.value.$el;if(e&&(ue.value=e.getBoundingClientRect().width,t.slots.prefix)){const t=e.querySelector(`.${o.e("prefix")}`);ke.value=Math.max(t.getBoundingClientRect().width+11,30)}})),S()})),e.multiple&&!Array.isArray(e.modelValue)&&t.emit(va,[]),!e.multiple&&Array.isArray(e.modelValue)&&t.emit(va,"");const De=(0,n.computed)((()=>{var e,t;return null==(t=null==(e=X.value)?void 0:e.popperRef)?void 0:t.contentRef})),Be=e=>{a.value=e};return{isIOS:_r,onOptionsRendered:Be,prefixWidth:ke,selectSize:u,readonly:d,handleResize:p,collapseTagSize:h,debouncedOnInputChange:f,debouncedQueryChange:g,deletePrevTag:m,deleteTag:v,handleDeleteTooltipTag:W,deleteSelected:y,handleOptionSelect:b,scrollToOption:w,inputWidth:ue,selected:de,inputLength:pe,filteredOptionsCount:he,visible:fe,selectedLabel:ge,hoverIndex:me,query:ve,inputHovering:ye,currentPlaceholder:be,menuVisibleOnFocus:we,isOnComposition:Se,options:Te,resetInputHeight:T,managePlaceholder:C,showClose:E,selectDisabled:k,iconComponent:x,iconReverse:I,showNewOption:R,emptyText:_,toggleLastOptionHitState:N,resetInputState:A,handleComposition:O,handleMenuEnter:B,handleFocus:j,focus:H,blur:M,handleBlur:L,handleClearClick:q,handleClose:$,handleKeydownEscape:V,toggleMenu:F,selectOption:U,getValueKey:z,navigateOptions:K,dropMenuVisible:G,reference:Y,input:J,iOSInput:Z,tooltipRef:X,popperPaneRef:De,tags:ee,selectWrapper:te,scrollbar:ne,wrapperKls:xe,tagsKls:Ie,tagWrapperKls:Re,inputKls:_e,iOSInputKls:Ne,scrollbarKls:Ae,selectTagsStyle:le,nsSelect:r,tagTextStyle:Oe,inputStyle:Pe,handleMouseEnter:ie,handleMouseLeave:se,showTagList:ae,collapseTagList:ce,tagTooltipRef:Q}}}),Uy=["disabled","autocomplete","aria-label"],zy=["disabled"],Ky={style:{height:"100%",display:"flex","justify-content":"center","align-items":"center"}};function Wy(e,t,r,o,i,s){const a=(0,n.resolveComponent)("el-tag"),c=(0,n.resolveComponent)("el-tooltip"),l=(0,n.resolveComponent)("el-icon"),u=(0,n.resolveComponent)("el-input"),d=(0,n.resolveComponent)("el-option"),p=(0,n.resolveComponent)("el-options"),h=(0,n.resolveComponent)("el-scrollbar"),f=(0,n.resolveComponent)("el-select-menu"),g=(0,n.resolveDirective)("click-outside");return(0,n.withDirectives)(((0,n.openBlock)(),(0,n.createElementBlock)("div",{ref:"selectWrapper",class:(0,n.normalizeClass)(e.wrapperKls),onMouseenter:t[22]||(t[22]=(...t)=>e.handleMouseEnter&&e.handleMouseEnter(...t)),onMouseleave:t[23]||(t[23]=(...t)=>e.handleMouseLeave&&e.handleMouseLeave(...t)),onClick:t[24]||(t[24]=(0,n.withModifiers)(((...t)=>e.toggleMenu&&e.toggleMenu(...t)),["stop"]))},[(0,n.createVNode)(c,{ref:"tooltipRef",visible:e.dropMenuVisible,placement:e.placement,teleported:e.teleported,"popper-class":[e.nsSelect.e("popper"),e.popperClass],"popper-options":e.popperOptions,"fallback-placements":["bottom-start","top-start","right","left"],effect:e.effect,pure:"",trigger:"click",transition:`${e.nsSelect.namespace.value}-zoom-in-top`,"stop-popper-mouse-event":!1,"gpu-acceleration":!1,persistent:e.persistent,onShow:e.handleMenuEnter},{default:(0,n.withCtx)((()=>[(0,n.createElementVNode)("div",{class:"select-trigger",onMouseenter:t[20]||(t[20]=t=>e.inputHovering=!0),onMouseleave:t[21]||(t[21]=t=>e.inputHovering=!1)},[e.multiple?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:0,ref:"tags",tabindex:"-1",class:(0,n.normalizeClass)(e.tagsKls),style:(0,n.normalizeStyle)(e.selectTagsStyle),onClick:t[15]||(t[15]=(...t)=>e.focus&&e.focus(...t))},[e.collapseTags&&e.selected.length?((0,n.openBlock)(),(0,n.createBlock)(n.Transition,{key:0,onAfterLeave:e.resetInputHeight},{default:(0,n.withCtx)((()=>[(0,n.createElementVNode)("span",{class:(0,n.normalizeClass)(e.tagWrapperKls)},[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(e.showTagList,(t=>((0,n.openBlock)(),(0,n.createBlock)(a,{key:e.getValueKey(t),closable:!e.selectDisabled&&!t.isDisabled,size:e.collapseTagSize,hit:t.hitState,type:e.tagType,"disable-transitions":"",onClose:n=>e.deleteTag(n,t)},{default:(0,n.withCtx)((()=>[(0,n.createElementVNode)("span",{class:(0,n.normalizeClass)(e.nsSelect.e("tags-text")),style:(0,n.normalizeStyle)(e.tagTextStyle)},(0,n.toDisplayString)(t.currentLabel),7)])),_:2},1032,["closable","size","hit","type","onClose"])))),128)),e.selected.length>e.maxCollapseTags?((0,n.openBlock)(),(0,n.createBlock)(a,{key:0,closable:!1,size:e.collapseTagSize,type:e.tagType,"disable-transitions":""},{default:(0,n.withCtx)((()=>[e.collapseTagsTooltip?((0,n.openBlock)(),(0,n.createBlock)(c,{key:0,ref:"tagTooltipRef",disabled:e.dropMenuVisible,"fallback-placements":["bottom","top","right","left"],effect:e.effect,placement:"bottom",teleported:e.teleported},{default:(0,n.withCtx)((()=>[(0,n.createElementVNode)("span",{class:(0,n.normalizeClass)(e.nsSelect.e("tags-text"))},"+ "+(0,n.toDisplayString)(e.selected.length-e.maxCollapseTags),3)])),content:(0,n.withCtx)((()=>[(0,n.createElementVNode)("div",{class:(0,n.normalizeClass)(e.nsSelect.e("collapse-tags"))},[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(e.collapseTagList,(t=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:e.getValueKey(t),class:(0,n.normalizeClass)(e.nsSelect.e("collapse-tag"))},[(0,n.createVNode)(a,{class:"in-tooltip",closable:!e.selectDisabled&&!t.isDisabled,size:e.collapseTagSize,hit:t.hitState,type:e.tagType,"disable-transitions":"",style:{margin:"2px"},onClose:n=>e.handleDeleteTooltipTag(n,t)},{default:(0,n.withCtx)((()=>[(0,n.createElementVNode)("span",{class:(0,n.normalizeClass)(e.nsSelect.e("tags-text")),style:(0,n.normalizeStyle)({maxWidth:e.inputWidth-75+"px"})},(0,n.toDisplayString)(t.currentLabel),7)])),_:2},1032,["closable","size","hit","type","onClose"])],2)))),128))],2)])),_:1},8,["disabled","effect","teleported"])):((0,n.openBlock)(),(0,n.createElementBlock)("span",{key:1,class:(0,n.normalizeClass)(e.nsSelect.e("tags-text"))},"+ "+(0,n.toDisplayString)(e.selected.length-e.maxCollapseTags),3))])),_:1},8,["size","type"])):(0,n.createCommentVNode)("v-if",!0)],2)])),_:1},8,["onAfterLeave"])):(0,n.createCommentVNode)("v-if",!0),e.collapseTags?(0,n.createCommentVNode)("v-if",!0):((0,n.openBlock)(),(0,n.createBlock)(n.Transition,{key:1,onAfterLeave:e.resetInputHeight},{default:(0,n.withCtx)((()=>[(0,n.createElementVNode)("span",{class:(0,n.normalizeClass)(e.tagWrapperKls),style:(0,n.normalizeStyle)(e.prefixWidth&&e.selected.length?{marginLeft:`${e.prefixWidth}px`}:"")},[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(e.selected,(t=>((0,n.openBlock)(),(0,n.createBlock)(a,{key:e.getValueKey(t),closable:!e.selectDisabled&&!t.isDisabled,size:e.collapseTagSize,hit:t.hitState,type:e.tagType,"disable-transitions":"",onClose:n=>e.deleteTag(n,t)},{default:(0,n.withCtx)((()=>[(0,n.createElementVNode)("span",{class:(0,n.normalizeClass)(e.nsSelect.e("tags-text")),style:(0,n.normalizeStyle)({maxWidth:e.inputWidth-75+"px"})},(0,n.toDisplayString)(t.currentLabel),7)])),_:2},1032,["closable","size","hit","type","onClose"])))),128))],6)])),_:1},8,["onAfterLeave"])),e.filterable&&!e.selectDisabled?(0,n.withDirectives)(((0,n.openBlock)(),(0,n.createElementBlock)("input",{key:2,ref:"input","onUpdate:modelValue":t[0]||(t[0]=t=>e.query=t),type:"text",class:(0,n.normalizeClass)(e.inputKls),disabled:e.selectDisabled,autocomplete:e.autocomplete,style:(0,n.normalizeStyle)(e.inputStyle),"aria-label":e.ariaLabel,onFocus:t[1]||(t[1]=(...t)=>e.handleFocus&&e.handleFocus(...t)),onBlur:t[2]||(t[2]=(...t)=>e.handleBlur&&e.handleBlur(...t)),onKeyup:t[3]||(t[3]=(...t)=>e.managePlaceholder&&e.managePlaceholder(...t)),onKeydown:[t[4]||(t[4]=(...t)=>e.resetInputState&&e.resetInputState(...t)),t[5]||(t[5]=(0,n.withKeys)((0,n.withModifiers)((t=>e.navigateOptions("next")),["prevent"]),["down"])),t[6]||(t[6]=(0,n.withKeys)((0,n.withModifiers)((t=>e.navigateOptions("prev")),["prevent"]),["up"])),t[7]||(t[7]=(0,n.withKeys)(((...t)=>e.handleKeydownEscape&&e.handleKeydownEscape(...t)),["esc"])),t[8]||(t[8]=(0,n.withKeys)((0,n.withModifiers)(((...t)=>e.selectOption&&e.selectOption(...t)),["stop","prevent"]),["enter"])),t[9]||(t[9]=(0,n.withKeys)(((...t)=>e.deletePrevTag&&e.deletePrevTag(...t)),["delete"])),t[10]||(t[10]=(0,n.withKeys)((t=>e.visible=!1),["tab"]))],onCompositionstart:t[11]||(t[11]=(...t)=>e.handleComposition&&e.handleComposition(...t)),onCompositionupdate:t[12]||(t[12]=(...t)=>e.handleComposition&&e.handleComposition(...t)),onCompositionend:t[13]||(t[13]=(...t)=>e.handleComposition&&e.handleComposition(...t)),onInput:t[14]||(t[14]=(...t)=>e.debouncedQueryChange&&e.debouncedQueryChange(...t))},null,46,Uy)),[[n.vModelText,e.query]]):(0,n.createCommentVNode)("v-if",!0)],6)):(0,n.createCommentVNode)("v-if",!0),(0,n.createCommentVNode)(" fix: https://github.com/element-plus/element-plus/issues/11415 "),e.isIOS&&!e.multiple&&e.filterable&&e.readonly?((0,n.openBlock)(),(0,n.createElementBlock)("input",{key:1,ref:"iOSInput",class:(0,n.normalizeClass)(e.iOSInputKls),disabled:e.selectDisabled,type:"text"},null,10,zy)):(0,n.createCommentVNode)("v-if",!0),(0,n.createVNode)(u,{id:e.id,ref:"reference",modelValue:e.selectedLabel,"onUpdate:modelValue":t[16]||(t[16]=t=>e.selectedLabel=t),type:"text",placeholder:"function"===typeof e.currentPlaceholder?e.currentPlaceholder():e.currentPlaceholder,name:e.name,autocomplete:e.autocomplete,size:e.selectSize,disabled:e.selectDisabled,readonly:e.readonly,"validate-event":!1,class:(0,n.normalizeClass)([e.nsSelect.is("focus",e.visible)]),tabindex:e.multiple&&e.filterable?-1:void 0,label:e.ariaLabel,onFocus:e.handleFocus,onBlur:e.handleBlur,onInput:e.debouncedOnInputChange,onPaste:e.debouncedOnInputChange,onCompositionstart:e.handleComposition,onCompositionupdate:e.handleComposition,onCompositionend:e.handleComposition,onKeydown:[t[17]||(t[17]=(0,n.withKeys)((0,n.withModifiers)((t=>e.navigateOptions("next")),["stop","prevent"]),["down"])),t[18]||(t[18]=(0,n.withKeys)((0,n.withModifiers)((t=>e.navigateOptions("prev")),["stop","prevent"]),["up"])),(0,n.withKeys)((0,n.withModifiers)(e.selectOption,["stop","prevent"]),["enter"]),(0,n.withKeys)(e.handleKeydownEscape,["esc"]),t[19]||(t[19]=(0,n.withKeys)((t=>e.visible=!1),["tab"]))]},(0,n.createSlots)({suffix:(0,n.withCtx)((()=>[e.iconComponent&&!e.showClose?((0,n.openBlock)(),(0,n.createBlock)(l,{key:0,class:(0,n.normalizeClass)([e.nsSelect.e("caret"),e.nsSelect.e("icon"),e.iconReverse])},{default:(0,n.withCtx)((()=>[((0,n.openBlock)(),(0,n.createBlock)((0,n.resolveDynamicComponent)(e.iconComponent)))])),_:1},8,["class"])):(0,n.createCommentVNode)("v-if",!0),e.showClose&&e.clearIcon?((0,n.openBlock)(),(0,n.createBlock)(l,{key:1,class:(0,n.normalizeClass)([e.nsSelect.e("caret"),e.nsSelect.e("icon")]),onClick:e.handleClearClick},{default:(0,n.withCtx)((()=>[((0,n.openBlock)(),(0,n.createBlock)((0,n.resolveDynamicComponent)(e.clearIcon)))])),_:1},8,["class","onClick"])):(0,n.createCommentVNode)("v-if",!0)])),_:2},[e.$slots.prefix?{name:"prefix",fn:(0,n.withCtx)((()=>[(0,n.createElementVNode)("div",Ky,[(0,n.renderSlot)(e.$slots,"prefix")])]))}:void 0]),1032,["id","modelValue","placeholder","name","autocomplete","size","disabled","readonly","class","tabindex","label","onFocus","onBlur","onInput","onPaste","onCompositionstart","onCompositionupdate","onCompositionend","onKeydown"])],32)])),content:(0,n.withCtx)((()=>[(0,n.createVNode)(f,null,{default:(0,n.withCtx)((()=>[(0,n.withDirectives)((0,n.createVNode)(h,{ref:"scrollbar",tag:"ul","wrap-class":e.nsSelect.be("dropdown","wrap"),"view-class":e.nsSelect.be("dropdown","list"),class:(0,n.normalizeClass)(e.scrollbarKls)},{default:(0,n.withCtx)((()=>[e.showNewOption?((0,n.openBlock)(),(0,n.createBlock)(d,{key:0,value:e.query,created:!0},null,8,["value"])):(0,n.createCommentVNode)("v-if",!0),(0,n.createVNode)(p,{onUpdateOptions:e.onOptionsRendered},{default:(0,n.withCtx)((()=>[(0,n.renderSlot)(e.$slots,"default")])),_:3},8,["onUpdateOptions"])])),_:3},8,["wrap-class","view-class","class"]),[[n.vShow,e.options.size>0&&!e.loading]]),e.emptyText&&(!e.allowCreate||e.loading||e.allowCreate&&0===e.options.size)?((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:0},[e.$slots.empty?(0,n.renderSlot)(e.$slots,"empty",{key:0}):((0,n.openBlock)(),(0,n.createElementBlock)("p",{key:1,class:(0,n.normalizeClass)(e.nsSelect.be("dropdown","empty"))},(0,n.toDisplayString)(e.emptyText),3))],64)):(0,n.createCommentVNode)("v-if",!0)])),_:3})])),_:3},8,["visible","placement","teleported","popper-class","popper-options","effect","transition","persistent","onShow"])],34)),[[g,e.handleClose,e.popperPaneRef]])}var Gy=tr(Fy,[["render",Wy],["__file","/home/runner/work/element-plus/element-plus/packages/components/select/src/select.vue"]]);const Yy=(0,n.defineComponent)({name:"ElOptionGroup",componentName:"ElOptionGroup",props:{label:String,disabled:Boolean},setup(e){const t=l("select"),r=(0,n.ref)(!0),o=(0,n.getCurrentInstance)(),i=(0,n.ref)([]);(0,n.provide)(bv,(0,n.reactive)({...(0,n.toRefs)(e)}));const s=(0,n.inject)(wv);(0,n.onMounted)((()=>{i.value=a(o.subTree)}));const a=e=>{const t=[];return Array.isArray(e.children)&&e.children.forEach((e=>{var n;e.type&&"ElOption"===e.type.name&&e.component&&e.component.proxy?t.push(e.component.proxy):(null==(n=e.children)?void 0:n.length)&&t.push(...a(e))})),t},{groupQueryChange:c}=(0,n.toRaw)(s);return(0,n.watch)(c,(()=>{r.value=i.value.some((e=>!0===e.visible))}),{flush:"post"}),{visible:r,ns:t}}});function Jy(e,t,r,o,i,s){return(0,n.withDirectives)(((0,n.openBlock)(),(0,n.createElementBlock)("ul",{class:(0,n.normalizeClass)(e.ns.be("group","wrap"))},[(0,n.createElementVNode)("li",{class:(0,n.normalizeClass)(e.ns.be("group","title"))},(0,n.toDisplayString)(e.label),3),(0,n.createElementVNode)("li",null,[(0,n.createElementVNode)("ul",{class:(0,n.normalizeClass)(e.ns.b("group"))},[(0,n.renderSlot)(e.$slots,"default")],2)])],2)),[[n.vShow,e.visible]])}var Zy=tr(Yy,[["render",Jy],["__file","/home/runner/work/element-plus/element-plus/packages/components/select/src/option-group.vue"]]);const Xy=Yn(Gy,{Option:xv,OptionGroup:Zy}),Qy=Zn(xv),eb=(Zn(Zy),Dn({type:{type:String,values:["primary","success","warning","info","danger","default"],default:"default"},underline:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},href:{type:String,default:""},icon:{type:Ui}})),tb={click:e=>e instanceof MouseEvent},nb=["href"],rb=(0,n.defineComponent)({name:"ElLink"}),ob=(0,n.defineComponent)({...rb,props:eb,emits:tb,setup(e,{emit:t}){const r=e,o=l("link"),i=(0,n.computed)((()=>[o.b(),o.m(r.type),o.is("disabled",r.disabled),o.is("underline",r.underline&&!r.disabled)]));function s(e){r.disabled||t("click",e)}return(e,t)=>((0,n.openBlock)(),(0,n.createElementBlock)("a",{class:(0,n.normalizeClass)((0,n.unref)(i)),href:e.disabled||!e.href?void 0:e.href,onClick:s},[e.icon?((0,n.openBlock)(),(0,n.createBlock)((0,n.unref)(ur),{key:0},{default:(0,n.withCtx)((()=>[((0,n.openBlock)(),(0,n.createBlock)((0,n.resolveDynamicComponent)(e.icon)))])),_:1})):(0,n.createCommentVNode)("v-if",!0),e.$slots.default?((0,n.openBlock)(),(0,n.createElementBlock)("span",{key:1,class:(0,n.normalizeClass)((0,n.unref)(o).e("inner"))},[(0,n.renderSlot)(e.$slots,"default")],2)):(0,n.createCommentVNode)("v-if",!0),e.$slots.icon?(0,n.renderSlot)(e.$slots,"icon",{key:2}):(0,n.createCommentVNode)("v-if",!0)],10,nb))}});var ib=tr(ob,[["__file","/home/runner/work/element-plus/element-plus/packages/components/link/src/link.vue"]]);const sb=Yn(ib),ab=(0,n.defineComponent)({inheritAttrs:!1});function cb(e,t,r,o,i,s){return(0,n.renderSlot)(e.$slots,"default")}var lb=tr(ab,[["render",cb],["__file","/home/runner/work/element-plus/element-plus/packages/components/collection/src/collection.vue"]]);const ub=(0,n.defineComponent)({name:"ElCollectionItem",inheritAttrs:!1});function db(e,t,r,o,i,s){return(0,n.renderSlot)(e.$slots,"default")}var pb=tr(ub,[["render",db],["__file","/home/runner/work/element-plus/element-plus/packages/components/collection/src/collection-item.vue"]]);const hb="data-el-collection-item",fb=e=>{const t=`El${e}Collection`,r=`${t}Item`,o=Symbol(t),i=Symbol(r),s={...lb,name:t,setup(){const e=(0,n.ref)(null),t=new Map,r=()=>{const r=(0,n.unref)(e);if(!r)return[];const o=Array.from(r.querySelectorAll(`[${hb}]`)),i=[...t.values()];return i.sort(((e,t)=>o.indexOf(e.ref)-o.indexOf(t.ref)))};(0,n.provide)(o,{itemMap:t,getItems:r,collectionRef:e})}},a={...pb,name:r,setup(e,{attrs:t}){const r=(0,n.ref)(null),s=(0,n.inject)(o,void 0);(0,n.provide)(i,{collectionItemRef:r}),(0,n.onMounted)((()=>{const e=(0,n.unref)(r);e&&s.itemMap.set(e,{ref:e,...t})})),(0,n.onBeforeUnmount)((()=>{const e=(0,n.unref)(r);s.itemMap.delete(e)}))}};return{COLLECTION_INJECTION_KEY:o,COLLECTION_ITEM_INJECTION_KEY:i,ElCollection:s,ElCollectionItem:a}},gb=Dn({trigger:lg.trigger,effect:{...sg.effect,default:"light"},type:{type:An(String)},placement:{type:An(String),default:"bottom"},popperOptions:{type:An(Object),default:()=>({})},id:String,size:{type:String,default:""},splitButton:Boolean,hideOnClick:{type:Boolean,default:!0},loop:{type:Boolean,default:!0},showTimeout:{type:Number,default:150},hideTimeout:{type:Number,default:150},tabindex:{type:An([Number,String]),default:0},maxHeight:{type:An([Number,String]),default:""},popperClass:{type:String,default:""},disabled:{type:Boolean,default:!1},role:{type:String,default:"menu"},buttonProps:{type:An(Object)},teleported:sg.teleported}),mb=Dn({command:{type:[Object,String,Number],default:()=>({})},disabled:Boolean,divided:Boolean,textValue:String,icon:{type:Ui}}),vb=Dn({onKeydown:{type:An(Function)}}),yb=[cg.down,cg.pageDown,cg.home],bb=[cg.up,cg.pageUp,cg.end],wb=[...yb,...bb],{ElCollection:Sb,ElCollectionItem:Tb,COLLECTION_INJECTION_KEY:Cb,COLLECTION_ITEM_INJECTION_KEY:Eb}=fb("Dropdown"),kb=Symbol("elDropdown"),xb=Dn({style:{type:An([String,Array,Object])},currentTabId:{type:An(String)},defaultCurrentTabId:String,loop:Boolean,dir:{type:String,values:["ltr","rtl"],default:"ltr"},orientation:{type:An(String)},onBlur:Function,onFocus:Function,onMousedown:Function}),{ElCollection:Ib,ElCollectionItem:Rb,COLLECTION_INJECTION_KEY:_b,COLLECTION_ITEM_INJECTION_KEY:Nb}=fb("RovingFocusGroup"),Ab=Symbol("elRovingFocusGroup"),Ob=Symbol("elRovingFocusGroupItem"),Pb={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"},Db=(e,t)=>{if("rtl"!==t)return e;switch(e){case cg.right:return cg.left;case cg.left:return cg.right;default:return e}},Bb=(e,t,n)=>{const r=Db(e.key,n);if(("vertical"!==t||![cg.left,cg.right].includes(r))&&("horizontal"!==t||![cg.up,cg.down].includes(r)))return Pb[r]},jb=(e,t)=>e.map(((n,r)=>e[(r+t)%e.length])),Hb=e=>{const{activeElement:t}=document;for(const n of e){if(n===t)return;if(n.focus(),t!==document.activeElement)return}},Mb="currentTabIdChange",Lb="rovingFocusGroup.entryFocus",qb={bubbles:!1,cancelable:!0},$b=(0,n.defineComponent)({name:"ElRovingFocusGroupImpl",inheritAttrs:!1,props:xb,emits:[Mb,"entryFocus"],setup(e,{emit:t}){var r;const o=(0,n.ref)(null!=(r=e.currentTabId||e.defaultCurrentTabId)?r:null),i=(0,n.ref)(!1),s=(0,n.ref)(!1),a=(0,n.ref)(null),{getItems:c}=(0,n.inject)(_b,void 0),l=(0,n.computed)((()=>[{outline:"none"},e.style])),u=e=>{t(Mb,e)},d=()=>{i.value=!0},p=Eg((t=>{var n;null==(n=e.onMousedown)||n.call(e,t)}),(()=>{s.value=!0})),h=Eg((t=>{var n;null==(n=e.onFocus)||n.call(e,t)}),(e=>{const t=!(0,n.unref)(s),{target:r,currentTarget:a}=e;if(r===a&&t&&!(0,n.unref)(i)){const e=new Event(Lb,qb);if(null==a||a.dispatchEvent(e),!e.defaultPrevented){const e=c().filter((e=>e.focusable)),t=e.find((e=>e.active)),r=e.find((e=>e.id===(0,n.unref)(o))),i=[t,r,...e].filter(Boolean),s=i.map((e=>e.ref));Hb(s)}}s.value=!1})),f=Eg((t=>{var n;null==(n=e.onBlur)||n.call(e,t)}),(()=>{i.value=!1})),g=(...e)=>{t("entryFocus",...e)};(0,n.provide)(Ab,{currentTabbedId:(0,n.readonly)(o),loop:(0,n.toRef)(e,"loop"),tabIndex:(0,n.computed)((()=>(0,n.unref)(i)?-1:0)),rovingFocusGroupRef:a,rovingFocusGroupRootStyle:l,orientation:(0,n.toRef)(e,"orientation"),dir:(0,n.toRef)(e,"dir"),onItemFocus:u,onItemShiftTab:d,onBlur:f,onFocus:h,onMousedown:p}),(0,n.watch)((()=>e.currentTabId),(e=>{o.value=null!=e?e:null})),Fs(a,Lb,g)}});function Vb(e,t,r,o,i,s){return(0,n.renderSlot)(e.$slots,"default")}var Fb=tr($b,[["render",Vb],["__file","/home/runner/work/element-plus/element-plus/packages/components/roving-focus-group/src/roving-focus-group-impl.vue"]]);const Ub=(0,n.defineComponent)({name:"ElRovingFocusGroup",components:{ElFocusGroupCollection:Ib,ElRovingFocusGroupImpl:Fb}});function zb(e,t,r,o,i,s){const a=(0,n.resolveComponent)("el-roving-focus-group-impl"),c=(0,n.resolveComponent)("el-focus-group-collection");return(0,n.openBlock)(),(0,n.createBlock)(c,null,{default:(0,n.withCtx)((()=>[(0,n.createVNode)(a,(0,n.normalizeProps)((0,n.guardReactiveProps)(e.$attrs)),{default:(0,n.withCtx)((()=>[(0,n.renderSlot)(e.$slots,"default")])),_:3},16)])),_:3})}var Kb=tr(Ub,[["render",zb],["__file","/home/runner/work/element-plus/element-plus/packages/components/roving-focus-group/src/roving-focus-group.vue"]]);function Wb(){if(!arguments.length)return[];var e=arguments[0];return d(e)?e:[e]}var Gb=Wb;const{ButtonGroup:Yb}=Hs,Jb=(0,n.defineComponent)({name:"ElDropdown",components:{ElButton:Hs,ElButtonGroup:Yb,ElScrollbar:pv,ElDropdownCollection:Sb,ElTooltip:Gm,ElRovingFocusGroup:Kb,ElOnlyChild:Ng,ElIcon:ur,ArrowDown:Zr},props:gb,emits:["visible-change","click","command"],setup(e,{emit:t}){const r=(0,n.getCurrentInstance)(),o=l("dropdown"),{t:i}=en(),s=(0,n.ref)(),a=(0,n.ref)(),c=(0,n.ref)(null),u=(0,n.ref)(null),d=(0,n.ref)(null),p=(0,n.ref)(null),h=(0,n.ref)(!1),f=[cg.enter,cg.space,cg.down],g=(0,n.computed)((()=>({maxHeight:sr(e.maxHeight)}))),m=(0,n.computed)((()=>[o.m(C.value)])),v=(0,n.computed)((()=>Gb(e.trigger))),y=Mr().value,b=(0,n.computed)((()=>e.id||y));function w(){S()}function S(){var e;null==(e=c.value)||e.onClose()}function T(){var e;null==(e=c.value)||e.onOpen()}(0,n.watch)([s,v],(([e,t],[n])=>{var r,o,i;(null==(r=null==n?void 0:n.$el)?void 0:r.removeEventListener)&&n.$el.removeEventListener("pointerenter",k),(null==(o=null==e?void 0:e.$el)?void 0:o.removeEventListener)&&e.$el.removeEventListener("pointerenter",k),(null==(i=null==e?void 0:e.$el)?void 0:i.addEventListener)&&t.includes("hover")&&e.$el.addEventListener("pointerenter",k)}),{immediate:!0}),(0,n.onBeforeUnmount)((()=>{var e,t;(null==(t=null==(e=s.value)?void 0:e.$el)?void 0:t.removeEventListener)&&s.value.$el.removeEventListener("pointerenter",k)}));const C=Vr();function E(...e){t("command",...e)}function k(){var e,t;null==(t=null==(e=s.value)?void 0:e.$el)||t.focus()}function x(){}function I(){const e=(0,n.unref)(u);v.value.includes("hover")&&(null==e||e.focus()),p.value=null}function R(e){p.value=e}function _(e){h.value||(e.preventDefault(),e.stopImmediatePropagation())}function N(){t("visible-change",!0)}function A(e){"keydown"===(null==e?void 0:e.type)&&u.value.focus()}function O(){t("visible-change",!1)}(0,n.provide)(kb,{contentRef:u,role:(0,n.computed)((()=>e.role)),triggerId:b,isUsingKeyboard:h,onItemEnter:x,onItemLeave:I}),(0,n.provide)("elDropdown",{instance:r,dropdownSize:C,handleClick:w,commandHandler:E,trigger:(0,n.toRef)(e,"trigger"),hideOnClick:(0,n.toRef)(e,"hideOnClick")});const P=e=>{var t,n;e.preventDefault(),null==(n=null==(t=u.value)?void 0:t.focus)||n.call(t,{preventScroll:!0})},D=e=>{t("click",e)};return{t:i,ns:o,scrollbar:d,wrapStyle:g,dropdownTriggerKls:m,dropdownSize:C,triggerId:b,triggerKeys:f,currentTabId:p,handleCurrentTabIdChange:R,handlerMainButtonClick:D,handleEntryFocus:_,handleClose:S,handleOpen:T,handleBeforeShowTooltip:N,handleShowTooltip:A,handleBeforeHideTooltip:O,onFocusAfterTrapped:P,popperRef:c,contentRef:u,triggeringElementRef:s,referenceElementRef:a}}});function Zb(e,t,r,o,i,s){var a;const c=(0,n.resolveComponent)("el-dropdown-collection"),l=(0,n.resolveComponent)("el-roving-focus-group"),u=(0,n.resolveComponent)("el-scrollbar"),d=(0,n.resolveComponent)("el-only-child"),p=(0,n.resolveComponent)("el-tooltip"),h=(0,n.resolveComponent)("el-button"),f=(0,n.resolveComponent)("arrow-down"),g=(0,n.resolveComponent)("el-icon"),m=(0,n.resolveComponent)("el-button-group");return(0,n.openBlock)(),(0,n.createElementBlock)("div",{class:(0,n.normalizeClass)([e.ns.b(),e.ns.is("disabled",e.disabled)])},[(0,n.createVNode)(p,{ref:"popperRef",role:e.role,effect:e.effect,"fallback-placements":["bottom","top"],"popper-options":e.popperOptions,"gpu-acceleration":!1,"hide-after":"hover"===e.trigger?e.hideTimeout:0,"manual-mode":!0,placement:e.placement,"popper-class":[e.ns.e("popper"),e.popperClass],"reference-element":null==(a=e.referenceElementRef)?void 0:a.$el,trigger:e.trigger,"trigger-keys":e.triggerKeys,"trigger-target-el":e.contentRef,"show-after":"hover"===e.trigger?e.showTimeout:0,"stop-popper-mouse-event":!1,"virtual-ref":e.triggeringElementRef,"virtual-triggering":e.splitButton,disabled:e.disabled,transition:`${e.ns.namespace.value}-zoom-in-top`,teleported:e.teleported,pure:"",persistent:"",onBeforeShow:e.handleBeforeShowTooltip,onShow:e.handleShowTooltip,onBeforeHide:e.handleBeforeHideTooltip},(0,n.createSlots)({content:(0,n.withCtx)((()=>[(0,n.createVNode)(u,{ref:"scrollbar","wrap-style":e.wrapStyle,tag:"div","view-class":e.ns.e("list")},{default:(0,n.withCtx)((()=>[(0,n.createVNode)(l,{loop:e.loop,"current-tab-id":e.currentTabId,orientation:"horizontal",onCurrentTabIdChange:e.handleCurrentTabIdChange,onEntryFocus:e.handleEntryFocus},{default:(0,n.withCtx)((()=>[(0,n.createVNode)(c,null,{default:(0,n.withCtx)((()=>[(0,n.renderSlot)(e.$slots,"dropdown")])),_:3})])),_:3},8,["loop","current-tab-id","onCurrentTabIdChange","onEntryFocus"])])),_:3},8,["wrap-style","view-class"])])),_:2},[e.splitButton?void 0:{name:"default",fn:(0,n.withCtx)((()=>[(0,n.createVNode)(d,{id:e.triggerId,ref:"triggeringElementRef",role:"button",tabindex:e.tabindex},{default:(0,n.withCtx)((()=>[(0,n.renderSlot)(e.$slots,"default")])),_:3},8,["id","tabindex"])]))}]),1032,["role","effect","popper-options","hide-after","placement","popper-class","reference-element","trigger","trigger-keys","trigger-target-el","show-after","virtual-ref","virtual-triggering","disabled","transition","teleported","onBeforeShow","onShow","onBeforeHide"]),e.splitButton?((0,n.openBlock)(),(0,n.createBlock)(m,{key:0},{default:(0,n.withCtx)((()=>[(0,n.createVNode)(h,(0,n.mergeProps)({ref:"referenceElementRef"},e.buttonProps,{size:e.dropdownSize,type:e.type,disabled:e.disabled,tabindex:e.tabindex,onClick:e.handlerMainButtonClick}),{default:(0,n.withCtx)((()=>[(0,n.renderSlot)(e.$slots,"default")])),_:3},16,["size","type","disabled","tabindex","onClick"]),(0,n.createVNode)(h,(0,n.mergeProps)({id:e.triggerId,ref:"triggeringElementRef"},e.buttonProps,{role:"button",size:e.dropdownSize,type:e.type,class:e.ns.e("caret-button"),disabled:e.disabled,tabindex:e.tabindex,"aria-label":e.t("el.dropdown.toggleDropdown")}),{default:(0,n.withCtx)((()=>[(0,n.createVNode)(g,{class:(0,n.normalizeClass)(e.ns.e("icon"))},{default:(0,n.withCtx)((()=>[(0,n.createVNode)(f)])),_:1},8,["class"])])),_:1},16,["id","size","type","class","disabled","tabindex","aria-label"])])),_:3})):(0,n.createCommentVNode)("v-if",!0)],2)}var Xb=tr(Jb,[["render",Zb],["__file","/home/runner/work/element-plus/element-plus/packages/components/dropdown/src/dropdown.vue"]]);const Qb=(...e)=>t=>{e.forEach((e=>{sn(e)?e(t):e.value=t}))},ew=(0,n.defineComponent)({name:"DropdownItemImpl",components:{ElIcon:ur},props:mb,emits:["pointermove","pointerleave","click","clickimpl"],setup(e,{emit:t}){const r=l("dropdown"),{role:o}=(0,n.inject)(kb,void 0),{collectionItemRef:i}=(0,n.inject)(Eb,void 0),{collectionItemRef:s}=(0,n.inject)(Nb,void 0),{rovingFocusGroupItemRef:a,tabIndex:c,handleFocus:u,handleKeydown:d,handleMousedown:p}=(0,n.inject)(Ob,void 0),h=Qb(i,s,a),f=(0,n.computed)((()=>"menu"===o.value?"menuitem":"navigation"===o.value?"link":"button")),g=Eg((e=>{const{code:n}=e;if(n===cg.enter||n===cg.space)return e.preventDefault(),e.stopImmediatePropagation(),t("clickimpl",e),!0}),d);return{ns:r,itemRef:h,dataset:{[hb]:""},role:f,tabIndex:c,handleFocus:u,handleKeydown:g,handleMousedown:p}}}),tw=["aria-disabled","tabindex","role"];function nw(e,t,r,o,i,s){const a=(0,n.resolveComponent)("el-icon");return(0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,null,[e.divided?((0,n.openBlock)(),(0,n.createElementBlock)("li",(0,n.mergeProps)({key:0,role:"separator",class:e.ns.bem("menu","item","divided")},e.$attrs),null,16)):(0,n.createCommentVNode)("v-if",!0),(0,n.createElementVNode)("li",(0,n.mergeProps)({ref:e.itemRef},{...e.dataset,...e.$attrs},{"aria-disabled":e.disabled,class:[e.ns.be("menu","item"),e.ns.is("disabled",e.disabled)],tabindex:e.tabIndex,role:e.role,onClick:t[0]||(t[0]=t=>e.$emit("clickimpl",t)),onFocus:t[1]||(t[1]=(...t)=>e.handleFocus&&e.handleFocus(...t)),onKeydown:t[2]||(t[2]=(0,n.withModifiers)(((...t)=>e.handleKeydown&&e.handleKeydown(...t)),["self"])),onMousedown:t[3]||(t[3]=(...t)=>e.handleMousedown&&e.handleMousedown(...t)),onPointermove:t[4]||(t[4]=t=>e.$emit("pointermove",t)),onPointerleave:t[5]||(t[5]=t=>e.$emit("pointerleave",t))}),[e.icon?((0,n.openBlock)(),(0,n.createBlock)(a,{key:0},{default:(0,n.withCtx)((()=>[((0,n.openBlock)(),(0,n.createBlock)((0,n.resolveDynamicComponent)(e.icon)))])),_:1})):(0,n.createCommentVNode)("v-if",!0),(0,n.renderSlot)(e.$slots,"default")],16,tw)],64)}var rw=tr(ew,[["render",nw],["__file","/home/runner/work/element-plus/element-plus/packages/components/dropdown/src/dropdown-item-impl.vue"]]);const ow=()=>{const e=(0,n.inject)("elDropdown",{}),t=(0,n.computed)((()=>null==e?void 0:e.dropdownSize));return{elDropdown:e,_elDropdownSize:t}},iw=(0,n.defineComponent)({components:{ElRovingFocusCollectionItem:Rb},props:{focusable:{type:Boolean,default:!0},active:{type:Boolean,default:!1}},emits:["mousedown","focus","keydown"],setup(e,{emit:t}){const{currentTabbedId:r,loop:o,onItemFocus:i,onItemShiftTab:s}=(0,n.inject)(Ab,void 0),{getItems:a}=(0,n.inject)(_b,void 0),c=Mr(),l=(0,n.ref)(null),u=Eg((e=>{t("mousedown",e)}),(t=>{e.focusable?i((0,n.unref)(c)):t.preventDefault()})),d=Eg((e=>{t("focus",e)}),(()=>{i((0,n.unref)(c))})),p=Eg((e=>{t("keydown",e)}),(e=>{const{key:t,shiftKey:r,target:i,currentTarget:c}=e;if(t===cg.tab&&r)return void s();if(i!==c)return;const l=Bb(e);if(l){e.preventDefault();const t=a().filter((e=>e.focusable));let r=t.map((e=>e.ref));switch(l){case"last":r.reverse();break;case"prev":case"next":{"prev"===l&&r.reverse();const e=r.indexOf(c);r=o.value?jb(r,e+1):r.slice(e+1);break}default:break}(0,n.nextTick)((()=>{Hb(r)}))}})),h=(0,n.computed)((()=>r.value===(0,n.unref)(c)));return(0,n.provide)(Ob,{rovingFocusGroupItemRef:l,tabIndex:(0,n.computed)((()=>(0,n.unref)(h)?0:-1)),handleMousedown:u,handleFocus:d,handleKeydown:p}),{id:c,handleKeydown:p,handleFocus:d,handleMousedown:u}}});function sw(e,t,r,o,i,s){const a=(0,n.resolveComponent)("el-roving-focus-collection-item");return(0,n.openBlock)(),(0,n.createBlock)(a,{id:e.id,focusable:e.focusable,active:e.active},{default:(0,n.withCtx)((()=>[(0,n.renderSlot)(e.$slots,"default")])),_:3},8,["id","focusable","active"])}var aw=tr(iw,[["render",sw],["__file","/home/runner/work/element-plus/element-plus/packages/components/roving-focus-group/src/roving-focus-item.vue"]]);const cw=(0,n.defineComponent)({name:"ElDropdownItem",components:{ElDropdownCollectionItem:Tb,ElRovingFocusItem:aw,ElDropdownItemImpl:rw},inheritAttrs:!1,props:mb,emits:["pointermove","pointerleave","click"],setup(e,{emit:t,attrs:r}){const{elDropdown:o}=ow(),i=(0,n.getCurrentInstance)(),s=(0,n.ref)(null),a=(0,n.computed)((()=>{var e,t;return null!=(t=null==(e=(0,n.unref)(s))?void 0:e.textContent)?t:""})),{onItemEnter:c,onItemLeave:l}=(0,n.inject)(kb,void 0),u=Eg((e=>(t("pointermove",e),e.defaultPrevented)),kg((t=>{if(e.disabled)return void l(t);const n=t.currentTarget;n===document.activeElement||n.contains(document.activeElement)||(c(t),t.defaultPrevented||null==n||n.focus())}))),d=Eg((e=>(t("pointerleave",e),e.defaultPrevented)),kg((e=>{l(e)}))),p=Eg((n=>{if(!e.disabled)return t("click",n),"keydown"!==n.type&&n.defaultPrevented}),(t=>{var n,r,s;e.disabled?t.stopImmediatePropagation():((null==(n=null==o?void 0:o.hideOnClick)?void 0:n.value)&&(null==(r=o.handleClick)||r.call(o)),null==(s=o.commandHandler)||s.call(o,e.command,i,t))})),h=(0,n.computed)((()=>({...e,...r})));return{handleClick:p,handlePointerMove:u,handlePointerLeave:d,textContent:a,propsAndAttrs:h}}});function lw(e,t,r,o,i,s){var a;const c=(0,n.resolveComponent)("el-dropdown-item-impl"),l=(0,n.resolveComponent)("el-roving-focus-item"),u=(0,n.resolveComponent)("el-dropdown-collection-item");return(0,n.openBlock)(),(0,n.createBlock)(u,{disabled:e.disabled,"text-value":null!=(a=e.textValue)?a:e.textContent},{default:(0,n.withCtx)((()=>[(0,n.createVNode)(l,{focusable:!e.disabled},{default:(0,n.withCtx)((()=>[(0,n.createVNode)(c,(0,n.mergeProps)(e.propsAndAttrs,{onPointerleave:e.handlePointerLeave,onPointermove:e.handlePointerMove,onClickimpl:e.handleClick}),{default:(0,n.withCtx)((()=>[(0,n.renderSlot)(e.$slots,"default")])),_:3},16,["onPointerleave","onPointermove","onClickimpl"])])),_:3},8,["focusable"])])),_:3},8,["disabled","text-value"])}var uw=tr(cw,[["render",lw],["__file","/home/runner/work/element-plus/element-plus/packages/components/dropdown/src/dropdown-item.vue"]]);const dw=(0,n.defineComponent)({name:"ElDropdownMenu",props:vb,setup(e){const t=l("dropdown"),{_elDropdownSize:r}=ow(),o=r.value,{focusTrapRef:i,onKeydown:s}=(0,n.inject)(cm,void 0),{contentRef:a,role:c,triggerId:u}=(0,n.inject)(kb,void 0),{collectionRef:d,getItems:p}=(0,n.inject)(Cb,void 0),{rovingFocusGroupRef:h,rovingFocusGroupRootStyle:f,tabIndex:g,onBlur:m,onFocus:v,onMousedown:y}=(0,n.inject)(Ab,void 0),{collectionRef:b}=(0,n.inject)(_b,void 0),w=(0,n.computed)((()=>[t.b("menu"),t.bm("menu",null==o?void 0:o.value)])),S=Qb(a,d,i,h,b),T=Eg((t=>{var n;null==(n=e.onKeydown)||n.call(e,t)}),(e=>{const{currentTarget:t,code:r,target:o}=e;t.contains(o);if(cg.tab===r&&e.stopImmediatePropagation(),e.preventDefault(),o!==(0,n.unref)(a))return;if(!wb.includes(r))return;const i=p().filter((e=>!e.disabled)),s=i.map((e=>e.ref));bb.includes(r)&&s.reverse(),Hb(s)})),C=e=>{T(e),s(e)};return{size:o,rovingFocusGroupRootStyle:f,tabIndex:g,dropdownKls:w,role:c,triggerId:u,dropdownListWrapperRef:S,handleKeydown:C,onBlur:m,onFocus:v,onMousedown:y}}}),pw=["role","aria-labelledby"];function hw(e,t,r,o,i,s){return(0,n.openBlock)(),(0,n.createElementBlock)("ul",{ref:e.dropdownListWrapperRef,class:(0,n.normalizeClass)(e.dropdownKls),style:(0,n.normalizeStyle)(e.rovingFocusGroupRootStyle),tabindex:-1,role:e.role,"aria-labelledby":e.triggerId,onBlur:t[0]||(t[0]=(...t)=>e.onBlur&&e.onBlur(...t)),onFocus:t[1]||(t[1]=(...t)=>e.onFocus&&e.onFocus(...t)),onKeydown:t[2]||(t[2]=(0,n.withModifiers)(((...t)=>e.handleKeydown&&e.handleKeydown(...t)),["self"])),onMousedown:t[3]||(t[3]=(0,n.withModifiers)(((...t)=>e.onMousedown&&e.onMousedown(...t)),["self"]))},[(0,n.renderSlot)(e.$slots,"default")],46,pw)}var fw=tr(dw,[["render",hw],["__file","/home/runner/work/element-plus/element-plus/packages/components/dropdown/src/dropdown-menu.vue"]]);const gw=Yn(Xb,{DropdownItem:uw,DropdownMenu:fw}),mw=Zn(uw),vw=Zn(fw),yw=e=>((0,n.pushScopeId)("data-v-e7fc1244"),e=e(),(0,n.popScopeId)(),e),bw={class:"peerStatus",drag:""},ww={class:"login-type"},Sw=yw((()=>(0,n.createElementVNode)("i",{class:"wtue wtue-fangxiang-you-mian-xiao"},null,-1))),Tw={class:"status-name"},Cw=["title"],Ew={class:"wtue wtue-fangxiang-xia-mian-xiao"},kw={class:"status-name-text ue-call-variable"},xw={class:"dialState-box"},Iw={class:"call-btn-right"},Rw={class:"customer-info",drag:""},_w={class:"customer-item"},Nw={class:"customer-name"},Aw={class:"time"},Ow={class:"customer-item"},Pw={class:"region"},Dw={class:"quick-operation-box drag",drag:""},Bw={class:"quick-btn"},jw=yw((()=>(0,n.createElementVNode)("i",{class:"wtue wtue-guaji1"},null,-1))),Hw=[jw],Mw=yw((()=>(0,n.createElementVNode)("i",{class:"wtue wtue-hujiaohuojieting"},null,-1))),Lw=[Mw],qw={key:0,class:"error"},$w={class:"opacity80"},Vw=(0,n.createTextVNode)("刷新状态"),Fw={class:"oprate-wrap link-hangup"},Uw=yw((()=>(0,n.createElementVNode)("i",{class:"wtue wtue-guaji1 right8 font12"},null,-1))),zw=(0,n.createTextVNode)("挂断 "),Kw=[Uw,zw],Ww=yw((()=>(0,n.createElementVNode)("i",{class:"wtue wtue-hujiaohuojieting right8 font12"},null,-1))),Gw=(0,n.createTextVNode)("接听 "),Yw=[Ww,Gw],Jw={class:"oprate-wrap link-oprate"},Zw=yw((()=>(0,n.createElementVNode)("i",{class:"wtue wtue-a-jiantou-zuo-line"},null,-1))),Xw=yw((()=>(0,n.createElementVNode)("span",{class:"text"},"返回",-1))),Qw=[Zw,Xw],eS=yw((()=>(0,n.createElementVNode)("i",{class:"wtue wtue-a-jiantou-zuo-line"},null,-1))),tS=yw((()=>(0,n.createElementVNode)("span",{class:"text"},"返回",-1))),nS=[eS,tS],rS={class:"oprate-wrap link-oprate"},oS=yw((()=>(0,n.createElementVNode)("i",{class:"wtue wtue-baochi"},null,-1))),iS=yw((()=>(0,n.createElementVNode)("span",{class:"text"},"保持",-1))),sS=[oS,iS],aS=yw((()=>(0,n.createElementVNode)("i",{class:"wtue wtue-quxiaobaochi"},null,-1))),cS=yw((()=>(0,n.createElementVNode)("span",{class:"text"},"取消保持",-1))),lS=[aS,cS],uS=yw((()=>(0,n.createElementVNode)("i",{class:"wtue wtue-jingyin"},null,-1))),dS=yw((()=>(0,n.createElementVNode)("span",{class:"text"},"静音",-1))),pS=[uS,dS],hS=yw((()=>(0,n.createElementVNode)("i",{class:"wtue wtue-quxiaojingyin"},null,-1))),fS=yw((()=>(0,n.createElementVNode)("span",{class:"text"},"取消静音",-1))),gS=[hS,fS],mS=yw((()=>(0,n.createElementVNode)("i",{class:"wtue wtue-jiehui"},null,-1))),vS=yw((()=>(0,n.createElementVNode)("span",{class:"text"},"接回",-1))),yS=[mS,vS],bS=yw((()=>(0,n.createElementVNode)("i",{class:"wtue wtue-zixun"},null,-1))),wS=yw((()=>(0,n.createElementVNode)("span",{class:"text"},"咨询",-1))),SS=[bS,wS],TS=yw((()=>(0,n.createElementVNode)("i",{class:"wtue wtue-quxiaozixun"},null,-1))),CS=yw((()=>(0,n.createElementVNode)("span",{class:"text"},"取消咨询",-1))),ES=[TS,CS],kS=yw((()=>(0,n.createElementVNode)("i",{class:"wtue wtue-quxiaozixun"},null,-1))),xS=yw((()=>(0,n.createElementVNode)("span",{class:"text"},"取消咨询",-1))),IS=[kS,xS],RS=yw((()=>(0,n.createElementVNode)("i",{class:"wtue wtue-zixunzhuanyi"},null,-1))),_S=yw((()=>(0,n.createElementVNode)("span",{class:"text"},"咨询转移",-1))),NS=[RS,_S],AS=yw((()=>(0,n.createElementVNode)("i",{class:"wtue wtue-sanfangtonghua"},null,-1))),OS=yw((()=>(0,n.createElementVNode)("span",{class:"text"},"三方通话",-1))),PS=[AS,OS],DS=yw((()=>(0,n.createElementVNode)("i",{class:"wtue wtue-zhuanjie"},null,-1))),BS=yw((()=>(0,n.createElementVNode)("span",{class:"text"},"转接",-1))),jS=[DS,BS],HS=yw((()=>(0,n.createElementVNode)("i",{class:"wtue wtue-manyidu"},null,-1))),MS=yw((()=>(0,n.createElementVNode)("span",{class:"text"},"满意度",-1))),LS=[HS,MS],qS=yw((()=>(0,n.createElementVNode)("i",{class:"wtue wtue-jianpan"},null,-1))),$S=yw((()=>(0,n.createElementVNode)("span",{class:"text"},"键盘",-1))),VS=[qS,$S],FS=yw((()=>(0,n.createElementVNode)("i",{class:"wtue wtue-quxiaojianpan"},null,-1))),US=yw((()=>(0,n.createElementVNode)("span",{class:"text"},"取消键盘",-1))),zS=[FS,US],KS={key:1},WS=yw((()=>(0,n.createElementVNode)("i",{class:"wtue wtue-a-jiantou-zuo-line"},null,-1))),GS=yw((()=>(0,n.createElementVNode)("span",{class:"text"},"返回",-1))),YS=[WS,GS],JS={key:2},ZS=yw((()=>(0,n.createElementVNode)("i",{class:"wtue wtue-a-jiantou-zuo-line"},null,-1))),XS=yw((()=>(0,n.createElementVNode)("span",{class:"text"},"返回",-1))),QS=[ZS,XS],eT={key:3,class:"dial"},tT={class:"dial-input"},nT=yw((()=>(0,n.createElementVNode)("use",{"xlink:href":"#wtue-jianpanshanchu"},null,-1))),rT=[nT],oT={class:"call-btn",style:{color:"rgb(28, 146, 233)","font-weight":"600","font-size":"16px"}},iT={key:0,class:"dial-box"},sT=["onClick"],aT={key:4,class:"setting"},cT=yw((()=>(0,n.createElementVNode)("div",{class:"label"},"通话设置",-1))),lT=(0,n.createTextVNode)(" 接听方式 "),uT=(0,n.createTextVNode)("自动接听"),dT={key:1},pT=(0,n.createTextVNode)(" 振铃 "),hT=(0,n.createTextVNode)(" 后接听 "),fT=(0,n.createTextVNode)(" SIP号 "),gT={class:"footer"},mT=(0,n.createTextVNode)("取消"),vT=(0,n.createTextVNode)("确定");function yT(e,t,r,o,i,s){const a=mw,c=vw,l=gw,u=(0,n.resolveComponent)("phoneBarTimer"),d=sb,p=(0,n.resolveComponent)("transferOprate"),h=(0,n.resolveComponent)("consuleOprate"),f=Da,g=Qy,m=Xy,v=(0,n.resolveComponent)("formItem"),y=Hp,b=za,w=(0,n.resolveComponent)("input-suffix"),S=Hs,T=(0,n.resolveDirective)("int"),C=(0,n.resolveDirective)("move");return(0,n.openBlock)(),(0,n.createElementBlock)("div",null,[(0,n.withDirectives)(((0,n.openBlock)(),(0,n.createElementBlock)("div",{class:(0,n.normalizeClass)({"red-border":"busy"==e.stateType,"success-border":"free"==e.stateType,"phone-bar":!0,"ue-call-variable":!0})},[(0,n.withDirectives)((0,n.createElementVNode)("div",bw,[(0,n.withDirectives)((0,n.createElementVNode)("div",ww,[(0,n.createElementVNode)("div",{class:(0,n.normalizeClass)(["middle pointer",{"red-border":"busy"==e.stateType,"success-border":"free"==e.stateType}]),onClick:t[0]||(t[0]=(0,n.withModifiers)(((...t)=>e.goToSetting&&e.goToSetting(...t)),["stop"]))},[(0,n.createTextVNode)((0,n.toDisplayString)(e.loginTypeMap[e.loginType])+" ",1),Sw],2)],512),[[n.vShow,!e.showConfig&&!e.disabledSwitch]]),(0,n.createElementVNode)("div",{class:(0,n.normalizeClass)(["peerStatus-center",e.stateType])},[(0,n.createVNode)(l,{class:"pointer",onCommand:e.updateAgentStatus,trigger:"click",disabled:e.disabledSwitch,style:{"min-width":"55px"}},{dropdown:(0,n.withCtx)((()=>[(0,n.createVNode)(c,{"visible-arrow":!1,class:"cep-dropdown-menu phoneMenu"},{default:(0,n.withCtx)((()=>[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(e.agentStatusList,(t=>((0,n.openBlock)(),(0,n.createBlock)(a,{key:t.number,command:t.number,class:(0,n.normalizeClass)({"hide-dropdown-item":t.name===e.currentStatusName})},{default:(0,n.withCtx)((()=>[(0,n.createElementVNode)("div",kw,[(0,n.createElementVNode)("div",{class:(0,n.normalizeClass)(["status",{idle:0===t.number}])},null,2),(0,n.createTextVNode)(" "+(0,n.toDisplayString)(t.name),1)])])),_:2},1032,["command","class"])))),128))])),_:1})])),default:(0,n.withCtx)((()=>[(0,n.createElementVNode)("span",Tw,[(0,n.createElementVNode)("span",{class:"name-ellipsis",title:e.currentStatusName},(0,n.toDisplayString)(e.currentStatusName),9,Cw),(0,n.withDirectives)((0,n.createElementVNode)("i",Ew,null,512),[[n.vShow,!e.disabledSwitch]]),(0,n.withDirectives)((0,n.createElementVNode)("span",null,(0,n.toDisplayString)(": "+e.callingNumber),513),[[n.vShow,e.disabledSwitch&&e.callingNumber]])])])),_:1},8,["onCommand","disabled"]),(0,n.createElementVNode)("div",xw,[(0,n.createVNode)(u,{class:"pointer",ref:"phoneBarPeerTimeRef"},null,512),e.showDial&&!e.hiddenOprate?((0,n.openBlock)(),(0,n.createElementBlock)("i",{key:0,class:"icon wtue wtue-kuozhan-shouqi-xian",onClick:t[1]||(t[1]=(...t)=>e.toggleDialState&&e.toggleDialState(...t))})):(0,n.createCommentVNode)("",!0),e.showDial||e.hiddenOprate?(0,n.createCommentVNode)("",!0):((0,n.openBlock)(),(0,n.createElementBlock)("i",{key:1,onClick:t[2]||(t[2]=(...t)=>e.toggleDialState&&e.toggleDialState(...t)),class:"icon wtue wtue-a-hujiaojieting"}))])],2),(0,n.createElementVNode)("div",Iw,[(0,n.createElementVNode)("i",{class:"wtue wtue-hujiaohuojieting success-back pointer",onClick:t[3]||(t[3]=(0,n.withModifiers)((t=>e.showInput=!e.showInput),["stop"]))})])],512),[[n.vShow,!e.disabledSwitch]]),(0,n.withDirectives)((0,n.createElementVNode)("div",Rw,[(0,n.createElementVNode)("div",_w,[(0,n.createElementVNode)("div",Nw,(0,n.toDisplayString)(e.customerInfo.name||e.customerInfo.number),1),(0,n.createElementVNode)("div",Aw,[(0,n.createVNode)(u,{ref:"phoneBarStatusTimeRef"},null,512)])]),(0,n.createElementVNode)("div",Ow,[(0,n.createElementVNode)("div",Pw,(0,n.toDisplayString)(e.customerInfo.place||"未知地点"),1),(0,n.withDirectives)((0,n.createElementVNode)("div",{class:"tag"},(0,n.toDisplayString)(e.customerInfo.tag||""),513),[[n.vShow,e.customerInfo.tag]])])],512),[[n.vShow,e.disabledSwitch&&!e.quickState]]),(0,n.withDirectives)((0,n.createElementVNode)("div",Dw,[(0,n.createElementVNode)("div",{class:(0,n.normalizeClass)(["quick-state",e.stateType]),drag:""},[(0,n.createElementVNode)("span",null,(0,n.toDisplayString)(e.currentStatusName),1),(0,n.createElementVNode)("span",null,[(0,n.createVNode)(u,{ref:"phoneBarQuickStatusTimeRef"},null,512),(0,n.createElementVNode)("i",{class:"wtue wtue-kuozhan-zhankai-xian",onClick:t[4]||(t[4]=t=>e.switchQuickState(!1))})])],2),(0,n.createElementVNode)("div",Bw,[(0,n.withDirectives)((0,n.createElementVNode)("div",{class:"btn-item hangup",onClick:t[5]||(t[5]=(0,n.withModifiers)(((...t)=>e.hangup&&e.hangup(...t)),["stop"]))},Hw,512),[[n.vShow,e.isVisibleBtn("hangup")]]),(0,n.withDirectives)((0,n.createElementVNode)("div",{class:"btn-item accept",onClick:t[6]||(t[6]=(0,n.withModifiers)(((...t)=>e.accept&&e.accept(...t)),["stop"]))},Lw,512),[[n.vShow,e.isVisibleBtn("answer")]])])],512),[[n.vShow,e.disabledSwitch]]),e.errorObj.isError?((0,n.openBlock)(),(0,n.createElementBlock)("div",qw,[(0,n.createElementVNode)("div",$w,(0,n.toDisplayString)(e.errorObj.message),1),(0,n.createVNode)(d,{style:{"margin-top":"8px"},underline:!1,type:"primary",onClick:(0,n.withModifiers)(e.connect,["stop"])},{default:(0,n.withCtx)((()=>[Vw])),_:1},8,["onClick"])])):(0,n.createCommentVNode)("",!0),(0,n.withDirectives)((0,n.createElementVNode)("div",Fw,[e.isVisibleBtn("hangup")&&e.showHangupBtn?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:0,class:"btn error-back pointer hangup-btn",onClick:t[7]||(t[7]=(0,n.withModifiers)(((...t)=>e.hangup&&e.hangup(...t)),["stop"]))},Kw)):(0,n.createCommentVNode)("",!0),e.isVisibleBtn("answer")?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:1,class:"btn success-back pointer",onClick:t[8]||(t[8]=(0,n.withModifiers)(((...t)=>e.accept&&e.accept(...t)),["stop"])),style:{"min-width":"200px"}},Yw)):(0,n.createCommentVNode)("",!0)],512),[[n.vShow,e.disabledSwitch&&!e.quickState]]),(0,n.createElementVNode)("div",null,[(0,n.createElementVNode)("div",Jw,[e.isVisibleBtn("concul")&&e.consulSelect?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:0,class:"btn btn-middle pointer bak-btn",onClick:t[9]||(t[9]=(0,n.withModifiers)((t=>e.setConsulState(!1)),["stop"]))},Qw)):(0,n.createCommentVNode)("",!0),e.isVisibleBtn("transfer")&&e.transferState?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:1,class:"btn btn-middle pointer bak-btn",onClick:t[10]||(t[10]=(0,n.withModifiers)((t=>e.setTransferState(!1)),["stop"]))},nS)):(0,n.createCommentVNode)("",!0)]),(0,n.createElementVNode)("div",rS,[e.isVisibleBtn("hold")?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:0,class:"btn btn-middle pointer",onClick:t[11]||(t[11]=(0,n.withModifiers)((t=>e.holdOrUnHold("1")),["stop"]))},sS)):(0,n.createCommentVNode)("",!0),e.isVisibleBtn("holdcancel")?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:1,class:"btn btn-middle pointer flex1",onClick:t[12]||(t[12]=(0,n.withModifiers)((t=>e.holdOrUnHold("2")),["stop"]))},lS)):(0,n.createCommentVNode)("",!0),e.isVisibleBtn("mute")?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:2,class:"btn btn-middle pointer",onClick:t[13]||(t[13]=(0,n.withModifiers)((t=>e.muteOrUnMute("1")),["stop"]))},pS)):(0,n.createCommentVNode)("",!0),e.isVisibleBtn("mutecancel")?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:3,class:"btn btn-middle pointer flex1",onClick:t[14]||(t[14]=(0,n.withModifiers)((t=>e.muteOrUnMute("2")),["stop"]))},gS)):(0,n.createCommentVNode)("",!0),e.isVisibleBtn("takeback")?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:4,class:"btn btn-middle pointer",onClick:t[15]||(t[15]=(0,n.withModifiers)(((...t)=>e.resumeConsult&&e.resumeConsult(...t)),["stop"]))},yS)):(0,n.createCommentVNode)("",!0),e.isVisibleBtn("concul")&&!e.consulSelect?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:5,class:"btn btn-middle pointer",onClick:t[16]||(t[16]=(0,n.withModifiers)((t=>e.setConsulState(!0)),["stop"]))},SS)):(0,n.createCommentVNode)("",!0),e.isVisibleBtn("cancelconcul")?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:6,class:"btn btn-middle pointer",onClick:t[17]||(t[17]=(0,n.withModifiers)(((...t)=>e.cancelConsult&&e.cancelConsult(...t)),["stop"]))},ES)):(0,n.createCommentVNode)("",!0),e.isVisibleBtn("endconsul")?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:7,class:"btn btn-middle pointer",onClick:t[18]||(t[18]=(0,n.withModifiers)(((...t)=>e.stopConsult&&e.stopConsult(...t)),["stop"]))},IS)):(0,n.createCommentVNode)("",!0),e.isVisibleBtn("concultransfer")?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:8,class:"btn btn-middle pointer",onClick:t[19]||(t[19]=(0,n.withModifiers)(((...t)=>e.consultTransfer&&e.consultTransfer(...t)),["stop"]))},NS)):(0,n.createCommentVNode)("",!0),e.isVisibleBtn("threepartycall")?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:9,class:"btn btn-middle pointer",onClick:t[20]||(t[20]=(0,n.withModifiers)(((...t)=>e.threeWayCall&&e.threeWayCall(...t)),["stop"]))},PS)):(0,n.createCommentVNode)("",!0),e.isVisibleBtn("transfer")&&!e.transferState?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:10,class:"btn btn-middle pointer",onClick:t[21]||(t[21]=(0,n.withModifiers)((t=>e.setTransferState(!0)),["stop"]))},jS)):(0,n.createCommentVNode)("",!0),e.isVisibleBtn("satisfaction")?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:11,class:"btn btn-middle pointer",onClick:t[22]||(t[22]=(0,n.withModifiers)(((...t)=>e.satisfaction&&e.satisfaction(...t)),["stop"]))},LS)):(0,n.createCommentVNode)("",!0),e.isVisibleBtn("key")&&e.webrtcKeyState?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:12,class:"btn btn-middle pointer",onClick:t[23]||(t[23]=(0,n.withModifiers)((t=>e.setWebrtcKeyState(!1)),["stop"]))},VS)):(0,n.createCommentVNode)("",!0),e.isVisibleBtn("key")&&!e.webrtcKeyState?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:13,class:"btn btn-middle pointer",onClick:t[24]||(t[24]=(0,n.withModifiers)((t=>e.setWebrtcKeyState(!0)),["stop"]))},zS)):(0,n.createCommentVNode)("",!0)])]),e.isVisibleBtn("transferoprate")?((0,n.openBlock)(),(0,n.createElementBlock)("div",KS,[(0,n.createElementVNode)("div",{class:"btn btn-middle pointer bak-btn",onClick:t[25]||(t[25]=(0,n.withModifiers)((t=>e.setTransferState(!1)),["stop"]))},YS),(0,n.createVNode)(p)])):(0,n.createCommentVNode)("",!0),e.isVisibleBtn("consuleoprate")?((0,n.openBlock)(),(0,n.createElementBlock)("div",JS,[(0,n.createElementVNode)("div",{class:"btn btn-middle pointer bak-btn",onClick:t[26]||(t[26]=(0,n.withModifiers)((t=>e.setConsulState(!1)),["stop"]))},QS),(0,n.createVNode)(h)])):(0,n.createCommentVNode)("",!0),!e.showConfig&&!e.disabledSwitch||e.isVisibleBtn("key")&&!e.webrtcKeyState&&e.disabledSwitch?((0,n.openBlock)(),(0,n.createElementBlock)("div",eT,[(0,n.withDirectives)((0,n.createElementVNode)("div",tT,[(0,n.createVNode)(f,{class:"input",type:"",placeholder:e.showKeyboardPlaceholder?e.defaultKeyboardPlaceholder:"",ref:"input",clearable:"",modelValue:e.dialoutNumber,"onUpdate:modelValue":e.inputChange,onKeyup:(0,n.withKeys)(e.keyDowndialout,["enter"]),onFocus:t[27]||(t[27]=t=>e.showKeyboardPlaceholder=!1),onBlur:t[28]||(t[28]=t=>e.showKeyboardPlaceholder=!0)},null,8,["placeholder","modelValue","onUpdate:modelValue","onKeyup"]),(0,n.withDirectives)(((0,n.openBlock)(),(0,n.createElementBlock)("svg",{class:"ue-num-keyboard back pointer",onClick:t[29]||(t[29]=(0,n.withModifiers)(((...t)=>e.deleteNum&&e.deleteNum(...t)),["stop"]))},rT,512)),[[n.vShow,e.isVisibleBtn("key")]]),(0,n.createElementVNode)("div",{style:(0,n.normalizeStyle)([{color:e.showNum?"rgb(28, 146, 233)":"rgb(140, 140, 140)"},{"font-weight":"600","font-size":"16px"}])},[(0,n.createElementVNode)("i",{class:"wtue wtue-jianpan pointer",onClick:t[30]||(t[30]=(0,n.withModifiers)((t=>e.showNum=!e.showNum),["stop"]))})],4),(0,n.createElementVNode)("div",oT,[(0,n.createElementVNode)("i",{class:(0,n.normalizeClass)(["wtue wtue-hujiaohuojieting success-back pointer",{"dialout-disabled":!(e.isVisibleBtn("dialout")&&!e.isVisibleBtn("key"))}]),onClick:t[31]||(t[31]=(0,n.withModifiers)((t=>e.dialout(e.dialoutNumber,e.isVisibleBtn("dialout")&&!e.isVisibleBtn("key"))),["stop"]))},null,2)])],512),[[n.vShow,e.showInput]]),e.showNum&&e.showInput?((0,n.openBlock)(),(0,n.createElementBlock)("div",iT,[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(e.keyList,((t,r)=>((0,n.openBlock)(),(0,n.createElementBlock)("span",{key:r,class:"ue-num-keyboard pointer",onClick:(0,n.withModifiers)((n=>e.sendDTMF(t)),["stop"])},(0,n.toDisplayString)(t),9,sT)))),128)),(0,n.createElementVNode)("span",{class:"ue-num-keyboard pointer star",onClick:t[32]||(t[32]=(0,n.withModifiers)((t=>e.sendDTMF("*")),["stop"]))},"*"),(0,n.createElementVNode)("span",{class:"ue-num-keyboard pointer",onClick:t[33]||(t[33]=(0,n.withModifiers)((t=>e.sendDTMF("0")),["stop"]))},"0"),(0,n.createElementVNode)("span",{class:"ue-num-keyboard pointer",onClick:t[34]||(t[34]=(0,n.withModifiers)((t=>e.sendDTMF("#")),["stop"]))},"#")])):(0,n.createCommentVNode)("",!0)])):(0,n.createCommentVNode)("",!0),e.showConfig&&!e.hiddenOprate?((0,n.openBlock)(),(0,n.createElementBlock)("div",aT,[cT,(0,n.createVNode)(v,{class:"width-full type"},{field:(0,n.withCtx)((()=>[(0,n.createVNode)(m,{modelValue:e.callConfig.loginType,"onUpdate:modelValue":t[35]||(t[35]=t=>e.callConfig.loginType=t),"popper-append-to-body":!0,class:"width-full","popper-class":"accept-select",onChange:e.changeType},{default:(0,n.withCtx)((()=>[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(e.loginTypeList,(e=>((0,n.openBlock)(),(0,n.createBlock)(g,{key:e.value,value:e.value,label:e.label},null,8,["value","label"])))),128))])),_:1},8,["modelValue","onChange"])])),default:(0,n.withCtx)((()=>[lT])),_:1}),"WEBRTC"===e.callConfig.loginType?((0,n.openBlock)(),(0,n.createBlock)(y,{key:0,modelValue:e.callConfig.autoAnswer,"onUpdate:modelValue":t[36]||(t[36]=t=>e.callConfig.autoAnswer=t)},{default:(0,n.withCtx)((()=>[uT])),_:1},8,["modelValue"])):(0,n.createCommentVNode)("",!0),e.callConfig.autoAnswer&&"WEBRTC"===e.callConfig.loginType?((0,n.openBlock)(),(0,n.createElementBlock)("div",dT,[pT,(0,n.createVNode)(w,{suffix:"秒"},{default:(0,n.withCtx)((()=>[(0,n.withDirectives)((0,n.createVNode)(b,{style:{width:"120px"},controls:!1,modelValue:e.callConfig.autoAnswerTime,"onUpdate:modelValue":t[37]||(t[37]=t=>e.callConfig.autoAnswerTime=t),min:0,"controls-position":"right",size:"middle"},null,8,["modelValue"]),[[T]])])),_:1}),hT])):(0,n.createCommentVNode)("",!0),"SIP"===e.callConfig.loginType?((0,n.openBlock)(),(0,n.createBlock)(v,{key:2,class:"width-full type"},{field:(0,n.withCtx)((()=>[(0,n.createVNode)(m,{placeholder:"请选择sip号",modelValue:e.callConfig.sipNumber,"onUpdate:modelValue":t[38]||(t[38]=t=>e.callConfig.sipNumber=t),clearable:"",class:"width-full","popper-append-to-body":!1},{default:(0,n.withCtx)((()=>[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(e.sipNumberList,(e=>((0,n.openBlock)(),(0,n.createBlock)(g,{key:e.id,value:e.number,label:e.number},null,8,["value","label"])))),128))])),_:1},8,["modelValue"])])),default:(0,n.withCtx)((()=>[fT])),_:1})):(0,n.createCommentVNode)("",!0),(0,n.createElementVNode)("div",gT,[(0,n.createVNode)(S,{class:"cancel",onClick:(0,n.withModifiers)(e.setBack,["stop"])},{default:(0,n.withCtx)((()=>[mT])),_:1},8,["onClick"]),(0,n.createVNode)(S,{type:"primary",onClick:(0,n.withModifiers)(e.updateLoginType,["stop"])},{default:(0,n.withCtx)((()=>[vT])),_:1},8,["onClick"])])])):(0,n.createCommentVNode)("",!0)],2)),[[C,{top:150,left:90}]])])}function bT(e,t,r,o,i,s){return(0,n.openBlock)(),(0,n.createElementBlock)("span",null,(0,n.toDisplayString)(e.timing),1)}var wT=(0,n.defineComponent)({name:"phoneBarTimes",components:{},setup(){const e=(0,n.reactive)({phoneBarTimer:"",timing:"00:00:00",currentTime:0});(0,n.onBeforeUnmount)((()=>{t.clearPhonebarTimer()}));const t=(0,n.reactive)({timerTypeChange(n){e.currentTime=parseInt(n.statusTime,10)||0,"timing"===n.timeType?t.timingInterval():"countDown"===n.timeType&&t.countDownInterval()},timingInterval(){null!==e.phoneBarTimer&&(window.clearInterval(e.phoneBarTimer),e.phoneBarTimer=window.setInterval((()=>{e.timing=t.ctiUiGetTimer(e.currentTime),e.currentTime=e.currentTime-0+1}),1e3))},countDownInterval(){let n=30;n=parseInt(n,10)-e.currentTime||0,n<1||(null!==e.phoneBarTimer&&window.clearInterval(e.phoneBarTimer),e.phoneBarTimer=window.setInterval((()=>{n--,n<=1&&(e.currentTime=0),e.timing=t.ctiUiAutoBusyTime(n)}),1e3))},ctiUiGetTimer(e){let t,n;e=1+parseInt(e,10),n=e/3600,n=parseInt(n,10),t=e%3600/60,t=parseInt(t,10);const r=e%3600%60;let o=n<10?"0"+n:n;return o+=":",o+=t<10?"0"+t:t,o+=":",o+=r<10?"0"+r:r,o},ctiUiAutoBusyTime(e){let t,n,r;e>=3600?(r=e/3600,r=parseInt(r,10),t=(e-3600*r)/60,t=parseInt(t,10),n=e-3600*r-60*t):e>=60&&e<3600?(r="0",t=e/60,t=parseInt(t,10),n=e-60*t):e>0&&e<60?(r="0",t="0",n=e):e<=0&&(r="0",t="0",n="0"),r<0&&(r=0),t<0&&(t=0),n<0&&(n=0);const o=(r<10?"0"+r:r)+":"+(t<10?"0"+t:t)+":"+(n<10?"0"+n:n);return o},clearPhonebarTimer(){window.clearInterval(e.phoneBarTimer)}});return{...(0,n.toRefs)(e),...(0,n.toRefs)(t)}}}),ST=__webpack_require__(769);const TT=(0,ST.Z)(wT,[["render",bT]]);var CT=TT;const ET={class:"border-form-item"},kT={class:"label"};function xT(e,t){return(0,n.openBlock)(),(0,n.createElementBlock)("div",ET,[(0,n.createElementVNode)("span",kT,[(0,n.renderSlot)(e.$slots,"default",{},void 0,!0)]),(0,n.renderSlot)(e.$slots,"field",{},void 0,!0)])}const IT={},RT=(0,ST.Z)(IT,[["render",xT],["__scopeId","data-v-7ac60f29"]]);var _T=RT;const NT={mounted(e,t){const n=t&&t.value&&t.value.left?t.value.left:0,r=t&&t.value&&t.value.top?t.value.top:0;e.style.top=`${r}px`,e.style.left=`${n}px`;const o=e,i=t.modifiers?.boundary??!1,s=(t.value,"false"!==e.getAttribute("dht-move-x")),a="false"!==e.getAttribute("dht-move-y");o.style.position="fixed";const c=o.parentNode,l=c.offsetWidth,u=c.offsetHeight,d=o.offsetWidth,p=2*o.offsetHeight,h=l-d+o.offsetLeft,f=u-p+o.offsetHeight,g=0,m=0;o.onmousedown=e=>{e.preventDefault(),o.style.cursor="move";const t=e.x-o.offsetLeft,n=e.y-o.offsetTop;document.onmousemove=e=>{let r=e.clientX-t,c=e.clientY-n,l=0,u=0;i&&(r=r>h?h:r<g?g:r,c=c>f?f:c<m?m:c,l=Number((r/h*100).toFixed(2)),u=Number((c/f*100).toFixed(2))),s&&(r<=0&&(r=0),o.style.left=r+"px"),a&&(c<=0&&(c=0),o.style.top=c+"px"),a&&(o.style.top=c+"px")},document.onmouseup=e=>{document.onmousemove=null,document.onmouseup=null,o.style.cursor="default"}}}};var AT=NT;const OT=e=>{let t;if("object"===typeof e)if(null===e)t=null;else if(e instanceof Date)t=e;else if(e instanceof Array){t=[];for(let n=0,r=e.length;n<r;n++)t.push(OT(e[n]))}else{t={};for(const n in e)t[n]=OT(e[n])}else t=e;return t},PT=Dn({value:{type:[String,Number],default:""},max:{type:Number,default:99},isDot:Boolean,hidden:Boolean,type:{type:String,values:["primary","success","warning","info","danger"],default:"danger"}}),DT=["textContent"],BT=(0,n.defineComponent)({name:"ElBadge"}),jT=(0,n.defineComponent)({...BT,props:PT,setup(e,{expose:t}){const r=e,o=l("badge"),i=(0,n.computed)((()=>r.isDot?"":yn(r.value)&&yn(r.max)&&r.max<r.value?`${r.max}+`:`${r.value}`));return t({content:i}),(e,t)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{class:(0,n.normalizeClass)((0,n.unref)(o).b())},[(0,n.renderSlot)(e.$slots,"default"),(0,n.createVNode)(n.Transition,{name:`${(0,n.unref)(o).namespace.value}-zoom-in-center`,persisted:""},{default:(0,n.withCtx)((()=>[(0,n.withDirectives)((0,n.createElementVNode)("sup",{class:(0,n.normalizeClass)([(0,n.unref)(o).e("content"),(0,n.unref)(o).em("content",e.type),(0,n.unref)(o).is("fixed",!!e.$slots.default),(0,n.unref)(o).is("dot",e.isDot)]),textContent:(0,n.toDisplayString)((0,n.unref)(i))},null,10,DT),[[n.vShow,!e.hidden&&((0,n.unref)(i)||e.isDot)]])])),_:1},8,["name"])],2))}});var HT=tr(jT,[["__file","/home/runner/work/element-plus/element-plus/packages/components/badge/src/badge.vue"]]);const MT=Yn(HT),LT=["success","info","warning","error"],qT=ma({customClass:"",center:!1,dangerouslyUseHTMLString:!1,duration:3e3,icon:void 0,id:"",message:"",onClose:void 0,showClose:!1,type:"info",offset:16,zIndex:0,grouping:!1,repeatNum:1,appendTo:xr?document.body:void 0}),$T=Dn({customClass:{type:String,default:qT.customClass},center:{type:Boolean,default:qT.center},dangerouslyUseHTMLString:{type:Boolean,default:qT.dangerouslyUseHTMLString},duration:{type:Number,default:qT.duration},icon:{type:Ui,default:qT.icon},id:{type:String,default:qT.id},message:{type:An([String,Object,Function]),default:qT.message},onClose:{type:An(Function),required:!1},showClose:{type:Boolean,default:qT.showClose},type:{type:String,values:LT,default:qT.type},offset:{type:Number,default:qT.offset},zIndex:{type:Number,default:qT.zIndex},grouping:{type:Boolean,default:qT.grouping},repeatNum:{type:Number,default:qT.repeatNum}}),VT={destroy:()=>!0},FT=(0,n.shallowReactive)([]),UT=e=>{const t=FT.findIndex((t=>t.id===e)),n=FT[t];let r;return t>0&&(r=FT[t-1]),{current:n,prev:r}},zT=e=>{const{prev:t}=UT(e);return t?t.vm.exposed.bottom.value:0},KT=(e,t)=>{const n=FT.findIndex((t=>t.id===e));return n>0?20:t},WT=["id"],GT=["innerHTML"],YT=(0,n.defineComponent)({name:"ElMessage"}),JT=(0,n.defineComponent)({...YT,props:$T,emits:VT,setup(e,{expose:t}){const r=e,{Close:o}=zi,{ns:i,zIndex:s}=Fn("message"),{currentZIndex:a,nextZIndex:c}=s,l=(0,n.ref)(),u=(0,n.ref)(!1),d=(0,n.ref)(0);let p;const h=(0,n.computed)((()=>r.type?"error"===r.type?"danger":r.type:"info")),f=(0,n.computed)((()=>{const e=r.type;return{[i.bm("icon",e)]:e&&Ki[e]}})),g=(0,n.computed)((()=>r.icon||Ki[r.type]||"")),m=(0,n.computed)((()=>zT(r.id))),v=(0,n.computed)((()=>KT(r.id,r.offset)+m.value)),y=(0,n.computed)((()=>d.value+v.value)),b=(0,n.computed)((()=>({top:`${v.value}px`,zIndex:a.value})));function w(){0!==r.duration&&({stop:p}=Dr((()=>{T()}),r.duration))}function S(){null==p||p()}function T(){u.value=!1}function C({code:e}){e===cg.esc&&T()}return(0,n.onMounted)((()=>{w(),c(),u.value=!0})),(0,n.watch)((()=>r.repeatNum),(()=>{S(),w()})),Fs(document,"keydown",C),ea(l,(()=>{d.value=l.value.getBoundingClientRect().height})),t({visible:u,bottom:y,close:T}),(e,t)=>((0,n.openBlock)(),(0,n.createBlock)(n.Transition,{name:(0,n.unref)(i).b("fade"),onBeforeLeave:e.onClose,onAfterLeave:t[0]||(t[0]=t=>e.$emit("destroy")),persisted:""},{default:(0,n.withCtx)((()=>[(0,n.withDirectives)((0,n.createElementVNode)("div",{id:e.id,ref_key:"messageRef",ref:l,class:(0,n.normalizeClass)([(0,n.unref)(i).b(),{[(0,n.unref)(i).m(e.type)]:e.type&&!e.icon},(0,n.unref)(i).is("center",e.center),(0,n.unref)(i).is("closable",e.showClose),e.customClass]),style:(0,n.normalizeStyle)((0,n.unref)(b)),role:"alert",onMouseenter:S,onMouseleave:w},[e.repeatNum>1?((0,n.openBlock)(),(0,n.createBlock)((0,n.unref)(MT),{key:0,value:e.repeatNum,type:(0,n.unref)(h),class:(0,n.normalizeClass)((0,n.unref)(i).e("badge"))},null,8,["value","type","class"])):(0,n.createCommentVNode)("v-if",!0),(0,n.unref)(g)?((0,n.openBlock)(),(0,n.createBlock)((0,n.unref)(ur),{key:1,class:(0,n.normalizeClass)([(0,n.unref)(i).e("icon"),(0,n.unref)(f)])},{default:(0,n.withCtx)((()=>[((0,n.openBlock)(),(0,n.createBlock)((0,n.resolveDynamicComponent)((0,n.unref)(g))))])),_:1},8,["class"])):(0,n.createCommentVNode)("v-if",!0),(0,n.renderSlot)(e.$slots,"default",{},(()=>[e.dangerouslyUseHTMLString?((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:1},[(0,n.createCommentVNode)(" Caution here, message could've been compromised, never use user's input as message "),(0,n.createElementVNode)("p",{class:(0,n.normalizeClass)((0,n.unref)(i).e("content")),innerHTML:e.message},null,10,GT)],2112)):((0,n.openBlock)(),(0,n.createElementBlock)("p",{key:0,class:(0,n.normalizeClass)((0,n.unref)(i).e("content"))},(0,n.toDisplayString)(e.message),3))])),e.showClose?((0,n.openBlock)(),(0,n.createBlock)((0,n.unref)(ur),{key:2,class:(0,n.normalizeClass)((0,n.unref)(i).e("closeBtn")),onClick:(0,n.withModifiers)(T,["stop"])},{default:(0,n.withCtx)((()=>[(0,n.createVNode)((0,n.unref)(o))])),_:1},8,["class","onClick"])):(0,n.createCommentVNode)("v-if",!0)],46,WT),[[n.vShow,u.value]])])),_:3},8,["name","onBeforeLeave"]))}});var ZT=tr(JT,[["__file","/home/runner/work/element-plus/element-plus/packages/components/message/src/message.vue"]]);let XT=1;const QT=e=>{const t=!e||an(e)||(0,n.isVNode)(e)||sn(e)?{message:e}:e,r={...qT,...t};if(r.appendTo){if(an(r.appendTo)){let e=document.querySelector(r.appendTo);bn(e)||(In("ElMessage","the appendTo option is not an HTMLElement. Falling back to document.body."),e=document.body),r.appendTo=e}}else r.appendTo=document.body;return r},eC=e=>{const t=FT.indexOf(e);if(-1===t)return;FT.splice(t,1);const{handler:n}=e;n.close()},tC=({appendTo:e,...t},r)=>{const o="message_"+XT++,i=t.onClose,s=document.createElement("div"),a={...t,id:o,onClose:()=>{null==i||i(),eC(d)},onDestroy:()=>{(0,n.render)(null,s)}},c=(0,n.createVNode)(ZT,a,sn(a.message)||(0,n.isVNode)(a.message)?{default:sn(a.message)?a.message:()=>a.message}:null);c.appContext=r||nC._context,(0,n.render)(c,s),e.appendChild(s.firstElementChild);const l=c.component,u={close:()=>{l.exposed.visible.value=!1}},d={id:o,vnode:c,vm:l,handler:u,props:c.component.props};return d},nC=(e={},t)=>{if(!xr)return{close:()=>{}};if(yn(Wn.max)&&FT.length>=Wn.max)return{close:()=>{}};const n=QT(e);if(n.grouping&&FT.length){const e=FT.find((({vnode:e})=>{var t;return(null==(t=e.props)?void 0:t.message)===n.message}));if(e)return e.props.repeatNum+=1,e.props.type=n.type,e.handler}const r=tC(n,t);return FT.push(r),r.handler};function rC(e){for(const t of FT)e&&e!==t.props.type||t.handler.close()}LT.forEach((e=>{nC[e]=(t={},n)=>{const r=QT(t);return nC({...r,type:e},n)}})),nC.closeAll=rC,nC._context=null;const oC=Jn(nC,"$message"),iC=e=>/^\d+(\.\d{1,2})?$/.test(e),sC=e=>/^\d+$/.test(e),aC={onChange(e){const t=e.target,n=+t.value;Number.isInteger(n)||(t.value=Number.parseInt(n))},mounted(e,t){t.input=e.querySelector("input"),t.input?.addEventListener("change",t.dir.onChange)},beforeUnmount(e,t){t.input?.removeEventListener("change",t.dir.onChange)}},cC=Symbol("tabsRootContextKey"),lC=Dn({tabs:{type:An(Array),default:()=>ma([])}}),uC="ElTabBar",dC=(0,n.defineComponent)({name:uC}),pC=(0,n.defineComponent)({...dC,props:lC,setup(e,{expose:t}){const r=e,o=(0,n.getCurrentInstance)(),i=(0,n.inject)(cC);i||xn(uC,"<el-tabs><el-tab-bar /></el-tabs>");const s=l("tabs"),a=(0,n.ref)(),c=(0,n.ref)(),u=()=>{let e=0,t=0;const n=["top","bottom"].includes(i.props.tabPosition)?"width":"height",s="width"===n?"x":"y",a="x"===s?"left":"top";return r.tabs.every((i=>{var s,c;const l=null==(c=null==(s=o.parent)?void 0:s.refs)?void 0:c[`tab-${i.uid}`];if(!l)return!1;if(!i.active)return!0;e=l[`offset${Tv(a)}`],t=l[`client${Tv(n)}`];const u=window.getComputedStyle(l);return"width"===n&&(r.tabs.length>1&&(t-=Number.parseFloat(u.paddingLeft)+Number.parseFloat(u.paddingRight)),e+=Number.parseFloat(u.paddingLeft)),!1})),{[n]:`${t}px`,transform:`translate${Tv(s)}(${e}px)`}},d=()=>c.value=u();return(0,n.watch)((()=>r.tabs),(async()=>{await(0,n.nextTick)(),d()}),{immediate:!0}),ea(a,(()=>d())),t({ref:a,update:d}),(e,t)=>((0,n.openBlock)(),(0,n.createElementBlock)("div",{ref_key:"barRef",ref:a,class:(0,n.normalizeClass)([(0,n.unref)(s).e("active-bar"),(0,n.unref)(s).is((0,n.unref)(i).props.tabPosition)]),style:(0,n.normalizeStyle)(c.value)},null,6))}});var hC=tr(pC,[["__file","/home/runner/work/element-plus/element-plus/packages/components/tabs/src/tab-bar.vue"]]);const fC=Dn({panes:{type:An(Array),default:()=>ma([])},currentName:{type:[String,Number],default:""},editable:Boolean,type:{type:String,values:["card","border-card",""],default:""},stretch:Boolean}),gC={tabClick:(e,t,n)=>n instanceof Event,tabRemove:(e,t)=>t instanceof Event},mC="ElTabNav",vC=(0,n.defineComponent)({name:mC,props:fC,emits:gC,setup(e,{expose:t,emit:r}){const o=(0,n.getCurrentInstance)(),i=(0,n.inject)(cC);i||xn(mC,"<el-tabs><tab-nav /></el-tabs>");const s=l("tabs"),a=Ys(),c=la(),u=(0,n.ref)(),d=(0,n.ref)(),p=(0,n.ref)(),h=(0,n.ref)(),f=(0,n.ref)(!1),g=(0,n.ref)(0),m=(0,n.ref)(!1),v=(0,n.ref)(!0),y=(0,n.computed)((()=>["top","bottom"].includes(i.props.tabPosition)?"width":"height")),b=(0,n.computed)((()=>{const e="width"===y.value?"X":"Y";return{transform:`translate${e}(-${g.value}px)`}})),w=()=>{if(!u.value)return;const e=u.value[`offset${Tv(y.value)}`],t=g.value;if(!t)return;const n=t>e?t-e:0;g.value=n},S=()=>{if(!u.value||!d.value)return;const e=d.value[`offset${Tv(y.value)}`],t=u.value[`offset${Tv(y.value)}`],n=g.value;if(e-n<=t)return;const r=e-n>2*t?n+t:e-t;g.value=r},T=async()=>{const e=d.value;if(!f.value||!p.value||!u.value||!e)return;await(0,n.nextTick)();const t=p.value.querySelector(".is-active");if(!t)return;const r=u.value,o=["top","bottom"].includes(i.props.tabPosition),s=t.getBoundingClientRect(),a=r.getBoundingClientRect(),c=o?e.offsetWidth-a.width:e.offsetHeight-a.height,l=g.value;let h=l;o?(s.left<a.left&&(h=l-(a.left-s.left)),s.right>a.right&&(h=l+s.right-a.right)):(s.top<a.top&&(h=l-(a.top-s.top)),s.bottom>a.bottom&&(h=l+(s.bottom-a.bottom))),h=Math.max(h,0),g.value=Math.min(h,c)},C=()=>{var t;if(!d.value||!u.value)return;e.stretch&&(null==(t=h.value)||t.update());const n=d.value[`offset${Tv(y.value)}`],r=u.value[`offset${Tv(y.value)}`],o=g.value;r<n?(f.value=f.value||{},f.value.prev=o,f.value.next=o+r<n,n-o<r&&(g.value=n-r)):(f.value=!1,o>0&&(g.value=0))},E=e=>{const t=e.code,{up:n,down:r,left:o,right:i}=cg;if(![n,r,o,i].includes(t))return;const s=Array.from(e.currentTarget.querySelectorAll("[role=tab]:not(.is-disabled)")),a=s.indexOf(e.target);let c;c=t===o||t===n?0===a?s.length-1:a-1:a<s.length-1?a+1:0,s[c].focus({preventScroll:!0}),s[c].click(),k()},k=()=>{v.value&&(m.value=!0)},x=()=>m.value=!1;return(0,n.watch)(a,(e=>{"hidden"===e?v.value=!1:"visible"===e&&setTimeout((()=>v.value=!0),50)})),(0,n.watch)(c,(e=>{e?setTimeout((()=>v.value=!0),50):v.value=!1})),ea(p,C),(0,n.onMounted)((()=>setTimeout((()=>T()),0))),(0,n.onUpdated)((()=>C())),t({scrollToActiveTab:T,removeFocus:x}),(0,n.watch)((()=>e.panes),(()=>o.update()),{flush:"post",deep:!0}),()=>{const t=f.value?[(0,n.createVNode)("span",{class:[s.e("nav-prev"),s.is("disabled",!f.value.prev)],onClick:w},[(0,n.createVNode)(ur,null,{default:()=>[(0,n.createVNode)(ro,null,null)]})]),(0,n.createVNode)("span",{class:[s.e("nav-next"),s.is("disabled",!f.value.next)],onClick:S},[(0,n.createVNode)(ur,null,{default:()=>[(0,n.createVNode)(lo,null,null)]})])]:null,o=e.panes.map(((t,o)=>{var a,c,l,u;const d=t.uid,p=t.props.disabled,h=null!=(c=null!=(a=t.props.name)?a:t.index)?c:`${o}`,f=!p&&(t.isClosable||e.editable);t.index=`${o}`;const g=f?(0,n.createVNode)(ur,{class:"is-icon-close",onClick:e=>r("tabRemove",t,e)},{default:()=>[(0,n.createVNode)(Go,null,null)]}):null,v=(null==(u=(l=t.slots).label)?void 0:u.call(l))||t.props.label,y=!p&&t.active?0:-1;return(0,n.createVNode)("div",{ref:`tab-${d}`,class:[s.e("item"),s.is(i.props.tabPosition),s.is("active",t.active),s.is("disabled",p),s.is("closable",f),s.is("focus",m.value)],id:`tab-${h}`,key:`tab-${d}`,"aria-controls":`pane-${h}`,role:"tab","aria-selected":t.active,tabindex:y,onFocus:()=>k(),onBlur:()=>x(),onClick:e=>{x(),r("tabClick",t,h,e)},onKeydown:e=>{!f||e.code!==cg.delete&&e.code!==cg.backspace||r("tabRemove",t,e)}},[v,g])}));return(0,n.createVNode)("div",{ref:p,class:[s.e("nav-wrap"),s.is("scrollable",!!f.value),s.is(i.props.tabPosition)]},[t,(0,n.createVNode)("div",{class:s.e("nav-scroll"),ref:u},[(0,n.createVNode)("div",{class:[s.e("nav"),s.is(i.props.tabPosition),s.is("stretch",e.stretch&&["top","bottom"].includes(i.props.tabPosition))],ref:d,style:b.value,role:"tablist",onKeydown:E},[e.type?null:(0,n.createVNode)(hC,{ref:h,tabs:[...e.panes]},null),o])])])}}});const yC=e=>{const t=on(e)?e:[e],r=[];return t.forEach((e=>{var t;on(e)?r.push(...yC(e)):(0,n.isVNode)(e)&&on(e.children)?r.push(...yC(e.children)):(r.push(e),(0,n.isVNode)(e)&&(null==(t=e.component)?void 0:t.subTree)&&r.push(...yC(e.component.subTree)))})),r},bC=(e,t,r)=>{const o=yC(e.subTree).filter((e=>{var r;return(0,n.isVNode)(e)&&(null==(r=e.type)?void 0:r.name)===t&&!!e.component})),i=o.map((e=>e.component.uid));return i.map((e=>r[e])).filter((e=>!!e))},wC=(e,t)=>{const r={},o=(0,n.shallowRef)([]),i=n=>{r[n.uid]=n,o.value=bC(e,t,r)},s=e=>{delete r[e],o.value=o.value.filter((t=>t.uid!==e))};return{children:o,addChild:i,removeChild:s}},SC=Dn({type:{type:String,values:["card","border-card",""],default:""},activeName:{type:[String,Number]},closable:Boolean,addable:Boolean,modelValue:{type:[String,Number]},editable:Boolean,tabPosition:{type:String,values:["top","right","bottom","left"],default:"top"},beforeLeave:{type:An(Function),default:()=>!0},stretch:Boolean}),TC=e=>an(e)||yn(e),CC={[va]:e=>TC(e),tabClick:(e,t)=>t instanceof Event,tabChange:e=>TC(e),edit:(e,t)=>["remove","add"].includes(t),tabRemove:e=>TC(e),tabAdd:()=>!0};var EC=(0,n.defineComponent)({name:"ElTabs",props:SC,emits:CC,setup(e,{emit:t,slots:r,expose:o}){var i,s;const a=l("tabs"),{children:c,addChild:u,removeChild:d}=wC((0,n.getCurrentInstance)(),"ElTabPane"),p=(0,n.ref)(),h=(0,n.ref)(null!=(s=null!=(i=e.modelValue)?i:e.activeName)?s:"0"),f=e=>{h.value=e,t(va,e),t("tabChange",e)},g=async t=>{var n,r,o;if(h.value!==t&&!mn(t))try{const i=await(null==(n=e.beforeLeave)?void 0:n.call(e,t,h.value));!1!==i&&(f(t),null==(o=null==(r=p.value)?void 0:r.removeFocus)||o.call(r))}catch(i){}},m=(e,n,r)=>{e.props.disabled||(g(n),t("tabClick",e,r))},v=(e,n)=>{e.props.disabled||mn(e.props.name)||(n.stopPropagation(),t("edit",e.props.name,"remove"),t("tabRemove",e.props.name))},y=()=>{t("edit",void 0,"add"),t("tabAdd")};return pr({from:'"activeName"',replacement:'"model-value" or "v-model"',scope:"ElTabs",version:"2.3.0",ref:"https://element-plus.org/en-US/component/tabs.html#attributes",type:"Attribute"},(0,n.computed)((()=>!!e.activeName))),(0,n.watch)((()=>e.activeName),(e=>g(e))),(0,n.watch)((()=>e.modelValue),(e=>g(e))),(0,n.watch)(h,(async()=>{var e;await(0,n.nextTick)(),null==(e=p.value)||e.scrollToActiveTab()})),(0,n.provide)(cC,{props:e,currentName:h,registerPane:u,unregisterPane:d}),o({currentName:h}),()=>{const t=e.editable||e.addable?(0,n.createVNode)("span",{class:a.e("new-tab"),tabindex:"0",onClick:y,onKeydown:e=>{e.code===cg.enter&&y()}},[(0,n.createVNode)(ur,{class:a.is("icon-plus")},{default:()=>[(0,n.createVNode)(ki,null,null)]})]):null,o=(0,n.createVNode)("div",{class:[a.e("header"),a.is(e.tabPosition)]},[t,(0,n.createVNode)(vC,{ref:p,currentName:h.value,editable:e.editable,type:e.type,panes:c.value,stretch:e.stretch,onTabClick:m,onTabRemove:v},null)]),i=(0,n.createVNode)("div",{class:a.e("content")},[(0,n.renderSlot)(r,"default")]);return(0,n.createVNode)("div",{class:[a.b(),a.m(e.tabPosition),{[a.m("card")]:"card"===e.type,[a.m("border-card")]:"border-card"===e.type}]},[..."bottom"!==e.tabPosition?[o,i]:[i,o]])}}});const kC=Dn({label:{type:String,default:""},name:{type:[String,Number]},closable:Boolean,disabled:Boolean,lazy:Boolean}),xC=["id","aria-hidden","aria-labelledby"],IC="ElTabPane",RC=(0,n.defineComponent)({name:IC}),_C=(0,n.defineComponent)({...RC,props:kC,setup(e){const t=e,r=(0,n.getCurrentInstance)(),o=(0,n.useSlots)(),i=(0,n.inject)(cC);i||xn(IC,"usage: <el-tabs><el-tab-pane /></el-tabs/>");const s=l("tab-pane"),a=(0,n.ref)(),c=(0,n.computed)((()=>t.closable||i.props.closable)),u=kr((()=>{var e;return i.currentName.value===(null!=(e=t.name)?e:a.value)})),d=(0,n.ref)(u.value),p=(0,n.computed)((()=>{var e;return null!=(e=t.name)?e:a.value})),h=kr((()=>!t.lazy||d.value||u.value));(0,n.watch)(u,(e=>{e&&(d.value=!0)}));const f=(0,n.reactive)({uid:r.uid,slots:o,props:t,paneName:p,active:u,index:a,isClosable:c});return(0,n.onMounted)((()=>{i.registerPane(f)})),(0,n.onUnmounted)((()=>{i.unregisterPane(f.uid)})),(e,t)=>(0,n.unref)(h)?(0,n.withDirectives)(((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:0,id:`pane-${(0,n.unref)(p)}`,class:(0,n.normalizeClass)((0,n.unref)(s).b()),role:"tabpanel","aria-hidden":!(0,n.unref)(u),"aria-labelledby":`tab-${(0,n.unref)(p)}`},[(0,n.renderSlot)(e.$slots,"default")],10,xC)),[[n.vShow,(0,n.unref)(u)]]):(0,n.createCommentVNode)("v-if",!0)}});var NC=tr(_C,[["__file","/home/runner/work/element-plus/element-plus/packages/components/tabs/src/tab-pane.vue"]]);const AC=Yn(EC,{TabPane:NC}),OC=Zn(NC),PC="$treeNodeId",DC=function(e,t){t&&!t[PC]&&Object.defineProperty(t,PC,{value:e.id,enumerable:!1,configurable:!1,writable:!1})},BC=function(e,t){return e?t[e]:t[PC]},jC=(e,t,n)=>{const r=e.value.currentNode;n();const o=e.value.currentNode;r!==o&&t("current-change",o?o.data:null,o)},HC=e=>{let t=!0,n=!0,r=!0;for(let o=0,i=e.length;o<i;o++){const i=e[o];(!0!==i.checked||i.indeterminate)&&(t=!1,i.disabled||(r=!1)),(!1!==i.checked||i.indeterminate)&&(n=!1)}return{all:t,none:n,allWithoutDisable:r,half:!t&&!n}},MC=function(e){if(0===e.childNodes.length||e.loading)return;const{all:t,none:n,half:r}=HC(e.childNodes);t?(e.checked=!0,e.indeterminate=!1):r?(e.checked=!1,e.indeterminate=!0):n&&(e.checked=!1,e.indeterminate=!1);const o=e.parent;o&&0!==o.level&&(e.store.checkStrictly||MC(o))},LC=function(e,t){const n=e.store.props,r=e.data||{},o=n[t];if("function"===typeof o)return o(r,e);if("string"===typeof o)return r[o];if("undefined"===typeof o){const e=r[t];return void 0===e?"":e}};let qC=0;class $C{constructor(e){this.id=qC++,this.text=null,this.checked=!1,this.indeterminate=!1,this.data=null,this.expanded=!1,this.parent=null,this.visible=!0,this.isCurrent=!1,this.canFocus=!1;for(const t in e)rn(e,t)&&(this[t]=e[t]);this.level=0,this.loaded=!1,this.childNodes=[],this.loading=!1,this.parent&&(this.level=this.parent.level+1)}initialize(){const e=this.store;if(!e)throw new Error("[Node]store is required!");e.registerNode(this);const t=e.props;if(t&&"undefined"!==typeof t.isLeaf){const e=LC(this,"isLeaf");"boolean"===typeof e&&(this.isLeafByUser=e)}if(!0!==e.lazy&&this.data?(this.setData(this.data),e.defaultExpandAll&&(this.expanded=!0,this.canFocus=!0)):this.level>0&&e.lazy&&e.defaultExpandAll&&this.expand(),Array.isArray(this.data)||DC(this,this.data),!this.data)return;const n=e.defaultExpandedKeys,r=e.key;r&&n&&n.includes(this.key)&&this.expand(null,e.autoExpandParent),r&&void 0!==e.currentNodeKey&&this.key===e.currentNodeKey&&(e.currentNode=this,e.currentNode.isCurrent=!0),e.lazy&&e._initDefaultCheckedNode(this),this.updateLeafState(),!this.parent||1!==this.level&&!0!==this.parent.expanded||(this.canFocus=!0)}setData(e){let t;Array.isArray(e)||DC(this,e),this.data=e,this.childNodes=[],t=0===this.level&&Array.isArray(this.data)?this.data:LC(this,"children")||[];for(let n=0,r=t.length;n<r;n++)this.insertChild({data:t[n]})}get label(){return LC(this,"label")}get key(){const e=this.store.key;return this.data?this.data[e]:null}get disabled(){return LC(this,"disabled")}get nextSibling(){const e=this.parent;if(e){const t=e.childNodes.indexOf(this);if(t>-1)return e.childNodes[t+1]}return null}get previousSibling(){const e=this.parent;if(e){const t=e.childNodes.indexOf(this);if(t>-1)return t>0?e.childNodes[t-1]:null}return null}contains(e,t=!0){return(this.childNodes||[]).some((n=>n===e||t&&n.contains(e)))}remove(){const e=this.parent;e&&e.removeChild(this)}insertChild(e,t,r){if(!e)throw new Error("InsertChild error: child is required.");if(!(e instanceof $C)){if(!r){const n=this.getChildren(!0);n.includes(e.data)||("undefined"===typeof t||t<0?n.push(e.data):n.splice(t,0,e.data))}Object.assign(e,{parent:this,store:this.store}),e=(0,n.reactive)(new $C(e)),e instanceof $C&&e.initialize()}e.level=this.level+1,"undefined"===typeof t||t<0?this.childNodes.push(e):this.childNodes.splice(t,0,e),this.updateLeafState()}insertBefore(e,t){let n;t&&(n=this.childNodes.indexOf(t)),this.insertChild(e,n)}insertAfter(e,t){let n;t&&(n=this.childNodes.indexOf(t),-1!==n&&(n+=1)),this.insertChild(e,n)}removeChild(e){const t=this.getChildren()||[],n=t.indexOf(e.data);n>-1&&t.splice(n,1);const r=this.childNodes.indexOf(e);r>-1&&(this.store&&this.store.deregisterNode(e),e.parent=null,this.childNodes.splice(r,1)),this.updateLeafState()}removeChildByData(e){let t=null;for(let n=0;n<this.childNodes.length;n++)if(this.childNodes[n].data===e){t=this.childNodes[n];break}t&&this.removeChild(t)}expand(e,t){const n=()=>{if(t){let e=this.parent;while(e.level>0)e.expanded=!0,e=e.parent}this.expanded=!0,e&&e(),this.childNodes.forEach((e=>{e.canFocus=!0}))};this.shouldLoadData()?this.loadData((e=>{Array.isArray(e)&&(this.checked?this.setChecked(!0,!0):this.store.checkStrictly||MC(this),n())})):n()}doCreateChildren(e,t={}){e.forEach((e=>{this.insertChild(Object.assign({data:e},t),void 0,!0)}))}collapse(){this.expanded=!1,this.childNodes.forEach((e=>{e.canFocus=!1}))}shouldLoadData(){return!0===this.store.lazy&&this.store.load&&!this.loaded}updateLeafState(){if(!0===this.store.lazy&&!0!==this.loaded&&"undefined"!==typeof this.isLeafByUser)return void(this.isLeaf=this.isLeafByUser);const e=this.childNodes;!this.store.lazy||!0===this.store.lazy&&!0===this.loaded?this.isLeaf=!e||0===e.length:this.isLeaf=!1}setChecked(e,t,n,r){if(this.indeterminate="half"===e,this.checked=!0===e,this.store.checkStrictly)return;if(!this.shouldLoadData()||this.store.checkDescendants){const{all:n,allWithoutDisable:o}=HC(this.childNodes);this.isLeaf||n||!o||(this.checked=!1,e=!1);const i=()=>{if(t){const n=this.childNodes;for(let s=0,a=n.length;s<a;s++){const o=n[s];r=r||!1!==e;const i=o.disabled?o.checked:r;o.setChecked(i,t,!0,r)}const{half:o,all:i}=HC(n);i||(this.checked=i,this.indeterminate=o)}};if(this.shouldLoadData())return void this.loadData((()=>{i(),MC(this)}),{checked:!1!==e});i()}const o=this.parent;o&&0!==o.level&&(n||MC(o))}getChildren(e=!1){if(0===this.level)return this.data;const t=this.data;if(!t)return null;const n=this.store.props;let r="children";return n&&(r=n.children||"children"),void 0===t[r]&&(t[r]=null),e&&!t[r]&&(t[r]=[]),t[r]}updateChildren(){const e=this.getChildren()||[],t=this.childNodes.map((e=>e.data)),n={},r=[];e.forEach(((e,o)=>{const i=e[PC],s=!!i&&t.findIndex((e=>e[PC]===i))>=0;s?n[i]={index:o,data:e}:r.push({index:o,data:e})})),this.store.lazy||t.forEach((e=>{n[e[PC]]||this.removeChildByData(e)})),r.forEach((({index:e,data:t})=>{this.insertChild({data:t},e)})),this.updateLeafState()}loadData(e,t={}){if(!0!==this.store.lazy||!this.store.load||this.loaded||this.loading&&!Object.keys(t).length)e&&e.call(this);else{this.loading=!0;const n=n=>{this.childNodes=[],this.doCreateChildren(n,t),this.loaded=!0,this.loading=!1,this.updateLeafState(),e&&e.call(this,n)};this.store.load(this,n)}}}class VC{constructor(e){this.currentNode=null,this.currentNodeKey=null;for(const t in e)rn(e,t)&&(this[t]=e[t]);this.nodesMap={}}initialize(){if(this.root=new $C({data:this.data,store:this}),this.root.initialize(),this.lazy&&this.load){const e=this.load;e(this.root,(e=>{this.root.doCreateChildren(e),this._initDefaultCheckedNodes()}))}else this._initDefaultCheckedNodes()}filter(e){const t=this.filterNodeMethod,n=this.lazy,r=function(o){const i=o.root?o.root.childNodes:o.childNodes;if(i.forEach((n=>{n.visible=t.call(n,e,n.data,n),r(n)})),!o.visible&&i.length){let e=!0;e=!i.some((e=>e.visible)),o.root?o.root.visible=!1===e:o.visible=!1===e}e&&(!o.visible||o.isLeaf||n||o.expand())};r(this)}setData(e){const t=e!==this.root.data;t?(this.root.setData(e),this._initDefaultCheckedNodes()):this.root.updateChildren()}getNode(e){if(e instanceof $C)return e;const t=cn(e)?BC(this.key,e):e;return this.nodesMap[t]||null}insertBefore(e,t){const n=this.getNode(t);n.parent.insertBefore({data:e},n)}insertAfter(e,t){const n=this.getNode(t);n.parent.insertAfter({data:e},n)}remove(e){const t=this.getNode(e);t&&t.parent&&(t===this.currentNode&&(this.currentNode=null),t.parent.removeChild(t))}append(e,t){const n=t?this.getNode(t):this.root;n&&n.insertChild({data:e})}_initDefaultCheckedNodes(){const e=this.defaultCheckedKeys||[],t=this.nodesMap;e.forEach((e=>{const n=t[e];n&&n.setChecked(!0,!this.checkStrictly)}))}_initDefaultCheckedNode(e){const t=this.defaultCheckedKeys||[];t.includes(e.key)&&e.setChecked(!0,!this.checkStrictly)}setDefaultCheckedKey(e){e!==this.defaultCheckedKeys&&(this.defaultCheckedKeys=e,this._initDefaultCheckedNodes())}registerNode(e){const t=this.key;if(e&&e.data)if(t){const t=e.key;void 0!==t&&(this.nodesMap[e.key]=e)}else this.nodesMap[e.id]=e}deregisterNode(e){const t=this.key;t&&e&&e.data&&(e.childNodes.forEach((e=>{this.deregisterNode(e)})),delete this.nodesMap[e.key])}getCheckedNodes(e=!1,t=!1){const n=[],r=function(o){const i=o.root?o.root.childNodes:o.childNodes;i.forEach((o=>{(o.checked||t&&o.indeterminate)&&(!e||e&&o.isLeaf)&&n.push(o.data),r(o)}))};return r(this),n}getCheckedKeys(e=!1){return this.getCheckedNodes(e).map((e=>(e||{})[this.key]))}getHalfCheckedNodes(){const e=[],t=function(n){const r=n.root?n.root.childNodes:n.childNodes;r.forEach((n=>{n.indeterminate&&e.push(n.data),t(n)}))};return t(this),e}getHalfCheckedKeys(){return this.getHalfCheckedNodes().map((e=>(e||{})[this.key]))}_getAllNodes(){const e=[],t=this.nodesMap;for(const n in t)rn(t,n)&&e.push(t[n]);return e}updateChildren(e,t){const n=this.nodesMap[e];if(!n)return;const r=n.childNodes;for(let o=r.length-1;o>=0;o--){const e=r[o];this.remove(e.data)}for(let o=0,i=t.length;o<i;o++){const e=t[o];this.append(e,n.data)}}_setCheckedKeys(e,t=!1,n){const r=this._getAllNodes().sort(((e,t)=>t.level-e.level)),o=Object.create(null),i=Object.keys(n);r.forEach((e=>e.setChecked(!1,!1)));for(let s=0,a=r.length;s<a;s++){const n=r[s],a=n.data[e].toString(),c=i.includes(a);if(!c){n.checked&&!o[a]&&n.setChecked(!1,!1);continue}let l=n.parent;while(l&&l.level>0)o[l.data[e]]=!0,l=l.parent;if(n.isLeaf||this.checkStrictly)n.setChecked(!0,!1);else if(n.setChecked(!0,!0),t){n.setChecked(!1,!1);const e=function(t){const n=t.childNodes;n.forEach((t=>{t.isLeaf||t.setChecked(!1,!1),e(t)}))};e(n)}}}setCheckedNodes(e,t=!1){const n=this.key,r={};e.forEach((e=>{r[(e||{})[n]]=!0})),this._setCheckedKeys(n,t,r)}setCheckedKeys(e,t=!1){this.defaultCheckedKeys=e;const n=this.key,r={};e.forEach((e=>{r[e]=!0})),this._setCheckedKeys(n,t,r)}setDefaultExpandedKeys(e){e=e||[],this.defaultExpandedKeys=e,e.forEach((e=>{const t=this.getNode(e);t&&t.expand(null,this.autoExpandParent)}))}setChecked(e,t,n){const r=this.getNode(e);r&&r.setChecked(!!t,n)}getCurrentNode(){return this.currentNode}setCurrentNode(e){const t=this.currentNode;t&&(t.isCurrent=!1),this.currentNode=e,this.currentNode.isCurrent=!0}setUserCurrentNode(e,t=!0){const n=e[this.key],r=this.nodesMap[n];this.setCurrentNode(r),t&&this.currentNode.level>1&&this.currentNode.parent.expand(null,!0)}setCurrentNodeKey(e,t=!0){if(null===e||void 0===e)return this.currentNode&&(this.currentNode.isCurrent=!1),void(this.currentNode=null);const n=this.getNode(e);n&&(this.setCurrentNode(n),t&&this.currentNode.level>1&&this.currentNode.parent.expand(null,!0))}}const FC=(0,n.defineComponent)({name:"ElCollapseTransition"}),UC=(0,n.defineComponent)({...FC,setup(e){const t=l("collapse-transition"),r=e=>{e.style.maxHeight="",e.style.overflow=e.dataset.oldOverflow,e.style.paddingTop=e.dataset.oldPaddingTop,e.style.paddingBottom=e.dataset.oldPaddingBottom},o={beforeEnter(e){e.dataset||(e.dataset={}),e.dataset.oldPaddingTop=e.style.paddingTop,e.dataset.oldPaddingBottom=e.style.paddingBottom,e.style.maxHeight=0,e.style.paddingTop=0,e.style.paddingBottom=0},enter(e){e.dataset.oldOverflow=e.style.overflow,0!==e.scrollHeight?e.style.maxHeight=`${e.scrollHeight}px`:e.style.maxHeight=0,e.style.paddingTop=e.dataset.oldPaddingTop,e.style.paddingBottom=e.dataset.oldPaddingBottom,e.style.overflow="hidden"},afterEnter(e){e.style.maxHeight="",e.style.overflow=e.dataset.oldOverflow},enterCancelled(e){r(e)},beforeLeave(e){e.dataset||(e.dataset={}),e.dataset.oldPaddingTop=e.style.paddingTop,e.dataset.oldPaddingBottom=e.style.paddingBottom,e.dataset.oldOverflow=e.style.overflow,e.style.maxHeight=`${e.scrollHeight}px`,e.style.overflow="hidden"},leave(e){0!==e.scrollHeight&&(e.style.maxHeight=0,e.style.paddingTop=0,e.style.paddingBottom=0)},afterLeave(e){r(e)},leaveCancelled(e){r(e)}};return(e,r)=>((0,n.openBlock)(),(0,n.createBlock)(n.Transition,(0,n.mergeProps)({name:(0,n.unref)(t).b()},(0,n.toHandlers)(o)),{default:(0,n.withCtx)((()=>[(0,n.renderSlot)(e.$slots,"default")])),_:3},16,["name"]))}});var zC=tr(UC,[["__file","/home/runner/work/element-plus/element-plus/packages/components/collapse-transition/src/collapse-transition.vue"]]);zC.install=e=>{e.component(zC.name,zC)};const KC=zC,WC=(0,n.defineComponent)({name:"ElTreeNodeContent",props:{node:{type:Object,required:!0},renderContent:Function},setup(e){const t=l("tree"),r=(0,n.inject)("NodeInstance"),o=(0,n.inject)("RootTree");return()=>{const i=e.node,{data:s,store:a}=i;return e.renderContent?e.renderContent(n.h,{_self:r,node:i,data:s,store:a}):o.ctx.slots.default?o.ctx.slots.default({node:i,data:s}):(0,n.h)("span",{class:t.be("node","label")},[i.label])}}});var GC=tr(WC,[["__file","/home/runner/work/element-plus/element-plus/packages/components/tree/src/tree-node-content.vue"]]);function YC(e){const t=(0,n.inject)("TreeNodeMap",null),r={treeNodeExpand:t=>{e.node!==t&&e.node.collapse()},children:[]};return t&&t.children.push(r),(0,n.provide)("TreeNodeMap",r),{broadcastExpanded:t=>{if(e.accordion)for(const e of r.children)e.treeNodeExpand(t)}}}const JC=Symbol("dragEvents");function ZC({props:e,ctx:t,el$:r,dropIndicator$:o,store:i}){const s=l("tree"),a=(0,n.ref)({showDropIndicator:!1,draggingNode:null,dropNode:null,allowDrop:!0,dropType:null}),c=({event:n,treeNode:r})=>{if("function"===typeof e.allowDrag&&!e.allowDrag(r.node))return n.preventDefault(),!1;n.dataTransfer.effectAllowed="move";try{n.dataTransfer.setData("text/plain","")}catch(o){}a.value.draggingNode=r,t.emit("node-drag-start",r.node,n)},u=({event:n,treeNode:i})=>{const c=i,l=a.value.dropNode;l&&l.node.id!==c.node.id&&ir(l.$el,s.is("drop-inner"));const u=a.value.draggingNode;if(!u||!c)return;let d=!0,p=!0,h=!0,f=!0;"function"===typeof e.allowDrop&&(d=e.allowDrop(u.node,c.node,"prev"),f=p=e.allowDrop(u.node,c.node,"inner"),h=e.allowDrop(u.node,c.node,"next")),n.dataTransfer.dropEffect=p||d||h?"move":"none",(d||p||h)&&(null==l?void 0:l.node.id)!==c.node.id&&(l&&t.emit("node-drag-leave",u.node,l.node,n),t.emit("node-drag-enter",u.node,c.node,n)),(d||p||h)&&(a.value.dropNode=c),c.node.nextSibling===u.node&&(h=!1),c.node.previousSibling===u.node&&(d=!1),c.node.contains(u.node,!1)&&(p=!1),(u.node===c.node||u.node.contains(c.node))&&(d=!1,p=!1,h=!1);const g=c.$el.querySelector(`.${s.be("node","content")}`).getBoundingClientRect(),m=r.value.getBoundingClientRect();let v;const y=d?p?.25:h?.45:1:-1,b=h?p?.75:d?.55:0:1;let w=-9999;const S=n.clientY-g.top;v=S<g.height*y?"before":S>g.height*b?"after":p?"inner":"none";const T=c.$el.querySelector(`.${s.be("node","expand-icon")}`).getBoundingClientRect(),C=o.value;"before"===v?w=T.top-m.top:"after"===v&&(w=T.bottom-m.top),C.style.top=`${w}px`,C.style.left=T.right-m.left+"px","inner"===v?or(c.$el,s.is("drop-inner")):ir(c.$el,s.is("drop-inner")),a.value.showDropIndicator="before"===v||"after"===v,a.value.allowDrop=a.value.showDropIndicator||f,a.value.dropType=v,t.emit("node-drag-over",u.node,c.node,n)},d=e=>{const{draggingNode:n,dropType:r,dropNode:o}=a.value;if(e.preventDefault(),e.dataTransfer.dropEffect="move",n&&o){const a={data:n.node.data};"none"!==r&&n.node.remove(),"before"===r?o.node.parent.insertBefore(a,o.node):"after"===r?o.node.parent.insertAfter(a,o.node):"inner"===r&&o.node.insertChild(a),"none"!==r&&i.value.registerNode(a),ir(o.$el,s.is("drop-inner")),t.emit("node-drag-end",n.node,o.node,r,e),"none"!==r&&t.emit("node-drop",n.node,o.node,r,e)}n&&!o&&t.emit("node-drag-end",n.node,null,r,e),a.value.showDropIndicator=!1,a.value.draggingNode=null,a.value.dropNode=null,a.value.allowDrop=!0};return(0,n.provide)(JC,{treeNodeDragStart:c,treeNodeDragOver:u,treeNodeDragEnd:d}),{dragState:a}}const XC=(0,n.defineComponent)({name:"ElTreeNode",components:{ElCollapseTransition:KC,ElCheckbox:Hp,NodeContent:GC,ElIcon:ur,Loading:hi},props:{node:{type:$C,default:()=>({})},props:{type:Object,default:()=>({})},accordion:Boolean,renderContent:Function,renderAfterExpand:Boolean,showCheckbox:{type:Boolean,default:!1}},emits:["node-expand"],setup(e,t){const r=l("tree"),{broadcastExpanded:o}=YC(e),i=(0,n.inject)("RootTree"),s=(0,n.ref)(!1),a=(0,n.ref)(!1),c=(0,n.ref)(null),u=(0,n.ref)(null),d=(0,n.ref)(null),p=(0,n.inject)(JC),h=(0,n.getCurrentInstance)();(0,n.provide)("NodeInstance",h),i||In("Tree","Can not find node's tree."),e.node.expanded&&(s.value=!0,a.value=!0);const f=i.props.props["children"]||"children";(0,n.watch)((()=>{const t=e.node.data[f];return t&&[...t]}),(()=>{e.node.updateChildren()})),(0,n.watch)((()=>e.node.indeterminate),(t=>{v(e.node.checked,t)})),(0,n.watch)((()=>e.node.checked),(t=>{v(t,e.node.indeterminate)})),(0,n.watch)((()=>e.node.expanded),(e=>{(0,n.nextTick)((()=>s.value=e)),e&&(a.value=!0)}));const g=e=>BC(i.props.nodeKey,e.data),m=t=>{const n=e.props.class;if(!n)return{};let r;if(sn(n)){const{data:e}=t;r=n(e,t)}else r=n;return an(r)?{[r]:!0}:r},v=(t,n)=>{c.value===t&&u.value===n||i.ctx.emit("check-change",e.node.data,t,n),c.value=t,u.value=n},y=t=>{jC(i.store,i.ctx.emit,(()=>i.store.value.setCurrentNode(e.node))),i.currentNode.value=e.node,i.props.expandOnClickNode&&w(),i.props.checkOnClickNode&&!e.node.disabled&&S(null,{target:{checked:!e.node.checked}}),i.ctx.emit("node-click",e.node.data,e.node,h,t)},b=t=>{i.instance.vnode.props["onNodeContextmenu"]&&(t.stopPropagation(),t.preventDefault()),i.ctx.emit("node-contextmenu",t,e.node.data,e.node,h)},w=()=>{e.node.isLeaf||(s.value?(i.ctx.emit("node-collapse",e.node.data,e.node,h),e.node.collapse()):(e.node.expand(),t.emit("node-expand",e.node.data,e.node,h)))},S=(t,r)=>{e.node.setChecked(r.target.checked,!i.props.checkStrictly),(0,n.nextTick)((()=>{const t=i.store.value;i.ctx.emit("check",e.node.data,{checkedNodes:t.getCheckedNodes(),checkedKeys:t.getCheckedKeys(),halfCheckedNodes:t.getHalfCheckedNodes(),halfCheckedKeys:t.getHalfCheckedKeys()})}))},T=(e,t,n)=>{o(t),i.ctx.emit("node-expand",e,t,n)},C=t=>{i.props.draggable&&p.treeNodeDragStart({event:t,treeNode:e})},E=t=>{t.preventDefault(),i.props.draggable&&p.treeNodeDragOver({event:t,treeNode:{$el:d.value,node:e.node}})},k=e=>{e.preventDefault()},x=e=>{i.props.draggable&&p.treeNodeDragEnd(e)};return{ns:r,node$:d,tree:i,expanded:s,childNodeRendered:a,oldChecked:c,oldIndeterminate:u,getNodeKey:g,getNodeClass:m,handleSelectChange:v,handleClick:y,handleContextMenu:b,handleExpandIconClick:w,handleCheckChange:S,handleChildNodeExpand:T,handleDragStart:C,handleDragOver:E,handleDrop:k,handleDragEnd:x,CaretRight:To}}}),QC=["aria-expanded","aria-disabled","aria-checked","draggable","data-key"],eE=["aria-expanded"];function tE(e,t,r,o,i,s){const a=(0,n.resolveComponent)("el-icon"),c=(0,n.resolveComponent)("el-checkbox"),l=(0,n.resolveComponent)("loading"),u=(0,n.resolveComponent)("node-content"),d=(0,n.resolveComponent)("el-tree-node"),p=(0,n.resolveComponent)("el-collapse-transition");return(0,n.withDirectives)(((0,n.openBlock)(),(0,n.createElementBlock)("div",{ref:"node$",class:(0,n.normalizeClass)([e.ns.b("node"),e.ns.is("expanded",e.expanded),e.ns.is("current",e.node.isCurrent),e.ns.is("hidden",!e.node.visible),e.ns.is("focusable",!e.node.disabled),e.ns.is("checked",!e.node.disabled&&e.node.checked),e.getNodeClass(e.node)]),role:"treeitem",tabindex:"-1","aria-expanded":e.expanded,"aria-disabled":e.node.disabled,"aria-checked":e.node.checked,draggable:e.tree.props.draggable,"data-key":e.getNodeKey(e.node),onClick:t[1]||(t[1]=(0,n.withModifiers)(((...t)=>e.handleClick&&e.handleClick(...t)),["stop"])),onContextmenu:t[2]||(t[2]=(...t)=>e.handleContextMenu&&e.handleContextMenu(...t)),onDragstart:t[3]||(t[3]=(0,n.withModifiers)(((...t)=>e.handleDragStart&&e.handleDragStart(...t)),["stop"])),onDragover:t[4]||(t[4]=(0,n.withModifiers)(((...t)=>e.handleDragOver&&e.handleDragOver(...t)),["stop"])),onDragend:t[5]||(t[5]=(0,n.withModifiers)(((...t)=>e.handleDragEnd&&e.handleDragEnd(...t)),["stop"])),onDrop:t[6]||(t[6]=(0,n.withModifiers)(((...t)=>e.handleDrop&&e.handleDrop(...t)),["stop"]))},[(0,n.createElementVNode)("div",{class:(0,n.normalizeClass)(e.ns.be("node","content")),style:(0,n.normalizeStyle)({paddingLeft:(e.node.level-1)*e.tree.props.indent+"px"})},[e.tree.props.icon||e.CaretRight?((0,n.openBlock)(),(0,n.createBlock)(a,{key:0,class:(0,n.normalizeClass)([e.ns.be("node","expand-icon"),e.ns.is("leaf",e.node.isLeaf),{expanded:!e.node.isLeaf&&e.expanded}]),onClick:(0,n.withModifiers)(e.handleExpandIconClick,["stop"])},{default:(0,n.withCtx)((()=>[((0,n.openBlock)(),(0,n.createBlock)((0,n.resolveDynamicComponent)(e.tree.props.icon||e.CaretRight)))])),_:1},8,["class","onClick"])):(0,n.createCommentVNode)("v-if",!0),e.showCheckbox?((0,n.openBlock)(),(0,n.createBlock)(c,{key:1,"model-value":e.node.checked,indeterminate:e.node.indeterminate,disabled:!!e.node.disabled,onClick:t[0]||(t[0]=(0,n.withModifiers)((()=>{}),["stop"])),onChange:e.handleCheckChange},null,8,["model-value","indeterminate","disabled","onChange"])):(0,n.createCommentVNode)("v-if",!0),e.node.loading?((0,n.openBlock)(),(0,n.createBlock)(a,{key:2,class:(0,n.normalizeClass)([e.ns.be("node","loading-icon"),e.ns.is("loading")])},{default:(0,n.withCtx)((()=>[(0,n.createVNode)(l)])),_:1},8,["class"])):(0,n.createCommentVNode)("v-if",!0),(0,n.createVNode)(u,{node:e.node,"render-content":e.renderContent},null,8,["node","render-content"])],6),(0,n.createVNode)(p,null,{default:(0,n.withCtx)((()=>[!e.renderAfterExpand||e.childNodeRendered?(0,n.withDirectives)(((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:0,class:(0,n.normalizeClass)(e.ns.be("node","children")),role:"group","aria-expanded":e.expanded},[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(e.node.childNodes,(t=>((0,n.openBlock)(),(0,n.createBlock)(d,{key:e.getNodeKey(t),"render-content":e.renderContent,"render-after-expand":e.renderAfterExpand,"show-checkbox":e.showCheckbox,node:t,accordion:e.accordion,props:e.props,onNodeExpand:e.handleChildNodeExpand},null,8,["render-content","render-after-expand","show-checkbox","node","accordion","props","onNodeExpand"])))),128))],10,eE)),[[n.vShow,e.expanded]]):(0,n.createCommentVNode)("v-if",!0)])),_:1})],42,QC)),[[n.vShow,e.node.visible]])}var nE=tr(XC,[["render",tE],["__file","/home/runner/work/element-plus/element-plus/packages/components/tree/src/tree-node.vue"]]);function rE({el$:e},t){const r=l("tree"),o=(0,n.shallowRef)([]),i=(0,n.shallowRef)([]);(0,n.onMounted)((()=>{a()})),(0,n.onUpdated)((()=>{o.value=Array.from(e.value.querySelectorAll("[role=treeitem]")),i.value=Array.from(e.value.querySelectorAll("input[type=checkbox]"))})),(0,n.watch)(i,(e=>{e.forEach((e=>{e.setAttribute("tabindex","-1")}))}));const s=n=>{const i=n.target;if(!i.className.includes(r.b("node")))return;const s=n.code;o.value=Array.from(e.value.querySelectorAll(`.${r.is("focusable")}[role=treeitem]`));const a=o.value.indexOf(i);let c;if([cg.up,cg.down].includes(s)){if(n.preventDefault(),s===cg.up){c=-1===a?0:0!==a?a-1:o.value.length-1;const e=c;while(1){if(t.value.getNode(o.value[c].dataset.key).canFocus)break;if(c--,c===e){c=-1;break}c<0&&(c=o.value.length-1)}}else{c=-1===a?0:a<o.value.length-1?a+1:0;const e=c;while(1){if(t.value.getNode(o.value[c].dataset.key).canFocus)break;if(c++,c===e){c=-1;break}c>=o.value.length&&(c=0)}}-1!==c&&o.value[c].focus()}[cg.left,cg.right].includes(s)&&(n.preventDefault(),i.click());const l=i.querySelector('[type="checkbox"]');[cg.enter,cg.space].includes(s)&&l&&(n.preventDefault(),l.click())};Fs(e,"keydown",s);const a=()=>{var t;o.value=Array.from(e.value.querySelectorAll(`.${r.is("focusable")}[role=treeitem]`)),i.value=Array.from(e.value.querySelectorAll("input[type=checkbox]"));const n=e.value.querySelectorAll(`.${r.is("checked")}[role=treeitem]`);n.length?n[0].setAttribute("tabindex","0"):null==(t=o.value[0])||t.setAttribute("tabindex","0")}}const oE=(0,n.defineComponent)({name:"ElTree",components:{ElTreeNode:nE},props:{data:{type:Array,default:()=>[]},emptyText:{type:String},renderAfterExpand:{type:Boolean,default:!0},nodeKey:String,checkStrictly:Boolean,defaultExpandAll:Boolean,expandOnClickNode:{type:Boolean,default:!0},checkOnClickNode:Boolean,checkDescendants:{type:Boolean,default:!1},autoExpandParent:{type:Boolean,default:!0},defaultCheckedKeys:Array,defaultExpandedKeys:Array,currentNodeKey:[String,Number],renderContent:Function,showCheckbox:{type:Boolean,default:!1},draggable:{type:Boolean,default:!1},allowDrag:Function,allowDrop:Function,props:{type:Object,default:()=>({children:"children",label:"label",disabled:"disabled"})},lazy:{type:Boolean,default:!1},highlightCurrent:Boolean,load:Function,filterNodeMethod:Function,accordion:Boolean,indent:{type:Number,default:18},icon:{type:Ui}},emits:["check-change","current-change","node-click","node-contextmenu","node-collapse","node-expand","check","node-drag-start","node-drag-end","node-drop","node-drag-leave","node-drag-enter","node-drag-over"],setup(e,t){const{t:r}=en(),o=l("tree"),i=(0,n.ref)(new VC({key:e.nodeKey,data:e.data,lazy:e.lazy,props:e.props,load:e.load,currentNodeKey:e.currentNodeKey,checkStrictly:e.checkStrictly,checkDescendants:e.checkDescendants,defaultCheckedKeys:e.defaultCheckedKeys,defaultExpandedKeys:e.defaultExpandedKeys,autoExpandParent:e.autoExpandParent,defaultExpandAll:e.defaultExpandAll,filterNodeMethod:e.filterNodeMethod}));i.value.initialize();const s=(0,n.ref)(i.value.root),a=(0,n.ref)(null),c=(0,n.ref)(null),u=(0,n.ref)(null),{broadcastExpanded:d}=YC(e),{dragState:p}=ZC({props:e,ctx:t,el$:c,dropIndicator$:u,store:i});rE({el$:c},i);const h=(0,n.computed)((()=>{const{childNodes:e}=s.value;return!e||0===e.length||e.every((({visible:e})=>!e))}));(0,n.watch)((()=>e.currentNodeKey),(e=>{i.value.setCurrentNodeKey(e)})),(0,n.watch)((()=>e.defaultCheckedKeys),(e=>{i.value.setDefaultCheckedKey(e)})),(0,n.watch)((()=>e.defaultExpandedKeys),(e=>{i.value.setDefaultExpandedKeys(e)})),(0,n.watch)((()=>e.data),(e=>{i.value.setData(e)}),{deep:!0}),(0,n.watch)((()=>e.checkStrictly),(e=>{i.value.checkStrictly=e}));const f=t=>{if(!e.filterNodeMethod)throw new Error("[Tree] filterNodeMethod is required when filter");i.value.filter(t)},g=t=>BC(e.nodeKey,t.data),m=t=>{if(!e.nodeKey)throw new Error("[Tree] nodeKey is required in getNodePath");const n=i.value.getNode(t);if(!n)return[];const r=[n.data];let o=n.parent;while(o&&o!==s.value)r.push(o.data),o=o.parent;return r.reverse()},v=(e,t)=>i.value.getCheckedNodes(e,t),y=e=>i.value.getCheckedKeys(e),b=()=>{const e=i.value.getCurrentNode();return e?e.data:null},w=()=>{if(!e.nodeKey)throw new Error("[Tree] nodeKey is required in getCurrentKey");const t=b();return t?t[e.nodeKey]:null},S=(t,n)=>{if(!e.nodeKey)throw new Error("[Tree] nodeKey is required in setCheckedNodes");i.value.setCheckedNodes(t,n)},T=(t,n)=>{if(!e.nodeKey)throw new Error("[Tree] nodeKey is required in setCheckedKeys");i.value.setCheckedKeys(t,n)},C=(e,t,n)=>{i.value.setChecked(e,t,n)},E=()=>i.value.getHalfCheckedNodes(),k=()=>i.value.getHalfCheckedKeys(),x=(n,r=!0)=>{if(!e.nodeKey)throw new Error("[Tree] nodeKey is required in setCurrentNode");jC(i,t.emit,(()=>i.value.setUserCurrentNode(n,r)))},I=(n,r=!0)=>{if(!e.nodeKey)throw new Error("[Tree] nodeKey is required in setCurrentKey");jC(i,t.emit,(()=>i.value.setCurrentNodeKey(n,r)))},R=e=>i.value.getNode(e),_=e=>{i.value.remove(e)},N=(e,t)=>{i.value.append(e,t)},A=(e,t)=>{i.value.insertBefore(e,t)},O=(e,t)=>{i.value.insertAfter(e,t)},P=(e,n,r)=>{d(n),t.emit("node-expand",e,n,r)},D=(t,n)=>{if(!e.nodeKey)throw new Error("[Tree] nodeKey is required in updateKeyChild");i.value.updateChildren(t,n)};return(0,n.provide)("RootTree",{ctx:t,props:e,store:i,root:s,currentNode:a,instance:(0,n.getCurrentInstance)()}),(0,n.provide)(fr,void 0),{ns:o,store:i,root:s,currentNode:a,dragState:p,el$:c,dropIndicator$:u,isEmpty:h,filter:f,getNodeKey:g,getNodePath:m,getCheckedNodes:v,getCheckedKeys:y,getCurrentNode:b,getCurrentKey:w,setCheckedNodes:S,setCheckedKeys:T,setChecked:C,getHalfCheckedNodes:E,getHalfCheckedKeys:k,setCurrentNode:x,setCurrentKey:I,t:r,getNode:R,remove:_,append:N,insertBefore:A,insertAfter:O,handleNodeExpand:P,updateKeyChildren:D}}});function iE(e,t,r,o,i,s){const a=(0,n.resolveComponent)("el-tree-node");return(0,n.openBlock)(),(0,n.createElementBlock)("div",{ref:"el$",class:(0,n.normalizeClass)([e.ns.b(),e.ns.is("dragging",!!e.dragState.draggingNode),e.ns.is("drop-not-allow",!e.dragState.allowDrop),e.ns.is("drop-inner","inner"===e.dragState.dropType),{[e.ns.m("highlight-current")]:e.highlightCurrent}]),role:"tree"},[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(e.root.childNodes,(t=>((0,n.openBlock)(),(0,n.createBlock)(a,{key:e.getNodeKey(t),node:t,props:e.props,accordion:e.accordion,"render-after-expand":e.renderAfterExpand,"show-checkbox":e.showCheckbox,"render-content":e.renderContent,onNodeExpand:e.handleNodeExpand},null,8,["node","props","accordion","render-after-expand","show-checkbox","render-content","onNodeExpand"])))),128)),e.isEmpty?((0,n.openBlock)(),(0,n.createElementBlock)("div",{key:0,class:(0,n.normalizeClass)(e.ns.e("empty-block"))},[(0,n.renderSlot)(e.$slots,"empty",{},(()=>{var t;return[(0,n.createElementVNode)("span",{class:(0,n.normalizeClass)(e.ns.e("empty-text"))},(0,n.toDisplayString)(null!=(t=e.emptyText)?t:e.t("el.tree.emptyText")),3)]}))],2)):(0,n.createCommentVNode)("v-if",!0),(0,n.withDirectives)((0,n.createElementVNode)("div",{ref:"dropIndicator$",class:(0,n.normalizeClass)(e.ns.e("drop-indicator"))},null,2),[[n.vShow,e.dragState.showDropIndicator]])],2)}var sE=tr(oE,[["render",iE],["__file","/home/runner/work/element-plus/element-plus/packages/components/tree/src/tree.vue"]]);sE.install=e=>{e.component(sE.name,sE)};const aE=sE,cE=aE,lE=e=>((0,n.pushScopeId)("data-v-414390b9"),e=e(),(0,n.popScopeId)(),e),uE={class:"transfer-box"},dE={key:0},pE={key:1,class:"idle-agent-box"},hE=["onClick"],fE=lE((()=>(0,n.createElementVNode)("i",{class:"wtue wtue-zhuanjie"},null,-1))),gE=[fE],mE={class:"outline-box"},vE=(0,n.createTextVNode)("转移");function yE(e,t,r,o,i,s){const a=Qy,c=cE,l=Xy,u=OC,d=Da,p=Hs,h=AC;return(0,n.openBlock)(),(0,n.createElementBlock)("div",uE,[(0,n.createVNode)(h,{modelValue:e.activeName,"onUpdate:modelValue":t[3]||(t[3]=t=>e.activeName=t),onTabClick:e.handleClick},{default:(0,n.withCtx)((()=>[(0,n.createVNode)(u,{label:"其他员工",name:"agent"},{default:(0,n.withCtx)((()=>[(0,n.createVNode)(l,{class:"transfer-select","popper-class":"transfer-select",placeholder:"请输入座席工号、姓名、技能组名称查询",onVisibleChange:e.visibleChange,"filter-method":e.dataFilter,filterable:"",modelValue:e.form.id,"onUpdate:modelValue":t[0]||(t[0]=t=>e.form.id=t),ref:"selectTree"},{default:(0,n.withCtx)((()=>[((0,n.openBlock)(),(0,n.createBlock)(a,{key:e.form.id,value:e.form.id,label:e.form.label,hidden:""},null,8,["value","label"])),(0,n.createVNode)(c,{data:e.agentOptions,props:e.props,"node-key":"id",accordion:"",ref:"tree","highlight-current":"","filter-node-method":e.filterNode},{default:(0,n.withCtx)((({data:t})=>[t.freeNumber>=0?((0,n.openBlock)(),(0,n.createElementBlock)("div",dE,[(0,n.createElementVNode)("span",null,(0,n.toDisplayString)(t.label),1),(0,n.createElementVNode)("span",null,"("+(0,n.toDisplayString)(t.freeNumber)+")",1)])):(0,n.createCommentVNode)("",!0),t.agentNumber?((0,n.openBlock)(),(0,n.createElementBlock)("div",pE,[(0,n.createElementVNode)("span",null,(0,n.toDisplayString)(t.label)+" ("+(0,n.toDisplayString)(t.agentNumber)+") ",1),(0,n.createElementVNode)("span",{onClick:n=>e.transferAction(t.agentNumber,"agent")},gE,8,hE)])):(0,n.createCommentVNode)("",!0)])),_:1},8,["data","props","filter-node-method"])])),_:1},8,["onVisibleChange","filter-method","modelValue"])])),_:1}),(0,n.createVNode)(u,{label:"外线电话",name:"outline"},{default:(0,n.withCtx)((()=>[(0,n.createElementVNode)("div",mE,[(0,n.createVNode)(d,{modelValue:e.outlineNumber,"onUpdate:modelValue":t[1]||(t[1]=t=>e.outlineNumber=t),size:"mini",clearable:"",placeholder:"请输入手机或完整的区号电话号码",style:{width:"244px"}},null,8,["modelValue"]),(0,n.createVNode)(p,{type:"primary",size:"default",class:"action-btn",disabled:!e.outlineNumber,onClick:t[2]||(t[2]=(0,n.withModifiers)((t=>e.transferAction(e.outlineNumber,"outline",e.outlineNumber)),["stop"]))},{default:(0,n.withCtx)((()=>[vE])),_:1},8,["disabled"])])])),_:1})])),_:1},8,["modelValue","onTabClick"])])}var bE=(0,n.defineComponent)({name:"transferConsult",components:{},props:{module:{type:String,default:""}},setup(){(0,n.ref)(null);const e=(0,n.reactive)({activeName:"agent",outlineNumber:"",ivrList:[],ivrObj:{name:"",nodeId:""},agentOptions:[],form:{id:"",label:""},props:{children:"children",label:"label"}}),t=(e,t)=>{if("outline"===t&&(!sC(e)||!e))return oC.error("请输入正确的号码"),!1;window.ueSoftphone.call.transfer({type:t,number:e,success:e=>{console.log(e,"success============")}})},r=()=>{window.ueSoftphone.agent.findIdleAgentsForQueue({success:t=>{if(t&&t.success&&t.dataList){const n=[];t.dataList.forEach((e=>{const t={value:e._id,label:e.name,freeNumber:0};let r=0;const o=[];e.members&&e.members.length>0?e.members.forEach((n=>{if("00000"!==n.agentId){const e={value:n.agentId,label:`${n.agentName}[${n.agentNumber}]`,callStatus:n.callStatus,callStatusName:n.callStatusName,agentNumber:n.agentNumber};"0"===n.callStatus?r++:e.disabled=!0,o.push(e)}else 1===e.members.length&&(t.disabled=!0)})):t.disabled=!0,t.freeNumber=r,o.length>0&&(t.children=o),t.freeNumber>0&&n.push(t)})),e.agentOptions=n}}})},o=e=>{window.ueSoftphone.call.transfer({type:"agent",number:e.agentNumber,success:e=>{console.log(e,"success============")}})},i=()=>{(0,n.nextTick)((()=>{console.log("切换")}))},s=e=>{e&&r()};return{...(0,n.toRefs)(e),transferClick:o,fetchQueueOnlineAgents:r,handleClick:i,transferAction:t,visibleChange:s}}});const wE=(0,ST.Z)(bE,[["render",yE],["__scopeId","data-v-414390b9"]]);var SE=wE;const TE=e=>((0,n.pushScopeId)("data-v-1618b142"),e=e(),(0,n.popScopeId)(),e),CE={class:"transfer-box"},EE={key:0},kE={key:1,class:"idle-agent-box"},xE=["onClick"],IE=TE((()=>(0,n.createElementVNode)("i",{class:"wtue wtue-zhuanjie"},null,-1))),RE=[IE],_E={class:"outline-box"},NE=(0,n.createTextVNode)("咨询");function AE(e,t,r,o,i,s){const a=Qy,c=cE,l=Xy,u=OC,d=Da,p=Hs,h=AC;return(0,n.openBlock)(),(0,n.createElementBlock)("div",CE,[(0,n.createVNode)(h,{modelValue:e.activeName,"onUpdate:modelValue":t[3]||(t[3]=t=>e.activeName=t),onTabClick:e.handleClick},{default:(0,n.withCtx)((()=>[(0,n.createVNode)(u,{label:"其他员工",name:"agent"},{default:(0,n.withCtx)((()=>[(0,n.createVNode)(l,{class:"transfer-select","popper-class":"transfer-select",placeholder:"请输入座席工号、姓名、技能组名称查询",onVisibleChange:e.visibleChange,"filter-method":e.dataFilter,filterable:"",modelValue:e.form.id,"onUpdate:modelValue":t[0]||(t[0]=t=>e.form.id=t),ref:"selectTree"},{default:(0,n.withCtx)((()=>[((0,n.openBlock)(),(0,n.createBlock)(a,{key:e.form.id,value:e.form.id,label:e.form.label,hidden:""},null,8,["value","label"])),(0,n.createVNode)(c,{data:e.agentOptions,props:e.props,"node-key":"id",accordion:"",ref:"tree","highlight-current":"","filter-node-method":e.filterNode},{default:(0,n.withCtx)((({data:t})=>[t.freeNumber>=0?((0,n.openBlock)(),(0,n.createElementBlock)("div",EE,[(0,n.createElementVNode)("span",null,(0,n.toDisplayString)(t.label),1),(0,n.createElementVNode)("span",null,"("+(0,n.toDisplayString)(t.freeNumber)+")",1)])):(0,n.createCommentVNode)("",!0),t.agentNumber?((0,n.openBlock)(),(0,n.createElementBlock)("div",kE,[(0,n.createElementVNode)("span",null,(0,n.toDisplayString)(t.label)+" ("+(0,n.toDisplayString)(t.agentNumber)+") ",1),(0,n.createElementVNode)("span",{onClick:n=>e.transferAction(t.agentNumber,"agent")},RE,8,xE)])):(0,n.createCommentVNode)("",!0)])),_:1},8,["data","props","filter-node-method"])])),_:1},8,["onVisibleChange","filter-method","modelValue"])])),_:1}),(0,n.createVNode)(u,{label:"外线电话",name:"outline"},{default:(0,n.withCtx)((()=>[(0,n.createElementVNode)("div",_E,[(0,n.createVNode)(d,{modelValue:e.outlineNumber,"onUpdate:modelValue":t[1]||(t[1]=t=>e.outlineNumber=t),size:"mini",clearable:"",placeholder:"请输入手机或完整的区号电话号码",style:{width:"244px"}},null,8,["modelValue"]),(0,n.createVNode)(p,{type:"primary",size:"default",class:"action-btn",disabled:!e.outlineNumber,onClick:t[2]||(t[2]=(0,n.withModifiers)((t=>e.transferAction(e.outlineNumber,"outline",e.outlineNumber)),["stop"]))},{default:(0,n.withCtx)((()=>[NE])),_:1},8,["disabled"])])])),_:1})])),_:1},8,["modelValue","onTabClick"])])}var OE=(0,n.defineComponent)({name:"transferConsult",components:{},props:{module:{type:String,default:""}},setup(){(0,n.ref)(null);const e=(0,n.reactive)({activeName:"agent",outlineNumber:"",ivrList:[],ivrObj:{name:"",nodeId:""},agentOptions:[],form:{id:"",label:""},props:{children:"children",label:"label"}}),t=(e,t)=>{if("outline"===t&&(!sC(e)||!e))return oC.error("请输入正确的号码"),!1;window.ueSoftphone.call.consult({mode:t,agentNumber:e,fail:e=>{console.log(e,"success============")}})},r=()=>{window.ueSoftphone.agent.findIdleAgentsForQueue({success:t=>{if(t&&t.success&&t.dataList){const n=[];t.dataList.forEach((e=>{const t={value:e._id,label:e.name,freeNumber:0};let r=0;const o=[];e.members&&e.members.length>0?e.members.forEach((n=>{if("00000"!==n.agentId){const e={value:n.agentId,label:`${n.agentName}[${n.agentNumber}]`,callStatus:n.callStatus,callStatusName:n.callStatusName,agentNumber:n.agentNumber};"0"===n.callStatus?r++:e.disabled=!0,o.push(e)}else 1===e.members.length&&(t.disabled=!0)})):t.disabled=!0,t.freeNumber=r,o.length>0&&(t.children=o),t.freeNumber>0&&n.push(t)})),e.agentOptions=n}}})},o=e=>{window.ueSoftphone.call.transfer({type:"agent",number:e.agentNumber,success:e=>{console.log(e,"success============")}})},i=()=>{(0,n.nextTick)((()=>{console.log("切换")}))},s=e=>{e&&r()};return{...(0,n.toRefs)(e),transferClick:o,fetchQueueOnlineAgents:r,handleClick:i,transferAction:t,visibleChange:s}}});const PE=(0,ST.Z)(OE,[["render",AE],["__scopeId","data-v-1618b142"]]);var DE=PE,BE=__webpack_require__(167),jE=__webpack_require__.n(BE),HE=(0,n.defineComponent)({name:"telephoneStrip",components:{phoneBarTimer:CT,formItem:_T,transferOprate:SE,consuleOprate:DE},directives:{move:AT,int:aC},created(){this.initPhone()},setup(){const e=(0,n.ref)(null),t=(0,n.ref)(null),r=(0,n.ref)(null),o=((0,n.ref)(null),(0,n.reactive)({actionModule:"transfer",errorObj:{isError:!1,type:"",message:""},stateType:"free",currentCallType:"",showConfig:!1,callConfig:{autoAnswer:!1,sipNumber:"",autoAnswerTime:"0",mobile:"",loginType:""},showNum:!0,accountConfig:{forbidDialInHangup:!1,forbidDialOutHangup:!1,ringCard:!1},defaultConfig:{},AnswerOffline:!1,sipNumberList:[],dialoutNumber:"",renderMap:{PSTN_INVALID:["dialout"],PSTN_CALLIN_CALLING:["hangup"],PSTN_CALLOUT_CALLING:["hangup"],PSTN_CALLIN_RING:["hangup","animation"],PSTN_CALLOUT_RING:["hangup"],PSTN_TRANSFER_RING:["hangup","animation"],PSTN_CALLIN_LINK:["hangup","hold","mute","transfer","concul","satisfaction"],PSTN_CALLOUT_LINK:["hangup","hold","mute","transfer","concul","satisfaction"],PSTN_TRANSFER_LINK:["hangup","hold","mute","transfer","concul","satisfaction"],PSTN_TRANSFER_ARRANGE:["dialout"],PSTN_CONSULTTRANSFER_LINK:["hangup","hold","mute","transfer","concul","satisfaction"],PSTN_CALLIN_MUTE:["hangup","mutecancel"],PSTN_CALLOUT_MUTE:["hangup","mutecancel"],PSTN_CONSULTTRANSFER_MUTE:["hangup","mutecancel"],PSTN_CALLIN_HOLD:["hangup","holdcancel"],PSTN_CALLOUT_HOLD:["hangup","holdcancel"],PSTN_CONSULTTRANSFER_HOLD:["hangup","holdcancel"],PSTN_CALLIN_ARRANGE:["dialout"],PSTN_CALLOUT_ARRANGE:["dialout"],PSTN_CONSULTTRANSFER_ARRANGE:["dialout"],PSTN_BUSY:["dialout"],PSTN_CALLOUT_BUSY:["dialout"],PSTN_CALLIN_BUSY:["dialout"],PSTN_DISCONNECTED:["showquick"],WAITCONSUL:["hangup","cancelconcul"],CONSULCANCEL:["hangup","concul","takeback"],CONSULPICKUP:["hangup","endconsul","threepartycall","concultransfer"],CONSULING:["hangup"],THREECALL:["hangup"],LISTEN:["hangup"],WHISPER:["hangup"],PSTN_CONSULT_RING:["hangup"],SIP_INVALID:["dialout"],SIP_CALLIN_CALLING:["hangup"],SIP_CALLOUT_CALLING:["hangup"],SIP_CALLIN_RING:["hangup"],SIP_CALLOUT_RING:["hangup"],SIP_TRANSFER_RING:["hangup"],SIP_CALLIN_LINK:["hangup","hold","mute","transfer","concul","satisfaction"],SIP_CALLOUT_LINK:["hangup","hold","mute","transfer","concul","satisfaction"],SIP_TRANSFER_LINK:["hangup","hold","mute","transfer","concul","satisfaction"],SIP_CONSULTTRANSFER_LINK:["hangup","hold","mute","transfer","concul","satisfaction"],SIP_CALLIN_MUTE:["hangup","mutecancel"],SIP_CALLOUT_MUTE:["hangup","mutecancel"],SIP_CONSULTTRANSFER_MUTE:["hangup","mutecancel"],SIP_CALLIN_HOLD:["hangup","holdcancel"],SIP_CALLOUT_HOLD:["hangup","holdcancel"],SIP_CONSULTTRANSFER_HOLD:["hangup","holdcancel"],SIP_CALLIN_ARRANGE:["dialout"],SIP_CALLOUT_ARRANGE:["dialout"],SIP_CONSULTTRANSFER_ARRANGE:["dialout"],SIP_TRANSFER_ARRANGE:["dialout"],SIP_BUSY:["dialout"],SIP_CALLOUT_BUSY:["dialout"],SIP_CALLIN_BUSY:["dialout"],SIP_DISCONNECTED:["showquick"],SIP_CONSULT_RING:["hangup"],WEBRTC_INVALID:["dialout","disconnect"],WEBRTC_CALLIN_CALLING:["hangup"],WEBRTC_CALLOUT_CALLING:["hangup"],WEBRTC_CALLIN_RING:["hangup","answer"],WEBRTC_CALLOUT_RING:["hangup"],WEBRTC_TRANSFER_RING:["hangup","answer","animation"],WEBRTC_CALLIN_LINK:["hangup","hold","mute","key","transfer","concul","satisfaction"],WEBRTC_CALLOUT_LINK:["hangup","hold","mute","key","transfer","concul","satisfaction"],WEBRTC_TRANSFER_LINK:["hangup","hold","mute","transfer","concul","satisfaction","key"],WEBRTC_CONSULTTRANSFER_LINK:["hangup","hold","mute","key","transfer","concul","satisfaction"],WEBRTC_CALLIN_MUTE:["hangup","mutecancel"],WEBRTC_CALLOUT_MUTE:["hangup","mutecancel"],WEBRTC_CONSULTTRANSFER_MUTE:["hangup","mutecancel"],WEBRTC_CALLIN_HOLD:["hangup","holdcancel"],WEBRTC_CALLOUT_HOLD:["hangup","holdcancel"],WEBRTC_CONSULTTRANSFER_HOLD:["hangup","holdcancel"],WEBRTC_CALLIN_ARRANGE:["dialout"],WEBRTC_CALLOUT_ARRANGE:["dialout"],WEBRTC_CONSULTTRANSFER_ARRANGE:["dialout"],WEBRTC_TRANSFER_ARRANGE:["dialout"],WEBRTC_DISCONNECTED:["connect","showquick"],WEBRTC_BUSY:["dialout"],WEBRTC_CALLOUT_BUSY:["dialout"],WEBRTC_CALLIN_BUSY:["dialout"],WEBRTC_CONSULT_RING:["hangup","answer"],TRANSFER_OPRATE:["transferoprate","hangup"],CONSULE_OPRATE:["consuleoprate","hangup"]},currentStatus:"PSTN_INVALID",currentStatusName:"空闲",callingNumber:"",keyList:["1","2","3","4","5","6","7","8","9"],loginType:"",loginTypeMap:{PSTN:"手机模式",SIP:"SIP话机",WEBRTC:"软电话"},loginTypeList:[{value:"PSTN",label:"手机模式"},{value:"SIP",label:"SIP话机"},{value:"WEBRTC",label:"软电话"}],ivrList:[],agentStatusList:[],agentStatusNumber:"",isTransterBtn:!0,isOpenpanel:!1,quickToWhole:!1,showInput:!1,showDial:!0,transferState:!1,consulSelect:!1,webrtcKeyState:!1,callRcentState:!0,quickState:!1,customerInfo:{number:"",name:"",place:"",tag:"",displayNumber:"",active:!1},backStatus:"",switchQuickState(e){o.quickState=e},switchKey(e){o.callRcentState=e},setTransferState(e){e?(o.backStatus=o.currentStatus,o.currentStatus="TRANSFER_OPRATE"):o.currentStatus=o.backStatus},setConsulState(e){e?(o.backStatus=o.currentStatus,o.currentStatus="CONSULE_OPRATE"):o.currentStatus=o.backStatus},setWebrtcKeyState(e){o.webrtcKeyState=e},toAnswerOffline(e){const t=e?"1":"0";window.ueSoftphone.agent.setAnswerOffline({toAnswerOffline:t,success:()=>{console.log({message:"设置成功",type:"success"})},fail:()=>{console.log({message:"设置失败",type:"error"})}})},inputChange(e){/^[0-9*#]*$/.test(e)&&(o.dialoutNumber=e)},initPhone(){let e;e=window&&window.ueSimpleSoftphone&&window.ueSimpleSoftphone.initParams?window.ueSimpleSoftphone.initParams:{accountId:"useasyTest",agentNumber:"8042",password:"Aa123456",loginType:"WEBRTC"};const t=e.loginType||"WEBRTC";window.ueSoftphone=new(jE())({accountId:e.accountId,agentNumber:e.agentNumber,password:e.password,loginType:t,server:e.server||null,error(e){"2005"===e.code?(o.errorObj.isError=!0,o.errorObj.message="当前License数量不足请联系管理员"):e.message&&console.log({message:e.message,type:"error"})},success(e){o.callConfig.loginType=t,o.errorObj.isError=!1,o.getAgentPhoneBarList(),o.getAvailableSipNumberList()}}),window.ueSoftphone.listenCallEvent({success(e){},error(e){e.message&&console.log({message:e.message,type:"error"}),console.error(e)},message:e=>{const t=e.data;if("status"===e.subtype){o.currentStatusName=t.stateName;const e="5"===t.state?"countDown":"timing";t.statusTime?o.timeRecording(e,t.statusTime):o.timeRecording(e)}else"login"===e.subtype&&(o.loginType=t.loginType||"WEBRTC");window.ueSimpleSoftphone&&window.ueSimpleSoftphone.backEventFunction&&window.ueSimpleSoftphone.backEventFunction(t),o.currentStatus=o.getCurrentStatus(t.state,t.callType,t.eventType)}})},setCustomerInfo(e){const t=e.callType||"";e.callEvent;if("calling"===o.stateType||"ring"===o.stateType||"called"===o.stateType){o.customerInfo.displayNumber="dialout"===t?e.displayNumber?"外显号:"+e.displayNumber:"":e.trunkNumber?"服务号:"+e.trunkNumber:"",e.number&&(o.customerInfo.number=e.number,o.customerInfo.name||(o.customerInfo.active||(o.customerInfo.active=!0),console.log("未设置名称")));let n="";"86"===e.customerCountryCode?e.customerProvince&&(n=e.customerProvince+"-"+e.customerCity):e.customerCountry&&(n=e.customerCountry),o.customerInfo.place=n}["calling","called","ring"].includes(o.stateType)||(o.customerInfo={number:"",name:"",place:"",tag:"",displayNumber:"",active:!1}),console.log(e,"")},initPhoneOpenState(){const e=localStorage.getItem("phoneUnfoldState");null===e||"true"===e?o.setUnfoldState(!0):o.setUnfoldState(!1)},setBack(){o.showDial=!0,o.showConfig=!1},goToSetting(){o.showDial=!1,o.showConfig=!0},deleteNum(){if(o.dialoutNumber){const e=o.dialoutNumber.length;o.dialoutNumber=o.dialoutNumber.substring(0,e-1)}},dialout(e,t){t&&(e?window.ueSoftphone&&window.ueSoftphone.call.callout({customerNumber:e,success(e){console.log({message:"外呼成功",type:"success",duration:5e3})},fail(e){oC.error({message:e.message,type:"error"}),console.log({message:e.message,type:"error"})}}):oC.error({message:"请填写外呼号码",type:"error"}))},hangup(){window.ueSoftphone&&window.ueSoftphone.call.hangup({fail(e){console.error(e,"error")}})},holdOrUnHold(e){window.ueSoftphone&&window.ueSoftphone.call.holdOrUnHold({type:e,fail(e){console.error(e,"error")}})},muteOrUnMute(e){window.ueSoftphone&&window.ueSoftphone.call.muteOrUnMute({type:e,fail(e){console.error(e,"error")}})},resumeConsult(){window.ueSoftphone.call.callbackConsult({success:()=>{console.log("取消咨询")}})},consultTransfer(){window.ueSoftphone.call.consultTransfer({success:()=>{console.log("咨询转移成功")}})},threeWayCall(){window.ueSoftphone.call.threeWayCall({success:()=>{console.log("三方通话成功")}})},stopConsult(){window.ueSoftphone.call.cancelconsult({success:()=>{console.log("取消咨询")}})},cancelConsult(){window.ueSoftphone.call.cancelconsult({success:()=>{console.log("取消咨询")}})},satisfaction(){window.ueSoftphone.call.evaluate({type:"SATISFACTION"})},transOrUntrans(){o.isTransterBtn=!o.isTransterBtn},accept(){window.ueSoftphone.webrtc.accept()},sendDTMF(e){o.dialoutNumber+=e,o.isVisibleBtn("key")&&window.ueSoftphone.call.sendDTMF(e)},connect(){window.ueSoftphone=null,o.initPhone()},disconnect(){window.ueSoftphone.call.disconnect()},keyDowndialout(e){13===e.keyCode&&o.dialout(o.dialoutNumber,!1)},updateLoginType(){const{loginType:e,sipNumber:t}=o.callConfig,n={loginType:e};"SIP"===e&&t&&(n.loginNumber=t),window.ueSoftphone.agent.switchLoginType({...n,success:()=>{o.loginType=e,localStorage.setItem("phoneLoginType",e),o.setBack(),o.updateCurrentStatus(),console.log({message:"切换成功",type:"success"})},fail:()=>{console.log({message:"切换失败",type:"error"})}})},getAgentPhoneBarList(){window.ueSoftphone.agent.findPhoneBarList({success:e=>{o.agentStatusList=e.data}})},updateAgentStatus(e){window.ueSoftphone.agent.switchPhoneBar({stateNumber:e})},getAvailableSipNumberList(){window.ueSoftphone.agent.getAvailableSipNumberList({success:e=>{e.success&&(o.sipNumberList=e.data)}})},initUserConfig(e){o.AnswerOffline=!(!e.toAnswerOffline||"1"!==e.toAnswerOffline)},isVisibleBtn(e){if(o.currentStatus){const t=o.renderMap[o.currentStatus]||"";return t&&t.indexOf(e)>-1}},getCurrentStatus(e,t,n){t&&(o.currentCallType=t);const r=t?"_"+t.toUpperCase():"";let i="";switch(o.quickToWhole=!1,e){case"0":i=o.loginType+"_INVALID",o.stateType="free";break;case"1":i=o.loginType+r+"_BUSY",o.stateType="busy";break;case"2":i=o.loginType+r+"_CALLING",o.stateType="calling";break;case"3":i="consult"===n?o.loginType+"_CONSULT_RING":o.loginType+r+"_RING",o.stateType="ring";break;case"4":i="consult"===n?"WAITCONSUL":"callBack"===n?"CONSULCANCEL":o.loginType+r+"_LINK",o.stateType="called";break;case"5":i=o.loginType+r+"_ARRANGE",o.stateType="busy";break;case"6":i=o.loginType+r+"_HOLD",o.stateType="called";break;case"7":i=o.loginType+r+"_MUTE",o.stateType="called";break;case"8":i=o.loginType+r+"_DISCONNECTED",o.stateType="disconnect";break;case"9":i=o.loginType+r+"_DISCONNECTED",o.stateType="disconnect";break;case"10":i="callback"===n?"CONSULCANCEL":"CONSULPICKUP",o.stateType="called";break;case"11":i="THREECALL",o.stateType="called";break;case"12":i="CONSULING",o.stateType="called";break;case"13":i="THREECALL",o.stateType="called";break;case"14":i="LISTEN",o.stateType="called";break;case"15":i="WHISPER",o.stateType="called";break;default:i=o.loginType+r+"_BUSY",o.stateType="busy";break}return i},updateCurrentStatus(){const e=o.currentStatus.split("_");e[0]!==o.loginType&&(e[0]=o.loginType,o.currentStatus=e.join("_"))},timeRecording(n,o){let i=0;if(o){const e=new Date(o),t=new Date,n=t.getTime()-e.getTime();i=n>0?n/1e3:0}console.log(e,"cccccccccccccccccccccccccccccccccccccccccccccc"),e.value.timerTypeChange({timeType:n,statusTime:i}),t.value.timerTypeChange({timeType:n,statusTime:i}),r.value.timerTypeChange({timeType:n,statusTime:i})},changeOpenState(){o.setUnfoldState(!o.isOpenpanel)},setUnfoldState(e){o.isOpenpanel=e,localStorage.setItem("phoneUnfoldState",JSON.stringify(e))}})),i=(0,n.reactive)({setDialState(e){e.showDial=e},toggleDialState(){o.showDial=!o.showDial}}),s=(0,n.computed)((()=>o.isVisibleBtn("answer")));(0,n.watch)(s,(e=>{if(e&&o.callConfig.autoAnswer){const e=o.callConfig.autoAnswerTime?1e3*Number(o.callConfig.autoAnswerTime):0;setTimeout((()=>{o.accept()}),e)}}));const a=(0,n.computed)((()=>"")),c=(0,n.computed)((()=>["calling","called","ring"].includes(o.stateType)));(0,n.watch)(c,(e=>{e&&(o.dialoutNumber="",o.accountConfig.ringCard?o.quickState=!1:o.quickState=!0)}));const l=(0,n.computed)((()=>!["free","busy","disconnect"].includes(o.stateType)||o.errorObj.isError)),u=(0,n.computed)((()=>"dialout"===o.currentCallType?!o.accountConfig.forbidDialOutHangup:"incoming"!==o.currentCallType||!o.accountConfig.forbidDialInHangup)),d=(0,n.reactive)({defaultKeyboardPlaceholder:"输入号码点击回车键发起呼叫",showKeyboardPlaceholder:!0}),p=()=>{const e={...o.defaultConfig,loginType:o.callConfig.loginType};o.callConfig=OT(e)},h=e=>{iC(e)||(o.callConfig.mobile="",oC.error("只能输入数字"))},f=()=>{};(0,n.onMounted)((()=>{f()}));const g=e=>{if(o.currentStatus){const t=o.renderMap[o.currentStatus]||"";return t&&t.indexOf(e)>-1}};return{...(0,n.toRefs)(o),...(0,n.toRefs)(d),...(0,n.toRefs)(i),isVisibleBtn:g,disabledSwitch:c,hiddenOprate:l,phoneBarPeerTimeRef:e,phoneBarStatusTimeRef:t,phoneBarQuickStatusTimeRef:r,pushServe:a,validFun:h,changeType:p,showHangupBtn:u}}});const ME=(0,ST.Z)(HE,[["render",yT],["__scopeId","data-v-e7fc1244"]]);var LE=ME,qE=(0,n.defineComponent)({name:"App",components:{telephoneStrip:LE}});const $E=(0,ST.Z)(qE,[["render",Qn]]);var VE=$E,FE=VE}(),__webpack_exports__=__webpack_exports__["default"],__webpack_exports__}()}));
|
|
41
|
+
//# sourceMappingURL=myLib.umd.min.js.map
|