PageSourceSearch

https://user.tikhub.io/assets/CostCalculator-D7nidrg-.js

js tikhub.io collected 2026-10-03 22:55:31 UTC 8,669 bytes, 1 lines download raw bytes

1import{T as R,b as K,r as m,am as A,j as x,p as G,q as X,s as Z,w as J,v as P,H as I,O as Q,I as M,B as q,X as U,y as z}from"./index-CjJlg5IG.js";import{D as W}from"./DashboardLayout-B2C5xjF3.js";import{B as y}from"./badge-CPZdGc_N.js";import{a as Y}from"./typography-hRCJH4ul.js";import"./shield-UbXs3cOt.js";import"./trash-2-DlkAJqPA.js";import"./chart-column-Dk74aL2Q.js";import"./key-CEk99L9L.js";import"./activity-BVgIeEr9.js";import"./database-bvWrRdVU.js";import"./credit-card-B4lnB-YB.js";import"./crown-CrKt48F8.js";import"./scroll-text-D6yptcfs.js";const ee=[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["line",{x1:"8",x2:"16",y1:"6",y2:"6",key:"x4nwl0"}],["line",{x1:"16",x2:"16",y1:"14",y2:"18",key:"wjye3r"}],["path",{d:"M16 10h.01",key:"1m94wz"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M8 18h.01",key:"lrp35t"}]],$=R("calculator",ee);(function(e,s){const a=n,l=e();for(;;)try{if(parseInt(a(300))/1+parseInt(a(307))/2*(parseInt(a(277))/3)+-parseInt(a(267))/4+-parseInt(a(295))/5*(-parseInt(a(276))/6)+parseInt(a(347))/7*(parseInt(a(309))/8)+parseInt(a(272))/9+-parseInt(a(344))/10*(parseInt(a(270))/11)===s)break;l.push(l.shift())}catch{l.push(l.shift())}})(N,959868);const xe=(function(){let e=!0;return function(s,a){const l=e?function(){const h=n;if(a){const p=a[h(297)](s,arguments);return a=null,p}}:function(){};return e=!1,l}})(),k=xe(void 0,function(){const e=n;return k[e(310)]()[e(262)]("(((.+)+)+)+$")[e(310)]().constructor(k)[e(262)](e(274))});k();function n(e,s){const a=N();return n=function(l,h){return l=l-260,a[l]},n(e,s)}function N(){const e=["span","pricing.freeCredit","p-3 text-sm text-muted-foreground","calculator.subtotal","mt-1","absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground","endpoint_uri","text-success","calculator.title","calculator.monthlyEstimate","some","text-xs text-muted-foreground mt-2","bg-card border border-border/60 p-4 rounded-lg","calculator.dailyTotal","removeEventListener","8459910Fdnaxg","p-3 hover:bg-card-hover cursor-pointer border-b border-border/60 last:border-0","value","28IVDwAO","requests","flex items-start justify-between mb-2","flex justify-between","min","calculator.volumeDiscount","discount","bg-card border border-border/60 rounded-lg p-4 mt-4","endpoint_type","map","success","mr-2 h-4 w-4","text-sm font-semibold","calculator.calculateCost","div","addEventListener","search","outline","ghost","type","allowFreeCredit","1733760czqKJI","text-destructive hover:text-destructive","cost","44ZQrHzZ","total","1043685xkCKMG","allow_discount","(((.+)+)+)+$","endpoint_cost","6euXdVN","5589993DjKzcO","calculator.selectedEndpoints","trim","number","forEach","length","mt-2 text-muted-foreground","calculator.totalRequests","absolute z-10 w-full mt-1 bg-popover border border-border/60 rounded-lg shadow-lg max-h-60 overflow-y-auto","font-medium","mousedown","flex-1 min-w-0","secondary","space-y-2 text-sm","/req","font-mono text-sm","space-y-3","text-xs text-muted-foreground","5888620ekGFyt","text-xs","apply","target","calculator.subtitle","1384732VatDpD","calculator.searchEndpoints","relative mt-1","max","allowDiscount","uri","calculator.dailyEstimatorDesc","2CsHmOB","bg-warning/10 border border-warning/20 rounded-lg p-3 text-sm text-warning","471040xlVViS","toString","find","h-4 w-4","calculator.selectEndpoint","status","font-semibold mb-3","reduce","flex items-center gap-2 mt-1","calculator.searchPlaceholder","rate","flex items-center gap-2","toFixed","calculator.dailyRequests","toLocaleString","flex justify-between font-semibold text-lg border-t pt-2","calculator.costSummary","common.noData","calculator.discountTiers","preventDefault"];return N=function(){return e},N()}function pe(){const e=n,{t:s}=K(),[a,l]=m.useState(""),[h,p]=m.useState([]),[L,D]=m.useState(!1),[g,f]=m.useState(!1),[o,w]=m.useState([]),[j,b]=m.useState(null);m.useEffect(()=>{if(!a[n(279)]()){p([]),f(!1);return}const r=setTimeout(async()=>{const c=n;try{D(!0);const i=await A[c(262)]({term:a,page:1,page_size:50});i[c(314)]===c(357)&&(p(i.results||[]),f(!0))}catch{}finally{D(!1)}},300);return()=>clearTimeout(r)},[a]),m.useEffect(()=>{const t=n,r=c=>{g&&!c[n(298)]?.closest(".search-dropdown")&&f(!1)};return document[t(261)]("mousedown",r),()=>document[t(343)](t(287),r)},[g]);const T=t=>{const r=n;o[r(311)](c=>c[r(305)]===t[r(335)])||(w([...o,{uri:t.endpoint_uri,cost:parseFloat(t[r(275)]),type:t[r(355)],allowDiscount:t[r(273)],allowFreeCredit:t.allow_free_credit,requests:0}]),l(""),f(!1),b(null))},B=t=>{const r=n;w(o.filter(c=>c[r(305)]!==t)),b(null)},H=(t,r)=>{const c=n;w(o.map(i=>i[c(305)]===t?{...i,requests:r}:i)),b(null)},V=()=>{const t=n;if(o.length===0){z({title:s(t(313))});return}if(o[t(316)]((u,d)=>u+d[t(348)],0)===0){z({title:s("calculator.enterRequests")});return}let c=0,i=0,E=0;o[t(281)](u=>{const d=n,_=u[d(348)]*u[d(269)];u[d(304)]?(c+=u[d(348)],i+=_):E+=_});const O=[{max:1e3,rate:0},{max:5e3,rate:.1},{max:1e4,rate:.2},{max:2e4,rate:.3},{max:3e4,rate:.4},{max:1/0,rate:.5}];let v=0;if(c>0&&i>0){const u=i/c;let d=c,_=0;for(const C of O){if(d<=0)break;const F=Math[t(351)](d,C[t(303)]-_);v+=F*u*C[t(319)],d-=F,_=C[t(303)]}}const S=i+E;b({subtotal:S,discount:v,total:S-v})};return x.jsx(W,{children:x.jsxs(e(260),{className:"space-y-6",children:[x.jsxs(e(260),{children:[x.jsx(Y,{children:s(e(337))}),x.jsx("p",{className:e(283),children:s(e(299))})]}),x.jsxs(G,{children:[x.jsxs(X,{children:[x.jsxs(Z,{className:e(320),children:[x.jsx($,{className:"h-5 w-5"}),s("calculator.dailyEstimator")]}),x.jsx(J,{children:s(e(306))})]}),x.jsxs(P,{className:"space-y-4",children:[x.jsx(e(260),{className:e(308),children:s(e(327))}),x.jsxs(e(260),{className:"relative search-dropdown",children:[x.jsx(I,{children:s(e(301))}),x.jsxs(e(260),{className:e(302),children:[x.jsx(Q,{className:e(334)}),x.jsx(M,{className:"pl-9",placeholder:s(e(318)),value:a,onChange:t=>l(t[e(298)][e(346)]),onFocus:()=>a&&f(!0)})]}),g&&a&&x.jsx(e(260),{className:e(285),children:L?x.jsx(e(260),{className:e(331),children:s("common.loading")}):h.length>0?h[e(356)]((t,r)=>x.jsxs(e(260),{className:e(345),onMouseDown:c=>{c[n(328)](),T(t)},children:[x.jsx("p",{className:e(292),children:t.endpoint_uri}),x.jsxs(e(260),{className:"flex items-center gap-2 mt-1",children:[x.jsx(y,{variant:e(263),className:e(296),children:t[e(355)]}),x.jsxs(e(329),{className:e(359),children:["$",parseFloat(t[e(275)]).toFixed(4)]})]})]},r)):x.jsx(e(260),{className:e(331),children:s(e(326))})})]}),o[e(282)]>0&&x.jsxs(e(260),{className:e(293),children:[x.jsxs(I,{children:[s(e(278))," (",o.length,")"]}),o[e(356)](t=>x.jsxs("div",{className:e(341),children:[x.jsxs(e(260),{className:e(349),children:[x.jsxs(e(260),{className:e(288),children:[x.jsx("p",{className:"font-mono text-sm truncate",children:t.uri}),x.jsxs("div",{className:e(317),children:[x.jsx(y,{variant:"outline",className:e(296),children:t[e(265)]}),x.jsxs(e(329),{className:e(294),children:["$",t[e(269)][e(321)](4),e(291)]}),t[e(304)]&&x.jsx(y,{className:e(296),children:s("pricing.volumeDiscount")}
1),t[e(266)]&&x.jsx(y,{variant:e(289),className:"text-xs",children:s(e(330))})]})]}),x.jsx(q,{variant:e(264),size:"sm",onClick:()=>B(t[e(305)]),className:e(268),children:x.jsx(U,{className:e(312)})})]}),x.jsxs(e(260),{children:[x.jsx(I,{className:"text-xs",children:s(e(322))}),x.jsx(M,{type:e(280),min:"0",placeholder:"0",value:t[e(348)]||"",onChange:r=>H(t[e(305)],parseInt(r[e(298)].value)||0),className:e(333)})]})]},t[e(305)]))]}),o[e(282)]>0&&o[e(339)](t=>t[e(348)]>0)&&x.jsx(e(260),{className:"flex justify-center pt-2",children:x.jsxs(q,{onClick:V,size:"lg",children:[x.jsx($,{className:e(358)}),s(e(360))]})}),j&&x.jsxs(e(260),{className:e(354),children:[x.jsx("h4",{className:e(315),children:s(e(325))}),x.jsxs(e(260),{className:e(290),children:[x.jsxs(e(260),{className:e(350),children:[x.jsx(e(329),{children:s(e(284))}),x.jsx(e(329),{className:e(286),children:o[e(316)]((t,r)=>t+r[e(348)],0)[e(323)]()})]}),x.jsxs(e(260),{className:e(350),children:[x.jsx(e(329),{children:s(e(332))}),x.jsxs(e(329),{children:["$",j.subtotal[e(321)](3)]})]}),x.jsxs("div",{className:e(350),children:[x.jsx("span",{children:s(e(352))}),x.jsxs("span",{className:e(336),children:["-$",j[e(353)].toFixed(3)]})]}),x.jsxs(e(260),{className:e(324),children:[x.jsx("span",{children:s(e(342))}),x.jsxs(e(329),{children:["$",j.total[e(321)](3)]})]}),x.jsxs("p",{className:e(340),children:[s(e(338))," $",(j[e(271)]*30)[e(321)](2)]})]})]})]})]})]})})}export{pe as default};

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