PageSourceSearch

https://apvball.net/chunk-FNLSFQGS.js

js apvball.net collected 2026-09-24 14:05:23 UTC 47,653 bytes, 138 lines download raw bytes

1import{a as nt,b as ot}from"./chunk-4PDJWD4P.js";import{b as Fe}from"./chunk-72FRQMR6.js";import"./chunk-WR54LXY5.js";import{$b as Se,Hd as we,Ia as fe,Mb as ue,Ob as v,Vb as he,Wb as Je,Xb as ye,kd as Ce,kh as rt,uc as it}from"./chunk-CWIKEVUT.js";import{$ as ae,$a as w,Ad as We,C as qe,Fa as m,Fb as Re,Ib as o,Jb as de,Ka as T,Lb as Ze,Ma as se,Na as ce,T as z,U as O,_ as Xe,ad as et,ba as je,bb as E,d as oe,fa as I,fi as tt,ga as K,gb as U,hb as c,ib as d,j as Z,jb as f,k as Ye,pj as me,qb as B,sb as R,tb as S,vd as le,xb as Qe,xd as pe,yb as Pe,zb as Te}from"./chunk-45UQS2YE.js";import{a as g,b as G,e as Q,j as l}from"./chunk-BMIYOSOG.js";var kt=["idFrontUpload"],Yt=["idBackUpload"];function qt(e,t){e&1&&(o(0,`
2          `),c(1,"app-loader"),o(2,"Loading..."),d(),o(3,`
3        `))}function Xt(e,t){e&1&&(o(0,`
4            `),c(1,"app-inline-alert",6),o(2,"You have already accepted this cardholder invitation. No further action is required."),d(),o(3,`
5          `)),e&2&&(m(),U("isInline",!0))}function jt(e,t){e&1&&(o(0,`
6              `),c(1,"app-inline-alert",7),o(2,"Your cardholder information has been submitted successfully. You will be redirected to the dashboard shortly."),d(),o(3,`
7            `)),e&2&&(m(),U("isInline",!0))}function Qt(e,t){if(e&1){let i=B();o(0,`
8                    `),c(1,"section"),o(2,`
9                      `),c(3,"h3",20),o(4,"Personal Information"),d(),o(5,`
10                      `),c(6,"div",10),o(7,`
11                        `),f(8,"app-dynamic-form-field",21),o(9,`
12                        `),f(10,"app-dynamic-form-field",22),o(11,`
13                        `),f(12,"app-dynamic-form-field",23),o(13,`
14                        `),f(14,"app-dynamic-form-field",24),o(15,`
15                        `),f(16,"app-dynamic-form-field",25),o(17,`
16                      `),d(),o(18,`
17                    `),d(),o(19,`
18                    `),c(20,"section",26),o(21,`
19                      `),c(22,"h3"),o(23,"Billing Address"),d(),o(24,`
20                      `),c(25,"div",10),o(26,`
21                        `),c(27,"app-dynamic-form-field",27),R("onChange",function(n){I(i);let a=S(4);return K(a.updateBillingAddressFields(n))}),d(),o(28,`
22                        `),f(29,"app-dynamic-form-field",28),o(30,`
23                        `),f(31,"app-dynamic-form-field",29),o(32,`
24                        `),f(33,"app-dynamic-form-field",30),o(34,`
25                        `),f(35,"app-dynamic-form-field",31),o(36,`
26                        `),f(37,"app-dynamic-form-field",32),o(38,`
27                        `),f(39,"app-dynamic-form-field",33),o(40,`
28                        `),f(41,"app-dynamic-form-field",34),o(42,`
29                        `),f(43,"app-dynamic-form-field",35),o(44,`
30                      `),d(),o(45,`
31                    `),d(),o(46,`
32                  `)}}function Zt(e,t){if(e&1){let i=B();o(0,`
33                        `),c(1,"app-dynamic-form-field",36),R("onChange",function(n){I(i);let a=S(4);return K(a.onShippingSameAsBillingChange(n))}),d(),o(2,`
34                      `)}}function ei(e,t){if(e&1){let i=B();o(0,`
35                              `),c(1,"button",48),R("click",function(){I(i);let n=S(5);return K(n.clearIdFront())}),o(2,`
36                                `),f(3,"i",49),o(4,`
37                              `),d(),o(5,`
38                            `)}}function ti(e,t){if(e&1){let i=B();o(0,`
39                              `),c(1,"button",48),R("click",function(){I(i);let n=S(5);return K(n.clearIdBack())}),o(2,`
40                                `),f(3,"i",49),o(4,`
41                              `),d(),o(5,`
42                            `)}}function ii(e,t){if(e&1){let i=B();o(0,`
43                    `),c(1,"section",26),o(2,`
44                      `),c(3,"h3"),o(4,"Identity Verification"),d(),o(5,`
45                      `),c(6,"div",10),o(7,`
46                        `),c(8,"p",37),o(9,"Please upload a photo of the front and back of a valid government-issued photo ID."),d(),o(10,`
47                        `),o(11,`
48                        `),c(12,"div",38),o(13,`
49                          `),c(14,"label",39),o(15,"ID Front "),c(16,"span",40),o(17,"*"),d()(),o(18,`
50                          `),c(19,"div",41),o(20,`
51                            `),c(21,"p-fileUpload",42,0),R("uploadHandler",function(n){I(i);let a=S(4);return K(a.onIdFrontSelected(n))}),o(23,`
52                            `),d(),o(24,`
53                            `),w(25,ei,6,0),d(),o(26,`
54                        `),d(),o(27,`
55                        `),c(28,"div",38),o(29,`
56                          `),c(30,"label",39),o(31,"ID Back "),c(32,"span",40),o(33,"*"),d()(),o(34,`
57                          `),c(35,"div",41),o(36,`
58                            `),c(37,"p-fileUpload",43,1),R("uploadHandler",function(n){I(i);let a=S(4);return K(a.onIdBackSelected(n))}),o(39,`
59                            `),d(),o(40,`
60                            `),w(41,ti,6,0),d(),o(42,`
61                        `),d(),o(43,`
62                      `),d(),o(44,`
63                    `),d(),o(45,`
64                    `),c(46,"section",44),o(47,`
65                      `),c(48,"h3"),o(49,"Authorized User Agreement"),d(),o(50,`
66                      `),c(51,"div",10),o(52,`
67                        `),f(53,"app-dynamic-form-field",45),o(54,`
68                        `),f(55,"app-dynamic-form-field",46),o(56,`
69                        `),f(57,"app-dynamic-form-field",47),o(58,`
70                      `),d(),o(59,`
71                    `),d(),o(60,`
72                  `)}if(e&2){let i=S(4);m(21),U("showUploadButton",!1)("showCancelButton",!1)("maxFileSize",10485760)("customUpload",!0)("auto",!0)("chooseLabel",i.idFrontFile?i.idFrontFile.name:"Choose")("chooseIcon",i.idFrontFile?"fa-regular fa-check":"fa-regular fa-upload"),m(4),E(i.idFrontFile?25:-1),m(12),U("showUploadButton",!1)("showCancelButton",!1)("maxFileSize",10485760)("customUpload",!0)("auto",!0)("chooseLabel",i.idBackFile?i.idBackFile.name:"Choose")("chooseIcon",i.idBackFile?"fa-regular fa-check":"fa-regular fa-upload"),m(4),E(i.idBackFile?41:-1)}}function ri(e,t){if(e&1){let i=B();o(0,`
73              `),c(1,"div",8),o(2,`
74                `),c(3,"app-dynamic-form",9),R("onSubmit",function(n){I(i);let a=S(3);return K(a.onSubmit(n))}),o(4,`
75                  `),w(5,Qt,47,0),c(6,"section"),o(7,`
76                    `),c(8,"h3"),o(9,"Shipping Address"),d(),o(10,`
77                    `),c(11,"div",10),o(12,`
78                      `),w(13,Zt,3,0),c(14,"div",11),o(15,`
79                        `),c(16,"app-dynamic-form-field",12),R("onChange",function(n){I(i);let a=S(3);return K(a.updateShippingAddressFields(n))}),d(),o(17,`
80                        `),f(18,"app-dynamic-form-field",13),o(19,`
81                        `),f(20,"app-dynamic-form-field",14),o(21,`
82                        `),f(22,"app-dynamic-form-field",15),o(23,`
83                        `),f(24,"app-dynamic-form-field",16),o(25,`
84                        `),f(26,"app-dynamic-form-field",17),o(27,`
85                        `),f(28,"app-dynamic-form-field",18),o(29,`
86                        `),f(30,"app-dynamic-form-field",19),o(31,`
87                      `),d(),o(32,`
88                    `),d(),o(33,`
89                  `),d(),o(34,`
90                  `),w(35,ii,61,16),d(),o(36,`
91              `),d(),o(37,`
92            `)}if(e&2){let i=S(3);m(3),U("fields",i.fields)("entity",i.formData)("submitButtonEnabled",!i.isSubmitting)("showCancelButton",!1)("contentFieldsMode",!0)("horizontalForm",!0)("buttonsPosition","left"),m(2),E(i.isReissue?-1:5),m(),Re("border-top",!i.isReissue)("mt-4",!i.isReissue)("pt-4",!i.isReissue),m(2),Re("mb-2",i.isReissue)("mt-2",i.isReissue),m(5),E(i.isReissue?-1:13),m(),U("hidden",i.shippingSameAsBilling&&!i.isReissue),m(21),E(i.isReissue?-1:35)}}function ni(e,t){if(e&1&&(o(0,`
93            `),w(1,jt,4,1),w(2,ri,38,21)),e&2){let i=S(2);m(),E(i.success?1:-1),m(),E(i.success?-1:2)}}function oi(e,t){if(e&1&&(o(0,`
94          `),w(1,Xt,4,1),w(2,ni,3,2)),e&2){let i=S();m(),E(i.alreadyAccepted?1:-1),m(),E(i.alreadyAccepted?-1:2)}}var at=(()=>{let t=class t{constructor(r,n,a,s,p){this.route=r,this.router=n,this.cardholderInviteService=a,this.siteDataService=s,this.dynamicFormService=p,this.unsubscribe$=new oe,this.loading=!0,this.isSubmitting=!1,this.alreadyAccepted=!1,this.success=!1,this.isReissue=!1,this.fields=[],this.idFrontFile=null,this.idBackFile=null,this.shippingSameAsBilling=!1,this.COUNTRY_USA=1}ngOnInit(){this.route.params.pipe(O(this.unsubscribe$)).subscribe({next:r=>{this.clubStripeCardholderID=+r.cardholderID,this.cardholderInviteService.getInviteFormData(this.clubStripeCardholderID).pipe(O(this.unsubscribe$)).subscribe({next:n=>{this.formData=n,this.isReissue=n.cardholderInviteStatusID===nt.REISSUE_PENDING,(this.isReissue?this.cardholderInviteService.getReissueFormMetadata():this.cardholderInviteService.getAcceptanceFormMetadata()).pipe(O(this.unsubscribe$)).subscribe({next:s=>{this.fields=s.fields,this.isReissue||(this.formData.billingCountryID||(this.formData.billingCountryID=this.COUNTRY_USA),this.formData.shippingSameAsBilling=!1,this.updateBillingAddressFields(this.formData.billingCountryID)),this.formData.shippingCountryID||(this.formData.shippingCountryID=this.COUNTRY_USA),this.updateShippingAddressFields(this.formData.shippingCountryID),this.loading=!1,this.siteDataService.hideSiteLoader()},error:()=>{this.siteDataService.hideSiteLoader(),this.router.navigate(["/dashboard"])}})},error:n=>{n?.status===403||n?.status===404?(this.siteDataService.hideSiteLoader(),this.router.navigate(["/dashboard"])):n?.status===409?(this.alreadyAccepted=!0,this.loading=!1,this.siteDataService.hideSiteLoader()):(this.siteDataService.hideSiteLoader(),this.router.navigate(["/dashboard"]))}})},error:()=>{this.router.navigate(["/dashboard"])}})}onShippingSameAsBillingChange(r){this.shippingSameAsBilling=r,this.shippingSameAsBilling?this.removeShippingRequiredValidators():this.updateShippingAddressFields(this.formData.shippingCountryID)}onIdFrontSelected(r){this.idFrontFile=r.files?.[0]??null}onIdBackSelected(r){this.idBackFile=r.files?.[0]??null}clearIdFront(){this.idFrontFile=null,this.idFrontUpload.clear()}clearIdBack(){this.idBackFile=null,this.idBackUpload.clear()}onSubmit(r){if(!this.isReissue&&(!this.idFrontFile||!this.idBackFile)){this.siteDataService.showSiteErrorAlert("Please upload both the front and back of your ID."),this.dynamicFormService.hideFormLoader();return}if(this.isSubmitting=!0,!this.isReissue&&this.shippingSameAsBilling){let s=r;s.shippingAddressLine1=s.billingAddressLine1,s.shippingAddressLine2=s.billingAddressLine2,s.shippingCity=s.billingCity,s.shippingState=s.billingState,s.shippingProvince=s.billingProvince,s.shippingZip=s.billingZip,s.shippingPostalCode=s.billingPostalCode,s.shippingCountryID=s.billingCountryID}let n=new FormData;for(let[s,p]of Object.entries(r))if(p!=null){let u;p instanceof Date?u=p.toISOString().substring(0,10):typeof p=="string"&&!isNaN(Date.parse(p))&&p.length>10?u=new Date(p).toISOString().substring(0,10):u=String(p),n.append(s,u)}this.isReissue||(n.append("idFront",this.idFrontFile,this.idFrontFile.name),n.append("idBack",this.idBackFile,this.idBackFile.name)),(this.isReissue?this.cardholderInviteService.reissueAccept(this.clubStripeCardholderID,n):this.cardholderInviteService.acceptInvite(this.clubStripeCardholderID,n)).pipe(O(this.unsubscribe$)).subscribe({next:s=>{this.isSubmitting=!1,s.success?(this.success=!0,setTimeout(()=>this.router.navigate(["/dashboard"]),3e3)):(this.dynamicFormService.hideFormLoader(),this.siteDataService.showSiteErrorAlert(s.errorMessage||"An error occurred. Please try again."))},error:()=>{this.isSubmitting=!1,this.dynamicFormService.hideFormLoader(),this.siteDataService.showSiteErrorAlert("An unexpected error occurred. Please try again.")}})}ngOnDestroy(){this.unsubscribe$.next(),this.unsubscribe$.complete()}removeShippingRequiredValidators(){["shippingState","shippingProvince","shippingZip","shippingPostalCode","shippingAddressLine1","shippingCity","shippingCountryID"].forEach(n=>{let a=this.fields.find(s=>s.controlName===n);a&&(a.required=!1,a.validators=a.validators?.filter(s=>s.validatorType!==v.REQUIRED)??[])}),this.fields=[...this.fields]}updateBillingAddressFields(r){let n=!r||r===this.COUNTRY_USA;this.toggleAddressFields(n,"billing")}updateShippingAddressFields(r){let n=!r||r===this.COUNTRY_USA;["shippingCountryID","shippingAddressLine1","shippingCity"].forEach(a=>{this.turnFieldOn(this.fields.find(s=>s.controlName===a))}),this.toggleAddressFields(n,"shipping")}toggleAddressFields(r,n){let a=this.fields.find(h=>
94h.controlName===`${n}State`),s=this.fields.find(h=>h.controlName===`${n}Province`),p=this.fields.find(h=>h.controlName===`${n}Zip`),u=this.fields.find(h=>h.controlName===`${n}PostalCode`);r?(this.turnFieldOn(a),this.turnFieldOff(s),this.turnFieldOn(p),this.turnFieldOff(u)):(this.turnFieldOff(a),this.turnFieldOn(s),this.turnFieldOff(p),this.turnFieldOn(u)),this.fields=[...this.fields]}turnFieldOn(r){r&&(r.hidden=!1,r.required=!0,r.validators?.some(n=>n.validatorType===v.REQUIRED)||(r.validators=[...r.validators??[],{validatorType:v.REQUIRED}]))}turnFieldOff(r){r&&(r.hidden=!0,r.required=!1,r.validators=r.validators?.filter(n=>n.validatorType!==v.REQUIRED)??[])}};t.\u0275fac=function(n){return new(n||t)(T(le),T(pe),T(ot),T(me),T(Se))},t.\u0275cmp=se({type:t,selectors:[["app-cardholder-invite-accept"]],viewQuery:function(n,a){if(n&1&&Qe(kt,5)(Yt,5),n&2){let s;Pe(s=Te())&&(a.idFrontUpload=s.first),Pe(s=Te())&&(a.idBackUpload=s.first)}},standalone:!1,decls:20,vars:3,consts:[["idFrontUpload",""],["idBackUpload",""],[1,"container"],[1,"row","justify-content-center"],[1,"col-lg-10"],[1,"section-header","mt-3"],["alertType","info",3,"isInline"],["alertType","success",3,"isInline"],[1,"card","mb-3"],["submitButtonDisabledMessage","","submitButtonText","Submit","submitButtonSavingText","Submitting...","formID","cardholder-invite-form",3,"onSubmit","fields","entity","submitButtonEnabled","showCancelButton","contentFieldsMode","horizontalForm","buttonsPosition"],[1,"section-content"],[3,"hidden"],["fieldName","shippingCountryID","formID","cardholder-invite-form",3,"onChange"],["fieldName","shippingAddressLine1","formID","cardholder-invite-form"],["fieldName","shippingAddressLine2","formID","cardholder-invite-form"],["fieldName","shippingCity","formID","cardholder-invite-form"],["fieldName","shippingState","formID","cardholder-invite-form"],["fieldName","shippingProvince","formID","cardholder-invite-form"],["fieldName","shippingZip","formID","cardholder-invite-form"],["fieldName","shippingPostalCode","formID","cardholder-invite-form"],[1,"mb-2","mt-2"],["fieldName","firstName","formID","cardholder-invite-form"],["fieldName","lastName","formID","cardholder-invite-form"],["fieldName","email","formID","cardholder-invite-form"],["fieldName","phone","formID","cardholder-invite-form"],["fieldName","dob","formID","cardholder-invite-form"],[1,"border-top","mt-4","pt-4"],["fieldName","billingCountryID","formID","cardholder-invite-form",3,"onChange"],["fieldName","billingAddressLine1","formID","cardholder-invite-form"],["fieldName","billingAddressLine2","formID","cardholder-invite-form"],["fieldName","billingCity","formID","cardholder-invite-form"],["fieldName","billingState","formID","cardholder-invite-form"],["fieldName","billingProvince","formID","cardholder-invite-form"],["fieldName","billingZip","formID","cardholder-invite-form"],["fieldName","billingPostalCode","formID","cardholder-invite-form"],["fieldName","saveBillingAddressToProfile","formID","cardholder-invite-form"],["fieldName","shippingSameAsBilling","formID","cardholder-invite-form",3,"onChange"],[1,"mb-2"],[1,"mb-3"],[1,"form-label"],[1,"text-danger"],[1,"d-flex","align-items-center","gap-2"],["name","idFront","accept","image/jpeg,image/png","mode","basic",3,"uploadHandler","showUploadButton","showCancelButton","maxFileSize","customUpload","auto","chooseLabel","chooseIcon"],["name","idBack","accept","image/jpeg,image/png","mode","basic",3,"uploadHandler","showUploadButton","showCancelButton","maxFileSize","customUpload","auto","chooseLabel","chooseIcon"],[1,"border-all","bg-grey-lt","mt-4","p-3","border-radius"],["fieldName","authorizedUserTermsForCelticAccepted","formID","cardholder-invite-form"],["fieldName","authorizedUserTermsForFifthThirdAccepted","formID","cardholder-invite-form"],["fieldName","eSignDisclosureAccepted","formID","cardholder-invite-form"],["type","button","title","Clear",1,"btn","btn-sm","btn-outline-secondary",3,"click"],[1,"fa-regular","fa-times"]],template:function(n,a){n&1&&(c(0,"main"),o(1,`
95  `),c(2,"div",2),o(3,`
96    `),c(4,"div",3),o(5,`
97      `),c(6,"div",4),o(7,`
98        `),c(8,"div",5),o(9,`
99          `),c(10,"h2"),o(11),d(),o(12,`
100        `),d(),o(13,`
101        `),w(14,qt,4,0),w(15,oi,3,2),d(),o(16,`
102    `),d(),o(17,`
103  `),d(),o(18,`
104`),d(),o(19,`
105`)),n&2&&(m(11),de(a.isReissue?"Accept your replacement card":"Accept c
105ardholder invitation"),m(3),E(a.loading?14:-1),m(),E(a.loading?-1:15))},dependencies:[we,Ce,fe,ue,it],encapsulation:2});let e=t;return e})();var st=new TextEncoder,Be=new TextDecoder,Ae=2**32;function W(...e){let t=e.reduce((n,{length:a})=>n+a,0),i=new Uint8Array(t),r=0;for(let n of e)i.set(n,r),r+=n.length;return i}function Ue(e,t,i){if(t<0||t>=Ae)throw new RangeError(`value must be >= 0 and <= ${Ae-1}. Received ${t}`);e.set([t>>>24,t>>>16,t>>>8,t&255],i)}function ct(e){let t=Math.floor(e/Ae),i=e%Ae,r=new Uint8Array(8);return Ue(r,t,0),Ue(r,i,4),r}function xe(e){let t=new Uint8Array(4);return Ue(t,e),t}function H(e){let t=new Uint8Array(e.length);for(let i=0;i<e.length;i++){let r=e.charCodeAt(i);if(r>127)throw new TypeError("non-ASCII string encountered in encode()");t[i]=r}return t}function dt(e){if(Uint8Array.prototype.toBase64)return e.toBase64();let t=32768,i=[];for(let r=0;r<e.length;r+=t)i.push(String.fromCharCode.apply(null,e.subarray(r,r+t)));return btoa(i.join(""))}function lt(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(e);let t=atob(e),i=new Uint8Array(t.length);for(let r=0;r<t.length;r++)i[r]=t.charCodeAt(r);return i}function ge(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(typeof e=="string"?e:Be.decode(e),{alphabet:"base64url"});let t=e;t instanceof Uint8Array&&(t=Be.decode(t)),t=t.replace(/-/g,"+").replace(/_/g,"/");try{return lt(t)}catch(i){throw new TypeError("The input to be decoded is not correctly encoded.")}}function A(e){let t=e;return typeof t=="string"&&(t=st.encode(t)),Uint8Array.prototype.toBase64?t.toBase64({alphabet:"base64url",omitPadding:!0}):dt(t).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}var M=(e,t="algorithm.name")=>new TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`),ve=(e,t)=>
105e.name===t;function ai(e){return parseInt(e.name.slice(4),10)}function si(e,t){if(ai(e.hash)!==t)throw M(`SHA-${t}`,"algorithm.hash")}function ci(e,t){if(t&&!e.usages.includes(t))throw new TypeError(`CryptoKey does not support this operation, its usages must include ${t}.`)}function F(e,t,i){switch(t){case"A128GCM":case"A192GCM":case"A256GCM":{if(!ve(e.algorithm,"AES-GCM"))throw M("AES-GCM");let r=parseInt(t.slice(1,4),10);if(e.algorithm.length!==r)throw M(r,"algorithm.length");break}case"A128KW":case"A192KW":case"A256KW":{if(!ve(e.algorithm,"AES-KW"))throw M("AES-KW");let r=parseInt(t.slice(1,4),10);if(e.algorithm.length!==r)throw M(r,"algorithm.length");break}case"ECDH":{switch(e.algorithm.name){case"ECDH":case"X25519":break;default:throw M("ECDH or X25519")}break}case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":if(!ve(e.algorithm,"PBKDF2"))throw M("PBKDF2");break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":{if(!ve(e.algorithm,"RSA-OAEP"))throw M("RSA-OAEP");si(e.algorithm,parseInt(t.slice(9),10)||1);break}default:throw new TypeError("CryptoKey does not support this operation")}ci(e,i)}function pt(e,t,...i){if(i=i.filter(Boolean),i.length>2){let r=i.pop();e+=`one of type ${i.join(", ")}, or ${r}.`}else i.length===2?e+=`one of type ${i[0]} or ${i[1]}.`:e+=`of type ${i[0]}.`;return t==null?e+=` Received ${t}`:typeof t=="function"&&t.name?e+=` Received function ${t.name}`:typeof t=="object"&&t!=null&&t.constructor?.name&&(e+=` Received an instance of ${t.constructor.name}`),e}var ee=(e,...t)=>pt("Key must be ",e,...t),Ne=(e,t,...i)=>pt(`Key for the ${e} algorithm must be `,t,...i);var mt=(()=>{class e extends Error{static code="ERR_JOSE_GENERIC";code="ERR_JOSE_GENERIC";constructor(i,r){super(i,r),this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}}return e})();var y=(()=>{class e extends mt{static code="ERR_JOSE_NOT_SUPPORTED";code="ERR_JOSE_NOT_SUPPORTED"}return e})();var _=(()=>{class e extends mt{static code="ERR_JWE_INVALID";code="ERR_JWE_INVALID"}return e})();function Oe(e){if(!L(e))throw new Error("CryptoKey instance expected")}var L=e=>{if(e?.[Symbol.toStringTag]==="CryptoKey")return!0;try{return e instanceof CryptoKey}catch(t){return!1}},te=e=>e?.[Symbol.toStringTag]==="KeyObject",He=e=>L(e)||te(e);function Me(e){switch(e){case"A128GCM":return 128;case"A192GCM":return 192;case"A256GCM":case"A128CBC-HS256":return 256;case"A192CBC-HS384":return 384;case"A256CBC-HS512":return 512;default:throw new y(`Unsupported JWE Algorithm: ${e}`)}}var k=e=>crypto.getRandomValues(new Uint8Array(Me(e)>>3));function ft(e,t){let i=e.byteLength<<3;if(i!==t)throw new _(`Invalid Content Encryption Key length. Expected ${t} bits, got ${i} bits`)}function ut(e){switch(e){case"A128GCM":case"A128GCMKW":case"A192GCM":case"A192GCMKW":case"A256GCM":case"A256GCMKW":return 96;case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return 128;default:throw new y(`Unsupported JWE Algorithm: ${e}`)}}var di=e=>crypto.getRandomValues(new Uint8Array(ut(e)>>3));function li(e,t){if(t.length<<3!==ut(e))throw new _("Invalid Initialization Vector length")}function pi(e,t,i){return l(this,null,function*(){if(!(t instanceof Uint8Array))throw new TypeError(ee(t,"Uint8Array"));let r=parseInt(e.slice(1,4),10),n=yield crypto.subtle.importKey("raw",t.subarray(r>>3),"AES-CBC",!1,[i]),a=yield crypto.subtle.importKey("raw",t.subarray(0,r>>3),{hash:`SHA-${r<<1}`,name:"HMAC"},!1,["sign"]);return{encKey:n,macKey:a,keySize:r}})}function mi(e,t,i){return l(this,null,function*(){return new Uint8Array((yield crypto.subtle.sign("HMAC",e,t)).slice(0,i>>3))})}function fi(e,t,i,r,n){return l(this,null,function*(){let{encKey:a,macKey:s,keySize:p}=yield pi(e,i,"encrypt"),u=new Uint8Array(yield crypto.subtle.encrypt({iv:r,name:"AES-CBC"},a,t)),h=W(n,r,u,ct(n.length<<3)),x=yield mi(s,h,p);return{ciphertext:u,tag:x,iv:r}})}function ui(e,t,i,r,n){return l(this,null,function*(){let a;i instanceof Uint8Array?a=yield crypto.subtle.importKey("raw",i,"AES-GCM",!1,["encrypt"]):(F(i,e,"encrypt"),a=i);let s=new Uint8Array(yield crypto.subtle.encrypt({additionalData:n,iv:r,name:"AES-GCM",tagLength:128},a,t)),p=s.slice(-16);return{ciphertext:s.slice(0,-16),tag:p,iv:r}})}var hi="Unsupported JWE Content Encryption Algorithm";function _e(e,t,i,r,n){return l(this,null,function*(){if(!L(i)&&!(i instanceof Uint8Array))throw new TypeError(ee(i,"CryptoKey","KeyObject","Uint8Array","JSON Web Key"));switch(r?li(e,r):r=di(e),e){case"A128CBC-HS256":case"A192CBC-HS384":case"A256CBC-HS512":return i instanceof Uint8Array&&ft(i,parseInt(e.slice(-3),10)),fi(e,t,i,r,n);case"A128GCM":case"A192GCM":case"A256GCM":return i instanceof Uint8Array&&ft(i,parseInt(e.slice(1,4),10)),ui(e,t,i,r,n);
105default:throw new y(hi)}})}var ht=Symbol();function $(e,t){if(e)throw new TypeError(`${t} can only be called once`)}function yt(e,t){return l(this,null,function*(){let i=`SHA-${e.slice(-3)}`;return new Uint8Array(yield crypto.subtle.digest(i,t))})}var yi=e=>typeof e=="object"&&e!==null;function Le(e){if(!yi(e)||Object.prototype.toString.call(e)!=="[object Object]")return!1;if(Object.getPrototypeOf(e)===null)return!0;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function St(...e){let t=e.filter(Boolean);if(t.length===0||t.length===1)return!0;let i;for(let r of t){let n=Object.keys(r);if(!i||i.size===0){i=new Set(n);continue}for(let a of n){if(i.has(a))return!1;i.add(a)}}return!0}var ie=e=>Le(e)&&typeof e.kty=="string",Ct=e=>e.kty!=="oct"&&(e.kty==="AKP"&&typeof e.priv=="string"||typeof e.d=="string"),wt=e=>e.kty!=="oct"&&e.d===void 0&&e.priv===void 0,Et=e=>e.kty==="oct"&&typeof e.k=="string";function Ci(e,t){if(e.algorithm.length!==parseInt(t.slice(1,4),10))throw new TypeError(`Invalid key size for alg: ${t}`)}function wi(e,t,i){return e instanceof Uint8Array?crypto.subtle.importKey("raw",e,"AES-KW",!0,[i]):(F(e,t,i),e)}function re(e,t,i){return l(this,null,function*(){let r=yield wi(t,e,"wrapKey");Ci(r,e);let n=yield crypto.subtle.importKey("raw",i,{hash:"SHA-256",name:"HMAC"},!0,["sign"]);return new Uint8Array(yield crypto.subtle.wrapKey("raw",n,r,"AES-KW"))})}function Ve(e){return W(xe(e.length),e)}function Ei(e,t,i){return l(this,null,function*(){let r=t>>3,n=32,a=Math.ceil(r/n),s=new Uint8Array(a*n);for(let p=1;p<=a;p++){let u=new Uint8Array(4+e.length+i.length);u.set(xe(p),0),u.set(e,4),u.set(i,4+e.length);let h=yield yt("sha256",u);s.set(h,(p-1)*n)}return s.slice(0,r)})}function xt(s,p,u,h){return l(this,arguments,function*(e,t,i,r,n=new Uint8Array,a=new Uint8Array){F(e,"ECDH"),F(t,"ECDH","deriveBits");let x=Ve(H(i)),C=Ve(n),N=Ve(a),V=xe(r),D=new Uint8Array,J=W(x,C,N,V,D),b=new Uint8Array(yield crypto.subtle.deriveBits({name:e.algorithm.name,public:e},t,Ai(e)));return Ei(b,r,J)})}function Ai(e){return e.algorithm.name==="X25519"?256:Math.ceil(parseInt(e.algorithm.namedCurve.slice(-3),10)/8)<<3}function gt(e){switch(e.algorithm.namedCurve){case"P-256":case"P-384":case"P-521":return!0;default:return e.algorithm.name==="X25519"}}function vi(e,t){return e instanceof Uint8Array?crypto.subtle.importKey("raw",e,"PBKDF2",!1,["deriveBits"]):(F(e,t,"deriveBits"),e)}var _i=(e,t)=>W(H(e),Uint8Array.of(0),t);function bi(e,t,i,r){return l(this,null,function*(){if(!(e instanceof Uint8Array)||e.length<8)throw new _("PBES2 Salt Input must be 8 or more octets");if(!Number.isSafeInteger(i)||Math.sign(i)!==1)throw new _("PBES2 Count Input must be a positive integer");let n=_i(t,e),a=parseInt(t.slice(13,16),10),s={hash:`SHA-${t.slice(8,11)}`,iterations:i,name:"PBKDF2",salt:n},p=yield vi(r,t);return new Uint8Array(yield crypto.subtle.deriveBits(s,p,a))})}function vt(a,s,p){return l(this,arguments,function*(e,t,i,r=2048,n=crypto.getRandomValues(new Uint8Array(16))){let u=yield bi(n,e,r,t);return{encryptedKey:yield re(e.slice(-6),u,i),p2c:r,p2s:A(n)}})}function _t(e,t){if(e.startsWith("RS")||e.startsWith("PS")){let{modulusLength:i}=t.algorithm;if(typeof i!="number"||i<2048)throw new TypeError(`${e} requires key modulusLength to be 2048 bits or larger`)}}var Ki=e=>{switch(e){case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":return"RSA-OAEP";default:throw new y(`alg ${e} is not supported either by JOSE or your javascript runtime`)}};function bt(e,t,i){return l(this,null,function*(){return F(t,e,"encrypt"),_t(e,t),new Uint8Array(yield crypto.subtle.encrypt(Ki(e),t,i))})}var be='Invalid or unsupported JWK "alg" (Algorithm) Parameter value';function Pi(e){let t,i;switch(e.kty){case"AKP":{switch(e.alg){case"ML-DSA-44":case"ML-DSA-65":case"ML-DSA-87":t={name:e.alg},i=e.priv?["sign"]:["verify"];break;default:throw new y(be)}break}case"RSA":{switch(e.alg){case"PS256":case"PS384":case"PS512":t={name:"RSA-PSS",hash:`SHA-${e.alg.slice(-3)}`},i=e.d?["sign"]:["verify"];break;case"RS256":case"RS384":case"RS512":t={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${e.alg.slice(-3)}`},i=e.d?["sign"]:["verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":t={name:"RSA-OAEP",hash:`SHA-${parseInt(e.alg.slice(-3),10)||1}`},i=e.d?["decrypt","unwrapKey"]:["encrypt","wrapKey"];break;default:throw new y(be)}break}case"EC":{switch(e.alg){case"ES256":case"ES384":case"ES512":t={name:"ECDSA",namedCurve:{ES256:"P-256",ES384:"P-384",ES512:"P-521"}[e.alg]},i=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:"ECDH",namedCurve:e.crv},i=e.d?["deriveBits"]:[];break;default:throw new y(be)}break}
105case"OKP":{switch(e.alg){case"Ed25519":case"EdDSA":t={name:"Ed25519"},i=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":t={name:e.crv},i=e.d?["deriveBits"]:[];break;default:throw new y(be)}break}default:throw new y('Invalid or unsupported JWK "kty" (Key Type) Parameter value')}return{algorithm:t,keyUsages:i}}function Y(e){return l(this,null,function*(){if(!e.alg)throw new TypeError('"alg" argument is required when "jwk.alg" is not present');let{algorithm:t,keyUsages:i}=Pi(e),r=g({},e);return r.kty!=="AKP"&&delete r.alg,delete r.use,crypto.subtle.importKey("jwk",r,t,e.ext??!(e.d||e.priv),e.key_ops??i)})}var q="given KeyObject instance cannot be used for this algorithm",X,It=(e,t,i,r=!1)=>l(null,null,function*(){X||=new WeakMap;let n=X.get(e);if(n?.[i])return n[i];let a=yield Y(G(g({},t),{alg:i}));return r&&Object.freeze(e),n?n[i]=a:X.set(e,{[i]:a}),a}),Ti=(e,t)=>{X||=new WeakMap;let i=X.get(e);if(i?.[t])return i[t];let r=e.type==="public",n=!!r,a;if(e.asymmetricKeyType==="x25519"){switch(t){case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":break;default:throw new TypeError(q)}a=e.toCryptoKey(e.asymmetricKeyType,n,r?[]:["deriveBits"])}if(e.asymmetricKeyType==="ed25519"){if(t!=="EdDSA"&&t!=="Ed25519")throw new TypeError(q);a=e.toCryptoKey(e.asymmetricKeyType,n,[r?"verify":"sign"])}switch(e.asymmetricKeyType){case"ml-dsa-44":case"ml-dsa-65":case"ml-dsa-87":{if(t!==e.asymmetricKeyType.toUpperCase())throw new TypeError(q);a=e.toCryptoKey(e.asymmetricKeyType,n,[r?"verify":"sign"])}}if(e.asymmetricKeyType==="rsa"){let s;switch(t){case"RSA-OAEP":s="SHA-1";break;case"RS256":case"PS256":case"RSA-OAEP-256":s="SHA-256";break;case"RS384":case"PS384":case"RSA-OAEP-384":s="SHA-384";break;case"RS512":case"PS512":case"RSA-OAEP-512":s="SHA-512";break;default:throw new TypeError(q)}if(t.startsWith("RSA-OAEP"))return e.toCryptoKey({name:"RSA-OAEP",hash:s},n,r?["encrypt"]:["decrypt"]);a=e.toCryptoKey({name:t.startsWith("PS")?"RSA-PSS":"RSASSA-PKCS1-v1_5",hash:s},n,[r?"verify":"sign"])}if(e.asymmetricKeyType==="ec"){let p=new Map([["prime256v1","P-256"],["secp384r1","P-384"],["secp521r1","P-521"]]).get(e.asymmetricKeyDetails?.namedCurve);if(!p)throw new TypeError(q);let u={ES256:"P-256",ES384:"P-384",ES512:"P-521"};u[t]&&p===u[t]&&(a=e.toCryptoKey({name:"ECDSA",namedCurve:p},n,[r?"verify":"sign"])),t.startsWith("ECDH-ES")&&(a=e.toCryptoKey({name:"ECDH",namedCurve:p},n,r?[]:["deriveBits"]))}if(!a)throw new TypeError(q);return i?i[t]=a:X.set(e,{[t]:a}),a};function Ie(e,t){return l(this,null,function*(){if(e instanceof Uint8Array||L(e))return e;if(te(e)){if(e.type==="secret")return e.export();if("toCryptoKey"in e&&typeof e.toCryptoKey=="function")try{return Ti(e,t)}catch(r){if(r instanceof TypeError)throw r}let i=e.export({format:"jwk"});return It(e,i,t)}if(ie(e))return e.k?ge(e.k):It(e,e,t,!0);throw new Error("unreachable")})}function $e(e,t,i){return l(this,null,function*(){if(!Le(e))throw new TypeError("JWK must be an object");let r;switch(t??=e.alg,r??=i?.extractable??e.ext,e.kty){case"oct":if(typeof e.k!="string"||!e.k)throw new TypeError('missing "k" (Key Value) Parameter value');return ge(e.k);case"RSA":if("oth"in e&&e.oth!==void 0)throw new y('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');return Y(G(g({},e),{alg:t,ext:r}));case"AKP":{if(typeof e.alg!="string"||!e.alg)throw new TypeError('missing "alg" (Algorithm) Parameter value');if(t!==void 0&&t!==e.alg)throw new TypeError("JWK alg and alg option value mismatch");return Y(G(g({},e),{ext:r}))}case"EC":case"OKP":return Y(G(g({},e),{alg:t,ext:r}));default:throw new y('Unsupported "kty" (Key Type) Parameter value')}})}function Kt(e){return l(this,null,function*(){if(te(e))if(e.type==="secret")e=e.export();else return e.export({format:"jwk"});if(e instanceof Uint8Array)return{kty:"oct",k:A(e)};if(!L(e))throw new TypeError(ee(e,"CryptoKey","KeyObject","Uint8Array"));if(!e.extractable)throw new TypeError("non-extractable CryptoKey cannot be exported as a JWK");let s=yield crypto.subtle.exportKey("jwk",e),{ext:t,key_ops:i,alg:r,use:n}=s,a=Q(s,["ext","key_ops","alg","use"]);return a.kty==="AKP"&&(a.alg=r),a})}function Dt(e){return l(this,null,function*(){return Kt(e)})}function Pt(e,t,i,r){return l(this,null,function*(){let n=e.slice(0,7),a=yield _e(n,i,t,r,new Uint8Array);return{encryptedKey:a.ciphertext,iv:A(a.iv),tag:A(a.tag)}})}var Ri='Invalid or unsupported "alg" (JWE Algorithm) header value';function Tt(a,s,p,u){return l(this,arguments,function*(e,t,i,r,n={}){var N,V;let h,x,C;switch(e){case"dir":{C=i;break}case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":{if(Oe(i),!gt(i))throw new y("ECDH with the provided key is not allowed or not supported by your javascript runtime");let{apu:D,apv:J}=n,b;n.epk?b=yield Ie(n.epk,e):b=(yield crypto.subtle.generateKey(i.algorithm,!0,["deriveBits"])).privateKey;let{x:P,y:De,crv:Nt,kty:ze}=yield Dt(b),ke=yield xt(i,b,e==="ECDH-ES"?t:e,e==="ECDH-ES"?Me(t):parseInt(e.slice(-5,-2),10),D,J);
105if(x={epk:{x:P,crv:Nt,kty:ze}},ze==="EC"&&(x.epk.y=De),D&&(x.apu=A(D)),J&&(x.apv=A(J)),e==="ECDH-ES"){C=ke;break}C=r||k(t);let Ot=e.slice(-6);h=yield re(Ot,ke,C);break}case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":{C=r||k(t),Oe(i),h=yield bt(e,i,C);break}case"PBES2-HS256+A128KW":case"PBES2-HS384+A192KW":case"PBES2-HS512+A256KW":{C=r||k(t);let{p2c:D,p2s:J}=n;N=yield vt(e,i,C,D,J),{encryptedKey:h}=N,x=Q(N,["encryptedKey"]);break}case"A128KW":case"A192KW":case"A256KW":{C=r||k(t),h=yield re(e,i,C);break}case"A128GCMKW":case"A192GCMKW":case"A256GCMKW":{C=r||k(t);let{iv:D}=n;V=yield Pt(e,i,C,D),{encryptedKey:h}=V,x=Q(V,["encryptedKey"]);break}default:throw new y(Ri)}return{cek:C,encryptedKey:h,parameters:x}})}function Rt(e,t,i,r,n){if(n.crit!==void 0&&r?.crit===void 0)throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');if(!r||r.crit===void 0)return new Set;if(!Array.isArray(r.crit)||r.crit.length===0||r.crit.some(s=>typeof s!="string"||s.length===0))throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let a;i!==void 0?a=new Map([...Object.entries(i),...t.entries()]):a=t;for(let s of r.crit){if(!a.has(s))throw new y(`Extension Header Parameter "${s}" is not recognized`);if(n[s]===void 0)throw new e(`Extension Header Parameter "${s}" is missing`);if(a.get(s)&&r[s]===void 0)throw new e(`Extension Header Parameter "${s}" MUST be integrity protected`)}return new Set(r.crit)}var j=e=>e?.[Symbol.toStringTag],Ge=(e,t,i)=>{if(t.use!==void 0){let r;switch(i){case"sign":case"verify":r="sig";break;case"encrypt":case"decrypt":r="enc";break}if(t.use!==r)throw new TypeError(`Invalid key for this operation, its "use" must be "${r}" when present`)}if(t.alg!==void 0&&t.alg!==e)throw new TypeError(`Invalid key for this operation, its "alg" must be "${e}" when present`);if(Array.isArray(t.key_ops)){let r;switch(!0){case(i==="sign"||i==="verify"):case e==="dir":case e.includes("CBC-HS"):r=i;break;case e.startsWith("PBES2"):r="deriveBits";break;case/^A\d{3}(?:GCM)?(?:KW)?$/.test(e):!e.includes("GCM")&&e.endsWith("KW")?r=i==="encrypt"?"wrapKey":"unwrapKey":r=i;break;case(i==="encrypt"&&e.startsWith("RSA")):r="wrapKey";break;case i==="decrypt":r=e.startsWith("RSA")?"unwrapKey":"deriveBits";break}if(r&&t.key_ops?.includes?.(r)===!1)throw new TypeError(`Invalid key for this operation, its "key_ops" must include "${r}" when present`)}return!0},Wi=(e,t,i)=>{if(!(t instanceof Uint8Array)){if(ie(t)){if(Et(t)&&Ge(e,t,i))return;throw new TypeError('JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present')}if(!He(t))throw new TypeError(Ne(e,t,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"));if(t.type!=="secret")throw new TypeError(`${j(t)} instances for symmetric algorithms must be of type "secret"`)}},Fi=(e,t,i)=>{if(ie(t))switch(i){case"decrypt":case"sign":if(Ct(t)&&Ge(e,t,i))return;throw new TypeError("JSON Web Key for this operation must be a private JWK");case"encrypt":case"verify":if(wt(t)&&Ge(e,t,i))return;throw new TypeError("JSON Web Key for this operation must be a public JWK")}if(!He(t))throw new TypeError(Ne(e,t,"CryptoKey","KeyObject","JSON Web Key"));if(t.type==="secret")throw new TypeError(`${j(t)} instances for asymmetric algorithms must not be of type "secret"`);if(t.type==="public")switch(i){case"sign":throw new TypeError(`${j(t)} instances for asymmetric algorithm signing must be of type "private"`);case"decrypt":throw new TypeError(`${j(t)} instances for asymmetric algorithm decryption must be of type "private"`)}if(t.type==="private")switch(i){case"verify":throw new TypeError(`${j(t)} instances for asymmetric algorithm verifying must be of type "public"`);case"encrypt":throw new TypeError(`${j(t)} instances for asymmetric algorithm encryption must be of type "public"`)}};function Wt(e,t,i){switch(e.substring(0,2)){case"A1":case"A2":case"di":case"HS":case"PB":Wi(e,t,i);break;default:Fi(e,t,i)}}function Ji(e){if(typeof globalThis[e]>"u")throw new y(`JWE "zip" (Compression Algorithm) Header Parameter requires the ${e} API.`)}function Ft(e){return l(this,null,function*(){Ji("CompressionStream");let t=new CompressionStream("deflate-raw"),i=t.writable.getWriter();i.write(e).catch(()=>{}),i.close().catch(()=>{});let r=[],n=t.readable.getReader();for(;;){let{value:a,done:s}=yield n.read();if(s)break;r.push(a)}return W(...r)})}var Ke=class{#i;#e;#r;#t;#o;#n;#a;#s;constructor(t){if(!(t instanceof Uint8Array))throw new TypeError("plaintext must be an instance of Uint8Array");this.#i=t}setKeyManagementParameters(t){return $(this.#s,"setKeyManagementParameters"),this.#s=t,this}setProtectedHeader(t){return $(this.#e,"setProtectedHeader"),this.#e=t,this}setSharedUnprotectedHeader(t){return $(this.#r,"setSharedUnprotectedHeader"),this.#r=t,this}setUnprotectedHeader(t){return $(this.#t,"setUnprotectedHeader"),this.#t=t,this}setAdditionalAuthenticatedData(t){return this.#o=t,this}setContentEncryptionKey(t){return $(this.#n,"setContentEncryptionKey"),this.#n=t,this}setInitializationVector(t){return $(this.#a,"setInitializationVector"),this.#a=t,this}encrypt(t,i){return l(this,null,function*(){if(!this.#e&&!this.#t&&!this.#r)throw new _("either setProtectedHeader, setUnprotectedHeader, or sharedUnprotectedHeader must be called before #encrypt()");if(!St(this.#e,this.#t,this.#r))throw new _("JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint");
105let r=g(g(g({},this.#e),this.#t),this.#r);if(Rt(_,new Map,i?.crit,this.#e,r),r.zip!==void 0&&r.zip!=="DEF")throw new y('Unsupported JWE "zip" (Compression Algorithm) Header Parameter value.');if(r.zip!==void 0&&!this.#e?.zip)throw new _('JWE "zip" (Compression Algorithm) Header Parameter MUST be in a protected header.');let{alg:n,enc:a}=r;if(typeof n!="string"||!n)throw new _('JWE "alg" (Algorithm) Header Parameter missing or invalid');if(typeof a!="string"||!a)throw new _('JWE "enc" (Encryption Algorithm) Header Parameter missing or invalid');let s;if(this.#n&&(n==="dir"||n==="ECDH-ES"))throw new TypeError(`setContentEncryptionKey cannot be called with JWE "alg" (Algorithm) Header ${n}`);Wt(n==="dir"?a:n,t,"encrypt");let p;{let P,De=yield Ie(t,n);({cek:p,encryptedKey:s,parameters:P}=yield Tt(n,a,De,this.#n,this.#s)),P&&(i&&ht in i?this.#t?this.#t=g(g({},this.#t),P):this.setUnprotectedHeader(P):this.#e?this.#e=g(g({},this.#e),P):this.setProtectedHeader(P))}let u,h,x,C;if(this.#e?(h=A(JSON.stringify(this.#e)),x=H(h)):(h="",x=new Uint8Array),this.#o){C=A(this.#o);let P=H(C);u=W(x,H("."),P)}else u=x;let N=this.#i;r.zip==="DEF"&&(N=yield Ft(N).catch(P=>{throw new _("Failed to compress plaintext",{cause:P})}));let{ciphertext:V,tag:D,iv:J}=yield _e(a,N,p,this.#a,u),b={ciphertext:A(V)};return J&&(b.iv=A(J)),D&&(b.tag=A(D)),s&&(b.encrypted_key=A(s)),C&&(b.aad=C),this.#e&&(b.protected=h),this.#r&&(b.unprotected=this.#r),this.#t&&(b.header=this.#t),b})}};var ne=class{#i;constructor(t){this.#i=new Ke(t)}setContentEncryptionKey(t){return this.#i.setContentEncryptionKey(t),this}setInitializationVector(t){return this.#i.setInitializationVector(t),this}setProtectedHeader(t){return this.#i.setProtectedHeader(t),this}setKeyManagementParameters(t){return this.#i.setKeyManagementParameters(t),this}encrypt(t,i){return l(this,null,function*(){let r=yield this.#i.encrypt(t,i);return[r.protected,r.encrypted_key,r.iv,r.ciphertext,r.tag].join(".")})}};var Jt=(()=>{let t=class t{constructor(r){this.webAPI=r}getFormMetadata(){let r=[new ye({dynamicFormFieldTypeID:he.TEXT,key:"cardLast4",controlName:"cardLast4",label:"Last 4 Digits of Card",placeholder:"Last 4 digits of card",required:!0,maxLength:4,validators:[{validatorType:v.MIN_LENGTH,values:[4]},{validatorType:v.DIGITS},{validatorType:v.NUMBER}]}),new ye({dynamicFormFieldTypeID:he.TEXT,dynamicFormFieldTextBoxTypeID:Je.PASSWORD,key:"newPin",controlName:"newPin",label:"New PIN",placeholder:"New PIN (4 digits)",required:!0,maxLength:4,validators:[{validatorType:v.MIN_LENGTH,values:[4]},{validatorType:v.DIGITS},{validatorType:v.NUMBER}]}),new ye({dynamicFormFieldTypeID:he.TEXT,dynamicFormFieldTextBoxTypeID:Je.PASSWORD,key:"newPin_confirm",controlName:"newPin_confirm",label:"Confirm New PIN",placeholder:"Confirm New PIN",required:!0,maxLength:4,validators:[{validatorType:v.MIN_LENGTH,values:[4]},{validatorType:v.MATCH,message:"Must match Pin",values:[{controlName:"newPin",label:"New PIN"}]},{validatorType:v.DIGITS},{validatorType:v.NUMBER}]})];return Ye(r)}getEncryptedPin(r){return Z(fetch("https://issuing-key.stripe.com/v1/keys")).pipe(z(n=>Z(n.json())),z(n=>Z($e(n.jwk,"RSA-OAEP")).pipe(z(a=>{let s=new ne(new TextEncoder().encode(r)).setProtectedHeader({alg:"RSA-OAEP",enc:"A128CBC-HS256",kid:n.key_id}).encrypt(a);return Z(s)}))),qe(n=>{throw console.error("PIN encryption failed:",n),n}))}activateCard(r){return this.webAPI.patchData("team-accounts/cardholders/activate-card",r)}};t.\u0275fac=function(n){return new(n||t)(je(tt))},t.\u0275prov=Xe({token:t,factory:t.\u0275fac,providedIn:"root"});let e=t;return e})();function Bi(e,t){e&1&&(o(0,`
106          `),c(1,"app-loader"),o(2,"Loading..."),d(),o(3,`
107        `))}function Ni(e,t){if(e&1&&o(0),e&2){let i=S(3);Ze(`
108                Your card for `,i.activateCardResult.programName," - ",i.activateCardResult.teamName,` has been activated.
109              `)}}function Oi(e,t){e&1&&o(0,`
110                Your card has been activated.
111              `)}function Hi(e,t){if(e&1){let i=B();o(0,`
112            `),c(1,"app-inline-alert",5),o(2,`
113              `),w(3,Ni,1,2)(4,Oi,1,0),c(5,"div",6),o(6,`
114                `),c(7,"button",7),R("click",function(){I(i);let n=S(2);return K(n.navigateBackToDashboard())}),o(8,`
115                  Back to Dashboard
116                `),d(),o(9,`
117              `),d(),o(10,`
118            `),d(),o(11,`
119          `)}if(e&2){let i=S(2);m(),U("isInline",!0),m(2),E(i.activateCardResult!=null&&i.activateCardResult.programName&&(i.activateCardResult!=null&&i.activateCardResult.teamName)?3:4)}}function Mi(e,t){if(e&1){let i=B();o(0,`
120              `),c(1,"app-dynamic-form",8,0),R("onSubmit",function(n){I(i);let a=S(3);return K(a.save(n))})("onCancel",function(){I(i);let n=S(3);return K(n.cancel())}),o(3,`
121                `),f(4,"app-dynamic-form-field",9),o(5,`
122                `),f(6,"app-dynamic-form-field",10),o(7,`
123                `),f(8,"app-dynamic-form-field",11),o(9,`
124              `),d(),o(10,`
125            `)}if(e&2){let i=S(3);m(),U("hidden",i.success)("fields",i.fields)("contentFieldsMode",!0)("showCancelButton",!0)("showSubmitButton",!0)("submitButtonEnabled",!i.isSubmitting)("buttonsPosition","left")}}function Li(e,t){if(e&1&&(o(0,`
126            `),w(1,Mi,11,7)),e&2){let i=S(2);m(),E(i.fields?1:-1)}}function Vi(e,t){if(e&1&&(o(0,`
127          `),w(1,Hi,12,2),w(2,Li,2,1)),e&2){let i=S();m(),E(i.success?1:-1),m(),E(i.success?-1:2)}}var Ut=(()=>{let t=class t{constructor(r,n,a,s,p){this.route=r,this.router=n,this.cardholderCardActivateService=a,this.siteDataService=s,this.dynamicFormService=p,this.unsubscribe$=new oe,this.loading=!0,this.isSubmitting=!1,this.pinsMatch=!0,this.success=!1,this.fields=[],this.activateCardResult=null}ngOnInit(){this.route.params.pipe(O(this.unsubscribe$)).subscribe({next:r=>
127{this.loading=!1,this.siteDataService.hideSiteLoader()},error:()=>{this.loading=!1,this.router.navigate(["/dashboard"])}}),this.cardholderCardActivateService.getFormMetadata().pipe(O(this.unsubscribe$)).subscribe(r=>{this.fields=r})}ngOnDestroy(){this.unsubscribe$.next(),this.unsubscribe$.complete()}save(r){this.isSubmitting=!0,this.cardholderCardActivateService.getEncryptedPin(r.newPin).pipe(z(n=>{let a={cardLast4:r.cardLast4,newPinEncrypted:n};return this.cardholderCardActivateService.activateCard(a)})).subscribe({next:n=>{this.activateCardResult=n,this.isSubmitting=!1,n.success?this.success=!0:(this.success=!1,this.dynamicFormService.hideFormLoader(),this.siteDataService.showSiteErrorAlert(n.errorMessage||"There was a problem with activating your card."))},error:()=>{this.isSubmitting=!1,this.success=!1,this.dynamicFormService.hideFormLoader(),this.siteDataService.showSiteErrorAlert("There was a problem with activating your card.")}})}cancel(){this.navigateBackToDashboard()}navigateBackToDashboard(){this.router.navigate(["/dashboard"])}};t.\u0275fac=function(n){return new(n||t)(T(le),T(pe),T(Jt),T(me),T(Se))},t.\u0275cmp=se({type:t,selectors:[["app-cardholder-card-activate"]],standalone:!1,decls:20,vars:3,consts:[["form",""],[1,"container"],[1,"row","justify-content-center"],[1,"col-lg-8"],[1,"section-header","mt-3"],["alertType","success",3,"isInline"],[1,"row","form-action","no-gutters"],[1,"btn","btn-primary",3,"click"],["formID","cardholder-activate-form","submitButtonText","Activate","cancelButtonText","Cancel","submitButtonSavingText","Activating card...","submitButtonDisabledMessage","",3,"onSubmit","onCancel","hidden","fields","contentFieldsMode","showCancelButton","showSubmitButton","submitButtonEnabled","buttonsPosition"],["fieldName","cardLast4"],["fieldName","newPin"],["fieldName","newPin_confirm"]],template:function(n,a){n&1&&(c(0,"main"),o(1,`
128  `),c(2,"div",1),o(3,`
129    `),c(4,"div",2),o(5,`
130      `),c(6,"div",3),o(7,`
131        `),c(8,"div",4),o(9,`
132          `),c(10,"h2"),o(11),d(),o(12,`
133        `),d(),o(13,`
134        `),w(14,Bi,4,0),w(15,Vi,3,2),d(),o(16,`
135    `),d(),o(17,`
136  `),d(),o(18,`
137`),d(),o(19,`
138`)),n&2&&(m(11),de("Activate your card"),m(3),E(a.loading?14:-1),m(),E(a.loading?-1:15))},dependencies:[we,Ce,fe,ue],encapsulation:2});let e=t;return e})();var Bt=(()=>{let t=class t{};t.\u0275fac=function(n){return new(n||t)},t.\u0275mod=ce({type:t}),t.\u0275inj=ae({imports:[We.forChild([{path:"cardholder/:cardholderID/accept",component:at,canActivate:[Fe],data:{metaTitle:"Accept Cardholder Invitation"}},{path:"cardholder/activate-card",component:Ut,canActivate:[Fe],data:{metaTitle:"Activate Cardholder Card"}}]),We]});let e=t;return e})();var Uo=(()=>{let t=class t{};t.\u0275fac=function(n){return new(n||t)},t.\u0275mod=ce({type:t}),t.\u0275inj=ae({imports:[et,Bt,rt]});let e=t;return e})();export{Uo as TeamAccountsModule};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.