"use strict";(globalThis.webpackChunkinfinity_hitab_client=globalThis.webpackChunkinfinity_hitab_client||[]).push([[3299,8051],{38051:(e,a,t)=>{t.r(a),t.d(a,{useCalcBinaryStore:()=>s});var n=t(10435),i=t(14754);const s=(0,n.Q_)("calc-components-binary",{state:()=>({activeIndex:0,baseItems:[{name:"二进制",radix:2},{name:"八进制",radix:8},{name:"十进制",radix:10},{name:"十六进制",radix:16}],barItems:[{name:"Binary"},{name:"Octal"},{name:"Decimal"},{name:"Hex"}],disabledKeys:["7","8","9","F","4","5","6","E","2","3","D","A","B","C"]}),getters:{getCurrentItemValue(){return this.baseItems[this.activeIndex].value||""}},actions:{changeActive(e){switch(this.activeIndex=e,e){case 0:this.disabledKeys=["7","8","9","F","4","5","6","E","2","3","D","A","B","C"];break;case 1:this.disabledKeys=["8","9","F","E","D","C","B","A"];break;case 2:this.disabledKeys=["F","E","D","C","B","A"];break;case 3:this.disabledKeys=[]}},changeValue(e,a){this.baseItems[a].value=e;const t=[...this.baseItems],n=t[a].radix,s=String(e).indexOf(".")>-1?(0,i.zX)(e,n):parseInt(String(e),n);return e?isNaN(s)?(t.forEach((e=>e.value="")),void(this.baseItems=t)):(t.forEach(((t,n)=>{if(n===a)t.value=String(e).toUpperCase();else try{const e=s.toString(t.radix);t.value=e.toUpperCase()}catch(e){t.value=""}})),void(this.baseItems=t)):(t.forEach((e=>e.value="")),void(this.baseItems=t))},calcBaseArr(){const e=[...this.baseItems];this.baseItems=e}}})},13299:(e,a,t)=>{t.r(a),t.d(a,{useBinaryPanel:()=>s});var n=t(10435),i=t(38051);const s=()=>{const e=(0,i.useCalcBinaryStore)(),a=(0,n.Jk)(e);return{changeActive:a=>{e.changeActive(a)},onInputNumber:(a,t)=>{var n;const i=null===(n=a.target)||void 0===n?void 0:n.value;e.changeValue(i,t)},onClickKeyItem:t=>{const n=e.getCurrentItemValue+t;e.changeValue(n,a.activeIndex.value)},onClickBackspace:()=>{const t=e.getCurrentItemValue.split("");t.length>0&&t.pop(),e.changeValue(t.length>0?t.join(""):"",a.activeIndex.value)},onClickClear:()=>{e.changeValue("",a.activeIndex.value)},onClickKeyDot:()=>{const t=e.getCurrentItemValue;t&&(t.indexOf(".")>-1||e.changeValue(t+".",a.activeIndex.value))},activeIndex:a.activeIndex,baseItems:a.baseItems,barItems:a.barItems,disabledKeys:a.disabledKeys}}},14754:(e,a,t)=>{t.d(a,{D:()=>b,Mb:()=>v,UC:()=>s,WS:()=>m,fS:()=>c,uf:()=>n,vZ:()=>i,zX:()=>r});const n=function(e){let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:5;if(!e)return 0;const n=Math.floor(Math.log(Math.abs(e))/Math.LN10);if(Math.abs(n)<=a)return Number(e.toFixed(t));{const a=e*Math.pow(10,-n);return Number(a.toFixed(t))+"e"+(n>0?"+"+n:n)}},i=(e,a)=>{const t=[...a],n=t.find((e=>e.base)),i=t.find((a=>a.name===e.name));return n.base=!1,i.base=!0,i.value=n.value,t},s=e=>{const a=[...e],t=e.find((e=>e.calcBase)),n=e.find((e=>e.base));var i;t.base?a.map((e=>{var a;e.base||e.calcBase||(e.value=null===(a=e.getValue)||void 0===a?void 0:a.call(null,Number(t.value)))})):(t.value=null===(i=n.reverseValue)||void 0===i?void 0:i.call(null,Number(n.value)),a.map((e=>{var a;e.base||e.calcBase||(e.value=null===(a=e.getValue)||void 0===a?void 0:a.call(null,Number(t.value)))})));return a},r=(e,a)=>{const t=String(e).split("."),n=t[1].split("");let i=0;for(let e=0;e<t[1].length;e++)i+=n[e]*Math.pow(a,-1*(e+1));return parseInt(t[0],a)+i},c=e=>Number(e||0).toFixed(2).replace(/\d+/,(e=>e.replace(/(\d)(?=(?:\d{3})+$)/g,"$1,"))),l=[{min:-1/0,max:36e3,rate:.03,deduction:0},{min:36e3,max:144e3,rate:.1,deduction:2520},{min:144e3,max:3e5,rate:.2,deduction:16920},{min:3e5,max:42e4,rate:.25,deduction:31920},{min:42e4,max:66e4,rate:.3,deduction:52920},{min:66e4,max:96e4,rate:.35,deduction:85920},{min:96e4,max:1/0,rate:.45,deduction:181920}],d=[{min:-1/0,max:3e3,rate:.03,deduction:0},{min:3e3,max:12e3,rate:.1,deduction:210},{min:12e3,max:25e3,rate:.2,deduction:1410},{min:25e3,max:35e3,rate:.25,deduction:2660},{min:35e3,max:55e3,rate:.3,deduction:4410},{min:55e3,max:8e4,rate:.35,deduction:7160},{min:8e4,max:1/0,rate:.45,deduction:15160}],u=[{min:-1/0,max:2e4,rate:.2,deduction:0},{min:2e4,max:5e4,rate:.3,deduction:2e3},{min:5e4,max:1/0,rate:.4,deduction:7e3}],o=(e,a)=>a.find((a=>e>a.min&&e<=a.max)),m=e=>o(e,l),v=e=>o(e,d),b=e=>o(e,u)}}]);