@tmsoft/webphone 2.0.25 → 2.0.27

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.
@@ -6,7 +6,7 @@
6
6
  `+r+` | `+ne(``,i.column-1,` `)+ne(``,s-i.column,`^`)}else t+=`
7
7
  at `+a}return t}};function re(e,t){t=t===void 0?{}:t;let n={},r=t.grammarSource,i={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},a=119,o=[`\r
8
8
  `,_(`\r
9
- `,!1),/^[0-9]/,v([[`0`,`9`]],!1,!1),/^[a-zA-Z]/,v([[`a`,`z`],[`A`,`Z`]],!1,!1),/^[0-9a-fA-F]/,v([[`0`,`9`],[`a`,`f`],[`A`,`F`]],!1,!1),/^[\0-\xFF]/,v([[`\0`,`ÿ`]],!1,!1),/^["]/,v([`"`],!1,!1),` `,_(` `,!1),` `,_(` `,!1),/^[a-zA-Z0-9]/,v([[`a`,`z`],[`A`,`Z`],[`0`,`9`]],!1,!1),`;`,_(`;`,!1),`/`,_(`/`,!1),`?`,_(`?`,!1),`:`,_(`:`,!1),`@`,_(`@`,!1),`&`,_(`&`,!1),`=`,_(`=`,!1),`+`,_(`+`,!1),`$`,_(`$`,!1),`,`,_(`,`,!1),`-`,_(`-`,!1),`_`,_(`_`,!1),`.`,_(`.`,!1),`!`,_(`!`,!1),`~`,_(`~`,!1),`*`,_(`*`,!1),`'`,_(`'`,!1),`(`,_(`(`,!1),`)`,_(`)`,!1),`%`,_(`%`,!1),function(){return` `},function(){return`:`},/^[!-~]/,v([[`!`,`~`]],!1,!1),/^[\x80-\uFFFF]/,v([[`€`,`￿`]],!1,!1),/^[\x80-\xBF]/,v([[`€`,`¿`]],!1,!1),/^[a-f]/,v([[`a`,`f`]],!1,!1),"`",_("`",!1),`<`,_(`<`,!1),`>`,_(`>`,!1),`\\`,_(`\\`,!1),`[`,_(`[`,!1),`]`,_(`]`,!1),`{`,_(`{`,!1),`}`,_(`}`,!1),function(){return`*`},function(){return`/`},function(){return`=`},function(){return`(`},function(){return`)`},function(){return`>`},function(){return`<`},function(){return`,`},function(){return`;`},function(){return`:`},function(){return`"`},/^[!-']/,v([[`!`,`'`]],!1,!1),/^[*-[]/,v([[`*`,`[`]],!1,!1),/^[\]-~]/,v([[`]`,`~`]],!1,!1),function(e){return e},/^[#-[]/,v([[`#`,`[`]],!1,!1),/^[\0-\t]/,v([[`\0`,` `]],!1,!1),/^[\v-\f]/,v([[`\v`,`\f`]],!1,!1),/^[\x0E-\x7F]/,v([[``,``]],!1,!1),function(){t||={data:{}},t.data.uri=new te(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||={data:{}},t.data.uri=new te(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,t.startRule===`SIP_URI`&&(t.data=t.data.uri)},`sips`,_(`sips`,!0),`sip`,_(`sip`,!0),function(e){t||={data:{}},t.data.scheme=e},function(){t||={data:{}},t.data.user=decodeURIComponent(h().slice(0,-1))},function(){t||={data:{}},t.data.password=h()},function(){return t||={data:{}},t.data.host=h(),t.data.host},function(){return t||={data:{}},t.data.host_type=`domain`,h()},/^[a-zA-Z0-9_\-]/,v([[`a`,`z`],[`A`,`Z`],[`0`,`9`],`_`,`-`],!1,!1),/^[a-zA-Z0-9\-]/,v([[`a`,`z`],[`A`,`Z`],[`0`,`9`],`-`],!1,!1),function(){return t||={data:{}},t.data.host_type=`IPv6`,h()},`::`,_(`::`,!1),function(){return t||={data:{}},t.data.host_type=`IPv6`,h()},function(){return t||={data:{}},t.data.host_type=`IPv4`,h()},`25`,_(`25`,!1),/^[0-5]/,v([[`0`,`5`]],!1,!1),`2`,_(`2`,!1),/^[0-4]/,v([[`0`,`4`]],!1,!1),`1`,_(`1`,!1),/^[1-9]/,v([[`1`,`9`]],!1,!1),function(e){return t||={data:{}},e=parseInt(e.join(``)),t.data.port=e,e},`transport=`,_(`transport=`,!0),`udp`,_(`udp`,!0),`tcp`,_(`tcp`,!0),`sctp`,_(`sctp`,!0),`tls`,_(`tls`,!0),function(e){t||={data:{}},t.data.uri_params||(t.data.uri_params={}),t.data.uri_params.transport=e.toLowerCase()},`user=`,_(`user=`,!0),`phone`,_(`phone`,!0),`ip`,_(`ip`,!0),function(e){t||={data:{}},t.data.uri_params||(t.data.uri_params={}),t.data.uri_params.user=e.toLowerCase()},`method=`,_(`method=`,!0),function(e){t||={data:{}},t.data.uri_params||(t.data.uri_params={}),t.data.uri_params.method=e},`ttl=`,_(`ttl=`,!0),function(e){t||={data:{}},t.data.params||(t.data.params={}),t.data.params.ttl=e},`maddr=`,_(`maddr=`,!0),function(e){t||={data:{}},t.data.uri_params||(t.data.uri_params={}),t.data.uri_params.maddr=e},`lr`,_(`lr`,!0),function(){t||={data:{}},t.data.uri_params||(t.data.uri_params={}),t.data.uri_params.lr=void 0},function(e,n){t||={data:{}},t.data.uri_params||(t.data.uri_params={}),n=n===null?void 0:n[1],t.data.uri_params[e.toLowerCase()]=n},function(e,n){e=e.join(``).toLowerCase(),n=n.join(``),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||={data:{}},t.startRule===`Refer_To`&&(t.data.uri=new te(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)},`//`,_(`//`,!1),function(){t||={data:{}},t.data.scheme=h()},_(`SIP`,!0),function(){t||={data:{}},t.data.sip_version=h()},`INVITE`,_(`INVITE`,!1),`ACK`,_(`ACK`,!1),`VXACH`,_(`VXACH`,!1),`OPTIONS`,_(`OPTIONS`,!1),`BYE`,_(`BYE`,!1),`CANCEL`,_(`CANCEL`,!1),`REGISTER`,_(`REGISTER`,!1),`SUBSCRIBE`,_(`SUBSCRIBE`,!1),`NOTIFY`,_(`NOTIFY`,!1),`REFER`,_(`REFER`,!1),`PUBLISH`,_(`PUBLISH`,!1),function(){return t||={data:{}},t.data.method=h(),t.data.method},function(e){t||={data:{}},t.data.status_code=parseInt(e.join(``))},function(){t||={data:{}},t.data.reason_phrase=h()},function(){t||={data:{}},t.data=h()},function(){var e,n;for(t||={data:{}},n=t.data.multi_header.length,e=0;e<n;e++)if(t.data.multi_header[e].parsed===null){t.data=null;break}t.data===null?t.data=-1:t.data=t.data.multi_header},function(){var e;t||={data:{}},t.data.multi_header||(t.data.multi_header=[]);try{e=new D(t.data.uri,t.data.displayName,t.data.params),delete t.data.uri,delete t.data.displayName,delete t.data.params}catch{e=null}t.data.multi_header.push({position:c,offset:g().start.offset,parsed:e})},function(e){e=h().trim(),e[0]===`"`&&(e=e.substring(1,e.length-1)),t||={data:{}},t.data.displayName=e},`q`,_(`q`,!0),function(e){t||={data:{}},t.data.params||(t.data.params={}),t.data.params.q=e},`expires`,_(`expires`,!0),function(e){t||={data:{}},t.data.params||(t.data.params={}),t.data.params.expires=e},function(e){return parseInt(e.join(``))},`0`,_(`0`,!1),function(){return parseFloat(h())},function(e,n){t||={data:{}},t.data.params||(t.data.params={}),n=n===null?void 0:n[1],t.data.params[e.toLowerCase()]=n},`render`,_(`render`,!0),`session`,_(`session`,!0),`icon`,_(`icon`,!0),`alert`,_(`alert`,!0),function(){t||={data:{}},t.startRule===`Content_Disposition`&&(t.data.type=h().toLowerCase())},`handling`,_(`handling`,!0),`optional`,_(`optional`,!0),`required`,_(`required`,!0),function(e){t||={data:{}},t.data=parseInt(e.join(``))},function(){t||={data:{}},t.data=h()},`text`,_(`text`,!0),`image`,_(`image`,!0),`audio`,_(`audio`,!0),`video`,_(`video`,!0),`application`,_(`application`,!0),`message`,_(`message`,!0),`multipart`,_(`multipart`,!0),`x-`,_(`x-`,!0),function(e){t||={data:{}},t.data.value=parseInt(e.join(``))},function(e){t||={data:{}},t.data=e},function(e){t||={data:{}},t.data.event=e.toLowerCase()},function(){t||={data:{}};var e=t.data.tag;t.data=new D(t.data.uri,t.data.displayName,t.data.params),e&&t.data.setParam(`tag`,e)},`tag`,_(`tag`,!0),function(e){t||={data:{}},t.data.tag=e},function(e){t||={data:{}},t.data=parseInt(e.join(``))},function(e){t||={data:{}},t.data=e},function(){t||={data:{}},t.data=new D(t.data.uri,t.data.displayName,t.data.params)},`digest`,_(`Digest`,!0),`realm`,_(`realm`,!0),function(e){t||={data:{}},t.data.realm=e},`domain`,_(`domain`,!0),`nonce`,_(`nonce`,!0),function(e){t||={data:{}},t.data.nonce=e},`opaque`,_(`opaque`,!0),function(e){t||={data:{}},t.data.opaque=e},`stale`,_(`stale`,!0),`true`,_(`true`,!0),function(){t||={data:{}},t.data.stale=!0},`false`,_(`false`,!0),function(){t||={data:{}},t.data.stale=!1},`algorithm`,_(`algorithm`,!0),`md5`,_(`MD5`,!0),`md5-sess`,_(`MD5-sess`,!0),function(e){t||={data:{}},t.data.algorithm=e.toUpperCase()},`qop`,_(`qop`,!0),`auth-int`,_(`auth-int`,!0),`auth`,_(`auth`,!0),function(e){t||={data:{}},t.data.qop||(t.data.qop=[]),t.data.qop.push(e.toLowerCase())},function(e){t||={data:{}},t.data.value=parseInt(e.join(``))},function(){var e,n;for(t||={data:{}},n=t.data.multi_header.length,e=0;e<n;e++)if(t.data.multi_header[e].parsed===null){t.data=null;break}t.data===null?t.data=-1:t.data=t.data.multi_header},function(){var e;t||={data:{}},t.data.multi_header||(t.data.multi_header=[]);try{e=new D(t.data.uri,t.data.displayName,t.data.params),delete t.data.uri,delete t.data.displayName,delete t.data.params}catch{e=null}t.data.multi_header.push({position:c,offset:g().start.offset,parsed:e})},function(){t||={data:{}},t.data=new D(t.data.uri,t.data.displayName,t.data.params)},function(){t||={data:{}},t.data.replaces_from_tag&&t.data.replaces_to_tag||(t.data=-1)},function(){t||={data:{}},t.data={call_id:t.data}},`from-tag`,_(`from-tag`,!0),function(e){t||={data:{}},t.data.replaces_from_tag=e},`to-tag`,_(`to-tag`,!0),function(e){t||={data:{}},t.data.replaces_to_tag=e},`early-only`,_(`early-only`,!0),function(){t||={data:{}},t.data.early_only=!0},function(e,t){return t},function(e,t){return E(e,t)},function(e){t||={data:{}},t.startRule===`Require`&&(t.data=e||[])},function(e){t||={data:{}},t.data.value=parseInt(e.join(``))},`active`,_(`active`,!0),`pending`,_(`pending`,!0),`terminated`,_(`terminated`,!0),function(){t||={data:{}},t.data.state=h()},`reason`,_(`reason`,!0),function(e){t||={data:{}},e!==void 0&&(t.data.reason=e)},function(e){t||={data:{}},e!==void 0&&(t.data.expires=e)},`retry_after`,_(`retry_after`,!0),function(e){t||={data:{}},e!==void 0&&(t.data.retry_after=e)},`deactivated`,_(`deactivated`,!0),`probation`,_(`probation`,!0),`rejected`,_(`rejected`,!0),`timeout`,_(`timeout`,!0),`giveup`,_(`giveup`,!0),`noresource`,_(`noresource`,!0),`invariant`,_(`invariant`,!0),function(e){t||={data:{}},t.startRule===`Supported`&&(t.data=e||[])},function(){t||={data:{}};var e=t.data.tag;t.data=new D(t.data.uri,t.data.displayName,t.data.params),e&&t.data.setParam(`tag`,e)},`ttl`,_(`ttl`,!0),function(e){t||={data:{}},t.data.ttl=e},`maddr`,_(`maddr`,!0),function(e){t||={data:{}},t.data.maddr=e},`received`,_(`received`,!0),function(e){t||={data:{}},t.data.received=e},`branch`,_(`branch`,!0),function(e){t||={data:{}},t.data.branch=e},`rport`,_(`rport`,!0),function(e){t||={data:{}},e!==void 0&&(t.data.rport=e.join(``))},function(e){t||={data:{}},t.data.protocol=e},_(`UDP`,!0),_(`TCP`,!0),_(`TLS`,!0),_(`SCTP`,!0),function(e){t||={data:{}},t.data.transport=e},function(){t||={data:{}},t.data.host=h()},function(e){t||={data:{}},t.data.port=parseInt(e.join(``))},function(e){return parseInt(e.join(``))},function(e){t||={data:{}},t.startRule===`Session_Expires`&&(t.data.deltaSeconds=e)},`refresher`,_(`refresher`,!1),`uas`,_(`uas`,!1),`uac`,_(`uac`,!1),function(e){t||={data:{}},t.startRule===`Session_Expires`&&(t.data.refresher=e)},function(e){t||={data:{}},t.startRule===`Min_SE`&&(t.data=e)},`stuns`,_(`stuns`,!0),`stun`,_(`stun`,!0),function(e){t||={data:{}},t.data.scheme=e},function(e){t||={data:{}},t.data.host=e},`?transport=`,_(`?transport=`,!1),`turns`,_(`turns`,!0),`turn`,_(`turn`,!0),function(e){t||={data:{}},t.data.transport=e},function(){t||={data:{}},t.data=h()},`Referred-By`,_(`Referred-By`,!1),`b`,_(`b`,!1),`cid`,_(`cid`,!1)],s=[w(`2 ""6 7!`),w(`4"""5!7#`),w(`4$""5!7%`),w(`4&""5!7'`),w(`;'.# &;(`),w(`4(""5!7)`),w(`4*""5!7+`),w(`2,""6,7-`),w(`2.""6.7/`),w(`40""5!71`),w(`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`),w(`;).# &;,`),w(`2F""6F7G.} &2H""6H7I.q &2J""6J7K.e &2L""6L7M.Y &2N""6N7O.M &2P""6P7Q.A &2R""6R7S.5 &2T""6T7U.) &2V""6V7W`),w(`%%2X""6X7Y/5#;#/,$;#/#$+#)(#'#("'#&'#/"!&,)`),w(`%%$;$0#*;$&/,#; /#$+")("'#&'#." &"/=#$;$/&#0#*;$&&&#/'$8":Z" )("'#&'#`),w(`;.." &"`),w(`%$;'.# &;(0)*;'.# &;(&/?#28""6879/0$;//'$8#:[# )(#'#("'#&'#`),w(`%%$;2/&#0#*;2&&&#/g#$%$;.0#*;.&/,#;2/#$+")("'#&'#0=*%$;.0#*;.&/,#;2/#$+")("'#&'#&/#$+")("'#&'#/"!&,)`),w(`4\\""5!7].# &;3`),w(`4^""5!7_`),w('4`""5!7a'),w(`;!.) &4b""5!7c`),w(`%$;).• &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&&&#/"!&,)`),w(`%$;).‰ &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&&&#/"!&,)`),w(`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.) &;'.# &;(`),w(`%$;).ī &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&&&#/"!&,)`),w(`%;//?#2P""6P7Q/0$;//'$8#:t# )(#'#("'#&'#`),w(`%;//?#24""6475/0$;//'$8#:u# )(#'#("'#&'#`),w(`%;//?#2>""6>7?/0$;//'$8#:v# )(#'#("'#&'#`),w(`%;//?#2T""6T7U/0$;//'$8#:w# )(#'#("'#&'#`),w(`%;//?#2V""6V7W/0$;//'$8#:x# )(#'#("'#&'#`),w(`%2h""6h7i/0#;//'$8":y" )("'#&'#`),w(`%;//6#2f""6f7g/'$8":z" )("'#&'#`),w(`%;//?#2D""6D7E/0$;//'$8#:{# )(#'#("'#&'#`),w(`%;//?#22""6273/0$;//'$8#:|# )(#'#("'#&'#`),w(`%;//?#28""6879/0$;//'$8#:}# )(#'#("'#&'#`),w(`%;//0#;&/'$8":~" )("'#&'#`),w(`%;&/0#;//'$8":~" )("'#&'#`),w(`%;=/T#$;G.) &;K.# &;F0/*;G.) &;K.# &;F&/,$;>/#$+#)(#'#("'#&'#`),w(`4""5!7€.A &4""5!7‚.5 &4ƒ""5!7„.) &;3.# &;.`),w(`%%;//Q#;&/H$$;J.# &;K0)*;J.# &;K&/,$;&/#$+$)($'#(#'#("'#&'#/"!&,)`),w(`%;//]#;&/T$%$;J.# &;K0)*;J.# &;K&/"!&,)/1$;&/($8$:…$!!)($'#(#'#("'#&'#`),w(`;..G &2L""6L7M.; &4†""5!7‡./ &4ƒ""5!7„.# &;3`),w(`%2j""6j7k/J#4ˆ""5!7‰.5 &4Š""5!7‹.) &4Œ""5!7/#$+")("'#&'#`),w(`%;N/M#28""6879/>$;O." &"/0$;S/'$8$:Ž$ )($'#(#'#("'#&'#`),w(`%;N/d#28""6879/U$;O." &"/G$;S/>$;_/5$;l." &"/'$8&:& )(&'#(%'#($'#(#'#("'#&'#`),w(`%3""5$7‘.) &3’""5#7“/' 8!:”!! )`),w(`%;P/]#%28""6879/,#;R/#$+")("'#&'#." &"/6$2:""6:7;/'$8#:•# )(#'#("'#&'#`),w(`$;+.) &;-.# &;Q/2#0/*;+.) &;-.# &;Q&&&#`),w(`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`),w(`%$;+._ &;-.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!:–! )`),w(`%;T/J#%28""6879/,#;^/#$+")("'#&'#." &"/#$+")("'#&'#`),w(`%;U.) &;\\.# &;X/& 8!:—! )`),w(`%$%;V/2#2J""6J7K/#$+")("'#&'#0<*%;V/2#2J""6J7K/#$+")("'#&'#&/D#;W/;$2J""6J7K." &"/'$8#:˜# )(#'#("'#&'#`),w(`$4™""5!7š/,#0)*4™""5!7š&&&#`),w(`%4$""5!7%/?#$4›""5!7œ0)*4›""5!7œ&/#$+")("'#&'#`),w(`%2l""6l7m/?#;Y/6$2n""6n7o/'$8#:# )(#'#("'#&'#`),w(`%%;Z/³#28""6879/¤$;Z/›$28""6879/Œ$;Z/ƒ$28""6879/t$;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+-)(-'#(,'#(+'#(*'#()'#(('#(''#(&'#(%'#($'#(#'#("'#&'#.ސ &%2ž""6ž7Ÿ/¤#;Z/›$28""6879/Œ$;Z/ƒ$28""6879/t$;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+,)(,'#(+'#(*'#()'#(('#(''#(&'#(%'#($'#(#'#("'#&'#.۹ &%2ž""6ž7Ÿ/Œ#;Z/ƒ$28""6879/t$;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+*)(*'#()'#(('#(''#(&'#(%'#($'#(#'#("'#&'#.ٺ &%2ž""6ž7Ÿ/t#;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+()(('#(''#(&'#(%'#($'#(#'#("'#&'#.ؓ &%2ž""6ž7Ÿ/\\#;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+&)(&'#(%'#($'#(#'#("'#&'#.ׄ &%2ž""6ž7Ÿ/D#;Z/;$28""6879/,$;[/#$+$)($'#(#'#("'#&'#.֍ &%2ž""6ž7Ÿ/,#;[/#$+")("'#&'#.ծ &%2ž""6ž7Ÿ/,#;Z/#$+")("'#&'#.Տ &%;Z/›#2ž""6ž7Ÿ/Œ$;Z/ƒ$28""6879/t$;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$++)(+'#(*'#()'#(('#(''#(&'#(%'#($'#(#'#("'#&'#.Ӈ &%;Z/ª#%28""6879/,#;Z/#$+")("'#&'#." &"/ƒ$2ž""6ž7Ÿ/t$;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+*)(*'#()'#(('#(''#(&'#(%'#($'#(#'#("'#&'#.а &%;Z/¹#%28""6879/,#;Z/#$+")("'#&'#." &"/’$%28""6879/,#;Z/#$+")("'#&'#." &"/k$2ž""6ž7Ÿ/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+))()'#(('#(''#(&'#(%'#($'#(#'#("'#&'#.Ί &%;Z/È#%28""6879/,#;Z/#$+")("'#&'#." &"/¡$%28""6879/,#;Z/#$+")("'#&'#." &"/z$%28""6879/,#;Z/#$+")("'#&'#." &"/S$2ž""6ž7Ÿ/D$;Z/;$28""6879/,$;[/#$+()(('#(''#(&'#(%'#($'#(#'#("'#&'#.˕ &%;Z/×#%28""6879/,#;Z/#$+")("'#&'#." &"/°$%28""6879/,#;Z/#$+")("'#&'#." &"/‰$%28""6879/,#;Z/#$+")("'#&'#." &"/b$%28""6879/,#;Z/#$+")("'#&'#." &"/;$2ž""6ž7Ÿ/,$;[/#$+')(''#(&'#(%'#($'#(#'#("'#&'#.ȑ &%;Z/þ#%28""6879/,#;Z/#$+")("'#&'#." &"/×$%28""6879/,#;Z/#$+")("'#&'#." &"/°$%28""6879/,#;Z/#$+")("'#&'#." &"/‰$%28""6879/,#;Z/#$+")("'#&'#." &"/b$%28""6879/,#;Z/#$+")("'#&'#." &"/;$2ž""6ž7Ÿ/,$;Z/#$+()(('#(''#(&'#(%'#($'#(#'#("'#&'#.Ħ &%;Z/Ĝ#%28""6879/,#;Z/#$+")("'#&'#." &"/õ$%28""6879/,#;Z/#$+")("'#&'#." &"/Î$%28""6879/,#;Z/#$+")("'#&'#." &"/§$%28""6879/,#;Z/#$+")("'#&'#." &"/€$%28""6879/,#;Z/#$+")("'#&'#." &"/Y$%28""6879/,#;Z/#$+")("'#&'#." &"/2$2ž""6ž7Ÿ/#$+()(('#(''#(&'#(%'#($'#(#'#("'#&'#/& 8!:\xA0! )`),w(`%;#/M#;#." &"/?$;#." &"/1$;#." &"/#$+$)($'#(#'#("'#&'#`),w(`%;Z/;#28""6879/,$;Z/#$+#)(#'#("'#&'#.# &;\\`),w(`%;]/o#2J""6J7K/\`$;]/W$2J""6J7K/H$;]/?$2J""6J7K/0$;]/'$8':¡' )(''#(&'#(%'#($'#(#'#("'#&'#`),w(`%2¢""6¢7£/2#4¤""5!7¥/#$+")("'#&'#.˜ &%2¦""6¦7§/;#4¨""5!7©/,$;!/#$+#)(#'#("'#&'#.j &%2ª""6ª7«/5#;!/,$;!/#$+#)(#'#("'#&'#.B &%4¬""5!7­/,#;!/#$+")("'#&'#.# &;!`),w(`%%;!." &"/[#;!." &"/M$;!." &"/?$;!." &"/1$;!." &"/#$+%)(%'#($'#(#'#("'#&'#/' 8!:®!! )`),w(`$%22""6273/,#;\`/#$+")("'#&'#0<*%22""6273/,#;\`/#$+")("'#&'#&`),w(`;a.A &;b.; &;c.5 &;d./ &;e.) &;f.# &;g`),w(`%3¯""5*7°/a#3±""5#7².G &3³""5#7´.; &3µ""5$7¶./ &3·""5#7¸.# &;6/($8":¹"! )("'#&'#`),w(`%3º""5%7»/I#3¼""5%7½./ &3¾""5"7¿.# &;6/($8":À"! )("'#&'#`),w(`%3Á""5'7Â/1#;/($8":Ã"! )("'#&'#`),w(`%3Ä""5$7Å/1#;ð/($8":Æ"! )("'#&'#`),w(`%3Ç""5&7È/1#;T/($8":É"! )("'#&'#`),w(`%3Ê""5"7Ë/N#%2>""6>7?/,#;6/#$+")("'#&'#." &"/'$8":Ì" )("'#&'#`),w(`%;h/P#%2>""6>7?/,#;i/#$+")("'#&'#." &"/)$8":Í""! )("'#&'#`),w(`%$;j/&#0#*;j&&&#/"!&,)`),w(`%$;j/&#0#*;j&&&#/"!&,)`),w(`;k.) &;+.# &;-`),w(`2l""6l7m.e &2n""6n7o.Y &24""6475.M &28""6879.A &2<""6<7=.5 &2@""6@7A.) &2B""6B7C`),w(`%26""6677/n#;m/e$$%2<""6<7=/,#;m/#$+")("'#&'#0<*%2<""6<7=/,#;m/#$+")("'#&'#&/#$+#)(#'#("'#&'#`),w(`%;n/A#2>""6>7?/2$;o/)$8#:Î#"" )(#'#("'#&'#`),w(`$;p.) &;+.# &;-/2#0/*;p.) &;+.# &;-&&&#`),w(`$;p.) &;+.# &;-0/*;p.) &;+.# &;-&`),w(`2l""6l7m.e &2n""6n7o.Y &24""6475.M &26""6677.A &28""6879.5 &2@""6@7A.) &2B""6B7C`),w(`;‘.# &;r`),w(`%;/G#;'/>$;s/5$;'/,$;„/#$+%)(%'#($'#(#'#("'#&'#`),w(`;M.# &;t`),w(`%;/E#28""6879/6$;u.# &;x/'$8#:Ï# )(#'#("'#&'#`),w(`%;v.# &;w/J#%26""6677/,#;ƒ/#$+")("'#&'#." &"/#$+")("'#&'#`),w(`%2Ð""6Ð7Ñ/:#;€/1$;w." &"/#$+#)(#'#("'#&'#`),w(`%24""6475/,#;{/#$+")("'#&'#`),w(`%;z/3#$;y0#*;y&/#$+")("'#&'#`),w(`;*.) &;+.# &;-`),w(`;+. &;-.‰ &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`),w(`%;|/e#$%24""6475/,#;|/#$+")("'#&'#0<*%24""6475/,#;|/#$+")("'#&'#&/#$+")("'#&'#`),w(`%$;~0#*;~&/e#$%22""6273/,#;}/#$+")("'#&'#0<*%22""6273/,#;}/#$+")("'#&'#&/#$+")("'#&'#`),w(`$;~0#*;~&`),w(`;+.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`),w(`%%;"/‡#$;".G &;!.A &2@""6@7A.5 &2F""6F7G.) &2J""6J7K0M*;".G &;!.A &2@""6@7A.5 &2F""6F7G.) &2J""6J7K&/#$+")("'#&'#/& 8!:Ò! )`),w(`;.# &;‚`),w(`%%;O/2#2:""6:7;/#$+")("'#&'#." &"/,#;S/#$+")("'#&'#." &"`),w(`$;+.ƒ &;-.} &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&&&#`),w(`$;y0#*;y&`),w(`%3’""5#7Ó/q#24""6475/b$$;!/&#0#*;!&&&#/L$2J""6J7K/=$$;!/&#0#*;!&&&#/'$8%:Ô% )(%'#($'#(#'#("'#&'#`),w(`2Õ""6Õ7Ö`),w(`2×""6×7Ø`),w(`2Ù""6Ù7Ú`),w(`2Û""6Û7Ü`),w(`2Ý""6Ý7Þ`),w(`2ß""6ß7à`),w(`2á""6á7â`),w(`2ã""6ã7ä`),w(`2å""6å7æ`),w(`2ç""6ç7è`),w(`2é""6é7ê`),w(`%;….Y &;†.S &;ˆ.M &;‰.G &;Š.A &;‹.; &;Œ.5 &;./ &;.) &;Ž.# &;6/& 8!:ë! )`),w(`%;„/G#;'/>$;’/5$;'/,$;”/#$+%)(%'#($'#(#'#("'#&'#`),w(`%;“/' 8!:ì!! )`),w(`%;!/5#;!/,$;!/#$+#)(#'#("'#&'#`),w(`%$;*.A &;+.; &;-.5 &;3./ &;4.) &;'.# &;(0G*;*.A &;+.; &;-.5 &;3./ &;4.) &;'.# &;(&/& 8!:í! )`),w(`%;¶/Y#$%;A/,#;¶/#$+")("'#&'#06*%;A/,#;¶/#$+")("'#&'#&/#$+")("'#&'#`),w(`%;9/N#%2:""6:7;/,#;9/#$+")("'#&'#." &"/'$8":î" )("'#&'#`),w(`%;:.c &%;˜/Y#$%;A/,#;˜/#$+")("'#&'#06*%;A/,#;˜/#$+")("'#&'#&/#$+")("'#&'#/& 8!:ï! )`),w(`%;L.# &;™/]#$%;B/,#;›/#$+")("'#&'#06*%;B/,#;›/#$+")("'#&'#&/'$8":ð" )("'#&'#`),w(`%;š." &"/>#;@/5$;M/,$;?/#$+$)($'#(#'#("'#&'#`),w(`%%;6/Y#$%;./,#;6/#$+")("'#&'#06*%;./,#;6/#$+")("'#&'#&/#$+")("'#&'#.# &;H/' 8!:ñ!! )`),w(`;œ.) &;.# &;\xA0`),w(`%3ò""5!7ó/:#;</1$;Ÿ/($8#:ô#! )(#'#("'#&'#`),w(`%3õ""5'7ö/:#;</1$;ž/($8#:÷#! )(#'#("'#&'#`),w(`%$;!/&#0#*;!&&&#/' 8!:ø!! )`),w(`%2ù""6ù7ú/o#%2J""6J7K/M#;!." &"/?$;!." &"/1$;!." &"/#$+$)($'#(#'#("'#&'#." &"/'$8":û" )("'#&'#`),w(`%;6/J#%;</,#;¡/#$+")("'#&'#." &"/)$8":ü""! )("'#&'#`),w(`;6.) &;T.# &;H`),w(`%;£/Y#$%;B/,#;¤/#$+")("'#&'#06*%;B/,#;¤/#$+")("'#&'#&/#$+")("'#&'#`),w(`%3ý""5&7þ.G &3ÿ""5'7Ā.; &3ā""5$7Ă./ &3ă""5%7Ą.# &;6/& 8!:ą! )`),w(`;¥.# &;\xA0`),w(`%3Ć""5(7ć/M#;</D$3Ĉ""5(7ĉ./ &3Ċ""5(7ċ.# &;6/#$+#)(#'#("'#&'#`),w(`%;6/Y#$%;A/,#;6/#$+")("'#&'#06*%;A/,#;6/#$+")("'#&'#&/#$+")("'#&'#`),w(`%$;!/&#0#*;!&&&#/' 8!:Č!! )`),w(`%;©/& 8!:č! )`),w(`%;ª/k#;;/b$;¯/Y$$%;B/,#;°/#$+")("'#&'#06*%;B/,#;°/#$+")("'#&'#&/#$+$)($'#(#'#("'#&'#`),w(`;«.# &;¬`),w(`3Ď""5$7ď.S &3Đ""5%7đ.G &3Ē""5%7ē.; &3Ĕ""5%7ĕ./ &3Ė""5+7ė.# &;­`),w(`3Ę""5'7ę./ &3Ě""5)7ě.# &;­`),w(`;6.# &;®`),w(`%3Ĝ""5"7ĝ/,#;6/#$+")("'#&'#`),w(`;­.# &;6`),w(`%;6/5#;</,$;±/#$+#)(#'#("'#&'#`),w(`;6.# &;H`),w(`%;³/5#;./,$;/#$+#)(#'#("'#&'#`),w(`%$;!/&#0#*;!&&&#/' 8!:Ğ!! )`),w(`%;ž/' 8!:ğ!! )`),w(`%;¶/^#$%;B/,#;\xA0/#$+")("'#&'#06*%;B/,#;\xA0/#$+")("'#&'#&/($8":Ġ"!!)("'#&'#`),w(`%%;7/e#$%2J""6J7K/,#;7/#$+")("'#&'#0<*%2J""6J7K/,#;7/#$+")("'#&'#&/#$+")("'#&'#/"!&,)`),w(`%;L.# &;™/]#$%;B/,#;¸/#$+")("'#&'#06*%;B/,#;¸/#$+")("'#&'#&/'$8":ġ" )("'#&'#`),w(`;¹.# &;\xA0`),w(`%3Ģ""5#7ģ/:#;</1$;6/($8#:Ĥ#! )(#'#("'#&'#`),w(`%$;!/&#0#*;!&&&#/' 8!:ĥ!! )`),w(`%;ž/' 8!:Ħ!! )`),w(`%$;š0#*;š&/x#;@/o$;M/f$;?/]$$%;B/,#;\xA0/#$+")("'#&'#06*%;B/,#;\xA0/#$+")("'#&'#&/'$8%:ħ% )(%'#($'#(#'#("'#&'#`),w(`;¾`),w(`%3Ĩ""5&7ĩ/k#;./b$;Á/Y$$%;A/,#;Á/#$+")("'#&'#06*%;A/,#;Á/#$+")("'#&'#&/#$+$)($'#(#'#("'#&'#.# &;¿`),w(`%;6/k#;./b$;À/Y$$%;A/,#;À/#$+")("'#&'#06*%;A/,#;À/#$+")("'#&'#&/#$+$)($'#(#'#("'#&'#`),w(`%;6/;#;</2$;6.# &;H/#$+#)(#'#("'#&'#`),w(`;Â.G &;Ä.A &;Æ.; &;È.5 &;É./ &;Ê.) &;Ë.# &;À`),w(`%3Ī""5%7ī/5#;</,$;Ã/#$+#)(#'#("'#&'#`),w(`%;I/' 8!:Ĭ!! )`),w(`%3ĭ""5&7Į/—#;</Ž$;D/…$;Å/|$$%$;'/&#0#*;'&&&#/,#;Å/#$+")("'#&'#0C*%$;'/&#0#*;'&&&#/,#;Å/#$+")("'#&'#&/,$;E/#$+&)(&'#(%'#($'#(#'#("'#&'#`),w(`;t.# &;w`),w(`%3į""5%7İ/5#;</,$;Ç/#$+#)(#'#("'#&'#`),w(`%;I/' 8!:ı!! )`),w(`%3IJ""5&7ij/:#;</1$;I/($8#:Ĵ#! )(#'#("'#&'#`),w(`%3ĵ""5%7Ķ/]#;</T$%3ķ""5$7ĸ/& 8!:Ĺ! ).4 &%3ĺ""5%7Ļ/& 8!:ļ! )/#$+#)(#'#("'#&'#`),w(`%3Ľ""5)7ľ/R#;</I$3Ŀ""5#7ŀ./ &3Ł""5(7ł.# &;6/($8#:Ń#! )(#'#("'#&'#`),w(`%3ń""5#7Ņ/“#;</Š$;D/$%;Ì/e#$%2D""6D7E/,#;Ì/#$+")("'#&'#0<*%2D""6D7E/,#;Ì/#$+")("'#&'#&/#$+")("'#&'#/,$;E/#$+%)(%'#($'#(#'#("'#&'#`),w(`%3ņ""5(7Ň./ &3ň""5$7ʼn.# &;6/' 8!:Ŋ!! )`),w(`%;6/Y#$%;A/,#;6/#$+")("'#&'#06*%;A/,#;6/#$+")("'#&'#&/#$+")("'#&'#`),w(`%;Ï/G#;./>$;Ï/5$;./,$;/#$+%)(%'#($'#(#'#("'#&'#`),w(`%$;!/&#0#*;!&&&#/' 8!:ŋ!! )`),w(`%;Ñ/]#$%;A/,#;Ñ/#$+")("'#&'#06*%;A/,#;Ñ/#$+")("'#&'#&/'$8":Ō" )("'#&'#`),w(`%;™/]#$%;B/,#;\xA0/#$+")("'#&'#06*%;B/,#;\xA0/#$+")("'#&'#&/'$8":ō" )("'#&'#`),w(`%;L.O &;™.I &%;@." &"/:#;t/1$;?." &"/#$+#)(#'#("'#&'#/]#$%;B/,#;\xA0/#$+")("'#&'#06*%;B/,#;\xA0/#$+")("'#&'#&/'$8":Ŏ" )("'#&'#`),w(`%;Ô/]#$%;B/,#;Õ/#$+")("'#&'#06*%;B/,#;Õ/#$+")("'#&'#&/'$8":ŏ" )("'#&'#`),w(`%;–/& 8!:Ő! )`),w(`%3ő""5(7Œ/:#;</1$;6/($8#:œ#! )(#'#("'#&'#.g &%3Ŕ""5&7ŕ/:#;</1$;6/($8#:Ŗ#! )(#'#("'#&'#.: &%3ŗ""5*7Ř/& 8!:ř! ).# &;\xA0`),w(`%%;6/k#$%;A/2#;6/)$8":Ś""$ )("'#&'#0<*%;A/2#;6/)$8":Ś""$ )("'#&'#&/)$8":ś""! )("'#&'#." &"/' 8!:Ŝ!! )`),w(`%;Ø/Y#$%;A/,#;Ø/#$+")("'#&'#06*%;A/,#;Ø/#$+")("'#&'#&/#$+")("'#&'#`),w(`%;™/Y#$%;B/,#;\xA0/#$+")("'#&'#06*%;B/,#;\xA0/#$+")("'#&'#&/#$+")("'#&'#`),w(`%$;!/&#0#*;!&&&#/' 8!:ŝ!! )`),w(`%;Û/Y#$%;B/,#;Ü/#$+")("'#&'#06*%;B/,#;Ü/#$+")("'#&'#&/#$+")("'#&'#`),w(`%3Ş""5&7ş.; &3Š""5'7š./ &3Ţ""5*7ţ.# &;6/& 8!:Ť! )`),w(`%3ť""5&7Ŧ/:#;</1$;Ý/($8#:ŧ#! )(#'#("'#&'#.} &%3õ""5'7ö/:#;</1$;ž/($8#:Ũ#! )(#'#("'#&'#.P &%3ũ""5+7Ū/:#;</1$;ž/($8#:ū#! )(#'#("'#&'#.# &;\xA0`),w(`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`),w(`;1." &"`),w(`%%;6/k#$%;A/2#;6/)$8":Ś""$ )("'#&'#0<*%;A/2#;6/)$8":Ś""$ )("'#&'#&/)$8":ś""! )("'#&'#." &"/' 8!:ź!! )`),w(`%;L.# &;™/]#$%;B/,#;á/#$+")("'#&'#06*%;B/,#;á/#$+")("'#&'#&/'$8":Ż" )("'#&'#`),w(`;¹.# &;\xA0`),w(`%;ã/Y#$%;A/,#;ã/#$+")("'#&'#06*%;A/,#;ã/#$+")("'#&'#&/#$+")("'#&'#`),w(`%;ê/k#;./b$;í/Y$$%;B/,#;ä/#$+")("'#&'#06*%;B/,#;ä/#$+")("'#&'#&/#$+$)($'#(#'#("'#&'#`),w(`;å.; &;æ.5 &;ç./ &;è.) &;é.# &;\xA0`),w(`%3ż""5#7Ž/:#;</1$;ð/($8#:ž#! )(#'#("'#&'#`),w(`%3ſ""5%7ƀ/:#;</1$;T/($8#:Ɓ#! )(#'#("'#&'#`),w(`%3Ƃ""5(7ƃ/F#;</=$;\\.) &;Y.# &;X/($8#:Ƅ#! )(#'#("'#&'#`),w(`%3ƅ""5&7Ɔ/:#;</1$;6/($8#:Ƈ#! )(#'#("'#&'#`),w(`%3ƈ""5%7Ɖ/A#;</8$$;!0#*;!&/($8#:Ɗ#! )(#'#("'#&'#`),w(`%;ë/G#;;/>$;6/5$;;/,$;ì/#$+%)(%'#($'#(#'#("'#&'#`),w(`%3’""5#7Ó.# &;6/' 8!:Ƌ!! )`),w(`%3±""5#7ƌ.G &3³""5#7ƍ.; &3·""5#7Ǝ./ &3µ""5$7Ə.# &;6/' 8!:Ɛ!! )`),w(`%;î/D#%;C/,#;ï/#$+")("'#&'#." &"/#$+")("'#&'#`),w(`%;U.) &;\\.# &;X/& 8!:Ƒ! )`),w(`%%;!." &"/[#;!." &"/M$;!." &"/?$;!." &"/1$;!." &"/#$+%)(%'#($'#(#'#("'#&'#/' 8!:ƒ!! )`),w(`%%;!/?#;!." &"/1$;!." &"/#$+#)(#'#("'#&'#/' 8!:Ɠ!! )`),w(`;¾`),w(`%;ž/^#$%;B/,#;ó/#$+")("'#&'#06*%;B/,#;ó/#$+")("'#&'#&/($8":Ɣ"!!)("'#&'#`),w(`;ô.# &;\xA0`),w(`%2ƕ""6ƕ7Ɩ/L#;</C$2Ɨ""6Ɨ7Ƙ.) &2ƙ""6ƙ7ƚ/($8#:ƛ#! )(#'#("'#&'#`),w(`%;ž/^#$%;B/,#;\xA0/#$+")("'#&'#06*%;B/,#;\xA0/#$+")("'#&'#&/($8":Ɯ"!!)("'#&'#`),w(`%;6/5#;0/,$;÷/#$+#)(#'#("'#&'#`),w(`$;2.) &;4.# &;.0/*;2.) &;4.# &;.&`),w(`$;%0#*;%&`),w(`%;ú/;#28""6879/,$;û/#$+#)(#'#("'#&'#`),w(`%3Ɲ""5%7ƞ.) &3Ɵ""5$7Ơ/' 8!:ơ!! )`),w(`%;ü/J#%28""6879/,#;^/#$+")("'#&'#." &"/#$+")("'#&'#`),w(`%;\\.) &;X.# &;‚/' 8!:Ƣ!! )`),w(`;".S &;!.M &2F""6F7G.A &2J""6J7K.5 &2H""6H7I.) &2N""6N7O`),w(`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?`),w(`%;Ā/b#28""6879/S$;û/J$%2ƣ""6ƣ7Ƥ/,#;ì/#$+")("'#&'#." &"/#$+$)($'#(#'#("'#&'#`),w(`%3ƥ""5%7Ʀ.) &3Ƨ""5$7ƨ/' 8!:ơ!! )`),w(`%3±""5#7².6 &3³""5#7´.* &$;+0#*;+&/' 8!:Ʃ!! )`),w(`%;Ą/‡#2F""6F7G/x$;ă/o$2F""6F7G/\`$;ă/W$2F""6F7G/H$;ă/?$2F""6F7G/0$;ą/'$8):ƪ) )()'#(('#(''#(&'#(%'#($'#(#'#("'#&'#`),w(`%;#/>#;#/5$;#/,$;#/#$+$)($'#(#'#("'#&'#`),w(`%;ă/,#;ă/#$+")("'#&'#`),w(`%;ă/5#;ă/,$;ă/#$+#)(#'#("'#&'#`),w(`%;q/T#$;m0#*;m&/D$%; /,#;ø/#$+")("'#&'#." &"/#$+#)(#'#("'#&'#`),w(`%2ƫ""6ƫ7Ƭ.) &2ƭ""6ƭ7Ʈ/w#;0/n$;Ĉ/e$$%;B/2#;ĉ.# &;\xA0/#$+")("'#&'#0<*%;B/2#;ĉ.# &;\xA0/#$+")("'#&'#&/#$+$)($'#(#'#("'#&'#`),w(`;™.# &;L`),w(`%2Ư""6Ư7ư/5#;</,$;Ċ/#$+#)(#'#("'#&'#`),w(`%;D/S#;,/J$2:""6:7;/;$;,.# &;T/,$;E/#$+%)(%'#($'#(#'#("'#&'#`)],c=0,l=0,u=[{line:1,column:1}],d=0,f=[],p=0,m;if(t.startRule!==void 0){if(!(t.startRule in i))throw Error(`Can't start parsing from rule "`+t.startRule+`".`);a=i[t.startRule]}function h(){return e.substring(l,c)}function g(){return x(l,c)}function _(e,t){return{type:`literal`,text:e,ignoreCase:t}}function v(e,t,n){return{type:`class`,parts:e,inverted:t,ignoreCase:n}}function y(){return{type:`end`}}function b(t){let n=u[t],r;if(n)return n;for(r=t-1;!u[r];)r--;for(n=u[r],n={line:n.line,column:n.column};r<t;)e.charCodeAt(r)===10?(n.line++,n.column=1):n.column++,r++;return u[t]=n,n}function x(e,t){let n=b(e),i=b(t);return{source:r,start:{offset:e,line:n.line,column:n.column},end:{offset:t,line:i.line,column:i.column}}}function S(e){c<d||(c>d&&(d=c,f=[]),f.push(e))}function C(e,t,n){return new k(k.buildMessage(e,t),e,t,n)}function w(e){return e.split(``).map(e=>e.charCodeAt(0)-32)}function T(t){let r=s[t],i=0,a=[],u=r.length,d=[],f=[],m;for(;;){for(;i<u;)switch(r[i]){case 0:f.push(o[r[i+1]]),i+=2;break;case 1:f.push(void 0),i++;break;case 2:f.push(null),i++;break;case 3:f.push(n),i++;break;case 4:f.push([]),i++;break;case 5:f.push(c),i++;break;case 6:f.pop(),i++;break;case 7:c=f.pop(),i++;break;case 8:f.length-=r[i+1],i+=2;break;case 9:f.splice(-2,1),i++;break;case 10:f[f.length-2].push(f.pop()),i++;break;case 11:f.push(f.splice(f.length-r[i+1],r[i+1])),i+=2;break;case 12:f.push(e.substring(f.pop(),c)),i++;break;case 13:d.push(u),a.push(i+3+r[i+1]+r[i+2]),f[f.length-1]?(u=i+3+r[i+1],i+=3):(u=i+3+r[i+1]+r[i+2],i+=3+r[i+1]);break;case 14:d.push(u),a.push(i+3+r[i+1]+r[i+2]),f[f.length-1]===n?(u=i+3+r[i+1],i+=3):(u=i+3+r[i+1]+r[i+2],i+=3+r[i+1]);break;case 15:d.push(u),a.push(i+3+r[i+1]+r[i+2]),f[f.length-1]===n?(u=i+3+r[i+1]+r[i+2],i+=3+r[i+1]):(u=i+3+r[i+1],i+=3);break;case 16:f[f.length-1]===n?i+=2+r[i+1]:(d.push(u),a.push(i),u=i+2+r[i+1],i+=2);break;case 17:d.push(u),a.push(i+3+r[i+1]+r[i+2]),e.length>c?(u=i+3+r[i+1],i+=3):(u=i+3+r[i+1]+r[i+2],i+=3+r[i+1]);break;case 18:d.push(u),a.push(i+4+r[i+2]+r[i+3]),e.substr(c,o[r[i+1]].length)===o[r[i+1]]?(u=i+4+r[i+2],i+=4):(u=i+4+r[i+2]+r[i+3],i+=4+r[i+2]);break;case 19:d.push(u),a.push(i+4+r[i+2]+r[i+3]),e.substr(c,o[r[i+1]].length).toLowerCase()===o[r[i+1]]?(u=i+4+r[i+2],i+=4):(u=i+4+r[i+2]+r[i+3],i+=4+r[i+2]);break;case 20:d.push(u),a.push(i+4+r[i+2]+r[i+3]),o[r[i+1]].test(e.charAt(c))?(u=i+4+r[i+2],i+=4):(u=i+4+r[i+2]+r[i+3],i+=4+r[i+2]);break;case 21:f.push(e.substr(c,r[i+1])),c+=r[i+1],i+=2;break;case 22:f.push(o[r[i+1]]),c+=o[r[i+1]].length,i+=2;break;case 23:f.push(n),p===0&&S(o[r[i+1]]),i+=2;break;case 24:l=f[f.length-1-r[i+1]],i+=2;break;case 25:l=c,i++;break;case 26:m=r.slice(i+4,i+4+r[i+3]).map(function(e){return f[f.length-1-e]}),f.splice(f.length-r[i+2],r[i+2],o[r[i+1]].apply(null,m)),i+=4+r[i+3];break;case 27:f.push(T(r[i+1])),i+=2;break;case 28:p++,i++;break;case 29:p--,i++;break;default:throw Error(`Invalid opcode: `+r[i]+`.`)}if(d.length>0)u=d.pop(),i=a.pop();else break}return f[0]}t.data={};function E(e,t){return[e].concat(t)}if(m=T(a),m!==n&&c===e.length)return m;throw m!==n&&c<e.length&&S(y()),C(f,d<e.length?e.charAt(d):null,d<e.length?x(d,d+1):x(d,d))}let ie=re;var A;(function(e){function t(e,t){let n={startRule:t};try{ie(e,n)}catch{n.data=-1}return n.data}e.parse=t;function n(t){let n=e.parse(t,`Name_Addr_Header`);return n===-1?void 0:n}e.nameAddrHeaderParse=n;function r(t){let n=e.parse(t,`SIP_URI`);return n===-1?void 0:n}e.URIParse=r})(A=A||={});var j={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 ae(e,t=32){let n=``;for(let r=0;r<e;r++){let e=Math.floor(Math.random()*t);n+=e.toString(t)}return n}function oe(e){return j[e]||``}function se(){return ae(10)}function ce(e){let 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,i=``;for(let e=0;e<r;e++)e!==0&&(i+=`-`),i+=n[e].charAt(0).toUpperCase()+n[e].substring(1);return t[i]&&(i=t[i]),i}function M(e){return encodeURIComponent(e).replace(/%[A-F\d]{2}/g,`U`).length}var le=class{constructor(){this.headers={}}addHeader(e,t){let n={raw:t};e=ce(e),this.headers[e]?this.headers[e].push(n):this.headers[e]=[n]}getHeader(e){let t=this.headers[ce(e)];if(t){if(t[0])return t[0].raw}else return}getHeaders(e){let t=this.headers[ce(e)],n=[];if(!t)return[];for(let e of t)n.push(e.raw);return n}hasHeader(e){return!!this.headers[ce(e)]}parseHeader(e,t=0){if(e=ce(e),this.headers[e]){if(t>=this.headers[e].length)return}else return;let n=this.headers[e][t],r=n.raw;if(n.parsed)return n.parsed;let i=A.parse(r,e.replace(/-/g,`_`));if(i===-1){this.headers[e].splice(t,1);return}else return n.parsed=i,i}s(e,t=0){return this.parseHeader(e,t)}setHeader(e,t){this.headers[ce(e)]=[{raw:t}]}toString(){return this.data}},ue=class extends le{constructor(){super()}},de=class extends le{constructor(){super()}},N=class e{constructor(t,n,r,i,a,o,s){this.headers={},this.extraHeaders=[],this.options=e.getDefaultOptions(),a&&(this.options=Object.assign(Object.assign({},this.options),a),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())),o&&o.length&&(this.extraHeaders=o.slice()),s&&(this.body={body:s.content,contentType:s.contentType}),this.method=t,this.ruri=n.clone(),this.fromURI=r.clone(),this.fromTag=this.options.fromTag?this.options.fromTag:se(),this.from=e.makeNameAddrHeader(this.fromURI,this.options.fromDisplayName,this.fromTag),this.toURI=i.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+ae(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`)}static getDefaultOptions(){return{callId:``,callIdPrefix:``,cseq:1,toDisplayName:``,toTag:``,fromDisplayName:``,fromTag:``,forceRport:!1,hackViaTcp:!1,optionTags:[`outbound`],routeSet:[],userAgentString:`sip.js`,viaHost:``}}static makeNameAddrHeader(e,t,n){let r={};return n&&(r.tag=n),new D(e,t,r)}getHeader(e){let t=this.headers[ce(e)];if(t){if(t[0])return t[0]}else{let t=RegExp(`^\\s*`+e+`\\s*:`,`i`);for(let e of this.extraHeaders)if(t.test(e))return e.substring(e.indexOf(`:`)+1).trim()}}getHeaders(e){let t=[],n=this.headers[ce(e)];if(n)for(let e of n)t.push(e);else{let n=RegExp(`^\\s*`+e+`\\s*:`,`i`);for(let e of this.extraHeaders)n.test(e)&&t.push(e.substring(e.indexOf(`:`)+1).trim())}return t}hasHeader(e){if(this.headers[ce(e)])return!0;{let t=RegExp(`^\\s*`+e+`\\s*:`,`i`);for(let e of this.extraHeaders)if(t.test(e))return!0}return!1}setHeader(e,t){this.headers[ce(e)]=t instanceof Array?t:[t]}setViaHeader(e,t){this.options.hackViaTcp&&(t=`TCP`);let n=`SIP/2.0/`+t;n+=` `+this.options.viaHost+`;branch=`+e,this.options.forceRport&&(n+=`;rport`),this.setHeader(`via`,n),this.branch=e}toString(){let e=``;for(let t in e+=this.method+` `+this.ruri.toRaw()+` SIP/2.0\r
9
+ `,!1),/^[0-9]/,v([[`0`,`9`]],!1,!1),/^[a-zA-Z]/,v([[`a`,`z`],[`A`,`Z`]],!1,!1),/^[0-9a-fA-F]/,v([[`0`,`9`],[`a`,`f`],[`A`,`F`]],!1,!1),/^[\0-\xFF]/,v([[`\0`,`ÿ`]],!1,!1),/^["]/,v([`"`],!1,!1),` `,_(` `,!1),` `,_(` `,!1),/^[a-zA-Z0-9]/,v([[`a`,`z`],[`A`,`Z`],[`0`,`9`]],!1,!1),`;`,_(`;`,!1),`/`,_(`/`,!1),`?`,_(`?`,!1),`:`,_(`:`,!1),`@`,_(`@`,!1),`&`,_(`&`,!1),`=`,_(`=`,!1),`+`,_(`+`,!1),`$`,_(`$`,!1),`,`,_(`,`,!1),`-`,_(`-`,!1),`_`,_(`_`,!1),`.`,_(`.`,!1),`!`,_(`!`,!1),`~`,_(`~`,!1),`*`,_(`*`,!1),`'`,_(`'`,!1),`(`,_(`(`,!1),`)`,_(`)`,!1),`%`,_(`%`,!1),function(){return` `},function(){return`:`},/^[!-~]/,v([[`!`,`~`]],!1,!1),/^[\x80-\uFFFF]/,v([[`€`,`￿`]],!1,!1),/^[\x80-\xBF]/,v([[`€`,`¿`]],!1,!1),/^[a-f]/,v([[`a`,`f`]],!1,!1),"`",_("`",!1),`<`,_(`<`,!1),`>`,_(`>`,!1),`\\`,_(`\\`,!1),`[`,_(`[`,!1),`]`,_(`]`,!1),`{`,_(`{`,!1),`}`,_(`}`,!1),function(){return`*`},function(){return`/`},function(){return`=`},function(){return`(`},function(){return`)`},function(){return`>`},function(){return`<`},function(){return`,`},function(){return`;`},function(){return`:`},function(){return`"`},/^[!-']/,v([[`!`,`'`]],!1,!1),/^[*-[]/,v([[`*`,`[`]],!1,!1),/^[\]-~]/,v([[`]`,`~`]],!1,!1),function(e){return e},/^[#-[]/,v([[`#`,`[`]],!1,!1),/^[\0-\t]/,v([[`\0`,` `]],!1,!1),/^[\v-\f]/,v([[`\v`,`\f`]],!1,!1),/^[\x0E-\x7F]/,v([[``,``]],!1,!1),function(){t||={data:{}},t.data.uri=new te(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||={data:{}},t.data.uri=new te(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,t.startRule===`SIP_URI`&&(t.data=t.data.uri)},`sips`,_(`sips`,!0),`sip`,_(`sip`,!0),function(e){t||={data:{}},t.data.scheme=e},function(){t||={data:{}},t.data.user=decodeURIComponent(h().slice(0,-1))},function(){t||={data:{}},t.data.password=h()},function(){return t||={data:{}},t.data.host=h(),t.data.host},function(){return t||={data:{}},t.data.host_type=`domain`,h()},/^[a-zA-Z0-9_\-]/,v([[`a`,`z`],[`A`,`Z`],[`0`,`9`],`_`,`-`],!1,!1),/^[a-zA-Z0-9\-]/,v([[`a`,`z`],[`A`,`Z`],[`0`,`9`],`-`],!1,!1),function(){return t||={data:{}},t.data.host_type=`IPv6`,h()},`::`,_(`::`,!1),function(){return t||={data:{}},t.data.host_type=`IPv6`,h()},function(){return t||={data:{}},t.data.host_type=`IPv4`,h()},`25`,_(`25`,!1),/^[0-5]/,v([[`0`,`5`]],!1,!1),`2`,_(`2`,!1),/^[0-4]/,v([[`0`,`4`]],!1,!1),`1`,_(`1`,!1),/^[1-9]/,v([[`1`,`9`]],!1,!1),function(e){return t||={data:{}},e=parseInt(e.join(``)),t.data.port=e,e},`transport=`,_(`transport=`,!0),`udp`,_(`udp`,!0),`tcp`,_(`tcp`,!0),`sctp`,_(`sctp`,!0),`tls`,_(`tls`,!0),function(e){t||={data:{}},t.data.uri_params||(t.data.uri_params={}),t.data.uri_params.transport=e.toLowerCase()},`user=`,_(`user=`,!0),`phone`,_(`phone`,!0),`ip`,_(`ip`,!0),function(e){t||={data:{}},t.data.uri_params||(t.data.uri_params={}),t.data.uri_params.user=e.toLowerCase()},`method=`,_(`method=`,!0),function(e){t||={data:{}},t.data.uri_params||(t.data.uri_params={}),t.data.uri_params.method=e},`ttl=`,_(`ttl=`,!0),function(e){t||={data:{}},t.data.params||(t.data.params={}),t.data.params.ttl=e},`maddr=`,_(`maddr=`,!0),function(e){t||={data:{}},t.data.uri_params||(t.data.uri_params={}),t.data.uri_params.maddr=e},`lr`,_(`lr`,!0),function(){t||={data:{}},t.data.uri_params||(t.data.uri_params={}),t.data.uri_params.lr=void 0},function(e,n){t||={data:{}},t.data.uri_params||(t.data.uri_params={}),n=n===null?void 0:n[1],t.data.uri_params[e.toLowerCase()]=n},function(e,n){e=e.join(``).toLowerCase(),n=n.join(``),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||={data:{}},t.startRule===`Refer_To`&&(t.data.uri=new te(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)},`//`,_(`//`,!1),function(){t||={data:{}},t.data.scheme=h()},_(`SIP`,!0),function(){t||={data:{}},t.data.sip_version=h()},`INVITE`,_(`INVITE`,!1),`ACK`,_(`ACK`,!1),`VXACH`,_(`VXACH`,!1),`OPTIONS`,_(`OPTIONS`,!1),`BYE`,_(`BYE`,!1),`CANCEL`,_(`CANCEL`,!1),`REGISTER`,_(`REGISTER`,!1),`SUBSCRIBE`,_(`SUBSCRIBE`,!1),`NOTIFY`,_(`NOTIFY`,!1),`REFER`,_(`REFER`,!1),`PUBLISH`,_(`PUBLISH`,!1),function(){return t||={data:{}},t.data.method=h(),t.data.method},function(e){t||={data:{}},t.data.status_code=parseInt(e.join(``))},function(){t||={data:{}},t.data.reason_phrase=h()},function(){t||={data:{}},t.data=h()},function(){var e,n;for(t||={data:{}},n=t.data.multi_header.length,e=0;e<n;e++)if(t.data.multi_header[e].parsed===null){t.data=null;break}t.data===null?t.data=-1:t.data=t.data.multi_header},function(){var e;t||={data:{}},t.data.multi_header||(t.data.multi_header=[]);try{e=new D(t.data.uri,t.data.displayName,t.data.params),delete t.data.uri,delete t.data.displayName,delete t.data.params}catch{e=null}t.data.multi_header.push({position:c,offset:g().start.offset,parsed:e})},function(e){e=h().trim(),e[0]===`"`&&(e=e.substring(1,e.length-1)),t||={data:{}},t.data.displayName=e},`q`,_(`q`,!0),function(e){t||={data:{}},t.data.params||(t.data.params={}),t.data.params.q=e},`expires`,_(`expires`,!0),function(e){t||={data:{}},t.data.params||(t.data.params={}),t.data.params.expires=e},function(e){return parseInt(e.join(``))},`0`,_(`0`,!1),function(){return parseFloat(h())},function(e,n){t||={data:{}},t.data.params||(t.data.params={}),n=n===null?void 0:n[1],t.data.params[e.toLowerCase()]=n},`render`,_(`render`,!0),`session`,_(`session`,!0),`icon`,_(`icon`,!0),`alert`,_(`alert`,!0),function(){t||={data:{}},t.startRule===`Content_Disposition`&&(t.data.type=h().toLowerCase())},`handling`,_(`handling`,!0),`optional`,_(`optional`,!0),`required`,_(`required`,!0),function(e){t||={data:{}},t.data=parseInt(e.join(``))},function(){t||={data:{}},t.data=h()},`text`,_(`text`,!0),`image`,_(`image`,!0),`audio`,_(`audio`,!0),`video`,_(`video`,!0),`application`,_(`application`,!0),`message`,_(`message`,!0),`multipart`,_(`multipart`,!0),`x-`,_(`x-`,!0),function(e){t||={data:{}},t.data.value=parseInt(e.join(``))},function(e){t||={data:{}},t.data=e},function(e){t||={data:{}},t.data.event=e.toLowerCase()},function(){t||={data:{}};var e=t.data.tag;t.data=new D(t.data.uri,t.data.displayName,t.data.params),e&&t.data.setParam(`tag`,e)},`tag`,_(`tag`,!0),function(e){t||={data:{}},t.data.tag=e},function(e){t||={data:{}},t.data=parseInt(e.join(``))},function(e){t||={data:{}},t.data=e},function(){t||={data:{}},t.data=new D(t.data.uri,t.data.displayName,t.data.params)},`digest`,_(`Digest`,!0),`realm`,_(`realm`,!0),function(e){t||={data:{}},t.data.realm=e},`domain`,_(`domain`,!0),`nonce`,_(`nonce`,!0),function(e){t||={data:{}},t.data.nonce=e},`opaque`,_(`opaque`,!0),function(e){t||={data:{}},t.data.opaque=e},`stale`,_(`stale`,!0),`true`,_(`true`,!0),function(){t||={data:{}},t.data.stale=!0},`false`,_(`false`,!0),function(){t||={data:{}},t.data.stale=!1},`algorithm`,_(`algorithm`,!0),`md5`,_(`MD5`,!0),`md5-sess`,_(`MD5-sess`,!0),function(e){t||={data:{}},t.data.algorithm=e.toUpperCase()},`qop`,_(`qop`,!0),`auth-int`,_(`auth-int`,!0),`auth`,_(`auth`,!0),function(e){t||={data:{}},t.data.qop||(t.data.qop=[]),t.data.qop.push(e.toLowerCase())},function(e){t||={data:{}},t.data.value=parseInt(e.join(``))},function(){var e,n;for(t||={data:{}},n=t.data.multi_header.length,e=0;e<n;e++)if(t.data.multi_header[e].parsed===null){t.data=null;break}t.data===null?t.data=-1:t.data=t.data.multi_header},function(){var e;t||={data:{}},t.data.multi_header||(t.data.multi_header=[]);try{e=new D(t.data.uri,t.data.displayName,t.data.params),delete t.data.uri,delete t.data.displayName,delete t.data.params}catch{e=null}t.data.multi_header.push({position:c,offset:g().start.offset,parsed:e})},function(){t||={data:{}},t.data=new D(t.data.uri,t.data.displayName,t.data.params)},function(){t||={data:{}},t.data.replaces_from_tag&&t.data.replaces_to_tag||(t.data=-1)},function(){t||={data:{}},t.data={call_id:t.data}},`from-tag`,_(`from-tag`,!0),function(e){t||={data:{}},t.data.replaces_from_tag=e},`to-tag`,_(`to-tag`,!0),function(e){t||={data:{}},t.data.replaces_to_tag=e},`early-only`,_(`early-only`,!0),function(){t||={data:{}},t.data.early_only=!0},function(e,t){return t},function(e,t){return E(e,t)},function(e){t||={data:{}},t.startRule===`Require`&&(t.data=e||[])},function(e){t||={data:{}},t.data.value=parseInt(e.join(``))},`active`,_(`active`,!0),`pending`,_(`pending`,!0),`terminated`,_(`terminated`,!0),function(){t||={data:{}},t.data.state=h()},`reason`,_(`reason`,!0),function(e){t||={data:{}},e!==void 0&&(t.data.reason=e)},function(e){t||={data:{}},e!==void 0&&(t.data.expires=e)},`retry_after`,_(`retry_after`,!0),function(e){t||={data:{}},e!==void 0&&(t.data.retry_after=e)},`deactivated`,_(`deactivated`,!0),`probation`,_(`probation`,!0),`rejected`,_(`rejected`,!0),`timeout`,_(`timeout`,!0),`giveup`,_(`giveup`,!0),`noresource`,_(`noresource`,!0),`invariant`,_(`invariant`,!0),function(e){t||={data:{}},t.startRule===`Supported`&&(t.data=e||[])},function(){t||={data:{}};var e=t.data.tag;t.data=new D(t.data.uri,t.data.displayName,t.data.params),e&&t.data.setParam(`tag`,e)},`ttl`,_(`ttl`,!0),function(e){t||={data:{}},t.data.ttl=e},`maddr`,_(`maddr`,!0),function(e){t||={data:{}},t.data.maddr=e},`received`,_(`received`,!0),function(e){t||={data:{}},t.data.received=e},`branch`,_(`branch`,!0),function(e){t||={data:{}},t.data.branch=e},`rport`,_(`rport`,!0),function(e){t||={data:{}},e!==void 0&&(t.data.rport=e.join(``))},function(e){t||={data:{}},t.data.protocol=e},_(`UDP`,!0),_(`TCP`,!0),_(`TLS`,!0),_(`SCTP`,!0),function(e){t||={data:{}},t.data.transport=e},function(){t||={data:{}},t.data.host=h()},function(e){t||={data:{}},t.data.port=parseInt(e.join(``))},function(e){return parseInt(e.join(``))},function(e){t||={data:{}},t.startRule===`Session_Expires`&&(t.data.deltaSeconds=e)},`refresher`,_(`refresher`,!1),`uas`,_(`uas`,!1),`uac`,_(`uac`,!1),function(e){t||={data:{}},t.startRule===`Session_Expires`&&(t.data.refresher=e)},function(e){t||={data:{}},t.startRule===`Min_SE`&&(t.data=e)},`stuns`,_(`stuns`,!0),`stun`,_(`stun`,!0),function(e){t||={data:{}},t.data.scheme=e},function(e){t||={data:{}},t.data.host=e},`?transport=`,_(`?transport=`,!1),`turns`,_(`turns`,!0),`turn`,_(`turn`,!0),function(e){t||={data:{}},t.data.transport=e},function(){t||={data:{}},t.data=h()},`Referred-By`,_(`Referred-By`,!1),`b`,_(`b`,!1),`cid`,_(`cid`,!1)],s=[w(`2 ""6 7!`),w(`4"""5!7#`),w(`4$""5!7%`),w(`4&""5!7'`),w(`;'.# &;(`),w(`4(""5!7)`),w(`4*""5!7+`),w(`2,""6,7-`),w(`2.""6.7/`),w(`40""5!71`),w(`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`),w(`;).# &;,`),w(`2F""6F7G.} &2H""6H7I.q &2J""6J7K.e &2L""6L7M.Y &2N""6N7O.M &2P""6P7Q.A &2R""6R7S.5 &2T""6T7U.) &2V""6V7W`),w(`%%2X""6X7Y/5#;#/,$;#/#$+#)(#'#("'#&'#/"!&,)`),w(`%%$;$0#*;$&/,#; /#$+")("'#&'#." &"/=#$;$/&#0#*;$&&&#/'$8":Z" )("'#&'#`),w(`;.." &"`),w(`%$;'.# &;(0)*;'.# &;(&/?#28""6879/0$;//'$8#:[# )(#'#("'#&'#`),w(`%%$;2/&#0#*;2&&&#/g#$%$;.0#*;.&/,#;2/#$+")("'#&'#0=*%$;.0#*;.&/,#;2/#$+")("'#&'#&/#$+")("'#&'#/"!&,)`),w(`4\\""5!7].# &;3`),w(`4^""5!7_`),w('4`""5!7a'),w(`;!.) &4b""5!7c`),w(`%$;).• &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&&&#/"!&,)`),w(`%$;).‰ &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&&&#/"!&,)`),w(`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.) &;'.# &;(`),w(`%$;).ī &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&&&#/"!&,)`),w(`%;//?#2P""6P7Q/0$;//'$8#:t# )(#'#("'#&'#`),w(`%;//?#24""6475/0$;//'$8#:u# )(#'#("'#&'#`),w(`%;//?#2>""6>7?/0$;//'$8#:v# )(#'#("'#&'#`),w(`%;//?#2T""6T7U/0$;//'$8#:w# )(#'#("'#&'#`),w(`%;//?#2V""6V7W/0$;//'$8#:x# )(#'#("'#&'#`),w(`%2h""6h7i/0#;//'$8":y" )("'#&'#`),w(`%;//6#2f""6f7g/'$8":z" )("'#&'#`),w(`%;//?#2D""6D7E/0$;//'$8#:{# )(#'#("'#&'#`),w(`%;//?#22""6273/0$;//'$8#:|# )(#'#("'#&'#`),w(`%;//?#28""6879/0$;//'$8#:}# )(#'#("'#&'#`),w(`%;//0#;&/'$8":~" )("'#&'#`),w(`%;&/0#;//'$8":~" )("'#&'#`),w(`%;=/T#$;G.) &;K.# &;F0/*;G.) &;K.# &;F&/,$;>/#$+#)(#'#("'#&'#`),w(`4""5!7€.A &4""5!7‚.5 &4ƒ""5!7„.) &;3.# &;.`),w(`%%;//Q#;&/H$$;J.# &;K0)*;J.# &;K&/,$;&/#$+$)($'#(#'#("'#&'#/"!&,)`),w(`%;//]#;&/T$%$;J.# &;K0)*;J.# &;K&/"!&,)/1$;&/($8$:…$!!)($'#(#'#("'#&'#`),w(`;..G &2L""6L7M.; &4†""5!7‡./ &4ƒ""5!7„.# &;3`),w(`%2j""6j7k/J#4ˆ""5!7‰.5 &4Š""5!7‹.) &4Œ""5!7/#$+")("'#&'#`),w(`%;N/M#28""6879/>$;O." &"/0$;S/'$8$:Ž$ )($'#(#'#("'#&'#`),w(`%;N/d#28""6879/U$;O." &"/G$;S/>$;_/5$;l." &"/'$8&:& )(&'#(%'#($'#(#'#("'#&'#`),w(`%3""5$7‘.) &3’""5#7“/' 8!:”!! )`),w(`%;P/]#%28""6879/,#;R/#$+")("'#&'#." &"/6$2:""6:7;/'$8#:•# )(#'#("'#&'#`),w(`$;+.) &;-.# &;Q/2#0/*;+.) &;-.# &;Q&&&#`),w(`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`),w(`%$;+._ &;-.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!:–! )`),w(`%;T/J#%28""6879/,#;^/#$+")("'#&'#." &"/#$+")("'#&'#`),w(`%;U.) &;\\.# &;X/& 8!:—! )`),w(`%$%;V/2#2J""6J7K/#$+")("'#&'#0<*%;V/2#2J""6J7K/#$+")("'#&'#&/D#;W/;$2J""6J7K." &"/'$8#:˜# )(#'#("'#&'#`),w(`$4™""5!7š/,#0)*4™""5!7š&&&#`),w(`%4$""5!7%/?#$4›""5!7œ0)*4›""5!7œ&/#$+")("'#&'#`),w(`%2l""6l7m/?#;Y/6$2n""6n7o/'$8#:# )(#'#("'#&'#`),w(`%%;Z/³#28""6879/¤$;Z/›$28""6879/Œ$;Z/ƒ$28""6879/t$;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+-)(-'#(,'#(+'#(*'#()'#(('#(''#(&'#(%'#($'#(#'#("'#&'#.ސ &%2ž""6ž7Ÿ/¤#;Z/›$28""6879/Œ$;Z/ƒ$28""6879/t$;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+,)(,'#(+'#(*'#()'#(('#(''#(&'#(%'#($'#(#'#("'#&'#.۹ &%2ž""6ž7Ÿ/Œ#;Z/ƒ$28""6879/t$;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+*)(*'#()'#(('#(''#(&'#(%'#($'#(#'#("'#&'#.ٺ &%2ž""6ž7Ÿ/t#;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+()(('#(''#(&'#(%'#($'#(#'#("'#&'#.ؓ &%2ž""6ž7Ÿ/\\#;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+&)(&'#(%'#($'#(#'#("'#&'#.ׄ &%2ž""6ž7Ÿ/D#;Z/;$28""6879/,$;[/#$+$)($'#(#'#("'#&'#.֍ &%2ž""6ž7Ÿ/,#;[/#$+")("'#&'#.ծ &%2ž""6ž7Ÿ/,#;Z/#$+")("'#&'#.Տ &%;Z/›#2ž""6ž7Ÿ/Œ$;Z/ƒ$28""6879/t$;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$++)(+'#(*'#()'#(('#(''#(&'#(%'#($'#(#'#("'#&'#.Ӈ &%;Z/ª#%28""6879/,#;Z/#$+")("'#&'#." &"/ƒ$2ž""6ž7Ÿ/t$;Z/k$28""6879/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+*)(*'#()'#(('#(''#(&'#(%'#($'#(#'#("'#&'#.а &%;Z/¹#%28""6879/,#;Z/#$+")("'#&'#." &"/’$%28""6879/,#;Z/#$+")("'#&'#." &"/k$2ž""6ž7Ÿ/\\$;Z/S$28""6879/D$;Z/;$28""6879/,$;[/#$+))()'#(('#(''#(&'#(%'#($'#(#'#("'#&'#.Ί &%;Z/È#%28""6879/,#;Z/#$+")("'#&'#." &"/¡$%28""6879/,#;Z/#$+")("'#&'#." &"/z$%28""6879/,#;Z/#$+")("'#&'#." &"/S$2ž""6ž7Ÿ/D$;Z/;$28""6879/,$;[/#$+()(('#(''#(&'#(%'#($'#(#'#("'#&'#.˕ &%;Z/×#%28""6879/,#;Z/#$+")("'#&'#." &"/°$%28""6879/,#;Z/#$+")("'#&'#." &"/‰$%28""6879/,#;Z/#$+")("'#&'#." &"/b$%28""6879/,#;Z/#$+")("'#&'#." &"/;$2ž""6ž7Ÿ/,$;[/#$+')(''#(&'#(%'#($'#(#'#("'#&'#.ȑ &%;Z/þ#%28""6879/,#;Z/#$+")("'#&'#." &"/×$%28""6879/,#;Z/#$+")("'#&'#." &"/°$%28""6879/,#;Z/#$+")("'#&'#." &"/‰$%28""6879/,#;Z/#$+")("'#&'#." &"/b$%28""6879/,#;Z/#$+")("'#&'#." &"/;$2ž""6ž7Ÿ/,$;Z/#$+()(('#(''#(&'#(%'#($'#(#'#("'#&'#.Ħ &%;Z/Ĝ#%28""6879/,#;Z/#$+")("'#&'#." &"/õ$%28""6879/,#;Z/#$+")("'#&'#." &"/Î$%28""6879/,#;Z/#$+")("'#&'#." &"/§$%28""6879/,#;Z/#$+")("'#&'#." &"/€$%28""6879/,#;Z/#$+")("'#&'#." &"/Y$%28""6879/,#;Z/#$+")("'#&'#." &"/2$2ž""6ž7Ÿ/#$+()(('#(''#(&'#(%'#($'#(#'#("'#&'#/& 8!:\xA0! )`),w(`%;#/M#;#." &"/?$;#." &"/1$;#." &"/#$+$)($'#(#'#("'#&'#`),w(`%;Z/;#28""6879/,$;Z/#$+#)(#'#("'#&'#.# &;\\`),w(`%;]/o#2J""6J7K/\`$;]/W$2J""6J7K/H$;]/?$2J""6J7K/0$;]/'$8':¡' )(''#(&'#(%'#($'#(#'#("'#&'#`),w(`%2¢""6¢7£/2#4¤""5!7¥/#$+")("'#&'#.˜ &%2¦""6¦7§/;#4¨""5!7©/,$;!/#$+#)(#'#("'#&'#.j &%2ª""6ª7«/5#;!/,$;!/#$+#)(#'#("'#&'#.B &%4¬""5!7­/,#;!/#$+")("'#&'#.# &;!`),w(`%%;!." &"/[#;!." &"/M$;!." &"/?$;!." &"/1$;!." &"/#$+%)(%'#($'#(#'#("'#&'#/' 8!:®!! )`),w(`$%22""6273/,#;\`/#$+")("'#&'#0<*%22""6273/,#;\`/#$+")("'#&'#&`),w(`;a.A &;b.; &;c.5 &;d./ &;e.) &;f.# &;g`),w(`%3¯""5*7°/a#3±""5#7².G &3³""5#7´.; &3µ""5$7¶./ &3·""5#7¸.# &;6/($8":¹"! )("'#&'#`),w(`%3º""5%7»/I#3¼""5%7½./ &3¾""5"7¿.# &;6/($8":À"! )("'#&'#`),w(`%3Á""5'7Â/1#;/($8":Ã"! )("'#&'#`),w(`%3Ä""5$7Å/1#;ð/($8":Æ"! )("'#&'#`),w(`%3Ç""5&7È/1#;T/($8":É"! )("'#&'#`),w(`%3Ê""5"7Ë/N#%2>""6>7?/,#;6/#$+")("'#&'#." &"/'$8":Ì" )("'#&'#`),w(`%;h/P#%2>""6>7?/,#;i/#$+")("'#&'#." &"/)$8":Í""! )("'#&'#`),w(`%$;j/&#0#*;j&&&#/"!&,)`),w(`%$;j/&#0#*;j&&&#/"!&,)`),w(`;k.) &;+.# &;-`),w(`2l""6l7m.e &2n""6n7o.Y &24""6475.M &28""6879.A &2<""6<7=.5 &2@""6@7A.) &2B""6B7C`),w(`%26""6677/n#;m/e$$%2<""6<7=/,#;m/#$+")("'#&'#0<*%2<""6<7=/,#;m/#$+")("'#&'#&/#$+#)(#'#("'#&'#`),w(`%;n/A#2>""6>7?/2$;o/)$8#:Î#"" )(#'#("'#&'#`),w(`$;p.) &;+.# &;-/2#0/*;p.) &;+.# &;-&&&#`),w(`$;p.) &;+.# &;-0/*;p.) &;+.# &;-&`),w(`2l""6l7m.e &2n""6n7o.Y &24""6475.M &26""6677.A &28""6879.5 &2@""6@7A.) &2B""6B7C`),w(`;‘.# &;r`),w(`%;/G#;'/>$;s/5$;'/,$;„/#$+%)(%'#($'#(#'#("'#&'#`),w(`;M.# &;t`),w(`%;/E#28""6879/6$;u.# &;x/'$8#:Ï# )(#'#("'#&'#`),w(`%;v.# &;w/J#%26""6677/,#;ƒ/#$+")("'#&'#." &"/#$+")("'#&'#`),w(`%2Ð""6Ð7Ñ/:#;€/1$;w." &"/#$+#)(#'#("'#&'#`),w(`%24""6475/,#;{/#$+")("'#&'#`),w(`%;z/3#$;y0#*;y&/#$+")("'#&'#`),w(`;*.) &;+.# &;-`),w(`;+. &;-.‰ &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`),w(`%;|/e#$%24""6475/,#;|/#$+")("'#&'#0<*%24""6475/,#;|/#$+")("'#&'#&/#$+")("'#&'#`),w(`%$;~0#*;~&/e#$%22""6273/,#;}/#$+")("'#&'#0<*%22""6273/,#;}/#$+")("'#&'#&/#$+")("'#&'#`),w(`$;~0#*;~&`),w(`;+.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`),w(`%%;"/‡#$;".G &;!.A &2@""6@7A.5 &2F""6F7G.) &2J""6J7K0M*;".G &;!.A &2@""6@7A.5 &2F""6F7G.) &2J""6J7K&/#$+")("'#&'#/& 8!:Ò! )`),w(`;.# &;‚`),w(`%%;O/2#2:""6:7;/#$+")("'#&'#." &"/,#;S/#$+")("'#&'#." &"`),w(`$;+.ƒ &;-.} &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&&&#`),w(`$;y0#*;y&`),w(`%3’""5#7Ó/q#24""6475/b$$;!/&#0#*;!&&&#/L$2J""6J7K/=$$;!/&#0#*;!&&&#/'$8%:Ô% )(%'#($'#(#'#("'#&'#`),w(`2Õ""6Õ7Ö`),w(`2×""6×7Ø`),w(`2Ù""6Ù7Ú`),w(`2Û""6Û7Ü`),w(`2Ý""6Ý7Þ`),w(`2ß""6ß7à`),w(`2á""6á7â`),w(`2ã""6ã7ä`),w(`2å""6å7æ`),w(`2ç""6ç7è`),w(`2é""6é7ê`),w(`%;….Y &;†.S &;ˆ.M &;‰.G &;Š.A &;‹.; &;Œ.5 &;./ &;.) &;Ž.# &;6/& 8!:ë! )`),w(`%;„/G#;'/>$;’/5$;'/,$;”/#$+%)(%'#($'#(#'#("'#&'#`),w(`%;“/' 8!:ì!! )`),w(`%;!/5#;!/,$;!/#$+#)(#'#("'#&'#`),w(`%$;*.A &;+.; &;-.5 &;3./ &;4.) &;'.# &;(0G*;*.A &;+.; &;-.5 &;3./ &;4.) &;'.# &;(&/& 8!:í! )`),w(`%;¶/Y#$%;A/,#;¶/#$+")("'#&'#06*%;A/,#;¶/#$+")("'#&'#&/#$+")("'#&'#`),w(`%;9/N#%2:""6:7;/,#;9/#$+")("'#&'#." &"/'$8":î" )("'#&'#`),w(`%;:.c &%;˜/Y#$%;A/,#;˜/#$+")("'#&'#06*%;A/,#;˜/#$+")("'#&'#&/#$+")("'#&'#/& 8!:ï! )`),w(`%;L.# &;™/]#$%;B/,#;›/#$+")("'#&'#06*%;B/,#;›/#$+")("'#&'#&/'$8":ð" )("'#&'#`),w(`%;š." &"/>#;@/5$;M/,$;?/#$+$)($'#(#'#("'#&'#`),w(`%%;6/Y#$%;./,#;6/#$+")("'#&'#06*%;./,#;6/#$+")("'#&'#&/#$+")("'#&'#.# &;H/' 8!:ñ!! )`),w(`;œ.) &;.# &;\xA0`),w(`%3ò""5!7ó/:#;</1$;Ÿ/($8#:ô#! )(#'#("'#&'#`),w(`%3õ""5'7ö/:#;</1$;ž/($8#:÷#! )(#'#("'#&'#`),w(`%$;!/&#0#*;!&&&#/' 8!:ø!! )`),w(`%2ù""6ù7ú/o#%2J""6J7K/M#;!." &"/?$;!." &"/1$;!." &"/#$+$)($'#(#'#("'#&'#." &"/'$8":û" )("'#&'#`),w(`%;6/J#%;</,#;¡/#$+")("'#&'#." &"/)$8":ü""! )("'#&'#`),w(`;6.) &;T.# &;H`),w(`%;£/Y#$%;B/,#;¤/#$+")("'#&'#06*%;B/,#;¤/#$+")("'#&'#&/#$+")("'#&'#`),w(`%3ý""5&7þ.G &3ÿ""5'7Ā.; &3ā""5$7Ă./ &3ă""5%7Ą.# &;6/& 8!:ą! )`),w(`;¥.# &;\xA0`),w(`%3Ć""5(7ć/M#;</D$3Ĉ""5(7ĉ./ &3Ċ""5(7ċ.# &;6/#$+#)(#'#("'#&'#`),w(`%;6/Y#$%;A/,#;6/#$+")("'#&'#06*%;A/,#;6/#$+")("'#&'#&/#$+")("'#&'#`),w(`%$;!/&#0#*;!&&&#/' 8!:Č!! )`),w(`%;©/& 8!:č! )`),w(`%;ª/k#;;/b$;¯/Y$$%;B/,#;°/#$+")("'#&'#06*%;B/,#;°/#$+")("'#&'#&/#$+$)($'#(#'#("'#&'#`),w(`;«.# &;¬`),w(`3Ď""5$7ď.S &3Đ""5%7đ.G &3Ē""5%7ē.; &3Ĕ""5%7ĕ./ &3Ė""5+7ė.# &;­`),w(`3Ę""5'7ę./ &3Ě""5)7ě.# &;­`),w(`;6.# &;®`),w(`%3Ĝ""5"7ĝ/,#;6/#$+")("'#&'#`),w(`;­.# &;6`),w(`%;6/5#;</,$;±/#$+#)(#'#("'#&'#`),w(`;6.# &;H`),w(`%;³/5#;./,$;/#$+#)(#'#("'#&'#`),w(`%$;!/&#0#*;!&&&#/' 8!:Ğ!! )`),w(`%;ž/' 8!:ğ!! )`),w(`%;¶/^#$%;B/,#;\xA0/#$+")("'#&'#06*%;B/,#;\xA0/#$+")("'#&'#&/($8":Ġ"!!)("'#&'#`),w(`%%;7/e#$%2J""6J7K/,#;7/#$+")("'#&'#0<*%2J""6J7K/,#;7/#$+")("'#&'#&/#$+")("'#&'#/"!&,)`),w(`%;L.# &;™/]#$%;B/,#;¸/#$+")("'#&'#06*%;B/,#;¸/#$+")("'#&'#&/'$8":ġ" )("'#&'#`),w(`;¹.# &;\xA0`),w(`%3Ģ""5#7ģ/:#;</1$;6/($8#:Ĥ#! )(#'#("'#&'#`),w(`%$;!/&#0#*;!&&&#/' 8!:ĥ!! )`),w(`%;ž/' 8!:Ħ!! )`),w(`%$;š0#*;š&/x#;@/o$;M/f$;?/]$$%;B/,#;\xA0/#$+")("'#&'#06*%;B/,#;\xA0/#$+")("'#&'#&/'$8%:ħ% )(%'#($'#(#'#("'#&'#`),w(`;¾`),w(`%3Ĩ""5&7ĩ/k#;./b$;Á/Y$$%;A/,#;Á/#$+")("'#&'#06*%;A/,#;Á/#$+")("'#&'#&/#$+$)($'#(#'#("'#&'#.# &;¿`),w(`%;6/k#;./b$;À/Y$$%;A/,#;À/#$+")("'#&'#06*%;A/,#;À/#$+")("'#&'#&/#$+$)($'#(#'#("'#&'#`),w(`%;6/;#;</2$;6.# &;H/#$+#)(#'#("'#&'#`),w(`;Â.G &;Ä.A &;Æ.; &;È.5 &;É./ &;Ê.) &;Ë.# &;À`),w(`%3Ī""5%7ī/5#;</,$;Ã/#$+#)(#'#("'#&'#`),w(`%;I/' 8!:Ĭ!! )`),w(`%3ĭ""5&7Į/—#;</Ž$;D/…$;Å/|$$%$;'/&#0#*;'&&&#/,#;Å/#$+")("'#&'#0C*%$;'/&#0#*;'&&&#/,#;Å/#$+")("'#&'#&/,$;E/#$+&)(&'#(%'#($'#(#'#("'#&'#`),w(`;t.# &;w`),w(`%3į""5%7İ/5#;</,$;Ç/#$+#)(#'#("'#&'#`),w(`%;I/' 8!:ı!! )`),w(`%3IJ""5&7ij/:#;</1$;I/($8#:Ĵ#! )(#'#("'#&'#`),w(`%3ĵ""5%7Ķ/]#;</T$%3ķ""5$7ĸ/& 8!:Ĺ! ).4 &%3ĺ""5%7Ļ/& 8!:ļ! )/#$+#)(#'#("'#&'#`),w(`%3Ľ""5)7ľ/R#;</I$3Ŀ""5#7ŀ./ &3Ł""5(7ł.# &;6/($8#:Ń#! )(#'#("'#&'#`),w(`%3ń""5#7Ņ/“#;</Š$;D/$%;Ì/e#$%2D""6D7E/,#;Ì/#$+")("'#&'#0<*%2D""6D7E/,#;Ì/#$+")("'#&'#&/#$+")("'#&'#/,$;E/#$+%)(%'#($'#(#'#("'#&'#`),w(`%3ņ""5(7Ň./ &3ň""5$7ʼn.# &;6/' 8!:Ŋ!! )`),w(`%;6/Y#$%;A/,#;6/#$+")("'#&'#06*%;A/,#;6/#$+")("'#&'#&/#$+")("'#&'#`),w(`%;Ï/G#;./>$;Ï/5$;./,$;/#$+%)(%'#($'#(#'#("'#&'#`),w(`%$;!/&#0#*;!&&&#/' 8!:ŋ!! )`),w(`%;Ñ/]#$%;A/,#;Ñ/#$+")("'#&'#06*%;A/,#;Ñ/#$+")("'#&'#&/'$8":Ō" )("'#&'#`),w(`%;™/]#$%;B/,#;\xA0/#$+")("'#&'#06*%;B/,#;\xA0/#$+")("'#&'#&/'$8":ō" )("'#&'#`),w(`%;L.O &;™.I &%;@." &"/:#;t/1$;?." &"/#$+#)(#'#("'#&'#/]#$%;B/,#;\xA0/#$+")("'#&'#06*%;B/,#;\xA0/#$+")("'#&'#&/'$8":Ŏ" )("'#&'#`),w(`%;Ô/]#$%;B/,#;Õ/#$+")("'#&'#06*%;B/,#;Õ/#$+")("'#&'#&/'$8":ŏ" )("'#&'#`),w(`%;–/& 8!:Ő! )`),w(`%3ő""5(7Œ/:#;</1$;6/($8#:œ#! )(#'#("'#&'#.g &%3Ŕ""5&7ŕ/:#;</1$;6/($8#:Ŗ#! )(#'#("'#&'#.: &%3ŗ""5*7Ř/& 8!:ř! ).# &;\xA0`),w(`%%;6/k#$%;A/2#;6/)$8":Ś""$ )("'#&'#0<*%;A/2#;6/)$8":Ś""$ )("'#&'#&/)$8":ś""! )("'#&'#." &"/' 8!:Ŝ!! )`),w(`%;Ø/Y#$%;A/,#;Ø/#$+")("'#&'#06*%;A/,#;Ø/#$+")("'#&'#&/#$+")("'#&'#`),w(`%;™/Y#$%;B/,#;\xA0/#$+")("'#&'#06*%;B/,#;\xA0/#$+")("'#&'#&/#$+")("'#&'#`),w(`%$;!/&#0#*;!&&&#/' 8!:ŝ!! )`),w(`%;Û/Y#$%;B/,#;Ü/#$+")("'#&'#06*%;B/,#;Ü/#$+")("'#&'#&/#$+")("'#&'#`),w(`%3Ş""5&7ş.; &3Š""5'7š./ &3Ţ""5*7ţ.# &;6/& 8!:Ť! )`),w(`%3ť""5&7Ŧ/:#;</1$;Ý/($8#:ŧ#! )(#'#("'#&'#.} &%3õ""5'7ö/:#;</1$;ž/($8#:Ũ#! )(#'#("'#&'#.P &%3ũ""5+7Ū/:#;</1$;ž/($8#:ū#! )(#'#("'#&'#.# &;\xA0`),w(`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`),w(`;1." &"`),w(`%%;6/k#$%;A/2#;6/)$8":Ś""$ )("'#&'#0<*%;A/2#;6/)$8":Ś""$ )("'#&'#&/)$8":ś""! )("'#&'#." &"/' 8!:ź!! )`),w(`%;L.# &;™/]#$%;B/,#;á/#$+")("'#&'#06*%;B/,#;á/#$+")("'#&'#&/'$8":Ż" )("'#&'#`),w(`;¹.# &;\xA0`),w(`%;ã/Y#$%;A/,#;ã/#$+")("'#&'#06*%;A/,#;ã/#$+")("'#&'#&/#$+")("'#&'#`),w(`%;ê/k#;./b$;í/Y$$%;B/,#;ä/#$+")("'#&'#06*%;B/,#;ä/#$+")("'#&'#&/#$+$)($'#(#'#("'#&'#`),w(`;å.; &;æ.5 &;ç./ &;è.) &;é.# &;\xA0`),w(`%3ż""5#7Ž/:#;</1$;ð/($8#:ž#! )(#'#("'#&'#`),w(`%3ſ""5%7ƀ/:#;</1$;T/($8#:Ɓ#! )(#'#("'#&'#`),w(`%3Ƃ""5(7ƃ/F#;</=$;\\.) &;Y.# &;X/($8#:Ƅ#! )(#'#("'#&'#`),w(`%3ƅ""5&7Ɔ/:#;</1$;6/($8#:Ƈ#! )(#'#("'#&'#`),w(`%3ƈ""5%7Ɖ/A#;</8$$;!0#*;!&/($8#:Ɗ#! )(#'#("'#&'#`),w(`%;ë/G#;;/>$;6/5$;;/,$;ì/#$+%)(%'#($'#(#'#("'#&'#`),w(`%3’""5#7Ó.# &;6/' 8!:Ƌ!! )`),w(`%3±""5#7ƌ.G &3³""5#7ƍ.; &3·""5#7Ǝ./ &3µ""5$7Ə.# &;6/' 8!:Ɛ!! )`),w(`%;î/D#%;C/,#;ï/#$+")("'#&'#." &"/#$+")("'#&'#`),w(`%;U.) &;\\.# &;X/& 8!:Ƒ! )`),w(`%%;!." &"/[#;!." &"/M$;!." &"/?$;!." &"/1$;!." &"/#$+%)(%'#($'#(#'#("'#&'#/' 8!:ƒ!! )`),w(`%%;!/?#;!." &"/1$;!." &"/#$+#)(#'#("'#&'#/' 8!:Ɠ!! )`),w(`;¾`),w(`%;ž/^#$%;B/,#;ó/#$+")("'#&'#06*%;B/,#;ó/#$+")("'#&'#&/($8":Ɣ"!!)("'#&'#`),w(`;ô.# &;\xA0`),w(`%2ƕ""6ƕ7Ɩ/L#;</C$2Ɨ""6Ɨ7Ƙ.) &2ƙ""6ƙ7ƚ/($8#:ƛ#! )(#'#("'#&'#`),w(`%;ž/^#$%;B/,#;\xA0/#$+")("'#&'#06*%;B/,#;\xA0/#$+")("'#&'#&/($8":Ɯ"!!)("'#&'#`),w(`%;6/5#;0/,$;÷/#$+#)(#'#("'#&'#`),w(`$;2.) &;4.# &;.0/*;2.) &;4.# &;.&`),w(`$;%0#*;%&`),w(`%;ú/;#28""6879/,$;û/#$+#)(#'#("'#&'#`),w(`%3Ɲ""5%7ƞ.) &3Ɵ""5$7Ơ/' 8!:ơ!! )`),w(`%;ü/J#%28""6879/,#;^/#$+")("'#&'#." &"/#$+")("'#&'#`),w(`%;\\.) &;X.# &;‚/' 8!:Ƣ!! )`),w(`;".S &;!.M &2F""6F7G.A &2J""6J7K.5 &2H""6H7I.) &2N""6N7O`),w(`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?`),w(`%;Ā/b#28""6879/S$;û/J$%2ƣ""6ƣ7Ƥ/,#;ì/#$+")("'#&'#." &"/#$+$)($'#(#'#("'#&'#`),w(`%3ƥ""5%7Ʀ.) &3Ƨ""5$7ƨ/' 8!:ơ!! )`),w(`%3±""5#7².6 &3³""5#7´.* &$;+0#*;+&/' 8!:Ʃ!! )`),w(`%;Ą/‡#2F""6F7G/x$;ă/o$2F""6F7G/\`$;ă/W$2F""6F7G/H$;ă/?$2F""6F7G/0$;ą/'$8):ƪ) )()'#(('#(''#(&'#(%'#($'#(#'#("'#&'#`),w(`%;#/>#;#/5$;#/,$;#/#$+$)($'#(#'#("'#&'#`),w(`%;ă/,#;ă/#$+")("'#&'#`),w(`%;ă/5#;ă/,$;ă/#$+#)(#'#("'#&'#`),w(`%;q/T#$;m0#*;m&/D$%; /,#;ø/#$+")("'#&'#." &"/#$+#)(#'#("'#&'#`),w(`%2ƫ""6ƫ7Ƭ.) &2ƭ""6ƭ7Ʈ/w#;0/n$;Ĉ/e$$%;B/2#;ĉ.# &;\xA0/#$+")("'#&'#0<*%;B/2#;ĉ.# &;\xA0/#$+")("'#&'#&/#$+$)($'#(#'#("'#&'#`),w(`;™.# &;L`),w(`%2Ư""6Ư7ư/5#;</,$;Ċ/#$+#)(#'#("'#&'#`),w(`%;D/S#;,/J$2:""6:7;/;$;,.# &;T/,$;E/#$+%)(%'#($'#(#'#("'#&'#`)],c=0,l=0,u=[{line:1,column:1}],d=0,f=[],p=0,m;if(t.startRule!==void 0){if(!(t.startRule in i))throw Error(`Can't start parsing from rule "`+t.startRule+`".`);a=i[t.startRule]}function h(){return e.substring(l,c)}function g(){return x(l,c)}function _(e,t){return{type:`literal`,text:e,ignoreCase:t}}function v(e,t,n){return{type:`class`,parts:e,inverted:t,ignoreCase:n}}function y(){return{type:`end`}}function b(t){let n=u[t],r;if(n)return n;for(r=t-1;!u[r];)r--;for(n=u[r],n={line:n.line,column:n.column};r<t;)e.charCodeAt(r)===10?(n.line++,n.column=1):n.column++,r++;return u[t]=n,n}function x(e,t){let n=b(e),i=b(t);return{source:r,start:{offset:e,line:n.line,column:n.column},end:{offset:t,line:i.line,column:i.column}}}function S(e){c<d||(c>d&&(d=c,f=[]),f.push(e))}function C(e,t,n){return new k(k.buildMessage(e,t),e,t,n)}function w(e){return e.split(``).map(e=>e.charCodeAt(0)-32)}function T(t){let r=s[t],i=0,a=[],u=r.length,d=[],f=[],m;for(;;){for(;i<u;)switch(r[i]){case 0:f.push(o[r[i+1]]),i+=2;break;case 1:f.push(void 0),i++;break;case 2:f.push(null),i++;break;case 3:f.push(n),i++;break;case 4:f.push([]),i++;break;case 5:f.push(c),i++;break;case 6:f.pop(),i++;break;case 7:c=f.pop(),i++;break;case 8:f.length-=r[i+1],i+=2;break;case 9:f.splice(-2,1),i++;break;case 10:f[f.length-2].push(f.pop()),i++;break;case 11:f.push(f.splice(f.length-r[i+1],r[i+1])),i+=2;break;case 12:f.push(e.substring(f.pop(),c)),i++;break;case 13:d.push(u),a.push(i+3+r[i+1]+r[i+2]),f[f.length-1]?(u=i+3+r[i+1],i+=3):(u=i+3+r[i+1]+r[i+2],i+=3+r[i+1]);break;case 14:d.push(u),a.push(i+3+r[i+1]+r[i+2]),f[f.length-1]===n?(u=i+3+r[i+1],i+=3):(u=i+3+r[i+1]+r[i+2],i+=3+r[i+1]);break;case 15:d.push(u),a.push(i+3+r[i+1]+r[i+2]),f[f.length-1]===n?(u=i+3+r[i+1]+r[i+2],i+=3+r[i+1]):(u=i+3+r[i+1],i+=3);break;case 16:f[f.length-1]===n?i+=2+r[i+1]:(d.push(u),a.push(i),u=i+2+r[i+1],i+=2);break;case 17:d.push(u),a.push(i+3+r[i+1]+r[i+2]),e.length>c?(u=i+3+r[i+1],i+=3):(u=i+3+r[i+1]+r[i+2],i+=3+r[i+1]);break;case 18:d.push(u),a.push(i+4+r[i+2]+r[i+3]),e.substr(c,o[r[i+1]].length)===o[r[i+1]]?(u=i+4+r[i+2],i+=4):(u=i+4+r[i+2]+r[i+3],i+=4+r[i+2]);break;case 19:d.push(u),a.push(i+4+r[i+2]+r[i+3]),e.substr(c,o[r[i+1]].length).toLowerCase()===o[r[i+1]]?(u=i+4+r[i+2],i+=4):(u=i+4+r[i+2]+r[i+3],i+=4+r[i+2]);break;case 20:d.push(u),a.push(i+4+r[i+2]+r[i+3]),o[r[i+1]].test(e.charAt(c))?(u=i+4+r[i+2],i+=4):(u=i+4+r[i+2]+r[i+3],i+=4+r[i+2]);break;case 21:f.push(e.substr(c,r[i+1])),c+=r[i+1],i+=2;break;case 22:f.push(o[r[i+1]]),c+=o[r[i+1]].length,i+=2;break;case 23:f.push(n),p===0&&S(o[r[i+1]]),i+=2;break;case 24:l=f[f.length-1-r[i+1]],i+=2;break;case 25:l=c,i++;break;case 26:m=r.slice(i+4,i+4+r[i+3]).map(function(e){return f[f.length-1-e]}),f.splice(f.length-r[i+2],r[i+2],o[r[i+1]].apply(null,m)),i+=4+r[i+3];break;case 27:f.push(T(r[i+1])),i+=2;break;case 28:p++,i++;break;case 29:p--,i++;break;default:throw Error(`Invalid opcode: `+r[i]+`.`)}if(d.length>0)u=d.pop(),i=a.pop();else break}return f[0]}t.data={};function E(e,t){return[e].concat(t)}if(m=T(a),m!==n&&c===e.length)return m;throw m!==n&&c<e.length&&S(y()),C(f,d<e.length?e.charAt(d):null,d<e.length?x(d,d+1):x(d,d))}let ie=re;var A;(function(e){function t(e,t){let n={startRule:t};try{ie(e,n)}catch{n.data=-1}return n.data}e.parse=t;function n(t){let n=e.parse(t,`Name_Addr_Header`);return n===-1?void 0:n}e.nameAddrHeaderParse=n;function r(t){let n=e.parse(t,`SIP_URI`);return n===-1?void 0:n}e.URIParse=r})(A=A||={});var j={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 ae(e,t=32){let n=``;for(let r=0;r<e;r++){let e=Math.floor(Math.random()*t);n+=e.toString(t)}return n}function oe(e){return j[e]||``}function se(){return ae(10)}function ce(e){let 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,i=``;for(let e=0;e<r;e++)e!==0&&(i+=`-`),i+=n[e].charAt(0).toUpperCase()+n[e].substring(1);return t[i]&&(i=t[i]),i}function M(e){return encodeURIComponent(e).replace(/%[A-F\d]{2}/g,`U`).length}var N=class{constructor(){this.headers={}}addHeader(e,t){let n={raw:t};e=ce(e),this.headers[e]?this.headers[e].push(n):this.headers[e]=[n]}getHeader(e){let t=this.headers[ce(e)];if(t){if(t[0])return t[0].raw}else return}getHeaders(e){let t=this.headers[ce(e)],n=[];if(!t)return[];for(let e of t)n.push(e.raw);return n}hasHeader(e){return!!this.headers[ce(e)]}parseHeader(e,t=0){if(e=ce(e),this.headers[e]){if(t>=this.headers[e].length)return}else return;let n=this.headers[e][t],r=n.raw;if(n.parsed)return n.parsed;let i=A.parse(r,e.replace(/-/g,`_`));if(i===-1){this.headers[e].splice(t,1);return}else return n.parsed=i,i}s(e,t=0){return this.parseHeader(e,t)}setHeader(e,t){this.headers[ce(e)]=[{raw:t}]}toString(){return this.data}},le=class extends N{constructor(){super()}},ue=class extends N{constructor(){super()}},P=class e{constructor(t,n,r,i,a,o,s){this.headers={},this.extraHeaders=[],this.options=e.getDefaultOptions(),a&&(this.options=Object.assign(Object.assign({},this.options),a),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())),o&&o.length&&(this.extraHeaders=o.slice()),s&&(this.body={body:s.content,contentType:s.contentType}),this.method=t,this.ruri=n.clone(),this.fromURI=r.clone(),this.fromTag=this.options.fromTag?this.options.fromTag:se(),this.from=e.makeNameAddrHeader(this.fromURI,this.options.fromDisplayName,this.fromTag),this.toURI=i.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+ae(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`)}static getDefaultOptions(){return{callId:``,callIdPrefix:``,cseq:1,toDisplayName:``,toTag:``,fromDisplayName:``,fromTag:``,forceRport:!1,hackViaTcp:!1,optionTags:[`outbound`],routeSet:[],userAgentString:`sip.js`,viaHost:``}}static makeNameAddrHeader(e,t,n){let r={};return n&&(r.tag=n),new D(e,t,r)}getHeader(e){let t=this.headers[ce(e)];if(t){if(t[0])return t[0]}else{let t=RegExp(`^\\s*`+e+`\\s*:`,`i`);for(let e of this.extraHeaders)if(t.test(e))return e.substring(e.indexOf(`:`)+1).trim()}}getHeaders(e){let t=[],n=this.headers[ce(e)];if(n)for(let e of n)t.push(e);else{let n=RegExp(`^\\s*`+e+`\\s*:`,`i`);for(let e of this.extraHeaders)n.test(e)&&t.push(e.substring(e.indexOf(`:`)+1).trim())}return t}hasHeader(e){if(this.headers[ce(e)])return!0;{let t=RegExp(`^\\s*`+e+`\\s*:`,`i`);for(let e of this.extraHeaders)if(t.test(e))return!0}return!1}setHeader(e,t){this.headers[ce(e)]=t instanceof Array?t:[t]}setViaHeader(e,t){this.options.hackViaTcp&&(t=`TCP`);let n=`SIP/2.0/`+t;n+=` `+this.options.viaHost+`;branch=`+e,this.options.forceRport&&(n+=`;rport`),this.setHeader(`via`,n),this.branch=e}toString(){let e=``;for(let t in e+=this.method+` `+this.ruri.toRaw()+` SIP/2.0\r
10
10
  `,this.headers)if(this.headers[t])for(let n of this.headers[t])e+=t+`: `+n+`\r
11
11
  `;for(let t of this.extraHeaders)e+=t.trim()+`\r
12
12
  `;return e+=`Supported: `+this.options.optionTags.join(`, `)+`\r
@@ -20,9 +20,9 @@
20
20
  \r
21
21
  `:e+=`Content-Length: 0\r
22
22
  \r
23
- `,e}};function fe(e){return e===`application/sdp`?`session`:`render`}function pe(e){let t=typeof e==`string`?e:e.body,n=typeof e==`string`?`application/sdp`:e.contentType;return{contentDisposition:fe(n),contentType:n,content:t}}function me(e){return e&&typeof e.content==`string`&&typeof e.contentType==`string`&&e.contentDisposition===void 0?!0:typeof e.contentDisposition==`string`}function he(e){let t,n,r;if(e instanceof ue&&e.body){let i=e.parseHeader(`Content-Disposition`);t=i?i.type:void 0,n=e.parseHeader(`Content-Type`),r=e.body}if(e instanceof de&&e.body){let i=e.parseHeader(`Content-Disposition`);t=i?i.type:void 0,n=e.parseHeader(`Content-Type`),r=e.body}if(e instanceof N&&e.body)if(t=e.getHeader(`Content-Disposition`),n=e.getHeader(`Content-Type`),typeof e.body==`string`){if(!n)throw Error(`Header content type header does not equal body content type.`);r=e.body}else{if(n&&n!==e.body.contentType)throw Error(`Header content type header does not equal body content type.`);n=e.body.contentType,r=e.body.body}if(me(e)&&(t=e.contentDisposition,n=e.contentType,r=e.content),r){if(n&&!t&&(t=fe(n)),!t)throw Error(`Content disposition undefined.`);if(!n)throw Error(`Content type undefined.`);return{contentDisposition:t,contentType:n,content:r}}}var ge;(function(e){e.Initial=`Initial`,e.Early=`Early`,e.AckWait=`AckWait`,e.Confirmed=`Confirmed`,e.Terminated=`Terminated`})(ge=ge||={});var P;(function(e){e.Initial=`Initial`,e.HaveLocalOffer=`HaveLocalOffer`,e.HaveRemoteOffer=`HaveRemoteOffer`,e.Stable=`Stable`,e.Closed=`Closed`})(P=P||={});var _e=500,ve=4e3,ye=5e3;let F={T1:_e,T2:ve,T4:ye,TIMER_B:64*_e,TIMER_D:0*_e,TIMER_F:64*_e,TIMER_H:64*_e,TIMER_I:0*ye,TIMER_J:0*_e,TIMER_K:0*ye,TIMER_L:64*_e,TIMER_M:64*_e,TIMER_N:64*_e,PROVISIONAL_RESPONSE_INTERVAL:6e4};var be=class extends g{constructor(e){super(e||`Transaction state error.`)}},I;(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`})(I=I||={});let xe=[I.ACK,I.BYE,I.CANCEL,I.INFO,I.INVITE,I.MESSAGE,I.NOTIFY,I.OPTIONS,I.PRACK,I.REFER,I.REGISTER,I.SUBSCRIBE];var Se=class{constructor(e){this.incomingMessageRequest=e}get request(){return this.incomingMessageRequest.message}accept(e){return this.incomingMessageRequest.accept(e),Promise.resolve()}reject(e){return this.incomingMessageRequest.reject(e),Promise.resolve()}},Ce=class{constructor(e){this.incomingNotifyRequest=e}get request(){return this.incomingNotifyRequest.message}accept(e){return this.incomingNotifyRequest.accept(e),Promise.resolve()}reject(e){return this.incomingNotifyRequest.reject(e),Promise.resolve()}},we=class{constructor(e,t){this.incomingReferRequest=e,this.session=t}get referTo(){let e=this.incomingReferRequest.message.parseHeader(`refer-to`);if(!(e instanceof D))throw Error(`Failed to parse Refer-To header.`);return e}get referredBy(){return this.incomingReferRequest.message.getHeader(`referred-by`)}get replaces(){let e=this.referTo.uri.getHeader(`replaces`);return e instanceof Array?e[0]:e}get request(){return this.incomingReferRequest.message}accept(e={statusCode:202}){return this.incomingReferRequest.accept(e),Promise.resolve()}reject(e){return this.incomingReferRequest.reject(e),Promise.resolve()}makeInviter(e){if(this.inviter)return this.inviter;let t=this.referTo.uri.clone();t.clearHeaders(),e||={};let n=(e.extraHeaders||[]).slice(),r=this.replaces;r&&n.push(`Replaces: `+decodeURIComponent(r));let i=this.referredBy;return i&&n.push(`Referred-By: `+i),e.extraHeaders=n,this.inviter=this.session.userAgent._makeInviter(t,e),this.inviter._referred=this.session,this.session._referral=this.inviter,this.inviter}},L;(function(e){e.Initial=`Initial`,e.Establishing=`Establishing`,e.Established=`Established`,e.Terminating=`Terminating`,e.Terminated=`Terminated`})(L=L||={});var Te=class e{constructor(e,t={}){this.pendingReinvite=!1,this.pendingReinviteAck=!1,this._state=L.Initial,this.delegate=t.delegate,this._stateEventEmitter=new T,this._userAgent=e}dispose(){switch(this.logger.log(`Session ${this.id} in state ${this._state} is being disposed`),delete this.userAgent._sessions[this.id],this._sessionDescriptionHandler&&this._sessionDescriptionHandler.close(),this.state){case L.Initial:break;case L.Establishing:break;case L.Established:return new Promise(e=>{this._bye({onAccept:()=>e(),onRedirect:()=>e(),onReject:()=>e()})});case L.Terminating:break;case L.Terminated:break;default:throw Error(`Unknown state.`)}return Promise.resolve()}get assertedIdentity(){return this._assertedIdentity}get dialog(){return this._dialog}get id(){return this._id}get replacee(){return this._replacee}get sessionDescriptionHandler(){return this._sessionDescriptionHandler}get sessionDescriptionHandlerFactory(){return this.userAgent.configuration.sessionDescriptionHandlerFactory}get sessionDescriptionHandlerModifiers(){return this._sessionDescriptionHandlerModifiers||[]}set sessionDescriptionHandlerModifiers(e){this._sessionDescriptionHandlerModifiers=e.slice()}get sessionDescriptionHandlerOptions(){return this._sessionDescriptionHandlerOptions||{}}set sessionDescriptionHandlerOptions(e){this._sessionDescriptionHandlerOptions=Object.assign({},e)}get sessionDescriptionHandlerModifiersReInvite(){return this._sessionDescriptionHandlerModifiersReInvite||[]}set sessionDescriptionHandlerModifiersReInvite(e){this._sessionDescriptionHandlerModifiersReInvite=e.slice()}get sessionDescriptionHandlerOptionsReInvite(){return this._sessionDescriptionHandlerOptionsReInvite||{}}set sessionDescriptionHandlerOptionsReInvite(e){this._sessionDescriptionHandlerOptionsReInvite=Object.assign({},e)}get state(){return this._state}get stateChange(){return this._stateEventEmitter}get userAgent(){return this._userAgent}bye(e={}){let t=`Session.bye() may only be called if established session.`;switch(this.state){case L.Initial:typeof this.cancel==`function`?(t+=` However Inviter.invite() has not yet been called.`,t+=` Perhaps you should have called Inviter.cancel()?`):typeof this.reject==`function`&&(t+=` However Invitation.accept() has not yet been called.`,t+=` Perhaps you should have called Invitation.reject()?`);break;case L.Establishing:typeof this.cancel==`function`?(t+=` However a dialog does not yet exist.`,t+=` Perhaps you should have called Inviter.cancel()?`):typeof this.reject==`function`&&(t+=` However Invitation.accept() has not yet been called (or not yet resolved).`,t+=` Perhaps you should have called Invitation.reject()?`);break;case L.Established:{let t=e.requestDelegate,n=this.copyRequestOptions(e.requestOptions);return this._bye(t,n)}case L.Terminating:t+=` However this session is already terminating.`,typeof this.cancel==`function`?t+=` Perhaps you have already called Inviter.cancel()?`:typeof this.reject==`function`&&(t+=` Perhaps you have already called Session.bye()?`);break;case L.Terminated:t+=` However this session is already terminated.`;break;default:throw Error(`Unknown state`)}return this.logger.error(t),Promise.reject(Error(`Invalid session state ${this.state}`))}info(e={}){if(this.state!==L.Established)return this.logger.error(`Session.info() may only be called if established session.`),Promise.reject(Error(`Invalid session state ${this.state}`));let t=e.requestDelegate,n=this.copyRequestOptions(e.requestOptions);return this._info(t,n)}invite(e={}){if(this.logger.log(`Session.invite`),this.state!==L.Established)return Promise.reject(Error(`Invalid session state ${this.state}`));if(this.pendingReinvite)return Promise.reject(new v(`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);let t={onAccept:t=>{let n=he(t.message);if(!n){this.logger.error(`Received 2xx response to re-INVITE without a session description`),this.ackAndBye(t,400,`Missing session description`),this.stateTransition(L.Terminated),this.pendingReinvite=!1;return}if(e.withoutSdp){let r={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptionsReInvite,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiersReInvite};this.setOfferAndGetAnswer(n,r).then(e=>{t.ack({body:e})}).catch(e=>{this.logger.error(`Failed to handle offer in 2xx response to re-INVITE`),this.logger.error(e.message),this.state===L.Terminated?t.ack():(this.ackAndBye(t,488,`Bad Media Description`),this.stateTransition(L.Terminated))}).then(()=>{this.pendingReinvite=!1,e.requestDelegate&&e.requestDelegate.onAccept&&e.requestDelegate.onAccept(t)})}else{let r={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptionsReInvite,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiersReInvite};this.setAnswer(n,r).then(()=>{t.ack()}).catch(e=>{this.logger.error(`Failed to handle answer in 2xx response to re-INVITE`),this.logger.error(e.message),this.state===L.Terminated?t.ack():(this.ackAndBye(t,488,`Bad Media Description`),this.stateTransition(L.Terminated))}).then(()=>{this.pendingReinvite=!1,e.requestDelegate&&e.requestDelegate.onAccept&&e.requestDelegate.onAccept(t)})}},onProgress:e=>{},onRedirect:e=>{},onReject:t=>{this.logger.warn(`Received a non-2xx response to re-INVITE`),this.pendingReinvite=!1,e.withoutSdp?e.requestDelegate&&e.requestDelegate.onReject&&e.requestDelegate.onReject(t):this.rollbackOffer().catch(e=>{if(this.logger.error(`Failed to rollback offer on non-2xx response to re-INVITE`),this.logger.error(e.message),this.state!==L.Terminated){if(!this.dialog)throw Error(`Dialog undefined.`);let e=[];e.push(`Reason: `+this.getReasonHeaderValue(500,`Internal Server Error`)),this.dialog.bye(void 0,{extraHeaders:e}),this.stateTransition(L.Terminated)}}).then(()=>{e.requestDelegate&&e.requestDelegate.onReject&&e.requestDelegate.onReject(t)})},onTrying:e=>{}},n=e.requestOptions||{};if(n.extraHeaders=(n.extraHeaders||[]).slice(),n.extraHeaders.push(`Allow: `+xe.toString()),n.extraHeaders.push(`Contact: `+this._contact),e.withoutSdp){if(!this.dialog)throw this.pendingReinvite=!1,Error(`Dialog undefined.`);return Promise.resolve(this.dialog.invite(t,n))}let r={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptionsReInvite,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiersReInvite};return this.getOffer(r).then(e=>{if(!this.dialog)throw this.pendingReinvite=!1,Error(`Dialog undefined.`);return n.body=e,this.dialog.invite(t,n)}).catch(e=>{throw this.logger.error(e.message),this.logger.error(`Failed to send re-INVITE`),this.pendingReinvite=!1,e})}message(e={}){if(this.state!==L.Established)return this.logger.error(`Session.message() may only be called if established session.`),Promise.reject(Error(`Invalid session state ${this.state}`));let t=e.requestDelegate,n=this.copyRequestOptions(e.requestOptions);return this._message(t,n)}refer(t,n={}){if(this.state!==L.Established)return this.logger.error(`Session.refer() may only be called if established session.`),Promise.reject(Error(`Invalid session state ${this.state}`));if(t instanceof e&&!t.dialog)return this.logger.error(`Session.refer() may only be called with session which is established. You are perhaps attempting to attended transfer to a target for which there is not dialog yet established. Perhaps you are attempting a 'semi-attended' tansfer? Regardless, this is not supported. The recommended approached is to check to see if the target Session is in the Established state before calling refer(); if the state is not Established you may proceed by falling back using a URI as the target (blind transfer).`),Promise.reject(Error(`Invalid session state ${this.state}`));let r=n.requestDelegate,i=this.copyRequestOptions(n.requestOptions);return i.extraHeaders=i.extraHeaders?i.extraHeaders.concat(this.referExtraHeaders(this.referToString(t))):this.referExtraHeaders(this.referToString(t)),this._refer(n.onNotify,r,i)}_bye(e,t){if(!this.dialog)return Promise.reject(Error(`Session dialog undefined.`));let n=this.dialog;switch(n.sessionState){case ge.Initial:throw Error(`Invalid dialog state ${n.sessionState}`);case ge.Early:throw Error(`Invalid dialog state ${n.sessionState}`);case ge.AckWait:return this.stateTransition(L.Terminating),new Promise(r=>{n.delegate={onAck:()=>{let i=n.bye(e,t);return this.stateTransition(L.Terminated),r(i),Promise.resolve()},onAckTimeout:()=>{let i=n.bye(e,t);this.stateTransition(L.Terminated),r(i)}}});case ge.Confirmed:{let r=n.bye(e,t);return this.stateTransition(L.Terminated),Promise.resolve(r)}case ge.Terminated:throw Error(`Invalid dialog state ${n.sessionState}`);default:throw Error(`Unrecognized state.`)}}_info(e,t){return this.dialog?Promise.resolve(this.dialog.info(e,t)):Promise.reject(Error(`Session dialog undefined.`))}_message(e,t){return this.dialog?Promise.resolve(this.dialog.message(e,t)):Promise.reject(Error(`Session dialog undefined.`))}_refer(e,t,n){return this.dialog?(this.onNotify=e,Promise.resolve(this.dialog.refer(t,n))):Promise.reject(Error(`Session dialog undefined.`))}ackAndBye(e,t,n){e.ack();let r=[];t&&r.push(`Reason: `+this.getReasonHeaderValue(t,n)),e.session.bye(void 0,{extraHeaders:r})}onAckRequest(e){if(this.logger.log(`Session.onAckRequest`),this.state!==L.Established&&this.state!==L.Terminating)return this.logger.error(`ACK received while in state ${this.state}, dropping request`),Promise.resolve();let t=this.dialog;if(!t)throw Error(`Dialog undefined.`);let n={sessionDescriptionHandlerOptions:this.pendingReinviteAck?this.sessionDescriptionHandlerOptionsReInvite:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.pendingReinviteAck?this._sessionDescriptionHandlerModifiersReInvite:this._sessionDescriptionHandlerModifiers};if(this.delegate&&this.delegate.onAck){let t=new S(e);this.delegate.onAck(t)}switch(this.pendingReinviteAck=!1,t.signalingState){case P.Initial:{this.logger.error(`Invalid signaling state ${t.signalingState}.`);let e=[`Reason: `+this.getReasonHeaderValue(488,`Bad Media Description`)];return t.bye(void 0,{extraHeaders:e}),this.stateTransition(L.Terminated),Promise.resolve()}case P.Stable:{let r=he(e.message);return r?r.contentDisposition===`render`?(this._renderbody=r.content,this._rendertype=r.contentType,Promise.resolve()):r.contentDisposition===`session`?this.setAnswer(r,n).catch(e=>{this.logger.error(e.message);let n=[`Reason: `+this.getReasonHeaderValue(488,`Bad Media Description`)];t.bye(void 0,{extraHeaders:n}),this.stateTransition(L.Terminated)}):Promise.resolve():Promise.resolve()}case P.HaveLocalOffer:{this.logger.error(`Invalid signaling state ${t.signalingState}.`);let e=[`Reason: `+this.getReasonHeaderValue(488,`Bad Media Description`)];return t.bye(void 0,{extraHeaders:e}),this.stateTransition(L.Terminated),Promise.resolve()}case P.HaveRemoteOffer:{this.logger.error(`Invalid signaling state ${t.signalingState}.`);let e=[`Reason: `+this.getReasonHeaderValue(488,`Bad Media Description`)];return t.bye(void 0,{extraHeaders:e}),this.stateTransition(L.Terminated),Promise.resolve()}case P.Closed:throw Error(`Invalid signaling state ${t.signalingState}.`);default:throw Error(`Invalid signaling state ${t.signalingState}.`)}}onByeRequest(e){if(this.logger.log(`Session.onByeRequest`),this.state!==L.Established){this.logger.error(`BYE received while in state ${this.state}, dropping request`);return}if(this.delegate&&this.delegate.onBye){let t=new C(e);this.delegate.onBye(t)}else e.accept();this.stateTransition(L.Terminated)}onInfoRequest(e){if(this.logger.log(`Session.onInfoRequest`),this.state!==L.Established){this.logger.error(`INFO received while in state ${this.state}, dropping request`);return}if(this.delegate&&this.delegate.onInfo){let t=new E(e);this.delegate.onInfo(t)}else e.accept()}onInviteRequest(e){if(this.logger.log(`Session.onInviteRequest`),this.state!==L.Established){this.logger.error(`INVITE received while in state ${this.state}, dropping request`);return}this.pendingReinviteAck=!0;let t=[`Contact: `+this._contact];if(e.message.hasHeader(`P-Asserted-Identity`)){let t=e.message.getHeader(`P-Asserted-Identity`);if(!t)throw Error(`Header undefined.`);this._assertedIdentity=A.nameAddrHeaderParse(t)}let n={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptionsReInvite,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiersReInvite};this.generateResponseOfferAnswerInDialog(n).then(n=>{let r=e.accept({statusCode:200,extraHeaders:t,body:n});this.delegate&&this.delegate.onInvite&&this.delegate.onInvite(e.message,r.message,200)}).catch(t=>{if(this.logger.error(t.message),this.logger.error(`Failed to handle to re-INVITE request`),!this.dialog)throw Error(`Dialog undefined.`);if(this.logger.error(this.dialog.signalingState),this.dialog.signalingState===P.Stable){let t=e.reject({statusCode:488});this.delegate&&this.delegate.onInvite&&this.delegate.onInvite(e.message,t.message,488);return}this.rollbackOffer().then(()=>{let t=e.reject({statusCode:488});this.delegate&&this.delegate.onInvite&&this.delegate.onInvite(e.message,t.message,488)}).catch(t=>{this.logger.error(t.message),this.logger.error(`Failed to rollback offer on re-INVITE request`);let n=e.reject({statusCode:488});if(this.state!==L.Terminated){if(!this.dialog)throw Error(`Dialog undefined.`);let e=[];e.push(`Reason: `+this.getReasonHeaderValue(500,`Internal Server Error`)),this.dialog.bye(void 0,{extraHeaders:e}),this.stateTransition(L.Terminated)}this.delegate&&this.delegate.onInvite&&this.delegate.onInvite(e.message,n.message,488)})})}onMessageRequest(e){if(this.logger.log(`Session.onMessageRequest`),this.state!==L.Established){this.logger.error(`MESSAGE received while in state ${this.state}, dropping request`);return}if(this.delegate&&this.delegate.onMessage){let t=new Se(e);this.delegate.onMessage(t)}else e.accept()}onNotifyRequest(e){if(this.logger.log(`Session.onNotifyRequest`),this.state!==L.Established){this.logger.error(`NOTIFY received while in state ${this.state}, dropping request`);return}if(this.onNotify){let t=new Ce(e);this.onNotify(t);return}if(this.delegate&&this.delegate.onNotify){let t=new Ce(e);this.delegate.onNotify(t)}else e.accept()}onPrackRequest(e){if(this.logger.log(`Session.onPrackRequest`),this.state!==L.Established){this.logger.error(`PRACK received while in state ${this.state}, dropping request`);return}throw Error(`Unimplemented.`)}onReferRequest(e){if(this.logger.log(`Session.onReferRequest`),this.state!==L.Established){this.logger.error(`REFER received while in state ${this.state}, dropping request`);return}if(!e.message.hasHeader(`refer-to`)){this.logger.warn(`Invalid REFER packet. A refer-to header is required. Rejecting.`),e.reject();return}let t=new we(e,this);this.delegate&&this.delegate.onRefer?this.delegate.onRefer(t):(this.logger.log(`No delegate available to handle REFER, automatically accepting and following.`),t.accept().then(()=>t.makeInviter(this._referralInviterOptions).invite()).catch(e=>{this.logger.error(e.message)}))}generateResponseOfferAnswer(e,t){if(this.dialog)return this.generateResponseOfferAnswerInDialog(t);let n=he(e.message);return!n||n.contentDisposition!==`session`?this.getOffer(t):this.setOfferAndGetAnswer(n,t)}generateResponseOfferAnswerInDialog(e){if(!this.dialog)throw Error(`Dialog undefined.`);switch(this.dialog.signalingState){case P.Initial:return this.getOffer(e);case P.HaveLocalOffer:return Promise.resolve(void 0);case P.HaveRemoteOffer:if(!this.dialog.offer)throw Error(`Session offer undefined in signaling state ${this.dialog.signalingState}.`);return this.setOfferAndGetAnswer(this.dialog.offer,e);case P.Stable:return this.state===L.Established?this.getOffer(e):Promise.resolve(void 0);case P.Closed:throw Error(`Invalid signaling state ${this.dialog.signalingState}.`);default:throw Error(`Invalid signaling state ${this.dialog.signalingState}.`)}}getOffer(e){let t=this.setupSessionDescriptionHandler(),n=e.sessionDescriptionHandlerOptions,r=e.sessionDescriptionHandlerModifiers;try{return t.getDescription(n,r).then(e=>pe(e)).catch(e=>{this.logger.error(`Session.getOffer: SDH getDescription rejected...`);let t=e instanceof Error?e:Error(`Session.getOffer unknown error.`);throw this.logger.error(t.message),t})}catch(e){this.logger.error(`Session.getOffer: SDH getDescription threw...`);let t=e instanceof Error?e:Error(e);return this.logger.error(t.message),Promise.reject(t)}}rollbackOffer(){let e=this.setupSessionDescriptionHandler();if(e.rollbackDescription===void 0)return Promise.resolve();try{return e.rollbackDescription().catch(e=>{this.logger.error(`Session.rollbackOffer: SDH rollbackDescription rejected...`);let t=e instanceof Error?e:Error(`Session.rollbackOffer unknown error.`);throw this.logger.error(t.message),t})}catch(e){this.logger.error(`Session.rollbackOffer: SDH rollbackDescription threw...`);let t=e instanceof Error?e:Error(e);return this.logger.error(t.message),Promise.reject(t)}}setAnswer(e,t){let n=this.setupSessionDescriptionHandler(),r=t.sessionDescriptionHandlerOptions,i=t.sessionDescriptionHandlerModifiers;try{if(!n.hasDescription(e.contentType))return Promise.reject(new _)}catch(e){this.logger.error(`Session.setAnswer: SDH hasDescription threw...`);let t=e instanceof Error?e:Error(e);return this.logger.error(t.message),Promise.reject(t)}try{return n.setDescription(e.content,r,i).catch(e=>{this.logger.error(`Session.setAnswer: SDH setDescription rejected...`);let t=e instanceof Error?e:Error(`Session.setAnswer unknown error.`);throw this.logger.error(t.message),t})}catch(e){this.logger.error(`Session.setAnswer: SDH setDescription threw...`);let t=e instanceof Error?e:Error(e);return this.logger.error(t.message),Promise.reject(t)}}setOfferAndGetAnswer(e,t){let n=this.setupSessionDescriptionHandler(),r=t.sessionDescriptionHandlerOptions,i=t.sessionDescriptionHandlerModifiers;try{if(!n.hasDescription(e.contentType))return Promise.reject(new _)}catch(e){this.logger.error(`Session.setOfferAndGetAnswer: SDH hasDescription threw...`);let t=e instanceof Error?e:Error(e);return this.logger.error(t.message),Promise.reject(t)}try{return n.setDescription(e.content,r,i).then(()=>n.getDescription(r,i)).then(e=>pe(e)).catch(e=>{this.logger.error(`Session.setOfferAndGetAnswer: SDH setDescription or getDescription rejected...`);let t=e instanceof Error?e:Error(`Session.setOfferAndGetAnswer unknown error.`);throw this.logger.error(t.message),t})}catch(e){this.logger.error(`Session.setOfferAndGetAnswer: SDH setDescription or getDescription threw...`);let t=e instanceof Error?e:Error(e);return this.logger.error(t.message),Promise.reject(t)}}setSessionDescriptionHandler(e){if(this._sessionDescriptionHandler)throw Error(`Session description handler defined.`);this._sessionDescriptionHandler=e}setupSessionDescriptionHandler(){return this._sessionDescriptionHandler?this._sessionDescriptionHandler:(this._sessionDescriptionHandler=this.sessionDescriptionHandlerFactory(this,this.userAgent.configuration.sessionDescriptionHandlerFactoryOptions),this.delegate?.onSessionDescriptionHandler&&this.delegate.onSessionDescriptionHandler(this._sessionDescriptionHandler,!1),this._sessionDescriptionHandler)}stateTransition(e){let t=()=>{throw Error(`Invalid state transition from ${this._state} to ${e}`)};switch(this._state){case L.Initial:e!==L.Establishing&&e!==L.Established&&e!==L.Terminating&&e!==L.Terminated&&t();break;case L.Establishing:e!==L.Established&&e!==L.Terminating&&e!==L.Terminated&&t();break;case L.Established:e!==L.Terminating&&e!==L.Terminated&&t();break;case L.Terminating:e!==L.Terminated&&t();break;case L.Terminated:t();break;default:throw Error(`Unrecognized state.`)}this._state=e,this.logger.log(`Session ${this.id} transitioned to state ${this._state}`),this._stateEventEmitter.emit(this._state),e===L.Terminated&&this.dispose()}copyRequestOptions(e={}){return{extraHeaders:e.extraHeaders?e.extraHeaders.slice():void 0,body:e.body?{contentDisposition:e.body.contentDisposition||`render`,contentType:e.body.contentType||`text/plain`,content:e.body.content||``}:void 0}}getReasonHeaderValue(e,t){let n=e,r=oe(e);return!r&&t&&(r=t),`SIP;cause=`+n+`;text="`+r+`"`}referExtraHeaders(e){let 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}referToString(e){let t;if(e instanceof te)t=e.toString();else{if(!e.dialog)throw Error(`Dialog undefined.`);let n=e.remoteIdentity.friendlyName,r=e.dialog.remoteTarget.toString(),i=e.dialog.callId,a=e.dialog.remoteTag,o=e.dialog.localTag;t=`"${n}" <${r}?Replaces=${encodeURIComponent(`${i};to-tag=${a};from-tag=${o}`)}>`}return t}},Ee;(function(e){e.Required=`Required`,e.Supported=`Supported`,e.Unsupported=`Unsupported`})(Ee=Ee||={});let De={"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};var Oe=class extends Te{constructor(e,t){super(e),this.incomingInviteRequest=t,this.disposed=!1,this.expiresTimer=void 0,this.isCanceled=!1,this.rel100=`none`,this.rseq=Math.floor(Math.random()*1e4),this.userNoAnswerTimer=void 0,this.waitingForPrack=!1,this.logger=e.getLogger(`sip.Invitation`);let n=this.incomingInviteRequest.message,r=n.getHeader(`require`);r&&r.toLowerCase().includes(`100rel`)&&(this.rel100=`required`);let i=n.getHeader(`supported`);if(i&&i.toLowerCase().includes(`100rel`)&&(this.rel100=`supported`),n.toTag=t.toTag,typeof n.toTag!=`string`)throw TypeError(`toTag should have been a string.`);if(this.userNoAnswerTimer=setTimeout(()=>{t.reject({statusCode:480}),this.stateTransition(L.Terminated)},this.userAgent.configuration.noAnswerTimeout?this.userAgent.configuration.noAnswerTimeout*1e3:6e4),n.hasHeader(`expires`)){let e=Number(n.getHeader(`expires`)||0)*1e3;this.expiresTimer=setTimeout(()=>{this.state===L.Initial&&(t.reject({statusCode:487}),this.stateTransition(L.Terminated))},e)}let a=this.request.getHeader(`P-Asserted-Identity`);a&&(this._assertedIdentity=A.nameAddrHeaderParse(a)),this._contact=this.userAgent.contact.toString();let o=n.parseHeader(`Content-Disposition`);o&&o.type===`render`&&(this._renderbody=n.body,this._rendertype=n.getHeader(`Content-Type`)),this._id=n.callId+n.fromTag,this.userAgent._sessions[this._id]=this}dispose(){if(this.disposed)return Promise.resolve();switch(this.disposed=!0,this.expiresTimer&&=(clearTimeout(this.expiresTimer),void 0),this.userNoAnswerTimer&&=(clearTimeout(this.userNoAnswerTimer),void 0),this.prackNeverArrived(),this.state){case L.Initial:return this.reject().then(()=>super.dispose());case L.Establishing:return this.reject().then(()=>super.dispose());case L.Established:return super.dispose();case L.Terminating:return super.dispose();case L.Terminated:return super.dispose();default:throw Error(`Unknown state.`)}}get autoSendAnInitialProvisionalResponse(){return this.rel100!==`required`&&this.userAgent.configuration.sendInitialProvisionalResponse}get body(){return this.incomingInviteRequest.message.body}get localIdentity(){return this.request.to}get remoteIdentity(){return this.request.from}get request(){return this.incomingInviteRequest.message}accept(e={}){if(this.logger.log(`Invitation.accept`),this.state!==L.Initial){let e=Error(`Invalid session state ${this.state}`);return this.logger.error(e.message),Promise.reject(e)}return e.sessionDescriptionHandlerModifiers&&(this.sessionDescriptionHandlerModifiers=e.sessionDescriptionHandlerModifiers),e.sessionDescriptionHandlerOptions&&(this.sessionDescriptionHandlerOptions=e.sessionDescriptionHandlerOptions),this.stateTransition(L.Establishing),this.sendAccept(e).then(({message:e,session:t})=>{t.delegate={onAck:e=>this.onAckRequest(e),onAckTimeout:()=>this.onAckTimeout(),onBye:e=>this.onByeRequest(e),onInfo:e=>this.onInfoRequest(e),onInvite:e=>this.onInviteRequest(e),onMessage:e=>this.onMessageRequest(e),onNotify:e=>this.onNotifyRequest(e),onPrack:e=>this.onPrackRequest(e),onRefer:e=>this.onReferRequest(e)},this._dialog=t,this.stateTransition(L.Established),this._replacee&&this._replacee._bye()}).catch(e=>this.handleResponseError(e))}progress(e={}){if(this.logger.log(`Invitation.progress`),this.state!==L.Initial){let e=Error(`Invalid session state ${this.state}`);return this.logger.error(e.message),Promise.reject(e)}let t=e.statusCode||180;if(t<100||t>199)throw TypeError(`Invalid statusCode: `+t);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()):e.statusCode===100?this.sendProgressTrying().then(()=>{}).catch(e=>this.handleResponseError(e)):this.rel100!==`required`&&!(this.rel100===`supported`&&e.rel100)&&!(this.rel100===`supported`&&this.userAgent.configuration.sipExtension100rel===Ee.Required)?this.sendProgress(e).then(()=>{}).catch(e=>this.handleResponseError(e)):this.sendProgressReliableWaitForPrack(e).then(()=>{}).catch(e=>this.handleResponseError(e))}reject(e={}){if(this.logger.log(`Invitation.reject`),this.state!==L.Initial&&this.state!==L.Establishing){let e=Error(`Invalid session state ${this.state}`);return this.logger.error(e.message),Promise.reject(e)}let t=e.statusCode||480,n=e.reasonPhrase?e.reasonPhrase:oe(t),r=e.extraHeaders||[];if(t<300||t>699)throw TypeError(`Invalid statusCode: `+t);let i=e.body?pe(e.body):void 0;return t<400?this.incomingInviteRequest.redirect([],{statusCode:t,reasonPhrase:n,extraHeaders:r,body:i}):this.incomingInviteRequest.reject({statusCode:t,reasonPhrase:n,extraHeaders:r,body:i}),this.stateTransition(L.Terminated),Promise.resolve()}_onCancel(e){if(this.logger.log(`Invitation._onCancel`),this.state!==L.Initial&&this.state!==L.Establishing){this.logger.error(`CANCEL received while in state ${this.state}, dropping request`);return}if(this.delegate&&this.delegate.onCancel){let t=new w(e);this.delegate.onCancel(t)}this.isCanceled=!0,this.incomingInviteRequest.reject({statusCode:487}),this.stateTransition(L.Terminated)}handlePrackOfferAnswer(e){if(!this.dialog)throw Error(`Dialog undefined.`);let t=he(e.message);if(!t||t.contentDisposition!==`session`)return Promise.resolve(void 0);let n={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers};switch(this.dialog.signalingState){case P.Initial:throw Error(`Invalid signaling state ${this.dialog.signalingState}.`);case P.Stable:return this.setAnswer(t,n).then(()=>void 0);case P.HaveLocalOffer:throw Error(`Invalid signaling state ${this.dialog.signalingState}.`);case P.HaveRemoteOffer:return this.setOfferAndGetAnswer(t,n);case P.Closed:throw Error(`Invalid signaling state ${this.dialog.signalingState}.`);default:throw Error(`Invalid signaling state ${this.dialog.signalingState}.`)}}handleResponseError(e){let t=480;if(e instanceof Error?this.logger.error(e.message):this.logger.error(e),e instanceof _?(this.logger.error(`A session description handler occurred while sending response (content type unsupported`),t=415):e instanceof y?this.logger.error(`A session description handler occurred while sending response`):e instanceof b?this.logger.error(`Session ended before response could be formulated and sent (while waiting for PRACK)`):e instanceof be&&this.logger.error(`Session changed state before response could be formulated and sent`),this.state===L.Initial||this.state===L.Establishing)try{this.incomingInviteRequest.reject({statusCode:t}),this.stateTransition(L.Terminated)}catch(e){throw this.logger.error(`An error occurred attempting to reject the request while handling another error`),e}if(this.isCanceled){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.`);return}throw e}onAckTimeout(){if(this.logger.log(`Invitation.onAckTimeout`),!this.dialog)throw Error(`Dialog undefined.`);this.logger.log(`No ACK received for an extended period of time, terminating session`),this.dialog.bye(),this.stateTransition(L.Terminated)}sendAccept(e={}){let t={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers},n=e.extraHeaders||[];return this.waitingForPrack?this.waitForArrivalOfPrack().then(()=>clearTimeout(this.userNoAnswerTimer)).then(()=>this.generateResponseOfferAnswer(this.incomingInviteRequest,t)).then(e=>this.incomingInviteRequest.accept({statusCode:200,body:e,extraHeaders:n})):(clearTimeout(this.userNoAnswerTimer),this.generateResponseOfferAnswer(this.incomingInviteRequest,t).then(e=>this.incomingInviteRequest.accept({statusCode:200,body:e,extraHeaders:n})))}sendProgress(e={}){let t=e.statusCode||180,n=e.reasonPhrase,r=(e.extraHeaders||[]).slice(),i=e.body?pe(e.body):void 0;if(t===183&&!i)return this.sendProgressWithSDP(e);try{let e=this.incomingInviteRequest.progress({statusCode:t,reasonPhrase:n,extraHeaders:r,body:i});return this._dialog=e.session,Promise.resolve(e)}catch(e){return Promise.reject(e)}}sendProgressWithSDP(e={}){let t={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers},n=e.statusCode||183,r=e.reasonPhrase,i=(e.extraHeaders||[]).slice();return this.generateResponseOfferAnswer(this.incomingInviteRequest,t).then(e=>this.incomingInviteRequest.progress({statusCode:n,reasonPhrase:r,extraHeaders:i,body:e})).then(e=>(this._dialog=e.session,e))}sendProgressReliable(e={}){return e.extraHeaders=(e.extraHeaders||[]).slice(),e.extraHeaders.push(`Require: 100rel`),e.extraHeaders.push(`RSeq: `+Math.floor(Math.random()*1e4)),this.sendProgressWithSDP(e)}sendProgressReliableWaitForPrack(e={}){let t={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers},n=e.statusCode||183,r=e.reasonPhrase,i=(e.extraHeaders||[]).slice();i.push(`Require: 100rel`),i.push(`RSeq: `+ this.rseq++);let a;return new Promise((e,o)=>{this.waitingForPrack=!0,this.generateResponseOfferAnswer(this.incomingInviteRequest,t).then(e=>(a=e,this.incomingInviteRequest.progress({statusCode:n,reasonPhrase:r,extraHeaders:i,body:a}))).then(t=>{this._dialog=t.session;let s,c;t.session.delegate={onPrack:n=>{s=n,clearTimeout(l),clearTimeout(f),this.waitingForPrack&&(this.waitingForPrack=!1,this.handlePrackOfferAnswer(s).then(n=>{try{c=s.accept({statusCode:200,body:n}),this.prackArrived(),e({prackRequest:s,prackResponse:c,progressResponse:t})}catch(e){o(e)}}).catch(e=>o(e)))}};let l=setTimeout(()=>{this.waitingForPrack&&(this.waitingForPrack=!1,this.logger.warn(`No PRACK received, rejecting INVITE.`),clearTimeout(f),this.reject({statusCode:504}).then(()=>o(new b)).catch(e=>o(e)))},F.T1*64),u=()=>{try{this.incomingInviteRequest.progress({statusCode:n,reasonPhrase:r,extraHeaders:i,body:a})}catch(e){this.waitingForPrack=!1,o(e);return}f=setTimeout(u,d*=2)},d=F.T1,f=setTimeout(u,d)}).catch(e=>{this.waitingForPrack=!1,o(e)})})}sendProgressTrying(){try{let e=this.incomingInviteRequest.trying();return Promise.resolve(e)}catch(e){return Promise.reject(e)}}waitForArrivalOfPrack(){if(this.waitingForPrackPromise)throw Error(`Already waiting for PRACK`);return this.waitingForPrackPromise=new Promise((e,t)=>{this.waitingForPrackResolve=e,this.waitingForPrackReject=t}),this.waitingForPrackPromise}prackArrived(){this.waitingForPrackResolve&&this.waitingForPrackResolve(),this.waitingForPrackPromise=void 0,this.waitingForPrackResolve=void 0,this.waitingForPrackReject=void 0}prackNeverArrived(){this.waitingForPrackReject&&this.waitingForPrackReject(new b),this.waitingForPrackPromise=void 0,this.waitingForPrackResolve=void 0,this.waitingForPrackReject=void 0}},ke=class extends Te{constructor(e,t,n={}){super(e,n),this.disposed=!1,this.earlyMedia=!1,this.earlyMediaSessionDescriptionHandlers=new Map,this.isCanceled=!1,this.inviteWithoutSdp=!1,this.logger=e.getLogger(`sip.Inviter`),this.earlyMedia=n.earlyMedia===void 0?this.earlyMedia:n.earlyMedia,this.fromTag=se(),this.inviteWithoutSdp=n.inviteWithoutSdp===void 0?this.inviteWithoutSdp:n.inviteWithoutSdp;let r=Object.assign({},n);r.params=Object.assign({},n.params);let i=n.anonymous||!1,a=e.contact.toString({anonymous:i,outbound:i?!e.contact.tempGruu:!e.contact.pubGruu});i&&e.configuration.uri&&(r.params.fromDisplayName=`Anonymous`,r.params.fromUri=`sip:anonymous@anonymous.invalid`);let o=e.userAgentCore.configuration.aor;if(r.params.fromUri&&(o=typeof r.params.fromUri==`string`?A.URIParse(r.params.fromUri):r.params.fromUri),!o)throw TypeError(`Invalid from URI: `+r.params.fromUri);let s=t;if(r.params.toUri&&(s=typeof r.params.toUri==`string`?A.URIParse(r.params.toUri):r.params.toUri),!s)throw TypeError(`Invalid to URI: `+r.params.toUri);let c=Object.assign({},r.params);c.fromTag=this.fromTag;let l=(r.extraHeaders||[]).slice();i&&e.configuration.uri&&(l.push(`P-Preferred-Identity: `+e.configuration.uri.toString()),l.push(`Privacy: id`)),l.push(`Contact: `+a),l.push(`Allow: `+[`ACK`,`CANCEL`,`INVITE`,`MESSAGE`,`BYE`,`OPTIONS`,`INFO`,`NOTIFY`,`REFER`].toString()),e.configuration.sipExtension100rel===Ee.Required&&l.push(`Require: 100rel`),e.configuration.sipExtensionReplaces===Ee.Required&&l.push(`Require: replaces`),r.extraHeaders=l,this.outgoingRequestMessage=e.userAgentCore.makeOutgoingRequestMessage(I.INVITE,t,o,s,c,l,void 0),this._contact=a,this._referralInviterOptions=r,this._renderbody=n.renderbody,this._rendertype=n.rendertype,n.sessionDescriptionHandlerModifiers&&(this.sessionDescriptionHandlerModifiers=n.sessionDescriptionHandlerModifiers),n.sessionDescriptionHandlerOptions&&(this.sessionDescriptionHandlerOptions=n.sessionDescriptionHandlerOptions),n.sessionDescriptionHandlerModifiersReInvite&&(this.sessionDescriptionHandlerModifiersReInvite=n.sessionDescriptionHandlerModifiersReInvite),n.sessionDescriptionHandlerOptionsReInvite&&(this.sessionDescriptionHandlerOptionsReInvite=n.sessionDescriptionHandlerOptionsReInvite),this._id=this.outgoingRequestMessage.callId+this.fromTag,this.userAgent._sessions[this._id]=this}dispose(){if(this.disposed)return Promise.resolve();switch(this.disposed=!0,this.disposeEarlyMedia(),this.state){case L.Initial:return this.cancel().then(()=>super.dispose());case L.Establishing:return this.cancel().then(()=>super.dispose());case L.Established:return super.dispose();case L.Terminating:return super.dispose();case L.Terminated:return super.dispose();default:throw Error(`Unknown state.`)}}get body(){return this.outgoingRequestMessage.body}get localIdentity(){return this.outgoingRequestMessage.from}get remoteIdentity(){return this.outgoingRequestMessage.to}get request(){return this.outgoingRequestMessage}cancel(e={}){if(this.logger.log(`Inviter.cancel`),this.state!==L.Initial&&this.state!==L.Establishing){let e=Error(`Invalid session state ${this.state}`);return this.logger.error(e.message),Promise.reject(e)}this.isCanceled=!0,this.stateTransition(L.Terminating);function t(e,t){if(e&&e<200||e>699)throw TypeError(`Invalid statusCode: `+e);if(e){let n=e,r=oe(e)||t;return`SIP;cause=`+n+`;text="`+r+`"`}}if(this.outgoingInviteRequest){let n;e.statusCode&&e.reasonPhrase&&(n=t(e.statusCode,e.reasonPhrase)),this.outgoingInviteRequest.cancel(n,e)}else this.logger.warn(`Canceled session before INVITE was sent`),this.stateTransition(L.Terminated);return Promise.resolve()}invite(e={}){if(this.logger.log(`Inviter.invite`),this.state!==L.Initial)return super.invite(e);if(e.sessionDescriptionHandlerModifiers&&(this.sessionDescriptionHandlerModifiers=e.sessionDescriptionHandlerModifiers),e.sessionDescriptionHandlerOptions&&(this.sessionDescriptionHandlerOptions=e.sessionDescriptionHandlerOptions),e.withoutSdp||this.inviteWithoutSdp)return this._renderbody&&this._rendertype&&(this.outgoingRequestMessage.body={contentType:this._rendertype,body:this._renderbody}),this.stateTransition(L.Establishing),Promise.resolve(this.sendInvite(e));let t={sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers,sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions};return this.getOffer(t).then(t=>(this.outgoingRequestMessage.body={body:t.content,contentType:t.contentType},this.stateTransition(L.Establishing),this.sendInvite(e))).catch(e=>{throw this.logger.log(e.message),this.state!==L.Terminated&&this.stateTransition(L.Terminated),e})}sendInvite(e={}){return this.outgoingInviteRequest=this.userAgent.userAgentCore.invite(this.outgoingRequestMessage,{onAccept:t=>{if(this.dialog){this.logger.log(`Additional confirmed dialog, sending ACK and BYE`),this.ackAndBye(t);return}if(this.isCanceled){this.logger.log(`Canceled session accepted, sending ACK and BYE`),this.ackAndBye(t),this.stateTransition(L.Terminated);return}this.notifyReferer(t),this.onAccept(t).then(()=>{this.disposeEarlyMedia()}).catch(()=>{this.disposeEarlyMedia()}).then(()=>{e.requestDelegate&&e.requestDelegate.onAccept&&e.requestDelegate.onAccept(t)})},onProgress:t=>{this.isCanceled||(this.notifyReferer(t),this.onProgress(t).catch(()=>{this.disposeEarlyMedia()}).then(()=>{e.requestDelegate&&e.requestDelegate.onProgress&&e.requestDelegate.onProgress(t)}))},onRedirect:t=>{this.notifyReferer(t),this.onRedirect(t),e.requestDelegate&&e.requestDelegate.onRedirect&&e.requestDelegate.onRedirect(t)},onReject:t=>{this.notifyReferer(t),this.onReject(t),e.requestDelegate&&e.requestDelegate.onReject&&e.requestDelegate.onReject(t)},onTrying:t=>{this.notifyReferer(t),this.onTrying(t),e.requestDelegate&&e.requestDelegate.onTrying&&e.requestDelegate.onTrying(t)}}),this.outgoingInviteRequest}disposeEarlyMedia(){this.earlyMediaSessionDescriptionHandlers.forEach(e=>{e.close()}),this.earlyMediaSessionDescriptionHandlers.clear()}notifyReferer(e){if(!this._referred)return;if(!(this._referred instanceof Te))throw Error(`Referred session not instance of session`);if(!this._referred.dialog)return;if(!e.message.statusCode)throw Error(`Status code undefined.`);if(!e.message.reasonPhrase)throw Error(`Reason phrase undefined.`);let t=`SIP/2.0 ${e.message.statusCode} ${e.message.reasonPhrase}`.trim(),n=this._referred.dialog.notify(void 0,{extraHeaders:[`Event: refer`,`Subscription-State: terminated`],body:{contentDisposition:`render`,contentType:`message/sipfrag`,content:t}});n.delegate={onReject:()=>{this._referred=void 0}}}onAccept(e){if(this.logger.log(`Inviter.onAccept`),this.state!==L.Establishing)return this.logger.error(`Accept received while in state ${this.state}, dropping response`),Promise.reject(Error(`Invalid session state ${this.state}`));let t=e.message,n=e.session;switch(t.hasHeader(`P-Asserted-Identity`)&&(this._assertedIdentity=A.nameAddrHeaderParse(t.getHeader(`P-Asserted-Identity`))),n.delegate={onAck:e=>this.onAckRequest(e),onBye:e=>this.onByeRequest(e),onInfo:e=>this.onInfoRequest(e),onInvite:e=>this.onInviteRequest(e),onMessage:e=>this.onMessageRequest(e),onNotify:e=>this.onNotifyRequest(e),onPrack:e=>this.onPrackRequest(e),onRefer:e=>this.onReferRequest(e)},this._dialog=n,n.signalingState){case P.Initial:return this.logger.error(`Received 2xx response to INVITE without a session description`),this.ackAndBye(e,400,`Missing session description`),this.stateTransition(L.Terminated),Promise.reject(Error(`Bad Media Description`));case P.HaveLocalOffer:return this.logger.error(`Received 2xx response to INVITE without a session description`),this.ackAndBye(e,400,`Missing session description`),this.stateTransition(L.Terminated),Promise.reject(Error(`Bad Media Description`));case P.HaveRemoteOffer:{if(!this._dialog.offer)throw Error(`Session offer undefined in signaling state ${this._dialog.signalingState}.`);let t={sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers,sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions};return this.setOfferAndGetAnswer(this._dialog.offer,t).then(t=>{e.ack({body:t}),this.stateTransition(L.Established)}).catch(t=>{throw this.ackAndBye(e,488,`Invalid session description`),this.stateTransition(L.Terminated),t})}case P.Stable:{if(this.earlyMediaSessionDescriptionHandlers.size>0){let t=this.earlyMediaSessionDescriptionHandlers.get(n.id);if(!t)throw Error(`Session description handler undefined.`);return this.setSessionDescriptionHandler(t),this.earlyMediaSessionDescriptionHandlers.delete(n.id),e.ack(),this.stateTransition(L.Established),Promise.resolve()}if(this.earlyMediaDialog){if(this.earlyMediaDialog!==n){this.earlyMedia&&this.logger.error(`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.`);let t=Error(`Early media dialog does not equal confirmed dialog, terminating session`);return this.logger.error(t.message),this.ackAndBye(e,488,`Not Acceptable Here`),this.stateTransition(L.Terminated),Promise.reject(t)}return e.ack(),this.stateTransition(L.Established),Promise.resolve()}let t=n.answer;if(!t)throw Error(`Answer is undefined.`);let r={sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers,sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions};return this.setAnswer(t,r).then(()=>{let t;this._renderbody&&this._rendertype&&(t={body:{contentDisposition:`render`,contentType:this._rendertype,content:this._renderbody}}),e.ack(t),this.stateTransition(L.Established)}).catch(t=>{throw this.logger.error(t.message),this.ackAndBye(e,488,`Not Acceptable Here`),this.stateTransition(L.Terminated),t})}case P.Closed:return Promise.reject(Error(`Terminated.`));default:throw Error(`Unknown session signaling state.`)}}onProgress(e){if(this.logger.log(`Inviter.onProgress`),this.state!==L.Establishing)return this.logger.error(`Progress received while in state ${this.state}, dropping response`),Promise.reject(Error(`Invalid session state ${this.state}`));if(!this.outgoingInviteRequest)throw Error(`Outgoing INVITE request undefined.`);let t=e.message,n=e.session;t.hasHeader(`P-Asserted-Identity`)&&(this._assertedIdentity=A.nameAddrHeaderParse(t.getHeader(`P-Asserted-Identity`)));let r=t.getHeader(`require`),i=t.getHeader(`rseq`),a=!!(r&&r.includes(`100rel`)&&i&&Number(i)),o=[];switch(a&&o.push(`RAck: `+t.getHeader(`rseq`)+` `+t.getHeader(`cseq`)),n.signalingState){case P.Initial:return a&&(this.logger.warn(`First reliable provisional response received MUST contain an offer when INVITE does not contain an offer.`),e.prack({extraHeaders:o})),Promise.resolve();case P.HaveLocalOffer:return a&&e.prack({extraHeaders:o}),Promise.resolve();case P.HaveRemoteOffer:if(!a)return this.logger.warn(`Non-reliable provisional response MUST NOT contain an initial offer, discarding response.`),Promise.resolve();{let r=this.sessionDescriptionHandlerFactory(this,this.userAgent.configuration.sessionDescriptionHandlerFactoryOptions||{});return this.delegate?.onSessionDescriptionHandler&&this.delegate.onSessionDescriptionHandler(r,!0),this.earlyMediaSessionDescriptionHandlers.set(n.id,r),r.setDescription(t.body,this.sessionDescriptionHandlerOptions,this.sessionDescriptionHandlerModifiers).then(()=>r.getDescription(this.sessionDescriptionHandlerOptions,this.sessionDescriptionHandlerModifiers)).then(t=>{let n={contentDisposition:`session`,contentType:t.contentType,content:t.body};e.prack({extraHeaders:o,body:n})}).catch(e=>{throw this.stateTransition(L.Terminated),e})}case P.Stable:if(a&&e.prack({extraHeaders:o}),this.earlyMedia&&!this.earlyMediaDialog){this.earlyMediaDialog=n;let e=n.answer;if(!e)throw Error(`Answer is undefined.`);let t={sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers,sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions};return this.setAnswer(e,t).catch(e=>{throw this.stateTransition(L.Terminated),e})}return Promise.resolve();case P.Closed:return Promise.reject(Error(`Terminated.`));default:throw Error(`Unknown session signaling state.`)}}onRedirect(e){if(this.logger.log(`Inviter.onRedirect`),this.state!==L.Establishing&&this.state!==L.Terminating){this.logger.error(`Redirect received while in state ${this.state}, dropping response`);return}this.stateTransition(L.Terminated)}onReject(e){if(this.logger.log(`Inviter.onReject`),this.state!==L.Establishing&&this.state!==L.Terminating){this.logger.error(`Reject received while in state ${this.state}, dropping response`);return}this.stateTransition(L.Terminated)}onTrying(e){if(this.logger.log(`Inviter.onTrying`),this.state!==L.Establishing){this.logger.error(`Trying received while in state ${this.state}, dropping response`);return}}},R;(function(e){e.Initial=`Initial`,e.Registered=`Registered`,e.Unregistered=`Unregistered`,e.Terminated=`Terminated`})(R=R||={});var Ae=class e{constructor(t,n={}){this.disposed=!1,this._contacts=[],this._retryAfter=void 0,this._state=R.Initial,this._waiting=!1,this._stateEventEmitter=new T,this._waitingEventEmitter=new T,this.userAgent=t;let r=t.configuration.uri.clone();if(r.user=void 0,this.options=Object.assign(Object.assign(Object.assign({},e.defaultOptions()),{registrar:r}),e.stripUndefinedProperties(n)),this.options.extraContactHeaderParams=(this.options.extraContactHeaderParams||[]).slice(),this.options.extraHeaders=(this.options.extraHeaders||[]).slice(),!this.options.registrar)throw Error(`Registrar undefined.`);if(this.options.registrar=this.options.registrar.clone(),this.options.regId&&!this.options.instanceId?this.options.instanceId=this.userAgent.instanceId:!this.options.regId&&this.options.instanceId&&(this.options.regId=1),this.options.instanceId&&A.parse(this.options.instanceId,`uuid`)===-1)throw Error(`Invalid instanceId.`);if(this.options.regId&&this.options.regId<0)throw Error(`Invalid regId.`);let i=this.options.registrar,a=this.options.params&&this.options.params.fromUri||t.userAgentCore.configuration.aor,o=this.options.params&&this.options.params.toUri||t.configuration.uri,s=this.options.params||{},c=(n.extraHeaders||[]).slice();if(this.request=t.userAgentCore.makeOutgoingRequestMessage(I.REGISTER,i,a,o,s,c,void 0),this.expires=this.options.expires||e.defaultExpires,this.expires<0)throw Error(`Invalid expires.`);if(this.refreshFrequency=this.options.refreshFrequency||e.defaultRefreshFrequency,this.refreshFrequency<50||this.refreshFrequency>99)throw 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(e=>{let t=this.options[e];switch(e){case`registrar`:this.logger.log(`· `+e+`: `+t);break;default:this.logger.log(`· `+e+`: `+JSON.stringify(t))}})),this.id=this.request.callId+this.request.from.parameters.tag,this.userAgent._registerers[this.id]=this}static defaultOptions(){return{expires:e.defaultExpires,extraContactHeaderParams:[],extraHeaders:[],logConfiguration:!0,instanceId:``,params:{},regId:0,registrar:new te(`sip`,`anonymous`,`anonymous.invalid`),refreshFrequency:e.defaultRefreshFrequency}}static stripUndefinedProperties(e){return Object.keys(e).reduce((t,n)=>(e[n]!==void 0&&(t[n]=e[n]),t),{})}get contacts(){return this._contacts.slice()}get retryAfter(){return this._retryAfter}get state(){return this._state}get stateChange(){return this._stateEventEmitter}dispose(){return this.disposed?Promise.resolve():(this.disposed=!0,this.logger.log(`Registerer ${this.id} in state ${this.state} is being disposed`),delete this.userAgent._registerers[this.id],new Promise(e=>{let t=()=>{if(!this.waiting&&this._state===R.Registered){this.stateChange.addListener(()=>{this.terminated(),e()},{once:!0}),this.unregister();return}this.terminated(),e()};this.waiting?this.waitingChange.addListener(()=>{t()},{once:!0}):t()}))}register(e={}){if(this.state===R.Terminated)throw this.stateError(),Error(`Registerer terminated. Unable to register.`);if(this.disposed)throw this.stateError(),Error(`Registerer disposed. Unable to register.`);if(this.waiting){this.waitingWarning();let e=new v(`REGISTER request already in progress, waiting for final response`);return Promise.reject(e)}e.requestOptions&&(this.options=Object.assign(Object.assign({},this.options),e.requestOptions));let t=(this.options.extraHeaders||[]).slice();t.push(`Contact: `+this.generateContactHeader(this.expires)),t.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=t,this.waitingToggle(!0);let n=this.userAgent.userAgentCore.register(this.request,{onAccept:t=>{let n;t.message.hasHeader(`expires`)&&(n=Number(t.message.getHeader(`expires`))),this._contacts=t.message.getHeaders(`contact`);let r=this._contacts.length;if(!r){this.logger.error(`No Contact header in response to REGISTER, dropping response.`),this.unregistered();return}let i;for(;r--;){if(i=t.message.parseHeader(`contact`,r),!i)throw Error(`Contact undefined`);if(this.userAgent.contact.pubGruu&&O(i.uri,this.userAgent.contact.pubGruu)){n=Number(i.getParam(`expires`));break}if(this.userAgent.configuration.contactName===``){if(i.uri.user===this.userAgent.contact.uri.user){n=Number(i.getParam(`expires`));break}}else if(O(i.uri,this.userAgent.contact.uri)){n=Number(i.getParam(`expires`));break}i=void 0}if(i===void 0){this.logger.error(`No Contact header pointing to us, dropping response`),this.unregistered(),this.waitingToggle(!1);return}if(n===void 0){this.logger.error(`Contact pointing to us is missing expires parameter, dropping response`),this.unregistered(),this.waitingToggle(!1);return}if(i.hasParam(`temp-gruu`)){let e=i.getParam(`temp-gruu`);e&&(this.userAgent.contact.tempGruu=A.URIParse(e.replace(/"/g,``)))}if(i.hasParam(`pub-gruu`)){let e=i.getParam(`pub-gruu`);e&&(this.userAgent.contact.pubGruu=A.URIParse(e.replace(/"/g,``)))}this.registered(n),e.requestDelegate&&e.requestDelegate.onAccept&&e.requestDelegate.onAccept(t),this.waitingToggle(!1)},onProgress:t=>{e.requestDelegate&&e.requestDelegate.onProgress&&e.requestDelegate.onProgress(t)},onRedirect:t=>{this.logger.error(`Redirect received. Not supported.`),this.unregistered(),e.requestDelegate&&e.requestDelegate.onRedirect&&e.requestDelegate.onRedirect(t),this.waitingToggle(!1)},onReject:t=>{if(t.message.statusCode===423){if(!t.message.hasHeader(`min-expires`)){this.logger.error(`423 response received for REGISTER without Min-Expires, dropping response`),this.unregistered(),this.waitingToggle(!1);return}this.expires=Number(t.message.getHeader(`min-expires`)),this.waitingToggle(!1),this.register();return}this.logger.warn(`Failed to register, status code ${t.message.statusCode}`);let n=NaN;if(t.message.statusCode===500||t.message.statusCode===503){let e=t.message.getHeader(`retry-after`);e&&(n=Number.parseInt(e,void 0))}this._retryAfter=isNaN(n)?void 0:n,this.unregistered(),e.requestDelegate&&e.requestDelegate.onReject&&e.requestDelegate.onReject(t),this._retryAfter=void 0,this.waitingToggle(!1)},onTrying:t=>{e.requestDelegate&&e.requestDelegate.onTrying&&e.requestDelegate.onTrying(t)}});return Promise.resolve(n)}unregister(e={}){if(this.state===R.Terminated)throw this.stateError(),Error(`Registerer terminated. Unable to register.`);if(this.disposed&&this.state!==R.Registered)throw this.stateError(),Error(`Registerer disposed. Unable to register.`);if(this.waiting){this.waitingWarning();let e=new v(`REGISTER request already in progress, waiting for final response`);return Promise.reject(e)}this._state!==R.Registered&&!e.all&&this.logger.warn(`Not currently registered, but sending an unregister anyway.`);let t=(e.requestOptions&&e.requestOptions.extraHeaders||[]).slice();this.request.extraHeaders=t,e.all?(t.push(`Contact: *`),t.push(`Expires: 0`)):t.push(`Contact: `+this.generateContactHeader(0)),this.request.cseq++,this.request.setHeader(`cseq`,this.request.cseq+` REGISTER`),this.registrationTimer!==void 0&&(clearTimeout(this.registrationTimer),this.registrationTimer=void 0),this.waitingToggle(!0);let n=this.userAgent.userAgentCore.register(this.request,{onAccept:t=>{this._contacts=t.message.getHeaders(`contact`),this.unregistered(),e.requestDelegate&&e.requestDelegate.onAccept&&e.requestDelegate.onAccept(t),this.waitingToggle(!1)},onProgress:t=>{e.requestDelegate&&e.requestDelegate.onProgress&&e.requestDelegate.onProgress(t)},onRedirect:t=>{this.logger.error(`Unregister redirected. Not currently supported.`),this.unregistered(),e.requestDelegate&&e.requestDelegate.onRedirect&&e.requestDelegate.onRedirect(t),this.waitingToggle(!1)},onReject:t=>{this.logger.error(`Unregister rejected with status code ${t.message.statusCode}`),this.unregistered(),e.requestDelegate&&e.requestDelegate.onReject&&e.requestDelegate.onReject(t),this.waitingToggle(!1)},onTrying:t=>{e.requestDelegate&&e.requestDelegate.onTrying&&e.requestDelegate.onTrying(t)}});return Promise.resolve(n)}clearTimers(){this.registrationTimer!==void 0&&(clearTimeout(this.registrationTimer),this.registrationTimer=void 0),this.registrationExpiredTimer!==void 0&&(clearTimeout(this.registrationExpiredTimer),this.registrationExpiredTimer=void 0)}generateContactHeader(e){let t=this.userAgent.contact.toString({register:!0});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(e=>{t+=`;`+e}),t+=`;expires=`+e,t}registered(e){this.clearTimers(),this.registrationTimer=setTimeout(()=>{this.registrationTimer=void 0,this.register()},this.refreshFrequency/100*e*1e3),this.registrationExpiredTimer=setTimeout(()=>{this.logger.warn(`Registration expired`),this.unregistered()},e*1e3),this._state!==R.Registered&&this.stateTransition(R.Registered)}unregistered(){this.clearTimers(),this._state!==R.Unregistered&&this.stateTransition(R.Unregistered)}terminated(){this.clearTimers(),this._state!==R.Terminated&&this.stateTransition(R.Terminated)}stateTransition(e){let t=()=>{throw Error(`Invalid state transition from ${this._state} to ${e}`)};switch(this._state){case R.Initial:e!==R.Registered&&e!==R.Unregistered&&e!==R.Terminated&&t();break;case R.Registered:e!==R.Unregistered&&e!==R.Terminated&&t();break;case R.Unregistered:e!==R.Registered&&e!==R.Terminated&&t();break;case R.Terminated:t();break;default:throw Error(`Unrecognized state.`)}this._state=e,this.logger.log(`Registration transitioned to state ${this._state}`),this._stateEventEmitter.emit(this._state),e===R.Terminated&&this.dispose()}get waiting(){return this._waiting}get waitingChange(){return this._waitingEventEmitter}waitingToggle(e){if(this._waiting===e)throw Error(`Invalid waiting transition from ${this._waiting} to ${e}`);this._waiting=e,this.logger.log(`Waiting toggled to ${this._waiting}`),this._waitingEventEmitter.emit(this._waiting)}waitingWarning(){let 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)}stateError(){let e=`An attempt was made to send a REGISTER request when the Registerer ${this.state===R.Terminated?`is in 'Terminated' state`:`has been disposed`}.`;e+=` The Registerer transitions to 'Terminated' when Registerer.dispose() is called.`,e+=` Perhaps you called UserAgent.stop() which dipsoses of all Registerers?`,this.logger.error(e)}};Ae.defaultExpires=600,Ae.defaultRefreshFrequency=99;var z;(function(e){e.Initial=`Initial`,e.NotifyWait=`NotifyWait`,e.Pending=`Pending`,e.Active=`Active`,e.Terminated=`Terminated`})(z=z||={});var B;(function(e){e.Connecting=`Connecting`,e.Connected=`Connected`,e.Disconnecting=`Disconnecting`,e.Disconnected=`Disconnected`})(B=B||={});var je;(function(e){e.Started=`Started`,e.Stopped=`Stopped`})(je=je||={});var Me=class e{constructor(){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()}static hashStr(e,t=!1){return this.onePassHasher.start().appendStr(e).end(t)}static hashAsciiStr(e,t=!1){return this.onePassHasher.start().appendAsciiStr(e).end(t)}static _hex(t){let n=e.hexChars,r=e.hexOut,i,a,o,s;for(s=0;s<4;s+=1)for(a=s*8,i=t[s],o=0;o<8;o+=2)r[a+1+o]=n.charAt(i&15),i>>>=4,r[a+0+o]=n.charAt(i&15),i>>>=4;return r.join(``)}static _md5cycle(e,t){let n=e[0],r=e[1],i=e[2],a=e[3];n+=(r&i|~r&a)+t[0]-680876936|0,n=(n<<7|n>>>25)+r|0,a+=(n&r|~n&i)+t[1]-389564586|0,a=(a<<12|a>>>20)+n|0,i+=(a&n|~a&r)+t[2]+606105819|0,i=(i<<17|i>>>15)+a|0,r+=(i&a|~i&n)+t[3]-1044525330|0,r=(r<<22|r>>>10)+i|0,n+=(r&i|~r&a)+t[4]-176418897|0,n=(n<<7|n>>>25)+r|0,a+=(n&r|~n&i)+t[5]+1200080426|0,a=(a<<12|a>>>20)+n|0,i+=(a&n|~a&r)+t[6]-1473231341|0,i=(i<<17|i>>>15)+a|0,r+=(i&a|~i&n)+t[7]-45705983|0,r=(r<<22|r>>>10)+i|0,n+=(r&i|~r&a)+t[8]+1770035416|0,n=(n<<7|n>>>25)+r|0,a+=(n&r|~n&i)+t[9]-1958414417|0,a=(a<<12|a>>>20)+n|0,i+=(a&n|~a&r)+t[10]-42063|0,i=(i<<17|i>>>15)+a|0,r+=(i&a|~i&n)+t[11]-1990404162|0,r=(r<<22|r>>>10)+i|0,n+=(r&i|~r&a)+t[12]+1804603682|0,n=(n<<7|n>>>25)+r|0,a+=(n&r|~n&i)+t[13]-40341101|0,a=(a<<12|a>>>20)+n|0,i+=(a&n|~a&r)+t[14]-1502002290|0,i=(i<<17|i>>>15)+a|0,r+=(i&a|~i&n)+t[15]+1236535329|0,r=(r<<22|r>>>10)+i|0,n+=(r&a|i&~a)+t[1]-165796510|0,n=(n<<5|n>>>27)+r|0,a+=(n&i|r&~i)+t[6]-1069501632|0,a=(a<<9|a>>>23)+n|0,i+=(a&r|n&~r)+t[11]+643717713|0,i=(i<<14|i>>>18)+a|0,r+=(i&n|a&~n)+t[0]-373897302|0,r=(r<<20|r>>>12)+i|0,n+=(r&a|i&~a)+t[5]-701558691|0,n=(n<<5|n>>>27)+r|0,a+=(n&i|r&~i)+t[10]+38016083|0,a=(a<<9|a>>>23)+n|0,i+=(a&r|n&~r)+t[15]-660478335|0,i=(i<<14|i>>>18)+a|0,r+=(i&n|a&~n)+t[4]-405537848|0,r=(r<<20|r>>>12)+i|0,n+=(r&a|i&~a)+t[9]+568446438|0,n=(n<<5|n>>>27)+r|0,a+=(n&i|r&~i)+t[14]-1019803690|0,a=(a<<9|a>>>23)+n|0,i+=(a&r|n&~r)+t[3]-187363961|0,i=(i<<14|i>>>18)+a|0,r+=(i&n|a&~n)+t[8]+1163531501|0,r=(r<<20|r>>>12)+i|0,n+=(r&a|i&~a)+t[13]-1444681467|0,n=(n<<5|n>>>27)+r|0,a+=(n&i|r&~i)+t[2]-51403784|0,a=(a<<9|a>>>23)+n|0,i+=(a&r|n&~r)+t[7]+1735328473|0,i=(i<<14|i>>>18)+a|0,r+=(i&n|a&~n)+t[12]-1926607734|0,r=(r<<20|r>>>12)+i|0,n+=(r^i^a)+t[5]-378558|0,n=(n<<4|n>>>28)+r|0,a+=(n^r^i)+t[8]-2022574463|0,a=(a<<11|a>>>21)+n|0,i+=(a^n^r)+t[11]+1839030562|0,i=(i<<16|i>>>16)+a|0,r+=(i^a^n)+t[14]-35309556|0,r=(r<<23|r>>>9)+i|0,n+=(r^i^a)+t[1]-1530992060|0,n=(n<<4|n>>>28)+r|0,a+=(n^r^i)+t[4]+1272893353|0,a=(a<<11|a>>>21)+n|0,i+=(a^n^r)+t[7]-155497632|0,i=(i<<16|i>>>16)+a|0,r+=(i^a^n)+t[10]-1094730640|0,r=(r<<23|r>>>9)+i|0,n+=(r^i^a)+t[13]+681279174|0,n=(n<<4|n>>>28)+r|0,a+=(n^r^i)+t[0]-358537222|0,a=(a<<11|a>>>21)+n|0,i+=(a^n^r)+t[3]-722521979|0,i=(i<<16|i>>>16)+a|0,r+=(i^a^n)+t[6]+76029189|0,r=(r<<23|r>>>9)+i|0,n+=(r^i^a)+t[9]-640364487|0,n=(n<<4|n>>>28)+r|0,a+=(n^r^i)+t[12]-421815835|0,a=(a<<11|a>>>21)+n|0,i+=(a^n^r)+t[15]+530742520|0,i=(i<<16|i>>>16)+a|0,r+=(i^a^n)+t[2]-995338651|0,r=(r<<23|r>>>9)+i|0,n+=(i^(r|~a))+t[0]-198630844|0,n=(n<<6|n>>>26)+r|0,a+=(r^(n|~i))+t[7]+1126891415|0,a=(a<<10|a>>>22)+n|0,i+=(n^(a|~r))+t[14]-1416354905|0,i=(i<<15|i>>>17)+a|0,r+=(a^(i|~n))+t[5]-57434055|0,r=(r<<21|r>>>11)+i|0,n+=(i^(r|~a))+t[12]+1700485571|0,n=(n<<6|n>>>26)+r|0,a+=(r^(n|~i))+t[3]-1894986606|0,a=(a<<10|a>>>22)+n|0,i+=(n^(a|~r))+t[10]-1051523|0,i=(i<<15|i>>>17)+a|0,r+=(a^(i|~n))+t[1]-2054922799|0,r=(r<<21|r>>>11)+i|0,n+=(i^(r|~a))+t[8]+1873313359|0,n=(n<<6|n>>>26)+r|0,a+=(r^(n|~i))+t[15]-30611744|0,a=(a<<10|a>>>22)+n|0,i+=(n^(a|~r))+t[6]-1560198380|0,i=(i<<15|i>>>17)+a|0,r+=(a^(i|~n))+t[13]+1309151649|0,r=(r<<21|r>>>11)+i|0,n+=(i^(r|~a))+t[4]-145523070|0,n=(n<<6|n>>>26)+r|0,a+=(r^(n|~i))+t[11]-1120210379|0,a=(a<<10|a>>>22)+n|0,i+=(n^(a|~r))+t[2]+718787259|0,i=(i<<15|i>>>17)+a|0,r+=(a^(i|~n))+t[9]-343485551|0,r=(r<<21|r>>>11)+i|0,e[0]=n+e[0]|0,e[1]=r+e[1]|0,e[2]=i+e[2]|0,e[3]=a+e[3]|0}start(){return this._dataLength=0,this._bufferLength=0,this._state.set(e.stateIdentity),this}appendStr(t){let n=this._buffer8,r=this._buffer32,i=this._bufferLength,a,o;for(o=0;o<t.length;o+=1){if(a=t.charCodeAt(o),a<128)n[i++]=a;else if(a<2048)n[i++]=(a>>>6)+192,n[i++]=a&63|128;else if(a<55296||a>56319)n[i++]=(a>>>12)+224,n[i++]=a>>>6&63|128,n[i++]=a&63|128;else{if(a=(a-55296)*1024+(t.charCodeAt(++o)-56320)+65536,a>1114111)throw Error(`Unicode standard supports code points up to U+10FFFF`);n[i++]=(a>>>18)+240,n[i++]=a>>>12&63|128,n[i++]=a>>>6&63|128,n[i++]=a&63|128}i>=64&&(this._dataLength+=64,e._md5cycle(this._state,r),i-=64,r[0]=r[16])}return this._bufferLength=i,this}appendAsciiStr(t){let n=this._buffer8,r=this._buffer32,i=this._bufferLength,a,o=0;for(;;){for(a=Math.min(t.length-o,64-i);a--;)n[i++]=t.charCodeAt(o++);if(i<64)break;this._dataLength+=64,e._md5cycle(this._state,r),i=0}return this._bufferLength=i,this}appendByteArray(t){let n=this._buffer8,r=this._buffer32,i=this._bufferLength,a,o=0;for(;;){for(a=Math.min(t.length-o,64-i);a--;)n[i++]=t[o++];if(i<64)break;this._dataLength+=64,e._md5cycle(this._state,r),i=0}return this._bufferLength=i,this}getState(){let 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]]}}setState(e){let t=e.buffer,n=e.state,r=this._state,i;for(this._dataLength=e.length,this._bufferLength=e.buflen,r[0]=n[0],r[1]=n[1],r[2]=n[2],r[3]=n[3],i=0;i<t.length;i+=1)this._buffer8[i]=t.charCodeAt(i)}end(t=!1){let n=this._bufferLength,r=this._buffer8,i=this._buffer32,a=(n>>2)+1,o;if(this._dataLength+=n,r[n]=128,r[n+1]=r[n+2]=r[n+3]=0,i.set(e.buffer32Identity.subarray(a),a),n>55&&(e._md5cycle(this._state,i),i.set(e.buffer32Identity)),o=this._dataLength*8,o<=4294967295)i[14]=o;else{let e=o.toString(16).match(/(.*?)(.{0,8})$/);if(e===null)return;let t=parseInt(e[2],16),n=parseInt(e[1],16)||0;i[14]=t,i[15]=n}return e._md5cycle(this._state,i),t?this._state:e._hex(this._state)}};Me.stateIdentity=new Int32Array([1732584193,-271733879,-1732584194,271733878]),Me.buffer32Identity=new Int32Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Me.hexChars=`0123456789abcdef`,Me.hexOut=[],Me.onePassHasher=new Me,Me.hashStr(`hello`)!==`5d41402abc4b2a76b9719d911017c592`&&console.error(`Md5 self test failed.`);function Ne(e){return Me.hashStr(e)}var Pe=class{constructor(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`}authenticate(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(this.algorithm!==`MD5`)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)this.qop=`auth-int`;else return this.logger.warn(`challenge without Digest qop different than 'auth' or 'auth-int', authentication aborted`),!1;else this.qop=void 0;return this.method=e.method,this.uri=e.ruri,this.cnonce=ae(12),this.nc+=1,this.updateNcHex(),this.nc===4294967296&&(this.nc=1,this.ncHex=`00000001`),this.calculateResponse(n),!0}toString(){let e=[];if(!this.response)throw 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(`, `)}updateNcHex(){let e=Number(this.nc).toString(16);this.ncHex=`00000000`.substr(0,8-e.length)+e}calculateResponse(e){let t,n;t=this.ha1,(t===``||t===void 0)&&(t=Ne(this.username+`:`+this.realm+`:`+this.password)),this.qop===`auth`?(n=Ne(this.method+`:`+this.uri),this.response=Ne(t+`:`+this.nonce+`:`+this.ncHex+`:`+this.cnonce+`:auth:`+n)):this.qop===`auth-int`?(n=Ne(this.method+`:`+this.uri+`:`+Ne(e||``)),this.response=Ne(t+`:`+this.nonce+`:`+this.ncHex+`:`+this.cnonce+`:auth-int:`+n)):this.qop===void 0&&(n=Ne(this.method+`:`+this.uri),this.response=Ne(t+`:`+this.nonce+`:`+n))}},V;(function(e){e[e.error=0]=`error`,e[e.warn=1]=`warn`,e[e.log=2]=`log`,e[e.debug=3]=`debug`})(V=V||={});var Fe=class{constructor(e,t,n){this.logger=e,this.category=t,this.label=n}error(e){this.genericLog(V.error,e)}warn(e){this.genericLog(V.warn,e)}log(e){this.genericLog(V.log,e)}debug(e){this.genericLog(V.debug,e)}genericLog(e,t){this.logger.genericLog(e,this.category,this.label,t)}get level(){return this.logger.level}set level(e){this.logger.level=e}},Ie=class{constructor(){this.builtinEnabled=!0,this._level=V.log,this.loggers={},this.logger=this.getLogger(`sip:loggerfactory`)}get level(){return this._level}set level(e){e>=0&&e<=3?this._level=e:e>3?this._level=3:V.hasOwnProperty(e)?this._level=e:this.logger.error(`invalid 'level' parameter value: `+JSON.stringify(e))}get connector(){return this._connector}set connector(e){e?typeof e==`function`?this._connector=e:this.logger.error(`invalid 'connector' parameter value: `+JSON.stringify(e)):this._connector=void 0}getLogger(e,t){if(t&&this.level===3)return new Fe(this,e,t);if(this.loggers[e])return this.loggers[e];{let t=new Fe(this,e);return this.loggers[e]=t,t}}genericLog(e,t,n,r){this.level>=e&&this.builtinEnabled&&this.print(e,t,n,r),this.connector&&this.connector(V[e],t,n,r)}print(e,t,n,r){if(typeof r==`string`){let e=[new Date,t];n&&e.push(n),r=e.concat(r).join(` | `)}switch(e){case V.error:console.error(r);break;case V.warn:console.warn(r);break;case V.log:console.log(r);break;case V.debug:console.debug(r);break;default:break}}},Le;(function(e){function t(e,t){let n=t,r=0,i=0;if(e.substring(n,n+2).match(/(^\r\n)/))return-2;for(;r===0;){if(i=e.indexOf(`\r
24
- `,n),i===-1)return i;!e.substring(i+2,i+4).match(/(^\r\n)/)&&e.charAt(i+2).match(/(^\s+)/)?n=i+2:r=i}return r}e.getHeader=t;function n(e,t,n,r){let i=t.indexOf(`:`,n),a=t.substring(n,i).trim(),o=t.substring(i+1,r).trim(),s;switch(a.toLowerCase()){case`via`:case`v`:e.addHeader(`via`,o),e.getHeaders(`via`).length===1?(s=e.parseHeader(`Via`),s&&(e.via=s,e.viaBranch=s.branch)):s=0;break;case`from`:case`f`:e.setHeader(`from`,o),s=e.parseHeader(`from`),s&&(e.from=s,e.fromTag=s.getParam(`tag`));break;case`to`:case`t`:e.setHeader(`to`,o),s=e.parseHeader(`to`),s&&(e.to=s,e.toTag=s.getParam(`tag`));break;case`record-route`:if(s=A.parse(o,`Record_Route`),s===-1){s=void 0;break}if(!(s instanceof Array)){s=void 0;break}s.forEach(t=>{e.addHeader(`record-route`,o.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`,o),s=e.parseHeader(`call-id`),s&&(e.callId=o);break;case`contact`:case`m`:if(s=A.parse(o,`Contact`),s===-1){s=void 0;break}if(!(s instanceof Array)){s=void 0;break}s.forEach(t=>{e.addHeader(`contact`,o.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`,o),s=e.parseHeader(`content-length`);break;case`content-type`:case`c`:e.setHeader(`content-type`,o),s=e.parseHeader(`content-type`);break;case`cseq`:e.setHeader(`cseq`,o),s=e.parseHeader(`cseq`),s&&(e.cseq=s.value),e instanceof de&&(e.method=s.method);break;case`max-forwards`:e.setHeader(`max-forwards`,o),s=e.parseHeader(`max-forwards`);break;case`www-authenticate`:e.setHeader(`www-authenticate`,o),s=e.parseHeader(`www-authenticate`);break;case`proxy-authenticate`:e.setHeader(`proxy-authenticate`,o),s=e.parseHeader(`proxy-authenticate`);break;case`refer-to`:case`r`:e.setHeader(`refer-to`,o),s=e.parseHeader(`refer-to`),s&&(e.referTo=s);break;default:e.addHeader(a.toLowerCase(),o),s=0}return s===void 0?{error:`error parsing header '`+a+`'`}:!0}e.parseHeader=n;function r(e,r){let i=0,a=e.indexOf(`\r
25
- `);if(a===-1){r.warn(`no CRLF found, not a SIP message, discarded`);return}let o=e.substring(0,a),s=A.parse(o,`Request_Response`),c;if(s===-1){r.warn(`error parsing first line of SIP message: "`+o+`"`);return}else s.status_code?(c=new de,c.statusCode=s.status_code,c.reasonPhrase=s.reason_phrase):(c=new ue,c.method=s.method,c.ruri=s.uri);c.data=e,i=a+2;let l;for(;;){if(a=t(e,i),a===-2){l=i+2;break}else if(a===-1){r.error(`malformed message`);return}let o=n(c,e,i,a);if(o&&o!==!0){r.error(o.error);return}i=a+2}return c.hasHeader(`content-length`)?c.body=e.substr(l,Number(c.getHeader(`content-length`))):c.body=e.substring(l),c}e.parseMessage=r})(Le=Le||={});function Re(e,t){if(t.statusCode<100||t.statusCode>699)throw TypeError(`Invalid statusCode: `+t.statusCode);let n=t.reasonPhrase?t.reasonPhrase:oe(t.statusCode),r=`SIP/2.0 `+t.statusCode+` `+n+`\r
23
+ `,e}};function de(e){return e===`application/sdp`?`session`:`render`}function fe(e){let t=typeof e==`string`?e:e.body,n=typeof e==`string`?`application/sdp`:e.contentType;return{contentDisposition:de(n),contentType:n,content:t}}function pe(e){return e&&typeof e.content==`string`&&typeof e.contentType==`string`&&e.contentDisposition===void 0?!0:typeof e.contentDisposition==`string`}function me(e){let t,n,r;if(e instanceof le&&e.body){let i=e.parseHeader(`Content-Disposition`);t=i?i.type:void 0,n=e.parseHeader(`Content-Type`),r=e.body}if(e instanceof ue&&e.body){let i=e.parseHeader(`Content-Disposition`);t=i?i.type:void 0,n=e.parseHeader(`Content-Type`),r=e.body}if(e instanceof P&&e.body)if(t=e.getHeader(`Content-Disposition`),n=e.getHeader(`Content-Type`),typeof e.body==`string`){if(!n)throw Error(`Header content type header does not equal body content type.`);r=e.body}else{if(n&&n!==e.body.contentType)throw Error(`Header content type header does not equal body content type.`);n=e.body.contentType,r=e.body.body}if(pe(e)&&(t=e.contentDisposition,n=e.contentType,r=e.content),r){if(n&&!t&&(t=de(n)),!t)throw Error(`Content disposition undefined.`);if(!n)throw Error(`Content type undefined.`);return{contentDisposition:t,contentType:n,content:r}}}var he;(function(e){e.Initial=`Initial`,e.Early=`Early`,e.AckWait=`AckWait`,e.Confirmed=`Confirmed`,e.Terminated=`Terminated`})(he=he||={});var F;(function(e){e.Initial=`Initial`,e.HaveLocalOffer=`HaveLocalOffer`,e.HaveRemoteOffer=`HaveRemoteOffer`,e.Stable=`Stable`,e.Closed=`Closed`})(F=F||={});var ge=500,_e=4e3,ve=5e3;let I={T1:ge,T2:_e,T4:ve,TIMER_B:64*ge,TIMER_D:0*ge,TIMER_F:64*ge,TIMER_H:64*ge,TIMER_I:0*ve,TIMER_J:0*ge,TIMER_K:0*ve,TIMER_L:64*ge,TIMER_M:64*ge,TIMER_N:64*ge,PROVISIONAL_RESPONSE_INTERVAL:6e4};var ye=class extends g{constructor(e){super(e||`Transaction state error.`)}},L;(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`})(L=L||={});let be=[L.ACK,L.BYE,L.CANCEL,L.INFO,L.INVITE,L.MESSAGE,L.NOTIFY,L.OPTIONS,L.PRACK,L.REFER,L.REGISTER,L.SUBSCRIBE];var xe=class{constructor(e){this.incomingMessageRequest=e}get request(){return this.incomingMessageRequest.message}accept(e){return this.incomingMessageRequest.accept(e),Promise.resolve()}reject(e){return this.incomingMessageRequest.reject(e),Promise.resolve()}},Se=class{constructor(e){this.incomingNotifyRequest=e}get request(){return this.incomingNotifyRequest.message}accept(e){return this.incomingNotifyRequest.accept(e),Promise.resolve()}reject(e){return this.incomingNotifyRequest.reject(e),Promise.resolve()}},Ce=class{constructor(e,t){this.incomingReferRequest=e,this.session=t}get referTo(){let e=this.incomingReferRequest.message.parseHeader(`refer-to`);if(!(e instanceof D))throw Error(`Failed to parse Refer-To header.`);return e}get referredBy(){return this.incomingReferRequest.message.getHeader(`referred-by`)}get replaces(){let e=this.referTo.uri.getHeader(`replaces`);return e instanceof Array?e[0]:e}get request(){return this.incomingReferRequest.message}accept(e={statusCode:202}){return this.incomingReferRequest.accept(e),Promise.resolve()}reject(e){return this.incomingReferRequest.reject(e),Promise.resolve()}makeInviter(e){if(this.inviter)return this.inviter;let t=this.referTo.uri.clone();t.clearHeaders(),e||={};let n=(e.extraHeaders||[]).slice(),r=this.replaces;r&&n.push(`Replaces: `+decodeURIComponent(r));let i=this.referredBy;return i&&n.push(`Referred-By: `+i),e.extraHeaders=n,this.inviter=this.session.userAgent._makeInviter(t,e),this.inviter._referred=this.session,this.session._referral=this.inviter,this.inviter}},R;(function(e){e.Initial=`Initial`,e.Establishing=`Establishing`,e.Established=`Established`,e.Terminating=`Terminating`,e.Terminated=`Terminated`})(R=R||={});var we=class e{constructor(e,t={}){this.pendingReinvite=!1,this.pendingReinviteAck=!1,this._state=R.Initial,this.delegate=t.delegate,this._stateEventEmitter=new T,this._userAgent=e}dispose(){switch(this.logger.log(`Session ${this.id} in state ${this._state} is being disposed`),delete this.userAgent._sessions[this.id],this._sessionDescriptionHandler&&this._sessionDescriptionHandler.close(),this.state){case R.Initial:break;case R.Establishing:break;case R.Established:return new Promise(e=>{this._bye({onAccept:()=>e(),onRedirect:()=>e(),onReject:()=>e()})});case R.Terminating:break;case R.Terminated:break;default:throw Error(`Unknown state.`)}return Promise.resolve()}get assertedIdentity(){return this._assertedIdentity}get dialog(){return this._dialog}get id(){return this._id}get replacee(){return this._replacee}get sessionDescriptionHandler(){return this._sessionDescriptionHandler}get sessionDescriptionHandlerFactory(){return this.userAgent.configuration.sessionDescriptionHandlerFactory}get sessionDescriptionHandlerModifiers(){return this._sessionDescriptionHandlerModifiers||[]}set sessionDescriptionHandlerModifiers(e){this._sessionDescriptionHandlerModifiers=e.slice()}get sessionDescriptionHandlerOptions(){return this._sessionDescriptionHandlerOptions||{}}set sessionDescriptionHandlerOptions(e){this._sessionDescriptionHandlerOptions=Object.assign({},e)}get sessionDescriptionHandlerModifiersReInvite(){return this._sessionDescriptionHandlerModifiersReInvite||[]}set sessionDescriptionHandlerModifiersReInvite(e){this._sessionDescriptionHandlerModifiersReInvite=e.slice()}get sessionDescriptionHandlerOptionsReInvite(){return this._sessionDescriptionHandlerOptionsReInvite||{}}set sessionDescriptionHandlerOptionsReInvite(e){this._sessionDescriptionHandlerOptionsReInvite=Object.assign({},e)}get state(){return this._state}get stateChange(){return this._stateEventEmitter}get userAgent(){return this._userAgent}bye(e={}){let t=`Session.bye() may only be called if established session.`;switch(this.state){case R.Initial:typeof this.cancel==`function`?(t+=` However Inviter.invite() has not yet been called.`,t+=` Perhaps you should have called Inviter.cancel()?`):typeof this.reject==`function`&&(t+=` However Invitation.accept() has not yet been called.`,t+=` Perhaps you should have called Invitation.reject()?`);break;case R.Establishing:typeof this.cancel==`function`?(t+=` However a dialog does not yet exist.`,t+=` Perhaps you should have called Inviter.cancel()?`):typeof this.reject==`function`&&(t+=` However Invitation.accept() has not yet been called (or not yet resolved).`,t+=` Perhaps you should have called Invitation.reject()?`);break;case R.Established:{let t=e.requestDelegate,n=this.copyRequestOptions(e.requestOptions);return this._bye(t,n)}case R.Terminating:t+=` However this session is already terminating.`,typeof this.cancel==`function`?t+=` Perhaps you have already called Inviter.cancel()?`:typeof this.reject==`function`&&(t+=` Perhaps you have already called Session.bye()?`);break;case R.Terminated:t+=` However this session is already terminated.`;break;default:throw Error(`Unknown state`)}return this.logger.error(t),Promise.reject(Error(`Invalid session state ${this.state}`))}info(e={}){if(this.state!==R.Established)return this.logger.error(`Session.info() may only be called if established session.`),Promise.reject(Error(`Invalid session state ${this.state}`));let t=e.requestDelegate,n=this.copyRequestOptions(e.requestOptions);return this._info(t,n)}invite(e={}){if(this.logger.log(`Session.invite`),this.state!==R.Established)return Promise.reject(Error(`Invalid session state ${this.state}`));if(this.pendingReinvite)return Promise.reject(new v(`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);let t={onAccept:t=>{let n=me(t.message);if(!n){this.logger.error(`Received 2xx response to re-INVITE without a session description`),this.ackAndBye(t,400,`Missing session description`),this.stateTransition(R.Terminated),this.pendingReinvite=!1;return}if(e.withoutSdp){let r={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptionsReInvite,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiersReInvite};this.setOfferAndGetAnswer(n,r).then(e=>{t.ack({body:e})}).catch(e=>{this.logger.error(`Failed to handle offer in 2xx response to re-INVITE`),this.logger.error(e.message),this.state===R.Terminated?t.ack():(this.ackAndBye(t,488,`Bad Media Description`),this.stateTransition(R.Terminated))}).then(()=>{this.pendingReinvite=!1,e.requestDelegate&&e.requestDelegate.onAccept&&e.requestDelegate.onAccept(t)})}else{let r={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptionsReInvite,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiersReInvite};this.setAnswer(n,r).then(()=>{t.ack()}).catch(e=>{this.logger.error(`Failed to handle answer in 2xx response to re-INVITE`),this.logger.error(e.message),this.state===R.Terminated?t.ack():(this.ackAndBye(t,488,`Bad Media Description`),this.stateTransition(R.Terminated))}).then(()=>{this.pendingReinvite=!1,e.requestDelegate&&e.requestDelegate.onAccept&&e.requestDelegate.onAccept(t)})}},onProgress:e=>{},onRedirect:e=>{},onReject:t=>{this.logger.warn(`Received a non-2xx response to re-INVITE`),this.pendingReinvite=!1,e.withoutSdp?e.requestDelegate&&e.requestDelegate.onReject&&e.requestDelegate.onReject(t):this.rollbackOffer().catch(e=>{if(this.logger.error(`Failed to rollback offer on non-2xx response to re-INVITE`),this.logger.error(e.message),this.state!==R.Terminated){if(!this.dialog)throw Error(`Dialog undefined.`);let e=[];e.push(`Reason: `+this.getReasonHeaderValue(500,`Internal Server Error`)),this.dialog.bye(void 0,{extraHeaders:e}),this.stateTransition(R.Terminated)}}).then(()=>{e.requestDelegate&&e.requestDelegate.onReject&&e.requestDelegate.onReject(t)})},onTrying:e=>{}},n=e.requestOptions||{};if(n.extraHeaders=(n.extraHeaders||[]).slice(),n.extraHeaders.push(`Allow: `+be.toString()),n.extraHeaders.push(`Contact: `+this._contact),e.withoutSdp){if(!this.dialog)throw this.pendingReinvite=!1,Error(`Dialog undefined.`);return Promise.resolve(this.dialog.invite(t,n))}let r={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptionsReInvite,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiersReInvite};return this.getOffer(r).then(e=>{if(!this.dialog)throw this.pendingReinvite=!1,Error(`Dialog undefined.`);return n.body=e,this.dialog.invite(t,n)}).catch(e=>{throw this.logger.error(e.message),this.logger.error(`Failed to send re-INVITE`),this.pendingReinvite=!1,e})}message(e={}){if(this.state!==R.Established)return this.logger.error(`Session.message() may only be called if established session.`),Promise.reject(Error(`Invalid session state ${this.state}`));let t=e.requestDelegate,n=this.copyRequestOptions(e.requestOptions);return this._message(t,n)}refer(t,n={}){if(this.state!==R.Established)return this.logger.error(`Session.refer() may only be called if established session.`),Promise.reject(Error(`Invalid session state ${this.state}`));if(t instanceof e&&!t.dialog)return this.logger.error(`Session.refer() may only be called with session which is established. You are perhaps attempting to attended transfer to a target for which there is not dialog yet established. Perhaps you are attempting a 'semi-attended' tansfer? Regardless, this is not supported. The recommended approached is to check to see if the target Session is in the Established state before calling refer(); if the state is not Established you may proceed by falling back using a URI as the target (blind transfer).`),Promise.reject(Error(`Invalid session state ${this.state}`));let r=n.requestDelegate,i=this.copyRequestOptions(n.requestOptions);return i.extraHeaders=i.extraHeaders?i.extraHeaders.concat(this.referExtraHeaders(this.referToString(t))):this.referExtraHeaders(this.referToString(t)),this._refer(n.onNotify,r,i)}_bye(e,t){if(!this.dialog)return Promise.reject(Error(`Session dialog undefined.`));let n=this.dialog;switch(n.sessionState){case he.Initial:throw Error(`Invalid dialog state ${n.sessionState}`);case he.Early:throw Error(`Invalid dialog state ${n.sessionState}`);case he.AckWait:return this.stateTransition(R.Terminating),new Promise(r=>{n.delegate={onAck:()=>{let i=n.bye(e,t);return this.stateTransition(R.Terminated),r(i),Promise.resolve()},onAckTimeout:()=>{let i=n.bye(e,t);this.stateTransition(R.Terminated),r(i)}}});case he.Confirmed:{let r=n.bye(e,t);return this.stateTransition(R.Terminated),Promise.resolve(r)}case he.Terminated:throw Error(`Invalid dialog state ${n.sessionState}`);default:throw Error(`Unrecognized state.`)}}_info(e,t){return this.dialog?Promise.resolve(this.dialog.info(e,t)):Promise.reject(Error(`Session dialog undefined.`))}_message(e,t){return this.dialog?Promise.resolve(this.dialog.message(e,t)):Promise.reject(Error(`Session dialog undefined.`))}_refer(e,t,n){return this.dialog?(this.onNotify=e,Promise.resolve(this.dialog.refer(t,n))):Promise.reject(Error(`Session dialog undefined.`))}ackAndBye(e,t,n){e.ack();let r=[];t&&r.push(`Reason: `+this.getReasonHeaderValue(t,n)),e.session.bye(void 0,{extraHeaders:r})}onAckRequest(e){if(this.logger.log(`Session.onAckRequest`),this.state!==R.Established&&this.state!==R.Terminating)return this.logger.error(`ACK received while in state ${this.state}, dropping request`),Promise.resolve();let t=this.dialog;if(!t)throw Error(`Dialog undefined.`);let n={sessionDescriptionHandlerOptions:this.pendingReinviteAck?this.sessionDescriptionHandlerOptionsReInvite:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.pendingReinviteAck?this._sessionDescriptionHandlerModifiersReInvite:this._sessionDescriptionHandlerModifiers};if(this.delegate&&this.delegate.onAck){let t=new S(e);this.delegate.onAck(t)}switch(this.pendingReinviteAck=!1,t.signalingState){case F.Initial:{this.logger.error(`Invalid signaling state ${t.signalingState}.`);let e=[`Reason: `+this.getReasonHeaderValue(488,`Bad Media Description`)];return t.bye(void 0,{extraHeaders:e}),this.stateTransition(R.Terminated),Promise.resolve()}case F.Stable:{let r=me(e.message);return r?r.contentDisposition===`render`?(this._renderbody=r.content,this._rendertype=r.contentType,Promise.resolve()):r.contentDisposition===`session`?this.setAnswer(r,n).catch(e=>{this.logger.error(e.message);let n=[`Reason: `+this.getReasonHeaderValue(488,`Bad Media Description`)];t.bye(void 0,{extraHeaders:n}),this.stateTransition(R.Terminated)}):Promise.resolve():Promise.resolve()}case F.HaveLocalOffer:{this.logger.error(`Invalid signaling state ${t.signalingState}.`);let e=[`Reason: `+this.getReasonHeaderValue(488,`Bad Media Description`)];return t.bye(void 0,{extraHeaders:e}),this.stateTransition(R.Terminated),Promise.resolve()}case F.HaveRemoteOffer:{this.logger.error(`Invalid signaling state ${t.signalingState}.`);let e=[`Reason: `+this.getReasonHeaderValue(488,`Bad Media Description`)];return t.bye(void 0,{extraHeaders:e}),this.stateTransition(R.Terminated),Promise.resolve()}case F.Closed:throw Error(`Invalid signaling state ${t.signalingState}.`);default:throw Error(`Invalid signaling state ${t.signalingState}.`)}}onByeRequest(e){if(this.logger.log(`Session.onByeRequest`),this.state!==R.Established){this.logger.error(`BYE received while in state ${this.state}, dropping request`);return}if(this.delegate&&this.delegate.onBye){let t=new C(e);this.delegate.onBye(t)}else e.accept();this.stateTransition(R.Terminated)}onInfoRequest(e){if(this.logger.log(`Session.onInfoRequest`),this.state!==R.Established){this.logger.error(`INFO received while in state ${this.state}, dropping request`);return}if(this.delegate&&this.delegate.onInfo){let t=new E(e);this.delegate.onInfo(t)}else e.accept()}onInviteRequest(e){if(this.logger.log(`Session.onInviteRequest`),this.state!==R.Established){this.logger.error(`INVITE received while in state ${this.state}, dropping request`);return}this.pendingReinviteAck=!0;let t=[`Contact: `+this._contact];if(e.message.hasHeader(`P-Asserted-Identity`)){let t=e.message.getHeader(`P-Asserted-Identity`);if(!t)throw Error(`Header undefined.`);this._assertedIdentity=A.nameAddrHeaderParse(t)}let n={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptionsReInvite,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiersReInvite};this.generateResponseOfferAnswerInDialog(n).then(n=>{let r=e.accept({statusCode:200,extraHeaders:t,body:n});this.delegate&&this.delegate.onInvite&&this.delegate.onInvite(e.message,r.message,200)}).catch(t=>{if(this.logger.error(t.message),this.logger.error(`Failed to handle to re-INVITE request`),!this.dialog)throw Error(`Dialog undefined.`);if(this.logger.error(this.dialog.signalingState),this.dialog.signalingState===F.Stable){let t=e.reject({statusCode:488});this.delegate&&this.delegate.onInvite&&this.delegate.onInvite(e.message,t.message,488);return}this.rollbackOffer().then(()=>{let t=e.reject({statusCode:488});this.delegate&&this.delegate.onInvite&&this.delegate.onInvite(e.message,t.message,488)}).catch(t=>{this.logger.error(t.message),this.logger.error(`Failed to rollback offer on re-INVITE request`);let n=e.reject({statusCode:488});if(this.state!==R.Terminated){if(!this.dialog)throw Error(`Dialog undefined.`);let e=[];e.push(`Reason: `+this.getReasonHeaderValue(500,`Internal Server Error`)),this.dialog.bye(void 0,{extraHeaders:e}),this.stateTransition(R.Terminated)}this.delegate&&this.delegate.onInvite&&this.delegate.onInvite(e.message,n.message,488)})})}onMessageRequest(e){if(this.logger.log(`Session.onMessageRequest`),this.state!==R.Established){this.logger.error(`MESSAGE received while in state ${this.state}, dropping request`);return}if(this.delegate&&this.delegate.onMessage){let t=new xe(e);this.delegate.onMessage(t)}else e.accept()}onNotifyRequest(e){if(this.logger.log(`Session.onNotifyRequest`),this.state!==R.Established){this.logger.error(`NOTIFY received while in state ${this.state}, dropping request`);return}if(this.onNotify){let t=new Se(e);this.onNotify(t);return}if(this.delegate&&this.delegate.onNotify){let t=new Se(e);this.delegate.onNotify(t)}else e.accept()}onPrackRequest(e){if(this.logger.log(`Session.onPrackRequest`),this.state!==R.Established){this.logger.error(`PRACK received while in state ${this.state}, dropping request`);return}throw Error(`Unimplemented.`)}onReferRequest(e){if(this.logger.log(`Session.onReferRequest`),this.state!==R.Established){this.logger.error(`REFER received while in state ${this.state}, dropping request`);return}if(!e.message.hasHeader(`refer-to`)){this.logger.warn(`Invalid REFER packet. A refer-to header is required. Rejecting.`),e.reject();return}let t=new Ce(e,this);this.delegate&&this.delegate.onRefer?this.delegate.onRefer(t):(this.logger.log(`No delegate available to handle REFER, automatically accepting and following.`),t.accept().then(()=>t.makeInviter(this._referralInviterOptions).invite()).catch(e=>{this.logger.error(e.message)}))}generateResponseOfferAnswer(e,t){if(this.dialog)return this.generateResponseOfferAnswerInDialog(t);let n=me(e.message);return!n||n.contentDisposition!==`session`?this.getOffer(t):this.setOfferAndGetAnswer(n,t)}generateResponseOfferAnswerInDialog(e){if(!this.dialog)throw Error(`Dialog undefined.`);switch(this.dialog.signalingState){case F.Initial:return this.getOffer(e);case F.HaveLocalOffer:return Promise.resolve(void 0);case F.HaveRemoteOffer:if(!this.dialog.offer)throw Error(`Session offer undefined in signaling state ${this.dialog.signalingState}.`);return this.setOfferAndGetAnswer(this.dialog.offer,e);case F.Stable:return this.state===R.Established?this.getOffer(e):Promise.resolve(void 0);case F.Closed:throw Error(`Invalid signaling state ${this.dialog.signalingState}.`);default:throw Error(`Invalid signaling state ${this.dialog.signalingState}.`)}}getOffer(e){let t=this.setupSessionDescriptionHandler(),n=e.sessionDescriptionHandlerOptions,r=e.sessionDescriptionHandlerModifiers;try{return t.getDescription(n,r).then(e=>fe(e)).catch(e=>{this.logger.error(`Session.getOffer: SDH getDescription rejected...`);let t=e instanceof Error?e:Error(`Session.getOffer unknown error.`);throw this.logger.error(t.message),t})}catch(e){this.logger.error(`Session.getOffer: SDH getDescription threw...`);let t=e instanceof Error?e:Error(e);return this.logger.error(t.message),Promise.reject(t)}}rollbackOffer(){let e=this.setupSessionDescriptionHandler();if(e.rollbackDescription===void 0)return Promise.resolve();try{return e.rollbackDescription().catch(e=>{this.logger.error(`Session.rollbackOffer: SDH rollbackDescription rejected...`);let t=e instanceof Error?e:Error(`Session.rollbackOffer unknown error.`);throw this.logger.error(t.message),t})}catch(e){this.logger.error(`Session.rollbackOffer: SDH rollbackDescription threw...`);let t=e instanceof Error?e:Error(e);return this.logger.error(t.message),Promise.reject(t)}}setAnswer(e,t){let n=this.setupSessionDescriptionHandler(),r=t.sessionDescriptionHandlerOptions,i=t.sessionDescriptionHandlerModifiers;try{if(!n.hasDescription(e.contentType))return Promise.reject(new _)}catch(e){this.logger.error(`Session.setAnswer: SDH hasDescription threw...`);let t=e instanceof Error?e:Error(e);return this.logger.error(t.message),Promise.reject(t)}try{return n.setDescription(e.content,r,i).catch(e=>{this.logger.error(`Session.setAnswer: SDH setDescription rejected...`);let t=e instanceof Error?e:Error(`Session.setAnswer unknown error.`);throw this.logger.error(t.message),t})}catch(e){this.logger.error(`Session.setAnswer: SDH setDescription threw...`);let t=e instanceof Error?e:Error(e);return this.logger.error(t.message),Promise.reject(t)}}setOfferAndGetAnswer(e,t){let n=this.setupSessionDescriptionHandler(),r=t.sessionDescriptionHandlerOptions,i=t.sessionDescriptionHandlerModifiers;try{if(!n.hasDescription(e.contentType))return Promise.reject(new _)}catch(e){this.logger.error(`Session.setOfferAndGetAnswer: SDH hasDescription threw...`);let t=e instanceof Error?e:Error(e);return this.logger.error(t.message),Promise.reject(t)}try{return n.setDescription(e.content,r,i).then(()=>n.getDescription(r,i)).then(e=>fe(e)).catch(e=>{this.logger.error(`Session.setOfferAndGetAnswer: SDH setDescription or getDescription rejected...`);let t=e instanceof Error?e:Error(`Session.setOfferAndGetAnswer unknown error.`);throw this.logger.error(t.message),t})}catch(e){this.logger.error(`Session.setOfferAndGetAnswer: SDH setDescription or getDescription threw...`);let t=e instanceof Error?e:Error(e);return this.logger.error(t.message),Promise.reject(t)}}setSessionDescriptionHandler(e){if(this._sessionDescriptionHandler)throw Error(`Session description handler defined.`);this._sessionDescriptionHandler=e}setupSessionDescriptionHandler(){return this._sessionDescriptionHandler?this._sessionDescriptionHandler:(this._sessionDescriptionHandler=this.sessionDescriptionHandlerFactory(this,this.userAgent.configuration.sessionDescriptionHandlerFactoryOptions),this.delegate?.onSessionDescriptionHandler&&this.delegate.onSessionDescriptionHandler(this._sessionDescriptionHandler,!1),this._sessionDescriptionHandler)}stateTransition(e){let t=()=>{throw Error(`Invalid state transition from ${this._state} to ${e}`)};switch(this._state){case R.Initial:e!==R.Establishing&&e!==R.Established&&e!==R.Terminating&&e!==R.Terminated&&t();break;case R.Establishing:e!==R.Established&&e!==R.Terminating&&e!==R.Terminated&&t();break;case R.Established:e!==R.Terminating&&e!==R.Terminated&&t();break;case R.Terminating:e!==R.Terminated&&t();break;case R.Terminated:t();break;default:throw Error(`Unrecognized state.`)}this._state=e,this.logger.log(`Session ${this.id} transitioned to state ${this._state}`),this._stateEventEmitter.emit(this._state),e===R.Terminated&&this.dispose()}copyRequestOptions(e={}){return{extraHeaders:e.extraHeaders?e.extraHeaders.slice():void 0,body:e.body?{contentDisposition:e.body.contentDisposition||`render`,contentType:e.body.contentType||`text/plain`,content:e.body.content||``}:void 0}}getReasonHeaderValue(e,t){let n=e,r=oe(e);return!r&&t&&(r=t),`SIP;cause=`+n+`;text="`+r+`"`}referExtraHeaders(e){let 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}referToString(e){let t;if(e instanceof te)t=e.toString();else{if(!e.dialog)throw Error(`Dialog undefined.`);let n=e.remoteIdentity.friendlyName,r=e.dialog.remoteTarget.toString(),i=e.dialog.callId,a=e.dialog.remoteTag,o=e.dialog.localTag;t=`"${n}" <${r}?Replaces=${encodeURIComponent(`${i};to-tag=${a};from-tag=${o}`)}>`}return t}},Te;(function(e){e.Required=`Required`,e.Supported=`Supported`,e.Unsupported=`Unsupported`})(Te=Te||={});let Ee={"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};var De=class extends we{constructor(e,t){super(e),this.incomingInviteRequest=t,this.disposed=!1,this.expiresTimer=void 0,this.isCanceled=!1,this.rel100=`none`,this.rseq=Math.floor(Math.random()*1e4),this.userNoAnswerTimer=void 0,this.waitingForPrack=!1,this.logger=e.getLogger(`sip.Invitation`);let n=this.incomingInviteRequest.message,r=n.getHeader(`require`);r&&r.toLowerCase().includes(`100rel`)&&(this.rel100=`required`);let i=n.getHeader(`supported`);if(i&&i.toLowerCase().includes(`100rel`)&&(this.rel100=`supported`),n.toTag=t.toTag,typeof n.toTag!=`string`)throw TypeError(`toTag should have been a string.`);if(this.userNoAnswerTimer=setTimeout(()=>{t.reject({statusCode:480}),this.stateTransition(R.Terminated)},this.userAgent.configuration.noAnswerTimeout?this.userAgent.configuration.noAnswerTimeout*1e3:6e4),n.hasHeader(`expires`)){let e=Number(n.getHeader(`expires`)||0)*1e3;this.expiresTimer=setTimeout(()=>{this.state===R.Initial&&(t.reject({statusCode:487}),this.stateTransition(R.Terminated))},e)}let a=this.request.getHeader(`P-Asserted-Identity`);a&&(this._assertedIdentity=A.nameAddrHeaderParse(a)),this._contact=this.userAgent.contact.toString();let o=n.parseHeader(`Content-Disposition`);o&&o.type===`render`&&(this._renderbody=n.body,this._rendertype=n.getHeader(`Content-Type`)),this._id=n.callId+n.fromTag,this.userAgent._sessions[this._id]=this}dispose(){if(this.disposed)return Promise.resolve();switch(this.disposed=!0,this.expiresTimer&&=(clearTimeout(this.expiresTimer),void 0),this.userNoAnswerTimer&&=(clearTimeout(this.userNoAnswerTimer),void 0),this.prackNeverArrived(),this.state){case R.Initial:return this.reject().then(()=>super.dispose());case R.Establishing:return this.reject().then(()=>super.dispose());case R.Established:return super.dispose();case R.Terminating:return super.dispose();case R.Terminated:return super.dispose();default:throw Error(`Unknown state.`)}}get autoSendAnInitialProvisionalResponse(){return this.rel100!==`required`&&this.userAgent.configuration.sendInitialProvisionalResponse}get body(){return this.incomingInviteRequest.message.body}get localIdentity(){return this.request.to}get remoteIdentity(){return this.request.from}get request(){return this.incomingInviteRequest.message}accept(e={}){if(this.logger.log(`Invitation.accept`),this.state!==R.Initial){let e=Error(`Invalid session state ${this.state}`);return this.logger.error(e.message),Promise.reject(e)}return e.sessionDescriptionHandlerModifiers&&(this.sessionDescriptionHandlerModifiers=e.sessionDescriptionHandlerModifiers),e.sessionDescriptionHandlerOptions&&(this.sessionDescriptionHandlerOptions=e.sessionDescriptionHandlerOptions),this.stateTransition(R.Establishing),this.sendAccept(e).then(({message:e,session:t})=>{t.delegate={onAck:e=>this.onAckRequest(e),onAckTimeout:()=>this.onAckTimeout(),onBye:e=>this.onByeRequest(e),onInfo:e=>this.onInfoRequest(e),onInvite:e=>this.onInviteRequest(e),onMessage:e=>this.onMessageRequest(e),onNotify:e=>this.onNotifyRequest(e),onPrack:e=>this.onPrackRequest(e),onRefer:e=>this.onReferRequest(e)},this._dialog=t,this.stateTransition(R.Established),this._replacee&&this._replacee._bye()}).catch(e=>this.handleResponseError(e))}progress(e={}){if(this.logger.log(`Invitation.progress`),this.state!==R.Initial){let e=Error(`Invalid session state ${this.state}`);return this.logger.error(e.message),Promise.reject(e)}let t=e.statusCode||180;if(t<100||t>199)throw TypeError(`Invalid statusCode: `+t);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()):e.statusCode===100?this.sendProgressTrying().then(()=>{}).catch(e=>this.handleResponseError(e)):this.rel100!==`required`&&!(this.rel100===`supported`&&e.rel100)&&!(this.rel100===`supported`&&this.userAgent.configuration.sipExtension100rel===Te.Required)?this.sendProgress(e).then(()=>{}).catch(e=>this.handleResponseError(e)):this.sendProgressReliableWaitForPrack(e).then(()=>{}).catch(e=>this.handleResponseError(e))}reject(e={}){if(this.logger.log(`Invitation.reject`),this.state!==R.Initial&&this.state!==R.Establishing){let e=Error(`Invalid session state ${this.state}`);return this.logger.error(e.message),Promise.reject(e)}let t=e.statusCode||480,n=e.reasonPhrase?e.reasonPhrase:oe(t),r=e.extraHeaders||[];if(t<300||t>699)throw TypeError(`Invalid statusCode: `+t);let i=e.body?fe(e.body):void 0;return t<400?this.incomingInviteRequest.redirect([],{statusCode:t,reasonPhrase:n,extraHeaders:r,body:i}):this.incomingInviteRequest.reject({statusCode:t,reasonPhrase:n,extraHeaders:r,body:i}),this.stateTransition(R.Terminated),Promise.resolve()}_onCancel(e){if(this.logger.log(`Invitation._onCancel`),this.state!==R.Initial&&this.state!==R.Establishing){this.logger.error(`CANCEL received while in state ${this.state}, dropping request`);return}if(this.delegate&&this.delegate.onCancel){let t=new w(e);this.delegate.onCancel(t)}this.isCanceled=!0,this.incomingInviteRequest.reject({statusCode:487}),this.stateTransition(R.Terminated)}handlePrackOfferAnswer(e){if(!this.dialog)throw Error(`Dialog undefined.`);let t=me(e.message);if(!t||t.contentDisposition!==`session`)return Promise.resolve(void 0);let n={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers};switch(this.dialog.signalingState){case F.Initial:throw Error(`Invalid signaling state ${this.dialog.signalingState}.`);case F.Stable:return this.setAnswer(t,n).then(()=>void 0);case F.HaveLocalOffer:throw Error(`Invalid signaling state ${this.dialog.signalingState}.`);case F.HaveRemoteOffer:return this.setOfferAndGetAnswer(t,n);case F.Closed:throw Error(`Invalid signaling state ${this.dialog.signalingState}.`);default:throw Error(`Invalid signaling state ${this.dialog.signalingState}.`)}}handleResponseError(e){let t=480;if(e instanceof Error?this.logger.error(e.message):this.logger.error(e),e instanceof _?(this.logger.error(`A session description handler occurred while sending response (content type unsupported`),t=415):e instanceof y?this.logger.error(`A session description handler occurred while sending response`):e instanceof b?this.logger.error(`Session ended before response could be formulated and sent (while waiting for PRACK)`):e instanceof ye&&this.logger.error(`Session changed state before response could be formulated and sent`),this.state===R.Initial||this.state===R.Establishing)try{this.incomingInviteRequest.reject({statusCode:t}),this.stateTransition(R.Terminated)}catch(e){throw this.logger.error(`An error occurred attempting to reject the request while handling another error`),e}if(this.isCanceled){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.`);return}throw e}onAckTimeout(){if(this.logger.log(`Invitation.onAckTimeout`),!this.dialog)throw Error(`Dialog undefined.`);this.logger.log(`No ACK received for an extended period of time, terminating session`),this.dialog.bye(),this.stateTransition(R.Terminated)}sendAccept(e={}){let t={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers},n=e.extraHeaders||[];return this.waitingForPrack?this.waitForArrivalOfPrack().then(()=>clearTimeout(this.userNoAnswerTimer)).then(()=>this.generateResponseOfferAnswer(this.incomingInviteRequest,t)).then(e=>this.incomingInviteRequest.accept({statusCode:200,body:e,extraHeaders:n})):(clearTimeout(this.userNoAnswerTimer),this.generateResponseOfferAnswer(this.incomingInviteRequest,t).then(e=>this.incomingInviteRequest.accept({statusCode:200,body:e,extraHeaders:n})))}sendProgress(e={}){let t=e.statusCode||180,n=e.reasonPhrase,r=(e.extraHeaders||[]).slice(),i=e.body?fe(e.body):void 0;if(t===183&&!i)return this.sendProgressWithSDP(e);try{let e=this.incomingInviteRequest.progress({statusCode:t,reasonPhrase:n,extraHeaders:r,body:i});return this._dialog=e.session,Promise.resolve(e)}catch(e){return Promise.reject(e)}}sendProgressWithSDP(e={}){let t={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers},n=e.statusCode||183,r=e.reasonPhrase,i=(e.extraHeaders||[]).slice();return this.generateResponseOfferAnswer(this.incomingInviteRequest,t).then(e=>this.incomingInviteRequest.progress({statusCode:n,reasonPhrase:r,extraHeaders:i,body:e})).then(e=>(this._dialog=e.session,e))}sendProgressReliable(e={}){return e.extraHeaders=(e.extraHeaders||[]).slice(),e.extraHeaders.push(`Require: 100rel`),e.extraHeaders.push(`RSeq: `+Math.floor(Math.random()*1e4)),this.sendProgressWithSDP(e)}sendProgressReliableWaitForPrack(e={}){let t={sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions,sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers},n=e.statusCode||183,r=e.reasonPhrase,i=(e.extraHeaders||[]).slice();i.push(`Require: 100rel`),i.push(`RSeq: `+ this.rseq++);let a;return new Promise((e,o)=>{this.waitingForPrack=!0,this.generateResponseOfferAnswer(this.incomingInviteRequest,t).then(e=>(a=e,this.incomingInviteRequest.progress({statusCode:n,reasonPhrase:r,extraHeaders:i,body:a}))).then(t=>{this._dialog=t.session;let s,c;t.session.delegate={onPrack:n=>{s=n,clearTimeout(l),clearTimeout(f),this.waitingForPrack&&(this.waitingForPrack=!1,this.handlePrackOfferAnswer(s).then(n=>{try{c=s.accept({statusCode:200,body:n}),this.prackArrived(),e({prackRequest:s,prackResponse:c,progressResponse:t})}catch(e){o(e)}}).catch(e=>o(e)))}};let l=setTimeout(()=>{this.waitingForPrack&&(this.waitingForPrack=!1,this.logger.warn(`No PRACK received, rejecting INVITE.`),clearTimeout(f),this.reject({statusCode:504}).then(()=>o(new b)).catch(e=>o(e)))},I.T1*64),u=()=>{try{this.incomingInviteRequest.progress({statusCode:n,reasonPhrase:r,extraHeaders:i,body:a})}catch(e){this.waitingForPrack=!1,o(e);return}f=setTimeout(u,d*=2)},d=I.T1,f=setTimeout(u,d)}).catch(e=>{this.waitingForPrack=!1,o(e)})})}sendProgressTrying(){try{let e=this.incomingInviteRequest.trying();return Promise.resolve(e)}catch(e){return Promise.reject(e)}}waitForArrivalOfPrack(){if(this.waitingForPrackPromise)throw Error(`Already waiting for PRACK`);return this.waitingForPrackPromise=new Promise((e,t)=>{this.waitingForPrackResolve=e,this.waitingForPrackReject=t}),this.waitingForPrackPromise}prackArrived(){this.waitingForPrackResolve&&this.waitingForPrackResolve(),this.waitingForPrackPromise=void 0,this.waitingForPrackResolve=void 0,this.waitingForPrackReject=void 0}prackNeverArrived(){this.waitingForPrackReject&&this.waitingForPrackReject(new b),this.waitingForPrackPromise=void 0,this.waitingForPrackResolve=void 0,this.waitingForPrackReject=void 0}},Oe=class extends we{constructor(e,t,n={}){super(e,n),this.disposed=!1,this.earlyMedia=!1,this.earlyMediaSessionDescriptionHandlers=new Map,this.isCanceled=!1,this.inviteWithoutSdp=!1,this.logger=e.getLogger(`sip.Inviter`),this.earlyMedia=n.earlyMedia===void 0?this.earlyMedia:n.earlyMedia,this.fromTag=se(),this.inviteWithoutSdp=n.inviteWithoutSdp===void 0?this.inviteWithoutSdp:n.inviteWithoutSdp;let r=Object.assign({},n);r.params=Object.assign({},n.params);let i=n.anonymous||!1,a=e.contact.toString({anonymous:i,outbound:i?!e.contact.tempGruu:!e.contact.pubGruu});i&&e.configuration.uri&&(r.params.fromDisplayName=`Anonymous`,r.params.fromUri=`sip:anonymous@anonymous.invalid`);let o=e.userAgentCore.configuration.aor;if(r.params.fromUri&&(o=typeof r.params.fromUri==`string`?A.URIParse(r.params.fromUri):r.params.fromUri),!o)throw TypeError(`Invalid from URI: `+r.params.fromUri);let s=t;if(r.params.toUri&&(s=typeof r.params.toUri==`string`?A.URIParse(r.params.toUri):r.params.toUri),!s)throw TypeError(`Invalid to URI: `+r.params.toUri);let c=Object.assign({},r.params);c.fromTag=this.fromTag;let l=(r.extraHeaders||[]).slice();i&&e.configuration.uri&&(l.push(`P-Preferred-Identity: `+e.configuration.uri.toString()),l.push(`Privacy: id`)),l.push(`Contact: `+a),l.push(`Allow: `+[`ACK`,`CANCEL`,`INVITE`,`MESSAGE`,`BYE`,`OPTIONS`,`INFO`,`NOTIFY`,`REFER`].toString()),e.configuration.sipExtension100rel===Te.Required&&l.push(`Require: 100rel`),e.configuration.sipExtensionReplaces===Te.Required&&l.push(`Require: replaces`),r.extraHeaders=l,this.outgoingRequestMessage=e.userAgentCore.makeOutgoingRequestMessage(L.INVITE,t,o,s,c,l,void 0),this._contact=a,this._referralInviterOptions=r,this._renderbody=n.renderbody,this._rendertype=n.rendertype,n.sessionDescriptionHandlerModifiers&&(this.sessionDescriptionHandlerModifiers=n.sessionDescriptionHandlerModifiers),n.sessionDescriptionHandlerOptions&&(this.sessionDescriptionHandlerOptions=n.sessionDescriptionHandlerOptions),n.sessionDescriptionHandlerModifiersReInvite&&(this.sessionDescriptionHandlerModifiersReInvite=n.sessionDescriptionHandlerModifiersReInvite),n.sessionDescriptionHandlerOptionsReInvite&&(this.sessionDescriptionHandlerOptionsReInvite=n.sessionDescriptionHandlerOptionsReInvite),this._id=this.outgoingRequestMessage.callId+this.fromTag,this.userAgent._sessions[this._id]=this}dispose(){if(this.disposed)return Promise.resolve();switch(this.disposed=!0,this.disposeEarlyMedia(),this.state){case R.Initial:return this.cancel().then(()=>super.dispose());case R.Establishing:return this.cancel().then(()=>super.dispose());case R.Established:return super.dispose();case R.Terminating:return super.dispose();case R.Terminated:return super.dispose();default:throw Error(`Unknown state.`)}}get body(){return this.outgoingRequestMessage.body}get localIdentity(){return this.outgoingRequestMessage.from}get remoteIdentity(){return this.outgoingRequestMessage.to}get request(){return this.outgoingRequestMessage}cancel(e={}){if(this.logger.log(`Inviter.cancel`),this.state!==R.Initial&&this.state!==R.Establishing){let e=Error(`Invalid session state ${this.state}`);return this.logger.error(e.message),Promise.reject(e)}this.isCanceled=!0,this.stateTransition(R.Terminating);function t(e,t){if(e&&e<200||e>699)throw TypeError(`Invalid statusCode: `+e);if(e){let n=e,r=oe(e)||t;return`SIP;cause=`+n+`;text="`+r+`"`}}if(this.outgoingInviteRequest){let n;e.statusCode&&e.reasonPhrase&&(n=t(e.statusCode,e.reasonPhrase)),this.outgoingInviteRequest.cancel(n,e)}else this.logger.warn(`Canceled session before INVITE was sent`),this.stateTransition(R.Terminated);return Promise.resolve()}invite(e={}){if(this.logger.log(`Inviter.invite`),this.state!==R.Initial)return super.invite(e);if(e.sessionDescriptionHandlerModifiers&&(this.sessionDescriptionHandlerModifiers=e.sessionDescriptionHandlerModifiers),e.sessionDescriptionHandlerOptions&&(this.sessionDescriptionHandlerOptions=e.sessionDescriptionHandlerOptions),e.withoutSdp||this.inviteWithoutSdp)return this._renderbody&&this._rendertype&&(this.outgoingRequestMessage.body={contentType:this._rendertype,body:this._renderbody}),this.stateTransition(R.Establishing),Promise.resolve(this.sendInvite(e));let t={sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers,sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions};return this.getOffer(t).then(t=>(this.outgoingRequestMessage.body={body:t.content,contentType:t.contentType},this.stateTransition(R.Establishing),this.sendInvite(e))).catch(e=>{throw this.logger.log(e.message),this.state!==R.Terminated&&this.stateTransition(R.Terminated),e})}sendInvite(e={}){return this.outgoingInviteRequest=this.userAgent.userAgentCore.invite(this.outgoingRequestMessage,{onAccept:t=>{if(this.dialog){this.logger.log(`Additional confirmed dialog, sending ACK and BYE`),this.ackAndBye(t);return}if(this.isCanceled){this.logger.log(`Canceled session accepted, sending ACK and BYE`),this.ackAndBye(t),this.stateTransition(R.Terminated);return}this.notifyReferer(t),this.onAccept(t).then(()=>{this.disposeEarlyMedia()}).catch(()=>{this.disposeEarlyMedia()}).then(()=>{e.requestDelegate&&e.requestDelegate.onAccept&&e.requestDelegate.onAccept(t)})},onProgress:t=>{this.isCanceled||(this.notifyReferer(t),this.onProgress(t).catch(()=>{this.disposeEarlyMedia()}).then(()=>{e.requestDelegate&&e.requestDelegate.onProgress&&e.requestDelegate.onProgress(t)}))},onRedirect:t=>{this.notifyReferer(t),this.onRedirect(t),e.requestDelegate&&e.requestDelegate.onRedirect&&e.requestDelegate.onRedirect(t)},onReject:t=>{this.notifyReferer(t),this.onReject(t),e.requestDelegate&&e.requestDelegate.onReject&&e.requestDelegate.onReject(t)},onTrying:t=>{this.notifyReferer(t),this.onTrying(t),e.requestDelegate&&e.requestDelegate.onTrying&&e.requestDelegate.onTrying(t)}}),this.outgoingInviteRequest}disposeEarlyMedia(){this.earlyMediaSessionDescriptionHandlers.forEach(e=>{e.close()}),this.earlyMediaSessionDescriptionHandlers.clear()}notifyReferer(e){if(!this._referred)return;if(!(this._referred instanceof we))throw Error(`Referred session not instance of session`);if(!this._referred.dialog)return;if(!e.message.statusCode)throw Error(`Status code undefined.`);if(!e.message.reasonPhrase)throw Error(`Reason phrase undefined.`);let t=`SIP/2.0 ${e.message.statusCode} ${e.message.reasonPhrase}`.trim(),n=this._referred.dialog.notify(void 0,{extraHeaders:[`Event: refer`,`Subscription-State: terminated`],body:{contentDisposition:`render`,contentType:`message/sipfrag`,content:t}});n.delegate={onReject:()=>{this._referred=void 0}}}onAccept(e){if(this.logger.log(`Inviter.onAccept`),this.state!==R.Establishing)return this.logger.error(`Accept received while in state ${this.state}, dropping response`),Promise.reject(Error(`Invalid session state ${this.state}`));let t=e.message,n=e.session;switch(t.hasHeader(`P-Asserted-Identity`)&&(this._assertedIdentity=A.nameAddrHeaderParse(t.getHeader(`P-Asserted-Identity`))),n.delegate={onAck:e=>this.onAckRequest(e),onBye:e=>this.onByeRequest(e),onInfo:e=>this.onInfoRequest(e),onInvite:e=>this.onInviteRequest(e),onMessage:e=>this.onMessageRequest(e),onNotify:e=>this.onNotifyRequest(e),onPrack:e=>this.onPrackRequest(e),onRefer:e=>this.onReferRequest(e)},this._dialog=n,n.signalingState){case F.Initial:return this.logger.error(`Received 2xx response to INVITE without a session description`),this.ackAndBye(e,400,`Missing session description`),this.stateTransition(R.Terminated),Promise.reject(Error(`Bad Media Description`));case F.HaveLocalOffer:return this.logger.error(`Received 2xx response to INVITE without a session description`),this.ackAndBye(e,400,`Missing session description`),this.stateTransition(R.Terminated),Promise.reject(Error(`Bad Media Description`));case F.HaveRemoteOffer:{if(!this._dialog.offer)throw Error(`Session offer undefined in signaling state ${this._dialog.signalingState}.`);let t={sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers,sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions};return this.setOfferAndGetAnswer(this._dialog.offer,t).then(t=>{e.ack({body:t}),this.stateTransition(R.Established)}).catch(t=>{throw this.ackAndBye(e,488,`Invalid session description`),this.stateTransition(R.Terminated),t})}case F.Stable:{if(this.earlyMediaSessionDescriptionHandlers.size>0){let t=this.earlyMediaSessionDescriptionHandlers.get(n.id);if(!t)throw Error(`Session description handler undefined.`);return this.setSessionDescriptionHandler(t),this.earlyMediaSessionDescriptionHandlers.delete(n.id),e.ack(),this.stateTransition(R.Established),Promise.resolve()}if(this.earlyMediaDialog){if(this.earlyMediaDialog!==n){this.earlyMedia&&this.logger.error(`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.`);let t=Error(`Early media dialog does not equal confirmed dialog, terminating session`);return this.logger.error(t.message),this.ackAndBye(e,488,`Not Acceptable Here`),this.stateTransition(R.Terminated),Promise.reject(t)}return e.ack(),this.stateTransition(R.Established),Promise.resolve()}let t=n.answer;if(!t)throw Error(`Answer is undefined.`);let r={sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers,sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions};return this.setAnswer(t,r).then(()=>{let t;this._renderbody&&this._rendertype&&(t={body:{contentDisposition:`render`,contentType:this._rendertype,content:this._renderbody}}),e.ack(t),this.stateTransition(R.Established)}).catch(t=>{throw this.logger.error(t.message),this.ackAndBye(e,488,`Not Acceptable Here`),this.stateTransition(R.Terminated),t})}case F.Closed:return Promise.reject(Error(`Terminated.`));default:throw Error(`Unknown session signaling state.`)}}onProgress(e){if(this.logger.log(`Inviter.onProgress`),this.state!==R.Establishing)return this.logger.error(`Progress received while in state ${this.state}, dropping response`),Promise.reject(Error(`Invalid session state ${this.state}`));if(!this.outgoingInviteRequest)throw Error(`Outgoing INVITE request undefined.`);let t=e.message,n=e.session;t.hasHeader(`P-Asserted-Identity`)&&(this._assertedIdentity=A.nameAddrHeaderParse(t.getHeader(`P-Asserted-Identity`)));let r=t.getHeader(`require`),i=t.getHeader(`rseq`),a=!!(r&&r.includes(`100rel`)&&i&&Number(i)),o=[];switch(a&&o.push(`RAck: `+t.getHeader(`rseq`)+` `+t.getHeader(`cseq`)),n.signalingState){case F.Initial:return a&&(this.logger.warn(`First reliable provisional response received MUST contain an offer when INVITE does not contain an offer.`),e.prack({extraHeaders:o})),Promise.resolve();case F.HaveLocalOffer:return a&&e.prack({extraHeaders:o}),Promise.resolve();case F.HaveRemoteOffer:if(!a)return this.logger.warn(`Non-reliable provisional response MUST NOT contain an initial offer, discarding response.`),Promise.resolve();{let r=this.sessionDescriptionHandlerFactory(this,this.userAgent.configuration.sessionDescriptionHandlerFactoryOptions||{});return this.delegate?.onSessionDescriptionHandler&&this.delegate.onSessionDescriptionHandler(r,!0),this.earlyMediaSessionDescriptionHandlers.set(n.id,r),r.setDescription(t.body,this.sessionDescriptionHandlerOptions,this.sessionDescriptionHandlerModifiers).then(()=>r.getDescription(this.sessionDescriptionHandlerOptions,this.sessionDescriptionHandlerModifiers)).then(t=>{let n={contentDisposition:`session`,contentType:t.contentType,content:t.body};e.prack({extraHeaders:o,body:n})}).catch(e=>{throw this.stateTransition(R.Terminated),e})}case F.Stable:if(a&&e.prack({extraHeaders:o}),this.earlyMedia&&!this.earlyMediaDialog){this.earlyMediaDialog=n;let e=n.answer;if(!e)throw Error(`Answer is undefined.`);let t={sessionDescriptionHandlerModifiers:this.sessionDescriptionHandlerModifiers,sessionDescriptionHandlerOptions:this.sessionDescriptionHandlerOptions};return this.setAnswer(e,t).catch(e=>{throw this.stateTransition(R.Terminated),e})}return Promise.resolve();case F.Closed:return Promise.reject(Error(`Terminated.`));default:throw Error(`Unknown session signaling state.`)}}onRedirect(e){if(this.logger.log(`Inviter.onRedirect`),this.state!==R.Establishing&&this.state!==R.Terminating){this.logger.error(`Redirect received while in state ${this.state}, dropping response`);return}this.stateTransition(R.Terminated)}onReject(e){if(this.logger.log(`Inviter.onReject`),this.state!==R.Establishing&&this.state!==R.Terminating){this.logger.error(`Reject received while in state ${this.state}, dropping response`);return}this.stateTransition(R.Terminated)}onTrying(e){if(this.logger.log(`Inviter.onTrying`),this.state!==R.Establishing){this.logger.error(`Trying received while in state ${this.state}, dropping response`);return}}},z;(function(e){e.Initial=`Initial`,e.Registered=`Registered`,e.Unregistered=`Unregistered`,e.Terminated=`Terminated`})(z=z||={});var ke=class e{constructor(t,n={}){this.disposed=!1,this._contacts=[],this._retryAfter=void 0,this._state=z.Initial,this._waiting=!1,this._stateEventEmitter=new T,this._waitingEventEmitter=new T,this.userAgent=t;let r=t.configuration.uri.clone();if(r.user=void 0,this.options=Object.assign(Object.assign(Object.assign({},e.defaultOptions()),{registrar:r}),e.stripUndefinedProperties(n)),this.options.extraContactHeaderParams=(this.options.extraContactHeaderParams||[]).slice(),this.options.extraHeaders=(this.options.extraHeaders||[]).slice(),!this.options.registrar)throw Error(`Registrar undefined.`);if(this.options.registrar=this.options.registrar.clone(),this.options.regId&&!this.options.instanceId?this.options.instanceId=this.userAgent.instanceId:!this.options.regId&&this.options.instanceId&&(this.options.regId=1),this.options.instanceId&&A.parse(this.options.instanceId,`uuid`)===-1)throw Error(`Invalid instanceId.`);if(this.options.regId&&this.options.regId<0)throw Error(`Invalid regId.`);let i=this.options.registrar,a=this.options.params&&this.options.params.fromUri||t.userAgentCore.configuration.aor,o=this.options.params&&this.options.params.toUri||t.configuration.uri,s=this.options.params||{},c=(n.extraHeaders||[]).slice();if(this.request=t.userAgentCore.makeOutgoingRequestMessage(L.REGISTER,i,a,o,s,c,void 0),this.expires=this.options.expires||e.defaultExpires,this.expires<0)throw Error(`Invalid expires.`);if(this.refreshFrequency=this.options.refreshFrequency||e.defaultRefreshFrequency,this.refreshFrequency<50||this.refreshFrequency>99)throw 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(e=>{let t=this.options[e];switch(e){case`registrar`:this.logger.log(`· `+e+`: `+t);break;default:this.logger.log(`· `+e+`: `+JSON.stringify(t))}})),this.id=this.request.callId+this.request.from.parameters.tag,this.userAgent._registerers[this.id]=this}static defaultOptions(){return{expires:e.defaultExpires,extraContactHeaderParams:[],extraHeaders:[],logConfiguration:!0,instanceId:``,params:{},regId:0,registrar:new te(`sip`,`anonymous`,`anonymous.invalid`),refreshFrequency:e.defaultRefreshFrequency}}static stripUndefinedProperties(e){return Object.keys(e).reduce((t,n)=>(e[n]!==void 0&&(t[n]=e[n]),t),{})}get contacts(){return this._contacts.slice()}get retryAfter(){return this._retryAfter}get state(){return this._state}get stateChange(){return this._stateEventEmitter}dispose(){return this.disposed?Promise.resolve():(this.disposed=!0,this.logger.log(`Registerer ${this.id} in state ${this.state} is being disposed`),delete this.userAgent._registerers[this.id],new Promise(e=>{let t=()=>{if(!this.waiting&&this._state===z.Registered){this.stateChange.addListener(()=>{this.terminated(),e()},{once:!0}),this.unregister();return}this.terminated(),e()};this.waiting?this.waitingChange.addListener(()=>{t()},{once:!0}):t()}))}register(e={}){if(this.state===z.Terminated)throw this.stateError(),Error(`Registerer terminated. Unable to register.`);if(this.disposed)throw this.stateError(),Error(`Registerer disposed. Unable to register.`);if(this.waiting){this.waitingWarning();let e=new v(`REGISTER request already in progress, waiting for final response`);return Promise.reject(e)}e.requestOptions&&(this.options=Object.assign(Object.assign({},this.options),e.requestOptions));let t=(this.options.extraHeaders||[]).slice();t.push(`Contact: `+this.generateContactHeader(this.expires)),t.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=t,this.waitingToggle(!0);let n=this.userAgent.userAgentCore.register(this.request,{onAccept:t=>{let n;t.message.hasHeader(`expires`)&&(n=Number(t.message.getHeader(`expires`))),this._contacts=t.message.getHeaders(`contact`);let r=this._contacts.length;if(!r){this.logger.error(`No Contact header in response to REGISTER, dropping response.`),this.unregistered();return}let i;for(;r--;){if(i=t.message.parseHeader(`contact`,r),!i)throw Error(`Contact undefined`);if(this.userAgent.contact.pubGruu&&O(i.uri,this.userAgent.contact.pubGruu)){n=Number(i.getParam(`expires`));break}if(this.userAgent.configuration.contactName===``){if(i.uri.user===this.userAgent.contact.uri.user){n=Number(i.getParam(`expires`));break}}else if(O(i.uri,this.userAgent.contact.uri)){n=Number(i.getParam(`expires`));break}i=void 0}if(i===void 0){this.logger.error(`No Contact header pointing to us, dropping response`),this.unregistered(),this.waitingToggle(!1);return}if(n===void 0){this.logger.error(`Contact pointing to us is missing expires parameter, dropping response`),this.unregistered(),this.waitingToggle(!1);return}if(i.hasParam(`temp-gruu`)){let e=i.getParam(`temp-gruu`);e&&(this.userAgent.contact.tempGruu=A.URIParse(e.replace(/"/g,``)))}if(i.hasParam(`pub-gruu`)){let e=i.getParam(`pub-gruu`);e&&(this.userAgent.contact.pubGruu=A.URIParse(e.replace(/"/g,``)))}this.registered(n),e.requestDelegate&&e.requestDelegate.onAccept&&e.requestDelegate.onAccept(t),this.waitingToggle(!1)},onProgress:t=>{e.requestDelegate&&e.requestDelegate.onProgress&&e.requestDelegate.onProgress(t)},onRedirect:t=>{this.logger.error(`Redirect received. Not supported.`),this.unregistered(),e.requestDelegate&&e.requestDelegate.onRedirect&&e.requestDelegate.onRedirect(t),this.waitingToggle(!1)},onReject:t=>{if(t.message.statusCode===423){if(!t.message.hasHeader(`min-expires`)){this.logger.error(`423 response received for REGISTER without Min-Expires, dropping response`),this.unregistered(),this.waitingToggle(!1);return}this.expires=Number(t.message.getHeader(`min-expires`)),this.waitingToggle(!1),this.register();return}this.logger.warn(`Failed to register, status code ${t.message.statusCode}`);let n=NaN;if(t.message.statusCode===500||t.message.statusCode===503){let e=t.message.getHeader(`retry-after`);e&&(n=Number.parseInt(e,void 0))}this._retryAfter=isNaN(n)?void 0:n,this.unregistered(),e.requestDelegate&&e.requestDelegate.onReject&&e.requestDelegate.onReject(t),this._retryAfter=void 0,this.waitingToggle(!1)},onTrying:t=>{e.requestDelegate&&e.requestDelegate.onTrying&&e.requestDelegate.onTrying(t)}});return Promise.resolve(n)}unregister(e={}){if(this.state===z.Terminated)throw this.stateError(),Error(`Registerer terminated. Unable to register.`);if(this.disposed&&this.state!==z.Registered)throw this.stateError(),Error(`Registerer disposed. Unable to register.`);if(this.waiting){this.waitingWarning();let e=new v(`REGISTER request already in progress, waiting for final response`);return Promise.reject(e)}this._state!==z.Registered&&!e.all&&this.logger.warn(`Not currently registered, but sending an unregister anyway.`);let t=(e.requestOptions&&e.requestOptions.extraHeaders||[]).slice();this.request.extraHeaders=t,e.all?(t.push(`Contact: *`),t.push(`Expires: 0`)):t.push(`Contact: `+this.generateContactHeader(0)),this.request.cseq++,this.request.setHeader(`cseq`,this.request.cseq+` REGISTER`),this.registrationTimer!==void 0&&(clearTimeout(this.registrationTimer),this.registrationTimer=void 0),this.waitingToggle(!0);let n=this.userAgent.userAgentCore.register(this.request,{onAccept:t=>{this._contacts=t.message.getHeaders(`contact`),this.unregistered(),e.requestDelegate&&e.requestDelegate.onAccept&&e.requestDelegate.onAccept(t),this.waitingToggle(!1)},onProgress:t=>{e.requestDelegate&&e.requestDelegate.onProgress&&e.requestDelegate.onProgress(t)},onRedirect:t=>{this.logger.error(`Unregister redirected. Not currently supported.`),this.unregistered(),e.requestDelegate&&e.requestDelegate.onRedirect&&e.requestDelegate.onRedirect(t),this.waitingToggle(!1)},onReject:t=>{this.logger.error(`Unregister rejected with status code ${t.message.statusCode}`),this.unregistered(),e.requestDelegate&&e.requestDelegate.onReject&&e.requestDelegate.onReject(t),this.waitingToggle(!1)},onTrying:t=>{e.requestDelegate&&e.requestDelegate.onTrying&&e.requestDelegate.onTrying(t)}});return Promise.resolve(n)}clearTimers(){this.registrationTimer!==void 0&&(clearTimeout(this.registrationTimer),this.registrationTimer=void 0),this.registrationExpiredTimer!==void 0&&(clearTimeout(this.registrationExpiredTimer),this.registrationExpiredTimer=void 0)}generateContactHeader(e){let t=this.userAgent.contact.toString({register:!0});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(e=>{t+=`;`+e}),t+=`;expires=`+e,t}registered(e){this.clearTimers(),this.registrationTimer=setTimeout(()=>{this.registrationTimer=void 0,this.register()},this.refreshFrequency/100*e*1e3),this.registrationExpiredTimer=setTimeout(()=>{this.logger.warn(`Registration expired`),this.unregistered()},e*1e3),this._state!==z.Registered&&this.stateTransition(z.Registered)}unregistered(){this.clearTimers(),this._state!==z.Unregistered&&this.stateTransition(z.Unregistered)}terminated(){this.clearTimers(),this._state!==z.Terminated&&this.stateTransition(z.Terminated)}stateTransition(e){let t=()=>{throw Error(`Invalid state transition from ${this._state} to ${e}`)};switch(this._state){case z.Initial:e!==z.Registered&&e!==z.Unregistered&&e!==z.Terminated&&t();break;case z.Registered:e!==z.Unregistered&&e!==z.Terminated&&t();break;case z.Unregistered:e!==z.Registered&&e!==z.Terminated&&t();break;case z.Terminated:t();break;default:throw Error(`Unrecognized state.`)}this._state=e,this.logger.log(`Registration transitioned to state ${this._state}`),this._stateEventEmitter.emit(this._state),e===z.Terminated&&this.dispose()}get waiting(){return this._waiting}get waitingChange(){return this._waitingEventEmitter}waitingToggle(e){if(this._waiting===e)throw Error(`Invalid waiting transition from ${this._waiting} to ${e}`);this._waiting=e,this.logger.log(`Waiting toggled to ${this._waiting}`),this._waitingEventEmitter.emit(this._waiting)}waitingWarning(){let 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)}stateError(){let e=`An attempt was made to send a REGISTER request when the Registerer ${this.state===z.Terminated?`is in 'Terminated' state`:`has been disposed`}.`;e+=` The Registerer transitions to 'Terminated' when Registerer.dispose() is called.`,e+=` Perhaps you called UserAgent.stop() which dipsoses of all Registerers?`,this.logger.error(e)}};ke.defaultExpires=600,ke.defaultRefreshFrequency=99;var B;(function(e){e.Initial=`Initial`,e.NotifyWait=`NotifyWait`,e.Pending=`Pending`,e.Active=`Active`,e.Terminated=`Terminated`})(B=B||={});var V;(function(e){e.Connecting=`Connecting`,e.Connected=`Connected`,e.Disconnecting=`Disconnecting`,e.Disconnected=`Disconnected`})(V=V||={});var Ae;(function(e){e.Started=`Started`,e.Stopped=`Stopped`})(Ae=Ae||={});var je=class e{constructor(){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()}static hashStr(e,t=!1){return this.onePassHasher.start().appendStr(e).end(t)}static hashAsciiStr(e,t=!1){return this.onePassHasher.start().appendAsciiStr(e).end(t)}static _hex(t){let n=e.hexChars,r=e.hexOut,i,a,o,s;for(s=0;s<4;s+=1)for(a=s*8,i=t[s],o=0;o<8;o+=2)r[a+1+o]=n.charAt(i&15),i>>>=4,r[a+0+o]=n.charAt(i&15),i>>>=4;return r.join(``)}static _md5cycle(e,t){let n=e[0],r=e[1],i=e[2],a=e[3];n+=(r&i|~r&a)+t[0]-680876936|0,n=(n<<7|n>>>25)+r|0,a+=(n&r|~n&i)+t[1]-389564586|0,a=(a<<12|a>>>20)+n|0,i+=(a&n|~a&r)+t[2]+606105819|0,i=(i<<17|i>>>15)+a|0,r+=(i&a|~i&n)+t[3]-1044525330|0,r=(r<<22|r>>>10)+i|0,n+=(r&i|~r&a)+t[4]-176418897|0,n=(n<<7|n>>>25)+r|0,a+=(n&r|~n&i)+t[5]+1200080426|0,a=(a<<12|a>>>20)+n|0,i+=(a&n|~a&r)+t[6]-1473231341|0,i=(i<<17|i>>>15)+a|0,r+=(i&a|~i&n)+t[7]-45705983|0,r=(r<<22|r>>>10)+i|0,n+=(r&i|~r&a)+t[8]+1770035416|0,n=(n<<7|n>>>25)+r|0,a+=(n&r|~n&i)+t[9]-1958414417|0,a=(a<<12|a>>>20)+n|0,i+=(a&n|~a&r)+t[10]-42063|0,i=(i<<17|i>>>15)+a|0,r+=(i&a|~i&n)+t[11]-1990404162|0,r=(r<<22|r>>>10)+i|0,n+=(r&i|~r&a)+t[12]+1804603682|0,n=(n<<7|n>>>25)+r|0,a+=(n&r|~n&i)+t[13]-40341101|0,a=(a<<12|a>>>20)+n|0,i+=(a&n|~a&r)+t[14]-1502002290|0,i=(i<<17|i>>>15)+a|0,r+=(i&a|~i&n)+t[15]+1236535329|0,r=(r<<22|r>>>10)+i|0,n+=(r&a|i&~a)+t[1]-165796510|0,n=(n<<5|n>>>27)+r|0,a+=(n&i|r&~i)+t[6]-1069501632|0,a=(a<<9|a>>>23)+n|0,i+=(a&r|n&~r)+t[11]+643717713|0,i=(i<<14|i>>>18)+a|0,r+=(i&n|a&~n)+t[0]-373897302|0,r=(r<<20|r>>>12)+i|0,n+=(r&a|i&~a)+t[5]-701558691|0,n=(n<<5|n>>>27)+r|0,a+=(n&i|r&~i)+t[10]+38016083|0,a=(a<<9|a>>>23)+n|0,i+=(a&r|n&~r)+t[15]-660478335|0,i=(i<<14|i>>>18)+a|0,r+=(i&n|a&~n)+t[4]-405537848|0,r=(r<<20|r>>>12)+i|0,n+=(r&a|i&~a)+t[9]+568446438|0,n=(n<<5|n>>>27)+r|0,a+=(n&i|r&~i)+t[14]-1019803690|0,a=(a<<9|a>>>23)+n|0,i+=(a&r|n&~r)+t[3]-187363961|0,i=(i<<14|i>>>18)+a|0,r+=(i&n|a&~n)+t[8]+1163531501|0,r=(r<<20|r>>>12)+i|0,n+=(r&a|i&~a)+t[13]-1444681467|0,n=(n<<5|n>>>27)+r|0,a+=(n&i|r&~i)+t[2]-51403784|0,a=(a<<9|a>>>23)+n|0,i+=(a&r|n&~r)+t[7]+1735328473|0,i=(i<<14|i>>>18)+a|0,r+=(i&n|a&~n)+t[12]-1926607734|0,r=(r<<20|r>>>12)+i|0,n+=(r^i^a)+t[5]-378558|0,n=(n<<4|n>>>28)+r|0,a+=(n^r^i)+t[8]-2022574463|0,a=(a<<11|a>>>21)+n|0,i+=(a^n^r)+t[11]+1839030562|0,i=(i<<16|i>>>16)+a|0,r+=(i^a^n)+t[14]-35309556|0,r=(r<<23|r>>>9)+i|0,n+=(r^i^a)+t[1]-1530992060|0,n=(n<<4|n>>>28)+r|0,a+=(n^r^i)+t[4]+1272893353|0,a=(a<<11|a>>>21)+n|0,i+=(a^n^r)+t[7]-155497632|0,i=(i<<16|i>>>16)+a|0,r+=(i^a^n)+t[10]-1094730640|0,r=(r<<23|r>>>9)+i|0,n+=(r^i^a)+t[13]+681279174|0,n=(n<<4|n>>>28)+r|0,a+=(n^r^i)+t[0]-358537222|0,a=(a<<11|a>>>21)+n|0,i+=(a^n^r)+t[3]-722521979|0,i=(i<<16|i>>>16)+a|0,r+=(i^a^n)+t[6]+76029189|0,r=(r<<23|r>>>9)+i|0,n+=(r^i^a)+t[9]-640364487|0,n=(n<<4|n>>>28)+r|0,a+=(n^r^i)+t[12]-421815835|0,a=(a<<11|a>>>21)+n|0,i+=(a^n^r)+t[15]+530742520|0,i=(i<<16|i>>>16)+a|0,r+=(i^a^n)+t[2]-995338651|0,r=(r<<23|r>>>9)+i|0,n+=(i^(r|~a))+t[0]-198630844|0,n=(n<<6|n>>>26)+r|0,a+=(r^(n|~i))+t[7]+1126891415|0,a=(a<<10|a>>>22)+n|0,i+=(n^(a|~r))+t[14]-1416354905|0,i=(i<<15|i>>>17)+a|0,r+=(a^(i|~n))+t[5]-57434055|0,r=(r<<21|r>>>11)+i|0,n+=(i^(r|~a))+t[12]+1700485571|0,n=(n<<6|n>>>26)+r|0,a+=(r^(n|~i))+t[3]-1894986606|0,a=(a<<10|a>>>22)+n|0,i+=(n^(a|~r))+t[10]-1051523|0,i=(i<<15|i>>>17)+a|0,r+=(a^(i|~n))+t[1]-2054922799|0,r=(r<<21|r>>>11)+i|0,n+=(i^(r|~a))+t[8]+1873313359|0,n=(n<<6|n>>>26)+r|0,a+=(r^(n|~i))+t[15]-30611744|0,a=(a<<10|a>>>22)+n|0,i+=(n^(a|~r))+t[6]-1560198380|0,i=(i<<15|i>>>17)+a|0,r+=(a^(i|~n))+t[13]+1309151649|0,r=(r<<21|r>>>11)+i|0,n+=(i^(r|~a))+t[4]-145523070|0,n=(n<<6|n>>>26)+r|0,a+=(r^(n|~i))+t[11]-1120210379|0,a=(a<<10|a>>>22)+n|0,i+=(n^(a|~r))+t[2]+718787259|0,i=(i<<15|i>>>17)+a|0,r+=(a^(i|~n))+t[9]-343485551|0,r=(r<<21|r>>>11)+i|0,e[0]=n+e[0]|0,e[1]=r+e[1]|0,e[2]=i+e[2]|0,e[3]=a+e[3]|0}start(){return this._dataLength=0,this._bufferLength=0,this._state.set(e.stateIdentity),this}appendStr(t){let n=this._buffer8,r=this._buffer32,i=this._bufferLength,a,o;for(o=0;o<t.length;o+=1){if(a=t.charCodeAt(o),a<128)n[i++]=a;else if(a<2048)n[i++]=(a>>>6)+192,n[i++]=a&63|128;else if(a<55296||a>56319)n[i++]=(a>>>12)+224,n[i++]=a>>>6&63|128,n[i++]=a&63|128;else{if(a=(a-55296)*1024+(t.charCodeAt(++o)-56320)+65536,a>1114111)throw Error(`Unicode standard supports code points up to U+10FFFF`);n[i++]=(a>>>18)+240,n[i++]=a>>>12&63|128,n[i++]=a>>>6&63|128,n[i++]=a&63|128}i>=64&&(this._dataLength+=64,e._md5cycle(this._state,r),i-=64,r[0]=r[16])}return this._bufferLength=i,this}appendAsciiStr(t){let n=this._buffer8,r=this._buffer32,i=this._bufferLength,a,o=0;for(;;){for(a=Math.min(t.length-o,64-i);a--;)n[i++]=t.charCodeAt(o++);if(i<64)break;this._dataLength+=64,e._md5cycle(this._state,r),i=0}return this._bufferLength=i,this}appendByteArray(t){let n=this._buffer8,r=this._buffer32,i=this._bufferLength,a,o=0;for(;;){for(a=Math.min(t.length-o,64-i);a--;)n[i++]=t[o++];if(i<64)break;this._dataLength+=64,e._md5cycle(this._state,r),i=0}return this._bufferLength=i,this}getState(){let 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]]}}setState(e){let t=e.buffer,n=e.state,r=this._state,i;for(this._dataLength=e.length,this._bufferLength=e.buflen,r[0]=n[0],r[1]=n[1],r[2]=n[2],r[3]=n[3],i=0;i<t.length;i+=1)this._buffer8[i]=t.charCodeAt(i)}end(t=!1){let n=this._bufferLength,r=this._buffer8,i=this._buffer32,a=(n>>2)+1,o;if(this._dataLength+=n,r[n]=128,r[n+1]=r[n+2]=r[n+3]=0,i.set(e.buffer32Identity.subarray(a),a),n>55&&(e._md5cycle(this._state,i),i.set(e.buffer32Identity)),o=this._dataLength*8,o<=4294967295)i[14]=o;else{let e=o.toString(16).match(/(.*?)(.{0,8})$/);if(e===null)return;let t=parseInt(e[2],16),n=parseInt(e[1],16)||0;i[14]=t,i[15]=n}return e._md5cycle(this._state,i),t?this._state:e._hex(this._state)}};je.stateIdentity=new Int32Array([1732584193,-271733879,-1732584194,271733878]),je.buffer32Identity=new Int32Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),je.hexChars=`0123456789abcdef`,je.hexOut=[],je.onePassHasher=new je,je.hashStr(`hello`)!==`5d41402abc4b2a76b9719d911017c592`&&console.error(`Md5 self test failed.`);function Me(e){return je.hashStr(e)}var Ne=class{constructor(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`}authenticate(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(this.algorithm!==`MD5`)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)this.qop=`auth-int`;else return this.logger.warn(`challenge without Digest qop different than 'auth' or 'auth-int', authentication aborted`),!1;else this.qop=void 0;return this.method=e.method,this.uri=e.ruri,this.cnonce=ae(12),this.nc+=1,this.updateNcHex(),this.nc===4294967296&&(this.nc=1,this.ncHex=`00000001`),this.calculateResponse(n),!0}toString(){let e=[];if(!this.response)throw 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(`, `)}updateNcHex(){let e=Number(this.nc).toString(16);this.ncHex=`00000000`.substr(0,8-e.length)+e}calculateResponse(e){let t,n;t=this.ha1,(t===``||t===void 0)&&(t=Me(this.username+`:`+this.realm+`:`+this.password)),this.qop===`auth`?(n=Me(this.method+`:`+this.uri),this.response=Me(t+`:`+this.nonce+`:`+this.ncHex+`:`+this.cnonce+`:auth:`+n)):this.qop===`auth-int`?(n=Me(this.method+`:`+this.uri+`:`+Me(e||``)),this.response=Me(t+`:`+this.nonce+`:`+this.ncHex+`:`+this.cnonce+`:auth-int:`+n)):this.qop===void 0&&(n=Me(this.method+`:`+this.uri),this.response=Me(t+`:`+this.nonce+`:`+n))}},Pe;(function(e){e[e.error=0]=`error`,e[e.warn=1]=`warn`,e[e.log=2]=`log`,e[e.debug=3]=`debug`})(Pe=Pe||={});var Fe=class{constructor(e,t,n){this.logger=e,this.category=t,this.label=n}error(e){this.genericLog(Pe.error,e)}warn(e){this.genericLog(Pe.warn,e)}log(e){this.genericLog(Pe.log,e)}debug(e){this.genericLog(Pe.debug,e)}genericLog(e,t){this.logger.genericLog(e,this.category,this.label,t)}get level(){return this.logger.level}set level(e){this.logger.level=e}},Ie=class{constructor(){this.builtinEnabled=!0,this._level=Pe.log,this.loggers={},this.logger=this.getLogger(`sip:loggerfactory`)}get level(){return this._level}set level(e){e>=0&&e<=3?this._level=e:e>3?this._level=3:Pe.hasOwnProperty(e)?this._level=e:this.logger.error(`invalid 'level' parameter value: `+JSON.stringify(e))}get connector(){return this._connector}set connector(e){e?typeof e==`function`?this._connector=e:this.logger.error(`invalid 'connector' parameter value: `+JSON.stringify(e)):this._connector=void 0}getLogger(e,t){if(t&&this.level===3)return new Fe(this,e,t);if(this.loggers[e])return this.loggers[e];{let t=new Fe(this,e);return this.loggers[e]=t,t}}genericLog(e,t,n,r){this.level>=e&&this.builtinEnabled&&this.print(e,t,n,r),this.connector&&this.connector(Pe[e],t,n,r)}print(e,t,n,r){if(typeof r==`string`){let e=[new Date,t];n&&e.push(n),r=e.concat(r).join(` | `)}switch(e){case Pe.error:console.error(r);break;case Pe.warn:console.warn(r);break;case Pe.log:console.log(r);break;case Pe.debug:console.debug(r);break;default:break}}},Le;(function(e){function t(e,t){let n=t,r=0,i=0;if(e.substring(n,n+2).match(/(^\r\n)/))return-2;for(;r===0;){if(i=e.indexOf(`\r
24
+ `,n),i===-1)return i;!e.substring(i+2,i+4).match(/(^\r\n)/)&&e.charAt(i+2).match(/(^\s+)/)?n=i+2:r=i}return r}e.getHeader=t;function n(e,t,n,r){let i=t.indexOf(`:`,n),a=t.substring(n,i).trim(),o=t.substring(i+1,r).trim(),s;switch(a.toLowerCase()){case`via`:case`v`:e.addHeader(`via`,o),e.getHeaders(`via`).length===1?(s=e.parseHeader(`Via`),s&&(e.via=s,e.viaBranch=s.branch)):s=0;break;case`from`:case`f`:e.setHeader(`from`,o),s=e.parseHeader(`from`),s&&(e.from=s,e.fromTag=s.getParam(`tag`));break;case`to`:case`t`:e.setHeader(`to`,o),s=e.parseHeader(`to`),s&&(e.to=s,e.toTag=s.getParam(`tag`));break;case`record-route`:if(s=A.parse(o,`Record_Route`),s===-1){s=void 0;break}if(!(s instanceof Array)){s=void 0;break}s.forEach(t=>{e.addHeader(`record-route`,o.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`,o),s=e.parseHeader(`call-id`),s&&(e.callId=o);break;case`contact`:case`m`:if(s=A.parse(o,`Contact`),s===-1){s=void 0;break}if(!(s instanceof Array)){s=void 0;break}s.forEach(t=>{e.addHeader(`contact`,o.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`,o),s=e.parseHeader(`content-length`);break;case`content-type`:case`c`:e.setHeader(`content-type`,o),s=e.parseHeader(`content-type`);break;case`cseq`:e.setHeader(`cseq`,o),s=e.parseHeader(`cseq`),s&&(e.cseq=s.value),e instanceof ue&&(e.method=s.method);break;case`max-forwards`:e.setHeader(`max-forwards`,o),s=e.parseHeader(`max-forwards`);break;case`www-authenticate`:e.setHeader(`www-authenticate`,o),s=e.parseHeader(`www-authenticate`);break;case`proxy-authenticate`:e.setHeader(`proxy-authenticate`,o),s=e.parseHeader(`proxy-authenticate`);break;case`refer-to`:case`r`:e.setHeader(`refer-to`,o),s=e.parseHeader(`refer-to`),s&&(e.referTo=s);break;default:e.addHeader(a.toLowerCase(),o),s=0}return s===void 0?{error:`error parsing header '`+a+`'`}:!0}e.parseHeader=n;function r(e,r){let i=0,a=e.indexOf(`\r
25
+ `);if(a===-1){r.warn(`no CRLF found, not a SIP message, discarded`);return}let o=e.substring(0,a),s=A.parse(o,`Request_Response`),c;if(s===-1){r.warn(`error parsing first line of SIP message: "`+o+`"`);return}else s.status_code?(c=new ue,c.statusCode=s.status_code,c.reasonPhrase=s.reason_phrase):(c=new le,c.method=s.method,c.ruri=s.uri);c.data=e,i=a+2;let l;for(;;){if(a=t(e,i),a===-2){l=i+2;break}else if(a===-1){r.error(`malformed message`);return}let o=n(c,e,i,a);if(o&&o!==!0){r.error(o.error);return}i=a+2}return c.hasHeader(`content-length`)?c.body=e.substr(l,Number(c.getHeader(`content-length`))):c.body=e.substring(l),c}e.parseMessage=r})(Le=Le||={});function Re(e,t){if(t.statusCode<100||t.statusCode>699)throw TypeError(`Invalid statusCode: `+t.statusCode);let n=t.reasonPhrase?t.reasonPhrase:oe(t.statusCode),r=`SIP/2.0 `+t.statusCode+` `+n+`\r
26
26
  `;t.statusCode>=100&&t.statusCode,t.statusCode;let i=`From: `+e.getHeader(`From`)+`\r
27
27
  `,a=`Call-ID: `+e.callId+`\r
28
28
  `,o=`CSeq: `+e.cseq+` `+e.method+`\r
@@ -36,31 +36,31 @@
36
36
  \r
37
37
  `,r+=t.body.content):r+=`Content-Length: 0\r
38
38
  \r
39
- `,{message:r}}var ze=class extends g{constructor(e){super(e||`Unspecified transport error.`)}},Be=class{constructor(e,t,n,r,i){this._transport=e,this._user=t,this._id=n,this._state=r,this.listeners=[],this.logger=t.loggerFactory.getLogger(i,n),this.logger.debug(`Constructing ${this.typeToString()} with id ${this.id}.`)}dispose(){this.logger.debug(`Destroyed ${this.typeToString()} with id ${this.id}.`)}get id(){return this._id}get kind(){throw Error(`Invalid kind.`)}get state(){return this._state}get transport(){return this._transport}addStateChangeListener(e,t){let n=()=>{this.removeStateChangeListener(n),e()};t?.once===!0?this.listeners.push(n):this.listeners.push(e)}notifyStateChangeListeners(){this.listeners.slice().forEach(e=>e())}removeStateChangeListener(e){this.listeners=this.listeners.filter(t=>t!==e)}logTransportError(e,t){this.logger.error(e.message),this.logger.error(`Transport error occurred in ${this.typeToString()} with id ${this.id}.`),this.logger.error(t)}send(e){return this.transport.send(e).catch(e=>{if(e instanceof ze)throw this.onTransportError(e),e;let t;throw t=e&&typeof e.message==`string`?new ze(e.message):new ze,this.onTransportError(t),t})}setState(e){this.logger.debug(`State change to "${e}" on ${this.typeToString()} with id ${this.id}.`),this._state=e,this._user.onStateChange&&this._user.onStateChange(e),this.notifyStateChangeListeners()}typeToString(){return`UnknownType`}},Ve=class extends Be{constructor(e,t,n,r,i){super(t,n,e.viaBranch,r,i),this._request=e,this.user=n}get request(){return this._request}},H;(function(e){e.Accepted=`Accepted`,e.Calling=`Calling`,e.Completed=`Completed`,e.Confirmed=`Confirmed`,e.Proceeding=`Proceeding`,e.Terminated=`Terminated`,e.Trying=`Trying`})(H=H||={});var He=class extends Ve{constructor(e,t,n){super(e,t,n,H.Proceeding,`sip.transaction.ist`)}dispose(){this.stopProgressExtensionTimer(),this.H&&=(clearTimeout(this.H),void 0),this.I&&=(clearTimeout(this.I),void 0),this.L&&=(clearTimeout(this.L),void 0),super.dispose()}get kind(){return`ist`}receiveRequest(e){switch(this.state){case H.Proceeding:if(e.method===I.INVITE){this.lastProvisionalResponse&&this.send(this.lastProvisionalResponse).catch(e=>{this.logTransportError(e,`Failed to send retransmission of provisional response.`)});return}break;case H.Accepted:if(e.method===I.INVITE)return;break;case H.Completed:if(e.method===I.INVITE){if(!this.lastFinalResponse)throw Error(`Last final response undefined.`);this.send(this.lastFinalResponse).catch(e=>{this.logTransportError(e,`Failed to send retransmission of final response.`)});return}if(e.method===I.ACK){this.stateTransition(H.Confirmed);return}break;case H.Confirmed:if(e.method===I.INVITE||e.method===I.ACK)return;break;case H.Terminated:if(e.method===I.INVITE||e.method===I.ACK)return;break;default:throw Error(`Invalid state ${this.state}`)}let t=`INVITE server transaction received unexpected ${e.method} request while in state ${this.state}.`;this.logger.warn(t)}receiveResponse(e,t){if(e<100||e>699)throw Error(`Invalid status code ${e}`);switch(this.state){case H.Proceeding:if(e>=100&&e<=199){this.lastProvisionalResponse=t,e>100&&this.startProgressExtensionTimer(),this.send(t).catch(e=>{this.logTransportError(e,`Failed to send 1xx response.`)});return}if(e>=200&&e<=299){this.lastFinalResponse=t,this.stateTransition(H.Accepted),this.send(t).catch(e=>{this.logTransportError(e,`Failed to send 2xx response.`)});return}if(e>=300&&e<=699){this.lastFinalResponse=t,this.stateTransition(H.Completed),this.send(t).catch(e=>{this.logTransportError(e,`Failed to send non-2xx final response.`)});return}break;case H.Accepted:if(e>=200&&e<=299){this.send(t).catch(e=>{this.logTransportError(e,`Failed to send 2xx response.`)});return}break;case H.Completed:break;case H.Confirmed:break;case H.Terminated:break;default:throw Error(`Invalid state ${this.state}`)}let n=`INVITE server transaction received unexpected ${e} response from TU while in state ${this.state}.`;throw this.logger.error(n),Error(n)}retransmitAcceptedResponse(){this.state===H.Accepted&&this.lastFinalResponse&&this.send(this.lastFinalResponse).catch(e=>{this.logTransportError(e,`Failed to send 2xx response.`)})}onTransportError(e){this.user.onTransportError&&this.user.onTransportError(e)}typeToString(){return`INVITE server transaction`}stateTransition(e){let t=()=>{throw Error(`Invalid state transition from ${this.state} to ${e}`)};switch(e){case H.Proceeding:t();break;case H.Accepted:case H.Completed:this.state!==H.Proceeding&&t();break;case H.Confirmed:this.state!==H.Completed&&t();break;case H.Terminated:this.state!==H.Accepted&&this.state!==H.Completed&&this.state!==H.Confirmed&&t();break;default:t()}this.stopProgressExtensionTimer(),e===H.Accepted&&(this.L=setTimeout(()=>this.timerL(),F.TIMER_L)),e===H.Completed&&(this.H=setTimeout(()=>this.timerH(),F.TIMER_H)),e===H.Confirmed&&(this.I=setTimeout(()=>this.timerI(),F.TIMER_I)),e===H.Terminated&&this.dispose(),this.setState(e)}startProgressExtensionTimer(){this.progressExtensionTimer===void 0&&(this.progressExtensionTimer=setInterval(()=>{if(this.logger.debug(`Progress extension timer expired for INVITE server transaction ${this.id}.`),!this.lastProvisionalResponse)throw Error(`Last provisional response undefined.`);this.send(this.lastProvisionalResponse).catch(e=>{this.logTransportError(e,`Failed to send retransmission of provisional response.`)})},F.PROVISIONAL_RESPONSE_INTERVAL))}stopProgressExtensionTimer(){this.progressExtensionTimer!==void 0&&(clearInterval(this.progressExtensionTimer),this.progressExtensionTimer=void 0)}timerG(){}timerH(){this.logger.debug(`Timer H expired for INVITE server transaction ${this.id}.`),this.state===H.Completed&&(this.logger.warn(`ACK to negative final response was never received, terminating transaction.`),this.stateTransition(H.Terminated))}timerI(){this.logger.debug(`Timer I expired for INVITE server transaction ${this.id}.`),this.stateTransition(H.Terminated)}timerL(){this.logger.debug(`Timer L expired for INVITE server transaction ${this.id}.`),this.state===H.Accepted&&this.stateTransition(H.Terminated)}},Ue=class e extends Be{constructor(t,n,r,i,a){super(n,r,e.makeId(t),i,a),this._request=t,this.user=r,t.setViaHeader(this.id,n.protocol)}static makeId(e){if(e.method===`CANCEL`){if(!e.branch)throw Error(`Outgoing CANCEL request without a branch.`);return e.branch}else return`z9hG4bK`+Math.floor(Math.random()*1e7)}get request(){return this._request}onRequestTimeout(){this.user.onRequestTimeout&&this.user.onRequestTimeout()}},We=class extends Ue{constructor(e,t,n){super(e,t,n,H.Trying,`sip.transaction.nict`),this.F=setTimeout(()=>this.timerF(),F.TIMER_F),this.send(e.toString()).catch(e=>{this.logTransportError(e,`Failed to send initial outgoing request.`)})}dispose(){this.F&&=(clearTimeout(this.F),void 0),this.K&&=(clearTimeout(this.K),void 0),super.dispose()}get kind(){return`nict`}receiveResponse(e){let t=e.statusCode;if(!t||t<100||t>699)throw Error(`Invalid status code ${t}`);switch(this.state){case H.Trying:if(t>=100&&t<=199){this.stateTransition(H.Proceeding),this.user.receiveResponse&&this.user.receiveResponse(e);return}if(t>=200&&t<=699){if(this.stateTransition(H.Completed),t===408){this.onRequestTimeout();return}this.user.receiveResponse&&this.user.receiveResponse(e);return}break;case H.Proceeding:if(t>=100&&t<=199&&this.user.receiveResponse)return this.user.receiveResponse(e);if(t>=200&&t<=699){if(this.stateTransition(H.Completed),t===408){this.onRequestTimeout();return}this.user.receiveResponse&&this.user.receiveResponse(e);return}break;case H.Completed:return;case H.Terminated:return;default:throw Error(`Invalid state ${this.state}`)}let n=`Non-INVITE client transaction received unexpected ${t} response while in state ${this.state}.`;this.logger.warn(n)}onTransportError(e){this.user.onTransportError&&this.user.onTransportError(e),this.stateTransition(H.Terminated,!0)}typeToString(){return`non-INVITE client transaction`}stateTransition(e,t=!1){let n=()=>{throw Error(`Invalid state transition from ${this.state} to ${e}`)};switch(e){case H.Trying:n();break;case H.Proceeding:this.state!==H.Trying&&n();break;case H.Completed:this.state!==H.Trying&&this.state!==H.Proceeding&&n();break;case H.Terminated:this.state!==H.Trying&&this.state!==H.Proceeding&&this.state!==H.Completed&&(t||n());break;default:n()}e===H.Completed&&(this.F&&=(clearTimeout(this.F),void 0),this.K=setTimeout(()=>this.timerK(),F.TIMER_K)),e===H.Terminated&&this.dispose(),this.setState(e)}timerF(){this.logger.debug(`Timer F expired for non-INVITE client transaction ${this.id}.`),(this.state===H.Trying||this.state===H.Proceeding)&&(this.onRequestTimeout(),this.stateTransition(H.Terminated))}timerK(){this.state===H.Completed&&this.stateTransition(H.Terminated)}},Ge=class{constructor(e,t){this.core=e,this.dialogState=t,this.core.dialogs.set(this.id,this)}static initialDialogStateForUserAgentClient(e,t){let n=t.getHeaders(`record-route`).reverse(),r=t.parseHeader(`contact`);if(!r)throw Error(`Contact undefined.`);if(!(r instanceof D))throw Error(`Contact not instance of NameAddrHeader.`);let i=r.uri,a=e.cseq,o=e.callId,s=e.fromTag,c=t.toTag;if(!o)throw Error(`Call id undefined.`);if(!s)throw Error(`From tag undefined.`);if(!c)throw Error(`To tag undefined.`);if(!e.from)throw Error(`From undefined.`);if(!e.to)throw Error(`To undefined.`);let l=e.from.uri,u=e.to.uri;if(!t.statusCode)throw Error(`Incoming response status code undefined.`);let d=t.statusCode<200;return{id:o+s+c,early:d,callId:o,localTag:s,remoteTag:c,localSequenceNumber:a,remoteSequenceNumber:void 0,localURI:l,remoteURI:u,remoteTarget:i,routeSet:n,secure:!1}}static initialDialogStateForUserAgentServer(e,t,n=!1){let r=e.getHeaders(`record-route`),i=e.parseHeader(`contact`);if(!i)throw Error(`Contact undefined.`);if(!(i instanceof D))throw Error(`Contact not instance of NameAddrHeader.`);let a=i.uri,o=e.cseq,s=e.callId,c=t,l=e.fromTag,u=e.from.uri,d=e.to.uri;return{id:s+c+l,early:n,callId:s,localTag:c,remoteTag:l,localSequenceNumber:void 0,remoteSequenceNumber:o,localURI:d,remoteURI:u,remoteTarget:a,routeSet:r,secure:!1}}dispose(){this.core.dialogs.delete(this.id)}get id(){return this.dialogState.id}get early(){return this.dialogState.early}get callId(){return this.dialogState.callId}get localTag(){return this.dialogState.localTag}get remoteTag(){return this.dialogState.remoteTag}get localSequenceNumber(){return this.dialogState.localSequenceNumber}get remoteSequenceNumber(){return this.dialogState.remoteSequenceNumber}get localURI(){return this.dialogState.localURI}get remoteURI(){return this.dialogState.remoteURI}get remoteTarget(){return this.dialogState.remoteTarget}get routeSet(){return this.dialogState.routeSet}get secure(){return this.dialogState.secure}get userAgentCore(){return this.core}confirm(){this.dialogState.early=!1}receiveRequest(e){if(e.method!==I.ACK){if(this.remoteSequenceNumber){if(e.cseq<=this.remoteSequenceNumber)throw 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)}}recomputeRouteSet(e){this.dialogState.routeSet=e.getHeaders(`record-route`).reverse()}createOutgoingRequestMessage(e,t){let n=this.remoteURI,r=this.remoteTag,i=this.localURI,a=this.localTag,o=this.callId,s;s=t&&t.cseq?t.cseq:this.dialogState.localSequenceNumber?this.dialogState.localSequenceNumber+=1:this.dialogState.localSequenceNumber=1;let c=this.remoteTarget,l=this.routeSet,u=t&&t.extraHeaders,d=t&&t.body;return this.userAgentCore.makeOutgoingRequestMessage(e,c,i,n,{callId:o,cseq:s,fromTag:a,toTag:r,routeSet:l},u,d)}incrementLocalSequenceNumber(){if(!this.dialogState.localSequenceNumber)throw Error(`Local sequence number undefined.`);this.dialogState.localSequenceNumber+=1}sequenceGuard(e){return e.method===I.ACK?!0:this.remoteSequenceNumber&&e.cseq<=this.remoteSequenceNumber?(this.core.replyStateless(e,{statusCode:500}),!1):!0}},Ke=class extends Ue{constructor(e,t,n){super(e,t,n,H.Calling,`sip.transaction.ict`),this.ackRetransmissionCache=new Map,this.B=setTimeout(()=>this.timerB(),F.TIMER_B),this.send(e.toString()).catch(e=>{this.logTransportError(e,`Failed to send initial outgoing request.`)})}dispose(){this.B&&=(clearTimeout(this.B),void 0),this.D&&=(clearTimeout(this.D),void 0),this.M&&=(clearTimeout(this.M),void 0),super.dispose()}get kind(){return`ict`}ackResponse(e){let t=e.toTag;if(!t)throw Error(`To tag undefined.`);let n=`z9hG4bK`+Math.floor(Math.random()*1e7);e.setViaHeader(n,this.transport.protocol),this.ackRetransmissionCache.set(t,e),this.send(e.toString()).catch(e=>{this.logTransportError(e,`Failed to send ACK to 2xx response.`)})}receiveResponse(e){let t=e.statusCode;if(!t||t<100||t>699)throw Error(`Invalid status code ${t}`);switch(this.state){case H.Calling:if(t>=100&&t<=199){this.stateTransition(H.Proceeding),this.user.receiveResponse&&this.user.receiveResponse(e);return}if(t>=200&&t<=299){this.ackRetransmissionCache.set(e.toTag,void 0),this.stateTransition(H.Accepted),this.user.receiveResponse&&this.user.receiveResponse(e);return}if(t>=300&&t<=699){this.stateTransition(H.Completed),this.ack(e),this.user.receiveResponse&&this.user.receiveResponse(e);return}break;case H.Proceeding:if(t>=100&&t<=199){this.user.receiveResponse&&this.user.receiveResponse(e);return}if(t>=200&&t<=299){this.ackRetransmissionCache.set(e.toTag,void 0),this.stateTransition(H.Accepted),this.user.receiveResponse&&this.user.receiveResponse(e);return}if(t>=300&&t<=699){this.stateTransition(H.Completed),this.ack(e),this.user.receiveResponse&&this.user.receiveResponse(e);return}break;case H.Accepted:if(t>=200&&t<=299){if(!this.ackRetransmissionCache.has(e.toTag)){this.ackRetransmissionCache.set(e.toTag,void 0),this.user.receiveResponse&&this.user.receiveResponse(e);return}let t=this.ackRetransmissionCache.get(e.toTag);if(t){this.send(t.toString()).catch(e=>{this.logTransportError(e,`Failed to send retransmission of ACK to 2xx response.`)});return}return}break;case H.Completed:if(t>=300&&t<=699){this.ack(e);return}break;case H.Terminated:break;default:throw Error(`Invalid state ${this.state}`)}let n=`Received unexpected ${t} response while in state ${this.state}.`;this.logger.warn(n)}onTransportError(e){this.user.onTransportError&&this.user.onTransportError(e),this.stateTransition(H.Terminated,!0)}typeToString(){return`INVITE client transaction`}ack(e){let t=this.request.ruri,n=this.request.callId,r=this.request.cseq,i=this.request.getHeader(`from`),a=e.getHeader(`to`),o=this.request.getHeader(`via`),s=this.request.getHeader(`route`);if(!i)throw Error(`From undefined.`);if(!a)throw Error(`To undefined.`);if(!o)throw Error(`Via undefined.`);let c=`ACK ${t} SIP/2.0\r\n`;s&&(c+=`Route: ${s}\r\n`),c+=`Via: ${o}\r\n`,c+=`To: ${a}\r\n`,c+=`From: ${i}\r\n`,c+=`Call-ID: ${n}\r\n`,c+=`CSeq: ${r} ACK\r\n`,c+=`Max-Forwards: 70\r
39
+ `,{message:r}}var ze=class extends g{constructor(e){super(e||`Unspecified transport error.`)}},Be=class{constructor(e,t,n,r,i){this._transport=e,this._user=t,this._id=n,this._state=r,this.listeners=[],this.logger=t.loggerFactory.getLogger(i,n),this.logger.debug(`Constructing ${this.typeToString()} with id ${this.id}.`)}dispose(){this.logger.debug(`Destroyed ${this.typeToString()} with id ${this.id}.`)}get id(){return this._id}get kind(){throw Error(`Invalid kind.`)}get state(){return this._state}get transport(){return this._transport}addStateChangeListener(e,t){let n=()=>{this.removeStateChangeListener(n),e()};t?.once===!0?this.listeners.push(n):this.listeners.push(e)}notifyStateChangeListeners(){this.listeners.slice().forEach(e=>e())}removeStateChangeListener(e){this.listeners=this.listeners.filter(t=>t!==e)}logTransportError(e,t){this.logger.error(e.message),this.logger.error(`Transport error occurred in ${this.typeToString()} with id ${this.id}.`),this.logger.error(t)}send(e){return this.transport.send(e).catch(e=>{if(e instanceof ze)throw this.onTransportError(e),e;let t;throw t=e&&typeof e.message==`string`?new ze(e.message):new ze,this.onTransportError(t),t})}setState(e){this.logger.debug(`State change to "${e}" on ${this.typeToString()} with id ${this.id}.`),this._state=e,this._user.onStateChange&&this._user.onStateChange(e),this.notifyStateChangeListeners()}typeToString(){return`UnknownType`}},Ve=class extends Be{constructor(e,t,n,r,i){super(t,n,e.viaBranch,r,i),this._request=e,this.user=n}get request(){return this._request}},H;(function(e){e.Accepted=`Accepted`,e.Calling=`Calling`,e.Completed=`Completed`,e.Confirmed=`Confirmed`,e.Proceeding=`Proceeding`,e.Terminated=`Terminated`,e.Trying=`Trying`})(H=H||={});var He=class extends Ve{constructor(e,t,n){super(e,t,n,H.Proceeding,`sip.transaction.ist`)}dispose(){this.stopProgressExtensionTimer(),this.H&&=(clearTimeout(this.H),void 0),this.I&&=(clearTimeout(this.I),void 0),this.L&&=(clearTimeout(this.L),void 0),super.dispose()}get kind(){return`ist`}receiveRequest(e){switch(this.state){case H.Proceeding:if(e.method===L.INVITE){this.lastProvisionalResponse&&this.send(this.lastProvisionalResponse).catch(e=>{this.logTransportError(e,`Failed to send retransmission of provisional response.`)});return}break;case H.Accepted:if(e.method===L.INVITE)return;break;case H.Completed:if(e.method===L.INVITE){if(!this.lastFinalResponse)throw Error(`Last final response undefined.`);this.send(this.lastFinalResponse).catch(e=>{this.logTransportError(e,`Failed to send retransmission of final response.`)});return}if(e.method===L.ACK){this.stateTransition(H.Confirmed);return}break;case H.Confirmed:if(e.method===L.INVITE||e.method===L.ACK)return;break;case H.Terminated:if(e.method===L.INVITE||e.method===L.ACK)return;break;default:throw Error(`Invalid state ${this.state}`)}let t=`INVITE server transaction received unexpected ${e.method} request while in state ${this.state}.`;this.logger.warn(t)}receiveResponse(e,t){if(e<100||e>699)throw Error(`Invalid status code ${e}`);switch(this.state){case H.Proceeding:if(e>=100&&e<=199){this.lastProvisionalResponse=t,e>100&&this.startProgressExtensionTimer(),this.send(t).catch(e=>{this.logTransportError(e,`Failed to send 1xx response.`)});return}if(e>=200&&e<=299){this.lastFinalResponse=t,this.stateTransition(H.Accepted),this.send(t).catch(e=>{this.logTransportError(e,`Failed to send 2xx response.`)});return}if(e>=300&&e<=699){this.lastFinalResponse=t,this.stateTransition(H.Completed),this.send(t).catch(e=>{this.logTransportError(e,`Failed to send non-2xx final response.`)});return}break;case H.Accepted:if(e>=200&&e<=299){this.send(t).catch(e=>{this.logTransportError(e,`Failed to send 2xx response.`)});return}break;case H.Completed:break;case H.Confirmed:break;case H.Terminated:break;default:throw Error(`Invalid state ${this.state}`)}let n=`INVITE server transaction received unexpected ${e} response from TU while in state ${this.state}.`;throw this.logger.error(n),Error(n)}retransmitAcceptedResponse(){this.state===H.Accepted&&this.lastFinalResponse&&this.send(this.lastFinalResponse).catch(e=>{this.logTransportError(e,`Failed to send 2xx response.`)})}onTransportError(e){this.user.onTransportError&&this.user.onTransportError(e)}typeToString(){return`INVITE server transaction`}stateTransition(e){let t=()=>{throw Error(`Invalid state transition from ${this.state} to ${e}`)};switch(e){case H.Proceeding:t();break;case H.Accepted:case H.Completed:this.state!==H.Proceeding&&t();break;case H.Confirmed:this.state!==H.Completed&&t();break;case H.Terminated:this.state!==H.Accepted&&this.state!==H.Completed&&this.state!==H.Confirmed&&t();break;default:t()}this.stopProgressExtensionTimer(),e===H.Accepted&&(this.L=setTimeout(()=>this.timerL(),I.TIMER_L)),e===H.Completed&&(this.H=setTimeout(()=>this.timerH(),I.TIMER_H)),e===H.Confirmed&&(this.I=setTimeout(()=>this.timerI(),I.TIMER_I)),e===H.Terminated&&this.dispose(),this.setState(e)}startProgressExtensionTimer(){this.progressExtensionTimer===void 0&&(this.progressExtensionTimer=setInterval(()=>{if(this.logger.debug(`Progress extension timer expired for INVITE server transaction ${this.id}.`),!this.lastProvisionalResponse)throw Error(`Last provisional response undefined.`);this.send(this.lastProvisionalResponse).catch(e=>{this.logTransportError(e,`Failed to send retransmission of provisional response.`)})},I.PROVISIONAL_RESPONSE_INTERVAL))}stopProgressExtensionTimer(){this.progressExtensionTimer!==void 0&&(clearInterval(this.progressExtensionTimer),this.progressExtensionTimer=void 0)}timerG(){}timerH(){this.logger.debug(`Timer H expired for INVITE server transaction ${this.id}.`),this.state===H.Completed&&(this.logger.warn(`ACK to negative final response was never received, terminating transaction.`),this.stateTransition(H.Terminated))}timerI(){this.logger.debug(`Timer I expired for INVITE server transaction ${this.id}.`),this.stateTransition(H.Terminated)}timerL(){this.logger.debug(`Timer L expired for INVITE server transaction ${this.id}.`),this.state===H.Accepted&&this.stateTransition(H.Terminated)}},Ue=class e extends Be{constructor(t,n,r,i,a){super(n,r,e.makeId(t),i,a),this._request=t,this.user=r,t.setViaHeader(this.id,n.protocol)}static makeId(e){if(e.method===`CANCEL`){if(!e.branch)throw Error(`Outgoing CANCEL request without a branch.`);return e.branch}else return`z9hG4bK`+Math.floor(Math.random()*1e7)}get request(){return this._request}onRequestTimeout(){this.user.onRequestTimeout&&this.user.onRequestTimeout()}},We=class extends Ue{constructor(e,t,n){super(e,t,n,H.Trying,`sip.transaction.nict`),this.F=setTimeout(()=>this.timerF(),I.TIMER_F),this.send(e.toString()).catch(e=>{this.logTransportError(e,`Failed to send initial outgoing request.`)})}dispose(){this.F&&=(clearTimeout(this.F),void 0),this.K&&=(clearTimeout(this.K),void 0),super.dispose()}get kind(){return`nict`}receiveResponse(e){let t=e.statusCode;if(!t||t<100||t>699)throw Error(`Invalid status code ${t}`);switch(this.state){case H.Trying:if(t>=100&&t<=199){this.stateTransition(H.Proceeding),this.user.receiveResponse&&this.user.receiveResponse(e);return}if(t>=200&&t<=699){if(this.stateTransition(H.Completed),t===408){this.onRequestTimeout();return}this.user.receiveResponse&&this.user.receiveResponse(e);return}break;case H.Proceeding:if(t>=100&&t<=199&&this.user.receiveResponse)return this.user.receiveResponse(e);if(t>=200&&t<=699){if(this.stateTransition(H.Completed),t===408){this.onRequestTimeout();return}this.user.receiveResponse&&this.user.receiveResponse(e);return}break;case H.Completed:return;case H.Terminated:return;default:throw Error(`Invalid state ${this.state}`)}let n=`Non-INVITE client transaction received unexpected ${t} response while in state ${this.state}.`;this.logger.warn(n)}onTransportError(e){this.user.onTransportError&&this.user.onTransportError(e),this.stateTransition(H.Terminated,!0)}typeToString(){return`non-INVITE client transaction`}stateTransition(e,t=!1){let n=()=>{throw Error(`Invalid state transition from ${this.state} to ${e}`)};switch(e){case H.Trying:n();break;case H.Proceeding:this.state!==H.Trying&&n();break;case H.Completed:this.state!==H.Trying&&this.state!==H.Proceeding&&n();break;case H.Terminated:this.state!==H.Trying&&this.state!==H.Proceeding&&this.state!==H.Completed&&(t||n());break;default:n()}e===H.Completed&&(this.F&&=(clearTimeout(this.F),void 0),this.K=setTimeout(()=>this.timerK(),I.TIMER_K)),e===H.Terminated&&this.dispose(),this.setState(e)}timerF(){this.logger.debug(`Timer F expired for non-INVITE client transaction ${this.id}.`),(this.state===H.Trying||this.state===H.Proceeding)&&(this.onRequestTimeout(),this.stateTransition(H.Terminated))}timerK(){this.state===H.Completed&&this.stateTransition(H.Terminated)}},Ge=class{constructor(e,t){this.core=e,this.dialogState=t,this.core.dialogs.set(this.id,this)}static initialDialogStateForUserAgentClient(e,t){let n=t.getHeaders(`record-route`).reverse(),r=t.parseHeader(`contact`);if(!r)throw Error(`Contact undefined.`);if(!(r instanceof D))throw Error(`Contact not instance of NameAddrHeader.`);let i=r.uri,a=e.cseq,o=e.callId,s=e.fromTag,c=t.toTag;if(!o)throw Error(`Call id undefined.`);if(!s)throw Error(`From tag undefined.`);if(!c)throw Error(`To tag undefined.`);if(!e.from)throw Error(`From undefined.`);if(!e.to)throw Error(`To undefined.`);let l=e.from.uri,u=e.to.uri;if(!t.statusCode)throw Error(`Incoming response status code undefined.`);let d=t.statusCode<200;return{id:o+s+c,early:d,callId:o,localTag:s,remoteTag:c,localSequenceNumber:a,remoteSequenceNumber:void 0,localURI:l,remoteURI:u,remoteTarget:i,routeSet:n,secure:!1}}static initialDialogStateForUserAgentServer(e,t,n=!1){let r=e.getHeaders(`record-route`),i=e.parseHeader(`contact`);if(!i)throw Error(`Contact undefined.`);if(!(i instanceof D))throw Error(`Contact not instance of NameAddrHeader.`);let a=i.uri,o=e.cseq,s=e.callId,c=t,l=e.fromTag,u=e.from.uri,d=e.to.uri;return{id:s+c+l,early:n,callId:s,localTag:c,remoteTag:l,localSequenceNumber:void 0,remoteSequenceNumber:o,localURI:d,remoteURI:u,remoteTarget:a,routeSet:r,secure:!1}}dispose(){this.core.dialogs.delete(this.id)}get id(){return this.dialogState.id}get early(){return this.dialogState.early}get callId(){return this.dialogState.callId}get localTag(){return this.dialogState.localTag}get remoteTag(){return this.dialogState.remoteTag}get localSequenceNumber(){return this.dialogState.localSequenceNumber}get remoteSequenceNumber(){return this.dialogState.remoteSequenceNumber}get localURI(){return this.dialogState.localURI}get remoteURI(){return this.dialogState.remoteURI}get remoteTarget(){return this.dialogState.remoteTarget}get routeSet(){return this.dialogState.routeSet}get secure(){return this.dialogState.secure}get userAgentCore(){return this.core}confirm(){this.dialogState.early=!1}receiveRequest(e){if(e.method!==L.ACK){if(this.remoteSequenceNumber){if(e.cseq<=this.remoteSequenceNumber)throw 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)}}recomputeRouteSet(e){this.dialogState.routeSet=e.getHeaders(`record-route`).reverse()}createOutgoingRequestMessage(e,t){let n=this.remoteURI,r=this.remoteTag,i=this.localURI,a=this.localTag,o=this.callId,s;s=t&&t.cseq?t.cseq:this.dialogState.localSequenceNumber?this.dialogState.localSequenceNumber+=1:this.dialogState.localSequenceNumber=1;let c=this.remoteTarget,l=this.routeSet,u=t&&t.extraHeaders,d=t&&t.body;return this.userAgentCore.makeOutgoingRequestMessage(e,c,i,n,{callId:o,cseq:s,fromTag:a,toTag:r,routeSet:l},u,d)}incrementLocalSequenceNumber(){if(!this.dialogState.localSequenceNumber)throw Error(`Local sequence number undefined.`);this.dialogState.localSequenceNumber+=1}sequenceGuard(e){return e.method===L.ACK?!0:this.remoteSequenceNumber&&e.cseq<=this.remoteSequenceNumber?(this.core.replyStateless(e,{statusCode:500}),!1):!0}},Ke=class extends Ue{constructor(e,t,n){super(e,t,n,H.Calling,`sip.transaction.ict`),this.ackRetransmissionCache=new Map,this.B=setTimeout(()=>this.timerB(),I.TIMER_B),this.send(e.toString()).catch(e=>{this.logTransportError(e,`Failed to send initial outgoing request.`)})}dispose(){this.B&&=(clearTimeout(this.B),void 0),this.D&&=(clearTimeout(this.D),void 0),this.M&&=(clearTimeout(this.M),void 0),super.dispose()}get kind(){return`ict`}ackResponse(e){let t=e.toTag;if(!t)throw Error(`To tag undefined.`);let n=`z9hG4bK`+Math.floor(Math.random()*1e7);e.setViaHeader(n,this.transport.protocol),this.ackRetransmissionCache.set(t,e),this.send(e.toString()).catch(e=>{this.logTransportError(e,`Failed to send ACK to 2xx response.`)})}receiveResponse(e){let t=e.statusCode;if(!t||t<100||t>699)throw Error(`Invalid status code ${t}`);switch(this.state){case H.Calling:if(t>=100&&t<=199){this.stateTransition(H.Proceeding),this.user.receiveResponse&&this.user.receiveResponse(e);return}if(t>=200&&t<=299){this.ackRetransmissionCache.set(e.toTag,void 0),this.stateTransition(H.Accepted),this.user.receiveResponse&&this.user.receiveResponse(e);return}if(t>=300&&t<=699){this.stateTransition(H.Completed),this.ack(e),this.user.receiveResponse&&this.user.receiveResponse(e);return}break;case H.Proceeding:if(t>=100&&t<=199){this.user.receiveResponse&&this.user.receiveResponse(e);return}if(t>=200&&t<=299){this.ackRetransmissionCache.set(e.toTag,void 0),this.stateTransition(H.Accepted),this.user.receiveResponse&&this.user.receiveResponse(e);return}if(t>=300&&t<=699){this.stateTransition(H.Completed),this.ack(e),this.user.receiveResponse&&this.user.receiveResponse(e);return}break;case H.Accepted:if(t>=200&&t<=299){if(!this.ackRetransmissionCache.has(e.toTag)){this.ackRetransmissionCache.set(e.toTag,void 0),this.user.receiveResponse&&this.user.receiveResponse(e);return}let t=this.ackRetransmissionCache.get(e.toTag);if(t){this.send(t.toString()).catch(e=>{this.logTransportError(e,`Failed to send retransmission of ACK to 2xx response.`)});return}return}break;case H.Completed:if(t>=300&&t<=699){this.ack(e);return}break;case H.Terminated:break;default:throw Error(`Invalid state ${this.state}`)}let n=`Received unexpected ${t} response while in state ${this.state}.`;this.logger.warn(n)}onTransportError(e){this.user.onTransportError&&this.user.onTransportError(e),this.stateTransition(H.Terminated,!0)}typeToString(){return`INVITE client transaction`}ack(e){let t=this.request.ruri,n=this.request.callId,r=this.request.cseq,i=this.request.getHeader(`from`),a=e.getHeader(`to`),o=this.request.getHeader(`via`),s=this.request.getHeader(`route`);if(!i)throw Error(`From undefined.`);if(!a)throw Error(`To undefined.`);if(!o)throw Error(`Via undefined.`);let c=`ACK ${t} SIP/2.0\r\n`;s&&(c+=`Route: ${s}\r\n`),c+=`Via: ${o}\r\n`,c+=`To: ${a}\r\n`,c+=`From: ${i}\r\n`,c+=`Call-ID: ${n}\r\n`,c+=`CSeq: ${r} ACK\r\n`,c+=`Max-Forwards: 70\r
40
40
  `,c+=`Content-Length: 0\r
41
41
  \r
42
- `,this.send(c).catch(e=>{this.logTransportError(e,`Failed to send ACK to non-2xx response.`)})}stateTransition(e,t=!1){let n=()=>{throw Error(`Invalid state transition from ${this.state} to ${e}`)};switch(e){case H.Calling:n();break;case H.Proceeding:this.state!==H.Calling&&n();break;case H.Accepted:case H.Completed:this.state!==H.Calling&&this.state!==H.Proceeding&&n();break;case H.Terminated:this.state!==H.Calling&&this.state!==H.Accepted&&this.state!==H.Completed&&(t||n());break;default:n()}this.B&&=(clearTimeout(this.B),void 0),H.Proceeding,e===H.Completed&&(this.D=setTimeout(()=>this.timerD(),F.TIMER_D)),e===H.Accepted&&(this.M=setTimeout(()=>this.timerM(),F.TIMER_M)),e===H.Terminated&&this.dispose(),this.setState(e)}timerA(){}timerB(){this.logger.debug(`Timer B expired for INVITE client transaction ${this.id}.`),this.state===H.Calling&&(this.onRequestTimeout(),this.stateTransition(H.Terminated))}timerD(){this.logger.debug(`Timer D expired for INVITE client transaction ${this.id}.`),this.state===H.Completed&&this.stateTransition(H.Terminated)}timerM(){this.logger.debug(`Timer M expired for INVITE client transaction ${this.id}.`),this.state===H.Accepted&&this.stateTransition(H.Terminated)}},qe=class e{constructor(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()}dispose(){this.transaction.dispose()}get loggerFactory(){return this.core.loggerFactory}get transaction(){if(!this._transaction)throw Error(`Transaction undefined.`);return this._transaction}cancel(t,n={}){if(!this.transaction)throw Error(`Transaction undefined.`);if(!this.message.to)throw Error(`To undefined.`);if(!this.message.from)throw Error(`From undefined.`);let r=this.core.makeOutgoingRequestMessage(I.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 r.branch=this.message.branch,this.message.headers.Route&&(r.headers.Route=this.message.headers.Route),t&&r.setHeader(`Reason`,t),this.transaction.state===H.Proceeding?new e(We,this.core,r):this.transaction.addStateChangeListener(()=>{this.transaction&&this.transaction.state===H.Proceeding&&new e(We,this.core,r)},{once:!0}),r}authenticationGuard(e,t){let n=e.statusCode;if(!n)throw Error(`Response status code undefined.`);if(n!==401&&n!==407)return!0;let r,i;if(n===401?(r=e.parseHeader(`www-authenticate`),i=`authorization`):(r=e.parseHeader(`proxy-authenticate`),i=`proxy-authorization`),!r)return this.logger.warn(n+` with wrong or missing challenge, cannot authenticate`),!0;if(this.challenged&&(this.stale||r.stale!==!0))return this.logger.warn(n+` 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,r))return!0;this.challenged=!0,r.stale&&(this.stale=!0);let a=this.message.cseq+=1;return t&&t.localSequenceNumber&&(t.incrementLocalSequenceNumber(),a=this.message.cseq=t.localSequenceNumber),this.message.setHeader(`cseq`,a+` `+this.message.method),this.message.setHeader(i,this.credentials.toString()),this.init(),!1}onRequestTimeout(){this.logger.warn(`User agent client request timed out. Generating internal 408 Request Timeout.`);let e=new de;e.statusCode=408,e.reasonPhrase=`Request Timeout`,this.receiveResponse(e)}onTransportError(e){this.logger.error(e.message),this.logger.error(`User agent client request transport error. Generating internal 503 Service Unavailable.`);let t=new de;t.statusCode=503,t.reasonPhrase=`Service Unavailable`,this.receiveResponse(t)}receiveResponse(e){if(!this.authenticationGuard(e))return;let t=e.statusCode?e.statusCode.toString():``;if(!t)throw 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 Error(`Invalid status code ${t}`)}}init(){let e={loggerFactory:this.loggerFactory,onRequestTimeout:()=>this.onRequestTimeout(),onStateChange:e=>{e===H.Terminated&&(this.core.userAgentClients.delete(n),t===this._transaction&&this.dispose())},onTransportError:e=>this.onTransportError(e),receiveResponse:e=>this.receiveResponse(e)},t=new this.transactionConstructor(this.message,this.core.transport,e);this._transaction=t;let n=t.id+t.request.method;this.core.userAgentClients.set(n,this)}},Je=class extends qe{constructor(e,t,n){let r=e.createOutgoingRequestMessage(I.BYE,n);super(We,e.userAgentCore,r,t),e.dispose()}},Ye=class extends Ve{constructor(e,t,n){super(e,t,n,H.Trying,`sip.transaction.nist`)}dispose(){this.J&&=(clearTimeout(this.J),void 0),super.dispose()}get kind(){return`nist`}receiveRequest(e){switch(this.state){case H.Trying:break;case H.Proceeding:if(!this.lastResponse)throw Error(`Last response undefined.`);this.send(this.lastResponse).catch(e=>{this.logTransportError(e,`Failed to send retransmission of provisional response.`)});break;case H.Completed:if(!this.lastResponse)throw Error(`Last response undefined.`);this.send(this.lastResponse).catch(e=>{this.logTransportError(e,`Failed to send retransmission of final response.`)});break;case H.Terminated:break;default:throw Error(`Invalid state ${this.state}`)}}receiveResponse(e,t){if(e<100||e>699)throw Error(`Invalid status code ${e}`);if(e>100&&e<=199)throw Error(`Provisional response other than 100 not allowed.`);switch(this.state){case H.Trying:if(this.lastResponse=t,e>=100&&e<200){this.stateTransition(H.Proceeding),this.send(t).catch(e=>{this.logTransportError(e,`Failed to send provisional response.`)});return}if(e>=200&&e<=699){this.stateTransition(H.Completed),this.send(t).catch(e=>{this.logTransportError(e,`Failed to send final response.`)});return}break;case H.Proceeding:if(this.lastResponse=t,e>=200&&e<=699){this.stateTransition(H.Completed),this.send(t).catch(e=>{this.logTransportError(e,`Failed to send final response.`)});return}break;case H.Completed:return;case H.Terminated:break;default:throw Error(`Invalid state ${this.state}`)}let n=`Non-INVITE server transaction received unexpected ${e} response from TU while in state ${this.state}.`;throw this.logger.error(n),Error(n)}onTransportError(e){this.user.onTransportError&&this.user.onTransportError(e),this.stateTransition(H.Terminated,!0)}typeToString(){return`non-INVITE server transaction`}stateTransition(e,t=!1){let n=()=>{throw Error(`Invalid state transition from ${this.state} to ${e}`)};switch(e){case H.Trying:n();break;case H.Proceeding:this.state!==H.Trying&&n();break;case H.Completed:this.state!==H.Trying&&this.state!==H.Proceeding&&n();break;case H.Terminated:this.state!==H.Proceeding&&this.state!==H.Completed&&(t||n());break;default:n()}e===H.Completed&&(this.J=setTimeout(()=>this.timerJ(),F.TIMER_J)),e===H.Terminated&&this.dispose(),this.setState(e)}timerJ(){this.logger.debug(`Timer J expired for NON-INVITE server transaction ${this.id}.`),this.state===H.Completed&&this.stateTransition(H.Terminated)}},Xe=class{constructor(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:se(),this.init()}dispose(){this.transaction.dispose()}get loggerFactory(){return this.core.loggerFactory}get transaction(){if(!this._transaction)throw Error(`Transaction undefined.`);return this._transaction}accept(e={statusCode:200}){if(!this.acceptable)throw new be(`${this.message.method} not acceptable in state ${this.transaction.state}.`);let t=e.statusCode;if(t<200||t>299)throw TypeError(`Invalid statusCode: ${t}`);return this.reply(e)}progress(e={statusCode:180}){if(!this.progressable)throw new be(`${this.message.method} not progressable in state ${this.transaction.state}.`);let t=e.statusCode;if(t<101||t>199)throw TypeError(`Invalid statusCode: ${t}`);return this.reply(e)}redirect(e,t={statusCode:302}){if(!this.redirectable)throw new be(`${this.message.method} not redirectable in state ${this.transaction.state}.`);let n=t.statusCode;if(n<300||n>399)throw TypeError(`Invalid statusCode: ${n}`);let r=[];return e.forEach(e=>r.push(`Contact: ${e.toString()}`)),t.extraHeaders=(t.extraHeaders||[]).concat(r),this.reply(t)}reject(e={statusCode:480}){if(!this.rejectable)throw new be(`${this.message.method} not rejectable in state ${this.transaction.state}.`);let t=e.statusCode;if(t<400||t>699)throw TypeError(`Invalid statusCode: ${t}`);return this.reply(e)}trying(e){if(!this.tryingable)throw new be(`${this.message.method} not tryingable in state ${this.transaction.state}.`);return this.reply({statusCode:100})}receiveCancel(e){this.delegate&&this.delegate.onCancel&&this.delegate.onCancel(e)}get acceptable(){if(this.transaction instanceof He)return this.transaction.state===H.Proceeding||this.transaction.state===H.Accepted;if(this.transaction instanceof Ye)return this.transaction.state===H.Trying||this.transaction.state===H.Proceeding;throw Error(`Unknown transaction type.`)}get progressable(){if(this.transaction instanceof He)return this.transaction.state===H.Proceeding;if(this.transaction instanceof Ye)return!1;throw Error(`Unknown transaction type.`)}get redirectable(){if(this.transaction instanceof He)return this.transaction.state===H.Proceeding;if(this.transaction instanceof Ye)return this.transaction.state===H.Trying||this.transaction.state===H.Proceeding;throw Error(`Unknown transaction type.`)}get rejectable(){if(this.transaction instanceof He)return this.transaction.state===H.Proceeding;if(this.transaction instanceof Ye)return this.transaction.state===H.Trying||this.transaction.state===H.Proceeding;throw Error(`Unknown transaction type.`)}get tryingable(){if(this.transaction instanceof He)return this.transaction.state===H.Proceeding;if(this.transaction instanceof Ye)return this.transaction.state===H.Trying;throw Error(`Unknown transaction type.`)}reply(e){!e.toTag&&e.statusCode!==100&&(e.toTag=this.toTag),e.userAgent=e.userAgent||this.core.configuration.userAgentHeaderFieldValue,e.supported=e.supported||this.core.configuration.supportedOptionTagsResponse;let t=Re(this.message,e);return this.transaction.receiveResponse(e.statusCode,t.message),t}init(){let e={loggerFactory:this.loggerFactory,onStateChange:e=>{e===H.Terminated&&(this.core.userAgentServers.delete(n),this.dispose())},onTransportError:e=>{this.logger.error(e.message),this.delegate&&this.delegate.onTransportError?this.delegate.onTransportError(e):this.logger.error(`User agent server response transport error.`)}},t=new this.transactionConstructor(this.message,this.core.transport,e);this._transaction=t;let n=t.id;this.core.userAgentServers.set(t.id,this)}},Ze=class extends Xe{constructor(e,t,n){super(Ye,e.userAgentCore,t,n)}},Qe=class extends qe{constructor(e,t,n){let r=e.createOutgoingRequestMessage(I.INFO,n);super(We,e.userAgentCore,r,t)}},$e=class extends Xe{constructor(e,t,n){super(Ye,e.userAgentCore,t,n)}},et=class extends qe{constructor(e,t,n){super(We,e,t,n)}},tt=class extends Xe{constructor(e,t,n){super(Ye,e,t,n)}},nt=class extends qe{constructor(e,t,n){let r=e.createOutgoingRequestMessage(I.NOTIFY,n);super(We,e.userAgentCore,r,t)}};function rt(e){return e.userAgentCore!==void 0}var it=class extends Xe{constructor(e,t,n){let r=rt(e)?e.userAgentCore:e;super(Ye,r,t,n)}},at=class extends qe{constructor(e,t,n){let r=e.createOutgoingRequestMessage(I.PRACK,n);super(We,e.userAgentCore,r,t),e.signalingStateTransition(r)}},ot=class extends Xe{constructor(e,t,n){super(Ye,e.userAgentCore,t,n),e.signalingStateTransition(t),this.dialog=e}accept(e={statusCode:200}){return e.body&&this.dialog.signalingStateTransition(e.body),super.accept(e)}},st=class extends qe{constructor(e,t,n){let r=e.createOutgoingRequestMessage(I.INVITE,n);super(Ke,e.userAgentCore,r,t),this.delegate=t,e.signalingStateTransition(r),e.reinviteUserAgentClient=this,this.dialog=e}receiveResponse(e){if(!this.authenticationGuard(e,this.dialog))return;let t=e.statusCode?e.statusCode.toString():``;if(!t)throw 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,session:this.dialog,prack:e=>{throw Error(`Unimplemented.`)}});break;case/^2[0-9]{2}$/.test(t):this.dialog.signalingStateTransition(e),this.delegate&&this.delegate.onAccept&&this.delegate.onAccept({message:e,session:this.dialog,ack:e=>this.dialog.ack(e)});break;case/^3[0-9]{2}$/.test(t):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(t):this.dialog.signalingStateRollback(),this.dialog.reinviteUserAgentClient=void 0,this.delegate&&this.delegate.onReject&&this.delegate.onReject({message:e});break;default:throw Error(`Invalid status code ${t}`)}}},ct=class extends Xe{constructor(e,t,n){super(He,e.userAgentCore,t,n),e.reinviteUserAgentServer=this,this.dialog=e}accept(e={statusCode:200}){e.extraHeaders=e.extraHeaders||[],e.extraHeaders=e.extraHeaders.concat(this.dialog.routeSet.map(e=>`Record-Route: ${e}`));let t=super.accept(e),n=this.dialog,r=Object.assign(Object.assign({},t),{session:n});return e.body&&this.dialog.signalingStateTransition(e.body),this.dialog.reConfirm(),r}progress(e={statusCode:180}){let t=super.progress(e),n=this.dialog,r=Object.assign(Object.assign({},t),{session:n});return e.body&&this.dialog.signalingStateTransition(e.body),r}redirect(e,t={statusCode:302}){throw this.dialog.signalingStateRollback(),this.dialog.reinviteUserAgentServer=void 0,Error(`Unimplemented.`)}reject(e={statusCode:488}){return this.dialog.signalingStateRollback(),this.dialog.reinviteUserAgentServer=void 0,super.reject(e)}},lt=class extends qe{constructor(e,t,n){let r=e.createOutgoingRequestMessage(I.REFER,n);super(We,e.userAgentCore,r,t)}};function ut(e){return e.userAgentCore!==void 0}var dt=class extends Xe{constructor(e,t,n){let r=ut(e)?e.userAgentCore:e;super(Ye,r,t,n)}},ft=class extends Ge{constructor(e,t,n,r){super(t,n),this.initialTransaction=e,this._signalingState=P.Initial,this.ackWait=!1,this.ackProcessing=!1,this.delegate=r,e instanceof He&&(this.ackWait=!0),this.early||this.start2xxRetransmissionTimer(),this.signalingStateTransition(e.request),this.logger=t.loggerFactory.getLogger(`sip.invite-dialog`),this.logger.log(`INVITE dialog ${this.id} constructed`)}dispose(){super.dispose(),this._signalingState=P.Closed,this._offer=void 0,this._answer=void 0,this.invite2xxTimer&&=(clearTimeout(this.invite2xxTimer),void 0),this.logger.log(`INVITE dialog ${this.id} destroyed`)}get sessionState(){return this.early?ge.Early:this.ackWait?ge.AckWait:this._signalingState===P.Closed?ge.Terminated:ge.Confirmed}get signalingState(){return this._signalingState}get offer(){return this._offer}get answer(){return this._answer}confirm(){this.early&&this.start2xxRetransmissionTimer(),super.confirm()}reConfirm(){this.reinviteUserAgentServer&&this.startReInvite2xxRetransmissionTimer()}ack(e={}){this.logger.log(`INVITE dialog ${this.id} sending ACK request`);let t;if(this.reinviteUserAgentClient){if(!(this.reinviteUserAgentClient.transaction instanceof Ke))throw Error(`Transaction not instance of InviteClientTransaction.`);t=this.reinviteUserAgentClient.transaction,this.reinviteUserAgentClient=void 0}else{if(!(this.initialTransaction instanceof Ke))throw Error(`Initial transaction not instance of InviteClientTransaction.`);t=this.initialTransaction}let n=this.createOutgoingRequestMessage(I.ACK,{cseq:t.request.cseq,extraHeaders:e.extraHeaders,body:e.body});return t.ackResponse(n),this.signalingStateTransition(n),{message:n}}bye(e,t){if(this.logger.log(`INVITE dialog ${this.id} sending BYE request`),this.initialTransaction instanceof He){if(this.early)throw Error(`UAS MUST NOT send a BYE on early dialogs.`);if(this.ackWait&&this.initialTransaction.state!==H.Terminated)throw 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 Je(this,e,t)}info(e,t){if(this.logger.log(`INVITE dialog ${this.id} sending INFO request`),this.early)throw Error(`Dialog not confirmed.`);return new Qe(this,e,t)}invite(e,t){if(this.logger.log(`INVITE dialog ${this.id} sending INVITE request`),this.early)throw Error(`Dialog not confirmed.`);if(this.reinviteUserAgentClient)throw Error(`There is an ongoing re-INVITE client transaction.`);if(this.reinviteUserAgentServer)throw Error(`There is an ongoing re-INVITE server transaction.`);return new st(this,e,t)}message(e,t){if(this.logger.log(`INVITE dialog ${this.id} sending MESSAGE request`),this.early)throw Error(`Dialog not confirmed.`);let n=this.createOutgoingRequestMessage(I.MESSAGE,t);return new et(this.core,n,e)}notify(e,t){if(this.logger.log(`INVITE dialog ${this.id} sending NOTIFY request`),this.early)throw Error(`Dialog not confirmed.`);return new nt(this,e,t)}prack(e,t){return this.logger.log(`INVITE dialog ${this.id} sending PRACK request`),new at(this,e,t)}refer(e,t){if(this.logger.log(`INVITE dialog ${this.id} sending REFER request`),this.early)throw Error(`Dialog not confirmed.`);return new lt(this,e,t)}receiveRequest(e){if(this.logger.log(`INVITE dialog ${this.id} received ${e.method} request`),e.method===I.ACK){if(this.ackWait){if(this.initialTransaction instanceof Ke){this.logger.warn(`INVITE dialog ${this.id} received unexpected ${e.method} request, dropping.`);return}if(this.initialTransaction.request.cseq!==e.cseq){this.logger.warn(`INVITE dialog ${this.id} received unexpected ${e.method} request, dropping.`);return}this.ackWait=!1}else{if(!this.reinviteUserAgentServer){this.logger.warn(`INVITE dialog ${this.id} received unexpected ${e.method} request, dropping.`);return}if(this.reinviteUserAgentServer.transaction.request.cseq!==e.cseq){this.logger.warn(`INVITE dialog ${this.id} received unexpected ${e.method} request, dropping.`);return}this.reinviteUserAgentServer=void 0}if(this.signalingStateTransition(e),this.delegate&&this.delegate.onAck){let t=this.delegate.onAck({message:e});t instanceof Promise&&(this.ackProcessing=!0,t.then(()=>this.ackProcessing=!1).catch(()=>this.ackProcessing=!1))}return}if(!this.sequenceGuard(e)){this.logger.log(`INVITE dialog ${this.id} rejected out of order ${e.method} request.`);return}if(super.receiveRequest(e),e.method===I.INVITE){let t=()=>{let e=this.ackWait?`waiting for initial ACK`:`processing initial ACK`;this.logger.warn(`INVITE dialog ${this.id} received re-INVITE while ${e}`);let 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.`,this.logger.warn(t)},n=[`Retry-After: ${Math.floor(Math.random()*10)+1}`];if(this.ackProcessing){this.core.replyStateless(e,{statusCode:500,extraHeaders:n}),t();return}if(this.ackWait&&this.signalingState!==P.Stable){this.core.replyStateless(e,{statusCode:500,extraHeaders:n}),t();return}if(this.reinviteUserAgentServer){this.core.replyStateless(e,{statusCode:500,extraHeaders:n});return}if(this.reinviteUserAgentClient){this.core.replyStateless(e,{statusCode:491});return}}if(e.method===I.INVITE){let t=e.parseHeader(`contact`);if(!t)throw Error(`Contact undefined.`);if(!(t instanceof D))throw Error(`Contact not instance of NameAddrHeader.`);this.dialogState.remoteTarget=t.uri}switch(e.method){case I.BYE:{let t=new Ze(this,e);this.delegate&&this.delegate.onBye?this.delegate.onBye(t):t.accept(),this.dispose()}break;case I.INFO:{let t=new $e(this,e);this.delegate&&this.delegate.onInfo?this.delegate.onInfo(t):t.reject({statusCode:469,extraHeaders:[`Recv-Info:`]})}break;case I.INVITE:{let t=new ct(this,e);this.signalingStateTransition(e),this.delegate&&this.delegate.onInvite?this.delegate.onInvite(t):t.reject({statusCode:488})}break;case I.MESSAGE:{let t=new tt(this.core,e);this.delegate&&this.delegate.onMessage?this.delegate.onMessage(t):t.accept()}break;case I.NOTIFY:{let t=new it(this,e);this.delegate&&this.delegate.onNotify?this.delegate.onNotify(t):t.accept()}break;case I.PRACK:{let t=new ot(this,e);this.delegate&&this.delegate.onPrack?this.delegate.onPrack(t):t.accept()}break;case I.REFER:{let t=new dt(this,e);this.delegate&&this.delegate.onRefer?this.delegate.onRefer(t):t.reject()}break;default:this.logger.log(`INVITE dialog ${this.id} received unimplemented ${e.method} request`),this.core.replyStateless(e,{statusCode:501});break}}reliableSequenceGuard(e){let t=e.statusCode;if(!t)throw Error(`Status code undefined`);if(t>100&&t<200){let t=e.getHeader(`require`),n=e.getHeader(`rseq`),r=t&&t.includes(`100rel`)&&n?Number(n):void 0;if(r){if(this.rseq&&this.rseq+1!==r)return!1;this.rseq=this.rseq?this.rseq+1:r}}return!0}signalingStateRollback(){(this._signalingState===P.HaveLocalOffer||this.signalingState===P.HaveRemoteOffer)&&this._rollbackOffer&&this._rollbackAnswer&&(this._signalingState=P.Stable,this._offer=this._rollbackOffer,this._answer=this._rollbackAnswer)}signalingStateTransition(e){let t=he(e);if(!(!t||t.contentDisposition!==`session`)){if(this._signalingState===P.Stable&&(this._rollbackOffer=this._offer,this._rollbackAnswer=this._answer),e instanceof ue)switch(this._signalingState){case P.Initial:case P.Stable:this._signalingState=P.HaveRemoteOffer,this._offer=t,this._answer=void 0;break;case P.HaveLocalOffer:this._signalingState=P.Stable,this._answer=t;break;case P.HaveRemoteOffer:break;case P.Closed:break;default:throw Error(`Unexpected signaling state.`)}if(e instanceof de)switch(this._signalingState){case P.Initial:case P.Stable:this._signalingState=P.HaveRemoteOffer,this._offer=t,this._answer=void 0;break;case P.HaveLocalOffer:this._signalingState=P.Stable,this._answer=t;break;case P.HaveRemoteOffer:break;case P.Closed:break;default:throw Error(`Unexpected signaling state.`)}if(e instanceof N)switch(this._signalingState){case P.Initial:case P.Stable:this._signalingState=P.HaveLocalOffer,this._offer=t,this._answer=void 0;break;case P.HaveLocalOffer:break;case P.HaveRemoteOffer:this._signalingState=P.Stable,this._answer=t;break;case P.Closed:break;default:throw Error(`Unexpected signaling state.`)}if(me(e))switch(this._signalingState){case P.Initial:case P.Stable:this._signalingState=P.HaveLocalOffer,this._offer=t,this._answer=void 0;break;case P.HaveLocalOffer:break;case P.HaveRemoteOffer:this._signalingState=P.Stable,this._answer=t;break;case P.Closed:break;default:throw Error(`Unexpected signaling state.`)}}}start2xxRetransmissionTimer(){if(this.initialTransaction instanceof He){let e=this.initialTransaction,t=F.T1,n=()=>{if(!this.ackWait){this.invite2xxTimer=void 0;return}this.logger.log(`No ACK for 2xx response received, attempting retransmission`),e.retransmitAcceptedResponse(),t=Math.min(t*2,F.T2),this.invite2xxTimer=setTimeout(n,t)};this.invite2xxTimer=setTimeout(n,t);let r=()=>{e.state===H.Terminated&&(e.removeStateChangeListener(r),this.invite2xxTimer&&=(clearTimeout(this.invite2xxTimer),void 0),this.ackWait&&(this.delegate&&this.delegate.onAckTimeout?this.delegate.onAckTimeout():this.bye()))};e.addStateChangeListener(r)}}startReInvite2xxRetransmissionTimer(){if(this.reinviteUserAgentServer&&this.reinviteUserAgentServer.transaction instanceof He){let e=this.reinviteUserAgentServer.transaction,t=F.T1,n=()=>{if(!this.reinviteUserAgentServer){this.invite2xxTimer=void 0;return}this.logger.log(`No ACK for 2xx response received, attempting retransmission`),e.retransmitAcceptedResponse(),t=Math.min(t*2,F.T2),this.invite2xxTimer=setTimeout(n,t)};this.invite2xxTimer=setTimeout(n,t);let r=()=>{e.state===H.Terminated&&(e.removeStateChangeListener(r),this.invite2xxTimer&&=(clearTimeout(this.invite2xxTimer),void 0),this.reinviteUserAgentServer)};e.addStateChangeListener(r)}}},pt=class extends qe{constructor(e,t,n){super(Ke,e,t,n),this.confirmedDialogAcks=new Map,this.confirmedDialogs=new Map,this.earlyDialogs=new Map,this.delegate=n}dispose(){this.earlyDialogs.forEach(e=>e.dispose()),this.earlyDialogs.clear(),super.dispose()}onTransportError(e){if(this.transaction.state===H.Calling)return super.onTransportError(e);this.logger.error(e.message),this.logger.error(`User agent client request transport error while sending ACK.`)}receiveResponse(e){if(!this.authenticationGuard(e))return;let t=e.statusCode?e.statusCode.toString():``;if(!t)throw Error(`Response status code undefined.`);switch(!0){case/^100$/.test(t):this.delegate&&this.delegate.onTrying&&this.delegate.onTrying({message:e});return;case/^1[0-9]{2}$/.test(t):{if(!e.toTag){this.logger.warn(`Non-100 1xx INVITE response received without a to tag, dropping.`);return}if(!e.parseHeader(`contact`)){this.logger.error(`Non-100 1xx INVITE response received without a Contact header field, dropping.`);return}let t=Ge.initialDialogStateForUserAgentClient(this.message,e),n=this.earlyDialogs.get(t.id);if(!n){let e=this.transaction;if(!(e instanceof Ke))throw Error(`Transaction not instance of InviteClientTransaction.`);n=new ft(e,this.core,t),this.earlyDialogs.set(n.id,n)}if(!n.reliableSequenceGuard(e)){this.logger.warn(`1xx INVITE reliable response received out of order or is a retransmission, dropping.`);return}(n.signalingState===P.Initial||n.signalingState===P.HaveLocalOffer)&&n.signalingStateTransition(e);let r=n;this.delegate&&this.delegate.onProgress&&this.delegate.onProgress({message:e,session:r,prack:e=>r.prack(void 0,e)})}return;case/^2[0-9]{2}$/.test(t):{if(!e.toTag){this.logger.error(`2xx INVITE response received without a to tag, dropping.`);return}if(!e.parseHeader(`contact`)){this.logger.error(`2xx INVITE response received without a Contact header field, dropping.`);return}let t=Ge.initialDialogStateForUserAgentClient(this.message,e),n=this.confirmedDialogs.get(t.id);if(n){let e=this.confirmedDialogAcks.get(t.id);if(e){let t=this.transaction;if(!(t instanceof Ke))throw Error(`Client transaction not instance of InviteClientTransaction.`);t.ackResponse(e.message)}return}if(n=this.earlyDialogs.get(t.id),n)n.confirm(),n.recomputeRouteSet(e),this.earlyDialogs.delete(n.id),this.confirmedDialogs.set(n.id,n);else{let e=this.transaction;if(!(e instanceof Ke))throw Error(`Transaction not instance of InviteClientTransaction.`);n=new ft(e,this.core,t),this.confirmedDialogs.set(n.id,n)}(n.signalingState===P.Initial||n.signalingState===P.HaveLocalOffer)&&n.signalingStateTransition(e);let r=n;if(this.delegate&&this.delegate.onAccept)this.delegate.onAccept({message:e,session:r,ack:e=>{let t=r.ack(e);return this.confirmedDialogAcks.set(r.id,t),t}});else{let e=r.ack();this.confirmedDialogAcks.set(r.id,e)}}return;case/^3[0-9]{2}$/.test(t):this.earlyDialogs.forEach(e=>e.dispose()),this.earlyDialogs.clear(),this.delegate&&this.delegate.onRedirect&&this.delegate.onRedirect({message:e});return;case/^[4-6][0-9]{2}$/.test(t):this.earlyDialogs.forEach(e=>e.dispose()),this.earlyDialogs.clear(),this.delegate&&this.delegate.onReject&&this.delegate.onReject({message:e});return;default:throw Error(`Invalid status code ${t}`)}throw Error(`Executing what should be an unreachable code path receiving ${t} response.`)}},mt=class extends Xe{constructor(e,t,n){super(He,e,t,n),this.core=e}dispose(){this.earlyDialog&&this.earlyDialog.dispose(),super.dispose()}accept(e={statusCode:200}){if(!this.acceptable)throw new be(`${this.message.method} not acceptable in state ${this.transaction.state}.`);if(!this.confirmedDialog)if(this.earlyDialog)this.earlyDialog.confirm(),this.confirmedDialog=this.earlyDialog,this.earlyDialog=void 0;else{let e=this.transaction;if(!(e instanceof He))throw Error(`Transaction not instance of InviteClientTransaction.`);let t=Ge.initialDialogStateForUserAgentServer(this.message,this.toTag);this.confirmedDialog=new ft(e,this.core,t)}let t=this.message.getHeaders(`record-route`).map(e=>`Record-Route: ${e}`),n=`Contact: ${this.core.configuration.contact.toString()}`,r=`Allow: `+xe.toString();if(!e.body){if(this.confirmedDialog.signalingState===P.Stable)e.body=this.confirmedDialog.answer;else if(this.confirmedDialog.signalingState===P.Initial||this.confirmedDialog.signalingState===P.HaveRemoteOffer)throw Error(`Response must have a body.`)}e.statusCode=e.statusCode||200,e.extraHeaders=e.extraHeaders||[],e.extraHeaders=e.extraHeaders.concat(t),e.extraHeaders.push(r),e.extraHeaders.push(n);let i=super.accept(e),a=this.confirmedDialog,o=Object.assign(Object.assign({},i),{session:a});return e.body&&this.confirmedDialog.signalingState!==P.Stable&&this.confirmedDialog.signalingStateTransition(e.body),o}progress(e={statusCode:180}){if(!this.progressable)throw new be(`${this.message.method} not progressable in state ${this.transaction.state}.`);if(!this.earlyDialog){let e=this.transaction;if(!(e instanceof He))throw Error(`Transaction not instance of InviteClientTransaction.`);let t=Ge.initialDialogStateForUserAgentServer(this.message,this.toTag,!0);this.earlyDialog=new ft(e,this.core,t)}let t=this.message.getHeaders(`record-route`).map(e=>`Record-Route: ${e}`),n=`Contact: ${this.core.configuration.contact}`;e.extraHeaders=e.extraHeaders||[],e.extraHeaders=e.extraHeaders.concat(t),e.extraHeaders.push(n);let r=super.progress(e),i=this.earlyDialog,a=Object.assign(Object.assign({},r),{session:i});return e.body&&this.earlyDialog.signalingState!==P.Stable&&this.earlyDialog.signalingStateTransition(e.body),a}redirect(e,t={statusCode:302}){return super.redirect(e,t)}reject(e={statusCode:486}){return super.reject(e)}},ht=class extends qe{constructor(e,t,n){super(We,e,t,n)}},gt=class extends qe{constructor(e,t,n){super(We,e,t,n)}},_t=class extends Xe{constructor(e,t,n){super(Ye,e,t,n),this.core=e}},vt=class extends qe{constructor(e,t,n){let r=e.createOutgoingRequestMessage(I.SUBSCRIBE,n);super(We,e.userAgentCore,r,t),this.dialog=e}waitNotifyStop(){}receiveResponse(e){if(e.statusCode&&e.statusCode>=200&&e.statusCode<300){let t=e.getHeader(`Expires`);if(!t)this.logger.warn(`Expires header missing in a 200-class response to SUBSCRIBE`);else{let e=Number(t);this.dialog.subscriptionExpires>e&&(this.dialog.subscriptionExpires=e)}}e.statusCode&&e.statusCode>=400&&e.statusCode<700&&[404,405,410,416,480,481,482,483,484,485,489,501,604].includes(e.statusCode)&&this.dialog.terminate(),super.receiveResponse(e)}},yt=class extends Ge{constructor(e,t,n,r,i,a){super(r,i),this.delegate=a,this._autoRefresh=!1,this._subscriptionEvent=e,this._subscriptionExpires=t,this._subscriptionExpiresInitial=t,this._subscriptionExpiresLastSet=Math.floor(Date.now()/1e3),this._subscriptionRefresh=void 0,this._subscriptionRefreshLastSet=void 0,this._subscriptionState=n,this.logger=r.loggerFactory.getLogger(`sip.subscribe-dialog`),this.logger.log(`SUBSCRIBE dialog ${this.id} constructed`)}static initialDialogStateForSubscription(e,t){let n=t.getHeaders(`record-route`),r=t.parseHeader(`contact`);if(!r)throw Error(`Contact undefined.`);if(!(r instanceof D))throw Error(`Contact not instance of NameAddrHeader.`);let i=r.uri,a=e.cseq,o=e.callId,s=e.fromTag,c=t.fromTag;if(!o)throw Error(`Call id undefined.`);if(!s)throw Error(`From tag undefined.`);if(!c)throw Error(`To tag undefined.`);if(!e.from)throw Error(`From undefined.`);if(!e.to)throw Error(`To undefined.`);let l=e.from.uri,u=e.to.uri;return{id:o+s+c,early:!1,callId:o,localTag:s,remoteTag:c,localSequenceNumber:a,remoteSequenceNumber:void 0,localURI:l,remoteURI:u,remoteTarget:i,routeSet:n,secure:!1}}dispose(){super.dispose(),this.N&&=(clearTimeout(this.N),void 0),this.refreshTimerClear(),this.logger.log(`SUBSCRIBE dialog ${this.id} destroyed`)}get autoRefresh(){return this._autoRefresh}set autoRefresh(e){this._autoRefresh=!0,this.refreshTimerSet()}get subscriptionEvent(){return this._subscriptionEvent}get subscriptionExpires(){let e=Math.floor(Date.now()/1e3)-this._subscriptionExpiresLastSet,t=this._subscriptionExpires-e;return Math.max(t,0)}set subscriptionExpires(e){if(e<0)throw Error(`Expires must be greater than or equal to zero.`);if(this._subscriptionExpires=e,this._subscriptionExpiresLastSet=Math.floor(Date.now()/1e3),this.autoRefresh){let t=this.subscriptionRefresh;(t===void 0||t>=e)&&this.refreshTimerSet()}}get subscriptionExpiresInitial(){return this._subscriptionExpiresInitial}get subscriptionRefresh(){if(this._subscriptionRefresh===void 0||this._subscriptionRefreshLastSet===void 0)return;let e=Math.floor(Date.now()/1e3)-this._subscriptionRefreshLastSet,t=this._subscriptionRefresh-e;return Math.max(t,0)}get subscriptionState(){return this._subscriptionState}receiveRequest(e){if(this.logger.log(`SUBSCRIBE dialog ${this.id} received ${e.method} request`),!this.sequenceGuard(e)){this.logger.log(`SUBSCRIBE dialog ${this.id} rejected out of order ${e.method} request.`);return}switch(super.receiveRequest(e),e.method){case I.NOTIFY:this.onNotify(e);break;default:this.logger.log(`SUBSCRIBE dialog ${this.id} received unimplemented ${e.method} request`),this.core.replyStateless(e,{statusCode:501});break}}refresh(){let e=`Allow: `+xe.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)}subscribe(e,t={}){if(this.subscriptionState!==z.Pending&&this.subscriptionState!==z.Active)throw Error(`Invalid state ${this.subscriptionState}. May only re-subscribe while in state "pending" or "active".`);this.logger.log(`SUBSCRIBE dialog ${this.id} sending SUBSCRIBE request`);let n=new vt(this,e,t);return this.N&&=(clearTimeout(this.N),void 0),t.extraHeaders?.includes(`Expires: 0`)||(this.N=setTimeout(()=>this.timerN(),F.TIMER_N)),n}terminate(){this.stateTransition(z.Terminated),this.onTerminated()}unsubscribe(){let e=`Allow: `+xe.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)}onNotify(e){let t=e.parseHeader(`Event`).event;if(!t||t!==this.subscriptionEvent){this.core.replyStateless(e,{statusCode:489});return}this.N&&=(clearTimeout(this.N),void 0);let n=e.parseHeader(`Subscription-State`);if(!n||!n.state){this.core.replyStateless(e,{statusCode:489});return}let r=n.state,i=n.expires?Math.max(n.expires,0):void 0;switch(r){case`pending`:this.stateTransition(z.Pending,i);break;case`active`:this.stateTransition(z.Active,i);break;case`terminated`:this.stateTransition(z.Terminated,i);break;default:this.logger.warn(`Unrecognized subscription state.`);break}let a=new it(this,e);this.delegate&&this.delegate.onNotify?this.delegate.onNotify(a):a.accept()}onRefresh(e){this.delegate&&this.delegate.onRefresh&&this.delegate.onRefresh(e)}onTerminated(){this.delegate&&this.delegate.onTerminated&&this.delegate.onTerminated()}refreshTimerClear(){this.refreshTimer&&=(clearTimeout(this.refreshTimer),void 0)}refreshTimerSet(){if(this.refreshTimerClear(),this.autoRefresh&&this.subscriptionExpires>0){let e=this.subscriptionExpires*900;this._subscriptionRefresh=Math.floor(e/1e3),this._subscriptionRefreshLastSet=Math.floor(Date.now()/1e3),this.refreshTimer=setTimeout(()=>{this.refreshTimer=void 0,this._subscriptionRefresh=void 0,this._subscriptionRefreshLastSet=void 0,this.onRefresh(this.refresh())},e)}}stateTransition(e,t){let n=()=>{this.logger.warn(`Invalid subscription state transition from ${this.subscriptionState} to ${e}`)};switch(e){case z.Initial:n();return;case z.NotifyWait:n();return;case z.Pending:if(this.subscriptionState!==z.NotifyWait&&this.subscriptionState!==z.Pending){n();return}break;case z.Active:if(this.subscriptionState!==z.NotifyWait&&this.subscriptionState!==z.Pending&&this.subscriptionState!==z.Active){n();return}break;case z.Terminated:if(this.subscriptionState!==z.NotifyWait&&this.subscriptionState!==z.Pending&&this.subscriptionState!==z.Active){n();return}break;default:n();return}e===z.Pending&&t&&(this.subscriptionExpires=t),e===z.Active&&t&&(this.subscriptionExpires=t),e===z.Terminated&&this.dispose(),this._subscriptionState=e}timerN(){this.logger.warn(`Timer N expired for SUBSCRIBE dialog. Timed out waiting for NOTIFY.`),this.subscriptionState!==z.Terminated&&(this.stateTransition(z.Terminated),this.onTerminated())}},bt=class extends qe{constructor(e,t,n){let r=t.getHeader(`Event`);if(!r)throw Error(`Event undefined`);let i=t.getHeader(`Expires`);if(!i)throw Error(`Expires undefined`);super(We,e,t,n),this.delegate=n,this.subscriberId=t.callId+t.fromTag+r,this.subscriptionExpiresRequested=this.subscriptionExpires=Number(i),this.subscriptionEvent=r,this.subscriptionState=z.NotifyWait,this.waitNotifyStart()}dispose(){super.dispose()}onNotify(e){let t=e.message.parseHeader(`Event`).event;if(!t||t!==this.subscriptionEvent){this.logger.warn(`Failed to parse event.`),e.reject({statusCode:489});return}let n=e.message.parseHeader(`Subscription-State`);if(!n||!n.state){this.logger.warn(`Failed to parse subscription state.`),e.reject({statusCode:489});return}let r=n.state;switch(r){case`pending`:break;case`active`:break;case`terminated`:break;default:this.logger.warn(`Invalid subscription state ${r}`),e.reject({statusCode:489});return}if(r!==`terminated`&&!e.message.parseHeader(`contact`)){this.logger.warn(`Failed to parse contact.`),e.reject({statusCode:489});return}if(this.dialog)throw 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=z.Pending;break;case`active`:this.subscriptionState=z.Active;break;case`terminated`:this.subscriptionState=z.Terminated;break;default:throw Error(`Unrecognized state ${r}.`)}if(this.subscriptionState!==z.Terminated){let t=yt.initialDialogStateForSubscription(this.message,e.message);this.dialog=new yt(this.subscriptionEvent,this.subscriptionExpires,this.subscriptionState,this.core,t)}if(this.delegate&&this.delegate.onNotify){let t=e,n=this.dialog;this.delegate.onNotify({request:t,subscription:n})}else e.accept()}waitNotifyStart(){this.N||=(this.core.subscribers.set(this.subscriberId,this),setTimeout(()=>this.timerN(),F.TIMER_N))}waitNotifyStop(){this.N&&=(this.core.subscribers.delete(this.subscriberId),clearTimeout(this.N),void 0)}receiveResponse(e){if(this.authenticationGuard(e)){if(e.statusCode&&e.statusCode>=200&&e.statusCode<300){let t=e.getHeader(`Expires`);if(!t)this.logger.warn(`Expires header missing in a 200-class response to SUBSCRIBE`);else{let e=Number(t);e>this.subscriptionExpiresRequested&&this.logger.warn(`Expires header in a 200-class response to SUBSCRIBE with a higher value than the one in the request`),e<this.subscriptionExpires&&(this.subscriptionExpires=e)}this.dialog&&this.dialog.subscriptionExpires>this.subscriptionExpires&&(this.dialog.subscriptionExpires=this.subscriptionExpires)}e.statusCode&&e.statusCode>=300&&e.statusCode<700&&this.waitNotifyStop(),super.receiveResponse(e)}}timerN(){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()}},xt=class extends Xe{constructor(e,t,n){super(Ye,e,t,n),this.core=e}},St=[`application/sdp`,`application/dtmf-relay`],Ct=class{constructor(e,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`)}dispose(){this.reset()}reset(){this.dialogs.forEach(e=>e.dispose()),this.dialogs.clear(),this.subscribers.forEach(e=>e.dispose()),this.subscribers.clear(),this.userAgentClients.forEach(e=>e.dispose()),this.userAgentClients.clear(),this.userAgentServers.forEach(e=>e.dispose()),this.userAgentServers.clear()}get loggerFactory(){return this.configuration.loggerFactory}get transport(){let e=this.configuration.transportAccessor();if(!e)throw Error(`Transport undefined.`);return e}invite(e,t){return new pt(this,e,t)}message(e,t){return new et(this,e,t)}publish(e,t){return new ht(this,e,t)}register(e,t){return new gt(this,e,t)}subscribe(e,t){return new bt(this,e,t)}request(e,t){return new qe(We,this,e,t)}makeOutgoingRequestMessage(e,t,n,r,i,a,o){let s=this.configuration.sipjsId,c=this.configuration.displayName,l=this.configuration.viaForceRport,u=this.configuration.hackViaTcp,d=this.configuration.supportedOptionTags.slice();e===I.REGISTER&&d.push(`path`,`gruu`),e===I.INVITE&&(this.configuration.contact.pubGruu||this.configuration.contact.tempGruu)&&d.push(`gruu`);let f={callIdPrefix:s,forceRport:l,fromDisplayName:c,hackViaTcp:u,optionTags:d,routeSet:this.configuration.routeSet,userAgentString:this.configuration.userAgentHeaderFieldValue,viaHost:this.configuration.viaHost};return new N(e,t,n,r,Object.assign(Object.assign({},f),i),a,o)}receiveIncomingRequestFromTransport(e){this.receiveRequestFromTransport(e)}receiveIncomingResponseFromTransport(e){this.receiveResponseFromTransport(e)}replyStateless(e,t){let n=this.configuration.userAgentHeaderFieldValue,r=this.configuration.supportedOptionTagsResponse;t=Object.assign(Object.assign({},t),{userAgent:n,supported:r});let i=Re(e,t);return this.transport.send(i.message).catch(t=>{t instanceof Error&&this.logger.error(t.message),this.logger.error(`Transport error occurred sending stateless reply to ${e.method} request.`)}),i}receiveRequestFromTransport(e){let t=e.viaBranch,n=this.userAgentServers.get(t);if(e.method===I.ACK&&n&&n.transaction.state===H.Accepted&&n instanceof mt){this.logger.warn(`Discarding out of dialog ACK after 2xx response sent on transaction ${t}.`);return}if(e.method===I.CANCEL){n?(this.replyStateless(e,{statusCode:200}),n.transaction instanceof He&&n.transaction.state===H.Proceeding&&n instanceof mt&&n.receiveCancel(e)):this.replyStateless(e,{statusCode:481});return}if(n){n.transaction.receiveRequest(e);return}this.receiveRequest(e)}receiveRequest(e){if(!xe.includes(e.method)){let t=`Allow: `+xe.toString();this.replyStateless(e,{statusCode:405,extraHeaders:[t]});return}if(!e.ruri)throw Error(`Request-URI undefined.`);if(e.ruri.scheme!==`sip`){this.replyStateless(e,{statusCode:416});return}let t=e.ruri,n=e=>!!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))){this.logger.warn(`Request-URI does not point to us.`),e.method!==I.ACK&&this.replyStateless(e,{statusCode:404});return}if(e.method===I.INVITE&&!e.hasHeader(`Contact`)){this.replyStateless(e,{statusCode:400,reasonPhrase:`Missing Contact Header`});return}if(!e.toTag){let t=e.viaBranch;if(!this.userAgentServers.has(t)&&Array.from(this.userAgentServers.values()).some(t=>t.transaction.request.fromTag===e.fromTag&&t.transaction.request.callId===e.callId&&t.transaction.request.cseq===e.cseq)){this.replyStateless(e,{statusCode:482});return}}e.toTag?this.receiveInsideDialogRequest(e):this.receiveOutsideDialogRequest(e)}receiveInsideDialogRequest(e){if(e.method===I.NOTIFY){let t=e.parseHeader(`Event`);if(!t||!t.event){this.replyStateless(e,{statusCode:489});return}let n=e.callId+e.toTag+t.event,r=this.subscribers.get(n);if(r){let t=new it(this,e);r.onNotify(t);return}}let t=e.callId+e.toTag+e.fromTag,n=this.dialogs.get(t);if(n){if(e.method===I.OPTIONS){let t=`Allow: `+xe.toString(),n=`Accept: `+St.toString();this.replyStateless(e,{statusCode:200,extraHeaders:[t,n]});return}n.receiveRequest(e);return}e.method!==I.ACK&&this.replyStateless(e,{statusCode:481})}receiveOutsideDialogRequest(e){switch(e.method){case I.ACK:break;case I.BYE:this.replyStateless(e,{statusCode:481});break;case I.CANCEL:throw Error(`Unexpected out of dialog request method ${e.method}.`);case I.INFO:this.replyStateless(e,{statusCode:405});break;case I.INVITE:{let t=new mt(this,e);this.delegate.onInvite?this.delegate.onInvite(t):t.reject()}break;case I.MESSAGE:{let t=new tt(this,e);this.delegate.onMessage?this.delegate.onMessage(t):t.accept()}break;case I.NOTIFY:{let t=new it(this,e);this.delegate.onNotify?this.delegate.onNotify(t):t.reject({statusCode:405})}break;case I.OPTIONS:{let t=`Allow: `+xe.toString(),n=`Accept: `+St.toString();this.replyStateless(e,{statusCode:200,extraHeaders:[t,n]})}break;case I.REFER:{let t=new dt(this,e);this.delegate.onRefer?this.delegate.onRefer(t):t.reject({statusCode:405})}break;case I.REGISTER:{let t=new _t(this,e);this.delegate.onRegister?this.delegate.onRegister(t):t.reject({statusCode:405})}break;case I.SUBSCRIBE:{let t=new xt(this,e);this.delegate.onSubscribe?this.delegate.onSubscribe(t):t.reject({statusCode:480})}break;default:throw Error(`Unexpected out of dialog request method ${e.method}.`)}}receiveResponseFromTransport(e){if(e.getHeaders(`via`).length>1){this.logger.warn(`More than one Via header field present in the response, dropping`);return}let t=e.viaBranch+e.method,n=this.userAgentClients.get(t);n?n.transaction.receiveResponse(e):this.logger.warn(`Discarding unmatched ${e.statusCode} response to ${e.method} ${t}.`)}};function wt(){return e=>!e.audio&&!e.video?Promise.resolve(new MediaStream):navigator.mediaDevices===void 0?Promise.reject(Error(`Media devices not available in insecure contexts.`)):navigator.mediaDevices.getUserMedia.call(navigator.mediaDevices,e)}function Tt(){return{bundlePolicy:`balanced`,certificates:void 0,iceCandidatePoolSize:0,iceServers:[{urls:`stun:stun.l.google.com:19302`}],iceTransportPolicy:`all`,rtcpMuxPolicy:`require`}}var Et=class e{constructor(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(n?.peerConnectionConfiguration),this.initPeerConnectionEventHandlers()}get localMediaStream(){return this._localMediaStream}get remoteMediaStream(){return this._remoteMediaStream}get dataChannel(){return this._dataChannel}get peerConnection(){return this._peerConnection}get peerConnectionDelegate(){return this._peerConnectionDelegate}set peerConnectionDelegate(e){this._peerConnectionDelegate=e}static dispatchAddTrackEvent(e,t){e.dispatchEvent(new MediaStreamTrackEvent(`addtrack`,{track:t}))}static dispatchRemoveTrackEvent(e,t){e.dispatchEvent(new MediaStreamTrackEvent(`removetrack`,{track:t}))}close(){this.logger.debug(`SessionDescriptionHandler.close`),this._peerConnection!==void 0&&(this._peerConnection.getReceivers().forEach(e=>{e.track&&e.track.stop()}),this._peerConnection.getSenders().forEach(e=>{e.track&&e.track.stop()}),this._dataChannel&&this._dataChannel.close(),this._peerConnection.close(),this._peerConnection=void 0)}enableReceiverTracks(e){let t=this.peerConnection;if(!t)throw Error(`Peer connection closed.`);t.getReceivers().forEach(t=>{t.track&&(t.track.enabled=e)})}enableSenderTracks(e){let t=this.peerConnection;if(!t)throw Error(`Peer connection closed.`);t.getSenders().forEach(t=>{t.track&&(t.track.enabled=e)})}getDescription(e,t){if(this.logger.debug(`SessionDescriptionHandler.getDescription`),this._peerConnection===void 0)return Promise.reject(Error(`Peer connection closed.`));this.onDataChannel=e?.onDataChannel;let n=e?.offerOptions?.iceRestart,r=e?.iceGatheringTimeout===void 0?this.sessionDescriptionHandlerConfiguration?.iceGatheringTimeout:e?.iceGatheringTimeout;return this.getLocalMediaStream(e).then(()=>this.updateDirection(e)).then(()=>this.createDataChannel(e)).then(()=>this.createLocalOfferOrAnswer(e)).then(e=>this.applyModifiers(e,t)).then(e=>this.setLocalSessionDescription(e)).then(()=>this.waitForIceGatheringComplete(n,r)).then(()=>this.getLocalSessionDescription()).then(e=>({body:e.sdp,contentType:`application/sdp`})).catch(e=>{throw this.logger.error(`SessionDescriptionHandler.getDescription failed - `+e),e})}hasDescription(e){return this.logger.debug(`SessionDescriptionHandler.hasDescription`),e===`application/sdp`}iceGatheringComplete(){this.logger.debug(`SessionDescriptionHandler.iceGatheringComplete`),this.iceGatheringCompleteTimeoutId!==void 0&&(this.logger.debug(`SessionDescriptionHandler.iceGatheringComplete - clearing timeout`),clearTimeout(this.iceGatheringCompleteTimeoutId),this.iceGatheringCompleteTimeoutId=void 0),this.iceGatheringCompletePromise!==void 0&&(this.logger.debug(`SessionDescriptionHandler.iceGatheringComplete - resolving promise`),this.iceGatheringCompleteResolve&&this.iceGatheringCompleteResolve(),this.iceGatheringCompletePromise=void 0,this.iceGatheringCompleteResolve=void 0,this.iceGatheringCompleteReject=void 0)}sendDtmf(e,t){if(this.logger.debug(`SessionDescriptionHandler.sendDtmf`),this._peerConnection===void 0)return this.logger.error(`SessionDescriptionHandler.sendDtmf failed - peer connection closed`),!1;let n=this._peerConnection.getSenders();if(n.length===0)return this.logger.error(`SessionDescriptionHandler.sendDtmf failed - no senders`),!1;let r=n[0].dtmf;if(!r)return this.logger.error(`SessionDescriptionHandler.sendDtmf failed - no DTMF sender`),!1;let i=t?.duration,a=t?.interToneGap;try{r.insertDTMF(e,i,a)}catch(e){return this.logger.error(e.toString()),!1}return this.logger.log(`SessionDescriptionHandler.sendDtmf sent via RTP: `+e.toString()),!0}setDescription(e,t,n){if(this.logger.debug(`SessionDescriptionHandler.setDescription`),this._peerConnection===void 0)return Promise.reject(Error(`Peer connection closed.`));this.onDataChannel=t?.onDataChannel;let r=this._peerConnection.signalingState===`have-local-offer`?`answer`:`offer`;return this.getLocalMediaStream(t).then(()=>this.applyModifiers({sdp:e,type:r},n)).then(e=>this.setRemoteSessionDescription(e)).catch(e=>{throw this.logger.error(`SessionDescriptionHandler.setDescription failed - `+e),e})}applyModifiers(e,t){return this.logger.debug(`SessionDescriptionHandler.applyModifiers`),!t||t.length===0?Promise.resolve(e):t.reduce((e,t)=>e.then(t),Promise.resolve(e)).then(e=>{if(this.logger.debug(`SessionDescriptionHandler.applyModifiers - modified sdp`),!e.sdp||!e.type)throw Error(`Invalid SDP.`);return{sdp:e.sdp,type:e.type}})}createDataChannel(e){if(this._peerConnection===void 0)return Promise.reject(Error(`Peer connection closed.`));if(e?.dataChannel!==!0||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(e?.dataChannelLabel||``,e?.dataChannelOptions),this.onDataChannel&&this.onDataChannel(this._dataChannel),Promise.resolve()}catch(e){return Promise.reject(e)}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(Error(`Invalid signaling state `+this._peerConnection.signalingState))}}createLocalOfferOrAnswer(e){if(this._peerConnection===void 0)return Promise.reject(Error(`Peer connection closed.`));switch(this._peerConnection.signalingState){case`stable`:return this.logger.debug(`SessionDescriptionHandler.createLocalOfferOrAnswer - creating SDP offer`),this._peerConnection.createOffer(e?.offerOptions);case`have-remote-offer`:return this.logger.debug(`SessionDescriptionHandler.createLocalOfferOrAnswer - creating SDP answer`),this._peerConnection.createAnswer(e?.answerOptions);case`have-local-offer`:case`have-local-pranswer`:case`have-remote-pranswer`:case`closed`:default:return Promise.reject(Error(`Invalid signaling state `+this._peerConnection.signalingState))}}getLocalMediaStream(e){if(this.logger.debug(`SessionDescriptionHandler.getLocalMediaStream`),this._peerConnection===void 0)return Promise.reject(Error(`Peer connection closed.`));let t=Object.assign({},e?.constraints);if(this.localMediaStreamConstraints){if(t.audio=t.audio||this.localMediaStreamConstraints.audio,t.video=t.video||this.localMediaStreamConstraints.video,JSON.stringify(this.localMediaStreamConstraints.audio)===JSON.stringify(t.audio)&&JSON.stringify(this.localMediaStreamConstraints.video)===JSON.stringify(t.video))return Promise.resolve()}else t.audio===void 0&&t.video===void 0&&(t={audio:!0});return this.localMediaStreamConstraints=t,this.mediaStreamFactory(t,this,e).then(e=>this.setLocalMediaStream(e))}setLocalMediaStream(t){if(this.logger.debug(`SessionDescriptionHandler.setLocalMediaStream`),!this._peerConnection)throw Error(`Peer connection undefined.`);let n=this._peerConnection,r=this._localMediaStream,i=[],a=t=>{let a=t.kind;if(a!==`audio`&&a!==`video`)throw Error(`Unknown new track kind ${a}.`);let o=n.getSenders().find(e=>e.track&&e.track.kind===a);o?i.push(new Promise(e=>{this.logger.debug(`SessionDescriptionHandler.setLocalMediaStream - replacing sender ${a} track`),e()}).then(()=>o.replaceTrack(t).then(()=>{let n=r.getTracks().find(e=>e.kind===a);n&&(n.stop(),r.removeTrack(n),e.dispatchRemoveTrackEvent(r,n)),r.addTrack(t),e.dispatchAddTrackEvent(r,t)}).catch(e=>{throw this.logger.error(`SessionDescriptionHandler.setLocalMediaStream - failed to replace sender ${a} track`),e}))):i.push(new Promise(e=>{this.logger.debug(`SessionDescriptionHandler.setLocalMediaStream - adding sender ${a} track`),e()}).then(()=>{try{n.addTrack(t,r)}catch(e){throw this.logger.error(`SessionDescriptionHandler.setLocalMediaStream - failed to add sender ${a} track`),e}r.addTrack(t),e.dispatchAddTrackEvent(r,t)}))},o=t.getAudioTracks();o.length&&a(o[0]);let s=t.getVideoTracks();return s.length&&a(s[0]),i.reduce((e,t)=>e.then(()=>t),Promise.resolve())}getLocalSessionDescription(){if(this.logger.debug(`SessionDescriptionHandler.getLocalSessionDescription`),this._peerConnection===void 0)return Promise.reject(Error(`Peer connection closed.`));let e=this._peerConnection.localDescription;return e?Promise.resolve(e):Promise.reject(Error(`Failed to get local session description`))}setLocalSessionDescription(e){return this.logger.debug(`SessionDescriptionHandler.setLocalSessionDescription`),this._peerConnection===void 0?Promise.reject(Error(`Peer connection closed.`)):this._peerConnection.setLocalDescription(e)}setRemoteSessionDescription(e){if(this.logger.debug(`SessionDescriptionHandler.setRemoteSessionDescription`),this._peerConnection===void 0)return Promise.reject(Error(`Peer connection closed.`));let t=e.sdp,n;switch(this._peerConnection.signalingState){case`stable`:n=`offer`;break;case`have-local-offer`:n=`answer`;break;case`have-local-pranswer`:case`have-remote-offer`:case`have-remote-pranswer`:case`closed`:default:return Promise.reject(Error(`Invalid signaling state `+this._peerConnection.signalingState))}return t?this._peerConnection.setRemoteDescription({sdp:t,type:n}):(this.logger.error(`SessionDescriptionHandler.setRemoteSessionDescription failed - cannot set null sdp`),Promise.reject(Error(`SDP is undefined`)))}setRemoteTrack(t){this.logger.debug(`SessionDescriptionHandler.setRemoteTrack`);let n=this._remoteMediaStream;n.getTrackById(t.id)?this.logger.debug(`SessionDescriptionHandler.setRemoteTrack - have remote ${t.kind} track`):t.kind===`audio`?(this.logger.debug(`SessionDescriptionHandler.setRemoteTrack - adding remote ${t.kind} track`),n.getAudioTracks().forEach(t=>{t.stop(),n.removeTrack(t),e.dispatchRemoveTrackEvent(n,t)}),n.addTrack(t),e.dispatchAddTrackEvent(n,t)):t.kind===`video`&&(this.logger.debug(`SessionDescriptionHandler.setRemoteTrack - adding remote ${t.kind} track`),n.getVideoTracks().forEach(t=>{t.stop(),n.removeTrack(t),e.dispatchRemoveTrackEvent(n,t)}),n.addTrack(t),e.dispatchAddTrackEvent(n,t))}updateDirection(e){if(this._peerConnection===void 0)return Promise.reject(Error(`Peer connection closed.`));switch(this._peerConnection.signalingState){case`stable`:this.logger.debug(`SessionDescriptionHandler.updateDirection - setting offer direction`);{let t=t=>{switch(t){case`inactive`:return e?.hold?`inactive`:`recvonly`;case`recvonly`:return e?.hold?`inactive`:`recvonly`;case`sendonly`:return e?.hold?`sendonly`:`sendrecv`;case`sendrecv`:return e?.hold?`sendonly`:`sendrecv`;case`stopped`:return`stopped`;default:throw Error(`Should never happen`)}};this._peerConnection.getTransceivers().forEach(e=>{if(e.direction){let n=t(e.direction);e.direction!==n&&(e.direction=n)}})}break;case`have-remote-offer`:this.logger.debug(`SessionDescriptionHandler.updateDirection - setting answer direction`);{let t=(()=>{let e=this._peerConnection.remoteDescription;if(!e)throw Error(`Failed to read remote offer`);let t=/a=sendrecv\r\n|a=sendonly\r\n|a=recvonly\r\n|a=inactive\r\n/.exec(e.sdp);if(t)switch(t[0]){case`a=inactive\r
42
+ `,this.send(c).catch(e=>{this.logTransportError(e,`Failed to send ACK to non-2xx response.`)})}stateTransition(e,t=!1){let n=()=>{throw Error(`Invalid state transition from ${this.state} to ${e}`)};switch(e){case H.Calling:n();break;case H.Proceeding:this.state!==H.Calling&&n();break;case H.Accepted:case H.Completed:this.state!==H.Calling&&this.state!==H.Proceeding&&n();break;case H.Terminated:this.state!==H.Calling&&this.state!==H.Accepted&&this.state!==H.Completed&&(t||n());break;default:n()}this.B&&=(clearTimeout(this.B),void 0),H.Proceeding,e===H.Completed&&(this.D=setTimeout(()=>this.timerD(),I.TIMER_D)),e===H.Accepted&&(this.M=setTimeout(()=>this.timerM(),I.TIMER_M)),e===H.Terminated&&this.dispose(),this.setState(e)}timerA(){}timerB(){this.logger.debug(`Timer B expired for INVITE client transaction ${this.id}.`),this.state===H.Calling&&(this.onRequestTimeout(),this.stateTransition(H.Terminated))}timerD(){this.logger.debug(`Timer D expired for INVITE client transaction ${this.id}.`),this.state===H.Completed&&this.stateTransition(H.Terminated)}timerM(){this.logger.debug(`Timer M expired for INVITE client transaction ${this.id}.`),this.state===H.Accepted&&this.stateTransition(H.Terminated)}},qe=class e{constructor(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()}dispose(){this.transaction.dispose()}get loggerFactory(){return this.core.loggerFactory}get transaction(){if(!this._transaction)throw Error(`Transaction undefined.`);return this._transaction}cancel(t,n={}){if(!this.transaction)throw Error(`Transaction undefined.`);if(!this.message.to)throw Error(`To undefined.`);if(!this.message.from)throw Error(`From undefined.`);let r=this.core.makeOutgoingRequestMessage(L.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 r.branch=this.message.branch,this.message.headers.Route&&(r.headers.Route=this.message.headers.Route),t&&r.setHeader(`Reason`,t),this.transaction.state===H.Proceeding?new e(We,this.core,r):this.transaction.addStateChangeListener(()=>{this.transaction&&this.transaction.state===H.Proceeding&&new e(We,this.core,r)},{once:!0}),r}authenticationGuard(e,t){let n=e.statusCode;if(!n)throw Error(`Response status code undefined.`);if(n!==401&&n!==407)return!0;let r,i;if(n===401?(r=e.parseHeader(`www-authenticate`),i=`authorization`):(r=e.parseHeader(`proxy-authenticate`),i=`proxy-authorization`),!r)return this.logger.warn(n+` with wrong or missing challenge, cannot authenticate`),!0;if(this.challenged&&(this.stale||r.stale!==!0))return this.logger.warn(n+` 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,r))return!0;this.challenged=!0,r.stale&&(this.stale=!0);let a=this.message.cseq+=1;return t&&t.localSequenceNumber&&(t.incrementLocalSequenceNumber(),a=this.message.cseq=t.localSequenceNumber),this.message.setHeader(`cseq`,a+` `+this.message.method),this.message.setHeader(i,this.credentials.toString()),this.init(),!1}onRequestTimeout(){this.logger.warn(`User agent client request timed out. Generating internal 408 Request Timeout.`);let e=new ue;e.statusCode=408,e.reasonPhrase=`Request Timeout`,this.receiveResponse(e)}onTransportError(e){this.logger.error(e.message),this.logger.error(`User agent client request transport error. Generating internal 503 Service Unavailable.`);let t=new ue;t.statusCode=503,t.reasonPhrase=`Service Unavailable`,this.receiveResponse(t)}receiveResponse(e){if(!this.authenticationGuard(e))return;let t=e.statusCode?e.statusCode.toString():``;if(!t)throw 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 Error(`Invalid status code ${t}`)}}init(){let e={loggerFactory:this.loggerFactory,onRequestTimeout:()=>this.onRequestTimeout(),onStateChange:e=>{e===H.Terminated&&(this.core.userAgentClients.delete(n),t===this._transaction&&this.dispose())},onTransportError:e=>this.onTransportError(e),receiveResponse:e=>this.receiveResponse(e)},t=new this.transactionConstructor(this.message,this.core.transport,e);this._transaction=t;let n=t.id+t.request.method;this.core.userAgentClients.set(n,this)}},Je=class extends qe{constructor(e,t,n){let r=e.createOutgoingRequestMessage(L.BYE,n);super(We,e.userAgentCore,r,t),e.dispose()}},Ye=class extends Ve{constructor(e,t,n){super(e,t,n,H.Trying,`sip.transaction.nist`)}dispose(){this.J&&=(clearTimeout(this.J),void 0),super.dispose()}get kind(){return`nist`}receiveRequest(e){switch(this.state){case H.Trying:break;case H.Proceeding:if(!this.lastResponse)throw Error(`Last response undefined.`);this.send(this.lastResponse).catch(e=>{this.logTransportError(e,`Failed to send retransmission of provisional response.`)});break;case H.Completed:if(!this.lastResponse)throw Error(`Last response undefined.`);this.send(this.lastResponse).catch(e=>{this.logTransportError(e,`Failed to send retransmission of final response.`)});break;case H.Terminated:break;default:throw Error(`Invalid state ${this.state}`)}}receiveResponse(e,t){if(e<100||e>699)throw Error(`Invalid status code ${e}`);if(e>100&&e<=199)throw Error(`Provisional response other than 100 not allowed.`);switch(this.state){case H.Trying:if(this.lastResponse=t,e>=100&&e<200){this.stateTransition(H.Proceeding),this.send(t).catch(e=>{this.logTransportError(e,`Failed to send provisional response.`)});return}if(e>=200&&e<=699){this.stateTransition(H.Completed),this.send(t).catch(e=>{this.logTransportError(e,`Failed to send final response.`)});return}break;case H.Proceeding:if(this.lastResponse=t,e>=200&&e<=699){this.stateTransition(H.Completed),this.send(t).catch(e=>{this.logTransportError(e,`Failed to send final response.`)});return}break;case H.Completed:return;case H.Terminated:break;default:throw Error(`Invalid state ${this.state}`)}let n=`Non-INVITE server transaction received unexpected ${e} response from TU while in state ${this.state}.`;throw this.logger.error(n),Error(n)}onTransportError(e){this.user.onTransportError&&this.user.onTransportError(e),this.stateTransition(H.Terminated,!0)}typeToString(){return`non-INVITE server transaction`}stateTransition(e,t=!1){let n=()=>{throw Error(`Invalid state transition from ${this.state} to ${e}`)};switch(e){case H.Trying:n();break;case H.Proceeding:this.state!==H.Trying&&n();break;case H.Completed:this.state!==H.Trying&&this.state!==H.Proceeding&&n();break;case H.Terminated:this.state!==H.Proceeding&&this.state!==H.Completed&&(t||n());break;default:n()}e===H.Completed&&(this.J=setTimeout(()=>this.timerJ(),I.TIMER_J)),e===H.Terminated&&this.dispose(),this.setState(e)}timerJ(){this.logger.debug(`Timer J expired for NON-INVITE server transaction ${this.id}.`),this.state===H.Completed&&this.stateTransition(H.Terminated)}},Xe=class{constructor(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:se(),this.init()}dispose(){this.transaction.dispose()}get loggerFactory(){return this.core.loggerFactory}get transaction(){if(!this._transaction)throw Error(`Transaction undefined.`);return this._transaction}accept(e={statusCode:200}){if(!this.acceptable)throw new ye(`${this.message.method} not acceptable in state ${this.transaction.state}.`);let t=e.statusCode;if(t<200||t>299)throw TypeError(`Invalid statusCode: ${t}`);return this.reply(e)}progress(e={statusCode:180}){if(!this.progressable)throw new ye(`${this.message.method} not progressable in state ${this.transaction.state}.`);let t=e.statusCode;if(t<101||t>199)throw TypeError(`Invalid statusCode: ${t}`);return this.reply(e)}redirect(e,t={statusCode:302}){if(!this.redirectable)throw new ye(`${this.message.method} not redirectable in state ${this.transaction.state}.`);let n=t.statusCode;if(n<300||n>399)throw TypeError(`Invalid statusCode: ${n}`);let r=[];return e.forEach(e=>r.push(`Contact: ${e.toString()}`)),t.extraHeaders=(t.extraHeaders||[]).concat(r),this.reply(t)}reject(e={statusCode:480}){if(!this.rejectable)throw new ye(`${this.message.method} not rejectable in state ${this.transaction.state}.`);let t=e.statusCode;if(t<400||t>699)throw TypeError(`Invalid statusCode: ${t}`);return this.reply(e)}trying(e){if(!this.tryingable)throw new ye(`${this.message.method} not tryingable in state ${this.transaction.state}.`);return this.reply({statusCode:100})}receiveCancel(e){this.delegate&&this.delegate.onCancel&&this.delegate.onCancel(e)}get acceptable(){if(this.transaction instanceof He)return this.transaction.state===H.Proceeding||this.transaction.state===H.Accepted;if(this.transaction instanceof Ye)return this.transaction.state===H.Trying||this.transaction.state===H.Proceeding;throw Error(`Unknown transaction type.`)}get progressable(){if(this.transaction instanceof He)return this.transaction.state===H.Proceeding;if(this.transaction instanceof Ye)return!1;throw Error(`Unknown transaction type.`)}get redirectable(){if(this.transaction instanceof He)return this.transaction.state===H.Proceeding;if(this.transaction instanceof Ye)return this.transaction.state===H.Trying||this.transaction.state===H.Proceeding;throw Error(`Unknown transaction type.`)}get rejectable(){if(this.transaction instanceof He)return this.transaction.state===H.Proceeding;if(this.transaction instanceof Ye)return this.transaction.state===H.Trying||this.transaction.state===H.Proceeding;throw Error(`Unknown transaction type.`)}get tryingable(){if(this.transaction instanceof He)return this.transaction.state===H.Proceeding;if(this.transaction instanceof Ye)return this.transaction.state===H.Trying;throw Error(`Unknown transaction type.`)}reply(e){!e.toTag&&e.statusCode!==100&&(e.toTag=this.toTag),e.userAgent=e.userAgent||this.core.configuration.userAgentHeaderFieldValue,e.supported=e.supported||this.core.configuration.supportedOptionTagsResponse;let t=Re(this.message,e);return this.transaction.receiveResponse(e.statusCode,t.message),t}init(){let e={loggerFactory:this.loggerFactory,onStateChange:e=>{e===H.Terminated&&(this.core.userAgentServers.delete(n),this.dispose())},onTransportError:e=>{this.logger.error(e.message),this.delegate&&this.delegate.onTransportError?this.delegate.onTransportError(e):this.logger.error(`User agent server response transport error.`)}},t=new this.transactionConstructor(this.message,this.core.transport,e);this._transaction=t;let n=t.id;this.core.userAgentServers.set(t.id,this)}},Ze=class extends Xe{constructor(e,t,n){super(Ye,e.userAgentCore,t,n)}},Qe=class extends qe{constructor(e,t,n){let r=e.createOutgoingRequestMessage(L.INFO,n);super(We,e.userAgentCore,r,t)}},$e=class extends Xe{constructor(e,t,n){super(Ye,e.userAgentCore,t,n)}},et=class extends qe{constructor(e,t,n){super(We,e,t,n)}},tt=class extends Xe{constructor(e,t,n){super(Ye,e,t,n)}},nt=class extends qe{constructor(e,t,n){let r=e.createOutgoingRequestMessage(L.NOTIFY,n);super(We,e.userAgentCore,r,t)}};function rt(e){return e.userAgentCore!==void 0}var it=class extends Xe{constructor(e,t,n){let r=rt(e)?e.userAgentCore:e;super(Ye,r,t,n)}},at=class extends qe{constructor(e,t,n){let r=e.createOutgoingRequestMessage(L.PRACK,n);super(We,e.userAgentCore,r,t),e.signalingStateTransition(r)}},ot=class extends Xe{constructor(e,t,n){super(Ye,e.userAgentCore,t,n),e.signalingStateTransition(t),this.dialog=e}accept(e={statusCode:200}){return e.body&&this.dialog.signalingStateTransition(e.body),super.accept(e)}},st=class extends qe{constructor(e,t,n){let r=e.createOutgoingRequestMessage(L.INVITE,n);super(Ke,e.userAgentCore,r,t),this.delegate=t,e.signalingStateTransition(r),e.reinviteUserAgentClient=this,this.dialog=e}receiveResponse(e){if(!this.authenticationGuard(e,this.dialog))return;let t=e.statusCode?e.statusCode.toString():``;if(!t)throw 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,session:this.dialog,prack:e=>{throw Error(`Unimplemented.`)}});break;case/^2[0-9]{2}$/.test(t):this.dialog.signalingStateTransition(e),this.delegate&&this.delegate.onAccept&&this.delegate.onAccept({message:e,session:this.dialog,ack:e=>this.dialog.ack(e)});break;case/^3[0-9]{2}$/.test(t):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(t):this.dialog.signalingStateRollback(),this.dialog.reinviteUserAgentClient=void 0,this.delegate&&this.delegate.onReject&&this.delegate.onReject({message:e});break;default:throw Error(`Invalid status code ${t}`)}}},ct=class extends Xe{constructor(e,t,n){super(He,e.userAgentCore,t,n),e.reinviteUserAgentServer=this,this.dialog=e}accept(e={statusCode:200}){e.extraHeaders=e.extraHeaders||[],e.extraHeaders=e.extraHeaders.concat(this.dialog.routeSet.map(e=>`Record-Route: ${e}`));let t=super.accept(e),n=this.dialog,r=Object.assign(Object.assign({},t),{session:n});return e.body&&this.dialog.signalingStateTransition(e.body),this.dialog.reConfirm(),r}progress(e={statusCode:180}){let t=super.progress(e),n=this.dialog,r=Object.assign(Object.assign({},t),{session:n});return e.body&&this.dialog.signalingStateTransition(e.body),r}redirect(e,t={statusCode:302}){throw this.dialog.signalingStateRollback(),this.dialog.reinviteUserAgentServer=void 0,Error(`Unimplemented.`)}reject(e={statusCode:488}){return this.dialog.signalingStateRollback(),this.dialog.reinviteUserAgentServer=void 0,super.reject(e)}},lt=class extends qe{constructor(e,t,n){let r=e.createOutgoingRequestMessage(L.REFER,n);super(We,e.userAgentCore,r,t)}};function ut(e){return e.userAgentCore!==void 0}var dt=class extends Xe{constructor(e,t,n){let r=ut(e)?e.userAgentCore:e;super(Ye,r,t,n)}},ft=class extends Ge{constructor(e,t,n,r){super(t,n),this.initialTransaction=e,this._signalingState=F.Initial,this.ackWait=!1,this.ackProcessing=!1,this.delegate=r,e instanceof He&&(this.ackWait=!0),this.early||this.start2xxRetransmissionTimer(),this.signalingStateTransition(e.request),this.logger=t.loggerFactory.getLogger(`sip.invite-dialog`),this.logger.log(`INVITE dialog ${this.id} constructed`)}dispose(){super.dispose(),this._signalingState=F.Closed,this._offer=void 0,this._answer=void 0,this.invite2xxTimer&&=(clearTimeout(this.invite2xxTimer),void 0),this.logger.log(`INVITE dialog ${this.id} destroyed`)}get sessionState(){return this.early?he.Early:this.ackWait?he.AckWait:this._signalingState===F.Closed?he.Terminated:he.Confirmed}get signalingState(){return this._signalingState}get offer(){return this._offer}get answer(){return this._answer}confirm(){this.early&&this.start2xxRetransmissionTimer(),super.confirm()}reConfirm(){this.reinviteUserAgentServer&&this.startReInvite2xxRetransmissionTimer()}ack(e={}){this.logger.log(`INVITE dialog ${this.id} sending ACK request`);let t;if(this.reinviteUserAgentClient){if(!(this.reinviteUserAgentClient.transaction instanceof Ke))throw Error(`Transaction not instance of InviteClientTransaction.`);t=this.reinviteUserAgentClient.transaction,this.reinviteUserAgentClient=void 0}else{if(!(this.initialTransaction instanceof Ke))throw Error(`Initial transaction not instance of InviteClientTransaction.`);t=this.initialTransaction}let n=this.createOutgoingRequestMessage(L.ACK,{cseq:t.request.cseq,extraHeaders:e.extraHeaders,body:e.body});return t.ackResponse(n),this.signalingStateTransition(n),{message:n}}bye(e,t){if(this.logger.log(`INVITE dialog ${this.id} sending BYE request`),this.initialTransaction instanceof He){if(this.early)throw Error(`UAS MUST NOT send a BYE on early dialogs.`);if(this.ackWait&&this.initialTransaction.state!==H.Terminated)throw 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 Je(this,e,t)}info(e,t){if(this.logger.log(`INVITE dialog ${this.id} sending INFO request`),this.early)throw Error(`Dialog not confirmed.`);return new Qe(this,e,t)}invite(e,t){if(this.logger.log(`INVITE dialog ${this.id} sending INVITE request`),this.early)throw Error(`Dialog not confirmed.`);if(this.reinviteUserAgentClient)throw Error(`There is an ongoing re-INVITE client transaction.`);if(this.reinviteUserAgentServer)throw Error(`There is an ongoing re-INVITE server transaction.`);return new st(this,e,t)}message(e,t){if(this.logger.log(`INVITE dialog ${this.id} sending MESSAGE request`),this.early)throw Error(`Dialog not confirmed.`);let n=this.createOutgoingRequestMessage(L.MESSAGE,t);return new et(this.core,n,e)}notify(e,t){if(this.logger.log(`INVITE dialog ${this.id} sending NOTIFY request`),this.early)throw Error(`Dialog not confirmed.`);return new nt(this,e,t)}prack(e,t){return this.logger.log(`INVITE dialog ${this.id} sending PRACK request`),new at(this,e,t)}refer(e,t){if(this.logger.log(`INVITE dialog ${this.id} sending REFER request`),this.early)throw Error(`Dialog not confirmed.`);return new lt(this,e,t)}receiveRequest(e){if(this.logger.log(`INVITE dialog ${this.id} received ${e.method} request`),e.method===L.ACK){if(this.ackWait){if(this.initialTransaction instanceof Ke){this.logger.warn(`INVITE dialog ${this.id} received unexpected ${e.method} request, dropping.`);return}if(this.initialTransaction.request.cseq!==e.cseq){this.logger.warn(`INVITE dialog ${this.id} received unexpected ${e.method} request, dropping.`);return}this.ackWait=!1}else{if(!this.reinviteUserAgentServer){this.logger.warn(`INVITE dialog ${this.id} received unexpected ${e.method} request, dropping.`);return}if(this.reinviteUserAgentServer.transaction.request.cseq!==e.cseq){this.logger.warn(`INVITE dialog ${this.id} received unexpected ${e.method} request, dropping.`);return}this.reinviteUserAgentServer=void 0}if(this.signalingStateTransition(e),this.delegate&&this.delegate.onAck){let t=this.delegate.onAck({message:e});t instanceof Promise&&(this.ackProcessing=!0,t.then(()=>this.ackProcessing=!1).catch(()=>this.ackProcessing=!1))}return}if(!this.sequenceGuard(e)){this.logger.log(`INVITE dialog ${this.id} rejected out of order ${e.method} request.`);return}if(super.receiveRequest(e),e.method===L.INVITE){let t=()=>{let e=this.ackWait?`waiting for initial ACK`:`processing initial ACK`;this.logger.warn(`INVITE dialog ${this.id} received re-INVITE while ${e}`);let 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.`,this.logger.warn(t)},n=[`Retry-After: ${Math.floor(Math.random()*10)+1}`];if(this.ackProcessing){this.core.replyStateless(e,{statusCode:500,extraHeaders:n}),t();return}if(this.ackWait&&this.signalingState!==F.Stable){this.core.replyStateless(e,{statusCode:500,extraHeaders:n}),t();return}if(this.reinviteUserAgentServer){this.core.replyStateless(e,{statusCode:500,extraHeaders:n});return}if(this.reinviteUserAgentClient){this.core.replyStateless(e,{statusCode:491});return}}if(e.method===L.INVITE){let t=e.parseHeader(`contact`);if(!t)throw Error(`Contact undefined.`);if(!(t instanceof D))throw Error(`Contact not instance of NameAddrHeader.`);this.dialogState.remoteTarget=t.uri}switch(e.method){case L.BYE:{let t=new Ze(this,e);this.delegate&&this.delegate.onBye?this.delegate.onBye(t):t.accept(),this.dispose()}break;case L.INFO:{let t=new $e(this,e);this.delegate&&this.delegate.onInfo?this.delegate.onInfo(t):t.reject({statusCode:469,extraHeaders:[`Recv-Info:`]})}break;case L.INVITE:{let t=new ct(this,e);this.signalingStateTransition(e),this.delegate&&this.delegate.onInvite?this.delegate.onInvite(t):t.reject({statusCode:488})}break;case L.MESSAGE:{let t=new tt(this.core,e);this.delegate&&this.delegate.onMessage?this.delegate.onMessage(t):t.accept()}break;case L.NOTIFY:{let t=new it(this,e);this.delegate&&this.delegate.onNotify?this.delegate.onNotify(t):t.accept()}break;case L.PRACK:{let t=new ot(this,e);this.delegate&&this.delegate.onPrack?this.delegate.onPrack(t):t.accept()}break;case L.REFER:{let t=new dt(this,e);this.delegate&&this.delegate.onRefer?this.delegate.onRefer(t):t.reject()}break;default:this.logger.log(`INVITE dialog ${this.id} received unimplemented ${e.method} request`),this.core.replyStateless(e,{statusCode:501});break}}reliableSequenceGuard(e){let t=e.statusCode;if(!t)throw Error(`Status code undefined`);if(t>100&&t<200){let t=e.getHeader(`require`),n=e.getHeader(`rseq`),r=t&&t.includes(`100rel`)&&n?Number(n):void 0;if(r){if(this.rseq&&this.rseq+1!==r)return!1;this.rseq=this.rseq?this.rseq+1:r}}return!0}signalingStateRollback(){(this._signalingState===F.HaveLocalOffer||this.signalingState===F.HaveRemoteOffer)&&this._rollbackOffer&&this._rollbackAnswer&&(this._signalingState=F.Stable,this._offer=this._rollbackOffer,this._answer=this._rollbackAnswer)}signalingStateTransition(e){let t=me(e);if(!(!t||t.contentDisposition!==`session`)){if(this._signalingState===F.Stable&&(this._rollbackOffer=this._offer,this._rollbackAnswer=this._answer),e instanceof le)switch(this._signalingState){case F.Initial:case F.Stable:this._signalingState=F.HaveRemoteOffer,this._offer=t,this._answer=void 0;break;case F.HaveLocalOffer:this._signalingState=F.Stable,this._answer=t;break;case F.HaveRemoteOffer:break;case F.Closed:break;default:throw Error(`Unexpected signaling state.`)}if(e instanceof ue)switch(this._signalingState){case F.Initial:case F.Stable:this._signalingState=F.HaveRemoteOffer,this._offer=t,this._answer=void 0;break;case F.HaveLocalOffer:this._signalingState=F.Stable,this._answer=t;break;case F.HaveRemoteOffer:break;case F.Closed:break;default:throw Error(`Unexpected signaling state.`)}if(e instanceof P)switch(this._signalingState){case F.Initial:case F.Stable:this._signalingState=F.HaveLocalOffer,this._offer=t,this._answer=void 0;break;case F.HaveLocalOffer:break;case F.HaveRemoteOffer:this._signalingState=F.Stable,this._answer=t;break;case F.Closed:break;default:throw Error(`Unexpected signaling state.`)}if(pe(e))switch(this._signalingState){case F.Initial:case F.Stable:this._signalingState=F.HaveLocalOffer,this._offer=t,this._answer=void 0;break;case F.HaveLocalOffer:break;case F.HaveRemoteOffer:this._signalingState=F.Stable,this._answer=t;break;case F.Closed:break;default:throw Error(`Unexpected signaling state.`)}}}start2xxRetransmissionTimer(){if(this.initialTransaction instanceof He){let e=this.initialTransaction,t=I.T1,n=()=>{if(!this.ackWait){this.invite2xxTimer=void 0;return}this.logger.log(`No ACK for 2xx response received, attempting retransmission`),e.retransmitAcceptedResponse(),t=Math.min(t*2,I.T2),this.invite2xxTimer=setTimeout(n,t)};this.invite2xxTimer=setTimeout(n,t);let r=()=>{e.state===H.Terminated&&(e.removeStateChangeListener(r),this.invite2xxTimer&&=(clearTimeout(this.invite2xxTimer),void 0),this.ackWait&&(this.delegate&&this.delegate.onAckTimeout?this.delegate.onAckTimeout():this.bye()))};e.addStateChangeListener(r)}}startReInvite2xxRetransmissionTimer(){if(this.reinviteUserAgentServer&&this.reinviteUserAgentServer.transaction instanceof He){let e=this.reinviteUserAgentServer.transaction,t=I.T1,n=()=>{if(!this.reinviteUserAgentServer){this.invite2xxTimer=void 0;return}this.logger.log(`No ACK for 2xx response received, attempting retransmission`),e.retransmitAcceptedResponse(),t=Math.min(t*2,I.T2),this.invite2xxTimer=setTimeout(n,t)};this.invite2xxTimer=setTimeout(n,t);let r=()=>{e.state===H.Terminated&&(e.removeStateChangeListener(r),this.invite2xxTimer&&=(clearTimeout(this.invite2xxTimer),void 0),this.reinviteUserAgentServer)};e.addStateChangeListener(r)}}},pt=class extends qe{constructor(e,t,n){super(Ke,e,t,n),this.confirmedDialogAcks=new Map,this.confirmedDialogs=new Map,this.earlyDialogs=new Map,this.delegate=n}dispose(){this.earlyDialogs.forEach(e=>e.dispose()),this.earlyDialogs.clear(),super.dispose()}onTransportError(e){if(this.transaction.state===H.Calling)return super.onTransportError(e);this.logger.error(e.message),this.logger.error(`User agent client request transport error while sending ACK.`)}receiveResponse(e){if(!this.authenticationGuard(e))return;let t=e.statusCode?e.statusCode.toString():``;if(!t)throw Error(`Response status code undefined.`);switch(!0){case/^100$/.test(t):this.delegate&&this.delegate.onTrying&&this.delegate.onTrying({message:e});return;case/^1[0-9]{2}$/.test(t):{if(!e.toTag){this.logger.warn(`Non-100 1xx INVITE response received without a to tag, dropping.`);return}if(!e.parseHeader(`contact`)){this.logger.error(`Non-100 1xx INVITE response received without a Contact header field, dropping.`);return}let t=Ge.initialDialogStateForUserAgentClient(this.message,e),n=this.earlyDialogs.get(t.id);if(!n){let e=this.transaction;if(!(e instanceof Ke))throw Error(`Transaction not instance of InviteClientTransaction.`);n=new ft(e,this.core,t),this.earlyDialogs.set(n.id,n)}if(!n.reliableSequenceGuard(e)){this.logger.warn(`1xx INVITE reliable response received out of order or is a retransmission, dropping.`);return}(n.signalingState===F.Initial||n.signalingState===F.HaveLocalOffer)&&n.signalingStateTransition(e);let r=n;this.delegate&&this.delegate.onProgress&&this.delegate.onProgress({message:e,session:r,prack:e=>r.prack(void 0,e)})}return;case/^2[0-9]{2}$/.test(t):{if(!e.toTag){this.logger.error(`2xx INVITE response received without a to tag, dropping.`);return}if(!e.parseHeader(`contact`)){this.logger.error(`2xx INVITE response received without a Contact header field, dropping.`);return}let t=Ge.initialDialogStateForUserAgentClient(this.message,e),n=this.confirmedDialogs.get(t.id);if(n){let e=this.confirmedDialogAcks.get(t.id);if(e){let t=this.transaction;if(!(t instanceof Ke))throw Error(`Client transaction not instance of InviteClientTransaction.`);t.ackResponse(e.message)}return}if(n=this.earlyDialogs.get(t.id),n)n.confirm(),n.recomputeRouteSet(e),this.earlyDialogs.delete(n.id),this.confirmedDialogs.set(n.id,n);else{let e=this.transaction;if(!(e instanceof Ke))throw Error(`Transaction not instance of InviteClientTransaction.`);n=new ft(e,this.core,t),this.confirmedDialogs.set(n.id,n)}(n.signalingState===F.Initial||n.signalingState===F.HaveLocalOffer)&&n.signalingStateTransition(e);let r=n;if(this.delegate&&this.delegate.onAccept)this.delegate.onAccept({message:e,session:r,ack:e=>{let t=r.ack(e);return this.confirmedDialogAcks.set(r.id,t),t}});else{let e=r.ack();this.confirmedDialogAcks.set(r.id,e)}}return;case/^3[0-9]{2}$/.test(t):this.earlyDialogs.forEach(e=>e.dispose()),this.earlyDialogs.clear(),this.delegate&&this.delegate.onRedirect&&this.delegate.onRedirect({message:e});return;case/^[4-6][0-9]{2}$/.test(t):this.earlyDialogs.forEach(e=>e.dispose()),this.earlyDialogs.clear(),this.delegate&&this.delegate.onReject&&this.delegate.onReject({message:e});return;default:throw Error(`Invalid status code ${t}`)}throw Error(`Executing what should be an unreachable code path receiving ${t} response.`)}},mt=class extends Xe{constructor(e,t,n){super(He,e,t,n),this.core=e}dispose(){this.earlyDialog&&this.earlyDialog.dispose(),super.dispose()}accept(e={statusCode:200}){if(!this.acceptable)throw new ye(`${this.message.method} not acceptable in state ${this.transaction.state}.`);if(!this.confirmedDialog)if(this.earlyDialog)this.earlyDialog.confirm(),this.confirmedDialog=this.earlyDialog,this.earlyDialog=void 0;else{let e=this.transaction;if(!(e instanceof He))throw Error(`Transaction not instance of InviteClientTransaction.`);let t=Ge.initialDialogStateForUserAgentServer(this.message,this.toTag);this.confirmedDialog=new ft(e,this.core,t)}let t=this.message.getHeaders(`record-route`).map(e=>`Record-Route: ${e}`),n=`Contact: ${this.core.configuration.contact.toString()}`,r=`Allow: `+be.toString();if(!e.body){if(this.confirmedDialog.signalingState===F.Stable)e.body=this.confirmedDialog.answer;else if(this.confirmedDialog.signalingState===F.Initial||this.confirmedDialog.signalingState===F.HaveRemoteOffer)throw Error(`Response must have a body.`)}e.statusCode=e.statusCode||200,e.extraHeaders=e.extraHeaders||[],e.extraHeaders=e.extraHeaders.concat(t),e.extraHeaders.push(r),e.extraHeaders.push(n);let i=super.accept(e),a=this.confirmedDialog,o=Object.assign(Object.assign({},i),{session:a});return e.body&&this.confirmedDialog.signalingState!==F.Stable&&this.confirmedDialog.signalingStateTransition(e.body),o}progress(e={statusCode:180}){if(!this.progressable)throw new ye(`${this.message.method} not progressable in state ${this.transaction.state}.`);if(!this.earlyDialog){let e=this.transaction;if(!(e instanceof He))throw Error(`Transaction not instance of InviteClientTransaction.`);let t=Ge.initialDialogStateForUserAgentServer(this.message,this.toTag,!0);this.earlyDialog=new ft(e,this.core,t)}let t=this.message.getHeaders(`record-route`).map(e=>`Record-Route: ${e}`),n=`Contact: ${this.core.configuration.contact}`;e.extraHeaders=e.extraHeaders||[],e.extraHeaders=e.extraHeaders.concat(t),e.extraHeaders.push(n);let r=super.progress(e),i=this.earlyDialog,a=Object.assign(Object.assign({},r),{session:i});return e.body&&this.earlyDialog.signalingState!==F.Stable&&this.earlyDialog.signalingStateTransition(e.body),a}redirect(e,t={statusCode:302}){return super.redirect(e,t)}reject(e={statusCode:486}){return super.reject(e)}},ht=class extends qe{constructor(e,t,n){super(We,e,t,n)}},gt=class extends qe{constructor(e,t,n){super(We,e,t,n)}},_t=class extends Xe{constructor(e,t,n){super(Ye,e,t,n),this.core=e}},vt=class extends qe{constructor(e,t,n){let r=e.createOutgoingRequestMessage(L.SUBSCRIBE,n);super(We,e.userAgentCore,r,t),this.dialog=e}waitNotifyStop(){}receiveResponse(e){if(e.statusCode&&e.statusCode>=200&&e.statusCode<300){let t=e.getHeader(`Expires`);if(!t)this.logger.warn(`Expires header missing in a 200-class response to SUBSCRIBE`);else{let e=Number(t);this.dialog.subscriptionExpires>e&&(this.dialog.subscriptionExpires=e)}}e.statusCode&&e.statusCode>=400&&e.statusCode<700&&[404,405,410,416,480,481,482,483,484,485,489,501,604].includes(e.statusCode)&&this.dialog.terminate(),super.receiveResponse(e)}},yt=class extends Ge{constructor(e,t,n,r,i,a){super(r,i),this.delegate=a,this._autoRefresh=!1,this._subscriptionEvent=e,this._subscriptionExpires=t,this._subscriptionExpiresInitial=t,this._subscriptionExpiresLastSet=Math.floor(Date.now()/1e3),this._subscriptionRefresh=void 0,this._subscriptionRefreshLastSet=void 0,this._subscriptionState=n,this.logger=r.loggerFactory.getLogger(`sip.subscribe-dialog`),this.logger.log(`SUBSCRIBE dialog ${this.id} constructed`)}static initialDialogStateForSubscription(e,t){let n=t.getHeaders(`record-route`),r=t.parseHeader(`contact`);if(!r)throw Error(`Contact undefined.`);if(!(r instanceof D))throw Error(`Contact not instance of NameAddrHeader.`);let i=r.uri,a=e.cseq,o=e.callId,s=e.fromTag,c=t.fromTag;if(!o)throw Error(`Call id undefined.`);if(!s)throw Error(`From tag undefined.`);if(!c)throw Error(`To tag undefined.`);if(!e.from)throw Error(`From undefined.`);if(!e.to)throw Error(`To undefined.`);let l=e.from.uri,u=e.to.uri;return{id:o+s+c,early:!1,callId:o,localTag:s,remoteTag:c,localSequenceNumber:a,remoteSequenceNumber:void 0,localURI:l,remoteURI:u,remoteTarget:i,routeSet:n,secure:!1}}dispose(){super.dispose(),this.N&&=(clearTimeout(this.N),void 0),this.refreshTimerClear(),this.logger.log(`SUBSCRIBE dialog ${this.id} destroyed`)}get autoRefresh(){return this._autoRefresh}set autoRefresh(e){this._autoRefresh=!0,this.refreshTimerSet()}get subscriptionEvent(){return this._subscriptionEvent}get subscriptionExpires(){let e=Math.floor(Date.now()/1e3)-this._subscriptionExpiresLastSet,t=this._subscriptionExpires-e;return Math.max(t,0)}set subscriptionExpires(e){if(e<0)throw Error(`Expires must be greater than or equal to zero.`);if(this._subscriptionExpires=e,this._subscriptionExpiresLastSet=Math.floor(Date.now()/1e3),this.autoRefresh){let t=this.subscriptionRefresh;(t===void 0||t>=e)&&this.refreshTimerSet()}}get subscriptionExpiresInitial(){return this._subscriptionExpiresInitial}get subscriptionRefresh(){if(this._subscriptionRefresh===void 0||this._subscriptionRefreshLastSet===void 0)return;let e=Math.floor(Date.now()/1e3)-this._subscriptionRefreshLastSet,t=this._subscriptionRefresh-e;return Math.max(t,0)}get subscriptionState(){return this._subscriptionState}receiveRequest(e){if(this.logger.log(`SUBSCRIBE dialog ${this.id} received ${e.method} request`),!this.sequenceGuard(e)){this.logger.log(`SUBSCRIBE dialog ${this.id} rejected out of order ${e.method} request.`);return}switch(super.receiveRequest(e),e.method){case L.NOTIFY:this.onNotify(e);break;default:this.logger.log(`SUBSCRIBE dialog ${this.id} received unimplemented ${e.method} request`),this.core.replyStateless(e,{statusCode:501});break}}refresh(){let e=`Allow: `+be.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)}subscribe(e,t={}){if(this.subscriptionState!==B.Pending&&this.subscriptionState!==B.Active)throw Error(`Invalid state ${this.subscriptionState}. May only re-subscribe while in state "pending" or "active".`);this.logger.log(`SUBSCRIBE dialog ${this.id} sending SUBSCRIBE request`);let n=new vt(this,e,t);return this.N&&=(clearTimeout(this.N),void 0),t.extraHeaders?.includes(`Expires: 0`)||(this.N=setTimeout(()=>this.timerN(),I.TIMER_N)),n}terminate(){this.stateTransition(B.Terminated),this.onTerminated()}unsubscribe(){let e=`Allow: `+be.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)}onNotify(e){let t=e.parseHeader(`Event`).event;if(!t||t!==this.subscriptionEvent){this.core.replyStateless(e,{statusCode:489});return}this.N&&=(clearTimeout(this.N),void 0);let n=e.parseHeader(`Subscription-State`);if(!n||!n.state){this.core.replyStateless(e,{statusCode:489});return}let r=n.state,i=n.expires?Math.max(n.expires,0):void 0;switch(r){case`pending`:this.stateTransition(B.Pending,i);break;case`active`:this.stateTransition(B.Active,i);break;case`terminated`:this.stateTransition(B.Terminated,i);break;default:this.logger.warn(`Unrecognized subscription state.`);break}let a=new it(this,e);this.delegate&&this.delegate.onNotify?this.delegate.onNotify(a):a.accept()}onRefresh(e){this.delegate&&this.delegate.onRefresh&&this.delegate.onRefresh(e)}onTerminated(){this.delegate&&this.delegate.onTerminated&&this.delegate.onTerminated()}refreshTimerClear(){this.refreshTimer&&=(clearTimeout(this.refreshTimer),void 0)}refreshTimerSet(){if(this.refreshTimerClear(),this.autoRefresh&&this.subscriptionExpires>0){let e=this.subscriptionExpires*900;this._subscriptionRefresh=Math.floor(e/1e3),this._subscriptionRefreshLastSet=Math.floor(Date.now()/1e3),this.refreshTimer=setTimeout(()=>{this.refreshTimer=void 0,this._subscriptionRefresh=void 0,this._subscriptionRefreshLastSet=void 0,this.onRefresh(this.refresh())},e)}}stateTransition(e,t){let n=()=>{this.logger.warn(`Invalid subscription state transition from ${this.subscriptionState} to ${e}`)};switch(e){case B.Initial:n();return;case B.NotifyWait:n();return;case B.Pending:if(this.subscriptionState!==B.NotifyWait&&this.subscriptionState!==B.Pending){n();return}break;case B.Active:if(this.subscriptionState!==B.NotifyWait&&this.subscriptionState!==B.Pending&&this.subscriptionState!==B.Active){n();return}break;case B.Terminated:if(this.subscriptionState!==B.NotifyWait&&this.subscriptionState!==B.Pending&&this.subscriptionState!==B.Active){n();return}break;default:n();return}e===B.Pending&&t&&(this.subscriptionExpires=t),e===B.Active&&t&&(this.subscriptionExpires=t),e===B.Terminated&&this.dispose(),this._subscriptionState=e}timerN(){this.logger.warn(`Timer N expired for SUBSCRIBE dialog. Timed out waiting for NOTIFY.`),this.subscriptionState!==B.Terminated&&(this.stateTransition(B.Terminated),this.onTerminated())}},bt=class extends qe{constructor(e,t,n){let r=t.getHeader(`Event`);if(!r)throw Error(`Event undefined`);let i=t.getHeader(`Expires`);if(!i)throw Error(`Expires undefined`);super(We,e,t,n),this.delegate=n,this.subscriberId=t.callId+t.fromTag+r,this.subscriptionExpiresRequested=this.subscriptionExpires=Number(i),this.subscriptionEvent=r,this.subscriptionState=B.NotifyWait,this.waitNotifyStart()}dispose(){super.dispose()}onNotify(e){let t=e.message.parseHeader(`Event`).event;if(!t||t!==this.subscriptionEvent){this.logger.warn(`Failed to parse event.`),e.reject({statusCode:489});return}let n=e.message.parseHeader(`Subscription-State`);if(!n||!n.state){this.logger.warn(`Failed to parse subscription state.`),e.reject({statusCode:489});return}let r=n.state;switch(r){case`pending`:break;case`active`:break;case`terminated`:break;default:this.logger.warn(`Invalid subscription state ${r}`),e.reject({statusCode:489});return}if(r!==`terminated`&&!e.message.parseHeader(`contact`)){this.logger.warn(`Failed to parse contact.`),e.reject({statusCode:489});return}if(this.dialog)throw 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=B.Pending;break;case`active`:this.subscriptionState=B.Active;break;case`terminated`:this.subscriptionState=B.Terminated;break;default:throw Error(`Unrecognized state ${r}.`)}if(this.subscriptionState!==B.Terminated){let t=yt.initialDialogStateForSubscription(this.message,e.message);this.dialog=new yt(this.subscriptionEvent,this.subscriptionExpires,this.subscriptionState,this.core,t)}if(this.delegate&&this.delegate.onNotify){let t=e,n=this.dialog;this.delegate.onNotify({request:t,subscription:n})}else e.accept()}waitNotifyStart(){this.N||=(this.core.subscribers.set(this.subscriberId,this),setTimeout(()=>this.timerN(),I.TIMER_N))}waitNotifyStop(){this.N&&=(this.core.subscribers.delete(this.subscriberId),clearTimeout(this.N),void 0)}receiveResponse(e){if(this.authenticationGuard(e)){if(e.statusCode&&e.statusCode>=200&&e.statusCode<300){let t=e.getHeader(`Expires`);if(!t)this.logger.warn(`Expires header missing in a 200-class response to SUBSCRIBE`);else{let e=Number(t);e>this.subscriptionExpiresRequested&&this.logger.warn(`Expires header in a 200-class response to SUBSCRIBE with a higher value than the one in the request`),e<this.subscriptionExpires&&(this.subscriptionExpires=e)}this.dialog&&this.dialog.subscriptionExpires>this.subscriptionExpires&&(this.dialog.subscriptionExpires=this.subscriptionExpires)}e.statusCode&&e.statusCode>=300&&e.statusCode<700&&this.waitNotifyStop(),super.receiveResponse(e)}}timerN(){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()}},xt=class extends Xe{constructor(e,t,n){super(Ye,e,t,n),this.core=e}},St=[`application/sdp`,`application/dtmf-relay`],Ct=class{constructor(e,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`)}dispose(){this.reset()}reset(){this.dialogs.forEach(e=>e.dispose()),this.dialogs.clear(),this.subscribers.forEach(e=>e.dispose()),this.subscribers.clear(),this.userAgentClients.forEach(e=>e.dispose()),this.userAgentClients.clear(),this.userAgentServers.forEach(e=>e.dispose()),this.userAgentServers.clear()}get loggerFactory(){return this.configuration.loggerFactory}get transport(){let e=this.configuration.transportAccessor();if(!e)throw Error(`Transport undefined.`);return e}invite(e,t){return new pt(this,e,t)}message(e,t){return new et(this,e,t)}publish(e,t){return new ht(this,e,t)}register(e,t){return new gt(this,e,t)}subscribe(e,t){return new bt(this,e,t)}request(e,t){return new qe(We,this,e,t)}makeOutgoingRequestMessage(e,t,n,r,i,a,o){let s=this.configuration.sipjsId,c=this.configuration.displayName,l=this.configuration.viaForceRport,u=this.configuration.hackViaTcp,d=this.configuration.supportedOptionTags.slice();e===L.REGISTER&&d.push(`path`,`gruu`),e===L.INVITE&&(this.configuration.contact.pubGruu||this.configuration.contact.tempGruu)&&d.push(`gruu`);let f={callIdPrefix:s,forceRport:l,fromDisplayName:c,hackViaTcp:u,optionTags:d,routeSet:this.configuration.routeSet,userAgentString:this.configuration.userAgentHeaderFieldValue,viaHost:this.configuration.viaHost};return new P(e,t,n,r,Object.assign(Object.assign({},f),i),a,o)}receiveIncomingRequestFromTransport(e){this.receiveRequestFromTransport(e)}receiveIncomingResponseFromTransport(e){this.receiveResponseFromTransport(e)}replyStateless(e,t){let n=this.configuration.userAgentHeaderFieldValue,r=this.configuration.supportedOptionTagsResponse;t=Object.assign(Object.assign({},t),{userAgent:n,supported:r});let i=Re(e,t);return this.transport.send(i.message).catch(t=>{t instanceof Error&&this.logger.error(t.message),this.logger.error(`Transport error occurred sending stateless reply to ${e.method} request.`)}),i}receiveRequestFromTransport(e){let t=e.viaBranch,n=this.userAgentServers.get(t);if(e.method===L.ACK&&n&&n.transaction.state===H.Accepted&&n instanceof mt){this.logger.warn(`Discarding out of dialog ACK after 2xx response sent on transaction ${t}.`);return}if(e.method===L.CANCEL){n?(this.replyStateless(e,{statusCode:200}),n.transaction instanceof He&&n.transaction.state===H.Proceeding&&n instanceof mt&&n.receiveCancel(e)):this.replyStateless(e,{statusCode:481});return}if(n){n.transaction.receiveRequest(e);return}this.receiveRequest(e)}receiveRequest(e){if(!be.includes(e.method)){let t=`Allow: `+be.toString();this.replyStateless(e,{statusCode:405,extraHeaders:[t]});return}if(!e.ruri)throw Error(`Request-URI undefined.`);if(e.ruri.scheme!==`sip`){this.replyStateless(e,{statusCode:416});return}let t=e.ruri,n=e=>!!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))){this.logger.warn(`Request-URI does not point to us.`),e.method!==L.ACK&&this.replyStateless(e,{statusCode:404});return}if(e.method===L.INVITE&&!e.hasHeader(`Contact`)){this.replyStateless(e,{statusCode:400,reasonPhrase:`Missing Contact Header`});return}if(!e.toTag){let t=e.viaBranch;if(!this.userAgentServers.has(t)&&Array.from(this.userAgentServers.values()).some(t=>t.transaction.request.fromTag===e.fromTag&&t.transaction.request.callId===e.callId&&t.transaction.request.cseq===e.cseq)){this.replyStateless(e,{statusCode:482});return}}e.toTag?this.receiveInsideDialogRequest(e):this.receiveOutsideDialogRequest(e)}receiveInsideDialogRequest(e){if(e.method===L.NOTIFY){let t=e.parseHeader(`Event`);if(!t||!t.event){this.replyStateless(e,{statusCode:489});return}let n=e.callId+e.toTag+t.event,r=this.subscribers.get(n);if(r){let t=new it(this,e);r.onNotify(t);return}}let t=e.callId+e.toTag+e.fromTag,n=this.dialogs.get(t);if(n){if(e.method===L.OPTIONS){let t=`Allow: `+be.toString(),n=`Accept: `+St.toString();this.replyStateless(e,{statusCode:200,extraHeaders:[t,n]});return}n.receiveRequest(e);return}e.method!==L.ACK&&this.replyStateless(e,{statusCode:481})}receiveOutsideDialogRequest(e){switch(e.method){case L.ACK:break;case L.BYE:this.replyStateless(e,{statusCode:481});break;case L.CANCEL:throw Error(`Unexpected out of dialog request method ${e.method}.`);case L.INFO:this.replyStateless(e,{statusCode:405});break;case L.INVITE:{let t=new mt(this,e);this.delegate.onInvite?this.delegate.onInvite(t):t.reject()}break;case L.MESSAGE:{let t=new tt(this,e);this.delegate.onMessage?this.delegate.onMessage(t):t.accept()}break;case L.NOTIFY:{let t=new it(this,e);this.delegate.onNotify?this.delegate.onNotify(t):t.reject({statusCode:405})}break;case L.OPTIONS:{let t=`Allow: `+be.toString(),n=`Accept: `+St.toString();this.replyStateless(e,{statusCode:200,extraHeaders:[t,n]})}break;case L.REFER:{let t=new dt(this,e);this.delegate.onRefer?this.delegate.onRefer(t):t.reject({statusCode:405})}break;case L.REGISTER:{let t=new _t(this,e);this.delegate.onRegister?this.delegate.onRegister(t):t.reject({statusCode:405})}break;case L.SUBSCRIBE:{let t=new xt(this,e);this.delegate.onSubscribe?this.delegate.onSubscribe(t):t.reject({statusCode:480})}break;default:throw Error(`Unexpected out of dialog request method ${e.method}.`)}}receiveResponseFromTransport(e){if(e.getHeaders(`via`).length>1){this.logger.warn(`More than one Via header field present in the response, dropping`);return}let t=e.viaBranch+e.method,n=this.userAgentClients.get(t);n?n.transaction.receiveResponse(e):this.logger.warn(`Discarding unmatched ${e.statusCode} response to ${e.method} ${t}.`)}};function wt(){return e=>!e.audio&&!e.video?Promise.resolve(new MediaStream):navigator.mediaDevices===void 0?Promise.reject(Error(`Media devices not available in insecure contexts.`)):navigator.mediaDevices.getUserMedia.call(navigator.mediaDevices,e)}function Tt(){return{bundlePolicy:`balanced`,certificates:void 0,iceCandidatePoolSize:0,iceServers:[{urls:`stun:stun.l.google.com:19302`}],iceTransportPolicy:`all`,rtcpMuxPolicy:`require`}}var Et=class e{constructor(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(n?.peerConnectionConfiguration),this.initPeerConnectionEventHandlers()}get localMediaStream(){return this._localMediaStream}get remoteMediaStream(){return this._remoteMediaStream}get dataChannel(){return this._dataChannel}get peerConnection(){return this._peerConnection}get peerConnectionDelegate(){return this._peerConnectionDelegate}set peerConnectionDelegate(e){this._peerConnectionDelegate=e}static dispatchAddTrackEvent(e,t){e.dispatchEvent(new MediaStreamTrackEvent(`addtrack`,{track:t}))}static dispatchRemoveTrackEvent(e,t){e.dispatchEvent(new MediaStreamTrackEvent(`removetrack`,{track:t}))}close(){this.logger.debug(`SessionDescriptionHandler.close`),this._peerConnection!==void 0&&(this._peerConnection.getReceivers().forEach(e=>{e.track&&e.track.stop()}),this._peerConnection.getSenders().forEach(e=>{e.track&&e.track.stop()}),this._dataChannel&&this._dataChannel.close(),this._peerConnection.close(),this._peerConnection=void 0)}enableReceiverTracks(e){let t=this.peerConnection;if(!t)throw Error(`Peer connection closed.`);t.getReceivers().forEach(t=>{t.track&&(t.track.enabled=e)})}enableSenderTracks(e){let t=this.peerConnection;if(!t)throw Error(`Peer connection closed.`);t.getSenders().forEach(t=>{t.track&&(t.track.enabled=e)})}getDescription(e,t){if(this.logger.debug(`SessionDescriptionHandler.getDescription`),this._peerConnection===void 0)return Promise.reject(Error(`Peer connection closed.`));this.onDataChannel=e?.onDataChannel;let n=e?.offerOptions?.iceRestart,r=e?.iceGatheringTimeout===void 0?this.sessionDescriptionHandlerConfiguration?.iceGatheringTimeout:e?.iceGatheringTimeout;return this.getLocalMediaStream(e).then(()=>this.updateDirection(e)).then(()=>this.createDataChannel(e)).then(()=>this.createLocalOfferOrAnswer(e)).then(e=>this.applyModifiers(e,t)).then(e=>this.setLocalSessionDescription(e)).then(()=>this.waitForIceGatheringComplete(n,r)).then(()=>this.getLocalSessionDescription()).then(e=>({body:e.sdp,contentType:`application/sdp`})).catch(e=>{throw this.logger.error(`SessionDescriptionHandler.getDescription failed - `+e),e})}hasDescription(e){return this.logger.debug(`SessionDescriptionHandler.hasDescription`),e===`application/sdp`}iceGatheringComplete(){this.logger.debug(`SessionDescriptionHandler.iceGatheringComplete`),this.iceGatheringCompleteTimeoutId!==void 0&&(this.logger.debug(`SessionDescriptionHandler.iceGatheringComplete - clearing timeout`),clearTimeout(this.iceGatheringCompleteTimeoutId),this.iceGatheringCompleteTimeoutId=void 0),this.iceGatheringCompletePromise!==void 0&&(this.logger.debug(`SessionDescriptionHandler.iceGatheringComplete - resolving promise`),this.iceGatheringCompleteResolve&&this.iceGatheringCompleteResolve(),this.iceGatheringCompletePromise=void 0,this.iceGatheringCompleteResolve=void 0,this.iceGatheringCompleteReject=void 0)}sendDtmf(e,t){if(this.logger.debug(`SessionDescriptionHandler.sendDtmf`),this._peerConnection===void 0)return this.logger.error(`SessionDescriptionHandler.sendDtmf failed - peer connection closed`),!1;let n=this._peerConnection.getSenders();if(n.length===0)return this.logger.error(`SessionDescriptionHandler.sendDtmf failed - no senders`),!1;let r=n[0].dtmf;if(!r)return this.logger.error(`SessionDescriptionHandler.sendDtmf failed - no DTMF sender`),!1;let i=t?.duration,a=t?.interToneGap;try{r.insertDTMF(e,i,a)}catch(e){return this.logger.error(e.toString()),!1}return this.logger.log(`SessionDescriptionHandler.sendDtmf sent via RTP: `+e.toString()),!0}setDescription(e,t,n){if(this.logger.debug(`SessionDescriptionHandler.setDescription`),this._peerConnection===void 0)return Promise.reject(Error(`Peer connection closed.`));this.onDataChannel=t?.onDataChannel;let r=this._peerConnection.signalingState===`have-local-offer`?`answer`:`offer`;return this.getLocalMediaStream(t).then(()=>this.applyModifiers({sdp:e,type:r},n)).then(e=>this.setRemoteSessionDescription(e)).catch(e=>{throw this.logger.error(`SessionDescriptionHandler.setDescription failed - `+e),e})}applyModifiers(e,t){return this.logger.debug(`SessionDescriptionHandler.applyModifiers`),!t||t.length===0?Promise.resolve(e):t.reduce((e,t)=>e.then(t),Promise.resolve(e)).then(e=>{if(this.logger.debug(`SessionDescriptionHandler.applyModifiers - modified sdp`),!e.sdp||!e.type)throw Error(`Invalid SDP.`);return{sdp:e.sdp,type:e.type}})}createDataChannel(e){if(this._peerConnection===void 0)return Promise.reject(Error(`Peer connection closed.`));if(e?.dataChannel!==!0||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(e?.dataChannelLabel||``,e?.dataChannelOptions),this.onDataChannel&&this.onDataChannel(this._dataChannel),Promise.resolve()}catch(e){return Promise.reject(e)}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(Error(`Invalid signaling state `+this._peerConnection.signalingState))}}createLocalOfferOrAnswer(e){if(this._peerConnection===void 0)return Promise.reject(Error(`Peer connection closed.`));switch(this._peerConnection.signalingState){case`stable`:return this.logger.debug(`SessionDescriptionHandler.createLocalOfferOrAnswer - creating SDP offer`),this._peerConnection.createOffer(e?.offerOptions);case`have-remote-offer`:return this.logger.debug(`SessionDescriptionHandler.createLocalOfferOrAnswer - creating SDP answer`),this._peerConnection.createAnswer(e?.answerOptions);case`have-local-offer`:case`have-local-pranswer`:case`have-remote-pranswer`:case`closed`:default:return Promise.reject(Error(`Invalid signaling state `+this._peerConnection.signalingState))}}getLocalMediaStream(e){if(this.logger.debug(`SessionDescriptionHandler.getLocalMediaStream`),this._peerConnection===void 0)return Promise.reject(Error(`Peer connection closed.`));let t=Object.assign({},e?.constraints);if(this.localMediaStreamConstraints){if(t.audio=t.audio||this.localMediaStreamConstraints.audio,t.video=t.video||this.localMediaStreamConstraints.video,JSON.stringify(this.localMediaStreamConstraints.audio)===JSON.stringify(t.audio)&&JSON.stringify(this.localMediaStreamConstraints.video)===JSON.stringify(t.video))return Promise.resolve()}else t.audio===void 0&&t.video===void 0&&(t={audio:!0});return this.localMediaStreamConstraints=t,this.mediaStreamFactory(t,this,e).then(e=>this.setLocalMediaStream(e))}setLocalMediaStream(t){if(this.logger.debug(`SessionDescriptionHandler.setLocalMediaStream`),!this._peerConnection)throw Error(`Peer connection undefined.`);let n=this._peerConnection,r=this._localMediaStream,i=[],a=t=>{let a=t.kind;if(a!==`audio`&&a!==`video`)throw Error(`Unknown new track kind ${a}.`);let o=n.getSenders().find(e=>e.track&&e.track.kind===a);o?i.push(new Promise(e=>{this.logger.debug(`SessionDescriptionHandler.setLocalMediaStream - replacing sender ${a} track`),e()}).then(()=>o.replaceTrack(t).then(()=>{let n=r.getTracks().find(e=>e.kind===a);n&&(n.stop(),r.removeTrack(n),e.dispatchRemoveTrackEvent(r,n)),r.addTrack(t),e.dispatchAddTrackEvent(r,t)}).catch(e=>{throw this.logger.error(`SessionDescriptionHandler.setLocalMediaStream - failed to replace sender ${a} track`),e}))):i.push(new Promise(e=>{this.logger.debug(`SessionDescriptionHandler.setLocalMediaStream - adding sender ${a} track`),e()}).then(()=>{try{n.addTrack(t,r)}catch(e){throw this.logger.error(`SessionDescriptionHandler.setLocalMediaStream - failed to add sender ${a} track`),e}r.addTrack(t),e.dispatchAddTrackEvent(r,t)}))},o=t.getAudioTracks();o.length&&a(o[0]);let s=t.getVideoTracks();return s.length&&a(s[0]),i.reduce((e,t)=>e.then(()=>t),Promise.resolve())}getLocalSessionDescription(){if(this.logger.debug(`SessionDescriptionHandler.getLocalSessionDescription`),this._peerConnection===void 0)return Promise.reject(Error(`Peer connection closed.`));let e=this._peerConnection.localDescription;return e?Promise.resolve(e):Promise.reject(Error(`Failed to get local session description`))}setLocalSessionDescription(e){return this.logger.debug(`SessionDescriptionHandler.setLocalSessionDescription`),this._peerConnection===void 0?Promise.reject(Error(`Peer connection closed.`)):this._peerConnection.setLocalDescription(e)}setRemoteSessionDescription(e){if(this.logger.debug(`SessionDescriptionHandler.setRemoteSessionDescription`),this._peerConnection===void 0)return Promise.reject(Error(`Peer connection closed.`));let t=e.sdp,n;switch(this._peerConnection.signalingState){case`stable`:n=`offer`;break;case`have-local-offer`:n=`answer`;break;case`have-local-pranswer`:case`have-remote-offer`:case`have-remote-pranswer`:case`closed`:default:return Promise.reject(Error(`Invalid signaling state `+this._peerConnection.signalingState))}return t?this._peerConnection.setRemoteDescription({sdp:t,type:n}):(this.logger.error(`SessionDescriptionHandler.setRemoteSessionDescription failed - cannot set null sdp`),Promise.reject(Error(`SDP is undefined`)))}setRemoteTrack(t){this.logger.debug(`SessionDescriptionHandler.setRemoteTrack`);let n=this._remoteMediaStream;n.getTrackById(t.id)?this.logger.debug(`SessionDescriptionHandler.setRemoteTrack - have remote ${t.kind} track`):t.kind===`audio`?(this.logger.debug(`SessionDescriptionHandler.setRemoteTrack - adding remote ${t.kind} track`),n.getAudioTracks().forEach(t=>{t.stop(),n.removeTrack(t),e.dispatchRemoveTrackEvent(n,t)}),n.addTrack(t),e.dispatchAddTrackEvent(n,t)):t.kind===`video`&&(this.logger.debug(`SessionDescriptionHandler.setRemoteTrack - adding remote ${t.kind} track`),n.getVideoTracks().forEach(t=>{t.stop(),n.removeTrack(t),e.dispatchRemoveTrackEvent(n,t)}),n.addTrack(t),e.dispatchAddTrackEvent(n,t))}updateDirection(e){if(this._peerConnection===void 0)return Promise.reject(Error(`Peer connection closed.`));switch(this._peerConnection.signalingState){case`stable`:this.logger.debug(`SessionDescriptionHandler.updateDirection - setting offer direction`);{let t=t=>{switch(t){case`inactive`:return e?.hold?`inactive`:`recvonly`;case`recvonly`:return e?.hold?`inactive`:`recvonly`;case`sendonly`:return e?.hold?`sendonly`:`sendrecv`;case`sendrecv`:return e?.hold?`sendonly`:`sendrecv`;case`stopped`:return`stopped`;default:throw Error(`Should never happen`)}};this._peerConnection.getTransceivers().forEach(e=>{if(e.direction){let n=t(e.direction);e.direction!==n&&(e.direction=n)}})}break;case`have-remote-offer`:this.logger.debug(`SessionDescriptionHandler.updateDirection - setting answer direction`);{let t=(()=>{let e=this._peerConnection.remoteDescription;if(!e)throw Error(`Failed to read remote offer`);let t=/a=sendrecv\r\n|a=sendonly\r\n|a=recvonly\r\n|a=inactive\r\n/.exec(e.sdp);if(t)switch(t[0]){case`a=inactive\r
43
43
  `:return`inactive`;case`a=recvonly\r
44
44
  `:return`recvonly`;case`a=sendonly\r
45
45
  `:return`sendonly`;case`a=sendrecv\r
46
- `:return`sendrecv`;default:throw Error(`Should never happen`)}return`sendrecv`})(),n=(()=>{switch(t){case`inactive`:return`inactive`;case`recvonly`:return`sendonly`;case`sendonly`:return e?.hold?`inactive`:`recvonly`;case`sendrecv`:return e?.hold?`sendonly`:`sendrecv`;default:throw Error(`Should never happen`)}})();this._peerConnection.getTransceivers().forEach(e=>{e.direction&&e.direction!==`stopped`&&e.direction!==n&&(e.direction=n)})}break;case`have-local-offer`:case`have-local-pranswer`:case`have-remote-pranswer`:case`closed`:default:return Promise.reject(Error(`Invalid signaling state `+this._peerConnection.signalingState))}return Promise.resolve()}waitForIceGatheringComplete(e=!1,t=0){return this.logger.debug(`SessionDescriptionHandler.waitForIceGatheringToComplete`),this._peerConnection===void 0?Promise.reject(`Peer connection closed.`):!e&&this._peerConnection.iceGatheringState===`complete`?(this.logger.debug(`SessionDescriptionHandler.waitForIceGatheringToComplete - already complete`),Promise.resolve()):(this.iceGatheringCompletePromise!==void 0&&(this.logger.debug(`SessionDescriptionHandler.waitForIceGatheringToComplete - rejecting prior waiting promise`),this.iceGatheringCompleteReject&&this.iceGatheringCompleteReject(Error(`Promise superseded.`)),this.iceGatheringCompletePromise=void 0,this.iceGatheringCompleteResolve=void 0,this.iceGatheringCompleteReject=void 0),this.iceGatheringCompletePromise=new Promise((e,n)=>{this.iceGatheringCompleteResolve=e,this.iceGatheringCompleteReject=n,t>0&&(this.logger.debug(`SessionDescriptionHandler.waitForIceGatheringToComplete - timeout in `+t),this.iceGatheringCompleteTimeoutId=setTimeout(()=>{this.logger.debug(`SessionDescriptionHandler.waitForIceGatheringToComplete - timeout`),this.iceGatheringComplete()},t))}),this.iceGatheringCompletePromise)}initPeerConnectionEventHandlers(){if(this.logger.debug(`SessionDescriptionHandler.initPeerConnectionEventHandlers`),!this._peerConnection)throw Error(`Peer connection undefined.`);let e=this._peerConnection;e.onconnectionstatechange=t=>{let n=e.connectionState;this.logger.debug(`SessionDescriptionHandler.onconnectionstatechange ${n}`),this._peerConnectionDelegate?.onconnectionstatechange&&this._peerConnectionDelegate.onconnectionstatechange(t)},e.ondatachannel=e=>{this.logger.debug(`SessionDescriptionHandler.ondatachannel`),this._dataChannel=e.channel,this.onDataChannel&&this.onDataChannel(this._dataChannel),this._peerConnectionDelegate?.ondatachannel&&this._peerConnectionDelegate.ondatachannel(e)},e.onicecandidate=e=>{this.logger.debug(`SessionDescriptionHandler.onicecandidate`),this._peerConnectionDelegate?.onicecandidate&&this._peerConnectionDelegate.onicecandidate(e)},e.onicecandidateerror=e=>{this.logger.debug(`SessionDescriptionHandler.onicecandidateerror`),this._peerConnectionDelegate?.onicecandidateerror&&this._peerConnectionDelegate.onicecandidateerror(e)},e.oniceconnectionstatechange=t=>{let n=e.iceConnectionState;this.logger.debug(`SessionDescriptionHandler.oniceconnectionstatechange ${n}`),this._peerConnectionDelegate?.oniceconnectionstatechange&&this._peerConnectionDelegate.oniceconnectionstatechange(t)},e.onicegatheringstatechange=t=>{let n=e.iceGatheringState;this.logger.debug(`SessionDescriptionHandler.onicegatheringstatechange ${n}`),n===`complete`&&this.iceGatheringComplete(),this._peerConnectionDelegate?.onicegatheringstatechange&&this._peerConnectionDelegate.onicegatheringstatechange(t)},e.onnegotiationneeded=e=>{this.logger.debug(`SessionDescriptionHandler.onnegotiationneeded`),this._peerConnectionDelegate?.onnegotiationneeded&&this._peerConnectionDelegate.onnegotiationneeded(e)},e.onsignalingstatechange=t=>{let n=e.signalingState;this.logger.debug(`SessionDescriptionHandler.onsignalingstatechange ${n}`),this._peerConnectionDelegate?.onsignalingstatechange&&this._peerConnectionDelegate.onsignalingstatechange(t)},e.ontrack=e=>{let t=e.track.kind,n=e.track.enabled?`enabled`:`disabled`;this.logger.debug(`SessionDescriptionHandler.ontrack ${t} ${n}`),this.setRemoteTrack(e.track),this._peerConnectionDelegate?.ontrack&&this._peerConnectionDelegate.ontrack(e)}}};function Dt(e){return(t,n)=>{e===void 0&&(e=wt());let r={iceGatheringTimeout:n?.iceGatheringTimeout===void 0?5e3:n?.iceGatheringTimeout,peerConnectionConfiguration:Object.assign(Object.assign({},Tt()),n?.peerConnectionConfiguration)};return new Et(t.userAgent.getLogger(`sip.SessionDescriptionHandler`),e,r)}}var Ot=class e{constructor(t,n){if(this._state=B.Disconnected,this.transitioningState=!1,this._stateEventEmitter=new T,this.logger=t,n){let e=n,t=e?.wsServers,r=e?.maxReconnectionAttempts;t!==void 0&&this.logger.warn(`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.`),r!==void 0&&this.logger.warn(`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.`),t&&!n.server&&(typeof t==`string`&&(n.server=t),t instanceof Array&&(n.server=t[0]))}this.configuration=Object.assign(Object.assign({},e.defaultOptions),n);let r=this.configuration.server,i=A.parse(r,`absoluteURI`);if(i===-1)throw this.logger.error(`Invalid WebSocket Server URL "${r}"`),Error(`Invalid WebSocket Server URL`);if(![`wss`,`ws`,`udp`].includes(i.scheme))throw this.logger.error(`Invalid scheme in WebSocket Server URL "${r}"`),Error(`Invalid scheme in WebSocket Server URL`);this._protocol=i.scheme.toUpperCase()}dispose(){return this.disconnect()}get protocol(){return this._protocol}get server(){return this.configuration.server}get state(){return this._state}get stateChange(){return this._stateEventEmitter}get ws(){return this._ws}connect(){return this._connect()}disconnect(){return this._disconnect()}isConnected(){return this.state===B.Connected}send(e){return this._send(e)}_connect(){switch(this.logger.log(`Connecting ${this.server}`),this.state){case B.Connecting:if(this.transitioningState)return Promise.reject(this.transitionLoopDetectedError(B.Connecting));if(!this.connectPromise)throw Error(`Connect promise must be defined.`);return this.connectPromise;case B.Connected:if(this.transitioningState)return Promise.reject(this.transitionLoopDetectedError(B.Connecting));if(this.connectPromise)throw Error(`Connect promise must not be defined.`);return Promise.resolve();case B.Disconnecting:if(this.connectPromise)throw Error(`Connect promise must not be defined.`);try{this.transitionState(B.Connecting)}catch(e){if(e instanceof x)return Promise.reject(e);throw e}break;case B.Disconnected:if(this.connectPromise)throw Error(`Connect promise must not be defined.`);try{this.transitionState(B.Connecting)}catch(e){if(e instanceof x)return Promise.reject(e);throw e}break;default:throw Error(`Unknown state`)}let e;try{e=new WebSocket(this.server,`sip`),e.binaryType=`arraybuffer`,e.addEventListener(`close`,t=>this.onWebSocketClose(t,e)),e.addEventListener(`error`,t=>this.onWebSocketError(t,e)),e.addEventListener(`open`,t=>this.onWebSocketOpen(t,e)),e.addEventListener(`message`,t=>this.onWebSocketMessage(t,e)),this._ws=e}catch(e){return this._ws=void 0,this.logger.error(`WebSocket construction failed.`),this.logger.error(e.toString()),new Promise((t,n)=>{this.connectResolve=t,this.connectReject=n,this.transitionState(B.Disconnected,e)})}return this.connectPromise=new Promise((t,n)=>{this.connectResolve=t,this.connectReject=n,this.connectTimeout=setTimeout(()=>{this.logger.warn(`Connect timed out. Exceeded time set in configuration.connectionTimeout: `+this.configuration.connectionTimeout+`s.`),e.close(1e3)},this.configuration.connectionTimeout*1e3)}),this.connectPromise}_disconnect(){switch(this.logger.log(`Disconnecting ${this.server}`),this.state){case B.Connecting:if(this.disconnectPromise)throw Error(`Disconnect promise must not be defined.`);try{this.transitionState(B.Disconnecting)}catch(e){if(e instanceof x)return Promise.reject(e);throw e}break;case B.Connected:if(this.disconnectPromise)throw Error(`Disconnect promise must not be defined.`);try{this.transitionState(B.Disconnecting)}catch(e){if(e instanceof x)return Promise.reject(e);throw e}break;case B.Disconnecting:if(this.transitioningState)return Promise.reject(this.transitionLoopDetectedError(B.Disconnecting));if(!this.disconnectPromise)throw Error(`Disconnect promise must be defined.`);return this.disconnectPromise;case B.Disconnected:if(this.transitioningState)return Promise.reject(this.transitionLoopDetectedError(B.Disconnecting));if(this.disconnectPromise)throw Error(`Disconnect promise must not be defined.`);return Promise.resolve();default:throw Error(`Unknown state`)}if(!this._ws)throw Error(`WebSocket must be defined.`);let e=this._ws;return this.disconnectPromise=new Promise((t,n)=>{this.disconnectResolve=t,this.disconnectReject=n;try{e.close(1e3)}catch(e){throw this.logger.error(`WebSocket close failed.`),this.logger.error(e.toString()),e}}),this.disconnectPromise}_send(e){if(this.configuration.traceSip===!0&&this.logger.log(`Sending WebSocket message:
46
+ `:return`sendrecv`;default:throw Error(`Should never happen`)}return`sendrecv`})(),n=(()=>{switch(t){case`inactive`:return`inactive`;case`recvonly`:return`sendonly`;case`sendonly`:return e?.hold?`inactive`:`recvonly`;case`sendrecv`:return e?.hold?`sendonly`:`sendrecv`;default:throw Error(`Should never happen`)}})();this._peerConnection.getTransceivers().forEach(e=>{e.direction&&e.direction!==`stopped`&&e.direction!==n&&(e.direction=n)})}break;case`have-local-offer`:case`have-local-pranswer`:case`have-remote-pranswer`:case`closed`:default:return Promise.reject(Error(`Invalid signaling state `+this._peerConnection.signalingState))}return Promise.resolve()}waitForIceGatheringComplete(e=!1,t=0){return this.logger.debug(`SessionDescriptionHandler.waitForIceGatheringToComplete`),this._peerConnection===void 0?Promise.reject(`Peer connection closed.`):!e&&this._peerConnection.iceGatheringState===`complete`?(this.logger.debug(`SessionDescriptionHandler.waitForIceGatheringToComplete - already complete`),Promise.resolve()):(this.iceGatheringCompletePromise!==void 0&&(this.logger.debug(`SessionDescriptionHandler.waitForIceGatheringToComplete - rejecting prior waiting promise`),this.iceGatheringCompleteReject&&this.iceGatheringCompleteReject(Error(`Promise superseded.`)),this.iceGatheringCompletePromise=void 0,this.iceGatheringCompleteResolve=void 0,this.iceGatheringCompleteReject=void 0),this.iceGatheringCompletePromise=new Promise((e,n)=>{this.iceGatheringCompleteResolve=e,this.iceGatheringCompleteReject=n,t>0&&(this.logger.debug(`SessionDescriptionHandler.waitForIceGatheringToComplete - timeout in `+t),this.iceGatheringCompleteTimeoutId=setTimeout(()=>{this.logger.debug(`SessionDescriptionHandler.waitForIceGatheringToComplete - timeout`),this.iceGatheringComplete()},t))}),this.iceGatheringCompletePromise)}initPeerConnectionEventHandlers(){if(this.logger.debug(`SessionDescriptionHandler.initPeerConnectionEventHandlers`),!this._peerConnection)throw Error(`Peer connection undefined.`);let e=this._peerConnection;e.onconnectionstatechange=t=>{let n=e.connectionState;this.logger.debug(`SessionDescriptionHandler.onconnectionstatechange ${n}`),this._peerConnectionDelegate?.onconnectionstatechange&&this._peerConnectionDelegate.onconnectionstatechange(t)},e.ondatachannel=e=>{this.logger.debug(`SessionDescriptionHandler.ondatachannel`),this._dataChannel=e.channel,this.onDataChannel&&this.onDataChannel(this._dataChannel),this._peerConnectionDelegate?.ondatachannel&&this._peerConnectionDelegate.ondatachannel(e)},e.onicecandidate=e=>{this.logger.debug(`SessionDescriptionHandler.onicecandidate`),this._peerConnectionDelegate?.onicecandidate&&this._peerConnectionDelegate.onicecandidate(e)},e.onicecandidateerror=e=>{this.logger.debug(`SessionDescriptionHandler.onicecandidateerror`),this._peerConnectionDelegate?.onicecandidateerror&&this._peerConnectionDelegate.onicecandidateerror(e)},e.oniceconnectionstatechange=t=>{let n=e.iceConnectionState;this.logger.debug(`SessionDescriptionHandler.oniceconnectionstatechange ${n}`),this._peerConnectionDelegate?.oniceconnectionstatechange&&this._peerConnectionDelegate.oniceconnectionstatechange(t)},e.onicegatheringstatechange=t=>{let n=e.iceGatheringState;this.logger.debug(`SessionDescriptionHandler.onicegatheringstatechange ${n}`),n===`complete`&&this.iceGatheringComplete(),this._peerConnectionDelegate?.onicegatheringstatechange&&this._peerConnectionDelegate.onicegatheringstatechange(t)},e.onnegotiationneeded=e=>{this.logger.debug(`SessionDescriptionHandler.onnegotiationneeded`),this._peerConnectionDelegate?.onnegotiationneeded&&this._peerConnectionDelegate.onnegotiationneeded(e)},e.onsignalingstatechange=t=>{let n=e.signalingState;this.logger.debug(`SessionDescriptionHandler.onsignalingstatechange ${n}`),this._peerConnectionDelegate?.onsignalingstatechange&&this._peerConnectionDelegate.onsignalingstatechange(t)},e.ontrack=e=>{let t=e.track.kind,n=e.track.enabled?`enabled`:`disabled`;this.logger.debug(`SessionDescriptionHandler.ontrack ${t} ${n}`),this.setRemoteTrack(e.track),this._peerConnectionDelegate?.ontrack&&this._peerConnectionDelegate.ontrack(e)}}};function Dt(e){return(t,n)=>{e===void 0&&(e=wt());let r={iceGatheringTimeout:n?.iceGatheringTimeout===void 0?5e3:n?.iceGatheringTimeout,peerConnectionConfiguration:Object.assign(Object.assign({},Tt()),n?.peerConnectionConfiguration)};return new Et(t.userAgent.getLogger(`sip.SessionDescriptionHandler`),e,r)}}var Ot=class e{constructor(t,n){if(this._state=V.Disconnected,this.transitioningState=!1,this._stateEventEmitter=new T,this.logger=t,n){let e=n,t=e?.wsServers,r=e?.maxReconnectionAttempts;t!==void 0&&this.logger.warn(`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.`),r!==void 0&&this.logger.warn(`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.`),t&&!n.server&&(typeof t==`string`&&(n.server=t),t instanceof Array&&(n.server=t[0]))}this.configuration=Object.assign(Object.assign({},e.defaultOptions),n);let r=this.configuration.server,i=A.parse(r,`absoluteURI`);if(i===-1)throw this.logger.error(`Invalid WebSocket Server URL "${r}"`),Error(`Invalid WebSocket Server URL`);if(![`wss`,`ws`,`udp`].includes(i.scheme))throw this.logger.error(`Invalid scheme in WebSocket Server URL "${r}"`),Error(`Invalid scheme in WebSocket Server URL`);this._protocol=i.scheme.toUpperCase()}dispose(){return this.disconnect()}get protocol(){return this._protocol}get server(){return this.configuration.server}get state(){return this._state}get stateChange(){return this._stateEventEmitter}get ws(){return this._ws}connect(){return this._connect()}disconnect(){return this._disconnect()}isConnected(){return this.state===V.Connected}send(e){return this._send(e)}_connect(){switch(this.logger.log(`Connecting ${this.server}`),this.state){case V.Connecting:if(this.transitioningState)return Promise.reject(this.transitionLoopDetectedError(V.Connecting));if(!this.connectPromise)throw Error(`Connect promise must be defined.`);return this.connectPromise;case V.Connected:if(this.transitioningState)return Promise.reject(this.transitionLoopDetectedError(V.Connecting));if(this.connectPromise)throw Error(`Connect promise must not be defined.`);return Promise.resolve();case V.Disconnecting:if(this.connectPromise)throw Error(`Connect promise must not be defined.`);try{this.transitionState(V.Connecting)}catch(e){if(e instanceof x)return Promise.reject(e);throw e}break;case V.Disconnected:if(this.connectPromise)throw Error(`Connect promise must not be defined.`);try{this.transitionState(V.Connecting)}catch(e){if(e instanceof x)return Promise.reject(e);throw e}break;default:throw Error(`Unknown state`)}let e;try{e=new WebSocket(this.server,`sip`),e.binaryType=`arraybuffer`,e.addEventListener(`close`,t=>this.onWebSocketClose(t,e)),e.addEventListener(`error`,t=>this.onWebSocketError(t,e)),e.addEventListener(`open`,t=>this.onWebSocketOpen(t,e)),e.addEventListener(`message`,t=>this.onWebSocketMessage(t,e)),this._ws=e}catch(e){return this._ws=void 0,this.logger.error(`WebSocket construction failed.`),this.logger.error(e.toString()),new Promise((t,n)=>{this.connectResolve=t,this.connectReject=n,this.transitionState(V.Disconnected,e)})}return this.connectPromise=new Promise((t,n)=>{this.connectResolve=t,this.connectReject=n,this.connectTimeout=setTimeout(()=>{this.logger.warn(`Connect timed out. Exceeded time set in configuration.connectionTimeout: `+this.configuration.connectionTimeout+`s.`),e.close(1e3)},this.configuration.connectionTimeout*1e3)}),this.connectPromise}_disconnect(){switch(this.logger.log(`Disconnecting ${this.server}`),this.state){case V.Connecting:if(this.disconnectPromise)throw Error(`Disconnect promise must not be defined.`);try{this.transitionState(V.Disconnecting)}catch(e){if(e instanceof x)return Promise.reject(e);throw e}break;case V.Connected:if(this.disconnectPromise)throw Error(`Disconnect promise must not be defined.`);try{this.transitionState(V.Disconnecting)}catch(e){if(e instanceof x)return Promise.reject(e);throw e}break;case V.Disconnecting:if(this.transitioningState)return Promise.reject(this.transitionLoopDetectedError(V.Disconnecting));if(!this.disconnectPromise)throw Error(`Disconnect promise must be defined.`);return this.disconnectPromise;case V.Disconnected:if(this.transitioningState)return Promise.reject(this.transitionLoopDetectedError(V.Disconnecting));if(this.disconnectPromise)throw Error(`Disconnect promise must not be defined.`);return Promise.resolve();default:throw Error(`Unknown state`)}if(!this._ws)throw Error(`WebSocket must be defined.`);let e=this._ws;return this.disconnectPromise=new Promise((t,n)=>{this.disconnectResolve=t,this.disconnectReject=n;try{e.close(1e3)}catch(e){throw this.logger.error(`WebSocket close failed.`),this.logger.error(e.toString()),e}}),this.disconnectPromise}_send(e){if(this.configuration.traceSip===!0&&this.logger.log(`Sending WebSocket message:
47
47
 
48
48
  `+e+`
49
- `),this._state!==B.Connected)return Promise.reject(Error(`Not connected.`));if(!this._ws)throw Error(`WebSocket undefined.`);try{this._ws.send(e)}catch(e){return e instanceof Error?Promise.reject(e):Promise.reject(Error(`WebSocket send failed.`))}return Promise.resolve()}onWebSocketClose(e,t){if(t!==this._ws)return;let n=`WebSocket closed ${this.server} (code: ${e.code})`,r=this.disconnectPromise?void 0:Error(n);r&&this.logger.warn(`WebSocket closed unexpectedly`),this.logger.log(n),this._ws=void 0,this.transitionState(B.Disconnected,r)}onWebSocketError(e,t){t===this._ws&&this.logger.error(`WebSocket error occurred.`)}onWebSocketMessage(e,t){if(t!==this._ws)return;let n=e.data,r;if(/^(\r\n)+$/.test(n)){this.clearKeepAliveTimeout(),this.configuration.traceSip===!0&&this.logger.log(`Received WebSocket message with CRLF Keep Alive response`);return}if(!n){this.logger.warn(`Received empty message, discarding...`);return}if(typeof n!=`string`){try{r=new TextDecoder().decode(new Uint8Array(n))}catch(e){this.logger.error(e.toString()),this.logger.error(`Received WebSocket binary message failed to be converted into string, message discarded`);return}this.configuration.traceSip===!0&&this.logger.log(`Received WebSocket binary message:
49
+ `),this._state!==V.Connected)return Promise.reject(Error(`Not connected.`));if(!this._ws)throw Error(`WebSocket undefined.`);try{this._ws.send(e)}catch(e){return e instanceof Error?Promise.reject(e):Promise.reject(Error(`WebSocket send failed.`))}return Promise.resolve()}onWebSocketClose(e,t){if(t!==this._ws)return;let n=`WebSocket closed ${this.server} (code: ${e.code})`,r=this.disconnectPromise?void 0:Error(n);r&&this.logger.warn(`WebSocket closed unexpectedly`),this.logger.log(n),this._ws=void 0,this.transitionState(V.Disconnected,r)}onWebSocketError(e,t){t===this._ws&&this.logger.error(`WebSocket error occurred.`)}onWebSocketMessage(e,t){if(t!==this._ws)return;let n=e.data,r;if(/^(\r\n)+$/.test(n)){this.clearKeepAliveTimeout(),this.configuration.traceSip===!0&&this.logger.log(`Received WebSocket message with CRLF Keep Alive response`);return}if(!n){this.logger.warn(`Received empty message, discarding...`);return}if(typeof n!=`string`){try{r=new TextDecoder().decode(new Uint8Array(n))}catch(e){this.logger.error(e.toString()),this.logger.error(`Received WebSocket binary message failed to be converted into string, message discarded`);return}this.configuration.traceSip===!0&&this.logger.log(`Received WebSocket binary message:
50
50
 
51
51
  `+r+`
52
52
  `)}else r=n,this.configuration.traceSip===!0&&this.logger.log(`Received WebSocket text message:
53
53
 
54
54
  `+r+`
55
- `);if(this.state!==B.Connected){this.logger.warn(`Received message while not connected, discarding...`);return}if(this.onMessage)try{this.onMessage(r)}catch(e){throw this.logger.error(e.toString()),this.logger.error(`Exception thrown by onMessage callback`),e}}onWebSocketOpen(e,t){t===this._ws&&this._state===B.Connecting&&(this.logger.log(`WebSocket opened ${this.server}`),this.transitionState(B.Connected))}transitionLoopDetectedError(e){let t=`A state transition loop has been detected.`;return t+=` An attempt to transition from ${this._state} to ${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 x(`Loop detected.`)}transitionState(e,t){let n=()=>{throw Error(`Invalid state transition from ${this._state} to ${e}`)};if(this.transitioningState)throw this.transitionLoopDetectedError(e);switch(this.transitioningState=!0,this._state){case B.Connecting:e!==B.Connected&&e!==B.Disconnecting&&e!==B.Disconnected&&n();break;case B.Connected:e!==B.Disconnecting&&e!==B.Disconnected&&n();break;case B.Disconnecting:e!==B.Connecting&&e!==B.Disconnected&&n();break;case B.Disconnected:e!==B.Connecting&&n();break;default:throw Error(`Unknown state.`)}let r=this._state;this._state=e;let i=this.connectResolve,a=this.connectReject;r===B.Connecting&&(this.connectPromise=void 0,this.connectResolve=void 0,this.connectReject=void 0);let o=this.disconnectResolve,s=this.disconnectReject;if(r===B.Disconnecting&&(this.disconnectPromise=void 0,this.disconnectResolve=void 0,this.disconnectReject=void 0),this.connectTimeout&&=(clearTimeout(this.connectTimeout),void 0),this.logger.log(`Transitioned from ${r} to ${this._state}`),this._stateEventEmitter.emit(this._state),e===B.Connected&&(this.startSendingKeepAlives(),this.onConnect))try{this.onConnect()}catch(e){throw this.logger.error(e.toString()),this.logger.error(`Exception thrown by onConnect callback`),e}if(r===B.Connected&&(this.stopSendingKeepAlives(),this.onDisconnect))try{t?this.onDisconnect(t):this.onDisconnect()}catch(e){throw this.logger.error(e.toString()),this.logger.error(`Exception thrown by onDisconnect callback`),e}if(r===B.Connecting){if(!i)throw Error(`Connect resolve undefined.`);if(!a)throw Error(`Connect reject undefined.`);e===B.Connected?i():a(t||Error(`Connect aborted.`))}if(r===B.Disconnecting){if(!o)throw Error(`Disconnect resolve undefined.`);if(!s)throw Error(`Disconnect reject undefined.`);e===B.Disconnected?o():s(t||Error(`Disconnect aborted.`))}this.transitioningState=!1}clearKeepAliveTimeout(){this.keepAliveDebounceTimeout&&clearTimeout(this.keepAliveDebounceTimeout),this.keepAliveDebounceTimeout=void 0}sendKeepAlive(){return this.keepAliveDebounceTimeout?Promise.resolve():(this.keepAliveDebounceTimeout=setTimeout(()=>{this.clearKeepAliveTimeout()},this.configuration.keepAliveDebounce*1e3),this.send(`\r
55
+ `);if(this.state!==V.Connected){this.logger.warn(`Received message while not connected, discarding...`);return}if(this.onMessage)try{this.onMessage(r)}catch(e){throw this.logger.error(e.toString()),this.logger.error(`Exception thrown by onMessage callback`),e}}onWebSocketOpen(e,t){t===this._ws&&this._state===V.Connecting&&(this.logger.log(`WebSocket opened ${this.server}`),this.transitionState(V.Connected))}transitionLoopDetectedError(e){let t=`A state transition loop has been detected.`;return t+=` An attempt to transition from ${this._state} to ${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 x(`Loop detected.`)}transitionState(e,t){let n=()=>{throw Error(`Invalid state transition from ${this._state} to ${e}`)};if(this.transitioningState)throw this.transitionLoopDetectedError(e);switch(this.transitioningState=!0,this._state){case V.Connecting:e!==V.Connected&&e!==V.Disconnecting&&e!==V.Disconnected&&n();break;case V.Connected:e!==V.Disconnecting&&e!==V.Disconnected&&n();break;case V.Disconnecting:e!==V.Connecting&&e!==V.Disconnected&&n();break;case V.Disconnected:e!==V.Connecting&&n();break;default:throw Error(`Unknown state.`)}let r=this._state;this._state=e;let i=this.connectResolve,a=this.connectReject;r===V.Connecting&&(this.connectPromise=void 0,this.connectResolve=void 0,this.connectReject=void 0);let o=this.disconnectResolve,s=this.disconnectReject;if(r===V.Disconnecting&&(this.disconnectPromise=void 0,this.disconnectResolve=void 0,this.disconnectReject=void 0),this.connectTimeout&&=(clearTimeout(this.connectTimeout),void 0),this.logger.log(`Transitioned from ${r} to ${this._state}`),this._stateEventEmitter.emit(this._state),e===V.Connected&&(this.startSendingKeepAlives(),this.onConnect))try{this.onConnect()}catch(e){throw this.logger.error(e.toString()),this.logger.error(`Exception thrown by onConnect callback`),e}if(r===V.Connected&&(this.stopSendingKeepAlives(),this.onDisconnect))try{t?this.onDisconnect(t):this.onDisconnect()}catch(e){throw this.logger.error(e.toString()),this.logger.error(`Exception thrown by onDisconnect callback`),e}if(r===V.Connecting){if(!i)throw Error(`Connect resolve undefined.`);if(!a)throw Error(`Connect reject undefined.`);e===V.Connected?i():a(t||Error(`Connect aborted.`))}if(r===V.Disconnecting){if(!o)throw Error(`Disconnect resolve undefined.`);if(!s)throw Error(`Disconnect reject undefined.`);e===V.Disconnected?o():s(t||Error(`Disconnect aborted.`))}this.transitioningState=!1}clearKeepAliveTimeout(){this.keepAliveDebounceTimeout&&clearTimeout(this.keepAliveDebounceTimeout),this.keepAliveDebounceTimeout=void 0}sendKeepAlive(){return this.keepAliveDebounceTimeout?Promise.resolve():(this.keepAliveDebounceTimeout=setTimeout(()=>{this.clearKeepAliveTimeout()},this.configuration.keepAliveDebounce*1e3),this.send(`\r
56
56
  \r
57
- `))}startSendingKeepAlives(){this.configuration.keepAliveInterval&&!this.keepAliveInterval&&(this.keepAliveInterval=setInterval(()=>{this.sendKeepAlive(),this.startSendingKeepAlives()},(e=>{let t=e*.8;return 1e3*(Math.random()*(e-t)+t)})(this.configuration.keepAliveInterval)))}stopSendingKeepAlives(){this.keepAliveInterval&&clearInterval(this.keepAliveInterval),this.keepAliveDebounceTimeout&&clearTimeout(this.keepAliveDebounceTimeout),this.keepAliveInterval=void 0,this.keepAliveDebounceTimeout=void 0}};Ot.defaultOptions={server:``,connectionTimeout:5,keepAliveInterval:0,keepAliveDebounce:10,traceSip:!0};var kt=class e{constructor(t={}){if(this._publishers={},this._registerers={},this._sessions={},this._subscriptions={},this._state=je.Stopped,this._stateEventEmitter=new T,this.delegate=t.delegate,this.options=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},e.defaultOptions()),{sipjsId:ae(5)}),{uri:new te(`sip`,`anonymous.`+ae(6),`anonymous.invalid`)}),{viaHost:ae(12)+`.invalid`}),e.stripUndefinedProperties(t)),this.options.hackIpInContact)if(typeof this.options.hackIpInContact==`boolean`&&this.options.hackIpInContact){let e=Math.floor(Math.random()*254+1);this.options.viaHost=`192.0.2.`+e}else this.options.hackIpInContact&&(this.options.viaHost=this.options.hackIpInContact);switch(this.loggerFactory=new Ie,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=V.error;break;case`warn`:this.loggerFactory.level=V.warn;break;case`log`:this.loggerFactory.level=V.log;break;case`debug`:this.loggerFactory.level=V.debug;break;default:break}if(this.options.logConfiguration&&(this.logger.log(`Configuration:`),Object.keys(this.options).forEach(e=>{let t=this.options[e];switch(e){case`uri`:case`sessionDescriptionHandlerFactory`:this.logger.log(`· `+e+`: `+t);break;case`authorizationPassword`:this.logger.log(`· `+e+`: NOT SHOWN`);break;case`transportConstructor`:this.logger.log(`· `+e+`: `+t.name);break;default:this.logger.log(`· `+e+`: `+JSON.stringify(t))}})),this.options.transportOptions){let e=this.options.transportOptions,n=e.maxReconnectionAttempts,r=e.reconnectionTimeout;n!==void 0&&this.logger.warn(`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.`),r!==void 0&&this.logger.warn(`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.`),t.reconnectionDelay===void 0&&r!==void 0&&(this.options.reconnectionDelay=r),t.reconnectionAttempts===void 0&&n!==void 0&&(this.options.reconnectionAttempts=n)}if(t.reconnectionDelay!==void 0&&this.logger.warn(`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.`),t.reconnectionAttempts!==void 0&&this.logger.warn(`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._transport=new this.options.transportConstructor(this.getLogger(`sip.Transport`),this.options.transportOptions),this.initTransportCallbacks(),this._contact=this.initContact(),this._instanceId=this.options.instanceId?this.options.instanceId:e.newUUID(),A.parse(this._instanceId,`uuid`)===-1)throw Error(`Invalid instanceId.`);this._userAgentCore=this.initCore()}static makeURI(e){return A.URIParse(e)}static defaultOptions(){return{allowLegacyNotifications:!1,authorizationHa1:``,authorizationPassword:``,authorizationUsername:``,delegate:{},contactName:``,contactParams:{transport:`ws`},displayName:``,forceRport:!1,gracefulShutdown:!0,hackAllowUnregisteredOptionTags:!1,hackIpInContact:!1,hackViaTcp:!1,instanceId:``,instanceIdAlwaysAdded:!1,logBuiltinEnabled:!0,logConfiguration:!0,logConnector:()=>{},logLevel:`log`,noAnswerTimeout:60,preloadedRouteSet:[],reconnectionAttempts:0,reconnectionDelay:4,sendInitialProvisionalResponse:!0,sessionDescriptionHandlerFactory:Dt(),sessionDescriptionHandlerFactoryOptions:{},sipExtension100rel:Ee.Unsupported,sipExtensionReplaces:Ee.Unsupported,sipExtensionExtraSupported:[],sipjsId:``,transportConstructor:Ot,transportOptions:{},uri:new te(`sip`,`anonymous`,`anonymous.invalid`),userAgentString:`SIP.js/0.21.1`,viaHost:``}}static newUUID(){return`xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`.replace(/[xy]/g,e=>{let t=Math.floor(Math.random()*16);return(e===`x`?t:t%4+8).toString(16)})}static stripUndefinedProperties(e){return Object.keys(e).reduce((t,n)=>(e[n]!==void 0&&(t[n]=e[n]),t),{})}get configuration(){return this.options}get contact(){return this._contact}get instanceId(){return this._instanceId}get state(){return this._state}get stateChange(){return this._stateEventEmitter}get transport(){return this._transport}get userAgentCore(){return this._userAgentCore}getLogger(e,t){return this.loggerFactory.getLogger(e,t)}getLoggerFactory(){return this.loggerFactory}isConnected(){return this.transport.isConnected()}reconnect(){return this.state===je.Stopped?Promise.reject(Error(`User agent stopped.`)):Promise.resolve().then(()=>this.transport.connect())}start(){return this.state===je.Started?(this.logger.warn(`User agent already started`),Promise.resolve()):(this.logger.log(`Starting ${this.configuration.uri}`),this.transitionState(je.Started),this.transport.connect())}async stop(){if(this.state===je.Stopped)return this.logger.warn(`User agent already stopped`),Promise.resolve();if(this.logger.log(`Stopping ${this.configuration.uri}`),!this.options.gracefulShutdown)return this.logger.log(`Dispose of transport`),this.transport.dispose().catch(e=>{throw this.logger.error(e.message),e}),this.logger.log(`Dispose of core`),this.userAgentCore.dispose(),this._publishers={},this._registerers={},this._sessions={},this._subscriptions={},this.transitionState(je.Stopped),Promise.resolve();let e=Object.assign({},this._publishers),t=Object.assign({},this._registerers),n=Object.assign({},this._sessions),r=Object.assign({},this._subscriptions),i=this.transport,a=this.userAgentCore;for(let e in this.logger.log(`Dispose of registerers`),t)t[e]&&await t[e].dispose().catch(t=>{throw this.logger.error(t.message),delete this._registerers[e],t});for(let e in this.logger.log(`Dispose of sessions`),n)n[e]&&await n[e].dispose().catch(t=>{throw this.logger.error(t.message),delete this._sessions[e],t});for(let e in this.logger.log(`Dispose of subscriptions`),r)r[e]&&await r[e].dispose().catch(t=>{throw this.logger.error(t.message),delete this._subscriptions[e],t});for(let t in this.logger.log(`Dispose of publishers`),e)e[t]&&await e[t].dispose().catch(e=>{throw this.logger.error(e.message),delete this._publishers[t],e});this.logger.log(`Dispose of transport`),await i.dispose().catch(e=>{throw this.logger.error(e.message),e}),this.logger.log(`Dispose of core`),a.dispose(),this.transitionState(je.Stopped)}_makeInviter(e,t){return new ke(this,e,t)}attemptReconnection(e=1){let t=this.options.reconnectionAttempts,n=this.options.reconnectionDelay;if(e>t){this.logger.log(`Maximum reconnection attempts reached`);return}this.logger.log(`Reconnection attempt ${e} of ${t} - trying`),setTimeout(()=>{this.reconnect().then(()=>{this.logger.log(`Reconnection attempt ${e} of ${t} - succeeded`)}).catch(n=>{this.logger.error(n.message),this.logger.log(`Reconnection attempt ${e} of ${t} - failed`),this.attemptReconnection(++e)})},e===1?0:n*1e3)}initContact(){let e=this.options.contactName===``?ae(8):this.options.contactName,t=this.options.contactParams;return{pubGruu:void 0,tempGruu:void 0,uri:new te(`sip`,e,this.options.viaHost,void 0,t),toString:(e={})=>{let n=e.anonymous||!1,r=e.outbound||!1,i=e.register||!1,a=`<`;return n?a+=this.contact.tempGruu||`sip:anonymous@anonymous.invalid;transport=${t.transport?t.transport:`ws`}`:i?a+=this.contact.uri:a+=this.contact.pubGruu||this.contact.uri,r&&(a+=`;ob`),a+=`>`,this.options.instanceIdAlwaysAdded&&(a+=`;+sip.instance="<urn:uuid:`+this._instanceId+`>"`),a}}}initCore(){let e=[];e.push(`outbound`),this.options.sipExtension100rel===Ee.Supported&&e.push(`100rel`),this.options.sipExtensionReplaces===Ee.Supported&&e.push(`replaces`),this.options.sipExtensionExtraSupported&&e.push(...this.options.sipExtensionExtraSupported),this.options.hackAllowUnregisteredOptionTags||(e=e.filter(e=>De[e])),e=Array.from(new Set(e));let t=e.slice();return(this.contact.pubGruu||this.contact.tempGruu)&&t.push(`gruu`),new Ct({aor:this.options.uri,contact:this.contact,displayName:this.options.displayName,loggerFactory:this.loggerFactory,hackViaTcp:this.options.hackViaTcp,routeSet:this.options.preloadedRouteSet,supportedOptionTags:e,supportedOptionTagsResponse:t,sipjsId:this.options.sipjsId,userAgentHeaderFieldValue:this.options.userAgentString,viaForceRport:this.options.forceRport,viaHost:this.options.viaHost,authenticationFactory:()=>{let e=this.options.authorizationUsername?this.options.authorizationUsername:this.options.uri.user,t=this.options.authorizationPassword?this.options.authorizationPassword:void 0,n=this.options.authorizationHa1?this.options.authorizationHa1:void 0;return new Pe(this.getLoggerFactory(),n,e,t)},transportAccessor:()=>this.transport},{onInvite:e=>{let t=new Oe(this,e);if(e.delegate={onCancel:e=>{t._onCancel(e)},onTransportError:e=>{this.logger.error(`A transport error has occurred while handling an incoming INVITE request.`)}},e.trying(),this.options.sipExtensionReplaces!==Ee.Unsupported){let n=e.message.parseHeader(`replaces`);if(n){let e=n.call_id;if(typeof e!=`string`)throw Error(`Type of call id is not string`);let r=n.replaces_to_tag;if(typeof r!=`string`)throw Error(`Type of to tag is not string`);let i=n.replaces_from_tag;if(typeof i!=`string`)throw Error(`type of from tag is not string`);let a=e+r+i,o=this.userAgentCore.dialogs.get(a);if(!o){t.reject({statusCode:481});return}if(!o.early&&n.early_only===!0){t.reject({statusCode:486});return}let s=this._sessions[e+i]||this._sessions[e+r]||void 0;if(!s)throw Error(`Session does not exist.`);t._replacee=s}}if(this.delegate?.onInvite){if(t.autoSendAnInitialProvisionalResponse){t.progress().then(()=>{if(this.delegate?.onInvite===void 0)throw Error(`onInvite undefined.`);this.delegate.onInvite(t)});return}this.delegate.onInvite(t);return}t.reject({statusCode:486})},onMessage:e=>{if(this.delegate&&this.delegate.onMessage){let t=new Se(e);this.delegate.onMessage(t)}else e.accept()},onNotify:e=>{if(this.delegate&&this.delegate.onNotify){let t=new Ce(e);this.delegate.onNotify(t)}else this.options.allowLegacyNotifications?e.accept():e.reject({statusCode:481})},onRefer:e=>{this.logger.warn(`Received an out of dialog REFER request`),this.delegate&&this.delegate.onReferRequest?this.delegate.onReferRequest(e):e.reject({statusCode:405})},onRegister:e=>{this.logger.warn(`Received an out of dialog REGISTER request`),this.delegate&&this.delegate.onRegisterRequest?this.delegate.onRegisterRequest(e):e.reject({statusCode:405})},onSubscribe:e=>{this.logger.warn(`Received an out of dialog SUBSCRIBE request`),this.delegate&&this.delegate.onSubscribeRequest?this.delegate.onSubscribeRequest(e):e.reject({statusCode:405})}})}initTransportCallbacks(){this.transport.onConnect=()=>this.onTransportConnect(),this.transport.onDisconnect=e=>this.onTransportDisconnect(e),this.transport.onMessage=e=>this.onTransportMessage(e)}onTransportConnect(){this.state!==je.Stopped&&this.delegate&&this.delegate.onConnect&&this.delegate.onConnect()}onTransportDisconnect(e){this.state!==je.Stopped&&(this.delegate&&this.delegate.onDisconnect&&this.delegate.onDisconnect(e),e&&this.options.reconnectionAttempts>0&&this.attemptReconnection())}onTransportMessage(e){let t=Le.parseMessage(e,this.getLogger(`sip.Parser`));if(!t){this.logger.warn(`Failed to parse incoming message. Dropping.`);return}if(this.state===je.Stopped&&t instanceof ue){this.logger.warn(`Received ${t.method} request while stopped. Dropping.`);return}let n=()=>{for(let e of[`from`,`to`,`call_id`,`cseq`,`via`])if(!t.hasHeader(e))return this.logger.warn(`Missing mandatory header field : ${e}.`),!1;return!0};if(t instanceof ue){if(!n()){this.logger.warn(`Request missing mandatory header field. Dropping.`);return}if(!t.toTag&&t.callId.substr(0,5)===this.options.sipjsId){this.userAgentCore.replyStateless(t,{statusCode:482});return}let e=M(t.body),r=t.getHeader(`content-length`);if(r&&e<Number(r)){this.userAgentCore.replyStateless(t,{statusCode:400});return}}if(t instanceof de){if(!n()){this.logger.warn(`Response missing mandatory header field. Dropping.`);return}if(t.getHeaders(`via`).length>1){this.logger.warn(`More than one Via header field present in the response. Dropping.`);return}if(t.via.host!==this.options.viaHost||t.via.port!==void 0){this.logger.warn(`Via sent-by in the response does not match UA Via host value. Dropping.`);return}let e=M(t.body),r=t.getHeader(`content-length`);if(r&&e<Number(r)){this.logger.warn(`Message body length is lower than the value in Content-Length header field. Dropping.`);return}}if(t instanceof ue){this.userAgentCore.receiveIncomingRequestFromTransport(t);return}if(t instanceof de){this.userAgentCore.receiveIncomingResponseFromTransport(t);return}throw Error(`Invalid message type.`)}transitionState(e,t){let n=()=>{throw Error(`Invalid state transition from ${this._state} to ${e}`)};switch(this._state){case je.Started:e!==je.Stopped&&n();break;case je.Stopped:e!==je.Started&&n();break;default:throw Error(`Unknown state.`)}this.logger.log(`Transitioned from ${this._state} to ${e}`),this._state=e,this._stateEventEmitter.emit(this._state)}},U=new window.AudioContext,At={1:[697,1209],2:[697,1336],3:[697,1477],A:[697,1633],4:[770,1209],5:[770,1336],6:[770,1477],B:[770,1633],7:[852,1209],8:[852,1336],9:[852,1477],C:[852,1633],"*":[941,1209],0:[941,1336],"#":[941,1477],D:[941,1633]},jt=(0,t.ref)(null),Mt=(0,t.ref)(null),Nt=(0,t.ref)(.5);let Pt=()=>({playDtmf:(e,t=150)=>{U.state===`suspended`&&U.resume();let n=At[e.toUpperCase()];if(!n)return;let r=U.createOscillator(),i=U.createOscillator(),a=U.createGain();r.frequency.value=n[0],i.frequency.value=n[1],r.type=`sine`,i.type=`sine`,a.gain.value=.1*Nt.value,r.connect(a),i.connect(a),a.connect(U.destination),r.start(),i.start(),setTimeout(()=>{r.stop(),i.stop(),r.disconnect(),i.disconnect(),a.disconnect()},t)},startRingtone:()=>{if(jt.value)return;U.state===`suspended`&&U.resume();let e=()=>{let e=U.currentTime,t=U.createOscillator(),n=U.createGain();t.type=`sine`,t.frequency.setValueAtTime(523.25,e),t.frequency.setValueAtTime(659.25,e+.1),t.frequency.setValueAtTime(783.99,e+.2),n.gain.setValueAtTime(.1*Nt.value,e),n.gain.exponentialRampToValueAtTime(.001,e+.5),t.connect(n),n.connect(U.destination),t.start(e),t.stop(e+.5)};e(),jt.value=window.setInterval(()=>{e(),setTimeout(e,400)},3e3)},stopRingtone:()=>{jt.value&&=(clearInterval(jt.value),null)},startRingback:()=>{if(Mt.value)return;U.state===`suspended`&&U.resume();let e=()=>{let e=U.currentTime,t=U.createOscillator(),n=U.createGain();t.type=`sine`,t.frequency.value=425,n.gain.setValueAtTime(.1*Nt.value,e),n.gain.linearRampToValueAtTime(.1*Nt.value,e+1),n.gain.linearRampToValueAtTime(0,e+1.1),t.connect(n),n.connect(U.destination),t.start(e),t.stop(e+1.1)};e(),Mt.value=window.setInterval(()=>{e()},4e3)},stopRingback:()=>{Mt.value&&=(clearInterval(Mt.value),null)},setNotificationVolume:e=>{Nt.value=Math.max(0,Math.min(1,e/100))}});function Ft(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Ft(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function It(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Ft(e))&&(r&&(r+=` `),r+=t);return r}var Lt=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},Rt=(e,t)=>({classGroupId:e,validator:t}),zt=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Bt=`-`,Vt=[],Ht=`arbitrary..`,Ut=e=>{let t=Kt(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return Gt(e);let n=e.split(Bt);return Wt(n,n[0]===``&&n.length>1?1:0,t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?Lt(i,t):t:i||Vt}return n[e]||Vt}}},Wt=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=Wt(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(Bt):e.slice(t).join(Bt),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},Gt=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?Ht+r:void 0})(),Kt=e=>{let{theme:t,classGroups:n}=e;return qt(n,t)},qt=(e,t)=>{let n=zt();for(let r in e){let i=e[r];Jt(i,n,r,t)}return n},Jt=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];Yt(i,t,n,r)}},Yt=(e,t,n,r)=>{if(typeof e==`string`){Xt(e,t,n);return}if(typeof e==`function`){Zt(e,t,n,r);return}Qt(e,t,n,r)},Xt=(e,t,n)=>{let r=e===``?t:$t(t,e);r.classGroupId=n},Zt=(e,t,n,r)=>{if(en(e)){Jt(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(Rt(n,e))},Qt=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];Jt(o,$t(t,a),n,r)}},$t=(e,t)=>{let n=e,r=t.split(Bt),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=zt(),n.nextPart.set(t,i)),n=i}return n},en=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,tn=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},nn=`!`,rn=`:`,an=[],on=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),sn=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===rn){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(nn)?(c=s.slice(0,-1),l=!0):s.startsWith(nn)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return on(t,l,c,u)};if(t){let e=t+rn,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):on(an,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},cn=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},ln=e=>({cache:tn(e.cacheSize),parseClassName:sn(e),sortModifiers:cn(e),...Ut(e)}),un=/\s+/,dn=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a}=t,o=[],s=e.trim().split(un),c=``;for(let e=s.length-1;e>=0;--e){let t=s[e],{isExternal:l,modifiers:u,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:p}=n(t);if(l){c=t+(c.length>0?` `+c:c);continue}let m=!!p,h=r(m?f.substring(0,p):f);if(!h){if(!m){c=t+(c.length>0?` `+c:c);continue}if(h=r(f),!h){c=t+(c.length>0?` `+c:c);continue}m=!1}let g=u.length===0?``:u.length===1?u[0]:a(u).join(`:`),_=d?g+nn:g,v=_+h;if(o.indexOf(v)>-1)continue;o.push(v);let y=i(h,m);for(let e=0;e<y.length;++e){let t=y[e];o.push(_+t)}c=t+(c.length>0?` `+c:c)}return c},fn=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=pn(n))&&(i&&(i+=` `),i+=r);return i},pn=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=pn(e[r]))&&(n&&(n+=` `),n+=t);return n},mn=(e,...t)=>{let n,r,i,a,o=o=>(n=ln(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=dn(e,n);return i(e,a),a};return a=o,(...e)=>a(fn(...e))},hn=[],W=e=>{let t=t=>t[e]||hn;return t.isThemeGetter=!0,t},gn=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,_n=/^\((?:(\w[\w-]*):)?(.+)\)$/i,vn=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,yn=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,bn=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,xn=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Sn=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Cn=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,wn=e=>vn.test(e),G=e=>!!e&&!Number.isNaN(Number(e)),Tn=e=>!!e&&Number.isInteger(Number(e)),En=e=>e.endsWith(`%`)&&G(e.slice(0,-1)),Dn=e=>yn.test(e),On=()=>!0,kn=e=>bn.test(e)&&!xn.test(e),An=()=>!1,jn=e=>Sn.test(e),Mn=e=>Cn.test(e),Nn=e=>!K(e)&&!q(e),Pn=e=>Yn(e,$n,An),K=e=>gn.test(e),Fn=e=>Yn(e,er,kn),In=e=>Yn(e,tr,G),Ln=e=>Yn(e,rr,On),Rn=e=>Yn(e,nr,An),zn=e=>Yn(e,Zn,An),Bn=e=>Yn(e,Qn,Mn),Vn=e=>Yn(e,ir,jn),q=e=>_n.test(e),Hn=e=>Xn(e,er),Un=e=>Xn(e,nr),Wn=e=>Xn(e,Zn),Gn=e=>Xn(e,$n),Kn=e=>Xn(e,Qn),qn=e=>Xn(e,ir,!0),Jn=e=>Xn(e,rr,!0),Yn=(e,t,n)=>{let r=gn.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Xn=(e,t,n=!1)=>{let r=_n.exec(e);return r?r[1]?t(r[1]):n:!1},Zn=e=>e===`position`||e===`percentage`,Qn=e=>e===`image`||e===`url`,$n=e=>e===`length`||e===`size`||e===`bg-size`,er=e=>e===`length`,tr=e=>e===`number`,nr=e=>e===`family-name`,rr=e=>e===`number`||e===`weight`,ir=e=>e===`shadow`,ar=mn(()=>{let e=W(`color`),t=W(`font`),n=W(`text`),r=W(`font-weight`),i=W(`tracking`),a=W(`leading`),o=W(`breakpoint`),s=W(`container`),c=W(`spacing`),l=W(`radius`),u=W(`shadow`),d=W(`inset-shadow`),f=W(`text-shadow`),p=W(`drop-shadow`),m=W(`blur`),h=W(`perspective`),g=W(`aspect`),_=W(`ease`),v=W(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),q,K],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[q,K,c],T=()=>[wn,`full`,`auto`,...w()],E=()=>[Tn,`none`,`subgrid`,q,K],ee=()=>[`auto`,{span:[`full`,Tn,q,K]},Tn,q,K],D=()=>[Tn,`auto`,q,K],te=()=>[`auto`,`min`,`max`,`fr`,q,K],O=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],ne=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],k=()=>[`auto`,...w()],re=()=>[wn,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],ie=()=>[wn,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],A=()=>[wn,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],j=()=>[e,q,K],ae=()=>[...b(),Wn,zn,{position:[q,K]}],oe=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],se=()=>[`auto`,`cover`,`contain`,Gn,Pn,{size:[q,K]}],ce=()=>[En,Hn,Fn],M=()=>[``,`none`,`full`,l,q,K],le=()=>[``,G,Hn,Fn],ue=()=>[`solid`,`dashed`,`dotted`,`double`],de=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],N=()=>[G,En,Wn,zn],fe=()=>[``,`none`,m,q,K],pe=()=>[`none`,G,q,K],me=()=>[`none`,G,q,K],he=()=>[G,q,K],ge=()=>[wn,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[Dn],breakpoint:[Dn],color:[On],container:[Dn],"drop-shadow":[Dn],ease:[`in`,`out`,`in-out`],font:[Nn],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[Dn],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[Dn],shadow:[Dn],spacing:[`px`,G],text:[Dn],"text-shadow":[Dn],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,wn,K,q,g]}],container:[`container`],columns:[{columns:[G,K,q,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[Tn,`auto`,q,K]}],basis:[{basis:[wn,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[G,wn,`auto`,`initial`,`none`,K]}],grow:[{grow:[``,G,q,K]}],shrink:[{shrink:[``,G,q,K]}],order:[{order:[Tn,`first`,`last`,`none`,q,K]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:ee()}],"col-start":[{"col-start":D()}],"col-end":[{"col-end":D()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:ee()}],"row-start":[{"row-start":D()}],"row-end":[{"row-end":D()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":te()}],"auto-rows":[{"auto-rows":te()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...O(),`normal`]}],"justify-items":[{"justify-items":[...ne(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...ne()]}],"align-content":[{content:[`normal`,...O()]}],"align-items":[{items:[...ne(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...ne(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":O()}],"place-items":[{"place-items":[...ne(),`baseline`]}],"place-self":[{"place-self":[`auto`,...ne()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:k()}],mx:[{mx:k()}],my:[{my:k()}],ms:[{ms:k()}],me:[{me:k()}],mbs:[{mbs:k()}],mbe:[{mbe:k()}],mt:[{mt:k()}],mr:[{mr:k()}],mb:[{mb:k()}],ml:[{ml:k()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:re()}],"inline-size":[{inline:[`auto`,...ie()]}],"min-inline-size":[{"min-inline":[`auto`,...ie()]}],"max-inline-size":[{"max-inline":[`none`,...ie()]}],"block-size":[{block:[`auto`,...A()]}],"min-block-size":[{"min-block":[`auto`,...A()]}],"max-block-size":[{"max-block":[`none`,...A()]}],w:[{w:[s,`screen`,...re()]}],"min-w":[{"min-w":[s,`screen`,`none`,...re()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...re()]}],h:[{h:[`screen`,`lh`,...re()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...re()]}],"max-h":[{"max-h":[`screen`,`lh`,...re()]}],"font-size":[{text:[`base`,n,Hn,Fn]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,Jn,Ln]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,En,K]}],"font-family":[{font:[Un,Rn,t]}],"font-features":[{"font-features":[K]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,q,K]}],"line-clamp":[{"line-clamp":[G,`none`,q,In]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,q,K]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,q,K]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:j()}],"text-color":[{text:j()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...ue(),`wavy`]}],"text-decoration-thickness":[{decoration:[G,`from-font`,`auto`,q,Fn]}],"text-decoration-color":[{decoration:j()}],"underline-offset":[{"underline-offset":[G,`auto`,q,K]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,q,K]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,q,K]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:ae()}],"bg-repeat":[{bg:oe()}],"bg-size":[{bg:se()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},Tn,q,K],radial:[``,q,K],conic:[Tn,q,K]},Kn,Bn]}],"bg-color":[{bg:j()}],"gradient-from-pos":[{from:ce()}],"gradient-via-pos":[{via:ce()}],"gradient-to-pos":[{to:ce()}],"gradient-from":[{from:j()}],"gradient-via":[{via:j()}],"gradient-to":[{to:j()}],rounded:[{rounded:M()}],"rounded-s":[{"rounded-s":M()}],"rounded-e":[{"rounded-e":M()}],"rounded-t":[{"rounded-t":M()}],"rounded-r":[{"rounded-r":M()}],"rounded-b":[{"rounded-b":M()}],"rounded-l":[{"rounded-l":M()}],"rounded-ss":[{"rounded-ss":M()}],"rounded-se":[{"rounded-se":M()}],"rounded-ee":[{"rounded-ee":M()}],"rounded-es":[{"rounded-es":M()}],"rounded-tl":[{"rounded-tl":M()}],"rounded-tr":[{"rounded-tr":M()}],"rounded-br":[{"rounded-br":M()}],"rounded-bl":[{"rounded-bl":M()}],"border-w":[{border:le()}],"border-w-x":[{"border-x":le()}],"border-w-y":[{"border-y":le()}],"border-w-s":[{"border-s":le()}],"border-w-e":[{"border-e":le()}],"border-w-bs":[{"border-bs":le()}],"border-w-be":[{"border-be":le()}],"border-w-t":[{"border-t":le()}],"border-w-r":[{"border-r":le()}],"border-w-b":[{"border-b":le()}],"border-w-l":[{"border-l":le()}],"divide-x":[{"divide-x":le()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":le()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...ue(),`hidden`,`none`]}],"divide-style":[{divide:[...ue(),`hidden`,`none`]}],"border-color":[{border:j()}],"border-color-x":[{"border-x":j()}],"border-color-y":[{"border-y":j()}],"border-color-s":[{"border-s":j()}],"border-color-e":[{"border-e":j()}],"border-color-bs":[{"border-bs":j()}],"border-color-be":[{"border-be":j()}],"border-color-t":[{"border-t":j()}],"border-color-r":[{"border-r":j()}],"border-color-b":[{"border-b":j()}],"border-color-l":[{"border-l":j()}],"divide-color":[{divide:j()}],"outline-style":[{outline:[...ue(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[G,q,K]}],"outline-w":[{outline:[``,G,Hn,Fn]}],"outline-color":[{outline:j()}],shadow:[{shadow:[``,`none`,u,qn,Vn]}],"shadow-color":[{shadow:j()}],"inset-shadow":[{"inset-shadow":[`none`,d,qn,Vn]}],"inset-shadow-color":[{"inset-shadow":j()}],"ring-w":[{ring:le()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:j()}],"ring-offset-w":[{"ring-offset":[G,Fn]}],"ring-offset-color":[{"ring-offset":j()}],"inset-ring-w":[{"inset-ring":le()}],"inset-ring-color":[{"inset-ring":j()}],"text-shadow":[{"text-shadow":[`none`,f,qn,Vn]}],"text-shadow-color":[{"text-shadow":j()}],opacity:[{opacity:[G,q,K]}],"mix-blend":[{"mix-blend":[...de(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":de()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[G]}],"mask-image-linear-from-pos":[{"mask-linear-from":N()}],"mask-image-linear-to-pos":[{"mask-linear-to":N()}],"mask-image-linear-from-color":[{"mask-linear-from":j()}],"mask-image-linear-to-color":[{"mask-linear-to":j()}],"mask-image-t-from-pos":[{"mask-t-from":N()}],"mask-image-t-to-pos":[{"mask-t-to":N()}],"mask-image-t-from-color":[{"mask-t-from":j()}],"mask-image-t-to-color":[{"mask-t-to":j()}],"mask-image-r-from-pos":[{"mask-r-from":N()}],"mask-image-r-to-pos":[{"mask-r-to":N()}],"mask-image-r-from-color":[{"mask-r-from":j()}],"mask-image-r-to-color":[{"mask-r-to":j()}],"mask-image-b-from-pos":[{"mask-b-from":N()}],"mask-image-b-to-pos":[{"mask-b-to":N()}],"mask-image-b-from-color":[{"mask-b-from":j()}],"mask-image-b-to-color":[{"mask-b-to":j()}],"mask-image-l-from-pos":[{"mask-l-from":N()}],"mask-image-l-to-pos":[{"mask-l-to":N()}],"mask-image-l-from-color":[{"mask-l-from":j()}],"mask-image-l-to-color":[{"mask-l-to":j()}],"mask-image-x-from-pos":[{"mask-x-from":N()}],"mask-image-x-to-pos":[{"mask-x-to":N()}],"mask-image-x-from-color":[{"mask-x-from":j()}],"mask-image-x-to-color":[{"mask-x-to":j()}],"mask-image-y-from-pos":[{"mask-y-from":N()}],"mask-image-y-to-pos":[{"mask-y-to":N()}],"mask-image-y-from-color":[{"mask-y-from":j()}],"mask-image-y-to-color":[{"mask-y-to":j()}],"mask-image-radial":[{"mask-radial":[q,K]}],"mask-image-radial-from-pos":[{"mask-radial-from":N()}],"mask-image-radial-to-pos":[{"mask-radial-to":N()}],"mask-image-radial-from-color":[{"mask-radial-from":j()}],"mask-image-radial-to-color":[{"mask-radial-to":j()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[G]}],"mask-image-conic-from-pos":[{"mask-conic-from":N()}],"mask-image-conic-to-pos":[{"mask-conic-to":N()}],"mask-image-conic-from-color":[{"mask-conic-from":j()}],"mask-image-conic-to-color":[{"mask-conic-to":j()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:ae()}],"mask-repeat":[{mask:oe()}],"mask-size":[{mask:se()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,q,K]}],filter:[{filter:[``,`none`,q,K]}],blur:[{blur:fe()}],brightness:[{brightness:[G,q,K]}],contrast:[{contrast:[G,q,K]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,qn,Vn]}],"drop-shadow-color":[{"drop-shadow":j()}],grayscale:[{grayscale:[``,G,q,K]}],"hue-rotate":[{"hue-rotate":[G,q,K]}],invert:[{invert:[``,G,q,K]}],saturate:[{saturate:[G,q,K]}],sepia:[{sepia:[``,G,q,K]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,q,K]}],"backdrop-blur":[{"backdrop-blur":fe()}],"backdrop-brightness":[{"backdrop-brightness":[G,q,K]}],"backdrop-contrast":[{"backdrop-contrast":[G,q,K]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,G,q,K]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[G,q,K]}],"backdrop-invert":[{"backdrop-invert":[``,G,q,K]}],"backdrop-opacity":[{"backdrop-opacity":[G,q,K]}],"backdrop-saturate":[{"backdrop-saturate":[G,q,K]}],"backdrop-sepia":[{"backdrop-sepia":[``,G,q,K]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,q,K]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[G,`initial`,q,K]}],ease:[{ease:[`linear`,`initial`,_,q,K]}],delay:[{delay:[G,q,K]}],animate:[{animate:[`none`,v,q,K]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,q,K]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:pe()}],"rotate-x":[{"rotate-x":pe()}],"rotate-y":[{"rotate-y":pe()}],"rotate-z":[{"rotate-z":pe()}],scale:[{scale:me()}],"scale-x":[{"scale-x":me()}],"scale-y":[{"scale-y":me()}],"scale-z":[{"scale-z":me()}],"scale-3d":[`scale-3d`],skew:[{skew:he()}],"skew-x":[{"skew-x":he()}],"skew-y":[{"skew-y":he()}],transform:[{transform:[q,K,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:ge()}],"translate-x":[{"translate-x":ge()}],"translate-y":[{"translate-y":ge()}],"translate-z":[{"translate-z":ge()}],"translate-none":[`translate-none`],accent:[{accent:j()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:j()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,q,K]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,q,K]}],fill:[{fill:[`none`,...j()]}],"stroke-w":[{stroke:[G,Hn,Fn,In]}],stroke:[{stroke:[`none`,...j()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});let J=(...e)=>ar(It(e)),or=(e,t)=>{if(e){let t=sr(e);if(t&&cr(t))return t;if(e.trim())return e.trim()}if(t){let e=sr(t);if(e&&cr(e))return e;let n=lr(t);if(n)return n;if(t.trim()&&!t.includes(`@`))return t.trim()}return`Unknown`};var sr=e=>e.replace(/[^\d+*#]/g,``),cr=e=>/^\+?[\d*#]{2,}$/.test(e),lr=e=>{let t=e.match(/^([+]?[\d*#]{2,})\s*[-:]/);return t&&t[1]||(t=e.match(/\(([+]?[\d*#]{2,})\)/),t&&t[1])||(t=e.match(/(?:ext\.?|extension)\s*([+]?[\d*#]{2,})/i),t&&t[1])?t[1]:(t=e.match(/([+]?\d{1,3}[-.\s]?\(?\d{1,4}\)?[-.\s]?\d{1,4}[-.\s]?\d{1,9})/),t&&t[1]?sr(t[1]):null)};let ur=e=>{let n=(0,t.shallowRef)(null),r=(0,t.shallowRef)(null),i=(0,t.shallowRef)(new Map),a=new Audio;a.autoplay=!0;let o=(0,t.shallowRef)(void 0),s=(0,t.shallowRef)(null),c=(0,t.shallowRef)(null),l=null,u=null,d=(0,t.computed)(()=>n.value?.configuration.uri?.user||``),{startRingtone:f,stopRingtone:p,startRingback:m,stopRingback:h,setNotificationVolume:g}=Pt(),_=()=>{e.channels.value.some(e=>e.status===`incoming`)?f():p(),e.activeChannel.value?.status===`calling`?m():h()},v=e=>{a.volume=e/100},y=async e=>{typeof a.setSinkId==`function`&&await a.setSinkId(e)},b=e=>{o.value=e},x=(e=!1)=>{let t={echoCancellation:{ideal:!0},noiseSuppression:{ideal:!1},autoGainControl:{ideal:!1},channelCount:1};return o.value&&(t.deviceId={exact:o.value}),{audio:t,video:e}},S=async t=>{if(!n.value){try{(await navigator.mediaDevices.getUserMedia({audio:!0})).getTracks().forEach(e=>e.stop())}catch(e){console.error(`Microphone permission denied`,e);return}try{let i=kt.makeURI(t.uri);if(!i)throw Error(`Invalid URI`);n.value=new kt({uri:i,logLevel:`error`,transportOptions:{server:t.transportOptions.server},authorizationUsername:t.authorizationUsername,authorizationPassword:t.authorizationPassword,reconnectionDelay:5,reconnectionAttempts:3,delegate:{onConnect:()=>e.setConnected(!0),onDisconnect:()=>e.setConnected(!1),onInvite:e=>T(e)}}),await n.value.start(),r.value=new Ae(n.value),await r.value.register(),C()}catch{}}},C=()=>{let t=null,n=Date.now(),r=(e=1e3)=>{t&&clearTimeout(t),t=setTimeout(async()=>{t=null,await w()},e)},i=()=>{if(document.visibilityState===`visible`){let e=Date.now()-n;e>5e3?(console.log(`[SipJs] Device was suspended for ${Math.round(e/1e3)}s, reconnecting...`),r(1500)):r(500)}n=Date.now()},a=()=>{console.log(`[SipJs] Network online, reconnecting...`),r(1e3)},o=()=>{console.log(`[SipJs] Network offline`),e.setConnected(!1),t&&=(clearTimeout(t),null)},s=null,c=()=>{s=setInterval(()=>{let e=Date.now(),t=e-n;t>3e4&&(console.log(`[SipJs] Heartbeat drift detected (${Math.round(t/1e3)}s), device may have woken from sleep`),r(1500)),n=e},1e3)};document.addEventListener(`visibilitychange`,i),window.addEventListener(`online`,a),window.addEventListener(`offline`,o),document.addEventListener(`freeze`,()=>{console.log(`[SipJs] Page frozen`),s&&=(clearInterval(s),null)}),document.addEventListener(`resume`,()=>{console.log(`[SipJs] Page resumed`),n=Date.now(),c(),r(1e3)}),c()},w=async()=>{if(n.value){if(!navigator.onLine){console.log(`[SipJs] Skipping reconnect, device is offline`);return}if(i.value.size>0){console.log(`[SipJs] Skipping reconnect, active calls in progress`);return}try{if(n.value.isConnected()||(console.log(`[SipJs] Reconnecting...`),await n.value.reconnect()),r.value&&n.value.isConnected())try{await r.value.register()}catch{}}catch(e){console.error(`[SipJs] Reconnection failed:`,e)}}},T=t=>{console.log(`[SipJs] 📞 Llamada entrante recibida`),console.log(`[SipJs] Remote Identity URI:`,t.remoteIdentity.uri.toString()),console.log(`[SipJs] Remote Identity URI user:`,t.remoteIdentity.uri.user),console.log(`[SipJs] Remote Identity displayName:`,t.remoteIdentity.displayName);let n=e.channels.value.find(e=>e.status===`idle`);if(!n){console.warn(`[SipJs] ⚠️ No hay canales disponibles, rechazando llamada`),t.reject();return}let r=n.id;i.value.set(r,t);let a=t.body?t.body.includes(`m=video`):!1,o=or(t.remoteIdentity.uri.user,t.remoteIdentity.displayName);console.log(`[SipJs] 📋 Caller number extraído:`,o),console.log(`[SipJs] 🎥 Video:`,a?`Sí`:`No`),e.updateChannelState(r,{status:`incoming`,remoteNumber:o,remoteDisplayName:t.remoteIdentity.displayName||void 0,hasVideo:a}),_(),e.setActiveChannelId(r),t.stateChange.addListener(n=>{switch(n){case L.Terminated:{let n=e.channels.value.find(e=>e.id===r),a=or(t.remoteIdentity.uri.user,t.remoteIdentity.displayName);if(n?.status===`connected`){let t=Math.floor((Date.now()-(n.startTime||Date.now()))/1e3);e.addCallLog({number:a,direction:`incoming`,status:`answered`,startTime:n.startTime||Date.now(),duration:t})}else n?.status===`incoming`&&e.addCallLog({number:a,direction:`incoming`,status:`missed`,startTime:Date.now(),duration:0});e.updateChannelState(r,{status:`idle`,remoteNumber:``,isMuted:!1,isHeld:!1,hasVideo:!1,hasEarlyMedia:!1}),i.value.delete(r),e.activeChannelId.value===r&&se(),_();break}case L.Established:e.updateChannelState(r,{status:`connected`,startTime:Date.now()}),e.activeChannelId.value===r&&oe(t),_();break}})},E=async(t,r=!1)=>{if(!n.value)return;let a=e.activeChannelId.value;if(i.value.has(a))return;let o=kt.makeURI(t);if(!o&&n.value.configuration.uri){let e=n.value.configuration.uri.host;o=kt.makeURI(`sip:${t}@${e}`)}if(!o)return;let s=new ke(n.value,o);i.value.set(a,s),e.updateChannelState(a,{status:`calling`,remoteNumber:t,hasVideo:r}),e.setLastDialedNumber(t),_(),s.stateChange.addListener(n=>{switch(n){case L.Established:e.channels.value.find(e=>e.id===a)?.status!==`connected`&&(e.updateChannelState(a,{status:`connected`,startTime:Date.now()}),oe(s),_());break;case L.Terminated:{let n=e.channels.value.find(e=>e.id===a);if(n?.status===`connected`){let r=Math.floor((Date.now()-(n.startTime||Date.now()))/1e3);e.addCallLog({number:t,direction:`outgoing`,status:`answered`,startTime:n.startTime||Date.now(),duration:r})}else e.addCallLog({number:t,direction:`outgoing`,status:`cancelled`,startTime:Date.now(),duration:0});e.updateChannelState(a,{status:`idle`,remoteNumber:``,isMuted:!1,isHeld:!1,startTime:void 0,keypadValue:``,hasVideo:!1}),i.value.delete(a),e.activeChannelId.value===a&&se(),_();break}}});let c={sessionDescriptionHandlerOptions:{constraints:x(r)},requestDelegate:{onProgress:t=>{(t.message.statusCode===180||t.message.statusCode===183)&&(t.message.body&&(e.updateChannelState(a,{hasEarlyMedia:!0}),oe(s)),_())},onAccept:t=>{e.channels.value.find(e=>e.id===a)?.status!==`connected`&&(e.updateChannelState(a,{status:`connected`,startTime:Date.now()}),oe(s),_())}}};await s.invite(c)},ee=async(t=!1)=>{let n=i.value.get(e.activeChannelId.value);if(n instanceof Oe&&n.state===L.Initial){for(let[t,n]of i.value.entries())if(t!==e.activeChannelId.value&&n.state===L.Established&&!e.channels.value.find(e=>e.id===t)?.isHeld)try{await O(n,!0),e.updateChannelState(t,{isHeld:!0})}catch(e){console.error(`[SipJs] Failed to hold channel ${t}:`,e)}let r={sessionDescriptionHandlerOptions:{constraints:x(t)}};await n.accept(r),_()}},D=async()=>{let t=i.value.get(e.activeChannelId.value);if(t)switch(t.state){case L.Initial:case L.Establishing:t instanceof ke?await t.cancel():t instanceof Oe&&await t.reject();break;case L.Established:await t.bye();break}},te=()=>{let t=i.value.get(e.activeChannelId.value);if(!t)return;let n=!e.isMuted.value,r=!1,a=t.sessionDescriptionHandler;a?.peerConnection&&a.peerConnection.getSenders().forEach(e=>{e.track&&e.track.kind===`audio`&&(e.track.enabled=!n,r=!0)}),c.value&&c.value.getAudioTracks().forEach(e=>{e.enabled=!n,r=!0}),r||console.warn(`[SipJs] No audio tracks found to mute/unmute`),e.setMuted(n)},O=async(e,t)=>{let n={sessionDescriptionHandlerOptions:{hold:t}};await e.invite(n)},ne=async()=>{let t=i.value.get(e.activeChannelId.value);if(t?.state!==L.Established)return;let n=!e.isHeld.value;try{await O(t,n),e.setHeld(n)}catch{}},k=async t=>{let n=e.activeChannelId.value;if(n===t)return;let r=i.value.get(n),a=i.value.get(t),o=e.channels.value.find(e=>e.id===n),s=e.channels.value.find(e=>e.id===t);if(r&&r.state===L.Established&&!o?.isHeld)try{await O(r,!0),e.updateChannelState(n,{isHeld:!0})}catch{}if(e.setActiveChannelId(t),_(),a&&a.state===L.Established){if(s?.isHeld)try{await O(a,!1),e.updateChannelState(t,{isHeld:!1})}catch{}if(s?.isMuted){let e=a.sessionDescriptionHandler;e?.peerConnection&&e.peerConnection.getSenders().forEach(e=>{e.track&&e.track.kind===`audio`&&(e.track.enabled=!1)}),c.value&&c.value.getAudioTracks().forEach(e=>{e.enabled=!1})}oe(a)}else se()},re=t=>{let n=i.value.get(e.activeChannelId.value);if(n?.state!==L.Established)return;let r={requestOptions:{body:{content:`Signal=${t}\r\nDuration=160`,contentType:`application/dtmf-relay`,contentDisposition:`signal`}}};n.info(r)},ie=async t=>{console.log(`[SipJs] 🔄 transferCall iniciado`),console.log(`[SipJs] Target:`,t);let r=e.activeChannelId.value,a=i.value.get(r);if(!a)throw console.error(`[SipJs] ❌ No hay sesión activa en el canal`,r),Error(`No active session to transfer`);if(console.log(`[SipJs] Sesión encontrada - Estado:`,a.state),console.log(`[SipJs] Dialog ID:`,a.dialog?.id),console.log(`[SipJs] Call ID:`,a.dialog?.callId),a.state!==L.Established)throw console.error(`[SipJs] ❌ Sesión no establecida. Estado actual:`,a.state),Error(`Cannot transfer call. Call is not established (state: ${a.state})`);let o=kt.makeURI(t);if(!o&&n.value?.configuration.uri){let e=n.value.configuration.uri.host;console.log(`[SipJs] Construyendo URI con dominio:`,e),o=kt.makeURI(`sip:${t}@${e}`)}if(!o)throw console.error(`[SipJs] ❌ URI de destino inválida:`,t),Error(`Invalid transfer target: ${t}`);console.log(`[SipJs] 📤 URI de transferencia:`,o.toString()),console.log(`[SipJs] URI scheme:`,o.scheme),console.log(`[SipJs] URI user:`,o.user),console.log(`[SipJs] URI host:`,o.host);try{console.log(`[SipJs] 🚀 Enviando REFER...`),await a.refer(o,{requestDelegate:{onAccept:e=>{console.log(`[SipJs] ✅ Transfer REFER aceptado por el servidor (202 Accepted)`),console.log(`[SipJs] Response:`,e.message)},onReject:e=>{let t=e.message.statusCode;console.error(`[SipJs] ❌ Transfer REFER rechazado:`,t),console.error(`[SipJs] Response completo:`,e.message)}},onNotify:e=>{console.log(`[SipJs] 📬 NOTIFY recibido para transferencia`),console.log(`[SipJs] NOTIFY request:`,e.request),e.accept();let t=e.request.body;if(console.log(`[SipJs] NOTIFY body:`,t),t){let e=t.match(/SIP\/2\.0\s+(\d{3})(.*)/);if(e&&e[1]){let t=parseInt(e[1],10),n=e[2]?.trim()||``;if(console.log(`[SipJs] 📊 Status code:`,t),console.log(`[SipJs] 📊 Status text:`,n),t>=200&&t<300)console.log(`[SipJs] ✅ Transferencia exitosa! Terminando sesión...`),setTimeout(()=>{a.bye().catch(e=>{console.warn(`[SipJs] Error hanging up after successful transfer:`,e)})},500);else if(t>=400){console.error(`[SipJs] ❌ Transfer falló con status:`,t,n),console.log(`[SipJs] 🔄 Manteniendo la sesión activa para el usuario`);let e={404:`Número no encontrado`,486:`Número ocupado`,487:`Transferencia cancelada`,503:`Servicio no disponible - el destino puede estar fuera de línea`}[t]||`Error en transferencia (código ${t})`;console.warn(`[SipJs] 💬`,e)}else t>=100&&t<200&&console.log(`[SipJs] 📞 Transferencia en progreso:`,t,n)}else console.warn(`[SipJs] ⚠️ No se pudo extraer el código de estado del NOTIFY body`)}else console.warn(`[SipJs] ⚠️ NOTIFY sin body`)}}),console.log(`[SipJs] ✅ REFER enviado exitosamente (promesa resuelta)`)}catch(e){throw console.error(`[SipJs] ❌ Error en transferCall:`,e),console.error(`[SipJs] Error type:`,e?.constructor?.name),console.error(`[SipJs] Error message:`,e instanceof Error?e.message:String(e)),console.error(`[SipJs] Error stack:`,e instanceof Error?e.stack:`N/A`),e}},A=async t=>{console.log(`[SipJs] 🔄 startAttendedTransfer iniciado`),console.log(`[SipJs] Target:`,t);let n=e.activeChannelId.value,r=i.value.get(n);if(console.log(`[SipJs] Canal original:`,n),console.log(`[SipJs] Sesión original:`,r?.state),!r||r.state!==L.Established)throw console.error(`[SipJs] ❌ No hay llamada establecida para transferir`),Error(`No established call to transfer`);let a=e.channels.value.find(e=>e.status===`idle`);if(console.log(`[SipJs] Canal de consulta encontrado:`,a?.id),!a)throw console.error(`[SipJs] ❌ No hay canales disponibles para llamada de consulta`),Error(`No available channel for consultation call`);try{console.log(`[SipJs] 🔇 Poniendo llamada original en hold...`),await O(r,!0),e.updateChannelState(n,{isHeld:!0}),console.log(`[SipJs] ✅ Llamada original en hold`)}catch(e){throw console.error(`[SipJs] ❌ Failed to hold original call:`,e),Error(`Failed to put call on hold`)}console.log(`[SipJs] 🔄 Cambiando al canal de consulta:`,a.id),e.setActiveChannelId(a.id);try{console.log(`[SipJs] 📞 Iniciando llamada de consulta a:`,t),await E(t,!1),console.log(`[SipJs] ✅ Llamada de consulta iniciada`),e.setTransferInProgress({originalChannelId:n,consultationChannelId:a.id,targetNumber:t}),console.log(`[SipJs] 📋 Transferencia en progreso registrada`)}catch(t){throw console.error(`[SipJs] ❌ Failed to start consultation call:`,t),console.log(`[SipJs] 🔄 Volviendo al canal original y quitando hold...`),e.setActiveChannelId(n),await O(r,!1).catch(()=>{}),e.updateChannelState(n,{isHeld:!1}),Error(`Failed to initiate consultation call`)}},j=async()=>{console.log(`[SipJs] 🔄 completeAttendedTransfer iniciado`);let t=e.transferInProgress.value;if(!t)throw console.error(`[SipJs] ❌ No hay transferencia en progreso`),Error(`No transfer in progress`);console.log(`[SipJs] Estado de transferencia:`,t);let r=i.value.get(t.originalChannelId),a=i.value.get(t.consultationChannelId);if(console.log(`[SipJs] Sesión original:`,r?.state),console.log(`[SipJs] Sesión de consulta:`,a?.state),!r||!a)throw console.error(`[SipJs] ❌ Falta una o ambas sesiones`),Error(`Missing session for transfer`);if(a.state!==L.Established)throw console.error(`[SipJs] ❌ Llamada de consulta no está establecida. Estado:`,a.state),Error(`Consultation call not established`);let o=a.dialog;if(!o)throw Error(`No dialog available for consultation session`);let s=o.callId,c=o.remoteTag,l=o.localTag,u=kt.makeURI(t.targetNumber);if(!u&&n.value?.configuration.uri){let e=n.value.configuration.uri.host;u=kt.makeURI(`sip:${t.targetNumber}@${e}`)}if(!u)throw Error(`Invalid transfer target URI`);let d=`${encodeURIComponent(s)}%3Bto-tag%3D${encodeURIComponent(c)}%3Bfrom-tag%3D${encodeURIComponent(l)}`;u.setHeader(`Replaces`,d);try{await r.refer(u,{onNotify:t=>{t.accept();let n=t.request.body,i=typeof n==`string`?n:n&&typeof n==`object`&&`content`in n?n.content:void 0;if(i){let t=i.match(/SIP\/2\.0\s+(\d+)/);if(t&&t[1]){let n=parseInt(t[1]);n>=200&&n<300?setTimeout(()=>{r.bye().catch(()=>{}),a.bye().catch(()=>{}),e.setTransferInProgress(null)},500):n>=400&&(console.error(`[SipJs] Attended transfer failed with status:`,n),e.setTransferInProgress(null))}}},requestDelegate:{onAccept:()=>{},onReject:t=>{console.error(`[SipJs] Attended transfer REFER rejected:`,t.message.statusCode),e.setTransferInProgress(null)}}})}catch(e){throw console.error(`[SipJs] Attended transfer failed:`,e),e}},ae=async()=>{let t=e.transferInProgress.value;if(!t)throw Error(`No transfer in progress`);console.log(`[SipJs] Canceling attended transfer...`);let n=i.value.get(t.originalChannelId),r=i.value.get(t.consultationChannelId);if(r)try{await r.bye(),console.log(`[SipJs] Consultation call ended`)}catch(e){console.warn(`[SipJs] Error ending consultation:`,e)}if(n)try{e.setActiveChannelId(t.originalChannelId),await O(n,!1),e.updateChannelState(t.originalChannelId,{isHeld:!1}),console.log(`[SipJs] Returned to original call`)}catch(e){console.warn(`[SipJs] Error resuming original call:`,e)}e.setTransferInProgress(null)},oe=e=>{let t=e.sessionDescriptionHandler;if(!t){console.error(`[SipJs] setupRemoteMedia: no sessionDescriptionHandler`);return}let n=t.remoteMediaStream;if(!n){console.error(`[SipJs] setupRemoteMedia: no remoteMediaStream on SDH`);return}if(s.value===n)return;a.pause(),a.srcObject=null,l?.abort(),l=new AbortController,s.value=n,c.value=t.localMediaStream??null;let r=e=>{u?.abort(),u=new AbortController;let{signal:t}=u,n=()=>{a.play().catch(e=>{e.name!==`AbortError`&&console.error(`[SipJs] play() failed:`,e.name,e.message)})};e.addEventListener(`mute`,()=>{a.pause()},{signal:t}),e.addEventListener(`unmute`,()=>{n()},{signal:t}),e.muted||n()};n.addEventListener(`addtrack`,e=>{e.track.kind===`audio`&&(a.srcObject=null,a.srcObject=n,r(e.track))},{signal:l.signal});let[i]=n.getTracks();i&&(a.srcObject=n,r(i))},se=()=>{u?.abort(),u=null,l?.abort(),l=null,a.pause(),a.srcObject=null,s.value=null,c.value=null};return{initUserAgent:S,makeCall:E,answerCall:ee,hangupCall:D,toggleMute:te,toggleHold:ne,sendDTMF:re,transferCall:ie,startAttendedTransfer:A,completeAttendedTransfer:j,cancelAttendedTransfer:ae,switchChannel:k,extension:d,setVolume:v,setNotificationVolume:g,setOutputDevice:y,setInputDevice:b,remoteStream:s,localStream:c}};var dr=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e;let fr=It,pr=(e,t)=>n=>{if(t?.variants==null)return fr(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=dr(t)||dr(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return fr(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)};function mr(e){return typeof e==`string`?`'${e}'`:new hr().serialize(e)}var hr=function(){class e{#e=new Map;compare(e,t){let n=typeof e,r=typeof t;return n===`string`&&r===`string`?e.localeCompare(t):n===`number`&&r===`number`?e-t:String.prototype.localeCompare.call(this.serialize(e,!0),this.serialize(t,!0))}serialize(e,t){if(e===null)return`null`;switch(typeof e){case`string`:return t?e:`'${e}'`;case`bigint`:return`${e}n`;case`object`:return this.$object(e);case`function`:return this.$function(e)}return String(e)}serializeObject(e){let t=Object.prototype.toString.call(e);if(t!==`[object Object]`)return this.serializeBuiltInType(t.length<10?`unknown:${t}`:t.slice(8,-1),e);let n=e.constructor,r=n===Object||n===void 0?``:n.name;if(r!==``&&globalThis[r]===n)return this.serializeBuiltInType(r,e);if(typeof e.toJSON==`function`){let t=e.toJSON();return r+(typeof t==`object`&&t?this.$object(t):`(${this.serialize(t)})`)}return this.serializeObjectEntries(r,Object.entries(e))}serializeBuiltInType(e,t){let n=this[`$`+e];if(n)return n.call(this,t);if(typeof t?.entries==`function`)return this.serializeObjectEntries(e,t.entries());throw Error(`Cannot serialize ${e}`)}serializeObjectEntries(e,t){let n=Array.from(t).sort((e,t)=>this.compare(e[0],t[0])),r=`${e}{`;for(let e=0;e<n.length;e++){let[t,i]=n[e];r+=`${this.serialize(t,!0)}:${this.serialize(i)}`,e<n.length-1&&(r+=`,`)}return r+`}`}$object(e){let t=this.#e.get(e);return t===void 0&&(this.#e.set(e,`#${this.#e.size}`),t=this.serializeObject(e),this.#e.set(e,t)),t}$function(e){let t=Function.prototype.toString.call(e);return t.slice(-15)===`[native code] }`?`${e.name||``}()[native]`:`${e.name}(${e.length})${t.replace(/\s*\n\s*/g,``)}`}$Array(e){let t=`[`;for(let n=0;n<e.length;n++)t+=this.serialize(e[n]),n<e.length-1&&(t+=`,`);return t+`]`}$Date(e){try{return`Date(${e.toISOString()})`}catch{return`Date(null)`}}$ArrayBuffer(e){return`ArrayBuffer[${new Uint8Array(e).join(`,`)}]`}$Set(e){return`Set${this.$Array(Array.from(e).sort((e,t)=>this.compare(e,t)))}`}$Map(e){return this.serializeObjectEntries(`Map`,e.entries())}}for(let t of[`Error`,`RegExp`,`URL`])e.prototype[`$`+t]=function(e){return`${t}(${e})`};for(let t of[`Int8Array`,`Uint8Array`,`Uint8ClampedArray`,`Int16Array`,`Uint16Array`,`Int32Array`,`Uint32Array`,`Float32Array`,`Float64Array`])e.prototype[`$`+t]=function(e){return`${t}[${e.join(`,`)}]`};for(let t of[`BigInt64Array`,`BigUint64Array`])e.prototype[`$`+t]=function(e){return`${t}[${e.join(`n,`)}${e.length>0?`n`:``}]`};return e}();function gr(e,t){return e===t||mr(e)===mr(t)}function _r(e,t=-1/0,n=1/0){return Math.min(n,Math.max(t,e))}function vr(e,n){let r=typeof e==`string`&&!n?`${e}Context`:n,i=Symbol(r);return[n=>{let r=(0,t.inject)(i,n);if(r||r===null)return r;throw Error(`Injection \`${i.toString()}\` not found. Component must be used within ${Array.isArray(e)?`one of the following components: ${e.join(`, `)}`:`\`${e}\``}`)},e=>((0,t.provide)(i,e),e)]}function yr(){let e=document.activeElement;if(e==null)return null;for(;e!=null&&e.shadowRoot!=null&&e.shadowRoot.activeElement!=null;)e=e.shadowRoot.activeElement;return e}function br(e,t,n){let r=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&r.addEventListener(e,t,{once:!0}),r.dispatchEvent(i)}function xr(e){return e==null}function Sr(e){return e?e.flatMap(e=>e.type===t.Fragment?Sr(e.children):[e]):[]}var[Cr,wr]=vr(`ConfigProvider`);function Tr(e,n){return(0,t.getCurrentScope)()?((0,t.onScopeDispose)(e,n),!0):!1}function Er(){let e=new Set,t=t=>{e.delete(t)};return{on:n=>{e.add(n);let r=()=>t(n);return Tr(r),{off:r}},off:t,trigger:(...t)=>Promise.all(Array.from(e).map(e=>e(...t))),clear:()=>{e.clear()}}}var Dr=typeof window<`u`&&typeof document<`u`;typeof WorkerGlobalScope<`u`&&globalThis instanceof WorkerGlobalScope;var Or=kr();function kr(){var e,t;return Dr&&!!(!((e=window)==null||(e=e.navigator)==null)&&e.userAgent)&&(/iP(?:ad|hone|od)/.test(window.navigator.userAgent)||((t=window)==null||(t=t.navigator)==null?void 0:t.maxTouchPoints)>2&&/iPad|Macintosh/.test(window?.navigator.userAgent))}function Ar(e){return e||(0,t.getCurrentInstance)()}function jr(e,n=1e4){return(0,t.customRef)((r,i)=>{let a=(0,t.toValue)(e),o,s=()=>setTimeout(()=>{a=(0,t.toValue)(e),i()},(0,t.toValue)(n));return Tr(()=>{clearTimeout(o)}),{get(){return r(),a},set(e){a=e,i(),clearTimeout(o),o=s()}}})}function Mr(e,n){Ar(n)&&(0,t.onBeforeUnmount)(e,n)}function Nr(e,n,r={}){let{immediate:i=!0,immediateCallback:a=!1}=r,o=(0,t.shallowRef)(!1),s;function c(){s&&=(clearTimeout(s),void 0)}function l(){o.value=!1,c()}function u(...r){a&&e(),c(),o.value=!0,s=setTimeout(()=>{o.value=!1,s=void 0,e(...r)},(0,t.toValue)(n))}return i&&(o.value=!0,Dr&&u()),Tr(l),{isPending:(0,t.shallowReadonly)(o),start:u,stop:l}}function Pr(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null||Symbol.iterator in e?!1:Symbol.toStringTag in e?Object.prototype.toString.call(e)===`[object Module]`:!0}function Fr(e,t,n=`.`,r){if(!Pr(t))return Fr(e,{},n,r);let i=Object.assign({},t);for(let t in e){if(t===`__proto__`||t===`constructor`)continue;let a=e[t];a!=null&&(r&&r(i,t,a,n)||(Array.isArray(a)&&Array.isArray(i[t])?i[t]=[...a,...i[t]]:Pr(a)&&Pr(i[t])?i[t]=Fr(a,i[t],(n?`${n}.`:``)+t.toString(),r):i[t]=a))}return i}function Ir(e){return(...t)=>t.reduce((t,n)=>Fr(t,n,``,e),{})}var Lr=Ir(),Rr=(0,n.createSharedComposable)(()=>{let e=(0,t.ref)(new Map),r=(0,t.ref)(),i=(0,t.computed)(()=>{for(let t of e.value.values())if(t)return!0;return!1}),a=Cr({scrollBody:(0,t.ref)(!0)}),o=null,s=()=>{document.body.style.paddingRight=``,document.body.style.marginRight=``,document.body.style.pointerEvents=``,document.documentElement.style.removeProperty(`--scrollbar-width`),document.body.style.overflow=r.value??``,Or&&o?.(),r.value=void 0};return(0,t.watch)(i,(e,i)=>{if(!Dr)return;if(!e){i&&s();return}r.value===void 0&&(r.value=document.body.style.overflow);let c=window.innerWidth-document.documentElement.clientWidth,l={padding:c,margin:0},u=a.scrollBody?.value?typeof a.scrollBody.value==`object`?Lr({padding:a.scrollBody.value.padding===!0?c:a.scrollBody.value.padding,margin:a.scrollBody.value.margin===!0?c:a.scrollBody.value.margin},l):l:{padding:0,margin:0};c>0&&(document.body.style.paddingRight=typeof u.padding==`number`?`${u.padding}px`:String(u.padding),document.body.style.marginRight=typeof u.margin==`number`?`${u.margin}px`:String(u.margin),document.documentElement.style.setProperty(`--scrollbar-width`,`${c}px`),document.body.style.overflow=`hidden`),Or&&(o=(0,n.useEventListener)(document,`touchmove`,e=>Vr(e),{passive:!1})),(0,t.nextTick)(()=>{document.body.style.pointerEvents=`none`,document.body.style.overflow=`hidden`})},{immediate:!0,flush:`sync`}),e});function zr(e){let n=Math.random().toString(36).substring(2,7),r=Rr();r.value.set(n,e??!1);let i=(0,t.computed)({get:()=>r.value.get(n)??!1,set:e=>r.value.set(n,e)});return Mr(()=>{r.value.delete(n)}),i}function Br(e){let t=window.getComputedStyle(e);if(t.overflowX===`scroll`||t.overflowY===`scroll`||t.overflowX===`auto`&&e.clientWidth<e.scrollWidth||t.overflowY===`auto`&&e.clientHeight<e.scrollHeight)return!0;{let t=e.parentNode;return!(t instanceof Element)||t.tagName===`BODY`?!1:Br(t)}}function Vr(e){let t=e||window.event,n=t.target;return n instanceof Element&&Br(n)?!1:t.touches.length>1?!0:(t.preventDefault&&t.cancelable&&t.preventDefault(),!1)}function Hr(e){let n=Cr({dir:(0,t.ref)(`ltr`)});return(0,t.computed)(()=>e?.value||n.dir?.value||`ltr`)}function Ur(e){let n=(0,t.getCurrentInstance)(),r=n?.type.emits,i={};return r?.length||console.warn(`No emitted event found. Please check component: ${n?.type.__name}`),r?.forEach(n=>{i[(0,t.toHandlerKey)((0,t.camelize)(n))]=(...t)=>e(n,...t)}),i}var Wr=0;function Gr(){(0,t.watchEffect)(e=>{if(!Dr)return;let t=document.querySelectorAll(`[data-reka-focus-guard]`);document.body.insertAdjacentElement(`afterbegin`,t[0]??Kr()),document.body.insertAdjacentElement(`beforeend`,t[1]??Kr()),Wr++,e(()=>{Wr===1&&document.querySelectorAll(`[data-reka-focus-guard]`).forEach(e=>e.remove()),Wr--})})}function Kr(){let e=document.createElement(`span`);return e.setAttribute(`data-reka-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}function qr(e){return(0,t.computed)(()=>(0,t.toValue)(e)?!!(0,n.unrefElement)(e)?.closest(`form`):!0)}function Y(){let e=(0,t.getCurrentInstance)(),r=(0,t.ref)(),i=(0,t.computed)(()=>a());(0,t.onUpdated)(()=>{i.value!==a()&&(0,t.triggerRef)(r)});function a(){return r.value&&`$el`in r.value&&[`#text`,`#comment`].includes(r.value.$el.nodeName)?r.value.$el.nextElementSibling:(0,n.unrefElement)(r)}let o=Object.assign({},e.exposed),s={};for(let t in e.props)Object.defineProperty(s,t,{enumerable:!0,configurable:!0,get:()=>e.props[t]});if(Object.keys(o).length>0)for(let e in o)Object.defineProperty(s,e,{enumerable:!0,configurable:!0,get:()=>o[e]});Object.defineProperty(s,`$el`,{enumerable:!0,configurable:!0,get:()=>e.vnode.el}),e.exposed=s;function c(t){if(r.value=t,t&&(Object.defineProperty(s,`$el`,{enumerable:!0,configurable:!0,get:()=>t instanceof Element?t:t.$el}),!(t instanceof Element)&&!Object.prototype.hasOwnProperty.call(t,`$el`))){let n=t.$.exposed,r=Object.assign({},s);for(let e in n)Object.defineProperty(r,e,{enumerable:!0,configurable:!0,get:()=>n[e]});e.exposed=r}}return{forwardRef:c,currentRef:r,currentElement:i}}function Jr(e){let n=(0,t.getCurrentInstance)(),r=Object.keys(n?.type.props??{}).reduce((e,t)=>{let r=(n?.type.props[t]).default;return r!==void 0&&(e[t]=r),e},{}),i=(0,t.toRef)(e);return(0,t.computed)(()=>{let e={},a=n?.vnode.props??{};return Object.keys(a).forEach(n=>{e[(0,t.camelize)(n)]=a[n]}),Object.keys({...r,...e}).reduce((e,t)=>(i.value[t]!==void 0&&(e[t]=i.value[t]),e),{})})}function Yr(e,n){let r=Jr(e),i=n?Ur(n):{};return(0,t.computed)(()=>({...r.value,...i}))}function Xr(e,n){let r=jr(!1,300);Tr(()=>{r.value=!1});let i=(0,t.ref)(null),a=Er();function o(){i.value=null,r.value=!1}function s(e,t){let n=e.currentTarget,a={x:e.clientX,y:e.clientY},o=Qr(a,Zr(a,n.getBoundingClientRect()),1),s=$r(t.getBoundingClientRect());i.value=ti([...o,...s]),r.value=!0}return(0,t.watchEffect)(t=>{if(e.value&&n.value){let r=e=>s(e,n.value),i=t=>s(t,e.value);e.value.addEventListener(`pointerleave`,r),n.value.addEventListener(`pointerleave`,i),t(()=>{e.value?.removeEventListener(`pointerleave`,r),n.value?.removeEventListener(`pointerleave`,i)})}}),(0,t.watchEffect)(t=>{if(i.value){let r=t=>{if(!i.value||!(t.target instanceof Element))return;let r=t.target,s={x:t.clientX,y:t.clientY},c=e.value?.contains(r)||n.value?.contains(r),l=!ei(s,i.value),u=!!r.closest(`[data-grace-area-trigger]`);c?o():(l||u)&&(o(),a.trigger())};e.value?.ownerDocument.addEventListener(`pointermove`,r),t(()=>e.value?.ownerDocument.removeEventListener(`pointermove`,r))}}),{isPointerInTransit:r,onPointerExit:a.on}}function Zr(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function Qr(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function $r(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function ei(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e].x,s=t[e].y,c=t[a].x,l=t[a].y;s>r!=l>r&&n<(c-o)*(r-s)/(l-s)+o&&(i=!i)}return i}function ti(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:e.y>t.y?1:0),ni(t)}function ni(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var ri=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},ii=new WeakMap,ai=new WeakMap,oi={},si=0,ci=function(e){return e&&(e.host||ci(e.parentNode))},li=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=ci(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},ui=function(e,t,n,r){var i=li(t,Array.isArray(e)?e:[e]);oi[n]||(oi[n]=new WeakMap);var a=oi[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(ii.get(e)||0)+1,l=(a.get(e)||0)+1;ii.set(e,c),a.set(e,l),o.push(e),c===1&&i&&ai.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),si++,function(){o.forEach(function(e){var t=ii.get(e)-1,i=a.get(e)-1;ii.set(e,t),a.set(e,i),t||(ai.has(e)||e.removeAttribute(r),ai.delete(e)),i||e.removeAttribute(n)}),si--,si||(ii=new WeakMap,ii=new WeakMap,ai=new WeakMap,oi={})}},di=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||ri(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),ui(r,i,n,`aria-hidden`)):function(){return null}};function fi(e){let r;(0,t.watch)(()=>(0,n.unrefElement)(e),e=>{e?r=di(e):r&&r()}),(0,t.onUnmounted)(()=>{r&&r()})}var pi=0;function mi(e,n=`reka`){if(e)return e;let r;return r=`useId`in t?t.useId?.():Cr({useId:void 0}).useId?.()??`${++pi}`,n?`${n}-${r}`:r}function hi(e){let r=(0,t.ref)(),i=(0,t.computed)(()=>r.value?.width??0),a=(0,t.computed)(()=>r.value?.height??0);return(0,t.onMounted)(()=>{let t=(0,n.unrefElement)(e);if(t){r.value={width:t.offsetWidth,height:t.offsetHeight};let e=new ResizeObserver(e=>{if(!Array.isArray(e)||!e.length)return;let n=e[0],i,a;if(`borderBoxSize`in n){let e=n.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=t.offsetWidth,a=t.offsetHeight;r.value={width:i,height:a}});return e.observe(t,{box:`border-box`}),()=>e.unobserve(t)}else r.value=void 0}),{width:i,height:a}}function gi(e,n){let r=(0,t.ref)(e);function i(e){return n[r.value][e]??r.value}return{state:r,dispatch:e=>{r.value=i(e)}}}function _i(e){let t=jr(``,1e3);return{search:t,handleTypeaheadSearch:(n,r)=>{if(t.value+=n,e)e(n);else{let e=yr(),n=r.map(e=>({...e,textValue:e.value?.textValue??e.ref.textContent?.trim()??``})),i=n.find(t=>t.ref===e),a=yi(n.map(e=>e.textValue),t.value,i?.textValue),o=n.find(e=>e.textValue===a);return o&&o.ref.focus(),o?.ref}},resetTypeahead:()=>{t.value=``}}}function vi(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function yi(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=vi(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function bi(e,r){let i=(0,t.ref)({}),a=(0,t.ref)(`none`),o=(0,t.ref)(e),s=e.value?`mounted`:`unmounted`,c,l=r.value?.ownerDocument.defaultView??n.defaultWindow,{state:u,dispatch:d}=gi(s,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}}),f=e=>{if(Dr){let t=new CustomEvent(e,{bubbles:!1,cancelable:!1});r.value?.dispatchEvent(t)}};(0,t.watch)(e,async(e,n)=>{let o=n!==e;if(await(0,t.nextTick)(),o){let t=a.value,o=xi(r.value);e?(d(`MOUNT`),f(`enter`),o===`none`&&f(`after-enter`)):o===`none`||o===`undefined`||i.value?.display===`none`?(d(`UNMOUNT`),f(`leave`),f(`after-leave`)):n&&t!==o?(d(`ANIMATION_OUT`),f(`leave`)):(d(`UNMOUNT`),f(`after-leave`))}},{immediate:!0});let p=e=>{let t=xi(r.value),n=t.includes(CSS.escape(e.animationName)),i=u.value===`mounted`?`enter`:`leave`;if(e.target===r.value&&n&&(f(`after-${i}`),d(`ANIMATION_END`),!o.value)){let e=r.value.style.animationFillMode;r.value.style.animationFillMode=`forwards`,c=l?.setTimeout(()=>{r.value?.style.animationFillMode===`forwards`&&(r.value.style.animationFillMode=e)})}e.target===r.value&&t===`none`&&d(`ANIMATION_END`)},m=e=>{e.target===r.value&&(a.value=xi(r.value))},h=(0,t.watch)(r,(e,t)=>{e?(i.value=getComputedStyle(e),e.addEventListener(`animationstart`,m),e.addEventListener(`animationcancel`,p),e.addEventListener(`animationend`,p)):(d(`ANIMATION_END`),c!==void 0&&l?.clearTimeout(c),t?.removeEventListener(`animationstart`,m),t?.removeEventListener(`animationcancel`,p),t?.removeEventListener(`animationend`,p))},{immediate:!0}),g=(0,t.watch)(u,()=>{let e=xi(r.value);a.value=u.value===`mounted`?e:`none`});return(0,t.onUnmounted)(()=>{h(),g()}),{isPresent:(0,t.computed)(()=>[`mounted`,`unmountSuspended`].includes(u.value))}}function xi(e){return e&&getComputedStyle(e).animationName||`none`}var Si=(0,t.defineComponent)({name:`Presence`,props:{present:{type:Boolean,required:!0},forceMount:{type:Boolean}},slots:{},setup(e,{slots:r,expose:i}){let{present:a,forceMount:o}=(0,t.toRefs)(e),s=(0,t.ref)(),{isPresent:c}=bi(a,s);i({present:c});let l=r.default({present:c.value});l=Sr(l||[]);let u=(0,t.getCurrentInstance)();if(l&&l?.length>1){let e=u?.parent?.type.name?`<${u.parent.type.name} />`:`component`;throw Error([`Detected an invalid children for \`${e}\` for \`Presence\` component.`,``,"Note: Presence works similarly to `v-if` directly, but it waits for animation/transition to finished before unmounting. So it expect only one direct child of valid VNode type.",`You can apply a few solutions:`,["Provide a single child element so that `presence` directive attach correctly.",`Ensure the first child is an actual element instead of a raw text node or comment node.`].map(e=>` - ${e}`).join(`
57
+ `))}startSendingKeepAlives(){this.configuration.keepAliveInterval&&!this.keepAliveInterval&&(this.keepAliveInterval=setInterval(()=>{this.sendKeepAlive(),this.startSendingKeepAlives()},(e=>{let t=e*.8;return 1e3*(Math.random()*(e-t)+t)})(this.configuration.keepAliveInterval)))}stopSendingKeepAlives(){this.keepAliveInterval&&clearInterval(this.keepAliveInterval),this.keepAliveDebounceTimeout&&clearTimeout(this.keepAliveDebounceTimeout),this.keepAliveInterval=void 0,this.keepAliveDebounceTimeout=void 0}};Ot.defaultOptions={server:``,connectionTimeout:5,keepAliveInterval:0,keepAliveDebounce:10,traceSip:!0};var kt=class e{constructor(t={}){if(this._publishers={},this._registerers={},this._sessions={},this._subscriptions={},this._state=Ae.Stopped,this._stateEventEmitter=new T,this.delegate=t.delegate,this.options=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},e.defaultOptions()),{sipjsId:ae(5)}),{uri:new te(`sip`,`anonymous.`+ae(6),`anonymous.invalid`)}),{viaHost:ae(12)+`.invalid`}),e.stripUndefinedProperties(t)),this.options.hackIpInContact)if(typeof this.options.hackIpInContact==`boolean`&&this.options.hackIpInContact){let e=Math.floor(Math.random()*254+1);this.options.viaHost=`192.0.2.`+e}else this.options.hackIpInContact&&(this.options.viaHost=this.options.hackIpInContact);switch(this.loggerFactory=new Ie,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=Pe.error;break;case`warn`:this.loggerFactory.level=Pe.warn;break;case`log`:this.loggerFactory.level=Pe.log;break;case`debug`:this.loggerFactory.level=Pe.debug;break;default:break}if(this.options.logConfiguration&&(this.logger.log(`Configuration:`),Object.keys(this.options).forEach(e=>{let t=this.options[e];switch(e){case`uri`:case`sessionDescriptionHandlerFactory`:this.logger.log(`· `+e+`: `+t);break;case`authorizationPassword`:this.logger.log(`· `+e+`: NOT SHOWN`);break;case`transportConstructor`:this.logger.log(`· `+e+`: `+t.name);break;default:this.logger.log(`· `+e+`: `+JSON.stringify(t))}})),this.options.transportOptions){let e=this.options.transportOptions,n=e.maxReconnectionAttempts,r=e.reconnectionTimeout;n!==void 0&&this.logger.warn(`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.`),r!==void 0&&this.logger.warn(`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.`),t.reconnectionDelay===void 0&&r!==void 0&&(this.options.reconnectionDelay=r),t.reconnectionAttempts===void 0&&n!==void 0&&(this.options.reconnectionAttempts=n)}if(t.reconnectionDelay!==void 0&&this.logger.warn(`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.`),t.reconnectionAttempts!==void 0&&this.logger.warn(`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._transport=new this.options.transportConstructor(this.getLogger(`sip.Transport`),this.options.transportOptions),this.initTransportCallbacks(),this._contact=this.initContact(),this._instanceId=this.options.instanceId?this.options.instanceId:e.newUUID(),A.parse(this._instanceId,`uuid`)===-1)throw Error(`Invalid instanceId.`);this._userAgentCore=this.initCore()}static makeURI(e){return A.URIParse(e)}static defaultOptions(){return{allowLegacyNotifications:!1,authorizationHa1:``,authorizationPassword:``,authorizationUsername:``,delegate:{},contactName:``,contactParams:{transport:`ws`},displayName:``,forceRport:!1,gracefulShutdown:!0,hackAllowUnregisteredOptionTags:!1,hackIpInContact:!1,hackViaTcp:!1,instanceId:``,instanceIdAlwaysAdded:!1,logBuiltinEnabled:!0,logConfiguration:!0,logConnector:()=>{},logLevel:`log`,noAnswerTimeout:60,preloadedRouteSet:[],reconnectionAttempts:0,reconnectionDelay:4,sendInitialProvisionalResponse:!0,sessionDescriptionHandlerFactory:Dt(),sessionDescriptionHandlerFactoryOptions:{},sipExtension100rel:Te.Unsupported,sipExtensionReplaces:Te.Unsupported,sipExtensionExtraSupported:[],sipjsId:``,transportConstructor:Ot,transportOptions:{},uri:new te(`sip`,`anonymous`,`anonymous.invalid`),userAgentString:`SIP.js/0.21.1`,viaHost:``}}static newUUID(){return`xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`.replace(/[xy]/g,e=>{let t=Math.floor(Math.random()*16);return(e===`x`?t:t%4+8).toString(16)})}static stripUndefinedProperties(e){return Object.keys(e).reduce((t,n)=>(e[n]!==void 0&&(t[n]=e[n]),t),{})}get configuration(){return this.options}get contact(){return this._contact}get instanceId(){return this._instanceId}get state(){return this._state}get stateChange(){return this._stateEventEmitter}get transport(){return this._transport}get userAgentCore(){return this._userAgentCore}getLogger(e,t){return this.loggerFactory.getLogger(e,t)}getLoggerFactory(){return this.loggerFactory}isConnected(){return this.transport.isConnected()}reconnect(){return this.state===Ae.Stopped?Promise.reject(Error(`User agent stopped.`)):Promise.resolve().then(()=>this.transport.connect())}start(){return this.state===Ae.Started?(this.logger.warn(`User agent already started`),Promise.resolve()):(this.logger.log(`Starting ${this.configuration.uri}`),this.transitionState(Ae.Started),this.transport.connect())}async stop(){if(this.state===Ae.Stopped)return this.logger.warn(`User agent already stopped`),Promise.resolve();if(this.logger.log(`Stopping ${this.configuration.uri}`),!this.options.gracefulShutdown)return this.logger.log(`Dispose of transport`),this.transport.dispose().catch(e=>{throw this.logger.error(e.message),e}),this.logger.log(`Dispose of core`),this.userAgentCore.dispose(),this._publishers={},this._registerers={},this._sessions={},this._subscriptions={},this.transitionState(Ae.Stopped),Promise.resolve();let e=Object.assign({},this._publishers),t=Object.assign({},this._registerers),n=Object.assign({},this._sessions),r=Object.assign({},this._subscriptions),i=this.transport,a=this.userAgentCore;for(let e in this.logger.log(`Dispose of registerers`),t)t[e]&&await t[e].dispose().catch(t=>{throw this.logger.error(t.message),delete this._registerers[e],t});for(let e in this.logger.log(`Dispose of sessions`),n)n[e]&&await n[e].dispose().catch(t=>{throw this.logger.error(t.message),delete this._sessions[e],t});for(let e in this.logger.log(`Dispose of subscriptions`),r)r[e]&&await r[e].dispose().catch(t=>{throw this.logger.error(t.message),delete this._subscriptions[e],t});for(let t in this.logger.log(`Dispose of publishers`),e)e[t]&&await e[t].dispose().catch(e=>{throw this.logger.error(e.message),delete this._publishers[t],e});this.logger.log(`Dispose of transport`),await i.dispose().catch(e=>{throw this.logger.error(e.message),e}),this.logger.log(`Dispose of core`),a.dispose(),this.transitionState(Ae.Stopped)}_makeInviter(e,t){return new Oe(this,e,t)}attemptReconnection(e=1){let t=this.options.reconnectionAttempts,n=this.options.reconnectionDelay;if(e>t){this.logger.log(`Maximum reconnection attempts reached`);return}this.logger.log(`Reconnection attempt ${e} of ${t} - trying`),setTimeout(()=>{this.reconnect().then(()=>{this.logger.log(`Reconnection attempt ${e} of ${t} - succeeded`)}).catch(n=>{this.logger.error(n.message),this.logger.log(`Reconnection attempt ${e} of ${t} - failed`),this.attemptReconnection(++e)})},e===1?0:n*1e3)}initContact(){let e=this.options.contactName===``?ae(8):this.options.contactName,t=this.options.contactParams;return{pubGruu:void 0,tempGruu:void 0,uri:new te(`sip`,e,this.options.viaHost,void 0,t),toString:(e={})=>{let n=e.anonymous||!1,r=e.outbound||!1,i=e.register||!1,a=`<`;return n?a+=this.contact.tempGruu||`sip:anonymous@anonymous.invalid;transport=${t.transport?t.transport:`ws`}`:i?a+=this.contact.uri:a+=this.contact.pubGruu||this.contact.uri,r&&(a+=`;ob`),a+=`>`,this.options.instanceIdAlwaysAdded&&(a+=`;+sip.instance="<urn:uuid:`+this._instanceId+`>"`),a}}}initCore(){let e=[];e.push(`outbound`),this.options.sipExtension100rel===Te.Supported&&e.push(`100rel`),this.options.sipExtensionReplaces===Te.Supported&&e.push(`replaces`),this.options.sipExtensionExtraSupported&&e.push(...this.options.sipExtensionExtraSupported),this.options.hackAllowUnregisteredOptionTags||(e=e.filter(e=>Ee[e])),e=Array.from(new Set(e));let t=e.slice();return(this.contact.pubGruu||this.contact.tempGruu)&&t.push(`gruu`),new Ct({aor:this.options.uri,contact:this.contact,displayName:this.options.displayName,loggerFactory:this.loggerFactory,hackViaTcp:this.options.hackViaTcp,routeSet:this.options.preloadedRouteSet,supportedOptionTags:e,supportedOptionTagsResponse:t,sipjsId:this.options.sipjsId,userAgentHeaderFieldValue:this.options.userAgentString,viaForceRport:this.options.forceRport,viaHost:this.options.viaHost,authenticationFactory:()=>{let e=this.options.authorizationUsername?this.options.authorizationUsername:this.options.uri.user,t=this.options.authorizationPassword?this.options.authorizationPassword:void 0,n=this.options.authorizationHa1?this.options.authorizationHa1:void 0;return new Ne(this.getLoggerFactory(),n,e,t)},transportAccessor:()=>this.transport},{onInvite:e=>{let t=new De(this,e);if(e.delegate={onCancel:e=>{t._onCancel(e)},onTransportError:e=>{this.logger.error(`A transport error has occurred while handling an incoming INVITE request.`)}},e.trying(),this.options.sipExtensionReplaces!==Te.Unsupported){let n=e.message.parseHeader(`replaces`);if(n){let e=n.call_id;if(typeof e!=`string`)throw Error(`Type of call id is not string`);let r=n.replaces_to_tag;if(typeof r!=`string`)throw Error(`Type of to tag is not string`);let i=n.replaces_from_tag;if(typeof i!=`string`)throw Error(`type of from tag is not string`);let a=e+r+i,o=this.userAgentCore.dialogs.get(a);if(!o){t.reject({statusCode:481});return}if(!o.early&&n.early_only===!0){t.reject({statusCode:486});return}let s=this._sessions[e+i]||this._sessions[e+r]||void 0;if(!s)throw Error(`Session does not exist.`);t._replacee=s}}if(this.delegate?.onInvite){if(t.autoSendAnInitialProvisionalResponse){t.progress().then(()=>{if(this.delegate?.onInvite===void 0)throw Error(`onInvite undefined.`);this.delegate.onInvite(t)});return}this.delegate.onInvite(t);return}t.reject({statusCode:486})},onMessage:e=>{if(this.delegate&&this.delegate.onMessage){let t=new xe(e);this.delegate.onMessage(t)}else e.accept()},onNotify:e=>{if(this.delegate&&this.delegate.onNotify){let t=new Se(e);this.delegate.onNotify(t)}else this.options.allowLegacyNotifications?e.accept():e.reject({statusCode:481})},onRefer:e=>{this.logger.warn(`Received an out of dialog REFER request`),this.delegate&&this.delegate.onReferRequest?this.delegate.onReferRequest(e):e.reject({statusCode:405})},onRegister:e=>{this.logger.warn(`Received an out of dialog REGISTER request`),this.delegate&&this.delegate.onRegisterRequest?this.delegate.onRegisterRequest(e):e.reject({statusCode:405})},onSubscribe:e=>{this.logger.warn(`Received an out of dialog SUBSCRIBE request`),this.delegate&&this.delegate.onSubscribeRequest?this.delegate.onSubscribeRequest(e):e.reject({statusCode:405})}})}initTransportCallbacks(){this.transport.onConnect=()=>this.onTransportConnect(),this.transport.onDisconnect=e=>this.onTransportDisconnect(e),this.transport.onMessage=e=>this.onTransportMessage(e)}onTransportConnect(){this.state!==Ae.Stopped&&this.delegate&&this.delegate.onConnect&&this.delegate.onConnect()}onTransportDisconnect(e){this.state!==Ae.Stopped&&(this.delegate&&this.delegate.onDisconnect&&this.delegate.onDisconnect(e),e&&this.options.reconnectionAttempts>0&&this.attemptReconnection())}onTransportMessage(e){let t=Le.parseMessage(e,this.getLogger(`sip.Parser`));if(!t){this.logger.warn(`Failed to parse incoming message. Dropping.`);return}if(this.state===Ae.Stopped&&t instanceof le){this.logger.warn(`Received ${t.method} request while stopped. Dropping.`);return}let n=()=>{for(let e of[`from`,`to`,`call_id`,`cseq`,`via`])if(!t.hasHeader(e))return this.logger.warn(`Missing mandatory header field : ${e}.`),!1;return!0};if(t instanceof le){if(!n()){this.logger.warn(`Request missing mandatory header field. Dropping.`);return}if(!t.toTag&&t.callId.substr(0,5)===this.options.sipjsId){this.userAgentCore.replyStateless(t,{statusCode:482});return}let e=M(t.body),r=t.getHeader(`content-length`);if(r&&e<Number(r)){this.userAgentCore.replyStateless(t,{statusCode:400});return}}if(t instanceof ue){if(!n()){this.logger.warn(`Response missing mandatory header field. Dropping.`);return}if(t.getHeaders(`via`).length>1){this.logger.warn(`More than one Via header field present in the response. Dropping.`);return}if(t.via.host!==this.options.viaHost||t.via.port!==void 0){this.logger.warn(`Via sent-by in the response does not match UA Via host value. Dropping.`);return}let e=M(t.body),r=t.getHeader(`content-length`);if(r&&e<Number(r)){this.logger.warn(`Message body length is lower than the value in Content-Length header field. Dropping.`);return}}if(t instanceof le){this.userAgentCore.receiveIncomingRequestFromTransport(t);return}if(t instanceof ue){this.userAgentCore.receiveIncomingResponseFromTransport(t);return}throw Error(`Invalid message type.`)}transitionState(e,t){let n=()=>{throw Error(`Invalid state transition from ${this._state} to ${e}`)};switch(this._state){case Ae.Started:e!==Ae.Stopped&&n();break;case Ae.Stopped:e!==Ae.Started&&n();break;default:throw Error(`Unknown state.`)}this.logger.log(`Transitioned from ${this._state} to ${e}`),this._state=e,this._stateEventEmitter.emit(this._state)}},U=new window.AudioContext,At={1:[697,1209],2:[697,1336],3:[697,1477],A:[697,1633],4:[770,1209],5:[770,1336],6:[770,1477],B:[770,1633],7:[852,1209],8:[852,1336],9:[852,1477],C:[852,1633],"*":[941,1209],0:[941,1336],"#":[941,1477],D:[941,1633]},jt=(0,t.ref)(null),Mt=(0,t.ref)(null),Nt=(0,t.ref)(.5);let Pt=()=>({playDtmf:(e,t=150)=>{U.state===`suspended`&&U.resume();let n=At[e.toUpperCase()];if(!n)return;let r=U.createOscillator(),i=U.createOscillator(),a=U.createGain();r.frequency.value=n[0],i.frequency.value=n[1],r.type=`sine`,i.type=`sine`,a.gain.value=.1*Nt.value,r.connect(a),i.connect(a),a.connect(U.destination),r.start(),i.start(),setTimeout(()=>{r.stop(),i.stop(),r.disconnect(),i.disconnect(),a.disconnect()},t)},startRingtone:()=>{if(jt.value)return;U.state===`suspended`&&U.resume();let e=()=>{let e=U.currentTime,t=U.createOscillator(),n=U.createGain();t.type=`sine`,t.frequency.setValueAtTime(523.25,e),t.frequency.setValueAtTime(659.25,e+.1),t.frequency.setValueAtTime(783.99,e+.2),n.gain.setValueAtTime(.1*Nt.value,e),n.gain.exponentialRampToValueAtTime(.001,e+.5),t.connect(n),n.connect(U.destination),t.start(e),t.stop(e+.5)};e(),jt.value=window.setInterval(()=>{e(),setTimeout(e,400)},3e3)},stopRingtone:()=>{jt.value&&=(clearInterval(jt.value),null)},startRingback:()=>{if(Mt.value)return;U.state===`suspended`&&U.resume();let e=()=>{let e=U.currentTime,t=U.createOscillator(),n=U.createGain();t.type=`sine`,t.frequency.value=425,n.gain.setValueAtTime(.1*Nt.value,e),n.gain.linearRampToValueAtTime(.1*Nt.value,e+1),n.gain.linearRampToValueAtTime(0,e+1.1),t.connect(n),n.connect(U.destination),t.start(e),t.stop(e+1.1)};e(),Mt.value=window.setInterval(()=>{e()},4e3)},stopRingback:()=>{Mt.value&&=(clearInterval(Mt.value),null)},setNotificationVolume:e=>{Nt.value=Math.max(0,Math.min(1,e/100))}});function Ft(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Ft(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function It(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Ft(e))&&(r&&(r+=` `),r+=t);return r}var Lt=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},Rt=(e,t)=>({classGroupId:e,validator:t}),zt=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Bt=`-`,Vt=[],Ht=`arbitrary..`,Ut=e=>{let t=Kt(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return Gt(e);let n=e.split(Bt);return Wt(n,n[0]===``&&n.length>1?1:0,t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?Lt(i,t):t:i||Vt}return n[e]||Vt}}},Wt=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=Wt(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(Bt):e.slice(t).join(Bt),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},Gt=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?Ht+r:void 0})(),Kt=e=>{let{theme:t,classGroups:n}=e;return qt(n,t)},qt=(e,t)=>{let n=zt();for(let r in e){let i=e[r];Jt(i,n,r,t)}return n},Jt=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];Yt(i,t,n,r)}},Yt=(e,t,n,r)=>{if(typeof e==`string`){Xt(e,t,n);return}if(typeof e==`function`){Zt(e,t,n,r);return}Qt(e,t,n,r)},Xt=(e,t,n)=>{let r=e===``?t:$t(t,e);r.classGroupId=n},Zt=(e,t,n,r)=>{if(en(e)){Jt(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(Rt(n,e))},Qt=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];Jt(o,$t(t,a),n,r)}},$t=(e,t)=>{let n=e,r=t.split(Bt),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=zt(),n.nextPart.set(t,i)),n=i}return n},en=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,tn=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},nn=`!`,rn=`:`,an=[],on=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),sn=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===rn){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(nn)?(c=s.slice(0,-1),l=!0):s.startsWith(nn)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return on(t,l,c,u)};if(t){let e=t+rn,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):on(an,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},cn=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},ln=e=>({cache:tn(e.cacheSize),parseClassName:sn(e),sortModifiers:cn(e),...Ut(e)}),un=/\s+/,dn=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a}=t,o=[],s=e.trim().split(un),c=``;for(let e=s.length-1;e>=0;--e){let t=s[e],{isExternal:l,modifiers:u,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:p}=n(t);if(l){c=t+(c.length>0?` `+c:c);continue}let m=!!p,h=r(m?f.substring(0,p):f);if(!h){if(!m){c=t+(c.length>0?` `+c:c);continue}if(h=r(f),!h){c=t+(c.length>0?` `+c:c);continue}m=!1}let g=u.length===0?``:u.length===1?u[0]:a(u).join(`:`),_=d?g+nn:g,v=_+h;if(o.indexOf(v)>-1)continue;o.push(v);let y=i(h,m);for(let e=0;e<y.length;++e){let t=y[e];o.push(_+t)}c=t+(c.length>0?` `+c:c)}return c},fn=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=pn(n))&&(i&&(i+=` `),i+=r);return i},pn=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=pn(e[r]))&&(n&&(n+=` `),n+=t);return n},mn=(e,...t)=>{let n,r,i,a,o=o=>(n=ln(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=dn(e,n);return i(e,a),a};return a=o,(...e)=>a(fn(...e))},hn=[],W=e=>{let t=t=>t[e]||hn;return t.isThemeGetter=!0,t},gn=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,_n=/^\((?:(\w[\w-]*):)?(.+)\)$/i,vn=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,yn=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,bn=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,xn=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Sn=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Cn=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,wn=e=>vn.test(e),G=e=>!!e&&!Number.isNaN(Number(e)),Tn=e=>!!e&&Number.isInteger(Number(e)),En=e=>e.endsWith(`%`)&&G(e.slice(0,-1)),Dn=e=>yn.test(e),On=()=>!0,kn=e=>bn.test(e)&&!xn.test(e),An=()=>!1,jn=e=>Sn.test(e),Mn=e=>Cn.test(e),Nn=e=>!K(e)&&!q(e),Pn=e=>Yn(e,$n,An),K=e=>gn.test(e),Fn=e=>Yn(e,er,kn),In=e=>Yn(e,tr,G),Ln=e=>Yn(e,rr,On),Rn=e=>Yn(e,nr,An),zn=e=>Yn(e,Zn,An),Bn=e=>Yn(e,Qn,Mn),Vn=e=>Yn(e,ir,jn),q=e=>_n.test(e),Hn=e=>Xn(e,er),Un=e=>Xn(e,nr),Wn=e=>Xn(e,Zn),Gn=e=>Xn(e,$n),Kn=e=>Xn(e,Qn),qn=e=>Xn(e,ir,!0),Jn=e=>Xn(e,rr,!0),Yn=(e,t,n)=>{let r=gn.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Xn=(e,t,n=!1)=>{let r=_n.exec(e);return r?r[1]?t(r[1]):n:!1},Zn=e=>e===`position`||e===`percentage`,Qn=e=>e===`image`||e===`url`,$n=e=>e===`length`||e===`size`||e===`bg-size`,er=e=>e===`length`,tr=e=>e===`number`,nr=e=>e===`family-name`,rr=e=>e===`number`||e===`weight`,ir=e=>e===`shadow`,ar=mn(()=>{let e=W(`color`),t=W(`font`),n=W(`text`),r=W(`font-weight`),i=W(`tracking`),a=W(`leading`),o=W(`breakpoint`),s=W(`container`),c=W(`spacing`),l=W(`radius`),u=W(`shadow`),d=W(`inset-shadow`),f=W(`text-shadow`),p=W(`drop-shadow`),m=W(`blur`),h=W(`perspective`),g=W(`aspect`),_=W(`ease`),v=W(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),q,K],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[q,K,c],T=()=>[wn,`full`,`auto`,...w()],E=()=>[Tn,`none`,`subgrid`,q,K],ee=()=>[`auto`,{span:[`full`,Tn,q,K]},Tn,q,K],D=()=>[Tn,`auto`,q,K],te=()=>[`auto`,`min`,`max`,`fr`,q,K],O=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],ne=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],k=()=>[`auto`,...w()],re=()=>[wn,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],ie=()=>[wn,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],A=()=>[wn,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],j=()=>[e,q,K],ae=()=>[...b(),Wn,zn,{position:[q,K]}],oe=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],se=()=>[`auto`,`cover`,`contain`,Gn,Pn,{size:[q,K]}],ce=()=>[En,Hn,Fn],M=()=>[``,`none`,`full`,l,q,K],N=()=>[``,G,Hn,Fn],le=()=>[`solid`,`dashed`,`dotted`,`double`],ue=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],P=()=>[G,En,Wn,zn],de=()=>[``,`none`,m,q,K],fe=()=>[`none`,G,q,K],pe=()=>[`none`,G,q,K],me=()=>[G,q,K],he=()=>[wn,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[Dn],breakpoint:[Dn],color:[On],container:[Dn],"drop-shadow":[Dn],ease:[`in`,`out`,`in-out`],font:[Nn],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[Dn],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[Dn],shadow:[Dn],spacing:[`px`,G],text:[Dn],"text-shadow":[Dn],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,wn,K,q,g]}],container:[`container`],columns:[{columns:[G,K,q,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[Tn,`auto`,q,K]}],basis:[{basis:[wn,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[G,wn,`auto`,`initial`,`none`,K]}],grow:[{grow:[``,G,q,K]}],shrink:[{shrink:[``,G,q,K]}],order:[{order:[Tn,`first`,`last`,`none`,q,K]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:ee()}],"col-start":[{"col-start":D()}],"col-end":[{"col-end":D()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:ee()}],"row-start":[{"row-start":D()}],"row-end":[{"row-end":D()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":te()}],"auto-rows":[{"auto-rows":te()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...O(),`normal`]}],"justify-items":[{"justify-items":[...ne(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...ne()]}],"align-content":[{content:[`normal`,...O()]}],"align-items":[{items:[...ne(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...ne(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":O()}],"place-items":[{"place-items":[...ne(),`baseline`]}],"place-self":[{"place-self":[`auto`,...ne()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:k()}],mx:[{mx:k()}],my:[{my:k()}],ms:[{ms:k()}],me:[{me:k()}],mbs:[{mbs:k()}],mbe:[{mbe:k()}],mt:[{mt:k()}],mr:[{mr:k()}],mb:[{mb:k()}],ml:[{ml:k()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:re()}],"inline-size":[{inline:[`auto`,...ie()]}],"min-inline-size":[{"min-inline":[`auto`,...ie()]}],"max-inline-size":[{"max-inline":[`none`,...ie()]}],"block-size":[{block:[`auto`,...A()]}],"min-block-size":[{"min-block":[`auto`,...A()]}],"max-block-size":[{"max-block":[`none`,...A()]}],w:[{w:[s,`screen`,...re()]}],"min-w":[{"min-w":[s,`screen`,`none`,...re()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...re()]}],h:[{h:[`screen`,`lh`,...re()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...re()]}],"max-h":[{"max-h":[`screen`,`lh`,...re()]}],"font-size":[{text:[`base`,n,Hn,Fn]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,Jn,Ln]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,En,K]}],"font-family":[{font:[Un,Rn,t]}],"font-features":[{"font-features":[K]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,q,K]}],"line-clamp":[{"line-clamp":[G,`none`,q,In]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,q,K]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,q,K]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:j()}],"text-color":[{text:j()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...le(),`wavy`]}],"text-decoration-thickness":[{decoration:[G,`from-font`,`auto`,q,Fn]}],"text-decoration-color":[{decoration:j()}],"underline-offset":[{"underline-offset":[G,`auto`,q,K]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,q,K]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,q,K]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:ae()}],"bg-repeat":[{bg:oe()}],"bg-size":[{bg:se()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},Tn,q,K],radial:[``,q,K],conic:[Tn,q,K]},Kn,Bn]}],"bg-color":[{bg:j()}],"gradient-from-pos":[{from:ce()}],"gradient-via-pos":[{via:ce()}],"gradient-to-pos":[{to:ce()}],"gradient-from":[{from:j()}],"gradient-via":[{via:j()}],"gradient-to":[{to:j()}],rounded:[{rounded:M()}],"rounded-s":[{"rounded-s":M()}],"rounded-e":[{"rounded-e":M()}],"rounded-t":[{"rounded-t":M()}],"rounded-r":[{"rounded-r":M()}],"rounded-b":[{"rounded-b":M()}],"rounded-l":[{"rounded-l":M()}],"rounded-ss":[{"rounded-ss":M()}],"rounded-se":[{"rounded-se":M()}],"rounded-ee":[{"rounded-ee":M()}],"rounded-es":[{"rounded-es":M()}],"rounded-tl":[{"rounded-tl":M()}],"rounded-tr":[{"rounded-tr":M()}],"rounded-br":[{"rounded-br":M()}],"rounded-bl":[{"rounded-bl":M()}],"border-w":[{border:N()}],"border-w-x":[{"border-x":N()}],"border-w-y":[{"border-y":N()}],"border-w-s":[{"border-s":N()}],"border-w-e":[{"border-e":N()}],"border-w-bs":[{"border-bs":N()}],"border-w-be":[{"border-be":N()}],"border-w-t":[{"border-t":N()}],"border-w-r":[{"border-r":N()}],"border-w-b":[{"border-b":N()}],"border-w-l":[{"border-l":N()}],"divide-x":[{"divide-x":N()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":N()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...le(),`hidden`,`none`]}],"divide-style":[{divide:[...le(),`hidden`,`none`]}],"border-color":[{border:j()}],"border-color-x":[{"border-x":j()}],"border-color-y":[{"border-y":j()}],"border-color-s":[{"border-s":j()}],"border-color-e":[{"border-e":j()}],"border-color-bs":[{"border-bs":j()}],"border-color-be":[{"border-be":j()}],"border-color-t":[{"border-t":j()}],"border-color-r":[{"border-r":j()}],"border-color-b":[{"border-b":j()}],"border-color-l":[{"border-l":j()}],"divide-color":[{divide:j()}],"outline-style":[{outline:[...le(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[G,q,K]}],"outline-w":[{outline:[``,G,Hn,Fn]}],"outline-color":[{outline:j()}],shadow:[{shadow:[``,`none`,u,qn,Vn]}],"shadow-color":[{shadow:j()}],"inset-shadow":[{"inset-shadow":[`none`,d,qn,Vn]}],"inset-shadow-color":[{"inset-shadow":j()}],"ring-w":[{ring:N()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:j()}],"ring-offset-w":[{"ring-offset":[G,Fn]}],"ring-offset-color":[{"ring-offset":j()}],"inset-ring-w":[{"inset-ring":N()}],"inset-ring-color":[{"inset-ring":j()}],"text-shadow":[{"text-shadow":[`none`,f,qn,Vn]}],"text-shadow-color":[{"text-shadow":j()}],opacity:[{opacity:[G,q,K]}],"mix-blend":[{"mix-blend":[...ue(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":ue()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[G]}],"mask-image-linear-from-pos":[{"mask-linear-from":P()}],"mask-image-linear-to-pos":[{"mask-linear-to":P()}],"mask-image-linear-from-color":[{"mask-linear-from":j()}],"mask-image-linear-to-color":[{"mask-linear-to":j()}],"mask-image-t-from-pos":[{"mask-t-from":P()}],"mask-image-t-to-pos":[{"mask-t-to":P()}],"mask-image-t-from-color":[{"mask-t-from":j()}],"mask-image-t-to-color":[{"mask-t-to":j()}],"mask-image-r-from-pos":[{"mask-r-from":P()}],"mask-image-r-to-pos":[{"mask-r-to":P()}],"mask-image-r-from-color":[{"mask-r-from":j()}],"mask-image-r-to-color":[{"mask-r-to":j()}],"mask-image-b-from-pos":[{"mask-b-from":P()}],"mask-image-b-to-pos":[{"mask-b-to":P()}],"mask-image-b-from-color":[{"mask-b-from":j()}],"mask-image-b-to-color":[{"mask-b-to":j()}],"mask-image-l-from-pos":[{"mask-l-from":P()}],"mask-image-l-to-pos":[{"mask-l-to":P()}],"mask-image-l-from-color":[{"mask-l-from":j()}],"mask-image-l-to-color":[{"mask-l-to":j()}],"mask-image-x-from-pos":[{"mask-x-from":P()}],"mask-image-x-to-pos":[{"mask-x-to":P()}],"mask-image-x-from-color":[{"mask-x-from":j()}],"mask-image-x-to-color":[{"mask-x-to":j()}],"mask-image-y-from-pos":[{"mask-y-from":P()}],"mask-image-y-to-pos":[{"mask-y-to":P()}],"mask-image-y-from-color":[{"mask-y-from":j()}],"mask-image-y-to-color":[{"mask-y-to":j()}],"mask-image-radial":[{"mask-radial":[q,K]}],"mask-image-radial-from-pos":[{"mask-radial-from":P()}],"mask-image-radial-to-pos":[{"mask-radial-to":P()}],"mask-image-radial-from-color":[{"mask-radial-from":j()}],"mask-image-radial-to-color":[{"mask-radial-to":j()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[G]}],"mask-image-conic-from-pos":[{"mask-conic-from":P()}],"mask-image-conic-to-pos":[{"mask-conic-to":P()}],"mask-image-conic-from-color":[{"mask-conic-from":j()}],"mask-image-conic-to-color":[{"mask-conic-to":j()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:ae()}],"mask-repeat":[{mask:oe()}],"mask-size":[{mask:se()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,q,K]}],filter:[{filter:[``,`none`,q,K]}],blur:[{blur:de()}],brightness:[{brightness:[G,q,K]}],contrast:[{contrast:[G,q,K]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,qn,Vn]}],"drop-shadow-color":[{"drop-shadow":j()}],grayscale:[{grayscale:[``,G,q,K]}],"hue-rotate":[{"hue-rotate":[G,q,K]}],invert:[{invert:[``,G,q,K]}],saturate:[{saturate:[G,q,K]}],sepia:[{sepia:[``,G,q,K]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,q,K]}],"backdrop-blur":[{"backdrop-blur":de()}],"backdrop-brightness":[{"backdrop-brightness":[G,q,K]}],"backdrop-contrast":[{"backdrop-contrast":[G,q,K]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,G,q,K]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[G,q,K]}],"backdrop-invert":[{"backdrop-invert":[``,G,q,K]}],"backdrop-opacity":[{"backdrop-opacity":[G,q,K]}],"backdrop-saturate":[{"backdrop-saturate":[G,q,K]}],"backdrop-sepia":[{"backdrop-sepia":[``,G,q,K]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,q,K]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[G,`initial`,q,K]}],ease:[{ease:[`linear`,`initial`,_,q,K]}],delay:[{delay:[G,q,K]}],animate:[{animate:[`none`,v,q,K]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,q,K]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:fe()}],"rotate-x":[{"rotate-x":fe()}],"rotate-y":[{"rotate-y":fe()}],"rotate-z":[{"rotate-z":fe()}],scale:[{scale:pe()}],"scale-x":[{"scale-x":pe()}],"scale-y":[{"scale-y":pe()}],"scale-z":[{"scale-z":pe()}],"scale-3d":[`scale-3d`],skew:[{skew:me()}],"skew-x":[{"skew-x":me()}],"skew-y":[{"skew-y":me()}],transform:[{transform:[q,K,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:he()}],"translate-x":[{"translate-x":he()}],"translate-y":[{"translate-y":he()}],"translate-z":[{"translate-z":he()}],"translate-none":[`translate-none`],accent:[{accent:j()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:j()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,q,K]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,q,K]}],fill:[{fill:[`none`,...j()]}],"stroke-w":[{stroke:[G,Hn,Fn,In]}],stroke:[{stroke:[`none`,...j()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});let J=(...e)=>ar(It(e)),or=(e,t)=>{if(e){let t=sr(e);if(t&&cr(t))return t;if(e.trim())return e.trim()}if(t){let e=sr(t);if(e&&cr(e))return e;let n=lr(t);if(n)return n;if(t.trim()&&!t.includes(`@`))return t.trim()}return`Unknown`};var sr=e=>e.replace(/[^\d+*#]/g,``),cr=e=>/^\+?[\d*#]{2,}$/.test(e),lr=e=>{let t=e.match(/^([+]?[\d*#]{2,})\s*[-:]/);return t&&t[1]||(t=e.match(/\(([+]?[\d*#]{2,})\)/),t&&t[1])||(t=e.match(/(?:ext\.?|extension)\s*([+]?[\d*#]{2,})/i),t&&t[1])?t[1]:(t=e.match(/([+]?\d{1,3}[-.\s]?\(?\d{1,4}\)?[-.\s]?\d{1,4}[-.\s]?\d{1,9})/),t&&t[1]?sr(t[1]):null)};let ur=e=>{let n=(0,t.shallowRef)(null),r=(0,t.shallowRef)(null),i=(0,t.shallowRef)(new Map),a=new Audio;a.autoplay=!0;let o=(0,t.shallowRef)(void 0),s=(0,t.shallowRef)(null),c=(0,t.shallowRef)(null),l=null,u=null,d=(0,t.computed)(()=>n.value?.configuration.uri?.user||``),{startRingtone:f,stopRingtone:p,startRingback:m,stopRingback:h,setNotificationVolume:g}=Pt(),_=()=>{e.channels.value.some(e=>e.status===`incoming`)?f():p(),e.activeChannel.value?.status===`calling`?m():h()},v=e=>{a.volume=e/100},y=async e=>{typeof a.setSinkId==`function`&&await a.setSinkId(e)},b=e=>{o.value=e},x=(e=!1)=>{let t={echoCancellation:{ideal:!0},noiseSuppression:{ideal:!1},autoGainControl:{ideal:!1},channelCount:1};return o.value&&(t.deviceId={exact:o.value}),{audio:t,video:e}},S=async t=>{if(!n.value){try{(await navigator.mediaDevices.getUserMedia({audio:!0})).getTracks().forEach(e=>e.stop())}catch(e){console.error(`Microphone permission denied`,e);return}try{let i=kt.makeURI(t.uri);if(!i)throw Error(`Invalid URI`);n.value=new kt({uri:i,logLevel:`error`,transportOptions:{server:t.transportOptions.server},authorizationUsername:t.authorizationUsername,authorizationPassword:t.authorizationPassword,reconnectionDelay:5,reconnectionAttempts:3,delegate:{onConnect:()=>e.setConnected(!0),onDisconnect:()=>e.setConnected(!1),onInvite:e=>T(e)}}),await n.value.start(),r.value=new ke(n.value),await r.value.register(),C()}catch{}}},C=()=>{let t=null,n=Date.now(),r=(e=1e3)=>{t&&clearTimeout(t),t=setTimeout(async()=>{t=null,await w()},e)},i=()=>{if(document.visibilityState===`visible`){let e=Date.now()-n;e>5e3?(console.log(`[SipJs] Device was suspended for ${Math.round(e/1e3)}s, reconnecting...`),r(1500)):r(500)}n=Date.now()},a=()=>{console.log(`[SipJs] Network online, reconnecting...`),r(1e3)},o=()=>{console.log(`[SipJs] Network offline`),e.setConnected(!1),t&&=(clearTimeout(t),null)},s=null,c=()=>{s=setInterval(()=>{let e=Date.now(),t=e-n;t>3e4&&(console.log(`[SipJs] Heartbeat drift detected (${Math.round(t/1e3)}s), device may have woken from sleep`),r(1500)),n=e},1e3)};document.addEventListener(`visibilitychange`,i),window.addEventListener(`online`,a),window.addEventListener(`offline`,o),document.addEventListener(`freeze`,()=>{console.log(`[SipJs] Page frozen`),s&&=(clearInterval(s),null)}),document.addEventListener(`resume`,()=>{console.log(`[SipJs] Page resumed`),n=Date.now(),c(),r(1e3)}),c()},w=async()=>{if(n.value){if(!navigator.onLine){console.log(`[SipJs] Skipping reconnect, device is offline`);return}if(i.value.size>0){console.log(`[SipJs] Skipping reconnect, active calls in progress`);return}try{if(n.value.isConnected()||(console.log(`[SipJs] Reconnecting...`),await n.value.reconnect()),r.value&&n.value.isConnected())try{await r.value.register()}catch{}}catch(e){console.error(`[SipJs] Reconnection failed:`,e)}}},T=t=>{console.log(`[SipJs] 📞 Llamada entrante recibida`),console.log(`[SipJs] Remote Identity URI:`,t.remoteIdentity.uri.toString()),console.log(`[SipJs] Remote Identity URI user:`,t.remoteIdentity.uri.user),console.log(`[SipJs] Remote Identity displayName:`,t.remoteIdentity.displayName);let n=e.channels.value.find(e=>e.status===`idle`);if(!n){console.warn(`[SipJs] ⚠️ No hay canales disponibles, rechazando llamada`),t.reject();return}let r=n.id;i.value.set(r,t);let a=t.body?t.body.includes(`m=video`):!1,o=or(t.remoteIdentity.uri.user,t.remoteIdentity.displayName);console.log(`[SipJs] 📋 Caller number extraído:`,o),console.log(`[SipJs] 🎥 Video:`,a?`Sí`:`No`),e.updateChannelState(r,{status:`incoming`,remoteNumber:o,remoteDisplayName:t.remoteIdentity.displayName||void 0,hasVideo:a}),_(),e.setActiveChannelId(r),t.stateChange.addListener(n=>{switch(n){case R.Terminated:{let n=e.channels.value.find(e=>e.id===r),a=or(t.remoteIdentity.uri.user,t.remoteIdentity.displayName);if(n?.status===`connected`){let t=Math.floor((Date.now()-(n.startTime||Date.now()))/1e3);e.addCallLog({number:a,direction:`incoming`,status:`answered`,startTime:n.startTime||Date.now(),duration:t})}else n?.status===`incoming`&&e.addCallLog({number:a,direction:`incoming`,status:`missed`,startTime:Date.now(),duration:0});e.updateChannelState(r,{status:`idle`,remoteNumber:``,isMuted:!1,isHeld:!1,hasVideo:!1,hasEarlyMedia:!1}),i.value.delete(r),e.activeChannelId.value===r&&se(),_();break}case R.Established:e.updateChannelState(r,{status:`connected`,startTime:Date.now()}),e.activeChannelId.value===r&&oe(t),_();break}})},E=async(t,r=!1)=>{if(!n.value)return;let a=e.activeChannelId.value;if(i.value.has(a))return;let o=kt.makeURI(t);if(!o&&n.value.configuration.uri){let e=n.value.configuration.uri.host;o=kt.makeURI(`sip:${t}@${e}`)}if(!o)return;let s=new Oe(n.value,o);i.value.set(a,s),e.updateChannelState(a,{status:`calling`,remoteNumber:t,hasVideo:r}),e.setLastDialedNumber(t),_(),s.stateChange.addListener(n=>{switch(n){case R.Established:e.channels.value.find(e=>e.id===a)?.status!==`connected`&&(e.updateChannelState(a,{status:`connected`,startTime:Date.now()}),oe(s),_());break;case R.Terminated:{let n=e.channels.value.find(e=>e.id===a);if(n?.status===`connected`){let r=Math.floor((Date.now()-(n.startTime||Date.now()))/1e3);e.addCallLog({number:t,direction:`outgoing`,status:`answered`,startTime:n.startTime||Date.now(),duration:r})}else e.addCallLog({number:t,direction:`outgoing`,status:`cancelled`,startTime:Date.now(),duration:0});e.updateChannelState(a,{status:`idle`,remoteNumber:``,isMuted:!1,isHeld:!1,startTime:void 0,keypadValue:``,hasVideo:!1}),i.value.delete(a),e.activeChannelId.value===a&&se(),_();break}}});let c={sessionDescriptionHandlerOptions:{constraints:x(r)},requestDelegate:{onProgress:t=>{(t.message.statusCode===180||t.message.statusCode===183)&&(t.message.body&&(e.updateChannelState(a,{hasEarlyMedia:!0}),oe(s)),_())},onAccept:t=>{e.channels.value.find(e=>e.id===a)?.status!==`connected`&&(e.updateChannelState(a,{status:`connected`,startTime:Date.now()}),oe(s),_())}}};await s.invite(c)},ee=async(t=!1)=>{let n=i.value.get(e.activeChannelId.value);if(n instanceof De&&n.state===R.Initial){for(let[t,n]of i.value.entries())if(t!==e.activeChannelId.value&&n.state===R.Established&&!e.channels.value.find(e=>e.id===t)?.isHeld)try{await O(n,!0),e.updateChannelState(t,{isHeld:!0})}catch(e){console.error(`[SipJs] Failed to hold channel ${t}:`,e)}let r={sessionDescriptionHandlerOptions:{constraints:x(t)}};await n.accept(r),_()}},D=async()=>{let t=i.value.get(e.activeChannelId.value);if(t)switch(t.state){case R.Initial:case R.Establishing:t instanceof Oe?await t.cancel():t instanceof De&&await t.reject();break;case R.Established:await t.bye();break}},te=()=>{let t=i.value.get(e.activeChannelId.value);if(!t)return;let n=!e.isMuted.value,r=!1,a=t.sessionDescriptionHandler;a?.peerConnection&&a.peerConnection.getSenders().forEach(e=>{e.track&&e.track.kind===`audio`&&(e.track.enabled=!n,r=!0)}),c.value&&c.value.getAudioTracks().forEach(e=>{e.enabled=!n,r=!0}),r||console.warn(`[SipJs] No audio tracks found to mute/unmute`),e.setMuted(n)},O=async(e,t)=>{let n={sessionDescriptionHandlerOptions:{hold:t}};await e.invite(n)},ne=async()=>{let t=i.value.get(e.activeChannelId.value);if(t?.state!==R.Established)return;let n=!e.isHeld.value;try{await O(t,n),e.setHeld(n)}catch{}},k=async t=>{let n=e.activeChannelId.value;if(n===t)return;let r=i.value.get(n),a=i.value.get(t),o=e.channels.value.find(e=>e.id===n),s=e.channels.value.find(e=>e.id===t);if(r&&r.state===R.Established&&!o?.isHeld)try{await O(r,!0),e.updateChannelState(n,{isHeld:!0})}catch{}if(e.setActiveChannelId(t),_(),a&&a.state===R.Established){if(s?.isHeld)try{await O(a,!1),e.updateChannelState(t,{isHeld:!1})}catch{}if(s?.isMuted){let e=a.sessionDescriptionHandler;e?.peerConnection&&e.peerConnection.getSenders().forEach(e=>{e.track&&e.track.kind===`audio`&&(e.track.enabled=!1)}),c.value&&c.value.getAudioTracks().forEach(e=>{e.enabled=!1})}oe(a)}else se()},re=t=>{let n=i.value.get(e.activeChannelId.value);if(n?.state!==R.Established)return;let r={requestOptions:{body:{content:`Signal=${t}\r\nDuration=160`,contentType:`application/dtmf-relay`,contentDisposition:`signal`}}};n.info(r)},ie=async t=>{console.log(`[SipJs] 🔄 transferCall iniciado`),console.log(`[SipJs] Target:`,t);let r=e.activeChannelId.value,a=i.value.get(r);if(!a)throw console.error(`[SipJs] ❌ No hay sesión activa en el canal`,r),Error(`No active session to transfer`);if(console.log(`[SipJs] Sesión encontrada - Estado:`,a.state),console.log(`[SipJs] Dialog ID:`,a.dialog?.id),console.log(`[SipJs] Call ID:`,a.dialog?.callId),a.state!==R.Established)throw console.error(`[SipJs] ❌ Sesión no establecida. Estado actual:`,a.state),Error(`Cannot transfer call. Call is not established (state: ${a.state})`);let o=kt.makeURI(t);if(!o&&n.value?.configuration.uri){let e=n.value.configuration.uri.host;console.log(`[SipJs] Construyendo URI con dominio:`,e),o=kt.makeURI(`sip:${t}@${e}`)}if(!o)throw console.error(`[SipJs] ❌ URI de destino inválida:`,t),Error(`Invalid transfer target: ${t}`);console.log(`[SipJs] 📤 URI de transferencia:`,o.toString()),console.log(`[SipJs] URI scheme:`,o.scheme),console.log(`[SipJs] URI user:`,o.user),console.log(`[SipJs] URI host:`,o.host);try{console.log(`[SipJs] 🚀 Enviando REFER...`),await a.refer(o,{requestDelegate:{onAccept:e=>{console.log(`[SipJs] ✅ Transfer REFER aceptado por el servidor (202 Accepted)`),console.log(`[SipJs] Response:`,e.message)},onReject:e=>{let t=e.message.statusCode;console.error(`[SipJs] ❌ Transfer REFER rechazado:`,t),console.error(`[SipJs] Response completo:`,e.message)}},onNotify:e=>{console.log(`[SipJs] 📬 NOTIFY recibido para transferencia`),console.log(`[SipJs] NOTIFY request:`,e.request),e.accept();let t=e.request.body;if(console.log(`[SipJs] NOTIFY body:`,t),t){let e=t.match(/SIP\/2\.0\s+(\d{3})(.*)/);if(e&&e[1]){let t=parseInt(e[1],10),n=e[2]?.trim()||``;if(console.log(`[SipJs] 📊 Status code:`,t),console.log(`[SipJs] 📊 Status text:`,n),t>=200&&t<300)console.log(`[SipJs] ✅ Transferencia exitosa! Terminando sesión...`),setTimeout(()=>{a.bye().catch(e=>{console.warn(`[SipJs] Error hanging up after successful transfer:`,e)})},500);else if(t>=400){console.error(`[SipJs] ❌ Transfer falló con status:`,t,n),console.log(`[SipJs] 🔄 Manteniendo la sesión activa para el usuario`);let e={404:`Número no encontrado`,486:`Número ocupado`,487:`Transferencia cancelada`,503:`Servicio no disponible - el destino puede estar fuera de línea`}[t]||`Error en transferencia (código ${t})`;console.warn(`[SipJs] 💬`,e)}else t>=100&&t<200&&console.log(`[SipJs] 📞 Transferencia en progreso:`,t,n)}else console.warn(`[SipJs] ⚠️ No se pudo extraer el código de estado del NOTIFY body`)}else console.warn(`[SipJs] ⚠️ NOTIFY sin body`)}}),console.log(`[SipJs] ✅ REFER enviado exitosamente (promesa resuelta)`)}catch(e){throw console.error(`[SipJs] ❌ Error en transferCall:`,e),console.error(`[SipJs] Error type:`,e?.constructor?.name),console.error(`[SipJs] Error message:`,e instanceof Error?e.message:String(e)),console.error(`[SipJs] Error stack:`,e instanceof Error?e.stack:`N/A`),e}},A=async t=>{console.log(`[SipJs] 🔄 startAttendedTransfer iniciado`),console.log(`[SipJs] Target:`,t);let n=e.activeChannelId.value,r=i.value.get(n);if(console.log(`[SipJs] Canal original:`,n),console.log(`[SipJs] Sesión original:`,r?.state),!r||r.state!==R.Established)throw console.error(`[SipJs] ❌ No hay llamada establecida para transferir`),Error(`No established call to transfer`);let a=e.channels.value.find(e=>e.status===`idle`);if(console.log(`[SipJs] Canal de consulta encontrado:`,a?.id),!a)throw console.error(`[SipJs] ❌ No hay canales disponibles para llamada de consulta`),Error(`No available channel for consultation call`);try{console.log(`[SipJs] 🔇 Poniendo llamada original en hold...`),await O(r,!0),e.updateChannelState(n,{isHeld:!0}),console.log(`[SipJs] ✅ Llamada original en hold`)}catch(e){throw console.error(`[SipJs] ❌ Failed to hold original call:`,e),Error(`Failed to put call on hold`)}console.log(`[SipJs] 🔄 Cambiando al canal de consulta:`,a.id),e.setActiveChannelId(a.id);try{console.log(`[SipJs] 📞 Iniciando llamada de consulta a:`,t),await E(t,!1),console.log(`[SipJs] ✅ Llamada de consulta iniciada`),e.setTransferInProgress({originalChannelId:n,consultationChannelId:a.id,targetNumber:t}),console.log(`[SipJs] 📋 Transferencia en progreso registrada`)}catch(t){throw console.error(`[SipJs] ❌ Failed to start consultation call:`,t),console.log(`[SipJs] 🔄 Volviendo al canal original y quitando hold...`),e.setActiveChannelId(n),await O(r,!1).catch(()=>{}),e.updateChannelState(n,{isHeld:!1}),Error(`Failed to initiate consultation call`)}},j=async()=>{console.log(`[SipJs] 🔄 completeAttendedTransfer iniciado`);let t=e.transferInProgress.value;if(!t)throw console.error(`[SipJs] ❌ No hay transferencia en progreso`),Error(`No transfer in progress`);console.log(`[SipJs] Estado de transferencia:`,t);let r=i.value.get(t.originalChannelId),a=i.value.get(t.consultationChannelId);if(console.log(`[SipJs] Sesión original:`,r?.state),console.log(`[SipJs] Sesión de consulta:`,a?.state),!r||!a)throw console.error(`[SipJs] ❌ Falta una o ambas sesiones`),Error(`Missing session for transfer`);if(a.state!==R.Established)throw console.error(`[SipJs] ❌ Llamada de consulta no está establecida. Estado:`,a.state),Error(`Consultation call not established`);let o=a.dialog;if(!o)throw Error(`No dialog available for consultation session`);let s=o.callId,c=o.remoteTag,l=o.localTag,u=kt.makeURI(t.targetNumber);if(!u&&n.value?.configuration.uri){let e=n.value.configuration.uri.host;u=kt.makeURI(`sip:${t.targetNumber}@${e}`)}if(!u)throw Error(`Invalid transfer target URI`);let d=`${encodeURIComponent(s)}%3Bto-tag%3D${encodeURIComponent(c)}%3Bfrom-tag%3D${encodeURIComponent(l)}`;u.setHeader(`Replaces`,d);try{await r.refer(u,{onNotify:t=>{t.accept();let n=t.request.body,i=typeof n==`string`?n:n&&typeof n==`object`&&`content`in n?n.content:void 0;if(i){let t=i.match(/SIP\/2\.0\s+(\d+)/);if(t&&t[1]){let n=parseInt(t[1]);n>=200&&n<300?setTimeout(()=>{r.bye().catch(()=>{}),a.bye().catch(()=>{}),e.setTransferInProgress(null)},500):n>=400&&(console.error(`[SipJs] Attended transfer failed with status:`,n),e.setTransferInProgress(null))}}},requestDelegate:{onAccept:()=>{},onReject:t=>{console.error(`[SipJs] Attended transfer REFER rejected:`,t.message.statusCode),e.setTransferInProgress(null)}}})}catch(e){throw console.error(`[SipJs] Attended transfer failed:`,e),e}},ae=async()=>{let t=e.transferInProgress.value;if(!t)throw Error(`No transfer in progress`);console.log(`[SipJs] Canceling attended transfer...`);let n=i.value.get(t.originalChannelId),r=i.value.get(t.consultationChannelId);if(r)try{await r.bye(),console.log(`[SipJs] Consultation call ended`)}catch(e){console.warn(`[SipJs] Error ending consultation:`,e)}if(n)try{e.setActiveChannelId(t.originalChannelId),await O(n,!1),e.updateChannelState(t.originalChannelId,{isHeld:!1}),console.log(`[SipJs] Returned to original call`)}catch(e){console.warn(`[SipJs] Error resuming original call:`,e)}e.setTransferInProgress(null)},oe=e=>{let t=e.sessionDescriptionHandler;if(!t){console.error(`[SipJs] setupRemoteMedia: no sessionDescriptionHandler`);return}let n=t.remoteMediaStream;if(!n){console.error(`[SipJs] setupRemoteMedia: no remoteMediaStream on SDH`);return}if(s.value===n)return;a.pause(),a.srcObject=null,l?.abort(),l=new AbortController,s.value=n,c.value=t.localMediaStream??null;let r=e=>{u?.abort(),u=new AbortController;let{signal:t}=u,n=()=>{a.play().catch(e=>{e.name!==`AbortError`&&console.error(`[SipJs] play() failed:`,e.name,e.message)})};e.addEventListener(`mute`,()=>{a.pause()},{signal:t}),e.addEventListener(`unmute`,()=>{n()},{signal:t}),e.muted||n()};n.addEventListener(`addtrack`,e=>{e.track.kind===`audio`&&(a.srcObject=null,a.srcObject=n,r(e.track))},{signal:l.signal});let[i]=n.getTracks();i&&(a.srcObject=n,r(i))},se=()=>{u?.abort(),u=null,l?.abort(),l=null,a.pause(),a.srcObject=null,s.value=null,c.value=null};return{initUserAgent:S,makeCall:E,answerCall:ee,hangupCall:D,toggleMute:te,toggleHold:ne,sendDTMF:re,transferCall:ie,startAttendedTransfer:A,completeAttendedTransfer:j,cancelAttendedTransfer:ae,switchChannel:k,extension:d,setVolume:v,setNotificationVolume:g,setOutputDevice:y,setInputDevice:b,remoteStream:s,localStream:c}};var dr=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e;let fr=It,pr=(e,t)=>n=>{if(t?.variants==null)return fr(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=dr(t)||dr(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return fr(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)};function mr(e){return typeof e==`string`?`'${e}'`:new hr().serialize(e)}var hr=function(){class e{#e=new Map;compare(e,t){let n=typeof e,r=typeof t;return n===`string`&&r===`string`?e.localeCompare(t):n===`number`&&r===`number`?e-t:String.prototype.localeCompare.call(this.serialize(e,!0),this.serialize(t,!0))}serialize(e,t){if(e===null)return`null`;switch(typeof e){case`string`:return t?e:`'${e}'`;case`bigint`:return`${e}n`;case`object`:return this.$object(e);case`function`:return this.$function(e)}return String(e)}serializeObject(e){let t=Object.prototype.toString.call(e);if(t!==`[object Object]`)return this.serializeBuiltInType(t.length<10?`unknown:${t}`:t.slice(8,-1),e);let n=e.constructor,r=n===Object||n===void 0?``:n.name;if(r!==``&&globalThis[r]===n)return this.serializeBuiltInType(r,e);if(typeof e.toJSON==`function`){let t=e.toJSON();return r+(typeof t==`object`&&t?this.$object(t):`(${this.serialize(t)})`)}return this.serializeObjectEntries(r,Object.entries(e))}serializeBuiltInType(e,t){let n=this[`$`+e];if(n)return n.call(this,t);if(typeof t?.entries==`function`)return this.serializeObjectEntries(e,t.entries());throw Error(`Cannot serialize ${e}`)}serializeObjectEntries(e,t){let n=Array.from(t).sort((e,t)=>this.compare(e[0],t[0])),r=`${e}{`;for(let e=0;e<n.length;e++){let[t,i]=n[e];r+=`${this.serialize(t,!0)}:${this.serialize(i)}`,e<n.length-1&&(r+=`,`)}return r+`}`}$object(e){let t=this.#e.get(e);return t===void 0&&(this.#e.set(e,`#${this.#e.size}`),t=this.serializeObject(e),this.#e.set(e,t)),t}$function(e){let t=Function.prototype.toString.call(e);return t.slice(-15)===`[native code] }`?`${e.name||``}()[native]`:`${e.name}(${e.length})${t.replace(/\s*\n\s*/g,``)}`}$Array(e){let t=`[`;for(let n=0;n<e.length;n++)t+=this.serialize(e[n]),n<e.length-1&&(t+=`,`);return t+`]`}$Date(e){try{return`Date(${e.toISOString()})`}catch{return`Date(null)`}}$ArrayBuffer(e){return`ArrayBuffer[${new Uint8Array(e).join(`,`)}]`}$Set(e){return`Set${this.$Array(Array.from(e).sort((e,t)=>this.compare(e,t)))}`}$Map(e){return this.serializeObjectEntries(`Map`,e.entries())}}for(let t of[`Error`,`RegExp`,`URL`])e.prototype[`$`+t]=function(e){return`${t}(${e})`};for(let t of[`Int8Array`,`Uint8Array`,`Uint8ClampedArray`,`Int16Array`,`Uint16Array`,`Int32Array`,`Uint32Array`,`Float32Array`,`Float64Array`])e.prototype[`$`+t]=function(e){return`${t}[${e.join(`,`)}]`};for(let t of[`BigInt64Array`,`BigUint64Array`])e.prototype[`$`+t]=function(e){return`${t}[${e.join(`n,`)}${e.length>0?`n`:``}]`};return e}();function gr(e,t){return e===t||mr(e)===mr(t)}function _r(e,t=-1/0,n=1/0){return Math.min(n,Math.max(t,e))}function vr(e,n){let r=typeof e==`string`&&!n?`${e}Context`:n,i=Symbol(r);return[n=>{let r=(0,t.inject)(i,n);if(r||r===null)return r;throw Error(`Injection \`${i.toString()}\` not found. Component must be used within ${Array.isArray(e)?`one of the following components: ${e.join(`, `)}`:`\`${e}\``}`)},e=>((0,t.provide)(i,e),e)]}function yr(){let e=document.activeElement;if(e==null)return null;for(;e!=null&&e.shadowRoot!=null&&e.shadowRoot.activeElement!=null;)e=e.shadowRoot.activeElement;return e}function br(e,t,n){let r=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&r.addEventListener(e,t,{once:!0}),r.dispatchEvent(i)}function xr(e){return e==null}function Sr(e){return e?e.flatMap(e=>e.type===t.Fragment?Sr(e.children):[e]):[]}var[Cr,wr]=vr(`ConfigProvider`);function Tr(e,n){return(0,t.getCurrentScope)()?((0,t.onScopeDispose)(e,n),!0):!1}function Er(){let e=new Set,t=t=>{e.delete(t)};return{on:n=>{e.add(n);let r=()=>t(n);return Tr(r),{off:r}},off:t,trigger:(...t)=>Promise.all(Array.from(e).map(e=>e(...t))),clear:()=>{e.clear()}}}var Dr=typeof window<`u`&&typeof document<`u`;typeof WorkerGlobalScope<`u`&&globalThis instanceof WorkerGlobalScope;var Or=kr();function kr(){var e,t;return Dr&&!!(!((e=window)==null||(e=e.navigator)==null)&&e.userAgent)&&(/iP(?:ad|hone|od)/.test(window.navigator.userAgent)||((t=window)==null||(t=t.navigator)==null?void 0:t.maxTouchPoints)>2&&/iPad|Macintosh/.test(window?.navigator.userAgent))}function Ar(e){return e||(0,t.getCurrentInstance)()}function jr(e,n=1e4){return(0,t.customRef)((r,i)=>{let a=(0,t.toValue)(e),o,s=()=>setTimeout(()=>{a=(0,t.toValue)(e),i()},(0,t.toValue)(n));return Tr(()=>{clearTimeout(o)}),{get(){return r(),a},set(e){a=e,i(),clearTimeout(o),o=s()}}})}function Mr(e,n){Ar(n)&&(0,t.onBeforeUnmount)(e,n)}function Nr(e,n,r={}){let{immediate:i=!0,immediateCallback:a=!1}=r,o=(0,t.shallowRef)(!1),s;function c(){s&&=(clearTimeout(s),void 0)}function l(){o.value=!1,c()}function u(...r){a&&e(),c(),o.value=!0,s=setTimeout(()=>{o.value=!1,s=void 0,e(...r)},(0,t.toValue)(n))}return i&&(o.value=!0,Dr&&u()),Tr(l),{isPending:(0,t.shallowReadonly)(o),start:u,stop:l}}function Pr(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null||Symbol.iterator in e?!1:Symbol.toStringTag in e?Object.prototype.toString.call(e)===`[object Module]`:!0}function Fr(e,t,n=`.`,r){if(!Pr(t))return Fr(e,{},n,r);let i=Object.assign({},t);for(let t in e){if(t===`__proto__`||t===`constructor`)continue;let a=e[t];a!=null&&(r&&r(i,t,a,n)||(Array.isArray(a)&&Array.isArray(i[t])?i[t]=[...a,...i[t]]:Pr(a)&&Pr(i[t])?i[t]=Fr(a,i[t],(n?`${n}.`:``)+t.toString(),r):i[t]=a))}return i}function Ir(e){return(...t)=>t.reduce((t,n)=>Fr(t,n,``,e),{})}var Lr=Ir(),Rr=(0,n.createSharedComposable)(()=>{let e=(0,t.ref)(new Map),r=(0,t.ref)(),i=(0,t.computed)(()=>{for(let t of e.value.values())if(t)return!0;return!1}),a=Cr({scrollBody:(0,t.ref)(!0)}),o=null,s=()=>{document.body.style.paddingRight=``,document.body.style.marginRight=``,document.body.style.pointerEvents=``,document.documentElement.style.removeProperty(`--scrollbar-width`),document.body.style.overflow=r.value??``,Or&&o?.(),r.value=void 0};return(0,t.watch)(i,(e,i)=>{if(!Dr)return;if(!e){i&&s();return}r.value===void 0&&(r.value=document.body.style.overflow);let c=window.innerWidth-document.documentElement.clientWidth,l={padding:c,margin:0},u=a.scrollBody?.value?typeof a.scrollBody.value==`object`?Lr({padding:a.scrollBody.value.padding===!0?c:a.scrollBody.value.padding,margin:a.scrollBody.value.margin===!0?c:a.scrollBody.value.margin},l):l:{padding:0,margin:0};c>0&&(document.body.style.paddingRight=typeof u.padding==`number`?`${u.padding}px`:String(u.padding),document.body.style.marginRight=typeof u.margin==`number`?`${u.margin}px`:String(u.margin),document.documentElement.style.setProperty(`--scrollbar-width`,`${c}px`),document.body.style.overflow=`hidden`),Or&&(o=(0,n.useEventListener)(document,`touchmove`,e=>Vr(e),{passive:!1})),(0,t.nextTick)(()=>{document.body.style.pointerEvents=`none`,document.body.style.overflow=`hidden`})},{immediate:!0,flush:`sync`}),e});function zr(e){let n=Math.random().toString(36).substring(2,7),r=Rr();r.value.set(n,e??!1);let i=(0,t.computed)({get:()=>r.value.get(n)??!1,set:e=>r.value.set(n,e)});return Mr(()=>{r.value.delete(n)}),i}function Br(e){let t=window.getComputedStyle(e);if(t.overflowX===`scroll`||t.overflowY===`scroll`||t.overflowX===`auto`&&e.clientWidth<e.scrollWidth||t.overflowY===`auto`&&e.clientHeight<e.scrollHeight)return!0;{let t=e.parentNode;return!(t instanceof Element)||t.tagName===`BODY`?!1:Br(t)}}function Vr(e){let t=e||window.event,n=t.target;return n instanceof Element&&Br(n)?!1:t.touches.length>1?!0:(t.preventDefault&&t.cancelable&&t.preventDefault(),!1)}function Hr(e){let n=Cr({dir:(0,t.ref)(`ltr`)});return(0,t.computed)(()=>e?.value||n.dir?.value||`ltr`)}function Ur(e){let n=(0,t.getCurrentInstance)(),r=n?.type.emits,i={};return r?.length||console.warn(`No emitted event found. Please check component: ${n?.type.__name}`),r?.forEach(n=>{i[(0,t.toHandlerKey)((0,t.camelize)(n))]=(...t)=>e(n,...t)}),i}var Wr=0;function Gr(){(0,t.watchEffect)(e=>{if(!Dr)return;let t=document.querySelectorAll(`[data-reka-focus-guard]`);document.body.insertAdjacentElement(`afterbegin`,t[0]??Kr()),document.body.insertAdjacentElement(`beforeend`,t[1]??Kr()),Wr++,e(()=>{Wr===1&&document.querySelectorAll(`[data-reka-focus-guard]`).forEach(e=>e.remove()),Wr--})})}function Kr(){let e=document.createElement(`span`);return e.setAttribute(`data-reka-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}function qr(e){return(0,t.computed)(()=>(0,t.toValue)(e)?!!(0,n.unrefElement)(e)?.closest(`form`):!0)}function Y(){let e=(0,t.getCurrentInstance)(),r=(0,t.ref)(),i=(0,t.computed)(()=>a());(0,t.onUpdated)(()=>{i.value!==a()&&(0,t.triggerRef)(r)});function a(){return r.value&&`$el`in r.value&&[`#text`,`#comment`].includes(r.value.$el.nodeName)?r.value.$el.nextElementSibling:(0,n.unrefElement)(r)}let o=Object.assign({},e.exposed),s={};for(let t in e.props)Object.defineProperty(s,t,{enumerable:!0,configurable:!0,get:()=>e.props[t]});if(Object.keys(o).length>0)for(let e in o)Object.defineProperty(s,e,{enumerable:!0,configurable:!0,get:()=>o[e]});Object.defineProperty(s,`$el`,{enumerable:!0,configurable:!0,get:()=>e.vnode.el}),e.exposed=s;function c(t){if(r.value=t,t&&(Object.defineProperty(s,`$el`,{enumerable:!0,configurable:!0,get:()=>t instanceof Element?t:t.$el}),!(t instanceof Element)&&!Object.prototype.hasOwnProperty.call(t,`$el`))){let n=t.$.exposed,r=Object.assign({},s);for(let e in n)Object.defineProperty(r,e,{enumerable:!0,configurable:!0,get:()=>n[e]});e.exposed=r}}return{forwardRef:c,currentRef:r,currentElement:i}}function Jr(e){let n=(0,t.getCurrentInstance)(),r=Object.keys(n?.type.props??{}).reduce((e,t)=>{let r=(n?.type.props[t]).default;return r!==void 0&&(e[t]=r),e},{}),i=(0,t.toRef)(e);return(0,t.computed)(()=>{let e={},a=n?.vnode.props??{};return Object.keys(a).forEach(n=>{e[(0,t.camelize)(n)]=a[n]}),Object.keys({...r,...e}).reduce((e,t)=>(i.value[t]!==void 0&&(e[t]=i.value[t]),e),{})})}function Yr(e,n){let r=Jr(e),i=n?Ur(n):{};return(0,t.computed)(()=>({...r.value,...i}))}function Xr(e,n){let r=jr(!1,300);Tr(()=>{r.value=!1});let i=(0,t.ref)(null),a=Er();function o(){i.value=null,r.value=!1}function s(e,t){let n=e.currentTarget,a={x:e.clientX,y:e.clientY},o=Qr(a,Zr(a,n.getBoundingClientRect()),1),s=$r(t.getBoundingClientRect());i.value=ti([...o,...s]),r.value=!0}return(0,t.watchEffect)(t=>{if(e.value&&n.value){let r=e=>s(e,n.value),i=t=>s(t,e.value);e.value.addEventListener(`pointerleave`,r),n.value.addEventListener(`pointerleave`,i),t(()=>{e.value?.removeEventListener(`pointerleave`,r),n.value?.removeEventListener(`pointerleave`,i)})}}),(0,t.watchEffect)(t=>{if(i.value){let r=t=>{if(!i.value||!(t.target instanceof Element))return;let r=t.target,s={x:t.clientX,y:t.clientY},c=e.value?.contains(r)||n.value?.contains(r),l=!ei(s,i.value),u=!!r.closest(`[data-grace-area-trigger]`);c?o():(l||u)&&(o(),a.trigger())};e.value?.ownerDocument.addEventListener(`pointermove`,r),t(()=>e.value?.ownerDocument.removeEventListener(`pointermove`,r))}}),{isPointerInTransit:r,onPointerExit:a.on}}function Zr(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function Qr(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function $r(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function ei(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e].x,s=t[e].y,c=t[a].x,l=t[a].y;s>r!=l>r&&n<(c-o)*(r-s)/(l-s)+o&&(i=!i)}return i}function ti(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:e.y>t.y?1:0),ni(t)}function ni(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var ri=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},ii=new WeakMap,ai=new WeakMap,oi={},si=0,ci=function(e){return e&&(e.host||ci(e.parentNode))},li=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=ci(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},ui=function(e,t,n,r){var i=li(t,Array.isArray(e)?e:[e]);oi[n]||(oi[n]=new WeakMap);var a=oi[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(ii.get(e)||0)+1,l=(a.get(e)||0)+1;ii.set(e,c),a.set(e,l),o.push(e),c===1&&i&&ai.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),si++,function(){o.forEach(function(e){var t=ii.get(e)-1,i=a.get(e)-1;ii.set(e,t),a.set(e,i),t||(ai.has(e)||e.removeAttribute(r),ai.delete(e)),i||e.removeAttribute(n)}),si--,si||(ii=new WeakMap,ii=new WeakMap,ai=new WeakMap,oi={})}},di=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||ri(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),ui(r,i,n,`aria-hidden`)):function(){return null}};function fi(e){let r;(0,t.watch)(()=>(0,n.unrefElement)(e),e=>{e?r=di(e):r&&r()}),(0,t.onUnmounted)(()=>{r&&r()})}var pi=0;function mi(e,n=`reka`){if(e)return e;let r;return r=`useId`in t?t.useId?.():Cr({useId:void 0}).useId?.()??`${++pi}`,n?`${n}-${r}`:r}function hi(e){let r=(0,t.ref)(),i=(0,t.computed)(()=>r.value?.width??0),a=(0,t.computed)(()=>r.value?.height??0);return(0,t.onMounted)(()=>{let t=(0,n.unrefElement)(e);if(t){r.value={width:t.offsetWidth,height:t.offsetHeight};let e=new ResizeObserver(e=>{if(!Array.isArray(e)||!e.length)return;let n=e[0],i,a;if(`borderBoxSize`in n){let e=n.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=t.offsetWidth,a=t.offsetHeight;r.value={width:i,height:a}});return e.observe(t,{box:`border-box`}),()=>e.unobserve(t)}else r.value=void 0}),{width:i,height:a}}function gi(e,n){let r=(0,t.ref)(e);function i(e){return n[r.value][e]??r.value}return{state:r,dispatch:e=>{r.value=i(e)}}}function _i(e){let t=jr(``,1e3);return{search:t,handleTypeaheadSearch:(n,r)=>{if(t.value+=n,e)e(n);else{let e=yr(),n=r.map(e=>({...e,textValue:e.value?.textValue??e.ref.textContent?.trim()??``})),i=n.find(t=>t.ref===e),a=yi(n.map(e=>e.textValue),t.value,i?.textValue),o=n.find(e=>e.textValue===a);return o&&o.ref.focus(),o?.ref}},resetTypeahead:()=>{t.value=``}}}function vi(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function yi(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=vi(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function bi(e,r){let i=(0,t.ref)({}),a=(0,t.ref)(`none`),o=(0,t.ref)(e),s=e.value?`mounted`:`unmounted`,c,l=r.value?.ownerDocument.defaultView??n.defaultWindow,{state:u,dispatch:d}=gi(s,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}}),f=e=>{if(Dr){let t=new CustomEvent(e,{bubbles:!1,cancelable:!1});r.value?.dispatchEvent(t)}};(0,t.watch)(e,async(e,n)=>{let o=n!==e;if(await(0,t.nextTick)(),o){let t=a.value,o=xi(r.value);e?(d(`MOUNT`),f(`enter`),o===`none`&&f(`after-enter`)):o===`none`||o===`undefined`||i.value?.display===`none`?(d(`UNMOUNT`),f(`leave`),f(`after-leave`)):n&&t!==o?(d(`ANIMATION_OUT`),f(`leave`)):(d(`UNMOUNT`),f(`after-leave`))}},{immediate:!0});let p=e=>{let t=xi(r.value),n=t.includes(CSS.escape(e.animationName)),i=u.value===`mounted`?`enter`:`leave`;if(e.target===r.value&&n&&(f(`after-${i}`),d(`ANIMATION_END`),!o.value)){let e=r.value.style.animationFillMode;r.value.style.animationFillMode=`forwards`,c=l?.setTimeout(()=>{r.value?.style.animationFillMode===`forwards`&&(r.value.style.animationFillMode=e)})}e.target===r.value&&t===`none`&&d(`ANIMATION_END`)},m=e=>{e.target===r.value&&(a.value=xi(r.value))},h=(0,t.watch)(r,(e,t)=>{e?(i.value=getComputedStyle(e),e.addEventListener(`animationstart`,m),e.addEventListener(`animationcancel`,p),e.addEventListener(`animationend`,p)):(d(`ANIMATION_END`),c!==void 0&&l?.clearTimeout(c),t?.removeEventListener(`animationstart`,m),t?.removeEventListener(`animationcancel`,p),t?.removeEventListener(`animationend`,p))},{immediate:!0}),g=(0,t.watch)(u,()=>{let e=xi(r.value);a.value=u.value===`mounted`?e:`none`});return(0,t.onUnmounted)(()=>{h(),g()}),{isPresent:(0,t.computed)(()=>[`mounted`,`unmountSuspended`].includes(u.value))}}function xi(e){return e&&getComputedStyle(e).animationName||`none`}var Si=(0,t.defineComponent)({name:`Presence`,props:{present:{type:Boolean,required:!0},forceMount:{type:Boolean}},slots:{},setup(e,{slots:r,expose:i}){let{present:a,forceMount:o}=(0,t.toRefs)(e),s=(0,t.ref)(),{isPresent:c}=bi(a,s);i({present:c});let l=r.default({present:c.value});l=Sr(l||[]);let u=(0,t.getCurrentInstance)();if(l&&l?.length>1){let e=u?.parent?.type.name?`<${u.parent.type.name} />`:`component`;throw Error([`Detected an invalid children for \`${e}\` for \`Presence\` component.`,``,"Note: Presence works similarly to `v-if` directly, but it waits for animation/transition to finished before unmounting. So it expect only one direct child of valid VNode type.",`You can apply a few solutions:`,["Provide a single child element so that `presence` directive attach correctly.",`Ensure the first child is an actual element instead of a raw text node or comment node.`].map(e=>` - ${e}`).join(`
58
58
  `)].join(`
59
59
  `))}return()=>o.value||a.value||c.value?(0,t.h)(r.default({present:c.value})[0],{ref:e=>{let t=(0,n.unrefElement)(e);return t?.hasAttribute===void 0||(t?.hasAttribute(`data-reka-popper-content-wrapper`)?s.value=t.firstElementChild:s.value=t),t}}):null}}),Ci=(0,t.defineComponent)({name:`PrimitiveSlot`,inheritAttrs:!1,setup(e,{attrs:n,slots:r}){return()=>{if(!r.default)return null;let e=Sr(r.default()),i=e.findIndex(e=>e.type!==t.Comment);if(i===-1)return e;let a=e[i];delete a.props?.ref;let o=a.props?(0,t.mergeProps)(n,a.props):n,s=(0,t.cloneVNode)({...a,props:{}},o);return e.length===1?s:(e[i]=s,e)}}}),wi=[`area`,`img`,`input`],X=(0,t.defineComponent)({name:`Primitive`,inheritAttrs:!1,props:{asChild:{type:Boolean,default:!1},as:{type:[String,Object],default:`div`}},setup(e,{attrs:n,slots:r}){let i=e.asChild?`template`:e.as;return typeof i==`string`&&wi.includes(i)?()=>(0,t.h)(i,n):i===`template`?()=>(0,t.h)(Ci,n,{default:r.default}):()=>(0,t.h)(e.as,n,{default:r.default})}});function Ti(){let e=(0,t.ref)();return{primitiveElement:e,currentElement:(0,t.computed)(()=>[`#text`,`#comment`].includes(e.value?.$el.nodeName)?e.value?.$el.nextElementSibling:(0,n.unrefElement)(e))}}var[Ei,Di]=vr(`DialogRoot`),Oi=(0,t.defineComponent)({inheritAttrs:!1,__name:`DialogRoot`,props:{open:{type:Boolean,required:!1,default:void 0},defaultOpen:{type:Boolean,required:!1,default:!1},modal:{type:Boolean,required:!1,default:!0}},emits:[`update:open`],setup(e,{emit:r}){let i=e,a=(0,n.useVModel)(i,`open`,r,{defaultValue:i.defaultOpen,passive:i.open===void 0}),o=(0,t.ref)(),s=(0,t.ref)(),{modal:c}=(0,t.toRefs)(i);return Di({open:a,modal:c,openModal:()=>{a.value=!0},onOpenChange:e=>{a.value=e},onOpenToggle:()=>{a.value=!a.value},contentId:``,titleId:``,descriptionId:``,triggerElement:o,contentElement:s}),(e,n)=>(0,t.renderSlot)(e.$slots,`default`,{open:(0,t.unref)(a),close:()=>a.value=!1})}}),ki=(0,t.defineComponent)({__name:`DialogClose`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`}},setup(e){let n=e;Y();let r=Ei();return(e,i)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(X),(0,t.mergeProps)(n,{type:e.as===`button`?`button`:void 0,onClick:i[0]||=e=>(0,t.unref)(r).onOpenChange(!1)}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16,[`type`]))}}),Ai=`dismissableLayer.pointerDownOutside`,ji=`dismissableLayer.focusOutside`;function Mi(e,t){let n=t.closest(`[data-dismissable-layer]`),r=e.dataset.dismissableLayer===``?e:e.querySelector(`[data-dismissable-layer]`),i=Array.from(e.ownerDocument.querySelectorAll(`[data-dismissable-layer]`));return!!(n&&(r===n||i.indexOf(r)<i.indexOf(n)))}function Ni(e,n,r=!0){let i=n?.value?.ownerDocument??globalThis?.document,a=(0,t.ref)(!1),o=(0,t.ref)(()=>{});return(0,t.watchEffect)(s=>{if(!Dr||!(0,t.toValue)(r))return;let c=async t=>{let r=t.target;if(!(!n?.value||!r)){if(Mi(n.value,r)){a.value=!1;return}if(t.target&&!a.value){let n={originalEvent:t};function r(){br(Ai,e,n)}t.pointerType===`touch`?(i.removeEventListener(`click`,o.value),o.value=r,i.addEventListener(`click`,o.value,{once:!0})):r()}else i.removeEventListener(`click`,o.value);a.value=!1}},l=window.setTimeout(()=>{i.addEventListener(`pointerdown`,c)},0);s(()=>{window.clearTimeout(l),i.removeEventListener(`pointerdown`,c),i.removeEventListener(`click`,o.value)})}),{onPointerDownCapture:()=>{(0,t.toValue)(r)&&(a.value=!0)}}}function Pi(e,n,r=!0){let i=n?.value?.ownerDocument??globalThis?.document,a=(0,t.ref)(!1);return(0,t.watchEffect)(o=>{if(!Dr||!(0,t.toValue)(r))return;let s=async r=>{if(!n?.value)return;await(0,t.nextTick)(),await(0,t.nextTick)();let i=r.target;!n.value||!i||Mi(n.value,i)||r.target&&!a.value&&br(ji,e,{originalEvent:r})};i.addEventListener(`focusin`,s),o(()=>i.removeEventListener(`focusin`,s))}),{onFocusCapture:()=>{(0,t.toValue)(r)&&(a.value=!0)},onBlurCapture:()=>{(0,t.toValue)(r)&&(a.value=!1)}}}var Fi=(0,t.reactive)({layersRoot:new Set,layersWithOutsidePointerEventsDisabled:new Set,originalBodyPointerEvents:void 0,branches:new Set}),Ii=(0,t.defineComponent)({__name:`DismissableLayer`,props:{disableOutsidePointerEvents:{type:Boolean,required:!1,default:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`escapeKeyDown`,`pointerDownOutside`,`focusOutside`,`interactOutside`,`dismiss`],setup(e,{emit:r}){let i=e,a=r,{forwardRef:o,currentElement:s}=Y(),c=(0,t.computed)(()=>s.value?.ownerDocument??globalThis.document),l=(0,t.computed)(()=>Fi.layersRoot),u=(0,t.computed)(()=>s.value?Array.from(l.value).indexOf(s.value):-1),d=(0,t.computed)(()=>Fi.layersWithOutsidePointerEventsDisabled.size>0),f=(0,t.computed)(()=>{let e=Array.from(l.value),[t]=[...Fi.layersWithOutsidePointerEventsDisabled].slice(-1),n=e.indexOf(t);return u.value>=n}),p=Ni(async e=>{let n=[...Fi.branches].some(t=>t?.contains(e.target));!f.value||n||(a(`pointerDownOutside`,e),a(`interactOutside`,e),await(0,t.nextTick)(),e.defaultPrevented||a(`dismiss`))},s),m=Pi(e=>{[...Fi.branches].some(t=>t?.contains(e.target))||(a(`focusOutside`,e),a(`interactOutside`,e),e.defaultPrevented||a(`dismiss`))},s);return(0,n.onKeyStroke)(`Escape`,e=>{u.value===l.value.size-1&&(a(`escapeKeyDown`,e),e.defaultPrevented||a(`dismiss`))}),(0,t.watchEffect)(e=>{s.value&&(i.disableOutsidePointerEvents&&(Fi.layersWithOutsidePointerEventsDisabled.size===0&&(Fi.originalBodyPointerEvents=c.value.body.style.pointerEvents,c.value.body.style.pointerEvents=`none`),Fi.layersWithOutsidePointerEventsDisabled.add(s.value)),l.value.add(s.value),e(()=>{i.disableOutsidePointerEvents&&Fi.layersWithOutsidePointerEventsDisabled.size===1&&!xr(Fi.originalBodyPointerEvents)&&(c.value.body.style.pointerEvents=Fi.originalBodyPointerEvents)}))}),(0,t.watchEffect)(e=>{e(()=>{s.value&&(l.value.delete(s.value),Fi.layersWithOutsidePointerEventsDisabled.delete(s.value))})}),(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(X),{ref:(0,t.unref)(o),"as-child":e.asChild,as:e.as,"data-dismissable-layer":``,style:(0,t.normalizeStyle)({pointerEvents:d.value?f.value?`auto`:`none`:void 0}),onFocusCapture:(0,t.unref)(m).onFocusCapture,onBlurCapture:(0,t.unref)(m).onBlurCapture,onPointerdownCapture:(0,t.unref)(p).onPointerDownCapture},{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},8,[`as-child`,`as`,`style`,`onFocusCapture`,`onBlurCapture`,`onPointerdownCapture`]))}}),Li=(0,n.createGlobalState)(()=>(0,t.ref)([]));function Ri(){let e=Li();return{add(t){let n=e.value[0];t!==n&&n?.pause(),e.value=zi(e.value,t),e.value.unshift(t)},remove(t){e.value=zi(e.value,t),e.value[0]?.resume()}}}function zi(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}var Bi=`focusScope.autoFocusOnMount`,Vi=`focusScope.autoFocusOnUnmount`,Hi={bubbles:!1,cancelable:!0};function Ui(e,{select:t=!1}={}){let n=yr();for(let r of e)if(Yi(r,{select:t}),yr()!==n)return!0}function Wi(e){let t=Gi(e);return[Ki(t,e),Ki(t.reverse(),e)]}function Gi(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Ki(e,t){for(let n of e)if(!qi(n,{upTo:t}))return n}function qi(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function Ji(e){return e instanceof HTMLInputElement&&`select`in e}function Yi(e,{select:t=!1}={}){if(e&&e.focus){let n=yr();e.focus({preventScroll:!0}),e!==n&&Ji(e)&&t&&e.select()}}var Xi=(0,t.defineComponent)({__name:`FocusScope`,props:{loop:{type:Boolean,required:!1,default:!1},trapped:{type:Boolean,required:!1,default:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`mountAutoFocus`,`unmountAutoFocus`],setup(e,{emit:n}){let r=e,i=n,{currentRef:a,currentElement:o}=Y(),s=(0,t.ref)(null),c=Ri(),l=(0,t.reactive)({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}});(0,t.watchEffect)(e=>{if(!Dr)return;let t=o.value;if(!r.trapped)return;function n(e){if(l.paused||!t)return;let n=e.target;t.contains(n)?s.value=n:Yi(s.value,{select:!0})}function i(e){if(l.paused||!t)return;let n=e.relatedTarget;n!==null&&(t.contains(n)||Yi(s.value,{select:!0}))}function a(e){t.contains(s.value)||Yi(t)}document.addEventListener(`focusin`,n),document.addEventListener(`focusout`,i);let c=new MutationObserver(a);t&&c.observe(t,{childList:!0,subtree:!0}),e(()=>{document.removeEventListener(`focusin`,n),document.removeEventListener(`focusout`,i),c.disconnect()})}),(0,t.watchEffect)(async e=>{let n=o.value;if(await(0,t.nextTick)(),!n)return;c.add(l);let r=yr();if(!n.contains(r)){let e=new CustomEvent(Bi,Hi);n.addEventListener(Bi,e=>i(`mountAutoFocus`,e)),n.dispatchEvent(e),e.defaultPrevented||(Ui(Gi(n),{select:!0}),yr()===r&&Yi(n))}e(()=>{n.removeEventListener(Bi,e=>i(`mountAutoFocus`,e));let e=new CustomEvent(Vi,Hi),t=e=>{i(`unmountAutoFocus`,e)};n.addEventListener(Vi,t),n.dispatchEvent(e),setTimeout(()=>{e.defaultPrevented||Yi(r??document.body,{select:!0}),n.removeEventListener(Vi,t),c.remove(l)},0)})});function u(e){if(!r.loop&&!r.trapped||l.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,n=yr();if(t&&n){let t=e.currentTarget,[i,a]=Wi(t);i&&a?!e.shiftKey&&n===a?(e.preventDefault(),r.loop&&Yi(i,{select:!0})):e.shiftKey&&n===i&&(e.preventDefault(),r.loop&&Yi(a,{select:!0})):n===t&&e.preventDefault()}}return(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(X),{ref_key:`currentRef`,ref:a,tabindex:`-1`,"as-child":e.asChild,as:e.as,onKeydown:u},{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},8,[`as-child`,`as`]))}}),Zi=[`Enter`,` `],Qi=[`ArrowDown`,`PageUp`,`Home`],$i=[`ArrowUp`,`PageDown`,`End`];[...Qi,...$i],[...Zi],[...Zi];function ea(e){return e?`open`:`closed`}function ta(e){let t=yr();for(let n of e)if(n===t||(n.focus(),yr()!==t))return}var na=`DialogTitle`,ra=`DialogContent`;function ia({titleName:e=na,contentName:n=ra,componentLink:r=`dialog.html#title`,titleId:i,descriptionId:a,contentElement:o}){let s=`Warning: \`${n}\` requires a \`${e}\` for the component to be accessible for screen reader users.
60
60
 
61
61
  If you want to hide the \`${e}\`, you can wrap it with our VisuallyHidden component.
62
62
 
63
- For more information, see https://www.reka-ui.com/docs/components/${r}`,c=`Warning: Missing \`Description\` or \`aria-describedby="undefined"\` for ${n}.`;(0,t.onMounted)(()=>{document.getElementById(i)||console.warn(s);let e=o.value?.getAttribute(`aria-describedby`);a&&e&&(document.getElementById(a)||console.warn(c))})}var aa=(0,t.defineComponent)({__name:`DialogContentImpl`,props:{forceMount:{type:Boolean,required:!1},trapFocus:{type:Boolean,required:!1},disableOutsidePointerEvents:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`escapeKeyDown`,`pointerDownOutside`,`focusOutside`,`interactOutside`,`openAutoFocus`,`closeAutoFocus`],setup(e,{emit:n}){let r=e,i=n,a=Ei(),{forwardRef:o,currentElement:s}=Y();return a.titleId||=mi(void 0,`reka-dialog-title`),a.descriptionId||=mi(void 0,`reka-dialog-description`),(0,t.onMounted)(()=>{a.contentElement=s,yr()!==document.body&&(a.triggerElement.value=yr())}),process.env.NODE_ENV!==`production`&&ia({titleName:`DialogTitle`,contentName:`DialogContent`,componentLink:`dialog.html#title`,titleId:a.titleId,descriptionId:a.descriptionId,contentElement:s}),(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Xi),{"as-child":``,loop:``,trapped:r.trapFocus,onMountAutoFocus:n[5]||=e=>i(`openAutoFocus`,e),onUnmountAutoFocus:n[6]||=e=>i(`closeAutoFocus`,e)},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(Ii),(0,t.mergeProps)({id:(0,t.unref)(a).contentId,ref:(0,t.unref)(o),as:e.as,"as-child":e.asChild,"disable-outside-pointer-events":e.disableOutsidePointerEvents,role:`dialog`,"aria-describedby":(0,t.unref)(a).descriptionId,"aria-labelledby":(0,t.unref)(a).titleId,"data-state":(0,t.unref)(ea)((0,t.unref)(a).open.value)},e.$attrs,{onDismiss:n[0]||=e=>(0,t.unref)(a).onOpenChange(!1),onEscapeKeyDown:n[1]||=e=>i(`escapeKeyDown`,e),onFocusOutside:n[2]||=e=>i(`focusOutside`,e),onInteractOutside:n[3]||=e=>i(`interactOutside`,e),onPointerDownOutside:n[4]||=e=>i(`pointerDownOutside`,e)}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16,[`id`,`as`,`as-child`,`disable-outside-pointer-events`,`aria-describedby`,`aria-labelledby`,`data-state`])]),_:3},8,[`trapped`]))}}),oa=(0,t.defineComponent)({__name:`DialogContentModal`,props:{forceMount:{type:Boolean,required:!1},trapFocus:{type:Boolean,required:!1},disableOutsidePointerEvents:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`escapeKeyDown`,`pointerDownOutside`,`focusOutside`,`interactOutside`,`openAutoFocus`,`closeAutoFocus`],setup(e,{emit:n}){let r=e,i=n,a=Ei(),o=Ur(i),{forwardRef:s,currentElement:c}=Y();return fi(c),(e,n)=>((0,t.openBlock)(),(0,t.createBlock)(aa,(0,t.mergeProps)({...r,...(0,t.unref)(o)},{ref:(0,t.unref)(s),"trap-focus":(0,t.unref)(a).open.value,"disable-outside-pointer-events":!0,onCloseAutoFocus:n[0]||=e=>{e.defaultPrevented||(e.preventDefault(),(0,t.unref)(a).triggerElement.value?.focus())},onPointerDownOutside:n[1]||=e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()},onFocusOutside:n[2]||=e=>{e.preventDefault()}}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16,[`trap-focus`]))}}),sa=(0,t.defineComponent)({__name:`DialogContentNonModal`,props:{forceMount:{type:Boolean,required:!1},trapFocus:{type:Boolean,required:!1},disableOutsidePointerEvents:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`escapeKeyDown`,`pointerDownOutside`,`focusOutside`,`interactOutside`,`openAutoFocus`,`closeAutoFocus`],setup(e,{emit:n}){let r=e,i=Ur(n);Y();let a=Ei(),o=(0,t.ref)(!1),s=(0,t.ref)(!1);return(e,n)=>((0,t.openBlock)(),(0,t.createBlock)(aa,(0,t.mergeProps)({...r,...(0,t.unref)(i)},{"trap-focus":!1,"disable-outside-pointer-events":!1,onCloseAutoFocus:n[0]||=e=>{e.defaultPrevented||(o.value||(0,t.unref)(a).triggerElement.value?.focus(),e.preventDefault()),o.value=!1,s.value=!1},onInteractOutside:n[1]||=e=>{e.defaultPrevented||(o.value=!0,e.detail.originalEvent.type===`pointerdown`&&(s.value=!0));let n=e.target;(0,t.unref)(a).triggerElement.value?.contains(n)&&e.preventDefault(),e.detail.originalEvent.type===`focusin`&&s.value&&e.preventDefault()}}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16))}}),ca=(0,t.defineComponent)({__name:`DialogContent`,props:{forceMount:{type:Boolean,required:!1},disableOutsidePointerEvents:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`escapeKeyDown`,`pointerDownOutside`,`focusOutside`,`interactOutside`,`openAutoFocus`,`closeAutoFocus`],setup(e,{emit:n}){let r=e,i=n,a=Ei(),o=Ur(i),{forwardRef:s}=Y();return(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Si),{present:e.forceMount||(0,t.unref)(a).open.value},{default:(0,t.withCtx)(()=>[(0,t.unref)(a).modal.value?((0,t.openBlock)(),(0,t.createBlock)(oa,(0,t.mergeProps)({key:0,ref:(0,t.unref)(s)},{...r,...(0,t.unref)(o),...e.$attrs}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16)):((0,t.openBlock)(),(0,t.createBlock)(sa,(0,t.mergeProps)({key:1,ref:(0,t.unref)(s)},{...r,...(0,t.unref)(o),...e.$attrs}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16))]),_:3},8,[`present`]))}}),la=(0,t.defineComponent)({__name:`DialogOverlayImpl`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let n=Ei();return zr(!0),Y(),(e,r)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(X),{as:e.as,"as-child":e.asChild,"data-state":(0,t.unref)(n).open.value?`open`:`closed`,style:{"pointer-events":`auto`}},{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},8,[`as`,`as-child`,`data-state`]))}}),ua=(0,t.defineComponent)({__name:`DialogOverlay`,props:{forceMount:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let n=Ei(),{forwardRef:r}=Y();return(e,i)=>(0,t.unref)(n)?.modal.value?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Si),{key:0,present:e.forceMount||(0,t.unref)(n).open.value},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(la,(0,t.mergeProps)(e.$attrs,{ref:(0,t.unref)(r),as:e.as,"as-child":e.asChild}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16,[`as`,`as-child`])]),_:3},8,[`present`])):(0,t.createCommentVNode)(`v-if`,!0)}}),da=(0,t.defineComponent)({__name:`Teleport`,props:{to:{type:null,required:!1,default:`body`},disabled:{type:Boolean,required:!1},defer:{type:Boolean,required:!1},forceMount:{type:Boolean,required:!1}},setup(e){let r=(0,n.useMounted)();return(e,n)=>(0,t.unref)(r)||e.forceMount?((0,t.openBlock)(),(0,t.createBlock)(t.Teleport,{key:0,to:e.to,disabled:e.disabled,defer:e.defer},[(0,t.renderSlot)(e.$slots,`default`)],8,[`to`,`disabled`,`defer`])):(0,t.createCommentVNode)(`v-if`,!0)}}),fa=(0,t.defineComponent)({__name:`DialogPortal`,props:{to:{type:null,required:!1},disabled:{type:Boolean,required:!1},defer:{type:Boolean,required:!1},forceMount:{type:Boolean,required:!1}},setup(e){let n=e;return(e,r)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(da),(0,t.normalizeProps)((0,t.guardReactiveProps)(n)),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16))}}),pa=(0,t.defineComponent)({__name:`DialogTitle`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`h2`}},setup(e){let n=e,r=Ei();return Y(),(e,i)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(X),(0,t.mergeProps)(n,{id:(0,t.unref)(r).titleId}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16,[`id`]))}}),ma=`data-reka-collection-item`;function ha(e={}){let{key:n=``,isProvider:r=!1}=e,i=`${n}CollectionProvider`,a;if(r){let e=(0,t.ref)(new Map);a={collectionRef:(0,t.ref)(),itemMap:e},(0,t.provide)(i,a)}else a=(0,t.inject)(i);let o=(e=!1)=>{let t=a.collectionRef.value;if(!t)return[];let n=Array.from(t.querySelectorAll(`[${ma}]`)),r=Array.from(a.itemMap.value.values()).sort((e,t)=>n.indexOf(e.ref)-n.indexOf(t.ref));return e?r:r.filter(e=>e.ref.dataset.disabled!==``)},s=(0,t.defineComponent)({name:`CollectionSlot`,inheritAttrs:!1,setup(e,{slots:n,attrs:r}){let{primitiveElement:i,currentElement:o}=Ti();return(0,t.watch)(o,()=>{a.collectionRef.value=o.value}),()=>(0,t.h)(Ci,{ref:i,...r},n)}}),c=(0,t.defineComponent)({name:`CollectionItem`,inheritAttrs:!1,props:{value:{validator:()=>!0}},setup(e,{slots:n,attrs:r}){let{primitiveElement:i,currentElement:o}=Ti();return(0,t.watchEffect)(n=>{if(o.value){let r=(0,t.markRaw)(o.value);a.itemMap.value.set(r,{ref:o.value,value:e.value}),n(()=>a.itemMap.value.delete(r))}}),()=>(0,t.h)(Ci,{...r,[ma]:``,ref:i},n)}});return{getItems:o,reactiveItems:(0,t.computed)(()=>Array.from(a.itemMap.value.values())),itemMapSize:(0,t.computed)(()=>a.itemMap.value.size),CollectionSlot:s,CollectionItem:c}}var ga=(0,t.defineComponent)({__name:`VisuallyHidden`,props:{feature:{type:String,required:!1,default:`focusable`},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`span`}},setup(e){return(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(X),{as:e.as,"as-child":e.asChild,"aria-hidden":e.feature===`focusable`?`true`:void 0,"data-hidden":e.feature===`fully-hidden`?``:void 0,tabindex:e.feature===`fully-hidden`?`-1`:void 0,style:{position:`absolute`,border:0,width:`1px`,height:`1px`,padding:0,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,clipPath:`inset(50%)`,whiteSpace:`nowrap`,wordWrap:`normal`,top:`-1px`,left:`-1px`}},{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},8,[`as`,`as-child`,`aria-hidden`,`data-hidden`,`tabindex`]))}}),_a=(0,t.defineComponent)({inheritAttrs:!1,__name:`VisuallyHiddenInputBubble`,props:{name:{type:String,required:!0},value:{type:null,required:!0},checked:{type:Boolean,required:!1,default:void 0},required:{type:Boolean,required:!1},disabled:{type:Boolean,required:!1},feature:{type:String,required:!1,default:`fully-hidden`}},setup(e){let n=e,{primitiveElement:r,currentElement:i}=Ti();return(0,t.watch)((0,t.computed)(()=>n.checked??n.value),(e,t)=>{if(!i.value)return;let n=i.value,r=window.HTMLInputElement.prototype,a=Object.getOwnPropertyDescriptor(r,`value`).set;if(a&&e!==t){let t=new Event(`input`,{bubbles:!0}),r=new Event(`change`,{bubbles:!0});a.call(n,e),n.dispatchEvent(t),n.dispatchEvent(r)}}),(e,i)=>((0,t.openBlock)(),(0,t.createBlock)(ga,(0,t.mergeProps)({ref_key:`primitiveElement`,ref:r},{...n,...e.$attrs},{as:`input`}),null,16))}}),va=(0,t.defineComponent)({inheritAttrs:!1,__name:`VisuallyHiddenInput`,props:{name:{type:String,required:!0},value:{type:null,required:!0},checked:{type:Boolean,required:!1,default:void 0},required:{type:Boolean,required:!1},disabled:{type:Boolean,required:!1},feature:{type:String,required:!1,default:`fully-hidden`}},setup(e){let n=e,r=(0,t.computed)(()=>typeof n.value==`object`&&Array.isArray(n.value)&&n.value.length===0&&n.required),i=(0,t.computed)(()=>typeof n.value==`string`||typeof n.value==`number`||typeof n.value==`boolean`||n.value===null||n.value===void 0?[{name:n.name,value:n.value}]:typeof n.value==`object`&&Array.isArray(n.value)?n.value.flatMap((e,t)=>typeof e==`object`?Object.entries(e).map(([e,r])=>({name:`${n.name}[${t}][${e}]`,value:r})):{name:`${n.name}[${t}]`,value:e}):n.value!==null&&typeof n.value==`object`&&!Array.isArray(n.value)?Object.entries(n.value).map(([e,t])=>({name:`${n.name}[${e}]`,value:t})):[]);return(e,a)=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,null,[(0,t.createCommentVNode)(` We render single input if it's required `),r.value?((0,t.openBlock)(),(0,t.createBlock)(_a,(0,t.mergeProps)({key:e.name},{...n,...e.$attrs},{name:e.name,value:e.value}),null,16,[`name`,`value`])):((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,{key:1},(0,t.renderList)(i.value,r=>((0,t.openBlock)(),(0,t.createBlock)(_a,(0,t.mergeProps)({key:r.name},{ref_for:!0},{...n,...e.$attrs},{name:r.name,value:r.value}),null,16,[`name`,`value`]))),128))],2112))}}),[ya,ba]=vr(`PopperRoot`),xa=(0,t.defineComponent)({inheritAttrs:!1,__name:`PopperRoot`,setup(e){let n=(0,t.ref)();return ba({anchor:n,onAnchorChange:e=>n.value=e}),(e,n)=>(0,t.renderSlot)(e.$slots,`default`)}}),Sa=(0,t.defineComponent)({__name:`PopperAnchor`,props:{reference:{type:null,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let n=e,{forwardRef:r,currentElement:i}=Y(),a=ya();return(0,t.watchPostEffect)(()=>{a.onAnchorChange(n.reference??i.value)}),(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(X),{ref:(0,t.unref)(r),as:e.as,"as-child":e.asChild},{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},8,[`as`,`as-child`]))}}),Ca={key:0,d:`M0 0L6 6L12 0`},wa={key:1,d:`M0 0L4.58579 4.58579C5.36683 5.36683 6.63316 5.36684 7.41421 4.58579L12 0`},Ta=(0,t.defineComponent)({__name:`Arrow`,props:{width:{type:Number,required:!1,default:10},height:{type:Number,required:!1,default:5},rounded:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`svg`}},setup(e){let n=e;return Y(),(e,r)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(X),(0,t.mergeProps)(n,{width:e.width,height:e.height,viewBox:e.asChild?void 0:`0 0 12 6`,preserveAspectRatio:e.asChild?void 0:`none`}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`,{},()=>[e.rounded?((0,t.openBlock)(),(0,t.createElementBlock)(`path`,wa)):((0,t.openBlock)(),(0,t.createElementBlock)(`path`,Ca))])]),_:3},16,[`width`,`height`,`viewBox`,`preserveAspectRatio`]))}});function Ea(e){return e!==null}function Da(e){return{name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=Oa(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}}}function Oa(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var ka=[`top`,`right`,`bottom`,`left`],Aa=Math.min,ja=Math.max,Ma=Math.round,Na=Math.floor,Pa=e=>({x:e,y:e}),Fa={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Ia(e,t,n){return ja(e,Aa(t,n))}function La(e,t){return typeof e==`function`?e(t):e}function Ra(e){return e.split(`-`)[0]}function za(e){return e.split(`-`)[1]}function Ba(e){return e===`x`?`y`:`x`}function Va(e){return e===`y`?`height`:`width`}function Ha(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Ua(e){return Ba(Ha(e))}function Wa(e,t,n){n===void 0&&(n=!1);let r=za(e),i=Ua(e),a=Va(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=$a(o)),[o,$a(o)]}function Ga(e){let t=$a(e);return[Ka(e),t,Ka(t)]}function Ka(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var qa=[`left`,`right`],Ja=[`right`,`left`],Ya=[`top`,`bottom`],Xa=[`bottom`,`top`];function Za(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Ja:qa:t?qa:Ja;case`left`:case`right`:return t?Ya:Xa;default:return[]}}function Qa(e,t,n,r){let i=za(e),a=Za(Ra(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Ka)))),a}function $a(e){let t=Ra(e);return Fa[t]+e.slice(t.length)}function eo(e){return{top:0,right:0,bottom:0,left:0,...e}}function to(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:eo(e)}function no(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function ro(e,t,n){let{reference:r,floating:i}=e,a=Ha(t),o=Ua(t),s=Va(o),c=Ra(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(za(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function io(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=La(t,e),p=to(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=no(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=no(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var ao=50,oo=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:io},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=ro(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<ao&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=ro(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},so=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=La(e,t)||{};if(l==null)return{};let d=to(u),f={x:n,y:r},p=Ua(i),m=Va(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=Aa(d[_],T),ee=Aa(d[v],T),D=E,te=C-h[m]-ee,O=C/2-h[m]/2+w,ne=Ia(D,O,te),k=!c.arrow&&za(i)!=null&&O!==ne&&a.reference[m]/2-(O<D?E:ee)-h[m]/2<0,re=k?O<D?O-D:O-te:0;return{[p]:f[p]+re,data:{[p]:ne,centerOffset:O-ne-re,...k&&{alignmentOffset:re}},reset:k}}}),co=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=La(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=Ra(r),_=Ha(o),v=Ra(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[$a(o)]:Ga(o)),x=p!==`none`;!d&&x&&b.push(...Qa(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=Wa(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==Ha(t))||T.every(e=>Ha(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=Ha(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function lo(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function uo(e){return ka.some(t=>e[t]>=0)}var fo=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=La(e,t);switch(i){case`referenceHidden`:{let e=lo(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:uo(e)}}}case`escaped`:{let e=lo(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:uo(e)}}}default:return{}}}}},po=new Set([`left`,`top`]);async function mo(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Ra(n),s=za(n),c=Ha(n)===`y`,l=po.has(o)?-1:1,u=a&&c?-1:1,d=La(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var ho=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await mo(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},go=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=La(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Ha(Ra(i)),p=Ba(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=Ia(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=Ia(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},_o=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=La(e,t),u={x:n,y:r},d=Ha(i),f=Ba(d),p=u[f],m=u[d],h=La(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=po.has(Ra(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},vo=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=La(e,t),u=await o.detectOverflow(t,l),d=Ra(i),f=za(i),p=Ha(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=Aa(h-u[g],v),x=Aa(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=ja(u.left,0),t=ja(u.right,0),n=ja(u.top,0),r=ja(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:ja(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:ja(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function yo(){return typeof window<`u`}function bo(e){return Co(e)?(e.nodeName||``).toLowerCase():`#document`}function xo(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function So(e){return((Co(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Co(e){return yo()?e instanceof Node||e instanceof xo(e).Node:!1}function wo(e){return yo()?e instanceof Element||e instanceof xo(e).Element:!1}function To(e){return yo()?e instanceof HTMLElement||e instanceof xo(e).HTMLElement:!1}function Eo(e){return!yo()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof xo(e).ShadowRoot}function Do(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Ro(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Oo(e){return/^(table|td|th)$/.test(bo(e))}function ko(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Ao=/transform|translate|scale|rotate|perspective|filter/,jo=/paint|layout|strict|content/,Mo=e=>!!e&&e!==`none`,No;function Po(e){let t=wo(e)?Ro(e):e;return Mo(t.transform)||Mo(t.translate)||Mo(t.scale)||Mo(t.rotate)||Mo(t.perspective)||!Io()&&(Mo(t.backdropFilter)||Mo(t.filter))||Ao.test(t.willChange||``)||jo.test(t.contain||``)}function Fo(e){let t=Bo(e);for(;To(t)&&!Lo(t);){if(Po(t))return t;if(ko(t))return null;t=Bo(t)}return null}function Io(){return No??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),No}function Lo(e){return/^(html|body|#document)$/.test(bo(e))}function Ro(e){return xo(e).getComputedStyle(e)}function zo(e){return wo(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Bo(e){if(bo(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Eo(e)&&e.host||So(e);return Eo(t)?t.host:t}function Vo(e){let t=Bo(e);return Lo(t)?e.ownerDocument?e.ownerDocument.body:e.body:To(t)&&Do(t)?t:Vo(t)}function Ho(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Vo(e),i=r===e.ownerDocument?.body,a=xo(r);if(i){let e=Uo(a);return t.concat(a,a.visualViewport||[],Do(r)?r:[],e&&n?Ho(e):[])}else return t.concat(r,Ho(r,[],n))}function Uo(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Wo(e){let t=Ro(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=To(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Ma(n)!==a||Ma(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Go(e){return wo(e)?e:e.contextElement}function Ko(e){let t=Go(e);if(!To(t))return Pa(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Wo(t),o=(a?Ma(n.width):n.width)/r,s=(a?Ma(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var qo=Pa(0);function Jo(e){let t=xo(e);return!Io()||!t.visualViewport?qo:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Yo(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==xo(e)?!1:t}function Xo(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Go(e),o=Pa(1);t&&(r?wo(r)&&(o=Ko(r)):o=Ko(e));let s=Yo(a,n,r)?Jo(a):Pa(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=xo(a),t=r&&wo(r)?xo(r):r,n=e,i=Uo(n);for(;i&&r&&t!==n;){let e=Ko(i),t=i.getBoundingClientRect(),r=Ro(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=xo(i),i=Uo(n)}}return no({width:u,height:d,x:c,y:l})}function Zo(e,t){let n=zo(e).scrollLeft;return t?t.left+n:Xo(So(e)).left+n}function Qo(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Zo(e,n),y:n.top+t.scrollTop}}function $o(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=So(r),s=t?ko(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Pa(1),u=Pa(0),d=To(r);if((d||!d&&!a)&&((bo(r)!==`body`||Do(o))&&(c=zo(r)),d)){let e=Xo(r);l=Ko(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Qo(o,c):Pa(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function es(e){return Array.from(e.getClientRects())}function ts(e){let t=So(e),n=zo(e),r=e.ownerDocument.body,i=ja(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=ja(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+Zo(e),s=-n.scrollTop;return Ro(r).direction===`rtl`&&(o+=ja(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var ns=25;function rs(e,t){let n=xo(e),r=So(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=Io();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=Zo(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=ns&&(a-=o)}else l<=ns&&(a+=l);return{width:a,height:o,x:s,y:c}}function is(e,t){let n=Xo(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=To(e)?Ko(e):Pa(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function as(e,t,n){let r;if(t===`viewport`)r=rs(e,n);else if(t===`document`)r=ts(So(e));else if(wo(t))r=is(t,n);else{let n=Jo(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return no(r)}function os(e,t){let n=Bo(e);return n===t||!wo(n)||Lo(n)?!1:Ro(n).position===`fixed`||os(n,t)}function ss(e,t){let n=t.get(e);if(n)return n;let r=Ho(e,[],!1).filter(e=>wo(e)&&bo(e)!==`body`),i=null,a=Ro(e).position===`fixed`,o=a?Bo(e):e;for(;wo(o)&&!Lo(o);){let t=Ro(o),n=Po(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||Do(o)&&!n&&os(e,o))?r=r.filter(e=>e!==o):i=t,o=Bo(o)}return t.set(e,r),r}function cs(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?ko(t)?[]:ss(t,this._c):[].concat(n),r],o=as(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=as(t,a[e],i);s=ja(n.top,s),c=Aa(n.right,c),l=Aa(n.bottom,l),u=ja(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function ls(e){let{width:t,height:n}=Wo(e);return{width:t,height:n}}function us(e,t,n){let r=To(t),i=So(t),a=n===`fixed`,o=Xo(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=Pa(0);function l(){c.x=Zo(i)}if(r||!r&&!a)if((bo(t)!==`body`||Do(i))&&(s=zo(t)),r){let e=Xo(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?Qo(i,s):Pa(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function ds(e){return Ro(e).position===`static`}function fs(e,t){if(!To(e)||Ro(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return So(e)===n&&(n=n.ownerDocument.body),n}function ps(e,t){let n=xo(e);if(ko(e))return n;if(!To(e)){let t=Bo(e);for(;t&&!Lo(t);){if(wo(t)&&!ds(t))return t;t=Bo(t)}return n}let r=fs(e,t);for(;r&&Oo(r)&&ds(r);)r=fs(r,t);return r&&Lo(r)&&ds(r)&&!Po(r)?n:r||Fo(e)||n}var ms=async function(e){let t=this.getOffsetParent||ps,n=this.getDimensions,r=await n(e.floating);return{reference:us(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function hs(e){return Ro(e).direction===`rtl`}var gs={convertOffsetParentRelativeRectToViewportRelativeRect:$o,getDocumentElement:So,getClippingRect:cs,getOffsetParent:ps,getElementRects:ms,getClientRects:es,getDimensions:ls,getScale:Ko,isElement:wo,isRTL:hs};function _s(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function vs(e,t){let n=null,r,i=So(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=Na(d),h=Na(i.clientWidth-(u+f)),g=Na(i.clientHeight-(d+p)),_=Na(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:ja(0,Aa(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!_s(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function ys(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Go(e),u=i||a?[...l?Ho(l):[],...t?Ho(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?vs(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?Xo(e):null;c&&g();function g(){let t=Xo(e);h&&!_s(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var bs=ho,xs=go,Ss=co,Cs=vo,ws=fo,Ts=so,Es=_o,Ds=(e,t,n)=>{let r=new Map,i={platform:gs,...n},a={...i.platform,_c:r};return oo(e,t,{...i,platform:a})},Z=l({Vue:()=>t,Vue2:()=>void 0,del:()=>As,install:()=>Os,isVue2:()=>!1,isVue3:()=>!0,set:()=>ks},1);d(Z,require(`vue`),void 0,1);function Os(){}function ks(e,t,n){return Array.isArray(e)?(e.length=Math.max(e.length,t),e.splice(t,1,n),n):(e[t]=n,n)}function As(e,t){if(Array.isArray(e)){e.splice(t,1);return}delete e[t]}function js(e){return typeof e==`object`&&!!e&&`$el`in e}function Ms(e){if(js(e)){let t=e.$el;return Co(t)&&bo(t)===`#comment`?null:t}return e}function Ns(e){return typeof e==`function`?e():(0,Z.unref)(e)}function Ps(e){return{name:`arrow`,options:e,fn(t){let n=Ms(Ns(e.element));return n==null?{}:Ts({element:n,padding:e.padding}).fn(t)}}}function Fs(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Is(e,t){let n=Fs(e);return Math.round(t*n)/n}function Ls(e,t,n){n===void 0&&(n={});let r=n.whileElementsMounted,i=(0,Z.computed)(()=>Ns(n.open)??!0),a=(0,Z.computed)(()=>Ns(n.middleware)),o=(0,Z.computed)(()=>Ns(n.placement)??`bottom`),s=(0,Z.computed)(()=>Ns(n.strategy)??`absolute`),c=(0,Z.computed)(()=>Ns(n.transform)??!0),l=(0,Z.computed)(()=>Ms(e.value)),u=(0,Z.computed)(()=>Ms(t.value)),d=(0,Z.ref)(0),f=(0,Z.ref)(0),p=(0,Z.ref)(s.value),m=(0,Z.ref)(o.value),h=(0,Z.shallowRef)({}),g=(0,Z.ref)(!1),_=(0,Z.computed)(()=>{let e={position:p.value,left:`0`,top:`0`};if(!u.value)return e;let t=Is(u.value,d.value),n=Is(u.value,f.value);return c.value?{...e,transform:`translate(`+t+`px, `+n+`px)`,...Fs(u.value)>=1.5&&{willChange:`transform`}}:{position:p.value,left:t+`px`,top:n+`px`}}),v;function y(){if(l.value==null||u.value==null)return;let e=i.value;Ds(l.value,u.value,{middleware:a.value,placement:o.value,strategy:s.value}).then(t=>{d.value=t.x,f.value=t.y,p.value=t.strategy,m.value=t.placement,h.value=t.middlewareData,g.value=e!==!1})}function b(){typeof v==`function`&&(v(),v=void 0)}function x(){if(b(),r===void 0){y();return}if(l.value!=null&&u.value!=null){v=r(l.value,u.value,y);return}}function S(){i.value||(g.value=!1)}return(0,Z.watch)([a,o,s,i],y,{flush:`sync`}),(0,Z.watch)([l,u],x,{flush:`sync`}),(0,Z.watch)(i,S,{flush:`sync`}),(0,Z.getCurrentScope)()&&(0,Z.onScopeDispose)(b),{x:(0,Z.shallowReadonly)(d),y:(0,Z.shallowReadonly)(f),strategy:(0,Z.shallowReadonly)(p),placement:(0,Z.shallowReadonly)(m),middlewareData:(0,Z.shallowReadonly)(h),isPositioned:(0,Z.shallowReadonly)(g),floatingStyles:_,update:y}}var Rs={side:`bottom`,sideOffset:0,sideFlip:!0,align:`center`,alignOffset:0,alignFlip:!0,arrowPadding:0,hideShiftedArrow:!0,avoidCollisions:!0,collisionBoundary:()=>[],collisionPadding:0,sticky:`partial`,hideWhenDetached:!1,positionStrategy:`fixed`,updatePositionStrategy:`optimized`,prioritizePosition:!1},[zs,Bs]=vr(`PopperContent`),Vs=(0,t.defineComponent)({inheritAttrs:!1,__name:`PopperContent`,props:(0,t.mergeDefaults)({side:{type:null,required:!1},sideOffset:{type:Number,required:!1},sideFlip:{type:Boolean,required:!1},align:{type:null,required:!1},alignOffset:{type:Number,required:!1},alignFlip:{type:Boolean,required:!1},avoidCollisions:{type:Boolean,required:!1},collisionBoundary:{type:null,required:!1},collisionPadding:{type:[Number,Object],required:!1},arrowPadding:{type:Number,required:!1},hideShiftedArrow:{type:Boolean,required:!1},sticky:{type:String,required:!1},hideWhenDetached:{type:Boolean,required:!1},positionStrategy:{type:String,required:!1},updatePositionStrategy:{type:String,required:!1},disableUpdateOnLayoutShift:{type:Boolean,required:!1},prioritizePosition:{type:Boolean,required:!1},reference:{type:null,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},{...Rs}),emits:[`placed`],setup(e,{emit:r}){let i=e,a=r,o=ya(),{forwardRef:s,currentElement:c}=Y(),l=(0,t.ref)(),u=(0,t.ref)(),{width:d,height:f}=hi(u),p=(0,t.computed)(()=>i.side+(i.align===`center`?``:`-${i.align}`)),m=(0,t.computed)(()=>typeof i.collisionPadding==`number`?i.collisionPadding:{top:0,right:0,bottom:0,left:0,...i.collisionPadding}),h=(0,t.computed)(()=>Array.isArray(i.collisionBoundary)?i.collisionBoundary:[i.collisionBoundary]),g=(0,t.computed)(()=>({padding:m.value,boundary:h.value.filter(Ea),altBoundary:h.value.length>0})),_=(0,t.computed)(()=>({mainAxis:i.sideFlip,crossAxis:i.alignFlip})),v=(0,n.computedEager)(()=>[bs({mainAxis:i.sideOffset+f.value,alignmentAxis:i.alignOffset}),i.prioritizePosition&&i.avoidCollisions&&Ss({...g.value,..._.value}),i.avoidCollisions&&xs({mainAxis:!0,crossAxis:!!i.prioritizePosition,limiter:i.sticky===`partial`?Es():void 0,...g.value}),!i.prioritizePosition&&i.avoidCollisions&&Ss({...g.value,..._.value}),Cs({...g.value,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--reka-popper-available-width`,`${n}px`),o.setProperty(`--reka-popper-available-height`,`${r}px`),o.setProperty(`--reka-popper-anchor-width`,`${i}px`),o.setProperty(`--reka-popper-anchor-height`,`${a}px`)}}),u.value&&Ps({element:u.value,padding:i.arrowPadding}),Da({arrowWidth:d.value,arrowHeight:f.value}),i.hideWhenDetached&&ws({strategy:`referenceHidden`,...g.value})]),{floatingStyles:y,placement:b,isPositioned:x,middlewareData:S,update:C}=Ls((0,t.computed)(()=>i.reference??o.anchor.value),l,{strategy:i.positionStrategy,placement:p,whileElementsMounted:(...e)=>ys(...e,{layoutShift:!i.disableUpdateOnLayoutShift,animationFrame:i.updatePositionStrategy===`always`}),middleware:v}),w=(0,t.computed)(()=>Oa(b.value)[0]),T=(0,t.computed)(()=>Oa(b.value)[1]);(0,t.watchPostEffect)(()=>{x.value&&a(`placed`)});let E=(0,t.computed)(()=>{let e=S.value.arrow?.centerOffset!==0;return i.hideShiftedArrow&&e}),ee=(0,t.ref)(``);return(0,t.watchEffect)(()=>{c.value&&(ee.value=window.getComputedStyle(c.value).zIndex)}),Bs({placedSide:w,onArrowChange:e=>u.value=e,arrowX:(0,t.computed)(()=>S.value.arrow?.x??0),arrowY:(0,t.computed)(()=>S.value.arrow?.y??0),shouldHideArrow:E}),(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{ref_key:`floatingRef`,ref:l,"data-reka-popper-content-wrapper":``,style:(0,t.normalizeStyle)({...(0,t.unref)(y),transform:(0,t.unref)(x)?(0,t.unref)(y).transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:ee.value,"--reka-popper-transform-origin":[(0,t.unref)(S).transformOrigin?.x,(0,t.unref)(S).transformOrigin?.y].join(` `),...(0,t.unref)(S).hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}})},[(0,t.createVNode)((0,t.unref)(X),(0,t.mergeProps)({ref:(0,t.unref)(s)},e.$attrs,{"as-child":i.asChild,as:e.as,"data-side":w.value,"data-align":T.value,style:{animation:(0,t.unref)(x)?void 0:`none`}}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16,[`as-child`,`as`,`data-side`,`data-align`,`style`])],4))}}),Hs={top:`bottom`,right:`left`,bottom:`top`,left:`right`},Us=(0,t.defineComponent)({inheritAttrs:!1,__name:`PopperArrow`,props:{width:{type:Number,required:!1},height:{type:Number,required:!1},rounded:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`svg`}},setup(e){let{forwardRef:n}=Y(),r=zs(),i=(0,t.computed)(()=>Hs[r.placedSide.value]);return(e,a)=>((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{ref:e=>{(0,t.unref)(r).onArrowChange(e)},style:(0,t.normalizeStyle)({position:`absolute`,left:(0,t.unref)(r).arrowX?.value?`${(0,t.unref)(r).arrowX?.value}px`:void 0,top:(0,t.unref)(r).arrowY?.value?`${(0,t.unref)(r).arrowY?.value}px`:void 0,[i.value]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[(0,t.unref)(r).placedSide.value],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[(0,t.unref)(r).placedSide.value],visibility:(0,t.unref)(r).shouldHideArrow.value?`hidden`:void 0})},[(0,t.createVNode)(Ta,(0,t.mergeProps)(e.$attrs,{ref:(0,t.unref)(n),style:{display:`block`},as:e.as,"as-child":e.asChild,rounded:e.rounded,width:e.width,height:e.height}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16,[`as`,`as-child`,`rounded`,`width`,`height`])],4))}});function Ws(e){let n=Cr({nonce:(0,t.ref)()});return(0,t.computed)(()=>e?.value||n.nonce?.value)}function Gs(e=[],t,n){let r=[...e];return r[n]=t,r.sort((e,t)=>e-t)}function Ks(e,t,n){return _r(100/(n-t)*(e-t),0,100)}function qs(e,t){if(t>2)return`Value ${e+1} of ${t}`;if(t===2)return[`Minimum`,`Maximum`][e]}function Js(e,t){if(e.length===1)return 0;let n=e.map(e=>Math.abs(e-t)),r=Math.min(...n);return n.indexOf(r)}function Ys(e,t,n){let r=e/2;return(r-Qs([0,50],[0,r])(t)*n)*n}function Xs(e){return e.slice(0,-1).map((t,n)=>e[n+1]-t)}function Zs(e,t){if(t>0){let n=Xs(e);return Math.min(...n)>=t}return!0}function Qs(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function $s(e){return(String(e).split(`.`)[1]||``).length}function ec(e,t){let n=10**t;return Math.round(e*n)/n}var tc=[`PageUp`,`PageDown`],nc=[`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`],rc={"from-left":[`Home`,`PageDown`,`ArrowDown`,`ArrowLeft`],"from-right":[`Home`,`PageDown`,`ArrowDown`,`ArrowRight`],"from-bottom":[`Home`,`PageDown`,`ArrowDown`,`ArrowLeft`],"from-top":[`Home`,`PageUp`,`ArrowUp`,`ArrowLeft`]},[ic,ac]=vr([`SliderVertical`,`SliderHorizontal`]),oc=(0,t.defineComponent)({__name:`SliderHorizontal`,props:{dir:{type:String,required:!1},min:{type:Number,required:!0},max:{type:Number,required:!0},inverted:{type:Boolean,required:!0}},emits:[`slideEnd`,`slideStart`,`slideMove`,`homeKeyDown`,`endKeyDown`,`stepKeyDown`],setup(e,{emit:n}){let r=e,i=n,{max:a,min:o,dir:s,inverted:c}=(0,t.toRefs)(r),{forwardRef:l,currentElement:u}=Y(),d=cc(),f=(0,t.ref)(),p=(0,t.ref)(),m=(0,t.computed)(()=>s?.value!==`rtl`&&!c.value||s?.value!==`ltr`&&c.value);function h(e,t){let n=p.value||u.value.getBoundingClientRect(),r=[...d.thumbElements.value][d.valueIndexToChangeRef.value],i=d.thumbAlignment.value===`contain`?r.clientWidth:0;!f.value&&!t&&d.thumbAlignment.value===`contain`&&(f.value=e.clientX-r.getBoundingClientRect().left);let s=Qs([0,n.width-i],m.value?[o.value,a.value]:[a.value,o.value]);return p.value=n,s(t?e.clientX-n.left-i/2:e.clientX-n.left-(f.value??0))}return ac({startEdge:(0,t.computed)(()=>m.value?`left`:`right`),endEdge:(0,t.computed)(()=>m.value?`right`:`left`),direction:(0,t.computed)(()=>m.value?1:-1),size:`width`}),(e,n)=>((0,t.openBlock)(),(0,t.createBlock)(dc,{ref:(0,t.unref)(l),dir:(0,t.unref)(s),"data-orientation":`horizontal`,style:(0,t.normalizeStyle)({"--reka-slider-thumb-transform":!m.value&&(0,t.unref)(d).thumbAlignment.value===`overflow`?`translateX(50%)`:`translateX(-50%)`}),onSlideStart:n[0]||=e=>{i(`slideStart`,h(e,!0))},onSlideMove:n[1]||=e=>{i(`slideMove`,h(e))},onSlideEnd:n[2]||=()=>{p.value=void 0,f.value=void 0,i(`slideEnd`)},onStepKeyDown:n[3]||=e=>{let n=m.value?`from-left`:`from-right`;i(`stepKeyDown`,e,(0,t.unref)(rc)[n].includes(e.key)?-1:1)},onEndKeyDown:n[4]||=e=>i(`endKeyDown`,e),onHomeKeyDown:n[5]||=e=>i(`homeKeyDown`,e)},{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},8,[`dir`,`style`]))}}),sc=(0,t.defineComponent)({__name:`SliderVertical`,props:{min:{type:Number,required:!0},max:{type:Number,required:!0},inverted:{type:Boolean,required:!0}},emits:[`slideEnd`,`slideStart`,`slideMove`,`homeKeyDown`,`endKeyDown`,`stepKeyDown`],setup(e,{emit:n}){let r=e,i=n,{max:a,min:o,inverted:s}=(0,t.toRefs)(r),c=cc(),{forwardRef:l,currentElement:u}=Y(),d=(0,t.ref)(),f=(0,t.ref)(),p=(0,t.computed)(()=>!s.value);function m(e,t){let n=f.value||u.value.getBoundingClientRect(),r=[...c.thumbElements.value][c.valueIndexToChangeRef.value],i=c.thumbAlignment.value===`contain`?r.clientHeight:0;!d.value&&!t&&c.thumbAlignment.value===`contain`&&(d.value=e.clientY-r.getBoundingClientRect().top);let s=Qs([0,n.height-i],p.value?[a.value,o.value]:[o.value,a.value]),l=t?e.clientY-n.top-i/2:e.clientY-n.top-(d.value??0);return f.value=n,s(l)}return ac({startEdge:(0,t.computed)(()=>p.value?`bottom`:`top`),endEdge:(0,t.computed)(()=>p.value?`top`:`bottom`),direction:(0,t.computed)(()=>p.value?1:-1),size:`height`}),(e,n)=>((0,t.openBlock)(),(0,t.createBlock)(dc,{ref:(0,t.unref)(l),"data-orientation":`vertical`,style:(0,t.normalizeStyle)({"--reka-slider-thumb-transform":!p.value&&(0,t.unref)(c).thumbAlignment.value===`overflow`?`translateY(-50%)`:`translateY(50%)`}),onSlideStart:n[0]||=e=>{i(`slideStart`,m(e,!0))},onSlideMove:n[1]||=e=>{i(`slideMove`,m(e))},onSlideEnd:n[2]||=()=>{f.value=void 0,d.value=void 0,i(`slideEnd`)},onStepKeyDown:n[3]||=e=>{let n=p.value?`from-bottom`:`from-top`;i(`stepKeyDown`,e,(0,t.unref)(rc)[n].includes(e.key)?-1:1)},onEndKeyDown:n[4]||=e=>i(`endKeyDown`,e),onHomeKeyDown:n[5]||=e=>i(`homeKeyDown`,e)},{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},8,[`style`]))}}),[cc,lc]=vr(`SliderRoot`),uc=(0,t.defineComponent)({inheritAttrs:!1,__name:`SliderRoot`,props:{defaultValue:{type:Array,required:!1,default:()=>[0]},modelValue:{type:[Array,null],required:!1},disabled:{type:Boolean,required:!1,default:!1},orientation:{type:String,required:!1,default:`horizontal`},dir:{type:String,required:!1},inverted:{type:Boolean,required:!1,default:!1},min:{type:Number,required:!1,default:0},max:{type:Number,required:!1,default:100},step:{type:Number,required:!1,default:1},minStepsBetweenThumbs:{type:Number,required:!1,default:0},thumbAlignment:{type:String,required:!1,default:`contain`},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`span`},name:{type:String,required:!1},required:{type:Boolean,required:!1}},emits:[`update:modelValue`,`valueCommit`],setup(e,{emit:r}){let i=e,a=r,{min:o,max:s,step:c,minStepsBetweenThumbs:l,orientation:u,disabled:d,thumbAlignment:f,dir:p}=(0,t.toRefs)(i),m=Hr(p),{forwardRef:h,currentElement:g}=Y(),_=qr(g),{CollectionSlot:v}=ha({isProvider:!0}),y=(0,n.useVModel)(i,`modelValue`,a,{defaultValue:i.defaultValue,passive:i.modelValue===void 0}),b=(0,t.computed)(()=>Array.isArray(y.value)?[...y.value]:[]),x=(0,t.ref)(0),S=(0,t.ref)(b.value);function C(e){E(e,Js(b.value,e))}function w(e){E(e,x.value)}function T(){let e=S.value[x.value];b.value[x.value]!==e&&a(`valueCommit`,(0,t.toRaw)(b.value))}function E(e,t,{commit:n}={commit:!1}){let r=$s(c.value),i=_r(ec(Math.round((e-o.value)/c.value)*c.value+o.value,r),o.value,s.value),u=Gs(b.value,i,t);if(Zs(u,l.value*c.value)){x.value=u.indexOf(i);let e=String(u)!==String(y.value);e&&n&&a(`valueCommit`,u),e&&(ee.value[x.value]?.focus(),y.value=u)}}let ee=(0,t.ref)([]);return lc({modelValue:y,currentModelValue:b,valueIndexToChangeRef:x,thumbElements:ee,orientation:u,min:o,max:s,disabled:d,thumbAlignment:f}),(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(v),null,{default:(0,t.withCtx)(()=>[((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)((0,t.unref)(u)===`horizontal`?oc:sc),(0,t.mergeProps)(e.$attrs,{ref:(0,t.unref)(h),"as-child":e.asChild,as:e.as,min:(0,t.unref)(o),max:(0,t.unref)(s),dir:(0,t.unref)(m),inverted:e.inverted,"aria-disabled":(0,t.unref)(d),"data-disabled":(0,t.unref)(d)?``:void 0,onPointerdown:n[0]||=()=>{(0,t.unref)(d)||(S.value=b.value)},onSlideStart:n[1]||=e=>!(0,t.unref)(d)&&C(e),onSlideMove:n[2]||=e=>!(0,t.unref)(d)&&w(e),onSlideEnd:n[3]||=e=>!(0,t.unref)(d)&&T(),onHomeKeyDown:n[4]||=e=>!(0,t.unref)(d)&&E((0,t.unref)(o),0,{commit:!0}),onEndKeyDown:n[5]||=e=>!(0,t.unref)(d)&&E((0,t.unref)(s),b.value.length-1,{commit:!0}),onStepKeyDown:n[6]||=(e,n)=>{if(!(0,t.unref)(d)){let r=(0,t.unref)(tc).includes(e.key)||e.shiftKey&&(0,t.unref)(nc).includes(e.key)?10:1,i=x.value,a=b.value[i];E(a+(0,t.unref)(c)*r*n,i,{commit:!0})}}}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`,{modelValue:(0,t.unref)(y)}),(0,t.unref)(_)&&e.name?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(va),{key:0,type:`number`,value:(0,t.unref)(y),name:e.name,required:e.required,disabled:(0,t.unref)(d),step:(0,t.unref)(c)},null,8,[`value`,`name`,`required`,`disabled`,`step`])):(0,t.createCommentVNode)(`v-if`,!0)]),_:3},16,[`as-child`,`as`,`min`,`max`,`dir`,`inverted`,`aria-disabled`,`data-disabled`]))]),_:3}))}}),dc=(0,t.defineComponent)({__name:`SliderImpl`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`span`}},emits:[`slideStart`,`slideMove`,`slideEnd`,`homeKeyDown`,`endKeyDown`,`stepKeyDown`],setup(e,{emit:n}){let r=e,i=n,a=cc();return(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(X),(0,t.mergeProps)({"data-slider-impl":``},r,{onKeydown:n[0]||=e=>{e.key===`Home`?(i(`homeKeyDown`,e),e.preventDefault()):e.key===`End`?(i(`endKeyDown`,e),e.preventDefault()):(0,t.unref)(tc).concat((0,t.unref)(nc)).includes(e.key)&&(i(`stepKeyDown`,e),e.preventDefault())},onPointerdown:n[1]||=e=>{let n=e.target;n.setPointerCapture(e.pointerId),e.preventDefault(),(0,t.unref)(a).thumbElements.value.includes(n)?n.focus():i(`slideStart`,e)},onPointermove:n[2]||=e=>{e.target.hasPointerCapture(e.pointerId)&&i(`slideMove`,e)},onPointerup:n[3]||=e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&(t.releasePointerCapture(e.pointerId),i(`slideEnd`,e))}}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16))}}),fc=(0,t.defineComponent)({__name:`SliderRange`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`span`}},setup(e){let n=cc(),r=ic();Y();let i=(0,t.computed)(()=>n.currentModelValue.value.map(e=>Ks(e,n.min.value,n.max.value))),a=(0,t.computed)(()=>n.currentModelValue.value.length>1?Math.min(...i.value):0),o=(0,t.computed)(()=>100-Math.max(...i.value,0));return(e,i)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(X),{"data-disabled":(0,t.unref)(n).disabled.value?``:void 0,"data-orientation":(0,t.unref)(n).orientation.value,"as-child":e.asChild,as:e.as,style:(0,t.normalizeStyle)({[(0,t.unref)(r).startEdge.value]:`${a.value}%`,[(0,t.unref)(r).endEdge.value]:`${o.value}%`})},{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},8,[`data-disabled`,`data-orientation`,`as-child`,`as`,`style`]))}}),pc=(0,t.defineComponent)({inheritAttrs:!1,__name:`SliderThumbImpl`,props:{index:{type:Number,required:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let r=e,i=cc(),a=ic(),{forwardRef:o,currentElement:s}=Y(),{CollectionItem:c}=ha(),l=(0,t.computed)(()=>i.modelValue?.value?.[r.index]),u=(0,t.computed)(()=>l.value===void 0?0:Ks(l.value,i.min.value??0,i.max.value??100)),d=(0,t.computed)(()=>qs(r.index,i.modelValue?.value?.length??0)),f=hi(s),p=(0,t.computed)(()=>f[a.size].value),m=(0,t.computed)(()=>i.thumbAlignment.value===`overflow`||!p.value?0:Ys(p.value,u.value,a.direction.value)),h=(0,n.useMounted)();return(0,t.onMounted)(()=>{i.thumbElements.value.push(s.value)}),(0,t.onUnmounted)(()=>{let e=i.thumbElements.value.findIndex(e=>e===s.value)??-1;i.thumbElements.value.splice(e,1)}),(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(c),null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(X),(0,t.mergeProps)(e.$attrs,{ref:(0,t.unref)(o),role:`slider`,tabindex:(0,t.unref)(i).disabled.value?void 0:0,"aria-label":e.$attrs[`aria-label`]||d.value,"data-disabled":(0,t.unref)(i).disabled.value?``:void 0,"data-orientation":(0,t.unref)(i).orientation.value,"aria-valuenow":l.value,"aria-valuemin":(0,t.unref)(i).min.value,"aria-valuemax":(0,t.unref)(i).max.value,"aria-orientation":(0,t.unref)(i).orientation.value,"as-child":e.asChild,as:e.as,style:{transform:`var(--reka-slider-thumb-transform)`,position:`absolute`,[(0,t.unref)(a).startEdge.value]:`calc(${u.value}% + ${m.value}px)`,display:!(0,t.unref)(h)&&l.value===void 0?`none`:void 0},onFocus:n[0]||=()=>{(0,t.unref)(i).valueIndexToChangeRef.value=e.index}}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16,[`tabindex`,`aria-label`,`data-disabled`,`data-orientation`,`aria-valuenow`,`aria-valuemin`,`aria-valuemax`,`aria-orientation`,`as-child`,`as`,`style`])]),_:3}))}}),mc=(0,t.defineComponent)({__name:`SliderThumb`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`span`}},setup(e){let n=e,{getItems:r}=ha(),{forwardRef:i,currentElement:a}=Y(),o=(0,t.computed)(()=>a.value?r(!0).findIndex(e=>e.ref===a.value):-1);return(e,r)=>((0,t.openBlock)(),(0,t.createBlock)(pc,(0,t.mergeProps)({ref:(0,t.unref)(i)},n,{index:o.value}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16,[`index`]))}}),hc=(0,t.defineComponent)({__name:`SliderTrack`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`span`}},setup(e){let n=cc();return Y(),(e,r)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(X),{"as-child":e.asChild,as:e.as,"data-disabled":(0,t.unref)(n).disabled.value?``:void 0,"data-orientation":(0,t.unref)(n).orientation.value},{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},8,[`as-child`,`as`,`data-disabled`,`data-orientation`]))}}),gc=(0,t.defineComponent)({__name:`Label`,props:{for:{type:String,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`label`}},setup(e){let n=e;return Y(),(e,r)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(X),(0,t.mergeProps)(n,{onMousedown:r[0]||=e=>{!e.defaultPrevented&&e.detail>1&&e.preventDefault()}}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16))}}),[_c,vc]=vr(`ScrollAreaRoot`),yc=(0,t.defineComponent)({__name:`ScrollAreaRoot`,props:{type:{type:String,required:!1,default:`hover`},dir:{type:String,required:!1},scrollHideDelay:{type:Number,required:!1,default:600},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e,{expose:n}){let r=e,i=(0,t.ref)(0),a=(0,t.ref)(0),o=(0,t.ref)(),s=(0,t.ref)(),c=(0,t.ref)(),l=(0,t.ref)(),u=(0,t.ref)(!1),d=(0,t.ref)(!1),{type:f,dir:p,scrollHideDelay:m}=(0,t.toRefs)(r),h=Hr(p);function g(){o.value?.scrollTo({top:0})}function _(){o.value?.scrollTo({top:0,left:0})}n({viewport:o,scrollTop:g,scrollTopLeft:_});let{forwardRef:v,currentElement:y}=Y();return vc({type:f,dir:h,scrollHideDelay:m,scrollArea:y,viewport:o,onViewportChange:e=>{o.value=e||void 0},content:s,onContentChange:e=>{s.value=e},scrollbarX:c,scrollbarXEnabled:u,scrollbarY:l,scrollbarYEnabled:d,onScrollbarXChange:e=>{c.value=e||void 0},onScrollbarYChange:e=>{l.value=e||void 0},onScrollbarXEnabledChange:e=>{u.value=e},onScrollbarYEnabledChange:e=>{d.value=e},onCornerWidthChange:e=>{i.value=e},onCornerHeightChange:e=>{a.value=e}}),(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(X),{ref:(0,t.unref)(v),"as-child":r.asChild,as:e.as,dir:(0,t.unref)(h),style:(0,t.normalizeStyle)({position:`relative`,"--reka-scroll-area-corner-width":`${i.value}px`,"--reka-scroll-area-corner-height":`${a.value}px`})},{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},8,[`as-child`,`as`,`dir`,`style`]))}}),bc=(0,t.defineComponent)({__name:`ScrollAreaCornerImpl`,setup(e){let r=_c(),i=(0,t.ref)(0),a=(0,t.ref)(0),o=(0,t.computed)(()=>!!i.value&&!!a.value);function s(){let e=r.scrollbarX.value?.offsetHeight||0;r.onCornerHeightChange(e),a.value=e}function c(){let e=r.scrollbarY.value?.offsetWidth||0;r.onCornerWidthChange(e),i.value=e}return(0,n.useResizeObserver)(r.scrollbarX.value,s),(0,n.useResizeObserver)(r.scrollbarY.value,c),(0,t.watch)(()=>r.scrollbarX.value,s),(0,t.watch)(()=>r.scrollbarY.value,c),(e,n)=>o.value?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(X),(0,t.mergeProps)({key:0,style:{width:`${i.value}px`,height:`${a.value}px`,position:`absolute`,right:(0,t.unref)(r).dir.value===`ltr`?0:void 0,left:(0,t.unref)(r).dir.value===`rtl`?0:void 0,bottom:0}},e.$parent?.$props),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16,[`style`])):(0,t.createCommentVNode)(`v-if`,!0)}}),xc=(0,t.defineComponent)({__name:`ScrollAreaCorner`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let n=e,{forwardRef:r}=Y(),i=_c(),a=(0,t.computed)(()=>!!i.scrollbarX.value&&!!i.scrollbarY.value),o=(0,t.computed)(()=>i.type.value!==`scroll`&&a.value);return(e,i)=>o.value?((0,t.openBlock)(),(0,t.createBlock)(bc,(0,t.mergeProps)({key:0},n,{ref:(0,t.unref)(r)}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16)):(0,t.createCommentVNode)(`v-if`,!0)}});function Sc(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function Cc(e){let t=wc(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function wc(e,t){let n=e/t;return Number.isNaN(n)?0:n}function Tc(e,t=()=>{}){let n={left:e.scrollLeft,top:e.scrollTop},r=0;return(function i(){let a={left:e.scrollLeft,top:e.scrollTop},o=n.left!==a.left,s=n.top!==a.top;(o||s)&&t(),n=a,r=window.requestAnimationFrame(i)})(),()=>window.cancelAnimationFrame(r)}function Ec(e,t,n=`ltr`){let r=Cc(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,a=t.scrollbar.size-i,o=t.content-t.viewport,s=a-r,c=n===`ltr`?[0,o]:[o*-1,0],l=_r(e,c[0],c[1]);return Sc([0,o],[0,s])(l)}function Dc(e){return e?Number.parseInt(e,10):0}function Oc(e,t,n,r=`ltr`){let i=Cc(n),a=i/2,o=t||a,s=i-o,c=n.scrollbar.paddingStart+o,l=n.scrollbar.size-n.scrollbar.paddingEnd-s,u=n.content-n.viewport,d=r===`ltr`?[0,u]:[u*-1,0];return Sc([c,l],d)(e)}function kc(e,t){return e>0&&e<t}var Ac=(0,t.defineComponent)({__name:`ScrollAreaScrollbarX`,setup(e){let n=_c(),r=zc(),{forwardRef:i,currentElement:a}=Y();(0,t.onMounted)(()=>{a.value&&n.onScrollbarXChange(a.value)});let o=(0,t.computed)(()=>r.sizes.value);return(e,a)=>((0,t.openBlock)(),(0,t.createBlock)(Hc,{ref:(0,t.unref)(i),"is-horizontal":!0,"data-orientation":`horizontal`,style:(0,t.normalizeStyle)({bottom:0,left:(0,t.unref)(n).dir.value===`rtl`?`var(--reka-scroll-area-corner-width)`:0,right:(0,t.unref)(n).dir.value===`ltr`?`var(--reka-scroll-area-corner-width)`:0,"--reka-scroll-area-thumb-width":o.value?`${(0,t.unref)(Cc)(o.value)}px`:void 0}),onOnDragScroll:a[0]||=e=>(0,t.unref)(r).onDragScroll(e.x)},{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},8,[`style`]))}}),jc=(0,t.defineComponent)({__name:`ScrollAreaScrollbarY`,setup(e){let n=_c(),r=zc(),{forwardRef:i,currentElement:a}=Y();(0,t.onMounted)(()=>{a.value&&n.onScrollbarYChange(a.value)});let o=(0,t.computed)(()=>r.sizes.value);return(e,a)=>((0,t.openBlock)(),(0,t.createBlock)(Hc,{ref:(0,t.unref)(i),"is-horizontal":!1,"data-orientation":`vertical`,style:(0,t.normalizeStyle)({top:0,right:(0,t.unref)(n).dir.value===`ltr`?0:void 0,left:(0,t.unref)(n).dir.value===`rtl`?0:void 0,bottom:`var(--reka-scroll-area-corner-height)`,"--reka-scroll-area-thumb-height":o.value?`${(0,t.unref)(Cc)(o.value)}px`:void 0}),onOnDragScroll:a[0]||=e=>(0,t.unref)(r).onDragScroll(e.y)},{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},8,[`style`]))}}),Mc=(0,t.defineComponent)({__name:`ScrollAreaScrollbarAuto`,props:{forceMount:{type:Boolean,required:!1}},setup(e){let r=_c(),i=Ic(),{forwardRef:a}=Y(),o=(0,t.ref)(!1),s=(0,n.useDebounceFn)(()=>{if(r.viewport.value){let e=r.viewport.value.offsetWidth<r.viewport.value.scrollWidth,t=r.viewport.value.offsetHeight<r.viewport.value.scrollHeight;o.value=i.isHorizontal.value?e:t}},10);return(0,t.onMounted)(()=>s()),(0,n.useResizeObserver)(r.viewport,s),(0,n.useResizeObserver)(r.content,s),(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Si),{present:e.forceMount||o.value},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(Vc,(0,t.mergeProps)(e.$attrs,{ref:(0,t.unref)(a),"data-state":o.value?`visible`:`hidden`}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16,[`data-state`])]),_:3},8,[`present`]))}}),Nc=(0,t.defineComponent)({inheritAttrs:!1,__name:`ScrollAreaScrollbarGlimpse`,props:{forceMount:{type:Boolean,required:!1}},setup(e){let r=_c(),i=Ic(),{forwardRef:a}=Y(),{state:o,dispatch:s}=gi(`hidden`,{hidden:{POINTER_ENTER:`glimpse`,SCROLL:`scrolling`},glimpse:{HIDE:`hidden`,POINTER_LEAVE:`hidden`,SCROLL:`scrolling`,POINTER_ENTER:`glimpse`},scrolling:{SCROLL_END:`idle`,POINTER_ENTER:`interacting`},interacting:{SCROLL:`interacting`,POINTER_LEAVE:`idle`},idle:{HIDE:`hidden`,SCROLL:`scrolling`,POINTER_ENTER:`interacting`}}),c=(0,t.computed)(()=>o.value!==`hidden`);function l(){s(`POINTER_ENTER`)}function u(){s(`POINTER_LEAVE`)}let d=(0,n.useDebounceFn)(()=>s(`SCROLL_END`),100);return(0,t.watchEffect)(e=>{if(o.value===`glimpse`){let t=window.setTimeout(()=>s(`HIDE`),r.scrollHideDelay.value);e(()=>{window.clearTimeout(t)})}}),(0,t.watchEffect)(e=>{if(o.value===`idle`){let t=window.setTimeout(()=>s(`HIDE`),r.scrollHideDelay.value);e(()=>{window.clearTimeout(t)})}}),(0,t.watchEffect)(e=>{let t=r.viewport.value,n=i.isHorizontal.value?`scrollLeft`:`scrollTop`;if(t){let r=t[n],i=()=>{let e=t[n];r!==e&&(s(`SCROLL`),d()),r=e};t.addEventListener(`scroll`,i),e(()=>{t.removeEventListener(`scroll`,i)})}}),(0,t.onMounted)(()=>{let e=r.scrollArea.value;e&&(e.addEventListener(`pointerenter`,l),e.addEventListener(`pointerleave`,u))}),(0,t.onUnmounted)(()=>{let e=r.scrollArea.value;e&&(e.removeEventListener(`pointerenter`,l),e.removeEventListener(`pointerleave`,u))}),(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Si),{present:e.forceMount||c.value},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(Mc,(0,t.mergeProps)(e.$attrs,{ref:(0,t.unref)(a),"data-state":c.value?`visible`:`hidden`}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16,[`data-state`])]),_:3},8,[`present`]))}}),Pc=(0,t.defineComponent)({inheritAttrs:!1,__name:`ScrollAreaScrollbarHover`,props:{forceMount:{type:Boolean,required:!1}},setup(e){let n=_c(),{forwardRef:r}=Y(),i,a=(0,t.ref)(!1);function o(){window.clearTimeout(i),a.value=!0}function s(){i=window.setTimeout(()=>{a.value=!1},n.scrollHideDelay.value)}return(0,t.onMounted)(()=>{let e=n.scrollArea.value;e&&(e.addEventListener(`pointerenter`,o),e.addEventListener(`pointerleave`,s))}),(0,t.onUnmounted)(()=>{let e=n.scrollArea.value;e&&(window.clearTimeout(i),e.removeEventListener(`pointerenter`,o),e.removeEventListener(`pointerleave`,s))}),(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Si),{present:e.forceMount||a.value},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(Mc,(0,t.mergeProps)(e.$attrs,{ref:(0,t.unref)(r),"data-state":a.value?`visible`:`hidden`}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16,[`data-state`])]),_:3},8,[`present`]))}}),Fc=(0,t.defineComponent)({__name:`ScrollAreaScrollbarScroll`,props:{forceMount:{type:Boolean,required:!1}},setup(e){let r=_c(),i=Ic(),{forwardRef:a}=Y(),{state:o,dispatch:s}=gi(`hidden`,{hidden:{SCROLL:`scrolling`},scrolling:{SCROLL_END:`idle`,POINTER_ENTER:`interacting`},interacting:{SCROLL:`interacting`,POINTER_LEAVE:`idle`},idle:{HIDE:`hidden`,SCROLL:`scrolling`,POINTER_ENTER:`interacting`}}),c=(0,t.computed)(()=>o.value!==`hidden`);(0,t.watchEffect)(e=>{if(o.value===`idle`){let t=window.setTimeout(()=>s(`HIDE`),r.scrollHideDelay.value);e(()=>{window.clearTimeout(t)})}});let l=(0,n.useDebounceFn)(()=>s(`SCROLL_END`),100);return(0,t.watchEffect)(e=>{let t=r.viewport.value,n=i.isHorizontal.value?`scrollLeft`:`scrollTop`;if(t){let r=t[n],i=()=>{let e=t[n];r!==e&&(s(`SCROLL`),l()),r=e};t.addEventListener(`scroll`,i),e(()=>{t.removeEventListener(`scroll`,i)})}}),(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Si),{present:e.forceMount||c.value},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(Vc,(0,t.mergeProps)(e.$attrs,{ref:(0,t.unref)(a),"data-state":c.value?`visible`:`hidden`}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16,[`data-state`])]),_:3},8,[`present`]))}}),[Ic,Lc]=vr(`ScrollAreaScrollbar`),Rc=(0,t.defineComponent)({inheritAttrs:!1,__name:`ScrollAreaScrollbar`,props:{orientation:{type:String,required:!1,default:`vertical`},forceMount:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`div`}},setup(e){let n=e,{forwardRef:r}=Y(),i=_c(),a=(0,t.computed)(()=>n.orientation===`horizontal`);(0,t.watch)(a,()=>{a.value?i.onScrollbarXEnabledChange(!0):i.onScrollbarYEnabledChange(!0)},{immediate:!0}),(0,t.onUnmounted)(()=>{i.onScrollbarXEnabledChange(!1),i.onScrollbarYEnabledChange(!1)});let{orientation:o,forceMount:s,asChild:c,as:l}=(0,t.toRefs)(n);return Lc({orientation:o,forceMount:s,isHorizontal:a,as:l,asChild:c}),(e,n)=>(0,t.unref)(i).type.value===`hover`?((0,t.openBlock)(),(0,t.createBlock)(Pc,(0,t.mergeProps)({key:0},e.$attrs,{ref:(0,t.unref)(r),"force-mount":(0,t.unref)(s)}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16,[`force-mount`])):(0,t.unref)(i).type.value===`scroll`?((0,t.openBlock)(),(0,t.createBlock)(Fc,(0,t.mergeProps)({key:1},e.$attrs,{ref:(0,t.unref)(r),"force-mount":(0,t.unref)(s)}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16,[`force-mount`])):(0,t.unref)(i).type.value===`glimpse`?((0,t.openBlock)(),(0,t.createBlock)(Nc,(0,t.mergeProps)({key:2},e.$attrs,{ref:(0,t.unref)(r),"force-mount":(0,t.unref)(s)}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16,[`force-mount`])):(0,t.unref)(i).type.value===`auto`?((0,t.openBlock)(),(0,t.createBlock)(Mc,(0,t.mergeProps)({key:3},e.$attrs,{ref:(0,t.unref)(r),"force-mount":(0,t.unref)(s)}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16,[`force-mount`])):(0,t.unref)(i).type.value===`always`?((0,t.openBlock)(),(0,t.createBlock)(Vc,(0,t.mergeProps)({key:4},e.$attrs,{ref:(0,t.unref)(r),"data-state":`visible`}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16)):(0,t.createCommentVNode)(`v-if`,!0)}}),[zc,Bc]=vr(`ScrollAreaScrollbarVisible`),Vc=(0,t.defineComponent)({__name:`ScrollAreaScrollbarVisible`,setup(e){let n=_c(),r=Ic(),{forwardRef:i}=Y(),a=(0,t.ref)({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),o=(0,t.computed)(()=>{let e=wc(a.value.viewport,a.value.content);return e>0&&e<1}),s=(0,t.ref)(),c=(0,t.ref)(0);function l(e,t){if(m.value){let r=n.viewport.value.scrollLeft+e.deltaY;n.viewport.value.scrollLeft=r,kc(r,t)&&e.preventDefault()}else{let r=n.viewport.value.scrollTop+e.deltaY;n.viewport.value.scrollTop=r,kc(r,t)&&e.preventDefault()}}function u(e,t){m.value?c.value=t.x:c.value=t.y}function d(e){c.value=0}function f(e){a.value=e}function p(e,t){return Oc(e,c.value,a.value,t)}let m=(0,t.computed)(()=>r.isHorizontal.value);function h(e){m.value?n.viewport.value.scrollLeft=p(e,n.dir.value):n.viewport.value.scrollTop=p(e)}function g(){if(m.value){if(n.viewport.value&&s.value){let e=n.viewport.value.scrollLeft,t=Ec(e,a.value,n.dir.value);s.value.style.transform=`translate3d(${t}px, 0, 0)`}}else if(n.viewport.value&&s.value){let e=n.viewport.value.scrollTop,t=Ec(e,a.value);s.value.style.transform=`translate3d(0, ${t}px, 0)`}}function _(e){s.value=e}return Bc({sizes:a,hasThumb:o,handleWheelScroll:l,handleThumbDown:u,handleThumbUp:d,handleSizeChange:f,onThumbPositionChange:g,onThumbChange:_,onDragScroll:h}),(e,n)=>m.value?((0,t.openBlock)(),(0,t.createBlock)(Ac,(0,t.mergeProps)({key:0},e.$attrs,{ref:(0,t.unref)(i)}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16)):((0,t.openBlock)(),(0,t.createBlock)(jc,(0,t.mergeProps)({key:1},e.$attrs,{ref:(0,t.unref)(i)}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16))}}),Hc=(0,t.defineComponent)({__name:`ScrollAreaScrollbarImpl`,props:{isHorizontal:{type:Boolean,required:!0}},emits:[`onDragScroll`,`onWheelScroll`,`onThumbPointerDown`],setup(e,{emit:r}){let i=e,a=r,o=_c(),s=zc(),c=Ic(),{forwardRef:l,currentElement:u}=Y(),d=(0,t.ref)(``),f=(0,t.ref)();function p(e){f.value&&a(`onDragScroll`,{x:e.clientX-f.value?.left,y:e.clientY-f.value?.top})}function m(e){e.button===0&&(e.target.setPointerCapture(e.pointerId),f.value=u.value.getBoundingClientRect(),d.value=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect=`none`,o.viewport&&(o.viewport.value.style.scrollBehavior=`auto`),p(e))}function h(e){p(e)}function g(e){let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=d.value,o.viewport&&(o.viewport.value.style.scrollBehavior=``),f.value=void 0}function _(e){let t=e.target,n=u.value?.contains(t),r=s.sizes.value.content-s.sizes.value.viewport;n&&s.handleWheelScroll(e,r)}(0,t.onMounted)(()=>{document.addEventListener(`wheel`,_,{passive:!1})}),(0,t.onUnmounted)(()=>{document.removeEventListener(`wheel`,_)});function v(){u.value&&(i.isHorizontal?s.handleSizeChange({content:o.viewport.value?.scrollWidth??0,viewport:o.viewport.value?.offsetWidth??0,scrollbar:{size:u.value.clientWidth??0,paddingStart:Dc(getComputedStyle(u.value).paddingLeft),paddingEnd:Dc(getComputedStyle(u.value).paddingRight)}}):s.handleSizeChange({content:o.viewport.value?.scrollHeight??0,viewport:o.viewport.value?.offsetHeight??0,scrollbar:{size:u.value?.clientHeight??0,paddingStart:Dc(getComputedStyle(u.value).paddingTop),paddingEnd:Dc(getComputedStyle(u.value).paddingBottom)}}),s.onThumbPositionChange())}return(0,n.useResizeObserver)(u,v),(0,n.useResizeObserver)(o.content,v),(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(X),{ref:(0,t.unref)(l),style:{position:`absolute`},"data-scrollbarimpl":``,as:(0,t.unref)(c).as.value,"as-child":(0,t.unref)(c).asChild.value,onPointerdown:m,onPointermove:h,onPointerup:g},{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},8,[`as`,`as-child`]))}}),Uc=(0,t.defineComponent)({__name:`ScrollAreaThumb`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let r=e,i=_c(),a=zc();function o(e){let t=e.target.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top;a.handleThumbDown(e,{x:n,y:r})}function s(e){a.handleThumbUp(e)}let{forwardRef:c,currentElement:l}=Y(),u=(0,t.ref)(),d=(0,t.computed)(()=>i.viewport.value);function f(){u.value||(u.value=Tc(d.value,a.onThumbPositionChange),a.onThumbPositionChange())}return(0,n.watchOnce)((0,t.computed)(()=>a.sizes.value),()=>{a.onThumbChange(l.value),d.value&&(a.onThumbPositionChange(),d.value.addEventListener(`scroll`,f))}),(0,t.onUnmounted)(()=>{d.value.removeEventListener(`scroll`,f),i.viewport.value?.removeEventListener(`scroll`,f)}),(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(X),{ref:(0,t.unref)(c),"data-state":(0,t.unref)(a).hasThumb?`visible`:`hidden`,style:{width:`var(--reka-scroll-area-thumb-width)`,height:`var(--reka-scroll-area-thumb-height)`},"as-child":r.asChild,as:e.as,onPointerdown:o,onPointerup:s},{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},8,[`data-state`,`as-child`,`as`]))}}),Wc=(0,t.defineComponent)({inheritAttrs:!1,__name:`ScrollAreaViewport`,props:{nonce:{type:String,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e,{expose:n}){let r=e,{nonce:i}=(0,t.toRefs)(r),a=Ws(i),o=_c(),s=(0,t.ref)();(0,t.onMounted)(()=>{o.onViewportChange(s.value),o.onContentChange(l.value)}),n({viewportElement:s});let{forwardRef:c,currentElement:l}=Y();return(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,null,[(0,t.createElementVNode)(`div`,(0,t.mergeProps)({ref_key:`viewportElement`,ref:s,"data-reka-scroll-area-viewport":``,style:{overflowX:(0,t.unref)(o).scrollbarXEnabled.value?`scroll`:`hidden`,overflowY:(0,t.unref)(o).scrollbarYEnabled.value?`scroll`:`hidden`}},e.$attrs,{tabindex:0}),[(0,t.createVNode)((0,t.unref)(X),{ref:(0,t.unref)(c),style:(0,t.normalizeStyle)({minWidth:(0,t.unref)(o).scrollbarXEnabled.value?`fit-content`:void 0}),"as-child":r.asChild,as:e.as},{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},8,[`style`,`as-child`,`as`])],16),(0,t.createVNode)((0,t.unref)(X),{as:`style`,nonce:(0,t.unref)(a)},{default:(0,t.withCtx)(()=>n[0]||=[(0,t.createTextVNode)(` /* Hide scrollbars cross-browser and enable momentum scroll for touch devices */ [data-reka-scroll-area-viewport] { scrollbar-width:none; -ms-overflow-style:none; -webkit-overflow-scrolling:touch; } [data-reka-scroll-area-viewport]::-webkit-scrollbar { display:none; } `)]),_:1,__:[0]},8,[`nonce`])],64))}}),Gc=[` `,`Enter`,`ArrowUp`,`ArrowDown`],Kc=[` `,`Enter`];function qc(e,t,n){return e===void 0?!1:Array.isArray(e)?e.some(e=>Jc(e,t,n)):Jc(e,t,n)}function Jc(e,t,n){return e===void 0||t===void 0?!1:typeof e==`string`?e===t:typeof n==`function`?n(e,t):typeof n==`string`?e?.[n]===t?.[n]:gr(e,t)}function Yc(e){return e==null||e===``||Array.isArray(e)&&e.length===0}var Xc={key:0,value:``},[Zc,Qc]=vr(`SelectRoot`),$c=(0,t.defineComponent)({inheritAttrs:!1,__name:`SelectRoot`,props:{open:{type:Boolean,required:!1,default:void 0},defaultOpen:{type:Boolean,required:!1},defaultValue:{type:null,required:!1},modelValue:{type:null,required:!1,default:void 0},by:{type:[String,Function],required:!1},dir:{type:String,required:!1},multiple:{type:Boolean,required:!1},autocomplete:{type:String,required:!1},disabled:{type:Boolean,required:!1},name:{type:String,required:!1},required:{type:Boolean,required:!1}},emits:[`update:modelValue`,`update:open`],setup(e,{emit:r}){let i=e,a=r,{required:o,disabled:s,multiple:c,dir:l}=(0,t.toRefs)(i),u=(0,n.useVModel)(i,`modelValue`,a,{defaultValue:i.defaultValue??(c.value?[]:void 0),passive:i.modelValue===void 0,deep:!0}),d=(0,n.useVModel)(i,`open`,a,{defaultValue:i.defaultOpen,passive:i.open===void 0}),f=(0,t.ref)(),p=(0,t.ref)(),m=(0,t.ref)({x:0,y:0}),h=(0,t.computed)(()=>c.value&&Array.isArray(u.value)?u.value?.length===0:xr(u.value));ha({isProvider:!0});let g=Hr(l),_=qr(f),v=(0,t.ref)(new Set),y=(0,t.computed)(()=>Array.from(v.value).map(e=>e.value).join(`;`));function b(e){if(c.value){let t=Array.isArray(u.value)?[...u.value]:[],n=t.findIndex(t=>Jc(t,e,i.by));n===-1?t.push(e):t.splice(n,1),u.value=[...t]}else u.value=e}function x(e){return Array.from(v.value).find(t=>qc(e,t.value,i.by))}return Qc({triggerElement:f,onTriggerChange:e=>{f.value=e},valueElement:p,onValueElementChange:e=>{p.value=e},contentId:``,modelValue:u,onValueChange:b,by:i.by,open:d,multiple:c,required:o,onOpenChange:e=>{d.value=e},dir:g,triggerPointerDownPosRef:m,disabled:s,isEmptyModelValue:h,optionsSet:v,onOptionAdd:e=>{let t=x(e.value);t&&v.value.delete(t),v.value.add(e)},onOptionRemove:e=>{let t=x(e.value);t&&v.value.delete(t)}}),(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(xa),null,{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`,{modelValue:(0,t.unref)(u),open:(0,t.unref)(d)}),(0,t.unref)(_)?((0,t.openBlock)(),(0,t.createBlock)(el,{key:y.value,"aria-hidden":`true`,tabindex:`-1`,multiple:(0,t.unref)(c),required:(0,t.unref)(o),name:e.name,autocomplete:e.autocomplete,disabled:(0,t.unref)(s),value:(0,t.unref)(u)},{default:(0,t.withCtx)(()=>[(0,t.unref)(xr)((0,t.unref)(u))?((0,t.openBlock)(),(0,t.createElementBlock)(`option`,Xc)):(0,t.createCommentVNode)(`v-if`,!0),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(Array.from(v.value),e=>((0,t.openBlock)(),(0,t.createElementBlock)(`option`,(0,t.mergeProps)({key:e.value??``},{ref_for:!0},e),null,16))),128))]),_:1},8,[`multiple`,`required`,`name`,`autocomplete`,`disabled`,`value`])):(0,t.createCommentVNode)(`v-if`,!0)]),_:3}))}}),el=(0,t.defineComponent)({__name:`BubbleSelect`,props:{autocomplete:{type:String,required:!1},autofocus:{type:Boolean,required:!1},disabled:{type:Boolean,required:!1},form:{type:String,required:!1},multiple:{type:Boolean,required:!1},name:{type:String,required:!1},required:{type:Boolean,required:!1},size:{type:Number,required:!1},value:{type:null,required:!1}},setup(e){let n=e,r=(0,t.ref)(),i=Zc();(0,t.watch)(()=>n.value,(e,t)=>{let n=window.HTMLSelectElement.prototype,i=Object.getOwnPropertyDescriptor(n,`value`).set;if(e!==t&&i&&r.value){let t=new Event(`change`,{bubbles:!0});i.call(r.value,e),r.value.dispatchEvent(t)}});function a(e){i.onValueChange(e.target.value)}return(e,i)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(ga),{"as-child":``},{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`select`,(0,t.mergeProps)({ref_key:`selectElement`,ref:r},n,{onInput:a}),[(0,t.renderSlot)(e.$slots,`default`)],16)]),_:3}))}}),tl=(0,t.defineComponent)({__name:`SelectPopperPosition`,props:{side:{type:null,required:!1},sideOffset:{type:Number,required:!1},sideFlip:{type:Boolean,required:!1},align:{type:null,required:!1,default:`start`},alignOffset:{type:Number,required:!1},alignFlip:{type:Boolean,required:!1},avoidCollisions:{type:Boolean,required:!1},collisionBoundary:{type:null,required:!1},collisionPadding:{type:[Number,Object],required:!1,default:10},arrowPadding:{type:Number,required:!1},hideShiftedArrow:{type:Boolean,required:!1},sticky:{type:String,required:!1},hideWhenDetached:{type:Boolean,required:!1},positionStrategy:{type:String,required:!1},updatePositionStrategy:{type:String,required:!1},disableUpdateOnLayoutShift:{type:Boolean,required:!1},prioritizePosition:{type:Boolean,required:!1},reference:{type:null,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let n=Jr(e);return(e,r)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Vs),(0,t.mergeProps)((0,t.unref)(n),{style:{boxSizing:`border-box`,"--reka-select-content-transform-origin":`var(--reka-popper-transform-origin)`,"--reka-select-content-available-width":`var(--reka-popper-available-width)`,"--reka-select-content-available-height":`var(--reka-popper-available-height)`,"--reka-select-trigger-width":`var(--reka-popper-anchor-width)`,"--reka-select-trigger-height":`var(--reka-popper-anchor-height)`}}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16))}}),nl={onViewportChange:()=>{},itemTextRefCallback:()=>{},itemRefCallback:()=>{}},[rl,il]=vr(`SelectContent`),al=(0,t.defineComponent)({__name:`SelectContentImpl`,props:{position:{type:String,required:!1,default:`item-aligned`},bodyLock:{type:Boolean,required:!1,default:!0},side:{type:null,required:!1},sideOffset:{type:Number,required:!1},sideFlip:{type:Boolean,required:!1},align:{type:null,required:!1,default:`start`},alignOffset:{type:Number,required:!1},alignFlip:{type:Boolean,required:!1},avoidCollisions:{type:Boolean,required:!1},collisionBoundary:{type:null,required:!1},collisionPadding:{type:[Number,Object],required:!1},arrowPadding:{type:Number,required:!1},hideShiftedArrow:{type:Boolean,required:!1},sticky:{type:String,required:!1},hideWhenDetached:{type:Boolean,required:!1},positionStrategy:{type:String,required:!1},updatePositionStrategy:{type:String,required:!1},disableUpdateOnLayoutShift:{type:Boolean,required:!1},prioritizePosition:{type:Boolean,required:!1},reference:{type:null,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},disableOutsidePointerEvents:{type:Boolean,required:!1,default:!0}},emits:[`closeAutoFocus`,`escapeKeyDown`,`pointerDownOutside`],setup(e,{emit:r}){let i=e,a=r,o=Zc();Gr(),zr(i.bodyLock);let{CollectionSlot:s,getItems:c}=ha(),l=(0,t.ref)();fi(l);let{search:u,handleTypeaheadSearch:d}=_i(),f=(0,t.ref)(),p=(0,t.ref)(),m=(0,t.ref)(),h=(0,t.ref)(!1),g=(0,t.ref)(!1),_=(0,t.ref)(!1);function v(){p.value&&l.value&&ta([p.value,l.value])}(0,t.watch)(h,()=>{v()});let{onOpenChange:y,triggerPointerDownPosRef:b}=o;(0,t.watchEffect)(e=>{if(!l.value)return;let t={x:0,y:0},n=e=>{t={x:Math.abs(Math.round(e.pageX)-(b.value?.x??0)),y:Math.abs(Math.round(e.pageY)-(b.value?.y??0))}},r=e=>{e.pointerType!==`touch`&&(t.x<=10&&t.y<=10?e.preventDefault():l.value?.contains(e.target)||y(!1),document.removeEventListener(`pointermove`,n),b.value=null)};b.value!==null&&(document.addEventListener(`pointermove`,n),document.addEventListener(`pointerup`,r,{capture:!0,once:!0})),e(()=>{document.removeEventListener(`pointermove`,n),document.removeEventListener(`pointerup`,r,{capture:!0})})});function x(e){let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&d(e.key,c()),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=[...c().map(e=>e.ref)];if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>ta(t)),e.preventDefault()}}let S=Jr((0,t.computed)(()=>i.position===`popper`?i:{}).value);return il({content:l,viewport:f,onViewportChange:e=>{f.value=e},itemRefCallback:(e,t,n)=>{let r=!g.value&&!n,i=qc(o.modelValue.value,t,o.by);if(o.multiple.value){if(_.value)return;(i||r)&&(p.value=e,i&&(_.value=!0))}else (i||r)&&(p.value=e);r&&(g.value=!0)},selectedItem:p,selectedItemText:m,onItemLeave:()=>{l.value?.focus()},itemTextRefCallback:(e,t,n)=>{let r=!g.value&&!n;(qc(o.modelValue.value,t,o.by)||r)&&(m.value=e)},focusSelectedItem:v,position:i.position,isPositioned:h,searchRef:u}),(e,r)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(s),null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(Xi),{"as-child":``,onMountAutoFocus:r[6]||=(0,t.withModifiers)(()=>{},[`prevent`]),onUnmountAutoFocus:r[7]||=e=>{a(`closeAutoFocus`,e),!e.defaultPrevented&&((0,t.unref)(o).triggerElement.value?.focus({preventScroll:!0}),e.preventDefault())}},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(Ii),{"as-child":``,"disable-outside-pointer-events":e.disableOutsidePointerEvents,onFocusOutside:r[2]||=(0,t.withModifiers)(()=>{},[`prevent`]),onDismiss:r[3]||=e=>(0,t.unref)(o).onOpenChange(!1),onEscapeKeyDown:r[4]||=e=>a(`escapeKeyDown`,e),onPointerDownOutside:r[5]||=e=>a(`pointerDownOutside`,e)},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(e.position===`popper`?tl:cl),(0,t.mergeProps)({...e.$attrs,...(0,t.unref)(S)},{id:(0,t.unref)(o).contentId,ref:e=>{let r=(0,t.unref)(n.unrefElement)(e);r?.hasAttribute(`data-reka-popper-content-wrapper`)?l.value=r.firstElementChild:l.value=r},role:`listbox`,"data-state":(0,t.unref)(o).open.value?`open`:`closed`,dir:(0,t.unref)(o).dir.value,style:{display:`flex`,flexDirection:`column`,outline:`none`},onContextmenu:r[0]||=(0,t.withModifiers)(()=>{},[`prevent`]),onPlaced:r[1]||=e=>h.value=!0,onKeydown:x}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16,[`id`,`data-state`,`dir`,`onKeydown`]))]),_:3},8,[`disable-outside-pointer-events`])]),_:3})]),_:3}))}}),[ol,sl]=vr(`SelectItemAlignedPosition`),cl=(0,t.defineComponent)({inheritAttrs:!1,__name:`SelectItemAlignedPosition`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`placed`],setup(e,{emit:r}){let i=e,a=r,{getItems:o}=ha(),s=Zc(),c=rl(),l=(0,t.ref)(!1),u=(0,t.ref)(!0),d=(0,t.ref)(),{forwardRef:f,currentElement:p}=Y(),{viewport:m,selectedItem:h,selectedItemText:g,focusSelectedItem:_}=c;function v(){if(s.triggerElement.value&&s.valueElement.value&&d.value&&p.value&&m?.value&&h?.value&&g?.value){let e=s.triggerElement.value.getBoundingClientRect(),t=p.value.getBoundingClientRect(),n=s.valueElement.value.getBoundingClientRect(),r=g.value.getBoundingClientRect();if(s.dir.value!==`rtl`){let i=r.left-t.left,a=n.left-i,o=e.left-a,s=e.width+o,c=Math.max(s,t.width),l=window.innerWidth-10,u=_r(a,10,Math.max(10,l-c));d.value.style.minWidth=`${s}px`,d.value.style.left=`${u}px`}else{let i=t.right-r.right,a=window.innerWidth-n.right-i,o=window.innerWidth-e.right-a,s=e.width+o,c=Math.max(s,t.width),l=window.innerWidth-10,u=_r(a,10,Math.max(10,l-c));d.value.style.minWidth=`${s}px`,d.value.style.right=`${u}px`}let i=o().map(e=>e.ref),c=window.innerHeight-20,u=m.value.scrollHeight,f=window.getComputedStyle(p.value),_=Number.parseInt(f.borderTopWidth,10),v=Number.parseInt(f.paddingTop,10),y=Number.parseInt(f.borderBottomWidth,10),b=Number.parseInt(f.paddingBottom,10),x=_+v+u+b+y,S=Math.min(h.value.offsetHeight*5,x),C=window.getComputedStyle(m.value),w=Number.parseInt(C.paddingTop,10),T=Number.parseInt(C.paddingBottom,10),E=e.top+e.height/2-10,ee=c-E,D=h.value.offsetHeight/2,te=h.value.offsetTop+D,O=_+v+te,ne=x-O;if(O<=E){let e=h.value===i[i.length-1];d.value.style.bottom=`0px`;let t=p.value.clientHeight-m.value.offsetTop-m.value.offsetHeight,n=O+Math.max(ee,D+(e?T:0)+t+y);d.value.style.height=`${n}px`}else{let e=h.value===i[0];d.value.style.top=`0px`;let t=Math.max(E,_+m.value.offsetTop+(e?w:0)+D)+ne;d.value.style.height=`${t}px`,m.value.scrollTop=O-E+m.value.offsetTop}d.value.style.margin=`10px 0`,d.value.style.minHeight=`${S}px`,d.value.style.maxHeight=`${c}px`,a(`placed`),requestAnimationFrame(()=>l.value=!0)}}let y=(0,t.ref)(``);(0,t.onMounted)(async()=>{await(0,t.nextTick)(),v(),p.value&&(y.value=window.getComputedStyle(p.value).zIndex)});function b(e){e&&u.value===!0&&(v(),_?.(),u.value=!1)}return(0,n.useResizeObserver)(s.triggerElement,()=>{v()}),sl({contentWrapper:d,shouldExpandOnScrollRef:l,onScrollButtonChange:b}),(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{ref_key:`contentWrapperElement`,ref:d,style:(0,t.normalizeStyle)({display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:y.value})},[(0,t.createVNode)((0,t.unref)(X),(0,t.mergeProps)({ref:(0,t.unref)(f),style:{boxSizing:`border-box`,maxHeight:`100%`}},{...e.$attrs,...i}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16)],4))}}),ll=(0,t.defineComponent)({inheritAttrs:!1,__name:`SelectProvider`,props:{context:{type:Object,required:!0}},setup(e){return Qc(e.context),il(nl),(e,n)=>(0,t.renderSlot)(e.$slots,`default`)}}),ul={key:1},dl=(0,t.defineComponent)({inheritAttrs:!1,__name:`SelectContent`,props:{forceMount:{type:Boolean,required:!1},position:{type:String,required:!1},bodyLock:{type:Boolean,required:!1},side:{type:null,required:!1},sideOffset:{type:Number,required:!1},sideFlip:{type:Boolean,required:!1},align:{type:null,required:!1},alignOffset:{type:Number,required:!1},alignFlip:{type:Boolean,required:!1},avoidCollisions:{type:Boolean,required:!1},collisionBoundary:{type:null,required:!1},collisionPadding:{type:[Number,Object],required:!1},arrowPadding:{type:Number,required:!1},hideShiftedArrow:{type:Boolean,required:!1},sticky:{type:String,required:!1},hideWhenDetached:{type:Boolean,required:!1},positionStrategy:{type:String,required:!1},updatePositionStrategy:{type:String,required:!1},disableUpdateOnLayoutShift:{type:Boolean,required:!1},prioritizePosition:{type:Boolean,required:!1},reference:{type:null,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},disableOutsidePointerEvents:{type:Boolean,required:!1}},emits:[`closeAutoFocus`,`escapeKeyDown`,`pointerDownOutside`],setup(e,{emit:n}){let r=e,i=Yr(r,n),a=Zc(),o=(0,t.ref)();(0,t.onMounted)(()=>{o.value=new DocumentFragment});let s=(0,t.ref)(),c=(0,t.computed)(()=>r.forceMount||a.open.value),l=(0,t.ref)(c.value);return(0,t.watch)(c,()=>{setTimeout(()=>l.value=c.value)}),(e,n)=>c.value||l.value||s.value?.present?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Si),{key:0,ref_key:`presenceRef`,ref:s,present:c.value},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(al,(0,t.normalizeProps)((0,t.guardReactiveProps)({...(0,t.unref)(i),...e.$attrs})),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16)]),_:3},8,[`present`])):o.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,ul,[((0,t.openBlock)(),(0,t.createBlock)(t.Teleport,{to:o.value},[(0,t.createVNode)(ll,{context:(0,t.unref)(a)},{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},8,[`context`])],8,[`to`]))])):(0,t.createCommentVNode)(`v-if`,!0)}}),[fl,pl]=vr(`SelectGroup`),ml=(0,t.defineComponent)({__name:`SelectGroup`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let n=e,r=mi(void 0,`reka-select-group`);return pl({id:r}),(e,i)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(X),(0,t.mergeProps)({role:`group`},n,{"aria-labelledby":(0,t.unref)(r)}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16,[`aria-labelledby`]))}}),hl=(0,t.defineComponent)({__name:`SelectIcon`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`span`}},setup(e){return(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(X),{"aria-hidden":`true`,as:e.as,"as-child":e.asChild},{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`,{},()=>[n[0]||=(0,t.createTextVNode)(`▼`)])]),_:3},8,[`as`,`as-child`]))}}),[gl,_l]=vr(`SelectItem`),vl=(0,t.defineComponent)({__name:`SelectItem`,props:{value:{type:null,required:!0},disabled:{type:Boolean,required:!1},textValue:{type:String,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`select`],setup(e,{emit:n}){let r=e,i=n,{disabled:a}=(0,t.toRefs)(r),o=Zc(),s=rl(),{forwardRef:c,currentElement:l}=Y(),{CollectionItem:u}=ha(),d=(0,t.computed)(()=>qc(o.modelValue?.value,r.value,o.by)),f=(0,t.ref)(!1),p=(0,t.ref)(r.textValue??``),m=mi(void 0,`reka-select-item-text`);async function h(e){e.defaultPrevented||br(`select.select`,g,{originalEvent:e,value:r.value})}async function g(e){await(0,t.nextTick)(),i(`select`,e),!e.defaultPrevented&&(a.value||(o.onValueChange(r.value),o.multiple.value||o.onOpenChange(!1)))}async function _(e){await(0,t.nextTick)(),!e.defaultPrevented&&(a.value?s.onItemLeave?.():e.currentTarget?.focus({preventScroll:!0}))}async function v(e){await(0,t.nextTick)(),!e.defaultPrevented&&e.currentTarget===yr()&&s.onItemLeave?.()}async function y(e){await(0,t.nextTick)(),!e.defaultPrevented&&(s.searchRef?.value!==``&&e.key===` `||(Kc.includes(e.key)&&h(e),e.key===` `&&e.preventDefault()))}if(r.value===``)throw Error(`A <SelectItem /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.`);return(0,t.onMounted)(()=>{l.value&&s.itemRefCallback(l.value,r.value,r.disabled)}),_l({value:r.value,disabled:a,textId:m,isSelected:d,onItemTextChange:e=>{p.value=((p.value||e?.textContent)??``).trim()}}),(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(u),{value:{textValue:p.value}},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(X),{ref:(0,t.unref)(c),role:`option`,"aria-labelledby":(0,t.unref)(m),"data-highlighted":f.value?``:void 0,"aria-selected":d.value,"data-state":d.value?`checked`:`unchecked`,"aria-disabled":(0,t.unref)(a)||void 0,"data-disabled":(0,t.unref)(a)?``:void 0,tabindex:(0,t.unref)(a)?void 0:-1,as:e.as,"as-child":e.asChild,onFocus:n[0]||=e=>f.value=!0,onBlur:n[1]||=e=>f.value=!1,onPointerup:h,onPointerdown:n[2]||=e=>{e.currentTarget.focus({preventScroll:!0})},onTouchend:n[3]||=(0,t.withModifiers)(()=>{},[`prevent`,`stop`]),onPointermove:_,onPointerleave:v,onKeydown:y},{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},8,[`aria-labelledby`,`data-highlighted`,`aria-selected`,`data-state`,`aria-disabled`,`data-disabled`,`tabindex`,`as`,`as-child`])]),_:3},8,[`value`]))}}),yl=(0,t.defineComponent)({__name:`SelectItemIndicator`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`span`}},setup(e){let n=e,r=gl();return(e,i)=>(0,t.unref)(r).isSelected.value?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(X),(0,t.mergeProps)({key:0,"aria-hidden":`true`},n),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16)):(0,t.createCommentVNode)(`v-if`,!0)}}),bl=(0,t.defineComponent)({inheritAttrs:!1,__name:`SelectItemText`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`span`}},setup(e){let n=e,r=Zc(),i=rl(),a=gl(),{forwardRef:o,currentElement:s}=Y(),c=(0,t.computed)(()=>({value:a.value,disabled:a.disabled.value,textContent:s.value?.textContent??a.value?.toString()??``}));return(0,t.onMounted)(()=>{s.value&&(a.onItemTextChange(s.value),i.itemTextRefCallback(s.value,a.value,a.disabled.value),r.onOptionAdd(c.value))}),(0,t.onUnmounted)(()=>{r.onOptionRemove(c.value)}),(e,r)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(X),(0,t.mergeProps)({id:(0,t.unref)(a).textId,ref:(0,t.unref)(o)},{...n,...e.$attrs}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16,[`id`]))}}),xl=(0,t.defineComponent)({__name:`SelectPortal`,props:{to:{type:null,required:!1},disabled:{type:Boolean,required:!1},defer:{type:Boolean,required:!1},forceMount:{type:Boolean,required:!1}},setup(e){let n=e;return(e,r)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(da),(0,t.normalizeProps)((0,t.guardReactiveProps)(n)),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16))}}),Sl=(0,t.defineComponent)({__name:`SelectScrollButtonImpl`,emits:[`autoScroll`],setup(e,{emit:n}){let r=n,{getItems:i}=ha(),a=rl(),o=(0,t.ref)(null);function s(){o.value!==null&&(window.clearInterval(o.value),o.value=null)}(0,t.watchEffect)(()=>{i().map(e=>e.ref).find(e=>e===yr())?.scrollIntoView({block:`nearest`})});function c(){o.value===null&&(o.value=window.setInterval(()=>{r(`autoScroll`)},50))}function l(){a.onItemLeave?.(),o.value===null&&(o.value=window.setInterval(()=>{r(`autoScroll`)},50))}return(0,t.onBeforeUnmount)(()=>s()),(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(X),(0,t.mergeProps)({"aria-hidden":`true`,style:{flexShrink:0}},e.$parent?.$props,{onPointerdown:c,onPointermove:l,onPointerleave:n[0]||=()=>{s()}}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16))}}),Cl=(0,t.defineComponent)({__name:`SelectScrollDownButton`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let n=rl(),r=n.position===`item-aligned`?ol():void 0,{forwardRef:i,currentElement:a}=Y(),o=(0,t.ref)(!1);return(0,t.watchEffect)(e=>{if(n.viewport?.value&&n.isPositioned?.value){let t=n.viewport.value;function r(){let e=t.scrollHeight-t.clientHeight;o.value=Math.ceil(t.scrollTop)<e}r(),t.addEventListener(`scroll`,r),e(()=>t.removeEventListener(`scroll`,r))}}),(0,t.watch)(a,()=>{a.value&&r?.onScrollButtonChange(a.value)}),(e,r)=>o.value?((0,t.openBlock)(),(0,t.createBlock)(Sl,{key:0,ref:(0,t.unref)(i),onAutoScroll:r[0]||=()=>{let{viewport:e,selectedItem:r}=(0,t.unref)(n);e?.value&&r?.value&&(e.value.scrollTop=e.value.scrollTop+r.value.offsetHeight)}},{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},512)):(0,t.createCommentVNode)(`v-if`,!0)}}),wl=(0,t.defineComponent)({__name:`SelectScrollUpButton`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let n=rl(),r=n.position===`item-aligned`?ol():void 0,{forwardRef:i,currentElement:a}=Y(),o=(0,t.ref)(!1);return(0,t.watchEffect)(e=>{if(n.viewport?.value&&n.isPositioned?.value){let t=n.viewport.value;function r(){o.value=t.scrollTop>0}r(),t.addEventListener(`scroll`,r),e(()=>t.removeEventListener(`scroll`,r))}}),(0,t.watch)(a,()=>{a.value&&r?.onScrollButtonChange(a.value)}),(e,r)=>o.value?((0,t.openBlock)(),(0,t.createBlock)(Sl,{key:0,ref:(0,t.unref)(i),onAutoScroll:r[0]||=()=>{let{viewport:e,selectedItem:r}=(0,t.unref)(n);e?.value&&r?.value&&(e.value.scrollTop=e.value.scrollTop-r.value.offsetHeight)}},{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},512)):(0,t.createCommentVNode)(`v-if`,!0)}}),Tl=(0,t.defineComponent)({__name:`SelectTrigger`,props:{disabled:{type:Boolean,required:!1},reference:{type:null,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`}},setup(e){let n=e,r=Zc(),{forwardRef:i,currentElement:a}=Y(),o=(0,t.computed)(()=>r.disabled?.value||n.disabled);r.contentId||=mi(void 0,`reka-select-content`),(0,t.onMounted)(()=>{r.onTriggerChange(a.value)});let{getItems:s}=ha(),{search:c,handleTypeaheadSearch:l,resetTypeahead:u}=_i();function d(){o.value||(r.onOpenChange(!0),u())}function f(e){d(),r.triggerPointerDownPosRef.value={x:Math.round(e.pageX),y:Math.round(e.pageY)}}return(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Sa),{"as-child":``,reference:e.reference},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(X),{ref:(0,t.unref)(i),role:`combobox`,type:e.as===`button`?`button`:void 0,"aria-controls":(0,t.unref)(r).contentId,"aria-expanded":(0,t.unref)(r).open.value||!1,"aria-required":(0,t.unref)(r).required?.value,"aria-autocomplete":`none`,disabled:o.value,dir:(0,t.unref)(r)?.dir.value,"data-state":(0,t.unref)(r)?.open.value?`open`:`closed`,"data-disabled":o.value?``:void 0,"data-placeholder":(0,t.unref)(Yc)((0,t.unref)(r).modelValue?.value)?``:void 0,"as-child":e.asChild,as:e.as,onClick:n[0]||=e=>{(e?.currentTarget)?.focus()},onPointerdown:n[1]||=e=>{if(e.pointerType===`touch`)return e.preventDefault();let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&(f(e),e.preventDefault())},onPointerup:n[2]||=(0,t.withModifiers)(e=>{e.pointerType===`touch`&&f(e)},[`prevent`]),onKeydown:n[3]||=e=>{let n=(0,t.unref)(c)!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&n&&e.key===` `||((0,t.unref)(l)(e.key,(0,t.unref)(s)()),(0,t.unref)(Gc).includes(e.key)&&(d(),e.preventDefault()))}},{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},8,[`type`,`aria-controls`,`aria-expanded`,`aria-required`,`disabled`,`dir`,`data-state`,`data-disabled`,`data-placeholder`,`as-child`,`as`])]),_:3},8,[`reference`]))}}),El=(0,t.defineComponent)({__name:`SelectValue`,props:{placeholder:{type:String,required:!1,default:``},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`span`}},setup(e){let n=e,{forwardRef:r,currentElement:i}=Y(),a=Zc();(0,t.onMounted)(()=>{a.valueElement=i});let o=(0,t.computed)(()=>{let e=[],t=Array.from(a.optionsSet.value),n=e=>t.find(t=>qc(e,t.value,a.by));return e=Array.isArray(a.modelValue.value)?a.modelValue.value.map(e=>n(e)?.textContent??``):[n(a.modelValue.value)?.textContent??``],e.filter(Boolean)}),s=(0,t.computed)(()=>o.value.length?o.value.join(`, `):n.placeholder);return(e,i)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(X),{ref:(0,t.unref)(r),as:e.as,"as-child":e.asChild,style:{pointerEvents:`none`},"data-placeholder":o.value.length?void 0:n.placeholder},{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`,{selectedLabel:o.value,modelValue:(0,t.unref)(a).modelValue.value},()=>[(0,t.createTextVNode)((0,t.toDisplayString)(s.value),1)])]),_:3},8,[`as`,`as-child`,`data-placeholder`]))}}),Dl=(0,t.defineComponent)({__name:`SelectViewport`,props:{nonce:{type:String,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let n=e,{nonce:r}=(0,t.toRefs)(n),i=Ws(r),a=rl(),o=a.position===`item-aligned`?ol():void 0,{forwardRef:s,currentElement:c}=Y();(0,t.onMounted)(()=>{a?.onViewportChange(c.value)});let l=(0,t.ref)(0);function u(e){let t=e.currentTarget,{shouldExpandOnScrollRef:n,contentWrapper:r}=o??{};if(n?.value&&r?.value){let e=Math.abs(l.value-t.scrollTop);if(e>0){let n=window.innerHeight-20,i=Number.parseFloat(r.value.style.minHeight),a=Number.parseFloat(r.value.style.height),o=Math.max(i,a);if(o<n){let i=o+e,a=Math.min(n,i),s=i-a;r.value.style.height=`${a}px`,r.value.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,r.value.style.justifyContent=`flex-end`)}}}l.value=t.scrollTop}return(e,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,null,[(0,t.createVNode)((0,t.unref)(X),(0,t.mergeProps)({ref:(0,t.unref)(s),"data-reka-select-viewport":``,role:`presentation`},{...e.$attrs,...n},{style:{position:`relative`,flex:1,overflow:`hidden auto`},onScroll:u}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16),(0,t.createVNode)((0,t.unref)(X),{as:`style`,nonce:(0,t.unref)(i)},{default:(0,t.withCtx)(()=>r[0]||=[(0,t.createTextVNode)(` /* Hide scrollbars cross-browser and enable momentum scroll for touch devices */ [data-reka-select-viewport] { scrollbar-width:none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; } [data-reka-select-viewport]::-webkit-scrollbar { display: none; } `)]),_:1,__:[0]},8,[`nonce`])],64))}}),Ol=(0,t.defineComponent)({__name:`BaseSeparator`,props:{orientation:{type:String,required:!1,default:`horizontal`},decorative:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let n=e,r=[`horizontal`,`vertical`];function i(e){return r.includes(e)}let a=(0,t.computed)(()=>i(n.orientation)?n.orientation:`horizontal`),o=(0,t.computed)(()=>a.value===`vertical`?n.orientation:void 0),s=(0,t.computed)(()=>n.decorative?{role:`none`}:{"aria-orientation":o.value,role:`separator`});return(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(X),(0,t.mergeProps)({as:e.as,"as-child":e.asChild,"data-orientation":a.value},s.value),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16,[`as`,`as-child`,`data-orientation`]))}}),kl=(0,t.defineComponent)({__name:`Separator`,props:{orientation:{type:String,required:!1,default:`horizontal`},decorative:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let n=e;return(e,r)=>((0,t.openBlock)(),(0,t.createBlock)(Ol,(0,t.normalizeProps)((0,t.guardReactiveProps)(n)),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16))}}),Al=(0,t.defineComponent)({__name:`TooltipArrow`,props:{width:{type:Number,required:!1,default:10},height:{type:Number,required:!1,default:5},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`svg`}},setup(e){let n=e;return Y(),(e,r)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Us),(0,t.normalizeProps)((0,t.guardReactiveProps)(n)),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16))}}),[jl,Ml]=vr(`TooltipProvider`),Nl=(0,t.defineComponent)({inheritAttrs:!1,__name:`TooltipProvider`,props:{delayDuration:{type:Number,required:!1,default:700},skipDelayDuration:{type:Number,required:!1,default:300},disableHoverableContent:{type:Boolean,required:!1,default:!1},disableClosingTrigger:{type:Boolean,required:!1},disabled:{type:Boolean,required:!1},ignoreNonKeyboardFocus:{type:Boolean,required:!1,default:!1},content:{type:Object,required:!1}},setup(e){let{delayDuration:n,skipDelayDuration:r,disableHoverableContent:i,disableClosingTrigger:a,ignoreNonKeyboardFocus:o,disabled:s,content:c}=(0,t.toRefs)(e);Y();let l=(0,t.ref)(!0),u=(0,t.ref)(!1),{start:d,stop:f}=Nr(()=>{l.value=!0},r,{immediate:!1});return Ml({isOpenDelayed:l,delayDuration:n,onOpen(){f(),l.value=!1},onClose(){d()},isPointerInTransitRef:u,disableHoverableContent:i,disableClosingTrigger:a,disabled:s,ignoreNonKeyboardFocus:o,content:c}),(e,n)=>(0,t.renderSlot)(e.$slots,`default`)}}),Pl=`tooltip.open`,[Fl,Il]=vr(`TooltipRoot`),Ll=(0,t.defineComponent)({__name:`TooltipRoot`,props:{defaultOpen:{type:Boolean,required:!1,default:!1},open:{type:Boolean,required:!1,default:void 0},delayDuration:{type:Number,required:!1,default:void 0},disableHoverableContent:{type:Boolean,required:!1,default:void 0},disableClosingTrigger:{type:Boolean,required:!1,default:void 0},disabled:{type:Boolean,required:!1,default:void 0},ignoreNonKeyboardFocus:{type:Boolean,required:!1,default:void 0}},emits:[`update:open`],setup(e,{emit:r}){let i=e,a=r;Y();let o=jl(),s=(0,t.computed)(()=>i.disableHoverableContent??o.disableHoverableContent.value),c=(0,t.computed)(()=>i.disableClosingTrigger??o.disableClosingTrigger.value),l=(0,t.computed)(()=>i.disabled??o.disabled.value),u=(0,t.computed)(()=>i.delayDuration??o.delayDuration.value),d=(0,t.computed)(()=>i.ignoreNonKeyboardFocus??o.ignoreNonKeyboardFocus.value),f=(0,n.useVModel)(i,`open`,a,{defaultValue:i.defaultOpen,passive:i.open===void 0});(0,t.watch)(f,e=>{o.onClose&&(e?(o.onOpen(),document.dispatchEvent(new CustomEvent(Pl))):o.onClose())});let p=(0,t.ref)(!1),m=(0,t.ref)(),h=(0,t.computed)(()=>f.value?p.value?`delayed-open`:`instant-open`:`closed`),{start:g,stop:_}=(0,n.useTimeoutFn)(()=>{p.value=!0,f.value=!0},u,{immediate:!1});function v(){_(),p.value=!1,f.value=!0}function y(){_(),f.value=!1}function b(){g()}return Il({contentId:``,open:f,stateAttribute:h,trigger:m,onTriggerChange(e){m.value=e},onTriggerEnter(){o.isOpenDelayed.value?b():v()},onTriggerLeave(){s.value?y():_()},onOpen:v,onClose:y,disableHoverableContent:s,disableClosingTrigger:c,disabled:l,ignoreNonKeyboardFocus:d}),(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(xa),null,{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`,{open:(0,t.unref)(f)})]),_:3}))}}),Rl=(0,t.defineComponent)({__name:`TooltipContentImpl`,props:{ariaLabel:{type:String,required:!1},asChild:{type:Boolean,required:!1,default:void 0},as:{type:null,required:!1},side:{type:null,required:!1},sideOffset:{type:Number,required:!1},align:{type:null,required:!1},alignOffset:{type:Number,required:!1},avoidCollisions:{type:Boolean,required:!1,default:void 0},collisionBoundary:{type:null,required:!1},collisionPadding:{type:[Number,Object],required:!1},arrowPadding:{type:Number,required:!1},sticky:{type:String,required:!1},hideWhenDetached:{type:Boolean,required:!1,default:void 0},positionStrategy:{type:String,required:!1},updatePositionStrategy:{type:String,required:!1}},emits:[`escapeKeyDown`,`pointerDownOutside`],setup(e,{emit:r}){let i=e,a=r,o=Fl(),s=jl(),{forwardRef:c,currentElement:l}=Y(),u=(0,t.computed)(()=>i.ariaLabel||l.value?.textContent),d=(0,t.computed)(()=>{let{ariaLabel:e,...t}=i;return Lr(t,s.content.value??{},{side:`top`,sideOffset:0,align:`center`,avoidCollisions:!0,collisionBoundary:[],collisionPadding:0,arrowPadding:0,sticky:`partial`,hideWhenDetached:!1})});return(0,t.onMounted)(()=>{(0,n.useEventListener)(window,`scroll`,e=>{e.target?.contains(o.trigger.value)&&o.onClose()}),(0,n.useEventListener)(window,Pl,o.onClose)}),(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Ii),{"as-child":``,"disable-outside-pointer-events":!1,onEscapeKeyDown:n[0]||=e=>a(`escapeKeyDown`,e),onPointerDownOutside:n[1]||=e=>{(0,t.unref)(o).disableClosingTrigger.value&&(0,t.unref)(o).trigger.value?.contains(e.target)&&e.preventDefault(),a(`pointerDownOutside`,e)},onFocusOutside:n[2]||=(0,t.withModifiers)(()=>{},[`prevent`]),onDismiss:n[3]||=e=>(0,t.unref)(o).onClose()},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(Vs),(0,t.mergeProps)({ref:(0,t.unref)(c),"data-state":(0,t.unref)(o).stateAttribute.value},{...e.$attrs,...d.value},{style:{"--reka-tooltip-content-transform-origin":`var(--reka-popper-transform-origin)`,"--reka-tooltip-content-available-width":`var(--reka-popper-available-width)`,"--reka-tooltip-content-available-height":`var(--reka-popper-available-height)`,"--reka-tooltip-trigger-width":`var(--reka-popper-anchor-width)`,"--reka-tooltip-trigger-height":`var(--reka-popper-anchor-height)`}}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`),(0,t.createVNode)((0,t.unref)(ga),{id:(0,t.unref)(o).contentId,role:`tooltip`},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)(u.value),1)]),_:1},8,[`id`])]),_:3},16,[`data-state`])]),_:3}))}}),zl=(0,t.defineComponent)({__name:`TooltipContentHoverable`,props:{ariaLabel:{type:String,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},side:{type:null,required:!1},sideOffset:{type:Number,required:!1},align:{type:null,required:!1},alignOffset:{type:Number,required:!1},avoidCollisions:{type:Boolean,required:!1},collisionBoundary:{type:null,required:!1},collisionPadding:{type:[Number,Object],required:!1},arrowPadding:{type:Number,required:!1},sticky:{type:String,required:!1},hideWhenDetached:{type:Boolean,required:!1},positionStrategy:{type:String,required:!1},updatePositionStrategy:{type:String,required:!1}},setup(e){let n=Jr(e),{forwardRef:r,currentElement:i}=Y(),{trigger:a,onClose:o}=Fl(),s=jl(),{isPointerInTransit:c,onPointerExit:l}=Xr(a,i);return s.isPointerInTransitRef=c,l(()=>{o()}),(e,i)=>((0,t.openBlock)(),(0,t.createBlock)(Rl,(0,t.mergeProps)({ref:(0,t.unref)(r)},(0,t.unref)(n)),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16))}}),Bl=(0,t.defineComponent)({__name:`TooltipContent`,props:{forceMount:{type:Boolean,required:!1},ariaLabel:{type:String,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},side:{type:null,required:!1},sideOffset:{type:Number,required:!1},align:{type:null,required:!1},alignOffset:{type:Number,required:!1},avoidCollisions:{type:Boolean,required:!1},collisionBoundary:{type:null,required:!1},collisionPadding:{type:[Number,Object],required:!1},arrowPadding:{type:Number,required:!1},sticky:{type:String,required:!1},hideWhenDetached:{type:Boolean,required:!1},positionStrategy:{type:String,required:!1},updatePositionStrategy:{type:String,required:!1}},emits:[`escapeKeyDown`,`pointerDownOutside`],setup(e,{emit:n}){let r=e,i=n,a=Fl(),o=Yr(r,i),{forwardRef:s}=Y();return(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Si),{present:e.forceMount||(0,t.unref)(a).open.value},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)((0,t.unref)(a).disableHoverableContent.value?Rl:zl),(0,t.mergeProps)({ref:(0,t.unref)(s)},(0,t.unref)(o)),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16))]),_:3},8,[`present`]))}}),Vl=(0,t.defineComponent)({__name:`TooltipPortal`,props:{to:{type:null,required:!1},disabled:{type:Boolean,required:!1},defer:{type:Boolean,required:!1},forceMount:{type:Boolean,required:!1}},setup(e){let n=e;return(e,r)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(da),(0,t.normalizeProps)((0,t.guardReactiveProps)(n)),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16))}}),Hl=(0,t.defineComponent)({__name:`TooltipTrigger`,props:{reference:{type:null,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`}},setup(e){let n=e,r=Fl(),i=jl();r.contentId||=mi(void 0,`reka-tooltip-content`);let{forwardRef:a,currentElement:o}=Y(),s=(0,t.ref)(!1),c=(0,t.ref)(!1),l=(0,t.computed)(()=>r.disabled.value?{}:{click:g,focus:m,pointermove:f,pointerleave:p,pointerdown:d,blur:h});(0,t.onMounted)(()=>{r.onTriggerChange(o.value)});function u(){setTimeout(()=>{s.value=!1},1)}function d(){r.open&&!r.disableClosingTrigger.value&&r.onClose(),s.value=!0,document.addEventListener(`pointerup`,u,{once:!0})}function f(e){e.pointerType!==`touch`&&!c.value&&!i.isPointerInTransitRef.value&&(r.onTriggerEnter(),c.value=!0)}function p(){r.onTriggerLeave(),c.value=!1}function m(e){s.value||r.ignoreNonKeyboardFocus.value&&!e.target.matches?.(`:focus-visible`)||r.onOpen()}function h(){r.onClose()}function g(){r.disableClosingTrigger.value||r.onClose()}return(e,i)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Sa),{"as-child":``,reference:e.reference},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(X),(0,t.mergeProps)({ref:(0,t.unref)(a),"aria-describedby":(0,t.unref)(r).open.value?(0,t.unref)(r).contentId:void 0,"data-state":(0,t.unref)(r).stateAttribute.value,as:e.as,"as-child":n.asChild,"data-grace-area-trigger":``},(0,t.toHandlers)(l.value)),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16,[`aria-describedby`,`data-state`,`as`,`as-child`])]),_:3},8,[`reference`]))}}),Q=(0,t.defineComponent)({__name:`Button`,props:{variant:{},size:{},class:{type:[Boolean,null,String,Object,Array]},asChild:{type:Boolean},as:{default:`button`}},setup(e){let n=e;return(r,i)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(X),{"data-slot":`button`,as:e.as,"as-child":e.asChild,class:(0,t.normalizeClass)((0,t.unref)(J)((0,t.unref)(Ul)({variant:e.variant,size:e.size}),n.class))},{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(r.$slots,`default`)]),_:3},8,[`as`,`as-child`,`class`]))}});let Ul=pr(`wp:inline-flex wp:items-center wp:justify-center wp:gap-2 wp:whitespace-nowrap wp:rounded-md wp:text-sm wp:font-medium wp:transition-all wp:disabled:pointer-events-none wp:disabled:opacity-50 wp:[&_svg]:pointer-events-none wp:[&_svg:not([class*='size-'])]:size-4 wp:shrink-0 wp:[&_svg]:shrink-0 wp:outline-none wp:focus-visible:border-ring wp:focus-visible:ring-ring/50 wp:focus-visible:ring-[3px] wp:aria-invalid:ring-destructive/20 wp:dark:aria-invalid:ring-destructive/40 wp:aria-invalid:border-destructive`,{variants:{variant:{default:`wp:bg-primary wp:text-primary-foreground wp:hover:bg-primary/90`,destructive:`wp:bg-destructive wp:text-white wp:hover:bg-destructive/90 wp:focus-visible:ring-destructive/20 wp:dark:focus-visible:ring-destructive/40 wp:dark:bg-destructive/60`,outline:`wp:border wp:bg-background wp:shadow-xs wp:hover:bg-accent wp:hover:text-accent-foreground wp:dark:bg-input/30 wp:dark:border-input wp:dark:hover:bg-input/50`,secondary:`wp:bg-secondary wp:text-secondary-foreground wp:hover:bg-secondary/80`,ghost:`wp:hover:bg-accent wp:hover:text-accent-foreground wp:dark:hover:bg-accent/50`,link:`wp:text-primary wp:underline-offset-4 wp:hover:underline`},size:{default:`wp:h-9 wp:px-4 wp:py-2 wp:has-[>svg]:px-3`,sm:`wp:h-8 wp:rounded-md wp:gap-1.5 wp:px-3 wp:has-[>svg]:px-2.5`,lg:`wp:h-10 wp:rounded-md wp:px-6 wp:has-[>svg]:px-4`,icon:`wp:size-9`,"icon-sm":`wp:size-8`,"icon-lg":`wp:size-10`}},defaultVariants:{variant:`default`,size:`default`}});var Wl={class:`webphone-keypad wp:grid wp:grid-cols-3 wp:gap-y-3 wp:gap-x-6 wp:px-4 wp:py-2 wp:mx-auto wp:place-items-center`},Gl=(0,t.defineComponent)({__name:`KeyPad`,setup(e){let n=(0,t.inject)(`webphone`),{sendDTMF:r}=(0,t.inject)(`sip`),{playDtmf:i}=Pt(),a=[`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`,`*`,`0`,`#`],o=e=>{i(e),n.callStatus===`connected`?r(e):n.appendKeypad(e)};return(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Wl,[((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(a,e=>(0,t.createVNode)((0,t.unref)(Q),{key:e,onClick:t=>o(e),variant:`ghost`,size:`icon`,class:`webphone-keypad__key wp:flex wp:items-center wp:justify-center wp:h-12 wp:w-full wp:rounded-xs wp:text-2xl wp:bg-neutral-100 wp:dark:bg-neutral-700 wp:hover:bg-neutral-200 wp:dark:hover:bg-neutral-600 wp:hover:text-primary wp:dark:hover:text-neutral-100 wp:text-primary wp:dark:text-white wp:transition-all wp:duration-150 wp:active:scale-95 wp:font-light montserrat`,"data-key":e},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)(e),1)]),_:2},1032,[`onClick`,`data-key`])),64))]))}}),Kl=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),ql=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),Jl=e=>{let t=ql(e);return t.charAt(0).toUpperCase()+t.slice(1)},Yl=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),Xl=e=>e===``,Zl={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":2,"stroke-linecap":`round`,"stroke-linejoin":`round`},Ql=({name:e,iconNode:n,absoluteStrokeWidth:r,"absolute-stroke-width":i,strokeWidth:a,"stroke-width":o,size:s=Zl.width,color:c=Zl.stroke,...l},{slots:u})=>(0,t.h)(`svg`,{...Zl,...l,width:s,height:s,stroke:c,"stroke-width":Xl(r)||Xl(i)||r===!0||i===!0?Number(a||o||Zl[`stroke-width`])*24/Number(s):a||o||Zl[`stroke-width`],class:Yl(`lucide`,l.class,...e?[`lucide-${Kl(Jl(e))}-icon`,`lucide-${Kl(e)}`]:[`lucide-icon`])},[...n.map(e=>(0,t.h)(...e)),...u.default?[u.default()]:[]]),$=(e,n)=>(r,{slots:i,attrs:a})=>(0,t.h)(Ql,{...a,...r,iconNode:n,name:e},i),$l=$(`building-2`,[[`path`,{d:`M10 12h4`,key:`a56b0p`}],[`path`,{d:`M10 8h4`,key:`1sr2af`}],[`path`,{d:`M14 21v-3a2 2 0 0 0-4 0v3`,key:`1rgiei`}],[`path`,{d:`M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2`,key:`secmi2`}],[`path`,{d:`M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16`,key:`16ra0t`}]]),eu=$(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),tu=$(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),nu=$(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),ru=$(`circle-user`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`10`,r:`3`,key:`ilqhr7`}],[`path`,{d:`M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662`,key:`154egf`}]]),iu=$(`mic-off`,[[`path`,{d:`M12 19v3`,key:`npa21l`}],[`path`,{d:`M15 9.34V5a3 3 0 0 0-5.68-1.33`,key:`1gzdoj`}],[`path`,{d:`M16.95 16.95A7 7 0 0 1 5 12v-2`,key:`cqa7eg`}],[`path`,{d:`M18.89 13.23A7 7 0 0 0 19 12v-2`,key:`16hl24`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M9 9v3a3 3 0 0 0 5.12 2.12`,key:`r2i35w`}]]),au=$(`mic`,[[`path`,{d:`M12 19v3`,key:`npa21l`}],[`path`,{d:`M19 10v2a7 7 0 0 1-14 0v-2`,key:`1vc78b`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`13`,rx:`3`,key:`s6n7sd`}]]),ou=$(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),su=$(`phone-incoming`,[[`path`,{d:`M16 2v6h6`,key:`1mfrl5`}],[`path`,{d:`m22 2-6 6`,key:`6f0sa0`}],[`path`,{d:`M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384`,key:`9njp5v`}]]),cu=$(`phone-missed`,[[`path`,{d:`m16 2 6 6`,key:`1gw87d`}],[`path`,{d:`m22 2-6 6`,key:`6f0sa0`}],[`path`,{d:`M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384`,key:`9njp5v`}]]),lu=$(`phone-outgoing`,[[`path`,{d:`m16 8 6-6`,key:`oawc05`}],[`path`,{d:`M22 8V2h-6`,key:`oqy2zc`}],[`path`,{d:`M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384`,key:`9njp5v`}]]),uu=$(`phone`,[[`path`,{d:`M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384`,key:`9njp5v`}]]),du=$(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),fu=$(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),pu=$(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),mu=$(`video`,[[`path`,{d:`m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5`,key:`ftymec`}],[`rect`,{x:`2`,y:`6`,width:`14`,height:`12`,rx:`2`,key:`158x01`}]]),hu=$(`voicemail`,[[`circle`,{cx:`6`,cy:`12`,r:`4`,key:`1ehtga`}],[`circle`,{cx:`18`,cy:`12`,r:`4`,key:`4vafl8`}],[`line`,{x1:`6`,x2:`18`,y1:`16`,y2:`16`,key:`pmt8us`}]]),gu=$(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),_u=$(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),vu=`data:image/svg+xml,%3csvg%20viewBox='0%200%2014%2014'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23a)'%3e%3cpath%20d='m1.913%207.003.035.49c0%20.605.49%201.095%201.095%201.095.015%200%201.08-.14%201.08-.14a1.1%201.1%200%200%200%201.07-1.07l.075-.655c1.192-.463%202.33-.465%203.47-.005l.072.657c.01.585.485%201.06%201.07%201.07%200%200%201.065.14%201.08.14.605%200%201.095-.49%201.095-1.07l.038-.537c0-.575-.23-1.12-.65-1.54-1.91-1.91-6.973-1.908-8.88%200-.418.417-.65.965-.648%201.562zM10.94%205.94c.285.285.443.653.44%201.015l-.037.538a.39.39%200%200%201-.368.387s-1.057-.137-1.072-.137a.4.4%200%200%201-.388-.388c0-.015-.1-.92-.1-.92a.35.35%200%200%200-.207-.282c-1.43-.64-2.913-.643-4.408-.003a.36.36%200%200%200-.212.288s-.103.907-.103.917a.386.386%200%200%201-.387.388c-.015%200-1.073.137-1.073.137a.395.395%200%200%201-.37-.41l-.035-.49c0-.385.155-.755.44-1.04%201.74-1.74%206.383-1.497%207.88%200'%20fill='currentColor'/%3e%3c/g%3e%3ccircle%20cx='7'%20cy='7'%20r='6.6'%20stroke='currentColor'%20stroke-width='.8'/%3e%3cdefs%3e%3cclipPath%20id='a'%3e%3cpath%20fill='%23fff'%20d='M7%2013%201%207l6-6%206%206z'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e`,yu=`data:image/svg+xml,%3csvg%20viewBox='0%200%209%209'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23a)'%3e%3cpath%20d='M0%208.625V6a3.38%203.38%200%200%201%203.375-3.375h1.811V2.03a.75.75%200%200%201%201.28-.53l2.206%202.205a1.125%201.125%200%200%201%200%201.59L6.466%207.5a.75.75%200%200%201-1.28-.53v-.595H3a2.25%202.25%200%200%200-2.25%202.25.375.375%200%200%201-.75%200M5.936%203a.375.375%200%200%201-.375.375H3.375A2.63%202.63%200%200%200%20.75%206v.643A3%203%200%200%201%203%205.625h2.561A.375.375%200%200%201%205.936%206v.97l2.205-2.205a.375.375%200%200%200%200-.53L5.936%202.03z'%20fill='currentColor'/%3e%3c/g%3e%3cdefs%3e%3cclipPath%20id='a'%3e%3cpath%20fill='%23fff'%20d='M0%200h9v9H0z'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e`,bu=`data:image/svg+xml,%3csvg%20viewBox='0%200%2020%2020'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23a)'%3e%3cpath%20d='m13.499%2013.495.321-.371a1.095%201.095%200%200%200%200-1.549c-.01-.01-.862-.665-.862-.665a1.1%201.1%200%200%200-1.514%200l-.516.41c-1.17-.516-1.976-1.318-2.457-2.45l.414-.516a1.09%201.09%200%200%200%200-1.513s-.654-.852-.665-.863c-.428-.427-1.12-.427-1.53-.017l-.407.353c-.407.407-.63.955-.63%201.549%200%202.701%203.582%206.279%206.28%206.279.59%200%201.141-.223%201.562-.647zM6.364%207.863c0-.403.148-.774.406-1.029l.407-.354a.39.39%200%200%201%20.534-.014s.65.845.661.856a.4.4%200%200%201%200%20.548c-.01.01-.58.721-.58.721a.35.35%200%200%200-.053.347c.559%201.463%201.605%202.513%203.115%203.118a.36.36%200%200%200%20.354-.053l.72-.576a.386.386%200%200%201%20.549%200c.01.01.855.66.855.66a.395.395%200%200%201-.028.552l-.322.372a1.47%201.47%200%200%201-1.046.424c-2.46%200-5.572-3.454-5.572-5.572'%20fill='currentColor'/%3e%3c/g%3e%3ccircle%20cx='9.899'%20cy='9.899'%20r='6.6'%20transform='rotate(-135%209.9%209.9)'%20stroke='currentColor'%20stroke-width='.8'/%3e%3cdefs%3e%3cclipPath%20id='a'%3e%3cpath%20fill='%23fff'%20d='M14.143%205.657v8.485H5.658V5.657z'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e`,xu=`data:image/svg+xml,%3csvg%20viewBox='2.8%202.8%2014.2%2014.2'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3ccircle%20cx='9.899'%20cy='9.899'%20r='6.6'%20transform='rotate(-135%209.9%209.9)'%20stroke='currentColor'%20stroke-width='.8'/%3e%3cpath%20d='M13.634%208.18a.66.66%200%200%200-.729.094l-.585.591a1.663%201.663%200%200%200-1.653-1.531h-3C6.747%207.334%206%208.08%206%209v2a1.67%201.67%200%200%200%201.667%201.667h3c.876%200%201.589-.683%201.654-1.543l.585.585.036.03a.66.66%200%200%200%20.692.063.66.66%200%200%200%20.366-.591V8.77a.66.66%200%200%200-.366-.592M10.667%2012h-3c-.552%200-1-.449-1-1V9c0-.551.448-1%201-1h3c.551%200%201%20.449%201%201v2c0%20.551-.449%201-1%201m1.666-1.806v-.396l1-1.01.009%202.413z'%20fill='currentColor'/%3e%3c/svg%3e`,Su=[`data-call-status`],Cu={key:0,class:`webphone-actions__idle wp:!w-full wp:flex wp:flex-col wp:items-center wp:space-y-2 wp:mb-4`},wu={key:2,class:`webphone-actions__connected wp:w-full wp:flex wp:flex-col wp:items-center wp:gap-3`},Tu={class:`webphone-actions__row wp:flex wp:items-center wp:gap-6`},Eu={key:4,class:`webphone-actions__transfer-state wp:absolute wp:inset-x-0 wp:bottom-full wp:mb-2 wp:flex wp:justify-center wp:gap-2`},Du=(0,t.defineComponent)({__name:`CallActions`,props:{destination:{},isVideo:{type:Boolean}},emits:[`transfer`,`completeTransfer`,`cancelTransfer`],setup(e,{emit:n}){let r=(0,t.inject)(`webphone`),{makeCall:i,hangupCall:a,answerCall:o,toggleMute:s,toggleHold:c}=(0,t.inject)(`sip`),l=e,u=n,d=(0,t.computed)(()=>!!r.transferInProgress),f=(0,t.computed)(()=>l.destination||r.keypadValue||r.lastDialedNumber||``),p=(0,t.computed)(()=>l.isVideo?f.value?/^[0-9*#]{1,5}$/.test(f.value):!0:!1),m=async e=>{try{l.destination?await i(l.destination,e):r.keypadValue?await i(r.keypadValue,e):r.lastDialedNumber&&(r.keypadValue=r.lastDialedNumber)}catch(t){if(console.error(`Error initiating call:`,t),e){let e=`No se pudo acceder a la cámara.`,n=t instanceof Error?t.name:String(t);n===`NotReadableError`?e=`La cámara parece estar en uso por otra aplicación (ej: Zoom, Meet) o no se puede acceder al hardware.`:n===`NotAllowedError`||n===`PermissionDeniedError`?e=`Permiso de cámara denegado. Por favor, permita el acceso a la cámara.`:n===`NotFoundError`?e=`No se detectó ninguna cámara en el sistema.`:e+=` `+(t instanceof Error?t.message:String(t)),confirm(`${e}\n\n¿Desea realizar la llamada solo con AUDIO?`)&&m(!1)}else alert(`Error al iniciar la llamada: `+(t instanceof Error?t.message:String(t)))}},h=(e=!1)=>{o(e)},g=(0,t.computed)(()=>{let e={};return r.channels.forEach(t=>{let n=t.status===`connected`||t.status===`calling`||t.status===`incoming`;e[t.id]=n?`wp:text-[var(--color-red)]`:`wp:text-[var(--color-avaible)]`}),e}),_=(0,t.computed)(()=>g.value[r.activeChannelId]??`wp:text-[var(--p-primary-color)]`);return(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:`webphone-actions wp:flex wp:justify-center wp:items-center wp:gap-2 wp:px-4 wp:relative wp:mb-4`,"data-call-status":(0,t.unref)(r).callStatus},[(0,t.unref)(r).callStatus===`idle`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Cu,[(0,t.createVNode)((0,t.unref)(Q),{variant:`default`,size:`icon`,onClick:n[0]||=e=>m(!1),disabled:!l.destination&&(!(0,t.unref)(r).keypadValue||!/^[+]?[0-9*#]+$/.test((0,t.unref)(r).keypadValue))&&!(0,t.unref)(r).lastDialedNumber,"aria-label":`Audio Call`,class:`webphone-actions__button webphone-actions__button--call wp:w-full wp:px-4 wp:border-0 wp:bg-gradient-to-r wp:from-[color:var(--p-primary-color)]/80 wp:to-[color:var(--p-primary-color)]/100 wp:hover:from-[color:var(--p-primary-color)]/75 wp:hover:to-[color:var(--p-primary-color)]`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(bu),{class:`webphone-actions__button-icon wp:size-8 wp:text-white`}),n[7]||=(0,t.createElementVNode)(`span`,{class:`webphone-actions__button-label wp:w-full wp:text-white`},`Llamar`,-1)]),_:1},8,[`disabled`]),p.value?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Q),{key:0,variant:`outline`,size:`icon`,onClick:n[1]||=e=>m(!0),disabled:!l.destination&&(!(0,t.unref)(r).keypadValue||!/^[+]?[0-9*#]+$/.test((0,t.unref)(r).keypadValue))&&!(0,t.unref)(r).lastDialedNumber,"aria-label":`Video Call`,class:`webphone-actions__button webphone-actions__button--video wp:w-full wp:px-4 wp:bg-transparent wp:border wp:border-primary wp:hover:bg-[var(--p-primary-color)]/8`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(xu),{class:(0,t.normalizeClass)([`webphone-actions__button-icon wp:size-6 wp:text-primary`,_.value])},null,8,[`class`]),n[8]||=(0,t.createElementVNode)(`span`,{class:`webphone-actions__button-label wp:w-full wp:text-primary`},` Video llamada a extensiones `,-1)]),_:1},8,[`disabled`])):(0,t.createCommentVNode)(``,!0)])):(0,t.createCommentVNode)(``,!0),(0,t.unref)(r).callStatus===`incoming`?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:1},[(0,t.unref)(r).activeChannel?.hasVideo?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Q),{key:0,variant:`default`,size:`icon`,onClick:n[2]||=e=>h(!0),class:`webphone-actions__button webphone-actions__button--answer-video wp:animate-pulse wp:w-12 wp:h-12 wp:rounded-full wp:bg-transparent wp:hover:bg-[var(--p-primary-color)]/10`,"aria-label":`Answer Video`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(mu),{class:`webphone-actions__button-icon wp:w-5 wp:h-5 wp:text-[var(--p-primary-color)]`})]),_:1})):(0,t.createCommentVNode)(``,!0),(0,t.createVNode)((0,t.unref)(Q),{variant:`default`,size:`icon`,onClick:n[3]||=e=>h(!1),class:`webphone-actions__button webphone-actions__button--answer wp:animate-pulse wp:w-12 wp:h-12 wp:rounded-full wp:bg-transparent wp:hover:bg-[var(--p-primary-color)]/10`,"aria-label":`Answer`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(uu),{class:`webphone-actions__button-icon wp:w-5 wp:h-5 wp:text-[var(--p-primary-color)]`})]),_:1}),(0,t.createVNode)((0,t.unref)(Q),{variant:`destructive`,size:`icon`,onClick:(0,t.unref)(a),"aria-label":`Reject`,class:`webphone-actions__button webphone-actions__button--hangup webphone-actions__button--reject wp:w-12 wp:h-12 wp:rounded-full wp:border-0 wp:bg-gradient-to-r wp:from-destructive/60 wp:to-destructive/90 wp:hover:from-destructive/70 wp:hover:to-destructive/95`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(vu),{class:`webphone-actions__button-icon wp:w-5 wp:h-5 wp:text-white`})]),_:1},8,[`onClick`])],64)):(0,t.createCommentVNode)(``,!0),(0,t.unref)(r).callStatus===`connected`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,wu,[(0,t.createElementVNode)(`div`,Tu,[(0,t.createVNode)((0,t.unref)(Q),{variant:(0,t.unref)(r).isMuted?`destructive`:`secondary`,size:`icon`,onClick:(0,t.unref)(s),"aria-label":`Mute`,class:`webphone-actions__button webphone-actions__button--mute wp:w-12 wp:h-12 wp:rounded-full wp:bg-primary/10 wp:hover:bg-[var(--p-primary-color)]/20`},{default:(0,t.withCtx)(()=>[(0,t.unref)(r).isMuted?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(iu),{key:0,class:`webphone-actions__button-icon wp:size-5 wp:text-status-disconnected`})):((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(au),{key:1,class:`webphone-actions__button-icon wp:size-5 wp:text-[var(--p-primary-color)]`}))]),_:1},8,[`variant`,`onClick`]),(0,t.createVNode)((0,t.unref)(Q),{variant:((0,t.unref)(r).isHeld,`secondary`),size:`icon`,onClick:(0,t.unref)(c),"aria-label":`Hold`,class:`webphone-actions__button webphone-actions__button--hold wp:w-12 wp:h-12 wp:rounded-full wp:bg-primary/10 wp:hover:bg-[var(--p-primary-color)]/20`},{default:(0,t.withCtx)(()=>[(0,t.unref)(r).isHeld?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(du),{key:0,class:`webphone-actions__button-icon wp:size-5 wp:text-status-hold`})):((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(ou),{key:1,class:`webphone-actions__button-icon wp:size-5 wp:text-[var(--p-primary-color)]`}))]),_:1},8,[`variant`,`onClick`]),d.value?(0,t.createCommentVNode)(``,!0):((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Q),{key:0,variant:`secondary`,size:`icon`,onClick:n[4]||=e=>u(`transfer`),"aria-label":`Transfer`,class:`webphone-actions__button webphone-actions__button--transfer wp:w-12 wp:h-12 wp:rounded-full wp:bg-primary/10 wp:hover:bg-[var(--p-primary-color)]/20`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(yu),{class:`webphone-actions__button-icon wp:size-5 wp:text-[var(--p-primary-color)]`})]),_:1}))]),(0,t.createVNode)((0,t.unref)(Q),{size:`icon`,onClick:(0,t.unref)(a),"aria-label":`Hangup`,class:`webphone-actions__button webphone-actions__button--hangup wp:w-full wp:px-4 wp:border-0 wp:bg-gradient-to-r wp:from-destructive/60 wp:to-destructive/90 wp:hover:from-destructive/70 wp:hover:to-destructive/95`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(vu),{class:`webphone-actions__button-icon wp:size-6 wp:text-white`}),n[9]||=(0,t.createElementVNode)(`span`,{class:`webphone-actions__button-label wp:w-full wp:text-white`},`Colgar`,-1)]),_:1},8,[`onClick`])])):(0,t.createCommentVNode)(``,!0),(0,t.unref)(r).callStatus===`calling`?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Q),{key:3,variant:`destructive`,size:`lg`,onClick:(0,t.unref)(a),"aria-label":`Cancel`,class:`webphone-actions__button webphone-actions__button--hangup webphone-actions__button--cancel wp:w-full wp:px-4 wp:border-0 wp:bg-gradient-to-r wp:from-destructive/60 wp:to-destructive/90 wp:hover:from-destructive/70 wp:hover:to-destructive/95`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(vu),{class:`webphone-actions__button-icon wp:size-6 wp:text-white`}),n[10]||=(0,t.createElementVNode)(`span`,{class:`webphone-actions__button-label wp:w-full wp:text-white`},`Colgar`,-1)]),_:1},8,[`onClick`])):(0,t.createCommentVNode)(``,!0),d.value&&(0,t.unref)(r).callStatus===`connected`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Eu,[(0,t.createVNode)((0,t.unref)(Q),{variant:`default`,size:`sm`,onClick:n[5]||=e=>u(`completeTransfer`),class:`webphone-actions__button webphone-actions__button--complete-transfer wp:gap-2 wp:bg-status-available wp:hover:bg-status-available/90 wp:text-white`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(eu),{class:`wp:w-4 wp:h-4`}),n[11]||=(0,t.createTextVNode)(` Completar Transferencia `,-1)]),_:1}),(0,t.createVNode)((0,t.unref)(Q),{variant:`destructive`,size:`sm`,onClick:n[6]||=e=>u(`cancelTransfer`),class:`webphone-actions__button webphone-actions__button--cancel-transfer wp:gap-2`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(_u),{class:`wp:w-4 wp:h-4`}),n[12]||=(0,t.createTextVNode)(` Cancelar `,-1)]),_:1})])):(0,t.createCommentVNode)(``,!0)],8,Su))}}),Ou=(0,t.defineComponent)({__name:`Input`,props:{defaultValue:{},modelValue:{},class:{type:[Boolean,null,String,Object,Array]}},emits:[`update:modelValue`],setup(e,{emit:r}){let i=e,a=(0,n.useVModel)(i,`modelValue`,r,{passive:!0,defaultValue:i.defaultValue});return(e,n)=>(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`input`,{"onUpdate:modelValue":n[0]||=e=>(0,t.isRef)(a)?a.value=e:null,"data-slot":`input`,class:(0,t.normalizeClass)((0,t.unref)(J)(`wp:file:text-foreground wp:placeholder:text-muted-foreground wp:selection:bg-primary wp:selection:text-primary-foreground wp:dark:bg-input/30 wp:border-blue-500 wp:h-9 wp:w-full wp:min-w-0 wp:rounded-md wp:border wp:bg-transparent wp:px-3 wp:py-1 wp:text-base wp:shadow-xs wp:transition-[color,box-shadow] wp:outline-none wp:file:inline-flex wp:file:h-7 wp:file:border-0 wp:file:bg-transparent wp:file:text-sm wp:file:font-medium wp:disabled:pointer-events-none wp:disabled:cursor-not-allowed wp:disabled:opacity-50 wp:md:text-sm`,`wp:focus-visible:border-ring wp:focus-visible:ring-ring/50 wp:focus-visible:ring-[3px]`,`wp:aria-invalid:ring-destructive/20 wp:dark:aria-invalid:ring-destructive/40 wp:aria-invalid:border-destructive`,i.class))},null,2)),[[t.vModelText,(0,t.unref)(a)]])}}),ku=(0,t.defineComponent)({__name:`Kbd`,props:{class:{type:[Boolean,null,String,Object,Array]}},setup(e){let n=e;return(e,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`kbd`,{class:(0,t.normalizeClass)((0,t.unref)(J)(`wp:bg-muted wp:text-muted-foreground wp:pointer-events-none wp:inline-flex wp:h-5 wp:w-fit wp:min-w-5 wp:items-center wp:justify-center wp:gap-1 wp:rounded-sm wp:px-1 wp:font-sans wp:text-xs wp:font-medium wp:select-none`,`wp:[&_svg:not([class*='size-'])]:size-3`,`wp:[[data-slot=tooltip-content]_&]:bg-background/20 wp:[[data-slot=tooltip-content]_&]:text-background wp:dark:[[data-slot=tooltip-content]_&]:bg-background/10`,n.class))},[(0,t.renderSlot)(e.$slots,`default`)],2))}}),Au=`data:image/svg+xml,%3csvg%20viewBox='0%200%2019%2019'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M3.91%205.867a1.7%201.7%200%200%201-.946-.248%201.9%201.9%200%200%201-.606-.594l-.117-.223a1.93%201.93%200%200%201%20.07-1.722q.077-.143.18-.264a1.8%201.8%200%200%201%20.33-.322q.063-.048.13-.086c.05-.03.093-.052.145-.079a1.75%201.75%200%200%201%201.653.07l.07.044c.244.162.446.383.59.645a1.92%201.92%200%200%201%20.003%201.847%202%202%200%200%201-.183.27c-.02.026-.029.038-.05.062q-.134.147-.293.264a1.7%201.7%200%200%201-.983.336zM1.88%203.923c-.017.333.048.665.188.965.027.055.048.104.075.156l.145.223c.19.26.44.468.725.606a1.92%201.92%200%200%200%201.688%200c.053-.028.1-.05.15-.078.35-.209.63-.525.8-.905a2.14%202.14%200%200%200-.276-2.205L5.2%202.494c-.03-.023-.037-.036-.064-.057a1.94%201.94%200%200%200-1.212-.483%201.8%201.8%200%200%200-.908.196c-.419.2-.755.55-.948.985a2%202%200%200%200-.188.79zm7.442%201.944a1.7%201.7%200%200%201-.942-.248%201.9%201.9%200%200%201-.606-.595L7.657%204.8a1.93%201.93%200%200%201%20.071-1.722q.076-.142.18-.264a1.8%201.8%200%200%201%20.33-.321q.062-.048.13-.086a1.75%201.75%200%200%201%201.798-.008l.076.043c.243.163.445.384.588.645a1.92%201.92%200%200%201-.001%201.847%202%202%200%200%201-.183.27c-.02.026-.029.039-.05.063a2%202%200%200%201-.29.264%201.73%201.73%200%200%201-.984.336zM7.296%203.923c-.017.333.048.665.188.965.027.055.047.104.075.156l.144.223c.192.26.44.468.726.606a1.92%201.92%200%200%200%201.688%200c.053-.028.1-.05.15-.078.35-.208.63-.524.802-.905a2.14%202.14%200%200%200-.278-2.205l-.173-.191c-.031-.024-.037-.037-.064-.058a1.94%201.94%200%200%200-1.214-.482%201.8%201.8%200%200%200-.908.196c-.419.2-.755.55-.948.985a2%202%200%200%200-.188.79zm7.442%201.944a1.7%201.7%200%200%201-.944-.248%201.9%201.9%200%200%201-.602-.594l-.117-.223a1.93%201.93%200%200%201%20.072-1.722q.075-.141.18-.263a1.8%201.8%200%200%201%20.326-.323q.062-.048.13-.086c.05-.03.093-.052.144-.079a1.75%201.75%200%200%201%201.654.07l.07.044c.242.163.444.384.587.645a1.93%201.93%200%200%201%200%201.847%202%202%200%200%201-.184.27c-.02.026-.028.039-.05.063a2%202%200%200%201-.29.264%201.7%201.7%200%200%201-.983.336zM12.71%203.923c-.017.333.048.665.188.965.027.055.048.104.076.156l.144.223a1.97%201.97%200%200%200%201.569.802c.292%200%20.58-.067.844-.196.053-.028.1-.05.15-.078a2%202%200%200%200%20.795-.904%202.14%202.14%200%200%200-.27-2.206l-.175-.191c-.031-.024-.037-.037-.064-.058a1.94%201.94%200%200%200-1.213-.482%201.8%201.8%200%200%200-.908.196c-.419.2-.755.55-.948.985a2%202%200%200%200-.187.79zm-8.8%207.281a1.7%201.7%200%200%201-.942-.246%201.9%201.9%200%200%201-.606-.595l-.121-.224a1.93%201.93%200%200%201%20.071-1.722q.077-.142.18-.263a1.8%201.8%200%200%201%20.464-.407%201.75%201.75%200%200%201%201.798-.008l.07.043c.242.163.444.384.587.645a1.92%201.92%200%200%201-.001%201.847%202%202%200%200%201-.183.27c-.02.026-.029.039-.05.063a2%202%200%200%201-.29.263%201.7%201.7%200%200%201-.984.337zM1.88%209.261c-.017.333.048.664.188.964.027.056.048.105.075.156l.145.223c.19.26.44.468.725.606a1.92%201.92%200%200%200%201.688%200c.053-.028.1-.049.15-.078.348-.209.626-.525.795-.904a2.14%202.14%200%200%200-.276-2.205l-.175-.19c-.03-.024-.037-.037-.064-.058a1.94%201.94%200%200%200-1.207-.483%201.8%201.8%200%200%200-.908.195c-.419.2-.755.55-.948.985a2%202%200%200%200-.188.791zm7.442%201.943a1.7%201.7%200%200%201-.941-.246%201.9%201.9%200%200%201-.606-.595l-.117-.223a1.93%201.93%200%200%201%20.071-1.722q.075-.143.18-.264a1.8%201.8%200%200%201%20.463-.407c.05-.03.093-.051.145-.078a1.74%201.74%200%200%201%201.653.07l.07.043c.243.163.444.385.588.646a1.93%201.93%200%200%201-.001%201.847%202%202%200%200%201-.184.27c-.02.026-.028.039-.05.063a2%202%200%200%201-.29.263c-.288.212-.63.33-.983.337zM7.293%209.261c-.017.333.048.664.188.964.027.056.047.105.075.156l.145.223c.19.26.44.468.725.606a1.92%201.92%200%200%200%201.688%200c.053-.028.1-.049.15-.078.352-.207.633-.524.805-.905a2.14%202.14%200%200%200-.276-2.205l-.175-.19c-.031-.024-.037-.037-.064-.058a1.94%201.94%200%200%200-1.214-.482%201.8%201.8%200%200%200-.908.195c-.419.2-.755.55-.948.985a2%202%200%200%200-.188.791zm7.445%201.944a1.7%201.7%200%200%201-.944-.246%201.9%201.9%200%200%201-.606-.596l-.117-.222a1.93%201.93%200%200%201%20.071-1.723q.075-.141.18-.263a1.8%201.8%200%200%201%20.463-.407%201.74%201.74%200%200%201%201.798-.008l.07.043c.243.163.444.384.588.646a1.92%201.92%200%200%201-.001%201.847%202%202%200%200%201-.184.27c-.02.026-.028.038-.05.063a2%202%200%200%201-.29.263c-.288.212-.63.329-.983.337zm-2.03-1.943c-.017.332.048.664.188.964.027.055.048.104.075.156l.145.223a1.97%201.97%200%200%200%201.569.802c.292%200%20.58-.067.844-.196.053-.028.1-.05.15-.078a2%202%200%200%200%20.795-.904%202.14%202.14%200%200%200-.276-2.205l-.175-.19c-.03-.024-.037-.037-.064-.059a1.94%201.94%200%200%200-1.211-.482%201.8%201.8%200%200%200-.909.196c-.418.2-.754.55-.947.985a2%202%200%200%200-.188.79zM3.91%2016.543a1.7%201.7%200%200%201-.942-.246%201.9%201.9%200%200%201-.606-.596l-.121-.223a1.93%201.93%200%200%201%20.071-1.723q.077-.141.18-.263a1.8%201.8%200%200%201%20.464-.407%201.75%201.75%200%200%201%201.798-.008l.07.043c.242.163.444.385.587.646a1.92%201.92%200%200%201-.001%201.847%202%202%200%200%201-.183.27l-.05.063a2%202%200%200%201-.29.26%201.7%201.7%200%200%201-.984.337zm-2.03-1.944c-.017.333.048.665.188.965.027.055.048.104.075.156l.145.223c.19.26.44.468.725.606a1.92%201.92%200%200%200%201.688%200c.053-.028.1-.05.15-.078a2%202%200%200%200%20.795-.904%202.14%202.14%200%200%200-.276-2.205l-.175-.191c-.03-.023-.037-.037-.064-.058a1.94%201.94%200%200%200-1.207-.483%201.8%201.8%200%200%200-.908.196c-.419.2-.755.55-.948.985a2%202%200%200%200-.188.79zm7.442%201.944a1.7%201.7%200%200%201-.941-.246%201.9%201.9%200%200%201-.606-.596l-.117-.223a1.93%201.93%200%200%201%20.071-1.722q.075-.141.18-.263a1.8%201.8%200%200%201%20.463-.407%201.75%201.75%200%200%201%201.797-.008l.07.043c.244.163.445.384.589.645a1.93%201.93%200%200%201-.001%201.848%202%202%200%200%201-.184.27c-.02.026-.028.038-.05.062a2%202%200%200%201-.29.264c-.288.212-.63.329-.983.337zm-2.029-1.944c-.017.333.048.665.188.965.027.055.047.104.075.156l.145.223c.19.26.44.468.725.606a1.92%201.92%200%200%200%201.688%200c.053-.028.1-.05.15-.078.352-.208.633-.524.805-.905a2.14%202.14%200%200%200-.276-2.205l-.175-.19c-.031-.024-.037-.037-.064-.059a1.94%201.94%200%200%200-1.214-.482%201.8%201.8%200%200%200-.908.196c-.419.2-.755.55-.948.985a2%202%200%200%200-.188.79zm7.445%201.944a1.7%201.7%200%200%201-.944-.246%201.9%201.9%200%200%201-.606-.595l-.117-.223a1.93%201.93%200%200%201%20.071-1.722q.075-.141.18-.263a1.8%201.8%200%200%201%20.463-.407c.05-.03.093-.052.145-.079a1.74%201.74%200%200%201%201.653.07l.07.044c.243.163.444.384.588.645a1.92%201.92%200%200%201-.001%201.847%202%202%200%200%201-.184.27c-.02.026-.028.039-.05.063a2%202%200%200%201-.29.264%201.7%201.7%200%200%201-.983.336zm-2.03-1.943c-.017.333.048.665.188.964.027.056.048.105.075.157l.145.222a1.97%201.97%200%200%200%201.569.803c.292%200%20.58-.067.844-.196.053-.029.1-.05.15-.079a2%202%200%200%200%20.795-.904%202.14%202.14%200%200%200-.276-2.205l-.175-.19c-.03-.024-.037-.037-.064-.058a1.94%201.94%200%200%200-1.211-.482%201.8%201.8%200%200%200-.909.195c-.418.2-.754.55-.947.986a2%202%200%200%200-.188.79z'%20fill='currentColor'%20stroke='currentColor'%20stroke-width='.5'/%3e%3c/svg%3e`,ju=`data:image/svg+xml,%3csvg%20viewBox='0%200%2019%2019'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M3.91%205.867a1.7%201.7%200%200%201-.946-.248%201.9%201.9%200%200%201-.606-.594l-.117-.223a1.93%201.93%200%200%201%20.07-1.722q.077-.143.18-.264a1.8%201.8%200%200%201%20.33-.322q.063-.048.13-.086c.05-.03.093-.052.145-.079a1.75%201.75%200%200%201%201.653.07l.07.044c.244.162.446.383.59.645a1.92%201.92%200%200%201%20.003%201.847%202%202%200%200%201-.183.27c-.02.026-.029.038-.05.062q-.134.147-.293.264a1.7%201.7%200%200%201-.983.336zM1.88%203.923c-.017.333.048.665.188.965.027.055.048.104.075.156l.145.223c.19.26.44.468.725.606a1.92%201.92%200%200%200%201.688%200c.053-.028.1-.05.15-.078.35-.209.63-.525.8-.905a2.14%202.14%200%200%200-.276-2.205L5.2%202.494c-.03-.023-.037-.036-.064-.057a1.94%201.94%200%200%200-1.212-.483%201.8%201.8%200%200%200-.908.196c-.419.2-.755.55-.948.985a2%202%200%200%200-.188.79zm7.442%201.944a1.7%201.7%200%200%201-.942-.248%201.9%201.9%200%200%201-.606-.595L7.657%204.8a1.93%201.93%200%200%201%20.071-1.722q.077-.142.18-.264a1.8%201.8%200%200%201%20.33-.321q.062-.048.13-.086a1.75%201.75%200%200%201%201.798-.008l.076.043c.243.163.445.384.588.645a1.93%201.93%200%200%201-.001%201.847%202%202%200%200%201-.183.27c-.02.026-.029.039-.05.063a2%202%200%200%201-.29.264%201.73%201.73%200%200%201-.984.336zM7.296%203.923c-.017.333.048.665.188.965.027.055.047.104.075.156l.145.223c.19.26.44.468.725.606a1.92%201.92%200%200%200%201.688%200c.053-.028.1-.05.15-.078.35-.208.63-.524.802-.905a2.14%202.14%200%200%200-.278-2.205l-.173-.191c-.031-.024-.037-.037-.064-.058a1.94%201.94%200%200%200-1.214-.482%201.8%201.8%200%200%200-.908.196c-.419.2-.755.55-.948.985a2%202%200%200%200-.188.79zm7.442%201.944a1.7%201.7%200%200%201-.944-.248%201.9%201.9%200%200%201-.602-.594l-.117-.223a1.93%201.93%200%200%201%20.072-1.722q.075-.141.18-.263a1.8%201.8%200%200%201%20.326-.323q.062-.048.13-.086c.05-.03.093-.052.144-.079a1.74%201.74%200%200%201%201.654.07l.07.044c.242.163.444.384.587.645a1.92%201.92%200%200%201%200%201.847%202%202%200%200%201-.184.27c-.02.026-.028.039-.05.063a2%202%200%200%201-.29.264%201.7%201.7%200%200%201-.983.336zM12.71%203.923c-.017.333.048.665.188.965.027.055.048.104.076.156l.144.223c.19.26.44.468.725.606a1.92%201.92%200%200%200%201.688%200c.053-.028.1-.05.15-.078a2%202%200%200%200%20.795-.904%202.14%202.14%200%200%200-.27-2.206l-.175-.191c-.031-.024-.037-.037-.064-.058a1.94%201.94%200%200%200-1.213-.482%201.8%201.8%200%200%200-.908.196c-.419.2-.755.55-.948.985a2%202%200%200%200-.187.79zm-8.8%207.281a1.7%201.7%200%200%201-.942-.246%201.9%201.9%200%200%201-.606-.595l-.121-.224a1.93%201.93%200%200%201%20.071-1.722q.077-.142.18-.263a1.8%201.8%200%200%201%20.464-.407%201.74%201.74%200%200%201%201.798-.008l.07.043c.242.163.444.384.587.645a1.92%201.92%200%200%201-.001%201.847%202%202%200%200%201-.183.27c-.02.026-.029.039-.05.063a2%202%200%200%201-.29.263%201.7%201.7%200%200%201-.984.337zM1.88%209.261c-.017.333.048.664.188.964.027.056.048.105.075.156l.145.223a1.97%201.97%200%200%200%201.569.802c.291%200%20.58-.067.844-.196.053-.028.1-.049.15-.078.348-.209.626-.525.795-.904a2.14%202.14%200%200%200-.276-2.205l-.175-.19c-.03-.024-.037-.037-.064-.058a1.94%201.94%200%200%200-1.207-.483%201.8%201.8%200%200%200-.908.195c-.419.2-.755.55-.948.985a2%202%200%200%200-.188.791zm7.442%201.943a1.7%201.7%200%200%201-.941-.246%201.9%201.9%200%200%201-.606-.595l-.117-.223a1.93%201.93%200%200%201%20.071-1.722q.075-.142.18-.264a1.8%201.8%200%200%201%20.463-.407c.05-.03.093-.051.145-.078a1.75%201.75%200%200%201%201.653.07l.07.043c.243.163.444.385.588.646a1.92%201.92%200%200%201-.001%201.847%202%202%200%200%201-.184.27c-.02.026-.028.039-.05.063a2%202%200%200%201-.29.263c-.288.212-.63.33-.983.337zM7.293%209.261c-.017.333.048.664.188.964.027.056.047.105.075.156l.145.223a1.97%201.97%200%200%200%201.569.802c.291%200%20.58-.067.844-.196.053-.028.1-.049.15-.078.352-.207.633-.524.805-.905a2.14%202.14%200%200%200-.276-2.205l-.175-.19c-.031-.024-.037-.037-.064-.058a1.94%201.94%200%200%200-1.214-.482%201.8%201.8%200%200%200-.908.195c-.419.2-.755.55-.948.985a2%202%200%200%200-.188.791zm7.444%201.944a1.7%201.7%200%200%201-.943-.246%201.9%201.9%200%200%201-.606-.596l-.117-.222a1.93%201.93%200%200%201%20.071-1.723q.075-.141.18-.263a1.8%201.8%200%200%201%20.463-.407c.05-.03.093-.051.145-.078a1.74%201.74%200%200%201%201.653.07l.07.043c.243.163.444.384.588.646a1.93%201.93%200%200%201-.001%201.847%202%202%200%200%201-.184.27c-.02.026-.028.038-.05.063a2%202%200%200%201-.29.263c-.288.212-.63.329-.983.337zm-2.029-1.943c-.017.332.048.664.188.964.027.055.048.104.075.156l.145.223c.19.26.44.468.725.606a1.92%201.92%200%200%200%201.688%200c.053-.028.1-.05.15-.078a2%202%200%200%200%20.795-.904%202.14%202.14%200%200%200-.276-2.205l-.175-.19c-.03-.024-.037-.037-.064-.059a1.94%201.94%200%200%200-1.211-.482%201.8%201.8%200%200%200-.909.196c-.418.2-.754.55-.947.985a2%202%200%200%200-.188.79zM3.91%2016.543a1.7%201.7%200%200%201-.942-.246%201.9%201.9%200%200%201-.606-.596l-.121-.223a1.93%201.93%200%200%201%20.071-1.723q.077-.141.18-.263a1.8%201.8%200%200%201%20.464-.407%201.75%201.75%200%200%201%201.798-.008l.07.043c.242.163.444.385.587.646a1.92%201.92%200%200%201-.001%201.847%202%202%200%200%201-.183.27l-.05.063a2%202%200%200%201-.29.26%201.7%201.7%200%200%201-.984.337zm-2.03-1.944c-.017.333.048.665.188.964.027.056.048.105.075.157l.145.223a1.97%201.97%200%200%200%201.569.802c.291%200%20.58-.067.844-.196.053-.028.1-.05.15-.078a2%202%200%200%200%20.795-.904%202.14%202.14%200%200%200-.276-2.205l-.175-.191c-.03-.023-.037-.037-.064-.058a1.94%201.94%200%200%200-1.207-.483%201.8%201.8%200%200%200-.908.196c-.419.2-.755.55-.948.985a2%202%200%200%200-.188.79zm7.442%201.944a1.7%201.7%200%200%201-.941-.246%201.9%201.9%200%200%201-.606-.596l-.117-.223a1.93%201.93%200%200%201%20.071-1.722q.075-.141.18-.263a1.8%201.8%200%200%201%20.463-.407%201.75%201.75%200%200%201%201.798-.008l.07.043c.243.163.444.384.588.645a1.92%201.92%200%200%201-.001%201.848%202%202%200%200%201-.184.27c-.02.026-.028.038-.05.062a2%202%200%200%201-.29.264c-.288.212-.63.329-.983.337zm-2.029-1.944c-.017.333.048.665.188.964.027.056.047.105.075.157l.145.223a1.97%201.97%200%200%200%201.569.802c.291%200%20.58-.067.844-.196.053-.028.1-.05.15-.078.352-.208.633-.524.805-.905a2.14%202.14%200%200%200-.276-2.205l-.175-.19c-.031-.024-.037-.037-.064-.059a1.94%201.94%200%200%200-1.214-.482%201.8%201.8%200%200%200-.908.196c-.419.2-.755.55-.948.985a2%202%200%200%200-.188.79zm7.444%201.944a1.7%201.7%200%200%201-.943-.246%201.9%201.9%200%200%201-.606-.595l-.117-.223a1.93%201.93%200%200%201%20.071-1.722q.075-.141.18-.263a1.8%201.8%200%200%201%20.463-.407c.05-.03.093-.052.145-.079a1.75%201.75%200%200%201%201.653.07l.07.044c.243.163.444.384.588.645a1.93%201.93%200%200%201-.001%201.847%202%202%200%200%201-.184.27c-.02.026-.028.039-.05.063a2%202%200%200%201-.29.264%201.7%201.7%200%200%201-.983.336zM12.708%2014.6c-.017.333.048.665.188.964.027.056.048.105.075.157l.145.222c.19.26.44.468.725.607a1.92%201.92%200%200%200%201.688%200c.053-.029.1-.05.15-.079a2%202%200%200%200%20.795-.904%202.14%202.14%200%200%200-.276-2.205l-.175-.19c-.03-.024-.037-.037-.064-.058a1.94%201.94%200%200%200-1.211-.482%201.8%201.8%200%200%200-.909.195c-.418.2-.754.55-.947.986a2%202%200%200%200-.188.79z'%20fill='currentColor'%20stroke='currentColor'%20stroke-width='.5'/%3e%3cpath%20stroke='currentColor'%20stroke-linecap='round'%20d='M2%2016.293%2016.293%202'/%3e%3c/svg%3e`,Mu=`data:image/svg+xml,%3csvg%20viewBox='0%200%2012%2012'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M9.75%201H4.5c-.678%200-1.314.302-1.743.828L.513%204.578a2.26%202.26%200%200%200%200%202.844l2.243%202.75A2.24%202.24%200%200%200%204.5%2011h5.25C10.99%2011%2012%209.99%2012%208.75v-5.5C12%202.01%2010.99%201%209.75%201m1.75%207.75c0%20.965-.785%201.75-1.75%201.75H4.5a1.74%201.74%200%200%201-1.356-.644L.901%207.106a1.755%201.755%200%200%201%200-2.212l2.243-2.75A1.74%201.74%200%200%201%204.5%201.499h5.25c.965%200%201.75.785%201.75%201.75zM8.927%204.427%207.354%206l1.573%201.573a.25.25%200%200%201-.354.353L7%206.355%205.427%207.926a.25.25%200%200%201-.354%200%20.25.25%200%200%201%200-.353L6.646%206%205.073%204.427a.25.25%200%200%201%20.354-.353L7%205.646l1.573-1.572a.25.25%200%200%201%20.353.353z'%20fill='currentColor'/%3e%3c/svg%3e`,Nu=`data:image/svg+xml,%3csvg%20viewBox='0%200%2030%2023'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20clip-rule='evenodd'%20d='m12.317%202.51%2015.123-.027c2.609%201.773%201.65%2019.836%200%2018.746l-15.124.026zM1.593%202.484h1.45V21.29h-1.45c-1.79-2.697-1.79-17.855%200-18.806ZM6.244.25h3.078a1.573%201.573%200%200%201%201.574%201.566v18.902a1.58%201.58%200%200%201-1.574%201.574H6.244a1.58%201.58%200%200%201-1.574-1.576v-18.9A1.573%201.573%200%200%201%206.244.25Z'%20stroke='currentColor'%20stroke-width='1.2'%20stroke-miterlimit='22.926'/%3e%3c/svg%3e`,Pu=(0,t.defineComponent)({__name:`Tooltip`,props:{defaultOpen:{type:Boolean},open:{type:Boolean},delayDuration:{},disableHoverableContent:{type:Boolean},disableClosingTrigger:{type:Boolean},disabled:{type:Boolean},ignoreNonKeyboardFocus:{type:Boolean}},emits:[`update:open`],setup(e,{emit:n}){let r=Yr(e,n);return(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Ll),(0,t.mergeProps)({"data-slot":`tooltip`},(0,t.unref)(r)),{default:(0,t.withCtx)(n=>[(0,t.renderSlot)(e.$slots,`default`,(0,t.normalizeProps)((0,t.guardReactiveProps)(n)))]),_:3},16))}}),Fu=(0,t.defineComponent)({inheritAttrs:!1,__name:`TooltipContent`,props:{forceMount:{type:Boolean},ariaLabel:{},asChild:{type:Boolean},as:{},side:{},sideOffset:{default:4},align:{},alignOffset:{},avoidCollisions:{type:Boolean},collisionBoundary:{},collisionPadding:{},arrowPadding:{},sticky:{},hideWhenDetached:{type:Boolean},positionStrategy:{},updatePositionStrategy:{},class:{type:[Boolean,null,String,Object,Array]}},emits:[`escapeKeyDown`,`pointerDownOutside`],setup(e,{emit:r}){let i=e,a=r,o=Yr((0,n.reactiveOmit)(i,`class`),a);return(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Vl),null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(Bl),(0,t.mergeProps)({"data-slot":`tooltip-content`},{...(0,t.unref)(o),...e.$attrs},{class:(0,t.unref)(J)(`wp:bg-foreground wp:text-background wp:animate-in wp:fade-in-0 wp:zoom-in-95 wp:data-[state=closed]:animate-out wp:data-[state=closed]:fade-out-0 wp:data-[state=closed]:zoom-out-95 wp:data-[side=bottom]:slide-in-from-top-2 wp:data-[side=left]:slide-in-from-right-2 wp:data-[side=right]:slide-in-from-left-2 wp:data-[side=top]:slide-in-from-bottom-2 wp:z-50 wp:w-fit wp:rounded-md wp:px-3 wp:py-1.5 wp:text-xs wp:text-balance`,i.class)}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`),(0,t.createVNode)((0,t.unref)(Al),{class:`wp:bg-foreground wp:fill-foreground wp:z-50 wp:size-2.5 wp:translate-y-[calc(-50%_-_2px)] wp:rotate-45 wp:rounded-[2px]`})]),_:3},16,[`class`])]),_:3}))}}),Iu=(0,t.defineComponent)({__name:`TooltipProvider`,props:{delayDuration:{default:0},skipDelayDuration:{},disableHoverableContent:{type:Boolean},disableClosingTrigger:{type:Boolean},disabled:{type:Boolean},ignoreNonKeyboardFocus:{type:Boolean},content:{}},setup(e){let n=e;return(e,r)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Nl),(0,t.normalizeProps)((0,t.guardReactiveProps)(n)),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16))}}),Lu=(0,t.defineComponent)({__name:`TooltipTrigger`,props:{reference:{},asChild:{type:Boolean},as:{}},setup(e){let n=e;return(e,r)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Hl),(0,t.mergeProps)({"data-slot":`tooltip-trigger`},n),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16))}}),Ru=[`data-call-status`],zu={class:`webphone-display__connected-status-label wp:flex wp:gap-2 wp:items-center`},Bu={class:`webphone-display__duration wp:ibrad wp:font-semibold wp:text-sm`},Vu={key:2,class:`webphone-display__dialer wp:w-full wp:flex wp:items-center wp:justify-center wp:min-h-10`},Hu={class:`webphone-display__dialer-field wp:relative`},Uu={class:`webphone-display__suggestions wp:absolute wp:bottom-full wp:left-0 wp:w-full wp:z-50 wp:bg-popover wp:text-popover-foreground wp:shadow-md wp:rounded-md wp:border wp:mb-1 wp:max-h-40 wp:overflow-y-auto`},Wu=[`onMousedown`],Gu={class:`webphone-display__contact-content wp:flex wp:flex-col wp:min-w-0`},Ku={class:`webphone-display__contact-name wp:truncate`},qu={class:`webphone-display__contact-number wp:text-xs wp:text-muted-foreground wp:truncate`},Ju={key:3,class:`webphone-display__connected-summary wp:flex wp:flex-col wp:items-center wp:justify-center wp:gap-2 wp:w-full`},Yu={class:`webphone-display__caller wp:flex wp:flex-col wp:items-center wp:gap-1`},Xu={class:`webphone-display__caller-row wp:flex wp:items-center wp:gap-2`},Zu={key:0,class:`webphone-display__caller-number wp:text-[10px] wp:text-muted-foreground`},Qu={key:4,class:`webphone-display__non-idle wp:flex wp:flex-col wp:items-center wp:justify-center wp:gap-2 wp:min-h-10`},$u={class:`webphone-display__non-idle-row wp:flex wp:items-center wp:gap-4`},ed={class:`webphone-display__non-idle-caller wp:flex wp:flex-col wp:items-center`},td={class:`webphone-display__non-idle-name wp:text-md wp:font-bold wp:text-neutral-800 wp:dark:text-white`},nd={key:0,class:`webphone-display__non-idle-number wp:text-sm wp:text-muted-foreground`},rd=(0,t.defineComponent)({__name:`CallDisplay`,props:{allowInput:{type:Boolean,default:!0},isWebCall:{type:Boolean,default:!1},user:{},contacts:{default:()=>[]},channelId:{default:void 0}},setup(e){let r=(0,t.inject)(`webphone`),i=(0,t.inject)(`sip`),a=navigator.platform.toUpperCase().indexOf(`MAC`)>=0?`⌘`:`Ctrl+`,o=e,s=(0,t.computed)(()=>o.channelId===void 0?r.activeChannel:r.channels.find(e=>e.id===o.channelId)),c=(0,t.computed)(()=>{if(!r.isConnected)return`wp:text-status-disconnected`;let e=s.value;return e&&e.status!==`idle`?e.isHeld||e.status===`held`?`wp:text-status-hold`:e.status===`incoming`?`wp:text-status-incoming`:`wp:text-primary`:`wp:text-primary`}),l=(0,t.ref)(!1),u=(0,t.ref)(null),d=(0,t.ref)(null);(0,n.onClickOutside)(u,()=>{l.value=!1});let f=(0,t.computed)({get:()=>s.value?.keypadValue||``,set:e=>{s.value&&r.updateChannelState(s.value.id,{keypadValue:e})}}),p=(0,t.computed)(()=>/^[+]?[0-9*#]+$/.test(f.value)),m=(0,t.computed)(()=>{if(!f.value)return o.contacts.slice(0,10);let e=f.value.toLowerCase(),t=[];for(let n of o.contacts)if((n.name.toLowerCase().includes(e)||n.number.includes(e))&&(t.push(n),t.length>=10))break;return t}),h=e=>{s.value&&r.updateChannelState(s.value.id,{keypadValue:e.number}),l.value=!1,i.makeCall(e.number)},g=()=>{!f.value||!p.value||(l.value=!1,i.makeCall(f.value))};(0,t.watch)(f,()=>{l.value=!0});let _=()=>{f.value&&p.value&&g()},v=()=>{l.value=!1},y=()=>{l.value=!0},b=()=>{setTimeout(()=>{l.value=!1},150)},x=(0,t.ref)(Date.now());(0,n.useIntervalFn)(()=>{x.value=Date.now()},1e3);let S=(0,t.computed)(()=>{let e=s.value?.startTime,t=s.value?.status||`idle`;if(!e||t!==`connected`)return`00:00:00`;let n=Math.floor((x.value-e)/1e3);return n<0?`00:00:00`:`${Math.floor(n/3600).toString().padStart(2,`0`)}:${Math.floor(n%3600/60).toString().padStart(2,`0`)}:${(n%60).toString().padStart(2,`0`)}`}),C=(0,t.computed)(()=>{let e=s.value,t=e?.status||`idle`;return t===`idle`?`Disponible`:t===`calling`?`Llamando...`:e?.isHeld?`En espera - ${e.remoteNumber||e.keypadValue||`Unknown`}`:t===`connected`?`Conectado`:t.charAt(0).toUpperCase()+t.slice(1)}),w=(0,t.computed)(()=>{let e=s.value,t=e?.remoteNumber||e?.keypadValue,n=e?.remoteDisplayName;if(!t)return`Unknown`;if(!t)return console.log(`[CallDisplay] ⚠️ No hay número`),`Unknown`;let r=o.contacts?.find(e=>(console.log(`[CallDisplay] Comparando con:`,e.name,`-`,e.number),e.number===t?(console.log(`[CallDisplay] ✅ Coincidencia exacta encontrada:`,e.name),!0):t.endsWith(e.number)||e.number.endsWith(t)?(console.log(`[CallDisplay] ✅ Coincidencia parcial encontrada:`,e.name),!0):!1)),i=r?r.name:n||t;return console.log(`[CallDisplay] 📱 Resultado final:`,i),i}),T=(0,t.computed)(()=>{let e=s.value;return e?.remoteNumber||e?.keypadValue||``});return(n,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:`webphone-display wp:flex wp:flex-col wp:items-center wp:px-4 wp:space-y-8`,"data-call-status":s.value?.status||`idle`},[(s.value?.status||`idle`)===`connected`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:(0,t.normalizeClass)([c.value,`webphone-display__connected-status wp:w-full wp:flex wp:items-center wp:justify-between wp:gap-2 wp:text-3xl wp:font-light wp:mb-5`])},[(0,t.createElementVNode)(`div`,zu,[(0,t.createVNode)((0,t.unref)(Nu),{class:`webphone-display__connected-status-icon wp:w-4 wp:h-4`}),i[2]||=(0,t.createElementVNode)(`span`,{class:`webphone-display__connected-status-text wp:text-sm wp:montserrat wp:font-bold`},`En llamada`,-1)]),(0,t.createElementVNode)(`span`,Bu,(0,t.toDisplayString)(S.value),1)],2)):(0,t.createCommentVNode)(``,!0),o.user?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:1,class:(0,t.normalizeClass)([c.value,`webphone-display__user wp:font-bold wp:text-lg wp:flex wp:items-center wp:gap-2 wp:transition-colors wp:duration-300`])},[(0,t.createVNode)((0,t.unref)(Nu),{class:`webphone-display__user-icon wp:size-6 wp:shrink-0 montserrat`}),(0,t.createTextVNode)(` `+(0,t.toDisplayString)(o.user)+` `,1),(s.value?.status||`idle`)===`connected`?(0,t.createCommentVNode)(``,!0):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:(0,t.normalizeClass)([c.value,`webphone-display__status-text wp:font-bold wp:tracking-wider wp:text-sm wp:text-[var(--color-primary)] montserrat`])},(0,t.toDisplayString)(C.value),3))],2)):(0,t.createCommentVNode)(``,!0),(s.value?.status||`idle`)===`idle`&&o.allowInput?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Vu,[(0,t.createElementVNode)(`div`,{class:`webphone-display__dialer-container wp:relative wp:w-full wp:max-w-80`,ref_key:`containerRef`,ref:u},[(0,t.createElementVNode)(`div`,Hu,[(0,t.createVNode)((0,t.unref)(Iu),null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(Pu),null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(Lu),{"as-child":``},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(Q),{onClick:(0,t.unref)(r).toggleKeypad,variant:`ghost`,size:`icon`,class:(0,t.normalizeClass)((0,t.unref)(J)(`webphone-display__keypad-toggle wp:absolute wp:left-0.5 wp:top-1/2 wp:-translate-y-1/2 wp:z-10 wp:h-9 wp:w-9 wp:rounded-full wp:text-[var(--p-primary-color)] wp:hover:opacity-80`))},{default:(0,t.withCtx)(()=>[(0,t.unref)(r).isKeypadVisible?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Au),{key:0,class:`webphone-display__keypad-toggle-icon wp:size-6`})):((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(ju),{key:1,class:`webphone-display__keypad-toggle-icon wp:size-6`}))]),_:1},8,[`onClick`,`class`])]),_:1}),(0,t.createVNode)((0,t.unref)(Fu),{class:`wp:flex wp:items-center wp:gap-2`},{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`span`,null,(0,t.toDisplayString)((0,t.unref)(r).isKeypadVisible?`Ocultar`:`Mostrar`)+` teclado`,1),(0,t.createVNode)((0,t.unref)(ku),null,{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)((0,t.unref)(a))+`K`,1)]),_:1})]),_:1})]),_:1})]),_:1}),(0,t.createVNode)((0,t.unref)(Ou),{ref_key:`inputRef`,ref:d,modelValue:f.value,"onUpdate:modelValue":i[0]||=e=>f.value=e,onFocus:y,onBlur:b,onKeydown:[(0,t.withKeys)(_,[`enter`]),(0,t.withKeys)(v,[`escape`])],placeholder:`Ingresa el numero a llamar...`,class:`p-input webphone-display__input wp:h-10 wp:text-center wp:select-text wp:px-14 wp:text-base hover:wp:border-[var(--p-primary-color)] wp:dark:hover:bg-neutral-900 focus-visible:wp:border-[var(--p-primary-color)] focus-visible:wp:ring-2 montserrat`},null,8,[`modelValue`]),(0,t.createElementVNode)(`div`,{class:`webphone-display__backspace wp:absolute wp:right-1 wp:top-1/2 wp:-translate-y-1/2 wp:z-10 wp:flex wp:h-8 wp:w-8 wp:cursor-pointer wp:items-center wp:justify-center wp:hover:bg-accent wp:rounded-full`,onClick:i[1]||=(0,t.withModifiers)(e=>(0,t.unref)(r).backspaceKeypad(),[`stop`])},[(0,t.createVNode)((0,t.unref)(Mu),{class:`webphone-display__backspace-icon wp:w-[16px] wp:h-[16px] wp:text-black wp:hover:text-status-disconnected wp:dark:text-neutral-500 wp:dark:hover:text-status-disconnected wp:transition-colors`})])]),(0,t.withDirectives)((0,t.createElementVNode)(`div`,Uu,[p.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:`webphone-display__suggestion webphone-display__suggestion--raw wp:cursor-pointer wp:hover:bg-accent wp:flex wp:items-center wp:gap-2 wp:p-2 wp:px-3 wp:text-sm`,onMousedown:(0,t.withModifiers)(g,[`prevent`])},[(0,t.createVNode)((0,t.unref)(uu),{class:`webphone-display__suggestion-icon wp:w-4 wp:h-4 wp:shrink-0`}),(0,t.createElementVNode)(`span`,null,`Marcar `+(0,t.toDisplayString)(f.value),1)],32)):(0,t.createCommentVNode)(``,!0),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(m.value,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:e.number,class:`webphone-display__suggestion webphone-display__suggestion--contact wp:cursor-pointer wp:hover:bg-accent wp:flex wp:items-center wp:gap-2 wp:p-2 wp:px-3 wp:text-sm`,onMousedown:(0,t.withModifiers)(t=>h(e),[`prevent`])},[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)((0,t.unref)(J)(`webphone-display__contact-badge wp:flex wp:items-center wp:justify-center wp:w-6 wp:h-6 wp:rounded-full wp:shrink-0`,e.type===`extension`?`wp:bg-blue-100 wp:text-blue-600 wp:dark:bg-blue-900/30 wp:dark:text-blue-400`:e.type===`contact`?`wp:bg-emerald-100 wp:text-emerald-600 wp:dark:bg-emerald-900/30 wp:dark:text-emerald-400`:e.type===`voicemail`?`wp:bg-purple-100 wp:text-purple-600 wp:dark:bg-purple-900/30 wp:dark:text-purple-400`:e.type===`tool`?`wp:bg-amber-100 wp:text-amber-600 wp:dark:bg-amber-900/30 wp:dark:text-amber-400`:`wp:bg-neutral-100 wp:text-neutral-600 wp:dark:bg-neutral-800 wp:dark:text-neutral-400`))},[e.type===`extension`?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)($l),{key:0,class:`wp:w-3 wp:h-3`})):e.type===`contact`?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(ru),{key:1,class:`wp:w-3 wp:h-3`})):e.type===`voicemail`?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(hu),{key:2,class:`wp:w-3 wp:h-3`})):e.type===`tool`?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(gu),{key:3,class:`wp:w-3 wp:h-3`})):((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(ru),{key:4,class:`wp:w-3 wp:h-3`}))],2),(0,t.createElementVNode)(`div`,Gu,[(0,t.createElementVNode)(`span`,Ku,(0,t.toDisplayString)(e.name),1),(0,t.createElementVNode)(`span`,qu,(0,t.toDisplayString)(e.number),1)])],40,Wu))),128))],512),[[t.vShow,l.value&&f.value&&(m.value.length>0||p.value)]])],512)])):(s.value?.status||`idle`)===`connected`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Ju,[(0,t.createElementVNode)(`div`,Yu,[(0,t.createElementVNode)(`div`,Xu,[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([c.value,`webphone-display__caller-name wp:text-xs`])},` En llamada con `+(0,t.toDisplayString)(w.value),3),e.isWebCall?(0,t.createCommentVNode)(``,!0):((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Iu),{key:0},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(Pu),null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(Lu),{"as-child":``}),(0,t.createVNode)((0,t.unref)(Fu),{class:`wp:flex wp:items-center wp:gap-2`},{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`span`,null,(0,t.toDisplayString)((0,t.unref)(r).isKeypadVisible?`Ocultar`:`Mostrar`)+` teclado`,1),(0,t.createVNode)((0,t.unref)(ku),null,{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)((0,t.unref)(a))+`K`,1)]),_:1})]),_:1})]),_:1})]),_:1}))]),w.value===T.value?(0,t.createCommentVNode)(``,!0):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Zu,(0,t.toDisplayString)(T.value),1))])])):(s.value?.status||`idle`)===`idle`?(0,t.createCommentVNode)(``,!0):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Qu,[(0,t.createElementVNode)(`div`,$u,[(0,t.createElementVNode)(`div`,ed,[(0,t.createElementVNode)(`div`,td,(0,t.toDisplayString)(w.value),1),w.value===T.value?(0,t.createCommentVNode)(``,!0):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,nd,(0,t.toDisplayString)(T.value),1))]),(0,t.createVNode)((0,t.unref)(Iu),null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(Pu),null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(Lu),{"as-child":``}),(0,t.createVNode)((0,t.unref)(Fu),{class:`wp:flex wp:items-center wp:gap-2`},{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`span`,null,(0,t.toDisplayString)((0,t.unref)(r).isKeypadVisible?`Ocultar`:`Mostrar`)+` teclado`,1),(0,t.createVNode)((0,t.unref)(ku),null,{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)((0,t.unref)(a))+`K`,1)]),_:1})]),_:1})]),_:1})]),_:1})])]))],8,Ru))}}),id=(0,t.defineComponent)({__name:`Dialog`,props:{open:{type:Boolean},defaultOpen:{type:Boolean},modal:{type:Boolean}},emits:[`update:open`],setup(e,{emit:n}){let r=Yr(e,n);return(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Oi),(0,t.mergeProps)({"data-slot":`dialog`},(0,t.unref)(r)),{default:(0,t.withCtx)(n=>[(0,t.renderSlot)(e.$slots,`default`,(0,t.normalizeProps)((0,t.guardReactiveProps)(n)))]),_:3},16))}}),ad=(0,t.defineComponent)({__name:`DialogOverlay`,props:{forceMount:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let r=e,i=(0,n.reactiveOmit)(r,`class`);return(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(ua),(0,t.mergeProps)({"data-slot":`dialog-overlay`},(0,t.unref)(i),{class:(0,t.unref)(J)(`wp:data-[state=open]:animate-in wp:data-[state=closed]:animate-out wp:data-[state=closed]:fade-out-0 wp:data-[state=open]:fade-in-0 wp:fixed wp:inset-0 wp:z-50 wp:bg-black/80`,r.class)}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16,[`class`]))}}),od=(0,t.defineComponent)({inheritAttrs:!1,__name:`DialogContent`,props:{forceMount:{type:Boolean},disableOutsidePointerEvents:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]},showCloseButton:{type:Boolean,default:!0}},emits:[`escapeKeyDown`,`pointerDownOutside`,`focusOutside`,`interactOutside`,`openAutoFocus`,`closeAutoFocus`],setup(e,{emit:r}){let i=e,a=r,o=Yr((0,n.reactiveOmit)(i,`class`),a);return(n,r)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(fa),null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)(ad),(0,t.createVNode)((0,t.unref)(ca),(0,t.mergeProps)({"data-slot":`dialog-content`},{...n.$attrs,...(0,t.unref)(o)},{class:(0,t.unref)(J)(`wp:bg-background wp:data-[state=open]:animate-in wp:data-[state=closed]:animate-out wp:data-[state=closed]:fade-out-0 wp:data-[state=open]:fade-in-0 wp:data-[state=closed]:zoom-out-95 wp:data-[state=open]:zoom-in-95 wp:fixed wp:top-[50%] wp:left-[50%] wp:z-50 wp:grid wp:w-full wp:max-w-[calc(100%-2rem)] wp:translate-x-[-50%] wp:translate-y-[-50%] wp:gap-4 wp:rounded-lg wp:border wp:p-6 wp:shadow-lg wp:duration-200 wp:sm:max-w-lg`,i.class)}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(n.$slots,`default`),e.showCloseButton?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(ki),{key:0,"data-slot":`dialog-close`,class:`wp:ring-offset-background wp:focus:ring-ring wp:data-[state=open]:bg-accent wp:data-[state=open]:text-muted-foreground wp:absolute wp:top-4 wp:right-4 wp:rounded-xs wp:opacity-70 wp:transition-opacity wp:hover:opacity-100 wp:focus:ring-2 wp:focus:ring-offset-2 wp:focus:outline-hidden wp:disabled:pointer-events-none wp:[&_svg]:pointer-events-none wp:[&_svg]:shrink-0 wp:[&_svg:not([class*='size-'])]:size-4`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(_u)),r[0]||=(0,t.createElementVNode)(`span`,{class:`wp:sr-only`},`Close`,-1)]),_:1})):(0,t.createCommentVNode)(``,!0)]),_:3},16,[`class`])]),_:3}))}}),sd=(0,t.defineComponent)({__name:`DialogFooter`,props:{class:{type:[Boolean,null,String,Object,Array]}},setup(e){let n=e;return(e,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{"data-slot":`dialog-footer`,class:(0,t.normalizeClass)((0,t.unref)(J)(`wp:flex wp:flex-col-reverse wp:gap-2 wp:sm:flex-row wp:sm:justify-end`,n.class))},[(0,t.renderSlot)(e.$slots,`default`)],2))}}),cd=(0,t.defineComponent)({__name:`DialogHeader`,props:{class:{type:[Boolean,null,String,Object,Array]}},setup(e){let n=e;return(e,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{"data-slot":`dialog-header`,class:(0,t.normalizeClass)((0,t.unref)(J)(`wp:flex wp:flex-col wp:gap-2 wp:text-center wp:sm:text-left`,n.class))},[(0,t.renderSlot)(e.$slots,`default`)],2))}}),ld=(0,t.defineComponent)({__name:`DialogTitle`,props:{asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let r=e,i=Jr((0,n.reactiveOmit)(r,`class`));return(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(pa),(0,t.mergeProps)({"data-slot":`dialog-title`},(0,t.unref)(i),{class:(0,t.unref)(J)(`wp:text-lg wp:leading-none wp:font-semibold`,r.class)}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16,[`class`]))}}),ud=(0,t.defineComponent)({__name:`Select`,props:{open:{type:Boolean},defaultOpen:{type:Boolean},defaultValue:{},modelValue:{},by:{type:[String,Function]},dir:{},multiple:{type:Boolean},autocomplete:{},disabled:{type:Boolean},name:{},required:{type:Boolean}},emits:[`update:modelValue`,`update:open`],setup(e,{emit:n}){let r=Yr(e,n);return(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)($c),(0,t.mergeProps)({"data-slot":`select`},(0,t.unref)(r)),{default:(0,t.withCtx)(n=>[(0,t.renderSlot)(e.$slots,`default`,(0,t.normalizeProps)((0,t.guardReactiveProps)(n)))]),_:3},16))}}),dd=(0,t.defineComponent)({inheritAttrs:!1,__name:`SelectContent`,props:{forceMount:{type:Boolean},position:{default:`popper`},bodyLock:{type:Boolean},side:{},sideOffset:{},sideFlip:{type:Boolean},align:{},alignOffset:{},alignFlip:{type:Boolean},avoidCollisions:{type:Boolean},collisionBoundary:{},collisionPadding:{},arrowPadding:{},hideShiftedArrow:{type:Boolean},sticky:{},hideWhenDetached:{type:Boolean},positionStrategy:{},updatePositionStrategy:{},disableUpdateOnLayoutShift:{type:Boolean},prioritizePosition:{type:Boolean},reference:{},asChild:{type:Boolean},as:{},disableOutsidePointerEvents:{type:Boolean},class:{type:[Boolean,null,String,Object,Array]}},emits:[`closeAutoFocus`,`escapeKeyDown`,`pointerDownOutside`],setup(e,{emit:r}){let i=e,a=r,o=Yr((0,n.reactiveOmit)(i,`class`),a);return(n,r)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(xl),null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(dl),(0,t.mergeProps)({"data-slot":`select-content`},{...n.$attrs,...(0,t.unref)(o)},{class:(0,t.unref)(J)(`wp:bg-popover wp:text-popover-foreground wp:data-[state=open]:animate-in wp:data-[state=closed]:animate-out wp:data-[state=closed]:fade-out-0 wp:data-[state=open]:fade-in-0 wp:data-[state=closed]:zoom-out-95 wp:data-[state=open]:zoom-in-95 wp:data-[side=bottom]:slide-in-from-top-2 wp:data-[side=left]:slide-in-from-right-2 wp:data-[side=right]:slide-in-from-left-2 wp:data-[side=top]:slide-in-from-bottom-2 wp:relative wp:z-50 wp:max-h-(--reka-select-content-available-height) wp:min-w-[8rem] wp:overflow-x-hidden wp:overflow-y-auto wp:rounded-md wp:border wp:shadow-md`,e.position===`popper`&&`wp:data-[side=bottom]:translate-y-1 wp:data-[side=left]:-translate-x-1 wp:data-[side=right]:translate-x-1 wp:data-[side=top]:-translate-y-1`,i.class)}),{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(gd)),(0,t.createVNode)((0,t.unref)(Dl),{class:(0,t.normalizeClass)((0,t.unref)(J)(`wp:p-1`,e.position===`popper`&&`wp:h-[var(--reka-select-trigger-height)] wp:w-full wp:min-w-[var(--reka-select-trigger-width)] wp:scroll-my-1`))},{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(n.$slots,`default`)]),_:3},8,[`class`]),(0,t.createVNode)((0,t.unref)(hd))]),_:3},16,[`class`])]),_:3}))}}),fd=(0,t.defineComponent)({__name:`SelectGroup`,props:{asChild:{type:Boolean},as:{}},setup(e){let n=e;return(e,r)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(ml),(0,t.mergeProps)({"data-slot":`select-group`},n),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16))}}),pd={class:`wp:absolute wp:right-2 wp:flex wp:size-3.5 wp:items-center wp:justify-center`},md=(0,t.defineComponent)({__name:`SelectItem`,props:{value:{},disabled:{type:Boolean},textValue:{},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let r=e,i=Jr((0,n.reactiveOmit)(r,`class`));return(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(vl),(0,t.mergeProps)({"data-slot":`select-item`},(0,t.unref)(i),{class:(0,t.unref)(J)(`wp:focus:bg-accent wp:focus:text-accent-foreground wp:[&_svg:not([class*='text-'])]:text-muted-foreground wp:relative wp:flex wp:w-full wp:cursor-default wp:items-center wp:gap-2 wp:rounded-sm wp:py-1.5 wp:pr-8 wp:pl-2 wp:text-sm wp:outline-hidden wp:select-none wp:data-[disabled]:pointer-events-none wp:data-[disabled]:opacity-50 wp:[&_svg]:pointer-events-none wp:[&_svg]:shrink-0 wp:[&_svg:not([class*='size-'])]:size-4 wp:*:[span]:last:flex wp:*:[span]:last:items-center wp:*:[span]:last:gap-2`,r.class)}),{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`span`,pd,[(0,t.createVNode)((0,t.unref)(yl),null,{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`indicator-icon`,{},()=>[(0,t.createVNode)((0,t.unref)(eu),{class:`wp:size-4`})])]),_:3})]),(0,t.createVNode)((0,t.unref)(bl),null,{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3})]),_:3},16,[`class`]))}}),hd=(0,t.defineComponent)({__name:`SelectScrollDownButton`,props:{asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let r=e,i=Jr((0,n.reactiveOmit)(r,`class`));return(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Cl),(0,t.mergeProps)({"data-slot":`select-scroll-down-button`},(0,t.unref)(i),{class:(0,t.unref)(J)(`wp:flex wp:cursor-default wp:items-center wp:justify-center wp:py-1`,r.class)}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`,{},()=>[(0,t.createVNode)((0,t.unref)(tu),{class:`wp:size-4`})])]),_:3},16,[`class`]))}}),gd=(0,t.defineComponent)({__name:`SelectScrollUpButton`,props:{asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let r=e,i=Jr((0,n.reactiveOmit)(r,`class`));return(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(wl),(0,t.mergeProps)({"data-slot":`select-scroll-up-button`},(0,t.unref)(i),{class:(0,t.unref)(J)(`wp:flex wp:cursor-default wp:items-center wp:justify-center wp:py-1`,r.class)}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`,{},()=>[(0,t.createVNode)((0,t.unref)(nu),{class:`wp:size-4`})])]),_:3},16,[`class`]))}}),_d=(0,t.defineComponent)({__name:`SelectTrigger`,props:{disabled:{type:Boolean},reference:{},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]},size:{default:`default`}},setup(e){let r=e,i=Jr((0,n.reactiveOmit)(r,`class`,`size`));return(n,a)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Tl),(0,t.mergeProps)({"data-slot":`select-trigger`,"data-size":e.size},(0,t.unref)(i),{class:(0,t.unref)(J)(`wp:border-input wp:data-[placeholder]:text-muted-foreground wp:[&_svg:not([class*='text-'])]:text-muted-foreground wp:focus-visible:border-ring wp:focus-visible:ring-ring/50 wp:aria-invalid:ring-destructive/20 wp:dark:aria-invalid:ring-destructive/40 wp:aria-invalid:border-destructive wp:dark:bg-input/30 wp:dark:hover:bg-input/50 wp:flex wp:w-fit wp:items-center wp:justify-between wp:gap-2 wp:rounded-md wp:border wp:bg-transparent wp:px-3 wp:py-2 wp:text-sm wp:whitespace-nowrap wp:shadow-xs wp:transition-[color,box-shadow] wp:outline-none wp:focus-visible:ring-[3px] wp:disabled:cursor-not-allowed wp:disabled:opacity-50 wp:data-[size=default]:h-9 wp:data-[size=sm]:h-8 wp:*:data-[slot=select-value]:line-clamp-1 wp:*:data-[slot=select-value]:flex wp:*:data-[slot=select-value]:items-center wp:*:data-[slot=select-value]:gap-2 wp:[&_svg]:pointer-events-none wp:[&_svg]:shrink-0 wp:[&_svg:not([class*='size-'])]:size-4`,r.class)}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(n.$slots,`default`),(0,t.createVNode)((0,t.unref)(hl),{"as-child":``},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(tu),{class:`wp:size-4 wp:opacity-50`})]),_:1})]),_:3},16,[`data-size`,`class`]))}}),vd=(0,t.defineComponent)({__name:`SelectValue`,props:{placeholder:{},asChild:{type:Boolean},as:{}},setup(e){let n=e;return(e,r)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(El),(0,t.mergeProps)({"data-slot":`select-value`},n),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16))}}),yd=(0,t.defineComponent)({__name:`Slider`,props:{defaultValue:{},modelValue:{},disabled:{type:Boolean},orientation:{},dir:{},inverted:{type:Boolean},min:{},max:{},step:{},minStepsBetweenThumbs:{},thumbAlignment:{},asChild:{type:Boolean},as:{},name:{},required:{type:Boolean},class:{type:[Boolean,null,String,Object,Array]}},emits:[`update:modelValue`,`valueCommit`],setup(e,{emit:r}){let i=e,a=r,o=Yr((0,n.reactiveOmit)(i,`class`),a);return(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(uc),(0,t.mergeProps)({"data-slot":`slider`,class:(0,t.unref)(J)(`wp:relative wp:flex wp:w-full wp:touch-none wp:items-center wp:select-none wp:data-[disabled]:opacity-50 wp:data-[orientation=vertical]:h-full wp:data-[orientation=vertical]:min-h-44 wp:data-[orientation=vertical]:w-auto wp:data-[orientation=vertical]:flex-col`,i.class)},(0,t.unref)(o)),{default:(0,t.withCtx)(({modelValue:e})=>[(0,t.createVNode)((0,t.unref)(hc),{"data-slot":`slider-track`,class:`wp:bg-muted wp:relative wp:grow wp:overflow-hidden wp:rounded-full wp:data-[orientation=horizontal]:h-1.5 wp:data-[orientation=horizontal]:w-full wp:data-[orientation=vertical]:h-full wp:data-[orientation=vertical]:w-1.5`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(fc),{"data-slot":`slider-range`,class:`wp:bg-primary wp:absolute wp:data-[orientation=horizontal]:h-full wp:data-[orientation=vertical]:w-full`})]),_:1}),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e,(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(mc),{key:n,"data-slot":`slider-thumb`,class:`wp:bg-white wp:border-primary wp:ring-ring/50 wp:block wp:size-4 wp:shrink-0 wp:rounded-full wp:border wp:shadow-sm wp:transition-[color,box-shadow] wp:hover:ring-4 wp:focus-visible:ring-4 wp:focus-visible:outline-hidden wp:disabled:pointer-events-none wp:disabled:opacity-50`}))),128))]),_:1},16,[`class`]))}}),bd=(0,t.defineComponent)({__name:`Label`,props:{for:{},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let r=e,i=(0,n.reactiveOmit)(r,`class`);return(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(gc),(0,t.mergeProps)({"data-slot":`label`},(0,t.unref)(i),{class:(0,t.unref)(J)(`wp:flex wp:items-center wp:gap-2 wp:text-sm wp:leading-none wp:font-medium wp:select-none wp:group-data-[disabled=true]:pointer-events-none wp:group-data-[disabled=true]:opacity-50 wp:peer-disabled:cursor-not-allowed wp:peer-disabled:opacity-50`,r.class)}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16,[`class`]))}}),xd=(0,t.defineComponent)({__name:`Separator`,props:{orientation:{default:`horizontal`},decorative:{type:Boolean,default:!0},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let r=e,i=(0,n.reactiveOmit)(r,`class`);return(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(kl),(0,t.mergeProps)({"data-slot":`separator`},(0,t.unref)(i),{class:(0,t.unref)(J)(`wp:bg-border wp:shrink-0 wp:data-[orientation=horizontal]:h-px wp:data-[orientation=horizontal]:w-full wp:data-[orientation=vertical]:h-full wp:data-[orientation=vertical]:w-px`,r.class)}),null,16,[`class`]))}}),Sd={class:`wp:flex wp:flex-col wp:gap-6 wp:py-4`},Cd={class:`wp:flex wp:flex-col wp:gap-2`},wd={class:`wp:flex wp:flex-col wp:gap-2`},Td={class:`wp:flex wp:flex-col wp:gap-4`},Ed={class:`wp:flex wp:justify-between`},Dd={class:`wp:text-sm wp:text-muted-foreground`},Od={class:`wp:flex wp:flex-col wp:gap-4`},kd={class:`wp:flex wp:justify-between`},Ad={class:`wp:text-sm wp:text-muted-foreground`},jd={class:`wp:flex wp:flex-col wp:gap-3`},Md={class:`wp:grid wp:grid-cols-2 wp:gap-2 wp:text-sm`},Nd={class:`wp:flex wp:items-center wp:justify-between wp:gap-2`},Pd={class:`wp:flex wp:items-center wp:justify-between wp:gap-2`},Fd={class:`wp:flex wp:items-center wp:justify-between wp:gap-2`},Id={class:`wp:flex wp:items-center wp:justify-between wp:gap-2`},Ld={class:`wp:flex wp:items-center wp:justify-between wp:gap-2`},Rd={class:`wp:flex wp:items-center wp:justify-between wp:gap-2`},zd=(0,t.defineComponent)({__name:`AudioSettingsDialog`,props:{visible:{type:Boolean}},emits:[`update:visible`],setup(e,{emit:r}){let i=r,a=navigator.platform.toUpperCase().indexOf(`MAC`)>=0?`⌘`:`Ctrl+`,{setVolume:o,setOutputDevice:s,setInputDevice:c,setNotificationVolume:l}=(0,t.inject)(`sip`),u=(0,t.ref)([]),d=(0,t.ref)([]),f=(0,n.useStorage)(`webphone-input-device`,``),p=(0,n.useStorage)(`webphone-output-device`,``),m=(0,n.useStorage)(`webphone-volume`,100),h=(0,n.useStorage)(`webphone-notification-volume`,100),g=async()=>{try{await navigator.mediaDevices.getUserMedia({audio:!0});let e=await navigator.mediaDevices.enumerateDevices();u.value=e.filter(e=>e.kind===`audioinput`).map((e,t)=>({deviceId:e.deviceId,label:e.label||`Microphone ${t+1}`})),d.value=e.filter(e=>e.kind===`audiooutput`).map((e,t)=>({deviceId:e.deviceId,label:e.label||`Speaker ${t+1}`}));let t=u.value.some(e=>e.deviceId===f.value);(!f.value||!t)&&u.value.length>0&&(f.value=u.value[0]?.deviceId??``);let n=d.value.some(e=>e.deviceId===p.value);(!p.value||!n)&&d.value.length>0&&(p.value=d.value[0]?.deviceId??``),f.value&&c(f.value),p.value&&s(p.value)}catch(e){console.error(`Error loading devices`,e)}},_=e=>{let t=String(e);f.value=t,c(t)},v=e=>{let t=String(e);p.value=t,s(t)},y=(e,t=35)=>e.length<=t?e:e.substring(0,t)+`...`,b=(0,t.computed)({get:()=>[m.value],set:e=>{m.value=e[0],o(m.value)}}),x=(0,t.computed)({get:()=>[h.value],set:e=>{h.value=e[0],l(h.value)}});return(0,t.onMounted)(()=>{g(),o(m.value),l(h.value)}),(n,r)=>e.visible?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(id),{key:0,open:e.visible,"onUpdate:open":r[5]||=e=>i(`update:visible`,e)},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(od),{class:`wp:sm:max-w-sm`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(cd),null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(ld),null,{default:(0,t.withCtx)(()=>[...r[6]||=[(0,t.createTextVNode)(`Audio Settings`,-1)]]),_:1})]),_:1}),(0,t.createElementVNode)(`div`,Sd,[(0,t.createElementVNode)(`div`,Cd,[(0,t.createVNode)((0,t.unref)(bd),null,{default:(0,t.withCtx)(()=>[...r[7]||=[(0,t.createTextVNode)(`Microphone`,-1)]]),_:1}),(0,t.createVNode)((0,t.unref)(ud),{modelValue:(0,t.unref)(f),"onUpdate:modelValue":[r[0]||=e=>(0,t.isRef)(f)?f.value=e:null,_]},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(_d),{class:`wp:w-full`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(vd),{placeholder:`Select Microphone`})]),_:1}),(0,t.createVNode)((0,t.unref)(dd),null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(fd),null,{default:(0,t.withCtx)(()=>[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(u.value,e=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(md),{key:e.deviceId,value:e.deviceId,title:e.label},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)(y(e.label)),1)]),_:2},1032,[`value`,`title`]))),128))]),_:1})]),_:1})]),_:1},8,[`modelValue`])]),(0,t.createElementVNode)(`div`,wd,[(0,t.createVNode)((0,t.unref)(bd),null,{default:(0,t.withCtx)(()=>[...r[8]||=[(0,t.createTextVNode)(`Speaker`,-1)]]),_:1}),(0,t.createVNode)((0,t.unref)(ud),{modelValue:(0,t.unref)(p),"onUpdate:modelValue":[r[1]||=e=>(0,t.isRef)(p)?p.value=e:null,v]},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(_d),{class:`wp:w-full`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(vd),{placeholder:`Select Speaker`})]),_:1}),(0,t.createVNode)((0,t.unref)(dd),null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(fd),null,{default:(0,t.withCtx)(()=>[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(d.value,e=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(md),{key:e.deviceId,value:e.deviceId,title:e.label},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)(y(e.label)),1)]),_:2},1032,[`value`,`title`]))),128))]),_:1})]),_:1})]),_:1},8,[`modelValue`])]),(0,t.createElementVNode)(`div`,Td,[(0,t.createElementVNode)(`div`,Ed,[(0,t.createVNode)((0,t.unref)(bd),null,{default:(0,t.withCtx)(()=>[...r[9]||=[(0,t.createTextVNode)(`Media Volume`,-1)]]),_:1}),(0,t.createElementVNode)(`span`,Dd,(0,t.toDisplayString)((0,t.unref)(m))+`%`,1)]),(0,t.createVNode)((0,t.unref)(yd),{modelValue:b.value,"onUpdate:modelValue":r[2]||=e=>b.value=e,max:100,step:1},null,8,[`modelValue`])]),(0,t.createElementVNode)(`div`,Od,[(0,t.createElementVNode)(`div`,kd,[(0,t.createVNode)((0,t.unref)(bd),null,{default:(0,t.withCtx)(()=>[...r[10]||=[(0,t.createTextVNode)(`Notification Volume`,-1)]]),_:1}),(0,t.createElementVNode)(`span`,Ad,(0,t.toDisplayString)((0,t.unref)(h))+`%`,1)]),(0,t.createVNode)((0,t.unref)(yd),{modelValue:x.value,"onUpdate:modelValue":r[3]||=e=>x.value=e,max:100,step:1},null,8,[`modelValue`])]),(0,t.createVNode)((0,t.unref)(xd)),(0,t.createElementVNode)(`div`,jd,[(0,t.createVNode)((0,t.unref)(bd),{class:`wp:text-base`},{default:(0,t.withCtx)(()=>[...r[11]||=[(0,t.createTextVNode)(`Atajos de teclado`,-1)]]),_:1}),(0,t.createElementVNode)(`div`,Md,[(0,t.createElementVNode)(`div`,Nd,[r[12]||=(0,t.createElementVNode)(`span`,{class:`wp:text-muted-foreground`},`Historial`,-1),(0,t.createVNode)((0,t.unref)(ku),null,{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)((0,t.unref)(a))+`H`,1)]),_:1})]),(0,t.createElementVNode)(`div`,Pd,[r[13]||=(0,t.createElementVNode)(`span`,{class:`wp:text-muted-foreground`},`Configuración`,-1),(0,t.createVNode)((0,t.unref)(ku),null,{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)((0,t.unref)(a))+`,`,1)]),_:1})]),(0,t.createElementVNode)(`div`,Fd,[r[14]||=(0,t.createElementVNode)(`span`,{class:`wp:text-muted-foreground`},`Teclado`,-1),(0,t.createVNode)((0,t.unref)(ku),null,{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)((0,t.unref)(a))+`K`,1)]),_:1})]),(0,t.createElementVNode)(`div`,Id,[r[15]||=(0,t.createElementVNode)(`span`,{class:`wp:text-muted-foreground`},`Línea 1`,-1),(0,t.createVNode)((0,t.unref)(ku),null,{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)((0,t.unref)(a))+`1`,1)]),_:1})]),(0,t.createElementVNode)(`div`,Ld,[r[16]||=(0,t.createElementVNode)(`span`,{class:`wp:text-muted-foreground`},`Línea 2`,-1),(0,t.createVNode)((0,t.unref)(ku),null,{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)((0,t.unref)(a))+`2`,1)]),_:1})]),(0,t.createElementVNode)(`div`,Rd,[r[17]||=(0,t.createElementVNode)(`span`,{class:`wp:text-muted-foreground`},`Línea 3`,-1),(0,t.createVNode)((0,t.unref)(ku),null,{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)((0,t.unref)(a))+`3`,1)]),_:1})])])])]),(0,t.createVNode)((0,t.unref)(sd),null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(Q),{variant:`secondary`,onClick:r[4]||=e=>i(`update:visible`,!1)},{default:(0,t.withCtx)(()=>[...r[18]||=[(0,t.createTextVNode)(`Close`,-1)]]),_:1})]),_:1})]),_:1})]),_:1},8,[`open`])):(0,t.createCommentVNode)(``,!0)}}),Bd=(0,t.defineComponent)({__name:`ScrollBar`,props:{orientation:{default:`vertical`},forceMount:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let r=e,i=(0,n.reactiveOmit)(r,`class`);return(n,a)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Rc),(0,t.mergeProps)({"data-slot":`scroll-area-scrollbar`},(0,t.unref)(i),{class:(0,t.unref)(J)(`wp:flex wp:touch-none wp:p-px wp:transition-colors wp:select-none`,e.orientation===`vertical`&&`wp:h-full wp:w-2.5 wp:border-l wp:border-l-transparent`,e.orientation===`horizontal`&&`wp:h-2.5 wp:flex-col wp:border-t wp:border-t-transparent`,r.class)}),{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(Uc),{"data-slot":`scroll-area-thumb`,class:`wp:bg-border wp:relative wp:flex-1 wp:rounded-full`})]),_:1},16,[`class`]))}}),Vd=(0,t.defineComponent)({__name:`ScrollArea`,props:{type:{},dir:{},scrollHideDelay:{},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let r=e,i=(0,n.reactiveOmit)(r,`class`);return(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(yc),(0,t.mergeProps)({"data-slot":`scroll-area`},(0,t.unref)(i),{class:(0,t.unref)(J)(`wp:relative`,r.class)}),{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(Wc),{"data-slot":`scroll-area-viewport`,class:`wp:focus-visible:ring-ring/50 wp:size-full wp:rounded-[inherit] wp:transition-[color,box-shadow] wp:outline-none wp:focus-visible:ring-[3px] wp:focus-visible:outline-1`},{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3}),(0,t.createVNode)(Bd),(0,t.createVNode)((0,t.unref)(xc))]),_:3},16,[`class`]))}}),Hd={class:`wp:relative wp:my-2`},Ud={class:`wp:flex wp:flex-col wp:gap-2`},Wd=[`onClick`],Gd={class:`wp:flex wp:items-center wp:gap-3`},Kd={class:`wp:flex wp:flex-col`},qd={class:`wp:text-sm wp:font-medium`},Jd={class:`wp:text-[10px] wp:text-muted-foreground`},Yd={class:`wp:flex wp:flex-col wp:items-end`},Xd={key:0,class:`wp:text-xs wp:font-mono wp:text-muted-foreground`},Zd={class:`wp:text-[10px] wp:text-muted-foreground wp:capitalize`},Qd={key:0,class:`wp:text-center wp:text-muted-foreground wp:py-8`},$d={key:1,class:`wp:text-center wp:text-muted-foreground wp:py-8`},ef=(0,t.defineComponent)({__name:`CallHistoryDialog`,props:{visible:{type:Boolean},contacts:{}},emits:[`update:visible`,`call`],setup(e,{emit:n}){let r=e,i=n,a=(0,t.inject)(`webphone`),o=(0,t.ref)(``),s=e=>{if(!r.contacts)return e;let t=r.contacts.find(t=>t.number===e);return t?t.name:e},c=(0,t.computed)(()=>{if(!o.value)return a.callHistory;let e=o.value.toLowerCase();return a.callHistory.filter(t=>{let n=s(t.number).toLowerCase(),r=t.number.toLowerCase();return n.includes(e)||r.includes(e)})}),l=e=>e===0?``:`${Math.floor(e/60)}:${(e%60).toString().padStart(2,`0`)}`,u=e=>e.direction===`incoming`?e.status===`missed`?cu:su:lu,d=e=>e.status===`missed`?`wp:text-red-500`:e.direction===`incoming`?`wp:text-green-500`:`wp:text-blue-500`,f=e=>{i(`update:visible`,!1),i(`call`,e)};return(n,r)=>e.visible?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(id),{key:0,open:e.visible,"onUpdate:open":r[1]||=e=>i(`update:visible`,e)},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(od),{class:`wp:sm:max-w-sm`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(cd),null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(ld),null,{default:(0,t.withCtx)(()=>[...r[2]||=[(0,t.createTextVNode)(`Call History`,-1)]]),_:1})]),_:1}),(0,t.createElementVNode)(`div`,Hd,[(0,t.createVNode)((0,t.unref)(fu),{class:`wp:absolute wp:left-2 wp:top-2.5 wp:h-4 wp:w-4 wp:text-muted-foreground`}),(0,t.createVNode)((0,t.unref)(Ou),{modelValue:o.value,"onUpdate:modelValue":r[0]||=e=>o.value=e,placeholder:`Search history...`,class:`wp:pl-8`},null,8,[`modelValue`])]),(0,t.createVNode)((0,t.unref)(Vd),{class:`wp:h-[60vh] wp:pr-4`},{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,Ud,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(c.value,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:e.id,class:`wp:flex wp:items-center wp:justify-between wp:p-2 wp:rounded-lg wp:hover:bg-accent wp:cursor-pointer wp:transition-colors`,onClick:t=>f(e.number)},[(0,t.createElementVNode)(`div`,Gd,[((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(u(e)),{class:(0,t.normalizeClass)([d(e),`wp:w-4 wp:h-4`])},null,8,[`class`])),(0,t.createElementVNode)(`div`,Kd,[(0,t.createElementVNode)(`span`,qd,(0,t.toDisplayString)(s(e.number)),1),(0,t.createElementVNode)(`span`,Jd,(0,t.toDisplayString)(new Date(e.startTime).toLocaleString()),1)])]),(0,t.createElementVNode)(`div`,Yd,[e.duration>0?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,Xd,(0,t.toDisplayString)(l(e.duration)),1)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`span`,Zd,(0,t.toDisplayString)(e.status),1)])],8,Wd))),128)),(0,t.unref)(a).callHistory.length===0?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Qd,` No call history `)):c.value.length===0?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,$d,` No results found `)):(0,t.createCommentVNode)(``,!0)])]),_:1})]),_:1})]),_:1},8,[`open`])):(0,t.createCommentVNode)(``,!0)}}),tf={class:`wp:grid wp:gap-4 wp:py-4`},nf={class:`wp:grid wp:gap-2 wp:relative`},rf={class:`wp:relative`},af={key:0,class:`wp:absolute wp:top-full wp:left-0 wp:right-0 wp:mt-1 wp:bg-popover wp:border wp:rounded-md wp:shadow-lg wp:z-50 wp:max-h-60 wp:overflow-auto`},of={class:`wp:p-1`},sf=[`onClick`],cf={class:`wp:flex wp:flex-col wp:min-w-0 wp:flex-1`},lf={class:`wp:font-medium wp:text-sm wp:truncate`},uf={class:`wp:text-xs wp:text-muted-foreground`},df=(0,t.defineComponent)({__name:`TransferDialog`,props:{visible:{type:Boolean},contacts:{default:()=>[]}},emits:[`update:visible`,`transfer`],setup(e,{emit:n}){let r=e,i=n,a=(0,t.ref)(``),o=(0,t.ref)(!1),s=(0,t.ref)(null);(0,t.watch)(()=>r.visible,e=>{e&&(a.value=``,o.value=!1)}),(0,t.watch)(a,e=>{o.value=e.length>0&&c.value.length>0});let c=(0,t.computed)(()=>{if(!a.value)return r.contacts;let e=a.value.toLowerCase();return r.contacts.filter(t=>t.name.toLowerCase().includes(e)||t.number.includes(e))}),l=e=>{a.value=e.number,o.value=!1},u=()=>{a.value=``,o.value=!1,s.value?.focus()},d=e=>{let t=a.value.trim();t&&(i(`transfer`,t,e),i(`update:visible`,!1),a.value=``,o.value=!1)},f=e=>{e.key===`Enter`&&a.value.trim()?(e.preventDefault(),d(`blind`)):e.key===`Escape`&&(o.value=!1)};return(n,r)=>e.visible?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(id),{key:0,open:e.visible,"onUpdate:open":r[5]||=e=>i(`update:visible`,e)},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(od),{class:`wp:sm:max-w-md`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(cd),null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(ld),null,{default:(0,t.withCtx)(()=>[...r[6]||=[(0,t.createTextVNode)(`Transferir Llamada`,-1)]]),_:1})]),_:1}),(0,t.createElementVNode)(`div`,tf,[(0,t.createElementVNode)(`div`,nf,[(0,t.createVNode)((0,t.unref)(bd),{for:`transfer-input`},{default:(0,t.withCtx)(()=>[...r[7]||=[(0,t.createTextVNode)(`Número o Contacto`,-1)]]),_:1}),(0,t.createElementVNode)(`div`,rf,[(0,t.createVNode)((0,t.unref)(Ou),{id:`transfer-input`,ref_key:`inputRef`,ref:s,modelValue:a.value,"onUpdate:modelValue":r[0]||=e=>a.value=e,type:`text`,placeholder:`Escribe un número o busca un contacto...`,class:`wp:pr-8`,onKeydown:f,onFocus:r[1]||=e=>o.value=a.value.length>0&&c.value.length>0,autocomplete:`off`},null,8,[`modelValue`]),a.value?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Q),{key:0,variant:`ghost`,size:`icon`,class:`wp:absolute wp:right-0 wp:top-0 wp:h-full wp:w-8 wp:hover:bg-transparent`,onClick:u},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(_u),{class:`wp:h-4 wp:w-4`})]),_:1})):(0,t.createCommentVNode)(``,!0)]),o.value&&c.value.length>0?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,af,[(0,t.createVNode)((0,t.unref)(Vd),{class:`wp:max-h-60`},{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,of,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(c.value,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:e.number,class:`wp:flex wp:items-center wp:gap-2 wp:p-2 wp:rounded-sm wp:cursor-pointer wp:hover:bg-accent wp:transition-colors`,onClick:t=>l(e)},[e.type?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:(0,t.normalizeClass)((0,t.unref)(J)(`wp:flex wp:items-center wp:justify-center wp:w-8 wp:h-8 wp:rounded-full wp:shrink-0`,e.type===`extension`?`wp:bg-blue-100 wp:text-blue-600 wp:dark:bg-blue-900/30 wp:dark:text-blue-400`:e.type===`contact`?`wp:bg-emerald-100 wp:text-emerald-600 wp:dark:bg-emerald-900/30 wp:dark:text-emerald-400`:e.type===`voicemail`?`wp:bg-purple-100 wp:text-purple-600 wp:dark:bg-purple-900/30 wp:dark:text-purple-400`:`wp:bg-amber-100 wp:text-amber-600 wp:dark:bg-amber-900/30 wp:dark:text-amber-400`))},[e.type===`extension`?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)($l),{key:0,class:`wp:w-4 wp:h-4`})):e.type===`contact`?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(ru),{key:1,class:`wp:w-4 wp:h-4`})):e.type===`voicemail`?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(hu),{key:2,class:`wp:w-4 wp:h-4`})):((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(gu),{key:3,class:`wp:w-4 wp:h-4`}))],2)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,cf,[(0,t.createElementVNode)(`span`,lf,(0,t.toDisplayString)(e.name),1),(0,t.createElementVNode)(`span`,uf,(0,t.toDisplayString)(e.number),1)])],8,sf))),128))])]),_:1})])):(0,t.createCommentVNode)(``,!0),r[8]||=(0,t.createElementVNode)(`p`,{class:`wp:text-xs wp:text-muted-foreground`},` Presiona Enter para transferir directamente `,-1)])]),(0,t.createVNode)((0,t.unref)(sd),{class:`wp:flex-col wp:gap-2 sm:wp:flex-row`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(Q),{variant:`secondary`,onClick:r[2]||=e=>i(`update:visible`,!1),class:`wp:w-full sm:wp:w-auto`},{default:(0,t.withCtx)(()=>[...r[9]||=[(0,t.createTextVNode)(` Cancelar `,-1)]]),_:1}),(0,t.createVNode)((0,t.unref)(Q),{onClick:r[3]||=e=>d(`blind`),disabled:!a.value.trim(),variant:`outline`,class:`wp:w-full sm:wp:flex-1`},{default:(0,t.withCtx)(()=>[...r[10]||=[(0,t.createTextVNode)(` Transferencia Ciega `,-1)]]),_:1},8,[`disabled`]),(0,t.createVNode)((0,t.unref)(Q),{onClick:r[4]||=e=>d(`attended`),disabled:!a.value.trim(),class:`wp:w-full sm:wp:flex-1`},{default:(0,t.withCtx)(()=>[...r[11]||=[(0,t.createTextVNode)(` Con Consulta `,-1)]]),_:1},8,[`disabled`])]),_:1})]),_:1})]),_:1},8,[`open`])):(0,t.createCommentVNode)(``,!0)}}),ff=(0,t.defineComponent)({__name:`DocumentPip`,props:{remoteStream:{},localStream:{},hasVideo:{type:Boolean},remoteNumber:{},isConnected:{type:Boolean},callStatus:{},isMuted:{type:Boolean},isHeld:{type:Boolean},destination:{},isVideo:{type:Boolean},active:{type:Boolean},autoOpenOnBlur:{type:Boolean}},emits:[`transfer`,`update:active`,`hangup`,`answer`,`toggleMute`,`toggleHold`],setup(e,{expose:n,emit:r}){let i=e,a=r,o=(0,t.ref)(!1),s=(0,t.ref)(!1),c=(0,t.ref)(null),l=(0,t.ref)(0),u=(0,t.ref)(null),d=null;(0,t.onMounted)(()=>{o.value=`documentPictureInPicture`in window,document.addEventListener(`visibilitychange`,f)}),(0,t.onUnmounted)(()=>{document.removeEventListener(`visibilitychange`,f),m(),D()});let f=()=>{i.callStatus===`idle`||!o.value||document.hidden&&!s.value&&i.autoOpenOnBlur!==!1&&setTimeout(()=>{document.hidden&&!s.value&&ee()},100)},p=()=>{u.value||=(l.value=0,setInterval(()=>{l.value++},1e3))},m=()=>{u.value&&=(clearInterval(u.value),null)},h=e=>{let t=Math.floor(e/60),n=e%60;return`${t.toString().padStart(2,`0`)}:${n.toString().padStart(2,`0`)}`};(0,t.watch)(()=>i.callStatus,(e,t)=>{e===`connected`&&t!==`connected`?p():e===`idle`&&t!==`idle`&&(m(),s.value&&D())},{immediate:!0}),(0,t.watch)(()=>i.isConnected,e=>{!e&&s.value&&(m(),D())}),(0,t.watch)(()=>[i.callStatus,i.isMuted,i.isHeld],()=>{c.value&&(C(c.value.document),x(c.value.document))});let g=(0,t.computed)(()=>o.value&&i.isConnected),_={phone:`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"/></svg>`,phoneOff:`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z" transform="rotate(135 12 12)"/><line x1="1" y1="1" x2="23" y2="23"/></svg>`,mic:`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z"/><path d="M19 10v2a7 7 0 0 1-14 0v-2"/><line x1="12" x2="12" y1="19" y2="22"/></svg>`,micOff:`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="2" x2="22" y1="2" y2="22"/><path d="M18.89 13.23A7.12 7.12 0 0 0 19 12v-2"/><path d="M5 10v2a7 7 0 0 0 12 5"/><path d="M15 9.34V5a3 3 0 0 0-5.68-1.33"/><path d="M9 9v3a3 3 0 0 0 5.12 2.12"/><line x1="12" x2="12" y1="19" y2="22"/></svg>`,pause:`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="14" y="4" width="4" height="16" rx="1"/><rect x="6" y="4" width="4" height="16" rx="1"/></svg>`,play:`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polygon points="6 3 20 12 6 21 6 3"/></svg>`,transfer:`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m16 3 4 4-4 4"/><path d="M20 7H4"/><path d="m8 21-4-4 4-4"/><path d="M4 17h16"/></svg>`,video:`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5"/><rect x="2" y="6" width="14" height="12" rx="2"/></svg>`,user:`<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/></svg>`},v=e=>{let t=e.createElement(`style`);t.textContent=`
63
+ For more information, see https://www.reka-ui.com/docs/components/${r}`,c=`Warning: Missing \`Description\` or \`aria-describedby="undefined"\` for ${n}.`;(0,t.onMounted)(()=>{document.getElementById(i)||console.warn(s);let e=o.value?.getAttribute(`aria-describedby`);a&&e&&(document.getElementById(a)||console.warn(c))})}var aa=(0,t.defineComponent)({__name:`DialogContentImpl`,props:{forceMount:{type:Boolean,required:!1},trapFocus:{type:Boolean,required:!1},disableOutsidePointerEvents:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`escapeKeyDown`,`pointerDownOutside`,`focusOutside`,`interactOutside`,`openAutoFocus`,`closeAutoFocus`],setup(e,{emit:n}){let r=e,i=n,a=Ei(),{forwardRef:o,currentElement:s}=Y();return a.titleId||=mi(void 0,`reka-dialog-title`),a.descriptionId||=mi(void 0,`reka-dialog-description`),(0,t.onMounted)(()=>{a.contentElement=s,yr()!==document.body&&(a.triggerElement.value=yr())}),process.env.NODE_ENV!==`production`&&ia({titleName:`DialogTitle`,contentName:`DialogContent`,componentLink:`dialog.html#title`,titleId:a.titleId,descriptionId:a.descriptionId,contentElement:s}),(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Xi),{"as-child":``,loop:``,trapped:r.trapFocus,onMountAutoFocus:n[5]||=e=>i(`openAutoFocus`,e),onUnmountAutoFocus:n[6]||=e=>i(`closeAutoFocus`,e)},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(Ii),(0,t.mergeProps)({id:(0,t.unref)(a).contentId,ref:(0,t.unref)(o),as:e.as,"as-child":e.asChild,"disable-outside-pointer-events":e.disableOutsidePointerEvents,role:`dialog`,"aria-describedby":(0,t.unref)(a).descriptionId,"aria-labelledby":(0,t.unref)(a).titleId,"data-state":(0,t.unref)(ea)((0,t.unref)(a).open.value)},e.$attrs,{onDismiss:n[0]||=e=>(0,t.unref)(a).onOpenChange(!1),onEscapeKeyDown:n[1]||=e=>i(`escapeKeyDown`,e),onFocusOutside:n[2]||=e=>i(`focusOutside`,e),onInteractOutside:n[3]||=e=>i(`interactOutside`,e),onPointerDownOutside:n[4]||=e=>i(`pointerDownOutside`,e)}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16,[`id`,`as`,`as-child`,`disable-outside-pointer-events`,`aria-describedby`,`aria-labelledby`,`data-state`])]),_:3},8,[`trapped`]))}}),oa=(0,t.defineComponent)({__name:`DialogContentModal`,props:{forceMount:{type:Boolean,required:!1},trapFocus:{type:Boolean,required:!1},disableOutsidePointerEvents:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`escapeKeyDown`,`pointerDownOutside`,`focusOutside`,`interactOutside`,`openAutoFocus`,`closeAutoFocus`],setup(e,{emit:n}){let r=e,i=n,a=Ei(),o=Ur(i),{forwardRef:s,currentElement:c}=Y();return fi(c),(e,n)=>((0,t.openBlock)(),(0,t.createBlock)(aa,(0,t.mergeProps)({...r,...(0,t.unref)(o)},{ref:(0,t.unref)(s),"trap-focus":(0,t.unref)(a).open.value,"disable-outside-pointer-events":!0,onCloseAutoFocus:n[0]||=e=>{e.defaultPrevented||(e.preventDefault(),(0,t.unref)(a).triggerElement.value?.focus())},onPointerDownOutside:n[1]||=e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()},onFocusOutside:n[2]||=e=>{e.preventDefault()}}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16,[`trap-focus`]))}}),sa=(0,t.defineComponent)({__name:`DialogContentNonModal`,props:{forceMount:{type:Boolean,required:!1},trapFocus:{type:Boolean,required:!1},disableOutsidePointerEvents:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`escapeKeyDown`,`pointerDownOutside`,`focusOutside`,`interactOutside`,`openAutoFocus`,`closeAutoFocus`],setup(e,{emit:n}){let r=e,i=Ur(n);Y();let a=Ei(),o=(0,t.ref)(!1),s=(0,t.ref)(!1);return(e,n)=>((0,t.openBlock)(),(0,t.createBlock)(aa,(0,t.mergeProps)({...r,...(0,t.unref)(i)},{"trap-focus":!1,"disable-outside-pointer-events":!1,onCloseAutoFocus:n[0]||=e=>{e.defaultPrevented||(o.value||(0,t.unref)(a).triggerElement.value?.focus(),e.preventDefault()),o.value=!1,s.value=!1},onInteractOutside:n[1]||=e=>{e.defaultPrevented||(o.value=!0,e.detail.originalEvent.type===`pointerdown`&&(s.value=!0));let n=e.target;(0,t.unref)(a).triggerElement.value?.contains(n)&&e.preventDefault(),e.detail.originalEvent.type===`focusin`&&s.value&&e.preventDefault()}}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16))}}),ca=(0,t.defineComponent)({__name:`DialogContent`,props:{forceMount:{type:Boolean,required:!1},disableOutsidePointerEvents:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`escapeKeyDown`,`pointerDownOutside`,`focusOutside`,`interactOutside`,`openAutoFocus`,`closeAutoFocus`],setup(e,{emit:n}){let r=e,i=n,a=Ei(),o=Ur(i),{forwardRef:s}=Y();return(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Si),{present:e.forceMount||(0,t.unref)(a).open.value},{default:(0,t.withCtx)(()=>[(0,t.unref)(a).modal.value?((0,t.openBlock)(),(0,t.createBlock)(oa,(0,t.mergeProps)({key:0,ref:(0,t.unref)(s)},{...r,...(0,t.unref)(o),...e.$attrs}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16)):((0,t.openBlock)(),(0,t.createBlock)(sa,(0,t.mergeProps)({key:1,ref:(0,t.unref)(s)},{...r,...(0,t.unref)(o),...e.$attrs}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16))]),_:3},8,[`present`]))}}),la=(0,t.defineComponent)({__name:`DialogOverlayImpl`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let n=Ei();return zr(!0),Y(),(e,r)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(X),{as:e.as,"as-child":e.asChild,"data-state":(0,t.unref)(n).open.value?`open`:`closed`,style:{"pointer-events":`auto`}},{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},8,[`as`,`as-child`,`data-state`]))}}),ua=(0,t.defineComponent)({__name:`DialogOverlay`,props:{forceMount:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let n=Ei(),{forwardRef:r}=Y();return(e,i)=>(0,t.unref)(n)?.modal.value?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Si),{key:0,present:e.forceMount||(0,t.unref)(n).open.value},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(la,(0,t.mergeProps)(e.$attrs,{ref:(0,t.unref)(r),as:e.as,"as-child":e.asChild}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16,[`as`,`as-child`])]),_:3},8,[`present`])):(0,t.createCommentVNode)(`v-if`,!0)}}),da=(0,t.defineComponent)({__name:`Teleport`,props:{to:{type:null,required:!1,default:`body`},disabled:{type:Boolean,required:!1},defer:{type:Boolean,required:!1},forceMount:{type:Boolean,required:!1}},setup(e){let r=(0,n.useMounted)();return(e,n)=>(0,t.unref)(r)||e.forceMount?((0,t.openBlock)(),(0,t.createBlock)(t.Teleport,{key:0,to:e.to,disabled:e.disabled,defer:e.defer},[(0,t.renderSlot)(e.$slots,`default`)],8,[`to`,`disabled`,`defer`])):(0,t.createCommentVNode)(`v-if`,!0)}}),fa=(0,t.defineComponent)({__name:`DialogPortal`,props:{to:{type:null,required:!1},disabled:{type:Boolean,required:!1},defer:{type:Boolean,required:!1},forceMount:{type:Boolean,required:!1}},setup(e){let n=e;return(e,r)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(da),(0,t.normalizeProps)((0,t.guardReactiveProps)(n)),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16))}}),pa=(0,t.defineComponent)({__name:`DialogTitle`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`h2`}},setup(e){let n=e,r=Ei();return Y(),(e,i)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(X),(0,t.mergeProps)(n,{id:(0,t.unref)(r).titleId}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16,[`id`]))}}),ma=`data-reka-collection-item`;function ha(e={}){let{key:n=``,isProvider:r=!1}=e,i=`${n}CollectionProvider`,a;if(r){let e=(0,t.ref)(new Map);a={collectionRef:(0,t.ref)(),itemMap:e},(0,t.provide)(i,a)}else a=(0,t.inject)(i);let o=(e=!1)=>{let t=a.collectionRef.value;if(!t)return[];let n=Array.from(t.querySelectorAll(`[${ma}]`)),r=Array.from(a.itemMap.value.values()).sort((e,t)=>n.indexOf(e.ref)-n.indexOf(t.ref));return e?r:r.filter(e=>e.ref.dataset.disabled!==``)},s=(0,t.defineComponent)({name:`CollectionSlot`,inheritAttrs:!1,setup(e,{slots:n,attrs:r}){let{primitiveElement:i,currentElement:o}=Ti();return(0,t.watch)(o,()=>{a.collectionRef.value=o.value}),()=>(0,t.h)(Ci,{ref:i,...r},n)}}),c=(0,t.defineComponent)({name:`CollectionItem`,inheritAttrs:!1,props:{value:{validator:()=>!0}},setup(e,{slots:n,attrs:r}){let{primitiveElement:i,currentElement:o}=Ti();return(0,t.watchEffect)(n=>{if(o.value){let r=(0,t.markRaw)(o.value);a.itemMap.value.set(r,{ref:o.value,value:e.value}),n(()=>a.itemMap.value.delete(r))}}),()=>(0,t.h)(Ci,{...r,[ma]:``,ref:i},n)}});return{getItems:o,reactiveItems:(0,t.computed)(()=>Array.from(a.itemMap.value.values())),itemMapSize:(0,t.computed)(()=>a.itemMap.value.size),CollectionSlot:s,CollectionItem:c}}var ga=(0,t.defineComponent)({__name:`VisuallyHidden`,props:{feature:{type:String,required:!1,default:`focusable`},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`span`}},setup(e){return(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(X),{as:e.as,"as-child":e.asChild,"aria-hidden":e.feature===`focusable`?`true`:void 0,"data-hidden":e.feature===`fully-hidden`?``:void 0,tabindex:e.feature===`fully-hidden`?`-1`:void 0,style:{position:`absolute`,border:0,width:`1px`,height:`1px`,padding:0,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,clipPath:`inset(50%)`,whiteSpace:`nowrap`,wordWrap:`normal`,top:`-1px`,left:`-1px`}},{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},8,[`as`,`as-child`,`aria-hidden`,`data-hidden`,`tabindex`]))}}),_a=(0,t.defineComponent)({inheritAttrs:!1,__name:`VisuallyHiddenInputBubble`,props:{name:{type:String,required:!0},value:{type:null,required:!0},checked:{type:Boolean,required:!1,default:void 0},required:{type:Boolean,required:!1},disabled:{type:Boolean,required:!1},feature:{type:String,required:!1,default:`fully-hidden`}},setup(e){let n=e,{primitiveElement:r,currentElement:i}=Ti();return(0,t.watch)((0,t.computed)(()=>n.checked??n.value),(e,t)=>{if(!i.value)return;let n=i.value,r=window.HTMLInputElement.prototype,a=Object.getOwnPropertyDescriptor(r,`value`).set;if(a&&e!==t){let t=new Event(`input`,{bubbles:!0}),r=new Event(`change`,{bubbles:!0});a.call(n,e),n.dispatchEvent(t),n.dispatchEvent(r)}}),(e,i)=>((0,t.openBlock)(),(0,t.createBlock)(ga,(0,t.mergeProps)({ref_key:`primitiveElement`,ref:r},{...n,...e.$attrs},{as:`input`}),null,16))}}),va=(0,t.defineComponent)({inheritAttrs:!1,__name:`VisuallyHiddenInput`,props:{name:{type:String,required:!0},value:{type:null,required:!0},checked:{type:Boolean,required:!1,default:void 0},required:{type:Boolean,required:!1},disabled:{type:Boolean,required:!1},feature:{type:String,required:!1,default:`fully-hidden`}},setup(e){let n=e,r=(0,t.computed)(()=>typeof n.value==`object`&&Array.isArray(n.value)&&n.value.length===0&&n.required),i=(0,t.computed)(()=>typeof n.value==`string`||typeof n.value==`number`||typeof n.value==`boolean`||n.value===null||n.value===void 0?[{name:n.name,value:n.value}]:typeof n.value==`object`&&Array.isArray(n.value)?n.value.flatMap((e,t)=>typeof e==`object`?Object.entries(e).map(([e,r])=>({name:`${n.name}[${t}][${e}]`,value:r})):{name:`${n.name}[${t}]`,value:e}):n.value!==null&&typeof n.value==`object`&&!Array.isArray(n.value)?Object.entries(n.value).map(([e,t])=>({name:`${n.name}[${e}]`,value:t})):[]);return(e,a)=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,null,[(0,t.createCommentVNode)(` We render single input if it's required `),r.value?((0,t.openBlock)(),(0,t.createBlock)(_a,(0,t.mergeProps)({key:e.name},{...n,...e.$attrs},{name:e.name,value:e.value}),null,16,[`name`,`value`])):((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,{key:1},(0,t.renderList)(i.value,r=>((0,t.openBlock)(),(0,t.createBlock)(_a,(0,t.mergeProps)({key:r.name},{ref_for:!0},{...n,...e.$attrs},{name:r.name,value:r.value}),null,16,[`name`,`value`]))),128))],2112))}}),[ya,ba]=vr(`PopperRoot`),xa=(0,t.defineComponent)({inheritAttrs:!1,__name:`PopperRoot`,setup(e){let n=(0,t.ref)();return ba({anchor:n,onAnchorChange:e=>n.value=e}),(e,n)=>(0,t.renderSlot)(e.$slots,`default`)}}),Sa=(0,t.defineComponent)({__name:`PopperAnchor`,props:{reference:{type:null,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let n=e,{forwardRef:r,currentElement:i}=Y(),a=ya();return(0,t.watchPostEffect)(()=>{a.onAnchorChange(n.reference??i.value)}),(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(X),{ref:(0,t.unref)(r),as:e.as,"as-child":e.asChild},{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},8,[`as`,`as-child`]))}}),Ca={key:0,d:`M0 0L6 6L12 0`},wa={key:1,d:`M0 0L4.58579 4.58579C5.36683 5.36683 6.63316 5.36684 7.41421 4.58579L12 0`},Ta=(0,t.defineComponent)({__name:`Arrow`,props:{width:{type:Number,required:!1,default:10},height:{type:Number,required:!1,default:5},rounded:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`svg`}},setup(e){let n=e;return Y(),(e,r)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(X),(0,t.mergeProps)(n,{width:e.width,height:e.height,viewBox:e.asChild?void 0:`0 0 12 6`,preserveAspectRatio:e.asChild?void 0:`none`}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`,{},()=>[e.rounded?((0,t.openBlock)(),(0,t.createElementBlock)(`path`,wa)):((0,t.openBlock)(),(0,t.createElementBlock)(`path`,Ca))])]),_:3},16,[`width`,`height`,`viewBox`,`preserveAspectRatio`]))}});function Ea(e){return e!==null}function Da(e){return{name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=Oa(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}}}function Oa(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var ka=[`top`,`right`,`bottom`,`left`],Aa=Math.min,ja=Math.max,Ma=Math.round,Na=Math.floor,Pa=e=>({x:e,y:e}),Fa={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Ia(e,t,n){return ja(e,Aa(t,n))}function La(e,t){return typeof e==`function`?e(t):e}function Ra(e){return e.split(`-`)[0]}function za(e){return e.split(`-`)[1]}function Ba(e){return e===`x`?`y`:`x`}function Va(e){return e===`y`?`height`:`width`}function Ha(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Ua(e){return Ba(Ha(e))}function Wa(e,t,n){n===void 0&&(n=!1);let r=za(e),i=Ua(e),a=Va(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=$a(o)),[o,$a(o)]}function Ga(e){let t=$a(e);return[Ka(e),t,Ka(t)]}function Ka(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var qa=[`left`,`right`],Ja=[`right`,`left`],Ya=[`top`,`bottom`],Xa=[`bottom`,`top`];function Za(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Ja:qa:t?qa:Ja;case`left`:case`right`:return t?Ya:Xa;default:return[]}}function Qa(e,t,n,r){let i=za(e),a=Za(Ra(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Ka)))),a}function $a(e){let t=Ra(e);return Fa[t]+e.slice(t.length)}function eo(e){return{top:0,right:0,bottom:0,left:0,...e}}function to(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:eo(e)}function no(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function ro(e,t,n){let{reference:r,floating:i}=e,a=Ha(t),o=Ua(t),s=Va(o),c=Ra(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(za(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function io(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=La(t,e),p=to(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=no(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=no(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var ao=50,oo=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:io},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=ro(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<ao&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=ro(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},so=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=La(e,t)||{};if(l==null)return{};let d=to(u),f={x:n,y:r},p=Ua(i),m=Va(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=Aa(d[_],T),ee=Aa(d[v],T),D=E,te=C-h[m]-ee,O=C/2-h[m]/2+w,ne=Ia(D,O,te),k=!c.arrow&&za(i)!=null&&O!==ne&&a.reference[m]/2-(O<D?E:ee)-h[m]/2<0,re=k?O<D?O-D:O-te:0;return{[p]:f[p]+re,data:{[p]:ne,centerOffset:O-ne-re,...k&&{alignmentOffset:re}},reset:k}}}),co=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=La(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=Ra(r),_=Ha(o),v=Ra(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[$a(o)]:Ga(o)),x=p!==`none`;!d&&x&&b.push(...Qa(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=Wa(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==Ha(t))||T.every(e=>Ha(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=Ha(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function lo(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function uo(e){return ka.some(t=>e[t]>=0)}var fo=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=La(e,t);switch(i){case`referenceHidden`:{let e=lo(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:uo(e)}}}case`escaped`:{let e=lo(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:uo(e)}}}default:return{}}}}},po=new Set([`left`,`top`]);async function mo(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Ra(n),s=za(n),c=Ha(n)===`y`,l=po.has(o)?-1:1,u=a&&c?-1:1,d=La(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var ho=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await mo(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},go=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=La(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Ha(Ra(i)),p=Ba(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=Ia(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=Ia(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},_o=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=La(e,t),u={x:n,y:r},d=Ha(i),f=Ba(d),p=u[f],m=u[d],h=La(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=po.has(Ra(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},vo=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=La(e,t),u=await o.detectOverflow(t,l),d=Ra(i),f=za(i),p=Ha(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=Aa(h-u[g],v),x=Aa(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=ja(u.left,0),t=ja(u.right,0),n=ja(u.top,0),r=ja(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:ja(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:ja(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function yo(){return typeof window<`u`}function bo(e){return Co(e)?(e.nodeName||``).toLowerCase():`#document`}function xo(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function So(e){return((Co(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Co(e){return yo()?e instanceof Node||e instanceof xo(e).Node:!1}function wo(e){return yo()?e instanceof Element||e instanceof xo(e).Element:!1}function To(e){return yo()?e instanceof HTMLElement||e instanceof xo(e).HTMLElement:!1}function Eo(e){return!yo()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof xo(e).ShadowRoot}function Do(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Ro(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Oo(e){return/^(table|td|th)$/.test(bo(e))}function ko(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Ao=/transform|translate|scale|rotate|perspective|filter/,jo=/paint|layout|strict|content/,Mo=e=>!!e&&e!==`none`,No;function Po(e){let t=wo(e)?Ro(e):e;return Mo(t.transform)||Mo(t.translate)||Mo(t.scale)||Mo(t.rotate)||Mo(t.perspective)||!Io()&&(Mo(t.backdropFilter)||Mo(t.filter))||Ao.test(t.willChange||``)||jo.test(t.contain||``)}function Fo(e){let t=Bo(e);for(;To(t)&&!Lo(t);){if(Po(t))return t;if(ko(t))return null;t=Bo(t)}return null}function Io(){return No??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),No}function Lo(e){return/^(html|body|#document)$/.test(bo(e))}function Ro(e){return xo(e).getComputedStyle(e)}function zo(e){return wo(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Bo(e){if(bo(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Eo(e)&&e.host||So(e);return Eo(t)?t.host:t}function Vo(e){let t=Bo(e);return Lo(t)?e.ownerDocument?e.ownerDocument.body:e.body:To(t)&&Do(t)?t:Vo(t)}function Ho(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Vo(e),i=r===e.ownerDocument?.body,a=xo(r);if(i){let e=Uo(a);return t.concat(a,a.visualViewport||[],Do(r)?r:[],e&&n?Ho(e):[])}else return t.concat(r,Ho(r,[],n))}function Uo(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Wo(e){let t=Ro(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=To(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Ma(n)!==a||Ma(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Go(e){return wo(e)?e:e.contextElement}function Ko(e){let t=Go(e);if(!To(t))return Pa(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Wo(t),o=(a?Ma(n.width):n.width)/r,s=(a?Ma(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var qo=Pa(0);function Jo(e){let t=xo(e);return!Io()||!t.visualViewport?qo:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Yo(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==xo(e)?!1:t}function Xo(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Go(e),o=Pa(1);t&&(r?wo(r)&&(o=Ko(r)):o=Ko(e));let s=Yo(a,n,r)?Jo(a):Pa(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=xo(a),t=r&&wo(r)?xo(r):r,n=e,i=Uo(n);for(;i&&r&&t!==n;){let e=Ko(i),t=i.getBoundingClientRect(),r=Ro(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=xo(i),i=Uo(n)}}return no({width:u,height:d,x:c,y:l})}function Zo(e,t){let n=zo(e).scrollLeft;return t?t.left+n:Xo(So(e)).left+n}function Qo(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Zo(e,n),y:n.top+t.scrollTop}}function $o(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=So(r),s=t?ko(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Pa(1),u=Pa(0),d=To(r);if((d||!d&&!a)&&((bo(r)!==`body`||Do(o))&&(c=zo(r)),d)){let e=Xo(r);l=Ko(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Qo(o,c):Pa(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function es(e){return Array.from(e.getClientRects())}function ts(e){let t=So(e),n=zo(e),r=e.ownerDocument.body,i=ja(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=ja(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+Zo(e),s=-n.scrollTop;return Ro(r).direction===`rtl`&&(o+=ja(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var ns=25;function rs(e,t){let n=xo(e),r=So(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=Io();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=Zo(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=ns&&(a-=o)}else l<=ns&&(a+=l);return{width:a,height:o,x:s,y:c}}function is(e,t){let n=Xo(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=To(e)?Ko(e):Pa(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function as(e,t,n){let r;if(t===`viewport`)r=rs(e,n);else if(t===`document`)r=ts(So(e));else if(wo(t))r=is(t,n);else{let n=Jo(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return no(r)}function os(e,t){let n=Bo(e);return n===t||!wo(n)||Lo(n)?!1:Ro(n).position===`fixed`||os(n,t)}function ss(e,t){let n=t.get(e);if(n)return n;let r=Ho(e,[],!1).filter(e=>wo(e)&&bo(e)!==`body`),i=null,a=Ro(e).position===`fixed`,o=a?Bo(e):e;for(;wo(o)&&!Lo(o);){let t=Ro(o),n=Po(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||Do(o)&&!n&&os(e,o))?r=r.filter(e=>e!==o):i=t,o=Bo(o)}return t.set(e,r),r}function cs(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?ko(t)?[]:ss(t,this._c):[].concat(n),r],o=as(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=as(t,a[e],i);s=ja(n.top,s),c=Aa(n.right,c),l=Aa(n.bottom,l),u=ja(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function ls(e){let{width:t,height:n}=Wo(e);return{width:t,height:n}}function us(e,t,n){let r=To(t),i=So(t),a=n===`fixed`,o=Xo(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=Pa(0);function l(){c.x=Zo(i)}if(r||!r&&!a)if((bo(t)!==`body`||Do(i))&&(s=zo(t)),r){let e=Xo(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?Qo(i,s):Pa(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function ds(e){return Ro(e).position===`static`}function fs(e,t){if(!To(e)||Ro(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return So(e)===n&&(n=n.ownerDocument.body),n}function ps(e,t){let n=xo(e);if(ko(e))return n;if(!To(e)){let t=Bo(e);for(;t&&!Lo(t);){if(wo(t)&&!ds(t))return t;t=Bo(t)}return n}let r=fs(e,t);for(;r&&Oo(r)&&ds(r);)r=fs(r,t);return r&&Lo(r)&&ds(r)&&!Po(r)?n:r||Fo(e)||n}var ms=async function(e){let t=this.getOffsetParent||ps,n=this.getDimensions,r=await n(e.floating);return{reference:us(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function hs(e){return Ro(e).direction===`rtl`}var gs={convertOffsetParentRelativeRectToViewportRelativeRect:$o,getDocumentElement:So,getClippingRect:cs,getOffsetParent:ps,getElementRects:ms,getClientRects:es,getDimensions:ls,getScale:Ko,isElement:wo,isRTL:hs};function _s(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function vs(e,t){let n=null,r,i=So(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=Na(d),h=Na(i.clientWidth-(u+f)),g=Na(i.clientHeight-(d+p)),_=Na(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:ja(0,Aa(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!_s(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function ys(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Go(e),u=i||a?[...l?Ho(l):[],...t?Ho(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?vs(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?Xo(e):null;c&&g();function g(){let t=Xo(e);h&&!_s(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var bs=ho,xs=go,Ss=co,Cs=vo,ws=fo,Ts=so,Es=_o,Ds=(e,t,n)=>{let r=new Map,i={platform:gs,...n},a={...i.platform,_c:r};return oo(e,t,{...i,platform:a})},Z=l({Vue:()=>t,Vue2:()=>void 0,del:()=>As,install:()=>Os,isVue2:()=>!1,isVue3:()=>!0,set:()=>ks},1);d(Z,require(`vue`),void 0,1);function Os(){}function ks(e,t,n){return Array.isArray(e)?(e.length=Math.max(e.length,t),e.splice(t,1,n),n):(e[t]=n,n)}function As(e,t){if(Array.isArray(e)){e.splice(t,1);return}delete e[t]}function js(e){return typeof e==`object`&&!!e&&`$el`in e}function Ms(e){if(js(e)){let t=e.$el;return Co(t)&&bo(t)===`#comment`?null:t}return e}function Ns(e){return typeof e==`function`?e():(0,Z.unref)(e)}function Ps(e){return{name:`arrow`,options:e,fn(t){let n=Ms(Ns(e.element));return n==null?{}:Ts({element:n,padding:e.padding}).fn(t)}}}function Fs(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Is(e,t){let n=Fs(e);return Math.round(t*n)/n}function Ls(e,t,n){n===void 0&&(n={});let r=n.whileElementsMounted,i=(0,Z.computed)(()=>Ns(n.open)??!0),a=(0,Z.computed)(()=>Ns(n.middleware)),o=(0,Z.computed)(()=>Ns(n.placement)??`bottom`),s=(0,Z.computed)(()=>Ns(n.strategy)??`absolute`),c=(0,Z.computed)(()=>Ns(n.transform)??!0),l=(0,Z.computed)(()=>Ms(e.value)),u=(0,Z.computed)(()=>Ms(t.value)),d=(0,Z.ref)(0),f=(0,Z.ref)(0),p=(0,Z.ref)(s.value),m=(0,Z.ref)(o.value),h=(0,Z.shallowRef)({}),g=(0,Z.ref)(!1),_=(0,Z.computed)(()=>{let e={position:p.value,left:`0`,top:`0`};if(!u.value)return e;let t=Is(u.value,d.value),n=Is(u.value,f.value);return c.value?{...e,transform:`translate(`+t+`px, `+n+`px)`,...Fs(u.value)>=1.5&&{willChange:`transform`}}:{position:p.value,left:t+`px`,top:n+`px`}}),v;function y(){if(l.value==null||u.value==null)return;let e=i.value;Ds(l.value,u.value,{middleware:a.value,placement:o.value,strategy:s.value}).then(t=>{d.value=t.x,f.value=t.y,p.value=t.strategy,m.value=t.placement,h.value=t.middlewareData,g.value=e!==!1})}function b(){typeof v==`function`&&(v(),v=void 0)}function x(){if(b(),r===void 0){y();return}if(l.value!=null&&u.value!=null){v=r(l.value,u.value,y);return}}function S(){i.value||(g.value=!1)}return(0,Z.watch)([a,o,s,i],y,{flush:`sync`}),(0,Z.watch)([l,u],x,{flush:`sync`}),(0,Z.watch)(i,S,{flush:`sync`}),(0,Z.getCurrentScope)()&&(0,Z.onScopeDispose)(b),{x:(0,Z.shallowReadonly)(d),y:(0,Z.shallowReadonly)(f),strategy:(0,Z.shallowReadonly)(p),placement:(0,Z.shallowReadonly)(m),middlewareData:(0,Z.shallowReadonly)(h),isPositioned:(0,Z.shallowReadonly)(g),floatingStyles:_,update:y}}var Rs={side:`bottom`,sideOffset:0,sideFlip:!0,align:`center`,alignOffset:0,alignFlip:!0,arrowPadding:0,hideShiftedArrow:!0,avoidCollisions:!0,collisionBoundary:()=>[],collisionPadding:0,sticky:`partial`,hideWhenDetached:!1,positionStrategy:`fixed`,updatePositionStrategy:`optimized`,prioritizePosition:!1},[zs,Bs]=vr(`PopperContent`),Vs=(0,t.defineComponent)({inheritAttrs:!1,__name:`PopperContent`,props:(0,t.mergeDefaults)({side:{type:null,required:!1},sideOffset:{type:Number,required:!1},sideFlip:{type:Boolean,required:!1},align:{type:null,required:!1},alignOffset:{type:Number,required:!1},alignFlip:{type:Boolean,required:!1},avoidCollisions:{type:Boolean,required:!1},collisionBoundary:{type:null,required:!1},collisionPadding:{type:[Number,Object],required:!1},arrowPadding:{type:Number,required:!1},hideShiftedArrow:{type:Boolean,required:!1},sticky:{type:String,required:!1},hideWhenDetached:{type:Boolean,required:!1},positionStrategy:{type:String,required:!1},updatePositionStrategy:{type:String,required:!1},disableUpdateOnLayoutShift:{type:Boolean,required:!1},prioritizePosition:{type:Boolean,required:!1},reference:{type:null,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},{...Rs}),emits:[`placed`],setup(e,{emit:r}){let i=e,a=r,o=ya(),{forwardRef:s,currentElement:c}=Y(),l=(0,t.ref)(),u=(0,t.ref)(),{width:d,height:f}=hi(u),p=(0,t.computed)(()=>i.side+(i.align===`center`?``:`-${i.align}`)),m=(0,t.computed)(()=>typeof i.collisionPadding==`number`?i.collisionPadding:{top:0,right:0,bottom:0,left:0,...i.collisionPadding}),h=(0,t.computed)(()=>Array.isArray(i.collisionBoundary)?i.collisionBoundary:[i.collisionBoundary]),g=(0,t.computed)(()=>({padding:m.value,boundary:h.value.filter(Ea),altBoundary:h.value.length>0})),_=(0,t.computed)(()=>({mainAxis:i.sideFlip,crossAxis:i.alignFlip})),v=(0,n.computedEager)(()=>[bs({mainAxis:i.sideOffset+f.value,alignmentAxis:i.alignOffset}),i.prioritizePosition&&i.avoidCollisions&&Ss({...g.value,..._.value}),i.avoidCollisions&&xs({mainAxis:!0,crossAxis:!!i.prioritizePosition,limiter:i.sticky===`partial`?Es():void 0,...g.value}),!i.prioritizePosition&&i.avoidCollisions&&Ss({...g.value,..._.value}),Cs({...g.value,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--reka-popper-available-width`,`${n}px`),o.setProperty(`--reka-popper-available-height`,`${r}px`),o.setProperty(`--reka-popper-anchor-width`,`${i}px`),o.setProperty(`--reka-popper-anchor-height`,`${a}px`)}}),u.value&&Ps({element:u.value,padding:i.arrowPadding}),Da({arrowWidth:d.value,arrowHeight:f.value}),i.hideWhenDetached&&ws({strategy:`referenceHidden`,...g.value})]),{floatingStyles:y,placement:b,isPositioned:x,middlewareData:S,update:C}=Ls((0,t.computed)(()=>i.reference??o.anchor.value),l,{strategy:i.positionStrategy,placement:p,whileElementsMounted:(...e)=>ys(...e,{layoutShift:!i.disableUpdateOnLayoutShift,animationFrame:i.updatePositionStrategy===`always`}),middleware:v}),w=(0,t.computed)(()=>Oa(b.value)[0]),T=(0,t.computed)(()=>Oa(b.value)[1]);(0,t.watchPostEffect)(()=>{x.value&&a(`placed`)});let E=(0,t.computed)(()=>{let e=S.value.arrow?.centerOffset!==0;return i.hideShiftedArrow&&e}),ee=(0,t.ref)(``);return(0,t.watchEffect)(()=>{c.value&&(ee.value=window.getComputedStyle(c.value).zIndex)}),Bs({placedSide:w,onArrowChange:e=>u.value=e,arrowX:(0,t.computed)(()=>S.value.arrow?.x??0),arrowY:(0,t.computed)(()=>S.value.arrow?.y??0),shouldHideArrow:E}),(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{ref_key:`floatingRef`,ref:l,"data-reka-popper-content-wrapper":``,style:(0,t.normalizeStyle)({...(0,t.unref)(y),transform:(0,t.unref)(x)?(0,t.unref)(y).transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:ee.value,"--reka-popper-transform-origin":[(0,t.unref)(S).transformOrigin?.x,(0,t.unref)(S).transformOrigin?.y].join(` `),...(0,t.unref)(S).hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}})},[(0,t.createVNode)((0,t.unref)(X),(0,t.mergeProps)({ref:(0,t.unref)(s)},e.$attrs,{"as-child":i.asChild,as:e.as,"data-side":w.value,"data-align":T.value,style:{animation:(0,t.unref)(x)?void 0:`none`}}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16,[`as-child`,`as`,`data-side`,`data-align`,`style`])],4))}}),Hs={top:`bottom`,right:`left`,bottom:`top`,left:`right`},Us=(0,t.defineComponent)({inheritAttrs:!1,__name:`PopperArrow`,props:{width:{type:Number,required:!1},height:{type:Number,required:!1},rounded:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`svg`}},setup(e){let{forwardRef:n}=Y(),r=zs(),i=(0,t.computed)(()=>Hs[r.placedSide.value]);return(e,a)=>((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{ref:e=>{(0,t.unref)(r).onArrowChange(e)},style:(0,t.normalizeStyle)({position:`absolute`,left:(0,t.unref)(r).arrowX?.value?`${(0,t.unref)(r).arrowX?.value}px`:void 0,top:(0,t.unref)(r).arrowY?.value?`${(0,t.unref)(r).arrowY?.value}px`:void 0,[i.value]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[(0,t.unref)(r).placedSide.value],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[(0,t.unref)(r).placedSide.value],visibility:(0,t.unref)(r).shouldHideArrow.value?`hidden`:void 0})},[(0,t.createVNode)(Ta,(0,t.mergeProps)(e.$attrs,{ref:(0,t.unref)(n),style:{display:`block`},as:e.as,"as-child":e.asChild,rounded:e.rounded,width:e.width,height:e.height}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16,[`as`,`as-child`,`rounded`,`width`,`height`])],4))}});function Ws(e){let n=Cr({nonce:(0,t.ref)()});return(0,t.computed)(()=>e?.value||n.nonce?.value)}function Gs(e=[],t,n){let r=[...e];return r[n]=t,r.sort((e,t)=>e-t)}function Ks(e,t,n){return _r(100/(n-t)*(e-t),0,100)}function qs(e,t){if(t>2)return`Value ${e+1} of ${t}`;if(t===2)return[`Minimum`,`Maximum`][e]}function Js(e,t){if(e.length===1)return 0;let n=e.map(e=>Math.abs(e-t)),r=Math.min(...n);return n.indexOf(r)}function Ys(e,t,n){let r=e/2;return(r-Qs([0,50],[0,r])(t)*n)*n}function Xs(e){return e.slice(0,-1).map((t,n)=>e[n+1]-t)}function Zs(e,t){if(t>0){let n=Xs(e);return Math.min(...n)>=t}return!0}function Qs(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function $s(e){return(String(e).split(`.`)[1]||``).length}function ec(e,t){let n=10**t;return Math.round(e*n)/n}var tc=[`PageUp`,`PageDown`],nc=[`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`],rc={"from-left":[`Home`,`PageDown`,`ArrowDown`,`ArrowLeft`],"from-right":[`Home`,`PageDown`,`ArrowDown`,`ArrowRight`],"from-bottom":[`Home`,`PageDown`,`ArrowDown`,`ArrowLeft`],"from-top":[`Home`,`PageUp`,`ArrowUp`,`ArrowLeft`]},[ic,ac]=vr([`SliderVertical`,`SliderHorizontal`]),oc=(0,t.defineComponent)({__name:`SliderHorizontal`,props:{dir:{type:String,required:!1},min:{type:Number,required:!0},max:{type:Number,required:!0},inverted:{type:Boolean,required:!0}},emits:[`slideEnd`,`slideStart`,`slideMove`,`homeKeyDown`,`endKeyDown`,`stepKeyDown`],setup(e,{emit:n}){let r=e,i=n,{max:a,min:o,dir:s,inverted:c}=(0,t.toRefs)(r),{forwardRef:l,currentElement:u}=Y(),d=cc(),f=(0,t.ref)(),p=(0,t.ref)(),m=(0,t.computed)(()=>s?.value!==`rtl`&&!c.value||s?.value!==`ltr`&&c.value);function h(e,t){let n=p.value||u.value.getBoundingClientRect(),r=[...d.thumbElements.value][d.valueIndexToChangeRef.value],i=d.thumbAlignment.value===`contain`?r.clientWidth:0;!f.value&&!t&&d.thumbAlignment.value===`contain`&&(f.value=e.clientX-r.getBoundingClientRect().left);let s=Qs([0,n.width-i],m.value?[o.value,a.value]:[a.value,o.value]);return p.value=n,s(t?e.clientX-n.left-i/2:e.clientX-n.left-(f.value??0))}return ac({startEdge:(0,t.computed)(()=>m.value?`left`:`right`),endEdge:(0,t.computed)(()=>m.value?`right`:`left`),direction:(0,t.computed)(()=>m.value?1:-1),size:`width`}),(e,n)=>((0,t.openBlock)(),(0,t.createBlock)(dc,{ref:(0,t.unref)(l),dir:(0,t.unref)(s),"data-orientation":`horizontal`,style:(0,t.normalizeStyle)({"--reka-slider-thumb-transform":!m.value&&(0,t.unref)(d).thumbAlignment.value===`overflow`?`translateX(50%)`:`translateX(-50%)`}),onSlideStart:n[0]||=e=>{i(`slideStart`,h(e,!0))},onSlideMove:n[1]||=e=>{i(`slideMove`,h(e))},onSlideEnd:n[2]||=()=>{p.value=void 0,f.value=void 0,i(`slideEnd`)},onStepKeyDown:n[3]||=e=>{let n=m.value?`from-left`:`from-right`;i(`stepKeyDown`,e,(0,t.unref)(rc)[n].includes(e.key)?-1:1)},onEndKeyDown:n[4]||=e=>i(`endKeyDown`,e),onHomeKeyDown:n[5]||=e=>i(`homeKeyDown`,e)},{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},8,[`dir`,`style`]))}}),sc=(0,t.defineComponent)({__name:`SliderVertical`,props:{min:{type:Number,required:!0},max:{type:Number,required:!0},inverted:{type:Boolean,required:!0}},emits:[`slideEnd`,`slideStart`,`slideMove`,`homeKeyDown`,`endKeyDown`,`stepKeyDown`],setup(e,{emit:n}){let r=e,i=n,{max:a,min:o,inverted:s}=(0,t.toRefs)(r),c=cc(),{forwardRef:l,currentElement:u}=Y(),d=(0,t.ref)(),f=(0,t.ref)(),p=(0,t.computed)(()=>!s.value);function m(e,t){let n=f.value||u.value.getBoundingClientRect(),r=[...c.thumbElements.value][c.valueIndexToChangeRef.value],i=c.thumbAlignment.value===`contain`?r.clientHeight:0;!d.value&&!t&&c.thumbAlignment.value===`contain`&&(d.value=e.clientY-r.getBoundingClientRect().top);let s=Qs([0,n.height-i],p.value?[a.value,o.value]:[o.value,a.value]),l=t?e.clientY-n.top-i/2:e.clientY-n.top-(d.value??0);return f.value=n,s(l)}return ac({startEdge:(0,t.computed)(()=>p.value?`bottom`:`top`),endEdge:(0,t.computed)(()=>p.value?`top`:`bottom`),direction:(0,t.computed)(()=>p.value?1:-1),size:`height`}),(e,n)=>((0,t.openBlock)(),(0,t.createBlock)(dc,{ref:(0,t.unref)(l),"data-orientation":`vertical`,style:(0,t.normalizeStyle)({"--reka-slider-thumb-transform":!p.value&&(0,t.unref)(c).thumbAlignment.value===`overflow`?`translateY(-50%)`:`translateY(50%)`}),onSlideStart:n[0]||=e=>{i(`slideStart`,m(e,!0))},onSlideMove:n[1]||=e=>{i(`slideMove`,m(e))},onSlideEnd:n[2]||=()=>{f.value=void 0,d.value=void 0,i(`slideEnd`)},onStepKeyDown:n[3]||=e=>{let n=p.value?`from-bottom`:`from-top`;i(`stepKeyDown`,e,(0,t.unref)(rc)[n].includes(e.key)?-1:1)},onEndKeyDown:n[4]||=e=>i(`endKeyDown`,e),onHomeKeyDown:n[5]||=e=>i(`homeKeyDown`,e)},{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},8,[`style`]))}}),[cc,lc]=vr(`SliderRoot`),uc=(0,t.defineComponent)({inheritAttrs:!1,__name:`SliderRoot`,props:{defaultValue:{type:Array,required:!1,default:()=>[0]},modelValue:{type:[Array,null],required:!1},disabled:{type:Boolean,required:!1,default:!1},orientation:{type:String,required:!1,default:`horizontal`},dir:{type:String,required:!1},inverted:{type:Boolean,required:!1,default:!1},min:{type:Number,required:!1,default:0},max:{type:Number,required:!1,default:100},step:{type:Number,required:!1,default:1},minStepsBetweenThumbs:{type:Number,required:!1,default:0},thumbAlignment:{type:String,required:!1,default:`contain`},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`span`},name:{type:String,required:!1},required:{type:Boolean,required:!1}},emits:[`update:modelValue`,`valueCommit`],setup(e,{emit:r}){let i=e,a=r,{min:o,max:s,step:c,minStepsBetweenThumbs:l,orientation:u,disabled:d,thumbAlignment:f,dir:p}=(0,t.toRefs)(i),m=Hr(p),{forwardRef:h,currentElement:g}=Y(),_=qr(g),{CollectionSlot:v}=ha({isProvider:!0}),y=(0,n.useVModel)(i,`modelValue`,a,{defaultValue:i.defaultValue,passive:i.modelValue===void 0}),b=(0,t.computed)(()=>Array.isArray(y.value)?[...y.value]:[]),x=(0,t.ref)(0),S=(0,t.ref)(b.value);function C(e){E(e,Js(b.value,e))}function w(e){E(e,x.value)}function T(){let e=S.value[x.value];b.value[x.value]!==e&&a(`valueCommit`,(0,t.toRaw)(b.value))}function E(e,t,{commit:n}={commit:!1}){let r=$s(c.value),i=_r(ec(Math.round((e-o.value)/c.value)*c.value+o.value,r),o.value,s.value),u=Gs(b.value,i,t);if(Zs(u,l.value*c.value)){x.value=u.indexOf(i);let e=String(u)!==String(y.value);e&&n&&a(`valueCommit`,u),e&&(ee.value[x.value]?.focus(),y.value=u)}}let ee=(0,t.ref)([]);return lc({modelValue:y,currentModelValue:b,valueIndexToChangeRef:x,thumbElements:ee,orientation:u,min:o,max:s,disabled:d,thumbAlignment:f}),(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(v),null,{default:(0,t.withCtx)(()=>[((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)((0,t.unref)(u)===`horizontal`?oc:sc),(0,t.mergeProps)(e.$attrs,{ref:(0,t.unref)(h),"as-child":e.asChild,as:e.as,min:(0,t.unref)(o),max:(0,t.unref)(s),dir:(0,t.unref)(m),inverted:e.inverted,"aria-disabled":(0,t.unref)(d),"data-disabled":(0,t.unref)(d)?``:void 0,onPointerdown:n[0]||=()=>{(0,t.unref)(d)||(S.value=b.value)},onSlideStart:n[1]||=e=>!(0,t.unref)(d)&&C(e),onSlideMove:n[2]||=e=>!(0,t.unref)(d)&&w(e),onSlideEnd:n[3]||=e=>!(0,t.unref)(d)&&T(),onHomeKeyDown:n[4]||=e=>!(0,t.unref)(d)&&E((0,t.unref)(o),0,{commit:!0}),onEndKeyDown:n[5]||=e=>!(0,t.unref)(d)&&E((0,t.unref)(s),b.value.length-1,{commit:!0}),onStepKeyDown:n[6]||=(e,n)=>{if(!(0,t.unref)(d)){let r=(0,t.unref)(tc).includes(e.key)||e.shiftKey&&(0,t.unref)(nc).includes(e.key)?10:1,i=x.value,a=b.value[i];E(a+(0,t.unref)(c)*r*n,i,{commit:!0})}}}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`,{modelValue:(0,t.unref)(y)}),(0,t.unref)(_)&&e.name?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(va),{key:0,type:`number`,value:(0,t.unref)(y),name:e.name,required:e.required,disabled:(0,t.unref)(d),step:(0,t.unref)(c)},null,8,[`value`,`name`,`required`,`disabled`,`step`])):(0,t.createCommentVNode)(`v-if`,!0)]),_:3},16,[`as-child`,`as`,`min`,`max`,`dir`,`inverted`,`aria-disabled`,`data-disabled`]))]),_:3}))}}),dc=(0,t.defineComponent)({__name:`SliderImpl`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`span`}},emits:[`slideStart`,`slideMove`,`slideEnd`,`homeKeyDown`,`endKeyDown`,`stepKeyDown`],setup(e,{emit:n}){let r=e,i=n,a=cc();return(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(X),(0,t.mergeProps)({"data-slider-impl":``},r,{onKeydown:n[0]||=e=>{e.key===`Home`?(i(`homeKeyDown`,e),e.preventDefault()):e.key===`End`?(i(`endKeyDown`,e),e.preventDefault()):(0,t.unref)(tc).concat((0,t.unref)(nc)).includes(e.key)&&(i(`stepKeyDown`,e),e.preventDefault())},onPointerdown:n[1]||=e=>{let n=e.target;n.setPointerCapture(e.pointerId),e.preventDefault(),(0,t.unref)(a).thumbElements.value.includes(n)?n.focus():i(`slideStart`,e)},onPointermove:n[2]||=e=>{e.target.hasPointerCapture(e.pointerId)&&i(`slideMove`,e)},onPointerup:n[3]||=e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&(t.releasePointerCapture(e.pointerId),i(`slideEnd`,e))}}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16))}}),fc=(0,t.defineComponent)({__name:`SliderRange`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`span`}},setup(e){let n=cc(),r=ic();Y();let i=(0,t.computed)(()=>n.currentModelValue.value.map(e=>Ks(e,n.min.value,n.max.value))),a=(0,t.computed)(()=>n.currentModelValue.value.length>1?Math.min(...i.value):0),o=(0,t.computed)(()=>100-Math.max(...i.value,0));return(e,i)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(X),{"data-disabled":(0,t.unref)(n).disabled.value?``:void 0,"data-orientation":(0,t.unref)(n).orientation.value,"as-child":e.asChild,as:e.as,style:(0,t.normalizeStyle)({[(0,t.unref)(r).startEdge.value]:`${a.value}%`,[(0,t.unref)(r).endEdge.value]:`${o.value}%`})},{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},8,[`data-disabled`,`data-orientation`,`as-child`,`as`,`style`]))}}),pc=(0,t.defineComponent)({inheritAttrs:!1,__name:`SliderThumbImpl`,props:{index:{type:Number,required:!0},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let r=e,i=cc(),a=ic(),{forwardRef:o,currentElement:s}=Y(),{CollectionItem:c}=ha(),l=(0,t.computed)(()=>i.modelValue?.value?.[r.index]),u=(0,t.computed)(()=>l.value===void 0?0:Ks(l.value,i.min.value??0,i.max.value??100)),d=(0,t.computed)(()=>qs(r.index,i.modelValue?.value?.length??0)),f=hi(s),p=(0,t.computed)(()=>f[a.size].value),m=(0,t.computed)(()=>i.thumbAlignment.value===`overflow`||!p.value?0:Ys(p.value,u.value,a.direction.value)),h=(0,n.useMounted)();return(0,t.onMounted)(()=>{i.thumbElements.value.push(s.value)}),(0,t.onUnmounted)(()=>{let e=i.thumbElements.value.findIndex(e=>e===s.value)??-1;i.thumbElements.value.splice(e,1)}),(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(c),null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(X),(0,t.mergeProps)(e.$attrs,{ref:(0,t.unref)(o),role:`slider`,tabindex:(0,t.unref)(i).disabled.value?void 0:0,"aria-label":e.$attrs[`aria-label`]||d.value,"data-disabled":(0,t.unref)(i).disabled.value?``:void 0,"data-orientation":(0,t.unref)(i).orientation.value,"aria-valuenow":l.value,"aria-valuemin":(0,t.unref)(i).min.value,"aria-valuemax":(0,t.unref)(i).max.value,"aria-orientation":(0,t.unref)(i).orientation.value,"as-child":e.asChild,as:e.as,style:{transform:`var(--reka-slider-thumb-transform)`,position:`absolute`,[(0,t.unref)(a).startEdge.value]:`calc(${u.value}% + ${m.value}px)`,display:!(0,t.unref)(h)&&l.value===void 0?`none`:void 0},onFocus:n[0]||=()=>{(0,t.unref)(i).valueIndexToChangeRef.value=e.index}}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16,[`tabindex`,`aria-label`,`data-disabled`,`data-orientation`,`aria-valuenow`,`aria-valuemin`,`aria-valuemax`,`aria-orientation`,`as-child`,`as`,`style`])]),_:3}))}}),mc=(0,t.defineComponent)({__name:`SliderThumb`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`span`}},setup(e){let n=e,{getItems:r}=ha(),{forwardRef:i,currentElement:a}=Y(),o=(0,t.computed)(()=>a.value?r(!0).findIndex(e=>e.ref===a.value):-1);return(e,r)=>((0,t.openBlock)(),(0,t.createBlock)(pc,(0,t.mergeProps)({ref:(0,t.unref)(i)},n,{index:o.value}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16,[`index`]))}}),hc=(0,t.defineComponent)({__name:`SliderTrack`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`span`}},setup(e){let n=cc();return Y(),(e,r)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(X),{"as-child":e.asChild,as:e.as,"data-disabled":(0,t.unref)(n).disabled.value?``:void 0,"data-orientation":(0,t.unref)(n).orientation.value},{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},8,[`as-child`,`as`,`data-disabled`,`data-orientation`]))}}),gc=(0,t.defineComponent)({__name:`Label`,props:{for:{type:String,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`label`}},setup(e){let n=e;return Y(),(e,r)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(X),(0,t.mergeProps)(n,{onMousedown:r[0]||=e=>{!e.defaultPrevented&&e.detail>1&&e.preventDefault()}}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16))}}),[_c,vc]=vr(`ScrollAreaRoot`),yc=(0,t.defineComponent)({__name:`ScrollAreaRoot`,props:{type:{type:String,required:!1,default:`hover`},dir:{type:String,required:!1},scrollHideDelay:{type:Number,required:!1,default:600},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e,{expose:n}){let r=e,i=(0,t.ref)(0),a=(0,t.ref)(0),o=(0,t.ref)(),s=(0,t.ref)(),c=(0,t.ref)(),l=(0,t.ref)(),u=(0,t.ref)(!1),d=(0,t.ref)(!1),{type:f,dir:p,scrollHideDelay:m}=(0,t.toRefs)(r),h=Hr(p);function g(){o.value?.scrollTo({top:0})}function _(){o.value?.scrollTo({top:0,left:0})}n({viewport:o,scrollTop:g,scrollTopLeft:_});let{forwardRef:v,currentElement:y}=Y();return vc({type:f,dir:h,scrollHideDelay:m,scrollArea:y,viewport:o,onViewportChange:e=>{o.value=e||void 0},content:s,onContentChange:e=>{s.value=e},scrollbarX:c,scrollbarXEnabled:u,scrollbarY:l,scrollbarYEnabled:d,onScrollbarXChange:e=>{c.value=e||void 0},onScrollbarYChange:e=>{l.value=e||void 0},onScrollbarXEnabledChange:e=>{u.value=e},onScrollbarYEnabledChange:e=>{d.value=e},onCornerWidthChange:e=>{i.value=e},onCornerHeightChange:e=>{a.value=e}}),(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(X),{ref:(0,t.unref)(v),"as-child":r.asChild,as:e.as,dir:(0,t.unref)(h),style:(0,t.normalizeStyle)({position:`relative`,"--reka-scroll-area-corner-width":`${i.value}px`,"--reka-scroll-area-corner-height":`${a.value}px`})},{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},8,[`as-child`,`as`,`dir`,`style`]))}}),bc=(0,t.defineComponent)({__name:`ScrollAreaCornerImpl`,setup(e){let r=_c(),i=(0,t.ref)(0),a=(0,t.ref)(0),o=(0,t.computed)(()=>!!i.value&&!!a.value);function s(){let e=r.scrollbarX.value?.offsetHeight||0;r.onCornerHeightChange(e),a.value=e}function c(){let e=r.scrollbarY.value?.offsetWidth||0;r.onCornerWidthChange(e),i.value=e}return(0,n.useResizeObserver)(r.scrollbarX.value,s),(0,n.useResizeObserver)(r.scrollbarY.value,c),(0,t.watch)(()=>r.scrollbarX.value,s),(0,t.watch)(()=>r.scrollbarY.value,c),(e,n)=>o.value?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(X),(0,t.mergeProps)({key:0,style:{width:`${i.value}px`,height:`${a.value}px`,position:`absolute`,right:(0,t.unref)(r).dir.value===`ltr`?0:void 0,left:(0,t.unref)(r).dir.value===`rtl`?0:void 0,bottom:0}},e.$parent?.$props),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16,[`style`])):(0,t.createCommentVNode)(`v-if`,!0)}}),xc=(0,t.defineComponent)({__name:`ScrollAreaCorner`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let n=e,{forwardRef:r}=Y(),i=_c(),a=(0,t.computed)(()=>!!i.scrollbarX.value&&!!i.scrollbarY.value),o=(0,t.computed)(()=>i.type.value!==`scroll`&&a.value);return(e,i)=>o.value?((0,t.openBlock)(),(0,t.createBlock)(bc,(0,t.mergeProps)({key:0},n,{ref:(0,t.unref)(r)}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16)):(0,t.createCommentVNode)(`v-if`,!0)}});function Sc(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function Cc(e){let t=wc(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function wc(e,t){let n=e/t;return Number.isNaN(n)?0:n}function Tc(e,t=()=>{}){let n={left:e.scrollLeft,top:e.scrollTop},r=0;return(function i(){let a={left:e.scrollLeft,top:e.scrollTop},o=n.left!==a.left,s=n.top!==a.top;(o||s)&&t(),n=a,r=window.requestAnimationFrame(i)})(),()=>window.cancelAnimationFrame(r)}function Ec(e,t,n=`ltr`){let r=Cc(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,a=t.scrollbar.size-i,o=t.content-t.viewport,s=a-r,c=n===`ltr`?[0,o]:[o*-1,0],l=_r(e,c[0],c[1]);return Sc([0,o],[0,s])(l)}function Dc(e){return e?Number.parseInt(e,10):0}function Oc(e,t,n,r=`ltr`){let i=Cc(n),a=i/2,o=t||a,s=i-o,c=n.scrollbar.paddingStart+o,l=n.scrollbar.size-n.scrollbar.paddingEnd-s,u=n.content-n.viewport,d=r===`ltr`?[0,u]:[u*-1,0];return Sc([c,l],d)(e)}function kc(e,t){return e>0&&e<t}var Ac=(0,t.defineComponent)({__name:`ScrollAreaScrollbarX`,setup(e){let n=_c(),r=zc(),{forwardRef:i,currentElement:a}=Y();(0,t.onMounted)(()=>{a.value&&n.onScrollbarXChange(a.value)});let o=(0,t.computed)(()=>r.sizes.value);return(e,a)=>((0,t.openBlock)(),(0,t.createBlock)(Hc,{ref:(0,t.unref)(i),"is-horizontal":!0,"data-orientation":`horizontal`,style:(0,t.normalizeStyle)({bottom:0,left:(0,t.unref)(n).dir.value===`rtl`?`var(--reka-scroll-area-corner-width)`:0,right:(0,t.unref)(n).dir.value===`ltr`?`var(--reka-scroll-area-corner-width)`:0,"--reka-scroll-area-thumb-width":o.value?`${(0,t.unref)(Cc)(o.value)}px`:void 0}),onOnDragScroll:a[0]||=e=>(0,t.unref)(r).onDragScroll(e.x)},{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},8,[`style`]))}}),jc=(0,t.defineComponent)({__name:`ScrollAreaScrollbarY`,setup(e){let n=_c(),r=zc(),{forwardRef:i,currentElement:a}=Y();(0,t.onMounted)(()=>{a.value&&n.onScrollbarYChange(a.value)});let o=(0,t.computed)(()=>r.sizes.value);return(e,a)=>((0,t.openBlock)(),(0,t.createBlock)(Hc,{ref:(0,t.unref)(i),"is-horizontal":!1,"data-orientation":`vertical`,style:(0,t.normalizeStyle)({top:0,right:(0,t.unref)(n).dir.value===`ltr`?0:void 0,left:(0,t.unref)(n).dir.value===`rtl`?0:void 0,bottom:`var(--reka-scroll-area-corner-height)`,"--reka-scroll-area-thumb-height":o.value?`${(0,t.unref)(Cc)(o.value)}px`:void 0}),onOnDragScroll:a[0]||=e=>(0,t.unref)(r).onDragScroll(e.y)},{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},8,[`style`]))}}),Mc=(0,t.defineComponent)({__name:`ScrollAreaScrollbarAuto`,props:{forceMount:{type:Boolean,required:!1}},setup(e){let r=_c(),i=Ic(),{forwardRef:a}=Y(),o=(0,t.ref)(!1),s=(0,n.useDebounceFn)(()=>{if(r.viewport.value){let e=r.viewport.value.offsetWidth<r.viewport.value.scrollWidth,t=r.viewport.value.offsetHeight<r.viewport.value.scrollHeight;o.value=i.isHorizontal.value?e:t}},10);return(0,t.onMounted)(()=>s()),(0,n.useResizeObserver)(r.viewport,s),(0,n.useResizeObserver)(r.content,s),(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Si),{present:e.forceMount||o.value},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(Vc,(0,t.mergeProps)(e.$attrs,{ref:(0,t.unref)(a),"data-state":o.value?`visible`:`hidden`}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16,[`data-state`])]),_:3},8,[`present`]))}}),Nc=(0,t.defineComponent)({inheritAttrs:!1,__name:`ScrollAreaScrollbarGlimpse`,props:{forceMount:{type:Boolean,required:!1}},setup(e){let r=_c(),i=Ic(),{forwardRef:a}=Y(),{state:o,dispatch:s}=gi(`hidden`,{hidden:{POINTER_ENTER:`glimpse`,SCROLL:`scrolling`},glimpse:{HIDE:`hidden`,POINTER_LEAVE:`hidden`,SCROLL:`scrolling`,POINTER_ENTER:`glimpse`},scrolling:{SCROLL_END:`idle`,POINTER_ENTER:`interacting`},interacting:{SCROLL:`interacting`,POINTER_LEAVE:`idle`},idle:{HIDE:`hidden`,SCROLL:`scrolling`,POINTER_ENTER:`interacting`}}),c=(0,t.computed)(()=>o.value!==`hidden`);function l(){s(`POINTER_ENTER`)}function u(){s(`POINTER_LEAVE`)}let d=(0,n.useDebounceFn)(()=>s(`SCROLL_END`),100);return(0,t.watchEffect)(e=>{if(o.value===`glimpse`){let t=window.setTimeout(()=>s(`HIDE`),r.scrollHideDelay.value);e(()=>{window.clearTimeout(t)})}}),(0,t.watchEffect)(e=>{if(o.value===`idle`){let t=window.setTimeout(()=>s(`HIDE`),r.scrollHideDelay.value);e(()=>{window.clearTimeout(t)})}}),(0,t.watchEffect)(e=>{let t=r.viewport.value,n=i.isHorizontal.value?`scrollLeft`:`scrollTop`;if(t){let r=t[n],i=()=>{let e=t[n];r!==e&&(s(`SCROLL`),d()),r=e};t.addEventListener(`scroll`,i),e(()=>{t.removeEventListener(`scroll`,i)})}}),(0,t.onMounted)(()=>{let e=r.scrollArea.value;e&&(e.addEventListener(`pointerenter`,l),e.addEventListener(`pointerleave`,u))}),(0,t.onUnmounted)(()=>{let e=r.scrollArea.value;e&&(e.removeEventListener(`pointerenter`,l),e.removeEventListener(`pointerleave`,u))}),(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Si),{present:e.forceMount||c.value},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(Mc,(0,t.mergeProps)(e.$attrs,{ref:(0,t.unref)(a),"data-state":c.value?`visible`:`hidden`}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16,[`data-state`])]),_:3},8,[`present`]))}}),Pc=(0,t.defineComponent)({inheritAttrs:!1,__name:`ScrollAreaScrollbarHover`,props:{forceMount:{type:Boolean,required:!1}},setup(e){let n=_c(),{forwardRef:r}=Y(),i,a=(0,t.ref)(!1);function o(){window.clearTimeout(i),a.value=!0}function s(){i=window.setTimeout(()=>{a.value=!1},n.scrollHideDelay.value)}return(0,t.onMounted)(()=>{let e=n.scrollArea.value;e&&(e.addEventListener(`pointerenter`,o),e.addEventListener(`pointerleave`,s))}),(0,t.onUnmounted)(()=>{let e=n.scrollArea.value;e&&(window.clearTimeout(i),e.removeEventListener(`pointerenter`,o),e.removeEventListener(`pointerleave`,s))}),(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Si),{present:e.forceMount||a.value},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(Mc,(0,t.mergeProps)(e.$attrs,{ref:(0,t.unref)(r),"data-state":a.value?`visible`:`hidden`}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16,[`data-state`])]),_:3},8,[`present`]))}}),Fc=(0,t.defineComponent)({__name:`ScrollAreaScrollbarScroll`,props:{forceMount:{type:Boolean,required:!1}},setup(e){let r=_c(),i=Ic(),{forwardRef:a}=Y(),{state:o,dispatch:s}=gi(`hidden`,{hidden:{SCROLL:`scrolling`},scrolling:{SCROLL_END:`idle`,POINTER_ENTER:`interacting`},interacting:{SCROLL:`interacting`,POINTER_LEAVE:`idle`},idle:{HIDE:`hidden`,SCROLL:`scrolling`,POINTER_ENTER:`interacting`}}),c=(0,t.computed)(()=>o.value!==`hidden`);(0,t.watchEffect)(e=>{if(o.value===`idle`){let t=window.setTimeout(()=>s(`HIDE`),r.scrollHideDelay.value);e(()=>{window.clearTimeout(t)})}});let l=(0,n.useDebounceFn)(()=>s(`SCROLL_END`),100);return(0,t.watchEffect)(e=>{let t=r.viewport.value,n=i.isHorizontal.value?`scrollLeft`:`scrollTop`;if(t){let r=t[n],i=()=>{let e=t[n];r!==e&&(s(`SCROLL`),l()),r=e};t.addEventListener(`scroll`,i),e(()=>{t.removeEventListener(`scroll`,i)})}}),(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Si),{present:e.forceMount||c.value},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(Vc,(0,t.mergeProps)(e.$attrs,{ref:(0,t.unref)(a),"data-state":c.value?`visible`:`hidden`}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16,[`data-state`])]),_:3},8,[`present`]))}}),[Ic,Lc]=vr(`ScrollAreaScrollbar`),Rc=(0,t.defineComponent)({inheritAttrs:!1,__name:`ScrollAreaScrollbar`,props:{orientation:{type:String,required:!1,default:`vertical`},forceMount:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`div`}},setup(e){let n=e,{forwardRef:r}=Y(),i=_c(),a=(0,t.computed)(()=>n.orientation===`horizontal`);(0,t.watch)(a,()=>{a.value?i.onScrollbarXEnabledChange(!0):i.onScrollbarYEnabledChange(!0)},{immediate:!0}),(0,t.onUnmounted)(()=>{i.onScrollbarXEnabledChange(!1),i.onScrollbarYEnabledChange(!1)});let{orientation:o,forceMount:s,asChild:c,as:l}=(0,t.toRefs)(n);return Lc({orientation:o,forceMount:s,isHorizontal:a,as:l,asChild:c}),(e,n)=>(0,t.unref)(i).type.value===`hover`?((0,t.openBlock)(),(0,t.createBlock)(Pc,(0,t.mergeProps)({key:0},e.$attrs,{ref:(0,t.unref)(r),"force-mount":(0,t.unref)(s)}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16,[`force-mount`])):(0,t.unref)(i).type.value===`scroll`?((0,t.openBlock)(),(0,t.createBlock)(Fc,(0,t.mergeProps)({key:1},e.$attrs,{ref:(0,t.unref)(r),"force-mount":(0,t.unref)(s)}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16,[`force-mount`])):(0,t.unref)(i).type.value===`glimpse`?((0,t.openBlock)(),(0,t.createBlock)(Nc,(0,t.mergeProps)({key:2},e.$attrs,{ref:(0,t.unref)(r),"force-mount":(0,t.unref)(s)}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16,[`force-mount`])):(0,t.unref)(i).type.value===`auto`?((0,t.openBlock)(),(0,t.createBlock)(Mc,(0,t.mergeProps)({key:3},e.$attrs,{ref:(0,t.unref)(r),"force-mount":(0,t.unref)(s)}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16,[`force-mount`])):(0,t.unref)(i).type.value===`always`?((0,t.openBlock)(),(0,t.createBlock)(Vc,(0,t.mergeProps)({key:4},e.$attrs,{ref:(0,t.unref)(r),"data-state":`visible`}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16)):(0,t.createCommentVNode)(`v-if`,!0)}}),[zc,Bc]=vr(`ScrollAreaScrollbarVisible`),Vc=(0,t.defineComponent)({__name:`ScrollAreaScrollbarVisible`,setup(e){let n=_c(),r=Ic(),{forwardRef:i}=Y(),a=(0,t.ref)({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),o=(0,t.computed)(()=>{let e=wc(a.value.viewport,a.value.content);return e>0&&e<1}),s=(0,t.ref)(),c=(0,t.ref)(0);function l(e,t){if(m.value){let r=n.viewport.value.scrollLeft+e.deltaY;n.viewport.value.scrollLeft=r,kc(r,t)&&e.preventDefault()}else{let r=n.viewport.value.scrollTop+e.deltaY;n.viewport.value.scrollTop=r,kc(r,t)&&e.preventDefault()}}function u(e,t){m.value?c.value=t.x:c.value=t.y}function d(e){c.value=0}function f(e){a.value=e}function p(e,t){return Oc(e,c.value,a.value,t)}let m=(0,t.computed)(()=>r.isHorizontal.value);function h(e){m.value?n.viewport.value.scrollLeft=p(e,n.dir.value):n.viewport.value.scrollTop=p(e)}function g(){if(m.value){if(n.viewport.value&&s.value){let e=n.viewport.value.scrollLeft,t=Ec(e,a.value,n.dir.value);s.value.style.transform=`translate3d(${t}px, 0, 0)`}}else if(n.viewport.value&&s.value){let e=n.viewport.value.scrollTop,t=Ec(e,a.value);s.value.style.transform=`translate3d(0, ${t}px, 0)`}}function _(e){s.value=e}return Bc({sizes:a,hasThumb:o,handleWheelScroll:l,handleThumbDown:u,handleThumbUp:d,handleSizeChange:f,onThumbPositionChange:g,onThumbChange:_,onDragScroll:h}),(e,n)=>m.value?((0,t.openBlock)(),(0,t.createBlock)(Ac,(0,t.mergeProps)({key:0},e.$attrs,{ref:(0,t.unref)(i)}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16)):((0,t.openBlock)(),(0,t.createBlock)(jc,(0,t.mergeProps)({key:1},e.$attrs,{ref:(0,t.unref)(i)}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16))}}),Hc=(0,t.defineComponent)({__name:`ScrollAreaScrollbarImpl`,props:{isHorizontal:{type:Boolean,required:!0}},emits:[`onDragScroll`,`onWheelScroll`,`onThumbPointerDown`],setup(e,{emit:r}){let i=e,a=r,o=_c(),s=zc(),c=Ic(),{forwardRef:l,currentElement:u}=Y(),d=(0,t.ref)(``),f=(0,t.ref)();function p(e){f.value&&a(`onDragScroll`,{x:e.clientX-f.value?.left,y:e.clientY-f.value?.top})}function m(e){e.button===0&&(e.target.setPointerCapture(e.pointerId),f.value=u.value.getBoundingClientRect(),d.value=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect=`none`,o.viewport&&(o.viewport.value.style.scrollBehavior=`auto`),p(e))}function h(e){p(e)}function g(e){let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=d.value,o.viewport&&(o.viewport.value.style.scrollBehavior=``),f.value=void 0}function _(e){let t=e.target,n=u.value?.contains(t),r=s.sizes.value.content-s.sizes.value.viewport;n&&s.handleWheelScroll(e,r)}(0,t.onMounted)(()=>{document.addEventListener(`wheel`,_,{passive:!1})}),(0,t.onUnmounted)(()=>{document.removeEventListener(`wheel`,_)});function v(){u.value&&(i.isHorizontal?s.handleSizeChange({content:o.viewport.value?.scrollWidth??0,viewport:o.viewport.value?.offsetWidth??0,scrollbar:{size:u.value.clientWidth??0,paddingStart:Dc(getComputedStyle(u.value).paddingLeft),paddingEnd:Dc(getComputedStyle(u.value).paddingRight)}}):s.handleSizeChange({content:o.viewport.value?.scrollHeight??0,viewport:o.viewport.value?.offsetHeight??0,scrollbar:{size:u.value?.clientHeight??0,paddingStart:Dc(getComputedStyle(u.value).paddingTop),paddingEnd:Dc(getComputedStyle(u.value).paddingBottom)}}),s.onThumbPositionChange())}return(0,n.useResizeObserver)(u,v),(0,n.useResizeObserver)(o.content,v),(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(X),{ref:(0,t.unref)(l),style:{position:`absolute`},"data-scrollbarimpl":``,as:(0,t.unref)(c).as.value,"as-child":(0,t.unref)(c).asChild.value,onPointerdown:m,onPointermove:h,onPointerup:g},{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},8,[`as`,`as-child`]))}}),Uc=(0,t.defineComponent)({__name:`ScrollAreaThumb`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let r=e,i=_c(),a=zc();function o(e){let t=e.target.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top;a.handleThumbDown(e,{x:n,y:r})}function s(e){a.handleThumbUp(e)}let{forwardRef:c,currentElement:l}=Y(),u=(0,t.ref)(),d=(0,t.computed)(()=>i.viewport.value);function f(){u.value||(u.value=Tc(d.value,a.onThumbPositionChange),a.onThumbPositionChange())}return(0,n.watchOnce)((0,t.computed)(()=>a.sizes.value),()=>{a.onThumbChange(l.value),d.value&&(a.onThumbPositionChange(),d.value.addEventListener(`scroll`,f))}),(0,t.onUnmounted)(()=>{d.value.removeEventListener(`scroll`,f),i.viewport.value?.removeEventListener(`scroll`,f)}),(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(X),{ref:(0,t.unref)(c),"data-state":(0,t.unref)(a).hasThumb?`visible`:`hidden`,style:{width:`var(--reka-scroll-area-thumb-width)`,height:`var(--reka-scroll-area-thumb-height)`},"as-child":r.asChild,as:e.as,onPointerdown:o,onPointerup:s},{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},8,[`data-state`,`as-child`,`as`]))}}),Wc=(0,t.defineComponent)({inheritAttrs:!1,__name:`ScrollAreaViewport`,props:{nonce:{type:String,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e,{expose:n}){let r=e,{nonce:i}=(0,t.toRefs)(r),a=Ws(i),o=_c(),s=(0,t.ref)();(0,t.onMounted)(()=>{o.onViewportChange(s.value),o.onContentChange(l.value)}),n({viewportElement:s});let{forwardRef:c,currentElement:l}=Y();return(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,null,[(0,t.createElementVNode)(`div`,(0,t.mergeProps)({ref_key:`viewportElement`,ref:s,"data-reka-scroll-area-viewport":``,style:{overflowX:(0,t.unref)(o).scrollbarXEnabled.value?`scroll`:`hidden`,overflowY:(0,t.unref)(o).scrollbarYEnabled.value?`scroll`:`hidden`}},e.$attrs,{tabindex:0}),[(0,t.createVNode)((0,t.unref)(X),{ref:(0,t.unref)(c),style:(0,t.normalizeStyle)({minWidth:(0,t.unref)(o).scrollbarXEnabled.value?`fit-content`:void 0}),"as-child":r.asChild,as:e.as},{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},8,[`style`,`as-child`,`as`])],16),(0,t.createVNode)((0,t.unref)(X),{as:`style`,nonce:(0,t.unref)(a)},{default:(0,t.withCtx)(()=>n[0]||=[(0,t.createTextVNode)(` /* Hide scrollbars cross-browser and enable momentum scroll for touch devices */ [data-reka-scroll-area-viewport] { scrollbar-width:none; -ms-overflow-style:none; -webkit-overflow-scrolling:touch; } [data-reka-scroll-area-viewport]::-webkit-scrollbar { display:none; } `)]),_:1,__:[0]},8,[`nonce`])],64))}}),Gc=[` `,`Enter`,`ArrowUp`,`ArrowDown`],Kc=[` `,`Enter`];function qc(e,t,n){return e===void 0?!1:Array.isArray(e)?e.some(e=>Jc(e,t,n)):Jc(e,t,n)}function Jc(e,t,n){return e===void 0||t===void 0?!1:typeof e==`string`?e===t:typeof n==`function`?n(e,t):typeof n==`string`?e?.[n]===t?.[n]:gr(e,t)}function Yc(e){return e==null||e===``||Array.isArray(e)&&e.length===0}var Xc={key:0,value:``},[Zc,Qc]=vr(`SelectRoot`),$c=(0,t.defineComponent)({inheritAttrs:!1,__name:`SelectRoot`,props:{open:{type:Boolean,required:!1,default:void 0},defaultOpen:{type:Boolean,required:!1},defaultValue:{type:null,required:!1},modelValue:{type:null,required:!1,default:void 0},by:{type:[String,Function],required:!1},dir:{type:String,required:!1},multiple:{type:Boolean,required:!1},autocomplete:{type:String,required:!1},disabled:{type:Boolean,required:!1},name:{type:String,required:!1},required:{type:Boolean,required:!1}},emits:[`update:modelValue`,`update:open`],setup(e,{emit:r}){let i=e,a=r,{required:o,disabled:s,multiple:c,dir:l}=(0,t.toRefs)(i),u=(0,n.useVModel)(i,`modelValue`,a,{defaultValue:i.defaultValue??(c.value?[]:void 0),passive:i.modelValue===void 0,deep:!0}),d=(0,n.useVModel)(i,`open`,a,{defaultValue:i.defaultOpen,passive:i.open===void 0}),f=(0,t.ref)(),p=(0,t.ref)(),m=(0,t.ref)({x:0,y:0}),h=(0,t.computed)(()=>c.value&&Array.isArray(u.value)?u.value?.length===0:xr(u.value));ha({isProvider:!0});let g=Hr(l),_=qr(f),v=(0,t.ref)(new Set),y=(0,t.computed)(()=>Array.from(v.value).map(e=>e.value).join(`;`));function b(e){if(c.value){let t=Array.isArray(u.value)?[...u.value]:[],n=t.findIndex(t=>Jc(t,e,i.by));n===-1?t.push(e):t.splice(n,1),u.value=[...t]}else u.value=e}function x(e){return Array.from(v.value).find(t=>qc(e,t.value,i.by))}return Qc({triggerElement:f,onTriggerChange:e=>{f.value=e},valueElement:p,onValueElementChange:e=>{p.value=e},contentId:``,modelValue:u,onValueChange:b,by:i.by,open:d,multiple:c,required:o,onOpenChange:e=>{d.value=e},dir:g,triggerPointerDownPosRef:m,disabled:s,isEmptyModelValue:h,optionsSet:v,onOptionAdd:e=>{let t=x(e.value);t&&v.value.delete(t),v.value.add(e)},onOptionRemove:e=>{let t=x(e.value);t&&v.value.delete(t)}}),(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(xa),null,{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`,{modelValue:(0,t.unref)(u),open:(0,t.unref)(d)}),(0,t.unref)(_)?((0,t.openBlock)(),(0,t.createBlock)(el,{key:y.value,"aria-hidden":`true`,tabindex:`-1`,multiple:(0,t.unref)(c),required:(0,t.unref)(o),name:e.name,autocomplete:e.autocomplete,disabled:(0,t.unref)(s),value:(0,t.unref)(u)},{default:(0,t.withCtx)(()=>[(0,t.unref)(xr)((0,t.unref)(u))?((0,t.openBlock)(),(0,t.createElementBlock)(`option`,Xc)):(0,t.createCommentVNode)(`v-if`,!0),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(Array.from(v.value),e=>((0,t.openBlock)(),(0,t.createElementBlock)(`option`,(0,t.mergeProps)({key:e.value??``},{ref_for:!0},e),null,16))),128))]),_:1},8,[`multiple`,`required`,`name`,`autocomplete`,`disabled`,`value`])):(0,t.createCommentVNode)(`v-if`,!0)]),_:3}))}}),el=(0,t.defineComponent)({__name:`BubbleSelect`,props:{autocomplete:{type:String,required:!1},autofocus:{type:Boolean,required:!1},disabled:{type:Boolean,required:!1},form:{type:String,required:!1},multiple:{type:Boolean,required:!1},name:{type:String,required:!1},required:{type:Boolean,required:!1},size:{type:Number,required:!1},value:{type:null,required:!1}},setup(e){let n=e,r=(0,t.ref)(),i=Zc();(0,t.watch)(()=>n.value,(e,t)=>{let n=window.HTMLSelectElement.prototype,i=Object.getOwnPropertyDescriptor(n,`value`).set;if(e!==t&&i&&r.value){let t=new Event(`change`,{bubbles:!0});i.call(r.value,e),r.value.dispatchEvent(t)}});function a(e){i.onValueChange(e.target.value)}return(e,i)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(ga),{"as-child":``},{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`select`,(0,t.mergeProps)({ref_key:`selectElement`,ref:r},n,{onInput:a}),[(0,t.renderSlot)(e.$slots,`default`)],16)]),_:3}))}}),tl=(0,t.defineComponent)({__name:`SelectPopperPosition`,props:{side:{type:null,required:!1},sideOffset:{type:Number,required:!1},sideFlip:{type:Boolean,required:!1},align:{type:null,required:!1,default:`start`},alignOffset:{type:Number,required:!1},alignFlip:{type:Boolean,required:!1},avoidCollisions:{type:Boolean,required:!1},collisionBoundary:{type:null,required:!1},collisionPadding:{type:[Number,Object],required:!1,default:10},arrowPadding:{type:Number,required:!1},hideShiftedArrow:{type:Boolean,required:!1},sticky:{type:String,required:!1},hideWhenDetached:{type:Boolean,required:!1},positionStrategy:{type:String,required:!1},updatePositionStrategy:{type:String,required:!1},disableUpdateOnLayoutShift:{type:Boolean,required:!1},prioritizePosition:{type:Boolean,required:!1},reference:{type:null,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let n=Jr(e);return(e,r)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Vs),(0,t.mergeProps)((0,t.unref)(n),{style:{boxSizing:`border-box`,"--reka-select-content-transform-origin":`var(--reka-popper-transform-origin)`,"--reka-select-content-available-width":`var(--reka-popper-available-width)`,"--reka-select-content-available-height":`var(--reka-popper-available-height)`,"--reka-select-trigger-width":`var(--reka-popper-anchor-width)`,"--reka-select-trigger-height":`var(--reka-popper-anchor-height)`}}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16))}}),nl={onViewportChange:()=>{},itemTextRefCallback:()=>{},itemRefCallback:()=>{}},[rl,il]=vr(`SelectContent`),al=(0,t.defineComponent)({__name:`SelectContentImpl`,props:{position:{type:String,required:!1,default:`item-aligned`},bodyLock:{type:Boolean,required:!1,default:!0},side:{type:null,required:!1},sideOffset:{type:Number,required:!1},sideFlip:{type:Boolean,required:!1},align:{type:null,required:!1,default:`start`},alignOffset:{type:Number,required:!1},alignFlip:{type:Boolean,required:!1},avoidCollisions:{type:Boolean,required:!1},collisionBoundary:{type:null,required:!1},collisionPadding:{type:[Number,Object],required:!1},arrowPadding:{type:Number,required:!1},hideShiftedArrow:{type:Boolean,required:!1},sticky:{type:String,required:!1},hideWhenDetached:{type:Boolean,required:!1},positionStrategy:{type:String,required:!1},updatePositionStrategy:{type:String,required:!1},disableUpdateOnLayoutShift:{type:Boolean,required:!1},prioritizePosition:{type:Boolean,required:!1},reference:{type:null,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},disableOutsidePointerEvents:{type:Boolean,required:!1,default:!0}},emits:[`closeAutoFocus`,`escapeKeyDown`,`pointerDownOutside`],setup(e,{emit:r}){let i=e,a=r,o=Zc();Gr(),zr(i.bodyLock);let{CollectionSlot:s,getItems:c}=ha(),l=(0,t.ref)();fi(l);let{search:u,handleTypeaheadSearch:d}=_i(),f=(0,t.ref)(),p=(0,t.ref)(),m=(0,t.ref)(),h=(0,t.ref)(!1),g=(0,t.ref)(!1),_=(0,t.ref)(!1);function v(){p.value&&l.value&&ta([p.value,l.value])}(0,t.watch)(h,()=>{v()});let{onOpenChange:y,triggerPointerDownPosRef:b}=o;(0,t.watchEffect)(e=>{if(!l.value)return;let t={x:0,y:0},n=e=>{t={x:Math.abs(Math.round(e.pageX)-(b.value?.x??0)),y:Math.abs(Math.round(e.pageY)-(b.value?.y??0))}},r=e=>{e.pointerType!==`touch`&&(t.x<=10&&t.y<=10?e.preventDefault():l.value?.contains(e.target)||y(!1),document.removeEventListener(`pointermove`,n),b.value=null)};b.value!==null&&(document.addEventListener(`pointermove`,n),document.addEventListener(`pointerup`,r,{capture:!0,once:!0})),e(()=>{document.removeEventListener(`pointermove`,n),document.removeEventListener(`pointerup`,r,{capture:!0})})});function x(e){let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&d(e.key,c()),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=[...c().map(e=>e.ref)];if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>ta(t)),e.preventDefault()}}let S=Jr((0,t.computed)(()=>i.position===`popper`?i:{}).value);return il({content:l,viewport:f,onViewportChange:e=>{f.value=e},itemRefCallback:(e,t,n)=>{let r=!g.value&&!n,i=qc(o.modelValue.value,t,o.by);if(o.multiple.value){if(_.value)return;(i||r)&&(p.value=e,i&&(_.value=!0))}else (i||r)&&(p.value=e);r&&(g.value=!0)},selectedItem:p,selectedItemText:m,onItemLeave:()=>{l.value?.focus()},itemTextRefCallback:(e,t,n)=>{let r=!g.value&&!n;(qc(o.modelValue.value,t,o.by)||r)&&(m.value=e)},focusSelectedItem:v,position:i.position,isPositioned:h,searchRef:u}),(e,r)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(s),null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(Xi),{"as-child":``,onMountAutoFocus:r[6]||=(0,t.withModifiers)(()=>{},[`prevent`]),onUnmountAutoFocus:r[7]||=e=>{a(`closeAutoFocus`,e),!e.defaultPrevented&&((0,t.unref)(o).triggerElement.value?.focus({preventScroll:!0}),e.preventDefault())}},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(Ii),{"as-child":``,"disable-outside-pointer-events":e.disableOutsidePointerEvents,onFocusOutside:r[2]||=(0,t.withModifiers)(()=>{},[`prevent`]),onDismiss:r[3]||=e=>(0,t.unref)(o).onOpenChange(!1),onEscapeKeyDown:r[4]||=e=>a(`escapeKeyDown`,e),onPointerDownOutside:r[5]||=e=>a(`pointerDownOutside`,e)},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(e.position===`popper`?tl:cl),(0,t.mergeProps)({...e.$attrs,...(0,t.unref)(S)},{id:(0,t.unref)(o).contentId,ref:e=>{let r=(0,t.unref)(n.unrefElement)(e);r?.hasAttribute(`data-reka-popper-content-wrapper`)?l.value=r.firstElementChild:l.value=r},role:`listbox`,"data-state":(0,t.unref)(o).open.value?`open`:`closed`,dir:(0,t.unref)(o).dir.value,style:{display:`flex`,flexDirection:`column`,outline:`none`},onContextmenu:r[0]||=(0,t.withModifiers)(()=>{},[`prevent`]),onPlaced:r[1]||=e=>h.value=!0,onKeydown:x}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16,[`id`,`data-state`,`dir`,`onKeydown`]))]),_:3},8,[`disable-outside-pointer-events`])]),_:3})]),_:3}))}}),[ol,sl]=vr(`SelectItemAlignedPosition`),cl=(0,t.defineComponent)({inheritAttrs:!1,__name:`SelectItemAlignedPosition`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`placed`],setup(e,{emit:r}){let i=e,a=r,{getItems:o}=ha(),s=Zc(),c=rl(),l=(0,t.ref)(!1),u=(0,t.ref)(!0),d=(0,t.ref)(),{forwardRef:f,currentElement:p}=Y(),{viewport:m,selectedItem:h,selectedItemText:g,focusSelectedItem:_}=c;function v(){if(s.triggerElement.value&&s.valueElement.value&&d.value&&p.value&&m?.value&&h?.value&&g?.value){let e=s.triggerElement.value.getBoundingClientRect(),t=p.value.getBoundingClientRect(),n=s.valueElement.value.getBoundingClientRect(),r=g.value.getBoundingClientRect();if(s.dir.value!==`rtl`){let i=r.left-t.left,a=n.left-i,o=e.left-a,s=e.width+o,c=Math.max(s,t.width),l=window.innerWidth-10,u=_r(a,10,Math.max(10,l-c));d.value.style.minWidth=`${s}px`,d.value.style.left=`${u}px`}else{let i=t.right-r.right,a=window.innerWidth-n.right-i,o=window.innerWidth-e.right-a,s=e.width+o,c=Math.max(s,t.width),l=window.innerWidth-10,u=_r(a,10,Math.max(10,l-c));d.value.style.minWidth=`${s}px`,d.value.style.right=`${u}px`}let i=o().map(e=>e.ref),c=window.innerHeight-20,u=m.value.scrollHeight,f=window.getComputedStyle(p.value),_=Number.parseInt(f.borderTopWidth,10),v=Number.parseInt(f.paddingTop,10),y=Number.parseInt(f.borderBottomWidth,10),b=Number.parseInt(f.paddingBottom,10),x=_+v+u+b+y,S=Math.min(h.value.offsetHeight*5,x),C=window.getComputedStyle(m.value),w=Number.parseInt(C.paddingTop,10),T=Number.parseInt(C.paddingBottom,10),E=e.top+e.height/2-10,ee=c-E,D=h.value.offsetHeight/2,te=h.value.offsetTop+D,O=_+v+te,ne=x-O;if(O<=E){let e=h.value===i[i.length-1];d.value.style.bottom=`0px`;let t=p.value.clientHeight-m.value.offsetTop-m.value.offsetHeight,n=O+Math.max(ee,D+(e?T:0)+t+y);d.value.style.height=`${n}px`}else{let e=h.value===i[0];d.value.style.top=`0px`;let t=Math.max(E,_+m.value.offsetTop+(e?w:0)+D)+ne;d.value.style.height=`${t}px`,m.value.scrollTop=O-E+m.value.offsetTop}d.value.style.margin=`10px 0`,d.value.style.minHeight=`${S}px`,d.value.style.maxHeight=`${c}px`,a(`placed`),requestAnimationFrame(()=>l.value=!0)}}let y=(0,t.ref)(``);(0,t.onMounted)(async()=>{await(0,t.nextTick)(),v(),p.value&&(y.value=window.getComputedStyle(p.value).zIndex)});function b(e){e&&u.value===!0&&(v(),_?.(),u.value=!1)}return(0,n.useResizeObserver)(s.triggerElement,()=>{v()}),sl({contentWrapper:d,shouldExpandOnScrollRef:l,onScrollButtonChange:b}),(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{ref_key:`contentWrapperElement`,ref:d,style:(0,t.normalizeStyle)({display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:y.value})},[(0,t.createVNode)((0,t.unref)(X),(0,t.mergeProps)({ref:(0,t.unref)(f),style:{boxSizing:`border-box`,maxHeight:`100%`}},{...e.$attrs,...i}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16)],4))}}),ll=(0,t.defineComponent)({inheritAttrs:!1,__name:`SelectProvider`,props:{context:{type:Object,required:!0}},setup(e){return Qc(e.context),il(nl),(e,n)=>(0,t.renderSlot)(e.$slots,`default`)}}),ul={key:1},dl=(0,t.defineComponent)({inheritAttrs:!1,__name:`SelectContent`,props:{forceMount:{type:Boolean,required:!1},position:{type:String,required:!1},bodyLock:{type:Boolean,required:!1},side:{type:null,required:!1},sideOffset:{type:Number,required:!1},sideFlip:{type:Boolean,required:!1},align:{type:null,required:!1},alignOffset:{type:Number,required:!1},alignFlip:{type:Boolean,required:!1},avoidCollisions:{type:Boolean,required:!1},collisionBoundary:{type:null,required:!1},collisionPadding:{type:[Number,Object],required:!1},arrowPadding:{type:Number,required:!1},hideShiftedArrow:{type:Boolean,required:!1},sticky:{type:String,required:!1},hideWhenDetached:{type:Boolean,required:!1},positionStrategy:{type:String,required:!1},updatePositionStrategy:{type:String,required:!1},disableUpdateOnLayoutShift:{type:Boolean,required:!1},prioritizePosition:{type:Boolean,required:!1},reference:{type:null,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},disableOutsidePointerEvents:{type:Boolean,required:!1}},emits:[`closeAutoFocus`,`escapeKeyDown`,`pointerDownOutside`],setup(e,{emit:n}){let r=e,i=Yr(r,n),a=Zc(),o=(0,t.ref)();(0,t.onMounted)(()=>{o.value=new DocumentFragment});let s=(0,t.ref)(),c=(0,t.computed)(()=>r.forceMount||a.open.value),l=(0,t.ref)(c.value);return(0,t.watch)(c,()=>{setTimeout(()=>l.value=c.value)}),(e,n)=>c.value||l.value||s.value?.present?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Si),{key:0,ref_key:`presenceRef`,ref:s,present:c.value},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(al,(0,t.normalizeProps)((0,t.guardReactiveProps)({...(0,t.unref)(i),...e.$attrs})),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16)]),_:3},8,[`present`])):o.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,ul,[((0,t.openBlock)(),(0,t.createBlock)(t.Teleport,{to:o.value},[(0,t.createVNode)(ll,{context:(0,t.unref)(a)},{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},8,[`context`])],8,[`to`]))])):(0,t.createCommentVNode)(`v-if`,!0)}}),[fl,pl]=vr(`SelectGroup`),ml=(0,t.defineComponent)({__name:`SelectGroup`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let n=e,r=mi(void 0,`reka-select-group`);return pl({id:r}),(e,i)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(X),(0,t.mergeProps)({role:`group`},n,{"aria-labelledby":(0,t.unref)(r)}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16,[`aria-labelledby`]))}}),hl=(0,t.defineComponent)({__name:`SelectIcon`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`span`}},setup(e){return(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(X),{"aria-hidden":`true`,as:e.as,"as-child":e.asChild},{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`,{},()=>[n[0]||=(0,t.createTextVNode)(`▼`)])]),_:3},8,[`as`,`as-child`]))}}),[gl,_l]=vr(`SelectItem`),vl=(0,t.defineComponent)({__name:`SelectItem`,props:{value:{type:null,required:!0},disabled:{type:Boolean,required:!1},textValue:{type:String,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:[`select`],setup(e,{emit:n}){let r=e,i=n,{disabled:a}=(0,t.toRefs)(r),o=Zc(),s=rl(),{forwardRef:c,currentElement:l}=Y(),{CollectionItem:u}=ha(),d=(0,t.computed)(()=>qc(o.modelValue?.value,r.value,o.by)),f=(0,t.ref)(!1),p=(0,t.ref)(r.textValue??``),m=mi(void 0,`reka-select-item-text`);async function h(e){e.defaultPrevented||br(`select.select`,g,{originalEvent:e,value:r.value})}async function g(e){await(0,t.nextTick)(),i(`select`,e),!e.defaultPrevented&&(a.value||(o.onValueChange(r.value),o.multiple.value||o.onOpenChange(!1)))}async function _(e){await(0,t.nextTick)(),!e.defaultPrevented&&(a.value?s.onItemLeave?.():e.currentTarget?.focus({preventScroll:!0}))}async function v(e){await(0,t.nextTick)(),!e.defaultPrevented&&e.currentTarget===yr()&&s.onItemLeave?.()}async function y(e){await(0,t.nextTick)(),!e.defaultPrevented&&(s.searchRef?.value!==``&&e.key===` `||(Kc.includes(e.key)&&h(e),e.key===` `&&e.preventDefault()))}if(r.value===``)throw Error(`A <SelectItem /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.`);return(0,t.onMounted)(()=>{l.value&&s.itemRefCallback(l.value,r.value,r.disabled)}),_l({value:r.value,disabled:a,textId:m,isSelected:d,onItemTextChange:e=>{p.value=((p.value||e?.textContent)??``).trim()}}),(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(u),{value:{textValue:p.value}},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(X),{ref:(0,t.unref)(c),role:`option`,"aria-labelledby":(0,t.unref)(m),"data-highlighted":f.value?``:void 0,"aria-selected":d.value,"data-state":d.value?`checked`:`unchecked`,"aria-disabled":(0,t.unref)(a)||void 0,"data-disabled":(0,t.unref)(a)?``:void 0,tabindex:(0,t.unref)(a)?void 0:-1,as:e.as,"as-child":e.asChild,onFocus:n[0]||=e=>f.value=!0,onBlur:n[1]||=e=>f.value=!1,onPointerup:h,onPointerdown:n[2]||=e=>{e.currentTarget.focus({preventScroll:!0})},onTouchend:n[3]||=(0,t.withModifiers)(()=>{},[`prevent`,`stop`]),onPointermove:_,onPointerleave:v,onKeydown:y},{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},8,[`aria-labelledby`,`data-highlighted`,`aria-selected`,`data-state`,`aria-disabled`,`data-disabled`,`tabindex`,`as`,`as-child`])]),_:3},8,[`value`]))}}),yl=(0,t.defineComponent)({__name:`SelectItemIndicator`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`span`}},setup(e){let n=e,r=gl();return(e,i)=>(0,t.unref)(r).isSelected.value?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(X),(0,t.mergeProps)({key:0,"aria-hidden":`true`},n),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16)):(0,t.createCommentVNode)(`v-if`,!0)}}),bl=(0,t.defineComponent)({inheritAttrs:!1,__name:`SelectItemText`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`span`}},setup(e){let n=e,r=Zc(),i=rl(),a=gl(),{forwardRef:o,currentElement:s}=Y(),c=(0,t.computed)(()=>({value:a.value,disabled:a.disabled.value,textContent:s.value?.textContent??a.value?.toString()??``}));return(0,t.onMounted)(()=>{s.value&&(a.onItemTextChange(s.value),i.itemTextRefCallback(s.value,a.value,a.disabled.value),r.onOptionAdd(c.value))}),(0,t.onUnmounted)(()=>{r.onOptionRemove(c.value)}),(e,r)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(X),(0,t.mergeProps)({id:(0,t.unref)(a).textId,ref:(0,t.unref)(o)},{...n,...e.$attrs}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16,[`id`]))}}),xl=(0,t.defineComponent)({__name:`SelectPortal`,props:{to:{type:null,required:!1},disabled:{type:Boolean,required:!1},defer:{type:Boolean,required:!1},forceMount:{type:Boolean,required:!1}},setup(e){let n=e;return(e,r)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(da),(0,t.normalizeProps)((0,t.guardReactiveProps)(n)),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16))}}),Sl=(0,t.defineComponent)({__name:`SelectScrollButtonImpl`,emits:[`autoScroll`],setup(e,{emit:n}){let r=n,{getItems:i}=ha(),a=rl(),o=(0,t.ref)(null);function s(){o.value!==null&&(window.clearInterval(o.value),o.value=null)}(0,t.watchEffect)(()=>{i().map(e=>e.ref).find(e=>e===yr())?.scrollIntoView({block:`nearest`})});function c(){o.value===null&&(o.value=window.setInterval(()=>{r(`autoScroll`)},50))}function l(){a.onItemLeave?.(),o.value===null&&(o.value=window.setInterval(()=>{r(`autoScroll`)},50))}return(0,t.onBeforeUnmount)(()=>s()),(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(X),(0,t.mergeProps)({"aria-hidden":`true`,style:{flexShrink:0}},e.$parent?.$props,{onPointerdown:c,onPointermove:l,onPointerleave:n[0]||=()=>{s()}}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16))}}),Cl=(0,t.defineComponent)({__name:`SelectScrollDownButton`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let n=rl(),r=n.position===`item-aligned`?ol():void 0,{forwardRef:i,currentElement:a}=Y(),o=(0,t.ref)(!1);return(0,t.watchEffect)(e=>{if(n.viewport?.value&&n.isPositioned?.value){let t=n.viewport.value;function r(){let e=t.scrollHeight-t.clientHeight;o.value=Math.ceil(t.scrollTop)<e}r(),t.addEventListener(`scroll`,r),e(()=>t.removeEventListener(`scroll`,r))}}),(0,t.watch)(a,()=>{a.value&&r?.onScrollButtonChange(a.value)}),(e,r)=>o.value?((0,t.openBlock)(),(0,t.createBlock)(Sl,{key:0,ref:(0,t.unref)(i),onAutoScroll:r[0]||=()=>{let{viewport:e,selectedItem:r}=(0,t.unref)(n);e?.value&&r?.value&&(e.value.scrollTop=e.value.scrollTop+r.value.offsetHeight)}},{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},512)):(0,t.createCommentVNode)(`v-if`,!0)}}),wl=(0,t.defineComponent)({__name:`SelectScrollUpButton`,props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let n=rl(),r=n.position===`item-aligned`?ol():void 0,{forwardRef:i,currentElement:a}=Y(),o=(0,t.ref)(!1);return(0,t.watchEffect)(e=>{if(n.viewport?.value&&n.isPositioned?.value){let t=n.viewport.value;function r(){o.value=t.scrollTop>0}r(),t.addEventListener(`scroll`,r),e(()=>t.removeEventListener(`scroll`,r))}}),(0,t.watch)(a,()=>{a.value&&r?.onScrollButtonChange(a.value)}),(e,r)=>o.value?((0,t.openBlock)(),(0,t.createBlock)(Sl,{key:0,ref:(0,t.unref)(i),onAutoScroll:r[0]||=()=>{let{viewport:e,selectedItem:r}=(0,t.unref)(n);e?.value&&r?.value&&(e.value.scrollTop=e.value.scrollTop-r.value.offsetHeight)}},{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},512)):(0,t.createCommentVNode)(`v-if`,!0)}}),Tl=(0,t.defineComponent)({__name:`SelectTrigger`,props:{disabled:{type:Boolean,required:!1},reference:{type:null,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`}},setup(e){let n=e,r=Zc(),{forwardRef:i,currentElement:a}=Y(),o=(0,t.computed)(()=>r.disabled?.value||n.disabled);r.contentId||=mi(void 0,`reka-select-content`),(0,t.onMounted)(()=>{r.onTriggerChange(a.value)});let{getItems:s}=ha(),{search:c,handleTypeaheadSearch:l,resetTypeahead:u}=_i();function d(){o.value||(r.onOpenChange(!0),u())}function f(e){d(),r.triggerPointerDownPosRef.value={x:Math.round(e.pageX),y:Math.round(e.pageY)}}return(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Sa),{"as-child":``,reference:e.reference},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(X),{ref:(0,t.unref)(i),role:`combobox`,type:e.as===`button`?`button`:void 0,"aria-controls":(0,t.unref)(r).contentId,"aria-expanded":(0,t.unref)(r).open.value||!1,"aria-required":(0,t.unref)(r).required?.value,"aria-autocomplete":`none`,disabled:o.value,dir:(0,t.unref)(r)?.dir.value,"data-state":(0,t.unref)(r)?.open.value?`open`:`closed`,"data-disabled":o.value?``:void 0,"data-placeholder":(0,t.unref)(Yc)((0,t.unref)(r).modelValue?.value)?``:void 0,"as-child":e.asChild,as:e.as,onClick:n[0]||=e=>{(e?.currentTarget)?.focus()},onPointerdown:n[1]||=e=>{if(e.pointerType===`touch`)return e.preventDefault();let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&(f(e),e.preventDefault())},onPointerup:n[2]||=(0,t.withModifiers)(e=>{e.pointerType===`touch`&&f(e)},[`prevent`]),onKeydown:n[3]||=e=>{let n=(0,t.unref)(c)!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&n&&e.key===` `||((0,t.unref)(l)(e.key,(0,t.unref)(s)()),(0,t.unref)(Gc).includes(e.key)&&(d(),e.preventDefault()))}},{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},8,[`type`,`aria-controls`,`aria-expanded`,`aria-required`,`disabled`,`dir`,`data-state`,`data-disabled`,`data-placeholder`,`as-child`,`as`])]),_:3},8,[`reference`]))}}),El=(0,t.defineComponent)({__name:`SelectValue`,props:{placeholder:{type:String,required:!1,default:``},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`span`}},setup(e){let n=e,{forwardRef:r,currentElement:i}=Y(),a=Zc();(0,t.onMounted)(()=>{a.valueElement=i});let o=(0,t.computed)(()=>{let e=[],t=Array.from(a.optionsSet.value),n=e=>t.find(t=>qc(e,t.value,a.by));return e=Array.isArray(a.modelValue.value)?a.modelValue.value.map(e=>n(e)?.textContent??``):[n(a.modelValue.value)?.textContent??``],e.filter(Boolean)}),s=(0,t.computed)(()=>o.value.length?o.value.join(`, `):n.placeholder);return(e,i)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(X),{ref:(0,t.unref)(r),as:e.as,"as-child":e.asChild,style:{pointerEvents:`none`},"data-placeholder":o.value.length?void 0:n.placeholder},{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`,{selectedLabel:o.value,modelValue:(0,t.unref)(a).modelValue.value},()=>[(0,t.createTextVNode)((0,t.toDisplayString)(s.value),1)])]),_:3},8,[`as`,`as-child`,`data-placeholder`]))}}),Dl=(0,t.defineComponent)({__name:`SelectViewport`,props:{nonce:{type:String,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let n=e,{nonce:r}=(0,t.toRefs)(n),i=Ws(r),a=rl(),o=a.position===`item-aligned`?ol():void 0,{forwardRef:s,currentElement:c}=Y();(0,t.onMounted)(()=>{a?.onViewportChange(c.value)});let l=(0,t.ref)(0);function u(e){let t=e.currentTarget,{shouldExpandOnScrollRef:n,contentWrapper:r}=o??{};if(n?.value&&r?.value){let e=Math.abs(l.value-t.scrollTop);if(e>0){let n=window.innerHeight-20,i=Number.parseFloat(r.value.style.minHeight),a=Number.parseFloat(r.value.style.height),o=Math.max(i,a);if(o<n){let i=o+e,a=Math.min(n,i),s=i-a;r.value.style.height=`${a}px`,r.value.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,r.value.style.justifyContent=`flex-end`)}}}l.value=t.scrollTop}return(e,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,null,[(0,t.createVNode)((0,t.unref)(X),(0,t.mergeProps)({ref:(0,t.unref)(s),"data-reka-select-viewport":``,role:`presentation`},{...e.$attrs,...n},{style:{position:`relative`,flex:1,overflow:`hidden auto`},onScroll:u}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16),(0,t.createVNode)((0,t.unref)(X),{as:`style`,nonce:(0,t.unref)(i)},{default:(0,t.withCtx)(()=>r[0]||=[(0,t.createTextVNode)(` /* Hide scrollbars cross-browser and enable momentum scroll for touch devices */ [data-reka-select-viewport] { scrollbar-width:none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; } [data-reka-select-viewport]::-webkit-scrollbar { display: none; } `)]),_:1,__:[0]},8,[`nonce`])],64))}}),Ol=(0,t.defineComponent)({__name:`BaseSeparator`,props:{orientation:{type:String,required:!1,default:`horizontal`},decorative:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let n=e,r=[`horizontal`,`vertical`];function i(e){return r.includes(e)}let a=(0,t.computed)(()=>i(n.orientation)?n.orientation:`horizontal`),o=(0,t.computed)(()=>a.value===`vertical`?n.orientation:void 0),s=(0,t.computed)(()=>n.decorative?{role:`none`}:{"aria-orientation":o.value,role:`separator`});return(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(X),(0,t.mergeProps)({as:e.as,"as-child":e.asChild,"data-orientation":a.value},s.value),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16,[`as`,`as-child`,`data-orientation`]))}}),kl=(0,t.defineComponent)({__name:`Separator`,props:{orientation:{type:String,required:!1,default:`horizontal`},decorative:{type:Boolean,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){let n=e;return(e,r)=>((0,t.openBlock)(),(0,t.createBlock)(Ol,(0,t.normalizeProps)((0,t.guardReactiveProps)(n)),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16))}}),Al=(0,t.defineComponent)({__name:`TooltipArrow`,props:{width:{type:Number,required:!1,default:10},height:{type:Number,required:!1,default:5},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`svg`}},setup(e){let n=e;return Y(),(e,r)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Us),(0,t.normalizeProps)((0,t.guardReactiveProps)(n)),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16))}}),[jl,Ml]=vr(`TooltipProvider`),Nl=(0,t.defineComponent)({inheritAttrs:!1,__name:`TooltipProvider`,props:{delayDuration:{type:Number,required:!1,default:700},skipDelayDuration:{type:Number,required:!1,default:300},disableHoverableContent:{type:Boolean,required:!1,default:!1},disableClosingTrigger:{type:Boolean,required:!1},disabled:{type:Boolean,required:!1},ignoreNonKeyboardFocus:{type:Boolean,required:!1,default:!1},content:{type:Object,required:!1}},setup(e){let{delayDuration:n,skipDelayDuration:r,disableHoverableContent:i,disableClosingTrigger:a,ignoreNonKeyboardFocus:o,disabled:s,content:c}=(0,t.toRefs)(e);Y();let l=(0,t.ref)(!0),u=(0,t.ref)(!1),{start:d,stop:f}=Nr(()=>{l.value=!0},r,{immediate:!1});return Ml({isOpenDelayed:l,delayDuration:n,onOpen(){f(),l.value=!1},onClose(){d()},isPointerInTransitRef:u,disableHoverableContent:i,disableClosingTrigger:a,disabled:s,ignoreNonKeyboardFocus:o,content:c}),(e,n)=>(0,t.renderSlot)(e.$slots,`default`)}}),Pl=`tooltip.open`,[Fl,Il]=vr(`TooltipRoot`),Ll=(0,t.defineComponent)({__name:`TooltipRoot`,props:{defaultOpen:{type:Boolean,required:!1,default:!1},open:{type:Boolean,required:!1,default:void 0},delayDuration:{type:Number,required:!1,default:void 0},disableHoverableContent:{type:Boolean,required:!1,default:void 0},disableClosingTrigger:{type:Boolean,required:!1,default:void 0},disabled:{type:Boolean,required:!1,default:void 0},ignoreNonKeyboardFocus:{type:Boolean,required:!1,default:void 0}},emits:[`update:open`],setup(e,{emit:r}){let i=e,a=r;Y();let o=jl(),s=(0,t.computed)(()=>i.disableHoverableContent??o.disableHoverableContent.value),c=(0,t.computed)(()=>i.disableClosingTrigger??o.disableClosingTrigger.value),l=(0,t.computed)(()=>i.disabled??o.disabled.value),u=(0,t.computed)(()=>i.delayDuration??o.delayDuration.value),d=(0,t.computed)(()=>i.ignoreNonKeyboardFocus??o.ignoreNonKeyboardFocus.value),f=(0,n.useVModel)(i,`open`,a,{defaultValue:i.defaultOpen,passive:i.open===void 0});(0,t.watch)(f,e=>{o.onClose&&(e?(o.onOpen(),document.dispatchEvent(new CustomEvent(Pl))):o.onClose())});let p=(0,t.ref)(!1),m=(0,t.ref)(),h=(0,t.computed)(()=>f.value?p.value?`delayed-open`:`instant-open`:`closed`),{start:g,stop:_}=(0,n.useTimeoutFn)(()=>{p.value=!0,f.value=!0},u,{immediate:!1});function v(){_(),p.value=!1,f.value=!0}function y(){_(),f.value=!1}function b(){g()}return Il({contentId:``,open:f,stateAttribute:h,trigger:m,onTriggerChange(e){m.value=e},onTriggerEnter(){o.isOpenDelayed.value?b():v()},onTriggerLeave(){s.value?y():_()},onOpen:v,onClose:y,disableHoverableContent:s,disableClosingTrigger:c,disabled:l,ignoreNonKeyboardFocus:d}),(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(xa),null,{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`,{open:(0,t.unref)(f)})]),_:3}))}}),Rl=(0,t.defineComponent)({__name:`TooltipContentImpl`,props:{ariaLabel:{type:String,required:!1},asChild:{type:Boolean,required:!1,default:void 0},as:{type:null,required:!1},side:{type:null,required:!1},sideOffset:{type:Number,required:!1},align:{type:null,required:!1},alignOffset:{type:Number,required:!1},avoidCollisions:{type:Boolean,required:!1,default:void 0},collisionBoundary:{type:null,required:!1},collisionPadding:{type:[Number,Object],required:!1},arrowPadding:{type:Number,required:!1},sticky:{type:String,required:!1},hideWhenDetached:{type:Boolean,required:!1,default:void 0},positionStrategy:{type:String,required:!1},updatePositionStrategy:{type:String,required:!1}},emits:[`escapeKeyDown`,`pointerDownOutside`],setup(e,{emit:r}){let i=e,a=r,o=Fl(),s=jl(),{forwardRef:c,currentElement:l}=Y(),u=(0,t.computed)(()=>i.ariaLabel||l.value?.textContent),d=(0,t.computed)(()=>{let{ariaLabel:e,...t}=i;return Lr(t,s.content.value??{},{side:`top`,sideOffset:0,align:`center`,avoidCollisions:!0,collisionBoundary:[],collisionPadding:0,arrowPadding:0,sticky:`partial`,hideWhenDetached:!1})});return(0,t.onMounted)(()=>{(0,n.useEventListener)(window,`scroll`,e=>{e.target?.contains(o.trigger.value)&&o.onClose()}),(0,n.useEventListener)(window,Pl,o.onClose)}),(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Ii),{"as-child":``,"disable-outside-pointer-events":!1,onEscapeKeyDown:n[0]||=e=>a(`escapeKeyDown`,e),onPointerDownOutside:n[1]||=e=>{(0,t.unref)(o).disableClosingTrigger.value&&(0,t.unref)(o).trigger.value?.contains(e.target)&&e.preventDefault(),a(`pointerDownOutside`,e)},onFocusOutside:n[2]||=(0,t.withModifiers)(()=>{},[`prevent`]),onDismiss:n[3]||=e=>(0,t.unref)(o).onClose()},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(Vs),(0,t.mergeProps)({ref:(0,t.unref)(c),"data-state":(0,t.unref)(o).stateAttribute.value},{...e.$attrs,...d.value},{style:{"--reka-tooltip-content-transform-origin":`var(--reka-popper-transform-origin)`,"--reka-tooltip-content-available-width":`var(--reka-popper-available-width)`,"--reka-tooltip-content-available-height":`var(--reka-popper-available-height)`,"--reka-tooltip-trigger-width":`var(--reka-popper-anchor-width)`,"--reka-tooltip-trigger-height":`var(--reka-popper-anchor-height)`}}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`),(0,t.createVNode)((0,t.unref)(ga),{id:(0,t.unref)(o).contentId,role:`tooltip`},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)(u.value),1)]),_:1},8,[`id`])]),_:3},16,[`data-state`])]),_:3}))}}),zl=(0,t.defineComponent)({__name:`TooltipContentHoverable`,props:{ariaLabel:{type:String,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},side:{type:null,required:!1},sideOffset:{type:Number,required:!1},align:{type:null,required:!1},alignOffset:{type:Number,required:!1},avoidCollisions:{type:Boolean,required:!1},collisionBoundary:{type:null,required:!1},collisionPadding:{type:[Number,Object],required:!1},arrowPadding:{type:Number,required:!1},sticky:{type:String,required:!1},hideWhenDetached:{type:Boolean,required:!1},positionStrategy:{type:String,required:!1},updatePositionStrategy:{type:String,required:!1}},setup(e){let n=Jr(e),{forwardRef:r,currentElement:i}=Y(),{trigger:a,onClose:o}=Fl(),s=jl(),{isPointerInTransit:c,onPointerExit:l}=Xr(a,i);return s.isPointerInTransitRef=c,l(()=>{o()}),(e,i)=>((0,t.openBlock)(),(0,t.createBlock)(Rl,(0,t.mergeProps)({ref:(0,t.unref)(r)},(0,t.unref)(n)),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16))}}),Bl=(0,t.defineComponent)({__name:`TooltipContent`,props:{forceMount:{type:Boolean,required:!1},ariaLabel:{type:String,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1},side:{type:null,required:!1},sideOffset:{type:Number,required:!1},align:{type:null,required:!1},alignOffset:{type:Number,required:!1},avoidCollisions:{type:Boolean,required:!1},collisionBoundary:{type:null,required:!1},collisionPadding:{type:[Number,Object],required:!1},arrowPadding:{type:Number,required:!1},sticky:{type:String,required:!1},hideWhenDetached:{type:Boolean,required:!1},positionStrategy:{type:String,required:!1},updatePositionStrategy:{type:String,required:!1}},emits:[`escapeKeyDown`,`pointerDownOutside`],setup(e,{emit:n}){let r=e,i=n,a=Fl(),o=Yr(r,i),{forwardRef:s}=Y();return(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Si),{present:e.forceMount||(0,t.unref)(a).open.value},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)((0,t.unref)(a).disableHoverableContent.value?Rl:zl),(0,t.mergeProps)({ref:(0,t.unref)(s)},(0,t.unref)(o)),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16))]),_:3},8,[`present`]))}}),Vl=(0,t.defineComponent)({__name:`TooltipPortal`,props:{to:{type:null,required:!1},disabled:{type:Boolean,required:!1},defer:{type:Boolean,required:!1},forceMount:{type:Boolean,required:!1}},setup(e){let n=e;return(e,r)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(da),(0,t.normalizeProps)((0,t.guardReactiveProps)(n)),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16))}}),Hl=(0,t.defineComponent)({__name:`TooltipTrigger`,props:{reference:{type:null,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1,default:`button`}},setup(e){let n=e,r=Fl(),i=jl();r.contentId||=mi(void 0,`reka-tooltip-content`);let{forwardRef:a,currentElement:o}=Y(),s=(0,t.ref)(!1),c=(0,t.ref)(!1),l=(0,t.computed)(()=>r.disabled.value?{}:{click:g,focus:m,pointermove:f,pointerleave:p,pointerdown:d,blur:h});(0,t.onMounted)(()=>{r.onTriggerChange(o.value)});function u(){setTimeout(()=>{s.value=!1},1)}function d(){r.open&&!r.disableClosingTrigger.value&&r.onClose(),s.value=!0,document.addEventListener(`pointerup`,u,{once:!0})}function f(e){e.pointerType!==`touch`&&!c.value&&!i.isPointerInTransitRef.value&&(r.onTriggerEnter(),c.value=!0)}function p(){r.onTriggerLeave(),c.value=!1}function m(e){s.value||r.ignoreNonKeyboardFocus.value&&!e.target.matches?.(`:focus-visible`)||r.onOpen()}function h(){r.onClose()}function g(){r.disableClosingTrigger.value||r.onClose()}return(e,i)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Sa),{"as-child":``,reference:e.reference},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(X),(0,t.mergeProps)({ref:(0,t.unref)(a),"aria-describedby":(0,t.unref)(r).open.value?(0,t.unref)(r).contentId:void 0,"data-state":(0,t.unref)(r).stateAttribute.value,as:e.as,"as-child":n.asChild,"data-grace-area-trigger":``},(0,t.toHandlers)(l.value)),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16,[`aria-describedby`,`data-state`,`as`,`as-child`])]),_:3},8,[`reference`]))}}),Q=(0,t.defineComponent)({__name:`Button`,props:{variant:{},size:{},class:{type:[Boolean,null,String,Object,Array]},asChild:{type:Boolean},as:{default:`button`}},setup(e){let n=e;return(r,i)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(X),{"data-slot":`button`,as:e.as,"as-child":e.asChild,class:(0,t.normalizeClass)((0,t.unref)(J)((0,t.unref)(Ul)({variant:e.variant,size:e.size}),n.class))},{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(r.$slots,`default`)]),_:3},8,[`as`,`as-child`,`class`]))}});let Ul=pr(`wp:inline-flex wp:items-center wp:justify-center wp:gap-2 wp:whitespace-nowrap wp:rounded-md wp:text-sm wp:font-medium wp:transition-all wp:disabled:pointer-events-none wp:disabled:opacity-50 wp:[&_svg]:pointer-events-none wp:[&_svg:not([class*='size-'])]:size-4 wp:shrink-0 wp:[&_svg]:shrink-0 wp:outline-none wp:focus-visible:border-ring wp:focus-visible:ring-ring/50 wp:focus-visible:ring-[3px] wp:aria-invalid:ring-destructive/20 wp:dark:aria-invalid:ring-destructive/40 wp:aria-invalid:border-destructive`,{variants:{variant:{default:`wp:bg-primary wp:text-primary-foreground wp:hover:bg-primary/90`,destructive:`wp:bg-destructive wp:text-white wp:hover:bg-destructive/90 wp:focus-visible:ring-destructive/20 wp:dark:focus-visible:ring-destructive/40 wp:dark:bg-destructive/60`,outline:`wp:border wp:bg-background wp:shadow-xs wp:hover:bg-accent wp:hover:text-accent-foreground wp:dark:bg-input/30 wp:dark:border-input wp:dark:hover:bg-input/50`,secondary:`wp:bg-secondary wp:text-secondary-foreground wp:hover:bg-secondary/80`,ghost:`wp:hover:bg-accent wp:hover:text-accent-foreground wp:dark:hover:bg-accent/50`,link:`wp:text-primary wp:underline-offset-4 wp:hover:underline`},size:{default:`wp:h-9 wp:px-4 wp:py-2 wp:has-[>svg]:px-3`,sm:`wp:h-8 wp:rounded-md wp:gap-1.5 wp:px-3 wp:has-[>svg]:px-2.5`,lg:`wp:h-10 wp:rounded-md wp:px-6 wp:has-[>svg]:px-4`,icon:`wp:size-9`,"icon-sm":`wp:size-8`,"icon-lg":`wp:size-10`}},defaultVariants:{variant:`default`,size:`default`}});var Wl={class:`webphone-keypad wp:grid wp:grid-cols-3 wp:gap-y-3 wp:gap-x-6 wp:px-4 wp:py-2 wp:mx-auto wp:place-items-center`},Gl=(0,t.defineComponent)({__name:`KeyPad`,setup(e){let n=(0,t.inject)(`webphone`),{sendDTMF:r}=(0,t.inject)(`sip`),{playDtmf:i}=Pt(),a=[`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`,`*`,`0`,`#`],o=e=>{i(e),n.callStatus===`connected`?r(e):n.appendKeypad(e)};return(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Wl,[((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(a,e=>(0,t.createVNode)((0,t.unref)(Q),{key:e,onClick:t=>o(e),variant:`ghost`,size:`icon`,class:`webphone-keypad__key wp:flex wp:items-center wp:justify-center wp:h-12 wp:w-full wp:rounded-xs wp:text-2xl wp:bg-neutral-100 wp:dark:bg-neutral-700 wp:hover:bg-neutral-200 wp:dark:hover:bg-neutral-600 wp:hover:text-primary wp:dark:hover:text-neutral-100 wp:text-primary wp:dark:text-white wp:transition-all wp:duration-150 wp:active:scale-95 wp:font-light montserrat`,"data-key":e},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)(e),1)]),_:2},1032,[`onClick`,`data-key`])),64))]))}}),Kl=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),ql=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),Jl=e=>{let t=ql(e);return t.charAt(0).toUpperCase()+t.slice(1)},Yl=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),Xl=e=>e===``,Zl={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":2,"stroke-linecap":`round`,"stroke-linejoin":`round`},Ql=({name:e,iconNode:n,absoluteStrokeWidth:r,"absolute-stroke-width":i,strokeWidth:a,"stroke-width":o,size:s=Zl.width,color:c=Zl.stroke,...l},{slots:u})=>(0,t.h)(`svg`,{...Zl,...l,width:s,height:s,stroke:c,"stroke-width":Xl(r)||Xl(i)||r===!0||i===!0?Number(a||o||Zl[`stroke-width`])*24/Number(s):a||o||Zl[`stroke-width`],class:Yl(`lucide`,l.class,...e?[`lucide-${Kl(Jl(e))}-icon`,`lucide-${Kl(e)}`]:[`lucide-icon`])},[...n.map(e=>(0,t.h)(...e)),...u.default?[u.default()]:[]]),$=(e,n)=>(r,{slots:i,attrs:a})=>(0,t.h)(Ql,{...a,...r,iconNode:n,name:e},i),$l=$(`building-2`,[[`path`,{d:`M10 12h4`,key:`a56b0p`}],[`path`,{d:`M10 8h4`,key:`1sr2af`}],[`path`,{d:`M14 21v-3a2 2 0 0 0-4 0v3`,key:`1rgiei`}],[`path`,{d:`M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2`,key:`secmi2`}],[`path`,{d:`M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16`,key:`16ra0t`}]]),eu=$(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),tu=$(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),nu=$(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),ru=$(`circle-user`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`10`,r:`3`,key:`ilqhr7`}],[`path`,{d:`M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662`,key:`154egf`}]]),iu=$(`mic-off`,[[`path`,{d:`M12 19v3`,key:`npa21l`}],[`path`,{d:`M15 9.34V5a3 3 0 0 0-5.68-1.33`,key:`1gzdoj`}],[`path`,{d:`M16.95 16.95A7 7 0 0 1 5 12v-2`,key:`cqa7eg`}],[`path`,{d:`M18.89 13.23A7 7 0 0 0 19 12v-2`,key:`16hl24`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M9 9v3a3 3 0 0 0 5.12 2.12`,key:`r2i35w`}]]),au=$(`mic`,[[`path`,{d:`M12 19v3`,key:`npa21l`}],[`path`,{d:`M19 10v2a7 7 0 0 1-14 0v-2`,key:`1vc78b`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`13`,rx:`3`,key:`s6n7sd`}]]),ou=$(`pause`,[[`rect`,{x:`14`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`kaeet6`}],[`rect`,{x:`5`,y:`3`,width:`5`,height:`18`,rx:`1`,key:`1wsw3u`}]]),su=$(`phone-incoming`,[[`path`,{d:`M16 2v6h6`,key:`1mfrl5`}],[`path`,{d:`m22 2-6 6`,key:`6f0sa0`}],[`path`,{d:`M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384`,key:`9njp5v`}]]),cu=$(`phone-missed`,[[`path`,{d:`m16 2 6 6`,key:`1gw87d`}],[`path`,{d:`m22 2-6 6`,key:`6f0sa0`}],[`path`,{d:`M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384`,key:`9njp5v`}]]),lu=$(`phone-outgoing`,[[`path`,{d:`m16 8 6-6`,key:`oawc05`}],[`path`,{d:`M22 8V2h-6`,key:`oqy2zc`}],[`path`,{d:`M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384`,key:`9njp5v`}]]),uu=$(`phone`,[[`path`,{d:`M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384`,key:`9njp5v`}]]),du=$(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),fu=$(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),pu=$(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),mu=$(`video`,[[`path`,{d:`m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5`,key:`ftymec`}],[`rect`,{x:`2`,y:`6`,width:`14`,height:`12`,rx:`2`,key:`158x01`}]]),hu=$(`voicemail`,[[`circle`,{cx:`6`,cy:`12`,r:`4`,key:`1ehtga`}],[`circle`,{cx:`18`,cy:`12`,r:`4`,key:`4vafl8`}],[`line`,{x1:`6`,x2:`18`,y1:`16`,y2:`16`,key:`pmt8us`}]]),gu=$(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),_u=$(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),vu={xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 14 14`};function yu(e,n){return(0,t.openBlock)(),(0,t.createElementBlock)(`svg`,vu,[...n[0]||=[(0,t.createStaticVNode)(`<g clip-path="url(#a)"><path fill="currentColor" d="m1.913 7.003.035.49c0 .605.49 1.095 1.095 1.095.015 0 1.08-.14 1.08-.14a1.1 1.1 0 0 0 1.07-1.07l.075-.655c1.192-.463 2.33-.465 3.47-.005l.072.657c.01.585.485 1.06 1.07 1.07 0 0 1.065.14 1.08.14.605 0 1.095-.49 1.095-1.07l.038-.537c0-.575-.23-1.12-.65-1.54-1.91-1.91-6.973-1.908-8.88 0-.418.417-.65.965-.648 1.562zM10.94 5.94c.285.285.443.653.44 1.015l-.037.538a.39.39 0 0 1-.368.387s-1.057-.137-1.072-.137a.4.4 0 0 1-.388-.388c0-.015-.1-.92-.1-.92a.35.35 0 0 0-.207-.282c-1.43-.64-2.913-.643-4.408-.003a.36.36 0 0 0-.212.288s-.103.907-.103.917a.386.386 0 0 1-.387.388c-.015 0-1.073.137-1.073.137a.395.395 0 0 1-.37-.41l-.035-.49c0-.385.155-.755.44-1.04 1.74-1.74 6.383-1.497 7.88 0"></path></g><circle cx="7" cy="7" r="6.6" stroke="currentColor" stroke-width=".8"></circle><defs><clipPath id="a"><path fill="#fff" d="M7 13 1 7l6-6 6 6z"></path></clipPath></defs>`,3)]])}var bu={render:yu},xu={xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 9 9`};function Su(e,n){return(0,t.openBlock)(),(0,t.createElementBlock)(`svg`,xu,[...n[0]||=[(0,t.createElementVNode)(`g`,{"clip-path":`url(#a)`},[(0,t.createElementVNode)(`path`,{fill:`currentColor`,d:`M0 8.625V6a3.38 3.38 0 0 1 3.375-3.375h1.811V2.03a.75.75 0 0 1 1.28-.53l2.206 2.205a1.125 1.125 0 0 1 0 1.59L6.466 7.5a.75.75 0 0 1-1.28-.53v-.595H3a2.25 2.25 0 0 0-2.25 2.25.375.375 0 0 1-.75 0M5.936 3a.375.375 0 0 1-.375.375H3.375A2.63 2.63 0 0 0 .75 6v.643A3 3 0 0 1 3 5.625h2.561A.375.375 0 0 1 5.936 6v.97l2.205-2.205a.375.375 0 0 0 0-.53L5.936 2.03z`})],-1),(0,t.createElementVNode)(`defs`,null,[(0,t.createElementVNode)(`clipPath`,{id:`a`},[(0,t.createElementVNode)(`path`,{fill:`#fff`,d:`M0 0h9v9H0z`})])],-1)]])}var Cu={render:Su},wu={xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 20 20`};function Tu(e,n){return(0,t.openBlock)(),(0,t.createElementBlock)(`svg`,wu,[...n[0]||=[(0,t.createStaticVNode)(`<g clip-path="url(#a)"><path fill="currentColor" d="m13.499 13.495.321-.371a1.095 1.095 0 0 0 0-1.549c-.01-.01-.862-.665-.862-.665a1.1 1.1 0 0 0-1.514 0l-.516.41c-1.17-.516-1.976-1.318-2.457-2.45l.414-.516a1.09 1.09 0 0 0 0-1.513s-.654-.852-.665-.863c-.428-.427-1.12-.427-1.53-.017l-.407.353c-.407.407-.63.955-.63 1.549 0 2.701 3.582 6.279 6.28 6.279.59 0 1.141-.223 1.562-.647zM6.364 7.863c0-.403.148-.774.406-1.029l.407-.354a.39.39 0 0 1 .534-.014s.65.845.661.856a.4.4 0 0 1 0 .548c-.01.01-.58.721-.58.721a.35.35 0 0 0-.053.347c.559 1.463 1.605 2.513 3.115 3.118a.36.36 0 0 0 .354-.053l.72-.576a.386.386 0 0 1 .549 0c.01.01.855.66.855.66a.395.395 0 0 1-.028.552l-.322.372a1.47 1.47 0 0 1-1.046.424c-2.46 0-5.572-3.454-5.572-5.572"></path></g><circle cx="9.899" cy="9.899" r="6.6" stroke="currentColor" stroke-width=".8" transform="rotate(-135 9.9 9.9)"></circle><defs><clipPath id="a"><path fill="#fff" d="M14.143 5.657v8.485H5.658V5.657z"></path></clipPath></defs>`,3)]])}var Eu={render:Tu},Du={xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`2.8 2.8 14.2 14.2`};function Ou(e,n){return(0,t.openBlock)(),(0,t.createElementBlock)(`svg`,Du,[...n[0]||=[(0,t.createElementVNode)(`circle`,{cx:`9.899`,cy:`9.899`,r:`6.6`,stroke:`currentColor`,"stroke-width":`.8`,transform:`rotate(-135 9.9 9.9)`},null,-1),(0,t.createElementVNode)(`path`,{fill:`currentColor`,d:`M13.634 8.18a.66.66 0 0 0-.729.094l-.585.591a1.663 1.663 0 0 0-1.653-1.531h-3C6.747 7.334 6 8.08 6 9v2a1.67 1.67 0 0 0 1.667 1.667h3c.876 0 1.589-.683 1.654-1.543l.585.585.036.03a.66.66 0 0 0 .692.063.66.66 0 0 0 .366-.591V8.77a.66.66 0 0 0-.366-.592M10.667 12h-3c-.552 0-1-.449-1-1V9c0-.551.448-1 1-1h3c.551 0 1 .449 1 1v2c0 .551-.449 1-1 1m1.666-1.806v-.396l1-1.01.009 2.413z`},null,-1)]])}var ku={render:Ou},Au=[`data-call-status`],ju={key:0,class:`webphone-actions__idle wp:!w-full wp:flex wp:flex-col wp:items-center wp:space-y-2 wp:mb-4`},Mu={key:2,class:`webphone-actions__connected wp:w-full wp:flex wp:flex-col wp:items-center wp:gap-3`},Nu={class:`webphone-actions__row wp:flex wp:items-center wp:gap-6`},Pu={key:4,class:`webphone-actions__transfer-state wp:absolute wp:inset-x-0 wp:bottom-full wp:mb-2 wp:flex wp:justify-center wp:gap-2`},Fu=(0,t.defineComponent)({__name:`CallActions`,props:{destination:{},isVideo:{type:Boolean}},emits:[`transfer`,`completeTransfer`,`cancelTransfer`],setup(e,{emit:n}){let r=(0,t.inject)(`webphone`),{makeCall:i,hangupCall:a,answerCall:o,toggleMute:s,toggleHold:c}=(0,t.inject)(`sip`),l=e,u=n,d=(0,t.computed)(()=>!!r.transferInProgress),f=(0,t.computed)(()=>l.destination||r.keypadValue||r.lastDialedNumber||``),p=(0,t.computed)(()=>l.isVideo?f.value?/^[0-9*#]{1,5}$/.test(f.value):!0:!1),m=async e=>{try{l.destination?await i(l.destination,e):r.keypadValue?await i(r.keypadValue,e):r.lastDialedNumber&&(r.keypadValue=r.lastDialedNumber)}catch(t){if(console.error(`Error initiating call:`,t),e){let e=`No se pudo acceder a la cámara.`,n=t instanceof Error?t.name:String(t);n===`NotReadableError`?e=`La cámara parece estar en uso por otra aplicación (ej: Zoom, Meet) o no se puede acceder al hardware.`:n===`NotAllowedError`||n===`PermissionDeniedError`?e=`Permiso de cámara denegado. Por favor, permita el acceso a la cámara.`:n===`NotFoundError`?e=`No se detectó ninguna cámara en el sistema.`:e+=` `+(t instanceof Error?t.message:String(t)),confirm(`${e}\n\n¿Desea realizar la llamada solo con AUDIO?`)&&m(!1)}else alert(`Error al iniciar la llamada: `+(t instanceof Error?t.message:String(t)))}},h=(e=!1)=>{o(e)},g=(0,t.computed)(()=>{let e={};return r.channels.forEach(t=>{let n=t.status===`connected`||t.status===`calling`||t.status===`incoming`;e[t.id]=n?`wp:text-[var(--color-red)]`:`wp:text-[var(--color-avaible)]`}),e}),_=(0,t.computed)(()=>g.value[r.activeChannelId]??`wp:text-[var(--p-primary-color)]`);return(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:`webphone-actions wp:flex wp:justify-center wp:items-center wp:gap-2 wp:px-4 wp:relative wp:mb-4`,"data-call-status":(0,t.unref)(r).callStatus},[(0,t.unref)(r).callStatus===`idle`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,ju,[(0,t.createVNode)((0,t.unref)(Q),{variant:`default`,size:`icon`,onClick:n[0]||=e=>m(!1),disabled:!l.destination&&(!(0,t.unref)(r).keypadValue||!/^[+]?[0-9*#]+$/.test((0,t.unref)(r).keypadValue))&&!(0,t.unref)(r).lastDialedNumber,"aria-label":`Audio Call`,class:`webphone-actions__button webphone-actions__button--call wp:w-full wp:px-4 wp:border-0 wp:bg-gradient-to-r wp:from-[color:var(--p-primary-color)]/80 wp:to-[color:var(--p-primary-color)]/100 wp:hover:from-[color:var(--p-primary-color)]/75 wp:hover:to-[color:var(--p-primary-color)]`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(Eu),{class:`webphone-actions__button-icon wp:size-8 wp:text-white`}),n[7]||=(0,t.createElementVNode)(`span`,{class:`webphone-actions__button-label wp:w-full wp:text-white`},`Llamar`,-1)]),_:1},8,[`disabled`]),p.value?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Q),{key:0,variant:`outline`,size:`icon`,onClick:n[1]||=e=>m(!0),disabled:!l.destination&&(!(0,t.unref)(r).keypadValue||!/^[+]?[0-9*#]+$/.test((0,t.unref)(r).keypadValue))&&!(0,t.unref)(r).lastDialedNumber,"aria-label":`Video Call`,class:`webphone-actions__button webphone-actions__button--video wp:w-full wp:px-4 wp:bg-transparent wp:border wp:border-primary wp:hover:bg-[var(--p-primary-color)]/8`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(ku),{class:(0,t.normalizeClass)([`webphone-actions__button-icon wp:size-6 wp:text-primary`,_.value])},null,8,[`class`]),n[8]||=(0,t.createElementVNode)(`span`,{class:`webphone-actions__button-label wp:w-full wp:text-primary`},` Video llamada a extensiones `,-1)]),_:1},8,[`disabled`])):(0,t.createCommentVNode)(``,!0)])):(0,t.createCommentVNode)(``,!0),(0,t.unref)(r).callStatus===`incoming`?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:1},[(0,t.unref)(r).activeChannel?.hasVideo?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Q),{key:0,variant:`default`,size:`icon`,onClick:n[2]||=e=>h(!0),class:`webphone-actions__button webphone-actions__button--answer-video wp:animate-pulse wp:w-12 wp:h-12 wp:rounded-full wp:bg-transparent wp:hover:bg-[var(--p-primary-color)]/10`,"aria-label":`Answer Video`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(mu),{class:`webphone-actions__button-icon wp:w-5 wp:h-5 wp:text-[var(--p-primary-color)]`})]),_:1})):(0,t.createCommentVNode)(``,!0),(0,t.createVNode)((0,t.unref)(Q),{variant:`default`,size:`icon`,onClick:n[3]||=e=>h(!1),class:`webphone-actions__button webphone-actions__button--answer wp:animate-pulse wp:w-12 wp:h-12 wp:rounded-full wp:bg-transparent wp:hover:bg-[var(--p-primary-color)]/10`,"aria-label":`Answer`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(uu),{class:`webphone-actions__button-icon wp:w-5 wp:h-5 wp:text-[var(--p-primary-color)]`})]),_:1}),(0,t.createVNode)((0,t.unref)(Q),{variant:`destructive`,size:`icon`,onClick:(0,t.unref)(a),"aria-label":`Reject`,class:`webphone-actions__button webphone-actions__button--hangup webphone-actions__button--reject wp:w-12 wp:h-12 wp:rounded-full wp:border-0 wp:bg-gradient-to-r wp:from-destructive/60 wp:to-destructive/90 wp:hover:from-destructive/70 wp:hover:to-destructive/95`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(bu),{class:`webphone-actions__button-icon wp:w-5 wp:h-5 wp:text-white`})]),_:1},8,[`onClick`])],64)):(0,t.createCommentVNode)(``,!0),(0,t.unref)(r).callStatus===`connected`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Mu,[(0,t.createElementVNode)(`div`,Nu,[(0,t.createVNode)((0,t.unref)(Q),{variant:(0,t.unref)(r).isMuted?`destructive`:`secondary`,size:`icon`,onClick:(0,t.unref)(s),"aria-label":`Mute`,class:`webphone-actions__button webphone-actions__button--mute wp:w-12 wp:h-12 wp:rounded-full wp:bg-primary/10 wp:hover:bg-[var(--p-primary-color)]/20`},{default:(0,t.withCtx)(()=>[(0,t.unref)(r).isMuted?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(iu),{key:0,class:`webphone-actions__button-icon wp:size-5 wp:text-status-disconnected`})):((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(au),{key:1,class:`webphone-actions__button-icon wp:size-5 wp:text-[var(--p-primary-color)]`}))]),_:1},8,[`variant`,`onClick`]),(0,t.createVNode)((0,t.unref)(Q),{variant:((0,t.unref)(r).isHeld,`secondary`),size:`icon`,onClick:(0,t.unref)(c),"aria-label":`Hold`,class:`webphone-actions__button webphone-actions__button--hold wp:w-12 wp:h-12 wp:rounded-full wp:bg-primary/10 wp:hover:bg-[var(--p-primary-color)]/20`},{default:(0,t.withCtx)(()=>[(0,t.unref)(r).isHeld?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(du),{key:0,class:`webphone-actions__button-icon wp:size-5 wp:text-status-hold`})):((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(ou),{key:1,class:`webphone-actions__button-icon wp:size-5 wp:text-[var(--p-primary-color)]`}))]),_:1},8,[`variant`,`onClick`]),d.value?(0,t.createCommentVNode)(``,!0):((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Q),{key:0,variant:`secondary`,size:`icon`,onClick:n[4]||=e=>u(`transfer`),"aria-label":`Transfer`,class:`webphone-actions__button webphone-actions__button--transfer wp:w-12 wp:h-12 wp:rounded-full wp:bg-primary/10 wp:hover:bg-[var(--p-primary-color)]/20`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(Cu),{class:`webphone-actions__button-icon wp:size-5 wp:text-[var(--p-primary-color)]`})]),_:1}))]),(0,t.createVNode)((0,t.unref)(Q),{size:`icon`,onClick:(0,t.unref)(a),"aria-label":`Hangup`,class:`webphone-actions__button webphone-actions__button--hangup wp:w-full wp:px-4 wp:border-0 wp:bg-gradient-to-r wp:from-destructive/60 wp:to-destructive/90 wp:hover:from-destructive/70 wp:hover:to-destructive/95`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(bu),{class:`webphone-actions__button-icon wp:size-6 wp:text-white`}),n[9]||=(0,t.createElementVNode)(`span`,{class:`webphone-actions__button-label wp:w-full wp:text-white`},`Colgar`,-1)]),_:1},8,[`onClick`])])):(0,t.createCommentVNode)(``,!0),(0,t.unref)(r).callStatus===`calling`?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Q),{key:3,variant:`destructive`,size:`lg`,onClick:(0,t.unref)(a),"aria-label":`Cancel`,class:`webphone-actions__button webphone-actions__button--hangup webphone-actions__button--cancel wp:w-full wp:px-4 wp:border-0 wp:bg-gradient-to-r wp:from-destructive/60 wp:to-destructive/90 wp:hover:from-destructive/70 wp:hover:to-destructive/95`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(bu),{class:`webphone-actions__button-icon wp:size-6 wp:text-white`}),n[10]||=(0,t.createElementVNode)(`span`,{class:`webphone-actions__button-label wp:w-full wp:text-white`},`Colgar`,-1)]),_:1},8,[`onClick`])):(0,t.createCommentVNode)(``,!0),d.value&&(0,t.unref)(r).callStatus===`connected`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Pu,[(0,t.createVNode)((0,t.unref)(Q),{variant:`default`,size:`sm`,onClick:n[5]||=e=>u(`completeTransfer`),class:`webphone-actions__button webphone-actions__button--complete-transfer wp:gap-2 wp:bg-status-available wp:hover:bg-status-available/90 wp:text-white`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(eu),{class:`wp:w-4 wp:h-4`}),n[11]||=(0,t.createTextVNode)(` Completar Transferencia `,-1)]),_:1}),(0,t.createVNode)((0,t.unref)(Q),{variant:`destructive`,size:`sm`,onClick:n[6]||=e=>u(`cancelTransfer`),class:`webphone-actions__button webphone-actions__button--cancel-transfer wp:gap-2`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(_u),{class:`wp:w-4 wp:h-4`}),n[12]||=(0,t.createTextVNode)(` Cancelar `,-1)]),_:1})])):(0,t.createCommentVNode)(``,!0)],8,Au))}}),Iu=(0,t.defineComponent)({__name:`Input`,props:{defaultValue:{},modelValue:{},class:{type:[Boolean,null,String,Object,Array]}},emits:[`update:modelValue`],setup(e,{emit:r}){let i=e,a=(0,n.useVModel)(i,`modelValue`,r,{passive:!0,defaultValue:i.defaultValue});return(e,n)=>(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`input`,{"onUpdate:modelValue":n[0]||=e=>(0,t.isRef)(a)?a.value=e:null,"data-slot":`input`,class:(0,t.normalizeClass)((0,t.unref)(J)(`wp:file:text-foreground wp:placeholder:text-muted-foreground wp:selection:bg-primary wp:selection:text-primary-foreground wp:dark:bg-input/30 wp:border-blue-500 wp:h-9 wp:w-full wp:min-w-0 wp:rounded-md wp:border wp:bg-transparent wp:px-3 wp:py-1 wp:text-base wp:shadow-xs wp:transition-[color,box-shadow] wp:outline-none wp:file:inline-flex wp:file:h-7 wp:file:border-0 wp:file:bg-transparent wp:file:text-sm wp:file:font-medium wp:disabled:pointer-events-none wp:disabled:cursor-not-allowed wp:disabled:opacity-50 wp:md:text-sm`,`wp:focus-visible:border-ring wp:focus-visible:ring-ring/50 wp:focus-visible:ring-[3px]`,`wp:aria-invalid:ring-destructive/20 wp:dark:aria-invalid:ring-destructive/40 wp:aria-invalid:border-destructive`,i.class))},null,2)),[[t.vModelText,(0,t.unref)(a)]])}}),Lu=(0,t.defineComponent)({__name:`Kbd`,props:{class:{type:[Boolean,null,String,Object,Array]}},setup(e){let n=e;return(e,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`kbd`,{class:(0,t.normalizeClass)((0,t.unref)(J)(`wp:bg-muted wp:text-muted-foreground wp:pointer-events-none wp:inline-flex wp:h-5 wp:w-fit wp:min-w-5 wp:items-center wp:justify-center wp:gap-1 wp:rounded-sm wp:px-1 wp:font-sans wp:text-xs wp:font-medium wp:select-none`,`wp:[&_svg:not([class*='size-'])]:size-3`,`wp:[[data-slot=tooltip-content]_&]:bg-background/20 wp:[[data-slot=tooltip-content]_&]:text-background wp:dark:[[data-slot=tooltip-content]_&]:bg-background/10`,n.class))},[(0,t.renderSlot)(e.$slots,`default`)],2))}}),Ru={xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 19 19`};function zu(e,n){return(0,t.openBlock)(),(0,t.createElementBlock)(`svg`,Ru,[...n[0]||=[(0,t.createElementVNode)(`path`,{fill:`currentColor`,"fill-rule":`evenodd`,stroke:`currentColor`,"stroke-width":`.5`,d:`M3.91 5.867a1.7 1.7 0 0 1-.946-.248 1.9 1.9 0 0 1-.606-.594l-.117-.223a1.93 1.93 0 0 1 .07-1.722q.077-.143.18-.264a1.8 1.8 0 0 1 .33-.322q.063-.048.13-.086c.05-.03.093-.052.145-.079a1.75 1.75 0 0 1 1.653.07l.07.044c.244.162.446.383.59.645a1.92 1.92 0 0 1 .003 1.847 2 2 0 0 1-.183.27c-.02.026-.029.038-.05.062q-.134.147-.293.264a1.7 1.7 0 0 1-.983.336zM1.88 3.923c-.017.333.048.665.188.965.027.055.048.104.075.156l.145.223c.19.26.44.468.725.606a1.92 1.92 0 0 0 1.688 0c.053-.028.1-.05.15-.078.35-.209.63-.525.8-.905a2.14 2.14 0 0 0-.276-2.205L5.2 2.494c-.03-.023-.037-.036-.064-.057a1.94 1.94 0 0 0-1.212-.483 1.8 1.8 0 0 0-.908.196c-.419.2-.755.55-.948.985a2 2 0 0 0-.188.79zm7.442 1.944a1.7 1.7 0 0 1-.942-.248 1.9 1.9 0 0 1-.606-.595L7.657 4.8a1.93 1.93 0 0 1 .071-1.722q.076-.142.18-.264a1.8 1.8 0 0 1 .33-.321q.062-.048.13-.086a1.75 1.75 0 0 1 1.798-.008l.076.043c.243.163.445.384.588.645a1.92 1.92 0 0 1-.001 1.847 2 2 0 0 1-.183.27c-.02.026-.029.039-.05.063a2 2 0 0 1-.29.264 1.73 1.73 0 0 1-.984.336zM7.296 3.923c-.017.333.048.665.188.965.027.055.047.104.075.156l.144.223c.192.26.44.468.726.606a1.92 1.92 0 0 0 1.688 0c.053-.028.1-.05.15-.078.35-.208.63-.524.802-.905a2.14 2.14 0 0 0-.278-2.205l-.173-.191c-.031-.024-.037-.037-.064-.058a1.94 1.94 0 0 0-1.214-.482 1.8 1.8 0 0 0-.908.196c-.419.2-.755.55-.948.985a2 2 0 0 0-.188.79zm7.442 1.944a1.7 1.7 0 0 1-.944-.248 1.9 1.9 0 0 1-.602-.594l-.117-.223a1.93 1.93 0 0 1 .072-1.722q.075-.141.18-.263a1.8 1.8 0 0 1 .326-.323q.062-.048.13-.086c.05-.03.093-.052.144-.079a1.75 1.75 0 0 1 1.654.07l.07.044c.242.163.444.384.587.645a1.93 1.93 0 0 1 0 1.847 2 2 0 0 1-.184.27c-.02.026-.028.039-.05.063a2 2 0 0 1-.29.264 1.7 1.7 0 0 1-.983.336zM12.71 3.923c-.017.333.048.665.188.965.027.055.048.104.076.156l.144.223a1.97 1.97 0 0 0 1.569.802c.292 0 .58-.067.844-.196.053-.028.1-.05.15-.078a2 2 0 0 0 .795-.904 2.14 2.14 0 0 0-.27-2.206l-.175-.191c-.031-.024-.037-.037-.064-.058a1.94 1.94 0 0 0-1.213-.482 1.8 1.8 0 0 0-.908.196c-.419.2-.755.55-.948.985a2 2 0 0 0-.187.79zm-8.8 7.281a1.7 1.7 0 0 1-.942-.246 1.9 1.9 0 0 1-.606-.595l-.121-.224a1.93 1.93 0 0 1 .071-1.722q.077-.142.18-.263a1.8 1.8 0 0 1 .464-.407 1.75 1.75 0 0 1 1.798-.008l.07.043c.242.163.444.384.587.645a1.92 1.92 0 0 1-.001 1.847 2 2 0 0 1-.183.27c-.02.026-.029.039-.05.063a2 2 0 0 1-.29.263 1.7 1.7 0 0 1-.984.337zM1.88 9.261c-.017.333.048.664.188.964.027.056.048.105.075.156l.145.223c.19.26.44.468.725.606a1.92 1.92 0 0 0 1.688 0c.053-.028.1-.049.15-.078.348-.209.626-.525.795-.904a2.14 2.14 0 0 0-.276-2.205l-.175-.19c-.03-.024-.037-.037-.064-.058a1.94 1.94 0 0 0-1.207-.483 1.8 1.8 0 0 0-.908.195c-.419.2-.755.55-.948.985a2 2 0 0 0-.188.791zm7.442 1.943a1.7 1.7 0 0 1-.941-.246 1.9 1.9 0 0 1-.606-.595l-.117-.223a1.93 1.93 0 0 1 .071-1.722q.075-.143.18-.264a1.8 1.8 0 0 1 .463-.407c.05-.03.093-.051.145-.078a1.74 1.74 0 0 1 1.653.07l.07.043c.243.163.444.385.588.646a1.93 1.93 0 0 1-.001 1.847 2 2 0 0 1-.184.27c-.02.026-.028.039-.05.063a2 2 0 0 1-.29.263c-.288.212-.63.33-.983.337zM7.293 9.261c-.017.333.048.664.188.964.027.056.047.105.075.156l.145.223c.19.26.44.468.725.606a1.92 1.92 0 0 0 1.688 0c.053-.028.1-.049.15-.078.352-.207.633-.524.805-.905a2.14 2.14 0 0 0-.276-2.205l-.175-.19c-.031-.024-.037-.037-.064-.058a1.94 1.94 0 0 0-1.214-.482 1.8 1.8 0 0 0-.908.195c-.419.2-.755.55-.948.985a2 2 0 0 0-.188.791zm7.445 1.944a1.7 1.7 0 0 1-.944-.246 1.9 1.9 0 0 1-.606-.596l-.117-.222a1.93 1.93 0 0 1 .071-1.723q.075-.141.18-.263a1.8 1.8 0 0 1 .463-.407 1.74 1.74 0 0 1 1.798-.008l.07.043c.243.163.444.384.588.646a1.92 1.92 0 0 1-.001 1.847 2 2 0 0 1-.184.27c-.02.026-.028.038-.05.063a2 2 0 0 1-.29.263c-.288.212-.63.329-.983.337zm-2.03-1.943c-.017.332.048.664.188.964.027.055.048.104.075.156l.145.223a1.97 1.97 0 0 0 1.569.802c.292 0 .58-.067.844-.196.053-.028.1-.05.15-.078a2 2 0 0 0 .795-.904 2.14 2.14 0 0 0-.276-2.205l-.175-.19c-.03-.024-.037-.037-.064-.059a1.94 1.94 0 0 0-1.211-.482 1.8 1.8 0 0 0-.909.196c-.418.2-.754.55-.947.985a2 2 0 0 0-.188.79zM3.91 16.543a1.7 1.7 0 0 1-.942-.246 1.9 1.9 0 0 1-.606-.596l-.121-.223a1.93 1.93 0 0 1 .071-1.723q.077-.141.18-.263a1.8 1.8 0 0 1 .464-.407 1.75 1.75 0 0 1 1.798-.008l.07.043c.242.163.444.385.587.646a1.92 1.92 0 0 1-.001 1.847 2 2 0 0 1-.183.27l-.05.063a2 2 0 0 1-.29.26 1.7 1.7 0 0 1-.984.337zm-2.03-1.944c-.017.333.048.665.188.965.027.055.048.104.075.156l.145.223c.19.26.44.468.725.606a1.92 1.92 0 0 0 1.688 0c.053-.028.1-.05.15-.078a2 2 0 0 0 .795-.904 2.14 2.14 0 0 0-.276-2.205l-.175-.191c-.03-.023-.037-.037-.064-.058a1.94 1.94 0 0 0-1.207-.483 1.8 1.8 0 0 0-.908.196c-.419.2-.755.55-.948.985a2 2 0 0 0-.188.79zm7.442 1.944a1.7 1.7 0 0 1-.941-.246 1.9 1.9 0 0 1-.606-.596l-.117-.223a1.93 1.93 0 0 1 .071-1.722q.075-.141.18-.263a1.8 1.8 0 0 1 .463-.407 1.75 1.75 0 0 1 1.797-.008l.07.043c.244.163.445.384.589.645a1.93 1.93 0 0 1-.001 1.848 2 2 0 0 1-.184.27c-.02.026-.028.038-.05.062a2 2 0 0 1-.29.264c-.288.212-.63.329-.983.337zm-2.029-1.944c-.017.333.048.665.188.965.027.055.047.104.075.156l.145.223c.19.26.44.468.725.606a1.92 1.92 0 0 0 1.688 0c.053-.028.1-.05.15-.078.352-.208.633-.524.805-.905a2.14 2.14 0 0 0-.276-2.205l-.175-.19c-.031-.024-.037-.037-.064-.059a1.94 1.94 0 0 0-1.214-.482 1.8 1.8 0 0 0-.908.196c-.419.2-.755.55-.948.985a2 2 0 0 0-.188.79zm7.445 1.944a1.7 1.7 0 0 1-.944-.246 1.9 1.9 0 0 1-.606-.595l-.117-.223a1.93 1.93 0 0 1 .071-1.722q.075-.141.18-.263a1.8 1.8 0 0 1 .463-.407c.05-.03.093-.052.145-.079a1.74 1.74 0 0 1 1.653.07l.07.044c.243.163.444.384.588.645a1.92 1.92 0 0 1-.001 1.847 2 2 0 0 1-.184.27c-.02.026-.028.039-.05.063a2 2 0 0 1-.29.264 1.7 1.7 0 0 1-.983.336zm-2.03-1.943c-.017.333.048.665.188.964.027.056.048.105.075.157l.145.222a1.97 1.97 0 0 0 1.569.803c.292 0 .58-.067.844-.196.053-.029.1-.05.15-.079a2 2 0 0 0 .795-.904 2.14 2.14 0 0 0-.276-2.205l-.175-.19c-.03-.024-.037-.037-.064-.058a1.94 1.94 0 0 0-1.211-.482 1.8 1.8 0 0 0-.909.195c-.418.2-.754.55-.947.986a2 2 0 0 0-.188.79z`,"clip-rule":`evenodd`},null,-1)]])}var Bu={render:zu},Vu={xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 19 19`};function Hu(e,n){return(0,t.openBlock)(),(0,t.createElementBlock)(`svg`,Vu,[...n[0]||=[(0,t.createElementVNode)(`path`,{fill:`currentColor`,"fill-rule":`evenodd`,stroke:`currentColor`,"stroke-width":`.5`,d:`M3.91 5.867a1.7 1.7 0 0 1-.946-.248 1.9 1.9 0 0 1-.606-.594l-.117-.223a1.93 1.93 0 0 1 .07-1.722q.077-.143.18-.264a1.8 1.8 0 0 1 .33-.322q.063-.048.13-.086c.05-.03.093-.052.145-.079a1.75 1.75 0 0 1 1.653.07l.07.044c.244.162.446.383.59.645a1.92 1.92 0 0 1 .003 1.847 2 2 0 0 1-.183.27c-.02.026-.029.038-.05.062q-.134.147-.293.264a1.7 1.7 0 0 1-.983.336zM1.88 3.923c-.017.333.048.665.188.965.027.055.048.104.075.156l.145.223c.19.26.44.468.725.606a1.92 1.92 0 0 0 1.688 0c.053-.028.1-.05.15-.078.35-.209.63-.525.8-.905a2.14 2.14 0 0 0-.276-2.205L5.2 2.494c-.03-.023-.037-.036-.064-.057a1.94 1.94 0 0 0-1.212-.483 1.8 1.8 0 0 0-.908.196c-.419.2-.755.55-.948.985a2 2 0 0 0-.188.79zm7.442 1.944a1.7 1.7 0 0 1-.942-.248 1.9 1.9 0 0 1-.606-.595L7.657 4.8a1.93 1.93 0 0 1 .071-1.722q.077-.142.18-.264a1.8 1.8 0 0 1 .33-.321q.062-.048.13-.086a1.75 1.75 0 0 1 1.798-.008l.076.043c.243.163.445.384.588.645a1.93 1.93 0 0 1-.001 1.847 2 2 0 0 1-.183.27c-.02.026-.029.039-.05.063a2 2 0 0 1-.29.264 1.73 1.73 0 0 1-.984.336zM7.296 3.923c-.017.333.048.665.188.965.027.055.047.104.075.156l.145.223c.19.26.44.468.725.606a1.92 1.92 0 0 0 1.688 0c.053-.028.1-.05.15-.078.35-.208.63-.524.802-.905a2.14 2.14 0 0 0-.278-2.205l-.173-.191c-.031-.024-.037-.037-.064-.058a1.94 1.94 0 0 0-1.214-.482 1.8 1.8 0 0 0-.908.196c-.419.2-.755.55-.948.985a2 2 0 0 0-.188.79zm7.442 1.944a1.7 1.7 0 0 1-.944-.248 1.9 1.9 0 0 1-.602-.594l-.117-.223a1.93 1.93 0 0 1 .072-1.722q.075-.141.18-.263a1.8 1.8 0 0 1 .326-.323q.062-.048.13-.086c.05-.03.093-.052.144-.079a1.74 1.74 0 0 1 1.654.07l.07.044c.242.163.444.384.587.645a1.92 1.92 0 0 1 0 1.847 2 2 0 0 1-.184.27c-.02.026-.028.039-.05.063a2 2 0 0 1-.29.264 1.7 1.7 0 0 1-.983.336zM12.71 3.923c-.017.333.048.665.188.965.027.055.048.104.076.156l.144.223c.19.26.44.468.725.606a1.92 1.92 0 0 0 1.688 0c.053-.028.1-.05.15-.078a2 2 0 0 0 .795-.904 2.14 2.14 0 0 0-.27-2.206l-.175-.191c-.031-.024-.037-.037-.064-.058a1.94 1.94 0 0 0-1.213-.482 1.8 1.8 0 0 0-.908.196c-.419.2-.755.55-.948.985a2 2 0 0 0-.187.79zm-8.8 7.281a1.7 1.7 0 0 1-.942-.246 1.9 1.9 0 0 1-.606-.595l-.121-.224a1.93 1.93 0 0 1 .071-1.722q.077-.142.18-.263a1.8 1.8 0 0 1 .464-.407 1.74 1.74 0 0 1 1.798-.008l.07.043c.242.163.444.384.587.645a1.92 1.92 0 0 1-.001 1.847 2 2 0 0 1-.183.27c-.02.026-.029.039-.05.063a2 2 0 0 1-.29.263 1.7 1.7 0 0 1-.984.337zM1.88 9.261c-.017.333.048.664.188.964.027.056.048.105.075.156l.145.223a1.97 1.97 0 0 0 1.569.802c.291 0 .58-.067.844-.196.053-.028.1-.049.15-.078.348-.209.626-.525.795-.904a2.14 2.14 0 0 0-.276-2.205l-.175-.19c-.03-.024-.037-.037-.064-.058a1.94 1.94 0 0 0-1.207-.483 1.8 1.8 0 0 0-.908.195c-.419.2-.755.55-.948.985a2 2 0 0 0-.188.791zm7.442 1.943a1.7 1.7 0 0 1-.941-.246 1.9 1.9 0 0 1-.606-.595l-.117-.223a1.93 1.93 0 0 1 .071-1.722q.075-.142.18-.264a1.8 1.8 0 0 1 .463-.407c.05-.03.093-.051.145-.078a1.75 1.75 0 0 1 1.653.07l.07.043c.243.163.444.385.588.646a1.92 1.92 0 0 1-.001 1.847 2 2 0 0 1-.184.27c-.02.026-.028.039-.05.063a2 2 0 0 1-.29.263c-.288.212-.63.33-.983.337zM7.293 9.261c-.017.333.048.664.188.964.027.056.047.105.075.156l.145.223a1.97 1.97 0 0 0 1.569.802c.291 0 .58-.067.844-.196.053-.028.1-.049.15-.078.352-.207.633-.524.805-.905a2.14 2.14 0 0 0-.276-2.205l-.175-.19c-.031-.024-.037-.037-.064-.058a1.94 1.94 0 0 0-1.214-.482 1.8 1.8 0 0 0-.908.195c-.419.2-.755.55-.948.985a2 2 0 0 0-.188.791zm7.444 1.944a1.7 1.7 0 0 1-.943-.246 1.9 1.9 0 0 1-.606-.596l-.117-.222a1.93 1.93 0 0 1 .071-1.723q.075-.141.18-.263a1.8 1.8 0 0 1 .463-.407c.05-.03.093-.051.145-.078a1.74 1.74 0 0 1 1.653.07l.07.043c.243.163.444.384.588.646a1.93 1.93 0 0 1-.001 1.847 2 2 0 0 1-.184.27c-.02.026-.028.038-.05.063a2 2 0 0 1-.29.263c-.288.212-.63.329-.983.337zm-2.029-1.943c-.017.332.048.664.188.964.027.055.048.104.075.156l.145.223c.19.26.44.468.725.606a1.92 1.92 0 0 0 1.688 0c.053-.028.1-.05.15-.078a2 2 0 0 0 .795-.904 2.14 2.14 0 0 0-.276-2.205l-.175-.19c-.03-.024-.037-.037-.064-.059a1.94 1.94 0 0 0-1.211-.482 1.8 1.8 0 0 0-.909.196c-.418.2-.754.55-.947.985a2 2 0 0 0-.188.79zM3.91 16.543a1.7 1.7 0 0 1-.942-.246 1.9 1.9 0 0 1-.606-.596l-.121-.223a1.93 1.93 0 0 1 .071-1.723q.077-.141.18-.263a1.8 1.8 0 0 1 .464-.407 1.75 1.75 0 0 1 1.798-.008l.07.043c.242.163.444.385.587.646a1.92 1.92 0 0 1-.001 1.847 2 2 0 0 1-.183.27l-.05.063a2 2 0 0 1-.29.26 1.7 1.7 0 0 1-.984.337zm-2.03-1.944c-.017.333.048.665.188.964.027.056.048.105.075.157l.145.223a1.97 1.97 0 0 0 1.569.802c.291 0 .58-.067.844-.196.053-.028.1-.05.15-.078a2 2 0 0 0 .795-.904 2.14 2.14 0 0 0-.276-2.205l-.175-.191c-.03-.023-.037-.037-.064-.058a1.94 1.94 0 0 0-1.207-.483 1.8 1.8 0 0 0-.908.196c-.419.2-.755.55-.948.985a2 2 0 0 0-.188.79zm7.442 1.944a1.7 1.7 0 0 1-.941-.246 1.9 1.9 0 0 1-.606-.596l-.117-.223a1.93 1.93 0 0 1 .071-1.722q.075-.141.18-.263a1.8 1.8 0 0 1 .463-.407 1.75 1.75 0 0 1 1.798-.008l.07.043c.243.163.444.384.588.645a1.92 1.92 0 0 1-.001 1.848 2 2 0 0 1-.184.27c-.02.026-.028.038-.05.062a2 2 0 0 1-.29.264c-.288.212-.63.329-.983.337zm-2.029-1.944c-.017.333.048.665.188.964.027.056.047.105.075.157l.145.223a1.97 1.97 0 0 0 1.569.802c.291 0 .58-.067.844-.196.053-.028.1-.05.15-.078.352-.208.633-.524.805-.905a2.14 2.14 0 0 0-.276-2.205l-.175-.19c-.031-.024-.037-.037-.064-.059a1.94 1.94 0 0 0-1.214-.482 1.8 1.8 0 0 0-.908.196c-.419.2-.755.55-.948.985a2 2 0 0 0-.188.79zm7.444 1.944a1.7 1.7 0 0 1-.943-.246 1.9 1.9 0 0 1-.606-.595l-.117-.223a1.93 1.93 0 0 1 .071-1.722q.075-.141.18-.263a1.8 1.8 0 0 1 .463-.407c.05-.03.093-.052.145-.079a1.75 1.75 0 0 1 1.653.07l.07.044c.243.163.444.384.588.645a1.93 1.93 0 0 1-.001 1.847 2 2 0 0 1-.184.27c-.02.026-.028.039-.05.063a2 2 0 0 1-.29.264 1.7 1.7 0 0 1-.983.336zM12.708 14.6c-.017.333.048.665.188.964.027.056.048.105.075.157l.145.222c.19.26.44.468.725.607a1.92 1.92 0 0 0 1.688 0c.053-.029.1-.05.15-.079a2 2 0 0 0 .795-.904 2.14 2.14 0 0 0-.276-2.205l-.175-.19c-.03-.024-.037-.037-.064-.058a1.94 1.94 0 0 0-1.211-.482 1.8 1.8 0 0 0-.909.195c-.418.2-.754.55-.947.986a2 2 0 0 0-.188.79z`,"clip-rule":`evenodd`},null,-1),(0,t.createElementVNode)(`path`,{stroke:`currentColor`,"stroke-linecap":`round`,d:`M2 16.293 16.293 2`},null,-1)]])}var Uu={render:Hu},Wu={xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 12 12`};function Gu(e,n){return(0,t.openBlock)(),(0,t.createElementBlock)(`svg`,Wu,[...n[0]||=[(0,t.createElementVNode)(`path`,{fill:`currentColor`,d:`M9.75 1H4.5c-.678 0-1.314.302-1.743.828L.513 4.578a2.26 2.26 0 0 0 0 2.844l2.243 2.75A2.24 2.24 0 0 0 4.5 11h5.25C10.99 11 12 9.99 12 8.75v-5.5C12 2.01 10.99 1 9.75 1m1.75 7.75c0 .965-.785 1.75-1.75 1.75H4.5a1.74 1.74 0 0 1-1.356-.644L.901 7.106a1.755 1.755 0 0 1 0-2.212l2.243-2.75A1.74 1.74 0 0 1 4.5 1.499h5.25c.965 0 1.75.785 1.75 1.75zM8.927 4.427 7.354 6l1.573 1.573a.25.25 0 0 1-.354.353L7 6.355 5.427 7.926a.25.25 0 0 1-.354 0 .25.25 0 0 1 0-.353L6.646 6 5.073 4.427a.25.25 0 0 1 .354-.353L7 5.646l1.573-1.572a.25.25 0 0 1 .353.353z`},null,-1)]])}var Ku={render:Gu},qu={xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 30 23`};function Ju(e,n){return(0,t.openBlock)(),(0,t.createElementBlock)(`svg`,qu,[...n[0]||=[(0,t.createElementVNode)(`path`,{stroke:`currentColor`,"stroke-miterlimit":`22.926`,"stroke-width":`1.2`,d:`m12.317 2.51 15.123-.027c2.609 1.773 1.65 19.836 0 18.746l-15.124.026zM1.593 2.484h1.45V21.29h-1.45c-1.79-2.697-1.79-17.855 0-18.806ZM6.244.25h3.078a1.573 1.573 0 0 1 1.574 1.566v18.902a1.58 1.58 0 0 1-1.574 1.574H6.244a1.58 1.58 0 0 1-1.574-1.576v-18.9A1.573 1.573 0 0 1 6.244.25Z`,"clip-rule":`evenodd`},null,-1)]])}var Yu={render:Ju},Xu=(0,t.defineComponent)({__name:`Tooltip`,props:{defaultOpen:{type:Boolean},open:{type:Boolean},delayDuration:{},disableHoverableContent:{type:Boolean},disableClosingTrigger:{type:Boolean},disabled:{type:Boolean},ignoreNonKeyboardFocus:{type:Boolean}},emits:[`update:open`],setup(e,{emit:n}){let r=Yr(e,n);return(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Ll),(0,t.mergeProps)({"data-slot":`tooltip`},(0,t.unref)(r)),{default:(0,t.withCtx)(n=>[(0,t.renderSlot)(e.$slots,`default`,(0,t.normalizeProps)((0,t.guardReactiveProps)(n)))]),_:3},16))}}),Zu=(0,t.defineComponent)({inheritAttrs:!1,__name:`TooltipContent`,props:{forceMount:{type:Boolean},ariaLabel:{},asChild:{type:Boolean},as:{},side:{},sideOffset:{default:4},align:{},alignOffset:{},avoidCollisions:{type:Boolean},collisionBoundary:{},collisionPadding:{},arrowPadding:{},sticky:{},hideWhenDetached:{type:Boolean},positionStrategy:{},updatePositionStrategy:{},class:{type:[Boolean,null,String,Object,Array]}},emits:[`escapeKeyDown`,`pointerDownOutside`],setup(e,{emit:r}){let i=e,a=r,o=Yr((0,n.reactiveOmit)(i,`class`),a);return(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Vl),null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(Bl),(0,t.mergeProps)({"data-slot":`tooltip-content`},{...(0,t.unref)(o),...e.$attrs},{class:(0,t.unref)(J)(`wp:bg-foreground wp:text-background wp:animate-in wp:fade-in-0 wp:zoom-in-95 wp:data-[state=closed]:animate-out wp:data-[state=closed]:fade-out-0 wp:data-[state=closed]:zoom-out-95 wp:data-[side=bottom]:slide-in-from-top-2 wp:data-[side=left]:slide-in-from-right-2 wp:data-[side=right]:slide-in-from-left-2 wp:data-[side=top]:slide-in-from-bottom-2 wp:z-50 wp:w-fit wp:rounded-md wp:px-3 wp:py-1.5 wp:text-xs wp:text-balance`,i.class)}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`),(0,t.createVNode)((0,t.unref)(Al),{class:`wp:bg-foreground wp:fill-foreground wp:z-50 wp:size-2.5 wp:translate-y-[calc(-50%_-_2px)] wp:rotate-45 wp:rounded-[2px]`})]),_:3},16,[`class`])]),_:3}))}}),Qu=(0,t.defineComponent)({__name:`TooltipProvider`,props:{delayDuration:{default:0},skipDelayDuration:{},disableHoverableContent:{type:Boolean},disableClosingTrigger:{type:Boolean},disabled:{type:Boolean},ignoreNonKeyboardFocus:{type:Boolean},content:{}},setup(e){let n=e;return(e,r)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Nl),(0,t.normalizeProps)((0,t.guardReactiveProps)(n)),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16))}}),$u=(0,t.defineComponent)({__name:`TooltipTrigger`,props:{reference:{},asChild:{type:Boolean},as:{}},setup(e){let n=e;return(e,r)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Hl),(0,t.mergeProps)({"data-slot":`tooltip-trigger`},n),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16))}}),ed=[`data-call-status`],td={class:`webphone-display__connected-status-label wp:flex wp:gap-2 wp:items-center`},nd={class:`webphone-display__duration wp:ibrad wp:font-semibold wp:text-sm`},rd={key:2,class:`webphone-display__dialer wp:w-full wp:flex wp:items-center wp:justify-center wp:min-h-10`},id={class:`webphone-display__dialer-field wp:relative`},ad={class:`webphone-display__suggestions wp:absolute wp:bottom-full wp:left-0 wp:w-full wp:z-50 wp:bg-popover wp:text-popover-foreground wp:shadow-md wp:rounded-md wp:border wp:mb-1 wp:max-h-40 wp:overflow-y-auto`},od=[`onMousedown`],sd={class:`webphone-display__contact-content wp:flex wp:flex-col wp:min-w-0`},cd={class:`webphone-display__contact-name wp:truncate`},ld={class:`webphone-display__contact-number wp:text-xs wp:text-muted-foreground wp:truncate`},ud={key:3,class:`webphone-display__connected-summary wp:flex wp:flex-col wp:items-center wp:justify-center wp:gap-2 wp:w-full`},dd={class:`webphone-display__caller wp:flex wp:flex-col wp:items-center wp:gap-1`},fd={class:`webphone-display__caller-row wp:flex wp:items-center wp:gap-2`},pd={key:0,class:`webphone-display__caller-number wp:text-[10px] wp:text-muted-foreground`},md={key:4,class:`webphone-display__non-idle wp:flex wp:flex-col wp:items-center wp:justify-center wp:gap-2 wp:min-h-10`},hd={class:`webphone-display__non-idle-row wp:flex wp:items-center wp:gap-4`},gd={class:`webphone-display__non-idle-caller wp:flex wp:flex-col wp:items-center`},_d={class:`webphone-display__non-idle-name wp:text-md wp:font-bold wp:text-neutral-800 wp:dark:text-white`},vd={key:0,class:`webphone-display__non-idle-number wp:text-sm wp:text-muted-foreground`},yd=(0,t.defineComponent)({__name:`CallDisplay`,props:{allowInput:{type:Boolean,default:!0},isWebCall:{type:Boolean,default:!1},user:{},contacts:{default:()=>[]},channelId:{default:void 0}},setup(e){let r=(0,t.inject)(`webphone`),i=(0,t.inject)(`sip`),a=navigator.platform.toUpperCase().indexOf(`MAC`)>=0?`⌘`:`Ctrl+`,o=e,s=(0,t.computed)(()=>o.channelId===void 0?r.activeChannel:r.channels.find(e=>e.id===o.channelId)),c=(0,t.computed)(()=>{if(!r.isConnected)return`wp:text-status-disconnected`;let e=s.value;return e&&e.status!==`idle`?e.isHeld||e.status===`held`?`wp:text-status-hold`:e.status===`incoming`?`wp:text-status-incoming`:`wp:text-primary`:`wp:text-primary`}),l=(0,t.ref)(!1),u=(0,t.ref)(null),d=(0,t.ref)(null);(0,n.onClickOutside)(u,()=>{l.value=!1});let f=(0,t.computed)({get:()=>s.value?.keypadValue||``,set:e=>{s.value&&r.updateChannelState(s.value.id,{keypadValue:e})}}),p=(0,t.computed)(()=>/^[+]?[0-9*#]+$/.test(f.value)),m=(0,t.computed)(()=>{if(!f.value)return o.contacts.slice(0,10);let e=f.value.toLowerCase(),t=[];for(let n of o.contacts)if((n.name.toLowerCase().includes(e)||n.number.includes(e))&&(t.push(n),t.length>=10))break;return t}),h=e=>{s.value&&r.updateChannelState(s.value.id,{keypadValue:e.number}),l.value=!1,i.makeCall(e.number)},g=()=>{!f.value||!p.value||(l.value=!1,i.makeCall(f.value))};(0,t.watch)(f,()=>{l.value=!0});let _=()=>{f.value&&p.value&&g()},v=()=>{l.value=!1},y=()=>{l.value=!0},b=()=>{setTimeout(()=>{l.value=!1},150)},x=(0,t.ref)(Date.now());(0,n.useIntervalFn)(()=>{x.value=Date.now()},1e3);let S=(0,t.computed)(()=>{let e=s.value?.startTime,t=s.value?.status||`idle`;if(!e||t!==`connected`)return`00:00:00`;let n=Math.floor((x.value-e)/1e3);return n<0?`00:00:00`:`${Math.floor(n/3600).toString().padStart(2,`0`)}:${Math.floor(n%3600/60).toString().padStart(2,`0`)}:${(n%60).toString().padStart(2,`0`)}`}),C=(0,t.computed)(()=>{let e=s.value,t=e?.status||`idle`;return t===`idle`?`Disponible`:t===`calling`?`Llamando...`:e?.isHeld?`En espera - ${e.remoteNumber||e.keypadValue||`Unknown`}`:t===`connected`?`Conectado`:t.charAt(0).toUpperCase()+t.slice(1)}),w=(0,t.computed)(()=>{let e=s.value,t=e?.remoteNumber||e?.keypadValue,n=e?.remoteDisplayName;if(!t)return`Unknown`;if(!t)return console.log(`[CallDisplay] ⚠️ No hay número`),`Unknown`;let r=o.contacts?.find(e=>(console.log(`[CallDisplay] Comparando con:`,e.name,`-`,e.number),e.number===t?(console.log(`[CallDisplay] ✅ Coincidencia exacta encontrada:`,e.name),!0):t.endsWith(e.number)||e.number.endsWith(t)?(console.log(`[CallDisplay] ✅ Coincidencia parcial encontrada:`,e.name),!0):!1)),i=r?r.name:n||t;return console.log(`[CallDisplay] 📱 Resultado final:`,i),i}),T=(0,t.computed)(()=>{let e=s.value;return e?.remoteNumber||e?.keypadValue||``});return(n,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:`webphone-display wp:flex wp:flex-col wp:items-center wp:px-4 wp:space-y-8`,"data-call-status":s.value?.status||`idle`},[(s.value?.status||`idle`)===`connected`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:(0,t.normalizeClass)([c.value,`webphone-display__connected-status wp:w-full wp:flex wp:items-center wp:justify-between wp:gap-2 wp:text-3xl wp:font-light wp:mb-5`])},[(0,t.createElementVNode)(`div`,td,[(0,t.createVNode)((0,t.unref)(Yu),{class:`webphone-display__connected-status-icon wp:w-4 wp:h-4`}),i[2]||=(0,t.createElementVNode)(`span`,{class:`webphone-display__connected-status-text wp:text-sm wp:montserrat wp:font-bold`},`En llamada`,-1)]),(0,t.createElementVNode)(`span`,nd,(0,t.toDisplayString)(S.value),1)],2)):(0,t.createCommentVNode)(``,!0),o.user?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:1,class:(0,t.normalizeClass)([c.value,`webphone-display__user wp:font-bold wp:text-lg wp:flex wp:items-center wp:gap-2 wp:transition-colors wp:duration-300`])},[(0,t.createVNode)((0,t.unref)(Yu),{class:`webphone-display__user-icon wp:size-6 wp:shrink-0 montserrat`}),(0,t.createTextVNode)(` `+(0,t.toDisplayString)(o.user)+` `,1),(s.value?.status||`idle`)===`connected`?(0,t.createCommentVNode)(``,!0):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:(0,t.normalizeClass)([c.value,`webphone-display__status-text wp:font-bold wp:tracking-wider wp:text-sm wp:text-[var(--color-primary)] montserrat`])},(0,t.toDisplayString)(C.value),3))],2)):(0,t.createCommentVNode)(``,!0),(s.value?.status||`idle`)===`idle`&&o.allowInput?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,rd,[(0,t.createElementVNode)(`div`,{class:`webphone-display__dialer-container wp:relative wp:w-full wp:max-w-80`,ref_key:`containerRef`,ref:u},[(0,t.createElementVNode)(`div`,id,[(0,t.createVNode)((0,t.unref)(Qu),null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(Xu),null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)($u),{"as-child":``},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(Q),{onClick:(0,t.unref)(r).toggleKeypad,variant:`ghost`,size:`icon`,class:(0,t.normalizeClass)((0,t.unref)(J)(`webphone-display__keypad-toggle wp:absolute wp:left-0.5 wp:top-1/2 wp:-translate-y-1/2 wp:z-10 wp:h-9 wp:w-9 wp:rounded-full wp:text-[var(--p-primary-color)] wp:hover:opacity-80`))},{default:(0,t.withCtx)(()=>[(0,t.unref)(r).isKeypadVisible?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Bu),{key:0,class:`webphone-display__keypad-toggle-icon wp:size-6`})):((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Uu),{key:1,class:`webphone-display__keypad-toggle-icon wp:size-6`}))]),_:1},8,[`onClick`,`class`])]),_:1}),(0,t.createVNode)((0,t.unref)(Zu),{class:`wp:flex wp:items-center wp:gap-2`},{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`span`,null,(0,t.toDisplayString)((0,t.unref)(r).isKeypadVisible?`Ocultar`:`Mostrar`)+` teclado`,1),(0,t.createVNode)((0,t.unref)(Lu),null,{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)((0,t.unref)(a))+`K`,1)]),_:1})]),_:1})]),_:1})]),_:1}),(0,t.createVNode)((0,t.unref)(Iu),{ref_key:`inputRef`,ref:d,modelValue:f.value,"onUpdate:modelValue":i[0]||=e=>f.value=e,onFocus:y,onBlur:b,onKeydown:[(0,t.withKeys)(_,[`enter`]),(0,t.withKeys)(v,[`escape`])],placeholder:`Ingresa el numero a llamar...`,class:`p-input webphone-display__input wp:h-10 wp:text-center wp:select-text wp:px-14 wp:text-base hover:wp:border-[var(--p-primary-color)] wp:dark:hover:bg-neutral-900 focus-visible:wp:border-[var(--p-primary-color)] focus-visible:wp:ring-2 montserrat`},null,8,[`modelValue`]),(0,t.createElementVNode)(`div`,{class:`webphone-display__backspace wp:absolute wp:right-1 wp:top-1/2 wp:-translate-y-1/2 wp:z-10 wp:flex wp:h-8 wp:w-8 wp:cursor-pointer wp:items-center wp:justify-center wp:hover:bg-accent wp:rounded-full`,onClick:i[1]||=(0,t.withModifiers)(e=>(0,t.unref)(r).backspaceKeypad(),[`stop`])},[(0,t.createVNode)((0,t.unref)(Ku),{class:`webphone-display__backspace-icon wp:w-[16px] wp:h-[16px] wp:text-black wp:hover:text-status-disconnected wp:dark:text-neutral-500 wp:dark:hover:text-status-disconnected wp:transition-colors`})])]),(0,t.withDirectives)((0,t.createElementVNode)(`div`,ad,[p.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:`webphone-display__suggestion webphone-display__suggestion--raw wp:cursor-pointer wp:hover:bg-accent wp:flex wp:items-center wp:gap-2 wp:p-2 wp:px-3 wp:text-sm`,onMousedown:(0,t.withModifiers)(g,[`prevent`])},[(0,t.createVNode)((0,t.unref)(uu),{class:`webphone-display__suggestion-icon wp:w-4 wp:h-4 wp:shrink-0`}),(0,t.createElementVNode)(`span`,null,`Marcar `+(0,t.toDisplayString)(f.value),1)],32)):(0,t.createCommentVNode)(``,!0),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(m.value,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:e.number,class:`webphone-display__suggestion webphone-display__suggestion--contact wp:cursor-pointer wp:hover:bg-accent wp:flex wp:items-center wp:gap-2 wp:p-2 wp:px-3 wp:text-sm`,onMousedown:(0,t.withModifiers)(t=>h(e),[`prevent`])},[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)((0,t.unref)(J)(`webphone-display__contact-badge wp:flex wp:items-center wp:justify-center wp:w-6 wp:h-6 wp:rounded-full wp:shrink-0`,e.type===`extension`?`wp:bg-blue-100 wp:text-blue-600 wp:dark:bg-blue-900/30 wp:dark:text-blue-400`:e.type===`contact`?`wp:bg-emerald-100 wp:text-emerald-600 wp:dark:bg-emerald-900/30 wp:dark:text-emerald-400`:e.type===`voicemail`?`wp:bg-purple-100 wp:text-purple-600 wp:dark:bg-purple-900/30 wp:dark:text-purple-400`:e.type===`tool`?`wp:bg-amber-100 wp:text-amber-600 wp:dark:bg-amber-900/30 wp:dark:text-amber-400`:`wp:bg-neutral-100 wp:text-neutral-600 wp:dark:bg-neutral-800 wp:dark:text-neutral-400`))},[e.type===`extension`?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)($l),{key:0,class:`wp:w-3 wp:h-3`})):e.type===`contact`?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(ru),{key:1,class:`wp:w-3 wp:h-3`})):e.type===`voicemail`?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(hu),{key:2,class:`wp:w-3 wp:h-3`})):e.type===`tool`?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(gu),{key:3,class:`wp:w-3 wp:h-3`})):((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(ru),{key:4,class:`wp:w-3 wp:h-3`}))],2),(0,t.createElementVNode)(`div`,sd,[(0,t.createElementVNode)(`span`,cd,(0,t.toDisplayString)(e.name),1),(0,t.createElementVNode)(`span`,ld,(0,t.toDisplayString)(e.number),1)])],40,od))),128))],512),[[t.vShow,l.value&&f.value&&(m.value.length>0||p.value)]])],512)])):(s.value?.status||`idle`)===`connected`?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,ud,[(0,t.createElementVNode)(`div`,dd,[(0,t.createElementVNode)(`div`,fd,[(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([c.value,`webphone-display__caller-name wp:text-xs`])},` En llamada con `+(0,t.toDisplayString)(w.value),3),e.isWebCall?(0,t.createCommentVNode)(``,!0):((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Qu),{key:0},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(Xu),null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)($u),{"as-child":``}),(0,t.createVNode)((0,t.unref)(Zu),{class:`wp:flex wp:items-center wp:gap-2`},{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`span`,null,(0,t.toDisplayString)((0,t.unref)(r).isKeypadVisible?`Ocultar`:`Mostrar`)+` teclado`,1),(0,t.createVNode)((0,t.unref)(Lu),null,{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)((0,t.unref)(a))+`K`,1)]),_:1})]),_:1})]),_:1})]),_:1}))]),w.value===T.value?(0,t.createCommentVNode)(``,!0):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,pd,(0,t.toDisplayString)(T.value),1))])])):(s.value?.status||`idle`)===`idle`?(0,t.createCommentVNode)(``,!0):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,md,[(0,t.createElementVNode)(`div`,hd,[(0,t.createElementVNode)(`div`,gd,[(0,t.createElementVNode)(`div`,_d,(0,t.toDisplayString)(w.value),1),w.value===T.value?(0,t.createCommentVNode)(``,!0):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,vd,(0,t.toDisplayString)(T.value),1))]),(0,t.createVNode)((0,t.unref)(Qu),null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(Xu),null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)($u),{"as-child":``}),(0,t.createVNode)((0,t.unref)(Zu),{class:`wp:flex wp:items-center wp:gap-2`},{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`span`,null,(0,t.toDisplayString)((0,t.unref)(r).isKeypadVisible?`Ocultar`:`Mostrar`)+` teclado`,1),(0,t.createVNode)((0,t.unref)(Lu),null,{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)((0,t.unref)(a))+`K`,1)]),_:1})]),_:1})]),_:1})]),_:1})])]))],8,ed))}}),bd=(0,t.defineComponent)({__name:`Dialog`,props:{open:{type:Boolean},defaultOpen:{type:Boolean},modal:{type:Boolean}},emits:[`update:open`],setup(e,{emit:n}){let r=Yr(e,n);return(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Oi),(0,t.mergeProps)({"data-slot":`dialog`},(0,t.unref)(r)),{default:(0,t.withCtx)(n=>[(0,t.renderSlot)(e.$slots,`default`,(0,t.normalizeProps)((0,t.guardReactiveProps)(n)))]),_:3},16))}}),xd=(0,t.defineComponent)({__name:`DialogOverlay`,props:{forceMount:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let r=e,i=(0,n.reactiveOmit)(r,`class`);return(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(ua),(0,t.mergeProps)({"data-slot":`dialog-overlay`},(0,t.unref)(i),{class:(0,t.unref)(J)(`wp:data-[state=open]:animate-in wp:data-[state=closed]:animate-out wp:data-[state=closed]:fade-out-0 wp:data-[state=open]:fade-in-0 wp:fixed wp:inset-0 wp:z-50 wp:bg-black/80`,r.class)}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16,[`class`]))}}),Sd=(0,t.defineComponent)({inheritAttrs:!1,__name:`DialogContent`,props:{forceMount:{type:Boolean},disableOutsidePointerEvents:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]},showCloseButton:{type:Boolean,default:!0}},emits:[`escapeKeyDown`,`pointerDownOutside`,`focusOutside`,`interactOutside`,`openAutoFocus`,`closeAutoFocus`],setup(e,{emit:r}){let i=e,a=r,o=Yr((0,n.reactiveOmit)(i,`class`),a);return(n,r)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(fa),null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)(xd),(0,t.createVNode)((0,t.unref)(ca),(0,t.mergeProps)({"data-slot":`dialog-content`},{...n.$attrs,...(0,t.unref)(o)},{class:(0,t.unref)(J)(`wp:bg-background wp:data-[state=open]:animate-in wp:data-[state=closed]:animate-out wp:data-[state=closed]:fade-out-0 wp:data-[state=open]:fade-in-0 wp:data-[state=closed]:zoom-out-95 wp:data-[state=open]:zoom-in-95 wp:fixed wp:top-[50%] wp:left-[50%] wp:z-50 wp:grid wp:w-full wp:max-w-[calc(100%-2rem)] wp:translate-x-[-50%] wp:translate-y-[-50%] wp:gap-4 wp:rounded-lg wp:border wp:p-6 wp:shadow-lg wp:duration-200 wp:sm:max-w-lg`,i.class)}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(n.$slots,`default`),e.showCloseButton?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(ki),{key:0,"data-slot":`dialog-close`,class:`wp:ring-offset-background wp:focus:ring-ring wp:data-[state=open]:bg-accent wp:data-[state=open]:text-muted-foreground wp:absolute wp:top-4 wp:right-4 wp:rounded-xs wp:opacity-70 wp:transition-opacity wp:hover:opacity-100 wp:focus:ring-2 wp:focus:ring-offset-2 wp:focus:outline-hidden wp:disabled:pointer-events-none wp:[&_svg]:pointer-events-none wp:[&_svg]:shrink-0 wp:[&_svg:not([class*='size-'])]:size-4`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(_u)),r[0]||=(0,t.createElementVNode)(`span`,{class:`wp:sr-only`},`Close`,-1)]),_:1})):(0,t.createCommentVNode)(``,!0)]),_:3},16,[`class`])]),_:3}))}}),Cd=(0,t.defineComponent)({__name:`DialogFooter`,props:{class:{type:[Boolean,null,String,Object,Array]}},setup(e){let n=e;return(e,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{"data-slot":`dialog-footer`,class:(0,t.normalizeClass)((0,t.unref)(J)(`wp:flex wp:flex-col-reverse wp:gap-2 wp:sm:flex-row wp:sm:justify-end`,n.class))},[(0,t.renderSlot)(e.$slots,`default`)],2))}}),wd=(0,t.defineComponent)({__name:`DialogHeader`,props:{class:{type:[Boolean,null,String,Object,Array]}},setup(e){let n=e;return(e,r)=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{"data-slot":`dialog-header`,class:(0,t.normalizeClass)((0,t.unref)(J)(`wp:flex wp:flex-col wp:gap-2 wp:text-center wp:sm:text-left`,n.class))},[(0,t.renderSlot)(e.$slots,`default`)],2))}}),Td=(0,t.defineComponent)({__name:`DialogTitle`,props:{asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let r=e,i=Jr((0,n.reactiveOmit)(r,`class`));return(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(pa),(0,t.mergeProps)({"data-slot":`dialog-title`},(0,t.unref)(i),{class:(0,t.unref)(J)(`wp:text-lg wp:leading-none wp:font-semibold`,r.class)}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16,[`class`]))}}),Ed=(0,t.defineComponent)({__name:`Select`,props:{open:{type:Boolean},defaultOpen:{type:Boolean},defaultValue:{},modelValue:{},by:{type:[String,Function]},dir:{},multiple:{type:Boolean},autocomplete:{},disabled:{type:Boolean},name:{},required:{type:Boolean}},emits:[`update:modelValue`,`update:open`],setup(e,{emit:n}){let r=Yr(e,n);return(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)($c),(0,t.mergeProps)({"data-slot":`select`},(0,t.unref)(r)),{default:(0,t.withCtx)(n=>[(0,t.renderSlot)(e.$slots,`default`,(0,t.normalizeProps)((0,t.guardReactiveProps)(n)))]),_:3},16))}}),Dd=(0,t.defineComponent)({inheritAttrs:!1,__name:`SelectContent`,props:{forceMount:{type:Boolean},position:{default:`popper`},bodyLock:{type:Boolean},side:{},sideOffset:{},sideFlip:{type:Boolean},align:{},alignOffset:{},alignFlip:{type:Boolean},avoidCollisions:{type:Boolean},collisionBoundary:{},collisionPadding:{},arrowPadding:{},hideShiftedArrow:{type:Boolean},sticky:{},hideWhenDetached:{type:Boolean},positionStrategy:{},updatePositionStrategy:{},disableUpdateOnLayoutShift:{type:Boolean},prioritizePosition:{type:Boolean},reference:{},asChild:{type:Boolean},as:{},disableOutsidePointerEvents:{type:Boolean},class:{type:[Boolean,null,String,Object,Array]}},emits:[`closeAutoFocus`,`escapeKeyDown`,`pointerDownOutside`],setup(e,{emit:r}){let i=e,a=r,o=Yr((0,n.reactiveOmit)(i,`class`),a);return(n,r)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(xl),null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(dl),(0,t.mergeProps)({"data-slot":`select-content`},{...n.$attrs,...(0,t.unref)(o)},{class:(0,t.unref)(J)(`wp:bg-popover wp:text-popover-foreground wp:data-[state=open]:animate-in wp:data-[state=closed]:animate-out wp:data-[state=closed]:fade-out-0 wp:data-[state=open]:fade-in-0 wp:data-[state=closed]:zoom-out-95 wp:data-[state=open]:zoom-in-95 wp:data-[side=bottom]:slide-in-from-top-2 wp:data-[side=left]:slide-in-from-right-2 wp:data-[side=right]:slide-in-from-left-2 wp:data-[side=top]:slide-in-from-bottom-2 wp:relative wp:z-50 wp:max-h-(--reka-select-content-available-height) wp:min-w-[8rem] wp:overflow-x-hidden wp:overflow-y-auto wp:rounded-md wp:border wp:shadow-md`,e.position===`popper`&&`wp:data-[side=bottom]:translate-y-1 wp:data-[side=left]:-translate-x-1 wp:data-[side=right]:translate-x-1 wp:data-[side=top]:-translate-y-1`,i.class)}),{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(Md)),(0,t.createVNode)((0,t.unref)(Dl),{class:(0,t.normalizeClass)((0,t.unref)(J)(`wp:p-1`,e.position===`popper`&&`wp:h-[var(--reka-select-trigger-height)] wp:w-full wp:min-w-[var(--reka-select-trigger-width)] wp:scroll-my-1`))},{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(n.$slots,`default`)]),_:3},8,[`class`]),(0,t.createVNode)((0,t.unref)(jd))]),_:3},16,[`class`])]),_:3}))}}),Od=(0,t.defineComponent)({__name:`SelectGroup`,props:{asChild:{type:Boolean},as:{}},setup(e){let n=e;return(e,r)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(ml),(0,t.mergeProps)({"data-slot":`select-group`},n),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16))}}),kd={class:`wp:absolute wp:right-2 wp:flex wp:size-3.5 wp:items-center wp:justify-center`},Ad=(0,t.defineComponent)({__name:`SelectItem`,props:{value:{},disabled:{type:Boolean},textValue:{},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let r=e,i=Jr((0,n.reactiveOmit)(r,`class`));return(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(vl),(0,t.mergeProps)({"data-slot":`select-item`},(0,t.unref)(i),{class:(0,t.unref)(J)(`wp:focus:bg-accent wp:focus:text-accent-foreground wp:[&_svg:not([class*='text-'])]:text-muted-foreground wp:relative wp:flex wp:w-full wp:cursor-default wp:items-center wp:gap-2 wp:rounded-sm wp:py-1.5 wp:pr-8 wp:pl-2 wp:text-sm wp:outline-hidden wp:select-none wp:data-[disabled]:pointer-events-none wp:data-[disabled]:opacity-50 wp:[&_svg]:pointer-events-none wp:[&_svg]:shrink-0 wp:[&_svg:not([class*='size-'])]:size-4 wp:*:[span]:last:flex wp:*:[span]:last:items-center wp:*:[span]:last:gap-2`,r.class)}),{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`span`,kd,[(0,t.createVNode)((0,t.unref)(yl),null,{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`indicator-icon`,{},()=>[(0,t.createVNode)((0,t.unref)(eu),{class:`wp:size-4`})])]),_:3})]),(0,t.createVNode)((0,t.unref)(bl),null,{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3})]),_:3},16,[`class`]))}}),jd=(0,t.defineComponent)({__name:`SelectScrollDownButton`,props:{asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let r=e,i=Jr((0,n.reactiveOmit)(r,`class`));return(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Cl),(0,t.mergeProps)({"data-slot":`select-scroll-down-button`},(0,t.unref)(i),{class:(0,t.unref)(J)(`wp:flex wp:cursor-default wp:items-center wp:justify-center wp:py-1`,r.class)}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`,{},()=>[(0,t.createVNode)((0,t.unref)(tu),{class:`wp:size-4`})])]),_:3},16,[`class`]))}}),Md=(0,t.defineComponent)({__name:`SelectScrollUpButton`,props:{asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let r=e,i=Jr((0,n.reactiveOmit)(r,`class`));return(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(wl),(0,t.mergeProps)({"data-slot":`select-scroll-up-button`},(0,t.unref)(i),{class:(0,t.unref)(J)(`wp:flex wp:cursor-default wp:items-center wp:justify-center wp:py-1`,r.class)}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`,{},()=>[(0,t.createVNode)((0,t.unref)(nu),{class:`wp:size-4`})])]),_:3},16,[`class`]))}}),Nd=(0,t.defineComponent)({__name:`SelectTrigger`,props:{disabled:{type:Boolean},reference:{},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]},size:{default:`default`}},setup(e){let r=e,i=Jr((0,n.reactiveOmit)(r,`class`,`size`));return(n,a)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Tl),(0,t.mergeProps)({"data-slot":`select-trigger`,"data-size":e.size},(0,t.unref)(i),{class:(0,t.unref)(J)(`wp:border-input wp:data-[placeholder]:text-muted-foreground wp:[&_svg:not([class*='text-'])]:text-muted-foreground wp:focus-visible:border-ring wp:focus-visible:ring-ring/50 wp:aria-invalid:ring-destructive/20 wp:dark:aria-invalid:ring-destructive/40 wp:aria-invalid:border-destructive wp:dark:bg-input/30 wp:dark:hover:bg-input/50 wp:flex wp:w-fit wp:items-center wp:justify-between wp:gap-2 wp:rounded-md wp:border wp:bg-transparent wp:px-3 wp:py-2 wp:text-sm wp:whitespace-nowrap wp:shadow-xs wp:transition-[color,box-shadow] wp:outline-none wp:focus-visible:ring-[3px] wp:disabled:cursor-not-allowed wp:disabled:opacity-50 wp:data-[size=default]:h-9 wp:data-[size=sm]:h-8 wp:*:data-[slot=select-value]:line-clamp-1 wp:*:data-[slot=select-value]:flex wp:*:data-[slot=select-value]:items-center wp:*:data-[slot=select-value]:gap-2 wp:[&_svg]:pointer-events-none wp:[&_svg]:shrink-0 wp:[&_svg:not([class*='size-'])]:size-4`,r.class)}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(n.$slots,`default`),(0,t.createVNode)((0,t.unref)(hl),{"as-child":``},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(tu),{class:`wp:size-4 wp:opacity-50`})]),_:1})]),_:3},16,[`data-size`,`class`]))}}),Pd=(0,t.defineComponent)({__name:`SelectValue`,props:{placeholder:{},asChild:{type:Boolean},as:{}},setup(e){let n=e;return(e,r)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(El),(0,t.mergeProps)({"data-slot":`select-value`},n),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16))}}),Fd=(0,t.defineComponent)({__name:`Slider`,props:{defaultValue:{},modelValue:{},disabled:{type:Boolean},orientation:{},dir:{},inverted:{type:Boolean},min:{},max:{},step:{},minStepsBetweenThumbs:{},thumbAlignment:{},asChild:{type:Boolean},as:{},name:{},required:{type:Boolean},class:{type:[Boolean,null,String,Object,Array]}},emits:[`update:modelValue`,`valueCommit`],setup(e,{emit:r}){let i=e,a=r,o=Yr((0,n.reactiveOmit)(i,`class`),a);return(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(uc),(0,t.mergeProps)({"data-slot":`slider`,class:(0,t.unref)(J)(`wp:relative wp:flex wp:w-full wp:touch-none wp:items-center wp:select-none wp:data-[disabled]:opacity-50 wp:data-[orientation=vertical]:h-full wp:data-[orientation=vertical]:min-h-44 wp:data-[orientation=vertical]:w-auto wp:data-[orientation=vertical]:flex-col`,i.class)},(0,t.unref)(o)),{default:(0,t.withCtx)(({modelValue:e})=>[(0,t.createVNode)((0,t.unref)(hc),{"data-slot":`slider-track`,class:`wp:bg-muted wp:relative wp:grow wp:overflow-hidden wp:rounded-full wp:data-[orientation=horizontal]:h-1.5 wp:data-[orientation=horizontal]:w-full wp:data-[orientation=vertical]:h-full wp:data-[orientation=vertical]:w-1.5`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(fc),{"data-slot":`slider-range`,class:`wp:bg-primary wp:absolute wp:data-[orientation=horizontal]:h-full wp:data-[orientation=vertical]:w-full`})]),_:1}),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e,(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(mc),{key:n,"data-slot":`slider-thumb`,class:`wp:bg-white wp:border-primary wp:ring-ring/50 wp:block wp:size-4 wp:shrink-0 wp:rounded-full wp:border wp:shadow-sm wp:transition-[color,box-shadow] wp:hover:ring-4 wp:focus-visible:ring-4 wp:focus-visible:outline-hidden wp:disabled:pointer-events-none wp:disabled:opacity-50`}))),128))]),_:1},16,[`class`]))}}),Id=(0,t.defineComponent)({__name:`Label`,props:{for:{},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let r=e,i=(0,n.reactiveOmit)(r,`class`);return(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(gc),(0,t.mergeProps)({"data-slot":`label`},(0,t.unref)(i),{class:(0,t.unref)(J)(`wp:flex wp:items-center wp:gap-2 wp:text-sm wp:leading-none wp:font-medium wp:select-none wp:group-data-[disabled=true]:pointer-events-none wp:group-data-[disabled=true]:opacity-50 wp:peer-disabled:cursor-not-allowed wp:peer-disabled:opacity-50`,r.class)}),{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3},16,[`class`]))}}),Ld=(0,t.defineComponent)({__name:`Separator`,props:{orientation:{default:`horizontal`},decorative:{type:Boolean,default:!0},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let r=e,i=(0,n.reactiveOmit)(r,`class`);return(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(kl),(0,t.mergeProps)({"data-slot":`separator`},(0,t.unref)(i),{class:(0,t.unref)(J)(`wp:bg-border wp:shrink-0 wp:data-[orientation=horizontal]:h-px wp:data-[orientation=horizontal]:w-full wp:data-[orientation=vertical]:h-full wp:data-[orientation=vertical]:w-px`,r.class)}),null,16,[`class`]))}}),Rd={class:`wp:flex wp:flex-col wp:gap-6 wp:py-4`},zd={class:`wp:flex wp:flex-col wp:gap-2`},Bd={class:`wp:flex wp:flex-col wp:gap-2`},Vd={class:`wp:flex wp:flex-col wp:gap-4`},Hd={class:`wp:flex wp:justify-between`},Ud={class:`wp:text-sm wp:text-muted-foreground`},Wd={class:`wp:flex wp:flex-col wp:gap-4`},Gd={class:`wp:flex wp:justify-between`},Kd={class:`wp:text-sm wp:text-muted-foreground`},qd={class:`wp:flex wp:flex-col wp:gap-3`},Jd={class:`wp:grid wp:grid-cols-2 wp:gap-2 wp:text-sm`},Yd={class:`wp:flex wp:items-center wp:justify-between wp:gap-2`},Xd={class:`wp:flex wp:items-center wp:justify-between wp:gap-2`},Zd={class:`wp:flex wp:items-center wp:justify-between wp:gap-2`},Qd={class:`wp:flex wp:items-center wp:justify-between wp:gap-2`},$d={class:`wp:flex wp:items-center wp:justify-between wp:gap-2`},ef={class:`wp:flex wp:items-center wp:justify-between wp:gap-2`},tf=(0,t.defineComponent)({__name:`AudioSettingsDialog`,props:{visible:{type:Boolean}},emits:[`update:visible`],setup(e,{emit:r}){let i=r,a=navigator.platform.toUpperCase().indexOf(`MAC`)>=0?`⌘`:`Ctrl+`,{setVolume:o,setOutputDevice:s,setInputDevice:c,setNotificationVolume:l}=(0,t.inject)(`sip`),u=(0,t.ref)([]),d=(0,t.ref)([]),f=(0,n.useStorage)(`webphone-input-device`,``),p=(0,n.useStorage)(`webphone-output-device`,``),m=(0,n.useStorage)(`webphone-volume`,100),h=(0,n.useStorage)(`webphone-notification-volume`,100),g=async()=>{try{await navigator.mediaDevices.getUserMedia({audio:!0});let e=await navigator.mediaDevices.enumerateDevices();u.value=e.filter(e=>e.kind===`audioinput`).map((e,t)=>({deviceId:e.deviceId,label:e.label||`Microphone ${t+1}`})),d.value=e.filter(e=>e.kind===`audiooutput`).map((e,t)=>({deviceId:e.deviceId,label:e.label||`Speaker ${t+1}`}));let t=u.value.some(e=>e.deviceId===f.value);(!f.value||!t)&&u.value.length>0&&(f.value=u.value[0]?.deviceId??``);let n=d.value.some(e=>e.deviceId===p.value);(!p.value||!n)&&d.value.length>0&&(p.value=d.value[0]?.deviceId??``),f.value&&c(f.value),p.value&&s(p.value)}catch(e){console.error(`Error loading devices`,e)}},_=e=>{let t=String(e);f.value=t,c(t)},v=e=>{let t=String(e);p.value=t,s(t)},y=(e,t=35)=>e.length<=t?e:e.substring(0,t)+`...`,b=(0,t.computed)({get:()=>[m.value],set:e=>{m.value=e[0],o(m.value)}}),x=(0,t.computed)({get:()=>[h.value],set:e=>{h.value=e[0],l(h.value)}});return(0,t.onMounted)(()=>{g(),o(m.value),l(h.value)}),(n,r)=>e.visible?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(bd),{key:0,open:e.visible,"onUpdate:open":r[5]||=e=>i(`update:visible`,e)},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(Sd),{class:`wp:sm:max-w-sm`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(wd),null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(Td),null,{default:(0,t.withCtx)(()=>[...r[6]||=[(0,t.createTextVNode)(`Audio Settings`,-1)]]),_:1})]),_:1}),(0,t.createElementVNode)(`div`,Rd,[(0,t.createElementVNode)(`div`,zd,[(0,t.createVNode)((0,t.unref)(Id),null,{default:(0,t.withCtx)(()=>[...r[7]||=[(0,t.createTextVNode)(`Microphone`,-1)]]),_:1}),(0,t.createVNode)((0,t.unref)(Ed),{modelValue:(0,t.unref)(f),"onUpdate:modelValue":[r[0]||=e=>(0,t.isRef)(f)?f.value=e:null,_]},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(Nd),{class:`wp:w-full`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(Pd),{placeholder:`Select Microphone`})]),_:1}),(0,t.createVNode)((0,t.unref)(Dd),null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(Od),null,{default:(0,t.withCtx)(()=>[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(u.value,e=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Ad),{key:e.deviceId,value:e.deviceId,title:e.label},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)(y(e.label)),1)]),_:2},1032,[`value`,`title`]))),128))]),_:1})]),_:1})]),_:1},8,[`modelValue`])]),(0,t.createElementVNode)(`div`,Bd,[(0,t.createVNode)((0,t.unref)(Id),null,{default:(0,t.withCtx)(()=>[...r[8]||=[(0,t.createTextVNode)(`Speaker`,-1)]]),_:1}),(0,t.createVNode)((0,t.unref)(Ed),{modelValue:(0,t.unref)(p),"onUpdate:modelValue":[r[1]||=e=>(0,t.isRef)(p)?p.value=e:null,v]},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(Nd),{class:`wp:w-full`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(Pd),{placeholder:`Select Speaker`})]),_:1}),(0,t.createVNode)((0,t.unref)(Dd),null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(Od),null,{default:(0,t.withCtx)(()=>[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(d.value,e=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Ad),{key:e.deviceId,value:e.deviceId,title:e.label},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)(y(e.label)),1)]),_:2},1032,[`value`,`title`]))),128))]),_:1})]),_:1})]),_:1},8,[`modelValue`])]),(0,t.createElementVNode)(`div`,Vd,[(0,t.createElementVNode)(`div`,Hd,[(0,t.createVNode)((0,t.unref)(Id),null,{default:(0,t.withCtx)(()=>[...r[9]||=[(0,t.createTextVNode)(`Media Volume`,-1)]]),_:1}),(0,t.createElementVNode)(`span`,Ud,(0,t.toDisplayString)((0,t.unref)(m))+`%`,1)]),(0,t.createVNode)((0,t.unref)(Fd),{modelValue:b.value,"onUpdate:modelValue":r[2]||=e=>b.value=e,max:100,step:1},null,8,[`modelValue`])]),(0,t.createElementVNode)(`div`,Wd,[(0,t.createElementVNode)(`div`,Gd,[(0,t.createVNode)((0,t.unref)(Id),null,{default:(0,t.withCtx)(()=>[...r[10]||=[(0,t.createTextVNode)(`Notification Volume`,-1)]]),_:1}),(0,t.createElementVNode)(`span`,Kd,(0,t.toDisplayString)((0,t.unref)(h))+`%`,1)]),(0,t.createVNode)((0,t.unref)(Fd),{modelValue:x.value,"onUpdate:modelValue":r[3]||=e=>x.value=e,max:100,step:1},null,8,[`modelValue`])]),(0,t.createVNode)((0,t.unref)(Ld)),(0,t.createElementVNode)(`div`,qd,[(0,t.createVNode)((0,t.unref)(Id),{class:`wp:text-base`},{default:(0,t.withCtx)(()=>[...r[11]||=[(0,t.createTextVNode)(`Atajos de teclado`,-1)]]),_:1}),(0,t.createElementVNode)(`div`,Jd,[(0,t.createElementVNode)(`div`,Yd,[r[12]||=(0,t.createElementVNode)(`span`,{class:`wp:text-muted-foreground`},`Historial`,-1),(0,t.createVNode)((0,t.unref)(Lu),null,{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)((0,t.unref)(a))+`H`,1)]),_:1})]),(0,t.createElementVNode)(`div`,Xd,[r[13]||=(0,t.createElementVNode)(`span`,{class:`wp:text-muted-foreground`},`Configuración`,-1),(0,t.createVNode)((0,t.unref)(Lu),null,{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)((0,t.unref)(a))+`,`,1)]),_:1})]),(0,t.createElementVNode)(`div`,Zd,[r[14]||=(0,t.createElementVNode)(`span`,{class:`wp:text-muted-foreground`},`Teclado`,-1),(0,t.createVNode)((0,t.unref)(Lu),null,{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)((0,t.unref)(a))+`K`,1)]),_:1})]),(0,t.createElementVNode)(`div`,Qd,[r[15]||=(0,t.createElementVNode)(`span`,{class:`wp:text-muted-foreground`},`Línea 1`,-1),(0,t.createVNode)((0,t.unref)(Lu),null,{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)((0,t.unref)(a))+`1`,1)]),_:1})]),(0,t.createElementVNode)(`div`,$d,[r[16]||=(0,t.createElementVNode)(`span`,{class:`wp:text-muted-foreground`},`Línea 2`,-1),(0,t.createVNode)((0,t.unref)(Lu),null,{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)((0,t.unref)(a))+`2`,1)]),_:1})]),(0,t.createElementVNode)(`div`,ef,[r[17]||=(0,t.createElementVNode)(`span`,{class:`wp:text-muted-foreground`},`Línea 3`,-1),(0,t.createVNode)((0,t.unref)(Lu),null,{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)((0,t.unref)(a))+`3`,1)]),_:1})])])])]),(0,t.createVNode)((0,t.unref)(Cd),null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(Q),{variant:`secondary`,onClick:r[4]||=e=>i(`update:visible`,!1)},{default:(0,t.withCtx)(()=>[...r[18]||=[(0,t.createTextVNode)(`Close`,-1)]]),_:1})]),_:1})]),_:1})]),_:1},8,[`open`])):(0,t.createCommentVNode)(``,!0)}}),nf=(0,t.defineComponent)({__name:`ScrollBar`,props:{orientation:{default:`vertical`},forceMount:{type:Boolean},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let r=e,i=(0,n.reactiveOmit)(r,`class`);return(n,a)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Rc),(0,t.mergeProps)({"data-slot":`scroll-area-scrollbar`},(0,t.unref)(i),{class:(0,t.unref)(J)(`wp:flex wp:touch-none wp:p-px wp:transition-colors wp:select-none`,e.orientation===`vertical`&&`wp:h-full wp:w-2.5 wp:border-l wp:border-l-transparent`,e.orientation===`horizontal`&&`wp:h-2.5 wp:flex-col wp:border-t wp:border-t-transparent`,r.class)}),{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(Uc),{"data-slot":`scroll-area-thumb`,class:`wp:bg-border wp:relative wp:flex-1 wp:rounded-full`})]),_:1},16,[`class`]))}}),rf=(0,t.defineComponent)({__name:`ScrollArea`,props:{type:{},dir:{},scrollHideDelay:{},asChild:{type:Boolean},as:{},class:{type:[Boolean,null,String,Object,Array]}},setup(e){let r=e,i=(0,n.reactiveOmit)(r,`class`);return(e,n)=>((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(yc),(0,t.mergeProps)({"data-slot":`scroll-area`},(0,t.unref)(i),{class:(0,t.unref)(J)(`wp:relative`,r.class)}),{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(Wc),{"data-slot":`scroll-area-viewport`,class:`wp:focus-visible:ring-ring/50 wp:size-full wp:rounded-[inherit] wp:transition-[color,box-shadow] wp:outline-none wp:focus-visible:ring-[3px] wp:focus-visible:outline-1`},{default:(0,t.withCtx)(()=>[(0,t.renderSlot)(e.$slots,`default`)]),_:3}),(0,t.createVNode)(nf),(0,t.createVNode)((0,t.unref)(xc))]),_:3},16,[`class`]))}}),af={class:`wp:relative wp:my-2`},of={class:`wp:flex wp:flex-col wp:gap-2`},sf=[`onClick`],cf={class:`wp:flex wp:items-center wp:gap-3`},lf={class:`wp:flex wp:flex-col`},uf={class:`wp:text-sm wp:font-medium`},df={class:`wp:text-[10px] wp:text-muted-foreground`},ff={class:`wp:flex wp:flex-col wp:items-end`},pf={key:0,class:`wp:text-xs wp:font-mono wp:text-muted-foreground`},mf={class:`wp:text-[10px] wp:text-muted-foreground wp:capitalize`},hf={key:0,class:`wp:text-center wp:text-muted-foreground wp:py-8`},gf={key:1,class:`wp:text-center wp:text-muted-foreground wp:py-8`},_f=(0,t.defineComponent)({__name:`CallHistoryDialog`,props:{visible:{type:Boolean},contacts:{}},emits:[`update:visible`,`call`],setup(e,{emit:n}){let r=e,i=n,a=(0,t.inject)(`webphone`),o=(0,t.ref)(``),s=e=>{if(!r.contacts)return e;let t=r.contacts.find(t=>t.number===e);return t?t.name:e},c=(0,t.computed)(()=>{if(!o.value)return a.callHistory;let e=o.value.toLowerCase();return a.callHistory.filter(t=>{let n=s(t.number).toLowerCase(),r=t.number.toLowerCase();return n.includes(e)||r.includes(e)})}),l=e=>e===0?``:`${Math.floor(e/60)}:${(e%60).toString().padStart(2,`0`)}`,u=e=>e.direction===`incoming`?e.status===`missed`?cu:su:lu,d=e=>e.status===`missed`?`wp:text-red-500`:e.direction===`incoming`?`wp:text-green-500`:`wp:text-blue-500`,f=e=>{i(`update:visible`,!1),i(`call`,e)};return(n,r)=>e.visible?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(bd),{key:0,open:e.visible,"onUpdate:open":r[1]||=e=>i(`update:visible`,e)},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(Sd),{class:`wp:sm:max-w-sm`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(wd),null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(Td),null,{default:(0,t.withCtx)(()=>[...r[2]||=[(0,t.createTextVNode)(`Call History`,-1)]]),_:1})]),_:1}),(0,t.createElementVNode)(`div`,af,[(0,t.createVNode)((0,t.unref)(fu),{class:`wp:absolute wp:left-2 wp:top-2.5 wp:h-4 wp:w-4 wp:text-muted-foreground`}),(0,t.createVNode)((0,t.unref)(Iu),{modelValue:o.value,"onUpdate:modelValue":r[0]||=e=>o.value=e,placeholder:`Search history...`,class:`wp:pl-8`},null,8,[`modelValue`])]),(0,t.createVNode)((0,t.unref)(rf),{class:`wp:h-[60vh] wp:pr-4`},{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,of,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(c.value,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:e.id,class:`wp:flex wp:items-center wp:justify-between wp:p-2 wp:rounded-lg wp:hover:bg-accent wp:cursor-pointer wp:transition-colors`,onClick:t=>f(e.number)},[(0,t.createElementVNode)(`div`,cf,[((0,t.openBlock)(),(0,t.createBlock)((0,t.resolveDynamicComponent)(u(e)),{class:(0,t.normalizeClass)([d(e),`wp:w-4 wp:h-4`])},null,8,[`class`])),(0,t.createElementVNode)(`div`,lf,[(0,t.createElementVNode)(`span`,uf,(0,t.toDisplayString)(s(e.number)),1),(0,t.createElementVNode)(`span`,df,(0,t.toDisplayString)(new Date(e.startTime).toLocaleString()),1)])]),(0,t.createElementVNode)(`div`,ff,[e.duration>0?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,pf,(0,t.toDisplayString)(l(e.duration)),1)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`span`,mf,(0,t.toDisplayString)(e.status),1)])],8,sf))),128)),(0,t.unref)(a).callHistory.length===0?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,hf,` No call history `)):c.value.length===0?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,gf,` No results found `)):(0,t.createCommentVNode)(``,!0)])]),_:1})]),_:1})]),_:1},8,[`open`])):(0,t.createCommentVNode)(``,!0)}}),vf={class:`wp:grid wp:gap-4 wp:py-4`},yf={class:`wp:grid wp:gap-2 wp:relative`},bf={class:`wp:relative`},xf={key:0,class:`wp:absolute wp:top-full wp:left-0 wp:right-0 wp:mt-1 wp:bg-popover wp:border wp:rounded-md wp:shadow-lg wp:z-50 wp:max-h-60 wp:overflow-auto`},Sf={class:`wp:p-1`},Cf=[`onClick`],wf={class:`wp:flex wp:flex-col wp:min-w-0 wp:flex-1`},Tf={class:`wp:font-medium wp:text-sm wp:truncate`},Ef={class:`wp:text-xs wp:text-muted-foreground`},Df=(0,t.defineComponent)({__name:`TransferDialog`,props:{visible:{type:Boolean},contacts:{default:()=>[]}},emits:[`update:visible`,`transfer`],setup(e,{emit:n}){let r=e,i=n,a=(0,t.ref)(``),o=(0,t.ref)(!1),s=(0,t.ref)(null);(0,t.watch)(()=>r.visible,e=>{e&&(a.value=``,o.value=!1)}),(0,t.watch)(a,e=>{o.value=e.length>0&&c.value.length>0});let c=(0,t.computed)(()=>{if(!a.value)return r.contacts;let e=a.value.toLowerCase();return r.contacts.filter(t=>t.name.toLowerCase().includes(e)||t.number.includes(e))}),l=e=>{a.value=e.number,o.value=!1},u=()=>{a.value=``,o.value=!1,s.value?.focus()},d=e=>{let t=a.value.trim();t&&(i(`transfer`,t,e),i(`update:visible`,!1),a.value=``,o.value=!1)},f=e=>{e.key===`Enter`&&a.value.trim()?(e.preventDefault(),d(`blind`)):e.key===`Escape`&&(o.value=!1)};return(n,r)=>e.visible?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(bd),{key:0,open:e.visible,"onUpdate:open":r[5]||=e=>i(`update:visible`,e)},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(Sd),{class:`wp:sm:max-w-md`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(wd),null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(Td),null,{default:(0,t.withCtx)(()=>[...r[6]||=[(0,t.createTextVNode)(`Transferir Llamada`,-1)]]),_:1})]),_:1}),(0,t.createElementVNode)(`div`,vf,[(0,t.createElementVNode)(`div`,yf,[(0,t.createVNode)((0,t.unref)(Id),{for:`transfer-input`},{default:(0,t.withCtx)(()=>[...r[7]||=[(0,t.createTextVNode)(`Número o Contacto`,-1)]]),_:1}),(0,t.createElementVNode)(`div`,bf,[(0,t.createVNode)((0,t.unref)(Iu),{id:`transfer-input`,ref_key:`inputRef`,ref:s,modelValue:a.value,"onUpdate:modelValue":r[0]||=e=>a.value=e,type:`text`,placeholder:`Escribe un número o busca un contacto...`,class:`wp:pr-8`,onKeydown:f,onFocus:r[1]||=e=>o.value=a.value.length>0&&c.value.length>0,autocomplete:`off`},null,8,[`modelValue`]),a.value?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(Q),{key:0,variant:`ghost`,size:`icon`,class:`wp:absolute wp:right-0 wp:top-0 wp:h-full wp:w-8 wp:hover:bg-transparent`,onClick:u},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(_u),{class:`wp:h-4 wp:w-4`})]),_:1})):(0,t.createCommentVNode)(``,!0)]),o.value&&c.value.length>0?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,xf,[(0,t.createVNode)((0,t.unref)(rf),{class:`wp:max-h-60`},{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,Sf,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(c.value,e=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:e.number,class:`wp:flex wp:items-center wp:gap-2 wp:p-2 wp:rounded-sm wp:cursor-pointer wp:hover:bg-accent wp:transition-colors`,onClick:t=>l(e)},[e.type?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:(0,t.normalizeClass)((0,t.unref)(J)(`wp:flex wp:items-center wp:justify-center wp:w-8 wp:h-8 wp:rounded-full wp:shrink-0`,e.type===`extension`?`wp:bg-blue-100 wp:text-blue-600 wp:dark:bg-blue-900/30 wp:dark:text-blue-400`:e.type===`contact`?`wp:bg-emerald-100 wp:text-emerald-600 wp:dark:bg-emerald-900/30 wp:dark:text-emerald-400`:e.type===`voicemail`?`wp:bg-purple-100 wp:text-purple-600 wp:dark:bg-purple-900/30 wp:dark:text-purple-400`:`wp:bg-amber-100 wp:text-amber-600 wp:dark:bg-amber-900/30 wp:dark:text-amber-400`))},[e.type===`extension`?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)($l),{key:0,class:`wp:w-4 wp:h-4`})):e.type===`contact`?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(ru),{key:1,class:`wp:w-4 wp:h-4`})):e.type===`voicemail`?((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(hu),{key:2,class:`wp:w-4 wp:h-4`})):((0,t.openBlock)(),(0,t.createBlock)((0,t.unref)(gu),{key:3,class:`wp:w-4 wp:h-4`}))],2)):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,wf,[(0,t.createElementVNode)(`span`,Tf,(0,t.toDisplayString)(e.name),1),(0,t.createElementVNode)(`span`,Ef,(0,t.toDisplayString)(e.number),1)])],8,Cf))),128))])]),_:1})])):(0,t.createCommentVNode)(``,!0),r[8]||=(0,t.createElementVNode)(`p`,{class:`wp:text-xs wp:text-muted-foreground`},` Presiona Enter para transferir directamente `,-1)])]),(0,t.createVNode)((0,t.unref)(Cd),{class:`wp:flex-col wp:gap-2 sm:wp:flex-row`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(Q),{variant:`secondary`,onClick:r[2]||=e=>i(`update:visible`,!1),class:`wp:w-full sm:wp:w-auto`},{default:(0,t.withCtx)(()=>[...r[9]||=[(0,t.createTextVNode)(` Cancelar `,-1)]]),_:1}),(0,t.createVNode)((0,t.unref)(Q),{onClick:r[3]||=e=>d(`blind`),disabled:!a.value.trim(),variant:`outline`,class:`wp:w-full sm:wp:flex-1`},{default:(0,t.withCtx)(()=>[...r[10]||=[(0,t.createTextVNode)(` Transferencia Ciega `,-1)]]),_:1},8,[`disabled`]),(0,t.createVNode)((0,t.unref)(Q),{onClick:r[4]||=e=>d(`attended`),disabled:!a.value.trim(),class:`wp:w-full sm:wp:flex-1`},{default:(0,t.withCtx)(()=>[...r[11]||=[(0,t.createTextVNode)(` Con Consulta `,-1)]]),_:1},8,[`disabled`])]),_:1})]),_:1})]),_:1},8,[`open`])):(0,t.createCommentVNode)(``,!0)}}),Of=(0,t.defineComponent)({__name:`DocumentPip`,props:{remoteStream:{},localStream:{},hasVideo:{type:Boolean},remoteNumber:{},isConnected:{type:Boolean},callStatus:{},isMuted:{type:Boolean},isHeld:{type:Boolean},destination:{},isVideo:{type:Boolean},active:{type:Boolean},autoOpenOnBlur:{type:Boolean}},emits:[`transfer`,`update:active`,`hangup`,`answer`,`toggleMute`,`toggleHold`],setup(e,{expose:n,emit:r}){let i=e,a=r,o=(0,t.ref)(!1),s=(0,t.ref)(!1),c=(0,t.ref)(null),l=(0,t.ref)(0),u=(0,t.ref)(null),d=null;(0,t.onMounted)(()=>{o.value=`documentPictureInPicture`in window,document.addEventListener(`visibilitychange`,f)}),(0,t.onUnmounted)(()=>{document.removeEventListener(`visibilitychange`,f),m(),D()});let f=()=>{i.callStatus===`idle`||!o.value||document.hidden&&!s.value&&i.autoOpenOnBlur!==!1&&setTimeout(()=>{document.hidden&&!s.value&&ee()},100)},p=()=>{u.value||=(l.value=0,setInterval(()=>{l.value++},1e3))},m=()=>{u.value&&=(clearInterval(u.value),null)},h=e=>{let t=Math.floor(e/60),n=e%60;return`${t.toString().padStart(2,`0`)}:${n.toString().padStart(2,`0`)}`};(0,t.watch)(()=>i.callStatus,(e,t)=>{e===`connected`&&t!==`connected`?p():e===`idle`&&t!==`idle`&&(m(),s.value&&D())},{immediate:!0}),(0,t.watch)(()=>i.isConnected,e=>{!e&&s.value&&(m(),D())}),(0,t.watch)(()=>[i.callStatus,i.isMuted,i.isHeld],()=>{c.value&&(C(c.value.document),x(c.value.document))});let g=(0,t.computed)(()=>o.value&&i.isConnected),_={phone:`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"/></svg>`,phoneOff:`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z" transform="rotate(135 12 12)"/><line x1="1" y1="1" x2="23" y2="23"/></svg>`,mic:`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z"/><path d="M19 10v2a7 7 0 0 1-14 0v-2"/><line x1="12" x2="12" y1="19" y2="22"/></svg>`,micOff:`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="2" x2="22" y1="2" y2="22"/><path d="M18.89 13.23A7.12 7.12 0 0 0 19 12v-2"/><path d="M5 10v2a7 7 0 0 0 12 5"/><path d="M15 9.34V5a3 3 0 0 0-5.68-1.33"/><path d="M9 9v3a3 3 0 0 0 5.12 2.12"/><line x1="12" x2="12" y1="19" y2="22"/></svg>`,pause:`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="14" y="4" width="4" height="16" rx="1"/><rect x="6" y="4" width="4" height="16" rx="1"/></svg>`,play:`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polygon points="6 3 20 12 6 21 6 3"/></svg>`,transfer:`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m16 3 4 4-4 4"/><path d="M20 7H4"/><path d="m8 21-4-4 4-4"/><path d="M4 17h16"/></svg>`,video:`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5"/><rect x="2" y="6" width="14" height="12" rx="2"/></svg>`,user:`<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/></svg>`},v=e=>{let t=e.createElement(`style`);t.textContent=`
64
64
  * { box-sizing: border-box; margin: 0; padding: 0; }
65
65
 
66
66
  body {
@@ -285,4 +285,4 @@ For more information, see https://www.reka-ui.com/docs/components/${r}`,c=`Warni
285
285
  <div class="pip-duration" id="pip-timer">${h(l.value)}</div>
286
286
  </div>
287
287
  <div class="pip-actions" id="pip-actions"></div>
288
- `,t},C=e=>{let t=e.getElementById(`pip-actions`);if(t){if(t.innerHTML=``,i.callStatus===`incoming`){if(i.hasVideo){let n=e.createElement(`button`);n.className=`pip-btn pip-btn-video`,n.title=`Contestar con Video`,n.innerHTML=_.video,n.onclick=()=>a(`answer`,!0),t.appendChild(n)}let n=e.createElement(`button`);n.className=`pip-btn pip-btn-answer`,n.title=`Contestar`,n.innerHTML=_.phone,n.onclick=()=>a(`answer`,!1),t.appendChild(n);let r=e.createElement(`button`);r.className=`pip-btn pip-btn-hangup`,r.title=`Rechazar`,r.innerHTML=_.phoneOff,r.onclick=()=>{a(`hangup`),D()},t.appendChild(r)}else if(i.callStatus===`connected`){let n=e.createElement(`button`);n.className=`pip-btn pip-btn-mute ${i.isMuted?`active`:``}`,n.title=i.isMuted?`Activar micrófono`:`Silenciar`,n.innerHTML=i.isMuted?_.micOff:_.mic,n.onclick=()=>a(`toggleMute`),t.appendChild(n);let r=e.createElement(`button`);r.className=`pip-btn pip-btn-hold ${i.isHeld?`active`:``}`,r.title=i.isHeld?`Reanudar`:`Pausar`,r.innerHTML=i.isHeld?_.play:_.pause,r.onclick=()=>a(`toggleHold`),t.appendChild(r);let o=e.createElement(`button`);o.className=`pip-btn pip-btn-transfer`,o.title=`Transferir`,o.innerHTML=_.transfer,o.onclick=()=>a(`transfer`),t.appendChild(o);let s=e.createElement(`button`);s.className=`pip-btn pip-btn-hangup`,s.title=`Colgar`,s.innerHTML=_.phoneOff,s.onclick=()=>{a(`hangup`),D()},t.appendChild(s)}else if(i.callStatus===`calling`){let n=e.createElement(`button`);n.className=`pip-btn pip-btn-hangup`,n.title=`Cancelar`,n.innerHTML=_.phoneOff,n.onclick=()=>{a(`hangup`),D()},t.appendChild(n)}}},w=e=>{setTimeout(()=>{let t=e.getElementById(`pip-remote-video`),n=e.getElementById(`pip-local-video`);t&&i.remoteStream&&(t.srcObject=i.remoteStream,t.play().catch(()=>{})),n&&i.localStream&&(n.srcObject=i.localStream,n.play().catch(()=>{}))},50)},T=e=>{let t=e.getElementById(`pip-timer`);t&&(d=setInterval(()=>{t.textContent=h(l.value)},1e3))},E=()=>{d&&=(clearInterval(d),null)},ee=async()=>{if(!(!o.value||s.value))try{let e=i.hasVideo?340:280,t=i.hasVideo?280:200,n=await window.documentPictureInPicture.requestWindow({width:e,height:t,preferInitialWindowPlacement:!0});c.value=n,s.value=!0,a(`update:active`,!0),v(n.document);let r=S(n.document);n.document.body.appendChild(r),i.hasVideo&&w(n.document),C(n.document),T(n.document),n.addEventListener(`pagehide`,()=>{E(),s.value=!1,c.value=null,a(`update:active`,!1)})}catch(e){console.error(`[DocumentPip] Error:`,e)}},D=()=>{E(),c.value&&(c.value.close(),c.value=null,s.value=!1,a(`update:active`,!1))};return n({open:ee,close:D,toggle:()=>{s.value?D():ee()},isActive:s,isSupported:o,canUsePip:g}),(e,n)=>(0,t.renderSlot)(e.$slots,`default`)}}),pf=[`data-mode`,`data-call-status`],mf={key:0,class:`webphone__video-area wp:relative wp:w-full wp:aspect-video wp:bg-black`},hf={class:`webphone__video-local-frame wp:absolute wp:bottom-2 wp:right-2 wp:w-24 wp:aspect-video wp:bg-neutral-800 wp:rounded wp:overflow-hidden wp:border wp:border-white/20 wp:shadow-lg`},gf={class:`webphone__body wp:flex wp:flex-col wp:gap-1 wp:space-y-2`},_f={key:0,class:`webphone__channel-switcher-wrap wp:flex wp:flex-col wp:items-center wp:justify-center wp:py-3 wp:px-4 wp:gap-2`},vf={role:`radiogroup`,"aria-label":`Canales`,class:`webphone__channel-switcher wp:w-full wp:max-w-[330px] wp:flex wp:items-center wp:justify-between wp:gap-1`},yf={class:`wp:flex wp:gap-1`},bf=[`aria-checked`,`title`,`data-channel-id`,`data-state`,`data-call-state`,`onClick`],xf={class:`webphone__display wp:py-1`},Sf=[`data-visible`],Cf={key:1,class:`webphone__footer wp:flex wp:flex-col wp:items-center wp:p-2 wp:gap-0`};e.WebPhone=((e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n})((0,t.defineComponent)({__name:`WebPhone`,props:{host:{},wsUrl:{},extension:{},password:{},to:{},mode:{default:`call`},logo:{},contacts:{default:()=>[]}},setup(e){let r=e,i=(0,t.computed)(()=>{if(r.wsUrl)return r.wsUrl;if(r.host)return`wss://${r.host}/ws`}),a=h({server:i.value,extension:r.extension}),o=(0,t.reactive)(a),s=ur(a),{initUserAgent:c,switchChannel:l,remoteStream:u,localStream:d}=s;(0,t.provide)(`webphone`,o),(0,t.provide)(`sip`,s),(0,t.watchEffect)(()=>{r.mode===`webcall`&&(r.to||console.error(`WebPhone: "to" prop is required when mode is "webcall"`),r.logo||console.error(`WebPhone: "logo" prop is required when mode is "webcall"`))});let f=(0,t.ref)(!1),p=(0,t.ref)(!1),m=(0,t.ref)(!1),g=(0,t.ref)(null),_=(0,t.ref)(null),v=(0,t.ref)(null),y=navigator.platform.toUpperCase().indexOf(`MAC`)>=0?`⌘`:`Ctrl+`,b=(0,t.computed)(()=>r.mode===`webcall`),x=(0,t.ref)(0),S=e=>!!e&&e.getVideoTracks().length>0,C=(0,t.computed)(()=>o.channels.find(e=>e.id===o.activeChannelId)??null),w=(0,t.computed)(()=>(x.value,!!C.value?.hasVideo||S(u.value)||S(d.value)));(0,n.useNetwork)();let T=(0,t.ref)(null),E=(0,t.ref)(!1),ee=async(e,t)=>{try{t===`blind`?await s.transferCall(e):await s.startAttendedTransfer(e)}catch(e){console.error(`[WebPhone] Transfer error:`,e),alert(e instanceof Error?e.message:`Transfer failed. Please try again.`)}},D=async()=>{try{await s.completeAttendedTransfer()}catch(e){console.error(`[WebPhone] Complete transfer error:`,e),alert(e instanceof Error?e.message:`Failed to complete transfer.`)}},te=async()=>{try{await s.cancelAttendedTransfer()}catch(e){console.error(`[WebPhone] Cancel transfer error:`,e),alert(e instanceof Error?e.message:`Failed to cancel transfer.`)}};(0,t.watchEffect)(()=>{_.value&&(E.value||!u.value?_.value.srcObject=null:_.value.srcObject=u.value),v.value&&(E.value||!d.value?v.value.srcObject=null:v.value.srcObject=d.value)});let O=e=>{if(!e||typeof e.addEventListener!=`function`||typeof e.removeEventListener!=`function`)return()=>{};let t=()=>{x.value+=1};return e.addEventListener(`addtrack`,t),e.addEventListener(`removetrack`,t),()=>{e.removeEventListener(`addtrack`,t),e.removeEventListener(`removetrack`,t)}};(0,t.watch)(u,(e,t,n)=>{x.value+=1,n(O(e))},{immediate:!0}),(0,t.watch)(d,(e,t,n)=>{x.value+=1,n(O(e))},{immediate:!0});let ne=[`button`,`a`,`input`,`textarea`,`select`,`label`,`video`,`[role="button"]`,`[role="radio"]`,`[data-no-drag]`].join(`, `),{style:k}=(0,n.useDraggable)(g,{initialValue:(()=>{let e=window.innerWidth<640,t=window.innerWidth<1024,n=360;return e?n=window.innerWidth*.9:t&&(n=340),{x:Math.max(0,(window.innerWidth-n)/2),y:e?30:80}})(),preventDefault:!0,onStart:(e,t)=>{let n=t.target;if(n instanceof HTMLElement&&n.closest(ne))return!1}}),re=[{label:`Canal 1`,value:0},{label:`Canal 2`,value:1},{label:`Canal 3`,value:2}],ie=(0,t.ref)(!1),A=(0,t.computed)({get:()=>o.activeChannelId.toString(),set:async e=>{if(e&&!ie.value){ie.value=!0;try{await l(parseInt(e))}finally{ie.value=!1}}}}),j=e=>{let t=o.channels.find(t=>t.id===e);return t?t.status===`connected`||t.status===`calling`||t.status===`incoming`:!1},ae=e=>{A.value=e.toString()},oe=e=>{if((e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`h`&&(e.preventDefault(),p.value=!0),(e.metaKey||e.ctrlKey)&&e.key===`,`&&(e.preventDefault(),f.value=!0),(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),o.toggleKeypad()),(e.metaKey||e.ctrlKey)&&[`1`,`2`,`3`].includes(e.key)){e.preventDefault();let t=parseInt(e.key)-1;ie.value||(ie.value=!0,l(t).finally(()=>{ie.value=!1}))}};return(0,t.onMounted)(async()=>{window.addEventListener(`keydown`,oe),!(r.mode===`webcall`&&(!r.to||!r.logo))&&(!r.host||!r.extension||!r.password||(await c({uri:`sip:${r.extension}@${r.host}`,transportOptions:{server:i.value},authorizationUsername:r.extension,authorizationPassword:r.password}),r.mode===`webcall`&&r.to&&s.makeCall(r.to)))}),(0,t.onUnmounted)(()=>{window.removeEventListener(`keydown`,oe)}),(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,null,[(0,t.createElementVNode)(`div`,{ref_key:`phoneRef`,ref:g,style:(0,t.normalizeStyle)((0,t.unref)(k)),class:`webphone webphone-container wp:bg-white wp:dark:bg-neutral-800 wp:rounded-2xl wp:shadow-sm wp:inset-shadow-2xs wp:w-[min(92vw,330px)] wp:fixed wp:z-50 wp:select-none wp:[&_button]:cursor-pointer wp:**:[[role=button]]:cursor-pointer`,"data-mode":r.mode,"data-call-status":o.callStatus},[w.value&&!E.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,mf,[(0,t.createElementVNode)(`video`,{ref_key:`remoteVideoRef`,ref:_,autoplay:``,playsinline:``,class:`webphone__video-remote wp:w-full wp:h-full wp:object-cover`},null,512),(0,t.createElementVNode)(`div`,hf,[(0,t.createElementVNode)(`video`,{ref_key:`localVideoRef`,ref:v,autoplay:``,playsinline:``,muted:``,class:`webphone__video-local wp:w-full wp:h-full wp:object-cover`},null,512)])])):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,gf,[b.value?(0,t.createCommentVNode)(``,!0):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,_f,[(0,t.createElementVNode)(`div`,vf,[(0,t.createElementVNode)(`div`,yf,[((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(re,e=>(0,t.createElementVNode)(`button`,{key:e.value,type:`button`,role:`radio`,"aria-checked":A.value===e.value.toString(),title:`${e.label} (${(0,t.unref)(y)}${e.value+1})`,class:(0,t.normalizeClass)([`webphone__channel-button wp:flex wp:items-center wp:gap-1 wp:px-2 wp:py-2 wp:rounded-lg wp:transition-colors wp:duration-200 wp:outline-none wp:focus-visible:ring-2 wp:focus-visible:ring-[var(--p-primary-color)] wp:focus-visible:ring-offset-2 wp:focus-visible:ring-offset-white wp:dark:focus-visible:ring-offset-neutral-900`,j(e.value)?`wp:bg-[var(--color-red)]/12 hover:wp:bg-[var(--color-red)]/18`:A.value===e.value.toString()?`wp:bg-[var(--p-primary-color)]/12`:`wp:hover:bg-neutral-100 wp:dark:hover:bg-neutral-800/80`]),"data-channel-id":e.value,"data-state":A.value===e.value.toString()?`active`:`idle`,"data-call-state":j(e.value)?`busy`:`available`,onClick:t=>ae(e.value)},[(0,t.createVNode)((0,t.unref)(Nu),{class:(0,t.normalizeClass)([`webphone__channel-icon wp:size-3 wp:shrink-0`,j(e.value)?`wp:text-[var(--color-red)]`:A.value===e.value.toString()?`wp:text-[var(--p-primary-color)]`:`wp:text-neutral-400`]),"stroke-width":1.8},null,8,[`class`]),(0,t.createElementVNode)(`span`,{class:(0,t.normalizeClass)([`webphone__channel-label wp:text-[12px] wp:leading-none ibrand`,j(e.value)?`wp:text-[var(--color-red)]`:A.value===e.value.toString()?`wp:text-[var(--p-primary-color)]`:`wp:text-neutral-500 wp:dark:text-neutral-400`])},(0,t.toDisplayString)(e.label),3)],10,bf)),64))]),(0,t.createVNode)((0,t.unref)(Iu),null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(Pu),null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(Lu),{"as-child":``},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(Q),{variant:`ghost`,size:`icon`,class:`wp:h-8 wp:w-8 wp:rounded-full`,onClick:n[0]||=e=>f.value=!0},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(pu),{class:`wp:w-4 wp:h-4 wp:text-[var(--color-settings)]`})]),_:1})]),_:1}),(0,t.createVNode)((0,t.unref)(Fu),{class:`wp:flex wp:items-center wp:gap-2`},{default:(0,t.withCtx)(()=>[n[12]||=(0,t.createElementVNode)(`span`,null,`Configuración`,-1),(0,t.createVNode)((0,t.unref)(ku),null,{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)((0,t.unref)(y))+`,`,1)]),_:1})]),_:1})]),_:1})]),_:1})])])),(0,t.createElementVNode)(`div`,xf,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(o.channels,e=>(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createBlock)(rd,{key:e.id,"channel-id":e.id,"allow-input":!b.value,"is-web-call":b.value,contacts:r.contacts,user:r.extension},null,8,[`channel-id`,`allow-input`,`is-web-call`,`contacts`,`user`])),[[t.vShow,e.id===o.activeChannelId]])),128))]),(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`webphone__keypad wp:transition-all wp:duration-300 wp:ease-in-out wp:overflow-hidden`,o.isKeypadVisible&&o.callStatus===`idle`?`wp:max-h-[300px] wp:opacity-100 wp:pb-0`:`wp:max-h-0 wp:opacity-0 wp:pb-0`]),"data-visible":o.isKeypadVisible&&o.callStatus===`idle`?`true`:`false`},[(0,t.createVNode)(Gl)],10,Sf),(0,t.createVNode)(Du,{class:`webphone__actions`,destination:b.value?r.to:void 0,"is-video":r.mode===`video`,onTransfer:n[1]||=e=>m.value=!0,onCompleteTransfer:D,onCancelTransfer:te},null,8,[`destination`,`is-video`])]),b.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Cf,[...n[13]||=[(0,t.createElementVNode)(`div`,{class:`webphone__footer-label wp:text-[10px] wp:text-primary`},`Powered By`,-1),(0,t.createElementVNode)(`div`,{class:`webphone__footer-content wp:flex wp:items-center wp:gap-2`},[(0,t.createElementVNode)(`a`,{href:`https://www.nebula123.com`,target:`_blank`,class:`webphone__footer-link wp:text-[10px] wp:text-primary wp:hover:underline`},` www.nebula123.com `)],-1)]])):(0,t.createCommentVNode)(``,!0)],12,pf),(0,t.createVNode)(zd,{visible:f.value,"onUpdate:visible":n[2]||=e=>f.value=e},null,8,[`visible`]),(0,t.createVNode)(ef,{visible:p.value,"onUpdate:visible":n[3]||=e=>p.value=e,contacts:r.contacts,onCall:n[4]||=e=>{o.keypadValue=e,(0,t.unref)(s).makeCall(e)}},null,8,[`visible`,`contacts`]),(0,t.createVNode)(df,{visible:m.value,"onUpdate:visible":n[5]||=e=>m.value=e,contacts:r.contacts,onTransfer:ee},null,8,[`visible`,`contacts`]),(0,t.createVNode)(ff,{ref_key:`documentPipRef`,ref:T,active:E.value,"onUpdate:active":n[6]||=e=>E.value=e,"is-connected":o.isConnected,"remote-number":o.remoteNumber,"has-video":w.value??!1,"remote-stream":(0,t.unref)(u),"local-stream":(0,t.unref)(d),destination:b.value?r.to:void 0,"is-video":r.mode===`video`,"call-status":o.callStatus,"is-muted":o.isMuted,"is-held":o.isHeld,onTransfer:n[7]||=e=>m.value=!0,onHangup:n[8]||=e=>(0,t.unref)(s).hangupCall(),onAnswer:n[9]||=e=>(0,t.unref)(s).answerCall(e),onToggleMute:n[10]||=e=>(0,t.unref)(s).toggleMute(),onToggleHold:n[11]||=e=>(0,t.unref)(s).toggleHold()},null,8,[`active`,`is-connected`,`remote-number`,`has-video`,`remote-stream`,`local-stream`,`destination`,`is-video`,`call-status`,`is-muted`,`is-held`])],64))}}),[[`__scopeId`,`data-v-94b7d1be`]])});
288
+ `,t},C=e=>{let t=e.getElementById(`pip-actions`);if(t){if(t.innerHTML=``,i.callStatus===`incoming`){if(i.hasVideo){let n=e.createElement(`button`);n.className=`pip-btn pip-btn-video`,n.title=`Contestar con Video`,n.innerHTML=_.video,n.onclick=()=>a(`answer`,!0),t.appendChild(n)}let n=e.createElement(`button`);n.className=`pip-btn pip-btn-answer`,n.title=`Contestar`,n.innerHTML=_.phone,n.onclick=()=>a(`answer`,!1),t.appendChild(n);let r=e.createElement(`button`);r.className=`pip-btn pip-btn-hangup`,r.title=`Rechazar`,r.innerHTML=_.phoneOff,r.onclick=()=>{a(`hangup`),D()},t.appendChild(r)}else if(i.callStatus===`connected`){let n=e.createElement(`button`);n.className=`pip-btn pip-btn-mute ${i.isMuted?`active`:``}`,n.title=i.isMuted?`Activar micrófono`:`Silenciar`,n.innerHTML=i.isMuted?_.micOff:_.mic,n.onclick=()=>a(`toggleMute`),t.appendChild(n);let r=e.createElement(`button`);r.className=`pip-btn pip-btn-hold ${i.isHeld?`active`:``}`,r.title=i.isHeld?`Reanudar`:`Pausar`,r.innerHTML=i.isHeld?_.play:_.pause,r.onclick=()=>a(`toggleHold`),t.appendChild(r);let o=e.createElement(`button`);o.className=`pip-btn pip-btn-transfer`,o.title=`Transferir`,o.innerHTML=_.transfer,o.onclick=()=>a(`transfer`),t.appendChild(o);let s=e.createElement(`button`);s.className=`pip-btn pip-btn-hangup`,s.title=`Colgar`,s.innerHTML=_.phoneOff,s.onclick=()=>{a(`hangup`),D()},t.appendChild(s)}else if(i.callStatus===`calling`){let n=e.createElement(`button`);n.className=`pip-btn pip-btn-hangup`,n.title=`Cancelar`,n.innerHTML=_.phoneOff,n.onclick=()=>{a(`hangup`),D()},t.appendChild(n)}}},w=e=>{setTimeout(()=>{let t=e.getElementById(`pip-remote-video`),n=e.getElementById(`pip-local-video`);t&&i.remoteStream&&(t.srcObject=i.remoteStream,t.play().catch(()=>{})),n&&i.localStream&&(n.srcObject=i.localStream,n.play().catch(()=>{}))},50)},T=e=>{let t=e.getElementById(`pip-timer`);t&&(d=setInterval(()=>{t.textContent=h(l.value)},1e3))},E=()=>{d&&=(clearInterval(d),null)},ee=async()=>{if(!(!o.value||s.value))try{let e=i.hasVideo?340:280,t=i.hasVideo?280:200,n=await window.documentPictureInPicture.requestWindow({width:e,height:t,preferInitialWindowPlacement:!0});c.value=n,s.value=!0,a(`update:active`,!0),v(n.document);let r=S(n.document);n.document.body.appendChild(r),i.hasVideo&&w(n.document),C(n.document),T(n.document),n.addEventListener(`pagehide`,()=>{E(),s.value=!1,c.value=null,a(`update:active`,!1)})}catch(e){console.error(`[DocumentPip] Error:`,e)}},D=()=>{E(),c.value&&(c.value.close(),c.value=null,s.value=!1,a(`update:active`,!1))};return n({open:ee,close:D,toggle:()=>{s.value?D():ee()},isActive:s,isSupported:o,canUsePip:g}),(e,n)=>(0,t.renderSlot)(e.$slots,`default`)}}),kf=[`data-mode`,`data-call-status`],Af={key:0,class:`webphone__video-area wp:relative wp:w-full wp:aspect-video wp:bg-black`},jf={class:`webphone__video-local-frame wp:absolute wp:bottom-2 wp:right-2 wp:w-24 wp:aspect-video wp:bg-neutral-800 wp:rounded wp:overflow-hidden wp:border wp:border-white/20 wp:shadow-lg`},Mf={class:`webphone__body wp:flex wp:flex-col wp:gap-1 wp:space-y-2`},Nf={key:0,class:`webphone__channel-switcher-wrap wp:flex wp:flex-col wp:items-center wp:justify-center wp:py-3 wp:px-4 wp:gap-2`},Pf={role:`radiogroup`,"aria-label":`Canales`,class:`webphone__channel-switcher wp:w-full wp:max-w-[330px] wp:flex wp:items-center wp:justify-between wp:gap-1`},Ff={class:`wp:flex wp:gap-1`},If=[`aria-checked`,`title`,`data-channel-id`,`data-state`,`data-call-state`,`onClick`],Lf={class:`webphone__display wp:py-1`},Rf=[`data-visible`],zf={key:1,class:`webphone__footer wp:flex wp:flex-col wp:items-center wp:p-2 wp:gap-0`};e.WebPhone=((e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n})((0,t.defineComponent)({__name:`WebPhone`,props:{host:{},wsUrl:{},extension:{},password:{},to:{},mode:{default:`call`},logo:{},contacts:{default:()=>[]}},setup(e){let r=e,i=(0,t.computed)(()=>{if(r.wsUrl)return r.wsUrl;if(r.host)return`wss://${r.host}/ws`}),a=h({server:i.value,extension:r.extension}),o=(0,t.reactive)(a),s=ur(a),{initUserAgent:c,switchChannel:l,remoteStream:u,localStream:d}=s;(0,t.provide)(`webphone`,o),(0,t.provide)(`sip`,s),(0,t.watchEffect)(()=>{r.mode===`webcall`&&(r.to||console.error(`WebPhone: "to" prop is required when mode is "webcall"`),r.logo||console.error(`WebPhone: "logo" prop is required when mode is "webcall"`))});let f=(0,t.ref)(!1),p=(0,t.ref)(!1),m=(0,t.ref)(!1),g=(0,t.ref)(null),_=(0,t.ref)(null),v=(0,t.ref)(null),y=navigator.platform.toUpperCase().indexOf(`MAC`)>=0?`⌘`:`Ctrl+`,b=(0,t.computed)(()=>r.mode===`webcall`),x=(0,t.ref)(0),S=e=>!!e&&e.getVideoTracks().length>0,C=(0,t.computed)(()=>o.channels.find(e=>e.id===o.activeChannelId)??null),w=(0,t.computed)(()=>(x.value,!!C.value?.hasVideo||S(u.value)||S(d.value)));(0,n.useNetwork)();let T=(0,t.ref)(null),E=(0,t.ref)(!1),ee=async(e,t)=>{try{t===`blind`?await s.transferCall(e):await s.startAttendedTransfer(e)}catch(e){console.error(`[WebPhone] Transfer error:`,e),alert(e instanceof Error?e.message:`Transfer failed. Please try again.`)}},D=async()=>{try{await s.completeAttendedTransfer()}catch(e){console.error(`[WebPhone] Complete transfer error:`,e),alert(e instanceof Error?e.message:`Failed to complete transfer.`)}},te=async()=>{try{await s.cancelAttendedTransfer()}catch(e){console.error(`[WebPhone] Cancel transfer error:`,e),alert(e instanceof Error?e.message:`Failed to cancel transfer.`)}};(0,t.watchEffect)(()=>{_.value&&(E.value||!u.value?_.value.srcObject=null:_.value.srcObject=u.value),v.value&&(E.value||!d.value?v.value.srcObject=null:v.value.srcObject=d.value)});let O=e=>{if(!e||typeof e.addEventListener!=`function`||typeof e.removeEventListener!=`function`)return()=>{};let t=()=>{x.value+=1};return e.addEventListener(`addtrack`,t),e.addEventListener(`removetrack`,t),()=>{e.removeEventListener(`addtrack`,t),e.removeEventListener(`removetrack`,t)}};(0,t.watch)(u,(e,t,n)=>{x.value+=1,n(O(e))},{immediate:!0}),(0,t.watch)(d,(e,t,n)=>{x.value+=1,n(O(e))},{immediate:!0});let ne=[`button`,`a`,`input`,`textarea`,`select`,`label`,`video`,`[role="button"]`,`[role="radio"]`,`[data-no-drag]`].join(`, `),{style:k}=(0,n.useDraggable)(g,{initialValue:(()=>{let e=window.innerWidth<640,t=window.innerWidth<1024,n=360;return e?n=window.innerWidth*.9:t&&(n=340),{x:Math.max(0,(window.innerWidth-n)/2),y:e?30:80}})(),preventDefault:!0,onStart:(e,t)=>{let n=t.target;if(n instanceof HTMLElement&&n.closest(ne))return!1}}),re=[{label:`Canal 1`,value:0},{label:`Canal 2`,value:1},{label:`Canal 3`,value:2}],ie=(0,t.ref)(!1),A=(0,t.computed)({get:()=>o.activeChannelId.toString(),set:async e=>{if(e&&!ie.value){ie.value=!0;try{await l(parseInt(e))}finally{ie.value=!1}}}}),j=e=>{let t=o.channels.find(t=>t.id===e);return t?t.status===`connected`||t.status===`calling`||t.status===`incoming`:!1},ae=e=>{A.value=e.toString()},oe=e=>{if((e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`h`&&(e.preventDefault(),p.value=!0),(e.metaKey||e.ctrlKey)&&e.key===`,`&&(e.preventDefault(),f.value=!0),(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),o.toggleKeypad()),(e.metaKey||e.ctrlKey)&&[`1`,`2`,`3`].includes(e.key)){e.preventDefault();let t=parseInt(e.key)-1;ie.value||(ie.value=!0,l(t).finally(()=>{ie.value=!1}))}};return(0,t.onMounted)(async()=>{window.addEventListener(`keydown`,oe),!(r.mode===`webcall`&&(!r.to||!r.logo))&&(!r.host||!r.extension||!r.password||(await c({uri:`sip:${r.extension}@${r.host}`,transportOptions:{server:i.value},authorizationUsername:r.extension,authorizationPassword:r.password}),r.mode===`webcall`&&r.to&&s.makeCall(r.to)))}),(0,t.onUnmounted)(()=>{window.removeEventListener(`keydown`,oe)}),(e,n)=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,null,[(0,t.createElementVNode)(`div`,{ref_key:`phoneRef`,ref:g,style:(0,t.normalizeStyle)((0,t.unref)(k)),class:`webphone webphone-container wp:bg-white wp:dark:bg-neutral-800 wp:rounded-2xl wp:shadow-sm wp:inset-shadow-2xs wp:w-[min(92vw,330px)] wp:fixed wp:z-50 wp:select-none wp:[&_button]:cursor-pointer wp:**:[[role=button]]:cursor-pointer`,"data-mode":r.mode,"data-call-status":o.callStatus},[w.value&&!E.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Af,[(0,t.createElementVNode)(`video`,{ref_key:`remoteVideoRef`,ref:_,autoplay:``,playsinline:``,class:`webphone__video-remote wp:w-full wp:h-full wp:object-cover`},null,512),(0,t.createElementVNode)(`div`,jf,[(0,t.createElementVNode)(`video`,{ref_key:`localVideoRef`,ref:v,autoplay:``,playsinline:``,muted:``,class:`webphone__video-local wp:w-full wp:h-full wp:object-cover`},null,512)])])):(0,t.createCommentVNode)(``,!0),(0,t.createElementVNode)(`div`,Mf,[b.value?(0,t.createCommentVNode)(``,!0):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,Nf,[(0,t.createElementVNode)(`div`,Pf,[(0,t.createElementVNode)(`div`,Ff,[((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(re,e=>(0,t.createElementVNode)(`button`,{key:e.value,type:`button`,role:`radio`,"aria-checked":A.value===e.value.toString(),title:`${e.label} (${(0,t.unref)(y)}${e.value+1})`,class:(0,t.normalizeClass)([`webphone__channel-button wp:flex wp:items-center wp:gap-1 wp:px-2 wp:py-2 wp:rounded-lg wp:transition-colors wp:duration-200 wp:outline-none wp:focus-visible:ring-2 wp:focus-visible:ring-[var(--p-primary-color)] wp:focus-visible:ring-offset-2 wp:focus-visible:ring-offset-white wp:dark:focus-visible:ring-offset-neutral-900`,j(e.value)?`wp:bg-[var(--color-red)]/12 hover:wp:bg-[var(--color-red)]/18`:A.value===e.value.toString()?`wp:bg-[var(--p-primary-color)]/12`:`wp:hover:bg-neutral-100 wp:dark:hover:bg-neutral-800/80`]),"data-channel-id":e.value,"data-state":A.value===e.value.toString()?`active`:`idle`,"data-call-state":j(e.value)?`busy`:`available`,onClick:t=>ae(e.value)},[(0,t.createVNode)((0,t.unref)(Yu),{class:(0,t.normalizeClass)([`webphone__channel-icon wp:size-3 wp:shrink-0`,j(e.value)?`wp:text-[var(--color-red)]`:A.value===e.value.toString()?`wp:text-[var(--p-primary-color)]`:`wp:text-neutral-400`]),"stroke-width":1.8},null,8,[`class`]),(0,t.createElementVNode)(`span`,{class:(0,t.normalizeClass)([`webphone__channel-label wp:text-[12px] wp:leading-none ibrand`,j(e.value)?`wp:text-[var(--color-red)]`:A.value===e.value.toString()?`wp:text-[var(--p-primary-color)]`:`wp:text-neutral-500 wp:dark:text-neutral-400`])},(0,t.toDisplayString)(e.label),3)],10,If)),64))]),(0,t.createVNode)((0,t.unref)(Qu),null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(Xu),null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)($u),{"as-child":``},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(Q),{variant:`ghost`,size:`icon`,class:`wp:h-8 wp:w-8 wp:rounded-full`,onClick:n[0]||=e=>f.value=!0},{default:(0,t.withCtx)(()=>[(0,t.createVNode)((0,t.unref)(pu),{class:`wp:w-4 wp:h-4 wp:text-[var(--color-settings)]`})]),_:1})]),_:1}),(0,t.createVNode)((0,t.unref)(Zu),{class:`wp:flex wp:items-center wp:gap-2`},{default:(0,t.withCtx)(()=>[n[12]||=(0,t.createElementVNode)(`span`,null,`Configuración`,-1),(0,t.createVNode)((0,t.unref)(Lu),null,{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)((0,t.unref)(y))+`,`,1)]),_:1})]),_:1})]),_:1})]),_:1})])])),(0,t.createElementVNode)(`div`,Lf,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(o.channels,e=>(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createBlock)(yd,{key:e.id,"channel-id":e.id,"allow-input":!b.value,"is-web-call":b.value,contacts:r.contacts,user:r.extension},null,8,[`channel-id`,`allow-input`,`is-web-call`,`contacts`,`user`])),[[t.vShow,e.id===o.activeChannelId]])),128))]),(0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`webphone__keypad wp:transition-all wp:duration-300 wp:ease-in-out wp:overflow-hidden`,o.isKeypadVisible&&o.callStatus===`idle`?`wp:max-h-[300px] wp:opacity-100 wp:pb-0`:`wp:max-h-0 wp:opacity-0 wp:pb-0`]),"data-visible":o.isKeypadVisible&&o.callStatus===`idle`?`true`:`false`},[(0,t.createVNode)(Gl)],10,Rf),(0,t.createVNode)(Fu,{class:`webphone__actions`,destination:b.value?r.to:void 0,"is-video":r.mode===`video`,onTransfer:n[1]||=e=>m.value=!0,onCompleteTransfer:D,onCancelTransfer:te},null,8,[`destination`,`is-video`])]),b.value?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,zf,[...n[13]||=[(0,t.createElementVNode)(`div`,{class:`webphone__footer-label wp:text-[10px] wp:text-primary`},`Powered By`,-1),(0,t.createElementVNode)(`div`,{class:`webphone__footer-content wp:flex wp:items-center wp:gap-2`},[(0,t.createElementVNode)(`a`,{href:`https://www.nebula123.com`,target:`_blank`,class:`webphone__footer-link wp:text-[10px] wp:text-primary wp:hover:underline`},` www.nebula123.com `)],-1)]])):(0,t.createCommentVNode)(``,!0)],12,kf),(0,t.createVNode)(tf,{visible:f.value,"onUpdate:visible":n[2]||=e=>f.value=e},null,8,[`visible`]),(0,t.createVNode)(_f,{visible:p.value,"onUpdate:visible":n[3]||=e=>p.value=e,contacts:r.contacts,onCall:n[4]||=e=>{o.keypadValue=e,(0,t.unref)(s).makeCall(e)}},null,8,[`visible`,`contacts`]),(0,t.createVNode)(Df,{visible:m.value,"onUpdate:visible":n[5]||=e=>m.value=e,contacts:r.contacts,onTransfer:ee},null,8,[`visible`,`contacts`]),(0,t.createVNode)(Of,{ref_key:`documentPipRef`,ref:T,active:E.value,"onUpdate:active":n[6]||=e=>E.value=e,"is-connected":o.isConnected,"remote-number":o.remoteNumber,"has-video":w.value??!1,"remote-stream":(0,t.unref)(u),"local-stream":(0,t.unref)(d),destination:b.value?r.to:void 0,"is-video":r.mode===`video`,"call-status":o.callStatus,"is-muted":o.isMuted,"is-held":o.isHeld,onTransfer:n[7]||=e=>m.value=!0,onHangup:n[8]||=e=>(0,t.unref)(s).hangupCall(),onAnswer:n[9]||=e=>(0,t.unref)(s).answerCall(e),onToggleMute:n[10]||=e=>(0,t.unref)(s).toggleMute(),onToggleHold:n[11]||=e=>(0,t.unref)(s).toggleHold()},null,8,[`active`,`is-connected`,`remote-number`,`has-video`,`remote-stream`,`local-stream`,`destination`,`is-video`,`call-status`,`is-muted`,`is-held`])],64))}}),[[`__scopeId`,`data-v-94b7d1be`]])});