authhero 0.200.0 → 0.201.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/authhero.cjs CHANGED
@@ -2,9 +2,9 @@
2
2
  * @license bcrypt.js (c) 2013 Daniel Wirtz <dcode@dcode.io>
3
3
  * Released under the Apache License, Version 2.0
4
4
  * see: https://github.com/dcodeIO/bcrypt.js for details
5
- */(function(e,n){typeof dv=="function"&&t&&t.exports?t.exports=n():(e.dcodeIO=e.dcodeIO||{}).bcrypt=n()})(Br,function(){var e={},n=null;function r(P){if(t&&t.exports)try{return Ec.randomBytes(P)}catch{}try{var L;return(self.crypto||self.msCrypto).getRandomValues(L=new Uint32Array(P)),Array.prototype.slice.call(L)}catch{}if(!n)throw Error("Neither WebCryptoAPI nor a crypto module is available. Use bcrypt.setRandomFallback to set an alternative");return n(P)}var i=!1;try{r(1),i=!0}catch{}n=null,e.setRandomFallback=function(P){n=P},e.genSaltSync=function(P,L){if(P=P||N,typeof P!="number")throw Error("Illegal arguments: "+typeof P+", "+typeof L);P<4?P=4:P>31&&(P=31);var R=[];return R.push("$2a$"),P<10&&R.push("0"),R.push(P.toString()),R.push("$"),R.push(h(r($),$)),R.join("")},e.genSalt=function(P,L,R){if(typeof L=="function"&&(R=L,L=void 0),typeof P=="function"&&(R=P,P=void 0),typeof P>"u")P=N;else if(typeof P!="number")throw Error("illegal arguments: "+typeof P);function k(S){a(function(){try{S(null,e.genSaltSync(P))}catch(j){S(j)}})}if(R){if(typeof R!="function")throw Error("Illegal callback: "+typeof R);k(R)}else return new Promise(function(S,j){k(function(V,de){if(V){j(V);return}S(de)})})},e.hashSync=function(P,L){if(typeof L>"u"&&(L=N),typeof L=="number"&&(L=e.genSaltSync(L)),typeof P!="string"||typeof L!="string")throw Error("Illegal arguments: "+typeof P+", "+typeof L);return Ce(P,L)},e.hash=function(P,L,R,k){function S(j){typeof P=="string"&&typeof L=="number"?e.genSalt(L,function(V,de){Ce(P,de,j,k)}):typeof P=="string"&&typeof L=="string"?Ce(P,L,j,k):a(j.bind(this,Error("Illegal arguments: "+typeof P+", "+typeof L)))}if(R){if(typeof R!="function")throw Error("Illegal callback: "+typeof R);S(R)}else return new Promise(function(j,V){S(function(de,re){if(de){V(de);return}j(re)})})};function o(P,L){for(var R=0,k=0,S=0,j=P.length;S<j;++S)P.charCodeAt(S)===L.charCodeAt(S)?++R:++k;return R<0?!1:k===0}e.compareSync=function(P,L){if(typeof P!="string"||typeof L!="string")throw Error("Illegal arguments: "+typeof P+", "+typeof L);return L.length!==60?!1:o(e.hashSync(P,L.substr(0,L.length-31)),L)},e.compare=function(P,L,R,k){function S(j){if(typeof P!="string"||typeof L!="string"){a(j.bind(this,Error("Illegal arguments: "+typeof P+", "+typeof L)));return}if(L.length!==60){a(j.bind(this,null,!1));return}e.hash(P,L.substr(0,29),function(V,de){V?j(V):j(null,o(de,L))},k)}if(R){if(typeof R!="function")throw Error("Illegal callback: "+typeof R);S(R)}else return new Promise(function(j,V){S(function(de,re){if(de){V(de);return}j(re)})})},e.getRounds=function(P){if(typeof P!="string")throw Error("Illegal arguments: "+typeof P);return parseInt(P.split("$")[2],10)},e.getSalt=function(P){if(typeof P!="string")throw Error("Illegal arguments: "+typeof P);if(P.length!==60)throw Error("Illegal hash length: "+P.length+" != 60");return P.substring(0,29)};var a=typeof process<"u"&&process&&typeof process.nextTick=="function"?typeof setImmediate=="function"?setImmediate:process.nextTick:setTimeout;function l(P){var L=[],R=0;return A.encodeUTF16toUTF8(function(){return R>=P.length?null:P.charCodeAt(R++)},function(k){L.push(k)}),L}var u="./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),d=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,54,55,56,57,58,59,60,61,62,63,-1,-1,-1,-1,-1,-1,-1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,-1,-1,-1,-1,-1,-1,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,-1,-1,-1,-1,-1],p=String.fromCharCode;function h(P,L){var R=0,k=[],S,j;if(L<=0||L>P.length)throw Error("Illegal len: "+L);for(;R<L;){if(S=P[R++]&255,k.push(u[S>>2&63]),S=(S&3)<<4,R>=L){k.push(u[S&63]);break}if(j=P[R++]&255,S|=j>>4&15,k.push(u[S&63]),S=(j&15)<<2,R>=L){k.push(u[S&63]);break}j=P[R++]&255,S|=j>>6&3,k.push(u[S&63]),k.push(u[j&63])}return k.join("")}function g(P,L){var R=0,k=P.length,S=0,j=[],V,de,re,ve,Se,Z;if(L<=0)throw Error("Illegal len: "+L);for(;R<k-1&&S<L&&(Z=P.charCodeAt(R++),V=Z<d.length?d[Z]:-1,Z=P.charCodeAt(R++),de=Z<d.length?d[Z]:-1,!(V==-1||de==-1||(Se=V<<2>>>0,Se|=(de&48)>>4,j.push(p(Se)),++S>=L||R>=k)||(Z=P.charCodeAt(R++),re=Z<d.length?d[Z]:-1,re==-1)||(Se=(de&15)<<4>>>0,Se|=(re&60)>>2,j.push(p(Se)),++S>=L||R>=k)));)Z=P.charCodeAt(R++),ve=Z<d.length?d[Z]:-1,Se=(re&3)<<6>>>0,Se|=ve,j.push(p(Se)),++S;var ye=[];for(R=0;R<S;R++)ye.push(j[R].charCodeAt(0));return ye}var A=function(){var P={};return P.MAX_CODEPOINT=1114111,P.encodeUTF8=function(L,R){var k=null;for(typeof L=="number"&&(k=L,L=function(){return null});k!==null||(k=L())!==null;)k<128?R(k&127):k<2048?(R(k>>6&31|192),R(k&63|128)):k<65536?(R(k>>12&15|224),R(k>>6&63|128),R(k&63|128)):(R(k>>18&7|240),R(k>>12&63|128),R(k>>6&63|128),R(k&63|128)),k=null},P.decodeUTF8=function(L,R){for(var k,S,j,V,de=function(re){re=re.slice(0,re.indexOf(null));var ve=Error(re.toString());throw ve.name="TruncatedError",ve.bytes=re,ve};(k=L())!==null;)if(!(k&128))R(k);else if((k&224)===192)(S=L())===null&&de([k,S]),R((k&31)<<6|S&63);else if((k&240)===224)((S=L())===null||(j=L())===null)&&de([k,S,j]),R((k&15)<<12|(S&63)<<6|j&63);else if((k&248)===240)((S=L())===null||(j=L())===null||(V=L())===null)&&de([k,S,j,V]),R((k&7)<<18|(S&63)<<12|(j&63)<<6|V&63);else throw RangeError("Illegal starting byte: "+k)},P.UTF16toUTF8=function(L,R){for(var k,S=null;(k=S!==null?S:L())!==null;){if(k>=55296&&k<=57343&&(S=L())!==null&&S>=56320&&S<=57343){R((k-55296)*1024+S-56320+65536),S=null;continue}R(k)}S!==null&&R(S)},P.UTF8toUTF16=function(L,R){var k=null;for(typeof L=="number"&&(k=L,L=function(){return null});k!==null||(k=L())!==null;)k<=65535?R(k):(k-=65536,R((k>>10)+55296),R(k%1024+56320)),k=null},P.encodeUTF16toUTF8=function(L,R){P.UTF16toUTF8(L,function(k){P.encodeUTF8(k,R)})},P.decodeUTF8toUTF16=function(L,R){P.decodeUTF8(L,function(k){P.UTF8toUTF16(k,R)})},P.calculateCodePoint=function(L){return L<128?1:L<2048?2:L<65536?3:4},P.calculateUTF8=function(L){for(var R,k=0;(R=L())!==null;)k+=P.calculateCodePoint(R);return k},P.calculateUTF16asUTF8=function(L){var R=0,k=0;return P.UTF16toUTF8(L,function(S){++R,k+=P.calculateCodePoint(S)}),[R,k]},P}();Date.now=Date.now||function(){return+new Date};var $=16,N=10,D=16,O=100,x=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],M=[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946,1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055,3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504,976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462],G=[1332899944,1700884034,1701343084,1684370003,1668446532,1869963892];function F(P,L,R,k){var S,j=P[L],V=P[L+1];return j^=R[0],S=k[j>>>24],S+=k[256|j>>16&255],S^=k[512|j>>8&255],S+=k[768|j&255],V^=S^R[1],S=k[V>>>24],S+=k[256|V>>16&255],S^=k[512|V>>8&255],S+=k[768|V&255],j^=S^R[2],S=k[j>>>24],S+=k[256|j>>16&255],S^=k[512|j>>8&255],S+=k[768|j&255],V^=S^R[3],S=k[V>>>24],S+=k[256|V>>16&255],S^=k[512|V>>8&255],S+=k[768|V&255],j^=S^R[4],S=k[j>>>24],S+=k[256|j>>16&255],S^=k[512|j>>8&255],S+=k[768|j&255],V^=S^R[5],S=k[V>>>24],S+=k[256|V>>16&255],S^=k[512|V>>8&255],S+=k[768|V&255],j^=S^R[6],S=k[j>>>24],S+=k[256|j>>16&255],S^=k[512|j>>8&255],S+=k[768|j&255],V^=S^R[7],S=k[V>>>24],S+=k[256|V>>16&255],S^=k[512|V>>8&255],S+=k[768|V&255],j^=S^R[8],S=k[j>>>24],S+=k[256|j>>16&255],S^=k[512|j>>8&255],S+=k[768|j&255],V^=S^R[9],S=k[V>>>24],S+=k[256|V>>16&255],S^=k[512|V>>8&255],S+=k[768|V&255],j^=S^R[10],S=k[j>>>24],S+=k[256|j>>16&255],S^=k[512|j>>8&255],S+=k[768|j&255],V^=S^R[11],S=k[V>>>24],S+=k[256|V>>16&255],S^=k[512|V>>8&255],S+=k[768|V&255],j^=S^R[12],S=k[j>>>24],S+=k[256|j>>16&255],S^=k[512|j>>8&255],S+=k[768|j&255],V^=S^R[13],S=k[V>>>24],S+=k[256|V>>16&255],S^=k[512|V>>8&255],S+=k[768|V&255],j^=S^R[14],S=k[j>>>24],S+=k[256|j>>16&255],S^=k[512|j>>8&255],S+=k[768|j&255],V^=S^R[15],S=k[V>>>24],S+=k[256|V>>16&255],S^=k[512|V>>8&255],S+=k[768|V&255],j^=S^R[16],P[L]=V^R[D+1],P[L+1]=j,P}function H(P,L){for(var R=0,k=0;R<4;++R)k=k<<8|P[L]&255,L=(L+1)%P.length;return{key:k,offp:L}}function W(P,L,R){for(var k=0,S=[0,0],j=L.length,V=R.length,de,re=0;re<j;re++)de=H(P,k),k=de.offp,L[re]=L[re]^de.key;for(re=0;re<j;re+=2)S=F(S,0,L,R),L[re]=S[0],L[re+1]=S[1];for(re=0;re<V;re+=2)S=F(S,0,L,R),R[re]=S[0],R[re+1]=S[1]}function Y(P,L,R,k){for(var S=0,j=[0,0],V=R.length,de=k.length,re,ve=0;ve<V;ve++)re=H(L,S),S=re.offp,R[ve]=R[ve]^re.key;for(S=0,ve=0;ve<V;ve+=2)re=H(P,S),S=re.offp,j[0]^=re.key,re=H(P,S),S=re.offp,j[1]^=re.key,j=F(j,0,R,k),R[ve]=j[0],R[ve+1]=j[1];for(ve=0;ve<de;ve+=2)re=H(P,S),S=re.offp,j[0]^=re.key,re=H(P,S),S=re.offp,j[1]^=re.key,j=F(j,0,R,k),k[ve]=j[0],k[ve+1]=j[1]}function ue(P,L,R,k,S){var j=G.slice(),V=j.length,de;if(R<4||R>31)if(de=Error("Illegal number of rounds (4-31): "+R),k){a(k.bind(this,de));return}else throw de;if(L.length!==$)if(de=Error("Illegal salt length: "+L.length+" != "+$),k){a(k.bind(this,de));return}else throw de;R=1<<R>>>0;var re,ve,Se=0,Z;Int32Array?(re=new Int32Array(x),ve=new Int32Array(M)):(re=x.slice(),ve=M.slice()),Y(L,P,re,ve);function ye(){if(S&&S(Se/R),Se<R)for(var Be=Date.now();Se<R&&(Se=Se+1,W(P,re,ve),W(L,re,ve),!(Date.now()-Be>O)););else{for(Se=0;Se<64;Se++)for(Z=0;Z<V>>1;Z++)F(j,Z<<1,re,ve);var Ge=[];for(Se=0;Se<V;Se++)Ge.push((j[Se]>>24&255)>>>0),Ge.push((j[Se]>>16&255)>>>0),Ge.push((j[Se]>>8&255)>>>0),Ge.push((j[Se]&255)>>>0);if(k){k(null,Ge);return}else return Ge}k&&a(ye)}if(typeof k<"u")ye();else for(var Bn;;)if(typeof(Bn=ye())<"u")return Bn||[]}function Ce(P,L,R,k){var S;if(typeof P!="string"||typeof L!="string")if(S=Error("Invalid string / salt: Not a string"),R){a(R.bind(this,S));return}else throw S;var j,V;if(L.charAt(0)!=="$"||L.charAt(1)!=="2")if(S=Error("Invalid salt version: "+L.substring(0,2)),R){a(R.bind(this,S));return}else throw S;if(L.charAt(2)==="$")j="\0",V=3;else{if(j=L.charAt(2),j!=="a"&&j!=="b"&&j!=="y"||L.charAt(3)!=="$")if(S=Error("Invalid salt revision: "+L.substring(2,4)),R){a(R.bind(this,S));return}else throw S;V=4}if(L.charAt(V+2)>"$")if(S=Error("Missing salt rounds"),R){a(R.bind(this,S));return}else throw S;var de=parseInt(L.substring(V,V+1),10)*10,re=parseInt(L.substring(V+1,V+2),10),ve=de+re,Se=L.substring(V+3,V+25);P+=j>="a"?"\0":"";var Z=l(P),ye=g(Se,$);function Bn(Be){var Ge=[];return Ge.push("$2"),j>="a"&&Ge.push(j),Ge.push("$"),ve<10&&Ge.push("0"),Ge.push(ve.toString()),Ge.push("$"),Ge.push(h(ye,ye.length)),Ge.push(h(Be,G.length*4-1)),Ge.join("")}if(typeof R>"u")return Bn(ue(Z,ye,ve));ue(Z,ye,ve,function(Be,Ge){Be?R(Be,null):R(null,Bn(Ge))},k)}return e.encodeBase64=h,e.decodeBase64=g,e})})(f_);var hv=f_.exports;const ts=p_(hv),gv="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let mv=t=>crypto.getRandomValues(new Uint8Array(t)),_v=(t,e,n)=>{let r=(2<<Math.log2(t.length-1))-1,i=-~(1.6*r*e/t.length);return(o=e)=>{let a="";for(;;){let l=n(i),u=i;for(;u--;)if(a+=t[l[u]&r]||"",a.length===o)return a}}},yv=(t,e=21)=>_v(t,e,mv),Ve=(t=21)=>{let e="",n=crypto.getRandomValues(new Uint8Array(t));for(;t--;)e+=gv[n[t]&63];return e};const wv=24;function Sc(){return yv("0123456789abcdef",wv)()}function dh(t){if(!t.includes("|"))return console.error("Invalid user_id format"),t;const[,e]=t.split("|");return e}function vv(t){return async(e,n)=>{if(!n.email||!n.email_verified)return t.users.create(e,n);const r=await Ep({userAdapter:t.users,tenant_id:e,email:n.email});return r?(await t.users.create(e,{...n,linked_to:r.user_id}),r):t.users.create(e,n)}}function Me(t,e){return{type:e.type,description:e.description||"",ip:t.var.ip,user_agent:t.var.useragent||"",auth0_client:t.var.auth0_client,date:new Date().toISOString(),details:{request:{method:t.req.method,path:t.req.path,qs:t.req.queries(),body:e.body||t.var.body||""}},isMobile:!1,client_id:t.var.client_id,client_name:"",user_id:e.userId||t.var.user_id||"",hostname:t.req.header("host")||"",user_name:t.var.username||"",connection_id:"",connection:t.var.connection||"",strategy:e.strategy||"",strategy_type:e.strategy_type||"",audience:"",scope:[]}}class _p{constructor(e,n){be(this,"value");be(this,"unit");this.value=e,this.unit=n}milliseconds(){return this.unit==="ms"?this.value:this.unit==="s"?this.value*1e3:this.unit==="m"?this.value*1e3*60:this.unit==="h"?this.value*1e3*60*60:this.unit==="d"?this.value*1e3*60*60*24:this.value*1e3*60*60*24*7}seconds(){return this.milliseconds()/1e3}transform(e){return new _p(Math.round(this.milliseconds()*e),"ms")}}class bv{constructor(e){be(this,"hash");this.hash=e}async verify(e,n,r){const i=await crypto.subtle.importKey("spki",e,{name:"RSASSA-PKCS1-v1_5",hash:this.hash},!1,["verify"]);return await crypto.subtle.verify("RSASSA-PKCS1-v1_5",i,n,r)}async sign(e,n){const r=await crypto.subtle.importKey("pkcs8",e,{name:"RSASSA-PKCS1-v1_5",hash:this.hash},!1,["sign"]);return await crypto.subtle.sign("RSASSA-PKCS1-v1_5",r,n)}async generateKeyPair(e){const n=await crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",hash:this.hash,modulusLength:e??2048,publicExponent:new Uint8Array([1,0,1])},!0,["sign"]),r=await crypto.subtle.exportKey("pkcs8",n.privateKey),i=await crypto.subtle.exportKey("spki",n.publicKey);return{privateKey:r,publicKey:i}}}async function h_(t){return await crypto.subtle.digest("SHA-256",t)}const ph="0123456789abcdef";function $u(t){const e=new Uint8Array(t);let n="";for(let r=0;r<e.length;r++){const i=e[r]>>4;n+=ph[i];const o=e[r]&15;n+=ph[o]}return n}class g_{constructor(e,n){be(this,"alphabet");be(this,"padding");be(this,"decodeMap",new Map);if(e.length!==32)throw new Error("Invalid alphabet");if(this.alphabet=e,this.padding=(n==null?void 0:n.padding)??"=",this.alphabet.includes(this.padding)||this.padding.length!==1)throw new Error("Invalid padding");for(let r=0;r<e.length;r++)this.decodeMap.set(e[r],r)}encode(e,n){let r="",i=0,o=0;for(let l=0;l<e.length;l++)for(i=i<<8|e[l],o+=8;o>=5;)o-=5,r+=this.alphabet[i>>o&31];if(o>0&&(r+=this.alphabet[i<<5-o&31]),(n==null?void 0:n.includePadding)??!0){const l=(8-r.length%8)%8;for(let u=0;u<l;u++)r+="="}return r}decode(e,n){const r=(n==null?void 0:n.strict)??!0,i=Math.ceil(e.length/8),o=[];for(let a=0;a<i;a++){let l=0;const u=[];for(let p=0;p<8;p++){const h=e[a*8+p];if(h==="="){if(a+1!==i)throw new Error(`Invalid character: ${h}`);l+=1;continue}if(h===void 0){if(r)throw new Error("Invalid data");l+=1;continue}const g=this.decodeMap.get(h)??null;if(g===null)throw new Error(`Invalid character: ${h}`);u.push(g)}if(l===8||l===7||l===5||l===2)throw new Error("Invalid padding");const d=(u[0]<<3)+(u[1]>>2);if(o.push(d),l<6){const p=((u[1]&3)<<6)+(u[2]<<1)+(u[3]>>4);o.push(p)}if(l<4){const p=((u[3]&255)<<4)+(u[4]>>1);o.push(p)}if(l<3){const p=((u[4]&1)<<7)+(u[5]<<2)+(u[6]>>3);o.push(p)}if(l<1){const p=((u[6]&7)<<5)+u[7];o.push(p)}}return Uint8Array.from(o)}}new g_("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567");new g_("0123456789ABCDEFGHIJKLMNOPQRSTUV");class m_{constructor(e,n){be(this,"alphabet");be(this,"padding");be(this,"decodeMap",new Map);if(e.length!==64)throw new Error("Invalid alphabet");if(this.alphabet=e,this.padding=(n==null?void 0:n.padding)??"=",this.alphabet.includes(this.padding)||this.padding.length!==1)throw new Error("Invalid padding");for(let r=0;r<e.length;r++)this.decodeMap.set(e[r],r)}encode(e,n){let r="",i=0,o=0;for(let l=0;l<e.length;l++)for(i=i<<8|e[l],o+=8;o>=6;)o+=-6,r+=this.alphabet[i>>o&63];if(o>0&&(r+=this.alphabet[i<<6-o&63]),(n==null?void 0:n.includePadding)??!0){const l=(4-r.length%4)%4;for(let u=0;u<l;u++)r+="="}return r}decode(e,n){const r=(n==null?void 0:n.strict)??!0,i=Math.ceil(e.length/4),o=[];for(let a=0;a<i;a++){let l=0,u=0;for(let d=0;d<4;d++){const p=e[a*4+d];if(p==="="){if(a+1!==i)throw new Error(`Invalid character: ${p}`);l+=1;continue}if(p===void 0){if(r)throw new Error("Invalid data");l+=1;continue}const h=this.decodeMap.get(p)??null;if(h===null)throw new Error(`Invalid character: ${p}`);u+=h<<6*(3-d)}o.push(u>>16&255),l<2&&o.push(u>>8&255),l<1&&o.push(u&255)}return Uint8Array.from(o)}}const __=new m_("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),Fr=new m_("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_");async function fh(t,e,n,r){const i={alg:t,typ:"JWT",...r==null?void 0:r.headers},o={...n};(r==null?void 0:r.audiences)!==void 0&&(o.aud=r.audiences),(r==null?void 0:r.subject)!==void 0&&(o.sub=r.subject),(r==null?void 0:r.issuer)!==void 0&&(o.iss=r.issuer),(r==null?void 0:r.jwtId)!==void 0&&(o.jti=r.jwtId),(r==null?void 0:r.expiresIn)!==void 0&&(o.exp=Math.floor(Date.now()/1e3)+r.expiresIn.seconds()),(r==null?void 0:r.notBefore)!==void 0&&(o.nbf=Math.floor(r.notBefore.getTime()/1e3)),o.iat=Math.floor(Date.now()/1e3);const a=new TextEncoder,l=Fr.encode(a.encode(JSON.stringify(i)),{includePadding:!1}),u=Fr.encode(a.encode(JSON.stringify(o)),{includePadding:!1}),d=a.encode([l,u].join(".")),p=await xv(t).sign(e,d),h=Fr.encode(new Uint8Array(p),{includePadding:!1});return[l,u,h].join(".")}function $v(t){const e=t.split(".");return e.length!==3?null:e}function yp(t){const e=$v(t);if(!e)return null;const n=new TextDecoder,r=Fr.decode(e[0],{strict:!1}),i=Fr.decode(e[1],{strict:!1}),o=JSON.parse(n.decode(r));if(typeof o!="object"||o===null||!("alg"in o)||!Av(o.alg)||"typ"in o&&o.typ!=="JWT")return null;const a=JSON.parse(n.decode(i));if(typeof a!="object"||a===null)return null;const l={algorithm:o.alg,expiresAt:null,subject:null,issuedAt:null,issuer:null,jwtId:null,audiences:null,notBefore:null};if("exp"in a){if(typeof a.exp!="number")return null;l.expiresAt=new Date(a.exp*1e3)}if("iss"in a){if(typeof a.iss!="string")return null;l.issuer=a.iss}if("sub"in a){if(typeof a.sub!="string")return null;l.subject=a.sub}if("aud"in a)if(Array.isArray(a.aud)){for(const u of a.aud)if(typeof u!="string")return null;l.audiences=a.aud}else{if(typeof a.aud!="string")return null;l.audiences=[a.aud]}if("nbf"in a){if(typeof a.nbf!="number")return null;l.notBefore=new Date(a.nbf*1e3)}if("iat"in a){if(typeof a.iat!="number")return null;l.issuedAt=new Date(a.iat*1e3)}if("jti"in a){if(typeof a.jti!="string")return null;l.jwtId=a.jti}return{value:t,header:{...o,typ:"JWT",alg:o.alg},payload:{...a},parts:e,...l}}function xv(t){return new bv(Ev[t])}function Av(t){return typeof t!="string"?!1:["HS256","HS384","HS512","RS256","RS384","RS512","ES256","ES384","ES512","PS256","PS384","PS512"].includes(t)}const Ev={RS256:"SHA-256",RS384:"SHA-384",RS512:"SHA-512"};function Sv(){const t=new Uint8Array(32);return crypto.getRandomValues(t),Fr.encode(t,{includePadding:!1})}function kv(t){try{const n=/-----BEGIN (?:RSA )?(?:PRIVATE|PUBLIC) KEY-----([^-]*)-----END (?:RSA )?(?:PRIVATE|PUBLIC) KEY-----/.exec(t);if(!n||!n[1])throw new Error("Invalid PEM format");return Uint8Array.from(atob(n[1].replace(/\s/g,"")),r=>r.charCodeAt(0)).buffer}finally{t=t.replace(/./g,"\0")}}async function Nv(t,e){if(e==="plain")return t;const n=new TextEncoder().encode(t),r=await h_(n);return Fr.encode(new Uint8Array(r),{includePadding:!1})}const js=60*5,kc=30*24*60*60,qr=24*60*60,Cv="auth-token",ea=30*60*1e3,xu=7*24*60*60*1e3,Tv=5*60,Iv=5*60,Ov=30*60*1e3,zv=30*60*1e3,Dv=24*60*60*1e3;function y_(t,e,n){const r=[];return r.push([encodeURIComponent(t),encodeURIComponent(e)]),(n==null?void 0:n.domain)!==void 0&&r.push(["Domain",n.domain]),(n==null?void 0:n.expires)!==void 0&&r.push(["Expires",n.expires.toUTCString()]),n!=null&&n.httpOnly&&r.push(["HttpOnly"]),(n==null?void 0:n.maxAge)!==void 0&&r.push(["Max-Age",n.maxAge.toString()]),(n==null?void 0:n.path)!==void 0&&r.push(["Path",n.path]),(n==null?void 0:n.sameSite)==="lax"&&r.push(["SameSite","Lax"]),(n==null?void 0:n.sameSite)==="none"&&r.push(["SameSite","None"]),(n==null?void 0:n.sameSite)==="strict"&&r.push(["SameSite","Strict"]),n!=null&&n.secure&&r.push(["Secure"]),r.map(i=>i.join("=")).join("; ")}function Rv(t){const e=new Map,n=t.split("; ");for(const r of n){const i=r.split("="),o=i[0],a=i[1]??"";o&&e.set(decodeURIComponent(o),decodeURIComponent(a))}return e}function wp(t){return`${t}-${Cv}`}function w_(t){if(!t)return;const[e]=t.split(":");if(!e||e==="localhost"||/^(\d{1,3}\.){3}\d{1,3}$/.test(e))return;const n=e.split(".");return n.length>2?`.${n.slice(-2).join(".")}`:`.${e}`}function Tn(t,e){return e?Rv(e).get(wp(t)):void 0}function Pv(t,e){return y_(wp(t),"",{path:"/",httpOnly:!0,secure:!0,maxAge:0,sameSite:"none",domain:e?w_(e):void 0})}function ka(t,e,n){return y_(wp(t),e,{path:"/",httpOnly:!0,secure:!0,maxAge:kc,sameSite:"none",domain:n?w_(n):void 0})}var vp={},Nc={};(function(t){const e=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",n=e+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",r="["+e+"]["+n+"]*",i=new RegExp("^"+r+"$"),o=function(l,u){const d=[];let p=u.exec(l);for(;p;){const h=[];h.startIndex=u.lastIndex-p[0].length;const g=p.length;for(let A=0;A<g;A++)h.push(p[A]);d.push(h),p=u.exec(l)}return d},a=function(l){const u=i.exec(l);return!(u===null||typeof u>"u")};t.isExist=function(l){return typeof l<"u"},t.isEmptyObject=function(l){return Object.keys(l).length===0},t.merge=function(l,u,d){if(u){const p=Object.keys(u),h=p.length;for(let g=0;g<h;g++)d==="strict"?l[p[g]]=[u[p[g]]]:l[p[g]]=u[p[g]]}},t.getValue=function(l){return t.isExist(l)?l:""},t.isName=a,t.getAllMatches=o,t.nameRegexp=r})(Nc);const bp=Nc,Bv={allowBooleanAttributes:!1,unpairedTags:[]};vp.validate=function(t,e){e=Object.assign({},Bv,e);const n=[];let r=!1,i=!1;t[0]==="\uFEFF"&&(t=t.substr(1));for(let o=0;o<t.length;o++)if(t[o]==="<"&&t[o+1]==="?"){if(o+=2,o=gh(t,o),o.err)return o}else if(t[o]==="<"){let a=o;if(o++,t[o]==="!"){o=mh(t,o);continue}else{let l=!1;t[o]==="/"&&(l=!0,o++);let u="";for(;o<t.length&&t[o]!==">"&&t[o]!==" "&&t[o]!==" "&&t[o]!==`
6
- `&&t[o]!=="\r";o++)u+=t[o];if(u=u.trim(),u[u.length-1]==="/"&&(u=u.substring(0,u.length-1),o--),!Hv(u)){let h;return u.trim().length===0?h="Invalid space after '<'.":h="Tag '"+u+"' is an invalid name.",Je("InvalidTag",h,_t(t,o))}const d=Fv(t,o);if(d===!1)return Je("InvalidAttr","Attributes for '"+u+"' have open quote.",_t(t,o));let p=d.value;if(o=d.index,p[p.length-1]==="/"){const h=o-p.length;p=p.substring(0,p.length-1);const g=_h(p,e);if(g===!0)r=!0;else return Je(g.err.code,g.err.msg,_t(t,h+g.err.line))}else if(l)if(d.tagClosed){if(p.trim().length>0)return Je("InvalidTag","Closing tag '"+u+"' can't have attributes or invalid starting.",_t(t,a));if(n.length===0)return Je("InvalidTag","Closing tag '"+u+"' has not been opened.",_t(t,a));{const h=n.pop();if(u!==h.tagName){let g=_t(t,h.tagStartPos);return Je("InvalidTag","Expected closing tag '"+h.tagName+"' (opened in line "+g.line+", col "+g.col+") instead of closing tag '"+u+"'.",_t(t,a))}n.length==0&&(i=!0)}}else return Je("InvalidTag","Closing tag '"+u+"' doesn't have proper closing.",_t(t,o));else{const h=_h(p,e);if(h!==!0)return Je(h.err.code,h.err.msg,_t(t,o-p.length+h.err.line));if(i===!0)return Je("InvalidXml","Multiple possible root nodes found.",_t(t,o));e.unpairedTags.indexOf(u)!==-1||n.push({tagName:u,tagStartPos:a}),r=!0}for(o++;o<t.length;o++)if(t[o]==="<")if(t[o+1]==="!"){o++,o=mh(t,o);continue}else if(t[o+1]==="?"){if(o=gh(t,++o),o.err)return o}else break;else if(t[o]==="&"){const h=qv(t,o);if(h==-1)return Je("InvalidChar","char '&' is not expected.",_t(t,o));o=h}else if(i===!0&&!hh(t[o]))return Je("InvalidXml","Extra text at the end",_t(t,o));t[o]==="<"&&o--}}else{if(hh(t[o]))continue;return Je("InvalidChar","char '"+t[o]+"' is not expected.",_t(t,o))}if(r){if(n.length==1)return Je("InvalidTag","Unclosed tag '"+n[0].tagName+"'.",_t(t,n[0].tagStartPos));if(n.length>0)return Je("InvalidXml","Invalid '"+JSON.stringify(n.map(o=>o.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return Je("InvalidXml","Start tag expected.",1);return!0};function hh(t){return t===" "||t===" "||t===`
7
- `||t==="\r"}function gh(t,e){const n=e;for(;e<t.length;e++)if(t[e]=="?"||t[e]==" "){const r=t.substr(n,e-n);if(e>5&&r==="xml")return Je("InvalidXml","XML declaration allowed only at the start of the document.",_t(t,e));if(t[e]=="?"&&t[e+1]==">"){e++;break}else continue}return e}function mh(t,e){if(t.length>e+5&&t[e+1]==="-"&&t[e+2]==="-"){for(e+=3;e<t.length;e++)if(t[e]==="-"&&t[e+1]==="-"&&t[e+2]===">"){e+=2;break}}else if(t.length>e+8&&t[e+1]==="D"&&t[e+2]==="O"&&t[e+3]==="C"&&t[e+4]==="T"&&t[e+5]==="Y"&&t[e+6]==="P"&&t[e+7]==="E"){let n=1;for(e+=8;e<t.length;e++)if(t[e]==="<")n++;else if(t[e]===">"&&(n--,n===0))break}else if(t.length>e+9&&t[e+1]==="["&&t[e+2]==="C"&&t[e+3]==="D"&&t[e+4]==="A"&&t[e+5]==="T"&&t[e+6]==="A"&&t[e+7]==="["){for(e+=8;e<t.length;e++)if(t[e]==="]"&&t[e+1]==="]"&&t[e+2]===">"){e+=2;break}}return e}const jv='"',Lv="'";function Fv(t,e){let n="",r="",i=!1;for(;e<t.length;e++){if(t[e]===jv||t[e]===Lv)r===""?r=t[e]:r!==t[e]||(r="");else if(t[e]===">"&&r===""){i=!0;break}n+=t[e]}return r!==""?!1:{value:n,index:e,tagClosed:i}}const Uv=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function _h(t,e){const n=bp.getAllMatches(t,Uv),r={};for(let i=0;i<n.length;i++){if(n[i][1].length===0)return Je("InvalidAttr","Attribute '"+n[i][2]+"' has no space in starting.",po(n[i]));if(n[i][3]!==void 0&&n[i][4]===void 0)return Je("InvalidAttr","Attribute '"+n[i][2]+"' is without value.",po(n[i]));if(n[i][3]===void 0&&!e.allowBooleanAttributes)return Je("InvalidAttr","boolean attribute '"+n[i][2]+"' is not allowed.",po(n[i]));const o=n[i][2];if(!Vv(o))return Je("InvalidAttr","Attribute '"+o+"' is an invalid name.",po(n[i]));if(!r.hasOwnProperty(o))r[o]=1;else return Je("InvalidAttr","Attribute '"+o+"' is repeated.",po(n[i]))}return!0}function Mv(t,e){let n=/\d/;for(t[e]==="x"&&(e++,n=/[\da-fA-F]/);e<t.length;e++){if(t[e]===";")return e;if(!t[e].match(n))break}return-1}function qv(t,e){if(e++,t[e]===";")return-1;if(t[e]==="#")return e++,Mv(t,e);let n=0;for(;e<t.length;e++,n++)if(!(t[e].match(/\w/)&&n<20)){if(t[e]===";")break;return-1}return e}function Je(t,e,n){return{err:{code:t,msg:e,line:n.line||n,col:n.col}}}function Vv(t){return bp.isName(t)}function Hv(t){return bp.isName(t)}function _t(t,e){const n=t.substring(0,e).split(/\r?\n/);return{line:n.length,col:n[n.length-1].length+1}}function po(t){return t.startIndex+t[1].length}var $p={};const v_={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(t,e,n){return t}},Kv=function(t){return Object.assign({},v_,t)};$p.buildOptions=Kv;$p.defaultOptions=v_;class Gv{constructor(e){this.tagname=e,this.child=[],this[":@"]={}}add(e,n){e==="__proto__"&&(e="#__proto__"),this.child.push({[e]:n})}addChild(e){e.tagname==="__proto__"&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,":@":e[":@"]}):this.child.push({[e.tagname]:e.child})}}var Wv=Gv;const Xv=Nc;function Jv(t,e){const n={};if(t[e+3]==="O"&&t[e+4]==="C"&&t[e+5]==="T"&&t[e+6]==="Y"&&t[e+7]==="P"&&t[e+8]==="E"){e=e+9;let r=1,i=!1,o=!1,a="";for(;e<t.length;e++)if(t[e]==="<"&&!o){if(i&&Qv(t,e)){e+=7;let l,u;[l,u,e]=Yv(t,e+1),u.indexOf("&")===-1&&(n[rb(l)]={regx:RegExp(`&${l};`,"g"),val:u})}else if(i&&eb(t,e))e+=8;else if(i&&tb(t,e))e+=8;else if(i&&nb(t,e))e+=9;else if(Zv)o=!0;else throw new Error("Invalid DOCTYPE");r++,a=""}else if(t[e]===">"){if(o?t[e-1]==="-"&&t[e-2]==="-"&&(o=!1,r--):r--,r===0)break}else t[e]==="["?i=!0:a+=t[e];if(r!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:n,i:e}}function Yv(t,e){let n="";for(;e<t.length&&t[e]!=="'"&&t[e]!=='"';e++)n+=t[e];if(n=n.trim(),n.indexOf(" ")!==-1)throw new Error("External entites are not supported");const r=t[e++];let i="";for(;e<t.length&&t[e]!==r;e++)i+=t[e];return[n,i,e]}function Zv(t,e){return t[e+1]==="!"&&t[e+2]==="-"&&t[e+3]==="-"}function Qv(t,e){return t[e+1]==="!"&&t[e+2]==="E"&&t[e+3]==="N"&&t[e+4]==="T"&&t[e+5]==="I"&&t[e+6]==="T"&&t[e+7]==="Y"}function eb(t,e){return t[e+1]==="!"&&t[e+2]==="E"&&t[e+3]==="L"&&t[e+4]==="E"&&t[e+5]==="M"&&t[e+6]==="E"&&t[e+7]==="N"&&t[e+8]==="T"}function tb(t,e){return t[e+1]==="!"&&t[e+2]==="A"&&t[e+3]==="T"&&t[e+4]==="T"&&t[e+5]==="L"&&t[e+6]==="I"&&t[e+7]==="S"&&t[e+8]==="T"}function nb(t,e){return t[e+1]==="!"&&t[e+2]==="N"&&t[e+3]==="O"&&t[e+4]==="T"&&t[e+5]==="A"&&t[e+6]==="T"&&t[e+7]==="I"&&t[e+8]==="O"&&t[e+9]==="N"}function rb(t){if(Xv.isName(t))return t;throw new Error(`Invalid entity name ${t}`)}var ib=Jv;const ob=/^[-+]?0x[a-fA-F0-9]+$/,sb=/^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/;!Number.parseInt&&window.parseInt&&(Number.parseInt=window.parseInt);!Number.parseFloat&&window.parseFloat&&(Number.parseFloat=window.parseFloat);const ab={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function cb(t,e={}){if(e=Object.assign({},ab,e),!t||typeof t!="string")return t;let n=t.trim();if(e.skipLike!==void 0&&e.skipLike.test(n))return t;if(e.hex&&ob.test(n))return Number.parseInt(n,16);{const r=sb.exec(n);if(r){const i=r[1],o=r[2];let a=lb(r[3]);const l=r[4]||r[6];if(!e.leadingZeros&&o.length>0&&i&&n[2]!==".")return t;if(!e.leadingZeros&&o.length>0&&!i&&n[1]!==".")return t;{const u=Number(n),d=""+u;return d.search(/[eE]/)!==-1||l?e.eNotation?u:t:n.indexOf(".")!==-1?d==="0"&&a===""||d===a||i&&d==="-"+a?u:t:o?a===d||i+a===d?u:t:n===d||n===i+d?u:t}}else return t}}function lb(t){return t&&t.indexOf(".")!==-1&&(t=t.replace(/0+$/,""),t==="."?t="0":t[0]==="."?t="0"+t:t[t.length-1]==="."&&(t=t.substr(0,t.length-1))),t}var ub=cb;function db(t){return typeof t=="function"?t:Array.isArray(t)?e=>{for(const n of t)if(typeof n=="string"&&e===n||n instanceof RegExp&&n.test(e))return!0}:()=>!1}var b_=db;const $_=Nc,fo=Wv,pb=ib,fb=ub,hb=b_;let gb=class{constructor(e){this.options=e,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(n,r)=>String.fromCharCode(Number.parseInt(r,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(n,r)=>String.fromCharCode(Number.parseInt(r,16))}},this.addExternalEntities=mb,this.parseXml=bb,this.parseTextData=_b,this.resolveNameSpace=yb,this.buildAttributesMap=vb,this.isItStopNode=Eb,this.replaceEntitiesValue=xb,this.readStopNodeData=kb,this.saveTextToParentTag=Ab,this.addChild=$b,this.ignoreAttributesFn=hb(this.options.ignoreAttributes)}};function mb(t){const e=Object.keys(t);for(let n=0;n<e.length;n++){const r=e[n];this.lastEntities[r]={regex:new RegExp("&"+r+";","g"),val:t[r]}}}function _b(t,e,n,r,i,o,a){if(t!==void 0&&(this.options.trimValues&&!r&&(t=t.trim()),t.length>0)){a||(t=this.replaceEntitiesValue(t));const l=this.options.tagValueProcessor(e,t,n,i,o);return l==null?t:typeof l!=typeof t||l!==t?l:this.options.trimValues?Eu(t,this.options.parseTagValue,this.options.numberParseOptions):t.trim()===t?Eu(t,this.options.parseTagValue,this.options.numberParseOptions):t}}function yb(t){if(this.options.removeNSPrefix){const e=t.split(":"),n=t.charAt(0)==="/"?"/":"";if(e[0]==="xmlns")return"";e.length===2&&(t=n+e[1])}return t}const wb=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function vb(t,e,n){if(this.options.ignoreAttributes!==!0&&typeof t=="string"){const r=$_.getAllMatches(t,wb),i=r.length,o={};for(let a=0;a<i;a++){const l=this.resolveNameSpace(r[a][1]);if(this.ignoreAttributesFn(l,e))continue;let u=r[a][4],d=this.options.attributeNamePrefix+l;if(l.length)if(this.options.transformAttributeName&&(d=this.options.transformAttributeName(d)),d==="__proto__"&&(d="#__proto__"),u!==void 0){this.options.trimValues&&(u=u.trim()),u=this.replaceEntitiesValue(u);const p=this.options.attributeValueProcessor(l,u,e);p==null?o[d]=u:typeof p!=typeof u||p!==u?o[d]=p:o[d]=Eu(u,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(o[d]=!0)}if(!Object.keys(o).length)return;if(this.options.attributesGroupName){const a={};return a[this.options.attributesGroupName]=o,a}return o}}const bb=function(t){t=t.replace(/\r\n?/g,`
5
+ */(function(e,n){typeof dv=="function"&&t&&t.exports?t.exports=n():(e.dcodeIO=e.dcodeIO||{}).bcrypt=n()})(Br,function(){var e={},n=null;function r(P){if(t&&t.exports)try{return Ec.randomBytes(P)}catch{}try{var L;return(self.crypto||self.msCrypto).getRandomValues(L=new Uint32Array(P)),Array.prototype.slice.call(L)}catch{}if(!n)throw Error("Neither WebCryptoAPI nor a crypto module is available. Use bcrypt.setRandomFallback to set an alternative");return n(P)}var i=!1;try{r(1),i=!0}catch{}n=null,e.setRandomFallback=function(P){n=P},e.genSaltSync=function(P,L){if(P=P||N,typeof P!="number")throw Error("Illegal arguments: "+typeof P+", "+typeof L);P<4?P=4:P>31&&(P=31);var R=[];return R.push("$2a$"),P<10&&R.push("0"),R.push(P.toString()),R.push("$"),R.push(h(r($),$)),R.join("")},e.genSalt=function(P,L,R){if(typeof L=="function"&&(R=L,L=void 0),typeof P=="function"&&(R=P,P=void 0),typeof P>"u")P=N;else if(typeof P!="number")throw Error("illegal arguments: "+typeof P);function k(S){a(function(){try{S(null,e.genSaltSync(P))}catch(j){S(j)}})}if(R){if(typeof R!="function")throw Error("Illegal callback: "+typeof R);k(R)}else return new Promise(function(S,j){k(function(V,de){if(V){j(V);return}S(de)})})},e.hashSync=function(P,L){if(typeof L>"u"&&(L=N),typeof L=="number"&&(L=e.genSaltSync(L)),typeof P!="string"||typeof L!="string")throw Error("Illegal arguments: "+typeof P+", "+typeof L);return Ce(P,L)},e.hash=function(P,L,R,k){function S(j){typeof P=="string"&&typeof L=="number"?e.genSalt(L,function(V,de){Ce(P,de,j,k)}):typeof P=="string"&&typeof L=="string"?Ce(P,L,j,k):a(j.bind(this,Error("Illegal arguments: "+typeof P+", "+typeof L)))}if(R){if(typeof R!="function")throw Error("Illegal callback: "+typeof R);S(R)}else return new Promise(function(j,V){S(function(de,re){if(de){V(de);return}j(re)})})};function o(P,L){for(var R=0,k=0,S=0,j=P.length;S<j;++S)P.charCodeAt(S)===L.charCodeAt(S)?++R:++k;return R<0?!1:k===0}e.compareSync=function(P,L){if(typeof P!="string"||typeof L!="string")throw Error("Illegal arguments: "+typeof P+", "+typeof L);return L.length!==60?!1:o(e.hashSync(P,L.substr(0,L.length-31)),L)},e.compare=function(P,L,R,k){function S(j){if(typeof P!="string"||typeof L!="string"){a(j.bind(this,Error("Illegal arguments: "+typeof P+", "+typeof L)));return}if(L.length!==60){a(j.bind(this,null,!1));return}e.hash(P,L.substr(0,29),function(V,de){V?j(V):j(null,o(de,L))},k)}if(R){if(typeof R!="function")throw Error("Illegal callback: "+typeof R);S(R)}else return new Promise(function(j,V){S(function(de,re){if(de){V(de);return}j(re)})})},e.getRounds=function(P){if(typeof P!="string")throw Error("Illegal arguments: "+typeof P);return parseInt(P.split("$")[2],10)},e.getSalt=function(P){if(typeof P!="string")throw Error("Illegal arguments: "+typeof P);if(P.length!==60)throw Error("Illegal hash length: "+P.length+" != 60");return P.substring(0,29)};var a=typeof process<"u"&&process&&typeof process.nextTick=="function"?typeof setImmediate=="function"?setImmediate:process.nextTick:setTimeout;function l(P){var L=[],R=0;return A.encodeUTF16toUTF8(function(){return R>=P.length?null:P.charCodeAt(R++)},function(k){L.push(k)}),L}var u="./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),d=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,54,55,56,57,58,59,60,61,62,63,-1,-1,-1,-1,-1,-1,-1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,-1,-1,-1,-1,-1,-1,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,-1,-1,-1,-1,-1],p=String.fromCharCode;function h(P,L){var R=0,k=[],S,j;if(L<=0||L>P.length)throw Error("Illegal len: "+L);for(;R<L;){if(S=P[R++]&255,k.push(u[S>>2&63]),S=(S&3)<<4,R>=L){k.push(u[S&63]);break}if(j=P[R++]&255,S|=j>>4&15,k.push(u[S&63]),S=(j&15)<<2,R>=L){k.push(u[S&63]);break}j=P[R++]&255,S|=j>>6&3,k.push(u[S&63]),k.push(u[j&63])}return k.join("")}function g(P,L){var R=0,k=P.length,S=0,j=[],V,de,re,ve,Se,Z;if(L<=0)throw Error("Illegal len: "+L);for(;R<k-1&&S<L&&(Z=P.charCodeAt(R++),V=Z<d.length?d[Z]:-1,Z=P.charCodeAt(R++),de=Z<d.length?d[Z]:-1,!(V==-1||de==-1||(Se=V<<2>>>0,Se|=(de&48)>>4,j.push(p(Se)),++S>=L||R>=k)||(Z=P.charCodeAt(R++),re=Z<d.length?d[Z]:-1,re==-1)||(Se=(de&15)<<4>>>0,Se|=(re&60)>>2,j.push(p(Se)),++S>=L||R>=k)));)Z=P.charCodeAt(R++),ve=Z<d.length?d[Z]:-1,Se=(re&3)<<6>>>0,Se|=ve,j.push(p(Se)),++S;var ye=[];for(R=0;R<S;R++)ye.push(j[R].charCodeAt(0));return ye}var A=function(){var P={};return P.MAX_CODEPOINT=1114111,P.encodeUTF8=function(L,R){var k=null;for(typeof L=="number"&&(k=L,L=function(){return null});k!==null||(k=L())!==null;)k<128?R(k&127):k<2048?(R(k>>6&31|192),R(k&63|128)):k<65536?(R(k>>12&15|224),R(k>>6&63|128),R(k&63|128)):(R(k>>18&7|240),R(k>>12&63|128),R(k>>6&63|128),R(k&63|128)),k=null},P.decodeUTF8=function(L,R){for(var k,S,j,V,de=function(re){re=re.slice(0,re.indexOf(null));var ve=Error(re.toString());throw ve.name="TruncatedError",ve.bytes=re,ve};(k=L())!==null;)if(!(k&128))R(k);else if((k&224)===192)(S=L())===null&&de([k,S]),R((k&31)<<6|S&63);else if((k&240)===224)((S=L())===null||(j=L())===null)&&de([k,S,j]),R((k&15)<<12|(S&63)<<6|j&63);else if((k&248)===240)((S=L())===null||(j=L())===null||(V=L())===null)&&de([k,S,j,V]),R((k&7)<<18|(S&63)<<12|(j&63)<<6|V&63);else throw RangeError("Illegal starting byte: "+k)},P.UTF16toUTF8=function(L,R){for(var k,S=null;(k=S!==null?S:L())!==null;){if(k>=55296&&k<=57343&&(S=L())!==null&&S>=56320&&S<=57343){R((k-55296)*1024+S-56320+65536),S=null;continue}R(k)}S!==null&&R(S)},P.UTF8toUTF16=function(L,R){var k=null;for(typeof L=="number"&&(k=L,L=function(){return null});k!==null||(k=L())!==null;)k<=65535?R(k):(k-=65536,R((k>>10)+55296),R(k%1024+56320)),k=null},P.encodeUTF16toUTF8=function(L,R){P.UTF16toUTF8(L,function(k){P.encodeUTF8(k,R)})},P.decodeUTF8toUTF16=function(L,R){P.decodeUTF8(L,function(k){P.UTF8toUTF16(k,R)})},P.calculateCodePoint=function(L){return L<128?1:L<2048?2:L<65536?3:4},P.calculateUTF8=function(L){for(var R,k=0;(R=L())!==null;)k+=P.calculateCodePoint(R);return k},P.calculateUTF16asUTF8=function(L){var R=0,k=0;return P.UTF16toUTF8(L,function(S){++R,k+=P.calculateCodePoint(S)}),[R,k]},P}();Date.now=Date.now||function(){return+new Date};var $=16,N=10,D=16,O=100,x=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],M=[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946,1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055,3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504,976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462],G=[1332899944,1700884034,1701343084,1684370003,1668446532,1869963892];function F(P,L,R,k){var S,j=P[L],V=P[L+1];return j^=R[0],S=k[j>>>24],S+=k[256|j>>16&255],S^=k[512|j>>8&255],S+=k[768|j&255],V^=S^R[1],S=k[V>>>24],S+=k[256|V>>16&255],S^=k[512|V>>8&255],S+=k[768|V&255],j^=S^R[2],S=k[j>>>24],S+=k[256|j>>16&255],S^=k[512|j>>8&255],S+=k[768|j&255],V^=S^R[3],S=k[V>>>24],S+=k[256|V>>16&255],S^=k[512|V>>8&255],S+=k[768|V&255],j^=S^R[4],S=k[j>>>24],S+=k[256|j>>16&255],S^=k[512|j>>8&255],S+=k[768|j&255],V^=S^R[5],S=k[V>>>24],S+=k[256|V>>16&255],S^=k[512|V>>8&255],S+=k[768|V&255],j^=S^R[6],S=k[j>>>24],S+=k[256|j>>16&255],S^=k[512|j>>8&255],S+=k[768|j&255],V^=S^R[7],S=k[V>>>24],S+=k[256|V>>16&255],S^=k[512|V>>8&255],S+=k[768|V&255],j^=S^R[8],S=k[j>>>24],S+=k[256|j>>16&255],S^=k[512|j>>8&255],S+=k[768|j&255],V^=S^R[9],S=k[V>>>24],S+=k[256|V>>16&255],S^=k[512|V>>8&255],S+=k[768|V&255],j^=S^R[10],S=k[j>>>24],S+=k[256|j>>16&255],S^=k[512|j>>8&255],S+=k[768|j&255],V^=S^R[11],S=k[V>>>24],S+=k[256|V>>16&255],S^=k[512|V>>8&255],S+=k[768|V&255],j^=S^R[12],S=k[j>>>24],S+=k[256|j>>16&255],S^=k[512|j>>8&255],S+=k[768|j&255],V^=S^R[13],S=k[V>>>24],S+=k[256|V>>16&255],S^=k[512|V>>8&255],S+=k[768|V&255],j^=S^R[14],S=k[j>>>24],S+=k[256|j>>16&255],S^=k[512|j>>8&255],S+=k[768|j&255],V^=S^R[15],S=k[V>>>24],S+=k[256|V>>16&255],S^=k[512|V>>8&255],S+=k[768|V&255],j^=S^R[16],P[L]=V^R[D+1],P[L+1]=j,P}function H(P,L){for(var R=0,k=0;R<4;++R)k=k<<8|P[L]&255,L=(L+1)%P.length;return{key:k,offp:L}}function W(P,L,R){for(var k=0,S=[0,0],j=L.length,V=R.length,de,re=0;re<j;re++)de=H(P,k),k=de.offp,L[re]=L[re]^de.key;for(re=0;re<j;re+=2)S=F(S,0,L,R),L[re]=S[0],L[re+1]=S[1];for(re=0;re<V;re+=2)S=F(S,0,L,R),R[re]=S[0],R[re+1]=S[1]}function Y(P,L,R,k){for(var S=0,j=[0,0],V=R.length,de=k.length,re,ve=0;ve<V;ve++)re=H(L,S),S=re.offp,R[ve]=R[ve]^re.key;for(S=0,ve=0;ve<V;ve+=2)re=H(P,S),S=re.offp,j[0]^=re.key,re=H(P,S),S=re.offp,j[1]^=re.key,j=F(j,0,R,k),R[ve]=j[0],R[ve+1]=j[1];for(ve=0;ve<de;ve+=2)re=H(P,S),S=re.offp,j[0]^=re.key,re=H(P,S),S=re.offp,j[1]^=re.key,j=F(j,0,R,k),k[ve]=j[0],k[ve+1]=j[1]}function ue(P,L,R,k,S){var j=G.slice(),V=j.length,de;if(R<4||R>31)if(de=Error("Illegal number of rounds (4-31): "+R),k){a(k.bind(this,de));return}else throw de;if(L.length!==$)if(de=Error("Illegal salt length: "+L.length+" != "+$),k){a(k.bind(this,de));return}else throw de;R=1<<R>>>0;var re,ve,Se=0,Z;Int32Array?(re=new Int32Array(x),ve=new Int32Array(M)):(re=x.slice(),ve=M.slice()),Y(L,P,re,ve);function ye(){if(S&&S(Se/R),Se<R)for(var Be=Date.now();Se<R&&(Se=Se+1,W(P,re,ve),W(L,re,ve),!(Date.now()-Be>O)););else{for(Se=0;Se<64;Se++)for(Z=0;Z<V>>1;Z++)F(j,Z<<1,re,ve);var Ke=[];for(Se=0;Se<V;Se++)Ke.push((j[Se]>>24&255)>>>0),Ke.push((j[Se]>>16&255)>>>0),Ke.push((j[Se]>>8&255)>>>0),Ke.push((j[Se]&255)>>>0);if(k){k(null,Ke);return}else return Ke}k&&a(ye)}if(typeof k<"u")ye();else for(var Bn;;)if(typeof(Bn=ye())<"u")return Bn||[]}function Ce(P,L,R,k){var S;if(typeof P!="string"||typeof L!="string")if(S=Error("Invalid string / salt: Not a string"),R){a(R.bind(this,S));return}else throw S;var j,V;if(L.charAt(0)!=="$"||L.charAt(1)!=="2")if(S=Error("Invalid salt version: "+L.substring(0,2)),R){a(R.bind(this,S));return}else throw S;if(L.charAt(2)==="$")j="\0",V=3;else{if(j=L.charAt(2),j!=="a"&&j!=="b"&&j!=="y"||L.charAt(3)!=="$")if(S=Error("Invalid salt revision: "+L.substring(2,4)),R){a(R.bind(this,S));return}else throw S;V=4}if(L.charAt(V+2)>"$")if(S=Error("Missing salt rounds"),R){a(R.bind(this,S));return}else throw S;var de=parseInt(L.substring(V,V+1),10)*10,re=parseInt(L.substring(V+1,V+2),10),ve=de+re,Se=L.substring(V+3,V+25);P+=j>="a"?"\0":"";var Z=l(P),ye=g(Se,$);function Bn(Be){var Ke=[];return Ke.push("$2"),j>="a"&&Ke.push(j),Ke.push("$"),ve<10&&Ke.push("0"),Ke.push(ve.toString()),Ke.push("$"),Ke.push(h(ye,ye.length)),Ke.push(h(Be,G.length*4-1)),Ke.join("")}if(typeof R>"u")return Bn(ue(Z,ye,ve));ue(Z,ye,ve,function(Be,Ke){Be?R(Be,null):R(null,Bn(Ke))},k)}return e.encodeBase64=h,e.decodeBase64=g,e})})(f_);var hv=f_.exports;const ts=p_(hv),gv="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let mv=t=>crypto.getRandomValues(new Uint8Array(t)),_v=(t,e,n)=>{let r=(2<<Math.log2(t.length-1))-1,i=-~(1.6*r*e/t.length);return(o=e)=>{let a="";for(;;){let l=n(i),u=i;for(;u--;)if(a+=t[l[u]&r]||"",a.length===o)return a}}},yv=(t,e=21)=>_v(t,e,mv),Ve=(t=21)=>{let e="",n=crypto.getRandomValues(new Uint8Array(t));for(;t--;)e+=gv[n[t]&63];return e};const wv=24;function Sc(){return yv("0123456789abcdef",wv)()}function dh(t){if(!t.includes("|"))return console.error("Invalid user_id format"),t;const[,e]=t.split("|");return e}function vv(t){return async(e,n)=>{if(!n.email||!n.email_verified)return t.users.create(e,n);const r=await Ep({userAdapter:t.users,tenant_id:e,email:n.email});return r?(await t.users.create(e,{...n,linked_to:r.user_id}),r):t.users.create(e,n)}}function Me(t,e){return{type:e.type,description:e.description||"",ip:t.var.ip,user_agent:t.var.useragent||"",auth0_client:t.var.auth0_client,date:new Date().toISOString(),details:{request:{method:t.req.method,path:t.req.path,qs:t.req.queries(),body:e.body||t.var.body||""}},isMobile:!1,client_id:t.var.client_id,client_name:"",user_id:e.userId||t.var.user_id||"",hostname:t.req.header("host")||"",user_name:t.var.username||"",connection_id:"",connection:t.var.connection||"",strategy:e.strategy||"",strategy_type:e.strategy_type||"",audience:"",scope:[]}}class _p{constructor(e,n){be(this,"value");be(this,"unit");this.value=e,this.unit=n}milliseconds(){return this.unit==="ms"?this.value:this.unit==="s"?this.value*1e3:this.unit==="m"?this.value*1e3*60:this.unit==="h"?this.value*1e3*60*60:this.unit==="d"?this.value*1e3*60*60*24:this.value*1e3*60*60*24*7}seconds(){return this.milliseconds()/1e3}transform(e){return new _p(Math.round(this.milliseconds()*e),"ms")}}class bv{constructor(e){be(this,"hash");this.hash=e}async verify(e,n,r){const i=await crypto.subtle.importKey("spki",e,{name:"RSASSA-PKCS1-v1_5",hash:this.hash},!1,["verify"]);return await crypto.subtle.verify("RSASSA-PKCS1-v1_5",i,n,r)}async sign(e,n){const r=await crypto.subtle.importKey("pkcs8",e,{name:"RSASSA-PKCS1-v1_5",hash:this.hash},!1,["sign"]);return await crypto.subtle.sign("RSASSA-PKCS1-v1_5",r,n)}async generateKeyPair(e){const n=await crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",hash:this.hash,modulusLength:e??2048,publicExponent:new Uint8Array([1,0,1])},!0,["sign"]),r=await crypto.subtle.exportKey("pkcs8",n.privateKey),i=await crypto.subtle.exportKey("spki",n.publicKey);return{privateKey:r,publicKey:i}}}async function h_(t){return await crypto.subtle.digest("SHA-256",t)}const ph="0123456789abcdef";function $u(t){const e=new Uint8Array(t);let n="";for(let r=0;r<e.length;r++){const i=e[r]>>4;n+=ph[i];const o=e[r]&15;n+=ph[o]}return n}class g_{constructor(e,n){be(this,"alphabet");be(this,"padding");be(this,"decodeMap",new Map);if(e.length!==32)throw new Error("Invalid alphabet");if(this.alphabet=e,this.padding=(n==null?void 0:n.padding)??"=",this.alphabet.includes(this.padding)||this.padding.length!==1)throw new Error("Invalid padding");for(let r=0;r<e.length;r++)this.decodeMap.set(e[r],r)}encode(e,n){let r="",i=0,o=0;for(let l=0;l<e.length;l++)for(i=i<<8|e[l],o+=8;o>=5;)o-=5,r+=this.alphabet[i>>o&31];if(o>0&&(r+=this.alphabet[i<<5-o&31]),(n==null?void 0:n.includePadding)??!0){const l=(8-r.length%8)%8;for(let u=0;u<l;u++)r+="="}return r}decode(e,n){const r=(n==null?void 0:n.strict)??!0,i=Math.ceil(e.length/8),o=[];for(let a=0;a<i;a++){let l=0;const u=[];for(let p=0;p<8;p++){const h=e[a*8+p];if(h==="="){if(a+1!==i)throw new Error(`Invalid character: ${h}`);l+=1;continue}if(h===void 0){if(r)throw new Error("Invalid data");l+=1;continue}const g=this.decodeMap.get(h)??null;if(g===null)throw new Error(`Invalid character: ${h}`);u.push(g)}if(l===8||l===7||l===5||l===2)throw new Error("Invalid padding");const d=(u[0]<<3)+(u[1]>>2);if(o.push(d),l<6){const p=((u[1]&3)<<6)+(u[2]<<1)+(u[3]>>4);o.push(p)}if(l<4){const p=((u[3]&255)<<4)+(u[4]>>1);o.push(p)}if(l<3){const p=((u[4]&1)<<7)+(u[5]<<2)+(u[6]>>3);o.push(p)}if(l<1){const p=((u[6]&7)<<5)+u[7];o.push(p)}}return Uint8Array.from(o)}}new g_("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567");new g_("0123456789ABCDEFGHIJKLMNOPQRSTUV");class m_{constructor(e,n){be(this,"alphabet");be(this,"padding");be(this,"decodeMap",new Map);if(e.length!==64)throw new Error("Invalid alphabet");if(this.alphabet=e,this.padding=(n==null?void 0:n.padding)??"=",this.alphabet.includes(this.padding)||this.padding.length!==1)throw new Error("Invalid padding");for(let r=0;r<e.length;r++)this.decodeMap.set(e[r],r)}encode(e,n){let r="",i=0,o=0;for(let l=0;l<e.length;l++)for(i=i<<8|e[l],o+=8;o>=6;)o+=-6,r+=this.alphabet[i>>o&63];if(o>0&&(r+=this.alphabet[i<<6-o&63]),(n==null?void 0:n.includePadding)??!0){const l=(4-r.length%4)%4;for(let u=0;u<l;u++)r+="="}return r}decode(e,n){const r=(n==null?void 0:n.strict)??!0,i=Math.ceil(e.length/4),o=[];for(let a=0;a<i;a++){let l=0,u=0;for(let d=0;d<4;d++){const p=e[a*4+d];if(p==="="){if(a+1!==i)throw new Error(`Invalid character: ${p}`);l+=1;continue}if(p===void 0){if(r)throw new Error("Invalid data");l+=1;continue}const h=this.decodeMap.get(p)??null;if(h===null)throw new Error(`Invalid character: ${p}`);u+=h<<6*(3-d)}o.push(u>>16&255),l<2&&o.push(u>>8&255),l<1&&o.push(u&255)}return Uint8Array.from(o)}}const __=new m_("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),Fr=new m_("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_");async function fh(t,e,n,r){const i={alg:t,typ:"JWT",...r==null?void 0:r.headers},o={...n};(r==null?void 0:r.audiences)!==void 0&&(o.aud=r.audiences),(r==null?void 0:r.subject)!==void 0&&(o.sub=r.subject),(r==null?void 0:r.issuer)!==void 0&&(o.iss=r.issuer),(r==null?void 0:r.jwtId)!==void 0&&(o.jti=r.jwtId),(r==null?void 0:r.expiresIn)!==void 0&&(o.exp=Math.floor(Date.now()/1e3)+r.expiresIn.seconds()),(r==null?void 0:r.notBefore)!==void 0&&(o.nbf=Math.floor(r.notBefore.getTime()/1e3)),o.iat=Math.floor(Date.now()/1e3);const a=new TextEncoder,l=Fr.encode(a.encode(JSON.stringify(i)),{includePadding:!1}),u=Fr.encode(a.encode(JSON.stringify(o)),{includePadding:!1}),d=a.encode([l,u].join(".")),p=await xv(t).sign(e,d),h=Fr.encode(new Uint8Array(p),{includePadding:!1});return[l,u,h].join(".")}function $v(t){const e=t.split(".");return e.length!==3?null:e}function yp(t){const e=$v(t);if(!e)return null;const n=new TextDecoder,r=Fr.decode(e[0],{strict:!1}),i=Fr.decode(e[1],{strict:!1}),o=JSON.parse(n.decode(r));if(typeof o!="object"||o===null||!("alg"in o)||!Av(o.alg)||"typ"in o&&o.typ!=="JWT")return null;const a=JSON.parse(n.decode(i));if(typeof a!="object"||a===null)return null;const l={algorithm:o.alg,expiresAt:null,subject:null,issuedAt:null,issuer:null,jwtId:null,audiences:null,notBefore:null};if("exp"in a){if(typeof a.exp!="number")return null;l.expiresAt=new Date(a.exp*1e3)}if("iss"in a){if(typeof a.iss!="string")return null;l.issuer=a.iss}if("sub"in a){if(typeof a.sub!="string")return null;l.subject=a.sub}if("aud"in a)if(Array.isArray(a.aud)){for(const u of a.aud)if(typeof u!="string")return null;l.audiences=a.aud}else{if(typeof a.aud!="string")return null;l.audiences=[a.aud]}if("nbf"in a){if(typeof a.nbf!="number")return null;l.notBefore=new Date(a.nbf*1e3)}if("iat"in a){if(typeof a.iat!="number")return null;l.issuedAt=new Date(a.iat*1e3)}if("jti"in a){if(typeof a.jti!="string")return null;l.jwtId=a.jti}return{value:t,header:{...o,typ:"JWT",alg:o.alg},payload:{...a},parts:e,...l}}function xv(t){return new bv(Ev[t])}function Av(t){return typeof t!="string"?!1:["HS256","HS384","HS512","RS256","RS384","RS512","ES256","ES384","ES512","PS256","PS384","PS512"].includes(t)}const Ev={RS256:"SHA-256",RS384:"SHA-384",RS512:"SHA-512"};function Sv(){const t=new Uint8Array(32);return crypto.getRandomValues(t),Fr.encode(t,{includePadding:!1})}function kv(t){try{const n=/-----BEGIN (?:RSA )?(?:PRIVATE|PUBLIC) KEY-----([^-]*)-----END (?:RSA )?(?:PRIVATE|PUBLIC) KEY-----/.exec(t);if(!n||!n[1])throw new Error("Invalid PEM format");return Uint8Array.from(atob(n[1].replace(/\s/g,"")),r=>r.charCodeAt(0)).buffer}finally{t=t.replace(/./g,"\0")}}async function Nv(t,e){if(e==="plain")return t;const n=new TextEncoder().encode(t),r=await h_(n);return Fr.encode(new Uint8Array(r),{includePadding:!1})}const js=60*5,kc=30*24*60*60,qr=24*60*60,Cv="auth-token",ea=30*60*1e3,xu=7*24*60*60*1e3,Tv=5*60,Iv=5*60,Ov=30*60*1e3,zv=30*60*1e3,Dv=24*60*60*1e3;function y_(t,e,n){const r=[];return r.push([encodeURIComponent(t),encodeURIComponent(e)]),(n==null?void 0:n.domain)!==void 0&&r.push(["Domain",n.domain]),(n==null?void 0:n.expires)!==void 0&&r.push(["Expires",n.expires.toUTCString()]),n!=null&&n.httpOnly&&r.push(["HttpOnly"]),(n==null?void 0:n.maxAge)!==void 0&&r.push(["Max-Age",n.maxAge.toString()]),(n==null?void 0:n.path)!==void 0&&r.push(["Path",n.path]),(n==null?void 0:n.sameSite)==="lax"&&r.push(["SameSite","Lax"]),(n==null?void 0:n.sameSite)==="none"&&r.push(["SameSite","None"]),(n==null?void 0:n.sameSite)==="strict"&&r.push(["SameSite","Strict"]),n!=null&&n.secure&&r.push(["Secure"]),r.map(i=>i.join("=")).join("; ")}function Rv(t){const e=new Map,n=t.split("; ");for(const r of n){const i=r.split("="),o=i[0],a=i[1]??"";o&&e.set(decodeURIComponent(o),decodeURIComponent(a))}return e}function wp(t){return`${t}-${Cv}`}function w_(t){if(!t)return;const[e]=t.split(":");if(!e||e==="localhost"||/^(\d{1,3}\.){3}\d{1,3}$/.test(e))return;const n=e.split(".");return n.length>2?`.${n.slice(-2).join(".")}`:`.${e}`}function Tn(t,e){return e?Rv(e).get(wp(t)):void 0}function Pv(t,e){return y_(wp(t),"",{path:"/",httpOnly:!0,secure:!0,maxAge:0,sameSite:"none",domain:e?w_(e):void 0})}function ka(t,e,n){return y_(wp(t),e,{path:"/",httpOnly:!0,secure:!0,maxAge:kc,sameSite:"none",domain:n?w_(n):void 0})}var vp={},Nc={};(function(t){const e=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",n=e+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",r="["+e+"]["+n+"]*",i=new RegExp("^"+r+"$"),o=function(l,u){const d=[];let p=u.exec(l);for(;p;){const h=[];h.startIndex=u.lastIndex-p[0].length;const g=p.length;for(let A=0;A<g;A++)h.push(p[A]);d.push(h),p=u.exec(l)}return d},a=function(l){const u=i.exec(l);return!(u===null||typeof u>"u")};t.isExist=function(l){return typeof l<"u"},t.isEmptyObject=function(l){return Object.keys(l).length===0},t.merge=function(l,u,d){if(u){const p=Object.keys(u),h=p.length;for(let g=0;g<h;g++)d==="strict"?l[p[g]]=[u[p[g]]]:l[p[g]]=u[p[g]]}},t.getValue=function(l){return t.isExist(l)?l:""},t.isName=a,t.getAllMatches=o,t.nameRegexp=r})(Nc);const bp=Nc,Bv={allowBooleanAttributes:!1,unpairedTags:[]};vp.validate=function(t,e){e=Object.assign({},Bv,e);const n=[];let r=!1,i=!1;t[0]==="\uFEFF"&&(t=t.substr(1));for(let o=0;o<t.length;o++)if(t[o]==="<"&&t[o+1]==="?"){if(o+=2,o=gh(t,o),o.err)return o}else if(t[o]==="<"){let a=o;if(o++,t[o]==="!"){o=mh(t,o);continue}else{let l=!1;t[o]==="/"&&(l=!0,o++);let u="";for(;o<t.length&&t[o]!==">"&&t[o]!==" "&&t[o]!==" "&&t[o]!==`
6
+ `&&t[o]!=="\r";o++)u+=t[o];if(u=u.trim(),u[u.length-1]==="/"&&(u=u.substring(0,u.length-1),o--),!Hv(u)){let h;return u.trim().length===0?h="Invalid space after '<'.":h="Tag '"+u+"' is an invalid name.",Xe("InvalidTag",h,_t(t,o))}const d=Fv(t,o);if(d===!1)return Xe("InvalidAttr","Attributes for '"+u+"' have open quote.",_t(t,o));let p=d.value;if(o=d.index,p[p.length-1]==="/"){const h=o-p.length;p=p.substring(0,p.length-1);const g=_h(p,e);if(g===!0)r=!0;else return Xe(g.err.code,g.err.msg,_t(t,h+g.err.line))}else if(l)if(d.tagClosed){if(p.trim().length>0)return Xe("InvalidTag","Closing tag '"+u+"' can't have attributes or invalid starting.",_t(t,a));if(n.length===0)return Xe("InvalidTag","Closing tag '"+u+"' has not been opened.",_t(t,a));{const h=n.pop();if(u!==h.tagName){let g=_t(t,h.tagStartPos);return Xe("InvalidTag","Expected closing tag '"+h.tagName+"' (opened in line "+g.line+", col "+g.col+") instead of closing tag '"+u+"'.",_t(t,a))}n.length==0&&(i=!0)}}else return Xe("InvalidTag","Closing tag '"+u+"' doesn't have proper closing.",_t(t,o));else{const h=_h(p,e);if(h!==!0)return Xe(h.err.code,h.err.msg,_t(t,o-p.length+h.err.line));if(i===!0)return Xe("InvalidXml","Multiple possible root nodes found.",_t(t,o));e.unpairedTags.indexOf(u)!==-1||n.push({tagName:u,tagStartPos:a}),r=!0}for(o++;o<t.length;o++)if(t[o]==="<")if(t[o+1]==="!"){o++,o=mh(t,o);continue}else if(t[o+1]==="?"){if(o=gh(t,++o),o.err)return o}else break;else if(t[o]==="&"){const h=qv(t,o);if(h==-1)return Xe("InvalidChar","char '&' is not expected.",_t(t,o));o=h}else if(i===!0&&!hh(t[o]))return Xe("InvalidXml","Extra text at the end",_t(t,o));t[o]==="<"&&o--}}else{if(hh(t[o]))continue;return Xe("InvalidChar","char '"+t[o]+"' is not expected.",_t(t,o))}if(r){if(n.length==1)return Xe("InvalidTag","Unclosed tag '"+n[0].tagName+"'.",_t(t,n[0].tagStartPos));if(n.length>0)return Xe("InvalidXml","Invalid '"+JSON.stringify(n.map(o=>o.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return Xe("InvalidXml","Start tag expected.",1);return!0};function hh(t){return t===" "||t===" "||t===`
7
+ `||t==="\r"}function gh(t,e){const n=e;for(;e<t.length;e++)if(t[e]=="?"||t[e]==" "){const r=t.substr(n,e-n);if(e>5&&r==="xml")return Xe("InvalidXml","XML declaration allowed only at the start of the document.",_t(t,e));if(t[e]=="?"&&t[e+1]==">"){e++;break}else continue}return e}function mh(t,e){if(t.length>e+5&&t[e+1]==="-"&&t[e+2]==="-"){for(e+=3;e<t.length;e++)if(t[e]==="-"&&t[e+1]==="-"&&t[e+2]===">"){e+=2;break}}else if(t.length>e+8&&t[e+1]==="D"&&t[e+2]==="O"&&t[e+3]==="C"&&t[e+4]==="T"&&t[e+5]==="Y"&&t[e+6]==="P"&&t[e+7]==="E"){let n=1;for(e+=8;e<t.length;e++)if(t[e]==="<")n++;else if(t[e]===">"&&(n--,n===0))break}else if(t.length>e+9&&t[e+1]==="["&&t[e+2]==="C"&&t[e+3]==="D"&&t[e+4]==="A"&&t[e+5]==="T"&&t[e+6]==="A"&&t[e+7]==="["){for(e+=8;e<t.length;e++)if(t[e]==="]"&&t[e+1]==="]"&&t[e+2]===">"){e+=2;break}}return e}const jv='"',Lv="'";function Fv(t,e){let n="",r="",i=!1;for(;e<t.length;e++){if(t[e]===jv||t[e]===Lv)r===""?r=t[e]:r!==t[e]||(r="");else if(t[e]===">"&&r===""){i=!0;break}n+=t[e]}return r!==""?!1:{value:n,index:e,tagClosed:i}}const Uv=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function _h(t,e){const n=bp.getAllMatches(t,Uv),r={};for(let i=0;i<n.length;i++){if(n[i][1].length===0)return Xe("InvalidAttr","Attribute '"+n[i][2]+"' has no space in starting.",po(n[i]));if(n[i][3]!==void 0&&n[i][4]===void 0)return Xe("InvalidAttr","Attribute '"+n[i][2]+"' is without value.",po(n[i]));if(n[i][3]===void 0&&!e.allowBooleanAttributes)return Xe("InvalidAttr","boolean attribute '"+n[i][2]+"' is not allowed.",po(n[i]));const o=n[i][2];if(!Vv(o))return Xe("InvalidAttr","Attribute '"+o+"' is an invalid name.",po(n[i]));if(!r.hasOwnProperty(o))r[o]=1;else return Xe("InvalidAttr","Attribute '"+o+"' is repeated.",po(n[i]))}return!0}function Mv(t,e){let n=/\d/;for(t[e]==="x"&&(e++,n=/[\da-fA-F]/);e<t.length;e++){if(t[e]===";")return e;if(!t[e].match(n))break}return-1}function qv(t,e){if(e++,t[e]===";")return-1;if(t[e]==="#")return e++,Mv(t,e);let n=0;for(;e<t.length;e++,n++)if(!(t[e].match(/\w/)&&n<20)){if(t[e]===";")break;return-1}return e}function Xe(t,e,n){return{err:{code:t,msg:e,line:n.line||n,col:n.col}}}function Vv(t){return bp.isName(t)}function Hv(t){return bp.isName(t)}function _t(t,e){const n=t.substring(0,e).split(/\r?\n/);return{line:n.length,col:n[n.length-1].length+1}}function po(t){return t.startIndex+t[1].length}var $p={};const v_={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(t,e,n){return t}},Kv=function(t){return Object.assign({},v_,t)};$p.buildOptions=Kv;$p.defaultOptions=v_;class Gv{constructor(e){this.tagname=e,this.child=[],this[":@"]={}}add(e,n){e==="__proto__"&&(e="#__proto__"),this.child.push({[e]:n})}addChild(e){e.tagname==="__proto__"&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,":@":e[":@"]}):this.child.push({[e.tagname]:e.child})}}var Wv=Gv;const Xv=Nc;function Jv(t,e){const n={};if(t[e+3]==="O"&&t[e+4]==="C"&&t[e+5]==="T"&&t[e+6]==="Y"&&t[e+7]==="P"&&t[e+8]==="E"){e=e+9;let r=1,i=!1,o=!1,a="";for(;e<t.length;e++)if(t[e]==="<"&&!o){if(i&&Qv(t,e)){e+=7;let l,u;[l,u,e]=Yv(t,e+1),u.indexOf("&")===-1&&(n[rb(l)]={regx:RegExp(`&${l};`,"g"),val:u})}else if(i&&eb(t,e))e+=8;else if(i&&tb(t,e))e+=8;else if(i&&nb(t,e))e+=9;else if(Zv)o=!0;else throw new Error("Invalid DOCTYPE");r++,a=""}else if(t[e]===">"){if(o?t[e-1]==="-"&&t[e-2]==="-"&&(o=!1,r--):r--,r===0)break}else t[e]==="["?i=!0:a+=t[e];if(r!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:n,i:e}}function Yv(t,e){let n="";for(;e<t.length&&t[e]!=="'"&&t[e]!=='"';e++)n+=t[e];if(n=n.trim(),n.indexOf(" ")!==-1)throw new Error("External entites are not supported");const r=t[e++];let i="";for(;e<t.length&&t[e]!==r;e++)i+=t[e];return[n,i,e]}function Zv(t,e){return t[e+1]==="!"&&t[e+2]==="-"&&t[e+3]==="-"}function Qv(t,e){return t[e+1]==="!"&&t[e+2]==="E"&&t[e+3]==="N"&&t[e+4]==="T"&&t[e+5]==="I"&&t[e+6]==="T"&&t[e+7]==="Y"}function eb(t,e){return t[e+1]==="!"&&t[e+2]==="E"&&t[e+3]==="L"&&t[e+4]==="E"&&t[e+5]==="M"&&t[e+6]==="E"&&t[e+7]==="N"&&t[e+8]==="T"}function tb(t,e){return t[e+1]==="!"&&t[e+2]==="A"&&t[e+3]==="T"&&t[e+4]==="T"&&t[e+5]==="L"&&t[e+6]==="I"&&t[e+7]==="S"&&t[e+8]==="T"}function nb(t,e){return t[e+1]==="!"&&t[e+2]==="N"&&t[e+3]==="O"&&t[e+4]==="T"&&t[e+5]==="A"&&t[e+6]==="T"&&t[e+7]==="I"&&t[e+8]==="O"&&t[e+9]==="N"}function rb(t){if(Xv.isName(t))return t;throw new Error(`Invalid entity name ${t}`)}var ib=Jv;const ob=/^[-+]?0x[a-fA-F0-9]+$/,sb=/^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/;!Number.parseInt&&window.parseInt&&(Number.parseInt=window.parseInt);!Number.parseFloat&&window.parseFloat&&(Number.parseFloat=window.parseFloat);const ab={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function cb(t,e={}){if(e=Object.assign({},ab,e),!t||typeof t!="string")return t;let n=t.trim();if(e.skipLike!==void 0&&e.skipLike.test(n))return t;if(e.hex&&ob.test(n))return Number.parseInt(n,16);{const r=sb.exec(n);if(r){const i=r[1],o=r[2];let a=lb(r[3]);const l=r[4]||r[6];if(!e.leadingZeros&&o.length>0&&i&&n[2]!==".")return t;if(!e.leadingZeros&&o.length>0&&!i&&n[1]!==".")return t;{const u=Number(n),d=""+u;return d.search(/[eE]/)!==-1||l?e.eNotation?u:t:n.indexOf(".")!==-1?d==="0"&&a===""||d===a||i&&d==="-"+a?u:t:o?a===d||i+a===d?u:t:n===d||n===i+d?u:t}}else return t}}function lb(t){return t&&t.indexOf(".")!==-1&&(t=t.replace(/0+$/,""),t==="."?t="0":t[0]==="."?t="0"+t:t[t.length-1]==="."&&(t=t.substr(0,t.length-1))),t}var ub=cb;function db(t){return typeof t=="function"?t:Array.isArray(t)?e=>{for(const n of t)if(typeof n=="string"&&e===n||n instanceof RegExp&&n.test(e))return!0}:()=>!1}var b_=db;const $_=Nc,fo=Wv,pb=ib,fb=ub,hb=b_;let gb=class{constructor(e){this.options=e,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(n,r)=>String.fromCharCode(Number.parseInt(r,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(n,r)=>String.fromCharCode(Number.parseInt(r,16))}},this.addExternalEntities=mb,this.parseXml=bb,this.parseTextData=_b,this.resolveNameSpace=yb,this.buildAttributesMap=vb,this.isItStopNode=Eb,this.replaceEntitiesValue=xb,this.readStopNodeData=kb,this.saveTextToParentTag=Ab,this.addChild=$b,this.ignoreAttributesFn=hb(this.options.ignoreAttributes)}};function mb(t){const e=Object.keys(t);for(let n=0;n<e.length;n++){const r=e[n];this.lastEntities[r]={regex:new RegExp("&"+r+";","g"),val:t[r]}}}function _b(t,e,n,r,i,o,a){if(t!==void 0&&(this.options.trimValues&&!r&&(t=t.trim()),t.length>0)){a||(t=this.replaceEntitiesValue(t));const l=this.options.tagValueProcessor(e,t,n,i,o);return l==null?t:typeof l!=typeof t||l!==t?l:this.options.trimValues?Eu(t,this.options.parseTagValue,this.options.numberParseOptions):t.trim()===t?Eu(t,this.options.parseTagValue,this.options.numberParseOptions):t}}function yb(t){if(this.options.removeNSPrefix){const e=t.split(":"),n=t.charAt(0)==="/"?"/":"";if(e[0]==="xmlns")return"";e.length===2&&(t=n+e[1])}return t}const wb=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function vb(t,e,n){if(this.options.ignoreAttributes!==!0&&typeof t=="string"){const r=$_.getAllMatches(t,wb),i=r.length,o={};for(let a=0;a<i;a++){const l=this.resolveNameSpace(r[a][1]);if(this.ignoreAttributesFn(l,e))continue;let u=r[a][4],d=this.options.attributeNamePrefix+l;if(l.length)if(this.options.transformAttributeName&&(d=this.options.transformAttributeName(d)),d==="__proto__"&&(d="#__proto__"),u!==void 0){this.options.trimValues&&(u=u.trim()),u=this.replaceEntitiesValue(u);const p=this.options.attributeValueProcessor(l,u,e);p==null?o[d]=u:typeof p!=typeof u||p!==u?o[d]=p:o[d]=Eu(u,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(o[d]=!0)}if(!Object.keys(o).length)return;if(this.options.attributesGroupName){const a={};return a[this.options.attributesGroupName]=o,a}return o}}const bb=function(t){t=t.replace(/\r\n?/g,`
8
8
  `);const e=new fo("!xml");let n=e,r="",i="";for(let o=0;o<t.length;o++)if(t[o]==="<")if(t[o+1]==="/"){const l=jr(t,">",o,"Closing Tag is not closed.");let u=t.substring(o+2,l).trim();if(this.options.removeNSPrefix){const h=u.indexOf(":");h!==-1&&(u=u.substr(h+1))}this.options.transformTagName&&(u=this.options.transformTagName(u)),n&&(r=this.saveTextToParentTag(r,n,i));const d=i.substring(i.lastIndexOf(".")+1);if(u&&this.options.unpairedTags.indexOf(u)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${u}>`);let p=0;d&&this.options.unpairedTags.indexOf(d)!==-1?(p=i.lastIndexOf(".",i.lastIndexOf(".")-1),this.tagsNodeStack.pop()):p=i.lastIndexOf("."),i=i.substring(0,p),n=this.tagsNodeStack.pop(),r="",o=l}else if(t[o+1]==="?"){let l=Au(t,o,!1,"?>");if(!l)throw new Error("Pi Tag is not closed.");if(r=this.saveTextToParentTag(r,n,i),!(this.options.ignoreDeclaration&&l.tagName==="?xml"||this.options.ignorePiTags)){const u=new fo(l.tagName);u.add(this.options.textNodeName,""),l.tagName!==l.tagExp&&l.attrExpPresent&&(u[":@"]=this.buildAttributesMap(l.tagExp,i,l.tagName)),this.addChild(n,u,i)}o=l.closeIndex+1}else if(t.substr(o+1,3)==="!--"){const l=jr(t,"-->",o+4,"Comment is not closed.");if(this.options.commentPropName){const u=t.substring(o+4,l-2);r=this.saveTextToParentTag(r,n,i),n.add(this.options.commentPropName,[{[this.options.textNodeName]:u}])}o=l}else if(t.substr(o+1,2)==="!D"){const l=pb(t,o);this.docTypeEntities=l.entities,o=l.i}else if(t.substr(o+1,2)==="!["){const l=jr(t,"]]>",o,"CDATA is not closed.")-2,u=t.substring(o+9,l);r=this.saveTextToParentTag(r,n,i);let d=this.parseTextData(u,n.tagname,i,!0,!1,!0,!0);d==null&&(d=""),this.options.cdataPropName?n.add(this.options.cdataPropName,[{[this.options.textNodeName]:u}]):n.add(this.options.textNodeName,d),o=l+2}else{let l=Au(t,o,this.options.removeNSPrefix),u=l.tagName;const d=l.rawTagName;let p=l.tagExp,h=l.attrExpPresent,g=l.closeIndex;this.options.transformTagName&&(u=this.options.transformTagName(u)),n&&r&&n.tagname!=="!xml"&&(r=this.saveTextToParentTag(r,n,i,!1));const A=n;if(A&&this.options.unpairedTags.indexOf(A.tagname)!==-1&&(n=this.tagsNodeStack.pop(),i=i.substring(0,i.lastIndexOf("."))),u!==e.tagname&&(i+=i?"."+u:u),this.isItStopNode(this.options.stopNodes,i,u)){let $="";if(p.length>0&&p.lastIndexOf("/")===p.length-1)u[u.length-1]==="/"?(u=u.substr(0,u.length-1),i=i.substr(0,i.length-1),p=u):p=p.substr(0,p.length-1),o=l.closeIndex;else if(this.options.unpairedTags.indexOf(u)!==-1)o=l.closeIndex;else{const D=this.readStopNodeData(t,d,g+1);if(!D)throw new Error(`Unexpected end of ${d}`);o=D.i,$=D.tagContent}const N=new fo(u);u!==p&&h&&(N[":@"]=this.buildAttributesMap(p,i,u)),$&&($=this.parseTextData($,u,i,!0,h,!0,!0)),i=i.substr(0,i.lastIndexOf(".")),N.add(this.options.textNodeName,$),this.addChild(n,N,i)}else{if(p.length>0&&p.lastIndexOf("/")===p.length-1){u[u.length-1]==="/"?(u=u.substr(0,u.length-1),i=i.substr(0,i.length-1),p=u):p=p.substr(0,p.length-1),this.options.transformTagName&&(u=this.options.transformTagName(u));const $=new fo(u);u!==p&&h&&($[":@"]=this.buildAttributesMap(p,i,u)),this.addChild(n,$,i),i=i.substr(0,i.lastIndexOf("."))}else{const $=new fo(u);this.tagsNodeStack.push(n),u!==p&&h&&($[":@"]=this.buildAttributesMap(p,i,u)),this.addChild(n,$,i),n=$}r="",o=g}}else r+=t[o];return e.child};function $b(t,e,n){const r=this.options.updateTag(e.tagname,n,e[":@"]);r===!1||(typeof r=="string"&&(e.tagname=r),t.addChild(e))}const xb=function(t){if(this.options.processEntities){for(let e in this.docTypeEntities){const n=this.docTypeEntities[e];t=t.replace(n.regx,n.val)}for(let e in this.lastEntities){const n=this.lastEntities[e];t=t.replace(n.regex,n.val)}if(this.options.htmlEntities)for(let e in this.htmlEntities){const n=this.htmlEntities[e];t=t.replace(n.regex,n.val)}t=t.replace(this.ampEntity.regex,this.ampEntity.val)}return t};function Ab(t,e,n,r){return t&&(r===void 0&&(r=Object.keys(e.child).length===0),t=this.parseTextData(t,e.tagname,n,!1,e[":@"]?Object.keys(e[":@"]).length!==0:!1,r),t!==void 0&&t!==""&&e.add(this.options.textNodeName,t),t=""),t}function Eb(t,e,n){const r="*."+n;for(const i in t){const o=t[i];if(r===o||e===o)return!0}return!1}function Sb(t,e,n=">"){let r,i="";for(let o=e;o<t.length;o++){let a=t[o];if(r)a===r&&(r="");else if(a==='"'||a==="'")r=a;else if(a===n[0])if(n[1]){if(t[o+1]===n[1])return{data:i,index:o}}else return{data:i,index:o};else a===" "&&(a=" ");i+=a}}function jr(t,e,n,r){const i=t.indexOf(e,n);if(i===-1)throw new Error(r);return i+e.length-1}function Au(t,e,n,r=">"){const i=Sb(t,e+1,r);if(!i)return;let o=i.data;const a=i.index,l=o.search(/\s/);let u=o,d=!0;l!==-1&&(u=o.substring(0,l),o=o.substring(l+1).trimStart());const p=u;if(n){const h=u.indexOf(":");h!==-1&&(u=u.substr(h+1),d=u!==i.data.substr(h+1))}return{tagName:u,tagExp:o,closeIndex:a,attrExpPresent:d,rawTagName:p}}function kb(t,e,n){const r=n;let i=1;for(;n<t.length;n++)if(t[n]==="<")if(t[n+1]==="/"){const o=jr(t,">",n,`${e} is not closed`);if(t.substring(n+2,o).trim()===e&&(i--,i===0))return{tagContent:t.substring(r,n),i:o};n=o}else if(t[n+1]==="?")n=jr(t,"?>",n+1,"StopNode is not closed.");else if(t.substr(n+1,3)==="!--")n=jr(t,"-->",n+3,"StopNode is not closed.");else if(t.substr(n+1,2)==="![")n=jr(t,"]]>",n,"StopNode is not closed.")-2;else{const o=Au(t,n,">");o&&((o&&o.tagName)===e&&o.tagExp[o.tagExp.length-1]!=="/"&&i++,n=o.closeIndex)}}function Eu(t,e,n){if(e&&typeof t=="string"){const r=t.trim();return r==="true"?!0:r==="false"?!1:fb(t,n)}else return $_.isExist(t)?t:""}var Nb=gb,x_={};function Cb(t,e){return A_(t,e)}function A_(t,e,n){let r;const i={};for(let o=0;o<t.length;o++){const a=t[o],l=Tb(a);let u="";if(n===void 0?u=l:u=n+"."+l,l===e.textNodeName)r===void 0?r=a[l]:r+=""+a[l];else{if(l===void 0)continue;if(a[l]){let d=A_(a[l],e,u);const p=Ob(d,e);a[":@"]?Ib(d,a[":@"],u,e):Object.keys(d).length===1&&d[e.textNodeName]!==void 0&&!e.alwaysCreateTextNode?d=d[e.textNodeName]:Object.keys(d).length===0&&(e.alwaysCreateTextNode?d[e.textNodeName]="":d=""),i[l]!==void 0&&i.hasOwnProperty(l)?(Array.isArray(i[l])||(i[l]=[i[l]]),i[l].push(d)):e.isArray(l,u,p)?i[l]=[d]:i[l]=d}}}return typeof r=="string"?r.length>0&&(i[e.textNodeName]=r):r!==void 0&&(i[e.textNodeName]=r),i}function Tb(t){const e=Object.keys(t);for(let n=0;n<e.length;n++){const r=e[n];if(r!==":@")return r}}function Ib(t,e,n,r){if(e){const i=Object.keys(e),o=i.length;for(let a=0;a<o;a++){const l=i[a];r.isArray(l,n+"."+l,!0,!0)?t[l]=[e[l]]:t[l]=e[l]}}}function Ob(t,e){const{textNodeName:n}=e,r=Object.keys(t).length;return!!(r===0||r===1&&(t[n]||typeof t[n]=="boolean"||t[n]===0))}x_.prettify=Cb;const{buildOptions:zb}=$p,Db=Nb,{prettify:Rb}=x_,Pb=vp;let Bb=class{constructor(e){this.externalEntities={},this.options=zb(e)}parse(e,n){if(typeof e!="string")if(e.toString)e=e.toString();else throw new Error("XML data is accepted in String or Bytes[] form.");if(n){n===!0&&(n={});const o=Pb.validate(e,n);if(o!==!0)throw Error(`${o.err.msg}:${o.err.line}:${o.err.col}`)}const r=new Db(this.options);r.addExternalEntities(this.externalEntities);const i=r.parseXml(e);return this.options.preserveOrder||i===void 0?i:Rb(i,this.options)}addEntity(e,n){if(n.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(e.indexOf("&")!==-1||e.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");if(n==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[e]=n}};var jb=Bb;const Lb=`
9
9
  `;function Fb(t,e){let n="";return e.format&&e.indentBy.length>0&&(n=Lb),E_(t,e,"",n)}function E_(t,e,n,r){let i="",o=!1;for(let a=0;a<t.length;a++){const l=t[a],u=Ub(l);if(u===void 0)continue;let d="";if(n.length===0?d=u:d=`${n}.${u}`,u===e.textNodeName){let $=l[u];Mb(d,e)||($=e.tagValueProcessor(u,$),$=S_($,e)),o&&(i+=r),i+=$,o=!1;continue}else if(u===e.cdataPropName){o&&(i+=r),i+=`<![CDATA[${l[u][0][e.textNodeName]}]]>`,o=!1;continue}else if(u===e.commentPropName){i+=r+`<!--${l[u][0][e.textNodeName]}-->`,o=!0;continue}else if(u[0]==="?"){const $=yh(l[":@"],e),N=u==="?xml"?"":r;let D=l[u][0][e.textNodeName];D=D.length!==0?" "+D:"",i+=N+`<${u}${D}${$}?>`,o=!0;continue}let p=r;p!==""&&(p+=e.indentBy);const h=yh(l[":@"],e),g=r+`<${u}${h}`,A=E_(l[u],e,d,p);e.unpairedTags.indexOf(u)!==-1?e.suppressUnpairedNode?i+=g+">":i+=g+"/>":(!A||A.length===0)&&e.suppressEmptyNode?i+=g+"/>":A&&A.endsWith(">")?i+=g+`>${A}${r}</${u}>`:(i+=g+">",A&&r!==""&&(A.includes("/>")||A.includes("</"))?i+=r+e.indentBy+A+r:i+=A,i+=`</${u}>`),o=!0}return i}function Ub(t){const e=Object.keys(t);for(let n=0;n<e.length;n++){const r=e[n];if(t.hasOwnProperty(r)&&r!==":@")return r}}function yh(t,e){let n="";if(t&&!e.ignoreAttributes)for(let r in t){if(!t.hasOwnProperty(r))continue;let i=e.attributeValueProcessor(r,t[r]);i=S_(i,e),i===!0&&e.suppressBooleanAttributes?n+=` ${r.substr(e.attributeNamePrefix.length)}`:n+=` ${r.substr(e.attributeNamePrefix.length)}="${i}"`}return n}function Mb(t,e){t=t.substr(0,t.length-e.textNodeName.length-1);let n=t.substr(t.lastIndexOf(".")+1);for(let r in e.stopNodes)if(e.stopNodes[r]===t||e.stopNodes[r]==="*."+n)return!0;return!1}function S_(t,e){if(t&&t.length>0&&e.processEntities)for(let n=0;n<e.entities.length;n++){const r=e.entities[n];t=t.replace(r.regex,r.val)}return t}var qb=Fb;const Vb=qb,Hb=b_,Kb={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&amp;"},{regex:new RegExp(">","g"),val:"&gt;"},{regex:new RegExp("<","g"),val:"&lt;"},{regex:new RegExp("'","g"),val:"&apos;"},{regex:new RegExp('"',"g"),val:"&quot;"}],processEntities:!0,stopNodes:[],oneListGroup:!1};function Er(t){this.options=Object.assign({},Kb,t),this.options.ignoreAttributes===!0||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn=Hb(this.options.ignoreAttributes),this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=Xb),this.processTextOrObjNode=Gb,this.options.format?(this.indentate=Wb,this.tagEndChar=`>
10
10
  `,this.newLine=`
@@ -82,7 +82,7 @@ MERCHANTABLITY OR NON-INFRINGEMENT.
82
82
 
83
83
  See the Apache Version 2.0 License for specific language governing permissions
84
84
  and limitations under the License.
85
- ***************************************************************************** */var xh;(function(t){(function(e){var n=typeof globalThis=="object"?globalThis:typeof Br=="object"?Br:typeof self=="object"?self:typeof this=="object"?this:l(),r=i(t);typeof n.Reflect<"u"&&(r=i(n.Reflect,r)),e(r,n),typeof n.Reflect>"u"&&(n.Reflect=t);function i(u,d){return function(p,h){Object.defineProperty(u,p,{configurable:!0,writable:!0,value:h}),d&&d(p,h)}}function o(){try{return Function("return this;")()}catch{}}function a(){try{return(0,eval)("(function() { return this; })()")}catch{}}function l(){return o()||a()}})(function(e,n){var r=Object.prototype.hasOwnProperty,i=typeof Symbol=="function",o=i&&typeof Symbol.toPrimitive<"u"?Symbol.toPrimitive:"@@toPrimitive",a=i&&typeof Symbol.iterator<"u"?Symbol.iterator:"@@iterator",l=typeof Object.create=="function",u={__proto__:[]}instanceof Array,d=!l&&!u,p={create:l?function(){return vn(Object.create(null))}:u?function(){return vn({__proto__:null})}:function(){return vn({})},has:d?function(z,I){return r.call(z,I)}:function(z,I){return I in z},get:d?function(z,I){return r.call(z,I)?z[I]:void 0}:function(z,I){return z[I]}},h=Object.getPrototypeOf(Function),g=typeof Map=="function"&&typeof Map.prototype.entries=="function"?Map:ae(),A=typeof Set=="function"&&typeof Set.prototype.entries=="function"?Set:Kt(),$=typeof WeakMap=="function"?WeakMap:Dt(),N=i?Symbol.for("@reflect-metadata:registry"):void 0,D=wn(),O=bt(D);function x(z,I,U,ee){if(Z(U)){if(!Ot(z))throw new TypeError;if(!he(I))throw new TypeError;return L(z,I)}else{if(!Ot(z))throw new TypeError;if(!Be(I))throw new TypeError;if(!Be(ee)&&!Z(ee)&&!ye(ee))throw new TypeError;return ye(ee)&&(ee=void 0),U=Qe(U),R(z,I,U,ee)}}e("decorate",x);function M(z,I){function U(ee,we){if(!Be(ee))throw new TypeError;if(!Z(we)&&!ge(we))throw new TypeError;de(z,I,ee,we)}return U}e("metadata",M);function G(z,I,U,ee){if(!Be(U))throw new TypeError;return Z(ee)||(ee=Qe(ee)),de(z,I,U,ee)}e("defineMetadata",G);function F(z,I,U){if(!Be(I))throw new TypeError;return Z(U)||(U=Qe(U)),k(z,I,U)}e("hasMetadata",F);function H(z,I,U){if(!Be(I))throw new TypeError;return Z(U)||(U=Qe(U)),S(z,I,U)}e("hasOwnMetadata",H);function W(z,I,U){if(!Be(I))throw new TypeError;return Z(U)||(U=Qe(U)),j(z,I,U)}e("getMetadata",W);function Y(z,I,U){if(!Be(I))throw new TypeError;return Z(U)||(U=Qe(U)),V(z,I,U)}e("getOwnMetadata",Y);function ue(z,I){if(!Be(z))throw new TypeError;return Z(I)||(I=Qe(I)),re(z,I)}e("getMetadataKeys",ue);function Ce(z,I){if(!Be(z))throw new TypeError;return Z(I)||(I=Qe(I)),ve(z,I)}e("getOwnMetadataKeys",Ce);function P(z,I,U){if(!Be(I))throw new TypeError;if(Z(U)||(U=Qe(U)),!Be(I))throw new TypeError;Z(U)||(U=Qe(U));var ee=me(I,U,!1);return Z(ee)?!1:ee.OrdinaryDeleteMetadata(z,I,U)}e("deleteMetadata",P);function L(z,I){for(var U=z.length-1;U>=0;--U){var ee=z[U],we=ee(I);if(!Z(we)&&!ye(we)){if(!he(we))throw new TypeError;I=we}}return I}function R(z,I,U,ee){for(var we=z.length-1;we>=0;--we){var et=z[we],Re=et(I,U,ee);if(!Z(Re)&&!ye(Re)){if(!Be(Re))throw new TypeError;ee=Re}}return ee}function k(z,I,U){var ee=S(z,I,U);if(ee)return!0;var we=zt(I);return ye(we)?!1:k(z,we,U)}function S(z,I,U){var ee=me(I,U,!1);return Z(ee)?!1:Q(ee.OrdinaryHasOwnMetadata(z,I,U))}function j(z,I,U){var ee=S(z,I,U);if(ee)return V(z,I,U);var we=zt(I);if(!ye(we))return j(z,we,U)}function V(z,I,U){var ee=me(I,U,!1);if(!Z(ee))return ee.OrdinaryGetOwnMetadata(z,I,U)}function de(z,I,U,ee){var we=me(U,ee,!0);we.OrdinaryDefineOwnMetadata(z,I,U,ee)}function re(z,I){var U=ve(z,I),ee=zt(z);if(ee===null)return U;var we=re(ee,I);if(we.length<=0)return U;if(U.length<=0)return we;for(var et=new A,Re=[],c=0,f=U;c<f.length;c++){var _=f[c],b=et.has(_);b||(et.add(_),Re.push(_))}for(var v=0,E=we;v<E.length;v++){var _=E[v],b=et.has(_);b||(et.add(_),Re.push(_))}return Re}function ve(z,I){var U=me(z,I,!1);return U?U.OrdinaryOwnMetadataKeys(z,I):[]}function Se(z){if(z===null)return 1;switch(typeof z){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return z===null?1:6;default:return 6}}function Z(z){return z===void 0}function ye(z){return z===null}function Bn(z){return typeof z=="symbol"}function Be(z){return typeof z=="object"?z!==null:typeof z=="function"}function Ge(z,I){switch(Se(z)){case 0:return z;case 1:return z;case 2:return z;case 3:return z;case 4:return z;case 5:return z}var U="string",ee=Rs(z,o);if(ee!==void 0){var we=ee.call(z,U);if(Be(we))throw new TypeError;return we}return Qt(z)}function Qt(z,I){var U,ee;{var we=z.toString;if(Fe(we)){var ee=we.call(z);if(!Be(ee))return ee}var U=z.valueOf;if(Fe(U)){var ee=U.call(z);if(!Be(ee))return ee}}throw new TypeError}function Q(z){return!!z}function oe(z){return""+z}function Qe(z){var I=Ge(z);return Bn(I)?I:oe(I)}function Ot(z){return Array.isArray?Array.isArray(z):z instanceof Object?z instanceof Array:Object.prototype.toString.call(z)==="[object Array]"}function Fe(z){return typeof z=="function"}function he(z){return typeof z=="function"}function ge(z){switch(Se(z)){case 3:return!0;case 4:return!0;default:return!1}}function lo(z,I){return z===I||z!==z&&I!==I}function Rs(z,I){var U=z[I];if(U!=null){if(!Fe(U))throw new TypeError;return U}}function pe(z){var I=Rs(z,a);if(!Fe(I))throw new TypeError;var U=I.call(z);if(!Be(U))throw new TypeError;return U}function at(z){return z.value}function Ps(z){var I=z.next();return I.done?!1:I}function se(z){var I=z.return;I&&I.call(z)}function zt(z){var I=Object.getPrototypeOf(z);if(typeof z!="function"||z===h||I!==h)return I;var U=z.prototype,ee=U&&Object.getPrototypeOf(U);if(ee==null||ee===Object.prototype)return I;var we=ee.constructor;return typeof we!="function"||we===z?I:we}function Ht(){var z;!Z(N)&&typeof n.Reflect<"u"&&!(N in n.Reflect)&&typeof n.Reflect.defineMetadata=="function"&&(z=en(n.Reflect));var I,U,ee,we=new $,et={registerProvider:Re,getProvider:f,setProvider:b};return et;function Re(v){if(!Object.isExtensible(et))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case z===v:break;case Z(I):I=v;break;case I===v:break;case Z(U):U=v;break;case U===v:break;default:ee===void 0&&(ee=new A),ee.add(v);break}}function c(v,E){if(!Z(I)){if(I.isProviderFor(v,E))return I;if(!Z(U)){if(U.isProviderFor(v,E))return I;if(!Z(ee))for(var K=pe(ee);;){var _e=Ps(K);if(!_e)return;var Ne=at(_e);if(Ne.isProviderFor(v,E))return se(K),Ne}}}if(!Z(z)&&z.isProviderFor(v,E))return z}function f(v,E){var K=we.get(v),_e;return Z(K)||(_e=K.get(E)),Z(_e)&&(_e=c(v,E),Z(_e)||(Z(K)&&(K=new g,we.set(v,K)),K.set(E,_e))),_e}function _(v){if(Z(v))throw new TypeError;return I===v||U===v||!Z(ee)&&ee.has(v)}function b(v,E,K){if(!_(K))throw new Error("Metadata provider not registered.");var _e=f(v,E);if(_e!==K){if(!Z(_e))return!1;var Ne=we.get(v);Z(Ne)&&(Ne=new g,we.set(v,Ne)),Ne.set(E,K)}return!0}}function wn(){var z;return!Z(N)&&Be(n.Reflect)&&Object.isExtensible(n.Reflect)&&(z=n.Reflect[N]),Z(z)&&(z=Ht()),!Z(N)&&Be(n.Reflect)&&Object.isExtensible(n.Reflect)&&Object.defineProperty(n.Reflect,N,{enumerable:!1,configurable:!1,writable:!1,value:z}),z}function bt(z){var I=new $,U={isProviderFor:function(_,b){var v=I.get(_);return Z(v)?!1:v.has(b)},OrdinaryDefineOwnMetadata:Re,OrdinaryHasOwnMetadata:we,OrdinaryGetOwnMetadata:et,OrdinaryOwnMetadataKeys:c,OrdinaryDeleteMetadata:f};return D.registerProvider(U),U;function ee(_,b,v){var E=I.get(_),K=!1;if(Z(E)){if(!v)return;E=new g,I.set(_,E),K=!0}var _e=E.get(b);if(Z(_e)){if(!v)return;if(_e=new g,E.set(b,_e),!z.setProvider(_,b,U))throw E.delete(b),K&&I.delete(_),new Error("Wrong provider for target.")}return _e}function we(_,b,v){var E=ee(b,v,!1);return Z(E)?!1:Q(E.has(_))}function et(_,b,v){var E=ee(b,v,!1);if(!Z(E))return E.get(_)}function Re(_,b,v,E){var K=ee(v,E,!0);K.set(_,b)}function c(_,b){var v=[],E=ee(_,b,!1);if(Z(E))return v;for(var K=E.keys(),_e=pe(K),Ne=0;;){var ie=Ps(_e);if(!ie)return v.length=Ne,v;var Ae=at(ie);try{v[Ne]=Ae}catch($t){try{se(_e)}finally{throw $t}}Ne++}}function f(_,b,v){var E=ee(b,v,!1);if(Z(E)||!E.delete(_))return!1;if(E.size===0){var K=I.get(b);Z(K)||(K.delete(v),K.size===0&&I.delete(K))}return!0}}function en(z){var I=z.defineMetadata,U=z.hasOwnMetadata,ee=z.getOwnMetadata,we=z.getOwnMetadataKeys,et=z.deleteMetadata,Re=new $,c={isProviderFor:function(f,_){var b=Re.get(f);return!Z(b)&&b.has(_)?!0:we(f,_).length?(Z(b)&&(b=new A,Re.set(f,b)),b.add(_),!0):!1},OrdinaryDefineOwnMetadata:I,OrdinaryHasOwnMetadata:U,OrdinaryGetOwnMetadata:ee,OrdinaryOwnMetadataKeys:we,OrdinaryDeleteMetadata:et};return c}function me(z,I,U){var ee=D.getProvider(z,I);if(!Z(ee))return ee;if(U){if(D.setProvider(z,I,O))return O;throw new Error("Illegal state.")}}function ae(){var z={},I=[],U=function(){function c(f,_,b){this._index=0,this._keys=f,this._values=_,this._selector=b}return c.prototype["@@iterator"]=function(){return this},c.prototype[a]=function(){return this},c.prototype.next=function(){var f=this._index;if(f>=0&&f<this._keys.length){var _=this._selector(this._keys[f],this._values[f]);return f+1>=this._keys.length?(this._index=-1,this._keys=I,this._values=I):this._index++,{value:_,done:!1}}return{value:void 0,done:!0}},c.prototype.throw=function(f){throw this._index>=0&&(this._index=-1,this._keys=I,this._values=I),f},c.prototype.return=function(f){return this._index>=0&&(this._index=-1,this._keys=I,this._values=I),{value:f,done:!0}},c}(),ee=function(){function c(){this._keys=[],this._values=[],this._cacheKey=z,this._cacheIndex=-2}return Object.defineProperty(c.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),c.prototype.has=function(f){return this._find(f,!1)>=0},c.prototype.get=function(f){var _=this._find(f,!1);return _>=0?this._values[_]:void 0},c.prototype.set=function(f,_){var b=this._find(f,!0);return this._values[b]=_,this},c.prototype.delete=function(f){var _=this._find(f,!1);if(_>=0){for(var b=this._keys.length,v=_+1;v<b;v++)this._keys[v-1]=this._keys[v],this._values[v-1]=this._values[v];return this._keys.length--,this._values.length--,lo(f,this._cacheKey)&&(this._cacheKey=z,this._cacheIndex=-2),!0}return!1},c.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=z,this._cacheIndex=-2},c.prototype.keys=function(){return new U(this._keys,this._values,we)},c.prototype.values=function(){return new U(this._keys,this._values,et)},c.prototype.entries=function(){return new U(this._keys,this._values,Re)},c.prototype["@@iterator"]=function(){return this.entries()},c.prototype[a]=function(){return this.entries()},c.prototype._find=function(f,_){if(!lo(this._cacheKey,f)){this._cacheIndex=-1;for(var b=0;b<this._keys.length;b++)if(lo(this._keys[b],f)){this._cacheIndex=b;break}}return this._cacheIndex<0&&_&&(this._cacheIndex=this._keys.length,this._keys.push(f),this._values.push(void 0)),this._cacheIndex},c}();return ee;function we(c,f){return c}function et(c,f){return f}function Re(c,f){return[c,f]}}function Kt(){var z=function(){function I(){this._map=new g}return Object.defineProperty(I.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),I.prototype.has=function(U){return this._map.has(U)},I.prototype.add=function(U){return this._map.set(U,U),this},I.prototype.delete=function(U){return this._map.delete(U)},I.prototype.clear=function(){this._map.clear()},I.prototype.keys=function(){return this._map.keys()},I.prototype.values=function(){return this._map.keys()},I.prototype.entries=function(){return this._map.entries()},I.prototype["@@iterator"]=function(){return this.keys()},I.prototype[a]=function(){return this.keys()},I}();return z}function Dt(){var z=16,I=p.create(),U=ee();return function(){function f(){this._key=ee()}return f.prototype.has=function(_){var b=we(_,!1);return b!==void 0?p.has(b,this._key):!1},f.prototype.get=function(_){var b=we(_,!1);return b!==void 0?p.get(b,this._key):void 0},f.prototype.set=function(_,b){var v=we(_,!0);return v[this._key]=b,this},f.prototype.delete=function(_){var b=we(_,!1);return b!==void 0?delete b[this._key]:!1},f.prototype.clear=function(){this._key=ee()},f}();function ee(){var f;do f="@@WeakMap@@"+c();while(p.has(I,f));return I[f]=!0,f}function we(f,_){if(!r.call(f,U)){if(!_)return;Object.defineProperty(f,U,{value:p.create()})}return f[U]}function et(f,_){for(var b=0;b<_;++b)f[b]=Math.random()*255|0;return f}function Re(f){if(typeof Uint8Array=="function"){var _=new Uint8Array(f);return typeof crypto<"u"?crypto.getRandomValues(_):typeof msCrypto<"u"?msCrypto.getRandomValues(_):et(_,f),_}return et(new Array(f),f)}function c(){var f=Re(z);f[6]=f[6]&79|64,f[8]=f[8]&191|128;for(var _="",b=0;b<z;++b){var v=f[b];(b===4||b===6||b===8)&&(_+="-"),v<16&&(_+="0"),_+=v.toString(16).toLowerCase()}return _}}function vn(z){return z.__=void 0,delete z.__,z}})})(xh||(xh={}));/*!
85
+ ***************************************************************************** */var xh;(function(t){(function(e){var n=typeof globalThis=="object"?globalThis:typeof Br=="object"?Br:typeof self=="object"?self:typeof this=="object"?this:l(),r=i(t);typeof n.Reflect<"u"&&(r=i(n.Reflect,r)),e(r,n),typeof n.Reflect>"u"&&(n.Reflect=t);function i(u,d){return function(p,h){Object.defineProperty(u,p,{configurable:!0,writable:!0,value:h}),d&&d(p,h)}}function o(){try{return Function("return this;")()}catch{}}function a(){try{return(0,eval)("(function() { return this; })()")}catch{}}function l(){return o()||a()}})(function(e,n){var r=Object.prototype.hasOwnProperty,i=typeof Symbol=="function",o=i&&typeof Symbol.toPrimitive<"u"?Symbol.toPrimitive:"@@toPrimitive",a=i&&typeof Symbol.iterator<"u"?Symbol.iterator:"@@iterator",l=typeof Object.create=="function",u={__proto__:[]}instanceof Array,d=!l&&!u,p={create:l?function(){return vn(Object.create(null))}:u?function(){return vn({__proto__:null})}:function(){return vn({})},has:d?function(z,I){return r.call(z,I)}:function(z,I){return I in z},get:d?function(z,I){return r.call(z,I)?z[I]:void 0}:function(z,I){return z[I]}},h=Object.getPrototypeOf(Function),g=typeof Map=="function"&&typeof Map.prototype.entries=="function"?Map:ae(),A=typeof Set=="function"&&typeof Set.prototype.entries=="function"?Set:Kt(),$=typeof WeakMap=="function"?WeakMap:Dt(),N=i?Symbol.for("@reflect-metadata:registry"):void 0,D=wn(),O=bt(D);function x(z,I,U,ee){if(Z(U)){if(!Ot(z))throw new TypeError;if(!he(I))throw new TypeError;return L(z,I)}else{if(!Ot(z))throw new TypeError;if(!Be(I))throw new TypeError;if(!Be(ee)&&!Z(ee)&&!ye(ee))throw new TypeError;return ye(ee)&&(ee=void 0),U=Ze(U),R(z,I,U,ee)}}e("decorate",x);function M(z,I){function U(ee,we){if(!Be(ee))throw new TypeError;if(!Z(we)&&!ge(we))throw new TypeError;de(z,I,ee,we)}return U}e("metadata",M);function G(z,I,U,ee){if(!Be(U))throw new TypeError;return Z(ee)||(ee=Ze(ee)),de(z,I,U,ee)}e("defineMetadata",G);function F(z,I,U){if(!Be(I))throw new TypeError;return Z(U)||(U=Ze(U)),k(z,I,U)}e("hasMetadata",F);function H(z,I,U){if(!Be(I))throw new TypeError;return Z(U)||(U=Ze(U)),S(z,I,U)}e("hasOwnMetadata",H);function W(z,I,U){if(!Be(I))throw new TypeError;return Z(U)||(U=Ze(U)),j(z,I,U)}e("getMetadata",W);function Y(z,I,U){if(!Be(I))throw new TypeError;return Z(U)||(U=Ze(U)),V(z,I,U)}e("getOwnMetadata",Y);function ue(z,I){if(!Be(z))throw new TypeError;return Z(I)||(I=Ze(I)),re(z,I)}e("getMetadataKeys",ue);function Ce(z,I){if(!Be(z))throw new TypeError;return Z(I)||(I=Ze(I)),ve(z,I)}e("getOwnMetadataKeys",Ce);function P(z,I,U){if(!Be(I))throw new TypeError;if(Z(U)||(U=Ze(U)),!Be(I))throw new TypeError;Z(U)||(U=Ze(U));var ee=me(I,U,!1);return Z(ee)?!1:ee.OrdinaryDeleteMetadata(z,I,U)}e("deleteMetadata",P);function L(z,I){for(var U=z.length-1;U>=0;--U){var ee=z[U],we=ee(I);if(!Z(we)&&!ye(we)){if(!he(we))throw new TypeError;I=we}}return I}function R(z,I,U,ee){for(var we=z.length-1;we>=0;--we){var Qe=z[we],Re=Qe(I,U,ee);if(!Z(Re)&&!ye(Re)){if(!Be(Re))throw new TypeError;ee=Re}}return ee}function k(z,I,U){var ee=S(z,I,U);if(ee)return!0;var we=zt(I);return ye(we)?!1:k(z,we,U)}function S(z,I,U){var ee=me(I,U,!1);return Z(ee)?!1:Q(ee.OrdinaryHasOwnMetadata(z,I,U))}function j(z,I,U){var ee=S(z,I,U);if(ee)return V(z,I,U);var we=zt(I);if(!ye(we))return j(z,we,U)}function V(z,I,U){var ee=me(I,U,!1);if(!Z(ee))return ee.OrdinaryGetOwnMetadata(z,I,U)}function de(z,I,U,ee){var we=me(U,ee,!0);we.OrdinaryDefineOwnMetadata(z,I,U,ee)}function re(z,I){var U=ve(z,I),ee=zt(z);if(ee===null)return U;var we=re(ee,I);if(we.length<=0)return U;if(U.length<=0)return we;for(var Qe=new A,Re=[],c=0,f=U;c<f.length;c++){var _=f[c],b=Qe.has(_);b||(Qe.add(_),Re.push(_))}for(var v=0,E=we;v<E.length;v++){var _=E[v],b=Qe.has(_);b||(Qe.add(_),Re.push(_))}return Re}function ve(z,I){var U=me(z,I,!1);return U?U.OrdinaryOwnMetadataKeys(z,I):[]}function Se(z){if(z===null)return 1;switch(typeof z){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return z===null?1:6;default:return 6}}function Z(z){return z===void 0}function ye(z){return z===null}function Bn(z){return typeof z=="symbol"}function Be(z){return typeof z=="object"?z!==null:typeof z=="function"}function Ke(z,I){switch(Se(z)){case 0:return z;case 1:return z;case 2:return z;case 3:return z;case 4:return z;case 5:return z}var U="string",ee=Rs(z,o);if(ee!==void 0){var we=ee.call(z,U);if(Be(we))throw new TypeError;return we}return Qt(z)}function Qt(z,I){var U,ee;{var we=z.toString;if(Fe(we)){var ee=we.call(z);if(!Be(ee))return ee}var U=z.valueOf;if(Fe(U)){var ee=U.call(z);if(!Be(ee))return ee}}throw new TypeError}function Q(z){return!!z}function oe(z){return""+z}function Ze(z){var I=Ke(z);return Bn(I)?I:oe(I)}function Ot(z){return Array.isArray?Array.isArray(z):z instanceof Object?z instanceof Array:Object.prototype.toString.call(z)==="[object Array]"}function Fe(z){return typeof z=="function"}function he(z){return typeof z=="function"}function ge(z){switch(Se(z)){case 3:return!0;case 4:return!0;default:return!1}}function lo(z,I){return z===I||z!==z&&I!==I}function Rs(z,I){var U=z[I];if(U!=null){if(!Fe(U))throw new TypeError;return U}}function pe(z){var I=Rs(z,a);if(!Fe(I))throw new TypeError;var U=I.call(z);if(!Be(U))throw new TypeError;return U}function st(z){return z.value}function Ps(z){var I=z.next();return I.done?!1:I}function se(z){var I=z.return;I&&I.call(z)}function zt(z){var I=Object.getPrototypeOf(z);if(typeof z!="function"||z===h||I!==h)return I;var U=z.prototype,ee=U&&Object.getPrototypeOf(U);if(ee==null||ee===Object.prototype)return I;var we=ee.constructor;return typeof we!="function"||we===z?I:we}function Ht(){var z;!Z(N)&&typeof n.Reflect<"u"&&!(N in n.Reflect)&&typeof n.Reflect.defineMetadata=="function"&&(z=en(n.Reflect));var I,U,ee,we=new $,Qe={registerProvider:Re,getProvider:f,setProvider:b};return Qe;function Re(v){if(!Object.isExtensible(Qe))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case z===v:break;case Z(I):I=v;break;case I===v:break;case Z(U):U=v;break;case U===v:break;default:ee===void 0&&(ee=new A),ee.add(v);break}}function c(v,E){if(!Z(I)){if(I.isProviderFor(v,E))return I;if(!Z(U)){if(U.isProviderFor(v,E))return I;if(!Z(ee))for(var K=pe(ee);;){var _e=Ps(K);if(!_e)return;var Ne=st(_e);if(Ne.isProviderFor(v,E))return se(K),Ne}}}if(!Z(z)&&z.isProviderFor(v,E))return z}function f(v,E){var K=we.get(v),_e;return Z(K)||(_e=K.get(E)),Z(_e)&&(_e=c(v,E),Z(_e)||(Z(K)&&(K=new g,we.set(v,K)),K.set(E,_e))),_e}function _(v){if(Z(v))throw new TypeError;return I===v||U===v||!Z(ee)&&ee.has(v)}function b(v,E,K){if(!_(K))throw new Error("Metadata provider not registered.");var _e=f(v,E);if(_e!==K){if(!Z(_e))return!1;var Ne=we.get(v);Z(Ne)&&(Ne=new g,we.set(v,Ne)),Ne.set(E,K)}return!0}}function wn(){var z;return!Z(N)&&Be(n.Reflect)&&Object.isExtensible(n.Reflect)&&(z=n.Reflect[N]),Z(z)&&(z=Ht()),!Z(N)&&Be(n.Reflect)&&Object.isExtensible(n.Reflect)&&Object.defineProperty(n.Reflect,N,{enumerable:!1,configurable:!1,writable:!1,value:z}),z}function bt(z){var I=new $,U={isProviderFor:function(_,b){var v=I.get(_);return Z(v)?!1:v.has(b)},OrdinaryDefineOwnMetadata:Re,OrdinaryHasOwnMetadata:we,OrdinaryGetOwnMetadata:Qe,OrdinaryOwnMetadataKeys:c,OrdinaryDeleteMetadata:f};return D.registerProvider(U),U;function ee(_,b,v){var E=I.get(_),K=!1;if(Z(E)){if(!v)return;E=new g,I.set(_,E),K=!0}var _e=E.get(b);if(Z(_e)){if(!v)return;if(_e=new g,E.set(b,_e),!z.setProvider(_,b,U))throw E.delete(b),K&&I.delete(_),new Error("Wrong provider for target.")}return _e}function we(_,b,v){var E=ee(b,v,!1);return Z(E)?!1:Q(E.has(_))}function Qe(_,b,v){var E=ee(b,v,!1);if(!Z(E))return E.get(_)}function Re(_,b,v,E){var K=ee(v,E,!0);K.set(_,b)}function c(_,b){var v=[],E=ee(_,b,!1);if(Z(E))return v;for(var K=E.keys(),_e=pe(K),Ne=0;;){var ie=Ps(_e);if(!ie)return v.length=Ne,v;var Ae=st(ie);try{v[Ne]=Ae}catch($t){try{se(_e)}finally{throw $t}}Ne++}}function f(_,b,v){var E=ee(b,v,!1);if(Z(E)||!E.delete(_))return!1;if(E.size===0){var K=I.get(b);Z(K)||(K.delete(v),K.size===0&&I.delete(K))}return!0}}function en(z){var I=z.defineMetadata,U=z.hasOwnMetadata,ee=z.getOwnMetadata,we=z.getOwnMetadataKeys,Qe=z.deleteMetadata,Re=new $,c={isProviderFor:function(f,_){var b=Re.get(f);return!Z(b)&&b.has(_)?!0:we(f,_).length?(Z(b)&&(b=new A,Re.set(f,b)),b.add(_),!0):!1},OrdinaryDefineOwnMetadata:I,OrdinaryHasOwnMetadata:U,OrdinaryGetOwnMetadata:ee,OrdinaryOwnMetadataKeys:we,OrdinaryDeleteMetadata:Qe};return c}function me(z,I,U){var ee=D.getProvider(z,I);if(!Z(ee))return ee;if(U){if(D.setProvider(z,I,O))return O;throw new Error("Illegal state.")}}function ae(){var z={},I=[],U=function(){function c(f,_,b){this._index=0,this._keys=f,this._values=_,this._selector=b}return c.prototype["@@iterator"]=function(){return this},c.prototype[a]=function(){return this},c.prototype.next=function(){var f=this._index;if(f>=0&&f<this._keys.length){var _=this._selector(this._keys[f],this._values[f]);return f+1>=this._keys.length?(this._index=-1,this._keys=I,this._values=I):this._index++,{value:_,done:!1}}return{value:void 0,done:!0}},c.prototype.throw=function(f){throw this._index>=0&&(this._index=-1,this._keys=I,this._values=I),f},c.prototype.return=function(f){return this._index>=0&&(this._index=-1,this._keys=I,this._values=I),{value:f,done:!0}},c}(),ee=function(){function c(){this._keys=[],this._values=[],this._cacheKey=z,this._cacheIndex=-2}return Object.defineProperty(c.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),c.prototype.has=function(f){return this._find(f,!1)>=0},c.prototype.get=function(f){var _=this._find(f,!1);return _>=0?this._values[_]:void 0},c.prototype.set=function(f,_){var b=this._find(f,!0);return this._values[b]=_,this},c.prototype.delete=function(f){var _=this._find(f,!1);if(_>=0){for(var b=this._keys.length,v=_+1;v<b;v++)this._keys[v-1]=this._keys[v],this._values[v-1]=this._values[v];return this._keys.length--,this._values.length--,lo(f,this._cacheKey)&&(this._cacheKey=z,this._cacheIndex=-2),!0}return!1},c.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=z,this._cacheIndex=-2},c.prototype.keys=function(){return new U(this._keys,this._values,we)},c.prototype.values=function(){return new U(this._keys,this._values,Qe)},c.prototype.entries=function(){return new U(this._keys,this._values,Re)},c.prototype["@@iterator"]=function(){return this.entries()},c.prototype[a]=function(){return this.entries()},c.prototype._find=function(f,_){if(!lo(this._cacheKey,f)){this._cacheIndex=-1;for(var b=0;b<this._keys.length;b++)if(lo(this._keys[b],f)){this._cacheIndex=b;break}}return this._cacheIndex<0&&_&&(this._cacheIndex=this._keys.length,this._keys.push(f),this._values.push(void 0)),this._cacheIndex},c}();return ee;function we(c,f){return c}function Qe(c,f){return f}function Re(c,f){return[c,f]}}function Kt(){var z=function(){function I(){this._map=new g}return Object.defineProperty(I.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),I.prototype.has=function(U){return this._map.has(U)},I.prototype.add=function(U){return this._map.set(U,U),this},I.prototype.delete=function(U){return this._map.delete(U)},I.prototype.clear=function(){this._map.clear()},I.prototype.keys=function(){return this._map.keys()},I.prototype.values=function(){return this._map.keys()},I.prototype.entries=function(){return this._map.entries()},I.prototype["@@iterator"]=function(){return this.keys()},I.prototype[a]=function(){return this.keys()},I}();return z}function Dt(){var z=16,I=p.create(),U=ee();return function(){function f(){this._key=ee()}return f.prototype.has=function(_){var b=we(_,!1);return b!==void 0?p.has(b,this._key):!1},f.prototype.get=function(_){var b=we(_,!1);return b!==void 0?p.get(b,this._key):void 0},f.prototype.set=function(_,b){var v=we(_,!0);return v[this._key]=b,this},f.prototype.delete=function(_){var b=we(_,!1);return b!==void 0?delete b[this._key]:!1},f.prototype.clear=function(){this._key=ee()},f}();function ee(){var f;do f="@@WeakMap@@"+c();while(p.has(I,f));return I[f]=!0,f}function we(f,_){if(!r.call(f,U)){if(!_)return;Object.defineProperty(f,U,{value:p.create()})}return f[U]}function Qe(f,_){for(var b=0;b<_;++b)f[b]=Math.random()*255|0;return f}function Re(f){if(typeof Uint8Array=="function"){var _=new Uint8Array(f);return typeof crypto<"u"?crypto.getRandomValues(_):typeof msCrypto<"u"?msCrypto.getRandomValues(_):Qe(_,f),_}return Qe(new Array(f),f)}function c(){var f=Re(z);f[6]=f[6]&79|64,f[8]=f[8]&191|128;for(var _="",b=0;b<z;++b){var v=f[b];(b===4||b===6||b===8)&&(_+="-"),v<16&&(_+="0"),_+=v.toString(16).toLowerCase()}return _}}function vn(z){return z.__=void 0,delete z.__,z}})})(xh||(xh={}));/*!
86
86
  * MIT License
87
87
  *
88
88
  * Copyright (c) 2017-2024 Peculiar Ventures, LLC
@@ -143,7 +143,7 @@ and limitations under the License.
143
143
  `).map(i=>` ${i}`).join(`
144
144
  `));const n=this.idBlock.tagClass===3?`[${this.idBlock.tagNumber}]`:this.constructor.NAME;return e.length?`${n} :
145
145
  ${e.join(`
146
- `)}`:`${n} :`}}U_=yt;le.Constructed=U_;yt.NAME="CONSTRUCTED";class M_ extends wt{fromBER(e,n,r){return n}toBER(e){return _n}}M_.override="EndOfContentValueBlock";var q_;class Np extends dt{constructor(e={}){super(e,M_),this.idBlock.tagClass=1,this.idBlock.tagNumber=0}}q_=Np;le.EndOfContent=q_;Np.NAME=zo;var V_;class Hr extends dt{constructor(e={}){super(e,wt),this.idBlock.tagClass=1,this.idBlock.tagNumber=5}fromBER(e,n,r){return this.lenBlock.length>0&&this.warnings.push("Non-zero length of value block for Null type"),this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.blockLength+=r,n+r>e.byteLength?(this.error="End of input reached before message was fully decoded (inconsistent offset and length values)",-1):n+r}toBER(e,n){const r=new ArrayBuffer(2);if(!e){const i=new Uint8Array(r);i[0]=5,i[1]=0}return n&&n.write(r),r}onAsciiEncoding(){return`${this.constructor.NAME}`}}V_=Hr;le.Null=V_;Hr.NAME="NULL";class H_ extends On(wt){get value(){for(const e of this.valueHexView)if(e>0)return!0;return!1}set value(e){this.valueHexView[0]=e?255:0}constructor({value:e,...n}={}){super(n),n.valueHex?this.valueHexView=ne.toUint8Array(n.valueHex):this.valueHexView=new Uint8Array(1),e&&(this.value=e)}fromBER(e,n,r){const i=ne.toUint8Array(e);return Qn(this,i,n,r)?(this.valueHexView=i.subarray(n,n+r),r>1&&this.warnings.push("Boolean value encoded in more then 1 octet"),this.isHexOnly=!0,z_.call(this),this.blockLength=r,n+r):-1}toBER(){return this.valueHexView.slice()}toJSON(){return{...super.toJSON(),value:this.value}}}H_.NAME="BooleanValueBlock";var K_;let zc=class extends dt{getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}constructor(e={}){super(e,H_),this.idBlock.tagClass=1,this.idBlock.tagNumber=1}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.getValue}`}};K_=zc;le.Boolean=K_;zc.NAME="BOOLEAN";class G_ extends On(gr){constructor({isConstructed:e=!1,...n}={}){super(n),this.isConstructed=e}fromBER(e,n,r){let i=0;if(this.isConstructed){if(this.isHexOnly=!1,i=gr.prototype.fromBER.call(this,e,n,r),i===-1)return i;for(let o=0;o<this.value.length;o++){const a=this.value[o].constructor.NAME;if(a===zo){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, OCTET STRING may consists of OCTET STRINGs only",-1}if(a!==D_)return this.error="OCTET STRING may consists of OCTET STRINGs only",-1}}else this.isHexOnly=!0,i=super.fromBER(e,n,r),this.blockLength=r;return i}toBER(e,n){return this.isConstructed?gr.prototype.toBER.call(this,e,n):e?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),isConstructed:this.isConstructed}}}G_.NAME="OctetStringValueBlock";var Cp;let Ur=class extends dt{constructor({idBlock:e={},lenBlock:n={},...r}={}){var i,o;(i=r.isConstructed)!==null&&i!==void 0||(r.isConstructed=!!(!((o=r.value)===null||o===void 0)&&o.length)),super({idBlock:{isConstructed:r.isConstructed,...e},lenBlock:{...n,isIndefiniteForm:!!r.isIndefiniteForm},...r},G_),this.idBlock.tagClass=1,this.idBlock.tagNumber=4}fromBER(e,n,r){if(this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,r===0)return this.idBlock.error.length===0&&(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length===0&&(this.blockLength+=this.lenBlock.blockLength),n;if(!this.valueBlock.isConstructed){const o=(e instanceof ArrayBuffer?new Uint8Array(e):e).subarray(n,n+r);try{if(o.byteLength){const a=Ji(o,0,o.byteLength);a.offset!==-1&&a.offset===r&&(this.valueBlock.value=[a.result])}}catch{}}return super.fromBER(e,n,r)}onAsciiEncoding(){if(this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length)return yt.prototype.onAsciiEncoding.call(this);const e=this.constructor.NAME,n=fe.ToHex(this.valueBlock.valueHexView);return`${e} : ${n}`}getValue(){if(!this.idBlock.isConstructed)return this.valueBlock.valueHexView.slice().buffer;const e=[];for(const n of this.valueBlock.value)n instanceof Cp&&e.push(n.valueBlock.valueHexView);return ne.concat(e)}};Cp=Ur;le.OctetString=Cp;Ur.NAME=D_;class W_ extends On(gr){constructor({unusedBits:e=0,isConstructed:n=!1,...r}={}){super(r),this.unusedBits=e,this.isConstructed=n,this.blockLength=this.valueHexView.byteLength}fromBER(e,n,r){if(!r)return n;let i=-1;if(this.isConstructed){if(i=gr.prototype.fromBER.call(this,e,n,r),i===-1)return i;for(const l of this.value){const u=l.constructor.NAME;if(u===zo){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, BIT STRING may consists of BIT STRINGs only",-1}if(u!==R_)return this.error="BIT STRING may consists of BIT STRINGs only",-1;const d=l.valueBlock;if(this.unusedBits>0&&d.unusedBits>0)return this.error='Using of "unused bits" inside constructive BIT STRING allowed for least one only',-1;this.unusedBits=d.unusedBits}return i}const o=ne.toUint8Array(e);if(!Qn(this,o,n,r))return-1;const a=o.subarray(n,n+r);if(this.unusedBits=a[0],this.unusedBits>7)return this.error="Unused bits for BitString must be in range 0-7",-1;if(!this.unusedBits){const l=a.subarray(1);try{if(l.byteLength){const u=Ji(l,0,l.byteLength);u.offset!==-1&&u.offset===r-1&&(this.value=[u.result])}}catch{}}return this.valueHexView=a.subarray(1),this.blockLength=a.length,n+r}toBER(e,n){if(this.isConstructed)return gr.prototype.toBER.call(this,e,n);if(e)return new ArrayBuffer(this.valueHexView.byteLength+1);if(!this.valueHexView.byteLength)return _n;const r=new Uint8Array(this.valueHexView.length+1);return r[0]=this.unusedBits,r.set(this.valueHexView,1),r.buffer}toJSON(){return{...super.toJSON(),unusedBits:this.unusedBits,isConstructed:this.isConstructed}}}W_.NAME="BitStringValueBlock";var X_;let Mr=class extends dt{constructor({idBlock:e={},lenBlock:n={},...r}={}){var i,o;(i=r.isConstructed)!==null&&i!==void 0||(r.isConstructed=!!(!((o=r.value)===null||o===void 0)&&o.length)),super({idBlock:{isConstructed:r.isConstructed,...e},lenBlock:{...n,isIndefiniteForm:!!r.isIndefiniteForm},...r},W_),this.idBlock.tagClass=1,this.idBlock.tagNumber=3}fromBER(e,n,r){return this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,super.fromBER(e,n,r)}onAsciiEncoding(){if(this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length)return yt.prototype.onAsciiEncoding.call(this);{const e=[],n=this.valueBlock.valueHexView;for(const a of n)e.push(a.toString(2).padStart(8,"0"));const r=e.join(""),i=this.constructor.NAME,o=r.substring(0,r.length-this.valueBlock.unusedBits);return`${i} : ${o}`}}};X_=Mr;le.BitString=X_;Mr.NAME=R_;var J_;function z3(t,e){const n=new Uint8Array([0]),r=new Uint8Array(t),i=new Uint8Array(e);let o=r.slice(0);const a=o.length-1,l=i.slice(0),u=l.length-1;let d=0;const p=u<a?a:u;let h=0;for(let g=p;g>=0;g--,h++){switch(!0){case h<l.length:d=o[a-h]+l[u-h]+n[0];break;default:d=o[a-h]+n[0]}switch(n[0]=d/10,!0){case h>=o.length:o=ku(new Uint8Array([d%10]),o);break;default:o[a-h]=d%10}}return n[0]>0&&(o=ku(n,o)),o}function kh(t){if(t>=ho.length)for(let e=ho.length;e<=t;e++){const n=new Uint8Array([0]);let r=ho[e-1].slice(0);for(let i=r.length-1;i>=0;i--){const o=new Uint8Array([(r[i]<<1)+n[0]]);n[0]=o[0]/10,r[i]=o[0]%10}n[0]>0&&(r=ku(n,r)),ho.push(r)}return ho[t]}function D3(t,e){let n=0;const r=new Uint8Array(t),i=new Uint8Array(e),o=r.slice(0),a=o.length-1,l=i.slice(0),u=l.length-1;let d,p=0;for(let h=u;h>=0;h--,p++)switch(d=o[a-p]-l[u-p]-n,!0){case d<0:n=1,o[a-p]=d+10;break;default:n=0,o[a-p]=d}if(n>0)for(let h=a-u+1;h>=0;h--,p++)if(d=o[a-p]-n,d<0)n=1,o[a-p]=d+10;else{n=0,o[a-p]=d;break}return o.slice()}class Tp extends On(wt){setValueHex(){this.valueHexView.length>=4?(this.warnings.push("Too big Integer for decoding, hex only"),this.isHexOnly=!0,this._valueDec=0):(this.isHexOnly=!1,this.valueHexView.length>0&&(this._valueDec=z_.call(this)))}constructor({value:e,...n}={}){super(n),this._valueDec=0,n.valueHex&&this.setValueHex(),e!==void 0&&(this.valueDec=e)}set valueDec(e){this._valueDec=e,this.isHexOnly=!1,this.valueHexView=new Uint8Array(b3(e))}get valueDec(){return this._valueDec}fromDER(e,n,r,i=0){const o=this.fromBER(e,n,r);if(o===-1)return o;const a=this.valueHexView;return a[0]===0&&a[1]&128?this.valueHexView=a.subarray(1):i!==0&&a.length<i&&(i-a.length>1&&(i=a.length+1),this.valueHexView=a.subarray(i-a.length)),o}toDER(e=!1){const n=this.valueHexView;switch(!0){case(n[0]&128)!==0:{const r=new Uint8Array(this.valueHexView.length+1);r[0]=0,r.set(n,1),this.valueHexView=r}break;case(n[0]===0&&(n[1]&128)===0):this.valueHexView=this.valueHexView.subarray(1);break}return this.toBER(e)}fromBER(e,n,r){const i=super.fromBER(e,n,r);return i===-1||this.setValueHex(),i}toBER(e){return e?new ArrayBuffer(this.valueHexView.length):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}toString(){const e=this.valueHexView.length*8-1;let n=new Uint8Array(this.valueHexView.length*8/3),r=0,i;const o=this.valueHexView;let a="",l=!1;for(let u=o.byteLength-1;u>=0;u--){i=o[u];for(let d=0;d<8;d++){if((i&1)===1)switch(r){case e:n=D3(kh(r),n),a="-";break;default:n=z3(n,kh(r))}r++,i>>=1}}for(let u=0;u<n.length;u++)n[u]&&(l=!0),l&&(a+=Eh.charAt(n[u]));return l===!1&&(a+=Eh.charAt(0)),a}}J_=Tp;Tp.NAME="IntegerValueBlock";Object.defineProperty(J_.prototype,"valueHex",{set:function(t){this.valueHexView=new Uint8Array(t),this.setValueHex()},get:function(){return this.valueHexView.slice().buffer}});var $o;class Yi extends dt{constructor(e={}){super(e,Tp),this.idBlock.tagClass=1,this.idBlock.tagNumber=2}toBigInt(){return Na(),BigInt(this.valueBlock.toString())}static fromBigInt(e){Na();const n=BigInt(e),r=new Ic,i=n.toString(16).replace(/^-/,""),o=new Uint8Array(fe.FromHex(i));if(n<0){const l=new Uint8Array(o.length+(o[0]&128?1:0));l[0]|=128;const d=BigInt(`0x${fe.ToHex(l)}`)+n,p=ne.toUint8Array(fe.FromHex(d.toString(16)));p[0]|=128,r.write(p)}else o[0]&128&&r.write(new Uint8Array([0])),r.write(o);return new $o({valueHex:r.final()})}convertToDER(){const e=new $o({valueHex:this.valueBlock.valueHexView});return e.valueBlock.toDER(),e}convertFromDER(){return new $o({valueHex:this.valueBlock.valueHexView[0]===0?this.valueBlock.valueHexView.subarray(1):this.valueBlock.valueHexView})}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()}`}}$o=Yi;le.Integer=$o;Yi.NAME="INTEGER";var Y_;class Dc extends Yi{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=10}}Y_=Dc;le.Enumerated=Y_;Dc.NAME="ENUMERATED";class Nu extends On(wt){constructor({valueDec:e=-1,isFirstSid:n=!1,...r}={}){super(r),this.valueDec=e,this.isFirstSid=n}fromBER(e,n,r){if(!r)return n;const i=ne.toUint8Array(e);if(!Qn(this,i,n,r))return-1;const o=i.subarray(n,n+r);this.valueHexView=new Uint8Array(r);for(let l=0;l<r&&(this.valueHexView[l]=o[l]&127,this.blockLength++,!!(o[l]&128));l++);const a=new Uint8Array(this.blockLength);for(let l=0;l<this.blockLength;l++)a[l]=this.valueHexView[l];return this.valueHexView=a,o[this.blockLength-1]&128?(this.error="End of input reached before message was fully decoded",-1):(this.valueHexView[0]===0&&this.warnings.push("Needlessly long format of SID encoding"),this.blockLength<=8?this.valueDec=Ii(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),n+this.blockLength)}set valueBigInt(e){Na();let n=BigInt(e).toString(2);for(;n.length%7;)n="0"+n;const r=new Uint8Array(n.length/7);for(let i=0;i<r.length;i++)r[i]=parseInt(n.slice(i*7,i*7+7),2)+(i+1<r.length?128:0);this.fromBER(r.buffer,0,r.length)}toBER(e){if(this.isHexOnly){if(e)return new ArrayBuffer(this.valueHexView.byteLength);const i=this.valueHexView,o=new Uint8Array(this.blockLength);for(let a=0;a<this.blockLength-1;a++)o[a]=i[a]|128;return o[this.blockLength-1]=i[this.blockLength-1],o.buffer}const n=Vr(this.valueDec,7);if(n.byteLength===0)return this.error="Error during encoding SID value",_n;const r=new Uint8Array(n.byteLength);if(!e){const i=new Uint8Array(n),o=n.byteLength-1;for(let a=0;a<o;a++)r[a]=i[a]|128;r[o]=i[o]}return r}toString(){let e="";if(this.isHexOnly)e=fe.ToHex(this.valueHexView);else if(this.isFirstSid){let n=this.valueDec;this.valueDec<=39?e="0.":this.valueDec<=79?(e="1.",n-=40):(e="2.",n-=80),e+=n.toString()}else e=this.valueDec.toString();return e}toJSON(){return{...super.toJSON(),valueDec:this.valueDec,isFirstSid:this.isFirstSid}}}Nu.NAME="sidBlock";class Z_ extends wt{constructor({value:e=Et,...n}={}){super(n),this.value=[],e&&this.fromString(e)}fromBER(e,n,r){let i=n;for(;r>0;){const o=new Nu;if(i=o.fromBER(e,i,r),i===-1)return this.blockLength=0,this.error=o.error,i;this.value.length===0&&(o.isFirstSid=!0),this.blockLength+=o.blockLength,r-=o.blockLength,this.value.push(o)}return i}toBER(e){const n=[];for(let r=0;r<this.value.length;r++){const i=this.value[r].toBER(e);if(i.byteLength===0)return this.error=this.value[r].error,_n;n.push(i)}return Sp(n)}fromString(e){this.value=[];let n=0,r=0,i="",o=!1;do if(r=e.indexOf(".",n),r===-1?i=e.substring(n):i=e.substring(n,r),n=r+1,o){const a=this.value[0];let l=0;switch(a.valueDec){case 0:break;case 1:l=40;break;case 2:l=80;break;default:this.value=[];return}const u=parseInt(i,10);if(isNaN(u))return;a.valueDec=u+l,o=!1}else{const a=new Nu;if(i>Number.MAX_SAFE_INTEGER){Na();const l=BigInt(i);a.valueBigInt=l}else if(a.valueDec=parseInt(i,10),isNaN(a.valueDec))return;this.value.length||(a.isFirstSid=!0,o=!0),this.value.push(a)}while(r!==-1)}toString(){let e="",n=!1;for(let r=0;r<this.value.length;r++){n=this.value[r].isHexOnly;let i=this.value[r].toString();r!==0&&(e=`${e}.`),n?(i=`{${i}}`,this.value[r].isFirstSid?e=`2.{${i} - 80}`:e+=i):e+=i}return e}toJSON(){const e={...super.toJSON(),value:this.toString(),sidArray:[]};for(let n=0;n<this.value.length;n++)e.sidArray.push(this.value[n].toJSON());return e}}Z_.NAME="ObjectIdentifierValueBlock";var Q_;class Rc extends dt{getValue(){return this.valueBlock.toString()}setValue(e){this.valueBlock.fromString(e)}constructor(e={}){super(e,Z_),this.idBlock.tagClass=1,this.idBlock.tagNumber=6}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return{...super.toJSON(),value:this.getValue()}}}Q_=Rc;le.ObjectIdentifier=Q_;Rc.NAME="OBJECT IDENTIFIER";class Cu extends On(si){constructor({valueDec:e=0,...n}={}){super(n),this.valueDec=e}fromBER(e,n,r){if(r===0)return n;const i=ne.toUint8Array(e);if(!Qn(this,i,n,r))return-1;const o=i.subarray(n,n+r);this.valueHexView=new Uint8Array(r);for(let l=0;l<r&&(this.valueHexView[l]=o[l]&127,this.blockLength++,!!(o[l]&128));l++);const a=new Uint8Array(this.blockLength);for(let l=0;l<this.blockLength;l++)a[l]=this.valueHexView[l];return this.valueHexView=a,o[this.blockLength-1]&128?(this.error="End of input reached before message was fully decoded",-1):(this.valueHexView[0]===0&&this.warnings.push("Needlessly long format of SID encoding"),this.blockLength<=8?this.valueDec=Ii(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),n+this.blockLength)}toBER(e){if(this.isHexOnly){if(e)return new ArrayBuffer(this.valueHexView.byteLength);const i=this.valueHexView,o=new Uint8Array(this.blockLength);for(let a=0;a<this.blockLength-1;a++)o[a]=i[a]|128;return o[this.blockLength-1]=i[this.blockLength-1],o.buffer}const n=Vr(this.valueDec,7);if(n.byteLength===0)return this.error="Error during encoding SID value",_n;const r=new Uint8Array(n.byteLength);if(!e){const i=new Uint8Array(n),o=n.byteLength-1;for(let a=0;a<o;a++)r[a]=i[a]|128;r[o]=i[o]}return r.buffer}toString(){let e="";return this.isHexOnly?e=fe.ToHex(this.valueHexView):e=this.valueDec.toString(),e}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}}Cu.NAME="relativeSidBlock";class e2 extends wt{constructor({value:e=Et,...n}={}){super(n),this.value=[],e&&this.fromString(e)}fromBER(e,n,r){let i=n;for(;r>0;){const o=new Cu;if(i=o.fromBER(e,i,r),i===-1)return this.blockLength=0,this.error=o.error,i;this.blockLength+=o.blockLength,r-=o.blockLength,this.value.push(o)}return i}toBER(e,n){const r=[];for(let i=0;i<this.value.length;i++){const o=this.value[i].toBER(e);if(o.byteLength===0)return this.error=this.value[i].error,_n;r.push(o)}return Sp(r)}fromString(e){this.value=[];let n=0,r=0,i="";do{r=e.indexOf(".",n),r===-1?i=e.substring(n):i=e.substring(n,r),n=r+1;const o=new Cu;if(o.valueDec=parseInt(i,10),isNaN(o.valueDec))return!0;this.value.push(o)}while(r!==-1);return!0}toString(){let e="",n=!1;for(let r=0;r<this.value.length;r++){n=this.value[r].isHexOnly;let i=this.value[r].toString();r!==0&&(e=`${e}.`),n&&(i=`{${i}}`),e+=i}return e}toJSON(){const e={...super.toJSON(),value:this.toString(),sidArray:[]};for(let n=0;n<this.value.length;n++)e.sidArray.push(this.value[n].toJSON());return e}}e2.NAME="RelativeObjectIdentifierValueBlock";var t2;class Ip extends dt{getValue(){return this.valueBlock.toString()}setValue(e){this.valueBlock.fromString(e)}constructor(e={}){super(e,e2),this.idBlock.tagClass=1,this.idBlock.tagNumber=13}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return{...super.toJSON(),value:this.getValue()}}}t2=Ip;le.RelativeObjectIdentifier=t2;Ip.NAME="RelativeObjectIdentifier";var n2;class an extends yt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=16}}n2=an;le.Sequence=n2;an.NAME="SEQUENCE";var r2;let kn=class extends yt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=17}};r2=kn;le.Set=r2;kn.NAME="SET";class i2 extends On(wt){constructor({...e}={}){super(e),this.isHexOnly=!0,this.value=Et}toJSON(){return{...super.toJSON(),value:this.value}}}i2.NAME="StringValueBlock";class o2 extends i2{}o2.NAME="SimpleStringValueBlock";class Ut extends kp{constructor({...e}={}){super(e,o2)}fromBuffer(e){this.valueBlock.value=String.fromCharCode.apply(null,ne.toUint8Array(e))}fromString(e){const n=e.length,r=this.valueBlock.valueHexView=new Uint8Array(n);for(let i=0;i<n;i++)r[i]=e.charCodeAt(i);this.valueBlock.value=e}}Ut.NAME="SIMPLE STRING";class s2 extends Ut{fromBuffer(e){this.valueBlock.valueHexView=ne.toUint8Array(e);try{this.valueBlock.value=fe.ToUtf8String(e)}catch(n){this.warnings.push(`Error during "decodeURIComponent": ${n}, using raw string`),this.valueBlock.value=fe.ToBinary(e)}}fromString(e){this.valueBlock.valueHexView=new Uint8Array(fe.FromUtf8String(e)),this.valueBlock.value=e}}s2.NAME="Utf8StringValueBlock";var a2;class er extends s2{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=12}}a2=er;le.Utf8String=a2;er.NAME="UTF8String";class c2 extends Ut{fromBuffer(e){this.valueBlock.value=fe.ToUtf16String(e),this.valueBlock.valueHexView=ne.toUint8Array(e)}fromString(e){this.valueBlock.value=e,this.valueBlock.valueHexView=new Uint8Array(fe.FromUtf16String(e))}}c2.NAME="BmpStringValueBlock";var l2;class Pc extends c2{constructor({...e}={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=30}}l2=Pc;le.BmpString=l2;Pc.NAME="BMPString";class u2 extends Ut{fromBuffer(e){const n=ArrayBuffer.isView(e)?e.slice().buffer:e.slice(0),r=new Uint8Array(n);for(let i=0;i<r.length;i+=4)r[i]=r[i+3],r[i+1]=r[i+2],r[i+2]=0,r[i+3]=0;this.valueBlock.value=String.fromCharCode.apply(null,new Uint32Array(n))}fromString(e){const n=e.length,r=this.valueBlock.valueHexView=new Uint8Array(n*4);for(let i=0;i<n;i++){const o=Vr(e.charCodeAt(i),8),a=new Uint8Array(o);if(a.length>4)continue;const l=4-a.length;for(let u=a.length-1;u>=0;u--)r[i*4+u+l]=a[u]}this.valueBlock.value=e}}u2.NAME="UniversalStringValueBlock";var d2;class Bc extends u2{constructor({...e}={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=28}}d2=Bc;le.UniversalString=d2;Bc.NAME="UniversalString";var p2;class jc extends Ut{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=18}}p2=jc;le.NumericString=p2;jc.NAME="NumericString";var f2;class Lc extends Ut{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=19}}f2=Lc;le.PrintableString=f2;Lc.NAME="PrintableString";var h2;class Fc extends Ut{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=20}}h2=Fc;le.TeletexString=h2;Fc.NAME="TeletexString";var g2;class Uc extends Ut{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=21}}g2=Uc;le.VideotexString=g2;Uc.NAME="VideotexString";var m2;class Mc extends Ut{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=22}}m2=Mc;le.IA5String=m2;Mc.NAME="IA5String";var _2;class qc extends Ut{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=25}}_2=qc;le.GraphicString=_2;qc.NAME="GraphicString";var y2;class is extends Ut{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=26}}y2=is;le.VisibleString=y2;is.NAME="VisibleString";var w2;class Vc extends Ut{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=27}}w2=Vc;le.GeneralString=w2;Vc.NAME="GeneralString";var v2;class Hc extends Ut{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=29}}v2=Hc;le.CharacterString=v2;Hc.NAME="CharacterString";var b2;class os extends is{constructor({value:e,valueDate:n,...r}={}){if(super(r),this.year=0,this.month=0,this.day=0,this.hour=0,this.minute=0,this.second=0,e){this.fromString(e),this.valueBlock.valueHexView=new Uint8Array(e.length);for(let i=0;i<e.length;i++)this.valueBlock.valueHexView[i]=e.charCodeAt(i)}n&&(this.fromDate(n),this.valueBlock.valueHexView=new Uint8Array(this.toBuffer())),this.idBlock.tagClass=1,this.idBlock.tagNumber=23}fromBuffer(e){this.fromString(String.fromCharCode.apply(null,ne.toUint8Array(e)))}toBuffer(){const e=this.toString(),n=new ArrayBuffer(e.length),r=new Uint8Array(n);for(let i=0;i<e.length;i++)r[i]=e.charCodeAt(i);return n}fromDate(e){this.year=e.getUTCFullYear(),this.month=e.getUTCMonth()+1,this.day=e.getUTCDate(),this.hour=e.getUTCHours(),this.minute=e.getUTCMinutes(),this.second=e.getUTCSeconds()}toDate(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second))}fromString(e){const r=/(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})Z/ig.exec(e);if(r===null){this.error="Wrong input string for conversion";return}const i=parseInt(r[1],10);i>=50?this.year=1900+i:this.year=2e3+i,this.month=parseInt(r[2],10),this.day=parseInt(r[3],10),this.hour=parseInt(r[4],10),this.minute=parseInt(r[5],10),this.second=parseInt(r[6],10)}toString(e="iso"){if(e==="iso"){const n=new Array(7);return n[0]=Pt(this.year<2e3?this.year-1900:this.year-2e3,2),n[1]=Pt(this.month,2),n[2]=Pt(this.day,2),n[3]=Pt(this.hour,2),n[4]=Pt(this.minute,2),n[5]=Pt(this.second,2),n[6]="Z",n.join("")}return super.toString(e)}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.toDate().toISOString()}`}toJSON(){return{...super.toJSON(),year:this.year,month:this.month,day:this.day,hour:this.hour,minute:this.minute,second:this.second}}}b2=os;le.UTCTime=b2;os.NAME="UTCTime";var $2;class Kc extends os{constructor(e={}){var n;super(e),(n=this.millisecond)!==null&&n!==void 0||(this.millisecond=0),this.idBlock.tagClass=1,this.idBlock.tagNumber=24}fromDate(e){super.fromDate(e),this.millisecond=e.getUTCMilliseconds()}toDate(){const e=Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second,this.millisecond);return new Date(e)}fromString(e){let n=!1,r="",i="",o=0,a,l=0,u=0;if(e[e.length-1]==="Z")r=e.substring(0,e.length-1),n=!0;else{const h=new Number(e[e.length-1]);if(isNaN(h.valueOf()))throw new Error("Wrong input string for conversion");r=e}if(n){if(r.indexOf("+")!==-1)throw new Error("Wrong input string for conversion");if(r.indexOf("-")!==-1)throw new Error("Wrong input string for conversion")}else{let h=1,g=r.indexOf("+"),A="";if(g===-1&&(g=r.indexOf("-"),h=-1),g!==-1){if(A=r.substring(g+1),r=r.substring(0,g),A.length!==2&&A.length!==4)throw new Error("Wrong input string for conversion");let $=parseInt(A.substring(0,2),10);if(isNaN($.valueOf()))throw new Error("Wrong input string for conversion");if(l=h*$,A.length===4){if($=parseInt(A.substring(2,4),10),isNaN($.valueOf()))throw new Error("Wrong input string for conversion");u=h*$}}}let d=r.indexOf(".");if(d===-1&&(d=r.indexOf(",")),d!==-1){const h=new Number(`0${r.substring(d)}`);if(isNaN(h.valueOf()))throw new Error("Wrong input string for conversion");o=h.valueOf(),i=r.substring(0,d)}else i=r;switch(!0){case i.length===8:if(a=/(\d{4})(\d{2})(\d{2})/ig,d!==-1)throw new Error("Wrong input string for conversion");break;case i.length===10:if(a=/(\d{4})(\d{2})(\d{2})(\d{2})/ig,d!==-1){let h=60*o;this.minute=Math.floor(h),h=60*(h-this.minute),this.second=Math.floor(h),h=1e3*(h-this.second),this.millisecond=Math.floor(h)}break;case i.length===12:if(a=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})/ig,d!==-1){let h=60*o;this.second=Math.floor(h),h=1e3*(h-this.second),this.millisecond=Math.floor(h)}break;case i.length===14:if(a=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/ig,d!==-1){const h=1e3*o;this.millisecond=Math.floor(h)}break;default:throw new Error("Wrong input string for conversion")}const p=a.exec(i);if(p===null)throw new Error("Wrong input string for conversion");for(let h=1;h<p.length;h++)switch(h){case 1:this.year=parseInt(p[h],10);break;case 2:this.month=parseInt(p[h],10);break;case 3:this.day=parseInt(p[h],10);break;case 4:this.hour=parseInt(p[h],10)+l;break;case 5:this.minute=parseInt(p[h],10)+u;break;case 6:this.second=parseInt(p[h],10);break;default:throw new Error("Wrong input string for conversion")}if(n===!1){const h=new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond);this.year=h.getUTCFullYear(),this.month=h.getUTCMonth(),this.day=h.getUTCDay(),this.hour=h.getUTCHours(),this.minute=h.getUTCMinutes(),this.second=h.getUTCSeconds(),this.millisecond=h.getUTCMilliseconds()}}toString(e="iso"){if(e==="iso"){const n=[];return n.push(Pt(this.year,4)),n.push(Pt(this.month,2)),n.push(Pt(this.day,2)),n.push(Pt(this.hour,2)),n.push(Pt(this.minute,2)),n.push(Pt(this.second,2)),this.millisecond!==0&&(n.push("."),n.push(Pt(this.millisecond,3))),n.push("Z"),n.join("")}return super.toString(e)}toJSON(){return{...super.toJSON(),millisecond:this.millisecond}}}$2=Kc;le.GeneralizedTime=$2;Kc.NAME="GeneralizedTime";var x2;class Op extends er{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=31}}x2=Op;le.DATE=x2;Op.NAME="DATE";var A2;class zp extends er{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=32}}A2=zp;le.TimeOfDay=A2;zp.NAME="TimeOfDay";var E2;class Dp extends er{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=33}}E2=Dp;le.DateTime=E2;Dp.NAME="DateTime";var S2;class Rp extends er{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=34}}S2=Rp;le.Duration=S2;Rp.NAME="Duration";var k2;class Pp extends er{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=14}}k2=Pp;le.TIME=k2;Pp.NAME="TIME";class Kr{constructor({name:e=Et,optional:n=!1}={}){this.name=e,this.optional=n}}class Bp extends Kr{constructor({value:e=[],...n}={}){super(n),this.value=e}}class Ca extends Kr{constructor({value:e=new Kr,local:n=!1,...r}={}){super(r),this.value=e,this.local=n}}class R3{get data(){return this.dataView.slice().buffer}set data(e){this.dataView=ne.toUint8Array(e)}constructor({data:e=Oc}={}){this.dataView=ne.toUint8Array(e)}fromBER(e,n,r){const i=n+r;return this.dataView=ne.toUint8Array(e).subarray(n,i),i}toBER(e){return this.dataView.slice().buffer}}function pr(t,e,n){if(n instanceof Bp){for(const o of n.value)if(pr(t,e,o).verified)return{verified:!0,result:t};{const o={verified:!1,result:{error:"Wrong values for Choice type"}};return n.hasOwnProperty(Ul)&&(o.name=n.name),o}}if(n instanceof Kr)return n.hasOwnProperty(Ul)&&(t[n.name]=e),{verified:!0,result:t};if(!(t instanceof Object))return{verified:!1,result:{error:"Wrong root object"}};if(!(e instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 data"}};if(!(n instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(A3 in n))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(N3 in n.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(C3 in n.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};const r=n.idBlock.toBER(!1);if(r.byteLength===0)return{verified:!1,result:{error:"Error encoding idBlock for ASN.1 schema"}};if(n.idBlock.fromBER(r,0,r.byteLength)===-1)return{verified:!1,result:{error:"Error decoding idBlock for ASN.1 schema"}};if(n.idBlock.hasOwnProperty(E3)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(n.idBlock.tagClass!==e.idBlock.tagClass)return{verified:!1,result:t};if(n.idBlock.hasOwnProperty(S3)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(n.idBlock.tagNumber!==e.idBlock.tagNumber)return{verified:!1,result:t};if(n.idBlock.hasOwnProperty(k3)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(n.idBlock.isConstructed!==e.idBlock.isConstructed)return{verified:!1,result:t};if(!(x3 in n.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(n.idBlock.isHexOnly!==e.idBlock.isHexOnly)return{verified:!1,result:t};if(n.idBlock.isHexOnly){if(!(Sh in n.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};const o=n.idBlock.valueHexView,a=e.idBlock.valueHexView;if(o.length!==a.length)return{verified:!1,result:t};for(let l=0;l<o.length;l++)if(o[l]!==a[1])return{verified:!1,result:t}}if(n.name&&(n.name=n.name.replace(/^\s+|\s+$/g,Et),n.name&&(t[n.name]=e)),n instanceof le.Constructed){let o=0,a={verified:!1,result:{error:"Unknown error"}},l=n.valueBlock.value.length;if(l>0&&n.valueBlock.value[0]instanceof Ca&&(l=e.valueBlock.value.length),l===0)return{verified:!0,result:t};if(e.valueBlock.value.length===0&&n.valueBlock.value.length!==0){let u=!0;for(let d=0;d<n.valueBlock.value.length;d++)u=u&&(n.valueBlock.value[d].optional||!1);return u?{verified:!0,result:t}:(n.name&&(n.name=n.name.replace(/^\s+|\s+$/g,Et),n.name&&delete t[n.name]),t.error="Inconsistent object length",{verified:!1,result:t})}for(let u=0;u<l;u++)if(u-o>=e.valueBlock.value.length){if(n.valueBlock.value[u].optional===!1){const d={verified:!1,result:t};return t.error="Inconsistent length between ASN.1 data and schema",n.name&&(n.name=n.name.replace(/^\s+|\s+$/g,Et),n.name&&(delete t[n.name],d.name=n.name)),d}}else if(n.valueBlock.value[0]instanceof Ca){if(a=pr(t,e.valueBlock.value[u],n.valueBlock.value[0].value),a.verified===!1)if(n.valueBlock.value[0].optional)o++;else return n.name&&(n.name=n.name.replace(/^\s+|\s+$/g,Et),n.name&&delete t[n.name]),a;if(Ul in n.valueBlock.value[0]&&n.valueBlock.value[0].name.length>0){let d={};T3 in n.valueBlock.value[0]&&n.valueBlock.value[0].local?d=e:d=t,typeof d[n.valueBlock.value[0].name]>"u"&&(d[n.valueBlock.value[0].name]=[]),d[n.valueBlock.value[0].name].push(e.valueBlock.value[u])}}else if(a=pr(t,e.valueBlock.value[u-o],n.valueBlock.value[u]),a.verified===!1)if(n.valueBlock.value[u].optional)o++;else return n.name&&(n.name=n.name.replace(/^\s+|\s+$/g,Et),n.name&&delete t[n.name]),a;if(a.verified===!1){const u={verified:!1,result:t};return n.name&&(n.name=n.name.replace(/^\s+|\s+$/g,Et),n.name&&(delete t[n.name],u.name=n.name)),u}return{verified:!0,result:t}}if(n.primitiveSchema&&Sh in e.valueBlock){const o=Ji(e.valueBlock.valueHexView);if(o.offset===-1){const a={verified:!1,result:o.result};return n.name&&(n.name=n.name.replace(/^\s+|\s+$/g,Et),n.name&&(delete t[n.name],a.name=n.name)),a}return pr(t,o.result,n.primitiveSchema)}return{verified:!0,result:t}}function P3(t,e){if(!(e instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 schema type"}};const n=Ji(ne.toUint8Array(t));return n.offset===-1?{verified:!1,result:n.result}:pr(n.result,n.result,e)}const N2=Object.freeze(Object.defineProperty({__proto__:null,Any:Kr,BaseBlock:dt,BaseStringBlock:kp,BitString:Mr,BmpString:Pc,Boolean:zc,CharacterString:Hc,Choice:Bp,Constructed:yt,DATE:Op,DateTime:Dp,Duration:Rp,EndOfContent:Np,Enumerated:Dc,GeneralString:Vc,GeneralizedTime:Kc,GraphicString:qc,HexBlock:On,IA5String:Mc,Integer:Yi,Null:Hr,NumericString:jc,ObjectIdentifier:Rc,OctetString:Ur,Primitive:rs,PrintableString:Lc,RawData:R3,RelativeObjectIdentifier:Ip,Repeated:Ca,Sequence:an,Set:kn,TIME:Pp,TeletexString:Fc,TimeOfDay:zp,UTCTime:os,UniversalString:Bc,Utf8String:er,ValueBlock:wt,VideotexString:Uc,ViewWriter:Ic,VisibleString:is,compareSchema:pr,fromBER:ki,verifySchema:P3},Symbol.toStringTag,{value:"Module"}));var q;(function(t){t[t.Sequence=0]="Sequence",t[t.Set=1]="Set",t[t.Choice=2]="Choice"})(q||(q={}));var T;(function(t){t[t.Any=1]="Any",t[t.Boolean=2]="Boolean",t[t.OctetString=3]="OctetString",t[t.BitString=4]="BitString",t[t.Integer=5]="Integer",t[t.Enumerated=6]="Enumerated",t[t.ObjectIdentifier=7]="ObjectIdentifier",t[t.Utf8String=8]="Utf8String",t[t.BmpString=9]="BmpString",t[t.UniversalString=10]="UniversalString",t[t.NumericString=11]="NumericString",t[t.PrintableString=12]="PrintableString",t[t.TeletexString=13]="TeletexString",t[t.VideotexString=14]="VideotexString",t[t.IA5String=15]="IA5String",t[t.GraphicString=16]="GraphicString",t[t.VisibleString=17]="VisibleString",t[t.GeneralString=18]="GeneralString",t[t.CharacterString=19]="CharacterString",t[t.UTCTime=20]="UTCTime",t[t.GeneralizedTime=21]="GeneralizedTime",t[t.DATE=22]="DATE",t[t.TimeOfDay=23]="TimeOfDay",t[t.DateTime=24]="DateTime",t[t.Duration=25]="Duration",t[t.TIME=26]="TIME",t[t.Null=27]="Null"})(T||(T={}));class Gc{constructor(e,n=0){if(this.unusedBits=0,this.value=new ArrayBuffer(0),e)if(typeof e=="number")this.fromNumber(e);else if(ne.isBufferSource(e))this.unusedBits=n,this.value=ne.toArrayBuffer(e);else throw TypeError("Unsupported type of 'params' argument for BitString")}fromASN(e){if(!(e instanceof Mr))throw new TypeError("Argument 'asn' is not instance of ASN.1 BitString");return this.unusedBits=e.valueBlock.unusedBits,this.value=e.valueBlock.valueHex,this}toASN(){return new Mr({unusedBits:this.unusedBits,valueHex:this.value})}toSchema(e){return new Mr({name:e})}toNumber(){let e="";const n=new Uint8Array(this.value);for(const r of n)e+=r.toString(2).padStart(8,"0");return e=e.split("").reverse().join(""),this.unusedBits&&(e=e.slice(this.unusedBits).padStart(this.unusedBits,"0")),parseInt(e,2)}fromNumber(e){let n=e.toString(2);const r=n.length+7>>3;this.unusedBits=(r<<3)-n.length;const i=new Uint8Array(r);n=n.padStart(r<<3,"0").split("").reverse().join("");let o=0;for(;o<r;)i[o]=parseInt(n.slice(o<<3,(o<<3)+8),2),o++;this.value=i.buffer}}class Ie{get byteLength(){return this.buffer.byteLength}get byteOffset(){return 0}constructor(e){typeof e=="number"?this.buffer=new ArrayBuffer(e):ne.isBufferSource(e)?this.buffer=ne.toArrayBuffer(e):Array.isArray(e)?this.buffer=new Uint8Array(e):this.buffer=new ArrayBuffer(0)}fromASN(e){if(!(e instanceof Ur))throw new TypeError("Argument 'asn' is not instance of ASN.1 OctetString");return this.buffer=e.valueBlock.valueHex,this}toASN(){return new Ur({valueHex:this.buffer})}toSchema(e){return new Ur({name:e})}}const B3={fromASN:t=>t instanceof Hr?null:t.valueBeforeDecodeView,toASN:t=>{if(t===null)return new Hr;const e=ki(t);if(e.result.error)throw new Error(e.result.error);return e.result}},j3={fromASN:t=>t.valueBlock.valueHexView.byteLength>=4?t.valueBlock.toString():t.valueBlock.valueDec,toASN:t=>new Yi({value:+t})},L3={fromASN:t=>t.valueBlock.valueDec,toASN:t=>new Dc({value:t})},qe={fromASN:t=>t.valueBlock.valueHexView,toASN:t=>new Yi({valueHex:t})},F3={fromASN:t=>t.valueBlock.valueHexView,toASN:t=>new Mr({valueHex:t})},U3={fromASN:t=>t.valueBlock.toString(),toASN:t=>new Rc({value:t})},M3={fromASN:t=>t.valueBlock.value,toASN:t=>new zc({value:t})},Ta={fromASN:t=>t.valueBlock.valueHexView,toASN:t=>new Ur({valueHex:t})},q3={fromASN:t=>new Ie(t.getValue()),toASN:t=>t.toASN()};function Zt(t){return{fromASN:e=>e.valueBlock.value,toASN:e=>new t({value:e})}}const C2=Zt(er),V3=Zt(Pc),H3=Zt(Bc),K3=Zt(jc),G3=Zt(Lc),W3=Zt(Fc),X3=Zt(Uc),J3=Zt(Mc),Y3=Zt(qc),Z3=Zt(is),Q3=Zt(Vc),e4=Zt(Hc),t4={fromASN:t=>t.toDate(),toASN:t=>new os({valueDate:t})},n4={fromASN:t=>t.toDate(),toASN:t=>new Kc({valueDate:t})},r4={fromASN:()=>null,toASN:()=>new Hr};function xo(t){switch(t){case T.Any:return B3;case T.BitString:return F3;case T.BmpString:return V3;case T.Boolean:return M3;case T.CharacterString:return e4;case T.Enumerated:return L3;case T.GeneralString:return Q3;case T.GeneralizedTime:return n4;case T.GraphicString:return Y3;case T.IA5String:return J3;case T.Integer:return j3;case T.Null:return r4;case T.NumericString:return K3;case T.ObjectIdentifier:return U3;case T.OctetString:return Ta;case T.PrintableString:return G3;case T.TeletexString:return W3;case T.UTCTime:return t4;case T.UniversalString:return H3;case T.Utf8String:return C2;case T.VideotexString:return X3;case T.VisibleString:return Z3;default:return null}}function Un(t){return typeof t=="function"&&t.prototype?t.prototype.toASN&&t.prototype.fromASN?!0:Un(t.prototype):!!(t&&typeof t=="object"&&"toASN"in t&&"fromASN"in t)}function T2(t){var e;if(t){const n=Object.getPrototypeOf(t);return((e=n==null?void 0:n.prototype)===null||e===void 0?void 0:e.constructor)===Array?!0:T2(n)}return!1}function i4(t,e){if(!(t&&e)||t.byteLength!==e.byteLength)return!1;const n=new Uint8Array(t),r=new Uint8Array(e);for(let i=0;i<t.byteLength;i++)if(n[i]!==r[i])return!1;return!0}class o4{constructor(){this.items=new WeakMap}has(e){return this.items.has(e)}get(e,n=!1){const r=this.items.get(e);if(!r)throw new Error(`Cannot get schema for '${e.prototype.constructor.name}' target`);if(n&&!r.schema)throw new Error(`Schema '${e.prototype.constructor.name}' doesn't contain ASN.1 schema. Call 'AsnSchemaStorage.cache'.`);return r}cache(e){const n=this.get(e);n.schema||(n.schema=this.create(e,!0))}createDefault(e){const n={type:q.Sequence,items:{}},r=this.findParentSchema(e);return r&&(Object.assign(n,r),n.items=Object.assign({},n.items,r.items)),n}create(e,n){const r=this.items.get(e)||this.createDefault(e),i=[];for(const o in r.items){const a=r.items[o],l=n?o:"";let u;if(typeof a.type=="number"){const p=T[a.type],h=N2[p];if(!h)throw new Error(`Cannot get ASN1 class by name '${p}'`);u=new h({name:l})}else Un(a.type)?u=new a.type().toSchema(l):a.optional?this.get(a.type).type===q.Choice?u=new Kr({name:l}):(u=this.create(a.type,!1),u.name=l):u=new Kr({name:l});const d=!!a.optional||a.defaultValue!==void 0;if(a.repeated){u.name="";const p=a.repeated==="set"?kn:an;u=new p({name:"",value:[new Ca({name:l,value:u})]})}if(a.context!==null&&a.context!==void 0)if(a.implicit)if(typeof a.type=="number"||Un(a.type)){const p=a.repeated?yt:rs;i.push(new p({name:l,optional:d,idBlock:{tagClass:3,tagNumber:a.context}}))}else{this.cache(a.type);const p=!!a.repeated;let h=p?u:this.get(a.type,!0).schema;h="valueBlock"in h?h.valueBlock.value:h.value,i.push(new yt({name:p?"":l,optional:d,idBlock:{tagClass:3,tagNumber:a.context},value:h}))}else i.push(new yt({optional:d,idBlock:{tagClass:3,tagNumber:a.context},value:[u]}));else u.optional=d,i.push(u)}switch(r.type){case q.Sequence:return new an({value:i,name:""});case q.Set:return new kn({value:i,name:""});case q.Choice:return new Bp({value:i,name:""});default:throw new Error("Unsupported ASN1 type in use")}}set(e,n){return this.items.set(e,n),this}findParentSchema(e){const n=Object.getPrototypeOf(e);return n?this.items.get(n)||this.findParentSchema(n):null}}const it=new o4,X=t=>e=>{let n;it.has(e)?n=it.get(e):(n=it.createDefault(e),it.set(e,n)),Object.assign(n,t)},w=t=>(e,n)=>{let r;it.has(e.constructor)?r=it.get(e.constructor):(r=it.createDefault(e.constructor),it.set(e.constructor,r));const i=Object.assign({},t);if(typeof i.type=="number"&&!i.converter){const o=xo(t.type);if(!o)throw new Error(`Cannot get default converter for property '${n}' of ${e.constructor.name}`);i.converter=o}r.items[n]=i};class go extends Error{constructor(){super(...arguments),this.schemas=[]}}class s4{static parse(e,n){const r=ki(e);if(r.result.error)throw new Error(r.result.error);return this.fromASN(r.result,n)}static fromASN(e,n){try{if(Un(n))return new n().fromASN(e);const r=it.get(n);it.cache(n);let i=r.schema;const o=this.handleChoiceTypes(e,r,n,i);if(o!=null&&o.result)return o.result;o!=null&&o.targetSchema&&(i=o.targetSchema);const a=this.handleSequenceTypes(e,r,n,i);if(a&&"isManualMapping"in a)return a.result;const l=a,u=new n;return T2(n)?this.handleArrayTypes(e,r,n):(this.processSchemaItems(r,l,u),u)}catch(r){throw r instanceof go&&r.schemas.push(n.name),r}}static handleChoiceTypes(e,n,r,i){if(e.constructor===yt&&n.type===q.Choice&&e.idBlock.tagClass===3)for(const o in n.items){const a=n.items[o];if(a.context===e.idBlock.tagNumber&&a.implicit&&typeof a.type=="function"&&it.has(a.type)){const l=it.get(a.type);if(l&&l.type===q.Sequence){const u=new an;if("value"in e.valueBlock&&Array.isArray(e.valueBlock.value)&&"value"in u.valueBlock){u.valueBlock.value=e.valueBlock.value;const d=this.fromASN(u,a.type),p=new r;return p[o]=d,{result:p}}}}}else if(e.constructor===yt&&n.type!==q.Choice){const o=new yt({idBlock:{tagClass:3,tagNumber:e.idBlock.tagNumber},value:n.schema.valueBlock.value});for(const a in n.items)delete e[a];return{targetSchema:o}}return null}static handleSequenceTypes(e,n,r,i){if(n.type===q.Sequence){if(Object.keys(n.items).filter(l=>{const u=n.items[l];return u.optional&&typeof u.type=="function"&&it.has(u.type)&&it.get(u.type).type===q.Choice}).length>0&&"value"in e.valueBlock&&Array.isArray(e.valueBlock.value)&&r.name==="CertReqMsg")return this.handleManualMapping(e,n,r);const a=pr({},e,i);if(!a.verified)throw new go(`Data does not match to ${r.name} ASN1 schema. ${a.result.error}`);return a}else{const o=pr({},e,i);if(!o.verified)throw new go(`Data does not match to ${r.name} ASN1 schema. ${o.result.error}`);return o}}static handleManualMapping(e,n,r){const i=new r,o=e.valueBlock.value,a=Object.keys(n.items);let l=0;for(let u=0;u<a.length;u++){const d=a[u],p=n.items[d];if(l>=o.length)break;if(p.repeated){i[d]=this.processRepeatedField(o,l,p);break}else if(typeof p.type=="number")i[d]=this.processPrimitiveField(o[l],p),l++;else if(this.isOptionalChoiceField(p)){const h=this.processOptionalChoiceField(o[l],p);h.processed&&(i[d]=h.value,l++)}else i[d]=this.fromASN(o[l],p.type),l++}return{result:i,verified:!0,isManualMapping:!0}}static processRepeatedField(e,n,r){let i=e.slice(n);if(i.length===1&&i[0].constructor.name==="Sequence"){const o=i[0];o.valueBlock&&o.valueBlock.value&&Array.isArray(o.valueBlock.value)&&(i=o.valueBlock.value)}if(typeof r.type=="number"){const o=xo(r.type);if(!o)throw new Error(`No converter for ASN.1 type ${r.type}`);return i.filter(a=>a&&a.valueBlock).map(a=>{try{return o.fromASN(a)}catch{return}}).filter(a=>a!==void 0)}else return i.filter(o=>o&&o.valueBlock).map(o=>{try{return this.fromASN(o,r.type)}catch{return}}).filter(o=>o!==void 0)}static processPrimitiveField(e,n){const r=xo(n.type);if(!r)throw new Error(`No converter for ASN.1 type ${n.type}`);return r.fromASN(e)}static isOptionalChoiceField(e){return e.optional&&typeof e.type=="function"&&it.has(e.type)&&it.get(e.type).type===q.Choice}static processOptionalChoiceField(e,n){try{return{processed:!0,value:this.fromASN(e,n.type)}}catch(r){if(r instanceof go&&/Wrong values for Choice type/.test(r.message))return{processed:!1};throw r}}static handleArrayTypes(e,n,r){if(!("value"in e.valueBlock&&Array.isArray(e.valueBlock.value)))throw new Error("Cannot get items from the ASN.1 parsed value. ASN.1 object is not constructed.");const i=n.itemType;if(typeof i=="number"){const o=xo(i);if(!o)throw new Error(`Cannot get default converter for array item of ${r.name} ASN1 schema`);return r.from(e.valueBlock.value,a=>o.fromASN(a))}else return r.from(e.valueBlock.value,o=>this.fromASN(o,i))}static processSchemaItems(e,n,r){for(const i in e.items){const o=n.result[i];if(!o)continue;const a=e.items[i],l=a.type;typeof l=="number"||Un(l)?r[i]=this.processPrimitiveSchemaItem(o,a,l):r[i]=this.processComplexSchemaItem(o,a,l)}}static processPrimitiveSchemaItem(e,n,r){var i;const o=(i=n.converter)!==null&&i!==void 0?i:Un(r)?new r:null;if(!o)throw new Error("Converter is empty");return n.repeated?this.processRepeatedPrimitiveItem(e,n,o):this.processSinglePrimitiveItem(e,n,r,o)}static processRepeatedPrimitiveItem(e,n,r){if(n.implicit){const i=n.repeated==="sequence"?an:kn,o=new i;o.valueBlock=e.valueBlock;const a=ki(o.toBER(!1));if(a.offset===-1)throw new Error(`Cannot parse the child item. ${a.result.error}`);if(!("value"in a.result.valueBlock&&Array.isArray(a.result.valueBlock.value)))throw new Error("Cannot get items from the ASN.1 parsed value. ASN.1 object is not constructed.");const l=a.result.valueBlock.value;return Array.from(l,u=>r.fromASN(u))}else return Array.from(e,i=>r.fromASN(i))}static processSinglePrimitiveItem(e,n,r,i){let o=e;if(n.implicit){let a;if(Un(r))a=new r().toSchema("");else{const l=T[r],u=N2[l];if(!u)throw new Error(`Cannot get '${l}' class from asn1js module`);a=new u}a.valueBlock=o.valueBlock,o=ki(a.toBER(!1)).result}return i.fromASN(o)}static processComplexSchemaItem(e,n,r){if(n.repeated){if(!Array.isArray(e))throw new Error("Cannot get list of items from the ASN.1 parsed value. ASN.1 value should be iterable.");return Array.from(e,i=>this.fromASN(i,r))}else{const i=this.handleImplicitTagging(e,n,r);if(this.isOptionalChoiceField(n))try{return this.fromASN(i,r)}catch(o){if(o instanceof go&&/Wrong values for Choice type/.test(o.message))return;throw o}else return this.fromASN(i,r)}}static handleImplicitTagging(e,n,r){if(n.implicit&&typeof n.context=="number"){const i=it.get(r);if(i.type===q.Sequence){const o=new an;if("value"in e.valueBlock&&Array.isArray(e.valueBlock.value)&&"value"in o.valueBlock)return o.valueBlock.value=e.valueBlock.value,o}else if(i.type===q.Set){const o=new kn;if("value"in e.valueBlock&&Array.isArray(e.valueBlock.value)&&"value"in o.valueBlock)return o.valueBlock.value=e.valueBlock.value,o}}return e}}class jp{static serialize(e){return e instanceof dt?e.toBER(!1):this.toASN(e).toBER(!1)}static toASN(e){if(e&&typeof e=="object"&&Un(e))return e.toASN();if(!(e&&typeof e=="object"))throw new TypeError("Parameter 1 should be type of Object.");const n=e.constructor,r=it.get(n);it.cache(n);let i=[];if(r.itemType){if(!Array.isArray(e))throw new TypeError("Parameter 1 should be type of Array.");if(typeof r.itemType=="number"){const a=xo(r.itemType);if(!a)throw new Error(`Cannot get default converter for array item of ${n.name} ASN1 schema`);i=e.map(l=>a.toASN(l))}else i=e.map(a=>this.toAsnItem({type:r.itemType},"[]",n,a))}else for(const a in r.items){const l=r.items[a],u=e[a];if(u===void 0||l.defaultValue===u||typeof l.defaultValue=="object"&&typeof u=="object"&&i4(this.serialize(l.defaultValue),this.serialize(u)))continue;const d=jp.toAsnItem(l,a,n,u);if(typeof l.context=="number")if(l.implicit)if(!l.repeated&&(typeof l.type=="number"||Un(l.type))){const p={};p.valueHex=d instanceof Hr?d.valueBeforeDecodeView:d.valueBlock.toBER(),i.push(new rs({optional:l.optional,idBlock:{tagClass:3,tagNumber:l.context},...p}))}else i.push(new yt({optional:l.optional,idBlock:{tagClass:3,tagNumber:l.context},value:d.valueBlock.value}));else i.push(new yt({optional:l.optional,idBlock:{tagClass:3,tagNumber:l.context},value:[d]}));else l.repeated?i=i.concat(d):i.push(d)}let o;switch(r.type){case q.Sequence:o=new an({value:i});break;case q.Set:o=new kn({value:i});break;case q.Choice:if(!i[0])throw new Error(`Schema '${n.name}' has wrong data. Choice cannot be empty.`);o=i[0];break}return o}static toAsnItem(e,n,r,i){let o;if(typeof e.type=="number"){const a=e.converter;if(!a)throw new Error(`Property '${n}' doesn't have converter for type ${T[e.type]} in schema '${r.name}'`);if(e.repeated){if(!Array.isArray(i))throw new TypeError("Parameter 'objProp' should be type of Array.");const l=Array.from(i,d=>a.toASN(d)),u=e.repeated==="sequence"?an:kn;o=new u({value:l})}else o=a.toASN(i)}else if(e.repeated){if(!Array.isArray(i))throw new TypeError("Parameter 'objProp' should be type of Array.");const a=Array.from(i,u=>this.toASN(u)),l=e.repeated==="sequence"?an:kn;o=new l({value:a})}else o=this.toASN(i);return o}}class De extends Array{constructor(e=[]){if(typeof e=="number")super(e);else{super();for(const n of e)this.push(n)}}}class te{static serialize(e){return jp.serialize(e)}static parse(e,n){return s4.parse(e,n)}static toString(e){const n=ne.isBufferSource(e)?ne.toArrayBuffer(e):te.serialize(e),r=ki(n);if(r.offset===-1)throw new Error(`Cannot decode ASN.1 data. ${r.result.error}`);return r.result.toString()}}function m(t,e,n,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,n):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(a=t[l])&&(o=(i<3?a(o):i>3?a(e,n,o):a(e,n))||o);return i>3&&o&&Object.defineProperty(e,n,o),o}class Nh{static isIPv4(e){return/^(\d{1,3}\.){3}\d{1,3}$/.test(e)}static parseIPv4(e){const n=e.split(".");if(n.length!==4)throw new Error("Invalid IPv4 address");return n.map(r=>{const i=parseInt(r,10);if(isNaN(i)||i<0||i>255)throw new Error("Invalid IPv4 address part");return i})}static parseIPv6(e){const r=this.expandIPv6(e).split(":");if(r.length!==8)throw new Error("Invalid IPv6 address");return r.reduce((i,o)=>{const a=parseInt(o,16);if(isNaN(a)||a<0||a>65535)throw new Error("Invalid IPv6 address part");return i.push(a>>8&255),i.push(a&255),i},[])}static expandIPv6(e){if(!e.includes("::"))return e;const n=e.split("::");if(n.length>2)throw new Error("Invalid IPv6 address");const r=n[0]?n[0].split(":"):[],i=n[1]?n[1].split(":"):[],o=8-(r.length+i.length);if(o<0)throw new Error("Invalid IPv6 address");return[...r,...Array(o).fill("0"),...i].join(":")}static formatIPv6(e){const n=[];for(let r=0;r<16;r+=2)n.push((e[r]<<8|e[r+1]).toString(16));return this.compressIPv6(n.join(":"))}static compressIPv6(e){const n=e.split(":");let r=-1,i=0,o=-1,a=0;for(let l=0;l<n.length;l++)n[l]==="0"?(o===-1&&(o=l),a++):(a>i&&(r=o,i=a),o=-1,a=0);if(a>i&&(r=o,i=a),i>1){const l=n.slice(0,r).join(":"),u=n.slice(r+i).join(":");return`${l}::${u}`}return e}static parseCIDR(e){const[n,r]=e.split("/"),i=parseInt(r,10);if(this.isIPv4(n)){if(i<0||i>32)throw new Error("Invalid IPv4 prefix length");return[this.parseIPv4(n),i]}else{if(i<0||i>128)throw new Error("Invalid IPv6 prefix length");return[this.parseIPv6(n),i]}}static decodeIP(e){if(e.length===64&&parseInt(e,16)===0)return"::/0";if(e.length!==16)return e;const n=parseInt(e.slice(8),16).toString(2).split("").reduce((i,o)=>i+ +o,0);let r=e.slice(0,8).replace(/(.{2})/g,i=>`${parseInt(i,16)}.`);return r=r.slice(0,-1),`${r}/${n}`}static toString(e){const n=new Uint8Array(e);if(n.length===4)return Array.from(n).join(".");if(n.length===16)return this.formatIPv6(n);if(n.length===8||n.length===32){const r=n.length/2,i=n.slice(0,r),o=n.slice(r);if(n.every(u=>u===0))return n.length===8?"0.0.0.0/0":"::/0";const l=o.reduce((u,d)=>u+(d.toString(2).match(/1/g)||[]).length,0);return n.length===8?`${Array.from(i).join(".")}/${l}`:`${this.formatIPv6(i)}/${l}`}return this.decodeIP(fe.ToHex(e))}static fromString(e){if(e.includes("/")){const[r,i]=this.parseCIDR(e),o=new Uint8Array(r.length);let a=i;for(let u=0;u<o.length;u++)a>=8?(o[u]=255,a-=8):a>0&&(o[u]=255<<8-a,a=0);const l=new Uint8Array(r.length*2);return l.set(r,0),l.set(o,r.length),l.buffer}const n=this.isIPv4(e)?this.parseIPv4(e):this.parseIPv6(e);return new Uint8Array(n).buffer}}var Tu,Iu,Ou;let pt=class{constructor(e={}){Object.assign(this,e)}toString(){return this.bmpString||this.printableString||this.teletexString||this.universalString||this.utf8String||""}};m([w({type:T.TeletexString})],pt.prototype,"teletexString",void 0);m([w({type:T.PrintableString})],pt.prototype,"printableString",void 0);m([w({type:T.UniversalString})],pt.prototype,"universalString",void 0);m([w({type:T.Utf8String})],pt.prototype,"utf8String",void 0);m([w({type:T.BmpString})],pt.prototype,"bmpString",void 0);pt=m([X({type:q.Choice})],pt);let Oi=class extends pt{constructor(e={}){super(e),Object.assign(this,e)}toString(){return this.ia5String||(this.anyValue?fe.ToHex(this.anyValue):super.toString())}};m([w({type:T.IA5String})],Oi.prototype,"ia5String",void 0);m([w({type:T.Any})],Oi.prototype,"anyValue",void 0);Oi=m([X({type:q.Choice})],Oi);class Wc{constructor(e={}){this.type="",this.value=new Oi,Object.assign(this,e)}}m([w({type:T.ObjectIdentifier})],Wc.prototype,"type",void 0);m([w({type:Oi})],Wc.prototype,"value",void 0);let zi=Tu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Tu.prototype)}};zi=Tu=m([X({type:q.Set,itemType:Wc})],zi);let zu=Iu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Iu.prototype)}};zu=Iu=m([X({type:q.Sequence,itemType:zi})],zu);let Ze=Ou=class extends zu{constructor(e){super(e),Object.setPrototypeOf(this,Ou.prototype)}};Ze=Ou=m([X({type:q.Sequence})],Ze);const a4={fromASN:t=>Nh.toString(Ta.fromASN(t)),toASN:t=>Ta.toASN(Nh.fromString(t))};class Do{constructor(e={}){this.typeId="",this.value=new ArrayBuffer(0),Object.assign(this,e)}}m([w({type:T.ObjectIdentifier})],Do.prototype,"typeId",void 0);m([w({type:T.Any,context:0})],Do.prototype,"value",void 0);class Lp{constructor(e={}){this.partyName=new pt,Object.assign(this,e)}}m([w({type:pt,optional:!0,context:0,implicit:!0})],Lp.prototype,"nameAssigner",void 0);m([w({type:pt,context:1,implicit:!0})],Lp.prototype,"partyName",void 0);let ke=class{constructor(e={}){Object.assign(this,e)}};m([w({type:Do,context:0,implicit:!0})],ke.prototype,"otherName",void 0);m([w({type:T.IA5String,context:1,implicit:!0})],ke.prototype,"rfc822Name",void 0);m([w({type:T.IA5String,context:2,implicit:!0})],ke.prototype,"dNSName",void 0);m([w({type:T.Any,context:3,implicit:!0})],ke.prototype,"x400Address",void 0);m([w({type:Ze,context:4,implicit:!1})],ke.prototype,"directoryName",void 0);m([w({type:Lp,context:5})],ke.prototype,"ediPartyName",void 0);m([w({type:T.IA5String,context:6,implicit:!0})],ke.prototype,"uniformResourceIdentifier",void 0);m([w({type:T.OctetString,context:7,implicit:!0,converter:a4})],ke.prototype,"iPAddress",void 0);m([w({type:T.ObjectIdentifier,context:8,implicit:!0})],ke.prototype,"registeredID",void 0);ke=m([X({type:q.Choice})],ke);const Fp="1.3.6.1.5.5.7",c4=`${Fp}.1`,Zi=`${Fp}.3`,Xc=`${Fp}.48`,Ch=`${Xc}.1`,Th=`${Xc}.2`,Ih=`${Xc}.3`,Oh=`${Xc}.5`,tr="2.5.29";var Du;const Ru=`${c4}.1`;class ss{constructor(e={}){this.accessMethod="",this.accessLocation=new ke,Object.assign(this,e)}}m([w({type:T.ObjectIdentifier})],ss.prototype,"accessMethod",void 0);m([w({type:ke})],ss.prototype,"accessLocation",void 0);let xi=Du=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Du.prototype)}};xi=Du=m([X({type:q.Sequence,itemType:ss})],xi);const Pu=`${tr}.35`;class Up extends Ie{}class Lr{constructor(e={}){e&&Object.assign(this,e)}}m([w({type:Up,context:0,optional:!0,implicit:!0})],Lr.prototype,"keyIdentifier",void 0);m([w({type:ke,context:1,optional:!0,implicit:!0,repeated:"sequence"})],Lr.prototype,"authorityCertIssuer",void 0);m([w({type:T.Integer,context:2,optional:!0,implicit:!0,converter:qe})],Lr.prototype,"authorityCertSerialNumber",void 0);const I2=`${tr}.19`;class Ia{constructor(e={}){this.cA=!1,Object.assign(this,e)}}m([w({type:T.Boolean,defaultValue:!1})],Ia.prototype,"cA",void 0);m([w({type:T.Integer,optional:!0})],Ia.prototype,"pathLenConstraint",void 0);var Bu;let gt=Bu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Bu.prototype)}};gt=Bu=m([X({type:q.Sequence,itemType:ke})],gt);var ju;let zh=ju=class extends gt{constructor(e){super(e),Object.setPrototypeOf(this,ju.prototype)}};zh=ju=m([X({type:q.Sequence})],zh);var Lu;const O2=`${tr}.32`;let qn=class{constructor(e={}){Object.assign(this,e)}toString(){return this.ia5String||this.visibleString||this.bmpString||this.utf8String||""}};m([w({type:T.IA5String})],qn.prototype,"ia5String",void 0);m([w({type:T.VisibleString})],qn.prototype,"visibleString",void 0);m([w({type:T.BmpString})],qn.prototype,"bmpString",void 0);m([w({type:T.Utf8String})],qn.prototype,"utf8String",void 0);qn=m([X({type:q.Choice})],qn);class Mp{constructor(e={}){this.organization=new qn,this.noticeNumbers=[],Object.assign(this,e)}}m([w({type:qn})],Mp.prototype,"organization",void 0);m([w({type:T.Integer,repeated:"sequence"})],Mp.prototype,"noticeNumbers",void 0);class qp{constructor(e={}){Object.assign(this,e)}}m([w({type:Mp,optional:!0})],qp.prototype,"noticeRef",void 0);m([w({type:qn,optional:!0})],qp.prototype,"explicitText",void 0);let Oa=class{constructor(e={}){Object.assign(this,e)}};m([w({type:T.IA5String})],Oa.prototype,"cPSuri",void 0);m([w({type:qp})],Oa.prototype,"userNotice",void 0);Oa=m([X({type:q.Choice})],Oa);class Vp{constructor(e={}){this.policyQualifierId="",this.qualifier=new ArrayBuffer(0),Object.assign(this,e)}}m([w({type:T.ObjectIdentifier})],Vp.prototype,"policyQualifierId",void 0);m([w({type:T.Any})],Vp.prototype,"qualifier",void 0);class Jc{constructor(e={}){this.policyIdentifier="",Object.assign(this,e)}}m([w({type:T.ObjectIdentifier})],Jc.prototype,"policyIdentifier",void 0);m([w({type:Vp,repeated:"sequence",optional:!0})],Jc.prototype,"policyQualifiers",void 0);let za=Lu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Lu.prototype)}};za=Lu=m([X({type:q.Sequence,itemType:Jc})],za);let Da=class{constructor(e=0){this.value=e}};m([w({type:T.Integer})],Da.prototype,"value",void 0);Da=m([X({type:q.Choice})],Da);let Dh=class extends Da{};Dh=m([X({type:q.Choice})],Dh);var Fu;const Uu=`${tr}.31`;var tn;(function(t){t[t.unused=1]="unused",t[t.keyCompromise=2]="keyCompromise",t[t.cACompromise=4]="cACompromise",t[t.affiliationChanged=8]="affiliationChanged",t[t.superseded=16]="superseded",t[t.cessationOfOperation=32]="cessationOfOperation",t[t.certificateHold=64]="certificateHold",t[t.privilegeWithdrawn=128]="privilegeWithdrawn",t[t.aACompromise=256]="aACompromise"})(tn||(tn={}));class z2 extends Gc{toJSON(){const e=[],n=this.toNumber();return n&tn.aACompromise&&e.push("aACompromise"),n&tn.affiliationChanged&&e.push("affiliationChanged"),n&tn.cACompromise&&e.push("cACompromise"),n&tn.certificateHold&&e.push("certificateHold"),n&tn.cessationOfOperation&&e.push("cessationOfOperation"),n&tn.keyCompromise&&e.push("keyCompromise"),n&tn.privilegeWithdrawn&&e.push("privilegeWithdrawn"),n&tn.superseded&&e.push("superseded"),n&tn.unused&&e.push("unused"),e}toString(){return`[${this.toJSON().join(", ")}]`}}let Gr=class{constructor(e={}){Object.assign(this,e)}};m([w({type:ke,context:0,repeated:"sequence",implicit:!0})],Gr.prototype,"fullName",void 0);m([w({type:zi,context:1,implicit:!0})],Gr.prototype,"nameRelativeToCRLIssuer",void 0);Gr=m([X({type:q.Choice})],Gr);class Qi{constructor(e={}){Object.assign(this,e)}}m([w({type:Gr,context:0,optional:!0})],Qi.prototype,"distributionPoint",void 0);m([w({type:z2,context:1,optional:!0,implicit:!0})],Qi.prototype,"reasons",void 0);m([w({type:ke,context:2,optional:!0,repeated:"sequence",implicit:!0})],Qi.prototype,"cRLIssuer",void 0);let Ni=Fu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Fu.prototype)}};Ni=Fu=m([X({type:q.Sequence,itemType:Qi})],Ni);var Mu;let Rh=Mu=class extends Ni{constructor(e){super(e),Object.setPrototypeOf(this,Mu.prototype)}};Rh=Mu=m([X({type:q.Sequence,itemType:Qi})],Rh);class ht{constructor(e={}){this.onlyContainsUserCerts=ht.ONLY,this.onlyContainsCACerts=ht.ONLY,this.indirectCRL=ht.ONLY,this.onlyContainsAttributeCerts=ht.ONLY,Object.assign(this,e)}}ht.ONLY=!1;m([w({type:Gr,context:0,optional:!0})],ht.prototype,"distributionPoint",void 0);m([w({type:T.Boolean,context:1,defaultValue:ht.ONLY,implicit:!0})],ht.prototype,"onlyContainsUserCerts",void 0);m([w({type:T.Boolean,context:2,defaultValue:ht.ONLY,implicit:!0})],ht.prototype,"onlyContainsCACerts",void 0);m([w({type:z2,context:3,optional:!0,implicit:!0})],ht.prototype,"onlySomeReasons",void 0);m([w({type:T.Boolean,context:4,defaultValue:ht.ONLY,implicit:!0})],ht.prototype,"indirectCRL",void 0);m([w({type:T.Boolean,context:5,defaultValue:ht.ONLY,implicit:!0})],ht.prototype,"onlyContainsAttributeCerts",void 0);var Ao;(function(t){t[t.unspecified=0]="unspecified",t[t.keyCompromise=1]="keyCompromise",t[t.cACompromise=2]="cACompromise",t[t.affiliationChanged=3]="affiliationChanged",t[t.superseded=4]="superseded",t[t.cessationOfOperation=5]="cessationOfOperation",t[t.certificateHold=6]="certificateHold",t[t.removeFromCRL=8]="removeFromCRL",t[t.privilegeWithdrawn=9]="privilegeWithdrawn",t[t.aACompromise=10]="aACompromise"})(Ao||(Ao={}));let qu=class{constructor(e=Ao.unspecified){this.reason=Ao.unspecified,this.reason=e}toJSON(){return Ao[this.reason]}toString(){return this.toJSON()}};m([w({type:T.Enumerated})],qu.prototype,"reason",void 0);qu=m([X({type:q.Choice})],qu);var Vu;const D2=`${tr}.37`;let Ra=Vu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Vu.prototype)}};Ra=Vu=m([X({type:q.Sequence,itemType:T.ObjectIdentifier})],Ra);const l4=`${Zi}.1`,u4=`${Zi}.2`,d4=`${Zi}.3`,p4=`${Zi}.4`,f4=`${Zi}.8`,h4=`${Zi}.9`;let Hu=class{constructor(e=new ArrayBuffer(0)){this.value=e}};m([w({type:T.Integer,converter:qe})],Hu.prototype,"value",void 0);Hu=m([X({type:q.Choice})],Hu);let Ku=class{constructor(e){this.value=new Date,e&&(this.value=e)}};m([w({type:T.GeneralizedTime})],Ku.prototype,"value",void 0);Ku=m([X({type:q.Choice})],Ku);var Gu;const R2=`${tr}.18`;let Ph=Gu=class extends gt{constructor(e){super(e),Object.setPrototypeOf(this,Gu.prototype)}};Ph=Gu=m([X({type:q.Sequence})],Ph);const P2=`${tr}.15`;var nn;(function(t){t[t.digitalSignature=1]="digitalSignature",t[t.nonRepudiation=2]="nonRepudiation",t[t.keyEncipherment=4]="keyEncipherment",t[t.dataEncipherment=8]="dataEncipherment",t[t.keyAgreement=16]="keyAgreement",t[t.keyCertSign=32]="keyCertSign",t[t.cRLSign=64]="cRLSign",t[t.encipherOnly=128]="encipherOnly",t[t.decipherOnly=256]="decipherOnly"})(nn||(nn={}));class Ml extends Gc{toJSON(){const e=this.toNumber(),n=[];return e&nn.cRLSign&&n.push("crlSign"),e&nn.dataEncipherment&&n.push("dataEncipherment"),e&nn.decipherOnly&&n.push("decipherOnly"),e&nn.digitalSignature&&n.push("digitalSignature"),e&nn.encipherOnly&&n.push("encipherOnly"),e&nn.keyAgreement&&n.push("keyAgreement"),e&nn.keyCertSign&&n.push("keyCertSign"),e&nn.keyEncipherment&&n.push("keyEncipherment"),e&nn.nonRepudiation&&n.push("nonRepudiation"),n}toString(){return`[${this.toJSON().join(", ")}]`}}var Wu;class Yc{constructor(e={}){this.base=new ke,this.minimum=0,Object.assign(this,e)}}m([w({type:ke})],Yc.prototype,"base",void 0);m([w({type:T.Integer,context:0,defaultValue:0,implicit:!0})],Yc.prototype,"minimum",void 0);m([w({type:T.Integer,context:1,optional:!0,implicit:!0})],Yc.prototype,"maximum",void 0);let Pa=Wu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Wu.prototype)}};Pa=Wu=m([X({type:q.Sequence,itemType:Yc})],Pa);class B2{constructor(e={}){Object.assign(this,e)}}m([w({type:Pa,context:0,optional:!0,implicit:!0})],B2.prototype,"permittedSubtrees",void 0);m([w({type:Pa,context:1,optional:!0,implicit:!0})],B2.prototype,"excludedSubtrees",void 0);class j2{constructor(e={}){Object.assign(this,e)}}m([w({type:T.Integer,context:0,implicit:!0,optional:!0,converter:qe})],j2.prototype,"requireExplicitPolicy",void 0);m([w({type:T.Integer,context:1,implicit:!0,optional:!0,converter:qe})],j2.prototype,"inhibitPolicyMapping",void 0);var Xu;class Hp{constructor(e={}){this.issuerDomainPolicy="",this.subjectDomainPolicy="",Object.assign(this,e)}}m([w({type:T.ObjectIdentifier})],Hp.prototype,"issuerDomainPolicy",void 0);m([w({type:T.ObjectIdentifier})],Hp.prototype,"subjectDomainPolicy",void 0);let Bh=Xu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Xu.prototype)}};Bh=Xu=m([X({type:q.Sequence,itemType:Hp})],Bh);var Ju;const L2=`${tr}.17`;let Yu=Ju=class extends gt{constructor(e){super(e),Object.setPrototypeOf(this,Ju.prototype)}};Yu=Ju=m([X({type:q.Sequence})],Yu);let Vn=class{constructor(e={}){this.type="",this.values=[],Object.assign(this,e)}};m([w({type:T.ObjectIdentifier})],Vn.prototype,"type",void 0);m([w({type:T.Any,repeated:"set"})],Vn.prototype,"values",void 0);var Zu;let jh=Zu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Zu.prototype)}};jh=Zu=m([X({type:q.Sequence,itemType:Vn})],jh);const F2=`${tr}.14`;class mr extends Up{}class U2{constructor(e={}){Object.assign(this,e)}}m([w({type:T.GeneralizedTime,context:0,implicit:!0,optional:!0})],U2.prototype,"notBefore",void 0);m([w({type:T.GeneralizedTime,context:1,implicit:!0,optional:!0})],U2.prototype,"notAfter",void 0);var Eo;(function(t){t[t.keyUpdateAllowed=1]="keyUpdateAllowed",t[t.newExtensions=2]="newExtensions",t[t.pKIXCertificate=4]="pKIXCertificate"})(Eo||(Eo={}));class M2 extends Gc{toJSON(){const e=[],n=this.toNumber();return n&Eo.pKIXCertificate&&e.push("pKIXCertificate"),n&Eo.newExtensions&&e.push("newExtensions"),n&Eo.keyUpdateAllowed&&e.push("keyUpdateAllowed"),e}toString(){return`[${this.toJSON().join(", ")}]`}}class q2{constructor(e={}){this.entrustVers="",this.entrustInfoFlags=new M2,Object.assign(this,e)}}m([w({type:T.GeneralString})],q2.prototype,"entrustVers",void 0);m([w({type:M2})],q2.prototype,"entrustInfoFlags",void 0);var Qu;let Lh=Qu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Qu.prototype)}};Lh=Qu=m([X({type:q.Sequence,itemType:ss})],Lh);class ce{constructor(e={}){this.algorithm="",Object.assign(this,e)}isEqual(e){return e instanceof ce&&e.algorithm==this.algorithm&&(e.parameters&&this.parameters&&O_(e.parameters,this.parameters)||e.parameters===this.parameters)}}m([w({type:T.ObjectIdentifier})],ce.prototype,"algorithm",void 0);m([w({type:T.Any,optional:!0})],ce.prototype,"parameters",void 0);class sn{constructor(e={}){this.algorithm=new ce,this.subjectPublicKey=new ArrayBuffer(0),Object.assign(this,e)}}m([w({type:ce})],sn.prototype,"algorithm",void 0);m([w({type:T.BitString})],sn.prototype,"subjectPublicKey",void 0);let ut=class{constructor(e){if(e)if(typeof e=="string"||typeof e=="number"||e instanceof Date){const n=new Date(e);n.getUTCFullYear()>2049?this.generalTime=n:this.utcTime=n}else Object.assign(this,e)}getTime(){const e=this.utcTime||this.generalTime;if(!e)throw new Error("Cannot get time from CHOICE object");return e}};m([w({type:T.UTCTime})],ut.prototype,"utcTime",void 0);m([w({type:T.GeneralizedTime})],ut.prototype,"generalTime",void 0);ut=m([X({type:q.Choice})],ut);class as{constructor(e){this.notBefore=new ut(new Date),this.notAfter=new ut(new Date),e&&(this.notBefore=new ut(e.notBefore),this.notAfter=new ut(e.notAfter))}}m([w({type:ut})],as.prototype,"notBefore",void 0);m([w({type:ut})],as.prototype,"notAfter",void 0);var ed;let Yt=class V2{constructor(e={}){this.extnID="",this.critical=V2.CRITICAL,this.extnValue=new Ie,Object.assign(this,e)}};Yt.CRITICAL=!1;m([w({type:T.ObjectIdentifier})],Yt.prototype,"extnID",void 0);m([w({type:T.Boolean,defaultValue:Yt.CRITICAL})],Yt.prototype,"critical",void 0);m([w({type:Ie})],Yt.prototype,"extnValue",void 0);let wr=ed=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,ed.prototype)}};wr=ed=m([X({type:q.Sequence,itemType:Yt})],wr);var Wr;(function(t){t[t.v1=0]="v1",t[t.v2=1]="v2",t[t.v3=2]="v3"})(Wr||(Wr={}));class Mt{constructor(e={}){this.version=Wr.v1,this.serialNumber=new ArrayBuffer(0),this.signature=new ce,this.issuer=new Ze,this.validity=new as,this.subject=new Ze,this.subjectPublicKeyInfo=new sn,Object.assign(this,e)}}m([w({type:T.Integer,context:0,defaultValue:Wr.v1})],Mt.prototype,"version",void 0);m([w({type:T.Integer,converter:qe})],Mt.prototype,"serialNumber",void 0);m([w({type:ce})],Mt.prototype,"signature",void 0);m([w({type:Ze})],Mt.prototype,"issuer",void 0);m([w({type:as})],Mt.prototype,"validity",void 0);m([w({type:Ze})],Mt.prototype,"subject",void 0);m([w({type:sn})],Mt.prototype,"subjectPublicKeyInfo",void 0);m([w({type:T.BitString,context:1,implicit:!0,optional:!0})],Mt.prototype,"issuerUniqueID",void 0);m([w({type:T.BitString,context:2,implicit:!0,optional:!0})],Mt.prototype,"subjectUniqueID",void 0);m([w({type:wr,context:3,optional:!0})],Mt.prototype,"extensions",void 0);class Xr{constructor(e={}){this.tbsCertificate=new Mt,this.signatureAlgorithm=new ce,this.signatureValue=new ArrayBuffer(0),Object.assign(this,e)}}m([w({type:Mt})],Xr.prototype,"tbsCertificate",void 0);m([w({type:ce})],Xr.prototype,"signatureAlgorithm",void 0);m([w({type:T.BitString})],Xr.prototype,"signatureValue",void 0);class Zc{constructor(e={}){this.userCertificate=new ArrayBuffer(0),this.revocationDate=new ut,Object.assign(this,e)}}m([w({type:T.Integer,converter:qe})],Zc.prototype,"userCertificate",void 0);m([w({type:ut})],Zc.prototype,"revocationDate",void 0);m([w({type:Yt,optional:!0,repeated:"sequence"})],Zc.prototype,"crlEntryExtensions",void 0);class nr{constructor(e={}){this.signature=new ce,this.issuer=new Ze,this.thisUpdate=new ut,Object.assign(this,e)}}m([w({type:T.Integer,optional:!0})],nr.prototype,"version",void 0);m([w({type:ce})],nr.prototype,"signature",void 0);m([w({type:Ze})],nr.prototype,"issuer",void 0);m([w({type:ut})],nr.prototype,"thisUpdate",void 0);m([w({type:ut,optional:!0})],nr.prototype,"nextUpdate",void 0);m([w({type:Zc,repeated:"sequence",optional:!0})],nr.prototype,"revokedCertificates",void 0);m([w({type:Yt,optional:!0,context:0,repeated:"sequence"})],nr.prototype,"crlExtensions",void 0);class Kp{constructor(e={}){this.tbsCertList=new nr,this.signatureAlgorithm=new ce,this.signature=new ArrayBuffer(0),Object.assign(this,e)}}m([w({type:nr})],Kp.prototype,"tbsCertList",void 0);m([w({type:ce})],Kp.prototype,"signatureAlgorithm",void 0);m([w({type:T.BitString})],Kp.prototype,"signature",void 0);class eo{constructor(e={}){this.issuer=new Ze,this.serialNumber=new ArrayBuffer(0),Object.assign(this,e)}}m([w({type:Ze})],eo.prototype,"issuer",void 0);m([w({type:T.Integer,converter:qe})],eo.prototype,"serialNumber",void 0);let Di=class{constructor(e={}){Object.assign(this,e)}};m([w({type:mr,context:0,implicit:!0})],Di.prototype,"subjectKeyIdentifier",void 0);m([w({type:eo})],Di.prototype,"issuerAndSerialNumber",void 0);Di=m([X({type:q.Choice})],Di);var Hn;(function(t){t[t.v0=0]="v0",t[t.v1=1]="v1",t[t.v2=2]="v2",t[t.v3=3]="v3",t[t.v4=4]="v4",t[t.v5=5]="v5"})(Hn||(Hn={}));let Ro=class extends ce{};Ro=m([X({type:q.Sequence})],Ro);let Ba=class extends ce{};Ba=m([X({type:q.Sequence})],Ba);let In=class extends ce{};In=m([X({type:q.Sequence})],In);let ja=class extends ce{};ja=m([X({type:q.Sequence})],ja);let Fh=class extends ce{};Fh=m([X({type:q.Sequence})],Fh);let td=class extends ce{};td=m([X({type:q.Sequence})],td);let to=class{constructor(e={}){this.attrType="",this.attrValues=[],Object.assign(this,e)}};m([w({type:T.ObjectIdentifier})],to.prototype,"attrType",void 0);m([w({type:T.Any,repeated:"set"})],to.prototype,"attrValues",void 0);var nd;class zn{constructor(e={}){this.version=Hn.v0,this.sid=new Di,this.digestAlgorithm=new Ro,this.signatureAlgorithm=new Ba,this.signature=new Ie,Object.assign(this,e)}}m([w({type:T.Integer})],zn.prototype,"version",void 0);m([w({type:Di})],zn.prototype,"sid",void 0);m([w({type:Ro})],zn.prototype,"digestAlgorithm",void 0);m([w({type:to,repeated:"set",context:0,implicit:!0,optional:!0})],zn.prototype,"signedAttrs",void 0);m([w({type:Ba})],zn.prototype,"signatureAlgorithm",void 0);m([w({type:Ie})],zn.prototype,"signature",void 0);m([w({type:to,repeated:"set",context:1,implicit:!0,optional:!0})],zn.prototype,"unsignedAttrs",void 0);let La=nd=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,nd.prototype)}};La=nd=m([X({type:q.Set,itemType:zn})],La);let Uh=class extends ut{};Uh=m([X({type:q.Choice})],Uh);let Mh=class extends zn{};Mh=m([X({type:q.Sequence})],Mh);class Gp{constructor(e={}){this.acIssuer=new ke,this.acSerial=0,this.attrs=[],Object.assign(this,e)}}m([w({type:ke})],Gp.prototype,"acIssuer",void 0);m([w({type:T.Integer})],Gp.prototype,"acSerial",void 0);m([w({type:Vn,repeated:"sequence"})],Gp.prototype,"attrs",void 0);var rd;let Fa=rd=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,rd.prototype)}};Fa=rd=m([X({type:q.Sequence,itemType:T.ObjectIdentifier})],Fa);class Qc{constructor(e={}){this.permitUnSpecified=!0,Object.assign(this,e)}}m([w({type:T.Integer,optional:!0})],Qc.prototype,"pathLenConstraint",void 0);m([w({type:Fa,implicit:!0,context:0,optional:!0})],Qc.prototype,"permittedAttrs",void 0);m([w({type:Fa,implicit:!0,context:1,optional:!0})],Qc.prototype,"excludedAttrs",void 0);m([w({type:T.Boolean,defaultValue:!0})],Qc.prototype,"permitUnSpecified",void 0);class ai{constructor(e={}){this.issuer=new gt,this.serial=new ArrayBuffer(0),this.issuerUID=new ArrayBuffer(0),Object.assign(this,e)}}m([w({type:gt})],ai.prototype,"issuer",void 0);m([w({type:T.Integer,converter:qe})],ai.prototype,"serial",void 0);m([w({type:T.BitString,optional:!0})],ai.prototype,"issuerUID",void 0);var id;(function(t){t[t.publicKey=0]="publicKey",t[t.publicKeyCert=1]="publicKeyCert",t[t.otherObjectTypes=2]="otherObjectTypes"})(id||(id={}));class ci{constructor(e={}){this.digestedObjectType=id.publicKey,this.digestAlgorithm=new ce,this.objectDigest=new ArrayBuffer(0),Object.assign(this,e)}}m([w({type:T.Enumerated})],ci.prototype,"digestedObjectType",void 0);m([w({type:T.ObjectIdentifier,optional:!0})],ci.prototype,"otherObjectTypeID",void 0);m([w({type:ce})],ci.prototype,"digestAlgorithm",void 0);m([w({type:T.BitString})],ci.prototype,"objectDigest",void 0);class el{constructor(e={}){Object.assign(this,e)}}m([w({type:gt,optional:!0})],el.prototype,"issuerName",void 0);m([w({type:ai,context:0,implicit:!0,optional:!0})],el.prototype,"baseCertificateID",void 0);m([w({type:ci,context:1,implicit:!0,optional:!0})],el.prototype,"objectDigestInfo",void 0);let Ri=class{constructor(e={}){Object.assign(this,e)}};m([w({type:ke,repeated:"sequence"})],Ri.prototype,"v1Form",void 0);m([w({type:el,context:0,implicit:!0})],Ri.prototype,"v2Form",void 0);Ri=m([X({type:q.Choice})],Ri);class tl{constructor(e={}){this.notBeforeTime=new Date,this.notAfterTime=new Date,Object.assign(this,e)}}m([w({type:T.GeneralizedTime})],tl.prototype,"notBeforeTime",void 0);m([w({type:T.GeneralizedTime})],tl.prototype,"notAfterTime",void 0);class cs{constructor(e={}){Object.assign(this,e)}}m([w({type:ai,implicit:!0,context:0,optional:!0})],cs.prototype,"baseCertificateID",void 0);m([w({type:gt,implicit:!0,context:1,optional:!0})],cs.prototype,"entityName",void 0);m([w({type:ci,implicit:!0,context:2,optional:!0})],cs.prototype,"objectDigestInfo",void 0);var od;(function(t){t[t.v2=1]="v2"})(od||(od={}));class yn{constructor(e={}){this.version=od.v2,this.holder=new cs,this.issuer=new Ri,this.signature=new ce,this.serialNumber=new ArrayBuffer(0),this.attrCertValidityPeriod=new tl,this.attributes=[],Object.assign(this,e)}}m([w({type:T.Integer})],yn.prototype,"version",void 0);m([w({type:cs})],yn.prototype,"holder",void 0);m([w({type:Ri})],yn.prototype,"issuer",void 0);m([w({type:ce})],yn.prototype,"signature",void 0);m([w({type:T.Integer,converter:qe})],yn.prototype,"serialNumber",void 0);m([w({type:tl})],yn.prototype,"attrCertValidityPeriod",void 0);m([w({type:Vn,repeated:"sequence"})],yn.prototype,"attributes",void 0);m([w({type:T.BitString,optional:!0})],yn.prototype,"issuerUniqueID",void 0);m([w({type:wr,optional:!0})],yn.prototype,"extensions",void 0);class nl{constructor(e={}){this.acinfo=new yn,this.signatureAlgorithm=new ce,this.signatureValue=new ArrayBuffer(0),Object.assign(this,e)}}m([w({type:yn})],nl.prototype,"acinfo",void 0);m([w({type:ce})],nl.prototype,"signatureAlgorithm",void 0);m([w({type:T.BitString})],nl.prototype,"signatureValue",void 0);var Ua;(function(t){t[t.unmarked=1]="unmarked",t[t.unclassified=2]="unclassified",t[t.restricted=4]="restricted",t[t.confidential=8]="confidential",t[t.secret=16]="secret",t[t.topSecret=32]="topSecret"})(Ua||(Ua={}));class sd extends Gc{}class Wp{constructor(e={}){this.type="",this.value=new ArrayBuffer(0),Object.assign(this,e)}}m([w({type:T.ObjectIdentifier,implicit:!0,context:0})],Wp.prototype,"type",void 0);m([w({type:T.Any,implicit:!0,context:1})],Wp.prototype,"value",void 0);class Xp{constructor(e={}){this.policyId="",this.classList=new sd(Ua.unclassified),Object.assign(this,e)}}m([w({type:T.ObjectIdentifier})],Xp.prototype,"policyId",void 0);m([w({type:sd,defaultValue:new sd(Ua.unclassified)})],Xp.prototype,"classList",void 0);m([w({type:Wp,repeated:"set"})],Xp.prototype,"securityCategories",void 0);class rl{constructor(e={}){Object.assign(this,e)}}m([w({type:Ie})],rl.prototype,"cotets",void 0);m([w({type:T.ObjectIdentifier})],rl.prototype,"oid",void 0);m([w({type:T.Utf8String})],rl.prototype,"string",void 0);class H2{constructor(e={}){this.values=[],Object.assign(this,e)}}m([w({type:gt,implicit:!0,context:0,optional:!0})],H2.prototype,"policyAuthority",void 0);m([w({type:rl,repeated:"sequence"})],H2.prototype,"values",void 0);var ad;class il{constructor(e={}){this.targetCertificate=new ai,Object.assign(this,e)}}m([w({type:ai})],il.prototype,"targetCertificate",void 0);m([w({type:ke,optional:!0})],il.prototype,"targetName",void 0);m([w({type:ci,optional:!0})],il.prototype,"certDigestInfo",void 0);let Pi=class{constructor(e={}){Object.assign(this,e)}};m([w({type:ke,context:0,implicit:!0})],Pi.prototype,"targetName",void 0);m([w({type:ke,context:1,implicit:!0})],Pi.prototype,"targetGroup",void 0);m([w({type:il,context:2,implicit:!0})],Pi.prototype,"targetCert",void 0);Pi=m([X({type:q.Choice})],Pi);let cd=ad=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,ad.prototype)}};cd=ad=m([X({type:q.Sequence,itemType:Pi})],cd);var ld;let qh=ld=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,ld.prototype)}};qh=ld=m([X({type:q.Sequence,itemType:cd})],qh);class K2{constructor(e={}){Object.assign(this,e)}}m([w({type:gt,implicit:!0,context:0,optional:!0})],K2.prototype,"roleAuthority",void 0);m([w({type:ke,implicit:!0,context:1})],K2.prototype,"roleName",void 0);class Jp{constructor(e={}){this.service=new ke,this.ident=new ke,Object.assign(this,e)}}m([w({type:ke})],Jp.prototype,"service",void 0);m([w({type:ke})],Jp.prototype,"ident",void 0);m([w({type:Ie,optional:!0})],Jp.prototype,"authInfo",void 0);var ud;class Yp{constructor(e={}){this.otherCertFormat="",this.otherCert=new ArrayBuffer(0),Object.assign(this,e)}}m([w({type:T.ObjectIdentifier})],Yp.prototype,"otherCertFormat",void 0);m([w({type:T.Any})],Yp.prototype,"otherCert",void 0);let Bi=class{constructor(e={}){Object.assign(this,e)}};m([w({type:Xr})],Bi.prototype,"certificate",void 0);m([w({type:nl,context:2,implicit:!0})],Bi.prototype,"v2AttrCert",void 0);m([w({type:Yp,context:3,implicit:!0})],Bi.prototype,"other",void 0);Bi=m([X({type:q.Choice})],Bi);let Ma=ud=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,ud.prototype)}};Ma=ud=m([X({type:q.Set,itemType:Bi})],Ma);class no{constructor(e={}){this.contentType="",this.content=new ArrayBuffer(0),Object.assign(this,e)}}m([w({type:T.ObjectIdentifier})],no.prototype,"contentType",void 0);m([w({type:T.Any,context:0})],no.prototype,"content",void 0);let Po=class{constructor(e={}){Object.assign(this,e)}};m([w({type:Ie})],Po.prototype,"single",void 0);m([w({type:T.Any})],Po.prototype,"any",void 0);Po=m([X({type:q.Choice})],Po);class ol{constructor(e={}){this.eContentType="",Object.assign(this,e)}}m([w({type:T.ObjectIdentifier})],ol.prototype,"eContentType",void 0);m([w({type:Po,context:0,optional:!0})],ol.prototype,"eContent",void 0);let Bo=class{constructor(e={}){Object.assign(this,e)}};m([w({type:Ie,context:0,implicit:!0,optional:!0})],Bo.prototype,"value",void 0);m([w({type:Ie,converter:q3,context:0,implicit:!0,optional:!0,repeated:"sequence"})],Bo.prototype,"constructedValue",void 0);Bo=m([X({type:q.Choice})],Bo);class ls{constructor(e={}){this.contentType="",this.contentEncryptionAlgorithm=new ja,Object.assign(this,e)}}m([w({type:T.ObjectIdentifier})],ls.prototype,"contentType",void 0);m([w({type:ja})],ls.prototype,"contentEncryptionAlgorithm",void 0);m([w({type:Bo,optional:!0})],ls.prototype,"encryptedContent",void 0);class sl{constructor(e={}){this.keyAttrId="",Object.assign(this,e)}}m([w({type:T.ObjectIdentifier})],sl.prototype,"keyAttrId",void 0);m([w({type:T.Any,optional:!0})],sl.prototype,"keyAttr",void 0);var dd;class al{constructor(e={}){this.subjectKeyIdentifier=new mr,Object.assign(this,e)}}m([w({type:mr})],al.prototype,"subjectKeyIdentifier",void 0);m([w({type:T.GeneralizedTime,optional:!0})],al.prototype,"date",void 0);m([w({type:sl,optional:!0})],al.prototype,"other",void 0);let ji=class{constructor(e={}){Object.assign(this,e)}};m([w({type:al,context:0,implicit:!0,optional:!0})],ji.prototype,"rKeyId",void 0);m([w({type:eo,optional:!0})],ji.prototype,"issuerAndSerialNumber",void 0);ji=m([X({type:q.Choice})],ji);class Zp{constructor(e={}){this.rid=new ji,this.encryptedKey=new Ie,Object.assign(this,e)}}m([w({type:ji})],Zp.prototype,"rid",void 0);m([w({type:Ie})],Zp.prototype,"encryptedKey",void 0);let qa=dd=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,dd.prototype)}};qa=dd=m([X({type:q.Sequence,itemType:Zp})],qa);class Qp{constructor(e={}){this.algorithm=new ce,this.publicKey=new ArrayBuffer(0),Object.assign(this,e)}}m([w({type:ce})],Qp.prototype,"algorithm",void 0);m([w({type:T.BitString})],Qp.prototype,"publicKey",void 0);let Jr=class{constructor(e={}){Object.assign(this,e)}};m([w({type:mr,context:0,implicit:!0,optional:!0})],Jr.prototype,"subjectKeyIdentifier",void 0);m([w({type:Qp,context:1,implicit:!0,optional:!0})],Jr.prototype,"originatorKey",void 0);m([w({type:eo,optional:!0})],Jr.prototype,"issuerAndSerialNumber",void 0);Jr=m([X({type:q.Choice})],Jr);class ro{constructor(e={}){this.version=Hn.v3,this.originator=new Jr,this.keyEncryptionAlgorithm=new In,this.recipientEncryptedKeys=new qa,Object.assign(this,e)}}m([w({type:T.Integer})],ro.prototype,"version",void 0);m([w({type:Jr,context:0})],ro.prototype,"originator",void 0);m([w({type:Ie,context:1,optional:!0})],ro.prototype,"ukm",void 0);m([w({type:In})],ro.prototype,"keyEncryptionAlgorithm",void 0);m([w({type:qa})],ro.prototype,"recipientEncryptedKeys",void 0);let Li=class{constructor(e={}){Object.assign(this,e)}};m([w({type:mr,context:0,implicit:!0})],Li.prototype,"subjectKeyIdentifier",void 0);m([w({type:eo})],Li.prototype,"issuerAndSerialNumber",void 0);Li=m([X({type:q.Choice})],Li);class us{constructor(e={}){this.version=Hn.v0,this.rid=new Li,this.keyEncryptionAlgorithm=new In,this.encryptedKey=new Ie,Object.assign(this,e)}}m([w({type:T.Integer})],us.prototype,"version",void 0);m([w({type:Li})],us.prototype,"rid",void 0);m([w({type:In})],us.prototype,"keyEncryptionAlgorithm",void 0);m([w({type:Ie})],us.prototype,"encryptedKey",void 0);class ds{constructor(e={}){this.keyIdentifier=new Ie,Object.assign(this,e)}}m([w({type:Ie})],ds.prototype,"keyIdentifier",void 0);m([w({type:T.GeneralizedTime,optional:!0})],ds.prototype,"date",void 0);m([w({type:sl,optional:!0})],ds.prototype,"other",void 0);class ps{constructor(e={}){this.version=Hn.v4,this.kekid=new ds,this.keyEncryptionAlgorithm=new In,this.encryptedKey=new Ie,Object.assign(this,e)}}m([w({type:T.Integer})],ps.prototype,"version",void 0);m([w({type:ds})],ps.prototype,"kekid",void 0);m([w({type:In})],ps.prototype,"keyEncryptionAlgorithm",void 0);m([w({type:Ie})],ps.prototype,"encryptedKey",void 0);class fs{constructor(e={}){this.version=Hn.v0,this.keyEncryptionAlgorithm=new In,this.encryptedKey=new Ie,Object.assign(this,e)}}m([w({type:T.Integer})],fs.prototype,"version",void 0);m([w({type:td,context:0,optional:!0})],fs.prototype,"keyDerivationAlgorithm",void 0);m([w({type:In})],fs.prototype,"keyEncryptionAlgorithm",void 0);m([w({type:Ie})],fs.prototype,"encryptedKey",void 0);class ef{constructor(e={}){this.oriType="",this.oriValue=new ArrayBuffer(0),Object.assign(this,e)}}m([w({type:T.ObjectIdentifier})],ef.prototype,"oriType",void 0);m([w({type:T.Any})],ef.prototype,"oriValue",void 0);let vr=class{constructor(e={}){Object.assign(this,e)}};m([w({type:us,optional:!0})],vr.prototype,"ktri",void 0);m([w({type:ro,context:1,implicit:!0,optional:!0})],vr.prototype,"kari",void 0);m([w({type:ps,context:2,implicit:!0,optional:!0})],vr.prototype,"kekri",void 0);m([w({type:fs,context:3,implicit:!0,optional:!0})],vr.prototype,"pwri",void 0);m([w({type:ef,context:4,implicit:!0,optional:!0})],vr.prototype,"ori",void 0);vr=m([X({type:q.Choice})],vr);var pd;let Va=pd=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,pd.prototype)}};Va=pd=m([X({type:q.Set,itemType:vr})],Va);var fd;class cl{constructor(e={}){this.otherRevInfoFormat="",this.otherRevInfo=new ArrayBuffer(0),Object.assign(this,e)}}m([w({type:T.ObjectIdentifier})],cl.prototype,"otherRevInfoFormat",void 0);m([w({type:T.Any})],cl.prototype,"otherRevInfo",void 0);let Ha=class{constructor(e={}){this.other=new cl,Object.assign(this,e)}};m([w({type:cl,context:1,implicit:!0})],Ha.prototype,"other",void 0);Ha=m([X({type:q.Choice})],Ha);let Ka=fd=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,fd.prototype)}};Ka=fd=m([X({type:q.Set,itemType:Ha})],Ka);class tf{constructor(e={}){Object.assign(this,e)}}m([w({type:Ma,context:0,implicit:!0,optional:!0})],tf.prototype,"certs",void 0);m([w({type:Ka,context:1,implicit:!0,optional:!0})],tf.prototype,"crls",void 0);var hd;let gd=hd=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,hd.prototype)}};gd=hd=m([X({type:q.Set,itemType:to})],gd);class hs{constructor(e={}){this.version=Hn.v0,this.recipientInfos=new Va,this.encryptedContentInfo=new ls,Object.assign(this,e)}}m([w({type:T.Integer})],hs.prototype,"version",void 0);m([w({type:tf,context:0,implicit:!0,optional:!0})],hs.prototype,"originatorInfo",void 0);m([w({type:Va})],hs.prototype,"recipientInfos",void 0);m([w({type:ls})],hs.prototype,"encryptedContentInfo",void 0);m([w({type:gd,context:1,implicit:!0,optional:!0})],hs.prototype,"unprotectedAttrs",void 0);const g4="1.2.840.113549.1.7.2";var md;let Ga=md=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,md.prototype)}};Ga=md=m([X({type:q.Set,itemType:Ro})],Ga);class io{constructor(e={}){this.version=Hn.v0,this.digestAlgorithms=new Ga,this.encapContentInfo=new ol,this.signerInfos=new La,Object.assign(this,e)}}m([w({type:T.Integer})],io.prototype,"version",void 0);m([w({type:Ga})],io.prototype,"digestAlgorithms",void 0);m([w({type:ol})],io.prototype,"encapContentInfo",void 0);m([w({type:Ma,context:0,implicit:!0,optional:!0})],io.prototype,"certificates",void 0);m([w({type:Ka,context:1,implicit:!0,optional:!0})],io.prototype,"crls",void 0);m([w({type:La})],io.prototype,"signerInfos",void 0);const jo="1.2.840.10045.2.1",nf="1.2.840.10045.4.1",G2="1.2.840.10045.4.3.1",rf="1.2.840.10045.4.3.2",of="1.2.840.10045.4.3.3",sf="1.2.840.10045.4.3.4",Vh="1.2.840.10045.3.1.7",Hh="1.3.132.0.34",Kh="1.3.132.0.35";function gs(t){return new ce({algorithm:t})}const m4=gs(nf);gs(G2);const _4=gs(rf),y4=gs(of),w4=gs(sf);let Lo=class{constructor(e={}){Object.assign(this,e)}};m([w({type:T.ObjectIdentifier})],Lo.prototype,"fieldType",void 0);m([w({type:T.Any})],Lo.prototype,"parameters",void 0);Lo=m([X({type:q.Sequence})],Lo);class v4 extends Ie{}let Fi=class{constructor(e={}){Object.assign(this,e)}};m([w({type:T.OctetString})],Fi.prototype,"a",void 0);m([w({type:T.OctetString})],Fi.prototype,"b",void 0);m([w({type:T.BitString,optional:!0})],Fi.prototype,"seed",void 0);Fi=m([X({type:q.Sequence})],Fi);var _d;(function(t){t[t.ecpVer1=1]="ecpVer1"})(_d||(_d={}));let Kn=class{constructor(e={}){this.version=_d.ecpVer1,Object.assign(this,e)}};m([w({type:T.Integer})],Kn.prototype,"version",void 0);m([w({type:Lo})],Kn.prototype,"fieldID",void 0);m([w({type:Fi})],Kn.prototype,"curve",void 0);m([w({type:v4})],Kn.prototype,"base",void 0);m([w({type:T.Integer,converter:qe})],Kn.prototype,"order",void 0);m([w({type:T.Integer,optional:!0})],Kn.prototype,"cofactor",void 0);Kn=m([X({type:q.Sequence})],Kn);let br=class{constructor(e={}){Object.assign(this,e)}};m([w({type:T.ObjectIdentifier})],br.prototype,"namedCurve",void 0);m([w({type:T.Null})],br.prototype,"implicitCurve",void 0);m([w({type:Kn})],br.prototype,"specifiedCurve",void 0);br=m([X({type:q.Choice})],br);class ll{constructor(e={}){this.version=1,this.privateKey=new Ie,Object.assign(this,e)}}m([w({type:T.Integer})],ll.prototype,"version",void 0);m([w({type:Ie})],ll.prototype,"privateKey",void 0);m([w({type:br,context:0,optional:!0})],ll.prototype,"parameters",void 0);m([w({type:T.BitString,context:1,optional:!0})],ll.prototype,"publicKey",void 0);class Wa{constructor(e={}){this.r=new ArrayBuffer(0),this.s=new ArrayBuffer(0),Object.assign(this,e)}}m([w({type:T.Integer,converter:qe})],Wa.prototype,"r",void 0);m([w({type:T.Integer,converter:qe})],Wa.prototype,"s",void 0);const Nt="1.2.840.113549.1.1",Yr=`${Nt}.1`,b4=`${Nt}.7`,$4=`${Nt}.9`,So=`${Nt}.10`,x4=`${Nt}.2`,A4=`${Nt}.4`,Xa=`${Nt}.5`,E4=`${Nt}.14`,yd=`${Nt}.11`,Ja=`${Nt}.12`,Ya=`${Nt}.13`,W2=`${Nt}.15`,X2=`${Nt}.16`,Za="1.3.14.3.2.26",J2="2.16.840.1.101.3.4.2.4",Qa="2.16.840.1.101.3.4.2.1",ec="2.16.840.1.101.3.4.2.2",tc="2.16.840.1.101.3.4.2.3",S4="2.16.840.1.101.3.4.2.5",k4="2.16.840.1.101.3.4.2.6",N4="1.2.840.113549.2.2",C4="1.2.840.113549.2.5",ul=`${Nt}.8`;function ot(t){return new ce({algorithm:t,parameters:null})}ot(N4);ot(C4);const Zr=ot(Za);ot(J2);ot(Qa);ot(ec);ot(tc);ot(S4);ot(k4);const Y2=new ce({algorithm:ul,parameters:te.serialize(Zr)}),Z2=new ce({algorithm:$4,parameters:te.serialize(Ta.toASN(new Uint8Array([218,57,163,238,94,107,75,13,50,85,191,239,149,96,24,144,175,216,7,9]).buffer))});ot(Yr);ot(x4);ot(A4);ot(Xa);ot(W2);ot(X2);ot(Ja);ot(Ya);ot(W2);ot(X2);class dl{constructor(e={}){this.hashAlgorithm=new ce(Zr),this.maskGenAlgorithm=new ce({algorithm:ul,parameters:te.serialize(Zr)}),this.pSourceAlgorithm=new ce(Z2),Object.assign(this,e)}}m([w({type:ce,context:0,defaultValue:Zr})],dl.prototype,"hashAlgorithm",void 0);m([w({type:ce,context:1,defaultValue:Y2})],dl.prototype,"maskGenAlgorithm",void 0);m([w({type:ce,context:2,defaultValue:Z2})],dl.prototype,"pSourceAlgorithm",void 0);new ce({algorithm:b4,parameters:te.serialize(new dl)});class Qr{constructor(e={}){this.hashAlgorithm=new ce(Zr),this.maskGenAlgorithm=new ce({algorithm:ul,parameters:te.serialize(Zr)}),this.saltLength=20,this.trailerField=1,Object.assign(this,e)}}m([w({type:ce,context:0,defaultValue:Zr})],Qr.prototype,"hashAlgorithm",void 0);m([w({type:ce,context:1,defaultValue:Y2})],Qr.prototype,"maskGenAlgorithm",void 0);m([w({type:T.Integer,context:2,defaultValue:20})],Qr.prototype,"saltLength",void 0);m([w({type:T.Integer,context:3,defaultValue:1})],Qr.prototype,"trailerField",void 0);new ce({algorithm:So,parameters:te.serialize(new Qr)});class pl{constructor(e={}){this.digestAlgorithm=new ce,this.digest=new Ie,Object.assign(this,e)}}m([w({type:ce})],pl.prototype,"digestAlgorithm",void 0);m([w({type:Ie})],pl.prototype,"digest",void 0);var wd;class fl{constructor(e={}){this.prime=new ArrayBuffer(0),this.exponent=new ArrayBuffer(0),this.coefficient=new ArrayBuffer(0),Object.assign(this,e)}}m([w({type:T.Integer,converter:qe})],fl.prototype,"prime",void 0);m([w({type:T.Integer,converter:qe})],fl.prototype,"exponent",void 0);m([w({type:T.Integer,converter:qe})],fl.prototype,"coefficient",void 0);let vd=wd=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,wd.prototype)}};vd=wd=m([X({type:q.Sequence,itemType:fl})],vd);class Dn{constructor(e={}){this.version=0,this.modulus=new ArrayBuffer(0),this.publicExponent=new ArrayBuffer(0),this.privateExponent=new ArrayBuffer(0),this.prime1=new ArrayBuffer(0),this.prime2=new ArrayBuffer(0),this.exponent1=new ArrayBuffer(0),this.exponent2=new ArrayBuffer(0),this.coefficient=new ArrayBuffer(0),Object.assign(this,e)}}m([w({type:T.Integer})],Dn.prototype,"version",void 0);m([w({type:T.Integer,converter:qe})],Dn.prototype,"modulus",void 0);m([w({type:T.Integer,converter:qe})],Dn.prototype,"publicExponent",void 0);m([w({type:T.Integer,converter:qe})],Dn.prototype,"privateExponent",void 0);m([w({type:T.Integer,converter:qe})],Dn.prototype,"prime1",void 0);m([w({type:T.Integer,converter:qe})],Dn.prototype,"prime2",void 0);m([w({type:T.Integer,converter:qe})],Dn.prototype,"exponent1",void 0);m([w({type:T.Integer,converter:qe})],Dn.prototype,"exponent2",void 0);m([w({type:T.Integer,converter:qe})],Dn.prototype,"coefficient",void 0);m([w({type:vd,optional:!0})],Dn.prototype,"otherPrimeInfos",void 0);class af{constructor(e={}){this.modulus=new ArrayBuffer(0),this.publicExponent=new ArrayBuffer(0),Object.assign(this,e)}}m([w({type:T.Integer,converter:qe})],af.prototype,"modulus",void 0);m([w({type:T.Integer,converter:qe})],af.prototype,"publicExponent",void 0);var bd;(function(t){t[t.Transient=0]="Transient",t[t.Singleton=1]="Singleton",t[t.ResolutionScoped=2]="ResolutionScoped",t[t.ContainerScoped=3]="ContainerScoped"})(bd||(bd={}));const At=bd;/*! *****************************************************************************
146
+ `)}`:`${n} :`}}U_=yt;le.Constructed=U_;yt.NAME="CONSTRUCTED";class M_ extends wt{fromBER(e,n,r){return n}toBER(e){return _n}}M_.override="EndOfContentValueBlock";var q_;class Np extends dt{constructor(e={}){super(e,M_),this.idBlock.tagClass=1,this.idBlock.tagNumber=0}}q_=Np;le.EndOfContent=q_;Np.NAME=zo;var V_;class Hr extends dt{constructor(e={}){super(e,wt),this.idBlock.tagClass=1,this.idBlock.tagNumber=5}fromBER(e,n,r){return this.lenBlock.length>0&&this.warnings.push("Non-zero length of value block for Null type"),this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.blockLength+=r,n+r>e.byteLength?(this.error="End of input reached before message was fully decoded (inconsistent offset and length values)",-1):n+r}toBER(e,n){const r=new ArrayBuffer(2);if(!e){const i=new Uint8Array(r);i[0]=5,i[1]=0}return n&&n.write(r),r}onAsciiEncoding(){return`${this.constructor.NAME}`}}V_=Hr;le.Null=V_;Hr.NAME="NULL";class H_ extends On(wt){get value(){for(const e of this.valueHexView)if(e>0)return!0;return!1}set value(e){this.valueHexView[0]=e?255:0}constructor({value:e,...n}={}){super(n),n.valueHex?this.valueHexView=ne.toUint8Array(n.valueHex):this.valueHexView=new Uint8Array(1),e&&(this.value=e)}fromBER(e,n,r){const i=ne.toUint8Array(e);return Qn(this,i,n,r)?(this.valueHexView=i.subarray(n,n+r),r>1&&this.warnings.push("Boolean value encoded in more then 1 octet"),this.isHexOnly=!0,z_.call(this),this.blockLength=r,n+r):-1}toBER(){return this.valueHexView.slice()}toJSON(){return{...super.toJSON(),value:this.value}}}H_.NAME="BooleanValueBlock";var K_;let zc=class extends dt{getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}constructor(e={}){super(e,H_),this.idBlock.tagClass=1,this.idBlock.tagNumber=1}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.getValue}`}};K_=zc;le.Boolean=K_;zc.NAME="BOOLEAN";class G_ extends On(gr){constructor({isConstructed:e=!1,...n}={}){super(n),this.isConstructed=e}fromBER(e,n,r){let i=0;if(this.isConstructed){if(this.isHexOnly=!1,i=gr.prototype.fromBER.call(this,e,n,r),i===-1)return i;for(let o=0;o<this.value.length;o++){const a=this.value[o].constructor.NAME;if(a===zo){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, OCTET STRING may consists of OCTET STRINGs only",-1}if(a!==D_)return this.error="OCTET STRING may consists of OCTET STRINGs only",-1}}else this.isHexOnly=!0,i=super.fromBER(e,n,r),this.blockLength=r;return i}toBER(e,n){return this.isConstructed?gr.prototype.toBER.call(this,e,n):e?new ArrayBuffer(this.valueHexView.byteLength):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),isConstructed:this.isConstructed}}}G_.NAME="OctetStringValueBlock";var Cp;let Ur=class extends dt{constructor({idBlock:e={},lenBlock:n={},...r}={}){var i,o;(i=r.isConstructed)!==null&&i!==void 0||(r.isConstructed=!!(!((o=r.value)===null||o===void 0)&&o.length)),super({idBlock:{isConstructed:r.isConstructed,...e},lenBlock:{...n,isIndefiniteForm:!!r.isIndefiniteForm},...r},G_),this.idBlock.tagClass=1,this.idBlock.tagNumber=4}fromBER(e,n,r){if(this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,r===0)return this.idBlock.error.length===0&&(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length===0&&(this.blockLength+=this.lenBlock.blockLength),n;if(!this.valueBlock.isConstructed){const o=(e instanceof ArrayBuffer?new Uint8Array(e):e).subarray(n,n+r);try{if(o.byteLength){const a=Ji(o,0,o.byteLength);a.offset!==-1&&a.offset===r&&(this.valueBlock.value=[a.result])}}catch{}}return super.fromBER(e,n,r)}onAsciiEncoding(){if(this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length)return yt.prototype.onAsciiEncoding.call(this);const e=this.constructor.NAME,n=fe.ToHex(this.valueBlock.valueHexView);return`${e} : ${n}`}getValue(){if(!this.idBlock.isConstructed)return this.valueBlock.valueHexView.slice().buffer;const e=[];for(const n of this.valueBlock.value)n instanceof Cp&&e.push(n.valueBlock.valueHexView);return ne.concat(e)}};Cp=Ur;le.OctetString=Cp;Ur.NAME=D_;class W_ extends On(gr){constructor({unusedBits:e=0,isConstructed:n=!1,...r}={}){super(r),this.unusedBits=e,this.isConstructed=n,this.blockLength=this.valueHexView.byteLength}fromBER(e,n,r){if(!r)return n;let i=-1;if(this.isConstructed){if(i=gr.prototype.fromBER.call(this,e,n,r),i===-1)return i;for(const l of this.value){const u=l.constructor.NAME;if(u===zo){if(this.isIndefiniteForm)break;return this.error="EndOfContent is unexpected, BIT STRING may consists of BIT STRINGs only",-1}if(u!==R_)return this.error="BIT STRING may consists of BIT STRINGs only",-1;const d=l.valueBlock;if(this.unusedBits>0&&d.unusedBits>0)return this.error='Using of "unused bits" inside constructive BIT STRING allowed for least one only',-1;this.unusedBits=d.unusedBits}return i}const o=ne.toUint8Array(e);if(!Qn(this,o,n,r))return-1;const a=o.subarray(n,n+r);if(this.unusedBits=a[0],this.unusedBits>7)return this.error="Unused bits for BitString must be in range 0-7",-1;if(!this.unusedBits){const l=a.subarray(1);try{if(l.byteLength){const u=Ji(l,0,l.byteLength);u.offset!==-1&&u.offset===r-1&&(this.value=[u.result])}}catch{}}return this.valueHexView=a.subarray(1),this.blockLength=a.length,n+r}toBER(e,n){if(this.isConstructed)return gr.prototype.toBER.call(this,e,n);if(e)return new ArrayBuffer(this.valueHexView.byteLength+1);if(!this.valueHexView.byteLength)return _n;const r=new Uint8Array(this.valueHexView.length+1);return r[0]=this.unusedBits,r.set(this.valueHexView,1),r.buffer}toJSON(){return{...super.toJSON(),unusedBits:this.unusedBits,isConstructed:this.isConstructed}}}W_.NAME="BitStringValueBlock";var X_;let Mr=class extends dt{constructor({idBlock:e={},lenBlock:n={},...r}={}){var i,o;(i=r.isConstructed)!==null&&i!==void 0||(r.isConstructed=!!(!((o=r.value)===null||o===void 0)&&o.length)),super({idBlock:{isConstructed:r.isConstructed,...e},lenBlock:{...n,isIndefiniteForm:!!r.isIndefiniteForm},...r},W_),this.idBlock.tagClass=1,this.idBlock.tagNumber=3}fromBER(e,n,r){return this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,super.fromBER(e,n,r)}onAsciiEncoding(){if(this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length)return yt.prototype.onAsciiEncoding.call(this);{const e=[],n=this.valueBlock.valueHexView;for(const a of n)e.push(a.toString(2).padStart(8,"0"));const r=e.join(""),i=this.constructor.NAME,o=r.substring(0,r.length-this.valueBlock.unusedBits);return`${i} : ${o}`}}};X_=Mr;le.BitString=X_;Mr.NAME=R_;var J_;function z3(t,e){const n=new Uint8Array([0]),r=new Uint8Array(t),i=new Uint8Array(e);let o=r.slice(0);const a=o.length-1,l=i.slice(0),u=l.length-1;let d=0;const p=u<a?a:u;let h=0;for(let g=p;g>=0;g--,h++){switch(!0){case h<l.length:d=o[a-h]+l[u-h]+n[0];break;default:d=o[a-h]+n[0]}switch(n[0]=d/10,!0){case h>=o.length:o=ku(new Uint8Array([d%10]),o);break;default:o[a-h]=d%10}}return n[0]>0&&(o=ku(n,o)),o}function kh(t){if(t>=ho.length)for(let e=ho.length;e<=t;e++){const n=new Uint8Array([0]);let r=ho[e-1].slice(0);for(let i=r.length-1;i>=0;i--){const o=new Uint8Array([(r[i]<<1)+n[0]]);n[0]=o[0]/10,r[i]=o[0]%10}n[0]>0&&(r=ku(n,r)),ho.push(r)}return ho[t]}function D3(t,e){let n=0;const r=new Uint8Array(t),i=new Uint8Array(e),o=r.slice(0),a=o.length-1,l=i.slice(0),u=l.length-1;let d,p=0;for(let h=u;h>=0;h--,p++)switch(d=o[a-p]-l[u-p]-n,!0){case d<0:n=1,o[a-p]=d+10;break;default:n=0,o[a-p]=d}if(n>0)for(let h=a-u+1;h>=0;h--,p++)if(d=o[a-p]-n,d<0)n=1,o[a-p]=d+10;else{n=0,o[a-p]=d;break}return o.slice()}class Tp extends On(wt){setValueHex(){this.valueHexView.length>=4?(this.warnings.push("Too big Integer for decoding, hex only"),this.isHexOnly=!0,this._valueDec=0):(this.isHexOnly=!1,this.valueHexView.length>0&&(this._valueDec=z_.call(this)))}constructor({value:e,...n}={}){super(n),this._valueDec=0,n.valueHex&&this.setValueHex(),e!==void 0&&(this.valueDec=e)}set valueDec(e){this._valueDec=e,this.isHexOnly=!1,this.valueHexView=new Uint8Array(b3(e))}get valueDec(){return this._valueDec}fromDER(e,n,r,i=0){const o=this.fromBER(e,n,r);if(o===-1)return o;const a=this.valueHexView;return a[0]===0&&a[1]&128?this.valueHexView=a.subarray(1):i!==0&&a.length<i&&(i-a.length>1&&(i=a.length+1),this.valueHexView=a.subarray(i-a.length)),o}toDER(e=!1){const n=this.valueHexView;switch(!0){case(n[0]&128)!==0:{const r=new Uint8Array(this.valueHexView.length+1);r[0]=0,r.set(n,1),this.valueHexView=r}break;case(n[0]===0&&(n[1]&128)===0):this.valueHexView=this.valueHexView.subarray(1);break}return this.toBER(e)}fromBER(e,n,r){const i=super.fromBER(e,n,r);return i===-1||this.setValueHex(),i}toBER(e){return e?new ArrayBuffer(this.valueHexView.length):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}toString(){const e=this.valueHexView.length*8-1;let n=new Uint8Array(this.valueHexView.length*8/3),r=0,i;const o=this.valueHexView;let a="",l=!1;for(let u=o.byteLength-1;u>=0;u--){i=o[u];for(let d=0;d<8;d++){if((i&1)===1)switch(r){case e:n=D3(kh(r),n),a="-";break;default:n=z3(n,kh(r))}r++,i>>=1}}for(let u=0;u<n.length;u++)n[u]&&(l=!0),l&&(a+=Eh.charAt(n[u]));return l===!1&&(a+=Eh.charAt(0)),a}}J_=Tp;Tp.NAME="IntegerValueBlock";Object.defineProperty(J_.prototype,"valueHex",{set:function(t){this.valueHexView=new Uint8Array(t),this.setValueHex()},get:function(){return this.valueHexView.slice().buffer}});var $o;class Yi extends dt{constructor(e={}){super(e,Tp),this.idBlock.tagClass=1,this.idBlock.tagNumber=2}toBigInt(){return Na(),BigInt(this.valueBlock.toString())}static fromBigInt(e){Na();const n=BigInt(e),r=new Ic,i=n.toString(16).replace(/^-/,""),o=new Uint8Array(fe.FromHex(i));if(n<0){const l=new Uint8Array(o.length+(o[0]&128?1:0));l[0]|=128;const d=BigInt(`0x${fe.ToHex(l)}`)+n,p=ne.toUint8Array(fe.FromHex(d.toString(16)));p[0]|=128,r.write(p)}else o[0]&128&&r.write(new Uint8Array([0])),r.write(o);return new $o({valueHex:r.final()})}convertToDER(){const e=new $o({valueHex:this.valueBlock.valueHexView});return e.valueBlock.toDER(),e}convertFromDER(){return new $o({valueHex:this.valueBlock.valueHexView[0]===0?this.valueBlock.valueHexView.subarray(1):this.valueBlock.valueHexView})}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()}`}}$o=Yi;le.Integer=$o;Yi.NAME="INTEGER";var Y_;class Dc extends Yi{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=10}}Y_=Dc;le.Enumerated=Y_;Dc.NAME="ENUMERATED";class Nu extends On(wt){constructor({valueDec:e=-1,isFirstSid:n=!1,...r}={}){super(r),this.valueDec=e,this.isFirstSid=n}fromBER(e,n,r){if(!r)return n;const i=ne.toUint8Array(e);if(!Qn(this,i,n,r))return-1;const o=i.subarray(n,n+r);this.valueHexView=new Uint8Array(r);for(let l=0;l<r&&(this.valueHexView[l]=o[l]&127,this.blockLength++,!!(o[l]&128));l++);const a=new Uint8Array(this.blockLength);for(let l=0;l<this.blockLength;l++)a[l]=this.valueHexView[l];return this.valueHexView=a,o[this.blockLength-1]&128?(this.error="End of input reached before message was fully decoded",-1):(this.valueHexView[0]===0&&this.warnings.push("Needlessly long format of SID encoding"),this.blockLength<=8?this.valueDec=Ii(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),n+this.blockLength)}set valueBigInt(e){Na();let n=BigInt(e).toString(2);for(;n.length%7;)n="0"+n;const r=new Uint8Array(n.length/7);for(let i=0;i<r.length;i++)r[i]=parseInt(n.slice(i*7,i*7+7),2)+(i+1<r.length?128:0);this.fromBER(r.buffer,0,r.length)}toBER(e){if(this.isHexOnly){if(e)return new ArrayBuffer(this.valueHexView.byteLength);const i=this.valueHexView,o=new Uint8Array(this.blockLength);for(let a=0;a<this.blockLength-1;a++)o[a]=i[a]|128;return o[this.blockLength-1]=i[this.blockLength-1],o.buffer}const n=Vr(this.valueDec,7);if(n.byteLength===0)return this.error="Error during encoding SID value",_n;const r=new Uint8Array(n.byteLength);if(!e){const i=new Uint8Array(n),o=n.byteLength-1;for(let a=0;a<o;a++)r[a]=i[a]|128;r[o]=i[o]}return r}toString(){let e="";if(this.isHexOnly)e=fe.ToHex(this.valueHexView);else if(this.isFirstSid){let n=this.valueDec;this.valueDec<=39?e="0.":this.valueDec<=79?(e="1.",n-=40):(e="2.",n-=80),e+=n.toString()}else e=this.valueDec.toString();return e}toJSON(){return{...super.toJSON(),valueDec:this.valueDec,isFirstSid:this.isFirstSid}}}Nu.NAME="sidBlock";class Z_ extends wt{constructor({value:e=Et,...n}={}){super(n),this.value=[],e&&this.fromString(e)}fromBER(e,n,r){let i=n;for(;r>0;){const o=new Nu;if(i=o.fromBER(e,i,r),i===-1)return this.blockLength=0,this.error=o.error,i;this.value.length===0&&(o.isFirstSid=!0),this.blockLength+=o.blockLength,r-=o.blockLength,this.value.push(o)}return i}toBER(e){const n=[];for(let r=0;r<this.value.length;r++){const i=this.value[r].toBER(e);if(i.byteLength===0)return this.error=this.value[r].error,_n;n.push(i)}return Sp(n)}fromString(e){this.value=[];let n=0,r=0,i="",o=!1;do if(r=e.indexOf(".",n),r===-1?i=e.substring(n):i=e.substring(n,r),n=r+1,o){const a=this.value[0];let l=0;switch(a.valueDec){case 0:break;case 1:l=40;break;case 2:l=80;break;default:this.value=[];return}const u=parseInt(i,10);if(isNaN(u))return;a.valueDec=u+l,o=!1}else{const a=new Nu;if(i>Number.MAX_SAFE_INTEGER){Na();const l=BigInt(i);a.valueBigInt=l}else if(a.valueDec=parseInt(i,10),isNaN(a.valueDec))return;this.value.length||(a.isFirstSid=!0,o=!0),this.value.push(a)}while(r!==-1)}toString(){let e="",n=!1;for(let r=0;r<this.value.length;r++){n=this.value[r].isHexOnly;let i=this.value[r].toString();r!==0&&(e=`${e}.`),n?(i=`{${i}}`,this.value[r].isFirstSid?e=`2.{${i} - 80}`:e+=i):e+=i}return e}toJSON(){const e={...super.toJSON(),value:this.toString(),sidArray:[]};for(let n=0;n<this.value.length;n++)e.sidArray.push(this.value[n].toJSON());return e}}Z_.NAME="ObjectIdentifierValueBlock";var Q_;class Rc extends dt{getValue(){return this.valueBlock.toString()}setValue(e){this.valueBlock.fromString(e)}constructor(e={}){super(e,Z_),this.idBlock.tagClass=1,this.idBlock.tagNumber=6}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return{...super.toJSON(),value:this.getValue()}}}Q_=Rc;le.ObjectIdentifier=Q_;Rc.NAME="OBJECT IDENTIFIER";class Cu extends On(si){constructor({valueDec:e=0,...n}={}){super(n),this.valueDec=e}fromBER(e,n,r){if(r===0)return n;const i=ne.toUint8Array(e);if(!Qn(this,i,n,r))return-1;const o=i.subarray(n,n+r);this.valueHexView=new Uint8Array(r);for(let l=0;l<r&&(this.valueHexView[l]=o[l]&127,this.blockLength++,!!(o[l]&128));l++);const a=new Uint8Array(this.blockLength);for(let l=0;l<this.blockLength;l++)a[l]=this.valueHexView[l];return this.valueHexView=a,o[this.blockLength-1]&128?(this.error="End of input reached before message was fully decoded",-1):(this.valueHexView[0]===0&&this.warnings.push("Needlessly long format of SID encoding"),this.blockLength<=8?this.valueDec=Ii(this.valueHexView,7):(this.isHexOnly=!0,this.warnings.push("Too big SID for decoding, hex only")),n+this.blockLength)}toBER(e){if(this.isHexOnly){if(e)return new ArrayBuffer(this.valueHexView.byteLength);const i=this.valueHexView,o=new Uint8Array(this.blockLength);for(let a=0;a<this.blockLength-1;a++)o[a]=i[a]|128;return o[this.blockLength-1]=i[this.blockLength-1],o.buffer}const n=Vr(this.valueDec,7);if(n.byteLength===0)return this.error="Error during encoding SID value",_n;const r=new Uint8Array(n.byteLength);if(!e){const i=new Uint8Array(n),o=n.byteLength-1;for(let a=0;a<o;a++)r[a]=i[a]|128;r[o]=i[o]}return r.buffer}toString(){let e="";return this.isHexOnly?e=fe.ToHex(this.valueHexView):e=this.valueDec.toString(),e}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}}Cu.NAME="relativeSidBlock";class e2 extends wt{constructor({value:e=Et,...n}={}){super(n),this.value=[],e&&this.fromString(e)}fromBER(e,n,r){let i=n;for(;r>0;){const o=new Cu;if(i=o.fromBER(e,i,r),i===-1)return this.blockLength=0,this.error=o.error,i;this.blockLength+=o.blockLength,r-=o.blockLength,this.value.push(o)}return i}toBER(e,n){const r=[];for(let i=0;i<this.value.length;i++){const o=this.value[i].toBER(e);if(o.byteLength===0)return this.error=this.value[i].error,_n;r.push(o)}return Sp(r)}fromString(e){this.value=[];let n=0,r=0,i="";do{r=e.indexOf(".",n),r===-1?i=e.substring(n):i=e.substring(n,r),n=r+1;const o=new Cu;if(o.valueDec=parseInt(i,10),isNaN(o.valueDec))return!0;this.value.push(o)}while(r!==-1);return!0}toString(){let e="",n=!1;for(let r=0;r<this.value.length;r++){n=this.value[r].isHexOnly;let i=this.value[r].toString();r!==0&&(e=`${e}.`),n&&(i=`{${i}}`),e+=i}return e}toJSON(){const e={...super.toJSON(),value:this.toString(),sidArray:[]};for(let n=0;n<this.value.length;n++)e.sidArray.push(this.value[n].toJSON());return e}}e2.NAME="RelativeObjectIdentifierValueBlock";var t2;class Ip extends dt{getValue(){return this.valueBlock.toString()}setValue(e){this.valueBlock.fromString(e)}constructor(e={}){super(e,e2),this.idBlock.tagClass=1,this.idBlock.tagNumber=13}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.valueBlock.toString()||"empty"}`}toJSON(){return{...super.toJSON(),value:this.getValue()}}}t2=Ip;le.RelativeObjectIdentifier=t2;Ip.NAME="RelativeObjectIdentifier";var n2;class an extends yt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=16}}n2=an;le.Sequence=n2;an.NAME="SEQUENCE";var r2;let kn=class extends yt{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=17}};r2=kn;le.Set=r2;kn.NAME="SET";class i2 extends On(wt){constructor({...e}={}){super(e),this.isHexOnly=!0,this.value=Et}toJSON(){return{...super.toJSON(),value:this.value}}}i2.NAME="StringValueBlock";class o2 extends i2{}o2.NAME="SimpleStringValueBlock";class Ut extends kp{constructor({...e}={}){super(e,o2)}fromBuffer(e){this.valueBlock.value=String.fromCharCode.apply(null,ne.toUint8Array(e))}fromString(e){const n=e.length,r=this.valueBlock.valueHexView=new Uint8Array(n);for(let i=0;i<n;i++)r[i]=e.charCodeAt(i);this.valueBlock.value=e}}Ut.NAME="SIMPLE STRING";class s2 extends Ut{fromBuffer(e){this.valueBlock.valueHexView=ne.toUint8Array(e);try{this.valueBlock.value=fe.ToUtf8String(e)}catch(n){this.warnings.push(`Error during "decodeURIComponent": ${n}, using raw string`),this.valueBlock.value=fe.ToBinary(e)}}fromString(e){this.valueBlock.valueHexView=new Uint8Array(fe.FromUtf8String(e)),this.valueBlock.value=e}}s2.NAME="Utf8StringValueBlock";var a2;class er extends s2{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=12}}a2=er;le.Utf8String=a2;er.NAME="UTF8String";class c2 extends Ut{fromBuffer(e){this.valueBlock.value=fe.ToUtf16String(e),this.valueBlock.valueHexView=ne.toUint8Array(e)}fromString(e){this.valueBlock.value=e,this.valueBlock.valueHexView=new Uint8Array(fe.FromUtf16String(e))}}c2.NAME="BmpStringValueBlock";var l2;class Pc extends c2{constructor({...e}={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=30}}l2=Pc;le.BmpString=l2;Pc.NAME="BMPString";class u2 extends Ut{fromBuffer(e){const n=ArrayBuffer.isView(e)?e.slice().buffer:e.slice(0),r=new Uint8Array(n);for(let i=0;i<r.length;i+=4)r[i]=r[i+3],r[i+1]=r[i+2],r[i+2]=0,r[i+3]=0;this.valueBlock.value=String.fromCharCode.apply(null,new Uint32Array(n))}fromString(e){const n=e.length,r=this.valueBlock.valueHexView=new Uint8Array(n*4);for(let i=0;i<n;i++){const o=Vr(e.charCodeAt(i),8),a=new Uint8Array(o);if(a.length>4)continue;const l=4-a.length;for(let u=a.length-1;u>=0;u--)r[i*4+u+l]=a[u]}this.valueBlock.value=e}}u2.NAME="UniversalStringValueBlock";var d2;class Bc extends u2{constructor({...e}={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=28}}d2=Bc;le.UniversalString=d2;Bc.NAME="UniversalString";var p2;class jc extends Ut{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=18}}p2=jc;le.NumericString=p2;jc.NAME="NumericString";var f2;class Lc extends Ut{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=19}}f2=Lc;le.PrintableString=f2;Lc.NAME="PrintableString";var h2;class Fc extends Ut{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=20}}h2=Fc;le.TeletexString=h2;Fc.NAME="TeletexString";var g2;class Uc extends Ut{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=21}}g2=Uc;le.VideotexString=g2;Uc.NAME="VideotexString";var m2;class Mc extends Ut{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=22}}m2=Mc;le.IA5String=m2;Mc.NAME="IA5String";var _2;class qc extends Ut{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=25}}_2=qc;le.GraphicString=_2;qc.NAME="GraphicString";var y2;class is extends Ut{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=26}}y2=is;le.VisibleString=y2;is.NAME="VisibleString";var w2;class Vc extends Ut{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=27}}w2=Vc;le.GeneralString=w2;Vc.NAME="GeneralString";var v2;class Hc extends Ut{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=29}}v2=Hc;le.CharacterString=v2;Hc.NAME="CharacterString";var b2;class os extends is{constructor({value:e,valueDate:n,...r}={}){if(super(r),this.year=0,this.month=0,this.day=0,this.hour=0,this.minute=0,this.second=0,e){this.fromString(e),this.valueBlock.valueHexView=new Uint8Array(e.length);for(let i=0;i<e.length;i++)this.valueBlock.valueHexView[i]=e.charCodeAt(i)}n&&(this.fromDate(n),this.valueBlock.valueHexView=new Uint8Array(this.toBuffer())),this.idBlock.tagClass=1,this.idBlock.tagNumber=23}fromBuffer(e){this.fromString(String.fromCharCode.apply(null,ne.toUint8Array(e)))}toBuffer(){const e=this.toString(),n=new ArrayBuffer(e.length),r=new Uint8Array(n);for(let i=0;i<e.length;i++)r[i]=e.charCodeAt(i);return n}fromDate(e){this.year=e.getUTCFullYear(),this.month=e.getUTCMonth()+1,this.day=e.getUTCDate(),this.hour=e.getUTCHours(),this.minute=e.getUTCMinutes(),this.second=e.getUTCSeconds()}toDate(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second))}fromString(e){const r=/(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})Z/ig.exec(e);if(r===null){this.error="Wrong input string for conversion";return}const i=parseInt(r[1],10);i>=50?this.year=1900+i:this.year=2e3+i,this.month=parseInt(r[2],10),this.day=parseInt(r[3],10),this.hour=parseInt(r[4],10),this.minute=parseInt(r[5],10),this.second=parseInt(r[6],10)}toString(e="iso"){if(e==="iso"){const n=new Array(7);return n[0]=Pt(this.year<2e3?this.year-1900:this.year-2e3,2),n[1]=Pt(this.month,2),n[2]=Pt(this.day,2),n[3]=Pt(this.hour,2),n[4]=Pt(this.minute,2),n[5]=Pt(this.second,2),n[6]="Z",n.join("")}return super.toString(e)}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.toDate().toISOString()}`}toJSON(){return{...super.toJSON(),year:this.year,month:this.month,day:this.day,hour:this.hour,minute:this.minute,second:this.second}}}b2=os;le.UTCTime=b2;os.NAME="UTCTime";var $2;class Kc extends os{constructor(e={}){var n;super(e),(n=this.millisecond)!==null&&n!==void 0||(this.millisecond=0),this.idBlock.tagClass=1,this.idBlock.tagNumber=24}fromDate(e){super.fromDate(e),this.millisecond=e.getUTCMilliseconds()}toDate(){const e=Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second,this.millisecond);return new Date(e)}fromString(e){let n=!1,r="",i="",o=0,a,l=0,u=0;if(e[e.length-1]==="Z")r=e.substring(0,e.length-1),n=!0;else{const h=new Number(e[e.length-1]);if(isNaN(h.valueOf()))throw new Error("Wrong input string for conversion");r=e}if(n){if(r.indexOf("+")!==-1)throw new Error("Wrong input string for conversion");if(r.indexOf("-")!==-1)throw new Error("Wrong input string for conversion")}else{let h=1,g=r.indexOf("+"),A="";if(g===-1&&(g=r.indexOf("-"),h=-1),g!==-1){if(A=r.substring(g+1),r=r.substring(0,g),A.length!==2&&A.length!==4)throw new Error("Wrong input string for conversion");let $=parseInt(A.substring(0,2),10);if(isNaN($.valueOf()))throw new Error("Wrong input string for conversion");if(l=h*$,A.length===4){if($=parseInt(A.substring(2,4),10),isNaN($.valueOf()))throw new Error("Wrong input string for conversion");u=h*$}}}let d=r.indexOf(".");if(d===-1&&(d=r.indexOf(",")),d!==-1){const h=new Number(`0${r.substring(d)}`);if(isNaN(h.valueOf()))throw new Error("Wrong input string for conversion");o=h.valueOf(),i=r.substring(0,d)}else i=r;switch(!0){case i.length===8:if(a=/(\d{4})(\d{2})(\d{2})/ig,d!==-1)throw new Error("Wrong input string for conversion");break;case i.length===10:if(a=/(\d{4})(\d{2})(\d{2})(\d{2})/ig,d!==-1){let h=60*o;this.minute=Math.floor(h),h=60*(h-this.minute),this.second=Math.floor(h),h=1e3*(h-this.second),this.millisecond=Math.floor(h)}break;case i.length===12:if(a=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})/ig,d!==-1){let h=60*o;this.second=Math.floor(h),h=1e3*(h-this.second),this.millisecond=Math.floor(h)}break;case i.length===14:if(a=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/ig,d!==-1){const h=1e3*o;this.millisecond=Math.floor(h)}break;default:throw new Error("Wrong input string for conversion")}const p=a.exec(i);if(p===null)throw new Error("Wrong input string for conversion");for(let h=1;h<p.length;h++)switch(h){case 1:this.year=parseInt(p[h],10);break;case 2:this.month=parseInt(p[h],10);break;case 3:this.day=parseInt(p[h],10);break;case 4:this.hour=parseInt(p[h],10)+l;break;case 5:this.minute=parseInt(p[h],10)+u;break;case 6:this.second=parseInt(p[h],10);break;default:throw new Error("Wrong input string for conversion")}if(n===!1){const h=new Date(this.year,this.month,this.day,this.hour,this.minute,this.second,this.millisecond);this.year=h.getUTCFullYear(),this.month=h.getUTCMonth(),this.day=h.getUTCDay(),this.hour=h.getUTCHours(),this.minute=h.getUTCMinutes(),this.second=h.getUTCSeconds(),this.millisecond=h.getUTCMilliseconds()}}toString(e="iso"){if(e==="iso"){const n=[];return n.push(Pt(this.year,4)),n.push(Pt(this.month,2)),n.push(Pt(this.day,2)),n.push(Pt(this.hour,2)),n.push(Pt(this.minute,2)),n.push(Pt(this.second,2)),this.millisecond!==0&&(n.push("."),n.push(Pt(this.millisecond,3))),n.push("Z"),n.join("")}return super.toString(e)}toJSON(){return{...super.toJSON(),millisecond:this.millisecond}}}$2=Kc;le.GeneralizedTime=$2;Kc.NAME="GeneralizedTime";var x2;class Op extends er{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=31}}x2=Op;le.DATE=x2;Op.NAME="DATE";var A2;class zp extends er{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=32}}A2=zp;le.TimeOfDay=A2;zp.NAME="TimeOfDay";var E2;class Dp extends er{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=33}}E2=Dp;le.DateTime=E2;Dp.NAME="DateTime";var S2;class Rp extends er{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=34}}S2=Rp;le.Duration=S2;Rp.NAME="Duration";var k2;class Pp extends er{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=14}}k2=Pp;le.TIME=k2;Pp.NAME="TIME";class Kr{constructor({name:e=Et,optional:n=!1}={}){this.name=e,this.optional=n}}class Bp extends Kr{constructor({value:e=[],...n}={}){super(n),this.value=e}}class Ca extends Kr{constructor({value:e=new Kr,local:n=!1,...r}={}){super(r),this.value=e,this.local=n}}class R3{get data(){return this.dataView.slice().buffer}set data(e){this.dataView=ne.toUint8Array(e)}constructor({data:e=Oc}={}){this.dataView=ne.toUint8Array(e)}fromBER(e,n,r){const i=n+r;return this.dataView=ne.toUint8Array(e).subarray(n,i),i}toBER(e){return this.dataView.slice().buffer}}function pr(t,e,n){if(n instanceof Bp){for(const o of n.value)if(pr(t,e,o).verified)return{verified:!0,result:t};{const o={verified:!1,result:{error:"Wrong values for Choice type"}};return n.hasOwnProperty(Ul)&&(o.name=n.name),o}}if(n instanceof Kr)return n.hasOwnProperty(Ul)&&(t[n.name]=e),{verified:!0,result:t};if(!(t instanceof Object))return{verified:!1,result:{error:"Wrong root object"}};if(!(e instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 data"}};if(!(n instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(A3 in n))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(N3 in n.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(!(C3 in n.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};const r=n.idBlock.toBER(!1);if(r.byteLength===0)return{verified:!1,result:{error:"Error encoding idBlock for ASN.1 schema"}};if(n.idBlock.fromBER(r,0,r.byteLength)===-1)return{verified:!1,result:{error:"Error decoding idBlock for ASN.1 schema"}};if(n.idBlock.hasOwnProperty(E3)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(n.idBlock.tagClass!==e.idBlock.tagClass)return{verified:!1,result:t};if(n.idBlock.hasOwnProperty(S3)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(n.idBlock.tagNumber!==e.idBlock.tagNumber)return{verified:!1,result:t};if(n.idBlock.hasOwnProperty(k3)===!1)return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(n.idBlock.isConstructed!==e.idBlock.isConstructed)return{verified:!1,result:t};if(!(x3 in n.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};if(n.idBlock.isHexOnly!==e.idBlock.isHexOnly)return{verified:!1,result:t};if(n.idBlock.isHexOnly){if(!(Sh in n.idBlock))return{verified:!1,result:{error:"Wrong ASN.1 schema"}};const o=n.idBlock.valueHexView,a=e.idBlock.valueHexView;if(o.length!==a.length)return{verified:!1,result:t};for(let l=0;l<o.length;l++)if(o[l]!==a[1])return{verified:!1,result:t}}if(n.name&&(n.name=n.name.replace(/^\s+|\s+$/g,Et),n.name&&(t[n.name]=e)),n instanceof le.Constructed){let o=0,a={verified:!1,result:{error:"Unknown error"}},l=n.valueBlock.value.length;if(l>0&&n.valueBlock.value[0]instanceof Ca&&(l=e.valueBlock.value.length),l===0)return{verified:!0,result:t};if(e.valueBlock.value.length===0&&n.valueBlock.value.length!==0){let u=!0;for(let d=0;d<n.valueBlock.value.length;d++)u=u&&(n.valueBlock.value[d].optional||!1);return u?{verified:!0,result:t}:(n.name&&(n.name=n.name.replace(/^\s+|\s+$/g,Et),n.name&&delete t[n.name]),t.error="Inconsistent object length",{verified:!1,result:t})}for(let u=0;u<l;u++)if(u-o>=e.valueBlock.value.length){if(n.valueBlock.value[u].optional===!1){const d={verified:!1,result:t};return t.error="Inconsistent length between ASN.1 data and schema",n.name&&(n.name=n.name.replace(/^\s+|\s+$/g,Et),n.name&&(delete t[n.name],d.name=n.name)),d}}else if(n.valueBlock.value[0]instanceof Ca){if(a=pr(t,e.valueBlock.value[u],n.valueBlock.value[0].value),a.verified===!1)if(n.valueBlock.value[0].optional)o++;else return n.name&&(n.name=n.name.replace(/^\s+|\s+$/g,Et),n.name&&delete t[n.name]),a;if(Ul in n.valueBlock.value[0]&&n.valueBlock.value[0].name.length>0){let d={};T3 in n.valueBlock.value[0]&&n.valueBlock.value[0].local?d=e:d=t,typeof d[n.valueBlock.value[0].name]>"u"&&(d[n.valueBlock.value[0].name]=[]),d[n.valueBlock.value[0].name].push(e.valueBlock.value[u])}}else if(a=pr(t,e.valueBlock.value[u-o],n.valueBlock.value[u]),a.verified===!1)if(n.valueBlock.value[u].optional)o++;else return n.name&&(n.name=n.name.replace(/^\s+|\s+$/g,Et),n.name&&delete t[n.name]),a;if(a.verified===!1){const u={verified:!1,result:t};return n.name&&(n.name=n.name.replace(/^\s+|\s+$/g,Et),n.name&&(delete t[n.name],u.name=n.name)),u}return{verified:!0,result:t}}if(n.primitiveSchema&&Sh in e.valueBlock){const o=Ji(e.valueBlock.valueHexView);if(o.offset===-1){const a={verified:!1,result:o.result};return n.name&&(n.name=n.name.replace(/^\s+|\s+$/g,Et),n.name&&(delete t[n.name],a.name=n.name)),a}return pr(t,o.result,n.primitiveSchema)}return{verified:!0,result:t}}function P3(t,e){if(!(e instanceof Object))return{verified:!1,result:{error:"Wrong ASN.1 schema type"}};const n=Ji(ne.toUint8Array(t));return n.offset===-1?{verified:!1,result:n.result}:pr(n.result,n.result,e)}const N2=Object.freeze(Object.defineProperty({__proto__:null,Any:Kr,BaseBlock:dt,BaseStringBlock:kp,BitString:Mr,BmpString:Pc,Boolean:zc,CharacterString:Hc,Choice:Bp,Constructed:yt,DATE:Op,DateTime:Dp,Duration:Rp,EndOfContent:Np,Enumerated:Dc,GeneralString:Vc,GeneralizedTime:Kc,GraphicString:qc,HexBlock:On,IA5String:Mc,Integer:Yi,Null:Hr,NumericString:jc,ObjectIdentifier:Rc,OctetString:Ur,Primitive:rs,PrintableString:Lc,RawData:R3,RelativeObjectIdentifier:Ip,Repeated:Ca,Sequence:an,Set:kn,TIME:Pp,TeletexString:Fc,TimeOfDay:zp,UTCTime:os,UniversalString:Bc,Utf8String:er,ValueBlock:wt,VideotexString:Uc,ViewWriter:Ic,VisibleString:is,compareSchema:pr,fromBER:ki,verifySchema:P3},Symbol.toStringTag,{value:"Module"}));var q;(function(t){t[t.Sequence=0]="Sequence",t[t.Set=1]="Set",t[t.Choice=2]="Choice"})(q||(q={}));var T;(function(t){t[t.Any=1]="Any",t[t.Boolean=2]="Boolean",t[t.OctetString=3]="OctetString",t[t.BitString=4]="BitString",t[t.Integer=5]="Integer",t[t.Enumerated=6]="Enumerated",t[t.ObjectIdentifier=7]="ObjectIdentifier",t[t.Utf8String=8]="Utf8String",t[t.BmpString=9]="BmpString",t[t.UniversalString=10]="UniversalString",t[t.NumericString=11]="NumericString",t[t.PrintableString=12]="PrintableString",t[t.TeletexString=13]="TeletexString",t[t.VideotexString=14]="VideotexString",t[t.IA5String=15]="IA5String",t[t.GraphicString=16]="GraphicString",t[t.VisibleString=17]="VisibleString",t[t.GeneralString=18]="GeneralString",t[t.CharacterString=19]="CharacterString",t[t.UTCTime=20]="UTCTime",t[t.GeneralizedTime=21]="GeneralizedTime",t[t.DATE=22]="DATE",t[t.TimeOfDay=23]="TimeOfDay",t[t.DateTime=24]="DateTime",t[t.Duration=25]="Duration",t[t.TIME=26]="TIME",t[t.Null=27]="Null"})(T||(T={}));class Gc{constructor(e,n=0){if(this.unusedBits=0,this.value=new ArrayBuffer(0),e)if(typeof e=="number")this.fromNumber(e);else if(ne.isBufferSource(e))this.unusedBits=n,this.value=ne.toArrayBuffer(e);else throw TypeError("Unsupported type of 'params' argument for BitString")}fromASN(e){if(!(e instanceof Mr))throw new TypeError("Argument 'asn' is not instance of ASN.1 BitString");return this.unusedBits=e.valueBlock.unusedBits,this.value=e.valueBlock.valueHex,this}toASN(){return new Mr({unusedBits:this.unusedBits,valueHex:this.value})}toSchema(e){return new Mr({name:e})}toNumber(){let e="";const n=new Uint8Array(this.value);for(const r of n)e+=r.toString(2).padStart(8,"0");return e=e.split("").reverse().join(""),this.unusedBits&&(e=e.slice(this.unusedBits).padStart(this.unusedBits,"0")),parseInt(e,2)}fromNumber(e){let n=e.toString(2);const r=n.length+7>>3;this.unusedBits=(r<<3)-n.length;const i=new Uint8Array(r);n=n.padStart(r<<3,"0").split("").reverse().join("");let o=0;for(;o<r;)i[o]=parseInt(n.slice(o<<3,(o<<3)+8),2),o++;this.value=i.buffer}}class Ie{get byteLength(){return this.buffer.byteLength}get byteOffset(){return 0}constructor(e){typeof e=="number"?this.buffer=new ArrayBuffer(e):ne.isBufferSource(e)?this.buffer=ne.toArrayBuffer(e):Array.isArray(e)?this.buffer=new Uint8Array(e):this.buffer=new ArrayBuffer(0)}fromASN(e){if(!(e instanceof Ur))throw new TypeError("Argument 'asn' is not instance of ASN.1 OctetString");return this.buffer=e.valueBlock.valueHex,this}toASN(){return new Ur({valueHex:this.buffer})}toSchema(e){return new Ur({name:e})}}const B3={fromASN:t=>t instanceof Hr?null:t.valueBeforeDecodeView,toASN:t=>{if(t===null)return new Hr;const e=ki(t);if(e.result.error)throw new Error(e.result.error);return e.result}},j3={fromASN:t=>t.valueBlock.valueHexView.byteLength>=4?t.valueBlock.toString():t.valueBlock.valueDec,toASN:t=>new Yi({value:+t})},L3={fromASN:t=>t.valueBlock.valueDec,toASN:t=>new Dc({value:t})},qe={fromASN:t=>t.valueBlock.valueHexView,toASN:t=>new Yi({valueHex:t})},F3={fromASN:t=>t.valueBlock.valueHexView,toASN:t=>new Mr({valueHex:t})},U3={fromASN:t=>t.valueBlock.toString(),toASN:t=>new Rc({value:t})},M3={fromASN:t=>t.valueBlock.value,toASN:t=>new zc({value:t})},Ta={fromASN:t=>t.valueBlock.valueHexView,toASN:t=>new Ur({valueHex:t})},q3={fromASN:t=>new Ie(t.getValue()),toASN:t=>t.toASN()};function Zt(t){return{fromASN:e=>e.valueBlock.value,toASN:e=>new t({value:e})}}const C2=Zt(er),V3=Zt(Pc),H3=Zt(Bc),K3=Zt(jc),G3=Zt(Lc),W3=Zt(Fc),X3=Zt(Uc),J3=Zt(Mc),Y3=Zt(qc),Z3=Zt(is),Q3=Zt(Vc),e4=Zt(Hc),t4={fromASN:t=>t.toDate(),toASN:t=>new os({valueDate:t})},n4={fromASN:t=>t.toDate(),toASN:t=>new Kc({valueDate:t})},r4={fromASN:()=>null,toASN:()=>new Hr};function xo(t){switch(t){case T.Any:return B3;case T.BitString:return F3;case T.BmpString:return V3;case T.Boolean:return M3;case T.CharacterString:return e4;case T.Enumerated:return L3;case T.GeneralString:return Q3;case T.GeneralizedTime:return n4;case T.GraphicString:return Y3;case T.IA5String:return J3;case T.Integer:return j3;case T.Null:return r4;case T.NumericString:return K3;case T.ObjectIdentifier:return U3;case T.OctetString:return Ta;case T.PrintableString:return G3;case T.TeletexString:return W3;case T.UTCTime:return t4;case T.UniversalString:return H3;case T.Utf8String:return C2;case T.VideotexString:return X3;case T.VisibleString:return Z3;default:return null}}function Un(t){return typeof t=="function"&&t.prototype?t.prototype.toASN&&t.prototype.fromASN?!0:Un(t.prototype):!!(t&&typeof t=="object"&&"toASN"in t&&"fromASN"in t)}function T2(t){var e;if(t){const n=Object.getPrototypeOf(t);return((e=n==null?void 0:n.prototype)===null||e===void 0?void 0:e.constructor)===Array?!0:T2(n)}return!1}function i4(t,e){if(!(t&&e)||t.byteLength!==e.byteLength)return!1;const n=new Uint8Array(t),r=new Uint8Array(e);for(let i=0;i<t.byteLength;i++)if(n[i]!==r[i])return!1;return!0}class o4{constructor(){this.items=new WeakMap}has(e){return this.items.has(e)}get(e,n=!1){const r=this.items.get(e);if(!r)throw new Error(`Cannot get schema for '${e.prototype.constructor.name}' target`);if(n&&!r.schema)throw new Error(`Schema '${e.prototype.constructor.name}' doesn't contain ASN.1 schema. Call 'AsnSchemaStorage.cache'.`);return r}cache(e){const n=this.get(e);n.schema||(n.schema=this.create(e,!0))}createDefault(e){const n={type:q.Sequence,items:{}},r=this.findParentSchema(e);return r&&(Object.assign(n,r),n.items=Object.assign({},n.items,r.items)),n}create(e,n){const r=this.items.get(e)||this.createDefault(e),i=[];for(const o in r.items){const a=r.items[o],l=n?o:"";let u;if(typeof a.type=="number"){const p=T[a.type],h=N2[p];if(!h)throw new Error(`Cannot get ASN1 class by name '${p}'`);u=new h({name:l})}else Un(a.type)?u=new a.type().toSchema(l):a.optional?this.get(a.type).type===q.Choice?u=new Kr({name:l}):(u=this.create(a.type,!1),u.name=l):u=new Kr({name:l});const d=!!a.optional||a.defaultValue!==void 0;if(a.repeated){u.name="";const p=a.repeated==="set"?kn:an;u=new p({name:"",value:[new Ca({name:l,value:u})]})}if(a.context!==null&&a.context!==void 0)if(a.implicit)if(typeof a.type=="number"||Un(a.type)){const p=a.repeated?yt:rs;i.push(new p({name:l,optional:d,idBlock:{tagClass:3,tagNumber:a.context}}))}else{this.cache(a.type);const p=!!a.repeated;let h=p?u:this.get(a.type,!0).schema;h="valueBlock"in h?h.valueBlock.value:h.value,i.push(new yt({name:p?"":l,optional:d,idBlock:{tagClass:3,tagNumber:a.context},value:h}))}else i.push(new yt({optional:d,idBlock:{tagClass:3,tagNumber:a.context},value:[u]}));else u.optional=d,i.push(u)}switch(r.type){case q.Sequence:return new an({value:i,name:""});case q.Set:return new kn({value:i,name:""});case q.Choice:return new Bp({value:i,name:""});default:throw new Error("Unsupported ASN1 type in use")}}set(e,n){return this.items.set(e,n),this}findParentSchema(e){const n=Object.getPrototypeOf(e);return n?this.items.get(n)||this.findParentSchema(n):null}}const rt=new o4,X=t=>e=>{let n;rt.has(e)?n=rt.get(e):(n=rt.createDefault(e),rt.set(e,n)),Object.assign(n,t)},w=t=>(e,n)=>{let r;rt.has(e.constructor)?r=rt.get(e.constructor):(r=rt.createDefault(e.constructor),rt.set(e.constructor,r));const i=Object.assign({},t);if(typeof i.type=="number"&&!i.converter){const o=xo(t.type);if(!o)throw new Error(`Cannot get default converter for property '${n}' of ${e.constructor.name}`);i.converter=o}r.items[n]=i};class go extends Error{constructor(){super(...arguments),this.schemas=[]}}class s4{static parse(e,n){const r=ki(e);if(r.result.error)throw new Error(r.result.error);return this.fromASN(r.result,n)}static fromASN(e,n){try{if(Un(n))return new n().fromASN(e);const r=rt.get(n);rt.cache(n);let i=r.schema;const o=this.handleChoiceTypes(e,r,n,i);if(o!=null&&o.result)return o.result;o!=null&&o.targetSchema&&(i=o.targetSchema);const a=this.handleSequenceTypes(e,r,n,i);if(a&&"isManualMapping"in a)return a.result;const l=a,u=new n;return T2(n)?this.handleArrayTypes(e,r,n):(this.processSchemaItems(r,l,u),u)}catch(r){throw r instanceof go&&r.schemas.push(n.name),r}}static handleChoiceTypes(e,n,r,i){if(e.constructor===yt&&n.type===q.Choice&&e.idBlock.tagClass===3)for(const o in n.items){const a=n.items[o];if(a.context===e.idBlock.tagNumber&&a.implicit&&typeof a.type=="function"&&rt.has(a.type)){const l=rt.get(a.type);if(l&&l.type===q.Sequence){const u=new an;if("value"in e.valueBlock&&Array.isArray(e.valueBlock.value)&&"value"in u.valueBlock){u.valueBlock.value=e.valueBlock.value;const d=this.fromASN(u,a.type),p=new r;return p[o]=d,{result:p}}}}}else if(e.constructor===yt&&n.type!==q.Choice){const o=new yt({idBlock:{tagClass:3,tagNumber:e.idBlock.tagNumber},value:n.schema.valueBlock.value});for(const a in n.items)delete e[a];return{targetSchema:o}}return null}static handleSequenceTypes(e,n,r,i){if(n.type===q.Sequence){if(Object.keys(n.items).filter(l=>{const u=n.items[l];return u.optional&&typeof u.type=="function"&&rt.has(u.type)&&rt.get(u.type).type===q.Choice}).length>0&&"value"in e.valueBlock&&Array.isArray(e.valueBlock.value)&&r.name==="CertReqMsg")return this.handleManualMapping(e,n,r);const a=pr({},e,i);if(!a.verified)throw new go(`Data does not match to ${r.name} ASN1 schema. ${a.result.error}`);return a}else{const o=pr({},e,i);if(!o.verified)throw new go(`Data does not match to ${r.name} ASN1 schema. ${o.result.error}`);return o}}static handleManualMapping(e,n,r){const i=new r,o=e.valueBlock.value,a=Object.keys(n.items);let l=0;for(let u=0;u<a.length;u++){const d=a[u],p=n.items[d];if(l>=o.length)break;if(p.repeated){i[d]=this.processRepeatedField(o,l,p);break}else if(typeof p.type=="number")i[d]=this.processPrimitiveField(o[l],p),l++;else if(this.isOptionalChoiceField(p)){const h=this.processOptionalChoiceField(o[l],p);h.processed&&(i[d]=h.value,l++)}else i[d]=this.fromASN(o[l],p.type),l++}return{result:i,verified:!0,isManualMapping:!0}}static processRepeatedField(e,n,r){let i=e.slice(n);if(i.length===1&&i[0].constructor.name==="Sequence"){const o=i[0];o.valueBlock&&o.valueBlock.value&&Array.isArray(o.valueBlock.value)&&(i=o.valueBlock.value)}if(typeof r.type=="number"){const o=xo(r.type);if(!o)throw new Error(`No converter for ASN.1 type ${r.type}`);return i.filter(a=>a&&a.valueBlock).map(a=>{try{return o.fromASN(a)}catch{return}}).filter(a=>a!==void 0)}else return i.filter(o=>o&&o.valueBlock).map(o=>{try{return this.fromASN(o,r.type)}catch{return}}).filter(o=>o!==void 0)}static processPrimitiveField(e,n){const r=xo(n.type);if(!r)throw new Error(`No converter for ASN.1 type ${n.type}`);return r.fromASN(e)}static isOptionalChoiceField(e){return e.optional&&typeof e.type=="function"&&rt.has(e.type)&&rt.get(e.type).type===q.Choice}static processOptionalChoiceField(e,n){try{return{processed:!0,value:this.fromASN(e,n.type)}}catch(r){if(r instanceof go&&/Wrong values for Choice type/.test(r.message))return{processed:!1};throw r}}static handleArrayTypes(e,n,r){if(!("value"in e.valueBlock&&Array.isArray(e.valueBlock.value)))throw new Error("Cannot get items from the ASN.1 parsed value. ASN.1 object is not constructed.");const i=n.itemType;if(typeof i=="number"){const o=xo(i);if(!o)throw new Error(`Cannot get default converter for array item of ${r.name} ASN1 schema`);return r.from(e.valueBlock.value,a=>o.fromASN(a))}else return r.from(e.valueBlock.value,o=>this.fromASN(o,i))}static processSchemaItems(e,n,r){for(const i in e.items){const o=n.result[i];if(!o)continue;const a=e.items[i],l=a.type;typeof l=="number"||Un(l)?r[i]=this.processPrimitiveSchemaItem(o,a,l):r[i]=this.processComplexSchemaItem(o,a,l)}}static processPrimitiveSchemaItem(e,n,r){var i;const o=(i=n.converter)!==null&&i!==void 0?i:Un(r)?new r:null;if(!o)throw new Error("Converter is empty");return n.repeated?this.processRepeatedPrimitiveItem(e,n,o):this.processSinglePrimitiveItem(e,n,r,o)}static processRepeatedPrimitiveItem(e,n,r){if(n.implicit){const i=n.repeated==="sequence"?an:kn,o=new i;o.valueBlock=e.valueBlock;const a=ki(o.toBER(!1));if(a.offset===-1)throw new Error(`Cannot parse the child item. ${a.result.error}`);if(!("value"in a.result.valueBlock&&Array.isArray(a.result.valueBlock.value)))throw new Error("Cannot get items from the ASN.1 parsed value. ASN.1 object is not constructed.");const l=a.result.valueBlock.value;return Array.from(l,u=>r.fromASN(u))}else return Array.from(e,i=>r.fromASN(i))}static processSinglePrimitiveItem(e,n,r,i){let o=e;if(n.implicit){let a;if(Un(r))a=new r().toSchema("");else{const l=T[r],u=N2[l];if(!u)throw new Error(`Cannot get '${l}' class from asn1js module`);a=new u}a.valueBlock=o.valueBlock,o=ki(a.toBER(!1)).result}return i.fromASN(o)}static processComplexSchemaItem(e,n,r){if(n.repeated){if(!Array.isArray(e))throw new Error("Cannot get list of items from the ASN.1 parsed value. ASN.1 value should be iterable.");return Array.from(e,i=>this.fromASN(i,r))}else{const i=this.handleImplicitTagging(e,n,r);if(this.isOptionalChoiceField(n))try{return this.fromASN(i,r)}catch(o){if(o instanceof go&&/Wrong values for Choice type/.test(o.message))return;throw o}else return this.fromASN(i,r)}}static handleImplicitTagging(e,n,r){if(n.implicit&&typeof n.context=="number"){const i=rt.get(r);if(i.type===q.Sequence){const o=new an;if("value"in e.valueBlock&&Array.isArray(e.valueBlock.value)&&"value"in o.valueBlock)return o.valueBlock.value=e.valueBlock.value,o}else if(i.type===q.Set){const o=new kn;if("value"in e.valueBlock&&Array.isArray(e.valueBlock.value)&&"value"in o.valueBlock)return o.valueBlock.value=e.valueBlock.value,o}}return e}}class jp{static serialize(e){return e instanceof dt?e.toBER(!1):this.toASN(e).toBER(!1)}static toASN(e){if(e&&typeof e=="object"&&Un(e))return e.toASN();if(!(e&&typeof e=="object"))throw new TypeError("Parameter 1 should be type of Object.");const n=e.constructor,r=rt.get(n);rt.cache(n);let i=[];if(r.itemType){if(!Array.isArray(e))throw new TypeError("Parameter 1 should be type of Array.");if(typeof r.itemType=="number"){const a=xo(r.itemType);if(!a)throw new Error(`Cannot get default converter for array item of ${n.name} ASN1 schema`);i=e.map(l=>a.toASN(l))}else i=e.map(a=>this.toAsnItem({type:r.itemType},"[]",n,a))}else for(const a in r.items){const l=r.items[a],u=e[a];if(u===void 0||l.defaultValue===u||typeof l.defaultValue=="object"&&typeof u=="object"&&i4(this.serialize(l.defaultValue),this.serialize(u)))continue;const d=jp.toAsnItem(l,a,n,u);if(typeof l.context=="number")if(l.implicit)if(!l.repeated&&(typeof l.type=="number"||Un(l.type))){const p={};p.valueHex=d instanceof Hr?d.valueBeforeDecodeView:d.valueBlock.toBER(),i.push(new rs({optional:l.optional,idBlock:{tagClass:3,tagNumber:l.context},...p}))}else i.push(new yt({optional:l.optional,idBlock:{tagClass:3,tagNumber:l.context},value:d.valueBlock.value}));else i.push(new yt({optional:l.optional,idBlock:{tagClass:3,tagNumber:l.context},value:[d]}));else l.repeated?i=i.concat(d):i.push(d)}let o;switch(r.type){case q.Sequence:o=new an({value:i});break;case q.Set:o=new kn({value:i});break;case q.Choice:if(!i[0])throw new Error(`Schema '${n.name}' has wrong data. Choice cannot be empty.`);o=i[0];break}return o}static toAsnItem(e,n,r,i){let o;if(typeof e.type=="number"){const a=e.converter;if(!a)throw new Error(`Property '${n}' doesn't have converter for type ${T[e.type]} in schema '${r.name}'`);if(e.repeated){if(!Array.isArray(i))throw new TypeError("Parameter 'objProp' should be type of Array.");const l=Array.from(i,d=>a.toASN(d)),u=e.repeated==="sequence"?an:kn;o=new u({value:l})}else o=a.toASN(i)}else if(e.repeated){if(!Array.isArray(i))throw new TypeError("Parameter 'objProp' should be type of Array.");const a=Array.from(i,u=>this.toASN(u)),l=e.repeated==="sequence"?an:kn;o=new l({value:a})}else o=this.toASN(i);return o}}class De extends Array{constructor(e=[]){if(typeof e=="number")super(e);else{super();for(const n of e)this.push(n)}}}class te{static serialize(e){return jp.serialize(e)}static parse(e,n){return s4.parse(e,n)}static toString(e){const n=ne.isBufferSource(e)?ne.toArrayBuffer(e):te.serialize(e),r=ki(n);if(r.offset===-1)throw new Error(`Cannot decode ASN.1 data. ${r.result.error}`);return r.result.toString()}}function m(t,e,n,r){var i=arguments.length,o=i<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,n):r,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(a=t[l])&&(o=(i<3?a(o):i>3?a(e,n,o):a(e,n))||o);return i>3&&o&&Object.defineProperty(e,n,o),o}class Nh{static isIPv4(e){return/^(\d{1,3}\.){3}\d{1,3}$/.test(e)}static parseIPv4(e){const n=e.split(".");if(n.length!==4)throw new Error("Invalid IPv4 address");return n.map(r=>{const i=parseInt(r,10);if(isNaN(i)||i<0||i>255)throw new Error("Invalid IPv4 address part");return i})}static parseIPv6(e){const r=this.expandIPv6(e).split(":");if(r.length!==8)throw new Error("Invalid IPv6 address");return r.reduce((i,o)=>{const a=parseInt(o,16);if(isNaN(a)||a<0||a>65535)throw new Error("Invalid IPv6 address part");return i.push(a>>8&255),i.push(a&255),i},[])}static expandIPv6(e){if(!e.includes("::"))return e;const n=e.split("::");if(n.length>2)throw new Error("Invalid IPv6 address");const r=n[0]?n[0].split(":"):[],i=n[1]?n[1].split(":"):[],o=8-(r.length+i.length);if(o<0)throw new Error("Invalid IPv6 address");return[...r,...Array(o).fill("0"),...i].join(":")}static formatIPv6(e){const n=[];for(let r=0;r<16;r+=2)n.push((e[r]<<8|e[r+1]).toString(16));return this.compressIPv6(n.join(":"))}static compressIPv6(e){const n=e.split(":");let r=-1,i=0,o=-1,a=0;for(let l=0;l<n.length;l++)n[l]==="0"?(o===-1&&(o=l),a++):(a>i&&(r=o,i=a),o=-1,a=0);if(a>i&&(r=o,i=a),i>1){const l=n.slice(0,r).join(":"),u=n.slice(r+i).join(":");return`${l}::${u}`}return e}static parseCIDR(e){const[n,r]=e.split("/"),i=parseInt(r,10);if(this.isIPv4(n)){if(i<0||i>32)throw new Error("Invalid IPv4 prefix length");return[this.parseIPv4(n),i]}else{if(i<0||i>128)throw new Error("Invalid IPv6 prefix length");return[this.parseIPv6(n),i]}}static decodeIP(e){if(e.length===64&&parseInt(e,16)===0)return"::/0";if(e.length!==16)return e;const n=parseInt(e.slice(8),16).toString(2).split("").reduce((i,o)=>i+ +o,0);let r=e.slice(0,8).replace(/(.{2})/g,i=>`${parseInt(i,16)}.`);return r=r.slice(0,-1),`${r}/${n}`}static toString(e){const n=new Uint8Array(e);if(n.length===4)return Array.from(n).join(".");if(n.length===16)return this.formatIPv6(n);if(n.length===8||n.length===32){const r=n.length/2,i=n.slice(0,r),o=n.slice(r);if(n.every(u=>u===0))return n.length===8?"0.0.0.0/0":"::/0";const l=o.reduce((u,d)=>u+(d.toString(2).match(/1/g)||[]).length,0);return n.length===8?`${Array.from(i).join(".")}/${l}`:`${this.formatIPv6(i)}/${l}`}return this.decodeIP(fe.ToHex(e))}static fromString(e){if(e.includes("/")){const[r,i]=this.parseCIDR(e),o=new Uint8Array(r.length);let a=i;for(let u=0;u<o.length;u++)a>=8?(o[u]=255,a-=8):a>0&&(o[u]=255<<8-a,a=0);const l=new Uint8Array(r.length*2);return l.set(r,0),l.set(o,r.length),l.buffer}const n=this.isIPv4(e)?this.parseIPv4(e):this.parseIPv6(e);return new Uint8Array(n).buffer}}var Tu,Iu,Ou;let pt=class{constructor(e={}){Object.assign(this,e)}toString(){return this.bmpString||this.printableString||this.teletexString||this.universalString||this.utf8String||""}};m([w({type:T.TeletexString})],pt.prototype,"teletexString",void 0);m([w({type:T.PrintableString})],pt.prototype,"printableString",void 0);m([w({type:T.UniversalString})],pt.prototype,"universalString",void 0);m([w({type:T.Utf8String})],pt.prototype,"utf8String",void 0);m([w({type:T.BmpString})],pt.prototype,"bmpString",void 0);pt=m([X({type:q.Choice})],pt);let Oi=class extends pt{constructor(e={}){super(e),Object.assign(this,e)}toString(){return this.ia5String||(this.anyValue?fe.ToHex(this.anyValue):super.toString())}};m([w({type:T.IA5String})],Oi.prototype,"ia5String",void 0);m([w({type:T.Any})],Oi.prototype,"anyValue",void 0);Oi=m([X({type:q.Choice})],Oi);class Wc{constructor(e={}){this.type="",this.value=new Oi,Object.assign(this,e)}}m([w({type:T.ObjectIdentifier})],Wc.prototype,"type",void 0);m([w({type:Oi})],Wc.prototype,"value",void 0);let zi=Tu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Tu.prototype)}};zi=Tu=m([X({type:q.Set,itemType:Wc})],zi);let zu=Iu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Iu.prototype)}};zu=Iu=m([X({type:q.Sequence,itemType:zi})],zu);let Ye=Ou=class extends zu{constructor(e){super(e),Object.setPrototypeOf(this,Ou.prototype)}};Ye=Ou=m([X({type:q.Sequence})],Ye);const a4={fromASN:t=>Nh.toString(Ta.fromASN(t)),toASN:t=>Ta.toASN(Nh.fromString(t))};class Do{constructor(e={}){this.typeId="",this.value=new ArrayBuffer(0),Object.assign(this,e)}}m([w({type:T.ObjectIdentifier})],Do.prototype,"typeId",void 0);m([w({type:T.Any,context:0})],Do.prototype,"value",void 0);class Lp{constructor(e={}){this.partyName=new pt,Object.assign(this,e)}}m([w({type:pt,optional:!0,context:0,implicit:!0})],Lp.prototype,"nameAssigner",void 0);m([w({type:pt,context:1,implicit:!0})],Lp.prototype,"partyName",void 0);let ke=class{constructor(e={}){Object.assign(this,e)}};m([w({type:Do,context:0,implicit:!0})],ke.prototype,"otherName",void 0);m([w({type:T.IA5String,context:1,implicit:!0})],ke.prototype,"rfc822Name",void 0);m([w({type:T.IA5String,context:2,implicit:!0})],ke.prototype,"dNSName",void 0);m([w({type:T.Any,context:3,implicit:!0})],ke.prototype,"x400Address",void 0);m([w({type:Ye,context:4,implicit:!1})],ke.prototype,"directoryName",void 0);m([w({type:Lp,context:5})],ke.prototype,"ediPartyName",void 0);m([w({type:T.IA5String,context:6,implicit:!0})],ke.prototype,"uniformResourceIdentifier",void 0);m([w({type:T.OctetString,context:7,implicit:!0,converter:a4})],ke.prototype,"iPAddress",void 0);m([w({type:T.ObjectIdentifier,context:8,implicit:!0})],ke.prototype,"registeredID",void 0);ke=m([X({type:q.Choice})],ke);const Fp="1.3.6.1.5.5.7",c4=`${Fp}.1`,Zi=`${Fp}.3`,Xc=`${Fp}.48`,Ch=`${Xc}.1`,Th=`${Xc}.2`,Ih=`${Xc}.3`,Oh=`${Xc}.5`,tr="2.5.29";var Du;const Ru=`${c4}.1`;class ss{constructor(e={}){this.accessMethod="",this.accessLocation=new ke,Object.assign(this,e)}}m([w({type:T.ObjectIdentifier})],ss.prototype,"accessMethod",void 0);m([w({type:ke})],ss.prototype,"accessLocation",void 0);let xi=Du=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Du.prototype)}};xi=Du=m([X({type:q.Sequence,itemType:ss})],xi);const Pu=`${tr}.35`;class Up extends Ie{}class Lr{constructor(e={}){e&&Object.assign(this,e)}}m([w({type:Up,context:0,optional:!0,implicit:!0})],Lr.prototype,"keyIdentifier",void 0);m([w({type:ke,context:1,optional:!0,implicit:!0,repeated:"sequence"})],Lr.prototype,"authorityCertIssuer",void 0);m([w({type:T.Integer,context:2,optional:!0,implicit:!0,converter:qe})],Lr.prototype,"authorityCertSerialNumber",void 0);const I2=`${tr}.19`;class Ia{constructor(e={}){this.cA=!1,Object.assign(this,e)}}m([w({type:T.Boolean,defaultValue:!1})],Ia.prototype,"cA",void 0);m([w({type:T.Integer,optional:!0})],Ia.prototype,"pathLenConstraint",void 0);var Bu;let gt=Bu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Bu.prototype)}};gt=Bu=m([X({type:q.Sequence,itemType:ke})],gt);var ju;let zh=ju=class extends gt{constructor(e){super(e),Object.setPrototypeOf(this,ju.prototype)}};zh=ju=m([X({type:q.Sequence})],zh);var Lu;const O2=`${tr}.32`;let qn=class{constructor(e={}){Object.assign(this,e)}toString(){return this.ia5String||this.visibleString||this.bmpString||this.utf8String||""}};m([w({type:T.IA5String})],qn.prototype,"ia5String",void 0);m([w({type:T.VisibleString})],qn.prototype,"visibleString",void 0);m([w({type:T.BmpString})],qn.prototype,"bmpString",void 0);m([w({type:T.Utf8String})],qn.prototype,"utf8String",void 0);qn=m([X({type:q.Choice})],qn);class Mp{constructor(e={}){this.organization=new qn,this.noticeNumbers=[],Object.assign(this,e)}}m([w({type:qn})],Mp.prototype,"organization",void 0);m([w({type:T.Integer,repeated:"sequence"})],Mp.prototype,"noticeNumbers",void 0);class qp{constructor(e={}){Object.assign(this,e)}}m([w({type:Mp,optional:!0})],qp.prototype,"noticeRef",void 0);m([w({type:qn,optional:!0})],qp.prototype,"explicitText",void 0);let Oa=class{constructor(e={}){Object.assign(this,e)}};m([w({type:T.IA5String})],Oa.prototype,"cPSuri",void 0);m([w({type:qp})],Oa.prototype,"userNotice",void 0);Oa=m([X({type:q.Choice})],Oa);class Vp{constructor(e={}){this.policyQualifierId="",this.qualifier=new ArrayBuffer(0),Object.assign(this,e)}}m([w({type:T.ObjectIdentifier})],Vp.prototype,"policyQualifierId",void 0);m([w({type:T.Any})],Vp.prototype,"qualifier",void 0);class Jc{constructor(e={}){this.policyIdentifier="",Object.assign(this,e)}}m([w({type:T.ObjectIdentifier})],Jc.prototype,"policyIdentifier",void 0);m([w({type:Vp,repeated:"sequence",optional:!0})],Jc.prototype,"policyQualifiers",void 0);let za=Lu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Lu.prototype)}};za=Lu=m([X({type:q.Sequence,itemType:Jc})],za);let Da=class{constructor(e=0){this.value=e}};m([w({type:T.Integer})],Da.prototype,"value",void 0);Da=m([X({type:q.Choice})],Da);let Dh=class extends Da{};Dh=m([X({type:q.Choice})],Dh);var Fu;const Uu=`${tr}.31`;var tn;(function(t){t[t.unused=1]="unused",t[t.keyCompromise=2]="keyCompromise",t[t.cACompromise=4]="cACompromise",t[t.affiliationChanged=8]="affiliationChanged",t[t.superseded=16]="superseded",t[t.cessationOfOperation=32]="cessationOfOperation",t[t.certificateHold=64]="certificateHold",t[t.privilegeWithdrawn=128]="privilegeWithdrawn",t[t.aACompromise=256]="aACompromise"})(tn||(tn={}));class z2 extends Gc{toJSON(){const e=[],n=this.toNumber();return n&tn.aACompromise&&e.push("aACompromise"),n&tn.affiliationChanged&&e.push("affiliationChanged"),n&tn.cACompromise&&e.push("cACompromise"),n&tn.certificateHold&&e.push("certificateHold"),n&tn.cessationOfOperation&&e.push("cessationOfOperation"),n&tn.keyCompromise&&e.push("keyCompromise"),n&tn.privilegeWithdrawn&&e.push("privilegeWithdrawn"),n&tn.superseded&&e.push("superseded"),n&tn.unused&&e.push("unused"),e}toString(){return`[${this.toJSON().join(", ")}]`}}let Gr=class{constructor(e={}){Object.assign(this,e)}};m([w({type:ke,context:0,repeated:"sequence",implicit:!0})],Gr.prototype,"fullName",void 0);m([w({type:zi,context:1,implicit:!0})],Gr.prototype,"nameRelativeToCRLIssuer",void 0);Gr=m([X({type:q.Choice})],Gr);class Qi{constructor(e={}){Object.assign(this,e)}}m([w({type:Gr,context:0,optional:!0})],Qi.prototype,"distributionPoint",void 0);m([w({type:z2,context:1,optional:!0,implicit:!0})],Qi.prototype,"reasons",void 0);m([w({type:ke,context:2,optional:!0,repeated:"sequence",implicit:!0})],Qi.prototype,"cRLIssuer",void 0);let Ni=Fu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Fu.prototype)}};Ni=Fu=m([X({type:q.Sequence,itemType:Qi})],Ni);var Mu;let Rh=Mu=class extends Ni{constructor(e){super(e),Object.setPrototypeOf(this,Mu.prototype)}};Rh=Mu=m([X({type:q.Sequence,itemType:Qi})],Rh);class ht{constructor(e={}){this.onlyContainsUserCerts=ht.ONLY,this.onlyContainsCACerts=ht.ONLY,this.indirectCRL=ht.ONLY,this.onlyContainsAttributeCerts=ht.ONLY,Object.assign(this,e)}}ht.ONLY=!1;m([w({type:Gr,context:0,optional:!0})],ht.prototype,"distributionPoint",void 0);m([w({type:T.Boolean,context:1,defaultValue:ht.ONLY,implicit:!0})],ht.prototype,"onlyContainsUserCerts",void 0);m([w({type:T.Boolean,context:2,defaultValue:ht.ONLY,implicit:!0})],ht.prototype,"onlyContainsCACerts",void 0);m([w({type:z2,context:3,optional:!0,implicit:!0})],ht.prototype,"onlySomeReasons",void 0);m([w({type:T.Boolean,context:4,defaultValue:ht.ONLY,implicit:!0})],ht.prototype,"indirectCRL",void 0);m([w({type:T.Boolean,context:5,defaultValue:ht.ONLY,implicit:!0})],ht.prototype,"onlyContainsAttributeCerts",void 0);var Ao;(function(t){t[t.unspecified=0]="unspecified",t[t.keyCompromise=1]="keyCompromise",t[t.cACompromise=2]="cACompromise",t[t.affiliationChanged=3]="affiliationChanged",t[t.superseded=4]="superseded",t[t.cessationOfOperation=5]="cessationOfOperation",t[t.certificateHold=6]="certificateHold",t[t.removeFromCRL=8]="removeFromCRL",t[t.privilegeWithdrawn=9]="privilegeWithdrawn",t[t.aACompromise=10]="aACompromise"})(Ao||(Ao={}));let qu=class{constructor(e=Ao.unspecified){this.reason=Ao.unspecified,this.reason=e}toJSON(){return Ao[this.reason]}toString(){return this.toJSON()}};m([w({type:T.Enumerated})],qu.prototype,"reason",void 0);qu=m([X({type:q.Choice})],qu);var Vu;const D2=`${tr}.37`;let Ra=Vu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Vu.prototype)}};Ra=Vu=m([X({type:q.Sequence,itemType:T.ObjectIdentifier})],Ra);const l4=`${Zi}.1`,u4=`${Zi}.2`,d4=`${Zi}.3`,p4=`${Zi}.4`,f4=`${Zi}.8`,h4=`${Zi}.9`;let Hu=class{constructor(e=new ArrayBuffer(0)){this.value=e}};m([w({type:T.Integer,converter:qe})],Hu.prototype,"value",void 0);Hu=m([X({type:q.Choice})],Hu);let Ku=class{constructor(e){this.value=new Date,e&&(this.value=e)}};m([w({type:T.GeneralizedTime})],Ku.prototype,"value",void 0);Ku=m([X({type:q.Choice})],Ku);var Gu;const R2=`${tr}.18`;let Ph=Gu=class extends gt{constructor(e){super(e),Object.setPrototypeOf(this,Gu.prototype)}};Ph=Gu=m([X({type:q.Sequence})],Ph);const P2=`${tr}.15`;var nn;(function(t){t[t.digitalSignature=1]="digitalSignature",t[t.nonRepudiation=2]="nonRepudiation",t[t.keyEncipherment=4]="keyEncipherment",t[t.dataEncipherment=8]="dataEncipherment",t[t.keyAgreement=16]="keyAgreement",t[t.keyCertSign=32]="keyCertSign",t[t.cRLSign=64]="cRLSign",t[t.encipherOnly=128]="encipherOnly",t[t.decipherOnly=256]="decipherOnly"})(nn||(nn={}));class Ml extends Gc{toJSON(){const e=this.toNumber(),n=[];return e&nn.cRLSign&&n.push("crlSign"),e&nn.dataEncipherment&&n.push("dataEncipherment"),e&nn.decipherOnly&&n.push("decipherOnly"),e&nn.digitalSignature&&n.push("digitalSignature"),e&nn.encipherOnly&&n.push("encipherOnly"),e&nn.keyAgreement&&n.push("keyAgreement"),e&nn.keyCertSign&&n.push("keyCertSign"),e&nn.keyEncipherment&&n.push("keyEncipherment"),e&nn.nonRepudiation&&n.push("nonRepudiation"),n}toString(){return`[${this.toJSON().join(", ")}]`}}var Wu;class Yc{constructor(e={}){this.base=new ke,this.minimum=0,Object.assign(this,e)}}m([w({type:ke})],Yc.prototype,"base",void 0);m([w({type:T.Integer,context:0,defaultValue:0,implicit:!0})],Yc.prototype,"minimum",void 0);m([w({type:T.Integer,context:1,optional:!0,implicit:!0})],Yc.prototype,"maximum",void 0);let Pa=Wu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Wu.prototype)}};Pa=Wu=m([X({type:q.Sequence,itemType:Yc})],Pa);class B2{constructor(e={}){Object.assign(this,e)}}m([w({type:Pa,context:0,optional:!0,implicit:!0})],B2.prototype,"permittedSubtrees",void 0);m([w({type:Pa,context:1,optional:!0,implicit:!0})],B2.prototype,"excludedSubtrees",void 0);class j2{constructor(e={}){Object.assign(this,e)}}m([w({type:T.Integer,context:0,implicit:!0,optional:!0,converter:qe})],j2.prototype,"requireExplicitPolicy",void 0);m([w({type:T.Integer,context:1,implicit:!0,optional:!0,converter:qe})],j2.prototype,"inhibitPolicyMapping",void 0);var Xu;class Hp{constructor(e={}){this.issuerDomainPolicy="",this.subjectDomainPolicy="",Object.assign(this,e)}}m([w({type:T.ObjectIdentifier})],Hp.prototype,"issuerDomainPolicy",void 0);m([w({type:T.ObjectIdentifier})],Hp.prototype,"subjectDomainPolicy",void 0);let Bh=Xu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Xu.prototype)}};Bh=Xu=m([X({type:q.Sequence,itemType:Hp})],Bh);var Ju;const L2=`${tr}.17`;let Yu=Ju=class extends gt{constructor(e){super(e),Object.setPrototypeOf(this,Ju.prototype)}};Yu=Ju=m([X({type:q.Sequence})],Yu);let Vn=class{constructor(e={}){this.type="",this.values=[],Object.assign(this,e)}};m([w({type:T.ObjectIdentifier})],Vn.prototype,"type",void 0);m([w({type:T.Any,repeated:"set"})],Vn.prototype,"values",void 0);var Zu;let jh=Zu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Zu.prototype)}};jh=Zu=m([X({type:q.Sequence,itemType:Vn})],jh);const F2=`${tr}.14`;class mr extends Up{}class U2{constructor(e={}){Object.assign(this,e)}}m([w({type:T.GeneralizedTime,context:0,implicit:!0,optional:!0})],U2.prototype,"notBefore",void 0);m([w({type:T.GeneralizedTime,context:1,implicit:!0,optional:!0})],U2.prototype,"notAfter",void 0);var Eo;(function(t){t[t.keyUpdateAllowed=1]="keyUpdateAllowed",t[t.newExtensions=2]="newExtensions",t[t.pKIXCertificate=4]="pKIXCertificate"})(Eo||(Eo={}));class M2 extends Gc{toJSON(){const e=[],n=this.toNumber();return n&Eo.pKIXCertificate&&e.push("pKIXCertificate"),n&Eo.newExtensions&&e.push("newExtensions"),n&Eo.keyUpdateAllowed&&e.push("keyUpdateAllowed"),e}toString(){return`[${this.toJSON().join(", ")}]`}}class q2{constructor(e={}){this.entrustVers="",this.entrustInfoFlags=new M2,Object.assign(this,e)}}m([w({type:T.GeneralString})],q2.prototype,"entrustVers",void 0);m([w({type:M2})],q2.prototype,"entrustInfoFlags",void 0);var Qu;let Lh=Qu=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Qu.prototype)}};Lh=Qu=m([X({type:q.Sequence,itemType:ss})],Lh);class ce{constructor(e={}){this.algorithm="",Object.assign(this,e)}isEqual(e){return e instanceof ce&&e.algorithm==this.algorithm&&(e.parameters&&this.parameters&&O_(e.parameters,this.parameters)||e.parameters===this.parameters)}}m([w({type:T.ObjectIdentifier})],ce.prototype,"algorithm",void 0);m([w({type:T.Any,optional:!0})],ce.prototype,"parameters",void 0);class sn{constructor(e={}){this.algorithm=new ce,this.subjectPublicKey=new ArrayBuffer(0),Object.assign(this,e)}}m([w({type:ce})],sn.prototype,"algorithm",void 0);m([w({type:T.BitString})],sn.prototype,"subjectPublicKey",void 0);let lt=class{constructor(e){if(e)if(typeof e=="string"||typeof e=="number"||e instanceof Date){const n=new Date(e);n.getUTCFullYear()>2049?this.generalTime=n:this.utcTime=n}else Object.assign(this,e)}getTime(){const e=this.utcTime||this.generalTime;if(!e)throw new Error("Cannot get time from CHOICE object");return e}};m([w({type:T.UTCTime})],lt.prototype,"utcTime",void 0);m([w({type:T.GeneralizedTime})],lt.prototype,"generalTime",void 0);lt=m([X({type:q.Choice})],lt);class as{constructor(e){this.notBefore=new lt(new Date),this.notAfter=new lt(new Date),e&&(this.notBefore=new lt(e.notBefore),this.notAfter=new lt(e.notAfter))}}m([w({type:lt})],as.prototype,"notBefore",void 0);m([w({type:lt})],as.prototype,"notAfter",void 0);var ed;let Yt=class V2{constructor(e={}){this.extnID="",this.critical=V2.CRITICAL,this.extnValue=new Ie,Object.assign(this,e)}};Yt.CRITICAL=!1;m([w({type:T.ObjectIdentifier})],Yt.prototype,"extnID",void 0);m([w({type:T.Boolean,defaultValue:Yt.CRITICAL})],Yt.prototype,"critical",void 0);m([w({type:Ie})],Yt.prototype,"extnValue",void 0);let wr=ed=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,ed.prototype)}};wr=ed=m([X({type:q.Sequence,itemType:Yt})],wr);var Wr;(function(t){t[t.v1=0]="v1",t[t.v2=1]="v2",t[t.v3=2]="v3"})(Wr||(Wr={}));class Mt{constructor(e={}){this.version=Wr.v1,this.serialNumber=new ArrayBuffer(0),this.signature=new ce,this.issuer=new Ye,this.validity=new as,this.subject=new Ye,this.subjectPublicKeyInfo=new sn,Object.assign(this,e)}}m([w({type:T.Integer,context:0,defaultValue:Wr.v1})],Mt.prototype,"version",void 0);m([w({type:T.Integer,converter:qe})],Mt.prototype,"serialNumber",void 0);m([w({type:ce})],Mt.prototype,"signature",void 0);m([w({type:Ye})],Mt.prototype,"issuer",void 0);m([w({type:as})],Mt.prototype,"validity",void 0);m([w({type:Ye})],Mt.prototype,"subject",void 0);m([w({type:sn})],Mt.prototype,"subjectPublicKeyInfo",void 0);m([w({type:T.BitString,context:1,implicit:!0,optional:!0})],Mt.prototype,"issuerUniqueID",void 0);m([w({type:T.BitString,context:2,implicit:!0,optional:!0})],Mt.prototype,"subjectUniqueID",void 0);m([w({type:wr,context:3,optional:!0})],Mt.prototype,"extensions",void 0);class Xr{constructor(e={}){this.tbsCertificate=new Mt,this.signatureAlgorithm=new ce,this.signatureValue=new ArrayBuffer(0),Object.assign(this,e)}}m([w({type:Mt})],Xr.prototype,"tbsCertificate",void 0);m([w({type:ce})],Xr.prototype,"signatureAlgorithm",void 0);m([w({type:T.BitString})],Xr.prototype,"signatureValue",void 0);class Zc{constructor(e={}){this.userCertificate=new ArrayBuffer(0),this.revocationDate=new lt,Object.assign(this,e)}}m([w({type:T.Integer,converter:qe})],Zc.prototype,"userCertificate",void 0);m([w({type:lt})],Zc.prototype,"revocationDate",void 0);m([w({type:Yt,optional:!0,repeated:"sequence"})],Zc.prototype,"crlEntryExtensions",void 0);class nr{constructor(e={}){this.signature=new ce,this.issuer=new Ye,this.thisUpdate=new lt,Object.assign(this,e)}}m([w({type:T.Integer,optional:!0})],nr.prototype,"version",void 0);m([w({type:ce})],nr.prototype,"signature",void 0);m([w({type:Ye})],nr.prototype,"issuer",void 0);m([w({type:lt})],nr.prototype,"thisUpdate",void 0);m([w({type:lt,optional:!0})],nr.prototype,"nextUpdate",void 0);m([w({type:Zc,repeated:"sequence",optional:!0})],nr.prototype,"revokedCertificates",void 0);m([w({type:Yt,optional:!0,context:0,repeated:"sequence"})],nr.prototype,"crlExtensions",void 0);class Kp{constructor(e={}){this.tbsCertList=new nr,this.signatureAlgorithm=new ce,this.signature=new ArrayBuffer(0),Object.assign(this,e)}}m([w({type:nr})],Kp.prototype,"tbsCertList",void 0);m([w({type:ce})],Kp.prototype,"signatureAlgorithm",void 0);m([w({type:T.BitString})],Kp.prototype,"signature",void 0);class eo{constructor(e={}){this.issuer=new Ye,this.serialNumber=new ArrayBuffer(0),Object.assign(this,e)}}m([w({type:Ye})],eo.prototype,"issuer",void 0);m([w({type:T.Integer,converter:qe})],eo.prototype,"serialNumber",void 0);let Di=class{constructor(e={}){Object.assign(this,e)}};m([w({type:mr,context:0,implicit:!0})],Di.prototype,"subjectKeyIdentifier",void 0);m([w({type:eo})],Di.prototype,"issuerAndSerialNumber",void 0);Di=m([X({type:q.Choice})],Di);var Hn;(function(t){t[t.v0=0]="v0",t[t.v1=1]="v1",t[t.v2=2]="v2",t[t.v3=3]="v3",t[t.v4=4]="v4",t[t.v5=5]="v5"})(Hn||(Hn={}));let Ro=class extends ce{};Ro=m([X({type:q.Sequence})],Ro);let Ba=class extends ce{};Ba=m([X({type:q.Sequence})],Ba);let In=class extends ce{};In=m([X({type:q.Sequence})],In);let ja=class extends ce{};ja=m([X({type:q.Sequence})],ja);let Fh=class extends ce{};Fh=m([X({type:q.Sequence})],Fh);let td=class extends ce{};td=m([X({type:q.Sequence})],td);let to=class{constructor(e={}){this.attrType="",this.attrValues=[],Object.assign(this,e)}};m([w({type:T.ObjectIdentifier})],to.prototype,"attrType",void 0);m([w({type:T.Any,repeated:"set"})],to.prototype,"attrValues",void 0);var nd;class zn{constructor(e={}){this.version=Hn.v0,this.sid=new Di,this.digestAlgorithm=new Ro,this.signatureAlgorithm=new Ba,this.signature=new Ie,Object.assign(this,e)}}m([w({type:T.Integer})],zn.prototype,"version",void 0);m([w({type:Di})],zn.prototype,"sid",void 0);m([w({type:Ro})],zn.prototype,"digestAlgorithm",void 0);m([w({type:to,repeated:"set",context:0,implicit:!0,optional:!0})],zn.prototype,"signedAttrs",void 0);m([w({type:Ba})],zn.prototype,"signatureAlgorithm",void 0);m([w({type:Ie})],zn.prototype,"signature",void 0);m([w({type:to,repeated:"set",context:1,implicit:!0,optional:!0})],zn.prototype,"unsignedAttrs",void 0);let La=nd=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,nd.prototype)}};La=nd=m([X({type:q.Set,itemType:zn})],La);let Uh=class extends lt{};Uh=m([X({type:q.Choice})],Uh);let Mh=class extends zn{};Mh=m([X({type:q.Sequence})],Mh);class Gp{constructor(e={}){this.acIssuer=new ke,this.acSerial=0,this.attrs=[],Object.assign(this,e)}}m([w({type:ke})],Gp.prototype,"acIssuer",void 0);m([w({type:T.Integer})],Gp.prototype,"acSerial",void 0);m([w({type:Vn,repeated:"sequence"})],Gp.prototype,"attrs",void 0);var rd;let Fa=rd=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,rd.prototype)}};Fa=rd=m([X({type:q.Sequence,itemType:T.ObjectIdentifier})],Fa);class Qc{constructor(e={}){this.permitUnSpecified=!0,Object.assign(this,e)}}m([w({type:T.Integer,optional:!0})],Qc.prototype,"pathLenConstraint",void 0);m([w({type:Fa,implicit:!0,context:0,optional:!0})],Qc.prototype,"permittedAttrs",void 0);m([w({type:Fa,implicit:!0,context:1,optional:!0})],Qc.prototype,"excludedAttrs",void 0);m([w({type:T.Boolean,defaultValue:!0})],Qc.prototype,"permitUnSpecified",void 0);class ai{constructor(e={}){this.issuer=new gt,this.serial=new ArrayBuffer(0),this.issuerUID=new ArrayBuffer(0),Object.assign(this,e)}}m([w({type:gt})],ai.prototype,"issuer",void 0);m([w({type:T.Integer,converter:qe})],ai.prototype,"serial",void 0);m([w({type:T.BitString,optional:!0})],ai.prototype,"issuerUID",void 0);var id;(function(t){t[t.publicKey=0]="publicKey",t[t.publicKeyCert=1]="publicKeyCert",t[t.otherObjectTypes=2]="otherObjectTypes"})(id||(id={}));class ci{constructor(e={}){this.digestedObjectType=id.publicKey,this.digestAlgorithm=new ce,this.objectDigest=new ArrayBuffer(0),Object.assign(this,e)}}m([w({type:T.Enumerated})],ci.prototype,"digestedObjectType",void 0);m([w({type:T.ObjectIdentifier,optional:!0})],ci.prototype,"otherObjectTypeID",void 0);m([w({type:ce})],ci.prototype,"digestAlgorithm",void 0);m([w({type:T.BitString})],ci.prototype,"objectDigest",void 0);class el{constructor(e={}){Object.assign(this,e)}}m([w({type:gt,optional:!0})],el.prototype,"issuerName",void 0);m([w({type:ai,context:0,implicit:!0,optional:!0})],el.prototype,"baseCertificateID",void 0);m([w({type:ci,context:1,implicit:!0,optional:!0})],el.prototype,"objectDigestInfo",void 0);let Ri=class{constructor(e={}){Object.assign(this,e)}};m([w({type:ke,repeated:"sequence"})],Ri.prototype,"v1Form",void 0);m([w({type:el,context:0,implicit:!0})],Ri.prototype,"v2Form",void 0);Ri=m([X({type:q.Choice})],Ri);class tl{constructor(e={}){this.notBeforeTime=new Date,this.notAfterTime=new Date,Object.assign(this,e)}}m([w({type:T.GeneralizedTime})],tl.prototype,"notBeforeTime",void 0);m([w({type:T.GeneralizedTime})],tl.prototype,"notAfterTime",void 0);class cs{constructor(e={}){Object.assign(this,e)}}m([w({type:ai,implicit:!0,context:0,optional:!0})],cs.prototype,"baseCertificateID",void 0);m([w({type:gt,implicit:!0,context:1,optional:!0})],cs.prototype,"entityName",void 0);m([w({type:ci,implicit:!0,context:2,optional:!0})],cs.prototype,"objectDigestInfo",void 0);var od;(function(t){t[t.v2=1]="v2"})(od||(od={}));class yn{constructor(e={}){this.version=od.v2,this.holder=new cs,this.issuer=new Ri,this.signature=new ce,this.serialNumber=new ArrayBuffer(0),this.attrCertValidityPeriod=new tl,this.attributes=[],Object.assign(this,e)}}m([w({type:T.Integer})],yn.prototype,"version",void 0);m([w({type:cs})],yn.prototype,"holder",void 0);m([w({type:Ri})],yn.prototype,"issuer",void 0);m([w({type:ce})],yn.prototype,"signature",void 0);m([w({type:T.Integer,converter:qe})],yn.prototype,"serialNumber",void 0);m([w({type:tl})],yn.prototype,"attrCertValidityPeriod",void 0);m([w({type:Vn,repeated:"sequence"})],yn.prototype,"attributes",void 0);m([w({type:T.BitString,optional:!0})],yn.prototype,"issuerUniqueID",void 0);m([w({type:wr,optional:!0})],yn.prototype,"extensions",void 0);class nl{constructor(e={}){this.acinfo=new yn,this.signatureAlgorithm=new ce,this.signatureValue=new ArrayBuffer(0),Object.assign(this,e)}}m([w({type:yn})],nl.prototype,"acinfo",void 0);m([w({type:ce})],nl.prototype,"signatureAlgorithm",void 0);m([w({type:T.BitString})],nl.prototype,"signatureValue",void 0);var Ua;(function(t){t[t.unmarked=1]="unmarked",t[t.unclassified=2]="unclassified",t[t.restricted=4]="restricted",t[t.confidential=8]="confidential",t[t.secret=16]="secret",t[t.topSecret=32]="topSecret"})(Ua||(Ua={}));class sd extends Gc{}class Wp{constructor(e={}){this.type="",this.value=new ArrayBuffer(0),Object.assign(this,e)}}m([w({type:T.ObjectIdentifier,implicit:!0,context:0})],Wp.prototype,"type",void 0);m([w({type:T.Any,implicit:!0,context:1})],Wp.prototype,"value",void 0);class Xp{constructor(e={}){this.policyId="",this.classList=new sd(Ua.unclassified),Object.assign(this,e)}}m([w({type:T.ObjectIdentifier})],Xp.prototype,"policyId",void 0);m([w({type:sd,defaultValue:new sd(Ua.unclassified)})],Xp.prototype,"classList",void 0);m([w({type:Wp,repeated:"set"})],Xp.prototype,"securityCategories",void 0);class rl{constructor(e={}){Object.assign(this,e)}}m([w({type:Ie})],rl.prototype,"cotets",void 0);m([w({type:T.ObjectIdentifier})],rl.prototype,"oid",void 0);m([w({type:T.Utf8String})],rl.prototype,"string",void 0);class H2{constructor(e={}){this.values=[],Object.assign(this,e)}}m([w({type:gt,implicit:!0,context:0,optional:!0})],H2.prototype,"policyAuthority",void 0);m([w({type:rl,repeated:"sequence"})],H2.prototype,"values",void 0);var ad;class il{constructor(e={}){this.targetCertificate=new ai,Object.assign(this,e)}}m([w({type:ai})],il.prototype,"targetCertificate",void 0);m([w({type:ke,optional:!0})],il.prototype,"targetName",void 0);m([w({type:ci,optional:!0})],il.prototype,"certDigestInfo",void 0);let Pi=class{constructor(e={}){Object.assign(this,e)}};m([w({type:ke,context:0,implicit:!0})],Pi.prototype,"targetName",void 0);m([w({type:ke,context:1,implicit:!0})],Pi.prototype,"targetGroup",void 0);m([w({type:il,context:2,implicit:!0})],Pi.prototype,"targetCert",void 0);Pi=m([X({type:q.Choice})],Pi);let cd=ad=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,ad.prototype)}};cd=ad=m([X({type:q.Sequence,itemType:Pi})],cd);var ld;let qh=ld=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,ld.prototype)}};qh=ld=m([X({type:q.Sequence,itemType:cd})],qh);class K2{constructor(e={}){Object.assign(this,e)}}m([w({type:gt,implicit:!0,context:0,optional:!0})],K2.prototype,"roleAuthority",void 0);m([w({type:ke,implicit:!0,context:1})],K2.prototype,"roleName",void 0);class Jp{constructor(e={}){this.service=new ke,this.ident=new ke,Object.assign(this,e)}}m([w({type:ke})],Jp.prototype,"service",void 0);m([w({type:ke})],Jp.prototype,"ident",void 0);m([w({type:Ie,optional:!0})],Jp.prototype,"authInfo",void 0);var ud;class Yp{constructor(e={}){this.otherCertFormat="",this.otherCert=new ArrayBuffer(0),Object.assign(this,e)}}m([w({type:T.ObjectIdentifier})],Yp.prototype,"otherCertFormat",void 0);m([w({type:T.Any})],Yp.prototype,"otherCert",void 0);let Bi=class{constructor(e={}){Object.assign(this,e)}};m([w({type:Xr})],Bi.prototype,"certificate",void 0);m([w({type:nl,context:2,implicit:!0})],Bi.prototype,"v2AttrCert",void 0);m([w({type:Yp,context:3,implicit:!0})],Bi.prototype,"other",void 0);Bi=m([X({type:q.Choice})],Bi);let Ma=ud=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,ud.prototype)}};Ma=ud=m([X({type:q.Set,itemType:Bi})],Ma);class no{constructor(e={}){this.contentType="",this.content=new ArrayBuffer(0),Object.assign(this,e)}}m([w({type:T.ObjectIdentifier})],no.prototype,"contentType",void 0);m([w({type:T.Any,context:0})],no.prototype,"content",void 0);let Po=class{constructor(e={}){Object.assign(this,e)}};m([w({type:Ie})],Po.prototype,"single",void 0);m([w({type:T.Any})],Po.prototype,"any",void 0);Po=m([X({type:q.Choice})],Po);class ol{constructor(e={}){this.eContentType="",Object.assign(this,e)}}m([w({type:T.ObjectIdentifier})],ol.prototype,"eContentType",void 0);m([w({type:Po,context:0,optional:!0})],ol.prototype,"eContent",void 0);let Bo=class{constructor(e={}){Object.assign(this,e)}};m([w({type:Ie,context:0,implicit:!0,optional:!0})],Bo.prototype,"value",void 0);m([w({type:Ie,converter:q3,context:0,implicit:!0,optional:!0,repeated:"sequence"})],Bo.prototype,"constructedValue",void 0);Bo=m([X({type:q.Choice})],Bo);class ls{constructor(e={}){this.contentType="",this.contentEncryptionAlgorithm=new ja,Object.assign(this,e)}}m([w({type:T.ObjectIdentifier})],ls.prototype,"contentType",void 0);m([w({type:ja})],ls.prototype,"contentEncryptionAlgorithm",void 0);m([w({type:Bo,optional:!0})],ls.prototype,"encryptedContent",void 0);class sl{constructor(e={}){this.keyAttrId="",Object.assign(this,e)}}m([w({type:T.ObjectIdentifier})],sl.prototype,"keyAttrId",void 0);m([w({type:T.Any,optional:!0})],sl.prototype,"keyAttr",void 0);var dd;class al{constructor(e={}){this.subjectKeyIdentifier=new mr,Object.assign(this,e)}}m([w({type:mr})],al.prototype,"subjectKeyIdentifier",void 0);m([w({type:T.GeneralizedTime,optional:!0})],al.prototype,"date",void 0);m([w({type:sl,optional:!0})],al.prototype,"other",void 0);let ji=class{constructor(e={}){Object.assign(this,e)}};m([w({type:al,context:0,implicit:!0,optional:!0})],ji.prototype,"rKeyId",void 0);m([w({type:eo,optional:!0})],ji.prototype,"issuerAndSerialNumber",void 0);ji=m([X({type:q.Choice})],ji);class Zp{constructor(e={}){this.rid=new ji,this.encryptedKey=new Ie,Object.assign(this,e)}}m([w({type:ji})],Zp.prototype,"rid",void 0);m([w({type:Ie})],Zp.prototype,"encryptedKey",void 0);let qa=dd=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,dd.prototype)}};qa=dd=m([X({type:q.Sequence,itemType:Zp})],qa);class Qp{constructor(e={}){this.algorithm=new ce,this.publicKey=new ArrayBuffer(0),Object.assign(this,e)}}m([w({type:ce})],Qp.prototype,"algorithm",void 0);m([w({type:T.BitString})],Qp.prototype,"publicKey",void 0);let Jr=class{constructor(e={}){Object.assign(this,e)}};m([w({type:mr,context:0,implicit:!0,optional:!0})],Jr.prototype,"subjectKeyIdentifier",void 0);m([w({type:Qp,context:1,implicit:!0,optional:!0})],Jr.prototype,"originatorKey",void 0);m([w({type:eo,optional:!0})],Jr.prototype,"issuerAndSerialNumber",void 0);Jr=m([X({type:q.Choice})],Jr);class ro{constructor(e={}){this.version=Hn.v3,this.originator=new Jr,this.keyEncryptionAlgorithm=new In,this.recipientEncryptedKeys=new qa,Object.assign(this,e)}}m([w({type:T.Integer})],ro.prototype,"version",void 0);m([w({type:Jr,context:0})],ro.prototype,"originator",void 0);m([w({type:Ie,context:1,optional:!0})],ro.prototype,"ukm",void 0);m([w({type:In})],ro.prototype,"keyEncryptionAlgorithm",void 0);m([w({type:qa})],ro.prototype,"recipientEncryptedKeys",void 0);let Li=class{constructor(e={}){Object.assign(this,e)}};m([w({type:mr,context:0,implicit:!0})],Li.prototype,"subjectKeyIdentifier",void 0);m([w({type:eo})],Li.prototype,"issuerAndSerialNumber",void 0);Li=m([X({type:q.Choice})],Li);class us{constructor(e={}){this.version=Hn.v0,this.rid=new Li,this.keyEncryptionAlgorithm=new In,this.encryptedKey=new Ie,Object.assign(this,e)}}m([w({type:T.Integer})],us.prototype,"version",void 0);m([w({type:Li})],us.prototype,"rid",void 0);m([w({type:In})],us.prototype,"keyEncryptionAlgorithm",void 0);m([w({type:Ie})],us.prototype,"encryptedKey",void 0);class ds{constructor(e={}){this.keyIdentifier=new Ie,Object.assign(this,e)}}m([w({type:Ie})],ds.prototype,"keyIdentifier",void 0);m([w({type:T.GeneralizedTime,optional:!0})],ds.prototype,"date",void 0);m([w({type:sl,optional:!0})],ds.prototype,"other",void 0);class ps{constructor(e={}){this.version=Hn.v4,this.kekid=new ds,this.keyEncryptionAlgorithm=new In,this.encryptedKey=new Ie,Object.assign(this,e)}}m([w({type:T.Integer})],ps.prototype,"version",void 0);m([w({type:ds})],ps.prototype,"kekid",void 0);m([w({type:In})],ps.prototype,"keyEncryptionAlgorithm",void 0);m([w({type:Ie})],ps.prototype,"encryptedKey",void 0);class fs{constructor(e={}){this.version=Hn.v0,this.keyEncryptionAlgorithm=new In,this.encryptedKey=new Ie,Object.assign(this,e)}}m([w({type:T.Integer})],fs.prototype,"version",void 0);m([w({type:td,context:0,optional:!0})],fs.prototype,"keyDerivationAlgorithm",void 0);m([w({type:In})],fs.prototype,"keyEncryptionAlgorithm",void 0);m([w({type:Ie})],fs.prototype,"encryptedKey",void 0);class ef{constructor(e={}){this.oriType="",this.oriValue=new ArrayBuffer(0),Object.assign(this,e)}}m([w({type:T.ObjectIdentifier})],ef.prototype,"oriType",void 0);m([w({type:T.Any})],ef.prototype,"oriValue",void 0);let vr=class{constructor(e={}){Object.assign(this,e)}};m([w({type:us,optional:!0})],vr.prototype,"ktri",void 0);m([w({type:ro,context:1,implicit:!0,optional:!0})],vr.prototype,"kari",void 0);m([w({type:ps,context:2,implicit:!0,optional:!0})],vr.prototype,"kekri",void 0);m([w({type:fs,context:3,implicit:!0,optional:!0})],vr.prototype,"pwri",void 0);m([w({type:ef,context:4,implicit:!0,optional:!0})],vr.prototype,"ori",void 0);vr=m([X({type:q.Choice})],vr);var pd;let Va=pd=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,pd.prototype)}};Va=pd=m([X({type:q.Set,itemType:vr})],Va);var fd;class cl{constructor(e={}){this.otherRevInfoFormat="",this.otherRevInfo=new ArrayBuffer(0),Object.assign(this,e)}}m([w({type:T.ObjectIdentifier})],cl.prototype,"otherRevInfoFormat",void 0);m([w({type:T.Any})],cl.prototype,"otherRevInfo",void 0);let Ha=class{constructor(e={}){this.other=new cl,Object.assign(this,e)}};m([w({type:cl,context:1,implicit:!0})],Ha.prototype,"other",void 0);Ha=m([X({type:q.Choice})],Ha);let Ka=fd=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,fd.prototype)}};Ka=fd=m([X({type:q.Set,itemType:Ha})],Ka);class tf{constructor(e={}){Object.assign(this,e)}}m([w({type:Ma,context:0,implicit:!0,optional:!0})],tf.prototype,"certs",void 0);m([w({type:Ka,context:1,implicit:!0,optional:!0})],tf.prototype,"crls",void 0);var hd;let gd=hd=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,hd.prototype)}};gd=hd=m([X({type:q.Set,itemType:to})],gd);class hs{constructor(e={}){this.version=Hn.v0,this.recipientInfos=new Va,this.encryptedContentInfo=new ls,Object.assign(this,e)}}m([w({type:T.Integer})],hs.prototype,"version",void 0);m([w({type:tf,context:0,implicit:!0,optional:!0})],hs.prototype,"originatorInfo",void 0);m([w({type:Va})],hs.prototype,"recipientInfos",void 0);m([w({type:ls})],hs.prototype,"encryptedContentInfo",void 0);m([w({type:gd,context:1,implicit:!0,optional:!0})],hs.prototype,"unprotectedAttrs",void 0);const g4="1.2.840.113549.1.7.2";var md;let Ga=md=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,md.prototype)}};Ga=md=m([X({type:q.Set,itemType:Ro})],Ga);class io{constructor(e={}){this.version=Hn.v0,this.digestAlgorithms=new Ga,this.encapContentInfo=new ol,this.signerInfos=new La,Object.assign(this,e)}}m([w({type:T.Integer})],io.prototype,"version",void 0);m([w({type:Ga})],io.prototype,"digestAlgorithms",void 0);m([w({type:ol})],io.prototype,"encapContentInfo",void 0);m([w({type:Ma,context:0,implicit:!0,optional:!0})],io.prototype,"certificates",void 0);m([w({type:Ka,context:1,implicit:!0,optional:!0})],io.prototype,"crls",void 0);m([w({type:La})],io.prototype,"signerInfos",void 0);const jo="1.2.840.10045.2.1",nf="1.2.840.10045.4.1",G2="1.2.840.10045.4.3.1",rf="1.2.840.10045.4.3.2",of="1.2.840.10045.4.3.3",sf="1.2.840.10045.4.3.4",Vh="1.2.840.10045.3.1.7",Hh="1.3.132.0.34",Kh="1.3.132.0.35";function gs(t){return new ce({algorithm:t})}const m4=gs(nf);gs(G2);const _4=gs(rf),y4=gs(of),w4=gs(sf);let Lo=class{constructor(e={}){Object.assign(this,e)}};m([w({type:T.ObjectIdentifier})],Lo.prototype,"fieldType",void 0);m([w({type:T.Any})],Lo.prototype,"parameters",void 0);Lo=m([X({type:q.Sequence})],Lo);class v4 extends Ie{}let Fi=class{constructor(e={}){Object.assign(this,e)}};m([w({type:T.OctetString})],Fi.prototype,"a",void 0);m([w({type:T.OctetString})],Fi.prototype,"b",void 0);m([w({type:T.BitString,optional:!0})],Fi.prototype,"seed",void 0);Fi=m([X({type:q.Sequence})],Fi);var _d;(function(t){t[t.ecpVer1=1]="ecpVer1"})(_d||(_d={}));let Kn=class{constructor(e={}){this.version=_d.ecpVer1,Object.assign(this,e)}};m([w({type:T.Integer})],Kn.prototype,"version",void 0);m([w({type:Lo})],Kn.prototype,"fieldID",void 0);m([w({type:Fi})],Kn.prototype,"curve",void 0);m([w({type:v4})],Kn.prototype,"base",void 0);m([w({type:T.Integer,converter:qe})],Kn.prototype,"order",void 0);m([w({type:T.Integer,optional:!0})],Kn.prototype,"cofactor",void 0);Kn=m([X({type:q.Sequence})],Kn);let br=class{constructor(e={}){Object.assign(this,e)}};m([w({type:T.ObjectIdentifier})],br.prototype,"namedCurve",void 0);m([w({type:T.Null})],br.prototype,"implicitCurve",void 0);m([w({type:Kn})],br.prototype,"specifiedCurve",void 0);br=m([X({type:q.Choice})],br);class ll{constructor(e={}){this.version=1,this.privateKey=new Ie,Object.assign(this,e)}}m([w({type:T.Integer})],ll.prototype,"version",void 0);m([w({type:Ie})],ll.prototype,"privateKey",void 0);m([w({type:br,context:0,optional:!0})],ll.prototype,"parameters",void 0);m([w({type:T.BitString,context:1,optional:!0})],ll.prototype,"publicKey",void 0);class Wa{constructor(e={}){this.r=new ArrayBuffer(0),this.s=new ArrayBuffer(0),Object.assign(this,e)}}m([w({type:T.Integer,converter:qe})],Wa.prototype,"r",void 0);m([w({type:T.Integer,converter:qe})],Wa.prototype,"s",void 0);const Nt="1.2.840.113549.1.1",Yr=`${Nt}.1`,b4=`${Nt}.7`,$4=`${Nt}.9`,So=`${Nt}.10`,x4=`${Nt}.2`,A4=`${Nt}.4`,Xa=`${Nt}.5`,E4=`${Nt}.14`,yd=`${Nt}.11`,Ja=`${Nt}.12`,Ya=`${Nt}.13`,W2=`${Nt}.15`,X2=`${Nt}.16`,Za="1.3.14.3.2.26",J2="2.16.840.1.101.3.4.2.4",Qa="2.16.840.1.101.3.4.2.1",ec="2.16.840.1.101.3.4.2.2",tc="2.16.840.1.101.3.4.2.3",S4="2.16.840.1.101.3.4.2.5",k4="2.16.840.1.101.3.4.2.6",N4="1.2.840.113549.2.2",C4="1.2.840.113549.2.5",ul=`${Nt}.8`;function it(t){return new ce({algorithm:t,parameters:null})}it(N4);it(C4);const Zr=it(Za);it(J2);it(Qa);it(ec);it(tc);it(S4);it(k4);const Y2=new ce({algorithm:ul,parameters:te.serialize(Zr)}),Z2=new ce({algorithm:$4,parameters:te.serialize(Ta.toASN(new Uint8Array([218,57,163,238,94,107,75,13,50,85,191,239,149,96,24,144,175,216,7,9]).buffer))});it(Yr);it(x4);it(A4);it(Xa);it(W2);it(X2);it(Ja);it(Ya);it(W2);it(X2);class dl{constructor(e={}){this.hashAlgorithm=new ce(Zr),this.maskGenAlgorithm=new ce({algorithm:ul,parameters:te.serialize(Zr)}),this.pSourceAlgorithm=new ce(Z2),Object.assign(this,e)}}m([w({type:ce,context:0,defaultValue:Zr})],dl.prototype,"hashAlgorithm",void 0);m([w({type:ce,context:1,defaultValue:Y2})],dl.prototype,"maskGenAlgorithm",void 0);m([w({type:ce,context:2,defaultValue:Z2})],dl.prototype,"pSourceAlgorithm",void 0);new ce({algorithm:b4,parameters:te.serialize(new dl)});class Qr{constructor(e={}){this.hashAlgorithm=new ce(Zr),this.maskGenAlgorithm=new ce({algorithm:ul,parameters:te.serialize(Zr)}),this.saltLength=20,this.trailerField=1,Object.assign(this,e)}}m([w({type:ce,context:0,defaultValue:Zr})],Qr.prototype,"hashAlgorithm",void 0);m([w({type:ce,context:1,defaultValue:Y2})],Qr.prototype,"maskGenAlgorithm",void 0);m([w({type:T.Integer,context:2,defaultValue:20})],Qr.prototype,"saltLength",void 0);m([w({type:T.Integer,context:3,defaultValue:1})],Qr.prototype,"trailerField",void 0);new ce({algorithm:So,parameters:te.serialize(new Qr)});class pl{constructor(e={}){this.digestAlgorithm=new ce,this.digest=new Ie,Object.assign(this,e)}}m([w({type:ce})],pl.prototype,"digestAlgorithm",void 0);m([w({type:Ie})],pl.prototype,"digest",void 0);var wd;class fl{constructor(e={}){this.prime=new ArrayBuffer(0),this.exponent=new ArrayBuffer(0),this.coefficient=new ArrayBuffer(0),Object.assign(this,e)}}m([w({type:T.Integer,converter:qe})],fl.prototype,"prime",void 0);m([w({type:T.Integer,converter:qe})],fl.prototype,"exponent",void 0);m([w({type:T.Integer,converter:qe})],fl.prototype,"coefficient",void 0);let vd=wd=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,wd.prototype)}};vd=wd=m([X({type:q.Sequence,itemType:fl})],vd);class Dn{constructor(e={}){this.version=0,this.modulus=new ArrayBuffer(0),this.publicExponent=new ArrayBuffer(0),this.privateExponent=new ArrayBuffer(0),this.prime1=new ArrayBuffer(0),this.prime2=new ArrayBuffer(0),this.exponent1=new ArrayBuffer(0),this.exponent2=new ArrayBuffer(0),this.coefficient=new ArrayBuffer(0),Object.assign(this,e)}}m([w({type:T.Integer})],Dn.prototype,"version",void 0);m([w({type:T.Integer,converter:qe})],Dn.prototype,"modulus",void 0);m([w({type:T.Integer,converter:qe})],Dn.prototype,"publicExponent",void 0);m([w({type:T.Integer,converter:qe})],Dn.prototype,"privateExponent",void 0);m([w({type:T.Integer,converter:qe})],Dn.prototype,"prime1",void 0);m([w({type:T.Integer,converter:qe})],Dn.prototype,"prime2",void 0);m([w({type:T.Integer,converter:qe})],Dn.prototype,"exponent1",void 0);m([w({type:T.Integer,converter:qe})],Dn.prototype,"exponent2",void 0);m([w({type:T.Integer,converter:qe})],Dn.prototype,"coefficient",void 0);m([w({type:vd,optional:!0})],Dn.prototype,"otherPrimeInfos",void 0);class af{constructor(e={}){this.modulus=new ArrayBuffer(0),this.publicExponent=new ArrayBuffer(0),Object.assign(this,e)}}m([w({type:T.Integer,converter:qe})],af.prototype,"modulus",void 0);m([w({type:T.Integer,converter:qe})],af.prototype,"publicExponent",void 0);var bd;(function(t){t[t.Transient=0]="Transient",t[t.Singleton=1]="Singleton",t[t.ResolutionScoped=2]="ResolutionScoped",t[t.ContainerScoped=3]="ContainerScoped"})(bd||(bd={}));const At=bd;/*! *****************************************************************************
147
147
  Copyright (c) Microsoft Corporation.
148
148
 
149
149
  Permission to use, copy, modify, and/or distribute this software for any
@@ -158,7 +158,7 @@ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
158
158
  PERFORMANCE OF THIS SOFTWARE.
159
159
  ***************************************************************************** */var $d=function(t,e){return $d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var i in r)r.hasOwnProperty(i)&&(n[i]=r[i])},$d(t,e)};function cf(t,e){$d(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}function T4(t,e,n,r){function i(o){return o instanceof n?o:new n(function(a){a(o)})}return new(n||(n=Promise))(function(o,a){function l(p){try{d(r.next(p))}catch(h){a(h)}}function u(p){try{d(r.throw(p))}catch(h){a(h)}}function d(p){p.done?o(p.value):i(p.value).then(l,u)}d((r=r.apply(t,[])).next())})}function I4(t,e){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,a;return a={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function l(d){return function(p){return u([d,p])}}function u(d){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,i&&(o=d[0]&2?i.return:d[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,d[1])).done)return o;switch(i=0,o&&(d=[d[0]&2,o.value]),d[0]){case 0:case 1:o=d;break;case 4:return n.label++,{value:d[1],done:!1};case 5:n.label++,i=d[1],d=[0];continue;case 7:d=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(d[0]===6||d[0]===2)){n=0;continue}if(d[0]===3&&(!o||d[1]>o[0]&&d[1]<o[3])){n.label=d[1];break}if(d[0]===6&&n.label<o[1]){n.label=o[1],o=d;break}if(o&&n.label<o[2]){n.label=o[2],n.ops.push(d);break}o[2]&&n.ops.pop(),n.trys.pop();continue}d=e.call(t,n)}catch(p){d=[6,p],i=0}finally{r=o=0}if(d[0]&5)throw d[1];return{value:d[0]?d[1]:void 0,done:!0}}}function Ls(t){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function nc(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var r=n.call(t),i,o=[],a;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)o.push(i.value)}catch(l){a={error:l}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(a)throw a.error}}return o}function zr(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(nc(arguments[e]));return t}var O4="injectionTokens";function z4(t){var e=Reflect.getMetadata("design:paramtypes",t)||[],n=Reflect.getOwnMetadata(O4,t)||{};return Object.keys(n).forEach(function(r){e[+r]=n[r]}),e}function Q2(t){return!!t.useClass}function xd(t){return!!t.useFactory}var e1=function(){function t(e){this.wrap=e,this.reflectMethods=["get","getPrototypeOf","setPrototypeOf","getOwnPropertyDescriptor","defineProperty","has","set","deleteProperty","apply","construct","ownKeys"]}return t.prototype.createProxy=function(e){var n=this,r={},i=!1,o,a=function(){return i||(o=e(n.wrap()),i=!0),o};return new Proxy(r,this.createHandler(a))},t.prototype.createHandler=function(e){var n={},r=function(i){n[i]=function(){for(var o=[],a=0;a<arguments.length;a++)o[a]=arguments[a];o[0]=e();var l=Reflect[i];return l.apply(void 0,zr(o))}};return this.reflectMethods.forEach(r),n},t}();function di(t){return typeof t=="string"||typeof t=="symbol"}function D4(t){return typeof t=="object"&&"token"in t&&"multiple"in t}function Gh(t){return typeof t=="object"&&"token"in t&&"transform"in t}function R4(t){return typeof t=="function"||t instanceof e1}function ta(t){return!!t.useToken}function na(t){return t.useValue!=null}function P4(t){return Q2(t)||na(t)||ta(t)||xd(t)}var lf=function(){function t(){this._registryMap=new Map}return t.prototype.entries=function(){return this._registryMap.entries()},t.prototype.getAll=function(e){return this.ensure(e),this._registryMap.get(e)},t.prototype.get=function(e){this.ensure(e);var n=this._registryMap.get(e);return n[n.length-1]||null},t.prototype.set=function(e,n){this.ensure(e),this._registryMap.get(e).push(n)},t.prototype.setAll=function(e,n){this._registryMap.set(e,n)},t.prototype.has=function(e){return this.ensure(e),this._registryMap.get(e).length>0},t.prototype.clear=function(){this._registryMap.clear()},t.prototype.ensure=function(e){this._registryMap.has(e)||this._registryMap.set(e,[])},t}(),B4=function(t){cf(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(lf),Fs=function(){function t(){this.scopedResolutions=new Map}return t}();function j4(t,e){if(t===null)return"at position #"+e;var n=t.split(",")[e].trim();return'"'+n+'" at position #'+e}function L4(t,e,n){return n===void 0&&(n=" "),zr([t],e.message.split(`
160
160
  `).map(function(r){return n+r})).join(`
161
- `)}function F4(t,e,n){var r=nc(t.toString().match(/constructor\(([\w, ]+)\)/)||[],2),i=r[1],o=i===void 0?null:i,a=j4(o,e);return L4("Cannot inject the dependency "+a+' of "'+t.name+'" constructor. Reason:',n)}function U4(t){if(typeof t.dispose!="function")return!1;var e=t.dispose;return!(e.length>0)}var M4=function(t){cf(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(lf),q4=function(t){cf(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(lf),V4=function(){function t(){this.preResolution=new M4,this.postResolution=new q4}return t}(),t1=new Map,H4=function(){function t(e){this.parent=e,this._registry=new B4,this.interceptors=new V4,this.disposed=!1,this.disposables=new Set}return t.prototype.register=function(e,n,r){r===void 0&&(r={lifecycle:At.Transient}),this.ensureNotDisposed();var i;if(P4(n)?i=n:i={useClass:n},ta(i))for(var o=[e],a=i;a!=null;){var l=a.useToken;if(o.includes(l))throw new Error("Token registration cycle detected! "+zr(o,[l]).join(" -> "));o.push(l);var u=this._registry.get(l);u&&ta(u.provider)?a=u.provider:a=null}if((r.lifecycle===At.Singleton||r.lifecycle==At.ContainerScoped||r.lifecycle==At.ResolutionScoped)&&(na(i)||xd(i)))throw new Error('Cannot use lifecycle "'+At[r.lifecycle]+'" with ValueProviders or FactoryProviders');return this._registry.set(e,{provider:i,options:r}),this},t.prototype.registerType=function(e,n){return this.ensureNotDisposed(),di(n)?this.register(e,{useToken:n}):this.register(e,{useClass:n})},t.prototype.registerInstance=function(e,n){return this.ensureNotDisposed(),this.register(e,{useValue:n})},t.prototype.registerSingleton=function(e,n){if(this.ensureNotDisposed(),di(e)){if(di(n))return this.register(e,{useToken:n},{lifecycle:At.Singleton});if(n)return this.register(e,{useClass:n},{lifecycle:At.Singleton});throw new Error('Cannot register a type name as a singleton without a "to" token')}var r=e;return n&&!di(n)&&(r=n),this.register(e,{useClass:r},{lifecycle:At.Singleton})},t.prototype.resolve=function(e,n,r){n===void 0&&(n=new Fs),r===void 0&&(r=!1),this.ensureNotDisposed();var i=this.getRegistration(e);if(!i&&di(e)){if(r)return;throw new Error('Attempted to resolve unregistered dependency token: "'+e.toString()+'"')}if(this.executePreResolutionInterceptor(e,"Single"),i){var o=this.resolveRegistration(i,n);return this.executePostResolutionInterceptor(e,o,"Single"),o}if(R4(e)){var o=this.construct(e,n);return this.executePostResolutionInterceptor(e,o,"Single"),o}throw new Error("Attempted to construct an undefined constructor. Could mean a circular dependency problem. Try using `delay` function.")},t.prototype.executePreResolutionInterceptor=function(e,n){var r,i;if(this.interceptors.preResolution.has(e)){var o=[];try{for(var a=Ls(this.interceptors.preResolution.getAll(e)),l=a.next();!l.done;l=a.next()){var u=l.value;u.options.frequency!="Once"&&o.push(u),u.callback(e,n)}}catch(d){r={error:d}}finally{try{l&&!l.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}this.interceptors.preResolution.setAll(e,o)}},t.prototype.executePostResolutionInterceptor=function(e,n,r){var i,o;if(this.interceptors.postResolution.has(e)){var a=[];try{for(var l=Ls(this.interceptors.postResolution.getAll(e)),u=l.next();!u.done;u=l.next()){var d=u.value;d.options.frequency!="Once"&&a.push(d),d.callback(e,n,r)}}catch(p){i={error:p}}finally{try{u&&!u.done&&(o=l.return)&&o.call(l)}finally{if(i)throw i.error}}this.interceptors.postResolution.setAll(e,a)}},t.prototype.resolveRegistration=function(e,n){if(this.ensureNotDisposed(),e.options.lifecycle===At.ResolutionScoped&&n.scopedResolutions.has(e))return n.scopedResolutions.get(e);var r=e.options.lifecycle===At.Singleton,i=e.options.lifecycle===At.ContainerScoped,o=r||i,a;return na(e.provider)?a=e.provider.useValue:ta(e.provider)?a=o?e.instance||(e.instance=this.resolve(e.provider.useToken,n)):this.resolve(e.provider.useToken,n):Q2(e.provider)?a=o?e.instance||(e.instance=this.construct(e.provider.useClass,n)):this.construct(e.provider.useClass,n):xd(e.provider)?a=e.provider.useFactory(this):a=this.construct(e.provider,n),e.options.lifecycle===At.ResolutionScoped&&n.scopedResolutions.set(e,a),a},t.prototype.resolveAll=function(e,n,r){var i=this;n===void 0&&(n=new Fs),r===void 0&&(r=!1),this.ensureNotDisposed();var o=this.getAllRegistrations(e);if(!o&&di(e)){if(r)return[];throw new Error('Attempted to resolve unregistered dependency token: "'+e.toString()+'"')}if(this.executePreResolutionInterceptor(e,"All"),o){var a=o.map(function(u){return i.resolveRegistration(u,n)});return this.executePostResolutionInterceptor(e,a,"All"),a}var l=[this.construct(e,n)];return this.executePostResolutionInterceptor(e,l,"All"),l},t.prototype.isRegistered=function(e,n){return n===void 0&&(n=!1),this.ensureNotDisposed(),this._registry.has(e)||n&&(this.parent||!1)&&this.parent.isRegistered(e,!0)},t.prototype.reset=function(){this.ensureNotDisposed(),this._registry.clear(),this.interceptors.preResolution.clear(),this.interceptors.postResolution.clear()},t.prototype.clearInstances=function(){var e,n;this.ensureNotDisposed();try{for(var r=Ls(this._registry.entries()),i=r.next();!i.done;i=r.next()){var o=nc(i.value,2),a=o[0],l=o[1];this._registry.setAll(a,l.filter(function(u){return!na(u.provider)}).map(function(u){return u.instance=void 0,u}))}}catch(u){e={error:u}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}},t.prototype.createChildContainer=function(){var e,n;this.ensureNotDisposed();var r=new t(this);try{for(var i=Ls(this._registry.entries()),o=i.next();!o.done;o=i.next()){var a=nc(o.value,2),l=a[0],u=a[1];u.some(function(d){var p=d.options;return p.lifecycle===At.ContainerScoped})&&r._registry.setAll(l,u.map(function(d){return d.options.lifecycle===At.ContainerScoped?{provider:d.provider,options:d.options}:d}))}}catch(d){e={error:d}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return r},t.prototype.beforeResolution=function(e,n,r){r===void 0&&(r={frequency:"Always"}),this.interceptors.preResolution.set(e,{callback:n,options:r})},t.prototype.afterResolution=function(e,n,r){r===void 0&&(r={frequency:"Always"}),this.interceptors.postResolution.set(e,{callback:n,options:r})},t.prototype.dispose=function(){return T4(this,void 0,void 0,function(){var e;return I4(this,function(n){switch(n.label){case 0:return this.disposed=!0,e=[],this.disposables.forEach(function(r){var i=r.dispose();i&&e.push(i)}),[4,Promise.all(e)];case 1:return n.sent(),[2]}})})},t.prototype.getRegistration=function(e){return this.isRegistered(e)?this._registry.get(e):this.parent?this.parent.getRegistration(e):null},t.prototype.getAllRegistrations=function(e){return this.isRegistered(e)?this._registry.getAll(e):this.parent?this.parent.getAllRegistrations(e):null},t.prototype.construct=function(e,n){var r=this;if(e instanceof e1)return e.createProxy(function(o){return r.resolve(o,n)});var i=function(){var o=t1.get(e);if(!o||o.length===0){if(e.length===0)return new e;throw new Error('TypeInfo not known for "'+e.name+'"')}var a=o.map(r.resolveParams(n,e));return new(e.bind.apply(e,zr([void 0],a)))}();return U4(i)&&this.disposables.add(i),i},t.prototype.resolveParams=function(e,n){var r=this;return function(i,o){var a,l,u;try{return D4(i)?Gh(i)?i.multiple?(a=r.resolve(i.transform)).transform.apply(a,zr([r.resolveAll(i.token,new Fs,i.isOptional)],i.transformArgs)):(l=r.resolve(i.transform)).transform.apply(l,zr([r.resolve(i.token,e,i.isOptional)],i.transformArgs)):i.multiple?r.resolveAll(i.token,new Fs,i.isOptional):r.resolve(i.token,e,i.isOptional):Gh(i)?(u=r.resolve(i.transform,e)).transform.apply(u,zr([r.resolve(i.token,e)],i.transformArgs)):r.resolve(i,e)}catch(d){throw new Error(F4(n,o,d))}}},t.prototype.ensureNotDisposed=function(){if(this.disposed)throw new Error("This container has been disposed, you cannot interact with a disposed container")},t}(),ft=new H4;function hl(t){return function(e){t1.set(e,z4(e))}}if(typeof Reflect>"u"||!Reflect.getMetadata)throw new Error(`tsyringe requires a reflect polyfill. Please add 'import "reflect-metadata"' to the top of your entry point.`);var Ad;class gl{constructor(e={}){this.attrId="",this.attrValues=[],Object.assign(e)}}m([w({type:T.ObjectIdentifier})],gl.prototype,"attrId",void 0);m([w({type:T.Any,repeated:"set"})],gl.prototype,"attrValues",void 0);let Wh=Ad=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Ad.prototype)}};Wh=Ad=m([X({type:q.Sequence,itemType:gl})],Wh);var Ed;let Xh=Ed=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Ed.prototype)}};Xh=Ed=m([X({type:q.Sequence,itemType:no})],Xh);class n1{constructor(e={}){this.certId="",this.certValue=new ArrayBuffer(0),Object.assign(this,e)}}m([w({type:T.ObjectIdentifier})],n1.prototype,"certId",void 0);m([w({type:T.Any,context:0})],n1.prototype,"certValue",void 0);class r1{constructor(e={}){this.crlId="",this.crltValue=new ArrayBuffer(0),Object.assign(this,e)}}m([w({type:T.ObjectIdentifier})],r1.prototype,"crlId",void 0);m([w({type:T.Any,context:0})],r1.prototype,"crltValue",void 0);class i1 extends Ie{}let ml=class{constructor(e={}){this.encryptionAlgorithm=new ce,this.encryptedData=new i1,Object.assign(this,e)}};m([w({type:ce})],ml.prototype,"encryptionAlgorithm",void 0);m([w({type:i1})],ml.prototype,"encryptedData",void 0);var Sd,kd;(function(t){t[t.v1=0]="v1"})(kd||(kd={}));class o1 extends Ie{}let Nd=Sd=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Sd.prototype)}};Nd=Sd=m([X({type:q.Sequence,itemType:Vn})],Nd);class ms{constructor(e={}){this.version=kd.v1,this.privateKeyAlgorithm=new ce,this.privateKey=new o1,Object.assign(this,e)}}m([w({type:T.Integer})],ms.prototype,"version",void 0);m([w({type:ce})],ms.prototype,"privateKeyAlgorithm",void 0);m([w({type:o1})],ms.prototype,"privateKey",void 0);m([w({type:Nd,implicit:!0,context:0,optional:!0})],ms.prototype,"attributes",void 0);let Jh=class extends ms{};Jh=m([X({type:q.Sequence})],Jh);let Yh=class extends ml{};Yh=m([X({type:q.Sequence})],Yh);class s1{constructor(e={}){this.secretTypeId="",this.secretValue=new ArrayBuffer(0),Object.assign(this,e)}}m([w({type:T.ObjectIdentifier})],s1.prototype,"secretTypeId",void 0);m([w({type:T.Any,context:0})],s1.prototype,"secretValue",void 0);class _s{constructor(e={}){this.mac=new pl,this.macSalt=new Ie,this.iterations=1,Object.assign(this,e)}}m([w({type:pl})],_s.prototype,"mac",void 0);m([w({type:Ie})],_s.prototype,"macSalt",void 0);m([w({type:T.Integer,defaultValue:1})],_s.prototype,"iterations",void 0);class _l{constructor(e={}){this.version=3,this.authSafe=new no,this.macData=new _s,Object.assign(this,e)}}m([w({type:T.Integer})],_l.prototype,"version",void 0);m([w({type:no})],_l.prototype,"authSafe",void 0);m([w({type:_s,optional:!0})],_l.prototype,"macData",void 0);var Cd;class yl{constructor(e={}){this.bagId="",this.bagValue=new ArrayBuffer(0),Object.assign(this,e)}}m([w({type:T.ObjectIdentifier})],yl.prototype,"bagId",void 0);m([w({type:T.Any,context:0})],yl.prototype,"bagValue",void 0);m([w({type:gl,repeated:"set",optional:!0})],yl.prototype,"bagAttributes",void 0);let Zh=Cd=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Cd.prototype)}};Zh=Cd=m([X({type:q.Sequence,itemType:yl})],Zh);var Td,Id,Od;const a1="1.2.840.113549.1.9",c1=`${a1}.7`,uf=`${a1}.14`;let rc=class extends pt{constructor(e={}){super(e)}toString(){return this.ia5String||super.toString()}};m([w({type:T.IA5String})],rc.prototype,"ia5String",void 0);rc=m([X({type:q.Choice})],rc);let Qh=class extends no{};Qh=m([X({type:q.Sequence})],Qh);let e0=class extends _l{};e0=m([X({type:q.Sequence})],e0);let t0=class extends ml{};t0=m([X({type:q.Sequence})],t0);let zd=class{constructor(e=""){this.value=e}toString(){return this.value}};m([w({type:T.IA5String})],zd.prototype,"value",void 0);zd=m([X({type:q.Choice})],zd);let n0=class extends rc{};n0=m([X({type:q.Choice})],n0);let r0=class extends pt{};r0=m([X({type:q.Choice})],r0);let Dd=class{constructor(e=new Date){this.value=e}};m([w({type:T.GeneralizedTime})],Dd.prototype,"value",void 0);Dd=m([X({type:q.Choice})],Dd);let i0=class extends pt{};i0=m([X({type:q.Choice})],i0);let Rd=class{constructor(e="M"){this.value=e}toString(){return this.value}};m([w({type:T.PrintableString})],Rd.prototype,"value",void 0);Rd=m([X({type:q.Choice})],Rd);let ic=class{constructor(e=""){this.value=e}toString(){return this.value}};m([w({type:T.PrintableString})],ic.prototype,"value",void 0);ic=m([X({type:q.Choice})],ic);let o0=class extends ic{};o0=m([X({type:q.Choice})],o0);let s0=class extends pt{};s0=m([X({type:q.Choice})],s0);let Pd=class{constructor(e=""){this.value=e}toString(){return this.value}};m([w({type:T.ObjectIdentifier})],Pd.prototype,"value",void 0);Pd=m([X({type:q.Choice})],Pd);let a0=class extends ut{};a0=m([X({type:q.Choice})],a0);let Bd=class{constructor(e=0){this.value=e}toString(){return this.value.toString()}};m([w({type:T.Integer})],Bd.prototype,"value",void 0);Bd=m([X({type:q.Choice})],Bd);let c0=class extends zn{};c0=m([X({type:q.Sequence})],c0);let oc=class extends pt{};oc=m([X({type:q.Choice})],oc);let l0=Td=class extends wr{constructor(e){super(e),Object.setPrototypeOf(this,Td.prototype)}};l0=Td=m([X({type:q.Sequence})],l0);let u0=Id=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Id.prototype)}};u0=Id=m([X({type:q.Set,itemType:to})],u0);let jd=class{constructor(e=""){this.value=e}toString(){return this.value}};m([w({type:T.BmpString})],jd.prototype,"value",void 0);jd=m([X({type:q.Choice})],jd);let Ld=class extends ce{};Ld=m([X({type:q.Sequence})],Ld);let d0=Od=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Od.prototype)}};d0=Od=m([X({type:q.Sequence,itemType:Ld})],d0);var Fd;let sc=Fd=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Fd.prototype)}};sc=Fd=m([X({type:q.Sequence,itemType:Vn})],sc);class oo{constructor(e={}){this.version=0,this.subject=new Ze,this.subjectPKInfo=new sn,this.attributes=new sc,Object.assign(this,e)}}m([w({type:T.Integer})],oo.prototype,"version",void 0);m([w({type:Ze})],oo.prototype,"subject",void 0);m([w({type:sn})],oo.prototype,"subjectPKInfo",void 0);m([w({type:sc,implicit:!0,context:0})],oo.prototype,"attributes",void 0);class Fo{constructor(e={}){this.certificationRequestInfo=new oo,this.signatureAlgorithm=new ce,this.signature=new ArrayBuffer(0),Object.assign(this,e)}}m([w({type:oo})],Fo.prototype,"certificationRequestInfo",void 0);m([w({type:ce})],Fo.prototype,"signatureAlgorithm",void 0);m([w({type:T.BitString})],Fo.prototype,"signature",void 0);/*!
161
+ `)}function F4(t,e,n){var r=nc(t.toString().match(/constructor\(([\w, ]+)\)/)||[],2),i=r[1],o=i===void 0?null:i,a=j4(o,e);return L4("Cannot inject the dependency "+a+' of "'+t.name+'" constructor. Reason:',n)}function U4(t){if(typeof t.dispose!="function")return!1;var e=t.dispose;return!(e.length>0)}var M4=function(t){cf(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(lf),q4=function(t){cf(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(lf),V4=function(){function t(){this.preResolution=new M4,this.postResolution=new q4}return t}(),t1=new Map,H4=function(){function t(e){this.parent=e,this._registry=new B4,this.interceptors=new V4,this.disposed=!1,this.disposables=new Set}return t.prototype.register=function(e,n,r){r===void 0&&(r={lifecycle:At.Transient}),this.ensureNotDisposed();var i;if(P4(n)?i=n:i={useClass:n},ta(i))for(var o=[e],a=i;a!=null;){var l=a.useToken;if(o.includes(l))throw new Error("Token registration cycle detected! "+zr(o,[l]).join(" -> "));o.push(l);var u=this._registry.get(l);u&&ta(u.provider)?a=u.provider:a=null}if((r.lifecycle===At.Singleton||r.lifecycle==At.ContainerScoped||r.lifecycle==At.ResolutionScoped)&&(na(i)||xd(i)))throw new Error('Cannot use lifecycle "'+At[r.lifecycle]+'" with ValueProviders or FactoryProviders');return this._registry.set(e,{provider:i,options:r}),this},t.prototype.registerType=function(e,n){return this.ensureNotDisposed(),di(n)?this.register(e,{useToken:n}):this.register(e,{useClass:n})},t.prototype.registerInstance=function(e,n){return this.ensureNotDisposed(),this.register(e,{useValue:n})},t.prototype.registerSingleton=function(e,n){if(this.ensureNotDisposed(),di(e)){if(di(n))return this.register(e,{useToken:n},{lifecycle:At.Singleton});if(n)return this.register(e,{useClass:n},{lifecycle:At.Singleton});throw new Error('Cannot register a type name as a singleton without a "to" token')}var r=e;return n&&!di(n)&&(r=n),this.register(e,{useClass:r},{lifecycle:At.Singleton})},t.prototype.resolve=function(e,n,r){n===void 0&&(n=new Fs),r===void 0&&(r=!1),this.ensureNotDisposed();var i=this.getRegistration(e);if(!i&&di(e)){if(r)return;throw new Error('Attempted to resolve unregistered dependency token: "'+e.toString()+'"')}if(this.executePreResolutionInterceptor(e,"Single"),i){var o=this.resolveRegistration(i,n);return this.executePostResolutionInterceptor(e,o,"Single"),o}if(R4(e)){var o=this.construct(e,n);return this.executePostResolutionInterceptor(e,o,"Single"),o}throw new Error("Attempted to construct an undefined constructor. Could mean a circular dependency problem. Try using `delay` function.")},t.prototype.executePreResolutionInterceptor=function(e,n){var r,i;if(this.interceptors.preResolution.has(e)){var o=[];try{for(var a=Ls(this.interceptors.preResolution.getAll(e)),l=a.next();!l.done;l=a.next()){var u=l.value;u.options.frequency!="Once"&&o.push(u),u.callback(e,n)}}catch(d){r={error:d}}finally{try{l&&!l.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}this.interceptors.preResolution.setAll(e,o)}},t.prototype.executePostResolutionInterceptor=function(e,n,r){var i,o;if(this.interceptors.postResolution.has(e)){var a=[];try{for(var l=Ls(this.interceptors.postResolution.getAll(e)),u=l.next();!u.done;u=l.next()){var d=u.value;d.options.frequency!="Once"&&a.push(d),d.callback(e,n,r)}}catch(p){i={error:p}}finally{try{u&&!u.done&&(o=l.return)&&o.call(l)}finally{if(i)throw i.error}}this.interceptors.postResolution.setAll(e,a)}},t.prototype.resolveRegistration=function(e,n){if(this.ensureNotDisposed(),e.options.lifecycle===At.ResolutionScoped&&n.scopedResolutions.has(e))return n.scopedResolutions.get(e);var r=e.options.lifecycle===At.Singleton,i=e.options.lifecycle===At.ContainerScoped,o=r||i,a;return na(e.provider)?a=e.provider.useValue:ta(e.provider)?a=o?e.instance||(e.instance=this.resolve(e.provider.useToken,n)):this.resolve(e.provider.useToken,n):Q2(e.provider)?a=o?e.instance||(e.instance=this.construct(e.provider.useClass,n)):this.construct(e.provider.useClass,n):xd(e.provider)?a=e.provider.useFactory(this):a=this.construct(e.provider,n),e.options.lifecycle===At.ResolutionScoped&&n.scopedResolutions.set(e,a),a},t.prototype.resolveAll=function(e,n,r){var i=this;n===void 0&&(n=new Fs),r===void 0&&(r=!1),this.ensureNotDisposed();var o=this.getAllRegistrations(e);if(!o&&di(e)){if(r)return[];throw new Error('Attempted to resolve unregistered dependency token: "'+e.toString()+'"')}if(this.executePreResolutionInterceptor(e,"All"),o){var a=o.map(function(u){return i.resolveRegistration(u,n)});return this.executePostResolutionInterceptor(e,a,"All"),a}var l=[this.construct(e,n)];return this.executePostResolutionInterceptor(e,l,"All"),l},t.prototype.isRegistered=function(e,n){return n===void 0&&(n=!1),this.ensureNotDisposed(),this._registry.has(e)||n&&(this.parent||!1)&&this.parent.isRegistered(e,!0)},t.prototype.reset=function(){this.ensureNotDisposed(),this._registry.clear(),this.interceptors.preResolution.clear(),this.interceptors.postResolution.clear()},t.prototype.clearInstances=function(){var e,n;this.ensureNotDisposed();try{for(var r=Ls(this._registry.entries()),i=r.next();!i.done;i=r.next()){var o=nc(i.value,2),a=o[0],l=o[1];this._registry.setAll(a,l.filter(function(u){return!na(u.provider)}).map(function(u){return u.instance=void 0,u}))}}catch(u){e={error:u}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}},t.prototype.createChildContainer=function(){var e,n;this.ensureNotDisposed();var r=new t(this);try{for(var i=Ls(this._registry.entries()),o=i.next();!o.done;o=i.next()){var a=nc(o.value,2),l=a[0],u=a[1];u.some(function(d){var p=d.options;return p.lifecycle===At.ContainerScoped})&&r._registry.setAll(l,u.map(function(d){return d.options.lifecycle===At.ContainerScoped?{provider:d.provider,options:d.options}:d}))}}catch(d){e={error:d}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return r},t.prototype.beforeResolution=function(e,n,r){r===void 0&&(r={frequency:"Always"}),this.interceptors.preResolution.set(e,{callback:n,options:r})},t.prototype.afterResolution=function(e,n,r){r===void 0&&(r={frequency:"Always"}),this.interceptors.postResolution.set(e,{callback:n,options:r})},t.prototype.dispose=function(){return T4(this,void 0,void 0,function(){var e;return I4(this,function(n){switch(n.label){case 0:return this.disposed=!0,e=[],this.disposables.forEach(function(r){var i=r.dispose();i&&e.push(i)}),[4,Promise.all(e)];case 1:return n.sent(),[2]}})})},t.prototype.getRegistration=function(e){return this.isRegistered(e)?this._registry.get(e):this.parent?this.parent.getRegistration(e):null},t.prototype.getAllRegistrations=function(e){return this.isRegistered(e)?this._registry.getAll(e):this.parent?this.parent.getAllRegistrations(e):null},t.prototype.construct=function(e,n){var r=this;if(e instanceof e1)return e.createProxy(function(o){return r.resolve(o,n)});var i=function(){var o=t1.get(e);if(!o||o.length===0){if(e.length===0)return new e;throw new Error('TypeInfo not known for "'+e.name+'"')}var a=o.map(r.resolveParams(n,e));return new(e.bind.apply(e,zr([void 0],a)))}();return U4(i)&&this.disposables.add(i),i},t.prototype.resolveParams=function(e,n){var r=this;return function(i,o){var a,l,u;try{return D4(i)?Gh(i)?i.multiple?(a=r.resolve(i.transform)).transform.apply(a,zr([r.resolveAll(i.token,new Fs,i.isOptional)],i.transformArgs)):(l=r.resolve(i.transform)).transform.apply(l,zr([r.resolve(i.token,e,i.isOptional)],i.transformArgs)):i.multiple?r.resolveAll(i.token,new Fs,i.isOptional):r.resolve(i.token,e,i.isOptional):Gh(i)?(u=r.resolve(i.transform,e)).transform.apply(u,zr([r.resolve(i.token,e)],i.transformArgs)):r.resolve(i,e)}catch(d){throw new Error(F4(n,o,d))}}},t.prototype.ensureNotDisposed=function(){if(this.disposed)throw new Error("This container has been disposed, you cannot interact with a disposed container")},t}(),ft=new H4;function hl(t){return function(e){t1.set(e,z4(e))}}if(typeof Reflect>"u"||!Reflect.getMetadata)throw new Error(`tsyringe requires a reflect polyfill. Please add 'import "reflect-metadata"' to the top of your entry point.`);var Ad;class gl{constructor(e={}){this.attrId="",this.attrValues=[],Object.assign(e)}}m([w({type:T.ObjectIdentifier})],gl.prototype,"attrId",void 0);m([w({type:T.Any,repeated:"set"})],gl.prototype,"attrValues",void 0);let Wh=Ad=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Ad.prototype)}};Wh=Ad=m([X({type:q.Sequence,itemType:gl})],Wh);var Ed;let Xh=Ed=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Ed.prototype)}};Xh=Ed=m([X({type:q.Sequence,itemType:no})],Xh);class n1{constructor(e={}){this.certId="",this.certValue=new ArrayBuffer(0),Object.assign(this,e)}}m([w({type:T.ObjectIdentifier})],n1.prototype,"certId",void 0);m([w({type:T.Any,context:0})],n1.prototype,"certValue",void 0);class r1{constructor(e={}){this.crlId="",this.crltValue=new ArrayBuffer(0),Object.assign(this,e)}}m([w({type:T.ObjectIdentifier})],r1.prototype,"crlId",void 0);m([w({type:T.Any,context:0})],r1.prototype,"crltValue",void 0);class i1 extends Ie{}let ml=class{constructor(e={}){this.encryptionAlgorithm=new ce,this.encryptedData=new i1,Object.assign(this,e)}};m([w({type:ce})],ml.prototype,"encryptionAlgorithm",void 0);m([w({type:i1})],ml.prototype,"encryptedData",void 0);var Sd,kd;(function(t){t[t.v1=0]="v1"})(kd||(kd={}));class o1 extends Ie{}let Nd=Sd=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Sd.prototype)}};Nd=Sd=m([X({type:q.Sequence,itemType:Vn})],Nd);class ms{constructor(e={}){this.version=kd.v1,this.privateKeyAlgorithm=new ce,this.privateKey=new o1,Object.assign(this,e)}}m([w({type:T.Integer})],ms.prototype,"version",void 0);m([w({type:ce})],ms.prototype,"privateKeyAlgorithm",void 0);m([w({type:o1})],ms.prototype,"privateKey",void 0);m([w({type:Nd,implicit:!0,context:0,optional:!0})],ms.prototype,"attributes",void 0);let Jh=class extends ms{};Jh=m([X({type:q.Sequence})],Jh);let Yh=class extends ml{};Yh=m([X({type:q.Sequence})],Yh);class s1{constructor(e={}){this.secretTypeId="",this.secretValue=new ArrayBuffer(0),Object.assign(this,e)}}m([w({type:T.ObjectIdentifier})],s1.prototype,"secretTypeId",void 0);m([w({type:T.Any,context:0})],s1.prototype,"secretValue",void 0);class _s{constructor(e={}){this.mac=new pl,this.macSalt=new Ie,this.iterations=1,Object.assign(this,e)}}m([w({type:pl})],_s.prototype,"mac",void 0);m([w({type:Ie})],_s.prototype,"macSalt",void 0);m([w({type:T.Integer,defaultValue:1})],_s.prototype,"iterations",void 0);class _l{constructor(e={}){this.version=3,this.authSafe=new no,this.macData=new _s,Object.assign(this,e)}}m([w({type:T.Integer})],_l.prototype,"version",void 0);m([w({type:no})],_l.prototype,"authSafe",void 0);m([w({type:_s,optional:!0})],_l.prototype,"macData",void 0);var Cd;class yl{constructor(e={}){this.bagId="",this.bagValue=new ArrayBuffer(0),Object.assign(this,e)}}m([w({type:T.ObjectIdentifier})],yl.prototype,"bagId",void 0);m([w({type:T.Any,context:0})],yl.prototype,"bagValue",void 0);m([w({type:gl,repeated:"set",optional:!0})],yl.prototype,"bagAttributes",void 0);let Zh=Cd=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Cd.prototype)}};Zh=Cd=m([X({type:q.Sequence,itemType:yl})],Zh);var Td,Id,Od;const a1="1.2.840.113549.1.9",c1=`${a1}.7`,uf=`${a1}.14`;let rc=class extends pt{constructor(e={}){super(e)}toString(){return this.ia5String||super.toString()}};m([w({type:T.IA5String})],rc.prototype,"ia5String",void 0);rc=m([X({type:q.Choice})],rc);let Qh=class extends no{};Qh=m([X({type:q.Sequence})],Qh);let e0=class extends _l{};e0=m([X({type:q.Sequence})],e0);let t0=class extends ml{};t0=m([X({type:q.Sequence})],t0);let zd=class{constructor(e=""){this.value=e}toString(){return this.value}};m([w({type:T.IA5String})],zd.prototype,"value",void 0);zd=m([X({type:q.Choice})],zd);let n0=class extends rc{};n0=m([X({type:q.Choice})],n0);let r0=class extends pt{};r0=m([X({type:q.Choice})],r0);let Dd=class{constructor(e=new Date){this.value=e}};m([w({type:T.GeneralizedTime})],Dd.prototype,"value",void 0);Dd=m([X({type:q.Choice})],Dd);let i0=class extends pt{};i0=m([X({type:q.Choice})],i0);let Rd=class{constructor(e="M"){this.value=e}toString(){return this.value}};m([w({type:T.PrintableString})],Rd.prototype,"value",void 0);Rd=m([X({type:q.Choice})],Rd);let ic=class{constructor(e=""){this.value=e}toString(){return this.value}};m([w({type:T.PrintableString})],ic.prototype,"value",void 0);ic=m([X({type:q.Choice})],ic);let o0=class extends ic{};o0=m([X({type:q.Choice})],o0);let s0=class extends pt{};s0=m([X({type:q.Choice})],s0);let Pd=class{constructor(e=""){this.value=e}toString(){return this.value}};m([w({type:T.ObjectIdentifier})],Pd.prototype,"value",void 0);Pd=m([X({type:q.Choice})],Pd);let a0=class extends lt{};a0=m([X({type:q.Choice})],a0);let Bd=class{constructor(e=0){this.value=e}toString(){return this.value.toString()}};m([w({type:T.Integer})],Bd.prototype,"value",void 0);Bd=m([X({type:q.Choice})],Bd);let c0=class extends zn{};c0=m([X({type:q.Sequence})],c0);let oc=class extends pt{};oc=m([X({type:q.Choice})],oc);let l0=Td=class extends wr{constructor(e){super(e),Object.setPrototypeOf(this,Td.prototype)}};l0=Td=m([X({type:q.Sequence})],l0);let u0=Id=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Id.prototype)}};u0=Id=m([X({type:q.Set,itemType:to})],u0);let jd=class{constructor(e=""){this.value=e}toString(){return this.value}};m([w({type:T.BmpString})],jd.prototype,"value",void 0);jd=m([X({type:q.Choice})],jd);let Ld=class extends ce{};Ld=m([X({type:q.Sequence})],Ld);let d0=Od=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Od.prototype)}};d0=Od=m([X({type:q.Sequence,itemType:Ld})],d0);var Fd;let sc=Fd=class extends De{constructor(e){super(e),Object.setPrototypeOf(this,Fd.prototype)}};sc=Fd=m([X({type:q.Sequence,itemType:Vn})],sc);class oo{constructor(e={}){this.version=0,this.subject=new Ye,this.subjectPKInfo=new sn,this.attributes=new sc,Object.assign(this,e)}}m([w({type:T.Integer})],oo.prototype,"version",void 0);m([w({type:Ye})],oo.prototype,"subject",void 0);m([w({type:sn})],oo.prototype,"subjectPKInfo",void 0);m([w({type:sc,implicit:!0,context:0})],oo.prototype,"attributes",void 0);class Fo{constructor(e={}){this.certificationRequestInfo=new oo,this.signatureAlgorithm=new ce,this.signature=new ArrayBuffer(0),Object.assign(this,e)}}m([w({type:oo})],Fo.prototype,"certificationRequestInfo",void 0);m([w({type:ce})],Fo.prototype,"signatureAlgorithm",void 0);m([w({type:T.BitString})],Fo.prototype,"signature",void 0);/*!
162
162
  * MIT License
163
163
  *
164
164
  * Copyright (c) Peculiar Ventures. All rights reserved.
@@ -182,29 +182,29 @@ PERFORMANCE OF THIS SOFTWARE.
182
182
  * SOFTWARE.
183
183
  *
184
184
  */const ys="crypto.algorithm";class K4{getAlgorithms(){return ft.resolveAll(ys)}toAsnAlgorithm(e){({...e});for(const n of this.getAlgorithms()){const r=n.toAsnAlgorithm(e);if(r)return r}if(/^[0-9.]+$/.test(e.name)){const n=new ce({algorithm:e.name});if("parameters"in e){const r=e;n.parameters=r.parameters}return n}throw new Error("Cannot convert WebCrypto algorithm to ASN.1 algorithm")}toWebAlgorithm(e){for(const r of this.getAlgorithms()){const i=r.toWebAlgorithm(e);if(i)return i}return{name:e.algorithm,parameters:e.parameters}}}const ei="crypto.algorithmProvider";ft.registerSingleton(ei,K4);var ra;const Ct="1.3.36.3.3.2.8.1.1",p0=`${Ct}.1`,f0=`${Ct}.2`,h0=`${Ct}.3`,g0=`${Ct}.4`,m0=`${Ct}.5`,_0=`${Ct}.6`,y0=`${Ct}.7`,w0=`${Ct}.8`,v0=`${Ct}.9`,b0=`${Ct}.10`,$0=`${Ct}.11`,x0=`${Ct}.12`,A0=`${Ct}.13`,E0=`${Ct}.14`,S0="brainpoolP160r1",k0="brainpoolP160t1",N0="brainpoolP192r1",C0="brainpoolP192t1",T0="brainpoolP224r1",I0="brainpoolP224t1",O0="brainpoolP256r1",z0="brainpoolP256t1",D0="brainpoolP320r1",R0="brainpoolP320t1",P0="brainpoolP384r1",B0="brainpoolP384t1",j0="brainpoolP512r1",L0="brainpoolP512t1",He="ECDSA";let Uo=ra=class{toAsnAlgorithm(e){switch(e.name.toLowerCase()){case He.toLowerCase():if("hash"in e)switch((typeof e.hash=="string"?e.hash:e.hash.name).toLowerCase()){case"sha-1":return m4;case"sha-256":return _4;case"sha-384":return y4;case"sha-512":return w4}else if("namedCurve"in e){let n="";switch(e.namedCurve){case"P-256":n=Vh;break;case"K-256":n=ra.SECP256K1;break;case"P-384":n=Hh;break;case"P-521":n=Kh;break;case S0:n=p0;break;case k0:n=f0;break;case N0:n=h0;break;case C0:n=g0;break;case T0:n=m0;break;case I0:n=_0;break;case O0:n=y0;break;case z0:n=w0;break;case D0:n=v0;break;case R0:n=b0;break;case P0:n=$0;break;case B0:n=x0;break;case j0:n=A0;break;case L0:n=E0;break}if(n)return new ce({algorithm:jo,parameters:te.serialize(new br({namedCurve:n}))})}}return null}toWebAlgorithm(e){switch(e.algorithm){case nf:return{name:He,hash:{name:"SHA-1"}};case rf:return{name:He,hash:{name:"SHA-256"}};case of:return{name:He,hash:{name:"SHA-384"}};case sf:return{name:He,hash:{name:"SHA-512"}};case jo:{if(!e.parameters)throw new TypeError("Cannot get required parameters from EC algorithm");switch(te.parse(e.parameters,br).namedCurve){case Vh:return{name:He,namedCurve:"P-256"};case ra.SECP256K1:return{name:He,namedCurve:"K-256"};case Hh:return{name:He,namedCurve:"P-384"};case Kh:return{name:He,namedCurve:"P-521"};case p0:return{name:He,namedCurve:S0};case f0:return{name:He,namedCurve:k0};case h0:return{name:He,namedCurve:N0};case g0:return{name:He,namedCurve:C0};case m0:return{name:He,namedCurve:T0};case _0:return{name:He,namedCurve:I0};case y0:return{name:He,namedCurve:O0};case w0:return{name:He,namedCurve:z0};case v0:return{name:He,namedCurve:D0};case b0:return{name:He,namedCurve:R0};case $0:return{name:He,namedCurve:P0};case x0:return{name:He,namedCurve:B0};case A0:return{name:He,namedCurve:j0};case E0:return{name:He,namedCurve:L0}}}}return null}};Uo.SECP256K1="1.3.132.0.10";Uo=ra=m([hl()],Uo);ft.registerSingleton(ys,Uo);const l1=Symbol("name"),u1=Symbol("value");class ze{constructor(e,n={},r=""){this[l1]=e,this[u1]=r;for(const i in n)this[i]=n[i]}}ze.NAME=l1;ze.VALUE=u1;class G4{static toTextObject(e){const n=new ze("Algorithm Identifier",{},kr.toString(e.algorithm));if(e.parameters)switch(e.algorithm){case jo:{const r=new Uo().toWebAlgorithm(e);r&&"namedCurve"in r?n["Named Curve"]=r.namedCurve:n.Parameters=e.parameters;break}default:n.Parameters=e.parameters}return n}}class kr{static toString(e){const n=this.items[e];return n||e}}kr.items={[Za]:"sha1",[J2]:"sha224",[Qa]:"sha256",[ec]:"sha384",[tc]:"sha512",[Yr]:"rsaEncryption",[Xa]:"sha1WithRSAEncryption",[E4]:"sha224WithRSAEncryption",[yd]:"sha256WithRSAEncryption",[Ja]:"sha384WithRSAEncryption",[Ya]:"sha512WithRSAEncryption",[jo]:"ecPublicKey",[nf]:"ecdsaWithSHA1",[G2]:"ecdsaWithSHA224",[rf]:"ecdsaWithSHA256",[of]:"ecdsaWithSHA384",[sf]:"ecdsaWithSHA512",[l4]:"TLS WWW server authentication",[u4]:"TLS WWW client authentication",[d4]:"Code Signing",[p4]:"E-mail Protection",[f4]:"Time Stamping",[h4]:"OCSP Signing",[g4]:"Signed Data"};class ti{static serialize(e){return this.serializeObj(e).join(`
185
- `)}static pad(e=0){return"".padStart(2*e," ")}static serializeObj(e,n=0){const r=[];let i=this.pad(n++),o="";const a=e[ze.VALUE];a&&(o=` ${a}`),r.push(`${i}${e[ze.NAME]}:${o}`),i=this.pad(n);for(const l in e){if(typeof l=="symbol")continue;const u=e[l],d=l?`${l}: `:"";if(typeof u=="string"||typeof u=="number"||typeof u=="boolean")r.push(`${i}${d}${u}`);else if(u instanceof Date)r.push(`${i}${d}${u.toUTCString()}`);else if(Array.isArray(u))for(const p of u)p[ze.NAME]=l,r.push(...this.serializeObj(p,n));else if(u instanceof ze)u[ze.NAME]=l,r.push(...this.serializeObj(u,n));else if(ne.isBufferSource(u))l?(r.push(`${i}${d}`),r.push(...this.serializeBufferSource(u,n+1))):r.push(...this.serializeBufferSource(u,n));else if("toTextObject"in u){const p=u.toTextObject();p[ze.NAME]=l,r.push(...this.serializeObj(p,n))}else throw new TypeError("Cannot serialize data in text format. Unsupported type.")}return r}static serializeBufferSource(e,n=0){const r=this.pad(n),i=ne.toUint8Array(e),o=[];for(let a=0;a<i.length;){const l=[];for(let u=0;u<16&&a<i.length;u++){u===8&&l.push("");const d=i[a++].toString(16).padStart(2,"0");l.push(d)}o.push(`${r}${l.join(" ")}`)}return o}static serializeAlgorithm(e){return this.algorithmSerializer.toTextObject(e)}}ti.oidSerializer=kr;ti.algorithmSerializer=G4;class Nr{constructor(...e){if(e.length===1){const n=e[0];this.rawData=te.serialize(n),this.onInit(n)}else{const n=te.parse(e[0],e[1]);this.rawData=ne.toArrayBuffer(e[0]),this.onInit(n)}}equal(e){return e instanceof Nr?O_(e.rawData,this.rawData):!1}toString(e="text"){switch(e){case"asn":return te.toString(this.rawData);case"text":return ti.serialize(this.toTextObject());case"hex":return fe.ToHex(this.rawData);case"base64":return fe.ToBase64(this.rawData);case"base64url":return fe.ToBase64Url(this.rawData);default:throw TypeError("Argument 'format' is unsupported value")}}getTextName(){return this.constructor.NAME}toTextObject(){const e=this.toTextObjectEmpty();return e[""]=this.rawData,e}toTextObjectEmpty(e){return new ze(this.getTextName(),{},e)}}Nr.NAME="ASN";class qt extends Nr{constructor(...e){let n;ne.isBufferSource(e[0])?n=ne.toArrayBuffer(e[0]):n=te.serialize(new Yt({extnID:e[0],critical:e[1],extnValue:new Ie(ne.toArrayBuffer(e[2]))})),super(n,Yt)}onInit(e){this.type=e.extnID,this.critical=e.critical,this.value=e.extnValue.buffer}toTextObject(){const e=this.toTextObjectWithoutValue();return e[""]=this.value,e}toTextObjectWithoutValue(){const e=this.toTextObjectEmpty(this.critical?"critical":void 0);return e[ze.NAME]===qt.NAME&&(e[ze.NAME]=kr.toString(this.type)),e}}var d1;class fr{static isCryptoKeyPair(e){return e&&e.privateKey&&e.publicKey}static isCryptoKey(e){return e&&e.usages&&e.type&&e.algorithm&&e.extractable!==void 0}constructor(){this.items=new Map,this[d1]="CryptoProvider",typeof self<"u"&&typeof crypto<"u"?this.set(fr.DEFAULT,crypto):typeof global<"u"&&global.crypto&&global.crypto.subtle&&this.set(fr.DEFAULT,global.crypto)}clear(){this.items.clear()}delete(e){return this.items.delete(e)}forEach(e,n){return this.items.forEach(e,n)}has(e){return this.items.has(e)}get size(){return this.items.size}entries(){return this.items.entries()}keys(){return this.items.keys()}values(){return this.items.values()}[Symbol.iterator](){return this.items[Symbol.iterator]()}get(e=fr.DEFAULT){const n=this.items.get(e.toLowerCase());if(!n)throw new Error(`Cannot get Crypto by name '${e}'`);return n}set(e,n){if(typeof e=="string"){if(!n)throw new TypeError("Argument 'value' is required");this.items.set(e.toLowerCase(),n)}else this.items.set(fr.DEFAULT,e);return this}}d1=Symbol.toStringTag;fr.DEFAULT="default";const lt=new fr,W4=/^[0-2](?:\.[1-9][0-9]*)+$/;function X4(t){return new RegExp(W4).test(t)}class p1{constructor(e={}){this.items={};for(const n in e)this.register(n,e[n])}get(e){return this.items[e]||null}findId(e){return X4(e)?e:this.get(e)}register(e,n){this.items[e]=n,this.items[n]=e}}const kt=new p1;kt.register("CN","2.5.4.3");kt.register("L","2.5.4.7");kt.register("ST","2.5.4.8");kt.register("O","2.5.4.10");kt.register("OU","2.5.4.11");kt.register("C","2.5.4.6");kt.register("DC","0.9.2342.19200300.100.1.25");kt.register("E","1.2.840.113549.1.9.1");kt.register("G","2.5.4.42");kt.register("I","2.5.4.43");kt.register("SN","2.5.4.4");kt.register("T","2.5.4.12");function J4(t,e){return`\\${fe.ToHex(fe.FromUtf8String(e)).toUpperCase()}`}function Y4(t){return t.replace(/([,+"\\<>;])/g,"\\$1").replace(/^([ #])/,"\\$1").replace(/([ ]$)/,"\\$1").replace(/([\r\n\t])/,J4)}class Xt{static isASCII(e){for(let n=0;n<e.length;n++)if(e.charCodeAt(n)>255)return!1;return!0}static isPrintableString(e){return/^[A-Za-z0-9 '()+,-./:=?]*$/g.test(e)}constructor(e,n={}){this.extraNames=new p1,this.asn=new Ze;for(const r in n)if(Object.prototype.hasOwnProperty.call(n,r)){const i=n[r];this.extraNames.register(r,i)}typeof e=="string"?this.asn=this.fromString(e):e instanceof Ze?this.asn=e:ne.isBufferSource(e)?this.asn=te.parse(e,Ze):this.asn=this.fromJSON(e)}getField(e){const n=this.extraNames.findId(e)||kt.findId(e),r=[];for(const i of this.asn)for(const o of i)o.type===n&&r.push(o.value.toString());return r}getName(e){return this.extraNames.get(e)||kt.get(e)}toString(){return this.asn.map(e=>e.map(n=>{const r=this.getName(n.type)||n.type,i=n.value.anyValue?`#${fe.ToHex(n.value.anyValue)}`:Y4(n.value.toString());return`${r}=${i}`}).join("+")).join(", ")}toJSON(){var e;const n=[];for(const r of this.asn){const i={};for(const o of r){const a=this.getName(o.type)||o.type;(e=i[a])!==null&&e!==void 0||(i[a]=[]),i[a].push(o.value.anyValue?`#${fe.ToHex(o.value.anyValue)}`:o.value.toString())}n.push(i)}return n}fromString(e){const n=new Ze,r=/(\d\.[\d.]*\d|[A-Za-z]+)=((?:"")|(?:".*?[^\\]")|(?:[^,+"\\](?=[,+]|$))|(?:[^,+].*?(?:[^\\][,+]))|(?:))([,+])?/g;let i=null,o=",";for(;i=r.exec(`${e},`);){let[,a,l]=i;const u=l[l.length-1];(u===","||u==="+")&&(l=l.slice(0,l.length-1),i[3]=u);const d=i[3];a=this.getTypeOid(a);const p=this.createAttribute(a,l);o==="+"?n[n.length-1].push(p):n.push(new zi([p])),o=d}return n}fromJSON(e){const n=new Ze;for(const r of e){const i=new zi;for(const o in r){const a=this.getTypeOid(o),l=r[o];for(const u of l){const d=this.createAttribute(a,u);i.push(d)}}n.push(i)}return n}getTypeOid(e){if(/[\d.]+/.test(e)||(e=this.getName(e)||""),!e)throw new Error(`Cannot get OID for name type '${e}'`);return e}createAttribute(e,n){const r=new Wc({type:e});if(typeof n=="object")for(const i in n)switch(i){case"ia5String":r.value.ia5String=n[i];break;case"utf8String":r.value.utf8String=n[i];break;case"universalString":r.value.universalString=n[i];break;case"bmpString":r.value.bmpString=n[i];break;case"printableString":r.value.printableString=n[i];break}else if(n[0]==="#")r.value.anyValue=fe.FromHex(n.slice(1));else{const i=this.processStringValue(n);e===this.getName("E")||e===this.getName("DC")?r.value.ia5String=i:Xt.isPrintableString(i)?r.value.printableString=i:r.value.utf8String=i}return r}processStringValue(e){const n=/"(.*?[^\\])?"/.exec(e);return n&&(e=n[1]),e.replace(/\\0a/ig,`
186
- `).replace(/\\0d/ig,"\r").replace(/\\0g/ig," ").replace(/\\(.)/g,"$1")}toArrayBuffer(){return te.serialize(this.asn)}async getThumbprint(...e){var n;let r,i="SHA-1";return e.length>=1&&!(!((n=e[0])===null||n===void 0)&&n.subtle)?(i=e[0]||i,r=e[1]||lt.get()):r=e[0]||lt.get(),await r.subtle.digest(i,this.toArrayBuffer())}}const f1="Cannot initialize GeneralName from ASN.1 data.",F0=`${f1} Unsupported string format in use.`,Z4=`${f1} Value doesn't match to GUID regular expression.`,U0=/^([0-9a-f]{8})-?([0-9a-f]{4})-?([0-9a-f]{4})-?([0-9a-f]{4})-?([0-9a-f]{12})$/i,M0="1.3.6.1.4.1.311.25.1",q0="1.3.6.1.4.1.311.20.2.3",ql="dns",Vl="dn",Hl="email",Kl="ip",Gl="url",Wl="guid",Xl="upn",Us="id";class hr extends Nr{constructor(...e){let n;if(e.length===2)switch(e[0]){case Vl:{const r=new Xt(e[1]).toArrayBuffer(),i=te.parse(r,Ze);n=new ke({directoryName:i});break}case ql:n=new ke({dNSName:e[1]});break;case Hl:n=new ke({rfc822Name:e[1]});break;case Wl:{const r=new RegExp(U0,"i").exec(e[1]);if(!r)throw new Error("Cannot parse GUID value. Value doesn't match to regular expression");const i=r.slice(1).map((o,a)=>a<3?fe.ToHex(new Uint8Array(fe.FromHex(o)).reverse()):o).join("");n=new ke({otherName:new Do({typeId:M0,value:te.serialize(new Ie(fe.FromHex(i)))})});break}case Kl:n=new ke({iPAddress:e[1]});break;case Us:n=new ke({registeredID:e[1]});break;case Xl:{n=new ke({otherName:new Do({typeId:q0,value:te.serialize(C2.toASN(e[1]))})});break}case Gl:n=new ke({uniformResourceIdentifier:e[1]});break;default:throw new Error("Cannot create GeneralName. Unsupported type of the name")}else ne.isBufferSource(e[0])?n=te.parse(e[0],ke):n=e[0];super(n)}onInit(e){if(e.dNSName!=null)this.type=ql,this.value=e.dNSName;else if(e.rfc822Name!=null)this.type=Hl,this.value=e.rfc822Name;else if(e.iPAddress!=null)this.type=Kl,this.value=e.iPAddress;else if(e.uniformResourceIdentifier!=null)this.type=Gl,this.value=e.uniformResourceIdentifier;else if(e.registeredID!=null)this.type=Us,this.value=e.registeredID;else if(e.directoryName!=null)this.type=Vl,this.value=new Xt(e.directoryName).toString();else if(e.otherName!=null)if(e.otherName.typeId===M0){this.type=Wl;const n=te.parse(e.otherName.value,Ie),r=new RegExp(U0,"i").exec(fe.ToHex(n));if(!r)throw new Error(Z4);this.value=r.slice(1).map((i,o)=>o<3?fe.ToHex(new Uint8Array(fe.FromHex(i)).reverse()):i).join("-")}else if(e.otherName.typeId===q0)this.type=Xl,this.value=te.parse(e.otherName.value,pt).toString();else throw new Error(F0);else throw new Error(F0)}toJSON(){return{type:this.type,value:this.value}}toTextObject(){let e;switch(this.type){case Vl:case ql:case Wl:case Kl:case Us:case Xl:case Gl:e=this.type.toUpperCase();break;case Hl:e="Email";break;default:throw new Error("Unsupported GeneralName type")}let n=this.value;return this.type===Us&&(n=kr.toString(n)),new ze(e,void 0,n)}}class ni extends Nr{constructor(e){let n;if(e instanceof gt)n=e;else if(Array.isArray(e)){const r=[];for(const i of e)if(i instanceof ke)r.push(i);else{const o=te.parse(new hr(i.type,i.value).rawData,ke);r.push(o)}n=new gt(r)}else if(ne.isBufferSource(e))n=te.parse(e,gt);else throw new Error("Cannot initialize GeneralNames. Incorrect incoming arguments");super(n)}onInit(e){const n=[];for(const r of e){let i=null;try{i=new hr(r)}catch{continue}n.push(i)}this.items=n}toJSON(){return this.items.map(e=>e.toJSON())}toTextObject(){const e=super.toTextObjectEmpty();for(const n of this.items){const r=n.toTextObject();let i=e[r[ze.NAME]];Array.isArray(i)||(i=[],e[r[ze.NAME]]=i),i.push(r)}return e}}ni.NAME="GeneralNames";const ko="-{5}",Mo="\\n",Q4=`[^${Mo}]+`,e$=`${ko}BEGIN (${Q4}(?=${ko}))${ko}`,t$=`${ko}END \\1${ko}`,Ui="\\n",n$=`[^:${Mo}]+`,r$=`(?:[^${Mo}]+${Ui}(?: +[^${Mo}]+${Ui})*)`,i$="[a-zA-Z0-9=+/]+",o$=`(?:${i$}${Ui})+`,V0=`${e$}${Ui}(?:((?:${n$}: ${r$})+))?${Ui}?(${o$})${t$}`;class jt{static isPem(e){return typeof e=="string"&&new RegExp(V0,"g").test(e.replace(/\r/g,""))}static decodeWithHeaders(e){e=e.replace(/\r/g,"");const n=new RegExp(V0,"g"),r=[];let i=null;for(;i=n.exec(e);){const o=i[3].replace(new RegExp(`[${Mo}]+`,"g"),""),a={type:i[1],headers:[],rawData:fe.FromBase64(o)},l=i[2];if(l){const u=l.split(new RegExp(Ui,"g"));let d=null;for(const p of u){const[h,g]=p.split(/:(.*)/);if(g===void 0){if(!d)throw new Error("Cannot parse PEM string. Incorrect header value");d.value+=h.trim()}else d&&a.headers.push(d),d={key:h,value:g.trim()}}d&&a.headers.push(d)}r.push(a)}return r}static decode(e){return this.decodeWithHeaders(e).map(r=>r.rawData)}static decodeFirst(e){const n=this.decode(e);if(!n.length)throw new RangeError("PEM string doesn't contain any objects");return n[0]}static encode(e,n){if(Array.isArray(e)){const r=new Array;return n?e.forEach(i=>{if(!ne.isBufferSource(i))throw new TypeError("Cannot encode array of BufferSource in PEM format. Not all items of the array are BufferSource");r.push(this.encodeStruct({type:n,rawData:ne.toArrayBuffer(i)}))}):e.forEach(i=>{if(!("type"in i))throw new TypeError("Cannot encode array of PemStruct in PEM format. Not all items of the array are PemStrut");r.push(this.encodeStruct(i))}),r.join(`
185
+ `)}static pad(e=0){return"".padStart(2*e," ")}static serializeObj(e,n=0){const r=[];let i=this.pad(n++),o="";const a=e[ze.VALUE];a&&(o=` ${a}`),r.push(`${i}${e[ze.NAME]}:${o}`),i=this.pad(n);for(const l in e){if(typeof l=="symbol")continue;const u=e[l],d=l?`${l}: `:"";if(typeof u=="string"||typeof u=="number"||typeof u=="boolean")r.push(`${i}${d}${u}`);else if(u instanceof Date)r.push(`${i}${d}${u.toUTCString()}`);else if(Array.isArray(u))for(const p of u)p[ze.NAME]=l,r.push(...this.serializeObj(p,n));else if(u instanceof ze)u[ze.NAME]=l,r.push(...this.serializeObj(u,n));else if(ne.isBufferSource(u))l?(r.push(`${i}${d}`),r.push(...this.serializeBufferSource(u,n+1))):r.push(...this.serializeBufferSource(u,n));else if("toTextObject"in u){const p=u.toTextObject();p[ze.NAME]=l,r.push(...this.serializeObj(p,n))}else throw new TypeError("Cannot serialize data in text format. Unsupported type.")}return r}static serializeBufferSource(e,n=0){const r=this.pad(n),i=ne.toUint8Array(e),o=[];for(let a=0;a<i.length;){const l=[];for(let u=0;u<16&&a<i.length;u++){u===8&&l.push("");const d=i[a++].toString(16).padStart(2,"0");l.push(d)}o.push(`${r}${l.join(" ")}`)}return o}static serializeAlgorithm(e){return this.algorithmSerializer.toTextObject(e)}}ti.oidSerializer=kr;ti.algorithmSerializer=G4;class Nr{constructor(...e){if(e.length===1){const n=e[0];this.rawData=te.serialize(n),this.onInit(n)}else{const n=te.parse(e[0],e[1]);this.rawData=ne.toArrayBuffer(e[0]),this.onInit(n)}}equal(e){return e instanceof Nr?O_(e.rawData,this.rawData):!1}toString(e="text"){switch(e){case"asn":return te.toString(this.rawData);case"text":return ti.serialize(this.toTextObject());case"hex":return fe.ToHex(this.rawData);case"base64":return fe.ToBase64(this.rawData);case"base64url":return fe.ToBase64Url(this.rawData);default:throw TypeError("Argument 'format' is unsupported value")}}getTextName(){return this.constructor.NAME}toTextObject(){const e=this.toTextObjectEmpty();return e[""]=this.rawData,e}toTextObjectEmpty(e){return new ze(this.getTextName(),{},e)}}Nr.NAME="ASN";class qt extends Nr{constructor(...e){let n;ne.isBufferSource(e[0])?n=ne.toArrayBuffer(e[0]):n=te.serialize(new Yt({extnID:e[0],critical:e[1],extnValue:new Ie(ne.toArrayBuffer(e[2]))})),super(n,Yt)}onInit(e){this.type=e.extnID,this.critical=e.critical,this.value=e.extnValue.buffer}toTextObject(){const e=this.toTextObjectWithoutValue();return e[""]=this.value,e}toTextObjectWithoutValue(){const e=this.toTextObjectEmpty(this.critical?"critical":void 0);return e[ze.NAME]===qt.NAME&&(e[ze.NAME]=kr.toString(this.type)),e}}var d1;class fr{static isCryptoKeyPair(e){return e&&e.privateKey&&e.publicKey}static isCryptoKey(e){return e&&e.usages&&e.type&&e.algorithm&&e.extractable!==void 0}constructor(){this.items=new Map,this[d1]="CryptoProvider",typeof self<"u"&&typeof crypto<"u"?this.set(fr.DEFAULT,crypto):typeof global<"u"&&global.crypto&&global.crypto.subtle&&this.set(fr.DEFAULT,global.crypto)}clear(){this.items.clear()}delete(e){return this.items.delete(e)}forEach(e,n){return this.items.forEach(e,n)}has(e){return this.items.has(e)}get size(){return this.items.size}entries(){return this.items.entries()}keys(){return this.items.keys()}values(){return this.items.values()}[Symbol.iterator](){return this.items[Symbol.iterator]()}get(e=fr.DEFAULT){const n=this.items.get(e.toLowerCase());if(!n)throw new Error(`Cannot get Crypto by name '${e}'`);return n}set(e,n){if(typeof e=="string"){if(!n)throw new TypeError("Argument 'value' is required");this.items.set(e.toLowerCase(),n)}else this.items.set(fr.DEFAULT,e);return this}}d1=Symbol.toStringTag;fr.DEFAULT="default";const ct=new fr,W4=/^[0-2](?:\.[1-9][0-9]*)+$/;function X4(t){return new RegExp(W4).test(t)}class p1{constructor(e={}){this.items={};for(const n in e)this.register(n,e[n])}get(e){return this.items[e]||null}findId(e){return X4(e)?e:this.get(e)}register(e,n){this.items[e]=n,this.items[n]=e}}const kt=new p1;kt.register("CN","2.5.4.3");kt.register("L","2.5.4.7");kt.register("ST","2.5.4.8");kt.register("O","2.5.4.10");kt.register("OU","2.5.4.11");kt.register("C","2.5.4.6");kt.register("DC","0.9.2342.19200300.100.1.25");kt.register("E","1.2.840.113549.1.9.1");kt.register("G","2.5.4.42");kt.register("I","2.5.4.43");kt.register("SN","2.5.4.4");kt.register("T","2.5.4.12");function J4(t,e){return`\\${fe.ToHex(fe.FromUtf8String(e)).toUpperCase()}`}function Y4(t){return t.replace(/([,+"\\<>;])/g,"\\$1").replace(/^([ #])/,"\\$1").replace(/([ ]$)/,"\\$1").replace(/([\r\n\t])/,J4)}class Xt{static isASCII(e){for(let n=0;n<e.length;n++)if(e.charCodeAt(n)>255)return!1;return!0}static isPrintableString(e){return/^[A-Za-z0-9 '()+,-./:=?]*$/g.test(e)}constructor(e,n={}){this.extraNames=new p1,this.asn=new Ye;for(const r in n)if(Object.prototype.hasOwnProperty.call(n,r)){const i=n[r];this.extraNames.register(r,i)}typeof e=="string"?this.asn=this.fromString(e):e instanceof Ye?this.asn=e:ne.isBufferSource(e)?this.asn=te.parse(e,Ye):this.asn=this.fromJSON(e)}getField(e){const n=this.extraNames.findId(e)||kt.findId(e),r=[];for(const i of this.asn)for(const o of i)o.type===n&&r.push(o.value.toString());return r}getName(e){return this.extraNames.get(e)||kt.get(e)}toString(){return this.asn.map(e=>e.map(n=>{const r=this.getName(n.type)||n.type,i=n.value.anyValue?`#${fe.ToHex(n.value.anyValue)}`:Y4(n.value.toString());return`${r}=${i}`}).join("+")).join(", ")}toJSON(){var e;const n=[];for(const r of this.asn){const i={};for(const o of r){const a=this.getName(o.type)||o.type;(e=i[a])!==null&&e!==void 0||(i[a]=[]),i[a].push(o.value.anyValue?`#${fe.ToHex(o.value.anyValue)}`:o.value.toString())}n.push(i)}return n}fromString(e){const n=new Ye,r=/(\d\.[\d.]*\d|[A-Za-z]+)=((?:"")|(?:".*?[^\\]")|(?:[^,+"\\](?=[,+]|$))|(?:[^,+].*?(?:[^\\][,+]))|(?:))([,+])?/g;let i=null,o=",";for(;i=r.exec(`${e},`);){let[,a,l]=i;const u=l[l.length-1];(u===","||u==="+")&&(l=l.slice(0,l.length-1),i[3]=u);const d=i[3];a=this.getTypeOid(a);const p=this.createAttribute(a,l);o==="+"?n[n.length-1].push(p):n.push(new zi([p])),o=d}return n}fromJSON(e){const n=new Ye;for(const r of e){const i=new zi;for(const o in r){const a=this.getTypeOid(o),l=r[o];for(const u of l){const d=this.createAttribute(a,u);i.push(d)}}n.push(i)}return n}getTypeOid(e){if(/[\d.]+/.test(e)||(e=this.getName(e)||""),!e)throw new Error(`Cannot get OID for name type '${e}'`);return e}createAttribute(e,n){const r=new Wc({type:e});if(typeof n=="object")for(const i in n)switch(i){case"ia5String":r.value.ia5String=n[i];break;case"utf8String":r.value.utf8String=n[i];break;case"universalString":r.value.universalString=n[i];break;case"bmpString":r.value.bmpString=n[i];break;case"printableString":r.value.printableString=n[i];break}else if(n[0]==="#")r.value.anyValue=fe.FromHex(n.slice(1));else{const i=this.processStringValue(n);e===this.getName("E")||e===this.getName("DC")?r.value.ia5String=i:Xt.isPrintableString(i)?r.value.printableString=i:r.value.utf8String=i}return r}processStringValue(e){const n=/"(.*?[^\\])?"/.exec(e);return n&&(e=n[1]),e.replace(/\\0a/ig,`
186
+ `).replace(/\\0d/ig,"\r").replace(/\\0g/ig," ").replace(/\\(.)/g,"$1")}toArrayBuffer(){return te.serialize(this.asn)}async getThumbprint(...e){var n;let r,i="SHA-1";return e.length>=1&&!(!((n=e[0])===null||n===void 0)&&n.subtle)?(i=e[0]||i,r=e[1]||ct.get()):r=e[0]||ct.get(),await r.subtle.digest(i,this.toArrayBuffer())}}const f1="Cannot initialize GeneralName from ASN.1 data.",F0=`${f1} Unsupported string format in use.`,Z4=`${f1} Value doesn't match to GUID regular expression.`,U0=/^([0-9a-f]{8})-?([0-9a-f]{4})-?([0-9a-f]{4})-?([0-9a-f]{4})-?([0-9a-f]{12})$/i,M0="1.3.6.1.4.1.311.25.1",q0="1.3.6.1.4.1.311.20.2.3",ql="dns",Vl="dn",Hl="email",Kl="ip",Gl="url",Wl="guid",Xl="upn",Us="id";class hr extends Nr{constructor(...e){let n;if(e.length===2)switch(e[0]){case Vl:{const r=new Xt(e[1]).toArrayBuffer(),i=te.parse(r,Ye);n=new ke({directoryName:i});break}case ql:n=new ke({dNSName:e[1]});break;case Hl:n=new ke({rfc822Name:e[1]});break;case Wl:{const r=new RegExp(U0,"i").exec(e[1]);if(!r)throw new Error("Cannot parse GUID value. Value doesn't match to regular expression");const i=r.slice(1).map((o,a)=>a<3?fe.ToHex(new Uint8Array(fe.FromHex(o)).reverse()):o).join("");n=new ke({otherName:new Do({typeId:M0,value:te.serialize(new Ie(fe.FromHex(i)))})});break}case Kl:n=new ke({iPAddress:e[1]});break;case Us:n=new ke({registeredID:e[1]});break;case Xl:{n=new ke({otherName:new Do({typeId:q0,value:te.serialize(C2.toASN(e[1]))})});break}case Gl:n=new ke({uniformResourceIdentifier:e[1]});break;default:throw new Error("Cannot create GeneralName. Unsupported type of the name")}else ne.isBufferSource(e[0])?n=te.parse(e[0],ke):n=e[0];super(n)}onInit(e){if(e.dNSName!=null)this.type=ql,this.value=e.dNSName;else if(e.rfc822Name!=null)this.type=Hl,this.value=e.rfc822Name;else if(e.iPAddress!=null)this.type=Kl,this.value=e.iPAddress;else if(e.uniformResourceIdentifier!=null)this.type=Gl,this.value=e.uniformResourceIdentifier;else if(e.registeredID!=null)this.type=Us,this.value=e.registeredID;else if(e.directoryName!=null)this.type=Vl,this.value=new Xt(e.directoryName).toString();else if(e.otherName!=null)if(e.otherName.typeId===M0){this.type=Wl;const n=te.parse(e.otherName.value,Ie),r=new RegExp(U0,"i").exec(fe.ToHex(n));if(!r)throw new Error(Z4);this.value=r.slice(1).map((i,o)=>o<3?fe.ToHex(new Uint8Array(fe.FromHex(i)).reverse()):i).join("-")}else if(e.otherName.typeId===q0)this.type=Xl,this.value=te.parse(e.otherName.value,pt).toString();else throw new Error(F0);else throw new Error(F0)}toJSON(){return{type:this.type,value:this.value}}toTextObject(){let e;switch(this.type){case Vl:case ql:case Wl:case Kl:case Us:case Xl:case Gl:e=this.type.toUpperCase();break;case Hl:e="Email";break;default:throw new Error("Unsupported GeneralName type")}let n=this.value;return this.type===Us&&(n=kr.toString(n)),new ze(e,void 0,n)}}class ni extends Nr{constructor(e){let n;if(e instanceof gt)n=e;else if(Array.isArray(e)){const r=[];for(const i of e)if(i instanceof ke)r.push(i);else{const o=te.parse(new hr(i.type,i.value).rawData,ke);r.push(o)}n=new gt(r)}else if(ne.isBufferSource(e))n=te.parse(e,gt);else throw new Error("Cannot initialize GeneralNames. Incorrect incoming arguments");super(n)}onInit(e){const n=[];for(const r of e){let i=null;try{i=new hr(r)}catch{continue}n.push(i)}this.items=n}toJSON(){return this.items.map(e=>e.toJSON())}toTextObject(){const e=super.toTextObjectEmpty();for(const n of this.items){const r=n.toTextObject();let i=e[r[ze.NAME]];Array.isArray(i)||(i=[],e[r[ze.NAME]]=i),i.push(r)}return e}}ni.NAME="GeneralNames";const ko="-{5}",Mo="\\n",Q4=`[^${Mo}]+`,e$=`${ko}BEGIN (${Q4}(?=${ko}))${ko}`,t$=`${ko}END \\1${ko}`,Ui="\\n",n$=`[^:${Mo}]+`,r$=`(?:[^${Mo}]+${Ui}(?: +[^${Mo}]+${Ui})*)`,i$="[a-zA-Z0-9=+/]+",o$=`(?:${i$}${Ui})+`,V0=`${e$}${Ui}(?:((?:${n$}: ${r$})+))?${Ui}?(${o$})${t$}`;class jt{static isPem(e){return typeof e=="string"&&new RegExp(V0,"g").test(e.replace(/\r/g,""))}static decodeWithHeaders(e){e=e.replace(/\r/g,"");const n=new RegExp(V0,"g"),r=[];let i=null;for(;i=n.exec(e);){const o=i[3].replace(new RegExp(`[${Mo}]+`,"g"),""),a={type:i[1],headers:[],rawData:fe.FromBase64(o)},l=i[2];if(l){const u=l.split(new RegExp(Ui,"g"));let d=null;for(const p of u){const[h,g]=p.split(/:(.*)/);if(g===void 0){if(!d)throw new Error("Cannot parse PEM string. Incorrect header value");d.value+=h.trim()}else d&&a.headers.push(d),d={key:h,value:g.trim()}}d&&a.headers.push(d)}r.push(a)}return r}static decode(e){return this.decodeWithHeaders(e).map(r=>r.rawData)}static decodeFirst(e){const n=this.decode(e);if(!n.length)throw new RangeError("PEM string doesn't contain any objects");return n[0]}static encode(e,n){if(Array.isArray(e)){const r=new Array;return n?e.forEach(i=>{if(!ne.isBufferSource(i))throw new TypeError("Cannot encode array of BufferSource in PEM format. Not all items of the array are BufferSource");r.push(this.encodeStruct({type:n,rawData:ne.toArrayBuffer(i)}))}):e.forEach(i=>{if(!("type"in i))throw new TypeError("Cannot encode array of PemStruct in PEM format. Not all items of the array are PemStrut");r.push(this.encodeStruct(i))}),r.join(`
187
187
  `)}else{if(!n)throw new Error("Required argument 'tag' is missed");return this.encodeStruct({type:n,rawData:ne.toArrayBuffer(e)})}}static encodeStruct(e){var n;const r=e.type.toLocaleUpperCase(),i=[];if(i.push(`-----BEGIN ${r}-----`),!((n=e.headers)===null||n===void 0)&&n.length){for(const d of e.headers)i.push(`${d.key}: ${d.value}`);i.push("")}const o=fe.ToBase64(e.rawData);let a,l=0;const u=Array();for(;l<o.length&&(o.length-l<64?a=o.substring(l):(a=o.substring(l,l+64),l+=64),a.length!==0);)if(u.push(a),a.length<64)break;return i.push(...u),i.push(`-----END ${r}-----`),i.join(`
188
- `)}}jt.CertificateTag="CERTIFICATE";jt.CrlTag="CRL";jt.CertificateRequestTag="CERTIFICATE REQUEST";jt.PublicKeyTag="PUBLIC KEY";jt.PrivateKeyTag="PRIVATE KEY";class Gn extends Nr{static isAsnEncoded(e){return ne.isBufferSource(e)||typeof e=="string"}static toArrayBuffer(e){if(typeof e=="string"){if(jt.isPem(e))return jt.decode(e)[0];if(fe.isHex(e))return fe.FromHex(e);if(fe.isBase64(e))return fe.FromBase64(e);if(fe.isBase64Url(e))return fe.FromBase64Url(e);throw new TypeError("Unsupported format of 'raw' argument. Must be one of DER, PEM, HEX, Base64, or Base4Url")}else{const n=fe.ToBinary(e);return jt.isPem(n)?jt.decode(n)[0]:fe.isHex(n)?fe.FromHex(n):fe.isBase64(n)?fe.FromBase64(n):fe.isBase64Url(n)?fe.FromBase64Url(n):ne.toArrayBuffer(e)}}constructor(...e){Gn.isAsnEncoded(e[0])?super(Gn.toArrayBuffer(e[0]),e[1]):super(e[0])}toString(e="pem"){switch(e){case"pem":return jt.encode(this.rawData,this.tag);default:return super.toString(e)}}}class cn extends Gn{static async create(e,n=lt.get()){if(e instanceof cn)return e;if(fr.isCryptoKey(e)){if(e.type!=="public")throw new TypeError("Public key is required");const r=await n.subtle.exportKey("spki",e);return new cn(r)}else{if(e.publicKey)return e.publicKey;if(ne.isBufferSource(e))return new cn(e);throw new TypeError("Unsupported PublicKeyType")}}constructor(e){Gn.isAsnEncoded(e)?super(e,sn):super(e),this.tag=jt.PublicKeyTag}async export(...e){let n,r=["verify"],i={hash:"SHA-256",...this.algorithm};e.length>1?(i=e[0]||i,r=e[1]||r,n=e[2]||lt.get()):n=e[0]||lt.get();let o=this.rawData;const a=te.parse(this.rawData,sn);return a.algorithm.algorithm===So&&(o=s$(a,o)),n.subtle.importKey("spki",o,i,!0,r)}onInit(e){const n=ft.resolve(ei),r=this.algorithm=n.toWebAlgorithm(e.algorithm);switch(e.algorithm.algorithm){case Yr:{const i=te.parse(e.subjectPublicKey,af),o=ne.toUint8Array(i.modulus);r.publicExponent=ne.toUint8Array(i.publicExponent),r.modulusLength=(o[0]?o:o.slice(1)).byteLength<<3;break}}}async getThumbprint(...e){var n;let r,i="SHA-1";return e.length>=1&&!(!((n=e[0])===null||n===void 0)&&n.subtle)?(i=e[0]||i,r=e[1]||lt.get()):r=e[0]||lt.get(),await r.subtle.digest(i,this.rawData)}async getKeyIdentifier(...e){let n,r="SHA-1";e.length===1?typeof e[0]=="string"?(r=e[0],n=lt.get()):n=e[0]:e.length===2?(r=e[0],n=e[1]):n=lt.get();const i=te.parse(this.rawData,sn);return await n.subtle.digest(r,i.subjectPublicKey)}toTextObject(){const e=this.toTextObjectEmpty(),n=te.parse(this.rawData,sn);switch(e.Algorithm=ti.serializeAlgorithm(n.algorithm),n.algorithm.algorithm){case jo:e["EC Point"]=n.subjectPublicKey;break;case Yr:default:e["Raw Data"]=n.subjectPublicKey}return e}}function s$(t,e){return t.algorithm=new ce({algorithm:Yr,parameters:null}),e=te.serialize(t),e}class qo extends qt{static async create(e,n=!1,r=lt.get()){if("name"in e&&"serialNumber"in e)return new qo(e,n);const o=await(await cn.create(e,r)).getKeyIdentifier(r);return new qo(fe.ToHex(o),n)}constructor(...e){if(ne.isBufferSource(e[0]))super(e[0]);else if(typeof e[0]=="string"){const n=new Lr({keyIdentifier:new Up(fe.FromHex(e[0]))});super(Pu,e[1],te.serialize(n))}else{const n=e[0],r=n.name instanceof ni?te.parse(n.name.rawData,gt):n.name,i=new Lr({authorityCertIssuer:r,authorityCertSerialNumber:fe.FromHex(n.serialNumber)});super(Pu,e[1],te.serialize(i))}}onInit(e){super.onInit(e);const n=te.parse(e.extnValue,Lr);n.keyIdentifier&&(this.keyId=fe.ToHex(n.keyIdentifier)),(n.authorityCertIssuer||n.authorityCertSerialNumber)&&(this.certId={name:n.authorityCertIssuer||[],serialNumber:n.authorityCertSerialNumber?fe.ToHex(n.authorityCertSerialNumber):""})}toTextObject(){const e=this.toTextObjectWithoutValue(),n=te.parse(this.value,Lr);return n.authorityCertIssuer&&(e["Authority Issuer"]=new ni(n.authorityCertIssuer).toTextObject()),n.authorityCertSerialNumber&&(e["Authority Serial Number"]=n.authorityCertSerialNumber),n.keyIdentifier&&(e[""]=n.keyIdentifier),e}}qo.NAME="Authority Key Identifier";class df extends qt{constructor(...e){if(ne.isBufferSource(e[0])){super(e[0]);const n=te.parse(this.value,Ia);this.ca=n.cA,this.pathLength=n.pathLenConstraint}else{const n=new Ia({cA:e[0],pathLenConstraint:e[1]});super(I2,e[2],te.serialize(n)),this.ca=e[0],this.pathLength=e[1]}}toTextObject(){const e=this.toTextObjectWithoutValue();return this.ca&&(e.CA=this.ca),this.pathLength!==void 0&&(e["Path Length"]=this.pathLength),e}}df.NAME="Basic Constraints";var H0;(function(t){t.serverAuth="1.3.6.1.5.5.7.3.1",t.clientAuth="1.3.6.1.5.5.7.3.2",t.codeSigning="1.3.6.1.5.5.7.3.3",t.emailProtection="1.3.6.1.5.5.7.3.4",t.timeStamping="1.3.6.1.5.5.7.3.8",t.ocspSigning="1.3.6.1.5.5.7.3.9"})(H0||(H0={}));class pf extends qt{constructor(...e){if(ne.isBufferSource(e[0])){super(e[0]);const n=te.parse(this.value,Ra);this.usages=n.map(r=>r)}else{const n=new Ra(e[0]);super(D2,e[1],te.serialize(n)),this.usages=e[0]}}toTextObject(){const e=this.toTextObjectWithoutValue();return e[""]=this.usages.map(n=>kr.toString(n)).join(", "),e}}pf.NAME="Extended Key Usages";var ac;(function(t){t[t.digitalSignature=1]="digitalSignature",t[t.nonRepudiation=2]="nonRepudiation",t[t.keyEncipherment=4]="keyEncipherment",t[t.dataEncipherment=8]="dataEncipherment",t[t.keyAgreement=16]="keyAgreement",t[t.keyCertSign=32]="keyCertSign",t[t.cRLSign=64]="cRLSign",t[t.encipherOnly=128]="encipherOnly",t[t.decipherOnly=256]="decipherOnly"})(ac||(ac={}));class ff extends qt{constructor(...e){if(ne.isBufferSource(e[0])){super(e[0]);const n=te.parse(this.value,Ml);this.usages=n.toNumber()}else{const n=new Ml(e[0]);super(P2,e[1],te.serialize(n)),this.usages=e[0]}}toTextObject(){const e=this.toTextObjectWithoutValue(),n=te.parse(this.value,Ml);return e[""]=n.toJSON().join(", "),e}}ff.NAME="Key Usages";class ws extends qt{static async create(e,n=!1,r=lt.get()){const o=await(await cn.create(e,r)).getKeyIdentifier(r);return new ws(fe.ToHex(o),n)}constructor(...e){if(ne.isBufferSource(e[0])){super(e[0]);const n=te.parse(this.value,mr);this.keyId=fe.ToHex(n)}else{const n=typeof e[0]=="string"?fe.FromHex(e[0]):e[0],r=new mr(n);super(F2,e[1],te.serialize(r)),this.keyId=fe.ToHex(n)}}toTextObject(){const e=this.toTextObjectWithoutValue(),n=te.parse(this.value,mr);return e[""]=n,e}}ws.NAME="Subject Key Identifier";class h1 extends qt{constructor(...e){ne.isBufferSource(e[0])?super(e[0]):super(L2,e[1],new ni(e[0]||[]).rawData)}onInit(e){super.onInit(e);const n=te.parse(e.extnValue,Yu);this.names=new ni(n)}toTextObject(){const e=this.toTextObjectWithoutValue(),n=this.names.toTextObject();for(const r in n)e[r]=n[r];return e}}h1.NAME="Subject Alternative Name";class Vt{static register(e,n){this.items.set(e,n)}static create(e){const n=new qt(e),r=this.items.get(n.type);return r?new r(e):n}}Vt.items=new Map;class g1 extends qt{constructor(...e){var n;if(ne.isBufferSource(e[0])){super(e[0]);const r=te.parse(this.value,za);this.policies=r.map(i=>i.policyIdentifier)}else{const r=e[0],i=(n=e[1])!==null&&n!==void 0?n:!1,o=new za(r.map(a=>new Jc({policyIdentifier:a})));super(O2,i,te.serialize(o)),this.policies=r}}toTextObject(){const e=this.toTextObjectWithoutValue();return e.Policy=this.policies.map(n=>new ze("",{},kr.toString(n))),e}}g1.NAME="Certificate Policies";Vt.register(O2,g1);class m1 extends qt{constructor(...e){var n;if(ne.isBufferSource(e[0]))super(e[0]);else if(Array.isArray(e[0])&&typeof e[0][0]=="string"){const i=e[0].map(a=>new Qi({distributionPoint:new Gr({fullName:[new ke({uniformResourceIdentifier:a})]})})),o=new Ni(i);super(Uu,e[1],te.serialize(o))}else{const r=new Ni(e[0]);super(Uu,e[1],te.serialize(r))}(n=this.distributionPoints)!==null&&n!==void 0||(this.distributionPoints=[])}onInit(e){super.onInit(e);const n=te.parse(e.extnValue,Ni);this.distributionPoints=n}toTextObject(){const e=this.toTextObjectWithoutValue();return e["Distribution Point"]=this.distributionPoints.map(n=>{var r;const i={};return n.distributionPoint&&(i[""]=(r=n.distributionPoint.fullName)===null||r===void 0?void 0:r.map(o=>new hr(o).toString()).join(", ")),n.reasons&&(i.Reasons=n.reasons.toString()),n.cRLIssuer&&(i["CRL Issuer"]=n.cRLIssuer.map(o=>o.toString()).join(", ")),i}),e}}m1.NAME="CRL Distribution Points";class _1 extends qt{constructor(...e){var n,r,i,o;if(ne.isBufferSource(e[0]))super(e[0]);else if(e[0]instanceof xi){const a=new xi(e[0]);super(Ru,e[1],te.serialize(a))}else{const a=e[0],l=new xi;qs(l,a,Ch,"ocsp"),qs(l,a,Th,"caIssuers"),qs(l,a,Ih,"timeStamping"),qs(l,a,Oh,"caRepository"),super(Ru,e[1],te.serialize(l))}(n=this.ocsp)!==null&&n!==void 0||(this.ocsp=[]),(r=this.caIssuers)!==null&&r!==void 0||(this.caIssuers=[]),(i=this.timeStamping)!==null&&i!==void 0||(this.timeStamping=[]),(o=this.caRepository)!==null&&o!==void 0||(this.caRepository=[])}onInit(e){super.onInit(e),this.ocsp=[],this.caIssuers=[],this.timeStamping=[],this.caRepository=[],te.parse(e.extnValue,xi).forEach(r=>{switch(r.accessMethod){case Ch:this.ocsp.push(new hr(r.accessLocation));break;case Th:this.caIssuers.push(new hr(r.accessLocation));break;case Ih:this.timeStamping.push(new hr(r.accessLocation));break;case Oh:this.caRepository.push(new hr(r.accessLocation));break}})}toTextObject(){const e=this.toTextObjectWithoutValue();return this.ocsp.length&&Ms(e,"OCSP",this.ocsp),this.caIssuers.length&&Ms(e,"CA Issuers",this.caIssuers),this.timeStamping.length&&Ms(e,"Time Stamping",this.timeStamping),this.caRepository.length&&Ms(e,"CA Repository",this.caRepository),e}}_1.NAME="Authority Info Access";function Ms(t,e,n){if(n.length===1)t[e]=n[0].toTextObject();else{const r=new ze("");n.forEach((i,o)=>{const a=i.toTextObject(),l=`${a[ze.NAME]} ${o+1}`;let u=r[l];Array.isArray(u)||(u=[],r[l]=u),u.push(a)}),t[e]=r}}function qs(t,e,n,r){const i=e[r];i&&(Array.isArray(i)?i:[i]).forEach(a=>{typeof a=="string"&&(a=new hr("url",a)),t.push(new ss({accessMethod:n,accessLocation:te.parse(a.rawData,ke)}))})}class y1 extends qt{constructor(...e){ne.isBufferSource(e[0])?super(e[0]):super(R2,e[1],new ni(e[0]||[]).rawData)}onInit(e){super.onInit(e);const n=te.parse(e.extnValue,gt);this.names=new ni(n)}toTextObject(){const e=this.toTextObjectWithoutValue(),n=this.names.toTextObject();for(const r in n)e[r]=n[r];return e}}y1.NAME="Issuer Alternative Name";class so extends Nr{constructor(...e){let n;if(ne.isBufferSource(e[0]))n=ne.toArrayBuffer(e[0]);else{const r=e[0],i=Array.isArray(e[1])?e[1].map(o=>ne.toArrayBuffer(o)):[];n=te.serialize(new Vn({type:r,values:i}))}super(n,Vn)}onInit(e){this.type=e.type,this.values=e.values}toTextObject(){const e=this.toTextObjectWithoutValue();return e.Value=this.values.map(n=>new ze("",{"":n})),e}toTextObjectWithoutValue(){const e=this.toTextObjectEmpty();return e[ze.NAME]===so.NAME&&(e[ze.NAME]=kr.toString(this.type)),e}}so.NAME="Attribute";class w1 extends so{constructor(...e){var n;if(ne.isBufferSource(e[0]))super(e[0]);else{const r=new oc({printableString:e[0]});super(c1,[te.serialize(r)])}(n=this.password)!==null&&n!==void 0||(this.password="")}onInit(e){if(super.onInit(e),this.values[0]){const n=te.parse(this.values[0],oc);this.password=n.toString()}}toTextObject(){const e=this.toTextObjectWithoutValue();return e[ze.VALUE]=this.password,e}}w1.NAME="Challenge Password";class hf extends so{constructor(...e){var n;if(ne.isBufferSource(e[0]))super(e[0]);else{const r=e[0],i=new wr;for(const o of r)i.push(te.parse(o.rawData,Yt));super(uf,[te.serialize(i)])}(n=this.items)!==null&&n!==void 0||(this.items=[])}onInit(e){if(super.onInit(e),this.values[0]){const n=te.parse(this.values[0],wr);this.items=n.map(r=>Vt.create(te.serialize(r)))}}toTextObject(){const e=this.toTextObjectWithoutValue(),n=this.items.map(r=>r.toTextObject());for(const r of n)e[r[ze.NAME]]=r;return e}}hf.NAME="Extensions";class wl{static register(e,n){this.items.set(e,n)}static create(e){const n=new so(e),r=this.items.get(n.type);return r?new r(e):n}}wl.items=new Map;const vs="crypto.signatureFormatter";class a${toAsnSignature(e,n){return ne.toArrayBuffer(n)}toWebSignature(e,n){return ne.toArrayBuffer(n)}}var ia;let Ud=ia=class{static createPssParams(e,n){const r=ia.getHashAlgorithm(e);return r?new Qr({hashAlgorithm:r,maskGenAlgorithm:new ce({algorithm:ul,parameters:te.serialize(r)}),saltLength:n}):null}static getHashAlgorithm(e){const n=ft.resolve(ei);return typeof e=="string"?n.toAsnAlgorithm({name:e}):typeof e=="object"&&e&&"name"in e?n.toAsnAlgorithm(e):null}toAsnAlgorithm(e){switch(e.name.toLowerCase()){case"rsassa-pkcs1-v1_5":if("hash"in e){let n;if(typeof e.hash=="string")n=e.hash;else if(e.hash&&typeof e.hash=="object"&&"name"in e.hash&&typeof e.hash.name=="string")n=e.hash.name.toUpperCase();else throw new Error("Cannot get hash algorithm name");switch(n.toLowerCase()){case"sha-1":return new ce({algorithm:Xa,parameters:null});case"sha-256":return new ce({algorithm:yd,parameters:null});case"sha-384":return new ce({algorithm:Ja,parameters:null});case"sha-512":return new ce({algorithm:Ya,parameters:null})}}else return new ce({algorithm:Yr,parameters:null});break;case"rsa-pss":if("hash"in e){if(!("saltLength"in e&&typeof e.saltLength=="number"))throw new Error("Cannot get 'saltLength' from 'alg' argument");const n=ia.createPssParams(e.hash,e.saltLength);if(!n)throw new Error("Cannot create PSS parameters");return new ce({algorithm:So,parameters:te.serialize(n)})}else return new ce({algorithm:So,parameters:null})}return null}toWebAlgorithm(e){switch(e.algorithm){case Yr:return{name:"RSASSA-PKCS1-v1_5"};case Xa:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-1"}};case yd:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case Ja:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-384"}};case Ya:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-512"}};case So:if(e.parameters){const n=te.parse(e.parameters,Qr);return{name:"RSA-PSS",hash:ft.resolve(ei).toWebAlgorithm(n.hashAlgorithm),saltLength:n.saltLength}}else return{name:"RSA-PSS"}}return null}};Ud=ia=m([hl()],Ud);ft.registerSingleton(ys,Ud);let Md=class{toAsnAlgorithm(e){switch(e.name.toLowerCase()){case"sha-1":return new ce({algorithm:Za});case"sha-256":return new ce({algorithm:Qa});case"sha-384":return new ce({algorithm:ec});case"sha-512":return new ce({algorithm:tc})}return null}toWebAlgorithm(e){switch(e.algorithm){case Za:return{name:"SHA-1"};case Qa:return{name:"SHA-256"};case ec:return{name:"SHA-384"};case tc:return{name:"SHA-512"}}return null}};Md=m([hl()],Md);ft.registerSingleton(ys,Md);class Jt{addPadding(e,n){const r=ne.toUint8Array(n),i=new Uint8Array(e);return i.set(r,e-r.length),i}removePadding(e,n=!1){let r=ne.toUint8Array(e);for(let i=0;i<r.length;i++)if(r[i]){r=r.slice(i);break}if(n&&r[0]>127){const i=new Uint8Array(r.length+1);return i.set(r,1),i.buffer}return r.buffer}toAsnSignature(e,n){if(e.name==="ECDSA"){const r=e.namedCurve,i=Jt.namedCurveSize.get(r)||Jt.defaultNamedCurveSize,o=new Wa,a=ne.toUint8Array(n);return o.r=this.removePadding(a.slice(0,i),!0),o.s=this.removePadding(a.slice(i,i+i),!0),te.serialize(o)}return null}toWebSignature(e,n){if(e.name==="ECDSA"){const r=te.parse(n,Wa),i=e.namedCurve,o=Jt.namedCurveSize.get(i)||Jt.defaultNamedCurveSize,a=this.addPadding(o,this.removePadding(r.r)),l=this.addPadding(o,this.removePadding(r.s));return v3(a,l)}return null}}Jt.namedCurveSize=new Map;Jt.defaultNamedCurveSize=32;const Jl="1.3.101.110",K0="1.3.101.111",Yl="1.3.101.112",G0="1.3.101.113";let qd=class{toAsnAlgorithm(e){let n=null;switch(e.name.toLowerCase()){case"ed25519":n=Yl;break;case"x25519":n=Jl;break;case"eddsa":switch(e.namedCurve.toLowerCase()){case"ed25519":n=Yl;break;case"ed448":n=G0;break}break;case"ecdh-es":switch(e.namedCurve.toLowerCase()){case"x25519":n=Jl;break;case"x448":n=K0;break}}return n?new ce({algorithm:n}):null}toWebAlgorithm(e){switch(e.algorithm){case Yl:return{name:"Ed25519"};case G0:return{name:"EdDSA",namedCurve:"Ed448"};case Jl:return{name:"X25519"};case K0:return{name:"ECDH-ES",namedCurve:"X448"}}return null}};qd=m([hl()],qd);ft.registerSingleton(ys,qd);class c$ extends Gn{constructor(e){Gn.isAsnEncoded(e)?super(e,Fo):super(e),this.tag=jt.CertificateRequestTag}onInit(e){this.tbs=te.serialize(e.certificationRequestInfo),this.publicKey=new cn(e.certificationRequestInfo.subjectPKInfo);const n=ft.resolve(ei);this.signatureAlgorithm=n.toWebAlgorithm(e.signatureAlgorithm),this.signature=e.signature,this.attributes=e.certificationRequestInfo.attributes.map(i=>wl.create(te.serialize(i)));const r=this.getAttribute(uf);this.extensions=[],r instanceof hf&&(this.extensions=r.items),this.subjectName=new Xt(e.certificationRequestInfo.subject),this.subject=this.subjectName.toString()}getAttribute(e){for(const n of this.attributes)if(n.type===e)return n;return null}getAttributes(e){return this.attributes.filter(n=>n.type===e)}getExtension(e){for(const n of this.extensions)if(n.type===e)return n;return null}getExtensions(e){return this.extensions.filter(n=>n.type===e)}async verify(e=lt.get()){const n={...this.publicKey.algorithm,...this.signatureAlgorithm},r=await this.publicKey.export(n,["verify"],e),i=ft.resolveAll(vs).reverse();let o=null;for(const l of i)if(o=l.toWebSignature(n,this.signature),o)break;if(!o)throw Error("Cannot convert WebCrypto signature value to ASN.1 format");return await e.subtle.verify(this.signatureAlgorithm,r,o,this.tbs)}toTextObject(){const e=this.toTextObjectEmpty(),n=te.parse(this.rawData,Fo),r=n.certificationRequestInfo,i=new ze("",{Version:`${Wr[r.version]} (${r.version})`,Subject:this.subject,"Subject Public Key Info":this.publicKey});if(this.attributes.length){const o=new ze("");for(const a of this.attributes){const l=a.toTextObject();o[l[ze.NAME]]=l}i.Attributes=o}return e.Data=i,e.Signature=new ze("",{Algorithm:ti.serializeAlgorithm(n.signatureAlgorithm),"":n.signature}),e}}c$.NAME="PKCS#10 Certificate Request";class vl extends Gn{constructor(e){Gn.isAsnEncoded(e)?super(e,Xr):super(e),this.tag=jt.CertificateTag}onInit(e){const n=e.tbsCertificate;this.tbs=te.serialize(n);let r=new Uint8Array(n.serialNumber);r.length>1&&r[0]===0&&r[1]>127&&(r=r.slice(1)),this.serialNumber=fe.ToHex(r),this.subjectName=new Xt(n.subject),this.subject=new Xt(n.subject).toString(),this.issuerName=new Xt(n.issuer),this.issuer=this.issuerName.toString();const i=ft.resolve(ei);this.signatureAlgorithm=i.toWebAlgorithm(e.signatureAlgorithm),this.signature=e.signatureValue;const o=n.validity.notBefore.utcTime||n.validity.notBefore.generalTime;if(!o)throw new Error("Cannot get 'notBefore' value");this.notBefore=o;const a=n.validity.notAfter.utcTime||n.validity.notAfter.generalTime;if(!a)throw new Error("Cannot get 'notAfter' value");this.notAfter=a,this.extensions=[],n.extensions&&(this.extensions=n.extensions.map(l=>Vt.create(te.serialize(l)))),this.publicKey=new cn(n.subjectPublicKeyInfo)}getExtension(e){for(const n of this.extensions)if(typeof e=="string"){if(n.type===e)return n}else if(n instanceof e)return n;return null}getExtensions(e){return this.extensions.filter(n=>typeof e=="string"?n.type===e:n instanceof e)}async verify(e={},n=lt.get()){let r,i;const o=e.publicKey;try{if(!o)r={...this.publicKey.algorithm,...this.signatureAlgorithm},i=await this.publicKey.export(r,["verify"],n);else if("publicKey"in o)r={...o.publicKey.algorithm,...this.signatureAlgorithm},i=await o.publicKey.export(r,["verify"],n);else if(o instanceof cn)r={...o.algorithm,...this.signatureAlgorithm},i=await o.export(r,["verify"],n);else if(ne.isBufferSource(o)){const d=new cn(o);r={...d.algorithm,...this.signatureAlgorithm},i=await d.export(r,["verify"],n)}else r={...o.algorithm,...this.signatureAlgorithm},i=o}catch{return!1}const a=ft.resolveAll(vs).reverse();let l=null;for(const d of a)if(l=d.toWebSignature(r,this.signature),l)break;if(!l)throw Error("Cannot convert ASN.1 signature value to WebCrypto format");const u=await n.subtle.verify(this.signatureAlgorithm,i,l,this.tbs);if(e.signatureOnly)return u;{const p=(e.date||new Date).getTime();return u&&this.notBefore.getTime()<p&&p<this.notAfter.getTime()}}async getThumbprint(...e){let n,r="SHA-1";return e[0]&&(e[0].subtle?n=e[0]:(r=e[0]||r,n=e[1])),n??(n=lt.get()),await n.subtle.digest(r,this.rawData)}async isSelfSigned(e=lt.get()){return this.subject===this.issuer&&await this.verify({signatureOnly:!0},e)}toTextObject(){const e=this.toTextObjectEmpty(),n=te.parse(this.rawData,Xr),r=n.tbsCertificate,i=new ze("",{Version:`${Wr[r.version]} (${r.version})`,"Serial Number":r.serialNumber,"Signature Algorithm":ti.serializeAlgorithm(r.signature),Issuer:this.issuer,Validity:new ze("",{"Not Before":r.validity.notBefore.getTime(),"Not After":r.validity.notAfter.getTime()}),Subject:this.subject,"Subject Public Key Info":this.publicKey});if(r.issuerUniqueID&&(i["Issuer Unique ID"]=r.issuerUniqueID),r.subjectUniqueID&&(i["Subject Unique ID"]=r.subjectUniqueID),this.extensions.length){const o=new ze("");for(const a of this.extensions){const l=a.toTextObject();o[l[ze.NAME]]=l}i.Extensions=o}return e.Data=i,e.Signature=new ze("",{Algorithm:ti.serializeAlgorithm(n.signatureAlgorithm),"":n.signatureValue}),e}}vl.NAME="Certificate";class l${static async createSelfSigned(e,n=lt.get()){if(!e.keys.privateKey)throw new Error("Bad field 'keys' in 'params' argument. 'privateKey' is empty");if(!e.keys.publicKey)throw new Error("Bad field 'keys' in 'params' argument. 'publicKey' is empty");return this.create({serialNumber:e.serialNumber,subject:e.name,issuer:e.name,notBefore:e.notBefore,notAfter:e.notAfter,publicKey:e.keys.publicKey,signingKey:e.keys.privateKey,signingAlgorithm:e.signingAlgorithm,extensions:e.extensions},n)}static async create(e,n=lt.get()){var r;let i;e.publicKey instanceof cn?i=e.publicKey.rawData:"publicKey"in e.publicKey?i=e.publicKey.publicKey.rawData:ne.isBufferSource(e.publicKey)?i=e.publicKey:i=await n.subtle.exportKey("spki",e.publicKey);let o=e.serialNumber?ne.toUint8Array(fe.FromHex(e.serialNumber)):void 0;o=this.generateSerialNumber(o,n);const a=e.notBefore||new Date,l=e.notAfter||new Date(a.getTime()+31536e6),u=new Xr({tbsCertificate:new Mt({version:Wr.v3,serialNumber:o,validity:new as({notBefore:a,notAfter:l}),extensions:new wr(((r=e.extensions)===null||r===void 0?void 0:r.map(D=>te.parse(D.rawData,Yt)))||[]),subjectPublicKeyInfo:te.parse(i,sn)})});if(e.subject){const D=e.subject instanceof Xt?e.subject:new Xt(e.subject);u.tbsCertificate.subject=te.parse(D.toArrayBuffer(),Ze)}if(e.issuer){const D=e.issuer instanceof Xt?e.issuer:new Xt(e.issuer);u.tbsCertificate.issuer=te.parse(D.toArrayBuffer(),Ze)}const d={hash:"SHA-256"},p="signingKey"in e?{...d,...e.signingAlgorithm,...e.signingKey.algorithm}:{...d,...e.signingAlgorithm},h=ft.resolve(ei);u.tbsCertificate.signature=u.signatureAlgorithm=h.toAsnAlgorithm(p);const g=te.serialize(u.tbsCertificate),A="signingKey"in e?await n.subtle.sign(p,e.signingKey,g):e.signature,$=ft.resolveAll(vs).reverse();let N=null;for(const D of $)if(N=D.toAsnSignature(p,A),N)break;if(!N)throw Error("Cannot convert ASN.1 signature value to WebCrypto format");return u.signatureValue=N,new vl(te.serialize(u))}static generateSerialNumber(e,n){let r=e&&e.length&&e.some(o=>o>0)?new Uint8Array(e):void 0;r||(r=n.getRandomValues(new Uint8Array(16)));let i=0;for(;i<r.length-1&&r[i]===0;)i++;if(r=r.slice(i),r[0]>127){const o=new Uint8Array(r.length+1);o[0]=0,o.set(r,1),r=o}return r}}var W0;(function(t){t[t.unspecified=0]="unspecified",t[t.keyCompromise=1]="keyCompromise",t[t.cACompromise=2]="cACompromise",t[t.affiliationChanged=3]="affiliationChanged",t[t.superseded=4]="superseded",t[t.cessationOfOperation=5]="cessationOfOperation",t[t.certificateHold=6]="certificateHold",t[t.removeFromCRL=8]="removeFromCRL",t[t.privilegeWithdrawn=9]="privilegeWithdrawn",t[t.aACompromise=10]="aACompromise"})(W0||(W0={}));Vt.register(I2,df);Vt.register(D2,pf);Vt.register(P2,ff);Vt.register(F2,ws);Vt.register(Pu,qo);Vt.register(L2,h1);Vt.register(Uu,m1);Vt.register(Ru,_1);Vt.register(R2,y1);wl.register(c1,w1);wl.register(uf,hf);ft.registerSingleton(vs,a$);ft.registerSingleton(vs,Jt);Jt.namedCurveSize.set("P-256",32);Jt.namedCurveSize.set("K-256",32);Jt.namedCurveSize.set("P-384",48);Jt.namedCurveSize.set("P-521",66);async function Vd(t){const e={name:"RSASSA-PKCS1-v1_5",hash:"SHA-256",publicExponent:new Uint8Array([1,0,1]),modulusLength:2048},n=await crypto.subtle.generateKey(e,!0,["sign","verify"]),r=Ve(),i=$u(new TextEncoder().encode(r)),o=await l$.createSelfSigned({serialNumber:i,name:t.name,notBefore:new Date,notAfter:new Date(Date.now()+365*24*60*60*1e3),signingAlgorithm:e,keys:n,extensions:[new df(!0,2,!0),new pf(["1.3.6.1.5.5.7.3.1"],!0),new ff(ac.keyCertSign|ac.cRLSign,!0),await ws.create(n.publicKey)]}),a=await crypto.subtle.exportKey("pkcs8",n.privateKey),l=o.toString("pem"),u=await d$(o),d=$u(await o.getThumbprint()),p=u$("PRIVATE",a);return{kid:o.serialNumber,cert:l,thumbprint:d,fingerprint:u,pkcs7:p,type:"jwt_signing"}}function u$(t,e){const n=__.encode(new Uint8Array(e));let r=`-----BEGIN ${t} KEY-----\r
188
+ `)}}jt.CertificateTag="CERTIFICATE";jt.CrlTag="CRL";jt.CertificateRequestTag="CERTIFICATE REQUEST";jt.PublicKeyTag="PUBLIC KEY";jt.PrivateKeyTag="PRIVATE KEY";class Gn extends Nr{static isAsnEncoded(e){return ne.isBufferSource(e)||typeof e=="string"}static toArrayBuffer(e){if(typeof e=="string"){if(jt.isPem(e))return jt.decode(e)[0];if(fe.isHex(e))return fe.FromHex(e);if(fe.isBase64(e))return fe.FromBase64(e);if(fe.isBase64Url(e))return fe.FromBase64Url(e);throw new TypeError("Unsupported format of 'raw' argument. Must be one of DER, PEM, HEX, Base64, or Base4Url")}else{const n=fe.ToBinary(e);return jt.isPem(n)?jt.decode(n)[0]:fe.isHex(n)?fe.FromHex(n):fe.isBase64(n)?fe.FromBase64(n):fe.isBase64Url(n)?fe.FromBase64Url(n):ne.toArrayBuffer(e)}}constructor(...e){Gn.isAsnEncoded(e[0])?super(Gn.toArrayBuffer(e[0]),e[1]):super(e[0])}toString(e="pem"){switch(e){case"pem":return jt.encode(this.rawData,this.tag);default:return super.toString(e)}}}class cn extends Gn{static async create(e,n=ct.get()){if(e instanceof cn)return e;if(fr.isCryptoKey(e)){if(e.type!=="public")throw new TypeError("Public key is required");const r=await n.subtle.exportKey("spki",e);return new cn(r)}else{if(e.publicKey)return e.publicKey;if(ne.isBufferSource(e))return new cn(e);throw new TypeError("Unsupported PublicKeyType")}}constructor(e){Gn.isAsnEncoded(e)?super(e,sn):super(e),this.tag=jt.PublicKeyTag}async export(...e){let n,r=["verify"],i={hash:"SHA-256",...this.algorithm};e.length>1?(i=e[0]||i,r=e[1]||r,n=e[2]||ct.get()):n=e[0]||ct.get();let o=this.rawData;const a=te.parse(this.rawData,sn);return a.algorithm.algorithm===So&&(o=s$(a,o)),n.subtle.importKey("spki",o,i,!0,r)}onInit(e){const n=ft.resolve(ei),r=this.algorithm=n.toWebAlgorithm(e.algorithm);switch(e.algorithm.algorithm){case Yr:{const i=te.parse(e.subjectPublicKey,af),o=ne.toUint8Array(i.modulus);r.publicExponent=ne.toUint8Array(i.publicExponent),r.modulusLength=(o[0]?o:o.slice(1)).byteLength<<3;break}}}async getThumbprint(...e){var n;let r,i="SHA-1";return e.length>=1&&!(!((n=e[0])===null||n===void 0)&&n.subtle)?(i=e[0]||i,r=e[1]||ct.get()):r=e[0]||ct.get(),await r.subtle.digest(i,this.rawData)}async getKeyIdentifier(...e){let n,r="SHA-1";e.length===1?typeof e[0]=="string"?(r=e[0],n=ct.get()):n=e[0]:e.length===2?(r=e[0],n=e[1]):n=ct.get();const i=te.parse(this.rawData,sn);return await n.subtle.digest(r,i.subjectPublicKey)}toTextObject(){const e=this.toTextObjectEmpty(),n=te.parse(this.rawData,sn);switch(e.Algorithm=ti.serializeAlgorithm(n.algorithm),n.algorithm.algorithm){case jo:e["EC Point"]=n.subjectPublicKey;break;case Yr:default:e["Raw Data"]=n.subjectPublicKey}return e}}function s$(t,e){return t.algorithm=new ce({algorithm:Yr,parameters:null}),e=te.serialize(t),e}class qo extends qt{static async create(e,n=!1,r=ct.get()){if("name"in e&&"serialNumber"in e)return new qo(e,n);const o=await(await cn.create(e,r)).getKeyIdentifier(r);return new qo(fe.ToHex(o),n)}constructor(...e){if(ne.isBufferSource(e[0]))super(e[0]);else if(typeof e[0]=="string"){const n=new Lr({keyIdentifier:new Up(fe.FromHex(e[0]))});super(Pu,e[1],te.serialize(n))}else{const n=e[0],r=n.name instanceof ni?te.parse(n.name.rawData,gt):n.name,i=new Lr({authorityCertIssuer:r,authorityCertSerialNumber:fe.FromHex(n.serialNumber)});super(Pu,e[1],te.serialize(i))}}onInit(e){super.onInit(e);const n=te.parse(e.extnValue,Lr);n.keyIdentifier&&(this.keyId=fe.ToHex(n.keyIdentifier)),(n.authorityCertIssuer||n.authorityCertSerialNumber)&&(this.certId={name:n.authorityCertIssuer||[],serialNumber:n.authorityCertSerialNumber?fe.ToHex(n.authorityCertSerialNumber):""})}toTextObject(){const e=this.toTextObjectWithoutValue(),n=te.parse(this.value,Lr);return n.authorityCertIssuer&&(e["Authority Issuer"]=new ni(n.authorityCertIssuer).toTextObject()),n.authorityCertSerialNumber&&(e["Authority Serial Number"]=n.authorityCertSerialNumber),n.keyIdentifier&&(e[""]=n.keyIdentifier),e}}qo.NAME="Authority Key Identifier";class df extends qt{constructor(...e){if(ne.isBufferSource(e[0])){super(e[0]);const n=te.parse(this.value,Ia);this.ca=n.cA,this.pathLength=n.pathLenConstraint}else{const n=new Ia({cA:e[0],pathLenConstraint:e[1]});super(I2,e[2],te.serialize(n)),this.ca=e[0],this.pathLength=e[1]}}toTextObject(){const e=this.toTextObjectWithoutValue();return this.ca&&(e.CA=this.ca),this.pathLength!==void 0&&(e["Path Length"]=this.pathLength),e}}df.NAME="Basic Constraints";var H0;(function(t){t.serverAuth="1.3.6.1.5.5.7.3.1",t.clientAuth="1.3.6.1.5.5.7.3.2",t.codeSigning="1.3.6.1.5.5.7.3.3",t.emailProtection="1.3.6.1.5.5.7.3.4",t.timeStamping="1.3.6.1.5.5.7.3.8",t.ocspSigning="1.3.6.1.5.5.7.3.9"})(H0||(H0={}));class pf extends qt{constructor(...e){if(ne.isBufferSource(e[0])){super(e[0]);const n=te.parse(this.value,Ra);this.usages=n.map(r=>r)}else{const n=new Ra(e[0]);super(D2,e[1],te.serialize(n)),this.usages=e[0]}}toTextObject(){const e=this.toTextObjectWithoutValue();return e[""]=this.usages.map(n=>kr.toString(n)).join(", "),e}}pf.NAME="Extended Key Usages";var ac;(function(t){t[t.digitalSignature=1]="digitalSignature",t[t.nonRepudiation=2]="nonRepudiation",t[t.keyEncipherment=4]="keyEncipherment",t[t.dataEncipherment=8]="dataEncipherment",t[t.keyAgreement=16]="keyAgreement",t[t.keyCertSign=32]="keyCertSign",t[t.cRLSign=64]="cRLSign",t[t.encipherOnly=128]="encipherOnly",t[t.decipherOnly=256]="decipherOnly"})(ac||(ac={}));class ff extends qt{constructor(...e){if(ne.isBufferSource(e[0])){super(e[0]);const n=te.parse(this.value,Ml);this.usages=n.toNumber()}else{const n=new Ml(e[0]);super(P2,e[1],te.serialize(n)),this.usages=e[0]}}toTextObject(){const e=this.toTextObjectWithoutValue(),n=te.parse(this.value,Ml);return e[""]=n.toJSON().join(", "),e}}ff.NAME="Key Usages";class ws extends qt{static async create(e,n=!1,r=ct.get()){const o=await(await cn.create(e,r)).getKeyIdentifier(r);return new ws(fe.ToHex(o),n)}constructor(...e){if(ne.isBufferSource(e[0])){super(e[0]);const n=te.parse(this.value,mr);this.keyId=fe.ToHex(n)}else{const n=typeof e[0]=="string"?fe.FromHex(e[0]):e[0],r=new mr(n);super(F2,e[1],te.serialize(r)),this.keyId=fe.ToHex(n)}}toTextObject(){const e=this.toTextObjectWithoutValue(),n=te.parse(this.value,mr);return e[""]=n,e}}ws.NAME="Subject Key Identifier";class h1 extends qt{constructor(...e){ne.isBufferSource(e[0])?super(e[0]):super(L2,e[1],new ni(e[0]||[]).rawData)}onInit(e){super.onInit(e);const n=te.parse(e.extnValue,Yu);this.names=new ni(n)}toTextObject(){const e=this.toTextObjectWithoutValue(),n=this.names.toTextObject();for(const r in n)e[r]=n[r];return e}}h1.NAME="Subject Alternative Name";class Vt{static register(e,n){this.items.set(e,n)}static create(e){const n=new qt(e),r=this.items.get(n.type);return r?new r(e):n}}Vt.items=new Map;class g1 extends qt{constructor(...e){var n;if(ne.isBufferSource(e[0])){super(e[0]);const r=te.parse(this.value,za);this.policies=r.map(i=>i.policyIdentifier)}else{const r=e[0],i=(n=e[1])!==null&&n!==void 0?n:!1,o=new za(r.map(a=>new Jc({policyIdentifier:a})));super(O2,i,te.serialize(o)),this.policies=r}}toTextObject(){const e=this.toTextObjectWithoutValue();return e.Policy=this.policies.map(n=>new ze("",{},kr.toString(n))),e}}g1.NAME="Certificate Policies";Vt.register(O2,g1);class m1 extends qt{constructor(...e){var n;if(ne.isBufferSource(e[0]))super(e[0]);else if(Array.isArray(e[0])&&typeof e[0][0]=="string"){const i=e[0].map(a=>new Qi({distributionPoint:new Gr({fullName:[new ke({uniformResourceIdentifier:a})]})})),o=new Ni(i);super(Uu,e[1],te.serialize(o))}else{const r=new Ni(e[0]);super(Uu,e[1],te.serialize(r))}(n=this.distributionPoints)!==null&&n!==void 0||(this.distributionPoints=[])}onInit(e){super.onInit(e);const n=te.parse(e.extnValue,Ni);this.distributionPoints=n}toTextObject(){const e=this.toTextObjectWithoutValue();return e["Distribution Point"]=this.distributionPoints.map(n=>{var r;const i={};return n.distributionPoint&&(i[""]=(r=n.distributionPoint.fullName)===null||r===void 0?void 0:r.map(o=>new hr(o).toString()).join(", ")),n.reasons&&(i.Reasons=n.reasons.toString()),n.cRLIssuer&&(i["CRL Issuer"]=n.cRLIssuer.map(o=>o.toString()).join(", ")),i}),e}}m1.NAME="CRL Distribution Points";class _1 extends qt{constructor(...e){var n,r,i,o;if(ne.isBufferSource(e[0]))super(e[0]);else if(e[0]instanceof xi){const a=new xi(e[0]);super(Ru,e[1],te.serialize(a))}else{const a=e[0],l=new xi;qs(l,a,Ch,"ocsp"),qs(l,a,Th,"caIssuers"),qs(l,a,Ih,"timeStamping"),qs(l,a,Oh,"caRepository"),super(Ru,e[1],te.serialize(l))}(n=this.ocsp)!==null&&n!==void 0||(this.ocsp=[]),(r=this.caIssuers)!==null&&r!==void 0||(this.caIssuers=[]),(i=this.timeStamping)!==null&&i!==void 0||(this.timeStamping=[]),(o=this.caRepository)!==null&&o!==void 0||(this.caRepository=[])}onInit(e){super.onInit(e),this.ocsp=[],this.caIssuers=[],this.timeStamping=[],this.caRepository=[],te.parse(e.extnValue,xi).forEach(r=>{switch(r.accessMethod){case Ch:this.ocsp.push(new hr(r.accessLocation));break;case Th:this.caIssuers.push(new hr(r.accessLocation));break;case Ih:this.timeStamping.push(new hr(r.accessLocation));break;case Oh:this.caRepository.push(new hr(r.accessLocation));break}})}toTextObject(){const e=this.toTextObjectWithoutValue();return this.ocsp.length&&Ms(e,"OCSP",this.ocsp),this.caIssuers.length&&Ms(e,"CA Issuers",this.caIssuers),this.timeStamping.length&&Ms(e,"Time Stamping",this.timeStamping),this.caRepository.length&&Ms(e,"CA Repository",this.caRepository),e}}_1.NAME="Authority Info Access";function Ms(t,e,n){if(n.length===1)t[e]=n[0].toTextObject();else{const r=new ze("");n.forEach((i,o)=>{const a=i.toTextObject(),l=`${a[ze.NAME]} ${o+1}`;let u=r[l];Array.isArray(u)||(u=[],r[l]=u),u.push(a)}),t[e]=r}}function qs(t,e,n,r){const i=e[r];i&&(Array.isArray(i)?i:[i]).forEach(a=>{typeof a=="string"&&(a=new hr("url",a)),t.push(new ss({accessMethod:n,accessLocation:te.parse(a.rawData,ke)}))})}class y1 extends qt{constructor(...e){ne.isBufferSource(e[0])?super(e[0]):super(R2,e[1],new ni(e[0]||[]).rawData)}onInit(e){super.onInit(e);const n=te.parse(e.extnValue,gt);this.names=new ni(n)}toTextObject(){const e=this.toTextObjectWithoutValue(),n=this.names.toTextObject();for(const r in n)e[r]=n[r];return e}}y1.NAME="Issuer Alternative Name";class so extends Nr{constructor(...e){let n;if(ne.isBufferSource(e[0]))n=ne.toArrayBuffer(e[0]);else{const r=e[0],i=Array.isArray(e[1])?e[1].map(o=>ne.toArrayBuffer(o)):[];n=te.serialize(new Vn({type:r,values:i}))}super(n,Vn)}onInit(e){this.type=e.type,this.values=e.values}toTextObject(){const e=this.toTextObjectWithoutValue();return e.Value=this.values.map(n=>new ze("",{"":n})),e}toTextObjectWithoutValue(){const e=this.toTextObjectEmpty();return e[ze.NAME]===so.NAME&&(e[ze.NAME]=kr.toString(this.type)),e}}so.NAME="Attribute";class w1 extends so{constructor(...e){var n;if(ne.isBufferSource(e[0]))super(e[0]);else{const r=new oc({printableString:e[0]});super(c1,[te.serialize(r)])}(n=this.password)!==null&&n!==void 0||(this.password="")}onInit(e){if(super.onInit(e),this.values[0]){const n=te.parse(this.values[0],oc);this.password=n.toString()}}toTextObject(){const e=this.toTextObjectWithoutValue();return e[ze.VALUE]=this.password,e}}w1.NAME="Challenge Password";class hf extends so{constructor(...e){var n;if(ne.isBufferSource(e[0]))super(e[0]);else{const r=e[0],i=new wr;for(const o of r)i.push(te.parse(o.rawData,Yt));super(uf,[te.serialize(i)])}(n=this.items)!==null&&n!==void 0||(this.items=[])}onInit(e){if(super.onInit(e),this.values[0]){const n=te.parse(this.values[0],wr);this.items=n.map(r=>Vt.create(te.serialize(r)))}}toTextObject(){const e=this.toTextObjectWithoutValue(),n=this.items.map(r=>r.toTextObject());for(const r of n)e[r[ze.NAME]]=r;return e}}hf.NAME="Extensions";class wl{static register(e,n){this.items.set(e,n)}static create(e){const n=new so(e),r=this.items.get(n.type);return r?new r(e):n}}wl.items=new Map;const vs="crypto.signatureFormatter";class a${toAsnSignature(e,n){return ne.toArrayBuffer(n)}toWebSignature(e,n){return ne.toArrayBuffer(n)}}var ia;let Ud=ia=class{static createPssParams(e,n){const r=ia.getHashAlgorithm(e);return r?new Qr({hashAlgorithm:r,maskGenAlgorithm:new ce({algorithm:ul,parameters:te.serialize(r)}),saltLength:n}):null}static getHashAlgorithm(e){const n=ft.resolve(ei);return typeof e=="string"?n.toAsnAlgorithm({name:e}):typeof e=="object"&&e&&"name"in e?n.toAsnAlgorithm(e):null}toAsnAlgorithm(e){switch(e.name.toLowerCase()){case"rsassa-pkcs1-v1_5":if("hash"in e){let n;if(typeof e.hash=="string")n=e.hash;else if(e.hash&&typeof e.hash=="object"&&"name"in e.hash&&typeof e.hash.name=="string")n=e.hash.name.toUpperCase();else throw new Error("Cannot get hash algorithm name");switch(n.toLowerCase()){case"sha-1":return new ce({algorithm:Xa,parameters:null});case"sha-256":return new ce({algorithm:yd,parameters:null});case"sha-384":return new ce({algorithm:Ja,parameters:null});case"sha-512":return new ce({algorithm:Ya,parameters:null})}}else return new ce({algorithm:Yr,parameters:null});break;case"rsa-pss":if("hash"in e){if(!("saltLength"in e&&typeof e.saltLength=="number"))throw new Error("Cannot get 'saltLength' from 'alg' argument");const n=ia.createPssParams(e.hash,e.saltLength);if(!n)throw new Error("Cannot create PSS parameters");return new ce({algorithm:So,parameters:te.serialize(n)})}else return new ce({algorithm:So,parameters:null})}return null}toWebAlgorithm(e){switch(e.algorithm){case Yr:return{name:"RSASSA-PKCS1-v1_5"};case Xa:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-1"}};case yd:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case Ja:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-384"}};case Ya:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-512"}};case So:if(e.parameters){const n=te.parse(e.parameters,Qr);return{name:"RSA-PSS",hash:ft.resolve(ei).toWebAlgorithm(n.hashAlgorithm),saltLength:n.saltLength}}else return{name:"RSA-PSS"}}return null}};Ud=ia=m([hl()],Ud);ft.registerSingleton(ys,Ud);let Md=class{toAsnAlgorithm(e){switch(e.name.toLowerCase()){case"sha-1":return new ce({algorithm:Za});case"sha-256":return new ce({algorithm:Qa});case"sha-384":return new ce({algorithm:ec});case"sha-512":return new ce({algorithm:tc})}return null}toWebAlgorithm(e){switch(e.algorithm){case Za:return{name:"SHA-1"};case Qa:return{name:"SHA-256"};case ec:return{name:"SHA-384"};case tc:return{name:"SHA-512"}}return null}};Md=m([hl()],Md);ft.registerSingleton(ys,Md);class Jt{addPadding(e,n){const r=ne.toUint8Array(n),i=new Uint8Array(e);return i.set(r,e-r.length),i}removePadding(e,n=!1){let r=ne.toUint8Array(e);for(let i=0;i<r.length;i++)if(r[i]){r=r.slice(i);break}if(n&&r[0]>127){const i=new Uint8Array(r.length+1);return i.set(r,1),i.buffer}return r.buffer}toAsnSignature(e,n){if(e.name==="ECDSA"){const r=e.namedCurve,i=Jt.namedCurveSize.get(r)||Jt.defaultNamedCurveSize,o=new Wa,a=ne.toUint8Array(n);return o.r=this.removePadding(a.slice(0,i),!0),o.s=this.removePadding(a.slice(i,i+i),!0),te.serialize(o)}return null}toWebSignature(e,n){if(e.name==="ECDSA"){const r=te.parse(n,Wa),i=e.namedCurve,o=Jt.namedCurveSize.get(i)||Jt.defaultNamedCurveSize,a=this.addPadding(o,this.removePadding(r.r)),l=this.addPadding(o,this.removePadding(r.s));return v3(a,l)}return null}}Jt.namedCurveSize=new Map;Jt.defaultNamedCurveSize=32;const Jl="1.3.101.110",K0="1.3.101.111",Yl="1.3.101.112",G0="1.3.101.113";let qd=class{toAsnAlgorithm(e){let n=null;switch(e.name.toLowerCase()){case"ed25519":n=Yl;break;case"x25519":n=Jl;break;case"eddsa":switch(e.namedCurve.toLowerCase()){case"ed25519":n=Yl;break;case"ed448":n=G0;break}break;case"ecdh-es":switch(e.namedCurve.toLowerCase()){case"x25519":n=Jl;break;case"x448":n=K0;break}}return n?new ce({algorithm:n}):null}toWebAlgorithm(e){switch(e.algorithm){case Yl:return{name:"Ed25519"};case G0:return{name:"EdDSA",namedCurve:"Ed448"};case Jl:return{name:"X25519"};case K0:return{name:"ECDH-ES",namedCurve:"X448"}}return null}};qd=m([hl()],qd);ft.registerSingleton(ys,qd);class c$ extends Gn{constructor(e){Gn.isAsnEncoded(e)?super(e,Fo):super(e),this.tag=jt.CertificateRequestTag}onInit(e){this.tbs=te.serialize(e.certificationRequestInfo),this.publicKey=new cn(e.certificationRequestInfo.subjectPKInfo);const n=ft.resolve(ei);this.signatureAlgorithm=n.toWebAlgorithm(e.signatureAlgorithm),this.signature=e.signature,this.attributes=e.certificationRequestInfo.attributes.map(i=>wl.create(te.serialize(i)));const r=this.getAttribute(uf);this.extensions=[],r instanceof hf&&(this.extensions=r.items),this.subjectName=new Xt(e.certificationRequestInfo.subject),this.subject=this.subjectName.toString()}getAttribute(e){for(const n of this.attributes)if(n.type===e)return n;return null}getAttributes(e){return this.attributes.filter(n=>n.type===e)}getExtension(e){for(const n of this.extensions)if(n.type===e)return n;return null}getExtensions(e){return this.extensions.filter(n=>n.type===e)}async verify(e=ct.get()){const n={...this.publicKey.algorithm,...this.signatureAlgorithm},r=await this.publicKey.export(n,["verify"],e),i=ft.resolveAll(vs).reverse();let o=null;for(const l of i)if(o=l.toWebSignature(n,this.signature),o)break;if(!o)throw Error("Cannot convert WebCrypto signature value to ASN.1 format");return await e.subtle.verify(this.signatureAlgorithm,r,o,this.tbs)}toTextObject(){const e=this.toTextObjectEmpty(),n=te.parse(this.rawData,Fo),r=n.certificationRequestInfo,i=new ze("",{Version:`${Wr[r.version]} (${r.version})`,Subject:this.subject,"Subject Public Key Info":this.publicKey});if(this.attributes.length){const o=new ze("");for(const a of this.attributes){const l=a.toTextObject();o[l[ze.NAME]]=l}i.Attributes=o}return e.Data=i,e.Signature=new ze("",{Algorithm:ti.serializeAlgorithm(n.signatureAlgorithm),"":n.signature}),e}}c$.NAME="PKCS#10 Certificate Request";class vl extends Gn{constructor(e){Gn.isAsnEncoded(e)?super(e,Xr):super(e),this.tag=jt.CertificateTag}onInit(e){const n=e.tbsCertificate;this.tbs=te.serialize(n);let r=new Uint8Array(n.serialNumber);r.length>1&&r[0]===0&&r[1]>127&&(r=r.slice(1)),this.serialNumber=fe.ToHex(r),this.subjectName=new Xt(n.subject),this.subject=new Xt(n.subject).toString(),this.issuerName=new Xt(n.issuer),this.issuer=this.issuerName.toString();const i=ft.resolve(ei);this.signatureAlgorithm=i.toWebAlgorithm(e.signatureAlgorithm),this.signature=e.signatureValue;const o=n.validity.notBefore.utcTime||n.validity.notBefore.generalTime;if(!o)throw new Error("Cannot get 'notBefore' value");this.notBefore=o;const a=n.validity.notAfter.utcTime||n.validity.notAfter.generalTime;if(!a)throw new Error("Cannot get 'notAfter' value");this.notAfter=a,this.extensions=[],n.extensions&&(this.extensions=n.extensions.map(l=>Vt.create(te.serialize(l)))),this.publicKey=new cn(n.subjectPublicKeyInfo)}getExtension(e){for(const n of this.extensions)if(typeof e=="string"){if(n.type===e)return n}else if(n instanceof e)return n;return null}getExtensions(e){return this.extensions.filter(n=>typeof e=="string"?n.type===e:n instanceof e)}async verify(e={},n=ct.get()){let r,i;const o=e.publicKey;try{if(!o)r={...this.publicKey.algorithm,...this.signatureAlgorithm},i=await this.publicKey.export(r,["verify"],n);else if("publicKey"in o)r={...o.publicKey.algorithm,...this.signatureAlgorithm},i=await o.publicKey.export(r,["verify"],n);else if(o instanceof cn)r={...o.algorithm,...this.signatureAlgorithm},i=await o.export(r,["verify"],n);else if(ne.isBufferSource(o)){const d=new cn(o);r={...d.algorithm,...this.signatureAlgorithm},i=await d.export(r,["verify"],n)}else r={...o.algorithm,...this.signatureAlgorithm},i=o}catch{return!1}const a=ft.resolveAll(vs).reverse();let l=null;for(const d of a)if(l=d.toWebSignature(r,this.signature),l)break;if(!l)throw Error("Cannot convert ASN.1 signature value to WebCrypto format");const u=await n.subtle.verify(this.signatureAlgorithm,i,l,this.tbs);if(e.signatureOnly)return u;{const p=(e.date||new Date).getTime();return u&&this.notBefore.getTime()<p&&p<this.notAfter.getTime()}}async getThumbprint(...e){let n,r="SHA-1";return e[0]&&(e[0].subtle?n=e[0]:(r=e[0]||r,n=e[1])),n??(n=ct.get()),await n.subtle.digest(r,this.rawData)}async isSelfSigned(e=ct.get()){return this.subject===this.issuer&&await this.verify({signatureOnly:!0},e)}toTextObject(){const e=this.toTextObjectEmpty(),n=te.parse(this.rawData,Xr),r=n.tbsCertificate,i=new ze("",{Version:`${Wr[r.version]} (${r.version})`,"Serial Number":r.serialNumber,"Signature Algorithm":ti.serializeAlgorithm(r.signature),Issuer:this.issuer,Validity:new ze("",{"Not Before":r.validity.notBefore.getTime(),"Not After":r.validity.notAfter.getTime()}),Subject:this.subject,"Subject Public Key Info":this.publicKey});if(r.issuerUniqueID&&(i["Issuer Unique ID"]=r.issuerUniqueID),r.subjectUniqueID&&(i["Subject Unique ID"]=r.subjectUniqueID),this.extensions.length){const o=new ze("");for(const a of this.extensions){const l=a.toTextObject();o[l[ze.NAME]]=l}i.Extensions=o}return e.Data=i,e.Signature=new ze("",{Algorithm:ti.serializeAlgorithm(n.signatureAlgorithm),"":n.signatureValue}),e}}vl.NAME="Certificate";class l${static async createSelfSigned(e,n=ct.get()){if(!e.keys.privateKey)throw new Error("Bad field 'keys' in 'params' argument. 'privateKey' is empty");if(!e.keys.publicKey)throw new Error("Bad field 'keys' in 'params' argument. 'publicKey' is empty");return this.create({serialNumber:e.serialNumber,subject:e.name,issuer:e.name,notBefore:e.notBefore,notAfter:e.notAfter,publicKey:e.keys.publicKey,signingKey:e.keys.privateKey,signingAlgorithm:e.signingAlgorithm,extensions:e.extensions},n)}static async create(e,n=ct.get()){var r;let i;e.publicKey instanceof cn?i=e.publicKey.rawData:"publicKey"in e.publicKey?i=e.publicKey.publicKey.rawData:ne.isBufferSource(e.publicKey)?i=e.publicKey:i=await n.subtle.exportKey("spki",e.publicKey);let o=e.serialNumber?ne.toUint8Array(fe.FromHex(e.serialNumber)):void 0;o=this.generateSerialNumber(o,n);const a=e.notBefore||new Date,l=e.notAfter||new Date(a.getTime()+31536e6),u=new Xr({tbsCertificate:new Mt({version:Wr.v3,serialNumber:o,validity:new as({notBefore:a,notAfter:l}),extensions:new wr(((r=e.extensions)===null||r===void 0?void 0:r.map(D=>te.parse(D.rawData,Yt)))||[]),subjectPublicKeyInfo:te.parse(i,sn)})});if(e.subject){const D=e.subject instanceof Xt?e.subject:new Xt(e.subject);u.tbsCertificate.subject=te.parse(D.toArrayBuffer(),Ye)}if(e.issuer){const D=e.issuer instanceof Xt?e.issuer:new Xt(e.issuer);u.tbsCertificate.issuer=te.parse(D.toArrayBuffer(),Ye)}const d={hash:"SHA-256"},p="signingKey"in e?{...d,...e.signingAlgorithm,...e.signingKey.algorithm}:{...d,...e.signingAlgorithm},h=ft.resolve(ei);u.tbsCertificate.signature=u.signatureAlgorithm=h.toAsnAlgorithm(p);const g=te.serialize(u.tbsCertificate),A="signingKey"in e?await n.subtle.sign(p,e.signingKey,g):e.signature,$=ft.resolveAll(vs).reverse();let N=null;for(const D of $)if(N=D.toAsnSignature(p,A),N)break;if(!N)throw Error("Cannot convert ASN.1 signature value to WebCrypto format");return u.signatureValue=N,new vl(te.serialize(u))}static generateSerialNumber(e,n){let r=e&&e.length&&e.some(o=>o>0)?new Uint8Array(e):void 0;r||(r=n.getRandomValues(new Uint8Array(16)));let i=0;for(;i<r.length-1&&r[i]===0;)i++;if(r=r.slice(i),r[0]>127){const o=new Uint8Array(r.length+1);o[0]=0,o.set(r,1),r=o}return r}}var W0;(function(t){t[t.unspecified=0]="unspecified",t[t.keyCompromise=1]="keyCompromise",t[t.cACompromise=2]="cACompromise",t[t.affiliationChanged=3]="affiliationChanged",t[t.superseded=4]="superseded",t[t.cessationOfOperation=5]="cessationOfOperation",t[t.certificateHold=6]="certificateHold",t[t.removeFromCRL=8]="removeFromCRL",t[t.privilegeWithdrawn=9]="privilegeWithdrawn",t[t.aACompromise=10]="aACompromise"})(W0||(W0={}));Vt.register(I2,df);Vt.register(D2,pf);Vt.register(P2,ff);Vt.register(F2,ws);Vt.register(Pu,qo);Vt.register(L2,h1);Vt.register(Uu,m1);Vt.register(Ru,_1);Vt.register(R2,y1);wl.register(c1,w1);wl.register(uf,hf);ft.registerSingleton(vs,a$);ft.registerSingleton(vs,Jt);Jt.namedCurveSize.set("P-256",32);Jt.namedCurveSize.set("K-256",32);Jt.namedCurveSize.set("P-384",48);Jt.namedCurveSize.set("P-521",66);async function Vd(t){const e={name:"RSASSA-PKCS1-v1_5",hash:"SHA-256",publicExponent:new Uint8Array([1,0,1]),modulusLength:2048},n=await crypto.subtle.generateKey(e,!0,["sign","verify"]),r=Ve(),i=$u(new TextEncoder().encode(r)),o=await l$.createSelfSigned({serialNumber:i,name:t.name,notBefore:new Date,notAfter:new Date(Date.now()+365*24*60*60*1e3),signingAlgorithm:e,keys:n,extensions:[new df(!0,2,!0),new pf(["1.3.6.1.5.5.7.3.1"],!0),new ff(ac.keyCertSign|ac.cRLSign,!0),await ws.create(n.publicKey)]}),a=await crypto.subtle.exportKey("pkcs8",n.privateKey),l=o.toString("pem"),u=await d$(o),d=$u(await o.getThumbprint()),p=u$("PRIVATE",a);return{kid:o.serialNumber,cert:l,thumbprint:d,fingerprint:u,pkcs7:p,type:"jwt_signing"}}function u$(t,e){const n=__.encode(new Uint8Array(e));let r=`-----BEGIN ${t} KEY-----\r
189
189
  `,i=0;for(;i<n.length;)i+64<=n.length?r+=n.substr(i,64)+`\r
190
190
  `:r+=n.substr(i)+`\r
191
191
  `,i+=64;return r+=`-----END ${t} KEY-----\r
192
- `,r}async function d$(t){const e=await t.publicKey.export(),n=await crypto.subtle.exportKey("jwk",e),r=JSON.stringify(n,Object.keys(n).sort()),o=new TextEncoder().encode(r);return $u(await h_(o))}const p$=1e3*60*60*24,f$=new s.OpenAPIHono().openapi(s.createRoute({tags:["keys"],method:"get",path:"/signing",request:{headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:s.z.array(bu)}},description:"List of keys"}}}),async t=>{const{signingKeys:e}=await t.env.data.keys.list({q:"type:jwt_signing"}),n=e.filter(r=>"cert"in r).map(r=>r);return t.json(n)}).openapi(s.createRoute({tags:["keys"],method:"get",path:"/signing/{kid}",request:{headers:s.z.object({"tenant-id":s.z.string()}),params:s.z.object({kid:s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:bu}},description:"The requested key"}}}),async t=>{const{kid:e}=t.req.valid("param"),{signingKeys:n}=await t.env.data.keys.list({q:"type:jwt_signing"}),r=n.find(i=>i.kid===e);if(!r)throw new C(404,{message:"Key not found"});return t.json(r)}).openapi(s.createRoute({tags:["keys"],method:"post",path:"/signing/rotate",request:{headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{description:"Status"}}}),async t=>{const{signingKeys:e}=await t.env.data.keys.list({q:"type:jwt_signing"});for await(const r of e)await t.env.data.keys.update(r.kid,{revoked_at:new Date(Date.now()+p$).toISOString()});const n=await Vd({name:`CN=${t.env.ORGANIZATION_NAME}`});return await t.env.data.keys.create({...n,type:"jwt_signing"}),t.text("OK",{status:201})}).openapi(s.createRoute({tags:["keys"],method:"put",path:"/signing/{kid}/revoke",request:{headers:s.z.object({"tenant-id":s.z.string()}),params:s.z.object({kid:s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{description:"Status"}}}),async t=>{const{kid:e}=t.req.valid("param");if(!await t.env.data.keys.update(e,{revoked_at:new Date().toISOString()}))throw new C(404,{message:"Key not found"});const r=await Vd({name:`CN=${t.env.ORGANIZATION_NAME}`});return await t.env.data.keys.create({...r,type:"jwt_signing"}),t.text("OK")}),h$=new s.OpenAPIHono().openapi(s.createRoute({tags:["users"],method:"get",path:"/",request:{query:s.z.object({email:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"tenant/json":{schema:s.z.array(up)}},description:"List of users"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{email:n}=t.req.valid("query"),i=(await Ap(t.env.data.users,e,n)).filter(o=>!o.linked_to);return t.json(i)}),g$=mn.extend({clients:s.z.array(Dr)}),m$=new s.OpenAPIHono().openapi(s.createRoute({tags:["clients"],method:"get",path:"/",request:{query:Lt,headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:s.z.union([g$,s.z.array(Dr)])}},description:"List of clients"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{page:n,per_page:r,include_totals:i,sort:o,q:a}=t.req.valid("query"),u=(await t.env.data.applications.list(e,{page:n,per_page:r,include_totals:i,sort:pn(o),q:a})).applications;return i?t.json({clients:u,start:0,limit:10,length:u.length}):t.json(u)}).openapi(s.createRoute({tags:["clients"],method:"get",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:Dr}},description:"An application"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param"),i=(await t.env.data.applications.list(e,{page:1,per_page:0,include_totals:!1})).applications.find(o=>o.id===n);if(!i)throw new C(404);return t.json(i)}).openapi(s.createRoute({tags:["clients"],method:"delete",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param");if(!await t.env.data.applications.remove(e,n))throw new C(404,{message:"Application not found"});return t.text("OK")}).openapi(s.createRoute({tags:["clients"],method:"patch",path:"/{id}",request:{body:{content:{"application/json":{schema:s.z.object(va.shape).partial()}}},params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:Dr}},description:"The update application"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param"),i=t.req.valid("json");await t.env.data.applications.update(e,n,i);const o=await t.env.data.applications.get(e,n);if(!o)throw new C(404,{message:"Application not found"});return t.json(o)}).openapi(s.createRoute({tags:["clients"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:s.z.object(va.shape)}}},headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:s.z.object(Dr.shape)}},description:"An application"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json"),r={...n,id:n.id||Ve(),client_secret:n.client_secret||Ve()},i=await t.env.data.applications.create(e,r);return t.json(i,{status:201})});s.z.object({start:s.z.number(),limit:s.z.number(),length:s.z.number()});vc.extend({email:s.z.string(),login_count:s.z.number(),multifactor:s.z.array(s.z.string()).optional(),last_ip:s.z.string().optional(),last_login:s.z.string().optional(),user_id:s.z.string()}).catchall(s.z.any());const _$=mn.extend({tenants:s.z.array(Si)}),y$=new s.OpenAPIHono().openapi(s.createRoute({tags:["tenants"],method:"get",path:"/",request:{query:Lt},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"tenant/json":{schema:s.z.union([s.z.array(Si),_$])}},description:"List of tenants"}}}),async t=>{const{page:e,per_page:n,include_totals:r,sort:i,q:o}=t.req.valid("query"),a=await t.env.data.tenants.list({page:e,per_page:n,include_totals:r,sort:pn(i),q:o});return r?t.json(a):t.json(a.tenants)}).openapi(s.createRoute({tags:["tenants"],method:"get",path:"/{id}",request:{params:s.z.object({id:s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"tenant/json":{schema:Si}},description:"A tenant"}}}),async t=>{const{id:e}=t.req.valid("param"),n=await t.env.data.tenants.get(e);if(!n)throw new C(404);return t.json(n)}).openapi(s.createRoute({tags:["tenants"],method:"delete",path:"/{id}",request:{params:s.z.object({id:s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async t=>{const{id:e}=t.req.valid("param");return await t.env.data.tenants.remove(e),t.text("OK")}).openapi(s.createRoute({tags:["tenants"],method:"patch",path:"/{id}",request:{body:{content:{"application/json":{schema:s.z.object($a.shape).partial()}}},params:s.z.object({id:s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async t=>{const{id:e}=t.req.valid("param"),n=t.req.valid("json");return await t.env.data.tenants.update(e,n),t.text("OK")}).openapi(s.createRoute({tags:["tenants"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:s.z.object($a.shape)}}}},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"tenant/json":{schema:Si}},description:"An tenant"}}}),async t=>{const e=t.req.valid("json"),n=await t.env.data.tenants.create(e);return t.json(n,{status:201})}),w$=mn.extend({logs:s.z.array(Aa)}),v$=new s.OpenAPIHono().openapi(s.createRoute({tags:["logs"],method:"get",path:"/",request:{query:Lt,headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:s.z.union([s.z.array(Aa),w$])}},description:"List of log rows"}}}),async t=>{const{page:e,per_page:n,include_totals:r,sort:i,q:o}=t.req.valid("query"),{"tenant-id":a}=t.req.valid("header"),l=await t.env.data.logs.list(a,{page:e,per_page:n,include_totals:r,sort:pn(i),q:o});return r?t.json(l):t.json(l.logs)}).openapi(s.createRoute({tags:["logs"],method:"get",path:"/{id}",request:{headers:s.z.object({"tenant-id":s.z.string()}),params:s.z.object({id:s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:Aa}},description:"A log entry"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param"),r=await t.env.data.logs.get(e,n);if(!r)throw new C(404);return t.json(r)}),b$=mn.extend({hooks:s.z.array(bi)}),$$=new s.OpenAPIHono().openapi(s.createRoute({tags:["hooks"],method:"get",path:"/",request:{query:Lt,headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:s.z.union([s.z.array(bi),b$])}},description:"List of hooks"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{page:n,per_page:r,include_totals:i,sort:o,q:a}=t.req.valid("query"),l=await t.env.data.hooks.list(e,{page:n,per_page:r,include_totals:i,sort:pn(o),q:a});return i?t.json(l):t.json(l.hooks)}).openapi(s.createRoute({tags:["hooks"],method:"post",path:"/",request:{headers:s.z.object({"tenant-id":s.z.string()}),body:{content:{"application/json":{schema:Js}}}},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:bi}},description:"The created hook"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json"),r=await t.env.data.hooks.create(e,n);return t.json(r,{status:201})}).openapi(s.createRoute({tags:["hooks"],method:"patch",path:"/{hook_id}",request:{headers:s.z.object({"tenant-id":s.z.string()}),params:s.z.object({hook_id:s.z.string()}),body:{content:{"application/json":{schema:s.z.union([Js.options[0].omit({hook_id:!0}).partial(),Js.options[1].omit({hook_id:!0}).partial()])}}}},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:bi}},description:"The updated hook"},404:{description:"Hook not found"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{hook_id:n}=t.req.valid("param"),r=t.req.valid("json");await t.env.data.hooks.update(e,n,r);const i=await t.env.data.hooks.get(e,n);if(!i)throw new C(404,{message:"Hook not found"});return t.json(i)}).openapi(s.createRoute({tags:["hooks"],method:"get",path:"/{hook_id}",request:{headers:s.z.object({"tenant-id":s.z.string()}),params:s.z.object({hook_id:s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:bi}},description:"A hook"},404:{description:"Hook not found"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{hook_id:n}=t.req.valid("param"),r=await t.env.data.hooks.get(e,n);if(!r)throw new C(404,{message:"Hook not found"});return t.json(r)}).openapi(s.createRoute({tags:["hooks"],method:"delete",path:"/{hook_id}",request:{headers:s.z.object({"tenant-id":s.z.string()}),params:s.z.object({hook_id:s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{description:"A hook"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{hook_id:n}=t.req.valid("param");if(!await t.env.data.hooks.remove(e,n))throw new C(404,{message:"Hook not found"});return t.text("OK")}),x$=mn.extend({connections:s.z.array(on)}),A$=new s.OpenAPIHono().openapi(s.createRoute({tags:["connections"],method:"get",path:"/",request:{query:Lt,headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:s.z.union([s.z.array(on),x$])}},description:"List of connectionss"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{page:n,per_page:r,include_totals:i=!1,sort:o,q:a}=t.req.valid("query"),l=await t.env.data.connections.list(e,{page:n,per_page:r,include_totals:i,sort:pn(o),q:a});return i?t.json(l):t.json(l.connections)}).openapi(s.createRoute({tags:["connections"],method:"get",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:on}},description:"A connection"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param"),r=await t.env.data.connections.get(e,n);if(!r)throw new C(404);return t.json(r)}).openapi(s.createRoute({tags:["connections"],method:"delete",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param");if(!await t.env.data.connections.remove(e,n))throw new C(404,{message:"Connection not found"});return t.text("OK")}).openapi(s.createRoute({tags:["connections"],method:"patch",path:"/{id}",request:{body:{content:{"application/json":{schema:s.z.object(ba.shape).partial()}}},params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:on}},description:"The updated connection"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param"),r=t.req.valid("json");if(!await t.env.data.connections.update(e,n,r))throw new C(404,{message:"Connection not found"});const o=await t.env.data.connections.get(e,n);if(!o)throw new C(404,{message:"Connection not found"});return t.json(o)}).openapi(s.createRoute({tags:["connections"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:s.z.object(ba.shape)}}},headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:on}},description:"A connection"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json"),r=await t.env.data.connections.create(e,n);return t.json(r,{status:201})}),E$=new s.OpenAPIHono().openapi(s.createRoute({tags:["prompts"],method:"get",path:"/",request:{headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:Zs}},description:"Branding settings"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=await t.env.data.promptSettings.get(e);return n?t.json(n):t.json(Zs.parse({}))}).openapi(s.createRoute({tags:["prompts"],method:"patch",path:"/",request:{headers:s.z.object({"tenant-id":s.z.string()}),body:{content:{"application/json":{schema:s.z.object(Zs.shape).partial()}}}},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Prompts settings"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json"),r=await t.env.data.promptSettings.get(e);return Object.assign(r,n),await t.env.data.promptSettings.set(e,r),t.json(r)});let X0=!1;function gf(t){t.use(async(e,n)=>(X0||(t.openAPIRegistry.registerComponent("securitySchemes","Bearer",{type:"oauth2",scheme:"bearer",flows:{implicit:{authorizationUrl:`${e.env.AUTH_URL}/authorize`,scopes:{openid:"Basic user information",email:"User email",profile:"User profile information"}}}}),X0=!0),await n()))}var v1=t=>$1(t.replace(/_|-/g,e=>({_:"/","-":"+"})[e]??e)),b1=t=>S$(t).replace(/\/|\+/g,e=>({"/":"_","+":"-"})[e]??e),S$=t=>{let e="";const n=new Uint8Array(t);for(let r=0,i=n.length;r<i;r++)e+=String.fromCharCode(n[r]);return btoa(e)},$1=t=>{const e=atob(t),n=new Uint8Array(new ArrayBuffer(e.length)),r=e.length/2;for(let i=0,o=e.length-1;i<=r;i++,o--)n[i]=e.charCodeAt(i),n[o]=e.charCodeAt(o);return n},x1=(t=>(t.HS256="HS256",t.HS384="HS384",t.HS512="HS512",t.RS256="RS256",t.RS384="RS384",t.RS512="RS512",t.PS256="PS256",t.PS384="PS384",t.PS512="PS512",t.ES256="ES256",t.ES384="ES384",t.ES512="ES512",t.EdDSA="EdDSA",t))(x1||{}),k$=class extends Error{constructor(t){super(`${t} is not an implemented algorithm`),this.name="JwtAlgorithmNotImplemented"}},bl=class extends Error{constructor(t){super(`invalid JWT token: ${t}`),this.name="JwtTokenInvalid"}},N$=class extends Error{constructor(t){super(`token (${t}) is being used before it's valid`),this.name="JwtTokenNotBefore"}},C$=class extends Error{constructor(t){super(`token (${t}) expired`),this.name="JwtTokenExpired"}},T$=class extends Error{constructor(t,e){super(`Invalid "iat" claim, must be a valid number lower than "${t}" (iat: "${e}")`),this.name="JwtTokenIssuedAt"}},Zl=class extends Error{constructor(t,e){super(`expected issuer "${t}", got ${e?`"${e}"`:"none"} `),this.name="JwtTokenIssuer"}},A1=class extends Error{constructor(t){super(`jwt header is invalid: ${JSON.stringify(t)}`),this.name="JwtHeaderInvalid"}},I$=class extends Error{constructor(t){super(`required "kid" in jwt header: ${JSON.stringify(t)}`),this.name="JwtHeaderRequiresKid"}},O$=class extends Error{constructor(t){super(`token(${t}) signature mismatched`),this.name="JwtTokenSignatureMismatched"}},Vo=(t=>(t.Encrypt="encrypt",t.Decrypt="decrypt",t.Sign="sign",t.Verify="verify",t.DeriveKey="deriveKey",t.DeriveBits="deriveBits",t.WrapKey="wrapKey",t.UnwrapKey="unwrapKey",t))(Vo||{}),bs=new TextEncoder,z$=new TextDecoder;async function D$(t,e,n){const r=E1(e),i=await P$(t,r);return await crypto.subtle.sign(r,i,n)}async function R$(t,e,n,r){const i=E1(e),o=await B$(t,i);return await crypto.subtle.verify(i,o,n,r)}function Hd(t){return $1(t.replace(/-+(BEGIN|END).*/g,"").replace(/\s/g,""))}async function P$(t,e){if(!crypto.subtle||!crypto.subtle.importKey)throw new Error("`crypto.subtle.importKey` is undefined. JWT auth middleware requires it.");if(S1(t)){if(t.type!=="private"&&t.type!=="secret")throw new Error(`unexpected key type: CryptoKey.type is ${t.type}, expected private or secret`);return t}const n=[Vo.Sign];return typeof t=="object"?await crypto.subtle.importKey("jwk",t,e,!1,n):t.includes("PRIVATE")?await crypto.subtle.importKey("pkcs8",Hd(t),e,!1,n):await crypto.subtle.importKey("raw",bs.encode(t),e,!1,n)}async function B$(t,e){if(!crypto.subtle||!crypto.subtle.importKey)throw new Error("`crypto.subtle.importKey` is undefined. JWT auth middleware requires it.");if(S1(t)){if(t.type==="public"||t.type==="secret")return t;t=await J0(t)}if(typeof t=="string"&&t.includes("PRIVATE")){const r=await crypto.subtle.importKey("pkcs8",Hd(t),e,!0,[Vo.Sign]);t=await J0(r)}const n=[Vo.Verify];return typeof t=="object"?await crypto.subtle.importKey("jwk",t,e,!1,n):t.includes("PUBLIC")?await crypto.subtle.importKey("spki",Hd(t),e,!1,n):await crypto.subtle.importKey("raw",bs.encode(t),e,!1,n)}async function J0(t){if(t.type!=="private")throw new Error(`unexpected key type: ${t.type}`);if(!t.extractable)throw new Error("unexpected private key is unextractable");const e=await crypto.subtle.exportKey("jwk",t),{kty:n}=e,{alg:r,e:i,n:o}=e,{crv:a,x:l,y:u}=e;return{kty:n,alg:r,e:i,n:o,crv:a,x:l,y:u,key_ops:[Vo.Verify]}}function E1(t){switch(t){case"HS256":return{name:"HMAC",hash:{name:"SHA-256"}};case"HS384":return{name:"HMAC",hash:{name:"SHA-384"}};case"HS512":return{name:"HMAC",hash:{name:"SHA-512"}};case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"RS384":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-384"}};case"RS512":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-512"}};case"PS256":return{name:"RSA-PSS",hash:{name:"SHA-256"},saltLength:32};case"PS384":return{name:"RSA-PSS",hash:{name:"SHA-384"},saltLength:48};case"PS512":return{name:"RSA-PSS",hash:{name:"SHA-512"},saltLength:64};case"ES256":return{name:"ECDSA",hash:{name:"SHA-256"},namedCurve:"P-256"};case"ES384":return{name:"ECDSA",hash:{name:"SHA-384"},namedCurve:"P-384"};case"ES512":return{name:"ECDSA",hash:{name:"SHA-512"},namedCurve:"P-521"};case"EdDSA":return{name:"Ed25519",namedCurve:"Ed25519"};default:throw new k$(t)}}function S1(t){return k_()==="node"&&crypto.webcrypto?t instanceof crypto.webcrypto.CryptoKey:t instanceof CryptoKey}var Ql=t=>b1(bs.encode(JSON.stringify(t)).buffer).replace(/=/g,""),j$=t=>b1(t).replace(/=/g,""),Kd=t=>JSON.parse(z$.decode(v1(t)));function k1(t){if(typeof t=="object"&&t!==null){const e=t;return"alg"in e&&Object.values(x1).includes(e.alg)&&(!("typ"in e)||e.typ==="JWT")}return!1}var L$=async(t,e,n="HS256")=>{const r=Ql(t);let i;typeof e=="object"&&"alg"in e?(n=e.alg,i=Ql({alg:n,typ:"JWT",kid:e.kid})):i=Ql({alg:n,typ:"JWT"});const o=`${i}.${r}`,a=await D$(e,n,bs.encode(o)),l=j$(a);return`${o}.${l}`},N1=async(t,e,n)=>{const r=typeof n=="string"?{alg:n}:n||{},i={alg:r.alg??"HS256",iss:r.iss,nbf:r.nbf??!0,exp:r.exp??!0,iat:r.iat??!0},o=t.split(".");if(o.length!==3)throw new bl(t);const{header:a,payload:l}=C1(t);if(!k1(a))throw new A1(a);const u=Date.now()/1e3|0;if(i.nbf&&l.nbf&&l.nbf>u)throw new N$(t);if(i.exp&&l.exp&&l.exp<=u)throw new C$(t);if(i.iat&&l.iat&&u<l.iat)throw new T$(u,l.iat);if(i.iss){if(!l.iss)throw new Zl(i.iss,null);if(typeof i.iss=="string"&&l.iss!==i.iss)throw new Zl(i.iss,l.iss);if(i.iss instanceof RegExp&&!i.iss.test(l.iss))throw new Zl(i.iss,l.iss)}const d=t.substring(0,t.lastIndexOf("."));if(!await R$(e,i.alg,v1(o[2]),bs.encode(d)))throw new O$(t);return l},F$=async(t,e,n)=>{const r=e.verification||{},i=U$(t);if(!k1(i))throw new A1(i);if(!i.kid)throw new I$(i);if(e.jwks_uri){const a=await fetch(e.jwks_uri,n);if(!a.ok)throw new Error(`failed to fetch JWKS from ${e.jwks_uri}`);const l=await a.json();if(!l.keys)throw new Error('invalid JWKS response. "keys" field is missing');if(!Array.isArray(l.keys))throw new Error('invalid JWKS response. "keys" field is not an array');e.keys?e.keys.push(...l.keys):e.keys=l.keys}else if(!e.keys)throw new Error('verifyWithJwks requires options for either "keys" or "jwks_uri" or both');const o=e.keys.find(a=>a.kid===i.kid);if(!o)throw new bl(t);return await N1(t,o,{alg:o.alg||i.alg,...r})},C1=t=>{try{const[e,n]=t.split("."),r=Kd(e),i=Kd(n);return{header:r,payload:i}}catch{throw new bl(t)}},U$=t=>{try{const[e]=t.split(".");return Kd(e)}catch{throw new bl(t)}},T1={sign:L$,verify:N1,decode:C1,verifyWithJwks:F$},M$={Stringify:1,BeforeStream:2,Stream:3},ln=(t,e)=>{const n=new String(t);return n.isEscaped=!0,n.callbacks=e,n},q$=/[&<>'"]/,I1=async(t,e)=>{let n="";e||(e=[]);const r=await Promise.all(t);for(let i=r.length-1;n+=r[i],i--,!(i<0);i--){let o=r[i];typeof o=="object"&&e.push(...o.callbacks||[]);const a=o.isEscaped;if(o=await(typeof o=="object"?o.toString():o),typeof o=="object"&&e.push(...o.callbacks||[]),o.isEscaped??a)n+=o;else{const l=[n];_r(o,l),n=l[0]}}return ln(n,e)},_r=(t,e)=>{const n=t.search(q$);if(n===-1){e[0]+=t;return}let r,i,o=0;for(i=n;i<t.length;i++){switch(t.charCodeAt(i)){case 34:r="&quot;";break;case 39:r="&#39;";break;case 38:r="&amp;";break;case 60:r="&lt;";break;case 62:r="&gt;";break;default:continue}e[0]+=t.substring(o,i)+r,o=i+1}e[0]+=t.substring(o,i)},O1=t=>{const e=t.callbacks;if(!(e!=null&&e.length))return t;const n=[t],r={};return e.forEach(i=>i({phase:M$.Stringify,buffer:n,context:r})),n[0]},V$=T1.verify,H$=T1.decode;async function Gd(t){const{signingKeys:e}=await t.keys.list({q:"type:jwt_signing"});return await Promise.all(e.map(async r=>{const o=await new vl(r.cert).publicKey.export(),a=await crypto.subtle.exportKey("jwk",o);return hp.parse({...a,kid:r.kid})}))}s.z.object({alg:s.z.literal("RS256"),kty:s.z.literal("RSA"),use:s.z.literal("sig"),n:s.z.string(),e:s.z.string(),kid:s.z.string(),x5t:s.z.string(),x5c:s.z.array(s.z.string())});async function K$(t){if(t.JWKS_URL&&t.JWKS_SERVICE){const e=await t.JWKS_SERVICE.fetch(t.JWKS_URL);return e.ok?(await e.json()).keys:(console.warn(`JWKS fetch failed with status ${e.status}, falling back to database`),await Gd(t.data))}return await Gd(t.data)}async function G$(t,e){try{const{header:n}=H$(e),i=(await K$(t.env)).find(l=>l.kid===n.kid);if(!i)throw new C(401,{message:"No matching kid found"});const o=await crypto.subtle.importKey("jwk",i,{name:"RSASSA-PKCS1-v1_5",hash:"SHA-256"},!1,["verify"]);return await V$(e,o,"RS256")}catch(n){throw n instanceof C?n:new C(403,{message:"Invalid JWT signature"})}}function W$(t){return t.replace(/:([a-zA-Z_][a-zA-Z0-9_]*)/g,"{$1}")}function X$(t,e){return e.startsWith(t)?e:t+e}function mf(t){return async(e,n)=>{var l,u,d;const r=e.req.matchedRoutes.find(p=>p.method.toUpperCase()===e.req.method&&p.path!=="/*");if(!r)return await n();const i=W$(r.path),o="basePath"in r&&typeof r.basePath=="string"?r.basePath:"",a=t.openAPIRegistry.definitions.find(p=>"route"in p&&X$(o,p.route.path)===i&&p.route.method.toUpperCase()===e.req.method.toUpperCase());if(a&&"route"in a){const p=(u=(l=a.route.security)==null?void 0:l[0])==null?void 0:u.Bearer;if(!(p!=null&&p.length))return await n();const h=e.req.header("authorization")||"",[g,A]=h.split(" ");if((g==null?void 0:g.toLowerCase())!=="bearer"||!A)throw new C(401,{message:"Missing bearer token"});try{const $=await G$(e,A);e.set("user_id",$.sub),e.set("user",$);const N=$.permissions||[],D=((d=$.scope)==null?void 0:d.split(" "))||[];if(p.length&&!(p.some(O=>N.includes(O))||p.some(O=>D.includes(O))))throw new C(403,{message:"Unauthorized"})}catch($){throw $ instanceof C?$:new C(403,{message:"Invalid token"})}}return await n()}}const J$=new s.OpenAPIHono().openapi(s.createRoute({tags:["emails"],method:"get",path:"/",request:{headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:Qs}},description:"Email provider"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=await t.env.data.emailProviders.get(e);if(!n)throw new C(404,{message:"Email provider not found"});return t.json(n)}).openapi(s.createRoute({tags:["emails"],method:"post",path:"/",request:{headers:s.z.object({"tenant-id":s.z.string()}),body:{content:{"application/json":{schema:s.z.object(Qs.shape)}}}},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Branding settings"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json");return await t.env.data.emailProviders.create(e,n),t.text("OK",{status:201})}).openapi(s.createRoute({tags:["emails"],method:"patch",path:"/",request:{headers:s.z.object({"tenant-id":s.z.string()}),body:{content:{"application/json":{schema:s.z.object(Qs.shape).partial()}}}},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Branding settings"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json");return await t.env.data.emailProviders.update(e,n),t.text("OK")}),Y$=new s.OpenAPIHono().openapi(s.createRoute({tags:["sessions"],method:"get",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:Ac}},description:"A session"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param"),r=await t.env.data.sessions.get(e,n);if(!r)throw new C(404);return t.json(r)}).openapi(s.createRoute({tags:["sessions"],method:"delete",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param");if(!await t.env.data.sessions.remove(e,n))throw new C(404,{message:"Session not found"});return t.text("OK")}).openapi(s.createRoute({tags:["sessions"],method:"post",path:"/{id}/revoke",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{202:{description:"Sesssion deletion status"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param");if(!await t.env.data.sessions.update(e,n,{revoked_at:new Date().toDateString()}))throw new C(404,{message:"Session not found"});return t.text("Session deletion request accepted.",{status:202})}),Z$=new s.OpenAPIHono().openapi(s.createRoute({tags:["refresh_tokens"],method:"get",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:mp}},description:"A session"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param"),r=await t.env.data.refreshTokens.get(e,n);if(!r)throw new C(404);return t.json(r)}).openapi(s.createRoute({tags:["refresh_tokens"],method:"delete",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param");if(!await t.env.data.refreshTokens.remove(e,n))throw new C(404,{message:"Session not found"});return t.text("OK")}),Q$=new s.OpenAPIHono().openapi(s.createRoute({tags:["custom-domains"],method:"get",path:"/",request:{query:Lt,headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:s.z.array(dr)}},description:"List of custom domains"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=await t.env.data.customDomains.list(e);return t.json(n)}).openapi(s.createRoute({tags:["custom-domains"],method:"get",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:dr}},description:"A connection"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param"),r=await t.env.data.customDomains.get(e,n);if(!r)throw new C(404);return t.json(r)}).openapi(s.createRoute({tags:["custom-domains"],method:"delete",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param");if(!await t.env.data.customDomains.remove(e,n))throw new C(404,{message:"Custom domain not found"});return t.text("OK")}).openapi(s.createRoute({tags:["custom-domains"],method:"patch",path:"/{id}",request:{body:{content:{"application/json":{schema:s.z.object(dr.shape).partial()}}},params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:dr}},description:"The updated custom domain"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param"),r=t.req.valid("json");if(!await t.env.data.customDomains.update(e,n,r))throw new C(404);const o=await t.env.data.customDomains.get(e,n);if(!o)throw new C(404);return t.json(o)}).openapi(s.createRoute({tags:["custom-domains"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:s.z.object(fp.shape)}}},headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:dr}},description:"The created custom domain"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json"),r=await t.env.data.customDomains.create(e,n);return t.json(r,{status:201})}).openapi(s.createRoute({tags:["custom-domains"],method:"post",path:"/{id}/verify",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:dr}},description:"The custom domain"}}}),async()=>{throw new C(501,{message:"Not implemented"})});function $l(t,e){const n={};for(const[r,i]of Object.entries(e)){const o={};for(const[a,l]of Object.entries(i))typeof l=="function"?o[a]=async(...u)=>{const d=performance.now();try{const p=await l(...u),g=performance.now()-d,A=t.res.headers.get("Server-Timing")||"",$=A?`${A}, ${r}-${a};dur=${g.toFixed(2)}`:`${r}-${a};dur=${g.toFixed(2)}`;return t.res.headers.set("Server-Timing",$),p}catch(p){const g=performance.now()-d,A=t.res.headers.get("Server-Timing")||"",$=A?`${A}, ${r}-${a}-error;dur=${g.toFixed(2)}`:`${r}-${a}-error;dur=${g.toFixed(2)}`;throw t.res.headers.set("Server-Timing",$),p}}:o[a]=l;n[r]=o}return n}function xl(t){return t.ISSUER}function Ke(t){return t.UNIVERSAL_LOGIN_URL||`${t.ISSUER}u/`}function ct(t){return t.OAUTH_API_URL||t.ISSUER}async function Al(t,e){const n=t.req.header("x-forwarded-host");if(n){const i=await t.env.data.customDomains.getByDomain(n);if(i)return t.set("tenant_id",i.tenant_id),t.set("custom_domain",n),t.set("host",n),await e()}const r=t.req.header("host");if(r){t.set("host",r);const i=r.split(".");if(i.length>1&&typeof i[0]=="string"){const o=i[0];await t.env.data.tenants.get(o)&&t.set("tenant_id",o)}}else t.set("host",new URL(xl(t.env)).host);if(!t.var.tenant_id){const i=t.req.header("tenant-id");i&&t.set("tenant_id",i)}return await e()}const ex=s.z.object({name:s.z.string(),version:s.z.string(),env:s.z.object({node:s.z.string().optional()}).optional()});function tx(t){if(t)try{let e=t;try{e=atob(t)}catch{}try{const n=JSON.parse(e);return ex.parse(n)}catch{}}catch{return}}const El=async(t,e)=>{var l,u,d,p;const n=(l=t.req.query("auth0Client"))==null?void 0:l.slice(0,255),r=(u=t.req.header("x-forwarded-host")&&t.req.header("x-forwarded-for")?t.req.header("x-forwarded-for"):t.req.header("cf-connecting-ip")||t.req.header("x-real-ip"))==null?void 0:u.slice(0,45),i=(d=t.req.header("user-agent"))==null?void 0:d.slice(0,512),o=(p=t.req.header("cf-ipcountry"))==null?void 0:p.slice(0,2),a=n?tx(n):void 0;a&&t.set("auth0_client",a),r&&t.set("ip",r),i&&t.set("useragent",i),o&&t.set("countryCode",o),await e()};function nx(t,e,n,r){try{const i=`${t}:${e}:${JSON.stringify(n)}`;return r?`${r}:${i}`:i}catch{const o=`${t}:${e}:${Date.now()}-${Math.random()}`;return r?`${r}:${o}`:o}}function Sl(t,e){const{cache:n,defaultTtl:r,customTtls:i={},excludeMethods:o=[],cacheEntities:a=[],keyPrefix:l}=e,u=new Set(o),d=a.length===0,p=new Set(a),h={};for(const[g,A]of Object.entries(t)){const $=d||p.has(g),N={};for(const[D,O]of Object.entries(A))if(typeof O=="function"){if(!$){N[D]=O;continue}const x=`${g}:${D}`;if(u.has(x)){N[D]=O;continue}const M=i[x]??r,G=["create","update","remove","delete","set","used"].includes(D);N[D]=async(...F)=>{if(G)return await O.apply(A,F);const H=nx(g,D,F,l),W=await n.get(H);if(W!==null)if(W&&typeof W=="object"&&"isCachedNull"in W){const ue=W;return ue.isCachedNull?null:ue.value}else return W;const Y=await O.apply(A,F);if(M>=0)if(Y!==null)await n.set(H,Y,M);else{const ue={value:null,isCachedNull:!0};await n.set(H,ue,M)}return Y}}else N[D]=O;h[g]=N}return h}class rx{constructor(e={}){be(this,"cache",new Map);be(this,"accessOrder",new Map);be(this,"accessCounter",0);be(this,"cleanupTimer");this.config=e;const n=e.cleanupIntervalMs;n&&n>0&&(this.cleanupTimer=setInterval(()=>{this.cleanupExpired()},n))}async get(e){const n=this.cache.get(e);return n?n.expiresAt&&n.expiresAt<new Date?(this.cache.delete(e),this.accessOrder.delete(e),null):(this.accessOrder.set(e,++this.accessCounter),n.value):null}async set(e,n,r){let i;const o=r??this.config.defaultTtlSeconds,a=o!==void 0,l=a?Math.max(0,o):0;a&&(i=new Date(Date.now()+(l>0?l*1e3:-1))),this.config.maxEntries&&this.cache.size>=this.config.maxEntries&&!this.cache.has(e)&&this.evictLeastRecentlyUsed();const u={value:n,expiresAt:i};this.cache.set(e,u),this.accessOrder.set(e,++this.accessCounter)}async delete(e){const n=this.cache.has(e);return this.cache.delete(e),this.accessOrder.delete(e),n}async clear(){this.cache.clear(),this.accessOrder.clear(),this.accessCounter=0}getStats(){return{size:this.cache.size,maxEntries:this.config.maxEntries,defaultTtlSeconds:this.config.defaultTtlSeconds}}cleanupExpired(){const e=new Date,n=[];for(const[r,i]of this.cache.entries())i.expiresAt&&i.expiresAt<e&&n.push(r);for(const r of n)this.cache.delete(r),this.accessOrder.delete(r)}evictLeastRecentlyUsed(){let e=null,n=1/0;for(const[r,i]of this.accessOrder.entries())i<n&&(n=i,e=r);e&&(this.cache.delete(e),this.accessOrder.delete(e))}destroy(){this.cleanupTimer&&(clearInterval(this.cleanupTimer),this.cleanupTimer=void 0)}}function $s(t={}){return new rx(t)}const ix=mn.extend({forms:s.z.array(vi)}),ox=new s.OpenAPIHono().openapi(s.createRoute({tags:["forms"],method:"get",path:"/",request:{query:Lt,headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:s.z.union([s.z.array(vi),ix])}},description:"List of forms"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{page:n,per_page:r,include_totals:i=!1,sort:o,q:a}=t.req.valid("query"),l=await t.env.data.forms.list(e,{page:n,per_page:r,include_totals:i,sort:pn(o),q:a});return i?t.json(l):t.json(l.forms)}).openapi(s.createRoute({tags:["forms"],method:"get",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:vi}},description:"A form"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param"),r=await t.env.data.forms.get(e,n);if(!r)throw new C(404);return t.json(r)}).openapi(s.createRoute({tags:["forms"],method:"delete",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param");if(!await t.env.data.forms.remove(e,n))throw new C(404,{message:"Form not found"});return t.text("OK")}).openapi(s.createRoute({tags:["forms"],method:"patch",path:"/{id}",request:{body:{content:{"application/json":{schema:s.z.object(xa.shape).partial()}}},params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:vi}},description:"The updated form"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param"),r=t.req.valid("json");if(!await t.env.data.forms.update(e,n,r))throw new C(404,{message:"Form not found"});const o=await t.env.data.forms.get(e,n);if(!o)throw new C(404,{message:"Form not found"});return t.json(o)}).openapi(s.createRoute({tags:["forms"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:s.z.object(xa.shape)}}},headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:vi}},description:"A form"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json"),r=await t.env.data.forms.create(e,n);return t.json(r,{status:201})}),sx=mn.extend({roles:s.z.array(Pr)}),ax=new s.OpenAPIHono().openapi(s.createRoute({tags:["roles"],method:"get",path:"/",request:{query:Lt,headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:s.z.union([s.z.array(Pr),sx])}},description:"List of roles"}}}),async t=>{const{page:e,per_page:n,include_totals:r,sort:i,q:o}=t.req.valid("query"),{"tenant-id":a}=t.req.valid("header"),l=await t.env.data.roles.list(a,{page:e,per_page:n,include_totals:r,sort:pn(i),q:o});return r?t.json(l):t.json(l.roles)}).openapi(s.createRoute({tags:["roles"],method:"get",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:Pr}},description:"A role"}}}),async t=>{const{id:e}=t.req.valid("param"),{"tenant-id":n}=t.req.valid("header"),r=await t.env.data.roles.get(n,e);if(!r)throw new C(404);return t.json(r)}).openapi(s.createRoute({tags:["roles"],method:"post",path:"/",request:{headers:s.z.object({"tenant-id":s.z.string()}),body:{content:{"application/json":{schema:Sa}}}},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:Pr}},description:"Role created"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json"),r=await t.env.data.roles.create(e,n);return t.json(r,{status:201})}).openapi(s.createRoute({tags:["roles"],method:"patch",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()}),body:{content:{"application/json":{schema:Sa.partial()}}}},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:Pr}},description:"Updated role"}}}),async t=>{const{id:e}=t.req.valid("param"),{"tenant-id":n}=t.req.valid("header"),r=t.req.valid("json");if(!await t.env.data.roles.update(n,e,r))throw new C(404);const o=await t.env.data.roles.get(n,e);return t.json(o)}).openapi(s.createRoute({tags:["roles"],method:"delete",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async t=>{const{id:e}=t.req.valid("param"),{"tenant-id":n}=t.req.valid("header");if(!await t.env.data.roles.remove(n,e))throw new C(404);return t.text("OK")}).openapi(s.createRoute({tags:["roles"],method:"get",path:"/{id}/permissions",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()}),query:Lt},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:s_}},description:"Role permissions"}}}),async t=>{const{id:e}=t.req.valid("param"),{"tenant-id":n}=t.req.valid("header"),{page:r,per_page:i,sort:o,q:a}=t.req.valid("query");if(!await t.env.data.roles.get(n,e))throw new C(404,{message:"Role not found"});const u=await t.env.data.rolePermissions.list(n,e,{page:r,per_page:i,include_totals:!1,sort:pn(o),q:a});return t.json(u)}).openapi(s.createRoute({tags:["roles"],method:"post",path:"/{id}/permissions",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()}),body:{content:{"application/json":{schema:s.z.object({permissions:s.z.array(s.z.object({permission_name:s.z.string(),resource_server_identifier:s.z.string()}))})}}}},security:[{Bearer:["auth:write"]}],responses:{201:{description:"Permissions assigned to role"}}}),async t=>{const{id:e}=t.req.valid("param"),{"tenant-id":n}=t.req.valid("header"),{permissions:r}=t.req.valid("json");if(!await t.env.data.roles.get(n,e))throw new C(404,{message:"Role not found"});if(!await t.env.data.rolePermissions.assign(n,e,r.map(a=>({role_id:e,resource_server_identifier:a.resource_server_identifier,permission_name:a.permission_name}))))throw new C(500,{message:"Failed to assign permissions to role"});return t.json({message:"Permissions assigned successfully"},{status:201})}).openapi(s.createRoute({tags:["roles"],method:"delete",path:"/{id}/permissions",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()}),body:{content:{"application/json":{schema:s.z.object({permissions:s.z.array(s.z.object({permission_name:s.z.string(),resource_server_identifier:s.z.string()}))})}}}},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Permissions removed from role"}}}),async t=>{const{id:e}=t.req.valid("param"),{"tenant-id":n}=t.req.valid("header"),{permissions:r}=t.req.valid("json");if(!await t.env.data.roles.get(n,e))throw new C(404,{message:"Role not found"});if(!await t.env.data.rolePermissions.remove(n,e,r))throw new C(500,{message:"Failed to remove permissions from role"});return t.json({message:"Permissions removed successfully"})}),cx=mn.extend({resource_servers:s.z.array(Rr)}),lx=new s.OpenAPIHono().openapi(s.createRoute({tags:["resource-servers"],method:"get",path:"/",request:{query:Lt,headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:s.z.union([s.z.array(Rr),cx])}},description:"List of resource servers"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{page:n,per_page:r,include_totals:i=!1,sort:o,q:a}=t.req.valid("query"),l=await t.env.data.resourceServers.list(e,{page:n,per_page:r,include_totals:i,sort:pn(o),q:a});return i?t.json(l):t.json(l.resource_servers)}).openapi(s.createRoute({tags:["resource-servers"],method:"get",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:Rr}},description:"A resource server"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param"),r=await t.env.data.resourceServers.get(e,n);if(!r)throw new C(404);return t.json(r)}).openapi(s.createRoute({tags:["resource-servers"],method:"delete",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param");if(!await t.env.data.resourceServers.remove(e,n))throw new C(404,{message:"Resource server not found"});return t.text("OK")}).openapi(s.createRoute({tags:["resource-servers"],method:"patch",path:"/{id}",request:{body:{content:{"application/json":{schema:s.z.object(Ea.shape).partial()}}},params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:Rr}},description:"The updated resource server"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param"),r=t.req.valid("json");if(!await t.env.data.resourceServers.update(e,n,r))throw new C(404,{message:"Resource server not found"});const o=await t.env.data.resourceServers.get(e,n);if(!o)throw new C(404,{message:"Resource server not found"});return t.json(o)}).openapi(s.createRoute({tags:["resource-servers"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:s.z.object(Ea.shape)}}},headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:Rr}},description:"A resource server"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json"),r=await t.env.data.resourceServers.create(e,n);return t.json(r,{status:201})});function ux(t){const e=new s.OpenAPIHono;e.use(wm({origin:r=>{var i;return r&&(i=t.allowedOrigins)!=null&&i.includes(r)?r:""},allowHeaders:["Tenant-Id","Content-Type","Content-Range","Auth0-Client","Authorization","Range","Upgrade-Insecure-Requests"],allowMethods:["POST","PUT","GET","DELETE","PATCH","OPTIONS"],exposeHeaders:["Content-Length","Content-Range"],maxAge:600,credentials:!0})),gf(e),e.use(async(r,i)=>{const o=ns(r,t.dataAdapter),a=$s({defaultTtlSeconds:0,maxEntries:100,cleanupIntervalMs:0}),l=Sl(o,{defaultTtl:0,cacheEntities:["tenants","connections","clients","branding","themes","promptSettings","forms"],cache:a});return r.env.data=$l(r,l),i()}),e.use(El).use(Al).use(mf(e));const n=e.route("/branding",lv).route("/custom-domains",Q$).route("/email/providers",J$).route("/users",g3).route("/keys",f$).route("/users-by-email",h$).route("/clients",m$).route("/tenants",y$).route("/logs",v$).route("/hooks",$$).route("/connections",A$).route("/prompts",E$).route("/sessions",Y$).route("/refresh_tokens",Z$).route("/forms",ox).route("/roles",ax).route("/resource-servers",lx);return n.doc("/spec",{openapi:"3.0.0",info:{version:"1.0.0",title:"Management API"},servers:[{url:"/api/v2",description:"API V2"}],security:[{oauth2:["openid","email","profile"]}]}),n}function dx(t,e){Object.keys(e).forEach(n=>{const r=e[n];r!=null&&r.length&&t.searchParams.set(n,r)})}function Wn(t){var e;if(t)return`${t.name}/${t.version}${(e=t.env)!=null&&e.node?` (env: node/${t.env.node})`:""}`}var Y0;(function(t){t[t.Include=0]="Include",t[t.None=1]="None"})(Y0||(Y0={}));var Z0;(function(t){t[t.Required=0]="Required",t[t.Ignore=1]="Ignore"})(Z0||(Z0={}));function px(t){return D1(t,fx,Ho.Include)}function z1(t){return D1(t,hx,Ho.None)}function D1(t,e,n){let r="";for(let i=0;i<t.byteLength;i+=3){let o=0,a=0;for(let l=0;l<3&&i+l<t.byteLength;l++)o=o<<8|t[i+l],a+=8;for(let l=0;l<4;l++)a>=6?(r+=e[o>>a-6&63],a-=6):a>0?(r+=e[o<<6-a&63],a=0):n===Ho.Include&&(r+="=")}return r}const fx="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",hx="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";var Ho;(function(t){t[t.Include=0]="Include",t[t.None=1]="None"})(Ho||(Ho={}));var Q0;(function(t){t[t.Required=0]="Required",t[t.Ignore=1]="Ignore"})(Q0||(Q0={}));class gx{uint8(e,n){if(e.byteLength<n+1)throw new TypeError("Insufficient bytes");return e[n]}uint16(e,n){if(e.byteLength<n+2)throw new TypeError("Insufficient bytes");return e[n]<<8|e[n+1]}uint32(e,n){if(e.byteLength<n+4)throw new TypeError("Insufficient bytes");let r=0;for(let i=0;i<4;i++)r|=e[n+i]<<24-i*8;return r}uint64(e,n){if(e.byteLength<n+8)throw new TypeError("Insufficient bytes");let r=0n;for(let i=0;i<8;i++)r|=BigInt(e[n+i])<<BigInt(56-i*8);return r}putUint8(e,n,r){if(e.length<r+1)throw new TypeError("Not enough space");if(n<0||n>255)throw new TypeError("Invalid uint8 value");e[r]=n}putUint16(e,n,r){if(e.length<r+2)throw new TypeError("Not enough space");if(n<0||n>65535)throw new TypeError("Invalid uint16 value");e[r]=n>>8,e[r+1]=n&255}putUint32(e,n,r){if(e.length<r+4)throw new TypeError("Not enough space");if(n<0||n>4294967295)throw new TypeError("Invalid uint32 value");for(let i=0;i<4;i++)e[r+i]=n>>(3-i)*8&255}putUint64(e,n,r){if(e.length<r+8)throw new TypeError("Not enough space");if(n<0||n>18446744073709551615n)throw new TypeError("Invalid uint64 value");for(let i=0;i<8;i++)e[r+i]=Number(n>>BigInt((7-i)*8)&0xffn)}}const eg=new gx;function $n(t,e){return(t<<32-e|t>>>e)>>>0}function mx(t){const e=new _x;return e.update(t),e.digest()}class _x{constructor(){be(this,"blockSize",64);be(this,"size",32);be(this,"blocks",new Uint8Array(64));be(this,"currentBlockSize",0);be(this,"H",new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]));be(this,"l",0n);be(this,"w",new Uint32Array(64))}update(e){if(this.l+=BigInt(e.byteLength)*8n,this.currentBlockSize+e.byteLength<64){this.blocks.set(e,this.currentBlockSize),this.currentBlockSize+=e.byteLength;return}let n=0;if(this.currentBlockSize>0){const r=e.slice(0,64-this.currentBlockSize);this.blocks.set(r,this.currentBlockSize),this.process(),n+=r.byteLength,this.currentBlockSize=0}for(;n+64<=e.byteLength;){const r=e.slice(n,n+64);this.blocks.set(r),this.process(),n+=64}if(e.byteLength-n>0){const r=e.slice(n);this.blocks.set(r),this.currentBlockSize=r.byteLength}}digest(){this.blocks[this.currentBlockSize]=128,this.currentBlockSize+=1,64-this.currentBlockSize<8&&(this.blocks.fill(0,this.currentBlockSize),this.process(),this.currentBlockSize=0),this.blocks.fill(0,this.currentBlockSize),eg.putUint64(this.blocks,this.l,this.blockSize-8),this.process();const e=new Uint8Array(32);for(let n=0;n<8;n++)eg.putUint32(e,this.H[n],n*4);return e}process(){for(let d=0;d<16;d++)this.w[d]=(this.blocks[d*4]<<24|this.blocks[d*4+1]<<16|this.blocks[d*4+2]<<8|this.blocks[d*4+3])>>>0;for(let d=16;d<64;d++){const p=($n(this.w[d-2],17)^$n(this.w[d-2],19)^this.w[d-2]>>>10)>>>0,h=($n(this.w[d-15],7)^$n(this.w[d-15],18)^this.w[d-15]>>>3)>>>0;this.w[d]=p+this.w[d-7]+h+this.w[d-16]|0}let e=this.H[0],n=this.H[1],r=this.H[2],i=this.H[3],o=this.H[4],a=this.H[5],l=this.H[6],u=this.H[7];for(let d=0;d<64;d++){const p=($n(o,6)^$n(o,11)^$n(o,25))>>>0,h=(o&a^~o&l)>>>0,g=u+p+h+yx[d]+this.w[d]|0,A=($n(e,2)^$n(e,13)^$n(e,22))>>>0,$=(e&n^e&r^n&r)>>>0,N=A+$|0;u=l,l=a,a=o,o=i+g|0,i=r,r=n,n=e,e=g+N|0}this.H[0]=e+this.H[0]|0,this.H[1]=n+this.H[1]|0,this.H[2]=r+this.H[2]|0,this.H[3]=i+this.H[3]|0,this.H[4]=o+this.H[4]|0,this.H[5]=a+this.H[5]|0,this.H[6]=l+this.H[6]|0,this.H[7]=u+this.H[7]|0}}const yx=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);new BigUint64Array([0x428a2f98d728ae22n,0x7137449123ef65cdn,0xb5c0fbcfec4d3b2fn,0xe9b5dba58189dbbcn,0x3956c25bf348b538n,0x59f111f1b605d019n,0x923f82a4af194f9bn,0xab1c5ed5da6d8118n,0xd807aa98a3030242n,0x12835b0145706fben,0x243185be4ee4b28cn,0x550c7dc3d5ffb4e2n,0x72be5d74f27b896fn,0x80deb1fe3b1696b1n,0x9bdc06a725c71235n,0xc19bf174cf692694n,0xe49b69c19ef14ad2n,0xefbe4786384f25e3n,0x0fc19dc68b8cd5b5n,0x240ca1cc77ac9c65n,0x2de92c6f592b0275n,0x4a7484aa6ea6e483n,0x5cb0a9dcbd41fbd4n,0x76f988da831153b5n,0x983e5152ee66dfabn,0xa831c66d2db43210n,0xb00327c898fb213fn,0xbf597fc7beef0ee4n,0xc6e00bf33da88fc2n,0xd5a79147930aa725n,0x06ca6351e003826fn,0x142929670a0e6e70n,0x27b70a8546d22ffcn,0x2e1b21385c26c926n,0x4d2c6dfc5ac42aedn,0x53380d139d95b3dfn,0x650a73548baf63den,0x766a0abb3c77b2a8n,0x81c2c92e47edaee6n,0x92722c851482353bn,0xa2bfe8a14cf10364n,0xa81a664bbc423001n,0xc24b8b70d0f89791n,0xc76c51a30654be30n,0xd192e819d6ef5218n,0xd69906245565a910n,0xf40e35855771202an,0x106aa07032bbd1b8n,0x19a4c116b8d2d0c8n,0x1e376c085141ab53n,0x2748774cdf8eeb99n,0x34b0bcb5e19b48a8n,0x391c0cb3c5c95a63n,0x4ed8aa4ae3418acbn,0x5b9cca4f7763e373n,0x682e6ff3d6b2b8a3n,0x748f82ee5defb2fcn,0x78a5636f43172f60n,0x84c87814a1f0ab72n,0x8cc702081a6439ecn,0x90befffa23631e28n,0xa4506cebde82bde9n,0xbef9a3f7b2c67915n,0xc67178f2e372532bn,0xca273eceea26619cn,0xd186b8c721c0c207n,0xeada7dd6cde0eb1en,0xf57d4f7fee6ed178n,0x06f067aa72176fban,0x0a637dc5a2c898a6n,0x113f9804bef90daen,0x1b710b35131c471bn,0x28db77f523047d84n,0x32caab7b40c72493n,0x3c9ebe0a15c9bebcn,0x431d67c49c100d4cn,0x4cc5d4becb3e42b6n,0x597f299cfc657e2an,0x5fcb6fab3ad6faecn,0x6c44198c4a475817n]);class wx{constructor(e){be(this,"data");this.data=e}tokenType(){if("token_type"in this.data&&typeof this.data.token_type=="string")return this.data.token_type;throw new Error("Missing or invalid 'token_type' field")}accessToken(){if("access_token"in this.data&&typeof this.data.access_token=="string")return this.data.access_token;throw new Error("Missing or invalid 'access_token' field")}accessTokenExpiresInSeconds(){if("expires_in"in this.data&&typeof this.data.expires_in=="number")return this.data.expires_in;throw new Error("Missing or invalid 'expires_in' field")}accessTokenExpiresAt(){return new Date(Date.now()+this.accessTokenExpiresInSeconds()*1e3)}hasRefreshToken(){return"refresh_token"in this.data&&typeof this.data.refresh_token=="string"}refreshToken(){if("refresh_token"in this.data&&typeof this.data.refresh_token=="string")return this.data.refresh_token;throw new Error("Missing or invalid 'refresh_token' field")}hasScopes(){return"scope"in this.data&&typeof this.data.scope=="string"}scopes(){if("scope"in this.data&&typeof this.data.scope=="string")return this.data.scope.split(" ");throw new Error("Missing or invalid 'scope' field")}idToken(){if("id_token"in this.data&&typeof this.data.id_token=="string")return this.data.id_token;throw new Error("Missing or invalid field 'id_token'")}}function vx(t){const e=mx(new TextEncoder().encode(t));return z1(e)}function bx(){const t=new Uint8Array(32);return crypto.getRandomValues(t),z1(t)}function No(t,e){const n=new TextEncoder().encode(e.toString()),r=new Request(t,{method:"POST",body:n});return r.headers.set("Content-Type","application/x-www-form-urlencoded"),r.headers.set("Accept","application/json"),r.headers.set("User-Agent","arctic"),r.headers.set("Content-Length",n.byteLength.toString()),r}function eu(t,e){const n=new TextEncoder().encode(`${t}:${e}`);return px(n)}async function cc(t){let e;try{e=await fetch(t)}catch(n){throw new P1(n)}if(e.status===400||e.status===401){let n;try{n=await e.json()}catch{throw new oa(e.status)}if(typeof n!="object"||n===null)throw new Ci(e.status,n);let r;try{r=R1(n)}catch{throw new Ci(e.status,n)}throw r}if(e.status===200){let n;try{n=await e.json()}catch{throw new oa(e.status)}if(typeof n!="object"||n===null)throw new Ci(e.status,n);return new wx(n)}throw e.body!==null&&await e.body.cancel(),new oa(e.status)}async function $x(t){let e;try{e=await fetch(t)}catch(n){throw new P1(n)}if(e.status===400||e.status===401){let n;try{n=await e.json()}catch{throw new Ci(e.status,null)}if(typeof n!="object"||n===null)throw new Ci(e.status,n);let r;try{r=R1(n)}catch{throw new Ci(e.status,n)}throw r}if(e.status===200){e.body!==null&&await e.body.cancel();return}throw e.body!==null&&await e.body.cancel(),new oa(e.status)}function R1(t){let e;if("error"in t&&typeof t.error=="string")e=t.error;else throw new Error("Invalid error response");let n=null,r=null,i=null;if("error_description"in t){if(typeof t.error_description!="string")throw new Error("Invalid data");n=t.error_description}if("error_uri"in t){if(typeof t.error_uri!="string")throw new Error("Invalid data");r=t.error_uri}if("state"in t){if(typeof t.state!="string")throw new Error("Invalid data");i=t.state}return new xx(e,n,r,i)}class P1 extends Error{constructor(e){super("Failed to send request",{cause:e})}}class xx extends Error{constructor(n,r,i,o){super(`OAuth request error: ${n}`);be(this,"code");be(this,"description");be(this,"uri");be(this,"state");this.code=n,this.description=r,this.uri=i,this.state=o}}class oa extends Error{constructor(n){super("Unexpected error response");be(this,"status");this.status=n}}class Ci extends Error{constructor(n,r){super("Unexpected error response body");be(this,"status");be(this,"data");this.status=n,this.data=r}}class _f{constructor(e,n,r){be(this,"clientId");be(this,"clientPassword");be(this,"redirectURI");this.clientId=e,this.clientPassword=n,this.redirectURI=r}createAuthorizationURL(e,n,r){const i=new URL(e);return i.searchParams.set("response_type","code"),i.searchParams.set("client_id",this.clientId),this.redirectURI!==null&&i.searchParams.set("redirect_uri",this.redirectURI),i.searchParams.set("state",n),r.length>0&&i.searchParams.set("scope",r.join(" ")),i}createAuthorizationURLWithPKCE(e,n,r,i,o){const a=new URL(e);if(a.searchParams.set("response_type","code"),a.searchParams.set("client_id",this.clientId),this.redirectURI!==null&&a.searchParams.set("redirect_uri",this.redirectURI),a.searchParams.set("state",n),r===Ko.S256){const l=vx(i);a.searchParams.set("code_challenge_method","S256"),a.searchParams.set("code_challenge",l)}else r===Ko.Plain&&(a.searchParams.set("code_challenge_method","plain"),a.searchParams.set("code_challenge",i));return o.length>0&&a.searchParams.set("scope",o.join(" ")),a}async validateAuthorizationCode(e,n,r){const i=new URLSearchParams;i.set("grant_type","authorization_code"),i.set("code",n),this.redirectURI!==null&&i.set("redirect_uri",this.redirectURI),r!==null&&i.set("code_verifier",r),this.clientPassword===null&&i.set("client_id",this.clientId);const o=No(e,i);if(this.clientPassword!==null){const l=eu(this.clientId,this.clientPassword);o.headers.set("Authorization",`Basic ${l}`)}return await cc(o)}async refreshAccessToken(e,n,r){const i=new URLSearchParams;i.set("grant_type","refresh_token"),i.set("refresh_token",n),this.clientPassword===null&&i.set("client_id",this.clientId),r.length>0&&i.set("scope",r.join(" "));const o=No(e,i);if(this.clientPassword!==null){const l=eu(this.clientId,this.clientPassword);o.headers.set("Authorization",`Basic ${l}`)}return await cc(o)}async revokeToken(e,n){const r=new URLSearchParams;r.set("token",n),this.clientPassword===null&&r.set("client_id",this.clientId);const i=No(e,r);if(this.clientPassword!==null){const o=eu(this.clientId,this.clientPassword);i.headers.set("Authorization",`Basic ${o}`)}await $x(i)}}var Ko;(function(t){t[t.S256=0]="S256",t[t.Plain=1]="Plain"})(Ko||(Ko={}));var tg;(function(t){t[t.Include=0]="Include",t[t.None=1]="None"})(tg||(tg={}));var ng;(function(t){t[t.Required=0]="Required",t[t.Ignore=1]="Ignore"})(ng||(ng={}));function Co(t){return Ax(t,Ex,lc.None)}function Ax(t,e,n){let r="";for(let i=0;i<t.byteLength;i+=3){let o=0,a=0;for(let l=0;l<3&&i+l<t.byteLength;l++)o=o<<8|t[i+l],a+=8;for(let l=0;l<4;l++)a>=6?(r+=e[o>>a-6&63],a-=6):a>0?(r+=e[o<<6-a&63],a=0):n===lc.Include&&(r+="=")}return r}const Ex="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";var lc;(function(t){t[t.Include=0]="Include",t[t.None=1]="None"})(lc||(lc={}));var rg;(function(t){t[t.Required=0]="Required",t[t.Ignore=1]="Ignore"})(rg||(rg={}));function Sx(t,e,n){const r=Co(new TextEncoder().encode(t)),i=Co(new TextEncoder().encode(e)),o=Co(n);return r+"."+i+"."+o}function kx(t,e){const n=Co(new TextEncoder().encode(t)),r=Co(new TextEncoder().encode(e)),i=n+"."+r;return new TextEncoder().encode(i)}const Nx="https://appleid.apple.com/auth/authorize",Cx="https://appleid.apple.com/auth/token";class B1{constructor(e,n,r,i,o){be(this,"clientId");be(this,"teamId");be(this,"keyId");be(this,"pkcs8PrivateKey");be(this,"redirectURI");this.clientId=e,this.teamId=n,this.keyId=r,this.pkcs8PrivateKey=i,this.redirectURI=o}createAuthorizationURL(e,n){const r=new URL(Nx);return r.searchParams.set("response_type","code"),r.searchParams.set("client_id",this.clientId),r.searchParams.set("state",e),n.length>0&&r.searchParams.set("scope",n.join(" ")),r.searchParams.set("redirect_uri",this.redirectURI),r}async validateAuthorizationCode(e){const n=new URLSearchParams;n.set("grant_type","authorization_code"),n.set("code",e),n.set("redirect_uri",this.redirectURI),n.set("client_id",this.clientId);const r=await this.createClientSecret();n.set("client_secret",r);const i=No(Cx,n);return await cc(i)}async createClientSecret(){const e=await crypto.subtle.importKey("pkcs8",this.pkcs8PrivateKey,{name:"ECDSA",namedCurve:"P-256"},!1,["sign"]),n=Math.floor(Date.now()/1e3),r=JSON.stringify({typ:"JWT",alg:"ES256",kid:this.keyId}),i=JSON.stringify({iss:this.teamId,exp:n+5*60,aud:["https://appleid.apple.com"],sub:this.clientId,iat:n}),o=new Uint8Array(await crypto.subtle.sign({name:"ECDSA",hash:"SHA-256"},e,kx(r,i)));return Sx(r,i,o)}}const Tx="https://www.facebook.com/v16.0/dialog/oauth",Ix="https://graph.facebook.com/v16.0/oauth/access_token";class j1{constructor(e,n,r){be(this,"clientId");be(this,"clientSecret");be(this,"redirectURI");this.clientId=e,this.clientSecret=n,this.redirectURI=r}createAuthorizationURL(e,n){const r=new URL(Tx);return r.searchParams.set("response_type","code"),r.searchParams.set("client_id",this.clientId),r.searchParams.set("state",e),n.length>0&&r.searchParams.set("scope",n.join(" ")),r.searchParams.set("redirect_uri",this.redirectURI),r}async validateAuthorizationCode(e){const n=new URLSearchParams;n.set("grant_type","authorization_code"),n.set("code",e),n.set("redirect_uri",this.redirectURI),n.set("client_id",this.clientId),n.set("client_secret",this.clientSecret);const r=No(Ix,n);return await cc(r)}}const Ox="https://accounts.google.com/o/oauth2/v2/auth",ig="https://oauth2.googleapis.com/token",zx="https://oauth2.googleapis.com/revoke";let L1=class{constructor(e,n,r){be(this,"client");this.client=new _f(e,n,r)}createAuthorizationURL(e,n,r){return this.client.createAuthorizationURLWithPKCE(Ox,e,Ko.S256,n,r)}async validateAuthorizationCode(e,n){return await this.client.validateAuthorizationCode(ig,e,n)}async refreshAccessToken(e){return await this.client.refreshAccessToken(ig,e,[])}async revokeToken(e){await this.client.revokeToken(zx,e)}};const kl=s.z.object({iss:s.z.string().url(),sub:s.z.string(),aud:s.z.string(),exp:s.z.number(),email:s.z.string().optional(),given_name:s.z.string().optional(),family_name:s.z.string().optional(),name:s.z.string().optional(),iat:s.z.number(),auth_time:s.z.number().optional(),nonce:s.z.string().optional(),acr:s.z.string().optional(),amr:s.z.array(s.z.string()).optional(),azp:s.z.string().optional(),at_hash:s.z.string().optional(),c_hash:s.z.string().optional()}).passthrough();kl.omit({iat:!0,auth_time:!0,nonce:!0,acr:!0,amr:!0,azp:!0,at_hash:!0,c_hash:!0});function F1(t){const{options:e}=t;if(!e||!e.client_id||!e.team_id||!e.kid||!e.app_secret)throw new Error("Missing required Apple authentication parameters");const n=Buffer.from(e.app_secret,"utf-8"),r=n.toString().replace(/-----BEGIN PRIVATE KEY-----|-----END PRIVATE KEY-----|\s/g,""),i=Uint8Array.from(Buffer.from(r,"base64"));return n.fill(0),{options:e,keyArray:i}}async function Dx(t,e){var d,p;const{options:n,keyArray:r}=F1(e),i=`${ct(t.env)}callback`,o=new B1(n.client_id,n.team_id,n.kid,r,i),a=Ve(),l=await o.createAuthorizationURL(a,((d=n.scope)==null?void 0:d.split(" "))||["name","email"]);return(((p=n.scope)==null?void 0:p.split(" "))||["name","email"]).some(h=>["email","name"].includes(h))&&l.searchParams.set("response_mode","form_post"),{redirectUrl:l.href,code:a}}async function Rx(t,e,n){const{options:r,keyArray:i}=F1(e),a=await new B1(r.client_id,r.team_id,r.kid,i,`${ct(t.env)}callback`).validateAuthorizationCode(n),l=yp(a.idToken());if(!l)throw new Error("Invalid ID token");const u=kl.parse(l.payload);return{sub:u.sub,email:u.email,given_name:u.given_name,family_name:u.family_name,name:u.name,picture:u.picture,locale:u.locale}}const Px=Object.freeze(Object.defineProperty({__proto__:null,getRedirect:Dx,validateAuthorizationCodeAndGetUser:Rx},Symbol.toStringTag,{value:"Module"}));async function Bx(t,e){var l;const{options:n}=e;if(!(n!=null&&n.client_id)||!n.client_secret)throw new Error("Missing required authentication parameters");const r=`${ct(t.env)}callback`,i=new j1(n.client_id,n.client_secret,r),o=Ve();return{redirectUrl:i.createAuthorizationURL(o,((l=n.scope)==null?void 0:l.split(" "))||["email"]).href,code:o}}async function jx(t,e,n){const{options:r}=e;if(!(r!=null&&r.client_id)||!r.client_secret)throw new Error("Missing required authentication parameters");const o=await new j1(r.client_id,r.client_secret,`${ct(t.env)}callback`).validateAuthorizationCode(n),a=await fetch("https://graph.facebook.com/v22.0/me?fields=id,email,name",{headers:{Authorization:`Bearer ${o.accessToken()}`}});if(!a.ok)throw new Error("Failed to fetch user info");const l=await a.json();return t.set("log",`Userinfo: ${JSON.stringify(l)}`),{sub:l.id,email:l.email,name:l.name}}const Lx=Object.freeze(Object.defineProperty({__proto__:null,getRedirect:Bx,validateAuthorizationCodeAndGetUser:jx},Symbol.toStringTag,{value:"Module"}));async function Fx(t,e){var u;const{options:n}=e;if(!(n!=null&&n.client_id)||!n.client_secret)throw new Error("Missing required Google authentication parameters");const r=`${ct(t.env)}callback`,i=new L1(n.client_id,n.client_secret,r),o=Ve(),a=bx();return{redirectUrl:i.createAuthorizationURL(o,a,((u=n.scope)==null?void 0:u.split(" "))??["email","profile"]).href,code:o,codeVerifier:a}}async function Ux(t,e,n,r){const{options:i}=e;if(!(i!=null&&i.client_id)||!i.client_secret||!r)throw new Error("Missing required authentication parameters");const a=await new L1(i.client_id,i.client_secret,`${ct(t.env)}callback`).validateAuthorizationCode(n,r),l=yp(a.idToken());if(!l)throw new Error("Invalid ID token");const u=kl.parse(l.payload);return{sub:u.sub,email:u.email,given_name:u.given_name,family_name:u.family_name,name:u.name,picture:u.picture,locale:u.locale}}const Mx=Object.freeze(Object.defineProperty({__proto__:null,getRedirect:Fx,validateAuthorizationCodeAndGetUser:Ux},Symbol.toStringTag,{value:"Module"}));async function qx(t,e){var a;const{options:n}=e;if(!(n!=null&&n.client_id)||!n.client_secret)throw new Error("Missing required authentication parameters");const r=new _f(n.client_id,n.client_secret,`${ct(t.env)}callback`),i=Ve(),o=r.createAuthorizationURL("https://api.vipps.no/access-management-1.0/access/oauth2/auth",i,((a=n.scope)==null?void 0:a.split(" "))||["openid","email","phoneNumber","name","address","birthDate"]);return o.searchParams.set("response_type","code"),o.searchParams.set("response_mode","query"),{redirectUrl:o.href,code:i}}async function Vx(t,e,n){const{options:r}=e;if(!(r!=null&&r.client_id)||!r.client_secret)throw new Error("Missing required authentication parameters");const o=await new _f(r.client_id,r.client_secret,`${ct(t.env)}callback`).validateAuthorizationCode("https://api.vipps.no/access-management-1.0/access/oauth2/token",n,null),a=yp(o.idToken());if(!a)throw new Error("Invalid ID token");const l=kl.parse(a.payload);if(typeof l.msn!="string")throw new Error("msn not available in id token");const u=await fetch("https://api.vipps.no/vipps-userinfo-api/userinfo",{headers:{Authorization:`Bearer ${o.accessToken()}`,"Merchant-Serial-Number":l.msn}});if(!u.ok)throw new C(400,{message:"Failed to get user from vipps"});return await u.json()}const Hx=Object.freeze(Object.defineProperty({__proto__:null,getRedirect:qx,validateAuthorizationCodeAndGetUser:Vx},Symbol.toStringTag,{value:"Module"}));function U1(t,e){const n=t.env.STRATEGIES||{},i={apple:Px,facebook:Lx,"google-oauth2":Mx,vipps:Hx,...n}[e];if(!i)throw new Error(`Strategy ${e} not found`);return i}async function ao(t,e){const n=await t.data.clients.get(e);if(!n)throw new C(403,{message:"Client not found"});let r=n;if(t.DEFAULT_CLIENT_ID||t.DEFAULT_TENANT_ID){const i=t.DEFAULT_CLIENT_ID?await t.data.clients.get(t.DEFAULT_CLIENT_ID):void 0,o=await t.data.connections.list(n.tenant.id),a=t.DEFAULT_TENANT_ID?await t.data.connections.list(t.DEFAULT_TENANT_ID):{connections:[]},l=o.connections.map(u=>{var h;const d=(h=a.connections)==null?void 0:h.find(g=>g.name===u.name);if(!(d!=null&&d.options))return u;const p=on.parse({...d||{},...u});return p.options=Ei.passthrough().parse({...d.options||{},...u.options}),p}).filter(u=>u);r={...n,web_origins:[...(i==null?void 0:i.web_origins)||[],...n.web_origins||[]],allowed_logout_urls:[...(i==null?void 0:i.allowed_logout_urls)||[],...n.allowed_logout_urls||[]],callbacks:[...(i==null?void 0:i.callbacks)||[],...n.callbacks||[]],connections:l,tenant:{...(i==null?void 0:i.tenant)||{},...n.tenant}}}return{...r,web_origins:[...r.web_origins||[],`${Ke(t)}login`],allowed_logout_urls:[...r.allowed_logout_urls||[],t.ISSUER],callbacks:[...r.callbacks||[],`${Ke(t)}info`]}}async function og(t,e,n,r){if(!r.state)throw new C(400,{message:"State not found"});const i=e.connections.find(u=>u.name===n);if(!i){t.set("client_id",e.id);const u=Me(t,{type:Le.FAILED_LOGIN,description:"Connection not found"});throw await t.env.data.logs.create(e.tenant.id,u),new C(403,{message:"Connection Not Found"})}let o=await t.env.data.loginSessions.get(e.tenant.id,r.state);if(!o){const u=t.get("ip"),d=t.get("useragent"),p=t.get("auth0_client");o=await t.env.data.loginSessions.create(e.tenant.id,{expires_at:new Date(Date.now()+qr*1e3).toISOString(),authParams:r,csrf_token:Ve(),ip:u,useragent:d,auth0Client:Wn(p)})}const l=await U1(t,i.strategy).getRedirect(t,i);return await t.env.data.codes.create(e.tenant.id,{login_id:o.id,code_id:l.code,code_type:"oauth2_state",connection_id:i.id,code_verifier:l.codeVerifier,expires_at:new Date(Date.now()+Iv*1e3).toISOString()}),new Response(null,{status:302,headers:{location:l.redirectUrl}})}async function sg(t,{code:e,state:n}){var $;const{env:r}=t,i=await r.data.codes.get(t.var.tenant_id||"",n,"oauth2_state");if(!i||!i.connection_id)throw new C(403,{message:"State not found"});const o=await r.data.loginSessions.get(t.var.tenant_id||"",i.login_id);if(!o)throw new C(403,{message:"Session not found"});if(o.authorization_url){const N=new URL(o.authorization_url).hostname,D=t.var.host||"";if(N!==D&&N){const O=new URL(`https://${N}/callback`);return O.searchParams.set("state",n),O.searchParams.set("code",e),new Response("Redirecting",{status:307,headers:{location:O.toString()}})}}const a=await ao(r,o.authParams.client_id);t.set("client_id",a.id),t.set("tenant_id",a.tenant.id);const l=a.connections.find(N=>N.id===i.connection_id);if(!l){const N=Me(t,{type:Le.FAILED_LOGIN,description:"Connection not found"});throw await r.data.logs.create(a.tenant.id,N),new C(403,{message:"Connection not found"})}if(t.set("connection",l.name),!o.authParams.redirect_uri){const N=Me(t,{type:Le.FAILED_LOGIN,description:"Redirect URI not defined"});throw await r.data.logs.create(a.tenant.id,N),new C(403,{message:"Redirect URI not defined"})}const d=await U1(t,l.strategy).validateAuthorizationCodeAndGetUser(t,l,e,i.code_verifier),{sub:p,...h}=d;t.set("user_id",p);const g=(($=d.email)==null?void 0:$.toLocaleLowerCase())||`${l.name}.${p}@${new URL(t.env.ISSUER).hostname}`;t.set("username",g);const A=await Tc(t,{client:a,username:g,provider:l.strategy,connection:l.name,userId:p,profileData:h,isSocial:!0,ip:t.req.header("x-real-ip")});return Sr(t,{client:a,authParams:o.authParams,loginSession:o,user:A})}async function ag(t,e,n,r,i,o){const a=await t.env.data.codes.get(t.var.tenant_id||"",e,"oauth2_state");if(!a)throw new C(400,{message:"State not found"});const l=await t.env.data.loginSessions.get(t.var.tenant_id,a.login_id);if(!l)throw new C(400,{message:"Login not found"});const{redirect_uri:u}=l.authParams;if(!u)throw new C(400,{message:"Redirect uri not found"});const d=Me(t,{type:Le.FAILED_LOGIN,description:`Failed connection login: ${i} ${n}, ${r}`});Bt(t,t.env.data.logs.create(t.var.tenant_id,d));const p=new URL(u);return dx(p,{error:n,error_description:r,error_reason:o,error_code:i,state:l.authParams.state}),t.redirect(`${Ke(t.env)}login/identifier?state=${l.id}&error=${n}`)}const Kx=new s.OpenAPIHono().openapi(s.createRoute({tags:["oauth2"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string(),code:s.z.string().optional(),scope:s.z.string().optional(),hd:s.z.string().optional(),error:s.z.string().optional(),error_description:s.z.string().optional(),error_code:s.z.string().optional(),error_reason:s.z.string().optional()})},responses:{302:{description:"Redirect to the client's redirect uri"},400:{description:"Bad Request",content:{"application/json":{schema:s.z.object({message:s.z.string()})}}},500:{description:"Internal Server Error",content:{"application/json":{schema:s.z.object({message:s.z.string()})}}}}}),async t=>{const{state:e,code:n,error:r,error_description:i,error_code:o,error_reason:a}=t.req.valid("query");if(r)return ag(t,e,r,i,o,a);if(!n)throw new C(400,{message:"Code is required"});const l=await sg(t,{code:n,state:e});if(!(l instanceof Response))throw new C(500,{message:"Internal server error"});return l}).openapi(s.createRoute({tags:["oauth2"],method:"post",path:"/",request:{body:{content:{"application/x-www-form-urlencoded":{schema:s.z.object({state:s.z.string(),code:s.z.string().optional(),scope:s.z.string().optional(),hd:s.z.string().optional(),error:s.z.string().optional(),error_description:s.z.string().optional(),error_code:s.z.string().optional(),error_reason:s.z.string().optional()})}}}},responses:{302:{description:"Redirect to the client's redirect uri"},400:{description:"Bad Request",content:{"application/json":{schema:s.z.object({message:s.z.string()})}}},500:{description:"Internal Server Error",content:{"application/json":{schema:s.z.object({message:s.z.string()})}}}}}),async t=>{const{state:e,code:n,error:r,error_description:i,error_code:o,error_reason:a}=t.req.valid("form");if(r)return ag(t,e,r,i,o,a);if(!n)throw new C(400,{message:"Code is required"});const l=await sg(t,{code:n,state:e});if(!(l instanceof Response))throw new C(500,{message:"Internal server error"});return l});function yf(t,e=[],n={}){try{const r=new URL(t);return e.some(i=>{try{return Gx(r,new URL(i),n.allowPathWildcards)}catch{return!1}})}catch{return!1}}function Gx(t,e,n){if(t.protocol!==e.protocol)return!1;if(n&&e.pathname.includes("*")){const r=e.pathname.replace(/\*/g,".*").replace(/\//g,"\\/");if(!new RegExp(`^${r}$`).test(t.pathname))return!1}else if(t.pathname!==e.pathname)return!1;if(e.hostname.startsWith("*.")&&e.hostname.split(".").length>2&&["http:","https:"].includes(e.protocol)){const r=e.hostname.split(".").slice(1).join(".");return t.hostname.endsWith(r)}return t.hostname===e.hostname}const Wx=new s.OpenAPIHono().openapi(s.createRoute({tags:["oauth2"],method:"get",path:"/",request:{query:s.z.object({client_id:s.z.string(),returnTo:s.z.string().optional()}),header:s.z.object({cookie:s.z.string().optional()})},responses:{302:{description:"Log the user out"}}}),async t=>{const{client_id:e,returnTo:n}=t.req.valid("query"),r=await t.env.data.clients.get(e);if(!r)return t.text("OK");const i=await t.env.data.clients.get("DEFAULT_CLIENT");t.set("client_id",e),t.set("tenant_id",r.tenant.id);const o=n||t.req.header("referer");if(!o)return t.text("OK");if(!yf(o,[...r.allowed_logout_urls||[],...(i==null?void 0:i.allowed_logout_urls)||[]],{allowPathWildcards:!0}))throw new C(400,{message:"Invalid redirect uri"});const a=t.req.header("cookie");if(a){const u=Tn(r.tenant.id,a);if(u){const d=await t.env.data.sessions.get(r.tenant.id,u);if(d){const p=await t.env.data.users.get(r.tenant.id,d.user_id);p&&(t.set("user_id",p.user_id),t.set("connection",p.connection));const h=await t.env.data.refreshTokens.list(r.tenant.id,{q:`session_id=${u}`,page:0,per_page:100,include_totals:!1});await Promise.all(h.refresh_tokens.map(g=>t.env.data.refreshTokens.remove(r.tenant.id,g.id))),await t.env.data.sessions.update(r.tenant.id,u,{revoked_at:new Date().toISOString()})}}}const l=Me(t,{type:Le.SUCCESS_LOGOUT,description:"User successfully logged out"});return await t.env.data.logs.create(r.tenant.id,l),new Response("Redirecting",{status:302,headers:{"set-cookie":Pv(r.tenant.id,t.req.header("host")),location:o}})}),cg=s.z.object({sub:s.z.string(),email:s.z.string().optional(),family_name:s.z.string().optional(),given_name:s.z.string().optional(),email_verified:s.z.boolean()}),Xx=new s.OpenAPIHono().openapi(s.createRoute({tags:["oauth2"],method:"get",path:"/",request:{},security:[{Bearer:["openid"]}],responses:{200:{content:{"application/json":{schema:cg}},description:"Userinfo"}}}),async t=>{if(!t.var.user)throw new C(404,{message:"User not found"});const e=await t.env.data.users.get(t.var.user.tenant_id,t.var.user.sub);if(!e)throw new C(404,{message:"User not found"});return t.json(cg.parse({...e,sub:e.user_id}))}),Jx=new s.OpenAPIHono().openapi(s.createRoute({tags:["well known"],method:"get",path:"/jwks.json",request:{},responses:{200:{content:{"application/json":{schema:qm}},description:"List of tenants"}}}),async t=>{const e=await Gd(t.env.data);return t.json({keys:e},{headers:{"access-control-allow-origin":"*","access-control-allow-method":"GET","cache-control":`public, max-age=${js}, stale-while-revalidate=${js*2}, stale-if-error=86400`}})}).openapi(s.createRoute({tags:["well known"],method:"get",path:"/openid-configuration",request:{},responses:{200:{content:{"application/json":{schema:vu}},description:"List of tenants"}}}),async t=>{const e=vu.parse({issuer:xl(t.env),authorization_endpoint:`${ct(t.env)}authorize`,token_endpoint:`${ct(t.env)}oauth/token`,device_authorization_endpoint:`${ct(t.env)}oauth/device/code`,userinfo_endpoint:`${ct(t.env)}userinfo`,mfa_challenge_endpoint:`${ct(t.env)}mfa/challenge`,jwks_uri:`${ct(t.env)}.well-known/jwks.json`,registration_endpoint:`${ct(t.env)}oidc/register`,revocation_endpoint:`${ct(t.env)}oauth/revoke`,scopes_supported:["openid","profile","offline_access","name","given_name","family_name","nickname","email","email_verified","picture","created_at","identities","phone","address"],response_types_supported:["code","token","id_token","code token","code id_token","token id_token","code token id_token"],code_challenge_methods_supported:["S256","plain"],response_modes_supported:["query","fragment","form_post"],subject_types_supported:["public"],id_token_signing_alg_values_supported:["RS256"],token_endpoint_auth_methods_supported:["client_secret_basic","client_secret_post"],claims_supported:["aud","auth_time","created_at","email","email_verified","exp","family_name","given_name","iat","identities","iss","name","nickname","phone_number","picture","sub"],request_uri_parameter_supported:!1,request_parameter_supported:!1,token_endpoint_auth_signing_alg_values_supported:["RS256","RS384","PS256"]});return t.json(e,{headers:{"access-control-allow-origin":"*","access-control-allow-method":"GET","cache-control":`public, max-age=${js}, stale-while-revalidate=${js*2}, stale-if-error=86400`}})});function sa(t,e){if(!t||!e||t.length!==e.length)return!1;let n=0;for(let r=0;r<t.length;r++)n|=t.charCodeAt(r)^e.charCodeAt(r);return n===0}const M1=s.z.object({grant_type:s.z.literal("client_credentials"),scope:s.z.string().optional(),client_secret:s.z.string(),client_id:s.z.string(),audience:s.z.string().optional()});async function Yx(t,e){const n=await t.env.data.clients.get(e.client_id);if(!n)throw new C(403,{message:"Invalid client credentials"});if(n.client_secret&&!sa(n.client_secret,e.client_secret))throw new C(403,{message:"Invalid client credentials"});const r={client_id:n.id,scope:e.scope,audience:e.audience};return{client:n,authParams:r}}const Zx=s.z.object({grant_type:s.z.literal("authorization_code"),client_id:s.z.string(),code:s.z.string(),redirect_uri:s.z.string().optional(),client_secret:s.z.string().optional(),code_verifier:s.z.string().optional()}).refine(t=>"client_secret"in t&&!("code_verifier"in t)||!("client_secret"in t)&&"code_verifier"in t,{message:"Must provide either client_secret (standard flow) or code_verifier/code_verifier_mode (PKCE flow), but not both"});async function Qx(t,e){var l;const n=await t.env.data.clients.get(e.client_id);if(!n)throw new C(403,{message:"Client not found"});const r=await t.env.data.codes.get(n.tenant.id,e.code,"authorization_code");if(!r||!r.user_id)throw new C(403,{message:"Invalid client credentials"});if(new Date(r.expires_at)<new Date)throw new C(403,{message:"Code expired"});if(r.used_at)throw new C(403,{message:"Code already used"});const i=await t.env.data.loginSessions.get(n.tenant.id,r.login_id);if(!i)throw new C(403,{message:"Invalid login"});if("client_secret"in e){const u=await t.env.data.clients.get("DEFAULT_CLIENT");if(!sa(n.client_secret,e.client_secret)&&!sa(u==null?void 0:u.client_secret,e.client_secret))throw new C(403,{message:"Invalid client credentials"})}else if(r.code_challenge&&r.code_challenge_method&&e.code_verifier){const u=await Nv(e.code_verifier,r.code_challenge_method);if(!sa(u,r.code_challenge))throw new C(403,{message:"Invalid client credentials"})}if(r.redirect_uri&&r.redirect_uri!==e.redirect_uri)throw new C(403,{message:"Invalid redirect uri"});const o=await t.env.data.users.get(n.tenant.id,r.user_id);if(!o)throw new C(403,{message:"User not found"});await t.env.data.codes.used(n.tenant.id,e.code);let a;return i.session_id&&((l=i.authParams.scope)!=null&&l.split(" ").includes("offline_access"))&&(a=await C_(t,{user:o,client:n,session_id:i.session_id,scope:i.authParams.scope,audience:i.authParams.audience})),{user:o,client:n,loginSession:i,session_id:i.session_id,refresh_token:a==null?void 0:a.id,authParams:{...i.authParams,state:r.state,nonce:r.nonce,response_mode:Sn.WEB_MESSAGE,client_id:n.id,scope:i.authParams.scope,audience:i.authParams.audience}}}const e5=s.z.object({grant_type:s.z.literal("refresh_token"),client_id:s.z.string(),redirect_uri:s.z.string().optional(),refresh_token:s.z.string()});async function t5(t,e){const n=await t.env.data.clients.get(e.client_id);if(!n)throw new C(403,{message:"Client not found"});const r=await t.env.data.refreshTokens.get(n.tenant.id,e.refresh_token);if(r){if(r.expires_at&&new Date(r.expires_at)<new Date||r.idle_expires_at&&new Date(r.idle_expires_at)<new Date)throw new C(403,{message:JSON.stringify({error:"invalid_grant",error_description:"Refresh token has expired"})})}else throw new C(403,{message:JSON.stringify({error:"invalid_grant",error_description:"Invalid refresh token"})});const i=await t.env.data.users.get(n.tenant.id,r.user_id);if(!i)throw new C(403,{message:"User not found"});const o=r.resource_servers[0];if(r.idle_expires_at){const a=new Date(Date.now()+2592e6);await t.env.data.refreshTokens.update(n.tenant.id,r.id,{idle_expires_at:a.toISOString(),last_exchanged_at:new Date().toISOString(),device:{...r.device,last_ip:t.req.header["x-real-ip"]||"",last_user_agent:t.req.header["user-agent"]||""}})}return{user:i,client:n,refresh_token:r.id,session_id:r.session_id,authParams:{client_id:n.id,audience:o==null?void 0:o.audience,scope:o==null?void 0:o.scopes,response_mode:Sn.WEB_MESSAGE}}}const n5={version:4,country_calling_codes:{1:["US","AG","AI","AS","BB","BM","BS","CA","DM","DO","GD","GU","JM","KN","KY","LC","MP","MS","PR","SX","TC","TT","VC","VG","VI"],7:["RU","KZ"],20:["EG"],27:["ZA"],30:["GR"],31:["NL"],32:["BE"],33:["FR"],34:["ES"],36:["HU"],39:["IT","VA"],40:["RO"],41:["CH"],43:["AT"],44:["GB","GG","IM","JE"],45:["DK"],46:["SE"],47:["NO","SJ"],48:["PL"],49:["DE"],51:["PE"],52:["MX"],53:["CU"],54:["AR"],55:["BR"],56:["CL"],57:["CO"],58:["VE"],60:["MY"],61:["AU","CC","CX"],62:["ID"],63:["PH"],64:["NZ"],65:["SG"],66:["TH"],81:["JP"],82:["KR"],84:["VN"],86:["CN"],90:["TR"],91:["IN"],92:["PK"],93:["AF"],94:["LK"],95:["MM"],98:["IR"],211:["SS"],212:["MA","EH"],213:["DZ"],216:["TN"],218:["LY"],220:["GM"],221:["SN"],222:["MR"],223:["ML"],224:["GN"],225:["CI"],226:["BF"],227:["NE"],228:["TG"],229:["BJ"],230:["MU"],231:["LR"],232:["SL"],233:["GH"],234:["NG"],235:["TD"],236:["CF"],237:["CM"],238:["CV"],239:["ST"],240:["GQ"],241:["GA"],242:["CG"],243:["CD"],244:["AO"],245:["GW"],246:["IO"],247:["AC"],248:["SC"],249:["SD"],250:["RW"],251:["ET"],252:["SO"],253:["DJ"],254:["KE"],255:["TZ"],256:["UG"],257:["BI"],258:["MZ"],260:["ZM"],261:["MG"],262:["RE","YT"],263:["ZW"],264:["NA"],265:["MW"],266:["LS"],267:["BW"],268:["SZ"],269:["KM"],290:["SH","TA"],291:["ER"],297:["AW"],298:["FO"],299:["GL"],350:["GI"],351:["PT"],352:["LU"],353:["IE"],354:["IS"],355:["AL"],356:["MT"],357:["CY"],358:["FI","AX"],359:["BG"],370:["LT"],371:["LV"],372:["EE"],373:["MD"],374:["AM"],375:["BY"],376:["AD"],377:["MC"],378:["SM"],380:["UA"],381:["RS"],382:["ME"],383:["XK"],385:["HR"],386:["SI"],387:["BA"],389:["MK"],420:["CZ"],421:["SK"],423:["LI"],500:["FK"],501:["BZ"],502:["GT"],503:["SV"],504:["HN"],505:["NI"],506:["CR"],507:["PA"],508:["PM"],509:["HT"],590:["GP","BL","MF"],591:["BO"],592:["GY"],593:["EC"],594:["GF"],595:["PY"],596:["MQ"],597:["SR"],598:["UY"],599:["CW","BQ"],670:["TL"],672:["NF"],673:["BN"],674:["NR"],675:["PG"],676:["TO"],677:["SB"],678:["VU"],679:["FJ"],680:["PW"],681:["WF"],682:["CK"],683:["NU"],685:["WS"],686:["KI"],687:["NC"],688:["TV"],689:["PF"],690:["TK"],691:["FM"],692:["MH"],850:["KP"],852:["HK"],853:["MO"],855:["KH"],856:["LA"],880:["BD"],886:["TW"],960:["MV"],961:["LB"],962:["JO"],963:["SY"],964:["IQ"],965:["KW"],966:["SA"],967:["YE"],968:["OM"],970:["PS"],971:["AE"],972:["IL"],973:["BH"],974:["QA"],975:["BT"],976:["MN"],977:["NP"],992:["TJ"],993:["TM"],994:["AZ"],995:["GE"],996:["KG"],998:["UZ"]},countries:{AC:["247","00","(?:[01589]\\d|[46])\\d{4}",[5,6]],AD:["376","00","(?:1|6\\d)\\d{7}|[135-9]\\d{5}",[6,8,9],[["(\\d{3})(\\d{3})","$1 $2",["[135-9]"]],["(\\d{4})(\\d{4})","$1 $2",["1"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6"]]]],AE:["971","00","(?:[4-7]\\d|9[0-689])\\d{7}|800\\d{2,9}|[2-4679]\\d{7}",[5,6,7,8,9,10,11,12],[["(\\d{3})(\\d{2,9})","$1 $2",["60|8"]],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[236]|[479][2-8]"],"0$1"],["(\\d{3})(\\d)(\\d{5})","$1 $2 $3",["[479]"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["5"],"0$1"]],"0"],AF:["93","00","[2-7]\\d{8}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[2-7]"],"0$1"]],"0"],AG:["1","011","(?:268|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([457]\\d{6})$|1","268$1",0,"268"],AI:["1","011","(?:264|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2457]\\d{6})$|1","264$1",0,"264"],AL:["355","00","(?:700\\d\\d|900)\\d{3}|8\\d{5,7}|(?:[2-5]|6\\d)\\d{7}",[6,7,8,9],[["(\\d{3})(\\d{3,4})","$1 $2",["80|9"],"0$1"],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["4[2-6]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[2358][2-5]|4"],"0$1"],["(\\d{3})(\\d{5})","$1 $2",["[23578]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["6"],"0$1"]],"0"],AM:["374","00","(?:[1-489]\\d|55|60|77)\\d{6}",[8],[["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[89]0"],"0 $1"],["(\\d{3})(\\d{5})","$1 $2",["2|3[12]"],"(0$1)"],["(\\d{2})(\\d{6})","$1 $2",["1|47"],"(0$1)"],["(\\d{2})(\\d{6})","$1 $2",["[3-9]"],"0$1"]],"0"],AO:["244","00","[29]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[29]"]]]],AR:["54","00","(?:11|[89]\\d\\d)\\d{8}|[2368]\\d{9}",[10,11],[["(\\d{4})(\\d{2})(\\d{4})","$1 $2-$3",["2(?:2[024-9]|3[0-59]|47|6[245]|9[02-8])|3(?:3[28]|4[03-9]|5[2-46-8]|7[1-578]|8[2-9])","2(?:[23]02|6(?:[25]|4[6-8])|9(?:[02356]|4[02568]|72|8[23]))|3(?:3[28]|4(?:[04679]|3[5-8]|5[4-68]|8[2379])|5(?:[2467]|3[237]|8[2-5])|7[1-578]|8(?:[2469]|3[2578]|5[4-8]|7[36-8]|8[5-8]))|2(?:2[24-9]|3[1-59]|47)","2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3[78]|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8[23])|7[1-578]|8(?:[2469]|3[278]|5[56][46]|86[3-6]))|2(?:2[24-9]|3[1-59]|47)|38(?:[58][78]|7[378])|3(?:4[35][56]|58[45]|8(?:[38]5|54|76))[4-6]","2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3(?:5(?:4[0-25689]|[56])|[78])|58|8[2379])|5(?:[2467]|3[237]|8(?:[23]|4(?:[45]|60)|5(?:4[0-39]|5|64)))|7[1-578]|8(?:[2469]|3[278]|54(?:4|5[13-7]|6[89])|86[3-6]))|2(?:2[24-9]|3[1-59]|47)|38(?:[58][78]|7[378])|3(?:454|85[56])[46]|3(?:4(?:36|5[56])|8(?:[38]5|76))[4-6]"],"0$1",1],["(\\d{2})(\\d{4})(\\d{4})","$1 $2-$3",["1"],"0$1",1],["(\\d{3})(\\d{3})(\\d{4})","$1-$2-$3",["[68]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2-$3",["[23]"],"0$1",1],["(\\d)(\\d{4})(\\d{2})(\\d{4})","$2 15-$3-$4",["9(?:2[2-469]|3[3-578])","9(?:2(?:2[024-9]|3[0-59]|47|6[245]|9[02-8])|3(?:3[28]|4[03-9]|5[2-46-8]|7[1-578]|8[2-9]))","9(?:2(?:[23]02|6(?:[25]|4[6-8])|9(?:[02356]|4[02568]|72|8[23]))|3(?:3[28]|4(?:[04679]|3[5-8]|5[4-68]|8[2379])|5(?:[2467]|3[237]|8[2-5])|7[1-578]|8(?:[2469]|3[2578]|5[4-8]|7[36-8]|8[5-8])))|92(?:2[24-9]|3[1-59]|47)","9(?:2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3[78]|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8[23])|7[1-578]|8(?:[2469]|3[278]|5(?:[56][46]|[78])|7[378]|8(?:6[3-6]|[78]))))|92(?:2[24-9]|3[1-59]|47)|93(?:4[35][56]|58[45]|8(?:[38]5|54|76))[4-6]","9(?:2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3(?:5(?:4[0-25689]|[56])|[78])|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8(?:[23]|4(?:[45]|60)|5(?:4[0-39]|5|64)))|7[1-578]|8(?:[2469]|3[278]|5(?:4(?:4|5[13-7]|6[89])|[56][46]|[78])|7[378]|8(?:6[3-6]|[78]))))|92(?:2[24-9]|3[1-59]|47)|93(?:4(?:36|5[56])|8(?:[38]5|76))[4-6]"],"0$1",0,"$1 $2 $3-$4"],["(\\d)(\\d{2})(\\d{4})(\\d{4})","$2 15-$3-$4",["91"],"0$1",0,"$1 $2 $3-$4"],["(\\d{3})(\\d{3})(\\d{5})","$1-$2-$3",["8"],"0$1"],["(\\d)(\\d{3})(\\d{3})(\\d{4})","$2 15-$3-$4",["9"],"0$1",0,"$1 $2 $3-$4"]],"0",0,"0?(?:(11|2(?:2(?:02?|[13]|2[13-79]|4[1-6]|5[2457]|6[124-8]|7[1-4]|8[13-6]|9[1267])|3(?:02?|1[467]|2[03-6]|3[13-8]|[49][2-6]|5[2-8]|[67])|4(?:7[3-578]|9)|6(?:[0136]|2[24-6]|4[6-8]?|5[15-8])|80|9(?:0[1-3]|[19]|2\\d|3[1-6]|4[02568]?|5[2-4]|6[2-46]|72?|8[23]?))|3(?:3(?:2[79]|6|8[2578])|4(?:0[0-24-9]|[12]|3[5-8]?|4[24-7]|5[4-68]?|6[02-9]|7[126]|8[2379]?|9[1-36-8])|5(?:1|2[1245]|3[237]?|4[1-46-9]|6[2-4]|7[1-6]|8[2-5]?)|6[24]|7(?:[069]|1[1568]|2[15]|3[145]|4[13]|5[14-8]|7[2-57]|8[126])|8(?:[01]|2[15-7]|3[2578]?|4[13-6]|5[4-8]?|6[1-357-9]|7[36-8]?|8[5-8]?|9[124])))15)?","9$1"],AS:["1","011","(?:[58]\\d\\d|684|900)\\d{7}",[10],0,"1",0,"([267]\\d{6})$|1","684$1",0,"684"],AT:["43","00","1\\d{3,12}|2\\d{6,12}|43(?:(?:0\\d|5[02-9])\\d{3,9}|2\\d{4,5}|[3467]\\d{4}|8\\d{4,6}|9\\d{4,7})|5\\d{4,12}|8\\d{7,12}|9\\d{8,12}|(?:[367]\\d|4[0-24-9])\\d{4,11}",[4,5,6,7,8,9,10,11,12,13],[["(\\d)(\\d{3,12})","$1 $2",["1(?:11|[2-9])"],"0$1"],["(\\d{3})(\\d{2})","$1 $2",["517"],"0$1"],["(\\d{2})(\\d{3,5})","$1 $2",["5[079]"],"0$1"],["(\\d{3})(\\d{3,10})","$1 $2",["(?:31|4)6|51|6(?:48|5[0-3579]|[6-9])|7(?:20|32|8)|[89]","(?:31|4)6|51|6(?:485|5[0-3579]|[6-9])|7(?:20|32|8)|[89]"],"0$1"],["(\\d{4})(\\d{3,9})","$1 $2",["[2-467]|5[2-6]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["5"],"0$1"],["(\\d{2})(\\d{4})(\\d{4,7})","$1 $2 $3",["5"],"0$1"]],"0"],AU:["61","001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011","1(?:[0-79]\\d{7}(?:\\d(?:\\d{2})?)?|8[0-24-9]\\d{7})|[2-478]\\d{8}|1\\d{4,7}",[5,6,7,8,9,10,12],[["(\\d{2})(\\d{3,4})","$1 $2",["16"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,4})","$1 $2 $3",["16"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["14|4"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["[2378]"],"(0$1)"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1(?:30|[89])"]]],"0",0,"(183[12])|0",0,0,0,[["(?:(?:(?:2(?:[0-26-9]\\d|3[0-8]|4[02-9]|5[0135-9])|7(?:[013-57-9]\\d|2[0-8]))\\d|3(?:(?:[0-3589]\\d|6[1-9]|7[0-35-9])\\d|4(?:[0-578]\\d|90)))\\d\\d|8(?:51(?:0(?:0[03-9]|[12479]\\d|3[2-9]|5[0-8]|6[1-9]|8[0-7])|1(?:[0235689]\\d|1[0-69]|4[0-589]|7[0-47-9])|2(?:0[0-79]|[18][13579]|2[14-9]|3[0-46-9]|[4-6]\\d|7[89]|9[0-4])|3\\d\\d)|(?:6[0-8]|[78]\\d)\\d{3}|9(?:[02-9]\\d{3}|1(?:(?:[0-58]\\d|6[0135-9])\\d|7(?:0[0-24-9]|[1-9]\\d)|9(?:[0-46-9]\\d|5[0-79])))))\\d{3}",[9]],["4(?:79[01]|83[0-389]|94[0-4])\\d{5}|4(?:[0-36]\\d|4[047-9]|5[0-25-9]|7[02-8]|8[0-24-9]|9[0-37-9])\\d{6}",[9]],["180(?:0\\d{3}|2)\\d{3}",[7,10]],["190[0-26]\\d{6}",[10]],0,0,0,["163\\d{2,6}",[5,6,7,8,9]],["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}",[9]],["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}",[6,8,10,12]]],"0011"],AW:["297","00","(?:[25-79]\\d\\d|800)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[25-9]"]]]],AX:["358","00|99(?:[01469]|5(?:[14]1|3[23]|5[59]|77|88|9[09]))","2\\d{4,9}|35\\d{4,5}|(?:60\\d\\d|800)\\d{4,6}|7\\d{5,11}|(?:[14]\\d|3[0-46-9]|50)\\d{4,8}",[5,6,7,8,9,10,11,12],0,"0",0,0,0,0,"18",0,"00"],AZ:["994","00","365\\d{6}|(?:[124579]\\d|60|88)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["90"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1[28]|2|365|46","1[28]|2|365[45]|46","1[28]|2|365(?:4|5[02])|46"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[13-9]"],"0$1"]],"0"],BA:["387","00","6\\d{8}|(?:[35689]\\d|49|70)\\d{6}",[8,9],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["6[1-3]|[7-9]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2-$3",["[3-5]|6[56]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3 $4",["6"],"0$1"]],"0"],BB:["1","011","(?:246|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","246$1",0,"246"],BD:["880","00","[1-469]\\d{9}|8[0-79]\\d{7,8}|[2-79]\\d{8}|[2-9]\\d{7}|[3-9]\\d{6}|[57-9]\\d{5}",[6,7,8,9,10],[["(\\d{2})(\\d{4,6})","$1-$2",["31[5-8]|[459]1"],"0$1"],["(\\d{3})(\\d{3,7})","$1-$2",["3(?:[67]|8[013-9])|4(?:6[168]|7|[89][18])|5(?:6[128]|9)|6(?:[15]|28|4[14])|7[2-589]|8(?:0[014-9]|[12])|9[358]|(?:3[2-5]|4[235]|5[2-578]|6[0389]|76|8[3-7]|9[24])1|(?:44|66)[01346-9]"],"0$1"],["(\\d{4})(\\d{3,6})","$1-$2",["[13-9]|2[23]"],"0$1"],["(\\d)(\\d{7,8})","$1-$2",["2"],"0$1"]],"0"],BE:["32","00","4\\d{8}|[1-9]\\d{7}",[8,9],[["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["(?:80|9)0"],"0$1"],["(\\d)(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[239]|4[23]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[15-8]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["4"],"0$1"]],"0"],BF:["226","00","[025-7]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[025-7]"]]]],BG:["359","00","00800\\d{7}|[2-7]\\d{6,7}|[89]\\d{6,8}|2\\d{5}",[6,7,8,9,12],[["(\\d)(\\d)(\\d{2})(\\d{2})","$1 $2 $3 $4",["2"],"0$1"],["(\\d{3})(\\d{4})","$1 $2",["43[1-6]|70[1-9]"],"0$1"],["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,3})","$1 $2 $3",["[356]|4[124-7]|7[1-9]|8[1-6]|9[1-7]"],"0$1"],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["(?:70|8)0"],"0$1"],["(\\d{3})(\\d{3})(\\d{2})","$1 $2 $3",["43[1-7]|7"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[48]|9[08]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["9"],"0$1"]],"0"],BH:["973","00","[136-9]\\d{7}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[13679]|8[02-4679]"]]]],BI:["257","00","(?:[267]\\d|31)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2367]"]]]],BJ:["229","00","(?:01\\d|[24-689])\\d{7}",[8,10],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[24-689]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["0"]]]],BL:["590","00","(?:590\\d|7090)\\d{5}|(?:69|80|9\\d)\\d{7}",[9],0,"0",0,0,0,0,0,[["590(?:2[7-9]|3[3-7]|5[12]|87)\\d{4}"],["(?:69(?:0\\d\\d|1(?:2[2-9]|3[0-5])|4(?:0[89]|1[2-6]|9\\d)|6(?:1[016-9]|5[0-4]|[67]\\d))|7090[0-4])\\d{4}"],["80[0-5]\\d{6}"],0,0,0,0,0,["9(?:(?:39[5-7]|76[018])\\d|475[0-6])\\d{4}"]]],BM:["1","011","(?:441|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","441$1",0,"441"],BN:["673","00","[2-578]\\d{6}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-578]"]]]],BO:["591","00(?:1\\d)?","8001\\d{5}|(?:[2-467]\\d|50)\\d{6}",[8,9],[["(\\d)(\\d{7})","$1 $2",["[235]|4[46]"]],["(\\d{8})","$1",["[67]"]],["(\\d{3})(\\d{2})(\\d{4})","$1 $2 $3",["8"]]],"0",0,"0(1\\d)?"],BQ:["599","00","(?:[34]1|7\\d)\\d{5}",[7],0,0,0,0,0,0,"[347]"],BR:["55","00(?:1[245]|2[1-35]|31|4[13]|[56]5|99)","[1-467]\\d{9,10}|55[0-46-9]\\d{8}|[34]\\d{7}|55\\d{7,8}|(?:5[0-46-9]|[89]\\d)\\d{7,9}",[8,9,10,11],[["(\\d{4})(\\d{4})","$1-$2",["300|4(?:0[02]|37|86)","300|4(?:0(?:0|20)|370|864)"]],["(\\d{3})(\\d{2,3})(\\d{4})","$1 $2 $3",["(?:[358]|90)0"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1 $2-$3",["(?:[14689][1-9]|2[12478]|3[1-578]|5[13-5]|7[13-579])[2-57]"],"($1)"],["(\\d{2})(\\d{5})(\\d{4})","$1 $2-$3",["[16][1-9]|[2-57-9]"],"($1)"]],"0",0,"(?:0|90)(?:(1[245]|2[1-35]|31|4[13]|[56]5|99)(\\d{10,11}))?","$2"],BS:["1","011","(?:242|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([3-8]\\d{6})$|1","242$1",0,"242"],BT:["975","00","[17]\\d{7}|[2-8]\\d{6}",[7,8],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[2-68]|7[246]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1[67]|7"]]]],BW:["267","00","(?:0800|(?:[37]|800)\\d)\\d{6}|(?:[2-6]\\d|90)\\d{5}",[7,8,10],[["(\\d{2})(\\d{5})","$1 $2",["90"]],["(\\d{3})(\\d{4})","$1 $2",["[24-6]|3[15-9]"]],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[37]"]],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["0"]],["(\\d{3})(\\d{4})(\\d{3})","$1 $2 $3",["8"]]]],BY:["375","810","(?:[12]\\d|33|44|902)\\d{7}|8(?:0[0-79]\\d{5,7}|[1-7]\\d{9})|8(?:1[0-489]|[5-79]\\d)\\d{7}|8[1-79]\\d{6,7}|8[0-79]\\d{5}|8\\d{5}",[6,7,8,9,10,11],[["(\\d{3})(\\d{3})","$1 $2",["800"],"8 $1"],["(\\d{3})(\\d{2})(\\d{2,4})","$1 $2 $3",["800"],"8 $1"],["(\\d{4})(\\d{2})(\\d{3})","$1 $2-$3",["1(?:5[169]|6[3-5]|7[179])|2(?:1[35]|2[34]|3[3-5])","1(?:5[169]|6(?:3[1-3]|4|5[125])|7(?:1[3-9]|7[0-24-6]|9[2-7]))|2(?:1[35]|2[34]|3[3-5])"],"8 0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2-$3-$4",["1(?:[56]|7[467])|2[1-3]"],"8 0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2-$3-$4",["[1-4]"],"8 0$1"],["(\\d{3})(\\d{3,4})(\\d{4})","$1 $2 $3",["[89]"],"8 $1"]],"8",0,"0|80?",0,0,0,0,"8~10"],BZ:["501","00","(?:0800\\d|[2-8])\\d{6}",[7,11],[["(\\d{3})(\\d{4})","$1-$2",["[2-8]"]],["(\\d)(\\d{3})(\\d{4})(\\d{3})","$1-$2-$3-$4",["0"]]]],CA:["1","011","[2-9]\\d{9}|3\\d{6}",[7,10],0,"1",0,0,0,0,0,[["(?:2(?:04|[23]6|[48]9|50|63)|3(?:06|43|54|6[578]|82)|4(?:03|1[68]|[26]8|3[178]|50|74)|5(?:06|1[49]|48|79|8[147])|6(?:04|[18]3|39|47|72)|7(?:0[59]|42|53|78|8[02])|8(?:[06]7|19|25|7[39])|9(?:0[25]|42))[2-9]\\d{6}",[10]],["",[10]],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}",[10]],["900[2-9]\\d{6}",[10]],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|(?:5(?:2[125-9]|33|44|66|77|88)|6(?:22|33))[2-9]\\d{6}",[10]],0,["310\\d{4}",[7]],0,["600[2-9]\\d{6}",[10]]]],CC:["61","001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011","1(?:[0-79]\\d{8}(?:\\d{2})?|8[0-24-9]\\d{7})|[148]\\d{8}|1\\d{5,7}",[6,7,8,9,10,12],0,"0",0,"([59]\\d{7})$|0","8$1",0,0,[["8(?:51(?:0(?:02|31|60|89)|1(?:18|76)|223)|91(?:0(?:1[0-2]|29)|1(?:[28]2|50|79)|2(?:10|64)|3(?:[06]8|22)|4[29]8|62\\d|70[23]|959))\\d{3}",[9]],["4(?:79[01]|83[0-389]|94[0-4])\\d{5}|4(?:[0-36]\\d|4[047-9]|5[0-25-9]|7[02-8]|8[0-24-9]|9[0-37-9])\\d{6}",[9]],["180(?:0\\d{3}|2)\\d{3}",[7,10]],["190[0-26]\\d{6}",[10]],0,0,0,0,["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}",[9]],["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}",[6,8,10,12]]],"0011"],CD:["243","00","(?:(?:[189]|5\\d)\\d|2)\\d{7}|[1-68]\\d{6}",[7,8,9,10],[["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["88"],"0$1"],["(\\d{2})(\\d{5})","$1 $2",["[1-6]"],"0$1"],["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[89]"],"0$1"],["(\\d{2})(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3 $4",["5"],"0$1"]],"0"],CF:["236","00","(?:[27]\\d{3}|8776)\\d{4}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[278]"]]]],CG:["242","00","222\\d{6}|(?:0\\d|80)\\d{7}",[9],[["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["8"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[02]"]]]],CH:["41","00","8\\d{11}|[2-9]\\d{8}",[9,12],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8[047]|90"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-79]|81"],"0$1"],["(\\d{3})(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["8"],"0$1"]],"0"],CI:["225","00","[02]\\d{9}",[10],[["(\\d{2})(\\d{2})(\\d)(\\d{5})","$1 $2 $3 $4",["2"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3 $4",["0"]]]],CK:["682","00","[2-578]\\d{4}",[5],[["(\\d{2})(\\d{3})","$1 $2",["[2-578]"]]]],CL:["56","(?:0|1(?:1[0-69]|2[02-5]|5[13-58]|69|7[0167]|8[018]))0","12300\\d{6}|6\\d{9,10}|[2-9]\\d{8}",[9,10,11],[["(\\d{5})(\\d{4})","$1 $2",["219","2196"],"($1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["44"]],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["2[1-36]"],"($1)"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["9[2-9]"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["3[2-5]|[47]|5[1-3578]|6[13-57]|8(?:0[1-9]|[1-9])"],"($1)"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["60|8"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]],["(\\d{3})(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3 $4",["60"]]]],CM:["237","00","[26]\\d{8}|88\\d{6,7}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["88"]],["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["[26]|88"]]]],CN:["86","00|1(?:[12]\\d|79)\\d\\d00","(?:(?:1[03-689]|2\\d)\\d\\d|6)\\d{8}|1\\d{10}|[126]\\d{6}(?:\\d(?:\\d{2})?)?|86\\d{5,6}|(?:[3-579]\\d|8[0-57-9])\\d{5,9}",[7,8,9,10,11,12],[["(\\d{2})(\\d{5,6})","$1 $2",["(?:10|2[0-57-9])[19]|3(?:[157]|35|49|9[1-68])|4(?:1[124-9]|2[179]|6[47-9]|7|8[23])|5(?:[1357]|2[37]|4[36]|6[1-46]|80)|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:07|1[236-8]|2[5-7]|[37]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3|4[13]|5[1-5]|7[0-79]|9[0-35-9])|(?:4[35]|59|85)[1-9]","(?:10|2[0-57-9])(?:1[02]|9[56])|8078|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:1[124-9]|2[179]|[35][1-9]|6[47-9]|7\\d|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3\\d|4[13]|5[1-5]|7[0-79]|9[0-35-9]))1","10(?:1(?:0|23)|9[56])|2[0-57-9](?:1(?:00|23)|9[56])|80781|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:1[124-9]|2[179]|[35][1-9]|6[47-9]|7\\d|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3\\d|4[13]|5[1-5]|7[0-79]|9[0-35-9]))12","10(?:1(?:0|23)|9[56])|2[0-57-9](?:1(?:00|23)|9[56])|807812|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:1[124-9]|2[179]|[35][1-9]|6[47-9]|7\\d|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3\\d|4[13]|5[1-5]|7[0-79]|9[0-35-9]))123","10(?:1(?:0|23)|9[56])|2[0-57-9](?:1(?:00|23)|9[56])|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:1[124-9]|2[179]|[35][1-9]|6[47-9]|7\\d|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:078|1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3\\d|4[13]|5[1-5]|7[0-79]|9[0-35-9]))123"],"0$1"],["(\\d{3})(\\d{5,6})","$1 $2",["3(?:[157]|35|49|9[1-68])|4(?:[17]|2[179]|6[47-9]|8[23])|5(?:[1357]|2[37]|4[36]|6[1-46]|80)|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]|4[13]|5[1-5])|(?:4[35]|59|85)[1-9]","(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))[19]","85[23](?:10|95)|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[14-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))(?:10|9[56])","85[23](?:100|95)|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[14-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))(?:100|9[56])"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["(?:4|80)0"]],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["10|2(?:[02-57-9]|1[1-9])","10|2(?:[02-57-9]|1[1-9])","10[0-79]|2(?:[02-57-9]|1[1-79])|(?:10|21)8(?:0[1-9]|[1-9])"],"0$1",1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["3(?:[3-59]|7[02-68])|4(?:[26-8]|3[3-9]|5[2-9])|5(?:3[03-9]|[468]|7[028]|9[2-46-9])|6|7(?:[0-247]|3[04-9]|5[0-4689]|6[2368])|8(?:[1-358]|9[1-7])|9(?:[013479]|5[1-5])|(?:[34]1|55|79|87)[02-9]"],"0$1",1],["(\\d{3})(\\d{7,8})","$1 $2",["9"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["80"],"0$1",1],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["[3-578]"],"0$1",1],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["1[3-9]"]],["(\\d{2})(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3 $4",["[12]"],"0$1",1]],"0",0,"(1(?:[12]\\d|79)\\d\\d)|0",0,0,0,0,"00"],CO:["57","00(?:4(?:[14]4|56)|[579])","(?:46|60\\d\\d)\\d{6}|(?:1\\d|[39])\\d{9}",[8,10,11],[["(\\d{4})(\\d{4})","$1 $2",["46"]],["(\\d{3})(\\d{7})","$1 $2",["6|90"],"($1)"],["(\\d{3})(\\d{7})","$1 $2",["3[0-357]|91"]],["(\\d)(\\d{3})(\\d{7})","$1-$2-$3",["1"],"0$1",0,"$1 $2 $3"]],"0",0,"0([3579]|4(?:[14]4|56))?"],CR:["506","00","(?:8\\d|90)\\d{8}|(?:[24-8]\\d{3}|3005)\\d{4}",[8,10],[["(\\d{4})(\\d{4})","$1 $2",["[2-7]|8[3-9]"]],["(\\d{3})(\\d{3})(\\d{4})","$1-$2-$3",["[89]"]]],0,0,"(19(?:0[0-2468]|1[09]|20|66|77|99))"],CU:["53","119","(?:[2-7]|8\\d\\d)\\d{7}|[2-47]\\d{6}|[34]\\d{5}",[6,7,8,10],[["(\\d{2})(\\d{4,6})","$1 $2",["2[1-4]|[34]"],"(0$1)"],["(\\d)(\\d{6,7})","$1 $2",["7"],"(0$1)"],["(\\d)(\\d{7})","$1 $2",["[56]"],"0$1"],["(\\d{3})(\\d{7})","$1 $2",["8"],"0$1"]],"0"],CV:["238","0","(?:[2-59]\\d\\d|800)\\d{4}",[7],[["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["[2-589]"]]]],CW:["599","00","(?:[34]1|60|(?:7|9\\d)\\d)\\d{5}",[7,8],[["(\\d{3})(\\d{4})","$1 $2",["[3467]"]],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["9[4-8]"]]],0,0,0,0,0,"[69]"],CX:["61","001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011","1(?:[0-79]\\d{8}(?:\\d{2})?|8[0-24-9]\\d{7})|[148]\\d{8}|1\\d{5,7}",[6,7,8,9,10,12],0,"0",0,"([59]\\d{7})$|0","8$1",0,0,[["8(?:51(?:0(?:01|30|59|88)|1(?:17|46|75)|2(?:22|35))|91(?:00[6-9]|1(?:[28]1|49|78)|2(?:09|63)|3(?:12|26|75)|4(?:56|97)|64\\d|7(?:0[01]|1[0-2])|958))\\d{3}",[9]],["4(?:79[01]|83[0-389]|94[0-4])\\d{5}|4(?:[0-36]\\d|4[047-9]|5[0-25-9]|7[02-8]|8[0-24-9]|9[0-37-9])\\d{6}",[9]],["180(?:0\\d{3}|2)\\d{3}",[7,10]],["190[0-26]\\d{6}",[10]],0,0,0,0,["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}",[9]],["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}",[6,8,10,12]]],"0011"],CY:["357","00","(?:[279]\\d|[58]0)\\d{6}",[8],[["(\\d{2})(\\d{6})","$1 $2",["[257-9]"]]]],CZ:["420","00","(?:[2-578]\\d|60)\\d{7}|9\\d{8,11}",[9,10,11,12],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[2-8]|9[015-7]"]],["(\\d{2})(\\d{3})(\\d{3})(\\d{2})","$1 $2 $3 $4",["96"]],["(\\d{2})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["9"]],["(\\d{3})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["9"]]]],DE:["49","00","[2579]\\d{5,14}|49(?:[34]0|69|8\\d)\\d\\d?|49(?:37|49|60|7[089]|9\\d)\\d{1,3}|49(?:2[024-9]|3[2-689]|7[1-7])\\d{1,8}|(?:1|[368]\\d|4[0-8])\\d{3,13}|49(?:[015]\\d|2[13]|31|[46][1-8])\\d{1,9}",[4,5,6,7,8,9,10,11,12,13,14,15],[["(\\d{2})(\\d{3,13})","$1 $2",["3[02]|40|[68]9"],"0$1"],["(\\d{3})(\\d{3,12})","$1 $2",["2(?:0[1-389]|1[124]|2[18]|3[14])|3(?:[35-9][15]|4[015])|906|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1","2(?:0[1-389]|12[0-8])|3(?:[35-9][15]|4[015])|906|2(?:[13][14]|2[18])|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1"],"0$1"],["(\\d{4})(\\d{2,11})","$1 $2",["[24-6]|3(?:[3569][02-46-9]|4[2-4679]|7[2-467]|8[2-46-8])|70[2-8]|8(?:0[2-9]|[1-8])|90[7-9]|[79][1-9]","[24-6]|3(?:3(?:0[1-467]|2[127-9]|3[124578]|7[1257-9]|8[1256]|9[145])|4(?:2[135]|4[13578]|9[1346])|5(?:0[14]|2[1-3589]|6[1-4]|7[13468]|8[13568])|6(?:2[1-489]|3[124-6]|6[13]|7[12579]|8[1-356]|9[135])|7(?:2[1-7]|4[145]|6[1-5]|7[1-4])|8(?:21|3[1468]|6|7[1467]|8[136])|9(?:0[12479]|2[1358]|4[134679]|6[1-9]|7[136]|8[147]|9[1468]))|70[2-8]|8(?:0[2-9]|[1-8])|90[7-9]|[79][1-9]|3[68]4[1347]|3(?:47|60)[1356]|3(?:3[46]|46|5[49])[1246]|3[4579]3[1357]"],"0$1"],["(\\d{3})(\\d{4})","$1 $2",["138"],"0$1"],["(\\d{5})(\\d{2,10})","$1 $2",["3"],"0$1"],["(\\d{3})(\\d{5,11})","$1 $2",["181"],"0$1"],["(\\d{3})(\\d)(\\d{4,10})","$1 $2 $3",["1(?:3|80)|9"],"0$1"],["(\\d{3})(\\d{7,8})","$1 $2",["1[67]"],"0$1"],["(\\d{3})(\\d{7,12})","$1 $2",["8"],"0$1"],["(\\d{5})(\\d{6})","$1 $2",["185","1850","18500"],"0$1"],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["7"],"0$1"],["(\\d{4})(\\d{7})","$1 $2",["18[68]"],"0$1"],["(\\d{4})(\\d{7})","$1 $2",["15[1279]"],"0$1"],["(\\d{5})(\\d{6})","$1 $2",["15[03568]","15(?:[0568]|31)"],"0$1"],["(\\d{3})(\\d{8})","$1 $2",["18"],"0$1"],["(\\d{3})(\\d{2})(\\d{7,8})","$1 $2 $3",["1(?:6[023]|7)"],"0$1"],["(\\d{4})(\\d{2})(\\d{7})","$1 $2 $3",["15[279]"],"0$1"],["(\\d{3})(\\d{2})(\\d{8})","$1 $2 $3",["15"],"0$1"]],"0"],DJ:["253","00","(?:2\\d|77)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[27]"]]]],DK:["45","00","[2-9]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-9]"]]]],DM:["1","011","(?:[58]\\d\\d|767|900)\\d{7}",[10],0,"1",0,"([2-7]\\d{6})$|1","767$1",0,"767"],DO:["1","011","(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,0,0,0,"8001|8[024]9"],DZ:["213","00","(?:[1-4]|[5-79]\\d|80)\\d{7}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[1-4]"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["9"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-8]"],"0$1"]],"0"],EC:["593","00","1\\d{9,10}|(?:[2-7]|9\\d)\\d{7}",[8,9,10,11],[["(\\d)(\\d{3})(\\d{4})","$1 $2-$3",["[2-7]"],"(0$1)",0,"$1-$2-$3"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["9"],"0$1"],["(\\d{4})(\\d{3})(\\d{3,4})","$1 $2 $3",["1"]]],"0"],EE:["372","00","8\\d{9}|[4578]\\d{7}|(?:[3-8]\\d|90)\\d{5}",[7,8,10],[["(\\d{3})(\\d{4})","$1 $2",["[369]|4[3-8]|5(?:[0-2]|5[0-478]|6[45])|7[1-9]|88","[369]|4[3-8]|5(?:[02]|1(?:[0-8]|95)|5[0-478]|6(?:4[0-4]|5[1-589]))|7[1-9]|88"]],["(\\d{4})(\\d{3,4})","$1 $2",["[45]|8(?:00|[1-49])","[45]|8(?:00[1-9]|[1-49])"]],["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["7"]],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["8"]]]],EG:["20","00","[189]\\d{8,9}|[24-6]\\d{8}|[135]\\d{7}",[8,9,10],[["(\\d)(\\d{7,8})","$1 $2",["[23]"],"0$1"],["(\\d{2})(\\d{6,7})","$1 $2",["1[35]|[4-6]|8[2468]|9[235-7]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[89]"],"0$1"],["(\\d{2})(\\d{8})","$1 $2",["1"],"0$1"]],"0"],EH:["212","00","[5-8]\\d{8}",[9],0,"0",0,0,0,0,"528[89]"],ER:["291","00","[178]\\d{6}",[7],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[178]"],"0$1"]],"0"],ES:["34","00","[5-9]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[89]00"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-9]"]]]],ET:["251","00","(?:11|[2-579]\\d)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[1-579]"],"0$1"]],"0"],FI:["358","00|99(?:[01469]|5(?:[14]1|3[23]|5[59]|77|88|9[09]))","[1-35689]\\d{4}|7\\d{10,11}|(?:[124-7]\\d|3[0-46-9])\\d{8}|[1-9]\\d{5,8}",[5,6,7,8,9,10,11,12],[["(\\d{5})","$1",["20[2-59]"],"0$1"],["(\\d{3})(\\d{3,7})","$1 $2",["(?:[1-3]0|[68])0|70[07-9]"],"0$1"],["(\\d{2})(\\d{4,8})","$1 $2",["[14]|2[09]|50|7[135]"],"0$1"],["(\\d{2})(\\d{6,10})","$1 $2",["7"],"0$1"],["(\\d)(\\d{4,9})","$1 $2",["(?:19|[2568])[1-8]|3(?:0[1-9]|[1-9])|9"],"0$1"]],"0",0,0,0,0,"1[03-79]|[2-9]",0,"00"],FJ:["679","0(?:0|52)","45\\d{5}|(?:0800\\d|[235-9])\\d{6}",[7,11],[["(\\d{3})(\\d{4})","$1 $2",["[235-9]|45"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["0"]]],0,0,0,0,0,0,0,"00"],FK:["500","00","[2-7]\\d{4}",[5]],FM:["691","00","(?:[39]\\d\\d|820)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[389]"]]]],FO:["298","00","[2-9]\\d{5}",[6],[["(\\d{6})","$1",["[2-9]"]]],0,0,"(10(?:01|[12]0|88))"],FR:["33","00","[1-9]\\d{8}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0 $1"],["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["[1-79]"],"0$1"]],"0"],GA:["241","00","(?:[067]\\d|11)\\d{6}|[2-7]\\d{6}",[7,8],[["(\\d)(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-7]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["0"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["11|[67]"],"0$1"]],0,0,"0(11\\d{6}|60\\d{6}|61\\d{6}|6[256]\\d{6}|7[467]\\d{6})","$1"],GB:["44","00","[1-357-9]\\d{9}|[18]\\d{8}|8\\d{6}",[7,9,10],[["(\\d{3})(\\d{4})","$1 $2",["800","8001","80011","800111","8001111"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["845","8454","84546","845464"],"0$1"],["(\\d{3})(\\d{6})","$1 $2",["800"],"0$1"],["(\\d{5})(\\d{4,5})","$1 $2",["1(?:38|5[23]|69|76|94)","1(?:(?:38|69)7|5(?:24|39)|768|946)","1(?:3873|5(?:242|39[4-6])|(?:697|768)[347]|9467)"],"0$1"],["(\\d{4})(\\d{5,6})","$1 $2",["1(?:[2-69][02-9]|[78])"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["[25]|7(?:0|6[02-9])","[25]|7(?:0|6(?:[03-9]|2[356]))"],"0$1"],["(\\d{4})(\\d{6})","$1 $2",["7"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[1389]"],"0$1"]],"0",0,0,0,0,0,[["(?:1(?:1(?:3(?:[0-58]\\d\\d|73[0-35])|4(?:(?:[0-5]\\d|70)\\d|69[7-9])|(?:(?:5[0-26-9]|[78][0-49])\\d|6(?:[0-4]\\d|50))\\d)|(?:2(?:(?:0[024-9]|2[3-9]|3[3-79]|4[1-689]|[58][02-9]|6[0-47-9]|7[013-9]|9\\d)\\d|1(?:[0-7]\\d|8[0-3]))|(?:3(?:0\\d|1[0-8]|[25][02-9]|3[02-579]|[468][0-46-9]|7[1-35-79]|9[2-578])|4(?:0[03-9]|[137]\\d|[28][02-57-9]|4[02-69]|5[0-8]|[69][0-79])|5(?:0[1-35-9]|[16]\\d|2[024-9]|3[015689]|4[02-9]|5[03-9]|7[0-35-9]|8[0-468]|9[0-57-9])|6(?:0[034689]|1\\d|2[0-35689]|[38][013-9]|4[1-467]|5[0-69]|6[13-9]|7[0-8]|9[0-24578])|7(?:0[0246-9]|2\\d|3[0236-8]|4[03-9]|5[0-46-9]|6[013-9]|7[0-35-9]|8[024-9]|9[02-9])|8(?:0[35-9]|2[1-57-9]|3[02-578]|4[0-578]|5[124-9]|6[2-69]|7\\d|8[02-9]|9[02569])|9(?:0[02-589]|[18]\\d|2[02-689]|3[1-57-9]|4[2-9]|5[0-579]|6[2-47-9]|7[0-24578]|9[2-57]))\\d)\\d)|2(?:0[013478]|3[0189]|4[017]|8[0-46-9]|9[0-2])\\d{3})\\d{4}|1(?:2(?:0(?:46[1-4]|87[2-9])|545[1-79]|76(?:2\\d|3[1-8]|6[1-6])|9(?:7(?:2[0-4]|3[2-5])|8(?:2[2-8]|7[0-47-9]|8[3-5])))|3(?:6(?:38[2-5]|47[23])|8(?:47[04-9]|64[0157-9]))|4(?:044[1-7]|20(?:2[23]|8\\d)|6(?:0(?:30|5[2-57]|6[1-8]|7[2-8])|140)|8(?:052|87[1-3]))|5(?:2(?:4(?:3[2-79]|6\\d)|76\\d)|6(?:26[06-9]|686))|6(?:06(?:4\\d|7[4-79])|295[5-7]|35[34]\\d|47(?:24|61)|59(?:5[08]|6[67]|74)|9(?:55[0-4]|77[23]))|7(?:26(?:6[13-9]|7[0-7])|(?:442|688)\\d|50(?:2[0-3]|[3-68]2|76))|8(?:27[56]\\d|37(?:5[2-5]|8[239])|843[2-58])|9(?:0(?:0(?:6[1-8]|85)|52\\d)|3583|4(?:66[1-8]|9(?:2[01]|81))|63(?:23|3[1-4])|9561))\\d{3}",[9,10]],["7(?:457[0-57-9]|700[01]|911[028])\\d{5}|7(?:[1-3]\\d\\d|4(?:[0-46-9]\\d|5[0-689])|5(?:0[0-8]|[13-9]\\d|2[0-35-9])|7(?:0[1-9]|[1-7]\\d|8[02-9]|9[0-689])|8(?:[014-9]\\d|[23][0-8])|9(?:[024-9]\\d|1[02-9]|3[0-689]))\\d{6}",[10]],["80[08]\\d{7}|800\\d{6}|8001111"],["(?:8(?:4[2-5]|7[0-3])|9(?:[01]\\d|8[2-49]))\\d{7}|845464\\d",[7,10]],["70\\d{8}",[10]],0,["(?:3[0347]|55)\\d{8}",[10]],["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}",[10]],["56\\d{8}",[10]]],0," x"],GD:["1","011","(?:473|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","473$1",0,"473"],GE:["995","00","(?:[3-57]\\d\\d|800)\\d{6}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["70"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["32"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[57]"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[348]"],"0$1"]],"0"],GF:["594","00","(?:[56]94\\d|7093)\\d{5}|(?:80|9\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-7]|9[47]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[89]"],"0$1"]],"0"],GG:["44","00","(?:1481|[357-9]\\d{3})\\d{6}|8\\d{6}(?:\\d{2})?",[7,9,10],0,"0",0,"([25-9]\\d{5})$|0","1481$1",0,0,[["1481[25-9]\\d{5}",[10]],["7(?:(?:781|839)\\d|911[17])\\d{5}",[10]],["80[08]\\d{7}|800\\d{6}|8001111"],["(?:8(?:4[2-5]|7[0-3])|9(?:[01]\\d|8[0-3]))\\d{7}|845464\\d",[7,10]],["70\\d{8}",[10]],0,["(?:3[0347]|55)\\d{8}",[10]],["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}",[10]],["56\\d{8}",[10]]]],GH:["233","00","(?:[235]\\d{3}|800)\\d{5}",[8,9],[["(\\d{3})(\\d{5})","$1 $2",["8"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[235]"],"0$1"]],"0"],GI:["350","00","(?:[25]\\d|60)\\d{6}",[8],[["(\\d{3})(\\d{5})","$1 $2",["2"]]]],GL:["299","00","(?:19|[2-689]\\d|70)\\d{4}",[6],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["19|[2-9]"]]]],GM:["220","00","[2-9]\\d{6}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-9]"]]]],GN:["224","00","722\\d{6}|(?:3|6\\d)\\d{7}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["3"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[67]"]]]],GP:["590","00","(?:590\\d|7090)\\d{5}|(?:69|80|9\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-79]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0",0,0,0,0,0,[["590(?:0[1-68]|[14][0-24-9]|2[0-68]|3[1-9]|5[3-579]|[68][0-689]|7[08]|9\\d)\\d{4}"],["(?:69(?:0\\d\\d|1(?:2[2-9]|3[0-5])|4(?:0[89]|1[2-6]|9\\d)|6(?:1[016-9]|5[0-4]|[67]\\d))|7090[0-4])\\d{4}"],["80[0-5]\\d{6}"],0,0,0,0,0,["9(?:(?:39[5-7]|76[018])\\d|475[0-6])\\d{4}"]]],GQ:["240","00","222\\d{6}|(?:3\\d|55|[89]0)\\d{7}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[235]"]],["(\\d{3})(\\d{6})","$1 $2",["[89]"]]]],GR:["30","00","5005000\\d{3}|8\\d{9,11}|(?:[269]\\d|70)\\d{8}",[10,11,12],[["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["21|7"]],["(\\d{4})(\\d{6})","$1 $2",["2(?:2|3[2-57-9]|4[2-469]|5[2-59]|6[2-9]|7[2-69]|8[2-49])|5"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[2689]"]],["(\\d{3})(\\d{3,4})(\\d{5})","$1 $2 $3",["8"]]]],GT:["502","00","80\\d{6}|(?:1\\d{3}|[2-7])\\d{7}",[8,11],[["(\\d{4})(\\d{4})","$1 $2",["[2-8]"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]]]],GU:["1","011","(?:[58]\\d\\d|671|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","671$1",0,"671"],GW:["245","00","[49]\\d{8}|4\\d{6}",[7,9],[["(\\d{3})(\\d{4})","$1 $2",["40"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[49]"]]]],GY:["592","001","(?:[2-8]\\d{3}|9008)\\d{3}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-9]"]]]],HK:["852","00(?:30|5[09]|[126-9]?)","8[0-46-9]\\d{6,7}|9\\d{4,7}|(?:[2-7]|9\\d{3})\\d{7}",[5,6,7,8,9,11],[["(\\d{3})(\\d{2,5})","$1 $2",["900","9003"]],["(\\d{4})(\\d{4})","$1 $2",["[2-7]|8[1-4]|9(?:0[1-9]|[1-8])"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"]],["(\\d{3})(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3 $4",["9"]]],0,0,0,0,0,0,0,"00"],HN:["504","00","8\\d{10}|[237-9]\\d{7}",[8,11],[["(\\d{4})(\\d{4})","$1-$2",["[237-9]"]]]],HR:["385","00","[2-69]\\d{8}|80\\d{5,7}|[1-79]\\d{7}|6\\d{6}",[7,8,9],[["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["6[01]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2,3})","$1 $2 $3",["8"],"0$1"],["(\\d)(\\d{4})(\\d{3})","$1 $2 $3",["1"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["6|7[245]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["9"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-57]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"],"0$1"]],"0"],HT:["509","00","(?:[2-489]\\d|55)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["[2-589]"]]]],HU:["36","00","[235-7]\\d{8}|[1-9]\\d{7}",[8,9],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["1"],"(06 $1)"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[27][2-9]|3[2-7]|4[24-9]|5[2-79]|6|8[2-57-9]|9[2-69]"],"(06 $1)"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-9]"],"06 $1"]],"06"],ID:["62","00[89]","00[1-9]\\d{9,14}|(?:[1-36]|8\\d{5})\\d{6}|00\\d{9}|[1-9]\\d{8,10}|[2-9]\\d{7}",[7,8,9,10,11,12,13,14,15,16,17],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["15"]],["(\\d{2})(\\d{5,9})","$1 $2",["2[124]|[36]1"],"(0$1)"],["(\\d{3})(\\d{5,7})","$1 $2",["800"],"0$1"],["(\\d{3})(\\d{5,8})","$1 $2",["[2-79]"],"(0$1)"],["(\\d{3})(\\d{3,4})(\\d{3})","$1-$2-$3",["8[1-35-9]"],"0$1"],["(\\d{3})(\\d{6,8})","$1 $2",["1"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["804"],"0$1"],["(\\d{3})(\\d)(\\d{3})(\\d{3})","$1 $2 $3 $4",["80"],"0$1"],["(\\d{3})(\\d{4})(\\d{4,5})","$1-$2-$3",["8"],"0$1"]],"0"],IE:["353","00","(?:1\\d|[2569])\\d{6,8}|4\\d{6,9}|7\\d{8}|8\\d{8,9}",[7,8,9,10],[["(\\d{2})(\\d{5})","$1 $2",["2[24-9]|47|58|6[237-9]|9[35-9]"],"(0$1)"],["(\\d{3})(\\d{5})","$1 $2",["[45]0"],"(0$1)"],["(\\d)(\\d{3,4})(\\d{4})","$1 $2 $3",["1"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2569]|4[1-69]|7[14]"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["70"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["81"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[78]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["4"],"(0$1)"],["(\\d{2})(\\d)(\\d{3})(\\d{4})","$1 $2 $3 $4",["8"],"0$1"]],"0"],IL:["972","0(?:0|1[2-9])","1\\d{6}(?:\\d{3,5})?|[57]\\d{8}|[1-489]\\d{7}",[7,8,9,10,11,12],[["(\\d{4})(\\d{3})","$1-$2",["125"]],["(\\d{4})(\\d{2})(\\d{2})","$1-$2-$3",["121"]],["(\\d)(\\d{3})(\\d{4})","$1-$2-$3",["[2-489]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["[57]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1-$2-$3",["12"]],["(\\d{4})(\\d{6})","$1-$2",["159"]],["(\\d)(\\d{3})(\\d{3})(\\d{3})","$1-$2-$3-$4",["1[7-9]"]],["(\\d{3})(\\d{1,2})(\\d{3})(\\d{4})","$1-$2 $3-$4",["15"]]],"0"],IM:["44","00","1624\\d{6}|(?:[3578]\\d|90)\\d{8}",[10],0,"0",0,"([25-8]\\d{5})$|0","1624$1",0,"74576|(?:16|7[56])24"],IN:["91","00","(?:000800|[2-9]\\d\\d)\\d{7}|1\\d{7,12}",[8,9,10,11,12,13],[["(\\d{8})","$1",["5(?:0|2[23]|3[03]|[67]1|88)","5(?:0|2(?:21|3)|3(?:0|3[23])|616|717|888)","5(?:0|2(?:21|3)|3(?:0|3[23])|616|717|8888)"],0,1],["(\\d{4})(\\d{4,5})","$1 $2",["180","1800"],0,1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["140"],0,1],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["11|2[02]|33|4[04]|79[1-7]|80[2-46]","11|2[02]|33|4[04]|79(?:[1-6]|7[19])|80(?:[2-4]|6[0-589])","11|2[02]|33|4[04]|79(?:[124-6]|3(?:[02-9]|1[0-24-9])|7(?:1|9[1-6]))|80(?:[2-4]|6[0-589])"],"0$1",1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["1(?:2[0-249]|3[0-25]|4[145]|[68]|7[1257])|2(?:1[257]|3[013]|4[01]|5[0137]|6[0158]|78|8[1568])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|5[12]|[78]1)|6(?:12|[2-4]1|5[17]|6[13]|80)|7(?:12|3[134]|4[47]|61|88)|8(?:16|2[014]|3[126]|6[136]|7[078]|8[34]|91)|(?:43|59|75)[15]|(?:1[59]|29|67|72)[14]","1(?:2[0-24]|3[0-25]|4[145]|[59][14]|6[1-9]|7[1257]|8[1-57-9])|2(?:1[257]|3[013]|4[01]|5[0137]|6[058]|78|8[1568]|9[14])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|3[15]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|[578]1|9[15])|674|7(?:(?:2[14]|3[34]|5[15])[2-6]|61[346]|88[0-8])|8(?:70[2-6]|84[235-7]|91[3-7])|(?:1(?:29|60|8[06])|261|552|6(?:12|[2-47]1|5[17]|6[13]|80)|7(?:12|31|4[47])|8(?:16|2[014]|3[126]|6[136]|7[78]|83))[2-7]","1(?:2[0-24]|3[0-25]|4[145]|[59][14]|6[1-9]|7[1257]|8[1-57-9])|2(?:1[257]|3[013]|4[01]|5[0137]|6[058]|78|8[1568]|9[14])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|3[15]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|[578]1|9[15])|6(?:12(?:[2-6]|7[0-8])|74[2-7])|7(?:(?:2[14]|5[15])[2-6]|3171|61[346]|88(?:[2-7]|82))|8(?:70[2-6]|84(?:[2356]|7[19])|91(?:[3-6]|7[19]))|73[134][2-6]|(?:74[47]|8(?:16|2[014]|3[126]|6[136]|7[78]|83))(?:[2-6]|7[19])|(?:1(?:29|60|8[06])|261|552|6(?:[2-4]1|5[17]|6[13]|7(?:1|4[0189])|80)|7(?:12|88[01]))[2-7]"],"0$1",1],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1(?:[2-479]|5[0235-9])|[2-5]|6(?:1[1358]|2[2457-9]|3[2-5]|4[235-7]|5[2-689]|6[24578]|7[235689]|8[1-6])|7(?:1[013-9]|28|3[129]|4[1-35689]|5[29]|6[02-5]|70)|807","1(?:[2-479]|5[0235-9])|[2-5]|6(?:1[1358]|2(?:[2457]|84|95)|3(?:[2-4]|55)|4[235-7]|5[2-689]|6[24578]|7[235689]|8[1-6])|7(?:1(?:[013-8]|9[6-9])|28[6-8]|3(?:17|2[0-49]|9[2-57])|4(?:1[2-4]|[29][0-7]|3[0-8]|[56]|8[0-24-7])|5(?:2[1-3]|9[0-6])|6(?:0[5689]|2[5-9]|3[02-8]|4|5[0-367])|70[13-7])|807[19]","1(?:[2-479]|5(?:[0236-9]|5[013-9]))|[2-5]|6(?:2(?:84|95)|355|83)|73179|807(?:1|9[1-3])|(?:1552|6(?:1[1358]|2[2457]|3[2-4]|4[235-7]|5[2-689]|6[24578]|7[235689]|8[124-6])\\d|7(?:1(?:[013-8]\\d|9[6-9])|28[6-8]|3(?:2[0-49]|9[2-57])|4(?:1[2-4]|[29][0-7]|3[0-8]|[56]\\d|8[0-24-7])|5(?:2[1-3]|9[0-6])|6(?:0[5689]|2[5-9]|3[02-8]|4\\d|5[0-367])|70[13-7]))[2-7]"],"0$1",1],["(\\d{5})(\\d{5})","$1 $2",["[6-9]"],"0$1",1],["(\\d{4})(\\d{2,4})(\\d{4})","$1 $2 $3",["1(?:6|8[06])","1(?:6|8[06]0)"],0,1],["(\\d{4})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["18"],0,1]],"0"],IO:["246","00","3\\d{6}",[7],[["(\\d{3})(\\d{4})","$1 $2",["3"]]]],IQ:["964","00","(?:1|7\\d\\d)\\d{7}|[2-6]\\d{7,8}",[8,9,10],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-6]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"0$1"]],"0"],IR:["98","00","[1-9]\\d{9}|(?:[1-8]\\d\\d|9)\\d{3,4}",[4,5,6,7,10],[["(\\d{4,5})","$1",["96"],"0$1"],["(\\d{2})(\\d{4,5})","$1 $2",["(?:1[137]|2[13-68]|3[1458]|4[145]|5[1468]|6[16]|7[1467]|8[13467])[12689]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["9"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["[1-8]"],"0$1"]],"0"],IS:["354","00|1(?:0(?:01|[12]0)|100)","(?:38\\d|[4-9])\\d{6}",[7,9],[["(\\d{3})(\\d{4})","$1 $2",["[4-9]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["3"]]],0,0,0,0,0,0,0,"00"],IT:["39","00","0\\d{5,10}|1\\d{8,10}|3(?:[0-8]\\d{7,10}|9\\d{7,8})|(?:43|55|70)\\d{8}|8\\d{5}(?:\\d{2,4})?",[6,7,8,9,10,11,12],[["(\\d{2})(\\d{4,6})","$1 $2",["0[26]"]],["(\\d{3})(\\d{3,6})","$1 $2",["0[13-57-9][0159]|8(?:03|4[17]|9[2-5])","0[13-57-9][0159]|8(?:03|4[17]|9(?:2|3[04]|[45][0-4]))"]],["(\\d{4})(\\d{2,6})","$1 $2",["0(?:[13-579][2-46-8]|8[236-8])"]],["(\\d{4})(\\d{4})","$1 $2",["894"]],["(\\d{2})(\\d{3,4})(\\d{4})","$1 $2 $3",["0[26]|5"]],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["1(?:44|[679])|[378]|43"]],["(\\d{3})(\\d{3,4})(\\d{4})","$1 $2 $3",["0[13-57-9][0159]|14"]],["(\\d{2})(\\d{4})(\\d{5})","$1 $2 $3",["0[26]"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["0"]],["(\\d{3})(\\d{4})(\\d{4,5})","$1 $2 $3",["3"]]],0,0,0,0,0,0,[["0669[0-79]\\d{1,6}|0(?:1(?:[0159]\\d|[27][1-5]|31|4[1-4]|6[1356]|8[2-57])|2\\d\\d|3(?:[0159]\\d|2[1-4]|3[12]|[48][1-6]|6[2-59]|7[1-7])|4(?:[0159]\\d|[23][1-9]|4[245]|6[1-5]|7[1-4]|81)|5(?:[0159]\\d|2[1-5]|3[2-6]|4[1-79]|6[4-6]|7[1-578]|8[3-8])|6(?:[0-57-9]\\d|6[0-8])|7(?:[0159]\\d|2[12]|3[1-7]|4[2-46]|6[13569]|7[13-6]|8[1-59])|8(?:[0159]\\d|2[3-578]|3[1-356]|[6-8][1-5])|9(?:[0159]\\d|[238][1-5]|4[12]|6[1-8]|7[1-6]))\\d{2,7}",[6,7,8,9,10,11]],["3[2-9]\\d{7,8}|(?:31|43)\\d{8}",[9,10]],["80(?:0\\d{3}|3)\\d{3}",[6,9]],["(?:0878\\d{3}|89(?:2\\d|3[04]|4(?:[0-4]|[5-9]\\d\\d)|5[0-4]))\\d\\d|(?:1(?:44|6[346])|89(?:38|5[5-9]|9))\\d{6}",[6,8,9,10]],["1(?:78\\d|99)\\d{6}",[9,10]],["3[2-8]\\d{9,10}",[11,12]],0,0,["55\\d{8}",[10]],["84(?:[08]\\d{3}|[17])\\d{3}",[6,9]]]],JE:["44","00","1534\\d{6}|(?:[3578]\\d|90)\\d{8}",[10],0,"0",0,"([0-24-8]\\d{5})$|0","1534$1",0,0,[["1534[0-24-8]\\d{5}"],["7(?:(?:(?:50|82)9|937)\\d|7(?:00[378]|97\\d))\\d{5}"],["80(?:07(?:35|81)|8901)\\d{4}"],["(?:8(?:4(?:4(?:4(?:05|42|69)|703)|5(?:041|800))|7(?:0002|1206))|90(?:066[59]|1810|71(?:07|55)))\\d{4}"],["701511\\d{4}"],0,["(?:3(?:0(?:07(?:35|81)|8901)|3\\d{4}|4(?:4(?:4(?:05|42|69)|703)|5(?:041|800))|7(?:0002|1206))|55\\d{4})\\d{4}"],["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}"],["56\\d{8}"]]],JM:["1","011","(?:[58]\\d\\d|658|900)\\d{7}",[10],0,"1",0,0,0,0,"658|876"],JO:["962","00","(?:(?:[2689]|7\\d)\\d|32|53)\\d{6}",[8,9],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[2356]|87"],"(0$1)"],["(\\d{3})(\\d{5,6})","$1 $2",["[89]"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["70"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["7"],"0$1"]],"0"],JP:["81","010","00[1-9]\\d{6,14}|[257-9]\\d{9}|(?:00|[1-9]\\d\\d)\\d{6}",[8,9,10,11,12,13,14,15,16,17],[["(\\d{3})(\\d{3})(\\d{3})","$1-$2-$3",["(?:12|57|99)0"],"0$1"],["(\\d{4})(\\d)(\\d{4})","$1-$2-$3",["1(?:26|3[79]|4[56]|5[4-68]|6[3-5])|499|5(?:76|97)|746|8(?:3[89]|47|51)|9(?:80|9[16])","1(?:267|3(?:7[247]|9[278])|466|5(?:47|58|64)|6(?:3[245]|48|5[4-68]))|499[2468]|5(?:76|97)9|7468|8(?:3(?:8[7-9]|96)|477|51[2-9])|9(?:802|9(?:1[23]|69))|1(?:45|58)[67]","1(?:267|3(?:7[247]|9[278])|466|5(?:47|58|64)|6(?:3[245]|48|5[4-68]))|499[2468]|5(?:769|979[2-69])|7468|8(?:3(?:8[7-9]|96[2457-9])|477|51[2-9])|9(?:802|9(?:1[23]|69))|1(?:45|58)[67]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["60"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1-$2-$3",["[36]|4(?:2[09]|7[01])","[36]|4(?:2(?:0|9[02-69])|7(?:0[019]|1))"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["1(?:1|5[45]|77|88|9[69])|2(?:2[1-37]|3[0-269]|4[59]|5|6[24]|7[1-358]|8[1369]|9[0-38])|4(?:[28][1-9]|3[0-57]|[45]|6[248]|7[2-579]|9[29])|5(?:2|3[0459]|4[0-369]|5[29]|8[02389]|9[0-389])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9[2-6])|8(?:2[124589]|3[26-9]|49|51|6|7[0-468]|8[68]|9[019])|9(?:[23][1-9]|4[15]|5[138]|6[1-3]|7[156]|8[189]|9[1-489])","1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2(?:[127]|3[014-9])|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|9[19])|62|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|8[1-9]|9[29])|5(?:2|3(?:[045]|9[0-8])|4[0-369]|5[29]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9[0-2469])|3(?:[29]|60)|49|51|6(?:[0-24]|36|5[0-3589]|7[23]|9[01459])|7[0-468]|8[68])|9(?:[23][1-9]|4[15]|5[138]|6[1-3]|7[156]|8[189]|9(?:[1289]|3[34]|4[0178]))|(?:264|837)[016-9]|2(?:57|93)[015-9]|(?:25[0468]|422|838)[01]|(?:47[59]|59[89]|8(?:6[68]|9))[019]","1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2[127]|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|9(?:17|99))|6(?:2|4[016-9])|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|9[29])|5(?:2|3(?:[045]|9(?:[0-58]|6[4-9]|7[0-35689]))|4[0-369]|5[29]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9[0169])|3(?:[29]|60|7(?:[017-9]|6[6-8]))|49|51|6(?:[0-24]|36[2-57-9]|5(?:[0-389]|5[23])|6(?:[01]|9[178])|7(?:2[2-468]|3[78])|9[0145])|7[0-468]|8[68])|9(?:4[15]|5[138]|7[156]|8[189]|9(?:[1289]|3(?:31|4[357])|4[0178]))|(?:8294|96)[1-3]|2(?:57|93)[015-9]|(?:223|8699)[014-9]|(?:25[0468]|422|838)[01]|(?:48|8292|9[23])[1-9]|(?:47[59]|59[89]|8(?:68|9))[019]"],"0$1"],["(\\d{3})(\\d{2})(\\d{4})","$1-$2-$3",["[14]|[289][2-9]|5[3-9]|7[2-4679]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1-$2-$3",["800"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1-$2-$3",["[257-9]"],"0$1"]],"0",0,"(000[259]\\d{6})$|(?:(?:003768)0?)|0","$1"],KE:["254","000","(?:[17]\\d\\d|900)\\d{6}|(?:2|80)0\\d{6,7}|[4-6]\\d{6,8}",[7,8,9,10],[["(\\d{2})(\\d{5,7})","$1 $2",["[24-6]"],"0$1"],["(\\d{3})(\\d{6})","$1 $2",["[17]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["[89]"],"0$1"]],"0"],KG:["996","00","8\\d{9}|[235-9]\\d{8}",[9,10],[["(\\d{4})(\\d{5})","$1 $2",["3(?:1[346]|[24-79])"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[235-79]|88"],"0$1"],["(\\d{3})(\\d{3})(\\d)(\\d{2,3})","$1 $2 $3 $4",["8"],"0$1"]],"0"],KH:["855","00[14-9]","1\\d{9}|[1-9]\\d{7,8}",[8,9,10],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-9]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]]],"0"],KI:["686","00","(?:[37]\\d|6[0-79])\\d{6}|(?:[2-48]\\d|50)\\d{3}",[5,8],0,"0"],KM:["269","00","[3478]\\d{6}",[7],[["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["[3478]"]]]],KN:["1","011","(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-7]\\d{6})$|1","869$1",0,"869"],KP:["850","00|99","85\\d{6}|(?:19\\d|[2-7])\\d{7}",[8,10],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["8"],"0$1"],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[2-7]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"]],"0"],KR:["82","00(?:[125689]|3(?:[46]5|91)|7(?:00|27|3|55|6[126]))","00[1-9]\\d{8,11}|(?:[12]|5\\d{3})\\d{7}|[13-6]\\d{9}|(?:[1-6]\\d|80)\\d{7}|[3-6]\\d{4,5}|(?:00|7)0\\d{8}",[5,6,8,9,10,11,12,13,14],[["(\\d{2})(\\d{3,4})","$1-$2",["(?:3[1-3]|[46][1-4]|5[1-5])1"],"0$1"],["(\\d{4})(\\d{4})","$1-$2",["1"]],["(\\d)(\\d{3,4})(\\d{4})","$1-$2-$3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["[36]0|8"],"0$1"],["(\\d{2})(\\d{3,4})(\\d{4})","$1-$2-$3",["[1346]|5[1-5]"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1-$2-$3",["[57]"],"0$1"],["(\\d{2})(\\d{5})(\\d{4})","$1-$2-$3",["5"],"0$1"]],"0",0,"0(8(?:[1-46-8]|5\\d\\d))?"],KW:["965","00","18\\d{5}|(?:[2569]\\d|41)\\d{6}",[7,8],[["(\\d{4})(\\d{3,4})","$1 $2",["[169]|2(?:[235]|4[1-35-9])|52"]],["(\\d{3})(\\d{5})","$1 $2",["[245]"]]]],KY:["1","011","(?:345|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","345$1",0,"345"],KZ:["7","810","(?:33622|8\\d{8})\\d{5}|[78]\\d{9}",[10,14],0,"8",0,0,0,0,"33|7",0,"8~10"],LA:["856","00","[23]\\d{9}|3\\d{8}|(?:[235-8]\\d|41)\\d{6}",[8,9,10],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["2[13]|3[14]|[4-8]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3 $4",["3"],"0$1"],["(\\d{2})(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3 $4",["[23]"],"0$1"]],"0"],LB:["961","00","[27-9]\\d{7}|[13-9]\\d{6}",[7,8],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[13-69]|7(?:[2-57]|62|8[0-7]|9[04-9])|8[02-9]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[27-9]"]]],"0"],LC:["1","011","(?:[58]\\d\\d|758|900)\\d{7}",[10],0,"1",0,"([2-8]\\d{6})$|1","758$1",0,"758"],LI:["423","00","[68]\\d{8}|(?:[2378]\\d|90)\\d{5}",[7,9],[["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["[2379]|8(?:0[09]|7)","[2379]|8(?:0(?:02|9)|7)"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["69"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6"]]],"0",0,"(1001)|0"],LK:["94","00","[1-9]\\d{8}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[1-689]"],"0$1"]],"0"],LR:["231","00","(?:[245]\\d|33|77|88)\\d{7}|(?:2\\d|[4-6])\\d{6}",[7,8,9],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["4[67]|[56]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[2-578]"],"0$1"]],"0"],LS:["266","00","(?:[256]\\d\\d|800)\\d{5}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[2568]"]]]],LT:["370","00","(?:[3469]\\d|52|[78]0)\\d{6}",[8],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["52[0-7]"],"(0-$1)",1],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[7-9]"],"0 $1",1],["(\\d{2})(\\d{6})","$1 $2",["37|4(?:[15]|6[1-8])"],"(0-$1)",1],["(\\d{3})(\\d{5})","$1 $2",["[3-6]"],"(0-$1)",1]],"0",0,"[08]"],LU:["352","00","35[013-9]\\d{4,8}|6\\d{8}|35\\d{2,4}|(?:[2457-9]\\d|3[0-46-9])\\d{2,9}",[4,5,6,7,8,9,10,11],[["(\\d{2})(\\d{3})","$1 $2",["2(?:0[2-689]|[2-9])|[3-57]|8(?:0[2-9]|[13-9])|9(?:0[89]|[2-579])"]],["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["2(?:0[2-689]|[2-9])|[3-57]|8(?:0[2-9]|[13-9])|9(?:0[89]|[2-579])"]],["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["20[2-689]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{1,2})","$1 $2 $3 $4",["2(?:[0367]|4[3-8])"]],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["80[01]|90[015]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3 $4",["20"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{1,2})","$1 $2 $3 $4 $5",["2(?:[0367]|4[3-8])"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{1,5})","$1 $2 $3 $4",["[3-57]|8[13-9]|9(?:0[89]|[2-579])|(?:2|80)[2-9]"]]],0,0,"(15(?:0[06]|1[12]|[35]5|4[04]|6[26]|77|88|99)\\d)"],LV:["371","00","(?:[268]\\d|90)\\d{6}",[8],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[269]|8[01]"]]]],LY:["218","00","[2-9]\\d{8}",[9],[["(\\d{2})(\\d{7})","$1-$2",["[2-9]"],"0$1"]],"0"],MA:["212","00","[5-8]\\d{8}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["5[45]"],"0$1"],["(\\d{4})(\\d{5})","$1-$2",["5(?:2[2-46-9]|3[3-9]|9)|8(?:0[89]|92)"],"0$1"],["(\\d{2})(\\d{7})","$1-$2",["8"],"0$1"],["(\\d{3})(\\d{6})","$1-$2",["[5-7]"],"0$1"]],"0",0,0,0,0,0,[["5(?:2(?:[0-25-79]\\d|3[1-578]|4[02-46-8]|8[0235-7])|3(?:[0-47]\\d|5[02-9]|6[02-8]|8[014-9]|9[3-9])|(?:4[067]|5[03])\\d)\\d{5}"],["(?:6(?:[0-79]\\d|8[0-247-9])|7(?:[0167]\\d|2[0-467]|5[0-3]|8[0-7]))\\d{6}"],["80[0-7]\\d{6}"],["89\\d{7}"],0,0,0,0,["(?:592(?:4[0-2]|93)|80[89]\\d\\d)\\d{4}"]]],MC:["377","00","(?:[3489]|6\\d)\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["4"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[389]"]],["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["6"],"0$1"]],"0"],MD:["373","00","(?:[235-7]\\d|[89]0)\\d{6}",[8],[["(\\d{3})(\\d{5})","$1 $2",["[89]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["22|3"],"0$1"],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[25-7]"],"0$1"]],"0"],ME:["382","00","(?:20|[3-79]\\d)\\d{6}|80\\d{6,7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-9]"],"0$1"]],"0"],MF:["590","00","(?:590\\d|7090)\\d{5}|(?:69|80|9\\d)\\d{7}",[9],0,"0",0,0,0,0,0,[["590(?:0[079]|[14]3|[27][79]|3[03-7]|5[0-268]|87)\\d{4}"],["(?:69(?:0\\d\\d|1(?:2[2-9]|3[0-5])|4(?:0[89]|1[2-6]|9\\d)|6(?:1[016-9]|5[0-4]|[67]\\d))|7090[0-4])\\d{4}"],["80[0-5]\\d{6}"],0,0,0,0,0,["9(?:(?:39[5-7]|76[018])\\d|475[0-6])\\d{4}"]]],MG:["261","00","[23]\\d{8}",[9],[["(\\d{2})(\\d{2})(\\d{3})(\\d{2})","$1 $2 $3 $4",["[23]"],"0$1"]],"0",0,"([24-9]\\d{6})$|0","20$1"],MH:["692","011","329\\d{4}|(?:[256]\\d|45)\\d{5}",[7],[["(\\d{3})(\\d{4})","$1-$2",["[2-6]"]]],"1"],MK:["389","00","[2-578]\\d{7}",[8],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["2|34[47]|4(?:[37]7|5[47]|64)"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[347]"],"0$1"],["(\\d{3})(\\d)(\\d{2})(\\d{2})","$1 $2 $3 $4",["[58]"],"0$1"]],"0"],ML:["223","00","[24-9]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[24-9]"]]]],MM:["95","00","1\\d{5,7}|95\\d{6}|(?:[4-7]|9[0-46-9])\\d{6,8}|(?:2|8\\d)\\d{5,8}",[6,7,8,9,10],[["(\\d)(\\d{2})(\\d{3})","$1 $2 $3",["16|2"],"0$1"],["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["4(?:[2-46]|5[3-5])|5|6(?:[1-689]|7[235-7])|7(?:[0-4]|5[2-7])|8[1-5]|(?:60|86)[23]"],"0$1"],["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["[12]|452|678|86","[12]|452|6788|86"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[4-7]|8[1-35]"],"0$1"],["(\\d)(\\d{3})(\\d{4,6})","$1 $2 $3",["9(?:2[0-4]|[35-9]|4[137-9])"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["2"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"],"0$1"],["(\\d)(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["92"],"0$1"],["(\\d)(\\d{5})(\\d{4})","$1 $2 $3",["9"],"0$1"]],"0"],MN:["976","001","[12]\\d{7,9}|[5-9]\\d{7}",[8,9,10],[["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["[12]1"],"0$1"],["(\\d{4})(\\d{4})","$1 $2",["[5-9]"]],["(\\d{3})(\\d{5,6})","$1 $2",["[12]2[1-3]"],"0$1"],["(\\d{4})(\\d{5,6})","$1 $2",["[12](?:27|3[2-8]|4[2-68]|5[1-4689])","[12](?:27|3[2-8]|4[2-68]|5[1-4689])[0-3]"],"0$1"],["(\\d{5})(\\d{4,5})","$1 $2",["[12]"],"0$1"]],"0"],MO:["853","00","0800\\d{3}|(?:28|[68]\\d)\\d{6}",[7,8],[["(\\d{4})(\\d{3})","$1 $2",["0"]],["(\\d{4})(\\d{4})","$1 $2",["[268]"]]]],MP:["1","011","[58]\\d{9}|(?:67|90)0\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","670$1",0,"670"],MQ:["596","00","(?:596\\d|7091)\\d{5}|(?:69|[89]\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-79]|8(?:0[6-9]|[36])"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0"],MR:["222","00","(?:[2-4]\\d\\d|800)\\d{5}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-48]"]]]],MS:["1","011","(?:[58]\\d\\d|664|900)\\d{7}",[10],0,"1",0,"([34]\\d{6})$|1","664$1",0,"664"],MT:["356","00","3550\\d{4}|(?:[2579]\\d\\d|800)\\d{5}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[2357-9]"]]]],MU:["230","0(?:0|[24-7]0|3[03])","(?:[57]|8\\d\\d)\\d{7}|[2-468]\\d{6}",[7,8,10],[["(\\d{3})(\\d{4})","$1 $2",["[2-46]|8[013]"]],["(\\d{4})(\\d{4})","$1 $2",["[57]"]],["(\\d{5})(\\d{5})","$1 $2",["8"]]],0,0,0,0,0,0,0,"020"],MV:["960","0(?:0|19)","(?:800|9[0-57-9]\\d)\\d{7}|[34679]\\d{6}",[7,10],[["(\\d{3})(\\d{4})","$1-$2",["[34679]"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[89]"]]],0,0,0,0,0,0,0,"00"],MW:["265","00","(?:[1289]\\d|31|77)\\d{7}|1\\d{6}",[7,9],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["1[2-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["2"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[137-9]"],"0$1"]],"0"],MX:["52","0[09]","[2-9]\\d{9}",[10],[["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["33|5[56]|81"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[2-9]"]]],0,0,0,0,0,0,0,"00"],MY:["60","00","1\\d{8,9}|(?:3\\d|[4-9])\\d{7}",[8,9,10],[["(\\d)(\\d{3})(\\d{4})","$1-$2 $3",["[4-79]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1-$2 $3",["1(?:[02469]|[378][1-9]|53)|8","1(?:[02469]|[37][1-9]|53|8(?:[1-46-9]|5[7-9]))|8"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1-$2 $3",["3"],"0$1"],["(\\d)(\\d{3})(\\d{2})(\\d{4})","$1-$2-$3-$4",["1(?:[367]|80)"]],["(\\d{3})(\\d{3})(\\d{4})","$1-$2 $3",["15"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1-$2 $3",["1"],"0$1"]],"0"],MZ:["258","00","(?:2|8\\d)\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["2|8[2-79]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"]]]],NA:["264","00","[68]\\d{7,8}",[8,9],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["88"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["6"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["87"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["8"],"0$1"]],"0"],NC:["687","00","(?:050|[2-57-9]\\d\\d)\\d{3}",[6],[["(\\d{2})(\\d{2})(\\d{2})","$1.$2.$3",["[02-57-9]"]]]],NE:["227","00","[027-9]\\d{7}",[8],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["08"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[089]|2[013]|7[0467]"]]]],NF:["672","00","[13]\\d{5}",[6],[["(\\d{2})(\\d{4})","$1 $2",["1[0-3]"]],["(\\d)(\\d{5})","$1 $2",["[13]"]]],0,0,"([0-258]\\d{4})$","3$1"],NG:["234","009","(?:20|9\\d)\\d{8}|[78]\\d{9,13}",[10,11,12,13,14],[["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["[7-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["20[129]"],"0$1"],["(\\d{4})(\\d{2})(\\d{4})","$1 $2 $3",["2"],"0$1"],["(\\d{3})(\\d{4})(\\d{4,5})","$1 $2 $3",["[78]"],"0$1"],["(\\d{3})(\\d{5})(\\d{5,6})","$1 $2 $3",["[78]"],"0$1"]],"0"],NI:["505","00","(?:1800|[25-8]\\d{3})\\d{4}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[125-8]"]]]],NL:["31","00","(?:[124-7]\\d\\d|3(?:[02-9]\\d|1[0-8]))\\d{6}|8\\d{6,9}|9\\d{6,10}|1\\d{4,5}",[5,6,7,8,9,10,11],[["(\\d{3})(\\d{4,7})","$1 $2",["[89]0"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["66"],"0$1"],["(\\d)(\\d{8})","$1 $2",["6"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["1[16-8]|2[259]|3[124]|4[17-9]|5[124679]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[1-578]|91"],"0$1"],["(\\d{3})(\\d{3})(\\d{5})","$1 $2 $3",["9"],"0$1"]],"0"],NO:["47","00","(?:0|[2-9]\\d{3})\\d{4}",[5,8],[["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["8"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-79]"]]],0,0,0,0,0,"[02-689]|7[0-8]"],NP:["977","00","(?:1\\d|9)\\d{9}|[1-9]\\d{7}",[8,10,11],[["(\\d)(\\d{7})","$1-$2",["1[2-6]"],"0$1"],["(\\d{2})(\\d{6})","$1-$2",["1[01]|[2-8]|9(?:[1-59]|[67][2-6])"],"0$1"],["(\\d{3})(\\d{7})","$1-$2",["9"]]],"0"],NR:["674","00","(?:222|444|(?:55|8\\d)\\d|666|777|999)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[24-9]"]]]],NU:["683","00","(?:[4-7]|888\\d)\\d{3}",[4,7],[["(\\d{3})(\\d{4})","$1 $2",["8"]]]],NZ:["64","0(?:0|161)","[1289]\\d{9}|50\\d{5}(?:\\d{2,3})?|[27-9]\\d{7,8}|(?:[34]\\d|6[0-35-9])\\d{6}|8\\d{4,6}",[5,6,7,8,9,10],[["(\\d{2})(\\d{3,8})","$1 $2",["8[1-79]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2,3})","$1 $2 $3",["50[036-8]|8|90","50(?:[0367]|88)|8|90"],"0$1"],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["24|[346]|7[2-57-9]|9[2-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["2(?:10|74)|[589]"],"0$1"],["(\\d{2})(\\d{3,4})(\\d{4})","$1 $2 $3",["1|2[028]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,5})","$1 $2 $3",["2(?:[169]|7[0-35-9])|7"],"0$1"]],"0",0,0,0,0,0,0,"00"],OM:["968","00","(?:1505|[279]\\d{3}|500)\\d{4}|800\\d{5,6}",[7,8,9],[["(\\d{3})(\\d{4,6})","$1 $2",["[58]"]],["(\\d{2})(\\d{6})","$1 $2",["2"]],["(\\d{4})(\\d{4})","$1 $2",["[179]"]]]],PA:["507","00","(?:00800|8\\d{3})\\d{6}|[68]\\d{7}|[1-57-9]\\d{6}",[7,8,10,11],[["(\\d{3})(\\d{4})","$1-$2",["[1-57-9]"]],["(\\d{4})(\\d{4})","$1-$2",["[68]"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"]]]],PE:["51","00|19(?:1[124]|77|90)00","(?:[14-8]|9\\d)\\d{7}",[8,9],[["(\\d{3})(\\d{5})","$1 $2",["80"],"(0$1)"],["(\\d)(\\d{7})","$1 $2",["1"],"(0$1)"],["(\\d{2})(\\d{6})","$1 $2",["[4-8]"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["9"]]],"0",0,0,0,0,0,0,"00"," Anexo "],PF:["689","00","4\\d{5}(?:\\d{2})?|8\\d{7,8}",[6,8,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["44"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["4|8[7-9]"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"]]]],PG:["675","00|140[1-3]","(?:180|[78]\\d{3})\\d{4}|(?:[2-589]\\d|64)\\d{5}",[7,8],[["(\\d{3})(\\d{4})","$1 $2",["18|[2-69]|85"]],["(\\d{4})(\\d{4})","$1 $2",["[78]"]]],0,0,0,0,0,0,0,"00"],PH:["63","00","(?:[2-7]|9\\d)\\d{8}|2\\d{5}|(?:1800|8)\\d{7,9}",[6,8,9,10,11,12,13],[["(\\d)(\\d{5})","$1 $2",["2"],"(0$1)"],["(\\d{4})(\\d{4,6})","$1 $2",["3(?:23|39|46)|4(?:2[3-6]|[35]9|4[26]|76)|544|88[245]|(?:52|64|86)2","3(?:230|397|461)|4(?:2(?:35|[46]4|51)|396|4(?:22|63)|59[347]|76[15])|5(?:221|446)|642[23]|8(?:622|8(?:[24]2|5[13]))"],"(0$1)"],["(\\d{5})(\\d{4})","$1 $2",["346|4(?:27|9[35])|883","3469|4(?:279|9(?:30|56))|8834"],"(0$1)"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["2"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[3-7]|8[2-8]"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[89]"],"0$1"],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]],["(\\d{4})(\\d{1,2})(\\d{3})(\\d{4})","$1 $2 $3 $4",["1"]]],"0"],PK:["92","00","122\\d{6}|[24-8]\\d{10,11}|9(?:[013-9]\\d{8,10}|2(?:[01]\\d\\d|2(?:[06-8]\\d|1[01]))\\d{7})|(?:[2-8]\\d{3}|92(?:[0-7]\\d|8[1-9]))\\d{6}|[24-9]\\d{8}|[89]\\d{7}",[8,9,10,11,12],[["(\\d{3})(\\d{3})(\\d{2,7})","$1 $2 $3",["[89]0"],"0$1"],["(\\d{4})(\\d{5})","$1 $2",["1"]],["(\\d{3})(\\d{6,7})","$1 $2",["2(?:3[2358]|4[2-4]|9[2-8])|45[3479]|54[2-467]|60[468]|72[236]|8(?:2[2-689]|3[23578]|4[3478]|5[2356])|9(?:2[2-8]|3[27-9]|4[2-6]|6[3569]|9[25-8])","9(?:2[3-8]|98)|(?:2(?:3[2358]|4[2-4]|9[2-8])|45[3479]|54[2-467]|60[468]|72[236]|8(?:2[2-689]|3[23578]|4[3478]|5[2356])|9(?:22|3[27-9]|4[2-6]|6[3569]|9[25-7]))[2-9]"],"(0$1)"],["(\\d{2})(\\d{7,8})","$1 $2",["(?:2[125]|4[0-246-9]|5[1-35-7]|6[1-8]|7[14]|8[16]|91)[2-9]"],"(0$1)"],["(\\d{5})(\\d{5})","$1 $2",["58"],"(0$1)"],["(\\d{3})(\\d{7})","$1 $2",["3"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["2[125]|4[0-246-9]|5[1-35-7]|6[1-8]|7[14]|8[16]|91"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["[24-9]"],"(0$1)"]],"0"],PL:["48","00","(?:6|8\\d\\d)\\d{7}|[1-9]\\d{6}(?:\\d{2})?|[26]\\d{5}",[6,7,8,9,10],[["(\\d{5})","$1",["19"]],["(\\d{3})(\\d{3})","$1 $2",["11|20|64"]],["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["(?:1[2-8]|2[2-69]|3[2-4]|4[1-468]|5[24-689]|6[1-3578]|7[14-7]|8[1-79]|9[145])1","(?:1[2-8]|2[2-69]|3[2-4]|4[1-468]|5[24-689]|6[1-3578]|7[14-7]|8[1-79]|9[145])19"]],["(\\d{3})(\\d{2})(\\d{2,3})","$1 $2 $3",["64"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["21|39|45|5[0137]|6[0469]|7[02389]|8(?:0[14]|8)"]],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1[2-8]|[2-7]|8[1-79]|9[145]"]],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["8"]]]],PM:["508","00","[45]\\d{5}|(?:708|8\\d\\d)\\d{6}",[6,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["[45]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["7"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0"],PR:["1","011","(?:[589]\\d\\d|787)\\d{7}",[10],0,"1",0,0,0,0,"787|939"],PS:["970","00","[2489]2\\d{6}|(?:1\\d|5)\\d{8}",[8,9,10],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[2489]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["5"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]]],"0"],PT:["351","00","1693\\d{5}|(?:[26-9]\\d|30)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["2[12]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["16|[236-9]"]]]],PW:["680","01[12]","(?:[24-8]\\d\\d|345|900)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-9]"]]]],PY:["595","00","59\\d{4,6}|9\\d{5,10}|(?:[2-46-8]\\d|5[0-8])\\d{4,7}",[6,7,8,9,10,11],[["(\\d{3})(\\d{3,6})","$1 $2",["[2-9]0"],"0$1"],["(\\d{2})(\\d{5})","$1 $2",["[26]1|3[289]|4[1246-8]|7[1-3]|8[1-36]"],"(0$1)"],["(\\d{3})(\\d{4,5})","$1 $2",["2[279]|3[13-5]|4[359]|5|6(?:[34]|7[1-46-8])|7[46-8]|85"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["2[14-68]|3[26-9]|4[1246-8]|6(?:1|75)|7[1-35]|8[1-36]"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["87"]],["(\\d{3})(\\d{6})","$1 $2",["9(?:[5-79]|8[1-7])"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[2-8]"],"0$1"],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["9"]]],"0"],QA:["974","00","800\\d{4}|(?:2|800)\\d{6}|(?:0080|[3-7])\\d{7}",[7,8,9,11],[["(\\d{3})(\\d{4})","$1 $2",["2[136]|8"]],["(\\d{4})(\\d{4})","$1 $2",["[3-7]"]]]],RE:["262","00","709\\d{6}|(?:26|[689]\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[26-9]"],"0$1"]],"0",0,0,0,0,0,[["26(?:2\\d\\d|3(?:0\\d|1[0-6]))\\d{4}"],["(?:69(?:2\\d\\d|3(?:[06][0-6]|1[0-3]|2[0-2]|3[0-39]|4\\d|5[0-5]|7[0-37]|8[0-8]|9[0-479]))|7092[0-3])\\d{4}"],["80\\d{7}"],["89[1-37-9]\\d{6}"],0,0,0,0,["9(?:399[0-3]|479[0-6]|76(?:2[278]|3[0-37]))\\d{4}"],["8(?:1[019]|2[0156]|84|90)\\d{6}"]]],RO:["40","00","(?:[236-8]\\d|90)\\d{7}|[23]\\d{5}",[6,9],[["(\\d{3})(\\d{3})","$1 $2",["2[3-6]","2[3-6]\\d9"],"0$1"],["(\\d{2})(\\d{4})","$1 $2",["219|31"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[23]1"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[236-9]"],"0$1"]],"0",0,0,0,0,0,0,0," int "],RS:["381","00","38[02-9]\\d{6,9}|6\\d{7,9}|90\\d{4,8}|38\\d{5,6}|(?:7\\d\\d|800)\\d{3,9}|(?:[12]\\d|3[0-79])\\d{5,10}",[6,7,8,9,10,11,12],[["(\\d{3})(\\d{3,9})","$1 $2",["(?:2[389]|39)0|[7-9]"],"0$1"],["(\\d{2})(\\d{5,10})","$1 $2",["[1-36]"],"0$1"]],"0"],RU:["7","810","8\\d{13}|[347-9]\\d{9}",[10,14],[["(\\d{4})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["7(?:1[0-8]|2[1-9])","7(?:1(?:[0-356]2|4[29]|7|8[27])|2(?:1[23]|[2-9]2))","7(?:1(?:[0-356]2|4[29]|7|8[27])|2(?:13[03-69]|62[013-9]))|72[1-57-9]2"],"8 ($1)",1],["(\\d{5})(\\d)(\\d{2})(\\d{2})","$1 $2 $3 $4",["7(?:1[0-68]|2[1-9])","7(?:1(?:[06][3-6]|[18]|2[35]|[3-5][3-5])|2(?:[13][3-5]|[24-689]|7[457]))","7(?:1(?:0(?:[356]|4[023])|[18]|2(?:3[013-9]|5)|3[45]|43[013-79]|5(?:3[1-8]|4[1-7]|5)|6(?:3[0-35-9]|[4-6]))|2(?:1(?:3[178]|[45])|[24-689]|3[35]|7[457]))|7(?:14|23)4[0-8]|71(?:33|45)[1-79]"],"8 ($1)",1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"8 ($1)",1],["(\\d{3})(\\d{3})(\\d{2})(\\d{2})","$1 $2-$3-$4",["[349]|8(?:[02-7]|1[1-8])"],"8 ($1)",1],["(\\d{4})(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3 $4",["8"],"8 ($1)"]],"8",0,0,0,0,"3[04-689]|[489]",0,"8~10"],RW:["250","00","(?:06|[27]\\d\\d|[89]00)\\d{6}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["0"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["2"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[7-9]"],"0$1"]],"0"],SA:["966","00","92\\d{7}|(?:[15]|8\\d)\\d{8}",[9,10],[["(\\d{4})(\\d{5})","$1 $2",["9"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["5"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["81"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"]]],"0"],SB:["677","0[01]","[6-9]\\d{6}|[1-6]\\d{4}",[5,7],[["(\\d{2})(\\d{5})","$1 $2",["6[89]|7|8[4-9]|9(?:[1-8]|9[0-8])"]]]],SC:["248","010|0[0-2]","(?:[2489]\\d|64)\\d{5}",[7],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[246]|9[57]"]]],0,0,0,0,0,0,0,"00"],SD:["249","00","[19]\\d{8}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[19]"],"0$1"]],"0"],SE:["46","00","(?:[26]\\d\\d|9)\\d{9}|[1-9]\\d{8}|[1-689]\\d{7}|[1-4689]\\d{6}|2\\d{5}",[6,7,8,9,10,12],[["(\\d{2})(\\d{2,3})(\\d{2})","$1-$2 $3",["20"],"0$1",0,"$1 $2 $3"],["(\\d{3})(\\d{4})","$1-$2",["9(?:00|39|44|9)"],"0$1",0,"$1 $2"],["(\\d{2})(\\d{3})(\\d{2})","$1-$2 $3",["[12][136]|3[356]|4[0246]|6[03]|90[1-9]"],"0$1",0,"$1 $2 $3"],["(\\d)(\\d{2,3})(\\d{2})(\\d{2})","$1-$2 $3 $4",["8"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2,3})(\\d{2})","$1-$2 $3",["1[2457]|2(?:[247-9]|5[0138])|3[0247-9]|4[1357-9]|5[0-35-9]|6(?:[125689]|4[02-57]|7[0-2])|9(?:[125-8]|3[02-5]|4[0-3])"],"0$1",0,"$1 $2 $3"],["(\\d{3})(\\d{2,3})(\\d{3})","$1-$2 $3",["9(?:00|39|44)"],"0$1",0,"$1 $2 $3"],["(\\d{2})(\\d{2,3})(\\d{2})(\\d{2})","$1-$2 $3 $4",["1[13689]|2[0136]|3[1356]|4[0246]|54|6[03]|90[1-9]"],"0$1",0,"$1 $2 $3 $4"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1-$2 $3 $4",["10|7"],"0$1",0,"$1 $2 $3 $4"],["(\\d)(\\d{3})(\\d{3})(\\d{2})","$1-$2 $3 $4",["8"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1-$2 $3 $4",["[13-5]|2(?:[247-9]|5[0138])|6(?:[124-689]|7[0-2])|9(?:[125-8]|3[02-5]|4[0-3])"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2})(\\d{2})(\\d{3})","$1-$2 $3 $4",["9"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1-$2 $3 $4 $5",["[26]"],"0$1",0,"$1 $2 $3 $4 $5"]],"0"],SG:["65","0[0-3]\\d","(?:(?:1\\d|8)\\d\\d|7000)\\d{7}|[3689]\\d{7}",[8,10,11],[["(\\d{4})(\\d{4})","$1 $2",["[369]|8(?:0[1-9]|[1-9])"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"]],["(\\d{4})(\\d{4})(\\d{3})","$1 $2 $3",["7"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]]]],SH:["290","00","(?:[256]\\d|8)\\d{3}",[4,5],0,0,0,0,0,0,"[256]"],SI:["386","00|10(?:22|66|88|99)","[1-7]\\d{7}|8\\d{4,7}|90\\d{4,6}",[5,6,7,8],[["(\\d{2})(\\d{3,6})","$1 $2",["8[09]|9"],"0$1"],["(\\d{3})(\\d{5})","$1 $2",["59|8"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[37][01]|4[0139]|51|6"],"0$1"],["(\\d)(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[1-57]"],"(0$1)"]],"0",0,0,0,0,0,0,"00"],SJ:["47","00","0\\d{4}|(?:[489]\\d|79)\\d{6}",[5,8],0,0,0,0,0,0,"79"],SK:["421","00","[2-689]\\d{8}|[2-59]\\d{6}|[2-5]\\d{5}",[6,7,9],[["(\\d)(\\d{2})(\\d{3,4})","$1 $2 $3",["21"],"0$1"],["(\\d{2})(\\d{2})(\\d{2,3})","$1 $2 $3",["[3-5][1-8]1","[3-5][1-8]1[67]"],"0$1"],["(\\d)(\\d{3})(\\d{3})(\\d{2})","$1/$2 $3 $4",["2"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[689]"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1/$2 $3 $4",["[3-5]"],"0$1"]],"0"],SL:["232","00","(?:[237-9]\\d|66)\\d{6}",[8],[["(\\d{2})(\\d{6})","$1 $2",["[236-9]"],"(0$1)"]],"0"],SM:["378","00","(?:0549|[5-7]\\d)\\d{6}",[8,10],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-7]"]],["(\\d{4})(\\d{6})","$1 $2",["0"]]],0,0,"([89]\\d{5})$","0549$1"],SN:["221","00","(?:[378]\\d|93)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"]],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[379]"]]]],SO:["252","00","[346-9]\\d{8}|[12679]\\d{7}|[1-5]\\d{6}|[1348]\\d{5}",[6,7,8,9],[["(\\d{2})(\\d{4})","$1 $2",["8[125]"]],["(\\d{6})","$1",["[134]"]],["(\\d)(\\d{6})","$1 $2",["[15]|2[0-79]|3[0-46-8]|4[0-7]"]],["(\\d)(\\d{7})","$1 $2",["(?:2|90)4|[67]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[348]|64|79|90"]],["(\\d{2})(\\d{5,7})","$1 $2",["1|28|6[0-35-9]|7[67]|9[2-9]"]]],"0"],SR:["597","00","(?:[2-5]|68|[78]\\d|90)\\d{5}",[6,7],[["(\\d{2})(\\d{2})(\\d{2})","$1-$2-$3",["56"]],["(\\d{3})(\\d{3})","$1-$2",["[2-5]"]],["(\\d{3})(\\d{4})","$1-$2",["[6-9]"]]]],SS:["211","00","[19]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[19]"],"0$1"]],"0"],ST:["239","00","(?:22|9\\d)\\d{5}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[29]"]]]],SV:["503","00","[267]\\d{7}|(?:80\\d|900)\\d{4}(?:\\d{4})?",[7,8,11],[["(\\d{3})(\\d{4})","$1 $2",["[89]"]],["(\\d{4})(\\d{4})","$1 $2",["[267]"]],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["[89]"]]]],SX:["1","011","7215\\d{6}|(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"(5\\d{6})$|1","721$1",0,"721"],SY:["963","00","[1-39]\\d{8}|[1-5]\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-5]"],"0$1",1],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["9"],"0$1",1]],"0"],SZ:["268","00","0800\\d{4}|(?:[237]\\d|900)\\d{6}",[8,9],[["(\\d{4})(\\d{4})","$1 $2",["[0237]"]],["(\\d{5})(\\d{4})","$1 $2",["9"]]]],TA:["290","00","8\\d{3}",[4],0,0,0,0,0,0,"8"],TC:["1","011","(?:[58]\\d\\d|649|900)\\d{7}",[10],0,"1",0,"([2-479]\\d{6})$|1","649$1",0,"649"],TD:["235","00|16","(?:22|[689]\\d|77)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[26-9]"]]],0,0,0,0,0,0,0,"00"],TG:["228","00","[279]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[279]"]]]],TH:["66","00[1-9]","(?:001800|[2-57]|[689]\\d)\\d{7}|1\\d{7,9}",[8,9,10,13],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[13-9]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]]],"0"],TJ:["992","810","[0-57-9]\\d{8}",[9],[["(\\d{6})(\\d)(\\d{2})","$1 $2 $3",["331","3317"]],["(\\d{3})(\\d{2})(\\d{4})","$1 $2 $3",["44[02-479]|[34]7"]],["(\\d{4})(\\d)(\\d{4})","$1 $2 $3",["3(?:[1245]|3[12])"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[0-57-9]"]]],0,0,0,0,0,0,0,"8~10"],TK:["690","00","[2-47]\\d{3,6}",[4,5,6,7]],TL:["670","00","7\\d{7}|(?:[2-47]\\d|[89]0)\\d{5}",[7,8],[["(\\d{3})(\\d{4})","$1 $2",["[2-489]|70"]],["(\\d{4})(\\d{4})","$1 $2",["7"]]]],TM:["993","810","(?:[1-6]\\d|71)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2-$3-$4",["12"],"(8 $1)"],["(\\d{3})(\\d)(\\d{2})(\\d{2})","$1 $2-$3-$4",["[1-5]"],"(8 $1)"],["(\\d{2})(\\d{6})","$1 $2",["[67]"],"8 $1"]],"8",0,0,0,0,0,0,"8~10"],TN:["216","00","[2-57-9]\\d{7}",[8],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[2-57-9]"]]]],TO:["676","00","(?:0800|(?:[5-8]\\d\\d|999)\\d)\\d{3}|[2-8]\\d{4}",[5,7],[["(\\d{2})(\\d{3})","$1-$2",["[2-4]|50|6[09]|7[0-24-69]|8[05]"]],["(\\d{4})(\\d{3})","$1 $2",["0"]],["(\\d{3})(\\d{4})","$1 $2",["[5-9]"]]]],TR:["90","00","4\\d{6}|8\\d{11,12}|(?:[2-58]\\d\\d|900)\\d{7}",[7,10,12,13],[["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["512|8[01589]|90"],"0$1",1],["(\\d{3})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["5(?:[0-59]|61)","5(?:[0-59]|61[06])","5(?:[0-59]|61[06]1)"],"0$1",1],["(\\d{3})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[24][1-8]|3[1-9]"],"(0$1)",1],["(\\d{3})(\\d{3})(\\d{6,7})","$1 $2 $3",["80"],"0$1",1]],"0"],TT:["1","011","(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-46-8]\\d{6})$|1","868$1",0,"868"],TV:["688","00","(?:2|7\\d\\d|90)\\d{4}",[5,6,7],[["(\\d{2})(\\d{3})","$1 $2",["2"]],["(\\d{2})(\\d{4})","$1 $2",["90"]],["(\\d{2})(\\d{5})","$1 $2",["7"]]]],TW:["886","0(?:0[25-79]|19)","[2-689]\\d{8}|7\\d{9,10}|[2-8]\\d{7}|2\\d{6}",[7,8,9,10,11],[["(\\d{2})(\\d)(\\d{4})","$1 $2 $3",["202"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[258]0"],"0$1"],["(\\d)(\\d{3,4})(\\d{4})","$1 $2 $3",["[23568]|4(?:0[02-48]|[1-47-9])|7[1-9]","[23568]|4(?:0[2-48]|[1-47-9])|(?:400|7)[1-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[49]"],"0$1"],["(\\d{2})(\\d{4})(\\d{4,5})","$1 $2 $3",["7"],"0$1"]],"0",0,0,0,0,0,0,0,"#"],TZ:["255","00[056]","(?:[25-8]\\d|41|90)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{4})","$1 $2 $3",["[89]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[24]"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["5"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[67]"],"0$1"]],"0"],UA:["380","00","[89]\\d{9}|[3-9]\\d{8}",[9,10],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6[12][29]|(?:3[1-8]|4[136-8]|5[12457]|6[49])2|(?:56|65)[24]","6[12][29]|(?:35|4[1378]|5[12457]|6[49])2|(?:56|65)[24]|(?:3[1-46-8]|46)2[013-9]"],"0$1"],["(\\d{4})(\\d{5})","$1 $2",["3[1-8]|4(?:[1367]|[45][6-9]|8[4-6])|5(?:[1-5]|6[0135689]|7[4-6])|6(?:[12][3-7]|[459])","3[1-8]|4(?:[1367]|[45][6-9]|8[4-6])|5(?:[1-5]|6(?:[015689]|3[02389])|7[4-6])|6(?:[12][3-7]|[459])"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[3-7]|89|9[1-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["[89]"],"0$1"]],"0",0,0,0,0,0,0,"0~0"],UG:["256","00[057]","800\\d{6}|(?:[29]0|[347]\\d)\\d{7}",[9],[["(\\d{4})(\\d{5})","$1 $2",["202","2024"],"0$1"],["(\\d{3})(\\d{6})","$1 $2",["[27-9]|4(?:6[45]|[7-9])"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["[34]"],"0$1"]],"0"],US:["1","011","[2-9]\\d{9}|3\\d{6}",[10],[["(\\d{3})(\\d{4})","$1-$2",["310"],0,1],["(\\d{3})(\\d{3})(\\d{4})","($1) $2-$3",["[2-9]"],0,1,"$1-$2-$3"]],"1",0,0,0,0,0,[["(?:3052(?:0[0-8]|[1-9]\\d)|5056(?:[0-35-9]\\d|4[0-468]))\\d{4}|(?:2742|305[3-9]|472[247-9]|505[2-57-9]|983[2-47-9])\\d{6}|(?:2(?:0[1-35-9]|1[02-9]|2[03-57-9]|3[1459]|4[08]|5[1-46]|6[0279]|7[0269]|8[13])|3(?:0[1-47-9]|1[02-9]|2[0135-79]|3[0-24679]|4[167]|5[0-2]|6[01349]|8[056])|4(?:0[124-9]|1[02-579]|2[3-5]|3[0245]|4[023578]|58|6[349]|7[0589]|8[04])|5(?:0[1-47-9]|1[0235-8]|20|3[0149]|4[01]|5[179]|6[1-47]|7[0-5]|8[0256])|6(?:0[1-35-9]|1[024-9]|2[03689]|3[016]|4[0156]|5[01679]|6[0-279]|78|8[0-29])|7(?:0[1-46-8]|1[2-9]|2[04-8]|3[0-247]|4[037]|5[47]|6[02359]|7[0-59]|8[156])|8(?:0[1-68]|1[02-8]|2[0168]|3[0-2589]|4[03578]|5[046-9]|6[02-5]|7[028])|9(?:0[1346-9]|1[02-9]|2[0589]|3[0146-8]|4[01357-9]|5[12469]|7[0-389]|8[04-69]))[2-9]\\d{6}"],[""],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["900[2-9]\\d{6}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|33|44|66|77|88)[2-9]\\d{6}"],0,0,0,["305209\\d{4}"]]],UY:["598","0(?:0|1[3-9]\\d)","0004\\d{2,9}|[1249]\\d{7}|(?:[49]\\d|80)\\d{5}",[6,7,8,9,10,11,12,13],[["(\\d{3})(\\d{3,4})","$1 $2",["0"]],["(\\d{3})(\\d{4})","$1 $2",["[49]0|8"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["9"],"0$1"],["(\\d{4})(\\d{4})","$1 $2",["[124]"]],["(\\d{3})(\\d{3})(\\d{2,4})","$1 $2 $3",["0"]],["(\\d{3})(\\d{3})(\\d{3})(\\d{2,4})","$1 $2 $3 $4",["0"]]],"0",0,0,0,0,0,0,"00"," int. "],UZ:["998","00","(?:20|33|[5-9]\\d)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[235-9]"]]]],VA:["39","00","0\\d{5,10}|3[0-8]\\d{7,10}|55\\d{8}|8\\d{5}(?:\\d{2,4})?|(?:1\\d|39)\\d{7,8}",[6,7,8,9,10,11,12],0,0,0,0,0,0,"06698"],VC:["1","011","(?:[58]\\d\\d|784|900)\\d{7}",[10],0,"1",0,"([2-7]\\d{6})$|1","784$1",0,"784"],VE:["58","00","[68]00\\d{7}|(?:[24]\\d|[59]0)\\d{8}",[10],[["(\\d{3})(\\d{7})","$1-$2",["[24-689]"],"0$1"]],"0"],VG:["1","011","(?:284|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-578]\\d{6})$|1","284$1",0,"284"],VI:["1","011","[58]\\d{9}|(?:34|90)0\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","340$1",0,"340"],VN:["84","00","[12]\\d{9}|[135-9]\\d{8}|[16]\\d{7}|[16-8]\\d{6}",[7,8,9,10],[["(\\d{2})(\\d{5})","$1 $2",["80"],"0$1",1],["(\\d{4})(\\d{4,6})","$1 $2",["1"],0,1],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["6"],"0$1",1],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[357-9]"],"0$1",1],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["2[48]"],"0$1",1],["(\\d{3})(\\d{4})(\\d{3})","$1 $2 $3",["2"],"0$1",1]],"0"],VU:["678","00","[57-9]\\d{6}|(?:[238]\\d|48)\\d{3}",[5,7],[["(\\d{3})(\\d{4})","$1 $2",["[57-9]"]]]],WF:["681","00","(?:40|72|8\\d{4})\\d{4}|[89]\\d{5}",[6,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["[47-9]"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"]]]],WS:["685","0","(?:[2-6]|8\\d{5})\\d{4}|[78]\\d{6}|[68]\\d{5}",[5,6,7,10],[["(\\d{5})","$1",["[2-5]|6[1-9]"]],["(\\d{3})(\\d{3,7})","$1 $2",["[68]"]],["(\\d{2})(\\d{5})","$1 $2",["7"]]]],XK:["383","00","2\\d{7,8}|3\\d{7,11}|(?:4\\d\\d|[89]00)\\d{5}",[8,9,10,11,12],[["(\\d{3})(\\d{5})","$1 $2",["[89]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[2-4]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["2|39"],"0$1"],["(\\d{2})(\\d{7,10})","$1 $2",["3"],"0$1"]],"0"],YE:["967","00","(?:1|7\\d)\\d{7}|[1-7]\\d{6}",[7,8,9],[["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-6]|7(?:[24-6]|8[0-7])"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["7"],"0$1"]],"0"],YT:["262","00","7093\\d{5}|(?:80|9\\d)\\d{7}|(?:26|63)9\\d{6}",[9],0,"0",0,0,0,0,0,[["269(?:0[0-467]|15|5[0-4]|6\\d|[78]0)\\d{4}"],["(?:639(?:0[0-79]|1[019]|[267]\\d|3[09]|40|5[05-9]|9[04-79])|7093[5-7])\\d{4}"],["80\\d{7}"],0,0,0,0,0,["9(?:(?:39|47)8[01]|769\\d)\\d{4}"]]],ZA:["27","00","[1-79]\\d{8}|8\\d{4,9}",[5,6,7,8,9,10],[["(\\d{2})(\\d{3,4})","$1 $2",["8[1-4]"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,3})","$1 $2 $3",["8[1-4]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["860"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[1-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"],"0$1"]],"0"],ZM:["260","00","800\\d{6}|(?:21|[579]\\d|63)\\d{7}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[28]"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["[579]"],"0$1"]],"0"],ZW:["263","00","2(?:[0-57-9]\\d{6,8}|6[0-24-9]\\d{6,7})|[38]\\d{9}|[35-8]\\d{8}|[3-6]\\d{7}|[1-689]\\d{6}|[1-3569]\\d{5}|[1356]\\d{4}",[5,6,7,8,9,10],[["(\\d{3})(\\d{3,5})","$1 $2",["2(?:0[45]|2[278]|[49]8)|3(?:[09]8|17)|6(?:[29]8|37|75)|[23][78]|(?:33|5[15]|6[68])[78]"],"0$1"],["(\\d)(\\d{3})(\\d{2,4})","$1 $2 $3",["[49]"],"0$1"],["(\\d{3})(\\d{4})","$1 $2",["80"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["24|8[13-59]|(?:2[05-79]|39|5[45]|6[15-8])2","2(?:02[014]|4|[56]20|[79]2)|392|5(?:42|525)|6(?:[16-8]21|52[013])|8[13-59]"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["2(?:1[39]|2[0157]|[378]|[56][14])|3(?:12|29)","2(?:1[39]|2[0157]|[378]|[56][14])|3(?:123|29)"],"0$1"],["(\\d{4})(\\d{6})","$1 $2",["8"],"0$1"],["(\\d{2})(\\d{3,5})","$1 $2",["1|2(?:0[0-36-9]|12|29|[56])|3(?:1[0-689]|[24-6])|5(?:[0236-9]|1[2-4])|6(?:[013-59]|7[0-46-9])|(?:33|55|6[68])[0-69]|(?:29|3[09]|62)[0-79]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["29[013-9]|39|54"],"0$1"],["(\\d{4})(\\d{3,5})","$1 $2",["(?:25|54)8","258|5483"],"0$1"]],"0"]},nonGeographic:{800:["800",0,"(?:00|[1-9]\\d)\\d{6}",[8],[["(\\d{4})(\\d{4})","$1 $2",["\\d"]]],0,0,0,0,0,0,[0,0,["(?:00|[1-9]\\d)\\d{6}"]]],808:["808",0,"[1-9]\\d{7}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[1-9]"]]],0,0,0,0,0,0,[0,0,0,0,0,0,0,0,0,["[1-9]\\d{7}"]]],870:["870",0,"7\\d{11}|[235-7]\\d{8}",[9,12],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[235-7]"]]],0,0,0,0,0,0,[0,["(?:[356]|774[45])\\d{8}|7[6-8]\\d{7}"],0,0,0,0,0,0,["2\\d{8}",[9]]]],878:["878",0,"10\\d{10}",[12],[["(\\d{2})(\\d{5})(\\d{5})","$1 $2 $3",["1"]]],0,0,0,0,0,0,[0,0,0,0,0,0,0,0,["10\\d{10}"]]],881:["881",0,"6\\d{9}|[0-36-9]\\d{8}",[9,10],[["(\\d)(\\d{3})(\\d{5})","$1 $2 $3",["[0-37-9]"]],["(\\d)(\\d{3})(\\d{5,6})","$1 $2 $3",["6"]]],0,0,0,0,0,0,[0,["6\\d{9}|[0-36-9]\\d{8}"]]],882:["882",0,"[13]\\d{6}(?:\\d{2,5})?|[19]\\d{7}|(?:[25]\\d\\d|4)\\d{7}(?:\\d{2})?",[7,8,9,10,11,12],[["(\\d{2})(\\d{5})","$1 $2",["16|342"]],["(\\d{2})(\\d{6})","$1 $2",["49"]],["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["1[36]|9"]],["(\\d{2})(\\d{4})(\\d{3})","$1 $2 $3",["3[23]"]],["(\\d{2})(\\d{3,4})(\\d{4})","$1 $2 $3",["16"]],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["10|23|3(?:[15]|4[57])|4|51"]],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["34"]],["(\\d{2})(\\d{4,5})(\\d{5})","$1 $2 $3",["[1-35]"]]],0,0,0,0,0,0,[0,["342\\d{4}|(?:337|49)\\d{6}|(?:3(?:2|47|7\\d{3})|50\\d{3})\\d{7}",[7,8,9,10,12]],0,0,0,["348[57]\\d{7}",[11]],0,0,["1(?:3(?:0[0347]|[13][0139]|2[035]|4[013568]|6[0459]|7[06]|8[15-8]|9[0689])\\d{4}|6\\d{5,10})|(?:345\\d|9[89])\\d{6}|(?:10|2(?:3|85\\d)|3(?:[15]|[69]\\d\\d)|4[15-8]|51)\\d{8}"]]],883:["883",0,"(?:[1-4]\\d|51)\\d{6,10}",[8,9,10,11,12],[["(\\d{3})(\\d{3})(\\d{2,8})","$1 $2 $3",["[14]|2[24-689]|3[02-689]|51[24-9]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["510"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["21"]],["(\\d{4})(\\d{4})(\\d{4})","$1 $2 $3",["51[13]"]],["(\\d{3})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["[235]"]]],0,0,0,0,0,0,[0,0,0,0,0,0,0,0,["(?:2(?:00\\d\\d|10)|(?:370[1-9]|51\\d0)\\d)\\d{7}|51(?:00\\d{5}|[24-9]0\\d{4,7})|(?:1[0-79]|2[24-689]|3[02-689]|4[0-4])0\\d{5,9}"]]],888:["888",0,"\\d{11}",[11],[["(\\d{3})(\\d{3})(\\d{5})","$1 $2 $3"]],0,0,0,0,0,0,[0,0,0,0,0,0,["\\d{11}"]]],979:["979",0,"[1359]\\d{8}",[9],[["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["[1359]"]]],0,0,0,0,0,0,[0,0,0,["[1359]\\d{8}"]]]}};function r5(t,e){var n=Array.prototype.slice.call(e);return n.push(n5),t.apply(this,n)}function lg(t,e){t=t.split("-"),e=e.split("-");for(var n=t[0].split("."),r=e[0].split("."),i=0;i<3;i++){var o=Number(n[i]),a=Number(r[i]);if(o>a)return 1;if(a>o)return-1;if(!isNaN(o)&&isNaN(a))return 1;if(isNaN(o)&&!isNaN(a))return-1}return t[1]&&e[1]?t[1]>e[1]?1:t[1]<e[1]?-1:0:!t[1]&&e[1]?1:t[1]&&!e[1]?-1:0}var i5={}.constructor;function Ti(t){return t!=null&&t.constructor===i5}function Wd(t){"@babel/helpers - typeof";return Wd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Wd(t)}function Nl(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o5(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function Cl(t,e,n){return e&&o5(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}var s5="1.2.0",a5="1.7.35",ug=" ext. ",c5=/^\d+$/,vt=function(){function t(e){Nl(this,t),q1(e),this.metadata=e,V1.call(this,e)}return Cl(t,[{key:"getCountries",value:function(){return Object.keys(this.metadata.countries).filter(function(n){return n!=="001"})}},{key:"getCountryMetadata",value:function(n){return this.metadata.countries[n]}},{key:"nonGeographic",value:function(){if(!(this.v1||this.v2||this.v3))return this.metadata.nonGeographic||this.metadata.nonGeographical}},{key:"hasCountry",value:function(n){return this.getCountryMetadata(n)!==void 0}},{key:"hasCallingCode",value:function(n){if(this.getCountryCodesForCallingCode(n))return!0;if(this.nonGeographic()){if(this.nonGeographic()[n])return!0}else{var r=this.countryCallingCodes()[n];if(r&&r.length===1&&r[0]==="001")return!0}}},{key:"isNonGeographicCallingCode",value:function(n){return this.nonGeographic()?!!this.nonGeographic()[n]:!this.getCountryCodesForCallingCode(n)}},{key:"country",value:function(n){return this.selectNumberingPlan(n)}},{key:"selectNumberingPlan",value:function(n,r){if(n&&c5.test(n)&&(r=n,n=null),n&&n!=="001"){if(!this.hasCountry(n))throw new Error("Unknown country: ".concat(n));this.numberingPlan=new dg(this.getCountryMetadata(n),this)}else if(r){if(!this.hasCallingCode(r))throw new Error("Unknown calling code: ".concat(r));this.numberingPlan=new dg(this.getNumberingPlanMetadata(r),this)}else this.numberingPlan=void 0;return this}},{key:"getCountryCodesForCallingCode",value:function(n){var r=this.countryCallingCodes()[n];if(r)return r.length===1&&r[0].length===3?void 0:r}},{key:"getCountryCodeForCallingCode",value:function(n){var r=this.getCountryCodesForCallingCode(n);if(r)return r[0]}},{key:"getNumberingPlanMetadata",value:function(n){var r=this.getCountryCodeForCallingCode(n);if(r)return this.getCountryMetadata(r);if(this.nonGeographic()){var i=this.nonGeographic()[n];if(i)return i}else{var o=this.countryCallingCodes()[n];if(o&&o.length===1&&o[0]==="001")return this.metadata.countries["001"]}}},{key:"countryCallingCode",value:function(){return this.numberingPlan.callingCode()}},{key:"IDDPrefix",value:function(){return this.numberingPlan.IDDPrefix()}},{key:"defaultIDDPrefix",value:function(){return this.numberingPlan.defaultIDDPrefix()}},{key:"nationalNumberPattern",value:function(){return this.numberingPlan.nationalNumberPattern()}},{key:"possibleLengths",value:function(){return this.numberingPlan.possibleLengths()}},{key:"formats",value:function(){return this.numberingPlan.formats()}},{key:"nationalPrefixForParsing",value:function(){return this.numberingPlan.nationalPrefixForParsing()}},{key:"nationalPrefixTransformRule",value:function(){return this.numberingPlan.nationalPrefixTransformRule()}},{key:"leadingDigits",value:function(){return this.numberingPlan.leadingDigits()}},{key:"hasTypes",value:function(){return this.numberingPlan.hasTypes()}},{key:"type",value:function(n){return this.numberingPlan.type(n)}},{key:"ext",value:function(){return this.numberingPlan.ext()}},{key:"countryCallingCodes",value:function(){return this.v1?this.metadata.country_phone_code_to_countries:this.metadata.country_calling_codes}},{key:"chooseCountryByCountryCallingCode",value:function(n){return this.selectNumberingPlan(n)}},{key:"hasSelectedNumberingPlan",value:function(){return this.numberingPlan!==void 0}}]),t}(),dg=function(){function t(e,n){Nl(this,t),this.globalMetadataObject=n,this.metadata=e,V1.call(this,n.metadata)}return Cl(t,[{key:"callingCode",value:function(){return this.metadata[0]}},{key:"getDefaultCountryMetadataForRegion",value:function(){return this.globalMetadataObject.getNumberingPlanMetadata(this.callingCode())}},{key:"IDDPrefix",value:function(){if(!(this.v1||this.v2))return this.metadata[1]}},{key:"defaultIDDPrefix",value:function(){if(!(this.v1||this.v2))return this.metadata[12]}},{key:"nationalNumberPattern",value:function(){return this.v1||this.v2?this.metadata[1]:this.metadata[2]}},{key:"possibleLengths",value:function(){if(!this.v1)return this.metadata[this.v2?2:3]}},{key:"_getFormats",value:function(n){return n[this.v1?2:this.v2?3:4]}},{key:"formats",value:function(){var n=this,r=this._getFormats(this.metadata)||this._getFormats(this.getDefaultCountryMetadataForRegion())||[];return r.map(function(i){return new l5(i,n)})}},{key:"nationalPrefix",value:function(){return this.metadata[this.v1?3:this.v2?4:5]}},{key:"_getNationalPrefixFormattingRule",value:function(n){return n[this.v1?4:this.v2?5:6]}},{key:"nationalPrefixFormattingRule",value:function(){return this._getNationalPrefixFormattingRule(this.metadata)||this._getNationalPrefixFormattingRule(this.getDefaultCountryMetadataForRegion())}},{key:"_nationalPrefixForParsing",value:function(){return this.metadata[this.v1?5:this.v2?6:7]}},{key:"nationalPrefixForParsing",value:function(){return this._nationalPrefixForParsing()||this.nationalPrefix()}},{key:"nationalPrefixTransformRule",value:function(){return this.metadata[this.v1?6:this.v2?7:8]}},{key:"_getNationalPrefixIsOptionalWhenFormatting",value:function(){return!!this.metadata[this.v1?7:this.v2?8:9]}},{key:"nationalPrefixIsOptionalWhenFormattingInNationalFormat",value:function(){return this._getNationalPrefixIsOptionalWhenFormatting(this.metadata)||this._getNationalPrefixIsOptionalWhenFormatting(this.getDefaultCountryMetadataForRegion())}},{key:"leadingDigits",value:function(){return this.metadata[this.v1?8:this.v2?9:10]}},{key:"types",value:function(){return this.metadata[this.v1?9:this.v2?10:11]}},{key:"hasTypes",value:function(){return this.types()&&this.types().length===0?!1:!!this.types()}},{key:"type",value:function(n){if(this.hasTypes()&&pg(this.types(),n))return new d5(pg(this.types(),n),this)}},{key:"ext",value:function(){return this.v1||this.v2?ug:this.metadata[13]||ug}}]),t}(),l5=function(){function t(e,n){Nl(this,t),this._format=e,this.metadata=n}return Cl(t,[{key:"pattern",value:function(){return this._format[0]}},{key:"format",value:function(){return this._format[1]}},{key:"leadingDigitsPatterns",value:function(){return this._format[2]||[]}},{key:"nationalPrefixFormattingRule",value:function(){return this._format[3]||this.metadata.nationalPrefixFormattingRule()}},{key:"nationalPrefixIsOptionalWhenFormattingInNationalFormat",value:function(){return!!this._format[4]||this.metadata.nationalPrefixIsOptionalWhenFormattingInNationalFormat()}},{key:"nationalPrefixIsMandatoryWhenFormattingInNationalFormat",value:function(){return this.usesNationalPrefix()&&!this.nationalPrefixIsOptionalWhenFormattingInNationalFormat()}},{key:"usesNationalPrefix",value:function(){return!!(this.nationalPrefixFormattingRule()&&!u5.test(this.nationalPrefixFormattingRule()))}},{key:"internationalFormat",value:function(){return this._format[5]||this.format()}}]),t}(),u5=/^\(?\$1\)?$/,d5=function(){function t(e,n){Nl(this,t),this.type=e,this.metadata=n}return Cl(t,[{key:"pattern",value:function(){return this.metadata.v1?this.type:this.type[0]}},{key:"possibleLengths",value:function(){if(!this.metadata.v1)return this.type[1]||this.metadata.possibleLengths()}}]),t}();function pg(t,e){switch(e){case"FIXED_LINE":return t[0];case"MOBILE":return t[1];case"TOLL_FREE":return t[2];case"PREMIUM_RATE":return t[3];case"PERSONAL_NUMBER":return t[4];case"VOICEMAIL":return t[5];case"UAN":return t[6];case"PAGER":return t[7];case"VOIP":return t[8];case"SHARED_COST":return t[9]}}function q1(t){if(!t)throw new Error("[libphonenumber-js] `metadata` argument not passed. Check your arguments.");if(!Ti(t)||!Ti(t.countries))throw new Error("[libphonenumber-js] `metadata` argument was passed but it's not a valid metadata. Must be an object having `.countries` child object property. Got ".concat(Ti(t)?"an object of shape: { "+Object.keys(t).join(", ")+" }":"a "+p5(t)+": "+t,"."))}var p5=function(e){return Wd(e)};function wf(t,e){if(e=new vt(e),e.hasCountry(t))return e.country(t).countryCallingCode();throw new Error("Unknown country: ".concat(t))}function f5(t,e){return e.countries.hasOwnProperty(t)}function V1(t){var e=t.version;typeof e=="number"?(this.v1=e===1,this.v2=e===2,this.v3=e===3,this.v4=e===4):e?lg(e,s5)===-1?this.v2=!0:lg(e,a5)===-1?this.v3=!0:this.v4=!0:this.v1=!0}function vf(t,e){return h5(t,void 0,e)}function h5(t,e,n){var r=n.type(e),i=r&&r.possibleLengths()||n.possibleLengths();if(!i)return"IS_POSSIBLE";var o=t.length,a=i[0];return a===o?"IS_POSSIBLE":a>o?"TOO_SHORT":i[i.length-1]<o?"TOO_LONG":i.indexOf(o,1)>=0?"IS_POSSIBLE":"INVALID_LENGTH"}function g5(t,e,n){if(e===void 0&&(e={}),n=new vt(n),e.v2){if(!t.countryCallingCode)throw new Error("Invalid phone number object passed");n.selectNumberingPlan(t.countryCallingCode)}else{if(!t.phone)return!1;if(t.country){if(!n.hasCountry(t.country))throw new Error("Unknown country: ".concat(t.country));n.country(t.country)}else{if(!t.countryCallingCode)throw new Error("Invalid phone number object passed");n.selectNumberingPlan(t.countryCallingCode)}}if(n.possibleLengths())return H1(t.phone||t.nationalNumber,n);if(t.countryCallingCode&&n.isNonGeographicCallingCode(t.countryCallingCode))return!0;throw new Error('Missing "possibleLengths" in metadata. Perhaps the metadata has been generated before v1.0.18.')}function H1(t,e){switch(vf(t,e)){case"IS_POSSIBLE":return!0;default:return!1}}function Xn(t,e){return t=t||"",new RegExp("^(?:"+e+")$").test(t)}function m5(t,e){var n=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n)return(n=n.call(t)).next.bind(n);if(Array.isArray(t)||(n=_5(t))||e){n&&(t=n);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
192
+ `,r}async function d$(t){const e=await t.publicKey.export(),n=await crypto.subtle.exportKey("jwk",e),r=JSON.stringify(n,Object.keys(n).sort()),o=new TextEncoder().encode(r);return $u(await h_(o))}const p$=1e3*60*60*24,f$=new s.OpenAPIHono().openapi(s.createRoute({tags:["keys"],method:"get",path:"/signing",request:{headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:s.z.array(bu)}},description:"List of keys"}}}),async t=>{const{signingKeys:e}=await t.env.data.keys.list({q:"type:jwt_signing"}),n=e.filter(r=>"cert"in r).map(r=>r);return t.json(n)}).openapi(s.createRoute({tags:["keys"],method:"get",path:"/signing/{kid}",request:{headers:s.z.object({"tenant-id":s.z.string()}),params:s.z.object({kid:s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:bu}},description:"The requested key"}}}),async t=>{const{kid:e}=t.req.valid("param"),{signingKeys:n}=await t.env.data.keys.list({q:"type:jwt_signing"}),r=n.find(i=>i.kid===e);if(!r)throw new C(404,{message:"Key not found"});return t.json(r)}).openapi(s.createRoute({tags:["keys"],method:"post",path:"/signing/rotate",request:{headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{description:"Status"}}}),async t=>{const{signingKeys:e}=await t.env.data.keys.list({q:"type:jwt_signing"});for await(const r of e)await t.env.data.keys.update(r.kid,{revoked_at:new Date(Date.now()+p$).toISOString()});const n=await Vd({name:`CN=${t.env.ORGANIZATION_NAME}`});return await t.env.data.keys.create({...n,type:"jwt_signing"}),t.text("OK",{status:201})}).openapi(s.createRoute({tags:["keys"],method:"put",path:"/signing/{kid}/revoke",request:{headers:s.z.object({"tenant-id":s.z.string()}),params:s.z.object({kid:s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{description:"Status"}}}),async t=>{const{kid:e}=t.req.valid("param");if(!await t.env.data.keys.update(e,{revoked_at:new Date().toISOString()}))throw new C(404,{message:"Key not found"});const r=await Vd({name:`CN=${t.env.ORGANIZATION_NAME}`});return await t.env.data.keys.create({...r,type:"jwt_signing"}),t.text("OK")}),h$=new s.OpenAPIHono().openapi(s.createRoute({tags:["users"],method:"get",path:"/",request:{query:s.z.object({email:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"tenant/json":{schema:s.z.array(up)}},description:"List of users"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{email:n}=t.req.valid("query"),i=(await Ap(t.env.data.users,e,n)).filter(o=>!o.linked_to);return t.json(i)}),g$=mn.extend({clients:s.z.array(Dr)}),m$=new s.OpenAPIHono().openapi(s.createRoute({tags:["clients"],method:"get",path:"/",request:{query:Lt,headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:s.z.union([g$,s.z.array(Dr)])}},description:"List of clients"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{page:n,per_page:r,include_totals:i,sort:o,q:a}=t.req.valid("query"),u=(await t.env.data.applications.list(e,{page:n,per_page:r,include_totals:i,sort:pn(o),q:a})).applications;return i?t.json({clients:u,start:0,limit:10,length:u.length}):t.json(u)}).openapi(s.createRoute({tags:["clients"],method:"get",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:Dr}},description:"An application"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param"),i=(await t.env.data.applications.list(e,{page:1,per_page:0,include_totals:!1})).applications.find(o=>o.id===n);if(!i)throw new C(404);return t.json(i)}).openapi(s.createRoute({tags:["clients"],method:"delete",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param");if(!await t.env.data.applications.remove(e,n))throw new C(404,{message:"Application not found"});return t.text("OK")}).openapi(s.createRoute({tags:["clients"],method:"patch",path:"/{id}",request:{body:{content:{"application/json":{schema:s.z.object(va.shape).partial()}}},params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:Dr}},description:"The update application"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param"),i=t.req.valid("json");await t.env.data.applications.update(e,n,i);const o=await t.env.data.applications.get(e,n);if(!o)throw new C(404,{message:"Application not found"});return t.json(o)}).openapi(s.createRoute({tags:["clients"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:s.z.object(va.shape)}}},headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:s.z.object(Dr.shape)}},description:"An application"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json"),r={...n,id:n.id||Ve(),client_secret:n.client_secret||Ve()},i=await t.env.data.applications.create(e,r);return t.json(i,{status:201})});s.z.object({start:s.z.number(),limit:s.z.number(),length:s.z.number()});vc.extend({email:s.z.string(),login_count:s.z.number(),multifactor:s.z.array(s.z.string()).optional(),last_ip:s.z.string().optional(),last_login:s.z.string().optional(),user_id:s.z.string()}).catchall(s.z.any());const _$=mn.extend({tenants:s.z.array(Si)}),y$=new s.OpenAPIHono().openapi(s.createRoute({tags:["tenants"],method:"get",path:"/",request:{query:Lt},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"tenant/json":{schema:s.z.union([s.z.array(Si),_$])}},description:"List of tenants"}}}),async t=>{const{page:e,per_page:n,include_totals:r,sort:i,q:o}=t.req.valid("query"),a=await t.env.data.tenants.list({page:e,per_page:n,include_totals:r,sort:pn(i),q:o});return r?t.json(a):t.json(a.tenants)}).openapi(s.createRoute({tags:["tenants"],method:"get",path:"/{id}",request:{params:s.z.object({id:s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"tenant/json":{schema:Si}},description:"A tenant"}}}),async t=>{const{id:e}=t.req.valid("param"),n=await t.env.data.tenants.get(e);if(!n)throw new C(404);return t.json(n)}).openapi(s.createRoute({tags:["tenants"],method:"delete",path:"/{id}",request:{params:s.z.object({id:s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async t=>{const{id:e}=t.req.valid("param");return await t.env.data.tenants.remove(e),t.text("OK")}).openapi(s.createRoute({tags:["tenants"],method:"patch",path:"/{id}",request:{body:{content:{"application/json":{schema:s.z.object($a.shape).partial()}}},params:s.z.object({id:s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async t=>{const{id:e}=t.req.valid("param"),n=t.req.valid("json");return await t.env.data.tenants.update(e,n),t.text("OK")}).openapi(s.createRoute({tags:["tenants"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:s.z.object($a.shape)}}}},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"tenant/json":{schema:Si}},description:"An tenant"}}}),async t=>{const e=t.req.valid("json"),n=await t.env.data.tenants.create(e);return t.json(n,{status:201})}),w$=mn.extend({logs:s.z.array(Aa)}),v$=new s.OpenAPIHono().openapi(s.createRoute({tags:["logs"],method:"get",path:"/",request:{query:Lt,headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:s.z.union([s.z.array(Aa),w$])}},description:"List of log rows"}}}),async t=>{const{page:e,per_page:n,include_totals:r,sort:i,q:o}=t.req.valid("query"),{"tenant-id":a}=t.req.valid("header"),l=await t.env.data.logs.list(a,{page:e,per_page:n,include_totals:r,sort:pn(i),q:o});return r?t.json(l):t.json(l.logs)}).openapi(s.createRoute({tags:["logs"],method:"get",path:"/{id}",request:{headers:s.z.object({"tenant-id":s.z.string()}),params:s.z.object({id:s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:Aa}},description:"A log entry"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param"),r=await t.env.data.logs.get(e,n);if(!r)throw new C(404);return t.json(r)}),b$=mn.extend({hooks:s.z.array(bi)}),$$=new s.OpenAPIHono().openapi(s.createRoute({tags:["hooks"],method:"get",path:"/",request:{query:Lt,headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:s.z.union([s.z.array(bi),b$])}},description:"List of hooks"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{page:n,per_page:r,include_totals:i,sort:o,q:a}=t.req.valid("query"),l=await t.env.data.hooks.list(e,{page:n,per_page:r,include_totals:i,sort:pn(o),q:a});return i?t.json(l):t.json(l.hooks)}).openapi(s.createRoute({tags:["hooks"],method:"post",path:"/",request:{headers:s.z.object({"tenant-id":s.z.string()}),body:{content:{"application/json":{schema:Js}}}},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:bi}},description:"The created hook"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json"),r=await t.env.data.hooks.create(e,n);return t.json(r,{status:201})}).openapi(s.createRoute({tags:["hooks"],method:"patch",path:"/{hook_id}",request:{headers:s.z.object({"tenant-id":s.z.string()}),params:s.z.object({hook_id:s.z.string()}),body:{content:{"application/json":{schema:s.z.union([Js.options[0].omit({hook_id:!0}).partial(),Js.options[1].omit({hook_id:!0}).partial()])}}}},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:bi}},description:"The updated hook"},404:{description:"Hook not found"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{hook_id:n}=t.req.valid("param"),r=t.req.valid("json");await t.env.data.hooks.update(e,n,r);const i=await t.env.data.hooks.get(e,n);if(!i)throw new C(404,{message:"Hook not found"});return t.json(i)}).openapi(s.createRoute({tags:["hooks"],method:"get",path:"/{hook_id}",request:{headers:s.z.object({"tenant-id":s.z.string()}),params:s.z.object({hook_id:s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:bi}},description:"A hook"},404:{description:"Hook not found"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{hook_id:n}=t.req.valid("param"),r=await t.env.data.hooks.get(e,n);if(!r)throw new C(404,{message:"Hook not found"});return t.json(r)}).openapi(s.createRoute({tags:["hooks"],method:"delete",path:"/{hook_id}",request:{headers:s.z.object({"tenant-id":s.z.string()}),params:s.z.object({hook_id:s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{description:"A hook"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{hook_id:n}=t.req.valid("param");if(!await t.env.data.hooks.remove(e,n))throw new C(404,{message:"Hook not found"});return t.text("OK")}),x$=mn.extend({connections:s.z.array(on)}),A$=new s.OpenAPIHono().openapi(s.createRoute({tags:["connections"],method:"get",path:"/",request:{query:Lt,headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:s.z.union([s.z.array(on),x$])}},description:"List of connectionss"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{page:n,per_page:r,include_totals:i=!1,sort:o,q:a}=t.req.valid("query"),l=await t.env.data.connections.list(e,{page:n,per_page:r,include_totals:i,sort:pn(o),q:a});return i?t.json(l):t.json(l.connections)}).openapi(s.createRoute({tags:["connections"],method:"get",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:on}},description:"A connection"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param"),r=await t.env.data.connections.get(e,n);if(!r)throw new C(404);return t.json(r)}).openapi(s.createRoute({tags:["connections"],method:"delete",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param");if(!await t.env.data.connections.remove(e,n))throw new C(404,{message:"Connection not found"});return t.text("OK")}).openapi(s.createRoute({tags:["connections"],method:"patch",path:"/{id}",request:{body:{content:{"application/json":{schema:s.z.object(ba.shape).partial()}}},params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:on}},description:"The updated connection"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param"),r=t.req.valid("json");if(!await t.env.data.connections.update(e,n,r))throw new C(404,{message:"Connection not found"});const o=await t.env.data.connections.get(e,n);if(!o)throw new C(404,{message:"Connection not found"});return t.json(o)}).openapi(s.createRoute({tags:["connections"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:s.z.object(ba.shape)}}},headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:on}},description:"A connection"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json"),r=await t.env.data.connections.create(e,n);return t.json(r,{status:201})}),E$=new s.OpenAPIHono().openapi(s.createRoute({tags:["prompts"],method:"get",path:"/",request:{headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:Zs}},description:"Branding settings"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=await t.env.data.promptSettings.get(e);return n?t.json(n):t.json(Zs.parse({}))}).openapi(s.createRoute({tags:["prompts"],method:"patch",path:"/",request:{headers:s.z.object({"tenant-id":s.z.string()}),body:{content:{"application/json":{schema:s.z.object(Zs.shape).partial()}}}},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Prompts settings"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json"),r=await t.env.data.promptSettings.get(e);return Object.assign(r,n),await t.env.data.promptSettings.set(e,r),t.json(r)});let X0=!1;function gf(t){t.use(async(e,n)=>(X0||(t.openAPIRegistry.registerComponent("securitySchemes","Bearer",{type:"oauth2",scheme:"bearer",flows:{implicit:{authorizationUrl:`${e.env.AUTH_URL}/authorize`,scopes:{openid:"Basic user information",email:"User email",profile:"User profile information"}}}}),X0=!0),await n()))}var v1=t=>$1(t.replace(/_|-/g,e=>({_:"/","-":"+"})[e]??e)),b1=t=>S$(t).replace(/\/|\+/g,e=>({"/":"_","+":"-"})[e]??e),S$=t=>{let e="";const n=new Uint8Array(t);for(let r=0,i=n.length;r<i;r++)e+=String.fromCharCode(n[r]);return btoa(e)},$1=t=>{const e=atob(t),n=new Uint8Array(new ArrayBuffer(e.length)),r=e.length/2;for(let i=0,o=e.length-1;i<=r;i++,o--)n[i]=e.charCodeAt(i),n[o]=e.charCodeAt(o);return n},x1=(t=>(t.HS256="HS256",t.HS384="HS384",t.HS512="HS512",t.RS256="RS256",t.RS384="RS384",t.RS512="RS512",t.PS256="PS256",t.PS384="PS384",t.PS512="PS512",t.ES256="ES256",t.ES384="ES384",t.ES512="ES512",t.EdDSA="EdDSA",t))(x1||{}),k$=class extends Error{constructor(t){super(`${t} is not an implemented algorithm`),this.name="JwtAlgorithmNotImplemented"}},bl=class extends Error{constructor(t){super(`invalid JWT token: ${t}`),this.name="JwtTokenInvalid"}},N$=class extends Error{constructor(t){super(`token (${t}) is being used before it's valid`),this.name="JwtTokenNotBefore"}},C$=class extends Error{constructor(t){super(`token (${t}) expired`),this.name="JwtTokenExpired"}},T$=class extends Error{constructor(t,e){super(`Invalid "iat" claim, must be a valid number lower than "${t}" (iat: "${e}")`),this.name="JwtTokenIssuedAt"}},Zl=class extends Error{constructor(t,e){super(`expected issuer "${t}", got ${e?`"${e}"`:"none"} `),this.name="JwtTokenIssuer"}},A1=class extends Error{constructor(t){super(`jwt header is invalid: ${JSON.stringify(t)}`),this.name="JwtHeaderInvalid"}},I$=class extends Error{constructor(t){super(`required "kid" in jwt header: ${JSON.stringify(t)}`),this.name="JwtHeaderRequiresKid"}},O$=class extends Error{constructor(t){super(`token(${t}) signature mismatched`),this.name="JwtTokenSignatureMismatched"}},Vo=(t=>(t.Encrypt="encrypt",t.Decrypt="decrypt",t.Sign="sign",t.Verify="verify",t.DeriveKey="deriveKey",t.DeriveBits="deriveBits",t.WrapKey="wrapKey",t.UnwrapKey="unwrapKey",t))(Vo||{}),bs=new TextEncoder,z$=new TextDecoder;async function D$(t,e,n){const r=E1(e),i=await P$(t,r);return await crypto.subtle.sign(r,i,n)}async function R$(t,e,n,r){const i=E1(e),o=await B$(t,i);return await crypto.subtle.verify(i,o,n,r)}function Hd(t){return $1(t.replace(/-+(BEGIN|END).*/g,"").replace(/\s/g,""))}async function P$(t,e){if(!crypto.subtle||!crypto.subtle.importKey)throw new Error("`crypto.subtle.importKey` is undefined. JWT auth middleware requires it.");if(S1(t)){if(t.type!=="private"&&t.type!=="secret")throw new Error(`unexpected key type: CryptoKey.type is ${t.type}, expected private or secret`);return t}const n=[Vo.Sign];return typeof t=="object"?await crypto.subtle.importKey("jwk",t,e,!1,n):t.includes("PRIVATE")?await crypto.subtle.importKey("pkcs8",Hd(t),e,!1,n):await crypto.subtle.importKey("raw",bs.encode(t),e,!1,n)}async function B$(t,e){if(!crypto.subtle||!crypto.subtle.importKey)throw new Error("`crypto.subtle.importKey` is undefined. JWT auth middleware requires it.");if(S1(t)){if(t.type==="public"||t.type==="secret")return t;t=await J0(t)}if(typeof t=="string"&&t.includes("PRIVATE")){const r=await crypto.subtle.importKey("pkcs8",Hd(t),e,!0,[Vo.Sign]);t=await J0(r)}const n=[Vo.Verify];return typeof t=="object"?await crypto.subtle.importKey("jwk",t,e,!1,n):t.includes("PUBLIC")?await crypto.subtle.importKey("spki",Hd(t),e,!1,n):await crypto.subtle.importKey("raw",bs.encode(t),e,!1,n)}async function J0(t){if(t.type!=="private")throw new Error(`unexpected key type: ${t.type}`);if(!t.extractable)throw new Error("unexpected private key is unextractable");const e=await crypto.subtle.exportKey("jwk",t),{kty:n}=e,{alg:r,e:i,n:o}=e,{crv:a,x:l,y:u}=e;return{kty:n,alg:r,e:i,n:o,crv:a,x:l,y:u,key_ops:[Vo.Verify]}}function E1(t){switch(t){case"HS256":return{name:"HMAC",hash:{name:"SHA-256"}};case"HS384":return{name:"HMAC",hash:{name:"SHA-384"}};case"HS512":return{name:"HMAC",hash:{name:"SHA-512"}};case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"RS384":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-384"}};case"RS512":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-512"}};case"PS256":return{name:"RSA-PSS",hash:{name:"SHA-256"},saltLength:32};case"PS384":return{name:"RSA-PSS",hash:{name:"SHA-384"},saltLength:48};case"PS512":return{name:"RSA-PSS",hash:{name:"SHA-512"},saltLength:64};case"ES256":return{name:"ECDSA",hash:{name:"SHA-256"},namedCurve:"P-256"};case"ES384":return{name:"ECDSA",hash:{name:"SHA-384"},namedCurve:"P-384"};case"ES512":return{name:"ECDSA",hash:{name:"SHA-512"},namedCurve:"P-521"};case"EdDSA":return{name:"Ed25519",namedCurve:"Ed25519"};default:throw new k$(t)}}function S1(t){return k_()==="node"&&crypto.webcrypto?t instanceof crypto.webcrypto.CryptoKey:t instanceof CryptoKey}var Ql=t=>b1(bs.encode(JSON.stringify(t)).buffer).replace(/=/g,""),j$=t=>b1(t).replace(/=/g,""),Kd=t=>JSON.parse(z$.decode(v1(t)));function k1(t){if(typeof t=="object"&&t!==null){const e=t;return"alg"in e&&Object.values(x1).includes(e.alg)&&(!("typ"in e)||e.typ==="JWT")}return!1}var L$=async(t,e,n="HS256")=>{const r=Ql(t);let i;typeof e=="object"&&"alg"in e?(n=e.alg,i=Ql({alg:n,typ:"JWT",kid:e.kid})):i=Ql({alg:n,typ:"JWT"});const o=`${i}.${r}`,a=await D$(e,n,bs.encode(o)),l=j$(a);return`${o}.${l}`},N1=async(t,e,n)=>{const r=typeof n=="string"?{alg:n}:n||{},i={alg:r.alg??"HS256",iss:r.iss,nbf:r.nbf??!0,exp:r.exp??!0,iat:r.iat??!0},o=t.split(".");if(o.length!==3)throw new bl(t);const{header:a,payload:l}=C1(t);if(!k1(a))throw new A1(a);const u=Date.now()/1e3|0;if(i.nbf&&l.nbf&&l.nbf>u)throw new N$(t);if(i.exp&&l.exp&&l.exp<=u)throw new C$(t);if(i.iat&&l.iat&&u<l.iat)throw new T$(u,l.iat);if(i.iss){if(!l.iss)throw new Zl(i.iss,null);if(typeof i.iss=="string"&&l.iss!==i.iss)throw new Zl(i.iss,l.iss);if(i.iss instanceof RegExp&&!i.iss.test(l.iss))throw new Zl(i.iss,l.iss)}const d=t.substring(0,t.lastIndexOf("."));if(!await R$(e,i.alg,v1(o[2]),bs.encode(d)))throw new O$(t);return l},F$=async(t,e,n)=>{const r=e.verification||{},i=U$(t);if(!k1(i))throw new A1(i);if(!i.kid)throw new I$(i);if(e.jwks_uri){const a=await fetch(e.jwks_uri,n);if(!a.ok)throw new Error(`failed to fetch JWKS from ${e.jwks_uri}`);const l=await a.json();if(!l.keys)throw new Error('invalid JWKS response. "keys" field is missing');if(!Array.isArray(l.keys))throw new Error('invalid JWKS response. "keys" field is not an array');e.keys?e.keys.push(...l.keys):e.keys=l.keys}else if(!e.keys)throw new Error('verifyWithJwks requires options for either "keys" or "jwks_uri" or both');const o=e.keys.find(a=>a.kid===i.kid);if(!o)throw new bl(t);return await N1(t,o,{alg:o.alg||i.alg,...r})},C1=t=>{try{const[e,n]=t.split("."),r=Kd(e),i=Kd(n);return{header:r,payload:i}}catch{throw new bl(t)}},U$=t=>{try{const[e]=t.split(".");return Kd(e)}catch{throw new bl(t)}},T1={sign:L$,verify:N1,decode:C1,verifyWithJwks:F$},M$={Stringify:1,BeforeStream:2,Stream:3},ln=(t,e)=>{const n=new String(t);return n.isEscaped=!0,n.callbacks=e,n},q$=/[&<>'"]/,I1=async(t,e)=>{let n="";e||(e=[]);const r=await Promise.all(t);for(let i=r.length-1;n+=r[i],i--,!(i<0);i--){let o=r[i];typeof o=="object"&&e.push(...o.callbacks||[]);const a=o.isEscaped;if(o=await(typeof o=="object"?o.toString():o),typeof o=="object"&&e.push(...o.callbacks||[]),o.isEscaped??a)n+=o;else{const l=[n];_r(o,l),n=l[0]}}return ln(n,e)},_r=(t,e)=>{const n=t.search(q$);if(n===-1){e[0]+=t;return}let r,i,o=0;for(i=n;i<t.length;i++){switch(t.charCodeAt(i)){case 34:r="&quot;";break;case 39:r="&#39;";break;case 38:r="&amp;";break;case 60:r="&lt;";break;case 62:r="&gt;";break;default:continue}e[0]+=t.substring(o,i)+r,o=i+1}e[0]+=t.substring(o,i)},O1=t=>{const e=t.callbacks;if(!(e!=null&&e.length))return t;const n=[t],r={};return e.forEach(i=>i({phase:M$.Stringify,buffer:n,context:r})),n[0]},V$=T1.verify,H$=T1.decode;async function Gd(t){const{signingKeys:e}=await t.keys.list({q:"type:jwt_signing"});return await Promise.all(e.map(async r=>{const o=await new vl(r.cert).publicKey.export(),a=await crypto.subtle.exportKey("jwk",o);return hp.parse({...a,kid:r.kid})}))}s.z.object({alg:s.z.literal("RS256"),kty:s.z.literal("RSA"),use:s.z.literal("sig"),n:s.z.string(),e:s.z.string(),kid:s.z.string(),x5t:s.z.string(),x5c:s.z.array(s.z.string())});async function K$(t){if(t.JWKS_URL&&t.JWKS_SERVICE){const e=await t.JWKS_SERVICE.fetch(t.JWKS_URL);return e.ok?(await e.json()).keys:(console.warn(`JWKS fetch failed with status ${e.status}, falling back to database`),await Gd(t.data))}return await Gd(t.data)}async function G$(t,e){try{const{header:n}=H$(e),i=(await K$(t.env)).find(l=>l.kid===n.kid);if(!i)throw new C(401,{message:"No matching kid found"});const o=await crypto.subtle.importKey("jwk",i,{name:"RSASSA-PKCS1-v1_5",hash:"SHA-256"},!1,["verify"]);return await V$(e,o,"RS256")}catch(n){throw n instanceof C?n:new C(403,{message:"Invalid JWT signature"})}}function W$(t){return t.replace(/:([a-zA-Z_][a-zA-Z0-9_]*)/g,"{$1}")}function X$(t,e){return e.startsWith(t)?e:t+e}function mf(t){return async(e,n)=>{var l,u,d;const r=e.req.matchedRoutes.find(p=>p.method.toUpperCase()===e.req.method&&p.path!=="/*");if(!r)return await n();const i=W$(r.path),o="basePath"in r&&typeof r.basePath=="string"?r.basePath:"",a=t.openAPIRegistry.definitions.find(p=>"route"in p&&X$(o,p.route.path)===i&&p.route.method.toUpperCase()===e.req.method.toUpperCase());if(a&&"route"in a){const p=(u=(l=a.route.security)==null?void 0:l[0])==null?void 0:u.Bearer;if(!(p!=null&&p.length))return await n();const h=e.req.header("authorization")||"",[g,A]=h.split(" ");if((g==null?void 0:g.toLowerCase())!=="bearer"||!A)throw new C(401,{message:"Missing bearer token"});try{const $=await G$(e,A);e.set("user_id",$.sub),e.set("user",$);const N=$.permissions||[],D=((d=$.scope)==null?void 0:d.split(" "))||[];if(p.length&&!(p.some(O=>N.includes(O))||p.some(O=>D.includes(O))))throw new C(403,{message:"Unauthorized"})}catch($){throw $ instanceof C?$:new C(403,{message:"Invalid token"})}}return await n()}}const J$=new s.OpenAPIHono().openapi(s.createRoute({tags:["emails"],method:"get",path:"/",request:{headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:Qs}},description:"Email provider"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=await t.env.data.emailProviders.get(e);if(!n)throw new C(404,{message:"Email provider not found"});return t.json(n)}).openapi(s.createRoute({tags:["emails"],method:"post",path:"/",request:{headers:s.z.object({"tenant-id":s.z.string()}),body:{content:{"application/json":{schema:s.z.object(Qs.shape)}}}},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Branding settings"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json");return await t.env.data.emailProviders.create(e,n),t.text("OK",{status:201})}).openapi(s.createRoute({tags:["emails"],method:"patch",path:"/",request:{headers:s.z.object({"tenant-id":s.z.string()}),body:{content:{"application/json":{schema:s.z.object(Qs.shape).partial()}}}},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Branding settings"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json");return await t.env.data.emailProviders.update(e,n),t.text("OK")}),Y$=new s.OpenAPIHono().openapi(s.createRoute({tags:["sessions"],method:"get",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:Ac}},description:"A session"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param"),r=await t.env.data.sessions.get(e,n);if(!r)throw new C(404);return t.json(r)}).openapi(s.createRoute({tags:["sessions"],method:"delete",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param");if(!await t.env.data.sessions.remove(e,n))throw new C(404,{message:"Session not found"});return t.text("OK")}).openapi(s.createRoute({tags:["sessions"],method:"post",path:"/{id}/revoke",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{202:{description:"Sesssion deletion status"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param");if(!await t.env.data.sessions.update(e,n,{revoked_at:new Date().toDateString()}))throw new C(404,{message:"Session not found"});return t.text("Session deletion request accepted.",{status:202})}),Z$=new s.OpenAPIHono().openapi(s.createRoute({tags:["refresh_tokens"],method:"get",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:mp}},description:"A session"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param"),r=await t.env.data.refreshTokens.get(e,n);if(!r)throw new C(404);return t.json(r)}).openapi(s.createRoute({tags:["refresh_tokens"],method:"delete",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param");if(!await t.env.data.refreshTokens.remove(e,n))throw new C(404,{message:"Session not found"});return t.text("OK")}),Q$=new s.OpenAPIHono().openapi(s.createRoute({tags:["custom-domains"],method:"get",path:"/",request:{query:Lt,headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:s.z.array(dr)}},description:"List of custom domains"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=await t.env.data.customDomains.list(e);return t.json(n)}).openapi(s.createRoute({tags:["custom-domains"],method:"get",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:dr}},description:"A connection"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param"),r=await t.env.data.customDomains.get(e,n);if(!r)throw new C(404);return t.json(r)}).openapi(s.createRoute({tags:["custom-domains"],method:"delete",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param");if(!await t.env.data.customDomains.remove(e,n))throw new C(404,{message:"Custom domain not found"});return t.text("OK")}).openapi(s.createRoute({tags:["custom-domains"],method:"patch",path:"/{id}",request:{body:{content:{"application/json":{schema:s.z.object(dr.shape).partial()}}},params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:dr}},description:"The updated custom domain"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param"),r=t.req.valid("json");if(!await t.env.data.customDomains.update(e,n,r))throw new C(404);const o=await t.env.data.customDomains.get(e,n);if(!o)throw new C(404);return t.json(o)}).openapi(s.createRoute({tags:["custom-domains"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:s.z.object(fp.shape)}}},headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:dr}},description:"The created custom domain"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json"),r=await t.env.data.customDomains.create(e,n);return t.json(r,{status:201})}).openapi(s.createRoute({tags:["custom-domains"],method:"post",path:"/{id}/verify",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:dr}},description:"The custom domain"}}}),async()=>{throw new C(501,{message:"Not implemented"})});function $l(t,e){const n={};for(const[r,i]of Object.entries(e)){const o={};for(const[a,l]of Object.entries(i))typeof l=="function"?o[a]=async(...u)=>{const d=performance.now();try{const p=await l(...u),g=performance.now()-d,A=t.res.headers.get("Server-Timing")||"",$=A?`${A}, ${r}-${a};dur=${g.toFixed(2)}`:`${r}-${a};dur=${g.toFixed(2)}`;return t.res.headers.set("Server-Timing",$),p}catch(p){const g=performance.now()-d,A=t.res.headers.get("Server-Timing")||"",$=A?`${A}, ${r}-${a}-error;dur=${g.toFixed(2)}`:`${r}-${a}-error;dur=${g.toFixed(2)}`;throw t.res.headers.set("Server-Timing",$),p}}:o[a]=l;n[r]=o}return n}function xl(t){return t.ISSUER}function ut(t){return t.UNIVERSAL_LOGIN_URL||`${t.ISSUER}u/`}function at(t){return t.OAUTH_API_URL||t.ISSUER}async function Al(t,e){const n=t.req.header("x-forwarded-host");if(n){const i=await t.env.data.customDomains.getByDomain(n);if(i)return t.set("tenant_id",i.tenant_id),t.set("custom_domain",n),t.set("host",n),await e()}const r=t.req.header("host");if(r){t.set("host",r);const i=r.split(".");if(i.length>1&&typeof i[0]=="string"){const o=i[0];await t.env.data.tenants.get(o)&&t.set("tenant_id",o)}}else t.set("host",new URL(xl(t.env)).host);if(!t.var.tenant_id){const i=t.req.header("tenant-id");i&&t.set("tenant_id",i)}return await e()}const ex=s.z.object({name:s.z.string(),version:s.z.string(),env:s.z.object({node:s.z.string().optional()}).optional()});function tx(t){if(t)try{let e=t;try{e=atob(t)}catch{}try{const n=JSON.parse(e);return ex.parse(n)}catch{}}catch{return}}const El=async(t,e)=>{var l,u,d,p;const n=(l=t.req.query("auth0Client"))==null?void 0:l.slice(0,255),r=(u=t.req.header("x-forwarded-host")&&t.req.header("x-forwarded-for")?t.req.header("x-forwarded-for"):t.req.header("cf-connecting-ip")||t.req.header("x-real-ip"))==null?void 0:u.slice(0,45),i=(d=t.req.header("user-agent"))==null?void 0:d.slice(0,512),o=(p=t.req.header("cf-ipcountry"))==null?void 0:p.slice(0,2),a=n?tx(n):void 0;a&&t.set("auth0_client",a),r&&t.set("ip",r),i&&t.set("useragent",i),o&&t.set("countryCode",o),await e()};function nx(t,e,n,r){try{const i=`${t}:${e}:${JSON.stringify(n)}`;return r?`${r}:${i}`:i}catch{const o=`${t}:${e}:${Date.now()}-${Math.random()}`;return r?`${r}:${o}`:o}}function Sl(t,e){const{cache:n,defaultTtl:r,customTtls:i={},excludeMethods:o=[],cacheEntities:a=[],keyPrefix:l}=e,u=new Set(o),d=a.length===0,p=new Set(a),h={};for(const[g,A]of Object.entries(t)){const $=d||p.has(g),N={};for(const[D,O]of Object.entries(A))if(typeof O=="function"){if(!$){N[D]=O;continue}const x=`${g}:${D}`;if(u.has(x)){N[D]=O;continue}const M=i[x]??r,G=["create","update","remove","delete","set","used"].includes(D);N[D]=async(...F)=>{if(G)return await O.apply(A,F);const H=nx(g,D,F,l),W=await n.get(H);if(W!==null)if(W&&typeof W=="object"&&"isCachedNull"in W){const ue=W;return ue.isCachedNull?null:ue.value}else return W;const Y=await O.apply(A,F);if(M>=0)if(Y!==null)await n.set(H,Y,M);else{const ue={value:null,isCachedNull:!0};await n.set(H,ue,M)}return Y}}else N[D]=O;h[g]=N}return h}class rx{constructor(e={}){be(this,"cache",new Map);be(this,"accessOrder",new Map);be(this,"accessCounter",0);be(this,"cleanupTimer");this.config=e;const n=e.cleanupIntervalMs;n&&n>0&&(this.cleanupTimer=setInterval(()=>{this.cleanupExpired()},n))}async get(e){const n=this.cache.get(e);return n?n.expiresAt&&n.expiresAt<new Date?(this.cache.delete(e),this.accessOrder.delete(e),null):(this.accessOrder.set(e,++this.accessCounter),n.value):null}async set(e,n,r){let i;const o=r??this.config.defaultTtlSeconds,a=o!==void 0,l=a?Math.max(0,o):0;a&&(i=new Date(Date.now()+(l>0?l*1e3:-1))),this.config.maxEntries&&this.cache.size>=this.config.maxEntries&&!this.cache.has(e)&&this.evictLeastRecentlyUsed();const u={value:n,expiresAt:i};this.cache.set(e,u),this.accessOrder.set(e,++this.accessCounter)}async delete(e){const n=this.cache.has(e);return this.cache.delete(e),this.accessOrder.delete(e),n}async clear(){this.cache.clear(),this.accessOrder.clear(),this.accessCounter=0}getStats(){return{size:this.cache.size,maxEntries:this.config.maxEntries,defaultTtlSeconds:this.config.defaultTtlSeconds}}cleanupExpired(){const e=new Date,n=[];for(const[r,i]of this.cache.entries())i.expiresAt&&i.expiresAt<e&&n.push(r);for(const r of n)this.cache.delete(r),this.accessOrder.delete(r)}evictLeastRecentlyUsed(){let e=null,n=1/0;for(const[r,i]of this.accessOrder.entries())i<n&&(n=i,e=r);e&&(this.cache.delete(e),this.accessOrder.delete(e))}destroy(){this.cleanupTimer&&(clearInterval(this.cleanupTimer),this.cleanupTimer=void 0)}}function $s(t={}){return new rx(t)}const ix=mn.extend({forms:s.z.array(vi)}),ox=new s.OpenAPIHono().openapi(s.createRoute({tags:["forms"],method:"get",path:"/",request:{query:Lt,headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:s.z.union([s.z.array(vi),ix])}},description:"List of forms"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{page:n,per_page:r,include_totals:i=!1,sort:o,q:a}=t.req.valid("query"),l=await t.env.data.forms.list(e,{page:n,per_page:r,include_totals:i,sort:pn(o),q:a});return i?t.json(l):t.json(l.forms)}).openapi(s.createRoute({tags:["forms"],method:"get",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:vi}},description:"A form"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param"),r=await t.env.data.forms.get(e,n);if(!r)throw new C(404);return t.json(r)}).openapi(s.createRoute({tags:["forms"],method:"delete",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param");if(!await t.env.data.forms.remove(e,n))throw new C(404,{message:"Form not found"});return t.text("OK")}).openapi(s.createRoute({tags:["forms"],method:"patch",path:"/{id}",request:{body:{content:{"application/json":{schema:s.z.object(xa.shape).partial()}}},params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:vi}},description:"The updated form"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param"),r=t.req.valid("json");if(!await t.env.data.forms.update(e,n,r))throw new C(404,{message:"Form not found"});const o=await t.env.data.forms.get(e,n);if(!o)throw new C(404,{message:"Form not found"});return t.json(o)}).openapi(s.createRoute({tags:["forms"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:s.z.object(xa.shape)}}},headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:vi}},description:"A form"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json"),r=await t.env.data.forms.create(e,n);return t.json(r,{status:201})}),sx=mn.extend({roles:s.z.array(Pr)}),ax=new s.OpenAPIHono().openapi(s.createRoute({tags:["roles"],method:"get",path:"/",request:{query:Lt,headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:s.z.union([s.z.array(Pr),sx])}},description:"List of roles"}}}),async t=>{const{page:e,per_page:n,include_totals:r,sort:i,q:o}=t.req.valid("query"),{"tenant-id":a}=t.req.valid("header"),l=await t.env.data.roles.list(a,{page:e,per_page:n,include_totals:r,sort:pn(i),q:o});return r?t.json(l):t.json(l.roles)}).openapi(s.createRoute({tags:["roles"],method:"get",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:Pr}},description:"A role"}}}),async t=>{const{id:e}=t.req.valid("param"),{"tenant-id":n}=t.req.valid("header"),r=await t.env.data.roles.get(n,e);if(!r)throw new C(404);return t.json(r)}).openapi(s.createRoute({tags:["roles"],method:"post",path:"/",request:{headers:s.z.object({"tenant-id":s.z.string()}),body:{content:{"application/json":{schema:Sa}}}},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:Pr}},description:"Role created"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json"),r=await t.env.data.roles.create(e,n);return t.json(r,{status:201})}).openapi(s.createRoute({tags:["roles"],method:"patch",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()}),body:{content:{"application/json":{schema:Sa.partial()}}}},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:Pr}},description:"Updated role"}}}),async t=>{const{id:e}=t.req.valid("param"),{"tenant-id":n}=t.req.valid("header"),r=t.req.valid("json");if(!await t.env.data.roles.update(n,e,r))throw new C(404);const o=await t.env.data.roles.get(n,e);return t.json(o)}).openapi(s.createRoute({tags:["roles"],method:"delete",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async t=>{const{id:e}=t.req.valid("param"),{"tenant-id":n}=t.req.valid("header");if(!await t.env.data.roles.remove(n,e))throw new C(404);return t.text("OK")}).openapi(s.createRoute({tags:["roles"],method:"get",path:"/{id}/permissions",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()}),query:Lt},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:s_}},description:"Role permissions"}}}),async t=>{const{id:e}=t.req.valid("param"),{"tenant-id":n}=t.req.valid("header"),{page:r,per_page:i,sort:o,q:a}=t.req.valid("query");if(!await t.env.data.roles.get(n,e))throw new C(404,{message:"Role not found"});const u=await t.env.data.rolePermissions.list(n,e,{page:r,per_page:i,include_totals:!1,sort:pn(o),q:a});return t.json(u)}).openapi(s.createRoute({tags:["roles"],method:"post",path:"/{id}/permissions",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()}),body:{content:{"application/json":{schema:s.z.object({permissions:s.z.array(s.z.object({permission_name:s.z.string(),resource_server_identifier:s.z.string()}))})}}}},security:[{Bearer:["auth:write"]}],responses:{201:{description:"Permissions assigned to role"}}}),async t=>{const{id:e}=t.req.valid("param"),{"tenant-id":n}=t.req.valid("header"),{permissions:r}=t.req.valid("json");if(!await t.env.data.roles.get(n,e))throw new C(404,{message:"Role not found"});if(!await t.env.data.rolePermissions.assign(n,e,r.map(a=>({role_id:e,resource_server_identifier:a.resource_server_identifier,permission_name:a.permission_name}))))throw new C(500,{message:"Failed to assign permissions to role"});return t.json({message:"Permissions assigned successfully"},{status:201})}).openapi(s.createRoute({tags:["roles"],method:"delete",path:"/{id}/permissions",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()}),body:{content:{"application/json":{schema:s.z.object({permissions:s.z.array(s.z.object({permission_name:s.z.string(),resource_server_identifier:s.z.string()}))})}}}},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Permissions removed from role"}}}),async t=>{const{id:e}=t.req.valid("param"),{"tenant-id":n}=t.req.valid("header"),{permissions:r}=t.req.valid("json");if(!await t.env.data.roles.get(n,e))throw new C(404,{message:"Role not found"});if(!await t.env.data.rolePermissions.remove(n,e,r))throw new C(500,{message:"Failed to remove permissions from role"});return t.json({message:"Permissions removed successfully"})}),cx=mn.extend({resource_servers:s.z.array(Rr)}),lx=new s.OpenAPIHono().openapi(s.createRoute({tags:["resource-servers"],method:"get",path:"/",request:{query:Lt,headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:s.z.union([s.z.array(Rr),cx])}},description:"List of resource servers"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{page:n,per_page:r,include_totals:i=!1,sort:o,q:a}=t.req.valid("query"),l=await t.env.data.resourceServers.list(e,{page:n,per_page:r,include_totals:i,sort:pn(o),q:a});return i?t.json(l):t.json(l.resource_servers)}).openapi(s.createRoute({tags:["resource-servers"],method:"get",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:read"]}],responses:{200:{content:{"application/json":{schema:Rr}},description:"A resource server"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param"),r=await t.env.data.resourceServers.get(e,n);if(!r)throw new C(404);return t.json(r)}).openapi(s.createRoute({tags:["resource-servers"],method:"delete",path:"/{id}",request:{params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{description:"Status"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param");if(!await t.env.data.resourceServers.remove(e,n))throw new C(404,{message:"Resource server not found"});return t.text("OK")}).openapi(s.createRoute({tags:["resource-servers"],method:"patch",path:"/{id}",request:{body:{content:{"application/json":{schema:s.z.object(Ea.shape).partial()}}},params:s.z.object({id:s.z.string()}),headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{200:{content:{"application/json":{schema:Rr}},description:"The updated resource server"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),{id:n}=t.req.valid("param"),r=t.req.valid("json");if(!await t.env.data.resourceServers.update(e,n,r))throw new C(404,{message:"Resource server not found"});const o=await t.env.data.resourceServers.get(e,n);if(!o)throw new C(404,{message:"Resource server not found"});return t.json(o)}).openapi(s.createRoute({tags:["resource-servers"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:s.z.object(Ea.shape)}}},headers:s.z.object({"tenant-id":s.z.string()})},security:[{Bearer:["auth:write"]}],responses:{201:{content:{"application/json":{schema:Rr}},description:"A resource server"}}}),async t=>{const{"tenant-id":e}=t.req.valid("header"),n=t.req.valid("json"),r=await t.env.data.resourceServers.create(e,n);return t.json(r,{status:201})});function ux(t){const e=new s.OpenAPIHono;e.use(wm({origin:r=>{var i;return r&&(i=t.allowedOrigins)!=null&&i.includes(r)?r:""},allowHeaders:["Tenant-Id","Content-Type","Content-Range","Auth0-Client","Authorization","Range","Upgrade-Insecure-Requests"],allowMethods:["POST","PUT","GET","DELETE","PATCH","OPTIONS"],exposeHeaders:["Content-Length","Content-Range"],maxAge:600,credentials:!0})),gf(e),e.use(async(r,i)=>{const o=ns(r,t.dataAdapter),a=$s({defaultTtlSeconds:0,maxEntries:100,cleanupIntervalMs:0}),l=Sl(o,{defaultTtl:0,cacheEntities:["tenants","connections","clients","branding","themes","promptSettings","forms"],cache:a});return r.env.data=$l(r,l),i()}),e.use(El).use(Al).use(mf(e));const n=e.route("/branding",lv).route("/custom-domains",Q$).route("/email/providers",J$).route("/users",g3).route("/keys",f$).route("/users-by-email",h$).route("/clients",m$).route("/tenants",y$).route("/logs",v$).route("/hooks",$$).route("/connections",A$).route("/prompts",E$).route("/sessions",Y$).route("/refresh_tokens",Z$).route("/forms",ox).route("/roles",ax).route("/resource-servers",lx);return n.doc("/spec",{openapi:"3.0.0",info:{version:"1.0.0",title:"Management API"},servers:[{url:"/api/v2",description:"API V2"}],security:[{oauth2:["openid","email","profile"]}]}),n}function dx(t,e){Object.keys(e).forEach(n=>{const r=e[n];r!=null&&r.length&&t.searchParams.set(n,r)})}function Wn(t){var e;if(t)return`${t.name}/${t.version}${(e=t.env)!=null&&e.node?` (env: node/${t.env.node})`:""}`}var Y0;(function(t){t[t.Include=0]="Include",t[t.None=1]="None"})(Y0||(Y0={}));var Z0;(function(t){t[t.Required=0]="Required",t[t.Ignore=1]="Ignore"})(Z0||(Z0={}));function px(t){return D1(t,fx,Ho.Include)}function z1(t){return D1(t,hx,Ho.None)}function D1(t,e,n){let r="";for(let i=0;i<t.byteLength;i+=3){let o=0,a=0;for(let l=0;l<3&&i+l<t.byteLength;l++)o=o<<8|t[i+l],a+=8;for(let l=0;l<4;l++)a>=6?(r+=e[o>>a-6&63],a-=6):a>0?(r+=e[o<<6-a&63],a=0):n===Ho.Include&&(r+="=")}return r}const fx="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",hx="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";var Ho;(function(t){t[t.Include=0]="Include",t[t.None=1]="None"})(Ho||(Ho={}));var Q0;(function(t){t[t.Required=0]="Required",t[t.Ignore=1]="Ignore"})(Q0||(Q0={}));class gx{uint8(e,n){if(e.byteLength<n+1)throw new TypeError("Insufficient bytes");return e[n]}uint16(e,n){if(e.byteLength<n+2)throw new TypeError("Insufficient bytes");return e[n]<<8|e[n+1]}uint32(e,n){if(e.byteLength<n+4)throw new TypeError("Insufficient bytes");let r=0;for(let i=0;i<4;i++)r|=e[n+i]<<24-i*8;return r}uint64(e,n){if(e.byteLength<n+8)throw new TypeError("Insufficient bytes");let r=0n;for(let i=0;i<8;i++)r|=BigInt(e[n+i])<<BigInt(56-i*8);return r}putUint8(e,n,r){if(e.length<r+1)throw new TypeError("Not enough space");if(n<0||n>255)throw new TypeError("Invalid uint8 value");e[r]=n}putUint16(e,n,r){if(e.length<r+2)throw new TypeError("Not enough space");if(n<0||n>65535)throw new TypeError("Invalid uint16 value");e[r]=n>>8,e[r+1]=n&255}putUint32(e,n,r){if(e.length<r+4)throw new TypeError("Not enough space");if(n<0||n>4294967295)throw new TypeError("Invalid uint32 value");for(let i=0;i<4;i++)e[r+i]=n>>(3-i)*8&255}putUint64(e,n,r){if(e.length<r+8)throw new TypeError("Not enough space");if(n<0||n>18446744073709551615n)throw new TypeError("Invalid uint64 value");for(let i=0;i<8;i++)e[r+i]=Number(n>>BigInt((7-i)*8)&0xffn)}}const eg=new gx;function $n(t,e){return(t<<32-e|t>>>e)>>>0}function mx(t){const e=new _x;return e.update(t),e.digest()}class _x{constructor(){be(this,"blockSize",64);be(this,"size",32);be(this,"blocks",new Uint8Array(64));be(this,"currentBlockSize",0);be(this,"H",new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]));be(this,"l",0n);be(this,"w",new Uint32Array(64))}update(e){if(this.l+=BigInt(e.byteLength)*8n,this.currentBlockSize+e.byteLength<64){this.blocks.set(e,this.currentBlockSize),this.currentBlockSize+=e.byteLength;return}let n=0;if(this.currentBlockSize>0){const r=e.slice(0,64-this.currentBlockSize);this.blocks.set(r,this.currentBlockSize),this.process(),n+=r.byteLength,this.currentBlockSize=0}for(;n+64<=e.byteLength;){const r=e.slice(n,n+64);this.blocks.set(r),this.process(),n+=64}if(e.byteLength-n>0){const r=e.slice(n);this.blocks.set(r),this.currentBlockSize=r.byteLength}}digest(){this.blocks[this.currentBlockSize]=128,this.currentBlockSize+=1,64-this.currentBlockSize<8&&(this.blocks.fill(0,this.currentBlockSize),this.process(),this.currentBlockSize=0),this.blocks.fill(0,this.currentBlockSize),eg.putUint64(this.blocks,this.l,this.blockSize-8),this.process();const e=new Uint8Array(32);for(let n=0;n<8;n++)eg.putUint32(e,this.H[n],n*4);return e}process(){for(let d=0;d<16;d++)this.w[d]=(this.blocks[d*4]<<24|this.blocks[d*4+1]<<16|this.blocks[d*4+2]<<8|this.blocks[d*4+3])>>>0;for(let d=16;d<64;d++){const p=($n(this.w[d-2],17)^$n(this.w[d-2],19)^this.w[d-2]>>>10)>>>0,h=($n(this.w[d-15],7)^$n(this.w[d-15],18)^this.w[d-15]>>>3)>>>0;this.w[d]=p+this.w[d-7]+h+this.w[d-16]|0}let e=this.H[0],n=this.H[1],r=this.H[2],i=this.H[3],o=this.H[4],a=this.H[5],l=this.H[6],u=this.H[7];for(let d=0;d<64;d++){const p=($n(o,6)^$n(o,11)^$n(o,25))>>>0,h=(o&a^~o&l)>>>0,g=u+p+h+yx[d]+this.w[d]|0,A=($n(e,2)^$n(e,13)^$n(e,22))>>>0,$=(e&n^e&r^n&r)>>>0,N=A+$|0;u=l,l=a,a=o,o=i+g|0,i=r,r=n,n=e,e=g+N|0}this.H[0]=e+this.H[0]|0,this.H[1]=n+this.H[1]|0,this.H[2]=r+this.H[2]|0,this.H[3]=i+this.H[3]|0,this.H[4]=o+this.H[4]|0,this.H[5]=a+this.H[5]|0,this.H[6]=l+this.H[6]|0,this.H[7]=u+this.H[7]|0}}const yx=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);new BigUint64Array([0x428a2f98d728ae22n,0x7137449123ef65cdn,0xb5c0fbcfec4d3b2fn,0xe9b5dba58189dbbcn,0x3956c25bf348b538n,0x59f111f1b605d019n,0x923f82a4af194f9bn,0xab1c5ed5da6d8118n,0xd807aa98a3030242n,0x12835b0145706fben,0x243185be4ee4b28cn,0x550c7dc3d5ffb4e2n,0x72be5d74f27b896fn,0x80deb1fe3b1696b1n,0x9bdc06a725c71235n,0xc19bf174cf692694n,0xe49b69c19ef14ad2n,0xefbe4786384f25e3n,0x0fc19dc68b8cd5b5n,0x240ca1cc77ac9c65n,0x2de92c6f592b0275n,0x4a7484aa6ea6e483n,0x5cb0a9dcbd41fbd4n,0x76f988da831153b5n,0x983e5152ee66dfabn,0xa831c66d2db43210n,0xb00327c898fb213fn,0xbf597fc7beef0ee4n,0xc6e00bf33da88fc2n,0xd5a79147930aa725n,0x06ca6351e003826fn,0x142929670a0e6e70n,0x27b70a8546d22ffcn,0x2e1b21385c26c926n,0x4d2c6dfc5ac42aedn,0x53380d139d95b3dfn,0x650a73548baf63den,0x766a0abb3c77b2a8n,0x81c2c92e47edaee6n,0x92722c851482353bn,0xa2bfe8a14cf10364n,0xa81a664bbc423001n,0xc24b8b70d0f89791n,0xc76c51a30654be30n,0xd192e819d6ef5218n,0xd69906245565a910n,0xf40e35855771202an,0x106aa07032bbd1b8n,0x19a4c116b8d2d0c8n,0x1e376c085141ab53n,0x2748774cdf8eeb99n,0x34b0bcb5e19b48a8n,0x391c0cb3c5c95a63n,0x4ed8aa4ae3418acbn,0x5b9cca4f7763e373n,0x682e6ff3d6b2b8a3n,0x748f82ee5defb2fcn,0x78a5636f43172f60n,0x84c87814a1f0ab72n,0x8cc702081a6439ecn,0x90befffa23631e28n,0xa4506cebde82bde9n,0xbef9a3f7b2c67915n,0xc67178f2e372532bn,0xca273eceea26619cn,0xd186b8c721c0c207n,0xeada7dd6cde0eb1en,0xf57d4f7fee6ed178n,0x06f067aa72176fban,0x0a637dc5a2c898a6n,0x113f9804bef90daen,0x1b710b35131c471bn,0x28db77f523047d84n,0x32caab7b40c72493n,0x3c9ebe0a15c9bebcn,0x431d67c49c100d4cn,0x4cc5d4becb3e42b6n,0x597f299cfc657e2an,0x5fcb6fab3ad6faecn,0x6c44198c4a475817n]);class wx{constructor(e){be(this,"data");this.data=e}tokenType(){if("token_type"in this.data&&typeof this.data.token_type=="string")return this.data.token_type;throw new Error("Missing or invalid 'token_type' field")}accessToken(){if("access_token"in this.data&&typeof this.data.access_token=="string")return this.data.access_token;throw new Error("Missing or invalid 'access_token' field")}accessTokenExpiresInSeconds(){if("expires_in"in this.data&&typeof this.data.expires_in=="number")return this.data.expires_in;throw new Error("Missing or invalid 'expires_in' field")}accessTokenExpiresAt(){return new Date(Date.now()+this.accessTokenExpiresInSeconds()*1e3)}hasRefreshToken(){return"refresh_token"in this.data&&typeof this.data.refresh_token=="string"}refreshToken(){if("refresh_token"in this.data&&typeof this.data.refresh_token=="string")return this.data.refresh_token;throw new Error("Missing or invalid 'refresh_token' field")}hasScopes(){return"scope"in this.data&&typeof this.data.scope=="string"}scopes(){if("scope"in this.data&&typeof this.data.scope=="string")return this.data.scope.split(" ");throw new Error("Missing or invalid 'scope' field")}idToken(){if("id_token"in this.data&&typeof this.data.id_token=="string")return this.data.id_token;throw new Error("Missing or invalid field 'id_token'")}}function vx(t){const e=mx(new TextEncoder().encode(t));return z1(e)}function bx(){const t=new Uint8Array(32);return crypto.getRandomValues(t),z1(t)}function No(t,e){const n=new TextEncoder().encode(e.toString()),r=new Request(t,{method:"POST",body:n});return r.headers.set("Content-Type","application/x-www-form-urlencoded"),r.headers.set("Accept","application/json"),r.headers.set("User-Agent","arctic"),r.headers.set("Content-Length",n.byteLength.toString()),r}function eu(t,e){const n=new TextEncoder().encode(`${t}:${e}`);return px(n)}async function cc(t){let e;try{e=await fetch(t)}catch(n){throw new P1(n)}if(e.status===400||e.status===401){let n;try{n=await e.json()}catch{throw new oa(e.status)}if(typeof n!="object"||n===null)throw new Ci(e.status,n);let r;try{r=R1(n)}catch{throw new Ci(e.status,n)}throw r}if(e.status===200){let n;try{n=await e.json()}catch{throw new oa(e.status)}if(typeof n!="object"||n===null)throw new Ci(e.status,n);return new wx(n)}throw e.body!==null&&await e.body.cancel(),new oa(e.status)}async function $x(t){let e;try{e=await fetch(t)}catch(n){throw new P1(n)}if(e.status===400||e.status===401){let n;try{n=await e.json()}catch{throw new Ci(e.status,null)}if(typeof n!="object"||n===null)throw new Ci(e.status,n);let r;try{r=R1(n)}catch{throw new Ci(e.status,n)}throw r}if(e.status===200){e.body!==null&&await e.body.cancel();return}throw e.body!==null&&await e.body.cancel(),new oa(e.status)}function R1(t){let e;if("error"in t&&typeof t.error=="string")e=t.error;else throw new Error("Invalid error response");let n=null,r=null,i=null;if("error_description"in t){if(typeof t.error_description!="string")throw new Error("Invalid data");n=t.error_description}if("error_uri"in t){if(typeof t.error_uri!="string")throw new Error("Invalid data");r=t.error_uri}if("state"in t){if(typeof t.state!="string")throw new Error("Invalid data");i=t.state}return new xx(e,n,r,i)}class P1 extends Error{constructor(e){super("Failed to send request",{cause:e})}}class xx extends Error{constructor(n,r,i,o){super(`OAuth request error: ${n}`);be(this,"code");be(this,"description");be(this,"uri");be(this,"state");this.code=n,this.description=r,this.uri=i,this.state=o}}class oa extends Error{constructor(n){super("Unexpected error response");be(this,"status");this.status=n}}class Ci extends Error{constructor(n,r){super("Unexpected error response body");be(this,"status");be(this,"data");this.status=n,this.data=r}}class _f{constructor(e,n,r){be(this,"clientId");be(this,"clientPassword");be(this,"redirectURI");this.clientId=e,this.clientPassword=n,this.redirectURI=r}createAuthorizationURL(e,n,r){const i=new URL(e);return i.searchParams.set("response_type","code"),i.searchParams.set("client_id",this.clientId),this.redirectURI!==null&&i.searchParams.set("redirect_uri",this.redirectURI),i.searchParams.set("state",n),r.length>0&&i.searchParams.set("scope",r.join(" ")),i}createAuthorizationURLWithPKCE(e,n,r,i,o){const a=new URL(e);if(a.searchParams.set("response_type","code"),a.searchParams.set("client_id",this.clientId),this.redirectURI!==null&&a.searchParams.set("redirect_uri",this.redirectURI),a.searchParams.set("state",n),r===Ko.S256){const l=vx(i);a.searchParams.set("code_challenge_method","S256"),a.searchParams.set("code_challenge",l)}else r===Ko.Plain&&(a.searchParams.set("code_challenge_method","plain"),a.searchParams.set("code_challenge",i));return o.length>0&&a.searchParams.set("scope",o.join(" ")),a}async validateAuthorizationCode(e,n,r){const i=new URLSearchParams;i.set("grant_type","authorization_code"),i.set("code",n),this.redirectURI!==null&&i.set("redirect_uri",this.redirectURI),r!==null&&i.set("code_verifier",r),this.clientPassword===null&&i.set("client_id",this.clientId);const o=No(e,i);if(this.clientPassword!==null){const l=eu(this.clientId,this.clientPassword);o.headers.set("Authorization",`Basic ${l}`)}return await cc(o)}async refreshAccessToken(e,n,r){const i=new URLSearchParams;i.set("grant_type","refresh_token"),i.set("refresh_token",n),this.clientPassword===null&&i.set("client_id",this.clientId),r.length>0&&i.set("scope",r.join(" "));const o=No(e,i);if(this.clientPassword!==null){const l=eu(this.clientId,this.clientPassword);o.headers.set("Authorization",`Basic ${l}`)}return await cc(o)}async revokeToken(e,n){const r=new URLSearchParams;r.set("token",n),this.clientPassword===null&&r.set("client_id",this.clientId);const i=No(e,r);if(this.clientPassword!==null){const o=eu(this.clientId,this.clientPassword);i.headers.set("Authorization",`Basic ${o}`)}await $x(i)}}var Ko;(function(t){t[t.S256=0]="S256",t[t.Plain=1]="Plain"})(Ko||(Ko={}));var tg;(function(t){t[t.Include=0]="Include",t[t.None=1]="None"})(tg||(tg={}));var ng;(function(t){t[t.Required=0]="Required",t[t.Ignore=1]="Ignore"})(ng||(ng={}));function Co(t){return Ax(t,Ex,lc.None)}function Ax(t,e,n){let r="";for(let i=0;i<t.byteLength;i+=3){let o=0,a=0;for(let l=0;l<3&&i+l<t.byteLength;l++)o=o<<8|t[i+l],a+=8;for(let l=0;l<4;l++)a>=6?(r+=e[o>>a-6&63],a-=6):a>0?(r+=e[o<<6-a&63],a=0):n===lc.Include&&(r+="=")}return r}const Ex="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";var lc;(function(t){t[t.Include=0]="Include",t[t.None=1]="None"})(lc||(lc={}));var rg;(function(t){t[t.Required=0]="Required",t[t.Ignore=1]="Ignore"})(rg||(rg={}));function Sx(t,e,n){const r=Co(new TextEncoder().encode(t)),i=Co(new TextEncoder().encode(e)),o=Co(n);return r+"."+i+"."+o}function kx(t,e){const n=Co(new TextEncoder().encode(t)),r=Co(new TextEncoder().encode(e)),i=n+"."+r;return new TextEncoder().encode(i)}const Nx="https://appleid.apple.com/auth/authorize",Cx="https://appleid.apple.com/auth/token";class B1{constructor(e,n,r,i,o){be(this,"clientId");be(this,"teamId");be(this,"keyId");be(this,"pkcs8PrivateKey");be(this,"redirectURI");this.clientId=e,this.teamId=n,this.keyId=r,this.pkcs8PrivateKey=i,this.redirectURI=o}createAuthorizationURL(e,n){const r=new URL(Nx);return r.searchParams.set("response_type","code"),r.searchParams.set("client_id",this.clientId),r.searchParams.set("state",e),n.length>0&&r.searchParams.set("scope",n.join(" ")),r.searchParams.set("redirect_uri",this.redirectURI),r}async validateAuthorizationCode(e){const n=new URLSearchParams;n.set("grant_type","authorization_code"),n.set("code",e),n.set("redirect_uri",this.redirectURI),n.set("client_id",this.clientId);const r=await this.createClientSecret();n.set("client_secret",r);const i=No(Cx,n);return await cc(i)}async createClientSecret(){const e=await crypto.subtle.importKey("pkcs8",this.pkcs8PrivateKey,{name:"ECDSA",namedCurve:"P-256"},!1,["sign"]),n=Math.floor(Date.now()/1e3),r=JSON.stringify({typ:"JWT",alg:"ES256",kid:this.keyId}),i=JSON.stringify({iss:this.teamId,exp:n+5*60,aud:["https://appleid.apple.com"],sub:this.clientId,iat:n}),o=new Uint8Array(await crypto.subtle.sign({name:"ECDSA",hash:"SHA-256"},e,kx(r,i)));return Sx(r,i,o)}}const Tx="https://www.facebook.com/v16.0/dialog/oauth",Ix="https://graph.facebook.com/v16.0/oauth/access_token";class j1{constructor(e,n,r){be(this,"clientId");be(this,"clientSecret");be(this,"redirectURI");this.clientId=e,this.clientSecret=n,this.redirectURI=r}createAuthorizationURL(e,n){const r=new URL(Tx);return r.searchParams.set("response_type","code"),r.searchParams.set("client_id",this.clientId),r.searchParams.set("state",e),n.length>0&&r.searchParams.set("scope",n.join(" ")),r.searchParams.set("redirect_uri",this.redirectURI),r}async validateAuthorizationCode(e){const n=new URLSearchParams;n.set("grant_type","authorization_code"),n.set("code",e),n.set("redirect_uri",this.redirectURI),n.set("client_id",this.clientId),n.set("client_secret",this.clientSecret);const r=No(Ix,n);return await cc(r)}}const Ox="https://accounts.google.com/o/oauth2/v2/auth",ig="https://oauth2.googleapis.com/token",zx="https://oauth2.googleapis.com/revoke";let L1=class{constructor(e,n,r){be(this,"client");this.client=new _f(e,n,r)}createAuthorizationURL(e,n,r){return this.client.createAuthorizationURLWithPKCE(Ox,e,Ko.S256,n,r)}async validateAuthorizationCode(e,n){return await this.client.validateAuthorizationCode(ig,e,n)}async refreshAccessToken(e){return await this.client.refreshAccessToken(ig,e,[])}async revokeToken(e){await this.client.revokeToken(zx,e)}};const kl=s.z.object({iss:s.z.string().url(),sub:s.z.string(),aud:s.z.string(),exp:s.z.number(),email:s.z.string().optional(),given_name:s.z.string().optional(),family_name:s.z.string().optional(),name:s.z.string().optional(),iat:s.z.number(),auth_time:s.z.number().optional(),nonce:s.z.string().optional(),acr:s.z.string().optional(),amr:s.z.array(s.z.string()).optional(),azp:s.z.string().optional(),at_hash:s.z.string().optional(),c_hash:s.z.string().optional()}).passthrough();kl.omit({iat:!0,auth_time:!0,nonce:!0,acr:!0,amr:!0,azp:!0,at_hash:!0,c_hash:!0});function F1(t){const{options:e}=t;if(!e||!e.client_id||!e.team_id||!e.kid||!e.app_secret)throw new Error("Missing required Apple authentication parameters");const n=Buffer.from(e.app_secret,"utf-8"),r=n.toString().replace(/-----BEGIN PRIVATE KEY-----|-----END PRIVATE KEY-----|\s/g,""),i=Uint8Array.from(Buffer.from(r,"base64"));return n.fill(0),{options:e,keyArray:i}}async function Dx(t,e){var d,p;const{options:n,keyArray:r}=F1(e),i=`${at(t.env)}callback`,o=new B1(n.client_id,n.team_id,n.kid,r,i),a=Ve(),l=await o.createAuthorizationURL(a,((d=n.scope)==null?void 0:d.split(" "))||["name","email"]);return(((p=n.scope)==null?void 0:p.split(" "))||["name","email"]).some(h=>["email","name"].includes(h))&&l.searchParams.set("response_mode","form_post"),{redirectUrl:l.href,code:a}}async function Rx(t,e,n){const{options:r,keyArray:i}=F1(e),a=await new B1(r.client_id,r.team_id,r.kid,i,`${at(t.env)}callback`).validateAuthorizationCode(n),l=yp(a.idToken());if(!l)throw new Error("Invalid ID token");const u=kl.parse(l.payload);return{sub:u.sub,email:u.email,given_name:u.given_name,family_name:u.family_name,name:u.name,picture:u.picture,locale:u.locale}}const Px=Object.freeze(Object.defineProperty({__proto__:null,getRedirect:Dx,validateAuthorizationCodeAndGetUser:Rx},Symbol.toStringTag,{value:"Module"}));async function Bx(t,e){var l;const{options:n}=e;if(!(n!=null&&n.client_id)||!n.client_secret)throw new Error("Missing required authentication parameters");const r=`${at(t.env)}callback`,i=new j1(n.client_id,n.client_secret,r),o=Ve();return{redirectUrl:i.createAuthorizationURL(o,((l=n.scope)==null?void 0:l.split(" "))||["email"]).href,code:o}}async function jx(t,e,n){const{options:r}=e;if(!(r!=null&&r.client_id)||!r.client_secret)throw new Error("Missing required authentication parameters");const o=await new j1(r.client_id,r.client_secret,`${at(t.env)}callback`).validateAuthorizationCode(n),a=await fetch("https://graph.facebook.com/v22.0/me?fields=id,email,name",{headers:{Authorization:`Bearer ${o.accessToken()}`}});if(!a.ok)throw new Error("Failed to fetch user info");const l=await a.json();return t.set("log",`Userinfo: ${JSON.stringify(l)}`),{sub:l.id,email:l.email,name:l.name}}const Lx=Object.freeze(Object.defineProperty({__proto__:null,getRedirect:Bx,validateAuthorizationCodeAndGetUser:jx},Symbol.toStringTag,{value:"Module"}));async function Fx(t,e){var u;const{options:n}=e;if(!(n!=null&&n.client_id)||!n.client_secret)throw new Error("Missing required Google authentication parameters");const r=`${at(t.env)}callback`,i=new L1(n.client_id,n.client_secret,r),o=Ve(),a=bx();return{redirectUrl:i.createAuthorizationURL(o,a,((u=n.scope)==null?void 0:u.split(" "))??["email","profile"]).href,code:o,codeVerifier:a}}async function Ux(t,e,n,r){const{options:i}=e;if(!(i!=null&&i.client_id)||!i.client_secret||!r)throw new Error("Missing required authentication parameters");const a=await new L1(i.client_id,i.client_secret,`${at(t.env)}callback`).validateAuthorizationCode(n,r),l=yp(a.idToken());if(!l)throw new Error("Invalid ID token");const u=kl.parse(l.payload);return{sub:u.sub,email:u.email,given_name:u.given_name,family_name:u.family_name,name:u.name,picture:u.picture,locale:u.locale}}const Mx=Object.freeze(Object.defineProperty({__proto__:null,getRedirect:Fx,validateAuthorizationCodeAndGetUser:Ux},Symbol.toStringTag,{value:"Module"}));async function qx(t,e){var a;const{options:n}=e;if(!(n!=null&&n.client_id)||!n.client_secret)throw new Error("Missing required authentication parameters");const r=new _f(n.client_id,n.client_secret,`${at(t.env)}callback`),i=Ve(),o=r.createAuthorizationURL("https://api.vipps.no/access-management-1.0/access/oauth2/auth",i,((a=n.scope)==null?void 0:a.split(" "))||["openid","email","phoneNumber","name","address","birthDate"]);return o.searchParams.set("response_type","code"),o.searchParams.set("response_mode","query"),{redirectUrl:o.href,code:i}}async function Vx(t,e,n){const{options:r}=e;if(!(r!=null&&r.client_id)||!r.client_secret)throw new Error("Missing required authentication parameters");const o=await new _f(r.client_id,r.client_secret,`${at(t.env)}callback`).validateAuthorizationCode("https://api.vipps.no/access-management-1.0/access/oauth2/token",n,null),a=yp(o.idToken());if(!a)throw new Error("Invalid ID token");const l=kl.parse(a.payload);if(typeof l.msn!="string")throw new Error("msn not available in id token");const u=await fetch("https://api.vipps.no/vipps-userinfo-api/userinfo",{headers:{Authorization:`Bearer ${o.accessToken()}`,"Merchant-Serial-Number":l.msn}});if(!u.ok)throw new C(400,{message:"Failed to get user from vipps"});return await u.json()}const Hx=Object.freeze(Object.defineProperty({__proto__:null,getRedirect:qx,validateAuthorizationCodeAndGetUser:Vx},Symbol.toStringTag,{value:"Module"}));function U1(t,e){const n=t.env.STRATEGIES||{},i={apple:Px,facebook:Lx,"google-oauth2":Mx,vipps:Hx,...n}[e];if(!i)throw new Error(`Strategy ${e} not found`);return i}async function ao(t,e){const n=await t.data.clients.get(e);if(!n)throw new C(403,{message:"Client not found"});let r=n;if(t.DEFAULT_CLIENT_ID||t.DEFAULT_TENANT_ID){const i=t.DEFAULT_CLIENT_ID?await t.data.clients.get(t.DEFAULT_CLIENT_ID):void 0,o=await t.data.connections.list(n.tenant.id),a=t.DEFAULT_TENANT_ID?await t.data.connections.list(t.DEFAULT_TENANT_ID):{connections:[]},l=o.connections.map(u=>{var h;const d=(h=a.connections)==null?void 0:h.find(g=>g.name===u.name);if(!(d!=null&&d.options))return u;const p=on.parse({...d||{},...u});return p.options=Ei.passthrough().parse({...d.options||{},...u.options}),p}).filter(u=>u);r={...n,web_origins:[...(i==null?void 0:i.web_origins)||[],...n.web_origins||[]],allowed_logout_urls:[...(i==null?void 0:i.allowed_logout_urls)||[],...n.allowed_logout_urls||[]],callbacks:[...(i==null?void 0:i.callbacks)||[],...n.callbacks||[]],connections:l,tenant:{...(i==null?void 0:i.tenant)||{},...n.tenant}}}return{...r,web_origins:[...r.web_origins||[],`${ut(t)}login`],allowed_logout_urls:[...r.allowed_logout_urls||[],t.ISSUER],callbacks:[...r.callbacks||[],`${ut(t)}info`]}}async function og(t,e,n,r){if(!r.state)throw new C(400,{message:"State not found"});const i=e.connections.find(u=>u.name===n);if(!i){t.set("client_id",e.id);const u=Me(t,{type:Le.FAILED_LOGIN,description:"Connection not found"});throw await t.env.data.logs.create(e.tenant.id,u),new C(403,{message:"Connection Not Found"})}let o=await t.env.data.loginSessions.get(e.tenant.id,r.state);if(!o){const u=t.get("ip"),d=t.get("useragent"),p=t.get("auth0_client");o=await t.env.data.loginSessions.create(e.tenant.id,{expires_at:new Date(Date.now()+qr*1e3).toISOString(),authParams:r,csrf_token:Ve(),ip:u,useragent:d,auth0Client:Wn(p)})}const l=await U1(t,i.strategy).getRedirect(t,i);return await t.env.data.codes.create(e.tenant.id,{login_id:o.id,code_id:l.code,code_type:"oauth2_state",connection_id:i.id,code_verifier:l.codeVerifier,expires_at:new Date(Date.now()+Iv*1e3).toISOString()}),new Response(null,{status:302,headers:{location:l.redirectUrl}})}async function sg(t,{code:e,state:n}){var $;const{env:r}=t,i=await r.data.codes.get(t.var.tenant_id||"",n,"oauth2_state");if(!i||!i.connection_id)throw new C(403,{message:"State not found"});const o=await r.data.loginSessions.get(t.var.tenant_id||"",i.login_id);if(!o)throw new C(403,{message:"Session not found"});if(o.authorization_url){const N=new URL(o.authorization_url).hostname,D=t.var.host||"";if(N!==D&&N){const O=new URL(`https://${N}/callback`);return O.searchParams.set("state",n),O.searchParams.set("code",e),new Response("Redirecting",{status:307,headers:{location:O.toString()}})}}const a=await ao(r,o.authParams.client_id);t.set("client_id",a.id),t.set("tenant_id",a.tenant.id);const l=a.connections.find(N=>N.id===i.connection_id);if(!l){const N=Me(t,{type:Le.FAILED_LOGIN,description:"Connection not found"});throw await r.data.logs.create(a.tenant.id,N),new C(403,{message:"Connection not found"})}if(t.set("connection",l.name),!o.authParams.redirect_uri){const N=Me(t,{type:Le.FAILED_LOGIN,description:"Redirect URI not defined"});throw await r.data.logs.create(a.tenant.id,N),new C(403,{message:"Redirect URI not defined"})}const d=await U1(t,l.strategy).validateAuthorizationCodeAndGetUser(t,l,e,i.code_verifier),{sub:p,...h}=d;t.set("user_id",p);const g=(($=d.email)==null?void 0:$.toLocaleLowerCase())||`${l.name}.${p}@${new URL(t.env.ISSUER).hostname}`;t.set("username",g);const A=await Tc(t,{client:a,username:g,provider:l.strategy,connection:l.name,userId:p,profileData:h,isSocial:!0,ip:t.req.header("x-real-ip")});return Sr(t,{client:a,authParams:o.authParams,loginSession:o,user:A})}async function ag(t,e,n,r,i,o){const a=await t.env.data.codes.get(t.var.tenant_id||"",e,"oauth2_state");if(!a)throw new C(400,{message:"State not found"});const l=await t.env.data.loginSessions.get(t.var.tenant_id,a.login_id);if(!l)throw new C(400,{message:"Login not found"});const{redirect_uri:u}=l.authParams;if(!u)throw new C(400,{message:"Redirect uri not found"});const d=Me(t,{type:Le.FAILED_LOGIN,description:`Failed connection login: ${i} ${n}, ${r}`});Bt(t,t.env.data.logs.create(t.var.tenant_id,d));const p=new URL(u);return dx(p,{error:n,error_description:r,error_reason:o,error_code:i,state:l.authParams.state}),t.redirect(`${ut(t.env)}login/identifier?state=${l.id}&error=${n}`)}const Kx=new s.OpenAPIHono().openapi(s.createRoute({tags:["oauth2"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string(),code:s.z.string().optional(),scope:s.z.string().optional(),hd:s.z.string().optional(),error:s.z.string().optional(),error_description:s.z.string().optional(),error_code:s.z.string().optional(),error_reason:s.z.string().optional()})},responses:{302:{description:"Redirect to the client's redirect uri"},400:{description:"Bad Request",content:{"application/json":{schema:s.z.object({message:s.z.string()})}}},500:{description:"Internal Server Error",content:{"application/json":{schema:s.z.object({message:s.z.string()})}}}}}),async t=>{const{state:e,code:n,error:r,error_description:i,error_code:o,error_reason:a}=t.req.valid("query");if(r)return ag(t,e,r,i,o,a);if(!n)throw new C(400,{message:"Code is required"});const l=await sg(t,{code:n,state:e});if(!(l instanceof Response))throw new C(500,{message:"Internal server error"});return l}).openapi(s.createRoute({tags:["oauth2"],method:"post",path:"/",request:{body:{content:{"application/x-www-form-urlencoded":{schema:s.z.object({state:s.z.string(),code:s.z.string().optional(),scope:s.z.string().optional(),hd:s.z.string().optional(),error:s.z.string().optional(),error_description:s.z.string().optional(),error_code:s.z.string().optional(),error_reason:s.z.string().optional()})}}}},responses:{302:{description:"Redirect to the client's redirect uri"},400:{description:"Bad Request",content:{"application/json":{schema:s.z.object({message:s.z.string()})}}},500:{description:"Internal Server Error",content:{"application/json":{schema:s.z.object({message:s.z.string()})}}}}}),async t=>{const{state:e,code:n,error:r,error_description:i,error_code:o,error_reason:a}=t.req.valid("form");if(r)return ag(t,e,r,i,o,a);if(!n)throw new C(400,{message:"Code is required"});const l=await sg(t,{code:n,state:e});if(!(l instanceof Response))throw new C(500,{message:"Internal server error"});return l});function yf(t,e=[],n={}){try{const r=new URL(t);return e.some(i=>{try{return Gx(r,new URL(i),n.allowPathWildcards)}catch{return!1}})}catch{return!1}}function Gx(t,e,n){if(t.protocol!==e.protocol)return!1;if(n&&e.pathname.includes("*")){const r=e.pathname.replace(/\*/g,".*").replace(/\//g,"\\/");if(!new RegExp(`^${r}$`).test(t.pathname))return!1}else if(t.pathname!==e.pathname)return!1;if(e.hostname.startsWith("*.")&&e.hostname.split(".").length>2&&["http:","https:"].includes(e.protocol)){const r=e.hostname.split(".").slice(1).join(".");return t.hostname.endsWith(r)}return t.hostname===e.hostname}const Wx=new s.OpenAPIHono().openapi(s.createRoute({tags:["oauth2"],method:"get",path:"/",request:{query:s.z.object({client_id:s.z.string(),returnTo:s.z.string().optional()}),header:s.z.object({cookie:s.z.string().optional()})},responses:{302:{description:"Log the user out"}}}),async t=>{const{client_id:e,returnTo:n}=t.req.valid("query"),r=await t.env.data.clients.get(e);if(!r)return t.text("OK");const i=await t.env.data.clients.get("DEFAULT_CLIENT");t.set("client_id",e),t.set("tenant_id",r.tenant.id);const o=n||t.req.header("referer");if(!o)return t.text("OK");if(!yf(o,[...r.allowed_logout_urls||[],...(i==null?void 0:i.allowed_logout_urls)||[]],{allowPathWildcards:!0}))throw new C(400,{message:"Invalid redirect uri"});const a=t.req.header("cookie");if(a){const u=Tn(r.tenant.id,a);if(u){const d=await t.env.data.sessions.get(r.tenant.id,u);if(d){const p=await t.env.data.users.get(r.tenant.id,d.user_id);p&&(t.set("user_id",p.user_id),t.set("connection",p.connection));const h=await t.env.data.refreshTokens.list(r.tenant.id,{q:`session_id=${u}`,page:0,per_page:100,include_totals:!1});await Promise.all(h.refresh_tokens.map(g=>t.env.data.refreshTokens.remove(r.tenant.id,g.id))),await t.env.data.sessions.update(r.tenant.id,u,{revoked_at:new Date().toISOString()})}}}const l=Me(t,{type:Le.SUCCESS_LOGOUT,description:"User successfully logged out"});return await t.env.data.logs.create(r.tenant.id,l),new Response("Redirecting",{status:302,headers:{"set-cookie":Pv(r.tenant.id,t.req.header("host")),location:o}})}),cg=s.z.object({sub:s.z.string(),email:s.z.string().optional(),family_name:s.z.string().optional(),given_name:s.z.string().optional(),email_verified:s.z.boolean()}),Xx=new s.OpenAPIHono().openapi(s.createRoute({tags:["oauth2"],method:"get",path:"/",request:{},security:[{Bearer:["openid"]}],responses:{200:{content:{"application/json":{schema:cg}},description:"Userinfo"}}}),async t=>{if(!t.var.user)throw new C(404,{message:"User not found"});const e=await t.env.data.users.get(t.var.user.tenant_id,t.var.user.sub);if(!e)throw new C(404,{message:"User not found"});return t.json(cg.parse({...e,sub:e.user_id}))}),Jx=new s.OpenAPIHono().openapi(s.createRoute({tags:["well known"],method:"get",path:"/jwks.json",request:{},responses:{200:{content:{"application/json":{schema:qm}},description:"List of tenants"}}}),async t=>{const e=await Gd(t.env.data);return t.json({keys:e},{headers:{"access-control-allow-origin":"*","access-control-allow-method":"GET","cache-control":`public, max-age=${js}, stale-while-revalidate=${js*2}, stale-if-error=86400`}})}).openapi(s.createRoute({tags:["well known"],method:"get",path:"/openid-configuration",request:{},responses:{200:{content:{"application/json":{schema:vu}},description:"List of tenants"}}}),async t=>{const e=vu.parse({issuer:xl(t.env),authorization_endpoint:`${at(t.env)}authorize`,token_endpoint:`${at(t.env)}oauth/token`,device_authorization_endpoint:`${at(t.env)}oauth/device/code`,userinfo_endpoint:`${at(t.env)}userinfo`,mfa_challenge_endpoint:`${at(t.env)}mfa/challenge`,jwks_uri:`${at(t.env)}.well-known/jwks.json`,registration_endpoint:`${at(t.env)}oidc/register`,revocation_endpoint:`${at(t.env)}oauth/revoke`,scopes_supported:["openid","profile","offline_access","name","given_name","family_name","nickname","email","email_verified","picture","created_at","identities","phone","address"],response_types_supported:["code","token","id_token","code token","code id_token","token id_token","code token id_token"],code_challenge_methods_supported:["S256","plain"],response_modes_supported:["query","fragment","form_post"],subject_types_supported:["public"],id_token_signing_alg_values_supported:["RS256"],token_endpoint_auth_methods_supported:["client_secret_basic","client_secret_post"],claims_supported:["aud","auth_time","created_at","email","email_verified","exp","family_name","given_name","iat","identities","iss","name","nickname","phone_number","picture","sub"],request_uri_parameter_supported:!1,request_parameter_supported:!1,token_endpoint_auth_signing_alg_values_supported:["RS256","RS384","PS256"]});return t.json(e,{headers:{"access-control-allow-origin":"*","access-control-allow-method":"GET","cache-control":`public, max-age=${js}, stale-while-revalidate=${js*2}, stale-if-error=86400`}})});function sa(t,e){if(!t||!e||t.length!==e.length)return!1;let n=0;for(let r=0;r<t.length;r++)n|=t.charCodeAt(r)^e.charCodeAt(r);return n===0}const M1=s.z.object({grant_type:s.z.literal("client_credentials"),scope:s.z.string().optional(),client_secret:s.z.string(),client_id:s.z.string(),audience:s.z.string().optional()});async function Yx(t,e){const n=await t.env.data.clients.get(e.client_id);if(!n)throw new C(403,{message:"Invalid client credentials"});if(n.client_secret&&!sa(n.client_secret,e.client_secret))throw new C(403,{message:"Invalid client credentials"});const r={client_id:n.id,scope:e.scope,audience:e.audience};return{client:n,authParams:r}}const Zx=s.z.object({grant_type:s.z.literal("authorization_code"),client_id:s.z.string(),code:s.z.string(),redirect_uri:s.z.string().optional(),client_secret:s.z.string().optional(),code_verifier:s.z.string().optional()}).refine(t=>"client_secret"in t&&!("code_verifier"in t)||!("client_secret"in t)&&"code_verifier"in t,{message:"Must provide either client_secret (standard flow) or code_verifier/code_verifier_mode (PKCE flow), but not both"});async function Qx(t,e){var l;const n=await t.env.data.clients.get(e.client_id);if(!n)throw new C(403,{message:"Client not found"});const r=await t.env.data.codes.get(n.tenant.id,e.code,"authorization_code");if(!r||!r.user_id)throw new C(403,{message:"Invalid client credentials"});if(new Date(r.expires_at)<new Date)throw new C(403,{message:"Code expired"});if(r.used_at)throw new C(403,{message:"Code already used"});const i=await t.env.data.loginSessions.get(n.tenant.id,r.login_id);if(!i)throw new C(403,{message:"Invalid login"});if("client_secret"in e){const u=await t.env.data.clients.get("DEFAULT_CLIENT");if(!sa(n.client_secret,e.client_secret)&&!sa(u==null?void 0:u.client_secret,e.client_secret))throw new C(403,{message:"Invalid client credentials"})}else if(r.code_challenge&&r.code_challenge_method&&e.code_verifier){const u=await Nv(e.code_verifier,r.code_challenge_method);if(!sa(u,r.code_challenge))throw new C(403,{message:"Invalid client credentials"})}if(r.redirect_uri&&r.redirect_uri!==e.redirect_uri)throw new C(403,{message:"Invalid redirect uri"});const o=await t.env.data.users.get(n.tenant.id,r.user_id);if(!o)throw new C(403,{message:"User not found"});await t.env.data.codes.used(n.tenant.id,e.code);let a;return i.session_id&&((l=i.authParams.scope)!=null&&l.split(" ").includes("offline_access"))&&(a=await C_(t,{user:o,client:n,session_id:i.session_id,scope:i.authParams.scope,audience:i.authParams.audience})),{user:o,client:n,loginSession:i,session_id:i.session_id,refresh_token:a==null?void 0:a.id,authParams:{...i.authParams,state:r.state,nonce:r.nonce,response_mode:Sn.WEB_MESSAGE,client_id:n.id,scope:i.authParams.scope,audience:i.authParams.audience}}}const e5=s.z.object({grant_type:s.z.literal("refresh_token"),client_id:s.z.string(),redirect_uri:s.z.string().optional(),refresh_token:s.z.string()});async function t5(t,e){const n=await t.env.data.clients.get(e.client_id);if(!n)throw new C(403,{message:"Client not found"});const r=await t.env.data.refreshTokens.get(n.tenant.id,e.refresh_token);if(r){if(r.expires_at&&new Date(r.expires_at)<new Date||r.idle_expires_at&&new Date(r.idle_expires_at)<new Date)throw new C(403,{message:JSON.stringify({error:"invalid_grant",error_description:"Refresh token has expired"})})}else throw new C(403,{message:JSON.stringify({error:"invalid_grant",error_description:"Invalid refresh token"})});const i=await t.env.data.users.get(n.tenant.id,r.user_id);if(!i)throw new C(403,{message:"User not found"});const o=r.resource_servers[0];if(r.idle_expires_at){const a=new Date(Date.now()+2592e6);await t.env.data.refreshTokens.update(n.tenant.id,r.id,{idle_expires_at:a.toISOString(),last_exchanged_at:new Date().toISOString(),device:{...r.device,last_ip:t.req.header["x-real-ip"]||"",last_user_agent:t.req.header["user-agent"]||""}})}return{user:i,client:n,refresh_token:r.id,session_id:r.session_id,authParams:{client_id:n.id,audience:o==null?void 0:o.audience,scope:o==null?void 0:o.scopes,response_mode:Sn.WEB_MESSAGE}}}const n5={version:4,country_calling_codes:{1:["US","AG","AI","AS","BB","BM","BS","CA","DM","DO","GD","GU","JM","KN","KY","LC","MP","MS","PR","SX","TC","TT","VC","VG","VI"],7:["RU","KZ"],20:["EG"],27:["ZA"],30:["GR"],31:["NL"],32:["BE"],33:["FR"],34:["ES"],36:["HU"],39:["IT","VA"],40:["RO"],41:["CH"],43:["AT"],44:["GB","GG","IM","JE"],45:["DK"],46:["SE"],47:["NO","SJ"],48:["PL"],49:["DE"],51:["PE"],52:["MX"],53:["CU"],54:["AR"],55:["BR"],56:["CL"],57:["CO"],58:["VE"],60:["MY"],61:["AU","CC","CX"],62:["ID"],63:["PH"],64:["NZ"],65:["SG"],66:["TH"],81:["JP"],82:["KR"],84:["VN"],86:["CN"],90:["TR"],91:["IN"],92:["PK"],93:["AF"],94:["LK"],95:["MM"],98:["IR"],211:["SS"],212:["MA","EH"],213:["DZ"],216:["TN"],218:["LY"],220:["GM"],221:["SN"],222:["MR"],223:["ML"],224:["GN"],225:["CI"],226:["BF"],227:["NE"],228:["TG"],229:["BJ"],230:["MU"],231:["LR"],232:["SL"],233:["GH"],234:["NG"],235:["TD"],236:["CF"],237:["CM"],238:["CV"],239:["ST"],240:["GQ"],241:["GA"],242:["CG"],243:["CD"],244:["AO"],245:["GW"],246:["IO"],247:["AC"],248:["SC"],249:["SD"],250:["RW"],251:["ET"],252:["SO"],253:["DJ"],254:["KE"],255:["TZ"],256:["UG"],257:["BI"],258:["MZ"],260:["ZM"],261:["MG"],262:["RE","YT"],263:["ZW"],264:["NA"],265:["MW"],266:["LS"],267:["BW"],268:["SZ"],269:["KM"],290:["SH","TA"],291:["ER"],297:["AW"],298:["FO"],299:["GL"],350:["GI"],351:["PT"],352:["LU"],353:["IE"],354:["IS"],355:["AL"],356:["MT"],357:["CY"],358:["FI","AX"],359:["BG"],370:["LT"],371:["LV"],372:["EE"],373:["MD"],374:["AM"],375:["BY"],376:["AD"],377:["MC"],378:["SM"],380:["UA"],381:["RS"],382:["ME"],383:["XK"],385:["HR"],386:["SI"],387:["BA"],389:["MK"],420:["CZ"],421:["SK"],423:["LI"],500:["FK"],501:["BZ"],502:["GT"],503:["SV"],504:["HN"],505:["NI"],506:["CR"],507:["PA"],508:["PM"],509:["HT"],590:["GP","BL","MF"],591:["BO"],592:["GY"],593:["EC"],594:["GF"],595:["PY"],596:["MQ"],597:["SR"],598:["UY"],599:["CW","BQ"],670:["TL"],672:["NF"],673:["BN"],674:["NR"],675:["PG"],676:["TO"],677:["SB"],678:["VU"],679:["FJ"],680:["PW"],681:["WF"],682:["CK"],683:["NU"],685:["WS"],686:["KI"],687:["NC"],688:["TV"],689:["PF"],690:["TK"],691:["FM"],692:["MH"],850:["KP"],852:["HK"],853:["MO"],855:["KH"],856:["LA"],880:["BD"],886:["TW"],960:["MV"],961:["LB"],962:["JO"],963:["SY"],964:["IQ"],965:["KW"],966:["SA"],967:["YE"],968:["OM"],970:["PS"],971:["AE"],972:["IL"],973:["BH"],974:["QA"],975:["BT"],976:["MN"],977:["NP"],992:["TJ"],993:["TM"],994:["AZ"],995:["GE"],996:["KG"],998:["UZ"]},countries:{AC:["247","00","(?:[01589]\\d|[46])\\d{4}",[5,6]],AD:["376","00","(?:1|6\\d)\\d{7}|[135-9]\\d{5}",[6,8,9],[["(\\d{3})(\\d{3})","$1 $2",["[135-9]"]],["(\\d{4})(\\d{4})","$1 $2",["1"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6"]]]],AE:["971","00","(?:[4-7]\\d|9[0-689])\\d{7}|800\\d{2,9}|[2-4679]\\d{7}",[5,6,7,8,9,10,11,12],[["(\\d{3})(\\d{2,9})","$1 $2",["60|8"]],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[236]|[479][2-8]"],"0$1"],["(\\d{3})(\\d)(\\d{5})","$1 $2 $3",["[479]"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["5"],"0$1"]],"0"],AF:["93","00","[2-7]\\d{8}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[2-7]"],"0$1"]],"0"],AG:["1","011","(?:268|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([457]\\d{6})$|1","268$1",0,"268"],AI:["1","011","(?:264|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2457]\\d{6})$|1","264$1",0,"264"],AL:["355","00","(?:700\\d\\d|900)\\d{3}|8\\d{5,7}|(?:[2-5]|6\\d)\\d{7}",[6,7,8,9],[["(\\d{3})(\\d{3,4})","$1 $2",["80|9"],"0$1"],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["4[2-6]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[2358][2-5]|4"],"0$1"],["(\\d{3})(\\d{5})","$1 $2",["[23578]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["6"],"0$1"]],"0"],AM:["374","00","(?:[1-489]\\d|55|60|77)\\d{6}",[8],[["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[89]0"],"0 $1"],["(\\d{3})(\\d{5})","$1 $2",["2|3[12]"],"(0$1)"],["(\\d{2})(\\d{6})","$1 $2",["1|47"],"(0$1)"],["(\\d{2})(\\d{6})","$1 $2",["[3-9]"],"0$1"]],"0"],AO:["244","00","[29]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[29]"]]]],AR:["54","00","(?:11|[89]\\d\\d)\\d{8}|[2368]\\d{9}",[10,11],[["(\\d{4})(\\d{2})(\\d{4})","$1 $2-$3",["2(?:2[024-9]|3[0-59]|47|6[245]|9[02-8])|3(?:3[28]|4[03-9]|5[2-46-8]|7[1-578]|8[2-9])","2(?:[23]02|6(?:[25]|4[6-8])|9(?:[02356]|4[02568]|72|8[23]))|3(?:3[28]|4(?:[04679]|3[5-8]|5[4-68]|8[2379])|5(?:[2467]|3[237]|8[2-5])|7[1-578]|8(?:[2469]|3[2578]|5[4-8]|7[36-8]|8[5-8]))|2(?:2[24-9]|3[1-59]|47)","2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3[78]|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8[23])|7[1-578]|8(?:[2469]|3[278]|5[56][46]|86[3-6]))|2(?:2[24-9]|3[1-59]|47)|38(?:[58][78]|7[378])|3(?:4[35][56]|58[45]|8(?:[38]5|54|76))[4-6]","2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3(?:5(?:4[0-25689]|[56])|[78])|58|8[2379])|5(?:[2467]|3[237]|8(?:[23]|4(?:[45]|60)|5(?:4[0-39]|5|64)))|7[1-578]|8(?:[2469]|3[278]|54(?:4|5[13-7]|6[89])|86[3-6]))|2(?:2[24-9]|3[1-59]|47)|38(?:[58][78]|7[378])|3(?:454|85[56])[46]|3(?:4(?:36|5[56])|8(?:[38]5|76))[4-6]"],"0$1",1],["(\\d{2})(\\d{4})(\\d{4})","$1 $2-$3",["1"],"0$1",1],["(\\d{3})(\\d{3})(\\d{4})","$1-$2-$3",["[68]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2-$3",["[23]"],"0$1",1],["(\\d)(\\d{4})(\\d{2})(\\d{4})","$2 15-$3-$4",["9(?:2[2-469]|3[3-578])","9(?:2(?:2[024-9]|3[0-59]|47|6[245]|9[02-8])|3(?:3[28]|4[03-9]|5[2-46-8]|7[1-578]|8[2-9]))","9(?:2(?:[23]02|6(?:[25]|4[6-8])|9(?:[02356]|4[02568]|72|8[23]))|3(?:3[28]|4(?:[04679]|3[5-8]|5[4-68]|8[2379])|5(?:[2467]|3[237]|8[2-5])|7[1-578]|8(?:[2469]|3[2578]|5[4-8]|7[36-8]|8[5-8])))|92(?:2[24-9]|3[1-59]|47)","9(?:2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3[78]|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8[23])|7[1-578]|8(?:[2469]|3[278]|5(?:[56][46]|[78])|7[378]|8(?:6[3-6]|[78]))))|92(?:2[24-9]|3[1-59]|47)|93(?:4[35][56]|58[45]|8(?:[38]5|54|76))[4-6]","9(?:2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3(?:5(?:4[0-25689]|[56])|[78])|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8(?:[23]|4(?:[45]|60)|5(?:4[0-39]|5|64)))|7[1-578]|8(?:[2469]|3[278]|5(?:4(?:4|5[13-7]|6[89])|[56][46]|[78])|7[378]|8(?:6[3-6]|[78]))))|92(?:2[24-9]|3[1-59]|47)|93(?:4(?:36|5[56])|8(?:[38]5|76))[4-6]"],"0$1",0,"$1 $2 $3-$4"],["(\\d)(\\d{2})(\\d{4})(\\d{4})","$2 15-$3-$4",["91"],"0$1",0,"$1 $2 $3-$4"],["(\\d{3})(\\d{3})(\\d{5})","$1-$2-$3",["8"],"0$1"],["(\\d)(\\d{3})(\\d{3})(\\d{4})","$2 15-$3-$4",["9"],"0$1",0,"$1 $2 $3-$4"]],"0",0,"0?(?:(11|2(?:2(?:02?|[13]|2[13-79]|4[1-6]|5[2457]|6[124-8]|7[1-4]|8[13-6]|9[1267])|3(?:02?|1[467]|2[03-6]|3[13-8]|[49][2-6]|5[2-8]|[67])|4(?:7[3-578]|9)|6(?:[0136]|2[24-6]|4[6-8]?|5[15-8])|80|9(?:0[1-3]|[19]|2\\d|3[1-6]|4[02568]?|5[2-4]|6[2-46]|72?|8[23]?))|3(?:3(?:2[79]|6|8[2578])|4(?:0[0-24-9]|[12]|3[5-8]?|4[24-7]|5[4-68]?|6[02-9]|7[126]|8[2379]?|9[1-36-8])|5(?:1|2[1245]|3[237]?|4[1-46-9]|6[2-4]|7[1-6]|8[2-5]?)|6[24]|7(?:[069]|1[1568]|2[15]|3[145]|4[13]|5[14-8]|7[2-57]|8[126])|8(?:[01]|2[15-7]|3[2578]?|4[13-6]|5[4-8]?|6[1-357-9]|7[36-8]?|8[5-8]?|9[124])))15)?","9$1"],AS:["1","011","(?:[58]\\d\\d|684|900)\\d{7}",[10],0,"1",0,"([267]\\d{6})$|1","684$1",0,"684"],AT:["43","00","1\\d{3,12}|2\\d{6,12}|43(?:(?:0\\d|5[02-9])\\d{3,9}|2\\d{4,5}|[3467]\\d{4}|8\\d{4,6}|9\\d{4,7})|5\\d{4,12}|8\\d{7,12}|9\\d{8,12}|(?:[367]\\d|4[0-24-9])\\d{4,11}",[4,5,6,7,8,9,10,11,12,13],[["(\\d)(\\d{3,12})","$1 $2",["1(?:11|[2-9])"],"0$1"],["(\\d{3})(\\d{2})","$1 $2",["517"],"0$1"],["(\\d{2})(\\d{3,5})","$1 $2",["5[079]"],"0$1"],["(\\d{3})(\\d{3,10})","$1 $2",["(?:31|4)6|51|6(?:48|5[0-3579]|[6-9])|7(?:20|32|8)|[89]","(?:31|4)6|51|6(?:485|5[0-3579]|[6-9])|7(?:20|32|8)|[89]"],"0$1"],["(\\d{4})(\\d{3,9})","$1 $2",["[2-467]|5[2-6]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["5"],"0$1"],["(\\d{2})(\\d{4})(\\d{4,7})","$1 $2 $3",["5"],"0$1"]],"0"],AU:["61","001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011","1(?:[0-79]\\d{7}(?:\\d(?:\\d{2})?)?|8[0-24-9]\\d{7})|[2-478]\\d{8}|1\\d{4,7}",[5,6,7,8,9,10,12],[["(\\d{2})(\\d{3,4})","$1 $2",["16"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,4})","$1 $2 $3",["16"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["14|4"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["[2378]"],"(0$1)"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1(?:30|[89])"]]],"0",0,"(183[12])|0",0,0,0,[["(?:(?:(?:2(?:[0-26-9]\\d|3[0-8]|4[02-9]|5[0135-9])|7(?:[013-57-9]\\d|2[0-8]))\\d|3(?:(?:[0-3589]\\d|6[1-9]|7[0-35-9])\\d|4(?:[0-578]\\d|90)))\\d\\d|8(?:51(?:0(?:0[03-9]|[12479]\\d|3[2-9]|5[0-8]|6[1-9]|8[0-7])|1(?:[0235689]\\d|1[0-69]|4[0-589]|7[0-47-9])|2(?:0[0-79]|[18][13579]|2[14-9]|3[0-46-9]|[4-6]\\d|7[89]|9[0-4])|3\\d\\d)|(?:6[0-8]|[78]\\d)\\d{3}|9(?:[02-9]\\d{3}|1(?:(?:[0-58]\\d|6[0135-9])\\d|7(?:0[0-24-9]|[1-9]\\d)|9(?:[0-46-9]\\d|5[0-79])))))\\d{3}",[9]],["4(?:79[01]|83[0-389]|94[0-4])\\d{5}|4(?:[0-36]\\d|4[047-9]|5[0-25-9]|7[02-8]|8[0-24-9]|9[0-37-9])\\d{6}",[9]],["180(?:0\\d{3}|2)\\d{3}",[7,10]],["190[0-26]\\d{6}",[10]],0,0,0,["163\\d{2,6}",[5,6,7,8,9]],["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}",[9]],["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}",[6,8,10,12]]],"0011"],AW:["297","00","(?:[25-79]\\d\\d|800)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[25-9]"]]]],AX:["358","00|99(?:[01469]|5(?:[14]1|3[23]|5[59]|77|88|9[09]))","2\\d{4,9}|35\\d{4,5}|(?:60\\d\\d|800)\\d{4,6}|7\\d{5,11}|(?:[14]\\d|3[0-46-9]|50)\\d{4,8}",[5,6,7,8,9,10,11,12],0,"0",0,0,0,0,"18",0,"00"],AZ:["994","00","365\\d{6}|(?:[124579]\\d|60|88)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["90"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1[28]|2|365|46","1[28]|2|365[45]|46","1[28]|2|365(?:4|5[02])|46"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[13-9]"],"0$1"]],"0"],BA:["387","00","6\\d{8}|(?:[35689]\\d|49|70)\\d{6}",[8,9],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["6[1-3]|[7-9]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2-$3",["[3-5]|6[56]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3 $4",["6"],"0$1"]],"0"],BB:["1","011","(?:246|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","246$1",0,"246"],BD:["880","00","[1-469]\\d{9}|8[0-79]\\d{7,8}|[2-79]\\d{8}|[2-9]\\d{7}|[3-9]\\d{6}|[57-9]\\d{5}",[6,7,8,9,10],[["(\\d{2})(\\d{4,6})","$1-$2",["31[5-8]|[459]1"],"0$1"],["(\\d{3})(\\d{3,7})","$1-$2",["3(?:[67]|8[013-9])|4(?:6[168]|7|[89][18])|5(?:6[128]|9)|6(?:[15]|28|4[14])|7[2-589]|8(?:0[014-9]|[12])|9[358]|(?:3[2-5]|4[235]|5[2-578]|6[0389]|76|8[3-7]|9[24])1|(?:44|66)[01346-9]"],"0$1"],["(\\d{4})(\\d{3,6})","$1-$2",["[13-9]|2[23]"],"0$1"],["(\\d)(\\d{7,8})","$1-$2",["2"],"0$1"]],"0"],BE:["32","00","4\\d{8}|[1-9]\\d{7}",[8,9],[["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["(?:80|9)0"],"0$1"],["(\\d)(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[239]|4[23]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[15-8]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["4"],"0$1"]],"0"],BF:["226","00","[025-7]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[025-7]"]]]],BG:["359","00","00800\\d{7}|[2-7]\\d{6,7}|[89]\\d{6,8}|2\\d{5}",[6,7,8,9,12],[["(\\d)(\\d)(\\d{2})(\\d{2})","$1 $2 $3 $4",["2"],"0$1"],["(\\d{3})(\\d{4})","$1 $2",["43[1-6]|70[1-9]"],"0$1"],["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,3})","$1 $2 $3",["[356]|4[124-7]|7[1-9]|8[1-6]|9[1-7]"],"0$1"],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["(?:70|8)0"],"0$1"],["(\\d{3})(\\d{3})(\\d{2})","$1 $2 $3",["43[1-7]|7"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[48]|9[08]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["9"],"0$1"]],"0"],BH:["973","00","[136-9]\\d{7}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[13679]|8[02-4679]"]]]],BI:["257","00","(?:[267]\\d|31)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2367]"]]]],BJ:["229","00","(?:01\\d|[24-689])\\d{7}",[8,10],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[24-689]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["0"]]]],BL:["590","00","(?:590\\d|7090)\\d{5}|(?:69|80|9\\d)\\d{7}",[9],0,"0",0,0,0,0,0,[["590(?:2[7-9]|3[3-7]|5[12]|87)\\d{4}"],["(?:69(?:0\\d\\d|1(?:2[2-9]|3[0-5])|4(?:0[89]|1[2-6]|9\\d)|6(?:1[016-9]|5[0-4]|[67]\\d))|7090[0-4])\\d{4}"],["80[0-5]\\d{6}"],0,0,0,0,0,["9(?:(?:39[5-7]|76[018])\\d|475[0-6])\\d{4}"]]],BM:["1","011","(?:441|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","441$1",0,"441"],BN:["673","00","[2-578]\\d{6}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-578]"]]]],BO:["591","00(?:1\\d)?","8001\\d{5}|(?:[2-467]\\d|50)\\d{6}",[8,9],[["(\\d)(\\d{7})","$1 $2",["[235]|4[46]"]],["(\\d{8})","$1",["[67]"]],["(\\d{3})(\\d{2})(\\d{4})","$1 $2 $3",["8"]]],"0",0,"0(1\\d)?"],BQ:["599","00","(?:[34]1|7\\d)\\d{5}",[7],0,0,0,0,0,0,"[347]"],BR:["55","00(?:1[245]|2[1-35]|31|4[13]|[56]5|99)","[1-467]\\d{9,10}|55[0-46-9]\\d{8}|[34]\\d{7}|55\\d{7,8}|(?:5[0-46-9]|[89]\\d)\\d{7,9}",[8,9,10,11],[["(\\d{4})(\\d{4})","$1-$2",["300|4(?:0[02]|37|86)","300|4(?:0(?:0|20)|370|864)"]],["(\\d{3})(\\d{2,3})(\\d{4})","$1 $2 $3",["(?:[358]|90)0"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1 $2-$3",["(?:[14689][1-9]|2[12478]|3[1-578]|5[13-5]|7[13-579])[2-57]"],"($1)"],["(\\d{2})(\\d{5})(\\d{4})","$1 $2-$3",["[16][1-9]|[2-57-9]"],"($1)"]],"0",0,"(?:0|90)(?:(1[245]|2[1-35]|31|4[13]|[56]5|99)(\\d{10,11}))?","$2"],BS:["1","011","(?:242|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([3-8]\\d{6})$|1","242$1",0,"242"],BT:["975","00","[17]\\d{7}|[2-8]\\d{6}",[7,8],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[2-68]|7[246]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1[67]|7"]]]],BW:["267","00","(?:0800|(?:[37]|800)\\d)\\d{6}|(?:[2-6]\\d|90)\\d{5}",[7,8,10],[["(\\d{2})(\\d{5})","$1 $2",["90"]],["(\\d{3})(\\d{4})","$1 $2",["[24-6]|3[15-9]"]],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[37]"]],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["0"]],["(\\d{3})(\\d{4})(\\d{3})","$1 $2 $3",["8"]]]],BY:["375","810","(?:[12]\\d|33|44|902)\\d{7}|8(?:0[0-79]\\d{5,7}|[1-7]\\d{9})|8(?:1[0-489]|[5-79]\\d)\\d{7}|8[1-79]\\d{6,7}|8[0-79]\\d{5}|8\\d{5}",[6,7,8,9,10,11],[["(\\d{3})(\\d{3})","$1 $2",["800"],"8 $1"],["(\\d{3})(\\d{2})(\\d{2,4})","$1 $2 $3",["800"],"8 $1"],["(\\d{4})(\\d{2})(\\d{3})","$1 $2-$3",["1(?:5[169]|6[3-5]|7[179])|2(?:1[35]|2[34]|3[3-5])","1(?:5[169]|6(?:3[1-3]|4|5[125])|7(?:1[3-9]|7[0-24-6]|9[2-7]))|2(?:1[35]|2[34]|3[3-5])"],"8 0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2-$3-$4",["1(?:[56]|7[467])|2[1-3]"],"8 0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2-$3-$4",["[1-4]"],"8 0$1"],["(\\d{3})(\\d{3,4})(\\d{4})","$1 $2 $3",["[89]"],"8 $1"]],"8",0,"0|80?",0,0,0,0,"8~10"],BZ:["501","00","(?:0800\\d|[2-8])\\d{6}",[7,11],[["(\\d{3})(\\d{4})","$1-$2",["[2-8]"]],["(\\d)(\\d{3})(\\d{4})(\\d{3})","$1-$2-$3-$4",["0"]]]],CA:["1","011","[2-9]\\d{9}|3\\d{6}",[7,10],0,"1",0,0,0,0,0,[["(?:2(?:04|[23]6|[48]9|50|63)|3(?:06|43|54|6[578]|82)|4(?:03|1[68]|[26]8|3[178]|50|74)|5(?:06|1[49]|48|79|8[147])|6(?:04|[18]3|39|47|72)|7(?:0[59]|42|53|78|8[02])|8(?:[06]7|19|25|7[39])|9(?:0[25]|42))[2-9]\\d{6}",[10]],["",[10]],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}",[10]],["900[2-9]\\d{6}",[10]],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|(?:5(?:2[125-9]|33|44|66|77|88)|6(?:22|33))[2-9]\\d{6}",[10]],0,["310\\d{4}",[7]],0,["600[2-9]\\d{6}",[10]]]],CC:["61","001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011","1(?:[0-79]\\d{8}(?:\\d{2})?|8[0-24-9]\\d{7})|[148]\\d{8}|1\\d{5,7}",[6,7,8,9,10,12],0,"0",0,"([59]\\d{7})$|0","8$1",0,0,[["8(?:51(?:0(?:02|31|60|89)|1(?:18|76)|223)|91(?:0(?:1[0-2]|29)|1(?:[28]2|50|79)|2(?:10|64)|3(?:[06]8|22)|4[29]8|62\\d|70[23]|959))\\d{3}",[9]],["4(?:79[01]|83[0-389]|94[0-4])\\d{5}|4(?:[0-36]\\d|4[047-9]|5[0-25-9]|7[02-8]|8[0-24-9]|9[0-37-9])\\d{6}",[9]],["180(?:0\\d{3}|2)\\d{3}",[7,10]],["190[0-26]\\d{6}",[10]],0,0,0,0,["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}",[9]],["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}",[6,8,10,12]]],"0011"],CD:["243","00","(?:(?:[189]|5\\d)\\d|2)\\d{7}|[1-68]\\d{6}",[7,8,9,10],[["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["88"],"0$1"],["(\\d{2})(\\d{5})","$1 $2",["[1-6]"],"0$1"],["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[89]"],"0$1"],["(\\d{2})(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3 $4",["5"],"0$1"]],"0"],CF:["236","00","(?:[27]\\d{3}|8776)\\d{4}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[278]"]]]],CG:["242","00","222\\d{6}|(?:0\\d|80)\\d{7}",[9],[["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["8"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[02]"]]]],CH:["41","00","8\\d{11}|[2-9]\\d{8}",[9,12],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8[047]|90"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-79]|81"],"0$1"],["(\\d{3})(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["8"],"0$1"]],"0"],CI:["225","00","[02]\\d{9}",[10],[["(\\d{2})(\\d{2})(\\d)(\\d{5})","$1 $2 $3 $4",["2"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3 $4",["0"]]]],CK:["682","00","[2-578]\\d{4}",[5],[["(\\d{2})(\\d{3})","$1 $2",["[2-578]"]]]],CL:["56","(?:0|1(?:1[0-69]|2[02-5]|5[13-58]|69|7[0167]|8[018]))0","12300\\d{6}|6\\d{9,10}|[2-9]\\d{8}",[9,10,11],[["(\\d{5})(\\d{4})","$1 $2",["219","2196"],"($1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["44"]],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["2[1-36]"],"($1)"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["9[2-9]"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["3[2-5]|[47]|5[1-3578]|6[13-57]|8(?:0[1-9]|[1-9])"],"($1)"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["60|8"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]],["(\\d{3})(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3 $4",["60"]]]],CM:["237","00","[26]\\d{8}|88\\d{6,7}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["88"]],["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["[26]|88"]]]],CN:["86","00|1(?:[12]\\d|79)\\d\\d00","(?:(?:1[03-689]|2\\d)\\d\\d|6)\\d{8}|1\\d{10}|[126]\\d{6}(?:\\d(?:\\d{2})?)?|86\\d{5,6}|(?:[3-579]\\d|8[0-57-9])\\d{5,9}",[7,8,9,10,11,12],[["(\\d{2})(\\d{5,6})","$1 $2",["(?:10|2[0-57-9])[19]|3(?:[157]|35|49|9[1-68])|4(?:1[124-9]|2[179]|6[47-9]|7|8[23])|5(?:[1357]|2[37]|4[36]|6[1-46]|80)|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:07|1[236-8]|2[5-7]|[37]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3|4[13]|5[1-5]|7[0-79]|9[0-35-9])|(?:4[35]|59|85)[1-9]","(?:10|2[0-57-9])(?:1[02]|9[56])|8078|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:1[124-9]|2[179]|[35][1-9]|6[47-9]|7\\d|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3\\d|4[13]|5[1-5]|7[0-79]|9[0-35-9]))1","10(?:1(?:0|23)|9[56])|2[0-57-9](?:1(?:00|23)|9[56])|80781|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:1[124-9]|2[179]|[35][1-9]|6[47-9]|7\\d|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3\\d|4[13]|5[1-5]|7[0-79]|9[0-35-9]))12","10(?:1(?:0|23)|9[56])|2[0-57-9](?:1(?:00|23)|9[56])|807812|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:1[124-9]|2[179]|[35][1-9]|6[47-9]|7\\d|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3\\d|4[13]|5[1-5]|7[0-79]|9[0-35-9]))123","10(?:1(?:0|23)|9[56])|2[0-57-9](?:1(?:00|23)|9[56])|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:1[124-9]|2[179]|[35][1-9]|6[47-9]|7\\d|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:078|1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|3\\d|4[13]|5[1-5]|7[0-79]|9[0-35-9]))123"],"0$1"],["(\\d{3})(\\d{5,6})","$1 $2",["3(?:[157]|35|49|9[1-68])|4(?:[17]|2[179]|6[47-9]|8[23])|5(?:[1357]|2[37]|4[36]|6[1-46]|80)|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]|4[13]|5[1-5])|(?:4[35]|59|85)[1-9]","(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))[19]","85[23](?:10|95)|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[14-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))(?:10|9[56])","85[23](?:100|95)|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[14-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))(?:100|9[56])"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["(?:4|80)0"]],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["10|2(?:[02-57-9]|1[1-9])","10|2(?:[02-57-9]|1[1-9])","10[0-79]|2(?:[02-57-9]|1[1-79])|(?:10|21)8(?:0[1-9]|[1-9])"],"0$1",1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["3(?:[3-59]|7[02-68])|4(?:[26-8]|3[3-9]|5[2-9])|5(?:3[03-9]|[468]|7[028]|9[2-46-9])|6|7(?:[0-247]|3[04-9]|5[0-4689]|6[2368])|8(?:[1-358]|9[1-7])|9(?:[013479]|5[1-5])|(?:[34]1|55|79|87)[02-9]"],"0$1",1],["(\\d{3})(\\d{7,8})","$1 $2",["9"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["80"],"0$1",1],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["[3-578]"],"0$1",1],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["1[3-9]"]],["(\\d{2})(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3 $4",["[12]"],"0$1",1]],"0",0,"(1(?:[12]\\d|79)\\d\\d)|0",0,0,0,0,"00"],CO:["57","00(?:4(?:[14]4|56)|[579])","(?:46|60\\d\\d)\\d{6}|(?:1\\d|[39])\\d{9}",[8,10,11],[["(\\d{4})(\\d{4})","$1 $2",["46"]],["(\\d{3})(\\d{7})","$1 $2",["6|90"],"($1)"],["(\\d{3})(\\d{7})","$1 $2",["3[0-357]|91"]],["(\\d)(\\d{3})(\\d{7})","$1-$2-$3",["1"],"0$1",0,"$1 $2 $3"]],"0",0,"0([3579]|4(?:[14]4|56))?"],CR:["506","00","(?:8\\d|90)\\d{8}|(?:[24-8]\\d{3}|3005)\\d{4}",[8,10],[["(\\d{4})(\\d{4})","$1 $2",["[2-7]|8[3-9]"]],["(\\d{3})(\\d{3})(\\d{4})","$1-$2-$3",["[89]"]]],0,0,"(19(?:0[0-2468]|1[09]|20|66|77|99))"],CU:["53","119","(?:[2-7]|8\\d\\d)\\d{7}|[2-47]\\d{6}|[34]\\d{5}",[6,7,8,10],[["(\\d{2})(\\d{4,6})","$1 $2",["2[1-4]|[34]"],"(0$1)"],["(\\d)(\\d{6,7})","$1 $2",["7"],"(0$1)"],["(\\d)(\\d{7})","$1 $2",["[56]"],"0$1"],["(\\d{3})(\\d{7})","$1 $2",["8"],"0$1"]],"0"],CV:["238","0","(?:[2-59]\\d\\d|800)\\d{4}",[7],[["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["[2-589]"]]]],CW:["599","00","(?:[34]1|60|(?:7|9\\d)\\d)\\d{5}",[7,8],[["(\\d{3})(\\d{4})","$1 $2",["[3467]"]],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["9[4-8]"]]],0,0,0,0,0,"[69]"],CX:["61","001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011","1(?:[0-79]\\d{8}(?:\\d{2})?|8[0-24-9]\\d{7})|[148]\\d{8}|1\\d{5,7}",[6,7,8,9,10,12],0,"0",0,"([59]\\d{7})$|0","8$1",0,0,[["8(?:51(?:0(?:01|30|59|88)|1(?:17|46|75)|2(?:22|35))|91(?:00[6-9]|1(?:[28]1|49|78)|2(?:09|63)|3(?:12|26|75)|4(?:56|97)|64\\d|7(?:0[01]|1[0-2])|958))\\d{3}",[9]],["4(?:79[01]|83[0-389]|94[0-4])\\d{5}|4(?:[0-36]\\d|4[047-9]|5[0-25-9]|7[02-8]|8[0-24-9]|9[0-37-9])\\d{6}",[9]],["180(?:0\\d{3}|2)\\d{3}",[7,10]],["190[0-26]\\d{6}",[10]],0,0,0,0,["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}",[9]],["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}",[6,8,10,12]]],"0011"],CY:["357","00","(?:[279]\\d|[58]0)\\d{6}",[8],[["(\\d{2})(\\d{6})","$1 $2",["[257-9]"]]]],CZ:["420","00","(?:[2-578]\\d|60)\\d{7}|9\\d{8,11}",[9,10,11,12],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[2-8]|9[015-7]"]],["(\\d{2})(\\d{3})(\\d{3})(\\d{2})","$1 $2 $3 $4",["96"]],["(\\d{2})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["9"]],["(\\d{3})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["9"]]]],DE:["49","00","[2579]\\d{5,14}|49(?:[34]0|69|8\\d)\\d\\d?|49(?:37|49|60|7[089]|9\\d)\\d{1,3}|49(?:2[024-9]|3[2-689]|7[1-7])\\d{1,8}|(?:1|[368]\\d|4[0-8])\\d{3,13}|49(?:[015]\\d|2[13]|31|[46][1-8])\\d{1,9}",[4,5,6,7,8,9,10,11,12,13,14,15],[["(\\d{2})(\\d{3,13})","$1 $2",["3[02]|40|[68]9"],"0$1"],["(\\d{3})(\\d{3,12})","$1 $2",["2(?:0[1-389]|1[124]|2[18]|3[14])|3(?:[35-9][15]|4[015])|906|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1","2(?:0[1-389]|12[0-8])|3(?:[35-9][15]|4[015])|906|2(?:[13][14]|2[18])|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1"],"0$1"],["(\\d{4})(\\d{2,11})","$1 $2",["[24-6]|3(?:[3569][02-46-9]|4[2-4679]|7[2-467]|8[2-46-8])|70[2-8]|8(?:0[2-9]|[1-8])|90[7-9]|[79][1-9]","[24-6]|3(?:3(?:0[1-467]|2[127-9]|3[124578]|7[1257-9]|8[1256]|9[145])|4(?:2[135]|4[13578]|9[1346])|5(?:0[14]|2[1-3589]|6[1-4]|7[13468]|8[13568])|6(?:2[1-489]|3[124-6]|6[13]|7[12579]|8[1-356]|9[135])|7(?:2[1-7]|4[145]|6[1-5]|7[1-4])|8(?:21|3[1468]|6|7[1467]|8[136])|9(?:0[12479]|2[1358]|4[134679]|6[1-9]|7[136]|8[147]|9[1468]))|70[2-8]|8(?:0[2-9]|[1-8])|90[7-9]|[79][1-9]|3[68]4[1347]|3(?:47|60)[1356]|3(?:3[46]|46|5[49])[1246]|3[4579]3[1357]"],"0$1"],["(\\d{3})(\\d{4})","$1 $2",["138"],"0$1"],["(\\d{5})(\\d{2,10})","$1 $2",["3"],"0$1"],["(\\d{3})(\\d{5,11})","$1 $2",["181"],"0$1"],["(\\d{3})(\\d)(\\d{4,10})","$1 $2 $3",["1(?:3|80)|9"],"0$1"],["(\\d{3})(\\d{7,8})","$1 $2",["1[67]"],"0$1"],["(\\d{3})(\\d{7,12})","$1 $2",["8"],"0$1"],["(\\d{5})(\\d{6})","$1 $2",["185","1850","18500"],"0$1"],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["7"],"0$1"],["(\\d{4})(\\d{7})","$1 $2",["18[68]"],"0$1"],["(\\d{4})(\\d{7})","$1 $2",["15[1279]"],"0$1"],["(\\d{5})(\\d{6})","$1 $2",["15[03568]","15(?:[0568]|31)"],"0$1"],["(\\d{3})(\\d{8})","$1 $2",["18"],"0$1"],["(\\d{3})(\\d{2})(\\d{7,8})","$1 $2 $3",["1(?:6[023]|7)"],"0$1"],["(\\d{4})(\\d{2})(\\d{7})","$1 $2 $3",["15[279]"],"0$1"],["(\\d{3})(\\d{2})(\\d{8})","$1 $2 $3",["15"],"0$1"]],"0"],DJ:["253","00","(?:2\\d|77)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[27]"]]]],DK:["45","00","[2-9]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-9]"]]]],DM:["1","011","(?:[58]\\d\\d|767|900)\\d{7}",[10],0,"1",0,"([2-7]\\d{6})$|1","767$1",0,"767"],DO:["1","011","(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,0,0,0,"8001|8[024]9"],DZ:["213","00","(?:[1-4]|[5-79]\\d|80)\\d{7}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[1-4]"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["9"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-8]"],"0$1"]],"0"],EC:["593","00","1\\d{9,10}|(?:[2-7]|9\\d)\\d{7}",[8,9,10,11],[["(\\d)(\\d{3})(\\d{4})","$1 $2-$3",["[2-7]"],"(0$1)",0,"$1-$2-$3"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["9"],"0$1"],["(\\d{4})(\\d{3})(\\d{3,4})","$1 $2 $3",["1"]]],"0"],EE:["372","00","8\\d{9}|[4578]\\d{7}|(?:[3-8]\\d|90)\\d{5}",[7,8,10],[["(\\d{3})(\\d{4})","$1 $2",["[369]|4[3-8]|5(?:[0-2]|5[0-478]|6[45])|7[1-9]|88","[369]|4[3-8]|5(?:[02]|1(?:[0-8]|95)|5[0-478]|6(?:4[0-4]|5[1-589]))|7[1-9]|88"]],["(\\d{4})(\\d{3,4})","$1 $2",["[45]|8(?:00|[1-49])","[45]|8(?:00[1-9]|[1-49])"]],["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["7"]],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["8"]]]],EG:["20","00","[189]\\d{8,9}|[24-6]\\d{8}|[135]\\d{7}",[8,9,10],[["(\\d)(\\d{7,8})","$1 $2",["[23]"],"0$1"],["(\\d{2})(\\d{6,7})","$1 $2",["1[35]|[4-6]|8[2468]|9[235-7]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[89]"],"0$1"],["(\\d{2})(\\d{8})","$1 $2",["1"],"0$1"]],"0"],EH:["212","00","[5-8]\\d{8}",[9],0,"0",0,0,0,0,"528[89]"],ER:["291","00","[178]\\d{6}",[7],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[178]"],"0$1"]],"0"],ES:["34","00","[5-9]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[89]00"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-9]"]]]],ET:["251","00","(?:11|[2-579]\\d)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[1-579]"],"0$1"]],"0"],FI:["358","00|99(?:[01469]|5(?:[14]1|3[23]|5[59]|77|88|9[09]))","[1-35689]\\d{4}|7\\d{10,11}|(?:[124-7]\\d|3[0-46-9])\\d{8}|[1-9]\\d{5,8}",[5,6,7,8,9,10,11,12],[["(\\d{5})","$1",["20[2-59]"],"0$1"],["(\\d{3})(\\d{3,7})","$1 $2",["(?:[1-3]0|[68])0|70[07-9]"],"0$1"],["(\\d{2})(\\d{4,8})","$1 $2",["[14]|2[09]|50|7[135]"],"0$1"],["(\\d{2})(\\d{6,10})","$1 $2",["7"],"0$1"],["(\\d)(\\d{4,9})","$1 $2",["(?:19|[2568])[1-8]|3(?:0[1-9]|[1-9])|9"],"0$1"]],"0",0,0,0,0,"1[03-79]|[2-9]",0,"00"],FJ:["679","0(?:0|52)","45\\d{5}|(?:0800\\d|[235-9])\\d{6}",[7,11],[["(\\d{3})(\\d{4})","$1 $2",["[235-9]|45"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["0"]]],0,0,0,0,0,0,0,"00"],FK:["500","00","[2-7]\\d{4}",[5]],FM:["691","00","(?:[39]\\d\\d|820)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[389]"]]]],FO:["298","00","[2-9]\\d{5}",[6],[["(\\d{6})","$1",["[2-9]"]]],0,0,"(10(?:01|[12]0|88))"],FR:["33","00","[1-9]\\d{8}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0 $1"],["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["[1-79]"],"0$1"]],"0"],GA:["241","00","(?:[067]\\d|11)\\d{6}|[2-7]\\d{6}",[7,8],[["(\\d)(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-7]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["0"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["11|[67]"],"0$1"]],0,0,"0(11\\d{6}|60\\d{6}|61\\d{6}|6[256]\\d{6}|7[467]\\d{6})","$1"],GB:["44","00","[1-357-9]\\d{9}|[18]\\d{8}|8\\d{6}",[7,9,10],[["(\\d{3})(\\d{4})","$1 $2",["800","8001","80011","800111","8001111"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["845","8454","84546","845464"],"0$1"],["(\\d{3})(\\d{6})","$1 $2",["800"],"0$1"],["(\\d{5})(\\d{4,5})","$1 $2",["1(?:38|5[23]|69|76|94)","1(?:(?:38|69)7|5(?:24|39)|768|946)","1(?:3873|5(?:242|39[4-6])|(?:697|768)[347]|9467)"],"0$1"],["(\\d{4})(\\d{5,6})","$1 $2",["1(?:[2-69][02-9]|[78])"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["[25]|7(?:0|6[02-9])","[25]|7(?:0|6(?:[03-9]|2[356]))"],"0$1"],["(\\d{4})(\\d{6})","$1 $2",["7"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[1389]"],"0$1"]],"0",0,0,0,0,0,[["(?:1(?:1(?:3(?:[0-58]\\d\\d|73[0-35])|4(?:(?:[0-5]\\d|70)\\d|69[7-9])|(?:(?:5[0-26-9]|[78][0-49])\\d|6(?:[0-4]\\d|50))\\d)|(?:2(?:(?:0[024-9]|2[3-9]|3[3-79]|4[1-689]|[58][02-9]|6[0-47-9]|7[013-9]|9\\d)\\d|1(?:[0-7]\\d|8[0-3]))|(?:3(?:0\\d|1[0-8]|[25][02-9]|3[02-579]|[468][0-46-9]|7[1-35-79]|9[2-578])|4(?:0[03-9]|[137]\\d|[28][02-57-9]|4[02-69]|5[0-8]|[69][0-79])|5(?:0[1-35-9]|[16]\\d|2[024-9]|3[015689]|4[02-9]|5[03-9]|7[0-35-9]|8[0-468]|9[0-57-9])|6(?:0[034689]|1\\d|2[0-35689]|[38][013-9]|4[1-467]|5[0-69]|6[13-9]|7[0-8]|9[0-24578])|7(?:0[0246-9]|2\\d|3[0236-8]|4[03-9]|5[0-46-9]|6[013-9]|7[0-35-9]|8[024-9]|9[02-9])|8(?:0[35-9]|2[1-57-9]|3[02-578]|4[0-578]|5[124-9]|6[2-69]|7\\d|8[02-9]|9[02569])|9(?:0[02-589]|[18]\\d|2[02-689]|3[1-57-9]|4[2-9]|5[0-579]|6[2-47-9]|7[0-24578]|9[2-57]))\\d)\\d)|2(?:0[013478]|3[0189]|4[017]|8[0-46-9]|9[0-2])\\d{3})\\d{4}|1(?:2(?:0(?:46[1-4]|87[2-9])|545[1-79]|76(?:2\\d|3[1-8]|6[1-6])|9(?:7(?:2[0-4]|3[2-5])|8(?:2[2-8]|7[0-47-9]|8[3-5])))|3(?:6(?:38[2-5]|47[23])|8(?:47[04-9]|64[0157-9]))|4(?:044[1-7]|20(?:2[23]|8\\d)|6(?:0(?:30|5[2-57]|6[1-8]|7[2-8])|140)|8(?:052|87[1-3]))|5(?:2(?:4(?:3[2-79]|6\\d)|76\\d)|6(?:26[06-9]|686))|6(?:06(?:4\\d|7[4-79])|295[5-7]|35[34]\\d|47(?:24|61)|59(?:5[08]|6[67]|74)|9(?:55[0-4]|77[23]))|7(?:26(?:6[13-9]|7[0-7])|(?:442|688)\\d|50(?:2[0-3]|[3-68]2|76))|8(?:27[56]\\d|37(?:5[2-5]|8[239])|843[2-58])|9(?:0(?:0(?:6[1-8]|85)|52\\d)|3583|4(?:66[1-8]|9(?:2[01]|81))|63(?:23|3[1-4])|9561))\\d{3}",[9,10]],["7(?:457[0-57-9]|700[01]|911[028])\\d{5}|7(?:[1-3]\\d\\d|4(?:[0-46-9]\\d|5[0-689])|5(?:0[0-8]|[13-9]\\d|2[0-35-9])|7(?:0[1-9]|[1-7]\\d|8[02-9]|9[0-689])|8(?:[014-9]\\d|[23][0-8])|9(?:[024-9]\\d|1[02-9]|3[0-689]))\\d{6}",[10]],["80[08]\\d{7}|800\\d{6}|8001111"],["(?:8(?:4[2-5]|7[0-3])|9(?:[01]\\d|8[2-49]))\\d{7}|845464\\d",[7,10]],["70\\d{8}",[10]],0,["(?:3[0347]|55)\\d{8}",[10]],["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}",[10]],["56\\d{8}",[10]]],0," x"],GD:["1","011","(?:473|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","473$1",0,"473"],GE:["995","00","(?:[3-57]\\d\\d|800)\\d{6}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["70"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["32"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[57]"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[348]"],"0$1"]],"0"],GF:["594","00","(?:[56]94\\d|7093)\\d{5}|(?:80|9\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-7]|9[47]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[89]"],"0$1"]],"0"],GG:["44","00","(?:1481|[357-9]\\d{3})\\d{6}|8\\d{6}(?:\\d{2})?",[7,9,10],0,"0",0,"([25-9]\\d{5})$|0","1481$1",0,0,[["1481[25-9]\\d{5}",[10]],["7(?:(?:781|839)\\d|911[17])\\d{5}",[10]],["80[08]\\d{7}|800\\d{6}|8001111"],["(?:8(?:4[2-5]|7[0-3])|9(?:[01]\\d|8[0-3]))\\d{7}|845464\\d",[7,10]],["70\\d{8}",[10]],0,["(?:3[0347]|55)\\d{8}",[10]],["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}",[10]],["56\\d{8}",[10]]]],GH:["233","00","(?:[235]\\d{3}|800)\\d{5}",[8,9],[["(\\d{3})(\\d{5})","$1 $2",["8"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[235]"],"0$1"]],"0"],GI:["350","00","(?:[25]\\d|60)\\d{6}",[8],[["(\\d{3})(\\d{5})","$1 $2",["2"]]]],GL:["299","00","(?:19|[2-689]\\d|70)\\d{4}",[6],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["19|[2-9]"]]]],GM:["220","00","[2-9]\\d{6}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-9]"]]]],GN:["224","00","722\\d{6}|(?:3|6\\d)\\d{7}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["3"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[67]"]]]],GP:["590","00","(?:590\\d|7090)\\d{5}|(?:69|80|9\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-79]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0",0,0,0,0,0,[["590(?:0[1-68]|[14][0-24-9]|2[0-68]|3[1-9]|5[3-579]|[68][0-689]|7[08]|9\\d)\\d{4}"],["(?:69(?:0\\d\\d|1(?:2[2-9]|3[0-5])|4(?:0[89]|1[2-6]|9\\d)|6(?:1[016-9]|5[0-4]|[67]\\d))|7090[0-4])\\d{4}"],["80[0-5]\\d{6}"],0,0,0,0,0,["9(?:(?:39[5-7]|76[018])\\d|475[0-6])\\d{4}"]]],GQ:["240","00","222\\d{6}|(?:3\\d|55|[89]0)\\d{7}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[235]"]],["(\\d{3})(\\d{6})","$1 $2",["[89]"]]]],GR:["30","00","5005000\\d{3}|8\\d{9,11}|(?:[269]\\d|70)\\d{8}",[10,11,12],[["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["21|7"]],["(\\d{4})(\\d{6})","$1 $2",["2(?:2|3[2-57-9]|4[2-469]|5[2-59]|6[2-9]|7[2-69]|8[2-49])|5"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[2689]"]],["(\\d{3})(\\d{3,4})(\\d{5})","$1 $2 $3",["8"]]]],GT:["502","00","80\\d{6}|(?:1\\d{3}|[2-7])\\d{7}",[8,11],[["(\\d{4})(\\d{4})","$1 $2",["[2-8]"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]]]],GU:["1","011","(?:[58]\\d\\d|671|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","671$1",0,"671"],GW:["245","00","[49]\\d{8}|4\\d{6}",[7,9],[["(\\d{3})(\\d{4})","$1 $2",["40"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[49]"]]]],GY:["592","001","(?:[2-8]\\d{3}|9008)\\d{3}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-9]"]]]],HK:["852","00(?:30|5[09]|[126-9]?)","8[0-46-9]\\d{6,7}|9\\d{4,7}|(?:[2-7]|9\\d{3})\\d{7}",[5,6,7,8,9,11],[["(\\d{3})(\\d{2,5})","$1 $2",["900","9003"]],["(\\d{4})(\\d{4})","$1 $2",["[2-7]|8[1-4]|9(?:0[1-9]|[1-8])"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"]],["(\\d{3})(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3 $4",["9"]]],0,0,0,0,0,0,0,"00"],HN:["504","00","8\\d{10}|[237-9]\\d{7}",[8,11],[["(\\d{4})(\\d{4})","$1-$2",["[237-9]"]]]],HR:["385","00","[2-69]\\d{8}|80\\d{5,7}|[1-79]\\d{7}|6\\d{6}",[7,8,9],[["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["6[01]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2,3})","$1 $2 $3",["8"],"0$1"],["(\\d)(\\d{4})(\\d{3})","$1 $2 $3",["1"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["6|7[245]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["9"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-57]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"],"0$1"]],"0"],HT:["509","00","(?:[2-489]\\d|55)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["[2-589]"]]]],HU:["36","00","[235-7]\\d{8}|[1-9]\\d{7}",[8,9],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["1"],"(06 $1)"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[27][2-9]|3[2-7]|4[24-9]|5[2-79]|6|8[2-57-9]|9[2-69]"],"(06 $1)"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-9]"],"06 $1"]],"06"],ID:["62","00[89]","00[1-9]\\d{9,14}|(?:[1-36]|8\\d{5})\\d{6}|00\\d{9}|[1-9]\\d{8,10}|[2-9]\\d{7}",[7,8,9,10,11,12,13,14,15,16,17],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["15"]],["(\\d{2})(\\d{5,9})","$1 $2",["2[124]|[36]1"],"(0$1)"],["(\\d{3})(\\d{5,7})","$1 $2",["800"],"0$1"],["(\\d{3})(\\d{5,8})","$1 $2",["[2-79]"],"(0$1)"],["(\\d{3})(\\d{3,4})(\\d{3})","$1-$2-$3",["8[1-35-9]"],"0$1"],["(\\d{3})(\\d{6,8})","$1 $2",["1"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["804"],"0$1"],["(\\d{3})(\\d)(\\d{3})(\\d{3})","$1 $2 $3 $4",["80"],"0$1"],["(\\d{3})(\\d{4})(\\d{4,5})","$1-$2-$3",["8"],"0$1"]],"0"],IE:["353","00","(?:1\\d|[2569])\\d{6,8}|4\\d{6,9}|7\\d{8}|8\\d{8,9}",[7,8,9,10],[["(\\d{2})(\\d{5})","$1 $2",["2[24-9]|47|58|6[237-9]|9[35-9]"],"(0$1)"],["(\\d{3})(\\d{5})","$1 $2",["[45]0"],"(0$1)"],["(\\d)(\\d{3,4})(\\d{4})","$1 $2 $3",["1"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2569]|4[1-69]|7[14]"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["70"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["81"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[78]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["4"],"(0$1)"],["(\\d{2})(\\d)(\\d{3})(\\d{4})","$1 $2 $3 $4",["8"],"0$1"]],"0"],IL:["972","0(?:0|1[2-9])","1\\d{6}(?:\\d{3,5})?|[57]\\d{8}|[1-489]\\d{7}",[7,8,9,10,11,12],[["(\\d{4})(\\d{3})","$1-$2",["125"]],["(\\d{4})(\\d{2})(\\d{2})","$1-$2-$3",["121"]],["(\\d)(\\d{3})(\\d{4})","$1-$2-$3",["[2-489]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["[57]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1-$2-$3",["12"]],["(\\d{4})(\\d{6})","$1-$2",["159"]],["(\\d)(\\d{3})(\\d{3})(\\d{3})","$1-$2-$3-$4",["1[7-9]"]],["(\\d{3})(\\d{1,2})(\\d{3})(\\d{4})","$1-$2 $3-$4",["15"]]],"0"],IM:["44","00","1624\\d{6}|(?:[3578]\\d|90)\\d{8}",[10],0,"0",0,"([25-8]\\d{5})$|0","1624$1",0,"74576|(?:16|7[56])24"],IN:["91","00","(?:000800|[2-9]\\d\\d)\\d{7}|1\\d{7,12}",[8,9,10,11,12,13],[["(\\d{8})","$1",["5(?:0|2[23]|3[03]|[67]1|88)","5(?:0|2(?:21|3)|3(?:0|3[23])|616|717|888)","5(?:0|2(?:21|3)|3(?:0|3[23])|616|717|8888)"],0,1],["(\\d{4})(\\d{4,5})","$1 $2",["180","1800"],0,1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["140"],0,1],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["11|2[02]|33|4[04]|79[1-7]|80[2-46]","11|2[02]|33|4[04]|79(?:[1-6]|7[19])|80(?:[2-4]|6[0-589])","11|2[02]|33|4[04]|79(?:[124-6]|3(?:[02-9]|1[0-24-9])|7(?:1|9[1-6]))|80(?:[2-4]|6[0-589])"],"0$1",1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["1(?:2[0-249]|3[0-25]|4[145]|[68]|7[1257])|2(?:1[257]|3[013]|4[01]|5[0137]|6[0158]|78|8[1568])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|5[12]|[78]1)|6(?:12|[2-4]1|5[17]|6[13]|80)|7(?:12|3[134]|4[47]|61|88)|8(?:16|2[014]|3[126]|6[136]|7[078]|8[34]|91)|(?:43|59|75)[15]|(?:1[59]|29|67|72)[14]","1(?:2[0-24]|3[0-25]|4[145]|[59][14]|6[1-9]|7[1257]|8[1-57-9])|2(?:1[257]|3[013]|4[01]|5[0137]|6[058]|78|8[1568]|9[14])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|3[15]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|[578]1|9[15])|674|7(?:(?:2[14]|3[34]|5[15])[2-6]|61[346]|88[0-8])|8(?:70[2-6]|84[235-7]|91[3-7])|(?:1(?:29|60|8[06])|261|552|6(?:12|[2-47]1|5[17]|6[13]|80)|7(?:12|31|4[47])|8(?:16|2[014]|3[126]|6[136]|7[78]|83))[2-7]","1(?:2[0-24]|3[0-25]|4[145]|[59][14]|6[1-9]|7[1257]|8[1-57-9])|2(?:1[257]|3[013]|4[01]|5[0137]|6[058]|78|8[1568]|9[14])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|3[15]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|[578]1|9[15])|6(?:12(?:[2-6]|7[0-8])|74[2-7])|7(?:(?:2[14]|5[15])[2-6]|3171|61[346]|88(?:[2-7]|82))|8(?:70[2-6]|84(?:[2356]|7[19])|91(?:[3-6]|7[19]))|73[134][2-6]|(?:74[47]|8(?:16|2[014]|3[126]|6[136]|7[78]|83))(?:[2-6]|7[19])|(?:1(?:29|60|8[06])|261|552|6(?:[2-4]1|5[17]|6[13]|7(?:1|4[0189])|80)|7(?:12|88[01]))[2-7]"],"0$1",1],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1(?:[2-479]|5[0235-9])|[2-5]|6(?:1[1358]|2[2457-9]|3[2-5]|4[235-7]|5[2-689]|6[24578]|7[235689]|8[1-6])|7(?:1[013-9]|28|3[129]|4[1-35689]|5[29]|6[02-5]|70)|807","1(?:[2-479]|5[0235-9])|[2-5]|6(?:1[1358]|2(?:[2457]|84|95)|3(?:[2-4]|55)|4[235-7]|5[2-689]|6[24578]|7[235689]|8[1-6])|7(?:1(?:[013-8]|9[6-9])|28[6-8]|3(?:17|2[0-49]|9[2-57])|4(?:1[2-4]|[29][0-7]|3[0-8]|[56]|8[0-24-7])|5(?:2[1-3]|9[0-6])|6(?:0[5689]|2[5-9]|3[02-8]|4|5[0-367])|70[13-7])|807[19]","1(?:[2-479]|5(?:[0236-9]|5[013-9]))|[2-5]|6(?:2(?:84|95)|355|83)|73179|807(?:1|9[1-3])|(?:1552|6(?:1[1358]|2[2457]|3[2-4]|4[235-7]|5[2-689]|6[24578]|7[235689]|8[124-6])\\d|7(?:1(?:[013-8]\\d|9[6-9])|28[6-8]|3(?:2[0-49]|9[2-57])|4(?:1[2-4]|[29][0-7]|3[0-8]|[56]\\d|8[0-24-7])|5(?:2[1-3]|9[0-6])|6(?:0[5689]|2[5-9]|3[02-8]|4\\d|5[0-367])|70[13-7]))[2-7]"],"0$1",1],["(\\d{5})(\\d{5})","$1 $2",["[6-9]"],"0$1",1],["(\\d{4})(\\d{2,4})(\\d{4})","$1 $2 $3",["1(?:6|8[06])","1(?:6|8[06]0)"],0,1],["(\\d{4})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["18"],0,1]],"0"],IO:["246","00","3\\d{6}",[7],[["(\\d{3})(\\d{4})","$1 $2",["3"]]]],IQ:["964","00","(?:1|7\\d\\d)\\d{7}|[2-6]\\d{7,8}",[8,9,10],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-6]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"0$1"]],"0"],IR:["98","00","[1-9]\\d{9}|(?:[1-8]\\d\\d|9)\\d{3,4}",[4,5,6,7,10],[["(\\d{4,5})","$1",["96"],"0$1"],["(\\d{2})(\\d{4,5})","$1 $2",["(?:1[137]|2[13-68]|3[1458]|4[145]|5[1468]|6[16]|7[1467]|8[13467])[12689]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["9"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["[1-8]"],"0$1"]],"0"],IS:["354","00|1(?:0(?:01|[12]0)|100)","(?:38\\d|[4-9])\\d{6}",[7,9],[["(\\d{3})(\\d{4})","$1 $2",["[4-9]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["3"]]],0,0,0,0,0,0,0,"00"],IT:["39","00","0\\d{5,10}|1\\d{8,10}|3(?:[0-8]\\d{7,10}|9\\d{7,8})|(?:43|55|70)\\d{8}|8\\d{5}(?:\\d{2,4})?",[6,7,8,9,10,11,12],[["(\\d{2})(\\d{4,6})","$1 $2",["0[26]"]],["(\\d{3})(\\d{3,6})","$1 $2",["0[13-57-9][0159]|8(?:03|4[17]|9[2-5])","0[13-57-9][0159]|8(?:03|4[17]|9(?:2|3[04]|[45][0-4]))"]],["(\\d{4})(\\d{2,6})","$1 $2",["0(?:[13-579][2-46-8]|8[236-8])"]],["(\\d{4})(\\d{4})","$1 $2",["894"]],["(\\d{2})(\\d{3,4})(\\d{4})","$1 $2 $3",["0[26]|5"]],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["1(?:44|[679])|[378]|43"]],["(\\d{3})(\\d{3,4})(\\d{4})","$1 $2 $3",["0[13-57-9][0159]|14"]],["(\\d{2})(\\d{4})(\\d{5})","$1 $2 $3",["0[26]"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["0"]],["(\\d{3})(\\d{4})(\\d{4,5})","$1 $2 $3",["3"]]],0,0,0,0,0,0,[["0669[0-79]\\d{1,6}|0(?:1(?:[0159]\\d|[27][1-5]|31|4[1-4]|6[1356]|8[2-57])|2\\d\\d|3(?:[0159]\\d|2[1-4]|3[12]|[48][1-6]|6[2-59]|7[1-7])|4(?:[0159]\\d|[23][1-9]|4[245]|6[1-5]|7[1-4]|81)|5(?:[0159]\\d|2[1-5]|3[2-6]|4[1-79]|6[4-6]|7[1-578]|8[3-8])|6(?:[0-57-9]\\d|6[0-8])|7(?:[0159]\\d|2[12]|3[1-7]|4[2-46]|6[13569]|7[13-6]|8[1-59])|8(?:[0159]\\d|2[3-578]|3[1-356]|[6-8][1-5])|9(?:[0159]\\d|[238][1-5]|4[12]|6[1-8]|7[1-6]))\\d{2,7}",[6,7,8,9,10,11]],["3[2-9]\\d{7,8}|(?:31|43)\\d{8}",[9,10]],["80(?:0\\d{3}|3)\\d{3}",[6,9]],["(?:0878\\d{3}|89(?:2\\d|3[04]|4(?:[0-4]|[5-9]\\d\\d)|5[0-4]))\\d\\d|(?:1(?:44|6[346])|89(?:38|5[5-9]|9))\\d{6}",[6,8,9,10]],["1(?:78\\d|99)\\d{6}",[9,10]],["3[2-8]\\d{9,10}",[11,12]],0,0,["55\\d{8}",[10]],["84(?:[08]\\d{3}|[17])\\d{3}",[6,9]]]],JE:["44","00","1534\\d{6}|(?:[3578]\\d|90)\\d{8}",[10],0,"0",0,"([0-24-8]\\d{5})$|0","1534$1",0,0,[["1534[0-24-8]\\d{5}"],["7(?:(?:(?:50|82)9|937)\\d|7(?:00[378]|97\\d))\\d{5}"],["80(?:07(?:35|81)|8901)\\d{4}"],["(?:8(?:4(?:4(?:4(?:05|42|69)|703)|5(?:041|800))|7(?:0002|1206))|90(?:066[59]|1810|71(?:07|55)))\\d{4}"],["701511\\d{4}"],0,["(?:3(?:0(?:07(?:35|81)|8901)|3\\d{4}|4(?:4(?:4(?:05|42|69)|703)|5(?:041|800))|7(?:0002|1206))|55\\d{4})\\d{4}"],["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}"],["56\\d{8}"]]],JM:["1","011","(?:[58]\\d\\d|658|900)\\d{7}",[10],0,"1",0,0,0,0,"658|876"],JO:["962","00","(?:(?:[2689]|7\\d)\\d|32|53)\\d{6}",[8,9],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[2356]|87"],"(0$1)"],["(\\d{3})(\\d{5,6})","$1 $2",["[89]"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["70"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["7"],"0$1"]],"0"],JP:["81","010","00[1-9]\\d{6,14}|[257-9]\\d{9}|(?:00|[1-9]\\d\\d)\\d{6}",[8,9,10,11,12,13,14,15,16,17],[["(\\d{3})(\\d{3})(\\d{3})","$1-$2-$3",["(?:12|57|99)0"],"0$1"],["(\\d{4})(\\d)(\\d{4})","$1-$2-$3",["1(?:26|3[79]|4[56]|5[4-68]|6[3-5])|499|5(?:76|97)|746|8(?:3[89]|47|51)|9(?:80|9[16])","1(?:267|3(?:7[247]|9[278])|466|5(?:47|58|64)|6(?:3[245]|48|5[4-68]))|499[2468]|5(?:76|97)9|7468|8(?:3(?:8[7-9]|96)|477|51[2-9])|9(?:802|9(?:1[23]|69))|1(?:45|58)[67]","1(?:267|3(?:7[247]|9[278])|466|5(?:47|58|64)|6(?:3[245]|48|5[4-68]))|499[2468]|5(?:769|979[2-69])|7468|8(?:3(?:8[7-9]|96[2457-9])|477|51[2-9])|9(?:802|9(?:1[23]|69))|1(?:45|58)[67]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["60"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1-$2-$3",["[36]|4(?:2[09]|7[01])","[36]|4(?:2(?:0|9[02-69])|7(?:0[019]|1))"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["1(?:1|5[45]|77|88|9[69])|2(?:2[1-37]|3[0-269]|4[59]|5|6[24]|7[1-358]|8[1369]|9[0-38])|4(?:[28][1-9]|3[0-57]|[45]|6[248]|7[2-579]|9[29])|5(?:2|3[0459]|4[0-369]|5[29]|8[02389]|9[0-389])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9[2-6])|8(?:2[124589]|3[26-9]|49|51|6|7[0-468]|8[68]|9[019])|9(?:[23][1-9]|4[15]|5[138]|6[1-3]|7[156]|8[189]|9[1-489])","1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2(?:[127]|3[014-9])|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|9[19])|62|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|8[1-9]|9[29])|5(?:2|3(?:[045]|9[0-8])|4[0-369]|5[29]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9[0-2469])|3(?:[29]|60)|49|51|6(?:[0-24]|36|5[0-3589]|7[23]|9[01459])|7[0-468]|8[68])|9(?:[23][1-9]|4[15]|5[138]|6[1-3]|7[156]|8[189]|9(?:[1289]|3[34]|4[0178]))|(?:264|837)[016-9]|2(?:57|93)[015-9]|(?:25[0468]|422|838)[01]|(?:47[59]|59[89]|8(?:6[68]|9))[019]","1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2[127]|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|9(?:17|99))|6(?:2|4[016-9])|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|9[29])|5(?:2|3(?:[045]|9(?:[0-58]|6[4-9]|7[0-35689]))|4[0-369]|5[29]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9[0169])|3(?:[29]|60|7(?:[017-9]|6[6-8]))|49|51|6(?:[0-24]|36[2-57-9]|5(?:[0-389]|5[23])|6(?:[01]|9[178])|7(?:2[2-468]|3[78])|9[0145])|7[0-468]|8[68])|9(?:4[15]|5[138]|7[156]|8[189]|9(?:[1289]|3(?:31|4[357])|4[0178]))|(?:8294|96)[1-3]|2(?:57|93)[015-9]|(?:223|8699)[014-9]|(?:25[0468]|422|838)[01]|(?:48|8292|9[23])[1-9]|(?:47[59]|59[89]|8(?:68|9))[019]"],"0$1"],["(\\d{3})(\\d{2})(\\d{4})","$1-$2-$3",["[14]|[289][2-9]|5[3-9]|7[2-4679]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1-$2-$3",["800"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1-$2-$3",["[257-9]"],"0$1"]],"0",0,"(000[259]\\d{6})$|(?:(?:003768)0?)|0","$1"],KE:["254","000","(?:[17]\\d\\d|900)\\d{6}|(?:2|80)0\\d{6,7}|[4-6]\\d{6,8}",[7,8,9,10],[["(\\d{2})(\\d{5,7})","$1 $2",["[24-6]"],"0$1"],["(\\d{3})(\\d{6})","$1 $2",["[17]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["[89]"],"0$1"]],"0"],KG:["996","00","8\\d{9}|[235-9]\\d{8}",[9,10],[["(\\d{4})(\\d{5})","$1 $2",["3(?:1[346]|[24-79])"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[235-79]|88"],"0$1"],["(\\d{3})(\\d{3})(\\d)(\\d{2,3})","$1 $2 $3 $4",["8"],"0$1"]],"0"],KH:["855","00[14-9]","1\\d{9}|[1-9]\\d{7,8}",[8,9,10],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-9]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]]],"0"],KI:["686","00","(?:[37]\\d|6[0-79])\\d{6}|(?:[2-48]\\d|50)\\d{3}",[5,8],0,"0"],KM:["269","00","[3478]\\d{6}",[7],[["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["[3478]"]]]],KN:["1","011","(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-7]\\d{6})$|1","869$1",0,"869"],KP:["850","00|99","85\\d{6}|(?:19\\d|[2-7])\\d{7}",[8,10],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["8"],"0$1"],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[2-7]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"]],"0"],KR:["82","00(?:[125689]|3(?:[46]5|91)|7(?:00|27|3|55|6[126]))","00[1-9]\\d{8,11}|(?:[12]|5\\d{3})\\d{7}|[13-6]\\d{9}|(?:[1-6]\\d|80)\\d{7}|[3-6]\\d{4,5}|(?:00|7)0\\d{8}",[5,6,8,9,10,11,12,13,14],[["(\\d{2})(\\d{3,4})","$1-$2",["(?:3[1-3]|[46][1-4]|5[1-5])1"],"0$1"],["(\\d{4})(\\d{4})","$1-$2",["1"]],["(\\d)(\\d{3,4})(\\d{4})","$1-$2-$3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["[36]0|8"],"0$1"],["(\\d{2})(\\d{3,4})(\\d{4})","$1-$2-$3",["[1346]|5[1-5]"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1-$2-$3",["[57]"],"0$1"],["(\\d{2})(\\d{5})(\\d{4})","$1-$2-$3",["5"],"0$1"]],"0",0,"0(8(?:[1-46-8]|5\\d\\d))?"],KW:["965","00","18\\d{5}|(?:[2569]\\d|41)\\d{6}",[7,8],[["(\\d{4})(\\d{3,4})","$1 $2",["[169]|2(?:[235]|4[1-35-9])|52"]],["(\\d{3})(\\d{5})","$1 $2",["[245]"]]]],KY:["1","011","(?:345|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","345$1",0,"345"],KZ:["7","810","(?:33622|8\\d{8})\\d{5}|[78]\\d{9}",[10,14],0,"8",0,0,0,0,"33|7",0,"8~10"],LA:["856","00","[23]\\d{9}|3\\d{8}|(?:[235-8]\\d|41)\\d{6}",[8,9,10],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["2[13]|3[14]|[4-8]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3 $4",["3"],"0$1"],["(\\d{2})(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3 $4",["[23]"],"0$1"]],"0"],LB:["961","00","[27-9]\\d{7}|[13-9]\\d{6}",[7,8],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[13-69]|7(?:[2-57]|62|8[0-7]|9[04-9])|8[02-9]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[27-9]"]]],"0"],LC:["1","011","(?:[58]\\d\\d|758|900)\\d{7}",[10],0,"1",0,"([2-8]\\d{6})$|1","758$1",0,"758"],LI:["423","00","[68]\\d{8}|(?:[2378]\\d|90)\\d{5}",[7,9],[["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["[2379]|8(?:0[09]|7)","[2379]|8(?:0(?:02|9)|7)"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["69"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6"]]],"0",0,"(1001)|0"],LK:["94","00","[1-9]\\d{8}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[1-689]"],"0$1"]],"0"],LR:["231","00","(?:[245]\\d|33|77|88)\\d{7}|(?:2\\d|[4-6])\\d{6}",[7,8,9],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["4[67]|[56]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[2-578]"],"0$1"]],"0"],LS:["266","00","(?:[256]\\d\\d|800)\\d{5}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[2568]"]]]],LT:["370","00","(?:[3469]\\d|52|[78]0)\\d{6}",[8],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["52[0-7]"],"(0-$1)",1],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[7-9]"],"0 $1",1],["(\\d{2})(\\d{6})","$1 $2",["37|4(?:[15]|6[1-8])"],"(0-$1)",1],["(\\d{3})(\\d{5})","$1 $2",["[3-6]"],"(0-$1)",1]],"0",0,"[08]"],LU:["352","00","35[013-9]\\d{4,8}|6\\d{8}|35\\d{2,4}|(?:[2457-9]\\d|3[0-46-9])\\d{2,9}",[4,5,6,7,8,9,10,11],[["(\\d{2})(\\d{3})","$1 $2",["2(?:0[2-689]|[2-9])|[3-57]|8(?:0[2-9]|[13-9])|9(?:0[89]|[2-579])"]],["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["2(?:0[2-689]|[2-9])|[3-57]|8(?:0[2-9]|[13-9])|9(?:0[89]|[2-579])"]],["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["20[2-689]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{1,2})","$1 $2 $3 $4",["2(?:[0367]|4[3-8])"]],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["80[01]|90[015]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3 $4",["20"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{1,2})","$1 $2 $3 $4 $5",["2(?:[0367]|4[3-8])"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{1,5})","$1 $2 $3 $4",["[3-57]|8[13-9]|9(?:0[89]|[2-579])|(?:2|80)[2-9]"]]],0,0,"(15(?:0[06]|1[12]|[35]5|4[04]|6[26]|77|88|99)\\d)"],LV:["371","00","(?:[268]\\d|90)\\d{6}",[8],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[269]|8[01]"]]]],LY:["218","00","[2-9]\\d{8}",[9],[["(\\d{2})(\\d{7})","$1-$2",["[2-9]"],"0$1"]],"0"],MA:["212","00","[5-8]\\d{8}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["5[45]"],"0$1"],["(\\d{4})(\\d{5})","$1-$2",["5(?:2[2-46-9]|3[3-9]|9)|8(?:0[89]|92)"],"0$1"],["(\\d{2})(\\d{7})","$1-$2",["8"],"0$1"],["(\\d{3})(\\d{6})","$1-$2",["[5-7]"],"0$1"]],"0",0,0,0,0,0,[["5(?:2(?:[0-25-79]\\d|3[1-578]|4[02-46-8]|8[0235-7])|3(?:[0-47]\\d|5[02-9]|6[02-8]|8[014-9]|9[3-9])|(?:4[067]|5[03])\\d)\\d{5}"],["(?:6(?:[0-79]\\d|8[0-247-9])|7(?:[0167]\\d|2[0-467]|5[0-3]|8[0-7]))\\d{6}"],["80[0-7]\\d{6}"],["89\\d{7}"],0,0,0,0,["(?:592(?:4[0-2]|93)|80[89]\\d\\d)\\d{4}"]]],MC:["377","00","(?:[3489]|6\\d)\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["4"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[389]"]],["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["6"],"0$1"]],"0"],MD:["373","00","(?:[235-7]\\d|[89]0)\\d{6}",[8],[["(\\d{3})(\\d{5})","$1 $2",["[89]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["22|3"],"0$1"],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[25-7]"],"0$1"]],"0"],ME:["382","00","(?:20|[3-79]\\d)\\d{6}|80\\d{6,7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-9]"],"0$1"]],"0"],MF:["590","00","(?:590\\d|7090)\\d{5}|(?:69|80|9\\d)\\d{7}",[9],0,"0",0,0,0,0,0,[["590(?:0[079]|[14]3|[27][79]|3[03-7]|5[0-268]|87)\\d{4}"],["(?:69(?:0\\d\\d|1(?:2[2-9]|3[0-5])|4(?:0[89]|1[2-6]|9\\d)|6(?:1[016-9]|5[0-4]|[67]\\d))|7090[0-4])\\d{4}"],["80[0-5]\\d{6}"],0,0,0,0,0,["9(?:(?:39[5-7]|76[018])\\d|475[0-6])\\d{4}"]]],MG:["261","00","[23]\\d{8}",[9],[["(\\d{2})(\\d{2})(\\d{3})(\\d{2})","$1 $2 $3 $4",["[23]"],"0$1"]],"0",0,"([24-9]\\d{6})$|0","20$1"],MH:["692","011","329\\d{4}|(?:[256]\\d|45)\\d{5}",[7],[["(\\d{3})(\\d{4})","$1-$2",["[2-6]"]]],"1"],MK:["389","00","[2-578]\\d{7}",[8],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["2|34[47]|4(?:[37]7|5[47]|64)"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[347]"],"0$1"],["(\\d{3})(\\d)(\\d{2})(\\d{2})","$1 $2 $3 $4",["[58]"],"0$1"]],"0"],ML:["223","00","[24-9]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[24-9]"]]]],MM:["95","00","1\\d{5,7}|95\\d{6}|(?:[4-7]|9[0-46-9])\\d{6,8}|(?:2|8\\d)\\d{5,8}",[6,7,8,9,10],[["(\\d)(\\d{2})(\\d{3})","$1 $2 $3",["16|2"],"0$1"],["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["4(?:[2-46]|5[3-5])|5|6(?:[1-689]|7[235-7])|7(?:[0-4]|5[2-7])|8[1-5]|(?:60|86)[23]"],"0$1"],["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["[12]|452|678|86","[12]|452|6788|86"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[4-7]|8[1-35]"],"0$1"],["(\\d)(\\d{3})(\\d{4,6})","$1 $2 $3",["9(?:2[0-4]|[35-9]|4[137-9])"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["2"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"],"0$1"],["(\\d)(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["92"],"0$1"],["(\\d)(\\d{5})(\\d{4})","$1 $2 $3",["9"],"0$1"]],"0"],MN:["976","001","[12]\\d{7,9}|[5-9]\\d{7}",[8,9,10],[["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["[12]1"],"0$1"],["(\\d{4})(\\d{4})","$1 $2",["[5-9]"]],["(\\d{3})(\\d{5,6})","$1 $2",["[12]2[1-3]"],"0$1"],["(\\d{4})(\\d{5,6})","$1 $2",["[12](?:27|3[2-8]|4[2-68]|5[1-4689])","[12](?:27|3[2-8]|4[2-68]|5[1-4689])[0-3]"],"0$1"],["(\\d{5})(\\d{4,5})","$1 $2",["[12]"],"0$1"]],"0"],MO:["853","00","0800\\d{3}|(?:28|[68]\\d)\\d{6}",[7,8],[["(\\d{4})(\\d{3})","$1 $2",["0"]],["(\\d{4})(\\d{4})","$1 $2",["[268]"]]]],MP:["1","011","[58]\\d{9}|(?:67|90)0\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","670$1",0,"670"],MQ:["596","00","(?:596\\d|7091)\\d{5}|(?:69|[89]\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-79]|8(?:0[6-9]|[36])"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0"],MR:["222","00","(?:[2-4]\\d\\d|800)\\d{5}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-48]"]]]],MS:["1","011","(?:[58]\\d\\d|664|900)\\d{7}",[10],0,"1",0,"([34]\\d{6})$|1","664$1",0,"664"],MT:["356","00","3550\\d{4}|(?:[2579]\\d\\d|800)\\d{5}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[2357-9]"]]]],MU:["230","0(?:0|[24-7]0|3[03])","(?:[57]|8\\d\\d)\\d{7}|[2-468]\\d{6}",[7,8,10],[["(\\d{3})(\\d{4})","$1 $2",["[2-46]|8[013]"]],["(\\d{4})(\\d{4})","$1 $2",["[57]"]],["(\\d{5})(\\d{5})","$1 $2",["8"]]],0,0,0,0,0,0,0,"020"],MV:["960","0(?:0|19)","(?:800|9[0-57-9]\\d)\\d{7}|[34679]\\d{6}",[7,10],[["(\\d{3})(\\d{4})","$1-$2",["[34679]"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[89]"]]],0,0,0,0,0,0,0,"00"],MW:["265","00","(?:[1289]\\d|31|77)\\d{7}|1\\d{6}",[7,9],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["1[2-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["2"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[137-9]"],"0$1"]],"0"],MX:["52","0[09]","[2-9]\\d{9}",[10],[["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["33|5[56]|81"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[2-9]"]]],0,0,0,0,0,0,0,"00"],MY:["60","00","1\\d{8,9}|(?:3\\d|[4-9])\\d{7}",[8,9,10],[["(\\d)(\\d{3})(\\d{4})","$1-$2 $3",["[4-79]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1-$2 $3",["1(?:[02469]|[378][1-9]|53)|8","1(?:[02469]|[37][1-9]|53|8(?:[1-46-9]|5[7-9]))|8"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1-$2 $3",["3"],"0$1"],["(\\d)(\\d{3})(\\d{2})(\\d{4})","$1-$2-$3-$4",["1(?:[367]|80)"]],["(\\d{3})(\\d{3})(\\d{4})","$1-$2 $3",["15"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1-$2 $3",["1"],"0$1"]],"0"],MZ:["258","00","(?:2|8\\d)\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["2|8[2-79]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"]]]],NA:["264","00","[68]\\d{7,8}",[8,9],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["88"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["6"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["87"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["8"],"0$1"]],"0"],NC:["687","00","(?:050|[2-57-9]\\d\\d)\\d{3}",[6],[["(\\d{2})(\\d{2})(\\d{2})","$1.$2.$3",["[02-57-9]"]]]],NE:["227","00","[027-9]\\d{7}",[8],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["08"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[089]|2[013]|7[0467]"]]]],NF:["672","00","[13]\\d{5}",[6],[["(\\d{2})(\\d{4})","$1 $2",["1[0-3]"]],["(\\d)(\\d{5})","$1 $2",["[13]"]]],0,0,"([0-258]\\d{4})$","3$1"],NG:["234","009","(?:20|9\\d)\\d{8}|[78]\\d{9,13}",[10,11,12,13,14],[["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["[7-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["20[129]"],"0$1"],["(\\d{4})(\\d{2})(\\d{4})","$1 $2 $3",["2"],"0$1"],["(\\d{3})(\\d{4})(\\d{4,5})","$1 $2 $3",["[78]"],"0$1"],["(\\d{3})(\\d{5})(\\d{5,6})","$1 $2 $3",["[78]"],"0$1"]],"0"],NI:["505","00","(?:1800|[25-8]\\d{3})\\d{4}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[125-8]"]]]],NL:["31","00","(?:[124-7]\\d\\d|3(?:[02-9]\\d|1[0-8]))\\d{6}|8\\d{6,9}|9\\d{6,10}|1\\d{4,5}",[5,6,7,8,9,10,11],[["(\\d{3})(\\d{4,7})","$1 $2",["[89]0"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["66"],"0$1"],["(\\d)(\\d{8})","$1 $2",["6"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["1[16-8]|2[259]|3[124]|4[17-9]|5[124679]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[1-578]|91"],"0$1"],["(\\d{3})(\\d{3})(\\d{5})","$1 $2 $3",["9"],"0$1"]],"0"],NO:["47","00","(?:0|[2-9]\\d{3})\\d{4}",[5,8],[["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["8"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-79]"]]],0,0,0,0,0,"[02-689]|7[0-8]"],NP:["977","00","(?:1\\d|9)\\d{9}|[1-9]\\d{7}",[8,10,11],[["(\\d)(\\d{7})","$1-$2",["1[2-6]"],"0$1"],["(\\d{2})(\\d{6})","$1-$2",["1[01]|[2-8]|9(?:[1-59]|[67][2-6])"],"0$1"],["(\\d{3})(\\d{7})","$1-$2",["9"]]],"0"],NR:["674","00","(?:222|444|(?:55|8\\d)\\d|666|777|999)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[24-9]"]]]],NU:["683","00","(?:[4-7]|888\\d)\\d{3}",[4,7],[["(\\d{3})(\\d{4})","$1 $2",["8"]]]],NZ:["64","0(?:0|161)","[1289]\\d{9}|50\\d{5}(?:\\d{2,3})?|[27-9]\\d{7,8}|(?:[34]\\d|6[0-35-9])\\d{6}|8\\d{4,6}",[5,6,7,8,9,10],[["(\\d{2})(\\d{3,8})","$1 $2",["8[1-79]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2,3})","$1 $2 $3",["50[036-8]|8|90","50(?:[0367]|88)|8|90"],"0$1"],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["24|[346]|7[2-57-9]|9[2-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["2(?:10|74)|[589]"],"0$1"],["(\\d{2})(\\d{3,4})(\\d{4})","$1 $2 $3",["1|2[028]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,5})","$1 $2 $3",["2(?:[169]|7[0-35-9])|7"],"0$1"]],"0",0,0,0,0,0,0,"00"],OM:["968","00","(?:1505|[279]\\d{3}|500)\\d{4}|800\\d{5,6}",[7,8,9],[["(\\d{3})(\\d{4,6})","$1 $2",["[58]"]],["(\\d{2})(\\d{6})","$1 $2",["2"]],["(\\d{4})(\\d{4})","$1 $2",["[179]"]]]],PA:["507","00","(?:00800|8\\d{3})\\d{6}|[68]\\d{7}|[1-57-9]\\d{6}",[7,8,10,11],[["(\\d{3})(\\d{4})","$1-$2",["[1-57-9]"]],["(\\d{4})(\\d{4})","$1-$2",["[68]"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"]]]],PE:["51","00|19(?:1[124]|77|90)00","(?:[14-8]|9\\d)\\d{7}",[8,9],[["(\\d{3})(\\d{5})","$1 $2",["80"],"(0$1)"],["(\\d)(\\d{7})","$1 $2",["1"],"(0$1)"],["(\\d{2})(\\d{6})","$1 $2",["[4-8]"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["9"]]],"0",0,0,0,0,0,0,"00"," Anexo "],PF:["689","00","4\\d{5}(?:\\d{2})?|8\\d{7,8}",[6,8,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["44"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["4|8[7-9]"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"]]]],PG:["675","00|140[1-3]","(?:180|[78]\\d{3})\\d{4}|(?:[2-589]\\d|64)\\d{5}",[7,8],[["(\\d{3})(\\d{4})","$1 $2",["18|[2-69]|85"]],["(\\d{4})(\\d{4})","$1 $2",["[78]"]]],0,0,0,0,0,0,0,"00"],PH:["63","00","(?:[2-7]|9\\d)\\d{8}|2\\d{5}|(?:1800|8)\\d{7,9}",[6,8,9,10,11,12,13],[["(\\d)(\\d{5})","$1 $2",["2"],"(0$1)"],["(\\d{4})(\\d{4,6})","$1 $2",["3(?:23|39|46)|4(?:2[3-6]|[35]9|4[26]|76)|544|88[245]|(?:52|64|86)2","3(?:230|397|461)|4(?:2(?:35|[46]4|51)|396|4(?:22|63)|59[347]|76[15])|5(?:221|446)|642[23]|8(?:622|8(?:[24]2|5[13]))"],"(0$1)"],["(\\d{5})(\\d{4})","$1 $2",["346|4(?:27|9[35])|883","3469|4(?:279|9(?:30|56))|8834"],"(0$1)"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["2"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[3-7]|8[2-8]"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[89]"],"0$1"],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]],["(\\d{4})(\\d{1,2})(\\d{3})(\\d{4})","$1 $2 $3 $4",["1"]]],"0"],PK:["92","00","122\\d{6}|[24-8]\\d{10,11}|9(?:[013-9]\\d{8,10}|2(?:[01]\\d\\d|2(?:[06-8]\\d|1[01]))\\d{7})|(?:[2-8]\\d{3}|92(?:[0-7]\\d|8[1-9]))\\d{6}|[24-9]\\d{8}|[89]\\d{7}",[8,9,10,11,12],[["(\\d{3})(\\d{3})(\\d{2,7})","$1 $2 $3",["[89]0"],"0$1"],["(\\d{4})(\\d{5})","$1 $2",["1"]],["(\\d{3})(\\d{6,7})","$1 $2",["2(?:3[2358]|4[2-4]|9[2-8])|45[3479]|54[2-467]|60[468]|72[236]|8(?:2[2-689]|3[23578]|4[3478]|5[2356])|9(?:2[2-8]|3[27-9]|4[2-6]|6[3569]|9[25-8])","9(?:2[3-8]|98)|(?:2(?:3[2358]|4[2-4]|9[2-8])|45[3479]|54[2-467]|60[468]|72[236]|8(?:2[2-689]|3[23578]|4[3478]|5[2356])|9(?:22|3[27-9]|4[2-6]|6[3569]|9[25-7]))[2-9]"],"(0$1)"],["(\\d{2})(\\d{7,8})","$1 $2",["(?:2[125]|4[0-246-9]|5[1-35-7]|6[1-8]|7[14]|8[16]|91)[2-9]"],"(0$1)"],["(\\d{5})(\\d{5})","$1 $2",["58"],"(0$1)"],["(\\d{3})(\\d{7})","$1 $2",["3"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["2[125]|4[0-246-9]|5[1-35-7]|6[1-8]|7[14]|8[16]|91"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["[24-9]"],"(0$1)"]],"0"],PL:["48","00","(?:6|8\\d\\d)\\d{7}|[1-9]\\d{6}(?:\\d{2})?|[26]\\d{5}",[6,7,8,9,10],[["(\\d{5})","$1",["19"]],["(\\d{3})(\\d{3})","$1 $2",["11|20|64"]],["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["(?:1[2-8]|2[2-69]|3[2-4]|4[1-468]|5[24-689]|6[1-3578]|7[14-7]|8[1-79]|9[145])1","(?:1[2-8]|2[2-69]|3[2-4]|4[1-468]|5[24-689]|6[1-3578]|7[14-7]|8[1-79]|9[145])19"]],["(\\d{3})(\\d{2})(\\d{2,3})","$1 $2 $3",["64"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["21|39|45|5[0137]|6[0469]|7[02389]|8(?:0[14]|8)"]],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1[2-8]|[2-7]|8[1-79]|9[145]"]],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["8"]]]],PM:["508","00","[45]\\d{5}|(?:708|8\\d\\d)\\d{6}",[6,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["[45]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["7"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0"],PR:["1","011","(?:[589]\\d\\d|787)\\d{7}",[10],0,"1",0,0,0,0,"787|939"],PS:["970","00","[2489]2\\d{6}|(?:1\\d|5)\\d{8}",[8,9,10],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[2489]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["5"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]]],"0"],PT:["351","00","1693\\d{5}|(?:[26-9]\\d|30)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["2[12]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["16|[236-9]"]]]],PW:["680","01[12]","(?:[24-8]\\d\\d|345|900)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-9]"]]]],PY:["595","00","59\\d{4,6}|9\\d{5,10}|(?:[2-46-8]\\d|5[0-8])\\d{4,7}",[6,7,8,9,10,11],[["(\\d{3})(\\d{3,6})","$1 $2",["[2-9]0"],"0$1"],["(\\d{2})(\\d{5})","$1 $2",["[26]1|3[289]|4[1246-8]|7[1-3]|8[1-36]"],"(0$1)"],["(\\d{3})(\\d{4,5})","$1 $2",["2[279]|3[13-5]|4[359]|5|6(?:[34]|7[1-46-8])|7[46-8]|85"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["2[14-68]|3[26-9]|4[1246-8]|6(?:1|75)|7[1-35]|8[1-36]"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["87"]],["(\\d{3})(\\d{6})","$1 $2",["9(?:[5-79]|8[1-7])"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[2-8]"],"0$1"],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["9"]]],"0"],QA:["974","00","800\\d{4}|(?:2|800)\\d{6}|(?:0080|[3-7])\\d{7}",[7,8,9,11],[["(\\d{3})(\\d{4})","$1 $2",["2[136]|8"]],["(\\d{4})(\\d{4})","$1 $2",["[3-7]"]]]],RE:["262","00","709\\d{6}|(?:26|[689]\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[26-9]"],"0$1"]],"0",0,0,0,0,0,[["26(?:2\\d\\d|3(?:0\\d|1[0-6]))\\d{4}"],["(?:69(?:2\\d\\d|3(?:[06][0-6]|1[0-3]|2[0-2]|3[0-39]|4\\d|5[0-5]|7[0-37]|8[0-8]|9[0-479]))|7092[0-3])\\d{4}"],["80\\d{7}"],["89[1-37-9]\\d{6}"],0,0,0,0,["9(?:399[0-3]|479[0-6]|76(?:2[278]|3[0-37]))\\d{4}"],["8(?:1[019]|2[0156]|84|90)\\d{6}"]]],RO:["40","00","(?:[236-8]\\d|90)\\d{7}|[23]\\d{5}",[6,9],[["(\\d{3})(\\d{3})","$1 $2",["2[3-6]","2[3-6]\\d9"],"0$1"],["(\\d{2})(\\d{4})","$1 $2",["219|31"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[23]1"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[236-9]"],"0$1"]],"0",0,0,0,0,0,0,0," int "],RS:["381","00","38[02-9]\\d{6,9}|6\\d{7,9}|90\\d{4,8}|38\\d{5,6}|(?:7\\d\\d|800)\\d{3,9}|(?:[12]\\d|3[0-79])\\d{5,10}",[6,7,8,9,10,11,12],[["(\\d{3})(\\d{3,9})","$1 $2",["(?:2[389]|39)0|[7-9]"],"0$1"],["(\\d{2})(\\d{5,10})","$1 $2",["[1-36]"],"0$1"]],"0"],RU:["7","810","8\\d{13}|[347-9]\\d{9}",[10,14],[["(\\d{4})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["7(?:1[0-8]|2[1-9])","7(?:1(?:[0-356]2|4[29]|7|8[27])|2(?:1[23]|[2-9]2))","7(?:1(?:[0-356]2|4[29]|7|8[27])|2(?:13[03-69]|62[013-9]))|72[1-57-9]2"],"8 ($1)",1],["(\\d{5})(\\d)(\\d{2})(\\d{2})","$1 $2 $3 $4",["7(?:1[0-68]|2[1-9])","7(?:1(?:[06][3-6]|[18]|2[35]|[3-5][3-5])|2(?:[13][3-5]|[24-689]|7[457]))","7(?:1(?:0(?:[356]|4[023])|[18]|2(?:3[013-9]|5)|3[45]|43[013-79]|5(?:3[1-8]|4[1-7]|5)|6(?:3[0-35-9]|[4-6]))|2(?:1(?:3[178]|[45])|[24-689]|3[35]|7[457]))|7(?:14|23)4[0-8]|71(?:33|45)[1-79]"],"8 ($1)",1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"8 ($1)",1],["(\\d{3})(\\d{3})(\\d{2})(\\d{2})","$1 $2-$3-$4",["[349]|8(?:[02-7]|1[1-8])"],"8 ($1)",1],["(\\d{4})(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3 $4",["8"],"8 ($1)"]],"8",0,0,0,0,"3[04-689]|[489]",0,"8~10"],RW:["250","00","(?:06|[27]\\d\\d|[89]00)\\d{6}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["0"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["2"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[7-9]"],"0$1"]],"0"],SA:["966","00","92\\d{7}|(?:[15]|8\\d)\\d{8}",[9,10],[["(\\d{4})(\\d{5})","$1 $2",["9"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["5"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["81"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"]]],"0"],SB:["677","0[01]","[6-9]\\d{6}|[1-6]\\d{4}",[5,7],[["(\\d{2})(\\d{5})","$1 $2",["6[89]|7|8[4-9]|9(?:[1-8]|9[0-8])"]]]],SC:["248","010|0[0-2]","(?:[2489]\\d|64)\\d{5}",[7],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[246]|9[57]"]]],0,0,0,0,0,0,0,"00"],SD:["249","00","[19]\\d{8}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[19]"],"0$1"]],"0"],SE:["46","00","(?:[26]\\d\\d|9)\\d{9}|[1-9]\\d{8}|[1-689]\\d{7}|[1-4689]\\d{6}|2\\d{5}",[6,7,8,9,10,12],[["(\\d{2})(\\d{2,3})(\\d{2})","$1-$2 $3",["20"],"0$1",0,"$1 $2 $3"],["(\\d{3})(\\d{4})","$1-$2",["9(?:00|39|44|9)"],"0$1",0,"$1 $2"],["(\\d{2})(\\d{3})(\\d{2})","$1-$2 $3",["[12][136]|3[356]|4[0246]|6[03]|90[1-9]"],"0$1",0,"$1 $2 $3"],["(\\d)(\\d{2,3})(\\d{2})(\\d{2})","$1-$2 $3 $4",["8"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2,3})(\\d{2})","$1-$2 $3",["1[2457]|2(?:[247-9]|5[0138])|3[0247-9]|4[1357-9]|5[0-35-9]|6(?:[125689]|4[02-57]|7[0-2])|9(?:[125-8]|3[02-5]|4[0-3])"],"0$1",0,"$1 $2 $3"],["(\\d{3})(\\d{2,3})(\\d{3})","$1-$2 $3",["9(?:00|39|44)"],"0$1",0,"$1 $2 $3"],["(\\d{2})(\\d{2,3})(\\d{2})(\\d{2})","$1-$2 $3 $4",["1[13689]|2[0136]|3[1356]|4[0246]|54|6[03]|90[1-9]"],"0$1",0,"$1 $2 $3 $4"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1-$2 $3 $4",["10|7"],"0$1",0,"$1 $2 $3 $4"],["(\\d)(\\d{3})(\\d{3})(\\d{2})","$1-$2 $3 $4",["8"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1-$2 $3 $4",["[13-5]|2(?:[247-9]|5[0138])|6(?:[124-689]|7[0-2])|9(?:[125-8]|3[02-5]|4[0-3])"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2})(\\d{2})(\\d{3})","$1-$2 $3 $4",["9"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1-$2 $3 $4 $5",["[26]"],"0$1",0,"$1 $2 $3 $4 $5"]],"0"],SG:["65","0[0-3]\\d","(?:(?:1\\d|8)\\d\\d|7000)\\d{7}|[3689]\\d{7}",[8,10,11],[["(\\d{4})(\\d{4})","$1 $2",["[369]|8(?:0[1-9]|[1-9])"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"]],["(\\d{4})(\\d{4})(\\d{3})","$1 $2 $3",["7"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]]]],SH:["290","00","(?:[256]\\d|8)\\d{3}",[4,5],0,0,0,0,0,0,"[256]"],SI:["386","00|10(?:22|66|88|99)","[1-7]\\d{7}|8\\d{4,7}|90\\d{4,6}",[5,6,7,8],[["(\\d{2})(\\d{3,6})","$1 $2",["8[09]|9"],"0$1"],["(\\d{3})(\\d{5})","$1 $2",["59|8"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[37][01]|4[0139]|51|6"],"0$1"],["(\\d)(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[1-57]"],"(0$1)"]],"0",0,0,0,0,0,0,"00"],SJ:["47","00","0\\d{4}|(?:[489]\\d|79)\\d{6}",[5,8],0,0,0,0,0,0,"79"],SK:["421","00","[2-689]\\d{8}|[2-59]\\d{6}|[2-5]\\d{5}",[6,7,9],[["(\\d)(\\d{2})(\\d{3,4})","$1 $2 $3",["21"],"0$1"],["(\\d{2})(\\d{2})(\\d{2,3})","$1 $2 $3",["[3-5][1-8]1","[3-5][1-8]1[67]"],"0$1"],["(\\d)(\\d{3})(\\d{3})(\\d{2})","$1/$2 $3 $4",["2"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[689]"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1/$2 $3 $4",["[3-5]"],"0$1"]],"0"],SL:["232","00","(?:[237-9]\\d|66)\\d{6}",[8],[["(\\d{2})(\\d{6})","$1 $2",["[236-9]"],"(0$1)"]],"0"],SM:["378","00","(?:0549|[5-7]\\d)\\d{6}",[8,10],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-7]"]],["(\\d{4})(\\d{6})","$1 $2",["0"]]],0,0,"([89]\\d{5})$","0549$1"],SN:["221","00","(?:[378]\\d|93)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"]],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[379]"]]]],SO:["252","00","[346-9]\\d{8}|[12679]\\d{7}|[1-5]\\d{6}|[1348]\\d{5}",[6,7,8,9],[["(\\d{2})(\\d{4})","$1 $2",["8[125]"]],["(\\d{6})","$1",["[134]"]],["(\\d)(\\d{6})","$1 $2",["[15]|2[0-79]|3[0-46-8]|4[0-7]"]],["(\\d)(\\d{7})","$1 $2",["(?:2|90)4|[67]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[348]|64|79|90"]],["(\\d{2})(\\d{5,7})","$1 $2",["1|28|6[0-35-9]|7[67]|9[2-9]"]]],"0"],SR:["597","00","(?:[2-5]|68|[78]\\d|90)\\d{5}",[6,7],[["(\\d{2})(\\d{2})(\\d{2})","$1-$2-$3",["56"]],["(\\d{3})(\\d{3})","$1-$2",["[2-5]"]],["(\\d{3})(\\d{4})","$1-$2",["[6-9]"]]]],SS:["211","00","[19]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[19]"],"0$1"]],"0"],ST:["239","00","(?:22|9\\d)\\d{5}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[29]"]]]],SV:["503","00","[267]\\d{7}|(?:80\\d|900)\\d{4}(?:\\d{4})?",[7,8,11],[["(\\d{3})(\\d{4})","$1 $2",["[89]"]],["(\\d{4})(\\d{4})","$1 $2",["[267]"]],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["[89]"]]]],SX:["1","011","7215\\d{6}|(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"(5\\d{6})$|1","721$1",0,"721"],SY:["963","00","[1-39]\\d{8}|[1-5]\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-5]"],"0$1",1],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["9"],"0$1",1]],"0"],SZ:["268","00","0800\\d{4}|(?:[237]\\d|900)\\d{6}",[8,9],[["(\\d{4})(\\d{4})","$1 $2",["[0237]"]],["(\\d{5})(\\d{4})","$1 $2",["9"]]]],TA:["290","00","8\\d{3}",[4],0,0,0,0,0,0,"8"],TC:["1","011","(?:[58]\\d\\d|649|900)\\d{7}",[10],0,"1",0,"([2-479]\\d{6})$|1","649$1",0,"649"],TD:["235","00|16","(?:22|[689]\\d|77)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[26-9]"]]],0,0,0,0,0,0,0,"00"],TG:["228","00","[279]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[279]"]]]],TH:["66","00[1-9]","(?:001800|[2-57]|[689]\\d)\\d{7}|1\\d{7,9}",[8,9,10,13],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[13-9]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]]],"0"],TJ:["992","810","[0-57-9]\\d{8}",[9],[["(\\d{6})(\\d)(\\d{2})","$1 $2 $3",["331","3317"]],["(\\d{3})(\\d{2})(\\d{4})","$1 $2 $3",["44[02-479]|[34]7"]],["(\\d{4})(\\d)(\\d{4})","$1 $2 $3",["3(?:[1245]|3[12])"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[0-57-9]"]]],0,0,0,0,0,0,0,"8~10"],TK:["690","00","[2-47]\\d{3,6}",[4,5,6,7]],TL:["670","00","7\\d{7}|(?:[2-47]\\d|[89]0)\\d{5}",[7,8],[["(\\d{3})(\\d{4})","$1 $2",["[2-489]|70"]],["(\\d{4})(\\d{4})","$1 $2",["7"]]]],TM:["993","810","(?:[1-6]\\d|71)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2-$3-$4",["12"],"(8 $1)"],["(\\d{3})(\\d)(\\d{2})(\\d{2})","$1 $2-$3-$4",["[1-5]"],"(8 $1)"],["(\\d{2})(\\d{6})","$1 $2",["[67]"],"8 $1"]],"8",0,0,0,0,0,0,"8~10"],TN:["216","00","[2-57-9]\\d{7}",[8],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[2-57-9]"]]]],TO:["676","00","(?:0800|(?:[5-8]\\d\\d|999)\\d)\\d{3}|[2-8]\\d{4}",[5,7],[["(\\d{2})(\\d{3})","$1-$2",["[2-4]|50|6[09]|7[0-24-69]|8[05]"]],["(\\d{4})(\\d{3})","$1 $2",["0"]],["(\\d{3})(\\d{4})","$1 $2",["[5-9]"]]]],TR:["90","00","4\\d{6}|8\\d{11,12}|(?:[2-58]\\d\\d|900)\\d{7}",[7,10,12,13],[["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["512|8[01589]|90"],"0$1",1],["(\\d{3})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["5(?:[0-59]|61)","5(?:[0-59]|61[06])","5(?:[0-59]|61[06]1)"],"0$1",1],["(\\d{3})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[24][1-8]|3[1-9]"],"(0$1)",1],["(\\d{3})(\\d{3})(\\d{6,7})","$1 $2 $3",["80"],"0$1",1]],"0"],TT:["1","011","(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-46-8]\\d{6})$|1","868$1",0,"868"],TV:["688","00","(?:2|7\\d\\d|90)\\d{4}",[5,6,7],[["(\\d{2})(\\d{3})","$1 $2",["2"]],["(\\d{2})(\\d{4})","$1 $2",["90"]],["(\\d{2})(\\d{5})","$1 $2",["7"]]]],TW:["886","0(?:0[25-79]|19)","[2-689]\\d{8}|7\\d{9,10}|[2-8]\\d{7}|2\\d{6}",[7,8,9,10,11],[["(\\d{2})(\\d)(\\d{4})","$1 $2 $3",["202"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[258]0"],"0$1"],["(\\d)(\\d{3,4})(\\d{4})","$1 $2 $3",["[23568]|4(?:0[02-48]|[1-47-9])|7[1-9]","[23568]|4(?:0[2-48]|[1-47-9])|(?:400|7)[1-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[49]"],"0$1"],["(\\d{2})(\\d{4})(\\d{4,5})","$1 $2 $3",["7"],"0$1"]],"0",0,0,0,0,0,0,0,"#"],TZ:["255","00[056]","(?:[25-8]\\d|41|90)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{4})","$1 $2 $3",["[89]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[24]"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["5"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[67]"],"0$1"]],"0"],UA:["380","00","[89]\\d{9}|[3-9]\\d{8}",[9,10],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6[12][29]|(?:3[1-8]|4[136-8]|5[12457]|6[49])2|(?:56|65)[24]","6[12][29]|(?:35|4[1378]|5[12457]|6[49])2|(?:56|65)[24]|(?:3[1-46-8]|46)2[013-9]"],"0$1"],["(\\d{4})(\\d{5})","$1 $2",["3[1-8]|4(?:[1367]|[45][6-9]|8[4-6])|5(?:[1-5]|6[0135689]|7[4-6])|6(?:[12][3-7]|[459])","3[1-8]|4(?:[1367]|[45][6-9]|8[4-6])|5(?:[1-5]|6(?:[015689]|3[02389])|7[4-6])|6(?:[12][3-7]|[459])"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[3-7]|89|9[1-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["[89]"],"0$1"]],"0",0,0,0,0,0,0,"0~0"],UG:["256","00[057]","800\\d{6}|(?:[29]0|[347]\\d)\\d{7}",[9],[["(\\d{4})(\\d{5})","$1 $2",["202","2024"],"0$1"],["(\\d{3})(\\d{6})","$1 $2",["[27-9]|4(?:6[45]|[7-9])"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["[34]"],"0$1"]],"0"],US:["1","011","[2-9]\\d{9}|3\\d{6}",[10],[["(\\d{3})(\\d{4})","$1-$2",["310"],0,1],["(\\d{3})(\\d{3})(\\d{4})","($1) $2-$3",["[2-9]"],0,1,"$1-$2-$3"]],"1",0,0,0,0,0,[["(?:3052(?:0[0-8]|[1-9]\\d)|5056(?:[0-35-9]\\d|4[0-468]))\\d{4}|(?:2742|305[3-9]|472[247-9]|505[2-57-9]|983[2-47-9])\\d{6}|(?:2(?:0[1-35-9]|1[02-9]|2[03-57-9]|3[1459]|4[08]|5[1-46]|6[0279]|7[0269]|8[13])|3(?:0[1-47-9]|1[02-9]|2[0135-79]|3[0-24679]|4[167]|5[0-2]|6[01349]|8[056])|4(?:0[124-9]|1[02-579]|2[3-5]|3[0245]|4[023578]|58|6[349]|7[0589]|8[04])|5(?:0[1-47-9]|1[0235-8]|20|3[0149]|4[01]|5[179]|6[1-47]|7[0-5]|8[0256])|6(?:0[1-35-9]|1[024-9]|2[03689]|3[016]|4[0156]|5[01679]|6[0-279]|78|8[0-29])|7(?:0[1-46-8]|1[2-9]|2[04-8]|3[0-247]|4[037]|5[47]|6[02359]|7[0-59]|8[156])|8(?:0[1-68]|1[02-8]|2[0168]|3[0-2589]|4[03578]|5[046-9]|6[02-5]|7[028])|9(?:0[1346-9]|1[02-9]|2[0589]|3[0146-8]|4[01357-9]|5[12469]|7[0-389]|8[04-69]))[2-9]\\d{6}"],[""],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["900[2-9]\\d{6}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|33|44|66|77|88)[2-9]\\d{6}"],0,0,0,["305209\\d{4}"]]],UY:["598","0(?:0|1[3-9]\\d)","0004\\d{2,9}|[1249]\\d{7}|(?:[49]\\d|80)\\d{5}",[6,7,8,9,10,11,12,13],[["(\\d{3})(\\d{3,4})","$1 $2",["0"]],["(\\d{3})(\\d{4})","$1 $2",["[49]0|8"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["9"],"0$1"],["(\\d{4})(\\d{4})","$1 $2",["[124]"]],["(\\d{3})(\\d{3})(\\d{2,4})","$1 $2 $3",["0"]],["(\\d{3})(\\d{3})(\\d{3})(\\d{2,4})","$1 $2 $3 $4",["0"]]],"0",0,0,0,0,0,0,"00"," int. "],UZ:["998","00","(?:20|33|[5-9]\\d)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[235-9]"]]]],VA:["39","00","0\\d{5,10}|3[0-8]\\d{7,10}|55\\d{8}|8\\d{5}(?:\\d{2,4})?|(?:1\\d|39)\\d{7,8}",[6,7,8,9,10,11,12],0,0,0,0,0,0,"06698"],VC:["1","011","(?:[58]\\d\\d|784|900)\\d{7}",[10],0,"1",0,"([2-7]\\d{6})$|1","784$1",0,"784"],VE:["58","00","[68]00\\d{7}|(?:[24]\\d|[59]0)\\d{8}",[10],[["(\\d{3})(\\d{7})","$1-$2",["[24-689]"],"0$1"]],"0"],VG:["1","011","(?:284|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-578]\\d{6})$|1","284$1",0,"284"],VI:["1","011","[58]\\d{9}|(?:34|90)0\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","340$1",0,"340"],VN:["84","00","[12]\\d{9}|[135-9]\\d{8}|[16]\\d{7}|[16-8]\\d{6}",[7,8,9,10],[["(\\d{2})(\\d{5})","$1 $2",["80"],"0$1",1],["(\\d{4})(\\d{4,6})","$1 $2",["1"],0,1],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["6"],"0$1",1],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[357-9]"],"0$1",1],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["2[48]"],"0$1",1],["(\\d{3})(\\d{4})(\\d{3})","$1 $2 $3",["2"],"0$1",1]],"0"],VU:["678","00","[57-9]\\d{6}|(?:[238]\\d|48)\\d{3}",[5,7],[["(\\d{3})(\\d{4})","$1 $2",["[57-9]"]]]],WF:["681","00","(?:40|72|8\\d{4})\\d{4}|[89]\\d{5}",[6,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["[47-9]"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"]]]],WS:["685","0","(?:[2-6]|8\\d{5})\\d{4}|[78]\\d{6}|[68]\\d{5}",[5,6,7,10],[["(\\d{5})","$1",["[2-5]|6[1-9]"]],["(\\d{3})(\\d{3,7})","$1 $2",["[68]"]],["(\\d{2})(\\d{5})","$1 $2",["7"]]]],XK:["383","00","2\\d{7,8}|3\\d{7,11}|(?:4\\d\\d|[89]00)\\d{5}",[8,9,10,11,12],[["(\\d{3})(\\d{5})","$1 $2",["[89]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[2-4]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["2|39"],"0$1"],["(\\d{2})(\\d{7,10})","$1 $2",["3"],"0$1"]],"0"],YE:["967","00","(?:1|7\\d)\\d{7}|[1-7]\\d{6}",[7,8,9],[["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-6]|7(?:[24-6]|8[0-7])"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["7"],"0$1"]],"0"],YT:["262","00","7093\\d{5}|(?:80|9\\d)\\d{7}|(?:26|63)9\\d{6}",[9],0,"0",0,0,0,0,0,[["269(?:0[0-467]|15|5[0-4]|6\\d|[78]0)\\d{4}"],["(?:639(?:0[0-79]|1[019]|[267]\\d|3[09]|40|5[05-9]|9[04-79])|7093[5-7])\\d{4}"],["80\\d{7}"],0,0,0,0,0,["9(?:(?:39|47)8[01]|769\\d)\\d{4}"]]],ZA:["27","00","[1-79]\\d{8}|8\\d{4,9}",[5,6,7,8,9,10],[["(\\d{2})(\\d{3,4})","$1 $2",["8[1-4]"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,3})","$1 $2 $3",["8[1-4]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["860"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[1-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"],"0$1"]],"0"],ZM:["260","00","800\\d{6}|(?:21|[579]\\d|63)\\d{7}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[28]"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["[579]"],"0$1"]],"0"],ZW:["263","00","2(?:[0-57-9]\\d{6,8}|6[0-24-9]\\d{6,7})|[38]\\d{9}|[35-8]\\d{8}|[3-6]\\d{7}|[1-689]\\d{6}|[1-3569]\\d{5}|[1356]\\d{4}",[5,6,7,8,9,10],[["(\\d{3})(\\d{3,5})","$1 $2",["2(?:0[45]|2[278]|[49]8)|3(?:[09]8|17)|6(?:[29]8|37|75)|[23][78]|(?:33|5[15]|6[68])[78]"],"0$1"],["(\\d)(\\d{3})(\\d{2,4})","$1 $2 $3",["[49]"],"0$1"],["(\\d{3})(\\d{4})","$1 $2",["80"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["24|8[13-59]|(?:2[05-79]|39|5[45]|6[15-8])2","2(?:02[014]|4|[56]20|[79]2)|392|5(?:42|525)|6(?:[16-8]21|52[013])|8[13-59]"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["2(?:1[39]|2[0157]|[378]|[56][14])|3(?:12|29)","2(?:1[39]|2[0157]|[378]|[56][14])|3(?:123|29)"],"0$1"],["(\\d{4})(\\d{6})","$1 $2",["8"],"0$1"],["(\\d{2})(\\d{3,5})","$1 $2",["1|2(?:0[0-36-9]|12|29|[56])|3(?:1[0-689]|[24-6])|5(?:[0236-9]|1[2-4])|6(?:[013-59]|7[0-46-9])|(?:33|55|6[68])[0-69]|(?:29|3[09]|62)[0-79]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["29[013-9]|39|54"],"0$1"],["(\\d{4})(\\d{3,5})","$1 $2",["(?:25|54)8","258|5483"],"0$1"]],"0"]},nonGeographic:{800:["800",0,"(?:00|[1-9]\\d)\\d{6}",[8],[["(\\d{4})(\\d{4})","$1 $2",["\\d"]]],0,0,0,0,0,0,[0,0,["(?:00|[1-9]\\d)\\d{6}"]]],808:["808",0,"[1-9]\\d{7}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[1-9]"]]],0,0,0,0,0,0,[0,0,0,0,0,0,0,0,0,["[1-9]\\d{7}"]]],870:["870",0,"7\\d{11}|[235-7]\\d{8}",[9,12],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[235-7]"]]],0,0,0,0,0,0,[0,["(?:[356]|774[45])\\d{8}|7[6-8]\\d{7}"],0,0,0,0,0,0,["2\\d{8}",[9]]]],878:["878",0,"10\\d{10}",[12],[["(\\d{2})(\\d{5})(\\d{5})","$1 $2 $3",["1"]]],0,0,0,0,0,0,[0,0,0,0,0,0,0,0,["10\\d{10}"]]],881:["881",0,"6\\d{9}|[0-36-9]\\d{8}",[9,10],[["(\\d)(\\d{3})(\\d{5})","$1 $2 $3",["[0-37-9]"]],["(\\d)(\\d{3})(\\d{5,6})","$1 $2 $3",["6"]]],0,0,0,0,0,0,[0,["6\\d{9}|[0-36-9]\\d{8}"]]],882:["882",0,"[13]\\d{6}(?:\\d{2,5})?|[19]\\d{7}|(?:[25]\\d\\d|4)\\d{7}(?:\\d{2})?",[7,8,9,10,11,12],[["(\\d{2})(\\d{5})","$1 $2",["16|342"]],["(\\d{2})(\\d{6})","$1 $2",["49"]],["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["1[36]|9"]],["(\\d{2})(\\d{4})(\\d{3})","$1 $2 $3",["3[23]"]],["(\\d{2})(\\d{3,4})(\\d{4})","$1 $2 $3",["16"]],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["10|23|3(?:[15]|4[57])|4|51"]],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["34"]],["(\\d{2})(\\d{4,5})(\\d{5})","$1 $2 $3",["[1-35]"]]],0,0,0,0,0,0,[0,["342\\d{4}|(?:337|49)\\d{6}|(?:3(?:2|47|7\\d{3})|50\\d{3})\\d{7}",[7,8,9,10,12]],0,0,0,["348[57]\\d{7}",[11]],0,0,["1(?:3(?:0[0347]|[13][0139]|2[035]|4[013568]|6[0459]|7[06]|8[15-8]|9[0689])\\d{4}|6\\d{5,10})|(?:345\\d|9[89])\\d{6}|(?:10|2(?:3|85\\d)|3(?:[15]|[69]\\d\\d)|4[15-8]|51)\\d{8}"]]],883:["883",0,"(?:[1-4]\\d|51)\\d{6,10}",[8,9,10,11,12],[["(\\d{3})(\\d{3})(\\d{2,8})","$1 $2 $3",["[14]|2[24-689]|3[02-689]|51[24-9]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["510"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["21"]],["(\\d{4})(\\d{4})(\\d{4})","$1 $2 $3",["51[13]"]],["(\\d{3})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["[235]"]]],0,0,0,0,0,0,[0,0,0,0,0,0,0,0,["(?:2(?:00\\d\\d|10)|(?:370[1-9]|51\\d0)\\d)\\d{7}|51(?:00\\d{5}|[24-9]0\\d{4,7})|(?:1[0-79]|2[24-689]|3[02-689]|4[0-4])0\\d{5,9}"]]],888:["888",0,"\\d{11}",[11],[["(\\d{3})(\\d{3})(\\d{5})","$1 $2 $3"]],0,0,0,0,0,0,[0,0,0,0,0,0,["\\d{11}"]]],979:["979",0,"[1359]\\d{8}",[9],[["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["[1359]"]]],0,0,0,0,0,0,[0,0,0,["[1359]\\d{8}"]]]}};function r5(t,e){var n=Array.prototype.slice.call(e);return n.push(n5),t.apply(this,n)}function lg(t,e){t=t.split("-"),e=e.split("-");for(var n=t[0].split("."),r=e[0].split("."),i=0;i<3;i++){var o=Number(n[i]),a=Number(r[i]);if(o>a)return 1;if(a>o)return-1;if(!isNaN(o)&&isNaN(a))return 1;if(isNaN(o)&&!isNaN(a))return-1}return t[1]&&e[1]?t[1]>e[1]?1:t[1]<e[1]?-1:0:!t[1]&&e[1]?1:t[1]&&!e[1]?-1:0}var i5={}.constructor;function Ti(t){return t!=null&&t.constructor===i5}function Wd(t){"@babel/helpers - typeof";return Wd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Wd(t)}function Nl(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o5(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function Cl(t,e,n){return e&&o5(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}var s5="1.2.0",a5="1.7.35",ug=" ext. ",c5=/^\d+$/,vt=function(){function t(e){Nl(this,t),q1(e),this.metadata=e,V1.call(this,e)}return Cl(t,[{key:"getCountries",value:function(){return Object.keys(this.metadata.countries).filter(function(n){return n!=="001"})}},{key:"getCountryMetadata",value:function(n){return this.metadata.countries[n]}},{key:"nonGeographic",value:function(){if(!(this.v1||this.v2||this.v3))return this.metadata.nonGeographic||this.metadata.nonGeographical}},{key:"hasCountry",value:function(n){return this.getCountryMetadata(n)!==void 0}},{key:"hasCallingCode",value:function(n){if(this.getCountryCodesForCallingCode(n))return!0;if(this.nonGeographic()){if(this.nonGeographic()[n])return!0}else{var r=this.countryCallingCodes()[n];if(r&&r.length===1&&r[0]==="001")return!0}}},{key:"isNonGeographicCallingCode",value:function(n){return this.nonGeographic()?!!this.nonGeographic()[n]:!this.getCountryCodesForCallingCode(n)}},{key:"country",value:function(n){return this.selectNumberingPlan(n)}},{key:"selectNumberingPlan",value:function(n,r){if(n&&c5.test(n)&&(r=n,n=null),n&&n!=="001"){if(!this.hasCountry(n))throw new Error("Unknown country: ".concat(n));this.numberingPlan=new dg(this.getCountryMetadata(n),this)}else if(r){if(!this.hasCallingCode(r))throw new Error("Unknown calling code: ".concat(r));this.numberingPlan=new dg(this.getNumberingPlanMetadata(r),this)}else this.numberingPlan=void 0;return this}},{key:"getCountryCodesForCallingCode",value:function(n){var r=this.countryCallingCodes()[n];if(r)return r.length===1&&r[0].length===3?void 0:r}},{key:"getCountryCodeForCallingCode",value:function(n){var r=this.getCountryCodesForCallingCode(n);if(r)return r[0]}},{key:"getNumberingPlanMetadata",value:function(n){var r=this.getCountryCodeForCallingCode(n);if(r)return this.getCountryMetadata(r);if(this.nonGeographic()){var i=this.nonGeographic()[n];if(i)return i}else{var o=this.countryCallingCodes()[n];if(o&&o.length===1&&o[0]==="001")return this.metadata.countries["001"]}}},{key:"countryCallingCode",value:function(){return this.numberingPlan.callingCode()}},{key:"IDDPrefix",value:function(){return this.numberingPlan.IDDPrefix()}},{key:"defaultIDDPrefix",value:function(){return this.numberingPlan.defaultIDDPrefix()}},{key:"nationalNumberPattern",value:function(){return this.numberingPlan.nationalNumberPattern()}},{key:"possibleLengths",value:function(){return this.numberingPlan.possibleLengths()}},{key:"formats",value:function(){return this.numberingPlan.formats()}},{key:"nationalPrefixForParsing",value:function(){return this.numberingPlan.nationalPrefixForParsing()}},{key:"nationalPrefixTransformRule",value:function(){return this.numberingPlan.nationalPrefixTransformRule()}},{key:"leadingDigits",value:function(){return this.numberingPlan.leadingDigits()}},{key:"hasTypes",value:function(){return this.numberingPlan.hasTypes()}},{key:"type",value:function(n){return this.numberingPlan.type(n)}},{key:"ext",value:function(){return this.numberingPlan.ext()}},{key:"countryCallingCodes",value:function(){return this.v1?this.metadata.country_phone_code_to_countries:this.metadata.country_calling_codes}},{key:"chooseCountryByCountryCallingCode",value:function(n){return this.selectNumberingPlan(n)}},{key:"hasSelectedNumberingPlan",value:function(){return this.numberingPlan!==void 0}}]),t}(),dg=function(){function t(e,n){Nl(this,t),this.globalMetadataObject=n,this.metadata=e,V1.call(this,n.metadata)}return Cl(t,[{key:"callingCode",value:function(){return this.metadata[0]}},{key:"getDefaultCountryMetadataForRegion",value:function(){return this.globalMetadataObject.getNumberingPlanMetadata(this.callingCode())}},{key:"IDDPrefix",value:function(){if(!(this.v1||this.v2))return this.metadata[1]}},{key:"defaultIDDPrefix",value:function(){if(!(this.v1||this.v2))return this.metadata[12]}},{key:"nationalNumberPattern",value:function(){return this.v1||this.v2?this.metadata[1]:this.metadata[2]}},{key:"possibleLengths",value:function(){if(!this.v1)return this.metadata[this.v2?2:3]}},{key:"_getFormats",value:function(n){return n[this.v1?2:this.v2?3:4]}},{key:"formats",value:function(){var n=this,r=this._getFormats(this.metadata)||this._getFormats(this.getDefaultCountryMetadataForRegion())||[];return r.map(function(i){return new l5(i,n)})}},{key:"nationalPrefix",value:function(){return this.metadata[this.v1?3:this.v2?4:5]}},{key:"_getNationalPrefixFormattingRule",value:function(n){return n[this.v1?4:this.v2?5:6]}},{key:"nationalPrefixFormattingRule",value:function(){return this._getNationalPrefixFormattingRule(this.metadata)||this._getNationalPrefixFormattingRule(this.getDefaultCountryMetadataForRegion())}},{key:"_nationalPrefixForParsing",value:function(){return this.metadata[this.v1?5:this.v2?6:7]}},{key:"nationalPrefixForParsing",value:function(){return this._nationalPrefixForParsing()||this.nationalPrefix()}},{key:"nationalPrefixTransformRule",value:function(){return this.metadata[this.v1?6:this.v2?7:8]}},{key:"_getNationalPrefixIsOptionalWhenFormatting",value:function(){return!!this.metadata[this.v1?7:this.v2?8:9]}},{key:"nationalPrefixIsOptionalWhenFormattingInNationalFormat",value:function(){return this._getNationalPrefixIsOptionalWhenFormatting(this.metadata)||this._getNationalPrefixIsOptionalWhenFormatting(this.getDefaultCountryMetadataForRegion())}},{key:"leadingDigits",value:function(){return this.metadata[this.v1?8:this.v2?9:10]}},{key:"types",value:function(){return this.metadata[this.v1?9:this.v2?10:11]}},{key:"hasTypes",value:function(){return this.types()&&this.types().length===0?!1:!!this.types()}},{key:"type",value:function(n){if(this.hasTypes()&&pg(this.types(),n))return new d5(pg(this.types(),n),this)}},{key:"ext",value:function(){return this.v1||this.v2?ug:this.metadata[13]||ug}}]),t}(),l5=function(){function t(e,n){Nl(this,t),this._format=e,this.metadata=n}return Cl(t,[{key:"pattern",value:function(){return this._format[0]}},{key:"format",value:function(){return this._format[1]}},{key:"leadingDigitsPatterns",value:function(){return this._format[2]||[]}},{key:"nationalPrefixFormattingRule",value:function(){return this._format[3]||this.metadata.nationalPrefixFormattingRule()}},{key:"nationalPrefixIsOptionalWhenFormattingInNationalFormat",value:function(){return!!this._format[4]||this.metadata.nationalPrefixIsOptionalWhenFormattingInNationalFormat()}},{key:"nationalPrefixIsMandatoryWhenFormattingInNationalFormat",value:function(){return this.usesNationalPrefix()&&!this.nationalPrefixIsOptionalWhenFormattingInNationalFormat()}},{key:"usesNationalPrefix",value:function(){return!!(this.nationalPrefixFormattingRule()&&!u5.test(this.nationalPrefixFormattingRule()))}},{key:"internationalFormat",value:function(){return this._format[5]||this.format()}}]),t}(),u5=/^\(?\$1\)?$/,d5=function(){function t(e,n){Nl(this,t),this.type=e,this.metadata=n}return Cl(t,[{key:"pattern",value:function(){return this.metadata.v1?this.type:this.type[0]}},{key:"possibleLengths",value:function(){if(!this.metadata.v1)return this.type[1]||this.metadata.possibleLengths()}}]),t}();function pg(t,e){switch(e){case"FIXED_LINE":return t[0];case"MOBILE":return t[1];case"TOLL_FREE":return t[2];case"PREMIUM_RATE":return t[3];case"PERSONAL_NUMBER":return t[4];case"VOICEMAIL":return t[5];case"UAN":return t[6];case"PAGER":return t[7];case"VOIP":return t[8];case"SHARED_COST":return t[9]}}function q1(t){if(!t)throw new Error("[libphonenumber-js] `metadata` argument not passed. Check your arguments.");if(!Ti(t)||!Ti(t.countries))throw new Error("[libphonenumber-js] `metadata` argument was passed but it's not a valid metadata. Must be an object having `.countries` child object property. Got ".concat(Ti(t)?"an object of shape: { "+Object.keys(t).join(", ")+" }":"a "+p5(t)+": "+t,"."))}var p5=function(e){return Wd(e)};function wf(t,e){if(e=new vt(e),e.hasCountry(t))return e.country(t).countryCallingCode();throw new Error("Unknown country: ".concat(t))}function f5(t,e){return e.countries.hasOwnProperty(t)}function V1(t){var e=t.version;typeof e=="number"?(this.v1=e===1,this.v2=e===2,this.v3=e===3,this.v4=e===4):e?lg(e,s5)===-1?this.v2=!0:lg(e,a5)===-1?this.v3=!0:this.v4=!0:this.v1=!0}function vf(t,e){return h5(t,void 0,e)}function h5(t,e,n){var r=n.type(e),i=r&&r.possibleLengths()||n.possibleLengths();if(!i)return"IS_POSSIBLE";var o=t.length,a=i[0];return a===o?"IS_POSSIBLE":a>o?"TOO_SHORT":i[i.length-1]<o?"TOO_LONG":i.indexOf(o,1)>=0?"IS_POSSIBLE":"INVALID_LENGTH"}function g5(t,e,n){if(e===void 0&&(e={}),n=new vt(n),e.v2){if(!t.countryCallingCode)throw new Error("Invalid phone number object passed");n.selectNumberingPlan(t.countryCallingCode)}else{if(!t.phone)return!1;if(t.country){if(!n.hasCountry(t.country))throw new Error("Unknown country: ".concat(t.country));n.country(t.country)}else{if(!t.countryCallingCode)throw new Error("Invalid phone number object passed");n.selectNumberingPlan(t.countryCallingCode)}}if(n.possibleLengths())return H1(t.phone||t.nationalNumber,n);if(t.countryCallingCode&&n.isNonGeographicCallingCode(t.countryCallingCode))return!0;throw new Error('Missing "possibleLengths" in metadata. Perhaps the metadata has been generated before v1.0.18.')}function H1(t,e){switch(vf(t,e)){case"IS_POSSIBLE":return!0;default:return!1}}function Xn(t,e){return t=t||"",new RegExp("^(?:"+e+")$").test(t)}function m5(t,e){var n=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n)return(n=n.call(t)).next.bind(n);if(Array.isArray(t)||(n=_5(t))||e){n&&(t=n);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
193
193
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _5(t,e){if(t){if(typeof t=="string")return fg(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return fg(t,e)}}function fg(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var y5=["MOBILE","PREMIUM_RATE","TOLL_FREE","SHARED_COST","VOIP","PERSONAL_NUMBER","PAGER","UAN","VOICEMAIL"];function bf(t,e,n){if(e=e||{},!(!t.country&&!t.countryCallingCode)){n=new vt(n),n.selectNumberingPlan(t.country,t.countryCallingCode);var r=e.v2?t.nationalNumber:t.phone;if(Xn(r,n.nationalNumberPattern())){if(tu(r,"FIXED_LINE",n))return n.type("MOBILE")&&n.type("MOBILE").pattern()===""||!n.type("MOBILE")||tu(r,"MOBILE",n)?"FIXED_LINE_OR_MOBILE":"FIXED_LINE";for(var i=m5(y5),o;!(o=i()).done;){var a=o.value;if(tu(r,a,n))return a}}}}function tu(t,e,n){return e=n.type(e),!e||!e.pattern()||e.possibleLengths()&&e.possibleLengths().indexOf(t.length)<0?!1:Xn(t,e.pattern())}function w5(t,e,n){if(e=e||{},n=new vt(n),n.selectNumberingPlan(t.country,t.countryCallingCode),n.hasTypes())return bf(t,e,n.metadata)!==void 0;var r=e.v2?t.nationalNumber:t.phone;return Xn(r,n.nationalNumberPattern())}function v5(t,e,n){var r=new vt(n),i=r.getCountryCodesForCallingCode(t);return i?i.filter(function(o){return b5(e,o,n)}):[]}function b5(t,e,n){var r=new vt(n);return r.selectNumberingPlan(e),r.numberingPlan.possibleLengths().indexOf(t.length)>=0}var $f=2,$5=17,x5=3,hn="0-90-9٠-٩۰-۹",A5="-‐-―−ー-",E5="//",S5="..",k5="  ­​⁠ ",N5="()()[]\\[\\]",C5="~⁓∼~",uc="".concat(A5).concat(E5).concat(S5).concat(k5).concat(N5).concat(C5),xf="++",T5=new RegExp("(["+hn+"])");function I5(t,e,n,r){if(e){var i=new vt(r);i.selectNumberingPlan(e,n);var o=new RegExp(i.IDDPrefix());if(t.search(o)===0){t=t.slice(t.match(o)[0].length);var a=t.match(T5);if(!(a&&a[1]!=null&&a[1].length>0&&a[1]==="0"))return t}}}function O5(t,e){if(t&&e.numberingPlan.nationalPrefixForParsing()){var n=new RegExp("^(?:"+e.numberingPlan.nationalPrefixForParsing()+")"),r=n.exec(t);if(r){var i,o,a=r.length-1,l=a>0&&r[a];if(e.nationalPrefixTransformRule()&&l)i=t.replace(n,e.nationalPrefixTransformRule()),a>1&&(o=r[1]);else{var u=r[0];i=t.slice(u.length),l&&(o=r[1])}var d;if(l){var p=t.indexOf(r[1]),h=t.slice(0,p);h===e.numberingPlan.nationalPrefix()&&(d=e.numberingPlan.nationalPrefix())}else d=r[0];return{nationalNumber:i,nationalPrefix:d,carrierCode:o}}}return{nationalNumber:t}}function Xd(t,e){var n=O5(t,e),r=n.carrierCode,i=n.nationalNumber;if(i!==t){if(!z5(t,i,e))return{nationalNumber:t};if(e.possibleLengths()&&!D5(i,e))return{nationalNumber:t}}return{nationalNumber:i,carrierCode:r}}function z5(t,e,n){return!(Xn(t,n.nationalNumberPattern())&&!Xn(e,n.nationalNumberPattern()))}function D5(t,e){switch(vf(t,e)){case"TOO_SHORT":case"INVALID_LENGTH":return!1;default:return!0}}function R5(t,e,n,r){var i=e?wf(e,r):n;if(t.indexOf(i)===0){r=new vt(r),r.selectNumberingPlan(e,n);var o=t.slice(i.length),a=Xd(o,r),l=a.nationalNumber,u=Xd(t,r),d=u.nationalNumber;if(!Xn(d,r.nationalNumberPattern())&&Xn(l,r.nationalNumberPattern())||vf(d,r)==="TOO_LONG")return{countryCallingCode:i,number:o}}return{number:t}}function K1(t,e,n,r){if(!t)return{};var i;if(t[0]!=="+"){var o=I5(t,e,n,r);if(o&&o!==t)i=!0,t="+"+o;else{if(e||n){var a=R5(t,e,n,r),l=a.countryCallingCode,u=a.number;if(l)return{countryCallingCodeSource:"FROM_NUMBER_WITHOUT_PLUS_SIGN",countryCallingCode:l,number:u}}return{number:t}}}if(t[1]==="0")return{};r=new vt(r);for(var d=2;d-1<=x5&&d<=t.length;){var p=t.slice(1,d);if(r.hasCallingCode(p))return r.selectNumberingPlan(p),{countryCallingCodeSource:i?"FROM_NUMBER_WITH_IDD":"FROM_NUMBER_WITH_PLUS_SIGN",countryCallingCode:p,number:t.slice(d)};d++}return{}}function P5(t){return t.replace(new RegExp("[".concat(uc,"]+"),"g")," ").trim()}var B5=/(\$\d)/;function j5(t,e,n){var r=n.useInternationalFormat,i=n.withNationalPrefix,o=t.replace(new RegExp(e.pattern()),r?e.internationalFormat():i&&e.nationalPrefixFormattingRule()?e.format().replace(B5,e.nationalPrefixFormattingRule()):e.format());return r?P5(o):o}var L5=/^[\d]+(?:[~\u2053\u223C\uFF5E][\d]+)?$/;function F5(t,e,n){var r=new vt(n);if(r.selectNumberingPlan(t,e),r.defaultIDDPrefix())return r.defaultIDDPrefix();if(L5.test(r.IDDPrefix()))return r.IDDPrefix()}var U5=";ext=",pi=function(e){return"([".concat(hn,"]{1,").concat(e,"})")};function G1(t){var e="20",n="15",r="9",i="6",o="[  \\t,]*",a="[:\\..]?[  \\t,-]*",l="#?",u="(?:e?xt(?:ensi(?:ó?|ó))?n?|e?xtn?|доб|anexo)",d="(?:[xx##~~]|int|int)",p="[- ]+",h="[  \\t]*",g="(?:,{2}|;)",A=U5+pi(e),$=o+u+a+pi(e)+l,N=o+d+a+pi(r)+l,D=p+pi(i)+"#",O=h+g+a+pi(n)+l,x=h+"(?:,)+"+a+pi(r)+l;return A+"|"+$+"|"+N+"|"+D+"|"+O+"|"+x}var M5="["+hn+"]{"+$f+"}",q5="["+xf+"]{0,1}(?:["+uc+"]*["+hn+"]){3,}["+uc+hn+"]*",V5=new RegExp("^["+xf+"]{0,1}(?:["+uc+"]*["+hn+"]){1,2}$","i"),H5=q5+"(?:"+G1()+")?",K5=new RegExp("^"+M5+"$|^"+H5+"$","i");function G5(t){return t.length>=$f&&K5.test(t)}function W5(t){return V5.test(t)}function X5(t){var e=t.number,n=t.ext;if(!e)return"";if(e[0]!=="+")throw new Error('"formatRFC3966()" expects "number" to be in E.164 format.');return"tel:".concat(e).concat(n?";ext="+n:"")}function J5(t,e){var n=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n)return(n=n.call(t)).next.bind(n);if(Array.isArray(t)||(n=Y5(t))||e){n&&(t=n);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
194
194
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Y5(t,e){if(t){if(typeof t=="string")return hg(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return hg(t,e)}}function hg(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function gg(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function mg(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?gg(Object(n),!0).forEach(function(r){Z5(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):gg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Z5(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var _g={formatExtension:function(e,n,r){return"".concat(e).concat(r.ext()).concat(n)}};function Q5(t,e,n,r){if(n?n=mg(mg({},_g),n):n=_g,r=new vt(r),t.country&&t.country!=="001"){if(!r.hasCountry(t.country))throw new Error("Unknown country: ".concat(t.country));r.country(t.country)}else if(t.countryCallingCode)r.selectNumberingPlan(t.countryCallingCode);else return t.phone||"";var i=r.countryCallingCode(),o=n.v2?t.nationalNumber:t.phone,a;switch(e){case"NATIONAL":return o?(a=dc(o,t.carrierCode,"NATIONAL",r,n),nu(a,t.ext,r,n.formatExtension)):"";case"INTERNATIONAL":return o?(a=dc(o,null,"INTERNATIONAL",r,n),a="+".concat(i," ").concat(a),nu(a,t.ext,r,n.formatExtension)):"+".concat(i);case"E.164":return"+".concat(i).concat(o);case"RFC3966":return X5({number:"+".concat(i).concat(o),ext:t.ext});case"IDD":if(!n.fromCountry)return;var l=tA(o,t.carrierCode,i,n.fromCountry,r);return nu(l,t.ext,r,n.formatExtension);default:throw new Error('Unknown "format" argument passed to "formatNumber()": "'.concat(e,'"'))}}function dc(t,e,n,r,i){var o=eA(r.formats(),t);return o?j5(t,o,{useInternationalFormat:n==="INTERNATIONAL",withNationalPrefix:!(o.nationalPrefixIsOptionalWhenFormattingInNationalFormat()&&i&&i.nationalPrefix===!1),carrierCode:e,metadata:r}):t}function eA(t,e){for(var n=J5(t),r;!(r=n()).done;){var i=r.value;if(i.leadingDigitsPatterns().length>0){var o=i.leadingDigitsPatterns()[i.leadingDigitsPatterns().length-1];if(e.search(o)!==0)continue}if(Xn(e,i.pattern()))return i}}function nu(t,e,n,r){return e?r(t,e,n):t}function tA(t,e,n,r,i){var o=wf(r,i.metadata);if(o===n){var a=dc(t,e,"NATIONAL",i);return n==="1"?n+" "+a:a}var l=F5(r,void 0,i.metadata);if(l)return"".concat(l," ").concat(n," ").concat(dc(t,null,"INTERNATIONAL",i))}function yg(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function wg(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?yg(Object(n),!0).forEach(function(r){nA(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):yg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function nA(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function rA(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function iA(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function oA(t,e,n){return e&&iA(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}var sA=function(){function t(e,n,r){if(rA(this,t),!e)throw new TypeError("First argument is required");if(typeof e!="string")throw new TypeError("First argument must be a string");if(typeof e=="string"){if(e[0]==="+"&&!n)throw new TypeError("`metadata` argument not passed");if(Ti(n)&&Ti(n.countries)){r=n;var i=e;if(!lA.test(i))throw new Error('Invalid `number` argument passed: must consist of a "+" followed by digits');var o=K1(i,void 0,void 0,r),a=o.countryCallingCode,l=o.number;if(n=l,e=a,!n)throw new Error("Invalid `number` argument passed: too short")}}if(!n)throw new TypeError("`nationalNumber` argument is required");if(typeof n!="string")throw new TypeError("`nationalNumber` argument must be a string");q1(r);var u=cA(e,r),d=u.country,p=u.countryCallingCode;this.country=d,this.countryCallingCode=p,this.nationalNumber=n,this.number="+"+this.countryCallingCode+this.nationalNumber,this.getMetadata=function(){return r}}return oA(t,[{key:"setExt",value:function(n){this.ext=n}},{key:"getPossibleCountries",value:function(){return this.country?[this.country]:v5(this.countryCallingCode,this.nationalNumber,this.getMetadata())}},{key:"isPossible",value:function(){return g5(this,{v2:!0},this.getMetadata())}},{key:"isValid",value:function(){return w5(this,{v2:!0},this.getMetadata())}},{key:"isNonGeographic",value:function(){var n=new vt(this.getMetadata());return n.isNonGeographicCallingCode(this.countryCallingCode)}},{key:"isEqual",value:function(n){return this.number===n.number&&this.ext===n.ext}},{key:"getType",value:function(){return bf(this,{v2:!0},this.getMetadata())}},{key:"format",value:function(n,r){return Q5(this,n,r?wg(wg({},r),{},{v2:!0}):{v2:!0},this.getMetadata())}},{key:"formatNational",value:function(n){return this.format("NATIONAL",n)}},{key:"formatInternational",value:function(n){return this.format("INTERNATIONAL",n)}},{key:"getURI",value:function(n){return this.format("RFC3966",n)}}]),t}(),aA=function(e){return/^[A-Z]{2}$/.test(e)};function cA(t,e){var n,r,i=new vt(e);return aA(t)?(n=t,i.selectNumberingPlan(n),r=i.countryCallingCode()):r=t,{country:n,countryCallingCode:r}}var lA=/^\+\d+$/;function Jd(t){"@babel/helpers - typeof";return Jd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Jd(t)}function uA(t,e,n){return Object.defineProperty(t,"prototype",{writable:!1}),t}function dA(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function pA(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Go(t,e)}function fA(t){var e=X1();return function(){var r=Wo(t),i;if(e){var o=Wo(this).constructor;i=Reflect.construct(r,arguments,o)}else i=r.apply(this,arguments);return hA(this,i)}}function hA(t,e){if(e&&(Jd(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return W1(t)}function W1(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Yd(t){var e=typeof Map=="function"?new Map:void 0;return Yd=function(r){if(r===null||!gA(r))return r;if(typeof r!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(r))return e.get(r);e.set(r,i)}function i(){return aa(r,arguments,Wo(this).constructor)}return i.prototype=Object.create(r.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),Go(i,r)},Yd(t)}function aa(t,e,n){return X1()?aa=Reflect.construct:aa=function(i,o,a){var l=[null];l.push.apply(l,o);var u=Function.bind.apply(i,l),d=new u;return a&&Go(d,a.prototype),d},aa.apply(null,arguments)}function X1(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function gA(t){return Function.toString.call(t).indexOf("[native code]")!==-1}function Go(t,e){return Go=Object.setPrototypeOf||function(r,i){return r.__proto__=i,r},Go(t,e)}function Wo(t){return Wo=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)},Wo(t)}var jn=function(t){pA(n,t);var e=fA(n);function n(r){var i;return dA(this,n),i=e.call(this,r),Object.setPrototypeOf(W1(i),n.prototype),i.name=i.constructor.name,i}return uA(n)}(Yd(Error)),vg=new RegExp("(?:"+G1()+")$","i");function mA(t){var e=t.search(vg);if(e<0)return{};for(var n=t.slice(0,e),r=t.match(vg),i=1;i<r.length;){if(r[i])return{number:n,ext:r[i]};i++}}var _A={0:"0",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9","0":"0","1":"1","2":"2","3":"3","4":"4","5":"5","6":"6","7":"7","8":"8","9":"9","٠":"0","١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","۰":"0","۱":"1","۲":"2","۳":"3","۴":"4","۵":"5","۶":"6","۷":"7","۸":"8","۹":"9"};function yA(t){return _A[t]}function wA(t,e){var n=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n)return(n=n.call(t)).next.bind(n);if(Array.isArray(t)||(n=vA(t))||e){n&&(t=n);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
195
195
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function vA(t,e){if(t){if(typeof t=="string")return bg(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return bg(t,e)}}function bg(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function $g(t){for(var e="",n=wA(t.split("")),r;!(r=n()).done;){var i=r.value;e+=bA(i,e)||""}return e}function bA(t,e,n){return t==="+"?e?void 0:"+":yA(t)}function $A(t,e){var n=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n)return(n=n.call(t)).next.bind(n);if(Array.isArray(t)||(n=xA(t))||e){n&&(t=n);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
196
196
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function xA(t,e){if(t){if(typeof t=="string")return xg(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return xg(t,e)}}function xg(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function AA(t,e){var n=e.countries,r=e.metadata;r=new vt(r);for(var i=$A(n),o;!(o=i()).done;){var a=o.value;if(r.country(a),r.leadingDigits()){if(t&&t.search(r.leadingDigits())===0)return a}else if(bf({phone:t,country:a},void 0,r.metadata))return a}}function EA(t,e){var n=e.nationalNumber,r=e.defaultCountry,i=e.metadata,o=i.getCountryCodesForCallingCode(t);if(o)return o.length===1?o[0]:AA(n,{countries:o,defaultCountry:r,metadata:i.metadata})}var J1="+",SA="[\\-\\.\\(\\)]?",Ag="(["+hn+"]|"+SA+")",kA="^\\"+J1+Ag+"*["+hn+"]"+Ag+"*$",NA=new RegExp(kA,"g"),Zd=hn,CA="["+Zd+"]+((\\-)*["+Zd+"])*",TA="a-zA-Z",IA="["+TA+"]+((\\-)*["+Zd+"])*",OA="^("+CA+"\\.)*"+IA+"\\.?$",zA=new RegExp(OA,"g"),Eg="tel:",Qd=";phone-context=",DA=";isub=";function RA(t){var e=t.indexOf(Qd);if(e<0)return null;var n=e+Qd.length;if(n>=t.length)return"";var r=t.indexOf(";",n);return r>=0?t.substring(n,r):t.substring(n)}function PA(t){return t===null?!0:t.length===0?!1:NA.test(t)||zA.test(t)}function BA(t,e){var n=e.extractFormattedPhoneNumber,r=RA(t);if(!PA(r))throw new jn("NOT_A_NUMBER");var i;if(r===null)i=n(t)||"";else{i="",r.charAt(0)===J1&&(i+=r);var o=t.indexOf(Eg),a;o>=0?a=o+Eg.length:a=0;var l=t.indexOf(Qd);i+=t.substring(a,l)}var u=i.indexOf(DA);if(u>0&&(i=i.substring(0,u)),i!=="")return i}var jA=250,LA=new RegExp("["+xf+hn+"]"),FA=new RegExp("[^"+hn+"#]+$");function UA(t,e,n){if(e=e||{},n=new vt(n),e.defaultCountry&&!n.hasCountry(e.defaultCountry))throw e.v2?new jn("INVALID_COUNTRY"):new Error("Unknown country: ".concat(e.defaultCountry));var r=qA(t,e.v2,e.extract),i=r.number,o=r.ext,a=r.error;if(!i){if(e.v2)throw a==="TOO_SHORT"?new jn("TOO_SHORT"):new jn("NOT_A_NUMBER");return{}}var l=HA(i,e.defaultCountry,e.defaultCallingCode,n),u=l.country,d=l.nationalNumber,p=l.countryCallingCode,h=l.countryCallingCodeSource,g=l.carrierCode;if(!n.hasSelectedNumberingPlan()){if(e.v2)throw new jn("INVALID_COUNTRY");return{}}if(!d||d.length<$f){if(e.v2)throw new jn("TOO_SHORT");return{}}if(d.length>$5){if(e.v2)throw new jn("TOO_LONG");return{}}if(e.v2){var A=new sA(p,d,n.metadata);return u&&(A.country=u),g&&(A.carrierCode=g),o&&(A.ext=o),A.__countryCallingCodeSource=h,A}var $=(e.extended?n.hasSelectedNumberingPlan():u)?Xn(d,n.nationalNumberPattern()):!1;return e.extended?{country:u,countryCallingCode:p,carrierCode:g,valid:$,possible:$?!0:!!(e.extended===!0&&n.possibleLengths()&&H1(d,n)),phone:d,ext:o}:$?VA(u,d,o):{}}function MA(t,e,n){if(t){if(t.length>jA){if(n)throw new jn("TOO_LONG");return}if(e===!1)return t;var r=t.search(LA);if(!(r<0))return t.slice(r).replace(FA,"")}}function qA(t,e,n){var r=BA(t,{extractFormattedPhoneNumber:function(a){return MA(a,n,e)}});if(!r)return{};if(!G5(r))return W5(r)?{error:"TOO_SHORT"}:{};var i=mA(r);return i.ext?i:{number:r}}function VA(t,e,n){var r={country:t,phone:e};return n&&(r.ext=n),r}function HA(t,e,n,r){var i=K1($g(t),e,n,r.metadata),o=i.countryCallingCodeSource,a=i.countryCallingCode,l=i.number,u;if(a)r.selectNumberingPlan(a);else if(l&&(e||n))r.selectNumberingPlan(e,n),e&&(u=e),a=n||wf(e,r.metadata);else return{};if(!l)return{countryCallingCodeSource:o,countryCallingCode:a};var d=Xd($g(l),r),p=d.nationalNumber,h=d.carrierCode,g=EA(a,{nationalNumber:p,defaultCountry:e,metadata:r});return g&&(u=g,g==="001"||r.country(u)),{country:u,countryCallingCode:a,countryCallingCodeSource:o,nationalNumber:p,carrierCode:h}}function Sg(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function kg(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Sg(Object(n),!0).forEach(function(r){KA(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Sg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function KA(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function GA(t,e,n){return UA(t,kg(kg({},e),{},{v2:!0}),n)}function Ng(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function WA(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Ng(Object(n),!0).forEach(function(r){XA(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Ng(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function XA(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function JA(t,e){return eE(t)||QA(t,e)||ZA(t,e)||YA()}function YA(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
197
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ZA(t,e){if(t){if(typeof t=="string")return Cg(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Cg(t,e)}}function Cg(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function QA(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r=[],i=!0,o=!1,a,l;try{for(n=n.call(t);!(i=(a=n.next()).done)&&(r.push(a.value),!(e&&r.length===e));i=!0);}catch(u){o=!0,l=u}finally{try{!i&&n.return!=null&&n.return()}finally{if(o)throw l}}return r}}function eE(t){if(Array.isArray(t))return t}function tE(t){var e=Array.prototype.slice.call(t),n=JA(e,4),r=n[0],i=n[1],o=n[2],a=n[3],l,u,d;if(typeof r=="string")l=r;else throw new TypeError("A text for parsing must be a string.");if(!i||typeof i=="string")a?(u=o,d=a):(u=void 0,d=o),i&&(u=WA({defaultCountry:i},u));else if(Ti(i))o?(u=i,d=o):d=i;else throw new Error("Invalid second argument: ".concat(i));return{text:l,options:u,metadata:d}}function Tg(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Ig(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Tg(Object(n),!0).forEach(function(r){nE(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Tg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function nE(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function rE(t,e,n){e&&e.defaultCountry&&!f5(e.defaultCountry,n)&&(e=Ig(Ig({},e),{},{defaultCountry:void 0}));try{return GA(t,e,n)}catch(r){if(!(r instanceof jn))throw r}}function iE(){var t=tE(arguments),e=t.text,n=t.options,r=t.metadata;return rE(e,n,r)}function oE(){return r5(iE,arguments)}function Tl(t,e="US"){const n=t.trim();if(n.includes("@")){const r=n.toLowerCase(),i=/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(r);return{connectionType:"email",normalized:i?r:null,isValid:i}}else if(/^\+?\d[\d\s\-().]*$/.test(n)){const r=oE(n,{defaultCountry:e});return r&&r.isValid()?{connectionType:"sms",normalized:r.number,isValid:!0}:{connectionType:"sms",normalized:null,isValid:!1}}else return{connectionType:"username",normalized:n,isValid:!0}}function Af(t){let e=t.trim();e.startsWith("[")&&e.endsWith("]")&&(e=e.slice(1,-1));const n=e.indexOf("%");return n!==-1&&(e=e.slice(0,n)),e}function sE(t){const n=Af(t).split(".");return n.length!==4?!1:n.every(r=>/^\d+$/.test(r)&&Number(r)>=0&&Number(r)<=255)}function aE(t){const e=Af(t);if(e.length<2||e.indexOf(":")===-1||!/^[0-9a-fA-F:.]+$/.test(e))return!1;const n=e.split(":");return e.includes("::")?n.length<=8:n.length===8}function cE(t){let e=t.trim();const n=/^\[([^\]]+)\](?::\d+)?$/,r=e.match(n);if(r&&r[1])return r[1];const i=e.lastIndexOf(":");if(i!==-1){const o=e.slice(0,i),a=e.slice(i+1);/^[0-9.]+$/.test(o)&&/^\d+$/.test(a)&&(e=o)}return e}function Og(t){if(!t)return null;const e=Af(cE(t));return sE(e)?{family:4,normalized:e}:aE(e)?{family:6,normalized:e.toLowerCase()}:null}function zg(t){if(t.includes("::")){let[e,n]=t.split("::"),r=e?e.split(":").filter(Boolean):[],i=n?n.split(":").filter(Boolean):[],o=8-(r.length+i.length);return[...r.map(a=>a.toLowerCase()||"0"),...Array(o).fill("0"),...i.map(a=>a.toLowerCase()||"0")]}else return t.split(":").map(e=>e.toLowerCase()||"0")}function lE(t,e,n=!0){const r=Og(t),i=Og(e);if(!r||!i||r.family!==i.family)return!1;if(r.family===4)return r.normalized===i.normalized;const o=zg(r.normalized),a=zg(i.normalized);return n?o.length===8&&a.length===8&&o.join(":")===a.join(":"):o.slice(0,4).join(":")===a.slice(0,4).join(":")}class xs extends Error{constructor(n,r=302){super(`Redirect to ${n}`);be(this,"location");be(this,"status");this.name=xs.name,this.location=n,this.status=r}}const uE=s.z.object({client_id:s.z.string(),username:s.z.string().transform(t=>t.toLowerCase()),otp:s.z.string(),authParams:Io.optional(),enforceIpCheck:s.z.boolean().optional().default(!1)});async function Y1(t,{client_id:e,username:n,otp:r,authParams:i,enforceIpCheck:o=!1}){var N;const a=t.get("ip"),l=t.get("countryCode"),{connectionType:u,normalized:d}=Tl(n,l);if(!d)throw new C(400,{message:"Invalid username format"});const p=await t.env.data.clients.get(e);if(!p)throw new C(403,{message:"Client not found"});const{env:h}=t,g=await h.data.codes.get(p.tenant.id,r,"otp");if(!g)throw new C(400,{message:xe("code_invalid")});if(g.expires_at<new Date().toISOString())throw new C(400,{message:xe("code_expired")});if(g.used_at)throw new C(400,{message:xe("code_used")});const A=await h.data.loginSessions.get(p.tenant.id,g.login_id);if(!A||A.authParams.username!==n)throw new C(400,{message:"Code not found or expired"});if(o&&A.ip&&a&&!lE(A.ip,a))throw new xs(`${Ke(t.env)}invalid-session?state=${A.id}`);const $=await Tc(t,{client:p,username:d,provider:u,connection:u,isSocial:!1,ip:t.req.header("x-real-ip")});return await h.data.codes.used(p.tenant.id,r),((N=$.app_metadata)==null?void 0:N.strategy)!=="email"&&Bt(t,t.env.data.users.update(p.tenant.id,$.user_id,{app_metadata:{...$.app_metadata||{},strategy:"email"}})),{user:$,client:p,loginSession:A,session_id:A.session_id,authParams:{...A.authParams,...i||{}}}}async function Ef(t,e){const n=await Y1(t,e);return Sr(t,{authParams:n.authParams,client:n.client,user:n.user,loginSession:n.loginSession})}const Dg=s.z.object({client_id:s.z.string().optional(),client_secret:s.z.string().optional()}),dE=s.z.union([M1.extend(Dg.shape),s.z.object({grant_type:s.z.literal("authorization_code"),client_id:s.z.string(),code:s.z.string(),redirect_uri:s.z.string(),code_verifier:s.z.string().min(43).max(128)}),s.z.object({grant_type:s.z.literal("authorization_code"),code:s.z.string(),redirect_uri:s.z.string().optional(),...Dg.shape}),s.z.object({grant_type:s.z.literal("refresh_token"),client_id:s.z.string(),refresh_token:s.z.string(),redirect_uri:s.z.string().optional()}),s.z.object({grant_type:s.z.literal("http://auth0.com/oauth/grant-type/passwordless/otp"),client_id:s.z.string(),username:s.z.string(),otp:s.z.string(),realm:s.z.enum(["email","sms"])})]);function pE(t){if(!t)return{};const[e,n]=t.split(" ");if((e==null?void 0:e.toLowerCase())==="basic"&&n){const[r,i]=atob(n).split(":");return{client_id:r,client_secret:i}}return{}}const fE=new s.OpenAPIHono().openapi(s.createRoute({tags:["oauth2"],method:"post",path:"/",request:{body:{content:{"application/x-www-form-urlencoded":{schema:dE}}}},responses:{200:{content:{"application/json":{schema:gp}},description:"Tokens"},302:{description:"Redirect for further user interaction (e.g., MFA, consent).",headers:s.z.object({Location:s.z.string().url()}).openapi({})},400:{description:"Bad Request - The request was malformed or invalid.",content:{"application/json":{schema:s.z.object({error:s.z.string(),error_description:s.z.string().optional()})}}},401:{description:"Unauthorized - Client authentication failed.",content:{"application/json":{schema:s.z.object({error:s.z.string(),error_description:s.z.string().optional()})}}}}}),async t=>{const e=t.req.valid("form"),n=pE(t.req.header("Authorization")),r={...e,...n};if(!r.client_id)throw new C(400,{message:"client_id is required"});t.set("client_id",r.client_id);let i;switch(e.grant_type){case $i.AuthorizationCode:i=await Qx(t,Zx.parse(r));break;case $i.ClientCredential:i=await Yx(t,M1.parse(r));break;case $i.RefreshToken:i=await t5(t,e5.parse(r));break;case $i.OTP:i=await Y1(t,uE.parse(r));break;default:return t.json({error:"unsupported_grant_type",error_description:"Grant type not implemented"},400)}const o=new Headers;if(i.session_id){const l=ka(i.client.tenant.id,i.session_id,t.var.host||"");o.set("Set-Cookie",l)}const a=await Cc(t,i);return t.json(a,{headers:o})});var Sf={exports:{}};const kf=[{id:0,value:"Too weak",minDiversity:0,minLength:0},{id:1,value:"Weak",minDiversity:2,minLength:6},{id:2,value:"Medium",minDiversity:4,minLength:8},{id:3,value:"Strong",minDiversity:4,minLength:10}],Z1=(t,e=kf,n="!\"#$%&'()*+,-./:;<=>?@[\\\\\\]^_`{|}~")=>{let r=t||"";e[0].minDiversity=0,e[0].minLength=0;const i=[{regex:"[a-z]",message:"lowercase"},{regex:"[A-Z]",message:"uppercase"},{regex:"[0-9]",message:"number"}];n&&i.push({regex:`[${n}]`,message:"symbol"});let o={};o.contains=i.filter(l=>new RegExp(`${l.regex}`).test(r)).map(l=>l.message),o.length=r.length;let a=e.filter(l=>o.contains.length>=l.minDiversity).filter(l=>o.length>=l.minLength).sort((l,u)=>u.id-l.id).map(l=>({id:l.id,value:l.value}));return Object.assign(o,a[0]),o};Sf.exports={passwordStrength:Z1,defaultOptions:kf};var hE=Sf.exports.passwordStrength=Z1;Sf.exports.defaultOptions=kf;function Nf(t){return hE(t).id<2?!1:t.length>=8&&/[a-z]/.test(t)&&/[A-Z]/.test(t)&&/[0-9]/.test(t)&&/[^A-Za-z0-9]/.test(t)}async function As(t,e){var i;const n=await t.env.data.emailProviders.get(t.var.tenant_id)||(t.env.DEFAULT_TENANT_ID?await t.env.data.emailProviders.get(t.env.DEFAULT_TENANT_ID):null);if(!n)throw new C(500,{message:"Email provider not found"});const r=(i=t.env.emailProviders)==null?void 0:i[n.name];if(!r)throw new C(500,{message:"Email provider not found"});await r({emailProvider:n,...e,from:n.default_from_address||`login@${t.env.ISSUER}`})}async function Q1(t,e){var a,l;if(!t.var.client_id)throw new C(500,{message:"Client not found"});const n=await ao(t.env,t.var.client_id),r=n.connections.find(u=>u.strategy==="sms");if(!r)throw new C(500,{message:"SMS provider not found"});const i=((a=r.options)==null?void 0:a.provider)||"twilio",o=(l=t.env.smsProviders)==null?void 0:l[i];if(!o)throw new C(500,{message:"SMS provider not found"});await o({options:r.options,to:e.to,from:e.from,text:e.text,template:"auth-code",data:{code:e.code,tenantName:n.tenant.name,tenantId:n.tenant.id}})}async function ey(t,e,n,r){const i=await t.env.data.tenants.get(t.var.tenant_id);if(!i)throw new C(500,{message:"Tenant not found"});const o=`${Ke(t.env)}reset-password?state=${r}&code=${n}`,a={vendorName:i.name,lng:i.language||"en"};await As(t,{to:e,subject:xe("reset_password_title",a),html:`Click here to reset your password: ${Ke(t.env)}reset-password?state=${r}&code=${n}`,template:"auth-password-reset",data:{vendorName:i.name,logo:i.logo||"",passwordResetUrl:o,supportUrl:i.support_url||"https://support.sesamy.com",buttonColor:i.primary_color||"#7d68f4",passwordResetTitle:xe("password_reset_title",a),resetPasswordEmailClickToReset:xe("reset_password_email_click_to_reset",a),resetPasswordEmailReset:xe("reset_password_email_reset",a),supportInfo:xe("support_info",a),contactUs:xe("contact_us",a),copyright:xe("copyright",a),tenantName:i.name,tenantId:i.id}})}async function Cf(t,{to:e,code:n}){const r=await t.env.data.tenants.get(t.var.tenant_id);if(!r)throw new C(500,{message:"Tenant not found"});const{connectionType:i}=Tl(e),o=new URL(Ke(t.env)),a={vendorName:r.name,vendorId:r.id,loginDomain:o.hostname,code:n,lng:r.language||"en"};i==="email"?await As(t,{to:e,subject:xe("code_email_subject",a),html:`Click here to validate your email: ${Ke(t.env)}validate-email`,template:"auth-code",data:{code:n,vendorName:r.name,logo:r.logo||"",supportUrl:r.support_url||"",buttonColor:r.primary_color||"",welcomeToYourAccount:xe("welcome_to_your_account",a),linkEmailClickToLogin:xe("link_email_click_to_login",a),linkEmailLogin:xe("link_email_login",a),linkEmailOrEnterCode:xe("link_email_or_enter_code",a),codeValid30Mins:xe("code_valid_30_minutes",a),supportInfo:xe("support_info",a),contactUs:xe("contact_us",a),copyright:xe("copyright",a)}}):i==="sms"&&await Q1(t,{to:e,text:xe("sms_code_text",a),code:n,from:r.name});const l=Me(t,{type:Le.CODE_LINK_SENT,description:e});Bt(t,t.env.data.logs.create(r.id,l))}async function Tf(t,{to:e,code:n,authParams:r}){const i=await t.env.data.tenants.get(t.var.tenant_id);if(!i)throw new C(500,{message:"Tenant not found"});if(!r.redirect_uri)throw new C(400,{message:"redirect_uri is required"});const{connectionType:o}=Tl(e),a=new URL(ct(t.env));a.pathname="passwordless/verify_redirect",a.searchParams.set("verification_code",n),a.searchParams.set("connection",o),a.searchParams.set("client_id",r.client_id),a.searchParams.set("redirect_uri",r.redirect_uri),a.searchParams.set("email",e),r.response_type&&a.searchParams.set("response_type",r.response_type),r.scope&&a.searchParams.set("scope",r.scope),r.state&&a.searchParams.set("state",r.state),r.nonce&&a.searchParams.set("nonce",r.nonce),r.code_challenge&&a.searchParams.set("code_challenge",r.code_challenge),r.code_challenge_method&&a.searchParams.set("code_challenge_method",r.code_challenge_method),r.audience&&a.searchParams.set("audience",r.audience);const l={vendorName:i.name,code:n,lng:i.language||"en"};if(o==="email")await As(t,{to:e,subject:xe("code_email_subject",l),html:`Click here to validate your email: ${Ke(t.env)}validate-email`,template:"auth-link",data:{code:n,vendorName:i.name,logo:i.logo||"",supportUrl:i.support_url||"",magicLink:a.toString(),buttonColor:i.primary_color||"",welcomeToYourAccount:xe("welcome_to_your_account",l),linkEmailClickToLogin:xe("link_email_click_to_login",l),linkEmailLogin:xe("link_email_login",l),linkEmailOrEnterCode:xe("link_email_or_enter_code",l),codeValid30Mins:xe("code_valid_30_minutes",l),supportInfo:xe("support_info",l),contactUs:xe("contact_us",l),copyright:xe("copyright",l)}});else if(o==="sms")await Q1(t,{to:e,text:`${xe("link_sms_login",l)}: ${a.toString()}`,code:n,from:i.name});else throw new C(400,{message:"Only email and SMS connections are supported for magic links"});const u=Me(t,{type:Le.CODE_LINK_SENT,description:e});Bt(t,t.env.data.logs.create(i.id,u))}async function If(t,e){const n=await t.env.data.tenants.get(t.var.tenant_id);if(!n)throw new C(500,{message:"Tenant not found"});if(!e.email)throw new C(400,{message:"User has no email"});const r={vendorName:n.name,lng:n.language||"en"};await As(t,{to:e.email,subject:xe("welcome_to_your_account",r),html:`Click here to validate your email: ${Ke(t.env)}validate-email`,template:"auth-verify-email",data:{vendorName:n.name,logo:n.logo||"",emailValidationUrl:`${Ke(t.env)}validate-email`,supportUrl:n.support_url||"https://support.sesamy.com",buttonColor:n.primary_color||"#7d68f4",welcomeToYourAccount:xe("welcome_to_your_account",r),verifyEmailVerify:xe("verify_email_verify",r),supportInfo:xe("support_info",r),contactUs:xe("contact_us",r),copyright:xe("copyright",r)}})}async function gE(t,e,n,r){const i=await t.env.data.tenants.get(t.var.tenant_id);if(!i)throw new C(500,{message:"Tenant not found"});const o={vendorName:i.name,lng:i.language||"en"},a=`${Ke(t.env)}signup?state=${r}&code=${n}`;await As(t,{to:e,subject:xe("register_password_account",o),html:`Click here to register: ${a}`,template:"auth-pre-signup-verification",data:{vendorName:i.name,logo:i.logo||"",signupUrl:a,setPassword:xe("set_password",o),registerPasswordAccount:xe("register_password_account",o),clickToSignUpDescription:xe("click_to_sign_up_description",o),supportUrl:i.support_url||"https://support.sesamy.com",buttonColor:i.primary_color||"#7d68f4",welcomeToYourAccount:xe("welcome_to_your_account",o),verifyEmailVerify:xe("verify_email_verify",o),supportInfo:xe("support_info",o),contactUs:xe("contact_us",o),copyright:xe("copyright",o)}})}const mE=new s.OpenAPIHono().openapi(s.createRoute({tags:["dbconnections"],method:"post",path:"/signup",request:{body:{content:{"application/json":{schema:s.z.object({client_id:s.z.string(),connection:s.z.literal("Username-Password-Authentication"),email:s.z.string().transform(t=>t.toLowerCase()),password:s.z.string()})}}}},responses:{200:{content:{"application/json":{schema:s.z.object({_id:s.z.string(),email:s.z.string().optional(),email_verified:s.z.boolean(),app_metadata:s.z.object({}),user_metadata:s.z.object({})})}},description:"Created user"}}}),async t=>{const{email:e,password:n,client_id:r}=t.req.valid("json"),i=await t.env.data.clients.get(r);if(!i)throw new C(400,{message:"Client not found"});if(t.set("client_id",i.id),t.set("tenant_id",i.tenant.id),!Nf(n))throw new C(400,{message:"Password does not meet the requirements"});if(await Oo({userAdapter:t.env.data.users,tenant_id:i.tenant.id,username:e,provider:"auth2"}))throw new C(400,{message:"Invalid sign up"});const a=await t.env.data.users.create(i.tenant.id,{user_id:`auth2|${Sc()}`,email:e,email_verified:!1,provider:"auth2",connection:"Username-Password-Authentication",is_social:!1});t.set("user_id",a.user_id),t.set("username",a.email),t.set("connection",a.connection);const l=await ts.hash(n,10);await t.env.data.passwords.create(i.tenant.id,{user_id:a.user_id,password:l,algorithm:"bcrypt"}),await If(t,a);const u=Me(t,{type:Le.SUCCESS_SIGNUP,description:"Successful signup"});return await t.env.data.logs.create(i.tenant.id,u),t.json({_id:a.user_id,email:a.email,email_verified:!1,app_metadata:{},user_metadata:{}})}).openapi(s.createRoute({tags:["dbconnections"],method:"post",path:"/change_password",request:{body:{content:{"application/json":{schema:s.z.object({client_id:s.z.string(),connection:s.z.literal("Username-Password-Authentication"),email:s.z.string().transform(t=>t.toLowerCase())})}}}},responses:{200:{description:"Redirect to the client's redirect uri"}}}),async t=>{const{email:e,client_id:n}=t.req.valid("json"),r=await t.env.data.clients.get(n);if(!r)throw new C(400,{message:"Client not found"});if(t.set("client_id",r.id),t.set("tenant_id",r.tenant.id),!await Xi({userAdapter:t.env.data.users,tenant_id:r.tenant.id,username:e,provider:"auth2"}))return t.html("If an account with that email exists, we've sent instructions to reset your password.");const o={client_id:n,username:e},a=await t.env.data.loginSessions.create(r.tenant.id,{expires_at:new Date(Date.now()+qr*1e3).toISOString(),authParams:o,csrf_token:Ve(),ip:t.get("ip"),useragent:t.get("useragent"),auth0Client:Wn(t.get("auth0_client"))});return await ey(t,e,a.id,a.authParams.state),t.html("If an account with that email exists, we've sent instructions to reset your password.")});function $r(){const t="1234567890";let e="";for(let n=0;n<6;n+=1)e+=t[Math.floor(Math.random()*10)];return e.toString()}const _E=new s.OpenAPIHono().openapi(s.createRoute({tags:["passwordless"],method:"post",path:"/start",request:{body:{content:{"application/json":{schema:s.z.union([s.z.object({connection:s.z.literal("email"),client_id:s.z.string(),email:s.z.string().transform(t=>t.toLowerCase()),send:s.z.enum(["link","code"]),authParams:Io.omit({client_id:!0})}),s.z.object({client_id:s.z.string(),connection:s.z.literal("sms"),phone_number:s.z.string(),send:s.z.enum(["link","code"]),authParams:Io.omit({client_id:!0})})])}}}},responses:{200:{description:"Status"}}}),async t=>{const e=t.req.valid("json"),{env:n}=t,{client_id:r,send:i,authParams:o,connection:a}=e,l=await t.env.data.clients.get(r);if(!l)throw new C(400,{message:"Client not found"});t.set("client_id",l.id),t.set("tenant_id",l.tenant.id);const u=a==="email"?e.email:e.phone_number,d=t.get("ip"),p=t.get("useragent"),h=t.get("auth0_client"),g=Wn(h),A=await n.data.loginSessions.create(l.tenant.id,{authParams:{...o,client_id:r,username:u},expires_at:new Date(Date.now()+ea).toISOString(),csrf_token:Ve(),ip:d,useragent:p,auth0Client:g}),$=await n.data.codes.create(l.tenant.id,{code_id:$r(),code_type:"otp",login_id:A.id,expires_at:new Date(Date.now()+ea).toISOString(),redirect_uri:o.redirect_uri});return i==="link"?await Tf(t,{to:u,code:$.code_id,authParams:{...o,client_id:r}}):await Cf(t,{to:u,code:$.code_id}),t.html("OK")}).openapi(s.createRoute({tags:["passwordless"],method:"get",path:"/verify_redirect",request:{query:s.z.object({scope:s.z.string(),response_type:s.z.nativeEnum(rn),redirect_uri:s.z.string(),state:s.z.string(),nonce:s.z.string().optional(),verification_code:s.z.string(),connection:s.z.string(),client_id:s.z.string(),email:s.z.string().transform(t=>t.toLowerCase()),audience:s.z.string().optional()})},responses:{302:{description:"Successful verification, redirecting to continue flow.",headers:s.z.object({Location:s.z.string().url()}).openapi({})},400:{description:"Bad Request (e.g., invalid client, invalid code, missing parameters).",content:{"application/json":{schema:s.z.object({error:s.z.string(),error_description:s.z.string().optional()})}}},500:{description:"Internal Server Error.",content:{"application/json":{schema:s.z.object({error:s.z.string(),error_description:s.z.string().optional()})}}}}}),async t=>{const{env:e}=t,{client_id:n,email:r,verification_code:i,redirect_uri:o,state:a,scope:l,audience:u,response_type:d,nonce:p}=t.req.valid("query"),h=await ao(e,n);t.set("client_id",h.id),t.set("tenant_id",h.tenant.id),t.set("connection","email");const g={client_id:n,redirect_uri:o,state:a,nonce:p,scope:l,audience:u,response_type:d};let A="Something went wrong. Please try again later.";try{const M=await Ef(t,{client_id:n,username:r,otp:i,authParams:g,enforceIpCheck:!0});if(M instanceof Response)return M;if(M&&typeof M=="object"&&"access_token"in M)return t.json(M)}catch(M){const G=M;"message"in G&&typeof G.message=="string"&&(A=G.message)}const $=t.get("ip"),N=t.get("useragent"),D=t.get("auth0_client"),O=Wn(D),x=await e.data.loginSessions.create(h.tenant.id,{authParams:{...g,username:r},expires_at:new Date(Date.now()+ea).toISOString(),csrf_token:Ve(),ip:$,useragent:N,auth0Client:O});return t.redirect(`${Ke(t.env)}invalid-session?state=${x.id}&error=${encodeURIComponent(A)}`,302)});class yi extends C{constructor(n,r){super(n,r);be(this,"_code");this._code=r==null?void 0:r.code}get code(){return this._code}}async function ty(t,e,n,r){var A;const{data:i}=t.env,{username:o}=n;if(t.set("username",o),!o)throw new C(400,{message:"Username is required"});const a=await Xi({userAdapter:t.env.data.users,tenant_id:e.tenant.id,username:o,provider:"auth2"});if(!a){const $=Me(t,{type:Le.FAILED_LOGIN_INCORRECT_PASSWORD,description:"Invalid user"});throw Bt(t,i.logs.create(e.tenant.id,$)),new yi(403,{message:"User not found",code:"USER_NOT_FOUND"})}const l=a.linked_to?await i.users.get(e.tenant.id,a.linked_to):a;if(!l)throw new yi(403,{message:"User not found",code:"USER_NOT_FOUND"});t.set("connection",a.connection),t.set("user_id",l.user_id);const u=await i.passwords.get(e.tenant.id,a.user_id);if(!(u&&await ts.compare(n.password,u.password))){const $=Me(t,{type:Le.FAILED_LOGIN_INCORRECT_PASSWORD,description:"Invalid password"});throw Bt(t,i.logs.create(e.tenant.id,$)),new yi(403,{message:"Invalid password",code:"INVALID_PASSWORD"})}if((await i.logs.list(e.tenant.id,{page:0,per_page:10,include_totals:!1,q:`user_id:${l.user_id}`})).logs.filter($=>$.type===Le.FAILED_LOGIN_INCORRECT_PASSWORD&&new Date($.date)>new Date(Date.now()-1e3*60*5)).length>=3){const $=Me(t,{type:Le.FAILED_LOGIN,description:"Too many failed login attempts"});throw Bt(t,i.logs.create(e.tenant.id,$)),new yi(403,{message:"Too many failed login attempts",code:"TOO_MANY_FAILED_LOGINS"})}if(!a.email_verified&&e.email_validation==="enforced"){await If(t,a);const $=Me(t,{type:Le.FAILED_LOGIN,description:"Email not verified"});throw await i.logs.create(e.tenant.id,$),new yi(403,{message:"Email not verified",code:"EMAIL_NOT_VERIFIED"})}((A=l.app_metadata)==null?void 0:A.strategy)!=="Username-Password-Authentication"&&Bt(t,i.users.update(e.tenant.id,l.user_id,{app_metadata:{...l.app_metadata||{},strategy:"Username-Password-Authentication"}}));const g=Me(t,{type:Le.SUCCESS_LOGIN,description:"Successful login",strategy_type:"Username-Password-Authentication",strategy:"Username-Password-Authentication"});return Bt(t,i.logs.create(e.tenant.id,g)),{client:e,authParams:n,user:l,loginSession:r}}async function ny(t,e,n,r,i){const o=await ty(t,e,n,r);return Sr(t,{...o,ticketAuth:i})}async function yE(t,e,n,r){await Tc(t,{client:e,username:n,provider:"auth2",connection:"Username-Password-Authentication",isSocial:!1,ip:t.req.header("x-real-ip")});let i=$r(),o=await t.env.data.codes.get(e.tenant.id,i,"password_reset");for(;o;)i=$r(),o=await t.env.data.codes.get(e.tenant.id,i,"password_reset");const a=t.get("ip"),l=t.get("useragent"),u=t.get("auth0_client"),d=Wn(u),p=await t.env.data.loginSessions.create(e.tenant.id,{expires_at:new Date(Date.now()+Dv).toISOString(),authParams:{client_id:e.id,username:n},csrf_token:Ve(),ip:a,useragent:l,auth0Client:d}),h=await t.env.data.codes.create(e.tenant.id,{code_id:i,code_type:"password_reset",login_id:p.id,expires_at:new Date(Date.now()+zv).toISOString()});await ey(t,n,h.code_id,r)}const wE=new s.OpenAPIHono().openapi(s.createRoute({tags:["oauth"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:s.z.union([s.z.object({credential_type:s.z.literal("http://auth0.com/oauth/grant-type/passwordless/otp"),otp:s.z.string(),client_id:s.z.string(),username:s.z.string().transform(t=>t.toLowerCase()),realm:s.z.enum(["email"]),scope:s.z.string().optional()}),s.z.object({credential_type:s.z.literal("http://auth0.com/oauth/grant-type/password-realm"),client_id:s.z.string(),username:s.z.string().transform(t=>t.toLowerCase()),password:s.z.string(),realm:s.z.enum(["Username-Password-Authentication"]),scope:s.z.string().optional()})])}}}},responses:{200:{description:"List of tenants"}}}),async t=>{const e=t.req.valid("json"),{client_id:n,username:r}=e;t.set("username",r);const i=await t.env.data.clients.get(n);if(!i)throw new C(400,{message:"Client not found"});t.set("client_id",n),t.set("tenant_id",i.tenant.id);const o=r.toLocaleLowerCase(),a=t.get("ip"),l=t.get("useragent"),u=t.get("auth0_client");let d;if("otp"in e)d=await Ef(t,{client_id:n,username:o,otp:e.otp});else if("password"in e){const p=await t.env.data.loginSessions.create(i.tenant.id,{expires_at:new Date(Date.now()+qr*1e3).toISOString(),authParams:{client_id:n,username:o},csrf_token:Ve(),ip:a,useragent:l,auth0Client:Wn(u)});d=await ny(t,i,{username:o,password:e.password,client_id:n},p,!0)}else throw new C(400,{message:"Code or password required"});if(!(d instanceof Response))throw new C(500,{message:"Unexpected response from loginWithPassword"});return d});function ry(t,e){var r,i,o;if(!t||e.length===0)return!1;const n=((r=ru(t))==null?void 0:r.host)??null;if(!n)return!1;for(const a of e){let l;if(a.startsWith("http://")||a.startsWith("https://")?l=((i=ru(a))==null?void 0:i.host)??null:l=((o=ru("https://"+a))==null?void 0:o.host)??null,n===l)return!0}return!1}function ru(t){try{return new URL(t)}catch{return null}}async function vE({ctx:t,session:e,client:n,authParams:r,connection:i,login_hint:o}){const a=new URL(t.req.url);t.var.custom_domain&&(a.hostname=t.var.custom_domain);const{ip:l,auth0_client:u,useragent:d}=t.var,p=Wn(u),h=await t.env.data.loginSessions.create(n.tenant.id,{expires_at:new Date(Date.now()+qr*1e3).toISOString(),authParams:r,csrf_token:Ve(),authorization_url:a.toString(),ip:l,useragent:d,auth0Client:p});if(e&&o){const g=await t.env.data.users.get(n.tenant.id,e.user_id);if((g==null?void 0:g.email)===o)return Sr(t,{client:n,loginSession:h,authParams:r,user:g,sessionId:e.id})}if(i==="email"&&o){const g=$r();return await t.env.data.codes.create(n.tenant.id,{code_id:g,code_type:"otp",login_id:h.id,expires_at:new Date(Date.now()+qr*1e3).toISOString(),redirect_uri:r.redirect_uri}),await Tf(t,{code:g,to:o,authParams:r}),t.redirect(`/u/enter-code?state=${h.id}`)}return e?t.redirect(`/u/check-account?state=${h.id}`):t.redirect(`/u/login/identifier?state=${h.id}`)}function bE(t){if(t==="Username-Password-Authentication")return"auth2";if(t==="email")return"email";throw new C(403,{message:"Invalid realm"})}async function $E(t,e,n,r,i){var g;const{env:o}=t;t.set("connection",i);const a=await o.data.codes.get(e,n,"ticket");if(!a||a.used_at)throw new C(403,{message:"Ticket not found"});const l=await o.data.loginSessions.get(e,a.login_id);if(!l||!l.authParams.username)throw new C(403,{message:"Session not found"});const u=await o.data.clients.get(l.authParams.client_id);if(!u)throw new C(403,{message:"Client not found"});t.set("client_id",l.authParams.client_id),await o.data.codes.used(e,n);const d=bE(i);let p=await Tc(t,{username:l.authParams.username,provider:d,client:u,connection:d==="auth2"?"Username-Password-Authentication":"email",isSocial:!1,ip:t.req.header("x-real-ip")});t.set("username",p.email||p.phone_number),t.set("user_id",p.user_id);const h=await T_(t,{user:p,client:u,loginSession:l});return Sr(t,{authParams:{scope:(g=l.authParams)==null?void 0:g.scope,...r},loginSession:l,sessionId:h.id,user:p,client:u})}async function xE({ctx:t,client:e,session:n,redirect_uri:r,state:i,nonce:o,code_challenge_method:a,code_challenge:l,audience:u,scope:d,response_type:p}){const{env:h}=t,g=new URL(r),A=`${g.protocol}//${g.host}`;async function $(H="Login required"){const W=Me(t,{type:Le.FAILED_SILENT_AUTH,description:H});return await t.env.data.logs.create(e.tenant.id,W),t.html(Su(A,JSON.stringify({error:"login_required",error_description:H,state:i})))}if(!n||(n==null?void 0:n.expires_at)&&new Date(n.expires_at)<new Date||(n==null?void 0:n.idle_expires_at)&&new Date(n.idle_expires_at)<new Date)return $();t.set("user_id",n.user_id);const D=await h.data.users.get(e.tenant.id,n.user_id);if(!D)return console.error("User not found",n.user_id),$("User not found");t.set("username",D.email),t.set("connection",D.connection);const O={client:e,authParams:{client_id:e.id,audience:u,code_challenge_method:a,code_challenge:l,scope:d,state:i,nonce:o,response_type:p,redirect_uri:r},user:D,session_id:n.id},x=p===rn.CODE?await N_(t,{user:D,client:e,authParams:O.authParams,login_id:n.login_session_id}):await Cc(t,O);await h.data.sessions.update(e.tenant.id,n.id,{used_at:new Date().toISOString(),last_interaction_at:new Date().toISOString(),device:{...n.device,last_ip:t.req.header("x-real-ip")||"",last_user_agent:t.req.header("user-agent")||""},idle_expires_at:n.idle_expires_at?new Date(Date.now()+kc*1e3).toISOString():void 0});const M=Me(t,{type:Le.SUCCESS_SILENT_AUTH,description:"Successful silent authentication"});await t.env.data.logs.create(e.tenant.id,M);const G=new Headers;G.set("Server-Timing","cf-nel=0; no-cloudflare-insights=1");const F=ka(e.tenant.id,n.id,t.req.header("host"));return G.set("set-cookie",F),t.html(Su(A,JSON.stringify({...x,state:i})),{headers:G})}const AE=["email","sms","Username-Password-Authentication"],EE=new s.OpenAPIHono().openapi(s.createRoute({tags:["oauth"],method:"get",path:"/",request:{query:s.z.object({client_id:s.z.string(),vendor_id:s.z.string().optional(),redirect_uri:s.z.string(),scope:s.z.string().optional(),state:s.z.string(),prompt:s.z.string().optional(),response_mode:s.z.nativeEnum(Sn).optional(),response_type:s.z.nativeEnum(rn).optional(),audience:s.z.string().optional(),connection:s.z.string().optional(),nonce:s.z.string().optional(),max_age:s.z.string().optional(),login_ticket:s.z.string().optional(),code_challenge_method:s.z.nativeEnum($c).optional(),code_challenge:s.z.string().optional(),realm:s.z.string().optional(),auth0Client:s.z.string().optional(),organization:s.z.string().optional(),login_hint:s.z.string().optional(),screen_hint:s.z.string().openapi({example:"signup",description:'Optional hint for the screen to show, like "signup" or "login".'}).optional(),ui_locales:s.z.string().optional()})},responses:{200:{description:"Successful authorization response. This can be an HTML page (e.g., for silent authentication iframe or universal login page) or a JSON object containing tokens (e.g., for response_mode=web_message).",content:{"text/html":{schema:s.z.string().openapi({example:"<html>...</html>"})},"application/json":{schema:gp}}},302:{description:"Redirect to the client's redirect URI, an authentication page, or an external identity provider.",headers:s.z.object({Location:s.z.string().url()})},400:{description:"Bad Request. Invalid parameters or other client-side errors.",content:{"application/json":{schema:s.z.object({message:s.z.string()})}}},403:{description:"Forbidden. The request is not allowed (e.g., invalid origin).",content:{"application/json":{schema:s.z.object({message:s.z.string()})}}}}}),async t=>{const{env:e}=t,{client_id:n,vendor_id:r,redirect_uri:i,scope:o,state:a,audience:l,nonce:u,connection:d,response_type:p,response_mode:h,code_challenge:g,code_challenge_method:A,prompt:$,login_ticket:N,realm:D,auth0Client:O,login_hint:x,ui_locales:M,organization:G}=t.req.valid("query");t.set("log","authorize");const F=await ao(e,n);t.set("client_id",F.id),t.set("tenant_id",F.tenant.id);const H={redirect_uri:i.split("#")[0],scope:o,state:a,client_id:n,vendor_id:r,audience:l,nonce:u,prompt:$,response_type:p,response_mode:h,code_challenge:g,code_challenge_method:A,username:x,ui_locales:M,organization:G},W=t.req.header("origin");if(W&&!ry(W,F.web_origins||[]))throw new C(403,{message:`Origin ${W} not allowed`});if(H.redirect_uri){const L=F.callbacks||[];if(t.var.host&&(L.push(`${xl(t.env)}/*`),L.push(`${Ke(t.env)}/*`)),!yf(H.redirect_uri,L,{allowPathWildcards:!0}))throw new C(400,{message:`Invalid redirect URI - ${H.redirect_uri}`})}const Y=Tn(F.tenant.id,t.req.header("cookie")),ue=Y?await e.data.sessions.get(F.tenant.id,Y):void 0,Ce=ue&&!ue.revoked_at?ue:void 0;if($=="none"){if(!p)throw new C(400,{message:"Missing response_type"});return xE({ctx:t,session:Ce||void 0,redirect_uri:i,state:a,response_type:p,client:F,nonce:u,code_challenge_method:A,code_challenge:g,audience:l,scope:o})}if(F.connections.length===1&&F.connections[0]&&!AE.includes(F.connections[0].strategy||""))return og(t,F,F.connections[0].name,H);if(d&&d!=="email")return og(t,F,d,H);if(N){const L=await $E(t,F.tenant.id,N,H,D);return L instanceof Response?L:t.json(L)}const P=await vE({ctx:t,client:F,auth0Client:O,authParams:H,session:Ce||void 0,connection:d,login_hint:x});return P instanceof Response?P:t.json(P)}),SE=new s.OpenAPIHono().openapi(s.createRoute({tags:["oauth"],method:"get",path:"/",request:{query:s.z.object({client_id:s.z.string(),redirect_url:s.z.string().optional(),login_hint:s.z.string().toLowerCase().optional()})},responses:{302:{description:"Redirect to the account page with login session state or login page",headers:s.z.object({Location:s.z.string().url()})},400:{description:"Bad Request. Invalid parameters or other client-side errors.",content:{"application/json":{schema:s.z.object({message:s.z.string()})}}}}}),async t=>{const{env:e}=t,{client_id:n,redirect_url:r,login_hint:i}=t.req.valid("query");t.set("log","account");const o=await ao(e,n);t.set("client_id",o.id),t.set("tenant_id",o.tenant.id);const a={redirect_uri:r||t.req.url,client_id:n,username:i},l=t.req.header("origin");if(l&&!ry(l,o.web_origins||[]))throw new C(403,{message:`Origin ${l} not allowed`});if(a.redirect_uri){const O=o.callbacks||[];if(t.var.host&&(O.push(`${xl(t.env)}/*`),O.push(`${Ke(t.env)}/*`)),!yf(a.redirect_uri,O,{allowPathWildcards:!0}))throw new C(400,{message:`Invalid redirect URI - ${a.redirect_uri}`})}const u=Tn(o.tenant.id,t.req.header("cookie")),d=u?await e.data.sessions.get(o.tenant.id,u):void 0,p=d&&!d.revoked_at?d:void 0,h=new URL(t.req.url);t.var.custom_domain&&(h.hostname=t.var.custom_domain);const{ip:g,auth0_client:A,useragent:$}=t.var,N=Wn(A),D=await e.data.loginSessions.create(o.tenant.id,{expires_at:new Date(Date.now()+qr*1e3).toISOString(),authParams:a,csrf_token:Ve(),authorization_url:h.toString(),ip:g,useragent:$,auth0Client:N});if(p){if(i){const O=await e.data.users.get(o.tenant.id,p.user_id);if((O==null?void 0:O.email)!==i)return t.redirect(`${Ke(t.env)}login/identifier?state=${encodeURIComponent(D.id)}`)}return await e.data.loginSessions.update(o.tenant.id,D.id,{session_id:p.id}),t.redirect(`/u/account?state=${encodeURIComponent(D.id)}`)}return t.redirect(`${Ke(t.env)}login/identifier?state=${encodeURIComponent(D.id)}`)});function kE(t){const e=new s.OpenAPIHono;e.use(async(r,i)=>{const o=ns(r,t.dataAdapter),a=t.dataAdapter.cache||$s({defaultTtlSeconds:0,maxEntries:100,cleanupIntervalMs:0}),l=t.dataAdapter.cache?300:0,u=Sl(o,{defaultTtl:l,cacheEntities:["tenants","connections","customDomains","clients","branding","themes","promptSettings","forms"],cache:a});return r.env.data=$l(r,u),i()}),e.use("/oauth/token",wm({origin:r=>r||"",allowHeaders:["Tenant-Id","Content-Type","Auth0-Client","Upgrade-Insecure-Requests"],allowMethods:["POST"],maxAge:600})),e.use(El).use(Al).use(mf(e));const n=e.route("/v2/logout",Wx).route("/userinfo",Xx).route("/.well-known",Jx).route("/oauth/token",fE).route("/dbconnections",mE).route("/passwordless",_E).route("/co/authenticate",wE).route("/authorize",EE).route("/account",SE).route("/callback",Kx);return n.doc("/spec",{openapi:"3.0.0",info:{version:"1.0.0",title:"Oauth API"},security:[{oauth2:["openid","email","profile"]}]}),gf(n),n}var iy=(t,...e)=>{const n=[""];for(let r=0,i=t.length-1;r<i;r++){n[0]+=t[r];const o=Array.isArray(e[r])?e[r].flat(1/0):[e[r]];for(let a=0,l=o.length;a<l;a++){const u=o[a];if(typeof u=="string")_r(u,n);else if(typeof u=="number")n[0]+=u;else{if(typeof u=="boolean"||u===null||u===void 0)continue;if(typeof u=="object"&&u.isEscaped)if(u.callbacks)n.unshift("",u);else{const d=u.toString();d instanceof Promise?n.unshift("",d):n[0]+=d}else u instanceof Promise?n.unshift("",u):_r(u.toString(),n)}}}return n[0]+=t.at(-1),n.length===1?"callbacks"in n?ln(O1(ln(n[0],n.callbacks))):ln(n[0]):I1(n,n.callbacks)},Of=Symbol("RENDERER"),ep=Symbol("ERROR_HANDLER"),We=Symbol("STASH"),oy=Symbol("INTERNAL"),NE=Symbol("MEMO"),pc=Symbol("PERMALINK"),Rg=t=>(t[oy]=!0,t),sy=t=>({value:e,children:n})=>{if(!n)return;const r={children:[{tag:Rg(()=>{t.push(e)}),props:{}}]};Array.isArray(n)?r.children.push(...n.flat()):r.children.push(n),r.children.push({tag:Rg(()=>{t.pop()}),props:{}});const i={tag:"",props:r,type:""};return i[ep]=o=>{throw t.pop(),o},i},ay=t=>{const e=[t],n=sy(e);return n.values=e,n.Provider=n,Mi.push(n),n},Mi=[],cy=t=>{const e=[t],n=r=>{e.push(r.value);let i;try{i=r.children?(Array.isArray(r.children)?new py("",{},r.children):r.children).toString():""}finally{e.pop()}return i instanceof Promise?i.then(o=>ln(o,o.callbacks)):ln(i)};return n.values=e,n.Provider=n,n[Of]=sy(e),Mi.push(n),n},co=t=>t.values.at(-1),ca={title:[],script:["src"],style:["data-href"],link:["href"],meta:["name","httpEquiv","charset","itemProp"]},tp={},la="data-precedence",Es=t=>Array.isArray(t)?t:[t],Pg=new WeakMap,Bg=(t,e,n,r)=>({buffer:i,context:o})=>{if(!i)return;const a=Pg.get(o)||{};Pg.set(o,a);const l=a[t]||(a[t]=[]);let u=!1;const d=ca[t];if(d.length>0){e:for(const[,p]of l)for(const h of d)if(((p==null?void 0:p[h])??null)===(n==null?void 0:n[h])){u=!0;break e}}if(u?i[0]=i[0].replaceAll(e,""):d.length>0?l.push([e,n,r]):l.unshift([e,n,r]),i[0].indexOf("</head>")!==-1){let p;if(r===void 0)p=l.map(([h])=>h);else{const h=[];p=l.map(([g,,A])=>{let $=h.indexOf(A);return $===-1&&(h.push(A),$=h.length-1),[g,$]}).sort((g,A)=>g[1]-A[1]).map(([g])=>g)}p.forEach(h=>{i[0]=i[0].replaceAll(h,"")}),i[0]=i[0].replace(/(?=<\/head>)/,p.join(""))}},Ss=(t,e,n)=>ln(new un(t,n,Es(e??[])).toString()),ks=(t,e,n,r)=>{if("itemProp"in n)return Ss(t,e,n);let{precedence:i,blocking:o,...a}=n;i=r?i??"":void 0,r&&(a[la]=i);const l=new un(t,a,Es(e||[])).toString();return l instanceof Promise?l.then(u=>ln(l,[...u.callbacks||[],Bg(t,u,a,i)])):ln(l,[Bg(t,l,a,i)])},CE=({children:t,...e})=>{const n=zf();if(n){const r=co(n);if(r==="svg"||r==="head")return new un("title",e,Es(t??[]))}return ks("title",t,e,!1)},TE=({children:t,...e})=>{const n=zf();return["src","async"].some(r=>!e[r])||n&&co(n)==="head"?Ss("script",t,e):ks("script",t,e,!1)},IE=({children:t,...e})=>["href","precedence"].every(n=>n in e)?(e["data-href"]=e.href,delete e.href,ks("style",t,e,!0)):Ss("style",t,e),OE=({children:t,...e})=>["onLoad","onError"].some(n=>n in e)||e.rel==="stylesheet"&&(!("precedence"in e)||"disabled"in e)?Ss("link",t,e):ks("link",t,e,"precedence"in e),zE=({children:t,...e})=>{const n=zf();return n&&co(n)==="head"?Ss("meta",t,e):ks("meta",t,e,!1)},ly=(t,{children:e,...n})=>new un(t,n,Es(e??[])),DE=t=>(typeof t.action=="function"&&(t.action=pc in t.action?t.action[pc]:void 0),ly("form",t)),uy=(t,e)=>(typeof e.formAction=="function"&&(e.formAction=pc in e.formAction?e.formAction[pc]:void 0),ly(t,e)),RE=t=>uy("input",t),PE=t=>uy("button",t);const iu=Object.freeze(Object.defineProperty({__proto__:null,button:PE,form:DE,input:RE,link:OE,meta:zE,script:TE,style:IE,title:CE},Symbol.toStringTag,{value:"Module"}));var BE=new Map([["className","class"],["htmlFor","for"],["crossOrigin","crossorigin"],["httpEquiv","http-equiv"],["itemProp","itemprop"],["fetchPriority","fetchpriority"],["noModule","nomodule"],["formAction","formaction"]]),fc=t=>BE.get(t)||t,dy=(t,e)=>{for(const[n,r]of Object.entries(t)){const i=n[0]==="-"||!/[A-Z]/.test(n)?n:n.replace(/[A-Z]/g,o=>`-${o.toLowerCase()}`);e(i,r==null?null:typeof r=="number"?i.match(/^(?:a|border-im|column(?:-c|s)|flex(?:$|-[^b])|grid-(?:ar|[^a])|font-w|li|or|sca|st|ta|wido|z)|ty$/)?`${r}`:`${r}px`:r)}},Xo=void 0,zf=()=>Xo,jE=t=>/[A-Z]/.test(t)&&t.match(/^(?:al|basel|clip(?:Path|Rule)$|co|do|fill|fl|fo|gl|let|lig|i|marker[EMS]|o|pai|pointe|sh|st[or]|text[^L]|tr|u|ve|w)/)?t.replace(/([A-Z])/g,"-$1").toLowerCase():t,LE=["area","base","br","col","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],FE=["allowfullscreen","async","autofocus","autoplay","checked","controls","default","defer","disabled","download","formnovalidate","hidden","inert","ismap","itemscope","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","selected"],Df=(t,e)=>{for(let n=0,r=t.length;n<r;n++){const i=t[n];if(typeof i=="string")_r(i,e);else{if(typeof i=="boolean"||i===null||i===void 0)continue;i instanceof un?i.toStringToBuffer(e):typeof i=="number"||i.isEscaped?e[0]+=i:i instanceof Promise?e.unshift("",i):Df(i,e)}}},un=class{constructor(t,e,n){be(this,"tag");be(this,"props");be(this,"key");be(this,"children");be(this,"isEscaped",!0);be(this,"localContexts");this.tag=t,this.props=e,this.children=n}get type(){return this.tag}get ref(){return this.props.ref||null}toString(){var e,n;const t=[""];(e=this.localContexts)==null||e.forEach(([r,i])=>{r.values.push(i)});try{this.toStringToBuffer(t)}finally{(n=this.localContexts)==null||n.forEach(([r])=>{r.values.pop()})}return t.length===1?"callbacks"in t?O1(ln(t[0],t.callbacks)).toString():t[0]:I1(t,t.callbacks)}toStringToBuffer(t){const e=this.tag,n=this.props;let{children:r}=this;t[0]+=`<${e}`;const i=Xo&&co(Xo)==="svg"?o=>jE(fc(o)):o=>fc(o);for(let[o,a]of Object.entries(n))if(o=i(o),o!=="children"){if(o==="style"&&typeof a=="object"){let l="";dy(a,(u,d)=>{d!=null&&(l+=`${l?";":""}${u}:${d}`)}),t[0]+=' style="',_r(l,t),t[0]+='"'}else if(typeof a=="string")t[0]+=` ${o}="`,_r(a,t),t[0]+='"';else if(a!=null)if(typeof a=="number"||a.isEscaped)t[0]+=` ${o}="${a}"`;else if(typeof a=="boolean"&&FE.includes(o))a&&(t[0]+=` ${o}=""`);else if(o==="dangerouslySetInnerHTML"){if(r.length>0)throw new Error("Can only set one of `children` or `props.dangerouslySetInnerHTML`.");r=[ln(a.__html)]}else if(a instanceof Promise)t[0]+=` ${o}="`,t.unshift('"',a);else if(typeof a=="function"){if(!o.startsWith("on")&&o!=="ref")throw new Error(`Invalid prop '${o}' of type 'function' supplied to '${e}'.`)}else t[0]+=` ${o}="`,_r(a.toString(),t),t[0]+='"'}if(LE.includes(e)&&r.length===0){t[0]+="/>";return}t[0]+=">",Df(r,t),t[0]+=`</${e}>`}},ou=class extends un{toStringToBuffer(t){const{children:e}=this,n=this.tag.call(null,{...this.props,children:e.length<=1?e[0]:e});if(!(typeof n=="boolean"||n==null))if(n instanceof Promise)if(Mi.length===0)t.unshift("",n);else{const r=Mi.map(i=>[i,i.values.at(-1)]);t.unshift("",n.then(i=>(i instanceof un&&(i.localContexts=r),i)))}else n instanceof un?n.toStringToBuffer(t):typeof n=="number"||n.isEscaped?(t[0]+=n,n.callbacks&&(t.callbacks||(t.callbacks=[]),t.callbacks.push(...n.callbacks))):_r(n,t)}},py=class extends un{toStringToBuffer(t){Df(this.children,t)}},UE=(t,e,...n)=>{e??(e={}),n.length&&(e.children=n.length===1?n[0]:n);const r=e.key;delete e.key;const i=ua(t,e,n);return i.key=r,i},jg=!1,ua=(t,e,n)=>{if(!jg){for(const r in tp)iu[r][Of]=tp[r];jg=!0}return typeof t=="function"?new ou(t,e,n):iu[t]?new ou(iu[t],e,n):t==="svg"||t==="head"?(Xo||(Xo=cy("")),new un(t,e,[new ou(Xo,{value:t},n)])):new un(t,e,n)},Rf=({children:t})=>new py("",{children:t},Array.isArray(t)?t:t?[t]:[]),ME=(t,e,...n)=>{let r;if(n.length>0)r=n;else{const i=t.props.children;r=Array.isArray(i)?i:[i]}return UE(t.tag,{...t.props,...e},...r)};function y(t,e,n){let r;if(!e||!("children"in e))r=ua(t,e,[]);else{const i=e.children;r=Array.isArray(i)?ua(t,e,i):ua(t,e,[i])}return r.key=n,r}async function Ue(t,e,n=!1){var p;const{env:r}=t,i=await r.data.loginSessions.get(t.var.tenant_id||"",e);if(!i)throw new C(400,{message:"Login session not found"});t.set("loginSession",i);const o=await ao(r,i.authParams.client_id);t.set("client_id",o.id),t.set("tenant_id",o.tenant.id);const a=await r.data.tenants.get(o.tenant.id);if(a){if(i.session_id&&!n){if(!i.authParams.redirect_uri)throw new C(400,{message:"Login session closed and no redirect URI available"});const h=new URL(i.authParams.redirect_uri);throw h.searchParams.set("error","access_denied"),h.searchParams.set("error_description","Login session closed"),i.authParams.state&&h.searchParams.set("state",i.authParams.state),new xs(h.toString(),302)}}else throw new C(400,{message:"Tenant not found"});const l=await r.data.themes.get(a.id,"default"),u=await r.data.branding.get(a.id),d=(p=i.authParams.ui_locales)==null?void 0:p.split(" ").map(h=>h.split("-")[0]).find(h=>{if(Array.isArray(B.options.supportedLngs))return B.options.supportedLngs.includes(h)});return await B.changeLanguage(d||a.language||"sv"),{theme:l,branding:u,client:o,tenant:a,loginSession:i}}async function qE(t,e,n,r){if(r!==void 0)return r==="password";const i=await Ep({userAdapter:t.env.data.users,tenant_id:e.tenant.id,email:n});return i!=null&&i.app_metadata.strategy?i.app_metadata.strategy==="Username-Password-Authentication":(await t.env.data.promptSettings.get(e.tenant.id)).password_first}const fy=({theme:t,branding:e})=>{var r;const n=((r=t==null?void 0:t.widget)==null?void 0:r.logo_url)||(e==null?void 0:e.logo_url);return n?y("div",{className:"flex h-9 items-center",children:y("img",{src:n,className:"max-h-full",alt:"Logo"})}):y(Rf,{})},hy=t=>{var e,n;return y("div",{className:"mt-8",children:((n=(e=t.client)==null?void 0:e.client_metadata)==null?void 0:n.termsAndConditionsUrl)&&y("div",{className:"text-xs text-gray-300",children:[B.t("agree_to")," ",y("a",{href:t.client.client_metadata.termsAndConditionsUrl,className:"text-primary hover:underline",target:"_blank",rel:"noreferrer",children:B.t("terms")})]})})};var gy={exports:{}};/*!
197
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ZA(t,e){if(t){if(typeof t=="string")return Cg(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Cg(t,e)}}function Cg(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function QA(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r=[],i=!0,o=!1,a,l;try{for(n=n.call(t);!(i=(a=n.next()).done)&&(r.push(a.value),!(e&&r.length===e));i=!0);}catch(u){o=!0,l=u}finally{try{!i&&n.return!=null&&n.return()}finally{if(o)throw l}}return r}}function eE(t){if(Array.isArray(t))return t}function tE(t){var e=Array.prototype.slice.call(t),n=JA(e,4),r=n[0],i=n[1],o=n[2],a=n[3],l,u,d;if(typeof r=="string")l=r;else throw new TypeError("A text for parsing must be a string.");if(!i||typeof i=="string")a?(u=o,d=a):(u=void 0,d=o),i&&(u=WA({defaultCountry:i},u));else if(Ti(i))o?(u=i,d=o):d=i;else throw new Error("Invalid second argument: ".concat(i));return{text:l,options:u,metadata:d}}function Tg(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Ig(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Tg(Object(n),!0).forEach(function(r){nE(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Tg(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function nE(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function rE(t,e,n){e&&e.defaultCountry&&!f5(e.defaultCountry,n)&&(e=Ig(Ig({},e),{},{defaultCountry:void 0}));try{return GA(t,e,n)}catch(r){if(!(r instanceof jn))throw r}}function iE(){var t=tE(arguments),e=t.text,n=t.options,r=t.metadata;return rE(e,n,r)}function oE(){return r5(iE,arguments)}function Tl(t,e="US"){const n=t.trim();if(n.includes("@")){const r=n.toLowerCase(),i=/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(r);return{connectionType:"email",normalized:i?r:null,isValid:i}}else if(/^\+?\d[\d\s\-().]*$/.test(n)){const r=oE(n,{defaultCountry:e});return r&&r.isValid()?{connectionType:"sms",normalized:r.number,isValid:!0}:{connectionType:"sms",normalized:null,isValid:!1}}else return{connectionType:"username",normalized:n,isValid:!0}}function Af(t){let e=t.trim();e.startsWith("[")&&e.endsWith("]")&&(e=e.slice(1,-1));const n=e.indexOf("%");return n!==-1&&(e=e.slice(0,n)),e}function sE(t){const n=Af(t).split(".");return n.length!==4?!1:n.every(r=>/^\d+$/.test(r)&&Number(r)>=0&&Number(r)<=255)}function aE(t){const e=Af(t);if(e.length<2||e.indexOf(":")===-1||!/^[0-9a-fA-F:.]+$/.test(e))return!1;const n=e.split(":");return e.includes("::")?n.length<=8:n.length===8}function cE(t){let e=t.trim();const n=/^\[([^\]]+)\](?::\d+)?$/,r=e.match(n);if(r&&r[1])return r[1];const i=e.lastIndexOf(":");if(i!==-1){const o=e.slice(0,i),a=e.slice(i+1);/^[0-9.]+$/.test(o)&&/^\d+$/.test(a)&&(e=o)}return e}function Og(t){if(!t)return null;const e=Af(cE(t));return sE(e)?{family:4,normalized:e}:aE(e)?{family:6,normalized:e.toLowerCase()}:null}function zg(t){if(t.includes("::")){let[e,n]=t.split("::"),r=e?e.split(":").filter(Boolean):[],i=n?n.split(":").filter(Boolean):[],o=8-(r.length+i.length);return[...r.map(a=>a.toLowerCase()||"0"),...Array(o).fill("0"),...i.map(a=>a.toLowerCase()||"0")]}else return t.split(":").map(e=>e.toLowerCase()||"0")}function lE(t,e,n=!0){const r=Og(t),i=Og(e);if(!r||!i||r.family!==i.family)return!1;if(r.family===4)return r.normalized===i.normalized;const o=zg(r.normalized),a=zg(i.normalized);return n?o.length===8&&a.length===8&&o.join(":")===a.join(":"):o.slice(0,4).join(":")===a.slice(0,4).join(":")}class xs extends Error{constructor(n,r=302){super(`Redirect to ${n}`);be(this,"location");be(this,"status");this.name=xs.name,this.location=n,this.status=r}}const uE=s.z.object({client_id:s.z.string(),username:s.z.string().transform(t=>t.toLowerCase()),otp:s.z.string(),authParams:Io.optional(),enforceIpCheck:s.z.boolean().optional().default(!1)});async function Y1(t,{client_id:e,username:n,otp:r,authParams:i,enforceIpCheck:o=!1}){var N;const a=t.get("ip"),l=t.get("countryCode"),{connectionType:u,normalized:d}=Tl(n,l);if(!d)throw new C(400,{message:"Invalid username format"});const p=await t.env.data.clients.get(e);if(!p)throw new C(403,{message:"Client not found"});const{env:h}=t,g=await h.data.codes.get(p.tenant.id,r,"otp");if(!g)throw new C(400,{message:xe("code_invalid")});if(g.expires_at<new Date().toISOString())throw new C(400,{message:xe("code_expired")});if(g.used_at)throw new C(400,{message:xe("code_used")});const A=await h.data.loginSessions.get(p.tenant.id,g.login_id);if(!A||A.authParams.username!==n)throw new C(400,{message:"Code not found or expired"});if(o&&A.ip&&a&&!lE(A.ip,a))throw new xs(`${ut(t.env)}invalid-session?state=${A.id}`);const $=await Tc(t,{client:p,username:d,provider:u,connection:u,isSocial:!1,ip:t.req.header("x-real-ip")});return await h.data.codes.used(p.tenant.id,r),((N=$.app_metadata)==null?void 0:N.strategy)!=="email"&&Bt(t,t.env.data.users.update(p.tenant.id,$.user_id,{app_metadata:{...$.app_metadata||{},strategy:"email"}})),{user:$,client:p,loginSession:A,session_id:A.session_id,authParams:{...A.authParams,...i||{}}}}async function Ef(t,e){const n=await Y1(t,e);return Sr(t,{authParams:n.authParams,client:n.client,user:n.user,loginSession:n.loginSession})}const Dg=s.z.object({client_id:s.z.string().optional(),client_secret:s.z.string().optional()}),dE=s.z.union([M1.extend(Dg.shape),s.z.object({grant_type:s.z.literal("authorization_code"),client_id:s.z.string(),code:s.z.string(),redirect_uri:s.z.string(),code_verifier:s.z.string().min(43).max(128)}),s.z.object({grant_type:s.z.literal("authorization_code"),code:s.z.string(),redirect_uri:s.z.string().optional(),...Dg.shape}),s.z.object({grant_type:s.z.literal("refresh_token"),client_id:s.z.string(),refresh_token:s.z.string(),redirect_uri:s.z.string().optional()}),s.z.object({grant_type:s.z.literal("http://auth0.com/oauth/grant-type/passwordless/otp"),client_id:s.z.string(),username:s.z.string(),otp:s.z.string(),realm:s.z.enum(["email","sms"])})]);function pE(t){if(!t)return{};const[e,n]=t.split(" ");if((e==null?void 0:e.toLowerCase())==="basic"&&n){const[r,i]=atob(n).split(":");return{client_id:r,client_secret:i}}return{}}const fE=new s.OpenAPIHono().openapi(s.createRoute({tags:["oauth2"],method:"post",path:"/",request:{body:{content:{"application/x-www-form-urlencoded":{schema:dE}}}},responses:{200:{content:{"application/json":{schema:gp}},description:"Tokens"},302:{description:"Redirect for further user interaction (e.g., MFA, consent).",headers:s.z.object({Location:s.z.string().url()}).openapi({})},400:{description:"Bad Request - The request was malformed or invalid.",content:{"application/json":{schema:s.z.object({error:s.z.string(),error_description:s.z.string().optional()})}}},401:{description:"Unauthorized - Client authentication failed.",content:{"application/json":{schema:s.z.object({error:s.z.string(),error_description:s.z.string().optional()})}}}}}),async t=>{const e=t.req.valid("form"),n=pE(t.req.header("Authorization")),r={...e,...n};if(!r.client_id)throw new C(400,{message:"client_id is required"});t.set("client_id",r.client_id);let i;switch(e.grant_type){case $i.AuthorizationCode:i=await Qx(t,Zx.parse(r));break;case $i.ClientCredential:i=await Yx(t,M1.parse(r));break;case $i.RefreshToken:i=await t5(t,e5.parse(r));break;case $i.OTP:i=await Y1(t,uE.parse(r));break;default:return t.json({error:"unsupported_grant_type",error_description:"Grant type not implemented"},400)}const o=new Headers;if(i.session_id){const l=ka(i.client.tenant.id,i.session_id,t.var.host||"");o.set("Set-Cookie",l)}const a=await Cc(t,i);return t.json(a,{headers:o})});var Sf={exports:{}};const kf=[{id:0,value:"Too weak",minDiversity:0,minLength:0},{id:1,value:"Weak",minDiversity:2,minLength:6},{id:2,value:"Medium",minDiversity:4,minLength:8},{id:3,value:"Strong",minDiversity:4,minLength:10}],Z1=(t,e=kf,n="!\"#$%&'()*+,-./:;<=>?@[\\\\\\]^_`{|}~")=>{let r=t||"";e[0].minDiversity=0,e[0].minLength=0;const i=[{regex:"[a-z]",message:"lowercase"},{regex:"[A-Z]",message:"uppercase"},{regex:"[0-9]",message:"number"}];n&&i.push({regex:`[${n}]`,message:"symbol"});let o={};o.contains=i.filter(l=>new RegExp(`${l.regex}`).test(r)).map(l=>l.message),o.length=r.length;let a=e.filter(l=>o.contains.length>=l.minDiversity).filter(l=>o.length>=l.minLength).sort((l,u)=>u.id-l.id).map(l=>({id:l.id,value:l.value}));return Object.assign(o,a[0]),o};Sf.exports={passwordStrength:Z1,defaultOptions:kf};var hE=Sf.exports.passwordStrength=Z1;Sf.exports.defaultOptions=kf;function Nf(t){return hE(t).id<2?!1:t.length>=8&&/[a-z]/.test(t)&&/[A-Z]/.test(t)&&/[0-9]/.test(t)&&/[^A-Za-z0-9]/.test(t)}async function As(t,e){var i;const n=await t.env.data.emailProviders.get(t.var.tenant_id)||(t.env.DEFAULT_TENANT_ID?await t.env.data.emailProviders.get(t.env.DEFAULT_TENANT_ID):null);if(!n)throw new C(500,{message:"Email provider not found"});const r=(i=t.env.emailProviders)==null?void 0:i[n.name];if(!r)throw new C(500,{message:"Email provider not found"});await r({emailProvider:n,...e,from:n.default_from_address||`login@${t.env.ISSUER}`})}async function Q1(t,e){var a,l;if(!t.var.client_id)throw new C(500,{message:"Client not found"});const n=await ao(t.env,t.var.client_id),r=n.connections.find(u=>u.strategy==="sms");if(!r)throw new C(500,{message:"SMS provider not found"});const i=((a=r.options)==null?void 0:a.provider)||"twilio",o=(l=t.env.smsProviders)==null?void 0:l[i];if(!o)throw new C(500,{message:"SMS provider not found"});await o({options:r.options,to:e.to,from:e.from,text:e.text,template:"auth-code",data:{code:e.code,tenantName:n.tenant.name,tenantId:n.tenant.id}})}async function ey(t,e,n,r){const i=await t.env.data.tenants.get(t.var.tenant_id);if(!i)throw new C(500,{message:"Tenant not found"});const o=`${ut(t.env)}reset-password?state=${r}&code=${n}`,a={vendorName:i.name,lng:i.language||"en"};await As(t,{to:e,subject:xe("reset_password_title",a),html:`Click here to reset your password: ${ut(t.env)}reset-password?state=${r}&code=${n}`,template:"auth-password-reset",data:{vendorName:i.name,logo:i.logo||"",passwordResetUrl:o,supportUrl:i.support_url||"https://support.sesamy.com",buttonColor:i.primary_color||"#7d68f4",passwordResetTitle:xe("password_reset_title",a),resetPasswordEmailClickToReset:xe("reset_password_email_click_to_reset",a),resetPasswordEmailReset:xe("reset_password_email_reset",a),supportInfo:xe("support_info",a),contactUs:xe("contact_us",a),copyright:xe("copyright",a),tenantName:i.name,tenantId:i.id}})}async function Cf(t,{to:e,code:n}){const r=await t.env.data.tenants.get(t.var.tenant_id);if(!r)throw new C(500,{message:"Tenant not found"});const{connectionType:i}=Tl(e),o=new URL(ut(t.env)),a={vendorName:r.name,vendorId:r.id,loginDomain:o.hostname,code:n,lng:r.language||"en"};i==="email"?await As(t,{to:e,subject:xe("code_email_subject",a),html:`Click here to validate your email: ${ut(t.env)}validate-email`,template:"auth-code",data:{code:n,vendorName:r.name,logo:r.logo||"",supportUrl:r.support_url||"",buttonColor:r.primary_color||"",welcomeToYourAccount:xe("welcome_to_your_account",a),linkEmailClickToLogin:xe("link_email_click_to_login",a),linkEmailLogin:xe("link_email_login",a),linkEmailOrEnterCode:xe("link_email_or_enter_code",a),codeValid30Mins:xe("code_valid_30_minutes",a),supportInfo:xe("support_info",a),contactUs:xe("contact_us",a),copyright:xe("copyright",a)}}):i==="sms"&&await Q1(t,{to:e,text:xe("sms_code_text",a),code:n,from:r.name});const l=Me(t,{type:Le.CODE_LINK_SENT,description:e});Bt(t,t.env.data.logs.create(r.id,l))}async function Tf(t,{to:e,code:n,authParams:r}){const i=await t.env.data.tenants.get(t.var.tenant_id);if(!i)throw new C(500,{message:"Tenant not found"});if(!r.redirect_uri)throw new C(400,{message:"redirect_uri is required"});const{connectionType:o}=Tl(e),a=new URL(at(t.env));a.pathname="passwordless/verify_redirect",a.searchParams.set("verification_code",n),a.searchParams.set("connection",o),a.searchParams.set("client_id",r.client_id),a.searchParams.set("redirect_uri",r.redirect_uri),a.searchParams.set("email",e),r.response_type&&a.searchParams.set("response_type",r.response_type),r.scope&&a.searchParams.set("scope",r.scope),r.state&&a.searchParams.set("state",r.state),r.nonce&&a.searchParams.set("nonce",r.nonce),r.code_challenge&&a.searchParams.set("code_challenge",r.code_challenge),r.code_challenge_method&&a.searchParams.set("code_challenge_method",r.code_challenge_method),r.audience&&a.searchParams.set("audience",r.audience);const l={vendorName:i.name,code:n,lng:i.language||"en"};if(o==="email")await As(t,{to:e,subject:xe("code_email_subject",l),html:`Click here to validate your email: ${ut(t.env)}validate-email`,template:"auth-link",data:{code:n,vendorName:i.name,logo:i.logo||"",supportUrl:i.support_url||"",magicLink:a.toString(),buttonColor:i.primary_color||"",welcomeToYourAccount:xe("welcome_to_your_account",l),linkEmailClickToLogin:xe("link_email_click_to_login",l),linkEmailLogin:xe("link_email_login",l),linkEmailOrEnterCode:xe("link_email_or_enter_code",l),codeValid30Mins:xe("code_valid_30_minutes",l),supportInfo:xe("support_info",l),contactUs:xe("contact_us",l),copyright:xe("copyright",l)}});else if(o==="sms")await Q1(t,{to:e,text:`${xe("link_sms_login",l)}: ${a.toString()}`,code:n,from:i.name});else throw new C(400,{message:"Only email and SMS connections are supported for magic links"});const u=Me(t,{type:Le.CODE_LINK_SENT,description:e});Bt(t,t.env.data.logs.create(i.id,u))}async function If(t,e){const n=await t.env.data.tenants.get(t.var.tenant_id);if(!n)throw new C(500,{message:"Tenant not found"});if(!e.email)throw new C(400,{message:"User has no email"});const r={vendorName:n.name,lng:n.language||"en"};await As(t,{to:e.email,subject:xe("welcome_to_your_account",r),html:`Click here to validate your email: ${ut(t.env)}validate-email`,template:"auth-verify-email",data:{vendorName:n.name,logo:n.logo||"",emailValidationUrl:`${ut(t.env)}validate-email`,supportUrl:n.support_url||"https://support.sesamy.com",buttonColor:n.primary_color||"#7d68f4",welcomeToYourAccount:xe("welcome_to_your_account",r),verifyEmailVerify:xe("verify_email_verify",r),supportInfo:xe("support_info",r),contactUs:xe("contact_us",r),copyright:xe("copyright",r)}})}async function gE(t,e,n,r){const i=await t.env.data.tenants.get(t.var.tenant_id);if(!i)throw new C(500,{message:"Tenant not found"});const o={vendorName:i.name,lng:i.language||"en"},a=`${ut(t.env)}signup?state=${r}&code=${n}`;await As(t,{to:e,subject:xe("register_password_account",o),html:`Click here to register: ${a}`,template:"auth-pre-signup-verification",data:{vendorName:i.name,logo:i.logo||"",signupUrl:a,setPassword:xe("set_password",o),registerPasswordAccount:xe("register_password_account",o),clickToSignUpDescription:xe("click_to_sign_up_description",o),supportUrl:i.support_url||"https://support.sesamy.com",buttonColor:i.primary_color||"#7d68f4",welcomeToYourAccount:xe("welcome_to_your_account",o),verifyEmailVerify:xe("verify_email_verify",o),supportInfo:xe("support_info",o),contactUs:xe("contact_us",o),copyright:xe("copyright",o)}})}const mE=new s.OpenAPIHono().openapi(s.createRoute({tags:["dbconnections"],method:"post",path:"/signup",request:{body:{content:{"application/json":{schema:s.z.object({client_id:s.z.string(),connection:s.z.literal("Username-Password-Authentication"),email:s.z.string().transform(t=>t.toLowerCase()),password:s.z.string()})}}}},responses:{200:{content:{"application/json":{schema:s.z.object({_id:s.z.string(),email:s.z.string().optional(),email_verified:s.z.boolean(),app_metadata:s.z.object({}),user_metadata:s.z.object({})})}},description:"Created user"}}}),async t=>{const{email:e,password:n,client_id:r}=t.req.valid("json"),i=await t.env.data.clients.get(r);if(!i)throw new C(400,{message:"Client not found"});if(t.set("client_id",i.id),t.set("tenant_id",i.tenant.id),!Nf(n))throw new C(400,{message:"Password does not meet the requirements"});if(await Oo({userAdapter:t.env.data.users,tenant_id:i.tenant.id,username:e,provider:"auth2"}))throw new C(400,{message:"Invalid sign up"});const a=await t.env.data.users.create(i.tenant.id,{user_id:`auth2|${Sc()}`,email:e,email_verified:!1,provider:"auth2",connection:"Username-Password-Authentication",is_social:!1});t.set("user_id",a.user_id),t.set("username",a.email),t.set("connection",a.connection);const l=await ts.hash(n,10);await t.env.data.passwords.create(i.tenant.id,{user_id:a.user_id,password:l,algorithm:"bcrypt"}),await If(t,a);const u=Me(t,{type:Le.SUCCESS_SIGNUP,description:"Successful signup"});return await t.env.data.logs.create(i.tenant.id,u),t.json({_id:a.user_id,email:a.email,email_verified:!1,app_metadata:{},user_metadata:{}})}).openapi(s.createRoute({tags:["dbconnections"],method:"post",path:"/change_password",request:{body:{content:{"application/json":{schema:s.z.object({client_id:s.z.string(),connection:s.z.literal("Username-Password-Authentication"),email:s.z.string().transform(t=>t.toLowerCase())})}}}},responses:{200:{description:"Redirect to the client's redirect uri"}}}),async t=>{const{email:e,client_id:n}=t.req.valid("json"),r=await t.env.data.clients.get(n);if(!r)throw new C(400,{message:"Client not found"});if(t.set("client_id",r.id),t.set("tenant_id",r.tenant.id),!await Xi({userAdapter:t.env.data.users,tenant_id:r.tenant.id,username:e,provider:"auth2"}))return t.html("If an account with that email exists, we've sent instructions to reset your password.");const o={client_id:n,username:e},a=await t.env.data.loginSessions.create(r.tenant.id,{expires_at:new Date(Date.now()+qr*1e3).toISOString(),authParams:o,csrf_token:Ve(),ip:t.get("ip"),useragent:t.get("useragent"),auth0Client:Wn(t.get("auth0_client"))});return await ey(t,e,a.id,a.authParams.state),t.html("If an account with that email exists, we've sent instructions to reset your password.")});function $r(){const t="1234567890";let e="";for(let n=0;n<6;n+=1)e+=t[Math.floor(Math.random()*10)];return e.toString()}const _E=new s.OpenAPIHono().openapi(s.createRoute({tags:["passwordless"],method:"post",path:"/start",request:{body:{content:{"application/json":{schema:s.z.union([s.z.object({connection:s.z.literal("email"),client_id:s.z.string(),email:s.z.string().transform(t=>t.toLowerCase()),send:s.z.enum(["link","code"]),authParams:Io.omit({client_id:!0})}),s.z.object({client_id:s.z.string(),connection:s.z.literal("sms"),phone_number:s.z.string(),send:s.z.enum(["link","code"]),authParams:Io.omit({client_id:!0})})])}}}},responses:{200:{description:"Status"}}}),async t=>{const e=t.req.valid("json"),{env:n}=t,{client_id:r,send:i,authParams:o,connection:a}=e,l=await t.env.data.clients.get(r);if(!l)throw new C(400,{message:"Client not found"});t.set("client_id",l.id),t.set("tenant_id",l.tenant.id);const u=a==="email"?e.email:e.phone_number,d=t.get("ip"),p=t.get("useragent"),h=t.get("auth0_client"),g=Wn(h),A=await n.data.loginSessions.create(l.tenant.id,{authParams:{...o,client_id:r,username:u},expires_at:new Date(Date.now()+ea).toISOString(),csrf_token:Ve(),ip:d,useragent:p,auth0Client:g}),$=await n.data.codes.create(l.tenant.id,{code_id:$r(),code_type:"otp",login_id:A.id,expires_at:new Date(Date.now()+ea).toISOString(),redirect_uri:o.redirect_uri});return i==="link"?await Tf(t,{to:u,code:$.code_id,authParams:{...o,client_id:r}}):await Cf(t,{to:u,code:$.code_id}),t.html("OK")}).openapi(s.createRoute({tags:["passwordless"],method:"get",path:"/verify_redirect",request:{query:s.z.object({scope:s.z.string(),response_type:s.z.nativeEnum(rn),redirect_uri:s.z.string(),state:s.z.string(),nonce:s.z.string().optional(),verification_code:s.z.string(),connection:s.z.string(),client_id:s.z.string(),email:s.z.string().transform(t=>t.toLowerCase()),audience:s.z.string().optional()})},responses:{302:{description:"Successful verification, redirecting to continue flow.",headers:s.z.object({Location:s.z.string().url()}).openapi({})},400:{description:"Bad Request (e.g., invalid client, invalid code, missing parameters).",content:{"application/json":{schema:s.z.object({error:s.z.string(),error_description:s.z.string().optional()})}}},500:{description:"Internal Server Error.",content:{"application/json":{schema:s.z.object({error:s.z.string(),error_description:s.z.string().optional()})}}}}}),async t=>{const{env:e}=t,{client_id:n,email:r,verification_code:i,redirect_uri:o,state:a,scope:l,audience:u,response_type:d,nonce:p}=t.req.valid("query"),h=await ao(e,n);t.set("client_id",h.id),t.set("tenant_id",h.tenant.id),t.set("connection","email");const g={client_id:n,redirect_uri:o,state:a,nonce:p,scope:l,audience:u,response_type:d};let A="Something went wrong. Please try again later.";try{const M=await Ef(t,{client_id:n,username:r,otp:i,authParams:g,enforceIpCheck:!0});if(M instanceof Response)return M;if(M&&typeof M=="object"&&"access_token"in M)return t.json(M)}catch(M){const G=M;"message"in G&&typeof G.message=="string"&&(A=G.message)}const $=t.get("ip"),N=t.get("useragent"),D=t.get("auth0_client"),O=Wn(D),x=await e.data.loginSessions.create(h.tenant.id,{authParams:{...g,username:r},expires_at:new Date(Date.now()+ea).toISOString(),csrf_token:Ve(),ip:$,useragent:N,auth0Client:O});return t.redirect(`${ut(t.env)}invalid-session?state=${x.id}&error=${encodeURIComponent(A)}`,302)});class yi extends C{constructor(n,r){super(n,r);be(this,"_code");this._code=r==null?void 0:r.code}get code(){return this._code}}async function ty(t,e,n,r){var A;const{data:i}=t.env,{username:o}=n;if(t.set("username",o),!o)throw new C(400,{message:"Username is required"});const a=await Xi({userAdapter:t.env.data.users,tenant_id:e.tenant.id,username:o,provider:"auth2"});if(!a){const $=Me(t,{type:Le.FAILED_LOGIN_INCORRECT_PASSWORD,description:"Invalid user"});throw Bt(t,i.logs.create(e.tenant.id,$)),new yi(403,{message:"User not found",code:"USER_NOT_FOUND"})}const l=a.linked_to?await i.users.get(e.tenant.id,a.linked_to):a;if(!l)throw new yi(403,{message:"User not found",code:"USER_NOT_FOUND"});t.set("connection",a.connection),t.set("user_id",l.user_id);const u=await i.passwords.get(e.tenant.id,a.user_id);if(!(u&&await ts.compare(n.password,u.password))){const $=Me(t,{type:Le.FAILED_LOGIN_INCORRECT_PASSWORD,description:"Invalid password"});throw Bt(t,i.logs.create(e.tenant.id,$)),new yi(403,{message:"Invalid password",code:"INVALID_PASSWORD"})}if((await i.logs.list(e.tenant.id,{page:0,per_page:10,include_totals:!1,q:`user_id:${l.user_id}`})).logs.filter($=>$.type===Le.FAILED_LOGIN_INCORRECT_PASSWORD&&new Date($.date)>new Date(Date.now()-1e3*60*5)).length>=3){const $=Me(t,{type:Le.FAILED_LOGIN,description:"Too many failed login attempts"});throw Bt(t,i.logs.create(e.tenant.id,$)),new yi(403,{message:"Too many failed login attempts",code:"TOO_MANY_FAILED_LOGINS"})}if(!a.email_verified&&e.email_validation==="enforced"){await If(t,a);const $=Me(t,{type:Le.FAILED_LOGIN,description:"Email not verified"});throw await i.logs.create(e.tenant.id,$),new yi(403,{message:"Email not verified",code:"EMAIL_NOT_VERIFIED"})}((A=l.app_metadata)==null?void 0:A.strategy)!=="Username-Password-Authentication"&&Bt(t,i.users.update(e.tenant.id,l.user_id,{app_metadata:{...l.app_metadata||{},strategy:"Username-Password-Authentication"}}));const g=Me(t,{type:Le.SUCCESS_LOGIN,description:"Successful login",strategy_type:"Username-Password-Authentication",strategy:"Username-Password-Authentication"});return Bt(t,i.logs.create(e.tenant.id,g)),{client:e,authParams:n,user:l,loginSession:r}}async function ny(t,e,n,r,i){const o=await ty(t,e,n,r);return Sr(t,{...o,ticketAuth:i})}async function yE(t,e,n,r){await Tc(t,{client:e,username:n,provider:"auth2",connection:"Username-Password-Authentication",isSocial:!1,ip:t.req.header("x-real-ip")});let i=$r(),o=await t.env.data.codes.get(e.tenant.id,i,"password_reset");for(;o;)i=$r(),o=await t.env.data.codes.get(e.tenant.id,i,"password_reset");const a=t.get("ip"),l=t.get("useragent"),u=t.get("auth0_client"),d=Wn(u),p=await t.env.data.loginSessions.create(e.tenant.id,{expires_at:new Date(Date.now()+Dv).toISOString(),authParams:{client_id:e.id,username:n},csrf_token:Ve(),ip:a,useragent:l,auth0Client:d}),h=await t.env.data.codes.create(e.tenant.id,{code_id:i,code_type:"password_reset",login_id:p.id,expires_at:new Date(Date.now()+zv).toISOString()});await ey(t,n,h.code_id,r)}const wE=new s.OpenAPIHono().openapi(s.createRoute({tags:["oauth"],method:"post",path:"/",request:{body:{content:{"application/json":{schema:s.z.union([s.z.object({credential_type:s.z.literal("http://auth0.com/oauth/grant-type/passwordless/otp"),otp:s.z.string(),client_id:s.z.string(),username:s.z.string().transform(t=>t.toLowerCase()),realm:s.z.enum(["email"]),scope:s.z.string().optional()}),s.z.object({credential_type:s.z.literal("http://auth0.com/oauth/grant-type/password-realm"),client_id:s.z.string(),username:s.z.string().transform(t=>t.toLowerCase()),password:s.z.string(),realm:s.z.enum(["Username-Password-Authentication"]),scope:s.z.string().optional()})])}}}},responses:{200:{description:"List of tenants"}}}),async t=>{const e=t.req.valid("json"),{client_id:n,username:r}=e;t.set("username",r);const i=await t.env.data.clients.get(n);if(!i)throw new C(400,{message:"Client not found"});t.set("client_id",n),t.set("tenant_id",i.tenant.id);const o=r.toLocaleLowerCase(),a=t.get("ip"),l=t.get("useragent"),u=t.get("auth0_client");let d;if("otp"in e)d=await Ef(t,{client_id:n,username:o,otp:e.otp});else if("password"in e){const p=await t.env.data.loginSessions.create(i.tenant.id,{expires_at:new Date(Date.now()+qr*1e3).toISOString(),authParams:{client_id:n,username:o},csrf_token:Ve(),ip:a,useragent:l,auth0Client:Wn(u)});d=await ny(t,i,{username:o,password:e.password,client_id:n},p,!0)}else throw new C(400,{message:"Code or password required"});if(!(d instanceof Response))throw new C(500,{message:"Unexpected response from loginWithPassword"});return d});function ry(t,e){var r,i,o;if(!t||e.length===0)return!1;const n=((r=ru(t))==null?void 0:r.host)??null;if(!n)return!1;for(const a of e){let l;if(a.startsWith("http://")||a.startsWith("https://")?l=((i=ru(a))==null?void 0:i.host)??null:l=((o=ru("https://"+a))==null?void 0:o.host)??null,n===l)return!0}return!1}function ru(t){try{return new URL(t)}catch{return null}}async function vE({ctx:t,session:e,client:n,authParams:r,connection:i,login_hint:o}){const a=new URL(t.req.url);t.var.custom_domain&&(a.hostname=t.var.custom_domain);const{ip:l,auth0_client:u,useragent:d}=t.var,p=Wn(u),h=await t.env.data.loginSessions.create(n.tenant.id,{expires_at:new Date(Date.now()+qr*1e3).toISOString(),authParams:r,csrf_token:Ve(),authorization_url:a.toString(),ip:l,useragent:d,auth0Client:p});if(e&&o){const g=await t.env.data.users.get(n.tenant.id,e.user_id);if((g==null?void 0:g.email)===o)return await t.env.data.loginSessions.update(n.tenant.id,h.id,{session_id:e.id}),Sr(t,{client:n,loginSession:{...h,session_id:e.id},authParams:r,user:g,sessionId:e.id})}if(i==="email"&&o){const g=$r();return await t.env.data.codes.create(n.tenant.id,{code_id:g,code_type:"otp",login_id:h.id,expires_at:new Date(Date.now()+qr*1e3).toISOString(),redirect_uri:r.redirect_uri}),await Tf(t,{code:g,to:o,authParams:r}),t.redirect(`/u/enter-code?state=${h.id}`)}return e?t.redirect(`/u/check-account?state=${h.id}`):t.redirect(`/u/login/identifier?state=${h.id}`)}function bE(t){if(t==="Username-Password-Authentication")return"auth2";if(t==="email")return"email";throw new C(403,{message:"Invalid realm"})}async function $E(t,e,n,r,i){var g;const{env:o}=t;t.set("connection",i);const a=await o.data.codes.get(e,n,"ticket");if(!a||a.used_at)throw new C(403,{message:"Ticket not found"});const l=await o.data.loginSessions.get(e,a.login_id);if(!l||!l.authParams.username)throw new C(403,{message:"Session not found"});const u=await o.data.clients.get(l.authParams.client_id);if(!u)throw new C(403,{message:"Client not found"});t.set("client_id",l.authParams.client_id),await o.data.codes.used(e,n);const d=bE(i);let p=await Tc(t,{username:l.authParams.username,provider:d,client:u,connection:d==="auth2"?"Username-Password-Authentication":"email",isSocial:!1,ip:t.req.header("x-real-ip")});t.set("username",p.email||p.phone_number),t.set("user_id",p.user_id);const h=await T_(t,{user:p,client:u,loginSession:l});return Sr(t,{authParams:{scope:(g=l.authParams)==null?void 0:g.scope,...r},loginSession:l,sessionId:h.id,user:p,client:u})}async function xE({ctx:t,client:e,session:n,redirect_uri:r,state:i,nonce:o,code_challenge_method:a,code_challenge:l,audience:u,scope:d,response_type:p}){const{env:h}=t,g=new URL(r),A=`${g.protocol}//${g.host}`;async function $(H="Login required"){const W=Me(t,{type:Le.FAILED_SILENT_AUTH,description:H});return await t.env.data.logs.create(e.tenant.id,W),t.html(Su(A,JSON.stringify({error:"login_required",error_description:H,state:i})))}if(!n||(n==null?void 0:n.expires_at)&&new Date(n.expires_at)<new Date||(n==null?void 0:n.idle_expires_at)&&new Date(n.idle_expires_at)<new Date)return $();t.set("user_id",n.user_id);const D=await h.data.users.get(e.tenant.id,n.user_id);if(!D)return console.error("User not found",n.user_id),$("User not found");t.set("username",D.email),t.set("connection",D.connection);const O={client:e,authParams:{client_id:e.id,audience:u,code_challenge_method:a,code_challenge:l,scope:d,state:i,nonce:o,response_type:p,redirect_uri:r},user:D,session_id:n.id},x=p===rn.CODE?await N_(t,{user:D,client:e,authParams:O.authParams,login_id:n.login_session_id}):await Cc(t,O);await h.data.sessions.update(e.tenant.id,n.id,{used_at:new Date().toISOString(),last_interaction_at:new Date().toISOString(),device:{...n.device,last_ip:t.req.header("x-real-ip")||"",last_user_agent:t.req.header("user-agent")||""},idle_expires_at:n.idle_expires_at?new Date(Date.now()+kc*1e3).toISOString():void 0});const M=Me(t,{type:Le.SUCCESS_SILENT_AUTH,description:"Successful silent authentication"});await t.env.data.logs.create(e.tenant.id,M);const G=new Headers;G.set("Server-Timing","cf-nel=0; no-cloudflare-insights=1");const F=ka(e.tenant.id,n.id,t.req.header("host"));return G.set("set-cookie",F),t.html(Su(A,JSON.stringify({...x,state:i})),{headers:G})}const AE=["email","sms","Username-Password-Authentication"],EE=new s.OpenAPIHono().openapi(s.createRoute({tags:["oauth"],method:"get",path:"/",request:{query:s.z.object({client_id:s.z.string(),vendor_id:s.z.string().optional(),redirect_uri:s.z.string(),scope:s.z.string().optional(),state:s.z.string(),prompt:s.z.string().optional(),response_mode:s.z.nativeEnum(Sn).optional(),response_type:s.z.nativeEnum(rn).optional(),audience:s.z.string().optional(),connection:s.z.string().optional(),nonce:s.z.string().optional(),max_age:s.z.string().optional(),login_ticket:s.z.string().optional(),code_challenge_method:s.z.nativeEnum($c).optional(),code_challenge:s.z.string().optional(),realm:s.z.string().optional(),auth0Client:s.z.string().optional(),organization:s.z.string().optional(),login_hint:s.z.string().optional(),screen_hint:s.z.string().openapi({example:"signup",description:'Optional hint for the screen to show, like "signup" or "login".'}).optional(),ui_locales:s.z.string().optional()})},responses:{200:{description:"Successful authorization response. This can be an HTML page (e.g., for silent authentication iframe or universal login page) or a JSON object containing tokens (e.g., for response_mode=web_message).",content:{"text/html":{schema:s.z.string().openapi({example:"<html>...</html>"})},"application/json":{schema:gp}}},302:{description:"Redirect to the client's redirect URI, an authentication page, or an external identity provider.",headers:s.z.object({Location:s.z.string().url()})},400:{description:"Bad Request. Invalid parameters or other client-side errors.",content:{"application/json":{schema:s.z.object({message:s.z.string()})}}},403:{description:"Forbidden. The request is not allowed (e.g., invalid origin).",content:{"application/json":{schema:s.z.object({message:s.z.string()})}}}}}),async t=>{const{env:e}=t,{client_id:n,vendor_id:r,redirect_uri:i,scope:o,state:a,audience:l,nonce:u,connection:d,response_type:p,response_mode:h,code_challenge:g,code_challenge_method:A,prompt:$,login_ticket:N,realm:D,auth0Client:O,login_hint:x,ui_locales:M,organization:G}=t.req.valid("query");t.set("log","authorize");const F=await ao(e,n);t.set("client_id",F.id),t.set("tenant_id",F.tenant.id);const H={redirect_uri:i.split("#")[0],scope:o,state:a,client_id:n,vendor_id:r,audience:l,nonce:u,prompt:$,response_type:p,response_mode:h,code_challenge:g,code_challenge_method:A,username:x,ui_locales:M,organization:G},W=t.req.header("origin");if(W&&!ry(W,F.web_origins||[]))throw new C(403,{message:`Origin ${W} not allowed`});if(H.redirect_uri){const L=F.callbacks||[];if(t.var.host&&(L.push(`${xl(t.env)}/*`),L.push(`${ut(t.env)}/*`)),!yf(H.redirect_uri,L,{allowPathWildcards:!0}))throw new C(400,{message:`Invalid redirect URI - ${H.redirect_uri}`})}const Y=Tn(F.tenant.id,t.req.header("cookie")),ue=Y?await e.data.sessions.get(F.tenant.id,Y):void 0,Ce=ue&&!ue.revoked_at?ue:void 0;if($=="none"){if(!p)throw new C(400,{message:"Missing response_type"});return xE({ctx:t,session:Ce||void 0,redirect_uri:i,state:a,response_type:p,client:F,nonce:u,code_challenge_method:A,code_challenge:g,audience:l,scope:o})}if(F.connections.length===1&&F.connections[0]&&!AE.includes(F.connections[0].strategy||""))return og(t,F,F.connections[0].name,H);if(d&&d!=="email")return og(t,F,d,H);if(N){const L=await $E(t,F.tenant.id,N,H,D);return L instanceof Response?L:t.json(L)}const P=await vE({ctx:t,client:F,auth0Client:O,authParams:H,session:Ce||void 0,connection:d,login_hint:x});return P instanceof Response?P:t.json(P)}),SE=new s.OpenAPIHono().openapi(s.createRoute({tags:["oauth"],method:"get",path:"/",request:{query:s.z.object({client_id:s.z.string(),redirect_url:s.z.string().optional(),login_hint:s.z.string().toLowerCase().optional()})},responses:{302:{description:"Redirect to the account page with login session state or login page",headers:s.z.object({Location:s.z.string().url()})},400:{description:"Bad Request. Invalid parameters or other client-side errors.",content:{"application/json":{schema:s.z.object({message:s.z.string()})}}}}}),async t=>{const{env:e}=t,{client_id:n,redirect_url:r,login_hint:i}=t.req.valid("query");t.set("log","account");const o=await ao(e,n);t.set("client_id",o.id),t.set("tenant_id",o.tenant.id);const a={redirect_uri:r||t.req.url,client_id:n,username:i},l=t.req.header("origin");if(l&&!ry(l,o.web_origins||[]))throw new C(403,{message:`Origin ${l} not allowed`});if(a.redirect_uri){const O=o.callbacks||[];if(t.var.host&&(O.push(`${xl(t.env)}/*`),O.push(`${ut(t.env)}/*`)),!yf(a.redirect_uri,O,{allowPathWildcards:!0}))throw new C(400,{message:`Invalid redirect URI - ${a.redirect_uri}`})}const u=Tn(o.tenant.id,t.req.header("cookie")),d=u?await e.data.sessions.get(o.tenant.id,u):void 0,p=d&&!d.revoked_at?d:void 0,h=new URL(t.req.url);t.var.custom_domain&&(h.hostname=t.var.custom_domain);const{ip:g,auth0_client:A,useragent:$}=t.var,N=Wn(A),D=await e.data.loginSessions.create(o.tenant.id,{expires_at:new Date(Date.now()+qr*1e3).toISOString(),authParams:a,csrf_token:Ve(),authorization_url:h.toString(),ip:g,useragent:$,auth0Client:N});if(p){if(i){const O=await e.data.users.get(o.tenant.id,p.user_id);if((O==null?void 0:O.email)!==i)return t.redirect(`${ut(t.env)}login/identifier?state=${encodeURIComponent(D.id)}`)}return await e.data.loginSessions.update(o.tenant.id,D.id,{session_id:p.id}),t.redirect(`/u/account?state=${encodeURIComponent(D.id)}`)}return t.redirect(`${ut(t.env)}login/identifier?state=${encodeURIComponent(D.id)}`)});function kE(t){const e=new s.OpenAPIHono;e.use(async(r,i)=>{const o=ns(r,t.dataAdapter),a=t.dataAdapter.cache||$s({defaultTtlSeconds:0,maxEntries:100,cleanupIntervalMs:0}),l=t.dataAdapter.cache?300:0,u=Sl(o,{defaultTtl:l,cacheEntities:["tenants","connections","customDomains","clients","branding","themes","promptSettings","forms"],cache:a});return r.env.data=$l(r,u),i()}),e.use("/oauth/token",wm({origin:r=>r||"",allowHeaders:["Tenant-Id","Content-Type","Auth0-Client","Upgrade-Insecure-Requests"],allowMethods:["POST"],maxAge:600})),e.use(El).use(Al).use(mf(e));const n=e.route("/v2/logout",Wx).route("/userinfo",Xx).route("/.well-known",Jx).route("/oauth/token",fE).route("/dbconnections",mE).route("/passwordless",_E).route("/co/authenticate",wE).route("/authorize",EE).route("/account",SE).route("/callback",Kx);return n.doc("/spec",{openapi:"3.0.0",info:{version:"1.0.0",title:"Oauth API"},security:[{oauth2:["openid","email","profile"]}]}),gf(n),n}var iy=(t,...e)=>{const n=[""];for(let r=0,i=t.length-1;r<i;r++){n[0]+=t[r];const o=Array.isArray(e[r])?e[r].flat(1/0):[e[r]];for(let a=0,l=o.length;a<l;a++){const u=o[a];if(typeof u=="string")_r(u,n);else if(typeof u=="number")n[0]+=u;else{if(typeof u=="boolean"||u===null||u===void 0)continue;if(typeof u=="object"&&u.isEscaped)if(u.callbacks)n.unshift("",u);else{const d=u.toString();d instanceof Promise?n.unshift("",d):n[0]+=d}else u instanceof Promise?n.unshift("",u):_r(u.toString(),n)}}}return n[0]+=t.at(-1),n.length===1?"callbacks"in n?ln(O1(ln(n[0],n.callbacks))):ln(n[0]):I1(n,n.callbacks)},Of=Symbol("RENDERER"),ep=Symbol("ERROR_HANDLER"),Ge=Symbol("STASH"),oy=Symbol("INTERNAL"),NE=Symbol("MEMO"),pc=Symbol("PERMALINK"),Rg=t=>(t[oy]=!0,t),sy=t=>({value:e,children:n})=>{if(!n)return;const r={children:[{tag:Rg(()=>{t.push(e)}),props:{}}]};Array.isArray(n)?r.children.push(...n.flat()):r.children.push(n),r.children.push({tag:Rg(()=>{t.pop()}),props:{}});const i={tag:"",props:r,type:""};return i[ep]=o=>{throw t.pop(),o},i},ay=t=>{const e=[t],n=sy(e);return n.values=e,n.Provider=n,Mi.push(n),n},Mi=[],cy=t=>{const e=[t],n=r=>{e.push(r.value);let i;try{i=r.children?(Array.isArray(r.children)?new py("",{},r.children):r.children).toString():""}finally{e.pop()}return i instanceof Promise?i.then(o=>ln(o,o.callbacks)):ln(i)};return n.values=e,n.Provider=n,n[Of]=sy(e),Mi.push(n),n},co=t=>t.values.at(-1),ca={title:[],script:["src"],style:["data-href"],link:["href"],meta:["name","httpEquiv","charset","itemProp"]},tp={},la="data-precedence",Es=t=>Array.isArray(t)?t:[t],Pg=new WeakMap,Bg=(t,e,n,r)=>({buffer:i,context:o})=>{if(!i)return;const a=Pg.get(o)||{};Pg.set(o,a);const l=a[t]||(a[t]=[]);let u=!1;const d=ca[t];if(d.length>0){e:for(const[,p]of l)for(const h of d)if(((p==null?void 0:p[h])??null)===(n==null?void 0:n[h])){u=!0;break e}}if(u?i[0]=i[0].replaceAll(e,""):d.length>0?l.push([e,n,r]):l.unshift([e,n,r]),i[0].indexOf("</head>")!==-1){let p;if(r===void 0)p=l.map(([h])=>h);else{const h=[];p=l.map(([g,,A])=>{let $=h.indexOf(A);return $===-1&&(h.push(A),$=h.length-1),[g,$]}).sort((g,A)=>g[1]-A[1]).map(([g])=>g)}p.forEach(h=>{i[0]=i[0].replaceAll(h,"")}),i[0]=i[0].replace(/(?=<\/head>)/,p.join(""))}},Ss=(t,e,n)=>ln(new un(t,n,Es(e??[])).toString()),ks=(t,e,n,r)=>{if("itemProp"in n)return Ss(t,e,n);let{precedence:i,blocking:o,...a}=n;i=r?i??"":void 0,r&&(a[la]=i);const l=new un(t,a,Es(e||[])).toString();return l instanceof Promise?l.then(u=>ln(l,[...u.callbacks||[],Bg(t,u,a,i)])):ln(l,[Bg(t,l,a,i)])},CE=({children:t,...e})=>{const n=zf();if(n){const r=co(n);if(r==="svg"||r==="head")return new un("title",e,Es(t??[]))}return ks("title",t,e,!1)},TE=({children:t,...e})=>{const n=zf();return["src","async"].some(r=>!e[r])||n&&co(n)==="head"?Ss("script",t,e):ks("script",t,e,!1)},IE=({children:t,...e})=>["href","precedence"].every(n=>n in e)?(e["data-href"]=e.href,delete e.href,ks("style",t,e,!0)):Ss("style",t,e),OE=({children:t,...e})=>["onLoad","onError"].some(n=>n in e)||e.rel==="stylesheet"&&(!("precedence"in e)||"disabled"in e)?Ss("link",t,e):ks("link",t,e,"precedence"in e),zE=({children:t,...e})=>{const n=zf();return n&&co(n)==="head"?Ss("meta",t,e):ks("meta",t,e,!1)},ly=(t,{children:e,...n})=>new un(t,n,Es(e??[])),DE=t=>(typeof t.action=="function"&&(t.action=pc in t.action?t.action[pc]:void 0),ly("form",t)),uy=(t,e)=>(typeof e.formAction=="function"&&(e.formAction=pc in e.formAction?e.formAction[pc]:void 0),ly(t,e)),RE=t=>uy("input",t),PE=t=>uy("button",t);const iu=Object.freeze(Object.defineProperty({__proto__:null,button:PE,form:DE,input:RE,link:OE,meta:zE,script:TE,style:IE,title:CE},Symbol.toStringTag,{value:"Module"}));var BE=new Map([["className","class"],["htmlFor","for"],["crossOrigin","crossorigin"],["httpEquiv","http-equiv"],["itemProp","itemprop"],["fetchPriority","fetchpriority"],["noModule","nomodule"],["formAction","formaction"]]),fc=t=>BE.get(t)||t,dy=(t,e)=>{for(const[n,r]of Object.entries(t)){const i=n[0]==="-"||!/[A-Z]/.test(n)?n:n.replace(/[A-Z]/g,o=>`-${o.toLowerCase()}`);e(i,r==null?null:typeof r=="number"?i.match(/^(?:a|border-im|column(?:-c|s)|flex(?:$|-[^b])|grid-(?:ar|[^a])|font-w|li|or|sca|st|ta|wido|z)|ty$/)?`${r}`:`${r}px`:r)}},Xo=void 0,zf=()=>Xo,jE=t=>/[A-Z]/.test(t)&&t.match(/^(?:al|basel|clip(?:Path|Rule)$|co|do|fill|fl|fo|gl|let|lig|i|marker[EMS]|o|pai|pointe|sh|st[or]|text[^L]|tr|u|ve|w)/)?t.replace(/([A-Z])/g,"-$1").toLowerCase():t,LE=["area","base","br","col","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],FE=["allowfullscreen","async","autofocus","autoplay","checked","controls","default","defer","disabled","download","formnovalidate","hidden","inert","ismap","itemscope","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","selected"],Df=(t,e)=>{for(let n=0,r=t.length;n<r;n++){const i=t[n];if(typeof i=="string")_r(i,e);else{if(typeof i=="boolean"||i===null||i===void 0)continue;i instanceof un?i.toStringToBuffer(e):typeof i=="number"||i.isEscaped?e[0]+=i:i instanceof Promise?e.unshift("",i):Df(i,e)}}},un=class{constructor(t,e,n){be(this,"tag");be(this,"props");be(this,"key");be(this,"children");be(this,"isEscaped",!0);be(this,"localContexts");this.tag=t,this.props=e,this.children=n}get type(){return this.tag}get ref(){return this.props.ref||null}toString(){var e,n;const t=[""];(e=this.localContexts)==null||e.forEach(([r,i])=>{r.values.push(i)});try{this.toStringToBuffer(t)}finally{(n=this.localContexts)==null||n.forEach(([r])=>{r.values.pop()})}return t.length===1?"callbacks"in t?O1(ln(t[0],t.callbacks)).toString():t[0]:I1(t,t.callbacks)}toStringToBuffer(t){const e=this.tag,n=this.props;let{children:r}=this;t[0]+=`<${e}`;const i=Xo&&co(Xo)==="svg"?o=>jE(fc(o)):o=>fc(o);for(let[o,a]of Object.entries(n))if(o=i(o),o!=="children"){if(o==="style"&&typeof a=="object"){let l="";dy(a,(u,d)=>{d!=null&&(l+=`${l?";":""}${u}:${d}`)}),t[0]+=' style="',_r(l,t),t[0]+='"'}else if(typeof a=="string")t[0]+=` ${o}="`,_r(a,t),t[0]+='"';else if(a!=null)if(typeof a=="number"||a.isEscaped)t[0]+=` ${o}="${a}"`;else if(typeof a=="boolean"&&FE.includes(o))a&&(t[0]+=` ${o}=""`);else if(o==="dangerouslySetInnerHTML"){if(r.length>0)throw new Error("Can only set one of `children` or `props.dangerouslySetInnerHTML`.");r=[ln(a.__html)]}else if(a instanceof Promise)t[0]+=` ${o}="`,t.unshift('"',a);else if(typeof a=="function"){if(!o.startsWith("on")&&o!=="ref")throw new Error(`Invalid prop '${o}' of type 'function' supplied to '${e}'.`)}else t[0]+=` ${o}="`,_r(a.toString(),t),t[0]+='"'}if(LE.includes(e)&&r.length===0){t[0]+="/>";return}t[0]+=">",Df(r,t),t[0]+=`</${e}>`}},ou=class extends un{toStringToBuffer(t){const{children:e}=this,n=this.tag.call(null,{...this.props,children:e.length<=1?e[0]:e});if(!(typeof n=="boolean"||n==null))if(n instanceof Promise)if(Mi.length===0)t.unshift("",n);else{const r=Mi.map(i=>[i,i.values.at(-1)]);t.unshift("",n.then(i=>(i instanceof un&&(i.localContexts=r),i)))}else n instanceof un?n.toStringToBuffer(t):typeof n=="number"||n.isEscaped?(t[0]+=n,n.callbacks&&(t.callbacks||(t.callbacks=[]),t.callbacks.push(...n.callbacks))):_r(n,t)}},py=class extends un{toStringToBuffer(t){Df(this.children,t)}},UE=(t,e,...n)=>{e??(e={}),n.length&&(e.children=n.length===1?n[0]:n);const r=e.key;delete e.key;const i=ua(t,e,n);return i.key=r,i},jg=!1,ua=(t,e,n)=>{if(!jg){for(const r in tp)iu[r][Of]=tp[r];jg=!0}return typeof t=="function"?new ou(t,e,n):iu[t]?new ou(iu[t],e,n):t==="svg"||t==="head"?(Xo||(Xo=cy("")),new un(t,e,[new ou(Xo,{value:t},n)])):new un(t,e,n)},Rf=({children:t})=>new py("",{children:t},Array.isArray(t)?t:t?[t]:[]),ME=(t,e,...n)=>{let r;if(n.length>0)r=n;else{const i=t.props.children;r=Array.isArray(i)?i:[i]}return UE(t.tag,{...t.props,...e},...r)};function y(t,e,n){let r;if(!e||!("children"in e))r=ua(t,e,[]);else{const i=e.children;r=Array.isArray(i)?ua(t,e,i):ua(t,e,[i])}return r.key=n,r}async function Ue(t,e,n=!1){var p;const{env:r}=t,i=await r.data.loginSessions.get(t.var.tenant_id||"",e);if(!i)throw new C(400,{message:"Login session not found"});t.set("loginSession",i);const o=await ao(r,i.authParams.client_id);t.set("client_id",o.id),t.set("tenant_id",o.tenant.id);const a=await r.data.tenants.get(o.tenant.id);if(a){if(i.session_id&&!n){if(!i.authParams.redirect_uri)throw new C(400,{message:"Login session closed and no redirect URI available"});const h=new URL(i.authParams.redirect_uri);throw h.searchParams.set("error","access_denied"),h.searchParams.set("error_description","Login session closed"),i.authParams.state&&h.searchParams.set("state",i.authParams.state),new xs(h.toString(),302)}}else throw new C(400,{message:"Tenant not found"});const l=await r.data.themes.get(a.id,"default"),u=await r.data.branding.get(a.id),d=(p=i.authParams.ui_locales)==null?void 0:p.split(" ").map(h=>h.split("-")[0]).find(h=>{if(Array.isArray(B.options.supportedLngs))return B.options.supportedLngs.includes(h)});return await B.changeLanguage(d||a.language||"sv"),{theme:l,branding:u,client:o,tenant:a,loginSession:i}}async function qE(t,e,n,r){if(r!==void 0)return r==="password";const i=await Ep({userAdapter:t.env.data.users,tenant_id:e.tenant.id,email:n});return i!=null&&i.app_metadata.strategy?i.app_metadata.strategy==="Username-Password-Authentication":(await t.env.data.promptSettings.get(e.tenant.id)).password_first}const fy=({theme:t,branding:e})=>{var r;const n=((r=t==null?void 0:t.widget)==null?void 0:r.logo_url)||(e==null?void 0:e.logo_url);return n?y("div",{className:"flex h-9 items-center",children:y("img",{src:n,className:"max-h-full",alt:"Logo"})}):y(Rf,{})},hy=t=>{var e,n;return y("div",{className:"mt-8",children:((n=(e=t.client)==null?void 0:e.client_metadata)==null?void 0:n.termsAndConditionsUrl)&&y("div",{className:"text-xs text-gray-300",children:[B.t("agree_to")," ",y("a",{href:t.client.client_metadata.termsAndConditionsUrl,className:"text-primary hover:underline",target:"_blank",rel:"noreferrer",children:B.t("terms")})]})})};var gy={exports:{}};/*!
198
198
  Copyright (c) 2018 Jed Watson.
199
199
  Licensed under the MIT License (MIT), see
200
200
  http://jedwatson.github.io/classnames
201
- */(function(t){(function(){var e={}.hasOwnProperty;function n(){for(var o="",a=0;a<arguments.length;a++){var l=arguments[a];l&&(o=i(o,r(l)))}return o}function r(o){if(typeof o=="string"||typeof o=="number")return o;if(typeof o!="object")return"";if(Array.isArray(o))return n.apply(null,o);if(o.toString!==Object.prototype.toString&&!o.toString.toString().includes("[native code]"))return o.toString();var a="";for(var l in o)e.call(o,l)&&o[l]&&(a=i(a,l));return a}function i(o,a){return a?o?o+" "+a:o+a:o}t.exports?(n.default=n,t.exports=n):window.classNames=n})()})(gy);var VE=gy.exports;const Jn=p_(VE),HE=t=>t==="small"?"text-base":t==="medium"?"text-2xl":t==="large"?"text-3xl":"",tt=({name:t,size:e,className:n=""})=>{const r=HE(e);return y("span",{className:Jn(`uicon-${t}`,n,r)})},KE=(t,e)=>{const n=t.replace("#",""),r=parseInt(n,16),i=r>>16&255,o=r>>8&255,a=r&255,l=Math.min(255,Math.round(i+(255-i)*e)),u=Math.min(255,Math.round(o+(255-o)*e)),d=Math.min(255,Math.round(a+(255-a)*e));return`#${(l<<16|u<<8|d).toString(16).padStart(6,"0")}`};var Lg=Object.freeze,GE=Object.defineProperty,WE=(t,e)=>Lg(GE(t,"raw",{value:Lg(t.slice())})),Fg;const XE=(t,e)=>{var o,a,l,u;const n=((o=t==null?void 0:t.colors)==null?void 0:o.primary_button)||((a=e==null?void 0:e.colors)==null?void 0:a.primary)||"#000000",r=((l=t==null?void 0:t.colors)==null?void 0:l.base_hover_color)||KE(n,.2),i=((u=t==null?void 0:t.colors)==null?void 0:u.primary_button_label)||"#ffffff";return`
201
+ */(function(t){(function(){var e={}.hasOwnProperty;function n(){for(var o="",a=0;a<arguments.length;a++){var l=arguments[a];l&&(o=i(o,r(l)))}return o}function r(o){if(typeof o=="string"||typeof o=="number")return o;if(typeof o!="object")return"";if(Array.isArray(o))return n.apply(null,o);if(o.toString!==Object.prototype.toString&&!o.toString.toString().includes("[native code]"))return o.toString();var a="";for(var l in o)e.call(o,l)&&o[l]&&(a=i(a,l));return a}function i(o,a){return a?o?o+" "+a:o+a:o}t.exports?(n.default=n,t.exports=n):window.classNames=n})()})(gy);var VE=gy.exports;const Jn=p_(VE),HE=t=>t==="small"?"text-base":t==="medium"?"text-2xl":t==="large"?"text-3xl":"",et=({name:t,size:e,className:n=""})=>{const r=HE(e);return y("span",{className:Jn(`uicon-${t}`,n,r)})},KE=(t,e)=>{const n=t.replace("#",""),r=parseInt(n,16),i=r>>16&255,o=r>>8&255,a=r&255,l=Math.min(255,Math.round(i+(255-i)*e)),u=Math.min(255,Math.round(o+(255-o)*e)),d=Math.min(255,Math.round(a+(255-a)*e));return`#${(l<<16|u<<8|d).toString(16).padStart(6,"0")}`};var Lg=Object.freeze,GE=Object.defineProperty,WE=(t,e)=>Lg(GE(t,"raw",{value:Lg(t.slice())})),Fg;const XE=(t,e)=>{var o,a,l,u;const n=((o=t==null?void 0:t.colors)==null?void 0:o.primary_button)||((a=e==null?void 0:e.colors)==null?void 0:a.primary)||"#000000",r=((l=t==null?void 0:t.colors)==null?void 0:l.base_hover_color)||KE(n,.2),i=((u=t==null?void 0:t.colors)==null?void 0:u.primary_button_label)||"#ffffff";return`
202
202
  body {
203
203
  --primary-color: ${n};
204
204
  --primary-hover: ${r};
205
205
  --text-on-primary: ${i};
206
206
  }
207
- `},JE="https://assets.sesamy.com/images/login-bg.jpg",rt=({title:t,children:e,theme:n,branding:r,client:i})=>{var a;const o={backgroundImage:`url(${((a=n==null?void 0:n.page_background)==null?void 0:a.background_image_url)||JE})`};return y("html",{lang:"en",children:[y("head",{children:[y("title",{children:t}),y("meta",{charset:"UTF-8"}),y("meta",{name:"robots",content:"noindex, follow"}),y("link",{rel:"preload",href:"https://assets.sesamy.com/fonts/khteka/WOFF2/KHTeka-Regular.woff2",as:"font",type:"font/woff2",crossOrigin:"anonymous"}),y("link",{rel:"preload",href:"https://assets.sesamy.com/fonts/khteka/WOFF2/KHTeka-Medium.woff2",as:"font",type:"font/woff2",crossOrigin:"anonymous"}),y("link",{rel:"preload",href:"https://assets.sesamy.com/fonts/khteka/WOFF2/KHTeka-Bold.woff2",as:"font",type:"font/woff2",crossOrigin:"anonymous"}),y("link",{rel:"stylesheet",href:"/u/css/tailwind.css"}),y("meta",{name:"viewport",content:"width=device-width, initial-scale=1, maximum-scale=1"}),y("style",{children:XE(n,r)}),y("meta",{name:"theme-color",content:"#000000"})]}),y("body",{children:y("div",{className:"row min-h-full w-full overflow-hidden bg-cover bg-center text-sm sm:bg-fixed sm:bg-left-top sm:pt-16 py-2",style:o,children:y("div",{className:"row-up-left w-[calc(100%-theme(space.2)-theme(space.2))] max-w-[1295px] !flex-nowrap sm:w-[calc(100%-theme(space.16)-theme(space.16))]",children:y("div",{className:"column-left w-full sm:w-auto",children:[y("div",{className:"relative flex w-full flex-col rounded-2xl bg-white px-5 py-10 dark:bg-gray-800 dark:text-white sm:min-h-[700px] sm:max-w-md sm:px-14 sm:py-14 md:min-w-[448px] short:min-h-[558px] min-h-[calc(100vh-83px)]",children:[y("div",{className:"mb-16",children:y(fy,{theme:n,branding:r})}),y("div",{className:"flex flex-1 flex-col",children:[e,y(hy,{theme:n,branding:r,client:i})]})]}),y("div",{className:"flex w-full items-center px-6 pb-8 pt-4 justify-between",children:[y("div",{className:"flex justify-center leading-[0]",children:y("a",{href:"https://sesamy.com",target:"_blank",rel:"noreferrer",children:y(tt,{name:"sesamy",className:"text-xl text-white"})})}),y("div",{className:"flex justify-center space-x-2 text-xs text-white sm:justify-normal md:text-xs"})]})]})})})}),iy(Fg||(Fg=WE([`
207
+ `},JE="https://assets.sesamy.com/images/login-bg.jpg",nt=({title:t,children:e,theme:n,branding:r,client:i})=>{var a;const o={backgroundImage:`url(${((a=n==null?void 0:n.page_background)==null?void 0:a.background_image_url)||JE})`};return y("html",{lang:"en",children:[y("head",{children:[y("title",{children:t}),y("meta",{charset:"UTF-8"}),y("meta",{name:"robots",content:"noindex, follow"}),y("link",{rel:"preload",href:"https://assets.sesamy.com/fonts/khteka/WOFF2/KHTeka-Regular.woff2",as:"font",type:"font/woff2",crossOrigin:"anonymous"}),y("link",{rel:"preload",href:"https://assets.sesamy.com/fonts/khteka/WOFF2/KHTeka-Medium.woff2",as:"font",type:"font/woff2",crossOrigin:"anonymous"}),y("link",{rel:"preload",href:"https://assets.sesamy.com/fonts/khteka/WOFF2/KHTeka-Bold.woff2",as:"font",type:"font/woff2",crossOrigin:"anonymous"}),y("link",{rel:"stylesheet",href:"/u/css/tailwind.css"}),y("meta",{name:"viewport",content:"width=device-width, initial-scale=1, maximum-scale=1"}),y("style",{children:XE(n,r)}),y("meta",{name:"theme-color",content:"#000000"})]}),y("body",{children:y("div",{className:"row min-h-full w-full overflow-hidden bg-cover bg-center text-sm sm:bg-fixed sm:bg-left-top sm:pt-16 py-2",style:o,children:y("div",{className:"row-up-left w-[calc(100%-theme(space.2)-theme(space.2))] max-w-[1295px] !flex-nowrap sm:w-[calc(100%-theme(space.16)-theme(space.16))]",children:y("div",{className:"column-left w-full sm:w-auto",children:[y("div",{className:"relative flex w-full flex-col rounded-2xl bg-white px-5 py-10 dark:bg-gray-800 dark:text-white sm:min-h-[700px] sm:max-w-md sm:px-14 sm:py-14 md:min-w-[448px] short:min-h-[558px] min-h-[calc(100vh-83px)]",children:[y("div",{className:"mb-16",children:y(fy,{theme:n,branding:r})}),y("div",{className:"flex flex-1 flex-col",children:[e,y(hy,{theme:n,branding:r,client:i})]})]}),y("div",{className:"flex w-full items-center px-6 pb-8 pt-4 justify-between",children:[y("div",{className:"flex justify-center leading-[0]",children:y("a",{href:"https://sesamy.com",target:"_blank",rel:"noreferrer",children:y(et,{name:"sesamy",className:"text-xl text-white"})})}),y("div",{className:"flex justify-center space-x-2 text-xs text-white sm:justify-normal md:text-xs"})]})]})})})}),iy(Fg||(Fg=WE([`
208
208
  <script>
209
209
  // Add loading class to submit button on form submission
210
210
  document.addEventListener("DOMContentLoaded", function () {
@@ -225,9 +225,9 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
225
225
  }
226
226
  });
227
227
  <\/script>
228
- `])))]})},rr=({children:t})=>y("div",{className:"mb-2 text-sm text-red",children:t}),YE=t=>t==="small"?"text-base":t==="medium"?"text-2xl":t==="large"?"text-3xl":"",my=({size:t})=>{const e=YE(t);return y("div",{className:"relative inline-block leading-[0]",children:[y(tt,{className:Jn("text-gray-200 dark:text-[#201a41]",{[e]:e}),name:"spinner-circle"}),y(tt,{className:Jn("absolute inset-0 animate-spin text-primary",{[e]:e}),name:"spinner-inner"})]})},nt=({children:t,className:e,Component:n="button",variant:r="primary",href:i,disabled:o,isLoading:a,id:l})=>{const u=n==="a"?{href:i}:{};return y(n,{class:Jn("btn relative w-full rounded-lg text-center",{"px-4 py-5":r!=="custom","bg-primary text-textOnPrimary hover:bg-primaryHover":r==="primary","border border-gray-300 bg-white text-black":r==="secondary","pointer-events-none cursor-not-allowed opacity-40":o,"is-loading":a},"focus:outline-none focus:ring",e),type:"submit",disabled:o,id:l,...u,children:[y("span",{className:"btn-label flex items-center justify-center space-x-2",children:t}),y("div",{className:"btn-spinner absolute left-0 top-0 flex h-full w-full items-center justify-center",children:y(my,{size:"medium"})})]})},wo=({connection:t,text:e,icon:n=null,canResize:r=!1,loginSession:i})=>{const o=new URLSearchParams({client_id:i.authParams.client_id,connection:t});i.authParams.response_type&&o.set("response_type",i.authParams.response_type),i.authParams.redirect_uri&&o.set("redirect_uri",i.authParams.redirect_uri),i.authParams.scope&&o.set("scope",i.authParams.scope),i.authParams.nonce&&o.set("nonce",i.authParams.nonce),i.authParams.response_type&&o.set("response_type",i.authParams.response_type),i.authParams.state&&o.set("state",i.id);const a=`/authorize?${o.toString()}`;return y(nt,{className:Jn("border border-gray-200 bg-white hover:bg-gray-100 dark:border-gray-400 dark:bg-black dark:hover:bg-black/90",{"px-0 py-3 sm:px-10 sm:py-4 short:px-0 short:py-3":r,"px-10 py-3":!r}),variant:"custom","aria-label":e,Component:"a",href:a,children:[n||"",y("div",{className:Jn("text-left text-black dark:text-white sm:text-base",{"hidden sm:inline short:hidden":r}),children:e})]})},_y=({...t})=>y("svg",{width:"45",height:"45",viewBox:"0 0 45 45",xmlns:"http://www.w3.org/2000/svg",...t,children:[y("path",{d:"M44.1035 23.0123C44.1054 21.4791 43.9758 19.9486 43.716 18.4375H22.498V27.1028H34.6507C34.4021 28.4868 33.8757 29.8061 33.1034 30.9812C32.3311 32.1562 31.3289 33.1628 30.1571 33.9401V39.5649H37.41C41.6567 35.6494 44.1035 29.859 44.1035 23.0123Z",fill:"#4285F4"}),y("path",{d:"M22.4982 44.9997C28.5698 44.9997 33.6821 43.0061 37.4101 39.5687L30.1573 33.9439C28.1386 35.3126 25.5387 36.0938 22.4982 36.0938C16.6296 36.0938 11.6485 32.1377 9.86736 26.8066H2.39575V32.6033C4.26839 36.3297 7.13989 39.4622 10.6896 41.6512C14.2394 43.8402 18.3277 44.9995 22.4982 44.9997Z",fill:"#34A853"}),y("path",{d:"M9.86737 26.8073C8.92572 24.0138 8.92572 20.9886 9.86737 18.1951V12.3984H2.39576C0.820432 15.5332 0 18.9929 0 22.5012C0 26.0095 0.820432 29.4692 2.39576 32.604L9.86737 26.8073Z",fill:"#FBBC04"}),y("path",{d:"M22.4982 8.90741C25.7068 8.85499 28.8071 10.0673 31.1291 12.2823L37.5507 5.86064C33.4788 2.03602 28.0843 -0.0637686 22.4982 0.00147616C18.3277 0.00166623 14.2394 1.16098 10.6896 3.34999C7.13989 5.539 4.26839 8.67155 2.39575 12.3979L9.86736 18.1946C11.6485 12.8635 16.6296 8.90741 22.4982 8.90741Z",fill:"#EA4335"})]}),Rn=({children:t,className:e})=>y("form",{id:"form",method:"post",className:e,children:t}),yy=({...t})=>y("svg",{version:"1.1",id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 48 48",enableBackground:"new 0 0 48 48",width:"45",height:"45",...t,children:[y("path",{fill:"#FF5B24",d:"M3.5,8h41c1.9,0,3.5,1.6,3.5,3.5v25c0,1.9-1.6,3.5-3.5,3.5h-41C1.6,40,0,38.4,0,36.5v-25C0,9.6,1.6,8,3.5,8z"}),y("path",{fillRule:"evenodd",clipRule:"evenodd",fill:"#FFFFFF",d:`M27.9,20.3c1.4,0,2.6-1,2.6-2.5h0c0-1.5-1.2-2.5-2.6-2.5c-1.4,0-2.6,1-2.6,2.5C25.3,19.2,26.5,20.3,27.9,20.3z
228
+ `])))]})},rr=({children:t})=>y("div",{className:"mb-2 text-sm text-red",children:t}),YE=t=>t==="small"?"text-base":t==="medium"?"text-2xl":t==="large"?"text-3xl":"",my=({size:t})=>{const e=YE(t);return y("div",{className:"relative inline-block leading-[0]",children:[y(et,{className:Jn("text-gray-200 dark:text-[#201a41]",{[e]:e}),name:"spinner-circle"}),y(et,{className:Jn("absolute inset-0 animate-spin text-primary",{[e]:e}),name:"spinner-inner"})]})},tt=({children:t,className:e,Component:n="button",variant:r="primary",href:i,disabled:o,isLoading:a,id:l})=>{const u=n==="a"?{href:i}:{};return y(n,{class:Jn("btn relative w-full rounded-lg text-center",{"px-4 py-5":r!=="custom","bg-primary text-textOnPrimary hover:bg-primaryHover":r==="primary","border border-gray-300 bg-white text-black":r==="secondary","pointer-events-none cursor-not-allowed opacity-40":o,"is-loading":a},"focus:outline-none focus:ring",e),type:"submit",disabled:o,id:l,...u,children:[y("span",{className:"btn-label flex items-center justify-center space-x-2",children:t}),y("div",{className:"btn-spinner absolute left-0 top-0 flex h-full w-full items-center justify-center",children:y(my,{size:"medium"})})]})},wo=({connection:t,text:e,icon:n=null,canResize:r=!1,loginSession:i})=>{const o=new URLSearchParams({client_id:i.authParams.client_id,connection:t});i.authParams.response_type&&o.set("response_type",i.authParams.response_type),i.authParams.redirect_uri&&o.set("redirect_uri",i.authParams.redirect_uri),i.authParams.scope&&o.set("scope",i.authParams.scope),i.authParams.nonce&&o.set("nonce",i.authParams.nonce),i.authParams.response_type&&o.set("response_type",i.authParams.response_type),i.authParams.state&&o.set("state",i.id);const a=`/authorize?${o.toString()}`;return y(tt,{className:Jn("border border-gray-200 bg-white hover:bg-gray-100 dark:border-gray-400 dark:bg-black dark:hover:bg-black/90",{"px-0 py-3 sm:px-10 sm:py-4 short:px-0 short:py-3":r,"px-10 py-3":!r}),variant:"custom","aria-label":e,Component:"a",href:a,children:[n||"",y("div",{className:Jn("text-left text-black dark:text-white sm:text-base",{"hidden sm:inline short:hidden":r}),children:e})]})},_y=({...t})=>y("svg",{width:"45",height:"45",viewBox:"0 0 45 45",xmlns:"http://www.w3.org/2000/svg",...t,children:[y("path",{d:"M44.1035 23.0123C44.1054 21.4791 43.9758 19.9486 43.716 18.4375H22.498V27.1028H34.6507C34.4021 28.4868 33.8757 29.8061 33.1034 30.9812C32.3311 32.1562 31.3289 33.1628 30.1571 33.9401V39.5649H37.41C41.6567 35.6494 44.1035 29.859 44.1035 23.0123Z",fill:"#4285F4"}),y("path",{d:"M22.4982 44.9997C28.5698 44.9997 33.6821 43.0061 37.4101 39.5687L30.1573 33.9439C28.1386 35.3126 25.5387 36.0938 22.4982 36.0938C16.6296 36.0938 11.6485 32.1377 9.86736 26.8066H2.39575V32.6033C4.26839 36.3297 7.13989 39.4622 10.6896 41.6512C14.2394 43.8402 18.3277 44.9995 22.4982 44.9997Z",fill:"#34A853"}),y("path",{d:"M9.86737 26.8073C8.92572 24.0138 8.92572 20.9886 9.86737 18.1951V12.3984H2.39576C0.820432 15.5332 0 18.9929 0 22.5012C0 26.0095 0.820432 29.4692 2.39576 32.604L9.86737 26.8073Z",fill:"#FBBC04"}),y("path",{d:"M22.4982 8.90741C25.7068 8.85499 28.8071 10.0673 31.1291 12.2823L37.5507 5.86064C33.4788 2.03602 28.0843 -0.0637686 22.4982 0.00147616C18.3277 0.00166623 14.2394 1.16098 10.6896 3.34999C7.13989 5.539 4.26839 8.67155 2.39575 12.3979L9.86736 18.1946C11.6485 12.8635 16.6296 8.90741 22.4982 8.90741Z",fill:"#EA4335"})]}),Rn=({children:t,className:e})=>y("form",{id:"form",method:"post",className:e,children:t}),yy=({...t})=>y("svg",{version:"1.1",id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 48 48",enableBackground:"new 0 0 48 48",width:"45",height:"45",...t,children:[y("path",{fill:"#FF5B24",d:"M3.5,8h41c1.9,0,3.5,1.6,3.5,3.5v25c0,1.9-1.6,3.5-3.5,3.5h-41C1.6,40,0,38.4,0,36.5v-25C0,9.6,1.6,8,3.5,8z"}),y("path",{fillRule:"evenodd",clipRule:"evenodd",fill:"#FFFFFF",d:`M27.9,20.3c1.4,0,2.6-1,2.6-2.5h0c0-1.5-1.2-2.5-2.6-2.5c-1.4,0-2.6,1-2.6,2.5C25.3,19.2,26.5,20.3,27.9,20.3z
229
229
  M31.2,24.4c-1.7,2.2-3.5,3.8-6.7,3.8h0c-3.2,0-5.8-2-7.7-4.8c-0.8-1.2-2-1.4-2.9-0.8c-0.8,0.6-1,1.8-0.3,2.9
230
- c2.7,4.1,6.5,6.6,10.9,6.6c4,0,7.2-2,9.6-5.2c0.9-1.2,0.9-2.5,0-3.1C33.3,22.9,32.1,23.2,31.2,24.4z`})]}),da=({error:t,theme:e,branding:n,loginSession:r,email:i,client:o})=>{const a=o.connections.map(({strategy:G})=>G),l=a.includes("email")||a.includes("Username-Password-Authentication"),u=a.includes("sms"),d=a.includes("facebook"),p=a.includes("google-oauth2"),h=a.includes("apple"),g=a.includes("vipps"),A=d||p||h||g,$=l||u;let N="text",D="username";const O=l&&u?"email_or_phone_placeholder":l?"email_placeholder":"phone_placeholder";let x=B.t(O,l&&u?"Email or Phone Number":l?"Email Address":"Phone Number");return y(rt,{title:B.t("welcome"),theme:e,branding:n,client:o,children:[y("div",{className:"mb-4 text-lg font-medium sm:text-2xl",children:B.t("welcome")}),y("div",{className:"mb-8 text-gray-300",children:B.t("login_description_template",{authMethod:B.t(O,{defaultValue:l&&u?"email or phone number":l?"email address":"phone number"}).toLocaleLowerCase(),defaultValue:"Sign in with your {{authMethod}}"})}),y("div",{className:"flex flex-1 flex-col justify-center",children:[$&&y(Rn,{className:"mb-7",children:[y("input",{type:N,name:D,placeholder:x,className:Jn("mb-2 w-full rounded-lg border bg-gray-100 px-4 py-5 text-base placeholder:text-gray-300 dark:bg-gray-600 md:text-base",{"border-red":t,"border-gray-100 dark:border-gray-500":!t}),required:!0,value:i||""}),t&&y(rr,{children:t}),y(nt,{className:"sm:mt-4 !text-base",children:[y("span",{children:B.t("continue")}),y(tt,{className:"text-xs",name:"arrow-right"})]})]}),$&&A&&y("div",{className:"relative mb-5 block text-center text-gray-300 dark:text-gray-300",children:[y("div",{className:"absolute left-0 right-0 top-1/2 border-b border-gray-200 dark:border-gray-600"}),y("div",{className:"relative inline-block bg-white px-2 dark:bg-gray-800",children:B.t("continue_social_login")})]}),y("div",{className:"flex space-x-4 sm:flex-col sm:space-x-0 sm:space-y-4 short:flex-row short:space-x-4 short:space-y-0",children:[d&&y(wo,{connection:"facebook",text:B.t("continue_with",{provider:"Facebook"}),canResize:!0,icon:y(tt,{className:"text-xl text-[#1196F5] sm:absolute sm:left-4 sm:top-1/2 sm:-translate-y-1/2 sm:text-2xl short:static short:left-auto short:top-auto short:translate-y-0 short:text-xl",name:"facebook"}),loginSession:r}),p&&y(wo,{connection:"google-oauth2",text:B.t("continue_with",{provider:"Google"}),canResize:!0,icon:y(_y,{className:"h-5 w-5 sm:absolute sm:left-4 sm:top-1/2 sm:h-6 sm:w-6 sm:-translate-y-1/2 short:static short:left-auto short:top-auto short:h-5 short:w-5 short:translate-y-0"}),loginSession:r}),h&&y(wo,{connection:"apple",text:B.t("continue_with",{provider:"Apple"}),canResize:!0,icon:y(tt,{className:"text-xl text-black dark:text-white sm:absolute sm:left-4 sm:top-1/2 sm:-translate-y-1/2 sm:text-2xl short:static short:left-auto short:top-auto short:translate-y-0 short:text-xl",name:"apple"}),loginSession:r}),g&&y(wo,{connection:"vipps",text:B.t("continue_with",{provider:"Vipps"}),canResize:!0,icon:y(yy,{className:"h-5 w-5 sm:absolute sm:left-4 sm:top-1/2 sm:h-6 sm:w-6 sm:-translate-y-1/2 short:static short:left-auto short:top-auto short:h-5 short:w-5 short:translate-y-0"}),loginSession:r})]})]})]})},ZE=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"}),impersonation:s.z.string().optional()})},responses:{200:{description:"Response"}}}),async t=>{const{state:e}=t.req.valid("query"),{theme:n,branding:r,loginSession:i,client:o}=await Ue(t,e);return t.html(y(da,{theme:n,branding:r,loginSession:i,client:o,email:i.authParams.username}))}).openapi(s.createRoute({tags:["login"],method:"post",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})}),body:{content:{"application/x-www-form-urlencoded":{schema:s.z.object({username:s.z.string().transform(t=>t.toLowerCase()),login_selection:s.z.enum(["code","password"]).optional()})}}}},responses:{400:{description:"Error response"},302:{description:"Redirect to enter code or password"}}}),async t=>{const{env:e}=t,{state:n}=t.req.valid("query"),r=t.req.valid("form");t.set("body",r),t.set("username",r.username);const{client:i,loginSession:o,theme:a,branding:l}=await Ue(t,n);t.set("client_id",i.id);const u=t.get("countryCode"),{normalized:d,connectionType:p}=Tl(r.username,u);if(!i.connections.find(D=>D.strategy===p)||!d)return t.html(y(da,{theme:a,branding:l,loginSession:o,error:B.t("invalid_identifier"),email:r.username,client:i}),400);const h=await Oo({userAdapter:e.data.users,tenant_id:i.tenant.id,username:d,provider:p});if(h&&t.set("user_id",h.user_id),!h)try{await d3(t,i,t.env.data,d)}catch{const D=Me(t,{type:Le.FAILED_SIGNUP,description:"Public signup is disabled"});return Bt(t,t.env.data.logs.create(i.tenant.id,D)),t.html(y(da,{theme:a,branding:l,loginSession:o,error:B.t("user_account_does_not_exist"),email:r.username,client:i}),400)}if(o.authParams.username=d,await e.data.loginSessions.update(i.tenant.id,o.id,o),await qE(t,i,r.username,r.login_selection))return t.redirect(`/u/enter-password?state=${n}`);let g=$r(),A=await e.data.codes.get(i.tenant.id,g,"otp");for(;A;)g=$r(),A=await e.data.codes.get(i.tenant.id,g,"otp");const $=await t.env.data.codes.create(i.tenant.id,{code_id:g,code_type:"otp",login_id:o.id,expires_at:new Date(Date.now()+ea).toISOString(),redirect_uri:o.authParams.redirect_uri}),N=i.connections.find(D=>D.strategy===p);if(!N)throw new C(400,{message:B.t("connection_not_found",{connection:p})});return p==="email"&&N.options.authentication_method==="magic_link"?await Tf(t,{to:d,code:$.code_id,authParams:o.authParams}):await Cf(t,{to:d,code:$.code_id}),t.redirect(`/u/enter-code?state=${n}`)}),gn=t=>y("a",{className:"block text-primary hover:text-primaryHover text-center",href:`/u/login/identifier?state=${t.state}`,children:B.t("go_back")});var Jo="_hp",QE={Change:"Input",DoubleClick:"DblClick"},e8={svg:"2000/svg",math:"1998/Math/MathML"},Yo=[],np=new WeakMap,qi=void 0,t8=()=>qi,Ln=t=>"t"in t,su={onClick:["click",!1]},Ug=t=>{if(!t.startsWith("on"))return;if(su[t])return su[t];const e=t.match(/^on([A-Z][a-zA-Z]+?(?:PointerCapture)?)(Capture)?$/);if(e){const[,n,r]=e;return su[t]=[(QE[n]||n).toLowerCase(),!!r]}},Mg=(t,e)=>qi&&t instanceof SVGElement&&/[A-Z]/.test(e)&&(e in t.style||e.match(/^(?:o|pai|str|u|ve)/))?e.replace(/([A-Z])/g,"-$1").toLowerCase():e,n8=(t,e,n)=>{var r;e||(e={});for(let i in e){const o=e[i];if(i!=="children"&&(!n||n[i]!==o)){i=fc(i);const a=Ug(i);if(a){if((n==null?void 0:n[i])!==o&&(n&&t.removeEventListener(a[0],n[i],a[1]),o!=null)){if(typeof o!="function")throw new Error(`Event handler for "${i}" is not a function`);t.addEventListener(a[0],o,a[1])}}else if(i==="dangerouslySetInnerHTML"&&o)t.innerHTML=o.__html;else if(i==="ref"){let l;typeof o=="function"?l=o(t)||(()=>o(null)):o&&"current"in o&&(o.current=t,l=()=>o.current=null),np.set(t,l)}else if(i==="style"){const l=t.style;typeof o=="string"?l.cssText=o:(l.cssText="",o!=null&&dy(o,l.setProperty.bind(l)))}else{if(i==="value"){const u=t.nodeName;if(u==="INPUT"||u==="TEXTAREA"||u==="SELECT"){if(t.value=o==null||o===!1?null:o,u==="TEXTAREA"){t.textContent=o;continue}else if(u==="SELECT"){t.selectedIndex===-1&&(t.selectedIndex=0);continue}}}else(i==="checked"&&t.nodeName==="INPUT"||i==="selected"&&t.nodeName==="OPTION")&&(t[i]=o);const l=Mg(t,i);o==null||o===!1?t.removeAttribute(l):o===!0?t.setAttribute(l,""):typeof o=="string"||typeof o=="number"?t.setAttribute(l,o):t.setAttribute(l,o.toString())}}}if(n)for(let i in n){const o=n[i];if(i!=="children"&&!(i in e)){i=fc(i);const a=Ug(i);a?t.removeEventListener(a[0],o,a[1]):i==="ref"?(r=np.get(t))==null||r():t.removeAttribute(Mg(t,i))}}},r8=(t,e)=>{e[We][0]=0,Yo.push([t,e]);const n=e.tag[Of]||e.tag,r=n.defaultProps?{...n.defaultProps,...e.props}:e.props;try{return[n.call(null,r)]}finally{Yo.pop()}},wy=(t,e,n,r,i)=>{var o,a;(o=t.vR)!=null&&o.length&&(r.push(...t.vR),delete t.vR),typeof t.tag=="function"&&((a=t[We][1][xy])==null||a.forEach(l=>i.push(l))),t.vC.forEach(l=>{var u;if(Ln(l))n.push(l);else if(typeof l.tag=="function"||l.tag===""){l.c=e;const d=n.length;if(wy(l,e,n,r,i),l.s){for(let p=d;p<n.length;p++)n[p].s=!0;l.s=!1}}else n.push(l),(u=l.vR)!=null&&u.length&&(r.push(...l.vR),delete l.vR)})},i8=t=>{for(;;t=t.tag===Jo||!t.vC||!t.pP?t.nN:t.vC[0]){if(!t)return null;if(t.tag!==Jo&&t.e)return t.e}},vy=t=>{var e,n,r,i,o,a;Ln(t)||((n=(e=t[We])==null?void 0:e[1][xy])==null||n.forEach(l=>{var u;return(u=l[2])==null?void 0:u.call(l)}),(r=np.get(t.e))==null||r(),t.p===2&&((i=t.vC)==null||i.forEach(l=>l.p=2)),(o=t.vC)==null||o.forEach(vy)),t.p||((a=t.e)==null||a.remove(),delete t.e),typeof t.tag=="function"&&(vo.delete(t),pa.delete(t),delete t[We][3],t.a=!0)},by=(t,e,n)=>{t.c=e,$y(t,e,n)},qg=(t,e)=>{if(e){for(let n=0,r=t.length;n<r;n++)if(t[n]===e)return n}},Vg=Symbol(),$y=(t,e,n)=>{var d;const r=[],i=[],o=[];wy(t,e,r,i,o),i.forEach(vy);const a=n?void 0:e.childNodes;let l,u=null;if(n)l=-1;else if(!a.length)l=0;else{const p=qg(a,i8(t.nN));p!==void 0?(u=a[p],l=p):l=qg(a,(d=r.find(h=>h.tag!==Jo&&h.e))==null?void 0:d.e)??-1,l===-1&&(n=!0)}for(let p=0,h=r.length;p<h;p++,l++){const g=r[p];let A;if(g.s&&g.e)A=g.e,g.s=!1;else{const $=n||!g.e;Ln(g)?(g.e&&g.d&&(g.e.textContent=g.t),g.d=!1,A=g.e||(g.e=document.createTextNode(g.t))):(A=g.e||(g.e=g.n?document.createElementNS(g.n,g.tag):document.createElement(g.tag)),n8(A,g.props,g.pP),$y(g,A,$))}g.tag===Jo?l--:n?A.parentNode||e.appendChild(A):a[l]!==A&&a[l-1]!==A&&(a[l+1]===A?e.appendChild(a[l]):e.insertBefore(A,u||a[l]||null))}if(t.pP&&delete t.pP,o.length){const p=[],h=[];o.forEach(([,g,,A,$])=>{g&&p.push(g),A&&h.push(A),$==null||$()}),p.forEach(g=>g()),h.length&&requestAnimationFrame(()=>{h.forEach(g=>g())})}},o8=(t,e)=>!!(t&&t.length===e.length&&t.every((n,r)=>n[1]===e[r][1])),pa=new WeakMap,rp=(t,e,n)=>{var o,a,l,u,d,p;const r=!n&&e.pC;n&&(e.pC||(e.pC=e.vC));let i;try{n||(n=typeof e.tag=="function"?r8(t,e):Es(e.props.children)),((o=n[0])==null?void 0:o.tag)===""&&n[0][ep]&&(i=n[0][ep],t[5].push([t,i,e]));const h=r?[...e.pC]:e.vC?[...e.vC]:void 0,g=[];let A;for(let $=0;$<n.length;$++){Array.isArray(n[$])&&n.splice($,1,...n[$].flat());let N=s8(n[$]);if(N){typeof N.tag=="function"&&!N.tag[oy]&&(Mi.length>0&&(N[We][2]=Mi.map(O=>[O,O.values.at(-1)])),(a=t[5])!=null&&a.length&&(N[We][3]=t[5].at(-1)));let D;if(h&&h.length){const O=h.findIndex(Ln(N)?x=>Ln(x):N.key!==void 0?x=>x.key===N.key&&x.tag===N.tag:x=>x.tag===N.tag);O!==-1&&(D=h[O],h.splice(O,1))}if(D)if(Ln(N))D.t!==N.t&&(D.t=N.t,D.d=!0),N=D;else{const O=D.pP=D.props;if(D.props=N.props,D.f||(D.f=N.f||e.f),typeof N.tag=="function"){const x=D[We][2];D[We][2]=N[We][2]||[],D[We][3]=N[We][3],!D.f&&((D.o||D)===N.o||(u=(l=D.tag)[NE])!=null&&u.call(l,O,D.props))&&o8(x,D[We][2])&&(D.s=!0)}N=D}else if(!Ln(N)&&qi){const O=co(qi);O&&(N.n=O)}if(!Ln(N)&&!N.s&&(rp(t,N),delete N.f),g.push(N),A&&!A.s&&!N.s)for(let O=A;O&&!Ln(O);O=(d=O.vC)==null?void 0:d.at(-1))O.nN=N;A=N}}e.vR=r?[...e.vC,...h||[]]:h||[],e.vC=g,r&&delete e.pC}catch(h){if(e.f=!0,h===Vg){if(i)return;throw h}const[g,A,$]=((p=e[We])==null?void 0:p[3])||[];if(A){const N=()=>fa([0,!1,t[2]],$),D=pa.get($)||[];D.push(N),pa.set($,D);const O=A(h,()=>{const x=pa.get($);if(x){const M=x.indexOf(N);if(M!==-1)return x.splice(M,1),N()}});if(O){if(t[0]===1)t[1]=!0;else if(rp(t,$,[O]),(A.length===1||t!==g)&&$.c){by($,$.c,!1);return}throw Vg}}throw h}finally{i&&t[5].pop()}},s8=t=>{if(!(t==null||typeof t=="boolean")){if(typeof t=="string"||typeof t=="number")return{t:t.toString(),d:!0};if("vR"in t&&(t={tag:t.tag,props:t.props,key:t.key,f:t.f,type:t.tag,ref:t.props.ref,o:t.o||t}),typeof t.tag=="function")t[We]=[0,[]];else{const e=e8[t.tag];e&&(qi||(qi=ay("")),t.props.children=[{tag:qi,props:{value:t.n=`http://www.w3.org/${e}`,children:t.props.children}}])}return t}},Hg=(t,e)=>{var n,r;(n=e[We][2])==null||n.forEach(([i,o])=>{i.values.push(o)});try{rp(t,e,void 0)}catch{return}if(e.a){delete e.a;return}(r=e[We][2])==null||r.forEach(([i])=>{i.values.pop()}),(t[0]!==1||!t[1])&&by(e,e.c,!1)},vo=new WeakMap,Kg=[],fa=async(t,e)=>{t[5]||(t[5]=[]);const n=vo.get(e);n&&n[0](void 0);let r;const i=new Promise(o=>r=o);if(vo.set(e,[r,()=>{t[2]?t[2](t,e,o=>{Hg(o,e)}).then(()=>r(e)):(Hg(t,e),r(e))}]),Kg.length)Kg.at(-1).add(e);else{await Promise.resolve();const o=vo.get(e);o&&(vo.delete(e),o[1]())}return i},a8=(t,e,n)=>({tag:Jo,props:{children:t},key:n,e,p:1}),au=0,xy=1,cu=2,lu=3,uu=new WeakMap,Ay=(t,e)=>!t||!e||t.length!==e.length||e.some((n,r)=>n!==t[r]),c8=void 0,Gg=[],l8=t=>{var a;const e=()=>typeof t=="function"?t():t,n=Yo.at(-1);if(!n)return[e(),()=>{}];const[,r]=n,i=(a=r[We][1])[au]||(a[au]=[]),o=r[We][0]++;return i[o]||(i[o]=[e(),l=>{const u=c8,d=i[o];if(typeof l=="function"&&(l=l(d[0])),!Object.is(l,d[0]))if(d[0]=l,Gg.length){const[p,h]=Gg.at(-1);Promise.all([p===3?r:fa([p,!1,u],r),h]).then(([g])=>{if(!g||!(p===2||p===3))return;const A=g.vC;requestAnimationFrame(()=>{setTimeout(()=>{A===g.vC&&fa([p===3?1:0,!1,u],g)})})})}else fa([0,!1,u],r)}])},Pf=(t,e)=>{var l;const n=Yo.at(-1);if(!n)return t;const[,r]=n,i=(l=r[We][1])[cu]||(l[cu]=[]),o=r[We][0]++,a=i[o];return Ay(a==null?void 0:a[1],e)?i[o]=[t,e]:t=i[o][0],t},u8=t=>{const e=uu.get(t);if(e){if(e.length===2)throw e[1];return e[0]}throw t.then(n=>uu.set(t,[n]),n=>uu.set(t,[void 0,n])),t},d8=(t,e)=>{var l;const n=Yo.at(-1);if(!n)return t();const[,r]=n,i=(l=r[We][1])[lu]||(l[lu]=[]),o=r[We][0]++,a=i[o];return Ay(a==null?void 0:a[1],e)&&(i[o]=[t(),e]),i[o][0]},p8=ay({pending:!1,data:null,method:null,action:null}),Wg=new Set,f8=t=>{Wg.add(t),t.finally(()=>Wg.delete(t))},Bf=(t,e)=>d8(()=>n=>{let r;t&&(typeof t=="function"?r=t(n)||(()=>{t(null)}):t&&"current"in t&&(t.current=n,r=()=>{t.current=null}));const i=e(n);return()=>{i==null||i(),r==null||r()}},[t]),fi=Object.create(null),Vs=Object.create(null),Ns=(t,e,n,r,i)=>{if(e!=null&&e.itemProp)return{tag:t,props:e,type:t,ref:e.ref};const o=document.head;let{onLoad:a,onError:l,precedence:u,blocking:d,...p}=e,h=null,g=!1;const A=ca[t];let $;if(A.length>0){const x=o.querySelectorAll(t);e:for(const M of x)for(const G of ca[t])if(M.getAttribute(G)===e[G]){h=M;break e}if(!h){const M=A.reduce((G,F)=>e[F]===void 0?G:`${G}-${F}-${e[F]}`,t);g=!Vs[M],h=Vs[M]||(Vs[M]=(()=>{const G=document.createElement(t);for(const F of A)e[F]!==void 0&&G.setAttribute(F,e[F]),e.rel&&G.setAttribute("rel",e.rel);return G})())}}else $=o.querySelectorAll(t);u=r?u??"":void 0,r&&(p[la]=u);const N=Pf(x=>{if(A.length>0){let M=!1;for(const G of o.querySelectorAll(t)){if(M&&G.getAttribute(la)!==u){o.insertBefore(x,G);return}G.getAttribute(la)===u&&(M=!0)}o.appendChild(x)}else if($){let M=!1;for(const G of $)if(G===x){M=!0;break}M||o.insertBefore(x,o.contains($[0])?$[0]:o.querySelector(t)),$=void 0}},[u]),D=Bf(e.ref,x=>{var F;const M=A[0];if(n===2&&(x.innerHTML=""),(g||$)&&N(x),!l&&!a)return;let G=fi[F=x.getAttribute(M)]||(fi[F]=new Promise((H,W)=>{x.addEventListener("load",H),x.addEventListener("error",W)}));a&&(G=G.then(a)),l&&(G=G.catch(l)),G.catch(()=>{})});if(i&&d==="render"){const x=ca[t][0];if(e[x]){const M=e[x],G=fi[M]||(fi[M]=new Promise((F,H)=>{N(h),h.addEventListener("load",F),h.addEventListener("error",H)}));u8(G)}}const O={tag:t,type:t,props:{...p,ref:D},ref:D};return O.p=n,h&&(O.e=h),a8(O,o)},h8=t=>{const e=t8(),n=e&&co(e);return n!=null&&n.endsWith("svg")?{tag:"title",props:t,type:"title",ref:t.ref}:Ns("title",t,void 0,!1,!1)},g8=t=>!t||["src","async"].some(e=>!t[e])?{tag:"script",props:t,type:"script",ref:t.ref}:Ns("script",t,1,!1,!0),m8=t=>!t||!["href","precedence"].every(e=>e in t)?{tag:"style",props:t,type:"style",ref:t.ref}:(t["data-href"]=t.href,delete t.href,Ns("style",t,2,!0,!0)),_8=t=>!t||["onLoad","onError"].some(e=>e in t)||t.rel==="stylesheet"&&(!("precedence"in t)||"disabled"in t)?{tag:"link",props:t,type:"link",ref:t.ref}:Ns("link",t,1,"precedence"in t,!0),y8=t=>Ns("meta",t,void 0,!1,!1),Ey=Symbol(),w8=t=>{const{action:e,...n}=t;typeof e!="function"&&(n.action=e);const[r,i]=l8([null,!1]),o=Pf(async d=>{const p=d.isTrusted?e:d.detail[Ey];if(typeof p!="function")return;d.preventDefault();const h=new FormData(d.target);i([h,!0]);const g=p(h);g instanceof Promise&&(f8(g),await g),i([null,!0])},[]),a=Bf(t.ref,d=>(d.addEventListener("submit",o),()=>{d.removeEventListener("submit",o)})),[l,u]=r;return r[1]=!1,{tag:p8,props:{value:{pending:l!==null,data:l,method:l?"post":null,action:l?e:null},children:{tag:"form",props:{...n,ref:a},type:"form",ref:a}},f:u}},Sy=(t,{formAction:e,...n})=>{if(typeof e=="function"){const r=Pf(i=>{i.preventDefault(),i.currentTarget.form.dispatchEvent(new CustomEvent("submit",{detail:{[Ey]:e}}))},[]);n.ref=Bf(n.ref,i=>(i.addEventListener("click",r),()=>{i.removeEventListener("click",r)}))}return{tag:t,props:n,type:t,ref:n.ref}},v8=t=>Sy("input",t),b8=t=>Sy("button",t);Object.assign(tp,{title:h8,script:g8,style:m8,link:_8,meta:y8,form:w8,input:v8,button:b8});cy(null);new TextEncoder;const Vi=t=>{const{i18nKey:e,values:n,components:r}=t,i=B.t(e,n),o=/<(\d+)>(.*?)<\/\d+>/g,a=[];let l=0,u;for(;(u=o.exec(i))!==null;){const[,d,p]=u,h=i.substring(l,u.index);h&&a.push(h);const g=parseInt(d,10);a.push(ME(r[g],{},p)),l=o.lastIndex}return l<i.length&&a.push(i.substring(l)),y(Rf,{children:a})},Xg=6,ip=({error:t,theme:e,branding:n,email:r,state:i,client:o,hasPasswordLogin:a})=>{const l=new URLSearchParams({state:i}),d=o.connections.map(({name:p})=>p).includes("auth2");return y(rt,{title:B.t("verify_your_email"),theme:e,branding:n,client:o,children:[y("div",{className:"mb-4 text-2xl font-medium",children:B.t("verify_your_email")}),y("div",{className:"mb-8 text-gray-300",children:y(Vi,{i18nKey:"code_sent_template",components:[y("span",{className:"text-black dark:text-white"},"span")],values:{username:r}})}),y("div",{className:"flex flex-1 flex-col justify-center",children:[y(Rn,{className:"pt-2",children:[y("input",{autoFocus:!0,type:"text",pattern:"[0-9]*",maxLength:Xg,inputMode:"numeric",name:"code",placeholder:"******",className:Jn("mb-2 w-full rounded-lg border bg-gray-100 px-4 pb-2 pt-2.5 text-center indent-[5px] font-mono text-3xl placeholder:text-gray-300 dark:bg-gray-600 md:text-3xl",{"border-red":t,"border-gray-100 dark:border-gray-500":!t}),minLength:Xg,required:!0,id:"code-input"}),t&&y(rr,{children:t}),y(nt,{className:"sm:mt-4 !text-base",children:[y("span",{children:B.t("login")}),y(tt,{className:"text-xs",name:"arrow-right"})]}),y("div",{className:"my-4 flex space-x-2 text-sm text-[#B2B2B2]",children:[y(tt,{className:"text-base",name:"info-bubble"}),y("div",{className:"text-sm text-gray-300 md:text-sm",children:B.t("sent_code_spam")})]}),d&&y("div",{className:"text-center mb-12",children:[y("div",{className:"relative mb-5 block text-center text-gray-300 dark:text-gray-300",children:[y("div",{className:"absolute left-0 right-0 top-1/2 border-b border-gray-200 dark:border-gray-600"}),y("div",{className:"relative inline-block bg-white px-2 dark:bg-gray-800",children:B.t("or")})]}),y(nt,{Component:"a",href:`/u/${a?"enter-password":"pre-signup"}?${l.toString()}`,variant:"secondary",className:"block",children:B.t("enter_your_password_btn")})]})]}),y(gn,{state:i})]})]})},Ft=t=>{const{message:e,theme:n,branding:r,client:i,pageTitle:o,state:a}=t;return y(rt,{title:"Login",theme:n,branding:r,client:i,children:[o?y("div",{className:"mb-6 text-gray-300",children:o}):"",y("div",{className:"flex flex-1 flex-col justify-center",children:e}),a?y(gn,{state:a}):""]})},$8=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state"})})},responses:{200:{description:"HTML page to enter verification code.",content:{"text/html":{schema:s.z.string()}}},400:{description:"Bad Request - HTML error page if username is missing in state.",content:{"text/html":{schema:s.z.string()}}},500:{description:"Internal Server Error - HTML error page.",content:{"text/html":{schema:s.z.string()}}}}}),async t=>{const{state:e}=t.req.valid("query");let n,r,i,o;try{if({theme:n,branding:r,loginSession:i,client:o}=await Ue(t,e),!i.authParams.username)return t.html(y(Ft,{theme:n,branding:r,client:o,state:e,pageTitle:B.t("error_page_title")||"Error",message:B.t("username_not_found_error")||"Username not found in session."}),400);const a=await Oo({userAdapter:t.env.data.users,tenant_id:o.tenant.id,username:i.authParams.username,provider:"auth2"});return t.html(y(ip,{theme:n,branding:r,email:i.authParams.username,state:e,client:o,hasPasswordLogin:!!a}))}catch(a){return console.error("Error in GET /u/enter-code:",a),r||(r=null),n||(n=null),o||(o=null),t.html(y(Ft,{theme:n,branding:r,client:o,state:e,pageTitle:B.t("error_page_title")||"Error",message:B.t("unexpected_error_try_again")||"An unexpected error occurred. Please try again."}),500)}}).openapi(s.createRoute({tags:["login"],method:"post",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state"})}),body:{content:{"application/x-www-form-urlencoded":{schema:s.z.object({code:s.z.string()})}}}},responses:{302:{description:"Redirect to continue authentication flow.",headers:s.z.object({Location:s.z.string().url()})},400:{description:"Bad Request - HTML page with an error message (e.g., invalid code, username missing).",content:{"text/html":{schema:s.z.string()}}},500:{description:"Internal Server Error - HTML error page for unexpected issues.",content:{"text/html":{schema:s.z.string()}}}}}),async t=>{var l;const{state:e}=t.req.valid("query"),{code:n}=t.req.valid("form"),{theme:r,branding:i,client:o,loginSession:a}=await Ue(t,e);if(!a.authParams.username)throw new C(400,{message:B.t("username_not_found_error")||"Username not found in session."});try{t.set("client_id",o.id);const u=await Ef(t,{client_id:o.id,authParams:a.authParams,username:a.authParams.username,otp:n});if(u instanceof Response)return u;throw new C(500,{message:B.t("unexpected_error_try_again")||"An unexpected error occurred. Please try again."})}catch(u){let d;try{d=await Oo({userAdapter:t.env.data.users,tenant_id:o.tenant.id,username:a.authParams.username,provider:"auth2"})}catch{d=null}return t.html(y(ip,{theme:r,branding:i,email:(l=a.authParams)==null?void 0:l.username,state:e,client:o,error:u.message,hasPasswordLogin:!!d}),400)}}),ky=t=>{const{theme:e,branding:n,client:r,state:i}=t;return y(rt,{title:B.t("unverified_email"),theme:e,branding:n,client:r,children:[y("div",{className:"flex flex-1 flex-col justify-center",children:[y("p",{className:"mb-8 text-gray-300 text-lg",children:B.t("unverified_email")}),y("div",{className:"my-4 flex space-x-2 text-sm text-[#B2B2B2]",children:[y(tt,{className:"text-base",name:"info-bubble"}),y("div",{className:"text-sm text-gray-300 md:text-sm",children:B.t("sent_code_spam")})]}),y(gn,{state:i})]}),y(gn,{state:i})]})},x8=({width:t=22,height:e=17})=>y("svg",{width:t,height:e,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 576 512",children:y("path",{fill:"currentColor",d:"M288 32c-80.8 0-145.5 36.8-192.6 80.6C48.6 156 17.3 208 2.5 243.7c-3.3 7.9-3.3 16.7 0 24.6C17.3 304 48.6 356 95.4 399.4 142.5 443.2 207.2 480 288 480s145.5-36.8 192.6-80.6c46.8-43.5 78.1-95.4 93-131.1 3.3-7.9 3.3-16.7 0-24.6-14.9-35.7-46.2-87.7-93-131.1C433.5 68.8 368.8 32 288 32M144 256a144 144 0 1 1 288 0 144 144 0 1 1-288 0m144-64c0 35.3-28.7 64-64 64-7.1 0-13.9-1.2-20.3-3.3-5.5-1.8-11.9 1.6-11.7 7.4.3 6.9 1.3 13.8 3.2 20.7 13.7 51.2 66.4 81.6 117.6 67.9s81.6-66.4 67.9-117.6c-11.1-41.5-47.8-69.4-88.6-71.1-5.8-.2-9.2 6.1-7.4 11.7 2.1 6.4 3.3 13.2 3.3 20.3"})}),A8=({width:t=23,height:e=18})=>y("svg",{width:t,height:e,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 640 512",children:y("path",{fill:"currentColor",d:"M38.8 5.1C28.4-3.1 13.3-1.2 5.1 9.2s-6.3 25.5 4.1 33.7l592 464c10.4 8.2 25.5 6.3 33.7-4.1s6.3-25.5-4.1-33.7l-105.2-82.4c39.6-40.6 66.4-86.1 79.9-118.4 3.3-7.9 3.3-16.7 0-24.6-14.9-35.7-46.2-87.7-93-131.1C465.5 68.8 400.8 32 320 32c-68.2 0-125 26.3-169.3 60.8zm184.3 144.4c25.5-23.3 59.6-37.5 96.9-37.5 79.5 0 144 64.5 144 144 0 24.9-6.3 48.3-17.4 68.7L408 294.5c8.4-19.3 10.6-41.4 4.8-63.3-11.1-41.5-47.8-69.4-88.6-71.1-5.8-.2-9.2 6.1-7.4 11.7 2.1 6.4 3.3 13.2 3.3 20.3 0 10.2-2.4 19.8-6.6 28.3l-90.3-70.8zM373 389.9c-16.4 6.5-34.3 10.1-53 10.1-79.5 0-144-64.5-144-144 0-6.9.5-13.6 1.4-20.2l-94.3-74.3c-22.8 29.7-39.1 59.3-48.6 82.2-3.3 7.9-3.3 16.7 0 24.6 14.9 35.7 46.2 87.7 93 131.1 47 43.8 111.7 80.6 192.5 80.6 47.8 0 89.9-12.9 126.2-32.5z"})}),op=({name:t,placeholder:e=B.t("password")})=>y("div",{className:"password-input relative mb-2",children:[y("input",{type:"password",name:t,placeholder:e,className:"w-full rounded-lg bg-gray-100 px-4 py-5 text-base placeholder:text-gray-300 dark:bg-gray-600 md:text-base",required:!0}),y("button",{type:"button","aria-label":B.t("show_password"),title:B.t("show_password"),className:"show-password-toggle-show absolute right-0 top-0 w-10 h-full rounded-r-lg text-gray-400 column hover:bg-black/5",children:y(x8,{})}),y("button",{type:"button","aria-label":B.t("hide_password"),title:B.t("hide_password"),className:"show-password-toggle-hide !hidden absolute right-0 top-0 w-10 h-full rounded-r-lg text-gray-400 column hover:bg-black/5",children:y(A8,{})})]});var Jg=Object.freeze,E8=Object.defineProperty,S8=(t,e)=>Jg(E8(t,"raw",{value:Jg(t.slice())})),Yg;const ha=t=>{const{error:e,theme:n,branding:r,email:i,state:o,client:a}=t,l=new URLSearchParams({state:o});return y(rt,{title:B.t("enter_password"),theme:n,branding:r,client:a,children:[y("div",{className:"mb-4 text-lg font-medium sm:text-2xl",children:B.t("enter_password")}),y("div",{className:"mb-6 text-gray-300",children:B.t("enter_password_description")}),y("div",{className:"flex flex-1 flex-col justify-center",children:[y(Rn,{className:"mb-7",children:[y("input",{type:"text",name:"username",placeholder:B.t("email_placeholder"),className:"mb-2 w-full rounded-lg bg-gray-100 px-4 py-5 text-base placeholder:text-gray-300 dark:bg-gray-600 md:text-base",value:i}),y(op,{name:"password"}),e&&y(rr,{children:e}),y(nt,{className:"sm:mt-4 !text-base",children:[y("span",{children:B.t("login")}),y(tt,{className:"text-xs",name:"arrow-right"})]})]}),y("a",{href:`/u/forgot-password?${l.toString()}`,className:"text-primary hover:underline mb-4",children:B.t("forgot_password_link")}),y("div",{className:"text-center mb-12",children:[y("div",{className:"relative mb-5 block text-center text-gray-300 dark:text-gray-300",children:[y("div",{className:"absolute left-0 right-0 top-1/2 border-b border-gray-200 dark:border-gray-600"}),y("div",{className:"relative inline-block bg-white px-2 dark:bg-gray-800",children:B.t("or")})]}),y("form",{method:"post",action:`/u/login/identifier?${l.toString()}`,children:[y("input",{type:"hidden",name:"login_selection",value:"code"}),y("input",{type:"hidden",name:"username",value:i}),y(nt,{variant:"secondary",className:"block",children:B.t("enter_a_code_btn")})]})]}),y(gn,{state:o})]}),iy(Yg||(Yg=S8([`
230
+ c2.7,4.1,6.5,6.6,10.9,6.6c4,0,7.2-2,9.6-5.2c0.9-1.2,0.9-2.5,0-3.1C33.3,22.9,32.1,23.2,31.2,24.4z`})]}),da=({error:t,theme:e,branding:n,loginSession:r,email:i,client:o})=>{const a=o.connections.map(({strategy:G})=>G),l=a.includes("email")||a.includes("Username-Password-Authentication"),u=a.includes("sms"),d=a.includes("facebook"),p=a.includes("google-oauth2"),h=a.includes("apple"),g=a.includes("vipps"),A=d||p||h||g,$=l||u;let N="text",D="username";const O=l&&u?"email_or_phone_placeholder":l?"email_placeholder":"phone_placeholder";let x=B.t(O,l&&u?"Email or Phone Number":l?"Email Address":"Phone Number");return y(nt,{title:B.t("welcome"),theme:e,branding:n,client:o,children:[y("div",{className:"mb-4 text-lg font-medium sm:text-2xl",children:B.t("welcome")}),y("div",{className:"mb-8 text-gray-300",children:B.t("login_description_template",{authMethod:B.t(O,{defaultValue:l&&u?"email or phone number":l?"email address":"phone number"}).toLocaleLowerCase(),defaultValue:"Sign in with your {{authMethod}}"})}),y("div",{className:"flex flex-1 flex-col justify-center",children:[$&&y(Rn,{className:"mb-7",children:[y("input",{type:N,name:D,placeholder:x,className:Jn("mb-2 w-full rounded-lg border bg-gray-100 px-4 py-5 text-base placeholder:text-gray-300 dark:bg-gray-600 md:text-base",{"border-red":t,"border-gray-100 dark:border-gray-500":!t}),required:!0,value:i||""}),t&&y(rr,{children:t}),y(tt,{className:"sm:mt-4 !text-base",children:[y("span",{children:B.t("continue")}),y(et,{className:"text-xs",name:"arrow-right"})]})]}),$&&A&&y("div",{className:"relative mb-5 block text-center text-gray-300 dark:text-gray-300",children:[y("div",{className:"absolute left-0 right-0 top-1/2 border-b border-gray-200 dark:border-gray-600"}),y("div",{className:"relative inline-block bg-white px-2 dark:bg-gray-800",children:B.t("continue_social_login")})]}),y("div",{className:"flex space-x-4 sm:flex-col sm:space-x-0 sm:space-y-4 short:flex-row short:space-x-4 short:space-y-0",children:[d&&y(wo,{connection:"facebook",text:B.t("continue_with",{provider:"Facebook"}),canResize:!0,icon:y(et,{className:"text-xl text-[#1196F5] sm:absolute sm:left-4 sm:top-1/2 sm:-translate-y-1/2 sm:text-2xl short:static short:left-auto short:top-auto short:translate-y-0 short:text-xl",name:"facebook"}),loginSession:r}),p&&y(wo,{connection:"google-oauth2",text:B.t("continue_with",{provider:"Google"}),canResize:!0,icon:y(_y,{className:"h-5 w-5 sm:absolute sm:left-4 sm:top-1/2 sm:h-6 sm:w-6 sm:-translate-y-1/2 short:static short:left-auto short:top-auto short:h-5 short:w-5 short:translate-y-0"}),loginSession:r}),h&&y(wo,{connection:"apple",text:B.t("continue_with",{provider:"Apple"}),canResize:!0,icon:y(et,{className:"text-xl text-black dark:text-white sm:absolute sm:left-4 sm:top-1/2 sm:-translate-y-1/2 sm:text-2xl short:static short:left-auto short:top-auto short:translate-y-0 short:text-xl",name:"apple"}),loginSession:r}),g&&y(wo,{connection:"vipps",text:B.t("continue_with",{provider:"Vipps"}),canResize:!0,icon:y(yy,{className:"h-5 w-5 sm:absolute sm:left-4 sm:top-1/2 sm:h-6 sm:w-6 sm:-translate-y-1/2 short:static short:left-auto short:top-auto short:h-5 short:w-5 short:translate-y-0"}),loginSession:r})]})]})]})},ZE=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"}),impersonation:s.z.string().optional()})},responses:{200:{description:"Response"}}}),async t=>{const{state:e}=t.req.valid("query"),{theme:n,branding:r,loginSession:i,client:o}=await Ue(t,e);return t.html(y(da,{theme:n,branding:r,loginSession:i,client:o,email:i.authParams.username}))}).openapi(s.createRoute({tags:["login"],method:"post",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})}),body:{content:{"application/x-www-form-urlencoded":{schema:s.z.object({username:s.z.string().transform(t=>t.toLowerCase()),login_selection:s.z.enum(["code","password"]).optional()})}}}},responses:{400:{description:"Error response"},302:{description:"Redirect to enter code or password"}}}),async t=>{const{env:e}=t,{state:n}=t.req.valid("query"),r=t.req.valid("form");t.set("body",r),t.set("username",r.username);const{client:i,loginSession:o,theme:a,branding:l}=await Ue(t,n);t.set("client_id",i.id);const u=t.get("countryCode"),{normalized:d,connectionType:p}=Tl(r.username,u);if(!i.connections.find(D=>D.strategy===p)||!d)return t.html(y(da,{theme:a,branding:l,loginSession:o,error:B.t("invalid_identifier"),email:r.username,client:i}),400);const h=await Oo({userAdapter:e.data.users,tenant_id:i.tenant.id,username:d,provider:p});if(h&&t.set("user_id",h.user_id),!h)try{await d3(t,i,t.env.data,d)}catch{const D=Me(t,{type:Le.FAILED_SIGNUP,description:"Public signup is disabled"});return Bt(t,t.env.data.logs.create(i.tenant.id,D)),t.html(y(da,{theme:a,branding:l,loginSession:o,error:B.t("user_account_does_not_exist"),email:r.username,client:i}),400)}if(o.authParams.username=d,await e.data.loginSessions.update(i.tenant.id,o.id,o),await qE(t,i,r.username,r.login_selection))return t.redirect(`/u/enter-password?state=${n}`);let g=$r(),A=await e.data.codes.get(i.tenant.id,g,"otp");for(;A;)g=$r(),A=await e.data.codes.get(i.tenant.id,g,"otp");const $=await t.env.data.codes.create(i.tenant.id,{code_id:g,code_type:"otp",login_id:o.id,expires_at:new Date(Date.now()+ea).toISOString(),redirect_uri:o.authParams.redirect_uri}),N=i.connections.find(D=>D.strategy===p);if(!N)throw new C(400,{message:B.t("connection_not_found",{connection:p})});return p==="email"&&N.options.authentication_method==="magic_link"?await Tf(t,{to:d,code:$.code_id,authParams:o.authParams}):await Cf(t,{to:d,code:$.code_id}),t.redirect(`/u/enter-code?state=${n}`)}),gn=t=>y("a",{className:"block text-primary hover:text-primaryHover text-center",href:`/u/login/identifier?state=${t.state}`,children:B.t("go_back")});var Jo="_hp",QE={Change:"Input",DoubleClick:"DblClick"},e8={svg:"2000/svg",math:"1998/Math/MathML"},Yo=[],np=new WeakMap,qi=void 0,t8=()=>qi,Ln=t=>"t"in t,su={onClick:["click",!1]},Ug=t=>{if(!t.startsWith("on"))return;if(su[t])return su[t];const e=t.match(/^on([A-Z][a-zA-Z]+?(?:PointerCapture)?)(Capture)?$/);if(e){const[,n,r]=e;return su[t]=[(QE[n]||n).toLowerCase(),!!r]}},Mg=(t,e)=>qi&&t instanceof SVGElement&&/[A-Z]/.test(e)&&(e in t.style||e.match(/^(?:o|pai|str|u|ve)/))?e.replace(/([A-Z])/g,"-$1").toLowerCase():e,n8=(t,e,n)=>{var r;e||(e={});for(let i in e){const o=e[i];if(i!=="children"&&(!n||n[i]!==o)){i=fc(i);const a=Ug(i);if(a){if((n==null?void 0:n[i])!==o&&(n&&t.removeEventListener(a[0],n[i],a[1]),o!=null)){if(typeof o!="function")throw new Error(`Event handler for "${i}" is not a function`);t.addEventListener(a[0],o,a[1])}}else if(i==="dangerouslySetInnerHTML"&&o)t.innerHTML=o.__html;else if(i==="ref"){let l;typeof o=="function"?l=o(t)||(()=>o(null)):o&&"current"in o&&(o.current=t,l=()=>o.current=null),np.set(t,l)}else if(i==="style"){const l=t.style;typeof o=="string"?l.cssText=o:(l.cssText="",o!=null&&dy(o,l.setProperty.bind(l)))}else{if(i==="value"){const u=t.nodeName;if(u==="INPUT"||u==="TEXTAREA"||u==="SELECT"){if(t.value=o==null||o===!1?null:o,u==="TEXTAREA"){t.textContent=o;continue}else if(u==="SELECT"){t.selectedIndex===-1&&(t.selectedIndex=0);continue}}}else(i==="checked"&&t.nodeName==="INPUT"||i==="selected"&&t.nodeName==="OPTION")&&(t[i]=o);const l=Mg(t,i);o==null||o===!1?t.removeAttribute(l):o===!0?t.setAttribute(l,""):typeof o=="string"||typeof o=="number"?t.setAttribute(l,o):t.setAttribute(l,o.toString())}}}if(n)for(let i in n){const o=n[i];if(i!=="children"&&!(i in e)){i=fc(i);const a=Ug(i);a?t.removeEventListener(a[0],o,a[1]):i==="ref"?(r=np.get(t))==null||r():t.removeAttribute(Mg(t,i))}}},r8=(t,e)=>{e[Ge][0]=0,Yo.push([t,e]);const n=e.tag[Of]||e.tag,r=n.defaultProps?{...n.defaultProps,...e.props}:e.props;try{return[n.call(null,r)]}finally{Yo.pop()}},wy=(t,e,n,r,i)=>{var o,a;(o=t.vR)!=null&&o.length&&(r.push(...t.vR),delete t.vR),typeof t.tag=="function"&&((a=t[Ge][1][xy])==null||a.forEach(l=>i.push(l))),t.vC.forEach(l=>{var u;if(Ln(l))n.push(l);else if(typeof l.tag=="function"||l.tag===""){l.c=e;const d=n.length;if(wy(l,e,n,r,i),l.s){for(let p=d;p<n.length;p++)n[p].s=!0;l.s=!1}}else n.push(l),(u=l.vR)!=null&&u.length&&(r.push(...l.vR),delete l.vR)})},i8=t=>{for(;;t=t.tag===Jo||!t.vC||!t.pP?t.nN:t.vC[0]){if(!t)return null;if(t.tag!==Jo&&t.e)return t.e}},vy=t=>{var e,n,r,i,o,a;Ln(t)||((n=(e=t[Ge])==null?void 0:e[1][xy])==null||n.forEach(l=>{var u;return(u=l[2])==null?void 0:u.call(l)}),(r=np.get(t.e))==null||r(),t.p===2&&((i=t.vC)==null||i.forEach(l=>l.p=2)),(o=t.vC)==null||o.forEach(vy)),t.p||((a=t.e)==null||a.remove(),delete t.e),typeof t.tag=="function"&&(vo.delete(t),pa.delete(t),delete t[Ge][3],t.a=!0)},by=(t,e,n)=>{t.c=e,$y(t,e,n)},qg=(t,e)=>{if(e){for(let n=0,r=t.length;n<r;n++)if(t[n]===e)return n}},Vg=Symbol(),$y=(t,e,n)=>{var d;const r=[],i=[],o=[];wy(t,e,r,i,o),i.forEach(vy);const a=n?void 0:e.childNodes;let l,u=null;if(n)l=-1;else if(!a.length)l=0;else{const p=qg(a,i8(t.nN));p!==void 0?(u=a[p],l=p):l=qg(a,(d=r.find(h=>h.tag!==Jo&&h.e))==null?void 0:d.e)??-1,l===-1&&(n=!0)}for(let p=0,h=r.length;p<h;p++,l++){const g=r[p];let A;if(g.s&&g.e)A=g.e,g.s=!1;else{const $=n||!g.e;Ln(g)?(g.e&&g.d&&(g.e.textContent=g.t),g.d=!1,A=g.e||(g.e=document.createTextNode(g.t))):(A=g.e||(g.e=g.n?document.createElementNS(g.n,g.tag):document.createElement(g.tag)),n8(A,g.props,g.pP),$y(g,A,$))}g.tag===Jo?l--:n?A.parentNode||e.appendChild(A):a[l]!==A&&a[l-1]!==A&&(a[l+1]===A?e.appendChild(a[l]):e.insertBefore(A,u||a[l]||null))}if(t.pP&&delete t.pP,o.length){const p=[],h=[];o.forEach(([,g,,A,$])=>{g&&p.push(g),A&&h.push(A),$==null||$()}),p.forEach(g=>g()),h.length&&requestAnimationFrame(()=>{h.forEach(g=>g())})}},o8=(t,e)=>!!(t&&t.length===e.length&&t.every((n,r)=>n[1]===e[r][1])),pa=new WeakMap,rp=(t,e,n)=>{var o,a,l,u,d,p;const r=!n&&e.pC;n&&(e.pC||(e.pC=e.vC));let i;try{n||(n=typeof e.tag=="function"?r8(t,e):Es(e.props.children)),((o=n[0])==null?void 0:o.tag)===""&&n[0][ep]&&(i=n[0][ep],t[5].push([t,i,e]));const h=r?[...e.pC]:e.vC?[...e.vC]:void 0,g=[];let A;for(let $=0;$<n.length;$++){Array.isArray(n[$])&&n.splice($,1,...n[$].flat());let N=s8(n[$]);if(N){typeof N.tag=="function"&&!N.tag[oy]&&(Mi.length>0&&(N[Ge][2]=Mi.map(O=>[O,O.values.at(-1)])),(a=t[5])!=null&&a.length&&(N[Ge][3]=t[5].at(-1)));let D;if(h&&h.length){const O=h.findIndex(Ln(N)?x=>Ln(x):N.key!==void 0?x=>x.key===N.key&&x.tag===N.tag:x=>x.tag===N.tag);O!==-1&&(D=h[O],h.splice(O,1))}if(D)if(Ln(N))D.t!==N.t&&(D.t=N.t,D.d=!0),N=D;else{const O=D.pP=D.props;if(D.props=N.props,D.f||(D.f=N.f||e.f),typeof N.tag=="function"){const x=D[Ge][2];D[Ge][2]=N[Ge][2]||[],D[Ge][3]=N[Ge][3],!D.f&&((D.o||D)===N.o||(u=(l=D.tag)[NE])!=null&&u.call(l,O,D.props))&&o8(x,D[Ge][2])&&(D.s=!0)}N=D}else if(!Ln(N)&&qi){const O=co(qi);O&&(N.n=O)}if(!Ln(N)&&!N.s&&(rp(t,N),delete N.f),g.push(N),A&&!A.s&&!N.s)for(let O=A;O&&!Ln(O);O=(d=O.vC)==null?void 0:d.at(-1))O.nN=N;A=N}}e.vR=r?[...e.vC,...h||[]]:h||[],e.vC=g,r&&delete e.pC}catch(h){if(e.f=!0,h===Vg){if(i)return;throw h}const[g,A,$]=((p=e[Ge])==null?void 0:p[3])||[];if(A){const N=()=>fa([0,!1,t[2]],$),D=pa.get($)||[];D.push(N),pa.set($,D);const O=A(h,()=>{const x=pa.get($);if(x){const M=x.indexOf(N);if(M!==-1)return x.splice(M,1),N()}});if(O){if(t[0]===1)t[1]=!0;else if(rp(t,$,[O]),(A.length===1||t!==g)&&$.c){by($,$.c,!1);return}throw Vg}}throw h}finally{i&&t[5].pop()}},s8=t=>{if(!(t==null||typeof t=="boolean")){if(typeof t=="string"||typeof t=="number")return{t:t.toString(),d:!0};if("vR"in t&&(t={tag:t.tag,props:t.props,key:t.key,f:t.f,type:t.tag,ref:t.props.ref,o:t.o||t}),typeof t.tag=="function")t[Ge]=[0,[]];else{const e=e8[t.tag];e&&(qi||(qi=ay("")),t.props.children=[{tag:qi,props:{value:t.n=`http://www.w3.org/${e}`,children:t.props.children}}])}return t}},Hg=(t,e)=>{var n,r;(n=e[Ge][2])==null||n.forEach(([i,o])=>{i.values.push(o)});try{rp(t,e,void 0)}catch{return}if(e.a){delete e.a;return}(r=e[Ge][2])==null||r.forEach(([i])=>{i.values.pop()}),(t[0]!==1||!t[1])&&by(e,e.c,!1)},vo=new WeakMap,Kg=[],fa=async(t,e)=>{t[5]||(t[5]=[]);const n=vo.get(e);n&&n[0](void 0);let r;const i=new Promise(o=>r=o);if(vo.set(e,[r,()=>{t[2]?t[2](t,e,o=>{Hg(o,e)}).then(()=>r(e)):(Hg(t,e),r(e))}]),Kg.length)Kg.at(-1).add(e);else{await Promise.resolve();const o=vo.get(e);o&&(vo.delete(e),o[1]())}return i},a8=(t,e,n)=>({tag:Jo,props:{children:t},key:n,e,p:1}),au=0,xy=1,cu=2,lu=3,uu=new WeakMap,Ay=(t,e)=>!t||!e||t.length!==e.length||e.some((n,r)=>n!==t[r]),c8=void 0,Gg=[],l8=t=>{var a;const e=()=>typeof t=="function"?t():t,n=Yo.at(-1);if(!n)return[e(),()=>{}];const[,r]=n,i=(a=r[Ge][1])[au]||(a[au]=[]),o=r[Ge][0]++;return i[o]||(i[o]=[e(),l=>{const u=c8,d=i[o];if(typeof l=="function"&&(l=l(d[0])),!Object.is(l,d[0]))if(d[0]=l,Gg.length){const[p,h]=Gg.at(-1);Promise.all([p===3?r:fa([p,!1,u],r),h]).then(([g])=>{if(!g||!(p===2||p===3))return;const A=g.vC;requestAnimationFrame(()=>{setTimeout(()=>{A===g.vC&&fa([p===3?1:0,!1,u],g)})})})}else fa([0,!1,u],r)}])},Pf=(t,e)=>{var l;const n=Yo.at(-1);if(!n)return t;const[,r]=n,i=(l=r[Ge][1])[cu]||(l[cu]=[]),o=r[Ge][0]++,a=i[o];return Ay(a==null?void 0:a[1],e)?i[o]=[t,e]:t=i[o][0],t},u8=t=>{const e=uu.get(t);if(e){if(e.length===2)throw e[1];return e[0]}throw t.then(n=>uu.set(t,[n]),n=>uu.set(t,[void 0,n])),t},d8=(t,e)=>{var l;const n=Yo.at(-1);if(!n)return t();const[,r]=n,i=(l=r[Ge][1])[lu]||(l[lu]=[]),o=r[Ge][0]++,a=i[o];return Ay(a==null?void 0:a[1],e)&&(i[o]=[t(),e]),i[o][0]},p8=ay({pending:!1,data:null,method:null,action:null}),Wg=new Set,f8=t=>{Wg.add(t),t.finally(()=>Wg.delete(t))},Bf=(t,e)=>d8(()=>n=>{let r;t&&(typeof t=="function"?r=t(n)||(()=>{t(null)}):t&&"current"in t&&(t.current=n,r=()=>{t.current=null}));const i=e(n);return()=>{i==null||i(),r==null||r()}},[t]),fi=Object.create(null),Vs=Object.create(null),Ns=(t,e,n,r,i)=>{if(e!=null&&e.itemProp)return{tag:t,props:e,type:t,ref:e.ref};const o=document.head;let{onLoad:a,onError:l,precedence:u,blocking:d,...p}=e,h=null,g=!1;const A=ca[t];let $;if(A.length>0){const x=o.querySelectorAll(t);e:for(const M of x)for(const G of ca[t])if(M.getAttribute(G)===e[G]){h=M;break e}if(!h){const M=A.reduce((G,F)=>e[F]===void 0?G:`${G}-${F}-${e[F]}`,t);g=!Vs[M],h=Vs[M]||(Vs[M]=(()=>{const G=document.createElement(t);for(const F of A)e[F]!==void 0&&G.setAttribute(F,e[F]),e.rel&&G.setAttribute("rel",e.rel);return G})())}}else $=o.querySelectorAll(t);u=r?u??"":void 0,r&&(p[la]=u);const N=Pf(x=>{if(A.length>0){let M=!1;for(const G of o.querySelectorAll(t)){if(M&&G.getAttribute(la)!==u){o.insertBefore(x,G);return}G.getAttribute(la)===u&&(M=!0)}o.appendChild(x)}else if($){let M=!1;for(const G of $)if(G===x){M=!0;break}M||o.insertBefore(x,o.contains($[0])?$[0]:o.querySelector(t)),$=void 0}},[u]),D=Bf(e.ref,x=>{var F;const M=A[0];if(n===2&&(x.innerHTML=""),(g||$)&&N(x),!l&&!a)return;let G=fi[F=x.getAttribute(M)]||(fi[F]=new Promise((H,W)=>{x.addEventListener("load",H),x.addEventListener("error",W)}));a&&(G=G.then(a)),l&&(G=G.catch(l)),G.catch(()=>{})});if(i&&d==="render"){const x=ca[t][0];if(e[x]){const M=e[x],G=fi[M]||(fi[M]=new Promise((F,H)=>{N(h),h.addEventListener("load",F),h.addEventListener("error",H)}));u8(G)}}const O={tag:t,type:t,props:{...p,ref:D},ref:D};return O.p=n,h&&(O.e=h),a8(O,o)},h8=t=>{const e=t8(),n=e&&co(e);return n!=null&&n.endsWith("svg")?{tag:"title",props:t,type:"title",ref:t.ref}:Ns("title",t,void 0,!1,!1)},g8=t=>!t||["src","async"].some(e=>!t[e])?{tag:"script",props:t,type:"script",ref:t.ref}:Ns("script",t,1,!1,!0),m8=t=>!t||!["href","precedence"].every(e=>e in t)?{tag:"style",props:t,type:"style",ref:t.ref}:(t["data-href"]=t.href,delete t.href,Ns("style",t,2,!0,!0)),_8=t=>!t||["onLoad","onError"].some(e=>e in t)||t.rel==="stylesheet"&&(!("precedence"in t)||"disabled"in t)?{tag:"link",props:t,type:"link",ref:t.ref}:Ns("link",t,1,"precedence"in t,!0),y8=t=>Ns("meta",t,void 0,!1,!1),Ey=Symbol(),w8=t=>{const{action:e,...n}=t;typeof e!="function"&&(n.action=e);const[r,i]=l8([null,!1]),o=Pf(async d=>{const p=d.isTrusted?e:d.detail[Ey];if(typeof p!="function")return;d.preventDefault();const h=new FormData(d.target);i([h,!0]);const g=p(h);g instanceof Promise&&(f8(g),await g),i([null,!0])},[]),a=Bf(t.ref,d=>(d.addEventListener("submit",o),()=>{d.removeEventListener("submit",o)})),[l,u]=r;return r[1]=!1,{tag:p8,props:{value:{pending:l!==null,data:l,method:l?"post":null,action:l?e:null},children:{tag:"form",props:{...n,ref:a},type:"form",ref:a}},f:u}},Sy=(t,{formAction:e,...n})=>{if(typeof e=="function"){const r=Pf(i=>{i.preventDefault(),i.currentTarget.form.dispatchEvent(new CustomEvent("submit",{detail:{[Ey]:e}}))},[]);n.ref=Bf(n.ref,i=>(i.addEventListener("click",r),()=>{i.removeEventListener("click",r)}))}return{tag:t,props:n,type:t,ref:n.ref}},v8=t=>Sy("input",t),b8=t=>Sy("button",t);Object.assign(tp,{title:h8,script:g8,style:m8,link:_8,meta:y8,form:w8,input:v8,button:b8});cy(null);new TextEncoder;const Vi=t=>{const{i18nKey:e,values:n,components:r}=t,i=B.t(e,n),o=/<(\d+)>(.*?)<\/\d+>/g,a=[];let l=0,u;for(;(u=o.exec(i))!==null;){const[,d,p]=u,h=i.substring(l,u.index);h&&a.push(h);const g=parseInt(d,10);a.push(ME(r[g],{},p)),l=o.lastIndex}return l<i.length&&a.push(i.substring(l)),y(Rf,{children:a})},Xg=6,ip=({error:t,theme:e,branding:n,email:r,state:i,client:o,hasPasswordLogin:a})=>{const l=new URLSearchParams({state:i}),d=o.connections.map(({name:p})=>p).includes("auth2");return y(nt,{title:B.t("verify_your_email"),theme:e,branding:n,client:o,children:[y("div",{className:"mb-4 text-2xl font-medium",children:B.t("verify_your_email")}),y("div",{className:"mb-8 text-gray-300",children:y(Vi,{i18nKey:"code_sent_template",components:[y("span",{className:"text-black dark:text-white"},"span")],values:{username:r}})}),y("div",{className:"flex flex-1 flex-col justify-center",children:[y(Rn,{className:"pt-2",children:[y("input",{autoFocus:!0,type:"text",pattern:"[0-9]*",maxLength:Xg,inputMode:"numeric",name:"code",placeholder:"******",className:Jn("mb-2 w-full rounded-lg border bg-gray-100 px-4 pb-2 pt-2.5 text-center indent-[5px] font-mono text-3xl placeholder:text-gray-300 dark:bg-gray-600 md:text-3xl",{"border-red":t,"border-gray-100 dark:border-gray-500":!t}),minLength:Xg,required:!0,id:"code-input"}),t&&y(rr,{children:t}),y(tt,{className:"sm:mt-4 !text-base",children:[y("span",{children:B.t("login")}),y(et,{className:"text-xs",name:"arrow-right"})]}),y("div",{className:"my-4 flex space-x-2 text-sm text-[#B2B2B2]",children:[y(et,{className:"text-base",name:"info-bubble"}),y("div",{className:"text-sm text-gray-300 md:text-sm",children:B.t("sent_code_spam")})]}),d&&y("div",{className:"text-center mb-12",children:[y("div",{className:"relative mb-5 block text-center text-gray-300 dark:text-gray-300",children:[y("div",{className:"absolute left-0 right-0 top-1/2 border-b border-gray-200 dark:border-gray-600"}),y("div",{className:"relative inline-block bg-white px-2 dark:bg-gray-800",children:B.t("or")})]}),y(tt,{Component:"a",href:`/u/${a?"enter-password":"pre-signup"}?${l.toString()}`,variant:"secondary",className:"block",children:B.t("enter_your_password_btn")})]})]}),y(gn,{state:i})]})]})},Ft=t=>{const{message:e,theme:n,branding:r,client:i,pageTitle:o,state:a}=t;return y(nt,{title:"Login",theme:n,branding:r,client:i,children:[o?y("div",{className:"mb-6 text-gray-300",children:o}):"",y("div",{className:"flex flex-1 flex-col justify-center",children:e}),a?y(gn,{state:a}):""]})},$8=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state"})})},responses:{200:{description:"HTML page to enter verification code.",content:{"text/html":{schema:s.z.string()}}},400:{description:"Bad Request - HTML error page if username is missing in state.",content:{"text/html":{schema:s.z.string()}}},500:{description:"Internal Server Error - HTML error page.",content:{"text/html":{schema:s.z.string()}}}}}),async t=>{const{state:e}=t.req.valid("query");let n,r,i,o;try{if({theme:n,branding:r,loginSession:i,client:o}=await Ue(t,e),!i.authParams.username)return t.html(y(Ft,{theme:n,branding:r,client:o,state:e,pageTitle:B.t("error_page_title")||"Error",message:B.t("username_not_found_error")||"Username not found in session."}),400);const a=await Oo({userAdapter:t.env.data.users,tenant_id:o.tenant.id,username:i.authParams.username,provider:"auth2"});return t.html(y(ip,{theme:n,branding:r,email:i.authParams.username,state:e,client:o,hasPasswordLogin:!!a}))}catch(a){return console.error("Error in GET /u/enter-code:",a),r||(r=null),n||(n=null),o||(o=null),t.html(y(Ft,{theme:n,branding:r,client:o,state:e,pageTitle:B.t("error_page_title")||"Error",message:B.t("unexpected_error_try_again")||"An unexpected error occurred. Please try again."}),500)}}).openapi(s.createRoute({tags:["login"],method:"post",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state"})}),body:{content:{"application/x-www-form-urlencoded":{schema:s.z.object({code:s.z.string()})}}}},responses:{302:{description:"Redirect to continue authentication flow.",headers:s.z.object({Location:s.z.string().url()})},400:{description:"Bad Request - HTML page with an error message (e.g., invalid code, username missing).",content:{"text/html":{schema:s.z.string()}}},500:{description:"Internal Server Error - HTML error page for unexpected issues.",content:{"text/html":{schema:s.z.string()}}}}}),async t=>{var l;const{state:e}=t.req.valid("query"),{code:n}=t.req.valid("form"),{theme:r,branding:i,client:o,loginSession:a}=await Ue(t,e);if(!a.authParams.username)throw new C(400,{message:B.t("username_not_found_error")||"Username not found in session."});try{t.set("client_id",o.id);const u=await Ef(t,{client_id:o.id,authParams:a.authParams,username:a.authParams.username,otp:n});if(u instanceof Response)return u;throw new C(500,{message:B.t("unexpected_error_try_again")||"An unexpected error occurred. Please try again."})}catch(u){let d;try{d=await Oo({userAdapter:t.env.data.users,tenant_id:o.tenant.id,username:a.authParams.username,provider:"auth2"})}catch{d=null}return t.html(y(ip,{theme:r,branding:i,email:(l=a.authParams)==null?void 0:l.username,state:e,client:o,error:u.message,hasPasswordLogin:!!d}),400)}}),ky=t=>{const{theme:e,branding:n,client:r,state:i}=t;return y(nt,{title:B.t("unverified_email"),theme:e,branding:n,client:r,children:[y("div",{className:"flex flex-1 flex-col justify-center",children:[y("p",{className:"mb-8 text-gray-300 text-lg",children:B.t("unverified_email")}),y("div",{className:"my-4 flex space-x-2 text-sm text-[#B2B2B2]",children:[y(et,{className:"text-base",name:"info-bubble"}),y("div",{className:"text-sm text-gray-300 md:text-sm",children:B.t("sent_code_spam")})]}),y(gn,{state:i})]}),y(gn,{state:i})]})},x8=({width:t=22,height:e=17})=>y("svg",{width:t,height:e,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 576 512",children:y("path",{fill:"currentColor",d:"M288 32c-80.8 0-145.5 36.8-192.6 80.6C48.6 156 17.3 208 2.5 243.7c-3.3 7.9-3.3 16.7 0 24.6C17.3 304 48.6 356 95.4 399.4 142.5 443.2 207.2 480 288 480s145.5-36.8 192.6-80.6c46.8-43.5 78.1-95.4 93-131.1 3.3-7.9 3.3-16.7 0-24.6-14.9-35.7-46.2-87.7-93-131.1C433.5 68.8 368.8 32 288 32M144 256a144 144 0 1 1 288 0 144 144 0 1 1-288 0m144-64c0 35.3-28.7 64-64 64-7.1 0-13.9-1.2-20.3-3.3-5.5-1.8-11.9 1.6-11.7 7.4.3 6.9 1.3 13.8 3.2 20.7 13.7 51.2 66.4 81.6 117.6 67.9s81.6-66.4 67.9-117.6c-11.1-41.5-47.8-69.4-88.6-71.1-5.8-.2-9.2 6.1-7.4 11.7 2.1 6.4 3.3 13.2 3.3 20.3"})}),A8=({width:t=23,height:e=18})=>y("svg",{width:t,height:e,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 640 512",children:y("path",{fill:"currentColor",d:"M38.8 5.1C28.4-3.1 13.3-1.2 5.1 9.2s-6.3 25.5 4.1 33.7l592 464c10.4 8.2 25.5 6.3 33.7-4.1s6.3-25.5-4.1-33.7l-105.2-82.4c39.6-40.6 66.4-86.1 79.9-118.4 3.3-7.9 3.3-16.7 0-24.6-14.9-35.7-46.2-87.7-93-131.1C465.5 68.8 400.8 32 320 32c-68.2 0-125 26.3-169.3 60.8zm184.3 144.4c25.5-23.3 59.6-37.5 96.9-37.5 79.5 0 144 64.5 144 144 0 24.9-6.3 48.3-17.4 68.7L408 294.5c8.4-19.3 10.6-41.4 4.8-63.3-11.1-41.5-47.8-69.4-88.6-71.1-5.8-.2-9.2 6.1-7.4 11.7 2.1 6.4 3.3 13.2 3.3 20.3 0 10.2-2.4 19.8-6.6 28.3l-90.3-70.8zM373 389.9c-16.4 6.5-34.3 10.1-53 10.1-79.5 0-144-64.5-144-144 0-6.9.5-13.6 1.4-20.2l-94.3-74.3c-22.8 29.7-39.1 59.3-48.6 82.2-3.3 7.9-3.3 16.7 0 24.6 14.9 35.7 46.2 87.7 93 131.1 47 43.8 111.7 80.6 192.5 80.6 47.8 0 89.9-12.9 126.2-32.5z"})}),op=({name:t,placeholder:e=B.t("password")})=>y("div",{className:"password-input relative mb-2",children:[y("input",{type:"password",name:t,placeholder:e,className:"w-full rounded-lg bg-gray-100 px-4 py-5 text-base placeholder:text-gray-300 dark:bg-gray-600 md:text-base",required:!0}),y("button",{type:"button","aria-label":B.t("show_password"),title:B.t("show_password"),className:"show-password-toggle-show absolute right-0 top-0 w-10 h-full rounded-r-lg text-gray-400 column hover:bg-black/5",children:y(x8,{})}),y("button",{type:"button","aria-label":B.t("hide_password"),title:B.t("hide_password"),className:"show-password-toggle-hide !hidden absolute right-0 top-0 w-10 h-full rounded-r-lg text-gray-400 column hover:bg-black/5",children:y(A8,{})})]});var Jg=Object.freeze,E8=Object.defineProperty,S8=(t,e)=>Jg(E8(t,"raw",{value:Jg(t.slice())})),Yg;const ha=t=>{const{error:e,theme:n,branding:r,email:i,state:o,client:a}=t,l=new URLSearchParams({state:o});return y(nt,{title:B.t("enter_password"),theme:n,branding:r,client:a,children:[y("div",{className:"mb-4 text-lg font-medium sm:text-2xl",children:B.t("enter_password")}),y("div",{className:"mb-6 text-gray-300",children:B.t("enter_password_description")}),y("div",{className:"flex flex-1 flex-col justify-center",children:[y(Rn,{className:"mb-7",children:[y("input",{type:"text",name:"username",placeholder:B.t("email_placeholder"),className:"mb-2 w-full rounded-lg bg-gray-100 px-4 py-5 text-base placeholder:text-gray-300 dark:bg-gray-600 md:text-base",value:i}),y(op,{name:"password"}),e&&y(rr,{children:e}),y(tt,{className:"sm:mt-4 !text-base",children:[y("span",{children:B.t("login")}),y(et,{className:"text-xs",name:"arrow-right"})]})]}),y("a",{href:`/u/forgot-password?${l.toString()}`,className:"text-primary hover:underline mb-4",children:B.t("forgot_password_link")}),y("div",{className:"text-center mb-12",children:[y("div",{className:"relative mb-5 block text-center text-gray-300 dark:text-gray-300",children:[y("div",{className:"absolute left-0 right-0 top-1/2 border-b border-gray-200 dark:border-gray-600"}),y("div",{className:"relative inline-block bg-white px-2 dark:bg-gray-800",children:B.t("or")})]}),y("form",{method:"post",action:`/u/login/identifier?${l.toString()}`,children:[y("input",{type:"hidden",name:"login_selection",value:"code"}),y("input",{type:"hidden",name:"username",value:i}),y(tt,{variant:"secondary",className:"block",children:B.t("enter_a_code_btn")})]})]}),y(gn,{state:o})]}),iy(Yg||(Yg=S8([`
231
231
  <script>
232
232
  // Show password toggle
233
233
  var passwordInputs = document.querySelectorAll(".password-input");
@@ -251,10 +251,10 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
251
251
  });
252
252
  });
253
253
  <\/script>
254
- `])))]})},k8=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})})},responses:{200:{description:"Response"}}}),async t=>{const{state:e}=t.req.valid("query"),{theme:n,branding:r,client:i,loginSession:o}=await Ue(t,e);if(!o.authParams.username)throw new C(400,{message:"Username required"});return t.html(y(ha,{theme:n,branding:r,email:o.authParams.username,state:e,client:i}))}).openapi(s.createRoute({tags:["login"],method:"post",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})}),body:{content:{"application/x-www-form-urlencoded":{schema:s.z.object({password:s.z.string()})}}}},responses:{200:{description:"HTML page indicating success or a next step (if not redirecting).",content:{"text/html":{schema:s.z.string()}}},302:{description:"Redirect to continue the authentication flow (e.g., to client, MFA, consent).",headers:s.z.object({Location:s.z.string().url()})},400:{description:"Bad Request - HTML page with an error message (e.g., invalid password, username required).",content:{"text/html":{schema:s.z.string()}}},500:{description:"Internal Server Error - HTML page with an error message.",content:{"text/html":{schema:s.z.string()}}}}}),async t=>{const{state:e}=t.req.valid("query"),n=t.req.valid("form"),{password:r}=n,{theme:i,branding:o,client:a,loginSession:l}=await Ue(t,e),{username:u}=l.authParams;if(!u)throw new C(400,{message:"Username required"});try{return await ny(t,a,{...l.authParams,password:r},l)}catch(d){const p=d;return p.code==="INVALID_PASSWORD"||p.code==="USER_NOT_FOUND"?t.html(y(ha,{theme:i,branding:o,email:u,error:B.t("invalid_password"),state:e,client:a}),400):p.code==="EMAIL_NOT_VERIFIED"?t.html(y(ky,{theme:i,branding:o,client:a,state:e}),400):t.html(y(ha,{theme:i,branding:o,email:u,error:p.message||"An unknown error occurred.",state:e,client:a}),p.code?400:500)}}),Or=t=>{const{error:e,theme:n,branding:r,client:i,email:o,state:a,code:l}=t;return y(rt,{title:B.t("sign_up"),theme:n,branding:r,client:i,children:[y("div",{className:"mb-4 text-lg font-medium sm:text-2xl",children:B.t("create_account_title")}),y("div",{className:"mb-6 text-gray-300",children:B.t("create_account_description")}),y("div",{className:"flex flex-1 flex-col justify-center",children:[y(Rn,{children:[y("input",{type:"hidden",name:"code",value:l}),y("input",{type:"email",name:"username",placeholder:B.t("email_placeholder"),className:"mb-2 w-full rounded-lg bg-gray-100 px-4 py-5 text-base placeholder:text-gray-300 dark:bg-gray-600 md:text-base",required:!0,value:o,disabled:!!o}),y("input",{type:"password",name:"password",placeholder:B.t("enter_new_password_placeholder"),className:"mb-2 w-full rounded-lg bg-gray-100 px-4 py-5 text-base placeholder:text-gray-300 dark:bg-gray-600 md:text-base"}),y("input",{type:"password",name:"re-enter-password",placeholder:B.t("reenter_new_password_placeholder"),className:"mb-2 w-full rounded-lg bg-gray-100 px-4 py-5 text-base placeholder:text-gray-300 dark:bg-gray-600 md:text-base"}),e&&y(rr,{children:e}),y(nt,{className:"sm:mt-4 !text-base",children:B.t("continue")})]}),y(gn,{state:a})]})]})},N8=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"}),code:s.z.string().optional().openapi({description:"The code parameter from an email verification link"})})},responses:{200:{description:"Response"}}}),async t=>{const{state:e,code:n}=t.req.valid("query"),{theme:r,branding:i,client:o,loginSession:a}=await Ue(t,e),{username:l}=a.authParams;if(!l)throw new C(400,{message:"Username required"});return n?t.html(y(Or,{state:e,theme:r,branding:i,client:o,email:l,code:n})):t.html(y(Or,{state:e,theme:r,branding:i,client:o,email:l}))}).openapi(s.createRoute({tags:["login"],method:"post",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})}),body:{content:{"application/x-www-form-urlencoded":{schema:s.z.object({password:s.z.string(),"re-enter-password":s.z.string(),code:s.z.string().optional()})}}}},responses:{200:{description:"HTML page indicating success (e.g., email verification sent) or a next step.",content:{"text/html":{schema:s.z.string()}}},302:{description:"Redirect to continue the authentication flow (e.g., to client, MFA, consent) after successful login.",headers:s.z.object({Location:s.z.string().url()})},400:{description:"Bad Request - HTML page with an error message (e.g., passwords don't match, weak password, user exists).",content:{"text/html":{schema:s.z.string()}}},500:{description:"Internal Server Error - HTML page with an error message.",content:{"text/html":{schema:s.z.string()}}}}}),async t=>{const{state:e}=t.req.valid("query"),n=t.req.valid("form"),{env:r}=t,{theme:i,branding:o,client:a,loginSession:l}=await Ue(t,e);try{if(!l.authParams.username)throw new C(400,{message:"Username required"});const u="Username-Password-Authentication";if(t.set("connection",u),n.password!==n["re-enter-password"])return t.html(y(Or,{state:e,code:n.code,theme:i,branding:o,client:a,error:B.t("create_account_passwords_didnt_match"),email:l.authParams.username}),400);if(!Nf(n.password))return t.html(y(Or,{state:e,code:n.code,theme:i,branding:o,client:a,error:B.t("create_account_weak_password"),email:l.authParams.username}),400);const d=n.code?await r.data.codes.get(a.tenant.id,n.code,"email_verification"):void 0,p=d?await r.data.loginSessions.get(a.tenant.id,d.login_id):void 0;if(await Xi({userAdapter:t.env.data.users,tenant_id:a.tenant.id,username:l.authParams.username,provider:"auth2"}))return t.html(y(Or,{state:e,code:n.code,theme:i,branding:o,client:a,error:B.t("user_exists_error"),email:l.authParams.username}),400);const g=(p==null?void 0:p.authParams.username)===l.authParams.username,A=`auth2|${Sc()}`,$=await r.data.users.create(a.tenant.id,{user_id:A,email:l.authParams.username,email_verified:g,provider:"auth2",connection:u,is_social:!1});if(await r.data.passwords.create(a.tenant.id,{user_id:A,password:await ts.hash(n.password,10),algorithm:"bcrypt"}),!g)return await If(t,$),t.html(y(Ft,{message:B.t("validate_email_body"),pageTitle:B.t("validate_email_title"),theme:i,branding:o,client:a,state:e}));const N=await ty(t,a,{...l.authParams,password:n.password},l);return Sr(t,N)}catch(u){let d=B.t("unknown_error_message"),p=400;return u instanceof C?(d=u.message||d,p=u.status===400?400:500):u instanceof yi?d=u.message||d:u instanceof Error&&(d=u.message||d,p=500),t.html(y(Or,{state:e,theme:i,branding:o,client:a,error:d,email:l.authParams.username,code:n.code}),p)}}),wi=t=>{const{error:e,theme:n,branding:r,client:i,email:o}=t;return y(rt,{title:B.t("reset_password_title"),theme:n,branding:r,client:i,children:[y("div",{className:"mb-4 text-lg font-medium sm:text-2xl",children:B.t("reset_password_title")}),y("div",{className:"mb-6 text-gray-300",children:`${B.t("reset_password_description")} ${o}`}),y("div",{className:"flex flex-1 flex-col justify-center",children:y(Rn,{children:[y(op,{name:"password",placeholder:B.t("enter_new_password_placeholder")}),y(op,{name:"re-enter-password",placeholder:B.t("reenter_new_password_placeholder")}),e&&y(rr,{children:e}),y(nt,{className:"sm:mt-4 !text-base",children:B.t("reset_password_cta")})]})})]})},C8=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"}),code:s.z.string().openapi({description:"The code parameter from the authorization request"})})},responses:{200:{description:"Response"}}}),async t=>{const{state:e}=t.req.valid("query"),{theme:n,branding:r,client:i,loginSession:o}=await Ue(t,e);if(!o.authParams.username)throw new C(400,{message:"Username required"});return t.html(y(wi,{theme:n,branding:r,client:i,email:o.authParams.username}))}).openapi(s.createRoute({tags:["login"],method:"post",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"}),code:s.z.string().openapi({description:"The code parameter from the authorization request"})}),body:{content:{"application/x-www-form-urlencoded":{schema:s.z.object({password:s.z.string(),"re-enter-password":s.z.string()})}}}},responses:{200:{description:"Response"}}}),async t=>{const{state:e,code:n}=t.req.valid("query"),{password:r,"re-enter-password":i}=t.req.valid("form"),{env:o}=t,{theme:a,branding:l,client:u,loginSession:d}=await Ue(t,e);if(!d.authParams.username)throw new C(400,{message:"Username required"});if(r!==i)return t.html(y(wi,{error:B.t("create_account_passwords_didnt_match"),theme:a,branding:l,client:u,email:d.authParams.username}),400);if(!Nf(r))return t.html(y(wi,{error:B.t("create_account_weak_password"),theme:a,branding:l,client:u,email:d.authParams.username}),400);const p=await Xi({userAdapter:o.data.users,tenant_id:u.tenant.id,username:d.authParams.username,provider:"auth2"});if(!p)throw new C(400,{message:"User not found"});try{if(!await o.data.codes.get(u.tenant.id,n,"password_reset"))return t.html(y(wi,{error:"Code not found or expired",theme:a,branding:l,client:u,email:d.authParams.username}),400);const g={user_id:p.user_id,password:await ts.hash(r,10),algorithm:"bcrypt"};await o.data.passwords.get(u.tenant.id,p.user_id)?await o.data.passwords.update(u.tenant.id,g):await o.data.passwords.create(u.tenant.id,g),p.email_verified||await o.data.users.update(u.tenant.id,p.user_id,{email_verified:!0})}catch{return t.html(y(wi,{error:"The password could not be reset",theme:a,branding:l,client:u,email:d.authParams.username}),400)}return t.html(y(Ft,{message:B.t("password_has_been_reset"),theme:a,branding:l,client:u,state:e}))}),Ny=t=>{const{error:e,theme:n,branding:r,client:i,email:o,state:a}=t;return y(rt,{title:B.t("forgot_password_title"),theme:n,branding:r,client:i,children:[y("div",{className:"mb-4 text-lg font-medium sm:text-2xl",children:B.t("forgot_password_title")}),y("div",{className:"mb-6 text-gray-300",children:B.t("forgot_password_description")}),y("div",{className:"flex flex-1 flex-col justify-center",children:[y(Rn,{className:"pt-2",children:[y("input",{type:"email",name:"username",placeholder:B.t("email_placeholder"),className:"mb-2 w-full rounded-lg bg-gray-100 px-4 py-5 text-base placeholder:text-gray-300 dark:bg-gray-600 md:text-base",value:o,disabled:!!o}),e&&y(rr,{children:e}),y(nt,{className:"sm:mt-4 !text-base",children:B.t("forgot_password_cta")})]}),y(gn,{state:a})]})]})},Cy=t=>{const{theme:e,branding:n,client:r,state:i}=t;return y(rt,{title:"Login",theme:e,branding:n,client:r,children:[y("div",{className:"flex flex-1 flex-col justify-center",children:[y("div",{children:B.t("forgot_password_email_sent")}),y("div",{className:"my-4 flex space-x-2 text-sm text-[#B2B2B2]",children:[y(tt,{className:"text-base",name:"info-bubble"}),y("div",{className:"text-sm text-gray-300 md:text-sm",children:B.t("sent_code_spam")})]})]}),y(gn,{state:i})]})},T8=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})})},responses:{200:{description:"Response"}}}),async t=>{const{state:e}=t.req.valid("query"),{theme:n,branding:r,client:i,loginSession:o}=await Ue(t,e);return t.html(y(Ny,{theme:n,branding:r,client:i,state:e,email:o.authParams.username}))}).openapi(s.createRoute({tags:["login"],method:"post",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})})},responses:{200:{description:"Response"}}}),async t=>{const{state:e}=t.req.valid("query"),{theme:n,branding:r,client:i,loginSession:o}=await Ue(t,e);return await yE(t,i,o.authParams.username,o.id),t.html(y(Cy,{theme:n,branding:r,client:i,state:e}))}),Ty=({theme:t,branding:e,client:n,state:r,user:i})=>y(rt,{title:xe("check_email_title"),theme:t,branding:e,client:n,children:y("div",{className:"flex flex-1 flex-col justify-center",children:[y("div",{className:"mb-8 text-gray-700 dark:text-gray-300",children:[y(Vi,{i18nKey:"currently_logged_in_as",components:[y("span",{className:"font-semibold text-gray-900 dark:text-white"},"span")],values:{email:i.email||""}}),y("br",{}),xe("continue_with_sso_provider_headline")]}),y("div",{className:"space-y-6",children:[y(Rn,{children:y(nt,{className:"!text-base",children:y("span",{children:B.t("yes_continue_with_existing_account")})})}),y("a",{className:"block text-center text-primary hover:text-primaryHover focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2 dark:focus:ring-offset-gray-900",href:`/u/login/identifier?state=${encodeURIComponent(r)}`,children:B.t("no_use_another")})]})]})}),I8=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})})},responses:{200:{description:"HTML page to check account status or verify email.",content:{"text/html":{schema:s.z.string()}}},302:{description:"Redirect to login identifier page if no valid session.",headers:s.z.object({Location:s.z.string().url()})},400:{description:"Bad Request - HTML error page if state is missing or other input error.",content:{"text/html":{schema:s.z.string()}}},500:{description:"Internal Server Error - HTML error page.",content:{"text/html":{schema:s.z.string()}}}}}),async t=>{var d;const{env:e}=t,{state:n}=t.req.valid("query"),{theme:r,branding:i,client:o}=await Ue(t,n);if(!o||!((d=o.tenant)!=null&&d.id))return console.error("Client or tenant ID missing in GET /u/check-account after initJSXRoute"),t.html(y(Ft,{theme:r,branding:i,client:o,state:n,pageTitle:B.t("error_page_title")||"Error",message:B.t("configuration_error_message")||"A configuration error occurred."}),500);const a=Tn(o.tenant.id,t.req.header("cookie")),l=a?await e.data.sessions.get(o.tenant.id,a):null;if(!l)return t.redirect(`/u/login/identifier?state=${n}`);const u=await e.data.users.get(o.tenant.id,l.user_id);return u?t.html(y(Ty,{theme:r,branding:i,client:o,state:n,user:u})):t.redirect(`/u/login/identifier?state=${n}`)}).openapi(s.createRoute({tags:["login"],method:"post",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})})},responses:{302:{description:"Redirect to continue authentication flow or to login identifier.",headers:s.z.object({Location:s.z.string().url()})},400:{description:"Bad Request - HTML error page if state is missing or other input error.",content:{"text/html":{schema:s.z.string()}}},500:{description:"Internal Server Error - HTML error page for unexpected issues or if TokenResponse is returned.",content:{"text/html":{schema:s.z.string()}}}}}),async t=>{var h;const{env:e}=t,{state:n}=t.req.valid("query"),{theme:r,branding:i,client:o,loginSession:a}=await Ue(t,n);if(!o||!((h=o.tenant)!=null&&h.id))return console.error("Client or tenant ID missing in POST /u/check-account after initJSXRoute"),t.html(y(Ft,{theme:r,branding:i,client:o,state:n,pageTitle:B.t("error_page_title")||"Error",message:B.t("configuration_error_message")}),500);const l=Tn(o.tenant.id,t.req.header("cookie")),u=l?await e.data.sessions.get(o.tenant.id,l):null;if(!u)return t.redirect(`/u/login/identifier?state=${n}`);const d=await e.data.users.get(o.tenant.id,u.user_id);if(!d)return t.redirect(`/u/login/identifier?state=${n}`);const p=await Sr(t,{user:d,authParams:a.authParams,client:o,loginSession:a});if(!(p instanceof Response))throw new C(500,{message:B.t("unexpected_error_try_again")});return p}),O8=!1,Zg=t=>{var l;const{theme:e,branding:n,user:r,client:i,error:o,success:a}=t;return(l=r.identities)!=null&&l.filter(u=>!(u.provider===r.provider&&u.user_id===r.user_id.split("|")[1])),y(rt,{title:B.t("account_title")||"Account Settings",theme:e,branding:n,client:i,children:y("div",{className:"flex flex-1 flex-col justify-center",children:y("div",{className:"mx-auto w-full max-w-sm",children:[y("div",{className:"text-center",children:y("h1",{className:"mb-6 text-2xl font-semibold text-gray-900",children:B.t("account_title")||"Account Settings"})}),o&&y(rr,{children:o}),a&&y("div",{className:"mb-4 rounded-md bg-green-50 p-4",children:y("div",{className:"text-sm text-green-700",children:a})}),y("div",{className:"mb-6",children:[y("h2",{className:"mb-3 text-lg font-medium text-gray-900",children:B.t("email")}),y("div",{className:"rounded-lg border border-gray-200 p-4",children:y("div",{className:"flex items-center justify-between",children:y("div",{children:[y("p",{className:"text-sm font-medium text-gray-900",children:r.email||"No email set"}),y("p",{className:"text-xs text-gray-500",children:r.email_verified?B.t("verified")||"Verified":B.t("unverified")||"Unverified"})]})})})]}),y("div",{className:"mb-6",children:[y("h2",{className:"mb-3 text-lg font-medium text-gray-900",children:B.t("update_email")}),y("form",{method:"post",children:[y("input",{type:"hidden",name:"action",value:"update_email"}),y("div",{className:"mb-4",children:y("input",{type:"email",id:"email",name:"email",required:!0,className:"w-full rounded-md border border-gray-300 px-3 py-2 text-sm placeholder-gray-400 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500",placeholder:B.t("enter_new_email")})}),y(nt,{variant:"primary",className:"w-full",children:B.t("update_email")})]})]}),O8]})})})},z8=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})})},responses:{200:{description:"HTML page showing account management interface.",content:{"text/html":{schema:s.z.string()}}},302:{description:"Redirect to login if no session",headers:s.z.object({Location:s.z.string().url()})},400:{description:"Bad Request - HTML error page if state is missing or other input error.",content:{"text/html":{schema:s.z.string()}}},500:{description:"Internal Server Error - HTML error page.",content:{"text/html":{schema:s.z.string()}}}}}),async t=>{var d;const{env:e}=t,{state:n}=t.req.valid("query"),{theme:r,branding:i,client:o}=await Ue(t,n,!0);if(!o||!((d=o.tenant)!=null&&d.id))return console.error("Client or tenant ID missing in GET /u/account after initJSXRoute"),t.html(y(Ft,{theme:r,branding:i,client:o,state:n,pageTitle:B.t("error_page_title")||"Error",message:B.t("configuration_error_message")||"A configuration error occurred."}),500);const a=Tn(o.tenant.id,t.req.header("cookie")),l=a?await e.data.sessions.get(o.tenant.id,a):null;if(!l)return t.redirect(`/u/login/identifier?state=${encodeURIComponent(n)}`);const u=await e.data.users.get(o.tenant.id,l.user_id);return u?t.html(y(Zg,{theme:r,branding:i,user:u,client:o})):t.redirect(`/u/login/identifier?state=${encodeURIComponent(n)}`)}).openapi(s.createRoute({tags:["login"],method:"post",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})}),body:{content:{"application/x-www-form-urlencoded":{schema:s.z.object({email:s.z.string().toLowerCase().optional(),action:s.z.enum(["update_email","unlink_account"]),provider:s.z.string().optional(),user_id:s.z.string().optional()})}}}},responses:{200:{description:"HTML response with form results",content:{"text/html":{schema:s.z.string()}}},302:{description:"Redirect to change-email page or login if no session",headers:s.z.object({Location:s.z.string().url()})},400:{description:"Bad Request - HTML error page if state is missing or other input error.",content:{"text/html":{schema:s.z.string()}}},500:{description:"Internal Server Error - HTML error page.",content:{"text/html":{schema:s.z.string()}}}}}),async t=>{var A;const{env:e}=t,{state:n}=t.req.valid("query"),r=t.req.valid("form"),{theme:i,branding:o,client:a}=await Ue(t,n,!0);if(!a||!((A=a.tenant)!=null&&A.id))return console.error("Client or tenant ID missing in POST /u/account after initJSXRoute"),t.html(y(Ft,{theme:i,branding:o,client:a,state:n,pageTitle:B.t("error_page_title")||"Error",message:B.t("configuration_error_message")||"A configuration error occurred."}),500);const l=Tn(a.tenant.id,t.req.header("cookie")),u=l?await e.data.sessions.get(a.tenant.id,l):null;if(!u)return t.redirect(`/u/login/identifier?state=${encodeURIComponent(n)}`);const d=await e.data.users.get(a.tenant.id,u.user_id);if(!d)return t.redirect(`/u/login/identifier?state=${encodeURIComponent(n)}`);let p,h;try{if(r.action==="update_email"&&r.email){const $=Ve();await e.data.codes.create(a.tenant.id,{code_id:$,login_id:"",code_type:"email_verification",expires_at:new Date(Date.now()+xu).toISOString(),user_id:d.user_id});const N=$r();return await e.data.codes.create(a.tenant.id,{code_id:N,login_id:"",code_type:"email_verification",expires_at:new Date(Date.now()+xu).toISOString(),user_id:d.user_id}),await Cf(t,{to:r.email.toLowerCase(),code:N}),t.redirect(`/u/change-email?state=${encodeURIComponent(n)}&email=${encodeURIComponent(r.email.toLowerCase())}&change_id=${$}`)}else r.action==="unlink_account"&&r.provider&&r.user_id&&(await e.data.users.unlink(a.tenant.id,d.user_id,r.provider,r.user_id),h=B.t("account_unlinked_successfully")||"Account unlinked successfully")}catch{p=B.t("operation_failed")||"Operation failed"}const g=await e.data.users.get(a.tenant.id,d.user_id);return t.html(y(Zg,{theme:i,branding:o,user:g||d,client:a,error:p,success:h}))}),Qg=6,sp=({error:t,theme:e,branding:n,client:r,email:i,success:o,state:a})=>o?y(rt,{title:B.t("success"),theme:e,branding:n,client:r,children:[y("div",{className:"mb-4 text-2xl font-medium",children:B.t("success")}),y("div",{className:"mb-8 text-gray-300",children:y(Vi,{i18nKey:"email_changed_to_template",components:[y("span",{className:"text-black dark:text-white"},"span")],values:{email:i}})}),y("div",{className:"flex flex-1 flex-col justify-center",children:y(nt,{Component:"a",href:a?`/u/account?state=${encodeURIComponent(a)}`:`/u/account?client_id=${encodeURIComponent(r.id)}`,className:"sm:mt-4 !text-base",children:[y("span",{children:B.t("continue")}),y(tt,{className:"text-xs",name:"arrow-right"})]})})]}):y(rt,{title:B.t("verify_email_verify"),theme:e,branding:n,client:r,children:[y("div",{className:"mb-4 text-2xl font-medium",children:B.t("verify_email_verify")}),y("div",{className:"mb-8 text-gray-300",children:y(Vi,{i18nKey:"code_sent_template",components:[y("span",{className:"text-black dark:text-white"},"span")],values:{username:i}})}),y("div",{className:"flex flex-1 flex-col justify-center",children:[y(Rn,{className:"pt-2",children:[y("input",{autoFocus:!0,type:"text",pattern:"[0-9]*",maxLength:Qg,inputMode:"numeric",name:"code",placeholder:"******",className:Jn("mb-2 w-full rounded-lg border bg-gray-100 px-4 pb-2 pt-2.5 text-center indent-[5px] font-mono text-3xl placeholder:text-gray-300 dark:bg-gray-600 md:text-3xl",{"border-red":t,"border-gray-100 dark:border-gray-500":!t}),minLength:Qg,required:!0,id:"code-input"}),t&&y(rr,{children:t}),y(nt,{className:"sm:mt-4 !text-base",children:[y("span",{children:B.t("continue")}),y(tt,{className:"text-xs",name:"arrow-right"})]}),y("div",{className:"my-4 flex space-x-2 text-sm text-[#B2B2B2]",children:[y(tt,{className:"text-base",name:"info-bubble"}),y("div",{className:"text-sm text-gray-300 md:text-sm",children:B.t("sent_code_spam")})]})]}),y("a",{className:"block text-primary hover:text-primaryHover text-center",href:a?`/u/account?state=${encodeURIComponent(a)}`:`/u/account?client_id=${encodeURIComponent(r.id)}`,children:B.t("go_back")})]})]}),D8=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"}),email:s.z.string().email(),change_id:s.z.string()})},responses:{200:{description:"HTML page for email change verification",content:{"text/html":{schema:s.z.string()}}},302:{description:"Redirect to account or login if no session",headers:s.z.object({Location:s.z.string().url()})},400:{description:"Bad Request - HTML error page if state is missing or other input error.",content:{"text/html":{schema:s.z.string()}}},500:{description:"Internal Server Error - HTML error page.",content:{"text/html":{schema:s.z.string()}}}}}),async t=>{var g;const{env:e}=t,{state:n,email:r,change_id:i}=t.req.valid("query"),{theme:o,branding:a,client:l}=await Ue(t,n,!0);if(!l||!((g=l.tenant)!=null&&g.id))return console.error("Client or tenant ID missing in GET /u/change-email after initJSXRoute"),t.html(y(Ft,{theme:o,branding:a,client:l,state:n,pageTitle:B.t("error_page_title")||"Error",message:B.t("configuration_error_message")||"A configuration error occurred."}),500);const u=Tn(l.tenant.id,t.req.header("cookie")),d=u?await e.data.sessions.get(l.tenant.id,u):null;if(!d)return t.redirect(`${Ke(t.env)}login/identifier?state=${encodeURIComponent(n)}`);const p=await e.data.users.get(l.tenant.id,d.user_id);if(!p)return t.redirect(`${Ke(t.env)}login/identifier?state=${encodeURIComponent(n)}`);const h=await t.env.data.codes.get(l.tenant.id,i,"email_verification");return!h||h.user_id!==p.user_id?t.redirect(`${Ke(t.env)}u/account?state=${encodeURIComponent(n)}`):t.html(y(sp,{theme:o,branding:a,client:l,email:r,state:n}))}).openapi(s.createRoute({tags:["login"],method:"post",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"}),email:s.z.string().toLowerCase(),change_id:s.z.string()}),body:{content:{"application/x-www-form-urlencoded":{schema:s.z.object({code:s.z.string()})}}}},responses:{200:{description:"HTML response with verification result",content:{"text/html":{schema:s.z.string()}}},302:{description:"Redirect to confirmation page on success",headers:s.z.object({Location:s.z.string().url()})},400:{description:"Bad Request - HTML error page if state is missing or other input error.",content:{"text/html":{schema:s.z.string()}}},500:{description:"Internal Server Error - HTML error page.",content:{"text/html":{schema:s.z.string()}}}}}),async t=>{var A;const{env:e}=t,{state:n,email:r,change_id:i}=t.req.valid("query"),{code:o}=t.req.valid("form"),{theme:a,branding:l,client:u}=await Ue(t,n,!0);if(!u||!((A=u.tenant)!=null&&A.id))return console.error("Client or tenant ID missing in POST /u/change-email after initJSXRoute"),t.html(y(Ft,{theme:a,branding:l,client:u,state:n,pageTitle:B.t("error_page_title")||"Error",message:B.t("configuration_error_message")||"A configuration error occurred."}),500);const d=Tn(u.tenant.id,t.req.header("cookie")),p=d?await e.data.sessions.get(u.tenant.id,d):null;if(!p||p.revoked_at)return t.redirect(`${Ke(t.env)}u/login/identifier?state=${encodeURIComponent(n)}`);const h=await e.data.users.get(u.tenant.id,p.user_id);if(!h)return t.redirect(`${Ke(t.env)}u/login/identifier?state=${encodeURIComponent(n)}`);let g;try{const $=await e.data.codes.get(u.tenant.id,i,"email_verification");if(!$)g=B.t("invalid_request");else if($.user_id!==h.user_id)g=B.t("invalid_request");else if($.used_at)g=B.t("code_already_used");else if(new Date($.expires_at)<new Date)g=B.t("code_expired");else{const N=await e.data.codes.get(u.tenant.id,o,"email_verification");if(!N)g=B.t("invalid_code");else if(N.used_at)g=B.t("code_already_used");else if(new Date(N.expires_at)<new Date)g=B.t("code_expired");else if(N.user_id!==h.user_id)g=B.t("invalid_code");else return await e.data.codes.used(u.tenant.id,i),await e.data.codes.used(u.tenant.id,o),await e.data.users.update(u.tenant.id,h.user_id,{email:r,email_verified:!0}),t.redirect(`${Ke(t.env)}u/change-email-confirmation?state=${encodeURIComponent(n)}&email=${encodeURIComponent(r)}`)}}catch{g=B.t("operation_failed")}return t.html(y(sp,{theme:a,branding:l,client:u,email:r,error:g,state:n}))}),R8=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"}),email:s.z.string().email()})},responses:{200:{description:"HTML page showing email change confirmation",content:{"text/html":{schema:s.z.string()}}},302:{description:"Redirect to login if no session",headers:s.z.object({Location:s.z.string().url()})},400:{description:"Bad Request - HTML error page if state is missing or other input error.",content:{"text/html":{schema:s.z.string()}}},500:{description:"Internal Server Error - HTML error page.",content:{"text/html":{schema:s.z.string()}}}}}),async t=>{var d;const{env:e}=t,{state:n,email:r}=t.req.valid("query"),{theme:i,branding:o,client:a}=await Ue(t,n,!0);if(!a||!((d=a.tenant)!=null&&d.id))return console.error("Client or tenant ID missing in GET /u/change-email-confirmation after initJSXRoute"),t.html(y(Ft,{theme:i,branding:o,client:a,state:n,pageTitle:B.t("error_page_title")||"Error",message:B.t("configuration_error_message")||"A configuration error occurred."}),500);const l=Tn(a.tenant.id,t.req.header("cookie")),u=l?await e.data.sessions.get(a.tenant.id,l):null;return!u||u.revoked_at?t.redirect(`/u/login/identifier?state=${encodeURIComponent(n)}`):t.html(y(sp,{theme:i,branding:o,client:a,email:r,success:!0,state:n}))}),Iy=t=>{const{theme:e,branding:n,client:r,email:i,state:o}=t;return y(rt,{title:B.t("create_password_account_title"),theme:e,branding:n,client:r,children:[y("div",{className:"mb-4 text-lg font-medium sm:text-2xl",children:B.t("create_password_account_title")}),y("div",{className:"mb-6 text-gray-300",children:B.t("enter_email_for_verification_description")}),y("div",{className:"flex flex-1 flex-col justify-center",children:y(Rn,{className:"pt-2",children:[y("input",{type:"email",name:"username",placeholder:B.t("email_placeholder"),className:"mb-2 w-full rounded-lg bg-gray-100 px-4 py-5 text-base placeholder:text-gray-300 dark:bg-gray-600 md:text-base",required:!0,value:i,disabled:!0}),y(nt,{className:"sm:mt-4 !text-base",children:B.t("send")})]})}),y(gn,{state:o})]})},P8=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})})},responses:{200:{description:"Response"}}}),async t=>{const{state:e}=t.req.valid("query"),{theme:n,branding:r,client:i,loginSession:o}=await Ue(t,e),{username:a}=o.authParams;if(!a)throw new C(400,{message:"Username required"});return t.html(y(Iy,{state:e,theme:n,branding:r,client:i,email:a}))}).openapi(s.createRoute({tags:["login"],method:"post",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})})},responses:{200:{description:"Response"}}}),async t=>{const{state:e}=t.req.valid("query"),{loginSession:n,client:r}=await Ue(t,e),{username:i}=n.authParams;if(!i)throw new C(400,{message:"Username required"});const o=await t.env.data.codes.create(r.tenant.id,{code_id:$r(),code_type:"email_verification",login_id:n.id,expires_at:new Date(Date.now()+xu).toISOString()});return await gE(t,i,o.code_id,n.id),t.redirect(`/u/pre-signup-sent?state=${e}`)}),Oy=t=>{const{redirectUrl:e,theme:n,branding:r,client:i}=t;return y(rt,{title:B.t("invalid_session_title"),theme:n,branding:r,client:i,children:[y("div",{className:"flex flex-1 flex-col justify-center",children:B.t("invalid_session_body")}),y("div",{className:"flex flex-1 flex-col justify-center",children:e&&y("a",{className:"block text-primary hover:text-primaryHover text-center",href:e,children:B.t("go_back")})})]})},B8=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string()})},responses:{200:{description:"Response"}}}),async t=>{const{state:e}=t.req.valid("query"),{theme:n,branding:r,client:i,loginSession:o}=await Ue(t,e);let a;return o.authParams.redirect_uri&&o.authParams.state&&(a=new URL(o.authParams.redirect_uri),a.searchParams.set("state",o.authParams.state),a.searchParams.set("error","invalid_session"),a.searchParams.set("error_description",o.authParams.username||"")),t.html(y(Oy,{redirectUrl:a==null?void 0:a.href,theme:n,branding:r,client:i}))}),j8=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"}),code:s.z.string().openapi({description:"The code parameter from the authorization request"})})},responses:{200:{description:"Response"}}}),async t=>{const{state:e}=t.req.valid("query"),{theme:n,branding:r,client:i}=await Ue(t,e);return t.html(y(Ft,{message:"Not implemented",pageTitle:"User info",theme:n,branding:r,client:i,state:e}))}),zy=({theme:t,branding:e,client:n,state:r})=>{const i=new URLSearchParams({state:r});return y(rt,{title:B.t("email_validated"),theme:t,branding:e,client:n,children:[y("div",{className:"mb-4 text-lg font-medium sm:text-2xl",children:B.t("email_validated")}),y("div",{className:"flex flex-1 flex-col justify-center mb-7",children:y(nt,{Component:"a",href:`/u/enter-password?${i}`,className:"text-base sm:mt-4 md:text-base",children:y("div",{className:"flex items-center space-x-2",children:[y("span",{children:B.t("email_validated_cta")}),y(tt,{className:"text-xs",name:"arrow-right"})]})})})]})},L8=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"}),code:s.z.string().openapi({description:"The code parameter from the authorization request"})})},responses:{200:{description:"Response"}}}),async t=>{var A;const{state:e,code:n}=t.req.valid("query"),{env:r}=t,{client:i,loginSession:o,theme:a,branding:l}=await Ue(t,e),{username:u}=o.authParams;if(!u)throw new C(400,{message:"Username not found in state"});const d=await Xi({userAdapter:r.data.users,tenant_id:i.tenant.id,username:u,provider:"auth2"});if(!d)throw new C(500,{message:"No user found"});if(!await r.data.codes.get(i.tenant.id,n,"email_verification"))throw new C(400,{message:"Code not found or expired"});await r.data.users.update(i.tenant.id,d.user_id,{email_verified:!0});const g=(await Ap(r.data.users,i.tenant.id,u)).filter($=>$.provider!=="auth2");if(g.length>0){const $=g.filter(N=>!N.linked_to);$.length>1&&console.error("More than one primary user found for email",u),$.length===0&&console.error("No primary user found for email",u),$.length===1&&await r.data.users.update(i.tenant.id,d.user_id,{linked_to:(A=$[0])==null?void 0:A.user_id})}return t.html(y(zy,{theme:a,branding:l,client:i,state:e}))}),Dy=t=>{const{theme:e,branding:n,client:r,email:i,state:o}=t;return y(rt,{title:B.t("sign_up_success"),theme:e,branding:n,client:r,children:[y("div",{className:"mb-4 text-lg font-medium sm:text-2xl",children:B.t("email_verification_for_signup_sent_title")}),y("div",{className:"flex flex-1 flex-col justify-center",children:[y("div",{className:"mb-6 text-gray-300",children:y(Vi,{i18nKey:"email_verification_for_signup_sent_description",components:[y("span",{className:"text-black dark:text-white"},"span")],values:{email:i}})}),y("div",{className:"my-4 flex space-x-2 text-sm text-[#B2B2B2]",children:[y(tt,{className:"text-base",name:"info-bubble"}),y("div",{className:"text-sm text-gray-300 md:text-sm",children:B.t("sent_code_spam")})]})]}),y(gn,{state:o})]})},F8=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})})},responses:{200:{description:"Response"}}}),async t=>{const{state:e}=t.req.valid("query"),{theme:n,branding:r,client:i,loginSession:o}=await Ue(t,e),{username:a}=o.authParams;if(!a)throw new C(400,{message:"Username required"});return t.html(y(Dy,{theme:n,branding:r,client:i,state:e,email:a}))}),jf=`
254
+ `])))]})},k8=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})})},responses:{200:{description:"Response"}}}),async t=>{const{state:e}=t.req.valid("query"),{theme:n,branding:r,client:i,loginSession:o}=await Ue(t,e);if(!o.authParams.username)throw new C(400,{message:"Username required"});return t.html(y(ha,{theme:n,branding:r,email:o.authParams.username,state:e,client:i}))}).openapi(s.createRoute({tags:["login"],method:"post",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})}),body:{content:{"application/x-www-form-urlencoded":{schema:s.z.object({password:s.z.string()})}}}},responses:{200:{description:"HTML page indicating success or a next step (if not redirecting).",content:{"text/html":{schema:s.z.string()}}},302:{description:"Redirect to continue the authentication flow (e.g., to client, MFA, consent).",headers:s.z.object({Location:s.z.string().url()})},400:{description:"Bad Request - HTML page with an error message (e.g., invalid password, username required).",content:{"text/html":{schema:s.z.string()}}},500:{description:"Internal Server Error - HTML page with an error message.",content:{"text/html":{schema:s.z.string()}}}}}),async t=>{const{state:e}=t.req.valid("query"),n=t.req.valid("form"),{password:r}=n,{theme:i,branding:o,client:a,loginSession:l}=await Ue(t,e),{username:u}=l.authParams;if(!u)throw new C(400,{message:"Username required"});try{return await ny(t,a,{...l.authParams,password:r},l)}catch(d){const p=d;return p.code==="INVALID_PASSWORD"||p.code==="USER_NOT_FOUND"?t.html(y(ha,{theme:i,branding:o,email:u,error:B.t("invalid_password"),state:e,client:a}),400):p.code==="EMAIL_NOT_VERIFIED"?t.html(y(ky,{theme:i,branding:o,client:a,state:e}),400):t.html(y(ha,{theme:i,branding:o,email:u,error:p.message||"An unknown error occurred.",state:e,client:a}),p.code?400:500)}}),Or=t=>{const{error:e,theme:n,branding:r,client:i,email:o,state:a,code:l}=t;return y(nt,{title:B.t("sign_up"),theme:n,branding:r,client:i,children:[y("div",{className:"mb-4 text-lg font-medium sm:text-2xl",children:B.t("create_account_title")}),y("div",{className:"mb-6 text-gray-300",children:B.t("create_account_description")}),y("div",{className:"flex flex-1 flex-col justify-center",children:[y(Rn,{children:[y("input",{type:"hidden",name:"code",value:l}),y("input",{type:"email",name:"username",placeholder:B.t("email_placeholder"),className:"mb-2 w-full rounded-lg bg-gray-100 px-4 py-5 text-base placeholder:text-gray-300 dark:bg-gray-600 md:text-base",required:!0,value:o,disabled:!!o}),y("input",{type:"password",name:"password",placeholder:B.t("enter_new_password_placeholder"),className:"mb-2 w-full rounded-lg bg-gray-100 px-4 py-5 text-base placeholder:text-gray-300 dark:bg-gray-600 md:text-base"}),y("input",{type:"password",name:"re-enter-password",placeholder:B.t("reenter_new_password_placeholder"),className:"mb-2 w-full rounded-lg bg-gray-100 px-4 py-5 text-base placeholder:text-gray-300 dark:bg-gray-600 md:text-base"}),e&&y(rr,{children:e}),y(tt,{className:"sm:mt-4 !text-base",children:B.t("continue")})]}),y(gn,{state:a})]})]})},N8=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"}),code:s.z.string().optional().openapi({description:"The code parameter from an email verification link"})})},responses:{200:{description:"Response"}}}),async t=>{const{state:e,code:n}=t.req.valid("query"),{theme:r,branding:i,client:o,loginSession:a}=await Ue(t,e),{username:l}=a.authParams;if(!l)throw new C(400,{message:"Username required"});return n?t.html(y(Or,{state:e,theme:r,branding:i,client:o,email:l,code:n})):t.html(y(Or,{state:e,theme:r,branding:i,client:o,email:l}))}).openapi(s.createRoute({tags:["login"],method:"post",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})}),body:{content:{"application/x-www-form-urlencoded":{schema:s.z.object({password:s.z.string(),"re-enter-password":s.z.string(),code:s.z.string().optional()})}}}},responses:{200:{description:"HTML page indicating success (e.g., email verification sent) or a next step.",content:{"text/html":{schema:s.z.string()}}},302:{description:"Redirect to continue the authentication flow (e.g., to client, MFA, consent) after successful login.",headers:s.z.object({Location:s.z.string().url()})},400:{description:"Bad Request - HTML page with an error message (e.g., passwords don't match, weak password, user exists).",content:{"text/html":{schema:s.z.string()}}},500:{description:"Internal Server Error - HTML page with an error message.",content:{"text/html":{schema:s.z.string()}}}}}),async t=>{const{state:e}=t.req.valid("query"),n=t.req.valid("form"),{env:r}=t,{theme:i,branding:o,client:a,loginSession:l}=await Ue(t,e);try{if(!l.authParams.username)throw new C(400,{message:"Username required"});const u="Username-Password-Authentication";if(t.set("connection",u),n.password!==n["re-enter-password"])return t.html(y(Or,{state:e,code:n.code,theme:i,branding:o,client:a,error:B.t("create_account_passwords_didnt_match"),email:l.authParams.username}),400);if(!Nf(n.password))return t.html(y(Or,{state:e,code:n.code,theme:i,branding:o,client:a,error:B.t("create_account_weak_password"),email:l.authParams.username}),400);const d=n.code?await r.data.codes.get(a.tenant.id,n.code,"email_verification"):void 0,p=d?await r.data.loginSessions.get(a.tenant.id,d.login_id):void 0;if(await Xi({userAdapter:t.env.data.users,tenant_id:a.tenant.id,username:l.authParams.username,provider:"auth2"}))return t.html(y(Or,{state:e,code:n.code,theme:i,branding:o,client:a,error:B.t("user_exists_error"),email:l.authParams.username}),400);const g=(p==null?void 0:p.authParams.username)===l.authParams.username,A=`auth2|${Sc()}`,$=await r.data.users.create(a.tenant.id,{user_id:A,email:l.authParams.username,email_verified:g,provider:"auth2",connection:u,is_social:!1});if(await r.data.passwords.create(a.tenant.id,{user_id:A,password:await ts.hash(n.password,10),algorithm:"bcrypt"}),!g)return await If(t,$),t.html(y(Ft,{message:B.t("validate_email_body"),pageTitle:B.t("validate_email_title"),theme:i,branding:o,client:a,state:e}));const N=await ty(t,a,{...l.authParams,password:n.password},l);return Sr(t,N)}catch(u){let d=B.t("unknown_error_message"),p=400;return u instanceof C?(d=u.message||d,p=u.status===400?400:500):u instanceof yi?d=u.message||d:u instanceof Error&&(d=u.message||d,p=500),t.html(y(Or,{state:e,theme:i,branding:o,client:a,error:d,email:l.authParams.username,code:n.code}),p)}}),wi=t=>{const{error:e,theme:n,branding:r,client:i,email:o}=t;return y(nt,{title:B.t("reset_password_title"),theme:n,branding:r,client:i,children:[y("div",{className:"mb-4 text-lg font-medium sm:text-2xl",children:B.t("reset_password_title")}),y("div",{className:"mb-6 text-gray-300",children:`${B.t("reset_password_description")} ${o}`}),y("div",{className:"flex flex-1 flex-col justify-center",children:y(Rn,{children:[y(op,{name:"password",placeholder:B.t("enter_new_password_placeholder")}),y(op,{name:"re-enter-password",placeholder:B.t("reenter_new_password_placeholder")}),e&&y(rr,{children:e}),y(tt,{className:"sm:mt-4 !text-base",children:B.t("reset_password_cta")})]})})]})},C8=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"}),code:s.z.string().openapi({description:"The code parameter from the authorization request"})})},responses:{200:{description:"Response"}}}),async t=>{const{state:e}=t.req.valid("query"),{theme:n,branding:r,client:i,loginSession:o}=await Ue(t,e);if(!o.authParams.username)throw new C(400,{message:"Username required"});return t.html(y(wi,{theme:n,branding:r,client:i,email:o.authParams.username}))}).openapi(s.createRoute({tags:["login"],method:"post",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"}),code:s.z.string().openapi({description:"The code parameter from the authorization request"})}),body:{content:{"application/x-www-form-urlencoded":{schema:s.z.object({password:s.z.string(),"re-enter-password":s.z.string()})}}}},responses:{200:{description:"Response"}}}),async t=>{const{state:e,code:n}=t.req.valid("query"),{password:r,"re-enter-password":i}=t.req.valid("form"),{env:o}=t,{theme:a,branding:l,client:u,loginSession:d}=await Ue(t,e);if(!d.authParams.username)throw new C(400,{message:"Username required"});if(r!==i)return t.html(y(wi,{error:B.t("create_account_passwords_didnt_match"),theme:a,branding:l,client:u,email:d.authParams.username}),400);if(!Nf(r))return t.html(y(wi,{error:B.t("create_account_weak_password"),theme:a,branding:l,client:u,email:d.authParams.username}),400);const p=await Xi({userAdapter:o.data.users,tenant_id:u.tenant.id,username:d.authParams.username,provider:"auth2"});if(!p)throw new C(400,{message:"User not found"});try{if(!await o.data.codes.get(u.tenant.id,n,"password_reset"))return t.html(y(wi,{error:"Code not found or expired",theme:a,branding:l,client:u,email:d.authParams.username}),400);const g={user_id:p.user_id,password:await ts.hash(r,10),algorithm:"bcrypt"};await o.data.passwords.get(u.tenant.id,p.user_id)?await o.data.passwords.update(u.tenant.id,g):await o.data.passwords.create(u.tenant.id,g),p.email_verified||await o.data.users.update(u.tenant.id,p.user_id,{email_verified:!0})}catch{return t.html(y(wi,{error:"The password could not be reset",theme:a,branding:l,client:u,email:d.authParams.username}),400)}return t.html(y(Ft,{message:B.t("password_has_been_reset"),theme:a,branding:l,client:u,state:e}))}),Ny=t=>{const{error:e,theme:n,branding:r,client:i,email:o,state:a}=t;return y(nt,{title:B.t("forgot_password_title"),theme:n,branding:r,client:i,children:[y("div",{className:"mb-4 text-lg font-medium sm:text-2xl",children:B.t("forgot_password_title")}),y("div",{className:"mb-6 text-gray-300",children:B.t("forgot_password_description")}),y("div",{className:"flex flex-1 flex-col justify-center",children:[y(Rn,{className:"pt-2",children:[y("input",{type:"email",name:"username",placeholder:B.t("email_placeholder"),className:"mb-2 w-full rounded-lg bg-gray-100 px-4 py-5 text-base placeholder:text-gray-300 dark:bg-gray-600 md:text-base",value:o,disabled:!!o}),e&&y(rr,{children:e}),y(tt,{className:"sm:mt-4 !text-base",children:B.t("forgot_password_cta")})]}),y(gn,{state:a})]})]})},Cy=t=>{const{theme:e,branding:n,client:r,state:i}=t;return y(nt,{title:"Login",theme:e,branding:n,client:r,children:[y("div",{className:"flex flex-1 flex-col justify-center",children:[y("div",{children:B.t("forgot_password_email_sent")}),y("div",{className:"my-4 flex space-x-2 text-sm text-[#B2B2B2]",children:[y(et,{className:"text-base",name:"info-bubble"}),y("div",{className:"text-sm text-gray-300 md:text-sm",children:B.t("sent_code_spam")})]})]}),y(gn,{state:i})]})},T8=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})})},responses:{200:{description:"Response"}}}),async t=>{const{state:e}=t.req.valid("query"),{theme:n,branding:r,client:i,loginSession:o}=await Ue(t,e);return t.html(y(Ny,{theme:n,branding:r,client:i,state:e,email:o.authParams.username}))}).openapi(s.createRoute({tags:["login"],method:"post",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})})},responses:{200:{description:"Response"}}}),async t=>{const{state:e}=t.req.valid("query"),{theme:n,branding:r,client:i,loginSession:o}=await Ue(t,e);return await yE(t,i,o.authParams.username,o.id),t.html(y(Cy,{theme:n,branding:r,client:i,state:e}))}),Ty=({theme:t,branding:e,client:n,state:r,user:i})=>y(nt,{title:xe("check_email_title"),theme:t,branding:e,client:n,children:y("div",{className:"flex flex-1 flex-col justify-center",children:[y("div",{className:"mb-8 text-gray-700 dark:text-gray-300",children:[y(Vi,{i18nKey:"currently_logged_in_as",components:[y("span",{className:"font-semibold text-gray-900 dark:text-white"},"span")],values:{email:i.email||""}}),y("br",{}),xe("continue_with_sso_provider_headline")]}),y("div",{className:"space-y-6",children:[y(Rn,{children:y(tt,{className:"!text-base",children:y("span",{children:B.t("yes_continue_with_existing_account")})})}),y("a",{className:"block text-center text-primary hover:text-primaryHover focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2 dark:focus:ring-offset-gray-900",href:`/u/login/identifier?state=${encodeURIComponent(r)}`,children:B.t("no_use_another")})]})]})}),I8=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})})},responses:{200:{description:"HTML page to check account status or verify email.",content:{"text/html":{schema:s.z.string()}}},302:{description:"Redirect to login identifier page if no valid session.",headers:s.z.object({Location:s.z.string().url()})},400:{description:"Bad Request - HTML error page if state is missing or other input error.",content:{"text/html":{schema:s.z.string()}}},500:{description:"Internal Server Error - HTML error page.",content:{"text/html":{schema:s.z.string()}}}}}),async t=>{var d;const{env:e}=t,{state:n}=t.req.valid("query"),{theme:r,branding:i,client:o}=await Ue(t,n);if(!o||!((d=o.tenant)!=null&&d.id))return console.error("Client or tenant ID missing in GET /u/check-account after initJSXRoute"),t.html(y(Ft,{theme:r,branding:i,client:o,state:n,pageTitle:B.t("error_page_title")||"Error",message:B.t("configuration_error_message")||"A configuration error occurred."}),500);const a=Tn(o.tenant.id,t.req.header("cookie")),l=a?await e.data.sessions.get(o.tenant.id,a):null;if(!l)return t.redirect(`/u/login/identifier?state=${n}`);const u=await e.data.users.get(o.tenant.id,l.user_id);return u?t.html(y(Ty,{theme:r,branding:i,client:o,state:n,user:u})):t.redirect(`/u/login/identifier?state=${n}`)}).openapi(s.createRoute({tags:["login"],method:"post",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})})},responses:{302:{description:"Redirect to continue authentication flow or to login identifier.",headers:s.z.object({Location:s.z.string().url()})},400:{description:"Bad Request - HTML error page if state is missing or other input error.",content:{"text/html":{schema:s.z.string()}}},500:{description:"Internal Server Error - HTML error page for unexpected issues or if TokenResponse is returned.",content:{"text/html":{schema:s.z.string()}}}}}),async t=>{var h;const{env:e}=t,{state:n}=t.req.valid("query"),{theme:r,branding:i,client:o,loginSession:a}=await Ue(t,n);if(!o||!((h=o.tenant)!=null&&h.id))return console.error("Client or tenant ID missing in POST /u/check-account after initJSXRoute"),t.html(y(Ft,{theme:r,branding:i,client:o,state:n,pageTitle:B.t("error_page_title")||"Error",message:B.t("configuration_error_message")}),500);const l=Tn(o.tenant.id,t.req.header("cookie")),u=l?await e.data.sessions.get(o.tenant.id,l):null;if(!u)return t.redirect(`/u/login/identifier?state=${n}`);const d=await e.data.users.get(o.tenant.id,u.user_id);if(!d)return t.redirect(`/u/login/identifier?state=${n}`);await e.data.loginSessions.update(o.tenant.id,a.id,{session_id:u.id});const p=await Sr(t,{user:d,authParams:a.authParams,client:o,loginSession:{...a,session_id:u.id},sessionId:u.id});if(!(p instanceof Response))throw new C(500,{message:B.t("unexpected_error_try_again")});return p}),O8=!1,Zg=t=>{var l;const{theme:e,branding:n,user:r,client:i,error:o,success:a}=t;return(l=r.identities)!=null&&l.filter(u=>!(u.provider===r.provider&&u.user_id===r.user_id.split("|")[1])),y(nt,{title:B.t("account_title")||"Account Settings",theme:e,branding:n,client:i,children:y("div",{className:"flex flex-1 flex-col justify-center",children:y("div",{className:"mx-auto w-full max-w-sm",children:[y("div",{className:"text-center",children:y("h1",{className:"mb-6 text-2xl font-semibold text-gray-900",children:B.t("account_title")||"Account Settings"})}),o&&y(rr,{children:o}),a&&y("div",{className:"mb-4 rounded-md bg-green-50 p-4",children:y("div",{className:"text-sm text-green-700",children:a})}),y("div",{className:"mb-6",children:[y("h2",{className:"mb-3 text-lg font-medium text-gray-900",children:B.t("email")}),y("div",{className:"rounded-lg border border-gray-200 p-4",children:y("div",{className:"flex items-center justify-between",children:y("div",{children:[y("p",{className:"text-sm font-medium text-gray-900",children:r.email||"No email set"}),y("p",{className:"text-xs text-gray-500",children:r.email_verified?B.t("verified")||"Verified":B.t("unverified")||"Unverified"})]})})})]}),y("div",{className:"mb-6",children:[y("h2",{className:"mb-3 text-lg font-medium text-gray-900",children:B.t("update_email")}),y("form",{method:"post",children:[y("input",{type:"hidden",name:"action",value:"update_email"}),y("div",{className:"mb-4",children:y("input",{type:"email",id:"email",name:"email",required:!0,className:"w-full rounded-md border border-gray-300 px-3 py-2 text-sm placeholder-gray-400 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500",placeholder:B.t("enter_new_email")})}),y(tt,{variant:"primary",className:"w-full",children:B.t("update_email")})]})]}),O8]})})})},z8=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})})},responses:{200:{description:"HTML page showing account management interface.",content:{"text/html":{schema:s.z.string()}}},302:{description:"Redirect to login if no session",headers:s.z.object({Location:s.z.string().url()})},400:{description:"Bad Request - HTML error page if state is missing or other input error.",content:{"text/html":{schema:s.z.string()}}},500:{description:"Internal Server Error - HTML error page.",content:{"text/html":{schema:s.z.string()}}}}}),async t=>{var d;const{env:e}=t,{state:n}=t.req.valid("query"),{theme:r,branding:i,client:o}=await Ue(t,n,!0);if(!o||!((d=o.tenant)!=null&&d.id))return console.error("Client or tenant ID missing in GET /u/account after initJSXRoute"),t.html(y(Ft,{theme:r,branding:i,client:o,state:n,pageTitle:B.t("error_page_title")||"Error",message:B.t("configuration_error_message")||"A configuration error occurred."}),500);const a=Tn(o.tenant.id,t.req.header("cookie")),l=a?await e.data.sessions.get(o.tenant.id,a):null;if(!l)return t.redirect(`/u/login/identifier?state=${encodeURIComponent(n)}`);const u=await e.data.users.get(o.tenant.id,l.user_id);return u?t.html(y(Zg,{theme:r,branding:i,user:u,client:o})):t.redirect(`/u/login/identifier?state=${encodeURIComponent(n)}`)}).openapi(s.createRoute({tags:["login"],method:"post",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})}),body:{content:{"application/x-www-form-urlencoded":{schema:s.z.object({email:s.z.string().toLowerCase().optional(),action:s.z.enum(["update_email","unlink_account"]),provider:s.z.string().optional(),user_id:s.z.string().optional()})}}}},responses:{200:{description:"HTML response with form results",content:{"text/html":{schema:s.z.string()}}},302:{description:"Redirect to change-email page or login if no session",headers:s.z.object({Location:s.z.string().url()})},400:{description:"Bad Request - HTML error page if state is missing or other input error.",content:{"text/html":{schema:s.z.string()}}},500:{description:"Internal Server Error - HTML error page.",content:{"text/html":{schema:s.z.string()}}}}}),async t=>{var A;const{env:e}=t,{state:n}=t.req.valid("query"),r=t.req.valid("form"),{theme:i,branding:o,client:a}=await Ue(t,n,!0);if(!a||!((A=a.tenant)!=null&&A.id))return console.error("Client or tenant ID missing in POST /u/account after initJSXRoute"),t.html(y(Ft,{theme:i,branding:o,client:a,state:n,pageTitle:B.t("error_page_title")||"Error",message:B.t("configuration_error_message")||"A configuration error occurred."}),500);const l=Tn(a.tenant.id,t.req.header("cookie")),u=l?await e.data.sessions.get(a.tenant.id,l):null;if(!u)return t.redirect(`/u/login/identifier?state=${encodeURIComponent(n)}`);const d=await e.data.users.get(a.tenant.id,u.user_id);if(!d)return t.redirect(`/u/login/identifier?state=${encodeURIComponent(n)}`);let p,h;try{if(r.action==="update_email"&&r.email){const $=Ve();await e.data.codes.create(a.tenant.id,{code_id:$,login_id:"",code_type:"email_verification",expires_at:new Date(Date.now()+xu).toISOString(),user_id:d.user_id});const N=$r();return await e.data.codes.create(a.tenant.id,{code_id:N,login_id:"",code_type:"email_verification",expires_at:new Date(Date.now()+xu).toISOString(),user_id:d.user_id}),await Cf(t,{to:r.email.toLowerCase(),code:N}),t.redirect(`/u/change-email?state=${encodeURIComponent(n)}&email=${encodeURIComponent(r.email.toLowerCase())}&change_id=${$}`)}else r.action==="unlink_account"&&r.provider&&r.user_id&&(await e.data.users.unlink(a.tenant.id,d.user_id,r.provider,r.user_id),h=B.t("account_unlinked_successfully")||"Account unlinked successfully")}catch{p=B.t("operation_failed")||"Operation failed"}const g=await e.data.users.get(a.tenant.id,d.user_id);return t.html(y(Zg,{theme:i,branding:o,user:g||d,client:a,error:p,success:h}))}),Qg=6,sp=({error:t,theme:e,branding:n,client:r,email:i,success:o,state:a})=>o?y(nt,{title:B.t("success"),theme:e,branding:n,client:r,children:[y("div",{className:"mb-4 text-2xl font-medium",children:B.t("success")}),y("div",{className:"mb-8 text-gray-300",children:y(Vi,{i18nKey:"email_changed_to_template",components:[y("span",{className:"text-black dark:text-white"},"span")],values:{email:i}})}),y("div",{className:"flex flex-1 flex-col justify-center",children:y(tt,{Component:"a",href:a?`/u/account?state=${encodeURIComponent(a)}`:`/u/account?client_id=${encodeURIComponent(r.id)}`,className:"sm:mt-4 !text-base",children:[y("span",{children:B.t("continue")}),y(et,{className:"text-xs",name:"arrow-right"})]})})]}):y(nt,{title:B.t("verify_email_verify"),theme:e,branding:n,client:r,children:[y("div",{className:"mb-4 text-2xl font-medium",children:B.t("verify_email_verify")}),y("div",{className:"mb-8 text-gray-300",children:y(Vi,{i18nKey:"code_sent_template",components:[y("span",{className:"text-black dark:text-white"},"span")],values:{username:i}})}),y("div",{className:"flex flex-1 flex-col justify-center",children:[y(Rn,{className:"pt-2",children:[y("input",{autoFocus:!0,type:"text",pattern:"[0-9]*",maxLength:Qg,inputMode:"numeric",name:"code",placeholder:"******",className:Jn("mb-2 w-full rounded-lg border bg-gray-100 px-4 pb-2 pt-2.5 text-center indent-[5px] font-mono text-3xl placeholder:text-gray-300 dark:bg-gray-600 md:text-3xl",{"border-red":t,"border-gray-100 dark:border-gray-500":!t}),minLength:Qg,required:!0,id:"code-input"}),t&&y(rr,{children:t}),y(tt,{className:"sm:mt-4 !text-base",children:[y("span",{children:B.t("continue")}),y(et,{className:"text-xs",name:"arrow-right"})]}),y("div",{className:"my-4 flex space-x-2 text-sm text-[#B2B2B2]",children:[y(et,{className:"text-base",name:"info-bubble"}),y("div",{className:"text-sm text-gray-300 md:text-sm",children:B.t("sent_code_spam")})]})]}),y("a",{className:"block text-primary hover:text-primaryHover text-center",href:a?`/u/account?state=${encodeURIComponent(a)}`:`/u/account?client_id=${encodeURIComponent(r.id)}`,children:B.t("go_back")})]})]}),D8=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"}),email:s.z.string().email(),change_id:s.z.string()})},responses:{200:{description:"HTML page for email change verification",content:{"text/html":{schema:s.z.string()}}},302:{description:"Redirect to account or login if no session",headers:s.z.object({Location:s.z.string().url()})},400:{description:"Bad Request - HTML error page if state is missing or other input error.",content:{"text/html":{schema:s.z.string()}}},500:{description:"Internal Server Error - HTML error page.",content:{"text/html":{schema:s.z.string()}}}}}),async t=>{var g;const{env:e}=t,{state:n,email:r,change_id:i}=t.req.valid("query"),{theme:o,branding:a,client:l}=await Ue(t,n,!0);if(!l||!((g=l.tenant)!=null&&g.id))return console.error("Client or tenant ID missing in GET /u/change-email after initJSXRoute"),t.html(y(Ft,{theme:o,branding:a,client:l,state:n,pageTitle:B.t("error_page_title")||"Error",message:B.t("configuration_error_message")||"A configuration error occurred."}),500);const u=Tn(l.tenant.id,t.req.header("cookie")),d=u?await e.data.sessions.get(l.tenant.id,u):null;if(!d)return t.redirect(`/u/login/identifier?state=${n}`);const p=await e.data.users.get(l.tenant.id,d.user_id);if(!p)return t.redirect(`/u/login/identifier?state=${n}`);const h=await t.env.data.codes.get(l.tenant.id,i,"email_verification");return!h||h.user_id!==p.user_id?t.redirect(`/u/account?state=${n}`):t.html(y(sp,{theme:o,branding:a,client:l,email:r,state:n}))}).openapi(s.createRoute({tags:["login"],method:"post",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"}),email:s.z.string().toLowerCase(),change_id:s.z.string()}),body:{content:{"application/x-www-form-urlencoded":{schema:s.z.object({code:s.z.string()})}}}},responses:{200:{description:"HTML response with verification result",content:{"text/html":{schema:s.z.string()}}},302:{description:"Redirect to confirmation page on success",headers:s.z.object({Location:s.z.string().url()})},400:{description:"Bad Request - HTML error page if state is missing or other input error.",content:{"text/html":{schema:s.z.string()}}},500:{description:"Internal Server Error - HTML error page.",content:{"text/html":{schema:s.z.string()}}}}}),async t=>{var A;const{env:e}=t,{state:n,email:r,change_id:i}=t.req.valid("query"),{code:o}=t.req.valid("form"),{theme:a,branding:l,client:u}=await Ue(t,n,!0);if(!u||!((A=u.tenant)!=null&&A.id))return console.error("Client or tenant ID missing in POST /u/change-email after initJSXRoute"),t.html(y(Ft,{theme:a,branding:l,client:u,state:n,pageTitle:B.t("error_page_title")||"Error",message:B.t("configuration_error_message")||"A configuration error occurred."}),500);const d=Tn(u.tenant.id,t.req.header("cookie")),p=d?await e.data.sessions.get(u.tenant.id,d):null;if(!p||p.revoked_at)return t.redirect(`/u/login/identifier?state=${encodeURIComponent(n)}`);const h=await e.data.users.get(u.tenant.id,p.user_id);if(!h)return t.redirect(`/u/login/identifier?state=${encodeURIComponent(n)}`);let g;try{const $=await e.data.codes.get(u.tenant.id,i,"email_verification");if(!$)g=B.t("invalid_request");else if($.user_id!==h.user_id)g=B.t("invalid_request");else if($.used_at)g=B.t("code_already_used");else if(new Date($.expires_at)<new Date)g=B.t("code_expired");else{const N=await e.data.codes.get(u.tenant.id,o,"email_verification");if(!N)g=B.t("invalid_code");else if(N.used_at)g=B.t("code_already_used");else if(new Date(N.expires_at)<new Date)g=B.t("code_expired");else if(N.user_id!==h.user_id)g=B.t("invalid_code");else return await e.data.codes.used(u.tenant.id,i),await e.data.codes.used(u.tenant.id,o),await e.data.users.update(u.tenant.id,h.user_id,{email:r,email_verified:!0}),t.redirect(`/u/change-email-confirmation?state=${encodeURIComponent(n)}&email=${encodeURIComponent(r)}`)}}catch{g=B.t("operation_failed")}return t.html(y(sp,{theme:a,branding:l,client:u,email:r,error:g,state:n}))}),R8=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"}),email:s.z.string().email()})},responses:{200:{description:"HTML page showing email change confirmation",content:{"text/html":{schema:s.z.string()}}},302:{description:"Redirect to login if no session",headers:s.z.object({Location:s.z.string().url()})},400:{description:"Bad Request - HTML error page if state is missing or other input error.",content:{"text/html":{schema:s.z.string()}}},500:{description:"Internal Server Error - HTML error page.",content:{"text/html":{schema:s.z.string()}}}}}),async t=>{var d;const{env:e}=t,{state:n,email:r}=t.req.valid("query"),{theme:i,branding:o,client:a}=await Ue(t,n,!0);if(!a||!((d=a.tenant)!=null&&d.id))return console.error("Client or tenant ID missing in GET /u/change-email-confirmation after initJSXRoute"),t.html(y(Ft,{theme:i,branding:o,client:a,state:n,pageTitle:B.t("error_page_title")||"Error",message:B.t("configuration_error_message")||"A configuration error occurred."}),500);const l=Tn(a.tenant.id,t.req.header("cookie")),u=l?await e.data.sessions.get(a.tenant.id,l):null;return!u||u.revoked_at?t.redirect(`/u/login/identifier?state=${encodeURIComponent(n)}`):t.html(y(sp,{theme:i,branding:o,client:a,email:r,success:!0,state:n}))}),Iy=t=>{const{theme:e,branding:n,client:r,email:i,state:o}=t;return y(nt,{title:B.t("create_password_account_title"),theme:e,branding:n,client:r,children:[y("div",{className:"mb-4 text-lg font-medium sm:text-2xl",children:B.t("create_password_account_title")}),y("div",{className:"mb-6 text-gray-300",children:B.t("enter_email_for_verification_description")}),y("div",{className:"flex flex-1 flex-col justify-center",children:y(Rn,{className:"pt-2",children:[y("input",{type:"email",name:"username",placeholder:B.t("email_placeholder"),className:"mb-2 w-full rounded-lg bg-gray-100 px-4 py-5 text-base placeholder:text-gray-300 dark:bg-gray-600 md:text-base",required:!0,value:i,disabled:!0}),y(tt,{className:"sm:mt-4 !text-base",children:B.t("send")})]})}),y(gn,{state:o})]})},P8=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})})},responses:{200:{description:"Response"}}}),async t=>{const{state:e}=t.req.valid("query"),{theme:n,branding:r,client:i,loginSession:o}=await Ue(t,e),{username:a}=o.authParams;if(!a)throw new C(400,{message:"Username required"});return t.html(y(Iy,{state:e,theme:n,branding:r,client:i,email:a}))}).openapi(s.createRoute({tags:["login"],method:"post",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})})},responses:{200:{description:"Response"}}}),async t=>{const{state:e}=t.req.valid("query"),{loginSession:n,client:r}=await Ue(t,e),{username:i}=n.authParams;if(!i)throw new C(400,{message:"Username required"});const o=await t.env.data.codes.create(r.tenant.id,{code_id:$r(),code_type:"email_verification",login_id:n.id,expires_at:new Date(Date.now()+xu).toISOString()});return await gE(t,i,o.code_id,n.id),t.redirect(`/u/pre-signup-sent?state=${e}`)}),Oy=t=>{const{redirectUrl:e,theme:n,branding:r,client:i}=t;return y(nt,{title:B.t("invalid_session_title"),theme:n,branding:r,client:i,children:[y("div",{className:"flex flex-1 flex-col justify-center",children:B.t("invalid_session_body")}),y("div",{className:"flex flex-1 flex-col justify-center",children:e&&y("a",{className:"block text-primary hover:text-primaryHover text-center",href:e,children:B.t("go_back")})})]})},B8=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string()})},responses:{200:{description:"Response"}}}),async t=>{const{state:e}=t.req.valid("query"),{theme:n,branding:r,client:i,loginSession:o}=await Ue(t,e);let a;return o.authParams.redirect_uri&&o.authParams.state&&(a=new URL(o.authParams.redirect_uri),a.searchParams.set("state",o.authParams.state),a.searchParams.set("error","invalid_session"),a.searchParams.set("error_description",o.authParams.username||"")),t.html(y(Oy,{redirectUrl:a==null?void 0:a.href,theme:n,branding:r,client:i}))}),j8=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"}),code:s.z.string().openapi({description:"The code parameter from the authorization request"})})},responses:{200:{description:"Response"}}}),async t=>{const{state:e}=t.req.valid("query"),{theme:n,branding:r,client:i}=await Ue(t,e);return t.html(y(Ft,{message:"Not implemented",pageTitle:"User info",theme:n,branding:r,client:i,state:e}))}),zy=({theme:t,branding:e,client:n,state:r})=>{const i=new URLSearchParams({state:r});return y(nt,{title:B.t("email_validated"),theme:t,branding:e,client:n,children:[y("div",{className:"mb-4 text-lg font-medium sm:text-2xl",children:B.t("email_validated")}),y("div",{className:"flex flex-1 flex-col justify-center mb-7",children:y(tt,{Component:"a",href:`/u/enter-password?${i}`,className:"text-base sm:mt-4 md:text-base",children:y("div",{className:"flex items-center space-x-2",children:[y("span",{children:B.t("email_validated_cta")}),y(et,{className:"text-xs",name:"arrow-right"})]})})})]})},L8=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"}),code:s.z.string().openapi({description:"The code parameter from the authorization request"})})},responses:{200:{description:"Response"}}}),async t=>{var A;const{state:e,code:n}=t.req.valid("query"),{env:r}=t,{client:i,loginSession:o,theme:a,branding:l}=await Ue(t,e),{username:u}=o.authParams;if(!u)throw new C(400,{message:"Username not found in state"});const d=await Xi({userAdapter:r.data.users,tenant_id:i.tenant.id,username:u,provider:"auth2"});if(!d)throw new C(500,{message:"No user found"});if(!await r.data.codes.get(i.tenant.id,n,"email_verification"))throw new C(400,{message:"Code not found or expired"});await r.data.users.update(i.tenant.id,d.user_id,{email_verified:!0});const g=(await Ap(r.data.users,i.tenant.id,u)).filter($=>$.provider!=="auth2");if(g.length>0){const $=g.filter(N=>!N.linked_to);$.length>1&&console.error("More than one primary user found for email",u),$.length===0&&console.error("No primary user found for email",u),$.length===1&&await r.data.users.update(i.tenant.id,d.user_id,{linked_to:(A=$[0])==null?void 0:A.user_id})}return t.html(y(zy,{theme:a,branding:l,client:i,state:e}))}),Dy=t=>{const{theme:e,branding:n,client:r,email:i,state:o}=t;return y(nt,{title:B.t("sign_up_success"),theme:e,branding:n,client:r,children:[y("div",{className:"mb-4 text-lg font-medium sm:text-2xl",children:B.t("email_verification_for_signup_sent_title")}),y("div",{className:"flex flex-1 flex-col justify-center",children:[y("div",{className:"mb-6 text-gray-300",children:y(Vi,{i18nKey:"email_verification_for_signup_sent_description",components:[y("span",{className:"text-black dark:text-white"},"span")],values:{email:i}})}),y("div",{className:"my-4 flex space-x-2 text-sm text-[#B2B2B2]",children:[y(et,{className:"text-base",name:"info-bubble"}),y("div",{className:"text-sm text-gray-300 md:text-sm",children:B.t("sent_code_spam")})]})]}),y(gn,{state:o})]})},F8=new s.OpenAPIHono().openapi(s.createRoute({tags:["login"],method:"get",path:"/",request:{query:s.z.object({state:s.z.string().openapi({description:"The state parameter from the authorization request"})})},responses:{200:{description:"Response"}}}),async t=>{const{state:e}=t.req.valid("query"),{theme:n,branding:r,client:i,loginSession:o}=await Ue(t,e),{username:a}=o.authParams;if(!a)throw new C(400,{message:"Username required"});return t.html(y(Dy,{theme:n,branding:r,client:i,state:e,email:a}))}),jf=`
255
255
  @font-face{font-display:swap;font-family:KHTeka;font-style:normal;font-weight:400;src:url(https://assets.sesamy.com/fonts/khteka/WOFF2/KHTeka-Regular.woff2) format("woff2")}@font-face{font-display:swap;font-family:KHTeka;font-style:normal;font-weight:500;src:url(https://assets.sesamy.com/fonts/khteka/WOFF2/KHTeka-Medium.woff2) format("woff2")}@font-face{font-display:swap;font-family:KHTeka;font-style:normal;font-weight:600;src:url(https://assets.sesamy.com/fonts/khteka/WOFF2/KHTeka-Bold.woff2) format("woff2")}@font-face{font-family:uicon;src:url(https://login2.sesamy.com/_next/static/media/uicon.0b00e08a.woff2)}[class*=" uicon-"],[class^=uicon-]{font-family:uicon!important;font-size:inherit;font-style:normal;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased}.uicon-apple:before{content:"\\ea01"}.uicon-arrow-down:before{content:"\\ea02"}.uicon-arrow-left:before{content:"\\ea03"}.uicon-arrow-right:before{content:"\\ea04"}.uicon-arrow-up:before{content:"\\ea05"}.uicon-facebook:before{content:"\\ea06"}.uicon-google:before{content:"\\ea07"}.uicon-info-bubble:before{content:"\\ea08"}.uicon-info:before{content:"\\ea09"}.uicon-sesamy:before{content:"\\ea0a"}.uicon-spinner-circle:before{content:"\\ea0b"}.uicon-spinner-inner:before{content:"\\ea0c"}
256
256
 
257
- /*! tailwindcss v3.4.1 | MIT License | https://tailwindcss.com*/*,:after,:before{border:0 solid #bfbcd7;box-sizing:border-box}:after,:before{--tw-content:""}:host,html{line-height:1.5;-webkit-text-size-adjust:100%;font-family:KHTeka,Helvetica Neue,HelveticaNeue,TeX Gyre Heros,TeXGyreHeros,FreeSans,Nimbus Sans L,Liberation Sans,Arimo,Helvetica,sans-serif;font-feature-settings:normal;font-variation-settings:normal;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-tap-highlight-color:transparent}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-size:1em;font-variation-settings:normal}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{color:inherit;font-family:inherit;font-feature-settings:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{color:#4b4a58;opacity:1}input::placeholder,textarea::placeholder{color:#4b4a58;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]{display:none}body,html{height:100%}body{--tw-bg-opacity:1;background-color:rgb(248 249 251/var(--tw-bg-opacity));font-size:1rem;letter-spacing:.0125rem;line-height:120%;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}@media (min-width:1280px){body{font-size:1.125rem;line-height:120%}}:is(.dark body){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}button,input,optgroup,select,textarea{font-size:.875rem;letter-spacing:.0125rem;line-height:120%}@media (min-width:1280px){button,input,optgroup,select,textarea{font-size:1rem;line-height:120%}}h1{font-size:1.5rem;font-weight:500;line-height:120%}@media (min-width:1280px){h1{font-size:2rem;line-height:120%}}@media (min-width:640px){h1{font-size:3rem;letter-spacing:-.0625rem;line-height:100%}}@media (min-width:1280px){h1{font-size:3.5rem;letter-spacing:-.0625rem;line-height:100%}}h2{font-size:1.25rem;font-weight:500;line-height:120%}@media (min-width:1280px){h2{font-size:1.5rem;line-height:120%}}@media (min-width:640px){h2{font-size:2rem;letter-spacing:0;line-height:120%}}@media (min-width:1280px){h2{font-size:3rem;letter-spacing:-.0625rem;line-height:100%}}h3{font-size:1.125rem;font-weight:500;line-height:120%}@media (min-width:1280px){h3{font-size:1.25rem;line-height:120%}}@media (min-width:640px){h3{font-size:1.5rem;line-height:120%}}@media (min-width:1280px){h3{font-size:2rem;line-height:120%}}h4{font-size:1rem;font-weight:500;line-height:120%}@media (min-width:1280px){h4{font-size:1.125rem;line-height:120%}}@media (min-width:640px){h4{font-size:1.125rem;line-height:120%}}@media (min-width:1280px){h4{font-size:1.5rem;line-height:120%}}h5{font-size:.875rem;font-weight:500;line-height:120%}@media (min-width:1280px){h5{font-size:1rem;line-height:120%}}@media (min-width:640px){h5{font-size:1rem;line-height:120%}}@media (min-width:1280px){h5{font-size:1.125rem;line-height:120%}}h6{font-size:.75rem;font-weight:500;line-height:135%}@media (min-width:1280px){h6{font-size:.875rem;line-height:120%}}@media (min-width:640px){h6{font-size:.875rem;line-height:120%}}@media (min-width:1280px){h6{font-size:1rem;line-height:120%}}*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.container{width:100%}@media (min-width:640px){.container{max-width:640px}}@media (min-width:1280px){.container{max-width:1280px}}@media (min-width:1920px){.container{max-width:1920px}}.pointer-events-none{pointer-events:none}.absolute{position:absolute}.relative{position:relative}.inset-0{inset:0}.left-0{left:0}.right-0{right:0}.top-0{top:0}.top-1\\/2{top:50%}.mx-auto{margin-left:auto;margin-right:auto}.my-4{margin-bottom:1rem;margin-top:1rem}.mb-12{margin-bottom:3rem}.mb-16{margin-bottom:4rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-5{margin-bottom:1.25rem}.mb-6{margin-bottom:1.5rem}.mb-7{margin-bottom:1.75rem}.mb-8{margin-bottom:2rem}.mt-1{margin-top:.25rem}.mt-8{margin-top:2rem}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.\\!hidden{display:none!important}.hidden{display:none}.h-5{height:1.25rem}.h-9{height:2.25rem}.h-full{height:100%}.max-h-full{max-height:100%}.min-h-\\[calc\\(100vh-83px\\)\\]{min-height:calc(100vh - 83px)}.min-h-full{min-height:100%}.w-10{width:2.5rem}.w-5{width:1.25rem}.w-\\[calc\\(100\\%-theme\\(space\\.2\\)-theme\\(space\\.2\\)\\)\\]{width:calc(100% - 1rem)}.w-full{width:100%}.max-w-\\[1295px\\]{max-width:1295px}.max-w-none{max-width:none}.max-w-sm{max-width:24rem}.flex-1{flex:1 1 0%}@keyframes spin{to{transform:rotate(1turn)}}.animate-spin{animation:spin 1s linear infinite}.cursor-not-allowed{cursor:not-allowed}.flex-col{flex-direction:column}.\\!flex-nowrap{flex-wrap:nowrap!important}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-2{gap:.5rem}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(.5rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(.5rem*var(--tw-space-x-reverse))}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(1rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(1rem*var(--tw-space-x-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(.75rem*var(--tw-space-y-reverse));margin-top:calc(.75rem*(1 - var(--tw-space-y-reverse)))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1.5rem*var(--tw-space-y-reverse));margin-top:calc(1.5rem*(1 - var(--tw-space-y-reverse)))}.overflow-hidden{overflow:hidden}.rounded-2xl{border-radius:1.25rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.625rem}.rounded-md{border-radius:.375rem}.rounded-r-lg{border-bottom-right-radius:.625rem;border-top-right-radius:.625rem}.border{border-width:1px}.border-b{border-bottom-width:1px}.border-gray-100{--tw-border-opacity:1;border-color:rgb(248 249 251/var(--tw-border-opacity))}.border-gray-200{--tw-border-opacity:1;border-color:rgb(191 188 215/var(--tw-border-opacity))}.border-gray-300{--tw-border-opacity:1;border-color:rgb(136 134 159/var(--tw-border-opacity))}.border-gray-500{--tw-border-opacity:1;border-color:rgb(59 57 70/var(--tw-border-opacity))}.border-red{--tw-border-opacity:1;border-color:rgb(252 90 90/var(--tw-border-opacity))}.bg-gray-100{--tw-bg-opacity:1;background-color:rgb(248 249 251/var(--tw-bg-opacity))}.bg-primary{background-color:var(--primary-color)}.bg-primaryHover{background-color:var(--primary-hover)}.bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.bg-cover{background-size:cover}.bg-center{background-position:50%}.p-4{padding:1rem}.px-0{padding-left:0;padding-right:0}.px-10{padding-left:2.5rem;padding-right:2.5rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-1{padding-bottom:.25rem;padding-top:.25rem}.py-10{padding-bottom:2.5rem;padding-top:2.5rem}.py-2{padding-bottom:.5rem;padding-top:.5rem}.py-3{padding-bottom:.75rem;padding-top:.75rem}.py-5{padding-bottom:1.25rem;padding-top:1.25rem}.pb-2{padding-bottom:.5rem}.pb-8{padding-bottom:2rem}.pt-2{padding-top:.5rem}.pt-2\\.5{padding-top:.625rem}.pt-4{padding-top:1rem}.text-left{text-align:left}.text-center{text-align:center}.indent-\\[5px\\]{text-indent:5px}.align-middle{vertical-align:middle}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.\\!text-base{font-size:1rem!important;line-height:120%!important}.text-2xl{font-size:1.5rem;line-height:120%}.text-3xl{font-size:2rem;line-height:120%}.text-base{font-size:1rem;line-height:120%}.text-lg{font-size:1.125rem;line-height:120%}.text-sm{font-size:.875rem;line-height:120%}.text-xl{font-size:1.25rem;line-height:120%}.text-xs{font-size:.75rem;line-height:135%}.font-medium{font-weight:500}.font-semibold{font-weight:600}.capitalize{text-transform:capitalize}.leading-\\[0\\]{line-height:0}.leading-tight{line-height:1.25}.text-\\[\\#1196F5\\]{--tw-text-opacity:1;color:rgb(17 150 245/var(--tw-text-opacity))}.text-\\[\\#B2B2B2\\]{--tw-text-opacity:1;color:rgb(178 178 178/var(--tw-text-opacity))}.text-black{--tw-text-opacity:1;color:rgb(0 0 0/var(--tw-text-opacity))}.text-gray-200{--tw-text-opacity:1;color:rgb(191 188 215/var(--tw-text-opacity))}.text-gray-300{--tw-text-opacity:1;color:rgb(136 134 159/var(--tw-text-opacity))}.text-gray-400{--tw-text-opacity:1;color:rgb(75 74 88/var(--tw-text-opacity))}.text-gray-500{--tw-text-opacity:1;color:rgb(59 57 70/var(--tw-text-opacity))}.text-gray-700{--tw-text-opacity:1;color:rgb(30 30 39/var(--tw-text-opacity))}.text-gray-900{--tw-text-opacity:1;color:rgb(8 8 14/var(--tw-text-opacity))}.text-primary{color:var(--primary-color)}.text-red{--tw-text-opacity:1;color:rgb(252 90 90/var(--tw-text-opacity))}.text-textOnPrimary{color:var(--text-on-primary)}.text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.placeholder-gray-400::-moz-placeholder{--tw-placeholder-opacity:1;color:rgb(75 74 88/var(--tw-placeholder-opacity))}.placeholder-gray-400::placeholder{--tw-placeholder-opacity:1;color:rgb(75 74 88/var(--tw-placeholder-opacity))}.accent-\\[\\#4F2D7F\\]{accent-color:#4f2d7f}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.row-up-left{align-content:flex-start;justify-content:flex-start}.row,.row-up-left{display:flex;flex-direction:row;flex-wrap:wrap}.row{align-content:center;align-items:center;justify-content:center}.column-left{align-items:flex-start}.column,.column-left{display:flex;flex-direction:column;justify-content:center}.column{align-items:center}@media (min-width:1280px){.text-5xl{font-size:5.125rem;letter-spacing:-.125rem;line-height:100%}.text-4xl{font-size:3.5rem}.text-3xl,.text-4xl{letter-spacing:-.0625rem;line-height:100%}.text-3xl{font-size:3rem}.text-2xl{font-size:2rem}.text-2xl,.text-xl{line-height:120%}.text-xl{font-size:1.5rem}.text-lg{font-size:1.25rem}.text-base,.text-lg{line-height:120%}.text-base{font-size:1.125rem}.text-sm{font-size:1rem}.text-sm,.text-xs{line-height:120%}.text-xs{font-size:.875rem}}:root{--primary-color:#7d68f4;--primary-hover:#9786f6;--text-on-primary:#fff}svg{transform:translate3d(var(--tw-translate-x),var(--tw-translate-y),0) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}*,:after,:before{text-underline-offset:4px}input[type=number],input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;-moz-appearance:textfield!important}.btn.is-loading{cursor:not-allowed;opacity:.4;pointer-events:none}.btn .btn-spinner,.btn.is-loading .btn-label{opacity:0;visibility:hidden}.btn.is-loading .btn-spinner{opacity:1;visibility:visible}[class*=" uicon-"],[class^=uicon-]{letter-spacing:0;line-height:100%}.placeholder\\:text-gray-300::-moz-placeholder{--tw-text-opacity:1;color:rgb(136 134 159/var(--tw-text-opacity))}.placeholder\\:text-gray-300::placeholder{--tw-text-opacity:1;color:rgb(136 134 159/var(--tw-text-opacity))}.hover\\:bg-black\\/5:hover{background-color:rgba(0,0,0,.05)}.hover\\:bg-gray-100:hover{--tw-bg-opacity:1;background-color:rgb(248 249 251/var(--tw-bg-opacity))}.hover\\:bg-primaryHover:hover{background-color:var(--primary-hover)}.hover\\:text-primaryHover:hover{color:var(--primary-hover)}.hover\\:underline:hover{text-decoration-line:underline}.focus\\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\\:ring:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color)}.focus\\:ring-1:focus,.focus\\:ring:focus{box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus\\:ring-1:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color)}.focus\\:ring-2:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus\\:ring-primary:focus{--tw-ring-color:var(--primary-color)}.focus\\:ring-offset-2:focus{--tw-ring-offset-width:2px}:is(.dark .dark\\:border-gray-400){--tw-border-opacity:1;border-color:rgb(75 74 88/var(--tw-border-opacity))}:is(.dark .dark\\:border-gray-500){--tw-border-opacity:1;border-color:rgb(59 57 70/var(--tw-border-opacity))}:is(.dark .dark\\:border-gray-600){--tw-border-opacity:1;border-color:rgb(40 40 52/var(--tw-border-opacity))}:is(.dark .dark\\:bg-black){--tw-bg-opacity:1;background-color:rgb(0 0 0/var(--tw-bg-opacity))}:is(.dark .dark\\:bg-gray-600){--tw-bg-opacity:1;background-color:rgb(40 40 52/var(--tw-bg-opacity))}:is(.dark .dark\\:bg-gray-800){--tw-bg-opacity:1;background-color:rgb(20 20 26/var(--tw-bg-opacity))}:is(.dark .dark\\:text-\\[\\#201a41\\]){--tw-text-opacity:1;color:rgb(32 26 65/var(--tw-text-opacity))}:is(.dark .dark\\:text-gray-300){--tw-text-opacity:1;color:rgb(136 134 159/var(--tw-text-opacity))}:is(.dark .dark\\:text-white){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}:is(.dark .dark\\:hover\\:bg-black\\/90:hover){background-color:rgba(0,0,0,.9)}:is(.dark .dark\\:focus\\:ring-offset-gray-900:focus){--tw-ring-offset-color:#08080e}@media (min-width:640px){.sm\\:absolute{position:absolute}.sm\\:left-4{left:1rem}.sm\\:top-1\\/2{top:50%}.sm\\:mt-4{margin-top:1rem}.sm\\:inline{display:inline}.sm\\:h-6{height:1.5rem}.sm\\:min-h-\\[700px\\]{min-height:700px}.sm\\:w-6{width:1.5rem}.sm\\:w-\\[calc\\(100\\%-theme\\(space\\.16\\)-theme\\(space\\.16\\)\\)\\]{width:calc(100% - 8rem)}.sm\\:w-auto{width:auto}.sm\\:max-w-md{max-width:28rem}.sm\\:-translate-y-1\\/2{--tw-translate-y:-50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.sm\\:flex-col{flex-direction:column}.sm\\:justify-normal{justify-content:normal}.sm\\:space-x-0>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(0px*(1 - var(--tw-space-x-reverse)));margin-right:calc(0px*var(--tw-space-x-reverse))}.sm\\:space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1rem*var(--tw-space-y-reverse));margin-top:calc(1rem*(1 - var(--tw-space-y-reverse)))}.sm\\:bg-fixed{background-attachment:fixed}.sm\\:bg-left-top{background-position:0 0}.sm\\:px-10{padding-left:2.5rem;padding-right:2.5rem}.sm\\:px-14{padding-left:3.5rem;padding-right:3.5rem}.sm\\:py-14{padding-bottom:3.5rem;padding-top:3.5rem}.sm\\:py-4{padding-bottom:1rem;padding-top:1rem}.sm\\:pt-16{padding-top:4rem}.sm\\:text-2xl{font-size:1.5rem;line-height:120%}.sm\\:text-base{font-size:1rem;line-height:120%}}@media (min-width:1280px){.md\\:min-w-\\[448px\\]{min-width:448px}.md\\:text-3xl{font-size:2rem;line-height:120%}.md\\:text-base{font-size:1rem;line-height:120%}.md\\:text-sm{font-size:.875rem;line-height:120%}.md\\:text-xs{font-size:.75rem;line-height:135%}}@media (max-height:900px) and (min-width:640px){.short\\:static{position:static}.short\\:left-auto{left:auto}.short\\:top-auto{top:auto}.short\\:hidden{display:none}.short\\:h-5{height:1.25rem}.short\\:min-h-\\[558px\\]{min-height:558px}.short\\:w-5{width:1.25rem}.short\\:translate-y-0{--tw-translate-y:0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.short\\:flex-row{flex-direction:row}.short\\:space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(1rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(1rem*var(--tw-space-x-reverse))}.short\\:space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(0px*var(--tw-space-y-reverse));margin-top:calc(0px*(1 - var(--tw-space-y-reverse)))}.short\\:px-0{padding-left:0;padding-right:0}.short\\:py-3{padding-bottom:.75rem;padding-top:.75rem}.short\\:text-xl{font-size:1.25rem;line-height:120%}}.\\[\\&\\>\\*\\:last-child\\]\\:mb-0>:last-child{margin-bottom:0}.\\[\\&_h1\\]\\:mb-6 h1,.\\[\\&_h2\\]\\:mb-6 h2{margin-bottom:1.5rem}`;function U8(){if(typeof document<"u"){const t=document.createElement("style");t.innerHTML=jf,t.setAttribute("data-authhero-tailwind",""),document.head.appendChild(t)}}const M8=t=>y("div",{className:"rich-text mb-6 prose prose-gray max-w-none [&>*:last-child]:mb-0 [&_h1]:mb-6 [&_h2]:mb-6",dangerouslySetInnerHTML:{__html:t.config.content}},t.id),q8=t=>y("div",{className:"flex items-center gap-2",children:[y("input",{type:"checkbox",name:t.id,required:!!t.required,className:"w-5 h-5 accent-[#4F2D7F] align-middle",id:t.id}),y("span",{className:"text-base leading-tight",children:y("span",{dangerouslySetInnerHTML:{__html:t.config.text}})})]},t.id),V8=t=>{var e;return y("div",{className:"mb-4",children:y("input",{type:"text",name:t.id,placeholder:((e=t.config)==null?void 0:e.placeholder)||"",required:!!t.required,className:"w-full rounded-lg border bg-gray-100 px-4 py-5 text-base placeholder:text-gray-300 dark:bg-gray-600 border-gray-100 dark:border-gray-500",id:t.id})},t.id)};function H8(t){switch(t.type){case"RICH_TEXT":return M8(t);case"LEGAL":return q8(t);case"TEXT":return V8(t);default:return null}}const du=({theme:t,branding:e,client:n,formName:r,error:i,components:o})=>{const a=o==null?void 0:o.find(d=>d.type==="LEGAL"&&d.required),l=a==null?void 0:a.id,u=o==null?void 0:o.find(d=>d.type==="NEXT_BUTTON");return y(rt,{title:r,theme:t,branding:e,client:n,children:[i&&y("div",{className:"mb-4 text-red-500",children:i}),y("div",{className:"flex flex-1 flex-col justify-center",children:y("form",{className:"pt-2",method:"post",children:[l&&y("style",{dangerouslySetInnerHTML:{__html:`
257
+ /*! tailwindcss v3.4.1 | MIT License | https://tailwindcss.com*/*,:after,:before{border:0 solid #bfbcd7;box-sizing:border-box}:after,:before{--tw-content:""}:host,html{line-height:1.5;-webkit-text-size-adjust:100%;font-family:KHTeka,Helvetica Neue,HelveticaNeue,TeX Gyre Heros,TeXGyreHeros,FreeSans,Nimbus Sans L,Liberation Sans,Arimo,Helvetica,sans-serif;font-feature-settings:normal;font-variation-settings:normal;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-tap-highlight-color:transparent}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-size:1em;font-variation-settings:normal}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{color:inherit;font-family:inherit;font-feature-settings:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{color:#4b4a58;opacity:1}input::placeholder,textarea::placeholder{color:#4b4a58;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]{display:none}body,html{height:100%}body{--tw-bg-opacity:1;background-color:rgb(248 249 251/var(--tw-bg-opacity));font-size:1rem;letter-spacing:.0125rem;line-height:120%;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}@media (min-width:1280px){body{font-size:1.125rem;line-height:120%}}:is(.dark body){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}button,input,optgroup,select,textarea{font-size:.875rem;letter-spacing:.0125rem;line-height:120%}@media (min-width:1280px){button,input,optgroup,select,textarea{font-size:1rem;line-height:120%}}h1{font-size:1.5rem;font-weight:500;line-height:120%}@media (min-width:1280px){h1{font-size:2rem;line-height:120%}}@media (min-width:640px){h1{font-size:3rem;letter-spacing:-.0625rem;line-height:100%}}@media (min-width:1280px){h1{font-size:3.5rem;letter-spacing:-.0625rem;line-height:100%}}h2{font-size:1.25rem;font-weight:500;line-height:120%}@media (min-width:1280px){h2{font-size:1.5rem;line-height:120%}}@media (min-width:640px){h2{font-size:2rem;letter-spacing:0;line-height:120%}}@media (min-width:1280px){h2{font-size:3rem;letter-spacing:-.0625rem;line-height:100%}}h3{font-size:1.125rem;font-weight:500;line-height:120%}@media (min-width:1280px){h3{font-size:1.25rem;line-height:120%}}@media (min-width:640px){h3{font-size:1.5rem;line-height:120%}}@media (min-width:1280px){h3{font-size:2rem;line-height:120%}}h4{font-size:1rem;font-weight:500;line-height:120%}@media (min-width:1280px){h4{font-size:1.125rem;line-height:120%}}@media (min-width:640px){h4{font-size:1.125rem;line-height:120%}}@media (min-width:1280px){h4{font-size:1.5rem;line-height:120%}}h5{font-size:.875rem;font-weight:500;line-height:120%}@media (min-width:1280px){h5{font-size:1rem;line-height:120%}}@media (min-width:640px){h5{font-size:1rem;line-height:120%}}@media (min-width:1280px){h5{font-size:1.125rem;line-height:120%}}h6{font-size:.75rem;font-weight:500;line-height:135%}@media (min-width:1280px){h6{font-size:.875rem;line-height:120%}}@media (min-width:640px){h6{font-size:.875rem;line-height:120%}}@media (min-width:1280px){h6{font-size:1rem;line-height:120%}}*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.container{width:100%}@media (min-width:640px){.container{max-width:640px}}@media (min-width:1280px){.container{max-width:1280px}}@media (min-width:1920px){.container{max-width:1920px}}.pointer-events-none{pointer-events:none}.absolute{position:absolute}.relative{position:relative}.inset-0{inset:0}.left-0{left:0}.right-0{right:0}.top-0{top:0}.top-1\\/2{top:50%}.mx-auto{margin-left:auto;margin-right:auto}.my-4{margin-bottom:1rem;margin-top:1rem}.mb-12{margin-bottom:3rem}.mb-16{margin-bottom:4rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-5{margin-bottom:1.25rem}.mb-6{margin-bottom:1.5rem}.mb-7{margin-bottom:1.75rem}.mb-8{margin-bottom:2rem}.mt-1{margin-top:.25rem}.mt-8{margin-top:2rem}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.\\!hidden{display:none!important}.hidden{display:none}.h-5{height:1.25rem}.h-9{height:2.25rem}.h-full{height:100%}.max-h-full{max-height:100%}.min-h-\\[calc\\(100vh-83px\\)\\]{min-height:calc(100vh - 83px)}.min-h-full{min-height:100%}.w-10{width:2.5rem}.w-5{width:1.25rem}.w-\\[calc\\(100\\%-theme\\(space\\.2\\)-theme\\(space\\.2\\)\\)\\]{width:calc(100% - 1rem)}.w-full{width:100%}.max-w-\\[1295px\\]{max-width:1295px}.max-w-none{max-width:none}.max-w-sm{max-width:24rem}.flex-1{flex:1 1 0%}@keyframes spin{to{transform:rotate(1turn)}}.animate-spin{animation:spin 1s linear infinite}.cursor-not-allowed{cursor:not-allowed}.flex-col{flex-direction:column}.\\!flex-nowrap{flex-wrap:nowrap!important}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-2{gap:.5rem}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(.5rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(.5rem*var(--tw-space-x-reverse))}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(1rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(1rem*var(--tw-space-x-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(.75rem*var(--tw-space-y-reverse));margin-top:calc(.75rem*(1 - var(--tw-space-y-reverse)))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1.5rem*var(--tw-space-y-reverse));margin-top:calc(1.5rem*(1 - var(--tw-space-y-reverse)))}.overflow-hidden{overflow:hidden}.rounded-2xl{border-radius:1.25rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.625rem}.rounded-md{border-radius:.375rem}.rounded-r-lg{border-bottom-right-radius:.625rem;border-top-right-radius:.625rem}.border{border-width:1px}.border-b{border-bottom-width:1px}.border-gray-100{--tw-border-opacity:1;border-color:rgb(248 249 251/var(--tw-border-opacity))}.border-gray-200{--tw-border-opacity:1;border-color:rgb(191 188 215/var(--tw-border-opacity))}.border-gray-300{--tw-border-opacity:1;border-color:rgb(136 134 159/var(--tw-border-opacity))}.border-gray-500{--tw-border-opacity:1;border-color:rgb(59 57 70/var(--tw-border-opacity))}.border-red{--tw-border-opacity:1;border-color:rgb(252 90 90/var(--tw-border-opacity))}.bg-gray-100{--tw-bg-opacity:1;background-color:rgb(248 249 251/var(--tw-bg-opacity))}.bg-primary{background-color:var(--primary-color)}.bg-primaryHover{background-color:var(--primary-hover)}.bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.bg-cover{background-size:cover}.bg-center{background-position:50%}.p-4{padding:1rem}.px-0{padding-left:0;padding-right:0}.px-10{padding-left:2.5rem;padding-right:2.5rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-1{padding-bottom:.25rem;padding-top:.25rem}.py-10{padding-bottom:2.5rem;padding-top:2.5rem}.py-2{padding-bottom:.5rem;padding-top:.5rem}.py-3{padding-bottom:.75rem;padding-top:.75rem}.py-5{padding-bottom:1.25rem;padding-top:1.25rem}.pb-2{padding-bottom:.5rem}.pb-8{padding-bottom:2rem}.pt-2{padding-top:.5rem}.pt-2\\.5{padding-top:.625rem}.pt-4{padding-top:1rem}.text-left{text-align:left}.text-center{text-align:center}.indent-\\[5px\\]{text-indent:5px}.align-middle{vertical-align:middle}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.\\!text-base{font-size:1rem!important;line-height:120%!important}.text-2xl{font-size:1.5rem;line-height:120%}.text-3xl{font-size:2rem;line-height:120%}.text-base{font-size:1rem;line-height:120%}.text-lg{font-size:1.125rem;line-height:120%}.text-sm{font-size:.875rem;line-height:120%}.text-xl{font-size:1.25rem;line-height:120%}.text-xs{font-size:.75rem;line-height:135%}.font-medium{font-weight:500}.font-semibold{font-weight:600}.capitalize{text-transform:capitalize}.leading-\\[0\\]{line-height:0}.leading-tight{line-height:1.25}.text-\\[\\#1196F5\\]{--tw-text-opacity:1;color:rgb(17 150 245/var(--tw-text-opacity))}.text-\\[\\#B2B2B2\\]{--tw-text-opacity:1;color:rgb(178 178 178/var(--tw-text-opacity))}.text-black{--tw-text-opacity:1;color:rgb(0 0 0/var(--tw-text-opacity))}.text-gray-200{--tw-text-opacity:1;color:rgb(191 188 215/var(--tw-text-opacity))}.text-gray-300{--tw-text-opacity:1;color:rgb(136 134 159/var(--tw-text-opacity))}.text-gray-400{--tw-text-opacity:1;color:rgb(75 74 88/var(--tw-text-opacity))}.text-gray-500{--tw-text-opacity:1;color:rgb(59 57 70/var(--tw-text-opacity))}.text-gray-700{--tw-text-opacity:1;color:rgb(30 30 39/var(--tw-text-opacity))}.text-gray-900{--tw-text-opacity:1;color:rgb(8 8 14/var(--tw-text-opacity))}.text-primary{color:var(--primary-color)}.text-red{--tw-text-opacity:1;color:rgb(252 90 90/var(--tw-text-opacity))}.text-textOnPrimary{color:var(--text-on-primary)}.text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.placeholder-gray-400::-moz-placeholder{--tw-placeholder-opacity:1;color:rgb(75 74 88/var(--tw-placeholder-opacity))}.placeholder-gray-400::placeholder{--tw-placeholder-opacity:1;color:rgb(75 74 88/var(--tw-placeholder-opacity))}.accent-\\[\\#4F2D7F\\]{accent-color:#4f2d7f}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.row-up-left{align-content:flex-start;justify-content:flex-start}.row,.row-up-left{display:flex;flex-direction:row;flex-wrap:wrap}.row{align-content:center;align-items:center;justify-content:center}.column-left{align-items:flex-start}.column,.column-left{display:flex;flex-direction:column;justify-content:center}.column{align-items:center}@media (min-width:1280px){.text-5xl{font-size:5.125rem;letter-spacing:-.125rem;line-height:100%}.text-4xl{font-size:3.5rem}.text-3xl,.text-4xl{letter-spacing:-.0625rem;line-height:100%}.text-3xl{font-size:3rem}.text-2xl{font-size:2rem}.text-2xl,.text-xl{line-height:120%}.text-xl{font-size:1.5rem}.text-lg{font-size:1.25rem}.text-base,.text-lg{line-height:120%}.text-base{font-size:1.125rem}.text-sm{font-size:1rem}.text-sm,.text-xs{line-height:120%}.text-xs{font-size:.875rem}}:root{--primary-color:#7d68f4;--primary-hover:#9786f6;--text-on-primary:#fff}svg{transform:translate3d(var(--tw-translate-x),var(--tw-translate-y),0) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}*,:after,:before{text-underline-offset:4px}input[type=number],input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;-moz-appearance:textfield!important}.btn.is-loading{cursor:not-allowed;opacity:.4;pointer-events:none}.btn .btn-spinner,.btn.is-loading .btn-label{opacity:0;visibility:hidden}.btn.is-loading .btn-spinner{opacity:1;visibility:visible}[class*=" uicon-"],[class^=uicon-]{letter-spacing:0;line-height:100%}.placeholder\\:text-gray-300::-moz-placeholder{--tw-text-opacity:1;color:rgb(136 134 159/var(--tw-text-opacity))}.placeholder\\:text-gray-300::placeholder{--tw-text-opacity:1;color:rgb(136 134 159/var(--tw-text-opacity))}.hover\\:bg-black\\/5:hover{background-color:rgba(0,0,0,.05)}.hover\\:bg-gray-100:hover{--tw-bg-opacity:1;background-color:rgb(248 249 251/var(--tw-bg-opacity))}.hover\\:bg-primaryHover:hover{background-color:var(--primary-hover)}.hover\\:text-primaryHover:hover{color:var(--primary-hover)}.hover\\:underline:hover{text-decoration-line:underline}.focus\\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\\:ring:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color)}.focus\\:ring-1:focus,.focus\\:ring:focus{box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus\\:ring-1:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color)}.focus\\:ring-2:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus\\:ring-primary:focus{--tw-ring-color:var(--primary-color)}.focus\\:ring-offset-2:focus{--tw-ring-offset-width:2px}:is(.dark .dark\\:border-gray-400){--tw-border-opacity:1;border-color:rgb(75 74 88/var(--tw-border-opacity))}:is(.dark .dark\\:border-gray-500){--tw-border-opacity:1;border-color:rgb(59 57 70/var(--tw-border-opacity))}:is(.dark .dark\\:border-gray-600){--tw-border-opacity:1;border-color:rgb(40 40 52/var(--tw-border-opacity))}:is(.dark .dark\\:bg-black){--tw-bg-opacity:1;background-color:rgb(0 0 0/var(--tw-bg-opacity))}:is(.dark .dark\\:bg-gray-600){--tw-bg-opacity:1;background-color:rgb(40 40 52/var(--tw-bg-opacity))}:is(.dark .dark\\:bg-gray-800){--tw-bg-opacity:1;background-color:rgb(20 20 26/var(--tw-bg-opacity))}:is(.dark .dark\\:text-\\[\\#201a41\\]){--tw-text-opacity:1;color:rgb(32 26 65/var(--tw-text-opacity))}:is(.dark .dark\\:text-gray-300){--tw-text-opacity:1;color:rgb(136 134 159/var(--tw-text-opacity))}:is(.dark .dark\\:text-white){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}:is(.dark .dark\\:hover\\:bg-black\\/90:hover){background-color:rgba(0,0,0,.9)}:is(.dark .dark\\:focus\\:ring-offset-gray-900:focus){--tw-ring-offset-color:#08080e}@media (min-width:640px){.sm\\:absolute{position:absolute}.sm\\:left-4{left:1rem}.sm\\:top-1\\/2{top:50%}.sm\\:mt-4{margin-top:1rem}.sm\\:inline{display:inline}.sm\\:h-6{height:1.5rem}.sm\\:min-h-\\[700px\\]{min-height:700px}.sm\\:w-6{width:1.5rem}.sm\\:w-\\[calc\\(100\\%-theme\\(space\\.16\\)-theme\\(space\\.16\\)\\)\\]{width:calc(100% - 8rem)}.sm\\:w-auto{width:auto}.sm\\:max-w-md{max-width:28rem}.sm\\:-translate-y-1\\/2{--tw-translate-y:-50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.sm\\:flex-col{flex-direction:column}.sm\\:justify-normal{justify-content:normal}.sm\\:space-x-0>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(0px*(1 - var(--tw-space-x-reverse)));margin-right:calc(0px*var(--tw-space-x-reverse))}.sm\\:space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1rem*var(--tw-space-y-reverse));margin-top:calc(1rem*(1 - var(--tw-space-y-reverse)))}.sm\\:bg-fixed{background-attachment:fixed}.sm\\:bg-left-top{background-position:0 0}.sm\\:px-10{padding-left:2.5rem;padding-right:2.5rem}.sm\\:px-14{padding-left:3.5rem;padding-right:3.5rem}.sm\\:py-14{padding-bottom:3.5rem;padding-top:3.5rem}.sm\\:py-4{padding-bottom:1rem;padding-top:1rem}.sm\\:pt-16{padding-top:4rem}.sm\\:text-2xl{font-size:1.5rem;line-height:120%}.sm\\:text-base{font-size:1rem;line-height:120%}}@media (min-width:1280px){.md\\:min-w-\\[448px\\]{min-width:448px}.md\\:text-3xl{font-size:2rem;line-height:120%}.md\\:text-base{font-size:1rem;line-height:120%}.md\\:text-sm{font-size:.875rem;line-height:120%}.md\\:text-xs{font-size:.75rem;line-height:135%}}@media (max-height:900px) and (min-width:640px){.short\\:static{position:static}.short\\:left-auto{left:auto}.short\\:top-auto{top:auto}.short\\:hidden{display:none}.short\\:h-5{height:1.25rem}.short\\:min-h-\\[558px\\]{min-height:558px}.short\\:w-5{width:1.25rem}.short\\:translate-y-0{--tw-translate-y:0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.short\\:flex-row{flex-direction:row}.short\\:space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(1rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(1rem*var(--tw-space-x-reverse))}.short\\:space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(0px*var(--tw-space-y-reverse));margin-top:calc(0px*(1 - var(--tw-space-y-reverse)))}.short\\:px-0{padding-left:0;padding-right:0}.short\\:py-3{padding-bottom:.75rem;padding-top:.75rem}.short\\:text-xl{font-size:1.25rem;line-height:120%}}.\\[\\&\\>\\*\\:last-child\\]\\:mb-0>:last-child{margin-bottom:0}.\\[\\&_h1\\]\\:mb-6 h1,.\\[\\&_h2\\]\\:mb-6 h2{margin-bottom:1.5rem}`;function U8(){if(typeof document<"u"){const t=document.createElement("style");t.innerHTML=jf,t.setAttribute("data-authhero-tailwind",""),document.head.appendChild(t)}}const M8=t=>y("div",{className:"rich-text mb-6 prose prose-gray max-w-none [&>*:last-child]:mb-0 [&_h1]:mb-6 [&_h2]:mb-6",dangerouslySetInnerHTML:{__html:t.config.content}},t.id),q8=t=>y("div",{className:"flex items-center gap-2",children:[y("input",{type:"checkbox",name:t.id,required:!!t.required,className:"w-5 h-5 accent-[#4F2D7F] align-middle",id:t.id}),y("span",{className:"text-base leading-tight",children:y("span",{dangerouslySetInnerHTML:{__html:t.config.text}})})]},t.id),V8=t=>{var e;return y("div",{className:"mb-4",children:y("input",{type:"text",name:t.id,placeholder:((e=t.config)==null?void 0:e.placeholder)||"",required:!!t.required,className:"w-full rounded-lg border bg-gray-100 px-4 py-5 text-base placeholder:text-gray-300 dark:bg-gray-600 border-gray-100 dark:border-gray-500",id:t.id})},t.id)};function H8(t){switch(t.type){case"RICH_TEXT":return M8(t);case"LEGAL":return q8(t);case"TEXT":return V8(t);default:return null}}const du=({theme:t,branding:e,client:n,formName:r,error:i,components:o})=>{const a=o==null?void 0:o.find(d=>d.type==="LEGAL"&&d.required),l=a==null?void 0:a.id,u=o==null?void 0:o.find(d=>d.type==="NEXT_BUTTON");return y(nt,{title:r,theme:t,branding:e,client:n,children:[i&&y("div",{className:"mb-4 text-red-500",children:i}),y("div",{className:"flex flex-1 flex-col justify-center",children:y("form",{className:"pt-2",method:"post",children:[l&&y("style",{dangerouslySetInnerHTML:{__html:`
258
258
  #_legalWrapper:has(#${l}:checked) #continueBtn {
259
259
  display: block;
260
260
  }
@@ -267,8 +267,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
267
267
  #_legalWrapper:not(:has(#${l}:checked)) #continueBtnDisabled {
268
268
  display: block;
269
269
  }
270
- `}}),y("div",{id:"_legalWrapper",children:[o&&o.map(d=>{if(d.type==="NEXT_BUTTON")return null;const p=H8(d);return p?y("div",{className:d.type==="RICH_TEXT"?"mb-6":"mb-4",children:p},d.id):null}),u&&y("div",{className:"mb-4",children:l?y(Rf,{children:[y(nt,{id:"continueBtn",className:"sm:mt-4 !text-base w-full",children:[y("span",{children:u.config.text||"Continue"}),y(tt,{className:"text-xs",name:"arrow-right"})]}),y(nt,{id:"continueBtnDisabled",className:"sm:mt-4 !text-base w-full opacity-50 cursor-not-allowed",disabled:!0,children:[y("span",{children:u.config.text||"Continue"}),y(tt,{className:"text-xs",name:"arrow-right"})]})]}):y(nt,{className:"sm:mt-4 !text-base w-full",children:[y("span",{children:u.config.text||"Continue"}),y(tt,{className:"text-xs",name:"arrow-right"})]})})]})]})})]})},K8=new s.OpenAPIHono().openapi(s.createRoute({tags:["forms"],method:"get",path:"/:formId/nodes/:nodeId",request:{params:s.z.object({formId:s.z.string(),nodeId:s.z.string()}),query:s.z.object({state:s.z.string()})},responses:{200:{description:"Form node HTML"},404:{description:"Form or node not found"}}}),async t=>{const{formId:e,nodeId:n}=t.req.valid("param"),{state:r}=t.req.valid("query"),{client:i,theme:o,branding:a}=await Ue(t,r,!0),l=await t.env.data.forms.get(i.tenant.id,e);if(!l)throw new C(404,{message:"Form not found"});const u=(l.nodes||[]).find(d=>d.id===n&&d.type==="STEP");if(!u)throw new C(404,{message:"Node not found or not a STEP node"});return t.html(y(du,{theme:o,branding:a,client:i,state:r,formName:l.name,nodeAlias:u.alias||u.type,components:"components"in u.config?u.config.components:[]}))}).openapi(s.createRoute({tags:["forms"],method:"post",path:"/:formId/nodes/:nodeId",request:{params:s.z.object({formId:s.z.string(),nodeId:s.z.string()}),query:s.z.object({state:s.z.string()}),body:{content:{"application/x-www-form-urlencoded":{schema:s.z.record(s.z.string())}}}},responses:{200:{description:"Form node submitted"},404:{description:"Form or node not found"}}}),async t=>{const{formId:e,nodeId:n}=t.req.valid("param"),{state:r}=t.req.valid("query"),{theme:i,branding:o,client:a}=await Ue(t,r,!0);let l,u,d=[];try{if(l=await t.env.data.forms.get(a.tenant.id,e),!l)throw new C(404,{message:"Form not found"});if(u=(l.nodes||[]).find(O=>O.id===n&&O.type==="STEP"),!u)throw new C(404,{message:"Node not found or not a STEP node"});d="components"in u.config?u.config.components:[];const p=await t.req.parseBody(),h=[],g={};for(const O of d)if(O.type==="LEGAL"){const x=O.id,M=!!O.required,G=p[x];M&&(!G||G==="")?h.push(x):typeof G=="string"&&(g[x]=G)}if(h.length>0)return t.html(y(du,{theme:i,branding:o,client:a,state:r,formName:l.name,nodeAlias:u.alias||u.type,components:d,error:`Missing required fields: ${h.join(", ")}`}));const A=await t.env.data.loginSessions.get(a.tenant.id,r);if(!A||!A.session_id||!A.authParams)throw new Error("Session expired");const $=await t.env.data.sessions.get(a.tenant.id,A.session_id);if(!$||!$.user_id)throw new Error("Session expired");const N=await t.env.data.users.get(t.var.tenant_id,$.user_id);if(!N)throw new Error("Session expired");const D=await Sr(t,{authParams:A.authParams,client:a,user:N,loginSession:A});return D instanceof Response?D:t.json(D)}catch{return t.html(y(du,{theme:i,branding:o,client:a,state:r,formName:(l==null?void 0:l.name)||"",nodeAlias:(u==null?void 0:u.alias)||n||"",components:d||[],error:"Your session has expired. Please try again."}))}});function G8(t){const e=new s.OpenAPIHono,n=t.dataAdapter.cache||$s({defaultTtlSeconds:0,maxEntries:100,cleanupIntervalMs:0}),r=t.dataAdapter.cache?300:0;e.onError((o,a)=>o instanceof xs?a.redirect(o.location,o.status):o instanceof C?a.text(o.message||"Error",o.status):a.text("Unexpected error",500)),e.get("/css/tailwind.css",async o=>{const a=jf;return o.text(a,200,{"content-type":"text/css; charset=utf-8"})}),e.use(async(o,a)=>{const l=ns(o,t.dataAdapter),u=Sl(l,{defaultTtl:r,cacheEntities:["tenants","connections","clients","branding","themes","promptSettings","forms"],cache:n});return o.env.data=$l(o,u),a()}).use(El).use(Al);const i=e.route("/info",j8).route("/check-account",I8).route("/account",z8).route("/change-email",D8).route("/change-email-confirmation",R8).route("/login/identifier",ZE).route("/enter-code",$8).route("/enter-password",k8).route("/invalid-session",B8).route("/pre-signup",P8).route("/pre-signup-sent",F8).route("/reset-password",C8).route("/forgot-password",T8).route("/validate-email",L8).route("/signup",N8).route("/forms",K8);return i.doc("/u/spec",{openapi:"3.0.0",info:{version:"1.0.0",title:"Universal login"}}),i}const Wt=s.z.object({"#text":s.z.string()}),W8=s.z.object({"#text":s.z.string(),"@_xmlns:saml":s.z.string().optional()}),X8=s.z.object({"samlp:AuthnRequest":s.z.object({"saml:Issuer":W8,"@_xmlns:samlp":s.z.string(),"@_xmlns:saml":s.z.string().optional(),"@_ForceAuthn":s.z.string().transform(t=>t.toLowerCase()==="true").optional(),"@_ID":s.z.string(),"@_IssueInstant":s.z.string().datetime(),"@_Destination":s.z.string().url(),"@_AssertionConsumerServiceURL":s.z.string().url().optional(),"@_ProtocolBinding":s.z.string().optional(),"@_Version":s.z.string()})});s.z.array(s.z.object({":@":s.z.object({"@_xmlns":s.z.string(),"@_entityID":s.z.string()}),EntityDescriptor:s.z.array(s.z.object({":@":s.z.object({"@_protocolSupportEnumeration":s.z.string()}),IDPSSODescriptor:s.z.array(s.z.union([s.z.object({KeyDescriptor:s.z.array(s.z.object({KeyInfo:s.z.array(s.z.object({X509Data:s.z.array(s.z.object({X509Certificate:s.z.array(Wt)}))})),":@":s.z.object({"@_xmlns":s.z.string()})})),":@":s.z.object({"@_use":s.z.string()})}),s.z.object({SingleLogoutService:s.z.array(s.z.object({})),":@":s.z.object({"@_Binding":s.z.string(),"@_Location":s.z.string()})}),s.z.object({NameIDFormat:s.z.array(Wt)}),s.z.object({SingleSignOnService:s.z.array(s.z.object({})),":@":s.z.object({"@_Binding":s.z.string(),"@_Location":s.z.string()})}),s.z.object({Attribute:s.z.array(s.z.object({})),":@":s.z.object({"@_Name":s.z.string(),"@_NameFormat":s.z.string(),"@_FriendlyName":s.z.string(),"@_xmlns":s.z.string()})})]))}))}));const J8=s.z.object({"saml:AttributeValue":s.z.array(s.z.object({"#text":s.z.string()})),":@":s.z.object({"@_xmlns:xs":s.z.string().optional(),"@_xmlns:xsi":s.z.string(),"@_xsi:type":s.z.string(),"@_Name":s.z.string().optional(),"@_NameFormat":s.z.string().optional()})}),Y8=s.z.object({"ds:Transform":s.z.array(s.z.any()),":@":s.z.object({"@_Algorithm":s.z.string()})}),em=s.z.object({"ds:Signature":s.z.array(s.z.union([s.z.object({"ds:SignedInfo":s.z.array(s.z.union([s.z.object({"ds:CanonicalizationMethod":s.z.array(s.z.string()),":@":s.z.object({"@_Algorithm":s.z.string()})}),s.z.object({"ds:SignatureMethod":s.z.array(s.z.string()),":@":s.z.object({"@_Algorithm":s.z.string()})}),s.z.object({"ds:Reference":s.z.array(s.z.union([s.z.object({"ds:Transforms":s.z.array(Y8)}),s.z.object({"ds:DigestMethod":s.z.array(s.z.string()),":@":s.z.object({"@_Algorithm":s.z.string()})}),s.z.object({"ds:DigestValue":s.z.array(Wt)})]))})]))}),s.z.object({"ds:SignatureValue":s.z.array(Wt)}),s.z.object({"ds:KeyInfo":s.z.array(s.z.object({"ds:KeyValue":s.z.array(s.z.object({"ds:RSAKeyValue":s.z.array(s.z.union([s.z.object({"ds:Modulus":s.z.array(Wt)}),s.z.object({"ds:Exponent":s.z.array(Wt)})]))}))}))})])),":@":s.z.object({"@_xmlns:ds":s.z.string()})});s.z.array(s.z.object({"samlp:Response":s.z.array(s.z.union([s.z.object({"saml:Issuer":s.z.array(Wt)}),em,s.z.object({"samlp:Status":s.z.array(s.z.object({"samlp:StatusCode":s.z.array(Wt),":@":s.z.object({"@_Value":s.z.string()})}))}),s.z.object({"saml:Assertion":s.z.array(s.z.union([s.z.object({"saml:Issuer":s.z.array(Wt)}),em,s.z.object({"saml:Subject":s.z.array(s.z.union([s.z.object({"saml:NameID":s.z.array(Wt),":@":s.z.object({"@_Format":s.z.string()})}),s.z.object({"saml:SubjectConfirmation":s.z.array(s.z.object({"saml:SubjectConfirmationData":s.z.array(s.z.any()),":@":s.z.object({"@_InResponseTo":s.z.string(),"@_NotOnOrAfter":s.z.string(),"@_Recipient":s.z.string()})})),":@":s.z.object({"@_Method":s.z.string()})})]))}),s.z.object({"saml:Conditions":s.z.array(s.z.object({"saml:AudienceRestriction":s.z.array(s.z.object({"saml:Audience":s.z.array(Wt)}))})),":@":s.z.object({"@_NotBefore":s.z.string(),"@_NotOnOrAfter":s.z.string()})}),s.z.object({"saml:AuthnStatement":s.z.array(s.z.object({"saml:AuthnContext":s.z.array(s.z.object({"saml:AuthnContextClassRef":s.z.array(Wt)}))})),":@":s.z.object({"@_AuthnInstant":s.z.string(),"@_SessionIndex":s.z.string(),"@_SessionNotOnOrAfter":s.z.string()})}),s.z.object({"saml:AttributeStatement":s.z.array(s.z.object({"saml:Attribute":s.z.array(J8),":@":s.z.object({"@_FriendlyName":s.z.string().optional(),"@_Name":s.z.string(),"@_NameFormat":s.z.string()})}))})])),":@":s.z.object({"@_xmlns":s.z.string(),"@_ID":s.z.string(),"@_IssueInstant":s.z.string(),"@_Version":s.z.string()})})])),":@":s.z.object({"@_xmlns:samlp":s.z.string(),"@_xmlns:saml":s.z.string(),"@_Destination":s.z.string(),"@_ID":s.z.string(),"@_InResponseTo":s.z.string(),"@_IssueInstant":s.z.string(),"@_Version":s.z.string()})}));var Z8={},ri={},Cs={},Il={};(function(t){var e=t;(function(n){function r(c){var f=Array.prototype.slice,_=c.length,b=function(E,K){return function(){return K.apply(this,E.concat(f.call(arguments)))}},v=function(){var E=f.call(arguments);return E.length<_?b(E,v):c.apply(this,f.apply(arguments,[0,_]))};return v}var i=function(c,f){for(var _=0;_<f.length;_+=1)c(f[_],_,f)},o=function(c,f,_){var b=f;return i(function(v,E){b=c(b,v,E)},_),b},a=function(c,f){var _=new Array(f.length);return i(function(b,v){_[v]=c(b)},f),_},l=function(c,f){var _=[];return i(function(b,v){c(b,v)&&_.push(b)},f),_},u=function(c,f){for(var _=0;_<c.length;_+=1)if(c[_]===f)return!0;return!1};function d(c){return function(){return c}}function p(c){return c.toString()}var h=function(c,f){return f.join(c)},g=function(c,f,_){return c+_+f},A=Array.prototype.concat,$=32767;function N(c){for(var f=[],_=0;_<c.length;_+=$){var b=c.slice(_,_+$);f=A.apply(f,b)}return f}function D(c,f){for(var _=Object(c),b=1;b<arguments.length;b++){var v=arguments[b];if(v!=null)for(var E in v)Object.prototype.hasOwnProperty.call(v,E)&&(_[E]=v[E])}return _}var O={ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11};x.prototype=new Object,x.prototype.constructor=x,x.superclass=Object.prototype;function x(){this.init()}x.prototype.init=function(){this.reduceActions=[],this.reduceActions[3]=function(c){return new ue(c[0],c[2])},this.reduceActions[5]=function(c){return new Ce(c[0],c[2])},this.reduceActions[7]=function(c){return new P(c[0],c[2])},this.reduceActions[8]=function(c){return new L(c[0],c[2])},this.reduceActions[10]=function(c){return new R(c[0],c[2])},this.reduceActions[11]=function(c){return new k(c[0],c[2])},this.reduceActions[12]=function(c){return new S(c[0],c[2])},this.reduceActions[13]=function(c){return new j(c[0],c[2])},this.reduceActions[15]=function(c){return new V(c[0],c[2])},this.reduceActions[16]=function(c){return new de(c[0],c[2])},this.reduceActions[18]=function(c){return new re(c[0],c[2])},this.reduceActions[19]=function(c){return new ve(c[0],c[2])},this.reduceActions[20]=function(c){return new Se(c[0],c[2])},this.reduceActions[22]=function(c){return new W(c[1])},this.reduceActions[24]=function(c){return new Z(c[0],c[2])},this.reduceActions[25]=function(c){return new ye(void 0,void 0,c[0])},this.reduceActions[27]=function(c){return c[0].locationPath=c[2],c[0]},this.reduceActions[28]=function(c){return c[0].locationPath=c[2],c[0].locationPath.steps.unshift(new Q(Q.DESCENDANTORSELF,oe.nodeTest,[])),c[0]},this.reduceActions[29]=function(c){return new ye(c[0],[],void 0)},this.reduceActions[30]=function(c){return ae.instance_of(c[0],ye)?(c[0].filterPredicates==null&&(c[0].filterPredicates=[]),c[0].filterPredicates.push(c[1]),c[0]):new ye(c[0],[c[1]],void 0)},this.reduceActions[32]=function(c){return c[1]},this.reduceActions[33]=function(c){return new he(c[0])},this.reduceActions[34]=function(c){return new ge(c[0])},this.reduceActions[36]=function(c){return new Ot(c[0],[])},this.reduceActions[37]=function(c){return new Ot(c[0],c[2])},this.reduceActions[38]=function(c){return[c[0]]},this.reduceActions[39]=function(c){return c[2].unshift(c[0]),c[2]},this.reduceActions[43]=function(c){return new Qt(!0,[])},this.reduceActions[44]=function(c){return c[1].absolute=!0,c[1]},this.reduceActions[46]=function(c){return new Qt(!1,[c[0]])},this.reduceActions[47]=function(c){return c[0].steps.push(c[2]),c[0]},this.reduceActions[49]=function(c){return new Q(c[0],c[1],[])},this.reduceActions[50]=function(c){return new Q(Q.CHILD,c[0],[])},this.reduceActions[51]=function(c){return new Q(c[0],c[1],c[2])},this.reduceActions[52]=function(c){return new Q(Q.CHILD,c[0],c[1])},this.reduceActions[54]=function(c){return[c[0]]},this.reduceActions[55]=function(c){return c[1].unshift(c[0]),c[1]},this.reduceActions[56]=function(c){return c[0]=="ancestor"?Q.ANCESTOR:c[0]=="ancestor-or-self"?Q.ANCESTORORSELF:c[0]=="attribute"?Q.ATTRIBUTE:c[0]=="child"?Q.CHILD:c[0]=="descendant"?Q.DESCENDANT:c[0]=="descendant-or-self"?Q.DESCENDANTORSELF:c[0]=="following"?Q.FOLLOWING:c[0]=="following-sibling"?Q.FOLLOWINGSIBLING:c[0]=="namespace"?Q.NAMESPACE:c[0]=="parent"?Q.PARENT:c[0]=="preceding"?Q.PRECEDING:c[0]=="preceding-sibling"?Q.PRECEDINGSIBLING:c[0]=="self"?Q.SELF:-1},this.reduceActions[57]=function(c){return Q.ATTRIBUTE},this.reduceActions[59]=function(c){return c[0]=="comment"?oe.commentTest:c[0]=="text"?oe.textTest:c[0]=="processing-instruction"?oe.anyPiTest:c[0]=="node"?oe.nodeTest:new oe(-1,void 0)},this.reduceActions[60]=function(c){return new oe.PITest(c[2])},this.reduceActions[61]=function(c){return c[1]},this.reduceActions[63]=function(c){return c[1].absolute=!0,c[1].steps.unshift(new Q(Q.DESCENDANTORSELF,oe.nodeTest,[])),c[1]},this.reduceActions[64]=function(c){return c[0].steps.push(new Q(Q.DESCENDANTORSELF,oe.nodeTest,[])),c[0].steps.push(c[2]),c[0]},this.reduceActions[65]=function(c){return new Q(Q.SELF,oe.nodeTest,[])},this.reduceActions[66]=function(c){return new Q(Q.PARENT,oe.nodeTest,[])},this.reduceActions[67]=function(c){return new Qe(c[1])},this.reduceActions[68]=function(c){return oe.nameTestAny},this.reduceActions[69]=function(c){return new oe.NameTestPrefixAny(c[0].split(":")[0])},this.reduceActions[70]=function(c){return new oe.NameTestQName(c[0])}},x.actionTable=[" s s sssssssss s ss s ss"," s ","r rrrrrrrrr rrrrrrr rr r "," rrrrr "," s s sssssssss s ss s ss","rs rrrrrrrr s sssssrrrrrr rrs rs "," s s sssssssss s ss s ss"," s "," s ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr "," s "," s "," s s sssss s s ","r rrrrrrrrr rrrrrrr rr r ","a ","r s rr r ","r sr rr r ","r s rr s rr r ","r rssrr rss rr r ","r rrrrr rrrss rr r ","r rrrrrsss rrrrr rr r ","r rrrrrrrr rrrrr rr r ","r rrrrrrrr rrrrrs rr r ","r rrrrrrrr rrrrrr rr r ","r rrrrrrrr rrrrrr rr r ","r srrrrrrrr rrrrrrs rr sr ","r srrrrrrrr rrrrrrs rr r ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrr rrrrrr rr r ","r rrrrrrrr rrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r "," sssss ","r rrrrrrrrr rrrrrrr rr sr ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr "," s ","r srrrrrrrr rrrrrrs rr r ","r rrrrrrrr rrrrr rr r "," s "," s "," rrrrr "," s s sssssssss s sss s ss","r srrrrrrrr rrrrrrs rr r "," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss ss s ss"," s s sssssssss s ss s ss"," s s sssss s s "," s s sssss s s ","r rrrrrrrrr rrrrrrr rr rr "," s s sssss s s "," s s sssss s s ","r rrrrrrrrr rrrrrrr rr sr ","r rrrrrrrrr rrrrrrr rr sr ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr rr "," s ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr "," rr "," s "," rs ","r sr rr r ","r s rr s rr r ","r rssrr rss rr r ","r rssrr rss rr r ","r rrrrr rrrss rr r ","r rrrrr rrrss rr r ","r rrrrr rrrss rr r ","r rrrrr rrrss rr r ","r rrrrrsss rrrrr rr r ","r rrrrrsss rrrrr rr r ","r rrrrrrrr rrrrr rr r ","r rrrrrrrr rrrrr rr r ","r rrrrrrrr rrrrr rr r ","r rrrrrrrr rrrrrr rr r "," r "," s ","r srrrrrrrr rrrrrrs rr r ","r srrrrrrrr rrrrrrs rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr "," s s sssssssss s ss s ss","r rrrrrrrrr rrrrrrr rr rr "," r "],x.actionTableNumber=[` 1 0 /.-,+*)(' & %$ # "!`," J ","a aaaaaaaaa aaaaaaa aa a "," YYYYY ",` 1 0 /.-,+*)(' & %$ # "!`,`K1 KKKKKKKK . +*)('KKKKKK KK# K" `,` 1 0 /.-,+*)(' & %$ # "!`," N "," O ","e eeeeeeeee eeeeeee ee ee ","f fffffffff fffffff ff ff ","d ddddddddd ddddddd dd dd ","B BBBBBBBBB BBBBBBB BB BB ","A AAAAAAAAA AAAAAAA AA AA "," P "," Q ",` 1 . +*)(' # " `,"b bbbbbbbbb bbbbbbb bb b "," ","! S !! ! ",'" T" "" " ',"$ V $$ U $$ $ ","& &ZY&& &XW && & ",") ))))) )))\\[ )) ) ",". ....._^] ..... .. . ","1 11111111 11111 11 1 ","5 55555555 55555` 55 5 ","7 77777777 777777 77 7 ","9 99999999 999999 99 9 ",": c:::::::: ::::::b :: a: ","I fIIIIIIII IIIIIIe II I ","= ========= ======= == == ","? ????????? ??????? ?? ?? ","C CCCCCCCCC CCCCCCC CC CC ","J JJJJJJJJ JJJJJJ JJ J ","M MMMMMMMM MMMMMM MM M ","N NNNNNNNNN NNNNNNN NN N ","P PPPPPPPPP PPPPPPP PP P "," +*)(' ","R RRRRRRRRR RRRRRRR RR aR ","U UUUUUUUUU UUUUUUU UU U ","Z ZZZZZZZZZ ZZZZZZZ ZZ ZZ ","c ccccccccc ccccccc cc cc "," j ","L fLLLLLLLL LLLLLLe LL L ","6 66666666 66666 66 6 "," k "," l "," XXXXX ",` 1 0 /.-,+*)(' & %$m # "!`,"_ f________ ______e __ _ ",` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 . +*)(' # " `,` 1 . +*)(' # " `,"> >>>>>>>>> >>>>>>> >> >> ",` 1 . +*)(' # " `,` 1 . +*)(' # " `,"Q QQQQQQQQQ QQQQQQQ QQ aQ ","V VVVVVVVVV VVVVVVV VV aV ","T TTTTTTTTT TTTTTTT TT T ","@ @@@@@@@@@ @@@@@@@ @@ @@ "," ‡ ","[ [[[[[[[[[ [[[[[[[ [[ [[ ","D DDDDDDDDD DDDDDDD DD DD "," HH "," ˆ "," F‰ ","# T# ## # ","% V %% U %% % ","' 'ZY'' 'XW '' ' ","( (ZY(( (XW (( ( ","+ +++++ +++\\[ ++ + ","* ***** ***\\[ ** * ","- ----- ---\\[ -- - ",", ,,,,, ,,,\\[ ,, , ","0 00000_^] 00000 00 0 ","/ /////_^] ///// // / ","2 22222222 22222 22 2 ","3 33333333 33333 33 3 ","4 44444444 44444 44 4 ","8 88888888 888888 88 8 "," ^ "," Š ","; f;;;;;;;; ;;;;;;e ;; ; ","< f<<<<<<<< <<<<<<e << < ","O OOOOOOOOO OOOOOOO OO O ","` ````````` ``````` `` ` ","S SSSSSSSSS SSSSSSS SS S ","W WWWWWWWWW WWWWWWW WW W ","\\ \\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\ \\\\ \\\\ ","E EEEEEEEEE EEEEEEE EE EE ",` 1 0 /.-,+*)(' & %$ # "!`,"] ]]]]]]]]] ]]]]]]] ]] ]] "," G "],x.gotoTable=["3456789:;<=>?@ AB CDEFGH IJ "," "," "," ","L456789:;<=>?@ AB CDEFGH IJ "," M EFGH IJ "," N;<=>?@ AB CDEFGH IJ "," "," "," "," "," "," "," "," "," "," S EFGH IJ "," "," "," "," "," "," "," "," "," "," "," "," "," e "," "," "," "," "," "," "," "," "," h J "," i j "," "," "," "," "," "," "," "," "," ","o456789:;<=>?@ ABpqCDEFGH IJ "," "," r6789:;<=>?@ AB CDEFGH IJ "," s789:;<=>?@ AB CDEFGH IJ "," t89:;<=>?@ AB CDEFGH IJ "," u89:;<=>?@ AB CDEFGH IJ "," v9:;<=>?@ AB CDEFGH IJ "," w9:;<=>?@ AB CDEFGH IJ "," x9:;<=>?@ AB CDEFGH IJ "," y9:;<=>?@ AB CDEFGH IJ "," z:;<=>?@ AB CDEFGH IJ "," {:;<=>?@ AB CDEFGH IJ "," |;<=>?@ AB CDEFGH IJ "," };<=>?@ AB CDEFGH IJ "," ~;<=>?@ AB CDEFGH IJ "," =>?@ AB CDEFGH IJ ","€456789:;<=>?@ AB CDEFGH IJ"," ‚ EFGH IJ "," ƒ EFGH IJ "," "," „ GH IJ "," … GH IJ "," i † "," i ‡ "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","o456789:;<=>?@ ABŒqCDEFGH IJ "," "," "],x.productions=[[1,1,2],[2,1,3],[3,1,4],[3,3,3,-9,4],[4,1,5],[4,3,4,-8,5],[5,1,6],[5,3,5,-22,6],[5,3,5,-5,6],[6,1,7],[6,3,6,-23,7],[6,3,6,-24,7],[6,3,6,-6,7],[6,3,6,-7,7],[7,1,8],[7,3,7,-25,8],[7,3,7,-26,8],[8,1,9],[8,3,8,-12,9],[8,3,8,-11,9],[8,3,8,-10,9],[9,1,10],[9,2,-26,9],[10,1,11],[10,3,10,-27,11],[11,1,12],[11,1,13],[11,3,13,-28,14],[11,3,13,-4,14],[13,1,15],[13,2,13,16],[15,1,17],[15,3,-29,2,-30],[15,1,-15],[15,1,-16],[15,1,18],[18,3,-13,-29,-30],[18,4,-13,-29,19,-30],[19,1,20],[19,3,20,-31,19],[20,1,2],[12,1,14],[12,1,21],[21,1,-28],[21,2,-28,14],[21,1,22],[14,1,23],[14,3,14,-28,23],[14,1,24],[23,2,25,26],[23,1,26],[23,3,25,26,27],[23,2,26,27],[23,1,28],[27,1,16],[27,2,16,27],[25,2,-14,-3],[25,1,-32],[26,1,29],[26,3,-20,-29,-30],[26,4,-21,-29,-15,-30],[16,3,-33,30,-34],[30,1,2],[22,2,-4,14],[24,3,14,-4,23],[28,1,-35],[28,1,-2],[17,2,-36,-18],[29,1,-17],[29,1,-19],[29,1,-18]],x.DOUBLEDOT=2,x.DOUBLECOLON=3,x.DOUBLESLASH=4,x.NOTEQUAL=5,x.LESSTHANOREQUAL=6,x.GREATERTHANOREQUAL=7,x.AND=8,x.OR=9,x.MOD=10,x.DIV=11,x.MULTIPLYOPERATOR=12,x.FUNCTIONNAME=13,x.AXISNAME=14,x.LITERAL=15,x.NUMBER=16,x.ASTERISKNAMETEST=17,x.QNAME=18,x.NCNAMECOLONASTERISK=19,x.NODETYPE=20,x.PROCESSINGINSTRUCTIONWITHLITERAL=21,x.EQUALS=22,x.LESSTHAN=23,x.GREATERTHAN=24,x.PLUS=25,x.MINUS=26,x.BAR=27,x.SLASH=28,x.LEFTPARENTHESIS=29,x.RIGHTPARENTHESIS=30,x.COMMA=31,x.AT=32,x.LEFTBRACKET=33,x.RIGHTBRACKET=34,x.DOT=35,x.DOLLAR=36,x.prototype.tokenize=function(c){for(var f=[],_=[],b=c+"\0",v=0,E=b.charAt(v++);;){for(;E==" "||E==" "||E=="\r"||E==`
271
- `;)E=b.charAt(v++);if(E=="\0"||v>=b.length)break;if(E=="("){f.push(x.LEFTPARENTHESIS),_.push(E),E=b.charAt(v++);continue}if(E==")"){f.push(x.RIGHTPARENTHESIS),_.push(E),E=b.charAt(v++);continue}if(E=="["){f.push(x.LEFTBRACKET),_.push(E),E=b.charAt(v++);continue}if(E=="]"){f.push(x.RIGHTBRACKET),_.push(E),E=b.charAt(v++);continue}if(E=="@"){f.push(x.AT),_.push(E),E=b.charAt(v++);continue}if(E==","){f.push(x.COMMA),_.push(E),E=b.charAt(v++);continue}if(E=="|"){f.push(x.BAR),_.push(E),E=b.charAt(v++);continue}if(E=="+"){f.push(x.PLUS),_.push(E),E=b.charAt(v++);continue}if(E=="-"){f.push(x.MINUS),_.push(E),E=b.charAt(v++);continue}if(E=="="){f.push(x.EQUALS),_.push(E),E=b.charAt(v++);continue}if(E=="$"){f.push(x.DOLLAR),_.push(E),E=b.charAt(v++);continue}if(E=="."){if(E=b.charAt(v++),E=="."){f.push(x.DOUBLEDOT),_.push(".."),E=b.charAt(v++);continue}if(E>="0"&&E<="9"){var K="."+E;for(E=b.charAt(v++);E>="0"&&E<="9";)K+=E,E=b.charAt(v++);f.push(x.NUMBER),_.push(K);continue}f.push(x.DOT),_.push(".");continue}if(E=="'"||E=='"'){for(var _e=E,Ne="";v<b.length&&(E=b.charAt(v))!==_e;)Ne+=E,v+=1;if(E!==_e)throw Kt.fromMessage("Unterminated string literal: "+_e+Ne);v+=1,f.push(x.LITERAL),_.push(Ne),E=b.charAt(v++);continue}if(E>="0"&&E<="9"){var K=E;for(E=b.charAt(v++);E>="0"&&E<="9";)K+=E,E=b.charAt(v++);if(E=="."&&b.charAt(v)>="0"&&b.charAt(v)<="9")for(K+=E,K+=b.charAt(v++),E=b.charAt(v++);E>="0"&&E<="9";)K+=E,E=b.charAt(v++);f.push(x.NUMBER),_.push(K);continue}if(E=="*"){if(f.length>0){var ie=f[f.length-1];if(ie!=x.AT&&ie!=x.DOUBLECOLON&&ie!=x.LEFTPARENTHESIS&&ie!=x.LEFTBRACKET&&ie!=x.AND&&ie!=x.OR&&ie!=x.MOD&&ie!=x.DIV&&ie!=x.MULTIPLYOPERATOR&&ie!=x.SLASH&&ie!=x.DOUBLESLASH&&ie!=x.BAR&&ie!=x.PLUS&&ie!=x.MINUS&&ie!=x.EQUALS&&ie!=x.NOTEQUAL&&ie!=x.LESSTHAN&&ie!=x.LESSTHANOREQUAL&&ie!=x.GREATERTHAN&&ie!=x.GREATERTHANOREQUAL){f.push(x.MULTIPLYOPERATOR),_.push(E),E=b.charAt(v++);continue}}f.push(x.ASTERISKNAMETEST),_.push(E),E=b.charAt(v++);continue}if(E==":"&&b.charAt(v)==":"){f.push(x.DOUBLECOLON),_.push("::"),v++,E=b.charAt(v++);continue}if(E=="/"){if(E=b.charAt(v++),E=="/"){f.push(x.DOUBLESLASH),_.push("//"),E=b.charAt(v++);continue}f.push(x.SLASH),_.push("/");continue}if(E=="!"&&b.charAt(v)=="="){f.push(x.NOTEQUAL),_.push("!="),v++,E=b.charAt(v++);continue}if(E=="<"){if(b.charAt(v)=="="){f.push(x.LESSTHANOREQUAL),_.push("<="),v++,E=b.charAt(v++);continue}f.push(x.LESSTHAN),_.push("<"),E=b.charAt(v++);continue}if(E==">"){if(b.charAt(v)=="="){f.push(x.GREATERTHANOREQUAL),_.push(">="),v++,E=b.charAt(v++);continue}f.push(x.GREATERTHAN),_.push(">"),E=b.charAt(v++);continue}if(E=="_"||ae.isLetter(E.charCodeAt(0))){var Ae=E;for(E=b.charAt(v++);ae.isNCNameChar(E.charCodeAt(0));)Ae+=E,E=b.charAt(v++);if(f.length>0){var ie=f[f.length-1];if(ie!=x.AT&&ie!=x.DOUBLECOLON&&ie!=x.LEFTPARENTHESIS&&ie!=x.LEFTBRACKET&&ie!=x.AND&&ie!=x.OR&&ie!=x.MOD&&ie!=x.DIV&&ie!=x.MULTIPLYOPERATOR&&ie!=x.SLASH&&ie!=x.DOUBLESLASH&&ie!=x.BAR&&ie!=x.PLUS&&ie!=x.MINUS&&ie!=x.EQUALS&&ie!=x.NOTEQUAL&&ie!=x.LESSTHAN&&ie!=x.LESSTHANOREQUAL&&ie!=x.GREATERTHAN&&ie!=x.GREATERTHANOREQUAL){if(Ae=="and"){f.push(x.AND),_.push(Ae);continue}if(Ae=="or"){f.push(x.OR),_.push(Ae);continue}if(Ae=="mod"){f.push(x.MOD),_.push(Ae);continue}if(Ae=="div"){f.push(x.DIV),_.push(Ae);continue}}}if(E==":"){if(b.charAt(v)=="*"){f.push(x.NCNAMECOLONASTERISK),_.push(Ae+":*"),v++,E=b.charAt(v++);continue}if(b.charAt(v)=="_"||ae.isLetter(b.charCodeAt(v))){for(Ae+=":",E=b.charAt(v++);ae.isNCNameChar(E.charCodeAt(0));)Ae+=E,E=b.charAt(v++);if(E=="("){f.push(x.FUNCTIONNAME),_.push(Ae);continue}f.push(x.QNAME),_.push(Ae);continue}if(b.charAt(v)==":"){f.push(x.AXISNAME),_.push(Ae);continue}}if(E=="("){if(Ae=="comment"||Ae=="text"||Ae=="node"){f.push(x.NODETYPE),_.push(Ae);continue}if(Ae=="processing-instruction"){b.charAt(v)==")"?f.push(x.NODETYPE):f.push(x.PROCESSINGINSTRUCTIONWITHLITERAL),_.push(Ae);continue}f.push(x.FUNCTIONNAME),_.push(Ae);continue}f.push(x.QNAME),_.push(Ae);continue}throw new Error("Unexpected character "+E)}return f.push(1),_.push("[EOF]"),[f,_]},x.SHIFT="s",x.REDUCE="r",x.ACCEPT="a",x.prototype.parse=function(Ne){var f,_,b=this.tokenize(Ne);if(b!=null){f=b[0],_=b[1];var v=0,E=[],K=[],_e=[],Ne,ie,Ae;for(E.push(0),K.push(1),_e.push("_S"),ie=f[v],Ae=_[v++];;)switch(Ne=E[E.length-1],x.actionTable[Ne].charAt(ie-1)){case x.SHIFT:K.push(-ie),_e.push(Ae),E.push(x.actionTableNumber[Ne].charCodeAt(ie-1)-32),ie=f[v],Ae=_[v++];break;case x.REDUCE:for(var $t=x.productions[x.actionTableNumber[Ne].charCodeAt(ie-1)-32][1],je=[],ar=0;ar<$t;ar++)K.pop(),je.unshift(_e.pop()),E.pop();var cr=E[E.length-1];K.push(x.productions[x.actionTableNumber[Ne].charCodeAt(ie-1)-32][0]),this.reduceActions[x.actionTableNumber[Ne].charCodeAt(ie-1)-32]==null?_e.push(je[0]):_e.push(this.reduceActions[x.actionTableNumber[Ne].charCodeAt(ie-1)-32](je)),E.push(x.gotoTable[cr].charCodeAt(x.productions[x.actionTableNumber[Ne].charCodeAt(ie-1)-32][0]-2)-33);break;case x.ACCEPT:return new M(_e.pop());default:throw new Error("XPath parse error")}}},M.prototype=new Object,M.prototype.constructor=M,M.superclass=Object.prototype;function M(c){this.expression=c}M.prototype.toString=function(){return this.expression.toString()};function G(c,f,_){f in c||(c[f]=_)}M.prototype.evaluate=function(c){return c.contextNode=c.expressionContextNode,c.contextSize=1,c.contextPosition=1,c.isHtml&&(G(c,"caseInsensitive",!0),G(c,"allowAnyNamespaceForNoPrefix",!0)),G(c,"caseInsensitive",!1),this.expression.evaluate(c)},M.XML_NAMESPACE_URI="http://www.w3.org/XML/1998/namespace",M.XMLNS_NAMESPACE_URI="http://www.w3.org/2000/xmlns/",F.prototype=new Object,F.prototype.constructor=F,F.superclass=Object.prototype;function F(){}F.prototype.init=function(){},F.prototype.toString=function(){return"<Expression>"},F.prototype.evaluate=function(c){throw new Error("Could not evaluate expression.")},H.prototype=new F,H.prototype.constructor=H,H.superclass=F.prototype;function H(c){arguments.length>0&&this.init(c)}H.prototype.init=function(c){this.rhs=c},W.prototype=new H,W.prototype.constructor=W,W.superclass=H.prototype;function W(c){arguments.length>0&&this.init(c)}W.prototype.init=function(c){W.superclass.init.call(this,c)},W.prototype.evaluate=function(c){return this.rhs.evaluate(c).number().negate()},W.prototype.toString=function(){return"-"+this.rhs.toString()},Y.prototype=new F,Y.prototype.constructor=Y,Y.superclass=F.prototype;function Y(c,f){arguments.length>0&&this.init(c,f)}Y.prototype.init=function(c,f){this.lhs=c,this.rhs=f},ue.prototype=new Y,ue.prototype.constructor=ue,ue.superclass=Y.prototype;function ue(c,f){arguments.length>0&&this.init(c,f)}ue.prototype.init=function(c,f){ue.superclass.init.call(this,c,f)},ue.prototype.toString=function(){return"("+this.lhs.toString()+" or "+this.rhs.toString()+")"},ue.prototype.evaluate=function(c){var f=this.lhs.evaluate(c).bool();return f.booleanValue()?f:this.rhs.evaluate(c).bool()},Ce.prototype=new Y,Ce.prototype.constructor=Ce,Ce.superclass=Y.prototype;function Ce(c,f){arguments.length>0&&this.init(c,f)}Ce.prototype.init=function(c,f){Ce.superclass.init.call(this,c,f)},Ce.prototype.toString=function(){return"("+this.lhs.toString()+" and "+this.rhs.toString()+")"},Ce.prototype.evaluate=function(c){var f=this.lhs.evaluate(c).bool();return f.booleanValue()?this.rhs.evaluate(c).bool():f},P.prototype=new Y,P.prototype.constructor=P,P.superclass=Y.prototype;function P(c,f){arguments.length>0&&this.init(c,f)}P.prototype.init=function(c,f){P.superclass.init.call(this,c,f)},P.prototype.toString=function(){return"("+this.lhs.toString()+" = "+this.rhs.toString()+")"},P.prototype.evaluate=function(c){return this.lhs.evaluate(c).equals(this.rhs.evaluate(c))},L.prototype=new Y,L.prototype.constructor=L,L.superclass=Y.prototype;function L(c,f){arguments.length>0&&this.init(c,f)}L.prototype.init=function(c,f){L.superclass.init.call(this,c,f)},L.prototype.toString=function(){return"("+this.lhs.toString()+" != "+this.rhs.toString()+")"},L.prototype.evaluate=function(c){return this.lhs.evaluate(c).notequal(this.rhs.evaluate(c))},R.prototype=new Y,R.prototype.constructor=R,R.superclass=Y.prototype;function R(c,f){arguments.length>0&&this.init(c,f)}R.prototype.init=function(c,f){R.superclass.init.call(this,c,f)},R.prototype.evaluate=function(c){return this.lhs.evaluate(c).lessthan(this.rhs.evaluate(c))},R.prototype.toString=function(){return"("+this.lhs.toString()+" < "+this.rhs.toString()+")"},k.prototype=new Y,k.prototype.constructor=k,k.superclass=Y.prototype;function k(c,f){arguments.length>0&&this.init(c,f)}k.prototype.init=function(c,f){k.superclass.init.call(this,c,f)},k.prototype.evaluate=function(c){return this.lhs.evaluate(c).greaterthan(this.rhs.evaluate(c))},k.prototype.toString=function(){return"("+this.lhs.toString()+" > "+this.rhs.toString()+")"},S.prototype=new Y,S.prototype.constructor=S,S.superclass=Y.prototype;function S(c,f){arguments.length>0&&this.init(c,f)}S.prototype.init=function(c,f){S.superclass.init.call(this,c,f)},S.prototype.evaluate=function(c){return this.lhs.evaluate(c).lessthanorequal(this.rhs.evaluate(c))},S.prototype.toString=function(){return"("+this.lhs.toString()+" <= "+this.rhs.toString()+")"},j.prototype=new Y,j.prototype.constructor=j,j.superclass=Y.prototype;function j(c,f){arguments.length>0&&this.init(c,f)}j.prototype.init=function(c,f){j.superclass.init.call(this,c,f)},j.prototype.evaluate=function(c){return this.lhs.evaluate(c).greaterthanorequal(this.rhs.evaluate(c))},j.prototype.toString=function(){return"("+this.lhs.toString()+" >= "+this.rhs.toString()+")"},V.prototype=new Y,V.prototype.constructor=V,V.superclass=Y.prototype;function V(c,f){arguments.length>0&&this.init(c,f)}V.prototype.init=function(c,f){V.superclass.init.call(this,c,f)},V.prototype.evaluate=function(c){return this.lhs.evaluate(c).number().plus(this.rhs.evaluate(c).number())},V.prototype.toString=function(){return"("+this.lhs.toString()+" + "+this.rhs.toString()+")"},de.prototype=new Y,de.prototype.constructor=de,de.superclass=Y.prototype;function de(c,f){arguments.length>0&&this.init(c,f)}de.prototype.init=function(c,f){de.superclass.init.call(this,c,f)},de.prototype.evaluate=function(c){return this.lhs.evaluate(c).number().minus(this.rhs.evaluate(c).number())},de.prototype.toString=function(){return"("+this.lhs.toString()+" - "+this.rhs.toString()+")"},re.prototype=new Y,re.prototype.constructor=re,re.superclass=Y.prototype;function re(c,f){arguments.length>0&&this.init(c,f)}re.prototype.init=function(c,f){re.superclass.init.call(this,c,f)},re.prototype.evaluate=function(c){return this.lhs.evaluate(c).number().multiply(this.rhs.evaluate(c).number())},re.prototype.toString=function(){return"("+this.lhs.toString()+" * "+this.rhs.toString()+")"},ve.prototype=new Y,ve.prototype.constructor=ve,ve.superclass=Y.prototype;function ve(c,f){arguments.length>0&&this.init(c,f)}ve.prototype.init=function(c,f){ve.superclass.init.call(this,c,f)},ve.prototype.evaluate=function(c){return this.lhs.evaluate(c).number().div(this.rhs.evaluate(c).number())},ve.prototype.toString=function(){return"("+this.lhs.toString()+" div "+this.rhs.toString()+")"},Se.prototype=new Y,Se.prototype.constructor=Se,Se.superclass=Y.prototype;function Se(c,f){arguments.length>0&&this.init(c,f)}Se.prototype.init=function(c,f){Se.superclass.init.call(this,c,f)},Se.prototype.evaluate=function(c){return this.lhs.evaluate(c).number().mod(this.rhs.evaluate(c).number())},Se.prototype.toString=function(){return"("+this.lhs.toString()+" mod "+this.rhs.toString()+")"},Z.prototype=new Y,Z.prototype.constructor=Z,Z.superclass=Y.prototype;function Z(c,f){arguments.length>0&&this.init(c,f)}Z.prototype.init=function(c,f){Z.superclass.init.call(this,c,f)},Z.prototype.evaluate=function(c){return this.lhs.evaluate(c).nodeset().union(this.rhs.evaluate(c).nodeset())},Z.prototype.toString=function(){return a(p,[this.lhs,this.rhs]).join(" | ")},ye.prototype=new F,ye.prototype.constructor=ye,ye.superclass=F.prototype;function ye(c,f,_){arguments.length>0&&this.init(c,f,_)}ye.prototype.init=function(c,f,_){ye.superclass.init.call(this),this.filter=c,this.filterPredicates=f,this.locationPath=_};function Bn(c){for(;c&&c.parentNode;)c=c.parentNode;return c}ye.applyPredicates=function(c,f,_){if(c.length===0)return _;var b=f.extend({});return o(function(v,E){return b.contextSize=v.length,l(function(K,_e){return b.contextNode=K,b.contextPosition=_e+1,ye.predicateMatches(E,b)},v)},_,c)},ye.getRoot=function(c,f){var _=f[0];if(_.nodeType===O.DOCUMENT_NODE)return _;if(c.virtualRoot)return c.virtualRoot;var b=_.ownerDocument;if(b)return b;for(var v=_;v.parentNode!=null;)v=v.parentNode;return v},ye.applyStep=function(c,f,_){var b=[];switch(f.contextNode=_,c.axis){case Q.ANCESTOR:if(f.contextNode===f.virtualRoot)break;var v;for(f.contextNode.nodeType==O.ATTRIBUTE_NODE?v=ye.getOwnerElement(f.contextNode):v=f.contextNode.parentNode;v!=null&&(c.nodeTest.matches(v,f)&&b.push(v),v!==f.virtualRoot);)v=v.parentNode;break;case Q.ANCESTORORSELF:for(var v=f.contextNode;v!=null&&(c.nodeTest.matches(v,f)&&b.push(v),v!==f.virtualRoot);v=v.nodeType==O.ATTRIBUTE_NODE?ye.getOwnerElement(v):v.parentNode);break;case Q.ATTRIBUTE:var E=f.contextNode.attributes;if(E!=null)for(var K=0;K<E.length;K++){var v=E.item(K);c.nodeTest.matches(v,f)&&b.push(v)}break;case Q.CHILD:for(var v=f.contextNode.firstChild;v!=null;v=v.nextSibling)c.nodeTest.matches(v,f)&&b.push(v);break;case Q.DESCENDANT:for(var je=[f.contextNode.firstChild];je.length>0;)for(var v=je.pop();v!=null;)c.nodeTest.matches(v,f)&&b.push(v),v.firstChild!=null?(je.push(v.nextSibling),v=v.firstChild):v=v.nextSibling;break;case Q.DESCENDANTORSELF:c.nodeTest.matches(f.contextNode,f)&&b.push(f.contextNode);for(var je=[f.contextNode.firstChild];je.length>0;)for(var v=je.pop();v!=null;)c.nodeTest.matches(v,f)&&b.push(v),v.firstChild!=null?(je.push(v.nextSibling),v=v.firstChild):v=v.nextSibling;break;case Q.FOLLOWING:if(f.contextNode===f.virtualRoot)break;var je=[];f.contextNode.firstChild!=null?je.unshift(f.contextNode.firstChild):je.unshift(f.contextNode.nextSibling);for(var v=f.contextNode.parentNode;v!=null&&v.nodeType!=O.DOCUMENT_NODE&&v!==f.virtualRoot;v=v.parentNode)je.unshift(v.nextSibling);do for(var v=je.pop();v!=null;)c.nodeTest.matches(v,f)&&b.push(v),v.firstChild!=null?(je.push(v.nextSibling),v=v.firstChild):v=v.nextSibling;while(je.length>0);break;case Q.FOLLOWINGSIBLING:if(f.contextNode===f.virtualRoot)break;for(var v=f.contextNode.nextSibling;v!=null;v=v.nextSibling)c.nodeTest.matches(v,f)&&b.push(v);break;case Q.NAMESPACE:var _e={};if(f.contextNode.nodeType==O.ELEMENT_NODE){_e.xml=M.XML_NAMESPACE_URI,_e.xmlns=M.XMLNS_NAMESPACE_URI;for(var v=f.contextNode;v!=null&&v.nodeType==O.ELEMENT_NODE;v=v.parentNode)for(var K=0;K<v.attributes.length;K++){var Ne=v.attributes.item(K),ie=String(Ne.name);if(ie=="xmlns")_e[""]==null&&(_e[""]=Ne.value);else if(ie.length>6&&ie.substring(0,6)=="xmlns:"){var Ae=ie.substring(6,ie.length);_e[Ae]==null&&(_e[Ae]=Ne.value)}}for(var Ae in _e){var $t=new zt(Ae,_e[Ae],f.contextNode);c.nodeTest.matches($t,f)&&b.push($t)}}break;case Q.PARENT:v=null,f.contextNode!==f.virtualRoot&&(f.contextNode.nodeType==O.ATTRIBUTE_NODE?v=ye.getOwnerElement(f.contextNode):v=f.contextNode.parentNode),v!=null&&c.nodeTest.matches(v,f)&&b.push(v);break;case Q.PRECEDING:var je;f.virtualRoot!=null?je=[f.virtualRoot]:je=[Bn(f.contextNode)];e:for(;je.length>0;)for(var v=je.pop();v!=null;){if(v==f.contextNode)break e;c.nodeTest.matches(v,f)&&b.unshift(v),v.firstChild!=null?(je.push(v.nextSibling),v=v.firstChild):v=v.nextSibling}break;case Q.PRECEDINGSIBLING:if(f.contextNode===f.virtualRoot)break;for(var v=f.contextNode.previousSibling;v!=null;v=v.previousSibling)c.nodeTest.matches(v,f)&&b.push(v);break;case Q.SELF:c.nodeTest.matches(f.contextNode,f)&&b.push(f.contextNode);break}return b};function Be(c,f,_){return ye.applyPredicates(c.predicates,f,ye.applyStep(c,f,_))}function Ge(c,f,_){return N(a(Be.bind(null,_,c),f))}ye.applySteps=function(c,f,_){return o(Ge.bind(null,f),_,c)},ye.prototype.applyFilter=function(c,f){if(!this.filter)return{nodes:[c.contextNode]};var _=this.filter.evaluate(c);if(!ae.instance_of(_,se)){if(this.filterPredicates!=null&&this.filterPredicates.length>0||this.locationPath!=null)throw new Error("Path expression filter must evaluate to a nodeset if predicates or location path are used");return{nonNodes:_}}return{nodes:ye.applyPredicates(this.filterPredicates||[],f,_.toUnsortedArray())}},ye.applyLocationPath=function(c,f,_){if(!c)return _;var b=c.absolute?[ye.getRoot(f,_)]:_;return ye.applySteps(c.steps,f,b)},ye.prototype.evaluate=function(c){var f=D(new Ht,c),_=this.applyFilter(c,f);if("nonNodes"in _)return _.nonNodes;var b=new se;return b.addArray(ye.applyLocationPath(this.locationPath,f,_.nodes)),b},ye.predicateMatches=function(c,f){var _=c.evaluate(f);return ae.instance_of(_,ge)?f.contextPosition===_.numberValue():_.booleanValue()},ye.predicateString=function(c){return g("[","]",c.toString())},ye.predicatesString=function(c){return h("",a(ye.predicateString,c))},ye.prototype.toString=function(){if(this.filter!=null){var c=p(this.filter);return ae.instance_of(this.filter,he)?g("'","'",c):this.filterPredicates!=null&&this.filterPredicates.length?g("(",")",c)+ye.predicatesString(this.filterPredicates):this.locationPath!=null?c+(this.locationPath.absolute?"":"/")+p(this.locationPath):c}return p(this.locationPath)},ye.getOwnerElement=function(c){if(c.ownerElement)return c.ownerElement;try{if(c.selectSingleNode)return c.selectSingleNode("..")}catch{}for(var f=c.nodeType==O.DOCUMENT_NODE?c:c.ownerDocument,_=f.getElementsByTagName("*"),b=0;b<_.length;b++)for(var v=_.item(b),E=v.attributes,K=0;K<E.length;K++){var _e=E.item(K);if(_e===c)return v}return null},Qt.prototype=new Object,Qt.prototype.constructor=Qt,Qt.superclass=Object.prototype;function Qt(c,f){arguments.length>0&&this.init(c,f)}Qt.prototype.init=function(c,f){this.absolute=c,this.steps=f},Qt.prototype.toString=function(){return(this.absolute?"/":"")+a(p,this.steps).join("/")},Q.prototype=new Object,Q.prototype.constructor=Q,Q.superclass=Object.prototype;function Q(c,f,_){arguments.length>0&&this.init(c,f,_)}Q.prototype.init=function(c,f,_){this.axis=c,this.nodeTest=f,this.predicates=_},Q.prototype.toString=function(){return Q.STEPNAMES[this.axis]+"::"+this.nodeTest.toString()+ye.predicatesString(this.predicates)},Q.ANCESTOR=0,Q.ANCESTORORSELF=1,Q.ATTRIBUTE=2,Q.CHILD=3,Q.DESCENDANT=4,Q.DESCENDANTORSELF=5,Q.FOLLOWING=6,Q.FOLLOWINGSIBLING=7,Q.NAMESPACE=8,Q.PARENT=9,Q.PRECEDING=10,Q.PRECEDINGSIBLING=11,Q.SELF=12,Q.STEPNAMES=o(function(c,f){return c[f[0]]=f[1],c},{},[[Q.ANCESTOR,"ancestor"],[Q.ANCESTORORSELF,"ancestor-or-self"],[Q.ATTRIBUTE,"attribute"],[Q.CHILD,"child"],[Q.DESCENDANT,"descendant"],[Q.DESCENDANTORSELF,"descendant-or-self"],[Q.FOLLOWING,"following"],[Q.FOLLOWINGSIBLING,"following-sibling"],[Q.NAMESPACE,"namespace"],[Q.PARENT,"parent"],[Q.PRECEDING,"preceding"],[Q.PRECEDINGSIBLING,"preceding-sibling"],[Q.SELF,"self"]]),oe.prototype=new Object,oe.prototype.constructor=oe,oe.superclass=Object.prototype;function oe(c,f){arguments.length>0&&this.init(c,f)}oe.prototype.init=function(c,f){this.type=c,this.value=f},oe.prototype.toString=function(){return"<unknown nodetest type>"},oe.prototype.matches=function(c,f){console.warn("unknown node test type")},oe.NAMETESTANY=0,oe.NAMETESTPREFIXANY=1,oe.NAMETESTQNAME=2,oe.COMMENT=3,oe.TEXT=4,oe.PI=5,oe.NODE=6,oe.isNodeType=function(c){return function(f){return u(c,f.nodeType)}},oe.makeNodeTestType=function(c,f,_){var b=_||function(){};return b.prototype=new oe(c),b.prototype.constructor=b,D(b.prototype,f),b},oe.makeNodeTypeTest=function(c,f,_){return new(oe.makeNodeTestType(c,{matches:oe.isNodeType(f),toString:d(_)}))},oe.hasPrefix=function(c){return c.prefix||(c.nodeName||c.tagName).indexOf(":")!==-1},oe.isElementOrAttribute=oe.isNodeType([1,2]),oe.nameSpaceMatches=function(c,f,_){var b=_.namespaceURI||"";if(!c)return!b||f.allowAnyNamespaceForNoPrefix&&!oe.hasPrefix(_);var v=f.namespaceResolver.getNamespace(c,f.expressionContextNode);if(v==null)throw new Error("Cannot resolve QName "+c);return v===b},oe.localNameMatches=function(c,f,_){var b=_.localName||_.nodeName;return f.caseInsensitive?c.toLowerCase()===b.toLowerCase():c===b},oe.NameTestPrefixAny=oe.makeNodeTestType(oe.NAMETESTPREFIXANY,{matches:function(c,f){return oe.isElementOrAttribute(c)&&oe.nameSpaceMatches(this.prefix,f,c)},toString:function(){return this.prefix+":*"}},function(f){this.prefix=f}),oe.NameTestQName=oe.makeNodeTestType(oe.NAMETESTQNAME,{matches:function(c,f){return oe.isNodeType([O.ELEMENT_NODE,O.ATTRIBUTE_NODE,zt.XPATH_NAMESPACE_NODE])(c)&&oe.nameSpaceMatches(this.prefix,f,c)&&oe.localNameMatches(this.localName,f,c)},toString:function(){return this.name}},function(f){var _=f.split(":");this.name=f,this.prefix=_.length>1?_[0]:null,this.localName=_[_.length>1?1:0]}),oe.PITest=oe.makeNodeTestType(oe.PI,{matches:function(c,f){return oe.isNodeType([O.PROCESSING_INSTRUCTION_NODE])(c)&&(c.target||c.nodeName)===this.name},toString:function(){return g('processing-instruction("','")',this.name)}},function(c){this.name=c}),oe.nameTestAny=oe.makeNodeTypeTest(oe.NAMETESTANY,[O.ELEMENT_NODE,O.ATTRIBUTE_NODE,zt.XPATH_NAMESPACE_NODE],"*"),oe.textTest=oe.makeNodeTypeTest(oe.TEXT,[O.TEXT_NODE,O.CDATA_SECTION_NODE],"text()"),oe.commentTest=oe.makeNodeTypeTest(oe.COMMENT,[O.COMMENT_NODE],"comment()"),oe.nodeTest=oe.makeNodeTypeTest(oe.NODE,[O.ELEMENT_NODE,O.ATTRIBUTE_NODE,O.TEXT_NODE,O.CDATA_SECTION_NODE,O.PROCESSING_INSTRUCTION_NODE,O.COMMENT_NODE,O.DOCUMENT_NODE],"node()"),oe.anyPiTest=oe.makeNodeTypeTest(oe.PI,[O.PROCESSING_INSTRUCTION_NODE],"processing-instruction()"),Qe.prototype=new F,Qe.prototype.constructor=Qe,Qe.superclass=F.prototype;function Qe(c){arguments.length>0&&this.init(c)}Qe.prototype.init=function(c){this.variable=c},Qe.prototype.toString=function(){return"$"+this.variable},Qe.prototype.evaluate=function(c){var f=ae.resolveQName(this.variable,c.namespaceResolver,c.contextNode,!1);if(f[0]==null)throw new Error("Cannot resolve QName "+fn);var _=c.variableResolver.getVariable(f[1],f[0]);if(!_)throw Kt.fromMessage("Undeclared variable: "+this.toString());return _},Ot.prototype=new F,Ot.prototype.constructor=Ot,Ot.superclass=F.prototype;function Ot(c,f){arguments.length>0&&this.init(c,f)}Ot.prototype.init=function(c,f){this.functionName=c,this.arguments=f},Ot.prototype.toString=function(){for(var c=this.functionName+"(",f=0;f<this.arguments.length;f++)f>0&&(c+=", "),c+=this.arguments[f].toString();return c+")"},Ot.prototype.evaluate=function(c){var f=bt.getFunctionFromContext(this.functionName,c);if(!f)throw new Error("Unknown function "+this.functionName);var _=[c].concat(this.arguments);return f.apply(c.functionResolver.thisArg,_)};var Fe=new Object;Fe.equals=function(c,f){return c.equals(f)},Fe.notequal=function(c,f){return c.notequal(f)},Fe.lessthan=function(c,f){return c.lessthan(f)},Fe.greaterthan=function(c,f){return c.greaterthan(f)},Fe.lessthanorequal=function(c,f){return c.lessthanorequal(f)},Fe.greaterthanorequal=function(c,f){return c.greaterthanorequal(f)},he.prototype=new F,he.prototype.constructor=he,he.superclass=F.prototype;function he(c){arguments.length>0&&this.init(c)}he.prototype.init=function(c){this.str=String(c)},he.prototype.toString=function(){return this.str},he.prototype.evaluate=function(c){return this},he.prototype.string=function(){return this},he.prototype.number=function(){return new ge(this.str)},he.prototype.bool=function(){return new pe(this.str)},he.prototype.nodeset=function(){throw new Error("Cannot convert string to nodeset")},he.prototype.stringValue=function(){return this.str},he.prototype.numberValue=function(){return this.number().numberValue()},he.prototype.booleanValue=function(){return this.bool().booleanValue()},he.prototype.equals=function(c){return ae.instance_of(c,pe)?this.bool().equals(c):ae.instance_of(c,ge)?this.number().equals(c):ae.instance_of(c,se)?c.compareWithString(this,Fe.equals):new pe(this.str==c.str)},he.prototype.notequal=function(c){return ae.instance_of(c,pe)?this.bool().notequal(c):ae.instance_of(c,ge)?this.number().notequal(c):ae.instance_of(c,se)?c.compareWithString(this,Fe.notequal):new pe(this.str!=c.str)},he.prototype.lessthan=function(c){return this.number().lessthan(c)},he.prototype.greaterthan=function(c){return this.number().greaterthan(c)},he.prototype.lessthanorequal=function(c){return this.number().lessthanorequal(c)},he.prototype.greaterthanorequal=function(c){return this.number().greaterthanorequal(c)},ge.prototype=new F,ge.prototype.constructor=ge,ge.superclass=F.prototype;function ge(c){arguments.length>0&&this.init(c)}ge.prototype.init=function(c){this.num=typeof c=="string"?this.parse(c):Number(c)},ge.prototype.numberFormat=/^\s*-?[0-9]*\.?[0-9]+\s*$/,ge.prototype.parse=function(c){return this.numberFormat.test(c)?parseFloat(c):Number.NaN};function lo(c){for(var f=c.split("e-"),_=f[0].replace(".",""),b=Number(f[1]),v=0;v<b-1;v+=1)_="0"+_;return"0."+_}function Rs(c){for(var f=c.split("e"),_=f[0].replace(".",""),b=Number(f[1]),v=b+1-_.length,E=0;E<v;E+=1)_+="0";return _}ge.prototype.toString=function(){var c=this.num.toString();return c.indexOf("e-")!==-1?lo(c):c.indexOf("e")!==-1?Rs(c):c},ge.prototype.evaluate=function(c){return this},ge.prototype.string=function(){return new he(this.toString())},ge.prototype.number=function(){return this},ge.prototype.bool=function(){return new pe(this.num)},ge.prototype.nodeset=function(){throw new Error("Cannot convert number to nodeset")},ge.prototype.stringValue=function(){return this.string().stringValue()},ge.prototype.numberValue=function(){return this.num},ge.prototype.booleanValue=function(){return this.bool().booleanValue()},ge.prototype.negate=function(){return new ge(-this.num)},ge.prototype.equals=function(c){return ae.instance_of(c,pe)?this.bool().equals(c):ae.instance_of(c,he)?this.equals(c.number()):ae.instance_of(c,se)?c.compareWithNumber(this,Fe.equals):new pe(this.num==c.num)},ge.prototype.notequal=function(c){return ae.instance_of(c,pe)?this.bool().notequal(c):ae.instance_of(c,he)?this.notequal(c.number()):ae.instance_of(c,se)?c.compareWithNumber(this,Fe.notequal):new pe(this.num!=c.num)},ge.prototype.lessthan=function(c){return ae.instance_of(c,se)?c.compareWithNumber(this,Fe.greaterthan):ae.instance_of(c,pe)||ae.instance_of(c,he)?this.lessthan(c.number()):new pe(this.num<c.num)},ge.prototype.greaterthan=function(c){return ae.instance_of(c,se)?c.compareWithNumber(this,Fe.lessthan):ae.instance_of(c,pe)||ae.instance_of(c,he)?this.greaterthan(c.number()):new pe(this.num>c.num)},ge.prototype.lessthanorequal=function(c){return ae.instance_of(c,se)?c.compareWithNumber(this,Fe.greaterthanorequal):ae.instance_of(c,pe)||ae.instance_of(c,he)?this.lessthanorequal(c.number()):new pe(this.num<=c.num)},ge.prototype.greaterthanorequal=function(c){return ae.instance_of(c,se)?c.compareWithNumber(this,Fe.lessthanorequal):ae.instance_of(c,pe)||ae.instance_of(c,he)?this.greaterthanorequal(c.number()):new pe(this.num>=c.num)},ge.prototype.plus=function(c){return new ge(this.num+c.num)},ge.prototype.minus=function(c){return new ge(this.num-c.num)},ge.prototype.multiply=function(c){return new ge(this.num*c.num)},ge.prototype.div=function(c){return new ge(this.num/c.num)},ge.prototype.mod=function(c){return new ge(this.num%c.num)},pe.prototype=new F,pe.prototype.constructor=pe,pe.superclass=F.prototype;function pe(c){arguments.length>0&&this.init(c)}pe.prototype.init=function(c){this.b=!!c},pe.prototype.toString=function(){return this.b.toString()},pe.prototype.evaluate=function(c){return this},pe.prototype.string=function(){return new he(this.b)},pe.prototype.number=function(){return new ge(this.b)},pe.prototype.bool=function(){return this},pe.prototype.nodeset=function(){throw new Error("Cannot convert boolean to nodeset")},pe.prototype.stringValue=function(){return this.string().stringValue()},pe.prototype.numberValue=function(){return this.number().numberValue()},pe.prototype.booleanValue=function(){return this.b},pe.prototype.not=function(){return new pe(!this.b)},pe.prototype.equals=function(c){return ae.instance_of(c,he)||ae.instance_of(c,ge)?this.equals(c.bool()):ae.instance_of(c,se)?c.compareWithBoolean(this,Fe.equals):new pe(this.b==c.b)},pe.prototype.notequal=function(c){return ae.instance_of(c,he)||ae.instance_of(c,ge)?this.notequal(c.bool()):ae.instance_of(c,se)?c.compareWithBoolean(this,Fe.notequal):new pe(this.b!=c.b)},pe.prototype.lessthan=function(c){return this.number().lessthan(c)},pe.prototype.greaterthan=function(c){return this.number().greaterthan(c)},pe.prototype.lessthanorequal=function(c){return this.number().lessthanorequal(c)},pe.prototype.greaterthanorequal=function(c){return this.number().greaterthanorequal(c)},pe.true_=new pe(!0),pe.false_=new pe(!1),at.prototype=new Object,at.prototype.constructor=at,at.superclass=Object.prototype;function at(c){this.init(c)}at.prototype.init=function(c){this.left=null,this.right=null,this.node=c,this.depth=1},at.prototype.balance=function(){var c=this.left==null?0:this.left.depth,f=this.right==null?0:this.right.depth;if(c>f+1){var _=this.left.left==null?0:this.left.left.depth,b=this.left.right==null?0:this.left.right.depth;_<b&&this.left.rotateRR(),this.rotateLL()}else if(c+1<f){var v=this.right.right==null?0:this.right.right.depth,E=this.right.left==null?0:this.right.left.depth;E>v&&this.right.rotateLL(),this.rotateRR()}},at.prototype.rotateLL=function(){var c=this.node,f=this.right;this.node=this.left.node,this.right=this.left,this.left=this.left.left,this.right.left=this.right.right,this.right.right=f,this.right.node=c,this.right.updateInNewLocation(),this.updateInNewLocation()},at.prototype.rotateRR=function(){var c=this.node,f=this.left;this.node=this.right.node,this.left=this.right,this.right=this.right.right,this.left.right=this.left.left,this.left.left=f,this.left.node=c,this.left.updateInNewLocation(),this.updateInNewLocation()},at.prototype.updateInNewLocation=function(){this.getDepthFromChildren()},at.prototype.getDepthFromChildren=function(){this.depth=this.node==null?0:1,this.left!=null&&(this.depth=this.left.depth+1),this.right!=null&&this.depth<=this.right.depth&&(this.depth=this.right.depth+1)};function Ps(c,f){if(c===f)return 0;if(c.compareDocumentPosition){var _=c.compareDocumentPosition(f);return _&1||_&10?1:_&20?-1:0}for(var b=0,v=0,E=c;E!=null;E=E.parentNode||E.ownerElement)b++;for(var K=f;K!=null;K=K.parentNode||K.ownerElement)v++;if(b>v){for(;b>v;)c=c.parentNode||c.ownerElement,b--;if(c===f)return 1}else if(v>b){for(;v>b;)f=f.parentNode||f.ownerElement,v--;if(c===f)return-1}for(var _e=c.parentNode||c.ownerElement,Ne=f.parentNode||f.ownerElement;_e!==Ne;)c=_e,f=Ne,_e=c.parentNode||c.ownerElement,Ne=f.parentNode||f.ownerElement;var ie=ae.isAttribute(c),Ae=ae.isAttribute(f);if(ie&&!Ae)return-1;if(!ie&&Ae)return 1;if(_e)for(var $t=ie?_e.attributes:_e.childNodes,je=$t.length,ar=0;ar<je;ar+=1){var cr=$t[ar];if(cr===c)return-1;if(cr===f)return 1}throw new Error("Unexpected: could not determine node order")}at.prototype.add=function(c){if(c===this.node)return!1;var f=Ps(c,this.node),_=!1;return f==-1?this.left==null?(this.left=new at(c),_=!0):(_=this.left.add(c),_&&this.balance()):f==1&&(this.right==null?(this.right=new at(c),_=!0):(_=this.right.add(c),_&&this.balance())),_&&this.getDepthFromChildren(),_},se.prototype=new F,se.prototype.constructor=se,se.superclass=F.prototype;function se(){this.init()}se.prototype.init=function(){this.tree=null,this.nodes=[],this.size=0},se.prototype.toString=function(){var c=this.first();return c==null?"":this.stringForNode(c)},se.prototype.evaluate=function(c){return this},se.prototype.string=function(){return new he(this.toString())},se.prototype.stringValue=function(){return this.toString()},se.prototype.number=function(){return new ge(this.string())},se.prototype.numberValue=function(){return Number(this.string())},se.prototype.bool=function(){return new pe(this.booleanValue())},se.prototype.booleanValue=function(){return!!this.size},se.prototype.nodeset=function(){return this},se.prototype.stringForNode=function(c){return c.nodeType==O.DOCUMENT_NODE||c.nodeType==O.ELEMENT_NODE||c.nodeType===O.DOCUMENT_FRAGMENT_NODE?this.stringForContainerNode(c):c.nodeType===O.ATTRIBUTE_NODE?c.value||c.nodeValue:c.isNamespaceNode?c.namespace:c.nodeValue},se.prototype.stringForContainerNode=function(c){for(var f="",_=c.firstChild;_!=null;_=_.nextSibling){var b=_.nodeType;(b===1||b===3||b===4||b===9||b===11)&&(f+=this.stringForNode(_))}return f},se.prototype.buildTree=function(){if(!this.tree&&this.nodes.length){this.tree=new at(this.nodes[0]);for(var c=1;c<this.nodes.length;c+=1)this.tree.add(this.nodes[c])}return this.tree},se.prototype.first=function(){var c=this.buildTree();if(c==null)return null;for(;c.left!=null;)c=c.left;return c.node},se.prototype.add=function(c){for(var f=0;f<this.nodes.length;f+=1)if(c===this.nodes[f])return;this.tree=null,this.nodes.push(c),this.size+=1},se.prototype.addArray=function(c){var f=this;i(function(_){f.add(_)},c)},se.prototype.toArray=function(){var c=[];return this.toArrayRec(this.buildTree(),c),c},se.prototype.toArrayRec=function(c,f){c!=null&&(this.toArrayRec(c.left,f),f.push(c.node),this.toArrayRec(c.right,f))},se.prototype.toUnsortedArray=function(){return this.nodes.slice()},se.prototype.compareWithString=function(c,f){for(var _=this.toUnsortedArray(),b=0;b<_.length;b++){var v=_[b],E=new he(this.stringForNode(v)),K=f(E,c);if(K.booleanValue())return K}return new pe(!1)},se.prototype.compareWithNumber=function(c,f){for(var _=this.toUnsortedArray(),b=0;b<_.length;b++){var v=_[b],E=new ge(this.stringForNode(v)),K=f(E,c);if(K.booleanValue())return K}return new pe(!1)},se.prototype.compareWithBoolean=function(c,f){return f(this.bool(),c)},se.prototype.compareWithNodeSet=function(c,f){for(var _=this.toUnsortedArray(),b=function(_e,Ne){return f(Ne,_e)},v=0;v<_.length;v++){var E=new he(this.stringForNode(_[v])),K=c.compareWithString(E,b);if(K.booleanValue())return K}return new pe(!1)},se.compareWith=r(function(c,f){return ae.instance_of(f,he)?this.compareWithString(f,c):ae.instance_of(f,ge)?this.compareWithNumber(f,c):ae.instance_of(f,pe)?this.compareWithBoolean(f,c):this.compareWithNodeSet(f,c)}),se.prototype.equals=se.compareWith(Fe.equals),se.prototype.notequal=se.compareWith(Fe.notequal),se.prototype.lessthan=se.compareWith(Fe.lessthan),se.prototype.greaterthan=se.compareWith(Fe.greaterthan),se.prototype.lessthanorequal=se.compareWith(Fe.lessthanorequal),se.prototype.greaterthanorequal=se.compareWith(Fe.greaterthanorequal),se.prototype.union=function(c){var f=new se;return f.addArray(this.toUnsortedArray()),f.addArray(c.toUnsortedArray()),f},zt.prototype=new Object,zt.prototype.constructor=zt,zt.superclass=Object.prototype;function zt(c,f,_){this.isXPathNamespace=!0,this.ownerDocument=_.ownerDocument,this.nodeName="#namespace",this.prefix=c,this.localName=c,this.namespaceURI=f,this.nodeValue=f,this.ownerElement=_,this.nodeType=zt.XPATH_NAMESPACE_NODE}zt.prototype.toString=function(){return'{ "'+this.prefix+'", "'+this.namespaceURI+'" }'},Ht.prototype=new Object,Ht.prototype.constructor=Ht,Ht.superclass=Object.prototype;function Ht(c,f,_){this.variableResolver=c??new wn,this.namespaceResolver=f??new en,this.functionResolver=_??new bt}Ht.prototype.extend=function(c){return D(new Ht,this,c)},wn.prototype=new Object,wn.prototype.constructor=wn,wn.superclass=Object.prototype;function wn(){}wn.prototype.getVariable=function(c,f){return null},bt.prototype=new Object,bt.prototype.constructor=bt,bt.superclass=Object.prototype;function bt(c){this.thisArg=c??me,this.functions=new Object,this.addStandardFunctions()}bt.prototype.addStandardFunctions=function(){this.functions["{}last"]=me.last,this.functions["{}position"]=me.position,this.functions["{}count"]=me.count,this.functions["{}id"]=me.id,this.functions["{}local-name"]=me.localName,this.functions["{}namespace-uri"]=me.namespaceURI,this.functions["{}name"]=me.name,this.functions["{}string"]=me.string,this.functions["{}concat"]=me.concat,this.functions["{}starts-with"]=me.startsWith,this.functions["{}contains"]=me.contains,this.functions["{}substring-before"]=me.substringBefore,this.functions["{}substring-after"]=me.substringAfter,this.functions["{}substring"]=me.substring,this.functions["{}string-length"]=me.stringLength,this.functions["{}normalize-space"]=me.normalizeSpace,this.functions["{}translate"]=me.translate,this.functions["{}boolean"]=me.boolean_,this.functions["{}not"]=me.not,this.functions["{}true"]=me.true_,this.functions["{}false"]=me.false_,this.functions["{}lang"]=me.lang,this.functions["{}number"]=me.number,this.functions["{}sum"]=me.sum,this.functions["{}floor"]=me.floor,this.functions["{}ceiling"]=me.ceiling,this.functions["{}round"]=me.round},bt.prototype.addFunction=function(c,f,_){this.functions["{"+c+"}"+f]=_},bt.getFunctionFromContext=function(c,f){var _=ae.resolveQName(c,f.namespaceResolver,f.contextNode,!1);if(_[0]===null)throw new Error("Cannot resolve QName "+name);return f.functionResolver.getFunction(_[1],_[0])},bt.prototype.getFunction=function(c,f){return this.functions["{"+f+"}"+c]},en.prototype=new Object,en.prototype.constructor=en,en.superclass=Object.prototype;function en(){}en.prototype.getNamespace=function(c,f){if(c=="xml")return M.XML_NAMESPACE_URI;if(c=="xmlns")return M.XMLNS_NAMESPACE_URI;for(f.nodeType==O.DOCUMENT_NODE?f=f.documentElement:f.nodeType==O.ATTRIBUTE_NODE?f=ye.getOwnerElement(f):f.nodeType!=O.ELEMENT_NODE&&(f=f.parentNode);f!=null&&f.nodeType==O.ELEMENT_NODE;){for(var _=f.attributes,b=0;b<_.length;b++){var v=_.item(b),E=v.name||v.nodeName;if(E==="xmlns"&&c===""||E==="xmlns:"+c)return String(v.value||v.nodeValue)}f=f.parentNode}return null};var me=new Object;me.last=function(c){if(arguments.length!=1)throw new Error("Function last expects ()");return new ge(c.contextSize)},me.position=function(c){if(arguments.length!=1)throw new Error("Function position expects ()");return new ge(c.contextPosition)},me.count=function(){var c=arguments[0],f;if(arguments.length!=2||!ae.instance_of(f=arguments[1].evaluate(c),se))throw new Error("Function count expects (node-set)");return new ge(f.size)},me.id=function(){var c=arguments[0],f;if(arguments.length!=2)throw new Error("Function id expects (object)");f=arguments[1].evaluate(c),ae.instance_of(f,se)?f=f.toArray().join(" "):f=f.stringValue();for(var _=f.split(/[\x0d\x0a\x09\x20]+/),b=new se,v=c.contextNode.nodeType==O.DOCUMENT_NODE?c.contextNode:c.contextNode.ownerDocument,E=0;E<_.length;E++){var K;v.getElementById?K=v.getElementById(_[E]):K=ae.getElementById(v,_[E]),K!=null&&b.add(K)}return b},me.localName=function(c,f){var _;if(arguments.length==1)_=c.contextNode;else if(arguments.length==2)_=f.evaluate(c).first();else throw new Error("Function local-name expects (node-set?)");return _==null?new he(""):new he(_.localName||_.baseName||_.target||_.nodeName||"")},me.namespaceURI=function(){var c=arguments[0],f;if(arguments.length==1)f=c.contextNode;else if(arguments.length==2)f=arguments[1].evaluate(c).first();else throw new Error("Function namespace-uri expects (node-set?)");return f==null?new he(""):new he(f.namespaceURI)},me.name=function(){var c=arguments[0],f;if(arguments.length==1)f=c.contextNode;else if(arguments.length==2)f=arguments[1].evaluate(c).first();else throw new Error("Function name expects (node-set?)");return f==null?new he(""):f.nodeType==O.ELEMENT_NODE?new he(f.nodeName):f.nodeType==O.ATTRIBUTE_NODE?new he(f.name||f.nodeName):f.nodeType===O.PROCESSING_INSTRUCTION_NODE?new he(f.target||f.nodeName):f.localName==null?new he(""):new he(f.localName)},me.string=function(){var c=arguments[0];if(arguments.length==1)return new he(se.prototype.stringForNode(c.contextNode));if(arguments.length==2)return arguments[1].evaluate(c).string();throw new Error("Function string expects (object?)")},me.concat=function(c){if(arguments.length<3)throw new Error("Function concat expects (string, string[, string]*)");for(var f="",_=1;_<arguments.length;_++)f+=arguments[_].evaluate(c).stringValue();return new he(f)},me.startsWith=function(){var c=arguments[0];if(arguments.length!=3)throw new Error("Function startsWith expects (string, string)");var f=arguments[1].evaluate(c).stringValue(),_=arguments[2].evaluate(c).stringValue();return new pe(f.substring(0,_.length)==_)},me.contains=function(){var c=arguments[0];if(arguments.length!=3)throw new Error("Function contains expects (string, string)");var f=arguments[1].evaluate(c).stringValue(),_=arguments[2].evaluate(c).stringValue();return new pe(f.indexOf(_)!==-1)},me.substringBefore=function(){var c=arguments[0];if(arguments.length!=3)throw new Error("Function substring-before expects (string, string)");var f=arguments[1].evaluate(c).stringValue(),_=arguments[2].evaluate(c).stringValue();return new he(f.substring(0,f.indexOf(_)))},me.substringAfter=function(){var c=arguments[0];if(arguments.length!=3)throw new Error("Function substring-after expects (string, string)");var f=arguments[1].evaluate(c).stringValue(),_=arguments[2].evaluate(c).stringValue();if(_.length==0)return new he(f);var b=f.indexOf(_);return b==-1?new he(""):new he(f.substring(b+_.length))},me.substring=function(){var c=arguments[0];if(!(arguments.length==3||arguments.length==4))throw new Error("Function substring expects (string, number, number?)");var f=arguments[1].evaluate(c).stringValue(),_=Math.round(arguments[2].evaluate(c).numberValue())-1,b=arguments.length==4?_+Math.round(arguments[3].evaluate(c).numberValue()):void 0;return new he(f.substring(_,b))},me.stringLength=function(){var c=arguments[0],f;if(arguments.length==1)f=se.prototype.stringForNode(c.contextNode);else if(arguments.length==2)f=arguments[1].evaluate(c).stringValue();else throw new Error("Function string-length expects (string?)");return new ge(f.length)},me.normalizeSpace=function(){var c=arguments[0],f;if(arguments.length==1)f=se.prototype.stringForNode(c.contextNode);else if(arguments.length==2)f=arguments[1].evaluate(c).stringValue();else throw new Error("Function normalize-space expects (string?)");for(var _=0,b=f.length-1;ae.isSpace(f.charCodeAt(b));)b--;for(var v="";_<=b&&ae.isSpace(f.charCodeAt(_));)_++;for(;_<=b;)if(ae.isSpace(f.charCodeAt(_)))for(v+=" ";_<=b&&ae.isSpace(f.charCodeAt(_));)_++;else v+=f.charAt(_),_++;return new he(v)},me.translate=function(c,f,_,b){if(arguments.length!=4)throw new Error("Function translate expects (string, string, string)");var v=f.evaluate(c).stringValue(),E=_.evaluate(c).stringValue(),K=b.evaluate(c).stringValue(),_e=o(function(ie,Ae,$t){return Ae in ie||(ie[Ae]=$t>K.length?"":K[$t]),ie},{},E),Ne=h("",a(function(ie){return ie in _e?_e[ie]:ie},v));return new he(Ne)},me.boolean_=function(){var c=arguments[0];if(arguments.length!=2)throw new Error("Function boolean expects (object)");return arguments[1].evaluate(c).bool()},me.not=function(c,f){if(arguments.length!=2)throw new Error("Function not expects (object)");return f.evaluate(c).bool().not()},me.true_=function(){if(arguments.length!=1)throw new Error("Function true expects ()");return pe.true_},me.false_=function(){if(arguments.length!=1)throw new Error("Function false expects ()");return pe.false_},me.lang=function(){var c=arguments[0];if(arguments.length!=2)throw new Error("Function lang expects (string)");for(var f,_=c.contextNode;_!=null&&_.nodeType!=O.DOCUMENT_NODE;_=_.parentNode){var b=_.getAttributeNS(M.XML_NAMESPACE_URI,"lang");if(b!=null){f=String(b);break}}if(f==null)return pe.false_;var v=arguments[1].evaluate(c).stringValue();return new pe(f.substring(0,v.length)==v&&(f.length==v.length||f.charAt(v.length)=="-"))},me.number=function(){var c=arguments[0];if(!(arguments.length==1||arguments.length==2))throw new Error("Function number expects (object?)");return arguments.length==1?new ge(se.prototype.stringForNode(c.contextNode)):arguments[1].evaluate(c).number()},me.sum=function(){var c=arguments[0],f;if(arguments.length!=2||!ae.instance_of(f=arguments[1].evaluate(c),se))throw new Error("Function sum expects (node-set)");f=f.toUnsortedArray();for(var _=0,b=0;b<f.length;b++)_+=new ge(se.prototype.stringForNode(f[b])).numberValue();return new ge(_)},me.floor=function(){var c=arguments[0];if(arguments.length!=2)throw new Error("Function floor expects (number)");return new ge(Math.floor(arguments[1].evaluate(c).numberValue()))},me.ceiling=function(){var c=arguments[0];if(arguments.length!=2)throw new Error("Function ceiling expects (number)");return new ge(Math.ceil(arguments[1].evaluate(c).numberValue()))},me.round=function(){var c=arguments[0];if(arguments.length!=2)throw new Error("Function round expects (number)");return new ge(Math.round(arguments[1].evaluate(c).numberValue()))};var ae=new Object;ae.isAttribute=function(c){return c&&(c.nodeType===O.ATTRIBUTE_NODE||c.ownerElement)},ae.splitQName=function(c){var f=c.indexOf(":");return f==-1?[null,c]:[c.substring(0,f),c.substring(f+1)]},ae.resolveQName=function(c,f,_,b){var v=ae.splitQName(c);return v[0]!=null?v[0]=f.getNamespace(v[0],_):b?(v[0]=f.getNamespace("",_),v[0]==null&&(v[0]="")):v[0]="",v},ae.isSpace=function(c){return c==9||c==13||c==10||c==32},ae.isLetter=function(c){return c>=65&&c<=90||c>=97&&c<=122||c>=192&&c<=214||c>=216&&c<=246||c>=248&&c<=255||c>=256&&c<=305||c>=308&&c<=318||c>=321&&c<=328||c>=330&&c<=382||c>=384&&c<=451||c>=461&&c<=496||c>=500&&c<=501||c>=506&&c<=535||c>=592&&c<=680||c>=699&&c<=705||c==902||c>=904&&c<=906||c==908||c>=910&&c<=929||c>=931&&c<=974||c>=976&&c<=982||c==986||c==988||c==990||c==992||c>=994&&c<=1011||c>=1025&&c<=1036||c>=1038&&c<=1103||c>=1105&&c<=1116||c>=1118&&c<=1153||c>=1168&&c<=1220||c>=1223&&c<=1224||c>=1227&&c<=1228||c>=1232&&c<=1259||c>=1262&&c<=1269||c>=1272&&c<=1273||c>=1329&&c<=1366||c==1369||c>=1377&&c<=1414||c>=1488&&c<=1514||c>=1520&&c<=1522||c>=1569&&c<=1594||c>=1601&&c<=1610||c>=1649&&c<=1719||c>=1722&&c<=1726||c>=1728&&c<=1742||c>=1744&&c<=1747||c==1749||c>=1765&&c<=1766||c>=2309&&c<=2361||c==2365||c>=2392&&c<=2401||c>=2437&&c<=2444||c>=2447&&c<=2448||c>=2451&&c<=2472||c>=2474&&c<=2480||c==2482||c>=2486&&c<=2489||c>=2524&&c<=2525||c>=2527&&c<=2529||c>=2544&&c<=2545||c>=2565&&c<=2570||c>=2575&&c<=2576||c>=2579&&c<=2600||c>=2602&&c<=2608||c>=2610&&c<=2611||c>=2613&&c<=2614||c>=2616&&c<=2617||c>=2649&&c<=2652||c==2654||c>=2674&&c<=2676||c>=2693&&c<=2699||c==2701||c>=2703&&c<=2705||c>=2707&&c<=2728||c>=2730&&c<=2736||c>=2738&&c<=2739||c>=2741&&c<=2745||c==2749||c==2784||c>=2821&&c<=2828||c>=2831&&c<=2832||c>=2835&&c<=2856||c>=2858&&c<=2864||c>=2866&&c<=2867||c>=2870&&c<=2873||c==2877||c>=2908&&c<=2909||c>=2911&&c<=2913||c>=2949&&c<=2954||c>=2958&&c<=2960||c>=2962&&c<=2965||c>=2969&&c<=2970||c==2972||c>=2974&&c<=2975||c>=2979&&c<=2980||c>=2984&&c<=2986||c>=2990&&c<=2997||c>=2999&&c<=3001||c>=3077&&c<=3084||c>=3086&&c<=3088||c>=3090&&c<=3112||c>=3114&&c<=3123||c>=3125&&c<=3129||c>=3168&&c<=3169||c>=3205&&c<=3212||c>=3214&&c<=3216||c>=3218&&c<=3240||c>=3242&&c<=3251||c>=3253&&c<=3257||c==3294||c>=3296&&c<=3297||c>=3333&&c<=3340||c>=3342&&c<=3344||c>=3346&&c<=3368||c>=3370&&c<=3385||c>=3424&&c<=3425||c>=3585&&c<=3630||c==3632||c>=3634&&c<=3635||c>=3648&&c<=3653||c>=3713&&c<=3714||c==3716||c>=3719&&c<=3720||c==3722||c==3725||c>=3732&&c<=3735||c>=3737&&c<=3743||c>=3745&&c<=3747||c==3749||c==3751||c>=3754&&c<=3755||c>=3757&&c<=3758||c==3760||c>=3762&&c<=3763||c==3773||c>=3776&&c<=3780||c>=3904&&c<=3911||c>=3913&&c<=3945||c>=4256&&c<=4293||c>=4304&&c<=4342||c==4352||c>=4354&&c<=4355||c>=4357&&c<=4359||c==4361||c>=4363&&c<=4364||c>=4366&&c<=4370||c==4412||c==4414||c==4416||c==4428||c==4430||c==4432||c>=4436&&c<=4437||c==4441||c>=4447&&c<=4449||c==4451||c==4453||c==4455||c==4457||c>=4461&&c<=4462||c>=4466&&c<=4467||c==4469||c==4510||c==4520||c==4523||c>=4526&&c<=4527||c>=4535&&c<=4536||c==4538||c>=4540&&c<=4546||c==4587||c==4592||c==4601||c>=7680&&c<=7835||c>=7840&&c<=7929||c>=7936&&c<=7957||c>=7960&&c<=7965||c>=7968&&c<=8005||c>=8008&&c<=8013||c>=8016&&c<=8023||c==8025||c==8027||c==8029||c>=8031&&c<=8061||c>=8064&&c<=8116||c>=8118&&c<=8124||c==8126||c>=8130&&c<=8132||c>=8134&&c<=8140||c>=8144&&c<=8147||c>=8150&&c<=8155||c>=8160&&c<=8172||c>=8178&&c<=8180||c>=8182&&c<=8188||c==8486||c>=8490&&c<=8491||c==8494||c>=8576&&c<=8578||c>=12353&&c<=12436||c>=12449&&c<=12538||c>=12549&&c<=12588||c>=44032&&c<=55203||c>=19968&&c<=40869||c==12295||c>=12321&&c<=12329},ae.isNCNameChar=function(c){return c>=48&&c<=57||c>=1632&&c<=1641||c>=1776&&c<=1785||c>=2406&&c<=2415||c>=2534&&c<=2543||c>=2662&&c<=2671||c>=2790&&c<=2799||c>=2918&&c<=2927||c>=3047&&c<=3055||c>=3174&&c<=3183||c>=3302&&c<=3311||c>=3430&&c<=3439||c>=3664&&c<=3673||c>=3792&&c<=3801||c>=3872&&c<=3881||c==46||c==45||c==95||ae.isLetter(c)||c>=768&&c<=837||c>=864&&c<=865||c>=1155&&c<=1158||c>=1425&&c<=1441||c>=1443&&c<=1465||c>=1467&&c<=1469||c==1471||c>=1473&&c<=1474||c==1476||c>=1611&&c<=1618||c==1648||c>=1750&&c<=1756||c>=1757&&c<=1759||c>=1760&&c<=1764||c>=1767&&c<=1768||c>=1770&&c<=1773||c>=2305&&c<=2307||c==2364||c>=2366&&c<=2380||c==2381||c>=2385&&c<=2388||c>=2402&&c<=2403||c>=2433&&c<=2435||c==2492||c==2494||c==2495||c>=2496&&c<=2500||c>=2503&&c<=2504||c>=2507&&c<=2509||c==2519||c>=2530&&c<=2531||c==2562||c==2620||c==2622||c==2623||c>=2624&&c<=2626||c>=2631&&c<=2632||c>=2635&&c<=2637||c>=2672&&c<=2673||c>=2689&&c<=2691||c==2748||c>=2750&&c<=2757||c>=2759&&c<=2761||c>=2763&&c<=2765||c>=2817&&c<=2819||c==2876||c>=2878&&c<=2883||c>=2887&&c<=2888||c>=2891&&c<=2893||c>=2902&&c<=2903||c>=2946&&c<=2947||c>=3006&&c<=3010||c>=3014&&c<=3016||c>=3018&&c<=3021||c==3031||c>=3073&&c<=3075||c>=3134&&c<=3140||c>=3142&&c<=3144||c>=3146&&c<=3149||c>=3157&&c<=3158||c>=3202&&c<=3203||c>=3262&&c<=3268||c>=3270&&c<=3272||c>=3274&&c<=3277||c>=3285&&c<=3286||c>=3330&&c<=3331||c>=3390&&c<=3395||c>=3398&&c<=3400||c>=3402&&c<=3405||c==3415||c==3633||c>=3636&&c<=3642||c>=3655&&c<=3662||c==3761||c>=3764&&c<=3769||c>=3771&&c<=3772||c>=3784&&c<=3789||c>=3864&&c<=3865||c==3893||c==3895||c==3897||c==3902||c==3903||c>=3953&&c<=3972||c>=3974&&c<=3979||c>=3984&&c<=3989||c==3991||c>=3993&&c<=4013||c>=4017&&c<=4023||c==4025||c>=8400&&c<=8412||c==8417||c>=12330&&c<=12335||c==12441||c==12442||c==183||c==720||c==721||c==903||c==1600||c==3654||c==3782||c==12293||c>=12337&&c<=12341||c>=12445&&c<=12446||c>=12540&&c<=12542},ae.coalesceText=function(c){for(var f=c.firstChild;f!=null;f=f.nextSibling)if(f.nodeType==O.TEXT_NODE||f.nodeType==O.CDATA_SECTION_NODE){var _=f.nodeValue,b=f;for(f=f.nextSibling;f!=null&&(f.nodeType==O.TEXT_NODE||f.nodeType==O.CDATA_SECTION_NODE);){_+=f.nodeValue;var v=f;f=f.nextSibling,v.parentNode.removeChild(v)}if(b.nodeType==O.CDATA_SECTION_NODE){var E=b.parentNode;if(b.nextSibling==null)E.removeChild(b),E.appendChild(E.ownerDocument.createTextNode(_));else{var K=b.nextSibling;E.removeChild(b),E.insertBefore(E.ownerDocument.createTextNode(_),K)}}else b.nodeValue=_;if(f==null)break}else f.nodeType==O.ELEMENT_NODE&&ae.coalesceText(f)},ae.instance_of=function(c,f){for(;c!=null;){if(c.constructor===f)return!0;if(c===Object)return!1;c=c.constructor.superclass}return!1},ae.getElementById=function(c,f){if(c.nodeType==O.ELEMENT_NODE&&(c.getAttribute("id")==f||c.getAttributeNS(null,"id")==f))return c;for(var _=c.firstChild;_!=null;_=_.nextSibling){var b=ae.getElementById(_,f);if(b!=null)return b}return null};var Kt=function(){function c(_,b){var v=b?": "+b.toString():"";switch(_){case f.INVALID_EXPRESSION_ERR:return"Invalid expression"+v;case f.TYPE_ERR:return"Type error"+v}return null}function f(_,b,v){var E=Error.call(this,c(_,b)||v);return E.code=_,E.exception=b,E}return f.prototype=Object.create(Error.prototype),f.prototype.constructor=f,f.superclass=Error,f.prototype.toString=function(){return this.message},f.fromMessage=function(_,b){return new f(null,b,_)},f.INVALID_EXPRESSION_ERR=51,f.TYPE_ERR=52,f}();Dt.prototype={},Dt.prototype.constructor=Dt,Dt.superclass=Object.prototype;function Dt(c,f,_){this.xpath=_.parse(c),this.context=new Ht,this.context.namespaceResolver=new vn(f)}Dt.getOwnerDocument=function(c){return c.nodeType===O.DOCUMENT_NODE?c:c.ownerDocument},Dt.detectHtmlDom=function(c){if(!c)return!1;var f=Dt.getOwnerDocument(c);try{return f.implementation.hasFeature("HTML","2.0")}catch{return!0}},Dt.prototype.evaluate=function(c,f,_){this.context.expressionContextNode=c,this.context.caseInsensitive=Dt.detectHtmlDom(c);var b=this.xpath.evaluate(this.context);return new I(b,f)},vn.prototype={},vn.prototype.constructor=vn,vn.superclass=Object.prototype;function vn(c){this.xpathNSResolver=c}vn.prototype.getNamespace=function(c,f){return this.xpathNSResolver==null?null:this.xpathNSResolver.lookupNamespaceURI(c)},z.prototype={},z.prototype.constructor=z,z.superclass=Object.prototype;function z(c){this.node=c,this.namespaceResolver=new en}z.prototype.lookupNamespaceURI=function(c){return this.namespaceResolver.getNamespace(c,this.node)},I.prototype={},I.prototype.constructor=I,I.superclass=Object.prototype;function I(c,f){switch(f==I.ANY_TYPE&&(c.constructor===he?f=I.STRING_TYPE:c.constructor===ge?f=I.NUMBER_TYPE:c.constructor===pe?f=I.BOOLEAN_TYPE:c.constructor===se&&(f=I.UNORDERED_NODE_ITERATOR_TYPE)),this.resultType=f,f){case I.NUMBER_TYPE:this.numberValue=c.numberValue();return;case I.STRING_TYPE:this.stringValue=c.stringValue();return;case I.BOOLEAN_TYPE:this.booleanValue=c.booleanValue();return;case I.ANY_UNORDERED_NODE_TYPE:case I.FIRST_ORDERED_NODE_TYPE:if(c.constructor===se){this.singleNodeValue=c.first();return}break;case I.UNORDERED_NODE_ITERATOR_TYPE:case I.ORDERED_NODE_ITERATOR_TYPE:if(c.constructor===se){this.invalidIteratorState=!1,this.nodes=c.toArray(),this.iteratorIndex=0;return}break;case I.UNORDERED_NODE_SNAPSHOT_TYPE:case I.ORDERED_NODE_SNAPSHOT_TYPE:if(c.constructor===se){this.nodes=c.toArray(),this.snapshotLength=this.nodes.length;return}break}throw new Kt(Kt.TYPE_ERR)}I.prototype.iterateNext=function(){if(this.resultType!=I.UNORDERED_NODE_ITERATOR_TYPE&&this.resultType!=I.ORDERED_NODE_ITERATOR_TYPE)throw new Kt(Kt.TYPE_ERR);return this.nodes[this.iteratorIndex++]},I.prototype.snapshotItem=function(c){if(this.resultType!=I.UNORDERED_NODE_SNAPSHOT_TYPE&&this.resultType!=I.ORDERED_NODE_SNAPSHOT_TYPE)throw new Kt(Kt.TYPE_ERR);return this.nodes[c]},I.ANY_TYPE=0,I.NUMBER_TYPE=1,I.STRING_TYPE=2,I.BOOLEAN_TYPE=3,I.UNORDERED_NODE_ITERATOR_TYPE=4,I.ORDERED_NODE_ITERATOR_TYPE=5,I.UNORDERED_NODE_SNAPSHOT_TYPE=6,I.ORDERED_NODE_SNAPSHOT_TYPE=7,I.ANY_UNORDERED_NODE_TYPE=8,I.FIRST_ORDERED_NODE_TYPE=9;function U(c,f){c.createExpression=function(_,b){try{return new Dt(_,b,f)}catch(v){throw new Kt(Kt.INVALID_EXPRESSION_ERR,v)}},c.createNSResolver=function(_){return new z(_)},c.evaluate=function(_,b,v,E,K){if(E<0||E>9)throw{code:0,toString:function(){return"Request type not supported"}};return c.createExpression(_,v,f).evaluate(b,E,K)}}try{var ee=!0;try{document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("XPath",null)&&(ee=!1)}catch{}ee&&U(document,new x)}catch{}U(n,new x),function(){var c=new x,f=new en,_=new bt,b=new wn;function v(J){return{getNamespace:function(Te,xt){var lr=J(Te,xt);return lr||f.getNamespace(Te,xt)}}}function E(J){return v(J.getNamespace.bind(J))}function K(J){return v(function(Te){return J[Te]})}function _e(J){return J&&typeof J.getNamespace=="function"?E(J):typeof J=="function"?v(J):typeof J=="object"?K(J):f}function Ne(J){if(J===null||typeof J>"u"||J instanceof he||J instanceof pe||J instanceof ge||J instanceof se)return J;switch(typeof J){case"string":return new he(J);case"boolean":return new pe(J);case"number":return new ge(J)}var Te=new se;return Te.addArray([].concat(J)),Te}function ie(J){return function(Te){var xt=Array.prototype.slice.call(arguments,1).map(function(ww){return ww.evaluate(Te)}),lr=J.apply(this,[].concat(Te,xt));return Ne(lr)}}function Ae(J){return{getFunction:function(Te,xt){var lr=J(Te,xt);return lr?ie(lr):_.getFunction(Te,xt)}}}function $t(J){return Ae(J.getFunction.bind(J))}function je(J){return Ae(function(Te){return J[Te]})}function ar(J){return J&&typeof J.getFunction=="function"?$t(J):typeof J=="function"?Ae(J):typeof J=="object"?je(J):_}function cr(J){return{getVariable:function(Te,xt){var lr=J(Te,xt);return Ne(lr)}}}function hw(J){if(J){if(typeof J.getVariable=="function")return cr(J.getVariable.bind(J));if(typeof J=="function")return cr(J);if(typeof J=="object")return cr(function(Te){return J[Te]})}return b}function Jf(J,Te,xt){J in xt&&(Te[J]=xt[J])}function gw(J){var Te=new Ht;return J?(Te.namespaceResolver=_e(J.namespaces),Te.functionResolver=ar(J.functions),Te.variableResolver=hw(J.variables),Te.expressionContextNode=J.node,Jf("allowAnyNamespaceForNoPrefix",Te,J),Jf("isHtml",Te,J)):Te.namespaceResolver=f,Te}function mw(J,Te){var xt=gw(Te);return J.evaluate(xt)}var _w={evaluate:function(J){return mw(this.expression,J)},evaluateNumber:function(J){return this.evaluate(J).numberValue()},evaluateString:function(J){return this.evaluate(J).stringValue()},evaluateBoolean:function(J){return this.evaluate(J).booleanValue()},evaluateNodeSet:function(J){return this.evaluate(J).nodeset()},select:function(J){return this.evaluateNodeSet(J).toArray()},select1:function(J){return this.select(J)[0]}};function yw(J){var Te=c.parse(J);return Object.create(_w,{expression:{value:Te}})}n.parse=yw}(),D(n,{XPath:M,XPathParser:x,XPathResult:I,Step:Q,PathExpr:ye,NodeTest:oe,LocationPath:Qt,OrOperation:ue,AndOperation:Ce,BarOperation:Z,EqualsOperation:P,NotEqualOperation:L,LessThanOperation:R,GreaterThanOperation:k,LessThanOrEqualOperation:S,GreaterThanOrEqualOperation:j,PlusOperation:V,MinusOperation:de,MultiplyOperation:re,DivOperation:ve,ModOperation:Se,UnaryMinusOperation:W,FunctionCall:Ot,VariableReference:Qe,XPathContext:Ht,XNodeSet:se,XBoolean:pe,XString:he,XNumber:ge,NamespaceResolver:en,FunctionResolver:bt,VariableResolver:wn,Utilities:ae}),n.select=function(c,f,_){return n.selectWithResolver(c,f,null,_)},n.useNamespaces=function(c){var f={mappings:c||{},lookupNamespaceURI:function(_){return this.mappings[_]}};return function(_,b,v){return n.selectWithResolver(_,b,f,v)}},n.selectWithResolver=function(c,f,_,b){var v=new Dt(c,_,new x),E=I.ANY_TYPE,K=v.evaluate(f,E,null);return K.resultType==I.STRING_TYPE?K=K.stringValue:K.resultType==I.NUMBER_TYPE?K=K.numberValue:K.resultType==I.BOOLEAN_TYPE?K=K.booleanValue:(K=K.nodes,b&&(K=K[0])),K},n.select1=function(c,f){return n.select(c,f,!0)};var we=function(c){return c&&typeof c.nodeType=="number"&&Number.isInteger(c.nodeType)&&c.nodeType>=1&&c.nodeType<=11&&typeof c.nodeName=="string"},et=function(c){return Array.isArray(c)&&c.every(we)},Re=function(c){return function(f){return we(f)&&f.nodeType===c}};D(n,{isNodeLike:we,isArrayOfNodes:et,isElement:Re(O.ELEMENT_NODE),isAttribute:Re(O.ATTRIBUTE_NODE),isTextNode:Re(O.TEXT_NODE),isCDATASection:Re(O.CDATA_SECTION_NODE),isProcessingInstruction:Re(O.PROCESSING_INSTRUCTION_NODE),isComment:Re(O.COMMENT_NODE),isDocumentNode:Re(O.DOCUMENT_NODE),isDocumentTypeNode:Re(O.DOCUMENT_TYPE_NODE),isDocumentFragment:Re(O.DOCUMENT_FRAGMENT_NODE)})})(e)})(Il);var $e={};Object.defineProperty($e,"__esModule",{value:!0});$e.assertIsDocumentFragmentNode=$e.assertIsDocumentTypeNode=$e.assertIsDocumentNode=$e.assertIsCommentNode=$e.assertIsProcessingInstructionNode=$e.assertIsCDATASectionNode=$e.assertIsTextNode=$e.assertIsAttributeNode=$e.assertIsElementNode=$e.isDocumentFragmentNode=$e.isDocumentTypeNode=$e.isDocumentNode=$e.isCommentNode=$e.isProcessingInstructionNode=$e.isCDATASectionNode=$e.isTextNode=$e.isAttributeNode=$e.isElementNode=$e.assertIsArrayOfNodes=$e.isArrayOfNodes=$e.assertIsNodeLike=$e.isNodeLike=$e.NodeTypes=void 0;var Xe;(function(t){t[t.ELEMENT_NODE=1]="ELEMENT_NODE",t[t.ATTRIBUTE_NODE=2]="ATTRIBUTE_NODE",t[t.TEXT_NODE=3]="TEXT_NODE",t[t.CDATA_SECTION_NODE=4]="CDATA_SECTION_NODE",t[t.PROCESSING_INSTRUCTION_NODE=7]="PROCESSING_INSTRUCTION_NODE",t[t.COMMENT_NODE=8]="COMMENT_NODE",t[t.DOCUMENT_NODE=9]="DOCUMENT_NODE",t[t.DOCUMENT_TYPE_NODE=10]="DOCUMENT_TYPE_NODE",t[t.DOCUMENT_FRAGMENT_NODE=11]="DOCUMENT_FRAGMENT_NODE"})(Xe||($e.NodeTypes=Xe={}));function Ol(t){return t&&typeof t=="object"&&Number.isInteger(t.nodeType)&&t.nodeType>=1&&t.nodeType<=11&&typeof t.nodeName=="string"&&typeof t.appendChild=="function"&&typeof t.removeChild=="function"}$e.isNodeLike=Ol;function Q8(t){if(!Ol(t))throw new Error(`Value is not a Node-like object. Received: ${t}`)}$e.assertIsNodeLike=Q8;function Ry(t){return Array.isArray(t)&&t.every(Ol)}$e.isArrayOfNodes=Ry;function e6(t){if(!Ry(t))throw new Error("Value is not an array of Nodes")}$e.assertIsArrayOfNodes=e6;function Pn(t,e){return Ol(e)&&e.nodeType===t}function ir(t,e){const n=Object.keys(Xe).find(r=>Xe[r]===t);if(!Pn(t,e))throw new Error(`Value is not of type ${n}`)}const t6=t=>Pn(Xe.ELEMENT_NODE,t);$e.isElementNode=t6;const n6=t=>Pn(Xe.ATTRIBUTE_NODE,t);$e.isAttributeNode=n6;const r6=t=>Pn(Xe.TEXT_NODE,t);$e.isTextNode=r6;const i6=t=>Pn(Xe.CDATA_SECTION_NODE,t);$e.isCDATASectionNode=i6;const o6=t=>Pn(Xe.PROCESSING_INSTRUCTION_NODE,t);$e.isProcessingInstructionNode=o6;const s6=t=>Pn(Xe.COMMENT_NODE,t);$e.isCommentNode=s6;const a6=t=>Pn(Xe.DOCUMENT_NODE,t);$e.isDocumentNode=a6;const c6=t=>Pn(Xe.DOCUMENT_TYPE_NODE,t);$e.isDocumentTypeNode=c6;const l6=t=>Pn(Xe.DOCUMENT_FRAGMENT_NODE,t);$e.isDocumentFragmentNode=l6;const u6=t=>{ir(Xe.ELEMENT_NODE,t)};$e.assertIsElementNode=u6;const d6=t=>ir(Xe.ATTRIBUTE_NODE,t);$e.assertIsAttributeNode=d6;const p6=t=>ir(Xe.TEXT_NODE,t);$e.assertIsTextNode=p6;const f6=t=>ir(Xe.CDATA_SECTION_NODE,t);$e.assertIsCDATASectionNode=f6;const h6=t=>ir(Xe.PROCESSING_INSTRUCTION_NODE,t);$e.assertIsProcessingInstructionNode=h6;const g6=t=>ir(Xe.COMMENT_NODE,t);$e.assertIsCommentNode=g6;const m6=t=>ir(Xe.DOCUMENT_NODE,t);$e.assertIsDocumentNode=m6;const _6=t=>ir(Xe.DOCUMENT_TYPE_NODE,t);$e.assertIsDocumentTypeNode=_6;const y6=t=>ir(Xe.DOCUMENT_FRAGMENT_NODE,t);$e.assertIsDocumentFragmentNode=y6;(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.validateDigestValue=t.findAncestorNs=t.derToPem=t.pemToDer=t.normalizePem=t.BASE64_REGEX=t.EXTRACT_X509_CERTS=t.PEM_FORMAT_REGEX=t.encodeSpecialCharactersInText=t.encodeSpecialCharactersInAttribute=t.findChilds=t.findChildren=t.findAttr=t.isArrayHasLength=void 0;const e=Il,n=$e;function r(F){return Array.isArray(F)&&F.length>0}t.isArrayHasLength=r;function i(F,H,W){return F.localName===H&&(F.namespaceURI===W||W==null)}function o(F,H,W,Y){return F.localName===H&&(!F.namespaceURI&&(Y==null?void 0:Y.namespaceURI)===W||W==null)}function a(F,H,W){for(let Y=0;Y<F.attributes.length;Y++){const ue=F.attributes[Y];if(i(ue,H,W)||o(ue,H,W,F))return ue}return null}t.findAttr=a;function l(F,H,W){const Y=F.documentElement??F,ue=[];for(let Ce=0;Ce<Y.childNodes.length;Ce++){const P=Y.childNodes[Ce];n.isElementNode(P)&&P.localName===H&&(P.namespaceURI===W||W==null)&&ue.push(P)}return ue}t.findChildren=l;function u(F,H,W){return l(F,H,W)}t.findChilds=u;const d={"&":"&amp;","<":"&lt;",'"':"&quot;","\r":"&#xD;","\n":"&#xA;"," ":"&#x9;"},p={"&":"&amp;","<":"&lt;",">":"&gt;","\r":"&#xD;"};function h(F){return F.replace(/([&<"\r\n\t])/g,function(H,W){return d[W]})}t.encodeSpecialCharactersInAttribute=h;function g(F){return F.replace(/([&<>\r])/g,function(H,W){return p[W]})}t.encodeSpecialCharactersInText=g,t.PEM_FORMAT_REGEX=new RegExp("^-----BEGIN [A-Z ]{1,48}-----([^-]*)-----END [A-Z ]{1,48}-----$","s"),t.EXTRACT_X509_CERTS=new RegExp("-----BEGIN CERTIFICATE-----[^-]*-----END CERTIFICATE-----","g"),t.BASE64_REGEX=new RegExp("^(?:[A-Za-z0-9\\+\\/]{4}\\n{0,1})*(?:[A-Za-z0-9\\+\\/]{2}==|[A-Za-z0-9\\+\\/]{3}=)?$","s");function A(F){return`${(F.trim().replace(/(\r\n|\r)/g,`
270
+ `}}),y("div",{id:"_legalWrapper",children:[o&&o.map(d=>{if(d.type==="NEXT_BUTTON")return null;const p=H8(d);return p?y("div",{className:d.type==="RICH_TEXT"?"mb-6":"mb-4",children:p},d.id):null}),u&&y("div",{className:"mb-4",children:l?y(Rf,{children:[y(tt,{id:"continueBtn",className:"sm:mt-4 !text-base w-full",children:[y("span",{children:u.config.text||"Continue"}),y(et,{className:"text-xs",name:"arrow-right"})]}),y(tt,{id:"continueBtnDisabled",className:"sm:mt-4 !text-base w-full opacity-50 cursor-not-allowed",disabled:!0,children:[y("span",{children:u.config.text||"Continue"}),y(et,{className:"text-xs",name:"arrow-right"})]})]}):y(tt,{className:"sm:mt-4 !text-base w-full",children:[y("span",{children:u.config.text||"Continue"}),y(et,{className:"text-xs",name:"arrow-right"})]})})]})]})})]})},K8=new s.OpenAPIHono().openapi(s.createRoute({tags:["forms"],method:"get",path:"/:formId/nodes/:nodeId",request:{params:s.z.object({formId:s.z.string(),nodeId:s.z.string()}),query:s.z.object({state:s.z.string()})},responses:{200:{description:"Form node HTML"},404:{description:"Form or node not found"}}}),async t=>{const{formId:e,nodeId:n}=t.req.valid("param"),{state:r}=t.req.valid("query"),{client:i,theme:o,branding:a}=await Ue(t,r,!0),l=await t.env.data.forms.get(i.tenant.id,e);if(!l)throw new C(404,{message:"Form not found"});const u=(l.nodes||[]).find(d=>d.id===n&&d.type==="STEP");if(!u)throw new C(404,{message:"Node not found or not a STEP node"});return t.html(y(du,{theme:o,branding:a,client:i,state:r,formName:l.name,nodeAlias:u.alias||u.type,components:"components"in u.config?u.config.components:[]}))}).openapi(s.createRoute({tags:["forms"],method:"post",path:"/:formId/nodes/:nodeId",request:{params:s.z.object({formId:s.z.string(),nodeId:s.z.string()}),query:s.z.object({state:s.z.string()}),body:{content:{"application/x-www-form-urlencoded":{schema:s.z.record(s.z.string())}}}},responses:{200:{description:"Form node submitted"},404:{description:"Form or node not found"}}}),async t=>{const{formId:e,nodeId:n}=t.req.valid("param"),{state:r}=t.req.valid("query"),{theme:i,branding:o,client:a}=await Ue(t,r,!0);let l,u,d=[];try{if(l=await t.env.data.forms.get(a.tenant.id,e),!l)throw new C(404,{message:"Form not found"});if(u=(l.nodes||[]).find(O=>O.id===n&&O.type==="STEP"),!u)throw new C(404,{message:"Node not found or not a STEP node"});d="components"in u.config?u.config.components:[];const p=await t.req.parseBody(),h=[],g={};for(const O of d)if(O.type==="LEGAL"){const x=O.id,M=!!O.required,G=p[x];M&&(!G||G==="")?h.push(x):typeof G=="string"&&(g[x]=G)}if(h.length>0)return t.html(y(du,{theme:i,branding:o,client:a,state:r,formName:l.name,nodeAlias:u.alias||u.type,components:d,error:`Missing required fields: ${h.join(", ")}`}));const A=await t.env.data.loginSessions.get(a.tenant.id,r);if(!A||!A.session_id||!A.authParams)throw new Error("Session expired");const $=await t.env.data.sessions.get(a.tenant.id,A.session_id);if(!$||!$.user_id)throw new Error("Session expired");const N=await t.env.data.users.get(t.var.tenant_id,$.user_id);if(!N)throw new Error("Session expired");const D=await Sr(t,{authParams:A.authParams,client:a,user:N,loginSession:A});return D instanceof Response?D:t.json(D)}catch{return t.html(y(du,{theme:i,branding:o,client:a,state:r,formName:(l==null?void 0:l.name)||"",nodeAlias:(u==null?void 0:u.alias)||n||"",components:d||[],error:"Your session has expired. Please try again."}))}});function G8(t){const e=new s.OpenAPIHono,n=t.dataAdapter.cache||$s({defaultTtlSeconds:0,maxEntries:100,cleanupIntervalMs:0}),r=t.dataAdapter.cache?300:0;e.onError((o,a)=>o instanceof xs?a.redirect(o.location,o.status):o instanceof C?a.text(o.message||"Error",o.status):a.text("Unexpected error",500)),e.get("/css/tailwind.css",async o=>{const a=jf;return o.text(a,200,{"content-type":"text/css; charset=utf-8"})}),e.use(async(o,a)=>{const l=ns(o,t.dataAdapter),u=Sl(l,{defaultTtl:r,cacheEntities:["tenants","connections","clients","branding","themes","promptSettings","forms"],cache:n});return o.env.data=$l(o,u),a()}).use(El).use(Al);const i=e.route("/info",j8).route("/check-account",I8).route("/account",z8).route("/change-email",D8).route("/change-email-confirmation",R8).route("/login/identifier",ZE).route("/enter-code",$8).route("/enter-password",k8).route("/invalid-session",B8).route("/pre-signup",P8).route("/pre-signup-sent",F8).route("/reset-password",C8).route("/forgot-password",T8).route("/validate-email",L8).route("/signup",N8).route("/forms",K8);return i.doc("/u/spec",{openapi:"3.0.0",info:{version:"1.0.0",title:"Universal login"}}),i}const Wt=s.z.object({"#text":s.z.string()}),W8=s.z.object({"#text":s.z.string(),"@_xmlns:saml":s.z.string().optional()}),X8=s.z.object({"samlp:AuthnRequest":s.z.object({"saml:Issuer":W8,"@_xmlns:samlp":s.z.string(),"@_xmlns:saml":s.z.string().optional(),"@_ForceAuthn":s.z.string().transform(t=>t.toLowerCase()==="true").optional(),"@_ID":s.z.string(),"@_IssueInstant":s.z.string().datetime(),"@_Destination":s.z.string().url(),"@_AssertionConsumerServiceURL":s.z.string().url().optional(),"@_ProtocolBinding":s.z.string().optional(),"@_Version":s.z.string()})});s.z.array(s.z.object({":@":s.z.object({"@_xmlns":s.z.string(),"@_entityID":s.z.string()}),EntityDescriptor:s.z.array(s.z.object({":@":s.z.object({"@_protocolSupportEnumeration":s.z.string()}),IDPSSODescriptor:s.z.array(s.z.union([s.z.object({KeyDescriptor:s.z.array(s.z.object({KeyInfo:s.z.array(s.z.object({X509Data:s.z.array(s.z.object({X509Certificate:s.z.array(Wt)}))})),":@":s.z.object({"@_xmlns":s.z.string()})})),":@":s.z.object({"@_use":s.z.string()})}),s.z.object({SingleLogoutService:s.z.array(s.z.object({})),":@":s.z.object({"@_Binding":s.z.string(),"@_Location":s.z.string()})}),s.z.object({NameIDFormat:s.z.array(Wt)}),s.z.object({SingleSignOnService:s.z.array(s.z.object({})),":@":s.z.object({"@_Binding":s.z.string(),"@_Location":s.z.string()})}),s.z.object({Attribute:s.z.array(s.z.object({})),":@":s.z.object({"@_Name":s.z.string(),"@_NameFormat":s.z.string(),"@_FriendlyName":s.z.string(),"@_xmlns":s.z.string()})})]))}))}));const J8=s.z.object({"saml:AttributeValue":s.z.array(s.z.object({"#text":s.z.string()})),":@":s.z.object({"@_xmlns:xs":s.z.string().optional(),"@_xmlns:xsi":s.z.string(),"@_xsi:type":s.z.string(),"@_Name":s.z.string().optional(),"@_NameFormat":s.z.string().optional()})}),Y8=s.z.object({"ds:Transform":s.z.array(s.z.any()),":@":s.z.object({"@_Algorithm":s.z.string()})}),em=s.z.object({"ds:Signature":s.z.array(s.z.union([s.z.object({"ds:SignedInfo":s.z.array(s.z.union([s.z.object({"ds:CanonicalizationMethod":s.z.array(s.z.string()),":@":s.z.object({"@_Algorithm":s.z.string()})}),s.z.object({"ds:SignatureMethod":s.z.array(s.z.string()),":@":s.z.object({"@_Algorithm":s.z.string()})}),s.z.object({"ds:Reference":s.z.array(s.z.union([s.z.object({"ds:Transforms":s.z.array(Y8)}),s.z.object({"ds:DigestMethod":s.z.array(s.z.string()),":@":s.z.object({"@_Algorithm":s.z.string()})}),s.z.object({"ds:DigestValue":s.z.array(Wt)})]))})]))}),s.z.object({"ds:SignatureValue":s.z.array(Wt)}),s.z.object({"ds:KeyInfo":s.z.array(s.z.object({"ds:KeyValue":s.z.array(s.z.object({"ds:RSAKeyValue":s.z.array(s.z.union([s.z.object({"ds:Modulus":s.z.array(Wt)}),s.z.object({"ds:Exponent":s.z.array(Wt)})]))}))}))})])),":@":s.z.object({"@_xmlns:ds":s.z.string()})});s.z.array(s.z.object({"samlp:Response":s.z.array(s.z.union([s.z.object({"saml:Issuer":s.z.array(Wt)}),em,s.z.object({"samlp:Status":s.z.array(s.z.object({"samlp:StatusCode":s.z.array(Wt),":@":s.z.object({"@_Value":s.z.string()})}))}),s.z.object({"saml:Assertion":s.z.array(s.z.union([s.z.object({"saml:Issuer":s.z.array(Wt)}),em,s.z.object({"saml:Subject":s.z.array(s.z.union([s.z.object({"saml:NameID":s.z.array(Wt),":@":s.z.object({"@_Format":s.z.string()})}),s.z.object({"saml:SubjectConfirmation":s.z.array(s.z.object({"saml:SubjectConfirmationData":s.z.array(s.z.any()),":@":s.z.object({"@_InResponseTo":s.z.string(),"@_NotOnOrAfter":s.z.string(),"@_Recipient":s.z.string()})})),":@":s.z.object({"@_Method":s.z.string()})})]))}),s.z.object({"saml:Conditions":s.z.array(s.z.object({"saml:AudienceRestriction":s.z.array(s.z.object({"saml:Audience":s.z.array(Wt)}))})),":@":s.z.object({"@_NotBefore":s.z.string(),"@_NotOnOrAfter":s.z.string()})}),s.z.object({"saml:AuthnStatement":s.z.array(s.z.object({"saml:AuthnContext":s.z.array(s.z.object({"saml:AuthnContextClassRef":s.z.array(Wt)}))})),":@":s.z.object({"@_AuthnInstant":s.z.string(),"@_SessionIndex":s.z.string(),"@_SessionNotOnOrAfter":s.z.string()})}),s.z.object({"saml:AttributeStatement":s.z.array(s.z.object({"saml:Attribute":s.z.array(J8),":@":s.z.object({"@_FriendlyName":s.z.string().optional(),"@_Name":s.z.string(),"@_NameFormat":s.z.string()})}))})])),":@":s.z.object({"@_xmlns":s.z.string(),"@_ID":s.z.string(),"@_IssueInstant":s.z.string(),"@_Version":s.z.string()})})])),":@":s.z.object({"@_xmlns:samlp":s.z.string(),"@_xmlns:saml":s.z.string(),"@_Destination":s.z.string(),"@_ID":s.z.string(),"@_InResponseTo":s.z.string(),"@_IssueInstant":s.z.string(),"@_Version":s.z.string()})}));var Z8={},ri={},Cs={},Il={};(function(t){var e=t;(function(n){function r(c){var f=Array.prototype.slice,_=c.length,b=function(E,K){return function(){return K.apply(this,E.concat(f.call(arguments)))}},v=function(){var E=f.call(arguments);return E.length<_?b(E,v):c.apply(this,f.apply(arguments,[0,_]))};return v}var i=function(c,f){for(var _=0;_<f.length;_+=1)c(f[_],_,f)},o=function(c,f,_){var b=f;return i(function(v,E){b=c(b,v,E)},_),b},a=function(c,f){var _=new Array(f.length);return i(function(b,v){_[v]=c(b)},f),_},l=function(c,f){var _=[];return i(function(b,v){c(b,v)&&_.push(b)},f),_},u=function(c,f){for(var _=0;_<c.length;_+=1)if(c[_]===f)return!0;return!1};function d(c){return function(){return c}}function p(c){return c.toString()}var h=function(c,f){return f.join(c)},g=function(c,f,_){return c+_+f},A=Array.prototype.concat,$=32767;function N(c){for(var f=[],_=0;_<c.length;_+=$){var b=c.slice(_,_+$);f=A.apply(f,b)}return f}function D(c,f){for(var _=Object(c),b=1;b<arguments.length;b++){var v=arguments[b];if(v!=null)for(var E in v)Object.prototype.hasOwnProperty.call(v,E)&&(_[E]=v[E])}return _}var O={ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11};x.prototype=new Object,x.prototype.constructor=x,x.superclass=Object.prototype;function x(){this.init()}x.prototype.init=function(){this.reduceActions=[],this.reduceActions[3]=function(c){return new ue(c[0],c[2])},this.reduceActions[5]=function(c){return new Ce(c[0],c[2])},this.reduceActions[7]=function(c){return new P(c[0],c[2])},this.reduceActions[8]=function(c){return new L(c[0],c[2])},this.reduceActions[10]=function(c){return new R(c[0],c[2])},this.reduceActions[11]=function(c){return new k(c[0],c[2])},this.reduceActions[12]=function(c){return new S(c[0],c[2])},this.reduceActions[13]=function(c){return new j(c[0],c[2])},this.reduceActions[15]=function(c){return new V(c[0],c[2])},this.reduceActions[16]=function(c){return new de(c[0],c[2])},this.reduceActions[18]=function(c){return new re(c[0],c[2])},this.reduceActions[19]=function(c){return new ve(c[0],c[2])},this.reduceActions[20]=function(c){return new Se(c[0],c[2])},this.reduceActions[22]=function(c){return new W(c[1])},this.reduceActions[24]=function(c){return new Z(c[0],c[2])},this.reduceActions[25]=function(c){return new ye(void 0,void 0,c[0])},this.reduceActions[27]=function(c){return c[0].locationPath=c[2],c[0]},this.reduceActions[28]=function(c){return c[0].locationPath=c[2],c[0].locationPath.steps.unshift(new Q(Q.DESCENDANTORSELF,oe.nodeTest,[])),c[0]},this.reduceActions[29]=function(c){return new ye(c[0],[],void 0)},this.reduceActions[30]=function(c){return ae.instance_of(c[0],ye)?(c[0].filterPredicates==null&&(c[0].filterPredicates=[]),c[0].filterPredicates.push(c[1]),c[0]):new ye(c[0],[c[1]],void 0)},this.reduceActions[32]=function(c){return c[1]},this.reduceActions[33]=function(c){return new he(c[0])},this.reduceActions[34]=function(c){return new ge(c[0])},this.reduceActions[36]=function(c){return new Ot(c[0],[])},this.reduceActions[37]=function(c){return new Ot(c[0],c[2])},this.reduceActions[38]=function(c){return[c[0]]},this.reduceActions[39]=function(c){return c[2].unshift(c[0]),c[2]},this.reduceActions[43]=function(c){return new Qt(!0,[])},this.reduceActions[44]=function(c){return c[1].absolute=!0,c[1]},this.reduceActions[46]=function(c){return new Qt(!1,[c[0]])},this.reduceActions[47]=function(c){return c[0].steps.push(c[2]),c[0]},this.reduceActions[49]=function(c){return new Q(c[0],c[1],[])},this.reduceActions[50]=function(c){return new Q(Q.CHILD,c[0],[])},this.reduceActions[51]=function(c){return new Q(c[0],c[1],c[2])},this.reduceActions[52]=function(c){return new Q(Q.CHILD,c[0],c[1])},this.reduceActions[54]=function(c){return[c[0]]},this.reduceActions[55]=function(c){return c[1].unshift(c[0]),c[1]},this.reduceActions[56]=function(c){return c[0]=="ancestor"?Q.ANCESTOR:c[0]=="ancestor-or-self"?Q.ANCESTORORSELF:c[0]=="attribute"?Q.ATTRIBUTE:c[0]=="child"?Q.CHILD:c[0]=="descendant"?Q.DESCENDANT:c[0]=="descendant-or-self"?Q.DESCENDANTORSELF:c[0]=="following"?Q.FOLLOWING:c[0]=="following-sibling"?Q.FOLLOWINGSIBLING:c[0]=="namespace"?Q.NAMESPACE:c[0]=="parent"?Q.PARENT:c[0]=="preceding"?Q.PRECEDING:c[0]=="preceding-sibling"?Q.PRECEDINGSIBLING:c[0]=="self"?Q.SELF:-1},this.reduceActions[57]=function(c){return Q.ATTRIBUTE},this.reduceActions[59]=function(c){return c[0]=="comment"?oe.commentTest:c[0]=="text"?oe.textTest:c[0]=="processing-instruction"?oe.anyPiTest:c[0]=="node"?oe.nodeTest:new oe(-1,void 0)},this.reduceActions[60]=function(c){return new oe.PITest(c[2])},this.reduceActions[61]=function(c){return c[1]},this.reduceActions[63]=function(c){return c[1].absolute=!0,c[1].steps.unshift(new Q(Q.DESCENDANTORSELF,oe.nodeTest,[])),c[1]},this.reduceActions[64]=function(c){return c[0].steps.push(new Q(Q.DESCENDANTORSELF,oe.nodeTest,[])),c[0].steps.push(c[2]),c[0]},this.reduceActions[65]=function(c){return new Q(Q.SELF,oe.nodeTest,[])},this.reduceActions[66]=function(c){return new Q(Q.PARENT,oe.nodeTest,[])},this.reduceActions[67]=function(c){return new Ze(c[1])},this.reduceActions[68]=function(c){return oe.nameTestAny},this.reduceActions[69]=function(c){return new oe.NameTestPrefixAny(c[0].split(":")[0])},this.reduceActions[70]=function(c){return new oe.NameTestQName(c[0])}},x.actionTable=[" s s sssssssss s ss s ss"," s ","r rrrrrrrrr rrrrrrr rr r "," rrrrr "," s s sssssssss s ss s ss","rs rrrrrrrr s sssssrrrrrr rrs rs "," s s sssssssss s ss s ss"," s "," s ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr "," s "," s "," s s sssss s s ","r rrrrrrrrr rrrrrrr rr r ","a ","r s rr r ","r sr rr r ","r s rr s rr r ","r rssrr rss rr r ","r rrrrr rrrss rr r ","r rrrrrsss rrrrr rr r ","r rrrrrrrr rrrrr rr r ","r rrrrrrrr rrrrrs rr r ","r rrrrrrrr rrrrrr rr r ","r rrrrrrrr rrrrrr rr r ","r srrrrrrrr rrrrrrs rr sr ","r srrrrrrrr rrrrrrs rr r ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrr rrrrrr rr r ","r rrrrrrrr rrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r "," sssss ","r rrrrrrrrr rrrrrrr rr sr ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr "," s ","r srrrrrrrr rrrrrrs rr r ","r rrrrrrrr rrrrr rr r "," s "," s "," rrrrr "," s s sssssssss s sss s ss","r srrrrrrrr rrrrrrs rr r "," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss s ss s ss"," s s sssssssss ss s ss"," s s sssssssss s ss s ss"," s s sssss s s "," s s sssss s s ","r rrrrrrrrr rrrrrrr rr rr "," s s sssss s s "," s s sssss s s ","r rrrrrrrrr rrrrrrr rr sr ","r rrrrrrrrr rrrrrrr rr sr ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr rr "," s ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr "," rr "," s "," rs ","r sr rr r ","r s rr s rr r ","r rssrr rss rr r ","r rssrr rss rr r ","r rrrrr rrrss rr r ","r rrrrr rrrss rr r ","r rrrrr rrrss rr r ","r rrrrr rrrss rr r ","r rrrrrsss rrrrr rr r ","r rrrrrsss rrrrr rr r ","r rrrrrrrr rrrrr rr r ","r rrrrrrrr rrrrr rr r ","r rrrrrrrr rrrrr rr r ","r rrrrrrrr rrrrrr rr r "," r "," s ","r srrrrrrrr rrrrrrs rr r ","r srrrrrrrr rrrrrrs rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr r ","r rrrrrrrrr rrrrrrr rr rr ","r rrrrrrrrr rrrrrrr rr rr "," s s sssssssss s ss s ss","r rrrrrrrrr rrrrrrr rr rr "," r "],x.actionTableNumber=[` 1 0 /.-,+*)(' & %$ # "!`," J ","a aaaaaaaaa aaaaaaa aa a "," YYYYY ",` 1 0 /.-,+*)(' & %$ # "!`,`K1 KKKKKKKK . +*)('KKKKKK KK# K" `,` 1 0 /.-,+*)(' & %$ # "!`," N "," O ","e eeeeeeeee eeeeeee ee ee ","f fffffffff fffffff ff ff ","d ddddddddd ddddddd dd dd ","B BBBBBBBBB BBBBBBB BB BB ","A AAAAAAAAA AAAAAAA AA AA "," P "," Q ",` 1 . +*)(' # " `,"b bbbbbbbbb bbbbbbb bb b "," ","! S !! ! ",'" T" "" " ',"$ V $$ U $$ $ ","& &ZY&& &XW && & ",") ))))) )))\\[ )) ) ",". ....._^] ..... .. . ","1 11111111 11111 11 1 ","5 55555555 55555` 55 5 ","7 77777777 777777 77 7 ","9 99999999 999999 99 9 ",": c:::::::: ::::::b :: a: ","I fIIIIIIII IIIIIIe II I ","= ========= ======= == == ","? ????????? ??????? ?? ?? ","C CCCCCCCCC CCCCCCC CC CC ","J JJJJJJJJ JJJJJJ JJ J ","M MMMMMMMM MMMMMM MM M ","N NNNNNNNNN NNNNNNN NN N ","P PPPPPPPPP PPPPPPP PP P "," +*)(' ","R RRRRRRRRR RRRRRRR RR aR ","U UUUUUUUUU UUUUUUU UU U ","Z ZZZZZZZZZ ZZZZZZZ ZZ ZZ ","c ccccccccc ccccccc cc cc "," j ","L fLLLLLLLL LLLLLLe LL L ","6 66666666 66666 66 6 "," k "," l "," XXXXX ",` 1 0 /.-,+*)(' & %$m # "!`,"_ f________ ______e __ _ ",` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 0 /.-,+*)(' %$ # "!`,` 1 0 /.-,+*)(' & %$ # "!`,` 1 . +*)(' # " `,` 1 . +*)(' # " `,"> >>>>>>>>> >>>>>>> >> >> ",` 1 . +*)(' # " `,` 1 . +*)(' # " `,"Q QQQQQQQQQ QQQQQQQ QQ aQ ","V VVVVVVVVV VVVVVVV VV aV ","T TTTTTTTTT TTTTTTT TT T ","@ @@@@@@@@@ @@@@@@@ @@ @@ "," ‡ ","[ [[[[[[[[[ [[[[[[[ [[ [[ ","D DDDDDDDDD DDDDDDD DD DD "," HH "," ˆ "," F‰ ","# T# ## # ","% V %% U %% % ","' 'ZY'' 'XW '' ' ","( (ZY(( (XW (( ( ","+ +++++ +++\\[ ++ + ","* ***** ***\\[ ** * ","- ----- ---\\[ -- - ",", ,,,,, ,,,\\[ ,, , ","0 00000_^] 00000 00 0 ","/ /////_^] ///// // / ","2 22222222 22222 22 2 ","3 33333333 33333 33 3 ","4 44444444 44444 44 4 ","8 88888888 888888 88 8 "," ^ "," Š ","; f;;;;;;;; ;;;;;;e ;; ; ","< f<<<<<<<< <<<<<<e << < ","O OOOOOOOOO OOOOOOO OO O ","` ````````` ``````` `` ` ","S SSSSSSSSS SSSSSSS SS S ","W WWWWWWWWW WWWWWWW WW W ","\\ \\\\\\\\\\\\\\\\\\ \\\\\\\\\\\\\\ \\\\ \\\\ ","E EEEEEEEEE EEEEEEE EE EE ",` 1 0 /.-,+*)(' & %$ # "!`,"] ]]]]]]]]] ]]]]]]] ]] ]] "," G "],x.gotoTable=["3456789:;<=>?@ AB CDEFGH IJ "," "," "," ","L456789:;<=>?@ AB CDEFGH IJ "," M EFGH IJ "," N;<=>?@ AB CDEFGH IJ "," "," "," "," "," "," "," "," "," "," S EFGH IJ "," "," "," "," "," "," "," "," "," "," "," "," "," e "," "," "," "," "," "," "," "," "," h J "," i j "," "," "," "," "," "," "," "," "," ","o456789:;<=>?@ ABpqCDEFGH IJ "," "," r6789:;<=>?@ AB CDEFGH IJ "," s789:;<=>?@ AB CDEFGH IJ "," t89:;<=>?@ AB CDEFGH IJ "," u89:;<=>?@ AB CDEFGH IJ "," v9:;<=>?@ AB CDEFGH IJ "," w9:;<=>?@ AB CDEFGH IJ "," x9:;<=>?@ AB CDEFGH IJ "," y9:;<=>?@ AB CDEFGH IJ "," z:;<=>?@ AB CDEFGH IJ "," {:;<=>?@ AB CDEFGH IJ "," |;<=>?@ AB CDEFGH IJ "," };<=>?@ AB CDEFGH IJ "," ~;<=>?@ AB CDEFGH IJ "," =>?@ AB CDEFGH IJ ","€456789:;<=>?@ AB CDEFGH IJ"," ‚ EFGH IJ "," ƒ EFGH IJ "," "," „ GH IJ "," … GH IJ "," i † "," i ‡ "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," ","o456789:;<=>?@ ABŒqCDEFGH IJ "," "," "],x.productions=[[1,1,2],[2,1,3],[3,1,4],[3,3,3,-9,4],[4,1,5],[4,3,4,-8,5],[5,1,6],[5,3,5,-22,6],[5,3,5,-5,6],[6,1,7],[6,3,6,-23,7],[6,3,6,-24,7],[6,3,6,-6,7],[6,3,6,-7,7],[7,1,8],[7,3,7,-25,8],[7,3,7,-26,8],[8,1,9],[8,3,8,-12,9],[8,3,8,-11,9],[8,3,8,-10,9],[9,1,10],[9,2,-26,9],[10,1,11],[10,3,10,-27,11],[11,1,12],[11,1,13],[11,3,13,-28,14],[11,3,13,-4,14],[13,1,15],[13,2,13,16],[15,1,17],[15,3,-29,2,-30],[15,1,-15],[15,1,-16],[15,1,18],[18,3,-13,-29,-30],[18,4,-13,-29,19,-30],[19,1,20],[19,3,20,-31,19],[20,1,2],[12,1,14],[12,1,21],[21,1,-28],[21,2,-28,14],[21,1,22],[14,1,23],[14,3,14,-28,23],[14,1,24],[23,2,25,26],[23,1,26],[23,3,25,26,27],[23,2,26,27],[23,1,28],[27,1,16],[27,2,16,27],[25,2,-14,-3],[25,1,-32],[26,1,29],[26,3,-20,-29,-30],[26,4,-21,-29,-15,-30],[16,3,-33,30,-34],[30,1,2],[22,2,-4,14],[24,3,14,-4,23],[28,1,-35],[28,1,-2],[17,2,-36,-18],[29,1,-17],[29,1,-19],[29,1,-18]],x.DOUBLEDOT=2,x.DOUBLECOLON=3,x.DOUBLESLASH=4,x.NOTEQUAL=5,x.LESSTHANOREQUAL=6,x.GREATERTHANOREQUAL=7,x.AND=8,x.OR=9,x.MOD=10,x.DIV=11,x.MULTIPLYOPERATOR=12,x.FUNCTIONNAME=13,x.AXISNAME=14,x.LITERAL=15,x.NUMBER=16,x.ASTERISKNAMETEST=17,x.QNAME=18,x.NCNAMECOLONASTERISK=19,x.NODETYPE=20,x.PROCESSINGINSTRUCTIONWITHLITERAL=21,x.EQUALS=22,x.LESSTHAN=23,x.GREATERTHAN=24,x.PLUS=25,x.MINUS=26,x.BAR=27,x.SLASH=28,x.LEFTPARENTHESIS=29,x.RIGHTPARENTHESIS=30,x.COMMA=31,x.AT=32,x.LEFTBRACKET=33,x.RIGHTBRACKET=34,x.DOT=35,x.DOLLAR=36,x.prototype.tokenize=function(c){for(var f=[],_=[],b=c+"\0",v=0,E=b.charAt(v++);;){for(;E==" "||E==" "||E=="\r"||E==`
271
+ `;)E=b.charAt(v++);if(E=="\0"||v>=b.length)break;if(E=="("){f.push(x.LEFTPARENTHESIS),_.push(E),E=b.charAt(v++);continue}if(E==")"){f.push(x.RIGHTPARENTHESIS),_.push(E),E=b.charAt(v++);continue}if(E=="["){f.push(x.LEFTBRACKET),_.push(E),E=b.charAt(v++);continue}if(E=="]"){f.push(x.RIGHTBRACKET),_.push(E),E=b.charAt(v++);continue}if(E=="@"){f.push(x.AT),_.push(E),E=b.charAt(v++);continue}if(E==","){f.push(x.COMMA),_.push(E),E=b.charAt(v++);continue}if(E=="|"){f.push(x.BAR),_.push(E),E=b.charAt(v++);continue}if(E=="+"){f.push(x.PLUS),_.push(E),E=b.charAt(v++);continue}if(E=="-"){f.push(x.MINUS),_.push(E),E=b.charAt(v++);continue}if(E=="="){f.push(x.EQUALS),_.push(E),E=b.charAt(v++);continue}if(E=="$"){f.push(x.DOLLAR),_.push(E),E=b.charAt(v++);continue}if(E=="."){if(E=b.charAt(v++),E=="."){f.push(x.DOUBLEDOT),_.push(".."),E=b.charAt(v++);continue}if(E>="0"&&E<="9"){var K="."+E;for(E=b.charAt(v++);E>="0"&&E<="9";)K+=E,E=b.charAt(v++);f.push(x.NUMBER),_.push(K);continue}f.push(x.DOT),_.push(".");continue}if(E=="'"||E=='"'){for(var _e=E,Ne="";v<b.length&&(E=b.charAt(v))!==_e;)Ne+=E,v+=1;if(E!==_e)throw Kt.fromMessage("Unterminated string literal: "+_e+Ne);v+=1,f.push(x.LITERAL),_.push(Ne),E=b.charAt(v++);continue}if(E>="0"&&E<="9"){var K=E;for(E=b.charAt(v++);E>="0"&&E<="9";)K+=E,E=b.charAt(v++);if(E=="."&&b.charAt(v)>="0"&&b.charAt(v)<="9")for(K+=E,K+=b.charAt(v++),E=b.charAt(v++);E>="0"&&E<="9";)K+=E,E=b.charAt(v++);f.push(x.NUMBER),_.push(K);continue}if(E=="*"){if(f.length>0){var ie=f[f.length-1];if(ie!=x.AT&&ie!=x.DOUBLECOLON&&ie!=x.LEFTPARENTHESIS&&ie!=x.LEFTBRACKET&&ie!=x.AND&&ie!=x.OR&&ie!=x.MOD&&ie!=x.DIV&&ie!=x.MULTIPLYOPERATOR&&ie!=x.SLASH&&ie!=x.DOUBLESLASH&&ie!=x.BAR&&ie!=x.PLUS&&ie!=x.MINUS&&ie!=x.EQUALS&&ie!=x.NOTEQUAL&&ie!=x.LESSTHAN&&ie!=x.LESSTHANOREQUAL&&ie!=x.GREATERTHAN&&ie!=x.GREATERTHANOREQUAL){f.push(x.MULTIPLYOPERATOR),_.push(E),E=b.charAt(v++);continue}}f.push(x.ASTERISKNAMETEST),_.push(E),E=b.charAt(v++);continue}if(E==":"&&b.charAt(v)==":"){f.push(x.DOUBLECOLON),_.push("::"),v++,E=b.charAt(v++);continue}if(E=="/"){if(E=b.charAt(v++),E=="/"){f.push(x.DOUBLESLASH),_.push("//"),E=b.charAt(v++);continue}f.push(x.SLASH),_.push("/");continue}if(E=="!"&&b.charAt(v)=="="){f.push(x.NOTEQUAL),_.push("!="),v++,E=b.charAt(v++);continue}if(E=="<"){if(b.charAt(v)=="="){f.push(x.LESSTHANOREQUAL),_.push("<="),v++,E=b.charAt(v++);continue}f.push(x.LESSTHAN),_.push("<"),E=b.charAt(v++);continue}if(E==">"){if(b.charAt(v)=="="){f.push(x.GREATERTHANOREQUAL),_.push(">="),v++,E=b.charAt(v++);continue}f.push(x.GREATERTHAN),_.push(">"),E=b.charAt(v++);continue}if(E=="_"||ae.isLetter(E.charCodeAt(0))){var Ae=E;for(E=b.charAt(v++);ae.isNCNameChar(E.charCodeAt(0));)Ae+=E,E=b.charAt(v++);if(f.length>0){var ie=f[f.length-1];if(ie!=x.AT&&ie!=x.DOUBLECOLON&&ie!=x.LEFTPARENTHESIS&&ie!=x.LEFTBRACKET&&ie!=x.AND&&ie!=x.OR&&ie!=x.MOD&&ie!=x.DIV&&ie!=x.MULTIPLYOPERATOR&&ie!=x.SLASH&&ie!=x.DOUBLESLASH&&ie!=x.BAR&&ie!=x.PLUS&&ie!=x.MINUS&&ie!=x.EQUALS&&ie!=x.NOTEQUAL&&ie!=x.LESSTHAN&&ie!=x.LESSTHANOREQUAL&&ie!=x.GREATERTHAN&&ie!=x.GREATERTHANOREQUAL){if(Ae=="and"){f.push(x.AND),_.push(Ae);continue}if(Ae=="or"){f.push(x.OR),_.push(Ae);continue}if(Ae=="mod"){f.push(x.MOD),_.push(Ae);continue}if(Ae=="div"){f.push(x.DIV),_.push(Ae);continue}}}if(E==":"){if(b.charAt(v)=="*"){f.push(x.NCNAMECOLONASTERISK),_.push(Ae+":*"),v++,E=b.charAt(v++);continue}if(b.charAt(v)=="_"||ae.isLetter(b.charCodeAt(v))){for(Ae+=":",E=b.charAt(v++);ae.isNCNameChar(E.charCodeAt(0));)Ae+=E,E=b.charAt(v++);if(E=="("){f.push(x.FUNCTIONNAME),_.push(Ae);continue}f.push(x.QNAME),_.push(Ae);continue}if(b.charAt(v)==":"){f.push(x.AXISNAME),_.push(Ae);continue}}if(E=="("){if(Ae=="comment"||Ae=="text"||Ae=="node"){f.push(x.NODETYPE),_.push(Ae);continue}if(Ae=="processing-instruction"){b.charAt(v)==")"?f.push(x.NODETYPE):f.push(x.PROCESSINGINSTRUCTIONWITHLITERAL),_.push(Ae);continue}f.push(x.FUNCTIONNAME),_.push(Ae);continue}f.push(x.QNAME),_.push(Ae);continue}throw new Error("Unexpected character "+E)}return f.push(1),_.push("[EOF]"),[f,_]},x.SHIFT="s",x.REDUCE="r",x.ACCEPT="a",x.prototype.parse=function(Ne){var f,_,b=this.tokenize(Ne);if(b!=null){f=b[0],_=b[1];var v=0,E=[],K=[],_e=[],Ne,ie,Ae;for(E.push(0),K.push(1),_e.push("_S"),ie=f[v],Ae=_[v++];;)switch(Ne=E[E.length-1],x.actionTable[Ne].charAt(ie-1)){case x.SHIFT:K.push(-ie),_e.push(Ae),E.push(x.actionTableNumber[Ne].charCodeAt(ie-1)-32),ie=f[v],Ae=_[v++];break;case x.REDUCE:for(var $t=x.productions[x.actionTableNumber[Ne].charCodeAt(ie-1)-32][1],je=[],ar=0;ar<$t;ar++)K.pop(),je.unshift(_e.pop()),E.pop();var cr=E[E.length-1];K.push(x.productions[x.actionTableNumber[Ne].charCodeAt(ie-1)-32][0]),this.reduceActions[x.actionTableNumber[Ne].charCodeAt(ie-1)-32]==null?_e.push(je[0]):_e.push(this.reduceActions[x.actionTableNumber[Ne].charCodeAt(ie-1)-32](je)),E.push(x.gotoTable[cr].charCodeAt(x.productions[x.actionTableNumber[Ne].charCodeAt(ie-1)-32][0]-2)-33);break;case x.ACCEPT:return new M(_e.pop());default:throw new Error("XPath parse error")}}},M.prototype=new Object,M.prototype.constructor=M,M.superclass=Object.prototype;function M(c){this.expression=c}M.prototype.toString=function(){return this.expression.toString()};function G(c,f,_){f in c||(c[f]=_)}M.prototype.evaluate=function(c){return c.contextNode=c.expressionContextNode,c.contextSize=1,c.contextPosition=1,c.isHtml&&(G(c,"caseInsensitive",!0),G(c,"allowAnyNamespaceForNoPrefix",!0)),G(c,"caseInsensitive",!1),this.expression.evaluate(c)},M.XML_NAMESPACE_URI="http://www.w3.org/XML/1998/namespace",M.XMLNS_NAMESPACE_URI="http://www.w3.org/2000/xmlns/",F.prototype=new Object,F.prototype.constructor=F,F.superclass=Object.prototype;function F(){}F.prototype.init=function(){},F.prototype.toString=function(){return"<Expression>"},F.prototype.evaluate=function(c){throw new Error("Could not evaluate expression.")},H.prototype=new F,H.prototype.constructor=H,H.superclass=F.prototype;function H(c){arguments.length>0&&this.init(c)}H.prototype.init=function(c){this.rhs=c},W.prototype=new H,W.prototype.constructor=W,W.superclass=H.prototype;function W(c){arguments.length>0&&this.init(c)}W.prototype.init=function(c){W.superclass.init.call(this,c)},W.prototype.evaluate=function(c){return this.rhs.evaluate(c).number().negate()},W.prototype.toString=function(){return"-"+this.rhs.toString()},Y.prototype=new F,Y.prototype.constructor=Y,Y.superclass=F.prototype;function Y(c,f){arguments.length>0&&this.init(c,f)}Y.prototype.init=function(c,f){this.lhs=c,this.rhs=f},ue.prototype=new Y,ue.prototype.constructor=ue,ue.superclass=Y.prototype;function ue(c,f){arguments.length>0&&this.init(c,f)}ue.prototype.init=function(c,f){ue.superclass.init.call(this,c,f)},ue.prototype.toString=function(){return"("+this.lhs.toString()+" or "+this.rhs.toString()+")"},ue.prototype.evaluate=function(c){var f=this.lhs.evaluate(c).bool();return f.booleanValue()?f:this.rhs.evaluate(c).bool()},Ce.prototype=new Y,Ce.prototype.constructor=Ce,Ce.superclass=Y.prototype;function Ce(c,f){arguments.length>0&&this.init(c,f)}Ce.prototype.init=function(c,f){Ce.superclass.init.call(this,c,f)},Ce.prototype.toString=function(){return"("+this.lhs.toString()+" and "+this.rhs.toString()+")"},Ce.prototype.evaluate=function(c){var f=this.lhs.evaluate(c).bool();return f.booleanValue()?this.rhs.evaluate(c).bool():f},P.prototype=new Y,P.prototype.constructor=P,P.superclass=Y.prototype;function P(c,f){arguments.length>0&&this.init(c,f)}P.prototype.init=function(c,f){P.superclass.init.call(this,c,f)},P.prototype.toString=function(){return"("+this.lhs.toString()+" = "+this.rhs.toString()+")"},P.prototype.evaluate=function(c){return this.lhs.evaluate(c).equals(this.rhs.evaluate(c))},L.prototype=new Y,L.prototype.constructor=L,L.superclass=Y.prototype;function L(c,f){arguments.length>0&&this.init(c,f)}L.prototype.init=function(c,f){L.superclass.init.call(this,c,f)},L.prototype.toString=function(){return"("+this.lhs.toString()+" != "+this.rhs.toString()+")"},L.prototype.evaluate=function(c){return this.lhs.evaluate(c).notequal(this.rhs.evaluate(c))},R.prototype=new Y,R.prototype.constructor=R,R.superclass=Y.prototype;function R(c,f){arguments.length>0&&this.init(c,f)}R.prototype.init=function(c,f){R.superclass.init.call(this,c,f)},R.prototype.evaluate=function(c){return this.lhs.evaluate(c).lessthan(this.rhs.evaluate(c))},R.prototype.toString=function(){return"("+this.lhs.toString()+" < "+this.rhs.toString()+")"},k.prototype=new Y,k.prototype.constructor=k,k.superclass=Y.prototype;function k(c,f){arguments.length>0&&this.init(c,f)}k.prototype.init=function(c,f){k.superclass.init.call(this,c,f)},k.prototype.evaluate=function(c){return this.lhs.evaluate(c).greaterthan(this.rhs.evaluate(c))},k.prototype.toString=function(){return"("+this.lhs.toString()+" > "+this.rhs.toString()+")"},S.prototype=new Y,S.prototype.constructor=S,S.superclass=Y.prototype;function S(c,f){arguments.length>0&&this.init(c,f)}S.prototype.init=function(c,f){S.superclass.init.call(this,c,f)},S.prototype.evaluate=function(c){return this.lhs.evaluate(c).lessthanorequal(this.rhs.evaluate(c))},S.prototype.toString=function(){return"("+this.lhs.toString()+" <= "+this.rhs.toString()+")"},j.prototype=new Y,j.prototype.constructor=j,j.superclass=Y.prototype;function j(c,f){arguments.length>0&&this.init(c,f)}j.prototype.init=function(c,f){j.superclass.init.call(this,c,f)},j.prototype.evaluate=function(c){return this.lhs.evaluate(c).greaterthanorequal(this.rhs.evaluate(c))},j.prototype.toString=function(){return"("+this.lhs.toString()+" >= "+this.rhs.toString()+")"},V.prototype=new Y,V.prototype.constructor=V,V.superclass=Y.prototype;function V(c,f){arguments.length>0&&this.init(c,f)}V.prototype.init=function(c,f){V.superclass.init.call(this,c,f)},V.prototype.evaluate=function(c){return this.lhs.evaluate(c).number().plus(this.rhs.evaluate(c).number())},V.prototype.toString=function(){return"("+this.lhs.toString()+" + "+this.rhs.toString()+")"},de.prototype=new Y,de.prototype.constructor=de,de.superclass=Y.prototype;function de(c,f){arguments.length>0&&this.init(c,f)}de.prototype.init=function(c,f){de.superclass.init.call(this,c,f)},de.prototype.evaluate=function(c){return this.lhs.evaluate(c).number().minus(this.rhs.evaluate(c).number())},de.prototype.toString=function(){return"("+this.lhs.toString()+" - "+this.rhs.toString()+")"},re.prototype=new Y,re.prototype.constructor=re,re.superclass=Y.prototype;function re(c,f){arguments.length>0&&this.init(c,f)}re.prototype.init=function(c,f){re.superclass.init.call(this,c,f)},re.prototype.evaluate=function(c){return this.lhs.evaluate(c).number().multiply(this.rhs.evaluate(c).number())},re.prototype.toString=function(){return"("+this.lhs.toString()+" * "+this.rhs.toString()+")"},ve.prototype=new Y,ve.prototype.constructor=ve,ve.superclass=Y.prototype;function ve(c,f){arguments.length>0&&this.init(c,f)}ve.prototype.init=function(c,f){ve.superclass.init.call(this,c,f)},ve.prototype.evaluate=function(c){return this.lhs.evaluate(c).number().div(this.rhs.evaluate(c).number())},ve.prototype.toString=function(){return"("+this.lhs.toString()+" div "+this.rhs.toString()+")"},Se.prototype=new Y,Se.prototype.constructor=Se,Se.superclass=Y.prototype;function Se(c,f){arguments.length>0&&this.init(c,f)}Se.prototype.init=function(c,f){Se.superclass.init.call(this,c,f)},Se.prototype.evaluate=function(c){return this.lhs.evaluate(c).number().mod(this.rhs.evaluate(c).number())},Se.prototype.toString=function(){return"("+this.lhs.toString()+" mod "+this.rhs.toString()+")"},Z.prototype=new Y,Z.prototype.constructor=Z,Z.superclass=Y.prototype;function Z(c,f){arguments.length>0&&this.init(c,f)}Z.prototype.init=function(c,f){Z.superclass.init.call(this,c,f)},Z.prototype.evaluate=function(c){return this.lhs.evaluate(c).nodeset().union(this.rhs.evaluate(c).nodeset())},Z.prototype.toString=function(){return a(p,[this.lhs,this.rhs]).join(" | ")},ye.prototype=new F,ye.prototype.constructor=ye,ye.superclass=F.prototype;function ye(c,f,_){arguments.length>0&&this.init(c,f,_)}ye.prototype.init=function(c,f,_){ye.superclass.init.call(this),this.filter=c,this.filterPredicates=f,this.locationPath=_};function Bn(c){for(;c&&c.parentNode;)c=c.parentNode;return c}ye.applyPredicates=function(c,f,_){if(c.length===0)return _;var b=f.extend({});return o(function(v,E){return b.contextSize=v.length,l(function(K,_e){return b.contextNode=K,b.contextPosition=_e+1,ye.predicateMatches(E,b)},v)},_,c)},ye.getRoot=function(c,f){var _=f[0];if(_.nodeType===O.DOCUMENT_NODE)return _;if(c.virtualRoot)return c.virtualRoot;var b=_.ownerDocument;if(b)return b;for(var v=_;v.parentNode!=null;)v=v.parentNode;return v},ye.applyStep=function(c,f,_){var b=[];switch(f.contextNode=_,c.axis){case Q.ANCESTOR:if(f.contextNode===f.virtualRoot)break;var v;for(f.contextNode.nodeType==O.ATTRIBUTE_NODE?v=ye.getOwnerElement(f.contextNode):v=f.contextNode.parentNode;v!=null&&(c.nodeTest.matches(v,f)&&b.push(v),v!==f.virtualRoot);)v=v.parentNode;break;case Q.ANCESTORORSELF:for(var v=f.contextNode;v!=null&&(c.nodeTest.matches(v,f)&&b.push(v),v!==f.virtualRoot);v=v.nodeType==O.ATTRIBUTE_NODE?ye.getOwnerElement(v):v.parentNode);break;case Q.ATTRIBUTE:var E=f.contextNode.attributes;if(E!=null)for(var K=0;K<E.length;K++){var v=E.item(K);c.nodeTest.matches(v,f)&&b.push(v)}break;case Q.CHILD:for(var v=f.contextNode.firstChild;v!=null;v=v.nextSibling)c.nodeTest.matches(v,f)&&b.push(v);break;case Q.DESCENDANT:for(var je=[f.contextNode.firstChild];je.length>0;)for(var v=je.pop();v!=null;)c.nodeTest.matches(v,f)&&b.push(v),v.firstChild!=null?(je.push(v.nextSibling),v=v.firstChild):v=v.nextSibling;break;case Q.DESCENDANTORSELF:c.nodeTest.matches(f.contextNode,f)&&b.push(f.contextNode);for(var je=[f.contextNode.firstChild];je.length>0;)for(var v=je.pop();v!=null;)c.nodeTest.matches(v,f)&&b.push(v),v.firstChild!=null?(je.push(v.nextSibling),v=v.firstChild):v=v.nextSibling;break;case Q.FOLLOWING:if(f.contextNode===f.virtualRoot)break;var je=[];f.contextNode.firstChild!=null?je.unshift(f.contextNode.firstChild):je.unshift(f.contextNode.nextSibling);for(var v=f.contextNode.parentNode;v!=null&&v.nodeType!=O.DOCUMENT_NODE&&v!==f.virtualRoot;v=v.parentNode)je.unshift(v.nextSibling);do for(var v=je.pop();v!=null;)c.nodeTest.matches(v,f)&&b.push(v),v.firstChild!=null?(je.push(v.nextSibling),v=v.firstChild):v=v.nextSibling;while(je.length>0);break;case Q.FOLLOWINGSIBLING:if(f.contextNode===f.virtualRoot)break;for(var v=f.contextNode.nextSibling;v!=null;v=v.nextSibling)c.nodeTest.matches(v,f)&&b.push(v);break;case Q.NAMESPACE:var _e={};if(f.contextNode.nodeType==O.ELEMENT_NODE){_e.xml=M.XML_NAMESPACE_URI,_e.xmlns=M.XMLNS_NAMESPACE_URI;for(var v=f.contextNode;v!=null&&v.nodeType==O.ELEMENT_NODE;v=v.parentNode)for(var K=0;K<v.attributes.length;K++){var Ne=v.attributes.item(K),ie=String(Ne.name);if(ie=="xmlns")_e[""]==null&&(_e[""]=Ne.value);else if(ie.length>6&&ie.substring(0,6)=="xmlns:"){var Ae=ie.substring(6,ie.length);_e[Ae]==null&&(_e[Ae]=Ne.value)}}for(var Ae in _e){var $t=new zt(Ae,_e[Ae],f.contextNode);c.nodeTest.matches($t,f)&&b.push($t)}}break;case Q.PARENT:v=null,f.contextNode!==f.virtualRoot&&(f.contextNode.nodeType==O.ATTRIBUTE_NODE?v=ye.getOwnerElement(f.contextNode):v=f.contextNode.parentNode),v!=null&&c.nodeTest.matches(v,f)&&b.push(v);break;case Q.PRECEDING:var je;f.virtualRoot!=null?je=[f.virtualRoot]:je=[Bn(f.contextNode)];e:for(;je.length>0;)for(var v=je.pop();v!=null;){if(v==f.contextNode)break e;c.nodeTest.matches(v,f)&&b.unshift(v),v.firstChild!=null?(je.push(v.nextSibling),v=v.firstChild):v=v.nextSibling}break;case Q.PRECEDINGSIBLING:if(f.contextNode===f.virtualRoot)break;for(var v=f.contextNode.previousSibling;v!=null;v=v.previousSibling)c.nodeTest.matches(v,f)&&b.push(v);break;case Q.SELF:c.nodeTest.matches(f.contextNode,f)&&b.push(f.contextNode);break}return b};function Be(c,f,_){return ye.applyPredicates(c.predicates,f,ye.applyStep(c,f,_))}function Ke(c,f,_){return N(a(Be.bind(null,_,c),f))}ye.applySteps=function(c,f,_){return o(Ke.bind(null,f),_,c)},ye.prototype.applyFilter=function(c,f){if(!this.filter)return{nodes:[c.contextNode]};var _=this.filter.evaluate(c);if(!ae.instance_of(_,se)){if(this.filterPredicates!=null&&this.filterPredicates.length>0||this.locationPath!=null)throw new Error("Path expression filter must evaluate to a nodeset if predicates or location path are used");return{nonNodes:_}}return{nodes:ye.applyPredicates(this.filterPredicates||[],f,_.toUnsortedArray())}},ye.applyLocationPath=function(c,f,_){if(!c)return _;var b=c.absolute?[ye.getRoot(f,_)]:_;return ye.applySteps(c.steps,f,b)},ye.prototype.evaluate=function(c){var f=D(new Ht,c),_=this.applyFilter(c,f);if("nonNodes"in _)return _.nonNodes;var b=new se;return b.addArray(ye.applyLocationPath(this.locationPath,f,_.nodes)),b},ye.predicateMatches=function(c,f){var _=c.evaluate(f);return ae.instance_of(_,ge)?f.contextPosition===_.numberValue():_.booleanValue()},ye.predicateString=function(c){return g("[","]",c.toString())},ye.predicatesString=function(c){return h("",a(ye.predicateString,c))},ye.prototype.toString=function(){if(this.filter!=null){var c=p(this.filter);return ae.instance_of(this.filter,he)?g("'","'",c):this.filterPredicates!=null&&this.filterPredicates.length?g("(",")",c)+ye.predicatesString(this.filterPredicates):this.locationPath!=null?c+(this.locationPath.absolute?"":"/")+p(this.locationPath):c}return p(this.locationPath)},ye.getOwnerElement=function(c){if(c.ownerElement)return c.ownerElement;try{if(c.selectSingleNode)return c.selectSingleNode("..")}catch{}for(var f=c.nodeType==O.DOCUMENT_NODE?c:c.ownerDocument,_=f.getElementsByTagName("*"),b=0;b<_.length;b++)for(var v=_.item(b),E=v.attributes,K=0;K<E.length;K++){var _e=E.item(K);if(_e===c)return v}return null},Qt.prototype=new Object,Qt.prototype.constructor=Qt,Qt.superclass=Object.prototype;function Qt(c,f){arguments.length>0&&this.init(c,f)}Qt.prototype.init=function(c,f){this.absolute=c,this.steps=f},Qt.prototype.toString=function(){return(this.absolute?"/":"")+a(p,this.steps).join("/")},Q.prototype=new Object,Q.prototype.constructor=Q,Q.superclass=Object.prototype;function Q(c,f,_){arguments.length>0&&this.init(c,f,_)}Q.prototype.init=function(c,f,_){this.axis=c,this.nodeTest=f,this.predicates=_},Q.prototype.toString=function(){return Q.STEPNAMES[this.axis]+"::"+this.nodeTest.toString()+ye.predicatesString(this.predicates)},Q.ANCESTOR=0,Q.ANCESTORORSELF=1,Q.ATTRIBUTE=2,Q.CHILD=3,Q.DESCENDANT=4,Q.DESCENDANTORSELF=5,Q.FOLLOWING=6,Q.FOLLOWINGSIBLING=7,Q.NAMESPACE=8,Q.PARENT=9,Q.PRECEDING=10,Q.PRECEDINGSIBLING=11,Q.SELF=12,Q.STEPNAMES=o(function(c,f){return c[f[0]]=f[1],c},{},[[Q.ANCESTOR,"ancestor"],[Q.ANCESTORORSELF,"ancestor-or-self"],[Q.ATTRIBUTE,"attribute"],[Q.CHILD,"child"],[Q.DESCENDANT,"descendant"],[Q.DESCENDANTORSELF,"descendant-or-self"],[Q.FOLLOWING,"following"],[Q.FOLLOWINGSIBLING,"following-sibling"],[Q.NAMESPACE,"namespace"],[Q.PARENT,"parent"],[Q.PRECEDING,"preceding"],[Q.PRECEDINGSIBLING,"preceding-sibling"],[Q.SELF,"self"]]),oe.prototype=new Object,oe.prototype.constructor=oe,oe.superclass=Object.prototype;function oe(c,f){arguments.length>0&&this.init(c,f)}oe.prototype.init=function(c,f){this.type=c,this.value=f},oe.prototype.toString=function(){return"<unknown nodetest type>"},oe.prototype.matches=function(c,f){console.warn("unknown node test type")},oe.NAMETESTANY=0,oe.NAMETESTPREFIXANY=1,oe.NAMETESTQNAME=2,oe.COMMENT=3,oe.TEXT=4,oe.PI=5,oe.NODE=6,oe.isNodeType=function(c){return function(f){return u(c,f.nodeType)}},oe.makeNodeTestType=function(c,f,_){var b=_||function(){};return b.prototype=new oe(c),b.prototype.constructor=b,D(b.prototype,f),b},oe.makeNodeTypeTest=function(c,f,_){return new(oe.makeNodeTestType(c,{matches:oe.isNodeType(f),toString:d(_)}))},oe.hasPrefix=function(c){return c.prefix||(c.nodeName||c.tagName).indexOf(":")!==-1},oe.isElementOrAttribute=oe.isNodeType([1,2]),oe.nameSpaceMatches=function(c,f,_){var b=_.namespaceURI||"";if(!c)return!b||f.allowAnyNamespaceForNoPrefix&&!oe.hasPrefix(_);var v=f.namespaceResolver.getNamespace(c,f.expressionContextNode);if(v==null)throw new Error("Cannot resolve QName "+c);return v===b},oe.localNameMatches=function(c,f,_){var b=_.localName||_.nodeName;return f.caseInsensitive?c.toLowerCase()===b.toLowerCase():c===b},oe.NameTestPrefixAny=oe.makeNodeTestType(oe.NAMETESTPREFIXANY,{matches:function(c,f){return oe.isElementOrAttribute(c)&&oe.nameSpaceMatches(this.prefix,f,c)},toString:function(){return this.prefix+":*"}},function(f){this.prefix=f}),oe.NameTestQName=oe.makeNodeTestType(oe.NAMETESTQNAME,{matches:function(c,f){return oe.isNodeType([O.ELEMENT_NODE,O.ATTRIBUTE_NODE,zt.XPATH_NAMESPACE_NODE])(c)&&oe.nameSpaceMatches(this.prefix,f,c)&&oe.localNameMatches(this.localName,f,c)},toString:function(){return this.name}},function(f){var _=f.split(":");this.name=f,this.prefix=_.length>1?_[0]:null,this.localName=_[_.length>1?1:0]}),oe.PITest=oe.makeNodeTestType(oe.PI,{matches:function(c,f){return oe.isNodeType([O.PROCESSING_INSTRUCTION_NODE])(c)&&(c.target||c.nodeName)===this.name},toString:function(){return g('processing-instruction("','")',this.name)}},function(c){this.name=c}),oe.nameTestAny=oe.makeNodeTypeTest(oe.NAMETESTANY,[O.ELEMENT_NODE,O.ATTRIBUTE_NODE,zt.XPATH_NAMESPACE_NODE],"*"),oe.textTest=oe.makeNodeTypeTest(oe.TEXT,[O.TEXT_NODE,O.CDATA_SECTION_NODE],"text()"),oe.commentTest=oe.makeNodeTypeTest(oe.COMMENT,[O.COMMENT_NODE],"comment()"),oe.nodeTest=oe.makeNodeTypeTest(oe.NODE,[O.ELEMENT_NODE,O.ATTRIBUTE_NODE,O.TEXT_NODE,O.CDATA_SECTION_NODE,O.PROCESSING_INSTRUCTION_NODE,O.COMMENT_NODE,O.DOCUMENT_NODE],"node()"),oe.anyPiTest=oe.makeNodeTypeTest(oe.PI,[O.PROCESSING_INSTRUCTION_NODE],"processing-instruction()"),Ze.prototype=new F,Ze.prototype.constructor=Ze,Ze.superclass=F.prototype;function Ze(c){arguments.length>0&&this.init(c)}Ze.prototype.init=function(c){this.variable=c},Ze.prototype.toString=function(){return"$"+this.variable},Ze.prototype.evaluate=function(c){var f=ae.resolveQName(this.variable,c.namespaceResolver,c.contextNode,!1);if(f[0]==null)throw new Error("Cannot resolve QName "+fn);var _=c.variableResolver.getVariable(f[1],f[0]);if(!_)throw Kt.fromMessage("Undeclared variable: "+this.toString());return _},Ot.prototype=new F,Ot.prototype.constructor=Ot,Ot.superclass=F.prototype;function Ot(c,f){arguments.length>0&&this.init(c,f)}Ot.prototype.init=function(c,f){this.functionName=c,this.arguments=f},Ot.prototype.toString=function(){for(var c=this.functionName+"(",f=0;f<this.arguments.length;f++)f>0&&(c+=", "),c+=this.arguments[f].toString();return c+")"},Ot.prototype.evaluate=function(c){var f=bt.getFunctionFromContext(this.functionName,c);if(!f)throw new Error("Unknown function "+this.functionName);var _=[c].concat(this.arguments);return f.apply(c.functionResolver.thisArg,_)};var Fe=new Object;Fe.equals=function(c,f){return c.equals(f)},Fe.notequal=function(c,f){return c.notequal(f)},Fe.lessthan=function(c,f){return c.lessthan(f)},Fe.greaterthan=function(c,f){return c.greaterthan(f)},Fe.lessthanorequal=function(c,f){return c.lessthanorequal(f)},Fe.greaterthanorequal=function(c,f){return c.greaterthanorequal(f)},he.prototype=new F,he.prototype.constructor=he,he.superclass=F.prototype;function he(c){arguments.length>0&&this.init(c)}he.prototype.init=function(c){this.str=String(c)},he.prototype.toString=function(){return this.str},he.prototype.evaluate=function(c){return this},he.prototype.string=function(){return this},he.prototype.number=function(){return new ge(this.str)},he.prototype.bool=function(){return new pe(this.str)},he.prototype.nodeset=function(){throw new Error("Cannot convert string to nodeset")},he.prototype.stringValue=function(){return this.str},he.prototype.numberValue=function(){return this.number().numberValue()},he.prototype.booleanValue=function(){return this.bool().booleanValue()},he.prototype.equals=function(c){return ae.instance_of(c,pe)?this.bool().equals(c):ae.instance_of(c,ge)?this.number().equals(c):ae.instance_of(c,se)?c.compareWithString(this,Fe.equals):new pe(this.str==c.str)},he.prototype.notequal=function(c){return ae.instance_of(c,pe)?this.bool().notequal(c):ae.instance_of(c,ge)?this.number().notequal(c):ae.instance_of(c,se)?c.compareWithString(this,Fe.notequal):new pe(this.str!=c.str)},he.prototype.lessthan=function(c){return this.number().lessthan(c)},he.prototype.greaterthan=function(c){return this.number().greaterthan(c)},he.prototype.lessthanorequal=function(c){return this.number().lessthanorequal(c)},he.prototype.greaterthanorequal=function(c){return this.number().greaterthanorequal(c)},ge.prototype=new F,ge.prototype.constructor=ge,ge.superclass=F.prototype;function ge(c){arguments.length>0&&this.init(c)}ge.prototype.init=function(c){this.num=typeof c=="string"?this.parse(c):Number(c)},ge.prototype.numberFormat=/^\s*-?[0-9]*\.?[0-9]+\s*$/,ge.prototype.parse=function(c){return this.numberFormat.test(c)?parseFloat(c):Number.NaN};function lo(c){for(var f=c.split("e-"),_=f[0].replace(".",""),b=Number(f[1]),v=0;v<b-1;v+=1)_="0"+_;return"0."+_}function Rs(c){for(var f=c.split("e"),_=f[0].replace(".",""),b=Number(f[1]),v=b+1-_.length,E=0;E<v;E+=1)_+="0";return _}ge.prototype.toString=function(){var c=this.num.toString();return c.indexOf("e-")!==-1?lo(c):c.indexOf("e")!==-1?Rs(c):c},ge.prototype.evaluate=function(c){return this},ge.prototype.string=function(){return new he(this.toString())},ge.prototype.number=function(){return this},ge.prototype.bool=function(){return new pe(this.num)},ge.prototype.nodeset=function(){throw new Error("Cannot convert number to nodeset")},ge.prototype.stringValue=function(){return this.string().stringValue()},ge.prototype.numberValue=function(){return this.num},ge.prototype.booleanValue=function(){return this.bool().booleanValue()},ge.prototype.negate=function(){return new ge(-this.num)},ge.prototype.equals=function(c){return ae.instance_of(c,pe)?this.bool().equals(c):ae.instance_of(c,he)?this.equals(c.number()):ae.instance_of(c,se)?c.compareWithNumber(this,Fe.equals):new pe(this.num==c.num)},ge.prototype.notequal=function(c){return ae.instance_of(c,pe)?this.bool().notequal(c):ae.instance_of(c,he)?this.notequal(c.number()):ae.instance_of(c,se)?c.compareWithNumber(this,Fe.notequal):new pe(this.num!=c.num)},ge.prototype.lessthan=function(c){return ae.instance_of(c,se)?c.compareWithNumber(this,Fe.greaterthan):ae.instance_of(c,pe)||ae.instance_of(c,he)?this.lessthan(c.number()):new pe(this.num<c.num)},ge.prototype.greaterthan=function(c){return ae.instance_of(c,se)?c.compareWithNumber(this,Fe.lessthan):ae.instance_of(c,pe)||ae.instance_of(c,he)?this.greaterthan(c.number()):new pe(this.num>c.num)},ge.prototype.lessthanorequal=function(c){return ae.instance_of(c,se)?c.compareWithNumber(this,Fe.greaterthanorequal):ae.instance_of(c,pe)||ae.instance_of(c,he)?this.lessthanorequal(c.number()):new pe(this.num<=c.num)},ge.prototype.greaterthanorequal=function(c){return ae.instance_of(c,se)?c.compareWithNumber(this,Fe.lessthanorequal):ae.instance_of(c,pe)||ae.instance_of(c,he)?this.greaterthanorequal(c.number()):new pe(this.num>=c.num)},ge.prototype.plus=function(c){return new ge(this.num+c.num)},ge.prototype.minus=function(c){return new ge(this.num-c.num)},ge.prototype.multiply=function(c){return new ge(this.num*c.num)},ge.prototype.div=function(c){return new ge(this.num/c.num)},ge.prototype.mod=function(c){return new ge(this.num%c.num)},pe.prototype=new F,pe.prototype.constructor=pe,pe.superclass=F.prototype;function pe(c){arguments.length>0&&this.init(c)}pe.prototype.init=function(c){this.b=!!c},pe.prototype.toString=function(){return this.b.toString()},pe.prototype.evaluate=function(c){return this},pe.prototype.string=function(){return new he(this.b)},pe.prototype.number=function(){return new ge(this.b)},pe.prototype.bool=function(){return this},pe.prototype.nodeset=function(){throw new Error("Cannot convert boolean to nodeset")},pe.prototype.stringValue=function(){return this.string().stringValue()},pe.prototype.numberValue=function(){return this.number().numberValue()},pe.prototype.booleanValue=function(){return this.b},pe.prototype.not=function(){return new pe(!this.b)},pe.prototype.equals=function(c){return ae.instance_of(c,he)||ae.instance_of(c,ge)?this.equals(c.bool()):ae.instance_of(c,se)?c.compareWithBoolean(this,Fe.equals):new pe(this.b==c.b)},pe.prototype.notequal=function(c){return ae.instance_of(c,he)||ae.instance_of(c,ge)?this.notequal(c.bool()):ae.instance_of(c,se)?c.compareWithBoolean(this,Fe.notequal):new pe(this.b!=c.b)},pe.prototype.lessthan=function(c){return this.number().lessthan(c)},pe.prototype.greaterthan=function(c){return this.number().greaterthan(c)},pe.prototype.lessthanorequal=function(c){return this.number().lessthanorequal(c)},pe.prototype.greaterthanorequal=function(c){return this.number().greaterthanorequal(c)},pe.true_=new pe(!0),pe.false_=new pe(!1),st.prototype=new Object,st.prototype.constructor=st,st.superclass=Object.prototype;function st(c){this.init(c)}st.prototype.init=function(c){this.left=null,this.right=null,this.node=c,this.depth=1},st.prototype.balance=function(){var c=this.left==null?0:this.left.depth,f=this.right==null?0:this.right.depth;if(c>f+1){var _=this.left.left==null?0:this.left.left.depth,b=this.left.right==null?0:this.left.right.depth;_<b&&this.left.rotateRR(),this.rotateLL()}else if(c+1<f){var v=this.right.right==null?0:this.right.right.depth,E=this.right.left==null?0:this.right.left.depth;E>v&&this.right.rotateLL(),this.rotateRR()}},st.prototype.rotateLL=function(){var c=this.node,f=this.right;this.node=this.left.node,this.right=this.left,this.left=this.left.left,this.right.left=this.right.right,this.right.right=f,this.right.node=c,this.right.updateInNewLocation(),this.updateInNewLocation()},st.prototype.rotateRR=function(){var c=this.node,f=this.left;this.node=this.right.node,this.left=this.right,this.right=this.right.right,this.left.right=this.left.left,this.left.left=f,this.left.node=c,this.left.updateInNewLocation(),this.updateInNewLocation()},st.prototype.updateInNewLocation=function(){this.getDepthFromChildren()},st.prototype.getDepthFromChildren=function(){this.depth=this.node==null?0:1,this.left!=null&&(this.depth=this.left.depth+1),this.right!=null&&this.depth<=this.right.depth&&(this.depth=this.right.depth+1)};function Ps(c,f){if(c===f)return 0;if(c.compareDocumentPosition){var _=c.compareDocumentPosition(f);return _&1||_&10?1:_&20?-1:0}for(var b=0,v=0,E=c;E!=null;E=E.parentNode||E.ownerElement)b++;for(var K=f;K!=null;K=K.parentNode||K.ownerElement)v++;if(b>v){for(;b>v;)c=c.parentNode||c.ownerElement,b--;if(c===f)return 1}else if(v>b){for(;v>b;)f=f.parentNode||f.ownerElement,v--;if(c===f)return-1}for(var _e=c.parentNode||c.ownerElement,Ne=f.parentNode||f.ownerElement;_e!==Ne;)c=_e,f=Ne,_e=c.parentNode||c.ownerElement,Ne=f.parentNode||f.ownerElement;var ie=ae.isAttribute(c),Ae=ae.isAttribute(f);if(ie&&!Ae)return-1;if(!ie&&Ae)return 1;if(_e)for(var $t=ie?_e.attributes:_e.childNodes,je=$t.length,ar=0;ar<je;ar+=1){var cr=$t[ar];if(cr===c)return-1;if(cr===f)return 1}throw new Error("Unexpected: could not determine node order")}st.prototype.add=function(c){if(c===this.node)return!1;var f=Ps(c,this.node),_=!1;return f==-1?this.left==null?(this.left=new st(c),_=!0):(_=this.left.add(c),_&&this.balance()):f==1&&(this.right==null?(this.right=new st(c),_=!0):(_=this.right.add(c),_&&this.balance())),_&&this.getDepthFromChildren(),_},se.prototype=new F,se.prototype.constructor=se,se.superclass=F.prototype;function se(){this.init()}se.prototype.init=function(){this.tree=null,this.nodes=[],this.size=0},se.prototype.toString=function(){var c=this.first();return c==null?"":this.stringForNode(c)},se.prototype.evaluate=function(c){return this},se.prototype.string=function(){return new he(this.toString())},se.prototype.stringValue=function(){return this.toString()},se.prototype.number=function(){return new ge(this.string())},se.prototype.numberValue=function(){return Number(this.string())},se.prototype.bool=function(){return new pe(this.booleanValue())},se.prototype.booleanValue=function(){return!!this.size},se.prototype.nodeset=function(){return this},se.prototype.stringForNode=function(c){return c.nodeType==O.DOCUMENT_NODE||c.nodeType==O.ELEMENT_NODE||c.nodeType===O.DOCUMENT_FRAGMENT_NODE?this.stringForContainerNode(c):c.nodeType===O.ATTRIBUTE_NODE?c.value||c.nodeValue:c.isNamespaceNode?c.namespace:c.nodeValue},se.prototype.stringForContainerNode=function(c){for(var f="",_=c.firstChild;_!=null;_=_.nextSibling){var b=_.nodeType;(b===1||b===3||b===4||b===9||b===11)&&(f+=this.stringForNode(_))}return f},se.prototype.buildTree=function(){if(!this.tree&&this.nodes.length){this.tree=new st(this.nodes[0]);for(var c=1;c<this.nodes.length;c+=1)this.tree.add(this.nodes[c])}return this.tree},se.prototype.first=function(){var c=this.buildTree();if(c==null)return null;for(;c.left!=null;)c=c.left;return c.node},se.prototype.add=function(c){for(var f=0;f<this.nodes.length;f+=1)if(c===this.nodes[f])return;this.tree=null,this.nodes.push(c),this.size+=1},se.prototype.addArray=function(c){var f=this;i(function(_){f.add(_)},c)},se.prototype.toArray=function(){var c=[];return this.toArrayRec(this.buildTree(),c),c},se.prototype.toArrayRec=function(c,f){c!=null&&(this.toArrayRec(c.left,f),f.push(c.node),this.toArrayRec(c.right,f))},se.prototype.toUnsortedArray=function(){return this.nodes.slice()},se.prototype.compareWithString=function(c,f){for(var _=this.toUnsortedArray(),b=0;b<_.length;b++){var v=_[b],E=new he(this.stringForNode(v)),K=f(E,c);if(K.booleanValue())return K}return new pe(!1)},se.prototype.compareWithNumber=function(c,f){for(var _=this.toUnsortedArray(),b=0;b<_.length;b++){var v=_[b],E=new ge(this.stringForNode(v)),K=f(E,c);if(K.booleanValue())return K}return new pe(!1)},se.prototype.compareWithBoolean=function(c,f){return f(this.bool(),c)},se.prototype.compareWithNodeSet=function(c,f){for(var _=this.toUnsortedArray(),b=function(_e,Ne){return f(Ne,_e)},v=0;v<_.length;v++){var E=new he(this.stringForNode(_[v])),K=c.compareWithString(E,b);if(K.booleanValue())return K}return new pe(!1)},se.compareWith=r(function(c,f){return ae.instance_of(f,he)?this.compareWithString(f,c):ae.instance_of(f,ge)?this.compareWithNumber(f,c):ae.instance_of(f,pe)?this.compareWithBoolean(f,c):this.compareWithNodeSet(f,c)}),se.prototype.equals=se.compareWith(Fe.equals),se.prototype.notequal=se.compareWith(Fe.notequal),se.prototype.lessthan=se.compareWith(Fe.lessthan),se.prototype.greaterthan=se.compareWith(Fe.greaterthan),se.prototype.lessthanorequal=se.compareWith(Fe.lessthanorequal),se.prototype.greaterthanorequal=se.compareWith(Fe.greaterthanorequal),se.prototype.union=function(c){var f=new se;return f.addArray(this.toUnsortedArray()),f.addArray(c.toUnsortedArray()),f},zt.prototype=new Object,zt.prototype.constructor=zt,zt.superclass=Object.prototype;function zt(c,f,_){this.isXPathNamespace=!0,this.ownerDocument=_.ownerDocument,this.nodeName="#namespace",this.prefix=c,this.localName=c,this.namespaceURI=f,this.nodeValue=f,this.ownerElement=_,this.nodeType=zt.XPATH_NAMESPACE_NODE}zt.prototype.toString=function(){return'{ "'+this.prefix+'", "'+this.namespaceURI+'" }'},Ht.prototype=new Object,Ht.prototype.constructor=Ht,Ht.superclass=Object.prototype;function Ht(c,f,_){this.variableResolver=c??new wn,this.namespaceResolver=f??new en,this.functionResolver=_??new bt}Ht.prototype.extend=function(c){return D(new Ht,this,c)},wn.prototype=new Object,wn.prototype.constructor=wn,wn.superclass=Object.prototype;function wn(){}wn.prototype.getVariable=function(c,f){return null},bt.prototype=new Object,bt.prototype.constructor=bt,bt.superclass=Object.prototype;function bt(c){this.thisArg=c??me,this.functions=new Object,this.addStandardFunctions()}bt.prototype.addStandardFunctions=function(){this.functions["{}last"]=me.last,this.functions["{}position"]=me.position,this.functions["{}count"]=me.count,this.functions["{}id"]=me.id,this.functions["{}local-name"]=me.localName,this.functions["{}namespace-uri"]=me.namespaceURI,this.functions["{}name"]=me.name,this.functions["{}string"]=me.string,this.functions["{}concat"]=me.concat,this.functions["{}starts-with"]=me.startsWith,this.functions["{}contains"]=me.contains,this.functions["{}substring-before"]=me.substringBefore,this.functions["{}substring-after"]=me.substringAfter,this.functions["{}substring"]=me.substring,this.functions["{}string-length"]=me.stringLength,this.functions["{}normalize-space"]=me.normalizeSpace,this.functions["{}translate"]=me.translate,this.functions["{}boolean"]=me.boolean_,this.functions["{}not"]=me.not,this.functions["{}true"]=me.true_,this.functions["{}false"]=me.false_,this.functions["{}lang"]=me.lang,this.functions["{}number"]=me.number,this.functions["{}sum"]=me.sum,this.functions["{}floor"]=me.floor,this.functions["{}ceiling"]=me.ceiling,this.functions["{}round"]=me.round},bt.prototype.addFunction=function(c,f,_){this.functions["{"+c+"}"+f]=_},bt.getFunctionFromContext=function(c,f){var _=ae.resolveQName(c,f.namespaceResolver,f.contextNode,!1);if(_[0]===null)throw new Error("Cannot resolve QName "+name);return f.functionResolver.getFunction(_[1],_[0])},bt.prototype.getFunction=function(c,f){return this.functions["{"+f+"}"+c]},en.prototype=new Object,en.prototype.constructor=en,en.superclass=Object.prototype;function en(){}en.prototype.getNamespace=function(c,f){if(c=="xml")return M.XML_NAMESPACE_URI;if(c=="xmlns")return M.XMLNS_NAMESPACE_URI;for(f.nodeType==O.DOCUMENT_NODE?f=f.documentElement:f.nodeType==O.ATTRIBUTE_NODE?f=ye.getOwnerElement(f):f.nodeType!=O.ELEMENT_NODE&&(f=f.parentNode);f!=null&&f.nodeType==O.ELEMENT_NODE;){for(var _=f.attributes,b=0;b<_.length;b++){var v=_.item(b),E=v.name||v.nodeName;if(E==="xmlns"&&c===""||E==="xmlns:"+c)return String(v.value||v.nodeValue)}f=f.parentNode}return null};var me=new Object;me.last=function(c){if(arguments.length!=1)throw new Error("Function last expects ()");return new ge(c.contextSize)},me.position=function(c){if(arguments.length!=1)throw new Error("Function position expects ()");return new ge(c.contextPosition)},me.count=function(){var c=arguments[0],f;if(arguments.length!=2||!ae.instance_of(f=arguments[1].evaluate(c),se))throw new Error("Function count expects (node-set)");return new ge(f.size)},me.id=function(){var c=arguments[0],f;if(arguments.length!=2)throw new Error("Function id expects (object)");f=arguments[1].evaluate(c),ae.instance_of(f,se)?f=f.toArray().join(" "):f=f.stringValue();for(var _=f.split(/[\x0d\x0a\x09\x20]+/),b=new se,v=c.contextNode.nodeType==O.DOCUMENT_NODE?c.contextNode:c.contextNode.ownerDocument,E=0;E<_.length;E++){var K;v.getElementById?K=v.getElementById(_[E]):K=ae.getElementById(v,_[E]),K!=null&&b.add(K)}return b},me.localName=function(c,f){var _;if(arguments.length==1)_=c.contextNode;else if(arguments.length==2)_=f.evaluate(c).first();else throw new Error("Function local-name expects (node-set?)");return _==null?new he(""):new he(_.localName||_.baseName||_.target||_.nodeName||"")},me.namespaceURI=function(){var c=arguments[0],f;if(arguments.length==1)f=c.contextNode;else if(arguments.length==2)f=arguments[1].evaluate(c).first();else throw new Error("Function namespace-uri expects (node-set?)");return f==null?new he(""):new he(f.namespaceURI)},me.name=function(){var c=arguments[0],f;if(arguments.length==1)f=c.contextNode;else if(arguments.length==2)f=arguments[1].evaluate(c).first();else throw new Error("Function name expects (node-set?)");return f==null?new he(""):f.nodeType==O.ELEMENT_NODE?new he(f.nodeName):f.nodeType==O.ATTRIBUTE_NODE?new he(f.name||f.nodeName):f.nodeType===O.PROCESSING_INSTRUCTION_NODE?new he(f.target||f.nodeName):f.localName==null?new he(""):new he(f.localName)},me.string=function(){var c=arguments[0];if(arguments.length==1)return new he(se.prototype.stringForNode(c.contextNode));if(arguments.length==2)return arguments[1].evaluate(c).string();throw new Error("Function string expects (object?)")},me.concat=function(c){if(arguments.length<3)throw new Error("Function concat expects (string, string[, string]*)");for(var f="",_=1;_<arguments.length;_++)f+=arguments[_].evaluate(c).stringValue();return new he(f)},me.startsWith=function(){var c=arguments[0];if(arguments.length!=3)throw new Error("Function startsWith expects (string, string)");var f=arguments[1].evaluate(c).stringValue(),_=arguments[2].evaluate(c).stringValue();return new pe(f.substring(0,_.length)==_)},me.contains=function(){var c=arguments[0];if(arguments.length!=3)throw new Error("Function contains expects (string, string)");var f=arguments[1].evaluate(c).stringValue(),_=arguments[2].evaluate(c).stringValue();return new pe(f.indexOf(_)!==-1)},me.substringBefore=function(){var c=arguments[0];if(arguments.length!=3)throw new Error("Function substring-before expects (string, string)");var f=arguments[1].evaluate(c).stringValue(),_=arguments[2].evaluate(c).stringValue();return new he(f.substring(0,f.indexOf(_)))},me.substringAfter=function(){var c=arguments[0];if(arguments.length!=3)throw new Error("Function substring-after expects (string, string)");var f=arguments[1].evaluate(c).stringValue(),_=arguments[2].evaluate(c).stringValue();if(_.length==0)return new he(f);var b=f.indexOf(_);return b==-1?new he(""):new he(f.substring(b+_.length))},me.substring=function(){var c=arguments[0];if(!(arguments.length==3||arguments.length==4))throw new Error("Function substring expects (string, number, number?)");var f=arguments[1].evaluate(c).stringValue(),_=Math.round(arguments[2].evaluate(c).numberValue())-1,b=arguments.length==4?_+Math.round(arguments[3].evaluate(c).numberValue()):void 0;return new he(f.substring(_,b))},me.stringLength=function(){var c=arguments[0],f;if(arguments.length==1)f=se.prototype.stringForNode(c.contextNode);else if(arguments.length==2)f=arguments[1].evaluate(c).stringValue();else throw new Error("Function string-length expects (string?)");return new ge(f.length)},me.normalizeSpace=function(){var c=arguments[0],f;if(arguments.length==1)f=se.prototype.stringForNode(c.contextNode);else if(arguments.length==2)f=arguments[1].evaluate(c).stringValue();else throw new Error("Function normalize-space expects (string?)");for(var _=0,b=f.length-1;ae.isSpace(f.charCodeAt(b));)b--;for(var v="";_<=b&&ae.isSpace(f.charCodeAt(_));)_++;for(;_<=b;)if(ae.isSpace(f.charCodeAt(_)))for(v+=" ";_<=b&&ae.isSpace(f.charCodeAt(_));)_++;else v+=f.charAt(_),_++;return new he(v)},me.translate=function(c,f,_,b){if(arguments.length!=4)throw new Error("Function translate expects (string, string, string)");var v=f.evaluate(c).stringValue(),E=_.evaluate(c).stringValue(),K=b.evaluate(c).stringValue(),_e=o(function(ie,Ae,$t){return Ae in ie||(ie[Ae]=$t>K.length?"":K[$t]),ie},{},E),Ne=h("",a(function(ie){return ie in _e?_e[ie]:ie},v));return new he(Ne)},me.boolean_=function(){var c=arguments[0];if(arguments.length!=2)throw new Error("Function boolean expects (object)");return arguments[1].evaluate(c).bool()},me.not=function(c,f){if(arguments.length!=2)throw new Error("Function not expects (object)");return f.evaluate(c).bool().not()},me.true_=function(){if(arguments.length!=1)throw new Error("Function true expects ()");return pe.true_},me.false_=function(){if(arguments.length!=1)throw new Error("Function false expects ()");return pe.false_},me.lang=function(){var c=arguments[0];if(arguments.length!=2)throw new Error("Function lang expects (string)");for(var f,_=c.contextNode;_!=null&&_.nodeType!=O.DOCUMENT_NODE;_=_.parentNode){var b=_.getAttributeNS(M.XML_NAMESPACE_URI,"lang");if(b!=null){f=String(b);break}}if(f==null)return pe.false_;var v=arguments[1].evaluate(c).stringValue();return new pe(f.substring(0,v.length)==v&&(f.length==v.length||f.charAt(v.length)=="-"))},me.number=function(){var c=arguments[0];if(!(arguments.length==1||arguments.length==2))throw new Error("Function number expects (object?)");return arguments.length==1?new ge(se.prototype.stringForNode(c.contextNode)):arguments[1].evaluate(c).number()},me.sum=function(){var c=arguments[0],f;if(arguments.length!=2||!ae.instance_of(f=arguments[1].evaluate(c),se))throw new Error("Function sum expects (node-set)");f=f.toUnsortedArray();for(var _=0,b=0;b<f.length;b++)_+=new ge(se.prototype.stringForNode(f[b])).numberValue();return new ge(_)},me.floor=function(){var c=arguments[0];if(arguments.length!=2)throw new Error("Function floor expects (number)");return new ge(Math.floor(arguments[1].evaluate(c).numberValue()))},me.ceiling=function(){var c=arguments[0];if(arguments.length!=2)throw new Error("Function ceiling expects (number)");return new ge(Math.ceil(arguments[1].evaluate(c).numberValue()))},me.round=function(){var c=arguments[0];if(arguments.length!=2)throw new Error("Function round expects (number)");return new ge(Math.round(arguments[1].evaluate(c).numberValue()))};var ae=new Object;ae.isAttribute=function(c){return c&&(c.nodeType===O.ATTRIBUTE_NODE||c.ownerElement)},ae.splitQName=function(c){var f=c.indexOf(":");return f==-1?[null,c]:[c.substring(0,f),c.substring(f+1)]},ae.resolveQName=function(c,f,_,b){var v=ae.splitQName(c);return v[0]!=null?v[0]=f.getNamespace(v[0],_):b?(v[0]=f.getNamespace("",_),v[0]==null&&(v[0]="")):v[0]="",v},ae.isSpace=function(c){return c==9||c==13||c==10||c==32},ae.isLetter=function(c){return c>=65&&c<=90||c>=97&&c<=122||c>=192&&c<=214||c>=216&&c<=246||c>=248&&c<=255||c>=256&&c<=305||c>=308&&c<=318||c>=321&&c<=328||c>=330&&c<=382||c>=384&&c<=451||c>=461&&c<=496||c>=500&&c<=501||c>=506&&c<=535||c>=592&&c<=680||c>=699&&c<=705||c==902||c>=904&&c<=906||c==908||c>=910&&c<=929||c>=931&&c<=974||c>=976&&c<=982||c==986||c==988||c==990||c==992||c>=994&&c<=1011||c>=1025&&c<=1036||c>=1038&&c<=1103||c>=1105&&c<=1116||c>=1118&&c<=1153||c>=1168&&c<=1220||c>=1223&&c<=1224||c>=1227&&c<=1228||c>=1232&&c<=1259||c>=1262&&c<=1269||c>=1272&&c<=1273||c>=1329&&c<=1366||c==1369||c>=1377&&c<=1414||c>=1488&&c<=1514||c>=1520&&c<=1522||c>=1569&&c<=1594||c>=1601&&c<=1610||c>=1649&&c<=1719||c>=1722&&c<=1726||c>=1728&&c<=1742||c>=1744&&c<=1747||c==1749||c>=1765&&c<=1766||c>=2309&&c<=2361||c==2365||c>=2392&&c<=2401||c>=2437&&c<=2444||c>=2447&&c<=2448||c>=2451&&c<=2472||c>=2474&&c<=2480||c==2482||c>=2486&&c<=2489||c>=2524&&c<=2525||c>=2527&&c<=2529||c>=2544&&c<=2545||c>=2565&&c<=2570||c>=2575&&c<=2576||c>=2579&&c<=2600||c>=2602&&c<=2608||c>=2610&&c<=2611||c>=2613&&c<=2614||c>=2616&&c<=2617||c>=2649&&c<=2652||c==2654||c>=2674&&c<=2676||c>=2693&&c<=2699||c==2701||c>=2703&&c<=2705||c>=2707&&c<=2728||c>=2730&&c<=2736||c>=2738&&c<=2739||c>=2741&&c<=2745||c==2749||c==2784||c>=2821&&c<=2828||c>=2831&&c<=2832||c>=2835&&c<=2856||c>=2858&&c<=2864||c>=2866&&c<=2867||c>=2870&&c<=2873||c==2877||c>=2908&&c<=2909||c>=2911&&c<=2913||c>=2949&&c<=2954||c>=2958&&c<=2960||c>=2962&&c<=2965||c>=2969&&c<=2970||c==2972||c>=2974&&c<=2975||c>=2979&&c<=2980||c>=2984&&c<=2986||c>=2990&&c<=2997||c>=2999&&c<=3001||c>=3077&&c<=3084||c>=3086&&c<=3088||c>=3090&&c<=3112||c>=3114&&c<=3123||c>=3125&&c<=3129||c>=3168&&c<=3169||c>=3205&&c<=3212||c>=3214&&c<=3216||c>=3218&&c<=3240||c>=3242&&c<=3251||c>=3253&&c<=3257||c==3294||c>=3296&&c<=3297||c>=3333&&c<=3340||c>=3342&&c<=3344||c>=3346&&c<=3368||c>=3370&&c<=3385||c>=3424&&c<=3425||c>=3585&&c<=3630||c==3632||c>=3634&&c<=3635||c>=3648&&c<=3653||c>=3713&&c<=3714||c==3716||c>=3719&&c<=3720||c==3722||c==3725||c>=3732&&c<=3735||c>=3737&&c<=3743||c>=3745&&c<=3747||c==3749||c==3751||c>=3754&&c<=3755||c>=3757&&c<=3758||c==3760||c>=3762&&c<=3763||c==3773||c>=3776&&c<=3780||c>=3904&&c<=3911||c>=3913&&c<=3945||c>=4256&&c<=4293||c>=4304&&c<=4342||c==4352||c>=4354&&c<=4355||c>=4357&&c<=4359||c==4361||c>=4363&&c<=4364||c>=4366&&c<=4370||c==4412||c==4414||c==4416||c==4428||c==4430||c==4432||c>=4436&&c<=4437||c==4441||c>=4447&&c<=4449||c==4451||c==4453||c==4455||c==4457||c>=4461&&c<=4462||c>=4466&&c<=4467||c==4469||c==4510||c==4520||c==4523||c>=4526&&c<=4527||c>=4535&&c<=4536||c==4538||c>=4540&&c<=4546||c==4587||c==4592||c==4601||c>=7680&&c<=7835||c>=7840&&c<=7929||c>=7936&&c<=7957||c>=7960&&c<=7965||c>=7968&&c<=8005||c>=8008&&c<=8013||c>=8016&&c<=8023||c==8025||c==8027||c==8029||c>=8031&&c<=8061||c>=8064&&c<=8116||c>=8118&&c<=8124||c==8126||c>=8130&&c<=8132||c>=8134&&c<=8140||c>=8144&&c<=8147||c>=8150&&c<=8155||c>=8160&&c<=8172||c>=8178&&c<=8180||c>=8182&&c<=8188||c==8486||c>=8490&&c<=8491||c==8494||c>=8576&&c<=8578||c>=12353&&c<=12436||c>=12449&&c<=12538||c>=12549&&c<=12588||c>=44032&&c<=55203||c>=19968&&c<=40869||c==12295||c>=12321&&c<=12329},ae.isNCNameChar=function(c){return c>=48&&c<=57||c>=1632&&c<=1641||c>=1776&&c<=1785||c>=2406&&c<=2415||c>=2534&&c<=2543||c>=2662&&c<=2671||c>=2790&&c<=2799||c>=2918&&c<=2927||c>=3047&&c<=3055||c>=3174&&c<=3183||c>=3302&&c<=3311||c>=3430&&c<=3439||c>=3664&&c<=3673||c>=3792&&c<=3801||c>=3872&&c<=3881||c==46||c==45||c==95||ae.isLetter(c)||c>=768&&c<=837||c>=864&&c<=865||c>=1155&&c<=1158||c>=1425&&c<=1441||c>=1443&&c<=1465||c>=1467&&c<=1469||c==1471||c>=1473&&c<=1474||c==1476||c>=1611&&c<=1618||c==1648||c>=1750&&c<=1756||c>=1757&&c<=1759||c>=1760&&c<=1764||c>=1767&&c<=1768||c>=1770&&c<=1773||c>=2305&&c<=2307||c==2364||c>=2366&&c<=2380||c==2381||c>=2385&&c<=2388||c>=2402&&c<=2403||c>=2433&&c<=2435||c==2492||c==2494||c==2495||c>=2496&&c<=2500||c>=2503&&c<=2504||c>=2507&&c<=2509||c==2519||c>=2530&&c<=2531||c==2562||c==2620||c==2622||c==2623||c>=2624&&c<=2626||c>=2631&&c<=2632||c>=2635&&c<=2637||c>=2672&&c<=2673||c>=2689&&c<=2691||c==2748||c>=2750&&c<=2757||c>=2759&&c<=2761||c>=2763&&c<=2765||c>=2817&&c<=2819||c==2876||c>=2878&&c<=2883||c>=2887&&c<=2888||c>=2891&&c<=2893||c>=2902&&c<=2903||c>=2946&&c<=2947||c>=3006&&c<=3010||c>=3014&&c<=3016||c>=3018&&c<=3021||c==3031||c>=3073&&c<=3075||c>=3134&&c<=3140||c>=3142&&c<=3144||c>=3146&&c<=3149||c>=3157&&c<=3158||c>=3202&&c<=3203||c>=3262&&c<=3268||c>=3270&&c<=3272||c>=3274&&c<=3277||c>=3285&&c<=3286||c>=3330&&c<=3331||c>=3390&&c<=3395||c>=3398&&c<=3400||c>=3402&&c<=3405||c==3415||c==3633||c>=3636&&c<=3642||c>=3655&&c<=3662||c==3761||c>=3764&&c<=3769||c>=3771&&c<=3772||c>=3784&&c<=3789||c>=3864&&c<=3865||c==3893||c==3895||c==3897||c==3902||c==3903||c>=3953&&c<=3972||c>=3974&&c<=3979||c>=3984&&c<=3989||c==3991||c>=3993&&c<=4013||c>=4017&&c<=4023||c==4025||c>=8400&&c<=8412||c==8417||c>=12330&&c<=12335||c==12441||c==12442||c==183||c==720||c==721||c==903||c==1600||c==3654||c==3782||c==12293||c>=12337&&c<=12341||c>=12445&&c<=12446||c>=12540&&c<=12542},ae.coalesceText=function(c){for(var f=c.firstChild;f!=null;f=f.nextSibling)if(f.nodeType==O.TEXT_NODE||f.nodeType==O.CDATA_SECTION_NODE){var _=f.nodeValue,b=f;for(f=f.nextSibling;f!=null&&(f.nodeType==O.TEXT_NODE||f.nodeType==O.CDATA_SECTION_NODE);){_+=f.nodeValue;var v=f;f=f.nextSibling,v.parentNode.removeChild(v)}if(b.nodeType==O.CDATA_SECTION_NODE){var E=b.parentNode;if(b.nextSibling==null)E.removeChild(b),E.appendChild(E.ownerDocument.createTextNode(_));else{var K=b.nextSibling;E.removeChild(b),E.insertBefore(E.ownerDocument.createTextNode(_),K)}}else b.nodeValue=_;if(f==null)break}else f.nodeType==O.ELEMENT_NODE&&ae.coalesceText(f)},ae.instance_of=function(c,f){for(;c!=null;){if(c.constructor===f)return!0;if(c===Object)return!1;c=c.constructor.superclass}return!1},ae.getElementById=function(c,f){if(c.nodeType==O.ELEMENT_NODE&&(c.getAttribute("id")==f||c.getAttributeNS(null,"id")==f))return c;for(var _=c.firstChild;_!=null;_=_.nextSibling){var b=ae.getElementById(_,f);if(b!=null)return b}return null};var Kt=function(){function c(_,b){var v=b?": "+b.toString():"";switch(_){case f.INVALID_EXPRESSION_ERR:return"Invalid expression"+v;case f.TYPE_ERR:return"Type error"+v}return null}function f(_,b,v){var E=Error.call(this,c(_,b)||v);return E.code=_,E.exception=b,E}return f.prototype=Object.create(Error.prototype),f.prototype.constructor=f,f.superclass=Error,f.prototype.toString=function(){return this.message},f.fromMessage=function(_,b){return new f(null,b,_)},f.INVALID_EXPRESSION_ERR=51,f.TYPE_ERR=52,f}();Dt.prototype={},Dt.prototype.constructor=Dt,Dt.superclass=Object.prototype;function Dt(c,f,_){this.xpath=_.parse(c),this.context=new Ht,this.context.namespaceResolver=new vn(f)}Dt.getOwnerDocument=function(c){return c.nodeType===O.DOCUMENT_NODE?c:c.ownerDocument},Dt.detectHtmlDom=function(c){if(!c)return!1;var f=Dt.getOwnerDocument(c);try{return f.implementation.hasFeature("HTML","2.0")}catch{return!0}},Dt.prototype.evaluate=function(c,f,_){this.context.expressionContextNode=c,this.context.caseInsensitive=Dt.detectHtmlDom(c);var b=this.xpath.evaluate(this.context);return new I(b,f)},vn.prototype={},vn.prototype.constructor=vn,vn.superclass=Object.prototype;function vn(c){this.xpathNSResolver=c}vn.prototype.getNamespace=function(c,f){return this.xpathNSResolver==null?null:this.xpathNSResolver.lookupNamespaceURI(c)},z.prototype={},z.prototype.constructor=z,z.superclass=Object.prototype;function z(c){this.node=c,this.namespaceResolver=new en}z.prototype.lookupNamespaceURI=function(c){return this.namespaceResolver.getNamespace(c,this.node)},I.prototype={},I.prototype.constructor=I,I.superclass=Object.prototype;function I(c,f){switch(f==I.ANY_TYPE&&(c.constructor===he?f=I.STRING_TYPE:c.constructor===ge?f=I.NUMBER_TYPE:c.constructor===pe?f=I.BOOLEAN_TYPE:c.constructor===se&&(f=I.UNORDERED_NODE_ITERATOR_TYPE)),this.resultType=f,f){case I.NUMBER_TYPE:this.numberValue=c.numberValue();return;case I.STRING_TYPE:this.stringValue=c.stringValue();return;case I.BOOLEAN_TYPE:this.booleanValue=c.booleanValue();return;case I.ANY_UNORDERED_NODE_TYPE:case I.FIRST_ORDERED_NODE_TYPE:if(c.constructor===se){this.singleNodeValue=c.first();return}break;case I.UNORDERED_NODE_ITERATOR_TYPE:case I.ORDERED_NODE_ITERATOR_TYPE:if(c.constructor===se){this.invalidIteratorState=!1,this.nodes=c.toArray(),this.iteratorIndex=0;return}break;case I.UNORDERED_NODE_SNAPSHOT_TYPE:case I.ORDERED_NODE_SNAPSHOT_TYPE:if(c.constructor===se){this.nodes=c.toArray(),this.snapshotLength=this.nodes.length;return}break}throw new Kt(Kt.TYPE_ERR)}I.prototype.iterateNext=function(){if(this.resultType!=I.UNORDERED_NODE_ITERATOR_TYPE&&this.resultType!=I.ORDERED_NODE_ITERATOR_TYPE)throw new Kt(Kt.TYPE_ERR);return this.nodes[this.iteratorIndex++]},I.prototype.snapshotItem=function(c){if(this.resultType!=I.UNORDERED_NODE_SNAPSHOT_TYPE&&this.resultType!=I.ORDERED_NODE_SNAPSHOT_TYPE)throw new Kt(Kt.TYPE_ERR);return this.nodes[c]},I.ANY_TYPE=0,I.NUMBER_TYPE=1,I.STRING_TYPE=2,I.BOOLEAN_TYPE=3,I.UNORDERED_NODE_ITERATOR_TYPE=4,I.ORDERED_NODE_ITERATOR_TYPE=5,I.UNORDERED_NODE_SNAPSHOT_TYPE=6,I.ORDERED_NODE_SNAPSHOT_TYPE=7,I.ANY_UNORDERED_NODE_TYPE=8,I.FIRST_ORDERED_NODE_TYPE=9;function U(c,f){c.createExpression=function(_,b){try{return new Dt(_,b,f)}catch(v){throw new Kt(Kt.INVALID_EXPRESSION_ERR,v)}},c.createNSResolver=function(_){return new z(_)},c.evaluate=function(_,b,v,E,K){if(E<0||E>9)throw{code:0,toString:function(){return"Request type not supported"}};return c.createExpression(_,v,f).evaluate(b,E,K)}}try{var ee=!0;try{document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("XPath",null)&&(ee=!1)}catch{}ee&&U(document,new x)}catch{}U(n,new x),function(){var c=new x,f=new en,_=new bt,b=new wn;function v(J){return{getNamespace:function(Te,xt){var lr=J(Te,xt);return lr||f.getNamespace(Te,xt)}}}function E(J){return v(J.getNamespace.bind(J))}function K(J){return v(function(Te){return J[Te]})}function _e(J){return J&&typeof J.getNamespace=="function"?E(J):typeof J=="function"?v(J):typeof J=="object"?K(J):f}function Ne(J){if(J===null||typeof J>"u"||J instanceof he||J instanceof pe||J instanceof ge||J instanceof se)return J;switch(typeof J){case"string":return new he(J);case"boolean":return new pe(J);case"number":return new ge(J)}var Te=new se;return Te.addArray([].concat(J)),Te}function ie(J){return function(Te){var xt=Array.prototype.slice.call(arguments,1).map(function(ww){return ww.evaluate(Te)}),lr=J.apply(this,[].concat(Te,xt));return Ne(lr)}}function Ae(J){return{getFunction:function(Te,xt){var lr=J(Te,xt);return lr?ie(lr):_.getFunction(Te,xt)}}}function $t(J){return Ae(J.getFunction.bind(J))}function je(J){return Ae(function(Te){return J[Te]})}function ar(J){return J&&typeof J.getFunction=="function"?$t(J):typeof J=="function"?Ae(J):typeof J=="object"?je(J):_}function cr(J){return{getVariable:function(Te,xt){var lr=J(Te,xt);return Ne(lr)}}}function hw(J){if(J){if(typeof J.getVariable=="function")return cr(J.getVariable.bind(J));if(typeof J=="function")return cr(J);if(typeof J=="object")return cr(function(Te){return J[Te]})}return b}function Jf(J,Te,xt){J in xt&&(Te[J]=xt[J])}function gw(J){var Te=new Ht;return J?(Te.namespaceResolver=_e(J.namespaces),Te.functionResolver=ar(J.functions),Te.variableResolver=hw(J.variables),Te.expressionContextNode=J.node,Jf("allowAnyNamespaceForNoPrefix",Te,J),Jf("isHtml",Te,J)):Te.namespaceResolver=f,Te}function mw(J,Te){var xt=gw(Te);return J.evaluate(xt)}var _w={evaluate:function(J){return mw(this.expression,J)},evaluateNumber:function(J){return this.evaluate(J).numberValue()},evaluateString:function(J){return this.evaluate(J).stringValue()},evaluateBoolean:function(J){return this.evaluate(J).booleanValue()},evaluateNodeSet:function(J){return this.evaluate(J).nodeset()},select:function(J){return this.evaluateNodeSet(J).toArray()},select1:function(J){return this.select(J)[0]}};function yw(J){var Te=c.parse(J);return Object.create(_w,{expression:{value:Te}})}n.parse=yw}(),D(n,{XPath:M,XPathParser:x,XPathResult:I,Step:Q,PathExpr:ye,NodeTest:oe,LocationPath:Qt,OrOperation:ue,AndOperation:Ce,BarOperation:Z,EqualsOperation:P,NotEqualOperation:L,LessThanOperation:R,GreaterThanOperation:k,LessThanOrEqualOperation:S,GreaterThanOrEqualOperation:j,PlusOperation:V,MinusOperation:de,MultiplyOperation:re,DivOperation:ve,ModOperation:Se,UnaryMinusOperation:W,FunctionCall:Ot,VariableReference:Ze,XPathContext:Ht,XNodeSet:se,XBoolean:pe,XString:he,XNumber:ge,NamespaceResolver:en,FunctionResolver:bt,VariableResolver:wn,Utilities:ae}),n.select=function(c,f,_){return n.selectWithResolver(c,f,null,_)},n.useNamespaces=function(c){var f={mappings:c||{},lookupNamespaceURI:function(_){return this.mappings[_]}};return function(_,b,v){return n.selectWithResolver(_,b,f,v)}},n.selectWithResolver=function(c,f,_,b){var v=new Dt(c,_,new x),E=I.ANY_TYPE,K=v.evaluate(f,E,null);return K.resultType==I.STRING_TYPE?K=K.stringValue:K.resultType==I.NUMBER_TYPE?K=K.numberValue:K.resultType==I.BOOLEAN_TYPE?K=K.booleanValue:(K=K.nodes,b&&(K=K[0])),K},n.select1=function(c,f){return n.select(c,f,!0)};var we=function(c){return c&&typeof c.nodeType=="number"&&Number.isInteger(c.nodeType)&&c.nodeType>=1&&c.nodeType<=11&&typeof c.nodeName=="string"},Qe=function(c){return Array.isArray(c)&&c.every(we)},Re=function(c){return function(f){return we(f)&&f.nodeType===c}};D(n,{isNodeLike:we,isArrayOfNodes:Qe,isElement:Re(O.ELEMENT_NODE),isAttribute:Re(O.ATTRIBUTE_NODE),isTextNode:Re(O.TEXT_NODE),isCDATASection:Re(O.CDATA_SECTION_NODE),isProcessingInstruction:Re(O.PROCESSING_INSTRUCTION_NODE),isComment:Re(O.COMMENT_NODE),isDocumentNode:Re(O.DOCUMENT_NODE),isDocumentTypeNode:Re(O.DOCUMENT_TYPE_NODE),isDocumentFragment:Re(O.DOCUMENT_FRAGMENT_NODE)})})(e)})(Il);var $e={};Object.defineProperty($e,"__esModule",{value:!0});$e.assertIsDocumentFragmentNode=$e.assertIsDocumentTypeNode=$e.assertIsDocumentNode=$e.assertIsCommentNode=$e.assertIsProcessingInstructionNode=$e.assertIsCDATASectionNode=$e.assertIsTextNode=$e.assertIsAttributeNode=$e.assertIsElementNode=$e.isDocumentFragmentNode=$e.isDocumentTypeNode=$e.isDocumentNode=$e.isCommentNode=$e.isProcessingInstructionNode=$e.isCDATASectionNode=$e.isTextNode=$e.isAttributeNode=$e.isElementNode=$e.assertIsArrayOfNodes=$e.isArrayOfNodes=$e.assertIsNodeLike=$e.isNodeLike=$e.NodeTypes=void 0;var We;(function(t){t[t.ELEMENT_NODE=1]="ELEMENT_NODE",t[t.ATTRIBUTE_NODE=2]="ATTRIBUTE_NODE",t[t.TEXT_NODE=3]="TEXT_NODE",t[t.CDATA_SECTION_NODE=4]="CDATA_SECTION_NODE",t[t.PROCESSING_INSTRUCTION_NODE=7]="PROCESSING_INSTRUCTION_NODE",t[t.COMMENT_NODE=8]="COMMENT_NODE",t[t.DOCUMENT_NODE=9]="DOCUMENT_NODE",t[t.DOCUMENT_TYPE_NODE=10]="DOCUMENT_TYPE_NODE",t[t.DOCUMENT_FRAGMENT_NODE=11]="DOCUMENT_FRAGMENT_NODE"})(We||($e.NodeTypes=We={}));function Ol(t){return t&&typeof t=="object"&&Number.isInteger(t.nodeType)&&t.nodeType>=1&&t.nodeType<=11&&typeof t.nodeName=="string"&&typeof t.appendChild=="function"&&typeof t.removeChild=="function"}$e.isNodeLike=Ol;function Q8(t){if(!Ol(t))throw new Error(`Value is not a Node-like object. Received: ${t}`)}$e.assertIsNodeLike=Q8;function Ry(t){return Array.isArray(t)&&t.every(Ol)}$e.isArrayOfNodes=Ry;function e6(t){if(!Ry(t))throw new Error("Value is not an array of Nodes")}$e.assertIsArrayOfNodes=e6;function Pn(t,e){return Ol(e)&&e.nodeType===t}function ir(t,e){const n=Object.keys(We).find(r=>We[r]===t);if(!Pn(t,e))throw new Error(`Value is not of type ${n}`)}const t6=t=>Pn(We.ELEMENT_NODE,t);$e.isElementNode=t6;const n6=t=>Pn(We.ATTRIBUTE_NODE,t);$e.isAttributeNode=n6;const r6=t=>Pn(We.TEXT_NODE,t);$e.isTextNode=r6;const i6=t=>Pn(We.CDATA_SECTION_NODE,t);$e.isCDATASectionNode=i6;const o6=t=>Pn(We.PROCESSING_INSTRUCTION_NODE,t);$e.isProcessingInstructionNode=o6;const s6=t=>Pn(We.COMMENT_NODE,t);$e.isCommentNode=s6;const a6=t=>Pn(We.DOCUMENT_NODE,t);$e.isDocumentNode=a6;const c6=t=>Pn(We.DOCUMENT_TYPE_NODE,t);$e.isDocumentTypeNode=c6;const l6=t=>Pn(We.DOCUMENT_FRAGMENT_NODE,t);$e.isDocumentFragmentNode=l6;const u6=t=>{ir(We.ELEMENT_NODE,t)};$e.assertIsElementNode=u6;const d6=t=>ir(We.ATTRIBUTE_NODE,t);$e.assertIsAttributeNode=d6;const p6=t=>ir(We.TEXT_NODE,t);$e.assertIsTextNode=p6;const f6=t=>ir(We.CDATA_SECTION_NODE,t);$e.assertIsCDATASectionNode=f6;const h6=t=>ir(We.PROCESSING_INSTRUCTION_NODE,t);$e.assertIsProcessingInstructionNode=h6;const g6=t=>ir(We.COMMENT_NODE,t);$e.assertIsCommentNode=g6;const m6=t=>ir(We.DOCUMENT_NODE,t);$e.assertIsDocumentNode=m6;const _6=t=>ir(We.DOCUMENT_TYPE_NODE,t);$e.assertIsDocumentTypeNode=_6;const y6=t=>ir(We.DOCUMENT_FRAGMENT_NODE,t);$e.assertIsDocumentFragmentNode=y6;(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.validateDigestValue=t.findAncestorNs=t.derToPem=t.pemToDer=t.normalizePem=t.BASE64_REGEX=t.EXTRACT_X509_CERTS=t.PEM_FORMAT_REGEX=t.encodeSpecialCharactersInText=t.encodeSpecialCharactersInAttribute=t.findChilds=t.findChildren=t.findAttr=t.isArrayHasLength=void 0;const e=Il,n=$e;function r(F){return Array.isArray(F)&&F.length>0}t.isArrayHasLength=r;function i(F,H,W){return F.localName===H&&(F.namespaceURI===W||W==null)}function o(F,H,W,Y){return F.localName===H&&(!F.namespaceURI&&(Y==null?void 0:Y.namespaceURI)===W||W==null)}function a(F,H,W){for(let Y=0;Y<F.attributes.length;Y++){const ue=F.attributes[Y];if(i(ue,H,W)||o(ue,H,W,F))return ue}return null}t.findAttr=a;function l(F,H,W){const Y=F.documentElement??F,ue=[];for(let Ce=0;Ce<Y.childNodes.length;Ce++){const P=Y.childNodes[Ce];n.isElementNode(P)&&P.localName===H&&(P.namespaceURI===W||W==null)&&ue.push(P)}return ue}t.findChildren=l;function u(F,H,W){return l(F,H,W)}t.findChilds=u;const d={"&":"&amp;","<":"&lt;",'"':"&quot;","\r":"&#xD;","\n":"&#xA;"," ":"&#x9;"},p={"&":"&amp;","<":"&lt;",">":"&gt;","\r":"&#xD;"};function h(F){return F.replace(/([&<"\r\n\t])/g,function(H,W){return d[W]})}t.encodeSpecialCharactersInAttribute=h;function g(F){return F.replace(/([&<>\r])/g,function(H,W){return p[W]})}t.encodeSpecialCharactersInText=g,t.PEM_FORMAT_REGEX=new RegExp("^-----BEGIN [A-Z ]{1,48}-----([^-]*)-----END [A-Z ]{1,48}-----$","s"),t.EXTRACT_X509_CERTS=new RegExp("-----BEGIN CERTIFICATE-----[^-]*-----END CERTIFICATE-----","g"),t.BASE64_REGEX=new RegExp("^(?:[A-Za-z0-9\\+\\/]{4}\\n{0,1})*(?:[A-Za-z0-9\\+\\/]{2}==|[A-Za-z0-9\\+\\/]{3}=)?$","s");function A(F){return`${(F.trim().replace(/(\r\n|\r)/g,`
272
272
  `).match(/.{1,64}/g)??[]).join(`
273
273
  `)}
274
274
  `}t.normalizePem=A;function $(F){if(!t.PEM_FORMAT_REGEX.test(F.trim()))throw new Error("Invalid PEM format.");return Buffer.from(F.replace(/(\r\n|\r)/g,"").replace(/-----BEGIN [A-Z\x20]{1,48}-----\n?/,"").replace(/-----END [A-Z\x20]{1,48}-----\n?/,""),"base64")}t.pemToDer=$;function N(F,H){const W=Buffer.isBuffer(F)?F.toString("base64").trim():F.replace(/(\r\n|\r)/g,"").trim();if(t.PEM_FORMAT_REGEX.test(W))return A(W);if(t.BASE64_REGEX.test(W.replace(/ /g,""))){if(H==null)throw new Error("PEM label is required when DER is given.");const Y=`-----BEGIN ${H}-----
@@ -277,7 +277,7 @@ ${W.replace(/ /g,"")}
277
277
  `:"",a=r?`
278
278
  `:"",l=Hs.encodeSpecialCharactersInText(e.data);return`${o}<!--${l}-->${a}`}process(e,n){n=n||{};const r=n.defaultNs||"",i=n.defaultNsForPrefix||{},o=n.ancestorNamespaces||[],a=[];for(let u=0;u<o.length;u++)a.push(o[u].prefix);return this.processInner(e,a,r,i,o)}getAlgorithmName(){return"http://www.w3.org/TR/2001/REC-xml-c14n-20010315"}}ri.C14nCanonicalization=Py;class w6 extends Py{constructor(){super(),this.includeComments=!0}getAlgorithmName(){return"http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments"}}ri.C14nCanonicalizationWithComments=w6;var ii={};Object.defineProperty(ii,"__esModule",{value:!0});ii.ExclusiveCanonicalizationWithComments=ii.ExclusiveCanonicalization=void 0;const Cr=Cs,fu=$e;function hu(t,e,n){let r=!1;return t.forEach(function(i){i.prefix===e&&i.namespaceURI===n&&(r=!0)}),r}class By{constructor(){this.includeComments=!1,this.includeComments=!1}attrCompare(e,n){if(!e.namespaceURI&&n.namespaceURI)return-1;if(!n.namespaceURI&&e.namespaceURI)return 1;const r=e.namespaceURI+e.localName,i=n.namespaceURI+n.localName;return r===i?0:r<i?-1:1}nsCompare(e,n){const r=e.prefix,i=n.prefix;return r===i?0:r.localeCompare(i)}renderAttrs(e){let n,r;const i=[],o=[];if(fu.isCommentNode(e))return this.renderComment(e);if(e.attributes)for(n=0;n<e.attributes.length;++n)r=e.attributes[n],r.name.indexOf("xmlns")!==0&&o.push(r);o.sort(this.attrCompare);for(r of o)i.push(" ",r.name,'="',Cr.encodeSpecialCharactersInAttribute(r.value),'"');return i.join("")}renderNs(e,n,r,i,o){let a,l;const u=[];let d=r;const p=[],h=e.namespaceURI||"";if(e.prefix?hu(n,e.prefix,e.namespaceURI||i[e.prefix])||(p.push({prefix:e.prefix,namespaceURI:e.namespaceURI||i[e.prefix]}),n.push({prefix:e.prefix,namespaceURI:e.namespaceURI||i[e.prefix]})):r!==h&&(d=e.namespaceURI,u.push(' xmlns="',d,'"')),e.attributes)for(a=0;a<e.attributes.length;++a)l=e.attributes[a],l.prefix&&!hu(n,l.localName,l.value)&&o.indexOf(l.localName)>=0&&(p.push({prefix:l.localName,namespaceURI:l.value}),n.push({prefix:l.localName,namespaceURI:l.value})),l.prefix&&!hu(n,l.prefix,l.namespaceURI)&&l.prefix!=="xmlns"&&l.prefix!=="xml"&&(p.push({prefix:l.prefix,namespaceURI:l.namespaceURI}),n.push({prefix:l.prefix,namespaceURI:l.namespaceURI}));p.sort(this.nsCompare);for(const g of p)u.push(" xmlns:",g.prefix,'="',g.namespaceURI,'"');return{rendered:u.join(""),newDefaultNs:d}}processInner(e,n,r,i,o){if(fu.isCommentNode(e))return this.renderComment(e);if(e.data)return Cr.encodeSpecialCharactersInText(e.data);if(fu.isElementNode(e)){let a,l;const u=this.renderNs(e,n,r,i,o),d=["<",e.tagName,u.rendered,this.renderAttrs(e),">"];for(a=0;a<e.childNodes.length;++a)l=n.slice(0),d.push(this.processInner(e.childNodes[a],l,u.newDefaultNs,i,o));return d.push("</",e.tagName,">"),d.join("")}throw new Error(`Unable to exclusive canonicalize node type: ${e.nodeType}`)}renderComment(e){if(!this.includeComments)return"";const n=e.ownerDocument===e.parentNode;let r=!1,i=!1;if(n){let u=e,d=e;for(;u!=null;){if(u===e.ownerDocument.documentElement){r=!0;break}u=u.nextSibling}for(;d!=null;){if(d===e.ownerDocument.documentElement){i=!0;break}d=d.previousSibling}}const o=i?`
279
279
  `:"",a=r?`
280
- `:"",l=Cr.encodeSpecialCharactersInText(e.data);return`${o}<!--${l}-->${a}`}process(e,n){n=n||{};let r=n.inclusiveNamespacesPrefixList||[];const i=n.defaultNs||"",o=n.defaultNsForPrefix||{},a=n.ancestorNamespaces||[];if(!Cr.isArrayHasLength(r)){const u=Cr.findChildren(e,"CanonicalizationMethod");if(u.length!==0){const d=Cr.findChildren(u[0],"InclusiveNamespaces");d.length!==0&&(r=(d[0].getAttribute("PrefixList")||"").split(" "))}}return Cr.isArrayHasLength(r)&&r.forEach(function(u){a&&a.forEach(function(d){u===d.prefix&&e.setAttributeNS("http://www.w3.org/2000/xmlns/",`xmlns:${u}`,d.namespaceURI)})}),this.processInner(e,[],i,o,r)}getAlgorithmName(){return"http://www.w3.org/2001/10/xml-exc-c14n#"}}ii.ExclusiveCanonicalization=By;class v6 extends By{constructor(){super(),this.includeComments=!0}getAlgorithmName(){return"http://www.w3.org/2001/10/xml-exc-c14n#WithComments"}}ii.ExclusiveCanonicalizationWithComments=v6;var zl={},Dl={},or={},sr={};function b6(t,e,n){if(n===void 0&&(n=Array.prototype),t&&typeof n.find=="function")return n.find.call(t,e);for(var r=0;r<t.length;r++)if(Object.prototype.hasOwnProperty.call(t,r)){var i=t[r];if(e.call(void 0,i,r,t))return i}}function Lf(t,e){return e===void 0&&(e=Object),e&&typeof e.freeze=="function"?e.freeze(t):t}function $6(t,e){if(t===null||typeof t!="object")throw new TypeError("target is not an object");for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}var jy=Lf({HTML:"text/html",isHTML:function(t){return t===jy.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),Ly=Lf({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(t){return t===Ly.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});sr.assign=$6;sr.find=b6;sr.freeze=Lf;sr.MIME_TYPE=jy;sr.NAMESPACE=Ly;var Fy=sr,Nn=Fy.find,Zo=Fy.NAMESPACE;function x6(t){return t!==""}function A6(t){return t?t.split(/[\t\n\f\r ]+/).filter(x6):[]}function E6(t,e){return t.hasOwnProperty(e)||(t[e]=!0),t}function tm(t){if(!t)return[];var e=A6(t);return Object.keys(e.reduce(E6,{}))}function S6(t){return function(e){return t&&t.indexOf(e)!==-1}}function Ts(t,e){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}function Tt(t,e){var n=t.prototype;if(!(n instanceof e)){let r=function(){};r.prototype=e.prototype,r=new r,Ts(n,r),t.prototype=n=r}n.constructor!=t&&(typeof t!="function"&&console.error("unknown Class:"+t),n.constructor=t)}var It={},dn=It.ELEMENT_NODE=1,Hi=It.ATTRIBUTE_NODE=2,hc=It.TEXT_NODE=3,Uy=It.CDATA_SECTION_NODE=4,My=It.ENTITY_REFERENCE_NODE=5,k6=It.ENTITY_NODE=6,qy=It.PROCESSING_INSTRUCTION_NODE=7,Vy=It.COMMENT_NODE=8,Hy=It.DOCUMENT_NODE=9,Ky=It.DOCUMENT_TYPE_NODE=10,Yn=It.DOCUMENT_FRAGMENT_NODE=11,N6=It.NOTATION_NODE=12,mt={},st={};mt.INDEX_SIZE_ERR=(st[1]="Index size error",1);mt.DOMSTRING_SIZE_ERR=(st[2]="DOMString size error",2);var St=mt.HIERARCHY_REQUEST_ERR=(st[3]="Hierarchy request error",3);mt.WRONG_DOCUMENT_ERR=(st[4]="Wrong document",4);mt.INVALID_CHARACTER_ERR=(st[5]="Invalid character",5);mt.NO_DATA_ALLOWED_ERR=(st[6]="No data allowed",6);mt.NO_MODIFICATION_ALLOWED_ERR=(st[7]="No modification allowed",7);var Gy=mt.NOT_FOUND_ERR=(st[8]="Not found",8);mt.NOT_SUPPORTED_ERR=(st[9]="Not supported",9);var nm=mt.INUSE_ATTRIBUTE_ERR=(st[10]="Attribute in use",10);mt.INVALID_STATE_ERR=(st[11]="Invalid state",11);mt.SYNTAX_ERR=(st[12]="Syntax error",12);mt.INVALID_MODIFICATION_ERR=(st[13]="Invalid modification",13);mt.NAMESPACE_ERR=(st[14]="Invalid namespace",14);mt.INVALID_ACCESS_ERR=(st[15]="Invalid access",15);function Ye(t,e){if(e instanceof Error)var n=e;else n=this,Error.call(this,st[t]),this.message=st[t],Error.captureStackTrace&&Error.captureStackTrace(this,Ye);return n.code=t,e&&(this.message=this.message+": "+e),n}Ye.prototype=Error.prototype;Ts(mt,Ye);function Mn(){}Mn.prototype={length:0,item:function(t){return t>=0&&t<this.length?this[t]:null},toString:function(t,e){for(var n=[],r=0;r<this.length;r++)Ai(this[r],n,t,e);return n.join("")},filter:function(t){return Array.prototype.filter.call(this,t)},indexOf:function(t){return Array.prototype.indexOf.call(this,t)}};function Ki(t,e){this._node=t,this._refresh=e,Ff(this)}function Ff(t){var e=t._node._inc||t._node.ownerDocument._inc;if(t._inc!==e){var n=t._refresh(t._node);if(ow(t,"length",n.length),!t.$$length||n.length<t.$$length)for(var r=n.length;r in t;r++)Object.prototype.hasOwnProperty.call(t,r)&&delete t[r];Ts(n,t),t._inc=e}}Ki.prototype.item=function(t){return Ff(this),this[t]||null};Tt(Ki,Mn);function gc(){}function Wy(t,e){for(var n=t.length;n--;)if(t[n]===e)return n}function rm(t,e,n,r){if(r?e[Wy(e,r)]=n:e[e.length++]=n,t){n.ownerElement=t;var i=t.ownerDocument;i&&(r&&Yy(i,t,r),C6(i,t,n))}}function im(t,e,n){var r=Wy(e,n);if(r>=0){for(var i=e.length-1;r<i;)e[r]=e[++r];if(e.length=i,t){var o=t.ownerDocument;o&&(Yy(o,t,n),n.ownerElement=null)}}else throw new Ye(Gy,new Error(t.tagName+"@"+n))}gc.prototype={length:0,item:Mn.prototype.item,getNamedItem:function(t){for(var e=this.length;e--;){var n=this[e];if(n.nodeName==t)return n}},setNamedItem:function(t){var e=t.ownerElement;if(e&&e!=this._ownerElement)throw new Ye(nm);var n=this.getNamedItem(t.nodeName);return rm(this._ownerElement,this,t,n),n},setNamedItemNS:function(t){var e=t.ownerElement,n;if(e&&e!=this._ownerElement)throw new Ye(nm);return n=this.getNamedItemNS(t.namespaceURI,t.localName),rm(this._ownerElement,this,t,n),n},removeNamedItem:function(t){var e=this.getNamedItem(t);return im(this._ownerElement,this,e),e},removeNamedItemNS:function(t,e){var n=this.getNamedItemNS(t,e);return im(this._ownerElement,this,n),n},getNamedItemNS:function(t,e){for(var n=this.length;n--;){var r=this[n];if(r.localName==e&&r.namespaceURI==t)return r}return null}};function Xy(){}Xy.prototype={hasFeature:function(t,e){return!0},createDocument:function(t,e,n){var r=new Is;if(r.implementation=this,r.childNodes=new Mn,r.doctype=n||null,n&&r.appendChild(n),e){var i=r.createElementNS(t,e);r.appendChild(i)}return r},createDocumentType:function(t,e,n){var r=new Rl;return r.name=t,r.nodeName=t,r.publicId=e||"",r.systemId=n||"",r}};function Pe(){}Pe.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(t,e){return mc(this,t,e)},replaceChild:function(t,e){mc(this,t,e,Qy),e&&this.removeChild(e)},removeChild:function(t){return Zy(this,t)},appendChild:function(t){return this.insertBefore(t,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(t){return ap(this.ownerDocument||this,this,t)},normalize:function(){for(var t=this.firstChild;t;){var e=t.nextSibling;e&&e.nodeType==hc&&t.nodeType==hc?(this.removeChild(e),t.appendData(e.data)):(t.normalize(),t=e)}},isSupported:function(t,e){return this.ownerDocument.implementation.hasFeature(t,e)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(t){for(var e=this;e;){var n=e._nsMap;if(n){for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)&&n[r]===t)return r}e=e.nodeType==Hi?e.ownerDocument:e.parentNode}return null},lookupNamespaceURI:function(t){for(var e=this;e;){var n=e._nsMap;if(n&&Object.prototype.hasOwnProperty.call(n,t))return n[t];e=e.nodeType==Hi?e.ownerDocument:e.parentNode}return null},isDefaultNamespace:function(t){var e=this.lookupPrefix(t);return e==null}};function Jy(t){return t=="<"&&"&lt;"||t==">"&&"&gt;"||t=="&"&&"&amp;"||t=='"'&&"&quot;"||"&#"+t.charCodeAt()+";"}Ts(It,Pe);Ts(It,Pe.prototype);function Qo(t,e){if(e(t))return!0;if(t=t.firstChild)do if(Qo(t,e))return!0;while(t=t.nextSibling)}function Is(){this.ownerDocument=this}function C6(t,e,n){t&&t._inc++;var r=n.namespaceURI;r===Zo.XMLNS&&(e._nsMap[n.prefix?n.localName:""]=n.value)}function Yy(t,e,n,r){t&&t._inc++;var i=n.namespaceURI;i===Zo.XMLNS&&delete e._nsMap[n.prefix?n.localName:""]}function Uf(t,e,n){if(t&&t._inc){t._inc++;var r=e.childNodes;if(n)r[r.length++]=n;else{for(var i=e.firstChild,o=0;i;)r[o++]=i,i=i.nextSibling;r.length=o,delete r[r.length]}}}function Zy(t,e){var n=e.previousSibling,r=e.nextSibling;return n?n.nextSibling=r:t.firstChild=r,r?r.previousSibling=n:t.lastChild=n,e.parentNode=null,e.previousSibling=null,e.nextSibling=null,Uf(t.ownerDocument,t),e}function T6(t){return t&&(t.nodeType===Pe.DOCUMENT_NODE||t.nodeType===Pe.DOCUMENT_FRAGMENT_NODE||t.nodeType===Pe.ELEMENT_NODE)}function I6(t){return t&&(Cn(t)||Mf(t)||Zn(t)||t.nodeType===Pe.DOCUMENT_FRAGMENT_NODE||t.nodeType===Pe.COMMENT_NODE||t.nodeType===Pe.PROCESSING_INSTRUCTION_NODE)}function Zn(t){return t&&t.nodeType===Pe.DOCUMENT_TYPE_NODE}function Cn(t){return t&&t.nodeType===Pe.ELEMENT_NODE}function Mf(t){return t&&t.nodeType===Pe.TEXT_NODE}function om(t,e){var n=t.childNodes||[];if(Nn(n,Cn)||Zn(e))return!1;var r=Nn(n,Zn);return!(e&&r&&n.indexOf(r)>n.indexOf(e))}function sm(t,e){var n=t.childNodes||[];function r(o){return Cn(o)&&o!==e}if(Nn(n,r))return!1;var i=Nn(n,Zn);return!(e&&i&&n.indexOf(i)>n.indexOf(e))}function O6(t,e,n){if(!T6(t))throw new Ye(St,"Unexpected parent node type "+t.nodeType);if(n&&n.parentNode!==t)throw new Ye(Gy,"child not in parent");if(!I6(e)||Zn(e)&&t.nodeType!==Pe.DOCUMENT_NODE)throw new Ye(St,"Unexpected node type "+e.nodeType+" for parent node type "+t.nodeType)}function z6(t,e,n){var r=t.childNodes||[],i=e.childNodes||[];if(e.nodeType===Pe.DOCUMENT_FRAGMENT_NODE){var o=i.filter(Cn);if(o.length>1||Nn(i,Mf))throw new Ye(St,"More than one element or text in fragment");if(o.length===1&&!om(t,n))throw new Ye(St,"Element in fragment can not be inserted before doctype")}if(Cn(e)&&!om(t,n))throw new Ye(St,"Only one element can be added and only after doctype");if(Zn(e)){if(Nn(r,Zn))throw new Ye(St,"Only one doctype is allowed");var a=Nn(r,Cn);if(n&&r.indexOf(a)<r.indexOf(n))throw new Ye(St,"Doctype can only be inserted before an element");if(!n&&a)throw new Ye(St,"Doctype can not be appended since element is present")}}function Qy(t,e,n){var r=t.childNodes||[],i=e.childNodes||[];if(e.nodeType===Pe.DOCUMENT_FRAGMENT_NODE){var o=i.filter(Cn);if(o.length>1||Nn(i,Mf))throw new Ye(St,"More than one element or text in fragment");if(o.length===1&&!sm(t,n))throw new Ye(St,"Element in fragment can not be inserted before doctype")}if(Cn(e)&&!sm(t,n))throw new Ye(St,"Only one element can be added and only after doctype");if(Zn(e)){if(Nn(r,function(u){return Zn(u)&&u!==n}))throw new Ye(St,"Only one doctype is allowed");var a=Nn(r,Cn);if(n&&r.indexOf(a)<r.indexOf(n))throw new Ye(St,"Doctype can only be inserted before an element")}}function mc(t,e,n,r){O6(t,e,n),t.nodeType===Pe.DOCUMENT_NODE&&(r||z6)(t,e,n);var i=e.parentNode;if(i&&i.removeChild(e),e.nodeType===Yn){var o=e.firstChild;if(o==null)return e;var a=e.lastChild}else o=a=e;var l=n?n.previousSibling:t.lastChild;o.previousSibling=l,a.nextSibling=n,l?l.nextSibling=o:t.firstChild=o,n==null?t.lastChild=a:n.previousSibling=a;do o.parentNode=t;while(o!==a&&(o=o.nextSibling));return Uf(t.ownerDocument||t,t),e.nodeType==Yn&&(e.firstChild=e.lastChild=null),e}function D6(t,e){return e.parentNode&&e.parentNode.removeChild(e),e.parentNode=t,e.previousSibling=t.lastChild,e.nextSibling=null,e.previousSibling?e.previousSibling.nextSibling=e:t.firstChild=e,t.lastChild=e,Uf(t.ownerDocument,t,e),e}Is.prototype={nodeName:"#document",nodeType:Hy,doctype:null,documentElement:null,_inc:1,insertBefore:function(t,e){if(t.nodeType==Yn){for(var n=t.firstChild;n;){var r=n.nextSibling;this.insertBefore(n,e),n=r}return t}return mc(this,t,e),t.ownerDocument=this,this.documentElement===null&&t.nodeType===dn&&(this.documentElement=t),t},removeChild:function(t){return this.documentElement==t&&(this.documentElement=null),Zy(this,t)},replaceChild:function(t,e){mc(this,t,e,Qy),t.ownerDocument=this,e&&this.removeChild(e),Cn(t)&&(this.documentElement=t)},importNode:function(t,e){return iw(this,t,e)},getElementById:function(t){var e=null;return Qo(this.documentElement,function(n){if(n.nodeType==dn&&n.getAttribute("id")==t)return e=n,!0}),e},getElementsByClassName:function(t){var e=tm(t);return new Ki(this,function(n){var r=[];return e.length>0&&Qo(n.documentElement,function(i){if(i!==n&&i.nodeType===dn){var o=i.getAttribute("class");if(o){var a=t===o;if(!a){var l=tm(o);a=e.every(S6(l))}a&&r.push(i)}}}),r})},createElement:function(t){var e=new oi;e.ownerDocument=this,e.nodeName=t,e.tagName=t,e.localName=t,e.childNodes=new Mn;var n=e.attributes=new gc;return n._ownerElement=e,e},createDocumentFragment:function(){var t=new Pl;return t.ownerDocument=this,t.childNodes=new Mn,t},createTextNode:function(t){var e=new qf;return e.ownerDocument=this,e.appendData(t),e},createComment:function(t){var e=new Vf;return e.ownerDocument=this,e.appendData(t),e},createCDATASection:function(t){var e=new Hf;return e.ownerDocument=this,e.appendData(t),e},createProcessingInstruction:function(t,e){var n=new Gf;return n.ownerDocument=this,n.tagName=n.nodeName=n.target=t,n.nodeValue=n.data=e,n},createAttribute:function(t){var e=new _c;return e.ownerDocument=this,e.name=t,e.nodeName=t,e.localName=t,e.specified=!0,e},createEntityReference:function(t){var e=new Kf;return e.ownerDocument=this,e.nodeName=t,e},createElementNS:function(t,e){var n=new oi,r=e.split(":"),i=n.attributes=new gc;return n.childNodes=new Mn,n.ownerDocument=this,n.nodeName=e,n.tagName=e,n.namespaceURI=t,r.length==2?(n.prefix=r[0],n.localName=r[1]):n.localName=e,i._ownerElement=n,n},createAttributeNS:function(t,e){var n=new _c,r=e.split(":");return n.ownerDocument=this,n.nodeName=e,n.name=e,n.namespaceURI=t,n.specified=!0,r.length==2?(n.prefix=r[0],n.localName=r[1]):n.localName=e,n}};Tt(Is,Pe);function oi(){this._nsMap={}}oi.prototype={nodeType:dn,hasAttribute:function(t){return this.getAttributeNode(t)!=null},getAttribute:function(t){var e=this.getAttributeNode(t);return e&&e.value||""},getAttributeNode:function(t){return this.attributes.getNamedItem(t)},setAttribute:function(t,e){var n=this.ownerDocument.createAttribute(t);n.value=n.nodeValue=""+e,this.setAttributeNode(n)},removeAttribute:function(t){var e=this.getAttributeNode(t);e&&this.removeAttributeNode(e)},appendChild:function(t){return t.nodeType===Yn?this.insertBefore(t,null):D6(this,t)},setAttributeNode:function(t){return this.attributes.setNamedItem(t)},setAttributeNodeNS:function(t){return this.attributes.setNamedItemNS(t)},removeAttributeNode:function(t){return this.attributes.removeNamedItem(t.nodeName)},removeAttributeNS:function(t,e){var n=this.getAttributeNodeNS(t,e);n&&this.removeAttributeNode(n)},hasAttributeNS:function(t,e){return this.getAttributeNodeNS(t,e)!=null},getAttributeNS:function(t,e){var n=this.getAttributeNodeNS(t,e);return n&&n.value||""},setAttributeNS:function(t,e,n){var r=this.ownerDocument.createAttributeNS(t,e);r.value=r.nodeValue=""+n,this.setAttributeNode(r)},getAttributeNodeNS:function(t,e){return this.attributes.getNamedItemNS(t,e)},getElementsByTagName:function(t){return new Ki(this,function(e){var n=[];return Qo(e,function(r){r!==e&&r.nodeType==dn&&(t==="*"||r.tagName==t)&&n.push(r)}),n})},getElementsByTagNameNS:function(t,e){return new Ki(this,function(n){var r=[];return Qo(n,function(i){i!==n&&i.nodeType===dn&&(t==="*"||i.namespaceURI===t)&&(e==="*"||i.localName==e)&&r.push(i)}),r})}};Is.prototype.getElementsByTagName=oi.prototype.getElementsByTagName;Is.prototype.getElementsByTagNameNS=oi.prototype.getElementsByTagNameNS;Tt(oi,Pe);function _c(){}_c.prototype.nodeType=Hi;Tt(_c,Pe);function Os(){}Os.prototype={data:"",substringData:function(t,e){return this.data.substring(t,t+e)},appendData:function(t){t=this.data+t,this.nodeValue=this.data=t,this.length=t.length},insertData:function(t,e){this.replaceData(t,0,e)},appendChild:function(t){throw new Error(st[St])},deleteData:function(t,e){this.replaceData(t,e,"")},replaceData:function(t,e,n){var r=this.data.substring(0,t),i=this.data.substring(t+e);n=r+n+i,this.nodeValue=this.data=n,this.length=n.length}};Tt(Os,Pe);function qf(){}qf.prototype={nodeName:"#text",nodeType:hc,splitText:function(t){var e=this.data,n=e.substring(t);e=e.substring(0,t),this.data=this.nodeValue=e,this.length=e.length;var r=this.ownerDocument.createTextNode(n);return this.parentNode&&this.parentNode.insertBefore(r,this.nextSibling),r}};Tt(qf,Os);function Vf(){}Vf.prototype={nodeName:"#comment",nodeType:Vy};Tt(Vf,Os);function Hf(){}Hf.prototype={nodeName:"#cdata-section",nodeType:Uy};Tt(Hf,Os);function Rl(){}Rl.prototype.nodeType=Ky;Tt(Rl,Pe);function ew(){}ew.prototype.nodeType=N6;Tt(ew,Pe);function tw(){}tw.prototype.nodeType=k6;Tt(tw,Pe);function Kf(){}Kf.prototype.nodeType=My;Tt(Kf,Pe);function Pl(){}Pl.prototype.nodeName="#document-fragment";Pl.prototype.nodeType=Yn;Tt(Pl,Pe);function Gf(){}Gf.prototype.nodeType=qy;Tt(Gf,Pe);function nw(){}nw.prototype.serializeToString=function(t,e,n){return rw.call(t,e,n)};Pe.prototype.toString=rw;function rw(t,e){var n=[],r=this.nodeType==9&&this.documentElement||this,i=r.prefix,o=r.namespaceURI;if(o&&i==null){var i=r.lookupPrefix(o);if(i==null)var a=[{namespace:o,prefix:null}]}return Ai(this,n,t,e,a),n.join("")}function am(t,e,n){var r=t.prefix||"",i=t.namespaceURI;if(!i||r==="xml"&&i===Zo.XML||i===Zo.XMLNS)return!1;for(var o=n.length;o--;){var a=n[o];if(a.prefix===r)return a.namespace!==i}return!0}function gu(t,e,n){t.push(" ",e,'="',n.replace(/[<>&"\t\n\r]/g,Jy),'"')}function Ai(t,e,n,r,i){if(i||(i=[]),r)if(t=r(t),t){if(typeof t=="string"){e.push(t);return}}else return;switch(t.nodeType){case dn:var o=t.attributes,a=o.length,O=t.firstChild,l=t.tagName;n=Zo.isHTML(t.namespaceURI)||n;var u=l;if(!n&&!t.prefix&&t.namespaceURI){for(var d,p=0;p<o.length;p++)if(o.item(p).name==="xmlns"){d=o.item(p).value;break}if(!d)for(var h=i.length-1;h>=0;h--){var g=i[h];if(g.prefix===""&&g.namespace===t.namespaceURI){d=g.namespace;break}}if(d!==t.namespaceURI)for(var h=i.length-1;h>=0;h--){var g=i[h];if(g.namespace===t.namespaceURI){g.prefix&&(u=g.prefix+":"+l);break}}}e.push("<",u);for(var A=0;A<a;A++){var $=o.item(A);$.prefix=="xmlns"?i.push({prefix:$.localName,namespace:$.value}):$.nodeName=="xmlns"&&i.push({prefix:"",namespace:$.value})}for(var A=0;A<a;A++){var $=o.item(A);if(am($,n,i)){var N=$.prefix||"",D=$.namespaceURI;gu(e,N?"xmlns:"+N:"xmlns",D),i.push({prefix:N,namespace:D})}Ai($,e,n,r,i)}if(l===u&&am(t,n,i)){var N=t.prefix||"",D=t.namespaceURI;gu(e,N?"xmlns:"+N:"xmlns",D),i.push({prefix:N,namespace:D})}if(O||n&&!/^(?:meta|link|img|br|hr|input)$/i.test(l)){if(e.push(">"),n&&/^script$/i.test(l))for(;O;)O.data?e.push(O.data):Ai(O,e,n,r,i.slice()),O=O.nextSibling;else for(;O;)Ai(O,e,n,r,i.slice()),O=O.nextSibling;e.push("</",u,">")}else e.push("/>");return;case Hy:case Yn:for(var O=t.firstChild;O;)Ai(O,e,n,r,i.slice()),O=O.nextSibling;return;case Hi:return gu(e,t.name,t.value);case hc:return e.push(t.data.replace(/[<&>]/g,Jy));case Uy:return e.push("<![CDATA[",t.data,"]]>");case Vy:return e.push("<!--",t.data,"-->");case Ky:var x=t.publicId,M=t.systemId;if(e.push("<!DOCTYPE ",t.name),x)e.push(" PUBLIC ",x),M&&M!="."&&e.push(" ",M),e.push(">");else if(M&&M!=".")e.push(" SYSTEM ",M,">");else{var G=t.internalSubset;G&&e.push(" [",G,"]"),e.push(">")}return;case qy:return e.push("<?",t.target," ",t.data,"?>");case My:return e.push("&",t.nodeName,";");default:e.push("??",t.nodeName)}}function iw(t,e,n){var r;switch(e.nodeType){case dn:r=e.cloneNode(!1),r.ownerDocument=t;case Yn:break;case Hi:n=!0;break}if(r||(r=e.cloneNode(!1)),r.ownerDocument=t,r.parentNode=null,n)for(var i=e.firstChild;i;)r.appendChild(iw(t,i,n)),i=i.nextSibling;return r}function ap(t,e,n){var r=new e.constructor;for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){var o=e[i];typeof o!="object"&&o!=r[i]&&(r[i]=o)}switch(e.childNodes&&(r.childNodes=new Mn),r.ownerDocument=t,r.nodeType){case dn:var a=e.attributes,l=r.attributes=new gc,u=a.length;l._ownerElement=r;for(var d=0;d<u;d++)r.setAttributeNode(ap(t,a.item(d),!0));break;case Hi:n=!0}if(n)for(var p=e.firstChild;p;)r.appendChild(ap(t,p,n)),p=p.nextSibling;return r}function ow(t,e,n){t[e]=n}try{if(Object.defineProperty){let t=function(e){switch(e.nodeType){case dn:case Yn:var n=[];for(e=e.firstChild;e;)e.nodeType!==7&&e.nodeType!==8&&n.push(t(e)),e=e.nextSibling;return n.join("");default:return e.nodeValue}};Object.defineProperty(Ki.prototype,"length",{get:function(){return Ff(this),this.$$length}}),Object.defineProperty(Pe.prototype,"textContent",{get:function(){return t(this)},set:function(e){switch(this.nodeType){case dn:case Yn:for(;this.firstChild;)this.removeChild(this.firstChild);(e||String(e))&&this.appendChild(this.ownerDocument.createTextNode(e));break;default:this.data=e,this.value=e,this.nodeValue=e}}}),ow=function(e,n,r){e["$$"+n]=r}}}catch{}or.DocumentType=Rl;or.DOMException=Ye;or.DOMImplementation=Xy;or.Element=oi;or.Node=Pe;or.NodeList=Mn;or.XMLSerializer=nw;var Bl={},sw={};(function(t){var e=sr.freeze;t.XML_ENTITIES=e({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),t.HTML_ENTITIES=e({Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"⁡",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"⁡",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"𝔠",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"𝕔",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"𝒻",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",Gt:"≫",GT:">",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"⁣",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"⁣",InvisibleTimes:"⁢",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"⁢",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"‎",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",Lt:"≪",LT:"<",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"​",NegativeThickSpace:"​",NegativeThinSpace:"​",NegativeVeryThinSpace:"​",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:`
280
+ `:"",l=Cr.encodeSpecialCharactersInText(e.data);return`${o}<!--${l}-->${a}`}process(e,n){n=n||{};let r=n.inclusiveNamespacesPrefixList||[];const i=n.defaultNs||"",o=n.defaultNsForPrefix||{},a=n.ancestorNamespaces||[];if(!Cr.isArrayHasLength(r)){const u=Cr.findChildren(e,"CanonicalizationMethod");if(u.length!==0){const d=Cr.findChildren(u[0],"InclusiveNamespaces");d.length!==0&&(r=(d[0].getAttribute("PrefixList")||"").split(" "))}}return Cr.isArrayHasLength(r)&&r.forEach(function(u){a&&a.forEach(function(d){u===d.prefix&&e.setAttributeNS("http://www.w3.org/2000/xmlns/",`xmlns:${u}`,d.namespaceURI)})}),this.processInner(e,[],i,o,r)}getAlgorithmName(){return"http://www.w3.org/2001/10/xml-exc-c14n#"}}ii.ExclusiveCanonicalization=By;class v6 extends By{constructor(){super(),this.includeComments=!0}getAlgorithmName(){return"http://www.w3.org/2001/10/xml-exc-c14n#WithComments"}}ii.ExclusiveCanonicalizationWithComments=v6;var zl={},Dl={},or={},sr={};function b6(t,e,n){if(n===void 0&&(n=Array.prototype),t&&typeof n.find=="function")return n.find.call(t,e);for(var r=0;r<t.length;r++)if(Object.prototype.hasOwnProperty.call(t,r)){var i=t[r];if(e.call(void 0,i,r,t))return i}}function Lf(t,e){return e===void 0&&(e=Object),e&&typeof e.freeze=="function"?e.freeze(t):t}function $6(t,e){if(t===null||typeof t!="object")throw new TypeError("target is not an object");for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}var jy=Lf({HTML:"text/html",isHTML:function(t){return t===jy.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),Ly=Lf({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(t){return t===Ly.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});sr.assign=$6;sr.find=b6;sr.freeze=Lf;sr.MIME_TYPE=jy;sr.NAMESPACE=Ly;var Fy=sr,Nn=Fy.find,Zo=Fy.NAMESPACE;function x6(t){return t!==""}function A6(t){return t?t.split(/[\t\n\f\r ]+/).filter(x6):[]}function E6(t,e){return t.hasOwnProperty(e)||(t[e]=!0),t}function tm(t){if(!t)return[];var e=A6(t);return Object.keys(e.reduce(E6,{}))}function S6(t){return function(e){return t&&t.indexOf(e)!==-1}}function Ts(t,e){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}function Tt(t,e){var n=t.prototype;if(!(n instanceof e)){let r=function(){};r.prototype=e.prototype,r=new r,Ts(n,r),t.prototype=n=r}n.constructor!=t&&(typeof t!="function"&&console.error("unknown Class:"+t),n.constructor=t)}var It={},dn=It.ELEMENT_NODE=1,Hi=It.ATTRIBUTE_NODE=2,hc=It.TEXT_NODE=3,Uy=It.CDATA_SECTION_NODE=4,My=It.ENTITY_REFERENCE_NODE=5,k6=It.ENTITY_NODE=6,qy=It.PROCESSING_INSTRUCTION_NODE=7,Vy=It.COMMENT_NODE=8,Hy=It.DOCUMENT_NODE=9,Ky=It.DOCUMENT_TYPE_NODE=10,Yn=It.DOCUMENT_FRAGMENT_NODE=11,N6=It.NOTATION_NODE=12,mt={},ot={};mt.INDEX_SIZE_ERR=(ot[1]="Index size error",1);mt.DOMSTRING_SIZE_ERR=(ot[2]="DOMString size error",2);var St=mt.HIERARCHY_REQUEST_ERR=(ot[3]="Hierarchy request error",3);mt.WRONG_DOCUMENT_ERR=(ot[4]="Wrong document",4);mt.INVALID_CHARACTER_ERR=(ot[5]="Invalid character",5);mt.NO_DATA_ALLOWED_ERR=(ot[6]="No data allowed",6);mt.NO_MODIFICATION_ALLOWED_ERR=(ot[7]="No modification allowed",7);var Gy=mt.NOT_FOUND_ERR=(ot[8]="Not found",8);mt.NOT_SUPPORTED_ERR=(ot[9]="Not supported",9);var nm=mt.INUSE_ATTRIBUTE_ERR=(ot[10]="Attribute in use",10);mt.INVALID_STATE_ERR=(ot[11]="Invalid state",11);mt.SYNTAX_ERR=(ot[12]="Syntax error",12);mt.INVALID_MODIFICATION_ERR=(ot[13]="Invalid modification",13);mt.NAMESPACE_ERR=(ot[14]="Invalid namespace",14);mt.INVALID_ACCESS_ERR=(ot[15]="Invalid access",15);function Je(t,e){if(e instanceof Error)var n=e;else n=this,Error.call(this,ot[t]),this.message=ot[t],Error.captureStackTrace&&Error.captureStackTrace(this,Je);return n.code=t,e&&(this.message=this.message+": "+e),n}Je.prototype=Error.prototype;Ts(mt,Je);function Mn(){}Mn.prototype={length:0,item:function(t){return t>=0&&t<this.length?this[t]:null},toString:function(t,e){for(var n=[],r=0;r<this.length;r++)Ai(this[r],n,t,e);return n.join("")},filter:function(t){return Array.prototype.filter.call(this,t)},indexOf:function(t){return Array.prototype.indexOf.call(this,t)}};function Ki(t,e){this._node=t,this._refresh=e,Ff(this)}function Ff(t){var e=t._node._inc||t._node.ownerDocument._inc;if(t._inc!==e){var n=t._refresh(t._node);if(ow(t,"length",n.length),!t.$$length||n.length<t.$$length)for(var r=n.length;r in t;r++)Object.prototype.hasOwnProperty.call(t,r)&&delete t[r];Ts(n,t),t._inc=e}}Ki.prototype.item=function(t){return Ff(this),this[t]||null};Tt(Ki,Mn);function gc(){}function Wy(t,e){for(var n=t.length;n--;)if(t[n]===e)return n}function rm(t,e,n,r){if(r?e[Wy(e,r)]=n:e[e.length++]=n,t){n.ownerElement=t;var i=t.ownerDocument;i&&(r&&Yy(i,t,r),C6(i,t,n))}}function im(t,e,n){var r=Wy(e,n);if(r>=0){for(var i=e.length-1;r<i;)e[r]=e[++r];if(e.length=i,t){var o=t.ownerDocument;o&&(Yy(o,t,n),n.ownerElement=null)}}else throw new Je(Gy,new Error(t.tagName+"@"+n))}gc.prototype={length:0,item:Mn.prototype.item,getNamedItem:function(t){for(var e=this.length;e--;){var n=this[e];if(n.nodeName==t)return n}},setNamedItem:function(t){var e=t.ownerElement;if(e&&e!=this._ownerElement)throw new Je(nm);var n=this.getNamedItem(t.nodeName);return rm(this._ownerElement,this,t,n),n},setNamedItemNS:function(t){var e=t.ownerElement,n;if(e&&e!=this._ownerElement)throw new Je(nm);return n=this.getNamedItemNS(t.namespaceURI,t.localName),rm(this._ownerElement,this,t,n),n},removeNamedItem:function(t){var e=this.getNamedItem(t);return im(this._ownerElement,this,e),e},removeNamedItemNS:function(t,e){var n=this.getNamedItemNS(t,e);return im(this._ownerElement,this,n),n},getNamedItemNS:function(t,e){for(var n=this.length;n--;){var r=this[n];if(r.localName==e&&r.namespaceURI==t)return r}return null}};function Xy(){}Xy.prototype={hasFeature:function(t,e){return!0},createDocument:function(t,e,n){var r=new Is;if(r.implementation=this,r.childNodes=new Mn,r.doctype=n||null,n&&r.appendChild(n),e){var i=r.createElementNS(t,e);r.appendChild(i)}return r},createDocumentType:function(t,e,n){var r=new Rl;return r.name=t,r.nodeName=t,r.publicId=e||"",r.systemId=n||"",r}};function Pe(){}Pe.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(t,e){return mc(this,t,e)},replaceChild:function(t,e){mc(this,t,e,Qy),e&&this.removeChild(e)},removeChild:function(t){return Zy(this,t)},appendChild:function(t){return this.insertBefore(t,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(t){return ap(this.ownerDocument||this,this,t)},normalize:function(){for(var t=this.firstChild;t;){var e=t.nextSibling;e&&e.nodeType==hc&&t.nodeType==hc?(this.removeChild(e),t.appendData(e.data)):(t.normalize(),t=e)}},isSupported:function(t,e){return this.ownerDocument.implementation.hasFeature(t,e)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(t){for(var e=this;e;){var n=e._nsMap;if(n){for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)&&n[r]===t)return r}e=e.nodeType==Hi?e.ownerDocument:e.parentNode}return null},lookupNamespaceURI:function(t){for(var e=this;e;){var n=e._nsMap;if(n&&Object.prototype.hasOwnProperty.call(n,t))return n[t];e=e.nodeType==Hi?e.ownerDocument:e.parentNode}return null},isDefaultNamespace:function(t){var e=this.lookupPrefix(t);return e==null}};function Jy(t){return t=="<"&&"&lt;"||t==">"&&"&gt;"||t=="&"&&"&amp;"||t=='"'&&"&quot;"||"&#"+t.charCodeAt()+";"}Ts(It,Pe);Ts(It,Pe.prototype);function Qo(t,e){if(e(t))return!0;if(t=t.firstChild)do if(Qo(t,e))return!0;while(t=t.nextSibling)}function Is(){this.ownerDocument=this}function C6(t,e,n){t&&t._inc++;var r=n.namespaceURI;r===Zo.XMLNS&&(e._nsMap[n.prefix?n.localName:""]=n.value)}function Yy(t,e,n,r){t&&t._inc++;var i=n.namespaceURI;i===Zo.XMLNS&&delete e._nsMap[n.prefix?n.localName:""]}function Uf(t,e,n){if(t&&t._inc){t._inc++;var r=e.childNodes;if(n)r[r.length++]=n;else{for(var i=e.firstChild,o=0;i;)r[o++]=i,i=i.nextSibling;r.length=o,delete r[r.length]}}}function Zy(t,e){var n=e.previousSibling,r=e.nextSibling;return n?n.nextSibling=r:t.firstChild=r,r?r.previousSibling=n:t.lastChild=n,e.parentNode=null,e.previousSibling=null,e.nextSibling=null,Uf(t.ownerDocument,t),e}function T6(t){return t&&(t.nodeType===Pe.DOCUMENT_NODE||t.nodeType===Pe.DOCUMENT_FRAGMENT_NODE||t.nodeType===Pe.ELEMENT_NODE)}function I6(t){return t&&(Cn(t)||Mf(t)||Zn(t)||t.nodeType===Pe.DOCUMENT_FRAGMENT_NODE||t.nodeType===Pe.COMMENT_NODE||t.nodeType===Pe.PROCESSING_INSTRUCTION_NODE)}function Zn(t){return t&&t.nodeType===Pe.DOCUMENT_TYPE_NODE}function Cn(t){return t&&t.nodeType===Pe.ELEMENT_NODE}function Mf(t){return t&&t.nodeType===Pe.TEXT_NODE}function om(t,e){var n=t.childNodes||[];if(Nn(n,Cn)||Zn(e))return!1;var r=Nn(n,Zn);return!(e&&r&&n.indexOf(r)>n.indexOf(e))}function sm(t,e){var n=t.childNodes||[];function r(o){return Cn(o)&&o!==e}if(Nn(n,r))return!1;var i=Nn(n,Zn);return!(e&&i&&n.indexOf(i)>n.indexOf(e))}function O6(t,e,n){if(!T6(t))throw new Je(St,"Unexpected parent node type "+t.nodeType);if(n&&n.parentNode!==t)throw new Je(Gy,"child not in parent");if(!I6(e)||Zn(e)&&t.nodeType!==Pe.DOCUMENT_NODE)throw new Je(St,"Unexpected node type "+e.nodeType+" for parent node type "+t.nodeType)}function z6(t,e,n){var r=t.childNodes||[],i=e.childNodes||[];if(e.nodeType===Pe.DOCUMENT_FRAGMENT_NODE){var o=i.filter(Cn);if(o.length>1||Nn(i,Mf))throw new Je(St,"More than one element or text in fragment");if(o.length===1&&!om(t,n))throw new Je(St,"Element in fragment can not be inserted before doctype")}if(Cn(e)&&!om(t,n))throw new Je(St,"Only one element can be added and only after doctype");if(Zn(e)){if(Nn(r,Zn))throw new Je(St,"Only one doctype is allowed");var a=Nn(r,Cn);if(n&&r.indexOf(a)<r.indexOf(n))throw new Je(St,"Doctype can only be inserted before an element");if(!n&&a)throw new Je(St,"Doctype can not be appended since element is present")}}function Qy(t,e,n){var r=t.childNodes||[],i=e.childNodes||[];if(e.nodeType===Pe.DOCUMENT_FRAGMENT_NODE){var o=i.filter(Cn);if(o.length>1||Nn(i,Mf))throw new Je(St,"More than one element or text in fragment");if(o.length===1&&!sm(t,n))throw new Je(St,"Element in fragment can not be inserted before doctype")}if(Cn(e)&&!sm(t,n))throw new Je(St,"Only one element can be added and only after doctype");if(Zn(e)){if(Nn(r,function(u){return Zn(u)&&u!==n}))throw new Je(St,"Only one doctype is allowed");var a=Nn(r,Cn);if(n&&r.indexOf(a)<r.indexOf(n))throw new Je(St,"Doctype can only be inserted before an element")}}function mc(t,e,n,r){O6(t,e,n),t.nodeType===Pe.DOCUMENT_NODE&&(r||z6)(t,e,n);var i=e.parentNode;if(i&&i.removeChild(e),e.nodeType===Yn){var o=e.firstChild;if(o==null)return e;var a=e.lastChild}else o=a=e;var l=n?n.previousSibling:t.lastChild;o.previousSibling=l,a.nextSibling=n,l?l.nextSibling=o:t.firstChild=o,n==null?t.lastChild=a:n.previousSibling=a;do o.parentNode=t;while(o!==a&&(o=o.nextSibling));return Uf(t.ownerDocument||t,t),e.nodeType==Yn&&(e.firstChild=e.lastChild=null),e}function D6(t,e){return e.parentNode&&e.parentNode.removeChild(e),e.parentNode=t,e.previousSibling=t.lastChild,e.nextSibling=null,e.previousSibling?e.previousSibling.nextSibling=e:t.firstChild=e,t.lastChild=e,Uf(t.ownerDocument,t,e),e}Is.prototype={nodeName:"#document",nodeType:Hy,doctype:null,documentElement:null,_inc:1,insertBefore:function(t,e){if(t.nodeType==Yn){for(var n=t.firstChild;n;){var r=n.nextSibling;this.insertBefore(n,e),n=r}return t}return mc(this,t,e),t.ownerDocument=this,this.documentElement===null&&t.nodeType===dn&&(this.documentElement=t),t},removeChild:function(t){return this.documentElement==t&&(this.documentElement=null),Zy(this,t)},replaceChild:function(t,e){mc(this,t,e,Qy),t.ownerDocument=this,e&&this.removeChild(e),Cn(t)&&(this.documentElement=t)},importNode:function(t,e){return iw(this,t,e)},getElementById:function(t){var e=null;return Qo(this.documentElement,function(n){if(n.nodeType==dn&&n.getAttribute("id")==t)return e=n,!0}),e},getElementsByClassName:function(t){var e=tm(t);return new Ki(this,function(n){var r=[];return e.length>0&&Qo(n.documentElement,function(i){if(i!==n&&i.nodeType===dn){var o=i.getAttribute("class");if(o){var a=t===o;if(!a){var l=tm(o);a=e.every(S6(l))}a&&r.push(i)}}}),r})},createElement:function(t){var e=new oi;e.ownerDocument=this,e.nodeName=t,e.tagName=t,e.localName=t,e.childNodes=new Mn;var n=e.attributes=new gc;return n._ownerElement=e,e},createDocumentFragment:function(){var t=new Pl;return t.ownerDocument=this,t.childNodes=new Mn,t},createTextNode:function(t){var e=new qf;return e.ownerDocument=this,e.appendData(t),e},createComment:function(t){var e=new Vf;return e.ownerDocument=this,e.appendData(t),e},createCDATASection:function(t){var e=new Hf;return e.ownerDocument=this,e.appendData(t),e},createProcessingInstruction:function(t,e){var n=new Gf;return n.ownerDocument=this,n.tagName=n.nodeName=n.target=t,n.nodeValue=n.data=e,n},createAttribute:function(t){var e=new _c;return e.ownerDocument=this,e.name=t,e.nodeName=t,e.localName=t,e.specified=!0,e},createEntityReference:function(t){var e=new Kf;return e.ownerDocument=this,e.nodeName=t,e},createElementNS:function(t,e){var n=new oi,r=e.split(":"),i=n.attributes=new gc;return n.childNodes=new Mn,n.ownerDocument=this,n.nodeName=e,n.tagName=e,n.namespaceURI=t,r.length==2?(n.prefix=r[0],n.localName=r[1]):n.localName=e,i._ownerElement=n,n},createAttributeNS:function(t,e){var n=new _c,r=e.split(":");return n.ownerDocument=this,n.nodeName=e,n.name=e,n.namespaceURI=t,n.specified=!0,r.length==2?(n.prefix=r[0],n.localName=r[1]):n.localName=e,n}};Tt(Is,Pe);function oi(){this._nsMap={}}oi.prototype={nodeType:dn,hasAttribute:function(t){return this.getAttributeNode(t)!=null},getAttribute:function(t){var e=this.getAttributeNode(t);return e&&e.value||""},getAttributeNode:function(t){return this.attributes.getNamedItem(t)},setAttribute:function(t,e){var n=this.ownerDocument.createAttribute(t);n.value=n.nodeValue=""+e,this.setAttributeNode(n)},removeAttribute:function(t){var e=this.getAttributeNode(t);e&&this.removeAttributeNode(e)},appendChild:function(t){return t.nodeType===Yn?this.insertBefore(t,null):D6(this,t)},setAttributeNode:function(t){return this.attributes.setNamedItem(t)},setAttributeNodeNS:function(t){return this.attributes.setNamedItemNS(t)},removeAttributeNode:function(t){return this.attributes.removeNamedItem(t.nodeName)},removeAttributeNS:function(t,e){var n=this.getAttributeNodeNS(t,e);n&&this.removeAttributeNode(n)},hasAttributeNS:function(t,e){return this.getAttributeNodeNS(t,e)!=null},getAttributeNS:function(t,e){var n=this.getAttributeNodeNS(t,e);return n&&n.value||""},setAttributeNS:function(t,e,n){var r=this.ownerDocument.createAttributeNS(t,e);r.value=r.nodeValue=""+n,this.setAttributeNode(r)},getAttributeNodeNS:function(t,e){return this.attributes.getNamedItemNS(t,e)},getElementsByTagName:function(t){return new Ki(this,function(e){var n=[];return Qo(e,function(r){r!==e&&r.nodeType==dn&&(t==="*"||r.tagName==t)&&n.push(r)}),n})},getElementsByTagNameNS:function(t,e){return new Ki(this,function(n){var r=[];return Qo(n,function(i){i!==n&&i.nodeType===dn&&(t==="*"||i.namespaceURI===t)&&(e==="*"||i.localName==e)&&r.push(i)}),r})}};Is.prototype.getElementsByTagName=oi.prototype.getElementsByTagName;Is.prototype.getElementsByTagNameNS=oi.prototype.getElementsByTagNameNS;Tt(oi,Pe);function _c(){}_c.prototype.nodeType=Hi;Tt(_c,Pe);function Os(){}Os.prototype={data:"",substringData:function(t,e){return this.data.substring(t,t+e)},appendData:function(t){t=this.data+t,this.nodeValue=this.data=t,this.length=t.length},insertData:function(t,e){this.replaceData(t,0,e)},appendChild:function(t){throw new Error(ot[St])},deleteData:function(t,e){this.replaceData(t,e,"")},replaceData:function(t,e,n){var r=this.data.substring(0,t),i=this.data.substring(t+e);n=r+n+i,this.nodeValue=this.data=n,this.length=n.length}};Tt(Os,Pe);function qf(){}qf.prototype={nodeName:"#text",nodeType:hc,splitText:function(t){var e=this.data,n=e.substring(t);e=e.substring(0,t),this.data=this.nodeValue=e,this.length=e.length;var r=this.ownerDocument.createTextNode(n);return this.parentNode&&this.parentNode.insertBefore(r,this.nextSibling),r}};Tt(qf,Os);function Vf(){}Vf.prototype={nodeName:"#comment",nodeType:Vy};Tt(Vf,Os);function Hf(){}Hf.prototype={nodeName:"#cdata-section",nodeType:Uy};Tt(Hf,Os);function Rl(){}Rl.prototype.nodeType=Ky;Tt(Rl,Pe);function ew(){}ew.prototype.nodeType=N6;Tt(ew,Pe);function tw(){}tw.prototype.nodeType=k6;Tt(tw,Pe);function Kf(){}Kf.prototype.nodeType=My;Tt(Kf,Pe);function Pl(){}Pl.prototype.nodeName="#document-fragment";Pl.prototype.nodeType=Yn;Tt(Pl,Pe);function Gf(){}Gf.prototype.nodeType=qy;Tt(Gf,Pe);function nw(){}nw.prototype.serializeToString=function(t,e,n){return rw.call(t,e,n)};Pe.prototype.toString=rw;function rw(t,e){var n=[],r=this.nodeType==9&&this.documentElement||this,i=r.prefix,o=r.namespaceURI;if(o&&i==null){var i=r.lookupPrefix(o);if(i==null)var a=[{namespace:o,prefix:null}]}return Ai(this,n,t,e,a),n.join("")}function am(t,e,n){var r=t.prefix||"",i=t.namespaceURI;if(!i||r==="xml"&&i===Zo.XML||i===Zo.XMLNS)return!1;for(var o=n.length;o--;){var a=n[o];if(a.prefix===r)return a.namespace!==i}return!0}function gu(t,e,n){t.push(" ",e,'="',n.replace(/[<>&"\t\n\r]/g,Jy),'"')}function Ai(t,e,n,r,i){if(i||(i=[]),r)if(t=r(t),t){if(typeof t=="string"){e.push(t);return}}else return;switch(t.nodeType){case dn:var o=t.attributes,a=o.length,O=t.firstChild,l=t.tagName;n=Zo.isHTML(t.namespaceURI)||n;var u=l;if(!n&&!t.prefix&&t.namespaceURI){for(var d,p=0;p<o.length;p++)if(o.item(p).name==="xmlns"){d=o.item(p).value;break}if(!d)for(var h=i.length-1;h>=0;h--){var g=i[h];if(g.prefix===""&&g.namespace===t.namespaceURI){d=g.namespace;break}}if(d!==t.namespaceURI)for(var h=i.length-1;h>=0;h--){var g=i[h];if(g.namespace===t.namespaceURI){g.prefix&&(u=g.prefix+":"+l);break}}}e.push("<",u);for(var A=0;A<a;A++){var $=o.item(A);$.prefix=="xmlns"?i.push({prefix:$.localName,namespace:$.value}):$.nodeName=="xmlns"&&i.push({prefix:"",namespace:$.value})}for(var A=0;A<a;A++){var $=o.item(A);if(am($,n,i)){var N=$.prefix||"",D=$.namespaceURI;gu(e,N?"xmlns:"+N:"xmlns",D),i.push({prefix:N,namespace:D})}Ai($,e,n,r,i)}if(l===u&&am(t,n,i)){var N=t.prefix||"",D=t.namespaceURI;gu(e,N?"xmlns:"+N:"xmlns",D),i.push({prefix:N,namespace:D})}if(O||n&&!/^(?:meta|link|img|br|hr|input)$/i.test(l)){if(e.push(">"),n&&/^script$/i.test(l))for(;O;)O.data?e.push(O.data):Ai(O,e,n,r,i.slice()),O=O.nextSibling;else for(;O;)Ai(O,e,n,r,i.slice()),O=O.nextSibling;e.push("</",u,">")}else e.push("/>");return;case Hy:case Yn:for(var O=t.firstChild;O;)Ai(O,e,n,r,i.slice()),O=O.nextSibling;return;case Hi:return gu(e,t.name,t.value);case hc:return e.push(t.data.replace(/[<&>]/g,Jy));case Uy:return e.push("<![CDATA[",t.data,"]]>");case Vy:return e.push("<!--",t.data,"-->");case Ky:var x=t.publicId,M=t.systemId;if(e.push("<!DOCTYPE ",t.name),x)e.push(" PUBLIC ",x),M&&M!="."&&e.push(" ",M),e.push(">");else if(M&&M!=".")e.push(" SYSTEM ",M,">");else{var G=t.internalSubset;G&&e.push(" [",G,"]"),e.push(">")}return;case qy:return e.push("<?",t.target," ",t.data,"?>");case My:return e.push("&",t.nodeName,";");default:e.push("??",t.nodeName)}}function iw(t,e,n){var r;switch(e.nodeType){case dn:r=e.cloneNode(!1),r.ownerDocument=t;case Yn:break;case Hi:n=!0;break}if(r||(r=e.cloneNode(!1)),r.ownerDocument=t,r.parentNode=null,n)for(var i=e.firstChild;i;)r.appendChild(iw(t,i,n)),i=i.nextSibling;return r}function ap(t,e,n){var r=new e.constructor;for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){var o=e[i];typeof o!="object"&&o!=r[i]&&(r[i]=o)}switch(e.childNodes&&(r.childNodes=new Mn),r.ownerDocument=t,r.nodeType){case dn:var a=e.attributes,l=r.attributes=new gc,u=a.length;l._ownerElement=r;for(var d=0;d<u;d++)r.setAttributeNode(ap(t,a.item(d),!0));break;case Hi:n=!0}if(n)for(var p=e.firstChild;p;)r.appendChild(ap(t,p,n)),p=p.nextSibling;return r}function ow(t,e,n){t[e]=n}try{if(Object.defineProperty){let t=function(e){switch(e.nodeType){case dn:case Yn:var n=[];for(e=e.firstChild;e;)e.nodeType!==7&&e.nodeType!==8&&n.push(t(e)),e=e.nextSibling;return n.join("");default:return e.nodeValue}};Object.defineProperty(Ki.prototype,"length",{get:function(){return Ff(this),this.$$length}}),Object.defineProperty(Pe.prototype,"textContent",{get:function(){return t(this)},set:function(e){switch(this.nodeType){case dn:case Yn:for(;this.firstChild;)this.removeChild(this.firstChild);(e||String(e))&&this.appendChild(this.ownerDocument.createTextNode(e));break;default:this.data=e,this.value=e,this.nodeValue=e}}}),ow=function(e,n,r){e["$$"+n]=r}}}catch{}or.DocumentType=Rl;or.DOMException=Je;or.DOMImplementation=Xy;or.Element=oi;or.Node=Pe;or.NodeList=Mn;or.XMLSerializer=nw;var Bl={},sw={};(function(t){var e=sr.freeze;t.XML_ENTITIES=e({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),t.HTML_ENTITIES=e({Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"⁡",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"⁡",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"𝔠",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"𝕔",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"𝒻",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",Gt:"≫",GT:">",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"⁣",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"⁣",InvisibleTimes:"⁢",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"⁢",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"‎",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",Lt:"≪",LT:"<",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"​",NegativeThickSpace:"​",NegativeThinSpace:"​",NegativeVeryThinSpace:"​",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:`
281
281
  `,nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"⁠",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"‏",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"­",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:" ",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:"  ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"​",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"‍",zwnj:"‌"}),t.entityMap=t.HTML_ENTITIES})(sw);var Wf={},es=sr.NAMESPACE,cp=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,cm=new RegExp("[\\-\\.0-9"+cp.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),lm=new RegExp("^"+cp.source+cm.source+"*(?::"+cp.source+cm.source+"*)?$"),mo=0,ur=1,hi=2,_o=3,gi=4,mi=5,yo=6,Ks=7;function Gi(t,e){this.message=t,this.locator=e,Error.captureStackTrace&&Error.captureStackTrace(this,Gi)}Gi.prototype=new Error;Gi.prototype.name=Gi.name;function aw(){}aw.prototype={parse:function(t,e,n){var r=this.domBuilder;r.startDocument(),cw(e,e={}),R6(t,e,n,r,this.errorHandler),r.endDocument()}};function R6(t,e,n,r,i){function o(j){if(j>65535){j-=65536;var V=55296+(j>>10),de=56320+(j&1023);return String.fromCharCode(V,de)}else return String.fromCharCode(j)}function a(j){var V=j.slice(1,-1);return Object.hasOwnProperty.call(n,V)?n[V]:V.charAt(0)==="#"?o(parseInt(V.substr(1).replace("x","0x"))):(i.error("entity not found:"+j),j)}function l(j){if(j>N){var V=t.substring(N,j).replace(/&#?\w+;/g,a);g&&u(N),r.characters(V,0,j-N),N=j}}function u(j,V){for(;j>=p&&(V=h.exec(t));)d=V.index,p=d+V[0].length,g.lineNumber++;g.columnNumber=j-d+1}for(var d=0,p=0,h=/.*(?:\r\n?|\n)|.*$/g,g=r.locator,A=[{currentNSMap:e}],$={},N=0;;){try{var D=t.indexOf("<",N);if(D<0){if(!t.substr(N).match(/^\s*$/)){var O=r.doc,x=O.createTextNode(t.substr(N));O.appendChild(x),r.currentElement=x}return}switch(D>N&&l(D),t.charAt(D+1)){case"/":var P=t.indexOf(">",D+3),M=t.substring(D+2,P).replace(/[ \t\n\r]+$/g,""),G=A.pop();P<0?(M=t.substring(D+2).replace(/[\s<].*/,""),i.error("end tag name: "+M+" is not complete:"+G.tagName),P=D+1+M.length):M.match(/\s</)&&(M=M.replace(/[\s<].*/,""),i.error("end tag name: "+M+" maybe not complete"),P=D+1+M.length);var F=G.localNSMap,H=G.tagName==M,W=H||G.tagName&&G.tagName.toLowerCase()==M.toLowerCase();if(W){if(r.endElement(G.uri,G.localName,M),F)for(var Y in F)Object.prototype.hasOwnProperty.call(F,Y)&&r.endPrefixMapping(Y);H||i.fatalError("end tag name: "+M+" is not match the current start tagName:"+G.tagName)}else A.push(G);P++;break;case"?":g&&u(D),P=F6(t,D,r);break;case"!":g&&u(D),P=L6(t,D,r,i);break;default:g&&u(D);var ue=new lw,Ce=A[A.length-1].currentNSMap,P=P6(t,D,ue,Ce,a,i),L=ue.length;if(!ue.closed&&j6(t,P,ue.tagName,$)&&(ue.closed=!0,n.nbsp||i.warning("unclosed xml attribute")),g&&L){for(var R=um(g,{}),k=0;k<L;k++){var S=ue[k];u(S.offset),S.locator=um(g,{})}r.locator=R,dm(ue,r,Ce)&&A.push(ue),r.locator=g}else dm(ue,r,Ce)&&A.push(ue);es.isHTML(ue.uri)&&!ue.closed?P=B6(t,P,ue.tagName,a,r):P++}}catch(j){if(j instanceof Gi)throw j;i.error("element parse error: "+j),P=-1}P>N?N=P:l(Math.max(D,N)+1)}}function um(t,e){return e.lineNumber=t.lineNumber,e.columnNumber=t.columnNumber,e}function P6(t,e,n,r,i,o){function a(g,A,$){n.attributeNames.hasOwnProperty(g)&&o.fatalError("Attribute "+g+" redefined"),n.addValue(g,A.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,i),$)}for(var l,u,d=++e,p=mo;;){var h=t.charAt(d);switch(h){case"=":if(p===ur)l=t.slice(e,d),p=_o;else if(p===hi)p=_o;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(p===_o||p===ur)if(p===ur&&(o.warning('attribute value must after "="'),l=t.slice(e,d)),e=d+1,d=t.indexOf(h,e),d>0)u=t.slice(e,d),a(l,u,e-1),p=mi;else throw new Error("attribute value no end '"+h+"' match");else if(p==gi)u=t.slice(e,d),a(l,u,e),o.warning('attribute "'+l+'" missed start quot('+h+")!!"),e=d+1,p=mi;else throw new Error('attribute value must after "="');break;case"/":switch(p){case mo:n.setTagName(t.slice(e,d));case mi:case yo:case Ks:p=Ks,n.closed=!0;case gi:case ur:break;case hi:n.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return o.error("unexpected end of input"),p==mo&&n.setTagName(t.slice(e,d)),d;case">":switch(p){case mo:n.setTagName(t.slice(e,d));case mi:case yo:case Ks:break;case gi:case ur:u=t.slice(e,d),u.slice(-1)==="/"&&(n.closed=!0,u=u.slice(0,-1));case hi:p===hi&&(u=l),p==gi?(o.warning('attribute "'+u+'" missed quot(")!'),a(l,u,e)):((!es.isHTML(r[""])||!u.match(/^(?:disabled|checked|selected)$/i))&&o.warning('attribute "'+u+'" missed value!! "'+u+'" instead!!'),a(u,u,e));break;case _o:throw new Error("attribute value missed!!")}return d;case"€":h=" ";default:if(h<=" ")switch(p){case mo:n.setTagName(t.slice(e,d)),p=yo;break;case ur:l=t.slice(e,d),p=hi;break;case gi:var u=t.slice(e,d);o.warning('attribute "'+u+'" missed quot(")!!'),a(l,u,e);case mi:p=yo;break}else switch(p){case hi:n.tagName,(!es.isHTML(r[""])||!l.match(/^(?:disabled|checked|selected)$/i))&&o.warning('attribute "'+l+'" missed value!! "'+l+'" instead2!!'),a(l,l,e),e=d,p=ur;break;case mi:o.warning('attribute space is required"'+l+'"!!');case yo:p=ur,e=d;break;case _o:p=gi,e=d;break;case Ks:throw new Error("elements closed character '/' and '>' must be connected to")}}d++}}function dm(t,e,n){for(var r=t.tagName,i=null,h=t.length;h--;){var o=t[h],a=o.qName,l=o.value,g=a.indexOf(":");if(g>0)var u=o.prefix=a.slice(0,g),d=a.slice(g+1),p=u==="xmlns"&&d;else d=a,u=null,p=a==="xmlns"&&"";o.localName=d,p!==!1&&(i==null&&(i={},cw(n,n={})),n[p]=i[p]=l,o.uri=es.XMLNS,e.startPrefixMapping(p,l))}for(var h=t.length;h--;){o=t[h];var u=o.prefix;u&&(u==="xml"&&(o.uri=es.XML),u!=="xmlns"&&(o.uri=n[u||""]))}var g=r.indexOf(":");g>0?(u=t.prefix=r.slice(0,g),d=t.localName=r.slice(g+1)):(u=null,d=t.localName=r);var A=t.uri=n[u||""];if(e.startElement(A,d,r,t),t.closed){if(e.endElement(A,d,r),i)for(u in i)Object.prototype.hasOwnProperty.call(i,u)&&e.endPrefixMapping(u)}else return t.currentNSMap=n,t.localNSMap=i,!0}function B6(t,e,n,r,i){if(/^(?:script|textarea)$/i.test(n)){var o=t.indexOf("</"+n+">",e),a=t.substring(e+1,o);if(/[&<]/.test(a))return/^script$/i.test(n)?(i.characters(a,0,a.length),o):(a=a.replace(/&#?\w+;/g,r),i.characters(a,0,a.length),o)}return e+1}function j6(t,e,n,r){var i=r[n];return i==null&&(i=t.lastIndexOf("</"+n+">"),i<e&&(i=t.lastIndexOf("</"+n)),r[n]=i),i<e}function cw(t,e){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}function L6(t,e,n,r){var i=t.charAt(e+2);switch(i){case"-":if(t.charAt(e+3)==="-"){var o=t.indexOf("-->",e+4);return o>e?(n.comment(t,e+4,o-e-4),o+3):(r.error("Unclosed comment"),-1)}else return-1;default:if(t.substr(e+3,6)=="CDATA["){var o=t.indexOf("]]>",e+9);return n.startCDATA(),n.characters(t,e+9,o-e-9),n.endCDATA(),o+3}var a=U6(t,e),l=a.length;if(l>1&&/!doctype/i.test(a[0][0])){var u=a[1][0],d=!1,p=!1;l>3&&(/^public$/i.test(a[2][0])?(d=a[3][0],p=l>4&&a[4][0]):/^system$/i.test(a[2][0])&&(p=a[3][0]));var h=a[l-1];return n.startDTD(u,d,p),n.endDTD(),h.index+h[0].length}}return-1}function F6(t,e,n){var r=t.indexOf("?>",e);if(r){var i=t.substring(e,r).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return i?(i[0].length,n.processingInstruction(i[1],i[2]),r+2):-1}return-1}function lw(){this.attributeNames={}}lw.prototype={setTagName:function(t){if(!lm.test(t))throw new Error("invalid tagName:"+t);this.tagName=t},addValue:function(t,e,n){if(!lm.test(t))throw new Error("invalid attribute:"+t);this.attributeNames[t]=this.length,this[this.length++]={qName:t,value:e,offset:n}},length:0,getLocalName:function(t){return this[t].localName},getLocator:function(t){return this[t].locator},getQName:function(t){return this[t].qName},getURI:function(t){return this[t].uri},getValue:function(t){return this[t].value}};function U6(t,e){var n,r=[],i=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(i.lastIndex=e,i.exec(t);n=i.exec(t);)if(r.push(n),n[1])return r}Wf.XMLReader=aw;Wf.ParseError=Gi;var M6=sr,q6=or,pm=sw,uw=Wf,V6=q6.DOMImplementation,fm=M6.NAMESPACE,H6=uw.ParseError,K6=uw.XMLReader;function dw(t){return t.replace(/\r[\n\u0085]/g,`
282
282
  `).replace(/[\r\u0085\u2028]/g,`
283
283
  `)}function pw(t){this.options=t||{locator:{}}}pw.prototype.parseFromString=function(t,e){var n=this.options,r=new K6,i=n.domBuilder||new zs,o=n.errorHandler,a=n.locator,l=n.xmlns||{},u=/\/x?html?$/.test(e),d=u?pm.HTML_ENTITIES:pm.XML_ENTITIES;a&&i.setDocumentLocator(a),r.errorHandler=G6(o,i,a),r.domBuilder=n.domBuilder||i,u&&(l[""]=fm.HTML),l.xml=l.xml||fm.XML;var p=n.normalizeLineEndings||dw;return t&&typeof t=="string"?r.parse(p(t),l,d):r.errorHandler.error("invalid doc source"),i.doc};function G6(t,e,n){if(!t){if(e instanceof zs)return e;t=e}var r={},i=t instanceof Function;n=n||{};function o(a){var l=t[a];!l&&i&&(l=t.length==2?function(u){t(a,u)}:t),r[a]=l&&function(u){l("[xmldom "+a+"] "+u+lp(n))}||function(){}}return o("warning"),o("error"),o("fatalError"),r}function zs(){this.cdata=!1}function _i(t,e){e.lineNumber=t.lineNumber,e.columnNumber=t.columnNumber}zs.prototype={startDocument:function(){this.doc=new V6().createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(t,e,n,r){var i=this.doc,o=i.createElementNS(t,n||e),a=r.length;Gs(this,o),this.currentElement=o,this.locator&&_i(this.locator,o);for(var l=0;l<a;l++){var t=r.getURI(l),u=r.getValue(l),n=r.getQName(l),d=i.createAttributeNS(t,n);this.locator&&_i(r.getLocator(l),d),d.value=d.nodeValue=u,o.setAttributeNode(d)}},endElement:function(t,e,n){var r=this.currentElement;r.tagName,this.currentElement=r.parentNode},startPrefixMapping:function(t,e){},endPrefixMapping:function(t){},processingInstruction:function(t,e){var n=this.doc.createProcessingInstruction(t,e);this.locator&&_i(this.locator,n),Gs(this,n)},ignorableWhitespace:function(t,e,n){},characters:function(t,e,n){if(t=hm.apply(this,arguments),t){if(this.cdata)var r=this.doc.createCDATASection(t);else var r=this.doc.createTextNode(t);this.currentElement?this.currentElement.appendChild(r):/^\s*$/.test(t)&&this.doc.appendChild(r),this.locator&&_i(this.locator,r)}},skippedEntity:function(t){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(t){(this.locator=t)&&(t.lineNumber=0)},comment:function(t,e,n){t=hm.apply(this,arguments);var r=this.doc.createComment(t);this.locator&&_i(this.locator,r),Gs(this,r)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(t,e,n){var r=this.doc.implementation;if(r&&r.createDocumentType){var i=r.createDocumentType(t,e,n);this.locator&&_i(this.locator,i),Gs(this,i),this.doc.doctype=i}},warning:function(t){console.warn("[xmldom warning] "+t,lp(this.locator))},error:function(t){console.error("[xmldom error] "+t,lp(this.locator))},fatalError:function(t){throw new H6(t,this.locator)}};function lp(t){if(t)return`
@@ -309,4 +309,4 @@ Kliknutím na odkaz níže můžete zahájit nové přihlášení.`,hj="Neplatn
309
309
 
310
310
  Varmista, että avaat kirjautumislinkin samalla selaimella, jolla aloitit kirjautumisen.
311
311
 
312
- Voit aloittaa uuden kirjautumisen klikkaamalla alla olevaa linkkiä.`,HF="Virheellinen linkki",KF="Kirjaudu sisään napsauttamalla painiketta",GF="Kirjaudu sisään",WF="Tai kirjoita koodi osoitteessa {{vendorName}} kirjautumisen loppuun saattamiseksi.",XF="Kirjoita sähköpostiosoitteesi avataksesi tämän ohjelman osoitteessa {{service}}",JF="Yhdistä tilisi {{service}}",YF="Olet kirjautunut sisään nimellä",ZF="Kirjaudu sisään",QF="Kirjoita sähköpostiosoitteesi kirjautuaksesi sisään.",eU="Anna sähköpostiosoitteesi, niin lähetämme sinulle kirjautumiskoodin.",tU="Kirjoita sähköpostiosoitteesi tai puhelinnumerosi kirjautuaksesi sisään",nU="Anna sähköpostiosoitteesi, niin lähetämme sinulle kirjautumislinkin.",rU="Anna puhelinnumerosi kirjautuaksesi sisään",iU="Kirjoita {{authMethod}} kirjautuaksesi sisään.",oU="Kirjaudu ulos",sU="Ei, haluan käyttää toista tiliä",aU="tai",cU="Salasana",lU="Salasana on nollattu",uU="Menestys",dU="Vaihda salasana tilillesi {{vendorName}} ",pU="Vaihda salasana tilillesi {{vendorName}} ",fU="Puhelinnumero",hU="Tietosuojakäytäntö",gU="Uudelleenohjaus",mU="Vahvista salasana",_U="Rekisteröi uusi salasana",yU="Lähetä koodi uudelleen",wU="Vaihda salasana",vU="Kirjoita alla oleva uusi salasanasi sähköpostitiliä varten: ",bU="Napsauta painiketta salasanasi palauttamiseksi",$U="Napsauta painiketta salasanasi palauttamiseksi",xU="Nollaa salasanasi",AU="Vaihda salasana tilillesi {{vendorName}} ",EU="Nollaa salasana",SU="Lähetä",kU="Lähetä minulle uusi maaginen linkki",NU="Muista tarkistaa roskapostikansiosi, jos sähköposti ei ole saapunut.",CU="Aseta salasana",TU="Näytä salasana",IU="Kirjaudu sisään",OU="Rekisteröityminen",zU="Rekisteröidy onnistuneesti",DU="{{code}} on kirjautumiskoodisi {{vendorName}}",RU="Näyttää siltä, että Spotify-tilisi on tällä hetkellä yhdistetty toiseen Sesamy-tiliin. Mutta älä pelkää, me opastamme sinua prosessin läpi, jotta saat tämän korjattua.",PU="Siirry Spotifyn Content Access -sivulle",BU='Aloitetaan poistamalla Spotify-tilisi linkitys. Klikkaa alla olevaa painiketta siirtyäksesi Spotifyn Content Access -sivulle. Kun olet kirjautunut sisään Spotify-tilillesi, etsi Sesamy yhdistettyjen alustojen luettelosta. Napsauta "Unlink" Sesamyn logon vieressä.',jU="Vaihe 1: Poista Spotify-tilisi linkitys",LU="Kun olet onnistuneesti irrottanut Spotify-tilisi, voit yhdistää sen uudelleen Sesamyn kanssa. Toista vain aiemmin tekemäsi vaiheet, jotka johtivat sinut tälle sivulle.",FU="Vaihe 2: Yhdistä Spotify-tilisi uudelleen Sesamyn kanssa",UU="Hups! Spotify-tilisi on jo linkitetty",MU="Valmis",qU="Jos sinulla on kysyttävää tai tarvitset apua, voit ottaa yhteyttä tukitiimiimme.",VU="Ehdot ja edellytykset",HU="Jokin meni pieleen. Yritä uudelleen.",KU="Sähköpostiosoitteesi on vahvistettava. Olemme lähettäneet uuden sähköpostiviestin sähköpostiisi.",GU="Päivitä sähköposti",WU="Käyttäjätiliä ei ole olemassa",XU="Käyttäjätiliä ei ole olemassa",JU="Emme löytäneet käyttäjää, jolla on annettu sähköpostiosoite. Yritä uudelleen.",YU="Yritä uudelleen.",ZU="Validoi koodi",QU="Tarkista sähköpostin vahvistusohjeet postilaatikostasi.",eM="Rekisteröitynyt",tM="Vahvista sähköpostiosoitteesi napsauttamalla painiketta",nM="Vahvista sähköpostiosoitteesi",rM="Vahvista sähköpostiosoitteesi",iM="Vahvista tili",oM="Vahvista sähköpostiosoitteesi",sM="Tarkista sähköpostisi osoitteesta <0>{{email}}</0> ja syötä lähettämämme kuusinumeroinen koodi.",aM="Tervetuloa",cM="Tervetuloa tilillesi {{vendorName}}!",lM="Jatka tällä tilillä",uM="Kyllä, jatka {{text}}",dM="Kyllä, jatka olemassa olevalla tilillä",pM={"Server error: Invalid code":"Virheellinen koodi",account_detected:PL,account_title:BL,account_with_sso_provider:jL,agree_to:LL,and:FL,auth_method_email:UL,auth_method_email_or_phone:ML,auth_method_phone:qL,callback_url_mismatch:VL,callback_url_not_allowed:HL,check_email_title:KL,click_to_sign_up_description:GL,code_email_enter_code:WL,code_email_subject:XL,code_email_title:JL,code_expired:YL,code_invalid:ZL,code_sent_template:QL,code_used:eF,code_valid_30_minutes:tF,confirm_password:nF,contact_support:rF,contact_us:iF,continue:"Jatka",continue_social_login:oF,continue_with:sF,continue_with_sso_provider_headline:aF,copyright:cF,copyright_sesamy:lF,create_account_description:uF,create_account_email_invalid:dF,create_account_passwords_didnt_match:pF,create_account_title:fF,create_account_weak_password:hF,create_new_account_link:gF,create_password_account_title:mF,currently_logged_in_as:_F,email:yF,email_changed_to_template:wF,email_or_phone_placeholder:vF,email_placeholder:bF,email_validated:$F,email_validated_cta:xF,email_verification_for_signup_sent_description:AF,email_verification_for_signup_sent_title:EF,enter_a_code_btn:SF,enter_email_for_verification_description:kF,enter_new_email:NF,enter_new_password_placeholder:CF,enter_password:TF,enter_password_description:IF,enter_your_password_btn:OF,expired_code:zF,fokus_info_message:DF,forgot_password_cta:RF,forgot_password_description:PF,forgot_password_email_sent:BF,forgot_password_link:jF,forgot_password_title:LF,go_back:FF,hide_password:UF,"invalid-email":"Virheellinen sähköpostiosoite",invalid_identifier:MF,invalid_password:qF,invalid_session_body:VF,invalid_session_title:HF,link_email_click_to_login:KF,link_email_login:GF,link_email_or_enter_code:WF,link_page_body:XF,link_page_headline:JF,logged_in_as:YF,login:ZF,login_description:QF,login_description_code:eU,login_description_combined:tU,login_description_link:nU,login_description_phone:rU,login_description_template:iU,logout:oU,no_use_another:sU,or:aU,password:cU,password_has_been_reset:lU,password_has_been_reset_title:uU,password_reset_subject:dU,password_reset_title:pU,phone_placeholder:fU,privacy_policy:hU,redirecting:gU,reenter_new_password_placeholder:mU,register_password_account:_U,resend_code:yU,reset_password_cta:wU,reset_password_description:vU,reset_password_email_click_to_reset:bU,reset_password_email_cta:$U,reset_password_email_reset:xU,reset_password_subject:AU,reset_password_title:EU,send:SU,send_me_a_new_magic_link:kU,sent_code_spam:NU,set_password:CU,show_password:TU,sign_in:IU,signup:OU,signup_success:zU,sms_code_text:DU,spotify_already_linked_body:RU,spotify_already_linked_cta:PU,spotify_already_linked_step1_body:BU,spotify_already_linked_step1_title:jU,spotify_already_linked_step2_body:LU,spotify_already_linked_step2_title:FU,spotify_already_linked_title:UU,success:MU,support_info:qU,terms:VU,unexpected_error_try_again:HU,unverified_email:KU,update_email:GU,user_account_does_not_exist:WU,user_not_found:XU,user_not_found_body:JU,user_not_found_cta:YU,validate_code:ZU,validate_email_body:QU,validate_email_title:eM,verify_email_click_to_verify:tM,verify_email_subject:nM,verify_email_title:rM,verify_email_verify:iM,verify_your_email:oM,we_sent_a_code_to:sM,welcome:aM,welcome_to_your_account:cM,yes_continue:lM,yes_continue_with:uM,yes_continue_with_existing_account:dM},fM="Konto opdaget",hM="Konto",gM="Vi har opdaget, at du allerede har oprettet en konto gennem",mM="Når du logger ind, accepterer du vores",_M="og",yM="e-mail-adresse",wM="e-mail eller telefonnummer",vM="Telefonnummer",bM="Uoverensstemmelse mellem URL og tilbagekald",$M="Den angivne redirect_uri er ikke på listen over tilladte tilbagekalds-URL'er.",xM="Fortsæt med brugeren",AM="Klik på knappen for at oprette en ny adgangskodekonto.",EM="Indtast koden på {{vendorName}} for at gennemføre login.",SM="Velkommen til {{vendorName}}! {{code}} er login-koden",kM="Velkommen til {{vendorName}}! {{code}} er login-koden",NM="Koden er udløbet",CM="Ugyldig kode",TM="Tjek venligst <0>{{username}}</0> og indtast den sekscifrede kode, som vi har sendt til dig.",IM="Koden er allerede brugt",OM="Koden er gyldig i 30 minutter",zM="Bekræft adgangskode",DM="Har du brug for hjælp?",RM="Kontakt os",PM="eller fortsæt med social konto",BM="Fortsæt med {{provider}}",jM="Vil du gerne fortsætte med din eksisterende konto?",LM="Ophavsret © 2023 SESAMY. Alle rettigheder forbeholdes.",FM="©2023 Sesamy",UM="Vælg en adgangskode med en blanding af store og små bogstaver, tal og symboler.",MM="Indtast venligst en gyldig e-mailadresse.",qM="Adgangskoderne stemte ikke overens. Prøv igen.",VM="Vælg adgangskode",HM="Adgangskoden skal være mindst 8 tegn lang og indeholde mindst et lille bogstav, et stort bogstav, et tal og et symbol.",KM="Opret ny konto",GM="Tilmeld dig med adgangskode",WM="Du er i øjeblikket logget ind som <0>{{email}}</0>",XM="E-mail",JM="E-mail ændret til <0>{{email}}</0> ",YM="E-mail eller telefonnummer",ZM="E-mail-adresse",QM="Din e-mailadresse er blevet valideret",eq="Indtast nu din adgangskode for at logge ind igen",tq="Der er sendt en e-mail til <0>{{email}}</0> med et bekræftelseslink. Klik på linket for at bekræfte din e-mailadresse og angive en adgangskode.",nq="E-mail-bekræftelse sendt",rq="Indtast en kode",iq="Vi sender dig et bekræftelseslink for at sikre, at du ejer denne e-mailadresse.",oq="Indtast ny e-mail",sq="Indtast ny adgangskode",aq="Indtast adgangskode",cq="Indtast din e-mailadresse og adgangskode for at logge ind.",lq="Indtast din adgangskode",uq="Det magiske link er udløbet. Klik på knappen nedenfor for at modtage et nyt link i din indbakke.",dq="Hej! Vi har opdateret vores login-oplevelse. <0>Klik her for at lære mere om det.</0>",pq="Send e-mail til nulstilling af adgangskode",fq="Klik på knappen nedenfor, så sender vi instruktioner om, hvordan du nulstiller din adgangskode.",hq="E-mail til nulstilling af adgangskode sendt",gq="Har du glemt din adgangskode?",mq="Har du glemt din adgangskode?",_q="Gå tilbage",yq="Skjul adgangskode",wq="Ugyldig identifikator",vq="Ugyldig adgangskode",bq="Linket er ikke længere gyldigt. Sørg for at åbne login-linket i den samme browser, som du startede login med. Du kan klikke på linket nedenfor for at starte et nyt login.",$q="Ugyldigt link",xq="Klik på knappen for at logge ind",Aq="Login",Eq="Eller indtast koden på {{vendorName}} for at gennemføre login.",Sq="Indtast din e-mailadresse for at låse op for dette show på {{service}}",kq="Forbind din konto med {{service}}",Nq="Du er logget ind som",Cq="Login",Tq="Indtast din e-mailadresse for at logge ind.",Iq="Indtast din e-mailadresse, så sender vi dig en login-kode.",Oq="Indtast din e-mail eller dit telefonnummer for at logge ind",zq="Indtast din e-mailadresse, så sender vi dig et login-link.",Dq="Indtast dit telefonnummer for at logge ind",Rq="Indtast din {{authMethod}} for at logge ind.",Pq="Log ud",Bq="Nej, jeg vil bruge en anden konto",jq="eller",Lq="Adgangskode",Fq="Adgangskoden er blevet nulstillet",Uq="Succes",Mq="Skift adgangskode til din {{vendorName}} -konto",qq="Skift adgangskode til din {{vendorName}} -konto",Vq="Telefonnummer",Hq="Politik for beskyttelse af personlige oplysninger",Kq="Omdirigering",Gq="Bekræft adgangskode",Wq="Registrer en ny adgangskode",Xq="Send koden igen",Jq="Skift adgangskode",Yq="Indtast din nye adgangskode til e-mailkontoen nedenfor: ",Zq="Klik på knappen for at nulstille din adgangskode",Qq="Klik på knappen for at nulstille din adgangskode",eV="Nulstil din adgangskode",tV="Skift adgangskode til din {{vendorName}} -konto",nV="Nulstil adgangskode",rV="Send",iV="Send mig et nyt magisk link",oV="Husk at tjekke din spam-mappe, hvis e-mailen ikke er kommet frem.",sV="Indstil adgangskode",aV="Vis adgangskode",cV="Log ind",lV="Tilmelding",uV="Tilmeld dig med succes",dV="{{code}} er din login-kode til {{vendorName}}",pV="Det ser ud til, at din Spotify-konto i øjeblikket er knyttet til en anden Sesamy-konto. Men frygt ikke, vi er her for at guide dig gennem processen med at få det løst.",fV="Gå til Spotifys side for adgang til indhold",hV='Lad os starte med at fjerne forbindelsen til din Spotify-konto. Klik på knappen nedenfor for at gå til Spotifys Content Access-side. Når du har logget ind på din Spotify-konto, skal du finde Sesamy på listen over tilsluttede platforme. Klik på "Unlink" ved siden af Sesamy-logoet.',gV="Trin 1: Fjern forbindelsen til din Spotify-konto",mV="Når du har afkoblet din Spotify-konto, kan du koble den til Sesamy igen. Du skal blot gentage de trin, du tidligere har taget, og som førte dig til denne side.",_V="Trin 2: Relink din Spotify-konto til Sesamy",yV="Ups! Din Spotify-konto er allerede forbundet",wV="Færdig",vV="Hvis du har spørgsmål eller brug for hjælp, kan du kontakte vores supportteam",bV="Vilkår og betingelser",$V="Noget gik galt. Prøv venligst igen.",xV="Din e-mailadresse skal valideres. Vi har sendt en ny e-mail til din indbakke",AV="Opdatering af e-mail",EV="Brugerkontoen findes ikke",SV="Brugerkontoen findes ikke",kV="Vi kunne ikke finde en bruger med den angivne e-mailadresse. Prøv venligst igen.",NV="Prøv igen.",CV="Valider koden",TV="Tjek din indbakke for instruktioner om validering af e-mail.",IV="Tilmeldte sig",OV="Klik på knappen for at bekræfte din e-mailadresse",zV="Bekræft din e-mailadresse",DV="Bekræft din e-mailadresse",RV="Bekræft konto",PV="Bekræft din e-mail",BV="Tjek venligst din e-mail på <0>{{email}}</0> og indtast den sekscifrede kode, vi har sendt dig.",jV="Velkommen",LV="Velkommen til din {{vendorName}} konto!",FV="Fortsæt med denne konto",UV="Ja, fortsæt med {{text}}",MV="Ja, fortsæt med eksisterende konto",qV={"Server error: Invalid code":"Ugyldig kode",account_detected:fM,account_title:hM,account_with_sso_provider:gM,agree_to:mM,and:_M,auth_method_email:yM,auth_method_email_or_phone:wM,auth_method_phone:vM,callback_url_mismatch:bM,callback_url_not_allowed:$M,check_email_title:xM,click_to_sign_up_description:AM,code_email_enter_code:EM,code_email_subject:SM,code_email_title:kM,code_expired:NM,code_invalid:CM,code_sent_template:TM,code_used:IM,code_valid_30_minutes:OM,confirm_password:zM,contact_support:DM,contact_us:RM,continue:"Fortsæt",continue_social_login:PM,continue_with:BM,continue_with_sso_provider_headline:jM,copyright:LM,copyright_sesamy:FM,create_account_description:UM,create_account_email_invalid:MM,create_account_passwords_didnt_match:qM,create_account_title:VM,create_account_weak_password:HM,create_new_account_link:KM,create_password_account_title:GM,currently_logged_in_as:WM,email:XM,email_changed_to_template:JM,email_or_phone_placeholder:YM,email_placeholder:ZM,email_validated:QM,email_validated_cta:eq,email_verification_for_signup_sent_description:tq,email_verification_for_signup_sent_title:nq,enter_a_code_btn:rq,enter_email_for_verification_description:iq,enter_new_email:oq,enter_new_password_placeholder:sq,enter_password:aq,enter_password_description:cq,enter_your_password_btn:lq,expired_code:uq,fokus_info_message:dq,forgot_password_cta:pq,forgot_password_description:fq,forgot_password_email_sent:hq,forgot_password_link:gq,forgot_password_title:mq,go_back:_q,hide_password:yq,"invalid-email":"Ugyldig e-mail",invalid_identifier:wq,invalid_password:vq,invalid_session_body:bq,invalid_session_title:$q,link_email_click_to_login:xq,link_email_login:Aq,link_email_or_enter_code:Eq,link_page_body:Sq,link_page_headline:kq,logged_in_as:Nq,login:Cq,login_description:Tq,login_description_code:Iq,login_description_combined:Oq,login_description_link:zq,login_description_phone:Dq,login_description_template:Rq,logout:Pq,no_use_another:Bq,or:jq,password:Lq,password_has_been_reset:Fq,password_has_been_reset_title:Uq,password_reset_subject:Mq,password_reset_title:qq,phone_placeholder:Vq,privacy_policy:Hq,redirecting:Kq,reenter_new_password_placeholder:Gq,register_password_account:Wq,resend_code:Xq,reset_password_cta:Jq,reset_password_description:Yq,reset_password_email_click_to_reset:Zq,reset_password_email_cta:Qq,reset_password_email_reset:eV,reset_password_subject:tV,reset_password_title:nV,send:rV,send_me_a_new_magic_link:iV,sent_code_spam:oV,set_password:sV,show_password:aV,sign_in:cV,signup:lV,signup_success:uV,sms_code_text:dV,spotify_already_linked_body:pV,spotify_already_linked_cta:fV,spotify_already_linked_step1_body:hV,spotify_already_linked_step1_title:gV,spotify_already_linked_step2_body:mV,spotify_already_linked_step2_title:_V,spotify_already_linked_title:yV,success:wV,support_info:vV,terms:bV,unexpected_error_try_again:$V,unverified_email:xV,update_email:AV,user_account_does_not_exist:EV,user_not_found:SV,user_not_found_body:kV,user_not_found_cta:NV,validate_code:CV,validate_email_body:TV,validate_email_title:IV,verify_email_click_to_verify:OV,verify_email_subject:zV,verify_email_title:DV,verify_email_verify:RV,verify_your_email:PV,we_sent_a_code_to:BV,welcome:jV,welcome_to_your_account:LV,yes_continue:FV,yes_continue_with:UV,yes_continue_with_existing_account:MV},VV=t=>{const{theme:e,branding:n,client:r,authParams:i}=t,a=`/authorize?${new URLSearchParams({...i})}`;return y(rt,{theme:e,branding:n,client:r,title:B.t("user_not_found"),children:y("div",{className:"flex flex-1 flex-col justify-center",children:[y("p",{className:"mb-8 text-gray-300 text-lg",children:B.t("user_not_found_body")}),y(nt,{Component:"a",href:a,children:B.t("user_not_found_cta")})]})})};function HV(t,e){const{mainTenantId:n,mainClientId:r}=e;return{...t,clients:{get:async i=>{const o=await t.clients.get(i);if(!o)return null;const a=r?await t.clients.get(r):void 0,l=await t.connections.list(o.tenant.id),u=n?await t.connections.list(n):{connections:[]},d=l.connections.map(p=>{var A;const h=(A=u.connections)==null?void 0:A.find($=>$.name===p.name);if(!(h!=null&&h.options))return p;const g=on.parse({...h||{},...p});return g.options=Ei.passthrough().parse({...h.options||{},...p.options}),g}).filter(p=>p);return{...o,web_origins:[...(a==null?void 0:a.web_origins)||[],...o.web_origins||[]],allowed_logout_urls:[...(a==null?void 0:a.allowed_logout_urls)||[],...o.allowed_logout_urls||[]],callbacks:[...(a==null?void 0:a.callbacks)||[],...o.callbacks||[]],connections:d,tenant:{...(a==null?void 0:a.tenant)||{},...o.tenant}}}},connections:{...t.connections,get:async(i,o)=>{const a=await t.connections.get(i,o);if(!a||!n)return a;const l=await t.connections.get(n,o);if(!l)return a;const u=on.parse({...l,...a});return u.options=Ei.passthrough().parse({...l.options||{},...a.options}),u},list:async(i,o)=>{const a=await t.connections.list(i,o);if(!n||i===n)return a;const l=await t.connections.list(n),u=a.connections.map(d=>{var g;const p=(g=l.connections)==null?void 0:g.find(A=>A.name===d.name);if(!(p!=null&&p.options))return d;const h=on.parse({...p,...d});return h.options=Ei.passthrough().parse({...p.options||{},...d.options}),h});return{...a,connections:u}}}}}function KV(t,e){return HV(t,e)}B.init({supportedLngs:["en","it","nb","sv","pl","cs","fi","da"],fallbackLng:"en",resources:{en:{translation:Mk},it:{translation:wC},nb:{translation:JI},sv:{translation:kD},pl:{translation:iB},cs:{translation:RL},fi:{translation:pM},da:{translation:qV}}});function GV(t){const e=new s.OpenAPIHono;e.get("/",a=>a.json({name:"authhero"}));const n=ux(t);e.route("/api/v2",n);const r=G8(t);e.route("/u",r);const i=dS(t);e.route("/samlp",i);const o=kE(t);return e.route("/",o),{app:e,managementApp:n,oauthApp:o,samlApp:i,universalApp:r,createX509Certificate:Vd}}exports.AppLogo=fy;exports.Auth0Client=Hm;exports.AuthorizationResponseMode=Sn;exports.AuthorizationResponseType=rn;exports.Button=nt;exports.CheckEmailPage=Ty;exports.CodeChallengeMethod=$c;exports.ComponentCategory=pp;exports.ComponentType=dp;exports.EmailValidatedPage=zy;exports.EnterCodePage=ip;exports.EnterPasswordPage=ha;exports.ErrorMessage=rr;exports.Footer=hy;exports.ForgotPasswordPage=Ny;exports.ForgotPasswordSentPage=Cy;exports.FormComponent=Rn;exports.GoBack=gn;exports.GoogleLogo=_y;exports.GrantType=$i;exports.Icon=tt;exports.IdentifierPage=da;exports.InvalidSession=Oy;exports.Layout=rt;exports.LogTypes=Le;exports.Message=Ft;exports.NodeType=Cm;exports.PreSignUpConfirmationPage=Dy;exports.PreSignUpPage=Iy;exports.ResetPasswordPage=wi;exports.SignUpPage=Or;exports.SocialButton=wo;exports.Spinner=my;exports.Trans=Vi;exports.UnverifiedEmailPage=ky;exports.UserNotFoundPage=VV;exports.VippsLogo=yy;exports.applicationInsertSchema=va;exports.applicationSchema=Dr;exports.auth0FlowInsertSchema=qw;exports.auth0FlowSchema=Pm;exports.auth0UserResponseSchema=xn;exports.authParamsSchema=Io;exports.baseUserSchema=vc;exports.bordersSchema=Xm;exports.brandingSchema=wu;exports.buttonComponentSchema=Am;exports.codeInsertSchema=jm;exports.codeSchema=Vw;exports.codeTypeSchema=Bm;exports.colorsSchema=Jm;exports.componentSchema=Nm;exports.connectionInsertSchema=ba;exports.connectionOptionsSchema=Ei;exports.connectionSchema=on;exports.coordinatesSchema=Wi;exports.createInMemoryCache=$s;exports.customDomainInsertSchema=fp;exports.customDomainSchema=dr;exports.customDomainWithTenantIdSchema=Hw;exports.emailProviderSchema=Qs;exports.endingSchema=Rm;exports.fieldComponentSchema=Sm;exports.flowNodeSchema=Im;exports.fontDetailsSchema=Ir;exports.fontsSchema=Ym;exports.formControlSchema=Kw;exports.formInsertSchema=xa;exports.formNodeComponentDefinition=Fm;exports.formSchema=vi;exports.genericComponentSchema=km;exports.genericNodeSchema=Om;exports.hookInsertSchema=Js;exports.hookSchema=bi;exports.identitySchema=bm;exports.init=GV;exports.injectTailwindCSS=U8;exports.jwksKeySchema=qm;exports.jwksSchema=hp;exports.legalComponentSchema=Em;exports.logSchema=Aa;exports.loginSessionInsertSchema=Vm;exports.loginSessionSchema=Yw;exports.nodeSchema=zm;exports.openIDConfigurationSchema=vu;exports.pageBackgroundSchema=Zm;exports.parseUserId=sv;exports.passwordInsertSchema=Km;exports.passwordSchema=Qw;exports.profileDataSchema=vm;exports.promptSettingSchema=Zs;exports.refreshTokenInsertSchema=mp;exports.refreshTokenSchema=ev;exports.resourceServerInsertSchema=Ea;exports.resourceServerListSchema=rv;exports.resourceServerOptionsSchema=n_;exports.resourceServerSchema=Rr;exports.resourceServerScopeSchema=t_;exports.richTextComponentSchema=xm;exports.roleInsertSchema=Sa;exports.roleListSchema=d_;exports.rolePermissionInsertSchema=r_;exports.rolePermissionListSchema=iv;exports.rolePermissionSchema=i_;exports.rolePermissionWithDetailsListSchema=s_;exports.rolePermissionWithDetailsSchema=o_;exports.roleSchema=Pr;exports.samlpAddon=$m;exports.sessionInsertSchema=Wm;exports.sessionSchema=Ac;exports.signingKeySchema=bu;exports.smsProviderSchema=nv;exports.smsSendParamsSchema=tv;exports.startSchema=Dm;exports.stepNodeSchema=Tm;exports.tailwindCss=jf;exports.tenantInsertSchema=$a;exports.tenantSchema=Si;exports.themeInsertSchema=e_;exports.themeSchema=Ys;exports.tokenResponseSchema=gp;exports.totalsSchema=mn;exports.userInsertSchema=wa;exports.userPermissionInsertSchema=a_;exports.userPermissionListSchema=ov;exports.userPermissionSchema=c_;exports.userPermissionWithDetailsListSchema=u_;exports.userPermissionWithDetailsSchema=l_;exports.userResponseSchema=Fw;exports.userSchema=up;exports.verificationMethodsSchema=Lm;exports.widgetSchema=Qm;exports.withMainTenantFallback=KV;
312
+ Voit aloittaa uuden kirjautumisen klikkaamalla alla olevaa linkkiä.`,HF="Virheellinen linkki",KF="Kirjaudu sisään napsauttamalla painiketta",GF="Kirjaudu sisään",WF="Tai kirjoita koodi osoitteessa {{vendorName}} kirjautumisen loppuun saattamiseksi.",XF="Kirjoita sähköpostiosoitteesi avataksesi tämän ohjelman osoitteessa {{service}}",JF="Yhdistä tilisi {{service}}",YF="Olet kirjautunut sisään nimellä",ZF="Kirjaudu sisään",QF="Kirjoita sähköpostiosoitteesi kirjautuaksesi sisään.",eU="Anna sähköpostiosoitteesi, niin lähetämme sinulle kirjautumiskoodin.",tU="Kirjoita sähköpostiosoitteesi tai puhelinnumerosi kirjautuaksesi sisään",nU="Anna sähköpostiosoitteesi, niin lähetämme sinulle kirjautumislinkin.",rU="Anna puhelinnumerosi kirjautuaksesi sisään",iU="Kirjoita {{authMethod}} kirjautuaksesi sisään.",oU="Kirjaudu ulos",sU="Ei, haluan käyttää toista tiliä",aU="tai",cU="Salasana",lU="Salasana on nollattu",uU="Menestys",dU="Vaihda salasana tilillesi {{vendorName}} ",pU="Vaihda salasana tilillesi {{vendorName}} ",fU="Puhelinnumero",hU="Tietosuojakäytäntö",gU="Uudelleenohjaus",mU="Vahvista salasana",_U="Rekisteröi uusi salasana",yU="Lähetä koodi uudelleen",wU="Vaihda salasana",vU="Kirjoita alla oleva uusi salasanasi sähköpostitiliä varten: ",bU="Napsauta painiketta salasanasi palauttamiseksi",$U="Napsauta painiketta salasanasi palauttamiseksi",xU="Nollaa salasanasi",AU="Vaihda salasana tilillesi {{vendorName}} ",EU="Nollaa salasana",SU="Lähetä",kU="Lähetä minulle uusi maaginen linkki",NU="Muista tarkistaa roskapostikansiosi, jos sähköposti ei ole saapunut.",CU="Aseta salasana",TU="Näytä salasana",IU="Kirjaudu sisään",OU="Rekisteröityminen",zU="Rekisteröidy onnistuneesti",DU="{{code}} on kirjautumiskoodisi {{vendorName}}",RU="Näyttää siltä, että Spotify-tilisi on tällä hetkellä yhdistetty toiseen Sesamy-tiliin. Mutta älä pelkää, me opastamme sinua prosessin läpi, jotta saat tämän korjattua.",PU="Siirry Spotifyn Content Access -sivulle",BU='Aloitetaan poistamalla Spotify-tilisi linkitys. Klikkaa alla olevaa painiketta siirtyäksesi Spotifyn Content Access -sivulle. Kun olet kirjautunut sisään Spotify-tilillesi, etsi Sesamy yhdistettyjen alustojen luettelosta. Napsauta "Unlink" Sesamyn logon vieressä.',jU="Vaihe 1: Poista Spotify-tilisi linkitys",LU="Kun olet onnistuneesti irrottanut Spotify-tilisi, voit yhdistää sen uudelleen Sesamyn kanssa. Toista vain aiemmin tekemäsi vaiheet, jotka johtivat sinut tälle sivulle.",FU="Vaihe 2: Yhdistä Spotify-tilisi uudelleen Sesamyn kanssa",UU="Hups! Spotify-tilisi on jo linkitetty",MU="Valmis",qU="Jos sinulla on kysyttävää tai tarvitset apua, voit ottaa yhteyttä tukitiimiimme.",VU="Ehdot ja edellytykset",HU="Jokin meni pieleen. Yritä uudelleen.",KU="Sähköpostiosoitteesi on vahvistettava. Olemme lähettäneet uuden sähköpostiviestin sähköpostiisi.",GU="Päivitä sähköposti",WU="Käyttäjätiliä ei ole olemassa",XU="Käyttäjätiliä ei ole olemassa",JU="Emme löytäneet käyttäjää, jolla on annettu sähköpostiosoite. Yritä uudelleen.",YU="Yritä uudelleen.",ZU="Validoi koodi",QU="Tarkista sähköpostin vahvistusohjeet postilaatikostasi.",eM="Rekisteröitynyt",tM="Vahvista sähköpostiosoitteesi napsauttamalla painiketta",nM="Vahvista sähköpostiosoitteesi",rM="Vahvista sähköpostiosoitteesi",iM="Vahvista tili",oM="Vahvista sähköpostiosoitteesi",sM="Tarkista sähköpostisi osoitteesta <0>{{email}}</0> ja syötä lähettämämme kuusinumeroinen koodi.",aM="Tervetuloa",cM="Tervetuloa tilillesi {{vendorName}}!",lM="Jatka tällä tilillä",uM="Kyllä, jatka {{text}}",dM="Kyllä, jatka olemassa olevalla tilillä",pM={"Server error: Invalid code":"Virheellinen koodi",account_detected:PL,account_title:BL,account_with_sso_provider:jL,agree_to:LL,and:FL,auth_method_email:UL,auth_method_email_or_phone:ML,auth_method_phone:qL,callback_url_mismatch:VL,callback_url_not_allowed:HL,check_email_title:KL,click_to_sign_up_description:GL,code_email_enter_code:WL,code_email_subject:XL,code_email_title:JL,code_expired:YL,code_invalid:ZL,code_sent_template:QL,code_used:eF,code_valid_30_minutes:tF,confirm_password:nF,contact_support:rF,contact_us:iF,continue:"Jatka",continue_social_login:oF,continue_with:sF,continue_with_sso_provider_headline:aF,copyright:cF,copyright_sesamy:lF,create_account_description:uF,create_account_email_invalid:dF,create_account_passwords_didnt_match:pF,create_account_title:fF,create_account_weak_password:hF,create_new_account_link:gF,create_password_account_title:mF,currently_logged_in_as:_F,email:yF,email_changed_to_template:wF,email_or_phone_placeholder:vF,email_placeholder:bF,email_validated:$F,email_validated_cta:xF,email_verification_for_signup_sent_description:AF,email_verification_for_signup_sent_title:EF,enter_a_code_btn:SF,enter_email_for_verification_description:kF,enter_new_email:NF,enter_new_password_placeholder:CF,enter_password:TF,enter_password_description:IF,enter_your_password_btn:OF,expired_code:zF,fokus_info_message:DF,forgot_password_cta:RF,forgot_password_description:PF,forgot_password_email_sent:BF,forgot_password_link:jF,forgot_password_title:LF,go_back:FF,hide_password:UF,"invalid-email":"Virheellinen sähköpostiosoite",invalid_identifier:MF,invalid_password:qF,invalid_session_body:VF,invalid_session_title:HF,link_email_click_to_login:KF,link_email_login:GF,link_email_or_enter_code:WF,link_page_body:XF,link_page_headline:JF,logged_in_as:YF,login:ZF,login_description:QF,login_description_code:eU,login_description_combined:tU,login_description_link:nU,login_description_phone:rU,login_description_template:iU,logout:oU,no_use_another:sU,or:aU,password:cU,password_has_been_reset:lU,password_has_been_reset_title:uU,password_reset_subject:dU,password_reset_title:pU,phone_placeholder:fU,privacy_policy:hU,redirecting:gU,reenter_new_password_placeholder:mU,register_password_account:_U,resend_code:yU,reset_password_cta:wU,reset_password_description:vU,reset_password_email_click_to_reset:bU,reset_password_email_cta:$U,reset_password_email_reset:xU,reset_password_subject:AU,reset_password_title:EU,send:SU,send_me_a_new_magic_link:kU,sent_code_spam:NU,set_password:CU,show_password:TU,sign_in:IU,signup:OU,signup_success:zU,sms_code_text:DU,spotify_already_linked_body:RU,spotify_already_linked_cta:PU,spotify_already_linked_step1_body:BU,spotify_already_linked_step1_title:jU,spotify_already_linked_step2_body:LU,spotify_already_linked_step2_title:FU,spotify_already_linked_title:UU,success:MU,support_info:qU,terms:VU,unexpected_error_try_again:HU,unverified_email:KU,update_email:GU,user_account_does_not_exist:WU,user_not_found:XU,user_not_found_body:JU,user_not_found_cta:YU,validate_code:ZU,validate_email_body:QU,validate_email_title:eM,verify_email_click_to_verify:tM,verify_email_subject:nM,verify_email_title:rM,verify_email_verify:iM,verify_your_email:oM,we_sent_a_code_to:sM,welcome:aM,welcome_to_your_account:cM,yes_continue:lM,yes_continue_with:uM,yes_continue_with_existing_account:dM},fM="Konto opdaget",hM="Konto",gM="Vi har opdaget, at du allerede har oprettet en konto gennem",mM="Når du logger ind, accepterer du vores",_M="og",yM="e-mail-adresse",wM="e-mail eller telefonnummer",vM="Telefonnummer",bM="Uoverensstemmelse mellem URL og tilbagekald",$M="Den angivne redirect_uri er ikke på listen over tilladte tilbagekalds-URL'er.",xM="Fortsæt med brugeren",AM="Klik på knappen for at oprette en ny adgangskodekonto.",EM="Indtast koden på {{vendorName}} for at gennemføre login.",SM="Velkommen til {{vendorName}}! {{code}} er login-koden",kM="Velkommen til {{vendorName}}! {{code}} er login-koden",NM="Koden er udløbet",CM="Ugyldig kode",TM="Tjek venligst <0>{{username}}</0> og indtast den sekscifrede kode, som vi har sendt til dig.",IM="Koden er allerede brugt",OM="Koden er gyldig i 30 minutter",zM="Bekræft adgangskode",DM="Har du brug for hjælp?",RM="Kontakt os",PM="eller fortsæt med social konto",BM="Fortsæt med {{provider}}",jM="Vil du gerne fortsætte med din eksisterende konto?",LM="Ophavsret © 2023 SESAMY. Alle rettigheder forbeholdes.",FM="©2023 Sesamy",UM="Vælg en adgangskode med en blanding af store og små bogstaver, tal og symboler.",MM="Indtast venligst en gyldig e-mailadresse.",qM="Adgangskoderne stemte ikke overens. Prøv igen.",VM="Vælg adgangskode",HM="Adgangskoden skal være mindst 8 tegn lang og indeholde mindst et lille bogstav, et stort bogstav, et tal og et symbol.",KM="Opret ny konto",GM="Tilmeld dig med adgangskode",WM="Du er i øjeblikket logget ind som <0>{{email}}</0>",XM="E-mail",JM="E-mail ændret til <0>{{email}}</0> ",YM="E-mail eller telefonnummer",ZM="E-mail-adresse",QM="Din e-mailadresse er blevet valideret",eq="Indtast nu din adgangskode for at logge ind igen",tq="Der er sendt en e-mail til <0>{{email}}</0> med et bekræftelseslink. Klik på linket for at bekræfte din e-mailadresse og angive en adgangskode.",nq="E-mail-bekræftelse sendt",rq="Indtast en kode",iq="Vi sender dig et bekræftelseslink for at sikre, at du ejer denne e-mailadresse.",oq="Indtast ny e-mail",sq="Indtast ny adgangskode",aq="Indtast adgangskode",cq="Indtast din e-mailadresse og adgangskode for at logge ind.",lq="Indtast din adgangskode",uq="Det magiske link er udløbet. Klik på knappen nedenfor for at modtage et nyt link i din indbakke.",dq="Hej! Vi har opdateret vores login-oplevelse. <0>Klik her for at lære mere om det.</0>",pq="Send e-mail til nulstilling af adgangskode",fq="Klik på knappen nedenfor, så sender vi instruktioner om, hvordan du nulstiller din adgangskode.",hq="E-mail til nulstilling af adgangskode sendt",gq="Har du glemt din adgangskode?",mq="Har du glemt din adgangskode?",_q="Gå tilbage",yq="Skjul adgangskode",wq="Ugyldig identifikator",vq="Ugyldig adgangskode",bq="Linket er ikke længere gyldigt. Sørg for at åbne login-linket i den samme browser, som du startede login med. Du kan klikke på linket nedenfor for at starte et nyt login.",$q="Ugyldigt link",xq="Klik på knappen for at logge ind",Aq="Login",Eq="Eller indtast koden på {{vendorName}} for at gennemføre login.",Sq="Indtast din e-mailadresse for at låse op for dette show på {{service}}",kq="Forbind din konto med {{service}}",Nq="Du er logget ind som",Cq="Login",Tq="Indtast din e-mailadresse for at logge ind.",Iq="Indtast din e-mailadresse, så sender vi dig en login-kode.",Oq="Indtast din e-mail eller dit telefonnummer for at logge ind",zq="Indtast din e-mailadresse, så sender vi dig et login-link.",Dq="Indtast dit telefonnummer for at logge ind",Rq="Indtast din {{authMethod}} for at logge ind.",Pq="Log ud",Bq="Nej, jeg vil bruge en anden konto",jq="eller",Lq="Adgangskode",Fq="Adgangskoden er blevet nulstillet",Uq="Succes",Mq="Skift adgangskode til din {{vendorName}} -konto",qq="Skift adgangskode til din {{vendorName}} -konto",Vq="Telefonnummer",Hq="Politik for beskyttelse af personlige oplysninger",Kq="Omdirigering",Gq="Bekræft adgangskode",Wq="Registrer en ny adgangskode",Xq="Send koden igen",Jq="Skift adgangskode",Yq="Indtast din nye adgangskode til e-mailkontoen nedenfor: ",Zq="Klik på knappen for at nulstille din adgangskode",Qq="Klik på knappen for at nulstille din adgangskode",eV="Nulstil din adgangskode",tV="Skift adgangskode til din {{vendorName}} -konto",nV="Nulstil adgangskode",rV="Send",iV="Send mig et nyt magisk link",oV="Husk at tjekke din spam-mappe, hvis e-mailen ikke er kommet frem.",sV="Indstil adgangskode",aV="Vis adgangskode",cV="Log ind",lV="Tilmelding",uV="Tilmeld dig med succes",dV="{{code}} er din login-kode til {{vendorName}}",pV="Det ser ud til, at din Spotify-konto i øjeblikket er knyttet til en anden Sesamy-konto. Men frygt ikke, vi er her for at guide dig gennem processen med at få det løst.",fV="Gå til Spotifys side for adgang til indhold",hV='Lad os starte med at fjerne forbindelsen til din Spotify-konto. Klik på knappen nedenfor for at gå til Spotifys Content Access-side. Når du har logget ind på din Spotify-konto, skal du finde Sesamy på listen over tilsluttede platforme. Klik på "Unlink" ved siden af Sesamy-logoet.',gV="Trin 1: Fjern forbindelsen til din Spotify-konto",mV="Når du har afkoblet din Spotify-konto, kan du koble den til Sesamy igen. Du skal blot gentage de trin, du tidligere har taget, og som førte dig til denne side.",_V="Trin 2: Relink din Spotify-konto til Sesamy",yV="Ups! Din Spotify-konto er allerede forbundet",wV="Færdig",vV="Hvis du har spørgsmål eller brug for hjælp, kan du kontakte vores supportteam",bV="Vilkår og betingelser",$V="Noget gik galt. Prøv venligst igen.",xV="Din e-mailadresse skal valideres. Vi har sendt en ny e-mail til din indbakke",AV="Opdatering af e-mail",EV="Brugerkontoen findes ikke",SV="Brugerkontoen findes ikke",kV="Vi kunne ikke finde en bruger med den angivne e-mailadresse. Prøv venligst igen.",NV="Prøv igen.",CV="Valider koden",TV="Tjek din indbakke for instruktioner om validering af e-mail.",IV="Tilmeldte sig",OV="Klik på knappen for at bekræfte din e-mailadresse",zV="Bekræft din e-mailadresse",DV="Bekræft din e-mailadresse",RV="Bekræft konto",PV="Bekræft din e-mail",BV="Tjek venligst din e-mail på <0>{{email}}</0> og indtast den sekscifrede kode, vi har sendt dig.",jV="Velkommen",LV="Velkommen til din {{vendorName}} konto!",FV="Fortsæt med denne konto",UV="Ja, fortsæt med {{text}}",MV="Ja, fortsæt med eksisterende konto",qV={"Server error: Invalid code":"Ugyldig kode",account_detected:fM,account_title:hM,account_with_sso_provider:gM,agree_to:mM,and:_M,auth_method_email:yM,auth_method_email_or_phone:wM,auth_method_phone:vM,callback_url_mismatch:bM,callback_url_not_allowed:$M,check_email_title:xM,click_to_sign_up_description:AM,code_email_enter_code:EM,code_email_subject:SM,code_email_title:kM,code_expired:NM,code_invalid:CM,code_sent_template:TM,code_used:IM,code_valid_30_minutes:OM,confirm_password:zM,contact_support:DM,contact_us:RM,continue:"Fortsæt",continue_social_login:PM,continue_with:BM,continue_with_sso_provider_headline:jM,copyright:LM,copyright_sesamy:FM,create_account_description:UM,create_account_email_invalid:MM,create_account_passwords_didnt_match:qM,create_account_title:VM,create_account_weak_password:HM,create_new_account_link:KM,create_password_account_title:GM,currently_logged_in_as:WM,email:XM,email_changed_to_template:JM,email_or_phone_placeholder:YM,email_placeholder:ZM,email_validated:QM,email_validated_cta:eq,email_verification_for_signup_sent_description:tq,email_verification_for_signup_sent_title:nq,enter_a_code_btn:rq,enter_email_for_verification_description:iq,enter_new_email:oq,enter_new_password_placeholder:sq,enter_password:aq,enter_password_description:cq,enter_your_password_btn:lq,expired_code:uq,fokus_info_message:dq,forgot_password_cta:pq,forgot_password_description:fq,forgot_password_email_sent:hq,forgot_password_link:gq,forgot_password_title:mq,go_back:_q,hide_password:yq,"invalid-email":"Ugyldig e-mail",invalid_identifier:wq,invalid_password:vq,invalid_session_body:bq,invalid_session_title:$q,link_email_click_to_login:xq,link_email_login:Aq,link_email_or_enter_code:Eq,link_page_body:Sq,link_page_headline:kq,logged_in_as:Nq,login:Cq,login_description:Tq,login_description_code:Iq,login_description_combined:Oq,login_description_link:zq,login_description_phone:Dq,login_description_template:Rq,logout:Pq,no_use_another:Bq,or:jq,password:Lq,password_has_been_reset:Fq,password_has_been_reset_title:Uq,password_reset_subject:Mq,password_reset_title:qq,phone_placeholder:Vq,privacy_policy:Hq,redirecting:Kq,reenter_new_password_placeholder:Gq,register_password_account:Wq,resend_code:Xq,reset_password_cta:Jq,reset_password_description:Yq,reset_password_email_click_to_reset:Zq,reset_password_email_cta:Qq,reset_password_email_reset:eV,reset_password_subject:tV,reset_password_title:nV,send:rV,send_me_a_new_magic_link:iV,sent_code_spam:oV,set_password:sV,show_password:aV,sign_in:cV,signup:lV,signup_success:uV,sms_code_text:dV,spotify_already_linked_body:pV,spotify_already_linked_cta:fV,spotify_already_linked_step1_body:hV,spotify_already_linked_step1_title:gV,spotify_already_linked_step2_body:mV,spotify_already_linked_step2_title:_V,spotify_already_linked_title:yV,success:wV,support_info:vV,terms:bV,unexpected_error_try_again:$V,unverified_email:xV,update_email:AV,user_account_does_not_exist:EV,user_not_found:SV,user_not_found_body:kV,user_not_found_cta:NV,validate_code:CV,validate_email_body:TV,validate_email_title:IV,verify_email_click_to_verify:OV,verify_email_subject:zV,verify_email_title:DV,verify_email_verify:RV,verify_your_email:PV,we_sent_a_code_to:BV,welcome:jV,welcome_to_your_account:LV,yes_continue:FV,yes_continue_with:UV,yes_continue_with_existing_account:MV},VV=t=>{const{theme:e,branding:n,client:r,authParams:i}=t,a=`/authorize?${new URLSearchParams({...i})}`;return y(nt,{theme:e,branding:n,client:r,title:B.t("user_not_found"),children:y("div",{className:"flex flex-1 flex-col justify-center",children:[y("p",{className:"mb-8 text-gray-300 text-lg",children:B.t("user_not_found_body")}),y(tt,{Component:"a",href:a,children:B.t("user_not_found_cta")})]})})};function HV(t,e){const{mainTenantId:n,mainClientId:r}=e;return{...t,clients:{get:async i=>{const o=await t.clients.get(i);if(!o)return null;const a=r?await t.clients.get(r):void 0,l=await t.connections.list(o.tenant.id),u=n?await t.connections.list(n):{connections:[]},d=l.connections.map(p=>{var A;const h=(A=u.connections)==null?void 0:A.find($=>$.name===p.name);if(!(h!=null&&h.options))return p;const g=on.parse({...h||{},...p});return g.options=Ei.passthrough().parse({...h.options||{},...p.options}),g}).filter(p=>p);return{...o,web_origins:[...(a==null?void 0:a.web_origins)||[],...o.web_origins||[]],allowed_logout_urls:[...(a==null?void 0:a.allowed_logout_urls)||[],...o.allowed_logout_urls||[]],callbacks:[...(a==null?void 0:a.callbacks)||[],...o.callbacks||[]],connections:d,tenant:{...(a==null?void 0:a.tenant)||{},...o.tenant}}}},connections:{...t.connections,get:async(i,o)=>{const a=await t.connections.get(i,o);if(!a||!n)return a;const l=await t.connections.get(n,o);if(!l)return a;const u=on.parse({...l,...a});return u.options=Ei.passthrough().parse({...l.options||{},...a.options}),u},list:async(i,o)=>{const a=await t.connections.list(i,o);if(!n||i===n)return a;const l=await t.connections.list(n),u=a.connections.map(d=>{var g;const p=(g=l.connections)==null?void 0:g.find(A=>A.name===d.name);if(!(p!=null&&p.options))return d;const h=on.parse({...p,...d});return h.options=Ei.passthrough().parse({...p.options||{},...d.options}),h});return{...a,connections:u}}}}}function KV(t,e){return HV(t,e)}B.init({supportedLngs:["en","it","nb","sv","pl","cs","fi","da"],fallbackLng:"en",resources:{en:{translation:Mk},it:{translation:wC},nb:{translation:JI},sv:{translation:kD},pl:{translation:iB},cs:{translation:RL},fi:{translation:pM},da:{translation:qV}}});function GV(t){const e=new s.OpenAPIHono;e.get("/",a=>a.json({name:"authhero"}));const n=ux(t);e.route("/api/v2",n);const r=G8(t);e.route("/u",r);const i=dS(t);e.route("/samlp",i);const o=kE(t);return e.route("/",o),{app:e,managementApp:n,oauthApp:o,samlApp:i,universalApp:r,createX509Certificate:Vd}}exports.AppLogo=fy;exports.Auth0Client=Hm;exports.AuthorizationResponseMode=Sn;exports.AuthorizationResponseType=rn;exports.Button=tt;exports.CheckEmailPage=Ty;exports.CodeChallengeMethod=$c;exports.ComponentCategory=pp;exports.ComponentType=dp;exports.EmailValidatedPage=zy;exports.EnterCodePage=ip;exports.EnterPasswordPage=ha;exports.ErrorMessage=rr;exports.Footer=hy;exports.ForgotPasswordPage=Ny;exports.ForgotPasswordSentPage=Cy;exports.FormComponent=Rn;exports.GoBack=gn;exports.GoogleLogo=_y;exports.GrantType=$i;exports.Icon=et;exports.IdentifierPage=da;exports.InvalidSession=Oy;exports.Layout=nt;exports.LogTypes=Le;exports.Message=Ft;exports.NodeType=Cm;exports.PreSignUpConfirmationPage=Dy;exports.PreSignUpPage=Iy;exports.ResetPasswordPage=wi;exports.SignUpPage=Or;exports.SocialButton=wo;exports.Spinner=my;exports.Trans=Vi;exports.UnverifiedEmailPage=ky;exports.UserNotFoundPage=VV;exports.VippsLogo=yy;exports.applicationInsertSchema=va;exports.applicationSchema=Dr;exports.auth0FlowInsertSchema=qw;exports.auth0FlowSchema=Pm;exports.auth0UserResponseSchema=xn;exports.authParamsSchema=Io;exports.baseUserSchema=vc;exports.bordersSchema=Xm;exports.brandingSchema=wu;exports.buttonComponentSchema=Am;exports.codeInsertSchema=jm;exports.codeSchema=Vw;exports.codeTypeSchema=Bm;exports.colorsSchema=Jm;exports.componentSchema=Nm;exports.connectionInsertSchema=ba;exports.connectionOptionsSchema=Ei;exports.connectionSchema=on;exports.coordinatesSchema=Wi;exports.createInMemoryCache=$s;exports.customDomainInsertSchema=fp;exports.customDomainSchema=dr;exports.customDomainWithTenantIdSchema=Hw;exports.emailProviderSchema=Qs;exports.endingSchema=Rm;exports.fieldComponentSchema=Sm;exports.flowNodeSchema=Im;exports.fontDetailsSchema=Ir;exports.fontsSchema=Ym;exports.formControlSchema=Kw;exports.formInsertSchema=xa;exports.formNodeComponentDefinition=Fm;exports.formSchema=vi;exports.genericComponentSchema=km;exports.genericNodeSchema=Om;exports.hookInsertSchema=Js;exports.hookSchema=bi;exports.identitySchema=bm;exports.init=GV;exports.injectTailwindCSS=U8;exports.jwksKeySchema=qm;exports.jwksSchema=hp;exports.legalComponentSchema=Em;exports.logSchema=Aa;exports.loginSessionInsertSchema=Vm;exports.loginSessionSchema=Yw;exports.nodeSchema=zm;exports.openIDConfigurationSchema=vu;exports.pageBackgroundSchema=Zm;exports.parseUserId=sv;exports.passwordInsertSchema=Km;exports.passwordSchema=Qw;exports.profileDataSchema=vm;exports.promptSettingSchema=Zs;exports.refreshTokenInsertSchema=mp;exports.refreshTokenSchema=ev;exports.resourceServerInsertSchema=Ea;exports.resourceServerListSchema=rv;exports.resourceServerOptionsSchema=n_;exports.resourceServerSchema=Rr;exports.resourceServerScopeSchema=t_;exports.richTextComponentSchema=xm;exports.roleInsertSchema=Sa;exports.roleListSchema=d_;exports.rolePermissionInsertSchema=r_;exports.rolePermissionListSchema=iv;exports.rolePermissionSchema=i_;exports.rolePermissionWithDetailsListSchema=s_;exports.rolePermissionWithDetailsSchema=o_;exports.roleSchema=Pr;exports.samlpAddon=$m;exports.sessionInsertSchema=Wm;exports.sessionSchema=Ac;exports.signingKeySchema=bu;exports.smsProviderSchema=nv;exports.smsSendParamsSchema=tv;exports.startSchema=Dm;exports.stepNodeSchema=Tm;exports.tailwindCss=jf;exports.tenantInsertSchema=$a;exports.tenantSchema=Si;exports.themeInsertSchema=e_;exports.themeSchema=Ys;exports.tokenResponseSchema=gp;exports.totalsSchema=mn;exports.userInsertSchema=wa;exports.userPermissionInsertSchema=a_;exports.userPermissionListSchema=ov;exports.userPermissionSchema=c_;exports.userPermissionWithDetailsListSchema=u_;exports.userPermissionWithDetailsSchema=l_;exports.userResponseSchema=Fw;exports.userSchema=up;exports.verificationMethodsSchema=Lm;exports.widgetSchema=Qm;exports.withMainTenantFallback=KV;