9 lines
46 KiB
JavaScript
9 lines
46 KiB
JavaScript
import{D as Bt,r as J,E as kt,G as Ht,H as ae,I as It,J as jt,K as zt,L as $t,B as ue,M as Kt,c as z,w as Nt,N as Jt,O as Yt,q as Y,C as Gt,P as Qt,Q as xt,d as N,i as U,u as F,e as R,f as h,t as P,n as re,_ as Q,F as ne,x as le,R as Wt,S as Rt,o as At,l as ce,z as Zt,T as Xt,k as ye,U as en,V as tn}from"./_plugin-vue_export-helper-R4vr2A9I.js";import{f as G,g as Ge}from"./helpers-CU0-cyzg.js";let Tt;const de=e=>Tt=e,Mt=Symbol();function He(e){return e&&typeof e=="object"&&Object.prototype.toString.call(e)==="[object Object]"&&typeof e.toJSON!="function"}var se;(function(e){e.direct="direct",e.patchObject="patch object",e.patchFunction="patch function"})(se||(se={}));function Sr(){const e=Bt(!0),r=e.run(()=>J({}));let o=[],t=[];const n=kt({install(s){de(n),n._a=s,s.provide(Mt,n),s.config.globalProperties.$pinia=n,t.forEach(i=>o.push(i)),t=[]},use(s){return this._a?o.push(s):t.push(s),this},_p:o,_a:null,_e:e,_s:new Map,state:r});return n}const Pt=()=>{};function Qe(e,r,o,t=Pt){e.add(r);const n=()=>{e.delete(r)&&t()};return!o&&zt()&&$t(n),n}function X(e,...r){e.forEach(o=>{o(...r)})}const nn=e=>e(),xe=Symbol(),we=Symbol();function je(e,r){e instanceof Map&&r instanceof Map?r.forEach((o,t)=>e.set(t,o)):e instanceof Set&&r instanceof Set&&r.forEach(e.add,e);for(const o in r){if(!r.hasOwnProperty(o))continue;const t=r[o],n=e[o];He(n)&&He(t)&&e.hasOwnProperty(o)&&!ae(t)&&!It(t)?e[o]=je(n,t):e[o]=t}return e}const sn=Symbol();function rn(e){return!He(e)||!Object.prototype.hasOwnProperty.call(e,sn)}const{assign:K}=Object;function on(e){return!!(ae(e)&&e.effect)}function an(e,r,o,t){const{state:n,actions:s,getters:i}=r,u=o.state.value[e];let a;function c(){u||(o.state.value[e]=n?n():{});const f=Kt(o.state.value[e]);return K(f,s,Object.keys(i||{}).reduce((y,w)=>(y[w]=kt(z(()=>{de(o);const d=o._s.get(e);return i[w].call(d,d)})),y),{}))}return a=Lt(e,c,r,o,t,!0),a}function Lt(e,r,o={},t,n,s){let i;const u=K({actions:{}},o),a={deep:!0};let c,f,y=new Set,w=new Set,d;const l=t.state.value[e];!s&&!l&&(t.state.value[e]={}),J({});let _;function L(m){let g;c=f=!1,typeof m=="function"?(m(t.state.value[e]),g={type:se.patchFunction,storeId:e,events:d}):(je(t.state.value[e],m),g={type:se.patchObject,payload:m,storeId:e,events:d});const v=_=Symbol();ue().then(()=>{_===v&&(c=!0)}),f=!0,X(y,g,t.state.value[e])}const I=s?function(){const{state:g}=o,v=g?g():{};this.$patch(b=>{K(b,v)})}:Pt;function p(){i.stop(),y.clear(),w.clear(),t._s.delete(e)}const C=(m,g="")=>{if(xe in m)return m[we]=g,m;const v=function(){de(t);const b=Array.from(arguments),B=new Set,k=new Set;function T(D){B.add(D)}function V(D){k.add(D)}X(w,{args:b,name:v[we],store:M,after:T,onError:V});let q;try{q=m.apply(this&&this.$id===e?this:M,b)}catch(D){throw X(k,D),D}return q instanceof Promise?q.then(D=>(X(B,D),D)).catch(D=>(X(k,D),Promise.reject(D))):(X(B,q),q)};return v[xe]=!0,v[we]=g,v},A={_p:t,$id:e,$onAction:Qe.bind(null,w),$patch:L,$reset:I,$subscribe(m,g={}){const v=Qe(y,m,g.detached,()=>b()),b=i.run(()=>Nt(()=>t.state.value[e],B=>{(g.flush==="sync"?f:c)&&m({storeId:e,type:se.direct,events:d},B)},K({},a,g)));return v},$dispose:p},M=Ht(A);t._s.set(e,M);const E=(t._a&&t._a.runWithContext||nn)(()=>t._e.run(()=>(i=Bt()).run(()=>r({action:C}))));for(const m in E){const g=E[m];if(ae(g)&&!on(g)||It(g))s||(l&&rn(g)&&(ae(g)?g.value=l[m]:je(g,l[m])),t.state.value[e][m]=g);else if(typeof g=="function"){const v=C(g,m);E[m]=v,u.actions[m]=g}}return K(M,E),K(jt(M),E),Object.defineProperty(M,"$state",{get:()=>t.state.value[e],set:m=>{L(g=>{K(g,m)})}}),t._p.forEach(m=>{K(M,i.run(()=>m({store:M,app:t._a,pinia:t,options:u})))}),l&&s&&o.hydrate&&o.hydrate(M.$state,l),c=!0,f=!0,M}function un(e,r,o){let t;const n=typeof r=="function";t=n?o:r;function s(i,u){const a=Yt();return i=i||(a?Jt(Mt,null):null),i&&de(i),i=Tt,i._s.has(e)||(n?Lt(e,r,t,i):an(e,t,i)),i._s.get(e)}return s.$id=e,s}const ze=un("auth",{state:()=>({userInfo:null,isLoading:!1,settings:null,currentView:"login",status:{message:"",type:"info",show:!1}}),getters:{},actions:{setLoading(e){this.isLoading=!!e},showMessage(e,r="info",o=3e3){this.status={message:e,type:r,show:!0},o>0&&setTimeout(()=>{this.status.show=!1},o)},async setSessionCookie(e){if(!e?.session_token)throw console.error("setSessionCookie called with missing session_token:",e),new Error("Authentication response missing session_token");return await Y("/auth/api/set-session",{method:"POST",headers:{Authorization:`Bearer ${e.session_token}`}})},async register(){this.isLoading=!0;try{const e=await xt();return await this.setSessionCookie(e),await this.loadUserInfo(),this.selectView(),e}finally{this.isLoading=!1}},async authenticate(){this.isLoading=!0;try{const e=await Qt();return await this.setSessionCookie(e),await this.loadUserInfo(),this.selectView(),e}finally{this.isLoading=!1}},selectView(){this.userInfo?this.currentView="profile":this.currentView="login"},async loadSettings(){this.settings=await Gt()},async loadUserInfo(){try{this.userInfo=await Y("/auth/api/user-info",{method:"POST"}),console.log("User info loaded:",this.userInfo)}catch(e){throw e.status===401||e.status===403?console.log("Authentication required:",e.message):this.showMessage(e.message||"Failed to load user info","error",5e3),e}},async deleteCredential(e){await Y(`/auth/api/user/credential/${e}`,{method:"DELETE"}),await this.loadUserInfo()},async terminateSession(e){try{if((await Y(`/auth/api/user/session/${e}`,{method:"DELETE"}))?.current_session_terminated){sessionStorage.clear(),location.reload();return}await this.loadUserInfo(),this.showMessage("Session terminated","success",2500)}catch(r){throw console.error("Terminate session error:",r),r}},async logout(){try{await Y("/auth/api/logout",{method:"POST"}),sessionStorage.clear(),location.reload()}catch(e){console.error("Logout error:",e),e.status!==401&&e.status!==403&&this.showMessage(e.message,"error")}},async logoutEverywhere(){try{await Y("/auth/api/user/logout-all",{method:"POST"}),sessionStorage.clear(),location.reload()}catch(e){console.error("Logout-all error:",e),e.status!==401&&e.status!==403&&this.showMessage(e.message,"error")}}}}),ln={key:0,class:"global-status",style:{display:"block"}},Er={__name:"StatusMessage",setup(e){const r=ze();return(o,t)=>F(r).status.show?(R(),N("div",ln,[h("div",{class:re(["status",F(r).status.type])},P(F(r).status.message),3)])):U("",!0)}},cn={key:0,class:"breadcrumbs","aria-label":"Breadcrumb"},dn=["href"],fn={key:0,class:"sep"},hn={__name:"Breadcrumbs",props:{entries:{type:Array,default:()=>[]},showHome:{type:Boolean,default:!0},homeHref:{type:String,default:"/"}},setup(e){const r=e,o=z(()=>[...r.showHome?[{label:"🏠",href:r.homeHref}]:[],...r.entries]);return(t,n)=>o.value.length?(R(),N("nav",cn,[h("ol",null,[(R(!0),N(ne,null,le(o.value,(s,i)=>(R(),N("li",{key:i},[h("a",{href:s.href},P(s.label),9,dn),i<o.value.length-1?(R(),N("span",fn," — ")):U("",!0)]))),128))])])):U("",!0)}},Br=Q(hn,[["__scopeId","data-v-2924b990"]]),gn={class:"credential-list"},mn={key:0},yn={key:1},wn=["onFocusin"],pn={class:"item-top"},vn={class:"item-icon"},Cn=["src","alt"],bn={key:1,class:"auth-emoji"},_n={class:"item-title"},Sn={class:"item-actions"},En={key:0,class:"badge badge-current"},Bn={key:1,class:"badge badge-current"},kn={key:2,class:"badge badge-current"},In=["onClick","disabled","title"],Nn={class:"item-details"},Rn={class:"credential-dates"},An={class:"date-value"},Tn={class:"date-value"},Mn={class:"date-value"},kr={__name:"CredentialList",props:{credentials:{type:Array,default:()=>[]},aaguidInfo:{type:Object,default:()=>({})},loading:{type:Boolean,default:!1},allowDelete:{type:Boolean,default:!1},hoveredCredentialUuid:{type:String,default:null},hoveredSessionCredentialUuid:{type:String,default:null}},emits:["delete","credentialHover"],setup(e,{emit:r}){const o=e,t=r,n=a=>{t("credentialHover",a)},s=a=>{a.currentTarget.contains(a.relatedTarget)||t("credentialHover",null)},i=a=>{const c=o.aaguidInfo?.[a.aaguid];return c?c.name:"Unknown Authenticator"},u=a=>{const c=o.aaguidInfo?.[a.aaguid];if(!c)return null;const y=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"icon_dark":"icon_light";return c[y]||null};return(a,c)=>(R(),N("div",gn,[e.loading?(R(),N("div",mn,[...c[1]||(c[1]=[h("p",null,"Loading credentials...",-1)])])):e.credentials?.length?(R(!0),N(ne,{key:2},le(e.credentials,f=>(R(),N("div",{key:f.credential_uuid,class:re(["credential-item",{"current-session":f.is_current_session&&!e.hoveredCredentialUuid&&!e.hoveredSessionCredentialUuid,"is-hovered":e.hoveredCredentialUuid===f.credential_uuid,"is-linked-session":e.hoveredSessionCredentialUuid===f.credential_uuid}]),tabindex:"0",onFocusin:y=>n(f.credential_uuid),onFocusout:c[0]||(c[0]=y=>s(y))},[h("div",pn,[h("div",vn,[u(f)?(R(),N("img",{key:0,src:u(f),alt:i(f),class:"auth-icon",width:"32",height:"32"},null,8,Cn)):(R(),N("span",bn,"🔑"))]),h("h4",_n,P(i(f)),1),h("div",Sn,[f.is_current_session&&!e.hoveredCredentialUuid&&!e.hoveredSessionCredentialUuid?(R(),N("span",En,"Current")):e.hoveredCredentialUuid===f.credential_uuid?(R(),N("span",Bn,"Selected")):e.hoveredSessionCredentialUuid===f.credential_uuid?(R(),N("span",kn,"Linked")):U("",!0),e.allowDelete?(R(),N("button",{key:3,onClick:y=>a.$emit("delete",f),class:"btn-card-delete",disabled:f.is_current_session,title:f.is_current_session?"Cannot delete current session credential":"Delete passkey"},"🗑️",8,In)):U("",!0)])]),h("div",Nn,[h("div",Rn,[c[3]||(c[3]=h("span",{class:"date-label"},"Created:",-1)),h("span",An,P(F(G)(f.created_at)),1),c[4]||(c[4]=h("span",{class:"date-label"},"Last used:",-1)),h("span",Tn,P(F(G)(f.last_used)),1),c[5]||(c[5]=h("span",{class:"date-label"},"Last verified:",-1)),h("span",Mn,P(F(G)(f.last_verified)),1)])])],42,wn))),128)):(R(),N("div",yn,[...c[2]||(c[2]=[h("p",null,"No passkeys found.",-1)])]))]))}},Pn={key:0,class:"user-info"},Ln={class:"user-name-heading"},Dn={class:"user-name-row"},Un=["title"],qn={key:0,class:"org-role-sub"},Fn={key:0,class:"org-line"},Vn={key:1,class:"role-line"},On={__name:"UserBasicInfo",props:{name:{type:String,required:!0},visits:{type:[Number,String],default:0},createdAt:{type:[String,Number,Date],default:null},lastSeen:{type:[String,Number,Date],default:null},updateEndpoint:{type:String,default:null},canEdit:{type:Boolean,default:!0},loading:{type:Boolean,default:!1},orgDisplayName:{type:String,default:""},roleName:{type:String,default:""}},emits:["saved","editName"],setup(e,{emit:r}){const o=e,t=r;ze();const n=z(()=>!!o.name);return(s,i)=>n.value?(R(),N("div",Pn,[h("h3",Ln,[i[1]||(i[1]=h("span",{class:"icon"},"👤",-1)),h("span",Dn,[h("span",{class:"display-name",title:e.name},P(e.name),9,Un),e.canEdit&&e.updateEndpoint?(R(),N("button",{key:0,class:"mini-btn",onClick:i[0]||(i[0]=u=>t("editName")),title:"Edit name"},"✏️")):U("",!0)])]),e.orgDisplayName||e.roleName?(R(),N("div",qn,[e.orgDisplayName?(R(),N("div",Fn,P(e.orgDisplayName),1)):U("",!0),e.roleName?(R(),N("div",Vn,P(e.roleName),1)):U("",!0)])):U("",!0),i[2]||(i[2]=h("span",null,[h("strong",null,"Visits:")],-1)),h("span",null,P(e.visits||0),1),i[3]||(i[3]=h("span",null,[h("strong",null,"Registered:")],-1)),h("span",null,P(F(G)(e.createdAt)),1),i[4]||(i[4]=h("span",null,[h("strong",null,"Last seen:")],-1)),h("span",null,P(F(G)(e.lastSeen)),1)])):U("",!0)}},Ir=Q(On,[["__scopeId","data-v-2994268a"]]),Hn={class:"modal",role:"dialog","aria-modal":"true"},jn={__name:"Modal",emits:["close"],setup(e){return(r,o)=>(R(),N("div",{class:"modal-overlay",onKeydown:o[0]||(o[0]=Rt(t=>r.$emit("close"),["esc"])),tabindex:"-1"},[h("div",Hn,[Wt(r.$slots,"default",{},void 0)])],32))}},Nr=Q(jn,[["__scopeId","data-v-d5e0cc32"]]),zn={class:"name-edit-form"},$n=["for"],Kn=["id","type","placeholder","disabled"],Jn={key:0,class:"error small"},Yn={class:"modal-actions"},Gn=["disabled"],Qn=["disabled"],xn={__name:"NameEditForm",props:{modelValue:{type:String,default:""},label:{type:String,default:"Name"},placeholder:{type:String,default:""},submitText:{type:String,default:"Save"},cancelText:{type:String,default:"Cancel"},busy:{type:Boolean,default:!1},error:{type:String,default:""},autoFocus:{type:Boolean,default:!0},autoSelect:{type:Boolean,default:!0},inputId:{type:String,default:null},inputType:{type:String,default:"text"}},emits:["update:modelValue","cancel"],setup(e,{emit:r}){const o=e,t=r,n=J(null),s=`name-edit-${Math.random().toString(36).slice(2,10)}`,i=z({get:()=>o.modelValue,set:c=>t("update:modelValue",c)}),u=z(()=>o.inputId||s);At(()=>{o.autoFocus&&ue(()=>{o.autoSelect?n.value?.select():n.value?.focus()})});function a(){t("cancel")}return(c,f)=>(R(),N("div",zn,[h("label",{for:u.value},[ce(P(e.label)+" ",1),Zt(h("input",{id:u.value,ref_key:"inputRef",ref:n,type:e.inputType,placeholder:e.placeholder,"onUpdate:modelValue":f[0]||(f[0]=y=>i.value=y),disabled:e.busy,required:""},null,8,Kn),[[Xt,i.value]])],8,$n),e.error?(R(),N("div",Jn,P(e.error),1)):U("",!0),h("div",Yn,[h("button",{type:"button",class:"btn-secondary",onClick:a,disabled:e.busy},P(e.cancelText),9,Gn),h("button",{type:"submit",class:"btn-primary",disabled:e.busy},P(e.submitText),9,Qn)])]))}},Rr=Q(xn,[["__scopeId","data-v-944620d3"]]),Wn={class:"section-block","data-component":"session-list-section"},Zn={class:"section-header"},Xn={class:"section-description"},es={class:"section-body"},ts={class:re(["session-list"])},ns=["href"],ss={class:"session-group-sessions"},rs=["onFocusin"],os={class:"item-top"},is={class:"item-title"},as={class:"item-actions"},us={key:0,class:"badge badge-current"},ls={key:1,class:"badge badge-current"},cs={key:2,class:"badge badge-current"},ds={key:3,class:"badge"},fs=["onClick","disabled","title"],hs={class:"item-details"},gs={class:"session-dates"},ms={class:"date-label"},ys={class:"date-value"},ws={key:1,class:"empty-state"},Ar={__name:"SessionList",props:{sessions:{type:Array,default:()=>[]},emptyMessage:{type:String,default:"You currently have no other active sessions."},sectionDescription:{type:String,default:"Review where you're signed in and end any sessions you no longer recognize."},terminatingSessions:{type:Object,default:()=>({})},hoveredCredentialUuid:{type:String,default:null}},emits:["terminate","sessionHover"],setup(e,{emit:r}){const o=e,t=r,n=J(null),s=J(null),i=l=>{s.value=l,n.value=l.ip||null,t("sessionHover",l)},u=l=>{l.currentTarget.contains(l.relatedTarget)||(s.value=null,n.value=null,t("sessionHover",null))},a=l=>!!o.terminatingSessions[l],c=l=>`${l.includes(":")?"http":"https"}://${l}`,f=l=>l?l.includes(":")?new URL(`http://[${l}]/`).hostname.split(":").slice(0,4).join(":"):l:null,y=z(()=>{if(n.value)return f(n.value);const l=o.sessions.find(_=>_.is_current);return l?f(l.ip):null}),w=l=>!y.value||!l?!1:f(l)===y.value,d=z(()=>{const l={};for(const p of o.sessions){const C=p.host||"";l[C]||(l[C]={sessions:[],isCurrentSite:!1}),l[C].sessions.push(p),p.is_current_host&&(l[C].isCurrentSite=!0)}for(const p in l)l[p].sessions.sort((C,A)=>new Date(A.last_renewed)-new Date(C.last_renewed));const _=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"}),L=Object.keys(l).sort(_.compare),I={};for(const p of L)I[p]=l[p];return I});return(l,_)=>(R(),N("section",Wn,[h("div",Zn,[_[1]||(_[1]=h("h2",null,"Active Sessions",-1)),h("p",Xn,P(e.sectionDescription),1)]),h("div",es,[h("div",ts,[Array.isArray(e.sessions)&&e.sessions.length?(R(!0),N(ne,{key:0},le(d.value,(L,I)=>(R(),N("div",{key:I,class:"session-group"},[h("h3",{class:re(["session-group-host",{"is-current-site":L.isCurrentSite}])},[I?(R(),N("a",{key:0,href:c(I)},"🌐 "+P(I),9,ns)):(R(),N(ne,{key:1},[ce("🌐 Unbound host")],64))],2),h("div",ss,[(R(!0),N(ne,null,le(L.sessions,p=>(R(),N("div",{key:p.id,class:re(["session-item",{"is-current":p.is_current&&!n.value&&!e.hoveredCredentialUuid,"is-hovered":s.value?.id===p.id,"is-linked-credential":e.hoveredCredentialUuid===p.credential_uuid}]),tabindex:"0",onFocusin:C=>i(p),onFocusout:_[0]||(_[0]=C=>u(C))},[h("div",os,[h("h4",is,P(p.user_agent),1),h("div",as,[p.is_current&&!n.value&&!e.hoveredCredentialUuid?(R(),N("span",us,"Current")):s.value?.id===p.id?(R(),N("span",ls,"Selected")):e.hoveredCredentialUuid===p.credential_uuid?(R(),N("span",cs,"Linked")):!e.hoveredCredentialUuid&&w(p.ip)?(R(),N("span",ds,"Same IP")):U("",!0),h("button",{onClick:C=>l.$emit("terminate",p),class:"btn-card-delete",disabled:a(p.id),title:a(p.id)?"Terminating...":"Terminate session"},"🗑️",8,fs)])]),h("div",hs,[h("div",gs,[h("span",ms,P(F(G)(p.last_renewed)),1),h("span",ys,P(p.ip),1)])])],42,rs))),128))])]))),128)):(R(),N("div",ws,[h("p",null,P(e.emptyMessage),1)]))])])]))}};function ps(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ee={},pe,We;function vs(){return We||(We=1,pe=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),pe}var ve={},$={},Ze;function x(){if(Ze)return $;Ze=1;let e;const r=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];return $.getSymbolSize=function(t){if(!t)throw new Error('"version" cannot be null or undefined');if(t<1||t>40)throw new Error('"version" should be in range from 1 to 40');return t*4+17},$.getSymbolTotalCodewords=function(t){return r[t]},$.getBCHDigit=function(o){let t=0;for(;o!==0;)t++,o>>>=1;return t},$.setToSJISFunction=function(t){if(typeof t!="function")throw new Error('"toSJISFunc" is not a valid function.');e=t},$.isKanjiModeEnabled=function(){return typeof e<"u"},$.toSJIS=function(t){return e(t)},$}var Ce={},Xe;function $e(){return Xe||(Xe=1,(function(e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function r(o){if(typeof o!="string")throw new Error("Param is not a string");switch(o.toLowerCase()){case"l":case"low":return e.L;case"m":case"medium":return e.M;case"q":case"quartile":return e.Q;case"h":case"high":return e.H;default:throw new Error("Unknown EC Level: "+o)}}e.isValid=function(t){return t&&typeof t.bit<"u"&&t.bit>=0&&t.bit<4},e.from=function(t,n){if(e.isValid(t))return t;try{return r(t)}catch{return n}}})(Ce)),Ce}var be,et;function Cs(){if(et)return be;et=1;function e(){this.buffer=[],this.length=0}return e.prototype={get:function(r){const o=Math.floor(r/8);return(this.buffer[o]>>>7-r%8&1)===1},put:function(r,o){for(let t=0;t<o;t++)this.putBit((r>>>o-t-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(r){const o=Math.floor(this.length/8);this.buffer.length<=o&&this.buffer.push(0),r&&(this.buffer[o]|=128>>>this.length%8),this.length++}},be=e,be}var _e,tt;function bs(){if(tt)return _e;tt=1;function e(r){if(!r||r<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=r,this.data=new Uint8Array(r*r),this.reservedBit=new Uint8Array(r*r)}return e.prototype.set=function(r,o,t,n){const s=r*this.size+o;this.data[s]=t,n&&(this.reservedBit[s]=!0)},e.prototype.get=function(r,o){return this.data[r*this.size+o]},e.prototype.xor=function(r,o,t){this.data[r*this.size+o]^=t},e.prototype.isReserved=function(r,o){return this.reservedBit[r*this.size+o]},_e=e,_e}var Se={},nt;function _s(){return nt||(nt=1,(function(e){const r=x().getSymbolSize;e.getRowColCoords=function(t){if(t===1)return[];const n=Math.floor(t/7)+2,s=r(t),i=s===145?26:Math.ceil((s-13)/(2*n-2))*2,u=[s-7];for(let a=1;a<n-1;a++)u[a]=u[a-1]-i;return u.push(6),u.reverse()},e.getPositions=function(t){const n=[],s=e.getRowColCoords(t),i=s.length;for(let u=0;u<i;u++)for(let a=0;a<i;a++)u===0&&a===0||u===0&&a===i-1||u===i-1&&a===0||n.push([s[u],s[a]]);return n}})(Se)),Se}var Ee={},st;function Ss(){if(st)return Ee;st=1;const e=x().getSymbolSize,r=7;return Ee.getPositions=function(t){const n=e(t);return[[0,0],[n-r,0],[0,n-r]]},Ee}var Be={},rt;function Es(){return rt||(rt=1,(function(e){e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const r={N1:3,N2:3,N3:40,N4:10};e.isValid=function(n){return n!=null&&n!==""&&!isNaN(n)&&n>=0&&n<=7},e.from=function(n){return e.isValid(n)?parseInt(n,10):void 0},e.getPenaltyN1=function(n){const s=n.size;let i=0,u=0,a=0,c=null,f=null;for(let y=0;y<s;y++){u=a=0,c=f=null;for(let w=0;w<s;w++){let d=n.get(y,w);d===c?u++:(u>=5&&(i+=r.N1+(u-5)),c=d,u=1),d=n.get(w,y),d===f?a++:(a>=5&&(i+=r.N1+(a-5)),f=d,a=1)}u>=5&&(i+=r.N1+(u-5)),a>=5&&(i+=r.N1+(a-5))}return i},e.getPenaltyN2=function(n){const s=n.size;let i=0;for(let u=0;u<s-1;u++)for(let a=0;a<s-1;a++){const c=n.get(u,a)+n.get(u,a+1)+n.get(u+1,a)+n.get(u+1,a+1);(c===4||c===0)&&i++}return i*r.N2},e.getPenaltyN3=function(n){const s=n.size;let i=0,u=0,a=0;for(let c=0;c<s;c++){u=a=0;for(let f=0;f<s;f++)u=u<<1&2047|n.get(c,f),f>=10&&(u===1488||u===93)&&i++,a=a<<1&2047|n.get(f,c),f>=10&&(a===1488||a===93)&&i++}return i*r.N3},e.getPenaltyN4=function(n){let s=0;const i=n.data.length;for(let a=0;a<i;a++)s+=n.data[a];return Math.abs(Math.ceil(s*100/i/5)-10)*r.N4};function o(t,n,s){switch(t){case e.Patterns.PATTERN000:return(n+s)%2===0;case e.Patterns.PATTERN001:return n%2===0;case e.Patterns.PATTERN010:return s%3===0;case e.Patterns.PATTERN011:return(n+s)%3===0;case e.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(s/3))%2===0;case e.Patterns.PATTERN101:return n*s%2+n*s%3===0;case e.Patterns.PATTERN110:return(n*s%2+n*s%3)%2===0;case e.Patterns.PATTERN111:return(n*s%3+(n+s)%2)%2===0;default:throw new Error("bad maskPattern:"+t)}}e.applyMask=function(n,s){const i=s.size;for(let u=0;u<i;u++)for(let a=0;a<i;a++)s.isReserved(a,u)||s.xor(a,u,o(n,a,u))},e.getBestMask=function(n,s){const i=Object.keys(e.Patterns).length;let u=0,a=1/0;for(let c=0;c<i;c++){s(c),e.applyMask(c,n);const f=e.getPenaltyN1(n)+e.getPenaltyN2(n)+e.getPenaltyN3(n)+e.getPenaltyN4(n);e.applyMask(c,n),f<a&&(a=f,u=c)}return u}})(Be)),Be}var ie={},ot;function Dt(){if(ot)return ie;ot=1;const e=$e(),r=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],o=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];return ie.getBlocksCount=function(n,s){switch(s){case e.L:return r[(n-1)*4+0];case e.M:return r[(n-1)*4+1];case e.Q:return r[(n-1)*4+2];case e.H:return r[(n-1)*4+3];default:return}},ie.getTotalCodewordsCount=function(n,s){switch(s){case e.L:return o[(n-1)*4+0];case e.M:return o[(n-1)*4+1];case e.Q:return o[(n-1)*4+2];case e.H:return o[(n-1)*4+3];default:return}},ie}var ke={},te={},it;function Bs(){if(it)return te;it=1;const e=new Uint8Array(512),r=new Uint8Array(256);return(function(){let t=1;for(let n=0;n<255;n++)e[n]=t,r[t]=n,t<<=1,t&256&&(t^=285);for(let n=255;n<512;n++)e[n]=e[n-255]})(),te.log=function(t){if(t<1)throw new Error("log("+t+")");return r[t]},te.exp=function(t){return e[t]},te.mul=function(t,n){return t===0||n===0?0:e[r[t]+r[n]]},te}var at;function ks(){return at||(at=1,(function(e){const r=Bs();e.mul=function(t,n){const s=new Uint8Array(t.length+n.length-1);for(let i=0;i<t.length;i++)for(let u=0;u<n.length;u++)s[i+u]^=r.mul(t[i],n[u]);return s},e.mod=function(t,n){let s=new Uint8Array(t);for(;s.length-n.length>=0;){const i=s[0];for(let a=0;a<n.length;a++)s[a]^=r.mul(n[a],i);let u=0;for(;u<s.length&&s[u]===0;)u++;s=s.slice(u)}return s},e.generateECPolynomial=function(t){let n=new Uint8Array([1]);for(let s=0;s<t;s++)n=e.mul(n,new Uint8Array([1,r.exp(s)]));return n}})(ke)),ke}var Ie,ut;function Is(){if(ut)return Ie;ut=1;const e=ks();function r(o){this.genPoly=void 0,this.degree=o,this.degree&&this.initialize(this.degree)}return r.prototype.initialize=function(t){this.degree=t,this.genPoly=e.generateECPolynomial(this.degree)},r.prototype.encode=function(t){if(!this.genPoly)throw new Error("Encoder not initialized");const n=new Uint8Array(t.length+this.degree);n.set(t);const s=e.mod(n,this.genPoly),i=this.degree-s.length;if(i>0){const u=new Uint8Array(this.degree);return u.set(s,i),u}return s},Ie=r,Ie}var Ne={},Re={},Ae={},lt;function Ut(){return lt||(lt=1,Ae.isValid=function(r){return!isNaN(r)&&r>=1&&r<=40}),Ae}var O={},ct;function qt(){if(ct)return O;ct=1;const e="[0-9]+",r="[A-Z $%*+\\-./:]+";let o="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";o=o.replace(/u/g,"\\u");const t="(?:(?![A-Z0-9 $%*+\\-./:]|"+o+`)(?:.|[\r
|
|
]))+`;O.KANJI=new RegExp(o,"g"),O.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),O.BYTE=new RegExp(t,"g"),O.NUMERIC=new RegExp(e,"g"),O.ALPHANUMERIC=new RegExp(r,"g");const n=new RegExp("^"+o+"$"),s=new RegExp("^"+e+"$"),i=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return O.testKanji=function(a){return n.test(a)},O.testNumeric=function(a){return s.test(a)},O.testAlphanumeric=function(a){return i.test(a)},O}var dt;function W(){return dt||(dt=1,(function(e){const r=Ut(),o=qt();e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(s,i){if(!s.ccBits)throw new Error("Invalid mode: "+s);if(!r.isValid(i))throw new Error("Invalid version: "+i);return i>=1&&i<10?s.ccBits[0]:i<27?s.ccBits[1]:s.ccBits[2]},e.getBestModeForData=function(s){return o.testNumeric(s)?e.NUMERIC:o.testAlphanumeric(s)?e.ALPHANUMERIC:o.testKanji(s)?e.KANJI:e.BYTE},e.toString=function(s){if(s&&s.id)return s.id;throw new Error("Invalid mode")},e.isValid=function(s){return s&&s.bit&&s.ccBits};function t(n){if(typeof n!="string")throw new Error("Param is not a string");switch(n.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+n)}}e.from=function(s,i){if(e.isValid(s))return s;try{return t(s)}catch{return i}}})(Re)),Re}var ft;function Ns(){return ft||(ft=1,(function(e){const r=x(),o=Dt(),t=$e(),n=W(),s=Ut(),i=7973,u=r.getBCHDigit(i);function a(w,d,l){for(let _=1;_<=40;_++)if(d<=e.getCapacity(_,l,w))return _}function c(w,d){return n.getCharCountIndicator(w,d)+4}function f(w,d){let l=0;return w.forEach(function(_){const L=c(_.mode,d);l+=L+_.getBitsLength()}),l}function y(w,d){for(let l=1;l<=40;l++)if(f(w,l)<=e.getCapacity(l,d,n.MIXED))return l}e.from=function(d,l){return s.isValid(d)?parseInt(d,10):l},e.getCapacity=function(d,l,_){if(!s.isValid(d))throw new Error("Invalid QR Code version");typeof _>"u"&&(_=n.BYTE);const L=r.getSymbolTotalCodewords(d),I=o.getTotalCodewordsCount(d,l),p=(L-I)*8;if(_===n.MIXED)return p;const C=p-c(_,d);switch(_){case n.NUMERIC:return Math.floor(C/10*3);case n.ALPHANUMERIC:return Math.floor(C/11*2);case n.KANJI:return Math.floor(C/13);case n.BYTE:default:return Math.floor(C/8)}},e.getBestVersionForData=function(d,l){let _;const L=t.from(l,t.M);if(Array.isArray(d)){if(d.length>1)return y(d,L);if(d.length===0)return 1;_=d[0]}else _=d;return a(_.mode,_.getLength(),L)},e.getEncodedBits=function(d){if(!s.isValid(d)||d<7)throw new Error("Invalid QR Code version");let l=d<<12;for(;r.getBCHDigit(l)-u>=0;)l^=i<<r.getBCHDigit(l)-u;return d<<12|l}})(Ne)),Ne}var Te={},ht;function Rs(){if(ht)return Te;ht=1;const e=x(),r=1335,o=21522,t=e.getBCHDigit(r);return Te.getEncodedBits=function(s,i){const u=s.bit<<3|i;let a=u<<10;for(;e.getBCHDigit(a)-t>=0;)a^=r<<e.getBCHDigit(a)-t;return(u<<10|a)^o},Te}var Me={},Pe,gt;function As(){if(gt)return Pe;gt=1;const e=W();function r(o){this.mode=e.NUMERIC,this.data=o.toString()}return r.getBitsLength=function(t){return 10*Math.floor(t/3)+(t%3?t%3*3+1:0)},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(t){let n,s,i;for(n=0;n+3<=this.data.length;n+=3)s=this.data.substr(n,3),i=parseInt(s,10),t.put(i,10);const u=this.data.length-n;u>0&&(s=this.data.substr(n),i=parseInt(s,10),t.put(i,u*3+1))},Pe=r,Pe}var Le,mt;function Ts(){if(mt)return Le;mt=1;const e=W(),r=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function o(t){this.mode=e.ALPHANUMERIC,this.data=t}return o.getBitsLength=function(n){return 11*Math.floor(n/2)+6*(n%2)},o.prototype.getLength=function(){return this.data.length},o.prototype.getBitsLength=function(){return o.getBitsLength(this.data.length)},o.prototype.write=function(n){let s;for(s=0;s+2<=this.data.length;s+=2){let i=r.indexOf(this.data[s])*45;i+=r.indexOf(this.data[s+1]),n.put(i,11)}this.data.length%2&&n.put(r.indexOf(this.data[s]),6)},Le=o,Le}var De,yt;function Ms(){if(yt)return De;yt=1;const e=W();function r(o){this.mode=e.BYTE,typeof o=="string"?this.data=new TextEncoder().encode(o):this.data=new Uint8Array(o)}return r.getBitsLength=function(t){return t*8},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(o){for(let t=0,n=this.data.length;t<n;t++)o.put(this.data[t],8)},De=r,De}var Ue,wt;function Ps(){if(wt)return Ue;wt=1;const e=W(),r=x();function o(t){this.mode=e.KANJI,this.data=t}return o.getBitsLength=function(n){return n*13},o.prototype.getLength=function(){return this.data.length},o.prototype.getBitsLength=function(){return o.getBitsLength(this.data.length)},o.prototype.write=function(t){let n;for(n=0;n<this.data.length;n++){let s=r.toSJIS(this.data[n]);if(s>=33088&&s<=40956)s-=33088;else if(s>=57408&&s<=60351)s-=49472;else throw new Error("Invalid SJIS character: "+this.data[n]+`
|
|
Make sure your charset is UTF-8`);s=(s>>>8&255)*192+(s&255),t.put(s,13)}},Ue=o,Ue}var qe={exports:{}},pt;function Ls(){return pt||(pt=1,(function(e){var r={single_source_shortest_paths:function(o,t,n){var s={},i={};i[t]=0;var u=r.PriorityQueue.make();u.push(t,0);for(var a,c,f,y,w,d,l,_,L;!u.empty();){a=u.pop(),c=a.value,y=a.cost,w=o[c]||{};for(f in w)w.hasOwnProperty(f)&&(d=w[f],l=y+d,_=i[f],L=typeof i[f]>"u",(L||_>l)&&(i[f]=l,u.push(f,l),s[f]=c))}if(typeof n<"u"&&typeof i[n]>"u"){var I=["Could not find a path from ",t," to ",n,"."].join("");throw new Error(I)}return s},extract_shortest_path_from_predecessor_list:function(o,t){for(var n=[],s=t;s;)n.push(s),o[s],s=o[s];return n.reverse(),n},find_path:function(o,t,n){var s=r.single_source_shortest_paths(o,t,n);return r.extract_shortest_path_from_predecessor_list(s,n)},PriorityQueue:{make:function(o){var t=r.PriorityQueue,n={},s;o=o||{};for(s in t)t.hasOwnProperty(s)&&(n[s]=t[s]);return n.queue=[],n.sorter=o.sorter||t.default_sorter,n},default_sorter:function(o,t){return o.cost-t.cost},push:function(o,t){var n={value:o,cost:t};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};e.exports=r})(qe)),qe.exports}var vt;function Ds(){return vt||(vt=1,(function(e){const r=W(),o=As(),t=Ts(),n=Ms(),s=Ps(),i=qt(),u=x(),a=Ls();function c(I){return unescape(encodeURIComponent(I)).length}function f(I,p,C){const A=[];let M;for(;(M=I.exec(C))!==null;)A.push({data:M[0],index:M.index,mode:p,length:M[0].length});return A}function y(I){const p=f(i.NUMERIC,r.NUMERIC,I),C=f(i.ALPHANUMERIC,r.ALPHANUMERIC,I);let A,M;return u.isKanjiModeEnabled()?(A=f(i.BYTE,r.BYTE,I),M=f(i.KANJI,r.KANJI,I)):(A=f(i.BYTE_KANJI,r.BYTE,I),M=[]),p.concat(C,A,M).sort(function(E,m){return E.index-m.index}).map(function(E){return{data:E.data,mode:E.mode,length:E.length}})}function w(I,p){switch(p){case r.NUMERIC:return o.getBitsLength(I);case r.ALPHANUMERIC:return t.getBitsLength(I);case r.KANJI:return s.getBitsLength(I);case r.BYTE:return n.getBitsLength(I)}}function d(I){return I.reduce(function(p,C){const A=p.length-1>=0?p[p.length-1]:null;return A&&A.mode===C.mode?(p[p.length-1].data+=C.data,p):(p.push(C),p)},[])}function l(I){const p=[];for(let C=0;C<I.length;C++){const A=I[C];switch(A.mode){case r.NUMERIC:p.push([A,{data:A.data,mode:r.ALPHANUMERIC,length:A.length},{data:A.data,mode:r.BYTE,length:A.length}]);break;case r.ALPHANUMERIC:p.push([A,{data:A.data,mode:r.BYTE,length:A.length}]);break;case r.KANJI:p.push([A,{data:A.data,mode:r.BYTE,length:c(A.data)}]);break;case r.BYTE:p.push([{data:A.data,mode:r.BYTE,length:c(A.data)}])}}return p}function _(I,p){const C={},A={start:{}};let M=["start"];for(let S=0;S<I.length;S++){const E=I[S],m=[];for(let g=0;g<E.length;g++){const v=E[g],b=""+S+g;m.push(b),C[b]={node:v,lastCount:0},A[b]={};for(let B=0;B<M.length;B++){const k=M[B];C[k]&&C[k].node.mode===v.mode?(A[k][b]=w(C[k].lastCount+v.length,v.mode)-w(C[k].lastCount,v.mode),C[k].lastCount+=v.length):(C[k]&&(C[k].lastCount=v.length),A[k][b]=w(v.length,v.mode)+4+r.getCharCountIndicator(v.mode,p))}}M=m}for(let S=0;S<M.length;S++)A[M[S]].end=0;return{map:A,table:C}}function L(I,p){let C;const A=r.getBestModeForData(I);if(C=r.from(p,A),C!==r.BYTE&&C.bit<A.bit)throw new Error('"'+I+'" cannot be encoded with mode '+r.toString(C)+`.
|
|
Suggested mode is: `+r.toString(A));switch(C===r.KANJI&&!u.isKanjiModeEnabled()&&(C=r.BYTE),C){case r.NUMERIC:return new o(I);case r.ALPHANUMERIC:return new t(I);case r.KANJI:return new s(I);case r.BYTE:return new n(I)}}e.fromArray=function(p){return p.reduce(function(C,A){return typeof A=="string"?C.push(L(A,null)):A.data&&C.push(L(A.data,A.mode)),C},[])},e.fromString=function(p,C){const A=y(p,u.isKanjiModeEnabled()),M=l(A),S=_(M,C),E=a.find_path(S.map,"start","end"),m=[];for(let g=1;g<E.length-1;g++)m.push(S.table[E[g]].node);return e.fromArray(d(m))},e.rawSplit=function(p){return e.fromArray(y(p,u.isKanjiModeEnabled()))}})(Me)),Me}var Ct;function Us(){if(Ct)return ve;Ct=1;const e=x(),r=$e(),o=Cs(),t=bs(),n=_s(),s=Ss(),i=Es(),u=Dt(),a=Is(),c=Ns(),f=Rs(),y=W(),w=Ds();function d(S,E){const m=S.size,g=s.getPositions(E);for(let v=0;v<g.length;v++){const b=g[v][0],B=g[v][1];for(let k=-1;k<=7;k++)if(!(b+k<=-1||m<=b+k))for(let T=-1;T<=7;T++)B+T<=-1||m<=B+T||(k>=0&&k<=6&&(T===0||T===6)||T>=0&&T<=6&&(k===0||k===6)||k>=2&&k<=4&&T>=2&&T<=4?S.set(b+k,B+T,!0,!0):S.set(b+k,B+T,!1,!0))}}function l(S){const E=S.size;for(let m=8;m<E-8;m++){const g=m%2===0;S.set(m,6,g,!0),S.set(6,m,g,!0)}}function _(S,E){const m=n.getPositions(E);for(let g=0;g<m.length;g++){const v=m[g][0],b=m[g][1];for(let B=-2;B<=2;B++)for(let k=-2;k<=2;k++)B===-2||B===2||k===-2||k===2||B===0&&k===0?S.set(v+B,b+k,!0,!0):S.set(v+B,b+k,!1,!0)}}function L(S,E){const m=S.size,g=c.getEncodedBits(E);let v,b,B;for(let k=0;k<18;k++)v=Math.floor(k/3),b=k%3+m-8-3,B=(g>>k&1)===1,S.set(v,b,B,!0),S.set(b,v,B,!0)}function I(S,E,m){const g=S.size,v=f.getEncodedBits(E,m);let b,B;for(b=0;b<15;b++)B=(v>>b&1)===1,b<6?S.set(b,8,B,!0):b<8?S.set(b+1,8,B,!0):S.set(g-15+b,8,B,!0),b<8?S.set(8,g-b-1,B,!0):b<9?S.set(8,15-b-1+1,B,!0):S.set(8,15-b-1,B,!0);S.set(g-8,8,1,!0)}function p(S,E){const m=S.size;let g=-1,v=m-1,b=7,B=0;for(let k=m-1;k>0;k-=2)for(k===6&&k--;;){for(let T=0;T<2;T++)if(!S.isReserved(v,k-T)){let V=!1;B<E.length&&(V=(E[B]>>>b&1)===1),S.set(v,k-T,V),b--,b===-1&&(B++,b=7)}if(v+=g,v<0||m<=v){v-=g,g=-g;break}}}function C(S,E,m){const g=new o;m.forEach(function(T){g.put(T.mode.bit,4),g.put(T.getLength(),y.getCharCountIndicator(T.mode,S)),T.write(g)});const v=e.getSymbolTotalCodewords(S),b=u.getTotalCodewordsCount(S,E),B=(v-b)*8;for(g.getLengthInBits()+4<=B&&g.put(0,4);g.getLengthInBits()%8!==0;)g.putBit(0);const k=(B-g.getLengthInBits())/8;for(let T=0;T<k;T++)g.put(T%2?17:236,8);return A(g,S,E)}function A(S,E,m){const g=e.getSymbolTotalCodewords(E),v=u.getTotalCodewordsCount(E,m),b=g-v,B=u.getBlocksCount(E,m),k=g%B,T=B-k,V=Math.floor(g/B),q=Math.floor(b/B),D=q+1,Ke=V-q,Vt=new a(Ke);let fe=0;const oe=new Array(B),Je=new Array(B);let he=0;const Ot=new Uint8Array(S.buffer);for(let Z=0;Z<B;Z++){const me=Z<T?q:D;oe[Z]=Ot.slice(fe,fe+me),Je[Z]=Vt.encode(oe[Z]),fe+=me,he=Math.max(he,me)}const ge=new Uint8Array(g);let Ye=0,H,j;for(H=0;H<he;H++)for(j=0;j<B;j++)H<oe[j].length&&(ge[Ye++]=oe[j][H]);for(H=0;H<Ke;H++)for(j=0;j<B;j++)ge[Ye++]=Je[j][H];return ge}function M(S,E,m,g){let v;if(Array.isArray(S))v=w.fromArray(S);else if(typeof S=="string"){let V=E;if(!V){const q=w.rawSplit(S);V=c.getBestVersionForData(q,m)}v=w.fromString(S,V||40)}else throw new Error("Invalid data");const b=c.getBestVersionForData(v,m);if(!b)throw new Error("The amount of data is too big to be stored in a QR Code");if(!E)E=b;else if(E<b)throw new Error(`
|
|
The chosen QR Code version cannot contain this amount of data.
|
|
Minimum version required to store current data is: `+b+`.
|
|
`);const B=C(E,m,v),k=e.getSymbolSize(E),T=new t(k);return d(T,E),l(T),_(T,E),I(T,m,0),E>=7&&L(T,E),p(T,B),isNaN(g)&&(g=i.getBestMask(T,I.bind(null,T,m))),i.applyMask(g,T),I(T,m,g),{modules:T,version:E,errorCorrectionLevel:m,maskPattern:g,segments:v}}return ve.create=function(E,m){if(typeof E>"u"||E==="")throw new Error("No input text");let g=r.M,v,b;return typeof m<"u"&&(g=r.from(m.errorCorrectionLevel,r.M),v=c.from(m.version),b=i.from(m.maskPattern),m.toSJISFunc&&e.setToSJISFunction(m.toSJISFunc)),M(E,v,g,b)},ve}var Fe={},Ve={},bt;function Ft(){return bt||(bt=1,(function(e){function r(o){if(typeof o=="number"&&(o=o.toString()),typeof o!="string")throw new Error("Color should be defined as hex string");let t=o.slice().replace("#","").split("");if(t.length<3||t.length===5||t.length>8)throw new Error("Invalid hex color: "+o);(t.length===3||t.length===4)&&(t=Array.prototype.concat.apply([],t.map(function(s){return[s,s]}))),t.length===6&&t.push("F","F");const n=parseInt(t.join(""),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:n&255,hex:"#"+t.slice(0,6).join("")}}e.getOptions=function(t){t||(t={}),t.color||(t.color={});const n=typeof t.margin>"u"||t.margin===null||t.margin<0?4:t.margin,s=t.width&&t.width>=21?t.width:void 0,i=t.scale||4;return{width:s,scale:s?4:i,margin:n,color:{dark:r(t.color.dark||"#000000ff"),light:r(t.color.light||"#ffffffff")},type:t.type,rendererOpts:t.rendererOpts||{}}},e.getScale=function(t,n){return n.width&&n.width>=t+n.margin*2?n.width/(t+n.margin*2):n.scale},e.getImageWidth=function(t,n){const s=e.getScale(t,n);return Math.floor((t+n.margin*2)*s)},e.qrToImageData=function(t,n,s){const i=n.modules.size,u=n.modules.data,a=e.getScale(i,s),c=Math.floor((i+s.margin*2)*a),f=s.margin*a,y=[s.color.light,s.color.dark];for(let w=0;w<c;w++)for(let d=0;d<c;d++){let l=(w*c+d)*4,_=s.color.light;if(w>=f&&d>=f&&w<c-f&&d<c-f){const L=Math.floor((w-f)/a),I=Math.floor((d-f)/a);_=y[u[L*i+I]?1:0]}t[l++]=_.r,t[l++]=_.g,t[l++]=_.b,t[l]=_.a}}})(Ve)),Ve}var _t;function qs(){return _t||(_t=1,(function(e){const r=Ft();function o(n,s,i){n.clearRect(0,0,s.width,s.height),s.style||(s.style={}),s.height=i,s.width=i,s.style.height=i+"px",s.style.width=i+"px"}function t(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}e.render=function(s,i,u){let a=u,c=i;typeof a>"u"&&(!i||!i.getContext)&&(a=i,i=void 0),i||(c=t()),a=r.getOptions(a);const f=r.getImageWidth(s.modules.size,a),y=c.getContext("2d"),w=y.createImageData(f,f);return r.qrToImageData(w.data,s,a),o(y,c,f),y.putImageData(w,0,0),c},e.renderToDataURL=function(s,i,u){let a=u;typeof a>"u"&&(!i||!i.getContext)&&(a=i,i=void 0),a||(a={});const c=e.render(s,i,a),f=a.type||"image/png",y=a.rendererOpts||{};return c.toDataURL(f,y.quality)}})(Fe)),Fe}var Oe={},St;function Fs(){if(St)return Oe;St=1;const e=Ft();function r(n,s){const i=n.a/255,u=s+'="'+n.hex+'"';return i<1?u+" "+s+'-opacity="'+i.toFixed(2).slice(1)+'"':u}function o(n,s,i){let u=n+s;return typeof i<"u"&&(u+=" "+i),u}function t(n,s,i){let u="",a=0,c=!1,f=0;for(let y=0;y<n.length;y++){const w=Math.floor(y%s),d=Math.floor(y/s);!w&&!c&&(c=!0),n[y]?(f++,y>0&&w>0&&n[y-1]||(u+=c?o("M",w+i,.5+d+i):o("m",a,0),a=0,c=!1),w+1<s&&n[y+1]||(u+=o("h",f),f=0)):a++}return u}return Oe.render=function(s,i,u){const a=e.getOptions(i),c=s.modules.size,f=s.modules.data,y=c+a.margin*2,w=a.color.light.a?"<path "+r(a.color.light,"fill")+' d="M0 0h'+y+"v"+y+'H0z"/>':"",d="<path "+r(a.color.dark,"stroke")+' d="'+t(f,c,a.margin)+'"/>',l='viewBox="0 0 '+y+" "+y+'"',L='<svg xmlns="http://www.w3.org/2000/svg" '+(a.width?'width="'+a.width+'" height="'+a.width+'" ':"")+l+' shape-rendering="crispEdges">'+w+d+`</svg>
|
|
`;return typeof u=="function"&&u(null,L),L},Oe}var Et;function Vs(){if(Et)return ee;Et=1;const e=vs(),r=Us(),o=qs(),t=Fs();function n(s,i,u,a,c){const f=[].slice.call(arguments,1),y=f.length,w=typeof f[y-1]=="function";if(!w&&!e())throw new Error("Callback required as last argument");if(w){if(y<2)throw new Error("Too few arguments provided");y===2?(c=u,u=i,i=a=void 0):y===3&&(i.getContext&&typeof c>"u"?(c=a,a=void 0):(c=a,a=u,u=i,i=void 0))}else{if(y<1)throw new Error("Too few arguments provided");return y===1?(u=i,i=a=void 0):y===2&&!i.getContext&&(a=u,u=i,i=void 0),new Promise(function(d,l){try{const _=r.create(u,a);d(s(_,i,a))}catch(_){l(_)}})}try{const d=r.create(u,a);c(null,s(d,i,a))}catch(d){c(d)}}return ee.create=r.create,ee.toCanvas=n.bind(null,o.render),ee.toDataURL=n.bind(null,o.renderToDataURL),ee.toString=n.bind(null,function(s,i,u){return t.render(s,u)}),ee}var Os=Vs();const Hs=ps(Os),js={class:"device-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"regTitle"},zs={class:"reg-header-row"},$s={id:"regTitle",class:"reg-title"},Ks={key:0},Js={key:1},Ys={class:"device-link-section"},Gs={class:"qr-container"},Qs=["href"],xs={class:"reg-help"},Ws={key:0},Zs={key:1},Xs={class:"reg-actions"},er={key:1,class:"registration-inline-wrapper"},tr={class:"registration-inline-block section-block"},nr={class:"section-header"},sr={class:"inline-heading"},rr={key:0},or={key:1},ir={class:"section-body"},ar={class:"device-link-section"},ur={class:"qr-container"},lr=["href"],cr={class:"reg-help"},dr={key:0},fr={key:1},hr={class:"button-row",style:{"margin-top":"1rem"}},gr={__name:"RegistrationLinkModal",props:{endpoint:{type:String,required:!0},autoCopy:{type:Boolean,default:!0},userName:{type:String,default:null},inline:{type:Boolean,default:!1},showCloseInInline:{type:Boolean,default:!1},prefixCopyWithUserName:{type:Boolean,default:!1}},emits:["close","generated","copied"],setup(e,{emit:r}){const o=ze(),t=e,n=r,s=J(null),i=J(null),u=J(null),a=z(()=>s.value?s.value.replace(/^[^:]+:\/\//,""):""),c=z(()=>{const d=G(i.value);return`⚠️ Expires ${d.startsWith("In ")?d.substring(3):d} and can only be used once.`});async function f(){try{const d=await Y(t.endpoint,{method:"POST"});s.value=d.url,i.value=d.expires,n("generated",{url:d.url,expires:d.expires}),await ue(),y(),t.autoCopy&&w()}catch(d){console.error("Failed to create link",d),en(d)&&o.showMessage(tn(d),"error",4e3),n("close")}}async function y(){s.value&&(await ue(),u.value&&Hs.toCanvas(u.value,s.value,{scale:8},d=>{d&&console.error(d)}))}async function w(){if(!s.value)return;let d=s.value;t.prefixCopyWithUserName&&t.userName&&(d=`${t.userName} ${d}`);try{await navigator.clipboard.writeText(d),n("copied",d),t.inline||n("close")}catch{}}return At(f),Nt(s,()=>y(),{flush:"post"}),(d,l)=>!e.inline&&s.value?(R(),N("div",{key:0,class:"dialog-overlay",onKeydown:l[2]||(l[2]=Rt(ye(_=>d.$emit("close"),["prevent"]),["esc"]))},[h("div",js,[h("div",zs,[h("h2",$s,[l[4]||(l[4]=ce(" 📱 ",-1)),e.userName?(R(),N("span",Ks,"Registration for "+P(e.userName),1)):(R(),N("span",Js,"Device Registration Link"))]),h("button",{class:"icon-btn",onClick:l[0]||(l[0]=_=>d.$emit("close")),"aria-label":"Close"},"❌")]),h("div",Ys,[h("div",Gs,[h("a",{href:s.value,onClick:ye(w,["prevent"]),class:"qr-link"},[h("canvas",{ref_key:"qrCanvas",ref:u,class:"qr-code"},null,512),h("p",null,P(a.value),1)],8,Qs),h("p",xs,[e.userName?(R(),N("span",Ws,"The user should open this link on the device where they want to register.")):(R(),N("span",Zs,"Open or scan this link on the device you wish to register to your account.")),l[5]||(l[5]=h("br",null,null,-1)),h("small",null,P(c.value),1)])])]),h("div",Xs,[h("button",{class:"btn-secondary",onClick:l[1]||(l[1]=_=>d.$emit("close"))},"Close"),h("button",{class:"btn-primary",onClick:w},"Copy Link")])])],32)):e.inline&&s.value?(R(),N("div",er,[h("div",tr,[h("div",nr,[h("h2",sr,[l[6]||(l[6]=ce("📱 ",-1)),e.userName?(R(),N("span",rr,"Registration for "+P(e.userName),1)):(R(),N("span",or,"Device Registration Link"))])]),h("div",ir,[h("div",ar,[h("div",ur,[h("a",{href:s.value,onClick:ye(w,["prevent"]),class:"qr-link"},[h("canvas",{ref_key:"qrCanvas",ref:u,class:"qr-code"},null,512),h("p",null,P(a.value),1)],8,lr),h("p",cr,[e.userName?(R(),N("span",dr,"The user should open this link on the device where they want to register.")):(R(),N("span",fr,"Open this link on the device you wish to connect with.")),l[7]||(l[7]=h("br",null,null,-1)),h("small",null,P(c.value),1)])])]),h("div",hr,[h("button",{class:"btn-primary",onClick:w},"Copy Link"),e.showCloseInInline?(R(),N("button",{key:0,class:"btn-secondary",onClick:l[3]||(l[3]=_=>d.$emit("close"))},"Close")):U("",!0)])])])])):U("",!0)}},Tr=Q(gr,[["__scopeId","data-v-5d6bcbcb"]]),mr={class:"loading-container"},yr={__name:"LoadingView",props:{message:{type:String,default:"Loading..."}},setup(e){return(r,o)=>(R(),N("div",mr,[o[0]||(o[0]=h("div",{class:"loading-spinner"},null,-1)),h("p",null,P(e.message),1)]))}},Mr=Q(yr,[["__scopeId","data-v-130f5abf"]]),wr={class:"message-container"},pr={class:"message-content"},vr={class:"button-row"},Cr={__name:"AccessDenied",emits:["reload"],setup(e){return(r,o)=>(R(),N("div",wr,[h("div",pr,[o[2]||(o[2]=h("h2",null,"🔒 Access Denied",-1)),h("div",vr,[h("button",{class:"btn-secondary",onClick:o[0]||(o[0]=(...t)=>F(Ge)&&F(Ge)(...t))},"Back"),h("button",{class:"btn-primary",onClick:o[1]||(o[1]=t=>r.$emit("reload"))},"Reload Page")])])]))}},Pr=Q(Cr,[["__scopeId","data-v-744305d5"]]);export{Pr as A,Br as B,Mr as L,Nr as M,Rr as N,Tr as R,Ir as U,kr as _,Ar as a,Er as b,Sr as c,ze as u};
|