Presupuestador_web/dist/client/assets/index-Ce3s5e6O.js

335 lines
320 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

var r0=Object.defineProperty;var s0=(t,a,s)=>a in t?r0(t,a,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[a]=s;var Me=(t,a,s)=>s0(t,typeof a!="symbol"?a+"":a,s);import{u as Vc,a as jn,b as sn,c as cr,d as Re,j as r,e as me,P as i0,f as a0,g as o0,N as bi,R as Qe,J as Vt,h as Ye,i as Lr,D as Or,l as so,M as It,V as l0,r as D,k as Hc,m as Gc,n as Cn,o as Kc,B as U,C as u0,p as Sn,q as Nn,s as Rn,S as Io,t as En,v as mi,w as C,x as wi,y as ji,z as yi,A as Ci,E as us,F as Fo,G as Un,H as zn,I as Vn,K as Hn,L as c0,O as Xt,Q as d0,T as f0,U as m0,W as We,X as Ve,Y as ht,Z as et,_ as it,$ as He,a0 as lr,a1 as Si,a2 as g0,a3 as Do,a4 as jt,a5 as Ni,a6 as Ri,a7 as zt,a8 as Ut,a9 as Wc,aa as h0,ab as ds,ac as ln,ad as To,ae as Mo,af as Tr,ag as Lo,ah as Qc,ai as Oo,aj as Po,ak as qo,al as ms,am as p0,an as ir,ao as Ac,ap as x0,aq as v0,ar as _0,as as ko,at as $n,au as un,av as Qn,aw as Ei,ax as Yc,ay as b0,az as Xc,aA as w0,aB as ae,aC as Ai,aD as vo,aE as Zc,aF as Jc,aG as ed,aH as dr,aI as td,aJ as Ii,aK as gs,aL as hs,aM as ps,aN as fs,aO as j0,aP as nd,aQ as at,aR as ot,aS as _o,aT as lt,aU as Gn,aV as $r,aW as Pr,aX as y0,aY as C0,aZ as rd,a_ as gi,a$ as S0,b0 as N0,b1 as Ir,b2 as rn,b3 as sd,b4 as Fr,b5 as id,b6 as ad,b7 as R0,b8 as E0,b9 as od,ba as A0,bb as ld,bc as hi,bd as ud,be as Jt,bf as qr,bg as an,bh as I0,bi as fr,bj as cd,bk as F0,bl as D0,bm as dd,bn as fd,bo as md,bp as gd,bq as hd,br as pd,bs as xd,bt as vd,bu as _d,bv as xs,bw as bd,bx as bo,by as wo,bz as T0,bA as M0,bB as L0,bC as O0,bD as P0,bE as Ic,bF as wd,bG as jd,bH as yd,bI as Cd,bJ as Sd,bK as Nd,bL as Rd,bM as q0,bN as io,bO as Dr,bP as k0,bQ as Ed,bR as $0,bS as B0,bT as Ad,bU as Id,bV as jo,bW as yo,bX as U0,bY as z0,bZ as V0}from"./index-C3U0yXJT.js";const H0=t=>{const{onSuccess:a,...s}=t||{},o=cr(),{login:l}=Vc(),d=jn();return sn({mutationKey:o().auth().action("login").get(),mutationFn:l,onSuccess:async(c,m,g)=>{c.success&&d.removeQueries({queryKey:o().auth().get()}),await(a==null?void 0:a(c,m,g))},...s})};/**
* @license lucide-react v0.427.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Fd=Re("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);/**
* @license lucide-react v0.427.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const G0=Re("ArrowDownUp",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"m21 8-4-4-4 4",key:"1c9v7m"}],["path",{d:"M17 4v16",key:"7dpous"}]]);/**
* @license lucide-react v0.427.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Fc=Re("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);/**
* @license lucide-react v0.427.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Dc=Re("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/**
* @license lucide-react v0.427.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const K0=Re("ChevronsLeft",[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]]);/**
* @license lucide-react v0.427.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const W0=Re("ChevronsRight",[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]]);/**
* @license lucide-react v0.427.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Dd=Re("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
* @license lucide-react v0.427.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Q0=Re("CirclePlus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]);/**
* @license lucide-react v0.427.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Y0=Re("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
* @license lucide-react v0.427.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const X0=Re("CopyPlus",[["line",{x1:"15",x2:"15",y1:"12",y2:"18",key:"1p7wdc"}],["line",{x1:"12",x2:"18",y1:"15",y2:"15",key:"1nscbv"}],["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
* @license lucide-react v0.427.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Fi=Re("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
* @license lucide-react v0.427.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Td=Re("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
* @license lucide-react v0.427.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Z0=Re("EllipsisVertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]);/**
* @license lucide-react v0.427.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Md=Re("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
* @license lucide-react v0.427.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const J0=Re("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
* @license lucide-react v0.427.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const eb=Re("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
* @license lucide-react v0.427.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Ld=Re("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);/**
* @license lucide-react v0.427.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Od=Re("FolderPlus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/**
* @license lucide-react v0.427.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const tb=Re("FolderX",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"m9.5 10.5 5 5",key:"ra9qjz"}],["path",{d:"m14.5 10.5-5 5",key:"l2rkpq"}]]);/**
* @license lucide-react v0.427.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const nb=Re("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/**
* @license lucide-react v0.427.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Pd=Re("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/**
* @license lucide-react v0.427.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const rb=Re("ListPlus",[["path",{d:"M11 12H3",key:"51ecnj"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M16 18H3",key:"12xzn7"}],["path",{d:"M18 9v6",key:"1twb98"}],["path",{d:"M21 12h-6",key:"bt1uis"}]]);/**
* @license lucide-react v0.427.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const sb=Re("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
* @license lucide-react v0.427.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const $o=Re("PackagePlus",[["path",{d:"M16 16h6",key:"100bgy"}],["path",{d:"M19 13v6",key:"85cyf1"}],["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]]);/**
* @license lucide-react v0.427.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Bo=Re("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
* @license lucide-react v0.427.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ib=Re("Scan",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}]]);/**
* @license lucide-react v0.427.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ab=Re("Send",[["path",{d:"m22 2-7 20-4-9-9-4Z",key:"1q3vgg"}],["path",{d:"M22 2 11 13",key:"nzbqef"}]]);/**
* @license lucide-react v0.427.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ob=Re("Settings2",[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);/**
* @license lucide-react v0.427.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const qd=Re("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);/**
* @license lucide-react v0.427.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const pi=Re("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);function lb({className:t,...a}){return r.jsx("div",{"data-slot":"empty",className:me("flex min-w-0 flex-col items-center justify-center gap-6 rounded-lg border border-dashed border-transparent p-6 text-center md:p-8",t),...a})}function ub({className:t,...a}){return r.jsx("div",{"data-slot":"empty-header",className:me("flex max-w-sm flex-col items-center gap-2 text-center",t),...a})}function cb({className:t,variant:a="default",...s}){return r.jsx("div",{"data-slot":"empty-media","data-variant":a,className:me("flex shrink-0 items-center justify-center",a==="icon"&&"h-10 w-10 rounded-lg bg-muted text-foreground [&_svg]:h-6 [&_svg]:w-6",t),...s})}function db({className:t,...a}){return r.jsx("div",{"data-slot":"empty-title",className:me("text-lg font-medium tracking-tight",t),...a})}function fb({className:t,...a}){return r.jsx("p",{"data-slot":"empty-description",className:me("text-sm leading-relaxed text-muted-foreground",t),...a})}function mb({className:t,...a}){return r.jsx("div",{"data-slot":"empty-content",className:me("flex w-full max-w-sm min-w-0 flex-col items-center gap-4 text-sm",t),...a})}const gb=({className:t,...a})=>r.jsx(a0,{className:me("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",t),...a}),Tc=i0,hb=({withHandle:t,className:a,...s})=>r.jsx(o0,{className:me("relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",a),...s,children:t&&r.jsx("div",{className:"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border",children:r.jsx(Pd,{className:"h-2.5 w-2.5"})})});function wt({className:t,...a}){return r.jsx("div",{className:me("animate-pulse rounded-md bg-muted",t),...a})}const pb=t=>typeof t=="object"&&t!==null&&t.hasOwnProperty("total_items");let oi;const xb=new Uint8Array(16);function vb(){if(!oi&&(oi=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!oi))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return oi(xb)}const st=[];for(let t=0;t<256;++t)st.push((t+256).toString(16).slice(1));function _b(t,a=0){return st[t[a+0]]+st[t[a+1]]+st[t[a+2]]+st[t[a+3]]+"-"+st[t[a+4]]+st[t[a+5]]+"-"+st[t[a+6]]+st[t[a+7]]+"-"+st[t[a+8]]+st[t[a+9]]+"-"+st[t[a+10]]+st[t[a+11]]+st[t[a+12]]+st[t[a+13]]+st[t[a+14]]+st[t[a+15]]}const bb=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Mc={randomUUID:bb};function wb(t,a,s){if(Mc.randomUUID&&!t)return Mc.randomUUID();t=t||{};const o=t.random||(t.rng||vb)();return o[6]=o[6]&15|64,o[8]=o[8]&63|128,_b(o)}class wn extends bi{static validate(a,s){const o=Qe.RULE_ALLOW_EMPTY.default(""),l=Vt.string().guid({version:["uuidv4"]}).label(s.label?s.label:"id"),d=Vt.alternatives(o,l);return Qe.validate(d,a)}static sanitize(a){return a.trim()}static create(a,s={}){const o={label:"id",generateOnEmpty:!1,...s};if(!a&&!o.generateOnEmpty)return Ye.fail(Lr(Or.INVALID_INPUT_DATA,"ID is null or empty"));if(a){const l=wn.validate(a,o);return l.isFailure?Ye.fail(Lr(Or.INVALID_INPUT_DATA,l.error.message,o)):Ye.ok(new wn(wn.sanitize(l.object)))}return o.generateOnEmpty?wn.generateNewID():Ye.ok(new wn(null))}static generateNewID(){return Ye.ok(new wn(wb()))}get value(){return String(this.props)}toString(){return String(this.props)}toPrimitive(){return this.toString()}}const ao={aa:{name:"Afar",nativeName:"Afaraf"},ab:{name:"Abkhaz",nativeName:"аҧсуа бызшәа"},ae:{name:"Avestan",nativeName:"avesta"},af:{name:"Afrikaans",nativeName:"Afrikaans"},ak:{name:"Akan",nativeName:"Akan"},am:{name:"Amharic",nativeName:"አማርኛ"},an:{name:"Aragonese",nativeName:"aragonés"},ar:{name:"Arabic",nativeName:"اَلْعَرَبِيَّةُ"},as:{name:"Assamese",nativeName:"অসমীয়া"},av:{name:"Avaric",nativeName:"авар мацӀ"},ay:{name:"Aymara",nativeName:"aymar aru"},az:{name:"Azerbaijani",nativeName:"azərbaycan dili"},ba:{name:"Bashkir",nativeName:"башҡорт теле"},be:{name:"Belarusian",nativeName:"беларуская мова"},bg:{name:"Bulgarian",nativeName:"български език"},bi:{name:"Bislama",nativeName:"Bislama"},bm:{name:"Bambara",nativeName:"bamanankan"},bn:{name:"Bengali",nativeName:"বাংলা"},bo:{name:"Tibetan",nativeName:"བོད་ཡིག"},br:{name:"Breton",nativeName:"brezhoneg"},bs:{name:"Bosnian",nativeName:"bosanski jezik"},ca:{name:"Catalan",nativeName:"Català"},ce:{name:"Chechen",nativeName:"нохчийн мотт"},ch:{name:"Chamorro",nativeName:"Chamoru"},co:{name:"Corsican",nativeName:"corsu"},cr:{name:"Cree",nativeName:"ᓀᐦᐃᔭᐍᐏᐣ"},cs:{name:"Czech",nativeName:"čeština"},cu:{name:"Old Church Slavonic",nativeName:"ѩзыкъ словѣньскъ"},cv:{name:"Chuvash",nativeName:"чӑваш чӗлхи"},cy:{name:"Welsh",nativeName:"Cymraeg"},da:{name:"Danish",nativeName:"dansk"},de:{name:"German",nativeName:"Deutsch"},dv:{name:"Divehi",nativeName:"ދިވެހި"},dz:{name:"Dzongkha",nativeName:"རྫོང་ཁ"},ee:{name:"Ewe",nativeName:"Eʋegbe"},el:{name:"Greek",nativeName:"Ελληνικά"},en:{name:"English",nativeName:"English"},eo:{name:"Esperanto",nativeName:"Esperanto"},es:{name:"Spanish",nativeName:"Español"},et:{name:"Estonian",nativeName:"eesti"},eu:{name:"Basque",nativeName:"euskara"},fa:{name:"Persian",nativeName:"فارسی"},ff:{name:"Fula",nativeName:"Fulfulde"},fi:{name:"Finnish",nativeName:"suomi"},fj:{name:"Fijian",nativeName:"vosa Vakaviti"},fo:{name:"Faroese",nativeName:"føroyskt"},fr:{name:"French",nativeName:"Français"},fy:{name:"Western Frisian",nativeName:"Frysk"},ga:{name:"Irish",nativeName:"Gaeilge"},gd:{name:"Scottish Gaelic",nativeName:"Gàidhlig"},gl:{name:"Galician",nativeName:"galego"},gn:{name:"Guaraní",nativeName:"Avañe'ẽ"},gu:{name:"Gujarati",nativeName:"ગુજરાતી"},gv:{name:"Manx",nativeName:"Gaelg"},ha:{name:"Hausa",nativeName:"هَوُسَ"},he:{name:"Hebrew",nativeName:"עברית"},hi:{name:"Hindi",nativeName:"हिन्दी"},ho:{name:"Hiri Motu",nativeName:"Hiri Motu"},hr:{name:"Croatian",nativeName:"Hrvatski"},ht:{name:"Haitian",nativeName:"Kreyòl ayisyen"},hu:{name:"Hungarian",nativeName:"magyar"},hy:{name:"Armenian",nativeName:"Հայերեն"},hz:{name:"Herero",nativeName:"Otjiherero"},ia:{name:"Interlingua",nativeName:"Interlingua"},id:{name:"Indonesian",nativeName:"Bahasa Indonesia"},ie:{name:"Interlingue",nativeName:"Interlingue"},ig:{name:"Igbo",nativeName:"Asụsụ Igbo"},ii:{name:"Nuosu",nativeName:"ꆈꌠ꒿ Nuosuhxop"},ik:{name:"Inupiaq",nativeName:"Iñupiaq"},io:{name:"Ido",nativeName:"Ido"},is:{name:"Icelandic",nativeName:"Íslenska"},it:{name:"Italian",nativeName:"Italiano"},iu:{name:"Inuktitut",nativeName:"ᐃᓄᒃᑎᑐᑦ"},ja:{name:"Japanese",nativeName:"日本語"},jv:{name:"Javanese",nativeName:"basa Jawa"},ka:{name:"Georgian",nativeName:"ქართული"},kg:{name:"Kongo",nativeName:"Kikongo"},ki:{name:"Kikuyu",nativeName:"Gĩkũyũ"},kj:{name:"Kwanyama",nativeName:"Kuanyama"},kk:{name:"Kazakh",nativeName:"қазақ тілі"},kl:{name:"Kalaallisut",nativeName:"kalaallisut"},km:{name:"Khmer",nativeName:"ខេមរភាសា"},kn:{name:"Kannada",nativeName:"ಕನ್ನಡ"},ko:{name:"Korean",nativeName:"한국어"},kr:{name:"Kanuri",nativeName:"Kanuri"},ks:{name:"Kashmiri",nativeName:"कश्मीरी"},ku:{name:"Kurdish",nativeName:"Kurdî"},kv:{name:"Komi",nativeName:"коми кыв"},kw:{name:"Cornish",nativeName:"Kernewek"},ky:{name:"Kyrgyz",nativeName:"Кыргызча"},la:{name:"Latin",nativeName:"latine"},lb:{name:"Luxembourgish",nativeName:"Lëtzebuergesch"},lg:{name:"Ganda",nativeName:"Luganda"},li:{name:"Limburgish",nativeName:"Limburgs"},ln:{name:"Lingala",nativeName:"Lingála"},lo:{name:"Lao",nativeName:"ພາສາລາວ"},lt:{name:"Lithuanian",nativeName:"lietuvių kalba"},lu:{name:"Luba-Katanga",nativeName:"Kiluba"},lv:{name:"Latvian",nativeName:"latviešu valoda"},mg:{name:"Malagasy",nativeName:"fiteny malagasy"},mh:{name:"Marshallese",nativeName:"Kajin M̧ajeļ"},mi:{name:"Māori",nativeName:"te reo Māori"},mk:{name:"Macedonian",nativeName:"македонски јазик"},ml:{name:"Malayalam",nativeName:"മലയാളം"},mn:{name:"Mongolian",nativeName:"Монгол хэл"},mr:{name:"Marathi",nativeName:"मराठी"},ms:{name:"Malay",nativeName:"Bahasa Melayu"},mt:{name:"Maltese",nativeName:"Malti"},my:{name:"Burmese",nativeName:"ဗမာစာ"},na:{name:"Nauru",nativeName:"Dorerin Naoero"},nb:{name:"Norwegian Bokmål",nativeName:"Norsk bokmål"},nd:{name:"Northern Ndebele",nativeName:"isiNdebele"},ne:{name:"Nepali",nativeName:"नेपाली"},ng:{name:"Ndonga",nativeName:"Owambo"},nl:{name:"Dutch",nativeName:"Nederlands"},nn:{name:"Norwegian Nynorsk",nativeName:"Norsk nynorsk"},no:{name:"Norwegian",nativeName:"Norsk"},nr:{name:"Southern Ndebele",nativeName:"isiNdebele"},nv:{name:"Navajo",nativeName:"Diné bizaad"},ny:{name:"Chichewa",nativeName:"chiCheŵa"},oc:{name:"Occitan",nativeName:"occitan"},oj:{name:"Ojibwe",nativeName:"ᐊᓂᔑᓈᐯᒧᐎᓐ"},om:{name:"Oromo",nativeName:"Afaan Oromoo"},or:{name:"Oriya",nativeName:"ଓଡ଼ିଆ"},os:{name:"Ossetian",nativeName:"ирон æвзаг"},pa:{name:"Panjabi",nativeName:"ਪੰਜਾਬੀ"},pi:{name:"Pāli",nativeName:"पाऴि"},pl:{name:"Polish",nativeName:"Polski"},ps:{name:"Pashto",nativeName:"پښتو"},pt:{name:"Portuguese",nativeName:"Português"},qu:{name:"Quechua",nativeName:"Runa Simi"},rm:{name:"Romansh",nativeName:"rumantsch grischun"},rn:{name:"Kirundi",nativeName:"Ikirundi"},ro:{name:"Romanian",nativeName:"Română"},ru:{name:"Russian",nativeName:"Русский"},rw:{name:"Kinyarwanda",nativeName:"Ikinyarwanda"},sa:{name:"Sanskrit",nativeName:"संस्कृतम्"},sc:{name:"Sardinian",nativeName:"sardu"},sd:{name:"Sindhi",nativeName:"सिन्धी"},se:{name:"Northern Sami",nativeName:"Davvisámegiella"},sg:{name:"Sango",nativeName:"yângâ tî sängö"},si:{name:"Sinhala",nativeName:"සිංහල"},sk:{name:"Slovak",nativeName:"slovenčina"},sl:{name:"Slovenian",nativeName:"slovenščina"},sm:{name:"Samoan",nativeName:"gagana fa'a Samoa"},sn:{name:"Shona",nativeName:"chiShona"},so:{name:"Somali",nativeName:"Soomaaliga"},sq:{name:"Albanian",nativeName:"Shqip"},sr:{name:"Serbian",nativeName:"српски језик"},ss:{name:"Swati",nativeName:"SiSwati"},st:{name:"Southern Sotho",nativeName:"Sesotho"},su:{name:"Sundanese",nativeName:"Basa Sunda"},sv:{name:"Swedish",nativeName:"Svenska"},sw:{name:"Swahili",nativeName:"Kiswahili"},ta:{name:"Tamil",nativeName:"தமிழ்"},te:{name:"Telugu",nativeName:"తెలుగు"},tg:{name:"Tajik",nativeName:"тоҷикӣ"},th:{name:"Thai",nativeName:"ไทย"},ti:{name:"Tigrinya",nativeName:"ትግርኛ"},tk:{name:"Turkmen",nativeName:"Türkmençe"},tl:{name:"Tagalog",nativeName:"Wikang Tagalog"},tn:{name:"Tswana",nativeName:"Setswana"},to:{name:"Tonga",nativeName:"faka Tonga"},tr:{name:"Turkish",nativeName:"Türkçe"},ts:{name:"Tsonga",nativeName:"Xitsonga"},tt:{name:"Tatar",nativeName:"татар теле"},tw:{name:"Twi",nativeName:"Twi"},ty:{name:"Tahitian",nativeName:"Reo Tahiti"},ug:{name:"Uyghur",nativeName:"ئۇيغۇرچە‎"},uk:{name:"Ukrainian",nativeName:"Українська"},ur:{name:"Urdu",nativeName:"اردو"},uz:{name:"Uzbek",nativeName:"Ўзбек"},ve:{name:"Venda",nativeName:"Tshivenḓa"},vi:{name:"Vietnamese",nativeName:"Tiếng Việt"},vo:{name:"Volapük",nativeName:"Volapük"},wa:{name:"Walloon",nativeName:"walon"},wo:{name:"Wolof",nativeName:"Wollof"},xh:{name:"Xhosa",nativeName:"isiXhosa"},yi:{name:"Yiddish",nativeName:"ייִדיש"},yo:{name:"Yoruba",nativeName:"Yorùbá"},za:{name:"Zhuang",nativeName:"Saɯ cueŋƅ"},zh:{name:"Chinese",nativeName:"中文"},zu:{name:"Zulu",nativeName:"isiZulu"}},kn=class kn extends bi{constructor(){super(...arguments);Me(this,"toString",()=>this.code)}static validate(s,o){const l=Vt.alternatives(Qe.RULE_ALLOW_EMPTY.default(""),Vt.string().lowercase().valid(...Object.keys(ao)).label(String(o.label)));return Qe.validate(l,s)}static sanitize(s){return s?String(s).toLowerCase():void 0}static createFromCode(s,o={}){const l={...o,label:o.label?o.label:"lang_code"},d=kn.validate(s,l);if(d.isFailure)return Ye.fail(Lr(Or.INVALID_INPUT_DATA,d.error.message,l));const c=kn.sanitize(d.object),m=c?{...ao[d.object],code:c}:void 0;return Ye.ok(new kn(m))}static createDefaultCode(){return kn.createFromCode(this.DEFAULT_LANGUAGE_CODE)}get name(){return this.props?String(this.props.name):""}get nativeName(){return this.props?String(this.props.nativeName):""}get code(){return this.props?String(this.props.code):""}isEmpty(){return this.isNull()||this.props===void 0}toPrimitive(){return this.toString()}};Me(kn,"DEFAULT_LANGUAGE_CODE","es"),Me(kn,"LANGUAGES",ao);let or=kn;class kd{constructor(a){Me(this,"_collection",[]);this._collection=a??[]}add(a){this._collection.push(a)}reset(){this._collection=[]}hasSomeFaultyResult(){return this._collection.some(a=>a.isFailure)}getFirstFaultyResult(){return this._collection.find(a=>a.isFailure)}getAllFaultyResults(){return this._collection.filter(a=>a.isFailure)}get objects(){return this._collection.filter(a=>a.isSuccess).map(a=>a.object)}get errors(){return this._collection.filter(a=>a.isFailure).map(a=>a.error)}}const $d=2,oo={amount:0,scale:$d},Ie=class Ie extends bi{constructor(s,o,l){super(s);Me(this,"_isNull");Me(this,"_options");Me(this,"isEmpty",()=>this.isNull());Me(this,"isNull",()=>this._isNull);this._isNull=Object.freeze(o),this._options=Object.freeze(l)}static validate(s,o,l){const d=Qe.RULE_ALLOW_NULL_OR_UNDEFINED,c=Qe.RULE_ALLOW_EMPTY,m=Qe.RULE_IS_TYPE_NUMBER.label(l.label?l.label:"amount"),g=Qe.RULE_IS_TYPE_STRING.regex(/^[-]?\d+$/).label(l.label?l.label:"amount"),x=Vt.number().min(Ie.MIN_SCALE).max(Ie.MAX_SCALE).label(l.label?l.label:"scale"),v=new kd([Qe.validate(Vt.alternatives(d,c,m,g),s),Qe.validate(Vt.alternatives(Qe.RULE_IS_TYPE_NUMBER.label(l.label?l.label:"scale"),x),o)]);if(v.hasSomeFaultyResult())return v.getFirstFaultyResult();let b=typeof s=="string"?parseInt(s,10):Number(s),j=so.isNull(o)?Ie.DEFAULT_SCALE:Number(o);const _=b/Math.pow(10,j);return _<Ie.MIN_VALUE||_>Ie.MAX_VALUE?Ye.fail(new Error(`Value with scale is out of range: ${_}`)):Ye.ok()}static create(s=oo,o={}){if(s===null)throw new Error("InvalidParams: props params is missing");const{amount:l=oo.amount,scale:d=oo.scale}=s,c={label:"percentage",...o},m=Ie.validate(l,d,c);if(m.isFailure)return Ye.fail(Lr(Or.INVALID_INPUT_DATA,m.error.message,c));let g=Ie._sanitize(l);const x={amount:so.isNull(g)?0:g,scale:d};return Ye.ok(new this(x,so.isNull(g),o))}static createFromFormattedValue(s,o={}){if(s===null||s==="")return Ie.create({amount:null,scale:Ie.DEFAULT_SCALE});const l=String(s),[d,c]=l.split(",");let m=d,g=2;return c===void 0?g=0:(c===""&&(m=d+c.padEnd(1,"0"),g=1),c.length===1?(m=d+c.padEnd(1,"0"),g=1):c.length===2&&(m=d+c.padEnd(2,"0"),g=2)),Ie.create({amount:m,scale:g},o)}static _sanitize(s){let o=null;return typeof s=="string"?o=parseInt(s,10):o=s,o}static _toString(s,o){if(s===null)return"";const l=Math.pow(10,o);return(Number(s)/l).toFixed(o)}static _isWithinRange(s,o){const l=Number(Ie._toString(s,o));return l>=Ie.MIN_VALUE&&l<=Ie.MAX_VALUE}get amount(){var s;return this.isNull()?null:Number((s=this.props)==null?void 0:s.amount)}get scale(){var s;return Number((s=this.props)==null?void 0:s.scale)}getAmount(){var s;return this.isNull()?null:Number((s=this.props)==null?void 0:s.amount)}getScale(){var s;return this.isNull()?0:Number((s=this.props)==null?void 0:s.scale)}toString(){return Ie._toString(this.amount,this.scale)}toNumber(){return this.isNull()?0:Number(this.toString())}toFormat(){return this._isNull?"":Intl.NumberFormat("es-ES",{maximumFractionDigits:2}).format(this.toNumber())}toPrimitive(){return this.scale!==Ie.DEFAULT_SCALE?this.convertScale(Ie.DEFAULT_SCALE).toPrimitive():this.amount}toPrimitives(){return this.toObject()}toObject(){return{amount:this.amount,scale:this.scale}}convertScale(s){if(s<Ie.MIN_SCALE||s>Ie.MAX_SCALE)throw new Error(`Scale out of range: ${s}`);if(this.isNull())return new Ie({amount:null,scale:s},!0,this._options);const o=Math.pow(10,this.scale),l=Number(this.amount)/o,d=Math.pow(10,s),c=Math.round(l*d);if(!Ie._isWithinRange(c,s))throw new Error(`Value out of range after conversion: ${c} ${s}`);return new Ie({amount:c,scale:s},!1,this._options)}hasSameScale(s){return this.scale===s.scale}isWithinRange(){return Ie._isWithinRange(this.amount,this.scale)}};Me(Ie,"DEFAULT_SCALE",$d),Me(Ie,"MIN_VALUE",0),Me(Ie,"MAX_VALUE",100),Me(Ie,"MIN_SCALE",0),Me(Ie,"MAX_SCALE",2);let on=Ie;const Bd=2,lo={amount:0,scale:Bd},Fe=class Fe extends bi{constructor(s,o,l){super(s);Me(this,"_isNull");Me(this,"_options");Me(this,"isEmpty",()=>this.isNull());Me(this,"isNull",()=>this._isNull);this._isNull=Object.freeze(o),this._options=Object.freeze(l)}static validate(s,o,l={}){const d=Qe.RULE_ALLOW_NULL_OR_UNDEFINED,c=Qe.RULE_ALLOW_EMPTY,m=Qe.RULE_IS_TYPE_NUMBER.label(l.label?l.label:"amount"),g=Qe.RULE_IS_TYPE_STRING.regex(/^[-]?\d+$/).label(l.label?l.label:"amount"),x=Vt.number().min(Fe.MIN_SCALE).max(Fe.MAX_SCALE).label(l.label?l.label:"scale"),v=new kd([Qe.validate(Vt.alternatives(d,c,m,g),s),Qe.validate(Vt.alternatives(Qe.RULE_IS_TYPE_NUMBER.label(l.label?l.label:"scale"),x),o)]);return v.hasSomeFaultyResult()?v.getFirstFaultyResult():Ye.ok()}static create(s=lo,o={}){if(s===null)throw new Error("InvalidParams: props params is missing");const{amount:l=lo.amount,scale:d=lo.scale}=s,c={label:"quantity",...o},m=Fe.validate(l,d,c);if(m.isFailure)return Ye.fail(Lr(Or.INVALID_INPUT_DATA,m.error.message,c));let g=Fe._sanitize(l);const x={amount:g===null?0:g,scale:d};return Ye.ok(new Fe(x,g===null,o))}static createFromFormattedValue(s,o={}){if(s===null||s==="")return Fe.create({amount:null,scale:Fe.DEFAULT_SCALE});const l=String(s),[d,c]=l.split(",");let m=d,g=2;return c===void 0?g=0:(c===""&&(m=d+c.padEnd(1,"0"),g=1),c.length===1?(m=d+c.padEnd(1,"0"),g=1):c.length===2&&(m=d+c.padEnd(2,"0"),g=2)),Fe.create({amount:m,scale:g},o)}static _sanitize(s){let o=null;return typeof s=="string"?o=parseInt(s,10):o=s,o}static _toString(s,o){if(s===null)return"";const l=Math.pow(10,o);return(Number(s)/l).toFixed(o)}get amount(){var s;return this.isNull()?null:Number((s=this.props)==null?void 0:s.amount)}get scale(){var s;return Number((s=this.props)==null?void 0:s.scale)}getAmount(){var s;return this.isNull()?null:Number((s=this.props)==null?void 0:s.amount)}getScale(){var s;return this.isNull()?0:Number((s=this.props)==null?void 0:s.scale)}toString(){return Fe._toString(this.amount,this.scale)}toNumber(){return this.isNull()?0:Number(this.toString())}toFormat(){return this._isNull?"":Intl.NumberFormat("es-ES",{maximumFractionDigits:2}).format(this.toNumber())}toPrimitive(){return this.scale!==Fe.DEFAULT_SCALE?this.convertScale(Fe.DEFAULT_SCALE).toPrimitive():this.amount}toPrimitives(){return this.toObject()}toObject(){return{amount:this.amount,scale:this.scale}}convertScale(s){if(s<Fe.MIN_SCALE||s>Fe.MAX_SCALE)throw new Error(`Scale out of range: ${s}`);if(this.isNull())return new Fe({amount:null,scale:s},!0,this._options);const o=Math.pow(10,this.scale),l=Number(this.amount)/o,d=Math.pow(10,s),c=Math.round(l*d);return new Fe({amount:c,scale:s},!1,this._options)}hasSameScale(s){return this.scale===s.scale}increment(s){return this.isNull()?s?Fe.create(s.toObject()):Fe.create():s?this.hasSameScale(s)?Fe.create({amount:Number(this.amount)+Number(s.amount),scale:this.scale},this._options):Ye.fail(Error("No se pueden sumar cantidades con diferentes escalas.")):Fe.create({amount:Number(this.amount)+1,scale:this.scale},this._options)}decrement(s){return this.isNull()?s?Fe.create(s.toObject()):Fe.create():s?this.hasSameScale(s)?Fe.create({amount:Number(this.amount)-Number(s.amount),scale:this.scale},this._options):Ye.fail(Error("No se pueden restar cantidades con diferentes escalas.")):Fe.create({amount:Number(this.amount)-1,scale:this.scale},this._options)}};Me(Fe,"DEFAULT_SCALE",Bd),Me(Fe,"MIN_SCALE",0),Me(Fe,"MAX_SCALE",2);let Kn=Fe;const Lc=2;class jb extends It{static create(a){const{amount:s,currencyCode:o,scale:l=Lc}=a,d=It.create({amount:s,currencyCode:o,scale:l});if(d.isFailure)return d;const c=d.object.convertScale(Lc);return Ye.ok(c)}}class Mr extends l0{constructor(){super(...arguments);Me(this,"isValid",()=>!isNaN(this.props.valueOf())&&this.props.valueOf()!==0);Me(this,"isEmpty",()=>!this.isValid());Me(this,"toISO8601",()=>this.isValid()?this.props.toISOString():"");Me(this,"toDateString",()=>this.isValid()?this.props.toDateString():"");Me(this,"toLocaleDateString",(s,o)=>this.isValid()?this.props.toLocaleDateString(s,o):"");Me(this,"toLocaleTimeString",()=>this.isValid()?this.props.toLocaleTimeString():"")}static validate(s,o){const l=Qe.RULE_ALLOW_EMPTY.default(0),d=Vt.date().label(String(o.label)),c=Vt.alternatives(l,d);return Qe.validate(c,s)}static createCurrentDate(){return Ye.ok(new Mr(new Date))}static create(s,o={}){const l={...o,dateFormat:o.dateFormat?o.dateFormat:"YYYY-MM-DD",label:o.label?o.label:"date"},d=Mr.validate(s,l);return d.isFailure?Ye.fail(Lr(Or.INVALID_INPUT_DATA,d.error.message,l)):Ye.ok(new Mr(new Date(d.object)))}toString(){if(!this.isEmpty()){const s=this.props.getFullYear(),o=String(this.props.getMonth()+1).padStart(2,"0"),l=String(this.props.getDate()).padStart(2,"0");return`${s}-${o}-${l}`}return""}toPrimitive(){return this.toISO8601()}}const yb=({isPending:t,interval:a=1e3,onInterval:s})=>{const[o,l]=D.useState(void 0);return D.useEffect(()=>{let d;return t&&(d=setInterval(()=>{l(c=>c===void 0?a:c+a)},a)),()=>{clearInterval(d),l(void 0)}},[t,a]),D.useEffect(()=>{s&&o&&s(o)},[o]),{elapsedTime:o}},Cb=2*60*1e3,Sb=60*1e3,Uo=({queryKey:t,queryFn:a,enabled:s,select:o,queryOptions:l={},overtimeOptions:d})=>{const[c,m]=D.useState(!1),g=Hc({queryKey:t,queryFn:a,placeholderData:Gc,staleTime:Sb,refetchInterval:Cb,refetchOnWindowFocus:!0,enabled:s&&!!a,select:o,...l});D.useEffect(()=>{g.isSuccess&&pb(g.data)&&m(g.data.total_items===0)},[g]);const{elapsedTime:x}=yb({isPending:g.isFetching,interval:d==null?void 0:d.interval,onInterval:d==null?void 0:d.onInterval});return{...g,overtime:{elapsedTime:x},isEmpty:c}},Ud=t=>Hc({placeholderData:Gc,...t});function Nb(t){return sn({...t})}/**
* table-core
*
* Copyright (c) TanStack
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/function Rb(){return{accessor:(t,a)=>typeof t=="function"?{...a,accessorFn:t}:{...a,accessorKey:t},display:t=>t,group:t=>t}}function Bn(t,a){return typeof t=="function"?t(a):t}function Ft(t,a){return s=>{a.setState(o=>({...o,[t]:Bn(s,o[t])}))}}function Di(t){return t instanceof Function}function Eb(t){return Array.isArray(t)&&t.every(a=>typeof a=="number")}function Ab(t,a){const s=[],o=l=>{l.forEach(d=>{s.push(d);const c=a(d);c!=null&&c.length&&o(c)})};return o(t),s}function ee(t,a,s){let o=[],l;return d=>{let c;s.key&&s.debug&&(c=Date.now());const m=t(d);if(!(m.length!==o.length||m.some((v,b)=>o[b]!==v)))return l;o=m;let x;if(s.key&&s.debug&&(x=Date.now()),l=a(...m),s==null||s.onChange==null||s.onChange(l),s.key&&s.debug&&s!=null&&s.debug()){const v=Math.round((Date.now()-c)*100)/100,b=Math.round((Date.now()-x)*100)/100,j=b/16,_=(N,I)=>{for(N=String(N);N.length<I;)N=" "+N;return N};console.info(`%c⏱ ${_(b,5)} /${_(v,5)} ms`,`
font-size: .6rem;
font-weight: bold;
color: hsl(${Math.max(0,Math.min(120-120*j,120))}deg 100% 31%);`,s==null?void 0:s.key)}return l}}function te(t,a,s,o){return{debug:()=>{var l;return(l=t==null?void 0:t.debugAll)!=null?l:t[a]},key:!1,onChange:o}}function Ib(t,a,s,o){const l=()=>{var c;return(c=d.getValue())!=null?c:t.options.renderFallbackValue},d={id:`${a.id}_${s.id}`,row:a,column:s,getValue:()=>a.getValue(o),renderValue:l,getContext:ee(()=>[t,s,a,d],(c,m,g,x)=>({table:c,column:m,row:g,cell:x,getValue:x.getValue,renderValue:x.renderValue}),te(t.options,"debugCells"))};return t._features.forEach(c=>{c.createCell==null||c.createCell(d,s,a,t)},{}),d}function Fb(t,a,s,o){var l,d;const m={...t._getDefaultColumnDef(),...a},g=m.accessorKey;let x=(l=(d=m.id)!=null?d:g?typeof String.prototype.replaceAll=="function"?g.replaceAll(".","_"):g.replace(/\./g,"_"):void 0)!=null?l:typeof m.header=="string"?m.header:void 0,v;if(m.accessorFn?v=m.accessorFn:g&&(g.includes(".")?v=j=>{let _=j;for(const I of g.split(".")){var N;_=(N=_)==null?void 0:N[I]}return _}:v=j=>j[m.accessorKey]),!x)throw new Error;let b={id:`${String(x)}`,accessorFn:v,parent:o,depth:s,columnDef:m,columns:[],getFlatColumns:ee(()=>[!0],()=>{var j;return[b,...(j=b.columns)==null?void 0:j.flatMap(_=>_.getFlatColumns())]},te(t.options,"debugColumns")),getLeafColumns:ee(()=>[t._getOrderColumnsFn()],j=>{var _;if((_=b.columns)!=null&&_.length){let N=b.columns.flatMap(I=>I.getLeafColumns());return j(N)}return[b]},te(t.options,"debugColumns"))};for(const j of t._features)j.createColumn==null||j.createColumn(b,t);return b}const dt="debugHeaders";function Oc(t,a,s){var o;let d={id:(o=s.id)!=null?o:a.id,column:a,index:s.index,isPlaceholder:!!s.isPlaceholder,placeholderId:s.placeholderId,depth:s.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const c=[],m=g=>{g.subHeaders&&g.subHeaders.length&&g.subHeaders.map(m),c.push(g)};return m(d),c},getContext:()=>({table:t,header:d,column:a})};return t._features.forEach(c=>{c.createHeader==null||c.createHeader(d,t)}),d}const Db={createTable:t=>{t.getHeaderGroups=ee(()=>[t.getAllColumns(),t.getVisibleLeafColumns(),t.getState().columnPinning.left,t.getState().columnPinning.right],(a,s,o,l)=>{var d,c;const m=(d=o==null?void 0:o.map(b=>s.find(j=>j.id===b)).filter(Boolean))!=null?d:[],g=(c=l==null?void 0:l.map(b=>s.find(j=>j.id===b)).filter(Boolean))!=null?c:[],x=s.filter(b=>!(o!=null&&o.includes(b.id))&&!(l!=null&&l.includes(b.id)));return li(a,[...m,...x,...g],t)},te(t.options,dt)),t.getCenterHeaderGroups=ee(()=>[t.getAllColumns(),t.getVisibleLeafColumns(),t.getState().columnPinning.left,t.getState().columnPinning.right],(a,s,o,l)=>(s=s.filter(d=>!(o!=null&&o.includes(d.id))&&!(l!=null&&l.includes(d.id))),li(a,s,t,"center")),te(t.options,dt)),t.getLeftHeaderGroups=ee(()=>[t.getAllColumns(),t.getVisibleLeafColumns(),t.getState().columnPinning.left],(a,s,o)=>{var l;const d=(l=o==null?void 0:o.map(c=>s.find(m=>m.id===c)).filter(Boolean))!=null?l:[];return li(a,d,t,"left")},te(t.options,dt)),t.getRightHeaderGroups=ee(()=>[t.getAllColumns(),t.getVisibleLeafColumns(),t.getState().columnPinning.right],(a,s,o)=>{var l;const d=(l=o==null?void 0:o.map(c=>s.find(m=>m.id===c)).filter(Boolean))!=null?l:[];return li(a,d,t,"right")},te(t.options,dt)),t.getFooterGroups=ee(()=>[t.getHeaderGroups()],a=>[...a].reverse(),te(t.options,dt)),t.getLeftFooterGroups=ee(()=>[t.getLeftHeaderGroups()],a=>[...a].reverse(),te(t.options,dt)),t.getCenterFooterGroups=ee(()=>[t.getCenterHeaderGroups()],a=>[...a].reverse(),te(t.options,dt)),t.getRightFooterGroups=ee(()=>[t.getRightHeaderGroups()],a=>[...a].reverse(),te(t.options,dt)),t.getFlatHeaders=ee(()=>[t.getHeaderGroups()],a=>a.map(s=>s.headers).flat(),te(t.options,dt)),t.getLeftFlatHeaders=ee(()=>[t.getLeftHeaderGroups()],a=>a.map(s=>s.headers).flat(),te(t.options,dt)),t.getCenterFlatHeaders=ee(()=>[t.getCenterHeaderGroups()],a=>a.map(s=>s.headers).flat(),te(t.options,dt)),t.getRightFlatHeaders=ee(()=>[t.getRightHeaderGroups()],a=>a.map(s=>s.headers).flat(),te(t.options,dt)),t.getCenterLeafHeaders=ee(()=>[t.getCenterFlatHeaders()],a=>a.filter(s=>{var o;return!((o=s.subHeaders)!=null&&o.length)}),te(t.options,dt)),t.getLeftLeafHeaders=ee(()=>[t.getLeftFlatHeaders()],a=>a.filter(s=>{var o;return!((o=s.subHeaders)!=null&&o.length)}),te(t.options,dt)),t.getRightLeafHeaders=ee(()=>[t.getRightFlatHeaders()],a=>a.filter(s=>{var o;return!((o=s.subHeaders)!=null&&o.length)}),te(t.options,dt)),t.getLeafHeaders=ee(()=>[t.getLeftHeaderGroups(),t.getCenterHeaderGroups(),t.getRightHeaderGroups()],(a,s,o)=>{var l,d,c,m,g,x;return[...(l=(d=a[0])==null?void 0:d.headers)!=null?l:[],...(c=(m=s[0])==null?void 0:m.headers)!=null?c:[],...(g=(x=o[0])==null?void 0:x.headers)!=null?g:[]].map(v=>v.getLeafHeaders()).flat()},te(t.options,dt))}};function li(t,a,s,o){var l,d;let c=0;const m=function(j,_){_===void 0&&(_=1),c=Math.max(c,_),j.filter(N=>N.getIsVisible()).forEach(N=>{var I;(I=N.columns)!=null&&I.length&&m(N.columns,_+1)},0)};m(t);let g=[];const x=(j,_)=>{const N={depth:_,id:[o,`${_}`].filter(Boolean).join("_"),headers:[]},I=[];j.forEach($=>{const L=[...I].reverse()[0],A=$.column.depth===N.depth;let E,T=!1;if(A&&$.column.parent?E=$.column.parent:(E=$.column,T=!0),L&&(L==null?void 0:L.column)===E)L.subHeaders.push($);else{const q=Oc(s,E,{id:[o,_,E.id,$==null?void 0:$.id].filter(Boolean).join("_"),isPlaceholder:T,placeholderId:T?`${I.filter(Y=>Y.column===E).length}`:void 0,depth:_,index:I.length});q.subHeaders.push($),I.push(q)}N.headers.push($),$.headerGroup=N}),g.push(N),_>0&&x(I,_-1)},v=a.map((j,_)=>Oc(s,j,{depth:c,index:_}));x(v,c-1),g.reverse();const b=j=>j.filter(N=>N.column.getIsVisible()).map(N=>{let I=0,$=0,L=[0];N.subHeaders&&N.subHeaders.length?(L=[],b(N.subHeaders).forEach(E=>{let{colSpan:T,rowSpan:q}=E;I+=T,L.push(q)})):I=1;const A=Math.min(...L);return $=$+A,N.colSpan=I,N.rowSpan=$,{colSpan:I,rowSpan:$}});return b((l=(d=g[0])==null?void 0:d.headers)!=null?l:[]),g}const zo=(t,a,s,o,l,d,c)=>{let m={id:a,index:o,original:s,depth:l,parentId:c,_valuesCache:{},_uniqueValuesCache:{},getValue:g=>{if(m._valuesCache.hasOwnProperty(g))return m._valuesCache[g];const x=t.getColumn(g);if(x!=null&&x.accessorFn)return m._valuesCache[g]=x.accessorFn(m.original,o),m._valuesCache[g]},getUniqueValues:g=>{if(m._uniqueValuesCache.hasOwnProperty(g))return m._uniqueValuesCache[g];const x=t.getColumn(g);if(x!=null&&x.accessorFn)return x.columnDef.getUniqueValues?(m._uniqueValuesCache[g]=x.columnDef.getUniqueValues(m.original,o),m._uniqueValuesCache[g]):(m._uniqueValuesCache[g]=[m.getValue(g)],m._uniqueValuesCache[g])},renderValue:g=>{var x;return(x=m.getValue(g))!=null?x:t.options.renderFallbackValue},subRows:[],getLeafRows:()=>Ab(m.subRows,g=>g.subRows),getParentRow:()=>m.parentId?t.getRow(m.parentId,!0):void 0,getParentRows:()=>{let g=[],x=m;for(;;){const v=x.getParentRow();if(!v)break;g.push(v),x=v}return g.reverse()},getAllCells:ee(()=>[t.getAllLeafColumns()],g=>g.map(x=>Ib(t,m,x,x.id)),te(t.options,"debugRows")),_getAllCellsByColumnId:ee(()=>[m.getAllCells()],g=>g.reduce((x,v)=>(x[v.column.id]=v,x),{}),te(t.options,"debugRows"))};for(let g=0;g<t._features.length;g++){const x=t._features[g];x==null||x.createRow==null||x.createRow(m,t)}return m},Tb={createColumn:(t,a)=>{t._getFacetedRowModel=a.options.getFacetedRowModel&&a.options.getFacetedRowModel(a,t.id),t.getFacetedRowModel=()=>t._getFacetedRowModel?t._getFacetedRowModel():a.getPreFilteredRowModel(),t._getFacetedUniqueValues=a.options.getFacetedUniqueValues&&a.options.getFacetedUniqueValues(a,t.id),t.getFacetedUniqueValues=()=>t._getFacetedUniqueValues?t._getFacetedUniqueValues():new Map,t._getFacetedMinMaxValues=a.options.getFacetedMinMaxValues&&a.options.getFacetedMinMaxValues(a,t.id),t.getFacetedMinMaxValues=()=>{if(t._getFacetedMinMaxValues)return t._getFacetedMinMaxValues()}}},zd=(t,a,s)=>{var o,l;const d=s==null||(o=s.toString())==null?void 0:o.toLowerCase();return!!(!((l=t.getValue(a))==null||(l=l.toString())==null||(l=l.toLowerCase())==null)&&l.includes(d))};zd.autoRemove=t=>Zt(t);const Vd=(t,a,s)=>{var o;return!!(!((o=t.getValue(a))==null||(o=o.toString())==null)&&o.includes(s))};Vd.autoRemove=t=>Zt(t);const Hd=(t,a,s)=>{var o;return((o=t.getValue(a))==null||(o=o.toString())==null?void 0:o.toLowerCase())===(s==null?void 0:s.toLowerCase())};Hd.autoRemove=t=>Zt(t);const Gd=(t,a,s)=>{var o;return(o=t.getValue(a))==null?void 0:o.includes(s)};Gd.autoRemove=t=>Zt(t);const Kd=(t,a,s)=>!s.some(o=>{var l;return!((l=t.getValue(a))!=null&&l.includes(o))});Kd.autoRemove=t=>Zt(t)||!(t!=null&&t.length);const Wd=(t,a,s)=>s.some(o=>{var l;return(l=t.getValue(a))==null?void 0:l.includes(o)});Wd.autoRemove=t=>Zt(t)||!(t!=null&&t.length);const Qd=(t,a,s)=>t.getValue(a)===s;Qd.autoRemove=t=>Zt(t);const Yd=(t,a,s)=>t.getValue(a)==s;Yd.autoRemove=t=>Zt(t);const Vo=(t,a,s)=>{let[o,l]=s;const d=t.getValue(a);return d>=o&&d<=l};Vo.resolveFilterValue=t=>{let[a,s]=t,o=typeof a!="number"?parseFloat(a):a,l=typeof s!="number"?parseFloat(s):s,d=a===null||Number.isNaN(o)?-1/0:o,c=s===null||Number.isNaN(l)?1/0:l;if(d>c){const m=d;d=c,c=m}return[d,c]};Vo.autoRemove=t=>Zt(t)||Zt(t[0])&&Zt(t[1]);const bn={includesString:zd,includesStringSensitive:Vd,equalsString:Hd,arrIncludes:Gd,arrIncludesAll:Kd,arrIncludesSome:Wd,equals:Qd,weakEquals:Yd,inNumberRange:Vo};function Zt(t){return t==null||t===""}const Mb={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:t=>({columnFilters:[],...t}),getDefaultOptions:t=>({onColumnFiltersChange:Ft("columnFilters",t),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(t,a)=>{t.getAutoFilterFn=()=>{const s=a.getCoreRowModel().flatRows[0],o=s==null?void 0:s.getValue(t.id);return typeof o=="string"?bn.includesString:typeof o=="number"?bn.inNumberRange:typeof o=="boolean"||o!==null&&typeof o=="object"?bn.equals:Array.isArray(o)?bn.arrIncludes:bn.weakEquals},t.getFilterFn=()=>{var s,o;return Di(t.columnDef.filterFn)?t.columnDef.filterFn:t.columnDef.filterFn==="auto"?t.getAutoFilterFn():(s=(o=a.options.filterFns)==null?void 0:o[t.columnDef.filterFn])!=null?s:bn[t.columnDef.filterFn]},t.getCanFilter=()=>{var s,o,l;return((s=t.columnDef.enableColumnFilter)!=null?s:!0)&&((o=a.options.enableColumnFilters)!=null?o:!0)&&((l=a.options.enableFilters)!=null?l:!0)&&!!t.accessorFn},t.getIsFiltered=()=>t.getFilterIndex()>-1,t.getFilterValue=()=>{var s;return(s=a.getState().columnFilters)==null||(s=s.find(o=>o.id===t.id))==null?void 0:s.value},t.getFilterIndex=()=>{var s,o;return(s=(o=a.getState().columnFilters)==null?void 0:o.findIndex(l=>l.id===t.id))!=null?s:-1},t.setFilterValue=s=>{a.setColumnFilters(o=>{const l=t.getFilterFn(),d=o==null?void 0:o.find(v=>v.id===t.id),c=Bn(s,d?d.value:void 0);if(Pc(l,c,t)){var m;return(m=o==null?void 0:o.filter(v=>v.id!==t.id))!=null?m:[]}const g={id:t.id,value:c};if(d){var x;return(x=o==null?void 0:o.map(v=>v.id===t.id?g:v))!=null?x:[]}return o!=null&&o.length?[...o,g]:[g]})}},createRow:(t,a)=>{t.columnFilters={},t.columnFiltersMeta={}},createTable:t=>{t.setColumnFilters=a=>{const s=t.getAllLeafColumns(),o=l=>{var d;return(d=Bn(a,l))==null?void 0:d.filter(c=>{const m=s.find(g=>g.id===c.id);if(m){const g=m.getFilterFn();if(Pc(g,c.value,m))return!1}return!0})};t.options.onColumnFiltersChange==null||t.options.onColumnFiltersChange(o)},t.resetColumnFilters=a=>{var s,o;t.setColumnFilters(a?[]:(s=(o=t.initialState)==null?void 0:o.columnFilters)!=null?s:[])},t.getPreFilteredRowModel=()=>t.getCoreRowModel(),t.getFilteredRowModel=()=>(!t._getFilteredRowModel&&t.options.getFilteredRowModel&&(t._getFilteredRowModel=t.options.getFilteredRowModel(t)),t.options.manualFiltering||!t._getFilteredRowModel?t.getPreFilteredRowModel():t._getFilteredRowModel())}};function Pc(t,a,s){return(t&&t.autoRemove?t.autoRemove(a,s):!1)||typeof a>"u"||typeof a=="string"&&!a}const Lb=(t,a,s)=>s.reduce((o,l)=>{const d=l.getValue(t);return o+(typeof d=="number"?d:0)},0),Ob=(t,a,s)=>{let o;return s.forEach(l=>{const d=l.getValue(t);d!=null&&(o>d||o===void 0&&d>=d)&&(o=d)}),o},Pb=(t,a,s)=>{let o;return s.forEach(l=>{const d=l.getValue(t);d!=null&&(o<d||o===void 0&&d>=d)&&(o=d)}),o},qb=(t,a,s)=>{let o,l;return s.forEach(d=>{const c=d.getValue(t);c!=null&&(o===void 0?c>=c&&(o=l=c):(o>c&&(o=c),l<c&&(l=c)))}),[o,l]},kb=(t,a)=>{let s=0,o=0;if(a.forEach(l=>{let d=l.getValue(t);d!=null&&(d=+d)>=d&&(++s,o+=d)}),s)return o/s},$b=(t,a)=>{if(!a.length)return;const s=a.map(d=>d.getValue(t));if(!Eb(s))return;if(s.length===1)return s[0];const o=Math.floor(s.length/2),l=s.sort((d,c)=>d-c);return s.length%2!==0?l[o]:(l[o-1]+l[o])/2},Bb=(t,a)=>Array.from(new Set(a.map(s=>s.getValue(t))).values()),Ub=(t,a)=>new Set(a.map(s=>s.getValue(t))).size,zb=(t,a)=>a.length,uo={sum:Lb,min:Ob,max:Pb,extent:qb,mean:kb,median:$b,unique:Bb,uniqueCount:Ub,count:zb},Vb={getDefaultColumnDef:()=>({aggregatedCell:t=>{var a,s;return(a=(s=t.getValue())==null||s.toString==null?void 0:s.toString())!=null?a:null},aggregationFn:"auto"}),getInitialState:t=>({grouping:[],...t}),getDefaultOptions:t=>({onGroupingChange:Ft("grouping",t),groupedColumnMode:"reorder"}),createColumn:(t,a)=>{t.toggleGrouping=()=>{a.setGrouping(s=>s!=null&&s.includes(t.id)?s.filter(o=>o!==t.id):[...s??[],t.id])},t.getCanGroup=()=>{var s,o;return((s=t.columnDef.enableGrouping)!=null?s:!0)&&((o=a.options.enableGrouping)!=null?o:!0)&&(!!t.accessorFn||!!t.columnDef.getGroupingValue)},t.getIsGrouped=()=>{var s;return(s=a.getState().grouping)==null?void 0:s.includes(t.id)},t.getGroupedIndex=()=>{var s;return(s=a.getState().grouping)==null?void 0:s.indexOf(t.id)},t.getToggleGroupingHandler=()=>{const s=t.getCanGroup();return()=>{s&&t.toggleGrouping()}},t.getAutoAggregationFn=()=>{const s=a.getCoreRowModel().flatRows[0],o=s==null?void 0:s.getValue(t.id);if(typeof o=="number")return uo.sum;if(Object.prototype.toString.call(o)==="[object Date]")return uo.extent},t.getAggregationFn=()=>{var s,o;if(!t)throw new Error;return Di(t.columnDef.aggregationFn)?t.columnDef.aggregationFn:t.columnDef.aggregationFn==="auto"?t.getAutoAggregationFn():(s=(o=a.options.aggregationFns)==null?void 0:o[t.columnDef.aggregationFn])!=null?s:uo[t.columnDef.aggregationFn]}},createTable:t=>{t.setGrouping=a=>t.options.onGroupingChange==null?void 0:t.options.onGroupingChange(a),t.resetGrouping=a=>{var s,o;t.setGrouping(a?[]:(s=(o=t.initialState)==null?void 0:o.grouping)!=null?s:[])},t.getPreGroupedRowModel=()=>t.getFilteredRowModel(),t.getGroupedRowModel=()=>(!t._getGroupedRowModel&&t.options.getGroupedRowModel&&(t._getGroupedRowModel=t.options.getGroupedRowModel(t)),t.options.manualGrouping||!t._getGroupedRowModel?t.getPreGroupedRowModel():t._getGroupedRowModel())},createRow:(t,a)=>{t.getIsGrouped=()=>!!t.groupingColumnId,t.getGroupingValue=s=>{if(t._groupingValuesCache.hasOwnProperty(s))return t._groupingValuesCache[s];const o=a.getColumn(s);return o!=null&&o.columnDef.getGroupingValue?(t._groupingValuesCache[s]=o.columnDef.getGroupingValue(t.original),t._groupingValuesCache[s]):t.getValue(s)},t._groupingValuesCache={}},createCell:(t,a,s,o)=>{t.getIsGrouped=()=>a.getIsGrouped()&&a.id===s.groupingColumnId,t.getIsPlaceholder=()=>!t.getIsGrouped()&&a.getIsGrouped(),t.getIsAggregated=()=>{var l;return!t.getIsGrouped()&&!t.getIsPlaceholder()&&!!((l=s.subRows)!=null&&l.length)}}};function Hb(t,a,s){if(!(a!=null&&a.length)||!s)return t;const o=t.filter(d=>!a.includes(d.id));return s==="remove"?o:[...a.map(d=>t.find(c=>c.id===d)).filter(Boolean),...o]}const Gb={getInitialState:t=>({columnOrder:[],...t}),getDefaultOptions:t=>({onColumnOrderChange:Ft("columnOrder",t)}),createColumn:(t,a)=>{t.getIndex=ee(s=>[cs(a,s)],s=>s.findIndex(o=>o.id===t.id),te(a.options,"debugColumns")),t.getIsFirstColumn=s=>{var o;return((o=cs(a,s)[0])==null?void 0:o.id)===t.id},t.getIsLastColumn=s=>{var o;const l=cs(a,s);return((o=l[l.length-1])==null?void 0:o.id)===t.id}},createTable:t=>{t.setColumnOrder=a=>t.options.onColumnOrderChange==null?void 0:t.options.onColumnOrderChange(a),t.resetColumnOrder=a=>{var s;t.setColumnOrder(a?[]:(s=t.initialState.columnOrder)!=null?s:[])},t._getOrderColumnsFn=ee(()=>[t.getState().columnOrder,t.getState().grouping,t.options.groupedColumnMode],(a,s,o)=>l=>{let d=[];if(!(a!=null&&a.length))d=l;else{const c=[...a],m=[...l];for(;m.length&&c.length;){const g=c.shift(),x=m.findIndex(v=>v.id===g);x>-1&&d.push(m.splice(x,1)[0])}d=[...d,...m]}return Hb(d,s,o)},te(t.options,"debugTable"))}},co=()=>({left:[],right:[]}),Kb={getInitialState:t=>({columnPinning:co(),...t}),getDefaultOptions:t=>({onColumnPinningChange:Ft("columnPinning",t)}),createColumn:(t,a)=>{t.pin=s=>{const o=t.getLeafColumns().map(l=>l.id).filter(Boolean);a.setColumnPinning(l=>{var d,c;if(s==="right"){var m,g;return{left:((m=l==null?void 0:l.left)!=null?m:[]).filter(b=>!(o!=null&&o.includes(b))),right:[...((g=l==null?void 0:l.right)!=null?g:[]).filter(b=>!(o!=null&&o.includes(b))),...o]}}if(s==="left"){var x,v;return{left:[...((x=l==null?void 0:l.left)!=null?x:[]).filter(b=>!(o!=null&&o.includes(b))),...o],right:((v=l==null?void 0:l.right)!=null?v:[]).filter(b=>!(o!=null&&o.includes(b)))}}return{left:((d=l==null?void 0:l.left)!=null?d:[]).filter(b=>!(o!=null&&o.includes(b))),right:((c=l==null?void 0:l.right)!=null?c:[]).filter(b=>!(o!=null&&o.includes(b)))}})},t.getCanPin=()=>t.getLeafColumns().some(o=>{var l,d,c;return((l=o.columnDef.enablePinning)!=null?l:!0)&&((d=(c=a.options.enableColumnPinning)!=null?c:a.options.enablePinning)!=null?d:!0)}),t.getIsPinned=()=>{const s=t.getLeafColumns().map(m=>m.id),{left:o,right:l}=a.getState().columnPinning,d=s.some(m=>o==null?void 0:o.includes(m)),c=s.some(m=>l==null?void 0:l.includes(m));return d?"left":c?"right":!1},t.getPinnedIndex=()=>{var s,o;const l=t.getIsPinned();return l?(s=(o=a.getState().columnPinning)==null||(o=o[l])==null?void 0:o.indexOf(t.id))!=null?s:-1:0}},createRow:(t,a)=>{t.getCenterVisibleCells=ee(()=>[t._getAllVisibleCells(),a.getState().columnPinning.left,a.getState().columnPinning.right],(s,o,l)=>{const d=[...o??[],...l??[]];return s.filter(c=>!d.includes(c.column.id))},te(a.options,"debugRows")),t.getLeftVisibleCells=ee(()=>[t._getAllVisibleCells(),a.getState().columnPinning.left],(s,o)=>(o??[]).map(d=>s.find(c=>c.column.id===d)).filter(Boolean).map(d=>({...d,position:"left"})),te(a.options,"debugRows")),t.getRightVisibleCells=ee(()=>[t._getAllVisibleCells(),a.getState().columnPinning.right],(s,o)=>(o??[]).map(d=>s.find(c=>c.column.id===d)).filter(Boolean).map(d=>({...d,position:"right"})),te(a.options,"debugRows"))},createTable:t=>{t.setColumnPinning=a=>t.options.onColumnPinningChange==null?void 0:t.options.onColumnPinningChange(a),t.resetColumnPinning=a=>{var s,o;return t.setColumnPinning(a?co():(s=(o=t.initialState)==null?void 0:o.columnPinning)!=null?s:co())},t.getIsSomeColumnsPinned=a=>{var s;const o=t.getState().columnPinning;if(!a){var l,d;return!!((l=o.left)!=null&&l.length||(d=o.right)!=null&&d.length)}return!!((s=o[a])!=null&&s.length)},t.getLeftLeafColumns=ee(()=>[t.getAllLeafColumns(),t.getState().columnPinning.left],(a,s)=>(s??[]).map(o=>a.find(l=>l.id===o)).filter(Boolean),te(t.options,"debugColumns")),t.getRightLeafColumns=ee(()=>[t.getAllLeafColumns(),t.getState().columnPinning.right],(a,s)=>(s??[]).map(o=>a.find(l=>l.id===o)).filter(Boolean),te(t.options,"debugColumns")),t.getCenterLeafColumns=ee(()=>[t.getAllLeafColumns(),t.getState().columnPinning.left,t.getState().columnPinning.right],(a,s,o)=>{const l=[...s??[],...o??[]];return a.filter(d=>!l.includes(d.id))},te(t.options,"debugColumns"))}},ui={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},fo=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),Wb={getDefaultColumnDef:()=>ui,getInitialState:t=>({columnSizing:{},columnSizingInfo:fo(),...t}),getDefaultOptions:t=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:Ft("columnSizing",t),onColumnSizingInfoChange:Ft("columnSizingInfo",t)}),createColumn:(t,a)=>{t.getSize=()=>{var s,o,l;const d=a.getState().columnSizing[t.id];return Math.min(Math.max((s=t.columnDef.minSize)!=null?s:ui.minSize,(o=d??t.columnDef.size)!=null?o:ui.size),(l=t.columnDef.maxSize)!=null?l:ui.maxSize)},t.getStart=ee(s=>[s,cs(a,s),a.getState().columnSizing],(s,o)=>o.slice(0,t.getIndex(s)).reduce((l,d)=>l+d.getSize(),0),te(a.options,"debugColumns")),t.getAfter=ee(s=>[s,cs(a,s),a.getState().columnSizing],(s,o)=>o.slice(t.getIndex(s)+1).reduce((l,d)=>l+d.getSize(),0),te(a.options,"debugColumns")),t.resetSize=()=>{a.setColumnSizing(s=>{let{[t.id]:o,...l}=s;return l})},t.getCanResize=()=>{var s,o;return((s=t.columnDef.enableResizing)!=null?s:!0)&&((o=a.options.enableColumnResizing)!=null?o:!0)},t.getIsResizing=()=>a.getState().columnSizingInfo.isResizingColumn===t.id},createHeader:(t,a)=>{t.getSize=()=>{let s=0;const o=l=>{if(l.subHeaders.length)l.subHeaders.forEach(o);else{var d;s+=(d=l.column.getSize())!=null?d:0}};return o(t),s},t.getStart=()=>{if(t.index>0){const s=t.headerGroup.headers[t.index-1];return s.getStart()+s.getSize()}return 0},t.getResizeHandler=s=>{const o=a.getColumn(t.column.id),l=o==null?void 0:o.getCanResize();return d=>{if(!o||!l||(d.persist==null||d.persist(),mo(d)&&d.touches&&d.touches.length>1))return;const c=t.getSize(),m=t?t.getLeafHeaders().map(L=>[L.column.id,L.column.getSize()]):[[o.id,o.getSize()]],g=mo(d)?Math.round(d.touches[0].clientX):d.clientX,x={},v=(L,A)=>{typeof A=="number"&&(a.setColumnSizingInfo(E=>{var T,q;const Y=a.options.columnResizeDirection==="rtl"?-1:1,H=(A-((T=E==null?void 0:E.startOffset)!=null?T:0))*Y,ce=Math.max(H/((q=E==null?void 0:E.startSize)!=null?q:0),-.999999);return E.columnSizingStart.forEach(pe=>{let[le,fe]=pe;x[le]=Math.round(Math.max(fe+fe*ce,0)*100)/100}),{...E,deltaOffset:H,deltaPercentage:ce}}),(a.options.columnResizeMode==="onChange"||L==="end")&&a.setColumnSizing(E=>({...E,...x})))},b=L=>v("move",L),j=L=>{v("end",L),a.setColumnSizingInfo(A=>({...A,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},_=s||typeof document<"u"?document:null,N={moveHandler:L=>b(L.clientX),upHandler:L=>{_==null||_.removeEventListener("mousemove",N.moveHandler),_==null||_.removeEventListener("mouseup",N.upHandler),j(L.clientX)}},I={moveHandler:L=>(L.cancelable&&(L.preventDefault(),L.stopPropagation()),b(L.touches[0].clientX),!1),upHandler:L=>{var A;_==null||_.removeEventListener("touchmove",I.moveHandler),_==null||_.removeEventListener("touchend",I.upHandler),L.cancelable&&(L.preventDefault(),L.stopPropagation()),j((A=L.touches[0])==null?void 0:A.clientX)}},$=Qb()?{passive:!1}:!1;mo(d)?(_==null||_.addEventListener("touchmove",I.moveHandler,$),_==null||_.addEventListener("touchend",I.upHandler,$)):(_==null||_.addEventListener("mousemove",N.moveHandler,$),_==null||_.addEventListener("mouseup",N.upHandler,$)),a.setColumnSizingInfo(L=>({...L,startOffset:g,startSize:c,deltaOffset:0,deltaPercentage:0,columnSizingStart:m,isResizingColumn:o.id}))}}},createTable:t=>{t.setColumnSizing=a=>t.options.onColumnSizingChange==null?void 0:t.options.onColumnSizingChange(a),t.setColumnSizingInfo=a=>t.options.onColumnSizingInfoChange==null?void 0:t.options.onColumnSizingInfoChange(a),t.resetColumnSizing=a=>{var s;t.setColumnSizing(a?{}:(s=t.initialState.columnSizing)!=null?s:{})},t.resetHeaderSizeInfo=a=>{var s;t.setColumnSizingInfo(a?fo():(s=t.initialState.columnSizingInfo)!=null?s:fo())},t.getTotalSize=()=>{var a,s;return(a=(s=t.getHeaderGroups()[0])==null?void 0:s.headers.reduce((o,l)=>o+l.getSize(),0))!=null?a:0},t.getLeftTotalSize=()=>{var a,s;return(a=(s=t.getLeftHeaderGroups()[0])==null?void 0:s.headers.reduce((o,l)=>o+l.getSize(),0))!=null?a:0},t.getCenterTotalSize=()=>{var a,s;return(a=(s=t.getCenterHeaderGroups()[0])==null?void 0:s.headers.reduce((o,l)=>o+l.getSize(),0))!=null?a:0},t.getRightTotalSize=()=>{var a,s;return(a=(s=t.getRightHeaderGroups()[0])==null?void 0:s.headers.reduce((o,l)=>o+l.getSize(),0))!=null?a:0}}};let ci=null;function Qb(){if(typeof ci=="boolean")return ci;let t=!1;try{const a={get passive(){return t=!0,!1}},s=()=>{};window.addEventListener("test",s,a),window.removeEventListener("test",s)}catch{t=!1}return ci=t,ci}function mo(t){return t.type==="touchstart"}const Yb={getInitialState:t=>({columnVisibility:{},...t}),getDefaultOptions:t=>({onColumnVisibilityChange:Ft("columnVisibility",t)}),createColumn:(t,a)=>{t.toggleVisibility=s=>{t.getCanHide()&&a.setColumnVisibility(o=>({...o,[t.id]:s??!t.getIsVisible()}))},t.getIsVisible=()=>{var s,o;const l=t.columns;return(s=l.length?l.some(d=>d.getIsVisible()):(o=a.getState().columnVisibility)==null?void 0:o[t.id])!=null?s:!0},t.getCanHide=()=>{var s,o;return((s=t.columnDef.enableHiding)!=null?s:!0)&&((o=a.options.enableHiding)!=null?o:!0)},t.getToggleVisibilityHandler=()=>s=>{t.toggleVisibility==null||t.toggleVisibility(s.target.checked)}},createRow:(t,a)=>{t._getAllVisibleCells=ee(()=>[t.getAllCells(),a.getState().columnVisibility],s=>s.filter(o=>o.column.getIsVisible()),te(a.options,"debugRows")),t.getVisibleCells=ee(()=>[t.getLeftVisibleCells(),t.getCenterVisibleCells(),t.getRightVisibleCells()],(s,o,l)=>[...s,...o,...l],te(a.options,"debugRows"))},createTable:t=>{const a=(s,o)=>ee(()=>[o(),o().filter(l=>l.getIsVisible()).map(l=>l.id).join("_")],l=>l.filter(d=>d.getIsVisible==null?void 0:d.getIsVisible()),te(t.options,"debugColumns"));t.getVisibleFlatColumns=a("getVisibleFlatColumns",()=>t.getAllFlatColumns()),t.getVisibleLeafColumns=a("getVisibleLeafColumns",()=>t.getAllLeafColumns()),t.getLeftVisibleLeafColumns=a("getLeftVisibleLeafColumns",()=>t.getLeftLeafColumns()),t.getRightVisibleLeafColumns=a("getRightVisibleLeafColumns",()=>t.getRightLeafColumns()),t.getCenterVisibleLeafColumns=a("getCenterVisibleLeafColumns",()=>t.getCenterLeafColumns()),t.setColumnVisibility=s=>t.options.onColumnVisibilityChange==null?void 0:t.options.onColumnVisibilityChange(s),t.resetColumnVisibility=s=>{var o;t.setColumnVisibility(s?{}:(o=t.initialState.columnVisibility)!=null?o:{})},t.toggleAllColumnsVisible=s=>{var o;s=(o=s)!=null?o:!t.getIsAllColumnsVisible(),t.setColumnVisibility(t.getAllLeafColumns().reduce((l,d)=>({...l,[d.id]:s||!(d.getCanHide!=null&&d.getCanHide())}),{}))},t.getIsAllColumnsVisible=()=>!t.getAllLeafColumns().some(s=>!(s.getIsVisible!=null&&s.getIsVisible())),t.getIsSomeColumnsVisible=()=>t.getAllLeafColumns().some(s=>s.getIsVisible==null?void 0:s.getIsVisible()),t.getToggleAllColumnsVisibilityHandler=()=>s=>{var o;t.toggleAllColumnsVisible((o=s.target)==null?void 0:o.checked)}}};function cs(t,a){return a?a==="center"?t.getCenterVisibleLeafColumns():a==="left"?t.getLeftVisibleLeafColumns():t.getRightVisibleLeafColumns():t.getVisibleLeafColumns()}const Xb={createTable:t=>{t._getGlobalFacetedRowModel=t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,"__global__"),t.getGlobalFacetedRowModel=()=>t.options.manualFiltering||!t._getGlobalFacetedRowModel?t.getPreFilteredRowModel():t._getGlobalFacetedRowModel(),t._getGlobalFacetedUniqueValues=t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,"__global__"),t.getGlobalFacetedUniqueValues=()=>t._getGlobalFacetedUniqueValues?t._getGlobalFacetedUniqueValues():new Map,t._getGlobalFacetedMinMaxValues=t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,"__global__"),t.getGlobalFacetedMinMaxValues=()=>{if(t._getGlobalFacetedMinMaxValues)return t._getGlobalFacetedMinMaxValues()}}},Zb={getInitialState:t=>({globalFilter:void 0,...t}),getDefaultOptions:t=>({onGlobalFilterChange:Ft("globalFilter",t),globalFilterFn:"auto",getColumnCanGlobalFilter:a=>{var s;const o=(s=t.getCoreRowModel().flatRows[0])==null||(s=s._getAllCellsByColumnId()[a.id])==null?void 0:s.getValue();return typeof o=="string"||typeof o=="number"}}),createColumn:(t,a)=>{t.getCanGlobalFilter=()=>{var s,o,l,d;return((s=t.columnDef.enableGlobalFilter)!=null?s:!0)&&((o=a.options.enableGlobalFilter)!=null?o:!0)&&((l=a.options.enableFilters)!=null?l:!0)&&((d=a.options.getColumnCanGlobalFilter==null?void 0:a.options.getColumnCanGlobalFilter(t))!=null?d:!0)&&!!t.accessorFn}},createTable:t=>{t.getGlobalAutoFilterFn=()=>bn.includesString,t.getGlobalFilterFn=()=>{var a,s;const{globalFilterFn:o}=t.options;return Di(o)?o:o==="auto"?t.getGlobalAutoFilterFn():(a=(s=t.options.filterFns)==null?void 0:s[o])!=null?a:bn[o]},t.setGlobalFilter=a=>{t.options.onGlobalFilterChange==null||t.options.onGlobalFilterChange(a)},t.resetGlobalFilter=a=>{t.setGlobalFilter(a?void 0:t.initialState.globalFilter)}}},Jb={getInitialState:t=>({expanded:{},...t}),getDefaultOptions:t=>({onExpandedChange:Ft("expanded",t),paginateExpandedRows:!0}),createTable:t=>{let a=!1,s=!1;t._autoResetExpanded=()=>{var o,l;if(!a){t._queue(()=>{a=!0});return}if((o=(l=t.options.autoResetAll)!=null?l:t.options.autoResetExpanded)!=null?o:!t.options.manualExpanding){if(s)return;s=!0,t._queue(()=>{t.resetExpanded(),s=!1})}},t.setExpanded=o=>t.options.onExpandedChange==null?void 0:t.options.onExpandedChange(o),t.toggleAllRowsExpanded=o=>{o??!t.getIsAllRowsExpanded()?t.setExpanded(!0):t.setExpanded({})},t.resetExpanded=o=>{var l,d;t.setExpanded(o?{}:(l=(d=t.initialState)==null?void 0:d.expanded)!=null?l:{})},t.getCanSomeRowsExpand=()=>t.getPrePaginationRowModel().flatRows.some(o=>o.getCanExpand()),t.getToggleAllRowsExpandedHandler=()=>o=>{o.persist==null||o.persist(),t.toggleAllRowsExpanded()},t.getIsSomeRowsExpanded=()=>{const o=t.getState().expanded;return o===!0||Object.values(o).some(Boolean)},t.getIsAllRowsExpanded=()=>{const o=t.getState().expanded;return typeof o=="boolean"?o===!0:!(!Object.keys(o).length||t.getRowModel().flatRows.some(l=>!l.getIsExpanded()))},t.getExpandedDepth=()=>{let o=0;return(t.getState().expanded===!0?Object.keys(t.getRowModel().rowsById):Object.keys(t.getState().expanded)).forEach(d=>{const c=d.split(".");o=Math.max(o,c.length)}),o},t.getPreExpandedRowModel=()=>t.getSortedRowModel(),t.getExpandedRowModel=()=>(!t._getExpandedRowModel&&t.options.getExpandedRowModel&&(t._getExpandedRowModel=t.options.getExpandedRowModel(t)),t.options.manualExpanding||!t._getExpandedRowModel?t.getPreExpandedRowModel():t._getExpandedRowModel())},createRow:(t,a)=>{t.toggleExpanded=s=>{a.setExpanded(o=>{var l;const d=o===!0?!0:!!(o!=null&&o[t.id]);let c={};if(o===!0?Object.keys(a.getRowModel().rowsById).forEach(m=>{c[m]=!0}):c=o,s=(l=s)!=null?l:!d,!d&&s)return{...c,[t.id]:!0};if(d&&!s){const{[t.id]:m,...g}=c;return g}return o})},t.getIsExpanded=()=>{var s;const o=a.getState().expanded;return!!((s=a.options.getIsRowExpanded==null?void 0:a.options.getIsRowExpanded(t))!=null?s:o===!0||o!=null&&o[t.id])},t.getCanExpand=()=>{var s,o,l;return(s=a.options.getRowCanExpand==null?void 0:a.options.getRowCanExpand(t))!=null?s:((o=a.options.enableExpanding)!=null?o:!0)&&!!((l=t.subRows)!=null&&l.length)},t.getIsAllParentsExpanded=()=>{let s=!0,o=t;for(;s&&o.parentId;)o=a.getRow(o.parentId,!0),s=o.getIsExpanded();return s},t.getToggleExpandedHandler=()=>{const s=t.getCanExpand();return()=>{s&&t.toggleExpanded()}}}},Co=0,So=10,go=()=>({pageIndex:Co,pageSize:So}),ew={getInitialState:t=>({...t,pagination:{...go(),...t==null?void 0:t.pagination}}),getDefaultOptions:t=>({onPaginationChange:Ft("pagination",t)}),createTable:t=>{let a=!1,s=!1;t._autoResetPageIndex=()=>{var o,l;if(!a){t._queue(()=>{a=!0});return}if((o=(l=t.options.autoResetAll)!=null?l:t.options.autoResetPageIndex)!=null?o:!t.options.manualPagination){if(s)return;s=!0,t._queue(()=>{t.resetPageIndex(),s=!1})}},t.setPagination=o=>{const l=d=>Bn(o,d);return t.options.onPaginationChange==null?void 0:t.options.onPaginationChange(l)},t.resetPagination=o=>{var l;t.setPagination(o?go():(l=t.initialState.pagination)!=null?l:go())},t.setPageIndex=o=>{t.setPagination(l=>{let d=Bn(o,l.pageIndex);const c=typeof t.options.pageCount>"u"||t.options.pageCount===-1?Number.MAX_SAFE_INTEGER:t.options.pageCount-1;return d=Math.max(0,Math.min(d,c)),{...l,pageIndex:d}})},t.resetPageIndex=o=>{var l,d;t.setPageIndex(o?Co:(l=(d=t.initialState)==null||(d=d.pagination)==null?void 0:d.pageIndex)!=null?l:Co)},t.resetPageSize=o=>{var l,d;t.setPageSize(o?So:(l=(d=t.initialState)==null||(d=d.pagination)==null?void 0:d.pageSize)!=null?l:So)},t.setPageSize=o=>{t.setPagination(l=>{const d=Math.max(1,Bn(o,l.pageSize)),c=l.pageSize*l.pageIndex,m=Math.floor(c/d);return{...l,pageIndex:m,pageSize:d}})},t.setPageCount=o=>t.setPagination(l=>{var d;let c=Bn(o,(d=t.options.pageCount)!=null?d:-1);return typeof c=="number"&&(c=Math.max(-1,c)),{...l,pageCount:c}}),t.getPageOptions=ee(()=>[t.getPageCount()],o=>{let l=[];return o&&o>0&&(l=[...new Array(o)].fill(null).map((d,c)=>c)),l},te(t.options,"debugTable")),t.getCanPreviousPage=()=>t.getState().pagination.pageIndex>0,t.getCanNextPage=()=>{const{pageIndex:o}=t.getState().pagination,l=t.getPageCount();return l===-1?!0:l===0?!1:o<l-1},t.previousPage=()=>t.setPageIndex(o=>o-1),t.nextPage=()=>t.setPageIndex(o=>o+1),t.firstPage=()=>t.setPageIndex(0),t.lastPage=()=>t.setPageIndex(t.getPageCount()-1),t.getPrePaginationRowModel=()=>t.getExpandedRowModel(),t.getPaginationRowModel=()=>(!t._getPaginationRowModel&&t.options.getPaginationRowModel&&(t._getPaginationRowModel=t.options.getPaginationRowModel(t)),t.options.manualPagination||!t._getPaginationRowModel?t.getPrePaginationRowModel():t._getPaginationRowModel()),t.getPageCount=()=>{var o;return(o=t.options.pageCount)!=null?o:Math.ceil(t.getRowCount()/t.getState().pagination.pageSize)},t.getRowCount=()=>{var o;return(o=t.options.rowCount)!=null?o:t.getPrePaginationRowModel().rows.length}}},ho=()=>({top:[],bottom:[]}),tw={getInitialState:t=>({rowPinning:ho(),...t}),getDefaultOptions:t=>({onRowPinningChange:Ft("rowPinning",t)}),createRow:(t,a)=>{t.pin=(s,o,l)=>{const d=o?t.getLeafRows().map(g=>{let{id:x}=g;return x}):[],c=l?t.getParentRows().map(g=>{let{id:x}=g;return x}):[],m=new Set([...c,t.id,...d]);a.setRowPinning(g=>{var x,v;if(s==="bottom"){var b,j;return{top:((b=g==null?void 0:g.top)!=null?b:[]).filter(I=>!(m!=null&&m.has(I))),bottom:[...((j=g==null?void 0:g.bottom)!=null?j:[]).filter(I=>!(m!=null&&m.has(I))),...Array.from(m)]}}if(s==="top"){var _,N;return{top:[...((_=g==null?void 0:g.top)!=null?_:[]).filter(I=>!(m!=null&&m.has(I))),...Array.from(m)],bottom:((N=g==null?void 0:g.bottom)!=null?N:[]).filter(I=>!(m!=null&&m.has(I)))}}return{top:((x=g==null?void 0:g.top)!=null?x:[]).filter(I=>!(m!=null&&m.has(I))),bottom:((v=g==null?void 0:g.bottom)!=null?v:[]).filter(I=>!(m!=null&&m.has(I)))}})},t.getCanPin=()=>{var s;const{enableRowPinning:o,enablePinning:l}=a.options;return typeof o=="function"?o(t):(s=o??l)!=null?s:!0},t.getIsPinned=()=>{const s=[t.id],{top:o,bottom:l}=a.getState().rowPinning,d=s.some(m=>o==null?void 0:o.includes(m)),c=s.some(m=>l==null?void 0:l.includes(m));return d?"top":c?"bottom":!1},t.getPinnedIndex=()=>{var s,o;const l=t.getIsPinned();if(!l)return-1;const d=(s=l==="top"?a.getTopRows():a.getBottomRows())==null?void 0:s.map(c=>{let{id:m}=c;return m});return(o=d==null?void 0:d.indexOf(t.id))!=null?o:-1}},createTable:t=>{t.setRowPinning=a=>t.options.onRowPinningChange==null?void 0:t.options.onRowPinningChange(a),t.resetRowPinning=a=>{var s,o;return t.setRowPinning(a?ho():(s=(o=t.initialState)==null?void 0:o.rowPinning)!=null?s:ho())},t.getIsSomeRowsPinned=a=>{var s;const o=t.getState().rowPinning;if(!a){var l,d;return!!((l=o.top)!=null&&l.length||(d=o.bottom)!=null&&d.length)}return!!((s=o[a])!=null&&s.length)},t._getPinnedRows=(a,s,o)=>{var l;return((l=t.options.keepPinnedRows)==null||l?(s??[]).map(c=>{const m=t.getRow(c,!0);return m.getIsAllParentsExpanded()?m:null}):(s??[]).map(c=>a.find(m=>m.id===c))).filter(Boolean).map(c=>({...c,position:o}))},t.getTopRows=ee(()=>[t.getRowModel().rows,t.getState().rowPinning.top],(a,s)=>t._getPinnedRows(a,s,"top"),te(t.options,"debugRows")),t.getBottomRows=ee(()=>[t.getRowModel().rows,t.getState().rowPinning.bottom],(a,s)=>t._getPinnedRows(a,s,"bottom"),te(t.options,"debugRows")),t.getCenterRows=ee(()=>[t.getRowModel().rows,t.getState().rowPinning.top,t.getState().rowPinning.bottom],(a,s,o)=>{const l=new Set([...s??[],...o??[]]);return a.filter(d=>!l.has(d.id))},te(t.options,"debugRows"))}},nw={getInitialState:t=>({rowSelection:{},...t}),getDefaultOptions:t=>({onRowSelectionChange:Ft("rowSelection",t),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:t=>{t.setRowSelection=a=>t.options.onRowSelectionChange==null?void 0:t.options.onRowSelectionChange(a),t.resetRowSelection=a=>{var s;return t.setRowSelection(a?{}:(s=t.initialState.rowSelection)!=null?s:{})},t.toggleAllRowsSelected=a=>{t.setRowSelection(s=>{a=typeof a<"u"?a:!t.getIsAllRowsSelected();const o={...s},l=t.getPreGroupedRowModel().flatRows;return a?l.forEach(d=>{d.getCanSelect()&&(o[d.id]=!0)}):l.forEach(d=>{delete o[d.id]}),o})},t.toggleAllPageRowsSelected=a=>t.setRowSelection(s=>{const o=typeof a<"u"?a:!t.getIsAllPageRowsSelected(),l={...s};return t.getRowModel().rows.forEach(d=>{No(l,d.id,o,!0,t)}),l}),t.getPreSelectedRowModel=()=>t.getCoreRowModel(),t.getSelectedRowModel=ee(()=>[t.getState().rowSelection,t.getCoreRowModel()],(a,s)=>Object.keys(a).length?po(t,s):{rows:[],flatRows:[],rowsById:{}},te(t.options,"debugTable")),t.getFilteredSelectedRowModel=ee(()=>[t.getState().rowSelection,t.getFilteredRowModel()],(a,s)=>Object.keys(a).length?po(t,s):{rows:[],flatRows:[],rowsById:{}},te(t.options,"debugTable")),t.getGroupedSelectedRowModel=ee(()=>[t.getState().rowSelection,t.getSortedRowModel()],(a,s)=>Object.keys(a).length?po(t,s):{rows:[],flatRows:[],rowsById:{}},te(t.options,"debugTable")),t.getIsAllRowsSelected=()=>{const a=t.getFilteredRowModel().flatRows,{rowSelection:s}=t.getState();let o=!!(a.length&&Object.keys(s).length);return o&&a.some(l=>l.getCanSelect()&&!s[l.id])&&(o=!1),o},t.getIsAllPageRowsSelected=()=>{const a=t.getPaginationRowModel().flatRows.filter(l=>l.getCanSelect()),{rowSelection:s}=t.getState();let o=!!a.length;return o&&a.some(l=>!s[l.id])&&(o=!1),o},t.getIsSomeRowsSelected=()=>{var a;const s=Object.keys((a=t.getState().rowSelection)!=null?a:{}).length;return s>0&&s<t.getFilteredRowModel().flatRows.length},t.getIsSomePageRowsSelected=()=>{const a=t.getPaginationRowModel().flatRows;return t.getIsAllPageRowsSelected()?!1:a.filter(s=>s.getCanSelect()).some(s=>s.getIsSelected()||s.getIsSomeSelected())},t.getToggleAllRowsSelectedHandler=()=>a=>{t.toggleAllRowsSelected(a.target.checked)},t.getToggleAllPageRowsSelectedHandler=()=>a=>{t.toggleAllPageRowsSelected(a.target.checked)}},createRow:(t,a)=>{t.toggleSelected=(s,o)=>{const l=t.getIsSelected();a.setRowSelection(d=>{var c;if(s=typeof s<"u"?s:!l,t.getCanSelect()&&l===s)return d;const m={...d};return No(m,t.id,s,(c=o==null?void 0:o.selectChildren)!=null?c:!0,a),m})},t.getIsSelected=()=>{const{rowSelection:s}=a.getState();return Ho(t,s)},t.getIsSomeSelected=()=>{const{rowSelection:s}=a.getState();return Ro(t,s)==="some"},t.getIsAllSubRowsSelected=()=>{const{rowSelection:s}=a.getState();return Ro(t,s)==="all"},t.getCanSelect=()=>{var s;return typeof a.options.enableRowSelection=="function"?a.options.enableRowSelection(t):(s=a.options.enableRowSelection)!=null?s:!0},t.getCanSelectSubRows=()=>{var s;return typeof a.options.enableSubRowSelection=="function"?a.options.enableSubRowSelection(t):(s=a.options.enableSubRowSelection)!=null?s:!0},t.getCanMultiSelect=()=>{var s;return typeof a.options.enableMultiRowSelection=="function"?a.options.enableMultiRowSelection(t):(s=a.options.enableMultiRowSelection)!=null?s:!0},t.getToggleSelectedHandler=()=>{const s=t.getCanSelect();return o=>{var l;s&&t.toggleSelected((l=o.target)==null?void 0:l.checked)}}}},No=(t,a,s,o,l)=>{var d;const c=l.getRow(a,!0);s?(c.getCanMultiSelect()||Object.keys(t).forEach(m=>delete t[m]),c.getCanSelect()&&(t[a]=!0)):delete t[a],o&&(d=c.subRows)!=null&&d.length&&c.getCanSelectSubRows()&&c.subRows.forEach(m=>No(t,m.id,s,o,l))};function po(t,a){const s=t.getState().rowSelection,o=[],l={},d=function(c,m){return c.map(g=>{var x;const v=Ho(g,s);if(v&&(o.push(g),l[g.id]=g),(x=g.subRows)!=null&&x.length&&(g={...g,subRows:d(g.subRows)}),v)return g}).filter(Boolean)};return{rows:d(a.rows),flatRows:o,rowsById:l}}function Ho(t,a){var s;return(s=a[t.id])!=null?s:!1}function Ro(t,a,s){var o;if(!((o=t.subRows)!=null&&o.length))return!1;let l=!0,d=!1;return t.subRows.forEach(c=>{if(!(d&&!l)&&(c.getCanSelect()&&(Ho(c,a)?d=!0:l=!1),c.subRows&&c.subRows.length)){const m=Ro(c,a);m==="all"?d=!0:(m==="some"&&(d=!0),l=!1)}}),l?"all":d?"some":!1}const Eo=/([0-9]+)/gm,rw=(t,a,s)=>Xd(Wn(t.getValue(s)).toLowerCase(),Wn(a.getValue(s)).toLowerCase()),sw=(t,a,s)=>Xd(Wn(t.getValue(s)),Wn(a.getValue(s))),iw=(t,a,s)=>Go(Wn(t.getValue(s)).toLowerCase(),Wn(a.getValue(s)).toLowerCase()),aw=(t,a,s)=>Go(Wn(t.getValue(s)),Wn(a.getValue(s))),ow=(t,a,s)=>{const o=t.getValue(s),l=a.getValue(s);return o>l?1:o<l?-1:0},lw=(t,a,s)=>Go(t.getValue(s),a.getValue(s));function Go(t,a){return t===a?0:t>a?1:-1}function Wn(t){return typeof t=="number"?isNaN(t)||t===1/0||t===-1/0?"":String(t):typeof t=="string"?t:""}function Xd(t,a){const s=t.split(Eo).filter(Boolean),o=a.split(Eo).filter(Boolean);for(;s.length&&o.length;){const l=s.shift(),d=o.shift(),c=parseInt(l,10),m=parseInt(d,10),g=[c,m].sort();if(isNaN(g[0])){if(l>d)return 1;if(d>l)return-1;continue}if(isNaN(g[1]))return isNaN(c)?-1:1;if(c>m)return 1;if(m>c)return-1}return s.length-o.length}const os={alphanumeric:rw,alphanumericCaseSensitive:sw,text:iw,textCaseSensitive:aw,datetime:ow,basic:lw},uw={getInitialState:t=>({sorting:[],...t}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:t=>({onSortingChange:Ft("sorting",t),isMultiSortEvent:a=>a.shiftKey}),createColumn:(t,a)=>{t.getAutoSortingFn=()=>{const s=a.getFilteredRowModel().flatRows.slice(10);let o=!1;for(const l of s){const d=l==null?void 0:l.getValue(t.id);if(Object.prototype.toString.call(d)==="[object Date]")return os.datetime;if(typeof d=="string"&&(o=!0,d.split(Eo).length>1))return os.alphanumeric}return o?os.text:os.basic},t.getAutoSortDir=()=>{const s=a.getFilteredRowModel().flatRows[0];return typeof(s==null?void 0:s.getValue(t.id))=="string"?"asc":"desc"},t.getSortingFn=()=>{var s,o;if(!t)throw new Error;return Di(t.columnDef.sortingFn)?t.columnDef.sortingFn:t.columnDef.sortingFn==="auto"?t.getAutoSortingFn():(s=(o=a.options.sortingFns)==null?void 0:o[t.columnDef.sortingFn])!=null?s:os[t.columnDef.sortingFn]},t.toggleSorting=(s,o)=>{const l=t.getNextSortingOrder(),d=typeof s<"u"&&s!==null;a.setSorting(c=>{const m=c==null?void 0:c.find(_=>_.id===t.id),g=c==null?void 0:c.findIndex(_=>_.id===t.id);let x=[],v,b=d?s:l==="desc";if(c!=null&&c.length&&t.getCanMultiSort()&&o?m?v="toggle":v="add":c!=null&&c.length&&g!==c.length-1?v="replace":m?v="toggle":v="replace",v==="toggle"&&(d||l||(v="remove")),v==="add"){var j;x=[...c,{id:t.id,desc:b}],x.splice(0,x.length-((j=a.options.maxMultiSortColCount)!=null?j:Number.MAX_SAFE_INTEGER))}else v==="toggle"?x=c.map(_=>_.id===t.id?{..._,desc:b}:_):v==="remove"?x=c.filter(_=>_.id!==t.id):x=[{id:t.id,desc:b}];return x})},t.getFirstSortDir=()=>{var s,o;return((s=(o=t.columnDef.sortDescFirst)!=null?o:a.options.sortDescFirst)!=null?s:t.getAutoSortDir()==="desc")?"desc":"asc"},t.getNextSortingOrder=s=>{var o,l;const d=t.getFirstSortDir(),c=t.getIsSorted();return c?c!==d&&((o=a.options.enableSortingRemoval)==null||o)&&(!(s&&(l=a.options.enableMultiRemove)!=null)||l)?!1:c==="desc"?"asc":"desc":d},t.getCanSort=()=>{var s,o;return((s=t.columnDef.enableSorting)!=null?s:!0)&&((o=a.options.enableSorting)!=null?o:!0)&&!!t.accessorFn},t.getCanMultiSort=()=>{var s,o;return(s=(o=t.columnDef.enableMultiSort)!=null?o:a.options.enableMultiSort)!=null?s:!!t.accessorFn},t.getIsSorted=()=>{var s;const o=(s=a.getState().sorting)==null?void 0:s.find(l=>l.id===t.id);return o?o.desc?"desc":"asc":!1},t.getSortIndex=()=>{var s,o;return(s=(o=a.getState().sorting)==null?void 0:o.findIndex(l=>l.id===t.id))!=null?s:-1},t.clearSorting=()=>{a.setSorting(s=>s!=null&&s.length?s.filter(o=>o.id!==t.id):[])},t.getToggleSortingHandler=()=>{const s=t.getCanSort();return o=>{s&&(o.persist==null||o.persist(),t.toggleSorting==null||t.toggleSorting(void 0,t.getCanMultiSort()?a.options.isMultiSortEvent==null?void 0:a.options.isMultiSortEvent(o):!1))}}},createTable:t=>{t.setSorting=a=>t.options.onSortingChange==null?void 0:t.options.onSortingChange(a),t.resetSorting=a=>{var s,o;t.setSorting(a?[]:(s=(o=t.initialState)==null?void 0:o.sorting)!=null?s:[])},t.getPreSortedRowModel=()=>t.getGroupedRowModel(),t.getSortedRowModel=()=>(!t._getSortedRowModel&&t.options.getSortedRowModel&&(t._getSortedRowModel=t.options.getSortedRowModel(t)),t.options.manualSorting||!t._getSortedRowModel?t.getPreSortedRowModel():t._getSortedRowModel())}},cw=[Db,Yb,Gb,Kb,Tb,Mb,Xb,Zb,uw,Vb,Jb,ew,tw,nw,Wb];function dw(t){var a,s;const o=[...cw,...(a=t._features)!=null?a:[]];let l={_features:o};const d=l._features.reduce((j,_)=>Object.assign(j,_.getDefaultOptions==null?void 0:_.getDefaultOptions(l)),{}),c=j=>l.options.mergeOptions?l.options.mergeOptions(d,j):{...d,...j};let g={...{},...(s=t.initialState)!=null?s:{}};l._features.forEach(j=>{var _;g=(_=j.getInitialState==null?void 0:j.getInitialState(g))!=null?_:g});const x=[];let v=!1;const b={_features:o,options:{...d,...t},initialState:g,_queue:j=>{x.push(j),v||(v=!0,Promise.resolve().then(()=>{for(;x.length;)x.shift()();v=!1}).catch(_=>setTimeout(()=>{throw _})))},reset:()=>{l.setState(l.initialState)},setOptions:j=>{const _=Bn(j,l.options);l.options=c(_)},getState:()=>l.options.state,setState:j=>{l.options.onStateChange==null||l.options.onStateChange(j)},_getRowId:(j,_,N)=>{var I;return(I=l.options.getRowId==null?void 0:l.options.getRowId(j,_,N))!=null?I:`${N?[N.id,_].join("."):_}`},getCoreRowModel:()=>(l._getCoreRowModel||(l._getCoreRowModel=l.options.getCoreRowModel(l)),l._getCoreRowModel()),getRowModel:()=>l.getPaginationRowModel(),getRow:(j,_)=>{let N=(_?l.getPrePaginationRowModel():l.getRowModel()).rowsById[j];if(!N&&(N=l.getCoreRowModel().rowsById[j],!N))throw new Error;return N},_getDefaultColumnDef:ee(()=>[l.options.defaultColumn],j=>{var _;return j=(_=j)!=null?_:{},{header:N=>{const I=N.header.column.columnDef;return I.accessorKey?I.accessorKey:I.accessorFn?I.id:null},cell:N=>{var I,$;return(I=($=N.renderValue())==null||$.toString==null?void 0:$.toString())!=null?I:null},...l._features.reduce((N,I)=>Object.assign(N,I.getDefaultColumnDef==null?void 0:I.getDefaultColumnDef()),{}),...j}},te(t,"debugColumns")),_getColumnDefs:()=>l.options.columns,getAllColumns:ee(()=>[l._getColumnDefs()],j=>{const _=function(N,I,$){return $===void 0&&($=0),N.map(L=>{const A=Fb(l,L,$,I),E=L;return A.columns=E.columns?_(E.columns,A,$+1):[],A})};return _(j)},te(t,"debugColumns")),getAllFlatColumns:ee(()=>[l.getAllColumns()],j=>j.flatMap(_=>_.getFlatColumns()),te(t,"debugColumns")),_getAllFlatColumnsById:ee(()=>[l.getAllFlatColumns()],j=>j.reduce((_,N)=>(_[N.id]=N,_),{}),te(t,"debugColumns")),getAllLeafColumns:ee(()=>[l.getAllColumns(),l._getOrderColumnsFn()],(j,_)=>{let N=j.flatMap(I=>I.getLeafColumns());return _(N)},te(t,"debugColumns")),getColumn:j=>l._getAllFlatColumnsById()[j]};Object.assign(l,b);for(let j=0;j<l._features.length;j++){const _=l._features[j];_==null||_.createTable==null||_.createTable(l)}return l}function Ko(){return t=>ee(()=>[t.options.data],a=>{const s={rows:[],flatRows:[],rowsById:{}},o=function(l,d,c){d===void 0&&(d=0);const m=[];for(let x=0;x<l.length;x++){const v=zo(t,t._getRowId(l[x],x,c),l[x],x,d,void 0,c==null?void 0:c.id);if(s.flatRows.push(v),s.rowsById[v.id]=v,m.push(v),t.options.getSubRows){var g;v.originalSubRows=t.options.getSubRows(l[x],x),(g=v.originalSubRows)!=null&&g.length&&(v.subRows=o(v.originalSubRows,d+1,v))}}return m};return s.rows=o(a),s},te(t.options,"debugTable","getRowModel",()=>t._autoResetPageIndex()))}function Zd(t,a,s){return s.options.filterFromLeafRows?fw(t,a,s):mw(t,a,s)}function fw(t,a,s){var o;const l=[],d={},c=(o=s.options.maxLeafRowFilterDepth)!=null?o:100,m=function(g,x){x===void 0&&(x=0);const v=[];for(let j=0;j<g.length;j++){var b;let _=g[j];const N=zo(s,_.id,_.original,_.index,_.depth,void 0,_.parentId);if(N.columnFilters=_.columnFilters,(b=_.subRows)!=null&&b.length&&x<c){if(N.subRows=m(_.subRows,x+1),_=N,a(_)&&!N.subRows.length){v.push(_),d[_.id]=_,l.push(_);continue}if(a(_)||N.subRows.length){v.push(_),d[_.id]=_,l.push(_);continue}}else _=N,a(_)&&(v.push(_),d[_.id]=_,l.push(_))}return v};return{rows:m(t),flatRows:l,rowsById:d}}function mw(t,a,s){var o;const l=[],d={},c=(o=s.options.maxLeafRowFilterDepth)!=null?o:100,m=function(g,x){x===void 0&&(x=0);const v=[];for(let j=0;j<g.length;j++){let _=g[j];if(a(_)){var b;if((b=_.subRows)!=null&&b.length&&x<c){const I=zo(s,_.id,_.original,_.index,_.depth,void 0,_.parentId);I.subRows=m(_.subRows,x+1),_=I}v.push(_),l.push(_),d[_.id]=_}}return v};return{rows:m(t),flatRows:l,rowsById:d}}function gw(){return(t,a)=>ee(()=>[t.getPreFilteredRowModel(),t.getState().columnFilters,t.getState().globalFilter,t.getFilteredRowModel()],(s,o,l)=>{if(!s.rows.length||!(o!=null&&o.length)&&!l)return s;const d=[...o.map(m=>m.id).filter(m=>m!==a),l?"__global__":void 0].filter(Boolean),c=m=>{for(let g=0;g<d.length;g++)if(m.columnFilters[d[g]]===!1)return!1;return!0};return Zd(s.rows,c,t)},te(t.options,"debugTable"))}function hw(){return(t,a)=>ee(()=>{var s;return[(s=t.getColumn(a))==null?void 0:s.getFacetedRowModel()]},s=>{if(!s)return new Map;let o=new Map;for(let d=0;d<s.flatRows.length;d++){const c=s.flatRows[d].getUniqueValues(a);for(let m=0;m<c.length;m++){const g=c[m];if(o.has(g)){var l;o.set(g,((l=o.get(g))!=null?l:0)+1)}else o.set(g,1)}}return o},te(t.options,"debugTable"))}function pw(){return t=>ee(()=>[t.getPreFilteredRowModel(),t.getState().columnFilters,t.getState().globalFilter],(a,s,o)=>{if(!a.rows.length||!(s!=null&&s.length)&&!o){for(let j=0;j<a.flatRows.length;j++)a.flatRows[j].columnFilters={},a.flatRows[j].columnFiltersMeta={};return a}const l=[],d=[];(s??[]).forEach(j=>{var _;const N=t.getColumn(j.id);if(!N)return;const I=N.getFilterFn();I&&l.push({id:j.id,filterFn:I,resolvedValue:(_=I.resolveFilterValue==null?void 0:I.resolveFilterValue(j.value))!=null?_:j.value})});const c=(s??[]).map(j=>j.id),m=t.getGlobalFilterFn(),g=t.getAllLeafColumns().filter(j=>j.getCanGlobalFilter());o&&m&&g.length&&(c.push("__global__"),g.forEach(j=>{var _;d.push({id:j.id,filterFn:m,resolvedValue:(_=m.resolveFilterValue==null?void 0:m.resolveFilterValue(o))!=null?_:o})}));let x,v;for(let j=0;j<a.flatRows.length;j++){const _=a.flatRows[j];if(_.columnFilters={},l.length)for(let N=0;N<l.length;N++){x=l[N];const I=x.id;_.columnFilters[I]=x.filterFn(_,I,x.resolvedValue,$=>{_.columnFiltersMeta[I]=$})}if(d.length){for(let N=0;N<d.length;N++){v=d[N];const I=v.id;if(v.filterFn(_,I,v.resolvedValue,$=>{_.columnFiltersMeta[I]=$})){_.columnFilters.__global__=!0;break}}_.columnFilters.__global__!==!0&&(_.columnFilters.__global__=!1)}}const b=j=>{for(let _=0;_<c.length;_++)if(j.columnFilters[c[_]]===!1)return!1;return!0};return Zd(a.rows,b,t)},te(t.options,"debugTable","getFilteredRowModel",()=>t._autoResetPageIndex()))}function xw(){return t=>ee(()=>[t.getState().sorting,t.getPreSortedRowModel()],(a,s)=>{if(!s.rows.length||!(a!=null&&a.length))return s;const o=t.getState().sorting,l=[],d=o.filter(g=>{var x;return(x=t.getColumn(g.id))==null?void 0:x.getCanSort()}),c={};d.forEach(g=>{const x=t.getColumn(g.id);x&&(c[g.id]={sortUndefined:x.columnDef.sortUndefined,invertSorting:x.columnDef.invertSorting,sortingFn:x.getSortingFn()})});const m=g=>{const x=g.map(v=>({...v}));return x.sort((v,b)=>{for(let _=0;_<d.length;_+=1){var j;const N=d[_],I=c[N.id],$=I.sortUndefined,L=(j=N==null?void 0:N.desc)!=null?j:!1;let A=0;if($){const E=v.getValue(N.id),T=b.getValue(N.id),q=E===void 0,Y=T===void 0;if(q||Y){if($==="first")return q?-1:1;if($==="last")return q?1:-1;A=q&&Y?0:q?$:-$}}if(A===0&&(A=I.sortingFn(v,b,N.id)),A!==0)return L&&(A*=-1),I.invertSorting&&(A*=-1),A}return v.index-b.index}),x.forEach(v=>{var b;l.push(v),(b=v.subRows)!=null&&b.length&&(v.subRows=m(v.subRows))}),x};return{rows:m(s.rows),flatRows:l,rowsById:s.rowsById}},te(t.options,"debugTable","getSortedRowModel",()=>t._autoResetPageIndex()))}/**
* react-table
*
* Copyright (c) TanStack
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/function kr(t,a){return t?vw(t)?D.createElement(t,a):t:null}function vw(t){return _w(t)||typeof t=="function"||bw(t)}function _w(t){return typeof t=="function"&&(()=>{const a=Object.getPrototypeOf(t);return a.prototype&&a.prototype.isReactComponent})()}function bw(t){return typeof t=="object"&&typeof t.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(t.$$typeof.description)}function Wo(t){const a={state:{},onStateChange:()=>{},renderFallbackValue:null,...t},[s]=D.useState(()=>({current:dw(a)})),[o,l]=D.useState(()=>s.current.initialState);return s.current.setOptions(d=>({...d,...t,state:{...o,...t.state},onStateChange:c=>{l(c),t.onStateChange==null||t.onStateChange(c)}})),s.current}const ww=({buttonText:t,title:a="",content:s,className:o=""})=>r.jsx("div",{className:`flex items-baseline justify-center mr-4 font-medium ${o}`,children:r.jsxs(Cn,{children:[r.jsx(Kc,{asChild:!0,children:r.jsxs(U,{variant:"link",className:"inline-flex items-center font-medium group",children:[r.jsx("span",{className:"underline-offset-4 group-hover:underline",children:t}),r.jsx(u0,{className:"w-4 h-4 ml-1 text-muted-foreground"})]})}),r.jsxs(Sn,{className:"sm:max-w-[425px]",children:[r.jsx(Nn,{children:r.jsx(Rn,{children:a})}),r.jsxs(Io,{className:"grid gap-4 py-2",children:[s,r.jsx(En,{children:r.jsx(mi,{asChild:!0,children:r.jsx(U,{type:"button",children:C("common.close")})})})]})]})]})});function jw(t){let o=0;for(let v=0;v<t.length;v++)o=t.charCodeAt(v)+((o<<5)-o);let l="#";for(let v=0;v<3;v++){const b=o>>v*8&255;l+=("00"+b.toString(16)).substr(-2)}const d=parseInt(l.substr(1,2),16),c=parseInt(l.substr(3,2),16),m=parseInt(l.substr(5,2),16),g=`#${(d*.7|0).toString(16).padStart(2,"0")}${(c*.7|0).toString(16).padStart(2,"0")}${(m*.7|0).toString(16).padStart(2,"0")}`,x=`#${Math.min(255,Math.floor(d+(255-d)*.7)).toString(16).padStart(2,"0")}${Math.min(255,Math.floor(c+(255-c)*.7)).toString(16).padStart(2,"0")}${Math.min(255,Math.floor(m+(255-m)*.7)).toString(16).padStart(2,"0")}`;return[g,x]}const Jd=({label:t,className:a})=>{const[s,o]=jw(t);return r.jsx(wi,{className:a,style:a?{}:{backgroundColor:o,color:s},children:t})};function ef({table:t,header:a,className:s}){return a.column.getCanSort()?r.jsx("div",{className:me("flex items-center space-x-2",s),children:r.jsxs(ji,{children:[r.jsx(yi,{asChild:!0,children:r.jsxs(U,{"aria-label":a.column.getIsSorted()==="desc"?C("common.sort_desc_description"):a.column.getIsSorted()==="asc"?C("common.sort_asc_description"):C("common.sort_none_description"),size:"sm",variant:"ghost",className:"-ml-3 h-8 data-[state=open]:bg-accent font-bold text-muted-foreground",children:[kr(a.column.columnDef.header,a.getContext()),a.column.getIsSorted()==="desc"?r.jsx(Fc,{className:"w-4 h-4 ml-2","aria-hidden":"true"}):a.column.getIsSorted()==="asc"?r.jsx(Dc,{className:"w-4 h-4 ml-2","aria-hidden":"true"}):r.jsx(G0,{className:"w-4 h-4 ml-2 text-muted-foreground/30","aria-hidden":"true"})]})}),r.jsxs(Ci,{align:"start",children:[a.column.getCanSort()&&r.jsxs(r.Fragment,{children:[r.jsxs(us,{onClick:()=>a.column.toggleSorting(!1),"aria-label":C("common.sort_asc"),children:[r.jsx(Dc,{className:"mr-2 h-3.5 w-3.5 text-muted-foreground/70","aria-hidden":"true"}),C("common.sort_asc")]}),r.jsxs(us,{onClick:()=>a.column.toggleSorting(!0),"aria-label":C("common.sort_desc"),children:[r.jsx(Fc,{className:"mr-2 h-3.5 w-3.5 text-muted-foreground/70","aria-hidden":"true"}),C("common.sort_desc")]})]}),a.column.getCanSort()&&a.column.getCanHide()&&r.jsx(Fo,{}),a.column.getCanHide()&&r.jsxs(us,{onClick:()=>a.column.toggleVisibility(!1),"aria-label":C("common.hide"),children:[r.jsx(Md,{className:"mr-2 h-3.5 w-3.5 text-muted-foreground/70","aria-hidden":"true"}),C("common.hide")]})]})]})}):r.jsxs(r.Fragment,{children:[r.jsx("div",{className:me("data-[state=open]:bg-accent tracking-wide text-ellipsis",s),children:a.isPlaceholder?null:kr(a.column.columnDef.header,a.getContext())}),!1]})}function yw({table:t,className:a,enablePageSizeSelector:s=!0,visible:o="auto"}){const l=D.useMemo(()=>o===!0,[o]),d=D.useMemo(()=>o==="auto",[o]);return!l||d&&t.getPageCount()<1?null:r.jsxs("div",{className:a,children:[r.jsx("div",{className:"flex-1 text-base text-muted-foreground",children:t.getSelectedRowModel().rows.length>0&&r.jsx(r.Fragment,{children:C("common.rows_selected_of_total",{count:t.getFilteredSelectedRowModel().rows.length,total:t.getFilteredRowModel().rows.length})})}),r.jsxs("div",{className:"flex justify-between space-x-6 lg:space-x-8",children:[s&&r.jsxs("div",{className:"flex items-center space-x-2 grow",children:[r.jsx("p",{className:"text-sm font-medium",children:C("common.rows_per_page")}),r.jsxs(Un,{value:`${t.getState().pagination.pageSize}`,onValueChange:c=>{t.setPageSize(Number(c))},children:[r.jsx(zn,{className:"h-8 w-[70px]",children:r.jsx(Vn,{placeholder:t.getState().pagination.pageSize})}),r.jsx(Hn,{side:"top",children:c0.map(c=>r.jsx(Xt,{value:`${c}`,children:c},c))})]})]}),r.jsxs("div",{className:me("flex space-x-2 flex-1",s?"justify-end":"justify-between"),children:[r.jsx("div",{className:"flex w-[150px] items-center justify-start",children:r.jsx("p",{className:"text-sm font-medium ",children:C("common.num_page_of_total",{count:t.getState().pagination.pageIndex+1,total:t.getPageCount()})})}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsxs(U,{type:"button",variant:"outline",className:"hidden w-8 h-8 p-0 lg:flex",onClick:()=>t.setPageIndex(d0),disabled:!t.getCanPreviousPage(),children:[r.jsx("span",{className:"sr-only",children:C("common.go_to_first_page")}),r.jsx(K0,{className:"w-4 h-4"})]}),r.jsxs(U,{type:"button",variant:"outline",className:"w-8 h-8 p-0",onClick:()=>t.previousPage(),disabled:!t.getCanPreviousPage(),children:[r.jsx("span",{className:"sr-only",children:C("common.go_to_prev_page")}),r.jsx(f0,{className:"w-4 h-4"})]}),r.jsxs(U,{type:"button",variant:"outline",className:"w-8 h-8 p-0",onClick:()=>t.nextPage(),disabled:!t.getCanNextPage(),children:[r.jsx("span",{className:"sr-only",children:C("common.go_to_next_page")}),r.jsx(m0,{className:"w-4 h-4"})]}),r.jsxs(U,{type:"button",variant:"outline",className:"hidden w-8 h-8 p-0 lg:flex",onClick:()=>t.setPageIndex(t.getPageCount()+1),disabled:!t.getCanNextPage(),children:[r.jsx("span",{className:"sr-only",children:C("common.go_to_last_page")}),r.jsx(W0,{className:"w-4 h-4"})]})]})]})]})]})}function Ti({table:t,title:a,description:s,caption:o,paginationOptions:l,headerOptions:d={visible:!0},children:c,className:m,contentClassName:g,footerClassName:x,rowClassName:v,cellClassName:b,onRowClick:j,activeRowIndex:_}){var $;const{t:N}=We(),I=d==null?void 0:d.visible;return r.jsxs(Ve,{className:m,children:[(a||s)&&r.jsxs(ht,{className:"pb-0",children:[r.jsx(et,{children:a}),r.jsx(it,{children:s})]}),r.jsxs(He,{className:me("pt-6",g),children:[c&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"flex space-x-2",children:c}),r.jsx(lr,{className:"my-4"})]}),r.jsxs(Si,{children:[typeof o<"u"&&r.jsx(g0,{children:o}),I&&t.getHeaderGroups().length&&r.jsx(Do,{children:t.getHeaderGroups().map(L=>r.jsx(jt,{className:v,children:L.headers.map(A=>r.jsx(Ni,{colSpan:A.colSpan,style:{width:A.getSize()===Number.MAX_SAFE_INTEGER?"auto":A.getSize()},children:r.jsx(ef,{table:t,header:A})},A.id))},L.id))}),r.jsx(Ri,{children:($=t.getRowModel().rows)!=null&&$.length?t.getRowModel().rows.map(L=>r.jsx(jt,{onClick:()=>{j&&j(L)},tabIndex:0,"data-state":L.getIsSelected()&&"selected",className:me(L.getIsSelected()||_===L.index?"bg-accent cursor-pointer hover:bg-accent":"cursor-pointer",v),children:L.getVisibleCells().map(A=>r.jsx(zt,{className:b,style:{width:A.column.getSize()===Number.MAX_SAFE_INTEGER?"auto":A.column.getSize()},children:kr(A.column.columnDef.cell,A.getContext())},A.id))},L.id)):r.jsx(jt,{className:v,children:r.jsx(zt,{className:me("h-24 text-center",b),colSpan:t.getAllColumns.length,children:N("components.data_table.no_results")})})})]})]}),r.jsx(Ut,{className:x,children:r.jsx(yw,{className:"flex-1",table:t,...l})})]})}function Cw({actions:t,rowContext:a}){return r.jsxs(ji,{children:[r.jsx(yi,{asChild:!0,children:r.jsxs(U,{size:"icon",variant:"outline",className:"w-8 h-8",children:[r.jsx(Z0,{className:"h-3.5 w-3.5"}),r.jsx("span",{className:"sr-only",children:C("common.open_menu")})]})}),r.jsxs(Ci,{align:"end",children:[r.jsxs(Wc,{children:[C("common.actions")," "]}),t&&t(a).map((s,o)=>s.label==="-"?r.jsx(Fo,{},o):r.jsxs(us,{onClick:l=>s.onClick?s.onClick(a,l):null,children:[s.icon&&r.jsx(r.Fragment,{children:s.icon}),s.label,s.shortcut&&r.jsx(h0,{children:s.shortcut})]},o))]})]})}function Sw(){return{id:"select",header:({table:t})=>r.jsx(ds,{id:"select-all",checked:t.getIsAllPageRowsSelected()||t.getIsSomePageRowsSelected()&&"indeterminate",onCheckedChange:a=>t.toggleAllPageRowsSelected(!!a),"aria-label":C("common.select_all"),className:"translate-y-[2px]"}),cell:({row:t})=>r.jsx(ds,{id:`select-row-${t.id}`,checked:t.getIsSelected(),onCheckedChange:a=>{t.toggleSelected(!!a)},"aria-label":C("common.select_row"),className:"translate-y-[2px]"}),enableSorting:!1,enableHiding:!1}}function Mi({columnCount:t,rowCount:a=10,searchableColumnCount:s=0,filterableColumnCount:o=0,showViewOptions:l=!0,cellWidths:d=["auto"],withPagination:c=!0,shrinkZero:m=!1,className:g,...x}){return r.jsxs("div",{className:me("w-full space-y-2.5 overflow-auto",g),...x,children:[r.jsxs("div",{className:"flex items-center justify-between w-full p-1 space-x-2 overflow-auto",children:[r.jsxs("div",{className:"flex items-center flex-1 space-x-2",children:[s>0?Array.from({length:s}).map((v,b)=>r.jsx(wt,{className:"w-40 h-7 lg:w-60"},b)):null,o>0?Array.from({length:o}).map((v,b)=>r.jsx(wt,{className:"h-7 w-[4.5rem] border-dashed"},b)):null]}),l?r.jsx(wt,{className:"ml-auto hidden h-7 w-[4.5rem] lg:flex"}):null]}),r.jsx("div",{className:"border rounded-md",children:r.jsxs(Si,{children:[r.jsx(Do,{children:Array.from({length:1}).map((v,b)=>r.jsx(jt,{className:"hover:bg-transparent",children:Array.from({length:t}).map((j,_)=>r.jsx(Ni,{style:{width:d[_],minWidth:m?d[_]:"auto"},children:r.jsx(wt,{className:"w-full h-6"})},_))},b))}),r.jsx(Ri,{children:Array.from({length:a}).map((v,b)=>r.jsx(jt,{className:"hover:bg-transparent",children:Array.from({length:t}).map((j,_)=>r.jsx(zt,{style:{width:d[_],minWidth:m?d[_]:"auto"},children:r.jsx(wt,{className:"w-full h-6"})},_))},b))})]})}),c?r.jsxs("div",{className:"flex items-center justify-between w-full gap-4 p-1 overflow-auto sm:gap-8",children:[r.jsx(wt,{className:"w-40 h-7 shrink-0"}),r.jsxs("div",{className:"flex items-center gap-4 sm:gap-6 lg:gap-8",children:[r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(wt,{className:"w-24 h-7"}),r.jsx(wt,{className:"h-7 w-[4.5rem]"})]}),r.jsx("div",{className:"flex items-center justify-center text-sm font-medium",children:r.jsx(wt,{className:"w-20 h-7"})}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(wt,{className:"hidden size-7 lg:block"}),r.jsx(wt,{className:"size-7"}),r.jsx(wt,{className:"size-7"}),r.jsx(wt,{className:"hidden size-7 lg:block"})]})]})]}):null]})}const Li=({title:t=C("components.empty_state.title"),subtitle:a=C("components.empty_state.subtitle"),buttonText:s=C("components.empty_state.button"),onButtonClick:o=()=>{},actions:l=()=>r.jsx(r.Fragment,{})})=>r.jsxs("div",{className:"text-center",children:[r.jsx("svg",{className:"w-12 h-12 mx-auto text-slate-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","aria-hidden":"true",children:r.jsx("path",{vectorEffect:"non-scaling-stroke",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 13h6m-3-3v6m-9 1V7a2 2 0 012-2h6l2 2h6a2 2 0 012 2v8a2 2 0 01-2 2H5a2 2 0 01-2-2z"})}),r.jsx("h3",{className:"mt-2 text-lg font-semibold text-slate-900",children:t}),r.jsx("p",{className:"mt-1 text-base text-slate-500",children:a}),r.jsxs("div",{className:"items-center mt-6",children:[l&&r.jsx(r.Fragment,{children:l}),!l&&r.jsxs(U,{className:"my-4",onClick:o,children:[r.jsx(Bo,{}),s]})]})]}),Nw=Oo("flex h-10 w-full rounded-md bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50",{variants:{variant:{default:"border border-input ring-offset-background focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 ",outline:"focus-visible:border focus-visible:border-input"}},defaultVariants:{variant:"default"}}),xi=t=>{const{name:a,label:s,hint:o,description:l,placeholder:d,className:c,disabled:m,defaultValue:g,rules:x,readOnly:v,scale:b,variant:j}=t,{control:_}=ln(),[N,I]=D.useState(""),$={input:L=>{if(typeof L!="object")return L;const A=on.create(L);if(A.isFailure)throw A.error;const E=A.object.toString();return N.endsWith(",")?E.replace(/.0$/,","):E},output:(L,A,E)=>{const{value:T}=E??{value:null};I(T??"");const q=on.createFromFormattedValue(T);if(q.isFailure)throw q.error;return q.object.toObject()}};return r.jsx(To,{defaultValue:g,control:_,name:a,disabled:m,rules:{max:100,min:0,...x},render:({field:L})=>{const A=$.input(L.value),E=m||L.disabled,T=!!((x==null?void 0:x.required)??!1);return r.jsxs(Mo,{className:me(c,"space-y-3"),children:[s&&r.jsx(Tr,{label:s,hint:o,required:T}),r.jsx(Lo,{children:r.jsx(Qc,{name:L.name,ref:L.ref,onBlur:L.onBlur,disabled:E,readOnly:v,className:me(Nw({variant:j,className:c})),groupSeparator:".",decimalSeparator:",",placeholder:d,allowDecimals:b!==0,decimalsLimit:b,decimalScale:b,step:1,value:A,onValueChange:(q,Y,H)=>L.onChange($.output(q,Y,H))})}),l&&r.jsx(Po,{children:l}),r.jsx(qo,{})]})}})},Rw=Oo("flex h-10 w-full rounded-md bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50",{variants:{variant:{default:"border border-input ring-offset-background focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 ",outline:"focus-visible:border focus-visible:border-input"}},defaultVariants:{variant:"default"}}),Ew=t=>{const{name:a,label:s,hint:o,description:l,placeholder:d,className:c,disabled:m,defaultValue:g,rules:x,readOnly:v,scale:b,variant:j}=t,{control:_}=ln(),[N,I]=D.useState(""),$={input:L=>{if(typeof L!="object")return L;const A=Kn.create(L);if(A.isFailure)throw A.error;const E=A.object.toString();return N.endsWith(",")?E.replace(/.0$/,","):E},output:(L,A,E)=>{const{value:T}=E??{value:null};I(T??"");const q=Kn.createFromFormattedValue(T);if(q.isFailure)throw q.error;return q.object.toObject()}};return r.jsx(To,{defaultValue:g,control:_,name:a,disabled:m,rules:x,render:({field:L})=>{const A=$.input(L.value),E=m||L.disabled,T=!!((x==null?void 0:x.required)??!1);return r.jsxs(Mo,{className:me(c,"space-y-3"),children:[s&&r.jsx(Tr,{label:s,hint:o,required:T}),r.jsx(Lo,{children:r.jsx(Qc,{name:L.name,ref:L.ref,onBlur:L.onBlur,disabled:E,readOnly:v,className:me(Rw({variant:j,className:c})),groupSeparator:".",decimalSeparator:",",placeholder:d,allowDecimals:b!==0,decimalsLimit:b,decimalScale:b,step:1,value:A,onValueChange:(q,Y,H)=>L.onChange($.output(q,Y,H))})}),l&&r.jsx(Po,{children:l}),r.jsx(qo,{})]})}})},Aw=Oo("",{variants:{variant:{default:"",ghost:"border-0 focus-visible:border focus-visible:border-input focus-visible:ring-0 focus-visible:ring-offset-0 "}},defaultVariants:{variant:"default"}}),ur=t=>{const{name:a,label:s,hint:o,description:l,placeholder:d,className:c,disabled:m,rules:g,required:x,type:v,variant:b}=t,{control:j}=ln();return r.jsx(To,{control:j,name:a,disabled:m,rules:{required:x,...g},render:({field:_,fieldState:N})=>{const I=!!((g==null?void 0:g.required)??x);return r.jsxs(Mo,{className:me(c,"space-y-3"),children:[s&&r.jsx(Tr,{label:s,hint:o,required:I}),r.jsx(Lo,{className:"block",children:r.jsx(ms,{type:v,placeholder:d,className:me(N.error?"border-destructive focus-visible:ring-destructive":"",Aw({variant:b,className:c})),..._})}),l&&r.jsx(Po,{children:l}),r.jsx(qo,{})]})}})};function Iw(t=!1){const[a,s]=D.useState(t);return[a,()=>s(l=>!l)]}const mr=()=>{const t=D.useContext(p0);if(t===null)throw new Error("useDataTableContext must be used within a DataTableProvider");return t};function Oi({data:t,columns:a,pageCount:s,enableSorting:o=!1,enableHiding:l=!1,enableRowSelection:d=!1,initialState:c,onPaginationChange:m,meta:g}){const{pagination:x,setPagination:v,sorting:b}=mr(),[j,_]=ir.useState({}),[N,I]=ir.useState((c==null?void 0:c.columnVisibility)||{}),$=T=>{if(typeof T=="function"){const q=T(x);v(q)}m&&m(T)},L=T=>{},A=D.useCallback(()=>{const T=a;return d&&T.unshift(Sw()),T},[a,d]);return{table:Wo({data:t,columns:A(),pageCount:s??-1,meta:g,getCoreRowModel:Ko(),initialState:c,state:{pagination:x,sorting:b,columnVisibility:N,rowSelection:j},enableRowSelection:d,onRowSelectionChange:_,manualSorting:!0,enableSorting:o,getSortedRowModel:xw(),onSortingChange:L,enableHiding:l,onColumnVisibilityChange:I,manualPagination:!0,onPaginationChange:$,manualFiltering:!0,getFilteredRowModel:pw(),getFacetedRowModel:gw(),getFacetedUniqueValues:hw(),debugTable:!1,debugHeaders:!1,debugColumns:!1,defaultColumn:{minSize:0,size:Number.MAX_SAFE_INTEGER,maxSize:Number.MAX_SAFE_INTEGER}})}}const Fw=({setSize:t,setControllerCallback:a,setPercentageCallback:s,setErrorCallback:o})=>l=>{if(!l.ok)throw Error(`${l.status} ${l.type} ${l.statusText}`);if(!l.body)throw Error("ReadableStream not yet supported in this browser.");const d=l.body,c=l.headers.get("content-encoding"),m=l.headers.get(c?"x-file-size":"content-length"),g=parseInt(m||"0",10);t(()=>g);let x=0;const v=new ReadableStream({start(b){a(b);const j=d.getReader();async function _(){return j.read().then(({done:N,value:I})=>N?b.close():(x+=(I==null?void 0:I.byteLength)||0,I&&b.enqueue(I),s({loaded:x,total:g}),_())).catch(N=>(o(N),j.cancel("Cancelled"),b.error(N)))}return _()}});return new Response(v)},qc=(t,a,s)=>{const o=[t],l=new Blob(o,{type:s||"application/octet-stream"});if(typeof window.navigator.msSaveBlob<"u")return window.navigator.msSaveBlob(l,a);const d=window.URL&&window.URL.createObjectURL?window.URL.createObjectURL(l):window.webkitURL.createObjectURL(l),c=document.createElement("a");return c.style.display="none",c.href=d,c.setAttribute("download",a),typeof c.download>"u"&&c.setAttribute("target","_blank"),document.body.appendChild(c),c.click(),setTimeout(()=>{document.body.removeChild(c),window.URL.revokeObjectURL(d)},200)};function kc({customHandleDownload:t,...a}={}){var T;let s=!1;try{s=process?!!((T=process==null?void 0:process.env)!=null&&T.REACT_APP_DEBUG_MODE):!1}catch{s=!1}const[o,l]=D.useState(0),[d,c]=D.useState(0),[m,g]=D.useState(0),[x,v]=D.useState(null),[b,j]=D.useState(!1),_=D.useRef(null),N=D.useCallback(({loaded:q,total:Y})=>{const H=Math.round(q/Y*100);c(()=>H)},[]),I=D.useCallback(q=>{const Y={"Failed to execute 'enqueue' on 'ReadableStreamDefaultController': Cannot enqueue a chunk into an errored readable stream":"Download canceled","The user aborted a request.":"Download timed out"};v(()=>({errorMessage:Y[q.message]?Y[q.message]:q.message}))},[]),$=D.useCallback(q=>{_.current=q},[]),L=D.useCallback(()=>{_.current&&_.current.error()},[]),A=D.useCallback(()=>{$(null),l(()=>0),c(()=>0),g(()=>0),j(()=>!1)},[$]),E=D.useCallback(async(q,Y,H=0,ce={})=>{if(b)return null;A(),v(()=>null),j(()=>!0);const pe=setInterval(()=>l(xe=>xe+1),s?1:1e3),le=Fw({setSize:g,setControllerCallback:$,setPercentageCallback:N,setErrorCallback:I}),fe=new AbortController,V=setTimeout(()=>{H>0&&fe.abort()},H),Z=t||qc;try{const xe=await fetch(q,{method:"GET",...a,...ce,signal:fe.signal}),X=await le(xe).blob();Z(X,Y),A()}catch(xe){A(),v(Be=>{const{message:X}=xe;return X!=="Failed to fetch"?{errorMessage:X}:Be}),clearTimeout(V)}finally{clearInterval(pe)}},[b,A,s,$,N,I,a,t]);return D.useMemo(()=>({elapsed:o,percentage:d,size:m,download:E,cancel:L,error:x,isInProgress:b,jsDownload:qc}),[o,d,m,E,L,x,b])}const tf=()=>{const{i18n:t}=We();return nf({locale:t.language})},nf=t=>{const{locale:a}=t,s=D.useCallback(c=>{if(c==null)return"";const{amount:m,scale:g,currency_code:x}=c;return new Intl.NumberFormat(a??"ES",{style:"currency",currency:x,currencyDisplay:"symbol",useGrouping:!0,maximumFractionDigits:g}).format(m===null?0:Ac({amount:m,scale:g}))},[a]),o=D.useCallback(c=>{if(c==null)return"";const{amount:m,scale:g}=c;return new Intl.NumberFormat("es",{minimumFractionDigits:g,useGrouping:!0}).format(m===null?0:Ac({amount:m,scale:g}))},[a]),l=D.useCallback(c=>{if(c==null)return"";const{amount:m,scale:g}=c;return new Intl.NumberFormat(a,{style:"decimal",minimumFractionDigits:g}).format(m===null?0:m)},[a]),d=D.useCallback(c=>{var m;return((m=new Intl.NumberFormat(a??"es",{style:"currency",currency:c,currencyDisplay:"name"}).formatToParts(1).find(g=>g.type==="currency"))==null?void 0:m.value)??c},[a]);return{formatCurrency:s,formatNumber:o,formatPercentage:l,formatCurrencyName:d}};function rf(t){const[a,s]=D.useState(!1);return D.useEffect(()=>{function o(d){s(d.matches)}const l=matchMedia(t);return l.addEventListener("change",o),s(l.matches),()=>l.removeEventListener("change",o)},[t]),a}const Dw=()=>{const t=D.useContext(x0);if(t===null)throw new Error("useWarnAboutChange must be used within a UnsavedWarnProvider");return t},Qo=({isDirty:t=!1,title:a=C("hooks.use_unsaved_changes_notifier.title"),subtitle:s=C("hooks.use_unsaved_changes_notifier.subtitle"),confirmText:o=C("hooks.use_unsaved_changes_notifier.confirm_text"),cancelText:l=C("hooks.use_unsaved_changes_notifier.cancel_text"),onConfirm:d,onCancel:c,type:m="warning"})=>{const g=v0(t),{show:x}=Dw(),v=D.useCallback(()=>t?new Promise(b=>{x({title:a,subtitle:s,confirmText:o,cancelText:l,type:m,onConfirm:()=>{b(!0),d==null||d()},onCancel:()=>{b(!1),c==null||c()}})}):Promise.resolve(!0),[l,o,t,c,d,x,s,a,m]);return D.useEffect(()=>{g.state==="blocked"&&v().then(b=>{b?g.proceed():g.reset()})},[g,v]),D.useEffect(()=>(t&&(window.onbeforeunload=()=>s),()=>{window.onbeforeunload=null}),[t,s]),{confirm:v}},sf=t=>{const{isSubmitting:a,isLoading:s,isValidating:o}=_0();return r.jsx(ko,{disabled:a||s||o,...t})};sf.displayName="FormSubmitButton";const yn=[{code:"es",name:"Español",flagClassName:"fi fi-es"},{code:"en",name:"English",flagClassName:"fi fi-gb"},{code:"fr",name:"Français",flagClassName:"fi fi-fr"}],Tw=t=>$n.object({email:$n.string().email({tlds:{allow:!1}}).required().messages({"any.required":t("login_page.validation.email_required"),"string.empty":t("login_page.validation.email_required"),"string.base":t("login_page.validation.email_invalid"),"string.email":t("login_page.validation.email_invalid")}),password:$n.string().min(4).alphanum().required().messages({"any.required":t("login_page.validation.password_required"),"string.empty":t("login_page.validation.password_required"),"string.base":t("login_page.validation.password_alphanum"),"string.min":t("login_page.validation.password_min",{count:4}),"string.alphanum":t("login_page.validation.password_alphanum")})}),Vj=()=>{var _,N,I,$,L;const{t,i18n:a}=We(),[s,o]=D.useState(a.language),l=un(),{toast:d}=Qn();D.useEffect(()=>{const A=navigator.language.split("-")[0],E=yn.find(T=>T.code===A);E&&c(E.code)},[]);const c=A=>{a.changeLanguage(A),o(A)},{mutate:m,status:g}=H0({onSuccess:A=>{const{success:E,error:T}=A;!E&&T&&x.setError("root",{type:T.name,message:T.message}),E&&l("/quotes",{replace:!0})},onError:A=>{const{message:E}=A;d({description:E,title:t("common.error")}),console.log(A)}}),x=Ei({mode:"onBlur",defaultValues:{email:"",password:""},resolver:Yc(Tw(t))}),{getFieldState:v,trigger:b}=x;D.useEffect(()=>{const A=["email","password"].filter(E=>v(E).invalid);A.length&&b(A)},[a.resolvedLanguage,v,b]);const j=async A=>{m({email:A.email,password:A.password},{})};return r.jsxs(b0,{variant:"full",className:"p-0 lg:grid lg:min-h-[600px] lg:grid-cols-2 xl:min-h-[800px] h-screen ",children:[r.jsx("div",{className:"flex items-center justify-center py-12 ",children:r.jsxs("div",{className:"mx-auto grid w-[650px] gap-6 relative ",children:[r.jsx("div",{className:"absolute flex space-x-2 top-4 right-4 ",children:r.jsxs(ji,{children:[r.jsx(yi,{asChild:!0,children:r.jsxs(U,{variant:"outline",className:"w-[140px] justify-start",children:[r.jsx("span",{className:"mr-2",children:r.jsx("span",{"aria-hidden":"true",className:(_=yn.find(A=>A.code===s))==null?void 0:_.flagClassName})}),(N=yn.find(A=>A.code===s))==null?void 0:N.name,r.jsx(Xc,{className:"w-4 h-4 ml-auto opacity-50"})]})}),r.jsx(Ci,{className:"w-[140px]",children:yn.map(A=>r.jsxs(us,{onSelect:()=>c(A.code),children:[r.jsx("span",{"aria-hidden":"true",className:`mr-2 ${A.flagClassName}`}),A.name]},A.code))})]})}),r.jsxs(Ve,{className:"px-12 py-6 bg-muted/50",children:[r.jsxs(ht,{children:[r.jsx(w0,{className:"inline-block m-auto mb-6 align-middle max-w-32"}),r.jsx(et,{children:r.jsx(ae,{i18nKey:"login_page.title"})}),r.jsx(it,{children:r.jsx(ae,{i18nKey:"login_page.description"})})]}),r.jsx(He,{children:r.jsx(Ai,{...x,children:r.jsx("form",{onSubmit:x.handleSubmit(j),children:r.jsxs("div",{className:"grid items-start gap-6",children:[r.jsx("div",{className:"grid gap-6",children:r.jsx(ur,{required:!0,disabled:g==="pending",name:"email",label:t("login_page.email_label"),type:"email",placeholder:t("login_page.email_placeholder")})}),r.jsxs("div",{className:"grid gap-6",children:[r.jsx(ur,{required:!0,disabled:g==="pending",name:"password",label:t("login_page.password_label"),type:"password"}),r.jsxs("div",{className:"mb-4 -mt-2 text-sm",children:[r.jsx(ae,{i18nKey:"login_page.forgotten_password"}),r.jsx("br",{}),r.jsx(vo,{to:"https://uecko.com/distribuidores",className:"underline",children:r.jsx(ae,{i18nKey:"login_page.contact_us"})})]})]}),((I=x.formState.errors.root)==null?void 0:I.message)&&r.jsxs(Zc,{variant:"destructive",children:[r.jsx(Dd,{className:"w-4 h-4"}),r.jsx(Jc,{children:r.jsx(ae,{i18nKey:"common.error"})}),r.jsx(ed,{children:(($=x.formState.errors.root)==null?void 0:$.type)==="InvalidCredentials"?t("login_page.invalid_credentials"):(L=x.formState.errors.root)==null?void 0:L.message})]}),r.jsx(sf,{className:"w-full",disabled:g==="pending"}),r.jsxs("div",{className:"mt-4 text-sm text-center",children:[r.jsx(ae,{i18nKey:"login_page.become_dealer"}),r.jsx("br",{}),r.jsx(vo,{to:"https://uecko.com/distribuidores",className:"underline",children:r.jsx(ae,{i18nKey:"login_page.contact_us"})}),r.jsx("br",{}),r.jsxs("p",{className:"mx-auto mt-4 -mb-6 text-xs text-muted-foreground/50",children:["v.","1.2.7"]})]})]})})})})]}),r.jsx("img",{className:"block w-11/12 mx-auto aspect-auto",src:"/img/uecko-footer_logos.jpg"})]})}),r.jsx("div",{className:"hidden bg-muted lg:block",children:r.jsx("img",{src:"/img/nara2.jpg",alt:"",width:"1920",height:"1080",className:"h-full w-full object-cover dark:brightness-[0.2] dark:grayscale"})})]})},Mw=t=>{const{onSuccess:a,onError:s,...o}=t||{},l=jn(),d=cr(),{logout:c}=Vc(),m=un(),{toast:g}=Qn();return sn({mutationKey:d().auth().action("logout").get(),mutationFn:c,onSuccess:async(x,v,b)=>{l.clear();const{success:j,redirectTo:_}=x;j&&_&&m(_||"/"),a&&a(x,v,b)},onError:(x,v,b)=>{const{message:j}=x;g({title:C("common.error"),description:j,variant:"destructive"}),s&&s(x,v,b)},...o})},Hj=()=>{const{mutate:t}=Mw({});return D.useEffect(()=>t(),[t]),r.jsx(dr,{})},Lw=D.createContext(null),Ow=({children:t})=>{const[a,s]=td();return r.jsx(Lw.Provider,{value:{pagination:a,setPagination:s},children:t})},Gj=({children:t})=>r.jsx(Ii,{children:r.jsx(Ow,{children:r.jsxs(gs,{className:"catalog-layout",children:[r.jsx(hs,{}),r.jsx(ps,{children:t})]})})}),af=t=>{const a=fs(),s=cr(),{pagination:o,searchTerm:l=[],enabled:d=!0,queryOptions:c}=t;return Uo({queryKey:s().data().resource("catalog").action("list").params(t).get(),queryFn:()=>a.getList({resource:"catalog",quickSearchTerm:l,pagination:o}),enabled:d,queryOptions:c})};function of({table:t,className:a,children:s,...o}){const{globalFilter:l,isFiltered:d,setGlobalFilter:c,resetGlobalFilter:m}=mr(),g=ir.useRef(null),[x,v]=ir.useState(""),b=ir.useCallback(N=>{N.key==="Enter"&&x.trim()&&(N.preventDefault(),c(I=>[...I,x.trim()]),v("")),N.key==="Backspace"&&!x&&l.length>0&&(N.preventDefault(),c(I=>I.slice(0,-1)))},[l,x]),j=ir.useCallback(N=>{c(I=>I.filter($=>$!==N))},[]),_=ir.useCallback(()=>{var N;x.trim()&&(c(I=>[...I,x.trim()]),v(""),(N=g.current)==null||N.focus())},[x]);return r.jsx(j0,{children:r.jsxs("div",{className:"w-full space-y-2",...o,children:[r.jsxs("div",{className:me("relative flex items-center flex-1 p-2 space-x-2 border rounded-md",d?"border-primary":"border-input"),children:[r.jsx(nd,{className:me("w-4 h-4 text-gray-500")}),r.jsxs("div",{className:"flex flex-wrap items-center flex-1 gap-2",children:[l&&l.map(N=>r.jsxs(wi,{variant:"default",className:"px-1 text-base font-normal rounded-sm",children:[N,r.jsxs(U,{variant:"ghost",onClick:()=>j(N),className:"h-auto p-0 px-1 ml-1 hover:bg-transparent",children:[r.jsxs(at,{children:[r.jsx(ot,{asChild:!0,children:r.jsx(_o,{className:"w-4 h-4"})}),r.jsx(lt,{children:r.jsx("p",{children:C("common.filter.badget_remove_tooltip")})})]}),r.jsx("span",{className:"sr-only",children:C("common.filter.badget_remove_tooltip")})]})]},N)),r.jsxs("div",{className:"flex-1 flex items-center min-w-[300px]",children:[r.jsx("input",{ref:g,value:x,onChange:N=>v(N.target.value),onKeyDown:b,placeholder:C("common.filter.input_placeholder"),className:"flex-1 w-full h-8 bg-transparent outline-none placeholder:text-muted-foreground"}),r.jsxs(Gn,{children:[d&&r.jsxs(at,{children:[r.jsx(ot,{asChild:!0,children:r.jsxs(U,{variant:"ghost",onClick:()=>m(),className:"h-8 px-2 transition-all lg:px-3 text-primary",children:[r.jsx(_o,{className:"w-4 h-4 mr-2"}),C("common.filter.reset_filter")]})}),r.jsx(lt,{children:r.jsx("p",{children:C("common.filter.reset_filter")})})]}),r.jsxs(at,{children:[r.jsx(ot,{asChild:!0,children:r.jsxs(U,{variant:"default",size:"icon",disabled:!x,onClick:_,className:"w-8 h-8 p-0 transition-all",children:[r.jsx(Bo,{className:"w-4 h-4"}),r.jsx("span",{className:"sr-only",children:C("common.filter.button_add_term")})]})}),r.jsx(lt,{children:r.jsx("p",{children:C("common.filter.button_add_term_tooltip")})})]})]})]})]})]}),r.jsx("p",{className:"text-sm text-muted-foreground",children:C("common.filter.help_text")})]})})}const Pw=()=>{const t=un(),{pagination:a,globalFilter:s,isFiltered:o}=mr(),{data:l,isPending:d,isError:c,error:m}=af({pagination:{pageIndex:a.pageIndex,pageSize:a.pageSize},searchTerm:s}),g=D.useMemo(()=>[{id:"id",accessorKey:"id"},{id:"id_article",accessorKey:"id_article"},{id:"catalog_name",accessorKey:"catalog_name"},{id:"description",accessorKey:"description",header:()=>r.jsx(r.Fragment,{children:C("catalog.list.columns.description")})},{id:"points",accessorKey:"points",header:()=>r.jsx("div",{className:"text-right",children:C("catalog.list.columns.points")}),cell:({renderValue:v})=>r.jsx("div",{className:"text-right",children:v()})},{id:"retail_price",accessorKey:"retail_price",header:()=>r.jsx("div",{className:"text-right",children:C("catalog.list.columns.retail_price")}),cell:({row:v})=>{const b=It.create(v.original.retail_price).object;return r.jsx("div",{className:"text-right",children:b.toFormat()})}}],[]),{table:x}=Oi({data:(l==null?void 0:l.items)??[],columns:g,pageCount:(l==null?void 0:l.total_pages)??-1,initialState:{columnVisibility:{id:!1,id_article:!1,catalog_name:!1}}});return c?r.jsx($r,{subtitle:m.message}):d?r.jsx(Ve,{children:r.jsx(He,{children:r.jsx(Mi,{columnCount:6,searchableColumnCount:1,filterableColumnCount:2,shrinkZero:!0})})}):(l==null?void 0:l.total_items)===0&&!o?r.jsx(Li,{subtitle:C("catalog.list.empty_state.subtitle"),buttonText:"",onButtonClick:()=>t("/catalog/add")}):r.jsx(Ti,{table:x,paginationOptions:{visible:!0},children:r.jsx(of,{table:x})})},Kj=()=>r.jsxs(Pr,{children:[r.jsx("div",{className:"flex items-center justify-between space-y-2",children:r.jsx("div",{children:r.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:r.jsx(ae,{i18nKey:"catalog.list.title"})})})}),r.jsx(Pw,{})]}),Wj=()=>{const{data:t,status:a}=y0();return r.jsxs(gs,{children:[r.jsx(hs,{}),r.jsx(ps,{children:a==="success"?r.jsx("div",{className:"flex items-center",children:r.jsx("h1",{className:"text-lg font-semibold md:text-2xl",children:`${C("dashboard.welcome")}, ${t==null?void 0:t.name}`})}):r.jsx(wt,{className:"w-[100px] h-[20px] rounded-full"})})]})},Qj=({children:t})=>r.jsx(Ii,{children:r.jsxs(gs,{className:"dealers-layout",children:[r.jsx(hs,{}),r.jsx(ps,{children:t})]})});function qw({table:t}){return r.jsxs(ji,{children:[r.jsx(yi,{asChild:!0,children:r.jsxs(U,{variant:"outline",size:"sm",className:"hidden h-8 ml-auto lg:flex",children:[r.jsx(ob,{className:"w-4 h-4 mr-2"}),C("components.data_table.columns")]})}),r.jsxs(Ci,{align:"end",className:"w-[150px]",children:[r.jsx(Wc,{children:C("components.data_table.columns")}),r.jsx(Fo,{}),t.getAllColumns().filter(a=>typeof a.accessorFn<"u"&&a.getCanHide()).map(a=>r.jsx(C0,{className:"capitalize",checked:a.getIsVisible(),onCheckedChange:s=>a.toggleVisibility(!!s),children:r.jsx(r.Fragment,{children:a.columnDef.header})},a.id))]})]})}function lf({table:t,className:a,children:s,...o}){const{globalFilter:l,isFiltered:d,setGlobalFilter:c,resetGlobalFilter:m}=mr(),g=x=>{const v=String(x.target.value);v===""?m():c([v])};return r.jsxs("div",{className:me("flex w-full items-center justify-between space-x-2 overflow-auto p-1",a),...o,children:[r.jsxs("div",{className:"flex items-center flex-1 space-x-2",children:[r.jsx(nd,{className:"w-4 h-4 text-gray-500"}),r.jsx(ms,{placeholder:C("common.filter.input_placeholder"),value:l,onChange:g,className:me("h-8 w-full transition-all")},"global-filter"),d&&r.jsxs(U,{variant:"outline",onClick:()=>m(),className:"h-8 px-2 transition-all lg:px-3",children:[r.jsx(_o,{className:"w-4 h-4 mr-2"}),C("common.filter.reset_filter")]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[s,t.options.enableHiding&&r.jsx(qw,{table:t})]})]})}const kw=t=>{const a=fs(),s=cr(),{pagination:o,searchTerm:l=void 0,enabled:d=!0,queryOptions:c}=t;return Uo({queryKey:s().data().resource("dealer").action("list").params(t).get(),queryFn:()=>a.getList({resource:"dealers",quickSearchTerm:l,pagination:o}),enabled:d,queryOptions:c})},$w=()=>{const{t}=We(),a=un(),{pagination:s,globalFilter:o,isFiltered:l}=mr(),{data:d,isPending:c,isError:m,error:g}=kw({pagination:{pageIndex:s.pageIndex,pageSize:s.pageSize},searchTerm:o}),x=D.useMemo(()=>[{id:"id",accessorKey:"id",header:()=>t("common.identifier"),enableResizing:!1,size:10},{id:"name",accessorKey:"name",header:()=>t("common.name"),enableResizing:!1,size:10}],[t]),{table:v}=Oi({data:(d==null?void 0:d.items)??[],columns:x,pageCount:(d==null?void 0:d.total_pages)??-1});return m?r.jsx($r,{subtitle:g.message}):c?r.jsx(Ve,{children:r.jsx(He,{children:r.jsx(Mi,{columnCount:6,searchableColumnCount:1,filterableColumnCount:2,shrinkZero:!0})})}):(d==null?void 0:d.total_items)===0&&!l?r.jsx(Li,{subtitle:t("catalog.list.empty_state.subtitle"),buttonText:"",onButtonClick:()=>a("/catalog/add")}):r.jsx(r.Fragment,{children:r.jsx(Ti,{table:v,paginationOptions:{visible:!0},children:r.jsx(lf,{table:v})})})},Yj=()=>r.jsx(Pr,{children:r.jsx($w,{})}),Xj=()=>{const{t}=We();return r.jsx("div",{className:"flex min-h-[100dvh] flex-col items-center justify-center bg-background px-4 py-12 sm:px-6 lg:px-8",children:r.jsxs("div",{className:"max-w-md mx-auto text-center",children:[r.jsx("div",{className:"w-12 h-12 mx-auto text-primary"}),r.jsx("h1",{className:"mt-4 text-3xl font-bold tracking-tight text-foreground sm:text-4xl",children:t("error_page.title")}),r.jsx("p",{className:"mt-4 text-muted-foreground",children:t("error_page.description")}),r.jsx("div",{className:"mt-6",children:r.jsx(U,{asChild:!0,className:"inline-flex items-center px-4 py-2 text-sm font-medium transition-colors rounded-md shadow-sm bg-primary text-primary-foreground hover:bg-primary/90 focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2",children:r.jsx(vo,{to:"/",children:t("error_page.go_home")})})})]})})},Bw={"any.unknown":"{{#label}}: no está permitido","any.invalid":"{{#label}}: contiene un valor invalido","any.empty":"{{#label}}: no está permitido que sea vacío","any.required":"{{#label}}: es un campo requerido","any.allowOnly":"{{#label}}: debería ser uno de las siguientes variantes: {{valids}}","any.default":"emitió un error cuando se ejecutó el metodo default","alternatives.base":"{{#label}}: no coincide con ninguna de las alternativas permitidas","array.base":"{{#label}}: debe ser un array","array.includes":"{{#label}}: en la posición {{pos}} no coincide con ninguno de los tipos permitidos","array.includesSingle":'{{#label}}: el valor de "{{!key}}" no coincide con ninguno de los tipos permitidos',"array.includesOne":"{{#label}}: en la posición {{pos}} falló porque {{reason}}","array.includesOneSingle":'{{#label}}: el valor "{{!key}}" falló porque {{reason}}',"array.includesRequiredUnknowns":"{{#label}}: no contiene valor/es requerido/s: {{unknownMisses}} ","array.includesRequiredKnowns":"{{#label}}: no contiene: {{knownMisses}}","array.includesRequiredBoth":"{{#label}}: no contiene {{knownMisses}} y {{unknownMisses}} otros valores requeridos","array.excludes":"{{#label}}: en la posición {{pos}} contiene un valor excluído","array.excludesSingle":'{{#label}}: el valor "{{!key}}" contiene un valor excluído',"array.min":"{{#label}}: debe contener al menos {{limit}} items","array.max":"{{#label}}: debe contener máximo {{limit}} items","array.length":"{{#label}}: debe contener exactamente {{limit}} items","array.ordered":"{{#label}}: en la posición {{pos}} falló porque {{reason}}","array.orderedLength":"{{#label}}: en la posición {{pos}} falló porque el array debre contener como máximo {{limit}} items","array.sparse":"{{#label}}: no debe ser un array esparcido","array.unique":"{{#label}}: posición {{pos}} contiene un valor duplicado","boolean.base":"{{#label}}: debe ser un valor verdadero/falso o si/no","binary.base":"{{#label}}: debe ser un buffer o un string","binary.min":"{{#label}}: debe ser como mínimo de {{limit}} bytes","binary.max":"{{#label}}: debe ser como máximo de {{limit}} bytes","binary.length":"{{#label}}: debe tener exactamente {{limit}} bytes","date.base":"{{#label}}: debe ser una cantidad de milisegundos o una fecha en cadena de texto válida","date.min":'{{#label}}: debe ser mayor o igual a "{{limit}}"',"date.max":'{{#label}}: debe ser menor o igual que "{{limit}}"',"date.isoDate":"{{#label}}: debe ser una fecha en formato ISO 8601","date.ref":'referencia a "{{ref}}", que no es una fecha válida',"function.base":"{{#label}}: debe ser una función","object.base":"{{#label}}: debe ser un objeto","object.child":'hijo "{{!key}}" falló porque {{reason}}',"object.min":"{{#label}}: debe tener como mínimo {{limit}} hijo","object.max":"{{#label}}: debe tener menos o a lo sumo {{limit}} hijo","object.length":"{{#label}}: debe tener máximo {{limit}} hijo/s","object.allowUnknown":"no está permitido","object.with":'peer faltante: "{{peer}}"',"object.without":'conflicto con peer prohibido: "{{peer}}"',"object.missing":"{{#label}}: debe contener al menos uno de: {{peers}}","object.xor":"{{#label}}: contiene un conflicto con alguno de: {{peers}}","object.or":"{{#label}}: debe contener al menos uno de: {{peers}}","object.and":"contiene {{present}} sin el requerido: {{missing}}","object.nand":'!!"{{main}}" no debe existir simultáneamente con {{peers}}',"object.assert":'!!"{{ref}}" falló validacion porque "{{ref}}" falló a {{message}}',"object.rename.multiple":'{{#label}}: no se puede renombrar el hijo "{{from}}" porque múltiples re-nombramientos estan deshabilitados y otra clave fue renombrada a "{{to}}"',"object.rename.override":'{{#label}}: no se puede renombrar el hijo "{{from}}" porque la sobre escritura esta deshabilitada y el target "{{to}}" existe',"object.type":'{{#label}}: debe ser una instancia de "{{type}}"',"number.base":"{{#label}}: debe ser un número","number.min":"{{#label}}: debe ser mayor o igual que {{limit}}","number.max":"{{#label}}: debe ser menor o igual que {{limit}}","number.less":"{{#label}}: debe ser menor a {{limit}}","number.greater":"{{#label}}: debe ser mayor a {{limit}}","number.float":"{{#label}}: debe ser un numero flotante","number.integer":"{{#label}}: debe ser un número entero","number.negative":"{{#label}}: debe ser un número negativo","number.positive":"{{#label}}: debe ser un número positivo","number.precision":"{{#label}}: no debe tener mas de {{limit}} decimales","number.ref":'{{#label}}: referencia a "{{ref}}" que no es un número',"number.multiple":"{{#label}}: debe ser un múltiplo de {{multiple}}","string.base":"{{#label}}: debe ser una cadena de texto","string.empty":"{{#label}}: no está permitido que sea vacío","string.min":"{{#label}}: debe ser mínimo de {{limit}} caracteres de largo","string.max":"{{#label}}: debe ser de máximo {{limit}} caracteres de largo","string.length":"{{#label}}: debe ser exactamente de {{limit}} caracteres de largo","string.alphanum":"{{#label}}: debe contener solo letras y números","string.token":"{{#label}}: debe contener solo letras, números y guines bajos","string.regex.base":'{{#label}}: el valor "{{!value}}" no coincide con el pattern requerido: {{pattern}}',"string.regex.name":'{{#label}}: el valor "{{!value}}" no coincide con el nombre de pattern {{name}}',"string.email":"{{#label}}: debe ser un email válido","string.uri":"{{#label}}: debe sre una uri válida","string.uriCustomScheme":"{{#label}}: debe ser una uri válida con el esquema concidiente con el patrón {{scheme}}","string.isoDate":"{{#label}}: debe ser una fecha en formato ISO 8601 válida","string.guid":"{{#label}}: debe ser un GUID valido","string.hex":"{{#label}}: debe contener solo caracteres hexadecimales","string.hostname":"{{#label}}: deber ser un hostname válido","string.lowercase":"{{#label}}: solo debe contener minúsculas","string.uppercase":"{{#label}}: solo debe contener mayúsculas","string.trim":"{{#label}}: no debe tener espacios en blanco delante o atrás","string.creditCard":"{{#label}}: debe ser una tarjeta de crédito","string.ref":'Referencia "{{ref}}" que no es un número',"string.ip":"{{#label}}: debe ser una dirección ip válida con un CDIR {{cidr}}","string.ipVersion":"{{#label}}: debe ser una dirección ip válida de una de las siguientes versiones {{version}} con un CDIR {{cidr}}","object.unknown":"{{#label}}: es un campo no es permitido","luxon.lt":"{{#label}}: must be before {{#date}}","luxon.gt":"{{#label}}: must be after {{#date}}","luxon.lte":"{{#label}}: must be same as or before {{#date}}","luxon.gte":"{{#label}}: must be same as or after {{#date}}"},uf=D.createContext({attributes:{role:"button",tabIndex:0,"aria-disabled":!1,"aria-pressed":void 0,"aria-roledescription":"sortable","aria-describedby":""},listeners:void 0,ref(){},isDragging:!1});function Uw(t){return t.isSorting||t.wasDragging?S0(t):!0}function cf({id:t,children:a,isActive:s=!1,hidden:o=!1,onActivate:l,disabled:d=!1}){const{attributes:c,isDragging:m,listeners:g,setNodeRef:x,setActivatorNodeRef:v,transform:b,transition:j}=rd({animateLayoutChanges:Uw,id:t,disabled:d}),_={transform:gi.Translate.toString(b),transition:j},N=D.useMemo(()=>({attributes:c,listeners:g,ref:v,isDragging:m}),[c,m,g,v]);return r.jsx(uf.Provider,{value:N,children:r.jsx(jt,{id:String(t),hidden:o,"data-active-item":s?"detail":void 0,className:me(m?"opacity-60":"opacity-100",s?"border border-destructive/30 border-b-0 border-l-4 border-l-destructive bg-destructive/5 hover:bg-destructive/5 focus-within:bg-destructive/5":"hover:bg-muted hover:focus-within:bg-accent focus-within:bg-accent","group/detail m-0"),ref:x,style:_,onClick:l,onFocusCapture:l,children:a},t)})}const zw=({className:t})=>{const{attributes:a,isDragging:s,listeners:o,ref:l}=D.useContext(uf);return r.jsxs(U,{ref:l,onClick:d=>{d.preventDefault()},size:"icon",variant:"link",className:me(s?"cursor-grabbing":"cursor-grab","w-4 h-4 mt-2 text-ring hover:text-muted-foreground touch-none","transition-opacity motion-reduce:transition-none group-hover/detail:opacity-100 focus-visible:opacity-100 [@media(hover:none)]:opacity-100",s?"opacity-100":"opacity-0",t),...a,...o,children:[r.jsx(Pd,{className:"w-4 h-4"}),r.jsx("span",{className:"sr-only",children:C("common.move_row")})]})};function Vw(t,a={}){const{t:s}=We(),{enableDragHandleColumn:o=!1,enableSelectionColumn:l=!1,enableActionsColumn:d=!1,rowActionFn:c=void 0}=a;return D.useMemo(()=>{const m=[...t];return l&&m.unshift({id:"select",header:({table:g})=>r.jsx(ds,{id:"select-all",checked:g.getIsAllPageRowsSelected()||g.getIsSomePageRowsSelected()&&"indeterminate",onCheckedChange:x=>g.toggleAllPageRowsSelected(!!x),"aria-label":s("common.select_all"),className:"translate-y-[0px]"}),cell:({row:g})=>r.jsx(ds,{id:`select-row-${g.id}`,checked:g.getIsSelected(),disabled:!g.getCanSelect(),onCheckedChange:x=>g.toggleSelected(!!x),"aria-label":s("common.select_row"),className:"mt-2 opacity-0 data-[state=checked]:opacity-100 transition-opacity group-hover/detail:opacity-100 focus-visible:opacity-100 motion-reduce:transition-none [@media(hover:none)]:opacity-100"}),enableSorting:!1,enableHiding:!1,size:40}),o&&m.unshift({id:"row_drag_handle",header:()=>null,cell:()=>r.jsx(zw,{}),enableSorting:!1,enableHiding:!1,size:40}),d&&m.push({id:"row_actions",cell:g=>r.jsx(Cw,{rowContext:g,actions:c}),enableSorting:!1,enableHiding:!1,size:48}),m},[t,d,o,l,c,s])}var df={exports:{}};(function(t,a){(function(s,o,l){t.exports=l(),t.exports.default=l()})("slugify",Ir,function(){var s=JSON.parse(`{"$":"dollar","%":"percent","&":"and","<":"less",">":"greater","|":"or","¢":"cent","£":"pound","¤":"currency","¥":"yen","©":"(c)","ª":"a","®":"(r)","º":"o","À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","Æ":"AE","Ç":"C","È":"E","É":"E","Ê":"E","Ë":"E","Ì":"I","Í":"I","Î":"I","Ï":"I","Ð":"D","Ñ":"N","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","Ù":"U","Ú":"U","Û":"U","Ü":"U","Ý":"Y","Þ":"TH","ß":"ss","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","æ":"ae","ç":"c","è":"e","é":"e","ê":"e","ë":"e","ì":"i","í":"i","î":"i","ï":"i","ð":"d","ñ":"n","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","ù":"u","ú":"u","û":"u","ü":"u","ý":"y","þ":"th","ÿ":"y","Ā":"A","ā":"a","Ă":"A","ă":"a","Ą":"A","ą":"a","Ć":"C","ć":"c","Č":"C","č":"c","Ď":"D","ď":"d","Đ":"DJ","đ":"dj","Ē":"E","ē":"e","Ė":"E","ė":"e","Ę":"e","ę":"e","Ě":"E","ě":"e","Ğ":"G","ğ":"g","Ģ":"G","ģ":"g","Ĩ":"I","ĩ":"i","Ī":"i","ī":"i","Į":"I","į":"i","İ":"I","ı":"i","Ķ":"k","ķ":"k","Ļ":"L","ļ":"l","Ľ":"L","ľ":"l","Ł":"L","ł":"l","Ń":"N","ń":"n","Ņ":"N","ņ":"n","Ň":"N","ň":"n","Ō":"O","ō":"o","Ő":"O","ő":"o","Œ":"OE","œ":"oe","Ŕ":"R","ŕ":"r","Ř":"R","ř":"r","Ś":"S","ś":"s","Ş":"S","ş":"s","Š":"S","š":"s","Ţ":"T","ţ":"t","Ť":"T","ť":"t","Ũ":"U","ũ":"u","Ū":"u","ū":"u","Ů":"U","ů":"u","Ű":"U","ű":"u","Ų":"U","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","ź":"z","Ż":"Z","ż":"z","Ž":"Z","ž":"z","Ə":"E","ƒ":"f","Ơ":"O","ơ":"o","Ư":"U","ư":"u","Lj":"LJ","lj":"lj","Nj":"NJ","nj":"nj","Ș":"S","ș":"s","Ț":"T","ț":"t","ə":"e","˚":"o","Ά":"A","Έ":"E","Ή":"H","Ί":"I","Ό":"O","Ύ":"Y","Ώ":"W","ΐ":"i","Α":"A","Β":"B","Γ":"G","Δ":"D","Ε":"E","Ζ":"Z","Η":"H","Θ":"8","Ι":"I","Κ":"K","Λ":"L","Μ":"M","Ν":"N","Ξ":"3","Ο":"O","Π":"P","Ρ":"R","Σ":"S","Τ":"T","Υ":"Y","Φ":"F","Χ":"X","Ψ":"PS","Ω":"W","Ϊ":"I","Ϋ":"Y","ά":"a","έ":"e","ή":"h","ί":"i","ΰ":"y","α":"a","β":"b","γ":"g","δ":"d","ε":"e","ζ":"z","η":"h","θ":"8","ι":"i","κ":"k","λ":"l","μ":"m","ν":"n","ξ":"3","ο":"o","π":"p","ρ":"r","ς":"s","σ":"s","τ":"t","υ":"y","φ":"f","χ":"x","ψ":"ps","ω":"w","ϊ":"i","ϋ":"y","ό":"o","ύ":"y","ώ":"w","Ё":"Yo","Ђ":"DJ","Є":"Ye","І":"I","Ї":"Yi","Ј":"J","Љ":"LJ","Њ":"NJ","Ћ":"C","Џ":"DZ","А":"A","Б":"B","В":"V","Г":"G","Д":"D","Е":"E","Ж":"Zh","З":"Z","И":"I","Й":"J","К":"K","Л":"L","М":"M","Н":"N","О":"O","П":"P","Р":"R","С":"S","Т":"T","У":"U","Ф":"F","Х":"H","Ц":"C","Ч":"Ch","Ш":"Sh","Щ":"Sh","Ъ":"U","Ы":"Y","Ь":"","Э":"E","Ю":"Yu","Я":"Ya","а":"a","б":"b","в":"v","г":"g","д":"d","е":"e","ж":"zh","з":"z","и":"i","й":"j","к":"k","л":"l","м":"m","н":"n","о":"o","п":"p","р":"r","с":"s","т":"t","у":"u","ф":"f","х":"h","ц":"c","ч":"ch","ш":"sh","щ":"sh","ъ":"u","ы":"y","ь":"","э":"e","ю":"yu","я":"ya","ё":"yo","ђ":"dj","є":"ye","і":"i","ї":"yi","ј":"j","љ":"lj","њ":"nj","ћ":"c","ѝ":"u","џ":"dz","Ґ":"G","ґ":"g","Ғ":"GH","ғ":"gh","Қ":"KH","қ":"kh","Ң":"NG","ң":"ng","Ү":"UE","ү":"ue","Ұ":"U","ұ":"u","Һ":"H","һ":"h","Ә":"AE","ә":"ae","Ө":"OE","ө":"oe","Ա":"A","Բ":"B","Գ":"G","Դ":"D","Ե":"E","Զ":"Z","Է":"E'","Ը":"Y'","Թ":"T'","Ժ":"JH","Ի":"I","Լ":"L","Խ":"X","Ծ":"C'","Կ":"K","Հ":"H","Ձ":"D'","Ղ":"GH","Ճ":"TW","Մ":"M","Յ":"Y","Ն":"N","Շ":"SH","Չ":"CH","Պ":"P","Ջ":"J","Ռ":"R'","Ս":"S","Վ":"V","Տ":"T","Ր":"R","Ց":"C","Փ":"P'","Ք":"Q'","Օ":"O''","Ֆ":"F","և":"EV","ء":"a","آ":"aa","أ":"a","ؤ":"u","إ":"i","ئ":"e","ا":"a","ب":"b","ة":"h","ت":"t","ث":"th","ج":"j","ح":"h","خ":"kh","د":"d","ذ":"th","ر":"r","ز":"z","س":"s","ش":"sh","ص":"s","ض":"dh","ط":"t","ظ":"z","ع":"a","غ":"gh","ف":"f","ق":"q","ك":"k","ل":"l","م":"m","ن":"n","ه":"h","و":"w","ى":"a","ي":"y","ً":"an","ٌ":"on","ٍ":"en","َ":"a","ُ":"u","ِ":"e","ْ":"","٠":"0","١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","پ":"p","چ":"ch","ژ":"zh","ک":"k","گ":"g","ی":"y","۰":"0","۱":"1","۲":"2","۳":"3","۴":"4","۵":"5","۶":"6","۷":"7","۸":"8","۹":"9","฿":"baht","ა":"a","ბ":"b","გ":"g","დ":"d","ე":"e","ვ":"v","ზ":"z","თ":"t","ი":"i","კ":"k","ლ":"l","მ":"m","ნ":"n","ო":"o","პ":"p","ჟ":"zh","რ":"r","ს":"s","ტ":"t","უ":"u","ფ":"f","ქ":"k","ღ":"gh","ყ":"q","შ":"sh","ჩ":"ch","ც":"ts","ძ":"dz","წ":"ts","ჭ":"ch","ხ":"kh","ჯ":"j","ჰ":"h","Ṣ":"S","ṣ":"s","Ẁ":"W","ẁ":"w","Ẃ":"W","ẃ":"w","Ẅ":"W","ẅ":"w","ẞ":"SS","Ạ":"A","ạ":"a","Ả":"A","ả":"a","Ấ":"A","ấ":"a","Ầ":"A","ầ":"a","Ẩ":"A","ẩ":"a","Ẫ":"A","ẫ":"a","Ậ":"A","ậ":"a","Ắ":"A","ắ":"a","Ằ":"A","ằ":"a","Ẳ":"A","ẳ":"a","Ẵ":"A","ẵ":"a","Ặ":"A","ặ":"a","Ẹ":"E","ẹ":"e","Ẻ":"E","ẻ":"e","Ẽ":"E","ẽ":"e","Ế":"E","ế":"e","Ề":"E","ề":"e","Ể":"E","ể":"e","Ễ":"E","ễ":"e","Ệ":"E","ệ":"e","Ỉ":"I","ỉ":"i","Ị":"I","ị":"i","Ọ":"O","ọ":"o","Ỏ":"O","ỏ":"o","Ố":"O","ố":"o","Ồ":"O","ồ":"o","Ổ":"O","ổ":"o","Ỗ":"O","ỗ":"o","Ộ":"O","ộ":"o","Ớ":"O","ớ":"o","Ờ":"O","ờ":"o","Ở":"O","ở":"o","Ỡ":"O","ỡ":"o","Ợ":"O","ợ":"o","Ụ":"U","ụ":"u","Ủ":"U","ủ":"u","Ứ":"U","ứ":"u","Ừ":"U","ừ":"u","Ử":"U","ử":"u","Ữ":"U","ữ":"u","Ự":"U","ự":"u","Ỳ":"Y","ỳ":"y","Ỵ":"Y","ỵ":"y","Ỷ":"Y","ỷ":"y","Ỹ":"Y","ỹ":"y","–":"-","‘":"'","’":"'","“":"\\"","”":"\\"","„":"\\"","†":"+","•":"*","…":"...","₠":"ecu","₢":"cruzeiro","₣":"french franc","₤":"lira","₥":"mill","₦":"naira","₧":"peseta","₨":"rupee","₩":"won","₪":"new shequel","₫":"dong","€":"euro","₭":"kip","₮":"tugrik","₯":"drachma","₰":"penny","₱":"peso","₲":"guarani","₳":"austral","₴":"hryvnia","₵":"cedi","₸":"kazakhstani tenge","₹":"indian rupee","₺":"turkish lira","₽":"russian ruble","₿":"bitcoin","℠":"sm","™":"tm","∂":"d","∆":"delta","∑":"sum","∞":"infinity","♥":"love","元":"yuan","円":"yen","﷼":"rial","ﻵ":"laa","ﻷ":"laa","ﻹ":"lai","ﻻ":"la"}`),o=JSON.parse('{"bg":{"Й":"Y","Ц":"Ts","Щ":"Sht","Ъ":"A","Ь":"Y","й":"y","ц":"ts","щ":"sht","ъ":"a","ь":"y"},"de":{"Ä":"AE","ä":"ae","Ö":"OE","ö":"oe","Ü":"UE","ü":"ue","ß":"ss","%":"prozent","&":"und","|":"oder","∑":"summe","∞":"unendlich","♥":"liebe"},"es":{"%":"por ciento","&":"y","<":"menor que",">":"mayor que","|":"o","¢":"centavos","£":"libras","¤":"moneda","₣":"francos","∑":"suma","∞":"infinito","♥":"amor"},"fr":{"%":"pourcent","&":"et","<":"plus petit",">":"plus grand","|":"ou","¢":"centime","£":"livre","¤":"devise","₣":"franc","∑":"somme","∞":"infini","♥":"amour"},"pt":{"%":"porcento","&":"e","<":"menor",">":"maior","|":"ou","¢":"centavo","∑":"soma","£":"libra","∞":"infinito","♥":"amor"},"uk":{"И":"Y","и":"y","Й":"Y","й":"y","Ц":"Ts","ц":"ts","Х":"Kh","х":"kh","Щ":"Shch","щ":"shch","Г":"H","г":"h"},"vi":{"Đ":"D","đ":"d"},"da":{"Ø":"OE","ø":"oe","Å":"AA","å":"aa","%":"procent","&":"og","|":"eller","$":"dollar","<":"mindre end",">":"større end"},"nb":{"&":"og","Å":"AA","Æ":"AE","Ø":"OE","å":"aa","æ":"ae","ø":"oe"},"it":{"&":"e"},"nl":{"&":"en"},"sv":{"&":"och","Å":"AA","Ä":"AE","Ö":"OE","å":"aa","ä":"ae","ö":"oe"}}');function l(d,c){if(typeof d!="string")throw new Error("slugify: string argument expected");c=typeof c=="string"?{replacement:c}:c||{};var m=o[c.locale]||{},g=c.replacement===void 0?"-":c.replacement,x=c.trim===void 0?!0:c.trim,v=d.normalize().split("").reduce(function(b,j){var _=m[j];return _===void 0&&(_=s[j]),_===void 0&&(_=j),_===g&&(_=" "),b+_.replace(c.remove||/[^\w\s$*_+~.()'"!\-:@]+/g,"")},"");return c.strict&&(v=v.replace(/[^A-Za-z0-9\s]/g,"")),x&&(v=v.trim()),v=v.replace(/\s+/g,g),c.lower&&(v=v.toLowerCase()),v}return l.extend=function(d){Object.assign(s,d)},l})})(df);var Hw=df.exports;const Gw=N0(Hw),Br=()=>{const t=fs(),a=cr(),{i18n:s}=We(),o=D.useCallback(c=>`${t.getApiUrl()}/quotes/${c}/report`,[t]),l=D.useCallback(c=>`quote-${Gw(c.reference,{lower:!0,strict:!0,locale:"en",trim:!0})}.pdf`,[]),d={useList:c=>{const m=fs(),g=cr(),{pagination:x,status:v="draft",quickSearchTerm:b=void 0,enabled:j=!0,queryOptions:_}=c;return Uo({queryKey:g().data().resource("quotes").action("list").params(c).get(),queryFn:()=>m.getList({resource:"quotes",quickSearchTerm:b,filters:v!=="all"?[{field:"status",operator:"eq",value:v}]:[{field:"status",operator:"ne",value:"archived"}],pagination:x}),enabled:j,queryOptions:_})},useCreate:()=>{const c=jn();return Nb({mutationFn:m=>{const{date:g}=m,x=wn.generateNewID().object.toString();return t.createOne({resource:"quotes",data:{...m,date:new Date(g).toISOString().slice(0,10),status:"draft",id:x}})},onSuccess:()=>{c.invalidateQueries({queryKey:["data","default","quotes"]})}})},useUpdate:c=>{const m=jn();return sn({mutationKey:a().data().resource("quotes").action("one").id(c).params().get(),mutationFn:g=>t.updateOne({resource:"quotes",id:c,data:g}),onSuccess:()=>{m.invalidateQueries({queryKey:["data","default","quotes"]})}})},useExchangeRate:()=>sn({mutationFn:({currency:c,date:m})=>t.custom({url:`${t.getApiUrl()}/quotes/exchange-rate?currency=${encodeURIComponent(c)}&date=${encodeURIComponent(m)}`,method:"get"})}),useSetStatus:()=>{const c=jn();return sn({mutationFn:m=>{const{id:g,newStatus:x}=m;return t.custom({url:`${t.getApiUrl()}/quotes/${g}/setStatus`,method:"put",data:{newStatus:x}})},onSuccess:()=>{c.invalidateQueries({queryKey:["data","default","quotes"]})}})},useDuplicate:()=>{const c=jn();return sn({mutationFn:m=>{const{id:g}=m;return t.custom({url:`${t.getApiUrl()}/quotes/${g}/duplicate`,method:"post"})},onSuccess:()=>{c.invalidateQueries({queryKey:["data","default","quotes"]})}})},useSentTo:c=>{const m=jn();return sn({mutationKey:a().data().resource("quotes").action("one").id(c).params().get(),mutationFn:g=>{const{sent_date:x}=g;return t.custom({url:`${t.getApiUrl()}/quotes/${c}/send`,method:"put",data:{sent_date:x}})},onSuccess:()=>{m.invalidateQueries({queryKey:["data","default","quotes"]})}})},useOne:(c,m)=>Ud({queryKey:a().data().resource("quotes").action("one").id(c).params({language:s.language}).get(),queryFn:()=>t.getOne({resource:"quotes",id:String(c)}),enabled:!!c,...m}),getQuotePDFDownloadURL:o,getQuotePDFFilename:l,useReport:()=>{const c=t.getApiAuthorization(),[m,g]=D.useState(void 0),{download:x,...v}=kc({headers:{Authorization:c},customHandleDownload:D.useCallback(j=>{const _=[j],N=new Blob(_,{type:"application/octet-stream"});return g(N),!0},[g])}),b=D.useCallback(j=>x(d.getQuotePDFDownloadURL(j),""),[x]);return{...v,preview:b,report:m}},useDownloader:()=>{const c=t.getApiAuthorization(),m=kc({headers:{Authorization:c}});return{...m,download:(x,v)=>{const b=d.getQuotePDFDownloadURL(x);return m.download(b,v)}}}};return d},xo=(t,a=!1)=>{const{discount:s,tax:o,subtotal_price:l}=t||{},d=on.create(s||{amount:null,scale:2});if(d.isFailure)throw d.error;const c=d.object,m=on.create(o||{amount:null,scale:2});if(m.isFailure)throw m.error;const g=m.object,x=It.create(l||{amount:null,scale:2});if(x.isFailure)throw x.error;const v=a?Kw(t.items,t.currency_code).convertScale(2):x.object,b=v.percentage(c.toNumber()).convertScale(2),j=v.subtract(b).convertScale(2),_=j.percentage(g.toNumber()).convertScale(2),N=j.add(_).convertScale(2);return{subtotal_price:v,discount:t.discount,discount_price:b,before_tax_price:j,tax:g,tax_price:_,total_price:N}},Kw=(t,a="EUR")=>{let s=It.create({currencyCode:a,amount:0,scale:2}).object;return t&&t.map(o=>{const l=vi(o);l.total_price.isNull()||(s=s.add(l.total_price))}),s},vi=t=>{const{quantity:a,unit_price:s,discount:o}=t||{};if((!a||a&&a.amount===null)&&(!s||s&&s.amount===null)&&(!o||o&&o.amount===null))return{quantity:Kn.create({amount:null,scale:0}).object,unit_price:It.create({amount:null,scale:2}).object,subtotal_price:It.create({amount:null,scale:2}).object,discount:on.create({amount:null,scale:2}).object,total_price:It.create({amount:null,scale:2}).object};const l=Kn.create(a);if(l.isFailure)throw l.error;const d=l.object,c=It.create({...s,currencyCode:s==null?void 0:s.currency_code});if(c.isFailure)throw c.error;const m=c.object,g=on.create(o);if(g.isFailure)throw g.error;const x=g.object,v=d.isNull()||m.isNull()?It.create({amount:null,scale:2,currencyCode:s==null?void 0:s.currency_code}).object:m.multiply(d.toNumber()),b=v.isNull()?v:v.subtract(v.percentage(x.toNumber()));return{quantity:d,unit_price:m,subtotal_price:v,discount:x,total_price:b}},ff=()=>wn.generateNewID().object.toString();function gr(t){if(t.chapters.length&&t.items.some(a=>!t.chapters.some(s=>s.id===a.chapter_id)))throw new Error("A detail must belong to an existing chapter");return{chapters:t.chapters,items:t.chapters.length?t.chapters.flatMap(a=>t.items.filter(s=>s.chapter_id===a.id)):t.items.map(a=>({...a,chapter_id:null}))}}function Ww(t){return{...t,chapters:(t.chapters??[]).map(({id:a,description:s})=>({id:a,description:s})),show_chapter_line_amounts:t.show_chapter_line_amounts??!0,items:t.items.map(a=>{const s={...a};return delete s.localized_description,s})}}function Qw(t,a,s,o=ff){if(!a.trim())throw new Error("Chapter description is required");const l={id:o(),description:a},d=t.chapters.findIndex(m=>m.id===s),c=[...t.chapters];return c.splice(d<0?c.length:d+1,0,l),gr({chapters:c,items:t.chapters.length?t.items:t.items.map(m=>({...m,chapter_id:l.id}))})}function di(t,a,s,o,l=!1){var m,g;const d=((m=t.chapters.find(x=>x.id===s))==null?void 0:m.id)??((g=t.chapters[t.chapters.length-1])==null?void 0:g.id)??null,c=[...t.items];return c.splice(o===void 0?c.length:o+Number(l),0,{...a,chapter_id:d}),gr({...t,items:c})}function Yw(t,a,s,o=ff){const l=new Set(a),d=new Set(s),c=t.chapters.filter(v=>l.has(v.id)).map(v=>({...v,id:o()})),m=[...t.chapters],g=t.chapters.reduce((v,b,j)=>l.has(b.id)?j:v,-1);m.splice(g+1,0,...c);const x=[...t.items];return t.chapters.forEach(v=>{if(l.has(v.id))return;const b=t.items.filter((_,N)=>_.chapter_id===v.id&&d.has(N));if(!b.length)return;const j=x.indexOf(b[b.length-1]);x.splice(j+1,0,...b.map(_=>({..._})))}),t.chapters.filter(v=>l.has(v.id)).forEach((v,b)=>{x.push(...t.items.filter(j=>j.chapter_id===v.id).map(j=>({...j,chapter_id:c[b].id})))}),gr({chapters:m,items:x})}function $c(t){return{chapters:[],items:gr(t).items.map(a=>({...a,chapter_id:null}))}}function Bc(t,a,s,o){const l=new Set(a),d=new Set(s),c=t.chapters.filter(x=>!l.has(x.id));if(o&&!c.some(x=>x.id===o))throw new Error("Invalid destination chapter");const m=(x,v)=>d.has(v)||l.has(x.chapter_id??""),g=t.items.filter((x,v)=>!m(x,v));return o&&g.push(...t.items.filter(m).map(x=>({...x,chapter_id:o}))),gr({chapters:c,items:g})}function Xw(t,a,s,o){const l=new Set(a);if(l.has(s))return t;const d=t.chapters.filter(m=>!l.has(m.id)),c=d.findIndex(m=>m.id===s);return c<0?t:(d.splice(c+Number(o),0,...t.chapters.filter(m=>l.has(m.id))),gr({chapters:d,items:t.items}))}function Zw(t,a,s,o,l=!1){if(!t.chapters.some(x=>x.id===s))return t;const d=new Set(a);if(o!==void 0&&d.has(o))return t;const c=t.items.filter((x,v)=>d.has(v)).map(x=>({...x,chapter_id:s})),m=t.items.filter((x,v)=>!d.has(v)),g=o===void 0?m.length:m.indexOf(t.items[o]);return m.splice(g<0?m.length:g+Number(l),0,...c),gr({chapters:t.chapters,items:m})}function Jw(t,a,s){return t.reduce((o,l)=>{var d,c;return l.chapter_id!==a||((d=l.quantity)==null?void 0:d.amount)==null||((c=l.unit_price)==null?void 0:c.amount)==null?o:o.add(vi(l).total_price)},It.create({amount:0,scale:2,currencyCode:s}).object)}const ej=[],tj=[];function nj(t){const{control:a,getValues:s,setValue:o,setFocus:l,clearErrors:d}=ln(),c=rn({control:a,name:"chapters"})??ej,m=rn({control:a,name:"items"})??tj,[g,x]=D.useState(null),v=D.useRef(null);D.useEffect(()=>{const A=c.findIndex(E=>E.id===v.current);A>=0&&(l(`chapters.${A}.description`),v.current=null)},[c,l]);const b=A=>{v.current=A,x(A)},j=D.useRef(null),_=()=>{var A;return c.some(E=>E.id===g)?g:((A=c[c.length-1])==null?void 0:A.id)??null},N=()=>({chapters:s("chapters")??[],items:s("items")??[]}),I=A=>{d("chapters"),o("chapters",A.chapters.map(({id:E,description:T})=>({id:E,description:T})),{shouldDirty:!0}),t(A.items)};return{chapters:c,items:m,activeId:g,setActiveId:x,focusTitle:b,destination:_,read:N,apply:I,capturePickerTarget:A=>{j.current=A??_()},appendPickedItem:A=>I(di(N(),A,j.current))}}const rj={droppable:{strategy:A0.Always}};function sj({columns:t,data:a,defaultValues:s,initialState:o,actions:l,showLineDiscountColumn:d}){const[c,m]=D.useState({}),[g,x]=D.useState(),[v,b]=D.useState(null),j=D.useMemo(()=>a.map(E=>E.id),[a]),_=Wo({data:a,columns:t,enableColumnResizing:!1,columnResizeMode:"onChange",autoResetAll:!1,initialState:o,state:{rowSelection:c,columnVisibility:{...o==null?void 0:o.columnVisibility,discount:d}},enableRowSelection:!0,enableMultiRowSelection:!0,enableSorting:!1,enableHiding:!0,onRowSelectionChange:m,getCoreRowModel:Ko(),getRowId:E=>E==null?void 0:E.id,debugTable:!1,debugHeaders:!1,debugColumns:!1,defaultColumn:{minSize:0,size:Number.MAX_SAFE_INTEGER,maxSize:Number.MAX_SAFE_INTEGER},meta:{insertItem:(E,T)=>{l.insert(E,T||(s==null?void 0:s.items[0]),{shouldFocus:!0})},appendItem:E=>{l.append(E||(s==null?void 0:s.items[0]),{shouldFocus:!0})},pickCatalogArticle:()=>{l.pickCatalogArticle&&(l==null||l.pickCatalogArticle())},pickBlock:()=>{l.pickBlock&&(l==null||l.pickBlock())},duplicateItems:E=>{var T;if(E!=null){const q=((T=l.getItem)==null?void 0:T.call(l,E))??_.getRowModel().rows[E].original;l.insert(E+1,{...q,id:void 0},{shouldFocus:!0})}else if(_.getSelectedRowModel().rows.length){const q=_.getSelectedRowModel().rows[_.getSelectedRowModel().rows.length-1].index,Y=_.getSelectedRowModel().rows.map(H=>({...H.original,id:void 0}));_.getRowModel().rows.length<q+1?l.append(Y):l.insert(q+1,Y,{shouldFocus:!0}),_.resetRowSelection()}},deleteItems:E=>{if(E!=null)l.remove(E);else if(_.getSelectedRowModel().rows.length>0){let T=_.getSelectedRowModel().rows.length-1;for(;T>=0;T--){const q=j.indexOf(String(_.getSelectedRowModel().rows[T].id));l.remove(q),j.splice(q,1)}_.resetRowSelection()}else l.remove()},updateItem:(E,T,q,Y)=>{l.update(E,{...T,[`${q}`]:Y})}}}),N=sd(Fr(E0,{}),Fr(R0,{}),Fr(ad,{}),Fr(id,{}));function I(E){var Y;let T=E.active.id,q=(Y=E.over)==null?void 0:Y.id;if(q!==void 0&&T!==q){let H=j.indexOf(String(q));if(_.getSelectedRowModel().rows.length>1)_.getSelectedRowModel().rows.forEach((ce,pe)=>{const le=j.indexOf(String(ce.id));pe>0&&(T=ce.id,H=j.indexOf(String(q)),H<le&&(H=H+1)),l.move(le,H),j.splice(H,0,j.splice(le,1)[0]),q=ce.id});else{const ce=j.indexOf(String(T));l.move(ce,H)}}x(null)}function $({active:E}){_.getSelectedRowModel().rowsById[E.id]||_.resetRowSelection(),x(E.id)}function L(){x(null)}function A(E){return g?E.filter(T=>{const q=typeof T=="string"?T:T.id;return q===g||!_.getSelectedRowModel().rowsById[q]}):E}return{table:_,activeId:g,activeRowId:v,setActiveRowId:b,rows:A(_.getRowModel().rows),sortableRowIds:A(j),dragContextProps:{sensors:N,measuring:rj,collisionDetection:od,onDragEnd:I,onDragStart:$,onDragCancel:L}}}const Zj=()=>{const t=un(),{i18n:a}=We(),{toast:s}=Qn(),{useCreate:o}=Br(),{mutateAsync:l,isPending:d}=o(),[c,m]=D.useState(),g=a.resolvedLanguage??a.language,x=yn.some(({code:A})=>A===g)?g:"es",v=D.useMemo(()=>({date:new Date(Date.now()).toUTCString(),lang_code:x,customer_reference:"",customer_information:""}),[x]),b=Ei({mode:"onBlur",defaultValues:v,resolver:Yc($n.object({customer_reference:$n.string(),date:$n.date().required(),customer_information:$n.string().required(),lang_code:$n.string().valid(...yn.map(({code:A})=>A)).required()}),{messages:{es:Bw}})}),{formState:j,reset:_,handleSubmit:N}=b,{isSubmitting:I,isDirty:$}=j;Qo({isDirty:$}),D.useEffect(()=>{c&&t(`/quotes/edit/${c}`,{relative:"path"})},[c,t]);const L=async A=>{try{const E=await l(A);_(A),s({title:C("quotes.notifications.created"),variant:"default"}),m(E.id)}catch(E){console.debug(E),s({title:C("common.error"),description:E.message,variant:"destructive"})}};return I?r.jsx(dr,{title:C("quotes.notifications.saving")}):d?r.jsx(dr,{}):r.jsx(Ai,{...b,children:r.jsx("form",{onSubmit:N(L),children:r.jsxs("div",{className:"mx-auto grid max-w-[90rem] flex-1 auto-rows-max gap-6",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(ld,{}),r.jsx("h1",{className:"flex-1 text-xl font-semibold tracking-tight shrink-0 whitespace-nowrap sm:grow-0",children:C("quotes.create.title")})]}),r.jsx("div",{className:"grid w-6/12 gap-6 mx-auto",children:r.jsxs(hi,{className:"md:col-span-4",title:C("quotes.create.form_groups.general.title"),description:C("quotes.create.form_groups.general.desc"),footerActions:r.jsxs("div",{className:"flex items-stretch justify-between flex-1",children:[r.jsx(U,{type:"button",size:"sm",variant:"outline",onClick:()=>t("/quotes"),children:C("common.discard")}),r.jsx(ko,{size:"sm",label:C("common.continue")})]}),children:[r.jsx(ur,{required:!0,name:"customer_reference",label:C("quotes.form_fields.customer_reference.label"),description:C("quotes.form_fields.customer_reference.desc"),placeholder:C("quotes.form_fields.customer_reference.placeholder")}),r.jsx(ud,{required:!0,label:C("quotes.form_fields.date.label"),description:C("quotes.form_fields.date.desc"),placeholder:C("quotes.form_fields.date.placeholder"),name:"date"}),r.jsxs("div",{className:"grid gap-2",children:[r.jsx(Jt,{htmlFor:"lang_code",className:"font-semibold",children:C("quotes.form_fields.lang_code.label")}),r.jsx(qr,{control:b.control,name:"lang_code",render:({field:A})=>r.jsxs(Un,{value:A.value||"es",onValueChange:A.onChange,children:[r.jsx(zn,{id:"lang_code","aria-label":C("quotes.form_fields.lang_code.label"),children:r.jsx(Vn,{})}),r.jsx(Hn,{children:yn.map(E=>r.jsxs(Xt,{value:E.code,children:[r.jsx("span",{"aria-hidden":"true",className:`mr-2 ${E.flagClassName}`}),E.name]},E.code))})]})}),r.jsx("p",{className:"text-sm text-muted-foreground",children:C("quotes.form_fields.lang_code.desc")})]}),r.jsx(lr,{}),r.jsx(an,{rows:4,className:"row-span-2",name:"customer_information",required:!0,label:C("quotes.form_fields.customer_information.label"),description:C("quotes.form_fields.customer_information.desc"),placeholder:C("quotes.form_fields.customer_information.placeholder")})]})})]})})})},ij=()=>{const{id:t}=I0();return t};var _i={exports:{}};/**
* @license
* Lodash <https://lodash.com/>
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
* Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
*/_i.exports;(function(t,a){(function(){var s,o="4.17.21",l=200,d="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",c="Expected a function",m="Invalid `variable` option passed into `_.template`",g="__lodash_hash_undefined__",x=500,v="__lodash_placeholder__",b=1,j=2,_=4,N=1,I=2,$=1,L=2,A=4,E=8,T=16,q=32,Y=64,H=128,ce=256,pe=512,le=30,fe="...",V=800,Z=16,xe=1,Be=2,X=3,Pe=1/0,_e=9007199254740991,je=17976931348623157e292,W=NaN,K=4294967295,Se=K-1,Dt=K>>>1,yt=[["ary",H],["bind",$],["bindKey",L],["curry",E],["curryRight",T],["flip",pe],["partial",q],["partialRight",Y],["rearg",ce]],Tt="[object Arguments]",B="[object Array]",be="[object AsyncFunction]",Ee="[object Boolean]",De="[object Date]",Le="[object DOMException]",ye="[object Error]",ge="[object Function]",pt="[object GeneratorFunction]",tt="[object Map]",Ht="[object Number]",An="[object Null]",cn="[object Object]",Jo="[object Promise]",wf="[object Proxy]",Ur="[object RegExp]",Gt="[object Set]",zr="[object String]",vs="[object Symbol]",jf="[object Undefined]",Vr="[object WeakMap]",yf="[object WeakSet]",Hr="[object ArrayBuffer]",hr="[object DataView]",Pi="[object Float32Array]",qi="[object Float64Array]",ki="[object Int8Array]",$i="[object Int16Array]",Bi="[object Int32Array]",Ui="[object Uint8Array]",zi="[object Uint8ClampedArray]",Vi="[object Uint16Array]",Hi="[object Uint32Array]",Cf=/\b__p \+= '';/g,Sf=/\b(__p \+=) '' \+/g,Nf=/(__e\(.*?\)|\b__t\)) \+\n'';/g,el=/&(?:amp|lt|gt|quot|#39);/g,tl=/[&<>"']/g,Rf=RegExp(el.source),Ef=RegExp(tl.source),Af=/<%-([\s\S]+?)%>/g,If=/<%([\s\S]+?)%>/g,nl=/<%=([\s\S]+?)%>/g,Ff=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Df=/^\w*$/,Tf=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Gi=/[\\^$.*+?()[\]{}|]/g,Mf=RegExp(Gi.source),Ki=/^\s+/,Lf=/\s/,Of=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Pf=/\{\n\/\* \[wrapped with (.+)\] \*/,qf=/,? & /,kf=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,$f=/[()=,{}\[\]\/\s]/,Bf=/\\(\\)?/g,Uf=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,rl=/\w*$/,zf=/^[-+]0x[0-9a-f]+$/i,Vf=/^0b[01]+$/i,Hf=/^\[object .+?Constructor\]$/,Gf=/^0o[0-7]+$/i,Kf=/^(?:0|[1-9]\d*)$/,Wf=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_s=/($^)/,Qf=/['\n\r\u2028\u2029\\]/g,bs="\\ud800-\\udfff",Yf="\\u0300-\\u036f",Xf="\\ufe20-\\ufe2f",Zf="\\u20d0-\\u20ff",sl=Yf+Xf+Zf,il="\\u2700-\\u27bf",al="a-z\\xdf-\\xf6\\xf8-\\xff",Jf="\\xac\\xb1\\xd7\\xf7",em="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",tm="\\u2000-\\u206f",nm=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",ol="A-Z\\xc0-\\xd6\\xd8-\\xde",ll="\\ufe0e\\ufe0f",ul=Jf+em+tm+nm,Wi="['’]",rm="["+bs+"]",cl="["+ul+"]",ws="["+sl+"]",dl="\\d+",sm="["+il+"]",fl="["+al+"]",ml="[^"+bs+ul+dl+il+al+ol+"]",Qi="\\ud83c[\\udffb-\\udfff]",im="(?:"+ws+"|"+Qi+")",gl="[^"+bs+"]",Yi="(?:\\ud83c[\\udde6-\\uddff]){2}",Xi="[\\ud800-\\udbff][\\udc00-\\udfff]",pr="["+ol+"]",hl="\\u200d",pl="(?:"+fl+"|"+ml+")",am="(?:"+pr+"|"+ml+")",xl="(?:"+Wi+"(?:d|ll|m|re|s|t|ve))?",vl="(?:"+Wi+"(?:D|LL|M|RE|S|T|VE))?",_l=im+"?",bl="["+ll+"]?",om="(?:"+hl+"(?:"+[gl,Yi,Xi].join("|")+")"+bl+_l+")*",lm="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",um="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",wl=bl+_l+om,cm="(?:"+[sm,Yi,Xi].join("|")+")"+wl,dm="(?:"+[gl+ws+"?",ws,Yi,Xi,rm].join("|")+")",fm=RegExp(Wi,"g"),mm=RegExp(ws,"g"),Zi=RegExp(Qi+"(?="+Qi+")|"+dm+wl,"g"),gm=RegExp([pr+"?"+fl+"+"+xl+"(?="+[cl,pr,"$"].join("|")+")",am+"+"+vl+"(?="+[cl,pr+pl,"$"].join("|")+")",pr+"?"+pl+"+"+xl,pr+"+"+vl,um,lm,dl,cm].join("|"),"g"),hm=RegExp("["+hl+bs+sl+ll+"]"),pm=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,xm=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],vm=-1,qe={};qe[Pi]=qe[qi]=qe[ki]=qe[$i]=qe[Bi]=qe[Ui]=qe[zi]=qe[Vi]=qe[Hi]=!0,qe[Tt]=qe[B]=qe[Hr]=qe[Ee]=qe[hr]=qe[De]=qe[ye]=qe[ge]=qe[tt]=qe[Ht]=qe[cn]=qe[Ur]=qe[Gt]=qe[zr]=qe[Vr]=!1;var Oe={};Oe[Tt]=Oe[B]=Oe[Hr]=Oe[hr]=Oe[Ee]=Oe[De]=Oe[Pi]=Oe[qi]=Oe[ki]=Oe[$i]=Oe[Bi]=Oe[tt]=Oe[Ht]=Oe[cn]=Oe[Ur]=Oe[Gt]=Oe[zr]=Oe[vs]=Oe[Ui]=Oe[zi]=Oe[Vi]=Oe[Hi]=!0,Oe[ye]=Oe[ge]=Oe[Vr]=!1;var _m={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},bm={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},wm={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},jm={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},ym=parseFloat,Cm=parseInt,jl=typeof Ir=="object"&&Ir&&Ir.Object===Object&&Ir,Sm=typeof self=="object"&&self&&self.Object===Object&&self,nt=jl||Sm||Function("return this")(),Ji=a&&!a.nodeType&&a,Yn=Ji&&!0&&t&&!t.nodeType&&t,yl=Yn&&Yn.exports===Ji,ea=yl&&jl.process,Mt=function(){try{var S=Yn&&Yn.require&&Yn.require("util").types;return S||ea&&ea.binding&&ea.binding("util")}catch{}}(),Cl=Mt&&Mt.isArrayBuffer,Sl=Mt&&Mt.isDate,Nl=Mt&&Mt.isMap,Rl=Mt&&Mt.isRegExp,El=Mt&&Mt.isSet,Al=Mt&&Mt.isTypedArray;function Ct(S,M,F){switch(F.length){case 0:return S.call(M);case 1:return S.call(M,F[0]);case 2:return S.call(M,F[0],F[1]);case 3:return S.call(M,F[0],F[1],F[2])}return S.apply(M,F)}function Nm(S,M,F,G){for(var se=-1,Ce=S==null?0:S.length;++se<Ce;){var Xe=S[se];M(G,Xe,F(Xe),S)}return G}function Lt(S,M){for(var F=-1,G=S==null?0:S.length;++F<G&&M(S[F],F,S)!==!1;);return S}function Rm(S,M){for(var F=S==null?0:S.length;F--&&M(S[F],F,S)!==!1;);return S}function Il(S,M){for(var F=-1,G=S==null?0:S.length;++F<G;)if(!M(S[F],F,S))return!1;return!0}function In(S,M){for(var F=-1,G=S==null?0:S.length,se=0,Ce=[];++F<G;){var Xe=S[F];M(Xe,F,S)&&(Ce[se++]=Xe)}return Ce}function js(S,M){var F=S==null?0:S.length;return!!F&&xr(S,M,0)>-1}function ta(S,M,F){for(var G=-1,se=S==null?0:S.length;++G<se;)if(F(M,S[G]))return!0;return!1}function ke(S,M){for(var F=-1,G=S==null?0:S.length,se=Array(G);++F<G;)se[F]=M(S[F],F,S);return se}function Fn(S,M){for(var F=-1,G=M.length,se=S.length;++F<G;)S[se+F]=M[F];return S}function na(S,M,F,G){var se=-1,Ce=S==null?0:S.length;for(G&&Ce&&(F=S[++se]);++se<Ce;)F=M(F,S[se],se,S);return F}function Em(S,M,F,G){var se=S==null?0:S.length;for(G&&se&&(F=S[--se]);se--;)F=M(F,S[se],se,S);return F}function ra(S,M){for(var F=-1,G=S==null?0:S.length;++F<G;)if(M(S[F],F,S))return!0;return!1}var Am=sa("length");function Im(S){return S.split("")}function Fm(S){return S.match(kf)||[]}function Fl(S,M,F){var G;return F(S,function(se,Ce,Xe){if(M(se,Ce,Xe))return G=Ce,!1}),G}function ys(S,M,F,G){for(var se=S.length,Ce=F+(G?1:-1);G?Ce--:++Ce<se;)if(M(S[Ce],Ce,S))return Ce;return-1}function xr(S,M,F){return M===M?zm(S,M,F):ys(S,Dl,F)}function Dm(S,M,F,G){for(var se=F-1,Ce=S.length;++se<Ce;)if(G(S[se],M))return se;return-1}function Dl(S){return S!==S}function Tl(S,M){var F=S==null?0:S.length;return F?aa(S,M)/F:W}function sa(S){return function(M){return M==null?s:M[S]}}function ia(S){return function(M){return S==null?s:S[M]}}function Ml(S,M,F,G,se){return se(S,function(Ce,Xe,Te){F=G?(G=!1,Ce):M(F,Ce,Xe,Te)}),F}function Tm(S,M){var F=S.length;for(S.sort(M);F--;)S[F]=S[F].value;return S}function aa(S,M){for(var F,G=-1,se=S.length;++G<se;){var Ce=M(S[G]);Ce!==s&&(F=F===s?Ce:F+Ce)}return F}function oa(S,M){for(var F=-1,G=Array(S);++F<S;)G[F]=M(F);return G}function Mm(S,M){return ke(M,function(F){return[F,S[F]]})}function Ll(S){return S&&S.slice(0,kl(S)+1).replace(Ki,"")}function St(S){return function(M){return S(M)}}function la(S,M){return ke(M,function(F){return S[F]})}function Gr(S,M){return S.has(M)}function Ol(S,M){for(var F=-1,G=S.length;++F<G&&xr(M,S[F],0)>-1;);return F}function Pl(S,M){for(var F=S.length;F--&&xr(M,S[F],0)>-1;);return F}function Lm(S,M){for(var F=S.length,G=0;F--;)S[F]===M&&++G;return G}var Om=ia(_m),Pm=ia(bm);function qm(S){return"\\"+jm[S]}function km(S,M){return S==null?s:S[M]}function vr(S){return hm.test(S)}function $m(S){return pm.test(S)}function Bm(S){for(var M,F=[];!(M=S.next()).done;)F.push(M.value);return F}function ua(S){var M=-1,F=Array(S.size);return S.forEach(function(G,se){F[++M]=[se,G]}),F}function ql(S,M){return function(F){return S(M(F))}}function Dn(S,M){for(var F=-1,G=S.length,se=0,Ce=[];++F<G;){var Xe=S[F];(Xe===M||Xe===v)&&(S[F]=v,Ce[se++]=F)}return Ce}function Cs(S){var M=-1,F=Array(S.size);return S.forEach(function(G){F[++M]=G}),F}function Um(S){var M=-1,F=Array(S.size);return S.forEach(function(G){F[++M]=[G,G]}),F}function zm(S,M,F){for(var G=F-1,se=S.length;++G<se;)if(S[G]===M)return G;return-1}function Vm(S,M,F){for(var G=F+1;G--;)if(S[G]===M)return G;return G}function _r(S){return vr(S)?Gm(S):Am(S)}function Kt(S){return vr(S)?Km(S):Im(S)}function kl(S){for(var M=S.length;M--&&Lf.test(S.charAt(M)););return M}var Hm=ia(wm);function Gm(S){for(var M=Zi.lastIndex=0;Zi.test(S);)++M;return M}function Km(S){return S.match(Zi)||[]}function Wm(S){return S.match(gm)||[]}var Qm=function S(M){M=M==null?nt:br.defaults(nt.Object(),M,br.pick(nt,xm));var F=M.Array,G=M.Date,se=M.Error,Ce=M.Function,Xe=M.Math,Te=M.Object,ca=M.RegExp,Ym=M.String,Ot=M.TypeError,Ss=F.prototype,Xm=Ce.prototype,wr=Te.prototype,Ns=M["__core-js_shared__"],Rs=Xm.toString,Ae=wr.hasOwnProperty,Zm=0,$l=function(){var e=/[^.]+$/.exec(Ns&&Ns.keys&&Ns.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}(),Es=wr.toString,Jm=Rs.call(Te),eg=nt._,tg=ca("^"+Rs.call(Ae).replace(Gi,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),As=yl?M.Buffer:s,Tn=M.Symbol,Is=M.Uint8Array,Bl=As?As.allocUnsafe:s,Fs=ql(Te.getPrototypeOf,Te),Ul=Te.create,zl=wr.propertyIsEnumerable,Ds=Ss.splice,Vl=Tn?Tn.isConcatSpreadable:s,Kr=Tn?Tn.iterator:s,Xn=Tn?Tn.toStringTag:s,Ts=function(){try{var e=nr(Te,"defineProperty");return e({},"",{}),e}catch{}}(),ng=M.clearTimeout!==nt.clearTimeout&&M.clearTimeout,rg=G&&G.now!==nt.Date.now&&G.now,sg=M.setTimeout!==nt.setTimeout&&M.setTimeout,Ms=Xe.ceil,Ls=Xe.floor,da=Te.getOwnPropertySymbols,ig=As?As.isBuffer:s,Hl=M.isFinite,ag=Ss.join,og=ql(Te.keys,Te),Ze=Xe.max,ut=Xe.min,lg=G.now,ug=M.parseInt,Gl=Xe.random,cg=Ss.reverse,fa=nr(M,"DataView"),Wr=nr(M,"Map"),ma=nr(M,"Promise"),jr=nr(M,"Set"),Qr=nr(M,"WeakMap"),Yr=nr(Te,"create"),Os=Qr&&new Qr,yr={},dg=rr(fa),fg=rr(Wr),mg=rr(ma),gg=rr(jr),hg=rr(Qr),Ps=Tn?Tn.prototype:s,Xr=Ps?Ps.valueOf:s,Kl=Ps?Ps.toString:s;function h(e){if(Ue(e)&&!ie(e)&&!(e instanceof ve)){if(e instanceof Pt)return e;if(Ae.call(e,"__wrapped__"))return Wu(e)}return new Pt(e)}var Cr=function(){function e(){}return function(n){if(!$e(n))return{};if(Ul)return Ul(n);e.prototype=n;var i=new e;return e.prototype=s,i}}();function qs(){}function Pt(e,n){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!n,this.__index__=0,this.__values__=s}h.templateSettings={escape:Af,evaluate:If,interpolate:nl,variable:"",imports:{_:h}},h.prototype=qs.prototype,h.prototype.constructor=h,Pt.prototype=Cr(qs.prototype),Pt.prototype.constructor=Pt;function ve(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=K,this.__views__=[]}function pg(){var e=new ve(this.__wrapped__);return e.__actions__=xt(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=xt(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=xt(this.__views__),e}function xg(){if(this.__filtered__){var e=new ve(this);e.__dir__=-1,e.__filtered__=!0}else e=this.clone(),e.__dir__*=-1;return e}function vg(){var e=this.__wrapped__.value(),n=this.__dir__,i=ie(e),u=n<0,f=i?e.length:0,p=Ih(0,f,this.__views__),w=p.start,y=p.end,R=y-w,O=u?y:w-1,P=this.__iteratees__,k=P.length,z=0,Q=ut(R,this.__takeCount__);if(!i||!u&&f==R&&Q==R)return xu(e,this.__actions__);var ne=[];e:for(;R--&&z<Q;){O+=n;for(var ue=-1,re=e[O];++ue<k;){var he=P[ue],we=he.iteratee,Et=he.type,gt=we(re);if(Et==Be)re=gt;else if(!gt){if(Et==xe)continue e;break e}}ne[z++]=re}return ne}ve.prototype=Cr(qs.prototype),ve.prototype.constructor=ve;function Zn(e){var n=-1,i=e==null?0:e.length;for(this.clear();++n<i;){var u=e[n];this.set(u[0],u[1])}}function _g(){this.__data__=Yr?Yr(null):{},this.size=0}function bg(e){var n=this.has(e)&&delete this.__data__[e];return this.size-=n?1:0,n}function wg(e){var n=this.__data__;if(Yr){var i=n[e];return i===g?s:i}return Ae.call(n,e)?n[e]:s}function jg(e){var n=this.__data__;return Yr?n[e]!==s:Ae.call(n,e)}function yg(e,n){var i=this.__data__;return this.size+=this.has(e)?0:1,i[e]=Yr&&n===s?g:n,this}Zn.prototype.clear=_g,Zn.prototype.delete=bg,Zn.prototype.get=wg,Zn.prototype.has=jg,Zn.prototype.set=yg;function dn(e){var n=-1,i=e==null?0:e.length;for(this.clear();++n<i;){var u=e[n];this.set(u[0],u[1])}}function Cg(){this.__data__=[],this.size=0}function Sg(e){var n=this.__data__,i=ks(n,e);if(i<0)return!1;var u=n.length-1;return i==u?n.pop():Ds.call(n,i,1),--this.size,!0}function Ng(e){var n=this.__data__,i=ks(n,e);return i<0?s:n[i][1]}function Rg(e){return ks(this.__data__,e)>-1}function Eg(e,n){var i=this.__data__,u=ks(i,e);return u<0?(++this.size,i.push([e,n])):i[u][1]=n,this}dn.prototype.clear=Cg,dn.prototype.delete=Sg,dn.prototype.get=Ng,dn.prototype.has=Rg,dn.prototype.set=Eg;function fn(e){var n=-1,i=e==null?0:e.length;for(this.clear();++n<i;){var u=e[n];this.set(u[0],u[1])}}function Ag(){this.size=0,this.__data__={hash:new Zn,map:new(Wr||dn),string:new Zn}}function Ig(e){var n=Xs(this,e).delete(e);return this.size-=n?1:0,n}function Fg(e){return Xs(this,e).get(e)}function Dg(e){return Xs(this,e).has(e)}function Tg(e,n){var i=Xs(this,e),u=i.size;return i.set(e,n),this.size+=i.size==u?0:1,this}fn.prototype.clear=Ag,fn.prototype.delete=Ig,fn.prototype.get=Fg,fn.prototype.has=Dg,fn.prototype.set=Tg;function Jn(e){var n=-1,i=e==null?0:e.length;for(this.__data__=new fn;++n<i;)this.add(e[n])}function Mg(e){return this.__data__.set(e,g),this}function Lg(e){return this.__data__.has(e)}Jn.prototype.add=Jn.prototype.push=Mg,Jn.prototype.has=Lg;function Wt(e){var n=this.__data__=new dn(e);this.size=n.size}function Og(){this.__data__=new dn,this.size=0}function Pg(e){var n=this.__data__,i=n.delete(e);return this.size=n.size,i}function qg(e){return this.__data__.get(e)}function kg(e){return this.__data__.has(e)}function $g(e,n){var i=this.__data__;if(i instanceof dn){var u=i.__data__;if(!Wr||u.length<l-1)return u.push([e,n]),this.size=++i.size,this;i=this.__data__=new fn(u)}return i.set(e,n),this.size=i.size,this}Wt.prototype.clear=Og,Wt.prototype.delete=Pg,Wt.prototype.get=qg,Wt.prototype.has=kg,Wt.prototype.set=$g;function Wl(e,n){var i=ie(e),u=!i&&sr(e),f=!i&&!u&&qn(e),p=!i&&!u&&!f&&Er(e),w=i||u||f||p,y=w?oa(e.length,Ym):[],R=y.length;for(var O in e)(n||Ae.call(e,O))&&!(w&&(O=="length"||f&&(O=="offset"||O=="parent")||p&&(O=="buffer"||O=="byteLength"||O=="byteOffset")||pn(O,R)))&&y.push(O);return y}function Ql(e){var n=e.length;return n?e[Ca(0,n-1)]:s}function Bg(e,n){return Zs(xt(e),er(n,0,e.length))}function Ug(e){return Zs(xt(e))}function ga(e,n,i){(i!==s&&!Qt(e[n],i)||i===s&&!(n in e))&&mn(e,n,i)}function Zr(e,n,i){var u=e[n];(!(Ae.call(e,n)&&Qt(u,i))||i===s&&!(n in e))&&mn(e,n,i)}function ks(e,n){for(var i=e.length;i--;)if(Qt(e[i][0],n))return i;return-1}function zg(e,n,i,u){return Mn(e,function(f,p,w){n(u,f,i(f),w)}),u}function Yl(e,n){return e&&tn(n,Je(n),e)}function Vg(e,n){return e&&tn(n,_t(n),e)}function mn(e,n,i){n=="__proto__"&&Ts?Ts(e,n,{configurable:!0,enumerable:!0,value:i,writable:!0}):e[n]=i}function ha(e,n){for(var i=-1,u=n.length,f=F(u),p=e==null;++i<u;)f[i]=p?s:Qa(e,n[i]);return f}function er(e,n,i){return e===e&&(i!==s&&(e=e<=i?e:i),n!==s&&(e=e>=n?e:n)),e}function qt(e,n,i,u,f,p){var w,y=n&b,R=n&j,O=n&_;if(i&&(w=f?i(e,u,f,p):i(e)),w!==s)return w;if(!$e(e))return e;var P=ie(e);if(P){if(w=Dh(e),!y)return xt(e,w)}else{var k=ct(e),z=k==ge||k==pt;if(qn(e))return bu(e,y);if(k==cn||k==Tt||z&&!f){if(w=R||z?{}:ku(e),!y)return R?wh(e,Vg(w,e)):bh(e,Yl(w,e))}else{if(!Oe[k])return f?e:{};w=Th(e,k,y)}}p||(p=new Wt);var Q=p.get(e);if(Q)return Q;p.set(e,w),gc(e)?e.forEach(function(re){w.add(qt(re,n,i,re,e,p))}):fc(e)&&e.forEach(function(re,he){w.set(he,qt(re,n,i,he,e,p))});var ne=O?R?La:Ma:R?_t:Je,ue=P?s:ne(e);return Lt(ue||e,function(re,he){ue&&(he=re,re=e[he]),Zr(w,he,qt(re,n,i,he,e,p))}),w}function Hg(e){var n=Je(e);return function(i){return Xl(i,e,n)}}function Xl(e,n,i){var u=i.length;if(e==null)return!u;for(e=Te(e);u--;){var f=i[u],p=n[f],w=e[f];if(w===s&&!(f in e)||!p(w))return!1}return!0}function Zl(e,n,i){if(typeof e!="function")throw new Ot(c);return is(function(){e.apply(s,i)},n)}function Jr(e,n,i,u){var f=-1,p=js,w=!0,y=e.length,R=[],O=n.length;if(!y)return R;i&&(n=ke(n,St(i))),u?(p=ta,w=!1):n.length>=l&&(p=Gr,w=!1,n=new Jn(n));e:for(;++f<y;){var P=e[f],k=i==null?P:i(P);if(P=u||P!==0?P:0,w&&k===k){for(var z=O;z--;)if(n[z]===k)continue e;R.push(P)}else p(n,k,u)||R.push(P)}return R}var Mn=Su(en),Jl=Su(xa,!0);function Gg(e,n){var i=!0;return Mn(e,function(u,f,p){return i=!!n(u,f,p),i}),i}function $s(e,n,i){for(var u=-1,f=e.length;++u<f;){var p=e[u],w=n(p);if(w!=null&&(y===s?w===w&&!Rt(w):i(w,y)))var y=w,R=p}return R}function Kg(e,n,i,u){var f=e.length;for(i=oe(i),i<0&&(i=-i>f?0:f+i),u=u===s||u>f?f:oe(u),u<0&&(u+=f),u=i>u?0:pc(u);i<u;)e[i++]=n;return e}function eu(e,n){var i=[];return Mn(e,function(u,f,p){n(u,f,p)&&i.push(u)}),i}function rt(e,n,i,u,f){var p=-1,w=e.length;for(i||(i=Lh),f||(f=[]);++p<w;){var y=e[p];n>0&&i(y)?n>1?rt(y,n-1,i,u,f):Fn(f,y):u||(f[f.length]=y)}return f}var pa=Nu(),tu=Nu(!0);function en(e,n){return e&&pa(e,n,Je)}function xa(e,n){return e&&tu(e,n,Je)}function Bs(e,n){return In(n,function(i){return xn(e[i])})}function tr(e,n){n=On(n,e);for(var i=0,u=n.length;e!=null&&i<u;)e=e[nn(n[i++])];return i&&i==u?e:s}function nu(e,n,i){var u=n(e);return ie(e)?u:Fn(u,i(e))}function ft(e){return e==null?e===s?jf:An:Xn&&Xn in Te(e)?Ah(e):Uh(e)}function va(e,n){return e>n}function Wg(e,n){return e!=null&&Ae.call(e,n)}function Qg(e,n){return e!=null&&n in Te(e)}function Yg(e,n,i){return e>=ut(n,i)&&e<Ze(n,i)}function _a(e,n,i){for(var u=i?ta:js,f=e[0].length,p=e.length,w=p,y=F(p),R=1/0,O=[];w--;){var P=e[w];w&&n&&(P=ke(P,St(n))),R=ut(P.length,R),y[w]=!i&&(n||f>=120&&P.length>=120)?new Jn(w&&P):s}P=e[0];var k=-1,z=y[0];e:for(;++k<f&&O.length<R;){var Q=P[k],ne=n?n(Q):Q;if(Q=i||Q!==0?Q:0,!(z?Gr(z,ne):u(O,ne,i))){for(w=p;--w;){var ue=y[w];if(!(ue?Gr(ue,ne):u(e[w],ne,i)))continue e}z&&z.push(ne),O.push(Q)}}return O}function Xg(e,n,i,u){return en(e,function(f,p,w){n(u,i(f),p,w)}),u}function es(e,n,i){n=On(n,e),e=zu(e,n);var u=e==null?e:e[nn($t(n))];return u==null?s:Ct(u,e,i)}function ru(e){return Ue(e)&&ft(e)==Tt}function Zg(e){return Ue(e)&&ft(e)==Hr}function Jg(e){return Ue(e)&&ft(e)==De}function ts(e,n,i,u,f){return e===n?!0:e==null||n==null||!Ue(e)&&!Ue(n)?e!==e&&n!==n:eh(e,n,i,u,ts,f)}function eh(e,n,i,u,f,p){var w=ie(e),y=ie(n),R=w?B:ct(e),O=y?B:ct(n);R=R==Tt?cn:R,O=O==Tt?cn:O;var P=R==cn,k=O==cn,z=R==O;if(z&&qn(e)){if(!qn(n))return!1;w=!0,P=!1}if(z&&!P)return p||(p=new Wt),w||Er(e)?Ou(e,n,i,u,f,p):Rh(e,n,R,i,u,f,p);if(!(i&N)){var Q=P&&Ae.call(e,"__wrapped__"),ne=k&&Ae.call(n,"__wrapped__");if(Q||ne){var ue=Q?e.value():e,re=ne?n.value():n;return p||(p=new Wt),f(ue,re,i,u,p)}}return z?(p||(p=new Wt),Eh(e,n,i,u,f,p)):!1}function th(e){return Ue(e)&&ct(e)==tt}function ba(e,n,i,u){var f=i.length,p=f,w=!u;if(e==null)return!p;for(e=Te(e);f--;){var y=i[f];if(w&&y[2]?y[1]!==e[y[0]]:!(y[0]in e))return!1}for(;++f<p;){y=i[f];var R=y[0],O=e[R],P=y[1];if(w&&y[2]){if(O===s&&!(R in e))return!1}else{var k=new Wt;if(u)var z=u(O,P,R,e,n,k);if(!(z===s?ts(P,O,N|I,u,k):z))return!1}}return!0}function su(e){if(!$e(e)||Ph(e))return!1;var n=xn(e)?tg:Hf;return n.test(rr(e))}function nh(e){return Ue(e)&&ft(e)==Ur}function rh(e){return Ue(e)&&ct(e)==Gt}function sh(e){return Ue(e)&&si(e.length)&&!!qe[ft(e)]}function iu(e){return typeof e=="function"?e:e==null?bt:typeof e=="object"?ie(e)?lu(e[0],e[1]):ou(e):Rc(e)}function wa(e){if(!ss(e))return og(e);var n=[];for(var i in Te(e))Ae.call(e,i)&&i!="constructor"&&n.push(i);return n}function ih(e){if(!$e(e))return Bh(e);var n=ss(e),i=[];for(var u in e)u=="constructor"&&(n||!Ae.call(e,u))||i.push(u);return i}function ja(e,n){return e<n}function au(e,n){var i=-1,u=vt(e)?F(e.length):[];return Mn(e,function(f,p,w){u[++i]=n(f,p,w)}),u}function ou(e){var n=Pa(e);return n.length==1&&n[0][2]?Bu(n[0][0],n[0][1]):function(i){return i===e||ba(i,e,n)}}function lu(e,n){return ka(e)&&$u(n)?Bu(nn(e),n):function(i){var u=Qa(i,e);return u===s&&u===n?Ya(i,e):ts(n,u,N|I)}}function Us(e,n,i,u,f){e!==n&&pa(n,function(p,w){if(f||(f=new Wt),$e(p))ah(e,n,w,i,Us,u,f);else{var y=u?u(Ba(e,w),p,w+"",e,n,f):s;y===s&&(y=p),ga(e,w,y)}},_t)}function ah(e,n,i,u,f,p,w){var y=Ba(e,i),R=Ba(n,i),O=w.get(R);if(O){ga(e,i,O);return}var P=p?p(y,R,i+"",e,n,w):s,k=P===s;if(k){var z=ie(R),Q=!z&&qn(R),ne=!z&&!Q&&Er(R);P=R,z||Q||ne?ie(y)?P=y:Ge(y)?P=xt(y):Q?(k=!1,P=bu(R,!0)):ne?(k=!1,P=wu(R,!0)):P=[]:as(R)||sr(R)?(P=y,sr(y)?P=xc(y):(!$e(y)||xn(y))&&(P=ku(R))):k=!1}k&&(w.set(R,P),f(P,R,u,p,w),w.delete(R)),ga(e,i,P)}function uu(e,n){var i=e.length;if(i)return n+=n<0?i:0,pn(n,i)?e[n]:s}function cu(e,n,i){n.length?n=ke(n,function(p){return ie(p)?function(w){return tr(w,p.length===1?p[0]:p)}:p}):n=[bt];var u=-1;n=ke(n,St(J()));var f=au(e,function(p,w,y){var R=ke(n,function(O){return O(p)});return{criteria:R,index:++u,value:p}});return Tm(f,function(p,w){return _h(p,w,i)})}function oh(e,n){return du(e,n,function(i,u){return Ya(e,u)})}function du(e,n,i){for(var u=-1,f=n.length,p={};++u<f;){var w=n[u],y=tr(e,w);i(y,w)&&ns(p,On(w,e),y)}return p}function lh(e){return function(n){return tr(n,e)}}function ya(e,n,i,u){var f=u?Dm:xr,p=-1,w=n.length,y=e;for(e===n&&(n=xt(n)),i&&(y=ke(e,St(i)));++p<w;)for(var R=0,O=n[p],P=i?i(O):O;(R=f(y,P,R,u))>-1;)y!==e&&Ds.call(y,R,1),Ds.call(e,R,1);return e}function fu(e,n){for(var i=e?n.length:0,u=i-1;i--;){var f=n[i];if(i==u||f!==p){var p=f;pn(f)?Ds.call(e,f,1):Ra(e,f)}}return e}function Ca(e,n){return e+Ls(Gl()*(n-e+1))}function uh(e,n,i,u){for(var f=-1,p=Ze(Ms((n-e)/(i||1)),0),w=F(p);p--;)w[u?p:++f]=e,e+=i;return w}function Sa(e,n){var i="";if(!e||n<1||n>_e)return i;do n%2&&(i+=e),n=Ls(n/2),n&&(e+=e);while(n);return i}function de(e,n){return Ua(Uu(e,n,bt),e+"")}function ch(e){return Ql(Ar(e))}function dh(e,n){var i=Ar(e);return Zs(i,er(n,0,i.length))}function ns(e,n,i,u){if(!$e(e))return e;n=On(n,e);for(var f=-1,p=n.length,w=p-1,y=e;y!=null&&++f<p;){var R=nn(n[f]),O=i;if(R==="__proto__"||R==="constructor"||R==="prototype")return e;if(f!=w){var P=y[R];O=u?u(P,R,y):s,O===s&&(O=$e(P)?P:pn(n[f+1])?[]:{})}Zr(y,R,O),y=y[R]}return e}var mu=Os?function(e,n){return Os.set(e,n),e}:bt,fh=Ts?function(e,n){return Ts(e,"toString",{configurable:!0,enumerable:!1,value:Za(n),writable:!0})}:bt;function mh(e){return Zs(Ar(e))}function kt(e,n,i){var u=-1,f=e.length;n<0&&(n=-n>f?0:f+n),i=i>f?f:i,i<0&&(i+=f),f=n>i?0:i-n>>>0,n>>>=0;for(var p=F(f);++u<f;)p[u]=e[u+n];return p}function gh(e,n){var i;return Mn(e,function(u,f,p){return i=n(u,f,p),!i}),!!i}function zs(e,n,i){var u=0,f=e==null?u:e.length;if(typeof n=="number"&&n===n&&f<=Dt){for(;u<f;){var p=u+f>>>1,w=e[p];w!==null&&!Rt(w)&&(i?w<=n:w<n)?u=p+1:f=p}return f}return Na(e,n,bt,i)}function Na(e,n,i,u){var f=0,p=e==null?0:e.length;if(p===0)return 0;n=i(n);for(var w=n!==n,y=n===null,R=Rt(n),O=n===s;f<p;){var P=Ls((f+p)/2),k=i(e[P]),z=k!==s,Q=k===null,ne=k===k,ue=Rt(k);if(w)var re=u||ne;else O?re=ne&&(u||z):y?re=ne&&z&&(u||!Q):R?re=ne&&z&&!Q&&(u||!ue):Q||ue?re=!1:re=u?k<=n:k<n;re?f=P+1:p=P}return ut(p,Se)}function gu(e,n){for(var i=-1,u=e.length,f=0,p=[];++i<u;){var w=e[i],y=n?n(w):w;if(!i||!Qt(y,R)){var R=y;p[f++]=w===0?0:w}}return p}function hu(e){return typeof e=="number"?e:Rt(e)?W:+e}function Nt(e){if(typeof e=="string")return e;if(ie(e))return ke(e,Nt)+"";if(Rt(e))return Kl?Kl.call(e):"";var n=e+"";return n=="0"&&1/e==-1/0?"-0":n}function Ln(e,n,i){var u=-1,f=js,p=e.length,w=!0,y=[],R=y;if(i)w=!1,f=ta;else if(p>=l){var O=n?null:Sh(e);if(O)return Cs(O);w=!1,f=Gr,R=new Jn}else R=n?[]:y;e:for(;++u<p;){var P=e[u],k=n?n(P):P;if(P=i||P!==0?P:0,w&&k===k){for(var z=R.length;z--;)if(R[z]===k)continue e;n&&R.push(k),y.push(P)}else f(R,k,i)||(R!==y&&R.push(k),y.push(P))}return y}function Ra(e,n){return n=On(n,e),e=zu(e,n),e==null||delete e[nn($t(n))]}function pu(e,n,i,u){return ns(e,n,i(tr(e,n)),u)}function Vs(e,n,i,u){for(var f=e.length,p=u?f:-1;(u?p--:++p<f)&&n(e[p],p,e););return i?kt(e,u?0:p,u?p+1:f):kt(e,u?p+1:0,u?f:p)}function xu(e,n){var i=e;return i instanceof ve&&(i=i.value()),na(n,function(u,f){return f.func.apply(f.thisArg,Fn([u],f.args))},i)}function Ea(e,n,i){var u=e.length;if(u<2)return u?Ln(e[0]):[];for(var f=-1,p=F(u);++f<u;)for(var w=e[f],y=-1;++y<u;)y!=f&&(p[f]=Jr(p[f]||w,e[y],n,i));return Ln(rt(p,1),n,i)}function vu(e,n,i){for(var u=-1,f=e.length,p=n.length,w={};++u<f;){var y=u<p?n[u]:s;i(w,e[u],y)}return w}function Aa(e){return Ge(e)?e:[]}function Ia(e){return typeof e=="function"?e:bt}function On(e,n){return ie(e)?e:ka(e,n)?[e]:Ku(Ne(e))}var hh=de;function Pn(e,n,i){var u=e.length;return i=i===s?u:i,!n&&i>=u?e:kt(e,n,i)}var _u=ng||function(e){return nt.clearTimeout(e)};function bu(e,n){if(n)return e.slice();var i=e.length,u=Bl?Bl(i):new e.constructor(i);return e.copy(u),u}function Fa(e){var n=new e.constructor(e.byteLength);return new Is(n).set(new Is(e)),n}function ph(e,n){var i=n?Fa(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.byteLength)}function xh(e){var n=new e.constructor(e.source,rl.exec(e));return n.lastIndex=e.lastIndex,n}function vh(e){return Xr?Te(Xr.call(e)):{}}function wu(e,n){var i=n?Fa(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.length)}function ju(e,n){if(e!==n){var i=e!==s,u=e===null,f=e===e,p=Rt(e),w=n!==s,y=n===null,R=n===n,O=Rt(n);if(!y&&!O&&!p&&e>n||p&&w&&R&&!y&&!O||u&&w&&R||!i&&R||!f)return 1;if(!u&&!p&&!O&&e<n||O&&i&&f&&!u&&!p||y&&i&&f||!w&&f||!R)return-1}return 0}function _h(e,n,i){for(var u=-1,f=e.criteria,p=n.criteria,w=f.length,y=i.length;++u<w;){var R=ju(f[u],p[u]);if(R){if(u>=y)return R;var O=i[u];return R*(O=="desc"?-1:1)}}return e.index-n.index}function yu(e,n,i,u){for(var f=-1,p=e.length,w=i.length,y=-1,R=n.length,O=Ze(p-w,0),P=F(R+O),k=!u;++y<R;)P[y]=n[y];for(;++f<w;)(k||f<p)&&(P[i[f]]=e[f]);for(;O--;)P[y++]=e[f++];return P}function Cu(e,n,i,u){for(var f=-1,p=e.length,w=-1,y=i.length,R=-1,O=n.length,P=Ze(p-y,0),k=F(P+O),z=!u;++f<P;)k[f]=e[f];for(var Q=f;++R<O;)k[Q+R]=n[R];for(;++w<y;)(z||f<p)&&(k[Q+i[w]]=e[f++]);return k}function xt(e,n){var i=-1,u=e.length;for(n||(n=F(u));++i<u;)n[i]=e[i];return n}function tn(e,n,i,u){var f=!i;i||(i={});for(var p=-1,w=n.length;++p<w;){var y=n[p],R=u?u(i[y],e[y],y,i,e):s;R===s&&(R=e[y]),f?mn(i,y,R):Zr(i,y,R)}return i}function bh(e,n){return tn(e,qa(e),n)}function wh(e,n){return tn(e,Pu(e),n)}function Hs(e,n){return function(i,u){var f=ie(i)?Nm:zg,p=n?n():{};return f(i,e,J(u,2),p)}}function Sr(e){return de(function(n,i){var u=-1,f=i.length,p=f>1?i[f-1]:s,w=f>2?i[2]:s;for(p=e.length>3&&typeof p=="function"?(f--,p):s,w&&mt(i[0],i[1],w)&&(p=f<3?s:p,f=1),n=Te(n);++u<f;){var y=i[u];y&&e(n,y,u,p)}return n})}function Su(e,n){return function(i,u){if(i==null)return i;if(!vt(i))return e(i,u);for(var f=i.length,p=n?f:-1,w=Te(i);(n?p--:++p<f)&&u(w[p],p,w)!==!1;);return i}}function Nu(e){return function(n,i,u){for(var f=-1,p=Te(n),w=u(n),y=w.length;y--;){var R=w[e?y:++f];if(i(p[R],R,p)===!1)break}return n}}function jh(e,n,i){var u=n&$,f=rs(e);function p(){var w=this&&this!==nt&&this instanceof p?f:e;return w.apply(u?i:this,arguments)}return p}function Ru(e){return function(n){n=Ne(n);var i=vr(n)?Kt(n):s,u=i?i[0]:n.charAt(0),f=i?Pn(i,1).join(""):n.slice(1);return u[e]()+f}}function Nr(e){return function(n){return na(Sc(Cc(n).replace(fm,"")),e,"")}}function rs(e){return function(){var n=arguments;switch(n.length){case 0:return new e;case 1:return new e(n[0]);case 2:return new e(n[0],n[1]);case 3:return new e(n[0],n[1],n[2]);case 4:return new e(n[0],n[1],n[2],n[3]);case 5:return new e(n[0],n[1],n[2],n[3],n[4]);case 6:return new e(n[0],n[1],n[2],n[3],n[4],n[5]);case 7:return new e(n[0],n[1],n[2],n[3],n[4],n[5],n[6])}var i=Cr(e.prototype),u=e.apply(i,n);return $e(u)?u:i}}function yh(e,n,i){var u=rs(e);function f(){for(var p=arguments.length,w=F(p),y=p,R=Rr(f);y--;)w[y]=arguments[y];var O=p<3&&w[0]!==R&&w[p-1]!==R?[]:Dn(w,R);if(p-=O.length,p<i)return Du(e,n,Gs,f.placeholder,s,w,O,s,s,i-p);var P=this&&this!==nt&&this instanceof f?u:e;return Ct(P,this,w)}return f}function Eu(e){return function(n,i,u){var f=Te(n);if(!vt(n)){var p=J(i,3);n=Je(n),i=function(y){return p(f[y],y,f)}}var w=e(n,i,u);return w>-1?f[p?n[w]:w]:s}}function Au(e){return hn(function(n){var i=n.length,u=i,f=Pt.prototype.thru;for(e&&n.reverse();u--;){var p=n[u];if(typeof p!="function")throw new Ot(c);if(f&&!w&&Ys(p)=="wrapper")var w=new Pt([],!0)}for(u=w?u:i;++u<i;){p=n[u];var y=Ys(p),R=y=="wrapper"?Oa(p):s;R&&$a(R[0])&&R[1]==(H|E|q|ce)&&!R[4].length&&R[9]==1?w=w[Ys(R[0])].apply(w,R[3]):w=p.length==1&&$a(p)?w[y]():w.thru(p)}return function(){var O=arguments,P=O[0];if(w&&O.length==1&&ie(P))return w.plant(P).value();for(var k=0,z=i?n[k].apply(this,O):P;++k<i;)z=n[k].call(this,z);return z}})}function Gs(e,n,i,u,f,p,w,y,R,O){var P=n&H,k=n&$,z=n&L,Q=n&(E|T),ne=n&pe,ue=z?s:rs(e);function re(){for(var he=arguments.length,we=F(he),Et=he;Et--;)we[Et]=arguments[Et];if(Q)var gt=Rr(re),At=Lm(we,gt);if(u&&(we=yu(we,u,f,Q)),p&&(we=Cu(we,p,w,Q)),he-=At,Q&&he<O){var Ke=Dn(we,gt);return Du(e,n,Gs,re.placeholder,i,we,Ke,y,R,O-he)}var Yt=k?i:this,_n=z?Yt[e]:e;return he=we.length,y?we=zh(we,y):ne&&he>1&&we.reverse(),P&&R<he&&(we.length=R),this&&this!==nt&&this instanceof re&&(_n=ue||rs(_n)),_n.apply(Yt,we)}return re}function Iu(e,n){return function(i,u){return Xg(i,e,n(u),{})}}function Ks(e,n){return function(i,u){var f;if(i===s&&u===s)return n;if(i!==s&&(f=i),u!==s){if(f===s)return u;typeof i=="string"||typeof u=="string"?(i=Nt(i),u=Nt(u)):(i=hu(i),u=hu(u)),f=e(i,u)}return f}}function Da(e){return hn(function(n){return n=ke(n,St(J())),de(function(i){var u=this;return e(n,function(f){return Ct(f,u,i)})})})}function Ws(e,n){n=n===s?" ":Nt(n);var i=n.length;if(i<2)return i?Sa(n,e):n;var u=Sa(n,Ms(e/_r(n)));return vr(n)?Pn(Kt(u),0,e).join(""):u.slice(0,e)}function Ch(e,n,i,u){var f=n&$,p=rs(e);function w(){for(var y=-1,R=arguments.length,O=-1,P=u.length,k=F(P+R),z=this&&this!==nt&&this instanceof w?p:e;++O<P;)k[O]=u[O];for(;R--;)k[O++]=arguments[++y];return Ct(z,f?i:this,k)}return w}function Fu(e){return function(n,i,u){return u&&typeof u!="number"&&mt(n,i,u)&&(i=u=s),n=vn(n),i===s?(i=n,n=0):i=vn(i),u=u===s?n<i?1:-1:vn(u),uh(n,i,u,e)}}function Qs(e){return function(n,i){return typeof n=="string"&&typeof i=="string"||(n=Bt(n),i=Bt(i)),e(n,i)}}function Du(e,n,i,u,f,p,w,y,R,O){var P=n&E,k=P?w:s,z=P?s:w,Q=P?p:s,ne=P?s:p;n|=P?q:Y,n&=~(P?Y:q),n&A||(n&=-4);var ue=[e,n,f,Q,k,ne,z,y,R,O],re=i.apply(s,ue);return $a(e)&&Vu(re,ue),re.placeholder=u,Hu(re,e,n)}function Ta(e){var n=Xe[e];return function(i,u){if(i=Bt(i),u=u==null?0:ut(oe(u),292),u&&Hl(i)){var f=(Ne(i)+"e").split("e"),p=n(f[0]+"e"+(+f[1]+u));return f=(Ne(p)+"e").split("e"),+(f[0]+"e"+(+f[1]-u))}return n(i)}}var Sh=jr&&1/Cs(new jr([,-0]))[1]==Pe?function(e){return new jr(e)}:to;function Tu(e){return function(n){var i=ct(n);return i==tt?ua(n):i==Gt?Um(n):Mm(n,e(n))}}function gn(e,n,i,u,f,p,w,y){var R=n&L;if(!R&&typeof e!="function")throw new Ot(c);var O=u?u.length:0;if(O||(n&=-97,u=f=s),w=w===s?w:Ze(oe(w),0),y=y===s?y:oe(y),O-=f?f.length:0,n&Y){var P=u,k=f;u=f=s}var z=R?s:Oa(e),Q=[e,n,i,u,f,P,k,p,w,y];if(z&&$h(Q,z),e=Q[0],n=Q[1],i=Q[2],u=Q[3],f=Q[4],y=Q[9]=Q[9]===s?R?0:e.length:Ze(Q[9]-O,0),!y&&n&(E|T)&&(n&=-25),!n||n==$)var ne=jh(e,n,i);else n==E||n==T?ne=yh(e,n,y):(n==q||n==($|q))&&!f.length?ne=Ch(e,n,i,u):ne=Gs.apply(s,Q);var ue=z?mu:Vu;return Hu(ue(ne,Q),e,n)}function Mu(e,n,i,u){return e===s||Qt(e,wr[i])&&!Ae.call(u,i)?n:e}function Lu(e,n,i,u,f,p){return $e(e)&&$e(n)&&(p.set(n,e),Us(e,n,s,Lu,p),p.delete(n)),e}function Nh(e){return as(e)?s:e}function Ou(e,n,i,u,f,p){var w=i&N,y=e.length,R=n.length;if(y!=R&&!(w&&R>y))return!1;var O=p.get(e),P=p.get(n);if(O&&P)return O==n&&P==e;var k=-1,z=!0,Q=i&I?new Jn:s;for(p.set(e,n),p.set(n,e);++k<y;){var ne=e[k],ue=n[k];if(u)var re=w?u(ue,ne,k,n,e,p):u(ne,ue,k,e,n,p);if(re!==s){if(re)continue;z=!1;break}if(Q){if(!ra(n,function(he,we){if(!Gr(Q,we)&&(ne===he||f(ne,he,i,u,p)))return Q.push(we)})){z=!1;break}}else if(!(ne===ue||f(ne,ue,i,u,p))){z=!1;break}}return p.delete(e),p.delete(n),z}function Rh(e,n,i,u,f,p,w){switch(i){case hr:if(e.byteLength!=n.byteLength||e.byteOffset!=n.byteOffset)return!1;e=e.buffer,n=n.buffer;case Hr:return!(e.byteLength!=n.byteLength||!p(new Is(e),new Is(n)));case Ee:case De:case Ht:return Qt(+e,+n);case ye:return e.name==n.name&&e.message==n.message;case Ur:case zr:return e==n+"";case tt:var y=ua;case Gt:var R=u&N;if(y||(y=Cs),e.size!=n.size&&!R)return!1;var O=w.get(e);if(O)return O==n;u|=I,w.set(e,n);var P=Ou(y(e),y(n),u,f,p,w);return w.delete(e),P;case vs:if(Xr)return Xr.call(e)==Xr.call(n)}return!1}function Eh(e,n,i,u,f,p){var w=i&N,y=Ma(e),R=y.length,O=Ma(n),P=O.length;if(R!=P&&!w)return!1;for(var k=R;k--;){var z=y[k];if(!(w?z in n:Ae.call(n,z)))return!1}var Q=p.get(e),ne=p.get(n);if(Q&&ne)return Q==n&&ne==e;var ue=!0;p.set(e,n),p.set(n,e);for(var re=w;++k<R;){z=y[k];var he=e[z],we=n[z];if(u)var Et=w?u(we,he,z,n,e,p):u(he,we,z,e,n,p);if(!(Et===s?he===we||f(he,we,i,u,p):Et)){ue=!1;break}re||(re=z=="constructor")}if(ue&&!re){var gt=e.constructor,At=n.constructor;gt!=At&&"constructor"in e&&"constructor"in n&&!(typeof gt=="function"&&gt instanceof gt&&typeof At=="function"&&At instanceof At)&&(ue=!1)}return p.delete(e),p.delete(n),ue}function hn(e){return Ua(Uu(e,s,Xu),e+"")}function Ma(e){return nu(e,Je,qa)}function La(e){return nu(e,_t,Pu)}var Oa=Os?function(e){return Os.get(e)}:to;function Ys(e){for(var n=e.name+"",i=yr[n],u=Ae.call(yr,n)?i.length:0;u--;){var f=i[u],p=f.func;if(p==null||p==e)return f.name}return n}function Rr(e){var n=Ae.call(h,"placeholder")?h:e;return n.placeholder}function J(){var e=h.iteratee||Ja;return e=e===Ja?iu:e,arguments.length?e(arguments[0],arguments[1]):e}function Xs(e,n){var i=e.__data__;return Oh(n)?i[typeof n=="string"?"string":"hash"]:i.map}function Pa(e){for(var n=Je(e),i=n.length;i--;){var u=n[i],f=e[u];n[i]=[u,f,$u(f)]}return n}function nr(e,n){var i=km(e,n);return su(i)?i:s}function Ah(e){var n=Ae.call(e,Xn),i=e[Xn];try{e[Xn]=s;var u=!0}catch{}var f=Es.call(e);return u&&(n?e[Xn]=i:delete e[Xn]),f}var qa=da?function(e){return e==null?[]:(e=Te(e),In(da(e),function(n){return zl.call(e,n)}))}:no,Pu=da?function(e){for(var n=[];e;)Fn(n,qa(e)),e=Fs(e);return n}:no,ct=ft;(fa&&ct(new fa(new ArrayBuffer(1)))!=hr||Wr&&ct(new Wr)!=tt||ma&&ct(ma.resolve())!=Jo||jr&&ct(new jr)!=Gt||Qr&&ct(new Qr)!=Vr)&&(ct=function(e){var n=ft(e),i=n==cn?e.constructor:s,u=i?rr(i):"";if(u)switch(u){case dg:return hr;case fg:return tt;case mg:return Jo;case gg:return Gt;case hg:return Vr}return n});function Ih(e,n,i){for(var u=-1,f=i.length;++u<f;){var p=i[u],w=p.size;switch(p.type){case"drop":e+=w;break;case"dropRight":n-=w;break;case"take":n=ut(n,e+w);break;case"takeRight":e=Ze(e,n-w);break}}return{start:e,end:n}}function Fh(e){var n=e.match(Pf);return n?n[1].split(qf):[]}function qu(e,n,i){n=On(n,e);for(var u=-1,f=n.length,p=!1;++u<f;){var w=nn(n[u]);if(!(p=e!=null&&i(e,w)))break;e=e[w]}return p||++u!=f?p:(f=e==null?0:e.length,!!f&&si(f)&&pn(w,f)&&(ie(e)||sr(e)))}function Dh(e){var n=e.length,i=new e.constructor(n);return n&&typeof e[0]=="string"&&Ae.call(e,"index")&&(i.index=e.index,i.input=e.input),i}function ku(e){return typeof e.constructor=="function"&&!ss(e)?Cr(Fs(e)):{}}function Th(e,n,i){var u=e.constructor;switch(n){case Hr:return Fa(e);case Ee:case De:return new u(+e);case hr:return ph(e,i);case Pi:case qi:case ki:case $i:case Bi:case Ui:case zi:case Vi:case Hi:return wu(e,i);case tt:return new u;case Ht:case zr:return new u(e);case Ur:return xh(e);case Gt:return new u;case vs:return vh(e)}}function Mh(e,n){var i=n.length;if(!i)return e;var u=i-1;return n[u]=(i>1?"& ":"")+n[u],n=n.join(i>2?", ":" "),e.replace(Of,`{
/* [wrapped with `+n+`] */
`)}function Lh(e){return ie(e)||sr(e)||!!(Vl&&e&&e[Vl])}function pn(e,n){var i=typeof e;return n=n??_e,!!n&&(i=="number"||i!="symbol"&&Kf.test(e))&&e>-1&&e%1==0&&e<n}function mt(e,n,i){if(!$e(i))return!1;var u=typeof n;return(u=="number"?vt(i)&&pn(n,i.length):u=="string"&&n in i)?Qt(i[n],e):!1}function ka(e,n){if(ie(e))return!1;var i=typeof e;return i=="number"||i=="symbol"||i=="boolean"||e==null||Rt(e)?!0:Df.test(e)||!Ff.test(e)||n!=null&&e in Te(n)}function Oh(e){var n=typeof e;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?e!=="__proto__":e===null}function $a(e){var n=Ys(e),i=h[n];if(typeof i!="function"||!(n in ve.prototype))return!1;if(e===i)return!0;var u=Oa(i);return!!u&&e===u[0]}function Ph(e){return!!$l&&$l in e}var qh=Ns?xn:ro;function ss(e){var n=e&&e.constructor,i=typeof n=="function"&&n.prototype||wr;return e===i}function $u(e){return e===e&&!$e(e)}function Bu(e,n){return function(i){return i==null?!1:i[e]===n&&(n!==s||e in Te(i))}}function kh(e){var n=ni(e,function(u){return i.size===x&&i.clear(),u}),i=n.cache;return n}function $h(e,n){var i=e[1],u=n[1],f=i|u,p=f<($|L|H),w=u==H&&i==E||u==H&&i==ce&&e[7].length<=n[8]||u==(H|ce)&&n[7].length<=n[8]&&i==E;if(!(p||w))return e;u&$&&(e[2]=n[2],f|=i&$?0:A);var y=n[3];if(y){var R=e[3];e[3]=R?yu(R,y,n[4]):y,e[4]=R?Dn(e[3],v):n[4]}return y=n[5],y&&(R=e[5],e[5]=R?Cu(R,y,n[6]):y,e[6]=R?Dn(e[5],v):n[6]),y=n[7],y&&(e[7]=y),u&H&&(e[8]=e[8]==null?n[8]:ut(e[8],n[8])),e[9]==null&&(e[9]=n[9]),e[0]=n[0],e[1]=f,e}function Bh(e){var n=[];if(e!=null)for(var i in Te(e))n.push(i);return n}function Uh(e){return Es.call(e)}function Uu(e,n,i){return n=Ze(n===s?e.length-1:n,0),function(){for(var u=arguments,f=-1,p=Ze(u.length-n,0),w=F(p);++f<p;)w[f]=u[n+f];f=-1;for(var y=F(n+1);++f<n;)y[f]=u[f];return y[n]=i(w),Ct(e,this,y)}}function zu(e,n){return n.length<2?e:tr(e,kt(n,0,-1))}function zh(e,n){for(var i=e.length,u=ut(n.length,i),f=xt(e);u--;){var p=n[u];e[u]=pn(p,i)?f[p]:s}return e}function Ba(e,n){if(!(n==="constructor"&&typeof e[n]=="function")&&n!="__proto__")return e[n]}var Vu=Gu(mu),is=sg||function(e,n){return nt.setTimeout(e,n)},Ua=Gu(fh);function Hu(e,n,i){var u=n+"";return Ua(e,Mh(u,Vh(Fh(u),i)))}function Gu(e){var n=0,i=0;return function(){var u=lg(),f=Z-(u-i);if(i=u,f>0){if(++n>=V)return arguments[0]}else n=0;return e.apply(s,arguments)}}function Zs(e,n){var i=-1,u=e.length,f=u-1;for(n=n===s?u:n;++i<n;){var p=Ca(i,f),w=e[p];e[p]=e[i],e[i]=w}return e.length=n,e}var Ku=kh(function(e){var n=[];return e.charCodeAt(0)===46&&n.push(""),e.replace(Tf,function(i,u,f,p){n.push(f?p.replace(Bf,"$1"):u||i)}),n});function nn(e){if(typeof e=="string"||Rt(e))return e;var n=e+"";return n=="0"&&1/e==-1/0?"-0":n}function rr(e){if(e!=null){try{return Rs.call(e)}catch{}try{return e+""}catch{}}return""}function Vh(e,n){return Lt(yt,function(i){var u="_."+i[0];n&i[1]&&!js(e,u)&&e.push(u)}),e.sort()}function Wu(e){if(e instanceof ve)return e.clone();var n=new Pt(e.__wrapped__,e.__chain__);return n.__actions__=xt(e.__actions__),n.__index__=e.__index__,n.__values__=e.__values__,n}function Hh(e,n,i){(i?mt(e,n,i):n===s)?n=1:n=Ze(oe(n),0);var u=e==null?0:e.length;if(!u||n<1)return[];for(var f=0,p=0,w=F(Ms(u/n));f<u;)w[p++]=kt(e,f,f+=n);return w}function Gh(e){for(var n=-1,i=e==null?0:e.length,u=0,f=[];++n<i;){var p=e[n];p&&(f[u++]=p)}return f}function Kh(){var e=arguments.length;if(!e)return[];for(var n=F(e-1),i=arguments[0],u=e;u--;)n[u-1]=arguments[u];return Fn(ie(i)?xt(i):[i],rt(n,1))}var Wh=de(function(e,n){return Ge(e)?Jr(e,rt(n,1,Ge,!0)):[]}),Qh=de(function(e,n){var i=$t(n);return Ge(i)&&(i=s),Ge(e)?Jr(e,rt(n,1,Ge,!0),J(i,2)):[]}),Yh=de(function(e,n){var i=$t(n);return Ge(i)&&(i=s),Ge(e)?Jr(e,rt(n,1,Ge,!0),s,i):[]});function Xh(e,n,i){var u=e==null?0:e.length;return u?(n=i||n===s?1:oe(n),kt(e,n<0?0:n,u)):[]}function Zh(e,n,i){var u=e==null?0:e.length;return u?(n=i||n===s?1:oe(n),n=u-n,kt(e,0,n<0?0:n)):[]}function Jh(e,n){return e&&e.length?Vs(e,J(n,3),!0,!0):[]}function ep(e,n){return e&&e.length?Vs(e,J(n,3),!0):[]}function tp(e,n,i,u){var f=e==null?0:e.length;return f?(i&&typeof i!="number"&&mt(e,n,i)&&(i=0,u=f),Kg(e,n,i,u)):[]}function Qu(e,n,i){var u=e==null?0:e.length;if(!u)return-1;var f=i==null?0:oe(i);return f<0&&(f=Ze(u+f,0)),ys(e,J(n,3),f)}function Yu(e,n,i){var u=e==null?0:e.length;if(!u)return-1;var f=u-1;return i!==s&&(f=oe(i),f=i<0?Ze(u+f,0):ut(f,u-1)),ys(e,J(n,3),f,!0)}function Xu(e){var n=e==null?0:e.length;return n?rt(e,1):[]}function np(e){var n=e==null?0:e.length;return n?rt(e,Pe):[]}function rp(e,n){var i=e==null?0:e.length;return i?(n=n===s?1:oe(n),rt(e,n)):[]}function sp(e){for(var n=-1,i=e==null?0:e.length,u={};++n<i;){var f=e[n];u[f[0]]=f[1]}return u}function Zu(e){return e&&e.length?e[0]:s}function ip(e,n,i){var u=e==null?0:e.length;if(!u)return-1;var f=i==null?0:oe(i);return f<0&&(f=Ze(u+f,0)),xr(e,n,f)}function ap(e){var n=e==null?0:e.length;return n?kt(e,0,-1):[]}var op=de(function(e){var n=ke(e,Aa);return n.length&&n[0]===e[0]?_a(n):[]}),lp=de(function(e){var n=$t(e),i=ke(e,Aa);return n===$t(i)?n=s:i.pop(),i.length&&i[0]===e[0]?_a(i,J(n,2)):[]}),up=de(function(e){var n=$t(e),i=ke(e,Aa);return n=typeof n=="function"?n:s,n&&i.pop(),i.length&&i[0]===e[0]?_a(i,s,n):[]});function cp(e,n){return e==null?"":ag.call(e,n)}function $t(e){var n=e==null?0:e.length;return n?e[n-1]:s}function dp(e,n,i){var u=e==null?0:e.length;if(!u)return-1;var f=u;return i!==s&&(f=oe(i),f=f<0?Ze(u+f,0):ut(f,u-1)),n===n?Vm(e,n,f):ys(e,Dl,f,!0)}function fp(e,n){return e&&e.length?uu(e,oe(n)):s}var mp=de(Ju);function Ju(e,n){return e&&e.length&&n&&n.length?ya(e,n):e}function gp(e,n,i){return e&&e.length&&n&&n.length?ya(e,n,J(i,2)):e}function hp(e,n,i){return e&&e.length&&n&&n.length?ya(e,n,s,i):e}var pp=hn(function(e,n){var i=e==null?0:e.length,u=ha(e,n);return fu(e,ke(n,function(f){return pn(f,i)?+f:f}).sort(ju)),u});function xp(e,n){var i=[];if(!(e&&e.length))return i;var u=-1,f=[],p=e.length;for(n=J(n,3);++u<p;){var w=e[u];n(w,u,e)&&(i.push(w),f.push(u))}return fu(e,f),i}function za(e){return e==null?e:cg.call(e)}function vp(e,n,i){var u=e==null?0:e.length;return u?(i&&typeof i!="number"&&mt(e,n,i)?(n=0,i=u):(n=n==null?0:oe(n),i=i===s?u:oe(i)),kt(e,n,i)):[]}function _p(e,n){return zs(e,n)}function bp(e,n,i){return Na(e,n,J(i,2))}function wp(e,n){var i=e==null?0:e.length;if(i){var u=zs(e,n);if(u<i&&Qt(e[u],n))return u}return-1}function jp(e,n){return zs(e,n,!0)}function yp(e,n,i){return Na(e,n,J(i,2),!0)}function Cp(e,n){var i=e==null?0:e.length;if(i){var u=zs(e,n,!0)-1;if(Qt(e[u],n))return u}return-1}function Sp(e){return e&&e.length?gu(e):[]}function Np(e,n){return e&&e.length?gu(e,J(n,2)):[]}function Rp(e){var n=e==null?0:e.length;return n?kt(e,1,n):[]}function Ep(e,n,i){return e&&e.length?(n=i||n===s?1:oe(n),kt(e,0,n<0?0:n)):[]}function Ap(e,n,i){var u=e==null?0:e.length;return u?(n=i||n===s?1:oe(n),n=u-n,kt(e,n<0?0:n,u)):[]}function Ip(e,n){return e&&e.length?Vs(e,J(n,3),!1,!0):[]}function Fp(e,n){return e&&e.length?Vs(e,J(n,3)):[]}var Dp=de(function(e){return Ln(rt(e,1,Ge,!0))}),Tp=de(function(e){var n=$t(e);return Ge(n)&&(n=s),Ln(rt(e,1,Ge,!0),J(n,2))}),Mp=de(function(e){var n=$t(e);return n=typeof n=="function"?n:s,Ln(rt(e,1,Ge,!0),s,n)});function Lp(e){return e&&e.length?Ln(e):[]}function Op(e,n){return e&&e.length?Ln(e,J(n,2)):[]}function Pp(e,n){return n=typeof n=="function"?n:s,e&&e.length?Ln(e,s,n):[]}function Va(e){if(!(e&&e.length))return[];var n=0;return e=In(e,function(i){if(Ge(i))return n=Ze(i.length,n),!0}),oa(n,function(i){return ke(e,sa(i))})}function ec(e,n){if(!(e&&e.length))return[];var i=Va(e);return n==null?i:ke(i,function(u){return Ct(n,s,u)})}var qp=de(function(e,n){return Ge(e)?Jr(e,n):[]}),kp=de(function(e){return Ea(In(e,Ge))}),$p=de(function(e){var n=$t(e);return Ge(n)&&(n=s),Ea(In(e,Ge),J(n,2))}),Bp=de(function(e){var n=$t(e);return n=typeof n=="function"?n:s,Ea(In(e,Ge),s,n)}),Up=de(Va);function zp(e,n){return vu(e||[],n||[],Zr)}function Vp(e,n){return vu(e||[],n||[],ns)}var Hp=de(function(e){var n=e.length,i=n>1?e[n-1]:s;return i=typeof i=="function"?(e.pop(),i):s,ec(e,i)});function tc(e){var n=h(e);return n.__chain__=!0,n}function Gp(e,n){return n(e),e}function Js(e,n){return n(e)}var Kp=hn(function(e){var n=e.length,i=n?e[0]:0,u=this.__wrapped__,f=function(p){return ha(p,e)};return n>1||this.__actions__.length||!(u instanceof ve)||!pn(i)?this.thru(f):(u=u.slice(i,+i+(n?1:0)),u.__actions__.push({func:Js,args:[f],thisArg:s}),new Pt(u,this.__chain__).thru(function(p){return n&&!p.length&&p.push(s),p}))});function Wp(){return tc(this)}function Qp(){return new Pt(this.value(),this.__chain__)}function Yp(){this.__values__===s&&(this.__values__=hc(this.value()));var e=this.__index__>=this.__values__.length,n=e?s:this.__values__[this.__index__++];return{done:e,value:n}}function Xp(){return this}function Zp(e){for(var n,i=this;i instanceof qs;){var u=Wu(i);u.__index__=0,u.__values__=s,n?f.__wrapped__=u:n=u;var f=u;i=i.__wrapped__}return f.__wrapped__=e,n}function Jp(){var e=this.__wrapped__;if(e instanceof ve){var n=e;return this.__actions__.length&&(n=new ve(this)),n=n.reverse(),n.__actions__.push({func:Js,args:[za],thisArg:s}),new Pt(n,this.__chain__)}return this.thru(za)}function ex(){return xu(this.__wrapped__,this.__actions__)}var tx=Hs(function(e,n,i){Ae.call(e,i)?++e[i]:mn(e,i,1)});function nx(e,n,i){var u=ie(e)?Il:Gg;return i&&mt(e,n,i)&&(n=s),u(e,J(n,3))}function rx(e,n){var i=ie(e)?In:eu;return i(e,J(n,3))}var sx=Eu(Qu),ix=Eu(Yu);function ax(e,n){return rt(ei(e,n),1)}function ox(e,n){return rt(ei(e,n),Pe)}function lx(e,n,i){return i=i===s?1:oe(i),rt(ei(e,n),i)}function nc(e,n){var i=ie(e)?Lt:Mn;return i(e,J(n,3))}function rc(e,n){var i=ie(e)?Rm:Jl;return i(e,J(n,3))}var ux=Hs(function(e,n,i){Ae.call(e,i)?e[i].push(n):mn(e,i,[n])});function cx(e,n,i,u){e=vt(e)?e:Ar(e),i=i&&!u?oe(i):0;var f=e.length;return i<0&&(i=Ze(f+i,0)),ii(e)?i<=f&&e.indexOf(n,i)>-1:!!f&&xr(e,n,i)>-1}var dx=de(function(e,n,i){var u=-1,f=typeof n=="function",p=vt(e)?F(e.length):[];return Mn(e,function(w){p[++u]=f?Ct(n,w,i):es(w,n,i)}),p}),fx=Hs(function(e,n,i){mn(e,i,n)});function ei(e,n){var i=ie(e)?ke:au;return i(e,J(n,3))}function mx(e,n,i,u){return e==null?[]:(ie(n)||(n=n==null?[]:[n]),i=u?s:i,ie(i)||(i=i==null?[]:[i]),cu(e,n,i))}var gx=Hs(function(e,n,i){e[i?0:1].push(n)},function(){return[[],[]]});function hx(e,n,i){var u=ie(e)?na:Ml,f=arguments.length<3;return u(e,J(n,4),i,f,Mn)}function px(e,n,i){var u=ie(e)?Em:Ml,f=arguments.length<3;return u(e,J(n,4),i,f,Jl)}function xx(e,n){var i=ie(e)?In:eu;return i(e,ri(J(n,3)))}function vx(e){var n=ie(e)?Ql:ch;return n(e)}function _x(e,n,i){(i?mt(e,n,i):n===s)?n=1:n=oe(n);var u=ie(e)?Bg:dh;return u(e,n)}function bx(e){var n=ie(e)?Ug:mh;return n(e)}function wx(e){if(e==null)return 0;if(vt(e))return ii(e)?_r(e):e.length;var n=ct(e);return n==tt||n==Gt?e.size:wa(e).length}function jx(e,n,i){var u=ie(e)?ra:gh;return i&&mt(e,n,i)&&(n=s),u(e,J(n,3))}var yx=de(function(e,n){if(e==null)return[];var i=n.length;return i>1&&mt(e,n[0],n[1])?n=[]:i>2&&mt(n[0],n[1],n[2])&&(n=[n[0]]),cu(e,rt(n,1),[])}),ti=rg||function(){return nt.Date.now()};function Cx(e,n){if(typeof n!="function")throw new Ot(c);return e=oe(e),function(){if(--e<1)return n.apply(this,arguments)}}function sc(e,n,i){return n=i?s:n,n=e&&n==null?e.length:n,gn(e,H,s,s,s,s,n)}function ic(e,n){var i;if(typeof n!="function")throw new Ot(c);return e=oe(e),function(){return--e>0&&(i=n.apply(this,arguments)),e<=1&&(n=s),i}}var Ha=de(function(e,n,i){var u=$;if(i.length){var f=Dn(i,Rr(Ha));u|=q}return gn(e,u,n,i,f)}),ac=de(function(e,n,i){var u=$|L;if(i.length){var f=Dn(i,Rr(ac));u|=q}return gn(n,u,e,i,f)});function oc(e,n,i){n=i?s:n;var u=gn(e,E,s,s,s,s,s,n);return u.placeholder=oc.placeholder,u}function lc(e,n,i){n=i?s:n;var u=gn(e,T,s,s,s,s,s,n);return u.placeholder=lc.placeholder,u}function uc(e,n,i){var u,f,p,w,y,R,O=0,P=!1,k=!1,z=!0;if(typeof e!="function")throw new Ot(c);n=Bt(n)||0,$e(i)&&(P=!!i.leading,k="maxWait"in i,p=k?Ze(Bt(i.maxWait)||0,n):p,z="trailing"in i?!!i.trailing:z);function Q(Ke){var Yt=u,_n=f;return u=f=s,O=Ke,w=e.apply(_n,Yt),w}function ne(Ke){return O=Ke,y=is(he,n),P?Q(Ke):w}function ue(Ke){var Yt=Ke-R,_n=Ke-O,Ec=n-Yt;return k?ut(Ec,p-_n):Ec}function re(Ke){var Yt=Ke-R,_n=Ke-O;return R===s||Yt>=n||Yt<0||k&&_n>=p}function he(){var Ke=ti();if(re(Ke))return we(Ke);y=is(he,ue(Ke))}function we(Ke){return y=s,z&&u?Q(Ke):(u=f=s,w)}function Et(){y!==s&&_u(y),O=0,u=R=f=y=s}function gt(){return y===s?w:we(ti())}function At(){var Ke=ti(),Yt=re(Ke);if(u=arguments,f=this,R=Ke,Yt){if(y===s)return ne(R);if(k)return _u(y),y=is(he,n),Q(R)}return y===s&&(y=is(he,n)),w}return At.cancel=Et,At.flush=gt,At}var Sx=de(function(e,n){return Zl(e,1,n)}),Nx=de(function(e,n,i){return Zl(e,Bt(n)||0,i)});function Rx(e){return gn(e,pe)}function ni(e,n){if(typeof e!="function"||n!=null&&typeof n!="function")throw new Ot(c);var i=function(){var u=arguments,f=n?n.apply(this,u):u[0],p=i.cache;if(p.has(f))return p.get(f);var w=e.apply(this,u);return i.cache=p.set(f,w)||p,w};return i.cache=new(ni.Cache||fn),i}ni.Cache=fn;function ri(e){if(typeof e!="function")throw new Ot(c);return function(){var n=arguments;switch(n.length){case 0:return!e.call(this);case 1:return!e.call(this,n[0]);case 2:return!e.call(this,n[0],n[1]);case 3:return!e.call(this,n[0],n[1],n[2])}return!e.apply(this,n)}}function Ex(e){return ic(2,e)}var Ax=hh(function(e,n){n=n.length==1&&ie(n[0])?ke(n[0],St(J())):ke(rt(n,1),St(J()));var i=n.length;return de(function(u){for(var f=-1,p=ut(u.length,i);++f<p;)u[f]=n[f].call(this,u[f]);return Ct(e,this,u)})}),Ga=de(function(e,n){var i=Dn(n,Rr(Ga));return gn(e,q,s,n,i)}),cc=de(function(e,n){var i=Dn(n,Rr(cc));return gn(e,Y,s,n,i)}),Ix=hn(function(e,n){return gn(e,ce,s,s,s,n)});function Fx(e,n){if(typeof e!="function")throw new Ot(c);return n=n===s?n:oe(n),de(e,n)}function Dx(e,n){if(typeof e!="function")throw new Ot(c);return n=n==null?0:Ze(oe(n),0),de(function(i){var u=i[n],f=Pn(i,0,n);return u&&Fn(f,u),Ct(e,this,f)})}function Tx(e,n,i){var u=!0,f=!0;if(typeof e!="function")throw new Ot(c);return $e(i)&&(u="leading"in i?!!i.leading:u,f="trailing"in i?!!i.trailing:f),uc(e,n,{leading:u,maxWait:n,trailing:f})}function Mx(e){return sc(e,1)}function Lx(e,n){return Ga(Ia(n),e)}function Ox(){if(!arguments.length)return[];var e=arguments[0];return ie(e)?e:[e]}function Px(e){return qt(e,_)}function qx(e,n){return n=typeof n=="function"?n:s,qt(e,_,n)}function kx(e){return qt(e,b|_)}function $x(e,n){return n=typeof n=="function"?n:s,qt(e,b|_,n)}function Bx(e,n){return n==null||Xl(e,n,Je(n))}function Qt(e,n){return e===n||e!==e&&n!==n}var Ux=Qs(va),zx=Qs(function(e,n){return e>=n}),sr=ru(function(){return arguments}())?ru:function(e){return Ue(e)&&Ae.call(e,"callee")&&!zl.call(e,"callee")},ie=F.isArray,Vx=Cl?St(Cl):Zg;function vt(e){return e!=null&&si(e.length)&&!xn(e)}function Ge(e){return Ue(e)&&vt(e)}function Hx(e){return e===!0||e===!1||Ue(e)&&ft(e)==Ee}var qn=ig||ro,Gx=Sl?St(Sl):Jg;function Kx(e){return Ue(e)&&e.nodeType===1&&!as(e)}function Wx(e){if(e==null)return!0;if(vt(e)&&(ie(e)||typeof e=="string"||typeof e.splice=="function"||qn(e)||Er(e)||sr(e)))return!e.length;var n=ct(e);if(n==tt||n==Gt)return!e.size;if(ss(e))return!wa(e).length;for(var i in e)if(Ae.call(e,i))return!1;return!0}function Qx(e,n){return ts(e,n)}function Yx(e,n,i){i=typeof i=="function"?i:s;var u=i?i(e,n):s;return u===s?ts(e,n,s,i):!!u}function Ka(e){if(!Ue(e))return!1;var n=ft(e);return n==ye||n==Le||typeof e.message=="string"&&typeof e.name=="string"&&!as(e)}function Xx(e){return typeof e=="number"&&Hl(e)}function xn(e){if(!$e(e))return!1;var n=ft(e);return n==ge||n==pt||n==be||n==wf}function dc(e){return typeof e=="number"&&e==oe(e)}function si(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=_e}function $e(e){var n=typeof e;return e!=null&&(n=="object"||n=="function")}function Ue(e){return e!=null&&typeof e=="object"}var fc=Nl?St(Nl):th;function Zx(e,n){return e===n||ba(e,n,Pa(n))}function Jx(e,n,i){return i=typeof i=="function"?i:s,ba(e,n,Pa(n),i)}function ev(e){return mc(e)&&e!=+e}function tv(e){if(qh(e))throw new se(d);return su(e)}function nv(e){return e===null}function rv(e){return e==null}function mc(e){return typeof e=="number"||Ue(e)&&ft(e)==Ht}function as(e){if(!Ue(e)||ft(e)!=cn)return!1;var n=Fs(e);if(n===null)return!0;var i=Ae.call(n,"constructor")&&n.constructor;return typeof i=="function"&&i instanceof i&&Rs.call(i)==Jm}var Wa=Rl?St(Rl):nh;function sv(e){return dc(e)&&e>=-9007199254740991&&e<=_e}var gc=El?St(El):rh;function ii(e){return typeof e=="string"||!ie(e)&&Ue(e)&&ft(e)==zr}function Rt(e){return typeof e=="symbol"||Ue(e)&&ft(e)==vs}var Er=Al?St(Al):sh;function iv(e){return e===s}function av(e){return Ue(e)&&ct(e)==Vr}function ov(e){return Ue(e)&&ft(e)==yf}var lv=Qs(ja),uv=Qs(function(e,n){return e<=n});function hc(e){if(!e)return[];if(vt(e))return ii(e)?Kt(e):xt(e);if(Kr&&e[Kr])return Bm(e[Kr]());var n=ct(e),i=n==tt?ua:n==Gt?Cs:Ar;return i(e)}function vn(e){if(!e)return e===0?e:0;if(e=Bt(e),e===Pe||e===-1/0){var n=e<0?-1:1;return n*je}return e===e?e:0}function oe(e){var n=vn(e),i=n%1;return n===n?i?n-i:n:0}function pc(e){return e?er(oe(e),0,K):0}function Bt(e){if(typeof e=="number")return e;if(Rt(e))return W;if($e(e)){var n=typeof e.valueOf=="function"?e.valueOf():e;e=$e(n)?n+"":n}if(typeof e!="string")return e===0?e:+e;e=Ll(e);var i=Vf.test(e);return i||Gf.test(e)?Cm(e.slice(2),i?2:8):zf.test(e)?W:+e}function xc(e){return tn(e,_t(e))}function cv(e){return e?er(oe(e),-9007199254740991,_e):e===0?e:0}function Ne(e){return e==null?"":Nt(e)}var dv=Sr(function(e,n){if(ss(n)||vt(n)){tn(n,Je(n),e);return}for(var i in n)Ae.call(n,i)&&Zr(e,i,n[i])}),vc=Sr(function(e,n){tn(n,_t(n),e)}),ai=Sr(function(e,n,i,u){tn(n,_t(n),e,u)}),fv=Sr(function(e,n,i,u){tn(n,Je(n),e,u)}),mv=hn(ha);function gv(e,n){var i=Cr(e);return n==null?i:Yl(i,n)}var hv=de(function(e,n){e=Te(e);var i=-1,u=n.length,f=u>2?n[2]:s;for(f&&mt(n[0],n[1],f)&&(u=1);++i<u;)for(var p=n[i],w=_t(p),y=-1,R=w.length;++y<R;){var O=w[y],P=e[O];(P===s||Qt(P,wr[O])&&!Ae.call(e,O))&&(e[O]=p[O])}return e}),pv=de(function(e){return e.push(s,Lu),Ct(_c,s,e)});function xv(e,n){return Fl(e,J(n,3),en)}function vv(e,n){return Fl(e,J(n,3),xa)}function _v(e,n){return e==null?e:pa(e,J(n,3),_t)}function bv(e,n){return e==null?e:tu(e,J(n,3),_t)}function wv(e,n){return e&&en(e,J(n,3))}function jv(e,n){return e&&xa(e,J(n,3))}function yv(e){return e==null?[]:Bs(e,Je(e))}function Cv(e){return e==null?[]:Bs(e,_t(e))}function Qa(e,n,i){var u=e==null?s:tr(e,n);return u===s?i:u}function Sv(e,n){return e!=null&&qu(e,n,Wg)}function Ya(e,n){return e!=null&&qu(e,n,Qg)}var Nv=Iu(function(e,n,i){n!=null&&typeof n.toString!="function"&&(n=Es.call(n)),e[n]=i},Za(bt)),Rv=Iu(function(e,n,i){n!=null&&typeof n.toString!="function"&&(n=Es.call(n)),Ae.call(e,n)?e[n].push(i):e[n]=[i]},J),Ev=de(es);function Je(e){return vt(e)?Wl(e):wa(e)}function _t(e){return vt(e)?Wl(e,!0):ih(e)}function Av(e,n){var i={};return n=J(n,3),en(e,function(u,f,p){mn(i,n(u,f,p),u)}),i}function Iv(e,n){var i={};return n=J(n,3),en(e,function(u,f,p){mn(i,f,n(u,f,p))}),i}var Fv=Sr(function(e,n,i){Us(e,n,i)}),_c=Sr(function(e,n,i,u){Us(e,n,i,u)}),Dv=hn(function(e,n){var i={};if(e==null)return i;var u=!1;n=ke(n,function(p){return p=On(p,e),u||(u=p.length>1),p}),tn(e,La(e),i),u&&(i=qt(i,b|j|_,Nh));for(var f=n.length;f--;)Ra(i,n[f]);return i});function Tv(e,n){return bc(e,ri(J(n)))}var Mv=hn(function(e,n){return e==null?{}:oh(e,n)});function bc(e,n){if(e==null)return{};var i=ke(La(e),function(u){return[u]});return n=J(n),du(e,i,function(u,f){return n(u,f[0])})}function Lv(e,n,i){n=On(n,e);var u=-1,f=n.length;for(f||(f=1,e=s);++u<f;){var p=e==null?s:e[nn(n[u])];p===s&&(u=f,p=i),e=xn(p)?p.call(e):p}return e}function Ov(e,n,i){return e==null?e:ns(e,n,i)}function Pv(e,n,i,u){return u=typeof u=="function"?u:s,e==null?e:ns(e,n,i,u)}var wc=Tu(Je),jc=Tu(_t);function qv(e,n,i){var u=ie(e),f=u||qn(e)||Er(e);if(n=J(n,4),i==null){var p=e&&e.constructor;f?i=u?new p:[]:$e(e)?i=xn(p)?Cr(Fs(e)):{}:i={}}return(f?Lt:en)(e,function(w,y,R){return n(i,w,y,R)}),i}function kv(e,n){return e==null?!0:Ra(e,n)}function $v(e,n,i){return e==null?e:pu(e,n,Ia(i))}function Bv(e,n,i,u){return u=typeof u=="function"?u:s,e==null?e:pu(e,n,Ia(i),u)}function Ar(e){return e==null?[]:la(e,Je(e))}function Uv(e){return e==null?[]:la(e,_t(e))}function zv(e,n,i){return i===s&&(i=n,n=s),i!==s&&(i=Bt(i),i=i===i?i:0),n!==s&&(n=Bt(n),n=n===n?n:0),er(Bt(e),n,i)}function Vv(e,n,i){return n=vn(n),i===s?(i=n,n=0):i=vn(i),e=Bt(e),Yg(e,n,i)}function Hv(e,n,i){if(i&&typeof i!="boolean"&&mt(e,n,i)&&(n=i=s),i===s&&(typeof n=="boolean"?(i=n,n=s):typeof e=="boolean"&&(i=e,e=s)),e===s&&n===s?(e=0,n=1):(e=vn(e),n===s?(n=e,e=0):n=vn(n)),e>n){var u=e;e=n,n=u}if(i||e%1||n%1){var f=Gl();return ut(e+f*(n-e+ym("1e-"+((f+"").length-1))),n)}return Ca(e,n)}var Gv=Nr(function(e,n,i){return n=n.toLowerCase(),e+(i?yc(n):n)});function yc(e){return Xa(Ne(e).toLowerCase())}function Cc(e){return e=Ne(e),e&&e.replace(Wf,Om).replace(mm,"")}function Kv(e,n,i){e=Ne(e),n=Nt(n);var u=e.length;i=i===s?u:er(oe(i),0,u);var f=i;return i-=n.length,i>=0&&e.slice(i,f)==n}function Wv(e){return e=Ne(e),e&&Ef.test(e)?e.replace(tl,Pm):e}function Qv(e){return e=Ne(e),e&&Mf.test(e)?e.replace(Gi,"\\$&"):e}var Yv=Nr(function(e,n,i){return e+(i?"-":"")+n.toLowerCase()}),Xv=Nr(function(e,n,i){return e+(i?" ":"")+n.toLowerCase()}),Zv=Ru("toLowerCase");function Jv(e,n,i){e=Ne(e),n=oe(n);var u=n?_r(e):0;if(!n||u>=n)return e;var f=(n-u)/2;return Ws(Ls(f),i)+e+Ws(Ms(f),i)}function e_(e,n,i){e=Ne(e),n=oe(n);var u=n?_r(e):0;return n&&u<n?e+Ws(n-u,i):e}function t_(e,n,i){e=Ne(e),n=oe(n);var u=n?_r(e):0;return n&&u<n?Ws(n-u,i)+e:e}function n_(e,n,i){return i||n==null?n=0:n&&(n=+n),ug(Ne(e).replace(Ki,""),n||0)}function r_(e,n,i){return(i?mt(e,n,i):n===s)?n=1:n=oe(n),Sa(Ne(e),n)}function s_(){var e=arguments,n=Ne(e[0]);return e.length<3?n:n.replace(e[1],e[2])}var i_=Nr(function(e,n,i){return e+(i?"_":"")+n.toLowerCase()});function a_(e,n,i){return i&&typeof i!="number"&&mt(e,n,i)&&(n=i=s),i=i===s?K:i>>>0,i?(e=Ne(e),e&&(typeof n=="string"||n!=null&&!Wa(n))&&(n=Nt(n),!n&&vr(e))?Pn(Kt(e),0,i):e.split(n,i)):[]}var o_=Nr(function(e,n,i){return e+(i?" ":"")+Xa(n)});function l_(e,n,i){return e=Ne(e),i=i==null?0:er(oe(i),0,e.length),n=Nt(n),e.slice(i,i+n.length)==n}function u_(e,n,i){var u=h.templateSettings;i&&mt(e,n,i)&&(n=s),e=Ne(e),n=ai({},n,u,Mu);var f=ai({},n.imports,u.imports,Mu),p=Je(f),w=la(f,p),y,R,O=0,P=n.interpolate||_s,k="__p += '",z=ca((n.escape||_s).source+"|"+P.source+"|"+(P===nl?Uf:_s).source+"|"+(n.evaluate||_s).source+"|$","g"),Q="//# sourceURL="+(Ae.call(n,"sourceURL")?(n.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++vm+"]")+`
`;e.replace(z,function(re,he,we,Et,gt,At){return we||(we=Et),k+=e.slice(O,At).replace(Qf,qm),he&&(y=!0,k+=`' +
__e(`+he+`) +
'`),gt&&(R=!0,k+=`';
`+gt+`;
__p += '`),we&&(k+=`' +
((__t = (`+we+`)) == null ? '' : __t) +
'`),O=At+re.length,re}),k+=`';
`;var ne=Ae.call(n,"variable")&&n.variable;if(!ne)k=`with (obj) {
`+k+`
}
`;else if($f.test(ne))throw new se(m);k=(R?k.replace(Cf,""):k).replace(Sf,"$1").replace(Nf,"$1;"),k="function("+(ne||"obj")+`) {
`+(ne?"":`obj || (obj = {});
`)+"var __t, __p = ''"+(y?", __e = _.escape":"")+(R?`, __j = Array.prototype.join;
function print() { __p += __j.call(arguments, '') }
`:`;
`)+k+`return __p
}`;var ue=Nc(function(){return Ce(p,Q+"return "+k).apply(s,w)});if(ue.source=k,Ka(ue))throw ue;return ue}function c_(e){return Ne(e).toLowerCase()}function d_(e){return Ne(e).toUpperCase()}function f_(e,n,i){if(e=Ne(e),e&&(i||n===s))return Ll(e);if(!e||!(n=Nt(n)))return e;var u=Kt(e),f=Kt(n),p=Ol(u,f),w=Pl(u,f)+1;return Pn(u,p,w).join("")}function m_(e,n,i){if(e=Ne(e),e&&(i||n===s))return e.slice(0,kl(e)+1);if(!e||!(n=Nt(n)))return e;var u=Kt(e),f=Pl(u,Kt(n))+1;return Pn(u,0,f).join("")}function g_(e,n,i){if(e=Ne(e),e&&(i||n===s))return e.replace(Ki,"");if(!e||!(n=Nt(n)))return e;var u=Kt(e),f=Ol(u,Kt(n));return Pn(u,f).join("")}function h_(e,n){var i=le,u=fe;if($e(n)){var f="separator"in n?n.separator:f;i="length"in n?oe(n.length):i,u="omission"in n?Nt(n.omission):u}e=Ne(e);var p=e.length;if(vr(e)){var w=Kt(e);p=w.length}if(i>=p)return e;var y=i-_r(u);if(y<1)return u;var R=w?Pn(w,0,y).join(""):e.slice(0,y);if(f===s)return R+u;if(w&&(y+=R.length-y),Wa(f)){if(e.slice(y).search(f)){var O,P=R;for(f.global||(f=ca(f.source,Ne(rl.exec(f))+"g")),f.lastIndex=0;O=f.exec(P);)var k=O.index;R=R.slice(0,k===s?y:k)}}else if(e.indexOf(Nt(f),y)!=y){var z=R.lastIndexOf(f);z>-1&&(R=R.slice(0,z))}return R+u}function p_(e){return e=Ne(e),e&&Rf.test(e)?e.replace(el,Hm):e}var x_=Nr(function(e,n,i){return e+(i?" ":"")+n.toUpperCase()}),Xa=Ru("toUpperCase");function Sc(e,n,i){return e=Ne(e),n=i?s:n,n===s?$m(e)?Wm(e):Fm(e):e.match(n)||[]}var Nc=de(function(e,n){try{return Ct(e,s,n)}catch(i){return Ka(i)?i:new se(i)}}),v_=hn(function(e,n){return Lt(n,function(i){i=nn(i),mn(e,i,Ha(e[i],e))}),e});function __(e){var n=e==null?0:e.length,i=J();return e=n?ke(e,function(u){if(typeof u[1]!="function")throw new Ot(c);return[i(u[0]),u[1]]}):[],de(function(u){for(var f=-1;++f<n;){var p=e[f];if(Ct(p[0],this,u))return Ct(p[1],this,u)}})}function b_(e){return Hg(qt(e,b))}function Za(e){return function(){return e}}function w_(e,n){return e==null||e!==e?n:e}var j_=Au(),y_=Au(!0);function bt(e){return e}function Ja(e){return iu(typeof e=="function"?e:qt(e,b))}function C_(e){return ou(qt(e,b))}function S_(e,n){return lu(e,qt(n,b))}var N_=de(function(e,n){return function(i){return es(i,e,n)}}),R_=de(function(e,n){return function(i){return es(e,i,n)}});function eo(e,n,i){var u=Je(n),f=Bs(n,u);i==null&&!($e(n)&&(f.length||!u.length))&&(i=n,n=e,e=this,f=Bs(n,Je(n)));var p=!($e(i)&&"chain"in i)||!!i.chain,w=xn(e);return Lt(f,function(y){var R=n[y];e[y]=R,w&&(e.prototype[y]=function(){var O=this.__chain__;if(p||O){var P=e(this.__wrapped__),k=P.__actions__=xt(this.__actions__);return k.push({func:R,args:arguments,thisArg:e}),P.__chain__=O,P}return R.apply(e,Fn([this.value()],arguments))})}),e}function E_(){return nt._===this&&(nt._=eg),this}function to(){}function A_(e){return e=oe(e),de(function(n){return uu(n,e)})}var I_=Da(ke),F_=Da(Il),D_=Da(ra);function Rc(e){return ka(e)?sa(nn(e)):lh(e)}function T_(e){return function(n){return e==null?s:tr(e,n)}}var M_=Fu(),L_=Fu(!0);function no(){return[]}function ro(){return!1}function O_(){return{}}function P_(){return""}function q_(){return!0}function k_(e,n){if(e=oe(e),e<1||e>_e)return[];var i=K,u=ut(e,K);n=J(n),e-=K;for(var f=oa(u,n);++i<e;)n(i);return f}function $_(e){return ie(e)?ke(e,nn):Rt(e)?[e]:xt(Ku(Ne(e)))}function B_(e){var n=++Zm;return Ne(e)+n}var U_=Ks(function(e,n){return e+n},0),z_=Ta("ceil"),V_=Ks(function(e,n){return e/n},1),H_=Ta("floor");function G_(e){return e&&e.length?$s(e,bt,va):s}function K_(e,n){return e&&e.length?$s(e,J(n,2),va):s}function W_(e){return Tl(e,bt)}function Q_(e,n){return Tl(e,J(n,2))}function Y_(e){return e&&e.length?$s(e,bt,ja):s}function X_(e,n){return e&&e.length?$s(e,J(n,2),ja):s}var Z_=Ks(function(e,n){return e*n},1),J_=Ta("round"),e0=Ks(function(e,n){return e-n},0);function t0(e){return e&&e.length?aa(e,bt):0}function n0(e,n){return e&&e.length?aa(e,J(n,2)):0}return h.after=Cx,h.ary=sc,h.assign=dv,h.assignIn=vc,h.assignInWith=ai,h.assignWith=fv,h.at=mv,h.before=ic,h.bind=Ha,h.bindAll=v_,h.bindKey=ac,h.castArray=Ox,h.chain=tc,h.chunk=Hh,h.compact=Gh,h.concat=Kh,h.cond=__,h.conforms=b_,h.constant=Za,h.countBy=tx,h.create=gv,h.curry=oc,h.curryRight=lc,h.debounce=uc,h.defaults=hv,h.defaultsDeep=pv,h.defer=Sx,h.delay=Nx,h.difference=Wh,h.differenceBy=Qh,h.differenceWith=Yh,h.drop=Xh,h.dropRight=Zh,h.dropRightWhile=Jh,h.dropWhile=ep,h.fill=tp,h.filter=rx,h.flatMap=ax,h.flatMapDeep=ox,h.flatMapDepth=lx,h.flatten=Xu,h.flattenDeep=np,h.flattenDepth=rp,h.flip=Rx,h.flow=j_,h.flowRight=y_,h.fromPairs=sp,h.functions=yv,h.functionsIn=Cv,h.groupBy=ux,h.initial=ap,h.intersection=op,h.intersectionBy=lp,h.intersectionWith=up,h.invert=Nv,h.invertBy=Rv,h.invokeMap=dx,h.iteratee=Ja,h.keyBy=fx,h.keys=Je,h.keysIn=_t,h.map=ei,h.mapKeys=Av,h.mapValues=Iv,h.matches=C_,h.matchesProperty=S_,h.memoize=ni,h.merge=Fv,h.mergeWith=_c,h.method=N_,h.methodOf=R_,h.mixin=eo,h.negate=ri,h.nthArg=A_,h.omit=Dv,h.omitBy=Tv,h.once=Ex,h.orderBy=mx,h.over=I_,h.overArgs=Ax,h.overEvery=F_,h.overSome=D_,h.partial=Ga,h.partialRight=cc,h.partition=gx,h.pick=Mv,h.pickBy=bc,h.property=Rc,h.propertyOf=T_,h.pull=mp,h.pullAll=Ju,h.pullAllBy=gp,h.pullAllWith=hp,h.pullAt=pp,h.range=M_,h.rangeRight=L_,h.rearg=Ix,h.reject=xx,h.remove=xp,h.rest=Fx,h.reverse=za,h.sampleSize=_x,h.set=Ov,h.setWith=Pv,h.shuffle=bx,h.slice=vp,h.sortBy=yx,h.sortedUniq=Sp,h.sortedUniqBy=Np,h.split=a_,h.spread=Dx,h.tail=Rp,h.take=Ep,h.takeRight=Ap,h.takeRightWhile=Ip,h.takeWhile=Fp,h.tap=Gp,h.throttle=Tx,h.thru=Js,h.toArray=hc,h.toPairs=wc,h.toPairsIn=jc,h.toPath=$_,h.toPlainObject=xc,h.transform=qv,h.unary=Mx,h.union=Dp,h.unionBy=Tp,h.unionWith=Mp,h.uniq=Lp,h.uniqBy=Op,h.uniqWith=Pp,h.unset=kv,h.unzip=Va,h.unzipWith=ec,h.update=$v,h.updateWith=Bv,h.values=Ar,h.valuesIn=Uv,h.without=qp,h.words=Sc,h.wrap=Lx,h.xor=kp,h.xorBy=$p,h.xorWith=Bp,h.zip=Up,h.zipObject=zp,h.zipObjectDeep=Vp,h.zipWith=Hp,h.entries=wc,h.entriesIn=jc,h.extend=vc,h.extendWith=ai,eo(h,h),h.add=U_,h.attempt=Nc,h.camelCase=Gv,h.capitalize=yc,h.ceil=z_,h.clamp=zv,h.clone=Px,h.cloneDeep=kx,h.cloneDeepWith=$x,h.cloneWith=qx,h.conformsTo=Bx,h.deburr=Cc,h.defaultTo=w_,h.divide=V_,h.endsWith=Kv,h.eq=Qt,h.escape=Wv,h.escapeRegExp=Qv,h.every=nx,h.find=sx,h.findIndex=Qu,h.findKey=xv,h.findLast=ix,h.findLastIndex=Yu,h.findLastKey=vv,h.floor=H_,h.forEach=nc,h.forEachRight=rc,h.forIn=_v,h.forInRight=bv,h.forOwn=wv,h.forOwnRight=jv,h.get=Qa,h.gt=Ux,h.gte=zx,h.has=Sv,h.hasIn=Ya,h.head=Zu,h.identity=bt,h.includes=cx,h.indexOf=ip,h.inRange=Vv,h.invoke=Ev,h.isArguments=sr,h.isArray=ie,h.isArrayBuffer=Vx,h.isArrayLike=vt,h.isArrayLikeObject=Ge,h.isBoolean=Hx,h.isBuffer=qn,h.isDate=Gx,h.isElement=Kx,h.isEmpty=Wx,h.isEqual=Qx,h.isEqualWith=Yx,h.isError=Ka,h.isFinite=Xx,h.isFunction=xn,h.isInteger=dc,h.isLength=si,h.isMap=fc,h.isMatch=Zx,h.isMatchWith=Jx,h.isNaN=ev,h.isNative=tv,h.isNil=rv,h.isNull=nv,h.isNumber=mc,h.isObject=$e,h.isObjectLike=Ue,h.isPlainObject=as,h.isRegExp=Wa,h.isSafeInteger=sv,h.isSet=gc,h.isString=ii,h.isSymbol=Rt,h.isTypedArray=Er,h.isUndefined=iv,h.isWeakMap=av,h.isWeakSet=ov,h.join=cp,h.kebabCase=Yv,h.last=$t,h.lastIndexOf=dp,h.lowerCase=Xv,h.lowerFirst=Zv,h.lt=lv,h.lte=uv,h.max=G_,h.maxBy=K_,h.mean=W_,h.meanBy=Q_,h.min=Y_,h.minBy=X_,h.stubArray=no,h.stubFalse=ro,h.stubObject=O_,h.stubString=P_,h.stubTrue=q_,h.multiply=Z_,h.nth=fp,h.noConflict=E_,h.noop=to,h.now=ti,h.pad=Jv,h.padEnd=e_,h.padStart=t_,h.parseInt=n_,h.random=Hv,h.reduce=hx,h.reduceRight=px,h.repeat=r_,h.replace=s_,h.result=Lv,h.round=J_,h.runInContext=S,h.sample=vx,h.size=wx,h.snakeCase=i_,h.some=jx,h.sortedIndex=_p,h.sortedIndexBy=bp,h.sortedIndexOf=wp,h.sortedLastIndex=jp,h.sortedLastIndexBy=yp,h.sortedLastIndexOf=Cp,h.startCase=o_,h.startsWith=l_,h.subtract=e0,h.sum=t0,h.sumBy=n0,h.template=u_,h.times=k_,h.toFinite=vn,h.toInteger=oe,h.toLength=pc,h.toLower=c_,h.toNumber=Bt,h.toSafeInteger=cv,h.toString=Ne,h.toUpper=d_,h.trim=f_,h.trimEnd=m_,h.trimStart=g_,h.truncate=h_,h.unescape=p_,h.uniqueId=B_,h.upperCase=x_,h.upperFirst=Xa,h.each=nc,h.eachRight=rc,h.first=Zu,eo(h,function(){var e={};return en(h,function(n,i){Ae.call(h.prototype,i)||(e[i]=n)}),e}(),{chain:!1}),h.VERSION=o,Lt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){h[e].placeholder=h}),Lt(["drop","take"],function(e,n){ve.prototype[e]=function(i){i=i===s?1:Ze(oe(i),0);var u=this.__filtered__&&!n?new ve(this):this.clone();return u.__filtered__?u.__takeCount__=ut(i,u.__takeCount__):u.__views__.push({size:ut(i,K),type:e+(u.__dir__<0?"Right":"")}),u},ve.prototype[e+"Right"]=function(i){return this.reverse()[e](i).reverse()}}),Lt(["filter","map","takeWhile"],function(e,n){var i=n+1,u=i==xe||i==X;ve.prototype[e]=function(f){var p=this.clone();return p.__iteratees__.push({iteratee:J(f,3),type:i}),p.__filtered__=p.__filtered__||u,p}}),Lt(["head","last"],function(e,n){var i="take"+(n?"Right":"");ve.prototype[e]=function(){return this[i](1).value()[0]}}),Lt(["initial","tail"],function(e,n){var i="drop"+(n?"":"Right");ve.prototype[e]=function(){return this.__filtered__?new ve(this):this[i](1)}}),ve.prototype.compact=function(){return this.filter(bt)},ve.prototype.find=function(e){return this.filter(e).head()},ve.prototype.findLast=function(e){return this.reverse().find(e)},ve.prototype.invokeMap=de(function(e,n){return typeof e=="function"?new ve(this):this.map(function(i){return es(i,e,n)})}),ve.prototype.reject=function(e){return this.filter(ri(J(e)))},ve.prototype.slice=function(e,n){e=oe(e);var i=this;return i.__filtered__&&(e>0||n<0)?new ve(i):(e<0?i=i.takeRight(-e):e&&(i=i.drop(e)),n!==s&&(n=oe(n),i=n<0?i.dropRight(-n):i.take(n-e)),i)},ve.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},ve.prototype.toArray=function(){return this.take(K)},en(ve.prototype,function(e,n){var i=/^(?:filter|find|map|reject)|While$/.test(n),u=/^(?:head|last)$/.test(n),f=h[u?"take"+(n=="last"?"Right":""):n],p=u||/^find/.test(n);f&&(h.prototype[n]=function(){var w=this.__wrapped__,y=u?[1]:arguments,R=w instanceof ve,O=y[0],P=R||ie(w),k=function(he){var we=f.apply(h,Fn([he],y));return u&&z?we[0]:we};P&&i&&typeof O=="function"&&O.length!=1&&(R=P=!1);var z=this.__chain__,Q=!!this.__actions__.length,ne=p&&!z,ue=R&&!Q;if(!p&&P){w=ue?w:new ve(this);var re=e.apply(w,y);return re.__actions__.push({func:Js,args:[k],thisArg:s}),new Pt(re,z)}return ne&&ue?e.apply(this,y):(re=this.thru(k),ne?u?re.value()[0]:re.value():re)})}),Lt(["pop","push","shift","sort","splice","unshift"],function(e){var n=Ss[e],i=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",u=/^(?:pop|shift)$/.test(e);h.prototype[e]=function(){var f=arguments;if(u&&!this.__chain__){var p=this.value();return n.apply(ie(p)?p:[],f)}return this[i](function(w){return n.apply(ie(w)?w:[],f)})}}),en(ve.prototype,function(e,n){var i=h[n];if(i){var u=i.name+"";Ae.call(yr,u)||(yr[u]=[]),yr[u].push({name:n,func:i})}}),yr[Gs(s,L).name]=[{name:"wrapper",func:s}],ve.prototype.clone=pg,ve.prototype.reverse=xg,ve.prototype.value=vg,h.prototype.at=Kp,h.prototype.chain=Wp,h.prototype.commit=Qp,h.prototype.next=Yp,h.prototype.plant=Zp,h.prototype.reverse=Jp,h.prototype.toJSON=h.prototype.valueOf=h.prototype.value=ex,h.prototype.first=h.prototype.head,Kr&&(h.prototype[Kr]=Xp),h},br=Qm();Yn?((Yn.exports=br)._=br,Ji._=br):nt._=br}).call(Ir)})(_i,_i.exports);var ze=_i.exports;const aj=t=>{const a=on.create(t[1]||{amount:null,scale:2});if(a.isFailure)throw a.error;const s=a.object,o=on.create(t[2]||{amount:null,scale:2});if(o.isFailure)throw o.error;const l=o.object,d=It.create(t[0]||{amount:null,scale:2});if(d.isFailure)throw d.error;const c=d.object,m=c.percentage(s.toNumber()).convertScale(2),g=c.subtract(m).convertScale(2),x=g.percentage(l.toNumber()).convertScale(2),v=g.add(x).convertScale(2);return{subtotalPrice:c.toObject(),discount:s.toObject(),discountPrice:m.toObject(),priceBeforeTaxes:g.toObject(),tax:l.toObject(),taxesPrice:x.toObject(),totalPrice:v.toObject()}},oj=({currency:t})=>{const{formState:a,control:s}=ln(),{formatNumber:o}=tf(),l=rn({control:s,name:["subtotal_price","discount","tax"]}),d=rn({control:s,name:"tax_label"})||C("quotes.form_fields.tax.label"),c=aj(l),m=o(c.subtotalPrice),g=o(c.discountPrice),x=o(c.taxesPrice),v=o(c.totalPrice),b=D.useMemo(()=>t.symbol||"",[t]);return r.jsx(Ve,{className:"w-full bg-muted",children:r.jsxs(He,{className:"flex flex-row items-end gap-2 p-4 border-t",children:[r.jsx("div",{className:"grid flex-1 h-16 grid-cols-1 auto-rows-max",children:r.jsxs("div",{className:"grid gap-1 font-semibold text-right text-muted-foreground",children:[r.jsx(it,{className:"text-sm",children:C("quotes.form_fields.subtotal_price.label")}),r.jsxs(et,{className:"flex items-baseline justify-end text-2xl tabular-nums",children:[m,r.jsx("span",{className:"ml-1 text-lg tracking-normal",children:b})]})]})}),r.jsx(lr,{orientation:"vertical",className:"w-px h-16 mx-2"}),r.jsxs("div",{className:"grid flex-1 h-16 grid-cols-2 gap-6 auto-rows-max",children:[r.jsxs("div",{className:"grid gap-1 font-medium text-muted-foreground",children:[r.jsx(it,{className:"text-sm",children:C("quotes.form_fields.discount.label")}),r.jsx(xi,{scale:2,disabled:a.disabled,placeholder:C("quotes.form_fields.discount.placeholder"),name:"discount",onChange:j=>{}})]}),r.jsxs("div",{className:"grid gap-1 font-semibold text-muted-foreground",children:[r.jsx(it,{className:"text-sm text-right",children:C("quotes.form_fields.discount_price.label")}),r.jsxs(et,{className:"flex items-baseline justify-end text-2xl tabular-nums",children:[g,r.jsx("span",{className:"ml-1 text-lg tracking-normal",children:b})]})]})]}),r.jsx(lr,{orientation:"vertical",className:"w-px h-16 mx-2"}),r.jsxs("div",{className:"grid flex-1 h-16 grid-cols-2 gap-6 auto-rows-max",children:[r.jsxs("div",{className:"grid gap-1 font-medium text-muted-foreground",children:[r.jsx(it,{className:"text-sm",children:d}),r.jsx(xi,{scale:2,disabled:a.disabled,placeholder:C("quotes.form_fields.tax.placeholder"),name:"tax"})]}),r.jsxs("div",{className:"grid gap-1 font-semibold text-muted-foreground",children:[r.jsx(it,{className:"text-sm text-right",children:C("quotes.form_fields.tax_price.label",{label:""})}),r.jsxs(et,{className:"flex items-baseline justify-end gap-1 text-2xl tabular-nums",children:[x,r.jsx("span",{className:"text-base font-medium tracking-normal",children:b})]})]})]})," ",r.jsx(lr,{orientation:"vertical",className:"w-px h-16 mx-2"}),r.jsx("div",{className:"grid flex-1 h-16 grid-cols-1 auto-rows-max",children:r.jsxs("div",{className:"grid gap-0",children:[r.jsx(it,{className:"text-sm font-semibold text-right text-foreground",children:C("quotes.form_fields.total_price.label")}),r.jsxs(et,{className:"flex items-baseline justify-end gap-1 text-3xl tabular-nums",children:[v,r.jsx("span",{className:"ml-1 text-lg tracking-normal",children:b})]})]})})]})})},mf=t=>{const{t:a}=We(),{percentage:s,cancel:o,error:l,isInProgress:d,onFinishDownload:c}=t,m=D.useId();return D.useEffect(()=>{d&&!l&&s===100&&c&&c()},[s,d,l,c]),r.jsx(Cn,{open:d,children:r.jsxs(Sn,{className:"sm:max-w-md",children:[r.jsxs(Nn,{children:[r.jsx(Rn,{children:a("quotes.downloading_dialog.title")}),r.jsx(fr,{children:a("quotes.downloading_dialog.description")})]}),r.jsxs("div",{className:"mb-4 space-y-2",id:m,children:[r.jsx(Jt,{children:a("quotes.downloading_dialog.progress.label",{status:a(d?"quotes.downloading_dialog.progress.status_in_progress":"quotes.downloading_dialog.progress.status_stopped")})}),r.jsx(cd,{value:s,max:100,getValueLabel:()=>a("quotes.downloading_dialog.progress.label",{})}),l&&r.jsx("p",{role:"alert",children:a("quotes.downloading_dialog.error")})]}),r.jsx(En,{className:"sm:justify-end",children:r.jsx(mi,{asChild:!0,children:r.jsx(U,{type:"button",variant:"secondary",onClick:()=>o(),children:a("quotes.downloading_dialog.cancel_button")})})})]})})},lj=({isInProgress:t,percentage:a,elapsed:s,cancel:o,error:l,className:d})=>{const[c,m]=D.useState(10);return D.useEffect(()=>{if(t&&a>0){const g=s/a*100;m(Math.max(0,Math.round(g-s)))}},[t,a,s]),!t&&!(l!=null&&l.errorMessage)?null:r.jsxs(Ve,{className:me("overflow-hidden",d),children:[r.jsx(ht,{children:r.jsxs(et,{className:"flex items-center justify-between",children:[l!=null&&l.errorMessage?C("quotes.pdf_generation.error"):C("quotes.pdf_generation.title"),t&&r.jsx(sb,{className:"w-4 h-4 animate-spin"}),(l==null?void 0:l.errorMessage)&&r.jsx(Y0,{className:"w-4 h-4 text-destructive"})]})}),r.jsx(He,{children:l!=null&&l.errorMessage?r.jsx("div",{className:"text-destructive",children:l==null?void 0:l.errorMessage}):r.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[r.jsxs("div",{className:"relative w-32 h-40 overflow-hidden rounded-lg bg-muted",children:[r.jsx("div",{className:"absolute bottom-0 left-0 right-0 transition-all duration-1000 ease-out bg-primary",style:{height:`${a}%`}}),r.jsx(eb,{className:"absolute transform -translate-x-1/2 -translate-y-1/2 animate-pulse top-1/2 left-1/2 text-muted-foreground",size:48})]}),r.jsx(cd,{value:a,className:"w-full"}),r.jsxs("div",{className:"text-sm text-center text-muted-foreground",children:[r.jsx("p",{children:C("quotes.pdf_generation.progress",{percentage:a})}),r.jsxs("div",{className:"hidden",children:[r.jsx("p",{children:C("quotes.pdf_generation.elapsed",{elapsed:s})}),c>0&&r.jsx("p",{children:C("quotes.pdf_generation.remaining",{estimatedTime:c})})]})]}),r.jsx(U,{variant:"destructive",onClick:o,className:"hidden",children:C("quotes.pdf_generation.cancel")})]})})]})},gf=({quote:t,className:a})=>{const{useReport:s,getQuotePDFFilename:o,useDownloader:l}=Br(),{download:d}=l(),{report:c,preview:m,isInProgress:g,...x}=s(),[v,b]=D.useState(void 0),j=D.useCallback(()=>{t&&d(t.id,o(t))},[t]);return D.useEffect(()=>{const _=setTimeout(()=>{t&&t.id&&m(t.id)},200);return()=>clearTimeout(_)},[t]),D.useEffect(()=>{if(!g&&c){const _=window.URL&&window.URL.createObjectURL?window.URL.createObjectURL(c):window.webkitURL.createObjectURL(c);return console.log(_),b(_),()=>{b(void 0),window.URL.revokeObjectURL(_)}}},[c,g]),t?g?r.jsx(lj,{isInProgress:g,...x}):r.jsx(F0,{file:v,className:"object-contain",onThumbnailClick:j}):r.jsx(Ve,{className:me("overflow-hidden",a),children:r.jsx(He,{className:"px-4 py-6 text-center",children:r.jsx("p",{className:"mx-auto",children:C("quotes.list.resume.select_quote")})})})};gf.whyDidYouRender=!0;const ls=Rb();function uj({row:t,table:a}){var l;const s=(l=a.options.meta)==null?void 0:l.catalogPicker;if(!s)return null;const o=s.quantities[t.index]??1;return r.jsx(ms,{type:"text",inputMode:"numeric",pattern:"[0-9]*",name:"quantity",className:"w-24",value:o,onChange:d=>{const c=d.target.value;c===""?s.setQuantity(t.index,""):/^[0-9]+$/.test(c)&&Number.isSafeInteger(Number(c))&&s.setQuantity(t.index,Number(c))}})}function cj({row:t,table:a}){var o;const s=(o=a.options.meta)==null?void 0:o.catalogPicker;return r.jsxs(U,{size:"sm",variant:"outline",className:"h-8 gap-1",onClick:l=>{l.preventDefault(),s==null||s.selectArticle(t.original,t.index)},children:[r.jsx($o,{className:"h-3.5 w-3.5"}),r.jsx("span",{className:"sr-only xl:not-sr-only xl:whitespace-nowrap",children:s==null?void 0:s.t("common.add")})]})}const Ao=({onSelect:t})=>{const a=un(),{t:s,i18n:o}=We(),{pagination:l,globalFilter:d,isFiltered:c}=mr(),[m,g]=D.useState([]),x=D.useCallback((A,E)=>{g(T=>{const q=[...T];return q[A]=E,q})},[]),v=()=>{g([])},{data:b,isPending:j,isError:_,error:N}=af({pagination:{pageIndex:l.pageIndex,pageSize:l.pageSize},searchTerm:d});D.useEffect(()=>{v()},[l,d,c]);const I=D.useMemo(()=>({catalogPicker:{quantities:m,t:s,setQuantity:x,selectArticle:(A,E)=>{const T=m[E]===""?1:m[E]??1;Number.isSafeInteger(T)&&T>=0&&t(A,T)}}}),[x,t,m,s]),$=D.useMemo(()=>[ls.accessor("description",{id:"description",header:()=>r.jsx(r.Fragment,{children:s("catalog.list.columns.description")})}),ls.accessor("points",{id:"points",header:()=>r.jsx("div",{className:"text-right",children:s("catalog.list.columns.points")}),cell:({renderValue:A})=>r.jsx("div",{className:"text-right",children:A()})}),ls.accessor("retail_price",{id:"retail_price",header:()=>r.jsx("div",{className:"text-right",children:s("catalog.list.columns.retail_price")}),cell:({row:A})=>{const E=It.create(A.original.retail_price).object;return r.jsx("div",{className:"text-right",children:E.toFormat()})}}),ls.display({id:"quantity",header:()=>r.jsx("div",{className:"font-medium text-right text-foreground",children:s("catalog.list.columns.quantity")}),cell:uj}),ls.display({id:"row-actions",header:()=>null,cell:cj})],[s,o.resolvedLanguage]),{table:L}=Oi({data:[...(b==null?void 0:b.items)||[]],columns:$,pageCount:(b==null?void 0:b.total_pages)??-1,meta:I});return _?r.jsx($r,{subtitle:N.message}):j?r.jsx(Mi,{columnCount:6,searchableColumnCount:1,filterableColumnCount:2,shrinkZero:!0}):(b==null?void 0:b.total_items)===0&&!c?r.jsx(Li,{subtitle:s("catalog.list.empty_state.subtitle"),buttonText:"",onButtonClick:()=>a("/catalog/add")}):r.jsx(Ti,{className:"bg-transparent border-0 shadow-none",table:L,paginationOptions:{visible:!0,enablePageSizeSelector:!1},footerClassName:"px-10 pt-2 border-t",children:r.jsx(of,{table:L})})};function dj({open:t,onOpenChange:a,onCreate:s}){const{t:o}=We(),l=D.useId(),d=D.useRef(!1),[c,m]=D.useState(""),g=()=>{m(""),a(!1)},x=()=>{c.trim()&&(d.current=!0,s(c),g())};return r.jsx(Cn,{open:t,onOpenChange:v=>{v||g()},children:r.jsxs(Sn,{onCloseAutoFocus:v=>{d.current&&(v.preventDefault(),d.current=!1)},children:[r.jsxs(Nn,{children:[r.jsx(Rn,{children:o("quotes.chapters.add")}),r.jsx(fr,{children:o("quotes.chapters.create_description")})]}),r.jsx(Jt,{htmlFor:l,children:o("quotes.chapters.description")}),r.jsx(ms,{id:l,value:c,onChange:v=>m(v.target.value),onKeyDown:v=>{v.key==="Enter"&&(v.preventDefault(),x())}}),r.jsxs(En,{children:[r.jsx(U,{type:"button",variant:"secondary",onClick:g,children:o("common.cancel")}),r.jsx(U,{type:"button",disabled:!c.trim(),onClick:x,children:o("common.add")})]})]})})}const fj=200;function mj(){const t=D.useRef(null),[a,s]=D.useState(!1),[o,l]=D.useState(!1),d=D.useRef(!1),c=D.useRef([]),m=D.useRef(0);return D.useLayoutEffect(()=>{var L,A;if(!d.current){d.current=!0;return}const g=++m.current,x=Array.from(((L=t.current)==null?void 0:L.querySelectorAll("[data-chapter-content]"))??[]),v=Array.from(new Set(x.map(E=>E.closest("tr"))));for(const E of v)E.toggleAttribute("inert",a),a?E.setAttribute("aria-hidden","true"):E.removeAttribute("aria-hidden");const b=v.flatMap(E=>Array.from(E.cells)),j=x.map(E=>({height:E.getBoundingClientRect().height,opacity:getComputedStyle(E).opacity})),_=b.map(E=>{const T=getComputedStyle(E);return{height:T.height,paddingTop:T.paddingTop,paddingBottom:T.paddingBottom,borderBottomWidth:T.borderBottomWidth}});if(c.current.forEach(E=>E.cancel()),c.current=[],!x.length||typeof x[0].animate!="function"||(A=window.matchMedia)!=null&&A.call(window,"(prefers-reduced-motion: reduce)").matches){l(a);return}const N=x.map(E=>E.getBoundingClientRect().height),I=b.map(E=>{const T=getComputedStyle(E);return{height:a?"0px":T.height,paddingTop:a?"0px":T.paddingTop,paddingBottom:a?"0px":T.paddingBottom,borderBottomWidth:a?"0px":T.borderBottomWidth}}),$={duration:fj,easing:"ease-in-out",fill:"both"};c.current=[...x.map((E,T)=>E.animate([{height:`${j[T].height}px`,opacity:j[T].opacity,overflow:"hidden"},{height:`${a?0:N[T]}px`,opacity:a?0:1,overflow:"hidden"}],$)),...b.map((E,T)=>E.animate([_[T],I[T]],$))],Promise.all(c.current.map(E=>E.finished)).then(()=>{m.current===g&&(l(a),a||(c.current.forEach(E=>E.cancel()),c.current=[]))}).catch(()=>{})},[a]),D.useLayoutEffect(()=>()=>{++m.current,c.current.forEach(g=>g.cancel())},[]),{ref:t,collapsed:a,hidden:o,toggle:()=>{l(!1),s(g=>!g)}}}const hf=({row:t,table:a,onDelete:s,confirmDelete:o=!0})=>{const l=()=>{var d;(d=a.options.meta)==null||d.deleteItems(t.index),s()};return r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsxs(U,{type:"button",variant:"outline",size:"sm",onClick:()=>{var d;return(d=a.options.meta)==null?void 0:d.insertItem(t.index)},children:[r.jsx(D0,{className:"w-4 h-4 mr-2"}),C("common.insert_row_above")]}),r.jsxs(U,{type:"button",variant:"outline",size:"sm",onClick:()=>{var d,c;return(d=a.options.meta)!=null&&d.insertItemBelow?a.options.meta.insertItemBelow(t.index):(c=a.options.meta)==null?void 0:c.insertItem(t.index+1)},children:[r.jsx(Xc,{className:"w-4 h-4 mr-2"}),C("common.insert_row_below")]}),r.jsxs(U,{type:"button",variant:"outline",size:"sm",onClick:()=>{var d;return(d=a.options.meta)==null?void 0:d.duplicateItems(t.index)},children:[r.jsx(Fi,{className:"w-4 h-4 mr-2"}),C("common.duplicate_row")]}),o?r.jsxs(dd,{children:[r.jsx(fd,{asChild:!0,children:r.jsxs(U,{type:"button",variant:"destructive",size:"sm",children:[r.jsx(pi,{className:"w-4 h-4 mr-2"}),C("common.remove_row")]})}),r.jsxs(md,{children:[r.jsxs(gd,{children:[r.jsx(hd,{children:C("quotes.inline_row_actions.delete_confirmation.title")}),r.jsx(pd,{children:C("quotes.inline_row_actions.delete_confirmation.description")})]}),r.jsxs(xd,{children:[r.jsx(vd,{children:C("common.cancel")}),r.jsx(_d,{asChild:!0,children:r.jsx(U,{type:"button",variant:"destructive",onClick:l,children:C("quotes.inline_row_actions.delete_confirmation.confirm")})})]})]})]}):r.jsxs(U,{type:"button",variant:"destructive",size:"sm",onClick:l,children:[r.jsx(pi,{className:"w-4 h-4 mr-2"}),C("common.remove_row")]})]})},Yo=D.forwardRef(({label:t=C("common.append_empty_row"),className:a,...s},o)=>r.jsxs(U,{type:"button",variant:"outline",ref:o,...s,children:[r.jsx(Q0,{className:t?"w-4 h-4 mr-2":"w-4 h-4"}),t&&r.jsx(r.Fragment,{children:t})]}));Yo.displayName="AppendEmptyRowButton";const Xo=D.forwardRef(({label:t=C("common.append_article"),className:a,...s},o)=>r.jsxs(U,{type:"button",variant:"outline",ref:o,...s,children:[" ",r.jsx($o,{className:t?"w-4 h-4 mr-2":"w-4 h-4"}),t&&r.jsx(r.Fragment,{children:t})]}));Xo.displayName="AppendCatalogArticleRowButton";const Zo=D.forwardRef(({label:t=C("common.append_block"),className:a,...s},o)=>r.jsxs(U,{type:"button",variant:"outline",ref:o,...s,children:[r.jsx($o,{className:t?"w-4 h-4 mr-2":"w-4 h-4"}),t&&r.jsx(r.Fragment,{children:t})]}));Zo.displayName="AppendBlockRowButton";function pf({onAddRow:t,onAddArticle:a,onAddBlock:s,size:o}){return r.jsxs(r.Fragment,{children:[r.jsx(Yo,{size:o,onClick:t}),r.jsx(Xo,{size:o,onClick:a}),r.jsx(Zo,{size:o,onClick:s})]})}function xf({title:t,description:a,icon:s=r.jsx(rb,{"aria-hidden":"true"}),className:o,...l}){return r.jsxs(lb,{className:me("border-border bg-muted/20",o),children:[r.jsxs(ub,{children:[r.jsx(cb,{variant:"icon",children:s}),r.jsx(db,{children:t}),r.jsx(fb,{children:a})]}),r.jsx(mb,{className:"max-w-none flex-row flex-wrap justify-center gap-2",children:r.jsx(pf,{size:"sm",...l})})]})}const vf=({table:t,showLineDiscountColumn:a,hasLineDiscounts:s,onShowLineDiscountColumnChange:o,extraControls:l,viewControls:d,selectionActions:c})=>{const m=(c==null?void 0:c.count)??t.getSelectedRowModel().rows.length,[g,x]=D.useState(!1),v=j=>{if(!j&&a&&s){x(!0);return}o(j)},b=r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex items-center gap-2 min-h-9",children:[r.jsx("div",{className:"grid gap-0.5",children:r.jsx(Jt,{htmlFor:"show-line-discount-column",children:C("quotes.discount_column.label")})}),r.jsx(xs,{id:"show-line-discount-column",checked:a,onCheckedChange:v})]}),r.jsx(Cn,{open:g,onOpenChange:x,children:r.jsxs(Sn,{children:[r.jsxs(Nn,{children:[r.jsx(Rn,{children:C("quotes.discount_column.confirmation.title")}),r.jsx(fr,{children:C("quotes.discount_column.confirmation.description")})]}),r.jsxs(En,{children:[r.jsx(U,{type:"button",variant:"secondary",onClick:()=>x(!1),children:C("common.cancel")}),r.jsx(U,{type:"button",onClick:()=>{o(!1),x(!1)},children:C("quotes.discount_column.confirmation.confirm")})]})]})})]});return r.jsxs("nav",{className:"flex flex-wrap items-center gap-3",children:[r.jsx(Gn,{role:"group",className:"flex-wrap gap-1 p-1 border rounded-md shadow-sm border-border bg-background",children:m>0?r.jsxs(r.Fragment,{children:[r.jsxs(at,{children:[r.jsx(ot,{asChild:!0,children:r.jsxs(U,{type:"button",variant:"ghost",size:"sm",onClick:()=>{var j;return c?c.duplicate():(j=t.options.meta)==null?void 0:j.duplicateItems()},children:[r.jsx(X0,{className:"w-4 h-4 sm:mr-2"}),r.jsx("span",{className:"sr-only sm:not-sr-only",children:C("common.duplicate_selected_rows")})]})}),r.jsx(lt,{children:C("common.duplicate_selected_rows_tooltip")})]}),r.jsxs(at,{children:[r.jsx(ot,{asChild:!0,children:r.jsxs(U,{type:"button",variant:"ghost",size:"sm",className:"text-destructive hover:bg-destructive/10 hover:text-destructive",onClick:()=>{var j;return c?c.remove():(j=t.options.meta)==null?void 0:j.deleteItems()},children:[r.jsx(pi,{className:"w-4 h-4 sm:mr-2"}),r.jsx("span",{className:"sr-only sm:not-sr-only",children:C("common.remove_selected_rows")})]})}),r.jsx(lt,{children:C("common.remove_selected_rows_tooltip")})]}),r.jsxs(at,{children:[r.jsx(ot,{asChild:!0,children:r.jsxs(U,{type:"button",variant:"ghost",size:"sm",onClick:()=>c?c.clear():t.resetRowSelection(),children:[r.jsx(ib,{className:"w-4 h-4 sm:mr-2"}),r.jsx("span",{className:"sr-only sm:not-sr-only",children:C("common.reset_selected_rows")})]})}),r.jsx(lt,{children:C("common.reset_selected_rows_tooltip")})]})]}):r.jsxs(r.Fragment,{children:[r.jsxs(at,{children:[r.jsx(ot,{asChild:!0,children:r.jsx(Yo,{variant:"ghost",size:"sm",onClick:()=>{var j;return(j=t.options.meta)==null?void 0:j.appendItem()}})}),r.jsx(lt,{children:C("common.append_empty_row_tooltip")})]}),r.jsxs(at,{children:[r.jsx(ot,{asChild:!0,children:r.jsx(Xo,{variant:"ghost",size:"sm",onClick:()=>{var j,_;return(_=(j=t.options.meta)==null?void 0:j.pickCatalogArticle)==null?void 0:_.call(j)}})}),r.jsx(lt,{children:C("common.append_article_tooltip")})]}),r.jsxs(at,{children:[r.jsx(ot,{asChild:!0,children:r.jsx(Zo,{variant:"ghost",size:"sm",onClick:()=>{var j,_;return(_=(j=t.options.meta)==null?void 0:j.pickBlock)==null?void 0:_.call(j)}})}),r.jsx(lt,{children:C("common.append_block_tooltip")})]})]})}),m>0&&r.jsx("p",{className:"px-1 text-sm whitespace-nowrap text-muted-foreground",children:C("common.rows_selected",{count:m})}),l&&m===0&&r.jsx(Gn,{role:"group",className:"flex-wrap gap-1 p-1 border rounded-md shadow-sm border-border bg-background",children:l}),r.jsxs("div",{className:"flex flex-wrap items-center w-full pt-2 border-t gap-x-4 gap-y-2 border-border xl:ml-auto xl:w-auto xl:border-t-0 xl:pt-0",children:[d,b]})]})},ar=t=>String(t).startsWith("chapter:"),gj=(t,{active:a,currentCoordinates:s,context:o})=>{var v;if(!["ArrowUp","ArrowDown"].includes(t.code))return;t.preventDefault();const l=o.droppableContainers.getEnabled().filter(b=>ar(b.id)===ar(a)).sort((b,j)=>{var _,N;return(((_=o.droppableRects.get(b.id))==null?void 0:_.top)??0)-(((N=o.droppableRects.get(j.id))==null?void 0:N.top)??0)}),d=((v=o.over)==null?void 0:v.id)??a,c=l.findIndex(b=>b.id===d),m=l[c+(t.code==="ArrowDown"?1:-1)],g=o.droppableRects.get(d),x=m&&o.droppableRects.get(m.id);if(g&&x)return{x:s.x+x.left-g.left,y:s.y+x.top+x.height/2-g.top-g.height/2}};function fi({children:t}){return r.jsx("div",{"data-chapter-content":!0,className:"min-w-0",children:t})}function hj({id:t,columns:a,hidden:s,collapsed:o,onAddRow:l,onAddArticle:d,onAddBlock:c}){const{t:m}=We(),{setNodeRef:g,isOver:x}=L0({id:`empty:${t}`,disabled:o});return r.jsx(jt,{ref:g,hidden:s,"data-empty-chapter":t,className:x?"bg-accent":"",children:r.jsx(zt,{colSpan:a,className:"p-4",children:r.jsx(fi,{children:r.jsx(xf,{title:m("quotes.chapters.empty_title"),description:m("quotes.chapters.empty"),icon:r.jsx(Ld,{"aria-hidden":"true"}),onAddRow:l,onAddArticle:d,onAddBlock:c})})})})}function pj({chapter:t,index:a,columns:s,children:o,onActivate:l,onDuplicate:d,onRemove:c,subtotal:m}){const{t:g}=We(),{control:x}=ln(),{ref:v,collapsed:b,hidden:j,toggle:_}=mj(),{attributes:N,listeners:I,setNodeRef:$,setActivatorNodeRef:L,transform:A,transition:E,isDragging:T}=rd({id:`chapter:${t.id}`});return r.jsxs(Ri,{ref:q=>{$(q),v.current=q},className:`bg-background
[&>tr:not([data-chapter-gap]):not([data-active-item])>td]:border-b
[&>tr:not([data-chapter-gap]):not([data-active-item])>td]:border-b-border
[&>tr:not([data-chapter-gap]):not([data-active-item])>:first-child]:border-l
[&>tr:not([data-chapter-gap]):not([data-active-item])>:first-child]:border-l-border
[&>tr:not([data-chapter-gap]):not([data-active-item])>:last-child]:border-r
[&>tr:not([data-chapter-gap]):not([data-active-item])>:last-child]:border-r-border
[&>tr[data-active-item]>td]:border-destructive/30
[&>tr[data-active-item]>td:first-child]:border-l-4
[&>tr[data-active-item]>td:first-child]:border-l-destructive
[&>tr[data-active-item]>td:last-child]:border-r
[&>tr[data-active-item=detail]>td]:border-t
[&>tr[data-active-item=detail]>td]:border-b-0
[&>tr[data-active-item=actions]>td]:border-b`,style:{transform:gi.Translate.toString(A),transition:E,opacity:T?.6:1},children:[a>0&&r.jsx(jt,{"data-chapter-gap":!0,"aria-hidden":"true",className:"border-0 bg-card hover:bg-card",children:r.jsx(zt,{colSpan:s,className:"h-5 p-0"})}),r.jsx(jt,{className:"group/chapter bg-muted hover:bg-muted [&>td]:border-t [&>td]:py-3 [&>td:first-child]:rounded-tl-md [&>td:last-child]:rounded-tr-md","data-chapter-id":t.id,children:r.jsx(zt,{colSpan:s,className:"px-2",children:r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsxs("div",{className:"relative self-center shrink-0 w-8 h-8 ml-1.5 mr-2.5",children:[r.jsx(U,{type:"button",variant:"ghost",size:"icon",ref:L,...N,...I,className:"w-8 h-8 touch-none cursor-grab active:cursor-grabbing text-muted-foreground",title:g("quotes.chapters.folder_help"),"aria-description":g("quotes.chapters.folder_help"),"aria-expanded":!b,"aria-label":g(b?"quotes.chapters.expand":"quotes.chapters.collapse",{number:a+1}),onFocus:l,onKeyDown:q=>{var Y;q.code==="Enter"&&!T||(Y=I==null?void 0:I.onKeyDown)==null||Y.call(I,q)},onClick:()=>{T||(_(),l())},children:b?r.jsx(nb,{className:"w-5 h-5","aria-hidden":"true"}):r.jsx(Ld,{className:"w-5 h-5","aria-hidden":"true"})}),r.jsx(wi,{"aria-hidden":"true",variant:"secondary",className:"pointer-events-none absolute -right-1 -top-1 flex h-4 min-w-4 items-center justify-center border-background bg-zinc-700 px-1 py-0 text-[10px] leading-none text-white hover:bg-zinc-700",children:a+1})]}),r.jsx(qr,{control:x,name:`chapters.${a}.description`,rules:{validate:q=>!!(q!=null&&q.trim())||g("quotes.chapters.title_required")},render:({field:q,fieldState:Y})=>r.jsxs("div",{className:"flex-1 min-w-0 -ml-px",children:[r.jsx(M0,{...q,value:q.value??"",rows:1,onFocus:l,"aria-label":g("quotes.chapters.title",{number:a+1}),"aria-invalid":!!Y.error,className:"px-0 font-semibold bg-transparent border-transparent shadow-none min-h-10 hover:border-input hover:bg-background focus-visible:border-input focus-visible:bg-background"}),Y.error&&r.jsx("p",{role:"alert",className:"text-sm text-destructive",children:Y.error.message})]})},`${t.id}:${a}`),r.jsx(U,{type:"button",variant:"ghost",size:"icon",onClick:d,className:"opacity-0 transition-opacity group-hover/chapter:opacity-100 focus-visible:opacity-100 motion-reduce:transition-none [@media(hover:none)]:opacity-100","aria-label":g("quotes.chapters.duplicate",{number:a+1}),children:r.jsx(Fi,{className:"w-4 h-4"})}),r.jsx(U,{type:"button",variant:"ghost",size:"icon",onClick:c,className:"opacity-0 transition-opacity group-hover/chapter:opacity-100 focus-visible:opacity-100 motion-reduce:transition-none [@media(hover:none)]:opacity-100","aria-label":g("quotes.chapters.remove",{number:a+1}),children:r.jsx(pi,{className:"w-4 h-4"})})]})})}),o(b,j),r.jsxs(jt,{className:"bg-muted/60 font-semibold hover:bg-muted/60 [&>td]:border-t-2 [&>td]:py-3 [&>td:first-child]:rounded-bl-md [&>td:last-child]:rounded-br-md","data-chapter-footer":t.id,children:[r.jsx(zt,{colSpan:s-1,className:"pl-4 text-sm text-muted-foreground",children:g("quotes.chapters.subtotal",{number:a+1,description:t.description})}),r.jsx(zt,{className:"text-base text-right whitespace-nowrap",children:m})]})]})}function xj({controller:t,columns:a,data:s,defaultItem:o,currencyCode:l,showLineDiscountColumn:d,hasLineDiscounts:c,onShowLineDiscountColumnChange:m,onAddChapter:g,pickCatalogArticle:x,pickBlock:v}){const{t:b}=We(),{watch:j,setValue:_}=ln(),[N,I]=D.useState({}),[$,L]=D.useState(null),[A,E]=D.useState(null),[T,q]=D.useState(!1),[Y,H]=D.useState(""),{chapters:ce,items:pe}=t,le=s.flatMap((B,be)=>N[B.id]?[be]:[]),fe=()=>{I({}),L(null)},V=B=>{t.apply(B),fe()},Z=B=>V(Yw(t.read(),B.chapters,B.indexes)),xe=B=>{var De,Le;const be=t.read();if(!be.items.some((ye,ge)=>B.indexes.includes(ge)||B.chapters.includes(ye.chapter_id??""))){const ye=Bc(be,B.chapters,B.indexes);if(B.chapters.includes(t.activeId??"")){const ge=be.chapters.findIndex(pt=>pt.id===t.activeId);t.setActiveId(((De=ye.chapters[Math.max(0,ge-1)])==null?void 0:De.id)??((Le=ye.chapters[0])==null?void 0:Le.id)??null)}V(ye);return}H(""),E(B)},Be=B=>{var Le,ye;if(!A)return;const be=t.read(),Ee=be.chapters.findIndex(ge=>ge.id===t.activeId),De=B==="ungroup"?$c(be):Bc(be,A.chapters,A.indexes,B==="transfer"?Y:void 0);De.chapters.some(ge=>ge.id===t.activeId)||t.setActiveId(((Le=De.chapters[Math.max(0,Ee-1)])==null?void 0:Le.id)??((ye=De.chapters[0])==null?void 0:ye.id)??null),V(De),E(null)},X={chapters:[],indexes:le},Pe=le.length,_e=(B,be=!1)=>{var De;const Ee=t.read();V(di(Ee,o,((De=Ee.items[B])==null?void 0:De.chapter_id)??t.destination(),B,be))},je=Wo({data:s,columns:a,getCoreRowModel:Ko(),getRowId:B=>B.id,state:{rowSelection:N,columnVisibility:{discount:d}},onRowSelectionChange:I,enableSorting:!1,meta:{insertItem:B=>_e(B),insertItemBelow:B=>_e(B,!0),appendItem:()=>V(di(t.read(),o,t.destination())),pickCatalogArticle:x,pickBlock:v,duplicateItems:B=>Z(B===void 0?X:{chapters:[],indexes:[B]}),deleteItems:B=>xe(B===void 0?X:{chapters:[],indexes:Array.isArray(B)?B:[B]}),updateItem:(B,be,Ee,De)=>{const Le=t.read();V({...Le,items:Le.items.map((ye,ge)=>ge===B?{...be,...ye,[Ee]:De}:ye)})}}}),W=sd(Fr(id,{activationConstraint:{distance:6}}),Fr(ad,{coordinateGetter:gj})),K=({active:B,over:be})=>{var De;if(!be||B.id===be.id)return;const Ee=t.read();if(ar(B.id)){if(!ar(be.id))return;const Le=String(B.id).slice(8),ye=String(be.id).slice(8);V(Xw(Ee,[Le],ye,Ee.chapters.findIndex(ge=>ge.id===Le)<Ee.chapters.findIndex(ge=>ge.id===ye)))}else{const Le=s.findIndex(An=>An.id===B.id);if(Le<0)return;const ye=le.includes(Le)?le:[Le],ge=s.findIndex(An=>An.id===be.id),pt=String(be.id).startsWith("empty:")?String(be.id).slice(6):(De=Ee.items[ge])==null?void 0:De.chapter_id;if(!pt)return;const tt=B.rect.current.translated,Ht=ge>=0&&(tt?tt.top+tt.height/2>=be.rect.top+be.rect.height/2:Le<ge);V(Zw(Ee,ye,pt,ge<0?void 0:ge,Ht)),t.setActiveId(pt)}},Se=!!(A!=null&&A.chapters.length),Dt=ce.filter(B=>!(A!=null&&A.chapters.includes(B.id))),yt=A?pe.filter((B,be)=>A.indexes.includes(be)||A.chapters.includes(B.chapter_id??"")).length:0,Tt=je.getVisibleLeafColumns().length;return r.jsxs(r.Fragment,{children:[r.jsx(bd,{sensors:W,onDragEnd:K,onDragStart:({active:B})=>{(ar(B.id)||!N[B.id])&&fe()},collisionDetection:B=>{const be={...B,droppableContainers:B.droppableContainers.filter(Ee=>ar(Ee.id)===ar(B.active.id))};return B.pointerCoordinates?T0(be):od(be)},accessibility:{screenReaderInstructions:{draggable:b("quotes.chapters.drag_instructions")},announcements:{onDragStart:()=>b("quotes.chapters.drag_start"),onDragOver:()=>b("quotes.chapters.drag_over"),onDragEnd:()=>b("quotes.chapters.drag_end"),onDragCancel:()=>b("quotes.chapters.drag_cancel")}},children:r.jsxs(Ve,{children:[r.jsx(ht,{className:"sticky z-10 top-16 bg-card/90",children:r.jsx(vf,{table:je,showLineDiscountColumn:d,hasLineDiscounts:c,onShowLineDiscountColumnChange:m,selectionActions:{count:Pe,duplicate:()=>Z(X),remove:()=>xe(X),clear:fe},extraControls:r.jsxs(r.Fragment,{children:[r.jsxs(U,{type:"button",variant:"ghost",size:"sm",onClick:g,children:[r.jsx(Od,{className:"w-4 h-4 sm:mr-2"}),b("quotes.chapters.add")]}),r.jsxs(U,{type:"button",variant:"ghost",size:"sm",onClick:()=>q(!0),children:[r.jsx(tb,{className:"w-4 h-4 sm:mr-2"}),b("quotes.chapters.ungroup")]})]}),viewControls:r.jsxs("div",{className:"flex items-center gap-2 min-h-9",children:[r.jsx(Jt,{htmlFor:"chapter-line-amounts",children:b("quotes.chapters.show_amounts")}),r.jsx(xs,{id:"chapter-line-amounts",checked:j("show_chapter_line_amounts")??!0,onCheckedChange:B=>_("show_chapter_line_amounts",B,{shouldDirty:!0})})]})})}),r.jsx(He,{children:r.jsxs(Si,{className:"border-separate table-fixed border-spacing-0",children:[r.jsx("colgroup",{children:je.getVisibleLeafColumns().map(B=>r.jsx("col",{style:{width:B.getSize()}},B.id))}),r.jsx(bo,{items:ce.map(B=>`chapter:${B.id}`),strategy:wo,children:ce.map((B,be)=>{const Ee=je.getRowModel().rows.filter(De=>{var Le;return((Le=pe[De.index])==null?void 0:Le.chapter_id)===B.id});return r.jsx(pj,{chapter:B,index:be,columns:Tt,onActivate:()=>t.setActiveId(B.id),onDuplicate:()=>Z({chapters:[B.id],indexes:[]}),onRemove:()=>xe({chapters:[B.id],indexes:[]}),subtotal:Jw(pe,B.id,l).toFormat(),children:(De,Le)=>r.jsxs(r.Fragment,{children:[Ee.length>0&&je.getHeaderGroups().map(ye=>r.jsx(jt,{hidden:Le,"data-chapter-columns":B.id,className:"bg-muted/30 hover:bg-muted/30",children:ye.headers.map(ge=>r.jsx(Ni,{scope:"col",className:"px-2",children:r.jsx(fi,{children:ge.column.id==="select"?r.jsx(ds,{"aria-label":b("quotes.chapters.select_details",{number:be+1}),checked:Ee.every(pt=>pt.getIsSelected())||Ee.some(pt=>pt.getIsSelected())&&"indeterminate",onCheckedChange:pt=>{I(tt=>{const Ht={...tt};for(const An of Ee)pt?Ht[An.id]=!0:delete Ht[An.id];return Ht})}}):ge.isPlaceholder?null:kr(ge.column.columnDef.header,ge.getContext())})},ge.id))},ye.id)),r.jsxs(bo,{items:De?[]:Ee.map(ye=>ye.id),strategy:wo,children:[Ee.map(ye=>r.jsxs(D.Fragment,{children:[r.jsx(cf,{id:ye.id,hidden:Le,disabled:De,isActive:$===ye.id,onActivate:ge=>{ge.target.closest('[role="checkbox"]')||(L(ye.id),t.setActiveId(B.id))},children:ye.getVisibleCells().map(ge=>r.jsx(zt,{className:ge.column.id==="description"?"py-2 pl-4 pr-2 align-top":"px-2 py-2 align-top",children:r.jsx(fi,{children:kr(ge.column.columnDef.cell,ge.getContext())})},ge.id))}),$===ye.id&&r.jsx(jt,{hidden:Le,"data-active-item":"actions",className:"bg-destructive/5 hover:bg-destructive/5 focus-within:bg-destructive/5",children:r.jsx(zt,{colSpan:Tt,className:"px-2 py-2",children:r.jsx(fi,{children:r.jsx(hf,{confirmDelete:!1,row:ye,table:je,onDelete:()=>L(null)})})})})]},ye.id)),!Ee.length&&r.jsx(hj,{id:B.id,columns:Tt,hidden:Le,collapsed:De,onAddRow:()=>{t.setActiveId(B.id),V(di(t.read(),o,B.id))},onAddArticle:()=>{t.setActiveId(B.id),x(B.id)},onAddBlock:()=>{t.setActiveId(B.id),v(B.id)}})]})]})},B.id)})})]})})]})}),r.jsx(Cn,{open:!!A,onOpenChange:B=>{B||E(null)},children:r.jsxs(Sn,{className:"max-h-[85vh] w-[calc(100%_-_2rem)] overflow-y-auto rounded-lg sm:max-w-xl",children:[r.jsxs(Nn,{className:"pr-5 text-left",children:[r.jsx(Rn,{children:b(Se?"quotes.chapters.delete_chapter_title":"quotes.chapters.delete_title")}),r.jsx(fr,{children:b(Se?"quotes.chapters.delete_chapter_description":"quotes.chapters.delete_details_description",{details:yt})})]}),Se?r.jsxs("div",{className:"space-y-4",children:[r.jsxs("section",{"aria-labelledby":"chapter-keep-title",className:"space-y-3 rounded-lg border border-border bg-muted/20 p-4",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("h3",{id:"chapter-keep-title",className:"text-sm font-semibold",children:b("quotes.chapters.keep_details_title")}),r.jsx("p",{className:"text-sm text-muted-foreground",children:b(Dt.length?"quotes.chapters.transfer_description":"quotes.chapters.keep_ungroup_description",{details:yt})})]}),Dt.length?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Jt,{htmlFor:"chapter-transfer",children:b("quotes.chapters.destination")}),r.jsxs(Un,{value:Y,onValueChange:H,children:[r.jsx(zn,{id:"chapter-transfer",children:r.jsx(Vn,{placeholder:b("quotes.chapters.choose_destination")})}),r.jsx(Hn,{children:Dt.map(B=>r.jsxs(Xt,{value:B.id,children:[ce.findIndex(be=>be.id===B.id)+1,"."," ",B.description]},B.id))})]})]}),r.jsx(U,{type:"button",variant:"outline",className:"h-auto min-h-10 w-full whitespace-normal",disabled:!Y,onClick:()=>Be("transfer"),children:b("quotes.chapters.transfer_action")})]}):r.jsx(U,{type:"button",variant:"outline",className:"h-auto min-h-10 w-full whitespace-normal",onClick:()=>Be("ungroup"),children:b("quotes.chapters.keep_ungroup_action")})]}),r.jsxs("section",{"aria-labelledby":"chapter-delete-content-title",className:"space-y-3 rounded-lg border border-destructive/20 bg-destructive/5 p-4",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("h3",{id:"chapter-delete-content-title",className:"text-sm font-semibold text-destructive",children:b("quotes.chapters.delete_all_title")}),r.jsx("p",{className:"text-sm text-muted-foreground",children:b("quotes.chapters.delete_all_description",{details:yt})})]}),r.jsx(U,{type:"button",variant:"destructive",className:"h-auto min-h-10 w-full whitespace-normal",onClick:()=>Be("delete"),children:b("quotes.chapters.delete_all_title")})]})]}):r.jsx(U,{type:"button",variant:"destructive",onClick:()=>Be("delete"),children:b("quotes.chapters.delete_content")}),r.jsx(En,{children:r.jsx(U,{type:"button",variant:"secondary",className:"w-full sm:w-auto",onClick:()=>E(null),children:b("common.cancel")})})]})}),r.jsx(Cn,{open:T,onOpenChange:q,children:r.jsxs(Sn,{children:[r.jsxs(Nn,{children:[r.jsx(Rn,{children:b("quotes.chapters.ungroup")}),r.jsx(fr,{children:b("quotes.chapters.ungroup_description")})]}),r.jsxs(En,{children:[r.jsx(U,{type:"button",variant:"secondary",onClick:()=>q(!1),children:b("common.cancel")}),r.jsx(U,{type:"button",onClick:()=>{V($c(t.read())),t.setActiveId(null),q(!1)},children:b("quotes.chapters.ungroup_keep")})]})]})})]})}const vj={keyframes({transform:t}){return[{opacity:1,transform:gi.Transform.toString(t.initial)},{opacity:0,transform:gi.Transform.toString({...t.final,x:t.final.x+5,y:t.final.y+5})}]},easing:"ease-out",sideEffects({active:t}){t.node.animate([{opacity:0},{opacity:1}],{duration:Ic.duration,easing:Ic.easing})}};function _j({activeId:t,selectedCount:a}){return O0.createPortal(r.jsx(P0,{dropAnimation:vj,className:"z-40 opacity-100",children:t&&r.jsx("div",{className:"relative flex flex-wrap",children:a>0&&r.jsx(wi,{variant:"destructive",className:"absolute z-50 flex items-center justify-center w-2 h-2 p-3 rounded-full top left -left-2 -top-2",children:a})})}),document.body)}function bj({table:t,rows:a,sortableRowIds:s,activeRowId:o,onActivate:l,onDeactivate:d}){return r.jsx(Ri,{children:r.jsx(bo,{items:s,strategy:wo,children:a.map(c=>{const m=c.id===o;return r.jsxs(D.Fragment,{children:[r.jsx(cf,{id:c.id,isActive:m,onActivate:()=>l(c.id),children:c.getVisibleCells().map(g=>r.jsx(zt,{className:"px-2 py-2 align-top",style:{width:g.column.getSize()===Number.MAX_SAFE_INTEGER?"auto":g.column.getSize()},children:kr(g.column.columnDef.cell,g.getContext())},g.id))}),m&&r.jsx(jt,{className:"border border-t-0 border-l-4 border-destructive/30 border-l-destructive bg-destructive/5 hover:bg-destructive/5",children:r.jsx(zt,{colSpan:c.getVisibleCells().length,className:"px-2 py-2",children:r.jsx(hf,{row:c,table:t,onDelete:d})})})]},c.id)})})})}function wj({table:t}){return r.jsx(Do,{className:"sticky top-0 z-10 bg-background",children:t.getHeaderGroups().map(a=>r.jsx(jt,{className:"hover:bg-transparent",children:a.headers.map(s=>r.jsx(Ni,{className:"px-2 py-1",style:{width:s.getSize()===Number.MAX_SAFE_INTEGER?"auto":s.getSize()},children:!s.isPlaceholder&&r.jsx(ef,{table:t,header:s})},s.id))},a.id))})}function jj(t){const{t:a}=We(),{table:s,activeId:o,activeRowId:l,setActiveRowId:d,rows:c,sortableRowIds:m,dragContextProps:g}=sj(t),x=t.data.length===0,v={onAddRow:()=>{var b;return(b=s.options.meta)==null?void 0:b.appendItem()},onAddArticle:()=>{var b,j;return(j=(b=s.options.meta)==null?void 0:b.pickCatalogArticle)==null?void 0:j.call(b)},onAddBlock:()=>{var b,j;return(j=(b=s.options.meta)==null?void 0:b.pickBlock)==null?void 0:j.call(b)}};return r.jsx(bd,{...g,children:r.jsxs(Ve,{children:[r.jsx(ht,{className:"sticky z-10 top-16 bg-card/90",children:r.jsx(et,{children:r.jsx(vf,{table:s,extraControls:t.extraControls,showLineDiscountColumn:t.showLineDiscountColumn,hasLineDiscounts:t.hasLineDiscounts,onShowLineDiscountColumnChange:t.onShowLineDiscountColumnChange})})}),r.jsxs(He,{children:[x?r.jsx(xf,{title:a("quotes.empty_details.title"),description:a("quotes.empty_details.description"),className:"p-4 sm:p-8",...v}):r.jsxs(Si,{className:"table-fixed",children:[r.jsx(wj,{table:s}),r.jsx(bj,{table:s,rows:c,sortableRowIds:m,activeRowId:l,onActivate:d,onDeactivate:()=>d(null)})]}),r.jsx(_j,{activeId:o,selectedCount:s.getSelectedRowModel().rows.length})]}),!x&&r.jsx(Ut,{children:r.jsx(Gn,{children:r.jsx(pf,{...v})})})]})})}const yj=[{id:50,code:"CAP_SEP_AMBIENTES_ES",title:"CARACTERISTICAS SEPARACIÓN DE AMBIENTES",body:`Medida de Hueco: 2450x3000 mm.\r
Modelo: LYN / Acabado: ANODIZADO / Color: NEGRO\r
Nº de travesaños: 2 TRAVESAÑOS HORIZONTALES\r
Acabado paneles: TRANSPARENTE TEMPLADO \r
Tirador: DOBLE POR PUERTA\r
Freno: DOBLE POR PUERTA (APERTURA Y CIERRE)\r
Guía: VISTA (DOBLE EMBELLECEDOR)\r
Nº de hojas: 2 CORREDERAS + 2 FIJOS`},{id:51,code:"CAP_FRE_ARM_CORREDERA_ES",title:"CARACTERISTICAS FRENTE DE ARMARIO CORREDERA",body:`Medida de Hueco:2440x5180mm.\r
Modelo: PANORAMIC P.O. / Acabado: LACADO / Color: BLANCO\r
Nº de lístelos: SIN LISTELOS / Acabado paneles: PANEL LACADO\r
Tirador:\r
Cerco perimetral: \r
Nº de hojas:\r
FRENO HIDRAULICO INCORPORADO O FRENO MAGNETICO INCORPORADO\r
Compuesto por:`},{id:52,code:"CAP_FRE_ARM_ABATIBLE_ES",title:"CARACTERISTICAS FRENTE DE ARMARIO",body:`Medida de hueco: 2275x1390 mm.\r
Modelo: ARGO / Acabado: LACADO / Color: A DETERMINAR\r
Grosor hoja: 22 o 19 mm\r
Acabado de hojas: LISAS\r
Tirador: UÑERO A DETERMINAR\r
Acabado herrajes: CROMADO O ANTRACITA\r
Jambas perimetrales: VISTAS, REMETIDAS O COMBI A DETERMINAR.\r
Nº de hojas: 2\r
Compuesto por:`},{id:53,code:"CAP_INT_ARM_FORRADO_ES",title:"CARACTERISTICAS INTERIOR DE ARMARIO",body:`Acabado: MELAMINA / color: A DETERMINAR\r
Espesor bloque: 19 mm. / Espesor complementos: 19 mm.\r
Barras de colgar: CROMO/ NEGRA/ BRONCE\r
Frentes cristal cajones: RECTO / “U” – FLOAT BRONCE C-424\r
Tirador cajones: FRENTE BAJO / Cajones: 4 DE 180 MM. A DETERMINAR\r
Baldas deslizantes: X DE 145 MM. A DETERMINAR\r
Compuesto por:`},{id:54,code:"CAP_CLA_SEMI_SUSPENDIDO_ES",title:"Acabado: MELAMINA / color: A DETERMINAR",body:`Medida de Hueco: 2450x3000 mm.\r
Espesor bloque: 25 mm. / Espesor complementos: 25 mm.\r
Barras de colgar: CROMO/ NEGRA/ BRONCE\r
Frentes cristal cajones: RECTO / “U” – FLOAT BRONCE C-424\r
Tirador cajones: FRENTE BAJO / Cajones: 4 DE 180 MM. A DETERMINAR\r
Baldas deslizantes: X DE 145 MM. A DETERMINAR\r
Compuesto por:`},{id:2000000108,code:"CAP_INT_EST_CRISTAL_ES",title:"Acabado bastidores: ANODIZADO NEGRO",body:`Acabado panel bastidores laterales: CRISTAL TEMPLADO FLOAT BRONCE C-424\r
Acabado trasera: CRISTAL TEMPLADO FLOAT BRONCE C-424\r
Acabado complementos: MELAMINA / Color: ROBLE DENBER M-242\r
Espesor complementos: 25 mm.\r
Barras de colgar: NEGRA\r
Frentes cristal cajones: RECTO / “U” – FLOAT BRONCE C-424 \r
Tirador cajones: xxxxx / Cajones: 4 DE 180 MM.\r
Compuesto por:`}],Cj=[{id:2000000098,code:"CAP_CLA_SEMI_SUSPENDIDO_EN",title:"Finish: MELAMINE / colour: TO BE DETERMINED",body:`Size of opening: 2450x3000 mm.\r
Thickness block: 19 mm / Thickness complements: 19 mm.\r
Hanging rods: CHROME/ BLACK\r
Glass drawer fronts: STRAIGHT / "U" - FLOAT BRONZE C-424 \r
Drawer handle: xxxxx / Drawers: 4 DE 180 MM.\r
Shoe rack door: YES/NO / Profile finish: BLACK LACQUER / SILVER MATTE\r
Shoe cabinet door glass finish: FLOAT BRONZE C-424\r
Composed of:`},{id:2000000084,code:"CAP_FRE_ARM_ABATIBLE_EN",title:"CHARACTERISTICS OF THE FRONT OF THE HINGED WARDROBE",body:`Size of opening: 2275x1390 mm.\r
Model: ARGO / Finish: LACQUER / Colour: TO BE DETERMINED\r
Door thickness: 22 or 19 mm\r
Door finish: SMOOTH \r
Handle: KNOB TO BE DETERMINED\r
Hardware finish: CHROME OR ANTHRACITE\r
Perimetral doorposts: VISIBLE, REMETED OR COMBI TO BE DETERMINED.\r
Number of doors: 2 \r
Composed of:`},{id:2000000089,code:"CAP_FRE_ARM_CORREDERA_EN",title:"Size of opening: 2440x5180mm. ",body:`Model: PANORAMIC P.O. / Finish: LACQUER / Colour: WHITE\r
No. of listers: NO LISTELS / Panels finish: LACQUERED PANEL \r
Handle: \r
Perimeter frame: \r
Nº of doors: \r
INCORPORATED HYDRAULIC BRAKE (not available in lower doors of 650 mm.) OR INCORPORATED MAGNETIC BRAKE. \r
Composed of:`},{id:2000000092,code:"CAP_INT_ARM_FORRADO_EN",title:"Finish: MELAMINE / colour: TO BE DETERMINED",body:`Thickness block: 19 mm / Thickness complements: 19 mm.\r
Hanging rods: CHROME/ BLACK\r
Glass drawer fronts: STRAIGHT / "U" - FLOAT BRONZE C-424 \r
Drawer handle: xxxxx / Drawers: 4 DE 180 MM.\r
Composed of:`},{id:2000000109,code:"CAP_INT_EST_CRISTAL_EN",title:"Frames finish: BLACK ANODIZED",body:`Side frame panel finish: BRONZE FLOAT BRONZE GLASS C-424\r
Rear panel finish: BRONZE FLOAT GLASS C-424\r
Complements finish: MELAMIN / Colour: DENBER OAK M-242\r
Thickness of accessories: 25 mm.\r
Hanging bars: BLACK\r
Glass drawer fronts: STRAIGHT / "U" - FLOAT BRONZE C-424 \r
Drawer handle: xxxxx / Drawers: 4 DE 180 MM.\r
Composed of:`},{id:2000000095,code:"CAP_SEP_AMBIENTES_EN",title:"CHARACTERISTICS SEPARATION OF ROOMS",body:`Size of opening: 2450x3000 mm.\r
Model: LYN / Finish: ANODISED / Colour: BLACK\r
No. of crosspieces: 2 HORIZONTAL CROSSBARS\r
Panel finish: TRANSPARENT TEMPLARED \r
Handle: DOUBLE PER DOOR\r
Brake: DOUBLE PER DOOR (OPENING AND CLOSING)\r
Guide: VISTA (DOUBLE EMBELLECEDOR)\r
Number of panels: 2 SLIDING + 2 FIXED`}],Sj=[{id:2000000121,code:"CAP_CLA_SEMI_SUSPENDIDO_FR",title:"CARACTÉRISTIQUES DRESSING CLASSIQUE / SEMI-SUSPENDU / SUSPENDU",body:`Finition : MÉLAMINE / Couleur : À DÉTERMINER\r
Épaisseur du bloc : 19 mm / Épaisseur des accessoires : 19 mm\r
Barres de penderie : CHROME / NOIR\r
Façades des tiroirs en verre : DROITE / “U” – FLOAT BRONZE C-424\r
Poignée des tiroirs : xxxxx\r
Tiroirs : 4 DE 180 MM\r
Porte de chaussures : OUI / NON\r
Finition du profil : LAQUÉ NOIR / ARGENT MAT\r
Finition du verre de la porte de chaussures : FLOAT BRONZE C-424\r
Composé de :`},{id:2000000123,code:"CAP_FRE_ARM_ABATIBLE_FR",title:"CARACTÉRISTIQUES FAÇADE DE PLACARD BATTANT",body:`Dimension de l’ouverture : 2275x1390 mm\r
Modèle : ARGO / Finition : LAQUÉE / Couleur : À DÉTERMINER\r
Épaisseur des vantaux : 22 ou 19 mm\r
Finition des vantaux : LISSES\r
Poignée : PRISE DE MAIN À DÉTERMINER\r
Finition des ferrures : CHROMÉ OU ANTHRACITE\r
Jambages périmétraux : APPARENTS, ENCASTRÉS OU COMBINÉS À DÉTERMINER\r
Nombre de vantaux : 2\r
Composé de :`},{id:2000000125,code:"CAP_FRE_ARM_CORREDERA_FR",title:"CARACTÉRISTIQUES FAÇADE DE PLACARD COULISSANT",body:`Dimension de l’ouverture : 2440x5180mm\r
Modèle : PANORAMIC P.O. / Finition : LAQUÉE / Couleur : BLANC\r
Nombre de listels : SANS LISTELS\r
Finition des panneaux : PANNEAU LAQUÉ\r
Poignée :\r
Encadrement périmétral :\r
Nombre de vantaux :\r
FREIN HYDRAULIQUE INTÉGRÉ (non disponible pour les portes inférieures à 650 mm) OU FREIN MAGNÉTIQUE INTÉGRÉ\r
Composé de :`},{id:2000000129,code:"CAP_INT_ARM_FORRADO_FR",title:"CARACTÉRISTIQUES INTÉRIEUR DE PLACARD HABILLÉ",body:`Finition : MÉLAMINE / Couleur : À DÉTERMINER\r
Épaisseur du bloc : 19 mm / Épaisseur des accessoires : 19 mm\r
Barres de penderie : CHROME / NOIR\r
Façades des tiroirs en verre : DROITE / “U” – FLOAT BRONZE C-424\r
Poignée des tiroirs : xxxxx\r
Tiroirs : 4 DE 180 MM\r
Composé de :`},{id:2000000131,code:"CAP_INT_EST_CRISTAL_FR",title:"CARACTÉRISTIQUES INTÉRIEUR DE PLACARD STRUCTURE EN VERRE",body:`Finition des cadres : ANODISÉ NOIR\r
Finition des panneaux des cadres latéraux : VERRE TREMPÉ FLOAT BRONZE C-424\r
Finition du dos : VERRE TREMPÉ FLOAT BRONZE C-424\r
Finition des accessoires : MÉLAMINE / Couleur : CHÊNE DENBER M-242\r
Épaisseur des accessoires : 25 mm\r
Barres de penderie : NOIRES\r
Façades des tiroirs en verre : DROITE / “U” – FLOAT BRONZE C-424\r
Poignée des tiroirs : xxxxx\r
Tiroirs : 4 DE 180 MM\r
Composé de :`},{id:2000000127,code:"CAP_INSTALACION_FR",title:"SERVICE D'INSTALLATION - PRIX NET",body:"Armoire d'installation x"},{id:2000000134,code:"CAP_SUMINISTRO_FR",title:"SERVICE DE FOURNITURE - PRIX NET",body:"Livraison du matériel au domicile du client"}],Uc={es:yj,en:Cj,fr:Sj},zc=({onSelect:t,languageCode:a})=>{const s=Uc[a.toLowerCase()]??Uc.es;return r.jsx(Io,{className:"h-96",children:r.jsx("div",{className:"flex flex-col gap-2 p-4 pt-0",children:s&&s.filter(({title:o,body:l})=>o||l).sort((o,l)=>o.title.localeCompare(l.title)).map(o=>r.jsx("button",{className:"flex flex-col items-start gap-2 p-3 text-sm text-left transition-all border rounded-lg hover:bg-accent",onClick:()=>t&&t(o,1),children:r.jsxs("div",{className:"flex flex-col w-full gap-1",children:[r.jsx("div",{className:"flex items-center",children:r.jsx("div",{className:"flex items-center gap-2",children:r.jsx("div",{className:"font-semibold",children:o.title})})}),r.jsx("div",{className:"text-xs line-clamp-2 text-muted-foreground",children:r.jsx("p",{dangerouslySetInnerHTML:{__html:o.body.substring(0,300).replace(`\r
`,"<br>")}})})]})},o.code))})})},Nj=({isOpen:t,onOpenChange:a,onSelect:s,languageCode:o})=>rf("(min-width: 768px)")?r.jsx(Cn,{modal:!0,open:t,onOpenChange:a,children:r.jsxs(Sn,{className:"w-full max-w-full md:w-9/12 lg:w-10/12",children:[r.jsxs(Nn,{children:[r.jsx(Rn,{children:C("quotes.blocks_picker_dialog.title")}),r.jsx(fr,{children:C("quotes.blocks_picker_dialog.description")})]}),r.jsx(zc,{languageCode:o,onSelect:s}),r.jsx(En,{children:r.jsx(U,{type:"submit",onClick:()=>a(!1),children:C("common.close")})})]})}):r.jsx(wd,{open:t,onOpenChange:a,children:r.jsxs(jd,{children:[r.jsxs(yd,{className:"text-left",children:[r.jsx(Cd,{children:C("quotes.blocks_picker_dialog.title")}),r.jsx(Sd,{children:C("quotes.blocks_picker_dialog.description")})]}),r.jsx(zc,{languageCode:o,onSelect:s}),r.jsx(Nd,{className:"pt-2",children:r.jsx(Rd,{asChild:!0,children:r.jsx(U,{variant:"outline",children:C("common.close")})})})]})}),Rj=({isOpen:t,onOpenChange:a,onSelect:s})=>rf("(min-width: 768px)")?r.jsx(Cn,{modal:!0,open:t,onOpenChange:a,children:r.jsxs(Sn,{className:"w-full max-w-full md:w-9/12 lg:w-10/12",children:[r.jsxs(Nn,{children:[r.jsx(Rn,{children:C("quotes.catalog_picker_dialog.title")}),r.jsx(fr,{children:C("quotes.catalog_picker_dialog.description")})]}),r.jsx(Pr,{syncWithLocation:!1,initialPageSize:5,children:r.jsx(Ao,{onSelect:s})}),r.jsx(En,{children:r.jsx(U,{type:"submit",onClick:()=>a(!1),children:C("common.close")})})]})}):r.jsx(wd,{open:t,onOpenChange:a,children:r.jsxs(jd,{children:[r.jsxs(yd,{className:"text-left",children:[r.jsx(Cd,{children:C("quotes.catalog_picker_dialog.title")}),r.jsx(Sd,{children:C("quotes.catalog_picker_dialog.description")})]}),r.jsx(Pr,{syncWithLocation:!1,initialPageSize:5,children:r.jsx(Ao,{onSelect:s})}),r.jsx(Nd,{className:"pt-2",children:r.jsx(Rd,{asChild:!0,children:r.jsx(U,{variant:"outline",children:C("common.close")})})})]})}),Ej=({currency:t,language:a,defaultValues:s})=>{var W;const{toast:o}=Qn(),{t:l}=We(),{control:d,getValues:c,setValue:m,watch:g}=ln(),x=g("lang_code")||or.DEFAULT_LANGUAGE_CODE,v=g("show_line_discount_column")??!0,b=!!((W=c("items"))!=null&&W.some(K=>{var Se;return Number((Se=K.discount)==null?void 0:Se.amount)>0})),[j]=D.useState("dialog"),[_,N]=D.useState(!1),[I,$]=D.useState(!1),{fields:L,...A}=q0({control:d,name:"items"}),E=nj(A.replace),[T,q]=D.useState(!1),Y=D.useCallback(K=>{E.chapters.length?E.appendPickedItem(K):A.append(K)},[E,A]),H=D.useMemo(()=>[{id:"description",accessorKey:"description",header:l("quotes.form_fields.items.description.label"),cell:({row:{index:K,original:Se}})=>Se!=null&&Se.id_article?r.jsx("div",{className:"px-3 py-2 text-sm whitespace-pre-wrap min-h-10",children:Se.localized_description??Se.description}):r.jsx(an,{autoSize:!0,name:`items.${K}.description`}),minSize:200,size:400},{id:"quantity",accessorKey:"quantity",header:()=>r.jsx("div",{className:"text-right",children:l("quotes.form_fields.items.quantity.label")}),cell:({row:{index:K}})=>r.jsx(Ew,{scale:0,className:"text-right",name:`items.${K}.quantity`}),size:75},{id:"unit_price",accessorKey:"unit_price",header:()=>r.jsx("div",{className:"text-right",children:l("quotes.form_fields.items.unit_price.label")}),cell:({row:{index:K}})=>r.jsx(io,{currency:t,language:a,scale:2,className:"text-right",name:`items.${K}.unit_price`}),size:125},{id:"subtotal_price",accessorKey:"subtotal_price",header:()=>r.jsx("div",{className:"text-right",children:l("quotes.form_fields.items.subtotal_price.label")}),cell:({row:{index:K}})=>r.jsx(io,{variant:"ghost",currency:t,language:a,scale:2,readOnly:!0,className:"text-right",name:`items.${K}.subtotal_price`}),size:150},{id:"discount",accessorKey:"discount",header:()=>r.jsx("div",{className:"text-right",children:l("quotes.form_fields.items.discount.label")}),cell:({row:{index:K}})=>r.jsx(xi,{scale:2,className:"text-right",name:`items.${K}.discount`}),size:100},{id:"total_price",accessorKey:"total_price",header:()=>r.jsx("div",{className:"text-right",children:l("quotes.form_fields.items.total_price.label")}),cell:({row:{index:K}})=>r.jsx(io,{variant:"ghost",currency:t,language:a,scale:2,readOnly:!0,className:"font-semibold text-right",name:`items.${K}.total_price`}),size:150}],[t,a,l]),ce=Vw(H,{enableDragHandleColumn:!0,enableSelectionColumn:!0}),pe=D.useCallback((K,Se=1)=>{Y({...K,quantity:{amount:100*Se,scale:Kn.DEFAULT_SCALE},unit_price:K.retail_price,discount:{amount:null,scale:2}}),o({title:l("quotes.catalog_picker_dialog.toast_article_added"),description:K.description})},[Y,o,l]),le=D.useCallback(K=>{Y({id_article:"",description:`${K.title}
${K.body}`,quantity:{amount:null,scale:Kn.DEFAULT_SCALE},unit_price:{amount:null,scale:jb.DEFAULT_SCALE},discount:{amount:null,scale:2}}),o({title:l("quotes.blocks_picker_dialog.toast_article_added"),description:K.title})},[Y,o,l]),[fe,V]=D.useState(!1),Z=[265,440,655],xe=4,Be=K=>{E.capturePickerTarget(K),N(!0)},X=K=>{E.capturePickerTarget(K),$(!0)},Pe=K=>m("show_line_discount_column",K,{shouldDirty:!0}),_e=E.chapters.length?r.jsx(xj,{controller:E,columns:ce,data:L,defaultItem:s==null?void 0:s.items[0],currencyCode:t.code,showLineDiscountColumn:v,hasLineDiscounts:b,onShowLineDiscountColumnChange:Pe,onAddChapter:()=>q(!0),pickCatalogArticle:Be,pickBlock:X}):r.jsx(jj,{actions:{...A,getItem:K=>c(`items.${K}`),pickCatalogArticle:Be,pickBlock:X},columns:ce,data:L,defaultValues:s,extraControls:r.jsxs(U,{type:"button",variant:"ghost",size:"sm",onClick:()=>q(!0),children:[r.jsx(Od,{className:"w-4 h-4 sm:mr-2"}),l("quotes.chapters.add")]}),showLineDiscountColumn:v,hasLineDiscounts:b,onShowLineDiscountColumnChange:Pe}),je=r.jsx(dj,{open:T,onOpenChange:q,onCreate:K=>{const Se=E.read(),Dt=Qw(Se,K,E.activeId);E.apply(Dt),E.focusTitle(Dt.chapters.find(yt=>!Se.chapters.some(Tt=>Tt.id===yt.id)).id)}});return j==="dialog"?r.jsxs("div",{className:"relative",children:[je,_e,r.jsx(Rj,{onSelect:pe,isOpen:_,onOpenChange:N}),r.jsx(Nj,{languageCode:x,onSelect:le,isOpen:I,onOpenChange:$})]}):r.jsxs(gb,{direction:"horizontal",autoSaveId:"uecko.quotes.details_layout",className:"items-stretch h-full",children:[je,r.jsx(Tc,{defaultSize:Z[0],collapsedSize:xe,collapsible:!0,minSize:50,maxSize:90,onCollapse:()=>{V(!0)},onExpand:()=>{V(!1)},className:me(fe&&"min-w-[50px] transition-all duration-300 ease-in-out"),children:_e}),r.jsx(hb,{withHandle:!0,className:"mx-3"}),r.jsx(Tc,{defaultSize:Z[1],minSize:10,children:r.jsx(Pr,{syncWithLocation:!1,children:r.jsx(Ao,{onSelect:pe})})})]})},Aj=()=>{const{formState:t,control:a}=ln();return r.jsxs("div",{className:"grid gap-6 md:grid-cols-6",children:[r.jsxs(hi,{className:"md:col-span-6",title:C("quotes.create.form_groups.general.title"),description:C("quotes.create.form_groups.general.desc"),actions:r.jsxs("div",{className:"grid min-w-48 gap-1",children:[r.jsx(Jt,{htmlFor:"lang_code",className:"text-xs text-muted-foreground",children:C("quotes.form_fields.lang_code.label")}),r.jsx(qr,{control:a,name:"lang_code",render:({field:s})=>r.jsxs(Un,{value:s.value||"es",onValueChange:s.onChange,children:[r.jsx(zn,{id:"lang_code","aria-label":C("quotes.form_fields.lang_code.label"),children:r.jsx(Vn,{placeholder:C("quotes.form_fields.lang_code.placeholder")})}),r.jsx(Hn,{children:yn.map(o=>r.jsxs(Xt,{value:o.code,children:[r.jsx("span",{"aria-hidden":"true",className:`mr-2 ${o.flagClassName}`}),o.name]},o.code))})]})})]}),children:[r.jsxs("div",{className:"grid grid-cols-6 gap-6",children:[r.jsx(ur,{required:!0,className:"col-span-2",label:C("quotes.form_fields.customer_reference.label"),description:C("quotes.form_fields.customer_reference.desc"),disabled:t.disabled,placeholder:C("quotes.form_fields.customer_reference.placeholder"),name:"customer_reference"}),r.jsx(ud,{required:!0,label:C("quotes.form_fields.date.label"),description:C("quotes.form_fields.date.desc"),disabled:t.disabled,placeholder:C("quotes.form_fields.date.placeholder"),name:"date"}),r.jsx(ur,{label:C("quotes.form_fields.validity.label"),description:C("quotes.form_fields.validity.desc"),disabled:t.disabled,placeholder:C("quotes.form_fields.validity.placeholder"),name:"validity"}),r.jsx(an,{className:"col-span-2",label:C("quotes.form_fields.payment_method.label"),description:C("quotes.form_fields.payment_method.desc"),disabled:t.disabled,placeholder:C("quotes.form_fields.payment_method.placeholder"),name:"payment_method"})]}),r.jsxs("div",{className:"grid grid-cols-6 gap-6",children:[r.jsx(an,{className:"col-span-3",required:!0,label:C("quotes.form_fields.customer_information.label"),description:C("quotes.form_fields.customer_information.desc"),disabled:t.disabled,placeholder:C("quotes.form_fields.customer_information.placeholder"),name:"customer_information",errors:t.errors}),r.jsx(an,{className:"col-span-3",label:C("quotes.form_fields.notes.label"),description:C("quotes.form_fields.notes.desc"),disabled:t.disabled,placeholder:C("quotes.form_fields.notes.placeholder"),name:"notes"})]})]}),r.jsx(hi,{className:"hidden md:col-span-2",title:C("quotes.create.form_groups.status.title"),description:C("quotes.create.form_groups.status.desc"),children:r.jsxs("div",{className:"grid gap-6",children:[r.jsxs("div",{className:"grid gap-3",children:[r.jsx(Jt,{htmlFor:"status",children:C("quotes.create.form_groups.status.title")}),r.jsxs(Un,{children:[r.jsx(zn,{id:"status","aria-label":C("quotes.list.select_status"),children:r.jsx(Vn,{placeholder:C("quotes.list.select_status")})}),r.jsxs(Hn,{children:[r.jsx(Xt,{value:"draft",children:C("quotes.status.draft")}),r.jsx(Xt,{value:"published",children:C("quotes.status.ready")}),r.jsx(Xt,{value:"archived",children:C("quotes.status.archived")})]})]})]}),r.jsx(ur,{required:!0,label:C("quotes.form_fields.currency_code.label"),description:C("quotes.form_fields.currency_code.desc"),placeholder:C("quotes.form_fields.currency_code.placeholder"),name:"currency_code"})]})})]})},Ij=t=>{const a=new Date(t);if(Number.isNaN(a.getTime()))return;const s=new Date,o=a>s?s:a,l=o.getFullYear(),d=String(o.getMonth()+1).padStart(2,"0"),c=String(o.getDate()).padStart(2,"0");return`${l}-${d}-${c}`},Fj=()=>{const{control:t,formState:a,getValues:s,setValue:o}=ln(),{formatNumber:l,formatCurrencyName:d}=tf(),{useExchangeRate:c}=Br(),{mutate:m,isPending:g}=c(),x=!!rn({control:t,name:"additional_currency_code"}),v=rn({control:t,name:"additional_currency_code"}),b=rn({control:t,name:"date"}),j=rn({control:t,name:"additional_currency_date"}),_=rn({control:t,name:"additional_currency_rate"}),N=rn({control:t,name:"total_price"}),I=b?new Date(b).getTime():void 0,$=D.useRef(I),L=Object.values(Dr.CURRENCIES),A=["EUR","USD","GBP","CHF","SAR"],E=A.map(fe=>L.find(V=>V.code===fe)).filter(fe=>!!fe),T=L.filter(fe=>!A.includes(fe.code)).sort((fe,V)=>fe.code.localeCompare(V.code)),q=(N==null?void 0:N.amount)!=null&&_?N.amount/100*Number(_):null,Y=q===null?null:l({amount:Math.round(q*100),scale:2,currency_code:v}),H=D.useMemo(()=>v?Dr.createFromCode(v).object.symbol:"",[v]),ce=D.useCallback((fe,V=b)=>{const Z=Ij(V);!fe||!Z||m({currency:fe,date:Z},{onSuccess:xe=>{s("additional_currency_code")===xe.currency_code&&(o("additional_currency_rate",xe.rate,{shouldDirty:!0}),o("additional_currency_date",xe.date,{shouldDirty:!0}))}})},[s,m,b,o]),pe=()=>ce(v);D.useEffect(()=>{$.current!==I&&($.current=I,x&&v&&ce(v,b))},[v,x,b,I,ce]);const le=fe=>{if(!fe){o("additional_currency_code",null,{shouldDirty:!0}),o("additional_currency_rate",null,{shouldDirty:!0}),o("additional_currency_date",null,{shouldDirty:!0});return}const V="USD";o("additional_currency_code",V,{shouldDirty:!0}),!j&&!_&&ce(V)};return r.jsx(hi,{title:C("quotes.additional_currency.title"),description:C("quotes.additional_currency.description"),actions:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Tr,{label:C("quotes.additional_currency.enabled")}),r.jsx(xs,{id:"additional_currency_enabled",checked:x,disabled:a.disabled,onCheckedChange:le})]}),children:x&&r.jsxs("div",{className:"grid gap-4 md:grid-cols-12",children:[r.jsxs("div",{className:"grid gap-2 md:col-span-3",children:[r.jsx(Tr,{label:C("quotes.additional_currency.currency")}),r.jsx(qr,{control:t,name:"additional_currency_code",render:({field:fe})=>r.jsxs(Un,{value:fe.value||"USD",onValueChange:V=>{fe.onChange(V),o("additional_currency_rate",null,{shouldDirty:!0}),o("additional_currency_date",null,{shouldDirty:!0}),ce(V)},children:[r.jsx(zn,{id:"additional_currency_code",disabled:a.disabled,children:r.jsx(Vn,{})}),r.jsxs(Hn,{children:[E.map(V=>r.jsxs(Xt,{value:V.code,disabled:V.code==="EUR",children:[V.code," - ",d(V.code)]},V.code)),r.jsx(k0,{}),T.map(V=>r.jsxs(Xt,{value:V.code,children:[V.code," - ",d(V.code)]},V.code))]})]})})]}),r.jsxs("div",{className:"grid gap-2 md:col-span-2",children:[r.jsx(Tr,{label:C("quotes.additional_currency.refresh")}),r.jsxs(U,{id:"additional_currency_refresh",className:"w-full",type:"button",variant:"secondary",size:"sm",disabled:a.disabled||!v||!b||g,onClick:pe,children:[r.jsx(Ed,{className:"w-4 h-4 mr-2"}),C("quotes.additional_currency.refresh")]})]}),r.jsxs("div",{className:"grid content-center gap-1 md:col-span-2",children:[r.jsx("p",{className:"text-sm font-semibold text-muted-foreground",children:C("quotes.additional_currency.date")}),r.jsx("p",{className:"font-medium tabular-nums",children:j?new Date(j).toLocaleDateString():"—"})]}),r.jsxs("div",{className:"grid content-center gap-1 md:col-span-3",children:[r.jsx("p",{className:"text-sm font-semibold text-muted-foreground",children:C("quotes.additional_currency.rate")}),r.jsx("p",{className:"font-medium tabular-nums",children:_?`1 EUR = ${Number(_).toLocaleString()} ${v}`:"—"})]}),r.jsxs("div",{className:"p-3 text-right rounded-md bg-muted md:col-span-2",children:[r.jsx("p",{className:"text-sm font-semibold text-muted-foreground",children:C("quotes.additional_currency.total",{code:v})}),r.jsxs("p",{className:"flex items-baseline justify-end text-2xl font-bold tabular-nums",children:[Y??"—",Y&&r.jsx("span",{className:"ml-1 text-lg tracking-normal",children:H})]})]})]})})},_f=({id:t,onSentTo:a,disabled:s})=>{const o=()=>{a(t)};return r.jsxs(dd,{children:[r.jsx(fd,{asChild:!0,disabled:s,children:r.jsxs(U,{variant:"ghost",className:"h-10 gap-1 text-primary disabled:text-secondary-foreground",children:[r.jsx(ab,{className:"w-4 h-4"}),C("quotes.quote_sent_to_editor.trigger_button")]})}),r.jsxs(md,{children:[r.jsxs(gd,{children:[r.jsx(hd,{children:C("quotes.quote_sent_to_editor.title")}),r.jsx(pd,{children:C("quotes.quote_sent_to_editor.description")})]}),r.jsxs(xd,{children:[r.jsx(vd,{children:C("common.cancel")}),r.jsx(_d,{asChild:!0,children:r.jsx(U,{onClick:o,children:C("common.continue")})})]})]})]})},Dj=["draft","ready","delivered","accepted","rejected","archived"],Tj={draft:["draft","ready","archived"],ready:["ready","delivered","archived"],delivered:["delivered","accepted","rejected","archived"],accepted:["accepted","rejected","archived"],rejected:["rejected","accepted","archived"],archived:["archived","draft","ready","delivered","accepted","rejected"]},bf=({type:t="button",status:a,onChangeStatus:s})=>{const[o,l]=D.useState(a),d=m=>l(m);D.useEffect(()=>{a&&l(a)},[a]);const c=()=>{o!==a&&s(o,a)};return r.jsxs(Cn,{children:[r.jsx(Kc,{asChild:!0,children:t==="button"?r.jsxs(U,{size:"sm",variant:"outline",className:"h-8 gap-1",children:[r.jsx(Ed,{className:"h-3.5 w-3.5"}),r.jsx("span",{className:"sr-only md:not-sr-only md:whitespace-nowrap",children:C("quotes.quote_status_editor.trigger_button")})]}):r.jsx($0,{status:a,isEditable:!0})}),r.jsxs(Sn,{children:[r.jsx(Nn,{children:r.jsx(Rn,{children:C("quotes.quote_status_editor.title")})}),r.jsx(B0,{}),r.jsx("div",{className:"grid gap-4 py-4",children:Dj.map(m=>{const g=!Tj[a].includes(m);return r.jsxs("div",{className:"flex items-start space-x-4",children:[r.jsx(xs,{id:m,checked:o===m,onCheckedChange:()=>d(m),disabled:g}),r.jsxs("div",{className:"grid gap-1.5 leading-none",children:[r.jsx(Jt,{htmlFor:m,className:me("font-medium",g?"text-input":"text-foreground"),children:C(`quotes.quote_status_editor.status.${m}.title`)}),r.jsx("p",{className:me("text-sm",g?"text-input":"text-muted-foreground"),children:C(`quotes.quote_status_editor.status.${m}.description`)})]})]},m)})}),r.jsxs(En,{className:"pt-6 border-t",children:[r.jsx(mi,{asChild:!0,children:r.jsx(U,{type:"button",variant:"secondary",children:C("common.cancel")})}),r.jsx(mi,{asChild:!0,children:r.jsx(U,{onClick:c,disabled:o===a,children:C("quotes.quote_status_editor.submit_button")})})]})]})]})},Mj=({quoteId:t,className:a})=>{const s=un(),{toast:o}=Qn(),{useOne:l,useSetStatus:d,useSentTo:c,useDownloader:m,useDuplicate:g,getQuotePDFFilename:x}=Br(),{data:v,status:b}=l(t),{mutate:j}=d(),{mutate:_}=c(t),{mutate:N}=g(),{download:I,...$}=m(),{formatCurrency:L,formatNumber:A}=nf({locale:(v==null?void 0:v.lang_code)||"ES"}),E=D.useMemo(()=>v?{subtotal_price:L(v.subtotal_price),discount:A(v.discount),discount_price:L(v.discount_price),tax:A(v.tax),tax_price:L(v.tax_price),total_price:L(v.total_price)}:{subtotal_price:"0,00 €",discount:"0",discount_price:"0,00 €",tax:"0",tax_price:"0,00 €",total_price:"0,00 €"},[v]),T=D.useMemo(()=>(v==null?void 0:v.status)==="accepted"&&!(v!=null&&v.date_sent),[v]),q=D.useMemo(()=>(v==null?void 0:v.status)==="accepted"&&!!(v!=null&&v.date_sent),[v]),Y=V=>{j({id:v.id,newStatus:V},{onSuccess:()=>{o({description:C("quotes.quote_status_editor.toast_status_changed"),variant:"success"})}})},H=V=>{_({sent_date:U0(new Date)},{onSuccess:()=>{o({description:C("quotes.quote_sent_to_editor.toast_status_changed"),variant:"success"})}})},ce=D.useCallback(()=>{o({description:C("quotes.downloading_dialog.toast_success"),variant:"success"})},[o]),pe=D.useCallback(()=>{v&&I(v.id,x(v))},[v]);if(b==="error"||b!=="success")return null;if(!v)return r.jsx(Ve,{className:me("overflow-hidden",a),children:r.jsx(He,{className:"px-4 py-6 text-center",children:r.jsx("p",{className:"mx-auto",children:C("quotes.list.resume.select_quote")})})});const le=V=>{N({id:V},{onSuccess(Z){o({description:C("quotes.duplicate_action.toast_success"),variant:"success"}),s(`/quotes/edit/${Z.id}`,{relative:"path"})}})},fe=V=>{j({id:V,newStatus:"archived"},{onSuccess:()=>{o({description:C("quotes.quote_status_editor.toast_status_changed",{newStatus:C("quotes.status.archived")}),variant:"success"})}})};return r.jsxs(r.Fragment,{children:[r.jsx(mf,{...$,onFinishDownload:ce}),r.jsx(Ad,{defaultValue:"resume",children:r.jsxs(Ve,{className:"w-[390px] overflow-hidden",children:[r.jsxs(ht,{className:"gap-3 border-b bg-accent",children:[r.jsxs(et,{className:"flex items-center justify-between text-lg",children:[r.jsx("span",{children:C("quotes.list.resume.title")}),r.jsx(bf,{status:v.status,onChangeStatus:Y,type:"badge"})]}),r.jsx("div",{className:"flex w-full mr-auto text-foreground",children:r.jsxs("div",{className:"flex justify-between w-full",children:[r.jsxs(Gn,{className:"gap-0",children:[r.jsxs(at,{children:[r.jsx(ot,{asChild:!0,children:r.jsxs(U,{variant:"outline",size:"icon",disabled:q,onClick:V=>{V.preventDefault(),s(`/quotes/edit/${v.id}`,{relative:"path"})},children:[r.jsx(qd,{className:"w-4 h-4"}),r.jsx("span",{className:"sr-only",children:C("common.edit")})]})}),r.jsx(lt,{children:r.jsx("p",{children:C("common.edit")})})]}),r.jsxs(at,{children:[r.jsx(ot,{asChild:!0,children:r.jsxs(U,{variant:"outline",size:"icon",onClick:V=>{V.preventDefault(),le(v.id)},children:[r.jsx(Fi,{className:"w-4 h-4"}),r.jsx("span",{className:"sr-only",children:C("common.duplicate")})]})}),r.jsx(lt,{children:r.jsx("p",{children:C("common.duplicate")})})]}),r.jsxs(at,{children:[r.jsx(ot,{asChild:!0,children:r.jsxs(U,{variant:"outline",size:"icon",onClick:pe,children:[r.jsx(Td,{className:"w-4 h-4"}),r.jsx("span",{className:"sr-only",children:C("common.download")})]})}),r.jsx(lt,{children:r.jsx("p",{children:C("common.download")})})]}),r.jsxs(at,{children:[r.jsx(ot,{asChild:!0,children:r.jsxs(U,{variant:"outline",size:"icon",disabled:q,onClick:V=>{V.preventDefault(),fe(v.id)},children:[r.jsx(Fd,{className:"w-4 h-4"}),r.jsx("span",{className:"sr-only",children:C("common.archive")})]})}),r.jsx(lt,{children:r.jsx("p",{children:C("common.archive")})})]})]}),r.jsx(Gn,{children:r.jsx(_f,{disabled:q||!T,id:v.id,onSentTo:H})})]})})]}),r.jsxs(He,{className:"p-6 text-sm",children:[r.jsxs(Id,{className:"grid w-full grid-cols-2",children:[r.jsx(jo,{value:"resume",children:C("quotes.list.resume.tabs.resume")}),r.jsx(jo,{value:"preview",children:C("quotes.list.resume.tabs.preview")})]}),r.jsx(yo,{value:"resume",className:"pt-4",children:r.jsxs("div",{className:"grid gap-3",children:[r.jsxs("div",{className:"grid gap-3",children:[r.jsx("div",{className:"font-semibold",children:C("quotes.list.resume.quote_information")}),r.jsxs("dl",{className:"grid gap-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("dt",{className:"text-muted-foreground",children:C("quotes.form_fields.reference.label")}),r.jsx("dd",{className:"font-medium",children:v.reference})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("dt",{className:"text-muted-foreground",children:C("quotes.form_fields.date.label")}),r.jsx("dd",{className:"font-medium",children:new Date(v.date).toLocaleDateString()})]}),r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsx("dt",{className:"text-muted-foreground whitespace-nowrap",children:C("quotes.form_fields.customer_reference.label")}),r.jsx("dd",{className:"font-medium text-right whitespace-break-spaces",children:v.customer_reference})]})]})]}),r.jsx(lr,{className:"my-4"}),r.jsxs("div",{className:"grid gap-3",children:[r.jsx("div",{className:"font-semibold",children:C("quotes.list.resume.customer_information")}),r.jsx("div",{children:v.customer_information})]}),r.jsx(lr,{className:"my-4"}),r.jsx("div",{className:"font-semibold",children:C("quotes.list.resume.price_information")}),r.jsxs("ul",{className:"grid gap-3",children:[r.jsxs("li",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-muted-foreground",children:C("quotes.form_fields.subtotal_price.label")}),r.jsx("span",{children:E.subtotal_price})]}),r.jsxs("li",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-muted-foreground",children:C("quotes.form_fields.discount_value.label",{value:E.discount})}),r.jsx("span",{children:E.discount_price})]}),r.jsxs("li",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-muted-foreground",children:C("quotes.form_fields.tax_value.label",{label:v.tax_label,value:E.tax})}),r.jsx("span",{children:E.tax_price})]}),r.jsxs("li",{className:"flex items-center justify-between font-semibold",children:[r.jsx("span",{className:"text-muted-foreground",children:C("quotes.form_fields.total_price.label")}),r.jsx("span",{children:E.total_price})]})]})]})}),r.jsx(yo,{value:"preview",children:r.jsx(gf,{quote:v})})]}),r.jsx(Ut,{className:"flex flex-row items-center px-6 py-3 border-t bg-accent",children:r.jsx("div",{className:"text-xs text-muted-foreground"})})]})})]})},Lj=({status:t="all",preview:a=!1})=>{const s=un(),{toast:o}=Qn(),{t:l,i18n:d}=We(),c=D.useId(),m=D.useId(),{pagination:g,globalFilter:x,isFiltered:v}=mr(),[b,j]=D.useState(void 0),{useList:_,useDownloader:N,useSetStatus:I,useDuplicate:$,getQuotePDFFilename:L}=Br(),{mutate:A}=I(),{mutate:E}=$(),{data:T,isPending:q,isError:Y,error:H}=_({pagination:{pageIndex:g.pageIndex,pageSize:g.pageSize},status:t,quickSearchTerm:x}),{download:ce,...pe}=N(),le=_e=>{j(_e)},fe=D.useCallback(()=>{o({description:l("quotes.downloading_dialog.toast_success")})},[o]),V=D.useCallback(_e=>{s(`/quotes/edit/${_e.id}`,{relative:"path"})},[s,o]),Z=_e=>{E({id:_e},{onSuccess(je){o({description:l("quotes.duplicate_action.toast_success"),variant:"success"}),s(`/quotes/edit/${je.id}`,{relative:"path"})}})},xe=_e=>{A({id:_e,newStatus:"archived"},{onSuccess:()=>{o({description:l("quotes.quote_status_editor.toast_status_changed",{newStatus:l("quotes.status.archived")}),variant:"success"})}})},Be=(_e,je)=>{A({id:_e,newStatus:je},{onSuccess:()=>{o({description:l("quotes.quote_status_editor.toast_status_changed",{newStatus:l(`quotes.status.${je}`)}),variant:"success"})}})},X=D.useMemo(()=>{const _e=[{id:"reference",accessorKey:"reference",header:()=>r.jsx(r.Fragment,{children:l("quotes.list.columns.reference")}),cell:({row:{original:W},renderValue:K})=>{const Se=!!((W==null?void 0:W.status)==="accepted"&&(W!=null&&W.date_sent));return r.jsx(U,{size:"sm",variant:"link",disabled:Se,className:"h-8 gap-1 px-0 text-left text-ellipsis",onClick:Dt=>{Dt.preventDefault(),V(W)},children:r.jsx("div",{className:"",children:K()})})}},{id:"status",accessorKey:"status",header:()=>r.jsx(r.Fragment,{children:l("quotes.list.columns.status")}),cell:({row:{original:W}})=>r.jsx(bf,{type:"badge",status:W.status,onChangeStatus:K=>Be(W.id,K)})},{id:"date_sent",accessor:"date_sent",header:()=>r.jsx("div",{className:"text-left text-ellipsis",children:l("quotes.list.columns.date_sent")}),cell:({row:{original:W}})=>{const K=Mr.create(W.date_sent),Se=K.isSuccess&&!K.object.isEmpty();return r.jsx("div",{className:"text-left text-ellipsis",children:Se?r.jsx(Jd,{label:K.object.toLocaleDateString("es-ES"),className:"text-green-800 bg-green-100 hover:text-green-800 hover:bg-green-100"}):r.jsx(r.Fragment,{})})}},{id:"date",accessor:"date",header:()=>r.jsx("div",{className:"text-left text-ellipsis",children:l("quotes.list.columns.date")}),cell:({row:{original:W}})=>{const K=Mr.create(W.date);return r.jsx("div",{className:"text-left text-ellipsis",children:K.isSuccess?K.object.toLocaleDateString("es-ES"):"-"})}},{id:"customer_reference",accessorKey:"customer_reference",header:()=>r.jsx(r.Fragment,{children:l("quotes.list.columns.customer_reference")}),cell:({renderValue:W})=>r.jsx("div",{className:"text-left text-ellipsis",children:W()})},{id:"customer_information",accessorKey:"customer_information",header:()=>r.jsx(r.Fragment,{children:l("quotes.list.columns.customer_information")}),cell:({row:{original:W}})=>r.jsx("div",{className:"text-left text-ellipsis",children:W.customer_information.split(`
`).map((K,Se)=>r.jsxs("span",{className:Se===0?"font-medium":"hidden text-sm text-muted-foreground md:inline",children:[K,r.jsx("br",{})]},Se))}),size:500}],je=[{id:"row-actions",header:()=>null,cell:({row:{original:W}})=>{const K=(W==null?void 0:W.status)==="accepted"&&!(W!=null&&W.date_sent),Se=(W==null?void 0:W.status)==="accepted"&&!!(W!=null&&W.date_sent),Dt=(W==null?void 0:W.status)==="archived";return r.jsxs("div",{className:"flex gap-1",children:[r.jsxs(Gn,{className:"gap-0",children:[r.jsxs(at,{children:[r.jsx(ot,{asChild:!0,children:r.jsxs(U,{variant:"ghost",size:"icon",disabled:Se,onClick:yt=>{yt.preventDefault(),V(W)},children:[r.jsx(qd,{className:"w-4 h-4"}),r.jsx("span",{className:"sr-only",children:l("common.edit")})]})}),r.jsx(lt,{children:r.jsx("p",{children:l("common.edit")})})]}),r.jsxs(at,{children:[r.jsx(ot,{asChild:!0,children:r.jsxs(U,{variant:"ghost",size:"icon",onClick:yt=>{yt.preventDefault(),Z(W.id)},children:[r.jsx(Fi,{className:"w-4 h-4"}),r.jsx("span",{className:"sr-only",children:l("common.duplicate")})]})}),r.jsx(lt,{children:r.jsx("p",{children:l("common.duplicate")})})]}),r.jsxs(at,{children:[r.jsx(ot,{asChild:!0,children:r.jsxs(U,{variant:"ghost",size:"icon",onClick:()=>{ce(W.id,L(W))},children:[r.jsx(Td,{className:"w-4 h-4"}),r.jsx("span",{className:"sr-only",children:l("common.download")})]})}),r.jsx(lt,{children:r.jsx("p",{children:l("common.download")})})]}),r.jsxs(at,{children:[r.jsx(ot,{asChild:!0,children:r.jsxs(U,{variant:"ghost",size:"icon",disabled:Dt||Se,onClick:yt=>{yt.preventDefault(),xe(W.id)},children:[r.jsx(Fd,{className:"w-4 h-4"}),r.jsx("span",{className:"sr-only",children:l("common.archive")})]})}),r.jsx(lt,{children:r.jsx("p",{children:l("common.archive")})})]})]}),r.jsx(Gn,{children:r.jsx(_f,{id:W.id,onSentTo:()=>null,disabled:Se||!K})})]})}}];return a?_e:[..._e,...je]},[a,l,d.resolvedLanguage]),{table:Pe}=Oi({data:(T==null?void 0:T.items)??[],columns:X,pageCount:(T==null?void 0:T.total_pages)??-1});return D.useEffect(()=>{Pe&&T&&(T==null?void 0:T.total_pages)>0&&j(Pe.getRowModel().rows[0])},[T,Pe]),Y?r.jsx($r,{subtitle:H.message}):q?r.jsxs("div",{className:"grid items-start flex-1 gap-4 sm:py-0 md:gap-8 lg:grid-cols-3 xl:grid-cols-3",children:[r.jsx(Ve,{className:"grid items-start gap-4 auto-rows-max md:gap-8 lg:col-span-2",children:r.jsx(He,{children:r.jsx(Mi,{columnCount:6,searchableColumnCount:1,filterableColumnCount:2,shrinkZero:!0})})}),r.jsx("div",{})]}):(T==null?void 0:T.total_items)===0&&!v?r.jsx(Ve,{children:r.jsx(He,{children:r.jsx(Li,{subtitle:l("quotes.list.empty_state.subtitle"),buttonText:l("quotes.create.title"),onButtonClick:()=>s("add",{relative:"path"})})})}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex flex-col items-stretch flex-1 gap-4 xl:flex-row",children:[r.jsx("div",{id:c,className:"flex items-stretch flex-1",children:r.jsx(Ti,{table:Pe,paginationOptions:{visible:!0},className:"grid items-start flex-1 gap-4 auto-rows-max md:gap-8 lg:col-span-2",onRowClick:le,activeRowIndex:b==null?void 0:b.index,children:r.jsx(lf,{table:Pe})})}),a&&r.jsx("div",{id:m,className:"flex items-stretch ",children:r.jsx(Mj,{quoteId:b==null?void 0:b.original.id})})]}),r.jsx(mf,{...pe,onFinishDownload:fe})]})},Jj=()=>{const{t}=We(),a=un(),s=ij(),{toast:o}=Qn(),[l,d]=D.useState(Dr.createDefaultCode().object),[c,m]=D.useState(or.createDefaultCode().object),g=D.useMemo(()=>({date:"",reference:"",customer_reference:"",customer_information:"",lang_code:"",currency_code:"",payment_method:"",notes:"",validity:"",show_line_discount_column:!0,chapters:[],show_chapter_line_amounts:!0,additional_currency_code:null,additional_currency_rate:null,additional_currency_date:null,additional_currency_total:null,subtotal_price:{amount:void 0,scale:2,currency_code:""},discount:{amount:0,scale:0},discount_price:{amount:0,scale:0,currency_code:""},before_tax_price:{amount:void 0,scale:2,currency_code:""},tax:{amount:void 0,scale:0},tax_label:t("settings.form_fields.default_tax_label.placeholder"),tax_price:{amount:void 0,scale:2,currency_code:""},total_price:{amount:void 0,scale:2,currency_code:""},items:[{id_article:"",chapter_id:null,description:"",quantity:{amount:null,scale:2},unit_price:{amount:null,scale:2,currency_code:l.code},subtotal_price:{amount:null,scale:2,currency_code:l.code},discount:{amount:null,scale:2},total_price:{amount:null,scale:2,currency_code:l.code}}]}),[l.code,t]),{useOne:x,useUpdate:v}=Br(),{data:b,status:j,error:_}=x(s),{mutate:N,isPending:I}=v(String(s)),$=Ei({mode:"onBlur",defaultValues:g}),{getValues:L,reset:A,handleSubmit:E,formState:T,control:q,watch:Y,setValue:H}=$,{isSubmitting:ce,isDirty:pe}=T;Qo({isDirty:pe}),D.useEffect(()=>{const{unsubscribe:V}=Y((Z,{name:xe,type:Be})=>{if(xe==="items"){Z.items&&Z.items.map((Pe,_e)=>{if(Pe){const je=vi(Pe);ze.isEqual(je.subtotal_price.toObject(),Pe.subtotal_price)||H(`items.${_e}.subtotal_price`,je.subtotal_price.toObject()),ze.isEqual(je.total_price.toObject(),Pe.total_price)||H(`items.${_e}.total_price`,je.total_price.toObject())}});const X=xo(Z,!0);ze.isEqual(X.subtotal_price.toObject(),Z.subtotal_price)||H("subtotal_price",X.subtotal_price.toObject()),ze.isEqual(X.discount_price.toObject(),Z.discount_price)||H("discount_price",X.discount_price.toObject()),ze.isEqual(X.before_tax_price.toObject(),Z.before_tax_price)||H("before_tax_price",X.before_tax_price.toObject()),ze.isEqual(X.tax_price.toObject(),Z.tax_price)||H("tax_price",X.tax_price.toObject()),ze.isEqual(X.total_price.toObject(),Z.total_price)||H("total_price",X.total_price.toObject())}else if(xe&&Be==="change"){if(xe==="currency_code"){const X=Dr.createFromCode(Z.currency_code??Dr.DEFAULT_CURRENCY_CODE);if(X.isFailure)throw console.error(X.error),X.error;d(X.object),H("items",L("items").map(Pe=>({...Pe,unit_price:{...Pe.unit_price,currency_code:X.object.code}})),{shouldDirty:!0})}if(xe==="lang_code"){const X=or.createFromCode(Z.lang_code??or.DEFAULT_LANGUAGE_CODE);if(X.isFailure)throw console.error(X.error),X.error;m(X.object)}if(["discount","tax"].includes(xe)){const X=xo(Z,!0);ze.isEqual(X.subtotal_price.toObject(),Z.subtotal_price)||H("subtotal_price",X.subtotal_price.toObject()),ze.isEqual(X.discount_price.toObject(),Z.discount_price)||H("discount_price",X.discount_price.toObject()),ze.isEqual(X.before_tax_price.toObject(),Z.before_tax_price)||H("before_tax_price",X.before_tax_price.toObject()),ze.isEqual(X.tax_price.toObject(),Z.tax_price)||H("tax_price",X.tax_price.toObject()),ze.isEqual(X.total_price.toObject(),Z.total_price)||H("total_price",X.total_price.toObject())}if(xe!=null&&xe.startsWith("items")){const X=Number(xe.split(".")[1]),Pe=xe.split(".")[2];if(["quantity","unit_price","discount"].includes(Pe)&&Z.items&&Z.items[X]){const _e=Z.items[X],je=vi(_e);ze.isEqual(je.quantity.toObject(),_e.quantity)||H(`items.${X}.quantity`,je.quantity.toObject()),ze.isEqual(je.unit_price.toObject(),_e.unit_price)||H(`items.${X}.unit_price`,je.unit_price.toObject()),ze.isEqual(je.discount.toObject(),_e.discount)||H(`items.${X}.discount`,je.discount.toObject()),ze.isEqual(je.subtotal_price.toObject(),_e.subtotal_price)||H(`items.${X}.subtotal_price`,je.subtotal_price.toObject()),ze.isEqual(je.total_price.toObject(),_e.total_price)||H(`items.${X}.total_price`,je.total_price.toObject());const W=xo(Z,!0);ze.isEqual(W.subtotal_price.toObject(),Z.subtotal_price)||H("subtotal_price",W.subtotal_price.toObject()),ze.isEqual(W.discount_price.toObject(),Z.discount_price)||H("discount_price",W.discount_price.toObject()),ze.isEqual(W.before_tax_price.toObject(),Z.before_tax_price)||H("before_tax_price",W.before_tax_price.toObject()),ze.isEqual(W.tax_price.toObject(),Z.tax_price)||H("tax_price",W.tax_price.toObject()),ze.isEqual(W.total_price.toObject(),Z.total_price)||H("total_price",W.total_price.toObject())}}}});return()=>V()},[Y,H,L]);const le=async(V,Z)=>{const xe=Ww(V);N(xe,{onError:Be=>{console.error(Be),o({title:t("common.error"),description:Be.message,variant:"destructive"})},onSuccess:()=>{A(L()),o({title:t("quotes.notifications.saved"),variant:"success"}),Z&&a("/quotes")}})},fe=D.useCallback(()=>{a("/quotes",{state:{id:s}})},[a,s]);return D.useEffect(()=>{if(j==="success"&&b){const V=Dr.createFromCode(b.currency_code),Z=or.createFromCode(b.lang_code);V.isSuccess&&d(V.object),Z.isSuccess&&m(Z.object),A({...b,chapters:b.chapters??[],show_chapter_line_amounts:b.show_chapter_line_amounts??!0})}},[j,b,A]),j==="error"?r.jsx($r,{errorMessage:_.message}):j!=="success"?r.jsx(dr,{}):r.jsxs(r.Fragment,{children:[(ce||I)&&r.jsx(dr,{title:t("quotes.notifications.saving")}),r.jsx(Ai,{...$,children:r.jsx("form",{onSubmit:E(V=>le(V,!1)),children:r.jsxs("div",{className:"mx-auto grid max-w-[90rem] flex-1 auto-rows-max gap-6",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(ld,{}),r.jsxs("h1",{className:"flex-1 text-xl font-semibold tracking-tight shrink-0 whitespace-nowrap sm:grow-0",children:[t("quotes.edit.title")," ",b.reference]}),r.jsx(Jd,{label:t(`quotes.status.${b.status}`),className:"ml-auto sm:ml-0"}),r.jsxs("div",{className:"items-center hidden gap-2 md:ml-auto md:flex",children:[r.jsx(z0,{label:t("common.close"),variant:"secondary",size:"sm",onClick:fe}),r.jsx(ko,{label:t("common.save"),size:"sm",disabled:T.isSubmitting||T.isLoading||T.isValidating}),r.jsx(U,{size:"sm",disabled:T.isSubmitting||T.isLoading||T.isValidating,onClick:E(V=>le(V,!0)),children:t("common.save_close")})]})]}),r.jsx(Aj,{}),r.jsx(oj,{currency:l}),r.jsx(Fj,{}),r.jsx(Ej,{currency:l,language:c,defaultValues:g}),r.jsxs("div",{className:"flex items-center justify-center gap-2 md:hidden",children:[r.jsx(U,{variant:"outline",size:"sm",children:t("common.discard")}),r.jsx(U,{onClick:E(V=>le(V,!1)),size:"sm",children:t("quotes.edit.buttons.save_quote")})]})]})})}),!1]})},Oj=D.createContext(null),Pj=({children:t})=>{const[a,s]=td();return r.jsx(Oj.Provider,{value:{pagination:a,setPagination:s},children:t})},ey=({children:t})=>r.jsx(Ii,{children:r.jsx(Pj,{children:r.jsxs(gs,{className:"quotes-layout",children:[r.jsx(hs,{}),r.jsx(ps,{children:t})]})})}),ty=()=>{const{t}=We(),a=un(),[s,o]=D.useState("all"),[l,d]=Iw(!0),c=[{value:"all",label:t("quotes.list.tabs.all")},{value:"draft",label:t("quotes.list.tabs.draft")},{value:"ready",label:t("quotes.list.tabs.ready")},{value:"delivered",label:t("quotes.list.tabs.delivered")},{value:"accepted",label:t("quotes.list.tabs.accepted")},{value:"rejected",label:t("quotes.list.tabs.rejected")},{value:"archived",label:t("quotes.list.tabs.archived")}];return r.jsxs(Pr,{children:[r.jsxs("div",{className:"flex items-center justify-between space-y-2",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:r.jsx(ae,{i18nKey:"quotes.list.title"})}),r.jsx("p",{className:"text-muted-foreground",children:r.jsx(ae,{i18nKey:"quotes.list.subtitle"})})]}),r.jsx("div",{className:"flex items-center space-x-2",children:r.jsxs(U,{onClick:()=>a("/quotes/add"),children:[r.jsx(Bo,{className:"w-4 h-4 mr-2"}),t("quotes.create.title")]})})]}),r.jsxs(Ad,{value:s,onValueChange:o,children:[r.jsxs("div",{className:"flex flex-col items-start justify-between mb-4 sm:flex-row sm:items-center",children:[r.jsxs("div",{className:"w-full mb-4 sm:w-auto sm:mb-0",children:[r.jsx(Id,{className:"hidden sm:flex",children:c.map(m=>r.jsx(jo,{value:m.value,children:m.label},m.value))}),r.jsxs("div",{className:"flex items-center w-full space-x-2 sm:hidden",children:[r.jsx(Jt,{children:t("quotes.list.tabs_title")}),r.jsxs(Un,{value:s,onValueChange:o,children:[r.jsx(zn,{children:r.jsx(Vn,{placeholder:t("quotes.list.select_status")})}),r.jsx(Hn,{children:c.map(m=>r.jsx(Xt,{value:m.value,children:m.label},m.value))})]})]})]}),r.jsx("div",{className:"flex items-baseline justify-center mr-4 font-medium",children:r.jsx(ww,{buttonText:t("common.help"),title:t("quotes.list.status_help.title"),content:r.jsx(qj,{})})}),r.jsx("div",{className:"flex items-center gap-2 ml-auto",children:r.jsx(V0,{"aria-label":t("quotes.list.preview_aria"),variant:"outline",defaultPressed:!1,pressed:l,onPressedChange:d,children:l?r.jsxs(r.Fragment,{children:[r.jsx(Md,{className:"w-4 h-4 mr-2"}),t("common.disable_preview")]}):r.jsxs(r.Fragment,{children:[r.jsx(J0,{className:"w-4 h-4 mr-2"}),t("common.enable_preview")]})})})]}),c.map(m=>r.jsx(yo,{value:m.value,children:r.jsx(Lj,{status:m.value,preview:l})},m.value))]})]})},qj=()=>{const{t}=We();return r.jsxs(Io,{className:"grid gap-4 py-4",children:[r.jsx("p",{children:t("quotes.list.status_help.intro")}),r.jsx("p",{children:t("quotes.list.status_help.possible")}),r.jsxs("ul",{className:"pl-6 space-y-2 list-disc",children:[r.jsxs("li",{children:[r.jsxs("strong",{children:[t("quotes.status.draft"),":"]})," ",t("quotes.quote_status_editor.status.draft.description")]}),r.jsxs("li",{children:[r.jsxs("strong",{children:[t("quotes.status.ready"),":"]})," ",t("quotes.quote_status_editor.status.ready.description")]}),r.jsxs("li",{children:[r.jsxs("strong",{children:[t("quotes.status.delivered"),":"]})," ",t("quotes.quote_status_editor.status.delivered.description")]}),r.jsxs("li",{children:[r.jsxs("strong",{children:[t("quotes.status.accepted"),":"]})," ",t("quotes.quote_status_editor.status.accepted.description")]}),r.jsxs("li",{children:[r.jsxs("strong",{children:[t("quotes.status.rejected"),":"]})," ",t("quotes.quote_status_editor.status.rejected.description")]}),r.jsxs("li",{children:[r.jsxs("strong",{children:[t("quotes.status.archived"),":"]})," ",t("quotes.quote_status_editor.status.archived.description")]})]}),r.jsx("p",{children:t("quotes.list.status_help.outro")})]})},kj=t=>{const a=fs(),s=cr(),o=s().data().resource("settings").action("one").id("me").params().get(),l=s().auth().action("profile").get();return{useOne:()=>Ud({queryKey:o,queryFn:()=>a.getOne({resource:"profile",id:""}),...t}),useUpdate:()=>{const d=jn();return sn({mutationKey:o,mutationFn:c=>a.updateOne({resource:"profile",data:c,id:""}),onSuccess:(c,m)=>{const g=x=>x&&{...x,lang_code:m.lang_code??x.lang_code,dealer:{...x.dealer,...c}};return d.setQueryData(o,g),d.setQueryData(l,g),Promise.all([d.invalidateQueries({queryKey:o}),d.invalidateQueries({queryKey:l})])}})},useUploadLogo:()=>{const d=jn(),{mutate:c,mutateAsync:m,...g}=sn({mutationKey:["data","default","settings"],mutationFn:x=>a.uploadFile({path:"profile/logo",file:x,key:"logo"}),onError:()=>d.invalidateQueries({queryKey:["data","default","settings"]}),onSuccess:()=>{d.invalidateQueries({queryKey:["data","default","settings"]})}});return{upload:c,uploadAsync:m,...g}}}},ny=()=>{var H,ce;const[t,a]=D.useState("profile"),{useOne:s,useUpdate:o,useUploadLogo:l}=kj(),{toast:d}=Qn(),{t:c,i18n:m}=We(),{data:g,status:x,error:v}=s(),b=D.useMemo(()=>({lang_code:"es",contact_information:"",default_payment_method:"",default_notes:"",default_legal_terms:"",default_quote_validity:"",default_show_line_discount_column:!0,default_tax:{amount:void 0,scale:2},default_tax_label:c("settings.form_fields.default_tax_label.placeholder")}),[c]),{mutate:j}=o(),{upload:_}=l(),N=Ei({mode:"onBlur",values:g?{...g.dealer,lang_code:g.lang_code}:void 0,defaultValues:b}),{formState:I,reset:$,getValues:L,handleSubmit:A}=N,{isSubmitting:E,isDirty:T}=I,q=pe=>{var fe;const le=(fe=pe.target.files)==null?void 0:fe[0];if(le){if(le.type!=="image/png"&&le.type!=="image/jpeg"){alert(c("settings.form_fields.logo.invalid_format"));return}const V=new FileReader;V.onloadend=()=>{const Z=new Image;Z.onload=()=>{const xe=Z.width,Be=Z.height,X=xe/Be===2;xe<200||Be<100||!X?alert(c("settings.form_fields.logo.invalid_dimensions")):_(le)},Z.src=V.result},V.readAsDataURL(le)}};Qo({isDirty:T});const Y=async pe=>{j(pe,{onError:le=>{console.debug(le),d({title:c("common.error"),description:le.message,variant:"destructive"})},onSuccess:()=>{m.language!==pe.lang_code&&m.changeLanguage(pe.lang_code??"es"),$(L()),d({description:c("settings.notifications.saved"),variant:"success"})}})};return E?r.jsx(dr,{title:c("settings.notifications.saving")}):x==="error"?r.jsx($r,{errorMessage:v.message}):x!=="success"?r.jsx(dr,{}):r.jsx(Ai,{...N,children:r.jsx("form",{onSubmit:A(Y),children:r.jsxs("div",{className:"mx-auto grid w-full max-w-6xl items-start gap-6 md:grid-cols-[180px_1fr] lg:grid-cols-[250px_1fr]",children:[((H=N.formState.errors.root)==null?void 0:H.message)&&r.jsxs(Zc,{variant:"destructive",children:[r.jsx(Dd,{className:"w-4 h-4"}),r.jsx(Jc,{children:r.jsx(ae,{i18nKey:"common.error"})}),r.jsx(ed,{children:(ce=N.formState.errors.root)==null?void 0:ce.message})]}),r.jsxs("nav",{className:"grid gap-4 text-sm text-muted-foreground",children:[r.jsx("a",{onClick:()=>a("profile"),className:t==="profile"?"font-semibold text-primary":"cursor-pointer",children:r.jsx(ae,{i18nKey:"settings.edit.tabs.profile"})}),r.jsx("a",{onClick:()=>a("quotes"),className:t==="quotes"?"font-semibold text-primary":"cursor-pointer ",children:r.jsx(ae,{i18nKey:"settings.edit.tabs.quotes"})}),r.jsx("a",{onClick:()=>a("legal"),className:t==="legal"?"font-semibold text-primary":"cursor-pointer ",children:r.jsx(ae,{i18nKey:"settings.edit.tabs.legal"})})]}),r.jsxs("div",{className:me("grid gap-6",t==="profile"?"visible":"hidden"),children:[r.jsxs(Ve,{children:[r.jsxs(ht,{children:[r.jsx(et,{children:r.jsx(ae,{i18nKey:"settings.form_fields.language.label"})}),r.jsx(it,{children:r.jsx(ae,{i18nKey:"settings.form_fields.language.desc"})})]}),r.jsx(He,{children:r.jsx(qr,{control:N.control,name:"lang_code",render:({field:pe})=>r.jsxs(Un,{value:pe.value,onValueChange:pe.onChange,children:[r.jsx(zn,{"aria-label":c("settings.form_fields.language.label"),children:r.jsx(Vn,{placeholder:c("settings.form_fields.language.placeholder")})}),r.jsx(Hn,{children:yn.map(le=>r.jsxs(Xt,{value:le.code,children:[r.jsx("span",{"aria-hidden":"true",className:`mr-2 ${le.flagClassName}`}),le.name]},le.code))})]})})}),r.jsx(Ut,{className:"px-6 py-4 border-t",children:r.jsx(U,{children:r.jsx(ae,{i18nKey:"common.save"})})})]}),r.jsxs(Ve,{children:[r.jsxs(ht,{children:[r.jsx(et,{children:r.jsx(ae,{i18nKey:"settings.form_fields.contact_information.label"})}),r.jsx(it,{children:r.jsx(ae,{i18nKey:"settings.form_fields.contact_information.desc"})})]}),r.jsx(He,{children:r.jsx(an,{rows:8,placeholder:c("settings.form_fields.contact_information.placeholder"),name:"contact_information",required:!0})}),r.jsx(Ut,{className:"px-6 py-4 border-t",children:r.jsx(U,{children:r.jsx(ae,{i18nKey:"common.save"})})})]}),r.jsxs(Ve,{children:[r.jsxs(ht,{children:[r.jsx(et,{children:r.jsx(ae,{i18nKey:"settings.form_fields.logo.label"})}),r.jsx(it,{children:r.jsx(ae,{i18nKey:"settings.form_fields.logo.desc"})})]}),r.jsx(He,{children:r.jsxs("div",{className:"flex items-center space-x-4",children:[r.jsx("div",{className:"w-[400px] h-[200px] border border-gray-300 flex items-center justify-center overflow-hidden",children:r.jsx("img",{src:g.dealer.logo?g.dealer.logo:"https://via.placeholder.com/200x100",width:400,height:200,style:{objectFit:"contain"}})}),r.jsx("div",{children:r.jsx("p",{className:"mt-2 text-sm text-gray-500",children:r.jsx(ae,{i18nKey:"settings.form_fields.logo.requirements"})})})]})}),r.jsxs(Ut,{className:"px-6 py-4 border-t",children:[r.jsx(Jt,{htmlFor:"logo-upload",className:"inline-flex items-center justify-center h-10 px-4 py-2 text-sm font-medium transition-colors rounded-md cursor-pointer bg-primary text-primary-foreground hover:bg-primary/90 whitespace-nowrap ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",children:r.jsx(ae,{i18nKey:"settings.form_fields.logo.upload"})}),r.jsx(ms,{id:"logo-upload",type:"file",accept:".png,.jpg,.jpeg",onChange:q,className:"hidden"})]})]})]}),r.jsxs("div",{className:me("grid gap-6",t==="quotes"?"visible":"hidden"),children:[r.jsxs(Ve,{children:[r.jsxs(ht,{children:[r.jsx(et,{children:r.jsx(ae,{i18nKey:"settings.form_fields.default_show_line_discount_column.label"})}),r.jsx(it,{children:r.jsx(ae,{i18nKey:"settings.form_fields.default_show_line_discount_column.desc"})})]}),r.jsx(He,{children:r.jsx(qr,{control:N.control,name:"default_show_line_discount_column",render:({field:pe})=>r.jsx(xs,{checked:pe.value??!0,onCheckedChange:pe.onChange})})}),r.jsx(Ut,{className:"px-6 py-4 border-t",children:r.jsx(U,{children:r.jsx(ae,{i18nKey:"common.save"})})})]}),r.jsxs(Ve,{children:[r.jsxs(ht,{children:[r.jsx(et,{children:r.jsx(ae,{i18nKey:"settings.form_fields.default_tax.label"})}),r.jsx(it,{children:r.jsx(ae,{i18nKey:"settings.form_fields.default_tax.desc"})})]}),r.jsxs(He,{children:[r.jsx(ur,{maxLength:32,placeholder:c("settings.form_fields.default_tax_label.placeholder"),name:"default_tax_label",required:!0,description:c("settings.form_fields.default_tax_label.desc")}),r.jsx("br",{}),r.jsx(xi,{scale:2,disabled:I.disabled,placeholder:c("settings.form_fields.default_tax.desc"),name:"default_tax",required:!0,description:c("settings.form_fields.default_tax.desc")})]}),r.jsx(Ut,{className:"px-6 py-4 border-t",children:r.jsx(U,{children:r.jsx(ae,{i18nKey:"common.save"})})})]}),r.jsxs(Ve,{children:[r.jsxs(ht,{children:[r.jsx(et,{children:r.jsx(ae,{i18nKey:"settings.form_fields.default_payment_method.label"})}),r.jsx(it,{children:r.jsx(ae,{i18nKey:"settings.form_fields.default_payment_method.desc"})})]}),r.jsx(He,{children:r.jsx(an,{autoSize:!0,placeholder:c("settings.form_fields.default_payment_method.placeholder"),name:"default_payment_method",required:!0,errors:N.formState.errors})}),r.jsx(Ut,{className:"px-6 py-4 border-t",children:r.jsx(U,{children:r.jsx(ae,{i18nKey:"common.save"})})})]}),r.jsxs(Ve,{children:[r.jsxs(ht,{children:[r.jsx(et,{children:r.jsx(ae,{i18nKey:"settings.form_fields.default_quote_validity.label"})}),r.jsx(it,{children:r.jsx(ae,{i18nKey:"settings.form_fields.default_quote_validity.desc"})})]}),r.jsx(He,{children:r.jsx(an,{autoSize:!0,placeholder:c("settings.form_fields.default_quote_validity.placeholder"),name:"default_quote_validity",required:!0})}),r.jsx(Ut,{className:"px-6 py-4 border-t",children:r.jsx(U,{children:r.jsx(ae,{i18nKey:"common.save"})})})]}),r.jsxs(Ve,{children:[r.jsxs(ht,{children:[r.jsx(et,{children:r.jsx(ae,{i18nKey:"settings.form_fields.default_notes.label"})}),r.jsx(it,{children:r.jsx(ae,{i18nKey:"settings.form_fields.default_notes.desc"})})]}),r.jsx(He,{children:r.jsx(an,{autoSize:!0,placeholder:c("settings.form_fields.default_notes.placeholder"),name:"default_notes"})}),r.jsx(Ut,{className:"px-6 py-4 border-t",children:r.jsx(U,{children:r.jsx(ae,{i18nKey:"common.save"})})})]})]}),r.jsx("div",{className:me("grid gap-6",t==="legal"?"visible":"hidden"),children:r.jsxs(Ve,{className:"h-",children:[r.jsxs(ht,{children:[r.jsx(et,{children:r.jsx(ae,{i18nKey:"settings.form_fields.default_legal_terms.label"})}),r.jsx(it,{children:r.jsx(ae,{i18nKey:"settings.form_fields.default_legal_terms.desc"})})]}),r.jsx(He,{children:r.jsx(an,{rows:25,placeholder:c("settings.form_fields.default_legal_terms.placeholder"),name:"default_legal_terms"})}),r.jsx(Ut,{className:"px-6 py-4 border-t",children:r.jsx(U,{children:r.jsx(ae,{i18nKey:"common.save"})})})]})})]})})})},$j=D.createContext(null),Bj=({children:t})=>r.jsx($j.Provider,{value:{},children:t}),ry=({children:t})=>r.jsx(Ii,{children:r.jsx(Bj,{children:r.jsxs(gs,{className:"settings-layout",children:[r.jsx(hs,{}),r.jsxs(ps,{children:[r.jsx("div",{className:"grid w-full max-w-6xl gap-2 mx-auto",children:r.jsx("h1",{className:"text-2xl font-semibold md:text-3xl",children:r.jsx(ae,{i18nKey:"settings.edit.title"})})}),t]})]})})});export{Gj as CatalogLayout,Kj as CatalogList,Wj as DashboardPage,Qj as DealerLayout,Yj as DealersList,Xj as ErrorPage,Vj as LoginPageWithLanguageSelector,Hj as LogoutPage,Zj as QuoteCreate,Jj as QuoteEdit,ey as QuotesLayout,ty as QuotesList,ny as SettingsEditor,ry as SettingsLayout};