import{_}from"./BCol.vue_vue_type_script_setup_true_lang-D0xTJQ30-C8E8teuV.js";import{_ as g}from"./BContainer.vue_vue_type_script_setup_true_lang-Bi1hGl0B-Bd4Gid1V.js";import{_ as b}from"./BRow.vue_vue_type_script_setup_true_lang-BDkBauhk-2kwIwZ0y.js";import{_ as I}from"./BButton.vue_vue_type_script_setup_true_lang-D5Eg7-Zv-DDRCX2AG.js";import{_ as w}from"./BAlert.vue_vue_type_script_setup_true_lang-BoLIpZFk-cCJ5v_dt.js";import{_ as y}from"./BImg.vue_vue_type_script_setup_true_lang-BJeFN9OT-6jJZkpT2.js";import{_ as $,c as r,o as s,w as e,a as k,h as x,d as l,b as n,t as o,e as c}from"./index-D02r7Zsc.js";import"./getClasses-CsgNQabU-zDOdZIGY.js";import"./useDefaults-DESCdb0p-CFLjYrdG.js";import"./useAlignment-Cw-9AVid-Db1FQC5G.js";import"./BSpinner.vue_vue_type_script_setup_true_lang-H1MzHypA-D8AXjJB0.js";import"./dom-DVb-f0ZG-Crdf0-mU.js";import"./useColorVariantClasses-ZDE19TZw-Cvu7SygP.js";import"./BLink.vue_vue_type_script_setup_true_lang-Ct47WhzE-DDPYis_D.js";import"./object-0ALvRU0O-3BORTTD-.js";import"./stringUtils-gJJ6T6UC-g5BZrMym.js";import"./index-C0p9vHHI-DoOEDIMw.js";import"./BCloseButton.vue_vue_type_script_setup_true_lang-byZmQ_ot-CWP55Z5N.js";import"./BProgress.vue_vue_type_script_setup_true_lang-DDTA5_ZV-eRxVOfNj.js";import"./useId-t29UARy6-BH5d2231.js";import"./useShowHide-717t6y_D-BZTBbOpd.js";import"./classes-BW_GpXTu-AKwVND4h.js";import"./useRadiusElementClasses-DtKYQuWz-DKKObN9q.js";const C={data:function(){return{userInfos:{login:"",password:"",sessionId:""},alert:!1,callbackURL:""}},created:function(){if(this.callbackURL=encodeURIComponent(window.location)+"&mobile_app=1",this.get("messageEventRegistered")===void 0){const t=new BroadcastChannel("mobile_app");t.onmessage=i=>{this.getMessage(i)},this.set("messageEventRegistered",1)}},mounted:function(){},watch:{authUrl:function(t,i){t!=""&&window.open(t,"_blank")}},computed:{authUrl:function(){if(this.callbackURL==""||this.getConfig().applimobile_opac_url=="")return"";var t=this.getConfig().applimobile_opac_url+"auth.php?mobile_app=1&callback_url="+this.callbackURL+"&action=";return this.get("logoutExt")==1?t+"logout":t+"check_auth"},disconnection:function(){return this.get("logoutExt")==1}},methods:{getMessage(t){t.data.sessId&&(this.userInfos.sessionId=t.data.sessId,this.userInfos.login=t.data.login,this.connection(),this.set("logoutExt",0))},async connection(){if(this.publish("showOverlay",!0),this.alert=!1,this.userInfos.sessionId==0){this.alert=!0,this.publish("showOverlay",!1);return}this.set("sessionId",this.userInfos.sessionId);let t=this.getModule("start").encryptUserInfos(this.userInfos.login,this.userInfos.password,this.userInfos.sessionId);if(localStorage.setItem("mainAccount",t),await this.getModule("start").setData(this.userInfos.sessionId),!localStorage.getItem("onboarding")){this.publish("showOverlay",!1),this.$router.push({name:"onboarding"});return}this.$router.push({name:"home"})},reconnection(){this.set("logoutExt",0),this.publish("reload")}}},E={class:"text-center text-secondary h2 pt-5 mb-2 title"},v={key:1,class:"h4 my-3 font-italic text-center my-3"},L={key:2,class:"h4 my-3 font-italic text-center my-3"};function U(t,i,B,R,M,a){const m=y,h=w,u=I,p=_,d=b,f=g;return s(),r(f,{class:"bg-light vh-100 vw-100"},{default:e(()=>[k("h1",E,o(t.$t("menusLabels.start.full")),1),t.getConfig().logoLibrary?(s(),r(m,{key:0,alt:t.$t("login.libraryLogoAlt"),thumbnail:"",center:"",height:"100",width:"100",rounded:"",fluid:"",src:t.getConfig().logoLibrary},null,8,["alt","src"])):x("",!0),a.disconnection?(s(),l("h2",v,o(t.$t("loginExt.disconnection")),1)):(s(),l("h2",L,o(t.$t("loginExt.connectInProgress")),1)),n(h,{class:"mx-2",variant:"danger",show:t.alert},{default:e(()=>[c(o(t.$t("login.errorText")),1)]),_:1},8,["show"]),n(d,null,{default:e(()=>[n(p,{class:"text-center"},{default:e(()=>[n(u,{class:"btn btn-default",onClick:a.reconnection},{default:e(()=>[c(o(t.$t("loginExt.reconnection")),1)]),_:1},8,["onClick"])]),_:1})]),_:1})]),_:1})}const ot=$(C,[["render",U]]);export{ot as default};
