From a5ed59bd64a228ced32d5f223c3a7605a91eb3ce Mon Sep 17 00:00:00 2001
From: kuaifan \s*<\/p>)+|( \s*<\/p>)+$/gi,""),n=n.replace(/^( \s*<\/p>)+|( \s*<\/p>)+$/gi,""),n=n.replace(/^(
")}}),t("div",{class:"department-tag-num"},` +${e.length}`)]))),t("div",{class:"team-table-department-warp"},a)}}},{title:this.$L("\u6700\u540E\u5728\u7EBF"),key:"line_at",width:168},{title:this.$L("\u64CD\u4F5C"),align:"center",width:100,render:(t,s)=>{const e=s.row.identity,a=[];e.includes("admin")?a.push(t("EDropdownItem",{props:{command:"clearadmin"}},[t("div",this.$L("\u53D6\u6D88\u7BA1\u7406\u5458"))])):a.push(t("EDropdownItem",{props:{command:"setadmin"}},[t("div",this.$L("\u8BBE\u4E3A\u7BA1\u7406\u5458"))])),e.includes("temp")?a.push(t("EDropdownItem",{props:{command:"cleartemp"}},[t("div",this.$L("\u53D6\u6D88\u4E34\u65F6\u8EAB\u4EFD"))])):a.push(t("EDropdownItem",{props:{command:"settemp"}},[t("div",this.$L("\u8BBE\u4E3A\u4E34\u65F6\u5E10\u53F7"))])),a.push(t("EDropdownItem",{props:{command:"email"}},[t("div",this.$L("\u4FEE\u6539\u90AE\u7BB1"))])),a.push(t("EDropdownItem",{props:{command:"password"}},[t("div",this.$L("\u4FEE\u6539\u5BC6\u7801"))])),this.checkinMac&&a.push(t("EDropdownItem",{props:{command:"checkin_mac"}},[t("div",this.$L("\u4FEE\u6539MAC"))])),a.push(t("EDropdownItem",{props:{command:"department"}},[t("div",this.$L("\u4FEE\u6539\u90E8\u95E8"))])),e.includes("disable")?a.push(t("EDropdownItem",{props:{command:"cleardisable"},style:{color:"#f90"}},[t("div",this.$L("\u6062\u590D\u5E10\u53F7\uFF08\u5DF2\u79BB\u804C\uFF09"))])):a.push(t("EDropdownItem",{props:{command:"setdisable"},style:{color:"#f90"}},[t("div",this.$L("\u64CD\u4F5C\u79BB\u804C"))])),a.push(t("EDropdownItem",{props:{command:"delete"},style:{color:"red"}},[t("div",this.$L("\u5220\u9664"))]));const i=t("EDropdown",{props:{size:"small",trigger:"click"},on:{command:n=>{this.dropUser(n,s.row)}}},[t("Button",{props:{type:"primary",size:"small"},style:{fontSize:"12px"}},this.$L("\u64CD\u4F5C")),t("EDropdownMenu",{slot:"dropdown"},[a])]);return t("TableAction",{props:{column:s.column}},[i])}}],list:[],page:1,pageSize:20,total:0,noText:"",checkinMacEditShow:!1,checkinMacEditLoading:0,checkinMacEditData:{},departmentEditShow:!1,departmentEditLoading:0,departmentEditData:{},disableShow:!1,disableLoading:0,disableData:{},disableOptions:{shortcuts:[{text:this.$L("12:00"),value(){return $A.Date($A.formatDate("Y-m-d 12:00:00"))},onClick:t=>{t.handlePickSuccess()}},{text:this.$L("17:00"),value(){return $A.Date($A.formatDate("Y-m-d 17:00:00"))},onClick:t=>{t.handlePickSuccess()}},{text:this.$L("18:00"),value(){return $A.Date($A.formatDate("Y-m-d 18:00:00"))},onClick:t=>{t.handlePickSuccess()}},{text:this.$L("19:00"),value(){return $A.Date($A.formatDate("Y-m-d 19:00:00"))},onClick:t=>{t.handlePickSuccess()}},{text:this.$L("\u73B0\u5728"),value(){return new Date},onClick:t=>{t.handlePickSuccess()}}]},departmentShow:!1,departmentLoading:0,departmentSelect:-1,departmentData:{id:0,name:"",parent_id:0,owner_userid:[],dialog_group:"new",dialog_useid:0},departmentList:[],dialogLoad:!1,dialogList:[],nullCheckinDatum:{mac:"",remark:""}}},created(){this.checkinMac&&this.columns.splice(5,0,{title:this.$L("MAC\u5730\u5740"),key:"checkin_mac",minWidth:80,render:(t,{row:s})=>{let e=$A.cloneJSON(s.checkin_macs||[]);if(e.length===0)return t("div","-");{const a=n=>n.remark?`${n.mac} (${n.remark})`:n.mac,i=[];return i.push(t("AutoTip",a(e[0]))),e.length>1&&(e=e.splice(1),i.push(t("ETooltip",[t("div",{slot:"content",domProps:{innerHTML:e.map(n=>a(n)).join("
")}}),t("div",{class:"department-tag-num"},` +${e.length}`)]))),t("div",{class:"team-table-department-warp"},i)}}})},mounted(){this.getLists(),this.getDepartmentLists()},watch:{keyIs(t){t||(this.keys={},this.setPage(1))},departmentSelect(){this.setPage(1)},windowPortrait:{handler(t){this.minBox=t},immediate:!0},minBox:{handler(){this.$nextTick(t=>{this.$el&&this.$el.clientWidth>0&&(this.minWidth=this.$el.clientWidth)})},immediate:!0}},computed:{departmentParentDisabled(){return!!(this.departmentData.id>0&&this.departmentList.find(({parent_id:t})=>t==this.departmentData.id))},userStyle({minWidth:t,windowPortrait:s}){const e={};return t>0&&s&&(e.minWidth=t-40+"px"),e}},methods:{onSearch(){this.page=1,this.getLists()},getLists(){this.loadIng++,this.keyIs=$A.objImplode(this.keys)!="";let t=$A.cloneJSON(this.keys);this.departmentSelect>-1&&(t=Object.assign(t,{department:this.departmentSelect})),this.$store.dispatch("call",{url:"users/lists",data:{keys:t,get_checkin_mac:this.checkinMac?1:0,page:Math.max(this.page,1),pagesize:Math.max($A.runNum(this.pageSize),10)}}).then(({data:s})=>{this.page=s.current_page,this.total=s.total,this.list=s.data,this.noText="\u6CA1\u6709\u76F8\u5173\u7684\u6210\u5458"}).catch(()=>{this.noText="\u6570\u636E\u52A0\u8F7D\u5931\u8D25"}).finally(s=>{this.loadIng--})},setPage(t){this.page=t,this.getLists()},setPageSize(t){this.page=1,this.pageSize=t,this.getLists()},dropUser(t,s){switch(t){case"settemp":$A.modalConfirm({content:`\u4F60\u786E\u5B9A\u5C06\u3010ID:${s.userid}\uFF0C${s.nickname}\u3011\u8BBE\u4E3A\u4E34\u65F6\u5E10\u53F7\u5417\uFF1F\uFF08\u6CE8\uFF1A\u4E34\u65F6\u5E10\u53F7\u9650\u5236\u8BF7\u67E5\u770B\u7CFB\u7EDF\u8BBE\u7F6E\uFF09`,loading:!0,onOk:()=>this.operationUser({userid:s.userid,type:t})});break;case"cleartemp":$A.modalConfirm({content:`\u4F60\u786E\u5B9A\u53D6\u6D88\u3010ID:${s.userid}\uFF0C${s.nickname}\u3011\u4E34\u65F6\u8EAB\u4EFD\u5417\uFF1F`,loading:!0,onOk:()=>this.operationUser({userid:s.userid,type:t})});break;case"email":$A.modalInput({title:"\u4FEE\u6539\u90AE\u7BB1",placeholder:`\u8BF7\u8F93\u5165\u65B0\u7684\u90AE\u7BB1\uFF08${s.email}\uFF09`,onOk:a=>a?this.operationUser({userid:s.userid,email:a}):"\u8BF7\u8F93\u5165\u65B0\u7684\u90AE\u7BB1\u5730\u5740"});break;case"password":$A.modalInput({title:"\u4FEE\u6539\u5BC6\u7801",placeholder:"\u8BF7\u8F93\u5165\u65B0\u7684\u5BC6\u7801",onOk:a=>a?this.operationUser({userid:s.userid,password:a}):"\u8BF7\u8F93\u5165\u65B0\u7684\u5BC6\u7801"});break;case"checkin_mac":this.checkinMacEditData={type:"checkin_macs",userid:s.userid,nickname:s.nickname,checkin_macs:s.checkin_macs},this.checkinMacEditData.checkin_macs.length===0&&this.addCheckinDatum(),this.checkinMacEditShow=!0;break;case"department":let e=[];s.department.some(a=>{const i=this.departmentList.find(n=>n.id==a);i&&e.push(i.owner_userid===s.userid?`${i.name} (${this.$L("\u8D1F\u8D23\u4EBA")})`:i.name)}),this.departmentEditData={type:"department",userid:s.userid,nickname:s.nickname,department:s.department.map(a=>parseInt(a))},this.departmentEditShow=!0;break;case"setdisable":this.disableData={type:"setdisable",userid:s.userid,nickname:s.nickname},this.disableShow=!0;break;case"cleardisable":$A.modalConfirm({content:`\u4F60\u786E\u5B9A\u6062\u590D\u5DF2\u79BB\u804C\u5E10\u53F7\u3010ID:${s.userid}\uFF0C${s.nickname}\u3011\u5417\uFF1F\uFF08\u6CE8\uFF1A\u6B64\u64CD\u4F5C\u4EC5\u6062\u590D\u5E10\u53F7\u72B6\u6001\uFF0C\u65E0\u6CD5\u6062\u590D\u64CD\u4F5C\u79BB\u804C\u65F6\u79FB\u4EA4\u7684\u6570\u636E\uFF09`,loading:!0,onOk:()=>this.operationUser({userid:s.userid,type:t})});break;case"delete":$A.modalInput({title:`\u5220\u9664\u5E10\u53F7\u3010ID:${s.userid}\uFF0C${s.nickname}\u3011`,placeholder:"\u8BF7\u8F93\u5165\u5220\u9664\u539F\u56E0",okText:"\u786E\u5B9A\u5220\u9664",onOk:a=>a?this.operationUser({userid:s.userid,type:t,delete_reason:a}):"\u5220\u9664\u539F\u56E0\u4E0D\u80FD\u4E3A\u7A7A"});break;default:this.operationUser({userid:s.userid,type:t},!0);break}},operationUser(t,s){return new Promise((e,a)=>{t.type=="checkin_macs"?this.checkinMacEditLoading++:t.type=="department"?this.departmentEditLoading++:t.type=="setdisable"?this.disableLoading++:this.loadIng++,this.$store.dispatch("call",{url:"users/operation",data:t}).then(({msg:i})=>{$A.messageSuccess(i),this.getLists(),e(),t.type=="checkin_macs"?this.checkinMacEditShow=!1:t.type=="department"?this.departmentEditShow=!1:t.type=="setdisable"&&(this.disableShow=!1)}).catch(({msg:i})=>{s===!0&&$A.modalError(i),this.getLists(),a(i)}).finally(i=>{t.type=="checkin_macs"?this.checkinMacEditLoading--:t.type=="department"?this.departmentEditLoading--:t.type=="setdisable"?this.disableLoading--:this.loadIng--})})},getDepartmentLists(){this.departmentLoading++,this.$store.dispatch("call",{url:"users/department/list"}).then(({data:t})=>{this.departmentList=[],this.generateDepartmentList(t,0,1)}).finally(t=>{this.departmentLoading--})},generateDepartmentList(t,s,e){t.some(a=>{a.parent_id==s&&(this.departmentList.push(Object.assign(a,{level:e+1})),this.generateDepartmentList(t,a.id,e+1))})},onShowDepartment(t){this.departmentData=Object.assign({id:0,name:"",parent_id:0,owner_userid:[],dialog_group:"new"},t||{}),this.departmentShow=!0},onSaveDepartment(){this.departmentLoading++,this.$store.dispatch("call",{url:"users/department/add",data:Object.assign(this.departmentData,{owner_userid:this.departmentData.owner_userid[0]})}).then(({msg:t})=>{$A.messageSuccess(t),this.getDepartmentLists(),this.getLists(),this.departmentShow=!1}).catch(({msg:t})=>{$A.modalError(t)}).finally(t=>{this.departmentLoading--})},onSelectDepartment(t){if(this.windowPortrait&&(this.minBox=!0),this.departmentSelect===t){this.departmentSelect=-1;return}this.departmentSelect=t},onOpDepartment(t){if($A.leftExists(t,"add_"))this.onShowDepartment({parent_id:parseInt(t.substr(4))});else if($A.leftExists(t,"edit_")){const s=this.departmentList.find(({id:e})=>e===parseInt(t.substr(5)));s&&this.onShowDepartment(s)}else if($A.leftExists(t,"del_")){const s=this.departmentList.find(({id:e})=>e===parseInt(t.substr(4)));s&&$A.modalConfirm({title:this.$L("\u5220\u9664\u90E8\u95E8"),content:`
")}}),t("div",{class:"department-tag-num"},` +${e.length}`)]))),t("div",{class:"team-table-department-warp"},a)}}},{title:this.$L("\u6700\u540E\u5728\u7EBF"),key:"line_at",width:168},{title:this.$L("\u64CD\u4F5C"),align:"center",width:100,render:(t,s)=>{const e=s.row.identity,a=[];e.includes("admin")?a.push(t("EDropdownItem",{props:{command:"clearadmin"}},[t("div",this.$L("\u53D6\u6D88\u7BA1\u7406\u5458"))])):a.push(t("EDropdownItem",{props:{command:"setadmin"}},[t("div",this.$L("\u8BBE\u4E3A\u7BA1\u7406\u5458"))])),e.includes("temp")?a.push(t("EDropdownItem",{props:{command:"cleartemp"}},[t("div",this.$L("\u53D6\u6D88\u4E34\u65F6\u8EAB\u4EFD"))])):a.push(t("EDropdownItem",{props:{command:"settemp"}},[t("div",this.$L("\u8BBE\u4E3A\u4E34\u65F6\u5E10\u53F7"))])),a.push(t("EDropdownItem",{props:{command:"email"}},[t("div",this.$L("\u4FEE\u6539\u90AE\u7BB1"))])),a.push(t("EDropdownItem",{props:{command:"password"}},[t("div",this.$L("\u4FEE\u6539\u5BC6\u7801"))])),this.checkinMac&&a.push(t("EDropdownItem",{props:{command:"checkin_mac"}},[t("div",this.$L("\u4FEE\u6539MAC"))])),a.push(t("EDropdownItem",{props:{command:"department"}},[t("div",this.$L("\u4FEE\u6539\u90E8\u95E8"))])),e.includes("disable")?a.push(t("EDropdownItem",{props:{command:"cleardisable"},style:{color:"#f90"}},[t("div",this.$L("\u6062\u590D\u5E10\u53F7\uFF08\u5DF2\u79BB\u804C\uFF09"))])):a.push(t("EDropdownItem",{props:{command:"setdisable"},style:{color:"#f90"}},[t("div",this.$L("\u64CD\u4F5C\u79BB\u804C"))])),a.push(t("EDropdownItem",{props:{command:"delete"},style:{color:"red"}},[t("div",this.$L("\u5220\u9664"))]));const i=t("EDropdown",{props:{size:"small",trigger:"click"},on:{command:n=>{this.dropUser(n,s.row)}}},[t("Button",{props:{type:"primary",size:"small"},style:{fontSize:"12px"}},this.$L("\u64CD\u4F5C")),t("EDropdownMenu",{slot:"dropdown"},[a])]);return t("TableAction",{props:{column:s.column}},[i])}}],list:[],page:1,pageSize:20,total:0,noText:"",checkinMacEditShow:!1,checkinMacEditLoading:0,checkinMacEditData:{},departmentEditShow:!1,departmentEditLoading:0,departmentEditData:{},disableShow:!1,disableLoading:0,disableData:{},disableOptions:{shortcuts:[{text:this.$L("12:00"),value(){return $A.Date($A.formatDate("Y-m-d 12:00:00"))},onClick:t=>{t.handlePickSuccess()}},{text:this.$L("17:00"),value(){return $A.Date($A.formatDate("Y-m-d 17:00:00"))},onClick:t=>{t.handlePickSuccess()}},{text:this.$L("18:00"),value(){return $A.Date($A.formatDate("Y-m-d 18:00:00"))},onClick:t=>{t.handlePickSuccess()}},{text:this.$L("19:00"),value(){return $A.Date($A.formatDate("Y-m-d 19:00:00"))},onClick:t=>{t.handlePickSuccess()}},{text:this.$L("\u73B0\u5728"),value(){return new Date},onClick:t=>{t.handlePickSuccess()}}]},departmentShow:!1,departmentLoading:0,departmentSelect:-1,departmentData:{id:0,name:"",parent_id:0,owner_userid:[],dialog_group:"new",dialog_useid:0},departmentList:[],dialogLoad:!1,dialogList:[],nullCheckinDatum:{mac:"",remark:""}}},created(){this.checkinMac&&this.columns.splice(5,0,{title:this.$L("MAC\u5730\u5740"),key:"checkin_mac",minWidth:80,render:(t,{row:s})=>{let e=$A.cloneJSON(s.checkin_macs||[]);if(e.length===0)return t("div","-");{const a=n=>n.remark?`${n.mac} (${n.remark})`:n.mac,i=[];return i.push(t("AutoTip",a(e[0]))),e.length>1&&(e=e.splice(1),i.push(t("ETooltip",[t("div",{slot:"content",domProps:{innerHTML:e.map(n=>a(n)).join("
")}}),t("div",{class:"department-tag-num"},` +${e.length}`)]))),t("div",{class:"team-table-department-warp"},i)}}})},mounted(){this.getLists(),this.getDepartmentLists()},watch:{keyIs(t){t||(this.keys={},this.setPage(1))},departmentSelect(){this.setPage(1)},windowPortrait:{handler(t){this.minBox=t},immediate:!0},minBox:{handler(){this.$nextTick(t=>{this.$el&&this.$el.clientWidth>0&&(this.minWidth=this.$el.clientWidth)})},immediate:!0}},computed:{departmentParentDisabled(){return!!(this.departmentData.id>0&&this.departmentList.find(({parent_id:t})=>t==this.departmentData.id))},userStyle({minWidth:t,windowPortrait:s}){const e={};return t>0&&s&&(e.minWidth=t-40+"px"),e}},methods:{onSearch(){this.page=1,this.getLists()},getLists(){this.loadIng++,this.keyIs=$A.objImplode(this.keys)!="";let t=$A.cloneJSON(this.keys);this.departmentSelect>-1&&(t=Object.assign(t,{department:this.departmentSelect})),this.$store.dispatch("call",{url:"users/lists",data:{keys:t,get_checkin_mac:this.checkinMac?1:0,page:Math.max(this.page,1),pagesize:Math.max($A.runNum(this.pageSize),10)}}).then(({data:s})=>{this.page=s.current_page,this.total=s.total,this.list=s.data,this.noText="\u6CA1\u6709\u76F8\u5173\u7684\u6210\u5458"}).catch(()=>{this.noText="\u6570\u636E\u52A0\u8F7D\u5931\u8D25"}).finally(s=>{this.loadIng--})},setPage(t){this.page=t,this.getLists()},setPageSize(t){this.page=1,this.pageSize=t,this.getLists()},dropUser(t,s){switch(t){case"settemp":$A.modalConfirm({content:`\u4F60\u786E\u5B9A\u5C06\u3010ID:${s.userid}\uFF0C${s.nickname}\u3011\u8BBE\u4E3A\u4E34\u65F6\u5E10\u53F7\u5417\uFF1F\uFF08\u6CE8\uFF1A\u4E34\u65F6\u5E10\u53F7\u9650\u5236\u8BF7\u67E5\u770B\u7CFB\u7EDF\u8BBE\u7F6E\uFF09`,loading:!0,onOk:()=>this.operationUser({userid:s.userid,type:t})});break;case"cleartemp":$A.modalConfirm({content:`\u4F60\u786E\u5B9A\u53D6\u6D88\u3010ID:${s.userid}\uFF0C${s.nickname}\u3011\u4E34\u65F6\u8EAB\u4EFD\u5417\uFF1F`,loading:!0,onOk:()=>this.operationUser({userid:s.userid,type:t})});break;case"email":$A.modalInput({title:"\u4FEE\u6539\u90AE\u7BB1",placeholder:`\u8BF7\u8F93\u5165\u65B0\u7684\u90AE\u7BB1\uFF08${s.email}\uFF09`,onOk:a=>a?this.operationUser({userid:s.userid,email:a}):"\u8BF7\u8F93\u5165\u65B0\u7684\u90AE\u7BB1\u5730\u5740"});break;case"password":$A.modalInput({title:"\u4FEE\u6539\u5BC6\u7801",placeholder:"\u8BF7\u8F93\u5165\u65B0\u7684\u5BC6\u7801",onOk:a=>a?this.operationUser({userid:s.userid,password:a}):"\u8BF7\u8F93\u5165\u65B0\u7684\u5BC6\u7801"});break;case"checkin_mac":this.checkinMacEditData={type:"checkin_macs",userid:s.userid,nickname:s.nickname,checkin_macs:s.checkin_macs},this.checkinMacEditData.checkin_macs.length===0&&this.addCheckinDatum(),this.checkinMacEditShow=!0;break;case"department":let e=[];s.department.some(a=>{const i=this.departmentList.find(n=>n.id==a);i&&e.push(i.owner_userid===s.userid?`${i.name} (${this.$L("\u8D1F\u8D23\u4EBA")})`:i.name)}),this.departmentEditData={type:"department",userid:s.userid,nickname:s.nickname,department:s.department.map(a=>parseInt(a))},this.departmentEditShow=!0;break;case"setdisable":this.disableData={type:"setdisable",userid:s.userid,nickname:s.nickname},this.disableShow=!0;break;case"cleardisable":$A.modalConfirm({content:`\u4F60\u786E\u5B9A\u6062\u590D\u5DF2\u79BB\u804C\u5E10\u53F7\u3010ID:${s.userid}\uFF0C${s.nickname}\u3011\u5417\uFF1F\uFF08\u6CE8\uFF1A\u6B64\u64CD\u4F5C\u4EC5\u6062\u590D\u5E10\u53F7\u72B6\u6001\uFF0C\u65E0\u6CD5\u6062\u590D\u64CD\u4F5C\u79BB\u804C\u65F6\u79FB\u4EA4\u7684\u6570\u636E\uFF09`,loading:!0,onOk:()=>this.operationUser({userid:s.userid,type:t})});break;case"delete":$A.modalInput({title:`\u5220\u9664\u5E10\u53F7\u3010ID:${s.userid}\uFF0C${s.nickname}\u3011`,placeholder:"\u8BF7\u8F93\u5165\u5220\u9664\u539F\u56E0",okText:"\u786E\u5B9A\u5220\u9664",onOk:a=>a?this.operationUser({userid:s.userid,type:t,delete_reason:a}):"\u5220\u9664\u539F\u56E0\u4E0D\u80FD\u4E3A\u7A7A"});break;default:this.operationUser({userid:s.userid,type:t},!0);break}},operationUser(t,s){return new Promise((e,a)=>{t.type=="checkin_macs"?this.checkinMacEditLoading++:t.type=="department"?this.departmentEditLoading++:t.type=="setdisable"?this.disableLoading++:this.loadIng++,this.$store.dispatch("call",{url:"users/operation",data:t}).then(({msg:i})=>{$A.messageSuccess(i),this.getLists(),e(),t.type=="checkin_macs"?this.checkinMacEditShow=!1:t.type=="department"?this.departmentEditShow=!1:t.type=="setdisable"&&(this.disableShow=!1)}).catch(({msg:i})=>{s===!0&&$A.modalError(i),this.getLists(),a(i)}).finally(i=>{t.type=="checkin_macs"?this.checkinMacEditLoading--:t.type=="department"?this.departmentEditLoading--:t.type=="setdisable"?this.disableLoading--:this.loadIng--})})},getDepartmentLists(){this.departmentLoading++,this.$store.dispatch("call",{url:"users/department/list"}).then(({data:t})=>{this.departmentList=[],this.generateDepartmentList(t,0,1)}).finally(t=>{this.departmentLoading--})},generateDepartmentList(t,s,e){t.some(a=>{a.parent_id==s&&(this.departmentList.push(Object.assign(a,{level:e+1})),this.generateDepartmentList(t,a.id,e+1))})},onShowDepartment(t){this.departmentData=Object.assign({id:0,name:"",parent_id:0,owner_userid:[],dialog_group:"new"},t||{}),this.departmentShow=!0},onSaveDepartment(){this.departmentLoading++,this.$store.dispatch("call",{url:"users/department/add",data:Object.assign(this.departmentData,{owner_userid:this.departmentData.owner_userid[0]})}).then(({msg:t})=>{$A.messageSuccess(t),this.getDepartmentLists(),this.getLists(),this.departmentShow=!1}).catch(({msg:t})=>{$A.modalError(t)}).finally(t=>{this.departmentLoading--})},onSelectDepartment(t){if(this.windowPortrait&&(this.minBox=!0),this.departmentSelect===t){this.departmentSelect=-1;return}this.departmentSelect=t},onOpDepartment(t){if($A.leftExists(t,"add_"))this.onShowDepartment({parent_id:parseInt(t.substr(4))});else if($A.leftExists(t,"edit_")){const s=this.departmentList.find(({id:e})=>e===parseInt(t.substr(5)));s&&this.onShowDepartment(s)}else if($A.leftExists(t,"del_")){const s=this.departmentList.find(({id:e})=>e===parseInt(t.substr(4)));s&&$A.modalConfirm({title:this.$L("\u5220\u9664\u90E8\u95E8"),content:`
`};Xt.fence=function(e,t,n,r,a){var l=e[t],u=l.info?zG(l.info).trim():"",c="",d="",f,g,h,p,m;return u&&(h=u.split(/(\s+)/g),c=h[0],d=h.slice(2).join("")),n.highlight?f=n.highlight(l.content,c,d)||Cn(l.content):f=Cn(l.content),f.indexOf(""+Cn(e[t].content)+`fe.offsetTop+Te*1.5&&me.insert(`
`)}return me}function lt(fe,me){var Te={},Oe=fe.style||{};return Oe.fontStyle&&ae(fe).fontStyle==="italic"&&(Te.italic=!0),Oe.fontWeight&&(ae(fe).fontWeight.startsWith("bold")||parseInt(ae(fe).fontWeight)>=700)&&(Te.bold=!0),Object.keys(Te).length>0&&(me=J(me,Te)),parseFloat(Oe.textIndent||0)>0&&(me=new h.default().insert(" ").concat(me)),me}function Me(fe,me){var Te=fe.data;if(fe.parentNode.tagName==="O:P")return me.insert(Te.trim());if(Te.trim().length===0&&fe.parentNode.classList.contains("ql-clipboard"))return me;if(!ae(fe.parentNode).whiteSpace.startsWith("pre")){var Oe=function(ze,$e){return $e=$e.replace(/[^\u00a0]/g,""),$e.length<1&&ze?" ":$e};Te=Te.replace(/\r\n/g," ").replace(/\n/g," "),Te=Te.replace(/\s\s+/g,Oe.bind(Oe,!0)),(fe.previousSibling==null&&Q(fe.parentNode)||fe.previousSibling!=null&&Q(fe.previousSibling))&&(Te=Te.replace(/^\s+/,Oe.bind(Oe,!1))),(fe.nextSibling==null&&Q(fe.parentNode)||fe.nextSibling!=null&&Q(fe.nextSibling))&&(Te=Te.replace(/\s+$/,Oe.bind(Oe,!1)))}return me.insert(Te)}r.default=X,r.matchAttributor=ue,r.matchBlot=Ee,r.matchNewline=Ye,r.matchSpacing=Ke,r.matchText=Me},function(n,r,a){Object.defineProperty(r,"__esModule",{value:!0});var l=function(){function y(b,C){for(var E=0;E
<\/p>)+|(
<\/p>)+$/gi,""),this.updateEmojiQuick(n),this._content=n,this.$emit("input",this._content),this.$nextTick(r=>{const a=this.quill.getSelection();if(a){const l=this.quill.getText(a.index);/^\n\n$/.test(l)&&this.quill.deleteText(a.index,1)}})},100)}),this.quill.clipboard.addMatcher(Node.ELEMENT_NODE,(e,t)=>(this.pasteClean&&(t.ops=t.ops.map(n=>{const r={insert:n.insert};try{typeof r.insert.mention=="object"&&e.innerHTML&&(r.insert=e.innerHTML.replace(/<[^>]+>/g,""))}catch{}return n.attributes&&["bold","strike","italic","underline","list","blockquote","link"].some(a=>{n.attributes[a]&&(typeof r.attributes=="undefined"&&(r.attributes={}),r.attributes[a]=n.attributes[a])}),r})),t)),this.$nextTick(e=>{this.quill.root.addEventListener("keydown",t=>{if(t.key==="\r\r"&&t.keyCode===229){const n=this.quill.getSelection(!0).index;this.quill.insertText(n,`\r
+`},{type:"d",name:"food",content:''},{type:"s",name:"symbols",content:''},{type:"a",name:"activity",content:''},{type:"t",name:"travel",content:''},{type:"o",name:"objects",content:''},{type:"f",name:"flags",content:''}],emoticonPath:"",emosearchKey:"",emosearchCache:null,emosearchLoad:!1,emosearchTimer:null,emosearchList:[],emojiData:[],emoticonData:[]}},mounted(){this.initData()},watch:{type(){this.onEmosearch()},emosearchKey(){this.onEmosearch()},searchKey:{handler(e){this.emosearchKey=e},immediate:!0}},computed:{list(){if(this.type==="emoji")return this.emojiData.filter(e=>e.category===this.emojiNavActive);if(this.type==="emosearch")return this.emosearchList;if(this.type==="emoticon"){const e=this.emoticonData.find(({path:t})=>t===this.emoticonPath);if(e)return e.list}return[]}},methods:{initData(){$A.loadScriptS(["js/emoji.all.js","js/emoticon.all.js"]).then(e=>{const t=$A.apiUrl("../images/emoticon");$A.isArray(window.emojiData)&&(this.emojiData=window.emojiData.sort(function(n,r){return n.emoji_order-r.emoji_order}).map(n=>({type:"emoji",name:n.name,category:n.category,html:n.code_decimal}))),$A.isArray(window.emoticonData)&&(this.emoticonData=window.emoticonData.map(n=>Object.assign(n,{src:`${t}/${n.path}/${n.icon}`,list:n.list.map(r=>Object.assign(r,{type:"emoticon",asset:`images/emoticon/${n.path}/${r.path}`,src:`${t}/${n.path}/${r.path}`}))})))})},onEmosearch(){this.type!=="emosearch"||this.emosearchCache===this.emosearchKey||(this.emosearchCache=this.emosearchKey,this.emosearchLoad=!0,this.emosearchTimer&&clearTimeout(this.emosearchTimer),this.emosearchTimer=setTimeout(e=>{uJ("https://pic.sogou.com/napi/wap/pic",{query:this.emosearchKey+" \u8868\u60C5"}).then(t=>{if(this.emosearchList=[],t.status===0){const n=t.data.items;n.length>0&&(this.emosearchList=n.map(r=>({type:"emoticon",asset:"emosearch",name:r.title,src:r.thumbUrl,height:r.thumbHeight,width:r.thumbWidth})))}this.emosearchList.length===0&&$A.noticeWarning("\u6CA1\u6709\u641C\u7D22\u5230\u4EFB\u4F55\u8868\u60C5")}).catch(t=>{this.emosearchList=[],$A.noticeWarning("\u641C\u7D22\u7ED3\u679C\u4E3A\u7A7A")}).finally(t=>{this.emosearchLoad=!1})},300))},onEmoticon(e){this.type="emoticon",this.emoticonPath=e},onSelect(e,t){t.type==="emoji"?this.$emit("on-select",{type:"emoji",text:e.target.innerText}):this.$emit("on-select",t)}}},Tl={};var mJ=Qt(pJ,dJ,_J,!1,fJ,null,null,null);function fJ(e){for(let t in Tl)this[t]=Tl[t]}var Ic=function(){return mJ.exports}();const yl="ontouchend"in document;var gJ={bind(e,t){let n=!1;e.__touchMouseDown__=r=>{r.preventDefault(),n=!0,t.value("down",r)},e.__touchMouseMove__=r=>{n&&t.value("move",r)},e.__touchMouseUp__=r=>{n&&(n=!1,t.value("up"))},yl?(e.addEventListener("touchstart",e.__touchMouseDown__),e.addEventListener("touchmove",e.__touchMouseMove__),e.addEventListener("touchend",e.__touchMouseUp__)):(e.addEventListener("mousedown",e.__touchMouseDown__),document.addEventListener("mousemove",e.__touchMouseMove__),document.addEventListener("mouseup",e.__touchMouseUp__))},update(){},unbind(e){yl?(e.removeEventListener("touchstart",e.__touchMouseDown__),e.removeEventListener("touchmove",e.__touchMouseMove__),e.removeEventListener("touchend",e.__touchMouseUp__)):(e.removeEventListener("mousedown",e.__touchMouseDown__),document.removeEventListener("mousemove",e.__touchMouseMove__),document.removeEventListener("mouseup",e.__touchMouseUp__)),delete e.__touchMouseDown__,delete e.__touchMouseMove__,delete e.__touchMouseUp__}};function Yn(e){return e===void 0&&(e=document.body),e===!0?document.body:e instanceof window.Node?e:document.querySelector(e)}const hJ={inserted(e,{value:t},n){if(e.dataset&&e.dataset.transfer!=="true")return!1;e.className=e.className?e.className+" v-transfer-dom":"v-transfer-dom";const r=e.parentNode;if(!r)return;const a=document.createComment("");let l=!1;t!==!1&&(r.replaceChild(a,e),Yn(t).appendChild(e),l=!0),e.__transferDomData||(e.__transferDomData={parentNode:r,home:a,target:Yn(t),hasMovedOut:l})},componentUpdated(e,{value:t}){if(e.dataset&&e.dataset.transfer!=="true")return!1;const n=e.__transferDomData;if(!n)return;const r=n.parentNode,a=n.home,l=n.hasMovedOut;!l&&t?(r.replaceChild(a,e),Yn(t).appendChild(e),e.__transferDomData=Object.assign({},e.__transferDomData,{hasMovedOut:!0,target:Yn(t)})):l&&t===!1?(r.replaceChild(e,a),e.__transferDomData=Object.assign({},e.__transferDomData,{hasMovedOut:!1,target:Yn(t)})):t&&Yn(t).appendChild(e)},unbind(e){if(e.dataset&&e.dataset.transfer!=="true")return!1;e.className=e.className.replace("v-transfer-dom",""),e.__transferDomData&&(e.__transferDomData.hasMovedOut===!0&&e.__transferDomData.parentNode&&e.__transferDomData.parentNode.appendChild(e),e.__transferDomData=null)}};var EJ=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{directives:[{name:"clickoutside",rawName:"v-clickoutside",value:e.hidePopover,expression:"hidePopover"}],staticClass:"chat-input-box",class:e.boxClass},[n("div",{staticClass:"chat-input-quick-emoji"},[n("EPopover",{ref:"emojiQuickRef",attrs:{visibleArrow:!1,transition:"",placement:"top-end",popperClass:"chat-quick-emoji-popover"},model:{value:e.emojiQuickShow,callback:function(r){e.emojiQuickShow=r},expression:"emojiQuickShow"}},[n("div",{attrs:{slot:"reference"},slot:"reference"}),n("ul",{staticClass:"chat-quick-emoji-wrapper"},e._l(e.emojiQuickItems,function(r){return n("li",{on:{click:function(a){return e.onEmojiQuick(r)}}},[n("img",{attrs:{title:r.name,alt:r.name,src:r.src}})])}),0)])],1),n("div",{staticClass:"chat-input-wrapper",on:{click:function(r){return r.stopPropagation(),e.focus.apply(null,arguments)}}},[e.quoteData?n("div",{staticClass:"chat-quote"},[e.quoteUpdate?n("div",{staticClass:"quote-label"},[e._v(e._s(e.$L("\u7F16\u8F91\u6D88\u606F")))]):n("UserAvatar",{attrs:{userid:e.quoteData.userid,"show-icon":!1,"show-name":!0,"tooltip-disabled":!0}}),n("div",{staticClass:"quote-desc"},[e._v(e._s(e.$A.getMsgSimpleDesc(e.quoteData)))]),n("i",{staticClass:"taskfont",on:{click:function(r){return r.stopPropagation(),e.cancelQuote.apply(null,arguments)}}},[e._v("\uE6E5")])],1):e._e(),n("div",{ref:"editor",staticClass:"no-dark-content",style:e.editorStyle,on:{click:function(r){return r.stopPropagation(),e.onClickEditor.apply(null,arguments)},paste:e.handlePaste}}),n("ul",{staticClass:"chat-toolbar",on:{click:function(r){r.stopPropagation()}}},[n("li",[e.emojiBottom?n("ETooltip",{ref:"emojiTip",attrs:{disabled:e.$isEEUiApp||e.windowTouch||e.showEmoji,placement:"top",content:e.$L("\u8868\u60C5")}},[n("i",{staticClass:"taskfont",on:{click:function(r){e.showEmoji=!e.showEmoji}}},[e._v("\uE7AD")])]):n("EPopover",{attrs:{visibleArrow:!1,placement:"top",popperClass:"chat-input-emoji-popover"},model:{value:e.showEmoji,callback:function(r){e.showEmoji=r},expression:"showEmoji"}},[n("ETooltip",{ref:"emojiTip",attrs:{slot:"reference",disabled:e.$isEEUiApp||e.windowTouch||e.showEmoji,placement:"top",content:e.$L("\u8868\u60C5")},slot:"reference"},[n("i",{staticClass:"taskfont"},[e._v("\uE7AD")])]),e.showEmoji?n("ChatEmoji",{attrs:{searchKey:e.emojiQuickKey},on:{"on-select":e.onSelectEmoji}}):e._e()],1)],1),n("li",[n("ETooltip",{attrs:{placement:"top",disabled:e.$isEEUiApp||e.windowTouch,content:e.$L("\u9009\u62E9\u6210\u5458")}},[n("i",{staticClass:"taskfont",on:{click:function(r){return e.onToolbar("user")}}},[e._v("\uE78F")])])],1),n("li",[n("ETooltip",{attrs:{placement:"top",disabled:e.$isEEUiApp||e.windowTouch,content:e.$L("\u9009\u62E9\u4EFB\u52A1")}},[n("i",{staticClass:"taskfont",on:{click:function(r){return e.onToolbar("task")}}},[e._v("\uE7D6")])])],1),n("li",[n("EPopover",{attrs:{visibleArrow:!1,placement:"top",popperClass:"chat-input-more-popover"},model:{value:e.showMore,callback:function(r){e.showMore=r},expression:"showMore"}},[n("ETooltip",{ref:"moreTip",attrs:{slot:"reference",disabled:e.$isEEUiApp||e.windowTouch||e.showMore,placement:"top",content:e.$L("\u5C55\u5F00")},slot:"reference"},[n("i",{staticClass:"taskfont"},[e._v("\uE790")])]),e.recordReady?n("div",{staticClass:"chat-input-popover-item",on:{click:function(r){return e.onToolbar("meeting")}}},[n("i",{staticClass:"taskfont"},[e._v("\uE7C1")]),e._v(" "+e._s(e.$L("\u65B0\u4F1A\u8BAE"))+" ")]):e._e(),e.canCall?n("div",{staticClass:"chat-input-popover-item",on:{click:function(r){return e.onToolbar("call")}}},[n("i",{staticClass:"taskfont"},[e._v("\uE7BA")]),e._v(" "+e._s(e.$L("\u62E8\u6253\u7535\u8BDD"))+" ")]):e._e(),n("div",{staticClass:"chat-input-popover-item",on:{click:function(r){return e.onToolbar("image")}}},[n("i",{staticClass:"taskfont"},[e._v("\uE7BC")]),e._v(" "+e._s(e.$L("\u53D1\u9001\u56FE\u7247"))+" ")]),n("div",{staticClass:"chat-input-popover-item",on:{click:function(r){return e.onToolbar("file")}}},[n("i",{staticClass:"taskfont"},[e._v("\uE7C0")]),e._v(" "+e._s(e.$L("\u4E0A\u4F20\u6587\u4EF6"))+" ")]),e.canAnon?n("div",{staticClass:"chat-input-popover-item",on:{click:function(r){return e.onToolbar("anon")}}},[n("i",{staticClass:"taskfont"},[e._v("\uE690")]),e._v(" "+e._s(e.$L("\u533F\u540D\u6D88\u606F"))+" ")]):e._e(),n("div",{staticClass:"chat-input-popover-item",on:{click:function(r){return e.onToolbar("full")}}},[n("i",{staticClass:"taskfont"},[e._v("\uE6A7")]),e._v(" "+e._s(e.$L("\u5168\u5C4F\u8F93\u5165"))+" ")])],1)],1),n("li",{directives:[{name:"touchmouse",rawName:"v-touchmouse",value:e.clickSend,expression:"clickSend"},{name:"longpress",rawName:"v-longpress",value:{callback:e.longSend,delay:300},expression:"{callback: longSend, delay: 300}"}],ref:"chatSend",staticClass:"chat-send",class:e.sendClass},[n("EPopover",{attrs:{visibleArrow:!1,trigger:"manual",placement:"top",popperClass:"chat-input-more-popover"},model:{value:e.showMenu,callback:function(r){e.showMenu=r},expression:"showMenu"}},[n("ETooltip",{ref:"sendTip",attrs:{slot:"reference",placement:"top",disabled:e.$isEEUiApp||e.windowTouch||e.showMenu,content:e.$L(e.sendContent)},slot:"reference"},[e.loading?n("div",[n("div",{staticClass:"chat-load"},[n("Loading")],1)]):n("div",[n("transition",{attrs:{name:"mobile-send"}},[e.sendClass==="recorder"?n("i",{staticClass:"taskfont"},[e._v("\uE609")]):e._e()]),n("transition",{attrs:{name:"mobile-send"}},[e.sendClass!=="recorder"?n("i",{staticClass:"taskfont"},[e._v("\uE606")]):e._e()])],1)]),n("div",{staticClass:"chat-input-popover-item",on:{click:function(r){return e.onSend("silence")}}},[n("i",{staticClass:"taskfont"},[e._v("\uE7D7")]),e._v(" "+e._s(e.$L("\u65E0\u58F0\u53D1\u9001"))+" ")]),n("div",{staticClass:"chat-input-popover-item",on:{click:function(r){return e.onSend("md")}}},[n("i",{staticClass:"taskfont"},[e._v("\uE647")]),e._v(" "+e._s(e.$L("Markdown \u683C\u5F0F\u53D1\u9001"))+" ")])],1)],1),n("li",{staticClass:"chat-record-recwave"},[n("div",{ref:"recwave"})])]),n("div",{staticClass:"chat-cover",on:{click:function(r){return r.stopPropagation(),e.onClickCover.apply(null,arguments)}}})]),e.emojiBottom&&e.showEmoji?n("ChatEmoji",{attrs:{searchKey:e.emojiQuickKey},on:{"on-select":e.onSelectEmoji}}):e._e(),n("transition",{attrs:{name:"fade"}},[["ready","ing"].includes(e.recordState)?n("div",{directives:[{name:"transfer-dom",rawName:"v-transfer-dom"}],staticClass:"chat-input-record-transfer",class:{cancel:e.touchLimitY},style:e.recordTransferStyle,attrs:{"data-transfer":!0},on:{click:e.stopRecord}},[e.recordDuration>0?n("div",{staticClass:"record-duration"},[e._v(e._s(e.recordFormatDuration))]):n("div",{staticClass:"record-loading"},[n("Loading")],1),n("div",{staticClass:"record-cancel",on:{click:function(r){return r.stopPropagation(),e.stopRecord(!0)}}},[e._v(e._s(e.$L(e.touchLimitY?"\u677E\u5F00\u53D6\u6D88":"\u5411\u4E0A\u6ED1\u52A8\u53D6\u6D88")))])]):e._e()]),n("Modal",{attrs:{"mask-closable":!1,beforeClose:e.onFullBeforeClose,"class-name":"chat-input-full-input","footer-hide":"",fullscreen:""},model:{value:e.fullInput,callback:function(r){e.fullInput=r},expression:"fullInput"}},[n("div",{staticClass:"chat-input-box"},[n("div",{staticClass:"chat-input-wrapper"},[n("div",{ref:"editorFull",staticClass:"no-dark-content"})])]),n("i",{staticClass:"taskfont",attrs:{slot:"close"},slot:"close"},[e._v("\uE6AB")])])],1)},SJ=[];const bJ={name:"ChatInput",components:{ChatEmoji:Ic},directives:{touchmouse:gJ,TransferDom:hJ,clickoutside:zu,longpress:za},props:{value:{type:[String,Number],default:""},dialogId:{type:Number,default:0},taskId:{type:Number,default:0},placeholder:{type:String,default:""},disabled:{type:Boolean,default:!1},disabledRecord:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},enterSend:{type:[String,Boolean],default:null},emojiBottom:{type:Boolean,default:!1},options:{type:Object,default:()=>({})},maxlength:{type:Number},defaultMenuOrientation:{type:String,default:"top"}},data(){return{quill:null,isFocus:!1,rangeIndex:0,_content:"",_options:{},mentionMode:"",userList:null,userCache:null,taskList:null,fileList:{},showMenu:!1,showMore:!1,showEmoji:!1,emojiQuickShow:!1,emojiQuickKey:"",emojiQuickItems:[],observer:null,wrapperWidth:0,wrapperHeight:0,editorHeight:0,recordReady:!1,recordRec:null,recordBlob:null,recordWave:null,recordInter:null,recordState:"stop",recordDuration:0,touchStart:{},touchLimitX:!1,touchLimitY:!1,pasteClean:!0,isSpecVersion:this.checkIOSVersion(),emojiTimer:null,scrollTimer:null,selectTimer:null,textTimer:null,fileTimer:null,moreTimer:null,fullInput:!1,fullQuill:null}},mounted(){this.init(),this.observer=new ResizeObserver(e=>{e.some(({target:t,contentRect:n})=>{t===this.$el?(this.wrapperWidth=n.width,this.wrapperHeight=n.height):t===this.$refs.editor&&(this.editorHeight=n.height)})}),this.observer.observe(this.$el),this.observer.observe(this.$refs.editor),this.recordInter=setInterval(e=>{this.recordState==="ing"&&(this.__recordDuration&&this.__recordDuration===this.recordDuration?(this.__recordDuration=null,this.stopRecord(!0),$A.messageWarning("\u5F55\u97F3\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5")):this.__recordDuration=this.recordDuration)},1e3),this.$isEEUiApp&&(window.__onPermissionRequest=(e,t)=>{e==="recordAudio"&&t===!1&&this.stopRecord(!0)})},beforeDestroy(){this.quill&&(this.quill=null),this.recordRec&&(this.recordRec=null),this.observer&&(this.observer.disconnect(),this.observer=null),this.recordInter&&clearInterval(this.recordInter)},computed:{...Wn(["cacheProjects","cacheTasks","cacheUserBasic","cacheDialogs","dialogMsgs"]),isEnterSend({enterSend:e}){return typeof e=="boolean"?e:!0},canCall(){return this.dialogData.type==="user"&&!this.dialogData.bot&&this.$isEEUiApp},canAnon(){return this.dialogData.type==="user"&&!this.dialogData.bot},editorStyle(){const{wrapperWidth:e,editorHeight:t,value:n}=this,r={};return n.length<10&&(r.height="30px"),e>0&&t>0&&(e<280||t>40)&&(r.width="100%"),r},recordTransferStyle(){const{windowScrollY:e}=this;return e>0?{marginTop:e/2+"px"}:null},boxClass(){const e=[];return["ready","ing"].includes(this.recordState)&&(this.recordState==="ing"&&this.recordDuration>0?e.push("record-progress"):e.push("record-ready")),this.showMenu&&e.push("show-menu"),this.showMore&&e.push("show-more"),this.showEmoji&&e.push("show-emoji"),this.mentionMode&&e.push(this.mentionMode),e},sendClass(){return this.value?"sender":this.recordReady?"recorder":""},sendContent(){const{sendTip:e}=this.$refs;return e&&e.$refs.popper&&(e.$refs.popper.style.visibility="hidden",e.showPopper=!1,setTimeout(t=>{e.$refs.popper&&(e.$refs.popper.style.visibility="visible")},300)),this.sendClass==="recorder"?"\u957F\u6309\u5F55\u97F3":"\u53D1\u9001"},recordFormatDuration(){const{recordDuration:e}=this;let t=Math.floor(e/6e4),n=Math.floor(e/1e3)%60,r=("00"+e%1e3).substr(-2);return t<10&&(t=`0${t}`),n<10&&(n=`0${n}`),`${t}:${n}\u2033${r}`},dialogData(){return this.dialogId>0?this.cacheDialogs.find(({id:e})=>e==this.dialogId)||{}:{}},quoteUpdate(){return this.dialogData.extra_quote_type==="update"},quoteData(){const{extra_quote_id:e}=this.dialogData;return e?this.dialogMsgs.find(t=>t.id===e):null}},watch:{value(e){this.quill&&(e&&e!==this._content?(this._content=e,this.setContent(e)):e||this.quill.setText("")),this.$store.dispatch("saveDialogDraft",{id:this.dialogId,extra_draft_content:e})},disabled(e){var t;(t=this.quill)==null||t.enable(!e)},dialogId(){this.userList=null,this.userCache=null,this.taskList=null,this.fileList={},this.loadInputDraft()},taskId(){this.userList=null,this.userCache=null,this.taskList=null,this.fileList={},this.loadInputDraft()},"dialogData.extra_draft_content"(){this.isFocus||this.loadInputDraft()},showMenu(e){e&&(this.showMore=!1,this.showEmoji=!1,this.emojiQuickShow=!1)},showMore(e){e&&(this.showMenu=!1,this.showEmoji=!1,this.emojiQuickShow=!1)},showEmoji(e){if(this.emojiBottom&&(e?this.quill.enable(!1):this.disabled||this.quill.enable(!0)),e){let t=this.value.replace(/ /g," ");if(t=t.replace(/<[^>]+>/g,""),t&&t.indexOf(" ")===-1&&t.length>=1&&t.length<=4?this.emojiQuickKey=t:this.emojiQuickKey="",this.showMenu=!1,this.showMore=!1,this.emojiQuickShow=!1,this.quill){const n=this.quill.selection.savedRange;this.rangeIndex=n?n.index:0}}else this.rangeIndex>0&&this.quill.setSelection(this.rangeIndex);this.$emit("on-emoji-visible-change",e)},emojiQuickShow(e){e&&(this.showMenu=!1,this.showMore=!1,this.showEmoji=!1)},isFocus(e){this.scrollTimer&&clearInterval(this.scrollTimer),e?(this.$emit("on-focus"),this.hidePopover(),this.isSpecVersion||this.windowPortrait&&(this.scrollTimer=setInterval(()=>{var t;(t=this.quill)!=null&&t.hasFocus()?this.windowScrollY>0&&$A.scrollIntoViewIfNeeded(this.$refs.editor):clearInterval(this.scrollTimer)},200))):this.$emit("on-blur")},recordState(e){e==="ing"?this.recordWave=window.Recorder.FrequencyHistogramView({elem:this.$refs.recwave,lineCount:90,position:0,minHeight:1,stripeEnable:!1}):(this.recordWave=null,this.$refs.recwave.innerHTML=""),this.$emit("on-record-state",e)},wrapperHeight(e,t){this.$emit("on-height-change",{newVal:e,oldVal:t})},fullInput(e){var t;(t=this.quill)==null||t.enable(!e)}},methods:{init(){this._options=Object.assign({theme:"bubble",readOnly:!1,placeholder:this.placeholder,modules:{toolbar:[["bold","strike","italic","underline",{list:"ordered"},{list:"bullet"},"blockquote","code-block"]],keyboard:{bindings:{"short enter":{key:13,shortKey:!0,handler:e=>this.isEnterSend?!0:(this.onSend(),!1)},enter:{key:13,shiftKey:!1,handler:e=>this.isEnterSend?(this.onSend(),!1):!0},esc:{key:27,shiftKey:!1,handler:e=>this.emojiQuickShow?(this.emojiQuickShow=!1,!1):!0}}},mention:this.quillMention()}},this.options),this.quill=new Vt(this.$refs.editor,this._options),this.quill.enable(!this.disabled),this.value?this.setContent(this.value):this.loadInputDraft(),this.quill.on("selection-change",e=>{if(!e&&document.activeElement&&["ql-editor","ql-clipboard"].includes(document.activeElement.className)){this.selectTimer&&clearTimeout(this.selectTimer),this.selectTimer=setTimeout(t=>{this.quill.setSelection(document.activeElement.className==="ql-editor"?0:this.quill.getLength())},100);return}this.isFocus=!!e}),this.quill.on("text-change",e=>{this.textTimer&&clearTimeout(this.textTimer),this.textTimer=setTimeout(t=>{this.maxlength>0&&this.quill.getLength()>this.maxlength&&this.quill.deleteText(this.maxlength,this.quill.getLength());let n=this.$refs.editor.firstChild.innerHTML;n=n.replace(/^(
<\/p>)+|(
<\/p>)+$/gi,""),this.updateEmojiQuick(n),this._content=n,this.$emit("input",this._content),this.$nextTick(r=>{const a=this.quill.getSelection();if(a){const l=this.quill.getText(a.index);/^\n\n$/.test(l)&&this.quill.deleteText(a.index,1)}})},100)}),this.quill.clipboard.addMatcher(Node.ELEMENT_NODE,(e,t)=>(this.pasteClean&&(t.ops=t.ops.map(n=>{const r={insert:n.insert};try{typeof r.insert.mention=="object"&&e.innerHTML&&(r.insert=e.innerHTML.replace(/<[^>]+>/g,""))}catch{}return n.attributes&&["bold","strike","italic","underline","list","blockquote","link"].some(a=>{n.attributes[a]&&(typeof r.attributes=="undefined"&&(r.attributes={}),r.attributes[a]=n.attributes[a])}),r})),t)),this.$nextTick(e=>{this.quill.root.addEventListener("keydown",t=>{if(t.key==="\r\r"&&t.keyCode===229){const n=this.quill.getSelection(!0).index;this.quill.insertText(n,`\r
`)}}),this.quill.root.setAttribute("enterkeyhint","send")}),this.$emit("on-ready",this.quill),this.disabledRecord||$A.loadScriptS(["js/recorder/recorder.mp3.min.js","js/recorder/lib.fft.js","js/recorder/frequency.histogram.view.js"]).then(e=>{typeof window.Recorder=="function"&&(this.recordRec=window.Recorder({type:"mp3",bitRate:64,sampleRate:32e3,onProcess:(t,n,r,a,l,u)=>{var c;(c=this.recordWave)==null||c.input(t[t.length-1],n,a),this.recordDuration=r,r>=3*60*1e3&&this.stopRecord(!1)}}),window.Recorder.Support()&&(this.recordReady=!0))})},quillMention(){return{allowedChars:/^\S*$/,mentionDenotationChars:["@","#","~"],defaultMenuOrientation:this.defaultMenuOrientation,isolateCharacter:!0,positioningStrategy:"fixed",renderItem:e=>{if(e.disabled===!0)return``)):(this.$emit("input",""),this.$emit("on-send",`
`)),this.emojiQuickShow=!1,this.focus()},onSelectEmoji(e){!this.quill||(e.type==="emoji"?(this.quill.insertText(this.rangeIndex,e.text),this.rangeIndex+=e.text.length,this.windowLandscape&&(this.showEmoji=!1)):e.type==="emoticon"&&(this.$emit("on-send",`
`),e.asset==="emosearch"&&this.$emit("input",""),this.windowLandscape&&(this.showEmoji=!1)))},onToolbar(e){switch(this.hidePopover(),e){case"user":this.openMenu("@");break;case"task":this.openMenu("#");break;case"meeting":Ya.Store.set("addMeeting",{type:"create",dialog_id:this.dialogId,userids:[this.userId]});break;case"full":this.onFullInput();break;case"image":case"file":case"call":case"anon":this.$emit("on-more",e);break}},onFullInput(){this.disabled||(this.fullInput=!this.fullInput,this.fullInput&&this.$nextTick(e=>{this.fullQuill=new Vt(this.$refs.editorFull,Object.assign({theme:"bubble",readOnly:!1,placeholder:this.placeholder,modules:{toolbar:[["bold","strike","italic","underline",{list:"ordered"},{list:"bullet"},"blockquote","code-block"]],mention:this.quillMention()}},this.options)),this.fullQuill.enable(!0),this.$refs.editorFull.firstChild.innerHTML=this.$refs.editor.firstChild.innerHTML,this.$nextTick(t=>{this.fullQuill.setSelection(this.fullQuill.getLength()),this.fullQuill.focus()})}))},onFullBeforeClose(){return new Promise(e=>{var t;(t=this.$refs.editorFull)!=null&&t.firstChild&&(this.$refs.editor.firstChild.innerHTML=this.$refs.editorFull.firstChild.innerHTML),e()})},onMoreVisibleChange(e){this.showMore=e},setQuote(e,t="reply"){this.dialogId>0&&this.$store.dispatch("saveDialog",{id:this.dialogId,extra_quote_id:e,extra_quote_type:t==="update"?"update":"reply"})},cancelQuote(){this.quoteUpdate&&this.$emit("input",""),this.setQuote(0)},openMenu(e){if(!!this.quill)if(this.value.length===0||this.value.endsWith("
${e.label}
`)},getTempId(){return this.tempId++},getMsgs(e){return new Promise((t,n)=>{setTimeout(r=>this.msgLoadIng++,2e3),this.$store.dispatch("getDialogMsgs",e).then(t).catch(n).finally(r=>{this.msgLoadIng--})})},msgFilter(e){if(this.msgType){if(this.msgType==="tag"){if(!e.tag)return!1}else if(this.msgType==="link"){if(!e.link)return!1}else if(this.msgType!==e.mtype)return!1}return!(this.msgId&&e.reply_id!=this.msgId)},onSearchMsgId(){this.dialogSearchMsgId>0&&this.openId===this.dialogId&&(this.onPositionId(this.dialogSearchMsgId),this.$store.state.dialogSearchMsgId=0)},onPositionId(e,t=0,n=0){return new Promise((r,a)=>{if(e===0){$A.modalError("\u67E5\u770B\u5931\u8D25\uFF1A\u53C2\u6570\u9519\u8BEF"),a();return}if(this.loadMsg||this.msgType!==""){if(this.msgType="",n===0)this.$store.dispatch("showSpinner",600);else if(n>20){this.$store.dispatch("hiddenSpinner"),$A.modalError("\u67E5\u770B\u5931\u8D25\uFF1A\u8BF7\u6C42\u8D85\u65F6"),a();return}n++,setTimeout(c=>{this.onPositionId(e,t,n).then(r).catch(a)},Math.min(800,200*n));return}n>0&&this.$store.dispatch("hiddenSpinner");const l=this.allMsgs.findIndex(c=>c.id===e),u=this.prevId>0?0:-1;l>u?setTimeout(c=>{this.onToIndex(l),r()},200):(t>0&&this.$store.dispatch("setLoad",{key:`msg-${t}`,delay:600}),this.preventToBottom=!0,this.getMsgs({dialog_id:this.dialogId,msg_id:this.msgId,msg_type:this.msgType,position_id:e,spinner:2e3}).finally(c=>{const d=this.allMsgs.findIndex(f=>f.id===e);d>-1&&(this.onToIndex(d),r()),t>0&&this.$store.dispatch("cancelLoad",`msg-${t}`),this.preventToBottom=!1}))})},onViewTodo(e){if(this.operateVisible)return;this.todoViewId=e.id,this.todoViewMid=e.msg_id,this.todoViewShow=!0,this.allMsgs.findIndex(n=>n.id===this.todoViewMid)===-1&&this.$store.dispatch("call",{url:"dialog/msg/one",data:{msg_id:this.todoViewMid}}).then(({data:n})=>{this.todoViewData=n})},onCloseTodo(){this.todoViewLoad=!1,this.todoViewShow=!1,this.todoViewData={},this.todoViewMid=0,this.todoViewId=0},onPosTodo(){!this.todoViewMid||(this.todoViewPosLoad=!0,this.onPositionId(this.todoViewMid).then(this.onCloseTodo).finally(e=>{this.todoViewPosLoad=!1}))},onDoneTodo(){!this.todoViewId||this.todoViewLoad||(this.todoViewLoad=!0,this.$store.dispatch("call",{url:"dialog/msg/done",data:{id:this.todoViewId}}).then(({data:e})=>{this.$store.dispatch("saveDialogTodo",{id:this.todoViewId,done_at:$A.formatDate("Y-m-d H:i:s")}),this.$store.dispatch("saveDialog",{id:this.dialogId,todo_num:this.todoList.length}),e.add&&this.sendSuccess(e.add),this.todoList.length===0&&this.$store.dispatch("getDialogTodo",this.dialogId),this.onCloseTodo()}).catch(({msg:e})=>{$A.modalError(e)}).finally(e=>{this.todoViewLoad=!1}))},itemClassAdd(e){return e===this.msgActiveIndex?"common-shake":""},inputFocus(){this.$nextTick(e=>{this.$refs.input&&this.$refs.input.focus()})},onRecordState(e){this.recordState=e},chatPasteDrag(e,t){this.dialogDrag=!1;const n=t==="drag"?e.dataTransfer.files:e.clipboardData.files,r=Array.prototype.slice.call(n);r.length>0&&(e.preventDefault(),this.sendFileMsg(r))},chatDragOver(e,t){let n=this.__dialogDrag=$A.randomString(8);if(!e)setTimeout(()=>{n===this.__dialogDrag&&(this.dialogDrag=e)},150);else{if(t.dataTransfer.effectAllowed==="move"||Array.prototype.slice.call(t.dataTransfer.files).length===0)return;this.dialogDrag=!0}},onTouchStart(e){this.wrapperStart=Object.assign(this.scrollInfo(),{clientY:e.touches[0].clientY,exclud:!this.$refs.scroller.$el.contains(e.target)})},onTouchMove(e){if(this.windowPortrait&&this.windowScrollY>0){if(this.wrapperStart.exclud){e.preventDefault();return}this.wrapperStart.clientY>e.touches[0].clientY?this.wrapperStart.tail===0&&e.preventDefault():this.wrapperStart.offset===0&&e.preventDefault()}},pasteSend(){this.pasteFile.some(e=>{this.$refs.chatUpload.upload(e)})},chatFile(e,t){switch(e){case"progress":const n={id:t.tempId,dialog_id:this.dialogData.id,reply_id:this.quoteId,type:"loading",userid:this.userId,msg:{}};this.tempMsgs.push(n),this.msgType="",this.cancelQuote(),this.onActive(),this.$nextTick(this.onToBottom);break;case"error":this.tempMsgs=this.tempMsgs.filter(({id:r})=>r!=t.tempId);break;case"success":this.tempMsgs=this.tempMsgs.filter(({id:r})=>r!=t.tempId),this.sendSuccess(t.data);break}},sendSuccess(e){if($A.isArray(e)){e.some(this.sendSuccess);return}this.$store.dispatch("saveDialogMsg",e),this.quoteUpdate||(this.$store.dispatch("increaseTaskMsgNum",e),this.$store.dispatch("increaseMsgReplyNum",e),this.$store.dispatch("updateDialogLastMsg",e)),this.cancelQuote(),this.onActive()},setQuote(e,t){var n;(n=this.$refs.input)==null||n.setQuote(e,t)},cancelQuote(){var e;(e=this.$refs.input)==null||e.cancelQuote()},onEventFocus(){this.$emit("on-focus")},onEventBlur(){this.$emit("on-blur")},onEventMore(e){switch(e){case"image":case"file":this.$refs.chatUpload.handleClick();break;case"call":this.onCallTel();break;case"anon":this.onAnon();break}},onCallTel(){this.$store.dispatch("call",{url:"dialog/tel",data:{dialog_id:this.dialogId},spinner:600}).then(({data:e})=>{e.tel&&$A.eeuiAppSendMessage({action:"callTel",tel:e.tel}),e.add&&(this.$store.dispatch("saveDialogMsg",e.add),this.$store.dispatch("updateDialogLastMsg",e.add),this.onActive())}).catch(({msg:e})=>{$A.modalError(e)})},onAnon(){if(this.dialogData.type!=="user"||this.dialogData.bot){$A.modalWarning("\u533F\u540D\u6D88\u606F\u4EC5\u5141\u8BB8\u53D1\u9001\u7ED9\u4E2A\u4EBA");return}$A.modalInput({title:"\u53D1\u9001\u533F\u540D\u6D88\u606F",placeholder:"\u533F\u540D\u6D88\u606F\u5C06\u901A\u8FC7\u533F\u540D\u6D88\u606F\uFF08\u673A\u5668\u4EBA\uFF09\u53D1\u9001\u7ED9\u5BF9\u65B9\uFF0C\u4E0D\u4F1A\u8BB0\u5F55\u4F60\u7684\u4EFB\u4F55\u8EAB\u4EFD\u4FE1\u606F",inputProps:{type:"textarea",rows:3,autosize:{minRows:3,maxRows:6},maxlength:2e3},okText:"\u533F\u540D\u53D1\u9001",onOk:e=>e?new Promise((t,n)=>{this.$store.dispatch("call",{url:"dialog/msg/sendanon",data:{userid:this.dialogData.dialog_user.userid,text:e},method:"post"}).then(({msg:r})=>{t(r)}).catch(({msg:r})=>{n(r)})}):"\u8BF7\u8F93\u5165\u6D88\u606F\u5185\u5BB9"})},onEventEmojiVisibleChange(e){e&&this.windowPortrait&&this.onToBottom()},onHeightChange({newVal:e,oldVal:t}){const n=e-t;if(n!==0){const{offset:r,tail:a}=this.scrollInfo();a>0&&this.onToOffset(r+n)}},onActive(){this.$emit("on-active")},onToBottom(){this.msgNew=0;const e=this.$refs.scroller;e&&(e.scrollToBottom(),requestAnimationFrame(t=>e.scrollToBottom()))},onToIndex(e){const t=this.$refs.scroller;t&&(t.stopToBottom(),t.scrollToIndex(e,-100),requestAnimationFrame(n=>t.scrollToIndex(e,-100))),requestAnimationFrame(n=>this.msgActiveIndex=e)},onToOffset(e){const t=this.$refs.scroller;t&&(t.stopToBottom(),t.scrollToOffset(e),setTimeout(n=>t.scrollToOffset(e),10))},scrollInfo(){const e=this.$refs.scroller;return e?e.scrollInfo():{offset:0,scale:0,tail:0}},openProject(){!this.dialogData.group_info||(this.windowPortrait&&this.$store.dispatch("openDialog",0),this.goForward({name:"manage-project",params:{projectId:this.dialogData.group_info.id}}))},openTask(){!this.dialogData.group_info||(this.taskId>0&&this.$store.dispatch("openDialog",0),this.$store.dispatch("openTask",this.dialogData.group_info.id))},onPrevPage(){this.prevId!==0&&this.getMsgs({dialog_id:this.dialogId,msg_id:this.msgId,msg_type:this.msgType,prev_id:this.prevId,save_before:e=>this.scrollDisabled=!0,save_after:e=>this.scrollDisabled=!1}).then(({data:e})=>{const t=e.list.map(n=>n.id);this.$nextTick(()=>{const n=this.$refs.scroller,r=t.reduce((l,u)=>({size:(typeof l=="object"?l.size:n.getSize(l))+n.getSize(u)}));let a=n.getOffset()+r.size;this.prevId===0&&(a-=36),this.onToOffset(a),setTimeout(l=>n.virtual.handleFront(),10)})}).catch(()=>{})},onDialogMenu(e){var t;switch(e){case"searchMsg":this.searchShow=!0,this.$nextTick(r=>{this.$refs.searchInput.focus()});break;case"openCreate":const n=[this.userId];this.dialogData.dialog_user&&this.userId!=this.dialogData.dialog_user.userid&&n.push(this.dialogData.dialog_user.userid),this.createGroupData={userids:n,uncancelable:[this.userId]},this.createGroupShow=!0;break;case"modifyNormal":this.modifyData={dialog_id:this.dialogData.id,avatar:this.dialogData.avatar,name:this.dialogData.name},this.dialogData.type==="user"&&(this.modifyData=Object.assign(this.modifyData,{userid:this.dialogData.dialog_user.userid,avatar:(t=this.cacheUserBasic.find(r=>r.userid===this.dialogData.dialog_user.userid))==null?void 0:t.userimg,clear_day:0,webhook_url:""}),this.modifyLoad++,this.$store.dispatch("call",{url:"users/bot/info",data:{id:this.dialogData.dialog_user.userid}}).then(({data:r})=>{this.modifyData.clear_day=r.clear_day,this.modifyData.webhook_url=r.webhook_url}).finally(()=>{this.modifyLoad--})),this.modifyShow=!0;break;case"modifyAdmin":this.modifyData={dialog_id:this.dialogData.id,avatar:this.dialogData.avatar,admin:1},this.modifyShow=!0;break;case"groupInfo":this.groupInfoShow=!0;break;case"transfer":this.groupTransferData={dialog_id:this.dialogId,userid:[],disabledChoice:[this.userId]},this.groupTransferShow=!0;break;case"transferConfirm":this.onTransferGroup();break;case"disband":this.onDisbandGroup();break;case"exit":this.onExitGroup();break}},onTransferGroup(){if(this.groupTransferData.userid.length===0){$A.messageError("\u8BF7\u9009\u62E9\u65B0\u7684\u7FA4\u4E3B");return}this.groupTransferLoad++,this.$store.dispatch("call",{url:"dialog/group/transfer",data:{dialog_id:this.dialogId,userid:this.groupTransferData.userid[0]}}).then(({data:e,msg:t})=>{$A.messageSuccess(t),this.$store.dispatch("saveDialog",e)}).catch(({msg:e})=>{$A.modalError(e)}).finally(e=>{this.groupTransferLoad--,this.groupTransferShow=!1})},onDisbandGroup(){$A.modalConfirm({content:`\u4F60\u786E\u5B9A\u8981\u89E3\u6563\u3010${this.dialogData.name}\u3011\u7FA4\u7EC4\u5417\uFF1F`,loading:!0,okText:"\u89E3\u6563",onOk:()=>new Promise((e,t)=>{this.$store.dispatch("call",{url:"dialog/group/disband",data:{dialog_id:this.dialogId}}).then(({msg:n})=>{e(n),this.$store.dispatch("forgetDialog",this.dialogId),this.goForward({name:"manage-messenger"})}).catch(({msg:n})=>{t(n)})})})},onExitGroup(){$A.modalConfirm({content:"\u4F60\u786E\u5B9A\u8981\u9000\u51FA\u7FA4\u7EC4\u5417\uFF1F",loading:!0,onOk:()=>new Promise((e,t)=>{this.$store.dispatch("call",{url:"dialog/group/deluser",data:{dialog_id:this.dialogId}}).then(({msg:n})=>{e(n),this.$store.dispatch("forgetDialog",this.dialogId),this.goForward({name:"manage-messenger"})}).catch(({msg:n})=>{t(n)})})})},onCreateGroup(){this.createGroupLoad++,this.$store.dispatch("call",{url:"dialog/group/add",data:this.createGroupData}).then(({data:e,msg:t})=>{$A.messageSuccess(t),this.createGroupShow=!1,this.createGroupData={},this.$store.dispatch("saveDialog",e),this.$store.dispatch("openDialog",e.id)}).catch(({msg:e})=>{$A.modalError(e)}).finally(e=>{this.createGroupLoad--})},onModify(){this.modifyData.userid?(this.modifyLoad++,this.$store.dispatch("call",{url:"users/bot/edit",data:{id:this.modifyData.userid,avatar:this.modifyData.avatar,name:this.modifyData.name,clear_day:this.modifyData.clear_day,webhook_url:this.modifyData.webhook_url},method:"post"}).then(({data:e,msg:t})=>{$A.messageSuccess(t),this.$store.dispatch("saveUserBasic",{userid:this.modifyData.userid,nickname:e.name,userimg:e.avatar}),this.$store.dispatch("saveDialog",{id:this.modifyData.dialog_id,name:e.name}),this.modifyShow=!1,this.modifyData={}}).catch(({msg:e})=>{$A.modalError(e)}).finally(e=>{this.modifyLoad--})):(this.modifyLoad++,this.$store.dispatch("call",{url:"dialog/group/edit",data:this.modifyData}).then(({data:e,msg:t})=>{$A.messageSuccess(t),this.$store.dispatch("saveDialog",e),this.modifyShow=!1,this.modifyData={}}).catch(({msg:e})=>{$A.modalError(e)}).finally(e=>{this.modifyLoad--}))},onForward(){return new Promise((e,t)=>{if(this.forwardData.length===0){$A.messageError("\u8BF7\u9009\u62E9\u8F6C\u53D1\u5BF9\u8BDD\u6216\u6210\u5458"),t();return}const n=this.forwardData.filter(a=>$A.leftExists(a,"d:")).map(a=>a.replace("d:","")),r=this.forwardData.filter(a=>!$A.leftExists(a,"d:"));this.$store.dispatch("call",{url:"dialog/msg/forward",data:{dialogids:n,userids:r,msg_id:this.operateItem.id}}).then(({data:a,msg:l})=>{this.$store.dispatch("saveDialogMsg",a.msgs),this.$store.dispatch("updateDialogLastMsg",a.msgs),$A.messageSuccess(l),e()}).catch(({msg:a})=>{$A.modalError(a),t()})})},onScroll(e){this.operateVisible=!1;const{offset:t,tail:n}=this.scrollInfo();this.scrollOffset=t,this.scrollTail=n,this.scrollTail<=10&&(this.msgNew=0),this.scrollAction=e.target.scrollTop,this.scrollDirection=this.scrollTmp<=this.scrollAction?"down":"up",setTimeout(r=>this.scrollTmp=this.scrollAction,0)},onRange(e){if(this.preventMoreLoad)return;const t=this.scrollDirection==="down"?"next_id":"prev_id";for(let n=e.start;n<=e.end;n++){const r=this.allMsgs[n][t];if(r){const a=this.allMsgs[n+(t==="next_id"?1:-1)];a&&a.id!=r&&(this.preventMoreLoad=!0,this.getMsgs({dialog_id:this.dialogId,msg_id:this.msgId,msg_type:this.msgType,[t]:r}).finally(l=>{this.preventMoreLoad=!1}))}}},onBack(){if(!this.beforeBack)return this.handleBack();const e=this.beforeBack();e&&e.then?e.then(()=>{this.handleBack()}):this.handleBack()},handleBack(){const{name:e,params:t}=this.$store.state.routeHistoryLast;e===this.$route.name&&/^\d+$/.test(t.dialogId)?this.goForward({name:this.$route.name}):this.goBack()},onMsgType(e){switch(e){case"project":this.openProject();break;case"task":this.openTask();break;default:this.loadMsg?$A.messageWarning("\u6B63\u5728\u52A0\u8F7D\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5..."):this.msgType=e;break}},onMention(e){const t=this.cacheUserBasic.find(({userid:n})=>n==e.userid);t&&this.$refs.input.addMention({denotationChar:"@",id:t.userid,value:t.nickname})},onLongpress({event:e,el:t,msgData:n}){this.operateVisible=this.operateItem.id===n.id,this.operateItem=$A.isJson(n)?n:{},this.operateCopys=[],e.target.nodeName==="IMG"&&this.$Electron?this.operateCopys.push({type:"image",icon:"",label:"\u590D\u5236\u56FE\u7247",value:$A.thumbRestore(e.target.currentSrc)}):e.target.nodeName==="A"&&(e.target.classList.contains("mention")&&e.target.classList.contains("file")&&this.findOperateFile(this.operateItem.id,e.target.href),this.operateCopys.push({type:"link",icon:"",label:"\u590D\u5236\u94FE\u63A5",value:e.target.href})),n.type==="text"&&(e.target.nodeName==="IMG"&&this.operateCopys.push({type:"imagedown",icon:"",label:"\u4E0B\u8F7D\u56FE\u7247",value:$A.thumbRestore(e.target.currentSrc)}),n.msg.text.replace(/<[^>]+>/g,"").length>0&&this.operateCopys.push({type:"text",icon:"",label:this.operateCopys.length>0?"\u590D\u5236\u6587\u672C":"\u590D\u5236",value:""})),this.$nextTick(()=>{const r=t.getBoundingClientRect(),a=this.$el.getBoundingClientRect();this.operateStyles={left:`${e.clientX-a.left}px`,top:`${r.top+this.windowScrollY}px`,height:r.height+"px"},this.operateVisible=!0})},onOperate(e,t=null){this.operateVisible=!1,this.$nextTick(n=>{switch(e){case"reply":this.onReply();break;case"update":this.onUpdate();break;case"copy":this.onCopy(t);break;case"forward":this.forwardData=[],this.$refs.forwardSelect.onSelection();break;case"withdraw":this.onWithdraw();break;case"view":this.onViewFile();break;case"down":this.onDownFile();break;case"tag":this.onTag();break;case"newTask":let r=$A.formatMsgBasic(this.operateItem.msg.text);r=r.replace(/${e.label}
`)},getTempId(){return this.tempId++},getMsgs(e){return new Promise((t,n)=>{setTimeout(r=>this.msgLoadIng++,2e3),this.$store.dispatch("getDialogMsgs",e).then(t).catch(n).finally(r=>{this.msgLoadIng--})})},msgFilter(e){if(this.msgType){if(this.msgType==="tag"){if(!e.tag)return!1}else if(this.msgType==="link"){if(!e.link)return!1}else if(this.msgType!==e.mtype)return!1}return!(this.msgId&&e.reply_id!=this.msgId)},onSearchMsgId(){this.dialogSearchMsgId>0&&this.openId===this.dialogId&&(this.onPositionId(this.dialogSearchMsgId),this.$store.state.dialogSearchMsgId=0)},onPositionId(e,t=0,n=0){return new Promise((r,a)=>{if(e===0){$A.modalError("\u67E5\u770B\u5931\u8D25\uFF1A\u53C2\u6570\u9519\u8BEF"),a();return}if(this.loadMsg||this.msgType!==""){if(this.msgType="",n===0)this.$store.dispatch("showSpinner",600);else if(n>20){this.$store.dispatch("hiddenSpinner"),$A.modalError("\u67E5\u770B\u5931\u8D25\uFF1A\u8BF7\u6C42\u8D85\u65F6"),a();return}n++,setTimeout(c=>{this.onPositionId(e,t,n).then(r).catch(a)},Math.min(800,200*n));return}n>0&&this.$store.dispatch("hiddenSpinner");const l=this.allMsgs.findIndex(c=>c.id===e),u=this.prevId>0?0:-1;l>u?setTimeout(c=>{this.onToIndex(l),r()},200):(t>0&&this.$store.dispatch("setLoad",{key:`msg-${t}`,delay:600}),this.preventToBottom=!0,this.getMsgs({dialog_id:this.dialogId,msg_id:this.msgId,msg_type:this.msgType,position_id:e,spinner:2e3}).finally(c=>{const d=this.allMsgs.findIndex(f=>f.id===e);d>-1&&(this.onToIndex(d),r()),t>0&&this.$store.dispatch("cancelLoad",`msg-${t}`),this.preventToBottom=!1}))})},onViewTodo(e){if(this.operateVisible)return;this.todoViewId=e.id,this.todoViewMid=e.msg_id,this.todoViewShow=!0,this.allMsgs.findIndex(n=>n.id===this.todoViewMid)===-1&&this.$store.dispatch("call",{url:"dialog/msg/one",data:{msg_id:this.todoViewMid}}).then(({data:n})=>{this.todoViewData=n})},onCloseTodo(){this.todoViewLoad=!1,this.todoViewShow=!1,this.todoViewData={},this.todoViewMid=0,this.todoViewId=0},onPosTodo(){!this.todoViewMid||(this.todoViewPosLoad=!0,this.onPositionId(this.todoViewMid).then(this.onCloseTodo).finally(e=>{this.todoViewPosLoad=!1}))},onDoneTodo(){!this.todoViewId||this.todoViewLoad||(this.todoViewLoad=!0,this.$store.dispatch("call",{url:"dialog/msg/done",data:{id:this.todoViewId}}).then(({data:e})=>{this.$store.dispatch("saveDialogTodo",{id:this.todoViewId,done_at:$A.formatDate("Y-m-d H:i:s")}),this.$store.dispatch("saveDialog",{id:this.dialogId,todo_num:this.todoList.length}),e.add&&this.sendSuccess(e.add),this.todoList.length===0&&this.$store.dispatch("getDialogTodo",this.dialogId),this.onCloseTodo()}).catch(({msg:e})=>{$A.modalError(e)}).finally(e=>{this.todoViewLoad=!1}))},itemClassAdd(e){return e===this.msgActiveIndex?"common-shake":""},inputFocus(){this.$nextTick(e=>{this.$refs.input&&this.$refs.input.focus()})},onRecordState(e){this.recordState=e},chatPasteDrag(e,t){this.dialogDrag=!1;const n=t==="drag"?e.dataTransfer.files:e.clipboardData.files,r=Array.prototype.slice.call(n);r.length>0&&(e.preventDefault(),this.sendFileMsg(r))},chatDragOver(e,t){let n=this.__dialogDrag=$A.randomString(8);if(!e)setTimeout(()=>{n===this.__dialogDrag&&(this.dialogDrag=e)},150);else{if(t.dataTransfer.effectAllowed==="move"||Array.prototype.slice.call(t.dataTransfer.files).length===0)return;this.dialogDrag=!0}},onTouchStart(e){this.wrapperStart=Object.assign(this.scrollInfo(),{clientY:e.touches[0].clientY,exclud:!this.$refs.scroller.$el.contains(e.target)})},onTouchMove(e){if(this.windowPortrait&&this.windowScrollY>0){if(this.wrapperStart.exclud){e.preventDefault();return}this.wrapperStart.clientY>e.touches[0].clientY?this.wrapperStart.tail===0&&e.preventDefault():this.wrapperStart.offset===0&&e.preventDefault()}},pasteSend(){this.pasteFile.some(e=>{this.$refs.chatUpload.upload(e)})},chatFile(e,t){switch(e){case"progress":const n={id:t.tempId,dialog_id:this.dialogData.id,reply_id:this.quoteId,type:"loading",userid:this.userId,msg:{}};this.tempMsgs.push(n),this.msgType="",this.cancelQuote(),this.onActive(),this.$nextTick(this.onToBottom);break;case"error":this.tempMsgs=this.tempMsgs.filter(({id:r})=>r!=t.tempId);break;case"success":this.tempMsgs=this.tempMsgs.filter(({id:r})=>r!=t.tempId),this.sendSuccess(t.data);break}},sendSuccess(e){if($A.isArray(e)){e.some(this.sendSuccess);return}this.$store.dispatch("saveDialogMsg",e),this.quoteUpdate||(this.$store.dispatch("increaseTaskMsgNum",e),this.$store.dispatch("increaseMsgReplyNum",e),this.$store.dispatch("updateDialogLastMsg",e)),this.cancelQuote(),this.onActive()},setQuote(e,t){var n;(n=this.$refs.input)==null||n.setQuote(e,t)},cancelQuote(){var e;(e=this.$refs.input)==null||e.cancelQuote()},onEventFocus(){this.$emit("on-focus")},onEventBlur(){this.$emit("on-blur")},onEventMore(e){switch(e){case"image":case"file":this.$refs.chatUpload.handleClick();break;case"call":this.onCallTel();break;case"anon":this.onAnon();break}},onCallTel(){this.$store.dispatch("call",{url:"dialog/tel",data:{dialog_id:this.dialogId},spinner:600}).then(({data:e})=>{e.tel&&$A.eeuiAppSendMessage({action:"callTel",tel:e.tel}),e.add&&(this.$store.dispatch("saveDialogMsg",e.add),this.$store.dispatch("updateDialogLastMsg",e.add),this.onActive())}).catch(({msg:e})=>{$A.modalError(e)})},onAnon(){if(this.dialogData.type!=="user"||this.dialogData.bot){$A.modalWarning("\u533F\u540D\u6D88\u606F\u4EC5\u5141\u8BB8\u53D1\u9001\u7ED9\u4E2A\u4EBA");return}$A.modalInput({title:"\u53D1\u9001\u533F\u540D\u6D88\u606F",placeholder:"\u533F\u540D\u6D88\u606F\u5C06\u901A\u8FC7\u533F\u540D\u6D88\u606F\uFF08\u673A\u5668\u4EBA\uFF09\u53D1\u9001\u7ED9\u5BF9\u65B9\uFF0C\u4E0D\u4F1A\u8BB0\u5F55\u4F60\u7684\u4EFB\u4F55\u8EAB\u4EFD\u4FE1\u606F",inputProps:{type:"textarea",rows:3,autosize:{minRows:3,maxRows:6},maxlength:2e3},okText:"\u533F\u540D\u53D1\u9001",onOk:e=>e?new Promise((t,n)=>{this.$store.dispatch("call",{url:"dialog/msg/sendanon",data:{userid:this.dialogData.dialog_user.userid,text:e},method:"post"}).then(({msg:r})=>{t(r)}).catch(({msg:r})=>{n(r)})}):"\u8BF7\u8F93\u5165\u6D88\u606F\u5185\u5BB9"})},onEventEmojiVisibleChange(e){e&&this.windowPortrait&&this.onToBottom()},onHeightChange({newVal:e,oldVal:t}){const n=e-t;if(n!==0){const{offset:r,tail:a}=this.scrollInfo();a>0&&this.onToOffset(r+n)}},onActive(){this.$emit("on-active")},onToBottom(){this.msgNew=0;const e=this.$refs.scroller;e&&(e.scrollToBottom(),requestAnimationFrame(t=>e.scrollToBottom()))},onToIndex(e){const t=this.$refs.scroller;t&&(t.stopToBottom(),t.scrollToIndex(e,-100),requestAnimationFrame(n=>t.scrollToIndex(e,-100))),requestAnimationFrame(n=>this.msgActiveIndex=e)},onToOffset(e){const t=this.$refs.scroller;t&&(t.stopToBottom(),t.scrollToOffset(e),setTimeout(n=>t.scrollToOffset(e),10))},scrollInfo(){const e=this.$refs.scroller;return e?e.scrollInfo():{offset:0,scale:0,tail:0}},openProject(){!this.dialogData.group_info||(this.windowPortrait&&this.$store.dispatch("openDialog",0),this.goForward({name:"manage-project",params:{projectId:this.dialogData.group_info.id}}))},openTask(){!this.dialogData.group_info||(this.taskId>0&&this.$store.dispatch("openDialog",0),this.$store.dispatch("openTask",this.dialogData.group_info.id))},onPrevPage(){this.prevId!==0&&this.getMsgs({dialog_id:this.dialogId,msg_id:this.msgId,msg_type:this.msgType,prev_id:this.prevId,save_before:e=>this.scrollDisabled=!0,save_after:e=>this.scrollDisabled=!1}).then(({data:e})=>{const t=e.list.map(n=>n.id);this.$nextTick(()=>{const n=this.$refs.scroller,r=t.reduce((l,u)=>({size:(typeof l=="object"?l.size:n.getSize(l))+n.getSize(u)}));let a=n.getOffset()+r.size;this.prevId===0&&(a-=36),this.onToOffset(a),setTimeout(l=>n.virtual.handleFront(),10)})}).catch(()=>{})},onDialogMenu(e){var t;switch(e){case"searchMsg":this.searchShow=!0,this.$nextTick(r=>{this.$refs.searchInput.focus()});break;case"openCreate":const n=[this.userId];this.dialogData.dialog_user&&this.userId!=this.dialogData.dialog_user.userid&&n.push(this.dialogData.dialog_user.userid),this.createGroupData={userids:n,uncancelable:[this.userId]},this.createGroupShow=!0;break;case"modifyNormal":this.modifyData={dialog_id:this.dialogData.id,avatar:this.dialogData.avatar,name:this.dialogData.name},this.dialogData.type==="user"&&(this.modifyData=Object.assign(this.modifyData,{userid:this.dialogData.dialog_user.userid,avatar:(t=this.cacheUserBasic.find(r=>r.userid===this.dialogData.dialog_user.userid))==null?void 0:t.userimg,clear_day:0,webhook_url:""}),this.modifyLoad++,this.$store.dispatch("call",{url:"users/bot/info",data:{id:this.dialogData.dialog_user.userid}}).then(({data:r})=>{this.modifyData.clear_day=r.clear_day,this.modifyData.webhook_url=r.webhook_url}).finally(()=>{this.modifyLoad--})),this.modifyShow=!0;break;case"modifyAdmin":this.modifyData={dialog_id:this.dialogData.id,avatar:this.dialogData.avatar,admin:1},this.modifyShow=!0;break;case"groupInfo":this.groupInfoShow=!0;break;case"transfer":this.groupTransferData={dialog_id:this.dialogId,userid:[],disabledChoice:[this.userId]},this.groupTransferShow=!0;break;case"transferConfirm":this.onTransferGroup();break;case"disband":this.onDisbandGroup();break;case"exit":this.onExitGroup();break}},onTransferGroup(){if(this.groupTransferData.userid.length===0){$A.messageError("\u8BF7\u9009\u62E9\u65B0\u7684\u7FA4\u4E3B");return}this.groupTransferLoad++,this.$store.dispatch("call",{url:"dialog/group/transfer",data:{dialog_id:this.dialogId,userid:this.groupTransferData.userid[0]}}).then(({data:e,msg:t})=>{$A.messageSuccess(t),this.$store.dispatch("saveDialog",e)}).catch(({msg:e})=>{$A.modalError(e)}).finally(e=>{this.groupTransferLoad--,this.groupTransferShow=!1})},onDisbandGroup(){$A.modalConfirm({content:`\u4F60\u786E\u5B9A\u8981\u89E3\u6563\u3010${this.dialogData.name}\u3011\u7FA4\u7EC4\u5417\uFF1F`,loading:!0,okText:"\u89E3\u6563",onOk:()=>new Promise((e,t)=>{this.$store.dispatch("call",{url:"dialog/group/disband",data:{dialog_id:this.dialogId}}).then(({msg:n})=>{e(n),this.$store.dispatch("forgetDialog",this.dialogId),this.goForward({name:"manage-messenger"})}).catch(({msg:n})=>{t(n)})})})},onExitGroup(){$A.modalConfirm({content:"\u4F60\u786E\u5B9A\u8981\u9000\u51FA\u7FA4\u7EC4\u5417\uFF1F",loading:!0,onOk:()=>new Promise((e,t)=>{this.$store.dispatch("call",{url:"dialog/group/deluser",data:{dialog_id:this.dialogId}}).then(({msg:n})=>{e(n),this.$store.dispatch("forgetDialog",this.dialogId),this.goForward({name:"manage-messenger"})}).catch(({msg:n})=>{t(n)})})})},onCreateGroup(){this.createGroupLoad++,this.$store.dispatch("call",{url:"dialog/group/add",data:this.createGroupData}).then(({data:e,msg:t})=>{$A.messageSuccess(t),this.createGroupShow=!1,this.createGroupData={},this.$store.dispatch("saveDialog",e),this.$store.dispatch("openDialog",e.id)}).catch(({msg:e})=>{$A.modalError(e)}).finally(e=>{this.createGroupLoad--})},onModify(){this.modifyData.userid?(this.modifyLoad++,this.$store.dispatch("call",{url:"users/bot/edit",data:{id:this.modifyData.userid,avatar:this.modifyData.avatar,name:this.modifyData.name,clear_day:this.modifyData.clear_day,webhook_url:this.modifyData.webhook_url},method:"post"}).then(({data:e,msg:t})=>{$A.messageSuccess(t),this.$store.dispatch("saveUserBasic",{userid:this.modifyData.userid,nickname:e.name,userimg:e.avatar}),this.$store.dispatch("saveDialog",{id:this.modifyData.dialog_id,name:e.name}),this.modifyShow=!1,this.modifyData={}}).catch(({msg:e})=>{$A.modalError(e)}).finally(e=>{this.modifyLoad--})):(this.modifyLoad++,this.$store.dispatch("call",{url:"dialog/group/edit",data:this.modifyData}).then(({data:e,msg:t})=>{$A.messageSuccess(t),this.$store.dispatch("saveDialog",e),this.modifyShow=!1,this.modifyData={}}).catch(({msg:e})=>{$A.modalError(e)}).finally(e=>{this.modifyLoad--}))},onForward(){return new Promise((e,t)=>{if(this.forwardData.length===0){$A.messageError("\u8BF7\u9009\u62E9\u8F6C\u53D1\u5BF9\u8BDD\u6216\u6210\u5458"),t();return}const n=this.forwardData.filter(a=>$A.leftExists(a,"d:")).map(a=>a.replace("d:","")),r=this.forwardData.filter(a=>!$A.leftExists(a,"d:"));this.$store.dispatch("call",{url:"dialog/msg/forward",data:{dialogids:n,userids:r,msg_id:this.operateItem.id}}).then(({data:a,msg:l})=>{this.$store.dispatch("saveDialogMsg",a.msgs),this.$store.dispatch("updateDialogLastMsg",a.msgs),$A.messageSuccess(l),e()}).catch(({msg:a})=>{$A.modalError(a),t()})})},onScroll(e){this.operateVisible=!1;const{offset:t,tail:n}=this.scrollInfo();this.scrollOffset=t,this.scrollTail=n,this.scrollTail<=45&&(this.msgNew=0),this.scrollAction=e.target.scrollTop,this.scrollDirection=this.scrollTmp<=this.scrollAction?"down":"up",setTimeout(r=>this.scrollTmp=this.scrollAction,0)},onRange(e){if(this.preventMoreLoad)return;const t=this.scrollDirection==="down"?"next_id":"prev_id";for(let n=e.start;n<=e.end;n++){const r=this.allMsgs[n][t];if(r){const a=this.allMsgs[n+(t==="next_id"?1:-1)];a&&a.id!=r&&(this.preventMoreLoad=!0,this.getMsgs({dialog_id:this.dialogId,msg_id:this.msgId,msg_type:this.msgType,[t]:r}).finally(l=>{this.preventMoreLoad=!1}))}}},onBack(){if(!this.beforeBack)return this.handleBack();const e=this.beforeBack();e&&e.then?e.then(()=>{this.handleBack()}):this.handleBack()},handleBack(){const{name:e,params:t}=this.$store.state.routeHistoryLast;e===this.$route.name&&/^\d+$/.test(t.dialogId)?this.goForward({name:this.$route.name}):this.goBack()},onMsgType(e){switch(e){case"project":this.openProject();break;case"task":this.openTask();break;default:this.loadMsg?$A.messageWarning("\u6B63\u5728\u52A0\u8F7D\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5..."):this.msgType=e;break}},onMention(e){const t=this.cacheUserBasic.find(({userid:n})=>n==e.userid);t&&this.$refs.input.addMention({denotationChar:"@",id:t.userid,value:t.nickname})},onLongpress({event:e,el:t,msgData:n}){this.operateVisible=this.operateItem.id===n.id,this.operateItem=$A.isJson(n)?n:{},this.operateCopys=[],e.target.nodeName==="IMG"&&this.$Electron?this.operateCopys.push({type:"image",icon:"",label:"\u590D\u5236\u56FE\u7247",value:$A.thumbRestore(e.target.currentSrc)}):e.target.nodeName==="A"&&(e.target.classList.contains("mention")&&e.target.classList.contains("file")&&this.findOperateFile(this.operateItem.id,e.target.href),this.operateCopys.push({type:"link",icon:"",label:"\u590D\u5236\u94FE\u63A5",value:e.target.href})),n.type==="text"&&(e.target.nodeName==="IMG"&&this.operateCopys.push({type:"imagedown",icon:"",label:"\u4E0B\u8F7D\u56FE\u7247",value:$A.thumbRestore(e.target.currentSrc)}),n.msg.text.replace(/<[^>]+>/g,"").length>0&&this.operateCopys.push({type:"text",icon:"",label:this.operateCopys.length>0?"\u590D\u5236\u6587\u672C":"\u590D\u5236",value:""})),this.$nextTick(()=>{const r=t.getBoundingClientRect(),a=this.$el.getBoundingClientRect();this.operateStyles={left:`${e.clientX-a.left}px`,top:`${r.top+this.windowScrollY}px`,height:r.height+"px"},this.operateVisible=!0})},onOperate(e,t=null){this.operateVisible=!1,this.$nextTick(n=>{switch(e){case"reply":this.onReply();break;case"update":this.onUpdate();break;case"copy":this.onCopy(t);break;case"forward":this.forwardData=[],this.$refs.forwardSelect.onSelection();break;case"withdraw":this.onWithdraw();break;case"view":this.onViewFile();break;case"down":this.onDownFile();break;case"tag":this.onTag();break;case"newTask":let r=$A.formatMsgBasic(this.operateItem.msg.text);r=r.replace(/"+e+""};cr.prototype.br=function(){return this.options.xhtml?""+Un(h.message+"",!0)+"";throw h}}Gn.options=Gn.setOptions=function(e){return Ca(Gn.defaults,e),Gn};Gn.getDefaults=function(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:new cr,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,xhtml:!1}};Gn.defaults=Gn.getDefaults();Gn.Parser=wa;Gn.parser=wa.parse;Gn.Renderer=cr;Gn.TextRenderer=Ga;Gn.Lexer=Ts;Gn.lexer=Ts.lex;Gn.InlineLexer=_i;Gn.inlineLexer=_i.output;Gn.Slugger=D0;Gn.parse=Gn;an.initHighlightingOnLoad();const yB=new Gn.Renderer;var bB=Gn.setOptions({renderer:yB,gfm:!0,tables:!0,breaks:!1,pedantic:!1,sanitize:!1,smartLists:!0,highlight:function(e){return an.highlightAuto(e).value}}),wB=function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{ref:"preview",staticClass:"markdown-preview-warp"},[r("div",{class:`markdown-preview ${"markdown-theme-"+e.theme}`,domProps:{innerHTML:e._s(e.html)}}),r("div",{class:["preview-img",e.previewImgModal?"active":""]},[r("span",{staticClass:"close icon-close iconfont",on:{click:function(i){e.previewImgModal=!1}}}),r("img",{class:[e.previewImgMode],attrs:{src:e.previewImgSrc,alt:""}})])])},CB=[];const xB={name:"markdown-preview",props:{initialValue:{type:String,default:""},markedOptions:{type:Object,default:()=>({})},theme:{type:String,default:"light"},copyCode:{type:Boolean,default:!0},copyBtnText:{type:String,default:"\u590D\u5236\u4EE3\u7801"}},data(){return{html:"",previewImgModal:!1,previewImgSrc:"",previewImgMode:""}},mounted(){this.translateMarkdown()},methods:{tocLevel(e,t){let r=9999;return t.forEach(({level:i})=>{r=Math.min(r,i)}),r===9999?e:e-(r-1)},translateMarkdown(){let e=bB(this.initialValue,{sanitize:!1,...this.markedOptions}).replace(/href="/gi,'target="_blank" href="');if(this.copyCode&&(e=e.replace(/
/g,''+this.copyBtnText+"")),/\[\[TOC\]\]/.test(e)){let t="";Hg.tocItems.forEach(r=>{t+=`").replace(/<\/pre>/g,"
>4)*ye[J],F=ee[J]>>8,ee[J]&=255;for(J=0;J<32;J++)ee[J]-=F*ye[J];for(I=0;I<32;I++)ee[I+1]+=ee[I]>>8,ae[I]=255&ee[I]}function ke(ae){var ee,F=new Float64Array(64);for(ee=0;ee<64;ee++)F[ee]=ae[ee];for(ee=0;ee<64;ee++)ae[ee]=0;de(ae,F)}function ie(ae,ee){var F=r(),I=r(),J=r(),q=r(),fe=r(),Ce=r(),X=r();return g(ae[2],u),x(ae[1],ee),M(J,ae[1]),T(q,J,h),w(J,J,ae[2]),E(q,ae[2],q),M(fe,q),M(Ce,fe),T(X,Ce,fe),T(F,X,J),T(F,F,q),function(H,re){var Z,Oe=r();for(Z=0;Z<16;Z++)Oe[Z]=re[Z];for(Z=250;Z>=0;Z--)M(Oe,Oe),Z!==1&&T(Oe,Oe,re);for(Z=0;Z<16;Z++)H[Z]=Oe[Z]}(F,F),T(F,F,J),T(F,F,q),T(F,F,q),T(ae[0],F,q),M(I,ae[0]),T(I,I,q),O(I,J)&&T(ae[0],ae[0],v),M(I,ae[0]),T(I,I,q),O(I,J)?-1:(S(ae[0])===ee[31]>>7&&w(ae[0],s,ae[0]),T(ae[3],ae[0],ae[1]),0)}var be=64;function Ie(){for(var ae=0;ae=0},t.sign.keyPair=function(){var ae=new Uint8Array(32),ee=new Uint8Array(64);return pe(ae,ee),{publicKey:ae,secretKey:ee}},t.sign.keyPair.fromSecretKey=function(ae){if(Ie(ae),ae.length!==64)throw Error("bad secret key size");for(var ee=new Uint8Array(32),F=0;F e&&(h.imod(s.leftShift(a)).iadd(s),n=h.mod(u).toNumber());while(!await sD(h,t,r));return h}async function sD(e,t,r){return!(t&&!e.dec().gcd(t).isOne())&&!!await async function(i){const a=await Pe.getBigInteger();return tV.every(s=>i.mod(new a(s))!==0)}(e)&&!!await async function(i,a){const s=await Pe.getBigInteger();return a=a||new s(2),a.modExp(i.dec(),i).isOne()}(e)&&!!await async function(i,a,s){const u=await Pe.getBigInteger(),c=i.bitLength();a||(a=Math.max(1,c/48|0));const h=i.dec();let n=0;for(;!h.getBit(n);)n++;const p=i.rightShift(new u(n));for(;a>0;a--){let d,v=(s?s():await Is(new u(2),h)).modExp(p,i);if(!v.isOne()&&!v.equal(h)){for(d=1;d t-11)throw Error("Message too long");const i=function(s){const u=new Uint8Array(s);let c=0;for(;c =8&!i;if(t)return Pe.selectUint8Array(u,s,t);if(u)return s;throw Error("Decryption error")}async function cy(e,t,r){let i;if(t.length!==wu.getHashByteLength(e))throw Error("Invalid hash length");const a=new Uint8Array(ja[e].length);for(i=0;iimport("./bn.min.a20d8e66.js"),[]),O=new k(g),S=new k(y),x=new k(m),E=x.mod(S.subn(1)),w=x.mod(O.subn(1)),T=ei.createSign(he.read(he.hash,n));T.write(p),T.end();const M={version:0,modulus:new k(d),publicExponent:new k(v),privateExponent:new k(m),prime1:new k(y),prime2:new k(g),exponent1:E,exponent2:w,coefficient:new k(b)};if(ei.createPrivateKey!==void 0){const L=Xl.encode(M,"der");return new Uint8Array(T.sign({key:L,format:"der",type:"pkcs1"}))}const A=Xl.encode(M,"pem",{label:"RSA PRIVATE KEY"});return new Uint8Array(T.sign(A))}(e,t,r,i,a,s,u,c)}return async function(n,p,d,v){const m=await Pe.getBigInteger();p=new m(p);const g=new m(await cy(n,v,p.byteLength()));if(d=new m(d),g.gte(p))throw Error("Message size cannot exceed modulus size");return g.modExp(d,p).toUint8Array("be",p.byteLength())}(e,r,a,h)},verify:async function(e,t,r,i,a,s){if(t&&!Pe.isStream(t)){if(Pe.getWebCrypto())try{return await async function(u,c,h,n,p){const d=function(m,g){return{kty:"RSA",n:zi(m,!0),e:zi(g,!0),ext:!0}}(n,p),v=await Yl.importKey("jwk",d,{name:"RSASSA-PKCS1-v1_5",hash:{name:u}},!1,["verify"]);return Yl.verify("RSASSA-PKCS1-v1_5",v,h,c)}(he.read(he.webHash,e),t,r,i,a)}catch(u){Pe.printDebugError(u)}else if(Pe.getNodeCrypto())return async function(u,c,h,n,p){const{default:d}=await Cn(()=>import("./bn.min.a20d8e66.js"),[]),v=ei.createVerify(he.read(he.hash,u));v.write(c),v.end();const m={modulus:new d(n),publicExponent:new d(p)};let g;ei.createPrivateKey!==void 0?g={key:Yh.encode(m,"der"),format:"der",type:"pkcs1"}:g=Yh.encode(m,"pem",{label:"RSA PUBLIC KEY"});try{return await v.verify(g,h)}catch{return!1}}(e,t,r,i,a)}return async function(u,c,h,n,p){const d=await Pe.getBigInteger();if(h=new d(h),c=new d(c),n=new d(n),c.gte(h))throw Error("Signature size cannot exceed modulus size");const v=c.modExp(n,h).toUint8Array("be",h.byteLength()),m=await cy(u,p,h.byteLength());return Pe.equalsUint8Array(v,m)}(e,r,i,a,s)},encrypt:async function(e,t,r){return Pe.getNodeCrypto()?async function(i,a,s){const{default:u}=await Cn(()=>import("./bn.min.a20d8e66.js"),[]),c={modulus:new u(a),publicExponent:new u(s)};let h;return ei.createPrivateKey!==void 0?h={key:Yh.encode(c,"der"),format:"der",type:"pkcs1",padding:ei.constants.RSA_PKCS1_PADDING}:h={key:Yh.encode(c,"pem",{label:"RSA PUBLIC KEY"}),padding:ei.constants.RSA_PKCS1_PADDING},new Uint8Array(ei.publicEncrypt(h,i))}(e,t,r):async function(i,a,s){const u=await Pe.getBigInteger();if(a=new u(a),i=new u(Y0(i,a.byteLength())),s=new u(s),i.gte(a))throw Error("Message size cannot exceed modulus size");return i.modExp(s,a).toUint8Array("be",a.byteLength())}(e,t,r)},decrypt:async function(e,t,r,i,a,s,u,c){return Pe.getNodeCrypto()?async function(h,n,p,d,v,m,g,y){const{default:b}=await Cn(()=>import("./bn.min.a20d8e66.js"),[]),k=new b(v),O=new b(m),S=new b(d),x=S.mod(O.subn(1)),E=S.mod(k.subn(1)),w={version:0,modulus:new b(n),publicExponent:new b(p),privateExponent:new b(d),prime1:new b(m),prime2:new b(v),exponent1:x,exponent2:E,coefficient:new b(g)};let T;ei.createPrivateKey!==void 0?T={key:Xl.encode(w,"der"),format:"der",type:"pkcs1",padding:ei.constants.RSA_PKCS1_PADDING}:T={key:Xl.encode(w,"pem",{label:"RSA PRIVATE KEY"}),padding:ei.constants.RSA_PKCS1_PADDING};try{return new Uint8Array(ei.privateDecrypt(T,h))}catch{if(y)return y;throw Error("Decryption error")}}(e,t,r,i,a,s,u,c):async function(h,n,p,d,v,m,g,y){const b=await Pe.getBigInteger();if(h=new b(h),n=new b(n),p=new b(p),d=new b(d),v=new b(v),m=new b(m),g=new b(g),h.gte(n))throw Error("Data too large.");const k=d.mod(m.dec()),O=d.mod(v.dec()),S=(await Is(new b(2),n)).mod(n),x=S.modInv(n).modExp(p,n);h=h.mul(x).mod(n);const E=h.modExp(O,v),w=h.modExp(k,m);let M=g.mul(w.sub(E)).mod(m).mul(v).add(E);return M=M.mul(S).mod(n),X0(M.toUint8Array("be",n.byteLength()),y)}(e,t,r,i,a,s,u,c)},generate:async function(e,t){if(t=new(await Pe.getBigInteger())(t),Pe.getWebCrypto()){const u={name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:t.toUint8Array(),hash:{name:"SHA-1"}},c=await Yl.generateKey(u,!0,["sign","verify"]),h=await Yl.exportKey("jwk",c.privateKey);return{n:ws(h.n),e:t.toUint8Array(),d:ws(h.d),p:ws(h.q),q:ws(h.p),u:ws(h.qi)}}if(Pe.getNodeCrypto()&&ei.generateKeyPair&&Xl){const u={modulusLength:e,publicExponent:t.toNumber(),publicKeyEncoding:{type:"pkcs1",format:"der"},privateKeyEncoding:{type:"pkcs1",format:"der"}},c=await new Promise((h,n)=>{ei.generateKeyPair("rsa",u,(p,d,v)=>{p?n(p):h(Xl.decode(v,"der"))})});return{n:c.modulus.toArrayLike(Uint8Array),e:c.publicExponent.toArrayLike(Uint8Array),d:c.privateExponent.toArrayLike(Uint8Array),p:c.prime2.toArrayLike(Uint8Array),q:c.prime1.toArrayLike(Uint8Array),u:c.coefficient.toArrayLike(Uint8Array)}}let r,i,a;do i=await h5(e-(e>>1),t,40),r=await h5(e>>1,t,40),a=r.mul(i);while(a.bitLength()!==e);const s=r.dec().imul(i.dec());return i.lt(r)&&([r,i]=[i,r]),{n:a.toUint8Array(),e:t.toUint8Array(),d:t.modInv(s).toUint8Array(),p:r.toUint8Array(),q:i.toUint8Array(),u:r.modInv(i).toUint8Array()}},validateParams:async function(e,t,r,i,a,s){const u=await Pe.getBigInteger();if(e=new u(e),i=new u(i),a=new u(a),!i.mul(a).equal(e))return!1;const c=new u(2);if(s=new u(s),!i.mul(s).mod(a).isOne())return!1;t=new u(t),r=new u(r);const h=new u(Math.floor(e.bitLength()/3)),n=await Is(c,c.leftShift(h)),p=n.mul(r).mul(t);return!(!p.mod(i.dec()).equal(n)||!p.mod(a.dec()).equal(n))}}),iV=Object.freeze({__proto__:null,encrypt:async function(e,t,r,i){const a=await Pe.getBigInteger();t=new a(t),r=new a(r),i=new a(i);const s=new a(Y0(e,t.byteLength())),u=await Is(new a(1),t.dec());return{c1:r.modExp(u,t).toUint8Array(),c2:i.modExp(u,t).imul(s).imod(t).toUint8Array()}},decrypt:async function(e,t,r,i,a){const s=await Pe.getBigInteger();return e=new s(e),t=new s(t),r=new s(r),i=new s(i),X0(e.modExp(i,r).modInv(r).imul(t).imod(r).toUint8Array("be",r.byteLength()),a)},validateParams:async function(e,t,r,i){const a=await Pe.getBigInteger();e=new a(e),t=new a(t),r=new a(r);const s=new a(1);if(t.lte(s)||t.gte(e))return!1;const u=new a(e.bitLength()),c=new a(1023);if(u.lt(c)||!t.modExp(e.dec(),e).isOne())return!1;let h=t;const n=new a(1),p=new a(2).leftShift(new a(17));for(;n.lt(p);){if(h=h.mul(t).imod(e),h.isOne())return!1;n.iinc()}i=new a(i);const d=new a(2),v=await Is(d.leftShift(u.dec()),d.leftShift(u)),m=e.dec().imul(v).iadd(i);return!!r.equal(t.modExp(m,e))}});class Ka{constructor(t){if(t instanceof Ka)this.oid=t.oid;else if(Pe.isArray(t)||Pe.isUint8Array(t)){if((t=new Uint8Array(t))[0]===6){if(t[1]!==t.length-2)throw Error("Length mismatch in DER encoded oid");t=t.subarray(2)}this.oid=t}else this.oid=""}read(t){if(t.length>=1){const r=t[0];if(t.length>=1+r)return this.oid=t.subarray(1,1+r),1+this.oid.length}throw Error("Invalid oid")}write(){return Pe.concatUint8Array([new Uint8Array([this.oid.length]),this.oid])}toHex(){return Pe.uint8ArrayToHex(this.oid)}getName(){const t=this.toHex();if(he.curve[t])return he.write(he.curve,t);throw Error("Unknown curve object identifier.")}}function tm(e,t){return e.keyPair({priv:t})}function nm(e,t){const r=e.keyPair({pub:t});if(r.validate().result!==!0)throw Error("Invalid elliptic public key");return r}async function Ru(e){if(!Nt.useIndutnyElliptic)throw Error("This curve is only supported in the full build of OpenPGP.js");const{default:t}=await Cn(()=>import("./elliptic.min.90ec5b69.js"),["js/build/elliptic.min.90ec5b69.js","js/build/bn.min.a20d8e66.js"]);return new t.ec(e)}function lD(e){let t,r=0;const i=e[0];return i<192?([r]=e,t=1):i<255?(r=(e[0]-192<<8)+e[1]+192,t=2):i===255&&(r=Pe.readNumber(e.subarray(1,5)),t=5),{len:r,offset:t}}function Md(e){return e<192?new Uint8Array([e]):e>191&&e<8384?new Uint8Array([192+(e-192>>8),e-192&255]):Pe.concatUint8Array([new Uint8Array([255]),Pe.writeNumber(e,4)])}function aV(e){if(e<0||e>30)throw Error("Partial Length power must be between 1 and 30");return new Uint8Array([224+e])}function uD(e){return new Uint8Array([192|e])}function p5(e,t){return Pe.concatUint8Array([uD(e),Md(t)])}function Ep(e){return[he.packet.literalData,he.packet.compressedData,he.packet.symmetricallyEncryptedData,he.packet.symEncryptedIntegrityProtectedData,he.packet.aeadEncryptedData].includes(e)}async function sV(e,t){const r=ls(e);let i,a;try{const s=await r.peekBytes(2);if(!s||s.length<2||(128&s[0])==0)throw Error("Error during parsing. This message / key probably does not conform to a valid OpenPGP format.");const u=await r.readByte();let c,h,n=-1,p=-1;p=0,(64&u)!=0&&(p=1),p?n=63&u:(n=(63&u)>>2,h=3&u);const d=Ep(n);let v,m=null;if(d){if(Pe.isStream(e)==="array"){const y=new Qa;i=Ri(y),m=y}else{const y=new bu;i=Ri(y.writable),m=y.readable}a=t({tag:n,packet:m})}else m=[];do{if(p){const y=await r.readByte();if(v=!1,y<192)c=y;else if(y>=192&&y<224)c=(y-192<<8)+await r.readByte()+192;else if(y>223&&y<255){if(c=1<<(31&y),v=!0,!d)throw new TypeError("This packet type does not support partial lengths.")}else c=await r.readByte()<<24|await r.readByte()<<16|await r.readByte()<<8|await r.readByte()}else switch(h){case 0:c=await r.readByte();break;case 1:c=await r.readByte()<<8|await r.readByte();break;case 2:c=await r.readByte()<<24|await r.readByte()<<16|await r.readByte()<<8|await r.readByte();break;default:c=1/0}if(c>0){let y=0;for(;;){i&&await i.ready;const{done:b,value:k}=await r.read();if(b){if(c===1/0)break;throw Error("Unexpected end of packet")}const O=c===1/0?k:k.subarray(0,c-y);if(i?await i.write(O):m.push(O),y+=k.length,y>=c){r.unshift(k.subarray(c-y+k.length));break}}}}while(v);const g=await r.peekBytes(d?1/0:2);return i?(await i.ready,await i.close()):(m=Pe.concatUint8Array(m),await t({tag:n,packet:m})),!g||!g.length}catch(s){if(i)return await i.abort(s),!0;throw s}finally{i&&await a,r.releaseLock()}}class kr extends Error{constructor(...t){super(...t),Error.captureStackTrace&&Error.captureStackTrace(this,kr),this.name="UnsupportedError"}}class dy{constructor(t,r){this.tag=t,this.rawContent=r}write(){return this.rawContent}}const V_=Pe.getWebCrypto(),dv=Pe.getNodeCrypto(),is={p256:"P-256",p384:"P-384",p521:"P-521"},ms=dv?dv.getCurves():[],Xs=dv?{secp256k1:ms.includes("secp256k1")?"secp256k1":void 0,p256:ms.includes("prime256v1")?"prime256v1":void 0,p384:ms.includes("secp384r1")?"secp384r1":void 0,p521:ms.includes("secp521r1")?"secp521r1":void 0,ed25519:ms.includes("ED25519")?"ED25519":void 0,curve25519:ms.includes("X25519")?"X25519":void 0,brainpoolP256r1:ms.includes("brainpoolP256r1")?"brainpoolP256r1":void 0,brainpoolP384r1:ms.includes("brainpoolP384r1")?"brainpoolP384r1":void 0,brainpoolP512r1:ms.includes("brainpoolP512r1")?"brainpoolP512r1":void 0}:{},Dp={p256:{oid:[6,8,42,134,72,206,61,3,1,7],keyType:he.publicKey.ecdsa,hash:he.hash.sha256,cipher:he.symmetric.aes128,node:Xs.p256,web:is.p256,payloadSize:32,sharedSize:256},p384:{oid:[6,5,43,129,4,0,34],keyType:he.publicKey.ecdsa,hash:he.hash.sha384,cipher:he.symmetric.aes192,node:Xs.p384,web:is.p384,payloadSize:48,sharedSize:384},p521:{oid:[6,5,43,129,4,0,35],keyType:he.publicKey.ecdsa,hash:he.hash.sha512,cipher:he.symmetric.aes256,node:Xs.p521,web:is.p521,payloadSize:66,sharedSize:528},secp256k1:{oid:[6,5,43,129,4,0,10],keyType:he.publicKey.ecdsa,hash:he.hash.sha256,cipher:he.symmetric.aes128,node:Xs.secp256k1,payloadSize:32},ed25519:{oid:[6,9,43,6,1,4,1,218,71,15,1],keyType:he.publicKey.eddsa,hash:he.hash.sha512,node:!1,payloadSize:32},curve25519:{oid:[6,10,43,6,1,4,1,151,85,1,5,1],keyType:he.publicKey.ecdh,hash:he.hash.sha256,cipher:he.symmetric.aes128,node:!1,payloadSize:32},brainpoolP256r1:{oid:[6,9,43,36,3,3,2,8,1,1,7],keyType:he.publicKey.ecdsa,hash:he.hash.sha256,cipher:he.symmetric.aes128,node:Xs.brainpoolP256r1,payloadSize:32},brainpoolP384r1:{oid:[6,9,43,36,3,3,2,8,1,1,11],keyType:he.publicKey.ecdsa,hash:he.hash.sha384,cipher:he.symmetric.aes192,node:Xs.brainpoolP384r1,payloadSize:48},brainpoolP512r1:{oid:[6,9,43,36,3,3,2,8,1,1,13],keyType:he.publicKey.ecdsa,hash:he.hash.sha512,cipher:he.symmetric.aes256,node:Xs.brainpoolP512r1,payloadSize:64}};class $s{constructor(t,r){try{(Pe.isArray(t)||Pe.isUint8Array(t))&&(t=new Ka(t)),t instanceof Ka&&(t=t.getName()),this.name=he.write(he.curve,t)}catch{throw new kr("Unknown curve")}r=r||Dp[this.name],this.keyType=r.keyType,this.oid=r.oid,this.hash=r.hash,this.cipher=r.cipher,this.node=r.node&&Dp[this.name],this.web=r.web&&Dp[this.name],this.payloadSize=r.payloadSize,this.web&&Pe.getWebCrypto()?this.type="web":this.node&&Pe.getNodeCrypto()?this.type="node":this.name==="curve25519"?this.type="curve25519":this.name==="ed25519"&&(this.type="ed25519")}async genKeyPair(){let t;switch(this.type){case"web":try{return await async function(i){const a=await V_.generateKey({name:"ECDSA",namedCurve:is[i]},!0,["sign","verify"]),s=await V_.exportKey("jwk",a.privateKey),u=await V_.exportKey("jwk",a.publicKey);return{publicKey:dD(u),privateKey:ws(s.d)}}(this.name)}catch(i){Pe.printDebugError("Browser did not support generating ec key "+i.message);break}case"node":return async function(i){const a=dv.createECDH(Xs[i]);return await a.generateKeys(),{publicKey:new Uint8Array(a.getPublicKey()),privateKey:new Uint8Array(a.getPrivateKey())}}(this.name);case"curve25519":{const i=rs(32);i[0]=127&i[0]|64,i[31]&=248;const a=i.slice().reverse();return t=ns.box.keyPair.fromSecretKey(a),{publicKey:Pe.concatUint8Array([new Uint8Array([64]),t.publicKey]),privateKey:i}}case"ed25519":{const i=rs(32),a=ns.sign.keyPair.fromSeed(i);return{publicKey:Pe.concatUint8Array([new Uint8Array([64]),a.publicKey]),privateKey:i}}}return t=await(await Ru(this.name)).genKeyPair({entropy:Pe.uint8ArrayToString(rs(32))}),{publicKey:new Uint8Array(t.getPublic("array",!1)),privateKey:t.getPrivate().toArrayLike(Uint8Array)}}}async function cD(e,t,r,i){const a={p256:!0,p384:!0,p521:!0,secp256k1:!0,curve25519:e===he.publicKey.ecdh,brainpoolP256r1:!0,brainpoolP384r1:!0,brainpoolP512r1:!0},s=t.getName();if(!a[s])return!1;if(s==="curve25519"){i=i.slice().reverse();const{publicKey:c}=ns.box.keyPair.fromSecretKey(i);r=new Uint8Array(r);const h=new Uint8Array([64,...c]);return!!Pe.equalsUint8Array(h,r)}const u=await Ru(s);try{r=nm(u,r).getPublic()}catch{return!1}return!!tm(u,i).getPublic().eq(r)}function dD(e){const t=ws(e.x),r=ws(e.y),i=new Uint8Array(t.length+r.length+1);return i[0]=4,i.set(t,1),i.set(r,t.length+1),i}function rm(e,t,r){const i=e,a=r.slice(1,i+1),s=r.slice(i+1,2*i+1);return{kty:"EC",crv:t,x:zi(a,!0),y:zi(s,!0),ext:!0}}function fD(e,t,r,i){const a=rm(e,t,r);return a.d=zi(i,!0),a}const fv=Pe.getWebCrypto(),Lu=Pe.getNodeCrypto();async function v5(e,t,r,i,a,s){const u=new $s(e);if(r&&!Pe.isStream(r)){const c={publicKey:i,privateKey:a};switch(u.type){case"web":try{return await async function(h,n,p,d){const v=h.payloadSize,m=fD(h.payloadSize,is[h.name],d.publicKey,d.privateKey),g=await fv.importKey("jwk",m,{name:"ECDSA",namedCurve:is[h.name],hash:{name:he.read(he.webHash,h.hash)}},!1,["sign"]),y=new Uint8Array(await fv.sign({name:"ECDSA",namedCurve:is[h.name],hash:{name:he.read(he.webHash,n)}},g,p));return{r:y.slice(0,v),s:y.slice(v,v<<1)}}(u,t,r,c)}catch(h){if(u.name!=="p521"&&(h.name==="DataError"||h.name==="OperationError"))throw h;Pe.printDebugError("Browser did not support signing: "+h.message)}break;case"node":{const h=await async function(n,p,d,v){const m=Lu.createSign(he.read(he.hash,p));m.write(d),m.end();const g=oV.encode({version:1,parameters:n.oid,privateKey:Array.from(v.privateKey),publicKey:{unused:0,data:Array.from(v.publicKey)}},"pem",{label:"EC PRIVATE KEY"});return hD.decode(m.sign(g),"der")}(u,t,r,c);return{r:h.r.toArrayLike(Uint8Array),s:h.s.toArrayLike(Uint8Array)}}}}return async function(c,h,n){const p=await Ru(c.name),d=tm(p,n),v=d.sign(h);return{r:v.r.toArrayLike(Uint8Array),s:v.s.toArrayLike(Uint8Array)}}(u,s,a)}async function m5(e,t,r,i,a,s){const u=new $s(e);if(i&&!Pe.isStream(i))switch(u.type){case"web":try{return await async function(c,h,{r:n,s:p},d,v){const m=rm(c.payloadSize,is[c.name],v),g=await fv.importKey("jwk",m,{name:"ECDSA",namedCurve:is[c.name],hash:{name:he.read(he.webHash,c.hash)}},!1,["verify"]),y=Pe.concatUint8Array([n,p]).buffer;return fv.verify({name:"ECDSA",namedCurve:is[c.name],hash:{name:he.read(he.webHash,h)}},g,y,d)}(u,t,r,i,a)}catch(c){if(u.name!=="p521"&&(c.name==="DataError"||c.name==="OperationError"))throw c;Pe.printDebugError("Browser did not support verifying: "+c.message)}break;case"node":return async function(c,h,{r:n,s:p},d,v){const{default:m}=await Cn(()=>import("./bn.min.a20d8e66.js"),[]),g=Lu.createVerify(he.read(he.hash,h));g.write(d),g.end();const y=uV.encode({algorithm:{algorithm:[1,2,840,10045,2,1],parameters:c.oid},subjectPublicKey:{unused:0,data:Array.from(v)}},"pem",{label:"PUBLIC KEY"}),b=hD.encode({r:new m(n),s:new m(p)},"der");try{return g.verify(y,b)}catch{return!1}}(u,t,r,i,a)}return async function(c,h,n,p){const d=await Ru(c.name);return nm(d,p).verify(n,h)}(u,r,t===void 0?i:s,a)}const im=void 0,hD=Lu?im.define("ECDSASignature",function(){this.seq().obj(this.key("r").int(),this.key("s").int())}):void 0,oV=Lu?im.define("ECPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").explicit(0).optional().any(),this.key("publicKey").explicit(1).optional().bitstr())}):void 0,lV=Lu?im.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional().any())}):void 0,uV=Lu?im.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(lV),this.key("subjectPublicKey").bitstr())}):void 0;var cV=Object.freeze({__proto__:null,sign:v5,verify:m5,validateParams:async function(e,t,r){const i=new $s(e);if(i.keyType!==he.publicKey.ecdsa)return!1;switch(i.type){case"web":case"node":{const a=rs(8),s=he.hash.sha256,u=await wu.digest(s,a);try{const c=await v5(e,s,a,t,r,u);return await m5(e,s,c,a,t,u)}catch{return!1}}default:return cD(he.publicKey.ecdsa,e,t,r)}}});ns.hash=e=>new Uint8Array(qv().update(e).digest());var dV=Object.freeze({__proto__:null,sign:async function(e,t,r,i,a,s){if(wu.getHashByteLength(t) =0;--p)for(let d=c-1;d>=0;--d)h[1]=c*p+(d+1),n[0]=s[0]^h[0],n[1]=s[1]^h[1],n[2]=u[2*d],n[3]=u[2*d+1],n=hv(r.decrypt(pv(n))),s=n.subarray(0,2),u[2*d]=n[2],u[2*d+1]=n[3];if(s[0]===i[0]&&s[1]===i[1])return pv(u);throw Error("Key Data Integrity failed")}function hv(e){const{length:t}=e,r=function(s){if(Pe.isString(s)){const{length:u}=s,c=new ArrayBuffer(u),h=new Uint8Array(c);for(let n=0;n0){const r=e[t-1];if(r>=1){const i=e.subarray(t-r),a=new Uint8Array(r).fill(r);if(Pe.equalsUint8Array(i,a))return e.subarray(0,t-r)}}throw Error("Invalid padding")}var hV=Object.freeze({__proto__:null,encode:mD,decode:_D});const no=Pe.getWebCrypto(),gD=Pe.getNodeCrypto();function _5(e,t,r,i){return Pe.concatUint8Array([t.write(),new Uint8Array([e]),r.write(),Pe.stringToUint8Array("Anonymous Sender "),i.subarray(0,20)])}async function g5(e,t,r,i,a=!1,s=!1){let u;if(a){for(u=0;u =0&&t[u]===0;u--);t=t.subarray(0,u+1)}return(await wu.digest(e,Pe.concatUint8Array([new Uint8Array([0,0,0,1]),t,i]))).subarray(0,r)}async function pV(e,t){switch(e.type){case"curve25519":{const r=rs(32),{secretKey:i,sharedKey:a}=await yD(e,t,null,r);let{publicKey:s}=ns.box.keyPair.fromSecretKey(i);return s=Pe.concatUint8Array([new Uint8Array([64]),s]),{publicKey:s,sharedKey:a}}case"web":if(e.web&&Pe.getWebCrypto())try{return await async function(r,i){const a=rm(r.payloadSize,r.web.web,i);let s=no.generateKey({name:"ECDH",namedCurve:r.web.web},!0,["deriveKey","deriveBits"]),u=no.importKey("jwk",a,{name:"ECDH",namedCurve:r.web.web},!1,[]);[s,u]=await Promise.all([s,u]);let c=no.deriveBits({name:"ECDH",namedCurve:r.web.web,public:u},s.privateKey,r.web.sharedSize),h=no.exportKey("jwk",s.publicKey);[c,h]=await Promise.all([c,h]);const n=new Uint8Array(c);return{publicKey:new Uint8Array(dD(h)),sharedKey:n}}(e,t)}catch(r){Pe.printDebugError(r)}break;case"node":return async function(r,i){const a=gD.createECDH(r.node.node);a.generateKeys();const s=new Uint8Array(a.computeSecret(i));return{publicKey:new Uint8Array(a.getPublicKey()),sharedKey:s}}(e,t)}return async function(r,i){const a=await Ru(r.name),s=await r.genKeyPair();i=nm(a,i);const u=tm(a,s.privateKey),c=s.publicKey,h=u.derive(i.getPublic()),n=a.curve.p.byteLength(),p=h.toArrayLike(Uint8Array,"be",n);return{publicKey:c,sharedKey:p}}(e,t)}async function yD(e,t,r,i){if(i.length!==e.payloadSize){const a=new Uint8Array(e.payloadSize);a.set(i,e.payloadSize-i.length),i=a}switch(e.type){case"curve25519":{const a=i.slice().reverse();return{secretKey:a,sharedKey:ns.scalarMult(a,t.subarray(1))}}case"web":if(e.web&&Pe.getWebCrypto())try{return await async function(a,s,u,c){const h=fD(a.payloadSize,a.web.web,u,c);let n=no.importKey("jwk",h,{name:"ECDH",namedCurve:a.web.web},!0,["deriveKey","deriveBits"]);const p=rm(a.payloadSize,a.web.web,s);let d=no.importKey("jwk",p,{name:"ECDH",namedCurve:a.web.web},!0,[]);[n,d]=await Promise.all([n,d]);let v=no.deriveBits({name:"ECDH",namedCurve:a.web.web,public:d},n,a.web.sharedSize),m=no.exportKey("jwk",n);[v,m]=await Promise.all([v,m]);const g=new Uint8Array(v);return{secretKey:ws(m.d),sharedKey:g}}(e,t,r,i)}catch(a){Pe.printDebugError(a)}break;case"node":return async function(a,s,u){const c=gD.createECDH(a.node.node);c.setPrivateKey(u);const h=new Uint8Array(c.computeSecret(s));return{secretKey:new Uint8Array(c.getPrivateKey()),sharedKey:h}}(e,t,i)}return async function(a,s,u){const c=await Ru(a.name);s=nm(c,s),u=tm(c,u);const h=new Uint8Array(u.getPrivate()),n=u.derive(s.getPublic()),p=c.curve.p.byteLength(),d=n.toArrayLike(Uint8Array,"be",p);return{secretKey:h,sharedKey:d}}(e,t,i)}var vV=Object.freeze({__proto__:null,validateParams:async function(e,t,r){return cD(he.publicKey.ecdh,e,t,r)},encrypt:async function(e,t,r,i,a){const s=mD(r),u=new $s(e),{publicKey:c,sharedKey:h}=await pV(u,i),n=_5(he.publicKey.ecdh,e,t,a),{keySize:p}=uo(t.cipher);return{publicKey:c,wrappedKey:pD(await g5(t.hash,h,p,n),s)}},decrypt:async function(e,t,r,i,a,s,u){const c=new $s(e),{sharedKey:h}=await yD(c,r,a,s),n=_5(he.publicKey.ecdh,e,t,u),{keySize:p}=uo(t.cipher);let d;for(let v=0;v<3;v++)try{return _D(vD(await g5(t.hash,h,p,n,v===1,v===2),i))}catch(m){d=m}throw d}}),mV=Object.freeze({__proto__:null,Curve:$s,ecdh:vV,ecdsa:cV,eddsa:dV,generate:async function(e){const t=await Pe.getBigInteger();e=new $s(e);const r=await e.genKeyPair(),i=new t(r.publicKey).toUint8Array(),a=new t(r.privateKey).toUint8Array("be",e.payloadSize);return{oid:e.oid,Q:i,secret:a,hash:e.hash,cipher:e.cipher}},getPreferredHashAlgo:function(e){return Dp[he.write(he.curve,e.toHex())].hash}}),_V=Object.freeze({__proto__:null,sign:async function(e,t,r,i,a,s){const u=await Pe.getBigInteger(),c=new u(1);let h,n,p,d;i=new u(i),a=new u(a),r=new u(r),s=new u(s),r=r.mod(i),s=s.mod(a);const v=new u(t.subarray(0,a.byteLength())).mod(a);for(;;){if(h=await Is(c,a),n=r.modExp(h,i).imod(a),n.isZero())continue;const m=s.mul(n).imod(a);if(d=v.add(m).imod(a),p=h.modInv(a).imul(d).imod(a),!p.isZero())break}return{r:n.toUint8Array("be",a.byteLength()),s:p.toUint8Array("be",a.byteLength())}},verify:async function(e,t,r,i,a,s,u,c){const h=await Pe.getBigInteger(),n=new h(0);if(t=new h(t),r=new h(r),s=new h(s),u=new h(u),a=new h(a),c=new h(c),t.lte(n)||t.gte(u)||r.lte(n)||r.gte(u))return Pe.printDebug("invalid DSA Signature"),!1;const p=new h(i.subarray(0,u.byteLength())).imod(u),d=r.modInv(u);if(d.isZero())return Pe.printDebug("invalid DSA Signature"),!1;a=a.mod(s),c=c.mod(s);const v=p.mul(d).imod(u),m=t.mul(d).imod(u),g=a.modExp(v,s),y=c.modExp(m,s);return g.mul(y).imod(s).imod(u).equal(t)},validateParams:async function(e,t,r,i,a){const s=await Pe.getBigInteger();e=new s(e),t=new s(t),r=new s(r),i=new s(i);const u=new s(1);if(r.lte(u)||r.gte(e)||!e.dec().mod(t).isZero()||!r.modExp(t,e).isOne())return!1;const c=new s(t.bitLength()),h=new s(150);if(c.lt(h)||!await sD(t,null,32))return!1;a=new s(a);const n=new s(2),p=await Is(n.leftShift(c.dec()),n.leftShift(c)),d=t.mul(p).add(a);return!!i.equal(r.modExp(d,e))}}),nr={rsa:rV,elgamal:iV,elliptic:mV,dsa:_V,nacl:ns},gV=Object.freeze({__proto__:null,parseSignatureParams:function(e,t){let r=0;switch(e){case he.publicKey.rsaEncryptSign:case he.publicKey.rsaEncrypt:case he.publicKey.rsaSign:return{s:Pe.readMPI(t.subarray(r))};case he.publicKey.dsa:case he.publicKey.ecdsa:{const i=Pe.readMPI(t.subarray(r));return r+=i.length+2,{r:i,s:Pe.readMPI(t.subarray(r))}}case he.publicKey.eddsa:{let i=Pe.readMPI(t.subarray(r));r+=i.length+2,i=Pe.leftPad(i,32);let a=Pe.readMPI(t.subarray(r));return a=Pe.leftPad(a,32),{r:i,s:a}}default:throw new kr("Unknown signature algorithm.")}},verify:async function(e,t,r,i,a,s){switch(e){case he.publicKey.rsaEncryptSign:case he.publicKey.rsaEncrypt:case he.publicKey.rsaSign:{const{n:u,e:c}=i,h=Pe.leftPad(r.s,u.length);return nr.rsa.verify(t,a,h,u,c,s)}case he.publicKey.dsa:{const{g:u,p:c,q:h,y:n}=i,{r:p,s:d}=r;return nr.dsa.verify(t,p,d,s,u,c,h,n)}case he.publicKey.ecdsa:{const{oid:u,Q:c}=i,h=new nr.elliptic.Curve(u).payloadSize,n=Pe.leftPad(r.r,h),p=Pe.leftPad(r.s,h);return nr.elliptic.ecdsa.verify(u,t,{r:n,s:p},a,c,s)}case he.publicKey.eddsa:{const{oid:u,Q:c}=i;return nr.elliptic.eddsa.verify(u,t,r,a,c,s)}default:throw Error("Unknown signature algorithm.")}},sign:async function(e,t,r,i,a,s){if(!r||!i)throw Error("Missing key parameters");switch(e){case he.publicKey.rsaEncryptSign:case he.publicKey.rsaEncrypt:case he.publicKey.rsaSign:{const{n:u,e:c}=r,{d:h,p:n,q:p,u:d}=i;return{s:await nr.rsa.sign(t,a,u,c,h,n,p,d,s)}}case he.publicKey.dsa:{const{g:u,p:c,q:h}=r,{x:n}=i;return nr.dsa.sign(t,s,u,c,h,n)}case he.publicKey.elgamal:throw Error("Signing with Elgamal is not defined in the OpenPGP standard.");case he.publicKey.ecdsa:{const{oid:u,Q:c}=r,{d:h}=i;return nr.elliptic.ecdsa.sign(u,t,a,c,h,s)}case he.publicKey.eddsa:{const{oid:u,Q:c}=r,{seed:h}=i;return nr.elliptic.eddsa.sign(u,t,a,c,h,s)}default:throw Error("Unknown signature algorithm.")}}});class y5{constructor(t){t=t===void 0?new Uint8Array([]):Pe.isString(t)?Pe.stringToUint8Array(t):new Uint8Array(t),this.data=t}read(t){if(t.length>=1){const r=t[0];if(t.length>=1+r)return this.data=t.subarray(1,1+r),1+this.data.length}throw Error("Invalid symmetric key")}write(){return Pe.concatUint8Array([new Uint8Array([this.data.length]),this.data])}}class b5{constructor(t){if(t){const{hash:r,cipher:i}=t;this.hash=r,this.cipher=i}else this.hash=null,this.cipher=null}read(t){if(t.length<4||t[0]!==3||t[1]!==1)throw Error("Cannot read KDFParams");return this.hash=t[2],this.cipher=t[3],4}write(){return new Uint8Array([3,1,this.hash,this.cipher])}}function W_(e){try{e.getName()}catch{throw new kr("Unknown curve OID")}}var yV=Object.freeze({__proto__:null,publicKeyEncrypt:async function(e,t,r,i){switch(e){case he.publicKey.rsaEncrypt:case he.publicKey.rsaEncryptSign:{const{n:a,e:s}=t;return{c:await nr.rsa.encrypt(r,a,s)}}case he.publicKey.elgamal:{const{p:a,g:s,y:u}=t;return nr.elgamal.encrypt(r,a,s,u)}case he.publicKey.ecdh:{const{oid:a,Q:s,kdfParams:u}=t,{publicKey:c,wrappedKey:h}=await nr.elliptic.ecdh.encrypt(a,u,r,s,i);return{V:c,C:new y5(h)}}default:return[]}},publicKeyDecrypt:async function(e,t,r,i,a,s){switch(e){case he.publicKey.rsaEncryptSign:case he.publicKey.rsaEncrypt:{const{c:u}=i,{n:c,e:h}=t,{d:n,p,q:d,u:v}=r;return nr.rsa.decrypt(u,c,h,n,p,d,v,s)}case he.publicKey.elgamal:{const{c1:u,c2:c}=i,h=t.p,n=r.x;return nr.elgamal.decrypt(u,c,h,n,s)}case he.publicKey.ecdh:{const{oid:u,Q:c,kdfParams:h}=t,{d:n}=r,{V:p,C:d}=i;return nr.elliptic.ecdh.decrypt(u,h,p,d.data,c,n,a)}default:throw Error("Unknown public key encryption algorithm.")}},parsePublicKeyParams:function(e,t){let r=0;switch(e){case he.publicKey.rsaEncrypt:case he.publicKey.rsaEncryptSign:case he.publicKey.rsaSign:{const i=Pe.readMPI(t.subarray(r));r+=i.length+2;const a=Pe.readMPI(t.subarray(r));return r+=a.length+2,{read:r,publicParams:{n:i,e:a}}}case he.publicKey.dsa:{const i=Pe.readMPI(t.subarray(r));r+=i.length+2;const a=Pe.readMPI(t.subarray(r));r+=a.length+2;const s=Pe.readMPI(t.subarray(r));r+=s.length+2;const u=Pe.readMPI(t.subarray(r));return r+=u.length+2,{read:r,publicParams:{p:i,q:a,g:s,y:u}}}case he.publicKey.elgamal:{const i=Pe.readMPI(t.subarray(r));r+=i.length+2;const a=Pe.readMPI(t.subarray(r));r+=a.length+2;const s=Pe.readMPI(t.subarray(r));return r+=s.length+2,{read:r,publicParams:{p:i,g:a,y:s}}}case he.publicKey.ecdsa:{const i=new Ka;r+=i.read(t),W_(i);const a=Pe.readMPI(t.subarray(r));return r+=a.length+2,{read:r,publicParams:{oid:i,Q:a}}}case he.publicKey.eddsa:{const i=new Ka;r+=i.read(t),W_(i);let a=Pe.readMPI(t.subarray(r));return r+=a.length+2,a=Pe.leftPad(a,33),{read:r,publicParams:{oid:i,Q:a}}}case he.publicKey.ecdh:{const i=new Ka;r+=i.read(t),W_(i);const a=Pe.readMPI(t.subarray(r));r+=a.length+2;const s=new b5;return r+=s.read(t.subarray(r)),{read:r,publicParams:{oid:i,Q:a,kdfParams:s}}}default:throw new kr("Unknown public key encryption algorithm.")}},parsePrivateKeyParams:function(e,t,r){let i=0;switch(e){case he.publicKey.rsaEncrypt:case he.publicKey.rsaEncryptSign:case he.publicKey.rsaSign:{const a=Pe.readMPI(t.subarray(i));i+=a.length+2;const s=Pe.readMPI(t.subarray(i));i+=s.length+2;const u=Pe.readMPI(t.subarray(i));i+=u.length+2;const c=Pe.readMPI(t.subarray(i));return i+=c.length+2,{read:i,privateParams:{d:a,p:s,q:u,u:c}}}case he.publicKey.dsa:case he.publicKey.elgamal:{const a=Pe.readMPI(t.subarray(i));return i+=a.length+2,{read:i,privateParams:{x:a}}}case he.publicKey.ecdsa:case he.publicKey.ecdh:{const a=new $s(r.oid);let s=Pe.readMPI(t.subarray(i));return i+=s.length+2,s=Pe.leftPad(s,a.payloadSize),{read:i,privateParams:{d:s}}}case he.publicKey.eddsa:{const a=new $s(r.oid);let s=Pe.readMPI(t.subarray(i));return i+=s.length+2,s=Pe.leftPad(s,a.payloadSize),{read:i,privateParams:{seed:s}}}default:throw new kr("Unknown public key encryption algorithm.")}},parseEncSessionKeyParams:function(e,t){let r=0;switch(e){case he.publicKey.rsaEncrypt:case he.publicKey.rsaEncryptSign:return{c:Pe.readMPI(t.subarray(r))};case he.publicKey.elgamal:{const i=Pe.readMPI(t.subarray(r));return r+=i.length+2,{c1:i,c2:Pe.readMPI(t.subarray(r))}}case he.publicKey.ecdh:{const i=Pe.readMPI(t.subarray(r));r+=i.length+2;const a=new y5;return a.read(t.subarray(r)),{V:i,C:a}}default:throw new kr("Unknown public key encryption algorithm.")}},serializeParams:function(e,t){const r=Object.keys(t).map(i=>{const a=t[i];return Pe.isUint8Array(a)?Pe.uint8ArrayToMPI(a):a.write()});return Pe.concatUint8Array(r)},generateParams:function(e,t,r){switch(e){case he.publicKey.rsaEncrypt:case he.publicKey.rsaEncryptSign:case he.publicKey.rsaSign:return nr.rsa.generate(t,65537).then(({n:i,e:a,d:s,p:u,q:c,u:h})=>({privateParams:{d:s,p:u,q:c,u:h},publicParams:{n:i,e:a}}));case he.publicKey.ecdsa:return nr.elliptic.generate(r).then(({oid:i,Q:a,secret:s})=>({privateParams:{d:s},publicParams:{oid:new Ka(i),Q:a}}));case he.publicKey.eddsa:return nr.elliptic.generate(r).then(({oid:i,Q:a,secret:s})=>({privateParams:{seed:s},publicParams:{oid:new Ka(i),Q:a}}));case he.publicKey.ecdh:return nr.elliptic.generate(r).then(({oid:i,Q:a,secret:s,hash:u,cipher:c})=>({privateParams:{d:s},publicParams:{oid:new Ka(i),Q:a,kdfParams:new b5({hash:u,cipher:c})}}));case he.publicKey.dsa:case he.publicKey.elgamal:throw Error("Unsupported algorithm for key generation.");default:throw Error("Unknown public key algorithm.")}},validateParams:async function(e,t,r){if(!t||!r)throw Error("Missing key parameters");switch(e){case he.publicKey.rsaEncrypt:case he.publicKey.rsaEncryptSign:case he.publicKey.rsaSign:{const{n:i,e:a}=t,{d:s,p:u,q:c,u:h}=r;return nr.rsa.validateParams(i,a,s,u,c,h)}case he.publicKey.dsa:{const{p:i,q:a,g:s,y:u}=t,{x:c}=r;return nr.dsa.validateParams(i,a,s,u,c)}case he.publicKey.elgamal:{const{p:i,g:a,y:s}=t,{x:u}=r;return nr.elgamal.validateParams(i,a,s,u)}case he.publicKey.ecdsa:case he.publicKey.ecdh:{const i=nr.elliptic[he.read(he.publicKey,e)],{oid:a,Q:s}=t,{d:u}=r;return i.validateParams(a,s,u)}case he.publicKey.eddsa:{const{oid:i,Q:a}=t,{seed:s}=r;return nr.elliptic.eddsa.validateParams(i,a,s)}default:throw Error("Unknown public key algorithm.")}},getPrefixRandom:async function(e){const{blockSize:t}=uo(e),r=await rs(t),i=new Uint8Array([r[r.length-2],r[r.length-1]]);return Pe.concat([r,i])},generateSessionKey:function(e){const{keySize:t}=uo(e);return rs(t)},getAEADMode:function(e){const t=he.read(he.aead,e);return aD[t]},getCipher:uo});const Kt={cipher:Ad,hash:wu,mode:aD,publicKey:nr,signature:gV,random:eV,pkcs1:nV,pkcs5:hV,aesKW:fV};Object.assign(Kt,yV);var Id=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Int32Array!="undefined";function bD(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)}const wD={arraySet:function(e,t,r,i,a){if(t.subarray&&e.subarray)e.set(t.subarray(r,r+i),a);else for(let s=0;s=0;)e[t]=0}const SV=0,DD=1,kV=2,Z0=29,$d=256,dd=$d+1+Z0,hu=30,Q0=19,S5=2*dd+1,Zo=15,K_=16,EV=7,q0=256,OD=16,PD=17,TD=18,hy=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],Op=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],DV=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],k5=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],bs=Array(2*(dd+2));Nu(bs);const qc=Array(2*hu);Nu(qc);const fd=Array(512);Nu(fd);const hd=Array(256);Nu(hd);const eb=Array(Z0);Nu(eb);const mv=Array(hu);function H_(e,t,r,i,a){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=i,this.max_length=a,this.has_stree=e&&e.length}let E5,D5,O5;function G_(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function AD(e){return e<256?fd[e]:fd[256+(e>>>7)]}function pd(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function Di(e,t,r){e.bi_valid>K_-r?(e.bi_buf|=t< >K_-e.bi_valid,e.bi_valid+=r-K_):(e.bi_buf|=t< >>=1,r<<=1;while(--t>0);return r>>>1}function ID(e,t,r){const i=Array(Zo+1);let a,s,u=0;for(a=1;a<=Zo;a++)i[a]=u=u+r[a-1]<<1;for(s=0;s<=t;s++){const c=e[2*s+1];c!==0&&(e[2*s]=MD(i[c]++,c))}}function $D(e){let t;for(t=0;t 8?pd(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function P5(e,t,r,i){const a=2*t,s=2*r;return e[a] >1;u>=1;u--)Y_(e,r,u);h=s;do u=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Y_(e,r,1),c=e.heap[1],e.heap[--e.heap_max]=u,e.heap[--e.heap_max]=c,r[2*h]=r[2*u]+r[2*c],e.depth[h]=(e.depth[u]>=e.depth[c]?e.depth[u]:e.depth[c])+1,r[2*u+1]=r[2*c+1]=h,e.heap[1]=h++,Y_(e,r,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],function(p,d){const v=d.dyn_tree,m=d.max_code,g=d.stat_desc.static_tree,y=d.stat_desc.has_stree,b=d.stat_desc.extra_bits,k=d.stat_desc.extra_base,O=d.stat_desc.max_length;let S,x,E,w,T,M,A=0;for(w=0;w<=Zo;w++)p.bl_count[w]=0;for(v[2*p.heap[p.heap_max]+1]=0,S=p.heap_max+1;S O&&(w=O,A++),v[2*x+1]=w,x>m||(p.bl_count[w]++,T=0,x>=k&&(T=b[x-k]),M=v[2*x],p.opt_len+=M*(w+T),y&&(p.static_len+=M*(g[2*x+1]+T)));if(A!==0){do{for(w=O-1;p.bl_count[w]===0;)w--;p.bl_count[w]--,p.bl_count[w+1]+=2,p.bl_count[O]--,A-=2}while(A>0);for(w=O;w!==0;w--)for(x=p.bl_count[w];x!==0;)E=p.heap[--S],E>m||(v[2*E+1]!==w&&(p.opt_len+=(w-v[2*E+1])*v[2*E],v[2*E+1]=w),x--)}}(e,t),ID(r,n,e.bl_count)}function A5(e,t,r){let i,a,s=-1,u=t[1],c=0,h=7,n=4;for(u===0&&(h=138,n=3),t[2*(r+1)+1]=65535,i=0;i<=r;i++)a=u,u=t[2*(i+1)+1],++c >=7;a =8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}(e)}function TV(e,t,r,i){let a,s,u=0;e.level>0?(e.strm.data_type===ED&&(e.strm.data_type=function(c){let h,n=4093624447;for(h=0;h<=31;h++,n>>>=1)if(1&n&&c.dyn_ltree[2*h]!==0)return C5;if(c.dyn_ltree[18]!==0||c.dyn_ltree[20]!==0||c.dyn_ltree[26]!==0)return x5;for(h=32;h<$d;h++)if(c.dyn_ltree[2*h]!==0)return x5;return C5}(e)),X_(e,e.l_desc),X_(e,e.d_desc),u=function(c){let h;for(A5(c,c.dyn_ltree,c.l_desc.max_code),A5(c,c.dyn_dtree,c.d_desc.max_code),X_(c,c.bl_desc),h=Q0-1;h>=3&&c.bl_tree[2*k5[h]+1]===0;h--);return c.opt_len+=3*(h+1)+5+5+4,h}(e),a=e.opt_len+3+7>>>3,s=e.static_len+3+7>>>3,s<=a&&(a=s)):a=s=r+5,r+4<=a&&t!==-1?LD(e,t,r,i):e.strategy===kD||s===a?(Di(e,(DD<<1)+(i?1:0),3),T5(e,bs,qc)):(Di(e,(kV<<1)+(i?1:0),3),function(c,h,n,p){let d;for(Di(c,h-257,5),Di(c,n-1,5),Di(c,p-4,4),d=0;d >>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,t===0?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(hd[r]+$d+1)]++,e.dyn_dtree[2*AD(t)]++),e.last_lit===e.lit_bufsize-1}function vd(e,t,r,i){let a=65535&e|0,s=e>>>16&65535|0,u=0;for(;r!==0;){u=r>2e3?2e3:r,r-=u;do a=a+t[i++]|0,s=s+a|0;while(--u);a%=65521,s%=65521}return a|s<<16|0}const AV=function(){let e;const t=[];for(let r=0;r<256;r++){e=r;for(let i=0;i<8;i++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}();function Tr(e,t,r,i){const a=AV,s=i+r;e^=-1;for(let u=i;u
>>8^a[255&(e^t[u])];return-1^e}var md={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"};const MV=9,Mn=3,ro=258,ga=ro+Mn+1,IV=32,_v=42,py=69,Pp=73,Tp=91,Ap=103,Qo=113,Uc=666,Ar=1,ed=2,qo=3,pu=4,$V=3;function io(e,t){return e.msg=md[t],t}function $5(e){return(e<<1)-(e>4?9:0)}function qs(e){let t=e.length;for(;--t>=0;)e[t]=0}function Js(e){const t=e.state;let r=t.pending;r>e.avail_out&&(r=e.avail_out),r!==0&&(as(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,t.pending===0&&(t.pending_out=0))}function Vr(e,t){TV(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,Js(e.strm)}function Ln(e,t){e.pending_buf[e.pending++]=t}function Dc(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function RV(e,t,r,i){let a=e.avail_in;return a>i&&(a=i),a===0?0:(e.avail_in-=a,as(t,e.input,e.next_in,a,r),e.state.wrap===1?e.adler=vd(e.adler,t,a,r):e.state.wrap===2&&(e.adler=Tr(e.adler,t,a,r)),e.next_in+=a,e.total_in+=a,a)}function ND(e,t){let r,i,a=e.max_chain_length,s=e.strstart,u=e.prev_length,c=e.nice_match;const h=e.strstart>e.w_size-ga?e.strstart-(e.w_size-ga):0,n=e.window,p=e.w_mask,d=e.prev,v=e.strstart+ro;let m=n[s+u-1],g=n[s+u];e.prev_length>=e.good_match&&(a>>=2),c>e.lookahead&&(c=e.lookahead);do if(r=t,n[r+u]===g&&n[r+u-1]===m&&n[r]===n[s]&&n[++r]===n[s+1]){s+=2,r++;do;while(n[++s]===n[++r]&&n[++s]===n[++r]&&n[++s]===n[++r]&&n[++s]===n[++r]&&n[++s]===n[++r]&&n[++s]===n[++r]&&n[++s]===n[++r]&&n[++s]===n[++r]&&su){if(e.match_start=t,u=i,i>=c)break;m=n[s+u-1],g=n[s+u]}}while((t=d[t&p])>h&&--a!=0);return u<=e.lookahead?u:e.lookahead}function pl(e){const t=e.w_size;let r,i,a,s,u;do{if(s=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-ga)){as(e.window,e.window,t,t,0),e.match_start-=t,e.strstart-=t,e.block_start-=t,i=e.hash_size,r=i;do a=e.head[--r],e.head[r]=a>=t?a-t:0;while(--i);i=t,r=i;do a=e.prev[--r],e.prev[r]=a>=t?a-t:0;while(--i);s+=t}if(e.strm.avail_in===0)break;if(i=RV(e.strm,e.window,e.strstart+e.lookahead,s),e.lookahead+=i,e.lookahead+e.insert>=Mn)for(u=e.strstart-e.insert,e.ins_h=e.window[u],e.ins_h=(e.ins_h< =Mn&&(e.ins_h=(e.ins_h< =Mn)if(i=co(e,e.strstart-e.match_start,e.match_length-Mn),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=Mn){e.match_length--;do e.strstart++,e.ins_h=(e.ins_h< =Mn&&(e.ins_h=(e.ins_h< 4096)&&(e.match_length=Mn-1)),e.prev_length>=Mn&&e.match_length<=e.prev_length){a=e.strstart+e.lookahead-Mn,i=co(e,e.strstart-1-e.prev_match,e.prev_length-Mn),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=a&&(e.ins_h=(e.ins_h< e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(pl(e),e.lookahead===0&&t===ss)return Ar;if(e.lookahead===0)break}e.strstart+=e.lookahead,e.lookahead=0;const i=e.block_start+r;if((e.strstart===0||e.strstart>=i)&&(e.lookahead=e.strstart-i,e.strstart=i,Vr(e,!1),e.strm.avail_out===0)||e.strstart-e.block_start>=e.w_size-ga&&(Vr(e,!1),e.strm.avail_out===0))return Ar}return e.insert=0,t===Ir?(Vr(e,!0),e.strm.avail_out===0?qo:pu):(e.strstart>e.block_start&&(Vr(e,!1),e.strm.avail_out),Ar)}),new Ba(4,4,8,4,J_),new Ba(4,5,16,8,J_),new Ba(4,6,32,32,J_),new Ba(4,4,16,16,Jl),new Ba(8,16,32,32,Jl),new Ba(8,16,128,128,Jl),new Ba(8,32,128,256,Jl),new Ba(32,128,258,1024,Jl),new Ba(32,258,258,4096,Jl)];class LV{constructor(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Cu,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new ia(1146),this.dyn_dtree=new ia(122),this.bl_tree=new ia(78),qs(this.dyn_ltree),qs(this.dyn_dtree),qs(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new ia(16),this.heap=new ia(573),qs(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new ia(573),qs(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}}function NV(e){const t=function(r){let i;return r&&r.state?(r.total_in=r.total_out=0,r.data_type=ED,i=r.state,i.pending=0,i.pending_out=0,i.wrap<0&&(i.wrap=-i.wrap),i.status=i.wrap?_v:Qo,r.adler=i.wrap===2?0:1,i.last_flush=ss,OV(i),Vn):io(r,br)}(e);return t===Vn&&function(r){r.window_size=2*r.w_size,qs(r.head),r.max_lazy_match=Vc[r.level].max_lazy,r.good_match=Vc[r.level].good_length,r.nice_match=Vc[r.level].nice_length,r.max_chain_length=Vc[r.level].max_chain,r.strstart=0,r.block_start=0,r.lookahead=0,r.insert=0,r.match_length=r.prev_length=Mn-1,r.match_available=0,r.ins_h=0}(e.state),t}function BV(e,t){let r,i,a,s;if(!e||!e.state||t>fy||t<0)return e?io(e,br):br;if(i=e.state,!e.output||!e.input&&e.avail_in!==0||i.status===Uc&&t!==Ir)return io(e,e.avail_out===0?Qc:br);if(i.strm=e,r=i.last_flush,i.last_flush=t,i.status===_v)if(i.wrap===2)e.adler=0,Ln(i,31),Ln(i,139),Ln(i,8),i.gzhead?(Ln(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),Ln(i,255&i.gzhead.time),Ln(i,i.gzhead.time>>8&255),Ln(i,i.gzhead.time>>16&255),Ln(i,i.gzhead.time>>24&255),Ln(i,i.level===9?2:i.strategy>=Jh||i.level<2?4:0),Ln(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(Ln(i,255&i.gzhead.extra.length),Ln(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(e.adler=Tr(e.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=py):(Ln(i,0),Ln(i,0),Ln(i,0),Ln(i,0),Ln(i,0),Ln(i,i.level===9?2:i.strategy>=Jh||i.level<2?4:0),Ln(i,$V),i.status=Qo);else{let c=Cu+(i.w_bits-8<<4)<<8,h=-1;h=i.strategy>=Jh||i.level<2?0:i.level<6?1:i.level===6?2:3,c|=h<<6,i.strstart!==0&&(c|=IV),c+=31-c%31,i.status=Qo,Dc(i,c),i.strstart!==0&&(Dc(i,e.adler>>>16),Dc(i,65535&e.adler)),e.adler=1}if(i.status===py)if(i.gzhead.extra){for(a=i.pending;i.gzindex<(65535&i.gzhead.extra.length)&&(i.pending!==i.pending_buf_size||(i.gzhead.hcrc&&i.pending>a&&(e.adler=Tr(e.adler,i.pending_buf,i.pending-a,a)),Js(e),a=i.pending,i.pending!==i.pending_buf_size));)Ln(i,255&i.gzhead.extra[i.gzindex]),i.gzindex++;i.gzhead.hcrc&&i.pending>a&&(e.adler=Tr(e.adler,i.pending_buf,i.pending-a,a)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=Pp)}else i.status=Pp;if(i.status===Pp)if(i.gzhead.name){a=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>a&&(e.adler=Tr(e.adler,i.pending_buf,i.pending-a,a)),Js(e),a=i.pending,i.pending===i.pending_buf_size)){s=1;break}s=i.gzindex a&&(e.adler=Tr(e.adler,i.pending_buf,i.pending-a,a)),s===0&&(i.gzindex=0,i.status=Tp)}else i.status=Tp;if(i.status===Tp)if(i.gzhead.comment){a=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>a&&(e.adler=Tr(e.adler,i.pending_buf,i.pending-a,a)),Js(e),a=i.pending,i.pending===i.pending_buf_size)){s=1;break}s=i.gzindex a&&(e.adler=Tr(e.adler,i.pending_buf,i.pending-a,a)),s===0&&(i.status=Ap)}else i.status=Ap;if(i.status===Ap&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&Js(e),i.pending+2<=i.pending_buf_size&&(Ln(i,255&e.adler),Ln(i,e.adler>>8&255),e.adler=0,i.status=Qo)):i.status=Qo),i.pending!==0){if(Js(e),e.avail_out===0)return i.last_flush=-1,Vn}else if(e.avail_in===0&&$5(t)<=$5(r)&&t!==Ir)return io(e,Qc);if(i.status===Uc&&e.avail_in!==0)return io(e,Qc);if(e.avail_in!==0||i.lookahead!==0||t!==ss&&i.status!==Uc){var u=i.strategy===Jh?function(c,h){let n;for(;;){if(c.lookahead===0&&(pl(c),c.lookahead===0)){if(h===ss)return Ar;break}if(c.match_length=0,n=co(c,0,c.window[c.strstart]),c.lookahead--,c.strstart++,n&&(Vr(c,!1),c.strm.avail_out===0))return Ar}return c.insert=0,h===Ir?(Vr(c,!0),c.strm.avail_out===0?qo:pu):c.last_lit&&(Vr(c,!1),c.strm.avail_out===0)?Ar:ed}(i,t):i.strategy===xV?function(c,h){let n,p,d,v;const m=c.window;for(;;){if(c.lookahead<=ro){if(pl(c),c.lookahead<=ro&&h===ss)return Ar;if(c.lookahead===0)break}if(c.match_length=0,c.lookahead>=Mn&&c.strstart>0&&(d=c.strstart-1,p=m[d],p===m[++d]&&p===m[++d]&&p===m[++d])){v=c.strstart+ro;do;while(p===m[++d]&&p===m[++d]&&p===m[++d]&&p===m[++d]&&p===m[++d]&&p===m[++d]&&p===m[++d]&&p===m[++d]&&d c.lookahead&&(c.match_length=c.lookahead)}if(c.match_length>=Mn?(n=co(c,1,c.match_length-Mn),c.lookahead-=c.match_length,c.strstart+=c.match_length,c.match_length=0):(n=co(c,0,c.window[c.strstart]),c.lookahead--,c.strstart++),n&&(Vr(c,!1),c.strm.avail_out===0))return Ar}return c.insert=0,h===Ir?(Vr(c,!0),c.strm.avail_out===0?qo:pu):c.last_lit&&(Vr(c,!1),c.strm.avail_out===0)?Ar:ed}(i,t):Vc[i.level].func(i,t);if(u!==qo&&u!==pu||(i.status=Uc),u===Ar||u===qo)return e.avail_out===0&&(i.last_flush=-1),Vn;if(u===ed&&(t===bV?PV(i):t!==fy&&(LD(i,0,0,!1),t===wV&&(qs(i.head),i.lookahead===0&&(i.strstart=0,i.block_start=0,i.insert=0))),Js(e),e.avail_out===0))return i.last_flush=-1,Vn}return t!==Ir?Vn:i.wrap<=0?Os:(i.wrap===2?(Ln(i,255&e.adler),Ln(i,e.adler>>8&255),Ln(i,e.adler>>16&255),Ln(i,e.adler>>24&255),Ln(i,255&e.total_in),Ln(i,e.total_in>>8&255),Ln(i,e.total_in>>16&255),Ln(i,e.total_in>>24&255)):(Dc(i,e.adler>>>16),Dc(i,65535&e.adler)),Js(e),i.wrap>0&&(i.wrap=-i.wrap),i.pending!==0?Vn:Os)}try{String.fromCharCode.call(null,0)}catch{}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{}const vy=new qa(256);for(let e=0;e<256;e++)vy[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;function my(e){let t,r,i,a,s=0;const u=e.length;for(i=0;i>>6,c[a++]=128|63&t):t<65536?(c[a++]=224|t>>>12,c[a++]=128|t>>>6&63,c[a++]=128|63&t):(c[a++]=240|t>>>18,c[a++]=128|t>>>12&63,c[a++]=128|t>>>6&63,c[a++]=128|63&t);return c}vy[254]=vy[254]=1;class BD{constructor(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}}class _y{constructor(t){this.options={level:w5,method:Cu,chunkSize:16384,windowBits:15,memLevel:8,strategy:0,...t||{}};const r=this.options;r.raw&&r.windowBits>0?r.windowBits=-r.windowBits:r.gzip&&r.windowBits>0&&r.windowBits<16&&(r.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new BD,this.strm.avail_out=0;var i,a,s=function(u,c,h,n,p,d){if(!u)return br;let v=1;if(c===w5&&(c=6),n<0?(v=0,n=-n):n>15&&(v=2,n-=16),p<1||p>MV||h!==Cu||n<8||n>15||c<0||c>9||d<0||d>kD)return io(u,br);n===8&&(n=9);const m=new LV;return u.state=m,m.strm=u,m.wrap=v,m.gzhead=null,m.w_bits=n,m.w_size=1< =n.w_size&&(v===0&&(qs(n.head),n.strstart=0,n.block_start=0,n.insert=0),b=new qa(n.w_size),as(b,h,k-n.w_size,n.w_size,0),h=b,k=n.w_size),m=c.avail_in,g=c.next_in,y=c.input,c.avail_in=k,c.next_in=0,c.input=h,pl(n);n.lookahead>=Mn;){p=n.strstart,d=n.lookahead-(Mn-1);do n.ins_h=(n.ins_h< 0||i.avail_out===0)&&s!==Os);return u===Ir?(s=function(c){let h;return c&&c.state?(h=c.state.status,h!==_v&&h!==py&&h!==Pp&&h!==Tp&&h!==Ap&&h!==Qo&&h!==Uc?io(c,br):(c.state=null,h===Qo?io(c,J0):Vn)):br}(this.strm),this.onEnd(s),this.ended=!0,s===Vn):u!==cd||(this.onEnd(Vn),i.avail_out=0,!0)}onData(t){this.chunks.push(t)}onEnd(t){t===Vn&&(this.result=xD(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg}}const Zh=30,FV=12;function zV(e,t){let r,i,a,s,u,c,h,n,p,d;const v=e.state;r=e.next_in;const m=e.input,g=r+(e.avail_in-5);i=e.next_out;const y=e.output,b=i-(t-e.avail_out),k=i+(e.avail_out-257),O=v.dmax,S=v.wsize,x=v.whave,E=v.wnext,w=v.window;a=v.hold,s=v.bits;const T=v.lencode,M=v.distcode,A=(1< >>24,a>>>=c,s-=c,c=u>>>16&255,c===0)y[i++]=65535&u;else{if(!(16&c)){if((64&c)==0){u=T[(65535&u)+(a&(1< >>=c,s-=c),s<15&&(a+=m[r++]< >>24,a>>>=c,s-=c,c=u>>>16&255,!(16&c)){if((64&c)==0){u=M[(65535&u)+(a&(1<O){e.msg="invalid distance too far back",v.mode=Zh;break e}if(a>>>=c,s-=c,c=i-b,n>c){if(c=n-c,c>x&&v.sane){e.msg="invalid distance too far back",v.mode=Zh;break e}if(p=0,d=w,E===0){if(p+=S-c,c 2;)y[i++]=d[p++],y[i++]=d[p++],y[i++]=d[p++],h-=3;h&&(y[i++]=d[p++],h>1&&(y[i++]=d[p++]))}else{p=i-n;do y[i++]=y[p++],y[i++]=y[p++],y[i++]=y[p++],h-=3;while(h>2);h&&(y[i++]=y[p++],h>1&&(y[i++]=y[p++]))}break}}break}}while(r >3,r-=h,s-=h<<3,a&=(1< =1&&L[k]===0;k--);if(O>k&&(O=k),k===0)return a[s++]=20971520,a[s++]=20971520,c.bits=1,0;for(b=1;b0&&(e===N5||k!==1))return-1;for(Y[1]=0,g=1;g R5||e===B5&&w>L5)return 1;for(;;){N=g-x,u[y] m?(W=ue[Te+u[y]],j=M[A+u[y]]):(W=96,j=0),n=1< >x)+p]=N<<24|W<<16|j|0;while(p!==0);for(n=1< >=1;if(n!==0?(T&=n-1,T+=n):T=0,y++,--L[g]==0){if(g===k)break;g=t[r+u[y]]}if(g>O&&(T&pe)!==d){for(x===0&&(x=O),v+=b,S=g-x,E=1< R5||e===B5&&w>L5)return 1;d=T&pe,a[d]=O<<24|S<<16|v-s|0}}return T!==0&&(a[v+T]=g-x<<24|64<<16|0),c.bits=O,0}const KV=0,FD=1,zD=2,jD=1,F5=2,z5=3,j5=4,U5=5,V5=6,W5=7,K5=8,H5=9,G5=10,gv=11,_s=12,Q_=13,Y5=14,q_=15,X5=16,J5=17,Z5=18,Q5=19,Qh=20,qh=21,q5=22,ek=23,tk=24,nk=25,rk=26,eg=27,ik=28,ak=29,lr=30,HV=852,GV=592;function sk(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}class YV{constructor(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new ia(320),this.work=new ia(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}}function XV(e){let t;return e&&e.state?(t=e.state,t.wsize=0,t.whave=0,t.wnext=0,function(r){let i;return r&&r.state?(i=r.state,r.total_in=r.total_out=i.total=0,r.msg="",i.wrap&&(r.adler=1&i.wrap),i.mode=jD,i.last=0,i.havedict=0,i.dmax=32768,i.head=null,i.hold=0,i.bits=0,i.lencode=i.lendyn=new vv(HV),i.distcode=i.distdyn=new vv(GV),i.sane=1,i.back=-1,Vn):br}(e)):br}function JV(e,t){let r,i;return e?(i=new YV,e.state=i,i.window=null,r=function(a,s){let u,c;return a&&a.state?(c=a.state,s<0?(u=0,s=-s):(u=1+(s>>4),s<48&&(s&=15)),s&&(s<8||s>15)?br:(c.window!==null&&c.wbits!==s&&(c.window=null),c.wrap=u,c.wbits=s,XV(a))):br}(e,t),r!==Vn&&(e.state=null),r):br}let tg,ng,ok=!0;function ZV(e){if(ok){let t;for(tg=new vv(512),ng=new vv(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(td(FD,e.lens,0,288,tg,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;td(zD,e.lens,0,32,ng,0,e.work,{bits:5}),ok=!1}e.lencode=tg,e.lenbits=9,e.distcode=ng,e.distbits=5}function UD(e,t,r,i){let a;const s=e.state;return s.window===null&&(s.wsize=1<=s.wsize?(as(s.window,t,r-s.wsize,s.wsize,0),s.wnext=0,s.whave=s.wsize):(a=s.wsize-s.wnext,a>i&&(a=i),as(s.window,t,r-i,a,s.wnext),(i-=a)?(as(s.window,t,r-i,i,0),s.wnext=i,s.whave=s.wsize):(s.wnext+=a,s.wnext===s.wsize&&(s.wnext=0),s.whave >>8&255,r.check=Tr(r.check,Y,2,0),n=0,p=0,r.mode=F5;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&n)<<8)+(n>>8))%31){e.msg="incorrect header check",r.mode=lr;break}if((15&n)!==Cu){e.msg="unknown compression method",r.mode=lr;break}if(n>>>=4,p-=4,w=8+(15&n),r.wbits===0)r.wbits=w;else if(w>r.wbits){e.msg="invalid window size",r.mode=lr;break}r.dmax=1< >8&1),512&r.flags&&(Y[0]=255&n,Y[1]=n>>>8&255,r.check=Tr(r.check,Y,2,0)),n=0,p=0,r.mode=z5;case z5:for(;p<32;){if(c===0)break e;c--,n+=i[s++]< >>8&255,Y[2]=n>>>16&255,Y[3]=n>>>24&255,r.check=Tr(r.check,Y,4,0)),n=0,p=0,r.mode=j5;case j5:for(;p<16;){if(c===0)break e;c--,n+=i[s++]<
>8),512&r.flags&&(Y[0]=255&n,Y[1]=n>>>8&255,r.check=Tr(r.check,Y,2,0)),n=0,p=0,r.mode=U5;case U5:if(1024&r.flags){for(;p<16;){if(c===0)break e;c--,n+=i[s++]<
>>8&255,r.check=Tr(r.check,Y,2,0)),n=0,p=0}else r.head&&(r.head.extra=null);r.mode=V5;case V5:if(1024&r.flags&&(m=r.length,m>c&&(m=c),m&&(r.head&&(w=r.head.extra_len-r.length,r.head.extra||(r.head.extra=Array(r.head.extra_len)),as(r.head.extra,i,s,m,w)),512&r.flags&&(r.check=Tr(r.check,i,m,s)),c-=m,s+=m,r.length-=m),r.length))break e;r.length=0,r.mode=W5;case W5:if(2048&r.flags){if(c===0)break e;m=0;do w=i[s+m++],r.head&&w&&r.length<65536&&(r.head.name+=String.fromCharCode(w));while(w&&m
>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=_s;break;case G5:for(;p<32;){if(c===0)break e;c--,n+=i[s++]< >>=7&p,p-=7&p,r.mode=eg;break}for(;p<3;){if(c===0)break e;c--,n+=i[s++]<
>>=1,p-=1,3&n){case 0:r.mode=Y5;break;case 1:if(ZV(r),r.mode=Qh,t===Xh){n>>>=2,p-=2;break e}break;case 2:r.mode=J5;break;case 3:e.msg="invalid block type",r.mode=lr}n>>>=2,p-=2;break;case Y5:for(n>>>=7&p,p-=7&p;p<32;){if(c===0)break e;c--,n+=i[s++]<
>>16^65535)){e.msg="invalid stored block lengths",r.mode=lr;break}if(r.length=65535&n,n=0,p=0,r.mode=q_,t===Xh)break e;case q_:r.mode=X5;case X5:if(m=r.length,m){if(m>c&&(m=c),m>h&&(m=h),m===0)break e;as(a,i,s,m,u),c-=m,s+=m,h-=m,u+=m,r.length-=m;break}r.mode=_s;break;case J5:for(;p<14;){if(c===0)break e;c--,n+=i[s++]<
>>=5,p-=5,r.ndist=1+(31&n),n>>>=5,p-=5,r.ncode=4+(15&n),n>>>=4,p-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=lr;break}r.have=0,r.mode=Z5;case Z5:for(;r.have
>>=3,p-=3}for(;r.have<19;)r.lens[N[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,M={bits:r.lenbits},T=td(KV,r.lens,0,19,r.lencode,0,r.work,M),r.lenbits=M.bits,T){e.msg="invalid code lengths set",r.mode=lr;break}r.have=0,r.mode=Q5;case Q5:for(;r.have >>24,k=L>>>16&255,O=65535&L,!(b<=p);){if(c===0)break e;c--,n+=i[s++]< >>=b,p-=b,r.lens[r.have++]=O;else{if(O===16){for(A=b+2;p>>=b,p-=b,r.have===0){e.msg="invalid bit length repeat",r.mode=lr;break}w=r.lens[r.have-1],m=3+(3&n),n>>>=2,p-=2}else if(O===17){for(A=b+3;p>>=b,p-=b,w=0,m=3+(7&n),n>>>=3,p-=3}else{for(A=b+7;p>>=b,p-=b,w=0,m=11+(127&n),n>>>=7,p-=7}if(r.have+m>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=lr;break}for(;m--;)r.lens[r.have++]=w}}if(r.mode===lr)break;if(r.lens[256]===0){e.msg="invalid code -- missing end-of-block",r.mode=lr;break}if(r.lenbits=9,M={bits:r.lenbits},T=td(FD,r.lens,0,r.nlen,r.lencode,0,r.work,M),r.lenbits=M.bits,T){e.msg="invalid literal/lengths set",r.mode=lr;break}if(r.distbits=6,r.distcode=r.distdyn,M={bits:r.distbits},T=td(zD,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,M),r.distbits=M.bits,T){e.msg="invalid distances set",r.mode=lr;break}if(r.mode=Qh,t===Xh)break e;case Qh:r.mode=qh;case qh:if(c>=6&&h>=258){e.next_out=u,e.avail_out=h,e.next_in=s,e.avail_in=c,r.hold=n,r.bits=p,zV(e,v),u=e.next_out,a=e.output,h=e.avail_out,s=e.next_in,i=e.input,c=e.avail_in,n=r.hold,p=r.bits,r.mode===_s&&(r.back=-1);break}for(r.back=0;L=r.lencode[n&(1<
>>24,k=L>>>16&255,O=65535&L,!(b<=p);){if(c===0)break e;c--,n+=i[s++]< >S)],b=L>>>24,k=L>>>16&255,O=65535&L,!(S+b<=p);){if(c===0)break e;c--,n+=i[s++]<
>>=S,p-=S,r.back+=S}if(n>>>=b,p-=b,r.back+=b,r.length=O,k===0){r.mode=rk;break}if(32&k){r.back=-1,r.mode=_s;break}if(64&k){e.msg="invalid literal/length code",r.mode=lr;break}r.extra=15&k,r.mode=q5;case q5:if(r.extra){for(A=r.extra;p>>=r.extra,p-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=ek;case ek:for(;L=r.distcode[n&(1<
>>24,k=L>>>16&255,O=65535&L,!(b<=p);){if(c===0)break e;c--,n+=i[s++]< >S)],b=L>>>24,k=L>>>16&255,O=65535&L,!(S+b<=p);){if(c===0)break e;c--,n+=i[s++]<
>>=S,p-=S,r.back+=S}if(n>>>=b,p-=b,r.back+=b,64&k){e.msg="invalid distance code",r.mode=lr;break}r.offset=O,r.extra=15&k,r.mode=tk;case tk:if(r.extra){for(A=r.extra;p>>=r.extra,p-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=lr;break}r.mode=nk;case nk:if(h===0)break e;if(m=v-h,r.offset>m){if(m=r.offset-m,m>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=lr;break}m>r.wnext?(m-=r.wnext,g=r.wsize-m):g=r.wnext-m,m>r.length&&(m=r.length),y=r.window}else y=a,g=u-r.offset,m=r.length;m>h&&(m=h),h-=m,r.length-=m;do a[u++]=y[g++];while(--m);r.length===0&&(r.mode=qh);break;case rk:if(h===0)break e;a[u++]=r.length,h--,r.mode=qh;break;case eg:if(r.wrap){for(;p<32;){if(c===0)break e;c--,n|=i[s++]<
=0&&r.windowBits<16&&(r.windowBits=-r.windowBits,r.windowBits===0&&(r.windowBits=-15)),!(r.windowBits>=0&&r.windowBits<16)||t&&t.windowBits||(r.windowBits+=32),r.windowBits>15&&r.windowBits<48&&(15&r.windowBits)==0&&(r.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new BD,this.strm.avail_out=0;let i=JV(this.strm,r.windowBits);if(i!==Vn||(this.header=new qV,function(a,s){let u;a&&a.state&&(u=a.state,(2&u.wrap)==0||(u.head=s,s.done=!1))}(this.strm,this.header),r.dictionary&&(typeof r.dictionary=="string"?r.dictionary=my(r.dictionary):r.dictionary instanceof ArrayBuffer&&(r.dictionary=new Uint8Array(r.dictionary)),r.raw&&(i=lk(this.strm,r.dictionary),i!==Vn))))throw Error(md[i])}push(t,r){const{strm:i,options:{chunkSize:a,dictionary:s}}=this;let u,c,h=!1;if(this.ended)return!1;c=r===~~r?r:r===!0?Ir:ss,typeof t=="string"?i.input=function(n){const p=new qa(n.length);for(let d=0,v=p.length;d
0||i.avail_out===0)&&u!==Os);return u===Os&&(c=Ir),c===Ir?(u=function(n){if(!n||!n.state)return br;const p=n.state;return p.window&&(p.window=null),n.state=null,Vn}(this.strm),this.onEnd(u),this.ended=!0,u===Vn):c!==cd||(this.onEnd(Vn),i.avail_out=0,!0)}onData(t){this.chunks.push(t)}onEnd(t){t===Vn&&(this.result=xD(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg}}var ck=[0,1,3,7,15,31,63,127,255],Wc=function(e){this.stream=e,this.bitOffset=0,this.curByte=0,this.hasByte=!1};Wc.prototype._ensureByte=function(){this.hasByte||(this.curByte=this.stream.readByte(),this.hasByte=!0)},Wc.prototype.read=function(e){for(var t=0;e>0;){this._ensureByte();var r=8-this.bitOffset;if(e>=r)t<<=r,t|=ck[r]&this.curByte,this.hasByte=!1,this.bitOffset=0,e-=r;else{t<<=e;var i=r-e;t|=(this.curByte&ck[e]<>i,this.bitOffset+=e,e=0}}return t},Wc.prototype.seek=function(e){var t=e%8,r=(e-t)/8;this.bitOffset=t,this.stream.seek(r),this.hasByte=!1},Wc.prototype.pi=function(){var e,t=new Uint8Array(6);for(e=0;e ("00"+i.toString(16)).slice(-2)).join("")}(t)};var eW=Wc,Vo=function(){};Vo.prototype.readByte=function(){throw Error("abstract method readByte() not implemented")},Vo.prototype.read=function(e,t,r){for(var i=0;i >>0},this.updateCRC=function(t){e=e<<8^rg[255&(e>>>24^t)]},this.updateCRCRun=function(t,r){for(;r-- >0;)e=e<<8^rg[255&(e>>>24^t)]}}),dk=function(e,t){var r,i=e[t];for(r=t;r>0;r--)e[r]=e[r-1];return e[0]=i,i},ur={OK:0,LAST_BLOCK:-1,NOT_BZIP_DATA:-2,UNEXPECTED_INPUT_EOF:-3,UNEXPECTED_OUTPUT_EOF:-4,DATA_ERROR:-5,OUT_OF_MEMORY:-6,OBSOLETE_INPUT:-7,END_OF_BLOCK:-8},Zs={};Zs[ur.LAST_BLOCK]="Bad file checksum",Zs[ur.NOT_BZIP_DATA]="Not bzip data",Zs[ur.UNEXPECTED_INPUT_EOF]="Unexpected input EOF",Zs[ur.UNEXPECTED_OUTPUT_EOF]="Unexpected output EOF",Zs[ur.DATA_ERROR]="Data error",Zs[ur.OUT_OF_MEMORY]="Out of memory",Zs[ur.OBSOLETE_INPUT]="Obsolete (pre 0.9.5) bzip format not supported.";var zr=function(e,t){var r=Zs[e]||"unknown error";t&&(r+=": "+t);var i=new TypeError(r);throw i.errorCode=e,i},Kc=function(e,t){this.writePos=this.writeCurrent=this.writeCount=0,this._start_bunzip(e,t)};Kc.prototype._init_block=function(){return this._get_next_block()?(this.blockCRC=new tW,!0):(this.writeCount=-1,!1)},Kc.prototype._start_bunzip=function(e,t){var r=new Uint8Array(4);e.read(r,0,4)===4&&String.fromCharCode(r[0],r[1],r[2])==="BZh"||zr(ur.NOT_BZIP_DATA,"bad magic");var i=r[3]-48;(i<1||i>9)&&zr(ur.NOT_BZIP_DATA,"level out of range"),this.reader=new eW(e),this.dbufSize=1e5*i,this.nextoutput=0,this.outputStream=t,this.streamCRC=0},Kc.prototype._get_next_block=function(){var e,t,r,i=this.reader,a=i.pi();if(a==="177245385090")return!1;a!=="314159265359"&&zr(ur.NOT_BZIP_DATA),this.targetBlockCRC=i.read(32)>>>0,this.streamCRC=(this.targetBlockCRC^(this.streamCRC<<1|this.streamCRC>>>31))>>>0,i.read(1)&&zr(ur.OBSOLETE_INPUT);var s=i.read(24);s>this.dbufSize&&zr(ur.DATA_ERROR,"initial position out of bounds");var u=i.read(16),c=new Uint8Array(256),h=0;for(e=0;e<16;e++)if(u&1<<15-e){var n=16*e;for(r=i.read(16),t=0;t<16;t++)r&1<<15-t&&(c[h++]=n+t)}var p=i.read(3);(p<2||p>6)&&zr(ur.DATA_ERROR);var d=i.read(15);d===0&&zr(ur.DATA_ERROR);var v=new Uint8Array(256);for(e=0;e =p&&zr(ur.DATA_ERROR);m[e]=dk(v,t)}var g,y=h+2,b=[];for(t=0;t
20)&&zr(ur.DATA_ERROR),i.read(1);)i.read(1)?u--:u++;S[e]=u}for(k=O=S[0],e=1;e
O?O=S[e]:S[e] =d&&zr(ur.DATA_ERROR),g=b[m[L++]]),e=g.minLen,t=i.read(e);e>g.maxLen&&zr(ur.DATA_ERROR),!(t<=g.limit[e]);e++)t=t<<1|i.read(1);((t-=g.base[e])<0||t>=258)&&zr(ur.DATA_ERROR);var N=g.permute[t];if(N!==0&&N!==1){if(M)for(M=0,A+u>this.dbufSize&&zr(ur.DATA_ERROR),w[T=c[v[0]]]+=u;u--;)Y[A++]=T;if(N>h)break;A>=this.dbufSize&&zr(ur.DATA_ERROR),w[T=c[T=dk(v,e=N-1)]]++,Y[A++]=T}else M||(M=1,u=0),u+=N===0?M:2*M,M<<=1}for((s<0||s>=A)&&zr(ur.DATA_ERROR),t=0,e=0;e<256;e++)r=t+w[e],w[e]=t,t=r;for(e=0;e>=8,ue=-1),this.writePos=W,this.writeCurrent=j,this.writeCount=A,this.writeRun=ue,!0},Kc.prototype._read_bunzip=function(e,t){var r,i,a;if(this.writeCount<0)return 0;var s=this.dbuf,u=this.writePos,c=this.writeCurrent,h=this.writeCount;this.outputsize;for(var n=this.writeRun;h;){for(h--,i=c,c=255&(u=s[u]),u>>=8,n++==3?(r=c,a=i,c=-1):(r=1,a=c),this.blockCRC.updateCRCRun(a,r);r--;)this.outputStream.writeByte(a),this.nextoutput++;c!=i&&(n=0)}return this.writeCount=h,this.blockCRC.getCRC()!==this.targetBlockCRC&&zr(ur.DATA_ERROR,"Bad block CRC (got "+this.blockCRC.getCRC().toString(16)+" expected "+this.targetBlockCRC.toString(16)+")"),this.nextoutput};var nW=function(e){if("readByte"in e)return e;var t=new VD;return t.pos=0,t.readByte=function(){return e[this.pos++]},t.seek=function(r){this.pos=r},t.eof=function(){return this.pos>=e.length},t},rW=function(e){var t=new VD,r=!0;if(e)if(typeof e=="number")t.buffer=new Uint8Array(e),r=!1;else{if("writeByte"in e)return e;t.buffer=e,r=!1}else t.buffer=new Uint8Array(16384);return t.pos=0,t.writeByte=function(i){if(r&&this.pos>=this.buffer.length){var a=new Uint8Array(2*this.buffer.length);a.set(this.buffer),this.buffer=a}this.buffer[this.pos++]=i},t.getBuffer=function(){if(this.pos!==this.buffer.length){if(!r)throw new TypeError("outputsize does not match decoded input");var i=new Uint8Array(this.pos);i.set(this.buffer.subarray(0,this.pos)),this.buffer=i}return this.buffer},t._coerced=!0,t},fk=function(e,t,r){for(var i=nW(e),a=rW(t),s=new Kc(i,a);!("eof"in i)||!i.eof();)if(s._init_block())s._read_bunzip();else{var u=s.reader.read(32)>>>0;if(u!==s.streamCRC&&zr(ur.DATA_ERROR,"Bad stream CRC (got "+s.streamCRC.toString(16)+" expected "+u.toString(16)+")"),!r||!("eof"in i)||i.eof())break;s._start_bunzip(i,a)}if("getBuffer"in a)return a.getBuffer()};class Bu{static get tag(){return he.packet.literalData}constructor(t=new Date){this.format=he.literal.utf8,this.date=Pe.normalizeDate(t),this.text=null,this.data=null,this.filename=""}setText(t,r=he.literal.utf8){this.format=r,this.text=t,this.data=null}getText(t=!1){return(this.text===null||Pe.isStream(this.text))&&(this.text=Pe.decodeUTF8(Pe.nativeEOL(this.getBytes(t)))),this.text}setBytes(t,r){this.format=r,this.data=t,this.text=null}getBytes(t=!1){return this.data===null&&(this.data=Pe.canonicalizeEOL(Pe.encodeUTF8(this.text))),t?cu(this.data):this.data}setFilename(t){this.filename=t}getFilename(){return this.filename}async read(t){await Jv(t,async r=>{const i=await r.readByte(),a=await r.readByte();this.filename=Pe.decodeUTF8(await r.readBytes(a)),this.date=Pe.readDate(await r.readBytes(4));let s=r.remainder();mr(s)&&(s=await gr(s)),this.setBytes(s,i)})}writeHeader(){const t=Pe.encodeUTF8(this.filename),r=new Uint8Array([t.length]),i=new Uint8Array([this.format]),a=Pe.writeDate(this.date);return Pe.concatUint8Array([i,r,t,a])}write(){const t=this.writeHeader(),r=this.getBytes();return Pe.concat([t,r])}}const Oc=Symbol("verified"),iW=new Set([he.signatureSubpacket.issuer,he.signatureSubpacket.issuerFingerprint,he.signatureSubpacket.embeddedSignature]);class Hr{static get tag(){return he.packet.signature}constructor(){this.version=null,this.signatureType=null,this.hashAlgorithm=null,this.publicKeyAlgorithm=null,this.signatureData=null,this.unhashedSubpackets=[],this.signedHashValue=null,this.created=null,this.signatureExpirationTime=null,this.signatureNeverExpires=!0,this.exportable=null,this.trustLevel=null,this.trustAmount=null,this.regularExpression=null,this.revocable=null,this.keyExpirationTime=null,this.keyNeverExpires=null,this.preferredSymmetricAlgorithms=null,this.revocationKeyClass=null,this.revocationKeyAlgorithm=null,this.revocationKeyFingerprint=null,this.issuerKeyID=new mo,this.rawNotations=[],this.notations={},this.preferredHashAlgorithms=null,this.preferredCompressionAlgorithms=null,this.keyServerPreferences=null,this.preferredKeyServer=null,this.isPrimaryUserID=null,this.policyURI=null,this.keyFlags=null,this.signersUserID=null,this.reasonForRevocationFlag=null,this.reasonForRevocationString=null,this.features=null,this.signatureTargetPublicKeyAlgorithm=null,this.signatureTargetHashAlgorithm=null,this.signatureTargetHash=null,this.embeddedSignature=null,this.issuerKeyVersion=null,this.issuerFingerprint=null,this.preferredAEADAlgorithms=null,this.revoked=null,this[Oc]=null}read(t){let r=0;if(this.version=t[r++],this.version!==4&&this.version!==5)throw new kr(`Version ${this.version} of the signature packet is unsupported.`);if(this.signatureType=t[r++],this.publicKeyAlgorithm=t[r++],this.hashAlgorithm=t[r++],r+=this.readSubPackets(t.subarray(r,t.length),!0),!this.created)throw Error("Missing signature creation time subpacket.");this.signatureData=t.subarray(0,r),r+=this.readSubPackets(t.subarray(r,t.length),!1),this.signedHashValue=t.subarray(r,r+2),r+=2,this.params=Kt.signature.parseSignatureParams(this.publicKeyAlgorithm,t.subarray(r,t.length))}writeParams(){return this.params instanceof Promise?wo(async()=>Kt.serializeParams(this.publicKeyAlgorithm,await this.params)):Kt.serializeParams(this.publicKeyAlgorithm,this.params)}write(){const t=[];return t.push(this.signatureData),t.push(this.writeUnhashedSubPackets()),t.push(this.signedHashValue),t.push(this.writeParams()),Pe.concat(t)}async sign(t,r,i=new Date,a=!1){t.version===5?this.version=5:this.version=4;const s=[new Uint8Array([this.version,this.signatureType,this.publicKeyAlgorithm,this.hashAlgorithm])];this.created=Pe.normalizeDate(i),this.issuerKeyVersion=t.version,this.issuerFingerprint=t.getFingerprintBytes(),this.issuerKeyID=t.getKeyID(),s.push(this.writeHashedSubPackets()),this.unhashedSubpackets=[],this.signatureData=Pe.concat(s);const u=this.toHash(this.signatureType,r,a),c=await this.hash(this.signatureType,r,u,a);this.signedHashValue=Wr(hl(c),0,2);const h=async()=>Kt.signature.sign(this.publicKeyAlgorithm,this.hashAlgorithm,t.publicParams,t.privateParams,u,await gr(c));Pe.isStream(c)?this.params=h():(this.params=await h(),this[Oc]=!0)}writeHashedSubPackets(){const t=he.signatureSubpacket,r=[];let i;if(this.created===null)throw Error("Missing signature creation time");r.push(tr(t.signatureCreationTime,!0,Pe.writeDate(this.created))),this.signatureExpirationTime!==null&&r.push(tr(t.signatureExpirationTime,!0,Pe.writeNumber(this.signatureExpirationTime,4))),this.exportable!==null&&r.push(tr(t.exportableCertification,!0,new Uint8Array([this.exportable?1:0]))),this.trustLevel!==null&&(i=new Uint8Array([this.trustLevel,this.trustAmount]),r.push(tr(t.trustSignature,!0,i))),this.regularExpression!==null&&r.push(tr(t.regularExpression,!0,this.regularExpression)),this.revocable!==null&&r.push(tr(t.revocable,!0,new Uint8Array([this.revocable?1:0]))),this.keyExpirationTime!==null&&r.push(tr(t.keyExpirationTime,!0,Pe.writeNumber(this.keyExpirationTime,4))),this.preferredSymmetricAlgorithms!==null&&(i=Pe.stringToUint8Array(Pe.uint8ArrayToString(this.preferredSymmetricAlgorithms)),r.push(tr(t.preferredSymmetricAlgorithms,!1,i))),this.revocationKeyClass!==null&&(i=new Uint8Array([this.revocationKeyClass,this.revocationKeyAlgorithm]),i=Pe.concat([i,this.revocationKeyFingerprint]),r.push(tr(t.revocationKey,!1,i))),this.issuerKeyID.isNull()||this.issuerKeyVersion===5||r.push(tr(t.issuer,!0,this.issuerKeyID.write())),this.rawNotations.forEach(({name:u,value:c,humanReadable:h,critical:n})=>{i=[new Uint8Array([h?128:0,0,0,0])];const p=Pe.encodeUTF8(u);i.push(Pe.writeNumber(p.length,2)),i.push(Pe.writeNumber(c.length,2)),i.push(p),i.push(c),i=Pe.concat(i),r.push(tr(t.notationData,n,i))}),this.preferredHashAlgorithms!==null&&(i=Pe.stringToUint8Array(Pe.uint8ArrayToString(this.preferredHashAlgorithms)),r.push(tr(t.preferredHashAlgorithms,!1,i))),this.preferredCompressionAlgorithms!==null&&(i=Pe.stringToUint8Array(Pe.uint8ArrayToString(this.preferredCompressionAlgorithms)),r.push(tr(t.preferredCompressionAlgorithms,!1,i))),this.keyServerPreferences!==null&&(i=Pe.stringToUint8Array(Pe.uint8ArrayToString(this.keyServerPreferences)),r.push(tr(t.keyServerPreferences,!1,i))),this.preferredKeyServer!==null&&r.push(tr(t.preferredKeyServer,!1,Pe.encodeUTF8(this.preferredKeyServer))),this.isPrimaryUserID!==null&&r.push(tr(t.primaryUserID,!1,new Uint8Array([this.isPrimaryUserID?1:0]))),this.policyURI!==null&&r.push(tr(t.policyURI,!1,Pe.encodeUTF8(this.policyURI))),this.keyFlags!==null&&(i=Pe.stringToUint8Array(Pe.uint8ArrayToString(this.keyFlags)),r.push(tr(t.keyFlags,!0,i))),this.signersUserID!==null&&r.push(tr(t.signersUserID,!1,Pe.encodeUTF8(this.signersUserID))),this.reasonForRevocationFlag!==null&&(i=Pe.stringToUint8Array(String.fromCharCode(this.reasonForRevocationFlag)+this.reasonForRevocationString),r.push(tr(t.reasonForRevocation,!0,i))),this.features!==null&&(i=Pe.stringToUint8Array(Pe.uint8ArrayToString(this.features)),r.push(tr(t.features,!1,i))),this.signatureTargetPublicKeyAlgorithm!==null&&(i=[new Uint8Array([this.signatureTargetPublicKeyAlgorithm,this.signatureTargetHashAlgorithm])],i.push(Pe.stringToUint8Array(this.signatureTargetHash)),i=Pe.concat(i),r.push(tr(t.signatureTarget,!0,i))),this.embeddedSignature!==null&&r.push(tr(t.embeddedSignature,!0,this.embeddedSignature.write())),this.issuerFingerprint!==null&&(i=[new Uint8Array([this.issuerKeyVersion]),this.issuerFingerprint],i=Pe.concat(i),r.push(tr(t.issuerFingerprint,this.version===5,i))),this.preferredAEADAlgorithms!==null&&(i=Pe.stringToUint8Array(Pe.uint8ArrayToString(this.preferredAEADAlgorithms)),r.push(tr(t.preferredAEADAlgorithms,!1,i)));const a=Pe.concat(r),s=Pe.writeNumber(a.length,2);return Pe.concat([s,a])}writeUnhashedSubPackets(){const t=[];this.unhashedSubpackets.forEach(a=>{t.push(Md(a.length)),t.push(a)});const r=Pe.concat(t),i=Pe.writeNumber(r.length,2);return Pe.concat([i,r])}readSubPacket(t,r=!0){let i=0;const a=!!(128&t[i]),s=127&t[i];if(r||(this.unhashedSubpackets.push(t.subarray(i,t.length)),iW.has(s)))switch(i++,s){case he.signatureSubpacket.signatureCreationTime:this.created=Pe.readDate(t.subarray(i,t.length));break;case he.signatureSubpacket.signatureExpirationTime:{const u=Pe.readNumber(t.subarray(i,t.length));this.signatureNeverExpires=u===0,this.signatureExpirationTime=u;break}case he.signatureSubpacket.exportableCertification:this.exportable=t[i++]===1;break;case he.signatureSubpacket.trustSignature:this.trustLevel=t[i++],this.trustAmount=t[i++];break;case he.signatureSubpacket.regularExpression:this.regularExpression=t[i];break;case he.signatureSubpacket.revocable:this.revocable=t[i++]===1;break;case he.signatureSubpacket.keyExpirationTime:{const u=Pe.readNumber(t.subarray(i,t.length));this.keyExpirationTime=u,this.keyNeverExpires=u===0;break}case he.signatureSubpacket.preferredSymmetricAlgorithms:this.preferredSymmetricAlgorithms=[...t.subarray(i,t.length)];break;case he.signatureSubpacket.revocationKey:this.revocationKeyClass=t[i++],this.revocationKeyAlgorithm=t[i++],this.revocationKeyFingerprint=t.subarray(i,i+20);break;case he.signatureSubpacket.issuer:this.issuerKeyID.read(t.subarray(i,t.length));break;case he.signatureSubpacket.notationData:{const u=!!(128&t[i]);i+=4;const c=Pe.readNumber(t.subarray(i,i+2));i+=2;const h=Pe.readNumber(t.subarray(i,i+2));i+=2;const n=Pe.decodeUTF8(t.subarray(i,i+c)),p=t.subarray(i+c,i+c+h);this.rawNotations.push({name:n,humanReadable:u,value:p,critical:a}),u&&(this.notations[n]=Pe.decodeUTF8(p));break}case he.signatureSubpacket.preferredHashAlgorithms:this.preferredHashAlgorithms=[...t.subarray(i,t.length)];break;case he.signatureSubpacket.preferredCompressionAlgorithms:this.preferredCompressionAlgorithms=[...t.subarray(i,t.length)];break;case he.signatureSubpacket.keyServerPreferences:this.keyServerPreferences=[...t.subarray(i,t.length)];break;case he.signatureSubpacket.preferredKeyServer:this.preferredKeyServer=Pe.decodeUTF8(t.subarray(i,t.length));break;case he.signatureSubpacket.primaryUserID:this.isPrimaryUserID=t[i++]!==0;break;case he.signatureSubpacket.policyURI:this.policyURI=Pe.decodeUTF8(t.subarray(i,t.length));break;case he.signatureSubpacket.keyFlags:this.keyFlags=[...t.subarray(i,t.length)];break;case he.signatureSubpacket.signersUserID:this.signersUserID=Pe.decodeUTF8(t.subarray(i,t.length));break;case he.signatureSubpacket.reasonForRevocation:this.reasonForRevocationFlag=t[i++],this.reasonForRevocationString=Pe.decodeUTF8(t.subarray(i,t.length));break;case he.signatureSubpacket.features:this.features=[...t.subarray(i,t.length)];break;case he.signatureSubpacket.signatureTarget:{this.signatureTargetPublicKeyAlgorithm=t[i++],this.signatureTargetHashAlgorithm=t[i++];const u=Kt.getHashByteLength(this.signatureTargetHashAlgorithm);this.signatureTargetHash=Pe.uint8ArrayToString(t.subarray(i,i+u));break}case he.signatureSubpacket.embeddedSignature:this.embeddedSignature=new Hr,this.embeddedSignature.read(t.subarray(i,t.length));break;case he.signatureSubpacket.issuerFingerprint:this.issuerKeyVersion=t[i++],this.issuerFingerprint=t.subarray(i,t.length),this.issuerKeyVersion===5?this.issuerKeyID.read(this.issuerFingerprint):this.issuerKeyID.read(this.issuerFingerprint.subarray(-8));break;case he.signatureSubpacket.preferredAEADAlgorithms:this.preferredAEADAlgorithms=[...t.subarray(i,t.length)];break;default:{const u=Error("Unknown signature subpacket type "+s);if(a)throw u;Pe.printDebug(u)}}}readSubPackets(t,r=!0,i){const a=Pe.readNumber(t.subarray(0,2));let s=2;for(;s<2+a;){const u=lD(t.subarray(s,t.length));s+=u.offset,this.readSubPacket(t.subarray(s,s+u.len),r,i),s+=u.len}return s}toSign(t,r){const i=he.signature;switch(t){case i.binary:return r.text!==null?Pe.encodeUTF8(r.getText(!0)):r.getBytes(!0);case i.text:{const a=r.getBytes(!0);return Pe.canonicalizeEOL(a)}case i.standalone:return new Uint8Array(0);case i.certGeneric:case i.certPersona:case i.certCasual:case i.certPositive:case i.certRevocation:{let a,s;if(r.userID)s=180,a=r.userID;else{if(!r.userAttribute)throw Error("Either a userID or userAttribute packet needs to be supplied for certification.");s=209,a=r.userAttribute}const u=a.write();return Pe.concat([this.toSign(i.key,r),new Uint8Array([s]),Pe.writeNumber(u.length,4),u])}case i.subkeyBinding:case i.subkeyRevocation:case i.keyBinding:return Pe.concat([this.toSign(i.key,r),this.toSign(i.key,{key:r.bind})]);case i.key:if(r.key===void 0)throw Error("Key packet is required for this signature.");return r.key.writeForHash(this.version);case i.keyRevocation:return this.toSign(i.key,r);case i.timestamp:return new Uint8Array(0);case i.thirdParty:throw Error("Not implemented");default:throw Error("Unknown signature type.")}}calculateTrailer(t,r){let i=0;return fr(hl(this.signatureData),a=>{i+=a.length},()=>{const a=[];return this.version!==5||this.signatureType!==he.signature.binary&&this.signatureType!==he.signature.text||(r?a.push(new Uint8Array(6)):a.push(t.writeHeader())),a.push(new Uint8Array([this.version,255])),this.version===5&&a.push(new Uint8Array(4)),a.push(Pe.writeNumber(i,4)),Pe.concat(a)})}toHash(t,r,i=!1){const a=this.toSign(t,r);return Pe.concat([a,this.signatureData,this.calculateTrailer(r,i)])}async hash(t,r,i,a=!1){return i||(i=this.toHash(t,r,a)),Kt.hash.digest(this.hashAlgorithm,i)}async verify(t,r,i,a=new Date,s=!1,u=Nt){if(!this.issuerKeyID.equals(t.getKeyID()))throw Error("Signature was not issued by the given public key");if(this.publicKeyAlgorithm!==t.algorithm)throw Error("Public key algorithm used to sign signature does not match issuer key algorithm.");const c=r===he.signature.binary||r===he.signature.text;if(!(this[Oc]&&!c)){let n,p;if(this.hashed?p=await this.hashed:(n=this.toHash(r,i,s),p=await this.hash(r,i,n)),p=await gr(p),this.signedHashValue[0]!==p[0]||this.signedHashValue[1]!==p[1])throw Error("Signed digest did not match");if(this.params=await this.params,this[Oc]=await Kt.signature.verify(this.publicKeyAlgorithm,this.hashAlgorithm,this.params,t.publicParams,n,p),!this[Oc])throw Error("Signature verification failed")}const h=Pe.normalizeDate(a);if(h&&this.created>h)throw Error("Signature creation time is in the future");if(h&&h>=this.getExpirationTime())throw Error("Signature is expired");if(u.rejectHashAlgorithms.has(this.hashAlgorithm))throw Error("Insecure hash algorithm: "+he.read(he.hash,this.hashAlgorithm).toUpperCase());if(u.rejectMessageHashAlgorithms.has(this.hashAlgorithm)&&[he.signature.binary,he.signature.text].includes(this.signatureType))throw Error("Insecure message hash algorithm: "+he.read(he.hash,this.hashAlgorithm).toUpperCase());if(this.rawNotations.forEach(({name:n,critical:p})=>{if(p&&u.knownNotations.indexOf(n)<0)throw Error("Unknown critical notation: "+n)}),this.revocationKeyClass!==null)throw Error("This key is intended to be revoked with an authorized key, which OpenPGP.js does not support.")}isExpired(t=new Date){const r=Pe.normalizeDate(t);return r!==null&&!(this.created<=r&&r Hr.prototype.calculateTrailer.apply(await this.correspondingSig,t))}async verify(){const t=await this.correspondingSig;if(!t||t.constructor.tag!==he.packet.signature)throw Error("Corresponding signature packet missing");if(t.signatureType!==this.signatureType||t.hashAlgorithm!==this.hashAlgorithm||t.publicKeyAlgorithm!==this.publicKeyAlgorithm||!t.issuerKeyID.equals(this.issuerKeyID))throw Error("Corresponding signature packet does not match one-pass signature packet");return t.hashed=this.hashed,t.verify.apply(t,arguments)}}function aW(e,t){if(!t[e]){let r;try{r=he.read(he.packet,e)}catch{throw new kr("Unknown packet type with tag: "+e)}throw Error("Packet not allowed in this context: "+r)}return new t[e]}ya.prototype.hash=Hr.prototype.hash,ya.prototype.toHash=Hr.prototype.toHash,ya.prototype.toSign=Hr.prototype.toSign;class zn extends Array{static async fromBinary(t,r,i=Nt){const a=new zn;return await a.read(t,r,i),a}async read(t,r,i=Nt){this.stream=As(t,async(s,u)=>{const c=Ri(u);try{for(;;)if(await c.ready,await sV(s,async h=>{try{if(h.tag===he.packet.marker||h.tag===he.packet.trust)return;const n=aW(h.tag,r);n.packets=new zn,n.fromStream=Pe.isStream(h.packet),await n.read(h.packet,i),await c.write(n)}catch(n){const p=!i.ignoreUnsupportedPackets&&n instanceof kr,d=!(i.ignoreMalformedPackets||n instanceof kr);if(p||d||Ep(h.tag))await c.abort(n);else{const v=new dy(h.tag,h.packet);await c.write(v)}Pe.printDebugError(n)}}))return await c.ready,void await c.close()}catch(h){await c.abort(h)}});const a=ls(this.stream);for(;;){const{done:s,value:u}=await a.read();if(s?this.stream=null:this.push(u),s||Ep(u.constructor.tag))break}a.releaseLock()}write(){const t=[];for(let r=0;r {if(s.push(h),u+=h.length,u>=c){const n=Math.min(Math.log(u)/Math.LN2|0,30),p=2**n,d=Pe.concat([aV(n)].concat(s));return s=[d.subarray(1+p)],u=s[0].length,d.subarray(0,1+p)}},()=>Pe.concat([Md(u)].concat(s))))}else{if(Pe.isStream(a)){let s=0;t.push(fr(hl(a),u=>{s+=u.length},()=>p5(i,s)))}else t.push(p5(i,a.length));t.push(a)}}return Pe.concat(t)}filterByTag(...t){const r=new zn,i=a=>s=>a===s;for(let a=0;a r.constructor.tag===t)}indexOfTag(...t){const r=[],i=this,a=s=>u=>s===u;for(let s=0;s {this.algorithm=await i.readByte(),this.compressed=i.remainder(),await this.decompress(r)})}write(){return this.compressed===null&&this.compress(),Pe.concat([new Uint8Array([this.algorithm]),this.compressed])}async decompress(t=Nt){const r=he.read(he.compression,this.algorithm),i=lW[r];if(!i)throw Error(r+" decompression not supported");this.packets=await zn.fromBinary(i(this.compressed),sW,t)}compress(){const t=he.read(he.compression,this.algorithm),r=oW[t];if(!r)throw Error(t+" compression not supported");this.compressed=r(this.packets.write(),this.deflateLevel)}}const Xa=Pe.getNodeZlib();function hk(e){return e}function yv(e,t,r={}){return function(i){return!Pe.isStream(i)||mr(i)?wo(()=>gr(i).then(a=>new Promise((s,u)=>{e(a,r,(c,h)=>{if(c)return u(c);s(h)})}))):Xv(j0(i).pipe(t(r)))}}function bv(e,t={}){return function(r){const i=new e(t);return fr(r,a=>{if(a.length)return i.push(a,cd),i.result},()=>{if(e===_y)return i.push([],Ir),i.result})}}function pk(e){return function(t){return wo(async()=>e(await gr(t)))}}const oW=Xa?{zip:(e,t)=>yv(Xa.deflateRaw,Xa.createDeflateRaw,{level:t})(e),zlib:(e,t)=>yv(Xa.deflate,Xa.createDeflate,{level:t})(e)}:{zip:(e,t)=>bv(_y,{raw:!0,level:t})(e),zlib:(e,t)=>bv(_y,{level:t})(e)},lW=Xa?{uncompressed:hk,zip:yv(Xa.inflateRaw,Xa.createInflateRaw),zlib:yv(Xa.inflate,Xa.createInflate),bzip2:pk(fk)}:{uncompressed:hk,zip:bv(uk,{raw:!0}),zlib:bv(uk),bzip2:pk(fk)},uW=Pe.constructAllowedPackets([Bu,Rd,ya,Hr]);class WD{static get tag(){return he.packet.symEncryptedIntegrityProtectedData}constructor(){this.version=1,this.encrypted=null,this.packets=null}async read(t){await Jv(t,async r=>{const i=await r.readByte();if(i!==1)throw new kr(`Version ${i} of the SEIP packet is unsupported.`);this.encrypted=r.remainder()})}write(){return Pe.concat([new Uint8Array([1]),this.encrypted])}async encrypt(t,r,i=Nt){const{blockSize:a}=Kt.getCipher(t);let s=this.packets.write();mr(s)&&(s=await gr(s));const u=await Kt.getPrefixRandom(t),c=new Uint8Array([211,20]),h=Pe.concat([u,s,c]),n=await Kt.hash.sha1(cu(h)),p=Pe.concat([h,n]);return this.encrypted=await Kt.mode.cfb.encrypt(t,r,p,new Uint8Array(a),i),!0}async decrypt(t,r,i=Nt){const{blockSize:a}=Kt.getCipher(t);let s=hl(this.encrypted);mr(s)&&(s=await gr(s));const u=await Kt.mode.cfb.decrypt(t,r,s,new Uint8Array(a)),c=Wr(cu(u),-20),h=Wr(u,0,-20),n=Promise.all([gr(await Kt.hash.sha1(cu(h))),gr(c)]).then(([v,m])=>{if(!Pe.equalsUint8Array(v,m))throw Error("Modification detected.");return new Uint8Array}),p=Wr(h,a+2);let d=Wr(p,0,-2);return d=Ti([d,wo(()=>n)]),Pe.isStream(s)&&i.allowUnauthenticatedStream||(d=await gr(d)),this.packets=await zn.fromBinary(d,uW,i),!0}}const cW=Pe.constructAllowedPackets([Bu,Rd,ya,Hr]);class am{static get tag(){return he.packet.aeadEncryptedData}constructor(){this.version=1,this.cipherAlgorithm=null,this.aeadAlgorithm=he.aead.eax,this.chunkSizeByte=null,this.iv=null,this.encrypted=null,this.packets=null}async read(t){await Jv(t,async r=>{const i=await r.readByte();if(i!==1)throw new kr(`Version ${i} of the AEAD-encrypted data packet is not supported.`);this.cipherAlgorithm=await r.readByte(),this.aeadAlgorithm=await r.readByte(),this.chunkSizeByte=await r.readByte();const a=Kt.getAEADMode(this.aeadAlgorithm);this.iv=await r.readBytes(a.ivLength),this.encrypted=r.remainder()})}write(){return Pe.concat([new Uint8Array([this.version,this.cipherAlgorithm,this.aeadAlgorithm,this.chunkSizeByte]),this.iv,this.encrypted])}async decrypt(t,r,i=Nt){this.packets=await zn.fromBinary(await this.crypt("decrypt",r,hl(this.encrypted)),cW,i)}async encrypt(t,r,i=Nt){this.cipherAlgorithm=t;const{ivLength:a}=Kt.getAEADMode(this.aeadAlgorithm);this.iv=Kt.random.getRandomBytes(a),this.chunkSizeByte=i.aeadChunkSizeByte;const s=this.packets.write();this.encrypted=await this.crypt("encrypt",r,s)}async crypt(t,r,i){const a=Kt.getAEADMode(this.aeadAlgorithm),s=await a(this.cipherAlgorithm,r),u=t==="decrypt"?a.tagLength:0,c=t==="encrypt"?a.tagLength:0,h=2**(this.chunkSizeByte+6)+u,n=new ArrayBuffer(21),p=new Uint8Array(n,0,13),d=new Uint8Array(n),v=new DataView(n),m=new Uint8Array(n,5,8);p.set([192|am.tag,this.version,this.cipherAlgorithm,this.aeadAlgorithm,this.chunkSizeByte],0);let g=0,y=Promise.resolve(),b=0,k=0;const O=this.iv;return As(i,async(S,x)=>{if(Pe.isStream(S)!=="array"){const T=new bu({},{highWaterMark:Pe.getHardwareConcurrency()*2**(this.chunkSizeByte+6),size:M=>M.length});vo(T.readable,x),x=T.writable}const E=ls(S),w=Ri(x);try{for(;;){let T=await E.readBytes(h+u)||new Uint8Array;const M=T.subarray(T.length-u);let A,L;if(T=T.subarray(0,T.length-u),!g||T.length?(E.unshift(M),A=s[t](T,a.getNonce(O,m),p),k+=T.length-u+c):(v.setInt32(17,b),A=s[t](M,a.getNonce(O,m),d),k+=c,L=!0),b+=T.length-u,y=y.then(()=>A).then(async Y=>{await w.ready,await w.write(Y),k-=Y.length}).catch(Y=>w.abort(Y)),(L||k>w.desiredSize)&&await y,L){await w.close();break}v.setInt32(9,++g)}}catch(T){await w.abort(T)}})}}class gy{static get tag(){return he.packet.publicKeyEncryptedSessionKey}constructor(){this.version=3,this.publicKeyID=new mo,this.publicKeyAlgorithm=null,this.sessionKey=null,this.sessionKeyAlgorithm=null,this.encrypted={}}read(t){if(this.version=t[0],this.version!==3)throw new kr(`Version ${this.version} of the PKESK packet is unsupported.`);this.publicKeyID.read(t.subarray(1,t.length)),this.publicKeyAlgorithm=t[9],this.encrypted=Kt.parseEncSessionKeyParams(this.publicKeyAlgorithm,t.subarray(10))}write(){const t=[new Uint8Array([this.version]),this.publicKeyID.write(),new Uint8Array([this.publicKeyAlgorithm]),Kt.serializeParams(this.publicKeyAlgorithm,this.encrypted)];return Pe.concatUint8Array(t)}async encrypt(t){const r=Pe.concatUint8Array([new Uint8Array([he.write(he.symmetric,this.sessionKeyAlgorithm)]),this.sessionKey,Pe.writeChecksum(this.sessionKey)]),i=he.write(he.publicKey,this.publicKeyAlgorithm);this.encrypted=await Kt.publicKeyEncrypt(i,t.publicParams,r,t.getFingerprintBytes())}async decrypt(t,r){if(this.publicKeyAlgorithm!==t.algorithm)throw Error("Decryption error");const i=r?Pe.concatUint8Array([new Uint8Array([r.sessionKeyAlgorithm]),r.sessionKey,Pe.writeChecksum(r.sessionKey)]):null,a=await Kt.publicKeyDecrypt(this.publicKeyAlgorithm,t.publicParams,t.privateParams,this.encrypted,t.getFingerprintBytes(),i),s=a[0],u=a.subarray(1,a.length-2),c=a.subarray(a.length-2),h=Pe.writeChecksum(u),n=h[0]===c[0]&h[1]===c[1];if(r){const p=n&s===r.sessionKeyAlgorithm&u.length===r.sessionKey.length;this.sessionKeyAlgorithm=Pe.selectUint8(p,s,r.sessionKeyAlgorithm),this.sessionKey=Pe.selectUint8Array(p,u,r.sessionKey)}else{if(!(n&&he.read(he.symmetric,s)))throw Error("Decryption error");this.sessionKey=u,this.sessionKeyAlgorithm=s}}}class nd{constructor(t=Nt){this.algorithm=he.hash.sha256,this.type="iterated",this.c=t.s2kIterationCountByte,this.salt=null}getCount(){return 16+(15&this.c)<<6+(this.c>>4)}read(t){let r=0;switch(this.type=he.read(he.s2k,t[r++]),this.algorithm=t[r++],this.type){case"simple":break;case"salted":this.salt=t.subarray(r,r+8),r+=8;break;case"iterated":this.salt=t.subarray(r,r+8),r+=8,this.c=t[r++];break;case"gnu":if(Pe.uint8ArrayToString(t.subarray(r,r+3))!=="GNU")throw Error("Unknown s2k type.");if(r+=3,1e3+t[r++]!==1001)throw Error("Unknown s2k gnu protection mode.");this.type="gnu-dummy";break;default:throw Error("Unknown s2k type.")}return r}write(){if(this.type==="gnu-dummy")return new Uint8Array([101,0,...Pe.stringToUint8Array("GNU"),1]);const t=[new Uint8Array([he.write(he.s2k,this.type),this.algorithm])];switch(this.type){case"simple":break;case"salted":t.push(this.salt);break;case"iterated":t.push(this.salt),t.push(new Uint8Array([this.c]));break;case"gnu":throw Error("GNU s2k type not supported.");default:throw Error("Unknown s2k type.")}return Pe.concatUint8Array(t)}async produceKey(t,r){t=Pe.encodeUTF8(t);const i=[];let a=0,s=0;for(;a {this.privateParams[t].fill(0),delete this.privateParams[t]}),this.privateParams=null,this.isEncrypted=!0)}}async function vk(e,t,r){const{keySize:i}=Kt.getCipher(r);return e.produceKey(t,i)}var hW=H0(function(e){(function(t){function r(a){function s(){return Zt 0&&(at.semantic=" "),at}}function S(rt,at){return function(){var xt,Ut,Ee,Be,Fe;for(Be=u(),xt=n("star"),Ee=0,Fe=at===void 0?0:at;(Ut=rt())!==null;)Ee+=1,d(xt,Ut);return Ee>=Fe?xt:(c(Be),null)}}function x(rt){return rt.charCodeAt(0)>=128}function E(){return p("cr",m("\r")())}function w(){return p("crlf",g(E,A)())}function T(){return p("dquote",m('"')())}function M(){return p("htab",m(" ")())}function A(){return p("lf",m(` +`)}return Pe.concat(n)}class mo{constructor(){this.bytes=""}read(t){this.bytes=Pe.uint8ArrayToString(t.subarray(0,8))}write(){return Pe.stringToUint8Array(this.bytes)}toHex(){return Pe.uint8ArrayToHex(Pe.stringToUint8Array(this.bytes))}equals(t,r=!1){return r&&(t.isWildcard()||this.isWildcard())||this.bytes===t.bytes}isNull(){return this.bytes===""}isWildcard(){return/^0+$/.test(this.toHex())}static mapToHex(t){return t.toHex()}static fromID(t){const r=new mo;return r.read(Pe.hexToUint8Array(t)),r}static wildcard(){const t=new mo;return t.read(new Uint8Array(8)),t}}var En=function(){var e,t,r=!1;function i(d,v){var m=e[(t[d]+t[v])%255];return d!==0&&v!==0||(m=0),m}var a,s,u,c,h=!1;function n(){function d(y){var b,k,O;for(k=O=function(S){var x=e[255-t[S]];return S===0&&(x=0),x}(y),b=0;b<4;b++)O^=k=255&(k<<1|k>>>7);return O^=99}r||function(){e=[],t=[];var y,b,k=1;for(y=0;y<255;y++)e[y]=k,b=128&k,k<<=1,k&=255,b===128&&(k^=27),k^=e[y],t[e[y]]=y;e[255]=e[0],t[0]=0,r=!0}(),a=[],s=[],u=[[],[],[],[]],c=[[],[],[],[]];for(var v=0;v<256;v++){var m=d(v);a[v]=m,s[m]=v,u[0][v]=i(2,m)<<24|m<<16|m<<8|i(3,m),c[0][m]=i(14,v)<<24|i(9,v)<<16|i(13,v)<<8|i(11,v);for(var g=1;g<4;g++)u[g][v]=u[g-1][v]>>>8|u[g-1][v]<<24,c[g][m]=c[g-1][m]>>>8|c[g-1][m]<<24}h=!0}var p=function(d,v){h||n();var m=new Uint32Array(v);m.set(a,512),m.set(s,768);for(var g=0;g<4;g++)m.set(u[g],4096+1024*g>>2),m.set(c[g],8192+1024*g>>2);var y=function(b,k,O){var S=0,x=0,E=0,w=0,T=0,M=0,A=0,L=0,Y=0,N=0,W=0,j=0,ue=0,Te=0,pe=0,ye=0,de=0,ke=0,ie=0,be=0,Ie=0,De=new b.Uint32Array(O),ae=new b.Uint8Array(O);function ee(ce,le,Ve,Je,gt,Pt,At,It){ce=ce|0,le=le|0,Ve=Ve|0,Je=Je|0,gt=gt|0,Pt=Pt|0,At=At|0,It=It|0;var ht=0,Rt=0,Tt=0,dn=0,nn=0,Xt=0,Gt=0,Zt=0;for(ht=Ve|1024,Rt=Ve|2048,Tt=Ve|3072,gt=gt^De[(ce|0)>>2],Pt=Pt^De[(ce|4)>>2],At=At^De[(ce|8)>>2],It=It^De[(ce|12)>>2],Zt=16;(Zt|0)<=Je<<4;Zt=Zt+16|0)dn=De[(Ve|gt>>22&1020)>>2]^De[(ht|Pt>>14&1020)>>2]^De[(Rt|At>>6&1020)>>2]^De[(Tt|It<<2&1020)>>2]^De[(ce|Zt|0)>>2],nn=De[(Ve|Pt>>22&1020)>>2]^De[(ht|At>>14&1020)>>2]^De[(Rt|It>>6&1020)>>2]^De[(Tt|gt<<2&1020)>>2]^De[(ce|Zt|4)>>2],Xt=De[(Ve|At>>22&1020)>>2]^De[(ht|It>>14&1020)>>2]^De[(Rt|gt>>6&1020)>>2]^De[(Tt|Pt<<2&1020)>>2]^De[(ce|Zt|8)>>2],Gt=De[(Ve|It>>22&1020)>>2]^De[(ht|gt>>14&1020)>>2]^De[(Rt|Pt>>6&1020)>>2]^De[(Tt|At<<2&1020)>>2]^De[(ce|Zt|12)>>2],gt=dn,Pt=nn,At=Xt,It=Gt;S=De[(le|gt>>22&1020)>>2]<<24^De[(le|Pt>>14&1020)>>2]<<16^De[(le|At>>6&1020)>>2]<<8^De[(le|It<<2&1020)>>2]^De[(ce|Zt|0)>>2],x=De[(le|Pt>>22&1020)>>2]<<24^De[(le|At>>14&1020)>>2]<<16^De[(le|It>>6&1020)>>2]<<8^De[(le|gt<<2&1020)>>2]^De[(ce|Zt|4)>>2],E=De[(le|At>>22&1020)>>2]<<24^De[(le|It>>14&1020)>>2]<<16^De[(le|gt>>6&1020)>>2]<<8^De[(le|Pt<<2&1020)>>2]^De[(ce|Zt|8)>>2],w=De[(le|It>>22&1020)>>2]<<24^De[(le|gt>>14&1020)>>2]<<16^De[(le|Pt>>6&1020)>>2]<<8^De[(le|At<<2&1020)>>2]^De[(ce|Zt|12)>>2]}function F(ce,le,Ve,Je){ce=ce|0,le=le|0,Ve=Ve|0,Je=Je|0,ee(0,2048,4096,Ie,ce,le,Ve,Je)}function I(ce,le,Ve,Je){ce=ce|0,le=le|0,Ve=Ve|0,Je=Je|0;var gt=0;ee(1024,3072,8192,Ie,ce,Je,Ve,le),gt=x,x=w,w=gt}function J(ce,le,Ve,Je){ce=ce|0,le=le|0,Ve=Ve|0,Je=Je|0,ee(0,2048,4096,Ie,T^ce,M^le,A^Ve,L^Je),T=S,M=x,A=E,L=w}function q(ce,le,Ve,Je){ce=ce|0,le=le|0,Ve=Ve|0,Je=Je|0;var gt=0;ee(1024,3072,8192,Ie,ce,Je,Ve,le),gt=x,x=w,w=gt,S=S^T,x=x^M,E=E^A,w=w^L,T=ce,M=le,A=Ve,L=Je}function fe(ce,le,Ve,Je){ce=ce|0,le=le|0,Ve=Ve|0,Je=Je|0,ee(0,2048,4096,Ie,T,M,A,L),T=S=S^ce,M=x=x^le,A=E=E^Ve,L=w=w^Je}function Ce(ce,le,Ve,Je){ce=ce|0,le=le|0,Ve=Ve|0,Je=Je|0,ee(0,2048,4096,Ie,T,M,A,L),S=S^ce,x=x^le,E=E^Ve,w=w^Je,T=ce,M=le,A=Ve,L=Je}function X(ce,le,Ve,Je){ce=ce|0,le=le|0,Ve=Ve|0,Je=Je|0,ee(0,2048,4096,Ie,T,M,A,L),T=S,M=x,A=E,L=w,S=S^ce,x=x^le,E=E^Ve,w=w^Je}function H(ce,le,Ve,Je){ce=ce|0,le=le|0,Ve=Ve|0,Je=Je|0,ee(0,2048,4096,Ie,Y,N,W,j),j=~ye&j|ye&j+1,W=~pe&W|pe&W+((j|0)==0),N=~Te&N|Te&N+((W|0)==0),Y=~ue&Y|ue&Y+((N|0)==0),S=S^ce,x=x^le,E=E^Ve,w=w^Je}function re(ce,le,Ve,Je){ce=ce|0,le=le|0,Ve=Ve|0,Je=Je|0;var gt=0,Pt=0,At=0,It=0,ht=0,Rt=0,Tt=0,dn=0,nn=0,Xt=0;for(ce=ce^T,le=le^M,Ve=Ve^A,Je=Je^L,gt=de|0,Pt=ke|0,At=ie|0,It=be|0;(nn|0)<128;nn=nn+1|0)gt>>>31&&(ht=ht^ce,Rt=Rt^le,Tt=Tt^Ve,dn=dn^Je),gt=gt<<1|Pt>>>31,Pt=Pt<<1|At>>>31,At=At<<1|It>>>31,It=It<<1,Xt=Je&1,Je=Je>>>1|Ve<<31,Ve=Ve>>>1|le<<31,le=le>>>1|ce<<31,ce=ce>>>1,Xt&&(ce=ce^3774873600);T=ht,M=Rt,A=Tt,L=dn}function Z(ce){ce=ce|0,Ie=ce}function Oe(ce,le,Ve,Je){ce=ce|0,le=le|0,Ve=Ve|0,Je=Je|0,S=ce,x=le,E=Ve,w=Je}function ve(ce,le,Ve,Je){ce=ce|0,le=le|0,Ve=Ve|0,Je=Je|0,T=ce,M=le,A=Ve,L=Je}function U(ce,le,Ve,Je){ce=ce|0,le=le|0,Ve=Ve|0,Je=Je|0,Y=ce,N=le,W=Ve,j=Je}function xe(ce,le,Ve,Je){ce=ce|0,le=le|0,Ve=Ve|0,Je=Je|0,ue=ce,Te=le,pe=Ve,ye=Je}function me(ce,le,Ve,Je){ce=ce|0,le=le|0,Ve=Ve|0,Je=Je|0,j=~ye&j|ye&Je,W=~pe&W|pe&Ve,N=~Te&N|Te&le,Y=~ue&Y|ue&ce}function se(ce){return ce=ce|0,ce&15?-1:(ae[ce|0]=S>>>24,ae[ce|1]=S>>>16&255,ae[ce|2]=S>>>8&255,ae[ce|3]=S&255,ae[ce|4]=x>>>24,ae[ce|5]=x>>>16&255,ae[ce|6]=x>>>8&255,ae[ce|7]=x&255,ae[ce|8]=E>>>24,ae[ce|9]=E>>>16&255,ae[ce|10]=E>>>8&255,ae[ce|11]=E&255,ae[ce|12]=w>>>24,ae[ce|13]=w>>>16&255,ae[ce|14]=w>>>8&255,ae[ce|15]=w&255,16)}function B(ce){return ce=ce|0,ce&15?-1:(ae[ce|0]=T>>>24,ae[ce|1]=T>>>16&255,ae[ce|2]=T>>>8&255,ae[ce|3]=T&255,ae[ce|4]=M>>>24,ae[ce|5]=M>>>16&255,ae[ce|6]=M>>>8&255,ae[ce|7]=M&255,ae[ce|8]=A>>>24,ae[ce|9]=A>>>16&255,ae[ce|10]=A>>>8&255,ae[ce|11]=A&255,ae[ce|12]=L>>>24,ae[ce|13]=L>>>16&255,ae[ce|14]=L>>>8&255,ae[ce|15]=L&255,16)}function V(){F(0,0,0,0),de=S,ke=x,ie=E,be=w}function G(ce,le,Ve){ce=ce|0,le=le|0,Ve=Ve|0;var Je=0;if(le&15)return-1;for(;(Ve|0)>=16;)oe[ce&7](ae[le|0]<<24|ae[le|1]<<16|ae[le|2]<<8|ae[le|3],ae[le|4]<<24|ae[le|5]<<16|ae[le|6]<<8|ae[le|7],ae[le|8]<<24|ae[le|9]<<16|ae[le|10]<<8|ae[le|11],ae[le|12]<<24|ae[le|13]<<16|ae[le|14]<<8|ae[le|15]),ae[le|0]=S>>>24,ae[le|1]=S>>>16&255,ae[le|2]=S>>>8&255,ae[le|3]=S&255,ae[le|4]=x>>>24,ae[le|5]=x>>>16&255,ae[le|6]=x>>>8&255,ae[le|7]=x&255,ae[le|8]=E>>>24,ae[le|9]=E>>>16&255,ae[le|10]=E>>>8&255,ae[le|11]=E&255,ae[le|12]=w>>>24,ae[le|13]=w>>>16&255,ae[le|14]=w>>>8&255,ae[le|15]=w&255,Je=Je+16|0,le=le+16|0,Ve=Ve-16|0;return Je|0}function te(ce,le,Ve){ce=ce|0,le=le|0,Ve=Ve|0;var Je=0;if(le&15)return-1;for(;(Ve|0)>=16;)_e[ce&1](ae[le|0]<<24|ae[le|1]<<16|ae[le|2]<<8|ae[le|3],ae[le|4]<<24|ae[le|5]<<16|ae[le|6]<<8|ae[le|7],ae[le|8]<<24|ae[le|9]<<16|ae[le|10]<<8|ae[le|11],ae[le|12]<<24|ae[le|13]<<16|ae[le|14]<<8|ae[le|15]),Je=Je+16|0,le=le+16|0,Ve=Ve-16|0;return Je|0}var oe=[F,I,J,q,fe,Ce,X,H],_e=[J,re];return{set_rounds:Z,set_state:Oe,set_iv:ve,set_nonce:U,set_mask:xe,set_counter:me,get_state:se,get_iv:B,gcm_init:V,cipher:G,mac:te}}({Uint8Array,Uint32Array},d,v);return y.set_key=function(b,k,O,S,x,E,w,T,M){var A=m.subarray(0,60),L=m.subarray(256,316);A.set([k,O,S,x,E,w,T,M]);for(var Y=b,N=1;Y<4*b+28;Y++){var W=A[Y-1];(Y%b==0||b===8&&Y%b==4)&&(W=a[W>>>24]<<24^a[W>>>16&255]<<16^a[W>>>8&255]<<8^a[255&W]),Y%b==0&&(W=W<<8^W>>>24^N<<24,N=N<<1^(128&N?27:0)),A[Y]=A[Y-b]^W}for(var j=0;j =Y-4?W:c[0][a[W>>>24]]^c[1][a[W>>>16&255]]^c[2][a[W>>>8&255]]^c[3][a[255&W]];y.set_rounds(b+5)},y};return p.ENC={ECB:0,CBC:2,CFB:4,OFB:6,CTR:7},p.DEC={ECB:1,CBC:3,CFB:5,OFB:6,CTR:7},p.MAC={CBC:0,GCM:1},p.HEAP_DATA=16384,p}();function HS(e){return e instanceof Uint8Array}function W0(e,t){const r=e?e.byteLength:t||65536;if(4095&r||r<=0)throw Error("heap size must be a positive integer and a multiple of 4096");return e=e||new Uint8Array(new ArrayBuffer(r))}function Yo(e,t,r,i,a){const s=e.length-t,u=sa+s.length,0),r=new Uint8Array(t);let i=0;for(let a=0;a >2,s.getUint32(0),s.getUint32(4),s.getUint32(8),s.getUint32(12),a>16?s.getUint32(16):0,a>16?s.getUint32(20):0,a>24?s.getUint32(24):0,a>24?s.getUint32(28):0),r!==void 0){if(r.length!==16)throw new Ds("illegal iv size");let u=new DataView(r.buffer,r.byteOffset,r.byteLength);i.set_iv(u.getUint32(0),u.getUint32(4),u.getUint32(8),u.getUint32(12))}else i.set_iv(0,0,0,0)}AES_Encrypt_process(t){if(!HS(t))throw new TypeError("data isn't of expected type");let{heap:r,asm:i}=this.acquire_asm(),a=En.ENC[this.mode],s=En.HEAP_DATA,u=this.pos,c=this.len,h=0,n=t.length||0,p=0,d=0,v=new Uint8Array(c+n&-16);for(;n>0;)d=Yo(r,u+c,t,h,n),c+=d,h+=d,n-=d,d=i.cipher(a,s+u,c),d&&v.set(r.subarray(u,u+d),p),p+=d,d 0;)m=Yo(r,u+c,t,h,n),c+=m,h+=m,n-=m,m=i.cipher(a,s+u,c-(n?0:v)),m&&g.set(r.subarray(u,u+m),p),p+=m,m 0){if(u%16){if(this.hasOwnProperty("padding"))throw new Ds("data length must be a multiple of the block size");u+=16-u%16}if(r.cipher(i,a+s,u),this.hasOwnProperty("padding")&&this.padding){let n=t[s+c-1];if(n<1||n>16||n>c)throw new oy("bad padding");let p=0;for(let d=n;d>1;d--)p|=n^t[s+c-d];if(p)throw new oy("bad padding");c-=n}}const h=new Uint8Array(c);return c>0&&h.set(t.subarray(s,s+c)),this.pos=0,this.len=0,this.release_asm(),h}}class av{static encrypt(t,r,i=!1){return new av(r,i).encrypt(t)}static decrypt(t,r,i=!1){return new av(r,i).decrypt(t)}constructor(t,r=!1,i){this.aes=i||new Td(t,void 0,r,"ECB")}encrypt(t){return _o(this.aes.AES_Encrypt_process(t),this.aes.AES_Encrypt_finish())}decrypt(t){return _o(this.aes.AES_Decrypt_process(t),this.aes.AES_Decrypt_finish())}}function K0(e){const t=function(r){const i=new av(r);this.encrypt=function(a){return i.encrypt(a)},this.decrypt=function(a){return i.decrypt(a)}};return t.blockSize=t.prototype.blockSize=16,t.keySize=t.prototype.keySize=e/8,t}function Jc(e,t,r,i,a,s){const u=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],c=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],h=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],n=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],p=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],d=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],v=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],m=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696];let g,y,b,k,O,S,x,E,w,T,M,A,L,Y,N=0,W=t.length;const j=e.length===32?3:9;E=j===3?r?[0,32,2]:[30,-2,-2]:r?[0,32,2,62,30,-2,64,96,2]:[94,62,-2,32,64,2,30,-2,-2],r&&(t=function(pe,ye){const de=8-pe.length%8;let ke;if(ye===2&&de<8)ke=32;else if(ye===1)ke=de;else{if(ye||!(de<8)){if(de===8)return pe;throw Error("des: invalid padding")}ke=0}const ie=new Uint8Array(pe.length+de);for(let be=0;be >>4^x),x^=b,S^=b<<4,b=65535&(S>>>16^x),x^=b,S^=b<<16,b=858993459&(x>>>2^S),S^=b,x^=b<<2,b=16711935&(x>>>8^S),S^=b,x^=b<<8,b=1431655765&(S>>>1^x),x^=b,S^=b<<1,S=S<<1|S>>>31,x=x<<1|x>>>31,y=0;y >>4|x<<28)^e[g+1],b=S,S=x,x=b^(c[k>>>24&63]|n[k>>>16&63]|d[k>>>8&63]|m[63&k]|u[O>>>24&63]|h[O>>>16&63]|p[O>>>8&63]|v[63&O]);b=S,S=x,x=b}S=S>>>1|S<<31,x=x>>>1|x<<31,b=1431655765&(S>>>1^x),x^=b,S^=b<<1,b=16711935&(x>>>8^S),S^=b,x^=b<<8,b=858993459&(x>>>2^S),S^=b,x^=b<<2,b=65535&(S>>>16^x),x^=b,S^=b<<16,b=252645135&(S>>>4^x),x^=b,S^=b<<4,i===1&&(r?(w=S,M=x):(S^=T,x^=A)),ue[Te++]=S>>>24,ue[Te++]=S>>>16&255,ue[Te++]=S>>>8&255,ue[Te++]=255&S,ue[Te++]=x>>>24,ue[Te++]=x>>>16&255,ue[Te++]=x>>>8&255,ue[Te++]=255&x}return r||(ue=function(pe,ye){let de,ke=null;if(ye===2)de=32;else if(ye===1)ke=pe[pe.length-1];else{if(ye)throw Error("des: invalid padding");de=0}if(!ke){for(ke=1;pe[pe.length-ke]===de;)ke++;ke--}return pe.subarray(0,pe.length-ke)}(ue,s)),ue}function Zc(e){const t=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],r=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],i=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],a=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],s=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],u=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],c=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],h=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],n=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],p=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],d=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],v=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],m=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],g=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],y=e.length>8?3:1,b=Array(32*y),k=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0];let O,S,x,E=0,w=0;for(let T=0;T >>4^A),A^=x,M^=x<<4,x=65535&(A>>>-16^M),M^=x,A^=x<<-16,x=858993459&(M>>>2^A),A^=x,M^=x<<2,x=65535&(A>>>-16^M),M^=x,A^=x<<-16,x=1431655765&(M>>>1^A),A^=x,M^=x<<1,x=16711935&(A>>>8^M),M^=x,A^=x<<8,x=1431655765&(M>>>1^A),A^=x,M^=x<<1,x=M<<8|A>>>20&240,M=A<<24|A<<8&16711680|A>>>8&65280|A>>>24&240,A=x;for(let L=0;L<16;L++)k[L]?(M=M<<2|M>>>26,A=A<<2|A>>>26):(M=M<<1|M>>>27,A=A<<1|A>>>27),M&=-15,A&=-15,O=t[M>>>28]|r[M>>>24&15]|i[M>>>20&15]|a[M>>>16&15]|s[M>>>12&15]|u[M>>>8&15]|c[M>>>4&15],S=h[A>>>28]|n[A>>>24&15]|p[A>>>20&15]|d[A>>>16&15]|v[A>>>12&15]|m[A>>>8&15]|g[A>>>4&15],x=65535&(S>>>16^O),b[w++]=O^x,b[w++]=S^x<<16}return b}function Lc(e){this.key=[];for(let t=0;t<3;t++)this.key.push(new Uint8Array(e.subarray(8*t,8*t+8)));this.encrypt=function(t){return Jc(Zc(this.key[2]),Jc(Zc(this.key[1]),Jc(Zc(this.key[0]),t,!0,0,null,null),!1,0,null,null),!0,0,null,null)}}function Xj(){this.BlockSize=8,this.KeySize=16,this.setKey=function(u){if(this.masking=Array(16),this.rotate=Array(16),this.reset(),u.length!==this.KeySize)throw Error("CAST-128: keys must be 16 bytes");return this.keySchedule(u),!0},this.reset=function(){for(let u=0;u<16;u++)this.masking[u]=0,this.rotate[u]=0},this.getBlockSize=function(){return this.BlockSize},this.encrypt=function(u){const c=Array(u.length);for(let h=0;h >>24&255,c[h+1]=d>>>16&255,c[h+2]=d>>>8&255,c[h+3]=255&d,c[h+4]=p>>>24&255,c[h+5]=p>>>16&255,c[h+6]=p>>>8&255,c[h+7]=255&p}return c},this.decrypt=function(u){const c=Array(u.length);for(let h=0;h >>24&255,c[h+1]=d>>>16&255,c[h+2]=d>>>8&255,c[h+3]=255&d,c[h+4]=p>>>24&255,c[h+5]=p>>16&255,c[h+6]=p>>8&255,c[h+7]=255&p}return c};const e=[,,,,];e[0]=[,,,,],e[0][0]=[4,0,13,15,12,14,8],e[0][1]=[5,2,16,18,17,19,10],e[0][2]=[6,3,23,22,21,20,9],e[0][3]=[7,1,26,25,27,24,11],e[1]=[,,,,],e[1][0]=[0,6,21,23,20,22,16],e[1][1]=[1,4,0,2,1,3,18],e[1][2]=[2,5,7,6,5,4,17],e[1][3]=[3,7,10,9,11,8,19],e[2]=[,,,,],e[2][0]=[4,0,13,15,12,14,8],e[2][1]=[5,2,16,18,17,19,10],e[2][2]=[6,3,23,22,21,20,9],e[2][3]=[7,1,26,25,27,24,11],e[3]=[,,,,],e[3][0]=[0,6,21,23,20,22,16],e[3][1]=[1,4,0,2,1,3,18],e[3][2]=[2,5,7,6,5,4,17],e[3][3]=[3,7,10,9,11,8,19];const t=[,,,,];function r(u,c,h){const n=c+u,p=n< >>32-h;return(s[0][p>>>24]^s[1][p>>>16&255])-s[2][p>>>8&255]+s[3][255&p]}function i(u,c,h){const n=c^u,p=n< >>32-h;return s[0][p>>>24]-s[1][p>>>16&255]+s[2][p>>>8&255]^s[3][255&p]}function a(u,c,h){const n=c-u,p=n< >>32-h;return(s[0][p>>>24]+s[1][p>>>16&255]^s[2][p>>>8&255])-s[3][255&p]}t[0]=[,,,,],t[0][0]=[24,25,23,22,18],t[0][1]=[26,27,21,20,22],t[0][2]=[28,29,19,18,25],t[0][3]=[30,31,17,16,28],t[1]=[,,,,],t[1][0]=[3,2,12,13,8],t[1][1]=[1,0,14,15,13],t[1][2]=[7,6,8,9,3],t[1][3]=[5,4,10,11,7],t[2]=[,,,,],t[2][0]=[19,18,28,29,25],t[2][1]=[17,16,30,31,28],t[2][2]=[23,22,24,25,18],t[2][3]=[21,20,26,27,22],t[3]=[,,,,],t[3][0]=[8,9,7,6,3],t[3][1]=[10,11,5,4,7],t[3][2]=[12,13,3,2,8],t[3][3]=[14,15,1,0,13],this.keySchedule=function(u){const c=[,,,,,,,,],h=Array(32);let n;for(let m=0;m<4;m++)n=4*m,c[m]=u[n]<<24|u[n+1]<<16|u[n+2]<<8|u[n+3];const p=[6,7,4,5];let d,v=0;for(let m=0;m<2;m++)for(let g=0;g<4;g++){for(n=0;n<4;n++){const y=e[g][n];d=c[y[1]],d^=s[4][c[y[2]>>>2]>>>24-8*(3&y[2])&255],d^=s[5][c[y[3]>>>2]>>>24-8*(3&y[3])&255],d^=s[6][c[y[4]>>>2]>>>24-8*(3&y[4])&255],d^=s[7][c[y[5]>>>2]>>>24-8*(3&y[5])&255],d^=s[p[n]][c[y[6]>>>2]>>>24-8*(3&y[6])&255],c[y[0]]=d}for(n=0;n<4;n++){const y=t[g][n];d=s[4][c[y[0]>>>2]>>>24-8*(3&y[0])&255],d^=s[5][c[y[1]>>>2]>>>24-8*(3&y[1])&255],d^=s[6][c[y[2]>>>2]>>>24-8*(3&y[2])&255],d^=s[7][c[y[3]>>>2]>>>24-8*(3&y[3])&255],d^=s[4+n][c[y[4]>>>2]>>>24-8*(3&y[4])&255],h[v]=d,v++}}for(let m=0;m<16;m++)this.masking[m]=h[m],this.rotate[m]=31&h[16+m]};const s=[,,,,,,,,];s[0]=[821772500,2678128395,1810681135,1059425402,505495343,2617265619,1610868032,3483355465,3218386727,2294005173,3791863952,2563806837,1852023008,365126098,3269944861,584384398,677919599,3229601881,4280515016,2002735330,1136869587,3744433750,2289869850,2731719981,2714362070,879511577,1639411079,575934255,717107937,2857637483,576097850,2731753936,1725645e3,2810460463,5111599,767152862,2543075244,1251459544,1383482551,3052681127,3089939183,3612463449,1878520045,1510570527,2189125840,2431448366,582008916,3163445557,1265446783,1354458274,3529918736,3202711853,3073581712,3912963487,3029263377,1275016285,4249207360,2905708351,3304509486,1442611557,3585198765,2712415662,2731849581,3248163920,2283946226,208555832,2766454743,1331405426,1447828783,3315356441,3108627284,2957404670,2981538698,3339933917,1669711173,286233437,1465092821,1782121619,3862771680,710211251,980974943,1651941557,430374111,2051154026,704238805,4128970897,3144820574,2857402727,948965521,3333752299,2227686284,718756367,2269778983,2731643755,718440111,2857816721,3616097120,1113355533,2478022182,410092745,1811985197,1944238868,2696854588,1415722873,1682284203,1060277122,1998114690,1503841958,82706478,2315155686,1068173648,845149890,2167947013,1768146376,1993038550,3566826697,3390574031,940016341,3355073782,2328040721,904371731,1205506512,4094660742,2816623006,825647681,85914773,2857843460,1249926541,1417871568,3287612,3211054559,3126306446,1975924523,1353700161,2814456437,2438597621,1800716203,722146342,2873936343,1151126914,4160483941,2877670899,458611604,2866078500,3483680063,770352098,2652916994,3367839148,3940505011,3585973912,3809620402,718646636,2504206814,2914927912,3631288169,2857486607,2860018678,575749918,2857478043,718488780,2069512688,3548183469,453416197,1106044049,3032691430,52586708,3378514636,3459808877,3211506028,1785789304,218356169,3571399134,3759170522,1194783844,1523787992,3007827094,1975193539,2555452411,1341901877,3045838698,3776907964,3217423946,2802510864,2889438986,1057244207,1636348243,3761863214,1462225785,2632663439,481089165,718503062,24497053,3332243209,3344655856,3655024856,3960371065,1195698900,2971415156,3710176158,2115785917,4027663609,3525578417,2524296189,2745972565,3564906415,1372086093,1452307862,2780501478,1476592880,3389271281,18495466,2378148571,901398090,891748256,3279637769,3157290713,2560960102,1447622437,4284372637,216884176,2086908623,1879786977,3588903153,2242455666,2938092967,3559082096,2810645491,758861177,1121993112,215018983,642190776,4169236812,1196255959,2081185372,3508738393,941322904,4124243163,2877523539,1848581667,2205260958,3180453958,2589345134,3694731276,550028657,2519456284,3789985535,2973870856,2093648313,443148163,46942275,2734146937,1117713533,1115362972,1523183689,3717140224,1551984063],s[1]=[522195092,4010518363,1776537470,960447360,4267822970,4005896314,1435016340,1929119313,2913464185,1310552629,3579470798,3724818106,2579771631,1594623892,417127293,2715217907,2696228731,1508390405,3994398868,3925858569,3695444102,4019471449,3129199795,3770928635,3520741761,990456497,4187484609,2783367035,21106139,3840405339,631373633,3783325702,532942976,396095098,3548038825,4267192484,2564721535,2011709262,2039648873,620404603,3776170075,2898526339,3612357925,4159332703,1645490516,223693667,1567101217,3362177881,1029951347,3470931136,3570957959,1550265121,119497089,972513919,907948164,3840628539,1613718692,3594177948,465323573,2659255085,654439692,2575596212,2699288441,3127702412,277098644,624404830,4100943870,2717858591,546110314,2403699828,3655377447,1321679412,4236791657,1045293279,4010672264,895050893,2319792268,494945126,1914543101,2777056443,3894764339,2219737618,311263384,4275257268,3458730721,669096869,3584475730,3835122877,3319158237,3949359204,2005142349,2713102337,2228954793,3769984788,569394103,3855636576,1425027204,108000370,2736431443,3671869269,3043122623,1750473702,2211081108,762237499,3972989403,2798899386,3061857628,2943854345,867476300,964413654,1591880597,1594774276,2179821409,552026980,3026064248,3726140315,2283577634,3110545105,2152310760,582474363,1582640421,1383256631,2043843868,3322775884,1217180674,463797851,2763038571,480777679,2718707717,2289164131,3118346187,214354409,200212307,3810608407,3025414197,2674075964,3997296425,1847405948,1342460550,510035443,4080271814,815934613,833030224,1620250387,1945732119,2703661145,3966000196,1388869545,3456054182,2687178561,2092620194,562037615,1356438536,3409922145,3261847397,1688467115,2150901366,631725691,3840332284,549916902,3455104640,394546491,837744717,2114462948,751520235,2221554606,2415360136,3999097078,2063029875,803036379,2702586305,821456707,3019566164,360699898,4018502092,3511869016,3677355358,2402471449,812317050,49299192,2570164949,3259169295,2816732080,3331213574,3101303564,2156015656,3705598920,3546263921,143268808,3200304480,1638124008,3165189453,3341807610,578956953,2193977524,3638120073,2333881532,807278310,658237817,2969561766,1641658566,11683945,3086995007,148645947,1138423386,4158756760,1981396783,2401016740,3699783584,380097457,2680394679,2803068651,3334260286,441530178,4016580796,1375954390,761952171,891809099,2183123478,157052462,3683840763,1592404427,341349109,2438483839,1417898363,644327628,2233032776,2353769706,2201510100,220455161,1815641738,182899273,2995019788,3627381533,3702638151,2890684138,1052606899,588164016,1681439879,4038439418,2405343923,4229449282,167996282,1336969661,1688053129,2739224926,1543734051,1046297529,1138201970,2121126012,115334942,1819067631,1902159161,1941945968,2206692869,1159982321],s[2]=[2381300288,637164959,3952098751,3893414151,1197506559,916448331,2350892612,2932787856,3199334847,4009478890,3905886544,1373570990,2450425862,4037870920,3778841987,2456817877,286293407,124026297,3001279700,1028597854,3115296800,4208886496,2691114635,2188540206,1430237888,1218109995,3572471700,308166588,570424558,2187009021,2455094765,307733056,1310360322,3135275007,1384269543,2388071438,863238079,2359263624,2801553128,3380786597,2831162807,1470087780,1728663345,4072488799,1090516929,532123132,2389430977,1132193179,2578464191,3051079243,1670234342,1434557849,2711078940,1241591150,3314043432,3435360113,3091448339,1812415473,2198440252,267246943,796911696,3619716990,38830015,1526438404,2806502096,374413614,2943401790,1489179520,1603809326,1920779204,168801282,260042626,2358705581,1563175598,2397674057,1356499128,2217211040,514611088,2037363785,2186468373,4022173083,2792511869,2913485016,1173701892,4200428547,3896427269,1334932762,2455136706,602925377,2835607854,1613172210,41346230,2499634548,2457437618,2188827595,41386358,4172255629,1313404830,2405527007,3801973774,2217704835,873260488,2528884354,2478092616,4012915883,2555359016,2006953883,2463913485,575479328,2218240648,2099895446,660001756,2341502190,3038761536,3888151779,3848713377,3286851934,1022894237,1620365795,3449594689,1551255054,15374395,3570825345,4249311020,4151111129,3181912732,310226346,1133119310,530038928,136043402,2476768958,3107506709,2544909567,1036173560,2367337196,1681395281,1758231547,3641649032,306774401,1575354324,3716085866,1990386196,3114533736,2455606671,1262092282,3124342505,2768229131,4210529083,1833535011,423410938,660763973,2187129978,1639812e3,3508421329,3467445492,310289298,272797111,2188552562,2456863912,310240523,677093832,1013118031,901835429,3892695601,1116285435,3036471170,1337354835,243122523,520626091,277223598,4244441197,4194248841,1766575121,594173102,316590669,742362309,3536858622,4176435350,3838792410,2501204839,1229605004,3115755532,1552908988,2312334149,979407927,3959474601,1148277331,176638793,3614686272,2083809052,40992502,1340822838,2731552767,3535757508,3560899520,1354035053,122129617,7215240,2732932949,3118912700,2718203926,2539075635,3609230695,3725561661,1928887091,2882293555,1988674909,2063640240,2491088897,1459647954,4189817080,2302804382,1113892351,2237858528,1927010603,4002880361,1856122846,1594404395,2944033133,3855189863,3474975698,1643104450,4054590833,3431086530,1730235576,2984608721,3084664418,2131803598,4178205752,267404349,1617849798,1616132681,1462223176,736725533,2327058232,551665188,2945899023,1749386277,2575514597,1611482493,674206544,2201269090,3642560800,728599968,1680547377,2620414464,1388111496,453204106,4156223445,1094905244,2754698257,2201108165,3757000246,2704524545,3922940700,3996465027],s[3]=[2645754912,532081118,2814278639,3530793624,1246723035,1689095255,2236679235,4194438865,2116582143,3859789411,157234593,2045505824,4245003587,1687664561,4083425123,605965023,672431967,1336064205,3376611392,214114848,4258466608,3232053071,489488601,605322005,3998028058,264917351,1912574028,756637694,436560991,202637054,135989450,85393697,2152923392,3896401662,2895836408,2145855233,3535335007,115294817,3147733898,1922296357,3464822751,4117858305,1037454084,2725193275,2127856640,1417604070,1148013728,1827919605,642362335,2929772533,909348033,1346338451,3547799649,297154785,1917849091,4161712827,2883604526,3968694238,1469521537,3780077382,3375584256,1763717519,136166297,4290970789,1295325189,2134727907,2798151366,1566297257,3672928234,2677174161,2672173615,965822077,2780786062,289653839,1133871874,3491843819,35685304,1068898316,418943774,672553190,642281022,2346158704,1954014401,3037126780,4079815205,2030668546,3840588673,672283427,1776201016,359975446,3750173538,555499703,2769985273,1324923,69110472,152125443,3176785106,3822147285,1340634837,798073664,1434183902,15393959,216384236,1303690150,3881221631,3711134124,3960975413,106373927,2578434224,1455997841,1801814300,1578393881,1854262133,3188178946,3258078583,2302670060,1539295533,3505142565,3078625975,2372746020,549938159,3278284284,2620926080,181285381,2865321098,3970029511,68876850,488006234,1728155692,2608167508,836007927,2435231793,919367643,3339422534,3655756360,1457871481,40520939,1380155135,797931188,234455205,2255801827,3990488299,397000196,739833055,3077865373,2871719860,4022553888,772369276,390177364,3853951029,557662966,740064294,1640166671,1699928825,3535942136,622006121,3625353122,68743880,1742502,219489963,1664179233,1577743084,1236991741,410585305,2366487942,823226535,1050371084,3426619607,3586839478,212779912,4147118561,1819446015,1911218849,530248558,3486241071,3252585495,2886188651,3410272728,2342195030,20547779,2982490058,3032363469,3631753222,312714466,1870521650,1493008054,3491686656,615382978,4103671749,2534517445,1932181,2196105170,278426614,6369430,3274544417,2913018367,697336853,2143000447,2946413531,701099306,1558357093,2805003052,3500818408,2321334417,3567135975,216290473,3591032198,23009561,1996984579,3735042806,2024298078,3739440863,569400510,2339758983,3016033873,3097871343,3639523026,3844324983,3256173865,795471839,2951117563,4101031090,4091603803,3603732598,971261452,534414648,428311343,3389027175,2844869880,694888862,1227866773,2456207019,3043454569,2614353370,3749578031,3676663836,459166190,4132644070,1794958188,51825668,2252611902,3084671440,2036672799,3436641603,1099053433,2469121526,3059204941,1323291266,2061838604,1018778475,2233344254,2553501054,334295216,3556750194,1065731521,183467730],s[4]=[2127105028,745436345,2601412319,2788391185,3093987327,500390133,1155374404,389092991,150729210,3891597772,3523549952,1935325696,716645080,946045387,2901812282,1774124410,3869435775,4039581901,3293136918,3438657920,948246080,363898952,3867875531,1286266623,1598556673,68334250,630723836,1104211938,1312863373,613332731,2377784574,1101634306,441780740,3129959883,1917973735,2510624549,3238456535,2544211978,3308894634,1299840618,4076074851,1756332096,3977027158,297047435,3790297736,2265573040,3621810518,1311375015,1667687725,47300608,3299642885,2474112369,201668394,1468347890,576830978,3594690761,3742605952,1958042578,1747032512,3558991340,1408974056,3366841779,682131401,1033214337,1545599232,4265137049,206503691,103024618,2855227313,1337551222,2428998917,2963842932,4015366655,3852247746,2796956967,3865723491,3747938335,247794022,3755824572,702416469,2434691994,397379957,851939612,2314769512,218229120,1380406772,62274761,214451378,3170103466,2276210409,3845813286,28563499,446592073,1693330814,3453727194,29968656,3093872512,220656637,2470637031,77972100,1667708854,1358280214,4064765667,2395616961,325977563,4277240721,4220025399,3605526484,3355147721,811859167,3069544926,3962126810,652502677,3075892249,4132761541,3498924215,1217549313,3250244479,3858715919,3053989961,1538642152,2279026266,2875879137,574252750,3324769229,2651358713,1758150215,141295887,2719868960,3515574750,4093007735,4194485238,1082055363,3417560400,395511885,2966884026,179534037,3646028556,3738688086,1092926436,2496269142,257381841,3772900718,1636087230,1477059743,2499234752,3811018894,2675660129,3285975680,90732309,1684827095,1150307763,1723134115,3237045386,1769919919,1240018934,815675215,750138730,2239792499,1234303040,1995484674,138143821,675421338,1145607174,1936608440,3238603024,2345230278,2105974004,323969391,779555213,3004902369,2861610098,1017501463,2098600890,2628620304,2940611490,2682542546,1171473753,3656571411,3687208071,4091869518,393037935,159126506,1662887367,1147106178,391545844,3452332695,1891500680,3016609650,1851642611,546529401,1167818917,3194020571,2848076033,3953471836,575554290,475796850,4134673196,450035699,2351251534,844027695,1080539133,86184846,1554234488,3692025454,1972511363,2018339607,1491841390,1141460869,1061690759,4244549243,2008416118,2351104703,2868147542,1598468138,722020353,1027143159,212344630,1387219594,1725294528,3745187956,2500153616,458938280,4129215917,1828119673,544571780,3503225445,2297937496,1241802790,267843827,2694610800,1397140384,1558801448,3782667683,1806446719,929573330,2234912681,400817706,616011623,4121520928,3603768725,1761550015,1968522284,4053731006,4192232858,4005120285,872482584,3140537016,3894607381,2287405443,1963876937,3663887957,1584857e3,2975024454,1833426440,4025083860],s[5]=[4143615901,749497569,1285769319,3795025788,2514159847,23610292,3974978748,844452780,3214870880,3751928557,2213566365,1676510905,448177848,3730751033,4086298418,2307502392,871450977,3222878141,4110862042,3831651966,2735270553,1310974780,2043402188,1218528103,2736035353,4274605013,2702448458,3936360550,2693061421,162023535,2827510090,687910808,23484817,3784910947,3371371616,779677500,3503626546,3473927188,4157212626,3500679282,4248902014,2466621104,3899384794,1958663117,925738300,1283408968,3669349440,1840910019,137959847,2679828185,1239142320,1315376211,1547541505,1690155329,739140458,3128809933,3933172616,3876308834,905091803,1548541325,4040461708,3095483362,144808038,451078856,676114313,2861728291,2469707347,993665471,373509091,2599041286,4025009006,4170239449,2149739950,3275793571,3749616649,2794760199,1534877388,572371878,2590613551,1753320020,3467782511,1405125690,4270405205,633333386,3026356924,3475123903,632057672,2846462855,1404951397,3882875879,3915906424,195638627,2385783745,3902872553,1233155085,3355999740,2380578713,2702246304,2144565621,3663341248,3894384975,2502479241,4248018925,3094885567,1594115437,572884632,3385116731,767645374,1331858858,1475698373,3793881790,3532746431,1321687957,619889600,1121017241,3440213920,2070816767,2833025776,1933951238,4095615791,890643334,3874130214,859025556,360630002,925594799,1764062180,3920222280,4078305929,979562269,2810700344,4087740022,1949714515,546639971,1165388173,3069891591,1495988560,922170659,1291546247,2107952832,1813327274,3406010024,3306028637,4241950635,153207855,2313154747,1608695416,1150242611,1967526857,721801357,1220138373,3691287617,3356069787,2112743302,3281662835,1111556101,1778980689,250857638,2298507990,673216130,2846488510,3207751581,3562756981,3008625920,3417367384,2198807050,529510932,3547516680,3426503187,2364944742,102533054,2294910856,1617093527,1204784762,3066581635,1019391227,1069574518,1317995090,1691889997,3661132003,510022745,3238594800,1362108837,1817929911,2184153760,805817662,1953603311,3699844737,120799444,2118332377,207536705,2282301548,4120041617,145305846,2508124933,3086745533,3261524335,1877257368,2977164480,3160454186,2503252186,4221677074,759945014,254147243,2767453419,3801518371,629083197,2471014217,907280572,3900796746,940896768,2751021123,2625262786,3161476951,3661752313,3260732218,1425318020,2977912069,1496677566,3988592072,2140652971,3126511541,3069632175,977771578,1392695845,1698528874,1411812681,1369733098,1343739227,3620887944,1142123638,67414216,3102056737,3088749194,1626167401,2546293654,3941374235,697522451,33404913,143560186,2595682037,994885535,1247667115,3859094837,2699155541,3547024625,4114935275,2968073508,3199963069,2732024527,1237921620,951448369,1898488916,1211705605,2790989240,2233243581,3598044975],s[6]=[2246066201,858518887,1714274303,3485882003,713916271,2879113490,3730835617,539548191,36158695,1298409750,419087104,1358007170,749914897,2989680476,1261868530,2995193822,2690628854,3443622377,3780124940,3796824509,2976433025,4259637129,1551479e3,512490819,1296650241,951993153,2436689437,2460458047,144139966,3136204276,310820559,3068840729,643875328,1969602020,1680088954,2185813161,3283332454,672358534,198762408,896343282,276269502,3014846926,84060815,197145886,376173866,3943890818,3813173521,3545068822,1316698879,1598252827,2633424951,1233235075,859989710,2358460855,3503838400,3409603720,1203513385,1193654839,2792018475,2060853022,207403770,1144516871,3068631394,1121114134,177607304,3785736302,326409831,1929119770,2983279095,4183308101,3474579288,3200513878,3228482096,119610148,1170376745,3378393471,3163473169,951863017,3337026068,3135789130,2907618374,1183797387,2015970143,4045674555,2182986399,2952138740,3928772205,384012900,2454997643,10178499,2879818989,2596892536,111523738,2995089006,451689641,3196290696,235406569,1441906262,3890558523,3013735005,4158569349,1644036924,376726067,1006849064,3664579700,2041234796,1021632941,1374734338,2566452058,371631263,4007144233,490221539,206551450,3140638584,1053219195,1853335209,3412429660,3562156231,735133835,1623211703,3104214392,2738312436,4096837757,3366392578,3110964274,3956598718,3196820781,2038037254,3877786376,2339753847,300912036,3766732888,2372630639,1516443558,4200396704,1574567987,4069441456,4122592016,2699739776,146372218,2748961456,2043888151,35287437,2596680554,655490400,1132482787,110692520,1031794116,2188192751,1324057718,1217253157,919197030,686247489,3261139658,1028237775,3135486431,3059715558,2460921700,986174950,2661811465,4062904701,2752986992,3709736643,367056889,1353824391,731860949,1650113154,1778481506,784341916,357075625,3608602432,1074092588,2480052770,3811426202,92751289,877911070,3600361838,1231880047,480201094,3756190983,3094495953,434011822,87971354,363687820,1717726236,1901380172,3926403882,2481662265,400339184,1490350766,2661455099,1389319756,2558787174,784598401,1983468483,30828846,3550527752,2716276238,3841122214,1765724805,1955612312,1277890269,1333098070,1564029816,2704417615,1026694237,3287671188,1260819201,3349086767,1016692350,1582273796,1073413053,1995943182,694588404,1025494639,3323872702,3551898420,4146854327,453260480,1316140391,1435673405,3038941953,3486689407,1622062951,403978347,817677117,950059133,4246079218,3278066075,1486738320,1417279718,481875527,2549965225,3933690356,760697757,1452955855,3897451437,1177426808,1702951038,4085348628,2447005172,1084371187,3516436277,3068336338,1073369276,1027665953,3284188590,1230553676,1368340146,2226246512,267243139,2274220762,4070734279,2497715176,2423353163,2504755875],s[7]=[3793104909,3151888380,2817252029,895778965,2005530807,3871412763,237245952,86829237,296341424,3851759377,3974600970,2475086196,709006108,1994621201,2972577594,937287164,3734691505,168608556,3189338153,2225080640,3139713551,3033610191,3025041904,77524477,185966941,1208824168,2344345178,1721625922,3354191921,1066374631,1927223579,1971335949,2483503697,1551748602,2881383779,2856329572,3003241482,48746954,1398218158,2050065058,313056748,4255789917,393167848,1912293076,940740642,3465845460,3091687853,2522601570,2197016661,1727764327,364383054,492521376,1291706479,3264136376,1474851438,1685747964,2575719748,1619776915,1814040067,970743798,1561002147,2925768690,2123093554,1880132620,3151188041,697884420,2550985770,2607674513,2659114323,110200136,1489731079,997519150,1378877361,3527870668,478029773,2766872923,1022481122,431258168,1112503832,897933369,2635587303,669726182,3383752315,918222264,163866573,3246985393,3776823163,114105080,1903216136,761148244,3571337562,1690750982,3166750252,1037045171,1888456500,2010454850,642736655,616092351,365016990,1185228132,4174898510,1043824992,2023083429,2241598885,3863320456,3279669087,3674716684,108438443,2132974366,830746235,606445527,4173263986,2204105912,1844756978,2532684181,4245352700,2969441100,3796921661,1335562986,4061524517,2720232303,2679424040,634407289,885462008,3294724487,3933892248,2094100220,339117932,4048830727,3202280980,1458155303,2689246273,1022871705,2464987878,3714515309,353796843,2822958815,4256850100,4052777845,551748367,618185374,3778635579,4020649912,1904685140,3069366075,2670879810,3407193292,2954511620,4058283405,2219449317,3135758300,1120655984,3447565834,1474845562,3577699062,550456716,3466908712,2043752612,881257467,869518812,2005220179,938474677,3305539448,3850417126,1315485940,3318264702,226533026,965733244,321539988,1136104718,804158748,573969341,3708209826,937399083,3290727049,2901666755,1461057207,4013193437,4066861423,3242773476,2421326174,1581322155,3028952165,786071460,3900391652,3918438532,1485433313,4023619836,3708277595,3678951060,953673138,1467089153,1930354364,1533292819,2492563023,1346121658,1685000834,1965281866,3765933717,4190206607,2052792609,3515332758,690371149,3125873887,2180283551,2903598061,3933952357,436236910,289419410,14314871,1242357089,2904507907,1616633776,2666382180,585885352,3471299210,2699507360,1432659641,277164553,3354103607,770115018,2303809295,3741942315,3177781868,2853364978,2269453327,3774259834,987383833,1290892879,225909803,1741533526,890078084,1496906255,1111072499,916028167,243534141,1252605537,2204162171,531204876,290011180,3916834213,102027703,237315147,209093447,1486785922,220223953,2758195998,4175039106,82940208,3127791296,2569425252,518464269,1353887104,3941492737,2377294467,3935040926]}function Nc(e){this.cast5=new Xj,this.cast5.setKey(e),this.encrypt=function(t){return this.cast5.encrypt(t)}}Lc.keySize=Lc.prototype.keySize=24,Lc.blockSize=Lc.prototype.blockSize=8,Nc.blockSize=Nc.prototype.blockSize=8,Nc.keySize=Nc.prototype.keySize=16;const na=4294967295;function La(e,t){return(e< >>32-t)&na}function vs(e,t){return e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24}function Ks(e,t,r){e.splice(t,4,255&r,r>>>8&255,r>>>16&255,r>>>24&255)}function wn(e,t){return e>>>8*t&255}function Bc(e){this.tf=function(){let t=null,r=null,i=-1,a=[],s=[[],[],[],[]];function u(p){return s[0][wn(p,0)]^s[1][wn(p,1)]^s[2][wn(p,2)]^s[3][wn(p,3)]}function c(p){return s[0][wn(p,3)]^s[1][wn(p,0)]^s[2][wn(p,1)]^s[3][wn(p,2)]}function h(p,d){let v=u(d[0]),m=c(d[1]);d[2]=La(d[2]^v+m+a[4*p+8]&na,31),d[3]=La(d[3],1)^v+2*m+a[4*p+9]&na,v=u(d[2]),m=c(d[3]),d[0]=La(d[0]^v+m+a[4*p+10]&na,31),d[1]=La(d[1],1)^v+2*m+a[4*p+11]&na}function n(p,d){let v=u(d[0]),m=c(d[1]);d[2]=La(d[2],1)^v+m+a[4*p+10]&na,d[3]=La(d[3]^v+2*m+a[4*p+11]&na,31),v=u(d[2]),m=c(d[3]),d[0]=La(d[0],1)^v+m+a[4*p+8]&na,d[1]=La(d[1]^v+2*m+a[4*p+9]&na,31)}return{name:"twofish",blocksize:16,open:function(p){let d,v,m,g,y;t=p;const b=[],k=[],O=[];let S;const x=[];let E,w,T;const M=[[8,1,7,13,6,15,3,2,0,11,5,9,14,12,10,4],[2,8,11,13,15,7,6,14,3,1,9,4,0,10,12,5]],A=[[14,12,11,8,1,2,3,5,15,4,10,6,7,0,9,13],[1,14,2,11,4,12,3,7,6,13,10,5,15,9,0,8]],L=[[11,10,5,14,6,13,9,0,12,8,15,3,2,4,7,1],[4,12,7,5,1,6,9,10,0,14,13,8,2,11,3,15]],Y=[[13,7,15,4,1,2,6,14,9,11,3,0,8,5,12,10],[11,9,5,1,12,3,13,14,6,4,7,15,2,0,8,10]],N=[0,8,1,9,2,10,3,11,4,12,5,13,6,14,7,15],W=[0,9,2,11,4,13,6,15,8,1,10,3,12,5,14,7],j=[[],[]],ue=[[],[],[],[]];function Te(ie){return ie^ie>>2^[0,90,180,238][3&ie]}function pe(ie){return ie^ie>>1^ie>>2^[0,238,180,90][3&ie]}function ye(ie,be){let Ie,De,ae;for(Ie=0;Ie<8;Ie++)De=be>>>24,be=be<<8&na|ie>>>24,ie=ie<<8&na,ae=De<<1,128&De&&(ae^=333),be^=De^ae<<16,ae^=De>>>1,1&De&&(ae^=166),be^=ae<<24|ae<<8;return be}function de(ie,be){const Ie=be>>4,De=15&be,ae=M[ie][Ie^De],ee=A[ie][N[De]^W[Ie]];return Y[ie][N[ee]^W[ae]]<<4|L[ie][ae^ee]}function ke(ie,be){let Ie=wn(ie,0),De=wn(ie,1),ae=wn(ie,2),ee=wn(ie,3);switch(S){case 4:Ie=j[1][Ie]^wn(be[3],0),De=j[0][De]^wn(be[3],1),ae=j[0][ae]^wn(be[3],2),ee=j[1][ee]^wn(be[3],3);case 3:Ie=j[1][Ie]^wn(be[2],0),De=j[1][De]^wn(be[2],1),ae=j[0][ae]^wn(be[2],2),ee=j[0][ee]^wn(be[2],3);case 2:Ie=j[0][j[0][Ie]^wn(be[1],0)]^wn(be[0],0),De=j[0][j[1][De]^wn(be[1],1)]^wn(be[0],1),ae=j[1][j[0][ae]^wn(be[1],2)]^wn(be[0],2),ee=j[1][j[1][ee]^wn(be[1],3)]^wn(be[0],3)}return ue[0][Ie]^ue[1][De]^ue[2][ae]^ue[3][ee]}for(t=t.slice(0,32),d=t.length;d!==16&&d!==24&&d!==32;)t[d++]=0;for(d=0;d >2]=vs(t,d);for(d=0;d<256;d++)j[0][d]=de(0,d),j[1][d]=de(1,d);for(d=0;d<256;d++)E=j[1][d],w=Te(E),T=pe(E),ue[0][d]=E+(w<<8)+(T<<16)+(T<<24),ue[2][d]=w+(T<<8)+(E<<16)+(T<<24),E=j[0][d],w=Te(E),T=pe(E),ue[1][d]=T+(T<<8)+(w<<16)+(E<<24),ue[3][d]=w+(E<<8)+(T<<16)+(w<<24);for(S=O.length/2,d=0;d =0;m--)n(m,v);Ks(r,i,v[2]^a[0]),Ks(r,i+4,v[3]^a[1]),Ks(r,i+8,v[0]^a[2]),Ks(r,i+12,v[1]^a[3]),i+=16},finalize:function(){return r}}}(),this.tf.open(Array.from(e),0),this.encrypt=function(t){return this.tf.encrypt(Array.from(t),0)}}function fa(){}function Fc(e){this.bf=new fa,this.bf.init(e),this.encrypt=function(t){return this.bf.encryptBlock(t)}}Bc.keySize=Bc.prototype.keySize=32,Bc.blockSize=Bc.prototype.blockSize=16,fa.prototype.BLOCKSIZE=8,fa.prototype.SBOXES=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]],fa.prototype.PARRAY=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],fa.prototype.NN=16,fa.prototype._clean=function(e){return e<0&&(e=(2147483647&e)+2147483648),e},fa.prototype._F=function(e){let t;const r=255&e,i=255&(e>>>=8),a=255&(e>>>=8),s=255&(e>>>=8);return t=this.sboxes[0][s]+this.sboxes[1][a],t^=this.sboxes[2][i],t+=this.sboxes[3][r],t},fa.prototype._encryptBlock=function(e){let t,r=e[0],i=e[1];for(t=0;t>>24-8*t&255,a[t+i]=r[1]>>>24-8*t&255;return a},fa.prototype._decryptBlock=function(e){let t,r=e[0],i=e[1];for(t=this.NN+1;t>1;--t){r^=this.parray[t],i=this._F(r)^i;const a=r;r=i,i=a}r^=this.parray[1],i^=this.parray[0],e[0]=this._clean(i),e[1]=this._clean(r)},fa.prototype.init=function(e){let t,r=0;for(this.parray=[],t=0;t =e.length&&(r=0);this.parray[t]=this.PARRAY[t]^a}for(this.sboxes=[],t=0;t<4;++t)for(this.sboxes[t]=[],r=0;r<256;++r)this.sboxes[t][r]=this.SBOXES[t][r];const i=[0,0];for(t=0;t >>27)+Oe+(H&re|~H&Z)+1518500249|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,U=ye+(X<<5|X>>>27)+Oe+(H&re|~H&Z)+1518500249|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,U=de+(X<<5|X>>>27)+Oe+(H&re|~H&Z)+1518500249|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,U=ke+(X<<5|X>>>27)+Oe+(H&re|~H&Z)+1518500249|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,U=ie+(X<<5|X>>>27)+Oe+(H&re|~H&Z)+1518500249|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,U=be+(X<<5|X>>>27)+Oe+(H&re|~H&Z)+1518500249|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,U=Ie+(X<<5|X>>>27)+Oe+(H&re|~H&Z)+1518500249|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,U=De+(X<<5|X>>>27)+Oe+(H&re|~H&Z)+1518500249|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,U=ae+(X<<5|X>>>27)+Oe+(H&re|~H&Z)+1518500249|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,U=ee+(X<<5|X>>>27)+Oe+(H&re|~H&Z)+1518500249|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,U=F+(X<<5|X>>>27)+Oe+(H&re|~H&Z)+1518500249|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,U=I+(X<<5|X>>>27)+Oe+(H&re|~H&Z)+1518500249|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,U=J+(X<<5|X>>>27)+Oe+(H&re|~H&Z)+1518500249|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,U=q+(X<<5|X>>>27)+Oe+(H&re|~H&Z)+1518500249|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,U=fe+(X<<5|X>>>27)+Oe+(H&re|~H&Z)+1518500249|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,U=Ce+(X<<5|X>>>27)+Oe+(H&re|~H&Z)+1518500249|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,ve=q^ae^de^pe,xe=ve<<1|ve>>>31,U=xe+(X<<5|X>>>27)+Oe+(H&re|~H&Z)+1518500249|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,ve=fe^ee^ke^ye,me=ve<<1|ve>>>31,U=me+(X<<5|X>>>27)+Oe+(H&re|~H&Z)+1518500249|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,ve=Ce^F^ie^de,se=ve<<1|ve>>>31,U=se+(X<<5|X>>>27)+Oe+(H&re|~H&Z)+1518500249|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,ve=xe^I^be^ke,B=ve<<1|ve>>>31,U=B+(X<<5|X>>>27)+Oe+(H&re|~H&Z)+1518500249|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,ve=me^J^Ie^ie,V=ve<<1|ve>>>31,U=V+(X<<5|X>>>27)+Oe+(H^re^Z)+1859775393|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,ve=se^q^De^be,G=ve<<1|ve>>>31,U=G+(X<<5|X>>>27)+Oe+(H^re^Z)+1859775393|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,ve=B^fe^ae^Ie,te=ve<<1|ve>>>31,U=te+(X<<5|X>>>27)+Oe+(H^re^Z)+1859775393|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,ve=V^Ce^ee^De,oe=ve<<1|ve>>>31,U=oe+(X<<5|X>>>27)+Oe+(H^re^Z)+1859775393|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,ve=G^xe^F^ae,_e=ve<<1|ve>>>31,U=_e+(X<<5|X>>>27)+Oe+(H^re^Z)+1859775393|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,ve=te^me^I^ee,ce=ve<<1|ve>>>31,U=ce+(X<<5|X>>>27)+Oe+(H^re^Z)+1859775393|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,ve=oe^se^J^F,le=ve<<1|ve>>>31,U=le+(X<<5|X>>>27)+Oe+(H^re^Z)+1859775393|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,ve=_e^B^q^I,Ve=ve<<1|ve>>>31,U=Ve+(X<<5|X>>>27)+Oe+(H^re^Z)+1859775393|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,ve=ce^V^fe^J,Je=ve<<1|ve>>>31,U=Je+(X<<5|X>>>27)+Oe+(H^re^Z)+1859775393|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,ve=le^G^Ce^q,gt=ve<<1|ve>>>31,U=gt+(X<<5|X>>>27)+Oe+(H^re^Z)+1859775393|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,ve=Ve^te^xe^fe,Pt=ve<<1|ve>>>31,U=Pt+(X<<5|X>>>27)+Oe+(H^re^Z)+1859775393|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,ve=Je^oe^me^Ce,At=ve<<1|ve>>>31,U=At+(X<<5|X>>>27)+Oe+(H^re^Z)+1859775393|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,ve=gt^_e^se^xe,It=ve<<1|ve>>>31,U=It+(X<<5|X>>>27)+Oe+(H^re^Z)+1859775393|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,ve=Pt^ce^B^me,ht=ve<<1|ve>>>31,U=ht+(X<<5|X>>>27)+Oe+(H^re^Z)+1859775393|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,ve=At^le^V^se,Rt=ve<<1|ve>>>31,U=Rt+(X<<5|X>>>27)+Oe+(H^re^Z)+1859775393|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,ve=It^Ve^G^B,Tt=ve<<1|ve>>>31,U=Tt+(X<<5|X>>>27)+Oe+(H^re^Z)+1859775393|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,ve=ht^Je^te^V,dn=ve<<1|ve>>>31,U=dn+(X<<5|X>>>27)+Oe+(H^re^Z)+1859775393|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,ve=Rt^gt^oe^G,nn=ve<<1|ve>>>31,U=nn+(X<<5|X>>>27)+Oe+(H^re^Z)+1859775393|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,ve=Tt^Pt^_e^te,Xt=ve<<1|ve>>>31,U=Xt+(X<<5|X>>>27)+Oe+(H^re^Z)+1859775393|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,ve=dn^At^ce^oe,Gt=ve<<1|ve>>>31,U=Gt+(X<<5|X>>>27)+Oe+(H^re^Z)+1859775393|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,ve=nn^It^le^_e,Zt=ve<<1|ve>>>31,U=Zt+(X<<5|X>>>27)+Oe+(H&re|H&Z|re&Z)-1894007588|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,ve=Xt^ht^Ve^ce,Yt=ve<<1|ve>>>31,U=Yt+(X<<5|X>>>27)+Oe+(H&re|H&Z|re&Z)-1894007588|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,ve=Gt^Rt^Je^le,un=ve<<1|ve>>>31,U=un+(X<<5|X>>>27)+Oe+(H&re|H&Z|re&Z)-1894007588|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,ve=Zt^Tt^gt^Ve,qt=ve<<1|ve>>>31,U=qt+(X<<5|X>>>27)+Oe+(H&re|H&Z|re&Z)-1894007588|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,ve=Yt^dn^Pt^Je,rt=ve<<1|ve>>>31,U=rt+(X<<5|X>>>27)+Oe+(H&re|H&Z|re&Z)-1894007588|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,ve=un^nn^At^gt,at=ve<<1|ve>>>31,U=at+(X<<5|X>>>27)+Oe+(H&re|H&Z|re&Z)-1894007588|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,ve=qt^Xt^It^Pt,xt=ve<<1|ve>>>31,U=xt+(X<<5|X>>>27)+Oe+(H&re|H&Z|re&Z)-1894007588|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,ve=rt^Gt^ht^At,Ut=ve<<1|ve>>>31,U=Ut+(X<<5|X>>>27)+Oe+(H&re|H&Z|re&Z)-1894007588|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,ve=at^Zt^Rt^It,Ee=ve<<1|ve>>>31,U=Ee+(X<<5|X>>>27)+Oe+(H&re|H&Z|re&Z)-1894007588|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,ve=xt^Yt^Tt^ht,Be=ve<<1|ve>>>31,U=Be+(X<<5|X>>>27)+Oe+(H&re|H&Z|re&Z)-1894007588|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,ve=Ut^un^dn^Rt,Fe=ve<<1|ve>>>31,U=Fe+(X<<5|X>>>27)+Oe+(H&re|H&Z|re&Z)-1894007588|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,ve=Ee^qt^nn^Tt,Le=ve<<1|ve>>>31,U=Le+(X<<5|X>>>27)+Oe+(H&re|H&Z|re&Z)-1894007588|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,ve=Be^rt^Xt^dn,tt=ve<<1|ve>>>31,U=tt+(X<<5|X>>>27)+Oe+(H&re|H&Z|re&Z)-1894007588|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,ve=Fe^at^Gt^nn,ot=ve<<1|ve>>>31,U=ot+(X<<5|X>>>27)+Oe+(H&re|H&Z|re&Z)-1894007588|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,ve=Le^xt^Zt^Xt,pt=ve<<1|ve>>>31,U=pt+(X<<5|X>>>27)+Oe+(H&re|H&Z|re&Z)-1894007588|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,ve=tt^Ut^Yt^Gt,yt=ve<<1|ve>>>31,U=yt+(X<<5|X>>>27)+Oe+(H&re|H&Z|re&Z)-1894007588|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,ve=ot^Ee^un^Zt,Dt=ve<<1|ve>>>31,U=Dt+(X<<5|X>>>27)+Oe+(H&re|H&Z|re&Z)-1894007588|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,ve=pt^Be^qt^Yt,jt=ve<<1|ve>>>31,U=jt+(X<<5|X>>>27)+Oe+(H&re|H&Z|re&Z)-1894007588|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,ve=yt^Fe^rt^un,Ht=ve<<1|ve>>>31,U=Ht+(X<<5|X>>>27)+Oe+(H&re|H&Z|re&Z)-1894007588|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,ve=Dt^Le^at^qt,zt=ve<<1|ve>>>31,U=zt+(X<<5|X>>>27)+Oe+(H&re|H&Z|re&Z)-1894007588|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,ve=jt^tt^xt^rt,en=ve<<1|ve>>>31,U=en+(X<<5|X>>>27)+Oe+(H^re^Z)-899497514|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,ve=Ht^ot^Ut^at,Qt=ve<<1|ve>>>31,U=Qt+(X<<5|X>>>27)+Oe+(H^re^Z)-899497514|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,ve=zt^pt^Ee^xt,rn=ve<<1|ve>>>31,U=rn+(X<<5|X>>>27)+Oe+(H^re^Z)-899497514|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,ve=en^yt^Be^Ut,On=ve<<1|ve>>>31,U=On+(X<<5|X>>>27)+Oe+(H^re^Z)-899497514|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,ve=Qt^Dt^Fe^Ee,ir=ve<<1|ve>>>31,U=ir+(X<<5|X>>>27)+Oe+(H^re^Z)-899497514|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,ve=rn^jt^Le^Be,ar=ve<<1|ve>>>31,U=ar+(X<<5|X>>>27)+Oe+(H^re^Z)-899497514|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,ve=On^Ht^tt^Fe,Yn=ve<<1|ve>>>31,U=Yn+(X<<5|X>>>27)+Oe+(H^re^Z)-899497514|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,ve=ir^zt^ot^Le,jn=ve<<1|ve>>>31,U=jn+(X<<5|X>>>27)+Oe+(H^re^Z)-899497514|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,ve=ar^en^pt^tt,Dr=ve<<1|ve>>>31,U=Dr+(X<<5|X>>>27)+Oe+(H^re^Z)-899497514|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,ve=Yn^Qt^yt^ot,hr=ve<<1|ve>>>31,U=hr+(X<<5|X>>>27)+Oe+(H^re^Z)-899497514|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,ve=jn^rn^Dt^pt,yi=ve<<1|ve>>>31,U=yi+(X<<5|X>>>27)+Oe+(H^re^Z)-899497514|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,ve=Dr^On^jt^yt,Rr=ve<<1|ve>>>31,U=Rr+(X<<5|X>>>27)+Oe+(H^re^Z)-899497514|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,ve=hr^ir^Ht^Dt,ai=ve<<1|ve>>>31,U=ai+(X<<5|X>>>27)+Oe+(H^re^Z)-899497514|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,ve=yi^ar^zt^jt,bi=ve<<1|ve>>>31,U=bi+(X<<5|X>>>27)+Oe+(H^re^Z)-899497514|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,ve=Rr^Yn^en^Ht,sr=ve<<1|ve>>>31,U=sr+(X<<5|X>>>27)+Oe+(H^re^Z)-899497514|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,ve=ai^jn^Qt^zt,Cr=ve<<1|ve>>>31,U=Cr+(X<<5|X>>>27)+Oe+(H^re^Z)-899497514|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,ve=bi^Dr^rn^en,si=ve<<1|ve>>>31,U=si+(X<<5|X>>>27)+Oe+(H^re^Z)-899497514|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,ve=sr^hr^On^Qt,wi=ve<<1|ve>>>31,U=wi+(X<<5|X>>>27)+Oe+(H^re^Z)-899497514|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,ve=Cr^yi^ir^rn,Me=ve<<1|ve>>>31,U=Me+(X<<5|X>>>27)+Oe+(H^re^Z)-899497514|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,ve=si^Rr^ar^On,We=ve<<1|ve>>>31,U=We+(X<<5|X>>>27)+Oe+(H^re^Z)-899497514|0,Oe=Z,Z=re,re=H<<30|H>>>2,H=X,X=U,i=i+X|0,a=a+H|0,s=s+re|0,u=u+Z|0,c=c+Oe|0}function w(pe){pe=pe|0,E(x[pe|0]<<24|x[pe|1]<<16|x[pe|2]<<8|x[pe|3],x[pe|4]<<24|x[pe|5]<<16|x[pe|6]<<8|x[pe|7],x[pe|8]<<24|x[pe|9]<<16|x[pe|10]<<8|x[pe|11],x[pe|12]<<24|x[pe|13]<<16|x[pe|14]<<8|x[pe|15],x[pe|16]<<24|x[pe|17]<<16|x[pe|18]<<8|x[pe|19],x[pe|20]<<24|x[pe|21]<<16|x[pe|22]<<8|x[pe|23],x[pe|24]<<24|x[pe|25]<<16|x[pe|26]<<8|x[pe|27],x[pe|28]<<24|x[pe|29]<<16|x[pe|30]<<8|x[pe|31],x[pe|32]<<24|x[pe|33]<<16|x[pe|34]<<8|x[pe|35],x[pe|36]<<24|x[pe|37]<<16|x[pe|38]<<8|x[pe|39],x[pe|40]<<24|x[pe|41]<<16|x[pe|42]<<8|x[pe|43],x[pe|44]<<24|x[pe|45]<<16|x[pe|46]<<8|x[pe|47],x[pe|48]<<24|x[pe|49]<<16|x[pe|50]<<8|x[pe|51],x[pe|52]<<24|x[pe|53]<<16|x[pe|54]<<8|x[pe|55],x[pe|56]<<24|x[pe|57]<<16|x[pe|58]<<8|x[pe|59],x[pe|60]<<24|x[pe|61]<<16|x[pe|62]<<8|x[pe|63])}function T(pe){pe=pe|0,x[pe|0]=i>>>24,x[pe|1]=i>>>16&255,x[pe|2]=i>>>8&255,x[pe|3]=i&255,x[pe|4]=a>>>24,x[pe|5]=a>>>16&255,x[pe|6]=a>>>8&255,x[pe|7]=a&255,x[pe|8]=s>>>24,x[pe|9]=s>>>16&255,x[pe|10]=s>>>8&255,x[pe|11]=s&255,x[pe|12]=u>>>24,x[pe|13]=u>>>16&255,x[pe|14]=u>>>8&255,x[pe|15]=u&255,x[pe|16]=c>>>24,x[pe|17]=c>>>16&255,x[pe|18]=c>>>8&255,x[pe|19]=c&255}function M(){i=1732584193,a=4023233417,s=2562383102,u=271733878,c=3285377520,h=n=0}function A(pe,ye,de,ke,ie,be,Ie){pe=pe|0,ye=ye|0,de=de|0,ke=ke|0,ie=ie|0,be=be|0,Ie=Ie|0,i=pe,a=ye,s=de,u=ke,c=ie,h=be,n=Ie}function L(pe,ye){pe=pe|0,ye=ye|0;var de=0;if(pe&63)return-1;for(;(ye|0)>=64;)w(pe),pe=pe+64|0,ye=ye-64|0,de=de+64|0;return h=h+de|0,h>>>0 >>0&&(n=n+1|0),de|0}function Y(pe,ye,de){pe=pe|0,ye=ye|0,de=de|0;var ke=0,ie=0;if(pe&63||~de&&de&31)return-1;if((ye|0)>=64){if(ke=L(pe,ye)|0,(ke|0)==-1)return-1;pe=pe+ke|0,ye=ye-ke|0}if(ke=ke+ye|0,h=h+ye|0,h>>>0 >>0&&(n=n+1|0),x[pe|ye]=128,(ye|0)>=56){for(ie=ye+1|0;(ie|0)<64;ie=ie+1|0)x[pe|ie]=0;w(pe),ye=0,x[pe|0]=0}for(ie=ye+1|0;(ie|0)<59;ie=ie+1|0)x[pe|ie]=0;return x[pe|56]=n>>>21&255,x[pe|57]=n>>>13&255,x[pe|58]=n>>>5&255,x[pe|59]=n<<3&255|h>>>29,x[pe|60]=h>>>21&255,x[pe|61]=h>>>13&255,x[pe|62]=h>>>5&255,x[pe|63]=h<<3&255,w(pe),~de&&T(de),ke|0}function N(){i=p,a=d,s=v,u=m,c=g,h=64,n=0}function W(){i=y,a=b,s=k,u=O,c=S,h=64,n=0}function j(pe,ye,de,ke,ie,be,Ie,De,ae,ee,F,I,J,q,fe,Ce){pe=pe|0,ye=ye|0,de=de|0,ke=ke|0,ie=ie|0,be=be|0,Ie=Ie|0,De=De|0,ae=ae|0,ee=ee|0,F=F|0,I=I|0,J=J|0,q=q|0,fe=fe|0,Ce=Ce|0,M(),E(pe^1549556828,ye^1549556828,de^1549556828,ke^1549556828,ie^1549556828,be^1549556828,Ie^1549556828,De^1549556828,ae^1549556828,ee^1549556828,F^1549556828,I^1549556828,J^1549556828,q^1549556828,fe^1549556828,Ce^1549556828),y=i,b=a,k=s,O=u,S=c,M(),E(pe^909522486,ye^909522486,de^909522486,ke^909522486,ie^909522486,be^909522486,Ie^909522486,De^909522486,ae^909522486,ee^909522486,F^909522486,I^909522486,J^909522486,q^909522486,fe^909522486,Ce^909522486),p=i,d=a,v=s,m=u,g=c,h=64,n=0}function ue(pe,ye,de){pe=pe|0,ye=ye|0,de=de|0;var ke=0,ie=0,be=0,Ie=0,De=0,ae=0;return pe&63||~de&&de&31?-1:(ae=Y(pe,ye,-1)|0,ke=i,ie=a,be=s,Ie=u,De=c,W(),E(ke,ie,be,Ie,De,2147483648,0,0,0,0,0,0,0,0,0,672),~de&&T(de),ae|0)}function Te(pe,ye,de,ke,ie){pe=pe|0,ye=ye|0,de=de|0,ke=ke|0,ie=ie|0;var be=0,Ie=0,De=0,ae=0,ee=0,F=0,I=0,J=0,q=0,fe=0;if(pe&63||~ie&&ie&31)return-1;for(x[pe+ye|0]=de>>>24,x[pe+ye+1|0]=de>>>16&255,x[pe+ye+2|0]=de>>>8&255,x[pe+ye+3|0]=de&255,ue(pe,ye+4|0,-1)|0,be=F=i,Ie=I=a,De=J=s,ae=q=u,ee=fe=c,ke=ke-1|0;(ke|0)>0;)N(),E(F,I,J,q,fe,2147483648,0,0,0,0,0,0,0,0,0,672),F=i,I=a,J=s,q=u,fe=c,W(),E(F,I,J,q,fe,2147483648,0,0,0,0,0,0,0,0,0,672),F=i,I=a,J=s,q=u,fe=c,be=be^i,Ie=Ie^a,De=De^s,ae=ae^u,ee=ee^c,ke=ke-1|0;return i=be,a=Ie,s=De,u=ae,c=ee,~ie&&T(ie),0}return{reset:M,init:A,process:L,finish:Y,hmac_reset:N,hmac_init:j,hmac_finish:ue,pbkdf2_generate_block:Te}};class V6{constructor(){this.pos=0,this.len=0}reset(){const{asm:t}=this.acquire_asm();return this.result=null,this.pos=0,this.len=0,t.reset(),this}process(t){if(this.result!==null)throw new sy("state must be reset before processing new data");const{asm:r,heap:i}=this.acquire_asm();let a=this.pos,s=this.len,u=0,c=t.length,h=0;for(;c>0;)h=Yo(i,a+s,t,u,c),s+=h,u+=h,c-=h,h=r.process(a,s),a+=h,s-=h,s||(a=0);return this.pos=a,this.len=s,this}finish(){if(this.result!==null)throw new sy("state must be reset before processing new data");const{asm:t,heap:r}=this.acquire_asm();return t.finish(this.pos,this.len,0),this.result=new Uint8Array(this.HASH_SIZE),this.result.set(r.subarray(0,this.HASH_SIZE)),this.pos=0,this.len=0,this.release_asm(),this}}const XS=[],JS=[];class Xo extends V6{constructor(){super(),this.NAME="sha1",this.BLOCK_SIZE=64,this.HASH_SIZE=20,this.acquire_asm()}acquire_asm(){return this.heap!==void 0&&this.asm!==void 0||(this.heap=XS.pop()||W0(),this.asm=JS.pop()||U6({Uint8Array},null,this.heap.buffer),this.reset()),{heap:this.heap,asm:this.asm}}release_asm(){this.heap!==void 0&&this.asm!==void 0&&(XS.push(this.heap),JS.push(this.asm)),this.heap=void 0,this.asm=void 0}static bytes(t){return new Xo().process(t).finish().result}}Xo.NAME="sha1",Xo.heap_pool=[],Xo.asm_pool=[],Xo.asm_function=U6;const ZS=[],QS=[];class Zv extends V6{constructor(){super(),this.NAME="sha256",this.BLOCK_SIZE=64,this.HASH_SIZE=32,this.acquire_asm()}acquire_asm(){return this.heap!==void 0&&this.asm!==void 0||(this.heap=ZS.pop()||W0(),this.asm=QS.pop()||function(t,r,i){var a=0,s=0,u=0,c=0,h=0,n=0,p=0,d=0,v=0,m=0,g=0,y=0,b=0,k=0,O=0,S=0,x=0,E=0,w=0,T=0,M=0,A=0,L=0,Y=0,N=0,W=0,j=new t.Uint8Array(i);function ue(F,I,J,q,fe,Ce,X,H,re,Z,Oe,ve,U,xe,me,se){F=F|0,I=I|0,J=J|0,q=q|0,fe=fe|0,Ce=Ce|0,X=X|0,H=H|0,re=re|0,Z=Z|0,Oe=Oe|0,ve=ve|0,U=U|0,xe=xe|0,me=me|0,se=se|0;var B=0,V=0,G=0,te=0,oe=0,_e=0,ce=0,le=0;B=a,V=s,G=u,te=c,oe=h,_e=n,ce=p,le=d,le=F+le+(oe>>>6^oe>>>11^oe>>>25^oe<<26^oe<<21^oe<<7)+(ce^oe&(_e^ce))+1116352408|0,te=te+le|0,le=le+(B&V^G&(B^V))+(B>>>2^B>>>13^B>>>22^B<<30^B<<19^B<<10)|0,ce=I+ce+(te>>>6^te>>>11^te>>>25^te<<26^te<<21^te<<7)+(_e^te&(oe^_e))+1899447441|0,G=G+ce|0,ce=ce+(le&B^V&(le^B))+(le>>>2^le>>>13^le>>>22^le<<30^le<<19^le<<10)|0,_e=J+_e+(G>>>6^G>>>11^G>>>25^G<<26^G<<21^G<<7)+(oe^G&(te^oe))+3049323471|0,V=V+_e|0,_e=_e+(ce&le^B&(ce^le))+(ce>>>2^ce>>>13^ce>>>22^ce<<30^ce<<19^ce<<10)|0,oe=q+oe+(V>>>6^V>>>11^V>>>25^V<<26^V<<21^V<<7)+(te^V&(G^te))+3921009573|0,B=B+oe|0,oe=oe+(_e&ce^le&(_e^ce))+(_e>>>2^_e>>>13^_e>>>22^_e<<30^_e<<19^_e<<10)|0,te=fe+te+(B>>>6^B>>>11^B>>>25^B<<26^B<<21^B<<7)+(G^B&(V^G))+961987163|0,le=le+te|0,te=te+(oe&_e^ce&(oe^_e))+(oe>>>2^oe>>>13^oe>>>22^oe<<30^oe<<19^oe<<10)|0,G=Ce+G+(le>>>6^le>>>11^le>>>25^le<<26^le<<21^le<<7)+(V^le&(B^V))+1508970993|0,ce=ce+G|0,G=G+(te&oe^_e&(te^oe))+(te>>>2^te>>>13^te>>>22^te<<30^te<<19^te<<10)|0,V=X+V+(ce>>>6^ce>>>11^ce>>>25^ce<<26^ce<<21^ce<<7)+(B^ce&(le^B))+2453635748|0,_e=_e+V|0,V=V+(G&te^oe&(G^te))+(G>>>2^G>>>13^G>>>22^G<<30^G<<19^G<<10)|0,B=H+B+(_e>>>6^_e>>>11^_e>>>25^_e<<26^_e<<21^_e<<7)+(le^_e&(ce^le))+2870763221|0,oe=oe+B|0,B=B+(V&G^te&(V^G))+(V>>>2^V>>>13^V>>>22^V<<30^V<<19^V<<10)|0,le=re+le+(oe>>>6^oe>>>11^oe>>>25^oe<<26^oe<<21^oe<<7)+(ce^oe&(_e^ce))+3624381080|0,te=te+le|0,le=le+(B&V^G&(B^V))+(B>>>2^B>>>13^B>>>22^B<<30^B<<19^B<<10)|0,ce=Z+ce+(te>>>6^te>>>11^te>>>25^te<<26^te<<21^te<<7)+(_e^te&(oe^_e))+310598401|0,G=G+ce|0,ce=ce+(le&B^V&(le^B))+(le>>>2^le>>>13^le>>>22^le<<30^le<<19^le<<10)|0,_e=Oe+_e+(G>>>6^G>>>11^G>>>25^G<<26^G<<21^G<<7)+(oe^G&(te^oe))+607225278|0,V=V+_e|0,_e=_e+(ce&le^B&(ce^le))+(ce>>>2^ce>>>13^ce>>>22^ce<<30^ce<<19^ce<<10)|0,oe=ve+oe+(V>>>6^V>>>11^V>>>25^V<<26^V<<21^V<<7)+(te^V&(G^te))+1426881987|0,B=B+oe|0,oe=oe+(_e&ce^le&(_e^ce))+(_e>>>2^_e>>>13^_e>>>22^_e<<30^_e<<19^_e<<10)|0,te=U+te+(B>>>6^B>>>11^B>>>25^B<<26^B<<21^B<<7)+(G^B&(V^G))+1925078388|0,le=le+te|0,te=te+(oe&_e^ce&(oe^_e))+(oe>>>2^oe>>>13^oe>>>22^oe<<30^oe<<19^oe<<10)|0,G=xe+G+(le>>>6^le>>>11^le>>>25^le<<26^le<<21^le<<7)+(V^le&(B^V))+2162078206|0,ce=ce+G|0,G=G+(te&oe^_e&(te^oe))+(te>>>2^te>>>13^te>>>22^te<<30^te<<19^te<<10)|0,V=me+V+(ce>>>6^ce>>>11^ce>>>25^ce<<26^ce<<21^ce<<7)+(B^ce&(le^B))+2614888103|0,_e=_e+V|0,V=V+(G&te^oe&(G^te))+(G>>>2^G>>>13^G>>>22^G<<30^G<<19^G<<10)|0,B=se+B+(_e>>>6^_e>>>11^_e>>>25^_e<<26^_e<<21^_e<<7)+(le^_e&(ce^le))+3248222580|0,oe=oe+B|0,B=B+(V&G^te&(V^G))+(V>>>2^V>>>13^V>>>22^V<<30^V<<19^V<<10)|0,F=(I>>>7^I>>>18^I>>>3^I<<25^I<<14)+(me>>>17^me>>>19^me>>>10^me<<15^me<<13)+F+Z|0,le=F+le+(oe>>>6^oe>>>11^oe>>>25^oe<<26^oe<<21^oe<<7)+(ce^oe&(_e^ce))+3835390401|0,te=te+le|0,le=le+(B&V^G&(B^V))+(B>>>2^B>>>13^B>>>22^B<<30^B<<19^B<<10)|0,I=(J>>>7^J>>>18^J>>>3^J<<25^J<<14)+(se>>>17^se>>>19^se>>>10^se<<15^se<<13)+I+Oe|0,ce=I+ce+(te>>>6^te>>>11^te>>>25^te<<26^te<<21^te<<7)+(_e^te&(oe^_e))+4022224774|0,G=G+ce|0,ce=ce+(le&B^V&(le^B))+(le>>>2^le>>>13^le>>>22^le<<30^le<<19^le<<10)|0,J=(q>>>7^q>>>18^q>>>3^q<<25^q<<14)+(F>>>17^F>>>19^F>>>10^F<<15^F<<13)+J+ve|0,_e=J+_e+(G>>>6^G>>>11^G>>>25^G<<26^G<<21^G<<7)+(oe^G&(te^oe))+264347078|0,V=V+_e|0,_e=_e+(ce&le^B&(ce^le))+(ce>>>2^ce>>>13^ce>>>22^ce<<30^ce<<19^ce<<10)|0,q=(fe>>>7^fe>>>18^fe>>>3^fe<<25^fe<<14)+(I>>>17^I>>>19^I>>>10^I<<15^I<<13)+q+U|0,oe=q+oe+(V>>>6^V>>>11^V>>>25^V<<26^V<<21^V<<7)+(te^V&(G^te))+604807628|0,B=B+oe|0,oe=oe+(_e&ce^le&(_e^ce))+(_e>>>2^_e>>>13^_e>>>22^_e<<30^_e<<19^_e<<10)|0,fe=(Ce>>>7^Ce>>>18^Ce>>>3^Ce<<25^Ce<<14)+(J>>>17^J>>>19^J>>>10^J<<15^J<<13)+fe+xe|0,te=fe+te+(B>>>6^B>>>11^B>>>25^B<<26^B<<21^B<<7)+(G^B&(V^G))+770255983|0,le=le+te|0,te=te+(oe&_e^ce&(oe^_e))+(oe>>>2^oe>>>13^oe>>>22^oe<<30^oe<<19^oe<<10)|0,Ce=(X>>>7^X>>>18^X>>>3^X<<25^X<<14)+(q>>>17^q>>>19^q>>>10^q<<15^q<<13)+Ce+me|0,G=Ce+G+(le>>>6^le>>>11^le>>>25^le<<26^le<<21^le<<7)+(V^le&(B^V))+1249150122|0,ce=ce+G|0,G=G+(te&oe^_e&(te^oe))+(te>>>2^te>>>13^te>>>22^te<<30^te<<19^te<<10)|0,X=(H>>>7^H>>>18^H>>>3^H<<25^H<<14)+(fe>>>17^fe>>>19^fe>>>10^fe<<15^fe<<13)+X+se|0,V=X+V+(ce>>>6^ce>>>11^ce>>>25^ce<<26^ce<<21^ce<<7)+(B^ce&(le^B))+1555081692|0,_e=_e+V|0,V=V+(G&te^oe&(G^te))+(G>>>2^G>>>13^G>>>22^G<<30^G<<19^G<<10)|0,H=(re>>>7^re>>>18^re>>>3^re<<25^re<<14)+(Ce>>>17^Ce>>>19^Ce>>>10^Ce<<15^Ce<<13)+H+F|0,B=H+B+(_e>>>6^_e>>>11^_e>>>25^_e<<26^_e<<21^_e<<7)+(le^_e&(ce^le))+1996064986|0,oe=oe+B|0,B=B+(V&G^te&(V^G))+(V>>>2^V>>>13^V>>>22^V<<30^V<<19^V<<10)|0,re=(Z>>>7^Z>>>18^Z>>>3^Z<<25^Z<<14)+(X>>>17^X>>>19^X>>>10^X<<15^X<<13)+re+I|0,le=re+le+(oe>>>6^oe>>>11^oe>>>25^oe<<26^oe<<21^oe<<7)+(ce^oe&(_e^ce))+2554220882|0,te=te+le|0,le=le+(B&V^G&(B^V))+(B>>>2^B>>>13^B>>>22^B<<30^B<<19^B<<10)|0,Z=(Oe>>>7^Oe>>>18^Oe>>>3^Oe<<25^Oe<<14)+(H>>>17^H>>>19^H>>>10^H<<15^H<<13)+Z+J|0,ce=Z+ce+(te>>>6^te>>>11^te>>>25^te<<26^te<<21^te<<7)+(_e^te&(oe^_e))+2821834349|0,G=G+ce|0,ce=ce+(le&B^V&(le^B))+(le>>>2^le>>>13^le>>>22^le<<30^le<<19^le<<10)|0,Oe=(ve>>>7^ve>>>18^ve>>>3^ve<<25^ve<<14)+(re>>>17^re>>>19^re>>>10^re<<15^re<<13)+Oe+q|0,_e=Oe+_e+(G>>>6^G>>>11^G>>>25^G<<26^G<<21^G<<7)+(oe^G&(te^oe))+2952996808|0,V=V+_e|0,_e=_e+(ce&le^B&(ce^le))+(ce>>>2^ce>>>13^ce>>>22^ce<<30^ce<<19^ce<<10)|0,ve=(U>>>7^U>>>18^U>>>3^U<<25^U<<14)+(Z>>>17^Z>>>19^Z>>>10^Z<<15^Z<<13)+ve+fe|0,oe=ve+oe+(V>>>6^V>>>11^V>>>25^V<<26^V<<21^V<<7)+(te^V&(G^te))+3210313671|0,B=B+oe|0,oe=oe+(_e&ce^le&(_e^ce))+(_e>>>2^_e>>>13^_e>>>22^_e<<30^_e<<19^_e<<10)|0,U=(xe>>>7^xe>>>18^xe>>>3^xe<<25^xe<<14)+(Oe>>>17^Oe>>>19^Oe>>>10^Oe<<15^Oe<<13)+U+Ce|0,te=U+te+(B>>>6^B>>>11^B>>>25^B<<26^B<<21^B<<7)+(G^B&(V^G))+3336571891|0,le=le+te|0,te=te+(oe&_e^ce&(oe^_e))+(oe>>>2^oe>>>13^oe>>>22^oe<<30^oe<<19^oe<<10)|0,xe=(me>>>7^me>>>18^me>>>3^me<<25^me<<14)+(ve>>>17^ve>>>19^ve>>>10^ve<<15^ve<<13)+xe+X|0,G=xe+G+(le>>>6^le>>>11^le>>>25^le<<26^le<<21^le<<7)+(V^le&(B^V))+3584528711|0,ce=ce+G|0,G=G+(te&oe^_e&(te^oe))+(te>>>2^te>>>13^te>>>22^te<<30^te<<19^te<<10)|0,me=(se>>>7^se>>>18^se>>>3^se<<25^se<<14)+(U>>>17^U>>>19^U>>>10^U<<15^U<<13)+me+H|0,V=me+V+(ce>>>6^ce>>>11^ce>>>25^ce<<26^ce<<21^ce<<7)+(B^ce&(le^B))+113926993|0,_e=_e+V|0,V=V+(G&te^oe&(G^te))+(G>>>2^G>>>13^G>>>22^G<<30^G<<19^G<<10)|0,se=(F>>>7^F>>>18^F>>>3^F<<25^F<<14)+(xe>>>17^xe>>>19^xe>>>10^xe<<15^xe<<13)+se+re|0,B=se+B+(_e>>>6^_e>>>11^_e>>>25^_e<<26^_e<<21^_e<<7)+(le^_e&(ce^le))+338241895|0,oe=oe+B|0,B=B+(V&G^te&(V^G))+(V>>>2^V>>>13^V>>>22^V<<30^V<<19^V<<10)|0,F=(I>>>7^I>>>18^I>>>3^I<<25^I<<14)+(me>>>17^me>>>19^me>>>10^me<<15^me<<13)+F+Z|0,le=F+le+(oe>>>6^oe>>>11^oe>>>25^oe<<26^oe<<21^oe<<7)+(ce^oe&(_e^ce))+666307205|0,te=te+le|0,le=le+(B&V^G&(B^V))+(B>>>2^B>>>13^B>>>22^B<<30^B<<19^B<<10)|0,I=(J>>>7^J>>>18^J>>>3^J<<25^J<<14)+(se>>>17^se>>>19^se>>>10^se<<15^se<<13)+I+Oe|0,ce=I+ce+(te>>>6^te>>>11^te>>>25^te<<26^te<<21^te<<7)+(_e^te&(oe^_e))+773529912|0,G=G+ce|0,ce=ce+(le&B^V&(le^B))+(le>>>2^le>>>13^le>>>22^le<<30^le<<19^le<<10)|0,J=(q>>>7^q>>>18^q>>>3^q<<25^q<<14)+(F>>>17^F>>>19^F>>>10^F<<15^F<<13)+J+ve|0,_e=J+_e+(G>>>6^G>>>11^G>>>25^G<<26^G<<21^G<<7)+(oe^G&(te^oe))+1294757372|0,V=V+_e|0,_e=_e+(ce&le^B&(ce^le))+(ce>>>2^ce>>>13^ce>>>22^ce<<30^ce<<19^ce<<10)|0,q=(fe>>>7^fe>>>18^fe>>>3^fe<<25^fe<<14)+(I>>>17^I>>>19^I>>>10^I<<15^I<<13)+q+U|0,oe=q+oe+(V>>>6^V>>>11^V>>>25^V<<26^V<<21^V<<7)+(te^V&(G^te))+1396182291|0,B=B+oe|0,oe=oe+(_e&ce^le&(_e^ce))+(_e>>>2^_e>>>13^_e>>>22^_e<<30^_e<<19^_e<<10)|0,fe=(Ce>>>7^Ce>>>18^Ce>>>3^Ce<<25^Ce<<14)+(J>>>17^J>>>19^J>>>10^J<<15^J<<13)+fe+xe|0,te=fe+te+(B>>>6^B>>>11^B>>>25^B<<26^B<<21^B<<7)+(G^B&(V^G))+1695183700|0,le=le+te|0,te=te+(oe&_e^ce&(oe^_e))+(oe>>>2^oe>>>13^oe>>>22^oe<<30^oe<<19^oe<<10)|0,Ce=(X>>>7^X>>>18^X>>>3^X<<25^X<<14)+(q>>>17^q>>>19^q>>>10^q<<15^q<<13)+Ce+me|0,G=Ce+G+(le>>>6^le>>>11^le>>>25^le<<26^le<<21^le<<7)+(V^le&(B^V))+1986661051|0,ce=ce+G|0,G=G+(te&oe^_e&(te^oe))+(te>>>2^te>>>13^te>>>22^te<<30^te<<19^te<<10)|0,X=(H>>>7^H>>>18^H>>>3^H<<25^H<<14)+(fe>>>17^fe>>>19^fe>>>10^fe<<15^fe<<13)+X+se|0,V=X+V+(ce>>>6^ce>>>11^ce>>>25^ce<<26^ce<<21^ce<<7)+(B^ce&(le^B))+2177026350|0,_e=_e+V|0,V=V+(G&te^oe&(G^te))+(G>>>2^G>>>13^G>>>22^G<<30^G<<19^G<<10)|0,H=(re>>>7^re>>>18^re>>>3^re<<25^re<<14)+(Ce>>>17^Ce>>>19^Ce>>>10^Ce<<15^Ce<<13)+H+F|0,B=H+B+(_e>>>6^_e>>>11^_e>>>25^_e<<26^_e<<21^_e<<7)+(le^_e&(ce^le))+2456956037|0,oe=oe+B|0,B=B+(V&G^te&(V^G))+(V>>>2^V>>>13^V>>>22^V<<30^V<<19^V<<10)|0,re=(Z>>>7^Z>>>18^Z>>>3^Z<<25^Z<<14)+(X>>>17^X>>>19^X>>>10^X<<15^X<<13)+re+I|0,le=re+le+(oe>>>6^oe>>>11^oe>>>25^oe<<26^oe<<21^oe<<7)+(ce^oe&(_e^ce))+2730485921|0,te=te+le|0,le=le+(B&V^G&(B^V))+(B>>>2^B>>>13^B>>>22^B<<30^B<<19^B<<10)|0,Z=(Oe>>>7^Oe>>>18^Oe>>>3^Oe<<25^Oe<<14)+(H>>>17^H>>>19^H>>>10^H<<15^H<<13)+Z+J|0,ce=Z+ce+(te>>>6^te>>>11^te>>>25^te<<26^te<<21^te<<7)+(_e^te&(oe^_e))+2820302411|0,G=G+ce|0,ce=ce+(le&B^V&(le^B))+(le>>>2^le>>>13^le>>>22^le<<30^le<<19^le<<10)|0,Oe=(ve>>>7^ve>>>18^ve>>>3^ve<<25^ve<<14)+(re>>>17^re>>>19^re>>>10^re<<15^re<<13)+Oe+q|0,_e=Oe+_e+(G>>>6^G>>>11^G>>>25^G<<26^G<<21^G<<7)+(oe^G&(te^oe))+3259730800|0,V=V+_e|0,_e=_e+(ce&le^B&(ce^le))+(ce>>>2^ce>>>13^ce>>>22^ce<<30^ce<<19^ce<<10)|0,ve=(U>>>7^U>>>18^U>>>3^U<<25^U<<14)+(Z>>>17^Z>>>19^Z>>>10^Z<<15^Z<<13)+ve+fe|0,oe=ve+oe+(V>>>6^V>>>11^V>>>25^V<<26^V<<21^V<<7)+(te^V&(G^te))+3345764771|0,B=B+oe|0,oe=oe+(_e&ce^le&(_e^ce))+(_e>>>2^_e>>>13^_e>>>22^_e<<30^_e<<19^_e<<10)|0,U=(xe>>>7^xe>>>18^xe>>>3^xe<<25^xe<<14)+(Oe>>>17^Oe>>>19^Oe>>>10^Oe<<15^Oe<<13)+U+Ce|0,te=U+te+(B>>>6^B>>>11^B>>>25^B<<26^B<<21^B<<7)+(G^B&(V^G))+3516065817|0,le=le+te|0,te=te+(oe&_e^ce&(oe^_e))+(oe>>>2^oe>>>13^oe>>>22^oe<<30^oe<<19^oe<<10)|0,xe=(me>>>7^me>>>18^me>>>3^me<<25^me<<14)+(ve>>>17^ve>>>19^ve>>>10^ve<<15^ve<<13)+xe+X|0,G=xe+G+(le>>>6^le>>>11^le>>>25^le<<26^le<<21^le<<7)+(V^le&(B^V))+3600352804|0,ce=ce+G|0,G=G+(te&oe^_e&(te^oe))+(te>>>2^te>>>13^te>>>22^te<<30^te<<19^te<<10)|0,me=(se>>>7^se>>>18^se>>>3^se<<25^se<<14)+(U>>>17^U>>>19^U>>>10^U<<15^U<<13)+me+H|0,V=me+V+(ce>>>6^ce>>>11^ce>>>25^ce<<26^ce<<21^ce<<7)+(B^ce&(le^B))+4094571909|0,_e=_e+V|0,V=V+(G&te^oe&(G^te))+(G>>>2^G>>>13^G>>>22^G<<30^G<<19^G<<10)|0,se=(F>>>7^F>>>18^F>>>3^F<<25^F<<14)+(xe>>>17^xe>>>19^xe>>>10^xe<<15^xe<<13)+se+re|0,B=se+B+(_e>>>6^_e>>>11^_e>>>25^_e<<26^_e<<21^_e<<7)+(le^_e&(ce^le))+275423344|0,oe=oe+B|0,B=B+(V&G^te&(V^G))+(V>>>2^V>>>13^V>>>22^V<<30^V<<19^V<<10)|0,F=(I>>>7^I>>>18^I>>>3^I<<25^I<<14)+(me>>>17^me>>>19^me>>>10^me<<15^me<<13)+F+Z|0,le=F+le+(oe>>>6^oe>>>11^oe>>>25^oe<<26^oe<<21^oe<<7)+(ce^oe&(_e^ce))+430227734|0,te=te+le|0,le=le+(B&V^G&(B^V))+(B>>>2^B>>>13^B>>>22^B<<30^B<<19^B<<10)|0,I=(J>>>7^J>>>18^J>>>3^J<<25^J<<14)+(se>>>17^se>>>19^se>>>10^se<<15^se<<13)+I+Oe|0,ce=I+ce+(te>>>6^te>>>11^te>>>25^te<<26^te<<21^te<<7)+(_e^te&(oe^_e))+506948616|0,G=G+ce|0,ce=ce+(le&B^V&(le^B))+(le>>>2^le>>>13^le>>>22^le<<30^le<<19^le<<10)|0,J=(q>>>7^q>>>18^q>>>3^q<<25^q<<14)+(F>>>17^F>>>19^F>>>10^F<<15^F<<13)+J+ve|0,_e=J+_e+(G>>>6^G>>>11^G>>>25^G<<26^G<<21^G<<7)+(oe^G&(te^oe))+659060556|0,V=V+_e|0,_e=_e+(ce&le^B&(ce^le))+(ce>>>2^ce>>>13^ce>>>22^ce<<30^ce<<19^ce<<10)|0,q=(fe>>>7^fe>>>18^fe>>>3^fe<<25^fe<<14)+(I>>>17^I>>>19^I>>>10^I<<15^I<<13)+q+U|0,oe=q+oe+(V>>>6^V>>>11^V>>>25^V<<26^V<<21^V<<7)+(te^V&(G^te))+883997877|0,B=B+oe|0,oe=oe+(_e&ce^le&(_e^ce))+(_e>>>2^_e>>>13^_e>>>22^_e<<30^_e<<19^_e<<10)|0,fe=(Ce>>>7^Ce>>>18^Ce>>>3^Ce<<25^Ce<<14)+(J>>>17^J>>>19^J>>>10^J<<15^J<<13)+fe+xe|0,te=fe+te+(B>>>6^B>>>11^B>>>25^B<<26^B<<21^B<<7)+(G^B&(V^G))+958139571|0,le=le+te|0,te=te+(oe&_e^ce&(oe^_e))+(oe>>>2^oe>>>13^oe>>>22^oe<<30^oe<<19^oe<<10)|0,Ce=(X>>>7^X>>>18^X>>>3^X<<25^X<<14)+(q>>>17^q>>>19^q>>>10^q<<15^q<<13)+Ce+me|0,G=Ce+G+(le>>>6^le>>>11^le>>>25^le<<26^le<<21^le<<7)+(V^le&(B^V))+1322822218|0,ce=ce+G|0,G=G+(te&oe^_e&(te^oe))+(te>>>2^te>>>13^te>>>22^te<<30^te<<19^te<<10)|0,X=(H>>>7^H>>>18^H>>>3^H<<25^H<<14)+(fe>>>17^fe>>>19^fe>>>10^fe<<15^fe<<13)+X+se|0,V=X+V+(ce>>>6^ce>>>11^ce>>>25^ce<<26^ce<<21^ce<<7)+(B^ce&(le^B))+1537002063|0,_e=_e+V|0,V=V+(G&te^oe&(G^te))+(G>>>2^G>>>13^G>>>22^G<<30^G<<19^G<<10)|0,H=(re>>>7^re>>>18^re>>>3^re<<25^re<<14)+(Ce>>>17^Ce>>>19^Ce>>>10^Ce<<15^Ce<<13)+H+F|0,B=H+B+(_e>>>6^_e>>>11^_e>>>25^_e<<26^_e<<21^_e<<7)+(le^_e&(ce^le))+1747873779|0,oe=oe+B|0,B=B+(V&G^te&(V^G))+(V>>>2^V>>>13^V>>>22^V<<30^V<<19^V<<10)|0,re=(Z>>>7^Z>>>18^Z>>>3^Z<<25^Z<<14)+(X>>>17^X>>>19^X>>>10^X<<15^X<<13)+re+I|0,le=re+le+(oe>>>6^oe>>>11^oe>>>25^oe<<26^oe<<21^oe<<7)+(ce^oe&(_e^ce))+1955562222|0,te=te+le|0,le=le+(B&V^G&(B^V))+(B>>>2^B>>>13^B>>>22^B<<30^B<<19^B<<10)|0,Z=(Oe>>>7^Oe>>>18^Oe>>>3^Oe<<25^Oe<<14)+(H>>>17^H>>>19^H>>>10^H<<15^H<<13)+Z+J|0,ce=Z+ce+(te>>>6^te>>>11^te>>>25^te<<26^te<<21^te<<7)+(_e^te&(oe^_e))+2024104815|0,G=G+ce|0,ce=ce+(le&B^V&(le^B))+(le>>>2^le>>>13^le>>>22^le<<30^le<<19^le<<10)|0,Oe=(ve>>>7^ve>>>18^ve>>>3^ve<<25^ve<<14)+(re>>>17^re>>>19^re>>>10^re<<15^re<<13)+Oe+q|0,_e=Oe+_e+(G>>>6^G>>>11^G>>>25^G<<26^G<<21^G<<7)+(oe^G&(te^oe))+2227730452|0,V=V+_e|0,_e=_e+(ce&le^B&(ce^le))+(ce>>>2^ce>>>13^ce>>>22^ce<<30^ce<<19^ce<<10)|0,ve=(U>>>7^U>>>18^U>>>3^U<<25^U<<14)+(Z>>>17^Z>>>19^Z>>>10^Z<<15^Z<<13)+ve+fe|0,oe=ve+oe+(V>>>6^V>>>11^V>>>25^V<<26^V<<21^V<<7)+(te^V&(G^te))+2361852424|0,B=B+oe|0,oe=oe+(_e&ce^le&(_e^ce))+(_e>>>2^_e>>>13^_e>>>22^_e<<30^_e<<19^_e<<10)|0,U=(xe>>>7^xe>>>18^xe>>>3^xe<<25^xe<<14)+(Oe>>>17^Oe>>>19^Oe>>>10^Oe<<15^Oe<<13)+U+Ce|0,te=U+te+(B>>>6^B>>>11^B>>>25^B<<26^B<<21^B<<7)+(G^B&(V^G))+2428436474|0,le=le+te|0,te=te+(oe&_e^ce&(oe^_e))+(oe>>>2^oe>>>13^oe>>>22^oe<<30^oe<<19^oe<<10)|0,xe=(me>>>7^me>>>18^me>>>3^me<<25^me<<14)+(ve>>>17^ve>>>19^ve>>>10^ve<<15^ve<<13)+xe+X|0,G=xe+G+(le>>>6^le>>>11^le>>>25^le<<26^le<<21^le<<7)+(V^le&(B^V))+2756734187|0,ce=ce+G|0,G=G+(te&oe^_e&(te^oe))+(te>>>2^te>>>13^te>>>22^te<<30^te<<19^te<<10)|0,me=(se>>>7^se>>>18^se>>>3^se<<25^se<<14)+(U>>>17^U>>>19^U>>>10^U<<15^U<<13)+me+H|0,V=me+V+(ce>>>6^ce>>>11^ce>>>25^ce<<26^ce<<21^ce<<7)+(B^ce&(le^B))+3204031479|0,_e=_e+V|0,V=V+(G&te^oe&(G^te))+(G>>>2^G>>>13^G>>>22^G<<30^G<<19^G<<10)|0,se=(F>>>7^F>>>18^F>>>3^F<<25^F<<14)+(xe>>>17^xe>>>19^xe>>>10^xe<<15^xe<<13)+se+re|0,B=se+B+(_e>>>6^_e>>>11^_e>>>25^_e<<26^_e<<21^_e<<7)+(le^_e&(ce^le))+3329325298|0,oe=oe+B|0,B=B+(V&G^te&(V^G))+(V>>>2^V>>>13^V>>>22^V<<30^V<<19^V<<10)|0,a=a+B|0,s=s+V|0,u=u+G|0,c=c+te|0,h=h+oe|0,n=n+_e|0,p=p+ce|0,d=d+le|0}function Te(F){F=F|0,ue(j[F|0]<<24|j[F|1]<<16|j[F|2]<<8|j[F|3],j[F|4]<<24|j[F|5]<<16|j[F|6]<<8|j[F|7],j[F|8]<<24|j[F|9]<<16|j[F|10]<<8|j[F|11],j[F|12]<<24|j[F|13]<<16|j[F|14]<<8|j[F|15],j[F|16]<<24|j[F|17]<<16|j[F|18]<<8|j[F|19],j[F|20]<<24|j[F|21]<<16|j[F|22]<<8|j[F|23],j[F|24]<<24|j[F|25]<<16|j[F|26]<<8|j[F|27],j[F|28]<<24|j[F|29]<<16|j[F|30]<<8|j[F|31],j[F|32]<<24|j[F|33]<<16|j[F|34]<<8|j[F|35],j[F|36]<<24|j[F|37]<<16|j[F|38]<<8|j[F|39],j[F|40]<<24|j[F|41]<<16|j[F|42]<<8|j[F|43],j[F|44]<<24|j[F|45]<<16|j[F|46]<<8|j[F|47],j[F|48]<<24|j[F|49]<<16|j[F|50]<<8|j[F|51],j[F|52]<<24|j[F|53]<<16|j[F|54]<<8|j[F|55],j[F|56]<<24|j[F|57]<<16|j[F|58]<<8|j[F|59],j[F|60]<<24|j[F|61]<<16|j[F|62]<<8|j[F|63])}function pe(F){F=F|0,j[F|0]=a>>>24,j[F|1]=a>>>16&255,j[F|2]=a>>>8&255,j[F|3]=a&255,j[F|4]=s>>>24,j[F|5]=s>>>16&255,j[F|6]=s>>>8&255,j[F|7]=s&255,j[F|8]=u>>>24,j[F|9]=u>>>16&255,j[F|10]=u>>>8&255,j[F|11]=u&255,j[F|12]=c>>>24,j[F|13]=c>>>16&255,j[F|14]=c>>>8&255,j[F|15]=c&255,j[F|16]=h>>>24,j[F|17]=h>>>16&255,j[F|18]=h>>>8&255,j[F|19]=h&255,j[F|20]=n>>>24,j[F|21]=n>>>16&255,j[F|22]=n>>>8&255,j[F|23]=n&255,j[F|24]=p>>>24,j[F|25]=p>>>16&255,j[F|26]=p>>>8&255,j[F|27]=p&255,j[F|28]=d>>>24,j[F|29]=d>>>16&255,j[F|30]=d>>>8&255,j[F|31]=d&255}function ye(){a=1779033703,s=3144134277,u=1013904242,c=2773480762,h=1359893119,n=2600822924,p=528734635,d=1541459225,v=m=0}function de(F,I,J,q,fe,Ce,X,H,re,Z){F=F|0,I=I|0,J=J|0,q=q|0,fe=fe|0,Ce=Ce|0,X=X|0,H=H|0,re=re|0,Z=Z|0,a=F,s=I,u=J,c=q,h=fe,n=Ce,p=X,d=H,v=re,m=Z}function ke(F,I){F=F|0,I=I|0;var J=0;if(F&63)return-1;for(;(I|0)>=64;)Te(F),F=F+64|0,I=I-64|0,J=J+64|0;return v=v+J|0,v>>>0 >>0&&(m=m+1|0),J|0}function ie(F,I,J){F=F|0,I=I|0,J=J|0;var q=0,fe=0;if(F&63||~J&&J&31)return-1;if((I|0)>=64){if(q=ke(F,I)|0,(q|0)==-1)return-1;F=F+q|0,I=I-q|0}if(q=q+I|0,v=v+I|0,v>>>0>>0&&(m=m+1|0),j[F|I]=128,(I|0)>=56){for(fe=I+1|0;(fe|0)<64;fe=fe+1|0)j[F|fe]=0;Te(F),I=0,j[F|0]=0}for(fe=I+1|0;(fe|0)<59;fe=fe+1|0)j[F|fe]=0;return j[F|56]=m>>>21&255,j[F|57]=m>>>13&255,j[F|58]=m>>>5&255,j[F|59]=m<<3&255|v>>>29,j[F|60]=v>>>21&255,j[F|61]=v>>>13&255,j[F|62]=v>>>5&255,j[F|63]=v<<3&255,Te(F),~J&&pe(J),q|0}function be(){a=g,s=y,u=b,c=k,h=O,n=S,p=x,d=E,v=64,m=0}function Ie(){a=w,s=T,u=M,c=A,h=L,n=Y,p=N,d=W,v=64,m=0}function De(F,I,J,q,fe,Ce,X,H,re,Z,Oe,ve,U,xe,me,se){F=F|0,I=I|0,J=J|0,q=q|0,fe=fe|0,Ce=Ce|0,X=X|0,H=H|0,re=re|0,Z=Z|0,Oe=Oe|0,ve=ve|0,U=U|0,xe=xe|0,me=me|0,se=se|0,ye(),ue(F^1549556828,I^1549556828,J^1549556828,q^1549556828,fe^1549556828,Ce^1549556828,X^1549556828,H^1549556828,re^1549556828,Z^1549556828,Oe^1549556828,ve^1549556828,U^1549556828,xe^1549556828,me^1549556828,se^1549556828),w=a,T=s,M=u,A=c,L=h,Y=n,N=p,W=d,ye(),ue(F^909522486,I^909522486,J^909522486,q^909522486,fe^909522486,Ce^909522486,X^909522486,H^909522486,re^909522486,Z^909522486,Oe^909522486,ve^909522486,U^909522486,xe^909522486,me^909522486,se^909522486),g=a,y=s,b=u,k=c,O=h,S=n,x=p,E=d,v=64,m=0}function ae(F,I,J){F=F|0,I=I|0,J=J|0;var q=0,fe=0,Ce=0,X=0,H=0,re=0,Z=0,Oe=0,ve=0;return F&63||~J&&J&31?-1:(ve=ie(F,I,-1)|0,q=a,fe=s,Ce=u,X=c,H=h,re=n,Z=p,Oe=d,Ie(),ue(q,fe,Ce,X,H,re,Z,Oe,2147483648,0,0,0,0,0,0,768),~J&&pe(J),ve|0)}function ee(F,I,J,q,fe){F=F|0,I=I|0,J=J|0,q=q|0,fe=fe|0;var Ce=0,X=0,H=0,re=0,Z=0,Oe=0,ve=0,U=0,xe=0,me=0,se=0,B=0,V=0,G=0,te=0,oe=0;if(F&63||~fe&&fe&31)return-1;for(j[F+I|0]=J>>>24,j[F+I+1|0]=J>>>16&255,j[F+I+2|0]=J>>>8&255,j[F+I+3|0]=J&255,ae(F,I+4|0,-1)|0,Ce=xe=a,X=me=s,H=se=u,re=B=c,Z=V=h,Oe=G=n,ve=te=p,U=oe=d,q=q-1|0;(q|0)>0;)be(),ue(xe,me,se,B,V,G,te,oe,2147483648,0,0,0,0,0,0,768),xe=a,me=s,se=u,B=c,V=h,G=n,te=p,oe=d,Ie(),ue(xe,me,se,B,V,G,te,oe,2147483648,0,0,0,0,0,0,768),xe=a,me=s,se=u,B=c,V=h,G=n,te=p,oe=d,Ce=Ce^a,X=X^s,H=H^u,re=re^c,Z=Z^h,Oe=Oe^n,ve=ve^p,U=U^d,q=q-1|0;return a=Ce,s=X,u=H,c=re,h=Z,n=Oe,p=ve,d=U,~fe&&pe(fe),0}return{reset:ye,init:de,process:ke,finish:ie,hmac_reset:be,hmac_init:De,hmac_finish:ae,pbkdf2_generate_block:ee}}({Uint8Array},null,this.heap.buffer),this.reset()),{heap:this.heap,asm:this.asm}}release_asm(){this.heap!==void 0&&this.asm!==void 0&&(ZS.push(this.heap),QS.push(this.asm)),this.heap=void 0,this.asm=void 0}static bytes(t){return new Zv().process(t).finish().result}}Zv.NAME="sha256";var Qv=W6;function W6(e,t){if(!e)throw Error(t||"Assertion failed")}W6.equal=function(e,t,r){if(e!=t)throw Error(r||"Assertion failed: "+e+" != "+t)};var lZ=Ki!==void 0?Ki:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function H0(e,t){return e(t={exports:{}},t.exports),t.exports}function qj(){throw Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var eU=H0(function(e){e.exports=typeof Object.create=="function"?function(t,r){t.super_=r,t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:function(t,r){t.super_=r;var i=function(){};i.prototype=r.prototype,t.prototype=new i,t.prototype.constructor=t}}),tU=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if(typeof e=="string")if(t){if(t==="hex")for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),i=0;i >8,u=255&a;s?r.push(s,u):r.push(u)}else for(i=0;i >>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}var rU=function(e,t){for(var r="",i=0;i >>0}return s},aU=function(e,t){for(var r=Array(4*e.length),i=0,a=0;i >>24,r[a+1]=s>>>16&255,r[a+2]=s>>>8&255,r[a+3]=255&s):(r[a+3]=s>>>24,r[a+2]=s>>>16&255,r[a+1]=s>>>8&255,r[a]=255&s)}return r},Tn={inherits:eU,toArray:tU,toHex:nU,htonl:K6,toHex32:rU,zero2:H6,zero8:G6,join32:iU,split32:aU,rotr32:function(e,t){return e>>>t|e<<32-t},rotl32:function(e,t){return e< >>32-t},sum32:function(e,t){return e+t>>>0},sum32_3:function(e,t,r){return e+t+r>>>0},sum32_4:function(e,t,r,i){return e+t+r+i>>>0},sum32_5:function(e,t,r,i,a){return e+t+r+i+a>>>0},sum64:function(e,t,r,i){var a=e[t],s=i+e[t+1]>>>0,u=(s>>0,e[t+1]=s},sum64_hi:function(e,t,r,i){return(t+i>>>0 >>0},sum64_lo:function(e,t,r,i){return t+i>>>0},sum64_4_hi:function(e,t,r,i,a,s,u,c){var h=0,n=t;return h+=(n=n+i>>>0) >>0) >>0)>>0},sum64_4_lo:function(e,t,r,i,a,s,u,c){return t+i+s+c>>>0},sum64_5_hi:function(e,t,r,i,a,s,u,c,h,n){var p=0,d=t;return p+=(d=d+i>>>0) >>0) >>0)>>0) >>0},sum64_5_lo:function(e,t,r,i,a,s,u,c,h,n){return t+i+s+c+n>>>0},rotr64_hi:function(e,t,r){return(t<<32-r|e>>>r)>>>0},rotr64_lo:function(e,t,r){return(e<<32-r|t>>>r)>>>0},shr64_hi:function(e,t,r){return e>>>r},shr64_lo:function(e,t,r){return(e<<32-r|t>>>r)>>>0}};function kp(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}var sU=kp;kp.prototype.update=function(e,t){if(e=Tn.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var r=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-r,e.length),this.pending.length===0&&(this.pending=null),e=Tn.join32(e,0,e.length-r,this.endian);for(var i=0;i >>24&255,i[a++]=e>>>16&255,i[a++]=e>>>8&255,i[a++]=255&e}else for(i[a++]=255&e,i[a++]=e>>>8&255,i[a++]=e>>>16&255,i[a++]=e>>>24&255,i[a++]=0,i[a++]=0,i[a++]=0,i[a++]=0,s=8;s >>3},g1_256:function(e){return Na(e,17)^Na(e,19)^e>>>10}},da=Tn.sum32,lU=Tn.sum32_4,uU=Tn.sum32_5,cU=$u.ch32,dU=$u.maj32,fU=$u.s0_256,hU=$u.s1_256,pU=$u.g0_256,vU=$u.g1_256,Z6=G0.BlockHash,mU=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function Va(){if(!(this instanceof Va))return new Va;Z6.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=mU,this.W=Array(64)}Tn.inherits(Va,Z6);var Q6=Va;function Cs(){if(!(this instanceof Cs))return new Cs;Q6.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}Va.blockSize=512,Va.outSize=256,Va.hmacStrength=192,Va.padLength=64,Va.prototype._update=function(e,t){for(var r=this.W,i=0;i<16;i++)r[i]=e[t+i];for(;i >>32-a,r)}function Xr(e,t,r,i,a,s,u){return em(t&r|~t&i,e,t,a,s,u)}function Jr(e,t,r,i,a,s,u){return em(t&i|r&~i,e,t,a,s,u)}function Zr(e,t,r,i,a,s,u){return em(t^r^i,e,t,a,s,u)}function Qr(e,t,r,i,a,s,u){return em(r^(t|~i),e,t,a,s,u)}function UU(e){const t=[];let r;for(r=0;r<64;r+=4)t[r>>2]=e.charCodeAt(r)+(e.charCodeAt(r+1)<<8)+(e.charCodeAt(r+2)<<16)+(e.charCodeAt(r+3)<<24);return t}const n5="0123456789abcdef".split("");function VU(e){let t="",r=0;for(;r<4;r++)t+=n5[e>>8*r+4&15]+n5[e>>8*r&15];return t}function to(e,t){return e+t&4294967295}const sv=Pe.getWebCrypto(),ov=Pe.getNodeCrypto(),WU=ov&&ov.getHashes();function Bo(e){if(ov&&WU.includes(e))return async function(t){const r=ov.createHash(e);return fr(t,i=>{r.update(i)},()=>new Uint8Array(r.digest()))}}function Wh(e,t){return async function(r,i=Nt){if(mr(r)&&(r=await gr(r)),!Pe.isStream(r)&&sv&&t&&r.length>=i.minBytesForWebCrypto)return new Uint8Array(await sv.digest(t,r));const a=e();return fr(r,s=>{a.update(s)},()=>new Uint8Array(a.digest()))}}function r5(e,t){return async function(r,i=Nt){if(mr(r)&&(r=await gr(r)),Pe.isStream(r)){const a=new e;return fr(r,s=>{a.process(s)},()=>a.finish().result)}return sv&&t&&r.length>=i.minBytesForWebCrypto?new Uint8Array(await sv.digest(t,r)):e.bytes(r)}}const Fo={md5:Bo("md5")||async function(e){const t=function(r){const i=r.length,a=[1732584193,-271733879,-1732584194,271733878];let s;for(s=64;s<=r.length;s+=64)B_(a,UU(r.substring(s-64,s)));r=r.substring(s-64);const u=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(s=0;s >2]|=r.charCodeAt(s)<<(s%4<<3);if(u[s>>2]|=128<<(s%4<<3),s>55)for(B_(a,u),s=0;s<16;s++)u[s]=0;return u[14]=8*i,B_(a,u),a}(Pe.uint8ArrayToString(e));return Pe.hexToUint8Array(function(r){for(let i=0;i new Uint8Array(b.update(k)))}(e,t,r,i);if(s.substr(0,3)==="aes")return function(d,v,m,g,y){if(Pe.getWebCrypto()&&v.length!==24&&!Pe.isStream(m)&&m.length>=3e3*y.minBytesForWebCrypto)return async function(k,O,S,x){const E="AES-CBC",w=await i5.importKey("raw",O,{name:E},!1,["encrypt"]),{blockSize:T}=uo(k),M=Pe.concatUint8Array([new Uint8Array(T),S]),A=new Uint8Array(await i5.encrypt({name:E,iv:x},w,M)).subarray(0,S.length);return function(L,Y){for(let N=0;N b.aes.AES_Encrypt_process(k),()=>b.aes.AES_Encrypt_finish())}(e,t,r,i,a);const u=new(uo(e))(t),c=u.blockSize,h=i.slice();let n=new Uint8Array;const p=d=>{d&&(n=Pe.concatUint8Array([n,d]));const v=new Uint8Array(n.length);let m,g=0;for(;d?n.length>=c:n.length;){const y=u.encrypt(h);for(m=0;m new Uint8Array(y.update(b)))}(e,t,r,i);if(a.substr(0,3)==="aes")return function(p,d,v,m){if(Pe.isStream(v)){const g=new fu(d,m);return fr(v,y=>g.aes.AES_Decrypt_process(y),()=>g.aes.AES_Decrypt_finish())}return fu.decrypt(v,d,m)}(0,t,r,i);const s=new(uo(e))(t),u=s.blockSize;let c=i,h=new Uint8Array;const n=p=>{p&&(h=Pe.concatUint8Array([h,p]));const d=new Uint8Array(h.length);let v,m=0;for(;p?h.length>=u:h.length;){const g=s.encrypt(c);for(c=h,v=0;v48)throw new Ds("illegal counter size");let s=Math.pow(2,i)-1;a.set_mask(0,0,s/4294967296|0,0|s)}else i=48,a.set_mask(0,0,65535,4294967295);if(t===void 0)throw Error("nonce is required");{let s=t.length;if(!s||s>16)throw new Ds("illegal nonce size");let u=new DataView(new ArrayBuffer(16));new Uint8Array(u.buffer).set(t),a.set_nonce(u.getUint32(0),u.getUint32(4),u.getUint32(8),u.getUint32(12))}if(r!==void 0){if(r<0||r>=Math.pow(2,i))throw new Ds("illegal counter value");a.set_counter(0,0,r/4294967296|0,0|r)}}}class cv{static encrypt(t,r,i=!0,a){return new cv(r,a,i).encrypt(t)}static decrypt(t,r,i=!0,a){return new cv(r,a,i).decrypt(t)}constructor(t,r,i=!0,a){this.aes=a||new Td(t,r,i,"CBC")}encrypt(t){return _o(this.aes.AES_Encrypt_process(t),this.aes.AES_Encrypt_finish())}decrypt(t){return _o(this.aes.AES_Decrypt_process(t),this.aes.AES_Decrypt_finish())}}const a5=Pe.getWebCrypto(),HU=Pe.getNodeCrypto(),ys=16;function s5(e,t){const r=e.length-ys;for(let i=0;i >3),17+(m>>3)),8-(7&m)).subarray(1),k=new Uint8Array(pi),O=new Uint8Array(h.length+Ys);let S,x=0;for(S=0;S 16)throw new Ds("illegal tagSize value");const h=r.length||0,n=new Uint8Array(16);h!==12?(this._gcm_mac_process(r),c[0]=0,c[1]=0,c[2]=0,c[3]=0,c[4]=0,c[5]=0,c[6]=0,c[7]=0,c[8]=0,c[9]=0,c[10]=0,c[11]=h>>>29,c[12]=h>>>21&255,c[13]=h>>>13&255,c[14]=h>>>5&255,c[15]=h<<3&255,u.mac(En.MAC.GCM,En.HEAP_DATA,16),u.get_iv(En.HEAP_DATA),u.set_iv(0,0,0,0),n.set(c.subarray(0,16))):(n.set(r),n[15]=1);const p=new DataView(n.buffer);if(this.gamma0=p.getUint32(12),u.set_nonce(p.getUint32(0),p.getUint32(4),p.getUint32(8),0),u.set_mask(0,0,0,4294967295),i!==void 0){if(i.length>z_)throw new Ds("illegal adata length");i.length?(this.adata=i,this._gcm_mac_process(i)):this.adata=void 0}else this.adata=void 0;if(this.counter<1||this.counter>4294967295)throw new RangeError("counter must be a positive 32-bit integer");u.set_counter(0,0,0,this.gamma0+this.counter|0)}static encrypt(t,r,i,a,s){return new Jo(r,i,a,s).encrypt(t)}static decrypt(t,r,i,a,s){return new Jo(r,i,a,s).decrypt(t)}encrypt(t){return this.AES_GCM_encrypt(t)}decrypt(t){return this.AES_GCM_decrypt(t)}AES_GCM_Encrypt_process(t){let r=0,i=t.length||0,{asm:a,heap:s}=this.aes.acquire_asm(),u=this.counter,c=this.aes.pos,h=this.aes.len,n=0,p=h+i&-16,d=0;if((u-1<<4)+h+i>z_)throw new RangeError("counter overflow");const v=new Uint8Array(p);for(;i>0;)d=Yo(s,c+h,t,r,i),h+=d,r+=d,i-=d,d=a.cipher(En.ENC.CTR,En.HEAP_DATA+c,h),d=a.mac(En.MAC.GCM,En.HEAP_DATA+c,d),d&&v.set(s.subarray(c,c+d),n),u+=d>>>4,n+=d,d >>29,r[4]=p>>>21,r[5]=p>>>13&255,r[6]=p>>>5&255,r[7]=p<<3&255,r[8]=r[9]=r[10]=0,r[11]=d>>>29,r[12]=d>>>21&255,r[13]=d>>>13&255,r[14]=d>>>5&255,r[15]=d<<3&255,t.mac(En.MAC.GCM,En.HEAP_DATA,16),t.get_iv(En.HEAP_DATA),t.set_counter(0,0,0,this.gamma0),t.cipher(En.ENC.CTR,En.HEAP_DATA,16),h.set(r.subarray(0,a),c),this.counter=1,this.aes.pos=0,this.aes.len=0,h}AES_GCM_Decrypt_process(t){let r=0,i=t.length||0,{asm:a,heap:s}=this.aes.acquire_asm(),u=this.counter,c=this.tagSize,h=this.aes.pos,n=this.aes.len,p=0,d=n+i>c?n+i-c&-16:0,v=n+i-d,m=0;if((u-1<<4)+n+i>z_)throw new RangeError("counter overflow");const g=new Uint8Array(d);for(;i>v;)m=Yo(s,h+n,t,r,i-v),n+=m,r+=m,i-=m,m=a.mac(En.MAC.GCM,En.HEAP_DATA+h,m),m=a.cipher(En.DEC.CTR,En.HEAP_DATA+h,m),m&&g.set(s.subarray(h,h+m),p),u+=m>>>4,p+=m,h=0,n=0;return i>0&&(n+=Yo(s,0,t,r,i)),this.counter=u,this.aes.pos=h,this.aes.len=n,g}AES_GCM_Decrypt_finish(){let{asm:t,heap:r}=this.aes.acquire_asm(),i=this.tagSize,a=this.adata,s=this.counter,u=this.aes.pos,c=this.aes.len,h=c-i;if(c>>29,r[4]=v>>>21,r[5]=v>>>13&255,r[6]=v>>>5&255,r[7]=v<<3&255,r[8]=r[9]=r[10]=0,r[11]=m>>>29,r[12]=m>>>21&255,r[13]=m>>>13&255,r[14]=m>>>5&255,r[15]=m<<3&255,t.mac(En.MAC.GCM,En.HEAP_DATA,16),t.get_iv(En.HEAP_DATA),t.set_counter(0,0,0,this.gamma0),t.cipher(En.ENC.CTR,En.HEAP_DATA,16);let g=0;for(let y=0;y0;){for(u=Yo(i,0,t,a,s),a+=u,s-=u;15&u;)i[u++]=0;r.mac(En.MAC.GCM,En.HEAP_DATA,u)}}}const j_=Pe.getWebCrypto(),c5=Pe.getNodeCrypto(),d5=Pe.getNodeBuffer(),tu=16,U_="AES-GCM";async function su(e,t){if(e!==he.symmetric.aes128&&e!==he.symmetric.aes192&&e!==he.symmetric.aes256)throw Error("GCM mode supports only AES cipher");if(Pe.getWebCrypto()&&t.length!==24){const r=await j_.importKey("raw",t,{name:U_},!1,["encrypt","decrypt"]);return{encrypt:async function(i,a,s=new Uint8Array){if(!i.length)return Jo.encrypt(i,t,a,s);const u=await j_.encrypt({name:U_,iv:a,additionalData:s,tagLength:8*tu},r,i);return new Uint8Array(u)},decrypt:async function(i,a,s=new Uint8Array){if(i.length===tu)return Jo.decrypt(i,t,a,s);const u=await j_.decrypt({name:U_,iv:a,additionalData:s,tagLength:8*tu},r,i);return new Uint8Array(u)}}}return Pe.getNodeCrypto()?{encrypt:async function(r,i,a=new Uint8Array){const s=new c5.createCipheriv("aes-"+8*t.length+"-gcm",t,i);s.setAAD(a);const u=d5.concat([s.update(r),s.final(),s.getAuthTag()]);return new Uint8Array(u)},decrypt:async function(r,i,a=new Uint8Array){const s=new c5.createDecipheriv("aes-"+8*t.length+"-gcm",t,i);s.setAAD(a),s.setAuthTag(r.slice(r.length-tu,r.length));const u=d5.concat([s.update(r.slice(0,r.length-tu)),s.final()]);return new Uint8Array(u)}}:{encrypt:async function(r,i,a){return Jo.encrypt(r,t,i,a)},decrypt:async function(r,i,a){return Jo.decrypt(r,t,i,a)}}}su.getNonce=function(e,t){const r=e.slice();for(let i=0;i >>8)-1}(ae,ee,F,I,32)}function g(ae,ee){var F;for(F=0;F<16;F++)ae[F]=0|ee[F]}function y(ae){var ee,F,I=1;for(ee=0;ee<16;ee++)F=ae[ee]+I+65535,I=Math.floor(F/65536),ae[ee]=F-65536*I;ae[0]+=I-1+37*(I-1)}function b(ae,ee,F){for(var I,J=~(F-1),q=0;q<16;q++)I=J&(ae[q]^ee[q]),ae[q]^=I,ee[q]^=I}function k(ae,ee){var F,I,J,q=r(),fe=r();for(F=0;F<16;F++)fe[F]=ee[F];for(y(fe),y(fe),y(fe),I=0;I<2;I++){for(q[0]=fe[0]-65517,F=1;F<15;F++)q[F]=fe[F]-65535-(q[F-1]>>16&1),q[F-1]&=65535;q[15]=fe[15]-32767-(q[14]>>16&1),J=q[15]>>16&1,q[14]&=65535,b(fe,q,1-J)}for(F=0;F<16;F++)ae[2*F]=255&fe[F],ae[2*F+1]=fe[F]>>8}function O(ae,ee){var F=new Uint8Array(32),I=new Uint8Array(32);return k(F,ae),k(I,ee),m(F,0,I,0)}function S(ae){var ee=new Uint8Array(32);return k(ee,ae),1&ee[0]}function x(ae,ee){var F;for(F=0;F<16;F++)ae[F]=ee[2*F]+(ee[2*F+1]<<8);ae[15]&=32767}function E(ae,ee,F){for(var I=0;I<16;I++)ae[I]=ee[I]+F[I]}function w(ae,ee,F){for(var I=0;I<16;I++)ae[I]=ee[I]-F[I]}function T(ae,ee,F){var I,J,q=0,fe=0,Ce=0,X=0,H=0,re=0,Z=0,Oe=0,ve=0,U=0,xe=0,me=0,se=0,B=0,V=0,G=0,te=0,oe=0,_e=0,ce=0,le=0,Ve=0,Je=0,gt=0,Pt=0,At=0,It=0,ht=0,Rt=0,Tt=0,dn=0,nn=F[0],Xt=F[1],Gt=F[2],Zt=F[3],Yt=F[4],un=F[5],qt=F[6],rt=F[7],at=F[8],xt=F[9],Ut=F[10],Ee=F[11],Be=F[12],Fe=F[13],Le=F[14],tt=F[15];q+=(I=ee[0])*nn,fe+=I*Xt,Ce+=I*Gt,X+=I*Zt,H+=I*Yt,re+=I*un,Z+=I*qt,Oe+=I*rt,ve+=I*at,U+=I*xt,xe+=I*Ut,me+=I*Ee,se+=I*Be,B+=I*Fe,V+=I*Le,G+=I*tt,fe+=(I=ee[1])*nn,Ce+=I*Xt,X+=I*Gt,H+=I*Zt,re+=I*Yt,Z+=I*un,Oe+=I*qt,ve+=I*rt,U+=I*at,xe+=I*xt,me+=I*Ut,se+=I*Ee,B+=I*Be,V+=I*Fe,G+=I*Le,te+=I*tt,Ce+=(I=ee[2])*nn,X+=I*Xt,H+=I*Gt,re+=I*Zt,Z+=I*Yt,Oe+=I*un,ve+=I*qt,U+=I*rt,xe+=I*at,me+=I*xt,se+=I*Ut,B+=I*Ee,V+=I*Be,G+=I*Fe,te+=I*Le,oe+=I*tt,X+=(I=ee[3])*nn,H+=I*Xt,re+=I*Gt,Z+=I*Zt,Oe+=I*Yt,ve+=I*un,U+=I*qt,xe+=I*rt,me+=I*at,se+=I*xt,B+=I*Ut,V+=I*Ee,G+=I*Be,te+=I*Fe,oe+=I*Le,_e+=I*tt,H+=(I=ee[4])*nn,re+=I*Xt,Z+=I*Gt,Oe+=I*Zt,ve+=I*Yt,U+=I*un,xe+=I*qt,me+=I*rt,se+=I*at,B+=I*xt,V+=I*Ut,G+=I*Ee,te+=I*Be,oe+=I*Fe,_e+=I*Le,ce+=I*tt,re+=(I=ee[5])*nn,Z+=I*Xt,Oe+=I*Gt,ve+=I*Zt,U+=I*Yt,xe+=I*un,me+=I*qt,se+=I*rt,B+=I*at,V+=I*xt,G+=I*Ut,te+=I*Ee,oe+=I*Be,_e+=I*Fe,ce+=I*Le,le+=I*tt,Z+=(I=ee[6])*nn,Oe+=I*Xt,ve+=I*Gt,U+=I*Zt,xe+=I*Yt,me+=I*un,se+=I*qt,B+=I*rt,V+=I*at,G+=I*xt,te+=I*Ut,oe+=I*Ee,_e+=I*Be,ce+=I*Fe,le+=I*Le,Ve+=I*tt,Oe+=(I=ee[7])*nn,ve+=I*Xt,U+=I*Gt,xe+=I*Zt,me+=I*Yt,se+=I*un,B+=I*qt,V+=I*rt,G+=I*at,te+=I*xt,oe+=I*Ut,_e+=I*Ee,ce+=I*Be,le+=I*Fe,Ve+=I*Le,Je+=I*tt,ve+=(I=ee[8])*nn,U+=I*Xt,xe+=I*Gt,me+=I*Zt,se+=I*Yt,B+=I*un,V+=I*qt,G+=I*rt,te+=I*at,oe+=I*xt,_e+=I*Ut,ce+=I*Ee,le+=I*Be,Ve+=I*Fe,Je+=I*Le,gt+=I*tt,U+=(I=ee[9])*nn,xe+=I*Xt,me+=I*Gt,se+=I*Zt,B+=I*Yt,V+=I*un,G+=I*qt,te+=I*rt,oe+=I*at,_e+=I*xt,ce+=I*Ut,le+=I*Ee,Ve+=I*Be,Je+=I*Fe,gt+=I*Le,Pt+=I*tt,xe+=(I=ee[10])*nn,me+=I*Xt,se+=I*Gt,B+=I*Zt,V+=I*Yt,G+=I*un,te+=I*qt,oe+=I*rt,_e+=I*at,ce+=I*xt,le+=I*Ut,Ve+=I*Ee,Je+=I*Be,gt+=I*Fe,Pt+=I*Le,At+=I*tt,me+=(I=ee[11])*nn,se+=I*Xt,B+=I*Gt,V+=I*Zt,G+=I*Yt,te+=I*un,oe+=I*qt,_e+=I*rt,ce+=I*at,le+=I*xt,Ve+=I*Ut,Je+=I*Ee,gt+=I*Be,Pt+=I*Fe,At+=I*Le,It+=I*tt,se+=(I=ee[12])*nn,B+=I*Xt,V+=I*Gt,G+=I*Zt,te+=I*Yt,oe+=I*un,_e+=I*qt,ce+=I*rt,le+=I*at,Ve+=I*xt,Je+=I*Ut,gt+=I*Ee,Pt+=I*Be,At+=I*Fe,It+=I*Le,ht+=I*tt,B+=(I=ee[13])*nn,V+=I*Xt,G+=I*Gt,te+=I*Zt,oe+=I*Yt,_e+=I*un,ce+=I*qt,le+=I*rt,Ve+=I*at,Je+=I*xt,gt+=I*Ut,Pt+=I*Ee,At+=I*Be,It+=I*Fe,ht+=I*Le,Rt+=I*tt,V+=(I=ee[14])*nn,G+=I*Xt,te+=I*Gt,oe+=I*Zt,_e+=I*Yt,ce+=I*un,le+=I*qt,Ve+=I*rt,Je+=I*at,gt+=I*xt,Pt+=I*Ut,At+=I*Ee,It+=I*Be,ht+=I*Fe,Rt+=I*Le,Tt+=I*tt,G+=(I=ee[15])*nn,fe+=38*(oe+=I*Gt),Ce+=38*(_e+=I*Zt),X+=38*(ce+=I*Yt),H+=38*(le+=I*un),re+=38*(Ve+=I*qt),Z+=38*(Je+=I*rt),Oe+=38*(gt+=I*at),ve+=38*(Pt+=I*xt),U+=38*(At+=I*Ut),xe+=38*(It+=I*Ee),me+=38*(ht+=I*Be),se+=38*(Rt+=I*Fe),B+=38*(Tt+=I*Le),V+=38*(dn+=I*tt),q=(I=(q+=38*(te+=I*Xt))+(J=1)+65535)-65536*(J=Math.floor(I/65536)),fe=(I=fe+J+65535)-65536*(J=Math.floor(I/65536)),Ce=(I=Ce+J+65535)-65536*(J=Math.floor(I/65536)),X=(I=X+J+65535)-65536*(J=Math.floor(I/65536)),H=(I=H+J+65535)-65536*(J=Math.floor(I/65536)),re=(I=re+J+65535)-65536*(J=Math.floor(I/65536)),Z=(I=Z+J+65535)-65536*(J=Math.floor(I/65536)),Oe=(I=Oe+J+65535)-65536*(J=Math.floor(I/65536)),ve=(I=ve+J+65535)-65536*(J=Math.floor(I/65536)),U=(I=U+J+65535)-65536*(J=Math.floor(I/65536)),xe=(I=xe+J+65535)-65536*(J=Math.floor(I/65536)),me=(I=me+J+65535)-65536*(J=Math.floor(I/65536)),se=(I=se+J+65535)-65536*(J=Math.floor(I/65536)),B=(I=B+J+65535)-65536*(J=Math.floor(I/65536)),V=(I=V+J+65535)-65536*(J=Math.floor(I/65536)),G=(I=G+J+65535)-65536*(J=Math.floor(I/65536)),q=(I=(q+=J-1+37*(J-1))+(J=1)+65535)-65536*(J=Math.floor(I/65536)),fe=(I=fe+J+65535)-65536*(J=Math.floor(I/65536)),Ce=(I=Ce+J+65535)-65536*(J=Math.floor(I/65536)),X=(I=X+J+65535)-65536*(J=Math.floor(I/65536)),H=(I=H+J+65535)-65536*(J=Math.floor(I/65536)),re=(I=re+J+65535)-65536*(J=Math.floor(I/65536)),Z=(I=Z+J+65535)-65536*(J=Math.floor(I/65536)),Oe=(I=Oe+J+65535)-65536*(J=Math.floor(I/65536)),ve=(I=ve+J+65535)-65536*(J=Math.floor(I/65536)),U=(I=U+J+65535)-65536*(J=Math.floor(I/65536)),xe=(I=xe+J+65535)-65536*(J=Math.floor(I/65536)),me=(I=me+J+65535)-65536*(J=Math.floor(I/65536)),se=(I=se+J+65535)-65536*(J=Math.floor(I/65536)),B=(I=B+J+65535)-65536*(J=Math.floor(I/65536)),V=(I=V+J+65535)-65536*(J=Math.floor(I/65536)),G=(I=G+J+65535)-65536*(J=Math.floor(I/65536)),q+=J-1+37*(J-1),ae[0]=q,ae[1]=fe,ae[2]=Ce,ae[3]=X,ae[4]=H,ae[5]=re,ae[6]=Z,ae[7]=Oe,ae[8]=ve,ae[9]=U,ae[10]=xe,ae[11]=me,ae[12]=se,ae[13]=B,ae[14]=V,ae[15]=G}function M(ae,ee){T(ae,ee,ee)}function A(ae,ee){var F,I=r();for(F=0;F<16;F++)I[F]=ee[F];for(F=253;F>=0;F--)M(I,I),F!==2&&F!==4&&T(I,I,ee);for(F=0;F<16;F++)ae[F]=I[F]}function L(ae,ee,F){var I,J,q=new Uint8Array(32),fe=new Float64Array(80),Ce=r(),X=r(),H=r(),re=r(),Z=r(),Oe=r();for(J=0;J<31;J++)q[J]=ee[J];for(q[31]=127&ee[31]|64,q[0]&=248,x(fe,F),J=0;J<16;J++)X[J]=fe[J],re[J]=Ce[J]=H[J]=0;for(Ce[0]=re[0]=1,J=254;J>=0;--J)b(Ce,X,I=q[J>>>3]>>>(7&J)&1),b(H,re,I),E(Z,Ce,H),w(Ce,Ce,H),E(H,X,re),w(X,X,re),M(re,Z),M(Oe,Ce),T(Ce,H,Ce),T(H,X,Z),E(Z,Ce,H),w(Ce,Ce,H),M(X,Ce),w(H,re,Oe),T(Ce,H,c),E(Ce,Ce,re),T(H,H,Ce),T(Ce,re,Oe),T(re,X,fe),M(X,Z),b(Ce,X,I),b(H,re,I);for(J=0;J<16;J++)fe[J+16]=Ce[J],fe[J+32]=H[J],fe[J+48]=X[J],fe[J+64]=re[J];var ve=fe.subarray(32),U=fe.subarray(16);return A(ve,ve),T(U,U,ve),k(ae,U),0}function Y(ae,ee){return L(ae,ee,a)}function N(ae,ee){var F=r(),I=r(),J=r(),q=r(),fe=r(),Ce=r(),X=r(),H=r(),re=r();w(F,ae[1],ae[0]),w(re,ee[1],ee[0]),T(F,F,re),E(I,ae[0],ae[1]),E(re,ee[0],ee[1]),T(I,I,re),T(J,ae[3],ee[3]),T(J,J,n),T(q,ae[2],ee[2]),E(q,q,q),w(fe,I,F),w(Ce,q,J),E(X,q,J),E(H,I,F),T(ae[0],fe,Ce),T(ae[1],H,X),T(ae[2],X,Ce),T(ae[3],fe,H)}function W(ae,ee,F){var I;for(I=0;I<4;I++)b(ae[I],ee[I],F)}function j(ae,ee){var F=r(),I=r(),J=r();A(J,ee[2]),T(F,ee[0],J),T(I,ee[1],J),k(ae,I),ae[31]^=S(F)<<7}function ue(ae,ee,F){var I,J;for(g(ae[0],s),g(ae[1],u),g(ae[2],u),g(ae[3],s),J=255;J>=0;--J)W(ae,ee,I=F[J/8|0]>>(7&J)&1),N(ee,ae),N(ae,ae),W(ae,ee,I)}function Te(ae,ee){var F=[r(),r(),r(),r()];g(F[0],p),g(F[1],d),g(F[2],u),T(F[3],p,d),ue(ae,F,ee)}function pe(ae,ee,F){var I,J,q=[r(),r(),r(),r()];for(F||i(ee,32),(I=t.hash(ee.subarray(0,32)))[0]&=248,I[31]&=127,I[31]|=64,Te(q,I),j(ae,q),J=0;J<32;J++)ee[J+32]=ae[J];return 0}var ye=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function de(ae,ee){var F,I,J,q;for(I=63;I>=32;--I){for(F=0,J=I-32,q=I-12;J >4)*ye[J],F=ee[J]>>8,ee[J]&=255;for(J=0;J<32;J++)ee[J]-=F*ye[J];for(I=0;I<32;I++)ee[I+1]+=ee[I]>>8,ae[I]=255&ee[I]}function ke(ae){var ee,F=new Float64Array(64);for(ee=0;ee<64;ee++)F[ee]=ae[ee];for(ee=0;ee<64;ee++)ae[ee]=0;de(ae,F)}function ie(ae,ee){var F=r(),I=r(),J=r(),q=r(),fe=r(),Ce=r(),X=r();return g(ae[2],u),x(ae[1],ee),M(J,ae[1]),T(q,J,h),w(J,J,ae[2]),E(q,ae[2],q),M(fe,q),M(Ce,fe),T(X,Ce,fe),T(F,X,J),T(F,F,q),function(H,re){var Z,Oe=r();for(Z=0;Z<16;Z++)Oe[Z]=re[Z];for(Z=250;Z>=0;Z--)M(Oe,Oe),Z!==1&&T(Oe,Oe,re);for(Z=0;Z<16;Z++)H[Z]=Oe[Z]}(F,F),T(F,F,J),T(F,F,q),T(F,F,q),T(ae[0],F,q),M(I,ae[0]),T(I,I,q),O(I,J)&&T(ae[0],ae[0],v),M(I,ae[0]),T(I,I,q),O(I,J)?-1:(S(ae[0])===ee[31]>>7&&w(ae[0],s,ae[0]),T(ae[3],ae[0],ae[1]),0)}var be=64;function Ie(){for(var ae=0;ae=0},t.sign.keyPair=function(){var ae=new Uint8Array(32),ee=new Uint8Array(64);return pe(ae,ee),{publicKey:ae,secretKey:ee}},t.sign.keyPair.fromSecretKey=function(ae){if(Ie(ae),ae.length!==64)throw Error("bad secret key size");for(var ee=new Uint8Array(32),F=0;F e&&(h.imod(s.leftShift(a)).iadd(s),n=h.mod(u).toNumber());while(!await sD(h,t,r));return h}async function sD(e,t,r){return!(t&&!e.dec().gcd(t).isOne())&&!!await async function(i){const a=await Pe.getBigInteger();return tV.every(s=>i.mod(new a(s))!==0)}(e)&&!!await async function(i,a){const s=await Pe.getBigInteger();return a=a||new s(2),a.modExp(i.dec(),i).isOne()}(e)&&!!await async function(i,a,s){const u=await Pe.getBigInteger(),c=i.bitLength();a||(a=Math.max(1,c/48|0));const h=i.dec();let n=0;for(;!h.getBit(n);)n++;const p=i.rightShift(new u(n));for(;a>0;a--){let d,v=(s?s():await Is(new u(2),h)).modExp(p,i);if(!v.isOne()&&!v.equal(h)){for(d=1;d t-11)throw Error("Message too long");const i=function(s){const u=new Uint8Array(s);let c=0;for(;c =8&!i;if(t)return Pe.selectUint8Array(u,s,t);if(u)return s;throw Error("Decryption error")}async function cy(e,t,r){let i;if(t.length!==wu.getHashByteLength(e))throw Error("Invalid hash length");const a=new Uint8Array(ja[e].length);for(i=0;iimport("./bn.min.f47e2400.js"),[]),O=new k(g),S=new k(y),x=new k(m),E=x.mod(S.subn(1)),w=x.mod(O.subn(1)),T=ei.createSign(he.read(he.hash,n));T.write(p),T.end();const M={version:0,modulus:new k(d),publicExponent:new k(v),privateExponent:new k(m),prime1:new k(y),prime2:new k(g),exponent1:E,exponent2:w,coefficient:new k(b)};if(ei.createPrivateKey!==void 0){const L=Xl.encode(M,"der");return new Uint8Array(T.sign({key:L,format:"der",type:"pkcs1"}))}const A=Xl.encode(M,"pem",{label:"RSA PRIVATE KEY"});return new Uint8Array(T.sign(A))}(e,t,r,i,a,s,u,c)}return async function(n,p,d,v){const m=await Pe.getBigInteger();p=new m(p);const g=new m(await cy(n,v,p.byteLength()));if(d=new m(d),g.gte(p))throw Error("Message size cannot exceed modulus size");return g.modExp(d,p).toUint8Array("be",p.byteLength())}(e,r,a,h)},verify:async function(e,t,r,i,a,s){if(t&&!Pe.isStream(t)){if(Pe.getWebCrypto())try{return await async function(u,c,h,n,p){const d=function(m,g){return{kty:"RSA",n:zi(m,!0),e:zi(g,!0),ext:!0}}(n,p),v=await Yl.importKey("jwk",d,{name:"RSASSA-PKCS1-v1_5",hash:{name:u}},!1,["verify"]);return Yl.verify("RSASSA-PKCS1-v1_5",v,h,c)}(he.read(he.webHash,e),t,r,i,a)}catch(u){Pe.printDebugError(u)}else if(Pe.getNodeCrypto())return async function(u,c,h,n,p){const{default:d}=await Cn(()=>import("./bn.min.f47e2400.js"),[]),v=ei.createVerify(he.read(he.hash,u));v.write(c),v.end();const m={modulus:new d(n),publicExponent:new d(p)};let g;ei.createPrivateKey!==void 0?g={key:Yh.encode(m,"der"),format:"der",type:"pkcs1"}:g=Yh.encode(m,"pem",{label:"RSA PUBLIC KEY"});try{return await v.verify(g,h)}catch{return!1}}(e,t,r,i,a)}return async function(u,c,h,n,p){const d=await Pe.getBigInteger();if(h=new d(h),c=new d(c),n=new d(n),c.gte(h))throw Error("Signature size cannot exceed modulus size");const v=c.modExp(n,h).toUint8Array("be",h.byteLength()),m=await cy(u,p,h.byteLength());return Pe.equalsUint8Array(v,m)}(e,r,i,a,s)},encrypt:async function(e,t,r){return Pe.getNodeCrypto()?async function(i,a,s){const{default:u}=await Cn(()=>import("./bn.min.f47e2400.js"),[]),c={modulus:new u(a),publicExponent:new u(s)};let h;return ei.createPrivateKey!==void 0?h={key:Yh.encode(c,"der"),format:"der",type:"pkcs1",padding:ei.constants.RSA_PKCS1_PADDING}:h={key:Yh.encode(c,"pem",{label:"RSA PUBLIC KEY"}),padding:ei.constants.RSA_PKCS1_PADDING},new Uint8Array(ei.publicEncrypt(h,i))}(e,t,r):async function(i,a,s){const u=await Pe.getBigInteger();if(a=new u(a),i=new u(Y0(i,a.byteLength())),s=new u(s),i.gte(a))throw Error("Message size cannot exceed modulus size");return i.modExp(s,a).toUint8Array("be",a.byteLength())}(e,t,r)},decrypt:async function(e,t,r,i,a,s,u,c){return Pe.getNodeCrypto()?async function(h,n,p,d,v,m,g,y){const{default:b}=await Cn(()=>import("./bn.min.f47e2400.js"),[]),k=new b(v),O=new b(m),S=new b(d),x=S.mod(O.subn(1)),E=S.mod(k.subn(1)),w={version:0,modulus:new b(n),publicExponent:new b(p),privateExponent:new b(d),prime1:new b(m),prime2:new b(v),exponent1:x,exponent2:E,coefficient:new b(g)};let T;ei.createPrivateKey!==void 0?T={key:Xl.encode(w,"der"),format:"der",type:"pkcs1",padding:ei.constants.RSA_PKCS1_PADDING}:T={key:Xl.encode(w,"pem",{label:"RSA PRIVATE KEY"}),padding:ei.constants.RSA_PKCS1_PADDING};try{return new Uint8Array(ei.privateDecrypt(T,h))}catch{if(y)return y;throw Error("Decryption error")}}(e,t,r,i,a,s,u,c):async function(h,n,p,d,v,m,g,y){const b=await Pe.getBigInteger();if(h=new b(h),n=new b(n),p=new b(p),d=new b(d),v=new b(v),m=new b(m),g=new b(g),h.gte(n))throw Error("Data too large.");const k=d.mod(m.dec()),O=d.mod(v.dec()),S=(await Is(new b(2),n)).mod(n),x=S.modInv(n).modExp(p,n);h=h.mul(x).mod(n);const E=h.modExp(O,v),w=h.modExp(k,m);let M=g.mul(w.sub(E)).mod(m).mul(v).add(E);return M=M.mul(S).mod(n),X0(M.toUint8Array("be",n.byteLength()),y)}(e,t,r,i,a,s,u,c)},generate:async function(e,t){if(t=new(await Pe.getBigInteger())(t),Pe.getWebCrypto()){const u={name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:t.toUint8Array(),hash:{name:"SHA-1"}},c=await Yl.generateKey(u,!0,["sign","verify"]),h=await Yl.exportKey("jwk",c.privateKey);return{n:ws(h.n),e:t.toUint8Array(),d:ws(h.d),p:ws(h.q),q:ws(h.p),u:ws(h.qi)}}if(Pe.getNodeCrypto()&&ei.generateKeyPair&&Xl){const u={modulusLength:e,publicExponent:t.toNumber(),publicKeyEncoding:{type:"pkcs1",format:"der"},privateKeyEncoding:{type:"pkcs1",format:"der"}},c=await new Promise((h,n)=>{ei.generateKeyPair("rsa",u,(p,d,v)=>{p?n(p):h(Xl.decode(v,"der"))})});return{n:c.modulus.toArrayLike(Uint8Array),e:c.publicExponent.toArrayLike(Uint8Array),d:c.privateExponent.toArrayLike(Uint8Array),p:c.prime2.toArrayLike(Uint8Array),q:c.prime1.toArrayLike(Uint8Array),u:c.coefficient.toArrayLike(Uint8Array)}}let r,i,a;do i=await h5(e-(e>>1),t,40),r=await h5(e>>1,t,40),a=r.mul(i);while(a.bitLength()!==e);const s=r.dec().imul(i.dec());return i.lt(r)&&([r,i]=[i,r]),{n:a.toUint8Array(),e:t.toUint8Array(),d:t.modInv(s).toUint8Array(),p:r.toUint8Array(),q:i.toUint8Array(),u:r.modInv(i).toUint8Array()}},validateParams:async function(e,t,r,i,a,s){const u=await Pe.getBigInteger();if(e=new u(e),i=new u(i),a=new u(a),!i.mul(a).equal(e))return!1;const c=new u(2);if(s=new u(s),!i.mul(s).mod(a).isOne())return!1;t=new u(t),r=new u(r);const h=new u(Math.floor(e.bitLength()/3)),n=await Is(c,c.leftShift(h)),p=n.mul(r).mul(t);return!(!p.mod(i.dec()).equal(n)||!p.mod(a.dec()).equal(n))}}),iV=Object.freeze({__proto__:null,encrypt:async function(e,t,r,i){const a=await Pe.getBigInteger();t=new a(t),r=new a(r),i=new a(i);const s=new a(Y0(e,t.byteLength())),u=await Is(new a(1),t.dec());return{c1:r.modExp(u,t).toUint8Array(),c2:i.modExp(u,t).imul(s).imod(t).toUint8Array()}},decrypt:async function(e,t,r,i,a){const s=await Pe.getBigInteger();return e=new s(e),t=new s(t),r=new s(r),i=new s(i),X0(e.modExp(i,r).modInv(r).imul(t).imod(r).toUint8Array("be",r.byteLength()),a)},validateParams:async function(e,t,r,i){const a=await Pe.getBigInteger();e=new a(e),t=new a(t),r=new a(r);const s=new a(1);if(t.lte(s)||t.gte(e))return!1;const u=new a(e.bitLength()),c=new a(1023);if(u.lt(c)||!t.modExp(e.dec(),e).isOne())return!1;let h=t;const n=new a(1),p=new a(2).leftShift(new a(17));for(;n.lt(p);){if(h=h.mul(t).imod(e),h.isOne())return!1;n.iinc()}i=new a(i);const d=new a(2),v=await Is(d.leftShift(u.dec()),d.leftShift(u)),m=e.dec().imul(v).iadd(i);return!!r.equal(t.modExp(m,e))}});class Ka{constructor(t){if(t instanceof Ka)this.oid=t.oid;else if(Pe.isArray(t)||Pe.isUint8Array(t)){if((t=new Uint8Array(t))[0]===6){if(t[1]!==t.length-2)throw Error("Length mismatch in DER encoded oid");t=t.subarray(2)}this.oid=t}else this.oid=""}read(t){if(t.length>=1){const r=t[0];if(t.length>=1+r)return this.oid=t.subarray(1,1+r),1+this.oid.length}throw Error("Invalid oid")}write(){return Pe.concatUint8Array([new Uint8Array([this.oid.length]),this.oid])}toHex(){return Pe.uint8ArrayToHex(this.oid)}getName(){const t=this.toHex();if(he.curve[t])return he.write(he.curve,t);throw Error("Unknown curve object identifier.")}}function tm(e,t){return e.keyPair({priv:t})}function nm(e,t){const r=e.keyPair({pub:t});if(r.validate().result!==!0)throw Error("Invalid elliptic public key");return r}async function Ru(e){if(!Nt.useIndutnyElliptic)throw Error("This curve is only supported in the full build of OpenPGP.js");const{default:t}=await Cn(()=>import("./elliptic.min.2279bef2.js"),["js/build/elliptic.min.2279bef2.js","js/build/bn.min.f47e2400.js"]);return new t.ec(e)}function lD(e){let t,r=0;const i=e[0];return i<192?([r]=e,t=1):i<255?(r=(e[0]-192<<8)+e[1]+192,t=2):i===255&&(r=Pe.readNumber(e.subarray(1,5)),t=5),{len:r,offset:t}}function Md(e){return e<192?new Uint8Array([e]):e>191&&e<8384?new Uint8Array([192+(e-192>>8),e-192&255]):Pe.concatUint8Array([new Uint8Array([255]),Pe.writeNumber(e,4)])}function aV(e){if(e<0||e>30)throw Error("Partial Length power must be between 1 and 30");return new Uint8Array([224+e])}function uD(e){return new Uint8Array([192|e])}function p5(e,t){return Pe.concatUint8Array([uD(e),Md(t)])}function Ep(e){return[he.packet.literalData,he.packet.compressedData,he.packet.symmetricallyEncryptedData,he.packet.symEncryptedIntegrityProtectedData,he.packet.aeadEncryptedData].includes(e)}async function sV(e,t){const r=ls(e);let i,a;try{const s=await r.peekBytes(2);if(!s||s.length<2||(128&s[0])==0)throw Error("Error during parsing. This message / key probably does not conform to a valid OpenPGP format.");const u=await r.readByte();let c,h,n=-1,p=-1;p=0,(64&u)!=0&&(p=1),p?n=63&u:(n=(63&u)>>2,h=3&u);const d=Ep(n);let v,m=null;if(d){if(Pe.isStream(e)==="array"){const y=new Qa;i=Ri(y),m=y}else{const y=new bu;i=Ri(y.writable),m=y.readable}a=t({tag:n,packet:m})}else m=[];do{if(p){const y=await r.readByte();if(v=!1,y<192)c=y;else if(y>=192&&y<224)c=(y-192<<8)+await r.readByte()+192;else if(y>223&&y<255){if(c=1<<(31&y),v=!0,!d)throw new TypeError("This packet type does not support partial lengths.")}else c=await r.readByte()<<24|await r.readByte()<<16|await r.readByte()<<8|await r.readByte()}else switch(h){case 0:c=await r.readByte();break;case 1:c=await r.readByte()<<8|await r.readByte();break;case 2:c=await r.readByte()<<24|await r.readByte()<<16|await r.readByte()<<8|await r.readByte();break;default:c=1/0}if(c>0){let y=0;for(;;){i&&await i.ready;const{done:b,value:k}=await r.read();if(b){if(c===1/0)break;throw Error("Unexpected end of packet")}const O=c===1/0?k:k.subarray(0,c-y);if(i?await i.write(O):m.push(O),y+=k.length,y>=c){r.unshift(k.subarray(c-y+k.length));break}}}}while(v);const g=await r.peekBytes(d?1/0:2);return i?(await i.ready,await i.close()):(m=Pe.concatUint8Array(m),await t({tag:n,packet:m})),!g||!g.length}catch(s){if(i)return await i.abort(s),!0;throw s}finally{i&&await a,r.releaseLock()}}class kr extends Error{constructor(...t){super(...t),Error.captureStackTrace&&Error.captureStackTrace(this,kr),this.name="UnsupportedError"}}class dy{constructor(t,r){this.tag=t,this.rawContent=r}write(){return this.rawContent}}const V_=Pe.getWebCrypto(),dv=Pe.getNodeCrypto(),is={p256:"P-256",p384:"P-384",p521:"P-521"},ms=dv?dv.getCurves():[],Xs=dv?{secp256k1:ms.includes("secp256k1")?"secp256k1":void 0,p256:ms.includes("prime256v1")?"prime256v1":void 0,p384:ms.includes("secp384r1")?"secp384r1":void 0,p521:ms.includes("secp521r1")?"secp521r1":void 0,ed25519:ms.includes("ED25519")?"ED25519":void 0,curve25519:ms.includes("X25519")?"X25519":void 0,brainpoolP256r1:ms.includes("brainpoolP256r1")?"brainpoolP256r1":void 0,brainpoolP384r1:ms.includes("brainpoolP384r1")?"brainpoolP384r1":void 0,brainpoolP512r1:ms.includes("brainpoolP512r1")?"brainpoolP512r1":void 0}:{},Dp={p256:{oid:[6,8,42,134,72,206,61,3,1,7],keyType:he.publicKey.ecdsa,hash:he.hash.sha256,cipher:he.symmetric.aes128,node:Xs.p256,web:is.p256,payloadSize:32,sharedSize:256},p384:{oid:[6,5,43,129,4,0,34],keyType:he.publicKey.ecdsa,hash:he.hash.sha384,cipher:he.symmetric.aes192,node:Xs.p384,web:is.p384,payloadSize:48,sharedSize:384},p521:{oid:[6,5,43,129,4,0,35],keyType:he.publicKey.ecdsa,hash:he.hash.sha512,cipher:he.symmetric.aes256,node:Xs.p521,web:is.p521,payloadSize:66,sharedSize:528},secp256k1:{oid:[6,5,43,129,4,0,10],keyType:he.publicKey.ecdsa,hash:he.hash.sha256,cipher:he.symmetric.aes128,node:Xs.secp256k1,payloadSize:32},ed25519:{oid:[6,9,43,6,1,4,1,218,71,15,1],keyType:he.publicKey.eddsa,hash:he.hash.sha512,node:!1,payloadSize:32},curve25519:{oid:[6,10,43,6,1,4,1,151,85,1,5,1],keyType:he.publicKey.ecdh,hash:he.hash.sha256,cipher:he.symmetric.aes128,node:!1,payloadSize:32},brainpoolP256r1:{oid:[6,9,43,36,3,3,2,8,1,1,7],keyType:he.publicKey.ecdsa,hash:he.hash.sha256,cipher:he.symmetric.aes128,node:Xs.brainpoolP256r1,payloadSize:32},brainpoolP384r1:{oid:[6,9,43,36,3,3,2,8,1,1,11],keyType:he.publicKey.ecdsa,hash:he.hash.sha384,cipher:he.symmetric.aes192,node:Xs.brainpoolP384r1,payloadSize:48},brainpoolP512r1:{oid:[6,9,43,36,3,3,2,8,1,1,13],keyType:he.publicKey.ecdsa,hash:he.hash.sha512,cipher:he.symmetric.aes256,node:Xs.brainpoolP512r1,payloadSize:64}};class $s{constructor(t,r){try{(Pe.isArray(t)||Pe.isUint8Array(t))&&(t=new Ka(t)),t instanceof Ka&&(t=t.getName()),this.name=he.write(he.curve,t)}catch{throw new kr("Unknown curve")}r=r||Dp[this.name],this.keyType=r.keyType,this.oid=r.oid,this.hash=r.hash,this.cipher=r.cipher,this.node=r.node&&Dp[this.name],this.web=r.web&&Dp[this.name],this.payloadSize=r.payloadSize,this.web&&Pe.getWebCrypto()?this.type="web":this.node&&Pe.getNodeCrypto()?this.type="node":this.name==="curve25519"?this.type="curve25519":this.name==="ed25519"&&(this.type="ed25519")}async genKeyPair(){let t;switch(this.type){case"web":try{return await async function(i){const a=await V_.generateKey({name:"ECDSA",namedCurve:is[i]},!0,["sign","verify"]),s=await V_.exportKey("jwk",a.privateKey),u=await V_.exportKey("jwk",a.publicKey);return{publicKey:dD(u),privateKey:ws(s.d)}}(this.name)}catch(i){Pe.printDebugError("Browser did not support generating ec key "+i.message);break}case"node":return async function(i){const a=dv.createECDH(Xs[i]);return await a.generateKeys(),{publicKey:new Uint8Array(a.getPublicKey()),privateKey:new Uint8Array(a.getPrivateKey())}}(this.name);case"curve25519":{const i=rs(32);i[0]=127&i[0]|64,i[31]&=248;const a=i.slice().reverse();return t=ns.box.keyPair.fromSecretKey(a),{publicKey:Pe.concatUint8Array([new Uint8Array([64]),t.publicKey]),privateKey:i}}case"ed25519":{const i=rs(32),a=ns.sign.keyPair.fromSeed(i);return{publicKey:Pe.concatUint8Array([new Uint8Array([64]),a.publicKey]),privateKey:i}}}return t=await(await Ru(this.name)).genKeyPair({entropy:Pe.uint8ArrayToString(rs(32))}),{publicKey:new Uint8Array(t.getPublic("array",!1)),privateKey:t.getPrivate().toArrayLike(Uint8Array)}}}async function cD(e,t,r,i){const a={p256:!0,p384:!0,p521:!0,secp256k1:!0,curve25519:e===he.publicKey.ecdh,brainpoolP256r1:!0,brainpoolP384r1:!0,brainpoolP512r1:!0},s=t.getName();if(!a[s])return!1;if(s==="curve25519"){i=i.slice().reverse();const{publicKey:c}=ns.box.keyPair.fromSecretKey(i);r=new Uint8Array(r);const h=new Uint8Array([64,...c]);return!!Pe.equalsUint8Array(h,r)}const u=await Ru(s);try{r=nm(u,r).getPublic()}catch{return!1}return!!tm(u,i).getPublic().eq(r)}function dD(e){const t=ws(e.x),r=ws(e.y),i=new Uint8Array(t.length+r.length+1);return i[0]=4,i.set(t,1),i.set(r,t.length+1),i}function rm(e,t,r){const i=e,a=r.slice(1,i+1),s=r.slice(i+1,2*i+1);return{kty:"EC",crv:t,x:zi(a,!0),y:zi(s,!0),ext:!0}}function fD(e,t,r,i){const a=rm(e,t,r);return a.d=zi(i,!0),a}const fv=Pe.getWebCrypto(),Lu=Pe.getNodeCrypto();async function v5(e,t,r,i,a,s){const u=new $s(e);if(r&&!Pe.isStream(r)){const c={publicKey:i,privateKey:a};switch(u.type){case"web":try{return await async function(h,n,p,d){const v=h.payloadSize,m=fD(h.payloadSize,is[h.name],d.publicKey,d.privateKey),g=await fv.importKey("jwk",m,{name:"ECDSA",namedCurve:is[h.name],hash:{name:he.read(he.webHash,h.hash)}},!1,["sign"]),y=new Uint8Array(await fv.sign({name:"ECDSA",namedCurve:is[h.name],hash:{name:he.read(he.webHash,n)}},g,p));return{r:y.slice(0,v),s:y.slice(v,v<<1)}}(u,t,r,c)}catch(h){if(u.name!=="p521"&&(h.name==="DataError"||h.name==="OperationError"))throw h;Pe.printDebugError("Browser did not support signing: "+h.message)}break;case"node":{const h=await async function(n,p,d,v){const m=Lu.createSign(he.read(he.hash,p));m.write(d),m.end();const g=oV.encode({version:1,parameters:n.oid,privateKey:Array.from(v.privateKey),publicKey:{unused:0,data:Array.from(v.publicKey)}},"pem",{label:"EC PRIVATE KEY"});return hD.decode(m.sign(g),"der")}(u,t,r,c);return{r:h.r.toArrayLike(Uint8Array),s:h.s.toArrayLike(Uint8Array)}}}}return async function(c,h,n){const p=await Ru(c.name),d=tm(p,n),v=d.sign(h);return{r:v.r.toArrayLike(Uint8Array),s:v.s.toArrayLike(Uint8Array)}}(u,s,a)}async function m5(e,t,r,i,a,s){const u=new $s(e);if(i&&!Pe.isStream(i))switch(u.type){case"web":try{return await async function(c,h,{r:n,s:p},d,v){const m=rm(c.payloadSize,is[c.name],v),g=await fv.importKey("jwk",m,{name:"ECDSA",namedCurve:is[c.name],hash:{name:he.read(he.webHash,c.hash)}},!1,["verify"]),y=Pe.concatUint8Array([n,p]).buffer;return fv.verify({name:"ECDSA",namedCurve:is[c.name],hash:{name:he.read(he.webHash,h)}},g,y,d)}(u,t,r,i,a)}catch(c){if(u.name!=="p521"&&(c.name==="DataError"||c.name==="OperationError"))throw c;Pe.printDebugError("Browser did not support verifying: "+c.message)}break;case"node":return async function(c,h,{r:n,s:p},d,v){const{default:m}=await Cn(()=>import("./bn.min.f47e2400.js"),[]),g=Lu.createVerify(he.read(he.hash,h));g.write(d),g.end();const y=uV.encode({algorithm:{algorithm:[1,2,840,10045,2,1],parameters:c.oid},subjectPublicKey:{unused:0,data:Array.from(v)}},"pem",{label:"PUBLIC KEY"}),b=hD.encode({r:new m(n),s:new m(p)},"der");try{return g.verify(y,b)}catch{return!1}}(u,t,r,i,a)}return async function(c,h,n,p){const d=await Ru(c.name);return nm(d,p).verify(n,h)}(u,r,t===void 0?i:s,a)}const im=void 0,hD=Lu?im.define("ECDSASignature",function(){this.seq().obj(this.key("r").int(),this.key("s").int())}):void 0,oV=Lu?im.define("ECPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").explicit(0).optional().any(),this.key("publicKey").explicit(1).optional().bitstr())}):void 0,lV=Lu?im.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional().any())}):void 0,uV=Lu?im.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(lV),this.key("subjectPublicKey").bitstr())}):void 0;var cV=Object.freeze({__proto__:null,sign:v5,verify:m5,validateParams:async function(e,t,r){const i=new $s(e);if(i.keyType!==he.publicKey.ecdsa)return!1;switch(i.type){case"web":case"node":{const a=rs(8),s=he.hash.sha256,u=await wu.digest(s,a);try{const c=await v5(e,s,a,t,r,u);return await m5(e,s,c,a,t,u)}catch{return!1}}default:return cD(he.publicKey.ecdsa,e,t,r)}}});ns.hash=e=>new Uint8Array(qv().update(e).digest());var dV=Object.freeze({__proto__:null,sign:async function(e,t,r,i,a,s){if(wu.getHashByteLength(t) =0;--p)for(let d=c-1;d>=0;--d)h[1]=c*p+(d+1),n[0]=s[0]^h[0],n[1]=s[1]^h[1],n[2]=u[2*d],n[3]=u[2*d+1],n=hv(r.decrypt(pv(n))),s=n.subarray(0,2),u[2*d]=n[2],u[2*d+1]=n[3];if(s[0]===i[0]&&s[1]===i[1])return pv(u);throw Error("Key Data Integrity failed")}function hv(e){const{length:t}=e,r=function(s){if(Pe.isString(s)){const{length:u}=s,c=new ArrayBuffer(u),h=new Uint8Array(c);for(let n=0;n0){const r=e[t-1];if(r>=1){const i=e.subarray(t-r),a=new Uint8Array(r).fill(r);if(Pe.equalsUint8Array(i,a))return e.subarray(0,t-r)}}throw Error("Invalid padding")}var hV=Object.freeze({__proto__:null,encode:mD,decode:_D});const no=Pe.getWebCrypto(),gD=Pe.getNodeCrypto();function _5(e,t,r,i){return Pe.concatUint8Array([t.write(),new Uint8Array([e]),r.write(),Pe.stringToUint8Array("Anonymous Sender "),i.subarray(0,20)])}async function g5(e,t,r,i,a=!1,s=!1){let u;if(a){for(u=0;u =0&&t[u]===0;u--);t=t.subarray(0,u+1)}return(await wu.digest(e,Pe.concatUint8Array([new Uint8Array([0,0,0,1]),t,i]))).subarray(0,r)}async function pV(e,t){switch(e.type){case"curve25519":{const r=rs(32),{secretKey:i,sharedKey:a}=await yD(e,t,null,r);let{publicKey:s}=ns.box.keyPair.fromSecretKey(i);return s=Pe.concatUint8Array([new Uint8Array([64]),s]),{publicKey:s,sharedKey:a}}case"web":if(e.web&&Pe.getWebCrypto())try{return await async function(r,i){const a=rm(r.payloadSize,r.web.web,i);let s=no.generateKey({name:"ECDH",namedCurve:r.web.web},!0,["deriveKey","deriveBits"]),u=no.importKey("jwk",a,{name:"ECDH",namedCurve:r.web.web},!1,[]);[s,u]=await Promise.all([s,u]);let c=no.deriveBits({name:"ECDH",namedCurve:r.web.web,public:u},s.privateKey,r.web.sharedSize),h=no.exportKey("jwk",s.publicKey);[c,h]=await Promise.all([c,h]);const n=new Uint8Array(c);return{publicKey:new Uint8Array(dD(h)),sharedKey:n}}(e,t)}catch(r){Pe.printDebugError(r)}break;case"node":return async function(r,i){const a=gD.createECDH(r.node.node);a.generateKeys();const s=new Uint8Array(a.computeSecret(i));return{publicKey:new Uint8Array(a.getPublicKey()),sharedKey:s}}(e,t)}return async function(r,i){const a=await Ru(r.name),s=await r.genKeyPair();i=nm(a,i);const u=tm(a,s.privateKey),c=s.publicKey,h=u.derive(i.getPublic()),n=a.curve.p.byteLength(),p=h.toArrayLike(Uint8Array,"be",n);return{publicKey:c,sharedKey:p}}(e,t)}async function yD(e,t,r,i){if(i.length!==e.payloadSize){const a=new Uint8Array(e.payloadSize);a.set(i,e.payloadSize-i.length),i=a}switch(e.type){case"curve25519":{const a=i.slice().reverse();return{secretKey:a,sharedKey:ns.scalarMult(a,t.subarray(1))}}case"web":if(e.web&&Pe.getWebCrypto())try{return await async function(a,s,u,c){const h=fD(a.payloadSize,a.web.web,u,c);let n=no.importKey("jwk",h,{name:"ECDH",namedCurve:a.web.web},!0,["deriveKey","deriveBits"]);const p=rm(a.payloadSize,a.web.web,s);let d=no.importKey("jwk",p,{name:"ECDH",namedCurve:a.web.web},!0,[]);[n,d]=await Promise.all([n,d]);let v=no.deriveBits({name:"ECDH",namedCurve:a.web.web,public:d},n,a.web.sharedSize),m=no.exportKey("jwk",n);[v,m]=await Promise.all([v,m]);const g=new Uint8Array(v);return{secretKey:ws(m.d),sharedKey:g}}(e,t,r,i)}catch(a){Pe.printDebugError(a)}break;case"node":return async function(a,s,u){const c=gD.createECDH(a.node.node);c.setPrivateKey(u);const h=new Uint8Array(c.computeSecret(s));return{secretKey:new Uint8Array(c.getPrivateKey()),sharedKey:h}}(e,t,i)}return async function(a,s,u){const c=await Ru(a.name);s=nm(c,s),u=tm(c,u);const h=new Uint8Array(u.getPrivate()),n=u.derive(s.getPublic()),p=c.curve.p.byteLength(),d=n.toArrayLike(Uint8Array,"be",p);return{secretKey:h,sharedKey:d}}(e,t,i)}var vV=Object.freeze({__proto__:null,validateParams:async function(e,t,r){return cD(he.publicKey.ecdh,e,t,r)},encrypt:async function(e,t,r,i,a){const s=mD(r),u=new $s(e),{publicKey:c,sharedKey:h}=await pV(u,i),n=_5(he.publicKey.ecdh,e,t,a),{keySize:p}=uo(t.cipher);return{publicKey:c,wrappedKey:pD(await g5(t.hash,h,p,n),s)}},decrypt:async function(e,t,r,i,a,s,u){const c=new $s(e),{sharedKey:h}=await yD(c,r,a,s),n=_5(he.publicKey.ecdh,e,t,u),{keySize:p}=uo(t.cipher);let d;for(let v=0;v<3;v++)try{return _D(vD(await g5(t.hash,h,p,n,v===1,v===2),i))}catch(m){d=m}throw d}}),mV=Object.freeze({__proto__:null,Curve:$s,ecdh:vV,ecdsa:cV,eddsa:dV,generate:async function(e){const t=await Pe.getBigInteger();e=new $s(e);const r=await e.genKeyPair(),i=new t(r.publicKey).toUint8Array(),a=new t(r.privateKey).toUint8Array("be",e.payloadSize);return{oid:e.oid,Q:i,secret:a,hash:e.hash,cipher:e.cipher}},getPreferredHashAlgo:function(e){return Dp[he.write(he.curve,e.toHex())].hash}}),_V=Object.freeze({__proto__:null,sign:async function(e,t,r,i,a,s){const u=await Pe.getBigInteger(),c=new u(1);let h,n,p,d;i=new u(i),a=new u(a),r=new u(r),s=new u(s),r=r.mod(i),s=s.mod(a);const v=new u(t.subarray(0,a.byteLength())).mod(a);for(;;){if(h=await Is(c,a),n=r.modExp(h,i).imod(a),n.isZero())continue;const m=s.mul(n).imod(a);if(d=v.add(m).imod(a),p=h.modInv(a).imul(d).imod(a),!p.isZero())break}return{r:n.toUint8Array("be",a.byteLength()),s:p.toUint8Array("be",a.byteLength())}},verify:async function(e,t,r,i,a,s,u,c){const h=await Pe.getBigInteger(),n=new h(0);if(t=new h(t),r=new h(r),s=new h(s),u=new h(u),a=new h(a),c=new h(c),t.lte(n)||t.gte(u)||r.lte(n)||r.gte(u))return Pe.printDebug("invalid DSA Signature"),!1;const p=new h(i.subarray(0,u.byteLength())).imod(u),d=r.modInv(u);if(d.isZero())return Pe.printDebug("invalid DSA Signature"),!1;a=a.mod(s),c=c.mod(s);const v=p.mul(d).imod(u),m=t.mul(d).imod(u),g=a.modExp(v,s),y=c.modExp(m,s);return g.mul(y).imod(s).imod(u).equal(t)},validateParams:async function(e,t,r,i,a){const s=await Pe.getBigInteger();e=new s(e),t=new s(t),r=new s(r),i=new s(i);const u=new s(1);if(r.lte(u)||r.gte(e)||!e.dec().mod(t).isZero()||!r.modExp(t,e).isOne())return!1;const c=new s(t.bitLength()),h=new s(150);if(c.lt(h)||!await sD(t,null,32))return!1;a=new s(a);const n=new s(2),p=await Is(n.leftShift(c.dec()),n.leftShift(c)),d=t.mul(p).add(a);return!!i.equal(r.modExp(d,e))}}),nr={rsa:rV,elgamal:iV,elliptic:mV,dsa:_V,nacl:ns},gV=Object.freeze({__proto__:null,parseSignatureParams:function(e,t){let r=0;switch(e){case he.publicKey.rsaEncryptSign:case he.publicKey.rsaEncrypt:case he.publicKey.rsaSign:return{s:Pe.readMPI(t.subarray(r))};case he.publicKey.dsa:case he.publicKey.ecdsa:{const i=Pe.readMPI(t.subarray(r));return r+=i.length+2,{r:i,s:Pe.readMPI(t.subarray(r))}}case he.publicKey.eddsa:{let i=Pe.readMPI(t.subarray(r));r+=i.length+2,i=Pe.leftPad(i,32);let a=Pe.readMPI(t.subarray(r));return a=Pe.leftPad(a,32),{r:i,s:a}}default:throw new kr("Unknown signature algorithm.")}},verify:async function(e,t,r,i,a,s){switch(e){case he.publicKey.rsaEncryptSign:case he.publicKey.rsaEncrypt:case he.publicKey.rsaSign:{const{n:u,e:c}=i,h=Pe.leftPad(r.s,u.length);return nr.rsa.verify(t,a,h,u,c,s)}case he.publicKey.dsa:{const{g:u,p:c,q:h,y:n}=i,{r:p,s:d}=r;return nr.dsa.verify(t,p,d,s,u,c,h,n)}case he.publicKey.ecdsa:{const{oid:u,Q:c}=i,h=new nr.elliptic.Curve(u).payloadSize,n=Pe.leftPad(r.r,h),p=Pe.leftPad(r.s,h);return nr.elliptic.ecdsa.verify(u,t,{r:n,s:p},a,c,s)}case he.publicKey.eddsa:{const{oid:u,Q:c}=i;return nr.elliptic.eddsa.verify(u,t,r,a,c,s)}default:throw Error("Unknown signature algorithm.")}},sign:async function(e,t,r,i,a,s){if(!r||!i)throw Error("Missing key parameters");switch(e){case he.publicKey.rsaEncryptSign:case he.publicKey.rsaEncrypt:case he.publicKey.rsaSign:{const{n:u,e:c}=r,{d:h,p:n,q:p,u:d}=i;return{s:await nr.rsa.sign(t,a,u,c,h,n,p,d,s)}}case he.publicKey.dsa:{const{g:u,p:c,q:h}=r,{x:n}=i;return nr.dsa.sign(t,s,u,c,h,n)}case he.publicKey.elgamal:throw Error("Signing with Elgamal is not defined in the OpenPGP standard.");case he.publicKey.ecdsa:{const{oid:u,Q:c}=r,{d:h}=i;return nr.elliptic.ecdsa.sign(u,t,a,c,h,s)}case he.publicKey.eddsa:{const{oid:u,Q:c}=r,{seed:h}=i;return nr.elliptic.eddsa.sign(u,t,a,c,h,s)}default:throw Error("Unknown signature algorithm.")}}});class y5{constructor(t){t=t===void 0?new Uint8Array([]):Pe.isString(t)?Pe.stringToUint8Array(t):new Uint8Array(t),this.data=t}read(t){if(t.length>=1){const r=t[0];if(t.length>=1+r)return this.data=t.subarray(1,1+r),1+this.data.length}throw Error("Invalid symmetric key")}write(){return Pe.concatUint8Array([new Uint8Array([this.data.length]),this.data])}}class b5{constructor(t){if(t){const{hash:r,cipher:i}=t;this.hash=r,this.cipher=i}else this.hash=null,this.cipher=null}read(t){if(t.length<4||t[0]!==3||t[1]!==1)throw Error("Cannot read KDFParams");return this.hash=t[2],this.cipher=t[3],4}write(){return new Uint8Array([3,1,this.hash,this.cipher])}}function W_(e){try{e.getName()}catch{throw new kr("Unknown curve OID")}}var yV=Object.freeze({__proto__:null,publicKeyEncrypt:async function(e,t,r,i){switch(e){case he.publicKey.rsaEncrypt:case he.publicKey.rsaEncryptSign:{const{n:a,e:s}=t;return{c:await nr.rsa.encrypt(r,a,s)}}case he.publicKey.elgamal:{const{p:a,g:s,y:u}=t;return nr.elgamal.encrypt(r,a,s,u)}case he.publicKey.ecdh:{const{oid:a,Q:s,kdfParams:u}=t,{publicKey:c,wrappedKey:h}=await nr.elliptic.ecdh.encrypt(a,u,r,s,i);return{V:c,C:new y5(h)}}default:return[]}},publicKeyDecrypt:async function(e,t,r,i,a,s){switch(e){case he.publicKey.rsaEncryptSign:case he.publicKey.rsaEncrypt:{const{c:u}=i,{n:c,e:h}=t,{d:n,p,q:d,u:v}=r;return nr.rsa.decrypt(u,c,h,n,p,d,v,s)}case he.publicKey.elgamal:{const{c1:u,c2:c}=i,h=t.p,n=r.x;return nr.elgamal.decrypt(u,c,h,n,s)}case he.publicKey.ecdh:{const{oid:u,Q:c,kdfParams:h}=t,{d:n}=r,{V:p,C:d}=i;return nr.elliptic.ecdh.decrypt(u,h,p,d.data,c,n,a)}default:throw Error("Unknown public key encryption algorithm.")}},parsePublicKeyParams:function(e,t){let r=0;switch(e){case he.publicKey.rsaEncrypt:case he.publicKey.rsaEncryptSign:case he.publicKey.rsaSign:{const i=Pe.readMPI(t.subarray(r));r+=i.length+2;const a=Pe.readMPI(t.subarray(r));return r+=a.length+2,{read:r,publicParams:{n:i,e:a}}}case he.publicKey.dsa:{const i=Pe.readMPI(t.subarray(r));r+=i.length+2;const a=Pe.readMPI(t.subarray(r));r+=a.length+2;const s=Pe.readMPI(t.subarray(r));r+=s.length+2;const u=Pe.readMPI(t.subarray(r));return r+=u.length+2,{read:r,publicParams:{p:i,q:a,g:s,y:u}}}case he.publicKey.elgamal:{const i=Pe.readMPI(t.subarray(r));r+=i.length+2;const a=Pe.readMPI(t.subarray(r));r+=a.length+2;const s=Pe.readMPI(t.subarray(r));return r+=s.length+2,{read:r,publicParams:{p:i,g:a,y:s}}}case he.publicKey.ecdsa:{const i=new Ka;r+=i.read(t),W_(i);const a=Pe.readMPI(t.subarray(r));return r+=a.length+2,{read:r,publicParams:{oid:i,Q:a}}}case he.publicKey.eddsa:{const i=new Ka;r+=i.read(t),W_(i);let a=Pe.readMPI(t.subarray(r));return r+=a.length+2,a=Pe.leftPad(a,33),{read:r,publicParams:{oid:i,Q:a}}}case he.publicKey.ecdh:{const i=new Ka;r+=i.read(t),W_(i);const a=Pe.readMPI(t.subarray(r));r+=a.length+2;const s=new b5;return r+=s.read(t.subarray(r)),{read:r,publicParams:{oid:i,Q:a,kdfParams:s}}}default:throw new kr("Unknown public key encryption algorithm.")}},parsePrivateKeyParams:function(e,t,r){let i=0;switch(e){case he.publicKey.rsaEncrypt:case he.publicKey.rsaEncryptSign:case he.publicKey.rsaSign:{const a=Pe.readMPI(t.subarray(i));i+=a.length+2;const s=Pe.readMPI(t.subarray(i));i+=s.length+2;const u=Pe.readMPI(t.subarray(i));i+=u.length+2;const c=Pe.readMPI(t.subarray(i));return i+=c.length+2,{read:i,privateParams:{d:a,p:s,q:u,u:c}}}case he.publicKey.dsa:case he.publicKey.elgamal:{const a=Pe.readMPI(t.subarray(i));return i+=a.length+2,{read:i,privateParams:{x:a}}}case he.publicKey.ecdsa:case he.publicKey.ecdh:{const a=new $s(r.oid);let s=Pe.readMPI(t.subarray(i));return i+=s.length+2,s=Pe.leftPad(s,a.payloadSize),{read:i,privateParams:{d:s}}}case he.publicKey.eddsa:{const a=new $s(r.oid);let s=Pe.readMPI(t.subarray(i));return i+=s.length+2,s=Pe.leftPad(s,a.payloadSize),{read:i,privateParams:{seed:s}}}default:throw new kr("Unknown public key encryption algorithm.")}},parseEncSessionKeyParams:function(e,t){let r=0;switch(e){case he.publicKey.rsaEncrypt:case he.publicKey.rsaEncryptSign:return{c:Pe.readMPI(t.subarray(r))};case he.publicKey.elgamal:{const i=Pe.readMPI(t.subarray(r));return r+=i.length+2,{c1:i,c2:Pe.readMPI(t.subarray(r))}}case he.publicKey.ecdh:{const i=Pe.readMPI(t.subarray(r));r+=i.length+2;const a=new y5;return a.read(t.subarray(r)),{V:i,C:a}}default:throw new kr("Unknown public key encryption algorithm.")}},serializeParams:function(e,t){const r=Object.keys(t).map(i=>{const a=t[i];return Pe.isUint8Array(a)?Pe.uint8ArrayToMPI(a):a.write()});return Pe.concatUint8Array(r)},generateParams:function(e,t,r){switch(e){case he.publicKey.rsaEncrypt:case he.publicKey.rsaEncryptSign:case he.publicKey.rsaSign:return nr.rsa.generate(t,65537).then(({n:i,e:a,d:s,p:u,q:c,u:h})=>({privateParams:{d:s,p:u,q:c,u:h},publicParams:{n:i,e:a}}));case he.publicKey.ecdsa:return nr.elliptic.generate(r).then(({oid:i,Q:a,secret:s})=>({privateParams:{d:s},publicParams:{oid:new Ka(i),Q:a}}));case he.publicKey.eddsa:return nr.elliptic.generate(r).then(({oid:i,Q:a,secret:s})=>({privateParams:{seed:s},publicParams:{oid:new Ka(i),Q:a}}));case he.publicKey.ecdh:return nr.elliptic.generate(r).then(({oid:i,Q:a,secret:s,hash:u,cipher:c})=>({privateParams:{d:s},publicParams:{oid:new Ka(i),Q:a,kdfParams:new b5({hash:u,cipher:c})}}));case he.publicKey.dsa:case he.publicKey.elgamal:throw Error("Unsupported algorithm for key generation.");default:throw Error("Unknown public key algorithm.")}},validateParams:async function(e,t,r){if(!t||!r)throw Error("Missing key parameters");switch(e){case he.publicKey.rsaEncrypt:case he.publicKey.rsaEncryptSign:case he.publicKey.rsaSign:{const{n:i,e:a}=t,{d:s,p:u,q:c,u:h}=r;return nr.rsa.validateParams(i,a,s,u,c,h)}case he.publicKey.dsa:{const{p:i,q:a,g:s,y:u}=t,{x:c}=r;return nr.dsa.validateParams(i,a,s,u,c)}case he.publicKey.elgamal:{const{p:i,g:a,y:s}=t,{x:u}=r;return nr.elgamal.validateParams(i,a,s,u)}case he.publicKey.ecdsa:case he.publicKey.ecdh:{const i=nr.elliptic[he.read(he.publicKey,e)],{oid:a,Q:s}=t,{d:u}=r;return i.validateParams(a,s,u)}case he.publicKey.eddsa:{const{oid:i,Q:a}=t,{seed:s}=r;return nr.elliptic.eddsa.validateParams(i,a,s)}default:throw Error("Unknown public key algorithm.")}},getPrefixRandom:async function(e){const{blockSize:t}=uo(e),r=await rs(t),i=new Uint8Array([r[r.length-2],r[r.length-1]]);return Pe.concat([r,i])},generateSessionKey:function(e){const{keySize:t}=uo(e);return rs(t)},getAEADMode:function(e){const t=he.read(he.aead,e);return aD[t]},getCipher:uo});const Kt={cipher:Ad,hash:wu,mode:aD,publicKey:nr,signature:gV,random:eV,pkcs1:nV,pkcs5:hV,aesKW:fV};Object.assign(Kt,yV);var Id=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Int32Array!="undefined";function bD(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)}const wD={arraySet:function(e,t,r,i,a){if(t.subarray&&e.subarray)e.set(t.subarray(r,r+i),a);else for(let s=0;s=0;)e[t]=0}const SV=0,DD=1,kV=2,Z0=29,$d=256,dd=$d+1+Z0,hu=30,Q0=19,S5=2*dd+1,Zo=15,K_=16,EV=7,q0=256,OD=16,PD=17,TD=18,hy=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],Op=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],DV=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],k5=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],bs=Array(2*(dd+2));Nu(bs);const qc=Array(2*hu);Nu(qc);const fd=Array(512);Nu(fd);const hd=Array(256);Nu(hd);const eb=Array(Z0);Nu(eb);const mv=Array(hu);function H_(e,t,r,i,a){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=i,this.max_length=a,this.has_stree=e&&e.length}let E5,D5,O5;function G_(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function AD(e){return e<256?fd[e]:fd[256+(e>>>7)]}function pd(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function Di(e,t,r){e.bi_valid>K_-r?(e.bi_buf|=t< >K_-e.bi_valid,e.bi_valid+=r-K_):(e.bi_buf|=t<