diff --git a/client/src/app/settings/edit.tsx b/client/src/app/settings/edit.tsx index 164520b..0ec8174 100644 --- a/client/src/app/settings/edit.tsx +++ b/client/src/app/settings/edit.tsx @@ -1,4 +1,10 @@ -import { ErrorOverlay, FormPercentageField, FormTextAreaField, LoadingOverlay } from "@/components"; +import { + ErrorOverlay, + FormPercentageField, + FormTextAreaField, + FormTextField, + LoadingOverlay, +} from "@/components"; import { Alert, AlertDescription, @@ -49,6 +55,7 @@ export const SettingsEditor = () => { amount: undefined, scale: 2, }, + default_tax_label: "% IVA", }), [] ); @@ -287,12 +294,21 @@ export const SettingsEditor = () => { + +
diff --git a/client/src/locales/en.json b/client/src/locales/en.json index f66ce47..cdf59f2 100644 --- a/client/src/locales/en.json +++ b/client/src/locales/en.json @@ -162,7 +162,6 @@ "sent_to": "Send to Uecko" } }, - "resume": { "title": "Quote", "download_quote": "Download quote", @@ -170,7 +169,6 @@ "resume": "Resume", "preview": "Preview" }, - "quote_information": "Quote Information", "customer_information": "Customer Information", "payment_information": "Payment Information", @@ -455,6 +453,11 @@ "placeholder": "", "desc": "Default tax rate for your quotes" }, + "default_tax_label": { + "label": "Tax label", + "placeholder": "% VAT", + "desc": "Name or label shown alongside the tax" + }, "default_show_line_discount_column": { "label": "Show discount column by default", "desc": "New quotes will initially show the discount column in their lines. You can change this option later for each quote." @@ -482,4 +485,4 @@ } } } -} +} \ No newline at end of file diff --git a/client/src/locales/es.json b/client/src/locales/es.json index c5c1adb..372cdd5 100644 --- a/client/src/locales/es.json +++ b/client/src/locales/es.json @@ -162,7 +162,6 @@ "sent_to": "Enviar a Uecko" } }, - "resume": { "title": "Cotización", "download_quote": "Descargar", @@ -170,7 +169,6 @@ "resume": "Resumen", "preview": "Previsualización" }, - "quote_information": "Información", "customer_information": "Cliente", "payment_information": "Pago", @@ -243,7 +241,6 @@ "description": "Para ayudar a rellenar la cotización, puede añadir bloques de texto predefinidos de esta lista.", "toast_article_added": "Bloque de texto añadido:" }, - "quote_sent_to_editor": { "trigger_button": "Enviar a Uecko", "title": "Enviar la cotización a Uecko", @@ -251,7 +248,6 @@ "submit_button": "Enviar", "toast_status_changed": "Cotización enviada a Uecko" }, - "quote_status_editor": { "trigger_button": "Cambiar el estado", "title": "Cambiar el estado de la cotización", @@ -439,8 +435,8 @@ "subtitle": "", "tabs": { "profile": "Ajustes de perfil", - "quotes": "Ajustes legales", - "legal": "Ajustes para cotizaciones" + "quotes": "Ajustes para cotizaciones", + "legal": "Ajustes legales" } }, "form_fields": { @@ -459,9 +455,14 @@ "desc": "Esta información de contacto aparecerá en las cotizaciones que entregue a sus clientes." }, "default_tax": { - "label": "IVA por defecto (%)", + "label": "Impuesto por defecto (%)", "placeholder": "", - "desc": "Porcentaje de IVA por defecto en las cotizaciones" + "desc": "Porcentaje de impuesto por defecto en las cotizaciones" + }, + "default_tax_label": { + "label": "Etiqueta del impuesto", + "placeholder": "% IVA", + "desc": "Nombre o etiqueta que se mostrará junto al impuesto" }, "default_show_line_discount_column": { "label": "Mostrar columna descuento por defecto", @@ -497,4 +498,4 @@ "form_fields": {} } } -} +} \ No newline at end of file diff --git a/dist/client/assets/index-DP3f1470.js b/dist/client/assets/index-Dq5tsIog.js similarity index 85% rename from dist/client/assets/index-DP3f1470.js rename to dist/client/assets/index-Dq5tsIog.js index 9d342d5..f6075ee 100644 --- a/dist/client/assets/index-DP3f1470.js +++ b/dist/client/assets/index-Dq5tsIog.js @@ -1,4 +1,4 @@ -var P_=Object.defineProperty;var k_=(n,a,r)=>a in n?P_(n,a,{enumerable:!0,configurable:!0,writable:!0,value:r}):n[a]=r;var Se=(n,a,r)=>k_(n,typeof a!="symbol"?a+"":a,r);import{u as Ic,a as Jt,b as en,c as Mn,d as Ne,j as i,P as q_,e as $_,f as he,g as z_,N as Wi,R as Pe,J as Nt,h as ke,i as Jn,D as er,l as Aa,M as Tt,V as B_,r as M,k as Fc,m as Mc,n as rr,o as Dc,B as G,C as V_,p as ir,q as sr,s as ar,S as no,t as or,v as Vi,w,x as ro,y as Yi,z as Qi,A as Xi,E as Lr,F as io,G as so,H as ao,I as oo,K as lo,L as U_,O as Or,Q as G_,T as H_,U as K_,W as Le,X as pt,Y as Ge,Z as Ze,_ as Oe,$ as mn,a0 as uo,a1 as W_,a2 as co,a3 as hn,a4 as fo,a5 as go,a6 as qr,a7 as Dt,a8 as Tc,a9 as Y_,aa as Ui,ab as lr,ac as mo,ad as ho,ae as po,af as xo,ag as Lc,ah as vo,ai as _o,aj as bo,ak as Zi,al as Q_,am as X_,an as Z_,ao as gc,ap as J_,aq as e0,ar as mc,as as hc,at as Ia,au as t0,av as n0,aw as An,ax as pc,ay as r0,az as i0,aA as s0,aB as wo,aC as zt,aD as vn,aE as Ji,aF as Oc,aG as In,aH as a0,aI as Pc,aJ as o0,aK as le,aL as es,aM as xc,aN as kc,aO as qc,aP as $c,aQ as Dn,aR as zc,aS as ts,aT as zr,aU as Br,aV as Vr,aW as $r,aX as l0,aY as Bc,aZ as He,a_ as Ke,a$ as Ua,b0 as We,b1 as tr,b2 as ur,b3 as nr,b4 as u0,b5 as c0,b6 as d0,b7 as Ga,b8 as f0,b9 as g0,ba as Xn,bb as Vc,bc as Ha,bd as Uc,be as qt,bf as m0,bg as h0,bh as ns,bi as cr,bj as Gc,bk as p0,bl as So,bm as x0,bn as Hc,bo as Kc,bp as Wc,bq as Yc,br as Qc,bs as Xc,bt as Zc,bu as Jc,bv as ed,bw as v0,bx as Pi,by as _0,bz as b0,bA as w0,bB as S0,bC as j0,bD as C0,bE as y0,bF as N0,bG as R0,bH as E0,bI as A0,bJ as vc,bK as td,bL as nd,bM as rd,bN as id,bO as sd,bP as ad,bQ as od,bR as I0,bS as Fa,bT as F0,bU as M0,bV as D0,bW as ld,bX as ud,bY as Ka,bZ as Wa,b_ as T0,b$ as Ma,c0 as L0,c1 as O0,c2 as P0}from"./index-D_mpiX-a.js";const k0=n=>{const{onSuccess:a,...r}=n||{},o=Mn(),{login:l}=Ic(),c=Jt();return en({mutationKey:o().auth().action("login").get(),mutationFn:l,onSuccess:async(d,h,p)=>{d.success&&c.removeQueries({queryKey:o().auth().get()}),await(a==null?void 0:a(d,h,p))},...r})};/** +var P_=Object.defineProperty;var k_=(n,a,r)=>a in n?P_(n,a,{enumerable:!0,configurable:!0,writable:!0,value:r}):n[a]=r;var Se=(n,a,r)=>k_(n,typeof a!="symbol"?a+"":a,r);import{u as Ic,a as Jt,b as en,c as Mn,d as Ne,j as i,P as q_,e as $_,f as he,g as z_,N as Wi,R as Pe,J as Rt,h as ke,i as Jn,D as er,l as Aa,M as Tt,V as B_,r as M,k as Fc,m as Mc,n as rr,o as Dc,B as U,C as V_,p as ir,q as sr,s as ar,S as no,t as or,v as Vi,w,x as ro,y as Yi,z as Qi,A as Xi,E as Lr,F as io,G as so,H as ao,I as oo,K as lo,L as U_,O as Or,Q as G_,T as H_,U as K_,W as Le,X as ct,Y as Be,Z as He,_ as Oe,$ as hn,a0 as uo,a1 as W_,a2 as co,a3 as pn,a4 as fo,a5 as go,a6 as qr,a7 as Nt,a8 as Tc,a9 as Y_,aa as Ui,ab as lr,ac as mo,ad as ho,ae as po,af as xo,ag as Lc,ah as vo,ai as _o,aj as bo,ak as Zi,al as Q_,am as X_,an as Z_,ao as gc,ap as J_,aq as e0,ar as mc,as as hc,at as Ia,au as t0,av as n0,aw as In,ax as pc,ay as r0,az as i0,aA as s0,aB as wo,aC as zt,aD as _n,aE as Ji,aF as Oc,aG as Fn,aH as a0,aI as Pc,aJ as o0,aK as se,aL as es,aM as xc,aN as kc,aO as qc,aP as $c,aQ as Dn,aR as zc,aS as ts,aT as zr,aU as Br,aV as Vr,aW as $r,aX as l0,aY as Bc,aZ as Ke,a_ as We,a$ as Ua,b0 as Ye,b1 as tr,b2 as ur,b3 as nr,b4 as u0,b5 as c0,b6 as d0,b7 as Ga,b8 as f0,b9 as g0,ba as Xn,bb as Vc,bc as Ha,bd as Uc,be as qt,bf as m0,bg as h0,bh as ns,bi as cr,bj as Gc,bk as p0,bl as So,bm as x0,bn as Hc,bo as Kc,bp as Wc,bq as Yc,br as Qc,bs as Xc,bt as Zc,bu as Jc,bv as ed,bw as v0,bx as Pi,by as _0,bz as b0,bA as w0,bB as S0,bC as j0,bD as C0,bE as y0,bF as N0,bG as R0,bH as E0,bI as A0,bJ as vc,bK as td,bL as nd,bM as rd,bN as id,bO as sd,bP as ad,bQ as od,bR as I0,bS as Fa,bT as F0,bU as M0,bV as D0,bW as ld,bX as ud,bY as Ka,bZ as Wa,b_ as T0,b$ as Ma,c0 as L0,c1 as O0,c2 as P0}from"./index-DzeF1POa.js";const k0=n=>{const{onSuccess:a,...r}=n||{},o=Mn(),{login:l}=Ic(),c=Jt();return en({mutationKey:o().auth().action("login").get(),mutationFn:l,onSuccess:async(d,h,p)=>{d.success&&c.removeQueries({queryKey:o().auth().get()}),await(a==null?void 0:a(d,h,p))},...r})};/** * @license lucide-react v0.427.0 - ISC * * This source code is licensed under the ISC license. @@ -123,7 +123,7 @@ var P_=Object.defineProperty;var k_=(n,a,r)=>a in n?P_(n,a,{enumerable:!0,config * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const pd=Ne("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"}]]),Z0=({className:n,...a})=>i.jsx($_,{className:he("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",n),...a}),wc=q_,J0=({withHandle:n,className:a,...r})=>i.jsx(z_,{className:he("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),...r,children:n&&i.jsx("div",{className:"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border",children:i.jsx(md,{className:"h-2.5 w-2.5"})})});function ut({className:n,...a}){return i.jsx("div",{className:he("animate-pulse rounded-md bg-muted",n),...a})}const eb=n=>typeof n=="object"&&n!==null&&n.hasOwnProperty("total_items");let ki;const tb=new Uint8Array(16);function nb(){if(!ki&&(ki=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!ki))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ki(tb)}const Ue=[];for(let n=0;n<256;++n)Ue.push((n+256).toString(16).slice(1));function rb(n,a=0){return Ue[n[a+0]]+Ue[n[a+1]]+Ue[n[a+2]]+Ue[n[a+3]]+"-"+Ue[n[a+4]]+Ue[n[a+5]]+"-"+Ue[n[a+6]]+Ue[n[a+7]]+"-"+Ue[n[a+8]]+Ue[n[a+9]]+"-"+Ue[n[a+10]]+Ue[n[a+11]]+Ue[n[a+12]]+Ue[n[a+13]]+Ue[n[a+14]]+Ue[n[a+15]]}const ib=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Sc={randomUUID:ib};function sb(n,a,r){if(Sc.randomUUID&&!n)return Sc.randomUUID();n=n||{};const o=n.random||(n.rng||nb)();return o[6]=o[6]&15|64,o[8]=o[8]&63|128,rb(o)}class dn extends Wi{static validate(a,r){const o=Pe.RULE_ALLOW_EMPTY.default(""),l=Nt.string().guid({version:["uuidv4"]}).label(r.label?r.label:"id"),c=Nt.alternatives(o,l);return Pe.validate(c,a)}static sanitize(a){return a.trim()}static create(a,r={}){const o={label:"id",generateOnEmpty:!1,...r};if(!a&&!o.generateOnEmpty)return ke.fail(Jn(er.INVALID_INPUT_DATA,"ID is null or empty"));if(a){const l=dn.validate(a,o);return l.isFailure?ke.fail(Jn(er.INVALID_INPUT_DATA,l.error.message,o)):ke.ok(new dn(dn.sanitize(l.object)))}return o.generateOnEmpty?dn.generateNewID():ke.ok(new dn(null))}static generateNewID(){return ke.ok(new dn(sb()))}get value(){return String(this.props)}toString(){return String(this.props)}toPrimitive(){return this.toString()}}const Da={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"}},fn=class fn extends Wi{constructor(){super(...arguments);Se(this,"toString",()=>this.code)}static validate(r,o){const l=Nt.alternatives(Pe.RULE_ALLOW_EMPTY.default(""),Nt.string().lowercase().valid(...Object.keys(Da)).label(String(o.label)));return Pe.validate(l,r)}static sanitize(r){return r?String(r).toLowerCase():void 0}static createFromCode(r,o={}){const l={...o,label:o.label?o.label:"lang_code"},c=fn.validate(r,l);if(c.isFailure)return ke.fail(Jn(er.INVALID_INPUT_DATA,c.error.message,l));const d=fn.sanitize(c.object),h=d?{...Da[c.object],code:d}:void 0;return ke.ok(new fn(h))}static createDefaultCode(){return fn.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()}};Se(fn,"DEFAULT_LANGUAGE_CODE","es"),Se(fn,"LANGUAGES",Da);let Pr=fn;class xd{constructor(a){Se(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 vd=2,Ta={amount:0,scale:vd},ve=class ve extends Wi{constructor(r,o,l){super(r);Se(this,"_isNull");Se(this,"_options");Se(this,"isEmpty",()=>this.isNull());Se(this,"isNull",()=>this._isNull);this._isNull=Object.freeze(o),this._options=Object.freeze(l)}static validate(r,o,l){const c=Pe.RULE_ALLOW_NULL_OR_UNDEFINED,d=Pe.RULE_ALLOW_EMPTY,h=Pe.RULE_IS_TYPE_NUMBER.label(l.label?l.label:"amount"),p=Pe.RULE_IS_TYPE_STRING.regex(/^[-]?\d+$/).label(l.label?l.label:"amount"),x=Nt.number().min(ve.MIN_SCALE).max(ve.MAX_SCALE).label(l.label?l.label:"scale"),v=new xd([Pe.validate(Nt.alternatives(c,d,h,p),r),Pe.validate(Nt.alternatives(Pe.RULE_IS_TYPE_NUMBER.label(l.label?l.label:"scale"),x),o)]);if(v.hasSomeFaultyResult())return v.getFirstFaultyResult();let R=typeof r=="string"?parseInt(r,10):Number(r),y=Aa.isNull(o)?ve.DEFAULT_SCALE:Number(o);const b=R/Math.pow(10,y);return bve.MAX_VALUE?ke.fail(new Error(`Value with scale is out of range: ${b}`)):ke.ok()}static create(r=Ta,o={}){if(r===null)throw new Error("InvalidParams: props params is missing");const{amount:l=Ta.amount,scale:c=Ta.scale}=r,d={label:"percentage",...o},h=ve.validate(l,c,d);if(h.isFailure)return ke.fail(Jn(er.INVALID_INPUT_DATA,h.error.message,d));let p=ve._sanitize(l);const x={amount:Aa.isNull(p)?0:p,scale:c};return ke.ok(new this(x,Aa.isNull(p),o))}static createFromFormattedValue(r,o={}){if(r===null||r==="")return ve.create({amount:null,scale:ve.DEFAULT_SCALE});const l=String(r),[c,d]=l.split(",");let h=c,p=2;return d===void 0?p=0:(d===""&&(h=c+d.padEnd(1,"0"),p=1),d.length===1?(h=c+d.padEnd(1,"0"),p=1):d.length===2&&(h=c+d.padEnd(2,"0"),p=2)),ve.create({amount:h,scale:p},o)}static _sanitize(r){let o=null;return typeof r=="string"?o=parseInt(r,10):o=r,o}static _toString(r,o){if(r===null)return"";const l=Math.pow(10,o);return(Number(r)/l).toFixed(o)}static _isWithinRange(r,o){const l=Number(ve._toString(r,o));return l>=ve.MIN_VALUE&&l<=ve.MAX_VALUE}get amount(){var r;return this.isNull()?null:Number((r=this.props)==null?void 0:r.amount)}get scale(){var r;return Number((r=this.props)==null?void 0:r.scale)}getAmount(){var r;return this.isNull()?null:Number((r=this.props)==null?void 0:r.amount)}getScale(){var r;return this.isNull()?0:Number((r=this.props)==null?void 0:r.scale)}toString(){return ve._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!==ve.DEFAULT_SCALE?this.convertScale(ve.DEFAULT_SCALE).toPrimitive():this.amount}toPrimitives(){return this.toObject()}toObject(){return{amount:this.amount,scale:this.scale}}convertScale(r){if(rve.MAX_SCALE)throw new Error(`Scale out of range: ${r}`);if(this.isNull())return new ve({amount:null,scale:r},!0,this._options);const o=Math.pow(10,this.scale),l=Number(this.amount)/o,c=Math.pow(10,r),d=Math.round(l*c);if(!ve._isWithinRange(d,r))throw new Error(`Value out of range after conversion: ${d} ${r}`);return new ve({amount:d,scale:r},!1,this._options)}hasSameScale(r){return this.scale===r.scale}isWithinRange(){return ve._isWithinRange(this.amount,this.scale)}};Se(ve,"DEFAULT_SCALE",vd),Se(ve,"MIN_VALUE",0),Se(ve,"MAX_VALUE",100),Se(ve,"MIN_SCALE",0),Se(ve,"MAX_SCALE",2);let $t=ve;const _d=2,La={amount:0,scale:_d},_e=class _e extends Wi{constructor(r,o,l){super(r);Se(this,"_isNull");Se(this,"_options");Se(this,"isEmpty",()=>this.isNull());Se(this,"isNull",()=>this._isNull);this._isNull=Object.freeze(o),this._options=Object.freeze(l)}static validate(r,o,l={}){const c=Pe.RULE_ALLOW_NULL_OR_UNDEFINED,d=Pe.RULE_ALLOW_EMPTY,h=Pe.RULE_IS_TYPE_NUMBER.label(l.label?l.label:"amount"),p=Pe.RULE_IS_TYPE_STRING.regex(/^[-]?\d+$/).label(l.label?l.label:"amount"),x=Nt.number().min(_e.MIN_SCALE).max(_e.MAX_SCALE).label(l.label?l.label:"scale"),v=new xd([Pe.validate(Nt.alternatives(c,d,h,p),r),Pe.validate(Nt.alternatives(Pe.RULE_IS_TYPE_NUMBER.label(l.label?l.label:"scale"),x),o)]);return v.hasSomeFaultyResult()?v.getFirstFaultyResult():ke.ok()}static create(r=La,o={}){if(r===null)throw new Error("InvalidParams: props params is missing");const{amount:l=La.amount,scale:c=La.scale}=r,d={label:"quantity",...o},h=_e.validate(l,c,d);if(h.isFailure)return ke.fail(Jn(er.INVALID_INPUT_DATA,h.error.message,d));let p=_e._sanitize(l);const x={amount:p===null?0:p,scale:c};return ke.ok(new _e(x,p===null,o))}static createFromFormattedValue(r,o={}){if(r===null||r==="")return _e.create({amount:null,scale:_e.DEFAULT_SCALE});const l=String(r),[c,d]=l.split(",");let h=c,p=2;return d===void 0?p=0:(d===""&&(h=c+d.padEnd(1,"0"),p=1),d.length===1?(h=c+d.padEnd(1,"0"),p=1):d.length===2&&(h=c+d.padEnd(2,"0"),p=2)),_e.create({amount:h,scale:p},o)}static _sanitize(r){let o=null;return typeof r=="string"?o=parseInt(r,10):o=r,o}static _toString(r,o){if(r===null)return"";const l=Math.pow(10,o);return(Number(r)/l).toFixed(o)}get amount(){var r;return this.isNull()?null:Number((r=this.props)==null?void 0:r.amount)}get scale(){var r;return Number((r=this.props)==null?void 0:r.scale)}getAmount(){var r;return this.isNull()?null:Number((r=this.props)==null?void 0:r.amount)}getScale(){var r;return this.isNull()?0:Number((r=this.props)==null?void 0:r.scale)}toString(){return _e._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!==_e.DEFAULT_SCALE?this.convertScale(_e.DEFAULT_SCALE).toPrimitive():this.amount}toPrimitives(){return this.toObject()}toObject(){return{amount:this.amount,scale:this.scale}}convertScale(r){if(r<_e.MIN_SCALE||r>_e.MAX_SCALE)throw new Error(`Scale out of range: ${r}`);if(this.isNull())return new _e({amount:null,scale:r},!0,this._options);const o=Math.pow(10,this.scale),l=Number(this.amount)/o,c=Math.pow(10,r),d=Math.round(l*c);return new _e({amount:d,scale:r},!1,this._options)}hasSameScale(r){return this.scale===r.scale}increment(r){return this.isNull()?r?_e.create(r.toObject()):_e.create():r?this.hasSameScale(r)?_e.create({amount:Number(this.amount)+Number(r.amount),scale:this.scale},this._options):ke.fail(Error("No se pueden sumar cantidades con diferentes escalas.")):_e.create({amount:Number(this.amount)+1,scale:this.scale},this._options)}decrement(r){return this.isNull()?r?_e.create(r.toObject()):_e.create():r?this.hasSameScale(r)?_e.create({amount:Number(this.amount)-Number(r.amount),scale:this.scale},this._options):ke.fail(Error("No se pueden restar cantidades con diferentes escalas.")):_e.create({amount:Number(this.amount)-1,scale:this.scale},this._options)}};Se(_e,"DEFAULT_SCALE",_d),Se(_e,"MIN_SCALE",0),Se(_e,"MAX_SCALE",2);let pn=_e;const jc=2;class ab extends Tt{static create(a){const{amount:r,currencyCode:o,scale:l=jc}=a,c=Tt.create({amount:r,currencyCode:o,scale:l});if(c.isFailure)return c;const d=c.object.convertScale(jc);return ke.ok(d)}}class Zn extends B_{constructor(){super(...arguments);Se(this,"isValid",()=>!isNaN(this.props.valueOf())&&this.props.valueOf()!==0);Se(this,"isEmpty",()=>!this.isValid());Se(this,"toISO8601",()=>this.isValid()?this.props.toISOString():"");Se(this,"toDateString",()=>this.isValid()?this.props.toDateString():"");Se(this,"toLocaleDateString",(r,o)=>this.isValid()?this.props.toLocaleDateString(r,o):"");Se(this,"toLocaleTimeString",()=>this.isValid()?this.props.toLocaleTimeString():"")}static validate(r,o){const l=Pe.RULE_ALLOW_EMPTY.default(0),c=Nt.date().label(String(o.label)),d=Nt.alternatives(l,c);return Pe.validate(d,r)}static createCurrentDate(){return ke.ok(new Zn(new Date))}static create(r,o={}){const l={...o,dateFormat:o.dateFormat?o.dateFormat:"YYYY-MM-DD",label:o.label?o.label:"date"},c=Zn.validate(r,l);return c.isFailure?ke.fail(Jn(er.INVALID_INPUT_DATA,c.error.message,l)):ke.ok(new Zn(new Date(c.object)))}toString(){if(!this.isEmpty()){const r=this.props.getFullYear(),o=String(this.props.getMonth()+1).padStart(2,"0"),l=String(this.props.getDate()).padStart(2,"0");return`${r}-${o}-${l}`}return""}toPrimitive(){return this.toISO8601()}}const ob=({isPending:n,interval:a=1e3,onInterval:r})=>{const[o,l]=M.useState(void 0);return M.useEffect(()=>{let c;return n&&(c=setInterval(()=>{l(d=>d===void 0?a:d+a)},a)),()=>{clearInterval(c),l(void 0)}},[n,a]),M.useEffect(()=>{r&&o&&r(o)},[o]),{elapsedTime:o}},lb=2*60*1e3,ub=60*1e3,No=({queryKey:n,queryFn:a,enabled:r,select:o,queryOptions:l={},overtimeOptions:c})=>{const[d,h]=M.useState(!1),p=Fc({queryKey:n,queryFn:a,placeholderData:Mc,staleTime:ub,refetchInterval:lb,refetchOnWindowFocus:!0,enabled:r&&!!a,select:o,...l});M.useEffect(()=>{p.isSuccess&&eb(p.data)&&h(p.data.total_items===0)},[p]);const{elapsedTime:x}=ob({isPending:p.isFetching,interval:c==null?void 0:c.interval,onInterval:c==null?void 0:c.onInterval});return{...p,overtime:{elapsedTime:x},isEmpty:d}},bd=n=>Fc({placeholderData:Mc,...n});function cb(n){return en({...n})}/** + */const pd=Ne("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"}]]),Z0=({className:n,...a})=>i.jsx($_,{className:he("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",n),...a}),wc=q_,J0=({withHandle:n,className:a,...r})=>i.jsx(z_,{className:he("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),...r,children:n&&i.jsx("div",{className:"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border",children:i.jsx(md,{className:"h-2.5 w-2.5"})})});function ut({className:n,...a}){return i.jsx("div",{className:he("animate-pulse rounded-md bg-muted",n),...a})}const eb=n=>typeof n=="object"&&n!==null&&n.hasOwnProperty("total_items");let ki;const tb=new Uint8Array(16);function nb(){if(!ki&&(ki=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!ki))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ki(tb)}const Ge=[];for(let n=0;n<256;++n)Ge.push((n+256).toString(16).slice(1));function rb(n,a=0){return Ge[n[a+0]]+Ge[n[a+1]]+Ge[n[a+2]]+Ge[n[a+3]]+"-"+Ge[n[a+4]]+Ge[n[a+5]]+"-"+Ge[n[a+6]]+Ge[n[a+7]]+"-"+Ge[n[a+8]]+Ge[n[a+9]]+"-"+Ge[n[a+10]]+Ge[n[a+11]]+Ge[n[a+12]]+Ge[n[a+13]]+Ge[n[a+14]]+Ge[n[a+15]]}const ib=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Sc={randomUUID:ib};function sb(n,a,r){if(Sc.randomUUID&&!n)return Sc.randomUUID();n=n||{};const o=n.random||(n.rng||nb)();return o[6]=o[6]&15|64,o[8]=o[8]&63|128,rb(o)}class dn extends Wi{static validate(a,r){const o=Pe.RULE_ALLOW_EMPTY.default(""),l=Rt.string().guid({version:["uuidv4"]}).label(r.label?r.label:"id"),c=Rt.alternatives(o,l);return Pe.validate(c,a)}static sanitize(a){return a.trim()}static create(a,r={}){const o={label:"id",generateOnEmpty:!1,...r};if(!a&&!o.generateOnEmpty)return ke.fail(Jn(er.INVALID_INPUT_DATA,"ID is null or empty"));if(a){const l=dn.validate(a,o);return l.isFailure?ke.fail(Jn(er.INVALID_INPUT_DATA,l.error.message,o)):ke.ok(new dn(dn.sanitize(l.object)))}return o.generateOnEmpty?dn.generateNewID():ke.ok(new dn(null))}static generateNewID(){return ke.ok(new dn(sb()))}get value(){return String(this.props)}toString(){return String(this.props)}toPrimitive(){return this.toString()}}const Da={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"}},fn=class fn extends Wi{constructor(){super(...arguments);Se(this,"toString",()=>this.code)}static validate(r,o){const l=Rt.alternatives(Pe.RULE_ALLOW_EMPTY.default(""),Rt.string().lowercase().valid(...Object.keys(Da)).label(String(o.label)));return Pe.validate(l,r)}static sanitize(r){return r?String(r).toLowerCase():void 0}static createFromCode(r,o={}){const l={...o,label:o.label?o.label:"lang_code"},c=fn.validate(r,l);if(c.isFailure)return ke.fail(Jn(er.INVALID_INPUT_DATA,c.error.message,l));const d=fn.sanitize(c.object),h=d?{...Da[c.object],code:d}:void 0;return ke.ok(new fn(h))}static createDefaultCode(){return fn.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()}};Se(fn,"DEFAULT_LANGUAGE_CODE","es"),Se(fn,"LANGUAGES",Da);let Pr=fn;class xd{constructor(a){Se(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 vd=2,Ta={amount:0,scale:vd},ve=class ve extends Wi{constructor(r,o,l){super(r);Se(this,"_isNull");Se(this,"_options");Se(this,"isEmpty",()=>this.isNull());Se(this,"isNull",()=>this._isNull);this._isNull=Object.freeze(o),this._options=Object.freeze(l)}static validate(r,o,l){const c=Pe.RULE_ALLOW_NULL_OR_UNDEFINED,d=Pe.RULE_ALLOW_EMPTY,h=Pe.RULE_IS_TYPE_NUMBER.label(l.label?l.label:"amount"),p=Pe.RULE_IS_TYPE_STRING.regex(/^[-]?\d+$/).label(l.label?l.label:"amount"),x=Rt.number().min(ve.MIN_SCALE).max(ve.MAX_SCALE).label(l.label?l.label:"scale"),v=new xd([Pe.validate(Rt.alternatives(c,d,h,p),r),Pe.validate(Rt.alternatives(Pe.RULE_IS_TYPE_NUMBER.label(l.label?l.label:"scale"),x),o)]);if(v.hasSomeFaultyResult())return v.getFirstFaultyResult();let R=typeof r=="string"?parseInt(r,10):Number(r),y=Aa.isNull(o)?ve.DEFAULT_SCALE:Number(o);const b=R/Math.pow(10,y);return bve.MAX_VALUE?ke.fail(new Error(`Value with scale is out of range: ${b}`)):ke.ok()}static create(r=Ta,o={}){if(r===null)throw new Error("InvalidParams: props params is missing");const{amount:l=Ta.amount,scale:c=Ta.scale}=r,d={label:"percentage",...o},h=ve.validate(l,c,d);if(h.isFailure)return ke.fail(Jn(er.INVALID_INPUT_DATA,h.error.message,d));let p=ve._sanitize(l);const x={amount:Aa.isNull(p)?0:p,scale:c};return ke.ok(new this(x,Aa.isNull(p),o))}static createFromFormattedValue(r,o={}){if(r===null||r==="")return ve.create({amount:null,scale:ve.DEFAULT_SCALE});const l=String(r),[c,d]=l.split(",");let h=c,p=2;return d===void 0?p=0:(d===""&&(h=c+d.padEnd(1,"0"),p=1),d.length===1?(h=c+d.padEnd(1,"0"),p=1):d.length===2&&(h=c+d.padEnd(2,"0"),p=2)),ve.create({amount:h,scale:p},o)}static _sanitize(r){let o=null;return typeof r=="string"?o=parseInt(r,10):o=r,o}static _toString(r,o){if(r===null)return"";const l=Math.pow(10,o);return(Number(r)/l).toFixed(o)}static _isWithinRange(r,o){const l=Number(ve._toString(r,o));return l>=ve.MIN_VALUE&&l<=ve.MAX_VALUE}get amount(){var r;return this.isNull()?null:Number((r=this.props)==null?void 0:r.amount)}get scale(){var r;return Number((r=this.props)==null?void 0:r.scale)}getAmount(){var r;return this.isNull()?null:Number((r=this.props)==null?void 0:r.amount)}getScale(){var r;return this.isNull()?0:Number((r=this.props)==null?void 0:r.scale)}toString(){return ve._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!==ve.DEFAULT_SCALE?this.convertScale(ve.DEFAULT_SCALE).toPrimitive():this.amount}toPrimitives(){return this.toObject()}toObject(){return{amount:this.amount,scale:this.scale}}convertScale(r){if(rve.MAX_SCALE)throw new Error(`Scale out of range: ${r}`);if(this.isNull())return new ve({amount:null,scale:r},!0,this._options);const o=Math.pow(10,this.scale),l=Number(this.amount)/o,c=Math.pow(10,r),d=Math.round(l*c);if(!ve._isWithinRange(d,r))throw new Error(`Value out of range after conversion: ${d} ${r}`);return new ve({amount:d,scale:r},!1,this._options)}hasSameScale(r){return this.scale===r.scale}isWithinRange(){return ve._isWithinRange(this.amount,this.scale)}};Se(ve,"DEFAULT_SCALE",vd),Se(ve,"MIN_VALUE",0),Se(ve,"MAX_VALUE",100),Se(ve,"MIN_SCALE",0),Se(ve,"MAX_SCALE",2);let $t=ve;const _d=2,La={amount:0,scale:_d},_e=class _e extends Wi{constructor(r,o,l){super(r);Se(this,"_isNull");Se(this,"_options");Se(this,"isEmpty",()=>this.isNull());Se(this,"isNull",()=>this._isNull);this._isNull=Object.freeze(o),this._options=Object.freeze(l)}static validate(r,o,l={}){const c=Pe.RULE_ALLOW_NULL_OR_UNDEFINED,d=Pe.RULE_ALLOW_EMPTY,h=Pe.RULE_IS_TYPE_NUMBER.label(l.label?l.label:"amount"),p=Pe.RULE_IS_TYPE_STRING.regex(/^[-]?\d+$/).label(l.label?l.label:"amount"),x=Rt.number().min(_e.MIN_SCALE).max(_e.MAX_SCALE).label(l.label?l.label:"scale"),v=new xd([Pe.validate(Rt.alternatives(c,d,h,p),r),Pe.validate(Rt.alternatives(Pe.RULE_IS_TYPE_NUMBER.label(l.label?l.label:"scale"),x),o)]);return v.hasSomeFaultyResult()?v.getFirstFaultyResult():ke.ok()}static create(r=La,o={}){if(r===null)throw new Error("InvalidParams: props params is missing");const{amount:l=La.amount,scale:c=La.scale}=r,d={label:"quantity",...o},h=_e.validate(l,c,d);if(h.isFailure)return ke.fail(Jn(er.INVALID_INPUT_DATA,h.error.message,d));let p=_e._sanitize(l);const x={amount:p===null?0:p,scale:c};return ke.ok(new _e(x,p===null,o))}static createFromFormattedValue(r,o={}){if(r===null||r==="")return _e.create({amount:null,scale:_e.DEFAULT_SCALE});const l=String(r),[c,d]=l.split(",");let h=c,p=2;return d===void 0?p=0:(d===""&&(h=c+d.padEnd(1,"0"),p=1),d.length===1?(h=c+d.padEnd(1,"0"),p=1):d.length===2&&(h=c+d.padEnd(2,"0"),p=2)),_e.create({amount:h,scale:p},o)}static _sanitize(r){let o=null;return typeof r=="string"?o=parseInt(r,10):o=r,o}static _toString(r,o){if(r===null)return"";const l=Math.pow(10,o);return(Number(r)/l).toFixed(o)}get amount(){var r;return this.isNull()?null:Number((r=this.props)==null?void 0:r.amount)}get scale(){var r;return Number((r=this.props)==null?void 0:r.scale)}getAmount(){var r;return this.isNull()?null:Number((r=this.props)==null?void 0:r.amount)}getScale(){var r;return this.isNull()?0:Number((r=this.props)==null?void 0:r.scale)}toString(){return _e._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!==_e.DEFAULT_SCALE?this.convertScale(_e.DEFAULT_SCALE).toPrimitive():this.amount}toPrimitives(){return this.toObject()}toObject(){return{amount:this.amount,scale:this.scale}}convertScale(r){if(r<_e.MIN_SCALE||r>_e.MAX_SCALE)throw new Error(`Scale out of range: ${r}`);if(this.isNull())return new _e({amount:null,scale:r},!0,this._options);const o=Math.pow(10,this.scale),l=Number(this.amount)/o,c=Math.pow(10,r),d=Math.round(l*c);return new _e({amount:d,scale:r},!1,this._options)}hasSameScale(r){return this.scale===r.scale}increment(r){return this.isNull()?r?_e.create(r.toObject()):_e.create():r?this.hasSameScale(r)?_e.create({amount:Number(this.amount)+Number(r.amount),scale:this.scale},this._options):ke.fail(Error("No se pueden sumar cantidades con diferentes escalas.")):_e.create({amount:Number(this.amount)+1,scale:this.scale},this._options)}decrement(r){return this.isNull()?r?_e.create(r.toObject()):_e.create():r?this.hasSameScale(r)?_e.create({amount:Number(this.amount)-Number(r.amount),scale:this.scale},this._options):ke.fail(Error("No se pueden restar cantidades con diferentes escalas.")):_e.create({amount:Number(this.amount)-1,scale:this.scale},this._options)}};Se(_e,"DEFAULT_SCALE",_d),Se(_e,"MIN_SCALE",0),Se(_e,"MAX_SCALE",2);let xn=_e;const jc=2;class ab extends Tt{static create(a){const{amount:r,currencyCode:o,scale:l=jc}=a,c=Tt.create({amount:r,currencyCode:o,scale:l});if(c.isFailure)return c;const d=c.object.convertScale(jc);return ke.ok(d)}}class Zn extends B_{constructor(){super(...arguments);Se(this,"isValid",()=>!isNaN(this.props.valueOf())&&this.props.valueOf()!==0);Se(this,"isEmpty",()=>!this.isValid());Se(this,"toISO8601",()=>this.isValid()?this.props.toISOString():"");Se(this,"toDateString",()=>this.isValid()?this.props.toDateString():"");Se(this,"toLocaleDateString",(r,o)=>this.isValid()?this.props.toLocaleDateString(r,o):"");Se(this,"toLocaleTimeString",()=>this.isValid()?this.props.toLocaleTimeString():"")}static validate(r,o){const l=Pe.RULE_ALLOW_EMPTY.default(0),c=Rt.date().label(String(o.label)),d=Rt.alternatives(l,c);return Pe.validate(d,r)}static createCurrentDate(){return ke.ok(new Zn(new Date))}static create(r,o={}){const l={...o,dateFormat:o.dateFormat?o.dateFormat:"YYYY-MM-DD",label:o.label?o.label:"date"},c=Zn.validate(r,l);return c.isFailure?ke.fail(Jn(er.INVALID_INPUT_DATA,c.error.message,l)):ke.ok(new Zn(new Date(c.object)))}toString(){if(!this.isEmpty()){const r=this.props.getFullYear(),o=String(this.props.getMonth()+1).padStart(2,"0"),l=String(this.props.getDate()).padStart(2,"0");return`${r}-${o}-${l}`}return""}toPrimitive(){return this.toISO8601()}}const ob=({isPending:n,interval:a=1e3,onInterval:r})=>{const[o,l]=M.useState(void 0);return M.useEffect(()=>{let c;return n&&(c=setInterval(()=>{l(d=>d===void 0?a:d+a)},a)),()=>{clearInterval(c),l(void 0)}},[n,a]),M.useEffect(()=>{r&&o&&r(o)},[o]),{elapsedTime:o}},lb=2*60*1e3,ub=60*1e3,No=({queryKey:n,queryFn:a,enabled:r,select:o,queryOptions:l={},overtimeOptions:c})=>{const[d,h]=M.useState(!1),p=Fc({queryKey:n,queryFn:a,placeholderData:Mc,staleTime:ub,refetchInterval:lb,refetchOnWindowFocus:!0,enabled:r&&!!a,select:o,...l});M.useEffect(()=>{p.isSuccess&&eb(p.data)&&h(p.data.total_items===0)},[p]);const{elapsedTime:x}=ob({isPending:p.isFetching,interval:c==null?void 0:c.interval,onInterval:c==null?void 0:c.onInterval});return{...p,overtime:{elapsedTime:x},isEmpty:d}},bd=n=>Fc({placeholderData:Mc,...n});function cb(n){return en({...n})}/** * table-core * * Copyright (c) TanStack @@ -135,7 +135,7 @@ var P_=Object.defineProperty;var k_=(n,a,r)=>a in n?P_(n,a,{enumerable:!0,config */function db(){return{accessor:(n,a)=>typeof n=="function"?{...a,accessorFn:n}:{...a,accessorKey:n},display:n=>n,group:n=>n}}function gn(n,a){return typeof n=="function"?n(a):n}function xt(n,a){return r=>{a.setState(o=>({...o,[n]:gn(r,o[n])}))}}function rs(n){return n instanceof Function}function fb(n){return Array.isArray(n)&&n.every(a=>typeof a=="number")}function gb(n,a){const r=[],o=l=>{l.forEach(c=>{r.push(c);const d=a(c);d!=null&&d.length&&o(d)})};return o(n),r}function Z(n,a,r){let o=[],l;return c=>{let d;r.key&&r.debug&&(d=Date.now());const h=n(c);if(!(h.length!==o.length||h.some((v,R)=>o[R]!==v)))return l;o=h;let x;if(r.key&&r.debug&&(x=Date.now()),l=a(...h),r==null||r.onChange==null||r.onChange(l),r.key&&r.debug&&r!=null&&r.debug()){const v=Math.round((Date.now()-d)*100)/100,R=Math.round((Date.now()-x)*100)/100,y=R/16,b=(E,j)=>{for(E=String(E);E.length{var l;return(l=n==null?void 0:n.debugAll)!=null?l:n[a]},key:!1,onChange:o}}function mb(n,a,r,o){const l=()=>{var d;return(d=c.getValue())!=null?d:n.options.renderFallbackValue},c={id:`${a.id}_${r.id}`,row:a,column:r,getValue:()=>a.getValue(o),renderValue:l,getContext:Z(()=>[n,r,a,c],(d,h,p,x)=>({table:d,column:h,row:p,cell:x,getValue:x.getValue,renderValue:x.renderValue}),J(n.options,"debugCells"))};return n._features.forEach(d=>{d.createCell==null||d.createCell(c,r,a,n)},{}),c}function hb(n,a,r,o){var l,c;const h={...n._getDefaultColumnDef(),...a},p=h.accessorKey;let x=(l=(c=h.id)!=null?c:p?typeof String.prototype.replaceAll=="function"?p.replaceAll(".","_"):p.replace(/\./g,"_"):void 0)!=null?l:typeof h.header=="string"?h.header:void 0,v;if(h.accessorFn?v=h.accessorFn:p&&(p.includes(".")?v=y=>{let b=y;for(const j of p.split(".")){var E;b=(E=b)==null?void 0:E[j]}return b}:v=y=>y[h.accessorKey]),!x)throw new Error;let R={id:`${String(x)}`,accessorFn:v,parent:o,depth:r,columnDef:h,columns:[],getFlatColumns:Z(()=>[!0],()=>{var y;return[R,...(y=R.columns)==null?void 0:y.flatMap(b=>b.getFlatColumns())]},J(n.options,"debugColumns")),getLeafColumns:Z(()=>[n._getOrderColumnsFn()],y=>{var b;if((b=R.columns)!=null&&b.length){let E=R.columns.flatMap(j=>j.getLeafColumns());return y(E)}return[R]},J(n.options,"debugColumns"))};for(const y of n._features)y.createColumn==null||y.createColumn(R,n);return R}const Xe="debugHeaders";function Cc(n,a,r){var o;let c={id:(o=r.id)!=null?o:a.id,column:a,index:r.index,isPlaceholder:!!r.isPlaceholder,placeholderId:r.placeholderId,depth:r.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const d=[],h=p=>{p.subHeaders&&p.subHeaders.length&&p.subHeaders.map(h),d.push(p)};return h(c),d},getContext:()=>({table:n,header:c,column:a})};return n._features.forEach(d=>{d.createHeader==null||d.createHeader(c,n)}),c}const pb={createTable:n=>{n.getHeaderGroups=Z(()=>[n.getAllColumns(),n.getVisibleLeafColumns(),n.getState().columnPinning.left,n.getState().columnPinning.right],(a,r,o,l)=>{var c,d;const h=(c=o==null?void 0:o.map(R=>r.find(y=>y.id===R)).filter(Boolean))!=null?c:[],p=(d=l==null?void 0:l.map(R=>r.find(y=>y.id===R)).filter(Boolean))!=null?d:[],x=r.filter(R=>!(o!=null&&o.includes(R.id))&&!(l!=null&&l.includes(R.id)));return qi(a,[...h,...x,...p],n)},J(n.options,Xe)),n.getCenterHeaderGroups=Z(()=>[n.getAllColumns(),n.getVisibleLeafColumns(),n.getState().columnPinning.left,n.getState().columnPinning.right],(a,r,o,l)=>(r=r.filter(c=>!(o!=null&&o.includes(c.id))&&!(l!=null&&l.includes(c.id))),qi(a,r,n,"center")),J(n.options,Xe)),n.getLeftHeaderGroups=Z(()=>[n.getAllColumns(),n.getVisibleLeafColumns(),n.getState().columnPinning.left],(a,r,o)=>{var l;const c=(l=o==null?void 0:o.map(d=>r.find(h=>h.id===d)).filter(Boolean))!=null?l:[];return qi(a,c,n,"left")},J(n.options,Xe)),n.getRightHeaderGroups=Z(()=>[n.getAllColumns(),n.getVisibleLeafColumns(),n.getState().columnPinning.right],(a,r,o)=>{var l;const c=(l=o==null?void 0:o.map(d=>r.find(h=>h.id===d)).filter(Boolean))!=null?l:[];return qi(a,c,n,"right")},J(n.options,Xe)),n.getFooterGroups=Z(()=>[n.getHeaderGroups()],a=>[...a].reverse(),J(n.options,Xe)),n.getLeftFooterGroups=Z(()=>[n.getLeftHeaderGroups()],a=>[...a].reverse(),J(n.options,Xe)),n.getCenterFooterGroups=Z(()=>[n.getCenterHeaderGroups()],a=>[...a].reverse(),J(n.options,Xe)),n.getRightFooterGroups=Z(()=>[n.getRightHeaderGroups()],a=>[...a].reverse(),J(n.options,Xe)),n.getFlatHeaders=Z(()=>[n.getHeaderGroups()],a=>a.map(r=>r.headers).flat(),J(n.options,Xe)),n.getLeftFlatHeaders=Z(()=>[n.getLeftHeaderGroups()],a=>a.map(r=>r.headers).flat(),J(n.options,Xe)),n.getCenterFlatHeaders=Z(()=>[n.getCenterHeaderGroups()],a=>a.map(r=>r.headers).flat(),J(n.options,Xe)),n.getRightFlatHeaders=Z(()=>[n.getRightHeaderGroups()],a=>a.map(r=>r.headers).flat(),J(n.options,Xe)),n.getCenterLeafHeaders=Z(()=>[n.getCenterFlatHeaders()],a=>a.filter(r=>{var o;return!((o=r.subHeaders)!=null&&o.length)}),J(n.options,Xe)),n.getLeftLeafHeaders=Z(()=>[n.getLeftFlatHeaders()],a=>a.filter(r=>{var o;return!((o=r.subHeaders)!=null&&o.length)}),J(n.options,Xe)),n.getRightLeafHeaders=Z(()=>[n.getRightFlatHeaders()],a=>a.filter(r=>{var o;return!((o=r.subHeaders)!=null&&o.length)}),J(n.options,Xe)),n.getLeafHeaders=Z(()=>[n.getLeftHeaderGroups(),n.getCenterHeaderGroups(),n.getRightHeaderGroups()],(a,r,o)=>{var l,c,d,h,p,x;return[...(l=(c=a[0])==null?void 0:c.headers)!=null?l:[],...(d=(h=r[0])==null?void 0:h.headers)!=null?d:[],...(p=(x=o[0])==null?void 0:x.headers)!=null?p:[]].map(v=>v.getLeafHeaders()).flat()},J(n.options,Xe))}};function qi(n,a,r,o){var l,c;let d=0;const h=function(y,b){b===void 0&&(b=1),d=Math.max(d,b),y.filter(E=>E.getIsVisible()).forEach(E=>{var j;(j=E.columns)!=null&&j.length&&h(E.columns,b+1)},0)};h(n);let p=[];const x=(y,b)=>{const E={depth:b,id:[o,`${b}`].filter(Boolean).join("_"),headers:[]},j=[];y.forEach(D=>{const F=[...j].reverse()[0],q=D.column.depth===E.depth;let $,Q=!1;if(q&&D.column.parent?$=D.column.parent:($=D.column,Q=!0),F&&(F==null?void 0:F.column)===$)F.subHeaders.push(D);else{const O=Cc(r,$,{id:[o,b,$.id,D==null?void 0:D.id].filter(Boolean).join("_"),isPlaceholder:Q,placeholderId:Q?`${j.filter(k=>k.column===$).length}`:void 0,depth:b,index:j.length});O.subHeaders.push(D),j.push(O)}E.headers.push(D),D.headerGroup=E}),p.push(E),b>0&&x(j,b-1)},v=a.map((y,b)=>Cc(r,y,{depth:d,index:b}));x(v,d-1),p.reverse();const R=y=>y.filter(E=>E.column.getIsVisible()).map(E=>{let j=0,D=0,F=[0];E.subHeaders&&E.subHeaders.length?(F=[],R(E.subHeaders).forEach($=>{let{colSpan:Q,rowSpan:O}=$;j+=Q,F.push(O)})):j=1;const q=Math.min(...F);return D=D+q,E.colSpan=j,E.rowSpan=D,{colSpan:j,rowSpan:D}});return R((l=(c=p[0])==null?void 0:c.headers)!=null?l:[]),p}const Ro=(n,a,r,o,l,c,d)=>{let h={id:a,index:o,original:r,depth:l,parentId:d,_valuesCache:{},_uniqueValuesCache:{},getValue:p=>{if(h._valuesCache.hasOwnProperty(p))return h._valuesCache[p];const x=n.getColumn(p);if(x!=null&&x.accessorFn)return h._valuesCache[p]=x.accessorFn(h.original,o),h._valuesCache[p]},getUniqueValues:p=>{if(h._uniqueValuesCache.hasOwnProperty(p))return h._uniqueValuesCache[p];const x=n.getColumn(p);if(x!=null&&x.accessorFn)return x.columnDef.getUniqueValues?(h._uniqueValuesCache[p]=x.columnDef.getUniqueValues(h.original,o),h._uniqueValuesCache[p]):(h._uniqueValuesCache[p]=[h.getValue(p)],h._uniqueValuesCache[p])},renderValue:p=>{var x;return(x=h.getValue(p))!=null?x:n.options.renderFallbackValue},subRows:[],getLeafRows:()=>gb(h.subRows,p=>p.subRows),getParentRow:()=>h.parentId?n.getRow(h.parentId,!0):void 0,getParentRows:()=>{let p=[],x=h;for(;;){const v=x.getParentRow();if(!v)break;p.push(v),x=v}return p.reverse()},getAllCells:Z(()=>[n.getAllLeafColumns()],p=>p.map(x=>mb(n,h,x,x.id)),J(n.options,"debugRows")),_getAllCellsByColumnId:Z(()=>[h.getAllCells()],p=>p.reduce((x,v)=>(x[v.column.id]=v,x),{}),J(n.options,"debugRows"))};for(let p=0;p{n._getFacetedRowModel=a.options.getFacetedRowModel&&a.options.getFacetedRowModel(a,n.id),n.getFacetedRowModel=()=>n._getFacetedRowModel?n._getFacetedRowModel():a.getPreFilteredRowModel(),n._getFacetedUniqueValues=a.options.getFacetedUniqueValues&&a.options.getFacetedUniqueValues(a,n.id),n.getFacetedUniqueValues=()=>n._getFacetedUniqueValues?n._getFacetedUniqueValues():new Map,n._getFacetedMinMaxValues=a.options.getFacetedMinMaxValues&&a.options.getFacetedMinMaxValues(a,n.id),n.getFacetedMinMaxValues=()=>{if(n._getFacetedMinMaxValues)return n._getFacetedMinMaxValues()}}},wd=(n,a,r)=>{var o,l;const c=r==null||(o=r.toString())==null?void 0:o.toLowerCase();return!!(!((l=n.getValue(a))==null||(l=l.toString())==null||(l=l.toLowerCase())==null)&&l.includes(c))};wd.autoRemove=n=>Lt(n);const Sd=(n,a,r)=>{var o;return!!(!((o=n.getValue(a))==null||(o=o.toString())==null)&&o.includes(r))};Sd.autoRemove=n=>Lt(n);const jd=(n,a,r)=>{var o;return((o=n.getValue(a))==null||(o=o.toString())==null?void 0:o.toLowerCase())===(r==null?void 0:r.toLowerCase())};jd.autoRemove=n=>Lt(n);const Cd=(n,a,r)=>{var o;return(o=n.getValue(a))==null?void 0:o.includes(r)};Cd.autoRemove=n=>Lt(n);const yd=(n,a,r)=>!r.some(o=>{var l;return!((l=n.getValue(a))!=null&&l.includes(o))});yd.autoRemove=n=>Lt(n)||!(n!=null&&n.length);const Nd=(n,a,r)=>r.some(o=>{var l;return(l=n.getValue(a))==null?void 0:l.includes(o)});Nd.autoRemove=n=>Lt(n)||!(n!=null&&n.length);const Rd=(n,a,r)=>n.getValue(a)===r;Rd.autoRemove=n=>Lt(n);const Ed=(n,a,r)=>n.getValue(a)==r;Ed.autoRemove=n=>Lt(n);const Eo=(n,a,r)=>{let[o,l]=r;const c=n.getValue(a);return c>=o&&c<=l};Eo.resolveFilterValue=n=>{let[a,r]=n,o=typeof a!="number"?parseFloat(a):a,l=typeof r!="number"?parseFloat(r):r,c=a===null||Number.isNaN(o)?-1/0:o,d=r===null||Number.isNaN(l)?1/0:l;if(c>d){const h=c;c=d,d=h}return[c,d]};Eo.autoRemove=n=>Lt(n)||Lt(n[0])&&Lt(n[1]);const Zt={includesString:wd,includesStringSensitive:Sd,equalsString:jd,arrIncludes:Cd,arrIncludesAll:yd,arrIncludesSome:Nd,equals:Rd,weakEquals:Ed,inNumberRange:Eo};function Lt(n){return n==null||n===""}const vb={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:n=>({columnFilters:[],...n}),getDefaultOptions:n=>({onColumnFiltersChange:xt("columnFilters",n),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(n,a)=>{n.getAutoFilterFn=()=>{const r=a.getCoreRowModel().flatRows[0],o=r==null?void 0:r.getValue(n.id);return typeof o=="string"?Zt.includesString:typeof o=="number"?Zt.inNumberRange:typeof o=="boolean"||o!==null&&typeof o=="object"?Zt.equals:Array.isArray(o)?Zt.arrIncludes:Zt.weakEquals},n.getFilterFn=()=>{var r,o;return rs(n.columnDef.filterFn)?n.columnDef.filterFn:n.columnDef.filterFn==="auto"?n.getAutoFilterFn():(r=(o=a.options.filterFns)==null?void 0:o[n.columnDef.filterFn])!=null?r:Zt[n.columnDef.filterFn]},n.getCanFilter=()=>{var r,o,l;return((r=n.columnDef.enableColumnFilter)!=null?r:!0)&&((o=a.options.enableColumnFilters)!=null?o:!0)&&((l=a.options.enableFilters)!=null?l:!0)&&!!n.accessorFn},n.getIsFiltered=()=>n.getFilterIndex()>-1,n.getFilterValue=()=>{var r;return(r=a.getState().columnFilters)==null||(r=r.find(o=>o.id===n.id))==null?void 0:r.value},n.getFilterIndex=()=>{var r,o;return(r=(o=a.getState().columnFilters)==null?void 0:o.findIndex(l=>l.id===n.id))!=null?r:-1},n.setFilterValue=r=>{a.setColumnFilters(o=>{const l=n.getFilterFn(),c=o==null?void 0:o.find(v=>v.id===n.id),d=gn(r,c?c.value:void 0);if(yc(l,d,n)){var h;return(h=o==null?void 0:o.filter(v=>v.id!==n.id))!=null?h:[]}const p={id:n.id,value:d};if(c){var x;return(x=o==null?void 0:o.map(v=>v.id===n.id?p:v))!=null?x:[]}return o!=null&&o.length?[...o,p]:[p]})}},createRow:(n,a)=>{n.columnFilters={},n.columnFiltersMeta={}},createTable:n=>{n.setColumnFilters=a=>{const r=n.getAllLeafColumns(),o=l=>{var c;return(c=gn(a,l))==null?void 0:c.filter(d=>{const h=r.find(p=>p.id===d.id);if(h){const p=h.getFilterFn();if(yc(p,d.value,h))return!1}return!0})};n.options.onColumnFiltersChange==null||n.options.onColumnFiltersChange(o)},n.resetColumnFilters=a=>{var r,o;n.setColumnFilters(a?[]:(r=(o=n.initialState)==null?void 0:o.columnFilters)!=null?r:[])},n.getPreFilteredRowModel=()=>n.getCoreRowModel(),n.getFilteredRowModel=()=>(!n._getFilteredRowModel&&n.options.getFilteredRowModel&&(n._getFilteredRowModel=n.options.getFilteredRowModel(n)),n.options.manualFiltering||!n._getFilteredRowModel?n.getPreFilteredRowModel():n._getFilteredRowModel())}};function yc(n,a,r){return(n&&n.autoRemove?n.autoRemove(a,r):!1)||typeof a>"u"||typeof a=="string"&&!a}const _b=(n,a,r)=>r.reduce((o,l)=>{const c=l.getValue(n);return o+(typeof c=="number"?c:0)},0),bb=(n,a,r)=>{let o;return r.forEach(l=>{const c=l.getValue(n);c!=null&&(o>c||o===void 0&&c>=c)&&(o=c)}),o},wb=(n,a,r)=>{let o;return r.forEach(l=>{const c=l.getValue(n);c!=null&&(o=c)&&(o=c)}),o},Sb=(n,a,r)=>{let o,l;return r.forEach(c=>{const d=c.getValue(n);d!=null&&(o===void 0?d>=d&&(o=l=d):(o>d&&(o=d),l{let r=0,o=0;if(a.forEach(l=>{let c=l.getValue(n);c!=null&&(c=+c)>=c&&(++r,o+=c)}),r)return o/r},Cb=(n,a)=>{if(!a.length)return;const r=a.map(c=>c.getValue(n));if(!fb(r))return;if(r.length===1)return r[0];const o=Math.floor(r.length/2),l=r.sort((c,d)=>c-d);return r.length%2!==0?l[o]:(l[o-1]+l[o])/2},yb=(n,a)=>Array.from(new Set(a.map(r=>r.getValue(n))).values()),Nb=(n,a)=>new Set(a.map(r=>r.getValue(n))).size,Rb=(n,a)=>a.length,Oa={sum:_b,min:bb,max:wb,extent:Sb,mean:jb,median:Cb,unique:yb,uniqueCount:Nb,count:Rb},Eb={getDefaultColumnDef:()=>({aggregatedCell:n=>{var a,r;return(a=(r=n.getValue())==null||r.toString==null?void 0:r.toString())!=null?a:null},aggregationFn:"auto"}),getInitialState:n=>({grouping:[],...n}),getDefaultOptions:n=>({onGroupingChange:xt("grouping",n),groupedColumnMode:"reorder"}),createColumn:(n,a)=>{n.toggleGrouping=()=>{a.setGrouping(r=>r!=null&&r.includes(n.id)?r.filter(o=>o!==n.id):[...r??[],n.id])},n.getCanGroup=()=>{var r,o;return((r=n.columnDef.enableGrouping)!=null?r:!0)&&((o=a.options.enableGrouping)!=null?o:!0)&&(!!n.accessorFn||!!n.columnDef.getGroupingValue)},n.getIsGrouped=()=>{var r;return(r=a.getState().grouping)==null?void 0:r.includes(n.id)},n.getGroupedIndex=()=>{var r;return(r=a.getState().grouping)==null?void 0:r.indexOf(n.id)},n.getToggleGroupingHandler=()=>{const r=n.getCanGroup();return()=>{r&&n.toggleGrouping()}},n.getAutoAggregationFn=()=>{const r=a.getCoreRowModel().flatRows[0],o=r==null?void 0:r.getValue(n.id);if(typeof o=="number")return Oa.sum;if(Object.prototype.toString.call(o)==="[object Date]")return Oa.extent},n.getAggregationFn=()=>{var r,o;if(!n)throw new Error;return rs(n.columnDef.aggregationFn)?n.columnDef.aggregationFn:n.columnDef.aggregationFn==="auto"?n.getAutoAggregationFn():(r=(o=a.options.aggregationFns)==null?void 0:o[n.columnDef.aggregationFn])!=null?r:Oa[n.columnDef.aggregationFn]}},createTable:n=>{n.setGrouping=a=>n.options.onGroupingChange==null?void 0:n.options.onGroupingChange(a),n.resetGrouping=a=>{var r,o;n.setGrouping(a?[]:(r=(o=n.initialState)==null?void 0:o.grouping)!=null?r:[])},n.getPreGroupedRowModel=()=>n.getFilteredRowModel(),n.getGroupedRowModel=()=>(!n._getGroupedRowModel&&n.options.getGroupedRowModel&&(n._getGroupedRowModel=n.options.getGroupedRowModel(n)),n.options.manualGrouping||!n._getGroupedRowModel?n.getPreGroupedRowModel():n._getGroupedRowModel())},createRow:(n,a)=>{n.getIsGrouped=()=>!!n.groupingColumnId,n.getGroupingValue=r=>{if(n._groupingValuesCache.hasOwnProperty(r))return n._groupingValuesCache[r];const o=a.getColumn(r);return o!=null&&o.columnDef.getGroupingValue?(n._groupingValuesCache[r]=o.columnDef.getGroupingValue(n.original),n._groupingValuesCache[r]):n.getValue(r)},n._groupingValuesCache={}},createCell:(n,a,r,o)=>{n.getIsGrouped=()=>a.getIsGrouped()&&a.id===r.groupingColumnId,n.getIsPlaceholder=()=>!n.getIsGrouped()&&a.getIsGrouped(),n.getIsAggregated=()=>{var l;return!n.getIsGrouped()&&!n.getIsPlaceholder()&&!!((l=r.subRows)!=null&&l.length)}}};function Ab(n,a,r){if(!(a!=null&&a.length)||!r)return n;const o=n.filter(c=>!a.includes(c.id));return r==="remove"?o:[...a.map(c=>n.find(d=>d.id===c)).filter(Boolean),...o]}const Ib={getInitialState:n=>({columnOrder:[],...n}),getDefaultOptions:n=>({onColumnOrderChange:xt("columnOrder",n)}),createColumn:(n,a)=>{n.getIndex=Z(r=>[kr(a,r)],r=>r.findIndex(o=>o.id===n.id),J(a.options,"debugColumns")),n.getIsFirstColumn=r=>{var o;return((o=kr(a,r)[0])==null?void 0:o.id)===n.id},n.getIsLastColumn=r=>{var o;const l=kr(a,r);return((o=l[l.length-1])==null?void 0:o.id)===n.id}},createTable:n=>{n.setColumnOrder=a=>n.options.onColumnOrderChange==null?void 0:n.options.onColumnOrderChange(a),n.resetColumnOrder=a=>{var r;n.setColumnOrder(a?[]:(r=n.initialState.columnOrder)!=null?r:[])},n._getOrderColumnsFn=Z(()=>[n.getState().columnOrder,n.getState().grouping,n.options.groupedColumnMode],(a,r,o)=>l=>{let c=[];if(!(a!=null&&a.length))c=l;else{const d=[...a],h=[...l];for(;h.length&&d.length;){const p=d.shift(),x=h.findIndex(v=>v.id===p);x>-1&&c.push(h.splice(x,1)[0])}c=[...c,...h]}return Ab(c,r,o)},J(n.options,"debugTable"))}},Pa=()=>({left:[],right:[]}),Fb={getInitialState:n=>({columnPinning:Pa(),...n}),getDefaultOptions:n=>({onColumnPinningChange:xt("columnPinning",n)}),createColumn:(n,a)=>{n.pin=r=>{const o=n.getLeafColumns().map(l=>l.id).filter(Boolean);a.setColumnPinning(l=>{var c,d;if(r==="right"){var h,p;return{left:((h=l==null?void 0:l.left)!=null?h:[]).filter(R=>!(o!=null&&o.includes(R))),right:[...((p=l==null?void 0:l.right)!=null?p:[]).filter(R=>!(o!=null&&o.includes(R))),...o]}}if(r==="left"){var x,v;return{left:[...((x=l==null?void 0:l.left)!=null?x:[]).filter(R=>!(o!=null&&o.includes(R))),...o],right:((v=l==null?void 0:l.right)!=null?v:[]).filter(R=>!(o!=null&&o.includes(R)))}}return{left:((c=l==null?void 0:l.left)!=null?c:[]).filter(R=>!(o!=null&&o.includes(R))),right:((d=l==null?void 0:l.right)!=null?d:[]).filter(R=>!(o!=null&&o.includes(R)))}})},n.getCanPin=()=>n.getLeafColumns().some(o=>{var l,c,d;return((l=o.columnDef.enablePinning)!=null?l:!0)&&((c=(d=a.options.enableColumnPinning)!=null?d:a.options.enablePinning)!=null?c:!0)}),n.getIsPinned=()=>{const r=n.getLeafColumns().map(h=>h.id),{left:o,right:l}=a.getState().columnPinning,c=r.some(h=>o==null?void 0:o.includes(h)),d=r.some(h=>l==null?void 0:l.includes(h));return c?"left":d?"right":!1},n.getPinnedIndex=()=>{var r,o;const l=n.getIsPinned();return l?(r=(o=a.getState().columnPinning)==null||(o=o[l])==null?void 0:o.indexOf(n.id))!=null?r:-1:0}},createRow:(n,a)=>{n.getCenterVisibleCells=Z(()=>[n._getAllVisibleCells(),a.getState().columnPinning.left,a.getState().columnPinning.right],(r,o,l)=>{const c=[...o??[],...l??[]];return r.filter(d=>!c.includes(d.column.id))},J(a.options,"debugRows")),n.getLeftVisibleCells=Z(()=>[n._getAllVisibleCells(),a.getState().columnPinning.left],(r,o)=>(o??[]).map(c=>r.find(d=>d.column.id===c)).filter(Boolean).map(c=>({...c,position:"left"})),J(a.options,"debugRows")),n.getRightVisibleCells=Z(()=>[n._getAllVisibleCells(),a.getState().columnPinning.right],(r,o)=>(o??[]).map(c=>r.find(d=>d.column.id===c)).filter(Boolean).map(c=>({...c,position:"right"})),J(a.options,"debugRows"))},createTable:n=>{n.setColumnPinning=a=>n.options.onColumnPinningChange==null?void 0:n.options.onColumnPinningChange(a),n.resetColumnPinning=a=>{var r,o;return n.setColumnPinning(a?Pa():(r=(o=n.initialState)==null?void 0:o.columnPinning)!=null?r:Pa())},n.getIsSomeColumnsPinned=a=>{var r;const o=n.getState().columnPinning;if(!a){var l,c;return!!((l=o.left)!=null&&l.length||(c=o.right)!=null&&c.length)}return!!((r=o[a])!=null&&r.length)},n.getLeftLeafColumns=Z(()=>[n.getAllLeafColumns(),n.getState().columnPinning.left],(a,r)=>(r??[]).map(o=>a.find(l=>l.id===o)).filter(Boolean),J(n.options,"debugColumns")),n.getRightLeafColumns=Z(()=>[n.getAllLeafColumns(),n.getState().columnPinning.right],(a,r)=>(r??[]).map(o=>a.find(l=>l.id===o)).filter(Boolean),J(n.options,"debugColumns")),n.getCenterLeafColumns=Z(()=>[n.getAllLeafColumns(),n.getState().columnPinning.left,n.getState().columnPinning.right],(a,r,o)=>{const l=[...r??[],...o??[]];return a.filter(c=>!l.includes(c.id))},J(n.options,"debugColumns"))}},$i={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},ka=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),Mb={getDefaultColumnDef:()=>$i,getInitialState:n=>({columnSizing:{},columnSizingInfo:ka(),...n}),getDefaultOptions:n=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:xt("columnSizing",n),onColumnSizingInfoChange:xt("columnSizingInfo",n)}),createColumn:(n,a)=>{n.getSize=()=>{var r,o,l;const c=a.getState().columnSizing[n.id];return Math.min(Math.max((r=n.columnDef.minSize)!=null?r:$i.minSize,(o=c??n.columnDef.size)!=null?o:$i.size),(l=n.columnDef.maxSize)!=null?l:$i.maxSize)},n.getStart=Z(r=>[r,kr(a,r),a.getState().columnSizing],(r,o)=>o.slice(0,n.getIndex(r)).reduce((l,c)=>l+c.getSize(),0),J(a.options,"debugColumns")),n.getAfter=Z(r=>[r,kr(a,r),a.getState().columnSizing],(r,o)=>o.slice(n.getIndex(r)+1).reduce((l,c)=>l+c.getSize(),0),J(a.options,"debugColumns")),n.resetSize=()=>{a.setColumnSizing(r=>{let{[n.id]:o,...l}=r;return l})},n.getCanResize=()=>{var r,o;return((r=n.columnDef.enableResizing)!=null?r:!0)&&((o=a.options.enableColumnResizing)!=null?o:!0)},n.getIsResizing=()=>a.getState().columnSizingInfo.isResizingColumn===n.id},createHeader:(n,a)=>{n.getSize=()=>{let r=0;const o=l=>{if(l.subHeaders.length)l.subHeaders.forEach(o);else{var c;r+=(c=l.column.getSize())!=null?c:0}};return o(n),r},n.getStart=()=>{if(n.index>0){const r=n.headerGroup.headers[n.index-1];return r.getStart()+r.getSize()}return 0},n.getResizeHandler=r=>{const o=a.getColumn(n.column.id),l=o==null?void 0:o.getCanResize();return c=>{if(!o||!l||(c.persist==null||c.persist(),qa(c)&&c.touches&&c.touches.length>1))return;const d=n.getSize(),h=n?n.getLeafHeaders().map(F=>[F.column.id,F.column.getSize()]):[[o.id,o.getSize()]],p=qa(c)?Math.round(c.touches[0].clientX):c.clientX,x={},v=(F,q)=>{typeof q=="number"&&(a.setColumnSizingInfo($=>{var Q,O;const k=a.options.columnResizeDirection==="rtl"?-1:1,H=(q-((Q=$==null?void 0:$.startOffset)!=null?Q:0))*k,W=Math.max(H/((O=$==null?void 0:$.startSize)!=null?O:0),-.999999);return $.columnSizingStart.forEach(B=>{let[se,ce]=B;x[se]=Math.round(Math.max(ce+ce*W,0)*100)/100}),{...$,deltaOffset:H,deltaPercentage:W}}),(a.options.columnResizeMode==="onChange"||F==="end")&&a.setColumnSizing($=>({...$,...x})))},R=F=>v("move",F),y=F=>{v("end",F),a.setColumnSizingInfo(q=>({...q,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},b=r||typeof document<"u"?document:null,E={moveHandler:F=>R(F.clientX),upHandler:F=>{b==null||b.removeEventListener("mousemove",E.moveHandler),b==null||b.removeEventListener("mouseup",E.upHandler),y(F.clientX)}},j={moveHandler:F=>(F.cancelable&&(F.preventDefault(),F.stopPropagation()),R(F.touches[0].clientX),!1),upHandler:F=>{var q;b==null||b.removeEventListener("touchmove",j.moveHandler),b==null||b.removeEventListener("touchend",j.upHandler),F.cancelable&&(F.preventDefault(),F.stopPropagation()),y((q=F.touches[0])==null?void 0:q.clientX)}},D=Db()?{passive:!1}:!1;qa(c)?(b==null||b.addEventListener("touchmove",j.moveHandler,D),b==null||b.addEventListener("touchend",j.upHandler,D)):(b==null||b.addEventListener("mousemove",E.moveHandler,D),b==null||b.addEventListener("mouseup",E.upHandler,D)),a.setColumnSizingInfo(F=>({...F,startOffset:p,startSize:d,deltaOffset:0,deltaPercentage:0,columnSizingStart:h,isResizingColumn:o.id}))}}},createTable:n=>{n.setColumnSizing=a=>n.options.onColumnSizingChange==null?void 0:n.options.onColumnSizingChange(a),n.setColumnSizingInfo=a=>n.options.onColumnSizingInfoChange==null?void 0:n.options.onColumnSizingInfoChange(a),n.resetColumnSizing=a=>{var r;n.setColumnSizing(a?{}:(r=n.initialState.columnSizing)!=null?r:{})},n.resetHeaderSizeInfo=a=>{var r;n.setColumnSizingInfo(a?ka():(r=n.initialState.columnSizingInfo)!=null?r:ka())},n.getTotalSize=()=>{var a,r;return(a=(r=n.getHeaderGroups()[0])==null?void 0:r.headers.reduce((o,l)=>o+l.getSize(),0))!=null?a:0},n.getLeftTotalSize=()=>{var a,r;return(a=(r=n.getLeftHeaderGroups()[0])==null?void 0:r.headers.reduce((o,l)=>o+l.getSize(),0))!=null?a:0},n.getCenterTotalSize=()=>{var a,r;return(a=(r=n.getCenterHeaderGroups()[0])==null?void 0:r.headers.reduce((o,l)=>o+l.getSize(),0))!=null?a:0},n.getRightTotalSize=()=>{var a,r;return(a=(r=n.getRightHeaderGroups()[0])==null?void 0:r.headers.reduce((o,l)=>o+l.getSize(),0))!=null?a:0}}};let zi=null;function Db(){if(typeof zi=="boolean")return zi;let n=!1;try{const a={get passive(){return n=!0,!1}},r=()=>{};window.addEventListener("test",r,a),window.removeEventListener("test",r)}catch{n=!1}return zi=n,zi}function qa(n){return n.type==="touchstart"}const Tb={getInitialState:n=>({columnVisibility:{},...n}),getDefaultOptions:n=>({onColumnVisibilityChange:xt("columnVisibility",n)}),createColumn:(n,a)=>{n.toggleVisibility=r=>{n.getCanHide()&&a.setColumnVisibility(o=>({...o,[n.id]:r??!n.getIsVisible()}))},n.getIsVisible=()=>{var r,o;const l=n.columns;return(r=l.length?l.some(c=>c.getIsVisible()):(o=a.getState().columnVisibility)==null?void 0:o[n.id])!=null?r:!0},n.getCanHide=()=>{var r,o;return((r=n.columnDef.enableHiding)!=null?r:!0)&&((o=a.options.enableHiding)!=null?o:!0)},n.getToggleVisibilityHandler=()=>r=>{n.toggleVisibility==null||n.toggleVisibility(r.target.checked)}},createRow:(n,a)=>{n._getAllVisibleCells=Z(()=>[n.getAllCells(),a.getState().columnVisibility],r=>r.filter(o=>o.column.getIsVisible()),J(a.options,"debugRows")),n.getVisibleCells=Z(()=>[n.getLeftVisibleCells(),n.getCenterVisibleCells(),n.getRightVisibleCells()],(r,o,l)=>[...r,...o,...l],J(a.options,"debugRows"))},createTable:n=>{const a=(r,o)=>Z(()=>[o(),o().filter(l=>l.getIsVisible()).map(l=>l.id).join("_")],l=>l.filter(c=>c.getIsVisible==null?void 0:c.getIsVisible()),J(n.options,"debugColumns"));n.getVisibleFlatColumns=a("getVisibleFlatColumns",()=>n.getAllFlatColumns()),n.getVisibleLeafColumns=a("getVisibleLeafColumns",()=>n.getAllLeafColumns()),n.getLeftVisibleLeafColumns=a("getLeftVisibleLeafColumns",()=>n.getLeftLeafColumns()),n.getRightVisibleLeafColumns=a("getRightVisibleLeafColumns",()=>n.getRightLeafColumns()),n.getCenterVisibleLeafColumns=a("getCenterVisibleLeafColumns",()=>n.getCenterLeafColumns()),n.setColumnVisibility=r=>n.options.onColumnVisibilityChange==null?void 0:n.options.onColumnVisibilityChange(r),n.resetColumnVisibility=r=>{var o;n.setColumnVisibility(r?{}:(o=n.initialState.columnVisibility)!=null?o:{})},n.toggleAllColumnsVisible=r=>{var o;r=(o=r)!=null?o:!n.getIsAllColumnsVisible(),n.setColumnVisibility(n.getAllLeafColumns().reduce((l,c)=>({...l,[c.id]:r||!(c.getCanHide!=null&&c.getCanHide())}),{}))},n.getIsAllColumnsVisible=()=>!n.getAllLeafColumns().some(r=>!(r.getIsVisible!=null&&r.getIsVisible())),n.getIsSomeColumnsVisible=()=>n.getAllLeafColumns().some(r=>r.getIsVisible==null?void 0:r.getIsVisible()),n.getToggleAllColumnsVisibilityHandler=()=>r=>{var o;n.toggleAllColumnsVisible((o=r.target)==null?void 0:o.checked)}}};function kr(n,a){return a?a==="center"?n.getCenterVisibleLeafColumns():a==="left"?n.getLeftVisibleLeafColumns():n.getRightVisibleLeafColumns():n.getVisibleLeafColumns()}const Lb={createTable:n=>{n._getGlobalFacetedRowModel=n.options.getFacetedRowModel&&n.options.getFacetedRowModel(n,"__global__"),n.getGlobalFacetedRowModel=()=>n.options.manualFiltering||!n._getGlobalFacetedRowModel?n.getPreFilteredRowModel():n._getGlobalFacetedRowModel(),n._getGlobalFacetedUniqueValues=n.options.getFacetedUniqueValues&&n.options.getFacetedUniqueValues(n,"__global__"),n.getGlobalFacetedUniqueValues=()=>n._getGlobalFacetedUniqueValues?n._getGlobalFacetedUniqueValues():new Map,n._getGlobalFacetedMinMaxValues=n.options.getFacetedMinMaxValues&&n.options.getFacetedMinMaxValues(n,"__global__"),n.getGlobalFacetedMinMaxValues=()=>{if(n._getGlobalFacetedMinMaxValues)return n._getGlobalFacetedMinMaxValues()}}},Ob={getInitialState:n=>({globalFilter:void 0,...n}),getDefaultOptions:n=>({onGlobalFilterChange:xt("globalFilter",n),globalFilterFn:"auto",getColumnCanGlobalFilter:a=>{var r;const o=(r=n.getCoreRowModel().flatRows[0])==null||(r=r._getAllCellsByColumnId()[a.id])==null?void 0:r.getValue();return typeof o=="string"||typeof o=="number"}}),createColumn:(n,a)=>{n.getCanGlobalFilter=()=>{var r,o,l,c;return((r=n.columnDef.enableGlobalFilter)!=null?r:!0)&&((o=a.options.enableGlobalFilter)!=null?o:!0)&&((l=a.options.enableFilters)!=null?l:!0)&&((c=a.options.getColumnCanGlobalFilter==null?void 0:a.options.getColumnCanGlobalFilter(n))!=null?c:!0)&&!!n.accessorFn}},createTable:n=>{n.getGlobalAutoFilterFn=()=>Zt.includesString,n.getGlobalFilterFn=()=>{var a,r;const{globalFilterFn:o}=n.options;return rs(o)?o:o==="auto"?n.getGlobalAutoFilterFn():(a=(r=n.options.filterFns)==null?void 0:r[o])!=null?a:Zt[o]},n.setGlobalFilter=a=>{n.options.onGlobalFilterChange==null||n.options.onGlobalFilterChange(a)},n.resetGlobalFilter=a=>{n.setGlobalFilter(a?void 0:n.initialState.globalFilter)}}},Pb={getInitialState:n=>({expanded:{},...n}),getDefaultOptions:n=>({onExpandedChange:xt("expanded",n),paginateExpandedRows:!0}),createTable:n=>{let a=!1,r=!1;n._autoResetExpanded=()=>{var o,l;if(!a){n._queue(()=>{a=!0});return}if((o=(l=n.options.autoResetAll)!=null?l:n.options.autoResetExpanded)!=null?o:!n.options.manualExpanding){if(r)return;r=!0,n._queue(()=>{n.resetExpanded(),r=!1})}},n.setExpanded=o=>n.options.onExpandedChange==null?void 0:n.options.onExpandedChange(o),n.toggleAllRowsExpanded=o=>{o??!n.getIsAllRowsExpanded()?n.setExpanded(!0):n.setExpanded({})},n.resetExpanded=o=>{var l,c;n.setExpanded(o?{}:(l=(c=n.initialState)==null?void 0:c.expanded)!=null?l:{})},n.getCanSomeRowsExpand=()=>n.getPrePaginationRowModel().flatRows.some(o=>o.getCanExpand()),n.getToggleAllRowsExpandedHandler=()=>o=>{o.persist==null||o.persist(),n.toggleAllRowsExpanded()},n.getIsSomeRowsExpanded=()=>{const o=n.getState().expanded;return o===!0||Object.values(o).some(Boolean)},n.getIsAllRowsExpanded=()=>{const o=n.getState().expanded;return typeof o=="boolean"?o===!0:!(!Object.keys(o).length||n.getRowModel().flatRows.some(l=>!l.getIsExpanded()))},n.getExpandedDepth=()=>{let o=0;return(n.getState().expanded===!0?Object.keys(n.getRowModel().rowsById):Object.keys(n.getState().expanded)).forEach(c=>{const d=c.split(".");o=Math.max(o,d.length)}),o},n.getPreExpandedRowModel=()=>n.getSortedRowModel(),n.getExpandedRowModel=()=>(!n._getExpandedRowModel&&n.options.getExpandedRowModel&&(n._getExpandedRowModel=n.options.getExpandedRowModel(n)),n.options.manualExpanding||!n._getExpandedRowModel?n.getPreExpandedRowModel():n._getExpandedRowModel())},createRow:(n,a)=>{n.toggleExpanded=r=>{a.setExpanded(o=>{var l;const c=o===!0?!0:!!(o!=null&&o[n.id]);let d={};if(o===!0?Object.keys(a.getRowModel().rowsById).forEach(h=>{d[h]=!0}):d=o,r=(l=r)!=null?l:!c,!c&&r)return{...d,[n.id]:!0};if(c&&!r){const{[n.id]:h,...p}=d;return p}return o})},n.getIsExpanded=()=>{var r;const o=a.getState().expanded;return!!((r=a.options.getIsRowExpanded==null?void 0:a.options.getIsRowExpanded(n))!=null?r:o===!0||o!=null&&o[n.id])},n.getCanExpand=()=>{var r,o,l;return(r=a.options.getRowCanExpand==null?void 0:a.options.getRowCanExpand(n))!=null?r:((o=a.options.enableExpanding)!=null?o:!0)&&!!((l=n.subRows)!=null&&l.length)},n.getIsAllParentsExpanded=()=>{let r=!0,o=n;for(;r&&o.parentId;)o=a.getRow(o.parentId,!0),r=o.getIsExpanded();return r},n.getToggleExpandedHandler=()=>{const r=n.getCanExpand();return()=>{r&&n.toggleExpanded()}}}},Ya=0,Qa=10,$a=()=>({pageIndex:Ya,pageSize:Qa}),kb={getInitialState:n=>({...n,pagination:{...$a(),...n==null?void 0:n.pagination}}),getDefaultOptions:n=>({onPaginationChange:xt("pagination",n)}),createTable:n=>{let a=!1,r=!1;n._autoResetPageIndex=()=>{var o,l;if(!a){n._queue(()=>{a=!0});return}if((o=(l=n.options.autoResetAll)!=null?l:n.options.autoResetPageIndex)!=null?o:!n.options.manualPagination){if(r)return;r=!0,n._queue(()=>{n.resetPageIndex(),r=!1})}},n.setPagination=o=>{const l=c=>gn(o,c);return n.options.onPaginationChange==null?void 0:n.options.onPaginationChange(l)},n.resetPagination=o=>{var l;n.setPagination(o?$a():(l=n.initialState.pagination)!=null?l:$a())},n.setPageIndex=o=>{n.setPagination(l=>{let c=gn(o,l.pageIndex);const d=typeof n.options.pageCount>"u"||n.options.pageCount===-1?Number.MAX_SAFE_INTEGER:n.options.pageCount-1;return c=Math.max(0,Math.min(c,d)),{...l,pageIndex:c}})},n.resetPageIndex=o=>{var l,c;n.setPageIndex(o?Ya:(l=(c=n.initialState)==null||(c=c.pagination)==null?void 0:c.pageIndex)!=null?l:Ya)},n.resetPageSize=o=>{var l,c;n.setPageSize(o?Qa:(l=(c=n.initialState)==null||(c=c.pagination)==null?void 0:c.pageSize)!=null?l:Qa)},n.setPageSize=o=>{n.setPagination(l=>{const c=Math.max(1,gn(o,l.pageSize)),d=l.pageSize*l.pageIndex,h=Math.floor(d/c);return{...l,pageIndex:h,pageSize:c}})},n.setPageCount=o=>n.setPagination(l=>{var c;let d=gn(o,(c=n.options.pageCount)!=null?c:-1);return typeof d=="number"&&(d=Math.max(-1,d)),{...l,pageCount:d}}),n.getPageOptions=Z(()=>[n.getPageCount()],o=>{let l=[];return o&&o>0&&(l=[...new Array(o)].fill(null).map((c,d)=>d)),l},J(n.options,"debugTable")),n.getCanPreviousPage=()=>n.getState().pagination.pageIndex>0,n.getCanNextPage=()=>{const{pageIndex:o}=n.getState().pagination,l=n.getPageCount();return l===-1?!0:l===0?!1:on.setPageIndex(o=>o-1),n.nextPage=()=>n.setPageIndex(o=>o+1),n.firstPage=()=>n.setPageIndex(0),n.lastPage=()=>n.setPageIndex(n.getPageCount()-1),n.getPrePaginationRowModel=()=>n.getExpandedRowModel(),n.getPaginationRowModel=()=>(!n._getPaginationRowModel&&n.options.getPaginationRowModel&&(n._getPaginationRowModel=n.options.getPaginationRowModel(n)),n.options.manualPagination||!n._getPaginationRowModel?n.getPrePaginationRowModel():n._getPaginationRowModel()),n.getPageCount=()=>{var o;return(o=n.options.pageCount)!=null?o:Math.ceil(n.getRowCount()/n.getState().pagination.pageSize)},n.getRowCount=()=>{var o;return(o=n.options.rowCount)!=null?o:n.getPrePaginationRowModel().rows.length}}},za=()=>({top:[],bottom:[]}),qb={getInitialState:n=>({rowPinning:za(),...n}),getDefaultOptions:n=>({onRowPinningChange:xt("rowPinning",n)}),createRow:(n,a)=>{n.pin=(r,o,l)=>{const c=o?n.getLeafRows().map(p=>{let{id:x}=p;return x}):[],d=l?n.getParentRows().map(p=>{let{id:x}=p;return x}):[],h=new Set([...d,n.id,...c]);a.setRowPinning(p=>{var x,v;if(r==="bottom"){var R,y;return{top:((R=p==null?void 0:p.top)!=null?R:[]).filter(j=>!(h!=null&&h.has(j))),bottom:[...((y=p==null?void 0:p.bottom)!=null?y:[]).filter(j=>!(h!=null&&h.has(j))),...Array.from(h)]}}if(r==="top"){var b,E;return{top:[...((b=p==null?void 0:p.top)!=null?b:[]).filter(j=>!(h!=null&&h.has(j))),...Array.from(h)],bottom:((E=p==null?void 0:p.bottom)!=null?E:[]).filter(j=>!(h!=null&&h.has(j)))}}return{top:((x=p==null?void 0:p.top)!=null?x:[]).filter(j=>!(h!=null&&h.has(j))),bottom:((v=p==null?void 0:p.bottom)!=null?v:[]).filter(j=>!(h!=null&&h.has(j)))}})},n.getCanPin=()=>{var r;const{enableRowPinning:o,enablePinning:l}=a.options;return typeof o=="function"?o(n):(r=o??l)!=null?r:!0},n.getIsPinned=()=>{const r=[n.id],{top:o,bottom:l}=a.getState().rowPinning,c=r.some(h=>o==null?void 0:o.includes(h)),d=r.some(h=>l==null?void 0:l.includes(h));return c?"top":d?"bottom":!1},n.getPinnedIndex=()=>{var r,o;const l=n.getIsPinned();if(!l)return-1;const c=(r=l==="top"?a.getTopRows():a.getBottomRows())==null?void 0:r.map(d=>{let{id:h}=d;return h});return(o=c==null?void 0:c.indexOf(n.id))!=null?o:-1}},createTable:n=>{n.setRowPinning=a=>n.options.onRowPinningChange==null?void 0:n.options.onRowPinningChange(a),n.resetRowPinning=a=>{var r,o;return n.setRowPinning(a?za():(r=(o=n.initialState)==null?void 0:o.rowPinning)!=null?r:za())},n.getIsSomeRowsPinned=a=>{var r;const o=n.getState().rowPinning;if(!a){var l,c;return!!((l=o.top)!=null&&l.length||(c=o.bottom)!=null&&c.length)}return!!((r=o[a])!=null&&r.length)},n._getPinnedRows=(a,r,o)=>{var l;return((l=n.options.keepPinnedRows)==null||l?(r??[]).map(d=>{const h=n.getRow(d,!0);return h.getIsAllParentsExpanded()?h:null}):(r??[]).map(d=>a.find(h=>h.id===d))).filter(Boolean).map(d=>({...d,position:o}))},n.getTopRows=Z(()=>[n.getRowModel().rows,n.getState().rowPinning.top],(a,r)=>n._getPinnedRows(a,r,"top"),J(n.options,"debugRows")),n.getBottomRows=Z(()=>[n.getRowModel().rows,n.getState().rowPinning.bottom],(a,r)=>n._getPinnedRows(a,r,"bottom"),J(n.options,"debugRows")),n.getCenterRows=Z(()=>[n.getRowModel().rows,n.getState().rowPinning.top,n.getState().rowPinning.bottom],(a,r,o)=>{const l=new Set([...r??[],...o??[]]);return a.filter(c=>!l.has(c.id))},J(n.options,"debugRows"))}},$b={getInitialState:n=>({rowSelection:{},...n}),getDefaultOptions:n=>({onRowSelectionChange:xt("rowSelection",n),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:n=>{n.setRowSelection=a=>n.options.onRowSelectionChange==null?void 0:n.options.onRowSelectionChange(a),n.resetRowSelection=a=>{var r;return n.setRowSelection(a?{}:(r=n.initialState.rowSelection)!=null?r:{})},n.toggleAllRowsSelected=a=>{n.setRowSelection(r=>{a=typeof a<"u"?a:!n.getIsAllRowsSelected();const o={...r},l=n.getPreGroupedRowModel().flatRows;return a?l.forEach(c=>{c.getCanSelect()&&(o[c.id]=!0)}):l.forEach(c=>{delete o[c.id]}),o})},n.toggleAllPageRowsSelected=a=>n.setRowSelection(r=>{const o=typeof a<"u"?a:!n.getIsAllPageRowsSelected(),l={...r};return n.getRowModel().rows.forEach(c=>{Xa(l,c.id,o,!0,n)}),l}),n.getPreSelectedRowModel=()=>n.getCoreRowModel(),n.getSelectedRowModel=Z(()=>[n.getState().rowSelection,n.getCoreRowModel()],(a,r)=>Object.keys(a).length?Ba(n,r):{rows:[],flatRows:[],rowsById:{}},J(n.options,"debugTable")),n.getFilteredSelectedRowModel=Z(()=>[n.getState().rowSelection,n.getFilteredRowModel()],(a,r)=>Object.keys(a).length?Ba(n,r):{rows:[],flatRows:[],rowsById:{}},J(n.options,"debugTable")),n.getGroupedSelectedRowModel=Z(()=>[n.getState().rowSelection,n.getSortedRowModel()],(a,r)=>Object.keys(a).length?Ba(n,r):{rows:[],flatRows:[],rowsById:{}},J(n.options,"debugTable")),n.getIsAllRowsSelected=()=>{const a=n.getFilteredRowModel().flatRows,{rowSelection:r}=n.getState();let o=!!(a.length&&Object.keys(r).length);return o&&a.some(l=>l.getCanSelect()&&!r[l.id])&&(o=!1),o},n.getIsAllPageRowsSelected=()=>{const a=n.getPaginationRowModel().flatRows.filter(l=>l.getCanSelect()),{rowSelection:r}=n.getState();let o=!!a.length;return o&&a.some(l=>!r[l.id])&&(o=!1),o},n.getIsSomeRowsSelected=()=>{var a;const r=Object.keys((a=n.getState().rowSelection)!=null?a:{}).length;return r>0&&r{const a=n.getPaginationRowModel().flatRows;return n.getIsAllPageRowsSelected()?!1:a.filter(r=>r.getCanSelect()).some(r=>r.getIsSelected()||r.getIsSomeSelected())},n.getToggleAllRowsSelectedHandler=()=>a=>{n.toggleAllRowsSelected(a.target.checked)},n.getToggleAllPageRowsSelectedHandler=()=>a=>{n.toggleAllPageRowsSelected(a.target.checked)}},createRow:(n,a)=>{n.toggleSelected=(r,o)=>{const l=n.getIsSelected();a.setRowSelection(c=>{var d;if(r=typeof r<"u"?r:!l,n.getCanSelect()&&l===r)return c;const h={...c};return Xa(h,n.id,r,(d=o==null?void 0:o.selectChildren)!=null?d:!0,a),h})},n.getIsSelected=()=>{const{rowSelection:r}=a.getState();return Ao(n,r)},n.getIsSomeSelected=()=>{const{rowSelection:r}=a.getState();return Za(n,r)==="some"},n.getIsAllSubRowsSelected=()=>{const{rowSelection:r}=a.getState();return Za(n,r)==="all"},n.getCanSelect=()=>{var r;return typeof a.options.enableRowSelection=="function"?a.options.enableRowSelection(n):(r=a.options.enableRowSelection)!=null?r:!0},n.getCanSelectSubRows=()=>{var r;return typeof a.options.enableSubRowSelection=="function"?a.options.enableSubRowSelection(n):(r=a.options.enableSubRowSelection)!=null?r:!0},n.getCanMultiSelect=()=>{var r;return typeof a.options.enableMultiRowSelection=="function"?a.options.enableMultiRowSelection(n):(r=a.options.enableMultiRowSelection)!=null?r:!0},n.getToggleSelectedHandler=()=>{const r=n.getCanSelect();return o=>{var l;r&&n.toggleSelected((l=o.target)==null?void 0:l.checked)}}}},Xa=(n,a,r,o,l)=>{var c;const d=l.getRow(a,!0);r?(d.getCanMultiSelect()||Object.keys(n).forEach(h=>delete n[h]),d.getCanSelect()&&(n[a]=!0)):delete n[a],o&&(c=d.subRows)!=null&&c.length&&d.getCanSelectSubRows()&&d.subRows.forEach(h=>Xa(n,h.id,r,o,l))};function Ba(n,a){const r=n.getState().rowSelection,o=[],l={},c=function(d,h){return d.map(p=>{var x;const v=Ao(p,r);if(v&&(o.push(p),l[p.id]=p),(x=p.subRows)!=null&&x.length&&(p={...p,subRows:c(p.subRows)}),v)return p}).filter(Boolean)};return{rows:c(a.rows),flatRows:o,rowsById:l}}function Ao(n,a){var r;return(r=a[n.id])!=null?r:!1}function Za(n,a,r){var o;if(!((o=n.subRows)!=null&&o.length))return!1;let l=!0,c=!1;return n.subRows.forEach(d=>{if(!(c&&!l)&&(d.getCanSelect()&&(Ao(d,a)?c=!0:l=!1),d.subRows&&d.subRows.length)){const h=Za(d,a);h==="all"?c=!0:(h==="some"&&(c=!0),l=!1)}}),l?"all":c?"some":!1}const Ja=/([0-9]+)/gm,zb=(n,a,r)=>Ad(xn(n.getValue(r)).toLowerCase(),xn(a.getValue(r)).toLowerCase()),Bb=(n,a,r)=>Ad(xn(n.getValue(r)),xn(a.getValue(r))),Vb=(n,a,r)=>Io(xn(n.getValue(r)).toLowerCase(),xn(a.getValue(r)).toLowerCase()),Ub=(n,a,r)=>Io(xn(n.getValue(r)),xn(a.getValue(r))),Gb=(n,a,r)=>{const o=n.getValue(r),l=a.getValue(r);return o>l?1:oIo(n.getValue(r),a.getValue(r));function Io(n,a){return n===a?0:n>a?1:-1}function xn(n){return typeof n=="number"?isNaN(n)||n===1/0||n===-1/0?"":String(n):typeof n=="string"?n:""}function Ad(n,a){const r=n.split(Ja).filter(Boolean),o=a.split(Ja).filter(Boolean);for(;r.length&&o.length;){const l=r.shift(),c=o.shift(),d=parseInt(l,10),h=parseInt(c,10),p=[d,h].sort();if(isNaN(p[0])){if(l>c)return 1;if(c>l)return-1;continue}if(isNaN(p[1]))return isNaN(d)?-1:1;if(d>h)return 1;if(h>d)return-1}return r.length-o.length}const Dr={alphanumeric:zb,alphanumericCaseSensitive:Bb,text:Vb,textCaseSensitive:Ub,datetime:Gb,basic:Hb},Kb={getInitialState:n=>({sorting:[],...n}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:n=>({onSortingChange:xt("sorting",n),isMultiSortEvent:a=>a.shiftKey}),createColumn:(n,a)=>{n.getAutoSortingFn=()=>{const r=a.getFilteredRowModel().flatRows.slice(10);let o=!1;for(const l of r){const c=l==null?void 0:l.getValue(n.id);if(Object.prototype.toString.call(c)==="[object Date]")return Dr.datetime;if(typeof c=="string"&&(o=!0,c.split(Ja).length>1))return Dr.alphanumeric}return o?Dr.text:Dr.basic},n.getAutoSortDir=()=>{const r=a.getFilteredRowModel().flatRows[0];return typeof(r==null?void 0:r.getValue(n.id))=="string"?"asc":"desc"},n.getSortingFn=()=>{var r,o;if(!n)throw new Error;return rs(n.columnDef.sortingFn)?n.columnDef.sortingFn:n.columnDef.sortingFn==="auto"?n.getAutoSortingFn():(r=(o=a.options.sortingFns)==null?void 0:o[n.columnDef.sortingFn])!=null?r:Dr[n.columnDef.sortingFn]},n.toggleSorting=(r,o)=>{const l=n.getNextSortingOrder(),c=typeof r<"u"&&r!==null;a.setSorting(d=>{const h=d==null?void 0:d.find(b=>b.id===n.id),p=d==null?void 0:d.findIndex(b=>b.id===n.id);let x=[],v,R=c?r:l==="desc";if(d!=null&&d.length&&n.getCanMultiSort()&&o?h?v="toggle":v="add":d!=null&&d.length&&p!==d.length-1?v="replace":h?v="toggle":v="replace",v==="toggle"&&(c||l||(v="remove")),v==="add"){var y;x=[...d,{id:n.id,desc:R}],x.splice(0,x.length-((y=a.options.maxMultiSortColCount)!=null?y:Number.MAX_SAFE_INTEGER))}else v==="toggle"?x=d.map(b=>b.id===n.id?{...b,desc:R}:b):v==="remove"?x=d.filter(b=>b.id!==n.id):x=[{id:n.id,desc:R}];return x})},n.getFirstSortDir=()=>{var r,o;return((r=(o=n.columnDef.sortDescFirst)!=null?o:a.options.sortDescFirst)!=null?r:n.getAutoSortDir()==="desc")?"desc":"asc"},n.getNextSortingOrder=r=>{var o,l;const c=n.getFirstSortDir(),d=n.getIsSorted();return d?d!==c&&((o=a.options.enableSortingRemoval)==null||o)&&(!(r&&(l=a.options.enableMultiRemove)!=null)||l)?!1:d==="desc"?"asc":"desc":c},n.getCanSort=()=>{var r,o;return((r=n.columnDef.enableSorting)!=null?r:!0)&&((o=a.options.enableSorting)!=null?o:!0)&&!!n.accessorFn},n.getCanMultiSort=()=>{var r,o;return(r=(o=n.columnDef.enableMultiSort)!=null?o:a.options.enableMultiSort)!=null?r:!!n.accessorFn},n.getIsSorted=()=>{var r;const o=(r=a.getState().sorting)==null?void 0:r.find(l=>l.id===n.id);return o?o.desc?"desc":"asc":!1},n.getSortIndex=()=>{var r,o;return(r=(o=a.getState().sorting)==null?void 0:o.findIndex(l=>l.id===n.id))!=null?r:-1},n.clearSorting=()=>{a.setSorting(r=>r!=null&&r.length?r.filter(o=>o.id!==n.id):[])},n.getToggleSortingHandler=()=>{const r=n.getCanSort();return o=>{r&&(o.persist==null||o.persist(),n.toggleSorting==null||n.toggleSorting(void 0,n.getCanMultiSort()?a.options.isMultiSortEvent==null?void 0:a.options.isMultiSortEvent(o):!1))}}},createTable:n=>{n.setSorting=a=>n.options.onSortingChange==null?void 0:n.options.onSortingChange(a),n.resetSorting=a=>{var r,o;n.setSorting(a?[]:(r=(o=n.initialState)==null?void 0:o.sorting)!=null?r:[])},n.getPreSortedRowModel=()=>n.getGroupedRowModel(),n.getSortedRowModel=()=>(!n._getSortedRowModel&&n.options.getSortedRowModel&&(n._getSortedRowModel=n.options.getSortedRowModel(n)),n.options.manualSorting||!n._getSortedRowModel?n.getPreSortedRowModel():n._getSortedRowModel())}},Wb=[pb,Tb,Ib,Fb,xb,vb,Lb,Ob,Kb,Eb,Pb,kb,qb,$b,Mb];function Yb(n){var a,r;const o=[...Wb,...(a=n._features)!=null?a:[]];let l={_features:o};const c=l._features.reduce((y,b)=>Object.assign(y,b.getDefaultOptions==null?void 0:b.getDefaultOptions(l)),{}),d=y=>l.options.mergeOptions?l.options.mergeOptions(c,y):{...c,...y};let p={...{},...(r=n.initialState)!=null?r:{}};l._features.forEach(y=>{var b;p=(b=y.getInitialState==null?void 0:y.getInitialState(p))!=null?b:p});const x=[];let v=!1;const R={_features:o,options:{...c,...n},initialState:p,_queue:y=>{x.push(y),v||(v=!0,Promise.resolve().then(()=>{for(;x.length;)x.shift()();v=!1}).catch(b=>setTimeout(()=>{throw b})))},reset:()=>{l.setState(l.initialState)},setOptions:y=>{const b=gn(y,l.options);l.options=d(b)},getState:()=>l.options.state,setState:y=>{l.options.onStateChange==null||l.options.onStateChange(y)},_getRowId:(y,b,E)=>{var j;return(j=l.options.getRowId==null?void 0:l.options.getRowId(y,b,E))!=null?j:`${E?[E.id,b].join("."):b}`},getCoreRowModel:()=>(l._getCoreRowModel||(l._getCoreRowModel=l.options.getCoreRowModel(l)),l._getCoreRowModel()),getRowModel:()=>l.getPaginationRowModel(),getRow:(y,b)=>{let E=(b?l.getPrePaginationRowModel():l.getRowModel()).rowsById[y];if(!E&&(E=l.getCoreRowModel().rowsById[y],!E))throw new Error;return E},_getDefaultColumnDef:Z(()=>[l.options.defaultColumn],y=>{var b;return y=(b=y)!=null?b:{},{header:E=>{const j=E.header.column.columnDef;return j.accessorKey?j.accessorKey:j.accessorFn?j.id:null},cell:E=>{var j,D;return(j=(D=E.renderValue())==null||D.toString==null?void 0:D.toString())!=null?j:null},...l._features.reduce((E,j)=>Object.assign(E,j.getDefaultColumnDef==null?void 0:j.getDefaultColumnDef()),{}),...y}},J(n,"debugColumns")),_getColumnDefs:()=>l.options.columns,getAllColumns:Z(()=>[l._getColumnDefs()],y=>{const b=function(E,j,D){return D===void 0&&(D=0),E.map(F=>{const q=hb(l,F,D,j),$=F;return q.columns=$.columns?b($.columns,q,D+1):[],q})};return b(y)},J(n,"debugColumns")),getAllFlatColumns:Z(()=>[l.getAllColumns()],y=>y.flatMap(b=>b.getFlatColumns()),J(n,"debugColumns")),_getAllFlatColumnsById:Z(()=>[l.getAllFlatColumns()],y=>y.reduce((b,E)=>(b[E.id]=E,b),{}),J(n,"debugColumns")),getAllLeafColumns:Z(()=>[l.getAllColumns(),l._getOrderColumnsFn()],(y,b)=>{let E=y.flatMap(j=>j.getLeafColumns());return b(E)},J(n,"debugColumns")),getColumn:y=>l._getAllFlatColumnsById()[y]};Object.assign(l,R);for(let y=0;yZ(()=>[n.options.data],a=>{const r={rows:[],flatRows:[],rowsById:{}},o=function(l,c,d){c===void 0&&(c=0);const h=[];for(let x=0;xn._autoResetPageIndex()))}function Fd(n,a,r){return r.options.filterFromLeafRows?Qb(n,a,r):Xb(n,a,r)}function Qb(n,a,r){var o;const l=[],c={},d=(o=r.options.maxLeafRowFilterDepth)!=null?o:100,h=function(p,x){x===void 0&&(x=0);const v=[];for(let y=0;yZ(()=>[n.getPreFilteredRowModel(),n.getState().columnFilters,n.getState().globalFilter,n.getFilteredRowModel()],(r,o,l)=>{if(!r.rows.length||!(o!=null&&o.length)&&!l)return r;const c=[...o.map(h=>h.id).filter(h=>h!==a),l?"__global__":void 0].filter(Boolean),d=h=>{for(let p=0;pZ(()=>{var r;return[(r=n.getColumn(a))==null?void 0:r.getFacetedRowModel()]},r=>{if(!r)return new Map;let o=new Map;for(let c=0;cZ(()=>[n.getPreFilteredRowModel(),n.getState().columnFilters,n.getState().globalFilter],(a,r,o)=>{if(!a.rows.length||!(r!=null&&r.length)&&!o){for(let y=0;y{var b;const E=n.getColumn(y.id);if(!E)return;const j=E.getFilterFn();j&&l.push({id:y.id,filterFn:j,resolvedValue:(b=j.resolveFilterValue==null?void 0:j.resolveFilterValue(y.value))!=null?b:y.value})});const d=(r??[]).map(y=>y.id),h=n.getGlobalFilterFn(),p=n.getAllLeafColumns().filter(y=>y.getCanGlobalFilter());o&&h&&p.length&&(d.push("__global__"),p.forEach(y=>{var b;c.push({id:y.id,filterFn:h,resolvedValue:(b=h.resolveFilterValue==null?void 0:h.resolveFilterValue(o))!=null?b:o})}));let x,v;for(let y=0;y{b.columnFiltersMeta[j]=D})}if(c.length){for(let E=0;E{b.columnFiltersMeta[j]=D})){b.columnFilters.__global__=!0;break}}b.columnFilters.__global__!==!0&&(b.columnFilters.__global__=!1)}}const R=y=>{for(let b=0;bn._autoResetPageIndex()))}function tw(){return n=>Z(()=>[n.getState().sorting,n.getPreSortedRowModel()],(a,r)=>{if(!r.rows.length||!(a!=null&&a.length))return r;const o=n.getState().sorting,l=[],c=o.filter(p=>{var x;return(x=n.getColumn(p.id))==null?void 0:x.getCanSort()}),d={};c.forEach(p=>{const x=n.getColumn(p.id);x&&(d[p.id]={sortUndefined:x.columnDef.sortUndefined,invertSorting:x.columnDef.invertSorting,sortingFn:x.getSortingFn()})});const h=p=>{const x=p.map(v=>({...v}));return x.sort((v,R)=>{for(let b=0;b{var R;l.push(v),(R=v.subRows)!=null&&R.length&&(v.subRows=h(v.subRows))}),x};return{rows:h(r.rows),flatRows:l,rowsById:r.rowsById}},J(n.options,"debugTable","getSortedRowModel",()=>n._autoResetPageIndex()))}/** + color: hsl(${Math.max(0,Math.min(120-120*y,120))}deg 100% 31%);`,r==null?void 0:r.key)}return l}}function J(n,a,r,o){return{debug:()=>{var l;return(l=n==null?void 0:n.debugAll)!=null?l:n[a]},key:!1,onChange:o}}function mb(n,a,r,o){const l=()=>{var d;return(d=c.getValue())!=null?d:n.options.renderFallbackValue},c={id:`${a.id}_${r.id}`,row:a,column:r,getValue:()=>a.getValue(o),renderValue:l,getContext:Z(()=>[n,r,a,c],(d,h,p,x)=>({table:d,column:h,row:p,cell:x,getValue:x.getValue,renderValue:x.renderValue}),J(n.options,"debugCells"))};return n._features.forEach(d=>{d.createCell==null||d.createCell(c,r,a,n)},{}),c}function hb(n,a,r,o){var l,c;const h={...n._getDefaultColumnDef(),...a},p=h.accessorKey;let x=(l=(c=h.id)!=null?c:p?typeof String.prototype.replaceAll=="function"?p.replaceAll(".","_"):p.replace(/\./g,"_"):void 0)!=null?l:typeof h.header=="string"?h.header:void 0,v;if(h.accessorFn?v=h.accessorFn:p&&(p.includes(".")?v=y=>{let b=y;for(const j of p.split(".")){var E;b=(E=b)==null?void 0:E[j]}return b}:v=y=>y[h.accessorKey]),!x)throw new Error;let R={id:`${String(x)}`,accessorFn:v,parent:o,depth:r,columnDef:h,columns:[],getFlatColumns:Z(()=>[!0],()=>{var y;return[R,...(y=R.columns)==null?void 0:y.flatMap(b=>b.getFlatColumns())]},J(n.options,"debugColumns")),getLeafColumns:Z(()=>[n._getOrderColumnsFn()],y=>{var b;if((b=R.columns)!=null&&b.length){let E=R.columns.flatMap(j=>j.getLeafColumns());return y(E)}return[R]},J(n.options,"debugColumns"))};for(const y of n._features)y.createColumn==null||y.createColumn(R,n);return R}const Ze="debugHeaders";function Cc(n,a,r){var o;let c={id:(o=r.id)!=null?o:a.id,column:a,index:r.index,isPlaceholder:!!r.isPlaceholder,placeholderId:r.placeholderId,depth:r.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const d=[],h=p=>{p.subHeaders&&p.subHeaders.length&&p.subHeaders.map(h),d.push(p)};return h(c),d},getContext:()=>({table:n,header:c,column:a})};return n._features.forEach(d=>{d.createHeader==null||d.createHeader(c,n)}),c}const pb={createTable:n=>{n.getHeaderGroups=Z(()=>[n.getAllColumns(),n.getVisibleLeafColumns(),n.getState().columnPinning.left,n.getState().columnPinning.right],(a,r,o,l)=>{var c,d;const h=(c=o==null?void 0:o.map(R=>r.find(y=>y.id===R)).filter(Boolean))!=null?c:[],p=(d=l==null?void 0:l.map(R=>r.find(y=>y.id===R)).filter(Boolean))!=null?d:[],x=r.filter(R=>!(o!=null&&o.includes(R.id))&&!(l!=null&&l.includes(R.id)));return qi(a,[...h,...x,...p],n)},J(n.options,Ze)),n.getCenterHeaderGroups=Z(()=>[n.getAllColumns(),n.getVisibleLeafColumns(),n.getState().columnPinning.left,n.getState().columnPinning.right],(a,r,o,l)=>(r=r.filter(c=>!(o!=null&&o.includes(c.id))&&!(l!=null&&l.includes(c.id))),qi(a,r,n,"center")),J(n.options,Ze)),n.getLeftHeaderGroups=Z(()=>[n.getAllColumns(),n.getVisibleLeafColumns(),n.getState().columnPinning.left],(a,r,o)=>{var l;const c=(l=o==null?void 0:o.map(d=>r.find(h=>h.id===d)).filter(Boolean))!=null?l:[];return qi(a,c,n,"left")},J(n.options,Ze)),n.getRightHeaderGroups=Z(()=>[n.getAllColumns(),n.getVisibleLeafColumns(),n.getState().columnPinning.right],(a,r,o)=>{var l;const c=(l=o==null?void 0:o.map(d=>r.find(h=>h.id===d)).filter(Boolean))!=null?l:[];return qi(a,c,n,"right")},J(n.options,Ze)),n.getFooterGroups=Z(()=>[n.getHeaderGroups()],a=>[...a].reverse(),J(n.options,Ze)),n.getLeftFooterGroups=Z(()=>[n.getLeftHeaderGroups()],a=>[...a].reverse(),J(n.options,Ze)),n.getCenterFooterGroups=Z(()=>[n.getCenterHeaderGroups()],a=>[...a].reverse(),J(n.options,Ze)),n.getRightFooterGroups=Z(()=>[n.getRightHeaderGroups()],a=>[...a].reverse(),J(n.options,Ze)),n.getFlatHeaders=Z(()=>[n.getHeaderGroups()],a=>a.map(r=>r.headers).flat(),J(n.options,Ze)),n.getLeftFlatHeaders=Z(()=>[n.getLeftHeaderGroups()],a=>a.map(r=>r.headers).flat(),J(n.options,Ze)),n.getCenterFlatHeaders=Z(()=>[n.getCenterHeaderGroups()],a=>a.map(r=>r.headers).flat(),J(n.options,Ze)),n.getRightFlatHeaders=Z(()=>[n.getRightHeaderGroups()],a=>a.map(r=>r.headers).flat(),J(n.options,Ze)),n.getCenterLeafHeaders=Z(()=>[n.getCenterFlatHeaders()],a=>a.filter(r=>{var o;return!((o=r.subHeaders)!=null&&o.length)}),J(n.options,Ze)),n.getLeftLeafHeaders=Z(()=>[n.getLeftFlatHeaders()],a=>a.filter(r=>{var o;return!((o=r.subHeaders)!=null&&o.length)}),J(n.options,Ze)),n.getRightLeafHeaders=Z(()=>[n.getRightFlatHeaders()],a=>a.filter(r=>{var o;return!((o=r.subHeaders)!=null&&o.length)}),J(n.options,Ze)),n.getLeafHeaders=Z(()=>[n.getLeftHeaderGroups(),n.getCenterHeaderGroups(),n.getRightHeaderGroups()],(a,r,o)=>{var l,c,d,h,p,x;return[...(l=(c=a[0])==null?void 0:c.headers)!=null?l:[],...(d=(h=r[0])==null?void 0:h.headers)!=null?d:[],...(p=(x=o[0])==null?void 0:x.headers)!=null?p:[]].map(v=>v.getLeafHeaders()).flat()},J(n.options,Ze))}};function qi(n,a,r,o){var l,c;let d=0;const h=function(y,b){b===void 0&&(b=1),d=Math.max(d,b),y.filter(E=>E.getIsVisible()).forEach(E=>{var j;(j=E.columns)!=null&&j.length&&h(E.columns,b+1)},0)};h(n);let p=[];const x=(y,b)=>{const E={depth:b,id:[o,`${b}`].filter(Boolean).join("_"),headers:[]},j=[];y.forEach(D=>{const F=[...j].reverse()[0],q=D.column.depth===E.depth;let $,Q=!1;if(q&&D.column.parent?$=D.column.parent:($=D.column,Q=!0),F&&(F==null?void 0:F.column)===$)F.subHeaders.push(D);else{const O=Cc(r,$,{id:[o,b,$.id,D==null?void 0:D.id].filter(Boolean).join("_"),isPlaceholder:Q,placeholderId:Q?`${j.filter(k=>k.column===$).length}`:void 0,depth:b,index:j.length});O.subHeaders.push(D),j.push(O)}E.headers.push(D),D.headerGroup=E}),p.push(E),b>0&&x(j,b-1)},v=a.map((y,b)=>Cc(r,y,{depth:d,index:b}));x(v,d-1),p.reverse();const R=y=>y.filter(E=>E.column.getIsVisible()).map(E=>{let j=0,D=0,F=[0];E.subHeaders&&E.subHeaders.length?(F=[],R(E.subHeaders).forEach($=>{let{colSpan:Q,rowSpan:O}=$;j+=Q,F.push(O)})):j=1;const q=Math.min(...F);return D=D+q,E.colSpan=j,E.rowSpan=D,{colSpan:j,rowSpan:D}});return R((l=(c=p[0])==null?void 0:c.headers)!=null?l:[]),p}const Ro=(n,a,r,o,l,c,d)=>{let h={id:a,index:o,original:r,depth:l,parentId:d,_valuesCache:{},_uniqueValuesCache:{},getValue:p=>{if(h._valuesCache.hasOwnProperty(p))return h._valuesCache[p];const x=n.getColumn(p);if(x!=null&&x.accessorFn)return h._valuesCache[p]=x.accessorFn(h.original,o),h._valuesCache[p]},getUniqueValues:p=>{if(h._uniqueValuesCache.hasOwnProperty(p))return h._uniqueValuesCache[p];const x=n.getColumn(p);if(x!=null&&x.accessorFn)return x.columnDef.getUniqueValues?(h._uniqueValuesCache[p]=x.columnDef.getUniqueValues(h.original,o),h._uniqueValuesCache[p]):(h._uniqueValuesCache[p]=[h.getValue(p)],h._uniqueValuesCache[p])},renderValue:p=>{var x;return(x=h.getValue(p))!=null?x:n.options.renderFallbackValue},subRows:[],getLeafRows:()=>gb(h.subRows,p=>p.subRows),getParentRow:()=>h.parentId?n.getRow(h.parentId,!0):void 0,getParentRows:()=>{let p=[],x=h;for(;;){const v=x.getParentRow();if(!v)break;p.push(v),x=v}return p.reverse()},getAllCells:Z(()=>[n.getAllLeafColumns()],p=>p.map(x=>mb(n,h,x,x.id)),J(n.options,"debugRows")),_getAllCellsByColumnId:Z(()=>[h.getAllCells()],p=>p.reduce((x,v)=>(x[v.column.id]=v,x),{}),J(n.options,"debugRows"))};for(let p=0;p{n._getFacetedRowModel=a.options.getFacetedRowModel&&a.options.getFacetedRowModel(a,n.id),n.getFacetedRowModel=()=>n._getFacetedRowModel?n._getFacetedRowModel():a.getPreFilteredRowModel(),n._getFacetedUniqueValues=a.options.getFacetedUniqueValues&&a.options.getFacetedUniqueValues(a,n.id),n.getFacetedUniqueValues=()=>n._getFacetedUniqueValues?n._getFacetedUniqueValues():new Map,n._getFacetedMinMaxValues=a.options.getFacetedMinMaxValues&&a.options.getFacetedMinMaxValues(a,n.id),n.getFacetedMinMaxValues=()=>{if(n._getFacetedMinMaxValues)return n._getFacetedMinMaxValues()}}},wd=(n,a,r)=>{var o,l;const c=r==null||(o=r.toString())==null?void 0:o.toLowerCase();return!!(!((l=n.getValue(a))==null||(l=l.toString())==null||(l=l.toLowerCase())==null)&&l.includes(c))};wd.autoRemove=n=>Lt(n);const Sd=(n,a,r)=>{var o;return!!(!((o=n.getValue(a))==null||(o=o.toString())==null)&&o.includes(r))};Sd.autoRemove=n=>Lt(n);const jd=(n,a,r)=>{var o;return((o=n.getValue(a))==null||(o=o.toString())==null?void 0:o.toLowerCase())===(r==null?void 0:r.toLowerCase())};jd.autoRemove=n=>Lt(n);const Cd=(n,a,r)=>{var o;return(o=n.getValue(a))==null?void 0:o.includes(r)};Cd.autoRemove=n=>Lt(n);const yd=(n,a,r)=>!r.some(o=>{var l;return!((l=n.getValue(a))!=null&&l.includes(o))});yd.autoRemove=n=>Lt(n)||!(n!=null&&n.length);const Nd=(n,a,r)=>r.some(o=>{var l;return(l=n.getValue(a))==null?void 0:l.includes(o)});Nd.autoRemove=n=>Lt(n)||!(n!=null&&n.length);const Rd=(n,a,r)=>n.getValue(a)===r;Rd.autoRemove=n=>Lt(n);const Ed=(n,a,r)=>n.getValue(a)==r;Ed.autoRemove=n=>Lt(n);const Eo=(n,a,r)=>{let[o,l]=r;const c=n.getValue(a);return c>=o&&c<=l};Eo.resolveFilterValue=n=>{let[a,r]=n,o=typeof a!="number"?parseFloat(a):a,l=typeof r!="number"?parseFloat(r):r,c=a===null||Number.isNaN(o)?-1/0:o,d=r===null||Number.isNaN(l)?1/0:l;if(c>d){const h=c;c=d,d=h}return[c,d]};Eo.autoRemove=n=>Lt(n)||Lt(n[0])&&Lt(n[1]);const Zt={includesString:wd,includesStringSensitive:Sd,equalsString:jd,arrIncludes:Cd,arrIncludesAll:yd,arrIncludesSome:Nd,equals:Rd,weakEquals:Ed,inNumberRange:Eo};function Lt(n){return n==null||n===""}const vb={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:n=>({columnFilters:[],...n}),getDefaultOptions:n=>({onColumnFiltersChange:xt("columnFilters",n),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(n,a)=>{n.getAutoFilterFn=()=>{const r=a.getCoreRowModel().flatRows[0],o=r==null?void 0:r.getValue(n.id);return typeof o=="string"?Zt.includesString:typeof o=="number"?Zt.inNumberRange:typeof o=="boolean"||o!==null&&typeof o=="object"?Zt.equals:Array.isArray(o)?Zt.arrIncludes:Zt.weakEquals},n.getFilterFn=()=>{var r,o;return rs(n.columnDef.filterFn)?n.columnDef.filterFn:n.columnDef.filterFn==="auto"?n.getAutoFilterFn():(r=(o=a.options.filterFns)==null?void 0:o[n.columnDef.filterFn])!=null?r:Zt[n.columnDef.filterFn]},n.getCanFilter=()=>{var r,o,l;return((r=n.columnDef.enableColumnFilter)!=null?r:!0)&&((o=a.options.enableColumnFilters)!=null?o:!0)&&((l=a.options.enableFilters)!=null?l:!0)&&!!n.accessorFn},n.getIsFiltered=()=>n.getFilterIndex()>-1,n.getFilterValue=()=>{var r;return(r=a.getState().columnFilters)==null||(r=r.find(o=>o.id===n.id))==null?void 0:r.value},n.getFilterIndex=()=>{var r,o;return(r=(o=a.getState().columnFilters)==null?void 0:o.findIndex(l=>l.id===n.id))!=null?r:-1},n.setFilterValue=r=>{a.setColumnFilters(o=>{const l=n.getFilterFn(),c=o==null?void 0:o.find(v=>v.id===n.id),d=gn(r,c?c.value:void 0);if(yc(l,d,n)){var h;return(h=o==null?void 0:o.filter(v=>v.id!==n.id))!=null?h:[]}const p={id:n.id,value:d};if(c){var x;return(x=o==null?void 0:o.map(v=>v.id===n.id?p:v))!=null?x:[]}return o!=null&&o.length?[...o,p]:[p]})}},createRow:(n,a)=>{n.columnFilters={},n.columnFiltersMeta={}},createTable:n=>{n.setColumnFilters=a=>{const r=n.getAllLeafColumns(),o=l=>{var c;return(c=gn(a,l))==null?void 0:c.filter(d=>{const h=r.find(p=>p.id===d.id);if(h){const p=h.getFilterFn();if(yc(p,d.value,h))return!1}return!0})};n.options.onColumnFiltersChange==null||n.options.onColumnFiltersChange(o)},n.resetColumnFilters=a=>{var r,o;n.setColumnFilters(a?[]:(r=(o=n.initialState)==null?void 0:o.columnFilters)!=null?r:[])},n.getPreFilteredRowModel=()=>n.getCoreRowModel(),n.getFilteredRowModel=()=>(!n._getFilteredRowModel&&n.options.getFilteredRowModel&&(n._getFilteredRowModel=n.options.getFilteredRowModel(n)),n.options.manualFiltering||!n._getFilteredRowModel?n.getPreFilteredRowModel():n._getFilteredRowModel())}};function yc(n,a,r){return(n&&n.autoRemove?n.autoRemove(a,r):!1)||typeof a>"u"||typeof a=="string"&&!a}const _b=(n,a,r)=>r.reduce((o,l)=>{const c=l.getValue(n);return o+(typeof c=="number"?c:0)},0),bb=(n,a,r)=>{let o;return r.forEach(l=>{const c=l.getValue(n);c!=null&&(o>c||o===void 0&&c>=c)&&(o=c)}),o},wb=(n,a,r)=>{let o;return r.forEach(l=>{const c=l.getValue(n);c!=null&&(o=c)&&(o=c)}),o},Sb=(n,a,r)=>{let o,l;return r.forEach(c=>{const d=c.getValue(n);d!=null&&(o===void 0?d>=d&&(o=l=d):(o>d&&(o=d),l{let r=0,o=0;if(a.forEach(l=>{let c=l.getValue(n);c!=null&&(c=+c)>=c&&(++r,o+=c)}),r)return o/r},Cb=(n,a)=>{if(!a.length)return;const r=a.map(c=>c.getValue(n));if(!fb(r))return;if(r.length===1)return r[0];const o=Math.floor(r.length/2),l=r.sort((c,d)=>c-d);return r.length%2!==0?l[o]:(l[o-1]+l[o])/2},yb=(n,a)=>Array.from(new Set(a.map(r=>r.getValue(n))).values()),Nb=(n,a)=>new Set(a.map(r=>r.getValue(n))).size,Rb=(n,a)=>a.length,Oa={sum:_b,min:bb,max:wb,extent:Sb,mean:jb,median:Cb,unique:yb,uniqueCount:Nb,count:Rb},Eb={getDefaultColumnDef:()=>({aggregatedCell:n=>{var a,r;return(a=(r=n.getValue())==null||r.toString==null?void 0:r.toString())!=null?a:null},aggregationFn:"auto"}),getInitialState:n=>({grouping:[],...n}),getDefaultOptions:n=>({onGroupingChange:xt("grouping",n),groupedColumnMode:"reorder"}),createColumn:(n,a)=>{n.toggleGrouping=()=>{a.setGrouping(r=>r!=null&&r.includes(n.id)?r.filter(o=>o!==n.id):[...r??[],n.id])},n.getCanGroup=()=>{var r,o;return((r=n.columnDef.enableGrouping)!=null?r:!0)&&((o=a.options.enableGrouping)!=null?o:!0)&&(!!n.accessorFn||!!n.columnDef.getGroupingValue)},n.getIsGrouped=()=>{var r;return(r=a.getState().grouping)==null?void 0:r.includes(n.id)},n.getGroupedIndex=()=>{var r;return(r=a.getState().grouping)==null?void 0:r.indexOf(n.id)},n.getToggleGroupingHandler=()=>{const r=n.getCanGroup();return()=>{r&&n.toggleGrouping()}},n.getAutoAggregationFn=()=>{const r=a.getCoreRowModel().flatRows[0],o=r==null?void 0:r.getValue(n.id);if(typeof o=="number")return Oa.sum;if(Object.prototype.toString.call(o)==="[object Date]")return Oa.extent},n.getAggregationFn=()=>{var r,o;if(!n)throw new Error;return rs(n.columnDef.aggregationFn)?n.columnDef.aggregationFn:n.columnDef.aggregationFn==="auto"?n.getAutoAggregationFn():(r=(o=a.options.aggregationFns)==null?void 0:o[n.columnDef.aggregationFn])!=null?r:Oa[n.columnDef.aggregationFn]}},createTable:n=>{n.setGrouping=a=>n.options.onGroupingChange==null?void 0:n.options.onGroupingChange(a),n.resetGrouping=a=>{var r,o;n.setGrouping(a?[]:(r=(o=n.initialState)==null?void 0:o.grouping)!=null?r:[])},n.getPreGroupedRowModel=()=>n.getFilteredRowModel(),n.getGroupedRowModel=()=>(!n._getGroupedRowModel&&n.options.getGroupedRowModel&&(n._getGroupedRowModel=n.options.getGroupedRowModel(n)),n.options.manualGrouping||!n._getGroupedRowModel?n.getPreGroupedRowModel():n._getGroupedRowModel())},createRow:(n,a)=>{n.getIsGrouped=()=>!!n.groupingColumnId,n.getGroupingValue=r=>{if(n._groupingValuesCache.hasOwnProperty(r))return n._groupingValuesCache[r];const o=a.getColumn(r);return o!=null&&o.columnDef.getGroupingValue?(n._groupingValuesCache[r]=o.columnDef.getGroupingValue(n.original),n._groupingValuesCache[r]):n.getValue(r)},n._groupingValuesCache={}},createCell:(n,a,r,o)=>{n.getIsGrouped=()=>a.getIsGrouped()&&a.id===r.groupingColumnId,n.getIsPlaceholder=()=>!n.getIsGrouped()&&a.getIsGrouped(),n.getIsAggregated=()=>{var l;return!n.getIsGrouped()&&!n.getIsPlaceholder()&&!!((l=r.subRows)!=null&&l.length)}}};function Ab(n,a,r){if(!(a!=null&&a.length)||!r)return n;const o=n.filter(c=>!a.includes(c.id));return r==="remove"?o:[...a.map(c=>n.find(d=>d.id===c)).filter(Boolean),...o]}const Ib={getInitialState:n=>({columnOrder:[],...n}),getDefaultOptions:n=>({onColumnOrderChange:xt("columnOrder",n)}),createColumn:(n,a)=>{n.getIndex=Z(r=>[kr(a,r)],r=>r.findIndex(o=>o.id===n.id),J(a.options,"debugColumns")),n.getIsFirstColumn=r=>{var o;return((o=kr(a,r)[0])==null?void 0:o.id)===n.id},n.getIsLastColumn=r=>{var o;const l=kr(a,r);return((o=l[l.length-1])==null?void 0:o.id)===n.id}},createTable:n=>{n.setColumnOrder=a=>n.options.onColumnOrderChange==null?void 0:n.options.onColumnOrderChange(a),n.resetColumnOrder=a=>{var r;n.setColumnOrder(a?[]:(r=n.initialState.columnOrder)!=null?r:[])},n._getOrderColumnsFn=Z(()=>[n.getState().columnOrder,n.getState().grouping,n.options.groupedColumnMode],(a,r,o)=>l=>{let c=[];if(!(a!=null&&a.length))c=l;else{const d=[...a],h=[...l];for(;h.length&&d.length;){const p=d.shift(),x=h.findIndex(v=>v.id===p);x>-1&&c.push(h.splice(x,1)[0])}c=[...c,...h]}return Ab(c,r,o)},J(n.options,"debugTable"))}},Pa=()=>({left:[],right:[]}),Fb={getInitialState:n=>({columnPinning:Pa(),...n}),getDefaultOptions:n=>({onColumnPinningChange:xt("columnPinning",n)}),createColumn:(n,a)=>{n.pin=r=>{const o=n.getLeafColumns().map(l=>l.id).filter(Boolean);a.setColumnPinning(l=>{var c,d;if(r==="right"){var h,p;return{left:((h=l==null?void 0:l.left)!=null?h:[]).filter(R=>!(o!=null&&o.includes(R))),right:[...((p=l==null?void 0:l.right)!=null?p:[]).filter(R=>!(o!=null&&o.includes(R))),...o]}}if(r==="left"){var x,v;return{left:[...((x=l==null?void 0:l.left)!=null?x:[]).filter(R=>!(o!=null&&o.includes(R))),...o],right:((v=l==null?void 0:l.right)!=null?v:[]).filter(R=>!(o!=null&&o.includes(R)))}}return{left:((c=l==null?void 0:l.left)!=null?c:[]).filter(R=>!(o!=null&&o.includes(R))),right:((d=l==null?void 0:l.right)!=null?d:[]).filter(R=>!(o!=null&&o.includes(R)))}})},n.getCanPin=()=>n.getLeafColumns().some(o=>{var l,c,d;return((l=o.columnDef.enablePinning)!=null?l:!0)&&((c=(d=a.options.enableColumnPinning)!=null?d:a.options.enablePinning)!=null?c:!0)}),n.getIsPinned=()=>{const r=n.getLeafColumns().map(h=>h.id),{left:o,right:l}=a.getState().columnPinning,c=r.some(h=>o==null?void 0:o.includes(h)),d=r.some(h=>l==null?void 0:l.includes(h));return c?"left":d?"right":!1},n.getPinnedIndex=()=>{var r,o;const l=n.getIsPinned();return l?(r=(o=a.getState().columnPinning)==null||(o=o[l])==null?void 0:o.indexOf(n.id))!=null?r:-1:0}},createRow:(n,a)=>{n.getCenterVisibleCells=Z(()=>[n._getAllVisibleCells(),a.getState().columnPinning.left,a.getState().columnPinning.right],(r,o,l)=>{const c=[...o??[],...l??[]];return r.filter(d=>!c.includes(d.column.id))},J(a.options,"debugRows")),n.getLeftVisibleCells=Z(()=>[n._getAllVisibleCells(),a.getState().columnPinning.left],(r,o)=>(o??[]).map(c=>r.find(d=>d.column.id===c)).filter(Boolean).map(c=>({...c,position:"left"})),J(a.options,"debugRows")),n.getRightVisibleCells=Z(()=>[n._getAllVisibleCells(),a.getState().columnPinning.right],(r,o)=>(o??[]).map(c=>r.find(d=>d.column.id===c)).filter(Boolean).map(c=>({...c,position:"right"})),J(a.options,"debugRows"))},createTable:n=>{n.setColumnPinning=a=>n.options.onColumnPinningChange==null?void 0:n.options.onColumnPinningChange(a),n.resetColumnPinning=a=>{var r,o;return n.setColumnPinning(a?Pa():(r=(o=n.initialState)==null?void 0:o.columnPinning)!=null?r:Pa())},n.getIsSomeColumnsPinned=a=>{var r;const o=n.getState().columnPinning;if(!a){var l,c;return!!((l=o.left)!=null&&l.length||(c=o.right)!=null&&c.length)}return!!((r=o[a])!=null&&r.length)},n.getLeftLeafColumns=Z(()=>[n.getAllLeafColumns(),n.getState().columnPinning.left],(a,r)=>(r??[]).map(o=>a.find(l=>l.id===o)).filter(Boolean),J(n.options,"debugColumns")),n.getRightLeafColumns=Z(()=>[n.getAllLeafColumns(),n.getState().columnPinning.right],(a,r)=>(r??[]).map(o=>a.find(l=>l.id===o)).filter(Boolean),J(n.options,"debugColumns")),n.getCenterLeafColumns=Z(()=>[n.getAllLeafColumns(),n.getState().columnPinning.left,n.getState().columnPinning.right],(a,r,o)=>{const l=[...r??[],...o??[]];return a.filter(c=>!l.includes(c.id))},J(n.options,"debugColumns"))}},$i={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},ka=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),Mb={getDefaultColumnDef:()=>$i,getInitialState:n=>({columnSizing:{},columnSizingInfo:ka(),...n}),getDefaultOptions:n=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:xt("columnSizing",n),onColumnSizingInfoChange:xt("columnSizingInfo",n)}),createColumn:(n,a)=>{n.getSize=()=>{var r,o,l;const c=a.getState().columnSizing[n.id];return Math.min(Math.max((r=n.columnDef.minSize)!=null?r:$i.minSize,(o=c??n.columnDef.size)!=null?o:$i.size),(l=n.columnDef.maxSize)!=null?l:$i.maxSize)},n.getStart=Z(r=>[r,kr(a,r),a.getState().columnSizing],(r,o)=>o.slice(0,n.getIndex(r)).reduce((l,c)=>l+c.getSize(),0),J(a.options,"debugColumns")),n.getAfter=Z(r=>[r,kr(a,r),a.getState().columnSizing],(r,o)=>o.slice(n.getIndex(r)+1).reduce((l,c)=>l+c.getSize(),0),J(a.options,"debugColumns")),n.resetSize=()=>{a.setColumnSizing(r=>{let{[n.id]:o,...l}=r;return l})},n.getCanResize=()=>{var r,o;return((r=n.columnDef.enableResizing)!=null?r:!0)&&((o=a.options.enableColumnResizing)!=null?o:!0)},n.getIsResizing=()=>a.getState().columnSizingInfo.isResizingColumn===n.id},createHeader:(n,a)=>{n.getSize=()=>{let r=0;const o=l=>{if(l.subHeaders.length)l.subHeaders.forEach(o);else{var c;r+=(c=l.column.getSize())!=null?c:0}};return o(n),r},n.getStart=()=>{if(n.index>0){const r=n.headerGroup.headers[n.index-1];return r.getStart()+r.getSize()}return 0},n.getResizeHandler=r=>{const o=a.getColumn(n.column.id),l=o==null?void 0:o.getCanResize();return c=>{if(!o||!l||(c.persist==null||c.persist(),qa(c)&&c.touches&&c.touches.length>1))return;const d=n.getSize(),h=n?n.getLeafHeaders().map(F=>[F.column.id,F.column.getSize()]):[[o.id,o.getSize()]],p=qa(c)?Math.round(c.touches[0].clientX):c.clientX,x={},v=(F,q)=>{typeof q=="number"&&(a.setColumnSizingInfo($=>{var Q,O;const k=a.options.columnResizeDirection==="rtl"?-1:1,H=(q-((Q=$==null?void 0:$.startOffset)!=null?Q:0))*k,W=Math.max(H/((O=$==null?void 0:$.startSize)!=null?O:0),-.999999);return $.columnSizingStart.forEach(B=>{let[ae,ce]=B;x[ae]=Math.round(Math.max(ce+ce*W,0)*100)/100}),{...$,deltaOffset:H,deltaPercentage:W}}),(a.options.columnResizeMode==="onChange"||F==="end")&&a.setColumnSizing($=>({...$,...x})))},R=F=>v("move",F),y=F=>{v("end",F),a.setColumnSizingInfo(q=>({...q,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},b=r||typeof document<"u"?document:null,E={moveHandler:F=>R(F.clientX),upHandler:F=>{b==null||b.removeEventListener("mousemove",E.moveHandler),b==null||b.removeEventListener("mouseup",E.upHandler),y(F.clientX)}},j={moveHandler:F=>(F.cancelable&&(F.preventDefault(),F.stopPropagation()),R(F.touches[0].clientX),!1),upHandler:F=>{var q;b==null||b.removeEventListener("touchmove",j.moveHandler),b==null||b.removeEventListener("touchend",j.upHandler),F.cancelable&&(F.preventDefault(),F.stopPropagation()),y((q=F.touches[0])==null?void 0:q.clientX)}},D=Db()?{passive:!1}:!1;qa(c)?(b==null||b.addEventListener("touchmove",j.moveHandler,D),b==null||b.addEventListener("touchend",j.upHandler,D)):(b==null||b.addEventListener("mousemove",E.moveHandler,D),b==null||b.addEventListener("mouseup",E.upHandler,D)),a.setColumnSizingInfo(F=>({...F,startOffset:p,startSize:d,deltaOffset:0,deltaPercentage:0,columnSizingStart:h,isResizingColumn:o.id}))}}},createTable:n=>{n.setColumnSizing=a=>n.options.onColumnSizingChange==null?void 0:n.options.onColumnSizingChange(a),n.setColumnSizingInfo=a=>n.options.onColumnSizingInfoChange==null?void 0:n.options.onColumnSizingInfoChange(a),n.resetColumnSizing=a=>{var r;n.setColumnSizing(a?{}:(r=n.initialState.columnSizing)!=null?r:{})},n.resetHeaderSizeInfo=a=>{var r;n.setColumnSizingInfo(a?ka():(r=n.initialState.columnSizingInfo)!=null?r:ka())},n.getTotalSize=()=>{var a,r;return(a=(r=n.getHeaderGroups()[0])==null?void 0:r.headers.reduce((o,l)=>o+l.getSize(),0))!=null?a:0},n.getLeftTotalSize=()=>{var a,r;return(a=(r=n.getLeftHeaderGroups()[0])==null?void 0:r.headers.reduce((o,l)=>o+l.getSize(),0))!=null?a:0},n.getCenterTotalSize=()=>{var a,r;return(a=(r=n.getCenterHeaderGroups()[0])==null?void 0:r.headers.reduce((o,l)=>o+l.getSize(),0))!=null?a:0},n.getRightTotalSize=()=>{var a,r;return(a=(r=n.getRightHeaderGroups()[0])==null?void 0:r.headers.reduce((o,l)=>o+l.getSize(),0))!=null?a:0}}};let zi=null;function Db(){if(typeof zi=="boolean")return zi;let n=!1;try{const a={get passive(){return n=!0,!1}},r=()=>{};window.addEventListener("test",r,a),window.removeEventListener("test",r)}catch{n=!1}return zi=n,zi}function qa(n){return n.type==="touchstart"}const Tb={getInitialState:n=>({columnVisibility:{},...n}),getDefaultOptions:n=>({onColumnVisibilityChange:xt("columnVisibility",n)}),createColumn:(n,a)=>{n.toggleVisibility=r=>{n.getCanHide()&&a.setColumnVisibility(o=>({...o,[n.id]:r??!n.getIsVisible()}))},n.getIsVisible=()=>{var r,o;const l=n.columns;return(r=l.length?l.some(c=>c.getIsVisible()):(o=a.getState().columnVisibility)==null?void 0:o[n.id])!=null?r:!0},n.getCanHide=()=>{var r,o;return((r=n.columnDef.enableHiding)!=null?r:!0)&&((o=a.options.enableHiding)!=null?o:!0)},n.getToggleVisibilityHandler=()=>r=>{n.toggleVisibility==null||n.toggleVisibility(r.target.checked)}},createRow:(n,a)=>{n._getAllVisibleCells=Z(()=>[n.getAllCells(),a.getState().columnVisibility],r=>r.filter(o=>o.column.getIsVisible()),J(a.options,"debugRows")),n.getVisibleCells=Z(()=>[n.getLeftVisibleCells(),n.getCenterVisibleCells(),n.getRightVisibleCells()],(r,o,l)=>[...r,...o,...l],J(a.options,"debugRows"))},createTable:n=>{const a=(r,o)=>Z(()=>[o(),o().filter(l=>l.getIsVisible()).map(l=>l.id).join("_")],l=>l.filter(c=>c.getIsVisible==null?void 0:c.getIsVisible()),J(n.options,"debugColumns"));n.getVisibleFlatColumns=a("getVisibleFlatColumns",()=>n.getAllFlatColumns()),n.getVisibleLeafColumns=a("getVisibleLeafColumns",()=>n.getAllLeafColumns()),n.getLeftVisibleLeafColumns=a("getLeftVisibleLeafColumns",()=>n.getLeftLeafColumns()),n.getRightVisibleLeafColumns=a("getRightVisibleLeafColumns",()=>n.getRightLeafColumns()),n.getCenterVisibleLeafColumns=a("getCenterVisibleLeafColumns",()=>n.getCenterLeafColumns()),n.setColumnVisibility=r=>n.options.onColumnVisibilityChange==null?void 0:n.options.onColumnVisibilityChange(r),n.resetColumnVisibility=r=>{var o;n.setColumnVisibility(r?{}:(o=n.initialState.columnVisibility)!=null?o:{})},n.toggleAllColumnsVisible=r=>{var o;r=(o=r)!=null?o:!n.getIsAllColumnsVisible(),n.setColumnVisibility(n.getAllLeafColumns().reduce((l,c)=>({...l,[c.id]:r||!(c.getCanHide!=null&&c.getCanHide())}),{}))},n.getIsAllColumnsVisible=()=>!n.getAllLeafColumns().some(r=>!(r.getIsVisible!=null&&r.getIsVisible())),n.getIsSomeColumnsVisible=()=>n.getAllLeafColumns().some(r=>r.getIsVisible==null?void 0:r.getIsVisible()),n.getToggleAllColumnsVisibilityHandler=()=>r=>{var o;n.toggleAllColumnsVisible((o=r.target)==null?void 0:o.checked)}}};function kr(n,a){return a?a==="center"?n.getCenterVisibleLeafColumns():a==="left"?n.getLeftVisibleLeafColumns():n.getRightVisibleLeafColumns():n.getVisibleLeafColumns()}const Lb={createTable:n=>{n._getGlobalFacetedRowModel=n.options.getFacetedRowModel&&n.options.getFacetedRowModel(n,"__global__"),n.getGlobalFacetedRowModel=()=>n.options.manualFiltering||!n._getGlobalFacetedRowModel?n.getPreFilteredRowModel():n._getGlobalFacetedRowModel(),n._getGlobalFacetedUniqueValues=n.options.getFacetedUniqueValues&&n.options.getFacetedUniqueValues(n,"__global__"),n.getGlobalFacetedUniqueValues=()=>n._getGlobalFacetedUniqueValues?n._getGlobalFacetedUniqueValues():new Map,n._getGlobalFacetedMinMaxValues=n.options.getFacetedMinMaxValues&&n.options.getFacetedMinMaxValues(n,"__global__"),n.getGlobalFacetedMinMaxValues=()=>{if(n._getGlobalFacetedMinMaxValues)return n._getGlobalFacetedMinMaxValues()}}},Ob={getInitialState:n=>({globalFilter:void 0,...n}),getDefaultOptions:n=>({onGlobalFilterChange:xt("globalFilter",n),globalFilterFn:"auto",getColumnCanGlobalFilter:a=>{var r;const o=(r=n.getCoreRowModel().flatRows[0])==null||(r=r._getAllCellsByColumnId()[a.id])==null?void 0:r.getValue();return typeof o=="string"||typeof o=="number"}}),createColumn:(n,a)=>{n.getCanGlobalFilter=()=>{var r,o,l,c;return((r=n.columnDef.enableGlobalFilter)!=null?r:!0)&&((o=a.options.enableGlobalFilter)!=null?o:!0)&&((l=a.options.enableFilters)!=null?l:!0)&&((c=a.options.getColumnCanGlobalFilter==null?void 0:a.options.getColumnCanGlobalFilter(n))!=null?c:!0)&&!!n.accessorFn}},createTable:n=>{n.getGlobalAutoFilterFn=()=>Zt.includesString,n.getGlobalFilterFn=()=>{var a,r;const{globalFilterFn:o}=n.options;return rs(o)?o:o==="auto"?n.getGlobalAutoFilterFn():(a=(r=n.options.filterFns)==null?void 0:r[o])!=null?a:Zt[o]},n.setGlobalFilter=a=>{n.options.onGlobalFilterChange==null||n.options.onGlobalFilterChange(a)},n.resetGlobalFilter=a=>{n.setGlobalFilter(a?void 0:n.initialState.globalFilter)}}},Pb={getInitialState:n=>({expanded:{},...n}),getDefaultOptions:n=>({onExpandedChange:xt("expanded",n),paginateExpandedRows:!0}),createTable:n=>{let a=!1,r=!1;n._autoResetExpanded=()=>{var o,l;if(!a){n._queue(()=>{a=!0});return}if((o=(l=n.options.autoResetAll)!=null?l:n.options.autoResetExpanded)!=null?o:!n.options.manualExpanding){if(r)return;r=!0,n._queue(()=>{n.resetExpanded(),r=!1})}},n.setExpanded=o=>n.options.onExpandedChange==null?void 0:n.options.onExpandedChange(o),n.toggleAllRowsExpanded=o=>{o??!n.getIsAllRowsExpanded()?n.setExpanded(!0):n.setExpanded({})},n.resetExpanded=o=>{var l,c;n.setExpanded(o?{}:(l=(c=n.initialState)==null?void 0:c.expanded)!=null?l:{})},n.getCanSomeRowsExpand=()=>n.getPrePaginationRowModel().flatRows.some(o=>o.getCanExpand()),n.getToggleAllRowsExpandedHandler=()=>o=>{o.persist==null||o.persist(),n.toggleAllRowsExpanded()},n.getIsSomeRowsExpanded=()=>{const o=n.getState().expanded;return o===!0||Object.values(o).some(Boolean)},n.getIsAllRowsExpanded=()=>{const o=n.getState().expanded;return typeof o=="boolean"?o===!0:!(!Object.keys(o).length||n.getRowModel().flatRows.some(l=>!l.getIsExpanded()))},n.getExpandedDepth=()=>{let o=0;return(n.getState().expanded===!0?Object.keys(n.getRowModel().rowsById):Object.keys(n.getState().expanded)).forEach(c=>{const d=c.split(".");o=Math.max(o,d.length)}),o},n.getPreExpandedRowModel=()=>n.getSortedRowModel(),n.getExpandedRowModel=()=>(!n._getExpandedRowModel&&n.options.getExpandedRowModel&&(n._getExpandedRowModel=n.options.getExpandedRowModel(n)),n.options.manualExpanding||!n._getExpandedRowModel?n.getPreExpandedRowModel():n._getExpandedRowModel())},createRow:(n,a)=>{n.toggleExpanded=r=>{a.setExpanded(o=>{var l;const c=o===!0?!0:!!(o!=null&&o[n.id]);let d={};if(o===!0?Object.keys(a.getRowModel().rowsById).forEach(h=>{d[h]=!0}):d=o,r=(l=r)!=null?l:!c,!c&&r)return{...d,[n.id]:!0};if(c&&!r){const{[n.id]:h,...p}=d;return p}return o})},n.getIsExpanded=()=>{var r;const o=a.getState().expanded;return!!((r=a.options.getIsRowExpanded==null?void 0:a.options.getIsRowExpanded(n))!=null?r:o===!0||o!=null&&o[n.id])},n.getCanExpand=()=>{var r,o,l;return(r=a.options.getRowCanExpand==null?void 0:a.options.getRowCanExpand(n))!=null?r:((o=a.options.enableExpanding)!=null?o:!0)&&!!((l=n.subRows)!=null&&l.length)},n.getIsAllParentsExpanded=()=>{let r=!0,o=n;for(;r&&o.parentId;)o=a.getRow(o.parentId,!0),r=o.getIsExpanded();return r},n.getToggleExpandedHandler=()=>{const r=n.getCanExpand();return()=>{r&&n.toggleExpanded()}}}},Ya=0,Qa=10,$a=()=>({pageIndex:Ya,pageSize:Qa}),kb={getInitialState:n=>({...n,pagination:{...$a(),...n==null?void 0:n.pagination}}),getDefaultOptions:n=>({onPaginationChange:xt("pagination",n)}),createTable:n=>{let a=!1,r=!1;n._autoResetPageIndex=()=>{var o,l;if(!a){n._queue(()=>{a=!0});return}if((o=(l=n.options.autoResetAll)!=null?l:n.options.autoResetPageIndex)!=null?o:!n.options.manualPagination){if(r)return;r=!0,n._queue(()=>{n.resetPageIndex(),r=!1})}},n.setPagination=o=>{const l=c=>gn(o,c);return n.options.onPaginationChange==null?void 0:n.options.onPaginationChange(l)},n.resetPagination=o=>{var l;n.setPagination(o?$a():(l=n.initialState.pagination)!=null?l:$a())},n.setPageIndex=o=>{n.setPagination(l=>{let c=gn(o,l.pageIndex);const d=typeof n.options.pageCount>"u"||n.options.pageCount===-1?Number.MAX_SAFE_INTEGER:n.options.pageCount-1;return c=Math.max(0,Math.min(c,d)),{...l,pageIndex:c}})},n.resetPageIndex=o=>{var l,c;n.setPageIndex(o?Ya:(l=(c=n.initialState)==null||(c=c.pagination)==null?void 0:c.pageIndex)!=null?l:Ya)},n.resetPageSize=o=>{var l,c;n.setPageSize(o?Qa:(l=(c=n.initialState)==null||(c=c.pagination)==null?void 0:c.pageSize)!=null?l:Qa)},n.setPageSize=o=>{n.setPagination(l=>{const c=Math.max(1,gn(o,l.pageSize)),d=l.pageSize*l.pageIndex,h=Math.floor(d/c);return{...l,pageIndex:h,pageSize:c}})},n.setPageCount=o=>n.setPagination(l=>{var c;let d=gn(o,(c=n.options.pageCount)!=null?c:-1);return typeof d=="number"&&(d=Math.max(-1,d)),{...l,pageCount:d}}),n.getPageOptions=Z(()=>[n.getPageCount()],o=>{let l=[];return o&&o>0&&(l=[...new Array(o)].fill(null).map((c,d)=>d)),l},J(n.options,"debugTable")),n.getCanPreviousPage=()=>n.getState().pagination.pageIndex>0,n.getCanNextPage=()=>{const{pageIndex:o}=n.getState().pagination,l=n.getPageCount();return l===-1?!0:l===0?!1:on.setPageIndex(o=>o-1),n.nextPage=()=>n.setPageIndex(o=>o+1),n.firstPage=()=>n.setPageIndex(0),n.lastPage=()=>n.setPageIndex(n.getPageCount()-1),n.getPrePaginationRowModel=()=>n.getExpandedRowModel(),n.getPaginationRowModel=()=>(!n._getPaginationRowModel&&n.options.getPaginationRowModel&&(n._getPaginationRowModel=n.options.getPaginationRowModel(n)),n.options.manualPagination||!n._getPaginationRowModel?n.getPrePaginationRowModel():n._getPaginationRowModel()),n.getPageCount=()=>{var o;return(o=n.options.pageCount)!=null?o:Math.ceil(n.getRowCount()/n.getState().pagination.pageSize)},n.getRowCount=()=>{var o;return(o=n.options.rowCount)!=null?o:n.getPrePaginationRowModel().rows.length}}},za=()=>({top:[],bottom:[]}),qb={getInitialState:n=>({rowPinning:za(),...n}),getDefaultOptions:n=>({onRowPinningChange:xt("rowPinning",n)}),createRow:(n,a)=>{n.pin=(r,o,l)=>{const c=o?n.getLeafRows().map(p=>{let{id:x}=p;return x}):[],d=l?n.getParentRows().map(p=>{let{id:x}=p;return x}):[],h=new Set([...d,n.id,...c]);a.setRowPinning(p=>{var x,v;if(r==="bottom"){var R,y;return{top:((R=p==null?void 0:p.top)!=null?R:[]).filter(j=>!(h!=null&&h.has(j))),bottom:[...((y=p==null?void 0:p.bottom)!=null?y:[]).filter(j=>!(h!=null&&h.has(j))),...Array.from(h)]}}if(r==="top"){var b,E;return{top:[...((b=p==null?void 0:p.top)!=null?b:[]).filter(j=>!(h!=null&&h.has(j))),...Array.from(h)],bottom:((E=p==null?void 0:p.bottom)!=null?E:[]).filter(j=>!(h!=null&&h.has(j)))}}return{top:((x=p==null?void 0:p.top)!=null?x:[]).filter(j=>!(h!=null&&h.has(j))),bottom:((v=p==null?void 0:p.bottom)!=null?v:[]).filter(j=>!(h!=null&&h.has(j)))}})},n.getCanPin=()=>{var r;const{enableRowPinning:o,enablePinning:l}=a.options;return typeof o=="function"?o(n):(r=o??l)!=null?r:!0},n.getIsPinned=()=>{const r=[n.id],{top:o,bottom:l}=a.getState().rowPinning,c=r.some(h=>o==null?void 0:o.includes(h)),d=r.some(h=>l==null?void 0:l.includes(h));return c?"top":d?"bottom":!1},n.getPinnedIndex=()=>{var r,o;const l=n.getIsPinned();if(!l)return-1;const c=(r=l==="top"?a.getTopRows():a.getBottomRows())==null?void 0:r.map(d=>{let{id:h}=d;return h});return(o=c==null?void 0:c.indexOf(n.id))!=null?o:-1}},createTable:n=>{n.setRowPinning=a=>n.options.onRowPinningChange==null?void 0:n.options.onRowPinningChange(a),n.resetRowPinning=a=>{var r,o;return n.setRowPinning(a?za():(r=(o=n.initialState)==null?void 0:o.rowPinning)!=null?r:za())},n.getIsSomeRowsPinned=a=>{var r;const o=n.getState().rowPinning;if(!a){var l,c;return!!((l=o.top)!=null&&l.length||(c=o.bottom)!=null&&c.length)}return!!((r=o[a])!=null&&r.length)},n._getPinnedRows=(a,r,o)=>{var l;return((l=n.options.keepPinnedRows)==null||l?(r??[]).map(d=>{const h=n.getRow(d,!0);return h.getIsAllParentsExpanded()?h:null}):(r??[]).map(d=>a.find(h=>h.id===d))).filter(Boolean).map(d=>({...d,position:o}))},n.getTopRows=Z(()=>[n.getRowModel().rows,n.getState().rowPinning.top],(a,r)=>n._getPinnedRows(a,r,"top"),J(n.options,"debugRows")),n.getBottomRows=Z(()=>[n.getRowModel().rows,n.getState().rowPinning.bottom],(a,r)=>n._getPinnedRows(a,r,"bottom"),J(n.options,"debugRows")),n.getCenterRows=Z(()=>[n.getRowModel().rows,n.getState().rowPinning.top,n.getState().rowPinning.bottom],(a,r,o)=>{const l=new Set([...r??[],...o??[]]);return a.filter(c=>!l.has(c.id))},J(n.options,"debugRows"))}},$b={getInitialState:n=>({rowSelection:{},...n}),getDefaultOptions:n=>({onRowSelectionChange:xt("rowSelection",n),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:n=>{n.setRowSelection=a=>n.options.onRowSelectionChange==null?void 0:n.options.onRowSelectionChange(a),n.resetRowSelection=a=>{var r;return n.setRowSelection(a?{}:(r=n.initialState.rowSelection)!=null?r:{})},n.toggleAllRowsSelected=a=>{n.setRowSelection(r=>{a=typeof a<"u"?a:!n.getIsAllRowsSelected();const o={...r},l=n.getPreGroupedRowModel().flatRows;return a?l.forEach(c=>{c.getCanSelect()&&(o[c.id]=!0)}):l.forEach(c=>{delete o[c.id]}),o})},n.toggleAllPageRowsSelected=a=>n.setRowSelection(r=>{const o=typeof a<"u"?a:!n.getIsAllPageRowsSelected(),l={...r};return n.getRowModel().rows.forEach(c=>{Xa(l,c.id,o,!0,n)}),l}),n.getPreSelectedRowModel=()=>n.getCoreRowModel(),n.getSelectedRowModel=Z(()=>[n.getState().rowSelection,n.getCoreRowModel()],(a,r)=>Object.keys(a).length?Ba(n,r):{rows:[],flatRows:[],rowsById:{}},J(n.options,"debugTable")),n.getFilteredSelectedRowModel=Z(()=>[n.getState().rowSelection,n.getFilteredRowModel()],(a,r)=>Object.keys(a).length?Ba(n,r):{rows:[],flatRows:[],rowsById:{}},J(n.options,"debugTable")),n.getGroupedSelectedRowModel=Z(()=>[n.getState().rowSelection,n.getSortedRowModel()],(a,r)=>Object.keys(a).length?Ba(n,r):{rows:[],flatRows:[],rowsById:{}},J(n.options,"debugTable")),n.getIsAllRowsSelected=()=>{const a=n.getFilteredRowModel().flatRows,{rowSelection:r}=n.getState();let o=!!(a.length&&Object.keys(r).length);return o&&a.some(l=>l.getCanSelect()&&!r[l.id])&&(o=!1),o},n.getIsAllPageRowsSelected=()=>{const a=n.getPaginationRowModel().flatRows.filter(l=>l.getCanSelect()),{rowSelection:r}=n.getState();let o=!!a.length;return o&&a.some(l=>!r[l.id])&&(o=!1),o},n.getIsSomeRowsSelected=()=>{var a;const r=Object.keys((a=n.getState().rowSelection)!=null?a:{}).length;return r>0&&r{const a=n.getPaginationRowModel().flatRows;return n.getIsAllPageRowsSelected()?!1:a.filter(r=>r.getCanSelect()).some(r=>r.getIsSelected()||r.getIsSomeSelected())},n.getToggleAllRowsSelectedHandler=()=>a=>{n.toggleAllRowsSelected(a.target.checked)},n.getToggleAllPageRowsSelectedHandler=()=>a=>{n.toggleAllPageRowsSelected(a.target.checked)}},createRow:(n,a)=>{n.toggleSelected=(r,o)=>{const l=n.getIsSelected();a.setRowSelection(c=>{var d;if(r=typeof r<"u"?r:!l,n.getCanSelect()&&l===r)return c;const h={...c};return Xa(h,n.id,r,(d=o==null?void 0:o.selectChildren)!=null?d:!0,a),h})},n.getIsSelected=()=>{const{rowSelection:r}=a.getState();return Ao(n,r)},n.getIsSomeSelected=()=>{const{rowSelection:r}=a.getState();return Za(n,r)==="some"},n.getIsAllSubRowsSelected=()=>{const{rowSelection:r}=a.getState();return Za(n,r)==="all"},n.getCanSelect=()=>{var r;return typeof a.options.enableRowSelection=="function"?a.options.enableRowSelection(n):(r=a.options.enableRowSelection)!=null?r:!0},n.getCanSelectSubRows=()=>{var r;return typeof a.options.enableSubRowSelection=="function"?a.options.enableSubRowSelection(n):(r=a.options.enableSubRowSelection)!=null?r:!0},n.getCanMultiSelect=()=>{var r;return typeof a.options.enableMultiRowSelection=="function"?a.options.enableMultiRowSelection(n):(r=a.options.enableMultiRowSelection)!=null?r:!0},n.getToggleSelectedHandler=()=>{const r=n.getCanSelect();return o=>{var l;r&&n.toggleSelected((l=o.target)==null?void 0:l.checked)}}}},Xa=(n,a,r,o,l)=>{var c;const d=l.getRow(a,!0);r?(d.getCanMultiSelect()||Object.keys(n).forEach(h=>delete n[h]),d.getCanSelect()&&(n[a]=!0)):delete n[a],o&&(c=d.subRows)!=null&&c.length&&d.getCanSelectSubRows()&&d.subRows.forEach(h=>Xa(n,h.id,r,o,l))};function Ba(n,a){const r=n.getState().rowSelection,o=[],l={},c=function(d,h){return d.map(p=>{var x;const v=Ao(p,r);if(v&&(o.push(p),l[p.id]=p),(x=p.subRows)!=null&&x.length&&(p={...p,subRows:c(p.subRows)}),v)return p}).filter(Boolean)};return{rows:c(a.rows),flatRows:o,rowsById:l}}function Ao(n,a){var r;return(r=a[n.id])!=null?r:!1}function Za(n,a,r){var o;if(!((o=n.subRows)!=null&&o.length))return!1;let l=!0,c=!1;return n.subRows.forEach(d=>{if(!(c&&!l)&&(d.getCanSelect()&&(Ao(d,a)?c=!0:l=!1),d.subRows&&d.subRows.length)){const h=Za(d,a);h==="all"?c=!0:(h==="some"&&(c=!0),l=!1)}}),l?"all":c?"some":!1}const Ja=/([0-9]+)/gm,zb=(n,a,r)=>Ad(vn(n.getValue(r)).toLowerCase(),vn(a.getValue(r)).toLowerCase()),Bb=(n,a,r)=>Ad(vn(n.getValue(r)),vn(a.getValue(r))),Vb=(n,a,r)=>Io(vn(n.getValue(r)).toLowerCase(),vn(a.getValue(r)).toLowerCase()),Ub=(n,a,r)=>Io(vn(n.getValue(r)),vn(a.getValue(r))),Gb=(n,a,r)=>{const o=n.getValue(r),l=a.getValue(r);return o>l?1:oIo(n.getValue(r),a.getValue(r));function Io(n,a){return n===a?0:n>a?1:-1}function vn(n){return typeof n=="number"?isNaN(n)||n===1/0||n===-1/0?"":String(n):typeof n=="string"?n:""}function Ad(n,a){const r=n.split(Ja).filter(Boolean),o=a.split(Ja).filter(Boolean);for(;r.length&&o.length;){const l=r.shift(),c=o.shift(),d=parseInt(l,10),h=parseInt(c,10),p=[d,h].sort();if(isNaN(p[0])){if(l>c)return 1;if(c>l)return-1;continue}if(isNaN(p[1]))return isNaN(d)?-1:1;if(d>h)return 1;if(h>d)return-1}return r.length-o.length}const Dr={alphanumeric:zb,alphanumericCaseSensitive:Bb,text:Vb,textCaseSensitive:Ub,datetime:Gb,basic:Hb},Kb={getInitialState:n=>({sorting:[],...n}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:n=>({onSortingChange:xt("sorting",n),isMultiSortEvent:a=>a.shiftKey}),createColumn:(n,a)=>{n.getAutoSortingFn=()=>{const r=a.getFilteredRowModel().flatRows.slice(10);let o=!1;for(const l of r){const c=l==null?void 0:l.getValue(n.id);if(Object.prototype.toString.call(c)==="[object Date]")return Dr.datetime;if(typeof c=="string"&&(o=!0,c.split(Ja).length>1))return Dr.alphanumeric}return o?Dr.text:Dr.basic},n.getAutoSortDir=()=>{const r=a.getFilteredRowModel().flatRows[0];return typeof(r==null?void 0:r.getValue(n.id))=="string"?"asc":"desc"},n.getSortingFn=()=>{var r,o;if(!n)throw new Error;return rs(n.columnDef.sortingFn)?n.columnDef.sortingFn:n.columnDef.sortingFn==="auto"?n.getAutoSortingFn():(r=(o=a.options.sortingFns)==null?void 0:o[n.columnDef.sortingFn])!=null?r:Dr[n.columnDef.sortingFn]},n.toggleSorting=(r,o)=>{const l=n.getNextSortingOrder(),c=typeof r<"u"&&r!==null;a.setSorting(d=>{const h=d==null?void 0:d.find(b=>b.id===n.id),p=d==null?void 0:d.findIndex(b=>b.id===n.id);let x=[],v,R=c?r:l==="desc";if(d!=null&&d.length&&n.getCanMultiSort()&&o?h?v="toggle":v="add":d!=null&&d.length&&p!==d.length-1?v="replace":h?v="toggle":v="replace",v==="toggle"&&(c||l||(v="remove")),v==="add"){var y;x=[...d,{id:n.id,desc:R}],x.splice(0,x.length-((y=a.options.maxMultiSortColCount)!=null?y:Number.MAX_SAFE_INTEGER))}else v==="toggle"?x=d.map(b=>b.id===n.id?{...b,desc:R}:b):v==="remove"?x=d.filter(b=>b.id!==n.id):x=[{id:n.id,desc:R}];return x})},n.getFirstSortDir=()=>{var r,o;return((r=(o=n.columnDef.sortDescFirst)!=null?o:a.options.sortDescFirst)!=null?r:n.getAutoSortDir()==="desc")?"desc":"asc"},n.getNextSortingOrder=r=>{var o,l;const c=n.getFirstSortDir(),d=n.getIsSorted();return d?d!==c&&((o=a.options.enableSortingRemoval)==null||o)&&(!(r&&(l=a.options.enableMultiRemove)!=null)||l)?!1:d==="desc"?"asc":"desc":c},n.getCanSort=()=>{var r,o;return((r=n.columnDef.enableSorting)!=null?r:!0)&&((o=a.options.enableSorting)!=null?o:!0)&&!!n.accessorFn},n.getCanMultiSort=()=>{var r,o;return(r=(o=n.columnDef.enableMultiSort)!=null?o:a.options.enableMultiSort)!=null?r:!!n.accessorFn},n.getIsSorted=()=>{var r;const o=(r=a.getState().sorting)==null?void 0:r.find(l=>l.id===n.id);return o?o.desc?"desc":"asc":!1},n.getSortIndex=()=>{var r,o;return(r=(o=a.getState().sorting)==null?void 0:o.findIndex(l=>l.id===n.id))!=null?r:-1},n.clearSorting=()=>{a.setSorting(r=>r!=null&&r.length?r.filter(o=>o.id!==n.id):[])},n.getToggleSortingHandler=()=>{const r=n.getCanSort();return o=>{r&&(o.persist==null||o.persist(),n.toggleSorting==null||n.toggleSorting(void 0,n.getCanMultiSort()?a.options.isMultiSortEvent==null?void 0:a.options.isMultiSortEvent(o):!1))}}},createTable:n=>{n.setSorting=a=>n.options.onSortingChange==null?void 0:n.options.onSortingChange(a),n.resetSorting=a=>{var r,o;n.setSorting(a?[]:(r=(o=n.initialState)==null?void 0:o.sorting)!=null?r:[])},n.getPreSortedRowModel=()=>n.getGroupedRowModel(),n.getSortedRowModel=()=>(!n._getSortedRowModel&&n.options.getSortedRowModel&&(n._getSortedRowModel=n.options.getSortedRowModel(n)),n.options.manualSorting||!n._getSortedRowModel?n.getPreSortedRowModel():n._getSortedRowModel())}},Wb=[pb,Tb,Ib,Fb,xb,vb,Lb,Ob,Kb,Eb,Pb,kb,qb,$b,Mb];function Yb(n){var a,r;const o=[...Wb,...(a=n._features)!=null?a:[]];let l={_features:o};const c=l._features.reduce((y,b)=>Object.assign(y,b.getDefaultOptions==null?void 0:b.getDefaultOptions(l)),{}),d=y=>l.options.mergeOptions?l.options.mergeOptions(c,y):{...c,...y};let p={...{},...(r=n.initialState)!=null?r:{}};l._features.forEach(y=>{var b;p=(b=y.getInitialState==null?void 0:y.getInitialState(p))!=null?b:p});const x=[];let v=!1;const R={_features:o,options:{...c,...n},initialState:p,_queue:y=>{x.push(y),v||(v=!0,Promise.resolve().then(()=>{for(;x.length;)x.shift()();v=!1}).catch(b=>setTimeout(()=>{throw b})))},reset:()=>{l.setState(l.initialState)},setOptions:y=>{const b=gn(y,l.options);l.options=d(b)},getState:()=>l.options.state,setState:y=>{l.options.onStateChange==null||l.options.onStateChange(y)},_getRowId:(y,b,E)=>{var j;return(j=l.options.getRowId==null?void 0:l.options.getRowId(y,b,E))!=null?j:`${E?[E.id,b].join("."):b}`},getCoreRowModel:()=>(l._getCoreRowModel||(l._getCoreRowModel=l.options.getCoreRowModel(l)),l._getCoreRowModel()),getRowModel:()=>l.getPaginationRowModel(),getRow:(y,b)=>{let E=(b?l.getPrePaginationRowModel():l.getRowModel()).rowsById[y];if(!E&&(E=l.getCoreRowModel().rowsById[y],!E))throw new Error;return E},_getDefaultColumnDef:Z(()=>[l.options.defaultColumn],y=>{var b;return y=(b=y)!=null?b:{},{header:E=>{const j=E.header.column.columnDef;return j.accessorKey?j.accessorKey:j.accessorFn?j.id:null},cell:E=>{var j,D;return(j=(D=E.renderValue())==null||D.toString==null?void 0:D.toString())!=null?j:null},...l._features.reduce((E,j)=>Object.assign(E,j.getDefaultColumnDef==null?void 0:j.getDefaultColumnDef()),{}),...y}},J(n,"debugColumns")),_getColumnDefs:()=>l.options.columns,getAllColumns:Z(()=>[l._getColumnDefs()],y=>{const b=function(E,j,D){return D===void 0&&(D=0),E.map(F=>{const q=hb(l,F,D,j),$=F;return q.columns=$.columns?b($.columns,q,D+1):[],q})};return b(y)},J(n,"debugColumns")),getAllFlatColumns:Z(()=>[l.getAllColumns()],y=>y.flatMap(b=>b.getFlatColumns()),J(n,"debugColumns")),_getAllFlatColumnsById:Z(()=>[l.getAllFlatColumns()],y=>y.reduce((b,E)=>(b[E.id]=E,b),{}),J(n,"debugColumns")),getAllLeafColumns:Z(()=>[l.getAllColumns(),l._getOrderColumnsFn()],(y,b)=>{let E=y.flatMap(j=>j.getLeafColumns());return b(E)},J(n,"debugColumns")),getColumn:y=>l._getAllFlatColumnsById()[y]};Object.assign(l,R);for(let y=0;yZ(()=>[n.options.data],a=>{const r={rows:[],flatRows:[],rowsById:{}},o=function(l,c,d){c===void 0&&(c=0);const h=[];for(let x=0;xn._autoResetPageIndex()))}function Fd(n,a,r){return r.options.filterFromLeafRows?Qb(n,a,r):Xb(n,a,r)}function Qb(n,a,r){var o;const l=[],c={},d=(o=r.options.maxLeafRowFilterDepth)!=null?o:100,h=function(p,x){x===void 0&&(x=0);const v=[];for(let y=0;yZ(()=>[n.getPreFilteredRowModel(),n.getState().columnFilters,n.getState().globalFilter,n.getFilteredRowModel()],(r,o,l)=>{if(!r.rows.length||!(o!=null&&o.length)&&!l)return r;const c=[...o.map(h=>h.id).filter(h=>h!==a),l?"__global__":void 0].filter(Boolean),d=h=>{for(let p=0;pZ(()=>{var r;return[(r=n.getColumn(a))==null?void 0:r.getFacetedRowModel()]},r=>{if(!r)return new Map;let o=new Map;for(let c=0;cZ(()=>[n.getPreFilteredRowModel(),n.getState().columnFilters,n.getState().globalFilter],(a,r,o)=>{if(!a.rows.length||!(r!=null&&r.length)&&!o){for(let y=0;y{var b;const E=n.getColumn(y.id);if(!E)return;const j=E.getFilterFn();j&&l.push({id:y.id,filterFn:j,resolvedValue:(b=j.resolveFilterValue==null?void 0:j.resolveFilterValue(y.value))!=null?b:y.value})});const d=(r??[]).map(y=>y.id),h=n.getGlobalFilterFn(),p=n.getAllLeafColumns().filter(y=>y.getCanGlobalFilter());o&&h&&p.length&&(d.push("__global__"),p.forEach(y=>{var b;c.push({id:y.id,filterFn:h,resolvedValue:(b=h.resolveFilterValue==null?void 0:h.resolveFilterValue(o))!=null?b:o})}));let x,v;for(let y=0;y{b.columnFiltersMeta[j]=D})}if(c.length){for(let E=0;E{b.columnFiltersMeta[j]=D})){b.columnFilters.__global__=!0;break}}b.columnFilters.__global__!==!0&&(b.columnFilters.__global__=!1)}}const R=y=>{for(let b=0;bn._autoResetPageIndex()))}function tw(){return n=>Z(()=>[n.getState().sorting,n.getPreSortedRowModel()],(a,r)=>{if(!r.rows.length||!(a!=null&&a.length))return r;const o=n.getState().sorting,l=[],c=o.filter(p=>{var x;return(x=n.getColumn(p.id))==null?void 0:x.getCanSort()}),d={};c.forEach(p=>{const x=n.getColumn(p.id);x&&(d[p.id]={sortUndefined:x.columnDef.sortUndefined,invertSorting:x.columnDef.invertSorting,sortingFn:x.getSortingFn()})});const h=p=>{const x=p.map(v=>({...v}));return x.sort((v,R)=>{for(let b=0;b{var R;l.push(v),(R=v.subRows)!=null&&R.length&&(v.subRows=h(v.subRows))}),x};return{rows:h(r.rows),flatRows:l,rowsById:r.rowsById}},J(n.options,"debugTable","getSortedRowModel",()=>n._autoResetPageIndex()))}/** * react-table * * Copyright (c) TanStack @@ -144,23 +144,23 @@ var P_=Object.defineProperty;var k_=(n,a,r)=>a in n?P_(n,a,{enumerable:!0,config * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function Gi(n,a){return n?nw(n)?M.createElement(n,a):n:null}function nw(n){return rw(n)||typeof n=="function"||iw(n)}function rw(n){return typeof n=="function"&&(()=>{const a=Object.getPrototypeOf(n);return a.prototype&&a.prototype.isReactComponent})()}function iw(n){return typeof n=="object"&&typeof n.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(n.$$typeof.description)}function Md(n){const a={state:{},onStateChange:()=>{},renderFallbackValue:null,...n},[r]=M.useState(()=>({current:Yb(a)})),[o,l]=M.useState(()=>r.current.initialState);return r.current.setOptions(c=>({...c,...n,state:{...o,...n.state},onStateChange:d=>{l(d),n.onStateChange==null||n.onStateChange(d)}})),r.current}const sw=({buttonText:n,title:a="",content:r,className:o=""})=>i.jsx("div",{className:`flex items-baseline justify-center mr-4 font-medium ${o}`,children:i.jsxs(rr,{children:[i.jsx(Dc,{asChild:!0,children:i.jsxs(G,{variant:"link",className:"inline-flex items-center font-medium group",children:[i.jsx("span",{className:"underline-offset-4 group-hover:underline",children:n}),i.jsx(V_,{className:"w-4 h-4 ml-1 text-muted-foreground"})]})}),i.jsxs(ir,{className:"sm:max-w-[425px]",children:[i.jsx(sr,{children:i.jsx(ar,{children:a})}),i.jsxs(no,{className:"grid gap-4 py-2",children:[r,i.jsx(or,{children:i.jsx(Vi,{asChild:!0,children:i.jsx(G,{type:"button",children:w("common.close")})})})]})]})]})});function aw(n){let o=0;for(let v=0;v>v*8&255;l+=("00"+R.toString(16)).substr(-2)}const c=parseInt(l.substr(1,2),16),d=parseInt(l.substr(3,2),16),h=parseInt(l.substr(5,2),16),p=`#${(c*.7|0).toString(16).padStart(2,"0")}${(d*.7|0).toString(16).padStart(2,"0")}${(h*.7|0).toString(16).padStart(2,"0")}`,x=`#${Math.min(255,Math.floor(c+(255-c)*.7)).toString(16).padStart(2,"0")}${Math.min(255,Math.floor(d+(255-d)*.7)).toString(16).padStart(2,"0")}${Math.min(255,Math.floor(h+(255-h)*.7)).toString(16).padStart(2,"0")}`;return[p,x]}const Dd=({label:n,className:a})=>{const[r,o]=aw(n);return i.jsx(ro,{className:a,style:a?{}:{backgroundColor:o,color:r},children:n})};function Td({table:n,header:a,className:r}){return a.column.getCanSort()?i.jsx("div",{className:he("flex items-center space-x-2",r),children:i.jsxs(Yi,{children:[i.jsx(Qi,{asChild:!0,children:i.jsxs(G,{"aria-label":a.column.getIsSorted()==="desc"?w("common.sort_desc_description"):a.column.getIsSorted()==="asc"?w("common.sort_asc_description"):w("sort_none_description"),size:"sm",variant:"ghost",className:"-ml-3 h-8 data-[state=open]:bg-accent font-bold text-muted-foreground",children:[Gi(a.column.columnDef.header,a.getContext()),a.column.getIsSorted()==="desc"?i.jsx(_c,{className:"w-4 h-4 ml-2","aria-hidden":"true"}):a.column.getIsSorted()==="asc"?i.jsx(bc,{className:"w-4 h-4 ml-2","aria-hidden":"true"}):i.jsx(q0,{className:"w-4 h-4 ml-2 text-muted-foreground/30","aria-hidden":"true"})]})}),i.jsxs(Xi,{align:"start",children:[a.column.getCanSort()&&i.jsxs(i.Fragment,{children:[i.jsxs(Lr,{onClick:()=>a.column.toggleSorting(!1),"aria-label":w("common.sort_asc"),children:[i.jsx(bc,{className:"mr-2 h-3.5 w-3.5 text-muted-foreground/70","aria-hidden":"true"}),w("common.sort_asc")]}),i.jsxs(Lr,{onClick:()=>a.column.toggleSorting(!0),"aria-label":w("common.sort_desc"),children:[i.jsx(_c,{className:"mr-2 h-3.5 w-3.5 text-muted-foreground/70","aria-hidden":"true"}),w("common.sort_desc")]})]}),a.column.getCanSort()&&a.column.getCanHide()&&i.jsx(io,{}),a.column.getCanHide()&&i.jsxs(Lr,{onClick:()=>a.column.toggleVisibility(!1),"aria-label":w("Hide"),children:[i.jsx(gd,{className:"mr-2 h-3.5 w-3.5 text-muted-foreground/70","aria-hidden":"true"}),w("Hide")]})]})]})}):i.jsxs(i.Fragment,{children:[i.jsx("div",{className:he("data-[state=open]:bg-accent tracking-wide text-ellipsis",r),children:a.isPlaceholder?null:Gi(a.column.columnDef.header,a.getContext())}),!1]})}function ow({table:n,className:a,enablePageSizeSelector:r=!0,visible:o="auto"}){const l=M.useMemo(()=>o===!0,[o]),c=M.useMemo(()=>o==="auto",[o]);return!l||c&&n.getPageCount()<1?null:i.jsxs("div",{className:a,children:[i.jsx("div",{className:"flex-1 text-base text-muted-foreground",children:n.getSelectedRowModel().rows.length>0&&i.jsx(i.Fragment,{children:w("common.rows_selected_of_total",{count:n.getFilteredSelectedRowModel().rows.length,total:n.getFilteredRowModel().rows.length})})}),i.jsxs("div",{className:"flex justify-between space-x-6 lg:space-x-8",children:[r&&i.jsxs("div",{className:"flex items-center space-x-2 grow",children:[i.jsx("p",{className:"text-sm font-medium",children:w("common.rows_per_page")}),i.jsxs(so,{value:`${n.getState().pagination.pageSize}`,onValueChange:d=>{n.setPageSize(Number(d))},children:[i.jsx(ao,{className:"h-8 w-[70px]",children:i.jsx(oo,{placeholder:n.getState().pagination.pageSize})}),i.jsx(lo,{side:"top",children:U_.map(d=>i.jsx(Or,{value:`${d}`,children:d},d))})]})]}),i.jsxs("div",{className:he("flex space-x-2 flex-1",r?"justify-end":"justify-between"),children:[i.jsx("div",{className:"flex w-[150px] items-center justify-start",children:i.jsx("p",{className:"text-sm font-medium ",children:w("common.num_page_of_total",{count:n.getState().pagination.pageIndex+1,total:n.getPageCount()})})}),i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsxs(G,{type:"button",variant:"outline",className:"hidden w-8 h-8 p-0 lg:flex",onClick:()=>n.setPageIndex(G_),disabled:!n.getCanPreviousPage(),children:[i.jsx("span",{className:"sr-only",children:w("common.go_to_first_page")}),i.jsx($0,{className:"w-4 h-4"})]}),i.jsxs(G,{type:"button",variant:"outline",className:"w-8 h-8 p-0",onClick:()=>n.previousPage(),disabled:!n.getCanPreviousPage(),children:[i.jsx("span",{className:"sr-only",children:w("common.go_to_prev_page")}),i.jsx(H_,{className:"w-4 h-4"})]}),i.jsxs(G,{type:"button",variant:"outline",className:"w-8 h-8 p-0",onClick:()=>n.nextPage(),disabled:!n.getCanNextPage(),children:[i.jsx("span",{className:"sr-only",children:w("common.go_to_next_page")}),i.jsx(K_,{className:"w-4 h-4"})]}),i.jsxs(G,{type:"button",variant:"outline",className:"hidden w-8 h-8 p-0 lg:flex",onClick:()=>n.setPageIndex(n.getPageCount()+1),disabled:!n.getCanNextPage(),children:[i.jsx("span",{className:"sr-only",children:w("common.go_to_last_page")}),i.jsx(z0,{className:"w-4 h-4"})]})]})]})]})]})}function is({table:n,title:a,description:r,caption:o,paginationOptions:l,headerOptions:c={visible:!0},children:d,className:h,contentClassName:p,footerClassName:x,rowClassName:v,cellClassName:R,onRowClick:y,activeRowIndex:b}){var j;const E=c==null?void 0:c.visible;return i.jsxs(Le,{className:h,children:[(a||r)&&i.jsxs(pt,{className:"pb-0",children:[i.jsx(Ge,{children:a}),i.jsx(Ze,{children:r})]}),i.jsxs(Oe,{className:he("pt-6",p),children:[d&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"flex space-x-2",children:d}),i.jsx(mn,{className:"my-4"})]}),i.jsxs(uo,{children:[typeof o<"u"&&i.jsx(W_,{children:o}),E&&n.getHeaderGroups().length&&i.jsx(co,{children:n.getHeaderGroups().map(D=>i.jsx(hn,{className:v,children:D.headers.map(F=>i.jsx(fo,{colSpan:F.colSpan,style:{width:F.getSize()===Number.MAX_SAFE_INTEGER?"auto":F.getSize()},children:i.jsx(Td,{table:n,header:F})},F.id))},D.id))}),i.jsx(go,{children:(j=n.getRowModel().rows)!=null&&j.length?n.getRowModel().rows.map(D=>i.jsx(hn,{onClick:()=>{y&&y(D)},tabIndex:0,"data-state":D.getIsSelected()&&"selected",className:he(D.getIsSelected()||b===D.index?"bg-accent cursor-pointer hover:bg-accent":"cursor-pointer",v),children:D.getVisibleCells().map(F=>i.jsx(qr,{className:R,style:{width:F.column.getSize()===Number.MAX_SAFE_INTEGER?"auto":F.column.getSize()},children:Gi(F.column.columnDef.cell,F.getContext())},F.id))},D.id)):i.jsx(hn,{className:v,children:i.jsx(qr,{className:he("h-24 text-center",R),colSpan:n.getAllColumns.length,children:"No hay datos para mostrar"})})})]})]}),i.jsx(Dt,{className:x,children:i.jsx(ow,{className:"flex-1",table:n,...l})})]})}function lw({actions:n,rowContext:a}){return i.jsxs(Yi,{children:[i.jsx(Qi,{asChild:!0,children:i.jsxs(G,{size:"icon",variant:"outline",className:"w-8 h-8",children:[i.jsx(G0,{className:"h-3.5 w-3.5"}),i.jsx("span",{className:"sr-only",children:w("common.open_menu")})]})}),i.jsxs(Xi,{align:"end",children:[i.jsxs(Tc,{children:[w("common.actions")," "]}),n&&n(a).map((r,o)=>r.label==="-"?i.jsx(io,{},o):i.jsxs(Lr,{onClick:l=>r.onClick?r.onClick(a,l):null,children:[r.icon&&i.jsx(i.Fragment,{children:r.icon}),r.label,r.shortcut&&i.jsx(Y_,{children:r.shortcut})]},o))]})]})}function uw(){return{id:"select",header:({table:n})=>i.jsx(Ui,{id:"select-all",checked:n.getIsAllPageRowsSelected()||n.getIsSomePageRowsSelected()&&"indeterminate",onCheckedChange:a=>n.toggleAllPageRowsSelected(!!a),"aria-label":"Seleccionar todo",className:"translate-y-[2px]"}),cell:({row:n})=>i.jsx(Ui,{id:`select-row-${n.id}`,checked:n.getIsSelected(),onCheckedChange:a=>{n.toggleSelected(!!a)},"aria-label":"Seleccionar file",className:"translate-y-[2px]"}),enableSorting:!1,enableHiding:!1}}function ss({columnCount:n,rowCount:a=10,searchableColumnCount:r=0,filterableColumnCount:o=0,showViewOptions:l=!0,cellWidths:c=["auto"],withPagination:d=!0,shrinkZero:h=!1,className:p,...x}){return i.jsxs("div",{className:he("w-full space-y-2.5 overflow-auto",p),...x,children:[i.jsxs("div",{className:"flex items-center justify-between w-full p-1 space-x-2 overflow-auto",children:[i.jsxs("div",{className:"flex items-center flex-1 space-x-2",children:[r>0?Array.from({length:r}).map((v,R)=>i.jsx(ut,{className:"w-40 h-7 lg:w-60"},R)):null,o>0?Array.from({length:o}).map((v,R)=>i.jsx(ut,{className:"h-7 w-[4.5rem] border-dashed"},R)):null]}),l?i.jsx(ut,{className:"ml-auto hidden h-7 w-[4.5rem] lg:flex"}):null]}),i.jsx("div",{className:"border rounded-md",children:i.jsxs(uo,{children:[i.jsx(co,{children:Array.from({length:1}).map((v,R)=>i.jsx(hn,{className:"hover:bg-transparent",children:Array.from({length:n}).map((y,b)=>i.jsx(fo,{style:{width:c[b],minWidth:h?c[b]:"auto"},children:i.jsx(ut,{className:"w-full h-6"})},b))},R))}),i.jsx(go,{children:Array.from({length:a}).map((v,R)=>i.jsx(hn,{className:"hover:bg-transparent",children:Array.from({length:n}).map((y,b)=>i.jsx(qr,{style:{width:c[b],minWidth:h?c[b]:"auto"},children:i.jsx(ut,{className:"w-full h-6"})},b))},R))})]})}),d?i.jsxs("div",{className:"flex items-center justify-between w-full gap-4 p-1 overflow-auto sm:gap-8",children:[i.jsx(ut,{className:"w-40 h-7 shrink-0"}),i.jsxs("div",{className:"flex items-center gap-4 sm:gap-6 lg:gap-8",children:[i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx(ut,{className:"w-24 h-7"}),i.jsx(ut,{className:"h-7 w-[4.5rem]"})]}),i.jsx("div",{className:"flex items-center justify-center text-sm font-medium",children:i.jsx(ut,{className:"w-20 h-7"})}),i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx(ut,{className:"hidden size-7 lg:block"}),i.jsx(ut,{className:"size-7"}),i.jsx(ut,{className:"size-7"}),i.jsx(ut,{className:"hidden size-7 lg:block"})]})]})]}):null]})}const as=({title:n="Esto está muy vacío",subtitle:a="Empieza solicitando la carga del catálogo",buttonText:r="Solicitar carga del catálogo",onButtonClick:o=()=>{},actions:l=()=>i.jsx(i.Fragment,{})})=>i.jsxs("div",{className:"text-center",children:[i.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:i.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"})}),i.jsx("h3",{className:"mt-2 text-lg font-semibold text-slate-900",children:n}),i.jsx("p",{className:"mt-1 text-base text-slate-500",children:a}),i.jsxs("div",{className:"items-center mt-6",children:[l&&i.jsx(i.Fragment,{children:l}),!l&&i.jsxs(G,{className:"my-4",onClick:o,children:[i.jsx(yo,{}),r]})]})]}),cw=vo("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"}}),Hi=n=>{const{name:a,label:r,hint:o,description:l,placeholder:c,className:d,disabled:h,defaultValue:p,rules:x,readOnly:v,scale:R,variant:y}=n,{control:b}=lr(),[E,j]=M.useState(""),D={input:F=>{if(typeof F!="object")return F;const q=$t.create(F);if(q.isFailure)throw q.error;const $=q.object.toString();return E.endsWith(",")?$.replace(/.0$/,","):$},output:(F,q,$)=>{const{value:Q}=$??{value:null};j(Q??"");const O=$t.createFromFormattedValue(Q);if(O.isFailure)throw O.error;return O.object.toObject()}};return i.jsx(mo,{defaultValue:p,control:b,name:a,disabled:h,rules:{max:100,min:0,...x},render:({field:F})=>{const q=D.input(F.value),$=h||F.disabled,Q=!!((x==null?void 0:x.required)??!1);return i.jsxs(ho,{className:he(d,"space-y-3"),children:[r&&i.jsx(po,{label:r,hint:o,required:Q}),i.jsx(xo,{children:i.jsx(Lc,{name:F.name,ref:F.ref,onBlur:F.onBlur,disabled:$,readOnly:v,className:he(cw({variant:y,className:d})),groupSeparator:".",decimalSeparator:",",placeholder:c,allowDecimals:R!==0,decimalsLimit:R,decimalScale:R,step:1,value:q,onValueChange:(O,k,H)=>F.onChange(D.output(O,k,H))})}),l&&i.jsx(_o,{children:l}),i.jsx(bo,{})]})}})},dw=vo("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"}}),fw=n=>{const{name:a,label:r,hint:o,description:l,placeholder:c,className:d,disabled:h,defaultValue:p,rules:x,readOnly:v,scale:R,variant:y}=n,{control:b}=lr(),[E,j]=M.useState(""),D={input:F=>{if(typeof F!="object")return F;const q=pn.create(F);if(q.isFailure)throw q.error;const $=q.object.toString();return E.endsWith(",")?$.replace(/.0$/,","):$},output:(F,q,$)=>{const{value:Q}=$??{value:null};j(Q??"");const O=pn.createFromFormattedValue(Q);if(O.isFailure)throw O.error;return O.object.toObject()}};return i.jsx(mo,{defaultValue:p,control:b,name:a,disabled:h,rules:x,render:({field:F})=>{const q=D.input(F.value),$=h||F.disabled,Q=!!((x==null?void 0:x.required)??!1);return i.jsxs(ho,{className:he(d,"space-y-3"),children:[r&&i.jsx(po,{label:r,hint:o,required:Q}),i.jsx(xo,{children:i.jsx(Lc,{name:F.name,ref:F.ref,onBlur:F.onBlur,disabled:$,readOnly:v,className:he(dw({variant:y,className:d})),groupSeparator:".",decimalSeparator:",",placeholder:c,allowDecimals:R!==0,decimalsLimit:R,decimalScale:R,step:1,value:q,onValueChange:(O,k,H)=>F.onChange(D.output(O,k,H))})}),l&&i.jsx(_o,{children:l}),i.jsx(bo,{})]})}})},gw=vo("",{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"}}),Fn=n=>{const{name:a,label:r,hint:o,description:l,placeholder:c,className:d,disabled:h,rules:p,required:x,type:v,variant:R}=n,{control:y}=lr();return i.jsx(mo,{control:y,name:a,disabled:h,rules:{required:x,...p},render:({field:b,fieldState:E})=>{const j=!!((p==null?void 0:p.required)??x);return i.jsxs(ho,{className:he(d,"space-y-3"),children:[r&&i.jsx(po,{label:r,hint:o,required:j}),i.jsx(xo,{className:"block",children:i.jsx(Zi,{type:v,placeholder:c,className:he(E.error?"border-destructive focus-visible:ring-destructive":"",gw({variant:R,className:d})),...b})}),l&&i.jsx(_o,{children:l}),i.jsx(bo,{})]})}})},mw=(n,a)=>{const r=M.useRef();return M.useEffect(()=>{r.current=n},[n,a]),r.current},Ld=(n,a,r,o)=>n.getFixedT(a,r,o),hw=(n,a,r,o)=>M.useCallback(Ld(n,a,r,o),[n,a,r,o]),Fo=(n,a={})=>{var Q,O,k,H;const{i18n:r}=a,{i18n:o,defaultNS:l}=M.useContext(Q_)||{},c=r||o||X_();if(c&&!c.reportNamespaces&&(c.reportNamespaces=new Z_),!c){gc(c,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const W=(se,ce)=>Ia(ce)?ce:t0(ce)&&Ia(ce.defaultValue)?ce.defaultValue:Array.isArray(se)?se[se.length-1]:se,B=[W,{},!1];return B.t=W,B.i18n={},B.ready=!1,B}(Q=c.options.react)!=null&&Q.wait&&gc(c,"DEPRECATED_OPTION","useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const d={...e0(),...c.options.react,...a},{useSuspense:h,keyPrefix:p}=d;let x=l||((O=c.options)==null?void 0:O.defaultNS);x=Ia(x)?[x]:x||["translation"],(H=(k=c.reportNamespaces).addUsedNamespaces)==null||H.call(k,x);const v=(c.isInitialized||c.initializedStoreOnce)&&x.every(W=>J_(W,c,d)),R=hw(c,a.lng||null,d.nsMode==="fallback"?x:x[0],p),y=()=>R,b=()=>Ld(c,a.lng||null,d.nsMode==="fallback"?x:x[0],p),[E,j]=M.useState(y);let D=x.join();a.lng&&(D=`${a.lng}${D}`);const F=mw(D),q=M.useRef(!0);M.useEffect(()=>{const{bindI18n:W,bindI18nStore:B}=d;q.current=!0,!v&&!h&&(a.lng?mc(c,a.lng,x,()=>{q.current&&j(b)}):hc(c,x,()=>{q.current&&j(b)})),v&&F&&F!==D&&q.current&&j(b);const se=()=>{q.current&&j(b)};return W&&(c==null||c.on(W,se)),B&&(c==null||c.store.on(B,se)),()=>{q.current=!1,c&&(W==null||W.split(" ").forEach(ce=>c.off(ce,se))),B&&c&&B.split(" ").forEach(ce=>c.store.off(ce,se))}},[c,D]),M.useEffect(()=>{q.current&&v&&j(y)},[c,p,v]);const $=[E,c,v];if($.t=E,$.i18n=c,$.ready=v,v||!v&&!h)return $;throw new Promise(W=>{a.lng?mc(c,a.lng,x,()=>W()):hc(c,x,()=>W())})};function pw(n=!1){const[a,r]=M.useState(n);return[a,()=>r(l=>!l)]}const Tn=()=>{const n=M.useContext(n0);if(n===null)throw new Error("useDataTableContext must be used within a DataTableProvider");return n};function os({data:n,columns:a,pageCount:r,enableSorting:o=!1,enableHiding:l=!1,enableRowSelection:c=!1,initialState:d,onPaginationChange:h,meta:p}){const{pagination:x,setPagination:v,sorting:R}=Tn(),[y,b]=An.useState({}),[E,j]=An.useState((d==null?void 0:d.columnVisibility)||{}),D=Q=>{if(typeof Q=="function"){const O=Q(x);v(O)}h&&h(Q)},F=Q=>{},q=M.useCallback(()=>{const Q=a;return c&&Q.unshift(uw()),Q},[a,c]);return{table:Md({data:n,columns:q(),pageCount:r??-1,meta:p,getCoreRowModel:Id(),initialState:d,state:{pagination:x,sorting:R,columnVisibility:E,rowSelection:y},enableRowSelection:c,onRowSelectionChange:b,manualSorting:!0,enableSorting:o,getSortedRowModel:tw(),onSortingChange:F,enableHiding:l,onColumnVisibilityChange:j,manualPagination:!0,onPaginationChange:D,manualFiltering:!0,getFilteredRowModel:ew(),getFacetedRowModel:Zb(),getFacetedUniqueValues:Jb(),debugTable:!1,debugHeaders:!1,debugColumns:!1,defaultColumn:{minSize:0,size:Number.MAX_SAFE_INTEGER,maxSize:Number.MAX_SAFE_INTEGER}})}}const xw=({setSize:n,setControllerCallback:a,setPercentageCallback:r,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 c=l.body,d=l.headers.get("content-encoding"),h=l.headers.get(d?"x-file-size":"content-length"),p=parseInt(h||"0",10);n(()=>p);let x=0;const v=new ReadableStream({start(R){a(R);const y=c.getReader();async function b(){return y.read().then(({done:E,value:j})=>E?R.close():(x+=(j==null?void 0:j.byteLength)||0,j&&R.enqueue(j),r({loaded:x,total:p}),b())).catch(E=>(o(E),y.cancel("Cancelled"),R.error(E)))}return b()}});return new Response(v)},Nc=(n,a,r)=>{const o=[n],l=new Blob(o,{type:r||"application/octet-stream"});if(typeof window.navigator.msSaveBlob<"u")return window.navigator.msSaveBlob(l,a);const c=window.URL&&window.URL.createObjectURL?window.URL.createObjectURL(l):window.webkitURL.createObjectURL(l),d=document.createElement("a");return d.style.display="none",d.href=c,d.setAttribute("download",a),typeof d.download>"u"&&d.setAttribute("target","_blank"),document.body.appendChild(d),d.click(),setTimeout(()=>{document.body.removeChild(d),window.URL.revokeObjectURL(c)},200)};function Rc({customHandleDownload:n,...a}={}){var Q;let r=!1;try{r=process?!!((Q=process==null?void 0:process.env)!=null&&Q.REACT_APP_DEBUG_MODE):!1}catch{r=!1}const[o,l]=M.useState(0),[c,d]=M.useState(0),[h,p]=M.useState(0),[x,v]=M.useState(null),[R,y]=M.useState(!1),b=M.useRef(null),E=M.useCallback(({loaded:O,total:k})=>{const H=Math.round(O/k*100);d(()=>H)},[]),j=M.useCallback(O=>{const k={"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:k[O.message]?k[O.message]:O.message}))},[]),D=M.useCallback(O=>{b.current=O},[]),F=M.useCallback(()=>{b.current&&b.current.error()},[]),q=M.useCallback(()=>{D(null),l(()=>0),d(()=>0),p(()=>0),y(()=>!1)},[D]),$=M.useCallback(async(O,k,H=0,W={})=>{if(R)return null;q(),v(()=>null),y(()=>!0);const B=setInterval(()=>l(rt=>rt+1),r?1:1e3),se=xw({setSize:p,setControllerCallback:D,setPercentageCallback:E,setErrorCallback:j}),ce=new AbortController,Y=setTimeout(()=>{H>0&&ce.abort()},H),Re=n||Nc;try{const rt=await fetch(O,{method:"GET",...a,...W,signal:ce.signal}),je=await se(rt).blob();Re(je,k),q()}catch(rt){q(),v(ee=>{const{message:je}=rt;return je!=="Failed to fetch"?{errorMessage:je}:ee}),clearTimeout(Y)}finally{clearInterval(B)}},[R,q,r,D,E,j,a,n]);return M.useMemo(()=>({elapsed:o,percentage:c,size:h,download:$,cancel:F,error:x,isInProgress:R,jsDownload:Nc}),[o,c,h,$,F,x,R])}const vw=()=>{const{i18n:n}=Fo();return Od({locale:n.language})},Od=n=>{const{locale:a}=n,r=M.useCallback(c=>{if(c==null)return"";const{amount:d,scale:h,currency_code:p}=c;return new Intl.NumberFormat(a??"ES",{style:"currency",currency:p,currencyDisplay:"symbol",useGrouping:!0,maximumFractionDigits:h}).format(d===null?0:pc({amount:d,scale:h}))},[a]),o=M.useCallback(c=>{if(c==null)return"";const{amount:d,scale:h}=c;return new Intl.NumberFormat("es",{minimumFractionDigits:h,useGrouping:!0}).format(d===null?0:pc({amount:d,scale:h}))},[a]),l=M.useCallback(c=>{if(c==null)return"";const{amount:d,scale:h}=c;return new Intl.NumberFormat(a,{style:"decimal",minimumFractionDigits:h}).format(d===null?0:d)},[a]);return{formatCurrency:r,formatNumber:o,formatPercentage:l}};function Pd(n){const[a,r]=M.useState(!1);return M.useEffect(()=>{function o(c){r(c.matches)}const l=matchMedia(n);return l.addEventListener("change",o),r(l.matches),()=>l.removeEventListener("change",o)},[n]),a}const _w=()=>{const n=M.useContext(r0);if(n===null)throw new Error("useWarnAboutChange must be used within a UnsavedWarnProvider");return n},Mo=({isDirty:n=!1,title:a=w("hooks.use_unsaved_changes_notifier.title"),subtitle:r=w("hooks.use_unsaved_changes_notifier.subtitle"),confirmText:o=w("hooks.use_unsaved_changes_notifier.confirm_text"),cancelText:l=w("hooks.use_unsaved_changes_notifier.cancel_text"),onConfirm:c,onCancel:d,type:h="warning"})=>{const p=i0(n),{show:x}=_w(),v=M.useCallback(()=>n?new Promise(R=>{x({title:a,subtitle:r,confirmText:o,cancelText:l,type:h,onConfirm:()=>{R(!0),c==null||c()},onCancel:()=>{R(!1),d==null||d()}})}):Promise.resolve(!0),[l,o,n,d,c,x,r,a,h]);return M.useEffect(()=>{p.state==="blocked"&&v().then(R=>{R?p.proceed():p.reset()})},[p,v]),M.useEffect(()=>(n&&(window.onbeforeunload=()=>r),()=>{window.onbeforeunload=null}),[n,r]),{confirm:v}},kd=n=>{const{isSubmitting:a,isLoading:r,isValidating:o}=s0();return i.jsx(wo,{disabled:a||r||o,...n})};kd.displayName="FormSubmitButton";const qd={"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}}"},Bi=[{code:"en",name:"English",flag:()=>i.jsx("span",{className:"fi fi-gb"})},{code:"es",name:"Español",flag:()=>i.jsx("span",{className:"fi fi-es"})}],oS=()=>{var R,y,b,E;const{t:n,i18n:a}=Fo(),[r,o]=M.useState(a.language),l=zt(),{toast:c}=vn();M.useEffect(()=>{const j=navigator.language.split("-")[0],D=Bi.find(F=>F.code===j);D&&d(D.code)},[]);const d=j=>{a.changeLanguage(j),o(j)},{mutate:h,status:p}=k0({onSuccess:j=>{const{success:D,error:F}=j;!D&&F&&x.setError("root",F),D&&l("/quotes",{replace:!0})},onError:j=>{const{message:D}=j;c({description:D,title:"Error"}),console.log(j)}}),x=Ji({mode:"onBlur",defaultValues:{email:"",password:""},resolver:Oc(In.object({email:In.string().email({tlds:{allow:!1}}).required(),password:In.string().min(4).alphanum().required()}),{messages:qd})}),v=async j=>{h({email:j.email,password:j.password},{})};return i.jsxs(a0,{variant:"full",className:"p-0 lg:grid lg:min-h-[600px] lg:grid-cols-2 xl:min-h-[800px] h-screen ",children:[i.jsx("div",{className:"flex items-center justify-center py-12 ",children:i.jsxs("div",{className:"mx-auto grid w-[650px] gap-6 relative ",children:[i.jsx("div",{className:"absolute flex space-x-2 top-4 right-4 ",children:i.jsxs(Yi,{children:[i.jsx(Qi,{asChild:!0,children:i.jsxs(G,{variant:"outline",className:"w-[140px] justify-start",children:[i.jsx("span",{className:"mr-2",children:(R=Bi.find(j=>j.code===r))==null?void 0:R.flag()}),(y=Bi.find(j=>j.code===r))==null?void 0:y.name,i.jsx(Pc,{className:"w-4 h-4 ml-auto opacity-50"})]})}),i.jsx(Xi,{className:"w-[140px]",children:Bi.map(j=>i.jsxs(Lr,{onSelect:()=>d(j.code),children:[i.jsx("span",{className:"mr-2",children:j.flag()}),j.name]},j.code))})]})}),i.jsxs(Le,{className:"px-12 py-6 bg-muted/50",children:[i.jsxs(pt,{children:[i.jsx(o0,{className:"inline-block m-auto mb-6 align-middle max-w-32"}),i.jsx(Ge,{children:i.jsx(le,{i18nKey:"login_page.title"})}),i.jsx(Ze,{children:i.jsx(le,{i18nKey:"login_page.description"})})]}),i.jsx(Oe,{children:i.jsx(es,{...x,children:i.jsx("form",{onSubmit:x.handleSubmit(v),children:i.jsxs("div",{className:"grid items-start gap-6",children:[i.jsx("div",{className:"grid gap-6",children:i.jsx(Fn,{required:!0,disabled:p==="pending",name:"email",label:n("login_page.email_label"),type:"email",placeholder:n("login_page.email_placeholder")})}),i.jsxs("div",{className:"grid gap-6",children:[i.jsx(Fn,{required:!0,disabled:p==="pending",name:"password",label:n("login_page.password_label"),type:"password"}),i.jsxs("div",{className:"mb-4 -mt-2 text-sm",children:[i.jsx(le,{i18nKey:"login_page.forgotten_password"}),i.jsx("br",{}),i.jsx(xc,{to:"https://uecko.com/distribuidores",className:"underline",children:i.jsx(le,{i18nKey:"login_page.contact_us"})})]})]}),((b=x.formState.errors.root)==null?void 0:b.message)&&i.jsxs(kc,{variant:"destructive",children:[i.jsx(dd,{className:"w-4 h-4"}),i.jsx(qc,{children:i.jsx(le,{i18nKey:"common.error"})}),i.jsx($c,{children:(E=x.formState.errors.root)==null?void 0:E.message})]}),i.jsx(kd,{className:"w-full",disabled:p==="pending"}),i.jsxs("div",{className:"mt-4 text-sm text-center",children:[i.jsx(le,{i18nKey:"login_page.become_dealer"}),i.jsx("br",{}),i.jsx(xc,{to:"https://uecko.com/distribuidores",className:"underline",children:i.jsx(le,{i18nKey:"login_page.contact_us"})}),i.jsx("br",{}),i.jsxs("p",{className:"mx-auto mt-4 -mb-6 text-xs text-muted-foreground/50",children:["v.","1.1.7"]})]})]})})})})]}),i.jsx("img",{className:"block w-11/12 mx-auto aspect-auto",src:"/img/uecko-footer_logos.jpg"})]})}),i.jsx("div",{className:"hidden bg-muted lg:block",children:i.jsx("img",{src:"/img/nara2.jpg",alt:"Image",width:"1920",height:"1080",className:"h-full w-full object-cover dark:brightness-[0.2] dark:grayscale"})})]})},bw=n=>{const{onSuccess:a,onError:r,...o}=n||{},l=Jt(),c=Mn(),{logout:d}=Ic(),h=zt(),{toast:p}=vn();return en({mutationKey:c().auth().action("logout").get(),mutationFn:d,onSuccess:async(x,v,R)=>{l.clear();const{success:y,redirectTo:b}=x;y&&b&&h(b||"/"),a&&a(x,v,R)},onError:(x,v,R)=>{const{message:y}=x;p({title:"Error",description:y,variant:"destructive"}),r&&r(x,v,R)},...o})},lS=()=>{const{mutate:n}=bw({});return M.useEffect(()=>n(),[n]),i.jsx(Dn,{})},ww=M.createContext(null),Sw=({children:n})=>{const[a,r]=zc();return i.jsx(ww.Provider,{value:{pagination:a,setPagination:r},children:n})},uS=({children:n})=>i.jsx(ts,{children:i.jsx(Sw,{children:i.jsxs(zr,{className:"catalog-layout",children:[i.jsx(Br,{}),i.jsx(Vr,{children:n})]})})}),$d=n=>{const a=$r(),r=Mn(),{pagination:o,searchTerm:l=[],enabled:c=!0,queryOptions:d}=n;return No({queryKey:r().data().resource("catalog").action("list").params(n).get(),queryFn:()=>a.getList({resource:"catalog",quickSearchTerm:l,pagination:o}),enabled:c,queryOptions:d})};function zd({table:n,className:a,children:r,...o}){const{globalFilter:l,isFiltered:c,setGlobalFilter:d,resetGlobalFilter:h}=Tn(),p=An.useRef(null),[x,v]=An.useState(""),R=An.useCallback(E=>{E.key==="Enter"&&x.trim()&&(E.preventDefault(),d(j=>[...j,x.trim()]),v("")),E.key==="Backspace"&&!x&&l.length>0&&(E.preventDefault(),d(j=>j.slice(0,-1)))},[l,x]),y=An.useCallback(E=>{d(j=>j.filter(D=>D!==E))},[]),b=An.useCallback(()=>{var E;x.trim()&&(d(j=>[...j,x.trim()]),v(""),(E=p.current)==null||E.focus())},[x]);return i.jsx(l0,{children:i.jsxs("div",{className:"w-full space-y-2",...o,children:[i.jsxs("div",{className:he("relative flex items-center flex-1 p-2 space-x-2 border rounded-md",c?"border-primary":"border-input"),children:[i.jsx(Bc,{className:he("w-4 h-4 text-gray-500")}),i.jsxs("div",{className:"flex flex-wrap items-center flex-1 gap-2",children:[l&&l.map(E=>i.jsxs(ro,{variant:"default",className:"px-1 text-base font-normal rounded-sm",children:[E,i.jsxs(G,{variant:"ghost",onClick:()=>y(E),className:"h-auto p-0 px-1 ml-1 hover:bg-transparent",children:[i.jsxs(He,{children:[i.jsx(Ke,{asChild:!0,children:i.jsx(Ua,{className:"w-4 h-4"})}),i.jsx(We,{children:i.jsx("p",{children:w("catalog.filter.badget_remove_tooltip")})})]}),i.jsx("span",{className:"sr-only",children:w("catalog.filter.badget_remove_tooltip")})]})]},E)),i.jsxs("div",{className:"flex-1 flex items-center min-w-[300px]",children:[i.jsx("input",{ref:p,value:x,onChange:E=>v(E.target.value),onKeyDown:R,placeholder:w("common.filter.input_placeholder"),className:"flex-1 w-full h-8 bg-transparent outline-none placeholder:text-muted-foreground"}),i.jsxs(tr,{children:[c&&i.jsxs(He,{children:[i.jsx(Ke,{asChild:!0,children:i.jsxs(G,{variant:"ghost",onClick:()=>h(),className:"h-8 px-2 transition-all lg:px-3 text-primary",children:[i.jsx(Ua,{className:"w-4 h-4 mr-2"}),w("common.filter.reset_filter")]})}),i.jsx(We,{children:i.jsx("p",{children:w("common.filter.reset_filter")})})]}),i.jsxs(He,{children:[i.jsx(Ke,{asChild:!0,children:i.jsxs(G,{variant:"default",size:"icon",disabled:!x,onClick:b,className:"w-8 h-8 p-0 transition-all",children:[i.jsx(yo,{className:"w-4 h-4"}),i.jsx("span",{className:"sr-only",children:w("common.filter.button_add_term")})]})}),i.jsx(We,{children:i.jsx("p",{children:w("common.filter.button_add_term_tooltip")})})]})]})]})]})]}),i.jsx("p",{className:"text-sm text-muted-foreground",children:w("common.filter.help_text")})]})})}const jw=()=>{const n=zt(),{pagination:a,globalFilter:r,isFiltered:o}=Tn(),{data:l,isPending:c,isError:d,error:h}=$d({pagination:{pageIndex:a.pageIndex,pageSize:a.pageSize},searchTerm:r}),p=M.useMemo(()=>[{id:"id",accessorKey:"id"},{id:"id_article",accessorKey:"id_article"},{id:"catalog_name",accessorKey:"catalog_name"},{id:"description",accessorKey:"description",header:()=>i.jsx(i.Fragment,{children:w("catalog.list.columns.description")})},{id:"points",accessorKey:"points",header:()=>i.jsx("div",{className:"text-right",children:w("catalog.list.columns.points")}),cell:({renderValue:v})=>i.jsx("div",{className:"text-right",children:v()})},{id:"retail_price",accessorKey:"retail_price",header:()=>i.jsx("div",{className:"text-right",children:w("catalog.list.columns.retail_price")}),cell:({row:v})=>{const R=Tt.create(v.original.retail_price).object;return i.jsx("div",{className:"text-right",children:R.toFormat()})}}],[]),{table:x}=os({data:(l==null?void 0:l.items)??[],columns:p,pageCount:(l==null?void 0:l.total_pages)??-1,initialState:{columnVisibility:{id:!1,id_article:!1,catalog_name:!1}}});return d?i.jsx(ur,{subtitle:h.message}):c?i.jsx(Le,{children:i.jsx(Oe,{children:i.jsx(ss,{columnCount:6,searchableColumnCount:1,filterableColumnCount:2,shrinkZero:!0})})}):(l==null?void 0:l.total_items)===0&&!o?i.jsx(as,{subtitle:"Empieza cargando los artículos del catálogo",buttonText:"",onButtonClick:()=>n("/catalog/add")}):i.jsx(is,{table:x,paginationOptions:{visible:!0},children:i.jsx(zd,{table:x})})},cS=()=>i.jsxs(nr,{children:[i.jsx("div",{className:"flex items-center justify-between space-y-2",children:i.jsx("div",{children:i.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:i.jsx(le,{i18nKey:"catalog.list.title"})})})}),i.jsx(jw,{})]}),dS=()=>{const{data:n,status:a}=u0();return i.jsxs(zr,{children:[i.jsx(Br,{}),i.jsx(Vr,{children:a==="success"?i.jsx("div",{className:"flex items-center",children:i.jsx("h1",{className:"text-lg font-semibold md:text-2xl",children:`${w("dashboard.welcome")}, ${n==null?void 0:n.name}`})}):i.jsx(ut,{className:"w-[100px] h-[20px] rounded-full"})})]})},fS=({children:n})=>i.jsx(ts,{children:i.jsxs(zr,{className:"dealers-layout",children:[i.jsx(Br,{}),i.jsx(Vr,{children:n})]})});function Cw({table:n}){return i.jsxs(Yi,{children:[i.jsx(Qi,{asChild:!0,children:i.jsxs(G,{variant:"outline",size:"sm",className:"hidden h-8 ml-auto lg:flex",children:[i.jsx(X0,{className:"w-4 h-4 mr-2"}),"Columnas"]})}),i.jsxs(Xi,{align:"end",className:"w-[150px]",children:[i.jsx(Tc,{children:"Columnas"}),i.jsx(io,{}),n.getAllColumns().filter(a=>typeof a.accessorFn<"u"&&a.getCanHide()).map(a=>i.jsx(c0,{className:"capitalize",checked:a.getIsVisible(),onCheckedChange:r=>a.toggleVisibility(!!r),children:i.jsx(i.Fragment,{children:a.columnDef.header})},a.id))]})]})}function Bd({table:n,className:a,children:r,...o}){const{globalFilter:l,isFiltered:c,setGlobalFilter:d,resetGlobalFilter:h}=Tn(),p=x=>{const v=String(x.target.value);v===""?h():d([v])};return i.jsxs("div",{className:he("flex w-full items-center justify-between space-x-2 overflow-auto p-1",a),...o,children:[i.jsxs("div",{className:"flex items-center flex-1 space-x-2",children:[i.jsx(Bc,{className:"w-4 h-4 text-gray-500"}),i.jsx(Zi,{placeholder:w("common.filter.input_placeholder"),value:l,onChange:p,className:he("h-8 w-full transition-all")},"global-filter"),c&&i.jsxs(G,{variant:"outline",onClick:()=>h(),className:"h-8 px-2 transition-all lg:px-3",children:[i.jsx(Ua,{className:"w-4 h-4 mr-2"}),w("common.filter.reset_filter")]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[r,n.options.enableHiding&&i.jsx(Cw,{table:n})]})]})}const yw=n=>{const a=$r(),r=Mn(),{pagination:o,searchTerm:l=void 0,enabled:c=!0,queryOptions:d}=n;return No({queryKey:r().data().resource("dealer").action("list").params(n).get(),queryFn:()=>a.getList({resource:"dealers",quickSearchTerm:l,pagination:o}),enabled:c,queryOptions:d})},Nw=()=>{const n=zt(),{pagination:a,globalFilter:r,isFiltered:o}=Tn(),{data:l,isPending:c,isError:d,error:h}=yw({pagination:{pageIndex:a.pageIndex,pageSize:a.pageSize},searchTerm:r}),p=M.useMemo(()=>[{id:"id",accessorKey:"id",enableResizing:!1,size:10},{id:"name",accessorKey:"name",enableResizing:!1,size:10}],[]),{table:x}=os({data:(l==null?void 0:l.items)??[],columns:p,pageCount:(l==null?void 0:l.total_pages)??-1});return d?i.jsx(ur,{subtitle:h.message}):c?i.jsx(Le,{children:i.jsx(Oe,{children:i.jsx(ss,{columnCount:6,searchableColumnCount:1,filterableColumnCount:2,shrinkZero:!0})})}):(l==null?void 0:l.total_items)===0&&!o?i.jsx(as,{subtitle:"Empieza cargando los artículos del catálogo",buttonText:"",onButtonClick:()=>n("/catalog/add")}):i.jsx(i.Fragment,{children:i.jsx(is,{table:x,paginationOptions:{visible:!0},children:i.jsx(Bd,{table:x})})})},gS=()=>i.jsx(nr,{children:i.jsx(Nw,{})}),mS=()=>i.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:i.jsxs("div",{className:"max-w-md mx-auto text-center",children:[i.jsx("div",{className:"w-12 h-12 mx-auto text-primary"}),i.jsx("h1",{className:"mt-4 text-3xl font-bold tracking-tight text-foreground sm:text-4xl",children:"Oops, page not found!"}),i.jsx("p",{className:"mt-4 text-muted-foreground",children:"The page you're looking for doesn't exist or has been moved."}),i.jsx("div",{className:"mt-6",children:i.jsx(G,{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:"Go to Homepage"})})]})}),Vd=M.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 Rw(n){return n.isSorting||n.wasDragging?f0(n):!0}function Ew({id:n,children:a,isActive:r=!1,onActivate:o}){const{attributes:l,isDragging:c,listeners:d,setNodeRef:h,setActivatorNodeRef:p,transform:x,transition:v}=d0({animateLayoutChanges:Rw,id:n}),R={transform:Ga.Translate.toString(x),transition:v},y=M.useMemo(()=>({attributes:l,listeners:d,ref:p,isDragging:c}),[l,c,d,p]);return i.jsx(Vd.Provider,{value:y,children:i.jsx(hn,{id:String(n),className:he(c?"opacity-60":"opacity-100",r?"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","m-0"),ref:h,style:R,onClick:o,onFocusCapture:o,children:a},n)})}const Aw=({className:n})=>{const{attributes:a,isDragging:r,listeners:o,ref:l}=M.useContext(Vd);return i.jsxs(G,{ref:l,onClick:c=>{c.preventDefault()},size:"icon",variant:"link",className:he(r?"cursor-grabbing":"cursor-grab","w-4 h-4 mt-2 text-ring hover:text-muted-foreground",n),...a,...o,children:[i.jsx(md,{className:"w-4 h-4"}),i.jsx("span",{className:"sr-only",children:w("common.move_row")})]})};function Iw(n,a={}){const{enableDragHandleColumn:r=!1,enableSelectionColumn:o=!1,enableActionsColumn:l=!1,rowActionFn:c=void 0}=a;return M.useMemo(()=>(r&&n.unshift({id:"row_drag_handle",header:()=>null,cell:()=>i.jsx(Aw,{}),enableSorting:!1,enableHiding:!1,size:40}),o&&n.unshift({id:"select",header:({table:d})=>i.jsx(Ui,{id:"select-all",checked:d.getIsAllPageRowsSelected()||d.getIsSomePageRowsSelected()&&"indeterminate",onCheckedChange:h=>d.toggleAllPageRowsSelected(!!h),"aria-label":"Seleccionar todo",className:"translate-y-[0px]"}),cell:({row:d})=>i.jsx(Ui,{id:`select-row-${d.id}`,checked:d.getIsSelected(),disabled:!d.getCanSelect(),onCheckedChange:d.getToggleSelectedHandler(),"aria-label":"Seleccionar fila",className:"mt-2"}),enableSorting:!1,enableHiding:!1,size:40}),l&&n.push({id:"row_actions",cell:d=>i.jsx(lw,{rowContext:d,actions:c}),enableSorting:!1,enableHiding:!1,size:48}),n),[l,r,o])}var Ud={exports:{}};(function(n,a){(function(r,o,l){n.exports=l(),n.exports.default=l()})("slugify",Xn,function(){var r=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(c,d){if(typeof c!="string")throw new Error("slugify: string argument expected");d=typeof d=="string"?{replacement:d}:d||{};var h=o[d.locale]||{},p=d.replacement===void 0?"-":d.replacement,x=d.trim===void 0?!0:d.trim,v=c.normalize().split("").reduce(function(R,y){var b=h[y];return b===void 0&&(b=r[y]),b===void 0&&(b=y),b===p&&(b=" "),R+b.replace(d.remove||/[^\w\s$*_+~.()'"!\-:@]+/g,"")},"");return d.strict&&(v=v.replace(/[^A-Za-z0-9\s]/g,"")),x&&(v=v.trim()),v=v.replace(/\s+/g,p),d.lower&&(v=v.toLowerCase()),v}return l.extend=function(c){Object.assign(r,c)},l})})(Ud);var Fw=Ud.exports;const Mw=g0(Fw),Ur=()=>{const n=$r(),a=Mn(),r=M.useCallback(c=>`${n.getApiUrl()}/quotes/${c}/report`,[n]),o=M.useCallback(c=>`quote-${Mw(c.reference,{lower:!0,strict:!0,locale:"en",trim:!0})}.pdf`,[]),l={useList:c=>{const d=$r(),h=Mn(),{pagination:p,status:x="draft",quickSearchTerm:v=void 0,enabled:R=!0,queryOptions:y}=c;return No({queryKey:h().data().resource("quotes").action("list").params(c).get(),queryFn:()=>d.getList({resource:"quotes",quickSearchTerm:v,filters:x!=="all"?[{field:"status",operator:"eq",value:x}]:[{field:"status",operator:"ne",value:"archived"}],pagination:p}),enabled:R,queryOptions:y})},useCreate:()=>{const c=Jt();return cb({mutationFn:d=>{const{date:h}=d,p=dn.generateNewID().object.toString();return n.createOne({resource:"quotes",data:{...d,date:new Date(h).toISOString().slice(0,10),status:"draft",id:p}})},onSuccess:()=>{c.invalidateQueries({queryKey:["data","default","quotes"]})}})},useUpdate:c=>{const d=Jt();return en({mutationKey:a().data().resource("quotes").action("one").id(c).params().get(),mutationFn:h=>n.updateOne({resource:"quotes",id:c,data:h}),onSuccess:()=>{d.invalidateQueries({queryKey:["data","default","quotes"]})}})},useSetStatus:()=>{const c=Jt();return en({mutationFn:d=>{const{id:h,newStatus:p}=d;return n.custom({url:`${n.getApiUrl()}/quotes/${h}/setStatus`,method:"put",data:{newStatus:p}})},onSuccess:()=>{c.invalidateQueries({queryKey:["data","default","quotes"]})}})},useDuplicate:()=>{const c=Jt();return en({mutationFn:d=>{const{id:h}=d;return n.custom({url:`${n.getApiUrl()}/quotes/${h}/duplicate`,method:"post"})},onSuccess:()=>{c.invalidateQueries({queryKey:["data","default","quotes"]})}})},useSentTo:c=>{const d=Jt();return en({mutationKey:a().data().resource("quotes").action("one").id(c).params().get(),mutationFn:h=>{const{sent_date:p}=h;return n.custom({url:`${n.getApiUrl()}/quotes/${c}/send`,method:"put",data:{sent_date:p}})},onSuccess:()=>{d.invalidateQueries({queryKey:["data","default","quotes"]})}})},useOne:(c,d)=>bd({queryKey:a().data().resource("quotes").action("one").id(c).params().get(),queryFn:()=>n.getOne({resource:"quotes",id:String(c)}),enabled:!!c,...d}),getQuotePDFDownloadURL:r,getQuotePDFFilename:o,useReport:()=>{const c=n.getApiAuthorization(),[d,h]=M.useState(void 0),{download:p,...x}=Rc({headers:{Authorization:c},customHandleDownload:M.useCallback(R=>{const y=[R],b=new Blob(y,{type:"application/octet-stream"});return h(b),!0},[h])}),v=M.useCallback(R=>p(l.getQuotePDFDownloadURL(R),""),[p]);return{...x,preview:v,report:d}},useDownloader:()=>{const c=n.getApiAuthorization(),d=Rc({headers:{Authorization:c}});return{...d,download:(p,x)=>{const v=l.getQuotePDFDownloadURL(p);return d.download(v,x)}}}};return l},hS=()=>{const n=zt(),{toast:a}=vn(),{useCreate:r}=Ur(),{mutate:o,isPending:l}=r(),c=M.useMemo(()=>({date:new Date(Date.now()).toUTCString(),customer_reference:"",customer_information:""}),[]),d=Ji({mode:"onBlur",defaultValues:c,resolver:Oc(In.object({customer_reference:In.string(),date:In.date().required(),customer_information:In.string().required()}),{messages:{es:qd}})}),{formState:h,reset:p,getValues:x,handleSubmit:v}=d,{isSubmitting:R,isDirty:y}=h;Mo({isDirty:y});const b=async E=>{try{o(E,{onError:j=>{console.debug(j),a({title:"Error",description:j.message,variant:"destructive"})},onSuccess:j=>{p(x()),a({title:"Cotización creada",variant:"default"}),n(`/quotes/edit/${j.id}`,{relative:"path"})}})}finally{}};return R?i.jsx(Dn,{title:"Guardando ajustes"}):l?i.jsx(Dn,{}):i.jsx(es,{...d,children:i.jsx("form",{onSubmit:v(b),children:i.jsxs("div",{className:"mx-auto grid max-w-[90rem] flex-1 auto-rows-max gap-6",children:[i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsx(Vc,{}),i.jsx("h1",{className:"flex-1 text-xl font-semibold tracking-tight shrink-0 whitespace-nowrap sm:grow-0",children:w("quotes.create.title")})]}),i.jsx("div",{className:"grid w-6/12 gap-6 mx-auto",children:i.jsxs(Ha,{className:"md:col-span-4",title:w("quotes.create.form_groups.general.title"),description:w("quotes.create.form_groups.general.desc"),footerActions:i.jsxs("div",{className:"flex items-stretch justify-between flex-1",children:[i.jsx(G,{size:"sm",variant:"outline",onClick:()=>n("/quotes"),children:w("common.discard")}),i.jsx(wo,{size:"sm",label:w("common.continue")})]}),children:[i.jsx(Fn,{required:!0,name:"customer_reference",label:w("quotes.form_fields.customer_reference.label"),description:w("quotes.form_fields.customer_reference.desc"),placeholder:w("quotes.form_fields.customer_reference.placeholder")}),i.jsx(Uc,{required:!0,label:w("quotes.form_fields.date.label"),description:w("quotes.form_fields.date.desc"),placeholder:w("quotes.form_fields.date.placeholder"),name:"date"}),i.jsx(mn,{}),i.jsx(qt,{rows:4,className:"row-span-2",name:"customer_information",required:!0,label:w("quotes.form_fields.customer_information.label"),description:w("quotes.form_fields.customer_information.desc"),placeholder:w("quotes.form_fields.customer_information.placeholder")})]})})]})})})},Va=(n,a=!1)=>{const{discount:r,tax:o,subtotal_price:l}=n||{},c=$t.create(r||{amount:null,scale:2});if(c.isFailure)throw c.error;const d=c.object,h=$t.create(o||{amount:null,scale:2});if(h.isFailure)throw h.error;const p=h.object,x=Tt.create(l||{amount:null,scale:2});if(x.isFailure)throw x.error;const v=a?Dw(n.items).convertScale(2):x.object,R=v.percentage(d.toNumber()).convertScale(2),y=v.subtract(R).convertScale(2),b=y.percentage(p.toNumber()).convertScale(2),E=y.add(b).convertScale(2);return{subtotal_price:v,discount:n.discount,discount_price:R,before_tax_price:y,tax:p,tax_price:b,total_price:E}},Dw=n=>{let a=Tt.create({amount:0,scale:2}).object;return n&&n.map(r=>{const o=eo(r);a=a.add(o.total_price)}),a},eo=n=>{const{quantity:a,unit_price:r,discount:o}=n||{};if((!a||a&&a.amount===null)&&(!r||r&&r.amount===null)&&(!o||o&&o.amount===null))return{quantity:pn.create({amount:null,scale:0}).object,unit_price:Tt.create({amount:null,scale:2}).object,subtotal_price:Tt.create({amount:null,scale:2}).object,discount:$t.create({amount:null,scale:2}).object,total_price:Tt.create({amount:null,scale:2}).object};const l=pn.create(a);if(l.isFailure)throw l.error;const c=l.object,d=Tt.create(r);if(d.isFailure)throw d.error;const h=d.object,p=$t.create(o);if(p.isFailure)throw p.error;const x=p.object,v=h.multiply(c.toNumber()),R=v.subtract(v.percentage(x.toNumber()));return{quantity:c,unit_price:h,subtotal_price:v,discount:x,total_price:R}},Tw=()=>{const{id:n}=m0();return n};var Ki={exports:{}};/** + */function Gi(n,a){return n?nw(n)?M.createElement(n,a):n:null}function nw(n){return rw(n)||typeof n=="function"||iw(n)}function rw(n){return typeof n=="function"&&(()=>{const a=Object.getPrototypeOf(n);return a.prototype&&a.prototype.isReactComponent})()}function iw(n){return typeof n=="object"&&typeof n.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(n.$$typeof.description)}function Md(n){const a={state:{},onStateChange:()=>{},renderFallbackValue:null,...n},[r]=M.useState(()=>({current:Yb(a)})),[o,l]=M.useState(()=>r.current.initialState);return r.current.setOptions(c=>({...c,...n,state:{...o,...n.state},onStateChange:d=>{l(d),n.onStateChange==null||n.onStateChange(d)}})),r.current}const sw=({buttonText:n,title:a="",content:r,className:o=""})=>i.jsx("div",{className:`flex items-baseline justify-center mr-4 font-medium ${o}`,children:i.jsxs(rr,{children:[i.jsx(Dc,{asChild:!0,children:i.jsxs(U,{variant:"link",className:"inline-flex items-center font-medium group",children:[i.jsx("span",{className:"underline-offset-4 group-hover:underline",children:n}),i.jsx(V_,{className:"w-4 h-4 ml-1 text-muted-foreground"})]})}),i.jsxs(ir,{className:"sm:max-w-[425px]",children:[i.jsx(sr,{children:i.jsx(ar,{children:a})}),i.jsxs(no,{className:"grid gap-4 py-2",children:[r,i.jsx(or,{children:i.jsx(Vi,{asChild:!0,children:i.jsx(U,{type:"button",children:w("common.close")})})})]})]})]})});function aw(n){let o=0;for(let v=0;v>v*8&255;l+=("00"+R.toString(16)).substr(-2)}const c=parseInt(l.substr(1,2),16),d=parseInt(l.substr(3,2),16),h=parseInt(l.substr(5,2),16),p=`#${(c*.7|0).toString(16).padStart(2,"0")}${(d*.7|0).toString(16).padStart(2,"0")}${(h*.7|0).toString(16).padStart(2,"0")}`,x=`#${Math.min(255,Math.floor(c+(255-c)*.7)).toString(16).padStart(2,"0")}${Math.min(255,Math.floor(d+(255-d)*.7)).toString(16).padStart(2,"0")}${Math.min(255,Math.floor(h+(255-h)*.7)).toString(16).padStart(2,"0")}`;return[p,x]}const Dd=({label:n,className:a})=>{const[r,o]=aw(n);return i.jsx(ro,{className:a,style:a?{}:{backgroundColor:o,color:r},children:n})};function Td({table:n,header:a,className:r}){return a.column.getCanSort()?i.jsx("div",{className:he("flex items-center space-x-2",r),children:i.jsxs(Yi,{children:[i.jsx(Qi,{asChild:!0,children:i.jsxs(U,{"aria-label":a.column.getIsSorted()==="desc"?w("common.sort_desc_description"):a.column.getIsSorted()==="asc"?w("common.sort_asc_description"):w("sort_none_description"),size:"sm",variant:"ghost",className:"-ml-3 h-8 data-[state=open]:bg-accent font-bold text-muted-foreground",children:[Gi(a.column.columnDef.header,a.getContext()),a.column.getIsSorted()==="desc"?i.jsx(_c,{className:"w-4 h-4 ml-2","aria-hidden":"true"}):a.column.getIsSorted()==="asc"?i.jsx(bc,{className:"w-4 h-4 ml-2","aria-hidden":"true"}):i.jsx(q0,{className:"w-4 h-4 ml-2 text-muted-foreground/30","aria-hidden":"true"})]})}),i.jsxs(Xi,{align:"start",children:[a.column.getCanSort()&&i.jsxs(i.Fragment,{children:[i.jsxs(Lr,{onClick:()=>a.column.toggleSorting(!1),"aria-label":w("common.sort_asc"),children:[i.jsx(bc,{className:"mr-2 h-3.5 w-3.5 text-muted-foreground/70","aria-hidden":"true"}),w("common.sort_asc")]}),i.jsxs(Lr,{onClick:()=>a.column.toggleSorting(!0),"aria-label":w("common.sort_desc"),children:[i.jsx(_c,{className:"mr-2 h-3.5 w-3.5 text-muted-foreground/70","aria-hidden":"true"}),w("common.sort_desc")]})]}),a.column.getCanSort()&&a.column.getCanHide()&&i.jsx(io,{}),a.column.getCanHide()&&i.jsxs(Lr,{onClick:()=>a.column.toggleVisibility(!1),"aria-label":w("Hide"),children:[i.jsx(gd,{className:"mr-2 h-3.5 w-3.5 text-muted-foreground/70","aria-hidden":"true"}),w("Hide")]})]})]})}):i.jsxs(i.Fragment,{children:[i.jsx("div",{className:he("data-[state=open]:bg-accent tracking-wide text-ellipsis",r),children:a.isPlaceholder?null:Gi(a.column.columnDef.header,a.getContext())}),!1]})}function ow({table:n,className:a,enablePageSizeSelector:r=!0,visible:o="auto"}){const l=M.useMemo(()=>o===!0,[o]),c=M.useMemo(()=>o==="auto",[o]);return!l||c&&n.getPageCount()<1?null:i.jsxs("div",{className:a,children:[i.jsx("div",{className:"flex-1 text-base text-muted-foreground",children:n.getSelectedRowModel().rows.length>0&&i.jsx(i.Fragment,{children:w("common.rows_selected_of_total",{count:n.getFilteredSelectedRowModel().rows.length,total:n.getFilteredRowModel().rows.length})})}),i.jsxs("div",{className:"flex justify-between space-x-6 lg:space-x-8",children:[r&&i.jsxs("div",{className:"flex items-center space-x-2 grow",children:[i.jsx("p",{className:"text-sm font-medium",children:w("common.rows_per_page")}),i.jsxs(so,{value:`${n.getState().pagination.pageSize}`,onValueChange:d=>{n.setPageSize(Number(d))},children:[i.jsx(ao,{className:"h-8 w-[70px]",children:i.jsx(oo,{placeholder:n.getState().pagination.pageSize})}),i.jsx(lo,{side:"top",children:U_.map(d=>i.jsx(Or,{value:`${d}`,children:d},d))})]})]}),i.jsxs("div",{className:he("flex space-x-2 flex-1",r?"justify-end":"justify-between"),children:[i.jsx("div",{className:"flex w-[150px] items-center justify-start",children:i.jsx("p",{className:"text-sm font-medium ",children:w("common.num_page_of_total",{count:n.getState().pagination.pageIndex+1,total:n.getPageCount()})})}),i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsxs(U,{type:"button",variant:"outline",className:"hidden w-8 h-8 p-0 lg:flex",onClick:()=>n.setPageIndex(G_),disabled:!n.getCanPreviousPage(),children:[i.jsx("span",{className:"sr-only",children:w("common.go_to_first_page")}),i.jsx($0,{className:"w-4 h-4"})]}),i.jsxs(U,{type:"button",variant:"outline",className:"w-8 h-8 p-0",onClick:()=>n.previousPage(),disabled:!n.getCanPreviousPage(),children:[i.jsx("span",{className:"sr-only",children:w("common.go_to_prev_page")}),i.jsx(H_,{className:"w-4 h-4"})]}),i.jsxs(U,{type:"button",variant:"outline",className:"w-8 h-8 p-0",onClick:()=>n.nextPage(),disabled:!n.getCanNextPage(),children:[i.jsx("span",{className:"sr-only",children:w("common.go_to_next_page")}),i.jsx(K_,{className:"w-4 h-4"})]}),i.jsxs(U,{type:"button",variant:"outline",className:"hidden w-8 h-8 p-0 lg:flex",onClick:()=>n.setPageIndex(n.getPageCount()+1),disabled:!n.getCanNextPage(),children:[i.jsx("span",{className:"sr-only",children:w("common.go_to_last_page")}),i.jsx(z0,{className:"w-4 h-4"})]})]})]})]})]})}function is({table:n,title:a,description:r,caption:o,paginationOptions:l,headerOptions:c={visible:!0},children:d,className:h,contentClassName:p,footerClassName:x,rowClassName:v,cellClassName:R,onRowClick:y,activeRowIndex:b}){var j;const E=c==null?void 0:c.visible;return i.jsxs(Le,{className:h,children:[(a||r)&&i.jsxs(ct,{className:"pb-0",children:[i.jsx(Be,{children:a}),i.jsx(He,{children:r})]}),i.jsxs(Oe,{className:he("pt-6",p),children:[d&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"flex space-x-2",children:d}),i.jsx(hn,{className:"my-4"})]}),i.jsxs(uo,{children:[typeof o<"u"&&i.jsx(W_,{children:o}),E&&n.getHeaderGroups().length&&i.jsx(co,{children:n.getHeaderGroups().map(D=>i.jsx(pn,{className:v,children:D.headers.map(F=>i.jsx(fo,{colSpan:F.colSpan,style:{width:F.getSize()===Number.MAX_SAFE_INTEGER?"auto":F.getSize()},children:i.jsx(Td,{table:n,header:F})},F.id))},D.id))}),i.jsx(go,{children:(j=n.getRowModel().rows)!=null&&j.length?n.getRowModel().rows.map(D=>i.jsx(pn,{onClick:()=>{y&&y(D)},tabIndex:0,"data-state":D.getIsSelected()&&"selected",className:he(D.getIsSelected()||b===D.index?"bg-accent cursor-pointer hover:bg-accent":"cursor-pointer",v),children:D.getVisibleCells().map(F=>i.jsx(qr,{className:R,style:{width:F.column.getSize()===Number.MAX_SAFE_INTEGER?"auto":F.column.getSize()},children:Gi(F.column.columnDef.cell,F.getContext())},F.id))},D.id)):i.jsx(pn,{className:v,children:i.jsx(qr,{className:he("h-24 text-center",R),colSpan:n.getAllColumns.length,children:"No hay datos para mostrar"})})})]})]}),i.jsx(Nt,{className:x,children:i.jsx(ow,{className:"flex-1",table:n,...l})})]})}function lw({actions:n,rowContext:a}){return i.jsxs(Yi,{children:[i.jsx(Qi,{asChild:!0,children:i.jsxs(U,{size:"icon",variant:"outline",className:"w-8 h-8",children:[i.jsx(G0,{className:"h-3.5 w-3.5"}),i.jsx("span",{className:"sr-only",children:w("common.open_menu")})]})}),i.jsxs(Xi,{align:"end",children:[i.jsxs(Tc,{children:[w("common.actions")," "]}),n&&n(a).map((r,o)=>r.label==="-"?i.jsx(io,{},o):i.jsxs(Lr,{onClick:l=>r.onClick?r.onClick(a,l):null,children:[r.icon&&i.jsx(i.Fragment,{children:r.icon}),r.label,r.shortcut&&i.jsx(Y_,{children:r.shortcut})]},o))]})]})}function uw(){return{id:"select",header:({table:n})=>i.jsx(Ui,{id:"select-all",checked:n.getIsAllPageRowsSelected()||n.getIsSomePageRowsSelected()&&"indeterminate",onCheckedChange:a=>n.toggleAllPageRowsSelected(!!a),"aria-label":"Seleccionar todo",className:"translate-y-[2px]"}),cell:({row:n})=>i.jsx(Ui,{id:`select-row-${n.id}`,checked:n.getIsSelected(),onCheckedChange:a=>{n.toggleSelected(!!a)},"aria-label":"Seleccionar file",className:"translate-y-[2px]"}),enableSorting:!1,enableHiding:!1}}function ss({columnCount:n,rowCount:a=10,searchableColumnCount:r=0,filterableColumnCount:o=0,showViewOptions:l=!0,cellWidths:c=["auto"],withPagination:d=!0,shrinkZero:h=!1,className:p,...x}){return i.jsxs("div",{className:he("w-full space-y-2.5 overflow-auto",p),...x,children:[i.jsxs("div",{className:"flex items-center justify-between w-full p-1 space-x-2 overflow-auto",children:[i.jsxs("div",{className:"flex items-center flex-1 space-x-2",children:[r>0?Array.from({length:r}).map((v,R)=>i.jsx(ut,{className:"w-40 h-7 lg:w-60"},R)):null,o>0?Array.from({length:o}).map((v,R)=>i.jsx(ut,{className:"h-7 w-[4.5rem] border-dashed"},R)):null]}),l?i.jsx(ut,{className:"ml-auto hidden h-7 w-[4.5rem] lg:flex"}):null]}),i.jsx("div",{className:"border rounded-md",children:i.jsxs(uo,{children:[i.jsx(co,{children:Array.from({length:1}).map((v,R)=>i.jsx(pn,{className:"hover:bg-transparent",children:Array.from({length:n}).map((y,b)=>i.jsx(fo,{style:{width:c[b],minWidth:h?c[b]:"auto"},children:i.jsx(ut,{className:"w-full h-6"})},b))},R))}),i.jsx(go,{children:Array.from({length:a}).map((v,R)=>i.jsx(pn,{className:"hover:bg-transparent",children:Array.from({length:n}).map((y,b)=>i.jsx(qr,{style:{width:c[b],minWidth:h?c[b]:"auto"},children:i.jsx(ut,{className:"w-full h-6"})},b))},R))})]})}),d?i.jsxs("div",{className:"flex items-center justify-between w-full gap-4 p-1 overflow-auto sm:gap-8",children:[i.jsx(ut,{className:"w-40 h-7 shrink-0"}),i.jsxs("div",{className:"flex items-center gap-4 sm:gap-6 lg:gap-8",children:[i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx(ut,{className:"w-24 h-7"}),i.jsx(ut,{className:"h-7 w-[4.5rem]"})]}),i.jsx("div",{className:"flex items-center justify-center text-sm font-medium",children:i.jsx(ut,{className:"w-20 h-7"})}),i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx(ut,{className:"hidden size-7 lg:block"}),i.jsx(ut,{className:"size-7"}),i.jsx(ut,{className:"size-7"}),i.jsx(ut,{className:"hidden size-7 lg:block"})]})]})]}):null]})}const as=({title:n="Esto está muy vacío",subtitle:a="Empieza solicitando la carga del catálogo",buttonText:r="Solicitar carga del catálogo",onButtonClick:o=()=>{},actions:l=()=>i.jsx(i.Fragment,{})})=>i.jsxs("div",{className:"text-center",children:[i.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:i.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"})}),i.jsx("h3",{className:"mt-2 text-lg font-semibold text-slate-900",children:n}),i.jsx("p",{className:"mt-1 text-base text-slate-500",children:a}),i.jsxs("div",{className:"items-center mt-6",children:[l&&i.jsx(i.Fragment,{children:l}),!l&&i.jsxs(U,{className:"my-4",onClick:o,children:[i.jsx(yo,{}),r]})]})]}),cw=vo("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"}}),Hi=n=>{const{name:a,label:r,hint:o,description:l,placeholder:c,className:d,disabled:h,defaultValue:p,rules:x,readOnly:v,scale:R,variant:y}=n,{control:b}=lr(),[E,j]=M.useState(""),D={input:F=>{if(typeof F!="object")return F;const q=$t.create(F);if(q.isFailure)throw q.error;const $=q.object.toString();return E.endsWith(",")?$.replace(/.0$/,","):$},output:(F,q,$)=>{const{value:Q}=$??{value:null};j(Q??"");const O=$t.createFromFormattedValue(Q);if(O.isFailure)throw O.error;return O.object.toObject()}};return i.jsx(mo,{defaultValue:p,control:b,name:a,disabled:h,rules:{max:100,min:0,...x},render:({field:F})=>{const q=D.input(F.value),$=h||F.disabled,Q=!!((x==null?void 0:x.required)??!1);return i.jsxs(ho,{className:he(d,"space-y-3"),children:[r&&i.jsx(po,{label:r,hint:o,required:Q}),i.jsx(xo,{children:i.jsx(Lc,{name:F.name,ref:F.ref,onBlur:F.onBlur,disabled:$,readOnly:v,className:he(cw({variant:y,className:d})),groupSeparator:".",decimalSeparator:",",placeholder:c,allowDecimals:R!==0,decimalsLimit:R,decimalScale:R,step:1,value:q,onValueChange:(O,k,H)=>F.onChange(D.output(O,k,H))})}),l&&i.jsx(_o,{children:l}),i.jsx(bo,{})]})}})},dw=vo("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"}}),fw=n=>{const{name:a,label:r,hint:o,description:l,placeholder:c,className:d,disabled:h,defaultValue:p,rules:x,readOnly:v,scale:R,variant:y}=n,{control:b}=lr(),[E,j]=M.useState(""),D={input:F=>{if(typeof F!="object")return F;const q=xn.create(F);if(q.isFailure)throw q.error;const $=q.object.toString();return E.endsWith(",")?$.replace(/.0$/,","):$},output:(F,q,$)=>{const{value:Q}=$??{value:null};j(Q??"");const O=xn.createFromFormattedValue(Q);if(O.isFailure)throw O.error;return O.object.toObject()}};return i.jsx(mo,{defaultValue:p,control:b,name:a,disabled:h,rules:x,render:({field:F})=>{const q=D.input(F.value),$=h||F.disabled,Q=!!((x==null?void 0:x.required)??!1);return i.jsxs(ho,{className:he(d,"space-y-3"),children:[r&&i.jsx(po,{label:r,hint:o,required:Q}),i.jsx(xo,{children:i.jsx(Lc,{name:F.name,ref:F.ref,onBlur:F.onBlur,disabled:$,readOnly:v,className:he(dw({variant:y,className:d})),groupSeparator:".",decimalSeparator:",",placeholder:c,allowDecimals:R!==0,decimalsLimit:R,decimalScale:R,step:1,value:q,onValueChange:(O,k,H)=>F.onChange(D.output(O,k,H))})}),l&&i.jsx(_o,{children:l}),i.jsx(bo,{})]})}})},gw=vo("",{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"}}),mn=n=>{const{name:a,label:r,hint:o,description:l,placeholder:c,className:d,disabled:h,rules:p,required:x,type:v,variant:R}=n,{control:y}=lr();return i.jsx(mo,{control:y,name:a,disabled:h,rules:{required:x,...p},render:({field:b,fieldState:E})=>{const j=!!((p==null?void 0:p.required)??x);return i.jsxs(ho,{className:he(d,"space-y-3"),children:[r&&i.jsx(po,{label:r,hint:o,required:j}),i.jsx(xo,{className:"block",children:i.jsx(Zi,{type:v,placeholder:c,className:he(E.error?"border-destructive focus-visible:ring-destructive":"",gw({variant:R,className:d})),...b})}),l&&i.jsx(_o,{children:l}),i.jsx(bo,{})]})}})},mw=(n,a)=>{const r=M.useRef();return M.useEffect(()=>{r.current=n},[n,a]),r.current},Ld=(n,a,r,o)=>n.getFixedT(a,r,o),hw=(n,a,r,o)=>M.useCallback(Ld(n,a,r,o),[n,a,r,o]),Fo=(n,a={})=>{var Q,O,k,H;const{i18n:r}=a,{i18n:o,defaultNS:l}=M.useContext(Q_)||{},c=r||o||X_();if(c&&!c.reportNamespaces&&(c.reportNamespaces=new Z_),!c){gc(c,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const W=(ae,ce)=>Ia(ce)?ce:t0(ce)&&Ia(ce.defaultValue)?ce.defaultValue:Array.isArray(ae)?ae[ae.length-1]:ae,B=[W,{},!1];return B.t=W,B.i18n={},B.ready=!1,B}(Q=c.options.react)!=null&&Q.wait&&gc(c,"DEPRECATED_OPTION","useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const d={...e0(),...c.options.react,...a},{useSuspense:h,keyPrefix:p}=d;let x=l||((O=c.options)==null?void 0:O.defaultNS);x=Ia(x)?[x]:x||["translation"],(H=(k=c.reportNamespaces).addUsedNamespaces)==null||H.call(k,x);const v=(c.isInitialized||c.initializedStoreOnce)&&x.every(W=>J_(W,c,d)),R=hw(c,a.lng||null,d.nsMode==="fallback"?x:x[0],p),y=()=>R,b=()=>Ld(c,a.lng||null,d.nsMode==="fallback"?x:x[0],p),[E,j]=M.useState(y);let D=x.join();a.lng&&(D=`${a.lng}${D}`);const F=mw(D),q=M.useRef(!0);M.useEffect(()=>{const{bindI18n:W,bindI18nStore:B}=d;q.current=!0,!v&&!h&&(a.lng?mc(c,a.lng,x,()=>{q.current&&j(b)}):hc(c,x,()=>{q.current&&j(b)})),v&&F&&F!==D&&q.current&&j(b);const ae=()=>{q.current&&j(b)};return W&&(c==null||c.on(W,ae)),B&&(c==null||c.store.on(B,ae)),()=>{q.current=!1,c&&(W==null||W.split(" ").forEach(ce=>c.off(ce,ae))),B&&c&&B.split(" ").forEach(ce=>c.store.off(ce,ae))}},[c,D]),M.useEffect(()=>{q.current&&v&&j(y)},[c,p,v]);const $=[E,c,v];if($.t=E,$.i18n=c,$.ready=v,v||!v&&!h)return $;throw new Promise(W=>{a.lng?mc(c,a.lng,x,()=>W()):hc(c,x,()=>W())})};function pw(n=!1){const[a,r]=M.useState(n);return[a,()=>r(l=>!l)]}const Tn=()=>{const n=M.useContext(n0);if(n===null)throw new Error("useDataTableContext must be used within a DataTableProvider");return n};function os({data:n,columns:a,pageCount:r,enableSorting:o=!1,enableHiding:l=!1,enableRowSelection:c=!1,initialState:d,onPaginationChange:h,meta:p}){const{pagination:x,setPagination:v,sorting:R}=Tn(),[y,b]=In.useState({}),[E,j]=In.useState((d==null?void 0:d.columnVisibility)||{}),D=Q=>{if(typeof Q=="function"){const O=Q(x);v(O)}h&&h(Q)},F=Q=>{},q=M.useCallback(()=>{const Q=a;return c&&Q.unshift(uw()),Q},[a,c]);return{table:Md({data:n,columns:q(),pageCount:r??-1,meta:p,getCoreRowModel:Id(),initialState:d,state:{pagination:x,sorting:R,columnVisibility:E,rowSelection:y},enableRowSelection:c,onRowSelectionChange:b,manualSorting:!0,enableSorting:o,getSortedRowModel:tw(),onSortingChange:F,enableHiding:l,onColumnVisibilityChange:j,manualPagination:!0,onPaginationChange:D,manualFiltering:!0,getFilteredRowModel:ew(),getFacetedRowModel:Zb(),getFacetedUniqueValues:Jb(),debugTable:!1,debugHeaders:!1,debugColumns:!1,defaultColumn:{minSize:0,size:Number.MAX_SAFE_INTEGER,maxSize:Number.MAX_SAFE_INTEGER}})}}const xw=({setSize:n,setControllerCallback:a,setPercentageCallback:r,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 c=l.body,d=l.headers.get("content-encoding"),h=l.headers.get(d?"x-file-size":"content-length"),p=parseInt(h||"0",10);n(()=>p);let x=0;const v=new ReadableStream({start(R){a(R);const y=c.getReader();async function b(){return y.read().then(({done:E,value:j})=>E?R.close():(x+=(j==null?void 0:j.byteLength)||0,j&&R.enqueue(j),r({loaded:x,total:p}),b())).catch(E=>(o(E),y.cancel("Cancelled"),R.error(E)))}return b()}});return new Response(v)},Nc=(n,a,r)=>{const o=[n],l=new Blob(o,{type:r||"application/octet-stream"});if(typeof window.navigator.msSaveBlob<"u")return window.navigator.msSaveBlob(l,a);const c=window.URL&&window.URL.createObjectURL?window.URL.createObjectURL(l):window.webkitURL.createObjectURL(l),d=document.createElement("a");return d.style.display="none",d.href=c,d.setAttribute("download",a),typeof d.download>"u"&&d.setAttribute("target","_blank"),document.body.appendChild(d),d.click(),setTimeout(()=>{document.body.removeChild(d),window.URL.revokeObjectURL(c)},200)};function Rc({customHandleDownload:n,...a}={}){var Q;let r=!1;try{r=process?!!((Q=process==null?void 0:process.env)!=null&&Q.REACT_APP_DEBUG_MODE):!1}catch{r=!1}const[o,l]=M.useState(0),[c,d]=M.useState(0),[h,p]=M.useState(0),[x,v]=M.useState(null),[R,y]=M.useState(!1),b=M.useRef(null),E=M.useCallback(({loaded:O,total:k})=>{const H=Math.round(O/k*100);d(()=>H)},[]),j=M.useCallback(O=>{const k={"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:k[O.message]?k[O.message]:O.message}))},[]),D=M.useCallback(O=>{b.current=O},[]),F=M.useCallback(()=>{b.current&&b.current.error()},[]),q=M.useCallback(()=>{D(null),l(()=>0),d(()=>0),p(()=>0),y(()=>!1)},[D]),$=M.useCallback(async(O,k,H=0,W={})=>{if(R)return null;q(),v(()=>null),y(()=>!0);const B=setInterval(()=>l(rt=>rt+1),r?1:1e3),ae=xw({setSize:p,setControllerCallback:D,setPercentageCallback:E,setErrorCallback:j}),ce=new AbortController,Y=setTimeout(()=>{H>0&&ce.abort()},H),Re=n||Nc;try{const rt=await fetch(O,{method:"GET",...a,...W,signal:ce.signal}),je=await ae(rt).blob();Re(je,k),q()}catch(rt){q(),v(ee=>{const{message:je}=rt;return je!=="Failed to fetch"?{errorMessage:je}:ee}),clearTimeout(Y)}finally{clearInterval(B)}},[R,q,r,D,E,j,a,n]);return M.useMemo(()=>({elapsed:o,percentage:c,size:h,download:$,cancel:F,error:x,isInProgress:R,jsDownload:Nc}),[o,c,h,$,F,x,R])}const vw=()=>{const{i18n:n}=Fo();return Od({locale:n.language})},Od=n=>{const{locale:a}=n,r=M.useCallback(c=>{if(c==null)return"";const{amount:d,scale:h,currency_code:p}=c;return new Intl.NumberFormat(a??"ES",{style:"currency",currency:p,currencyDisplay:"symbol",useGrouping:!0,maximumFractionDigits:h}).format(d===null?0:pc({amount:d,scale:h}))},[a]),o=M.useCallback(c=>{if(c==null)return"";const{amount:d,scale:h}=c;return new Intl.NumberFormat("es",{minimumFractionDigits:h,useGrouping:!0}).format(d===null?0:pc({amount:d,scale:h}))},[a]),l=M.useCallback(c=>{if(c==null)return"";const{amount:d,scale:h}=c;return new Intl.NumberFormat(a,{style:"decimal",minimumFractionDigits:h}).format(d===null?0:d)},[a]);return{formatCurrency:r,formatNumber:o,formatPercentage:l}};function Pd(n){const[a,r]=M.useState(!1);return M.useEffect(()=>{function o(c){r(c.matches)}const l=matchMedia(n);return l.addEventListener("change",o),r(l.matches),()=>l.removeEventListener("change",o)},[n]),a}const _w=()=>{const n=M.useContext(r0);if(n===null)throw new Error("useWarnAboutChange must be used within a UnsavedWarnProvider");return n},Mo=({isDirty:n=!1,title:a=w("hooks.use_unsaved_changes_notifier.title"),subtitle:r=w("hooks.use_unsaved_changes_notifier.subtitle"),confirmText:o=w("hooks.use_unsaved_changes_notifier.confirm_text"),cancelText:l=w("hooks.use_unsaved_changes_notifier.cancel_text"),onConfirm:c,onCancel:d,type:h="warning"})=>{const p=i0(n),{show:x}=_w(),v=M.useCallback(()=>n?new Promise(R=>{x({title:a,subtitle:r,confirmText:o,cancelText:l,type:h,onConfirm:()=>{R(!0),c==null||c()},onCancel:()=>{R(!1),d==null||d()}})}):Promise.resolve(!0),[l,o,n,d,c,x,r,a,h]);return M.useEffect(()=>{p.state==="blocked"&&v().then(R=>{R?p.proceed():p.reset()})},[p,v]),M.useEffect(()=>(n&&(window.onbeforeunload=()=>r),()=>{window.onbeforeunload=null}),[n,r]),{confirm:v}},kd=n=>{const{isSubmitting:a,isLoading:r,isValidating:o}=s0();return i.jsx(wo,{disabled:a||r||o,...n})};kd.displayName="FormSubmitButton";const qd={"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}}"},Bi=[{code:"en",name:"English",flag:()=>i.jsx("span",{className:"fi fi-gb"})},{code:"es",name:"Español",flag:()=>i.jsx("span",{className:"fi fi-es"})}],oS=()=>{var R,y,b,E;const{t:n,i18n:a}=Fo(),[r,o]=M.useState(a.language),l=zt(),{toast:c}=_n();M.useEffect(()=>{const j=navigator.language.split("-")[0],D=Bi.find(F=>F.code===j);D&&d(D.code)},[]);const d=j=>{a.changeLanguage(j),o(j)},{mutate:h,status:p}=k0({onSuccess:j=>{const{success:D,error:F}=j;!D&&F&&x.setError("root",F),D&&l("/quotes",{replace:!0})},onError:j=>{const{message:D}=j;c({description:D,title:"Error"}),console.log(j)}}),x=Ji({mode:"onBlur",defaultValues:{email:"",password:""},resolver:Oc(Fn.object({email:Fn.string().email({tlds:{allow:!1}}).required(),password:Fn.string().min(4).alphanum().required()}),{messages:qd})}),v=async j=>{h({email:j.email,password:j.password},{})};return i.jsxs(a0,{variant:"full",className:"p-0 lg:grid lg:min-h-[600px] lg:grid-cols-2 xl:min-h-[800px] h-screen ",children:[i.jsx("div",{className:"flex items-center justify-center py-12 ",children:i.jsxs("div",{className:"mx-auto grid w-[650px] gap-6 relative ",children:[i.jsx("div",{className:"absolute flex space-x-2 top-4 right-4 ",children:i.jsxs(Yi,{children:[i.jsx(Qi,{asChild:!0,children:i.jsxs(U,{variant:"outline",className:"w-[140px] justify-start",children:[i.jsx("span",{className:"mr-2",children:(R=Bi.find(j=>j.code===r))==null?void 0:R.flag()}),(y=Bi.find(j=>j.code===r))==null?void 0:y.name,i.jsx(Pc,{className:"w-4 h-4 ml-auto opacity-50"})]})}),i.jsx(Xi,{className:"w-[140px]",children:Bi.map(j=>i.jsxs(Lr,{onSelect:()=>d(j.code),children:[i.jsx("span",{className:"mr-2",children:j.flag()}),j.name]},j.code))})]})}),i.jsxs(Le,{className:"px-12 py-6 bg-muted/50",children:[i.jsxs(ct,{children:[i.jsx(o0,{className:"inline-block m-auto mb-6 align-middle max-w-32"}),i.jsx(Be,{children:i.jsx(se,{i18nKey:"login_page.title"})}),i.jsx(He,{children:i.jsx(se,{i18nKey:"login_page.description"})})]}),i.jsx(Oe,{children:i.jsx(es,{...x,children:i.jsx("form",{onSubmit:x.handleSubmit(v),children:i.jsxs("div",{className:"grid items-start gap-6",children:[i.jsx("div",{className:"grid gap-6",children:i.jsx(mn,{required:!0,disabled:p==="pending",name:"email",label:n("login_page.email_label"),type:"email",placeholder:n("login_page.email_placeholder")})}),i.jsxs("div",{className:"grid gap-6",children:[i.jsx(mn,{required:!0,disabled:p==="pending",name:"password",label:n("login_page.password_label"),type:"password"}),i.jsxs("div",{className:"mb-4 -mt-2 text-sm",children:[i.jsx(se,{i18nKey:"login_page.forgotten_password"}),i.jsx("br",{}),i.jsx(xc,{to:"https://uecko.com/distribuidores",className:"underline",children:i.jsx(se,{i18nKey:"login_page.contact_us"})})]})]}),((b=x.formState.errors.root)==null?void 0:b.message)&&i.jsxs(kc,{variant:"destructive",children:[i.jsx(dd,{className:"w-4 h-4"}),i.jsx(qc,{children:i.jsx(se,{i18nKey:"common.error"})}),i.jsx($c,{children:(E=x.formState.errors.root)==null?void 0:E.message})]}),i.jsx(kd,{className:"w-full",disabled:p==="pending"}),i.jsxs("div",{className:"mt-4 text-sm text-center",children:[i.jsx(se,{i18nKey:"login_page.become_dealer"}),i.jsx("br",{}),i.jsx(xc,{to:"https://uecko.com/distribuidores",className:"underline",children:i.jsx(se,{i18nKey:"login_page.contact_us"})}),i.jsx("br",{}),i.jsxs("p",{className:"mx-auto mt-4 -mb-6 text-xs text-muted-foreground/50",children:["v.","1.1.7"]})]})]})})})})]}),i.jsx("img",{className:"block w-11/12 mx-auto aspect-auto",src:"/img/uecko-footer_logos.jpg"})]})}),i.jsx("div",{className:"hidden bg-muted lg:block",children:i.jsx("img",{src:"/img/nara2.jpg",alt:"Image",width:"1920",height:"1080",className:"h-full w-full object-cover dark:brightness-[0.2] dark:grayscale"})})]})},bw=n=>{const{onSuccess:a,onError:r,...o}=n||{},l=Jt(),c=Mn(),{logout:d}=Ic(),h=zt(),{toast:p}=_n();return en({mutationKey:c().auth().action("logout").get(),mutationFn:d,onSuccess:async(x,v,R)=>{l.clear();const{success:y,redirectTo:b}=x;y&&b&&h(b||"/"),a&&a(x,v,R)},onError:(x,v,R)=>{const{message:y}=x;p({title:"Error",description:y,variant:"destructive"}),r&&r(x,v,R)},...o})},lS=()=>{const{mutate:n}=bw({});return M.useEffect(()=>n(),[n]),i.jsx(Dn,{})},ww=M.createContext(null),Sw=({children:n})=>{const[a,r]=zc();return i.jsx(ww.Provider,{value:{pagination:a,setPagination:r},children:n})},uS=({children:n})=>i.jsx(ts,{children:i.jsx(Sw,{children:i.jsxs(zr,{className:"catalog-layout",children:[i.jsx(Br,{}),i.jsx(Vr,{children:n})]})})}),$d=n=>{const a=$r(),r=Mn(),{pagination:o,searchTerm:l=[],enabled:c=!0,queryOptions:d}=n;return No({queryKey:r().data().resource("catalog").action("list").params(n).get(),queryFn:()=>a.getList({resource:"catalog",quickSearchTerm:l,pagination:o}),enabled:c,queryOptions:d})};function zd({table:n,className:a,children:r,...o}){const{globalFilter:l,isFiltered:c,setGlobalFilter:d,resetGlobalFilter:h}=Tn(),p=In.useRef(null),[x,v]=In.useState(""),R=In.useCallback(E=>{E.key==="Enter"&&x.trim()&&(E.preventDefault(),d(j=>[...j,x.trim()]),v("")),E.key==="Backspace"&&!x&&l.length>0&&(E.preventDefault(),d(j=>j.slice(0,-1)))},[l,x]),y=In.useCallback(E=>{d(j=>j.filter(D=>D!==E))},[]),b=In.useCallback(()=>{var E;x.trim()&&(d(j=>[...j,x.trim()]),v(""),(E=p.current)==null||E.focus())},[x]);return i.jsx(l0,{children:i.jsxs("div",{className:"w-full space-y-2",...o,children:[i.jsxs("div",{className:he("relative flex items-center flex-1 p-2 space-x-2 border rounded-md",c?"border-primary":"border-input"),children:[i.jsx(Bc,{className:he("w-4 h-4 text-gray-500")}),i.jsxs("div",{className:"flex flex-wrap items-center flex-1 gap-2",children:[l&&l.map(E=>i.jsxs(ro,{variant:"default",className:"px-1 text-base font-normal rounded-sm",children:[E,i.jsxs(U,{variant:"ghost",onClick:()=>y(E),className:"h-auto p-0 px-1 ml-1 hover:bg-transparent",children:[i.jsxs(Ke,{children:[i.jsx(We,{asChild:!0,children:i.jsx(Ua,{className:"w-4 h-4"})}),i.jsx(Ye,{children:i.jsx("p",{children:w("catalog.filter.badget_remove_tooltip")})})]}),i.jsx("span",{className:"sr-only",children:w("catalog.filter.badget_remove_tooltip")})]})]},E)),i.jsxs("div",{className:"flex-1 flex items-center min-w-[300px]",children:[i.jsx("input",{ref:p,value:x,onChange:E=>v(E.target.value),onKeyDown:R,placeholder:w("common.filter.input_placeholder"),className:"flex-1 w-full h-8 bg-transparent outline-none placeholder:text-muted-foreground"}),i.jsxs(tr,{children:[c&&i.jsxs(Ke,{children:[i.jsx(We,{asChild:!0,children:i.jsxs(U,{variant:"ghost",onClick:()=>h(),className:"h-8 px-2 transition-all lg:px-3 text-primary",children:[i.jsx(Ua,{className:"w-4 h-4 mr-2"}),w("common.filter.reset_filter")]})}),i.jsx(Ye,{children:i.jsx("p",{children:w("common.filter.reset_filter")})})]}),i.jsxs(Ke,{children:[i.jsx(We,{asChild:!0,children:i.jsxs(U,{variant:"default",size:"icon",disabled:!x,onClick:b,className:"w-8 h-8 p-0 transition-all",children:[i.jsx(yo,{className:"w-4 h-4"}),i.jsx("span",{className:"sr-only",children:w("common.filter.button_add_term")})]})}),i.jsx(Ye,{children:i.jsx("p",{children:w("common.filter.button_add_term_tooltip")})})]})]})]})]})]}),i.jsx("p",{className:"text-sm text-muted-foreground",children:w("common.filter.help_text")})]})})}const jw=()=>{const n=zt(),{pagination:a,globalFilter:r,isFiltered:o}=Tn(),{data:l,isPending:c,isError:d,error:h}=$d({pagination:{pageIndex:a.pageIndex,pageSize:a.pageSize},searchTerm:r}),p=M.useMemo(()=>[{id:"id",accessorKey:"id"},{id:"id_article",accessorKey:"id_article"},{id:"catalog_name",accessorKey:"catalog_name"},{id:"description",accessorKey:"description",header:()=>i.jsx(i.Fragment,{children:w("catalog.list.columns.description")})},{id:"points",accessorKey:"points",header:()=>i.jsx("div",{className:"text-right",children:w("catalog.list.columns.points")}),cell:({renderValue:v})=>i.jsx("div",{className:"text-right",children:v()})},{id:"retail_price",accessorKey:"retail_price",header:()=>i.jsx("div",{className:"text-right",children:w("catalog.list.columns.retail_price")}),cell:({row:v})=>{const R=Tt.create(v.original.retail_price).object;return i.jsx("div",{className:"text-right",children:R.toFormat()})}}],[]),{table:x}=os({data:(l==null?void 0:l.items)??[],columns:p,pageCount:(l==null?void 0:l.total_pages)??-1,initialState:{columnVisibility:{id:!1,id_article:!1,catalog_name:!1}}});return d?i.jsx(ur,{subtitle:h.message}):c?i.jsx(Le,{children:i.jsx(Oe,{children:i.jsx(ss,{columnCount:6,searchableColumnCount:1,filterableColumnCount:2,shrinkZero:!0})})}):(l==null?void 0:l.total_items)===0&&!o?i.jsx(as,{subtitle:"Empieza cargando los artículos del catálogo",buttonText:"",onButtonClick:()=>n("/catalog/add")}):i.jsx(is,{table:x,paginationOptions:{visible:!0},children:i.jsx(zd,{table:x})})},cS=()=>i.jsxs(nr,{children:[i.jsx("div",{className:"flex items-center justify-between space-y-2",children:i.jsx("div",{children:i.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:i.jsx(se,{i18nKey:"catalog.list.title"})})})}),i.jsx(jw,{})]}),dS=()=>{const{data:n,status:a}=u0();return i.jsxs(zr,{children:[i.jsx(Br,{}),i.jsx(Vr,{children:a==="success"?i.jsx("div",{className:"flex items-center",children:i.jsx("h1",{className:"text-lg font-semibold md:text-2xl",children:`${w("dashboard.welcome")}, ${n==null?void 0:n.name}`})}):i.jsx(ut,{className:"w-[100px] h-[20px] rounded-full"})})]})},fS=({children:n})=>i.jsx(ts,{children:i.jsxs(zr,{className:"dealers-layout",children:[i.jsx(Br,{}),i.jsx(Vr,{children:n})]})});function Cw({table:n}){return i.jsxs(Yi,{children:[i.jsx(Qi,{asChild:!0,children:i.jsxs(U,{variant:"outline",size:"sm",className:"hidden h-8 ml-auto lg:flex",children:[i.jsx(X0,{className:"w-4 h-4 mr-2"}),"Columnas"]})}),i.jsxs(Xi,{align:"end",className:"w-[150px]",children:[i.jsx(Tc,{children:"Columnas"}),i.jsx(io,{}),n.getAllColumns().filter(a=>typeof a.accessorFn<"u"&&a.getCanHide()).map(a=>i.jsx(c0,{className:"capitalize",checked:a.getIsVisible(),onCheckedChange:r=>a.toggleVisibility(!!r),children:i.jsx(i.Fragment,{children:a.columnDef.header})},a.id))]})]})}function Bd({table:n,className:a,children:r,...o}){const{globalFilter:l,isFiltered:c,setGlobalFilter:d,resetGlobalFilter:h}=Tn(),p=x=>{const v=String(x.target.value);v===""?h():d([v])};return i.jsxs("div",{className:he("flex w-full items-center justify-between space-x-2 overflow-auto p-1",a),...o,children:[i.jsxs("div",{className:"flex items-center flex-1 space-x-2",children:[i.jsx(Bc,{className:"w-4 h-4 text-gray-500"}),i.jsx(Zi,{placeholder:w("common.filter.input_placeholder"),value:l,onChange:p,className:he("h-8 w-full transition-all")},"global-filter"),c&&i.jsxs(U,{variant:"outline",onClick:()=>h(),className:"h-8 px-2 transition-all lg:px-3",children:[i.jsx(Ua,{className:"w-4 h-4 mr-2"}),w("common.filter.reset_filter")]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[r,n.options.enableHiding&&i.jsx(Cw,{table:n})]})]})}const yw=n=>{const a=$r(),r=Mn(),{pagination:o,searchTerm:l=void 0,enabled:c=!0,queryOptions:d}=n;return No({queryKey:r().data().resource("dealer").action("list").params(n).get(),queryFn:()=>a.getList({resource:"dealers",quickSearchTerm:l,pagination:o}),enabled:c,queryOptions:d})},Nw=()=>{const n=zt(),{pagination:a,globalFilter:r,isFiltered:o}=Tn(),{data:l,isPending:c,isError:d,error:h}=yw({pagination:{pageIndex:a.pageIndex,pageSize:a.pageSize},searchTerm:r}),p=M.useMemo(()=>[{id:"id",accessorKey:"id",enableResizing:!1,size:10},{id:"name",accessorKey:"name",enableResizing:!1,size:10}],[]),{table:x}=os({data:(l==null?void 0:l.items)??[],columns:p,pageCount:(l==null?void 0:l.total_pages)??-1});return d?i.jsx(ur,{subtitle:h.message}):c?i.jsx(Le,{children:i.jsx(Oe,{children:i.jsx(ss,{columnCount:6,searchableColumnCount:1,filterableColumnCount:2,shrinkZero:!0})})}):(l==null?void 0:l.total_items)===0&&!o?i.jsx(as,{subtitle:"Empieza cargando los artículos del catálogo",buttonText:"",onButtonClick:()=>n("/catalog/add")}):i.jsx(i.Fragment,{children:i.jsx(is,{table:x,paginationOptions:{visible:!0},children:i.jsx(Bd,{table:x})})})},gS=()=>i.jsx(nr,{children:i.jsx(Nw,{})}),mS=()=>i.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:i.jsxs("div",{className:"max-w-md mx-auto text-center",children:[i.jsx("div",{className:"w-12 h-12 mx-auto text-primary"}),i.jsx("h1",{className:"mt-4 text-3xl font-bold tracking-tight text-foreground sm:text-4xl",children:"Oops, page not found!"}),i.jsx("p",{className:"mt-4 text-muted-foreground",children:"The page you're looking for doesn't exist or has been moved."}),i.jsx("div",{className:"mt-6",children:i.jsx(U,{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:"Go to Homepage"})})]})}),Vd=M.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 Rw(n){return n.isSorting||n.wasDragging?f0(n):!0}function Ew({id:n,children:a,isActive:r=!1,onActivate:o}){const{attributes:l,isDragging:c,listeners:d,setNodeRef:h,setActivatorNodeRef:p,transform:x,transition:v}=d0({animateLayoutChanges:Rw,id:n}),R={transform:Ga.Translate.toString(x),transition:v},y=M.useMemo(()=>({attributes:l,listeners:d,ref:p,isDragging:c}),[l,c,d,p]);return i.jsx(Vd.Provider,{value:y,children:i.jsx(pn,{id:String(n),className:he(c?"opacity-60":"opacity-100",r?"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","m-0"),ref:h,style:R,onClick:o,onFocusCapture:o,children:a},n)})}const Aw=({className:n})=>{const{attributes:a,isDragging:r,listeners:o,ref:l}=M.useContext(Vd);return i.jsxs(U,{ref:l,onClick:c=>{c.preventDefault()},size:"icon",variant:"link",className:he(r?"cursor-grabbing":"cursor-grab","w-4 h-4 mt-2 text-ring hover:text-muted-foreground",n),...a,...o,children:[i.jsx(md,{className:"w-4 h-4"}),i.jsx("span",{className:"sr-only",children:w("common.move_row")})]})};function Iw(n,a={}){const{enableDragHandleColumn:r=!1,enableSelectionColumn:o=!1,enableActionsColumn:l=!1,rowActionFn:c=void 0}=a;return M.useMemo(()=>(r&&n.unshift({id:"row_drag_handle",header:()=>null,cell:()=>i.jsx(Aw,{}),enableSorting:!1,enableHiding:!1,size:40}),o&&n.unshift({id:"select",header:({table:d})=>i.jsx(Ui,{id:"select-all",checked:d.getIsAllPageRowsSelected()||d.getIsSomePageRowsSelected()&&"indeterminate",onCheckedChange:h=>d.toggleAllPageRowsSelected(!!h),"aria-label":"Seleccionar todo",className:"translate-y-[0px]"}),cell:({row:d})=>i.jsx(Ui,{id:`select-row-${d.id}`,checked:d.getIsSelected(),disabled:!d.getCanSelect(),onCheckedChange:d.getToggleSelectedHandler(),"aria-label":"Seleccionar fila",className:"mt-2"}),enableSorting:!1,enableHiding:!1,size:40}),l&&n.push({id:"row_actions",cell:d=>i.jsx(lw,{rowContext:d,actions:c}),enableSorting:!1,enableHiding:!1,size:48}),n),[l,r,o])}var Ud={exports:{}};(function(n,a){(function(r,o,l){n.exports=l(),n.exports.default=l()})("slugify",Xn,function(){var r=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(c,d){if(typeof c!="string")throw new Error("slugify: string argument expected");d=typeof d=="string"?{replacement:d}:d||{};var h=o[d.locale]||{},p=d.replacement===void 0?"-":d.replacement,x=d.trim===void 0?!0:d.trim,v=c.normalize().split("").reduce(function(R,y){var b=h[y];return b===void 0&&(b=r[y]),b===void 0&&(b=y),b===p&&(b=" "),R+b.replace(d.remove||/[^\w\s$*_+~.()'"!\-:@]+/g,"")},"");return d.strict&&(v=v.replace(/[^A-Za-z0-9\s]/g,"")),x&&(v=v.trim()),v=v.replace(/\s+/g,p),d.lower&&(v=v.toLowerCase()),v}return l.extend=function(c){Object.assign(r,c)},l})})(Ud);var Fw=Ud.exports;const Mw=g0(Fw),Ur=()=>{const n=$r(),a=Mn(),r=M.useCallback(c=>`${n.getApiUrl()}/quotes/${c}/report`,[n]),o=M.useCallback(c=>`quote-${Mw(c.reference,{lower:!0,strict:!0,locale:"en",trim:!0})}.pdf`,[]),l={useList:c=>{const d=$r(),h=Mn(),{pagination:p,status:x="draft",quickSearchTerm:v=void 0,enabled:R=!0,queryOptions:y}=c;return No({queryKey:h().data().resource("quotes").action("list").params(c).get(),queryFn:()=>d.getList({resource:"quotes",quickSearchTerm:v,filters:x!=="all"?[{field:"status",operator:"eq",value:x}]:[{field:"status",operator:"ne",value:"archived"}],pagination:p}),enabled:R,queryOptions:y})},useCreate:()=>{const c=Jt();return cb({mutationFn:d=>{const{date:h}=d,p=dn.generateNewID().object.toString();return n.createOne({resource:"quotes",data:{...d,date:new Date(h).toISOString().slice(0,10),status:"draft",id:p}})},onSuccess:()=>{c.invalidateQueries({queryKey:["data","default","quotes"]})}})},useUpdate:c=>{const d=Jt();return en({mutationKey:a().data().resource("quotes").action("one").id(c).params().get(),mutationFn:h=>n.updateOne({resource:"quotes",id:c,data:h}),onSuccess:()=>{d.invalidateQueries({queryKey:["data","default","quotes"]})}})},useSetStatus:()=>{const c=Jt();return en({mutationFn:d=>{const{id:h,newStatus:p}=d;return n.custom({url:`${n.getApiUrl()}/quotes/${h}/setStatus`,method:"put",data:{newStatus:p}})},onSuccess:()=>{c.invalidateQueries({queryKey:["data","default","quotes"]})}})},useDuplicate:()=>{const c=Jt();return en({mutationFn:d=>{const{id:h}=d;return n.custom({url:`${n.getApiUrl()}/quotes/${h}/duplicate`,method:"post"})},onSuccess:()=>{c.invalidateQueries({queryKey:["data","default","quotes"]})}})},useSentTo:c=>{const d=Jt();return en({mutationKey:a().data().resource("quotes").action("one").id(c).params().get(),mutationFn:h=>{const{sent_date:p}=h;return n.custom({url:`${n.getApiUrl()}/quotes/${c}/send`,method:"put",data:{sent_date:p}})},onSuccess:()=>{d.invalidateQueries({queryKey:["data","default","quotes"]})}})},useOne:(c,d)=>bd({queryKey:a().data().resource("quotes").action("one").id(c).params().get(),queryFn:()=>n.getOne({resource:"quotes",id:String(c)}),enabled:!!c,...d}),getQuotePDFDownloadURL:r,getQuotePDFFilename:o,useReport:()=>{const c=n.getApiAuthorization(),[d,h]=M.useState(void 0),{download:p,...x}=Rc({headers:{Authorization:c},customHandleDownload:M.useCallback(R=>{const y=[R],b=new Blob(y,{type:"application/octet-stream"});return h(b),!0},[h])}),v=M.useCallback(R=>p(l.getQuotePDFDownloadURL(R),""),[p]);return{...x,preview:v,report:d}},useDownloader:()=>{const c=n.getApiAuthorization(),d=Rc({headers:{Authorization:c}});return{...d,download:(p,x)=>{const v=l.getQuotePDFDownloadURL(p);return d.download(v,x)}}}};return l},hS=()=>{const n=zt(),{toast:a}=_n(),{useCreate:r}=Ur(),{mutate:o,isPending:l}=r(),c=M.useMemo(()=>({date:new Date(Date.now()).toUTCString(),customer_reference:"",customer_information:""}),[]),d=Ji({mode:"onBlur",defaultValues:c,resolver:Oc(Fn.object({customer_reference:Fn.string(),date:Fn.date().required(),customer_information:Fn.string().required()}),{messages:{es:qd}})}),{formState:h,reset:p,getValues:x,handleSubmit:v}=d,{isSubmitting:R,isDirty:y}=h;Mo({isDirty:y});const b=async E=>{try{o(E,{onError:j=>{console.debug(j),a({title:"Error",description:j.message,variant:"destructive"})},onSuccess:j=>{p(x()),a({title:"Cotización creada",variant:"default"}),n(`/quotes/edit/${j.id}`,{relative:"path"})}})}finally{}};return R?i.jsx(Dn,{title:"Guardando ajustes"}):l?i.jsx(Dn,{}):i.jsx(es,{...d,children:i.jsx("form",{onSubmit:v(b),children:i.jsxs("div",{className:"mx-auto grid max-w-[90rem] flex-1 auto-rows-max gap-6",children:[i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsx(Vc,{}),i.jsx("h1",{className:"flex-1 text-xl font-semibold tracking-tight shrink-0 whitespace-nowrap sm:grow-0",children:w("quotes.create.title")})]}),i.jsx("div",{className:"grid w-6/12 gap-6 mx-auto",children:i.jsxs(Ha,{className:"md:col-span-4",title:w("quotes.create.form_groups.general.title"),description:w("quotes.create.form_groups.general.desc"),footerActions:i.jsxs("div",{className:"flex items-stretch justify-between flex-1",children:[i.jsx(U,{size:"sm",variant:"outline",onClick:()=>n("/quotes"),children:w("common.discard")}),i.jsx(wo,{size:"sm",label:w("common.continue")})]}),children:[i.jsx(mn,{required:!0,name:"customer_reference",label:w("quotes.form_fields.customer_reference.label"),description:w("quotes.form_fields.customer_reference.desc"),placeholder:w("quotes.form_fields.customer_reference.placeholder")}),i.jsx(Uc,{required:!0,label:w("quotes.form_fields.date.label"),description:w("quotes.form_fields.date.desc"),placeholder:w("quotes.form_fields.date.placeholder"),name:"date"}),i.jsx(hn,{}),i.jsx(qt,{rows:4,className:"row-span-2",name:"customer_information",required:!0,label:w("quotes.form_fields.customer_information.label"),description:w("quotes.form_fields.customer_information.desc"),placeholder:w("quotes.form_fields.customer_information.placeholder")})]})})]})})})},Va=(n,a=!1)=>{const{discount:r,tax:o,subtotal_price:l}=n||{},c=$t.create(r||{amount:null,scale:2});if(c.isFailure)throw c.error;const d=c.object,h=$t.create(o||{amount:null,scale:2});if(h.isFailure)throw h.error;const p=h.object,x=Tt.create(l||{amount:null,scale:2});if(x.isFailure)throw x.error;const v=a?Dw(n.items).convertScale(2):x.object,R=v.percentage(d.toNumber()).convertScale(2),y=v.subtract(R).convertScale(2),b=y.percentage(p.toNumber()).convertScale(2),E=y.add(b).convertScale(2);return{subtotal_price:v,discount:n.discount,discount_price:R,before_tax_price:y,tax:p,tax_price:b,total_price:E}},Dw=n=>{let a=Tt.create({amount:0,scale:2}).object;return n&&n.map(r=>{const o=eo(r);a=a.add(o.total_price)}),a},eo=n=>{const{quantity:a,unit_price:r,discount:o}=n||{};if((!a||a&&a.amount===null)&&(!r||r&&r.amount===null)&&(!o||o&&o.amount===null))return{quantity:xn.create({amount:null,scale:0}).object,unit_price:Tt.create({amount:null,scale:2}).object,subtotal_price:Tt.create({amount:null,scale:2}).object,discount:$t.create({amount:null,scale:2}).object,total_price:Tt.create({amount:null,scale:2}).object};const l=xn.create(a);if(l.isFailure)throw l.error;const c=l.object,d=Tt.create(r);if(d.isFailure)throw d.error;const h=d.object,p=$t.create(o);if(p.isFailure)throw p.error;const x=p.object,v=h.multiply(c.toNumber()),R=v.subtract(v.percentage(x.toNumber()));return{quantity:c,unit_price:h,subtotal_price:v,discount:x,total_price:R}},Tw=()=>{const{id:n}=m0();return n};var Ki={exports:{}};/** * @license * Lodash * Copyright OpenJS Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - */Ki.exports;(function(n,a){(function(){var r,o="4.17.21",l=200,c="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",d="Expected a function",h="Invalid `variable` option passed into `_.template`",p="__lodash_hash_undefined__",x=500,v="__lodash_placeholder__",R=1,y=2,b=4,E=1,j=2,D=1,F=2,q=4,$=8,Q=16,O=32,k=64,H=128,W=256,B=512,se=30,ce="...",Y=800,Re=16,rt=1,ee=2,je=3,Me=1/0,U=9007199254740991,be=17976931348623157e292,Je=NaN,it=4294967295,_n=it-1,Yd=it>>>1,Qd=[["ary",H],["bind",D],["bindKey",F],["curry",$],["curryRight",Q],["flip",B],["partial",O],["partialRight",k],["rearg",W]],Ln="[object Arguments]",Gr="[object Array]",Xd="[object AsyncFunction]",dr="[object Boolean]",fr="[object Date]",Zd="[object DOMException]",Hr="[object Error]",Kr="[object Function]",Oo="[object GeneratorFunction]",Rt="[object Map]",gr="[object Number]",Jd="[object Null]",Bt="[object Object]",Po="[object Promise]",ef="[object Proxy]",mr="[object RegExp]",Et="[object Set]",hr="[object String]",Wr="[object Symbol]",tf="[object Undefined]",pr="[object WeakMap]",nf="[object WeakSet]",xr="[object ArrayBuffer]",On="[object DataView]",ls="[object Float32Array]",us="[object Float64Array]",cs="[object Int8Array]",ds="[object Int16Array]",fs="[object Int32Array]",gs="[object Uint8Array]",ms="[object Uint8ClampedArray]",hs="[object Uint16Array]",ps="[object Uint32Array]",rf=/\b__p \+= '';/g,sf=/\b(__p \+=) '' \+/g,af=/(__e\(.*?\)|\b__t\)) \+\n'';/g,ko=/&(?:amp|lt|gt|quot|#39);/g,qo=/[&<>"']/g,of=RegExp(ko.source),lf=RegExp(qo.source),uf=/<%-([\s\S]+?)%>/g,cf=/<%([\s\S]+?)%>/g,$o=/<%=([\s\S]+?)%>/g,df=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ff=/^\w*$/,gf=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,xs=/[\\^$.*+?()[\]{}|]/g,mf=RegExp(xs.source),vs=/^\s+/,hf=/\s/,pf=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,xf=/\{\n\/\* \[wrapped with (.+)\] \*/,vf=/,? & /,_f=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,bf=/[()=,{}\[\]\/\s]/,wf=/\\(\\)?/g,Sf=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,zo=/\w*$/,jf=/^[-+]0x[0-9a-f]+$/i,Cf=/^0b[01]+$/i,yf=/^\[object .+?Constructor\]$/,Nf=/^0o[0-7]+$/i,Rf=/^(?:0|[1-9]\d*)$/,Ef=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Yr=/($^)/,Af=/['\n\r\u2028\u2029\\]/g,Qr="\\ud800-\\udfff",If="\\u0300-\\u036f",Ff="\\ufe20-\\ufe2f",Mf="\\u20d0-\\u20ff",Bo=If+Ff+Mf,Vo="\\u2700-\\u27bf",Uo="a-z\\xdf-\\xf6\\xf8-\\xff",Df="\\xac\\xb1\\xd7\\xf7",Tf="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Lf="\\u2000-\\u206f",Of=" \\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",Go="A-Z\\xc0-\\xd6\\xd8-\\xde",Ho="\\ufe0e\\ufe0f",Ko=Df+Tf+Lf+Of,_s="['’]",Pf="["+Qr+"]",Wo="["+Ko+"]",Xr="["+Bo+"]",Yo="\\d+",kf="["+Vo+"]",Qo="["+Uo+"]",Xo="[^"+Qr+Ko+Yo+Vo+Uo+Go+"]",bs="\\ud83c[\\udffb-\\udfff]",qf="(?:"+Xr+"|"+bs+")",Zo="[^"+Qr+"]",ws="(?:\\ud83c[\\udde6-\\uddff]){2}",Ss="[\\ud800-\\udbff][\\udc00-\\udfff]",Pn="["+Go+"]",Jo="\\u200d",el="(?:"+Qo+"|"+Xo+")",$f="(?:"+Pn+"|"+Xo+")",tl="(?:"+_s+"(?:d|ll|m|re|s|t|ve))?",nl="(?:"+_s+"(?:D|LL|M|RE|S|T|VE))?",rl=qf+"?",il="["+Ho+"]?",zf="(?:"+Jo+"(?:"+[Zo,ws,Ss].join("|")+")"+il+rl+")*",Bf="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Vf="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",sl=il+rl+zf,Uf="(?:"+[kf,ws,Ss].join("|")+")"+sl,Gf="(?:"+[Zo+Xr+"?",Xr,ws,Ss,Pf].join("|")+")",Hf=RegExp(_s,"g"),Kf=RegExp(Xr,"g"),js=RegExp(bs+"(?="+bs+")|"+Gf+sl,"g"),Wf=RegExp([Pn+"?"+Qo+"+"+tl+"(?="+[Wo,Pn,"$"].join("|")+")",$f+"+"+nl+"(?="+[Wo,Pn+el,"$"].join("|")+")",Pn+"?"+el+"+"+tl,Pn+"+"+nl,Vf,Bf,Yo,Uf].join("|"),"g"),Yf=RegExp("["+Jo+Qr+Bo+Ho+"]"),Qf=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Xf=["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"],Zf=-1,ye={};ye[ls]=ye[us]=ye[cs]=ye[ds]=ye[fs]=ye[gs]=ye[ms]=ye[hs]=ye[ps]=!0,ye[Ln]=ye[Gr]=ye[xr]=ye[dr]=ye[On]=ye[fr]=ye[Hr]=ye[Kr]=ye[Rt]=ye[gr]=ye[Bt]=ye[mr]=ye[Et]=ye[hr]=ye[pr]=!1;var Ce={};Ce[Ln]=Ce[Gr]=Ce[xr]=Ce[On]=Ce[dr]=Ce[fr]=Ce[ls]=Ce[us]=Ce[cs]=Ce[ds]=Ce[fs]=Ce[Rt]=Ce[gr]=Ce[Bt]=Ce[mr]=Ce[Et]=Ce[hr]=Ce[Wr]=Ce[gs]=Ce[ms]=Ce[hs]=Ce[ps]=!0,Ce[Hr]=Ce[Kr]=Ce[pr]=!1;var Jf={À:"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"},eg={"&":"&","<":"<",">":">",'"':""","'":"'"},tg={"&":"&","<":"<",">":">",""":'"',"'":"'"},ng={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},rg=parseFloat,ig=parseInt,al=typeof Xn=="object"&&Xn&&Xn.Object===Object&&Xn,sg=typeof self=="object"&&self&&self.Object===Object&&self,Be=al||sg||Function("return this")(),Cs=a&&!a.nodeType&&a,bn=Cs&&!0&&n&&!n.nodeType&&n,ol=bn&&bn.exports===Cs,ys=ol&&al.process,vt=function(){try{var C=bn&&bn.require&&bn.require("util").types;return C||ys&&ys.binding&&ys.binding("util")}catch{}}(),ll=vt&&vt.isArrayBuffer,ul=vt&&vt.isDate,cl=vt&&vt.isMap,dl=vt&&vt.isRegExp,fl=vt&&vt.isSet,gl=vt&&vt.isTypedArray;function ct(C,I,A){switch(A.length){case 0:return C.call(I);case 1:return C.call(I,A[0]);case 2:return C.call(I,A[0],A[1]);case 3:return C.call(I,A[0],A[1],A[2])}return C.apply(I,A)}function ag(C,I,A,V){for(var re=-1,me=C==null?0:C.length;++re-1}function Ns(C,I,A){for(var V=-1,re=C==null?0:C.length;++V-1;);return A}function wl(C,I){for(var A=C.length;A--&&kn(I,C[A],0)>-1;);return A}function hg(C,I){for(var A=C.length,V=0;A--;)C[A]===I&&++V;return V}var pg=Is(Jf),xg=Is(eg);function vg(C){return"\\"+ng[C]}function _g(C,I){return C==null?r:C[I]}function qn(C){return Yf.test(C)}function bg(C){return Qf.test(C)}function wg(C){for(var I,A=[];!(I=C.next()).done;)A.push(I.value);return A}function Ts(C){var I=-1,A=Array(C.size);return C.forEach(function(V,re){A[++I]=[re,V]}),A}function Sl(C,I){return function(A){return C(I(A))}}function rn(C,I){for(var A=-1,V=C.length,re=0,me=[];++A-1}function lm(e,t){var s=this.__data__,u=hi(s,e);return u<0?(++this.size,s.push([e,t])):s[u][1]=t,this}Vt.prototype.clear=im,Vt.prototype.delete=sm,Vt.prototype.get=am,Vt.prototype.has=om,Vt.prototype.set=lm;function Ut(e){var t=-1,s=e==null?0:e.length;for(this.clear();++t=t?e:t)),e}function St(e,t,s,u,f,m){var _,S=t&R,N=t&y,T=t&b;if(s&&(_=f?s(e,u,f,m):s(e)),_!==r)return _;if(!Ae(e))return e;var L=ie(e);if(L){if(_=fh(e),!S)return st(e,_)}else{var P=Qe(e),z=P==Kr||P==Oo;if(cn(e))return iu(e,S);if(P==Bt||P==Ln||z&&!f){if(_=N||z?{}:ju(e),!S)return N?th(e,Cm(_,e)):eh(e,Tl(_,e))}else{if(!Ce[P])return f?e:{};_=gh(e,P,S)}}m||(m=new It);var K=m.get(e);if(K)return K;m.set(e,_),Zu(e)?e.forEach(function(ne){_.add(St(ne,t,s,ne,e,m))}):Qu(e)&&e.forEach(function(ne,de){_.set(de,St(ne,t,s,de,e,m))});var te=T?N?aa:sa:N?ot:ze,oe=L?r:te(e);return _t(oe||e,function(ne,de){oe&&(de=ne,ne=e[de]),Cr(_,de,St(ne,t,s,de,e,m))}),_}function ym(e){var t=ze(e);return function(s){return Ll(s,e,t)}}function Ll(e,t,s){var u=s.length;if(e==null)return!u;for(e=we(e);u--;){var f=s[u],m=t[f],_=e[f];if(_===r&&!(f in e)||!m(_))return!1}return!0}function Ol(e,t,s){if(typeof e!="function")throw new bt(d);return Fr(function(){e.apply(r,s)},t)}function yr(e,t,s,u){var f=-1,m=Zr,_=!0,S=e.length,N=[],T=t.length;if(!S)return N;s&&(t=Ee(t,dt(s))),u?(m=Ns,_=!1):t.length>=l&&(m=vr,_=!1,t=new jn(t));e:for(;++ff?0:f+s),u=u===r||u>f?f:ae(u),u<0&&(u+=f),u=s>u?0:ec(u);s0&&s(S)?t>1?Ve(S,t-1,s,u,f):nn(f,S):u||(f[f.length]=S)}return f}var zs=cu(),ql=cu(!0);function Ot(e,t){return e&&zs(e,t,ze)}function Bs(e,t){return e&&ql(e,t,ze)}function xi(e,t){return tn(t,function(s){return Yt(e[s])})}function yn(e,t){t=ln(t,e);for(var s=0,u=t.length;e!=null&&st}function Em(e,t){return e!=null&&xe.call(e,t)}function Am(e,t){return e!=null&&t in we(e)}function Im(e,t,s){return e>=Ye(t,s)&&e<$e(t,s)}function Us(e,t,s){for(var u=s?Ns:Zr,f=e[0].length,m=e.length,_=m,S=A(m),N=1/0,T=[];_--;){var L=e[_];_&&t&&(L=Ee(L,dt(t))),N=Ye(L.length,N),S[_]=!s&&(t||f>=120&&L.length>=120)?new jn(_&&L):r}L=e[0];var P=-1,z=S[0];e:for(;++P-1;)S!==e&&li.call(S,N,1),li.call(e,N,1);return e}function Ql(e,t){for(var s=e?t.length:0,u=s-1;s--;){var f=t[s];if(s==u||f!==m){var m=f;Wt(f)?li.call(e,f,1):Zs(e,f)}}return e}function Ys(e,t){return e+di(Il()*(t-e+1))}function Vm(e,t,s,u){for(var f=-1,m=$e(ci((t-e)/(s||1)),0),_=A(m);m--;)_[u?m:++f]=e,e+=s;return _}function Qs(e,t){var s="";if(!e||t<1||t>U)return s;do t%2&&(s+=e),t=di(t/2),t&&(e+=e);while(t);return s}function ue(e,t){return ga(Nu(e,t,lt),e+"")}function Um(e){return Dl(Qn(e))}function Gm(e,t){var s=Qn(e);return Ei(s,Cn(t,0,s.length))}function Er(e,t,s,u){if(!Ae(e))return e;t=ln(t,e);for(var f=-1,m=t.length,_=m-1,S=e;S!=null&&++ff?0:f+t),s=s>f?f:s,s<0&&(s+=f),f=t>s?0:s-t>>>0,t>>>=0;for(var m=A(f);++u>>1,_=e[m];_!==null&&!gt(_)&&(s?_<=t:_=l){var T=t?null:sh(e);if(T)return ei(T);_=!1,f=vr,N=new jn}else N=t?[]:S;e:for(;++u=u?e:jt(e,t,s)}var ru=Og||function(e){return Be.clearTimeout(e)};function iu(e,t){if(t)return e.slice();var s=e.length,u=yl?yl(s):new e.constructor(s);return e.copy(u),u}function na(e){var t=new e.constructor(e.byteLength);return new ai(t).set(new ai(e)),t}function Qm(e,t){var s=t?na(e.buffer):e.buffer;return new e.constructor(s,e.byteOffset,e.byteLength)}function Xm(e){var t=new e.constructor(e.source,zo.exec(e));return t.lastIndex=e.lastIndex,t}function Zm(e){return jr?we(jr.call(e)):{}}function su(e,t){var s=t?na(e.buffer):e.buffer;return new e.constructor(s,e.byteOffset,e.length)}function au(e,t){if(e!==t){var s=e!==r,u=e===null,f=e===e,m=gt(e),_=t!==r,S=t===null,N=t===t,T=gt(t);if(!S&&!T&&!m&&e>t||m&&_&&N&&!S&&!T||u&&_&&N||!s&&N||!f)return 1;if(!u&&!m&&!T&&e=S)return N;var T=s[u];return N*(T=="desc"?-1:1)}}return e.index-t.index}function ou(e,t,s,u){for(var f=-1,m=e.length,_=s.length,S=-1,N=t.length,T=$e(m-_,0),L=A(N+T),P=!u;++S1?s[f-1]:r,_=f>2?s[2]:r;for(m=e.length>3&&typeof m=="function"?(f--,m):r,_&&tt(s[0],s[1],_)&&(m=f<3?r:m,f=1),t=we(t);++u-1?f[m?t[_]:_]:r}}function gu(e){return Kt(function(t){var s=t.length,u=s,f=wt.prototype.thru;for(e&&t.reverse();u--;){var m=t[u];if(typeof m!="function")throw new bt(d);if(f&&!_&&Ni(m)=="wrapper")var _=new wt([],!0)}for(u=_?u:s;++u1&&ge.reverse(),L&&NS))return!1;var T=m.get(e),L=m.get(t);if(T&&L)return T==t&&L==e;var P=-1,z=!0,K=s&j?new jn:r;for(m.set(e,t),m.set(t,e);++P1?"& ":"")+t[u],t=t.join(s>2?", ":" "),e.replace(pf,`{ + */Ki.exports;(function(n,a){(function(){var r,o="4.17.21",l=200,c="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",d="Expected a function",h="Invalid `variable` option passed into `_.template`",p="__lodash_hash_undefined__",x=500,v="__lodash_placeholder__",R=1,y=2,b=4,E=1,j=2,D=1,F=2,q=4,$=8,Q=16,O=32,k=64,H=128,W=256,B=512,ae=30,ce="...",Y=800,Re=16,rt=1,ee=2,je=3,Me=1/0,G=9007199254740991,be=17976931348623157e292,Je=NaN,it=4294967295,bn=it-1,Yd=it>>>1,Qd=[["ary",H],["bind",D],["bindKey",F],["curry",$],["curryRight",Q],["flip",B],["partial",O],["partialRight",k],["rearg",W]],Ln="[object Arguments]",Gr="[object Array]",Xd="[object AsyncFunction]",dr="[object Boolean]",fr="[object Date]",Zd="[object DOMException]",Hr="[object Error]",Kr="[object Function]",Oo="[object GeneratorFunction]",Et="[object Map]",gr="[object Number]",Jd="[object Null]",Bt="[object Object]",Po="[object Promise]",ef="[object Proxy]",mr="[object RegExp]",At="[object Set]",hr="[object String]",Wr="[object Symbol]",tf="[object Undefined]",pr="[object WeakMap]",nf="[object WeakSet]",xr="[object ArrayBuffer]",On="[object DataView]",ls="[object Float32Array]",us="[object Float64Array]",cs="[object Int8Array]",ds="[object Int16Array]",fs="[object Int32Array]",gs="[object Uint8Array]",ms="[object Uint8ClampedArray]",hs="[object Uint16Array]",ps="[object Uint32Array]",rf=/\b__p \+= '';/g,sf=/\b(__p \+=) '' \+/g,af=/(__e\(.*?\)|\b__t\)) \+\n'';/g,ko=/&(?:amp|lt|gt|quot|#39);/g,qo=/[&<>"']/g,of=RegExp(ko.source),lf=RegExp(qo.source),uf=/<%-([\s\S]+?)%>/g,cf=/<%([\s\S]+?)%>/g,$o=/<%=([\s\S]+?)%>/g,df=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ff=/^\w*$/,gf=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,xs=/[\\^$.*+?()[\]{}|]/g,mf=RegExp(xs.source),vs=/^\s+/,hf=/\s/,pf=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,xf=/\{\n\/\* \[wrapped with (.+)\] \*/,vf=/,? & /,_f=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,bf=/[()=,{}\[\]\/\s]/,wf=/\\(\\)?/g,Sf=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,zo=/\w*$/,jf=/^[-+]0x[0-9a-f]+$/i,Cf=/^0b[01]+$/i,yf=/^\[object .+?Constructor\]$/,Nf=/^0o[0-7]+$/i,Rf=/^(?:0|[1-9]\d*)$/,Ef=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Yr=/($^)/,Af=/['\n\r\u2028\u2029\\]/g,Qr="\\ud800-\\udfff",If="\\u0300-\\u036f",Ff="\\ufe20-\\ufe2f",Mf="\\u20d0-\\u20ff",Bo=If+Ff+Mf,Vo="\\u2700-\\u27bf",Uo="a-z\\xdf-\\xf6\\xf8-\\xff",Df="\\xac\\xb1\\xd7\\xf7",Tf="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Lf="\\u2000-\\u206f",Of=" \\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",Go="A-Z\\xc0-\\xd6\\xd8-\\xde",Ho="\\ufe0e\\ufe0f",Ko=Df+Tf+Lf+Of,_s="['’]",Pf="["+Qr+"]",Wo="["+Ko+"]",Xr="["+Bo+"]",Yo="\\d+",kf="["+Vo+"]",Qo="["+Uo+"]",Xo="[^"+Qr+Ko+Yo+Vo+Uo+Go+"]",bs="\\ud83c[\\udffb-\\udfff]",qf="(?:"+Xr+"|"+bs+")",Zo="[^"+Qr+"]",ws="(?:\\ud83c[\\udde6-\\uddff]){2}",Ss="[\\ud800-\\udbff][\\udc00-\\udfff]",Pn="["+Go+"]",Jo="\\u200d",el="(?:"+Qo+"|"+Xo+")",$f="(?:"+Pn+"|"+Xo+")",tl="(?:"+_s+"(?:d|ll|m|re|s|t|ve))?",nl="(?:"+_s+"(?:D|LL|M|RE|S|T|VE))?",rl=qf+"?",il="["+Ho+"]?",zf="(?:"+Jo+"(?:"+[Zo,ws,Ss].join("|")+")"+il+rl+")*",Bf="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Vf="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",sl=il+rl+zf,Uf="(?:"+[kf,ws,Ss].join("|")+")"+sl,Gf="(?:"+[Zo+Xr+"?",Xr,ws,Ss,Pf].join("|")+")",Hf=RegExp(_s,"g"),Kf=RegExp(Xr,"g"),js=RegExp(bs+"(?="+bs+")|"+Gf+sl,"g"),Wf=RegExp([Pn+"?"+Qo+"+"+tl+"(?="+[Wo,Pn,"$"].join("|")+")",$f+"+"+nl+"(?="+[Wo,Pn+el,"$"].join("|")+")",Pn+"?"+el+"+"+tl,Pn+"+"+nl,Vf,Bf,Yo,Uf].join("|"),"g"),Yf=RegExp("["+Jo+Qr+Bo+Ho+"]"),Qf=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Xf=["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"],Zf=-1,ye={};ye[ls]=ye[us]=ye[cs]=ye[ds]=ye[fs]=ye[gs]=ye[ms]=ye[hs]=ye[ps]=!0,ye[Ln]=ye[Gr]=ye[xr]=ye[dr]=ye[On]=ye[fr]=ye[Hr]=ye[Kr]=ye[Et]=ye[gr]=ye[Bt]=ye[mr]=ye[At]=ye[hr]=ye[pr]=!1;var Ce={};Ce[Ln]=Ce[Gr]=Ce[xr]=Ce[On]=Ce[dr]=Ce[fr]=Ce[ls]=Ce[us]=Ce[cs]=Ce[ds]=Ce[fs]=Ce[Et]=Ce[gr]=Ce[Bt]=Ce[mr]=Ce[At]=Ce[hr]=Ce[Wr]=Ce[gs]=Ce[ms]=Ce[hs]=Ce[ps]=!0,Ce[Hr]=Ce[Kr]=Ce[pr]=!1;var Jf={À:"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"},eg={"&":"&","<":"<",">":">",'"':""","'":"'"},tg={"&":"&","<":"<",">":">",""":'"',"'":"'"},ng={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},rg=parseFloat,ig=parseInt,al=typeof Xn=="object"&&Xn&&Xn.Object===Object&&Xn,sg=typeof self=="object"&&self&&self.Object===Object&&self,Ve=al||sg||Function("return this")(),Cs=a&&!a.nodeType&&a,wn=Cs&&!0&&n&&!n.nodeType&&n,ol=wn&&wn.exports===Cs,ys=ol&&al.process,vt=function(){try{var C=wn&&wn.require&&wn.require("util").types;return C||ys&&ys.binding&&ys.binding("util")}catch{}}(),ll=vt&&vt.isArrayBuffer,ul=vt&&vt.isDate,cl=vt&&vt.isMap,dl=vt&&vt.isRegExp,fl=vt&&vt.isSet,gl=vt&&vt.isTypedArray;function dt(C,I,A){switch(A.length){case 0:return C.call(I);case 1:return C.call(I,A[0]);case 2:return C.call(I,A[0],A[1]);case 3:return C.call(I,A[0],A[1],A[2])}return C.apply(I,A)}function ag(C,I,A,V){for(var re=-1,me=C==null?0:C.length;++re-1}function Ns(C,I,A){for(var V=-1,re=C==null?0:C.length;++V-1;);return A}function wl(C,I){for(var A=C.length;A--&&kn(I,C[A],0)>-1;);return A}function hg(C,I){for(var A=C.length,V=0;A--;)C[A]===I&&++V;return V}var pg=Is(Jf),xg=Is(eg);function vg(C){return"\\"+ng[C]}function _g(C,I){return C==null?r:C[I]}function qn(C){return Yf.test(C)}function bg(C){return Qf.test(C)}function wg(C){for(var I,A=[];!(I=C.next()).done;)A.push(I.value);return A}function Ts(C){var I=-1,A=Array(C.size);return C.forEach(function(V,re){A[++I]=[re,V]}),A}function Sl(C,I){return function(A){return C(I(A))}}function rn(C,I){for(var A=-1,V=C.length,re=0,me=[];++A-1}function lm(e,t){var s=this.__data__,u=hi(s,e);return u<0?(++this.size,s.push([e,t])):s[u][1]=t,this}Vt.prototype.clear=im,Vt.prototype.delete=sm,Vt.prototype.get=am,Vt.prototype.has=om,Vt.prototype.set=lm;function Ut(e){var t=-1,s=e==null?0:e.length;for(this.clear();++t=t?e:t)),e}function St(e,t,s,u,f,m){var _,S=t&R,N=t&y,T=t&b;if(s&&(_=f?s(e,u,f,m):s(e)),_!==r)return _;if(!Ae(e))return e;var L=ie(e);if(L){if(_=fh(e),!S)return st(e,_)}else{var P=Xe(e),z=P==Kr||P==Oo;if(cn(e))return iu(e,S);if(P==Bt||P==Ln||z&&!f){if(_=N||z?{}:ju(e),!S)return N?th(e,Cm(_,e)):eh(e,Tl(_,e))}else{if(!Ce[P])return f?e:{};_=gh(e,P,S)}}m||(m=new Ft);var K=m.get(e);if(K)return K;m.set(e,_),Zu(e)?e.forEach(function(ne){_.add(St(ne,t,s,ne,e,m))}):Qu(e)&&e.forEach(function(ne,de){_.set(de,St(ne,t,s,de,e,m))});var te=T?N?aa:sa:N?ot:ze,le=L?r:te(e);return _t(le||e,function(ne,de){le&&(de=ne,ne=e[de]),Cr(_,de,St(ne,t,s,de,e,m))}),_}function ym(e){var t=ze(e);return function(s){return Ll(s,e,t)}}function Ll(e,t,s){var u=s.length;if(e==null)return!u;for(e=we(e);u--;){var f=s[u],m=t[f],_=e[f];if(_===r&&!(f in e)||!m(_))return!1}return!0}function Ol(e,t,s){if(typeof e!="function")throw new bt(d);return Fr(function(){e.apply(r,s)},t)}function yr(e,t,s,u){var f=-1,m=Zr,_=!0,S=e.length,N=[],T=t.length;if(!S)return N;s&&(t=Ee(t,ft(s))),u?(m=Ns,_=!1):t.length>=l&&(m=vr,_=!1,t=new Cn(t));e:for(;++ff?0:f+s),u=u===r||u>f?f:oe(u),u<0&&(u+=f),u=s>u?0:ec(u);s0&&s(S)?t>1?Ue(S,t-1,s,u,f):nn(f,S):u||(f[f.length]=S)}return f}var zs=cu(),ql=cu(!0);function Ot(e,t){return e&&zs(e,t,ze)}function Bs(e,t){return e&&ql(e,t,ze)}function xi(e,t){return tn(t,function(s){return Yt(e[s])})}function Nn(e,t){t=ln(t,e);for(var s=0,u=t.length;e!=null&&st}function Em(e,t){return e!=null&&xe.call(e,t)}function Am(e,t){return e!=null&&t in we(e)}function Im(e,t,s){return e>=Qe(t,s)&&e<$e(t,s)}function Us(e,t,s){for(var u=s?Ns:Zr,f=e[0].length,m=e.length,_=m,S=A(m),N=1/0,T=[];_--;){var L=e[_];_&&t&&(L=Ee(L,ft(t))),N=Qe(L.length,N),S[_]=!s&&(t||f>=120&&L.length>=120)?new Cn(_&&L):r}L=e[0];var P=-1,z=S[0];e:for(;++P-1;)S!==e&&li.call(S,N,1),li.call(e,N,1);return e}function Ql(e,t){for(var s=e?t.length:0,u=s-1;s--;){var f=t[s];if(s==u||f!==m){var m=f;Wt(f)?li.call(e,f,1):Zs(e,f)}}return e}function Ys(e,t){return e+di(Il()*(t-e+1))}function Vm(e,t,s,u){for(var f=-1,m=$e(ci((t-e)/(s||1)),0),_=A(m);m--;)_[u?m:++f]=e,e+=s;return _}function Qs(e,t){var s="";if(!e||t<1||t>G)return s;do t%2&&(s+=e),t=di(t/2),t&&(e+=e);while(t);return s}function ue(e,t){return ga(Nu(e,t,lt),e+"")}function Um(e){return Dl(Qn(e))}function Gm(e,t){var s=Qn(e);return Ei(s,yn(t,0,s.length))}function Er(e,t,s,u){if(!Ae(e))return e;t=ln(t,e);for(var f=-1,m=t.length,_=m-1,S=e;S!=null&&++ff?0:f+t),s=s>f?f:s,s<0&&(s+=f),f=t>s?0:s-t>>>0,t>>>=0;for(var m=A(f);++u>>1,_=e[m];_!==null&&!mt(_)&&(s?_<=t:_=l){var T=t?null:sh(e);if(T)return ei(T);_=!1,f=vr,N=new Cn}else N=t?[]:S;e:for(;++u=u?e:jt(e,t,s)}var ru=Og||function(e){return Ve.clearTimeout(e)};function iu(e,t){if(t)return e.slice();var s=e.length,u=yl?yl(s):new e.constructor(s);return e.copy(u),u}function na(e){var t=new e.constructor(e.byteLength);return new ai(t).set(new ai(e)),t}function Qm(e,t){var s=t?na(e.buffer):e.buffer;return new e.constructor(s,e.byteOffset,e.byteLength)}function Xm(e){var t=new e.constructor(e.source,zo.exec(e));return t.lastIndex=e.lastIndex,t}function Zm(e){return jr?we(jr.call(e)):{}}function su(e,t){var s=t?na(e.buffer):e.buffer;return new e.constructor(s,e.byteOffset,e.length)}function au(e,t){if(e!==t){var s=e!==r,u=e===null,f=e===e,m=mt(e),_=t!==r,S=t===null,N=t===t,T=mt(t);if(!S&&!T&&!m&&e>t||m&&_&&N&&!S&&!T||u&&_&&N||!s&&N||!f)return 1;if(!u&&!m&&!T&&e=S)return N;var T=s[u];return N*(T=="desc"?-1:1)}}return e.index-t.index}function ou(e,t,s,u){for(var f=-1,m=e.length,_=s.length,S=-1,N=t.length,T=$e(m-_,0),L=A(N+T),P=!u;++S1?s[f-1]:r,_=f>2?s[2]:r;for(m=e.length>3&&typeof m=="function"?(f--,m):r,_&&tt(s[0],s[1],_)&&(m=f<3?r:m,f=1),t=we(t);++u-1?f[m?t[_]:_]:r}}function gu(e){return Kt(function(t){var s=t.length,u=s,f=wt.prototype.thru;for(e&&t.reverse();u--;){var m=t[u];if(typeof m!="function")throw new bt(d);if(f&&!_&&Ni(m)=="wrapper")var _=new wt([],!0)}for(u=_?u:s;++u1&&ge.reverse(),L&&NS))return!1;var T=m.get(e),L=m.get(t);if(T&&L)return T==t&&L==e;var P=-1,z=!0,K=s&j?new Cn:r;for(m.set(e,t),m.set(t,e);++P1?"& ":"")+t[u],t=t.join(s>2?", ":" "),e.replace(pf,`{ /* [wrapped with `+t+`] */ -`)}function hh(e){return ie(e)||En(e)||!!(El&&e&&e[El])}function Wt(e,t){var s=typeof e;return t=t??U,!!t&&(s=="number"||s!="symbol"&&Rf.test(e))&&e>-1&&e%1==0&&e0){if(++t>=Y)return arguments[0]}else t=0;return e.apply(r,arguments)}}function Ei(e,t){var s=-1,u=e.length,f=u-1;for(t=t===r?u:t;++s1?e[t-1]:r;return s=typeof s=="function"?(e.pop(),s):r,ku(e,s)});function qu(e){var t=g(e);return t.__chain__=!0,t}function Np(e,t){return t(e),e}function Ai(e,t){return t(e)}var Rp=Kt(function(e){var t=e.length,s=t?e[0]:0,u=this.__wrapped__,f=function(m){return $s(m,e)};return t>1||this.__actions__.length||!(u instanceof fe)||!Wt(s)?this.thru(f):(u=u.slice(s,+s+(t?1:0)),u.__actions__.push({func:Ai,args:[f],thisArg:r}),new wt(u,this.__chain__).thru(function(m){return t&&!m.length&&m.push(r),m}))});function Ep(){return qu(this)}function Ap(){return new wt(this.value(),this.__chain__)}function Ip(){this.__values__===r&&(this.__values__=Ju(this.value()));var e=this.__index__>=this.__values__.length,t=e?r:this.__values__[this.__index__++];return{done:e,value:t}}function Fp(){return this}function Mp(e){for(var t,s=this;s instanceof mi;){var u=Mu(s);u.__index__=0,u.__values__=r,t?f.__wrapped__=u:t=u;var f=u;s=s.__wrapped__}return f.__wrapped__=e,t}function Dp(){var e=this.__wrapped__;if(e instanceof fe){var t=e;return this.__actions__.length&&(t=new fe(this)),t=t.reverse(),t.__actions__.push({func:Ai,args:[ma],thisArg:r}),new wt(t,this.__chain__)}return this.thru(ma)}function Tp(){return tu(this.__wrapped__,this.__actions__)}var Lp=wi(function(e,t,s){xe.call(e,s)?++e[s]:Gt(e,s,1)});function Op(e,t,s){var u=ie(e)?ml:Nm;return s&&tt(e,t,s)&&(t=r),u(e,X(t,3))}function Pp(e,t){var s=ie(e)?tn:kl;return s(e,X(t,3))}var kp=fu(Du),qp=fu(Tu);function $p(e,t){return Ve(Ii(e,t),1)}function zp(e,t){return Ve(Ii(e,t),Me)}function Bp(e,t,s){return s=s===r?1:ae(s),Ve(Ii(e,t),s)}function $u(e,t){var s=ie(e)?_t:an;return s(e,X(t,3))}function zu(e,t){var s=ie(e)?og:Pl;return s(e,X(t,3))}var Vp=wi(function(e,t,s){xe.call(e,s)?e[s].push(t):Gt(e,s,[t])});function Up(e,t,s,u){e=at(e)?e:Qn(e),s=s&&!u?ae(s):0;var f=e.length;return s<0&&(s=$e(f+s,0)),Li(e)?s<=f&&e.indexOf(t,s)>-1:!!f&&kn(e,t,s)>-1}var Gp=ue(function(e,t,s){var u=-1,f=typeof t=="function",m=at(e)?A(e.length):[];return an(e,function(_){m[++u]=f?ct(t,_,s):Nr(_,t,s)}),m}),Hp=wi(function(e,t,s){Gt(e,s,t)});function Ii(e,t){var s=ie(e)?Ee:Ul;return s(e,X(t,3))}function Kp(e,t,s,u){return e==null?[]:(ie(t)||(t=t==null?[]:[t]),s=u?r:s,ie(s)||(s=s==null?[]:[s]),Wl(e,t,s))}var Wp=wi(function(e,t,s){e[s?0:1].push(t)},function(){return[[],[]]});function Yp(e,t,s){var u=ie(e)?Rs:vl,f=arguments.length<3;return u(e,X(t,4),s,f,an)}function Qp(e,t,s){var u=ie(e)?lg:vl,f=arguments.length<3;return u(e,X(t,4),s,f,Pl)}function Xp(e,t){var s=ie(e)?tn:kl;return s(e,Di(X(t,3)))}function Zp(e){var t=ie(e)?Dl:Um;return t(e)}function Jp(e,t,s){(s?tt(e,t,s):t===r)?t=1:t=ae(t);var u=ie(e)?wm:Gm;return u(e,t)}function ex(e){var t=ie(e)?Sm:Km;return t(e)}function tx(e){if(e==null)return 0;if(at(e))return Li(e)?$n(e):e.length;var t=Qe(e);return t==Rt||t==Et?e.size:Hs(e).length}function nx(e,t,s){var u=ie(e)?Es:Wm;return s&&tt(e,t,s)&&(t=r),u(e,X(t,3))}var rx=ue(function(e,t){if(e==null)return[];var s=t.length;return s>1&&tt(e,t[0],t[1])?t=[]:s>2&&tt(t[0],t[1],t[2])&&(t=[t[0]]),Wl(e,Ve(t,1),[])}),Fi=Pg||function(){return Be.Date.now()};function ix(e,t){if(typeof t!="function")throw new bt(d);return e=ae(e),function(){if(--e<1)return t.apply(this,arguments)}}function Bu(e,t,s){return t=s?r:t,t=e&&t==null?e.length:t,Ht(e,H,r,r,r,r,t)}function Vu(e,t){var s;if(typeof t!="function")throw new bt(d);return e=ae(e),function(){return--e>0&&(s=t.apply(this,arguments)),e<=1&&(t=r),s}}var pa=ue(function(e,t,s){var u=D;if(s.length){var f=rn(s,Wn(pa));u|=O}return Ht(e,u,t,s,f)}),Uu=ue(function(e,t,s){var u=D|F;if(s.length){var f=rn(s,Wn(Uu));u|=O}return Ht(t,u,e,s,f)});function Gu(e,t,s){t=s?r:t;var u=Ht(e,$,r,r,r,r,r,t);return u.placeholder=Gu.placeholder,u}function Hu(e,t,s){t=s?r:t;var u=Ht(e,Q,r,r,r,r,r,t);return u.placeholder=Hu.placeholder,u}function Ku(e,t,s){var u,f,m,_,S,N,T=0,L=!1,P=!1,z=!0;if(typeof e!="function")throw new bt(d);t=yt(t)||0,Ae(s)&&(L=!!s.leading,P="maxWait"in s,m=P?$e(yt(s.maxWait)||0,t):m,z="trailing"in s?!!s.trailing:z);function K(Te){var Mt=u,Xt=f;return u=f=r,T=Te,_=e.apply(Xt,Mt),_}function te(Te){return T=Te,S=Fr(de,t),L?K(Te):_}function oe(Te){var Mt=Te-N,Xt=Te-T,fc=t-Mt;return P?Ye(fc,m-Xt):fc}function ne(Te){var Mt=Te-N,Xt=Te-T;return N===r||Mt>=t||Mt<0||P&&Xt>=m}function de(){var Te=Fi();if(ne(Te))return ge(Te);S=Fr(de,oe(Te))}function ge(Te){return S=r,z&&u?K(Te):(u=f=r,_)}function mt(){S!==r&&ru(S),T=0,u=N=f=S=r}function nt(){return S===r?_:ge(Fi())}function ht(){var Te=Fi(),Mt=ne(Te);if(u=arguments,f=this,N=Te,Mt){if(S===r)return te(N);if(P)return ru(S),S=Fr(de,t),K(N)}return S===r&&(S=Fr(de,t)),_}return ht.cancel=mt,ht.flush=nt,ht}var sx=ue(function(e,t){return Ol(e,1,t)}),ax=ue(function(e,t,s){return Ol(e,yt(t)||0,s)});function ox(e){return Ht(e,B)}function Mi(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new bt(d);var s=function(){var u=arguments,f=t?t.apply(this,u):u[0],m=s.cache;if(m.has(f))return m.get(f);var _=e.apply(this,u);return s.cache=m.set(f,_)||m,_};return s.cache=new(Mi.Cache||Ut),s}Mi.Cache=Ut;function Di(e){if(typeof e!="function")throw new bt(d);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}function lx(e){return Vu(2,e)}var ux=Ym(function(e,t){t=t.length==1&&ie(t[0])?Ee(t[0],dt(X())):Ee(Ve(t,1),dt(X()));var s=t.length;return ue(function(u){for(var f=-1,m=Ye(u.length,s);++f=t}),En=zl(function(){return arguments}())?zl:function(e){return Ie(e)&&xe.call(e,"callee")&&!Rl.call(e,"callee")},ie=A.isArray,Cx=ll?dt(ll):Mm;function at(e){return e!=null&&Ti(e.length)&&!Yt(e)}function De(e){return Ie(e)&&at(e)}function yx(e){return e===!0||e===!1||Ie(e)&&et(e)==dr}var cn=qg||Ea,Nx=ul?dt(ul):Dm;function Rx(e){return Ie(e)&&e.nodeType===1&&!Mr(e)}function Ex(e){if(e==null)return!0;if(at(e)&&(ie(e)||typeof e=="string"||typeof e.splice=="function"||cn(e)||Yn(e)||En(e)))return!e.length;var t=Qe(e);if(t==Rt||t==Et)return!e.size;if(Ir(e))return!Hs(e).length;for(var s in e)if(xe.call(e,s))return!1;return!0}function Ax(e,t){return Rr(e,t)}function Ix(e,t,s){s=typeof s=="function"?s:r;var u=s?s(e,t):r;return u===r?Rr(e,t,r,s):!!u}function va(e){if(!Ie(e))return!1;var t=et(e);return t==Hr||t==Zd||typeof e.message=="string"&&typeof e.name=="string"&&!Mr(e)}function Fx(e){return typeof e=="number"&&Al(e)}function Yt(e){if(!Ae(e))return!1;var t=et(e);return t==Kr||t==Oo||t==Xd||t==ef}function Yu(e){return typeof e=="number"&&e==ae(e)}function Ti(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=U}function Ae(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function Ie(e){return e!=null&&typeof e=="object"}var Qu=cl?dt(cl):Lm;function Mx(e,t){return e===t||Gs(e,t,la(t))}function Dx(e,t,s){return s=typeof s=="function"?s:r,Gs(e,t,la(t),s)}function Tx(e){return Xu(e)&&e!=+e}function Lx(e){if(vh(e))throw new re(c);return Bl(e)}function Ox(e){return e===null}function Px(e){return e==null}function Xu(e){return typeof e=="number"||Ie(e)&&et(e)==gr}function Mr(e){if(!Ie(e)||et(e)!=Bt)return!1;var t=oi(e);if(t===null)return!0;var s=xe.call(t,"constructor")&&t.constructor;return typeof s=="function"&&s instanceof s&&ri.call(s)==Dg}var _a=dl?dt(dl):Om;function kx(e){return Yu(e)&&e>=-9007199254740991&&e<=U}var Zu=fl?dt(fl):Pm;function Li(e){return typeof e=="string"||!ie(e)&&Ie(e)&&et(e)==hr}function gt(e){return typeof e=="symbol"||Ie(e)&&et(e)==Wr}var Yn=gl?dt(gl):km;function qx(e){return e===r}function $x(e){return Ie(e)&&Qe(e)==pr}function zx(e){return Ie(e)&&et(e)==nf}var Bx=yi(Ks),Vx=yi(function(e,t){return e<=t});function Ju(e){if(!e)return[];if(at(e))return Li(e)?At(e):st(e);if(_r&&e[_r])return wg(e[_r]());var t=Qe(e),s=t==Rt?Ts:t==Et?ei:Qn;return s(e)}function Qt(e){if(!e)return e===0?e:0;if(e=yt(e),e===Me||e===-1/0){var t=e<0?-1:1;return t*be}return e===e?e:0}function ae(e){var t=Qt(e),s=t%1;return t===t?s?t-s:t:0}function ec(e){return e?Cn(ae(e),0,it):0}function yt(e){if(typeof e=="number")return e;if(gt(e))return Je;if(Ae(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Ae(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=_l(e);var s=Cf.test(e);return s||Nf.test(e)?ig(e.slice(2),s?2:8):jf.test(e)?Je:+e}function tc(e){return Pt(e,ot(e))}function Ux(e){return e?Cn(ae(e),-9007199254740991,U):e===0?e:0}function pe(e){return e==null?"":ft(e)}var Gx=Hn(function(e,t){if(Ir(t)||at(t)){Pt(t,ze(t),e);return}for(var s in t)xe.call(t,s)&&Cr(e,s,t[s])}),nc=Hn(function(e,t){Pt(t,ot(t),e)}),Oi=Hn(function(e,t,s,u){Pt(t,ot(t),e,u)}),Hx=Hn(function(e,t,s,u){Pt(t,ze(t),e,u)}),Kx=Kt($s);function Wx(e,t){var s=Gn(e);return t==null?s:Tl(s,t)}var Yx=ue(function(e,t){e=we(e);var s=-1,u=t.length,f=u>2?t[2]:r;for(f&&tt(t[0],t[1],f)&&(u=1);++s1),m}),Pt(e,aa(e),s),u&&(s=St(s,R|y|b,ah));for(var f=t.length;f--;)Zs(s,t[f]);return s});function gv(e,t){return ic(e,Di(X(t)))}var mv=Kt(function(e,t){return e==null?{}:zm(e,t)});function ic(e,t){if(e==null)return{};var s=Ee(aa(e),function(u){return[u]});return t=X(t),Yl(e,s,function(u,f){return t(u,f[0])})}function hv(e,t,s){t=ln(t,e);var u=-1,f=t.length;for(f||(f=1,e=r);++ut){var u=e;e=t,t=u}if(s||e%1||t%1){var f=Il();return Ye(e+f*(t-e+rg("1e-"+((f+"").length-1))),t)}return Ys(e,t)}var Nv=Kn(function(e,t,s){return t=t.toLowerCase(),e+(s?oc(t):t)});function oc(e){return Sa(pe(e).toLowerCase())}function lc(e){return e=pe(e),e&&e.replace(Ef,pg).replace(Kf,"")}function Rv(e,t,s){e=pe(e),t=ft(t);var u=e.length;s=s===r?u:Cn(ae(s),0,u);var f=s;return s-=t.length,s>=0&&e.slice(s,f)==t}function Ev(e){return e=pe(e),e&&lf.test(e)?e.replace(qo,xg):e}function Av(e){return e=pe(e),e&&mf.test(e)?e.replace(xs,"\\$&"):e}var Iv=Kn(function(e,t,s){return e+(s?"-":"")+t.toLowerCase()}),Fv=Kn(function(e,t,s){return e+(s?" ":"")+t.toLowerCase()}),Mv=du("toLowerCase");function Dv(e,t,s){e=pe(e),t=ae(t);var u=t?$n(e):0;if(!t||u>=t)return e;var f=(t-u)/2;return Ci(di(f),s)+e+Ci(ci(f),s)}function Tv(e,t,s){e=pe(e),t=ae(t);var u=t?$n(e):0;return t&&u>>0,s?(e=pe(e),e&&(typeof t=="string"||t!=null&&!_a(t))&&(t=ft(t),!t&&qn(e))?un(At(e),0,s):e.split(t,s)):[]}var zv=Kn(function(e,t,s){return e+(s?" ":"")+Sa(t)});function Bv(e,t,s){return e=pe(e),s=s==null?0:Cn(ae(s),0,e.length),t=ft(t),e.slice(s,s+t.length)==t}function Vv(e,t,s){var u=g.templateSettings;s&&tt(e,t,s)&&(t=r),e=pe(e),t=Oi({},t,u,vu);var f=Oi({},t.imports,u.imports,vu),m=ze(f),_=Ds(f,m),S,N,T=0,L=t.interpolate||Yr,P="__p += '",z=Ls((t.escape||Yr).source+"|"+L.source+"|"+(L===$o?Sf:Yr).source+"|"+(t.evaluate||Yr).source+"|$","g"),K="//# sourceURL="+(xe.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Zf+"]")+` -`;e.replace(z,function(ne,de,ge,mt,nt,ht){return ge||(ge=mt),P+=e.slice(T,ht).replace(Af,vg),de&&(S=!0,P+=`' + +`)}function hh(e){return ie(e)||An(e)||!!(El&&e&&e[El])}function Wt(e,t){var s=typeof e;return t=t??G,!!t&&(s=="number"||s!="symbol"&&Rf.test(e))&&e>-1&&e%1==0&&e0){if(++t>=Y)return arguments[0]}else t=0;return e.apply(r,arguments)}}function Ei(e,t){var s=-1,u=e.length,f=u-1;for(t=t===r?u:t;++s1?e[t-1]:r;return s=typeof s=="function"?(e.pop(),s):r,ku(e,s)});function qu(e){var t=g(e);return t.__chain__=!0,t}function Np(e,t){return t(e),e}function Ai(e,t){return t(e)}var Rp=Kt(function(e){var t=e.length,s=t?e[0]:0,u=this.__wrapped__,f=function(m){return $s(m,e)};return t>1||this.__actions__.length||!(u instanceof fe)||!Wt(s)?this.thru(f):(u=u.slice(s,+s+(t?1:0)),u.__actions__.push({func:Ai,args:[f],thisArg:r}),new wt(u,this.__chain__).thru(function(m){return t&&!m.length&&m.push(r),m}))});function Ep(){return qu(this)}function Ap(){return new wt(this.value(),this.__chain__)}function Ip(){this.__values__===r&&(this.__values__=Ju(this.value()));var e=this.__index__>=this.__values__.length,t=e?r:this.__values__[this.__index__++];return{done:e,value:t}}function Fp(){return this}function Mp(e){for(var t,s=this;s instanceof mi;){var u=Mu(s);u.__index__=0,u.__values__=r,t?f.__wrapped__=u:t=u;var f=u;s=s.__wrapped__}return f.__wrapped__=e,t}function Dp(){var e=this.__wrapped__;if(e instanceof fe){var t=e;return this.__actions__.length&&(t=new fe(this)),t=t.reverse(),t.__actions__.push({func:Ai,args:[ma],thisArg:r}),new wt(t,this.__chain__)}return this.thru(ma)}function Tp(){return tu(this.__wrapped__,this.__actions__)}var Lp=wi(function(e,t,s){xe.call(e,s)?++e[s]:Gt(e,s,1)});function Op(e,t,s){var u=ie(e)?ml:Nm;return s&&tt(e,t,s)&&(t=r),u(e,X(t,3))}function Pp(e,t){var s=ie(e)?tn:kl;return s(e,X(t,3))}var kp=fu(Du),qp=fu(Tu);function $p(e,t){return Ue(Ii(e,t),1)}function zp(e,t){return Ue(Ii(e,t),Me)}function Bp(e,t,s){return s=s===r?1:oe(s),Ue(Ii(e,t),s)}function $u(e,t){var s=ie(e)?_t:an;return s(e,X(t,3))}function zu(e,t){var s=ie(e)?og:Pl;return s(e,X(t,3))}var Vp=wi(function(e,t,s){xe.call(e,s)?e[s].push(t):Gt(e,s,[t])});function Up(e,t,s,u){e=at(e)?e:Qn(e),s=s&&!u?oe(s):0;var f=e.length;return s<0&&(s=$e(f+s,0)),Li(e)?s<=f&&e.indexOf(t,s)>-1:!!f&&kn(e,t,s)>-1}var Gp=ue(function(e,t,s){var u=-1,f=typeof t=="function",m=at(e)?A(e.length):[];return an(e,function(_){m[++u]=f?dt(t,_,s):Nr(_,t,s)}),m}),Hp=wi(function(e,t,s){Gt(e,s,t)});function Ii(e,t){var s=ie(e)?Ee:Ul;return s(e,X(t,3))}function Kp(e,t,s,u){return e==null?[]:(ie(t)||(t=t==null?[]:[t]),s=u?r:s,ie(s)||(s=s==null?[]:[s]),Wl(e,t,s))}var Wp=wi(function(e,t,s){e[s?0:1].push(t)},function(){return[[],[]]});function Yp(e,t,s){var u=ie(e)?Rs:vl,f=arguments.length<3;return u(e,X(t,4),s,f,an)}function Qp(e,t,s){var u=ie(e)?lg:vl,f=arguments.length<3;return u(e,X(t,4),s,f,Pl)}function Xp(e,t){var s=ie(e)?tn:kl;return s(e,Di(X(t,3)))}function Zp(e){var t=ie(e)?Dl:Um;return t(e)}function Jp(e,t,s){(s?tt(e,t,s):t===r)?t=1:t=oe(t);var u=ie(e)?wm:Gm;return u(e,t)}function ex(e){var t=ie(e)?Sm:Km;return t(e)}function tx(e){if(e==null)return 0;if(at(e))return Li(e)?$n(e):e.length;var t=Xe(e);return t==Et||t==At?e.size:Hs(e).length}function nx(e,t,s){var u=ie(e)?Es:Wm;return s&&tt(e,t,s)&&(t=r),u(e,X(t,3))}var rx=ue(function(e,t){if(e==null)return[];var s=t.length;return s>1&&tt(e,t[0],t[1])?t=[]:s>2&&tt(t[0],t[1],t[2])&&(t=[t[0]]),Wl(e,Ue(t,1),[])}),Fi=Pg||function(){return Ve.Date.now()};function ix(e,t){if(typeof t!="function")throw new bt(d);return e=oe(e),function(){if(--e<1)return t.apply(this,arguments)}}function Bu(e,t,s){return t=s?r:t,t=e&&t==null?e.length:t,Ht(e,H,r,r,r,r,t)}function Vu(e,t){var s;if(typeof t!="function")throw new bt(d);return e=oe(e),function(){return--e>0&&(s=t.apply(this,arguments)),e<=1&&(t=r),s}}var pa=ue(function(e,t,s){var u=D;if(s.length){var f=rn(s,Wn(pa));u|=O}return Ht(e,u,t,s,f)}),Uu=ue(function(e,t,s){var u=D|F;if(s.length){var f=rn(s,Wn(Uu));u|=O}return Ht(t,u,e,s,f)});function Gu(e,t,s){t=s?r:t;var u=Ht(e,$,r,r,r,r,r,t);return u.placeholder=Gu.placeholder,u}function Hu(e,t,s){t=s?r:t;var u=Ht(e,Q,r,r,r,r,r,t);return u.placeholder=Hu.placeholder,u}function Ku(e,t,s){var u,f,m,_,S,N,T=0,L=!1,P=!1,z=!0;if(typeof e!="function")throw new bt(d);t=yt(t)||0,Ae(s)&&(L=!!s.leading,P="maxWait"in s,m=P?$e(yt(s.maxWait)||0,t):m,z="trailing"in s?!!s.trailing:z);function K(Te){var Dt=u,Xt=f;return u=f=r,T=Te,_=e.apply(Xt,Dt),_}function te(Te){return T=Te,S=Fr(de,t),L?K(Te):_}function le(Te){var Dt=Te-N,Xt=Te-T,fc=t-Dt;return P?Qe(fc,m-Xt):fc}function ne(Te){var Dt=Te-N,Xt=Te-T;return N===r||Dt>=t||Dt<0||P&&Xt>=m}function de(){var Te=Fi();if(ne(Te))return ge(Te);S=Fr(de,le(Te))}function ge(Te){return S=r,z&&u?K(Te):(u=f=r,_)}function ht(){S!==r&&ru(S),T=0,u=N=f=S=r}function nt(){return S===r?_:ge(Fi())}function pt(){var Te=Fi(),Dt=ne(Te);if(u=arguments,f=this,N=Te,Dt){if(S===r)return te(N);if(P)return ru(S),S=Fr(de,t),K(N)}return S===r&&(S=Fr(de,t)),_}return pt.cancel=ht,pt.flush=nt,pt}var sx=ue(function(e,t){return Ol(e,1,t)}),ax=ue(function(e,t,s){return Ol(e,yt(t)||0,s)});function ox(e){return Ht(e,B)}function Mi(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new bt(d);var s=function(){var u=arguments,f=t?t.apply(this,u):u[0],m=s.cache;if(m.has(f))return m.get(f);var _=e.apply(this,u);return s.cache=m.set(f,_)||m,_};return s.cache=new(Mi.Cache||Ut),s}Mi.Cache=Ut;function Di(e){if(typeof e!="function")throw new bt(d);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}function lx(e){return Vu(2,e)}var ux=Ym(function(e,t){t=t.length==1&&ie(t[0])?Ee(t[0],ft(X())):Ee(Ue(t,1),ft(X()));var s=t.length;return ue(function(u){for(var f=-1,m=Qe(u.length,s);++f=t}),An=zl(function(){return arguments}())?zl:function(e){return Ie(e)&&xe.call(e,"callee")&&!Rl.call(e,"callee")},ie=A.isArray,Cx=ll?ft(ll):Mm;function at(e){return e!=null&&Ti(e.length)&&!Yt(e)}function De(e){return Ie(e)&&at(e)}function yx(e){return e===!0||e===!1||Ie(e)&&et(e)==dr}var cn=qg||Ea,Nx=ul?ft(ul):Dm;function Rx(e){return Ie(e)&&e.nodeType===1&&!Mr(e)}function Ex(e){if(e==null)return!0;if(at(e)&&(ie(e)||typeof e=="string"||typeof e.splice=="function"||cn(e)||Yn(e)||An(e)))return!e.length;var t=Xe(e);if(t==Et||t==At)return!e.size;if(Ir(e))return!Hs(e).length;for(var s in e)if(xe.call(e,s))return!1;return!0}function Ax(e,t){return Rr(e,t)}function Ix(e,t,s){s=typeof s=="function"?s:r;var u=s?s(e,t):r;return u===r?Rr(e,t,r,s):!!u}function va(e){if(!Ie(e))return!1;var t=et(e);return t==Hr||t==Zd||typeof e.message=="string"&&typeof e.name=="string"&&!Mr(e)}function Fx(e){return typeof e=="number"&&Al(e)}function Yt(e){if(!Ae(e))return!1;var t=et(e);return t==Kr||t==Oo||t==Xd||t==ef}function Yu(e){return typeof e=="number"&&e==oe(e)}function Ti(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=G}function Ae(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function Ie(e){return e!=null&&typeof e=="object"}var Qu=cl?ft(cl):Lm;function Mx(e,t){return e===t||Gs(e,t,la(t))}function Dx(e,t,s){return s=typeof s=="function"?s:r,Gs(e,t,la(t),s)}function Tx(e){return Xu(e)&&e!=+e}function Lx(e){if(vh(e))throw new re(c);return Bl(e)}function Ox(e){return e===null}function Px(e){return e==null}function Xu(e){return typeof e=="number"||Ie(e)&&et(e)==gr}function Mr(e){if(!Ie(e)||et(e)!=Bt)return!1;var t=oi(e);if(t===null)return!0;var s=xe.call(t,"constructor")&&t.constructor;return typeof s=="function"&&s instanceof s&&ri.call(s)==Dg}var _a=dl?ft(dl):Om;function kx(e){return Yu(e)&&e>=-9007199254740991&&e<=G}var Zu=fl?ft(fl):Pm;function Li(e){return typeof e=="string"||!ie(e)&&Ie(e)&&et(e)==hr}function mt(e){return typeof e=="symbol"||Ie(e)&&et(e)==Wr}var Yn=gl?ft(gl):km;function qx(e){return e===r}function $x(e){return Ie(e)&&Xe(e)==pr}function zx(e){return Ie(e)&&et(e)==nf}var Bx=yi(Ks),Vx=yi(function(e,t){return e<=t});function Ju(e){if(!e)return[];if(at(e))return Li(e)?It(e):st(e);if(_r&&e[_r])return wg(e[_r]());var t=Xe(e),s=t==Et?Ts:t==At?ei:Qn;return s(e)}function Qt(e){if(!e)return e===0?e:0;if(e=yt(e),e===Me||e===-1/0){var t=e<0?-1:1;return t*be}return e===e?e:0}function oe(e){var t=Qt(e),s=t%1;return t===t?s?t-s:t:0}function ec(e){return e?yn(oe(e),0,it):0}function yt(e){if(typeof e=="number")return e;if(mt(e))return Je;if(Ae(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Ae(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=_l(e);var s=Cf.test(e);return s||Nf.test(e)?ig(e.slice(2),s?2:8):jf.test(e)?Je:+e}function tc(e){return Pt(e,ot(e))}function Ux(e){return e?yn(oe(e),-9007199254740991,G):e===0?e:0}function pe(e){return e==null?"":gt(e)}var Gx=Hn(function(e,t){if(Ir(t)||at(t)){Pt(t,ze(t),e);return}for(var s in t)xe.call(t,s)&&Cr(e,s,t[s])}),nc=Hn(function(e,t){Pt(t,ot(t),e)}),Oi=Hn(function(e,t,s,u){Pt(t,ot(t),e,u)}),Hx=Hn(function(e,t,s,u){Pt(t,ze(t),e,u)}),Kx=Kt($s);function Wx(e,t){var s=Gn(e);return t==null?s:Tl(s,t)}var Yx=ue(function(e,t){e=we(e);var s=-1,u=t.length,f=u>2?t[2]:r;for(f&&tt(t[0],t[1],f)&&(u=1);++s1),m}),Pt(e,aa(e),s),u&&(s=St(s,R|y|b,ah));for(var f=t.length;f--;)Zs(s,t[f]);return s});function gv(e,t){return ic(e,Di(X(t)))}var mv=Kt(function(e,t){return e==null?{}:zm(e,t)});function ic(e,t){if(e==null)return{};var s=Ee(aa(e),function(u){return[u]});return t=X(t),Yl(e,s,function(u,f){return t(u,f[0])})}function hv(e,t,s){t=ln(t,e);var u=-1,f=t.length;for(f||(f=1,e=r);++ut){var u=e;e=t,t=u}if(s||e%1||t%1){var f=Il();return Qe(e+f*(t-e+rg("1e-"+((f+"").length-1))),t)}return Ys(e,t)}var Nv=Kn(function(e,t,s){return t=t.toLowerCase(),e+(s?oc(t):t)});function oc(e){return Sa(pe(e).toLowerCase())}function lc(e){return e=pe(e),e&&e.replace(Ef,pg).replace(Kf,"")}function Rv(e,t,s){e=pe(e),t=gt(t);var u=e.length;s=s===r?u:yn(oe(s),0,u);var f=s;return s-=t.length,s>=0&&e.slice(s,f)==t}function Ev(e){return e=pe(e),e&&lf.test(e)?e.replace(qo,xg):e}function Av(e){return e=pe(e),e&&mf.test(e)?e.replace(xs,"\\$&"):e}var Iv=Kn(function(e,t,s){return e+(s?"-":"")+t.toLowerCase()}),Fv=Kn(function(e,t,s){return e+(s?" ":"")+t.toLowerCase()}),Mv=du("toLowerCase");function Dv(e,t,s){e=pe(e),t=oe(t);var u=t?$n(e):0;if(!t||u>=t)return e;var f=(t-u)/2;return Ci(di(f),s)+e+Ci(ci(f),s)}function Tv(e,t,s){e=pe(e),t=oe(t);var u=t?$n(e):0;return t&&u>>0,s?(e=pe(e),e&&(typeof t=="string"||t!=null&&!_a(t))&&(t=gt(t),!t&&qn(e))?un(It(e),0,s):e.split(t,s)):[]}var zv=Kn(function(e,t,s){return e+(s?" ":"")+Sa(t)});function Bv(e,t,s){return e=pe(e),s=s==null?0:yn(oe(s),0,e.length),t=gt(t),e.slice(s,s+t.length)==t}function Vv(e,t,s){var u=g.templateSettings;s&&tt(e,t,s)&&(t=r),e=pe(e),t=Oi({},t,u,vu);var f=Oi({},t.imports,u.imports,vu),m=ze(f),_=Ds(f,m),S,N,T=0,L=t.interpolate||Yr,P="__p += '",z=Ls((t.escape||Yr).source+"|"+L.source+"|"+(L===$o?Sf:Yr).source+"|"+(t.evaluate||Yr).source+"|$","g"),K="//# sourceURL="+(xe.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Zf+"]")+` +`;e.replace(z,function(ne,de,ge,ht,nt,pt){return ge||(ge=ht),P+=e.slice(T,pt).replace(Af,vg),de&&(S=!0,P+=`' + __e(`+de+`) + '`),nt&&(N=!0,P+=`'; `+nt+`; __p += '`),ge&&(P+=`' + ((__t = (`+ge+`)) == null ? '' : __t) + -'`),T=ht+ne.length,ne}),P+=`'; +'`),T=pt+ne.length,ne}),P+=`'; `;var te=xe.call(t,"variable")&&t.variable;if(!te)P=`with (obj) { `+P+` } @@ -170,7 +170,7 @@ __p += '`),ge&&(P+=`' + function print() { __p += __j.call(arguments, '') } `:`; `)+P+`return __p -}`;var oe=cc(function(){return me(m,K+"return "+P).apply(r,_)});if(oe.source=P,va(oe))throw oe;return oe}function Uv(e){return pe(e).toLowerCase()}function Gv(e){return pe(e).toUpperCase()}function Hv(e,t,s){if(e=pe(e),e&&(s||t===r))return _l(e);if(!e||!(t=ft(t)))return e;var u=At(e),f=At(t),m=bl(u,f),_=wl(u,f)+1;return un(u,m,_).join("")}function Kv(e,t,s){if(e=pe(e),e&&(s||t===r))return e.slice(0,jl(e)+1);if(!e||!(t=ft(t)))return e;var u=At(e),f=wl(u,At(t))+1;return un(u,0,f).join("")}function Wv(e,t,s){if(e=pe(e),e&&(s||t===r))return e.replace(vs,"");if(!e||!(t=ft(t)))return e;var u=At(e),f=bl(u,At(t));return un(u,f).join("")}function Yv(e,t){var s=se,u=ce;if(Ae(t)){var f="separator"in t?t.separator:f;s="length"in t?ae(t.length):s,u="omission"in t?ft(t.omission):u}e=pe(e);var m=e.length;if(qn(e)){var _=At(e);m=_.length}if(s>=m)return e;var S=s-$n(u);if(S<1)return u;var N=_?un(_,0,S).join(""):e.slice(0,S);if(f===r)return N+u;if(_&&(S+=N.length-S),_a(f)){if(e.slice(S).search(f)){var T,L=N;for(f.global||(f=Ls(f.source,pe(zo.exec(f))+"g")),f.lastIndex=0;T=f.exec(L);)var P=T.index;N=N.slice(0,P===r?S:P)}}else if(e.indexOf(ft(f),S)!=S){var z=N.lastIndexOf(f);z>-1&&(N=N.slice(0,z))}return N+u}function Qv(e){return e=pe(e),e&&of.test(e)?e.replace(ko,yg):e}var Xv=Kn(function(e,t,s){return e+(s?" ":"")+t.toUpperCase()}),Sa=du("toUpperCase");function uc(e,t,s){return e=pe(e),t=s?r:t,t===r?bg(e)?Eg(e):dg(e):e.match(t)||[]}var cc=ue(function(e,t){try{return ct(e,r,t)}catch(s){return va(s)?s:new re(s)}}),Zv=Kt(function(e,t){return _t(t,function(s){s=kt(s),Gt(e,s,pa(e[s],e))}),e});function Jv(e){var t=e==null?0:e.length,s=X();return e=t?Ee(e,function(u){if(typeof u[1]!="function")throw new bt(d);return[s(u[0]),u[1]]}):[],ue(function(u){for(var f=-1;++fU)return[];var s=it,u=Ye(e,it);t=X(t),e-=it;for(var f=Ms(u,t);++s0||t<0)?new fe(s):(e<0?s=s.takeRight(-e):e&&(s=s.drop(e)),t!==r&&(t=ae(t),s=t<0?s.dropRight(-t):s.take(t-e)),s)},fe.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},fe.prototype.toArray=function(){return this.take(it)},Ot(fe.prototype,function(e,t){var s=/^(?:filter|find|map|reject)|While$/.test(t),u=/^(?:head|last)$/.test(t),f=g[u?"take"+(t=="last"?"Right":""):t],m=u||/^find/.test(t);f&&(g.prototype[t]=function(){var _=this.__wrapped__,S=u?[1]:arguments,N=_ instanceof fe,T=S[0],L=N||ie(_),P=function(de){var ge=f.apply(g,nn([de],S));return u&&z?ge[0]:ge};L&&s&&typeof T=="function"&&T.length!=1&&(N=L=!1);var z=this.__chain__,K=!!this.__actions__.length,te=m&&!z,oe=N&&!K;if(!m&&L){_=oe?_:new fe(this);var ne=e.apply(_,S);return ne.__actions__.push({func:Ai,args:[P],thisArg:r}),new wt(ne,z)}return te&&oe?e.apply(this,S):(ne=this.thru(P),te?u?ne.value()[0]:ne.value():ne)})}),_t(["pop","push","shift","sort","splice","unshift"],function(e){var t=ti[e],s=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",u=/^(?:pop|shift)$/.test(e);g.prototype[e]=function(){var f=arguments;if(u&&!this.__chain__){var m=this.value();return t.apply(ie(m)?m:[],f)}return this[s](function(_){return t.apply(ie(_)?_:[],f)})}}),Ot(fe.prototype,function(e,t){var s=g[t];if(s){var u=s.name+"";xe.call(Un,u)||(Un[u]=[]),Un[u].push({name:t,func:s})}}),Un[Si(r,F).name]=[{name:"wrapper",func:r}],fe.prototype.clone=Qg,fe.prototype.reverse=Xg,fe.prototype.value=Zg,g.prototype.at=Rp,g.prototype.chain=Ep,g.prototype.commit=Ap,g.prototype.next=Ip,g.prototype.plant=Mp,g.prototype.reverse=Dp,g.prototype.toJSON=g.prototype.valueOf=g.prototype.value=Tp,g.prototype.first=g.prototype.head,_r&&(g.prototype[_r]=Fp),g},zn=Ag();bn?((bn.exports=zn)._=zn,Cs._=zn):Be._=zn}).call(Xn)})(Ki,Ki.exports);var Fe=Ki.exports;const Lw=n=>{console.debug("calculateQuoteTotals",n);const a=$t.create(n[1]||{amount:null,scale:2});if(a.isFailure)throw a.error;const r=a.object,o=$t.create(n[2]||{amount:null,scale:2});if(o.isFailure)throw o.error;const l=o.object,c=Tt.create(n[0]||{amount:null,scale:2});if(c.isFailure)throw c.error;const d=c.object,h=d.percentage(r.toNumber()).convertScale(2),p=d.subtract(h).convertScale(2),x=p.percentage(l.toNumber()).convertScale(2),v=p.add(x).convertScale(2);return{subtotalPrice:d.toObject(),discount:r.toObject(),discountPrice:h.toObject(),priceBeforeTaxes:p.toObject(),tax:l.toObject(),taxesPrice:x.toObject(),totalPrice:v.toObject()}},Ow=({currency:n})=>{const{formState:a,control:r}=lr(),{formatNumber:o}=vw(),l=h0({control:r,name:["subtotal_price","discount","tax"]}),c=Lw(l),d=o(c.subtotalPrice),h=o(c.discountPrice),p=o(c.taxesPrice),x=o(c.totalPrice),v=M.useMemo(()=>n.symbol||"",[n]);return i.jsx(Le,{className:"w-full bg-muted",children:i.jsxs(Oe,{className:"flex flex-row items-end gap-2 p-4 border-t",children:[i.jsx("div",{className:"grid flex-1 h-16 grid-cols-1 auto-rows-max",children:i.jsxs("div",{className:"grid gap-1 font-semibold text-right text-muted-foreground",children:[i.jsx(Ze,{className:"text-sm",children:w("quotes.form_fields.subtotal_price.label")}),i.jsxs(Ge,{className:"flex items-baseline justify-end text-2xl tabular-nums",children:[d,i.jsx("span",{className:"ml-1 text-lg tracking-normal",children:v})]})]})}),i.jsx(mn,{orientation:"vertical",className:"w-px h-16 mx-2"}),i.jsxs("div",{className:"grid flex-1 h-16 grid-cols-2 gap-6 auto-rows-max",children:[i.jsxs("div",{className:"grid gap-1 font-medium text-muted-foreground",children:[i.jsx(Ze,{className:"text-sm",children:w("quotes.form_fields.discount.label")}),i.jsx(Hi,{scale:2,disabled:a.disabled,placeholder:w("quotes.form_fields.discount.placeholder"),name:"discount",onChange:R=>{console.log("discount",R)}})]}),i.jsxs("div",{className:"grid gap-1 font-semibold text-muted-foreground",children:[i.jsx(Ze,{className:"text-sm text-right",children:w("quotes.form_fields.discount_price.label")}),i.jsxs(Ge,{className:"flex items-baseline justify-end text-2xl tabular-nums",children:[h,i.jsx("span",{className:"ml-1 text-lg tracking-normal",children:v})]})]})]}),i.jsx(mn,{orientation:"vertical",className:"w-px h-16 mx-2"}),i.jsxs("div",{className:"grid flex-1 h-16 grid-cols-2 gap-6 auto-rows-max",children:[i.jsxs("div",{className:"grid gap-1 font-medium text-muted-foreground",children:[i.jsx(Ze,{className:"text-sm",children:w("quotes.form_fields.tax.label")}),i.jsx(Hi,{scale:2,disabled:a.disabled,placeholder:w("quotes.form_fields.tax.placeholder"),name:"tax"})]}),i.jsxs("div",{className:"grid gap-1 font-semibold text-muted-foreground",children:[i.jsx(Ze,{className:"text-sm text-right",children:w("quotes.form_fields.tax_price.label")}),i.jsxs(Ge,{className:"flex items-baseline justify-end gap-1 text-2xl tabular-nums",children:[p,i.jsx("span",{className:"text-base font-medium tracking-normal",children:v})]})]})]})," ",i.jsx(mn,{orientation:"vertical",className:"w-px h-16 mx-2"}),i.jsx("div",{className:"grid flex-1 h-16 grid-cols-1 auto-rows-max",children:i.jsxs("div",{className:"grid gap-0",children:[i.jsx(Ze,{className:"text-sm font-semibold text-right text-foreground",children:w("quotes.form_fields.total_price.label")}),i.jsxs(Ge,{className:"flex items-baseline justify-end gap-1 text-3xl tabular-nums",children:[x,i.jsx("span",{className:"ml-1 text-lg tracking-normal",children:v})]})]})})]})})},Gd=n=>{const{percentage:a,cancel:r,error:o,isInProgress:l,onFinishDownload:c}=n,d=M.useId();return M.useEffect(()=>{l&&!o&&a===100&&c&&c()},[a,l,o,c]),i.jsx(rr,{open:l,children:i.jsxs(ir,{className:"sm:max-w-md",children:[i.jsxs(sr,{children:[i.jsx(ar,{children:w("quotes.downloading_dialog.title")}),i.jsx(ns,{children:w("quotes.downloading_dialog.description")})]}),i.jsxs("div",{className:"mb-4 space-y-2",id:d,children:[i.jsx(cr,{children:w("quotes.downloading_dialog.progress.label",{status:w(l?"quotes.downloading_dialog.progress.status_in_progress":"quotes.downloading_dialog.progress.status_stopped")})}),i.jsx(Gc,{value:a,max:100,getValueLabel:()=>w("quotes.downloading_dialog.progress.label",{})}),o&&i.jsxs("p",{children:["Error: ",JSON.stringify(o)]})]}),i.jsx(or,{className:"sm:justify-end",children:i.jsx(Vi,{asChild:!0,children:i.jsx(G,{type:"button",variant:"secondary",onClick:()=>r(),children:w("quotes.downloading_dialog.cancel_button")})})})]})})},Pw=({isInProgress:n,percentage:a,elapsed:r,cancel:o,error:l,className:c})=>{const[d,h]=M.useState(10);return M.useEffect(()=>{if(n&&a>0){const p=r/a*100;h(Math.max(0,Math.round(p-r)))}},[n,a,r]),!n&&!(l!=null&&l.errorMessage)?null:i.jsxs(Le,{className:he("overflow-hidden",c),children:[i.jsx(pt,{children:i.jsxs(Ge,{className:"flex items-center justify-between",children:[l!=null&&l.errorMessage?"Error en la generación del PDF":"Generando PDF",n&&i.jsx(W0,{className:"w-4 h-4 animate-spin"}),(l==null?void 0:l.errorMessage)&&i.jsx(V0,{className:"w-4 h-4 text-destructive"})]})}),i.jsx(Oe,{children:l!=null&&l.errorMessage?i.jsx("div",{className:"text-destructive",children:l==null?void 0:l.errorMessage}):i.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[i.jsxs("div",{className:"relative w-32 h-40 overflow-hidden rounded-lg bg-muted",children:[i.jsx("div",{className:"absolute bottom-0 left-0 right-0 transition-all duration-1000 ease-out bg-primary",style:{height:`${a}%`}}),i.jsx(K0,{className:"absolute transform -translate-x-1/2 -translate-y-1/2 animate-pulse top-1/2 left-1/2 text-muted-foreground",size:48})]}),i.jsx(Gc,{value:a,className:"w-full"}),i.jsxs("div",{className:"text-sm text-center text-muted-foreground",children:[i.jsxs("p",{children:["Progreso: ",a,"%"]}),i.jsxs("div",{className:"hidden",children:[i.jsxs("p",{children:["Tiempo transcurrido: ",r," segundos"]}),d>0&&i.jsxs("p",{children:["Tiempo estimado restante: ",d," segundos"]})]})]}),i.jsx(G,{variant:"destructive",onClick:o,className:"hidden",children:"Cancelar generación"})]})})]})},Hd=({quote:n,className:a})=>{const{useReport:r,getQuotePDFFilename:o,useDownloader:l}=Ur(),{download:c}=l(),{report:d,preview:h,isInProgress:p,...x}=r(),[v,R]=M.useState(void 0),y=M.useCallback(()=>{n&&c(n.id,o(n))},[n]);return M.useEffect(()=>{const b=setTimeout(()=>{n&&n.id&&h(n.id)},200);return()=>clearTimeout(b)},[n]),M.useEffect(()=>{if(!p&&d){const b=window.URL&&window.URL.createObjectURL?window.URL.createObjectURL(d):window.webkitURL.createObjectURL(d);return R(b),()=>{R(void 0),window.URL.revokeObjectURL(b)}}},[d,p]),n?p?i.jsx(Pw,{isInProgress:p,...x}):i.jsx(p0,{file:v,className:"object-contain",onThumbnailClick:y}):i.jsx(Le,{className:he("overflow-hidden",a),children:i.jsx(Oe,{className:"px-4 py-6 text-center",children:i.jsx("p",{className:"mx-auto",children:"Select a quote"})})})};Hd.whyDidYouRender=!0;const Tr=db();function kw({row:n,table:a}){var l;const r=(l=a.options.meta)==null?void 0:l.catalogPicker;if(!r)return null;const o=r.quantities[n.index]??1;return i.jsx(Zi,{type:"number",name:"quantity",min:1,className:"w-24",value:o,onChange:c=>{const d=c.target.value;r.setQuantity(n.index,d===""?"":Number(d))}})}function qw({row:n,table:a}){var o;const r=(o=a.options.meta)==null?void 0:o.catalogPicker;return i.jsxs(G,{size:"sm",variant:"outline",className:"h-8 gap-1",onClick:l=>{l.preventDefault(),r==null||r.selectArticle(n.original,n.index)},children:[i.jsx(Co,{className:"h-3.5 w-3.5"}),i.jsx("span",{className:"sr-only xl:not-sr-only xl:whitespace-nowrap",children:w("common.add")})]})}const to=({onSelect:n})=>{const a=zt(),{pagination:r,globalFilter:o,isFiltered:l}=Tn(),[c,d]=M.useState([]),h=M.useCallback((D,F)=>{d(q=>{const $=[...q];return $[D]=F,$})},[]),p=()=>{d([])},{data:x,isPending:v,isError:R,error:y}=$d({pagination:{pageIndex:r.pageIndex,pageSize:r.pageSize},searchTerm:o});M.useEffect(()=>{p()},[r,o,l]);const b=M.useMemo(()=>({catalogPicker:{quantities:c,setQuantity:h,selectArticle:(D,F)=>n(D,c[F]===""?1:c[F]??1)}}),[h,n,c]),E=M.useMemo(()=>[Tr.accessor("description",{id:"description",header:()=>i.jsx(i.Fragment,{children:w("catalog.list.columns.description")})}),Tr.accessor("points",{id:"points",header:()=>i.jsx("div",{className:"text-right",children:w("catalog.list.columns.points")}),cell:({renderValue:D})=>i.jsx("div",{className:"text-right",children:D()})}),Tr.accessor("retail_price",{id:"retail_price",header:()=>i.jsx("div",{className:"text-right",children:w("catalog.list.columns.retail_price")}),cell:({row:D})=>{const F=Tt.create(D.original.retail_price).object;return i.jsx("div",{className:"text-right",children:F.toFormat()})}}),Tr.display({id:"quantity",header:()=>i.jsx("div",{className:"font-medium text-right text-foreground",children:w("catalog.list.columns.quantity")}),cell:kw}),Tr.display({id:"row-actions",header:()=>null,cell:qw})],[]),{table:j}=os({data:[...(x==null?void 0:x.items)||[]],columns:E,pageCount:(x==null?void 0:x.total_pages)??-1,meta:b});return R?i.jsx(ur,{subtitle:y.message}):v?i.jsx(ss,{columnCount:6,searchableColumnCount:1,filterableColumnCount:2,shrinkZero:!0}):(x==null?void 0:x.total_items)===0&&!l?i.jsx(as,{subtitle:"Empieza cargando los artículos del catálogo",buttonText:"",onButtonClick:()=>a("/catalog/add")}):i.jsx(is,{className:"bg-transparent border-0 shadow-none",table:j,paginationOptions:{visible:!0,enablePageSizeSelector:!1},footerClassName:"px-10 pt-2 border-t",children:i.jsx(zd,{table:j})})},Do=M.forwardRef(({label:n=w("common.append_block"),className:a,...r},o)=>i.jsxs(G,{type:"button",variant:"outline",ref:o,...r,children:[" ",i.jsx(Co,{className:n?"w-4 h-4 mr-2":"w-4 h-4"}),n&&i.jsx(i.Fragment,{children:n})]}));Do.displayName="AppendBlockRowButton";const To=M.forwardRef(({label:n=w("common.append_article"),className:a,...r},o)=>i.jsxs(G,{type:"button",variant:"outline",ref:o,...r,children:[" ",i.jsx(Co,{className:n?"w-4 h-4 mr-2":"w-4 h-4"}),n&&i.jsx(i.Fragment,{children:n})]}));To.displayName="AppendCatalogArticleRowButton";const Lo=M.forwardRef(({label:n=w("common.append_empty_row"),className:a,...r},o)=>i.jsxs(G,{type:"button",variant:"outline",ref:o,...r,children:[i.jsx(B0,{className:n?"w-4 h-4 mr-2":"w-4 h-4"}),n&&i.jsx(i.Fragment,{children:n})]}));Lo.displayName="AppendEmptyRowButton";const $w=({table:n,showLineDiscountColumn:a,hasLineDiscounts:r,onShowLineDiscountColumnChange:o})=>{const l=n.getSelectedRowModel().rows.length,[c,d]=M.useState(!1),h=x=>{if(!x&&a&&r){d(!0);return}o(x)},p=i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex items-center gap-2 ml-auto",children:[i.jsxs("div",{className:"grid gap-0.5",children:[i.jsx(cr,{htmlFor:"show-line-discount-column",className:"text-sm font-medium",children:w("quotes.discount_column.label")}),i.jsx("p",{className:"text-xs font-normal text-muted-foreground",children:w("quotes.discount_column.description")})]}),i.jsx(So,{id:"show-line-discount-column",checked:a,onCheckedChange:h})]}),i.jsx(rr,{open:c,onOpenChange:d,children:i.jsxs(ir,{children:[i.jsxs(sr,{children:[i.jsx(ar,{children:w("quotes.discount_column.confirmation.title")}),i.jsx(ns,{children:w("quotes.discount_column.confirmation.description")})]}),i.jsxs(or,{children:[i.jsx(G,{type:"button",variant:"secondary",onClick:()=>d(!1),children:w("common.cancel")}),i.jsx(G,{type:"button",onClick:()=>{o(!1),d(!1)},children:w("quotes.discount_column.confirmation.confirm")})]})]})})]});return l?i.jsx("nav",{className:"flex items-center h-12 p-1 rounded-md text-muted-foreground bg-muted ",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs(He,{children:[i.jsx(Ke,{asChild:!0,children:i.jsxs(G,{type:"button",variant:"link",disabled:!n.getSelectedRowModel().rows.length,onClick:()=>{var x;return(x=n.options.meta)==null?void 0:x.duplicateItems()},children:[i.jsx(U0,{className:"w-4 h-4 sm:mr-2"}),i.jsx("span",{className:"sr-only sm:not-sr-only",children:w("common.duplicate_selected_rows")})]})}),i.jsx(We,{children:w("common.duplicate_selected_rows_tooltip")})]}),i.jsxs(He,{children:[i.jsx(Ke,{asChild:!0,children:i.jsxs(G,{type:"button",variant:"link",disabled:!n.getSelectedRowModel().rows.length,onClick:()=>{var x;return(x=n.options.meta)==null?void 0:x.deleteItems()},children:[i.jsx(pd,{className:"w-4 h-4 sm:mr-2"}),i.jsx("span",{className:"sr-only sm:not-sr-only",children:w("common.remove_selected_rows")})]})}),i.jsx(We,{children:w("common.remove_selected_rows_tooltip")})]}),i.jsxs(He,{children:[i.jsx(Ke,{asChild:!0,children:i.jsxs(G,{type:"button",variant:"link",disabled:!n.getSelectedRowModel().rows.length,onClick:()=>n.resetRowSelection(),children:[i.jsx(Y0,{className:"w-4 h-4 sm:mr-2"}),i.jsx("span",{className:"sr-only sm:not-sr-only",children:w("common.reset_selected_rows")})]})}),i.jsx(We,{children:w("common.reset_selected_rows_tooltip")})]}),i.jsx(mn,{orientation:"vertical",className:"h-6 ml-1 mr-4"}),i.jsx("p",{className:"text-sm font-normal",children:w("common.rows_selected",{count:l})}),p]})}):i.jsxs("nav",{className:"flex items-center h-12 p-1 rounded-md bg-accent/75 text-muted-foreground",children:[i.jsxs("div",{className:"flex space-x-2",children:[i.jsxs(He,{children:[i.jsx(Ke,{asChild:!0,children:i.jsx(Lo,{variant:"link",onClick:()=>{var x;return(x=n.options.meta)==null?void 0:x.appendItem()}})}),i.jsx(We,{children:w("common.append_empty_row_tooltip")})]}),i.jsxs(He,{children:[i.jsx(Ke,{asChild:!0,children:i.jsx(To,{variant:"link",onClick:()=>{var x;n.options.meta&&n.options.meta.pickCatalogArticle&&((x=n.options.meta)==null||x.pickCatalogArticle())}})}),i.jsx(We,{children:w("common.append_article_tooltip")})]}),i.jsxs(He,{children:[i.jsx(Ke,{asChild:!0,children:i.jsx(Do,{variant:"link",onClick:()=>{var x;n.options.meta&&n.options.meta.pickBlock&&((x=n.options.meta)==null||x.pickBlock())}})}),i.jsx(We,{children:w("common.append_block_tooltip")})]})]}),p]})},zw=({row:n,table:a,onDelete:r})=>{const o=()=>{var l;(l=a.options.meta)==null||l.deleteItems(n.index),r()};return i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsxs(G,{type:"button",variant:"outline",size:"sm",onClick:()=>{var l;return(l=a.options.meta)==null?void 0:l.insertItem(n.index)},children:[i.jsx(x0,{className:"w-4 h-4 mr-2"}),w("common.insert_row_above")]}),i.jsxs(G,{type:"button",variant:"outline",size:"sm",onClick:()=>{var l;return(l=a.options.meta)==null?void 0:l.insertItem(n.index+1)},children:[i.jsx(Pc,{className:"w-4 h-4 mr-2"}),w("common.insert_row_below")]}),i.jsxs(G,{type:"button",variant:"outline",size:"sm",onClick:()=>{var l;return(l=a.options.meta)==null?void 0:l.duplicateItems(n.index)},children:[i.jsx(jo,{className:"w-4 h-4 mr-2"}),w("common.duplicate_row")]}),i.jsxs(Hc,{children:[i.jsx(Kc,{asChild:!0,children:i.jsxs(G,{type:"button",variant:"destructive",size:"sm",children:[i.jsx(pd,{className:"w-4 h-4 mr-2"}),w("common.remove_row")]})}),i.jsxs(Wc,{children:[i.jsxs(Yc,{children:[i.jsx(Qc,{children:w("quotes.inline_row_actions.delete_confirmation.title")}),i.jsx(Xc,{children:w("quotes.inline_row_actions.delete_confirmation.description")})]}),i.jsxs(Zc,{children:[i.jsx(Jc,{children:w("common.cancel")}),i.jsx(ed,{asChild:!0,children:i.jsx(G,{type:"button",variant:"destructive",onClick:o,children:w("quotes.inline_row_actions.delete_confirmation.confirm")})})]})]})]})]})},Bw={droppable:{strategy:w0.Always}},Vw={keyframes({transform:n}){return[{opacity:1,transform:Ga.Transform.toString(n.initial)},{opacity:0,transform:Ga.Transform.toString({...n.final,x:n.final.x+5,y:n.final.y+5})}]},easing:"ease-out",sideEffects({active:n}){n.node.animate([{opacity:0},{opacity:1}],{duration:vc.duration,easing:vc.easing})}};function Ec({columns:n,data:a,defaultValues:r,initialState:o,actions:l,showLineDiscountColumn:c,hasLineDiscounts:d,onShowLineDiscountColumnChange:h}){const[p,x]=M.useState({}),[v,R]=M.useState(),[y,b]=M.useState(null),E=M.useMemo(()=>a.map(O=>O.id),[a]),j=Md({data:a,columns:n,enableColumnResizing:!1,columnResizeMode:"onChange",autoResetAll:!1,initialState:o,state:{rowSelection:p,columnVisibility:{...o==null?void 0:o.columnVisibility,discount:c}},enableRowSelection:!0,enableMultiRowSelection:!0,enableSorting:!1,enableHiding:!0,onRowSelectionChange:x,getCoreRowModel:Id(),getRowId:O=>O==null?void 0:O.id,debugTable:!1,debugHeaders:!1,debugColumns:!1,defaultColumn:{minSize:0,size:Number.MAX_SAFE_INTEGER,maxSize:Number.MAX_SAFE_INTEGER},meta:{insertItem:(O,k)=>{l.insert(O,k||(r==null?void 0:r.items[0]),{shouldFocus:!0})},appendItem:O=>{l.append(O||(r==null?void 0:r.items[0]),{shouldFocus:!0})},pickCatalogArticle:()=>{l.pickCatalogArticle&&(l==null||l.pickCatalogArticle())},pickBlock:()=>{l.pickBlock&&(l==null||l.pickBlock())},duplicateItems:O=>{var k;if(O!=null){const H=((k=l.getItem)==null?void 0:k.call(l,O))??j.getRowModel().rows[O].original;l.insert(O+1,{...H,id:void 0},{shouldFocus:!0})}else if(j.getSelectedRowModel().rows.length){const H=j.getSelectedRowModel().rows[j.getSelectedRowModel().rows.length-1].index,W=j.getSelectedRowModel().rows.map(B=>({...B.original,id:void 0}));j.getRowModel().rows.length{if(O!=null)l.remove(O);else if(j.getSelectedRowModel().rows.length>0){let k=j.getSelectedRowModel().rows.length-1;for(;k>=0;k--){const H=E.indexOf(String(j.getSelectedRowModel().rows[k].id));l.remove(H),E.splice(H,1)}j.resetRowSelection()}else l.remove()},updateItem:(O,k,H,W)=>{l.update(O,{...k,[`${H}`]:W})}}}),D=v0(Pi(A0,{}),Pi(E0,{}),Pi(R0,{}),Pi(N0,{}));function F(O){var W;let k=O.active.id,H=(W=O.over)==null?void 0:W.id;if(H!==void 0&&k!==H){let B=E.indexOf(String(H));if(j.getSelectedRowModel().rows.length>1)j.getSelectedRowModel().rows.forEach((se,ce)=>{const Y=E.indexOf(String(se.id));ce>0&&(k=se.id,B=E.indexOf(String(H)),B{const H=typeof k=="string"?k:k.id;return H===v||!j.getSelectedRowModel().rowsById[H]}):O}return i.jsx(_0,{measuring:Bw,sensors:D,onDragEnd:F,onDragStart:q,onDragCancel:$,collisionDetection:b0,children:i.jsxs(Le,{children:[i.jsx(pt,{className:"sticky z-10 top-16 bg-card/90",children:i.jsx(Ge,{children:i.jsx($w,{table:j,showLineDiscountColumn:c,hasLineDiscounts:d,onShowLineDiscountColumnChange:h})})}),i.jsxs(Oe,{children:[i.jsxs(uo,{className:"table-fixed",children:[i.jsx(co,{className:"sticky top-0 z-10 bg-background",children:j.getHeaderGroups().map(O=>i.jsx(hn,{className:"hover:bg-transparent",children:O.headers.map(k=>i.jsx(fo,{className:"px-2 py-1",style:{width:k.getSize()===Number.MAX_SAFE_INTEGER?"auto":k.getSize()},children:k.isPlaceholder?null:i.jsx(Td,{table:j,header:k})},k.id))},O.id))}),i.jsx(go,{children:i.jsx(j0,{items:Q(E),strategy:C0,children:Q(j.getRowModel().rows).map(O=>{const k=O,H=k.id===y;return i.jsxs(M.Fragment,{children:[i.jsx(Ew,{id:k.id,isActive:H,onActivate:()=>b(k.id),children:k.getVisibleCells().map(W=>i.jsx(qr,{className:"px-2 py-2 align-top",style:{width:W.column.getSize()===Number.MAX_SAFE_INTEGER?"auto":W.column.getSize()},children:Gi(W.column.columnDef.cell,W.getContext())},W.id))}),H&&i.jsx(hn,{className:"border border-t-0 border-destructive/30 border-l-4 border-l-destructive bg-destructive/5 hover:bg-destructive/5",children:i.jsx(qr,{colSpan:k.getVisibleCells().length,className:"px-2 py-2",children:i.jsx(zw,{row:k,table:j,onDelete:()=>b(null)})})})]},k.id)})})})]}),S0.createPortal(i.jsx(y0,{dropAnimation:Vw,className:"z-40 opacity-100",children:v&&i.jsx("div",{className:"relative flex flex-wrap",children:j.getSelectedRowModel().rows.length?i.jsx(ro,{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:j.getSelectedRowModel().rows.length}):null})}),document.body),!1]}),i.jsx(Dt,{children:i.jsxs(tr,{children:[i.jsx(Lo,{onClick:()=>{var O;return(O=j.options.meta)==null?void 0:O.appendItem()}}),i.jsx(To,{onClick:()=>{var O;j.options.meta&&j.options.meta.pickCatalogArticle&&((O=j.options.meta)==null||O.pickCatalogArticle())}}),i.jsx(Do,{onClick:()=>{var O;j.options.meta&&j.options.meta.pickBlock&&((O=j.options.meta)==null||O.pickBlock())}})]})})]})})}const Uw={en:[{id:2000000098,code:"CAP_CLA_SEMI_SUSPENDIDO_EN",title:"Finish: MELAMINE / colour: TO BE DETERMINED",body:`Thickness block: 19 mm / Thickness complements: 19 mm.\r +}`;var le=cc(function(){return me(m,K+"return "+P).apply(r,_)});if(le.source=P,va(le))throw le;return le}function Uv(e){return pe(e).toLowerCase()}function Gv(e){return pe(e).toUpperCase()}function Hv(e,t,s){if(e=pe(e),e&&(s||t===r))return _l(e);if(!e||!(t=gt(t)))return e;var u=It(e),f=It(t),m=bl(u,f),_=wl(u,f)+1;return un(u,m,_).join("")}function Kv(e,t,s){if(e=pe(e),e&&(s||t===r))return e.slice(0,jl(e)+1);if(!e||!(t=gt(t)))return e;var u=It(e),f=wl(u,It(t))+1;return un(u,0,f).join("")}function Wv(e,t,s){if(e=pe(e),e&&(s||t===r))return e.replace(vs,"");if(!e||!(t=gt(t)))return e;var u=It(e),f=bl(u,It(t));return un(u,f).join("")}function Yv(e,t){var s=ae,u=ce;if(Ae(t)){var f="separator"in t?t.separator:f;s="length"in t?oe(t.length):s,u="omission"in t?gt(t.omission):u}e=pe(e);var m=e.length;if(qn(e)){var _=It(e);m=_.length}if(s>=m)return e;var S=s-$n(u);if(S<1)return u;var N=_?un(_,0,S).join(""):e.slice(0,S);if(f===r)return N+u;if(_&&(S+=N.length-S),_a(f)){if(e.slice(S).search(f)){var T,L=N;for(f.global||(f=Ls(f.source,pe(zo.exec(f))+"g")),f.lastIndex=0;T=f.exec(L);)var P=T.index;N=N.slice(0,P===r?S:P)}}else if(e.indexOf(gt(f),S)!=S){var z=N.lastIndexOf(f);z>-1&&(N=N.slice(0,z))}return N+u}function Qv(e){return e=pe(e),e&&of.test(e)?e.replace(ko,yg):e}var Xv=Kn(function(e,t,s){return e+(s?" ":"")+t.toUpperCase()}),Sa=du("toUpperCase");function uc(e,t,s){return e=pe(e),t=s?r:t,t===r?bg(e)?Eg(e):dg(e):e.match(t)||[]}var cc=ue(function(e,t){try{return dt(e,r,t)}catch(s){return va(s)?s:new re(s)}}),Zv=Kt(function(e,t){return _t(t,function(s){s=kt(s),Gt(e,s,pa(e[s],e))}),e});function Jv(e){var t=e==null?0:e.length,s=X();return e=t?Ee(e,function(u){if(typeof u[1]!="function")throw new bt(d);return[s(u[0]),u[1]]}):[],ue(function(u){for(var f=-1;++fG)return[];var s=it,u=Qe(e,it);t=X(t),e-=it;for(var f=Ms(u,t);++s0||t<0)?new fe(s):(e<0?s=s.takeRight(-e):e&&(s=s.drop(e)),t!==r&&(t=oe(t),s=t<0?s.dropRight(-t):s.take(t-e)),s)},fe.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},fe.prototype.toArray=function(){return this.take(it)},Ot(fe.prototype,function(e,t){var s=/^(?:filter|find|map|reject)|While$/.test(t),u=/^(?:head|last)$/.test(t),f=g[u?"take"+(t=="last"?"Right":""):t],m=u||/^find/.test(t);f&&(g.prototype[t]=function(){var _=this.__wrapped__,S=u?[1]:arguments,N=_ instanceof fe,T=S[0],L=N||ie(_),P=function(de){var ge=f.apply(g,nn([de],S));return u&&z?ge[0]:ge};L&&s&&typeof T=="function"&&T.length!=1&&(N=L=!1);var z=this.__chain__,K=!!this.__actions__.length,te=m&&!z,le=N&&!K;if(!m&&L){_=le?_:new fe(this);var ne=e.apply(_,S);return ne.__actions__.push({func:Ai,args:[P],thisArg:r}),new wt(ne,z)}return te&&le?e.apply(this,S):(ne=this.thru(P),te?u?ne.value()[0]:ne.value():ne)})}),_t(["pop","push","shift","sort","splice","unshift"],function(e){var t=ti[e],s=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",u=/^(?:pop|shift)$/.test(e);g.prototype[e]=function(){var f=arguments;if(u&&!this.__chain__){var m=this.value();return t.apply(ie(m)?m:[],f)}return this[s](function(_){return t.apply(ie(_)?_:[],f)})}}),Ot(fe.prototype,function(e,t){var s=g[t];if(s){var u=s.name+"";xe.call(Un,u)||(Un[u]=[]),Un[u].push({name:t,func:s})}}),Un[Si(r,F).name]=[{name:"wrapper",func:r}],fe.prototype.clone=Qg,fe.prototype.reverse=Xg,fe.prototype.value=Zg,g.prototype.at=Rp,g.prototype.chain=Ep,g.prototype.commit=Ap,g.prototype.next=Ip,g.prototype.plant=Mp,g.prototype.reverse=Dp,g.prototype.toJSON=g.prototype.valueOf=g.prototype.value=Tp,g.prototype.first=g.prototype.head,_r&&(g.prototype[_r]=Fp),g},zn=Ag();wn?((wn.exports=zn)._=zn,Cs._=zn):Ve._=zn}).call(Xn)})(Ki,Ki.exports);var Fe=Ki.exports;const Lw=n=>{console.debug("calculateQuoteTotals",n);const a=$t.create(n[1]||{amount:null,scale:2});if(a.isFailure)throw a.error;const r=a.object,o=$t.create(n[2]||{amount:null,scale:2});if(o.isFailure)throw o.error;const l=o.object,c=Tt.create(n[0]||{amount:null,scale:2});if(c.isFailure)throw c.error;const d=c.object,h=d.percentage(r.toNumber()).convertScale(2),p=d.subtract(h).convertScale(2),x=p.percentage(l.toNumber()).convertScale(2),v=p.add(x).convertScale(2);return{subtotalPrice:d.toObject(),discount:r.toObject(),discountPrice:h.toObject(),priceBeforeTaxes:p.toObject(),tax:l.toObject(),taxesPrice:x.toObject(),totalPrice:v.toObject()}},Ow=({currency:n})=>{const{formState:a,control:r}=lr(),{formatNumber:o}=vw(),l=h0({control:r,name:["subtotal_price","discount","tax"]}),c=Lw(l),d=o(c.subtotalPrice),h=o(c.discountPrice),p=o(c.taxesPrice),x=o(c.totalPrice),v=M.useMemo(()=>n.symbol||"",[n]);return i.jsx(Le,{className:"w-full bg-muted",children:i.jsxs(Oe,{className:"flex flex-row items-end gap-2 p-4 border-t",children:[i.jsx("div",{className:"grid flex-1 h-16 grid-cols-1 auto-rows-max",children:i.jsxs("div",{className:"grid gap-1 font-semibold text-right text-muted-foreground",children:[i.jsx(He,{className:"text-sm",children:w("quotes.form_fields.subtotal_price.label")}),i.jsxs(Be,{className:"flex items-baseline justify-end text-2xl tabular-nums",children:[d,i.jsx("span",{className:"ml-1 text-lg tracking-normal",children:v})]})]})}),i.jsx(hn,{orientation:"vertical",className:"w-px h-16 mx-2"}),i.jsxs("div",{className:"grid flex-1 h-16 grid-cols-2 gap-6 auto-rows-max",children:[i.jsxs("div",{className:"grid gap-1 font-medium text-muted-foreground",children:[i.jsx(He,{className:"text-sm",children:w("quotes.form_fields.discount.label")}),i.jsx(Hi,{scale:2,disabled:a.disabled,placeholder:w("quotes.form_fields.discount.placeholder"),name:"discount",onChange:R=>{console.log("discount",R)}})]}),i.jsxs("div",{className:"grid gap-1 font-semibold text-muted-foreground",children:[i.jsx(He,{className:"text-sm text-right",children:w("quotes.form_fields.discount_price.label")}),i.jsxs(Be,{className:"flex items-baseline justify-end text-2xl tabular-nums",children:[h,i.jsx("span",{className:"ml-1 text-lg tracking-normal",children:v})]})]})]}),i.jsx(hn,{orientation:"vertical",className:"w-px h-16 mx-2"}),i.jsxs("div",{className:"grid flex-1 h-16 grid-cols-2 gap-6 auto-rows-max",children:[i.jsxs("div",{className:"grid gap-1 font-medium text-muted-foreground",children:[i.jsx(He,{className:"text-sm",children:w("quotes.form_fields.tax.label")}),i.jsx(Hi,{scale:2,disabled:a.disabled,placeholder:w("quotes.form_fields.tax.placeholder"),name:"tax"})]}),i.jsxs("div",{className:"grid gap-1 font-semibold text-muted-foreground",children:[i.jsx(He,{className:"text-sm text-right",children:w("quotes.form_fields.tax_price.label")}),i.jsxs(Be,{className:"flex items-baseline justify-end gap-1 text-2xl tabular-nums",children:[p,i.jsx("span",{className:"text-base font-medium tracking-normal",children:v})]})]})]})," ",i.jsx(hn,{orientation:"vertical",className:"w-px h-16 mx-2"}),i.jsx("div",{className:"grid flex-1 h-16 grid-cols-1 auto-rows-max",children:i.jsxs("div",{className:"grid gap-0",children:[i.jsx(He,{className:"text-sm font-semibold text-right text-foreground",children:w("quotes.form_fields.total_price.label")}),i.jsxs(Be,{className:"flex items-baseline justify-end gap-1 text-3xl tabular-nums",children:[x,i.jsx("span",{className:"ml-1 text-lg tracking-normal",children:v})]})]})})]})})},Gd=n=>{const{percentage:a,cancel:r,error:o,isInProgress:l,onFinishDownload:c}=n,d=M.useId();return M.useEffect(()=>{l&&!o&&a===100&&c&&c()},[a,l,o,c]),i.jsx(rr,{open:l,children:i.jsxs(ir,{className:"sm:max-w-md",children:[i.jsxs(sr,{children:[i.jsx(ar,{children:w("quotes.downloading_dialog.title")}),i.jsx(ns,{children:w("quotes.downloading_dialog.description")})]}),i.jsxs("div",{className:"mb-4 space-y-2",id:d,children:[i.jsx(cr,{children:w("quotes.downloading_dialog.progress.label",{status:w(l?"quotes.downloading_dialog.progress.status_in_progress":"quotes.downloading_dialog.progress.status_stopped")})}),i.jsx(Gc,{value:a,max:100,getValueLabel:()=>w("quotes.downloading_dialog.progress.label",{})}),o&&i.jsxs("p",{children:["Error: ",JSON.stringify(o)]})]}),i.jsx(or,{className:"sm:justify-end",children:i.jsx(Vi,{asChild:!0,children:i.jsx(U,{type:"button",variant:"secondary",onClick:()=>r(),children:w("quotes.downloading_dialog.cancel_button")})})})]})})},Pw=({isInProgress:n,percentage:a,elapsed:r,cancel:o,error:l,className:c})=>{const[d,h]=M.useState(10);return M.useEffect(()=>{if(n&&a>0){const p=r/a*100;h(Math.max(0,Math.round(p-r)))}},[n,a,r]),!n&&!(l!=null&&l.errorMessage)?null:i.jsxs(Le,{className:he("overflow-hidden",c),children:[i.jsx(ct,{children:i.jsxs(Be,{className:"flex items-center justify-between",children:[l!=null&&l.errorMessage?"Error en la generación del PDF":"Generando PDF",n&&i.jsx(W0,{className:"w-4 h-4 animate-spin"}),(l==null?void 0:l.errorMessage)&&i.jsx(V0,{className:"w-4 h-4 text-destructive"})]})}),i.jsx(Oe,{children:l!=null&&l.errorMessage?i.jsx("div",{className:"text-destructive",children:l==null?void 0:l.errorMessage}):i.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[i.jsxs("div",{className:"relative w-32 h-40 overflow-hidden rounded-lg bg-muted",children:[i.jsx("div",{className:"absolute bottom-0 left-0 right-0 transition-all duration-1000 ease-out bg-primary",style:{height:`${a}%`}}),i.jsx(K0,{className:"absolute transform -translate-x-1/2 -translate-y-1/2 animate-pulse top-1/2 left-1/2 text-muted-foreground",size:48})]}),i.jsx(Gc,{value:a,className:"w-full"}),i.jsxs("div",{className:"text-sm text-center text-muted-foreground",children:[i.jsxs("p",{children:["Progreso: ",a,"%"]}),i.jsxs("div",{className:"hidden",children:[i.jsxs("p",{children:["Tiempo transcurrido: ",r," segundos"]}),d>0&&i.jsxs("p",{children:["Tiempo estimado restante: ",d," segundos"]})]})]}),i.jsx(U,{variant:"destructive",onClick:o,className:"hidden",children:"Cancelar generación"})]})})]})},Hd=({quote:n,className:a})=>{const{useReport:r,getQuotePDFFilename:o,useDownloader:l}=Ur(),{download:c}=l(),{report:d,preview:h,isInProgress:p,...x}=r(),[v,R]=M.useState(void 0),y=M.useCallback(()=>{n&&c(n.id,o(n))},[n]);return M.useEffect(()=>{const b=setTimeout(()=>{n&&n.id&&h(n.id)},200);return()=>clearTimeout(b)},[n]),M.useEffect(()=>{if(!p&&d){const b=window.URL&&window.URL.createObjectURL?window.URL.createObjectURL(d):window.webkitURL.createObjectURL(d);return R(b),()=>{R(void 0),window.URL.revokeObjectURL(b)}}},[d,p]),n?p?i.jsx(Pw,{isInProgress:p,...x}):i.jsx(p0,{file:v,className:"object-contain",onThumbnailClick:y}):i.jsx(Le,{className:he("overflow-hidden",a),children:i.jsx(Oe,{className:"px-4 py-6 text-center",children:i.jsx("p",{className:"mx-auto",children:"Select a quote"})})})};Hd.whyDidYouRender=!0;const Tr=db();function kw({row:n,table:a}){var l;const r=(l=a.options.meta)==null?void 0:l.catalogPicker;if(!r)return null;const o=r.quantities[n.index]??1;return i.jsx(Zi,{type:"number",name:"quantity",min:1,className:"w-24",value:o,onChange:c=>{const d=c.target.value;r.setQuantity(n.index,d===""?"":Number(d))}})}function qw({row:n,table:a}){var o;const r=(o=a.options.meta)==null?void 0:o.catalogPicker;return i.jsxs(U,{size:"sm",variant:"outline",className:"h-8 gap-1",onClick:l=>{l.preventDefault(),r==null||r.selectArticle(n.original,n.index)},children:[i.jsx(Co,{className:"h-3.5 w-3.5"}),i.jsx("span",{className:"sr-only xl:not-sr-only xl:whitespace-nowrap",children:w("common.add")})]})}const to=({onSelect:n})=>{const a=zt(),{pagination:r,globalFilter:o,isFiltered:l}=Tn(),[c,d]=M.useState([]),h=M.useCallback((D,F)=>{d(q=>{const $=[...q];return $[D]=F,$})},[]),p=()=>{d([])},{data:x,isPending:v,isError:R,error:y}=$d({pagination:{pageIndex:r.pageIndex,pageSize:r.pageSize},searchTerm:o});M.useEffect(()=>{p()},[r,o,l]);const b=M.useMemo(()=>({catalogPicker:{quantities:c,setQuantity:h,selectArticle:(D,F)=>n(D,c[F]===""?1:c[F]??1)}}),[h,n,c]),E=M.useMemo(()=>[Tr.accessor("description",{id:"description",header:()=>i.jsx(i.Fragment,{children:w("catalog.list.columns.description")})}),Tr.accessor("points",{id:"points",header:()=>i.jsx("div",{className:"text-right",children:w("catalog.list.columns.points")}),cell:({renderValue:D})=>i.jsx("div",{className:"text-right",children:D()})}),Tr.accessor("retail_price",{id:"retail_price",header:()=>i.jsx("div",{className:"text-right",children:w("catalog.list.columns.retail_price")}),cell:({row:D})=>{const F=Tt.create(D.original.retail_price).object;return i.jsx("div",{className:"text-right",children:F.toFormat()})}}),Tr.display({id:"quantity",header:()=>i.jsx("div",{className:"font-medium text-right text-foreground",children:w("catalog.list.columns.quantity")}),cell:kw}),Tr.display({id:"row-actions",header:()=>null,cell:qw})],[]),{table:j}=os({data:[...(x==null?void 0:x.items)||[]],columns:E,pageCount:(x==null?void 0:x.total_pages)??-1,meta:b});return R?i.jsx(ur,{subtitle:y.message}):v?i.jsx(ss,{columnCount:6,searchableColumnCount:1,filterableColumnCount:2,shrinkZero:!0}):(x==null?void 0:x.total_items)===0&&!l?i.jsx(as,{subtitle:"Empieza cargando los artículos del catálogo",buttonText:"",onButtonClick:()=>a("/catalog/add")}):i.jsx(is,{className:"bg-transparent border-0 shadow-none",table:j,paginationOptions:{visible:!0,enablePageSizeSelector:!1},footerClassName:"px-10 pt-2 border-t",children:i.jsx(zd,{table:j})})},Do=M.forwardRef(({label:n=w("common.append_block"),className:a,...r},o)=>i.jsxs(U,{type:"button",variant:"outline",ref:o,...r,children:[" ",i.jsx(Co,{className:n?"w-4 h-4 mr-2":"w-4 h-4"}),n&&i.jsx(i.Fragment,{children:n})]}));Do.displayName="AppendBlockRowButton";const To=M.forwardRef(({label:n=w("common.append_article"),className:a,...r},o)=>i.jsxs(U,{type:"button",variant:"outline",ref:o,...r,children:[" ",i.jsx(Co,{className:n?"w-4 h-4 mr-2":"w-4 h-4"}),n&&i.jsx(i.Fragment,{children:n})]}));To.displayName="AppendCatalogArticleRowButton";const Lo=M.forwardRef(({label:n=w("common.append_empty_row"),className:a,...r},o)=>i.jsxs(U,{type:"button",variant:"outline",ref:o,...r,children:[i.jsx(B0,{className:n?"w-4 h-4 mr-2":"w-4 h-4"}),n&&i.jsx(i.Fragment,{children:n})]}));Lo.displayName="AppendEmptyRowButton";const $w=({table:n,showLineDiscountColumn:a,hasLineDiscounts:r,onShowLineDiscountColumnChange:o})=>{const l=n.getSelectedRowModel().rows.length,[c,d]=M.useState(!1),h=x=>{if(!x&&a&&r){d(!0);return}o(x)},p=i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex items-center gap-2 ml-auto",children:[i.jsxs("div",{className:"grid gap-0.5",children:[i.jsx(cr,{htmlFor:"show-line-discount-column",className:"text-sm font-medium",children:w("quotes.discount_column.label")}),i.jsx("p",{className:"text-xs font-normal text-muted-foreground",children:w("quotes.discount_column.description")})]}),i.jsx(So,{id:"show-line-discount-column",checked:a,onCheckedChange:h})]}),i.jsx(rr,{open:c,onOpenChange:d,children:i.jsxs(ir,{children:[i.jsxs(sr,{children:[i.jsx(ar,{children:w("quotes.discount_column.confirmation.title")}),i.jsx(ns,{children:w("quotes.discount_column.confirmation.description")})]}),i.jsxs(or,{children:[i.jsx(U,{type:"button",variant:"secondary",onClick:()=>d(!1),children:w("common.cancel")}),i.jsx(U,{type:"button",onClick:()=>{o(!1),d(!1)},children:w("quotes.discount_column.confirmation.confirm")})]})]})})]});return l?i.jsx("nav",{className:"flex items-center h-12 p-1 rounded-md text-muted-foreground bg-muted ",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs(Ke,{children:[i.jsx(We,{asChild:!0,children:i.jsxs(U,{type:"button",variant:"link",disabled:!n.getSelectedRowModel().rows.length,onClick:()=>{var x;return(x=n.options.meta)==null?void 0:x.duplicateItems()},children:[i.jsx(U0,{className:"w-4 h-4 sm:mr-2"}),i.jsx("span",{className:"sr-only sm:not-sr-only",children:w("common.duplicate_selected_rows")})]})}),i.jsx(Ye,{children:w("common.duplicate_selected_rows_tooltip")})]}),i.jsxs(Ke,{children:[i.jsx(We,{asChild:!0,children:i.jsxs(U,{type:"button",variant:"link",disabled:!n.getSelectedRowModel().rows.length,onClick:()=>{var x;return(x=n.options.meta)==null?void 0:x.deleteItems()},children:[i.jsx(pd,{className:"w-4 h-4 sm:mr-2"}),i.jsx("span",{className:"sr-only sm:not-sr-only",children:w("common.remove_selected_rows")})]})}),i.jsx(Ye,{children:w("common.remove_selected_rows_tooltip")})]}),i.jsxs(Ke,{children:[i.jsx(We,{asChild:!0,children:i.jsxs(U,{type:"button",variant:"link",disabled:!n.getSelectedRowModel().rows.length,onClick:()=>n.resetRowSelection(),children:[i.jsx(Y0,{className:"w-4 h-4 sm:mr-2"}),i.jsx("span",{className:"sr-only sm:not-sr-only",children:w("common.reset_selected_rows")})]})}),i.jsx(Ye,{children:w("common.reset_selected_rows_tooltip")})]}),i.jsx(hn,{orientation:"vertical",className:"h-6 ml-1 mr-4"}),i.jsx("p",{className:"text-sm font-normal",children:w("common.rows_selected",{count:l})}),p]})}):i.jsxs("nav",{className:"flex items-center h-12 p-1 rounded-md bg-accent/75 text-muted-foreground",children:[i.jsxs("div",{className:"flex space-x-2",children:[i.jsxs(Ke,{children:[i.jsx(We,{asChild:!0,children:i.jsx(Lo,{variant:"link",onClick:()=>{var x;return(x=n.options.meta)==null?void 0:x.appendItem()}})}),i.jsx(Ye,{children:w("common.append_empty_row_tooltip")})]}),i.jsxs(Ke,{children:[i.jsx(We,{asChild:!0,children:i.jsx(To,{variant:"link",onClick:()=>{var x;n.options.meta&&n.options.meta.pickCatalogArticle&&((x=n.options.meta)==null||x.pickCatalogArticle())}})}),i.jsx(Ye,{children:w("common.append_article_tooltip")})]}),i.jsxs(Ke,{children:[i.jsx(We,{asChild:!0,children:i.jsx(Do,{variant:"link",onClick:()=>{var x;n.options.meta&&n.options.meta.pickBlock&&((x=n.options.meta)==null||x.pickBlock())}})}),i.jsx(Ye,{children:w("common.append_block_tooltip")})]})]}),p]})},zw=({row:n,table:a,onDelete:r})=>{const o=()=>{var l;(l=a.options.meta)==null||l.deleteItems(n.index),r()};return i.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[i.jsxs(U,{type:"button",variant:"outline",size:"sm",onClick:()=>{var l;return(l=a.options.meta)==null?void 0:l.insertItem(n.index)},children:[i.jsx(x0,{className:"w-4 h-4 mr-2"}),w("common.insert_row_above")]}),i.jsxs(U,{type:"button",variant:"outline",size:"sm",onClick:()=>{var l;return(l=a.options.meta)==null?void 0:l.insertItem(n.index+1)},children:[i.jsx(Pc,{className:"w-4 h-4 mr-2"}),w("common.insert_row_below")]}),i.jsxs(U,{type:"button",variant:"outline",size:"sm",onClick:()=>{var l;return(l=a.options.meta)==null?void 0:l.duplicateItems(n.index)},children:[i.jsx(jo,{className:"w-4 h-4 mr-2"}),w("common.duplicate_row")]}),i.jsxs(Hc,{children:[i.jsx(Kc,{asChild:!0,children:i.jsxs(U,{type:"button",variant:"destructive",size:"sm",children:[i.jsx(pd,{className:"w-4 h-4 mr-2"}),w("common.remove_row")]})}),i.jsxs(Wc,{children:[i.jsxs(Yc,{children:[i.jsx(Qc,{children:w("quotes.inline_row_actions.delete_confirmation.title")}),i.jsx(Xc,{children:w("quotes.inline_row_actions.delete_confirmation.description")})]}),i.jsxs(Zc,{children:[i.jsx(Jc,{children:w("common.cancel")}),i.jsx(ed,{asChild:!0,children:i.jsx(U,{type:"button",variant:"destructive",onClick:o,children:w("quotes.inline_row_actions.delete_confirmation.confirm")})})]})]})]})]})},Bw={droppable:{strategy:w0.Always}},Vw={keyframes({transform:n}){return[{opacity:1,transform:Ga.Transform.toString(n.initial)},{opacity:0,transform:Ga.Transform.toString({...n.final,x:n.final.x+5,y:n.final.y+5})}]},easing:"ease-out",sideEffects({active:n}){n.node.animate([{opacity:0},{opacity:1}],{duration:vc.duration,easing:vc.easing})}};function Ec({columns:n,data:a,defaultValues:r,initialState:o,actions:l,showLineDiscountColumn:c,hasLineDiscounts:d,onShowLineDiscountColumnChange:h}){const[p,x]=M.useState({}),[v,R]=M.useState(),[y,b]=M.useState(null),E=M.useMemo(()=>a.map(O=>O.id),[a]),j=Md({data:a,columns:n,enableColumnResizing:!1,columnResizeMode:"onChange",autoResetAll:!1,initialState:o,state:{rowSelection:p,columnVisibility:{...o==null?void 0:o.columnVisibility,discount:c}},enableRowSelection:!0,enableMultiRowSelection:!0,enableSorting:!1,enableHiding:!0,onRowSelectionChange:x,getCoreRowModel:Id(),getRowId:O=>O==null?void 0:O.id,debugTable:!1,debugHeaders:!1,debugColumns:!1,defaultColumn:{minSize:0,size:Number.MAX_SAFE_INTEGER,maxSize:Number.MAX_SAFE_INTEGER},meta:{insertItem:(O,k)=>{l.insert(O,k||(r==null?void 0:r.items[0]),{shouldFocus:!0})},appendItem:O=>{l.append(O||(r==null?void 0:r.items[0]),{shouldFocus:!0})},pickCatalogArticle:()=>{l.pickCatalogArticle&&(l==null||l.pickCatalogArticle())},pickBlock:()=>{l.pickBlock&&(l==null||l.pickBlock())},duplicateItems:O=>{var k;if(O!=null){const H=((k=l.getItem)==null?void 0:k.call(l,O))??j.getRowModel().rows[O].original;l.insert(O+1,{...H,id:void 0},{shouldFocus:!0})}else if(j.getSelectedRowModel().rows.length){const H=j.getSelectedRowModel().rows[j.getSelectedRowModel().rows.length-1].index,W=j.getSelectedRowModel().rows.map(B=>({...B.original,id:void 0}));j.getRowModel().rows.length{if(O!=null)l.remove(O);else if(j.getSelectedRowModel().rows.length>0){let k=j.getSelectedRowModel().rows.length-1;for(;k>=0;k--){const H=E.indexOf(String(j.getSelectedRowModel().rows[k].id));l.remove(H),E.splice(H,1)}j.resetRowSelection()}else l.remove()},updateItem:(O,k,H,W)=>{l.update(O,{...k,[`${H}`]:W})}}}),D=v0(Pi(A0,{}),Pi(E0,{}),Pi(R0,{}),Pi(N0,{}));function F(O){var W;let k=O.active.id,H=(W=O.over)==null?void 0:W.id;if(H!==void 0&&k!==H){let B=E.indexOf(String(H));if(j.getSelectedRowModel().rows.length>1)j.getSelectedRowModel().rows.forEach((ae,ce)=>{const Y=E.indexOf(String(ae.id));ce>0&&(k=ae.id,B=E.indexOf(String(H)),B{const H=typeof k=="string"?k:k.id;return H===v||!j.getSelectedRowModel().rowsById[H]}):O}return i.jsx(_0,{measuring:Bw,sensors:D,onDragEnd:F,onDragStart:q,onDragCancel:$,collisionDetection:b0,children:i.jsxs(Le,{children:[i.jsx(ct,{className:"sticky z-10 top-16 bg-card/90",children:i.jsx(Be,{children:i.jsx($w,{table:j,showLineDiscountColumn:c,hasLineDiscounts:d,onShowLineDiscountColumnChange:h})})}),i.jsxs(Oe,{children:[i.jsxs(uo,{className:"table-fixed",children:[i.jsx(co,{className:"sticky top-0 z-10 bg-background",children:j.getHeaderGroups().map(O=>i.jsx(pn,{className:"hover:bg-transparent",children:O.headers.map(k=>i.jsx(fo,{className:"px-2 py-1",style:{width:k.getSize()===Number.MAX_SAFE_INTEGER?"auto":k.getSize()},children:k.isPlaceholder?null:i.jsx(Td,{table:j,header:k})},k.id))},O.id))}),i.jsx(go,{children:i.jsx(j0,{items:Q(E),strategy:C0,children:Q(j.getRowModel().rows).map(O=>{const k=O,H=k.id===y;return i.jsxs(M.Fragment,{children:[i.jsx(Ew,{id:k.id,isActive:H,onActivate:()=>b(k.id),children:k.getVisibleCells().map(W=>i.jsx(qr,{className:"px-2 py-2 align-top",style:{width:W.column.getSize()===Number.MAX_SAFE_INTEGER?"auto":W.column.getSize()},children:Gi(W.column.columnDef.cell,W.getContext())},W.id))}),H&&i.jsx(pn,{className:"border border-t-0 border-destructive/30 border-l-4 border-l-destructive bg-destructive/5 hover:bg-destructive/5",children:i.jsx(qr,{colSpan:k.getVisibleCells().length,className:"px-2 py-2",children:i.jsx(zw,{row:k,table:j,onDelete:()=>b(null)})})})]},k.id)})})})]}),S0.createPortal(i.jsx(y0,{dropAnimation:Vw,className:"z-40 opacity-100",children:v&&i.jsx("div",{className:"relative flex flex-wrap",children:j.getSelectedRowModel().rows.length?i.jsx(ro,{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:j.getSelectedRowModel().rows.length}):null})}),document.body),!1]}),i.jsx(Nt,{children:i.jsxs(tr,{children:[i.jsx(Lo,{onClick:()=>{var O;return(O=j.options.meta)==null?void 0:O.appendItem()}}),i.jsx(To,{onClick:()=>{var O;j.options.meta&&j.options.meta.pickCatalogArticle&&((O=j.options.meta)==null||O.pickCatalogArticle())}}),i.jsx(Do,{onClick:()=>{var O;j.options.meta&&j.options.meta.pickBlock&&((O=j.options.meta)==null||O.pickBlock())}})]})})]})})}const Uw={en:[{id:2000000098,code:"CAP_CLA_SEMI_SUSPENDIDO_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 @@ -249,6 +249,6 @@ 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`}]},Ac=({onSelect:n})=>{const{i18n:a}=Fo(),[r]=M.useState(a.resolvedLanguage||"es"),[o]=M.useState(Uw[r.toLowerCase()]);return console.log(r),i.jsx(no,{className:"h-96",children:i.jsx("div",{className:"flex flex-col gap-2 p-4 pt-0",children:o&&o.sort((l,c)=>l.title.localeCompare(c.title)).map((l,c)=>i.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:()=>n&&n(l,1),children:i.jsxs("div",{className:"flex flex-col w-full gap-1",children:[i.jsx("div",{className:"flex items-center",children:i.jsx("div",{className:"flex items-center gap-2",children:i.jsx("div",{className:"font-semibold",children:l.title})})}),i.jsx("div",{className:"text-xs line-clamp-2 text-muted-foreground",children:i.jsx("p",{dangerouslySetInnerHTML:{__html:l.body.substring(0,300).replace(`\r -`,"
")}})})]})},l.id))})})},Gw=({isOpen:n,onOpenChange:a,onSelect:r})=>Pd("(min-width: 768px)")?i.jsx(rr,{modal:!0,open:n,onOpenChange:a,children:i.jsxs(ir,{className:"w-full max-w-full md:w-9/12 lg:w-10/12",children:[i.jsxs(sr,{children:[i.jsx(ar,{children:w("quotes.blocks_picker_dialog.title")}),i.jsx(ns,{children:w("quotes.blocks_picker_dialog.description")})]}),i.jsx(Ac,{onSelect:r}),i.jsx(or,{children:i.jsx(G,{type:"submit",onClick:()=>a(!1),children:w("common.close")})})]})}):i.jsx(td,{open:n,onOpenChange:a,children:i.jsxs(nd,{children:[i.jsxs(rd,{className:"text-left",children:[i.jsx(id,{children:w("quotes.blocks_picker_dialog.title")}),i.jsx(sd,{children:w("quotes.blocks_picker_dialog.description")})]}),i.jsx(Ac,{onSelect:r}),i.jsx(ad,{className:"pt-2",children:i.jsx(od,{asChild:!0,children:i.jsx(G,{variant:"outline",children:w("common.close")})})})]})}),Hw=({isOpen:n,onOpenChange:a,onSelect:r})=>Pd("(min-width: 768px)")?i.jsx(rr,{modal:!0,open:n,onOpenChange:a,children:i.jsxs(ir,{className:"w-full max-w-full md:w-9/12 lg:w-10/12",children:[i.jsxs(sr,{children:[i.jsx(ar,{children:w("quotes.catalog_picker_dialog.title")}),i.jsx(ns,{children:w("quotes.catalog_picker_dialog.description")})]}),i.jsx(nr,{syncWithLocation:!1,initialPageSize:5,children:i.jsx(to,{onSelect:r})}),i.jsx(or,{children:i.jsx(G,{type:"submit",onClick:()=>a(!1),children:w("common.close")})})]})}):i.jsx(td,{open:n,onOpenChange:a,children:i.jsxs(nd,{children:[i.jsxs(rd,{className:"text-left",children:[i.jsx(id,{children:w("quotes.catalog_picker_dialog.title")}),i.jsx(sd,{children:w("quotes.catalog_picker_dialog.description")})]}),i.jsx(nr,{syncWithLocation:!1,initialPageSize:5,children:i.jsx(to,{onSelect:r})}),i.jsx(ad,{className:"pt-2",children:i.jsx(od,{asChild:!0,children:i.jsx(G,{variant:"outline",children:w("common.close")})})})]})}),Kw=({currency:n,language:a,defaultValues:r})=>{var W;const{toast:o}=vn(),{control:l,getValues:c,setValue:d,watch:h}=lr(),p=h("show_line_discount_column")??!0,x=!!((W=c("items"))!=null&&W.some(B=>{var se;return Number((se=B.discount)==null?void 0:se.amount)>0})),[v]=M.useState("dialog"),[R,y]=M.useState(!1),[b,E]=M.useState(!1),{fields:j,...D}=I0({control:l,name:"items"}),F=Iw([{id:"description",accessorKey:"description",header:w("quotes.form_fields.items.description.label"),cell:({row:{index:B,original:se}})=>i.jsx(qt,{readOnly:se==null?void 0:se.id_article,autoSize:!0,name:`items.${B}.description`}),minSize:200,size:400},{id:"quantity",accessorKey:"quantity",header:()=>i.jsx("div",{className:"text-right",children:w("quotes.form_fields.items.quantity.label")}),cell:({row:{index:B}})=>i.jsx(fw,{scale:0,className:"text-right",name:`items.${B}.quantity`}),size:75},{id:"unit_price",accessorKey:"unit_price",header:()=>i.jsx("div",{className:"text-right",children:w("quotes.form_fields.items.unit_price.label")}),cell:({row:{index:B}})=>i.jsx(Fa,{currency:n,language:a,scale:2,className:"text-right",name:`items.${B}.unit_price`}),size:125},{id:"subtotal_price",accessorKey:"subtotal_price",header:()=>i.jsx("div",{className:"text-right",children:w("quotes.form_fields.items.subtotal_price.label")}),cell:({row:{index:B}})=>i.jsx(Fa,{variant:"ghost",currency:n,language:a,scale:2,readOnly:!0,className:"text-right",name:`items.${B}.subtotal_price`}),size:150},{id:"discount",accessorKey:"discount",header:()=>i.jsx("div",{className:"text-right",children:w("quotes.form_fields.items.discount.label")}),cell:({row:{index:B}})=>i.jsx(Hi,{scale:2,className:"text-right",name:`items.${B}.discount`}),size:100},{id:"total_price",accessorKey:"total_price",header:()=>i.jsx("div",{className:"text-right",children:w("quotes.form_fields.items.total_price.label")}),cell:({row:{index:B}})=>i.jsx(Fa,{variant:"ghost",currency:n,language:a,scale:2,readOnly:!0,className:"font-semibold text-right",name:`items.${B}.total_price`}),size:150}],{enableDragHandleColumn:!0,enableSelectionColumn:!0}),q=M.useCallback((B,se=1)=>{D.append({...B,quantity:{amount:100*se,scale:pn.DEFAULT_SCALE},unit_price:B.retail_price,discount:{amount:null,scale:2}}),o({title:w("quotes.catalog_picker_dialog.toast_article_added"),description:B.description})},[D]),$=M.useCallback(B=>{D.append({description:`${B.title} -${B.body}`,quantity:{amount:null,scale:pn.DEFAULT_SCALE},unit_price:{amount:null,scale:ab.DEFAULT_SCALE},discount:{amount:null,scale:2}}),o({title:w("quotes.blocks_picker_dialog.toast_article_added"),description:B.title})},[D]),[Q,O]=M.useState(!1),k=[265,440,655],H=4;return v==="dialog"?i.jsxs("div",{className:"relative",children:[i.jsx(Ec,{actions:{...D,getItem:B=>c(`items.${B}`),pickCatalogArticle:()=>y(!0),pickBlock:()=>E(!0)},columns:F,data:j,defaultValues:r,showLineDiscountColumn:p,hasLineDiscounts:x,onShowLineDiscountColumnChange:B=>d("show_line_discount_column",B,{shouldDirty:!0})}),i.jsx(Hw,{onSelect:q,isOpen:R,onOpenChange:y}),i.jsx(Gw,{onSelect:$,isOpen:b,onOpenChange:E})]}):i.jsxs(Z0,{direction:"horizontal",autoSaveId:"uecko.quotes.details_layout",className:"items-stretch h-full",children:[i.jsx(wc,{defaultSize:k[0],collapsedSize:H,collapsible:!0,minSize:50,maxSize:90,onCollapse:()=>{O(!0)},onExpand:()=>{O(!1)},className:he(Q&&"min-w-[50px] transition-all duration-300 ease-in-out"),children:i.jsx(Ec,{actions:{...D,getItem:B=>c(`items.${B}`)},columns:F,data:j,defaultValues:r,showLineDiscountColumn:p,hasLineDiscounts:x,onShowLineDiscountColumnChange:B=>d("show_line_discount_column",B,{shouldDirty:!0})})}),i.jsx(J0,{withHandle:!0,className:"mx-3"}),i.jsx(wc,{defaultSize:k[1],minSize:10,children:i.jsx(nr,{syncWithLocation:!1,children:i.jsx(to,{onSelect:q})})})]})},Ww=()=>{const{formState:n}=lr();return i.jsxs("div",{className:"grid gap-6 md:grid-cols-6",children:[i.jsxs(Ha,{className:"md:col-span-6",title:w("quotes.create.form_groups.general.title"),description:w("quotes.create.form_groups.general.desc"),children:[i.jsxs("div",{className:"grid grid-cols-6 gap-6",children:[i.jsx(Fn,{required:!0,className:"col-span-2",label:w("quotes.form_fields.customer_reference.label"),description:w("quotes.form_fields.customer_reference.desc"),disabled:n.disabled,placeholder:w("quotes.form_fields.customer_reference.placeholder"),name:"customer_reference"}),i.jsx(Uc,{required:!0,label:w("quotes.form_fields.date.label"),description:w("quotes.form_fields.date.desc"),disabled:n.disabled,placeholder:w("quotes.form_fields.date.placeholder"),name:"date"}),i.jsx(Fn,{label:w("quotes.form_fields.validity.label"),description:w("quotes.form_fields.validity.desc"),disabled:n.disabled,placeholder:w("quotes.form_fields.validity.placeholder"),name:"validity"}),i.jsx(qt,{className:"col-span-2",label:w("quotes.form_fields.payment_method.label"),description:w("quotes.form_fields.payment_method.desc"),disabled:n.disabled,placeholder:w("quotes.form_fields.payment_method.placeholder"),name:"payment_method"})]}),i.jsxs("div",{className:"grid grid-cols-6 gap-6",children:[i.jsx(qt,{className:"col-span-3",required:!0,label:w("quotes.form_fields.customer_information.label"),description:w("quotes.form_fields.customer_information.desc"),disabled:n.disabled,placeholder:w("quotes.form_fields.customer_information.placeholder"),name:"customer_information",errors:n.errors}),i.jsx(qt,{className:"col-span-3",label:w("quotes.form_fields.notes.label"),description:w("quotes.form_fields.notes.desc"),disabled:n.disabled,placeholder:w("quotes.form_fields.notes.placeholder"),name:"notes"})]})]}),i.jsx(Ha,{className:"hidden md:col-span-2",title:w("quotes.create.form_groups.status.title"),description:w("quotes.create.form_groups.status.desc"),children:i.jsxs("div",{className:"grid gap-6",children:[i.jsxs("div",{className:"grid gap-3",children:[i.jsx(cr,{htmlFor:"status",children:"Status"}),i.jsxs(so,{children:[i.jsx(ao,{id:"status","aria-label":"Select status",children:i.jsx(oo,{placeholder:"Select status"})}),i.jsxs(lo,{children:[i.jsx(Or,{value:"draft",children:"Draft"}),i.jsx(Or,{value:"published",children:"Active"}),i.jsx(Or,{value:"archived",children:"Archived"})]})]})]}),i.jsx(Fn,{required:!0,label:w("quotes.form_fields.lang_code.label"),description:w("quotes.form_fields.lang_code.desc"),placeholder:w("quotes.form_fields.lang_code.placeholder"),name:"lang_code"}),i.jsx(Fn,{required:!0,label:w("quotes.form_fields.currency_code.label"),description:w("quotes.form_fields.currency_code.desc"),placeholder:w("quotes.form_fields.currency_code.placeholder"),name:"currency_code"})]})})]})},Kd=({id:n,onSentTo:a,disabled:r})=>{const o=()=>{a(n)};return i.jsxs(Hc,{children:[i.jsx(Kc,{asChild:!0,disabled:r,children:i.jsxs(G,{variant:"ghost",className:"h-10 gap-1 text-primary disabled:text-secondary-foreground",children:[i.jsx(Q0,{className:"w-4 h-4"}),w("quotes.quote_sent_to_editor.trigger_button")]})}),i.jsxs(Wc,{children:[i.jsxs(Yc,{children:[i.jsx(Qc,{children:w("quotes.quote_sent_to_editor.title")}),i.jsx(Xc,{children:w("quotes.quote_sent_to_editor.description")})]}),i.jsxs(Zc,{children:[i.jsx(Jc,{children:w("common.cancel")}),i.jsx(ed,{asChild:!0,children:i.jsx(G,{onClick:o,children:w("common.continue")})})]})]})]})},Yw=["draft","ready","delivered","accepted","rejected","archived"],Qw={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"]},Wd=({type:n="button",status:a,onChangeStatus:r})=>{const[o,l]=M.useState(a),c=h=>l(h);M.useEffect(()=>{a&&l(a)},[a]);const d=()=>{o!==a&&r(o,a)};return i.jsxs(rr,{children:[i.jsx(Dc,{asChild:!0,children:n==="button"?i.jsxs(G,{size:"sm",variant:"outline",className:"h-8 gap-1",children:[i.jsx(F0,{className:"h-3.5 w-3.5"}),i.jsx("span",{className:"sr-only md:not-sr-only md:whitespace-nowrap",children:w("quotes.quote_status_editor.trigger_button")})]}):i.jsx(M0,{status:a,isEditable:!0})}),i.jsxs(ir,{children:[i.jsx(sr,{children:i.jsx(ar,{children:w("quotes.quote_status_editor.title")})}),i.jsx(D0,{}),i.jsx("div",{className:"grid gap-4 py-4",children:Yw.map(h=>{const p=!Qw[a].includes(h);return i.jsxs("div",{className:"flex items-start space-x-4",children:[i.jsx(So,{id:h,checked:o===h,onCheckedChange:()=>c(h),disabled:p}),i.jsxs("div",{className:"grid gap-1.5 leading-none",children:[i.jsx(cr,{htmlFor:h,className:he("font-medium",p?"text-input":"text-foreground"),children:w(`quotes.quote_status_editor.status.${h}.title`)}),i.jsx("p",{className:he("text-sm",p?"text-input":"text-muted-foreground"),children:w(`quotes.quote_status_editor.status.${h}.description`)})]})]},h)})}),i.jsxs(or,{className:"pt-6 border-t",children:[i.jsx(Vi,{asChild:!0,children:i.jsx(G,{type:"button",variant:"secondary",children:w("common.cancel")})}),i.jsx(Vi,{asChild:!0,children:i.jsx(G,{onClick:d,disabled:o===a,children:w("quotes.quote_status_editor.submit_button")})})]})]})]})},Xw=({quoteId:n,className:a})=>{const r=zt(),{toast:o}=vn(),{useOne:l,useSetStatus:c,useSentTo:d,useDownloader:h,useDuplicate:p,getQuotePDFFilename:x}=Ur(),{data:v,status:R}=l(n),{mutate:y}=c(),{mutate:b}=d(n),{mutate:E}=p(),{download:j,...D}=h(),{formatCurrency:F,formatNumber:q}=Od({locale:(v==null?void 0:v.lang_code)||"ES"}),$=M.useMemo(()=>v?{subtotal_price:F(v.subtotal_price),discount:q(v.discount),discount_price:F(v.discount_price),tax:q(v.tax),tax_price:F(v.tax_price),total_price:F(v.total_price)}:{subtotal_price:"0,00 €",discount:"0",discount_price:"0,00 €",tax:"0",tax_price:"0,00 €",total_price:"0,00 €"},[v]),Q=M.useMemo(()=>(v==null?void 0:v.status)==="accepted"&&!(v!=null&&v.date_sent),[v]),O=M.useMemo(()=>(v==null?void 0:v.status)==="accepted"&&!!(v!=null&&v.date_sent),[v]),k=Y=>{y({id:v.id,newStatus:Y},{onSuccess:()=>{o({description:w("quotes.quote_status_editor.toast_status_changed"),variant:"success"})}})},H=Y=>{b({sent_date:T0(new Date)},{onSuccess:()=>{o({description:w("quotes.quote_sent_to_editor.toast_status_changed"),variant:"success"})}})},W=M.useCallback(()=>{o({description:w("quotes.downloading_dialog.toast_success"),variant:"success"})},[o]),B=M.useCallback(()=>{v&&j(v.id,x(v))},[v]);if(R==="error"||R!=="success")return null;if(!v)return i.jsx(Le,{className:he("overflow-hidden",a),children:i.jsx(Oe,{className:"px-4 py-6 text-center",children:i.jsx("p",{className:"mx-auto",children:"Select a quote"})})});const se=Y=>{E({id:Y},{onSuccess(Re){o({description:w("quotes.duplicate_action.toast_success"),variant:"success"}),r(`/quotes/edit/${Re.id}`,{relative:"path"})}})},ce=Y=>{y({id:Y,newStatus:"archived"},{onSuccess:()=>{o({description:w("quotes.quote_status_editor.toast_status_changed",{newStatus:w("quotes.status.archived")}),variant:"success"})}})};return i.jsxs(i.Fragment,{children:[i.jsx(Gd,{...D,onFinishDownload:W}),i.jsx(ld,{defaultValue:"resume",children:i.jsxs(Le,{className:"w-[390px] overflow-hidden",children:[i.jsxs(pt,{className:"gap-3 border-b bg-accent",children:[i.jsxs(Ge,{className:"flex items-center justify-between text-lg",children:[i.jsx("span",{children:w("quotes.list.resume.title")}),i.jsx(Wd,{status:v.status,onChangeStatus:k,type:"badge"})]}),i.jsx("div",{className:"flex w-full mr-auto text-foreground",children:i.jsxs("div",{className:"flex justify-between w-full",children:[i.jsxs(tr,{className:"gap-0",children:[i.jsxs(He,{children:[i.jsx(Ke,{asChild:!0,children:i.jsxs(G,{variant:"outline",size:"icon",disabled:O,onClick:Y=>{Y.preventDefault(),r(`/quotes/edit/${v.id}`,{relative:"path"})},children:[i.jsx(hd,{className:"w-4 h-4"}),i.jsx("span",{className:"sr-only",children:"Editar"})]})}),i.jsx(We,{children:i.jsx("p",{children:"Editar"})})]}),i.jsxs(He,{children:[i.jsx(Ke,{asChild:!0,children:i.jsxs(G,{variant:"outline",size:"icon",onClick:Y=>{Y.preventDefault(),se(v.id)},children:[i.jsx(jo,{className:"w-4 h-4"}),i.jsx("span",{className:"sr-only",children:"Duplicar"})]})}),i.jsx(We,{children:i.jsx("p",{children:"Duplicar"})})]}),i.jsxs(He,{children:[i.jsx(Ke,{asChild:!0,children:i.jsxs(G,{variant:"outline",size:"icon",onClick:B,children:[i.jsx(fd,{className:"w-4 h-4"}),i.jsx("span",{className:"sr-only",children:"Descargar"})]})}),i.jsx(We,{children:i.jsx("p",{children:"Descargar"})})]}),i.jsxs(He,{children:[i.jsx(Ke,{asChild:!0,children:i.jsxs(G,{variant:"outline",size:"icon",disabled:O,onClick:Y=>{Y.preventDefault(),ce(v.id)},children:[i.jsx(cd,{className:"w-4 h-4"}),i.jsx("span",{className:"sr-only",children:"Archivar"})]})}),i.jsx(We,{children:i.jsx("p",{children:"Archivar"})})]})]}),i.jsx(tr,{children:i.jsx(Kd,{disabled:O||!Q,id:v.id,onSentTo:H})})]})})]}),i.jsxs(Oe,{className:"p-6 text-sm",children:[i.jsxs(ud,{className:"grid w-full grid-cols-2",children:[i.jsx(Ka,{value:"resume",children:w("quotes.list.resume.tabs.resume")}),i.jsx(Ka,{value:"preview",children:w("quotes.list.resume.tabs.preview")})]}),i.jsx(Wa,{value:"resume",className:"pt-4",children:i.jsxs("div",{className:"grid gap-3",children:[i.jsxs("div",{className:"grid gap-3",children:[i.jsx("div",{className:"font-semibold",children:w("quotes.list.resume.quote_information")}),i.jsxs("dl",{className:"grid gap-3",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("dt",{className:"text-muted-foreground",children:w("quotes.form_fields.reference.label")}),i.jsx("dd",{className:"font-medium",children:v.reference})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("dt",{className:"text-muted-foreground",children:w("quotes.form_fields.date.label")}),i.jsx("dd",{className:"font-medium",children:new Date(v.date).toLocaleDateString()})]}),i.jsxs("div",{className:"flex items-start justify-between",children:[i.jsx("dt",{className:"text-muted-foreground whitespace-nowrap",children:w("quotes.form_fields.customer_reference.label")}),i.jsx("dd",{className:"font-medium text-right whitespace-break-spaces",children:v.customer_reference})]})]})]}),i.jsx(mn,{className:"my-4"}),i.jsxs("div",{className:"grid gap-3",children:[i.jsx("div",{className:"font-semibold",children:w("quotes.list.resume.customer_information")}),i.jsx("div",{children:v.customer_information})]}),i.jsx(mn,{className:"my-4"}),i.jsx("div",{className:"font-semibold",children:w("quotes.list.resume.price_information")}),i.jsxs("ul",{className:"grid gap-3",children:[i.jsxs("li",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:w("quotes.form_fields.subtotal_price.label")}),i.jsx("span",{children:$.subtotal_price})]}),i.jsxs("li",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:w("quotes.form_fields.discount_value.label",{value:$.discount})}),i.jsx("span",{children:$.discount_price})]}),i.jsxs("li",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:w("quotes.form_fields.tax_value.label",{value:$.tax})}),i.jsx("span",{children:$.tax_price})]}),i.jsxs("li",{className:"flex items-center justify-between font-semibold",children:[i.jsx("span",{className:"text-muted-foreground",children:w("quotes.form_fields.total_price.label")}),i.jsx("span",{children:$.total_price})]})]})]})}),i.jsx(Wa,{value:"preview",children:i.jsx(Hd,{quote:v})})]}),i.jsx(Dt,{className:"flex flex-row items-center px-6 py-3 border-t bg-accent",children:i.jsx("div",{className:"text-xs text-muted-foreground"})})]})})]})},Zw=({status:n="all",preview:a=!1})=>{const r=zt(),{toast:o}=vn(),l=M.useId(),c=M.useId(),{pagination:d,globalFilter:h,isFiltered:p}=Tn(),[x,v]=M.useState(void 0),{useList:R,useDownloader:y,useSetStatus:b,useDuplicate:E,getQuotePDFFilename:j}=Ur(),{mutate:D}=b(),{mutate:F}=E(),{data:q,isPending:$,isError:Q,error:O}=R({pagination:{pageIndex:d.pageIndex,pageSize:d.pageSize},status:n,quickSearchTerm:h}),{download:k,...H}=y(),W=je=>{v(je)},B=M.useCallback(()=>{o({description:w("quotes.downloading_dialog.toast_success")})},[o]),se=M.useCallback(je=>{r(`/quotes/edit/${je.id}`,{relative:"path"})},[r,o]),ce=je=>{F({id:je},{onSuccess(Me){o({description:w("quotes.duplicate_action.toast_success"),variant:"success"}),r(`/quotes/edit/${Me.id}`,{relative:"path"})}})},Y=je=>{D({id:je,newStatus:"archived"},{onSuccess:()=>{o({description:w("quotes.quote_status_editor.toast_status_changed",{newStatus:w("quotes.status.archived")}),variant:"success"})}})},Re=(je,Me)=>{D({id:je,newStatus:Me},{onSuccess:()=>{o({description:w("quotes.quote_status_editor.toast_status_changed",{newStatus:w(`quotes.status.${Me}`)}),variant:"success"})}})},rt=M.useMemo(()=>{const je=[{id:"reference",accessorKey:"reference",header:()=>i.jsx(i.Fragment,{children:w("quotes.list.columns.reference")}),cell:({row:{original:U},renderValue:be})=>{const Je=!!((U==null?void 0:U.status)==="accepted"&&(U!=null&&U.date_sent));return i.jsx(G,{size:"sm",variant:"link",disabled:Je,className:"h-8 gap-1 px-0 text-left text-ellipsis",onClick:it=>{it.preventDefault(),se(U)},children:i.jsx("div",{className:"",children:be()})})}},{id:"status",accessorKey:"status",header:()=>i.jsx(i.Fragment,{children:w("quotes.list.columns.status")}),cell:({row:{original:U}})=>i.jsx(Wd,{type:"badge",status:U.status,onChangeStatus:be=>Re(U.id,be)})},{id:"date_sent",accessor:"date_sent",header:()=>i.jsx("div",{className:"text-left text-ellipsis",children:w("quotes.list.columns.date_sent")}),cell:({row:{original:U}})=>{const be=Zn.create(U.date_sent),Je=be.isSuccess&&!be.object.isEmpty();return i.jsx("div",{className:"text-left text-ellipsis",children:Je?i.jsx(Dd,{label:be.object.toLocaleDateString("es-ES"),className:"text-green-800 bg-green-100 hover:text-green-800 hover:bg-green-100"}):i.jsx(i.Fragment,{})})}},{id:"date",accessor:"date",header:()=>i.jsx("div",{className:"text-left text-ellipsis",children:w("quotes.list.columns.date")}),cell:({row:{original:U}})=>{const be=Zn.create(U.date);return i.jsx("div",{className:"text-left text-ellipsis",children:be.isSuccess?be.object.toLocaleDateString("es-ES"):"-"})}},{id:"customer_reference",accessorKey:"customer_reference",header:()=>i.jsx(i.Fragment,{children:w("quotes.list.columns.customer_reference")}),cell:({renderValue:U})=>i.jsx("div",{className:"text-left text-ellipsis",children:U()})},{id:"customer_information",accessorKey:"customer_information",header:()=>i.jsx(i.Fragment,{children:w("quotes.list.columns.customer_information")}),cell:({row:{original:U}})=>i.jsx("div",{className:"text-left text-ellipsis",children:U.customer_information.split(` -`).map((be,Je)=>i.jsxs("span",{className:Je===0?"font-medium":"hidden text-sm text-muted-foreground md:inline",children:[be,i.jsx("br",{})]},Je))}),size:500}],Me=[{id:"row-actions",header:()=>null,cell:({row:{original:U}})=>{const be=(U==null?void 0:U.status)==="accepted"&&!(U!=null&&U.date_sent),Je=(U==null?void 0:U.status)==="accepted"&&!!(U!=null&&U.date_sent),it=(U==null?void 0:U.status)==="archived";return i.jsxs("div",{className:"flex gap-1",children:[i.jsxs(tr,{className:"gap-0",children:[i.jsxs(He,{children:[i.jsx(Ke,{asChild:!0,children:i.jsxs(G,{variant:"ghost",size:"icon",disabled:Je,onClick:_n=>{_n.preventDefault(),se(U)},children:[i.jsx(hd,{className:"w-4 h-4"}),i.jsx("span",{className:"sr-only",children:"Editar"})]})}),i.jsx(We,{children:i.jsx("p",{children:"Editar"})})]}),i.jsxs(He,{children:[i.jsx(Ke,{asChild:!0,children:i.jsxs(G,{variant:"ghost",size:"icon",onClick:_n=>{_n.preventDefault(),ce(U.id)},children:[i.jsx(jo,{className:"w-4 h-4"}),i.jsx("span",{className:"sr-only",children:"Duplicar"})]})}),i.jsx(We,{children:i.jsx("p",{children:"Duplicar"})})]}),i.jsxs(He,{children:[i.jsx(Ke,{asChild:!0,children:i.jsxs(G,{variant:"ghost",size:"icon",onClick:()=>{k(U.id,j(U))},children:[i.jsx(fd,{className:"w-4 h-4"}),i.jsx("span",{className:"sr-only",children:"Descargar"})]})}),i.jsx(We,{children:i.jsx("p",{children:"Descargar"})})]}),i.jsxs(He,{children:[i.jsx(Ke,{asChild:!0,children:i.jsxs(G,{variant:"ghost",size:"icon",disabled:it||Je,onClick:_n=>{_n.preventDefault(),Y(U.id)},children:[i.jsx(cd,{className:"w-4 h-4"}),i.jsx("span",{className:"sr-only",children:"Archivar"})]})}),i.jsx(We,{children:i.jsx("p",{children:"Archivar"})})]})]}),i.jsx(tr,{children:i.jsx(Kd,{id:U.id,onSentTo:()=>null,disabled:Je||!be})})]})}}];return a?je:[...je,...Me]},[a]),{table:ee}=os({data:(q==null?void 0:q.items)??[],columns:rt,pageCount:(q==null?void 0:q.total_pages)??-1});return M.useEffect(()=>{ee&&q&&(q==null?void 0:q.total_pages)>0&&v(ee.getRowModel().rows[0])},[q,ee]),Q?i.jsx(ur,{subtitle:O.message}):$?i.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:[i.jsx(Le,{className:"grid items-start gap-4 auto-rows-max md:gap-8 lg:col-span-2",children:i.jsx(Oe,{children:i.jsx(ss,{columnCount:6,searchableColumnCount:1,filterableColumnCount:2,shrinkZero:!0})})}),i.jsx("div",{})]}):(q==null?void 0:q.total_items)===0&&!p?i.jsx(Le,{children:i.jsx(Oe,{children:i.jsx(as,{subtitle:"Empieza creando alguna cotización",buttonText:w("quotes.create.title"),onButtonClick:()=>r("add",{relative:"path"})})})}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex flex-col items-stretch flex-1 gap-4 xl:flex-row",children:[i.jsx("div",{id:l,className:"flex items-stretch flex-1",children:i.jsx(is,{table:ee,paginationOptions:{visible:!0},className:"grid items-start flex-1 gap-4 auto-rows-max md:gap-8 lg:col-span-2",onRowClick:W,activeRowIndex:x==null?void 0:x.index,children:i.jsx(Bd,{table:ee})})}),a&&i.jsx("div",{id:c,className:"flex items-stretch ",children:i.jsx(Xw,{quoteId:x==null?void 0:x.original.id})})]}),i.jsx(Gd,{...H,onFinishDownload:B})]})},pS=()=>{const n=zt(),a=Tw(),{toast:r}=vn(),[o,l]=M.useState(Ma.createDefaultCode().object),[c,d]=M.useState(Pr.createDefaultCode().object),h=M.useMemo(()=>({date:"",reference:"",customer_reference:"",customer_information:"",lang_code:"",currency_code:"",payment_method:"",notes:"",validity:"",show_line_discount_column:!0,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_price:{amount:void 0,scale:2,currency_code:""},total_price:{amount:void 0,scale:2,currency_code:""},items:[{id_article:"",description:"",quantity:{amount:null,scale:2},unit_price:{amount:null,scale:2,currency_code:o.code},subtotal_price:{amount:null,scale:2,currency_code:o.code},discount:{amount:null,scale:2},total_price:{amount:null,scale:2,currency_code:o.code}}]}),[o.code]),{useOne:p,useUpdate:x}=Ur(),{data:v,status:R,error:y}=p(a),{mutate:b,isPending:E}=x(String(a)),j=Ji({mode:"onBlur",defaultValues:h}),{getValues:D,reset:F,handleSubmit:q,formState:$,control:Q,watch:O,setValue:k}=j,{isSubmitting:H,isDirty:W}=$;Mo({isDirty:W}),M.useEffect(()=>{if(!W)return;const{unsubscribe:ce}=O((Y,{name:Re,type:rt})=>{if(Re==="items"){Y.items&&Y.items.map((je,Me)=>{if(je){const U=eo(je);Fe.isEqual(U.subtotal_price.toObject(),je.subtotal_price)||k(`items.${Me}.subtotal_price`,U.subtotal_price.toObject()),Fe.isEqual(U.total_price.toObject(),je.total_price)||k(`items.${Me}.total_price`,U.total_price.toObject())}});const ee=Va(Y,!0);Fe.isEqual(ee.subtotal_price.toObject(),Y.total_price)||k("subtotal_price",ee.subtotal_price.toObject()),Fe.isEqual(ee.discount_price.toObject(),Y.total_price)||k("discount_price",ee.discount_price.toObject()),Fe.isEqual(ee.before_tax_price.toObject(),Y.before_tax_price)||k("before_tax_price",ee.before_tax_price.toObject()),Fe.isEqual(ee.tax_price.toObject(),Y.tax_price)||k("tax_price",ee.tax_price.toObject()),Fe.isEqual(ee.total_price.toObject(),Y.total_price)||k("total_price",ee.total_price.toObject())}else if(Re&&rt==="change"){if(Re==="currency_code"){const ee=Ma.createFromCode(Y.currency_code??Ma.DEFAULT_CURRENCY_CODE);if(ee.isFailure)throw console.error(ee.error),ee.error;l(ee.object)}if(Re==="lang_code"){const ee=Pr.createFromCode(Y.lang_code??Pr.DEFAULT_LANGUAGE_CODE);if(ee.isFailure)throw console.error(ee.error),ee.error;d(ee.object)}if(["discount","tax"].includes(Re)){const ee=Va(Y,!0);Fe.isEqual(ee.subtotal_price.toObject(),Y.total_price)||k("subtotal_price",ee.subtotal_price.toObject()),Fe.isEqual(ee.discount_price.toObject(),Y.total_price)||k("discount_price",ee.discount_price.toObject()),Fe.isEqual(ee.before_tax_price.toObject(),Y.before_tax_price)||k("before_tax_price",ee.before_tax_price.toObject()),Fe.isEqual(ee.tax_price.toObject(),Y.tax_price)||k("tax_price",ee.tax_price.toObject()),Fe.isEqual(ee.total_price.toObject(),Y.total_price)||k("total_price",ee.total_price.toObject())}if(Re!=null&&Re.startsWith("items")){const ee=Number(Re.split(".")[1]),je=Re.split(".")[2];if(["quantity","unit_price","discount"].includes(je)&&Y.items&&Y.items[ee]){const Me=Y.items[ee],U=eo(Me);Fe.isEqual(U.quantity.toObject(),Me.quantity)||k(`items.${ee}.quantity`,U.quantity.toObject()),Fe.isEqual(U.unit_price.toObject(),Me.unit_price)||k(`items.${ee}.unit_price`,U.unit_price.toObject()),Fe.isEqual(U.discount.toObject(),Me.discount)||k(`items.${ee}.discount`,U.discount.toObject()),Fe.isEqual(U.subtotal_price.toObject(),Me.subtotal_price)||k(`items.${ee}.subtotal_price`,U.subtotal_price.toObject()),Fe.isEqual(U.total_price.toObject(),Me.total_price)||k(`items.${ee}.total_price`,U.total_price.toObject());const be=Va(Y,!0);Fe.isEqual(be.subtotal_price.toObject(),Y.total_price)||k("subtotal_price",be.subtotal_price.toObject()),Fe.isEqual(be.discount_price.toObject(),Y.total_price)||k("discount_price",be.discount_price.toObject()),Fe.isEqual(be.before_tax_price.toObject(),Y.before_tax_price)||k("before_tax_price",be.before_tax_price.toObject()),Fe.isEqual(be.tax_price.toObject(),Y.tax_price)||k("tax_price",be.tax_price.toObject()),Fe.isEqual(be.total_price.toObject(),Y.total_price)||k("total_price",be.total_price.toObject())}}}});return()=>ce()},[O,W,k]);const B=async(ce,Y)=>{b(ce,{onError:Re=>{console.error(Re),r({title:"Error",description:Re.message,variant:"destructive"})},onSuccess:()=>{F(D()),r({title:"Cotización guardada",variant:"success"}),Y&&n("/quotes")}})},se=M.useCallback(()=>{n("/quotes",{state:{id:a}})},[n,a]);return M.useEffect(()=>{R==="success"&&v&&F(v)},[R,v,F]),R==="error"?i.jsx(ur,{errorMessage:y.message}):R!=="success"?i.jsx(Dn,{}):i.jsxs(i.Fragment,{children:[(H||E)&&i.jsx(Dn,{title:"Guardando cotización"}),i.jsx(es,{...j,children:i.jsx("form",{onSubmit:q(ce=>B(ce,!1)),children:i.jsxs("div",{className:"mx-auto grid max-w-[90rem] flex-1 auto-rows-max gap-6",children:[i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsx(Vc,{}),i.jsxs("h1",{className:"flex-1 text-xl font-semibold tracking-tight shrink-0 whitespace-nowrap sm:grow-0",children:[w("quotes.edit.title")," ",v.reference]}),i.jsx(Dd,{label:w(`quotes.status.${v.status}`),className:"ml-auto sm:ml-0"}),i.jsxs("div",{className:"items-center hidden gap-2 md:ml-auto md:flex",children:[i.jsx(L0,{label:w("common.close"),variant:"secondary",size:"sm",onClick:se}),i.jsx(wo,{label:w("common.save"),size:"sm",disabled:$.isSubmitting||$.isLoading||$.isValidating}),i.jsx(G,{size:"sm",disabled:$.isSubmitting||$.isLoading||$.isValidating,onClick:q(ce=>B(ce,!0)),children:w("common.save_close")})]})]}),i.jsx(Ww,{}),i.jsx(Ow,{currency:o}),i.jsx(Kw,{currency:o,language:c,defaultValues:h}),i.jsxs("div",{className:"flex items-center justify-center gap-2 md:hidden",children:[i.jsx(G,{variant:"outline",size:"sm",children:w("common.discard")}),i.jsx(G,{onClick:q(ce=>B(ce,!1)),size:"sm",children:w("quotes.edit.buttons.save_quote")})]})]})})}),!1]})},Jw=M.createContext(null),eS=({children:n})=>{const[a,r]=zc();return i.jsx(Jw.Provider,{value:{pagination:a,setPagination:r},children:n})},xS=({children:n})=>i.jsx(ts,{children:i.jsx(eS,{children:i.jsxs(zr,{className:"quotes-layout",children:[i.jsx(Br,{}),i.jsx(Vr,{children:n})]})})}),vS=()=>{const n=zt(),[a,r]=M.useState("all"),[o,l]=pw(!0),c=[{value:"all",label:w("quotes.list.tabs.all")},{value:"draft",label:w("quotes.list.tabs.draft")},{value:"ready",label:w("quotes.list.tabs.ready")},{value:"delivered",label:w("quotes.list.tabs.delivered")},{value:"accepted",label:w("quotes.list.tabs.accepted")},{value:"rejected",label:w("quotes.list.tabs.rejected")},{value:"archived",label:w("quotes.list.tabs.archived")}];return i.jsxs(nr,{children:[i.jsxs("div",{className:"flex items-center justify-between space-y-2",children:[i.jsxs("div",{children:[i.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:i.jsx(le,{i18nKey:"quotes.list.title"})}),i.jsx("p",{className:"text-muted-foreground",children:i.jsx(le,{i18nKey:"quotes.list.subtitle"})})]}),i.jsx("div",{className:"flex items-center space-x-2",children:i.jsxs(G,{onClick:()=>n("/quotes/add"),children:[i.jsx(yo,{className:"w-4 h-4 mr-2"}),w("quotes.create.title")]})})]}),i.jsxs(ld,{value:a,onValueChange:r,children:[i.jsxs("div",{className:"flex flex-col items-start justify-between mb-4 sm:flex-row sm:items-center",children:[i.jsxs("div",{className:"w-full mb-4 sm:w-auto sm:mb-0",children:[i.jsx(ud,{className:"hidden sm:flex",children:c.map(d=>i.jsx(Ka,{value:d.value,children:d.label},d.value))}),i.jsxs("div",{className:"flex items-center w-full space-x-2 sm:hidden",children:[i.jsx(cr,{children:w("quotes.list.tabs_title")}),i.jsxs(so,{value:a,onValueChange:r,children:[i.jsx(ao,{children:i.jsx(oo,{placeholder:"Seleccionar estado"})}),i.jsx(lo,{children:c.map(d=>i.jsx(Or,{value:d.value,children:d.label},d.value))})]})]})]}),i.jsx("div",{className:"flex items-baseline justify-center mr-4 font-medium",children:i.jsx(sw,{buttonText:"Ayuda",title:"Ayuda sobre el Estado de Cotizaciones",content:tS})}),i.jsx("div",{className:"flex items-center gap-2 ml-auto",children:i.jsx(O0,{"aria-label":"Show quote preview",variant:"outline",defaultPressed:!1,pressed:o,onPressedChange:l,children:o?i.jsxs(i.Fragment,{children:[i.jsx(gd,{className:"w-4 h-4 mr-2"}),w("common.disable_preview")]}):i.jsxs(i.Fragment,{children:[i.jsx(H0,{className:"w-4 h-4 mr-2"}),w("common.enable_preview")]})})})]}),c.map(d=>i.jsx(Wa,{value:d.value,children:i.jsx(Zw,{status:d.value,preview:o})},d.value))]})]})},tS=i.jsxs(no,{className:"grid gap-4 py-4",children:[i.jsx("p",{children:"El estado de una cotización indica su posición actual en el proceso de negocio."}),i.jsx("p",{children:"Los estados posibles son:"}),i.jsxs("ul",{className:"pl-6 space-y-2 list-disc",children:[i.jsxs("li",{children:[i.jsx("strong",{children:"Borrador:"})," La cotización está en proceso de creación o edición."]}),i.jsxs("li",{children:[i.jsx("strong",{children:"Preparado:"})," La cotización está lista para ser enviada al cliente."]}),i.jsxs("li",{children:[i.jsx("strong",{children:"Entregado:"})," La cotización ha sido enviada al cliente."]}),i.jsxs("li",{children:[i.jsx("strong",{children:"Aceptado:"})," El cliente ha aprobado la cotización."]}),i.jsxs("li",{children:[i.jsx("strong",{children:"Rechazado:"})," El cliente no ha aceptado la cotización."]}),i.jsxs("li",{children:[i.jsx("strong",{children:"Arcivado:"})," La cotización ha sido guardada para referencia futura y ya no está activa."]})]}),i.jsxs("p",{children:["Utiliza estos estados para hacer un seguimiento eficiente de tus cotizaciones y optimizar tu proceso de ventas. El estado ",i.jsx("strong",{children:"Archivado"})," es útil para mantener un historial de cotizaciones pasadas sin que interfieran con las cotizaciones activas."]})]}),nS=n=>{const a=$r(),r=Mn();return{useOne:()=>bd({queryKey:r().data().resource("settings").action("one").id("me").params().get(),queryFn:()=>a.getOne({resource:"profile",id:""}),...n}),useUpdate:()=>{const o=Jt();return en({mutationKey:r().data().resource("settings").action("one").id("me").params().get(),mutationFn:l=>a.updateOne({resource:"profile",data:l,id:""}),onSuccess:()=>{o.invalidateQueries({queryKey:["data","default","settings"]})}})},useUploadLogo:()=>{const o=Jt(),{mutate:l,mutateAsync:c,...d}=en({mutationKey:["data","default","settings"],mutationFn:h=>a.uploadFile({path:"profile/logo",file:h,key:"logo"}),onError:()=>o.invalidateQueries({queryKey:["data","default","settings"]}),onSuccess:()=>{o.invalidateQueries({queryKey:["data","default","settings"]})}});return{upload:l,uploadAsync:c,...d}}}},_S=()=>{var O,k;const[n,a]=M.useState("profile"),{useOne:r,useUpdate:o,useUploadLogo:l}=nS(),{toast:c}=vn(),{data:d,status:h,error:p}=r(),x=M.useMemo(()=>({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}}),[]),{mutate:v}=o(),{upload:R}=l(),y=Ji({mode:"onBlur",values:d==null?void 0:d.dealer,defaultValues:x}),{formState:b,reset:E,getValues:j,handleSubmit:D}=y,{isSubmitting:F,isDirty:q}=b,$=H=>{var B;const W=(B=H.target.files)==null?void 0:B[0];if(W){if(W.type!=="image/png"&&W.type!=="image/jpeg"){alert(w("settings.form_fields.logo.invalid_format"));return}const se=new FileReader;se.onloadend=()=>{const ce=new Image;ce.onload=()=>{const Y=ce.width,Re=ce.height,rt=Y/Re===2;Y<200||Re<100||!rt?alert(w("settings.form_fields.logo.invalid_dimensions")):R(W)},ce.src=se.result},se.readAsDataURL(W)}};Mo({isDirty:q});const Q=async H=>{v(H,{onError:W=>{console.debug(W),c({title:"Error",description:W.message,variant:"destructive"})},onSuccess:()=>{E(j()),c({description:"Ajustes guardados",variant:"success"})}})};return F?i.jsx(Dn,{title:"Guardando ajustes"}):h==="error"?i.jsx(ur,{errorMessage:p.message}):h!=="success"?i.jsx(Dn,{}):i.jsx(es,{...y,children:i.jsx("form",{onSubmit:D(Q),children:i.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:[((O=y.formState.errors.root)==null?void 0:O.message)&&i.jsxs(kc,{variant:"destructive",children:[i.jsx(dd,{className:"w-4 h-4"}),i.jsx(qc,{children:i.jsx(le,{i18nKey:"common.error"})}),i.jsx($c,{children:(k=y.formState.errors.root)==null?void 0:k.message})]}),i.jsxs("nav",{className:"grid gap-4 text-sm text-muted-foreground",children:[i.jsx("a",{onClick:()=>a("profile"),className:n==="profile"?"font-semibold text-primary":"cursor-pointer",children:i.jsx(le,{i18nKey:"settings.edit.tabs.profile"})}),i.jsx("a",{onClick:()=>a("quotes"),className:n==="quotes"?"font-semibold text-primary":"cursor-pointer ",children:i.jsx(le,{i18nKey:"settings.edit.tabs.quotes"})}),i.jsx("a",{onClick:()=>a("legal"),className:n==="legal"?"font-semibold text-primary":"cursor-pointer ",children:i.jsx(le,{i18nKey:"settings.edit.tabs.legal"})})]}),i.jsxs("div",{className:he("grid gap-6",n==="profile"?"visible":"hidden"),children:[i.jsxs(Le,{children:[i.jsxs(pt,{children:[i.jsx(Ge,{children:i.jsx(le,{i18nKey:"settings.form_fields.contact_information.label"})}),i.jsx(Ze,{children:i.jsx(le,{i18nKey:"settings.form_fields.contact_information.desc"})})]}),i.jsx(Oe,{children:i.jsx(qt,{rows:8,placeholder:w("settings.form_fields.contact_information.placeholder"),name:"contact_information",required:!0})}),i.jsx(Dt,{className:"px-6 py-4 border-t",children:i.jsx(G,{children:i.jsx(le,{i18nKey:"common.save"})})})]}),i.jsxs(Le,{children:[i.jsxs(pt,{children:[i.jsx(Ge,{children:i.jsx(le,{i18nKey:"settings.form_fields.logo.label"})}),i.jsx(Ze,{children:i.jsx(le,{i18nKey:"settings.form_fields.logo.desc"})})]}),i.jsx(Oe,{children:i.jsxs("div",{className:"flex items-center space-x-4",children:[i.jsx("div",{className:"w-[400px] h-[200px] border border-gray-300 flex items-center justify-center overflow-hidden",children:i.jsx("img",{src:d.dealer.logo?d.dealer.logo:"https://via.placeholder.com/200x100",width:400,height:200,style:{objectFit:"contain"}})}),i.jsx("div",{children:i.jsx("p",{className:"mt-2 text-sm text-gray-500",children:i.jsx(le,{i18nKey:"settings.form_fields.logo.requirements"})})})]})}),i.jsxs(Dt,{className:"px-6 py-4 border-t",children:[i.jsx(cr,{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:i.jsx(le,{i18nKey:"settings.form_fields.logo.upload"})}),i.jsx(Zi,{id:"logo-upload",type:"file",accept:".png,.jpg,.jpeg",onChange:$,className:"hidden"})]})]})]}),i.jsxs("div",{className:he("grid gap-6",n==="quotes"?"visible":"hidden"),children:[i.jsxs(Le,{children:[i.jsxs(pt,{children:[i.jsx(Ge,{children:i.jsx(le,{i18nKey:"settings.form_fields.default_show_line_discount_column.label"})}),i.jsx(Ze,{children:i.jsx(le,{i18nKey:"settings.form_fields.default_show_line_discount_column.desc"})})]}),i.jsx(Oe,{children:i.jsx(P0,{control:y.control,name:"default_show_line_discount_column",render:({field:H})=>i.jsx(So,{checked:H.value??!0,onCheckedChange:H.onChange})})}),i.jsx(Dt,{className:"px-6 py-4 border-t",children:i.jsx(G,{children:i.jsx(le,{i18nKey:"common.save"})})})]}),i.jsxs(Le,{children:[i.jsxs(pt,{children:[i.jsx(Ge,{children:i.jsx(le,{i18nKey:"settings.form_fields.default_tax.label"})}),i.jsx(Ze,{children:i.jsx(le,{i18nKey:"settings.form_fields.default_tax.desc"})})]}),i.jsx(Oe,{children:i.jsx(Hi,{scale:2,disabled:b.disabled,placeholder:w("settings.form_fields.default_tax.desc"),name:"default_tax",required:!0})}),i.jsx(Dt,{className:"px-6 py-4 border-t",children:i.jsx(G,{children:i.jsx(le,{i18nKey:"common.save"})})})]}),i.jsxs(Le,{children:[i.jsxs(pt,{children:[i.jsx(Ge,{children:i.jsx(le,{i18nKey:"settings.form_fields.default_payment_method.label"})}),i.jsx(Ze,{children:i.jsx(le,{i18nKey:"settings.form_fields.default_payment_method.desc"})})]}),i.jsx(Oe,{children:i.jsx(qt,{autoSize:!0,placeholder:w("settings.form_fields.default_payment_method.placeholder"),name:"default_payment_method",required:!0,errors:y.formState.errors})}),i.jsx(Dt,{className:"px-6 py-4 border-t",children:i.jsx(G,{children:i.jsx(le,{i18nKey:"common.save"})})})]}),i.jsxs(Le,{children:[i.jsxs(pt,{children:[i.jsx(Ge,{children:i.jsx(le,{i18nKey:"settings.form_fields.default_quote_validity.label"})}),i.jsx(Ze,{children:i.jsx(le,{i18nKey:"settings.form_fields.default_quote_validity.desc"})})]}),i.jsx(Oe,{children:i.jsx(qt,{autoSize:!0,placeholder:w("settings.form_fields.default_quote_validity.placeholder"),name:"default_quote_validity",required:!0})}),i.jsx(Dt,{className:"px-6 py-4 border-t",children:i.jsx(G,{children:i.jsx(le,{i18nKey:"common.save"})})})]}),i.jsxs(Le,{children:[i.jsxs(pt,{children:[i.jsx(Ge,{children:i.jsx(le,{i18nKey:"settings.form_fields.default_notes.label"})}),i.jsx(Ze,{children:i.jsx(le,{i18nKey:"settings.form_fields.default_notes.desc"})})]}),i.jsx(Oe,{children:i.jsx(qt,{autoSize:!0,placeholder:w("settings.form_fields.default_notes.placeholder"),name:"default_notes"})}),i.jsx(Dt,{className:"px-6 py-4 border-t",children:i.jsx(G,{children:i.jsx(le,{i18nKey:"common.save"})})})]})]}),i.jsx("div",{className:he("grid gap-6",n==="legal"?"visible":"hidden"),children:i.jsxs(Le,{className:"h-",children:[i.jsxs(pt,{children:[i.jsx(Ge,{children:i.jsx(le,{i18nKey:"settings.form_fields.default_legal_terms.label"})}),i.jsx(Ze,{children:i.jsx(le,{i18nKey:"settings.form_fields.default_legal_terms.desc"})})]}),i.jsx(Oe,{children:i.jsx(qt,{rows:25,placeholder:w("settings.form_fields.default_legal_terms.placeholder"),name:"default_legal_terms"})}),i.jsx(Dt,{className:"px-6 py-4 border-t",children:i.jsx(G,{children:i.jsx(le,{i18nKey:"common.save"})})})]})})]})})})},rS=M.createContext(null),iS=({children:n})=>i.jsx(rS.Provider,{value:{},children:n}),bS=({children:n})=>i.jsx(ts,{children:i.jsx(iS,{children:i.jsxs(zr,{className:"settings-layout",children:[i.jsx(Br,{}),i.jsxs(Vr,{children:[i.jsx("div",{className:"grid w-full max-w-6xl gap-2 mx-auto",children:i.jsx("h1",{className:"text-2xl font-semibold md:text-3xl",children:i.jsx(le,{i18nKey:"settings.edit.title"})})}),n]})]})})});export{uS as CatalogLayout,cS as CatalogList,dS as DashboardPage,fS as DealerLayout,gS as DealersList,mS as ErrorPage,oS as LoginPageWithLanguageSelector,lS as LogoutPage,hS as QuoteCreate,pS as QuoteEdit,xS as QuotesLayout,vS as QuotesList,_S as SettingsEditor,bS as SettingsLayout}; +`,"
")}})})]})},l.id))})})},Gw=({isOpen:n,onOpenChange:a,onSelect:r})=>Pd("(min-width: 768px)")?i.jsx(rr,{modal:!0,open:n,onOpenChange:a,children:i.jsxs(ir,{className:"w-full max-w-full md:w-9/12 lg:w-10/12",children:[i.jsxs(sr,{children:[i.jsx(ar,{children:w("quotes.blocks_picker_dialog.title")}),i.jsx(ns,{children:w("quotes.blocks_picker_dialog.description")})]}),i.jsx(Ac,{onSelect:r}),i.jsx(or,{children:i.jsx(U,{type:"submit",onClick:()=>a(!1),children:w("common.close")})})]})}):i.jsx(td,{open:n,onOpenChange:a,children:i.jsxs(nd,{children:[i.jsxs(rd,{className:"text-left",children:[i.jsx(id,{children:w("quotes.blocks_picker_dialog.title")}),i.jsx(sd,{children:w("quotes.blocks_picker_dialog.description")})]}),i.jsx(Ac,{onSelect:r}),i.jsx(ad,{className:"pt-2",children:i.jsx(od,{asChild:!0,children:i.jsx(U,{variant:"outline",children:w("common.close")})})})]})}),Hw=({isOpen:n,onOpenChange:a,onSelect:r})=>Pd("(min-width: 768px)")?i.jsx(rr,{modal:!0,open:n,onOpenChange:a,children:i.jsxs(ir,{className:"w-full max-w-full md:w-9/12 lg:w-10/12",children:[i.jsxs(sr,{children:[i.jsx(ar,{children:w("quotes.catalog_picker_dialog.title")}),i.jsx(ns,{children:w("quotes.catalog_picker_dialog.description")})]}),i.jsx(nr,{syncWithLocation:!1,initialPageSize:5,children:i.jsx(to,{onSelect:r})}),i.jsx(or,{children:i.jsx(U,{type:"submit",onClick:()=>a(!1),children:w("common.close")})})]})}):i.jsx(td,{open:n,onOpenChange:a,children:i.jsxs(nd,{children:[i.jsxs(rd,{className:"text-left",children:[i.jsx(id,{children:w("quotes.catalog_picker_dialog.title")}),i.jsx(sd,{children:w("quotes.catalog_picker_dialog.description")})]}),i.jsx(nr,{syncWithLocation:!1,initialPageSize:5,children:i.jsx(to,{onSelect:r})}),i.jsx(ad,{className:"pt-2",children:i.jsx(od,{asChild:!0,children:i.jsx(U,{variant:"outline",children:w("common.close")})})})]})}),Kw=({currency:n,language:a,defaultValues:r})=>{var W;const{toast:o}=_n(),{control:l,getValues:c,setValue:d,watch:h}=lr(),p=h("show_line_discount_column")??!0,x=!!((W=c("items"))!=null&&W.some(B=>{var ae;return Number((ae=B.discount)==null?void 0:ae.amount)>0})),[v]=M.useState("dialog"),[R,y]=M.useState(!1),[b,E]=M.useState(!1),{fields:j,...D}=I0({control:l,name:"items"}),F=Iw([{id:"description",accessorKey:"description",header:w("quotes.form_fields.items.description.label"),cell:({row:{index:B,original:ae}})=>i.jsx(qt,{readOnly:ae==null?void 0:ae.id_article,autoSize:!0,name:`items.${B}.description`}),minSize:200,size:400},{id:"quantity",accessorKey:"quantity",header:()=>i.jsx("div",{className:"text-right",children:w("quotes.form_fields.items.quantity.label")}),cell:({row:{index:B}})=>i.jsx(fw,{scale:0,className:"text-right",name:`items.${B}.quantity`}),size:75},{id:"unit_price",accessorKey:"unit_price",header:()=>i.jsx("div",{className:"text-right",children:w("quotes.form_fields.items.unit_price.label")}),cell:({row:{index:B}})=>i.jsx(Fa,{currency:n,language:a,scale:2,className:"text-right",name:`items.${B}.unit_price`}),size:125},{id:"subtotal_price",accessorKey:"subtotal_price",header:()=>i.jsx("div",{className:"text-right",children:w("quotes.form_fields.items.subtotal_price.label")}),cell:({row:{index:B}})=>i.jsx(Fa,{variant:"ghost",currency:n,language:a,scale:2,readOnly:!0,className:"text-right",name:`items.${B}.subtotal_price`}),size:150},{id:"discount",accessorKey:"discount",header:()=>i.jsx("div",{className:"text-right",children:w("quotes.form_fields.items.discount.label")}),cell:({row:{index:B}})=>i.jsx(Hi,{scale:2,className:"text-right",name:`items.${B}.discount`}),size:100},{id:"total_price",accessorKey:"total_price",header:()=>i.jsx("div",{className:"text-right",children:w("quotes.form_fields.items.total_price.label")}),cell:({row:{index:B}})=>i.jsx(Fa,{variant:"ghost",currency:n,language:a,scale:2,readOnly:!0,className:"font-semibold text-right",name:`items.${B}.total_price`}),size:150}],{enableDragHandleColumn:!0,enableSelectionColumn:!0}),q=M.useCallback((B,ae=1)=>{D.append({...B,quantity:{amount:100*ae,scale:xn.DEFAULT_SCALE},unit_price:B.retail_price,discount:{amount:null,scale:2}}),o({title:w("quotes.catalog_picker_dialog.toast_article_added"),description:B.description})},[D]),$=M.useCallback(B=>{D.append({description:`${B.title} +${B.body}`,quantity:{amount:null,scale:xn.DEFAULT_SCALE},unit_price:{amount:null,scale:ab.DEFAULT_SCALE},discount:{amount:null,scale:2}}),o({title:w("quotes.blocks_picker_dialog.toast_article_added"),description:B.title})},[D]),[Q,O]=M.useState(!1),k=[265,440,655],H=4;return v==="dialog"?i.jsxs("div",{className:"relative",children:[i.jsx(Ec,{actions:{...D,getItem:B=>c(`items.${B}`),pickCatalogArticle:()=>y(!0),pickBlock:()=>E(!0)},columns:F,data:j,defaultValues:r,showLineDiscountColumn:p,hasLineDiscounts:x,onShowLineDiscountColumnChange:B=>d("show_line_discount_column",B,{shouldDirty:!0})}),i.jsx(Hw,{onSelect:q,isOpen:R,onOpenChange:y}),i.jsx(Gw,{onSelect:$,isOpen:b,onOpenChange:E})]}):i.jsxs(Z0,{direction:"horizontal",autoSaveId:"uecko.quotes.details_layout",className:"items-stretch h-full",children:[i.jsx(wc,{defaultSize:k[0],collapsedSize:H,collapsible:!0,minSize:50,maxSize:90,onCollapse:()=>{O(!0)},onExpand:()=>{O(!1)},className:he(Q&&"min-w-[50px] transition-all duration-300 ease-in-out"),children:i.jsx(Ec,{actions:{...D,getItem:B=>c(`items.${B}`)},columns:F,data:j,defaultValues:r,showLineDiscountColumn:p,hasLineDiscounts:x,onShowLineDiscountColumnChange:B=>d("show_line_discount_column",B,{shouldDirty:!0})})}),i.jsx(J0,{withHandle:!0,className:"mx-3"}),i.jsx(wc,{defaultSize:k[1],minSize:10,children:i.jsx(nr,{syncWithLocation:!1,children:i.jsx(to,{onSelect:q})})})]})},Ww=()=>{const{formState:n}=lr();return i.jsxs("div",{className:"grid gap-6 md:grid-cols-6",children:[i.jsxs(Ha,{className:"md:col-span-6",title:w("quotes.create.form_groups.general.title"),description:w("quotes.create.form_groups.general.desc"),children:[i.jsxs("div",{className:"grid grid-cols-6 gap-6",children:[i.jsx(mn,{required:!0,className:"col-span-2",label:w("quotes.form_fields.customer_reference.label"),description:w("quotes.form_fields.customer_reference.desc"),disabled:n.disabled,placeholder:w("quotes.form_fields.customer_reference.placeholder"),name:"customer_reference"}),i.jsx(Uc,{required:!0,label:w("quotes.form_fields.date.label"),description:w("quotes.form_fields.date.desc"),disabled:n.disabled,placeholder:w("quotes.form_fields.date.placeholder"),name:"date"}),i.jsx(mn,{label:w("quotes.form_fields.validity.label"),description:w("quotes.form_fields.validity.desc"),disabled:n.disabled,placeholder:w("quotes.form_fields.validity.placeholder"),name:"validity"}),i.jsx(qt,{className:"col-span-2",label:w("quotes.form_fields.payment_method.label"),description:w("quotes.form_fields.payment_method.desc"),disabled:n.disabled,placeholder:w("quotes.form_fields.payment_method.placeholder"),name:"payment_method"})]}),i.jsxs("div",{className:"grid grid-cols-6 gap-6",children:[i.jsx(qt,{className:"col-span-3",required:!0,label:w("quotes.form_fields.customer_information.label"),description:w("quotes.form_fields.customer_information.desc"),disabled:n.disabled,placeholder:w("quotes.form_fields.customer_information.placeholder"),name:"customer_information",errors:n.errors}),i.jsx(qt,{className:"col-span-3",label:w("quotes.form_fields.notes.label"),description:w("quotes.form_fields.notes.desc"),disabled:n.disabled,placeholder:w("quotes.form_fields.notes.placeholder"),name:"notes"})]})]}),i.jsx(Ha,{className:"hidden md:col-span-2",title:w("quotes.create.form_groups.status.title"),description:w("quotes.create.form_groups.status.desc"),children:i.jsxs("div",{className:"grid gap-6",children:[i.jsxs("div",{className:"grid gap-3",children:[i.jsx(cr,{htmlFor:"status",children:"Status"}),i.jsxs(so,{children:[i.jsx(ao,{id:"status","aria-label":"Select status",children:i.jsx(oo,{placeholder:"Select status"})}),i.jsxs(lo,{children:[i.jsx(Or,{value:"draft",children:"Draft"}),i.jsx(Or,{value:"published",children:"Active"}),i.jsx(Or,{value:"archived",children:"Archived"})]})]})]}),i.jsx(mn,{required:!0,label:w("quotes.form_fields.lang_code.label"),description:w("quotes.form_fields.lang_code.desc"),placeholder:w("quotes.form_fields.lang_code.placeholder"),name:"lang_code"}),i.jsx(mn,{required:!0,label:w("quotes.form_fields.currency_code.label"),description:w("quotes.form_fields.currency_code.desc"),placeholder:w("quotes.form_fields.currency_code.placeholder"),name:"currency_code"})]})})]})},Kd=({id:n,onSentTo:a,disabled:r})=>{const o=()=>{a(n)};return i.jsxs(Hc,{children:[i.jsx(Kc,{asChild:!0,disabled:r,children:i.jsxs(U,{variant:"ghost",className:"h-10 gap-1 text-primary disabled:text-secondary-foreground",children:[i.jsx(Q0,{className:"w-4 h-4"}),w("quotes.quote_sent_to_editor.trigger_button")]})}),i.jsxs(Wc,{children:[i.jsxs(Yc,{children:[i.jsx(Qc,{children:w("quotes.quote_sent_to_editor.title")}),i.jsx(Xc,{children:w("quotes.quote_sent_to_editor.description")})]}),i.jsxs(Zc,{children:[i.jsx(Jc,{children:w("common.cancel")}),i.jsx(ed,{asChild:!0,children:i.jsx(U,{onClick:o,children:w("common.continue")})})]})]})]})},Yw=["draft","ready","delivered","accepted","rejected","archived"],Qw={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"]},Wd=({type:n="button",status:a,onChangeStatus:r})=>{const[o,l]=M.useState(a),c=h=>l(h);M.useEffect(()=>{a&&l(a)},[a]);const d=()=>{o!==a&&r(o,a)};return i.jsxs(rr,{children:[i.jsx(Dc,{asChild:!0,children:n==="button"?i.jsxs(U,{size:"sm",variant:"outline",className:"h-8 gap-1",children:[i.jsx(F0,{className:"h-3.5 w-3.5"}),i.jsx("span",{className:"sr-only md:not-sr-only md:whitespace-nowrap",children:w("quotes.quote_status_editor.trigger_button")})]}):i.jsx(M0,{status:a,isEditable:!0})}),i.jsxs(ir,{children:[i.jsx(sr,{children:i.jsx(ar,{children:w("quotes.quote_status_editor.title")})}),i.jsx(D0,{}),i.jsx("div",{className:"grid gap-4 py-4",children:Yw.map(h=>{const p=!Qw[a].includes(h);return i.jsxs("div",{className:"flex items-start space-x-4",children:[i.jsx(So,{id:h,checked:o===h,onCheckedChange:()=>c(h),disabled:p}),i.jsxs("div",{className:"grid gap-1.5 leading-none",children:[i.jsx(cr,{htmlFor:h,className:he("font-medium",p?"text-input":"text-foreground"),children:w(`quotes.quote_status_editor.status.${h}.title`)}),i.jsx("p",{className:he("text-sm",p?"text-input":"text-muted-foreground"),children:w(`quotes.quote_status_editor.status.${h}.description`)})]})]},h)})}),i.jsxs(or,{className:"pt-6 border-t",children:[i.jsx(Vi,{asChild:!0,children:i.jsx(U,{type:"button",variant:"secondary",children:w("common.cancel")})}),i.jsx(Vi,{asChild:!0,children:i.jsx(U,{onClick:d,disabled:o===a,children:w("quotes.quote_status_editor.submit_button")})})]})]})]})},Xw=({quoteId:n,className:a})=>{const r=zt(),{toast:o}=_n(),{useOne:l,useSetStatus:c,useSentTo:d,useDownloader:h,useDuplicate:p,getQuotePDFFilename:x}=Ur(),{data:v,status:R}=l(n),{mutate:y}=c(),{mutate:b}=d(n),{mutate:E}=p(),{download:j,...D}=h(),{formatCurrency:F,formatNumber:q}=Od({locale:(v==null?void 0:v.lang_code)||"ES"}),$=M.useMemo(()=>v?{subtotal_price:F(v.subtotal_price),discount:q(v.discount),discount_price:F(v.discount_price),tax:q(v.tax),tax_price:F(v.tax_price),total_price:F(v.total_price)}:{subtotal_price:"0,00 €",discount:"0",discount_price:"0,00 €",tax:"0",tax_price:"0,00 €",total_price:"0,00 €"},[v]),Q=M.useMemo(()=>(v==null?void 0:v.status)==="accepted"&&!(v!=null&&v.date_sent),[v]),O=M.useMemo(()=>(v==null?void 0:v.status)==="accepted"&&!!(v!=null&&v.date_sent),[v]),k=Y=>{y({id:v.id,newStatus:Y},{onSuccess:()=>{o({description:w("quotes.quote_status_editor.toast_status_changed"),variant:"success"})}})},H=Y=>{b({sent_date:T0(new Date)},{onSuccess:()=>{o({description:w("quotes.quote_sent_to_editor.toast_status_changed"),variant:"success"})}})},W=M.useCallback(()=>{o({description:w("quotes.downloading_dialog.toast_success"),variant:"success"})},[o]),B=M.useCallback(()=>{v&&j(v.id,x(v))},[v]);if(R==="error"||R!=="success")return null;if(!v)return i.jsx(Le,{className:he("overflow-hidden",a),children:i.jsx(Oe,{className:"px-4 py-6 text-center",children:i.jsx("p",{className:"mx-auto",children:"Select a quote"})})});const ae=Y=>{E({id:Y},{onSuccess(Re){o({description:w("quotes.duplicate_action.toast_success"),variant:"success"}),r(`/quotes/edit/${Re.id}`,{relative:"path"})}})},ce=Y=>{y({id:Y,newStatus:"archived"},{onSuccess:()=>{o({description:w("quotes.quote_status_editor.toast_status_changed",{newStatus:w("quotes.status.archived")}),variant:"success"})}})};return i.jsxs(i.Fragment,{children:[i.jsx(Gd,{...D,onFinishDownload:W}),i.jsx(ld,{defaultValue:"resume",children:i.jsxs(Le,{className:"w-[390px] overflow-hidden",children:[i.jsxs(ct,{className:"gap-3 border-b bg-accent",children:[i.jsxs(Be,{className:"flex items-center justify-between text-lg",children:[i.jsx("span",{children:w("quotes.list.resume.title")}),i.jsx(Wd,{status:v.status,onChangeStatus:k,type:"badge"})]}),i.jsx("div",{className:"flex w-full mr-auto text-foreground",children:i.jsxs("div",{className:"flex justify-between w-full",children:[i.jsxs(tr,{className:"gap-0",children:[i.jsxs(Ke,{children:[i.jsx(We,{asChild:!0,children:i.jsxs(U,{variant:"outline",size:"icon",disabled:O,onClick:Y=>{Y.preventDefault(),r(`/quotes/edit/${v.id}`,{relative:"path"})},children:[i.jsx(hd,{className:"w-4 h-4"}),i.jsx("span",{className:"sr-only",children:"Editar"})]})}),i.jsx(Ye,{children:i.jsx("p",{children:"Editar"})})]}),i.jsxs(Ke,{children:[i.jsx(We,{asChild:!0,children:i.jsxs(U,{variant:"outline",size:"icon",onClick:Y=>{Y.preventDefault(),ae(v.id)},children:[i.jsx(jo,{className:"w-4 h-4"}),i.jsx("span",{className:"sr-only",children:"Duplicar"})]})}),i.jsx(Ye,{children:i.jsx("p",{children:"Duplicar"})})]}),i.jsxs(Ke,{children:[i.jsx(We,{asChild:!0,children:i.jsxs(U,{variant:"outline",size:"icon",onClick:B,children:[i.jsx(fd,{className:"w-4 h-4"}),i.jsx("span",{className:"sr-only",children:"Descargar"})]})}),i.jsx(Ye,{children:i.jsx("p",{children:"Descargar"})})]}),i.jsxs(Ke,{children:[i.jsx(We,{asChild:!0,children:i.jsxs(U,{variant:"outline",size:"icon",disabled:O,onClick:Y=>{Y.preventDefault(),ce(v.id)},children:[i.jsx(cd,{className:"w-4 h-4"}),i.jsx("span",{className:"sr-only",children:"Archivar"})]})}),i.jsx(Ye,{children:i.jsx("p",{children:"Archivar"})})]})]}),i.jsx(tr,{children:i.jsx(Kd,{disabled:O||!Q,id:v.id,onSentTo:H})})]})})]}),i.jsxs(Oe,{className:"p-6 text-sm",children:[i.jsxs(ud,{className:"grid w-full grid-cols-2",children:[i.jsx(Ka,{value:"resume",children:w("quotes.list.resume.tabs.resume")}),i.jsx(Ka,{value:"preview",children:w("quotes.list.resume.tabs.preview")})]}),i.jsx(Wa,{value:"resume",className:"pt-4",children:i.jsxs("div",{className:"grid gap-3",children:[i.jsxs("div",{className:"grid gap-3",children:[i.jsx("div",{className:"font-semibold",children:w("quotes.list.resume.quote_information")}),i.jsxs("dl",{className:"grid gap-3",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("dt",{className:"text-muted-foreground",children:w("quotes.form_fields.reference.label")}),i.jsx("dd",{className:"font-medium",children:v.reference})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("dt",{className:"text-muted-foreground",children:w("quotes.form_fields.date.label")}),i.jsx("dd",{className:"font-medium",children:new Date(v.date).toLocaleDateString()})]}),i.jsxs("div",{className:"flex items-start justify-between",children:[i.jsx("dt",{className:"text-muted-foreground whitespace-nowrap",children:w("quotes.form_fields.customer_reference.label")}),i.jsx("dd",{className:"font-medium text-right whitespace-break-spaces",children:v.customer_reference})]})]})]}),i.jsx(hn,{className:"my-4"}),i.jsxs("div",{className:"grid gap-3",children:[i.jsx("div",{className:"font-semibold",children:w("quotes.list.resume.customer_information")}),i.jsx("div",{children:v.customer_information})]}),i.jsx(hn,{className:"my-4"}),i.jsx("div",{className:"font-semibold",children:w("quotes.list.resume.price_information")}),i.jsxs("ul",{className:"grid gap-3",children:[i.jsxs("li",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:w("quotes.form_fields.subtotal_price.label")}),i.jsx("span",{children:$.subtotal_price})]}),i.jsxs("li",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:w("quotes.form_fields.discount_value.label",{value:$.discount})}),i.jsx("span",{children:$.discount_price})]}),i.jsxs("li",{className:"flex items-center justify-between",children:[i.jsx("span",{className:"text-muted-foreground",children:w("quotes.form_fields.tax_value.label",{value:$.tax})}),i.jsx("span",{children:$.tax_price})]}),i.jsxs("li",{className:"flex items-center justify-between font-semibold",children:[i.jsx("span",{className:"text-muted-foreground",children:w("quotes.form_fields.total_price.label")}),i.jsx("span",{children:$.total_price})]})]})]})}),i.jsx(Wa,{value:"preview",children:i.jsx(Hd,{quote:v})})]}),i.jsx(Nt,{className:"flex flex-row items-center px-6 py-3 border-t bg-accent",children:i.jsx("div",{className:"text-xs text-muted-foreground"})})]})})]})},Zw=({status:n="all",preview:a=!1})=>{const r=zt(),{toast:o}=_n(),l=M.useId(),c=M.useId(),{pagination:d,globalFilter:h,isFiltered:p}=Tn(),[x,v]=M.useState(void 0),{useList:R,useDownloader:y,useSetStatus:b,useDuplicate:E,getQuotePDFFilename:j}=Ur(),{mutate:D}=b(),{mutate:F}=E(),{data:q,isPending:$,isError:Q,error:O}=R({pagination:{pageIndex:d.pageIndex,pageSize:d.pageSize},status:n,quickSearchTerm:h}),{download:k,...H}=y(),W=je=>{v(je)},B=M.useCallback(()=>{o({description:w("quotes.downloading_dialog.toast_success")})},[o]),ae=M.useCallback(je=>{r(`/quotes/edit/${je.id}`,{relative:"path"})},[r,o]),ce=je=>{F({id:je},{onSuccess(Me){o({description:w("quotes.duplicate_action.toast_success"),variant:"success"}),r(`/quotes/edit/${Me.id}`,{relative:"path"})}})},Y=je=>{D({id:je,newStatus:"archived"},{onSuccess:()=>{o({description:w("quotes.quote_status_editor.toast_status_changed",{newStatus:w("quotes.status.archived")}),variant:"success"})}})},Re=(je,Me)=>{D({id:je,newStatus:Me},{onSuccess:()=>{o({description:w("quotes.quote_status_editor.toast_status_changed",{newStatus:w(`quotes.status.${Me}`)}),variant:"success"})}})},rt=M.useMemo(()=>{const je=[{id:"reference",accessorKey:"reference",header:()=>i.jsx(i.Fragment,{children:w("quotes.list.columns.reference")}),cell:({row:{original:G},renderValue:be})=>{const Je=!!((G==null?void 0:G.status)==="accepted"&&(G!=null&&G.date_sent));return i.jsx(U,{size:"sm",variant:"link",disabled:Je,className:"h-8 gap-1 px-0 text-left text-ellipsis",onClick:it=>{it.preventDefault(),ae(G)},children:i.jsx("div",{className:"",children:be()})})}},{id:"status",accessorKey:"status",header:()=>i.jsx(i.Fragment,{children:w("quotes.list.columns.status")}),cell:({row:{original:G}})=>i.jsx(Wd,{type:"badge",status:G.status,onChangeStatus:be=>Re(G.id,be)})},{id:"date_sent",accessor:"date_sent",header:()=>i.jsx("div",{className:"text-left text-ellipsis",children:w("quotes.list.columns.date_sent")}),cell:({row:{original:G}})=>{const be=Zn.create(G.date_sent),Je=be.isSuccess&&!be.object.isEmpty();return i.jsx("div",{className:"text-left text-ellipsis",children:Je?i.jsx(Dd,{label:be.object.toLocaleDateString("es-ES"),className:"text-green-800 bg-green-100 hover:text-green-800 hover:bg-green-100"}):i.jsx(i.Fragment,{})})}},{id:"date",accessor:"date",header:()=>i.jsx("div",{className:"text-left text-ellipsis",children:w("quotes.list.columns.date")}),cell:({row:{original:G}})=>{const be=Zn.create(G.date);return i.jsx("div",{className:"text-left text-ellipsis",children:be.isSuccess?be.object.toLocaleDateString("es-ES"):"-"})}},{id:"customer_reference",accessorKey:"customer_reference",header:()=>i.jsx(i.Fragment,{children:w("quotes.list.columns.customer_reference")}),cell:({renderValue:G})=>i.jsx("div",{className:"text-left text-ellipsis",children:G()})},{id:"customer_information",accessorKey:"customer_information",header:()=>i.jsx(i.Fragment,{children:w("quotes.list.columns.customer_information")}),cell:({row:{original:G}})=>i.jsx("div",{className:"text-left text-ellipsis",children:G.customer_information.split(` +`).map((be,Je)=>i.jsxs("span",{className:Je===0?"font-medium":"hidden text-sm text-muted-foreground md:inline",children:[be,i.jsx("br",{})]},Je))}),size:500}],Me=[{id:"row-actions",header:()=>null,cell:({row:{original:G}})=>{const be=(G==null?void 0:G.status)==="accepted"&&!(G!=null&&G.date_sent),Je=(G==null?void 0:G.status)==="accepted"&&!!(G!=null&&G.date_sent),it=(G==null?void 0:G.status)==="archived";return i.jsxs("div",{className:"flex gap-1",children:[i.jsxs(tr,{className:"gap-0",children:[i.jsxs(Ke,{children:[i.jsx(We,{asChild:!0,children:i.jsxs(U,{variant:"ghost",size:"icon",disabled:Je,onClick:bn=>{bn.preventDefault(),ae(G)},children:[i.jsx(hd,{className:"w-4 h-4"}),i.jsx("span",{className:"sr-only",children:"Editar"})]})}),i.jsx(Ye,{children:i.jsx("p",{children:"Editar"})})]}),i.jsxs(Ke,{children:[i.jsx(We,{asChild:!0,children:i.jsxs(U,{variant:"ghost",size:"icon",onClick:bn=>{bn.preventDefault(),ce(G.id)},children:[i.jsx(jo,{className:"w-4 h-4"}),i.jsx("span",{className:"sr-only",children:"Duplicar"})]})}),i.jsx(Ye,{children:i.jsx("p",{children:"Duplicar"})})]}),i.jsxs(Ke,{children:[i.jsx(We,{asChild:!0,children:i.jsxs(U,{variant:"ghost",size:"icon",onClick:()=>{k(G.id,j(G))},children:[i.jsx(fd,{className:"w-4 h-4"}),i.jsx("span",{className:"sr-only",children:"Descargar"})]})}),i.jsx(Ye,{children:i.jsx("p",{children:"Descargar"})})]}),i.jsxs(Ke,{children:[i.jsx(We,{asChild:!0,children:i.jsxs(U,{variant:"ghost",size:"icon",disabled:it||Je,onClick:bn=>{bn.preventDefault(),Y(G.id)},children:[i.jsx(cd,{className:"w-4 h-4"}),i.jsx("span",{className:"sr-only",children:"Archivar"})]})}),i.jsx(Ye,{children:i.jsx("p",{children:"Archivar"})})]})]}),i.jsx(tr,{children:i.jsx(Kd,{id:G.id,onSentTo:()=>null,disabled:Je||!be})})]})}}];return a?je:[...je,...Me]},[a]),{table:ee}=os({data:(q==null?void 0:q.items)??[],columns:rt,pageCount:(q==null?void 0:q.total_pages)??-1});return M.useEffect(()=>{ee&&q&&(q==null?void 0:q.total_pages)>0&&v(ee.getRowModel().rows[0])},[q,ee]),Q?i.jsx(ur,{subtitle:O.message}):$?i.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:[i.jsx(Le,{className:"grid items-start gap-4 auto-rows-max md:gap-8 lg:col-span-2",children:i.jsx(Oe,{children:i.jsx(ss,{columnCount:6,searchableColumnCount:1,filterableColumnCount:2,shrinkZero:!0})})}),i.jsx("div",{})]}):(q==null?void 0:q.total_items)===0&&!p?i.jsx(Le,{children:i.jsx(Oe,{children:i.jsx(as,{subtitle:"Empieza creando alguna cotización",buttonText:w("quotes.create.title"),onButtonClick:()=>r("add",{relative:"path"})})})}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex flex-col items-stretch flex-1 gap-4 xl:flex-row",children:[i.jsx("div",{id:l,className:"flex items-stretch flex-1",children:i.jsx(is,{table:ee,paginationOptions:{visible:!0},className:"grid items-start flex-1 gap-4 auto-rows-max md:gap-8 lg:col-span-2",onRowClick:W,activeRowIndex:x==null?void 0:x.index,children:i.jsx(Bd,{table:ee})})}),a&&i.jsx("div",{id:c,className:"flex items-stretch ",children:i.jsx(Xw,{quoteId:x==null?void 0:x.original.id})})]}),i.jsx(Gd,{...H,onFinishDownload:B})]})},pS=()=>{const n=zt(),a=Tw(),{toast:r}=_n(),[o,l]=M.useState(Ma.createDefaultCode().object),[c,d]=M.useState(Pr.createDefaultCode().object),h=M.useMemo(()=>({date:"",reference:"",customer_reference:"",customer_information:"",lang_code:"",currency_code:"",payment_method:"",notes:"",validity:"",show_line_discount_column:!0,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_price:{amount:void 0,scale:2,currency_code:""},total_price:{amount:void 0,scale:2,currency_code:""},items:[{id_article:"",description:"",quantity:{amount:null,scale:2},unit_price:{amount:null,scale:2,currency_code:o.code},subtotal_price:{amount:null,scale:2,currency_code:o.code},discount:{amount:null,scale:2},total_price:{amount:null,scale:2,currency_code:o.code}}]}),[o.code]),{useOne:p,useUpdate:x}=Ur(),{data:v,status:R,error:y}=p(a),{mutate:b,isPending:E}=x(String(a)),j=Ji({mode:"onBlur",defaultValues:h}),{getValues:D,reset:F,handleSubmit:q,formState:$,control:Q,watch:O,setValue:k}=j,{isSubmitting:H,isDirty:W}=$;Mo({isDirty:W}),M.useEffect(()=>{if(!W)return;const{unsubscribe:ce}=O((Y,{name:Re,type:rt})=>{if(Re==="items"){Y.items&&Y.items.map((je,Me)=>{if(je){const G=eo(je);Fe.isEqual(G.subtotal_price.toObject(),je.subtotal_price)||k(`items.${Me}.subtotal_price`,G.subtotal_price.toObject()),Fe.isEqual(G.total_price.toObject(),je.total_price)||k(`items.${Me}.total_price`,G.total_price.toObject())}});const ee=Va(Y,!0);Fe.isEqual(ee.subtotal_price.toObject(),Y.total_price)||k("subtotal_price",ee.subtotal_price.toObject()),Fe.isEqual(ee.discount_price.toObject(),Y.total_price)||k("discount_price",ee.discount_price.toObject()),Fe.isEqual(ee.before_tax_price.toObject(),Y.before_tax_price)||k("before_tax_price",ee.before_tax_price.toObject()),Fe.isEqual(ee.tax_price.toObject(),Y.tax_price)||k("tax_price",ee.tax_price.toObject()),Fe.isEqual(ee.total_price.toObject(),Y.total_price)||k("total_price",ee.total_price.toObject())}else if(Re&&rt==="change"){if(Re==="currency_code"){const ee=Ma.createFromCode(Y.currency_code??Ma.DEFAULT_CURRENCY_CODE);if(ee.isFailure)throw console.error(ee.error),ee.error;l(ee.object)}if(Re==="lang_code"){const ee=Pr.createFromCode(Y.lang_code??Pr.DEFAULT_LANGUAGE_CODE);if(ee.isFailure)throw console.error(ee.error),ee.error;d(ee.object)}if(["discount","tax"].includes(Re)){const ee=Va(Y,!0);Fe.isEqual(ee.subtotal_price.toObject(),Y.total_price)||k("subtotal_price",ee.subtotal_price.toObject()),Fe.isEqual(ee.discount_price.toObject(),Y.total_price)||k("discount_price",ee.discount_price.toObject()),Fe.isEqual(ee.before_tax_price.toObject(),Y.before_tax_price)||k("before_tax_price",ee.before_tax_price.toObject()),Fe.isEqual(ee.tax_price.toObject(),Y.tax_price)||k("tax_price",ee.tax_price.toObject()),Fe.isEqual(ee.total_price.toObject(),Y.total_price)||k("total_price",ee.total_price.toObject())}if(Re!=null&&Re.startsWith("items")){const ee=Number(Re.split(".")[1]),je=Re.split(".")[2];if(["quantity","unit_price","discount"].includes(je)&&Y.items&&Y.items[ee]){const Me=Y.items[ee],G=eo(Me);Fe.isEqual(G.quantity.toObject(),Me.quantity)||k(`items.${ee}.quantity`,G.quantity.toObject()),Fe.isEqual(G.unit_price.toObject(),Me.unit_price)||k(`items.${ee}.unit_price`,G.unit_price.toObject()),Fe.isEqual(G.discount.toObject(),Me.discount)||k(`items.${ee}.discount`,G.discount.toObject()),Fe.isEqual(G.subtotal_price.toObject(),Me.subtotal_price)||k(`items.${ee}.subtotal_price`,G.subtotal_price.toObject()),Fe.isEqual(G.total_price.toObject(),Me.total_price)||k(`items.${ee}.total_price`,G.total_price.toObject());const be=Va(Y,!0);Fe.isEqual(be.subtotal_price.toObject(),Y.total_price)||k("subtotal_price",be.subtotal_price.toObject()),Fe.isEqual(be.discount_price.toObject(),Y.total_price)||k("discount_price",be.discount_price.toObject()),Fe.isEqual(be.before_tax_price.toObject(),Y.before_tax_price)||k("before_tax_price",be.before_tax_price.toObject()),Fe.isEqual(be.tax_price.toObject(),Y.tax_price)||k("tax_price",be.tax_price.toObject()),Fe.isEqual(be.total_price.toObject(),Y.total_price)||k("total_price",be.total_price.toObject())}}}});return()=>ce()},[O,W,k]);const B=async(ce,Y)=>{b(ce,{onError:Re=>{console.error(Re),r({title:"Error",description:Re.message,variant:"destructive"})},onSuccess:()=>{F(D()),r({title:"Cotización guardada",variant:"success"}),Y&&n("/quotes")}})},ae=M.useCallback(()=>{n("/quotes",{state:{id:a}})},[n,a]);return M.useEffect(()=>{R==="success"&&v&&F(v)},[R,v,F]),R==="error"?i.jsx(ur,{errorMessage:y.message}):R!=="success"?i.jsx(Dn,{}):i.jsxs(i.Fragment,{children:[(H||E)&&i.jsx(Dn,{title:"Guardando cotización"}),i.jsx(es,{...j,children:i.jsx("form",{onSubmit:q(ce=>B(ce,!1)),children:i.jsxs("div",{className:"mx-auto grid max-w-[90rem] flex-1 auto-rows-max gap-6",children:[i.jsxs("div",{className:"flex items-center gap-4",children:[i.jsx(Vc,{}),i.jsxs("h1",{className:"flex-1 text-xl font-semibold tracking-tight shrink-0 whitespace-nowrap sm:grow-0",children:[w("quotes.edit.title")," ",v.reference]}),i.jsx(Dd,{label:w(`quotes.status.${v.status}`),className:"ml-auto sm:ml-0"}),i.jsxs("div",{className:"items-center hidden gap-2 md:ml-auto md:flex",children:[i.jsx(L0,{label:w("common.close"),variant:"secondary",size:"sm",onClick:ae}),i.jsx(wo,{label:w("common.save"),size:"sm",disabled:$.isSubmitting||$.isLoading||$.isValidating}),i.jsx(U,{size:"sm",disabled:$.isSubmitting||$.isLoading||$.isValidating,onClick:q(ce=>B(ce,!0)),children:w("common.save_close")})]})]}),i.jsx(Ww,{}),i.jsx(Ow,{currency:o}),i.jsx(Kw,{currency:o,language:c,defaultValues:h}),i.jsxs("div",{className:"flex items-center justify-center gap-2 md:hidden",children:[i.jsx(U,{variant:"outline",size:"sm",children:w("common.discard")}),i.jsx(U,{onClick:q(ce=>B(ce,!1)),size:"sm",children:w("quotes.edit.buttons.save_quote")})]})]})})}),!1]})},Jw=M.createContext(null),eS=({children:n})=>{const[a,r]=zc();return i.jsx(Jw.Provider,{value:{pagination:a,setPagination:r},children:n})},xS=({children:n})=>i.jsx(ts,{children:i.jsx(eS,{children:i.jsxs(zr,{className:"quotes-layout",children:[i.jsx(Br,{}),i.jsx(Vr,{children:n})]})})}),vS=()=>{const n=zt(),[a,r]=M.useState("all"),[o,l]=pw(!0),c=[{value:"all",label:w("quotes.list.tabs.all")},{value:"draft",label:w("quotes.list.tabs.draft")},{value:"ready",label:w("quotes.list.tabs.ready")},{value:"delivered",label:w("quotes.list.tabs.delivered")},{value:"accepted",label:w("quotes.list.tabs.accepted")},{value:"rejected",label:w("quotes.list.tabs.rejected")},{value:"archived",label:w("quotes.list.tabs.archived")}];return i.jsxs(nr,{children:[i.jsxs("div",{className:"flex items-center justify-between space-y-2",children:[i.jsxs("div",{children:[i.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:i.jsx(se,{i18nKey:"quotes.list.title"})}),i.jsx("p",{className:"text-muted-foreground",children:i.jsx(se,{i18nKey:"quotes.list.subtitle"})})]}),i.jsx("div",{className:"flex items-center space-x-2",children:i.jsxs(U,{onClick:()=>n("/quotes/add"),children:[i.jsx(yo,{className:"w-4 h-4 mr-2"}),w("quotes.create.title")]})})]}),i.jsxs(ld,{value:a,onValueChange:r,children:[i.jsxs("div",{className:"flex flex-col items-start justify-between mb-4 sm:flex-row sm:items-center",children:[i.jsxs("div",{className:"w-full mb-4 sm:w-auto sm:mb-0",children:[i.jsx(ud,{className:"hidden sm:flex",children:c.map(d=>i.jsx(Ka,{value:d.value,children:d.label},d.value))}),i.jsxs("div",{className:"flex items-center w-full space-x-2 sm:hidden",children:[i.jsx(cr,{children:w("quotes.list.tabs_title")}),i.jsxs(so,{value:a,onValueChange:r,children:[i.jsx(ao,{children:i.jsx(oo,{placeholder:"Seleccionar estado"})}),i.jsx(lo,{children:c.map(d=>i.jsx(Or,{value:d.value,children:d.label},d.value))})]})]})]}),i.jsx("div",{className:"flex items-baseline justify-center mr-4 font-medium",children:i.jsx(sw,{buttonText:"Ayuda",title:"Ayuda sobre el Estado de Cotizaciones",content:tS})}),i.jsx("div",{className:"flex items-center gap-2 ml-auto",children:i.jsx(O0,{"aria-label":"Show quote preview",variant:"outline",defaultPressed:!1,pressed:o,onPressedChange:l,children:o?i.jsxs(i.Fragment,{children:[i.jsx(gd,{className:"w-4 h-4 mr-2"}),w("common.disable_preview")]}):i.jsxs(i.Fragment,{children:[i.jsx(H0,{className:"w-4 h-4 mr-2"}),w("common.enable_preview")]})})})]}),c.map(d=>i.jsx(Wa,{value:d.value,children:i.jsx(Zw,{status:d.value,preview:o})},d.value))]})]})},tS=i.jsxs(no,{className:"grid gap-4 py-4",children:[i.jsx("p",{children:"El estado de una cotización indica su posición actual en el proceso de negocio."}),i.jsx("p",{children:"Los estados posibles son:"}),i.jsxs("ul",{className:"pl-6 space-y-2 list-disc",children:[i.jsxs("li",{children:[i.jsx("strong",{children:"Borrador:"})," La cotización está en proceso de creación o edición."]}),i.jsxs("li",{children:[i.jsx("strong",{children:"Preparado:"})," La cotización está lista para ser enviada al cliente."]}),i.jsxs("li",{children:[i.jsx("strong",{children:"Entregado:"})," La cotización ha sido enviada al cliente."]}),i.jsxs("li",{children:[i.jsx("strong",{children:"Aceptado:"})," El cliente ha aprobado la cotización."]}),i.jsxs("li",{children:[i.jsx("strong",{children:"Rechazado:"})," El cliente no ha aceptado la cotización."]}),i.jsxs("li",{children:[i.jsx("strong",{children:"Arcivado:"})," La cotización ha sido guardada para referencia futura y ya no está activa."]})]}),i.jsxs("p",{children:["Utiliza estos estados para hacer un seguimiento eficiente de tus cotizaciones y optimizar tu proceso de ventas. El estado ",i.jsx("strong",{children:"Archivado"})," es útil para mantener un historial de cotizaciones pasadas sin que interfieran con las cotizaciones activas."]})]}),nS=n=>{const a=$r(),r=Mn();return{useOne:()=>bd({queryKey:r().data().resource("settings").action("one").id("me").params().get(),queryFn:()=>a.getOne({resource:"profile",id:""}),...n}),useUpdate:()=>{const o=Jt();return en({mutationKey:r().data().resource("settings").action("one").id("me").params().get(),mutationFn:l=>a.updateOne({resource:"profile",data:l,id:""}),onSuccess:()=>{o.invalidateQueries({queryKey:["data","default","settings"]})}})},useUploadLogo:()=>{const o=Jt(),{mutate:l,mutateAsync:c,...d}=en({mutationKey:["data","default","settings"],mutationFn:h=>a.uploadFile({path:"profile/logo",file:h,key:"logo"}),onError:()=>o.invalidateQueries({queryKey:["data","default","settings"]}),onSuccess:()=>{o.invalidateQueries({queryKey:["data","default","settings"]})}});return{upload:l,uploadAsync:c,...d}}}},_S=()=>{var O,k;const[n,a]=M.useState("profile"),{useOne:r,useUpdate:o,useUploadLogo:l}=nS(),{toast:c}=_n(),{data:d,status:h,error:p}=r(),x=M.useMemo(()=>({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:"% IVA"}),[]),{mutate:v}=o(),{upload:R}=l(),y=Ji({mode:"onBlur",values:d==null?void 0:d.dealer,defaultValues:x}),{formState:b,reset:E,getValues:j,handleSubmit:D}=y,{isSubmitting:F,isDirty:q}=b,$=H=>{var B;const W=(B=H.target.files)==null?void 0:B[0];if(W){if(W.type!=="image/png"&&W.type!=="image/jpeg"){alert(w("settings.form_fields.logo.invalid_format"));return}const ae=new FileReader;ae.onloadend=()=>{const ce=new Image;ce.onload=()=>{const Y=ce.width,Re=ce.height,rt=Y/Re===2;Y<200||Re<100||!rt?alert(w("settings.form_fields.logo.invalid_dimensions")):R(W)},ce.src=ae.result},ae.readAsDataURL(W)}};Mo({isDirty:q});const Q=async H=>{v(H,{onError:W=>{console.debug(W),c({title:"Error",description:W.message,variant:"destructive"})},onSuccess:()=>{E(j()),c({description:"Ajustes guardados",variant:"success"})}})};return F?i.jsx(Dn,{title:"Guardando ajustes"}):h==="error"?i.jsx(ur,{errorMessage:p.message}):h!=="success"?i.jsx(Dn,{}):i.jsx(es,{...y,children:i.jsx("form",{onSubmit:D(Q),children:i.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:[((O=y.formState.errors.root)==null?void 0:O.message)&&i.jsxs(kc,{variant:"destructive",children:[i.jsx(dd,{className:"w-4 h-4"}),i.jsx(qc,{children:i.jsx(se,{i18nKey:"common.error"})}),i.jsx($c,{children:(k=y.formState.errors.root)==null?void 0:k.message})]}),i.jsxs("nav",{className:"grid gap-4 text-sm text-muted-foreground",children:[i.jsx("a",{onClick:()=>a("profile"),className:n==="profile"?"font-semibold text-primary":"cursor-pointer",children:i.jsx(se,{i18nKey:"settings.edit.tabs.profile"})}),i.jsx("a",{onClick:()=>a("quotes"),className:n==="quotes"?"font-semibold text-primary":"cursor-pointer ",children:i.jsx(se,{i18nKey:"settings.edit.tabs.quotes"})}),i.jsx("a",{onClick:()=>a("legal"),className:n==="legal"?"font-semibold text-primary":"cursor-pointer ",children:i.jsx(se,{i18nKey:"settings.edit.tabs.legal"})})]}),i.jsxs("div",{className:he("grid gap-6",n==="profile"?"visible":"hidden"),children:[i.jsxs(Le,{children:[i.jsxs(ct,{children:[i.jsx(Be,{children:i.jsx(se,{i18nKey:"settings.form_fields.default_tax_label.label"})}),i.jsx(He,{children:i.jsx(se,{i18nKey:"settings.form_fields.default_tax_label.desc"})})]}),i.jsx(Oe,{children:i.jsx(mn,{maxLength:32,placeholder:w("settings.form_fields.default_tax_label.placeholder"),name:"default_tax_label",required:!0})}),i.jsx(Nt,{className:"px-6 py-4 border-t",children:i.jsx(U,{children:i.jsx(se,{i18nKey:"common.save"})})})]}),i.jsxs(Le,{children:[i.jsxs(ct,{children:[i.jsx(Be,{children:i.jsx(se,{i18nKey:"settings.form_fields.contact_information.label"})}),i.jsx(He,{children:i.jsx(se,{i18nKey:"settings.form_fields.contact_information.desc"})})]}),i.jsx(Oe,{children:i.jsx(qt,{rows:8,placeholder:w("settings.form_fields.contact_information.placeholder"),name:"contact_information",required:!0})}),i.jsx(Nt,{className:"px-6 py-4 border-t",children:i.jsx(U,{children:i.jsx(se,{i18nKey:"common.save"})})})]}),i.jsxs(Le,{children:[i.jsxs(ct,{children:[i.jsx(Be,{children:i.jsx(se,{i18nKey:"settings.form_fields.logo.label"})}),i.jsx(He,{children:i.jsx(se,{i18nKey:"settings.form_fields.logo.desc"})})]}),i.jsx(Oe,{children:i.jsxs("div",{className:"flex items-center space-x-4",children:[i.jsx("div",{className:"w-[400px] h-[200px] border border-gray-300 flex items-center justify-center overflow-hidden",children:i.jsx("img",{src:d.dealer.logo?d.dealer.logo:"https://via.placeholder.com/200x100",width:400,height:200,style:{objectFit:"contain"}})}),i.jsx("div",{children:i.jsx("p",{className:"mt-2 text-sm text-gray-500",children:i.jsx(se,{i18nKey:"settings.form_fields.logo.requirements"})})})]})}),i.jsxs(Nt,{className:"px-6 py-4 border-t",children:[i.jsx(cr,{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:i.jsx(se,{i18nKey:"settings.form_fields.logo.upload"})}),i.jsx(Zi,{id:"logo-upload",type:"file",accept:".png,.jpg,.jpeg",onChange:$,className:"hidden"})]})]})]}),i.jsxs("div",{className:he("grid gap-6",n==="quotes"?"visible":"hidden"),children:[i.jsxs(Le,{children:[i.jsxs(ct,{children:[i.jsx(Be,{children:i.jsx(se,{i18nKey:"settings.form_fields.default_show_line_discount_column.label"})}),i.jsx(He,{children:i.jsx(se,{i18nKey:"settings.form_fields.default_show_line_discount_column.desc"})})]}),i.jsx(Oe,{children:i.jsx(P0,{control:y.control,name:"default_show_line_discount_column",render:({field:H})=>i.jsx(So,{checked:H.value??!0,onCheckedChange:H.onChange})})}),i.jsx(Nt,{className:"px-6 py-4 border-t",children:i.jsx(U,{children:i.jsx(se,{i18nKey:"common.save"})})})]}),i.jsxs(Le,{children:[i.jsxs(ct,{children:[i.jsx(Be,{children:i.jsx(se,{i18nKey:"settings.form_fields.default_tax.label"})}),i.jsx(He,{children:i.jsx(se,{i18nKey:"settings.form_fields.default_tax.desc"})})]}),i.jsx(Oe,{children:i.jsx(Hi,{scale:2,disabled:b.disabled,placeholder:w("settings.form_fields.default_tax.desc"),name:"default_tax",required:!0})}),i.jsx(Nt,{className:"px-6 py-4 border-t",children:i.jsx(U,{children:i.jsx(se,{i18nKey:"common.save"})})})]}),i.jsxs(Le,{children:[i.jsxs(ct,{children:[i.jsx(Be,{children:i.jsx(se,{i18nKey:"settings.form_fields.default_payment_method.label"})}),i.jsx(He,{children:i.jsx(se,{i18nKey:"settings.form_fields.default_payment_method.desc"})})]}),i.jsx(Oe,{children:i.jsx(qt,{autoSize:!0,placeholder:w("settings.form_fields.default_payment_method.placeholder"),name:"default_payment_method",required:!0,errors:y.formState.errors})}),i.jsx(Nt,{className:"px-6 py-4 border-t",children:i.jsx(U,{children:i.jsx(se,{i18nKey:"common.save"})})})]}),i.jsxs(Le,{children:[i.jsxs(ct,{children:[i.jsx(Be,{children:i.jsx(se,{i18nKey:"settings.form_fields.default_quote_validity.label"})}),i.jsx(He,{children:i.jsx(se,{i18nKey:"settings.form_fields.default_quote_validity.desc"})})]}),i.jsx(Oe,{children:i.jsx(qt,{autoSize:!0,placeholder:w("settings.form_fields.default_quote_validity.placeholder"),name:"default_quote_validity",required:!0})}),i.jsx(Nt,{className:"px-6 py-4 border-t",children:i.jsx(U,{children:i.jsx(se,{i18nKey:"common.save"})})})]}),i.jsxs(Le,{children:[i.jsxs(ct,{children:[i.jsx(Be,{children:i.jsx(se,{i18nKey:"settings.form_fields.default_notes.label"})}),i.jsx(He,{children:i.jsx(se,{i18nKey:"settings.form_fields.default_notes.desc"})})]}),i.jsx(Oe,{children:i.jsx(qt,{autoSize:!0,placeholder:w("settings.form_fields.default_notes.placeholder"),name:"default_notes"})}),i.jsx(Nt,{className:"px-6 py-4 border-t",children:i.jsx(U,{children:i.jsx(se,{i18nKey:"common.save"})})})]})]}),i.jsx("div",{className:he("grid gap-6",n==="legal"?"visible":"hidden"),children:i.jsxs(Le,{className:"h-",children:[i.jsxs(ct,{children:[i.jsx(Be,{children:i.jsx(se,{i18nKey:"settings.form_fields.default_legal_terms.label"})}),i.jsx(He,{children:i.jsx(se,{i18nKey:"settings.form_fields.default_legal_terms.desc"})})]}),i.jsx(Oe,{children:i.jsx(qt,{rows:25,placeholder:w("settings.form_fields.default_legal_terms.placeholder"),name:"default_legal_terms"})}),i.jsx(Nt,{className:"px-6 py-4 border-t",children:i.jsx(U,{children:i.jsx(se,{i18nKey:"common.save"})})})]})})]})})})},rS=M.createContext(null),iS=({children:n})=>i.jsx(rS.Provider,{value:{},children:n}),bS=({children:n})=>i.jsx(ts,{children:i.jsx(iS,{children:i.jsxs(zr,{className:"settings-layout",children:[i.jsx(Br,{}),i.jsxs(Vr,{children:[i.jsx("div",{className:"grid w-full max-w-6xl gap-2 mx-auto",children:i.jsx("h1",{className:"text-2xl font-semibold md:text-3xl",children:i.jsx(se,{i18nKey:"settings.edit.title"})})}),n]})]})})});export{uS as CatalogLayout,cS as CatalogList,dS as DashboardPage,fS as DealerLayout,gS as DealersList,mS as ErrorPage,oS as LoginPageWithLanguageSelector,lS as LogoutPage,hS as QuoteCreate,pS as QuoteEdit,xS as QuotesLayout,vS as QuotesList,_S as SettingsEditor,bS as SettingsLayout}; diff --git a/dist/client/assets/index-D_mpiX-a.js b/dist/client/assets/index-DzeF1POa.js similarity index 99% rename from dist/client/assets/index-D_mpiX-a.js rename to dist/client/assets/index-DzeF1POa.js index 3d9e845..bb2392b 100644 --- a/dist/client/assets/index-D_mpiX-a.js +++ b/dist/client/assets/index-DzeF1POa.js @@ -1,4 +1,4 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DP3f1470.js","assets/index-DtTssDoC.css"])))=>i.map(i=>d[i]); +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-Dq5tsIog.js","assets/index-DtTssDoC.css"])))=>i.map(i=>d[i]); var vle=Object.defineProperty;var Sj=t=>{throw TypeError(t)};var yle=(t,e,n)=>e in t?vle(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var He=(t,e,n)=>yle(t,typeof e!="symbol"?e+"":e,n),_P=(t,e,n)=>e.has(t)||Sj("Cannot "+n);var C=(t,e,n)=>(_P(t,e,"read from private field"),n?n.call(t):e.get(t)),z=(t,e,n)=>e.has(t)?Sj("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),$=(t,e,n,r)=>(_P(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),B=(t,e,n)=>(_P(t,e,"access private method"),n);var vs=(t,e,n,r)=>({set _(s){$(t,e,s,n)},get _(){return C(t,e,r)}});function l5(t,e){for(var n=0;nr[s]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var yr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Dd(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function ble(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var n=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(r){var s=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,s.get?s:{enumerable:!0,get:function(){return t[r]}})}),n}var c5={exports:{}},g1={},u5={exports:{}},Mt={};/** * @license React * react.production.min.js @@ -309,7 +309,7 @@ function print() { __p += __j.call(arguments, '') } `)){const o=document.createElement("div");o.append(a?document.createTextNode(a):document.createElement("br")),r.append(o)}const i=Nn._internalPadding*this.parentScale;return n.updateEdited({rect:this.getRect(i,i),popupContent:C(this,Hi)}),r}resetAnnotationElement(n){super.resetAnnotationElement(n),n.resetEdited()}};yw=new WeakMap,bw=new WeakMap,ww=new WeakMap,_w=new WeakMap,xw=new WeakMap,aa=new WeakMap,Hi=new WeakMap,Sw=new WeakMap,Vi=new WeakMap,Mg=new WeakMap,Ar=new WeakSet,OJ=function(n){const r=i=>{this.editorDiv.style.fontSize=`calc(${i}px * var(--scale-factor))`,this.translate(0,-(i-C(this,Vi))*this.parentScale),$(this,Vi,i),B(this,Ar,cE).call(this)},s=C(this,Vi);this.addCommands({cmd:r.bind(this,n),undo:r.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:ht.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})},MJ=function(n){const r=i=>{$(this,aa,this.editorDiv.style.color=i)},s=C(this,aa);this.addCommands({cmd:r.bind(this,n),undo:r.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:ht.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})},LJ=function(){var r;const n=[];this.editorDiv.normalize();for(const s of this.editorDiv.childNodes)n.push(B(r=Nn,Ic,uE).call(r,s));return n.join(` `)},cE=function(){const[n,r]=this.parentDimensions;let s;if(this.isAttachedToDOM)s=this.div.getBoundingClientRect();else{const{currentLayer:i,div:a}=this,o=a.style.display,c=a.classList.contains("hidden");a.classList.remove("hidden"),a.style.display="hidden",i.div.append(this.div),s=a.getBoundingClientRect(),a.remove(),a.style.display=o,a.classList.toggle("hidden",c)}this.rotation%180===this.parentRotation%180?(this.width=s.width/n,this.height=s.height/r):(this.width=s.height/n,this.height=s.width/r),this.fixAndSetPosition()},Ic=new WeakSet,uE=function(n){return(n.nodeType===Node.TEXT_NODE?n.nodeValue:n.innerText).replaceAll(CS,"")},dE=function(){if(this.editorDiv.replaceChildren(),!!C(this,Hi))for(const n of C(this,Hi).split(` `)){const r=document.createElement("div");r.append(n?document.createTextNode(n):document.createElement("br")),this.editorDiv.append(r)}},IJ=function(){return C(this,Hi).replaceAll(" "," ")},EO=function(n){return n.replaceAll(" "," ")},$J=function(n){const{value:r,fontSize:s,color:i,pageIndex:a}=C(this,Mg);return this._hasBeenMoved||n.value!==r||n.fontSize!==s||n.color.some((o,c)=>o!==i[c])||n.pageIndex!==a},z(Nn,Ic),He(Nn,"_freeTextDefaultContent",""),He(Nn,"_internalPadding",0),He(Nn,"_defaultColor",null),He(Nn,"_defaultFontSize",10),He(Nn,"_type","freetext"),He(Nn,"_editorType",Vt.FREETEXT);let SO=Nn;var Ew,Ju,la,Xs,FJ,fE,jJ,zJ,AO;class CO{constructor(e,n=0,r=0,s=!0){z(this,Xs);z(this,Ew);z(this,Ju,[]);z(this,la,[]);let i=1/0,a=-1/0,o=1/0,c=-1/0;const u=10**-4;for(const{x:y,y:g,width:v,height:w}of e){const x=Math.floor((y-n)/u)*u,A=Math.ceil((y+v+n)/u)*u,k=Math.floor((g-n)/u)*u,R=Math.ceil((g+w+n)/u)*u,E=[x,k,R,!0],T=[A,k,R,!1];C(this,Ju).push(E,T),i=Math.min(i,x),a=Math.max(a,A),o=Math.min(o,k),c=Math.max(c,R)}const f=a-i+2*r,l=c-o+2*r,d=i-r,m=o-r,p=C(this,Ju).at(s?-1:-2),h=[p[0],p[2]];for(const y of C(this,Ju)){const[g,v,w]=y;y[0]=(g-d)/f,y[1]=(v-m)/l,y[2]=(w-m)/l}$(this,Ew,{x:d,y:m,width:f,height:l,lastPoint:h})}getOutlines(){C(this,Ju).sort((n,r)=>n[0]-r[0]||n[1]-r[1]||n[2]-r[2]);const e=[];for(const n of C(this,Ju))n[3]?(e.push(...B(this,Xs,AO).call(this,n)),B(this,Xs,jJ).call(this,n)):(B(this,Xs,zJ).call(this,n),e.push(...B(this,Xs,AO).call(this,n)));return B(this,Xs,FJ).call(this,e)}}Ew=new WeakMap,Ju=new WeakMap,la=new WeakMap,Xs=new WeakSet,FJ=function(e){const n=[],r=new Set;for(const a of e){const[o,c,u]=a;n.push([o,c,a],[o,u,a])}n.sort((a,o)=>a[1]-o[1]||a[0]-o[0]);for(let a=0,o=n.length;a0;){const a=r.values().next().value;let[o,c,u,f,l]=a;r.delete(a);let d=o,m=c;for(i=[o,u],s.push(i);;){let p;if(r.has(f))p=f;else if(r.has(l))p=l;else break;r.delete(p),[o,c,u,f,l]=p,d!==o&&(i.push(d,m,o,m===c?c:u),d=o),m=m===c?u:c}i.push(d,m)}return new gFe(s,C(this,Ew))},fE=function(e){const n=C(this,la);let r=0,s=n.length-1;for(;r<=s;){const i=r+s>>1,a=n[i][0];if(a===e)return i;a=0;s--){const[i,a]=C(this,la)[s];if(i!==e)break;if(i===e&&a===n){C(this,la).splice(s,1);return}}},AO=function(e){const[n,r,s]=e,i=[[n,r,s]],a=B(this,Xs,fE).call(this,s);for(let o=0;o=c){if(m>u)i[f][1]=u;else{if(l===1)return[];i.splice(f,1),f--,l--}continue}i[f][2]=c,m>u&&i.push([n,u,m])}}}return i};class BJ{toSVGPath(){throw new Error("Abstract method `toSVGPath` must be implemented.")}get box(){throw new Error("Abstract getter `box` must be implemented.")}serialize(e,n){throw new Error("Abstract method `serialize` must be implemented.")}get free(){return this instanceof PO}}var Cw,Lg;class gFe extends BJ{constructor(n,r){super();z(this,Cw);z(this,Lg);$(this,Lg,n),$(this,Cw,r)}toSVGPath(){const n=[];for(const r of C(this,Lg)){let[s,i]=r;n.push(`M${s} ${i}`);for(let a=2;a=6;p-=6)isNaN(n[p])?m.push(`L${n[p+4]} ${n[p+5]}`):m.push(`C${n[p]} ${n[p+1]} ${n[p+2]} ${n[p+3]} ${n[p+4]} ${n[p+5]}`);return m.push(`L${n[4]} ${n[5]} Z`),m.join(" ")}getOutlines(){var g;const e=C(this,tl),n=C(this,vc),r=C(this,zt),s=r.subarray(4,6),i=r.subarray(16,18),[a,o,c,u]=C(this,el),f=new Float64Array((((g=C(this,ed))==null?void 0:g.length)??0)+2);for(let v=0,w=f.length-2;v=6;v-=6)for(let w=0;w<6;w+=2){if(isNaN(n[v+w])){h[y]=h[y+1]=NaN,y+=2;continue}h[y]=n[v+w],h[y+1]=n[v+w+1],y+=2}return h.set([NaN,NaN,NaN,NaN,n[4],n[5]],y),new PO(h,f,C(this,el),C(this,Fg),C(this,Ig),C(this,$g))}};el=new WeakMap,vc=new WeakMap,Ig=new WeakMap,$g=new WeakMap,tl=new WeakMap,zt=new WeakMap,hh=new WeakMap,ph=new WeakMap,Aw=new WeakMap,Rw=new WeakMap,Fg=new WeakMap,jg=new WeakMap,ed=new WeakMap,Pw=new WeakMap,h1=new WeakMap,p1=new WeakMap,Tw=new WeakSet,RO=function(){const e=C(this,zt).subarray(4,6),n=C(this,zt).subarray(16,18),[r,s,i,a]=C(this,el);return[(C(this,hh)+(e[0]-n[0])/2-r)/i,(C(this,ph)+(e[1]-n[1])/2-s)/a,(C(this,hh)+(n[0]-e[0])/2-r)/i,(C(this,ph)+(n[1]-e[1])/2-s)/a]},z(Yl,Pw,8),z(Yl,h1,2),z(Yl,p1,C(Yl,Pw)+C(Yl,h1));let VC=Yl;var zg,mh,yc,kw,Wi,Dw,gr,bi,Qy,Zy,UJ;class PO extends BJ{constructor(n,r,s,i,a,o){super();z(this,bi);z(this,zg);z(this,mh,null);z(this,yc);z(this,kw);z(this,Wi);z(this,Dw);z(this,gr);$(this,gr,n),$(this,Wi,r),$(this,zg,s),$(this,Dw,i),$(this,yc,a),$(this,kw,o),B(this,bi,UJ).call(this,o);const{x:c,y:u,width:f,height:l}=C(this,mh);for(let d=0,m=n.length;d-1?($(this,Gi,!0),B(this,Ot,NO).call(this,n),B(this,Ot,Jy).call(this)):($(this,Vg,n.anchorNode),$(this,$w,n.anchorOffset),$(this,Fw,n.focusNode),$(this,jw,n.focusOffset),B(this,Ot,DO).call(this),B(this,Ot,Jy).call(this),this.rotate(this.rotation))}static get _keyboardManager(){const n=tn.prototype;return Gt(this,"_keyboardManager",new I_([[["ArrowLeft","mac+ArrowLeft"],n._moveCaret,{args:[0]}],[["ArrowRight","mac+ArrowRight"],n._moveCaret,{args:[1]}],[["ArrowUp","mac+ArrowUp"],n._moveCaret,{args:[2]}],[["ArrowDown","mac+ArrowDown"],n._moveCaret,{args:[3]}]]))}get telemetryInitialData(){return{action:"added",type:C(this,Gi)?"free_highlight":"highlight",color:this._uiManager.highlightColorNames.get(this.color),thickness:C(this,nl),methodOfCreation:C(this,zw)}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.highlightColorNames.get(this.color)}}static computeTelemetryFinalData(n){return{numberOfColors:n.get("color").size}}static initialize(n,r){var s;hn.initialize(n,r),tn._defaultColor||(tn._defaultColor=((s=r.highlightColors)==null?void 0:s.values().next().value)||"#fff066")}static updateDefaultParams(n,r){switch(n){case ht.HIGHLIGHT_DEFAULT_COLOR:tn._defaultColor=r;break;case ht.HIGHLIGHT_THICKNESS:tn._defaultThickness=r;break}}translateInPage(n,r){}get toolbarPosition(){return C(this,Gg)}updateParams(n,r){switch(n){case ht.HIGHLIGHT_COLOR:B(this,Ot,WJ).call(this,r);break;case ht.HIGHLIGHT_THICKNESS:B(this,Ot,GJ).call(this,r);break}}static get defaultPropertiesToUpdate(){return[[ht.HIGHLIGHT_DEFAULT_COLOR,tn._defaultColor],[ht.HIGHLIGHT_THICKNESS,tn._defaultThickness]]}get propertiesToUpdate(){return[[ht.HIGHLIGHT_COLOR,this.color||tn._defaultColor],[ht.HIGHLIGHT_THICKNESS,C(this,nl)||tn._defaultThickness],[ht.HIGHLIGHT_FREE,C(this,Gi)]]}async addEditToolbar(){const n=await super.addEditToolbar();return n?(this._uiManager.highlightColors&&($(this,Wg,new WC({editor:this})),n.addColorPicker(C(this,Wg))),n):null}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition(B(this,Ot,eb).call(this))}getBaseTranslation(){return[0,0]}getRect(n,r){return super.getRect(n,r,B(this,Ot,eb).call(this))}onceAdded(){this.parent.addUndoableEditor(this),this.div.focus()}remove(){B(this,Ot,OO).call(this),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(B(this,Ot,Jy).call(this),this.isAttachedToDOM||this.parent.add(this)))}setParent(n){var s;let r=!1;this.parent&&!n?B(this,Ot,OO).call(this):n&&(B(this,Ot,Jy).call(this,n),r=!this.parent&&((s=this.div)==null?void 0:s.classList.contains("selectedEditor"))),super.setParent(n),this.show(this._isVisible),r&&this.select()}rotate(n){var i,a,o;const{drawLayer:r}=this.parent;let s;C(this,Gi)?(n=(n-this.rotation+360)%360,s=B(i=tn,No,im).call(i,C(this,da).box,n)):s=B(a=tn,No,im).call(a,this,n),r.rotate(C(this,Bs),n),r.rotate(C(this,Or),n),r.updateBox(C(this,Bs),s),r.updateBox(C(this,Or),B(o=tn,No,im).call(o,C(this,xo).box,n))}render(){if(this.div)return this.div;const n=super.render();C(this,qg)&&(n.setAttribute("aria-label",C(this,qg)),n.setAttribute("role","mark")),C(this,Gi)?n.classList.add("free"):this.div.addEventListener("keydown",C(this,m1),{signal:this._uiManager._signal});const r=$(this,yh,document.createElement("div"));n.append(r),r.setAttribute("aria-hidden","true"),r.className="internal",r.style.clipPath=C(this,vh);const[s,i]=this.parentDimensions;return this.setDims(this.width*s,this.height*i),zC(this,C(this,yh),["pointerover","pointerleave"]),this.enableEditing(),n}pointerover(){this.parent.drawLayer.addClass(C(this,Or),"hovered")}pointerleave(){this.parent.drawLayer.removeClass(C(this,Or),"hovered")}_moveCaret(n){switch(this.parent.unselect(this),n){case 0:case 2:B(this,Ot,hE).call(this,!0);break;case 1:case 3:B(this,Ot,hE).call(this,!1);break}}select(){var n,r;super.select(),C(this,Or)&&((n=this.parent)==null||n.drawLayer.removeClass(C(this,Or),"hovered"),(r=this.parent)==null||r.drawLayer.addClass(C(this,Or),"selected"))}unselect(){var n;super.unselect(),C(this,Or)&&((n=this.parent)==null||n.drawLayer.removeClass(C(this,Or),"selected"),C(this,Gi)||B(this,Ot,hE).call(this,!1))}get _mustFixPosition(){return!C(this,Gi)}show(n=this._isVisible){super.show(n),this.parent&&(this.parent.drawLayer.show(C(this,Bs),n),this.parent.drawLayer.show(C(this,Or),n))}static startHighlighting(n,r,{target:s,x:i,y:a}){const{x:o,y:c,width:u,height:f}=s.getBoundingClientRect(),l=y=>{B(this,No,QJ).call(this,n,y)},d=n._signal,m={capture:!0,passive:!1,signal:d},p=y=>{y.preventDefault(),y.stopPropagation()},h=y=>{s.removeEventListener("pointermove",l),window.removeEventListener("blur",h),window.removeEventListener("pointerup",h),window.removeEventListener("pointerdown",p,m),window.removeEventListener("contextmenu",Ei),B(this,No,ZJ).call(this,n,y)};window.addEventListener("blur",h,{signal:d}),window.addEventListener("pointerup",h,{signal:d}),window.addEventListener("pointerdown",p,m),window.addEventListener("contextmenu",Ei,{signal:d}),s.addEventListener("pointermove",l,{signal:d}),this._freeHighlight=new VC({x:i,y:a},[o,c,u,f],n.scale,this._defaultThickness/2,r,.001),{id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=n.drawLayer.highlight(this._freeHighlight,this._defaultColor,this._defaultOpacity,!0)}static deserialize(n,r,s){var h;const i=super.deserialize(n,r,s),{rect:[a,o,c,u],color:f,quadPoints:l}=n;i.color=et.makeHexColor(...f),$(i,bh,n.opacity);const[d,m]=i.pageDimensions;i.width=(c-a)/d,i.height=(u-o)/m;const p=$(i,td,[]);for(let y=0;y=0)$(this,Bs,r),$(this,vh,s),this.parent.drawLayer.finalizeLine(r,n),$(this,Or,this.parent.drawLayer.highlightOutline(C(this,xo)));else if(this.parent){const m=this.parent.viewport.rotation;this.parent.drawLayer.updateLine(C(this,Bs),n),this.parent.drawLayer.updateBox(C(this,Bs),B(l=tn,No,im).call(l,C(this,da).box,(m-this.rotation+360)%360)),this.parent.drawLayer.updateLine(C(this,Or),C(this,xo)),this.parent.drawLayer.updateBox(C(this,Or),B(d=tn,No,im).call(d,C(this,xo).box,m))}const{x:a,y:o,width:c,height:u}=n.box;switch(this.rotation){case 0:this.x=a,this.y=o,this.width=c,this.height=u;break;case 90:{const[m,p]=this.parentDimensions;this.x=o,this.y=1-a,this.width=c*p/m,this.height=u*m/p;break}case 180:this.x=1-a,this.y=1-o,this.width=c,this.height=u;break;case 270:{const[m,p]=this.parentDimensions;this.x=1-o,this.y=a,this.width=c*p/m,this.height=u*m/p;break}}const{lastPoint:f}=C(this,xo).box;$(this,Gg,[(f[0]-a)/c,(f[1]-o)/u])},WJ=function(n){const r=i=>{var a,o;this.color=i,(a=this.parent)==null||a.drawLayer.changeColor(C(this,Bs),i),(o=C(this,Wg))==null||o.updateColor(i)},s=this.color;this.addCommands({cmd:r.bind(this,n),undo:r.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:ht.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.highlightColorNames.get(n)},!0)},GJ=function(n){const r=C(this,nl),s=i=>{$(this,nl,i),B(this,Ot,qJ).call(this,i)};this.addCommands({cmd:s.bind(this,n),undo:s.bind(this,r),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:ht.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:n},!0)},qJ=function(n){if(!C(this,Gi))return;B(this,Ot,NO).call(this,{highlightOutlines:C(this,da).getNewOutline(n/2)}),this.fixAndSetPosition();const[r,s]=this.parentDimensions;this.setDims(this.width*r,this.height*s)},OO=function(){C(this,Bs)===null||!this.parent||(this.parent.drawLayer.remove(C(this,Bs)),$(this,Bs,null),this.parent.drawLayer.remove(C(this,Or)),$(this,Or,null))},Jy=function(n=this.parent){C(this,Bs)===null&&({id:vs(this,Bs)._,clipPathId:vs(this,vh)._}=n.drawLayer.highlight(C(this,da),this.color,C(this,bh)),$(this,Or,n.drawLayer.highlightOutline(C(this,xo))),C(this,yh)&&(C(this,yh).style.clipPath=C(this,vh)))},No=new WeakSet,im=function({x:n,y:r,width:s,height:i},a){switch(a){case 90:return{x:1-r-i,y:n,width:i,height:s};case 180:return{x:1-n-s,y:1-r-i,width:s,height:i};case 270:return{x:r,y:1-n-s,width:i,height:s}}return{x:n,y:r,width:s,height:i}},KJ=function(n){tn._keyboardManager.exec(this,n)},hE=function(n){if(!C(this,Vg))return;const r=window.getSelection();n?r.setPosition(C(this,Vg),C(this,$w)):r.setPosition(C(this,Fw),C(this,jw))},eb=function(){return C(this,Gi)?this.rotation:0},YJ=function(){if(C(this,Gi))return null;const[n,r]=this.pageDimensions,s=C(this,td),i=new Float32Array(s.length*8);let a=0;for(const{x:o,y:c,width:u,height:f}of s){const l=o*n,d=(1-c-f)*r;i[a]=i[a+4]=l,i[a+1]=i[a+3]=d,i[a+2]=i[a+6]=l+u*n,i[a+5]=i[a+7]=d+f*r,a+=8}return i},XJ=function(n){return C(this,da).serialize(n,B(this,Ot,eb).call(this))},QJ=function(n,r){this._freeHighlight.add(r)&&n.drawLayer.updatePath(this._freeHighlightId,this._freeHighlight)},ZJ=function(n,r){this._freeHighlight.isEmpty()?n.drawLayer.removeFreeHighlight(this._freeHighlightId):n.createAndAddNewEditor(r,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""},z(tn,No),He(tn,"_defaultColor",null),He(tn,"_defaultOpacity",1),He(tn,"_defaultThickness",12),He(tn,"_l10nPromise"),He(tn,"_type","highlight"),He(tn,"_editorType",Vt.HIGHLIGHT),He(tn,"_freeHighlightId",-1),He(tn,"_freeHighlight",null),He(tn,"_freeHighlightClipId","");let GC=tn;var wh,_h,Bw,Uw,Hw,xh,rl,bc,So,Sh,Eh,wc,Ch,Ah,nd,ze,JJ,eee,tee,nee,LO,ree,IO,see,iee,oee,aee,lee,hf,$O,pE,mE,om,FO,gE,Wc,cee,jO,uee,dee,zO,vE,tb;const Xn=class Xn extends hn{constructor(n){super({...n,name:"inkEditor"});z(this,ze);z(this,wh,0);z(this,_h,0);z(this,Bw,this.canvasPointermove.bind(this));z(this,Uw,this.canvasPointerleave.bind(this));z(this,Hw,this.canvasPointerup.bind(this));z(this,xh,this.canvasPointerdown.bind(this));z(this,rl,null);z(this,bc,new Path2D);z(this,So,!1);z(this,Sh,!1);z(this,Eh,!1);z(this,wc,null);z(this,Ch,0);z(this,Ah,0);z(this,nd,null);this.color=n.color||null,this.thickness=n.thickness||null,this.opacity=n.opacity||null,this.paths=[],this.bezierPath2D=[],this.allRawPaths=[],this.currentPath=[],this.scaleFactor=1,this.translationX=this.translationY=0,this.x=0,this.y=0,this._willKeepAspectRatio=!0}static initialize(n,r){hn.initialize(n,r)}static updateDefaultParams(n,r){switch(n){case ht.INK_THICKNESS:Xn._defaultThickness=r;break;case ht.INK_COLOR:Xn._defaultColor=r;break;case ht.INK_OPACITY:Xn._defaultOpacity=r/100;break}}updateParams(n,r){switch(n){case ht.INK_THICKNESS:B(this,ze,JJ).call(this,r);break;case ht.INK_COLOR:B(this,ze,eee).call(this,r);break;case ht.INK_OPACITY:B(this,ze,tee).call(this,r);break}}static get defaultPropertiesToUpdate(){return[[ht.INK_THICKNESS,Xn._defaultThickness],[ht.INK_COLOR,Xn._defaultColor||hn._defaultLineColor],[ht.INK_OPACITY,Math.round(Xn._defaultOpacity*100)]]}get propertiesToUpdate(){return[[ht.INK_THICKNESS,this.thickness||Xn._defaultThickness],[ht.INK_COLOR,this.color||Xn._defaultColor||hn._defaultLineColor],[ht.INK_OPACITY,Math.round(100*(this.opacity??Xn._defaultOpacity))]]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.canvas||(B(this,ze,pE).call(this),B(this,ze,mE).call(this)),this.isAttachedToDOM||(this.parent.add(this),B(this,ze,om).call(this)),B(this,ze,tb).call(this)))}remove(){var n;this.canvas!==null&&(this.isEmpty()||this.commit(),this.canvas.width=this.canvas.height=0,this.canvas.remove(),this.canvas=null,C(this,rl)&&(clearTimeout(C(this,rl)),$(this,rl,null)),(n=C(this,wc))==null||n.disconnect(),$(this,wc,null),super.remove())}setParent(n){!this.parent&&n?this._uiManager.removeShouldRescale(this):this.parent&&n===null&&this._uiManager.addShouldRescale(this),super.setParent(n)}onScaleChanging(){const[n,r]=this.parentDimensions,s=this.width*n,i=this.height*r;this.setDimensions(s,i)}enableEditMode(){C(this,So)||this.canvas===null||(super.enableEditMode(),this._isDraggable=!1,this.canvas.addEventListener("pointerdown",C(this,xh),{signal:this._uiManager._signal}))}disableEditMode(){!this.isInEditMode()||this.canvas===null||(super.disableEditMode(),this._isDraggable=!this.isEmpty(),this.div.classList.remove("editing"),this.canvas.removeEventListener("pointerdown",C(this,xh)))}onceAdded(){this._isDraggable=!this.isEmpty()}isEmpty(){return this.paths.length===0||this.paths.length===1&&this.paths[0].length===0}commit(){C(this,So)||(super.commit(),this.isEditing=!1,this.disableEditMode(),this.setInForeground(),$(this,So,!0),this.div.classList.add("disabled"),B(this,ze,tb).call(this,!0),this.select(),this.parent.addInkEditorIfNeeded(!0),this.moveInDOM(),this.div.focus({preventScroll:!0}))}focusin(n){this._focusEventsAllowed&&(super.focusin(n),this.enableEditMode())}canvasPointerdown(n){n.button!==0||!this.isInEditMode()||C(this,So)||(this.setInForeground(),n.preventDefault(),this.div.contains(document.activeElement)||this.div.focus({preventScroll:!0}),B(this,ze,ree).call(this,n.offsetX,n.offsetY))}canvasPointermove(n){n.preventDefault(),B(this,ze,IO).call(this,n.offsetX,n.offsetY)}canvasPointerup(n){n.preventDefault(),B(this,ze,$O).call(this,n)}canvasPointerleave(n){B(this,ze,$O).call(this,n)}get isResizable(){return!this.isEmpty()&&C(this,So)}render(){if(this.div)return this.div;let n,r;this.width&&(n=this.x,r=this.y),super.render(),this.div.setAttribute("data-l10n-id","pdfjs-ink");const[s,i,a,o]=B(this,ze,nee).call(this);if(this.setAt(s,i,0,0),this.setDims(a,o),B(this,ze,pE).call(this),this.width){const[c,u]=this.parentDimensions;this.setAspectRatio(this.width*c,this.height*u),this.setAt(n*c,r*u,this.width*c,this.height*u),$(this,Eh,!0),B(this,ze,om).call(this),this.setDims(this.width*c,this.height*u),B(this,ze,hf).call(this),this.div.classList.add("disabled")}else this.div.classList.add("editing"),this.enableEditMode();return B(this,ze,mE).call(this),this.div}setDimensions(n,r){const s=Math.round(n),i=Math.round(r);if(C(this,Ch)===s&&C(this,Ah)===i)return;$(this,Ch,s),$(this,Ah,i),this.canvas.style.visibility="hidden";const[a,o]=this.parentDimensions;this.width=n/a,this.height=r/o,this.fixAndSetPosition(),C(this,So)&&B(this,ze,FO).call(this,n,r),B(this,ze,om).call(this),B(this,ze,hf).call(this),this.canvas.style.visibility="visible",this.fixDims()}static deserialize(n,r,s){var y,g,v;if(n instanceof kJ)return null;const i=super.deserialize(n,r,s);i.thickness=n.thickness,i.color=et.makeHexColor(...n.color),i.opacity=n.opacity;const[a,o]=i.pageDimensions,c=i.width*a,u=i.height*o,f=i.parentScale,l=n.thickness/2;$(i,So,!0),$(i,Ch,Math.round(c)),$(i,Ah,Math.round(u));const{paths:d,rect:m,rotation:p}=n;for(let{bezier:w}of d){w=B(y=Xn,Wc,uee).call(y,w,m,p);const x=[];i.paths.push(x);let A=f*(w[0]-l),k=f*(w[1]-l);for(let E=2,T=w.length;E{this.thickness=i,B(this,ze,tb).call(this)},s=this.thickness;this.addCommands({cmd:r.bind(this,n),undo:r.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:ht.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0})},eee=function(n){const r=i=>{this.color=i,B(this,ze,hf).call(this)},s=this.color;this.addCommands({cmd:r.bind(this,n),undo:r.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:ht.INK_COLOR,overwriteIfSameType:!0,keepUndo:!0})},tee=function(n){const r=i=>{this.opacity=i,B(this,ze,hf).call(this)};n/=100;const s=this.opacity;this.addCommands({cmd:r.bind(this,n),undo:r.bind(this,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:ht.INK_OPACITY,overwriteIfSameType:!0,keepUndo:!0})},nee=function(){const{parentRotation:n,parentDimensions:[r,s]}=this;switch(n){case 90:return[0,s,s,r];case 180:return[r,s,r,s];case 270:return[r,0,s,r];default:return[0,0,r,s]}},LO=function(){const{ctx:n,color:r,opacity:s,thickness:i,parentScale:a,scaleFactor:o}=this;n.lineWidth=i*a/o,n.lineCap="round",n.lineJoin="round",n.miterLimit=10,n.strokeStyle=`${r}${z$e(s)}`},ree=function(n,r){const s=this._uiManager._signal;this.canvas.addEventListener("contextmenu",Ei,{signal:s}),this.canvas.addEventListener("pointerleave",C(this,Uw),{signal:s}),this.canvas.addEventListener("pointermove",C(this,Bw),{signal:s}),this.canvas.addEventListener("pointerup",C(this,Hw),{signal:s}),this.canvas.removeEventListener("pointerdown",C(this,xh)),this.isEditing=!0,C(this,Eh)||($(this,Eh,!0),B(this,ze,om).call(this),this.thickness||(this.thickness=Xn._defaultThickness),this.color||(this.color=Xn._defaultColor||hn._defaultLineColor),this.opacity??(this.opacity=Xn._defaultOpacity)),this.currentPath.push([n,r]),$(this,Sh,!1),B(this,ze,LO).call(this),$(this,nd,()=>{B(this,ze,oee).call(this),C(this,nd)&&window.requestAnimationFrame(C(this,nd))}),window.requestAnimationFrame(C(this,nd))},IO=function(n,r){const[s,i]=this.currentPath.at(-1);if(this.currentPath.length>1&&n===s&&r===i)return;const a=this.currentPath;let o=C(this,bc);if(a.push([n,r]),$(this,Sh,!0),a.length<=2){o.moveTo(...a[0]),o.lineTo(n,r);return}a.length===3&&($(this,bc,o=new Path2D),o.moveTo(...a[0])),B(this,ze,aee).call(this,o,...a.at(-3),...a.at(-2),n,r)},see=function(){if(this.currentPath.length===0)return;const n=this.currentPath.at(-1);C(this,bc).lineTo(...n)},iee=function(n,r){$(this,nd,null),n=Math.min(Math.max(n,0),this.canvas.width),r=Math.min(Math.max(r,0),this.canvas.height),B(this,ze,IO).call(this,n,r),B(this,ze,see).call(this);let s;if(this.currentPath.length!==1)s=B(this,ze,lee).call(this);else{const u=[n,r];s=[[u,u.slice(),u.slice(),u]]}const i=C(this,bc),a=this.currentPath;this.currentPath=[],$(this,bc,new Path2D);const o=()=>{this.allRawPaths.push(a),this.paths.push(s),this.bezierPath2D.push(i),this._uiManager.rebuild(this)},c=()=>{this.allRawPaths.pop(),this.paths.pop(),this.bezierPath2D.pop(),this.paths.length===0?this.remove():(this.canvas||(B(this,ze,pE).call(this),B(this,ze,mE).call(this)),B(this,ze,tb).call(this))};this.addCommands({cmd:o,undo:c,mustExec:!0})},oee=function(){if(!C(this,Sh))return;$(this,Sh,!1);const n=Math.ceil(this.thickness*this.parentScale),r=this.currentPath.slice(-3),s=r.map(o=>o[0]),i=r.map(o=>o[1]);Math.min(...s)-n,Math.max(...s)+n,Math.min(...i)-n,Math.max(...i)+n;const{ctx:a}=this;a.save(),a.clearRect(0,0,this.canvas.width,this.canvas.height);for(const o of this.bezierPath2D)a.stroke(o);a.stroke(C(this,bc)),a.restore()},aee=function(n,r,s,i,a,o,c){const u=(r+i)/2,f=(s+a)/2,l=(i+o)/2,d=(a+c)/2;n.bezierCurveTo(u+2*(i-u)/3,f+2*(a-f)/3,l+2*(i-l)/3,d+2*(a-d)/3,l,d)},lee=function(){const n=this.currentPath;if(n.length<=2)return[[n[0],n[0],n.at(-1),n.at(-1)]];const r=[];let s,[i,a]=n[0];for(s=1;s{$(this,rl,null),this.canvas.removeEventListener("contextmenu",Ei)},10)),B(this,ze,iee).call(this,n.offsetX,n.offsetY),this.addToAnnotationStorage(),this.setInBackground()},pE=function(){this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=0,this.canvas.className="inkEditorCanvas",this.canvas.setAttribute("data-l10n-id","pdfjs-ink-canvas"),this.div.append(this.canvas),this.ctx=this.canvas.getContext("2d")},mE=function(){$(this,wc,new ResizeObserver(n=>{const r=n[0].contentRect;r.width&&r.height&&this.setDimensions(r.width,r.height)})),C(this,wc).observe(this.div),this._uiManager._signal.addEventListener("abort",()=>{var n;(n=C(this,wc))==null||n.disconnect(),$(this,wc,null)},{once:!0})},om=function(){if(!C(this,Eh))return;const[n,r]=this.parentDimensions;this.canvas.width=Math.ceil(this.width*n),this.canvas.height=Math.ceil(this.height*r),B(this,ze,gE).call(this)},FO=function(n,r){const s=B(this,ze,vE).call(this),i=(n-s)/C(this,_h),a=(r-s)/C(this,wh);this.scaleFactor=Math.min(i,a)},gE=function(){const n=B(this,ze,vE).call(this)/2;this.ctx.setTransform(this.scaleFactor,0,0,this.scaleFactor,this.translationX*this.scaleFactor+n,this.translationY*this.scaleFactor+n)},Wc=new WeakSet,cee=function(n){const r=new Path2D;for(let s=0,i=n.length;s`image/${r}`))}static get supportedTypesStr(){return Gt(this,"supportedTypesStr",this.supportedTypes.join(","))}static isHandlingMimeForPasting(n){return this.supportedTypes.includes(n)}static paste(n,r){r.pasteEditor(Vt.STAMP,{bitmapFile:n.getAsFile()})}remove(){var n,r;C(this,as)&&($(this,os,null),this._uiManager.imageManager.deleteId(C(this,as)),(n=C(this,sl))==null||n.remove(),$(this,sl,null),(r=C(this,xc))==null||r.disconnect(),$(this,xc,null),C(this,il)&&(clearTimeout(C(this,il)),$(this,il,null))),super.remove()}rebuild(){if(!this.parent){C(this,as)&&B(this,Jt,yE).call(this);return}super.rebuild(),this.div!==null&&(C(this,as)&&C(this,sl)===null&&B(this,Jt,yE).call(this),this.isAttachedToDOM||this.parent.add(this))}onceAdded(){this._isDraggable=!0,this.div.focus()}isEmpty(){return!(C(this,rd)||C(this,os)||C(this,_c)||C(this,sd)||C(this,as))}get isResizable(){return!0}render(){if(this.div)return this.div;let n,r;if(this.width&&(n=this.x,r=this.y),super.render(),this.div.hidden=!0,this.addAltTextButton(),C(this,os)?B(this,Jt,UO).call(this):B(this,Jt,yE).call(this),this.width){const[s,i]=this.parentDimensions;this.setAt(n*s,r*i,this.width*s,this.height*i)}return this.div}getImageForAltText(){return C(this,sl)}static deserialize(n,r,s){if(n instanceof DJ)return null;const i=super.deserialize(n,r,s),{rect:a,bitmapUrl:o,bitmapId:c,isSvg:u,accessibilityData:f}=n;c&&s.imageManager.isValidId(c)?$(i,as,c):$(i,_c,o),$(i,fa,u);const[l,d]=i.pageDimensions;return i.width=(a[2]-a[0])/l,i.height=(a[3]-a[1])/d,f&&(i.altTextData=f),i}serialize(n=!1,r=null){if(this.isEmpty())return null;const s={annotationType:Vt.STAMP,bitmapId:C(this,as),pageIndex:this.pageIndex,rect:this.getRect(0,0),rotation:this.rotation,isSvg:C(this,fa),structTreeParentId:this._structTreeParentId};if(n)return s.bitmapUrl=B(this,Jt,bE).call(this,!0),s.accessibilityData=this.altTextData,s;const{decorative:i,altText:a}=this.altTextData;if(!i&&a&&(s.accessibilityData={type:"Figure",alt:a}),r===null)return s;r.stamps||(r.stamps=new Map);const o=C(this,fa)?(s.rect[2]-s.rect[0])*(s.rect[3]-s.rect[1]):null;if(!r.stamps.has(C(this,as)))r.stamps.set(C(this,as),{area:o,serialized:s}),s.bitmap=B(this,Jt,bE).call(this,!1);else if(C(this,fa)){const c=r.stamps.get(C(this,as));o>c.area&&(c.area=o,c.serialized.bitmap.close(),c.serialized.bitmap=B(this,Jt,bE).call(this,!1))}return s}};os=new WeakMap,as=new WeakMap,rd=new WeakMap,_c=new WeakMap,sd=new WeakMap,Kg=new WeakMap,sl=new WeakMap,xc=new WeakMap,il=new WeakMap,fa=new WeakMap,Vw=new WeakMap,Jt=new WeakSet,nb=function(n,r=!1){if(!n){this.remove();return}$(this,os,n.bitmap),r||($(this,as,n.id),$(this,fa,n.isSvg)),n.file&&$(this,Kg,n.file.name),B(this,Jt,UO).call(this)},rb=function(){$(this,rd,null),this._uiManager.enableWaiting(!1),C(this,sl)&&this.div.focus()},yE=function(){if(C(this,as)){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(C(this,as)).then(s=>B(this,Jt,nb).call(this,s,!0)).finally(()=>B(this,Jt,rb).call(this));return}if(C(this,_c)){const s=C(this,_c);$(this,_c,null),this._uiManager.enableWaiting(!0),$(this,rd,this._uiManager.imageManager.getFromUrl(s).then(i=>B(this,Jt,nb).call(this,i)).finally(()=>B(this,Jt,rb).call(this)));return}if(C(this,sd)){const s=C(this,sd);$(this,sd,null),this._uiManager.enableWaiting(!0),$(this,rd,this._uiManager.imageManager.getFromFile(s).then(i=>B(this,Jt,nb).call(this,i)).finally(()=>B(this,Jt,rb).call(this)));return}const n=document.createElement("input");n.type="file",n.accept=Eb.supportedTypesStr;const r=this._uiManager._signal;$(this,rd,new Promise(s=>{n.addEventListener("change",async()=>{if(!n.files||n.files.length===0)this.remove();else{this._uiManager.enableWaiting(!0);const i=await this._uiManager.imageManager.getFromFile(n.files[0]);B(this,Jt,nb).call(this,i)}s()},{signal:r}),n.addEventListener("cancel",()=>{this.remove(),s()},{signal:r})}).finally(()=>B(this,Jt,rb).call(this))),n.click()},UO=function(){const{div:n}=this;let{width:r,height:s}=C(this,os);const[i,a]=this.pageDimensions,o=.75;if(this.width)r=this.width*i,s=this.height*a;else if(r>o*i||s>o*a){const l=Math.min(o*i/r,o*a/s);r*=l,s*=l}const[c,u]=this.parentDimensions;this.setDims(r*c/i,s*u/a),this._uiManager.enableWaiting(!1);const f=$(this,sl,document.createElement("canvas"));n.append(f),n.hidden=!1,B(this,Jt,HO).call(this,r,s),B(this,Jt,pee).call(this),C(this,Vw)||(this.parent.addUndoableEditor(this),$(this,Vw,!0)),this._reportTelemetry({action:"inserted_image"}),C(this,Kg)&&f.setAttribute("aria-label",C(this,Kg))},fee=function(n,r){var o;const[s,i]=this.parentDimensions;this.width=n/s,this.height=r/i,this.setDims(n,r),(o=this._initialOptions)!=null&&o.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,C(this,il)!==null&&clearTimeout(C(this,il)),$(this,il,setTimeout(()=>{$(this,il,null),B(this,Jt,HO).call(this,n,r)},200))},hee=function(n,r){const{width:s,height:i}=C(this,os);let a=s,o=i,c=C(this,os);for(;a>2*n||o>2*r;){const u=a,f=o;a>2*n&&(a=a>=16384?Math.floor(a/2)-1:Math.ceil(a/2)),o>2*r&&(o=o>=16384?Math.floor(o/2)-1:Math.ceil(o/2));const l=new OffscreenCanvas(a,o);l.getContext("2d").drawImage(c,0,0,u,f,0,0,a,o),c=l.transferToImageBitmap()}return c},HO=function(n,r){n=Math.ceil(n),r=Math.ceil(r);const s=C(this,sl);if(!s||s.width===n&&s.height===r)return;s.width=n,s.height=r;const i=C(this,fa)?C(this,os):B(this,Jt,hee).call(this,n,r);if(this._uiManager.hasMLManager&&!this.hasAltText()){const c=new OffscreenCanvas(n,r).getContext("2d");c.drawImage(i,0,0,i.width,i.height,0,0,n,r),this._uiManager.mlGuess({service:"image-to-text",request:{data:c.getImageData(0,0,n,r).data,width:n,height:r,channels:4}}).then(u=>{const f=(u==null?void 0:u.output)||"";this.parent&&f&&!this.hasAltText()&&(this.altTextData={altText:f,decorative:!1})})}const a=s.getContext("2d");a.filter=this._uiManager.hcmFilter,a.drawImage(i,0,0,i.width,i.height,0,0,n,r)},bE=function(n){if(n){if(C(this,fa)){const i=this._uiManager.imageManager.getSvgUrl(C(this,as));if(i)return i}const r=document.createElement("canvas");return{width:r.width,height:r.height}=C(this,os),r.getContext("2d").drawImage(C(this,os),0,0),r.toDataURL()}if(C(this,fa)){const[r,s]=this.pageDimensions,i=Math.round(this.width*r*Pd.PDF_TO_CSS_UNITS),a=Math.round(this.height*s*Pd.PDF_TO_CSS_UNITS),o=new OffscreenCanvas(i,a);return o.getContext("2d").drawImage(C(this,os),0,0,C(this,os).width,C(this,os).height,0,0,i,a),o.transferToImageBitmap()}return structuredClone(C(this,os))},pee=function(){this._uiManager._signal&&($(this,xc,new ResizeObserver(n=>{const r=n[0].contentRect;r.width&&r.height&&B(this,Jt,fee).call(this,r.width,r.height)})),C(this,xc).observe(this.div),this._uiManager._signal.addEventListener("abort",()=>{var n;(n=C(this,xc))==null||n.disconnect(),$(this,xc,null)},{once:!0}))},He(Eb,"_type","stamp"),He(Eb,"_editorType",Vt.STAMP);let BO=Eb;var Rh,Yg,ol,Ph,Sc,Ec,Cc,qi,id,Xg,Qg,Us,rt,od,us,mee,WO,GO,qO,wE;const Yo=class Yo{constructor({uiManager:e,pageIndex:n,div:r,accessibilityManager:s,annotationLayer:i,drawLayer:a,textLayer:o,viewport:c,l10n:u}){z(this,us);z(this,Rh);z(this,Yg,!1);z(this,ol,null);z(this,Ph,null);z(this,Sc,null);z(this,Ec,null);z(this,Cc,null);z(this,qi,new Map);z(this,id,!1);z(this,Xg,!1);z(this,Qg,!1);z(this,Us,null);z(this,rt);const f=[...C(Yo,od).values()];if(!Yo._initialized){Yo._initialized=!0;for(const l of f)l.initialize(u,e)}e.registerEditorTypes(f),$(this,rt,e),this.pageIndex=n,this.div=r,$(this,Rh,s),$(this,ol,i),this.viewport=c,$(this,Us,o),this.drawLayer=a,C(this,rt).addLayer(this)}get isEmpty(){return C(this,qi).size===0}get isInvisible(){return this.isEmpty&&C(this,rt).getMode()===Vt.NONE}updateToolbar(e){C(this,rt).updateToolbar(e)}updateMode(e=C(this,rt).getMode()){switch(B(this,us,wE).call(this),e){case Vt.NONE:this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case Vt.INK:this.addInkEditorIfNeeded(!1),this.disableTextSelection(),this.togglePointerEvents(!0),this.disableClick();break;case Vt.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);const{classList:n}=this.div;for(const r of C(Yo,od).values())n.toggle(`${r._type}Editing`,e===r._editorType);this.div.hidden=!1}hasTextLayer(e){var n;return e===((n=C(this,Us))==null?void 0:n.div)}addInkEditorIfNeeded(e){if(C(this,rt).getMode()!==Vt.INK)return;if(!e){for(const r of C(this,qi).values())if(r.isEmpty()){r.setInBackground();return}}this.createAndAddNewEditor({offsetX:0,offsetY:0},!1).setInBackground()}setEditingState(e){C(this,rt).setEditingState(e)}addCommands(e){C(this,rt).addCommands(e)}togglePointerEvents(e=!1){this.div.classList.toggle("disabled",!e)}toggleAnnotationLayerPointerEvents(e=!1){var n;(n=C(this,ol))==null||n.div.classList.toggle("disabled",!e)}enable(){this.div.tabIndex=0,this.togglePointerEvents(!0);const e=new Set;for(const r of C(this,qi).values())r.enableEditing(),r.show(!0),r.annotationElementId&&(C(this,rt).removeChangedExistingAnnotation(r),e.add(r.annotationElementId));if(!C(this,ol))return;const n=C(this,ol).getEditableAnnotations();for(const r of n){if(r.hide(),C(this,rt).isDeletedAnnotationElement(r.data.id)||e.has(r.data.id))continue;const s=this.deserialize(r);s&&(this.addOrRebuild(s),s.enableEditing())}}disable(){var s;$(this,Qg,!0),this.div.tabIndex=-1,this.togglePointerEvents(!1);const e=new Map,n=new Map;for(const i of C(this,qi).values())if(i.disableEditing(),!!i.annotationElementId){if(i.serialize()!==null){e.set(i.annotationElementId,i);continue}else n.set(i.annotationElementId,i);(s=this.getEditableAnnotation(i.annotationElementId))==null||s.show(),i.remove()}if(C(this,ol)){const i=C(this,ol).getEditableAnnotations();for(const a of i){const{id:o}=a.data;if(C(this,rt).isDeletedAnnotationElement(o))continue;let c=n.get(o);if(c){c.resetAnnotationElement(a),c.show(!1),a.show();continue}c=e.get(o),c&&(C(this,rt).addChangedExistingAnnotation(c),c.renderAnnotationElement(a),c.show(!1)),a.show()}}B(this,us,wE).call(this),this.isEmpty&&(this.div.hidden=!0);const{classList:r}=this.div;for(const i of C(Yo,od).values())r.remove(`${i._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),$(this,Qg,!1)}getEditableAnnotation(e){var n;return((n=C(this,ol))==null?void 0:n.getEditableAnnotation(e))||null}setActiveEditor(e){C(this,rt).getActive()!==e&&C(this,rt).setActiveEditor(e)}enableTextSelection(){var e;this.div.tabIndex=-1,(e=C(this,Us))!=null&&e.div&&!C(this,Ec)&&($(this,Ec,B(this,us,mee).bind(this)),C(this,Us).div.addEventListener("pointerdown",C(this,Ec),{signal:C(this,rt)._signal}),C(this,Us).div.classList.add("highlighting"))}disableTextSelection(){var e;this.div.tabIndex=0,(e=C(this,Us))!=null&&e.div&&C(this,Ec)&&(C(this,Us).div.removeEventListener("pointerdown",C(this,Ec)),$(this,Ec,null),C(this,Us).div.classList.remove("highlighting"))}enableClick(){if(C(this,Sc))return;const e=C(this,rt)._signal;$(this,Sc,this.pointerdown.bind(this)),$(this,Ph,this.pointerup.bind(this)),this.div.addEventListener("pointerdown",C(this,Sc),{signal:e}),this.div.addEventListener("pointerup",C(this,Ph),{signal:e})}disableClick(){C(this,Sc)&&(this.div.removeEventListener("pointerdown",C(this,Sc)),this.div.removeEventListener("pointerup",C(this,Ph)),$(this,Sc,null),$(this,Ph,null))}attach(e){C(this,qi).set(e.id,e);const{annotationElementId:n}=e;n&&C(this,rt).isDeletedAnnotationElement(n)&&C(this,rt).removeDeletedAnnotationElement(e)}detach(e){var n;C(this,qi).delete(e.id),(n=C(this,Rh))==null||n.removePointerInTextLayer(e.contentDiv),!C(this,Qg)&&e.annotationElementId&&C(this,rt).addDeletedAnnotationElement(e)}remove(e){this.detach(e),C(this,rt).removeEditor(e),e.div.remove(),e.isAttachedToDOM=!1,C(this,Xg)||this.addInkEditorIfNeeded(!1)}changeParent(e){var n;e.parent!==this&&(e.parent&&e.annotationElementId&&(C(this,rt).addDeletedAnnotationElement(e.annotationElementId),hn.deleteAnnotationElement(e),e.annotationElementId=null),this.attach(e),(n=e.parent)==null||n.detach(e),e.setParent(this),e.div&&e.isAttachedToDOM&&(e.div.remove(),this.div.append(e.div)))}add(e){if(!(e.parent===this&&e.isAttachedToDOM)){if(this.changeParent(e),C(this,rt).addEditor(e),this.attach(e),!e.isAttachedToDOM){const n=e.render();this.div.append(n),e.isAttachedToDOM=!0}e.fixAndSetPosition(),e.onceAdded(),C(this,rt).addToAnnotationStorage(e),e._reportTelemetry(e.telemetryInitialData)}}moveEditorInDOM(e){var r;if(!e.isAttachedToDOM)return;const{activeElement:n}=document;e.div.contains(n)&&!C(this,Cc)&&(e._focusEventsAllowed=!1,$(this,Cc,setTimeout(()=>{$(this,Cc,null),e.div.contains(document.activeElement)?e._focusEventsAllowed=!0:(e.div.addEventListener("focusin",()=>{e._focusEventsAllowed=!0},{once:!0,signal:C(this,rt)._signal}),n.focus())},0))),e._structTreeParentId=(r=C(this,Rh))==null?void 0:r.moveElementInDOM(this.div,e.div,e.contentDiv,!0)}addOrRebuild(e){e.needsToBeRebuilt()?(e.parent||(e.parent=this),e.rebuild(),e.show()):this.add(e)}addUndoableEditor(e){const n=()=>e._uiManager.rebuild(e),r=()=>{e.remove()};this.addCommands({cmd:n,undo:r,mustExec:!1})}getNextId(){return C(this,rt).getId()}get _signal(){return C(this,rt)._signal}canCreateNewEmptyEditor(){var e;return(e=C(this,us,WO))==null?void 0:e.canCreateNewEmptyEditor()}pasteEditor(e,n){C(this,rt).updateToolbar(e),C(this,rt).updateMode(e);const{offsetX:r,offsetY:s}=B(this,us,qO).call(this),i=this.getNextId(),a=B(this,us,GO).call(this,{parent:this,id:i,x:r,y:s,uiManager:C(this,rt),isCentered:!0,...n});a&&this.add(a)}deserialize(e){var n;return((n=C(Yo,od).get(e.annotationType??e.annotationEditorType))==null?void 0:n.deserialize(e,this,C(this,rt)))||null}createAndAddNewEditor(e,n,r={}){const s=this.getNextId(),i=B(this,us,GO).call(this,{parent:this,id:s,x:e.offsetX,y:e.offsetY,uiManager:C(this,rt),isCentered:n,...r});return i&&this.add(i),i}addNewEditor(){this.createAndAddNewEditor(B(this,us,qO).call(this),!0)}setSelected(e){C(this,rt).setSelected(e)}toggleSelected(e){C(this,rt).toggleSelected(e)}isSelected(e){return C(this,rt).isSelected(e)}unselect(e){C(this,rt).unselect(e)}pointerup(e){const{isMac:n}=yi.platform;if(!(e.button!==0||e.ctrlKey&&n)&&e.target===this.div&&C(this,id)){if($(this,id,!1),!C(this,Yg)){$(this,Yg,!0);return}if(C(this,rt).getMode()===Vt.STAMP){C(this,rt).unselectAll();return}this.createAndAddNewEditor(e,!1)}}pointerdown(e){if(C(this,rt).getMode()===Vt.HIGHLIGHT&&this.enableTextSelection(),C(this,id)){$(this,id,!1);return}const{isMac:n}=yi.platform;if(e.button!==0||e.ctrlKey&&n||e.target!==this.div)return;$(this,id,!0);const r=C(this,rt).getActive();$(this,Yg,!r||r.isEmpty())}findNewParent(e,n,r){const s=C(this,rt).findParent(n,r);return s===null||s===this?!1:(s.changeParent(e),!0)}destroy(){var e,n;((e=C(this,rt).getActive())==null?void 0:e.parent)===this&&(C(this,rt).commitOrRemove(),C(this,rt).setActiveEditor(null)),C(this,Cc)&&(clearTimeout(C(this,Cc)),$(this,Cc,null));for(const r of C(this,qi).values())(n=C(this,Rh))==null||n.removePointerInTextLayer(r.contentDiv),r.setParent(null),r.isAttachedToDOM=!1,r.div.remove();this.div=null,C(this,qi).clear(),C(this,rt).removeLayer(this)}render({viewport:e}){this.viewport=e,ep(this.div,e);for(const n of C(this,rt).getEditors(this.pageIndex))this.add(n),n.rebuild();this.updateMode()}update({viewport:e}){C(this,rt).commitOrRemove(),B(this,us,wE).call(this);const n=this.viewport.rotation,r=e.rotation;if(this.viewport=e,ep(this.div,{rotation:r}),n!==r)for(const s of C(this,qi).values())s.rotate(r);this.addInkEditorIfNeeded(!1)}get pageDimensions(){const{pageWidth:e,pageHeight:n}=this.viewport.rawDims;return[e,n]}get scale(){return C(this,rt).viewParameters.realScale}};Rh=new WeakMap,Yg=new WeakMap,ol=new WeakMap,Ph=new WeakMap,Sc=new WeakMap,Ec=new WeakMap,Cc=new WeakMap,qi=new WeakMap,id=new WeakMap,Xg=new WeakMap,Qg=new WeakMap,Us=new WeakMap,rt=new WeakMap,od=new WeakMap,us=new WeakSet,mee=function(e){if(C(this,rt).unselectAll(),e.target===C(this,Us).div){const{isMac:n}=yi.platform;if(e.button!==0||e.ctrlKey&&n)return;C(this,rt).showAllEditors("highlight",!0,!0),C(this,Us).div.classList.add("free"),GC.startHighlighting(this,C(this,rt).direction==="ltr",e),C(this,Us).div.addEventListener("pointerup",()=>{C(this,Us).div.classList.remove("free")},{once:!0,signal:C(this,rt)._signal}),e.preventDefault()}},WO=function(){return C(Yo,od).get(C(this,rt).getMode())},GO=function(e){const n=C(this,us,WO);return n?new n.prototype.constructor(e):null},qO=function(){const{x:e,y:n,width:r,height:s}=this.div.getBoundingClientRect(),i=Math.max(0,e),a=Math.max(0,n),o=Math.min(window.innerWidth,e+r),c=Math.min(window.innerHeight,n+s),u=(i+o)/2-e,f=(a+c)/2-n,[l,d]=this.viewport.rotation%180===0?[u,f]:[f,u];return{offsetX:l,offsetY:d}},wE=function(){$(this,Xg,!0);for(const e of C(this,qi).values())e.isEmpty()&&e.remove();$(this,Xg,!1)},He(Yo,"_initialized",!1),z(Yo,od,new Map([SO,MO,BO,GC].map(e=>[e._editorType,e])));let VO=Yo;var al,Ww,Mr,ad,Gw,YO,op,XO,gee;const ts=class ts{constructor({pageIndex:e}){z(this,op);z(this,al,null);z(this,Ww,0);z(this,Mr,new Map);z(this,ad,new Map);this.pageIndex=e}setParent(e){if(!C(this,al)){$(this,al,e);return}if(C(this,al)!==e){if(C(this,Mr).size>0)for(const n of C(this,Mr).values())n.remove(),e.append(n);$(this,al,e)}}static get _svgFactory(){return Gt(this,"_svgFactory",new z$)}highlight(e,n,r,s=!1){const i=vs(this,Ww)._++,a=B(this,op,XO).call(this,e.box);a.classList.add("highlight"),e.free&&a.classList.add("free");const o=ts._svgFactory.createElement("defs");a.append(o);const c=ts._svgFactory.createElement("path");o.append(c);const u=`path_p${this.pageIndex}_${i}`;c.setAttribute("id",u),c.setAttribute("d",e.toSVGPath()),s&&C(this,ad).set(i,c);const f=B(this,op,gee).call(this,o,u),l=ts._svgFactory.createElement("use");return a.append(l),a.setAttribute("fill",n),a.setAttribute("fill-opacity",r),l.setAttribute("href",`#${u}`),C(this,Mr).set(i,a),{id:i,clipPathId:`url(#${f})`}}highlightOutline(e){const n=vs(this,Ww)._++,r=B(this,op,XO).call(this,e.box);r.classList.add("highlightOutline");const s=ts._svgFactory.createElement("defs");r.append(s);const i=ts._svgFactory.createElement("path");s.append(i);const a=`path_p${this.pageIndex}_${n}`;i.setAttribute("id",a),i.setAttribute("d",e.toSVGPath()),i.setAttribute("vector-effect","non-scaling-stroke");let o;if(e.free){r.classList.add("free");const f=ts._svgFactory.createElement("mask");s.append(f),o=`mask_p${this.pageIndex}_${n}`,f.setAttribute("id",o),f.setAttribute("maskUnits","objectBoundingBox");const l=ts._svgFactory.createElement("rect");f.append(l),l.setAttribute("width","1"),l.setAttribute("height","1"),l.setAttribute("fill","white");const d=ts._svgFactory.createElement("use");f.append(d),d.setAttribute("href",`#${a}`),d.setAttribute("stroke","none"),d.setAttribute("fill","black"),d.setAttribute("fill-rule","nonzero"),d.classList.add("mask")}const c=ts._svgFactory.createElement("use");r.append(c),c.setAttribute("href",`#${a}`),o&&c.setAttribute("mask",`url(#${o})`);const u=c.cloneNode();return r.append(u),c.classList.add("mainOutline"),u.classList.add("secondaryOutline"),C(this,Mr).set(n,r),n}finalizeLine(e,n){const r=C(this,ad).get(e);C(this,ad).delete(e),this.updateBox(e,n.box),r.setAttribute("d",n.toSVGPath())}updateLine(e,n){C(this,Mr).get(e).firstChild.firstChild.setAttribute("d",n.toSVGPath())}removeFreeHighlight(e){this.remove(e),C(this,ad).delete(e)}updatePath(e,n){C(this,ad).get(e).setAttribute("d",n.toSVGPath())}updateBox(e,n){var r;B(r=ts,Gw,YO).call(r,C(this,Mr).get(e),n)}show(e,n){C(this,Mr).get(e).classList.toggle("hidden",!n)}rotate(e,n){C(this,Mr).get(e).setAttribute("data-main-rotation",n)}changeColor(e,n){C(this,Mr).get(e).setAttribute("fill",n)}changeOpacity(e,n){C(this,Mr).get(e).setAttribute("fill-opacity",n)}addClass(e,n){C(this,Mr).get(e).classList.add(n)}removeClass(e,n){C(this,Mr).get(e).classList.remove(n)}remove(e){C(this,al)!==null&&(C(this,Mr).get(e).remove(),C(this,Mr).delete(e))}destroy(){$(this,al,null);for(const e of C(this,Mr).values())e.remove();C(this,Mr).clear()}};al=new WeakMap,Ww=new WeakMap,Mr=new WeakMap,ad=new WeakMap,Gw=new WeakSet,YO=function(e,{x:n=0,y:r=0,width:s=1,height:i=1}={}){const{style:a}=e;a.top=`${100*r}%`,a.left=`${100*n}%`,a.width=`${100*s}%`,a.height=`${100*i}%`},op=new WeakSet,XO=function(e){var r;const n=ts._svgFactory.create(1,1,!0);return C(this,al).append(n),n.setAttribute("aria-hidden",!0),B(r=ts,Gw,YO).call(r,n,e),n},gee=function(e,n){const r=ts._svgFactory.createElement("clipPath");e.append(r);const s=`clip_${n}`;r.setAttribute("id",s),r.setAttribute("clipPathUnits","objectBoundingBox");const i=ts._svgFactory.createElement("use");return r.append(i),i.setAttribute("href",`#${n}`),i.classList.add("clip"),s},z(ts,Gw);let KO=ts;var vFe=ft.AbortException,yFe=ft.AnnotationEditorLayer,bFe=ft.AnnotationEditorParamsType,wFe=ft.AnnotationEditorType,_Fe=ft.AnnotationEditorUIManager,vee=ft.AnnotationLayer,yee=ft.AnnotationMode,xFe=ft.CMapCompressionType,SFe=ft.ColorPicker,EFe=ft.DOMSVGFactory,CFe=ft.DrawLayer,AFe=ft.FeatureTest,K$=ft.GlobalWorkerOptions,RFe=ft.ImageKind,PFe=ft.InvalidPDFException,TFe=ft.MissingPDFException,kFe=ft.OPS,DFe=ft.Outliner,NFe=ft.PDFDataRangeTransport,OFe=ft.PDFDateString,MFe=ft.PDFWorker,LFe=ft.PasswordResponses,IFe=ft.PermissionFlag,$Fe=ft.PixelsPerInch,FFe=ft.RenderingCancelledException,bee=ft.TextLayer,jFe=ft.UnexpectedResponseException,zFe=ft.Util,BFe=ft.VerbosityLevel,UFe=ft.XfaLayer,HFe=ft.build,VFe=ft.createValidAbsoluteUrl,WFe=ft.fetchData,wee=ft.getDocument,GFe=ft.getFilenameFromUrl,qFe=ft.getPdfFilenameFromUrl,KFe=ft.getXfaPageViewport,YFe=ft.isDataScheme,XFe=ft.isPdfFile,QFe=ft.noContextMenu,ZFe=ft.normalizeUnicode,JFe=ft.renderTextLayer,eje=ft.setLayerDimensions,tje=ft.shadow,nje=ft.updateTextLayer,_ee=ft.version;const rje=Object.freeze(Object.defineProperty({__proto__:null,AbortException:vFe,AnnotationEditorLayer:yFe,AnnotationEditorParamsType:bFe,AnnotationEditorType:wFe,AnnotationEditorUIManager:_Fe,AnnotationLayer:vee,AnnotationMode:yee,CMapCompressionType:xFe,ColorPicker:SFe,DOMSVGFactory:EFe,DrawLayer:CFe,FeatureTest:AFe,GlobalWorkerOptions:K$,ImageKind:RFe,InvalidPDFException:PFe,MissingPDFException:TFe,OPS:kFe,Outliner:DFe,PDFDataRangeTransport:NFe,PDFDateString:OFe,PDFWorker:MFe,PasswordResponses:LFe,PermissionFlag:IFe,PixelsPerInch:$Fe,RenderingCancelledException:FFe,TextLayer:bee,UnexpectedResponseException:jFe,Util:zFe,VerbosityLevel:BFe,XfaLayer:UFe,build:HFe,createValidAbsoluteUrl:VFe,fetchData:WFe,getDocument:wee,getFilenameFromUrl:GFe,getPdfFilenameFromUrl:qFe,getXfaPageViewport:KFe,isDataScheme:YFe,isPdfFile:XFe,noContextMenu:QFe,normalizeUnicode:ZFe,renderTextLayer:JFe,setLayerDimensions:eje,shadow:tje,updateTextLayer:nje,version:_ee},Symbol.toStringTag,{value:"Module"}));var Wr=function(t,e,n){if(n||arguments.length===2)for(var r=0,s=e.length,i;r{An(this.pdfDocument),An(e),typeof e=="string"?this.pdfDocument.getDestination(e).then(n):Array.isArray(e)?n(e):e.then(n)}).then(n=>{An(Array.isArray(n));const r=n[0];new Promise(s=>{An(this.pdfDocument),r instanceof Object?this.pdfDocument.getPageIndex(r).then(i=>{s(i)}).catch(()=>{An(!1)}):typeof r=="number"?s(r):An(!1)}).then(s=>{const i=s+1;An(this.pdfViewer),An(i>=1&&i<=this.pagesCount),this.pdfViewer.scrollPageIntoView({dest:n,pageIndex:s,pageNumber:i})})})}navigateTo(e){this.goToDestination(e)}goToPage(e){const n=e-1;An(this.pdfViewer),An(e>=1&&e<=this.pagesCount),this.pdfViewer.scrollPageIntoView({pageIndex:n,pageNumber:e})}addLinkAttributes(e,n,r){e.href=n,e.rel=this.externalLinkRel||Cje,e.target=r?"_blank":this.externalLinkTarget||""}getDestinationHash(){return"#"}getAnchorUrl(){return"#"}setHash(){}executeNamedAction(){}cachePageRef(){}isPageVisible(){return!0}isPageCached(){return!0}executeSetOCGState(){}}const hU={NEED_PASSWORD:1,INCORRECT_PASSWORD:2},JA=typeof document<"u",Eee=JA&&window.location.protocol==="file:";function Rje(t){return typeof t<"u"}function af(t){return Rje(t)&&t!==null}function Pje(t){return typeof t=="string"}function Tje(t){return t instanceof ArrayBuffer}function kje(t){return An(JA),t instanceof Blob}function QO(t){return Pje(t)&&/^data:/.test(t)}function pU(t){An(QO(t));const[e="",n=""]=t.split(",");return e.split(";").indexOf("base64")!==-1?atob(n):unescape(n)}function Dje(){return JA&&window.devicePixelRatio||1}const Cee="On Chromium based browsers, you can use --allow-file-access-from-files flag for debugging purposes.";function mU(){Ps(!Eee,`Loading PDF as base64 strings/URLs may not work on protocols other than HTTP/HTTPS. ${Cee}`)}function Nje(){Ps(!Eee,`Loading PDF.js worker may not work on protocols other than HTTP/HTTPS. ${Cee}`)}function rp(t){t!=null&&t.cancel&&t.cancel()}function ZO(t,e){return Object.defineProperty(t,"width",{get(){return this.view[2]*e},configurable:!0}),Object.defineProperty(t,"height",{get(){return this.view[3]*e},configurable:!0}),Object.defineProperty(t,"originalWidth",{get(){return this.view[2]},configurable:!0}),Object.defineProperty(t,"originalHeight",{get(){return this.view[3]},configurable:!0}),t}function Oje(t){return t.name==="RenderingCancelledException"}function Mje(t){return new Promise((e,n)=>{const r=new FileReader;r.onload=()=>{if(!r.result)return n(new Error("Error while reading a file."));e(r.result)},r.onerror=s=>{if(!s.target)return n(new Error("Error while reading a file."));const{error:i}=s.target;if(!i)return n(new Error("Error while reading a file."));switch(i.code){case i.NOT_FOUND_ERR:return n(new Error("Error while reading a file: File not found."));case i.SECURITY_ERR:return n(new Error("Error while reading a file: Security error."));case i.ABORT_ERR:return n(new Error("Error while reading a file: Aborted."));default:return n(new Error("Error while reading a file."))}},r.readAsArrayBuffer(t)})}function Lje(t,e){switch(e.type){case"RESOLVE":return{value:e.value,error:void 0};case"REJECT":return{value:!1,error:e.error};case"RESET":return{value:void 0,error:void 0};default:return t}}function pv(){return _.useReducer(Lje,{value:void 0,error:void 0})}var Ije=function(t,e,n,r){function s(i){return i instanceof n?i:new n(function(a){a(i)})}return new(n||(n=Promise))(function(i,a){function o(f){try{u(r.next(f))}catch(l){a(l)}}function c(f){try{u(r.throw(f))}catch(l){a(l)}}function u(f){f.done?i(f.value):s(f.value).then(o,c)}u((r=r.apply(t,e||[])).next())})},gU=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(t);s{switch(e){case hU.NEED_PASSWORD:{const n=prompt("Enter the password to open this PDF file.");t(n);break}case hU.INCORRECT_PASSWORD:{const n=prompt("Invalid password. Please try again.");t(n);break}}};function vU(t){return typeof t=="object"&&t!==null&&("data"in t||"range"in t||"url"in t)}const jje=_.forwardRef(function(e,n){var{children:r,className:s,error:i="Failed to load PDF file.",externalLinkRel:a,externalLinkTarget:o,file:c,inputRef:u,imageResourcesPath:f,loading:l="Loading PDF…",noData:d="No PDF file specified.",onItemClick:m,onLoadError:p,onLoadProgress:h,onLoadSuccess:y,onPassword:g=Fje,onSourceError:v,onSourceSuccess:w,options:x,renderMode:A,rotate:k}=e,R=gU(e,["children","className","error","externalLinkRel","externalLinkTarget","file","inputRef","imageResourcesPath","loading","noData","onItemClick","onLoadError","onLoadProgress","onLoadSuccess","onPassword","onSourceError","onSourceSuccess","options","renderMode","rotate"]);const[E,T]=pv(),{value:D,error:O}=E,[L,I]=pv(),{value:F,error:U}=L,Y=_.useRef(new Aje),V=_.useRef([]),H=_.useRef(void 0),ee=_.useRef(void 0);c&&c!==H.current&&vU(c)&&(Ps(!Um(c,H.current),`File prop passed to changed, but it's equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "file" prop.`),H.current=c),x&&x!==ee.current&&(Ps(!Um(x,ee.current),`Options prop passed to changed, but it's equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "options" prop.`),ee.current=x);const re=_.useRef({scrollPageIntoView:ye=>{const{dest:$e,pageNumber:ut,pageIndex:Qe=ut-1}=ye;if(m){m({dest:$e,pageIndex:Qe,pageNumber:ut});return}const vt=V.current[Qe];if(vt){vt.scrollIntoView();return}Ps(!1,`An internal link leading to page ${ut} was clicked, but neither was provided with onItemClick nor it was able to find the page within itself. Either provide onItemClick to and handle navigating by yourself or ensure that all pages are rendered within .`)}});_.useImperativeHandle(n,()=>({linkService:Y,pages:V,viewer:re}),[]);function X(){w&&w()}function q(){O&&(Ps(!1,O.toString()),v&&v(O))}function K(){T({type:"RESET"})}_.useEffect(K,[c,T]);const Z=_.useCallback(()=>Ije(this,void 0,void 0,function*(){if(!c)return null;if(typeof c=="string")return QO(c)?{data:pU(c)}:(mU(),{url:c});if(c instanceof $je)return{range:c};if(Tje(c))return{data:c};if(JA&&kje(c))return{data:yield Mje(c)};if(An(typeof c=="object"),An(vU(c)),"url"in c&&typeof c.url=="string"){if(QO(c.url)){const{url:ye}=c,$e=gU(c,["url"]),ut=pU(ye);return Object.assign({data:ut},$e)}mU()}return c}),[c]);_.useEffect(()=>{const ye=j_(Z());return ye.promise.then($e=>{T({type:"RESOLVE",value:$e})}).catch($e=>{T({type:"REJECT",error:$e})}),()=>{rp(ye)}},[Z,T]),_.useEffect(()=>{if(!(typeof D>"u")){if(D===!1){q();return}X()}},[D]);function ue(){F&&(y&&y(F),V.current=new Array(F.numPages),Y.current.setDocument(F))}function de(){U&&(Ps(!1,U.toString()),p&&p(U))}_.useEffect(function(){I({type:"RESET"})},[I,D]),_.useEffect(function(){if(!D)return;const $e=Object.assign(Object.assign({},D),x),ut=wee($e);h&&(ut.onProgress=h),g&&(ut.onPassword=g);const Qe=ut;return Qe.promise.then(vt=>{I({type:"RESOLVE",value:vt})}).catch(vt=>{Qe.destroyed||I({type:"REJECT",error:vt})}),()=>{Qe.destroy()}},[x,I,D]),_.useEffect(()=>{if(!(typeof F>"u")){if(F===!1){de();return}ue()}},[F]),_.useEffect(function(){Y.current.setViewer(re.current),Y.current.setExternalLinkRel(a),Y.current.setExternalLinkTarget(o)},[a,o]);const ie=_.useCallback((ye,$e)=>{V.current[ye]=$e},[]),be=_.useCallback(ye=>{delete V.current[ye]},[]),Ae=_.useMemo(()=>({imageResourcesPath:f,linkService:Y.current,onItemClick:m,pdf:F,registerPage:ie,renderMode:A,rotate:k,unregisterPage:be}),[f,m,F,ie,A,k,be]),_e=_.useMemo(()=>xee(R,()=>F),[R,F]);function Me(){return P.jsx(See.Provider,{value:Ae,children:r})}function Ne(){return c?F==null?P.jsx(Hm,{type:"loading",children:typeof l=="function"?l():l}):F===!1?P.jsx(Hm,{type:"error",children:typeof i=="function"?i():i}):Me():P.jsx(Hm,{type:"no-data",children:typeof d=="function"?d():d})}return P.jsx("div",Object.assign({className:cp("react-pdf__Document",s),ref:u,style:{"--scale-factor":"1"}},_e,{children:Ne()}))});function Aee(){return _.useContext(See)}function Ree(){for(var t=[],e=0;eHje(e),[e]),r=_.useMemo(()=>!eR(e)||kee(e)?null:e.children.map((s,i)=>P.jsx(Nee,{node:s},i)),[e]);return P.jsx("span",Object.assign({className:t},n,{children:r}))}function tR(){return _.useContext(Pee)}function Vje(){const t=tR();An(t);const{onGetStructTreeError:e,onGetStructTreeSuccess:n}=t,[r,s]=pv(),{value:i,error:a}=r,{customTextRenderer:o,page:c}=t;function u(){i&&n&&n(i)}function f(){a&&(Ps(!1,a.toString()),e&&e(a))}return _.useEffect(function(){s({type:"RESET"})},[s,c]),_.useEffect(function(){if(o||!c)return;const d=j_(c.getStructTree()),m=d;return d.promise.then(p=>{s({type:"RESOLVE",value:p})}).catch(p=>{s({type:"REJECT",error:p})}),()=>rp(m)},[o,c,s]),_.useEffect(()=>{if(i!==void 0){if(i===!1){f();return}u()}},[i]),i?P.jsx(Nee,{className:"react-pdf__Page__structTree structTree",node:i}):null}const yU=yee;function Wje(t){const e=tR();An(e);const n=Object.assign(Object.assign({},e),t),{_className:r,canvasBackground:s,devicePixelRatio:i=Dje(),onRenderError:a,onRenderSuccess:o,page:c,renderForms:u,renderTextLayer:f,rotate:l,scale:d}=n,{canvasRef:m}=t;An(c);const p=_.useRef(null);function h(){c&&o&&o(ZO(c,d))}function y(x){Oje(x)||(Ps(!1,x.toString()),a&&a(x))}const g=_.useMemo(()=>c.getViewport({scale:d*i,rotation:l}),[i,c,l,d]),v=_.useMemo(()=>c.getViewport({scale:d,rotation:l}),[c,l,d]);_.useEffect(function(){if(!c)return;c.cleanup();const{current:A}=p;if(!A)return;A.width=g.width,A.height=g.height,A.style.width=`${Math.floor(v.width)}px`,A.style.height=`${Math.floor(v.height)}px`,A.style.visibility="hidden";const k={annotationMode:u?yU.ENABLE_FORMS:yU.ENABLE,canvasContext:A.getContext("2d",{alpha:!1}),viewport:g};s&&(k.background=s);const R=c.render(k),E=R;return R.promise.then(()=>{A.style.visibility="",h()}).catch(y),()=>rp(E)},[s,c,u,g,v]);const w=_.useCallback(()=>{const{current:x}=p;x&&(x.width=0,x.height=0)},[]);return _.useEffect(()=>w,[w]),P.jsx("canvas",{className:`${r}__canvas`,dir:"ltr",ref:Ree(m,p),style:{display:"block",userSelect:"none"},children:f?P.jsx(Vje,{}):null})}function Gje(t){return"str"in t}function qje(){const t=tR();An(t);const{customTextRenderer:e,onGetTextError:n,onGetTextSuccess:r,onRenderTextLayerError:s,onRenderTextLayerSuccess:i,page:a,pageIndex:o,pageNumber:c,rotate:u,scale:f}=t;An(a);const[l,d]=pv(),{value:m,error:p}=l,h=_.useRef(null),y=_.useRef(void 0);Ps(Number.parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-text-layer"),10)===1,"TextLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-text-layer");function g(){m&&r&&r(m)}function v(){p&&(Ps(!1,p.toString()),n&&n(p))}_.useEffect(function(){d({type:"RESET"})},[a,d]),_.useEffect(function(){if(!a)return;const T=j_(a.getTextContent()),D=T;return T.promise.then(O=>{d({type:"RESOLVE",value:O})}).catch(O=>{d({type:"REJECT",error:O})}),()=>rp(D)},[a,d]),_.useEffect(()=>{if(m!==void 0){if(m===!1){v();return}g()}},[m]);const w=_.useCallback(()=>{i&&i()},[i]),x=_.useCallback(E=>{Ps(!1,E.toString()),s&&s(E)},[s]);function A(){const E=y.current;E&&E.classList.add("active")}function k(){const E=y.current;E&&E.classList.remove("active")}const R=_.useMemo(()=>a.getViewport({scale:f,rotation:u}),[a,u,f]);return _.useLayoutEffect(function(){if(!a||!m)return;const{current:T}=h;if(!T)return;T.innerHTML="";const D=a.streamTextContent({includeMarkedContent:!0}),O={container:T,textContentSource:D,viewport:R},L=new bee(O),I=L;return L.render().then(()=>{const F=document.createElement("div");F.className="endOfContent",T.append(F),y.current=F;const U=T.querySelectorAll('[role="presentation"]');if(e){let Y=0;m.items.forEach((V,H)=>{if(!Gje(V))return;const ee=U[Y];if(!ee)return;const re=e(Object.assign({pageIndex:o,pageNumber:c,itemIndex:H},V));ee.innerHTML=re,Y+=V.str&&V.hasEOL?2:1})}w()}).catch(x),()=>rp(I)},[e,x,w,a,o,c,m,R]),P.jsx("div",{className:cp("react-pdf__Page__textContent","textLayer"),onMouseUp:k,onMouseDown:A,ref:h})}function Kje(){const t=Aee(),e=tR();An(e);const n=Object.assign(Object.assign({},t),e),{imageResourcesPath:r,linkService:s,onGetAnnotationsError:i,onGetAnnotationsSuccess:a,onRenderAnnotationLayerError:o,onRenderAnnotationLayerSuccess:c,page:u,pdf:f,renderForms:l,rotate:d,scale:m=1}=n;An(f),An(u),An(s);const[p,h]=pv(),{value:y,error:g}=p,v=_.useRef(null);Ps(Number.parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-annotation-layer"),10)===1,"AnnotationLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-annotations");function w(){y&&a&&a(y)}function x(){g&&(Ps(!1,g.toString()),i&&i(g))}_.useEffect(function(){h({type:"RESET"})},[h,u]),_.useEffect(function(){if(!u)return;const T=j_(u.getAnnotations()),D=T;return T.promise.then(O=>{h({type:"RESOLVE",value:O})}).catch(O=>{h({type:"REJECT",error:O})}),()=>{rp(D)}},[h,u]),_.useEffect(()=>{if(y!==void 0){if(y===!1){x();return}w()}},[y]);function A(){c&&c()}function k(E){Ps(!1,`${E}`),o&&o(E)}const R=_.useMemo(()=>u.getViewport({scale:m,rotation:d}),[u,d,m]);return _.useEffect(function(){if(!f||!u||!s||!y)return;const{current:T}=v;if(!T)return;const D=R.clone({dontFlip:!0}),O={accessibilityManager:null,annotationCanvasMap:null,annotationEditorUIManager:null,div:T,l10n:null,page:u,viewport:D},L={annotations:y,annotationStorage:f.annotationStorage,div:T,imageResourcesPath:r,linkService:s,page:u,renderForms:l,viewport:D};T.innerHTML="";try{new vee(O).render(L),A()}catch(I){k(I)}return()=>{}},[y,r,s,u,f,l,R]),P.jsx("div",{className:cp("react-pdf__Page__annotations","annotationLayer"),ref:v})}var Yje=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(t);s{if(!_e)return null;let xe=1;const Te=Z??bU;if(de||m){const Ye=_e.getViewport({scale:1,rotation:ut});de?xe=de/Ye.width:m&&(xe=m/Ye.height)}return Te*xe},[m,_e,ut,Z,de]);_.useEffect(function(){return()=>{af(ye)&&s&&ue&&ue(ye)}},[s,V,ye,ue]);function vt(){if(E){if(!_e||!Qe)return;E(ZO(_e,Qe))}if(s&&H){if(!af(ye)||!Ne.current)return;H(ye,Ne.current)}}function Sn(){Me&&(Ps(!1,Me.toString()),R&&R(Me))}_.useEffect(function(){Ae({type:"RESET"})},[Ae,V,ye]),_.useEffect(function(){if(!V||!$e)return;const Te=j_(V.getPage($e)),Ye=Te;return Te.promise.then(Rt=>{Ae({type:"RESOLVE",value:Rt})}).catch(Rt=>{Ae({type:"REJECT",error:Rt})}),()=>rp(Ye)},[Ae,V,$e]),_.useEffect(()=>{if(_e!==void 0){if(_e===!1){Sn();return}vt()}},[_e,Qe]);const Yt=_.useMemo(()=>_e&&af(ye)&&$e&&af(ut)&&af(Qe)?{_className:r,canvasBackground:i,customTextRenderer:f,devicePixelRatio:l,onGetAnnotationsError:g,onGetAnnotationsSuccess:v,onGetStructTreeError:w,onGetStructTreeSuccess:x,onGetTextError:A,onGetTextSuccess:k,onRenderAnnotationLayerError:T,onRenderAnnotationLayerSuccess:D,onRenderError:O,onRenderSuccess:L,onRenderTextLayerError:I,onRenderTextLayerSuccess:F,page:_e,pageIndex:ye,pageNumber:$e,renderForms:re,renderTextLayer:q,rotate:ut,scale:Qe}:null,[r,i,f,l,g,v,w,x,A,k,T,D,O,L,I,F,_e,ye,$e,re,q,ut,Qe]),mn=_.useMemo(()=>xee(ie,()=>_e&&(Qe?ZO(_e,Qe):void 0)),[ie,_e,Qe]),Xt=`${ye}@${Qe}/${ut}`;function J(){switch(X){case"custom":return An(u),P.jsx(u,{},`${Xt}_custom`);case"none":return null;case"canvas":default:return P.jsx(Wje,{canvasRef:a},`${Xt}_canvas`)}}function fe(){return q?P.jsx(qje,{},`${Xt}_text`):null}function ge(){return ee?P.jsx(Kje,{},`${Xt}_annotations`):null}function Pe(){return P.jsxs(Pee.Provider,{value:Yt,children:[J(),fe(),ge(),o]})}function Oe(){return $e?V===null||_e===void 0||_e===null?P.jsx(Hm,{type:"loading",children:typeof h=="function"?h():h}):V===!1||_e===!1?P.jsx(Hm,{type:"error",children:typeof d=="function"?d():d}):Pe():P.jsx(Hm,{type:"no-data",children:typeof y=="function"?y():y})}return P.jsx("div",Object.assign({className:cp(r,c),"data-page-number":$e,ref:Ree(p,Ne),style:{"--scale-factor":`${Qe}`,backgroundColor:i||"white",position:"relative",minWidth:"min-content",minHeight:"min-content"}},mn,{children:Oe()}))}Nje();K$.workerSrc="pdf.worker.mjs";K$.workerSrc=`//unpkg.com/pdfjs-dist@${_ee}/build/pdf.worker.min.mjs`;const Kp=800,Xje={},qUe=({file:t,onThumbnailClick:e,className:n})=>{const[r,s]=_.useState(0),[i,a]=_.useState(1),[o,c]=_.useState(void 0),[u,f]=_.useState(null),[l,d]=_.useState(),m=_.useCallback(A=>{const[k]=A;k&&d(k.contentRect.width)},[]);m$e(u,Xje,m);const p=_.useCallback(()=>{c(i)},[c,i]);function h({numPages:A}){a(1),s(A)}const y=_.useCallback(A=>a(k=>A>0?Math.min(k+A,r):Math.max(k+A,1)),[r]),g=_.useCallback(()=>y(1),[y]),v=_.useCallback(()=>y(-1),[y]),w=_.useMemo(()=>o!==i,[o,i]),x=_.useMemo(()=>({cMapUrl:"/cmaps/",standardFontDataUrl:"/standard_fonts/"}),[]);return P.jsxs("div",{className:ce("flex flex-col cursor-default text-center",n),ref:f,children:[P.jsxs(jje,{file:t,onLoadSuccess:h,loading:P.jsx(wZ,{className:"w-full mx-auto mt-32"}),options:x,className:ce(`w-full aspect-[3/4] relative bg-white shadow w-[${l?Math.min(l,Kp):Kp}]`,e?"cursor-pointer":""),children:[P.jsx(wU,{className:w&&o?"visible":"hidden",pageNumber:o,canvasBackground:"white",width:l?Math.min(l,Kp):Kp,onClick:()=>e?e():null},`page_${o}`),P.jsx(wU,{className:ce(w&&o?"hidden":"visible","text-center"),pageNumber:i,canvasBackground:"white",onRenderSuccess:p,width:l?Math.min(l,Kp):Kp,onClick:()=>e?e():null},i)]}),P.jsxs("div",{className:"flex flex-row justify-center w-full mt-4 space-x-4",children:[P.jsxs(no,{type:"button",variant:"outline",className:"w-8 h-8 p-0",onClick:v,disabled:w,children:[P.jsx("span",{className:"sr-only",children:tr("common.go_to_prev_page")}),P.jsx(dL,{className:"w-4 h-4"})]}),P.jsxs(no,{type:"button",variant:"outline",className:"w-8 h-8 p-0",onClick:g,disabled:w,children:[P.jsx("span",{className:"sr-only",children:tr("common.go_to_next_page")}),P.jsx(n_,{className:"w-4 h-4"})]})]}),P.jsx("p",{className:"mt-4 text-sm font-medium text-center",children:tr("common.num_page_of_total",{count:i,total:r})})]})},_U=({children:t})=>{const e=Ud(),n=_.useId(),{isSuccess:r,isLoading:s,data:{authenticated:i=!1,redirectTo:a="/login"}={}}=$de(),{isSuccess:o,isLoading:c,isFetching:u,error:f,data:l}=jV({enabled:r&&i});return s||c||o&&l===null&&u?P.jsx(xs,{}):f?(console.error("Error loading profile:",f),P.jsx(aZ,{subtitle:f.message})):r&&!i||o&&!(l!=null&&l.id)?(console.debug("Not authenticated, redirecting to:",a),P.jsx(wQ,{to:a,state:{from:e},replace:!0})):P.jsx("div",{id:`${n}-${l==null?void 0:l.lang_code}`,children:t??null})},AS={draft:{color:"text-gray-700",bgColor:"bg-gray-200",hoverColor:"hover:text-gray-900",hoverBgColor:"hover:bg-gray-300"},ready:{color:"text-blue-700",bgColor:"bg-blue-200",hoverColor:"hover:text-blue-900",hoverBgColor:"hover:bg-blue-300"},delivered:{color:"text-yellow-700",bgColor:"bg-yellow-200",hoverColor:"hover:text-yellow-900",hoverBgColor:"hover:bg-yellow-300"},accepted:{color:"text-green-700",bgColor:"bg-green-200",hoverColor:"hover:text-green-900",hoverBgColor:"hover:bg-green-300"},rejected:{color:"text-red-700",bgColor:"bg-red-200",hoverColor:"hover:text-red-900",hoverBgColor:"hover:bg-red-300"},archived:{color:"text-purple-700",bgColor:"bg-purple-200",hoverColor:"hover:text-purple-900",hoverBgColor:"hover:bg-purple-300"}},KUe=_.forwardRef(({status:t,isEditable:e,className:n,...r},s)=>P.jsx("div",{ref:s,children:P.jsxs(Bpe,{className:ce(AS[t].bgColor,AS[t].color,AS[t].hoverBgColor,AS[t].hoverColor,"transition-colors duration-200 cursor-pointer flex items-center group",n),...r,children:[tr(`quotes.status.${t}`),e&&P.jsx(Pfe,{className:"w-3 h-3 ml-2 transition-opacity opacity-0 group-hover:opacity-100"})]})}));function Qje(){return null}var Y$={},z_={},Oee={exports:{}};function Zje(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var fk={exports:{}};const Jje={},sb=Object.freeze(Object.defineProperty({__proto__:null,default:Jje},Symbol.toStringTag,{value:"Module"})),e3e=ble(sb);var xU;function Vd(){return xU||(xU=1,function(t,e){(function(n,r){t.exports=r()})(yr,function(){var n=n||function(r,s){var i;if(typeof window<"u"&&window.crypto&&(i=window.crypto),typeof self<"u"&&self.crypto&&(i=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(i=globalThis.crypto),!i&&typeof window<"u"&&window.msCrypto&&(i=window.msCrypto),!i&&typeof yr<"u"&&yr.crypto&&(i=yr.crypto),!i&&typeof Zje=="function")try{i=e3e}catch{}var a=function(){if(i){if(typeof i.getRandomValues=="function")try{return i.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof i.randomBytes=="function")try{return i.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},o=Object.create||function(){function v(){}return function(w){var x;return v.prototype=w,x=new v,v.prototype=null,x}}(),c={},u=c.lib={},f=u.Base=function(){return{extend:function(v){var w=o(this);return v&&w.mixIn(v),(!w.hasOwnProperty("init")||this.init===w.init)&&(w.init=function(){w.$super.init.apply(this,arguments)}),w.init.prototype=w,w.$super=this,w},create:function(){var v=this.extend();return v.init.apply(v,arguments),v},init:function(){},mixIn:function(v){for(var w in v)v.hasOwnProperty(w)&&(this[w]=v[w]);v.hasOwnProperty("toString")&&(this.toString=v.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),l=u.WordArray=f.extend({init:function(v,w){v=this.words=v||[],w!=s?this.sigBytes=w:this.sigBytes=v.length*4},toString:function(v){return(v||m).stringify(this)},concat:function(v){var w=this.words,x=v.words,A=this.sigBytes,k=v.sigBytes;if(this.clamp(),A%4)for(var R=0;R>>2]>>>24-R%4*8&255;w[A+R>>>2]|=E<<24-(A+R)%4*8}else for(var T=0;T>>2]=x[T>>>2];return this.sigBytes+=k,this},clamp:function(){var v=this.words,w=this.sigBytes;v[w>>>2]&=4294967295<<32-w%4*8,v.length=r.ceil(w/4)},clone:function(){var v=f.clone.call(this);return v.words=this.words.slice(0),v},random:function(v){for(var w=[],x=0;x>>2]>>>24-k%4*8&255;A.push((R>>>4).toString(16)),A.push((R&15).toString(16))}return A.join("")},parse:function(v){for(var w=v.length,x=[],A=0;A>>3]|=parseInt(v.substr(A,2),16)<<24-A%8*4;return new l.init(x,w/2)}},p=d.Latin1={stringify:function(v){for(var w=v.words,x=v.sigBytes,A=[],k=0;k>>2]>>>24-k%4*8&255;A.push(String.fromCharCode(R))}return A.join("")},parse:function(v){for(var w=v.length,x=[],A=0;A>>2]|=(v.charCodeAt(A)&255)<<24-A%4*8;return new l.init(x,w)}},h=d.Utf8={stringify:function(v){try{return decodeURIComponent(escape(p.stringify(v)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(v){return p.parse(unescape(encodeURIComponent(v)))}},y=u.BufferedBlockAlgorithm=f.extend({reset:function(){this._data=new l.init,this._nDataBytes=0},_append:function(v){typeof v=="string"&&(v=h.parse(v)),this._data.concat(v),this._nDataBytes+=v.sigBytes},_process:function(v){var w,x=this._data,A=x.words,k=x.sigBytes,R=this.blockSize,E=R*4,T=k/E;v?T=r.ceil(T):T=r.max((T|0)-this._minBufferSize,0);var D=T*R,O=r.min(D*4,k);if(D){for(var L=0;L>>2]>>>24-m%4*8&255,h=u[m+1>>>2]>>>24-(m+1)%4*8&255,y=u[m+2>>>2]>>>24-(m+2)%4*8&255,g=p<<16|h<<8|y,v=0;v<4&&m+v*.75>>6*(3-v)&63));var w=l.charAt(64);if(w)for(;d.length%4;)d.push(w);return d.join("")},parse:function(c){var u=c.length,f=this._map,l=this._reverseMap;if(!l){l=this._reverseMap=[];for(var d=0;d>>6-m%4*2,y=p|h;l[d>>>2]|=y<<24-d%4*8,d++}return i.create(l,d)}}(),n.enc.Base64})}(hk)),hk.exports}var pk={exports:{}},EU;function r3e(){return EU||(EU=1,function(t,e){(function(n,r){t.exports=r(Vd())})(yr,function(n){return function(r){var s=n,i=s.lib,a=i.WordArray,o=i.Hasher,c=s.algo,u=[];(function(){for(var h=0;h<64;h++)u[h]=r.abs(r.sin(h+1))*4294967296|0})();var f=c.MD5=o.extend({_doReset:function(){this._hash=new a.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(h,y){for(var g=0;g<16;g++){var v=y+g,w=h[v];h[v]=(w<<8|w>>>24)&16711935|(w<<24|w>>>8)&4278255360}var x=this._hash.words,A=h[y+0],k=h[y+1],R=h[y+2],E=h[y+3],T=h[y+4],D=h[y+5],O=h[y+6],L=h[y+7],I=h[y+8],F=h[y+9],U=h[y+10],Y=h[y+11],V=h[y+12],H=h[y+13],ee=h[y+14],re=h[y+15],X=x[0],q=x[1],K=x[2],Z=x[3];X=l(X,q,K,Z,A,7,u[0]),Z=l(Z,X,q,K,k,12,u[1]),K=l(K,Z,X,q,R,17,u[2]),q=l(q,K,Z,X,E,22,u[3]),X=l(X,q,K,Z,T,7,u[4]),Z=l(Z,X,q,K,D,12,u[5]),K=l(K,Z,X,q,O,17,u[6]),q=l(q,K,Z,X,L,22,u[7]),X=l(X,q,K,Z,I,7,u[8]),Z=l(Z,X,q,K,F,12,u[9]),K=l(K,Z,X,q,U,17,u[10]),q=l(q,K,Z,X,Y,22,u[11]),X=l(X,q,K,Z,V,7,u[12]),Z=l(Z,X,q,K,H,12,u[13]),K=l(K,Z,X,q,ee,17,u[14]),q=l(q,K,Z,X,re,22,u[15]),X=d(X,q,K,Z,k,5,u[16]),Z=d(Z,X,q,K,O,9,u[17]),K=d(K,Z,X,q,Y,14,u[18]),q=d(q,K,Z,X,A,20,u[19]),X=d(X,q,K,Z,D,5,u[20]),Z=d(Z,X,q,K,U,9,u[21]),K=d(K,Z,X,q,re,14,u[22]),q=d(q,K,Z,X,T,20,u[23]),X=d(X,q,K,Z,F,5,u[24]),Z=d(Z,X,q,K,ee,9,u[25]),K=d(K,Z,X,q,E,14,u[26]),q=d(q,K,Z,X,I,20,u[27]),X=d(X,q,K,Z,H,5,u[28]),Z=d(Z,X,q,K,R,9,u[29]),K=d(K,Z,X,q,L,14,u[30]),q=d(q,K,Z,X,V,20,u[31]),X=m(X,q,K,Z,D,4,u[32]),Z=m(Z,X,q,K,I,11,u[33]),K=m(K,Z,X,q,Y,16,u[34]),q=m(q,K,Z,X,ee,23,u[35]),X=m(X,q,K,Z,k,4,u[36]),Z=m(Z,X,q,K,T,11,u[37]),K=m(K,Z,X,q,L,16,u[38]),q=m(q,K,Z,X,U,23,u[39]),X=m(X,q,K,Z,H,4,u[40]),Z=m(Z,X,q,K,A,11,u[41]),K=m(K,Z,X,q,E,16,u[42]),q=m(q,K,Z,X,O,23,u[43]),X=m(X,q,K,Z,F,4,u[44]),Z=m(Z,X,q,K,V,11,u[45]),K=m(K,Z,X,q,re,16,u[46]),q=m(q,K,Z,X,R,23,u[47]),X=p(X,q,K,Z,A,6,u[48]),Z=p(Z,X,q,K,L,10,u[49]),K=p(K,Z,X,q,ee,15,u[50]),q=p(q,K,Z,X,D,21,u[51]),X=p(X,q,K,Z,V,6,u[52]),Z=p(Z,X,q,K,E,10,u[53]),K=p(K,Z,X,q,U,15,u[54]),q=p(q,K,Z,X,k,21,u[55]),X=p(X,q,K,Z,I,6,u[56]),Z=p(Z,X,q,K,re,10,u[57]),K=p(K,Z,X,q,O,15,u[58]),q=p(q,K,Z,X,H,21,u[59]),X=p(X,q,K,Z,T,6,u[60]),Z=p(Z,X,q,K,Y,10,u[61]),K=p(K,Z,X,q,R,15,u[62]),q=p(q,K,Z,X,F,21,u[63]),x[0]=x[0]+X|0,x[1]=x[1]+q|0,x[2]=x[2]+K|0,x[3]=x[3]+Z|0},_doFinalize:function(){var h=this._data,y=h.words,g=this._nDataBytes*8,v=h.sigBytes*8;y[v>>>5]|=128<<24-v%32;var w=r.floor(g/4294967296),x=g;y[(v+64>>>9<<4)+15]=(w<<8|w>>>24)&16711935|(w<<24|w>>>8)&4278255360,y[(v+64>>>9<<4)+14]=(x<<8|x>>>24)&16711935|(x<<24|x>>>8)&4278255360,h.sigBytes=(y.length+1)*4,this._process();for(var A=this._hash,k=A.words,R=0;R<4;R++){var E=k[R];k[R]=(E<<8|E>>>24)&16711935|(E<<24|E>>>8)&4278255360}return A},clone:function(){var h=o.clone.call(this);return h._hash=this._hash.clone(),h}});function l(h,y,g,v,w,x,A){var k=h+(y&g|~y&v)+w+A;return(k<>>32-x)+y}function d(h,y,g,v,w,x,A){var k=h+(y&v|g&~v)+w+A;return(k<>>32-x)+y}function m(h,y,g,v,w,x,A){var k=h+(y^g^v)+w+A;return(k<>>32-x)+y}function p(h,y,g,v,w,x,A){var k=h+(g^(y|~v))+w+A;return(k<>>32-x)+y}s.MD5=o._createHelper(f),s.HmacMD5=o._createHmacHelper(f)}(Math),n.MD5})}(pk)),pk.exports}var mk={exports:{}},gk={exports:{}},CU;function s3e(){return CU||(CU=1,function(t,e){(function(n,r){t.exports=r(Vd())})(yr,function(n){return function(){var r=n,s=r.lib,i=s.WordArray,a=s.Hasher,o=r.algo,c=[],u=o.SHA1=a.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(f,l){for(var d=this._hash.words,m=d[0],p=d[1],h=d[2],y=d[3],g=d[4],v=0;v<80;v++){if(v<16)c[v]=f[l+v]|0;else{var w=c[v-3]^c[v-8]^c[v-14]^c[v-16];c[v]=w<<1|w>>>31}var x=(m<<5|m>>>27)+g+c[v];v<20?x+=(p&h|~p&y)+1518500249:v<40?x+=(p^h^y)+1859775393:v<60?x+=(p&h|p&y|h&y)-1894007588:x+=(p^h^y)-899497514,g=y,y=h,h=p<<30|p>>>2,p=m,m=x}d[0]=d[0]+m|0,d[1]=d[1]+p|0,d[2]=d[2]+h|0,d[3]=d[3]+y|0,d[4]=d[4]+g|0},_doFinalize:function(){var f=this._data,l=f.words,d=this._nDataBytes*8,m=f.sigBytes*8;return l[m>>>5]|=128<<24-m%32,l[(m+64>>>9<<4)+14]=Math.floor(d/4294967296),l[(m+64>>>9<<4)+15]=d,f.sigBytes=l.length*4,this._process(),this._hash},clone:function(){var f=a.clone.call(this);return f._hash=this._hash.clone(),f}});r.SHA1=a._createHelper(u),r.HmacSHA1=a._createHmacHelper(u)}(),n.SHA1})}(gk)),gk.exports}var vk={exports:{}},AU;function i3e(){return AU||(AU=1,function(t,e){(function(n,r){t.exports=r(Vd())})(yr,function(n){(function(){var r=n,s=r.lib,i=s.Base,a=r.enc,o=a.Utf8,c=r.algo;c.HMAC=i.extend({init:function(u,f){u=this._hasher=new u.init,typeof f=="string"&&(f=o.parse(f));var l=u.blockSize,d=l*4;f.sigBytes>d&&(f=u.finalize(f)),f.clamp();for(var m=this._oKey=f.clone(),p=this._iKey=f.clone(),h=m.words,y=p.words,g=0;g>>2]&255;D.sigBytes-=O}};i.BlockCipher=m.extend({cfg:m.cfg.extend({mode:y,padding:v}),reset:function(){var D;m.reset.call(this);var O=this.cfg,L=O.iv,I=O.mode;this._xformMode==this._ENC_XFORM_MODE?D=I.createEncryptor:(D=I.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==D?this._mode.init(this,L&&L.words):(this._mode=D.call(I,this,L&&L.words),this._mode.__creator=D)},_doProcessBlock:function(D,O){this._mode.processBlock(D,O)},_doFinalize:function(){var D,O=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(O.pad(this._data,this.blockSize),D=this._process(!0)):(D=this._process(!0),O.unpad(D)),D},blockSize:128/32});var w=i.CipherParams=a.extend({init:function(D){this.mixIn(D)},toString:function(D){return(D||this.formatter).stringify(this)}}),x=s.format={},A=x.OpenSSL={stringify:function(D){var O,L=D.ciphertext,I=D.salt;return I?O=o.create([1398893684,1701076831]).concat(I).concat(L):O=L,O.toString(f)},parse:function(D){var O,L=f.parse(D),I=L.words;return I[0]==1398893684&&I[1]==1701076831&&(O=o.create(I.slice(2,4)),I.splice(0,4),L.sigBytes-=16),w.create({ciphertext:L,salt:O})}},k=i.SerializableCipher=a.extend({cfg:a.extend({format:A}),encrypt:function(D,O,L,I){I=this.cfg.extend(I);var F=D.createEncryptor(L,I),U=F.finalize(O),Y=F.cfg;return w.create({ciphertext:U,key:L,iv:Y.iv,algorithm:D,mode:Y.mode,padding:Y.padding,blockSize:D.blockSize,formatter:I.format})},decrypt:function(D,O,L,I){I=this.cfg.extend(I),O=this._parse(O,I.format);var F=D.createDecryptor(L,I).finalize(O.ciphertext);return F},_parse:function(D,O){return typeof D=="string"?O.parse(D,this):D}}),R=s.kdf={},E=R.OpenSSL={execute:function(D,O,L,I,F){if(I||(I=o.random(64/8)),F)var U=d.create({keySize:O+L,hasher:F}).compute(D,I);else var U=d.create({keySize:O+L}).compute(D,I);var Y=o.create(U.words.slice(O),L*4);return U.sigBytes=O*4,w.create({key:U,iv:Y,salt:I})}},T=i.PasswordBasedCipher=k.extend({cfg:k.cfg.extend({kdf:E}),encrypt:function(D,O,L,I){I=this.cfg.extend(I);var F=I.kdf.execute(L,D.keySize,D.ivSize,I.salt,I.hasher);I.iv=F.iv;var U=k.encrypt.call(this,D,O,F.key,I);return U.mixIn(F),U},decrypt:function(D,O,L,I){I=this.cfg.extend(I),O=this._parse(O,I.format);var F=I.kdf.execute(L,D.keySize,D.ivSize,O.salt,I.hasher);I.iv=F.iv;var U=k.decrypt.call(this,D,O,F.key,I);return U}})}()})}(yk)),yk.exports}(function(t,e){(function(n,r,s){t.exports=r(Vd(),n3e(),r3e(),Lee(),o3e())})(yr,function(n){return function(){var r=n,s=r.lib,i=s.BlockCipher,a=r.algo,o=[],c=[],u=[],f=[],l=[],d=[],m=[],p=[],h=[],y=[];(function(){for(var w=[],x=0;x<256;x++)x<128?w[x]=x<<1:w[x]=x<<1^283;for(var A=0,k=0,x=0;x<256;x++){var R=k^k<<1^k<<2^k<<3^k<<4;R=R>>>8^R&255^99,o[A]=R,c[R]=A;var E=w[A],T=w[E],D=w[T],O=w[R]*257^R*16843008;u[A]=O<<24|O>>>8,f[A]=O<<16|O>>>16,l[A]=O<<8|O>>>24,d[A]=O;var O=D*16843009^T*65537^E*257^A*16843008;m[R]=O<<24|O>>>8,p[R]=O<<16|O>>>16,h[R]=O<<8|O>>>24,y[R]=O,A?(A=E^w[w[w[D^E]]],k^=w[w[k]]):A=k=1}})();var g=[0,1,2,4,8,16,32,64,128,27,54],v=a.AES=i.extend({_doReset:function(){var w;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var x=this._keyPriorReset=this._key,A=x.words,k=x.sigBytes/4,R=this._nRounds=k+6,E=(R+1)*4,T=this._keySchedule=[],D=0;D6&&D%k==4&&(w=o[w>>>24]<<24|o[w>>>16&255]<<16|o[w>>>8&255]<<8|o[w&255]):(w=w<<8|w>>>24,w=o[w>>>24]<<24|o[w>>>16&255]<<16|o[w>>>8&255]<<8|o[w&255],w^=g[D/k|0]<<24),T[D]=T[D-k]^w);for(var O=this._invKeySchedule=[],L=0;L>>24]]^p[o[w>>>16&255]]^h[o[w>>>8&255]]^y[o[w&255]]}}},encryptBlock:function(w,x){this._doCryptBlock(w,x,this._keySchedule,u,f,l,d,o)},decryptBlock:function(w,x){var A=w[x+1];w[x+1]=w[x+3],w[x+3]=A,this._doCryptBlock(w,x,this._invKeySchedule,m,p,h,y,c);var A=w[x+1];w[x+1]=w[x+3],w[x+3]=A},_doCryptBlock:function(w,x,A,k,R,E,T,D){for(var O=this._nRounds,L=w[x]^A[0],I=w[x+1]^A[1],F=w[x+2]^A[2],U=w[x+3]^A[3],Y=4,V=1;V>>24]^R[I>>>16&255]^E[F>>>8&255]^T[U&255]^A[Y++],ee=k[I>>>24]^R[F>>>16&255]^E[U>>>8&255]^T[L&255]^A[Y++],re=k[F>>>24]^R[U>>>16&255]^E[L>>>8&255]^T[I&255]^A[Y++],X=k[U>>>24]^R[L>>>16&255]^E[I>>>8&255]^T[F&255]^A[Y++];L=H,I=ee,F=re,U=X}var H=(D[L>>>24]<<24|D[I>>>16&255]<<16|D[F>>>8&255]<<8|D[U&255])^A[Y++],ee=(D[I>>>24]<<24|D[F>>>16&255]<<16|D[U>>>8&255]<<8|D[L&255])^A[Y++],re=(D[F>>>24]<<24|D[U>>>16&255]<<16|D[L>>>8&255]<<8|D[I&255])^A[Y++],X=(D[U>>>24]<<24|D[L>>>16&255]<<16|D[I>>>8&255]<<8|D[F&255])^A[Y++];w[x]=H,w[x+1]=ee,w[x+2]=re,w[x+3]=X},keySize:256/32});r.AES=i._createHelper(v)}(),n.AES})})(Mee);var a3e=Mee.exports,nR={},B_={},qs={};Object.defineProperty(B_,"__esModule",{value:!0});B_.default=void 0;var l3e=function(){var e=null;try{typeof Cypress<"u"?e=Cypress.env("SECURE_LOCAL_STORAGE_HASH_KEY")||Cypress.env("REACT_APP_SECURE_LOCAL_STORAGE_HASH_KEY")||Cypress.env("NEXT_PUBLIC_SECURE_LOCAL_STORAGE_HASH_KEY")||Cypress.env("VITE_SECURE_LOCAL_STORAGE_HASH_KEY"):typeof qs<"u"?e=qs.SECURE_LOCAL_STORAGE_HASH_KEY||qs.REACT_APP_SECURE_LOCAL_STORAGE_HASH_KEY||qs.NEXT_PUBLIC_SECURE_LOCAL_STORAGE_HASH_KEY||qs.VITE_SECURE_LOCAL_STORAGE_HASH_KEY:console.warn("react-secure-storage : process is not defined! Just a warning!")}catch{return null}return e},c3e=function(){var e=null;try{typeof Cypress<"u"?e=Cypress.env("SECURE_LOCAL_STORAGE_PREFIX")||Cypress.env("REACT_APP_SECURE_LOCAL_STORAGE_PREFIX")||Cypress.env("NEXT_PUBLIC_SECURE_LOCAL_STORAGE_PREFIX")||Cypress.env("VITE_SECURE_LOCAL_STORAGE_PREFIX"):typeof qs<"u"?e=qs.SECURE_LOCAL_STORAGE_PREFIX||qs.REACT_APP_SECURE_LOCAL_STORAGE_PREFIX||qs.NEXT_PUBLIC_SECURE_LOCAL_STORAGE_PREFIX||qs.VITE_SECURE_LOCAL_STORAGE_PREFIX:console.warn("react-secure-storage : process is not defined! Just a warning!")}catch{return null}return e},u3e=function(){var e=null;try{typeof Cypress<"u"?e=Cypress.env("SECURE_LOCAL_STORAGE_DISABLED_KEYS")||Cypress.env("REACT_APP_SECURE_LOCAL_STORAGE_DISABLED_KEYS")||Cypress.env("NEXT_PUBLIC_SECURE_LOCAL_STORAGE_DISABLED_KEYS")||Cypress.env("VITE_SECURE_LOCAL_STORAGE_DISABLED_KEYS"):typeof qs<"u"?e=qs.SECURE_LOCAL_STORAGE_DISABLED_KEYS||qs.REACT_APP_SECURE_LOCAL_STORAGE_DISABLED_KEYS||qs.NEXT_PUBLIC_SECURE_LOCAL_STORAGE_DISABLED_KEYS||qs.VITE_SECURE_LOCAL_STORAGE_DISABLED_KEYS:console.warn("react-secure-storage : process is not defined! Just a warning!")}catch{return null}return e},d3e={getHashKey:l3e,getStoragePrefix:c3e,getDisabledKeys:u3e},f3e=d3e;B_.default=f3e;var rR={},Iee={exports:{}};(function(t){function e(n,r){var s,i,a,o,c,u,f,l;for(s=n.length&3,i=n.length-s,a=r,c=3432918353,u=461845907,l=0;l>>16)*c&65535)<<16)&4294967295,f=f<<15|f>>>17,f=(f&65535)*u+(((f>>>16)*u&65535)<<16)&4294967295,a^=f,a=a<<13|a>>>19,o=(a&65535)*5+(((a>>>16)*5&65535)<<16)&4294967295,a=(o&65535)+27492+(((o>>>16)+58964&65535)<<16);switch(f=0,s){case 3:f^=(n.charCodeAt(l+2)&255)<<16;case 2:f^=(n.charCodeAt(l+1)&255)<<8;case 1:f^=n.charCodeAt(l)&255,f=(f&65535)*c+(((f>>>16)*c&65535)<<16)&4294967295,f=f<<15|f>>>17,f=(f&65535)*u+(((f>>>16)*u&65535)<<16)&4294967295,a^=f}return a^=n.length,a^=a>>>16,a=(a&65535)*2246822507+(((a>>>16)*2246822507&65535)<<16)&4294967295,a^=a>>>13,a=(a&65535)*3266489909+(((a>>>16)*3266489909&65535)<<16)&4294967295,a^=a>>>16,a>>>0}t.exports=e})(Iee);var h3e=Iee.exports,ml={};Object.defineProperty(ml,"__esModule",{value:!0});ml.getSecurePrefix=ml.getDisabledKeys=ml.FINGERPRINT_KEYS=void 0;var $ee=p3e(B_);function p3e(t){return t&&t.__esModule?t:{default:t}}var m3e=function(){var e=$ee.default.getStoragePrefix()||"@secure.";return e.endsWith(".")?e:e+"."};ml.getSecurePrefix=m3e;var Fi={USERAGENT:"UserAgent",SCREEN_PRINT:"ScreenPrint",PLUGINS:"Plugins",FONTS:"Fonts",LOCAL_STORAGE:"LocalStorage",SESSION_STORAGE:"SessionStorage",TIMEZONE:"TimeZone",LANGUAGE:"Language",SYSTEM_LANGUAGE:"SystemLanguage",COOKIE:"Cookie",CANVAS:"Canvas",HOSTNAME:"Hostname"};ml.FINGERPRINT_KEYS=Fi;var g3e=function(){var e=$ee.default.getDisabledKeys()||"";if(e==="")return[];var n=[Fi.USERAGENT,Fi.SCREEN_PRINT,Fi.PLUGINS,Fi.FONTS,Fi.LOCAL_STORAGE,Fi.SESSION_STORAGE,Fi.TIMEZONE,Fi.LANGUAGE,Fi.SYSTEM_LANGUAGE,Fi.COOKIE,Fi.CANVAS,Fi.HOSTNAME],r=[];return e.split("|").forEach(function(s){s===""||(n.includes(s)?r.push(s):console.warn("react-secure-storage : ".concat(s," is not present in the available disabled keys options! Please go through the documentation")))}),r};ml.getDisabledKeys=g3e;Object.defineProperty(rR,"__esModule",{value:!0});rR.default=void 0;var v3e=y3e(h3e),Ii=ml;function y3e(t){return t&&t.__esModule?t:{default:t}}function b3e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function w3e(t,e){for(var n=0;n"u"?e:A3e.default.getFingerprint()+e},T3e=P3e;nR.default=T3e;Object.defineProperty(z_,"__esModule",{value:!0});z_.default=void 0;var k3e=X$(t3e),TU=X$(a3e),D3e=X$(nR);function X$(t){return t&&t.__esModule?t:{default:t}}function N3e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function O3e(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);nnull},oze=_.createContext(ize);function aze({children:t,defaultTheme:e="system",storageKey:n="vite-ui-theme",...r}){const[s,i]=_.useState(()=>Ao.getItem(n)||e);_.useEffect(()=>{const o=window.document.documentElement;if(o.classList.remove("light","dark"),s==="system"){const c=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";o.classList.add(c);return}o.classList.add(s)},[s]);const a={theme:s,setTheme:o=>{Ao.setItem(n,o),i(o)}};return P.jsx(oze.Provider,{...r,value:a,children:t})}const lze=_.createContext(null),zee=({children:t})=>{const[e,n]=_.useState(null),[r,s]=_.useState(!1),i=_.useCallback(u=>{n(u),s(!0)},[s,n]),a=()=>{var u;(u=e==null?void 0:e.onConfirm)==null||u.call(e),s(!1)},o=()=>{var u;(u=e==null?void 0:e.onCancel)==null||u.call(e),s(!1)},c=_.useMemo(()=>({show:i}),[i]);return P.jsxs(lze.Provider,{value:c,children:[t,P.jsx(_Q,{onCancel:()=>{o()},onConfirm:()=>a(),title:e==null?void 0:e.title,description:e==null?void 0:e.subtitle,confirmLabel:e==null?void 0:e.confirmText,cancelLabel:e==null?void 0:e.cancelText,isOpen:r})]})},cze=_.lazy(()=>Xr(()=>import("./index-DP3f1470.js"),__vite__mapDeps([0,1])).then(t=>({default:t.DealerLayout}))),uze=_.lazy(()=>Xr(()=>import("./index-DP3f1470.js"),__vite__mapDeps([0,1])).then(t=>({default:t.DealersList}))),dze=_.lazy(()=>Xr(()=>import("./index-DP3f1470.js"),__vite__mapDeps([0,1])).then(t=>({default:t.ErrorPage}))),fze=_.lazy(()=>Xr(()=>import("./index-DP3f1470.js"),__vite__mapDeps([0,1])).then(t=>({default:t.LoginPageWithLanguageSelector}))),hze=_.lazy(()=>Xr(()=>import("./index-DP3f1470.js"),__vite__mapDeps([0,1])).then(t=>({default:t.LogoutPage}))),pze=_.lazy(()=>Xr(()=>import("./index-DP3f1470.js"),__vite__mapDeps([0,1])).then(t=>({default:t.QuoteCreate}))),mze=_.lazy(()=>Xr(()=>import("./index-DP3f1470.js"),__vite__mapDeps([0,1])).then(t=>({default:t.QuoteEdit}))),gze=_.lazy(()=>Xr(()=>import("./index-DP3f1470.js"),__vite__mapDeps([0,1])).then(t=>({default:t.SettingsEditor}))),vze=_.lazy(()=>Xr(()=>import("./index-DP3f1470.js"),__vite__mapDeps([0,1])).then(t=>({default:t.SettingsLayout}))),yze=_.lazy(()=>Xr(()=>import("./index-DP3f1470.js"),__vite__mapDeps([0,1])).then(t=>({default:t.CatalogLayout}))),bze=_.lazy(()=>Xr(()=>import("./index-DP3f1470.js"),__vite__mapDeps([0,1])).then(t=>({default:t.CatalogList}))),wze=_.lazy(()=>Xr(()=>import("./index-DP3f1470.js"),__vite__mapDeps([0,1])).then(t=>({default:t.DashboardPage}))),_ze=_.lazy(()=>Xr(()=>import("./index-DP3f1470.js"),__vite__mapDeps([0,1])).then(t=>({default:t.QuotesLayout}))),xze=_.lazy(()=>Xr(()=>import("./index-DP3f1470.js"),__vite__mapDeps([0,1])).then(t=>({default:t.QuotesList}))),Sze=()=>{const t=[{path:"*",Element:P.jsx(_.Suspense,{fallback:P.jsx(xs,{}),children:P.jsx(dze,{})})}],e=[{path:"/",element:P.jsx(_U,{children:P.jsx(wQ,{to:"/quotes",replace:!0})})},{path:"/home",element:P.jsx(_U,{children:P.jsx(_.Suspense,{fallback:P.jsx(xs,{}),children:P.jsx(wze,{})})})},{path:"/catalog",element:P.jsx(_.Suspense,{fallback:P.jsx(xs,{}),children:P.jsx(yze,{children:P.jsx(gS,{})})}),children:[{index:!0,element:P.jsx(_.Suspense,{fallback:P.jsx(xs,{}),children:P.jsx(bze,{})})}]},{path:"/dealers",element:P.jsx(_.Suspense,{fallback:P.jsx(xs,{}),children:P.jsx(cze,{children:P.jsx(gS,{})})}),children:[{index:!0,element:P.jsx(_.Suspense,{fallback:P.jsx(xs,{}),children:P.jsx(uze,{})})}]},{path:"/quotes",element:P.jsx(_.Suspense,{fallback:P.jsx(xs,{}),children:P.jsx(_ze,{children:P.jsx(gS,{})})}),children:[{index:!0,element:P.jsx(_.Suspense,{fallback:P.jsx(xs,{}),children:P.jsx(xze,{})})},{path:"add",element:P.jsx(_.Suspense,{fallback:P.jsx(xs,{}),children:P.jsx(pze,{})})},{path:"edit/:id",element:P.jsx(_.Suspense,{fallback:P.jsx(xs,{}),children:P.jsx(mze,{})})}]},{path:"/settings",element:P.jsx(_.Suspense,{fallback:P.jsx(xs,{}),children:P.jsx(vze,{children:P.jsx(gS,{})})}),children:[{index:!0,element:P.jsx(_.Suspense,{fallback:P.jsx(xs,{}),children:P.jsx(gze,{})})}]},{path:"/logout",element:P.jsx(hze,{})}],n=[{path:"/login",element:P.jsx(_.Suspense,{fallback:P.jsx(xs,{}),children:P.jsx(fze,{})})}],r=rOe([...e,...n,...t],{});return P.jsx(fOe,{router:r})};function Bee(t,e){return function(){return t.apply(e,arguments)}}const{toString:Eze}=Object.prototype,{getPrototypeOf:Q$}=Object,iR=(t=>e=>{const n=Eze.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Oa=t=>(t=t.toLowerCase(),e=>iR(e)===t),oR=t=>e=>typeof e===t,{isArray:jv}=Array,u0=oR("undefined");function Cze(t){return t!==null&&!u0(t)&&t.constructor!==null&&!u0(t.constructor)&&so(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const Uee=Oa("ArrayBuffer");function Aze(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&Uee(t.buffer),e}const Rze=oR("string"),so=oR("function"),Hee=oR("number"),aR=t=>t!==null&&typeof t=="object",Pze=t=>t===!0||t===!1,xE=t=>{if(iR(t)!=="object")return!1;const e=Q$(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},Tze=Oa("Date"),kze=Oa("File"),Dze=Oa("Blob"),Nze=Oa("FileList"),Oze=t=>aR(t)&&so(t.pipe),Mze=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||so(t.append)&&((e=iR(t))==="formdata"||e==="object"&&so(t.toString)&&t.toString()==="[object FormData]"))},Lze=Oa("URLSearchParams"),[Ize,$ze,Fze,jze]=["ReadableStream","Request","Response","Headers"].map(Oa),zze=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function U_(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let r,s;if(typeof t!="object"&&(t=[t]),jv(t))for(r=0,s=t.length;r0;)if(s=n[r],e===s.toLowerCase())return s;return null}const Cf=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Wee=t=>!u0(t)&&t!==Cf;function JO(){const{caseless:t}=Wee(this)&&this||{},e={},n=(r,s)=>{const i=t&&Vee(e,s)||s;xE(e[i])&&xE(r)?e[i]=JO(e[i],r):xE(r)?e[i]=JO({},r):jv(r)?e[i]=r.slice():e[i]=r};for(let r=0,s=arguments.length;r(U_(e,(s,i)=>{n&&so(s)?t[i]=Bee(s,n):t[i]=s},{allOwnKeys:r}),t),Uze=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),Hze=(t,e,n,r)=>{t.prototype=Object.create(e.prototype,r),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),n&&Object.assign(t.prototype,n)},Vze=(t,e,n,r)=>{let s,i,a;const o={};if(e=e||{},t==null)return e;do{for(s=Object.getOwnPropertyNames(t),i=s.length;i-- >0;)a=s[i],(!r||r(a,t,e))&&!o[a]&&(e[a]=t[a],o[a]=!0);t=n!==!1&&Q$(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},Wze=(t,e,n)=>{t=String(t),(n===void 0||n>t.length)&&(n=t.length),n-=e.length;const r=t.indexOf(e,n);return r!==-1&&r===n},Gze=t=>{if(!t)return null;if(jv(t))return t;let e=t.length;if(!Hee(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},qze=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&Q$(Uint8Array)),Kze=(t,e)=>{const r=(t&&t[Symbol.iterator]).call(t);let s;for(;(s=r.next())&&!s.done;){const i=s.value;e.call(t,i[0],i[1])}},Yze=(t,e)=>{let n;const r=[];for(;(n=t.exec(e))!==null;)r.push(n);return r},Xze=Oa("HTMLFormElement"),Qze=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),OU=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),Zze=Oa("RegExp"),Gee=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),r={};U_(n,(s,i)=>{let a;(a=e(s,i,t))!==!1&&(r[i]=a||s)}),Object.defineProperties(t,r)},Jze=t=>{Gee(t,(e,n)=>{if(so(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=t[n];if(so(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},eBe=(t,e)=>{const n={},r=s=>{s.forEach(i=>{n[i]=!0})};return jv(t)?r(t):r(String(t).split(e)),n},tBe=()=>{},nBe=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function rBe(t){return!!(t&&so(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}const sBe=t=>{const e=new Array(10),n=(r,s)=>{if(aR(r)){if(e.indexOf(r)>=0)return;if(!("toJSON"in r)){e[s]=r;const i=jv(r)?[]:{};return U_(r,(a,o)=>{const c=n(a,s+1);!u0(c)&&(i[o]=c)}),e[s]=void 0,i}}return r};return n(t,0)},iBe=Oa("AsyncFunction"),oBe=t=>t&&(aR(t)||so(t))&&so(t.then)&&so(t.catch),qee=((t,e)=>t?setImmediate:e?((n,r)=>(Cf.addEventListener("message",({source:s,data:i})=>{s===Cf&&i===n&&r.length&&r.shift()()},!1),s=>{r.push(s),Cf.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",so(Cf.postMessage)),aBe=typeof queueMicrotask<"u"?queueMicrotask.bind(Cf):typeof process<"u"&&process.nextTick||qee,ve={isArray:jv,isArrayBuffer:Uee,isBuffer:Cze,isFormData:Mze,isArrayBufferView:Aze,isString:Rze,isNumber:Hee,isBoolean:Pze,isObject:aR,isPlainObject:xE,isReadableStream:Ize,isRequest:$ze,isResponse:Fze,isHeaders:jze,isUndefined:u0,isDate:Tze,isFile:kze,isBlob:Dze,isRegExp:Zze,isFunction:so,isStream:Oze,isURLSearchParams:Lze,isTypedArray:qze,isFileList:Nze,forEach:U_,merge:JO,extend:Bze,trim:zze,stripBOM:Uze,inherits:Hze,toFlatObject:Vze,kindOf:iR,kindOfTest:Oa,endsWith:Wze,toArray:Gze,forEachEntry:Kze,matchAll:Yze,isHTMLForm:Xze,hasOwnProperty:OU,hasOwnProp:OU,reduceDescriptors:Gee,freezeMethods:Jze,toObjectSet:eBe,toCamelCase:Qze,noop:tBe,toFiniteNumber:nBe,findKey:Vee,global:Cf,isContextDefined:Wee,isSpecCompliantForm:rBe,toJSONObject:sBe,isAsyncFn:iBe,isThenable:oBe,setImmediate:qee,asap:aBe};function wt(t,e,n,r,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),n&&(this.config=n),r&&(this.request=r),s&&(this.response=s,this.status=s.status?s.status:null)}ve.inherits(wt,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:ve.toJSONObject(this.config),code:this.code,status:this.status}}});const Kee=wt.prototype,Yee={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{Yee[t]={value:t}});Object.defineProperties(wt,Yee);Object.defineProperty(Kee,"isAxiosError",{value:!0});wt.from=(t,e,n,r,s,i)=>{const a=Object.create(Kee);return ve.toFlatObject(t,a,function(c){return c!==Error.prototype},o=>o!=="isAxiosError"),wt.call(a,t.message,e,n,r,s),a.cause=t,a.name=t.name,i&&Object.assign(a,i),a};const lBe=null;function eM(t){return ve.isPlainObject(t)||ve.isArray(t)}function Xee(t){return ve.endsWith(t,"[]")?t.slice(0,-2):t}function MU(t,e,n){return t?t.concat(e).map(function(s,i){return s=Xee(s),!n&&i?"["+s+"]":s}).join(n?".":""):e}function cBe(t){return ve.isArray(t)&&!t.some(eM)}const uBe=ve.toFlatObject(ve,{},null,function(e){return/^is[A-Z]/.test(e)});function lR(t,e,n){if(!ve.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,n=ve.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(h,y){return!ve.isUndefined(y[h])});const r=n.metaTokens,s=n.visitor||f,i=n.dots,a=n.indexes,c=(n.Blob||typeof Blob<"u"&&Blob)&&ve.isSpecCompliantForm(e);if(!ve.isFunction(s))throw new TypeError("visitor must be a function");function u(p){if(p===null)return"";if(ve.isDate(p))return p.toISOString();if(!c&&ve.isBlob(p))throw new wt("Blob is not supported. Use a Buffer instead.");return ve.isArrayBuffer(p)||ve.isTypedArray(p)?c&&typeof Blob=="function"?new Blob([p]):Buffer.from(p):p}function f(p,h,y){let g=p;if(p&&!y&&typeof p=="object"){if(ve.endsWith(h,"{}"))h=r?h:h.slice(0,-2),p=JSON.stringify(p);else if(ve.isArray(p)&&cBe(p)||(ve.isFileList(p)||ve.endsWith(h,"[]"))&&(g=ve.toArray(p)))return h=Xee(h),g.forEach(function(w,x){!(ve.isUndefined(w)||w===null)&&e.append(a===!0?MU([h],x,i):a===null?h:h+"[]",u(w))}),!1}return eM(p)?!0:(e.append(MU(y,h,i),u(p)),!1)}const l=[],d=Object.assign(uBe,{defaultVisitor:f,convertValue:u,isVisitable:eM});function m(p,h){if(!ve.isUndefined(p)){if(l.indexOf(p)!==-1)throw Error("Circular reference detected in "+h.join("."));l.push(p),ve.forEach(p,function(g,v){(!(ve.isUndefined(g)||g===null)&&s.call(e,g,ve.isString(v)?v.trim():v,h,d))===!0&&m(g,h?h.concat(v):[v])}),l.pop()}}if(!ve.isObject(t))throw new TypeError("data must be an object");return m(t),e}function LU(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function Z$(t,e){this._pairs=[],t&&lR(t,this,e)}const Qee=Z$.prototype;Qee.append=function(e,n){this._pairs.push([e,n])};Qee.toString=function(e){const n=e?function(r){return e.call(this,r,LU)}:LU;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function dBe(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Zee(t,e,n){if(!e)return t;const r=n&&n.encode||dBe;ve.isFunction(n)&&(n={serialize:n});const s=n&&n.serialize;let i;if(s?i=s(e,n):i=ve.isURLSearchParams(e)?e.toString():new Z$(e,n).toString(r),i){const a=t.indexOf("#");a!==-1&&(t=t.slice(0,a)),t+=(t.indexOf("?")===-1?"?":"&")+i}return t}class IU{constructor(){this.handlers=[]}use(e,n,r){return this.handlers.push({fulfilled:e,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){ve.forEach(this.handlers,function(r){r!==null&&e(r)})}}const Jee={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},fBe=typeof URLSearchParams<"u"?URLSearchParams:Z$,hBe=typeof FormData<"u"?FormData:null,pBe=typeof Blob<"u"?Blob:null,mBe={isBrowser:!0,classes:{URLSearchParams:fBe,FormData:hBe,Blob:pBe},protocols:["http","https","file","blob","url","data"]},J$=typeof window<"u"&&typeof document<"u",tM=typeof navigator=="object"&&navigator||void 0,gBe=J$&&(!tM||["ReactNative","NativeScript","NS"].indexOf(tM.product)<0),vBe=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",yBe=J$&&window.location.href||"http://localhost",bBe=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:J$,hasStandardBrowserEnv:gBe,hasStandardBrowserWebWorkerEnv:vBe,navigator:tM,origin:yBe},Symbol.toStringTag,{value:"Module"})),Ts={...bBe,...mBe};function wBe(t,e){return lR(t,new Ts.classes.URLSearchParams,Object.assign({visitor:function(n,r,s,i){return Ts.isNode&&ve.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)}},e))}function _Be(t){return ve.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function xBe(t){const e={},n=Object.keys(t);let r;const s=n.length;let i;for(r=0;r=n.length;return a=!a&&ve.isArray(s)?s.length:a,c?(ve.hasOwnProp(s,a)?s[a]=[s[a],r]:s[a]=r,!o):((!s[a]||!ve.isObject(s[a]))&&(s[a]=[]),e(n,r,s[a],i)&&ve.isArray(s[a])&&(s[a]=xBe(s[a])),!o)}if(ve.isFormData(t)&&ve.isFunction(t.entries)){const n={};return ve.forEachEntry(t,(r,s)=>{e(_Be(r),s,n,0)}),n}return null}function SBe(t,e,n){if(ve.isString(t))try{return(e||JSON.parse)(t),ve.trim(t)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(t)}const H_={transitional:Jee,adapter:["xhr","http","fetch"],transformRequest:[function(e,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,i=ve.isObject(e);if(i&&ve.isHTMLForm(e)&&(e=new FormData(e)),ve.isFormData(e))return s?JSON.stringify(ete(e)):e;if(ve.isArrayBuffer(e)||ve.isBuffer(e)||ve.isStream(e)||ve.isFile(e)||ve.isBlob(e)||ve.isReadableStream(e))return e;if(ve.isArrayBufferView(e))return e.buffer;if(ve.isURLSearchParams(e))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return wBe(e,this.formSerializer).toString();if((o=ve.isFileList(e))||r.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return lR(o?{"files[]":e}:e,c&&new c,this.formSerializer)}}return i||s?(n.setContentType("application/json",!1),SBe(e)):e}],transformResponse:[function(e){const n=this.transitional||H_.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(ve.isResponse(e)||ve.isReadableStream(e))return e;if(e&&ve.isString(e)&&(r&&!this.responseType||s)){const a=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(e)}catch(o){if(a)throw o.name==="SyntaxError"?wt.from(o,wt.ERR_BAD_RESPONSE,this,null,this.response):o}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ts.classes.FormData,Blob:Ts.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ve.forEach(["delete","get","head","post","put","patch"],t=>{H_.headers[t]={}});const EBe=ve.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),CBe=t=>{const e={};let n,r,s;return t&&t.split(` +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function H3e(t,e){if(t){if(typeof t=="string")return kU(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return kU(t,e)}}function kU(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);nnull},oze=_.createContext(ize);function aze({children:t,defaultTheme:e="system",storageKey:n="vite-ui-theme",...r}){const[s,i]=_.useState(()=>Ao.getItem(n)||e);_.useEffect(()=>{const o=window.document.documentElement;if(o.classList.remove("light","dark"),s==="system"){const c=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";o.classList.add(c);return}o.classList.add(s)},[s]);const a={theme:s,setTheme:o=>{Ao.setItem(n,o),i(o)}};return P.jsx(oze.Provider,{...r,value:a,children:t})}const lze=_.createContext(null),zee=({children:t})=>{const[e,n]=_.useState(null),[r,s]=_.useState(!1),i=_.useCallback(u=>{n(u),s(!0)},[s,n]),a=()=>{var u;(u=e==null?void 0:e.onConfirm)==null||u.call(e),s(!1)},o=()=>{var u;(u=e==null?void 0:e.onCancel)==null||u.call(e),s(!1)},c=_.useMemo(()=>({show:i}),[i]);return P.jsxs(lze.Provider,{value:c,children:[t,P.jsx(_Q,{onCancel:()=>{o()},onConfirm:()=>a(),title:e==null?void 0:e.title,description:e==null?void 0:e.subtitle,confirmLabel:e==null?void 0:e.confirmText,cancelLabel:e==null?void 0:e.cancelText,isOpen:r})]})},cze=_.lazy(()=>Xr(()=>import("./index-Dq5tsIog.js"),__vite__mapDeps([0,1])).then(t=>({default:t.DealerLayout}))),uze=_.lazy(()=>Xr(()=>import("./index-Dq5tsIog.js"),__vite__mapDeps([0,1])).then(t=>({default:t.DealersList}))),dze=_.lazy(()=>Xr(()=>import("./index-Dq5tsIog.js"),__vite__mapDeps([0,1])).then(t=>({default:t.ErrorPage}))),fze=_.lazy(()=>Xr(()=>import("./index-Dq5tsIog.js"),__vite__mapDeps([0,1])).then(t=>({default:t.LoginPageWithLanguageSelector}))),hze=_.lazy(()=>Xr(()=>import("./index-Dq5tsIog.js"),__vite__mapDeps([0,1])).then(t=>({default:t.LogoutPage}))),pze=_.lazy(()=>Xr(()=>import("./index-Dq5tsIog.js"),__vite__mapDeps([0,1])).then(t=>({default:t.QuoteCreate}))),mze=_.lazy(()=>Xr(()=>import("./index-Dq5tsIog.js"),__vite__mapDeps([0,1])).then(t=>({default:t.QuoteEdit}))),gze=_.lazy(()=>Xr(()=>import("./index-Dq5tsIog.js"),__vite__mapDeps([0,1])).then(t=>({default:t.SettingsEditor}))),vze=_.lazy(()=>Xr(()=>import("./index-Dq5tsIog.js"),__vite__mapDeps([0,1])).then(t=>({default:t.SettingsLayout}))),yze=_.lazy(()=>Xr(()=>import("./index-Dq5tsIog.js"),__vite__mapDeps([0,1])).then(t=>({default:t.CatalogLayout}))),bze=_.lazy(()=>Xr(()=>import("./index-Dq5tsIog.js"),__vite__mapDeps([0,1])).then(t=>({default:t.CatalogList}))),wze=_.lazy(()=>Xr(()=>import("./index-Dq5tsIog.js"),__vite__mapDeps([0,1])).then(t=>({default:t.DashboardPage}))),_ze=_.lazy(()=>Xr(()=>import("./index-Dq5tsIog.js"),__vite__mapDeps([0,1])).then(t=>({default:t.QuotesLayout}))),xze=_.lazy(()=>Xr(()=>import("./index-Dq5tsIog.js"),__vite__mapDeps([0,1])).then(t=>({default:t.QuotesList}))),Sze=()=>{const t=[{path:"*",Element:P.jsx(_.Suspense,{fallback:P.jsx(xs,{}),children:P.jsx(dze,{})})}],e=[{path:"/",element:P.jsx(_U,{children:P.jsx(wQ,{to:"/quotes",replace:!0})})},{path:"/home",element:P.jsx(_U,{children:P.jsx(_.Suspense,{fallback:P.jsx(xs,{}),children:P.jsx(wze,{})})})},{path:"/catalog",element:P.jsx(_.Suspense,{fallback:P.jsx(xs,{}),children:P.jsx(yze,{children:P.jsx(gS,{})})}),children:[{index:!0,element:P.jsx(_.Suspense,{fallback:P.jsx(xs,{}),children:P.jsx(bze,{})})}]},{path:"/dealers",element:P.jsx(_.Suspense,{fallback:P.jsx(xs,{}),children:P.jsx(cze,{children:P.jsx(gS,{})})}),children:[{index:!0,element:P.jsx(_.Suspense,{fallback:P.jsx(xs,{}),children:P.jsx(uze,{})})}]},{path:"/quotes",element:P.jsx(_.Suspense,{fallback:P.jsx(xs,{}),children:P.jsx(_ze,{children:P.jsx(gS,{})})}),children:[{index:!0,element:P.jsx(_.Suspense,{fallback:P.jsx(xs,{}),children:P.jsx(xze,{})})},{path:"add",element:P.jsx(_.Suspense,{fallback:P.jsx(xs,{}),children:P.jsx(pze,{})})},{path:"edit/:id",element:P.jsx(_.Suspense,{fallback:P.jsx(xs,{}),children:P.jsx(mze,{})})}]},{path:"/settings",element:P.jsx(_.Suspense,{fallback:P.jsx(xs,{}),children:P.jsx(vze,{children:P.jsx(gS,{})})}),children:[{index:!0,element:P.jsx(_.Suspense,{fallback:P.jsx(xs,{}),children:P.jsx(gze,{})})}]},{path:"/logout",element:P.jsx(hze,{})}],n=[{path:"/login",element:P.jsx(_.Suspense,{fallback:P.jsx(xs,{}),children:P.jsx(fze,{})})}],r=rOe([...e,...n,...t],{});return P.jsx(fOe,{router:r})};function Bee(t,e){return function(){return t.apply(e,arguments)}}const{toString:Eze}=Object.prototype,{getPrototypeOf:Q$}=Object,iR=(t=>e=>{const n=Eze.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Oa=t=>(t=t.toLowerCase(),e=>iR(e)===t),oR=t=>e=>typeof e===t,{isArray:jv}=Array,u0=oR("undefined");function Cze(t){return t!==null&&!u0(t)&&t.constructor!==null&&!u0(t.constructor)&&so(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const Uee=Oa("ArrayBuffer");function Aze(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&Uee(t.buffer),e}const Rze=oR("string"),so=oR("function"),Hee=oR("number"),aR=t=>t!==null&&typeof t=="object",Pze=t=>t===!0||t===!1,xE=t=>{if(iR(t)!=="object")return!1;const e=Q$(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},Tze=Oa("Date"),kze=Oa("File"),Dze=Oa("Blob"),Nze=Oa("FileList"),Oze=t=>aR(t)&&so(t.pipe),Mze=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||so(t.append)&&((e=iR(t))==="formdata"||e==="object"&&so(t.toString)&&t.toString()==="[object FormData]"))},Lze=Oa("URLSearchParams"),[Ize,$ze,Fze,jze]=["ReadableStream","Request","Response","Headers"].map(Oa),zze=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function U_(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let r,s;if(typeof t!="object"&&(t=[t]),jv(t))for(r=0,s=t.length;r0;)if(s=n[r],e===s.toLowerCase())return s;return null}const Cf=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Wee=t=>!u0(t)&&t!==Cf;function JO(){const{caseless:t}=Wee(this)&&this||{},e={},n=(r,s)=>{const i=t&&Vee(e,s)||s;xE(e[i])&&xE(r)?e[i]=JO(e[i],r):xE(r)?e[i]=JO({},r):jv(r)?e[i]=r.slice():e[i]=r};for(let r=0,s=arguments.length;r(U_(e,(s,i)=>{n&&so(s)?t[i]=Bee(s,n):t[i]=s},{allOwnKeys:r}),t),Uze=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),Hze=(t,e,n,r)=>{t.prototype=Object.create(e.prototype,r),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),n&&Object.assign(t.prototype,n)},Vze=(t,e,n,r)=>{let s,i,a;const o={};if(e=e||{},t==null)return e;do{for(s=Object.getOwnPropertyNames(t),i=s.length;i-- >0;)a=s[i],(!r||r(a,t,e))&&!o[a]&&(e[a]=t[a],o[a]=!0);t=n!==!1&&Q$(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},Wze=(t,e,n)=>{t=String(t),(n===void 0||n>t.length)&&(n=t.length),n-=e.length;const r=t.indexOf(e,n);return r!==-1&&r===n},Gze=t=>{if(!t)return null;if(jv(t))return t;let e=t.length;if(!Hee(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},qze=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&Q$(Uint8Array)),Kze=(t,e)=>{const r=(t&&t[Symbol.iterator]).call(t);let s;for(;(s=r.next())&&!s.done;){const i=s.value;e.call(t,i[0],i[1])}},Yze=(t,e)=>{let n;const r=[];for(;(n=t.exec(e))!==null;)r.push(n);return r},Xze=Oa("HTMLFormElement"),Qze=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),OU=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),Zze=Oa("RegExp"),Gee=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),r={};U_(n,(s,i)=>{let a;(a=e(s,i,t))!==!1&&(r[i]=a||s)}),Object.defineProperties(t,r)},Jze=t=>{Gee(t,(e,n)=>{if(so(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=t[n];if(so(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},eBe=(t,e)=>{const n={},r=s=>{s.forEach(i=>{n[i]=!0})};return jv(t)?r(t):r(String(t).split(e)),n},tBe=()=>{},nBe=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function rBe(t){return!!(t&&so(t.append)&&t[Symbol.toStringTag]==="FormData"&&t[Symbol.iterator])}const sBe=t=>{const e=new Array(10),n=(r,s)=>{if(aR(r)){if(e.indexOf(r)>=0)return;if(!("toJSON"in r)){e[s]=r;const i=jv(r)?[]:{};return U_(r,(a,o)=>{const c=n(a,s+1);!u0(c)&&(i[o]=c)}),e[s]=void 0,i}}return r};return n(t,0)},iBe=Oa("AsyncFunction"),oBe=t=>t&&(aR(t)||so(t))&&so(t.then)&&so(t.catch),qee=((t,e)=>t?setImmediate:e?((n,r)=>(Cf.addEventListener("message",({source:s,data:i})=>{s===Cf&&i===n&&r.length&&r.shift()()},!1),s=>{r.push(s),Cf.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",so(Cf.postMessage)),aBe=typeof queueMicrotask<"u"?queueMicrotask.bind(Cf):typeof process<"u"&&process.nextTick||qee,ve={isArray:jv,isArrayBuffer:Uee,isBuffer:Cze,isFormData:Mze,isArrayBufferView:Aze,isString:Rze,isNumber:Hee,isBoolean:Pze,isObject:aR,isPlainObject:xE,isReadableStream:Ize,isRequest:$ze,isResponse:Fze,isHeaders:jze,isUndefined:u0,isDate:Tze,isFile:kze,isBlob:Dze,isRegExp:Zze,isFunction:so,isStream:Oze,isURLSearchParams:Lze,isTypedArray:qze,isFileList:Nze,forEach:U_,merge:JO,extend:Bze,trim:zze,stripBOM:Uze,inherits:Hze,toFlatObject:Vze,kindOf:iR,kindOfTest:Oa,endsWith:Wze,toArray:Gze,forEachEntry:Kze,matchAll:Yze,isHTMLForm:Xze,hasOwnProperty:OU,hasOwnProp:OU,reduceDescriptors:Gee,freezeMethods:Jze,toObjectSet:eBe,toCamelCase:Qze,noop:tBe,toFiniteNumber:nBe,findKey:Vee,global:Cf,isContextDefined:Wee,isSpecCompliantForm:rBe,toJSONObject:sBe,isAsyncFn:iBe,isThenable:oBe,setImmediate:qee,asap:aBe};function wt(t,e,n,r,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),n&&(this.config=n),r&&(this.request=r),s&&(this.response=s,this.status=s.status?s.status:null)}ve.inherits(wt,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:ve.toJSONObject(this.config),code:this.code,status:this.status}}});const Kee=wt.prototype,Yee={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{Yee[t]={value:t}});Object.defineProperties(wt,Yee);Object.defineProperty(Kee,"isAxiosError",{value:!0});wt.from=(t,e,n,r,s,i)=>{const a=Object.create(Kee);return ve.toFlatObject(t,a,function(c){return c!==Error.prototype},o=>o!=="isAxiosError"),wt.call(a,t.message,e,n,r,s),a.cause=t,a.name=t.name,i&&Object.assign(a,i),a};const lBe=null;function eM(t){return ve.isPlainObject(t)||ve.isArray(t)}function Xee(t){return ve.endsWith(t,"[]")?t.slice(0,-2):t}function MU(t,e,n){return t?t.concat(e).map(function(s,i){return s=Xee(s),!n&&i?"["+s+"]":s}).join(n?".":""):e}function cBe(t){return ve.isArray(t)&&!t.some(eM)}const uBe=ve.toFlatObject(ve,{},null,function(e){return/^is[A-Z]/.test(e)});function lR(t,e,n){if(!ve.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,n=ve.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(h,y){return!ve.isUndefined(y[h])});const r=n.metaTokens,s=n.visitor||f,i=n.dots,a=n.indexes,c=(n.Blob||typeof Blob<"u"&&Blob)&&ve.isSpecCompliantForm(e);if(!ve.isFunction(s))throw new TypeError("visitor must be a function");function u(p){if(p===null)return"";if(ve.isDate(p))return p.toISOString();if(!c&&ve.isBlob(p))throw new wt("Blob is not supported. Use a Buffer instead.");return ve.isArrayBuffer(p)||ve.isTypedArray(p)?c&&typeof Blob=="function"?new Blob([p]):Buffer.from(p):p}function f(p,h,y){let g=p;if(p&&!y&&typeof p=="object"){if(ve.endsWith(h,"{}"))h=r?h:h.slice(0,-2),p=JSON.stringify(p);else if(ve.isArray(p)&&cBe(p)||(ve.isFileList(p)||ve.endsWith(h,"[]"))&&(g=ve.toArray(p)))return h=Xee(h),g.forEach(function(w,x){!(ve.isUndefined(w)||w===null)&&e.append(a===!0?MU([h],x,i):a===null?h:h+"[]",u(w))}),!1}return eM(p)?!0:(e.append(MU(y,h,i),u(p)),!1)}const l=[],d=Object.assign(uBe,{defaultVisitor:f,convertValue:u,isVisitable:eM});function m(p,h){if(!ve.isUndefined(p)){if(l.indexOf(p)!==-1)throw Error("Circular reference detected in "+h.join("."));l.push(p),ve.forEach(p,function(g,v){(!(ve.isUndefined(g)||g===null)&&s.call(e,g,ve.isString(v)?v.trim():v,h,d))===!0&&m(g,h?h.concat(v):[v])}),l.pop()}}if(!ve.isObject(t))throw new TypeError("data must be an object");return m(t),e}function LU(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function Z$(t,e){this._pairs=[],t&&lR(t,this,e)}const Qee=Z$.prototype;Qee.append=function(e,n){this._pairs.push([e,n])};Qee.toString=function(e){const n=e?function(r){return e.call(this,r,LU)}:LU;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function dBe(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Zee(t,e,n){if(!e)return t;const r=n&&n.encode||dBe;ve.isFunction(n)&&(n={serialize:n});const s=n&&n.serialize;let i;if(s?i=s(e,n):i=ve.isURLSearchParams(e)?e.toString():new Z$(e,n).toString(r),i){const a=t.indexOf("#");a!==-1&&(t=t.slice(0,a)),t+=(t.indexOf("?")===-1?"?":"&")+i}return t}class IU{constructor(){this.handlers=[]}use(e,n,r){return this.handlers.push({fulfilled:e,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){ve.forEach(this.handlers,function(r){r!==null&&e(r)})}}const Jee={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},fBe=typeof URLSearchParams<"u"?URLSearchParams:Z$,hBe=typeof FormData<"u"?FormData:null,pBe=typeof Blob<"u"?Blob:null,mBe={isBrowser:!0,classes:{URLSearchParams:fBe,FormData:hBe,Blob:pBe},protocols:["http","https","file","blob","url","data"]},J$=typeof window<"u"&&typeof document<"u",tM=typeof navigator=="object"&&navigator||void 0,gBe=J$&&(!tM||["ReactNative","NativeScript","NS"].indexOf(tM.product)<0),vBe=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",yBe=J$&&window.location.href||"http://localhost",bBe=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:J$,hasStandardBrowserEnv:gBe,hasStandardBrowserWebWorkerEnv:vBe,navigator:tM,origin:yBe},Symbol.toStringTag,{value:"Module"})),Ts={...bBe,...mBe};function wBe(t,e){return lR(t,new Ts.classes.URLSearchParams,Object.assign({visitor:function(n,r,s,i){return Ts.isNode&&ve.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)}},e))}function _Be(t){return ve.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function xBe(t){const e={},n=Object.keys(t);let r;const s=n.length;let i;for(r=0;r=n.length;return a=!a&&ve.isArray(s)?s.length:a,c?(ve.hasOwnProp(s,a)?s[a]=[s[a],r]:s[a]=r,!o):((!s[a]||!ve.isObject(s[a]))&&(s[a]=[]),e(n,r,s[a],i)&&ve.isArray(s[a])&&(s[a]=xBe(s[a])),!o)}if(ve.isFormData(t)&&ve.isFunction(t.entries)){const n={};return ve.forEachEntry(t,(r,s)=>{e(_Be(r),s,n,0)}),n}return null}function SBe(t,e,n){if(ve.isString(t))try{return(e||JSON.parse)(t),ve.trim(t)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(t)}const H_={transitional:Jee,adapter:["xhr","http","fetch"],transformRequest:[function(e,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,i=ve.isObject(e);if(i&&ve.isHTMLForm(e)&&(e=new FormData(e)),ve.isFormData(e))return s?JSON.stringify(ete(e)):e;if(ve.isArrayBuffer(e)||ve.isBuffer(e)||ve.isStream(e)||ve.isFile(e)||ve.isBlob(e)||ve.isReadableStream(e))return e;if(ve.isArrayBufferView(e))return e.buffer;if(ve.isURLSearchParams(e))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return wBe(e,this.formSerializer).toString();if((o=ve.isFileList(e))||r.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return lR(o?{"files[]":e}:e,c&&new c,this.formSerializer)}}return i||s?(n.setContentType("application/json",!1),SBe(e)):e}],transformResponse:[function(e){const n=this.transitional||H_.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(ve.isResponse(e)||ve.isReadableStream(e))return e;if(e&&ve.isString(e)&&(r&&!this.responseType||s)){const a=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(e)}catch(o){if(a)throw o.name==="SyntaxError"?wt.from(o,wt.ERR_BAD_RESPONSE,this,null,this.response):o}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ts.classes.FormData,Blob:Ts.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ve.forEach(["delete","get","head","post","put","patch"],t=>{H_.headers[t]={}});const EBe=ve.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),CBe=t=>{const e={};let n,r,s;return t&&t.split(` `).forEach(function(a){s=a.indexOf(":"),n=a.substring(0,s).trim().toLowerCase(),r=a.substring(s+1).trim(),!(!n||e[n]&&EBe[n])&&(n==="set-cookie"?e[n]?e[n].push(r):e[n]=[r]:e[n]=e[n]?e[n]+", "+r:r)}),e},$U=Symbol("internals");function Dy(t){return t&&String(t).trim().toLowerCase()}function SE(t){return t===!1||t==null?t:ve.isArray(t)?t.map(SE):String(t)}function ABe(t){const e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(t);)e[r[1]]=r[2];return e}const RBe=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function bk(t,e,n,r,s){if(ve.isFunction(r))return r.call(this,e,n);if(s&&(e=n),!!ve.isString(e)){if(ve.isString(r))return e.indexOf(r)!==-1;if(ve.isRegExp(r))return r.test(e)}}function PBe(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,r)=>n.toUpperCase()+r)}function TBe(t,e){const n=ve.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(t,r+n,{value:function(s,i,a){return this[r].call(this,e,s,i,a)},configurable:!0})})}let Ci=class{constructor(e){e&&this.set(e)}set(e,n,r){const s=this;function i(o,c,u){const f=Dy(c);if(!f)throw new Error("header name must be a non-empty string");const l=ve.findKey(s,f);(!l||s[l]===void 0||u===!0||u===void 0&&s[l]!==!1)&&(s[l||c]=SE(o))}const a=(o,c)=>ve.forEach(o,(u,f)=>i(u,f,c));if(ve.isPlainObject(e)||e instanceof this.constructor)a(e,n);else if(ve.isString(e)&&(e=e.trim())&&!RBe(e))a(CBe(e),n);else if(ve.isHeaders(e))for(const[o,c]of e.entries())i(c,o,r);else e!=null&&i(n,e,r);return this}get(e,n){if(e=Dy(e),e){const r=ve.findKey(this,e);if(r){const s=this[r];if(!n)return s;if(n===!0)return ABe(s);if(ve.isFunction(n))return n.call(this,s,r);if(ve.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=Dy(e),e){const r=ve.findKey(this,e);return!!(r&&this[r]!==void 0&&(!n||bk(this,this[r],r,n)))}return!1}delete(e,n){const r=this;let s=!1;function i(a){if(a=Dy(a),a){const o=ve.findKey(r,a);o&&(!n||bk(r,r[o],o,n))&&(delete r[o],s=!0)}}return ve.isArray(e)?e.forEach(i):i(e),s}clear(e){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const i=n[r];(!e||bk(this,this[i],i,e,!0))&&(delete this[i],s=!0)}return s}normalize(e){const n=this,r={};return ve.forEach(this,(s,i)=>{const a=ve.findKey(r,i);if(a){n[a]=SE(s),delete n[i];return}const o=e?PBe(i):String(i).trim();o!==i&&delete n[i],n[o]=SE(s),r[o]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const n=Object.create(null);return ve.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=e&&ve.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,n])=>e+": "+n).join(` `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...n){const r=new this(e);return n.forEach(s=>r.set(s)),r}static accessor(e){const r=(this[$U]=this[$U]={accessors:{}}).accessors,s=this.prototype;function i(a){const o=Dy(a);r[o]||(TBe(s,a),r[o]=!0)}return ve.isArray(e)?e.forEach(i):i(e),this}};Ci.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);ve.reduceDescriptors(Ci.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(r){this[n]=r}}});ve.freezeMethods(Ci);function wk(t,e){const n=this||H_,r=e||n,s=Ci.from(r.headers);let i=r.data;return ve.forEach(t,function(o){i=o.call(n,i,s.normalize(),e?e.status:void 0)}),s.normalize(),i}function tte(t){return!!(t&&t.__CANCEL__)}function zv(t,e,n){wt.call(this,t??"canceled",wt.ERR_CANCELED,e,n),this.name="CanceledError"}ve.inherits(zv,wt,{__CANCEL__:!0});function nte(t,e,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?t(n):e(new wt("Request failed with status code "+n.status,[wt.ERR_BAD_REQUEST,wt.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function kBe(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function DBe(t,e){t=t||10;const n=new Array(t),r=new Array(t);let s=0,i=0,a;return e=e!==void 0?e:1e3,function(c){const u=Date.now(),f=r[i];a||(a=u),n[s]=c,r[s]=u;let l=i,d=0;for(;l!==s;)d+=n[l++],l=l%t;if(s=(s+1)%t,s===i&&(i=(i+1)%t),u-a{n=f,s=null,i&&(clearTimeout(i),i=null),t.apply(null,u)};return[(...u)=>{const f=Date.now(),l=f-n;l>=r?a(u,f):(s=u,i||(i=setTimeout(()=>{i=null,a(s)},r-l)))},()=>s&&a(s)]}const KC=(t,e,n=3)=>{let r=0;const s=DBe(50,250);return NBe(i=>{const a=i.loaded,o=i.lengthComputable?i.total:void 0,c=a-r,u=s(c),f=a<=o;r=a;const l={loaded:a,total:o,progress:o?a/o:void 0,bytes:c,rate:u||void 0,estimated:u&&o&&f?(o-a)/u:void 0,event:i,lengthComputable:o!=null,[e?"download":"upload"]:!0};t(l)},n)},FU=(t,e)=>{const n=t!=null;return[r=>e[0]({lengthComputable:n,total:t,loaded:r}),e[1]]},jU=t=>(...e)=>ve.asap(()=>t(...e)),OBe=Ts.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,Ts.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(Ts.origin),Ts.navigator&&/(msie|trident)/i.test(Ts.navigator.userAgent)):()=>!0,MBe=Ts.hasStandardBrowserEnv?{write(t,e,n,r,s,i){const a=[t+"="+encodeURIComponent(e)];ve.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),ve.isString(r)&&a.push("path="+r),ve.isString(s)&&a.push("domain="+s),i===!0&&a.push("secure"),document.cookie=a.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function LBe(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function IBe(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function rte(t,e,n){let r=!LBe(e);return t&&(r||n==!1)?IBe(t,e):e}const zU=t=>t instanceof Ci?{...t}:t;function sp(t,e){e=e||{};const n={};function r(u,f,l,d){return ve.isPlainObject(u)&&ve.isPlainObject(f)?ve.merge.call({caseless:d},u,f):ve.isPlainObject(f)?ve.merge({},f):ve.isArray(f)?f.slice():f}function s(u,f,l,d){if(ve.isUndefined(f)){if(!ve.isUndefined(u))return r(void 0,u,l,d)}else return r(u,f,l,d)}function i(u,f){if(!ve.isUndefined(f))return r(void 0,f)}function a(u,f){if(ve.isUndefined(f)){if(!ve.isUndefined(u))return r(void 0,u)}else return r(void 0,f)}function o(u,f,l){if(l in e)return r(u,f);if(l in t)return r(void 0,u)}const c={url:i,method:i,data:i,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:o,headers:(u,f,l)=>s(zU(u),zU(f),l,!0)};return ve.forEach(Object.keys(Object.assign({},t,e)),function(f){const l=c[f]||s,d=l(t[f],e[f],f);ve.isUndefined(d)&&l!==o||(n[f]=d)}),n}const ste=t=>{const e=sp({},t);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:i,headers:a,auth:o}=e;e.headers=a=Ci.from(a),e.url=Zee(rte(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),o&&a.set("Authorization","Basic "+btoa((o.username||"")+":"+(o.password?unescape(encodeURIComponent(o.password)):"")));let c;if(ve.isFormData(n)){if(Ts.hasStandardBrowserEnv||Ts.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if((c=a.getContentType())!==!1){const[u,...f]=c?c.split(";").map(l=>l.trim()).filter(Boolean):[];a.setContentType([u||"multipart/form-data",...f].join("; "))}}if(Ts.hasStandardBrowserEnv&&(r&&ve.isFunction(r)&&(r=r(e)),r||r!==!1&&OBe(e.url))){const u=s&&i&&MBe.read(i);u&&a.set(s,u)}return e},$Be=typeof XMLHttpRequest<"u",FBe=$Be&&function(t){return new Promise(function(n,r){const s=ste(t);let i=s.data;const a=Ci.from(s.headers).normalize();let{responseType:o,onUploadProgress:c,onDownloadProgress:u}=s,f,l,d,m,p;function h(){m&&m(),p&&p(),s.cancelToken&&s.cancelToken.unsubscribe(f),s.signal&&s.signal.removeEventListener("abort",f)}let y=new XMLHttpRequest;y.open(s.method.toUpperCase(),s.url,!0),y.timeout=s.timeout;function g(){if(!y)return;const w=Ci.from("getAllResponseHeaders"in y&&y.getAllResponseHeaders()),A={data:!o||o==="text"||o==="json"?y.responseText:y.response,status:y.status,statusText:y.statusText,headers:w,config:t,request:y};nte(function(R){n(R),h()},function(R){r(R),h()},A),y=null}"onloadend"in y?y.onloadend=g:y.onreadystatechange=function(){!y||y.readyState!==4||y.status===0&&!(y.responseURL&&y.responseURL.indexOf("file:")===0)||setTimeout(g)},y.onabort=function(){y&&(r(new wt("Request aborted",wt.ECONNABORTED,t,y)),y=null)},y.onerror=function(){r(new wt("Network Error",wt.ERR_NETWORK,t,y)),y=null},y.ontimeout=function(){let x=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const A=s.transitional||Jee;s.timeoutErrorMessage&&(x=s.timeoutErrorMessage),r(new wt(x,A.clarifyTimeoutError?wt.ETIMEDOUT:wt.ECONNABORTED,t,y)),y=null},i===void 0&&a.setContentType(null),"setRequestHeader"in y&&ve.forEach(a.toJSON(),function(x,A){y.setRequestHeader(A,x)}),ve.isUndefined(s.withCredentials)||(y.withCredentials=!!s.withCredentials),o&&o!=="json"&&(y.responseType=s.responseType),u&&([d,p]=KC(u,!0),y.addEventListener("progress",d)),c&&y.upload&&([l,m]=KC(c),y.upload.addEventListener("progress",l),y.upload.addEventListener("loadend",m)),(s.cancelToken||s.signal)&&(f=w=>{y&&(r(!w||w.type?new zv(null,t,y):w),y.abort(),y=null)},s.cancelToken&&s.cancelToken.subscribe(f),s.signal&&(s.signal.aborted?f():s.signal.addEventListener("abort",f)));const v=kBe(s.url);if(v&&Ts.protocols.indexOf(v)===-1){r(new wt("Unsupported protocol "+v+":",wt.ERR_BAD_REQUEST,t));return}y.send(i||null)})},jBe=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let r=new AbortController,s;const i=function(u){if(!s){s=!0,o();const f=u instanceof Error?u:this.reason;r.abort(f instanceof wt?f:new zv(f instanceof Error?f.message:f))}};let a=e&&setTimeout(()=>{a=null,i(new wt(`timeout ${e} of ms exceeded`,wt.ETIMEDOUT))},e);const o=()=>{t&&(a&&clearTimeout(a),a=null,t.forEach(u=>{u.unsubscribe?u.unsubscribe(i):u.removeEventListener("abort",i)}),t=null)};t.forEach(u=>u.addEventListener("abort",i));const{signal:c}=r;return c.unsubscribe=()=>ve.asap(o),c}},zBe=function*(t,e){let n=t.byteLength;if(n{const s=BBe(t,e);let i=0,a,o=c=>{a||(a=!0,r&&r(c))};return new ReadableStream({async pull(c){try{const{done:u,value:f}=await s.next();if(u){o(),c.close();return}let l=f.byteLength;if(n){let d=i+=l;n(d)}c.enqueue(new Uint8Array(f))}catch(u){throw o(u),u}},cancel(c){return o(c),s.return()}},{highWaterMark:2})},cR=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",ite=cR&&typeof ReadableStream=="function",HBe=cR&&(typeof TextEncoder=="function"?(t=>e=>t.encode(e))(new TextEncoder):async t=>new Uint8Array(await new Response(t).arrayBuffer())),ote=(t,...e)=>{try{return!!t(...e)}catch{return!1}},VBe=ite&&ote(()=>{let t=!1;const e=new Request(Ts.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),UU=64*1024,nM=ite&&ote(()=>ve.isReadableStream(new Response("").body)),YC={stream:nM&&(t=>t.body)};cR&&(t=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!YC[e]&&(YC[e]=ve.isFunction(t[e])?n=>n[e]():(n,r)=>{throw new wt(`Response type '${e}' is not supported`,wt.ERR_NOT_SUPPORT,r)})})})(new Response);const WBe=async t=>{if(t==null)return 0;if(ve.isBlob(t))return t.size;if(ve.isSpecCompliantForm(t))return(await new Request(Ts.origin,{method:"POST",body:t}).arrayBuffer()).byteLength;if(ve.isArrayBufferView(t)||ve.isArrayBuffer(t))return t.byteLength;if(ve.isURLSearchParams(t)&&(t=t+""),ve.isString(t))return(await HBe(t)).byteLength},GBe=async(t,e)=>{const n=ve.toFiniteNumber(t.getContentLength());return n??WBe(e)},qBe=cR&&(async t=>{let{url:e,method:n,data:r,signal:s,cancelToken:i,timeout:a,onDownloadProgress:o,onUploadProgress:c,responseType:u,headers:f,withCredentials:l="same-origin",fetchOptions:d}=ste(t);u=u?(u+"").toLowerCase():"text";let m=jBe([s,i&&i.toAbortSignal()],a),p;const h=m&&m.unsubscribe&&(()=>{m.unsubscribe()});let y;try{if(c&&VBe&&n!=="get"&&n!=="head"&&(y=await GBe(f,r))!==0){let A=new Request(e,{method:"POST",body:r,duplex:"half"}),k;if(ve.isFormData(r)&&(k=A.headers.get("content-type"))&&f.setContentType(k),A.body){const[R,E]=FU(y,KC(jU(c)));r=BU(A.body,UU,R,E)}}ve.isString(l)||(l=l?"include":"omit");const g="credentials"in Request.prototype;p=new Request(e,{...d,signal:m,method:n.toUpperCase(),headers:f.normalize().toJSON(),body:r,duplex:"half",credentials:g?l:void 0});let v=await fetch(p);const w=nM&&(u==="stream"||u==="response");if(nM&&(o||w&&h)){const A={};["status","statusText","headers"].forEach(T=>{A[T]=v[T]});const k=ve.toFiniteNumber(v.headers.get("content-length")),[R,E]=o&&FU(k,KC(jU(o),!0))||[];v=new Response(BU(v.body,UU,R,()=>{E&&E(),h&&h()}),A)}u=u||"text";let x=await YC[ve.findKey(YC,u)||"text"](v,t);return!w&&h&&h(),await new Promise((A,k)=>{nte(A,k,{data:x,headers:Ci.from(v.headers),status:v.status,statusText:v.statusText,config:t,request:p})})}catch(g){throw h&&h(),g&&g.name==="TypeError"&&/fetch/i.test(g.message)?Object.assign(new wt("Network Error",wt.ERR_NETWORK,t,p),{cause:g.cause||g}):wt.from(g,g&&g.code,t,p)}}),rM={http:lBe,xhr:FBe,fetch:qBe};ve.forEach(rM,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const HU=t=>`- ${t}`,KBe=t=>ve.isFunction(t)||t===null||t===!1,ate={getAdapter:t=>{t=ve.isArray(t)?t:[t];const{length:e}=t;let n,r;const s={};for(let i=0;i`adapter ${o} `+(c===!1?"is not supported by the environment":"is not available in the build"));let a=e?i.length>1?`since : `+i.map(HU).join(` @@ -317,7 +317,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho `+i):r.stack=i}catch{}}throw r}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=sp(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:i}=n;r!==void 0&&EE.assertOptions(r,{silentJSONParsing:za.transitional(za.boolean),forcedJSONParsing:za.transitional(za.boolean),clarifyTimeoutError:za.transitional(za.boolean)},!1),s!=null&&(ve.isFunction(s)?n.paramsSerializer={serialize:s}:EE.assertOptions(s,{encode:za.function,serialize:za.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),EE.assertOptions(n,{baseUrl:za.spelling("baseURL"),withXsrfToken:za.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let a=i&&ve.merge(i.common,i[n.method]);i&&ve.forEach(["delete","get","head","post","put","patch","common"],p=>{delete i[p]}),n.headers=Ci.concat(a,i);const o=[];let c=!0;this.interceptors.request.forEach(function(h){typeof h.runWhen=="function"&&h.runWhen(n)===!1||(c=c&&h.synchronous,o.unshift(h.fulfilled,h.rejected))});const u=[];this.interceptors.response.forEach(function(h){u.push(h.fulfilled,h.rejected)});let f,l=0,d;if(!c){const p=[VU.bind(this),void 0];for(p.unshift.apply(p,o),p.push.apply(p,u),d=p.length,f=Promise.resolve(n);l{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](s);r._listeners=null}),this.promise.then=s=>{let i;const a=new Promise(o=>{r.subscribe(o),i=o}).then(s);return a.cancel=function(){r.unsubscribe(i)},a},e(function(i,a,o){r.reason||(r.reason=new zv(i,a,o),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const e=new AbortController,n=r=>{e.abort(r)};return this.subscribe(n),e.signal.unsubscribe=()=>this.unsubscribe(n),e.signal}static source(){let e;return{token:new cte(function(s){e=s}),cancel:e}}};function QBe(t){return function(n){return t.apply(null,n)}}function ZBe(t){return ve.isObject(t)&&t.isAxiosError===!0}const sM={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(sM).forEach(([t,e])=>{sM[e]=t});function ute(t){const e=new Mh(t),n=Bee(Mh.prototype.request,e);return ve.extend(n,Mh.prototype,e,{allOwnKeys:!0}),ve.extend(n,e,null,{allOwnKeys:!0}),n.create=function(s){return ute(sp(t,s))},n}const _r=ute(H_);_r.Axios=Mh;_r.CanceledError=zv;_r.CancelToken=XBe;_r.isCancel=tte;_r.VERSION=lte;_r.toFormData=lR;_r.AxiosError=wt;_r.Cancel=_r.CanceledError;_r.all=function(e){return Promise.all(e)};_r.spread=QBe;_r.isAxiosError=ZBe;_r.mergeConfig=sp;_r.AxiosHeaders=Ci;_r.formToJSON=t=>ete(ve.isHTMLForm(t)?new FormData(t):t);_r.getAdapter=ate.getAdapter;_r.HttpStatusCode=sM;_r.default=_r;const{Axios:QUe,AxiosError:ZUe,CanceledError:JUe,isCancel:e5e,CancelToken:t5e,VERSION:n5e,all:r5e,Cancel:s5e,isAxiosError:i5e,spread:o5e,toFormData:a5e,AxiosHeaders:l5e,HttpStatusCode:c5e,formToJSON:u5e,getAdapter:d5e,mergeConfig:f5e}=_r,dte=()=>{const t=Ao.getItem("uecko.auth");return t&&t.token?`Bearer ${t.token}`:""},JBe=t=>(t.headers.Authorization=dte(),t),e4e=t=>Promise.reject(t),t4e=t=>((t==null?void 0:t.config).raw,t),n4e=t=>{if(console.debug("[response error]"),t.response){console.debug("1 => El servidor respondió con un código de estado > 200");const e=t.response.data,n=t.response.status;switch(console.debug(e),console.debug(n),n){case 400:console.error("Bad Request");break;case 401:console.error("UnAuthorized");break;case 403:console.error("Forbidden");break;case 404:console.error("Not found");break;case 422:console.error("Unprocessable Content");break}return Promise.reject(e)}else t.request?(console.debug("2 => El servidor no respondió"),console.error(t)):t.code==="ERR_CANCELED"?console.debug("3 => Petición cancelada"):(console.debug("4 => Error desconocido"),console.error(t));return console.groupEnd(),Promise.reject(t)};function r4e(t){return t.interceptors.request.use(JBe,e4e),t.interceptors.response.use(t4e,n4e),t}const fte={mode:"cors",cache:"no-cache",credentials:"same-origin",headers:{Accept:"application/json","Content-Type":"application/json; charset=utf-8","Cache-Control":"no-cache","Access-Control-Allow-Origin":"*"}},hte=()=>r4e(_r.create(fte)),s4e=(t,e=hte())=>({login:async({email:n,password:r})=>{Ao.clear();try{const s=await e.request({url:`${t}/auth/login`,method:"POST",data:{email:n,password:r}}),{data:i}=s;return Ao.setItem("uecko.auth",i),{success:!0,data:i}}catch{return{success:!1,error:{message:"Login failed",name:"Invalid email or password"}}}},logout:()=>(Ao.clear(),Promise.resolve({success:!0,redirectTo:"/login"})),check:()=>{const n=Ao.getItem("uecko.auth"),r=!!(n!=null&&n.token);return r||Ao.clear(),Promise.resolve(r?{authenticated:!0}:{authenticated:!1,redirectTo:"/login"})},getProfile:async()=>{try{const n=await e.request({url:`${t}/profile`,method:"GET"}),{data:r}=n,s=Ao.getItem("uecko.auth");return(s==null?void 0:s.id)===(r==null?void 0:r.id)?(Ao.setItem("uecko.profile",r),Promise.resolve(r)):Promise.resolve(null)}catch(n){throw n}},onError:n=>(Ao.clear(),Promise.resolve({error:n,logout:!0}))}),i4e=(t,e=hte())=>({name:()=>"AxiosDataProvider",getApiUrl:()=>t,getApiAuthorization:dte,getList:async n=>{const{resource:r,quickSearchTerm:s,pagination:i,filters:a=[],sort:o=[]}=n,c=`${t}/${r}`,u=new URLSearchParams,{page:f,limit:l}=c4e(i);u.append("page",String(f)),u.append("limit",String(l));const d=o4e(o);d.length&&u.append("$sort_by",d.join(","));const m=l4e(s,a);m.length&&u.append("q",m.join(","));const p=a4e(a);return p.length&&u.append("$filters",p.join(",")),(await e.request({url:`${c}?${u.toString()}`,method:"GET"})).data},getOne:async n=>{const{resource:r,id:s}=n;return(await e.request({url:`${t}/${r}/${s}`,method:"GET"})).data},createOne:async n=>{const{resource:r,data:s}=n;return(await e.request({url:`${t}/${r}`,method:"POST",data:s})).data},updateOne:async n=>{const{resource:r,data:s,id:i}=n;return(await e.request({url:`${t}/${r}/${i}`,method:"PUT",data:s})).data},removeOne:async n=>{const{resource:r,id:s}=n;await e.request({url:`${t}/${r}/${s}`,method:"DELETE"})},uploadFile:async n=>{const{path:r,file:s,key:i,onUploadProgress:a}=n,o=`${t}/${r}`,c=new FormData;return c.append(i||"file",s),(await e.post(o,c,{headers:{"Content-Type":"multipart/form-data"},onUploadProgress:a})).data},downloadPDF:async n=>{const{url:r,config:s}=n,i=await e.get(r,{responseType:"arraybuffer",...s}),a=i.headers["content-disposition"];let o="downloaded-file.pdf";if(a){const u=a.match(/filename="?(.+)"?/);u&&u[1]&&(o=u[1])}const c=new Blob([i.data],{type:"application/pdf"});return{filename:o,filedata:c}},custom:async n=>{const{url:r,path:s,method:i,responseType:a,headers:o,signal:c,data:u,...f}=n;let l;if(s)l=`${t}/${s}`;else if(r)l=r;else throw new Error('"url" or "path" param is missing');let d;const m={url:l.toString(),method:i,responseType:a,signal:c,...f,...fte};switch(i){case"put":case"post":case"patch":d=await e.request({...m,data:u});break;case"delete":d=await e.delete(l.toString(),{responseType:a,headers:o,...f});break;default:d=await e.get(l.toString(),{responseType:a,signal:c,headers:o,...f});break}return d.data}}),o4e=(t=[])=>t.map(({field:e,order:n})=>`${n==="DESC"?"-":"+"}${e}`),a4e=(t=[])=>t.filter(({field:e})=>e!=="q").map(({field:e,operator:n,value:r})=>`${e}[${n}]${r}`),l4e=(t=[],e=[])=>{var n;return(n=e.find(({field:r})=>r==="q"))!=null&&n.value?[e.find(({field:r})=>r==="q").value]:t},c4e=t=>{const{pageIndex:e=yb,pageSize:n=T$}=t||{};return{page:e,limit:n}},{slice:u4e,forEach:d4e}=[];function f4e(t){return d4e.call(u4e.call(arguments,1),e=>{if(e)for(const n in e)t[n]===void 0&&(t[n]=e[n])}),t}const GU=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,h4e=function(t,e){const r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{path:"/"},s=encodeURIComponent(e);let i=`${t}=${s}`;if(r.maxAge>0){const a=r.maxAge-0;if(Number.isNaN(a))throw new Error("maxAge should be a Number");i+=`; Max-Age=${Math.floor(a)}`}if(r.domain){if(!GU.test(r.domain))throw new TypeError("option domain is invalid");i+=`; Domain=${r.domain}`}if(r.path){if(!GU.test(r.path))throw new TypeError("option path is invalid");i+=`; Path=${r.path}`}if(r.expires){if(typeof r.expires.toUTCString!="function")throw new TypeError("option expires is invalid");i+=`; Expires=${r.expires.toUTCString()}`}if(r.httpOnly&&(i+="; HttpOnly"),r.secure&&(i+="; Secure"),r.sameSite)switch(typeof r.sameSite=="string"?r.sameSite.toLowerCase():r.sameSite){case!0:i+="; SameSite=Strict";break;case"lax":i+="; SameSite=Lax";break;case"strict":i+="; SameSite=Strict";break;case"none":i+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}return i},qU={create(t,e,n,r){let s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};n&&(s.expires=new Date,s.expires.setTime(s.expires.getTime()+n*60*1e3)),r&&(s.domain=r),document.cookie=h4e(t,encodeURIComponent(e),s)},read(t){const e=`${t}=`,n=document.cookie.split(";");for(let r=0;r-1&&(s=window.location.hash.substring(window.location.hash.indexOf("?")));const a=s.substring(1).split("&");for(let o=0;o0&&a[o].substring(0,c)===e&&(n=a[o].substring(c+1))}}return n}};let Yp=null;const KU=()=>{if(Yp!==null)return Yp;try{if(Yp=typeof window<"u"&&window.localStorage!==null,!Yp)return!1;const t="i18next.translate.boo";window.localStorage.setItem(t,"foo"),window.localStorage.removeItem(t)}catch{Yp=!1}return Yp};var g4e={name:"localStorage",lookup(t){let{lookupLocalStorage:e}=t;if(e&&KU())return window.localStorage.getItem(e)||void 0},cacheUserLanguage(t,e){let{lookupLocalStorage:n}=e;n&&KU()&&window.localStorage.setItem(n,t)}};let Xp=null;const YU=()=>{if(Xp!==null)return Xp;try{if(Xp=typeof window<"u"&&window.sessionStorage!==null,!Xp)return!1;const t="i18next.translate.boo";window.sessionStorage.setItem(t,"foo"),window.sessionStorage.removeItem(t)}catch{Xp=!1}return Xp};var v4e={name:"sessionStorage",lookup(t){let{lookupSessionStorage:e}=t;if(e&&YU())return window.sessionStorage.getItem(e)||void 0},cacheUserLanguage(t,e){let{lookupSessionStorage:n}=e;n&&YU()&&window.sessionStorage.setItem(n,t)}},y4e={name:"navigator",lookup(t){const e=[];if(typeof navigator<"u"){const{languages:n,userLanguage:r,language:s}=navigator;if(n)for(let i=0;i0?e:void 0}},b4e={name:"htmlTag",lookup(t){let{htmlTag:e}=t,n;const r=e||(typeof document<"u"?document.documentElement:null);return r&&typeof r.getAttribute=="function"&&(n=r.getAttribute("lang")),n}},w4e={name:"path",lookup(t){var s;let{lookupFromPathIndex:e}=t;if(typeof window>"u")return;const n=window.location.pathname.match(/\/([a-zA-Z-]*)/g);return Array.isArray(n)?(s=n[typeof e=="number"?e:0])==null?void 0:s.replace("/",""):void 0}},_4e={name:"subdomain",lookup(t){var s,i;let{lookupFromSubdomainIndex:e}=t;const n=typeof e=="number"?e+1:1,r=typeof window<"u"&&((i=(s=window.location)==null?void 0:s.hostname)==null?void 0:i.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i));if(r)return r[n]}};let pte=!1;try{document.cookie,pte=!0}catch{}const mte=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];pte||mte.splice(1,1);const x4e=()=>({order:mte,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:t=>t});class gte{constructor(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.type="languageDetector",this.detectors={},this.init(e,n)}init(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{languageUtils:{}},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=e,this.options=f4e(n,this.options||{},x4e()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=s=>s.replace("-","_")),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=r,this.addDetector(p4e),this.addDetector(m4e),this.addDetector(g4e),this.addDetector(v4e),this.addDetector(y4e),this.addDetector(b4e),this.addDetector(w4e),this.addDetector(_4e)}addDetector(e){return this.detectors[e.name]=e,this}detect(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.options.order,n=[];return e.forEach(r=>{if(this.detectors[r]){let s=this.detectors[r].lookup(this.options);s&&typeof s=="string"&&(s=[s]),s&&(n=n.concat(s))}}),n=n.map(r=>this.options.convertDetectedLanguage(r)),this.services&&this.services.languageUtils&&this.services.languageUtils.getBestMatchFromCodes?n:n.length>0?n[0]:null}cacheUserLanguage(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.options.caches;n&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(e)>-1||n.forEach(r=>{this.detectors[r]&&this.detectors[r].cacheUserLanguage(e,this.options)}))}}gte.type="languageDetector";const S4e={title:"Presupuestador para distribuidores",LoginPage:{title:"Pressupostador per a distribuïdors",description:"Introdueixi la seva adreça de correu electrònic i contrasenya per accedir-hi"}},E4e={translation:S4e},C4e={common:{loading:"Loading...",required:"required",cancel:"Cancel",no:"No",yes:"Yes",save:"Save",save_close:"Save and Close",accept:"OK",discard:"Discard",hide:"Hide",back:"Back",upload:"Upload",continue:"Continue",close:"Close",more:"More",add:"Add",sort_asc:"Asc",sort_asc_description:"In ascending order. Click to sort descending order.",sort_desc:"Desc",sort_desc_description:"In descending order. Click to sort in ascending order.",sort_none_description:"No sorting order. Click to sort in ascending order.",rows_selected:"{{count}} row(s) selected.",rows_selected_of_total:"{{count}} of {{total}} row(s) selected.",rows_per_page:"Rows per page",num_page_of_total:"Page {{count}} of {{total}}",go_to_first_page:"Go to first page",go_to_prev_page:"Go to previous page",go_to_next_page:"Go to next page",go_to_last_page:"Go to last page",error:"Error",actions:"Actions",open_menu:"Open menu",duplicate_row:"Duplicate",duplicate_selected_rows:"Duplicate",duplicate_selected_rows_tooltip:"Duplicate selected row(s)",append_empty_row:"Append row",append_empty_row_tooltip:"Append a empty row",append_article:"Append article",append_article_tooltip:"Select and add an item from the catalog",append_block:"Append text block",append_block_tooltip:"Select and add a text block",move_row:"Move row",remove_row:"Remove",remove_selected_rows:"Remove",remove_selected_rows_tooltip:"Remove selected row(s)",reset_selected_rows:"Reset selection",reset_selected_rows_tooltip:"Reset selected row(s)",insert_row_above:"Insert row above",insert_row_below:"Insert row below",pick_date:"Select a date",required_field:"This field is required",unsaved_changes_prompt:"There are unsaved changes. If you leave, you'll lose your changes.",edit:"Edit",remove:"Remove",archive:"Archive",duplicate:"Duplicate",print:"Print",disable_preview:"Disable preview",enable_preview:"Enable preview",filter:{reset_filter:"Reset filter",badget_remove_tooltip:"Remove this filter term",input_placeholder:"Type here to filter...",button_add_term:"Add filter term",button_add_term_tooltip:"Add filter term (or press Enter)",button_remove_all:"Remove all terms from filter",help_text:"Press Enter or click the + button to add a term to the filter. Use multiple terms for a broader search."}},components:{loading_indicator:{title:"Loading..."},loading_overlay:{title:"Loading...",subtitle:"This may take a few seconds. Please do not close this page."}},hooks:{use_unsaved_changes_notifier:{title:"Changes detected",subtitle:`Caution, there are pending changes to save on this page. If you continue, you will lose the changes.`,confirm_text:"Continue",cancel_text:"Cancel"}},main_menu:{home:"Home",settings:"Settings",dealers:"Dealers",catalog:"Catalog",quotes:"Quotes",orders:"Orders",search_placeholder:"Type here for search quotes and articles",user:{user_menu:"User menu",my_account:"My account",profile:"Profile",settings:"Settings",support:"Support",logout:"Logout"},logout_dialog:{title:"Confirm",description:"Are you sure you want to log out?",confirm_label:"Log out",cancel_label:"Cancel"}},login_page:{title:"Partner intranet",description:"Enter your email address and password to login",email_label:"Email",email_placeholder:"myemail@sample.com",password_label:"Password",forgotten_password:"Forgot your password?",become_dealer:"Do you want to become a Uecko partner?",contact_us:"Contact us",login:"Log in"},dashboard:{welcome:"Welcome"},catalog:{list:{title:"Catalog of articles",columns:{description:"Description",points:"Points",retail_price:"Retail price",quantity:"quantity"}}},quotes:{list:{title:"Quotes",subtitle:"",tabs_title:"Status",tabs:{all:"All",draft:"Draft",ready:"Ready",delivered:"Delivered",accepted:"Accepted",rejected:"Rejected",archived:"Archived"},columns:{date:"Date",date_sent:"Sent to Uecko",reference:"Reference",status:"Status",customer_reference:"Customer Ref.",customer_information:"Customer",total_price:"Imp. total",actions:{edit:"Edit quote",sent_to:"Send to Uecko"}},resume:{title:"Quote",download_quote:"Download quote",tabs:{resume:"Resume",preview:"Preview"},quote_information:"Quote Information",customer_information:"Customer Information",payment_information:"Payment Information",price_information:"Quote totals"}},create:{title:"New quote",tabs:{general:"General data",items:"Quote items",preview:"Quote preview",documents:"Documents",history:"History"},form_groups:{general:{title:"General Data",desc:"General data and quote customer"},status:{title:"Status",desc:"Quote status"},items:{title:"Quote Items",desc:"Quote detail lines. Use the catalog to make it easier to fill in the content."},documents:{title:"Attached Documents",desc:"Attach documents such as photos, drawings, sketches, etc. to your quotation."},history:{title:"History",desc:"Quote history"}},edit:{title:"Quote"}},edit:{title:"Quote",buttons:{save_quote:"Save quote"}},duplicate_action:{toast_success:"Quote duplicated"},downloading_dialog:{title:"Downloading quote",description:"Please wait while your quotation is generated and downloaded in PDF format...",progress:{label:"Download is in {{status}}",status_in_progress:"in progress",status_stopped:"stopped",value_label:"Elapsed time in seconds {{elapsed}}"},cancel_button:"Cancel the download",toast_success:"Quote downloaded"},catalog_picker_dialog:{title:"Select catalog items",description:"To complete your quote, you can add items from the catalog.",toast_article_added:"Catalog item added:"},blocks_picker_dialog:{title:"Select a text block",description:"To complete your quote, you can default text blocks.",toast_article_added:"Text block added:"},quote_status_editor:{trigger_button:"Change quote status",title:"Change quote status",status:{draft:{title:"Draft",description:"The quote is in the initial stages of creation."},ready:{title:"Ready",description:"The quote is completed and ready to be delivered to the customer."},delivered:{title:"Delivered",description:"The quote has been sent to the client and a response is awaited."},accepted:{title:"Accepted",description:"The customer has approved the quote."},rejected:{title:"Rejected",description:"The customer has not accepted the quotation."},archived:{title:"Archived",description:"The quote is archived."}},submit_button:"Change status",toast_status_changed:"Quote status changed to: {{newStatus}}"},discount_column:{label:"Show discount column",description:"Shows or hides the discount column in quote lines.",confirmation:{title:"Hide line discounts",description:"There are lines with discounts applied. Hiding the column will not remove those discounts: they will still affect the quote amount, but will no longer be shown in the lines or PDF.",confirm:"Hide column"}},inline_row_actions:{delete_confirmation:{title:"Remove row",description:"Are you sure you want to remove this row? This action cannot be undone.",confirm:"Remove row"}},status:{draft:"Draft",ready:"Ready",delivered:"Delivered",accepted:"Accepted",rejected:"Rejected",archived:"Archived"},form_fields:{date:{label:"Date",desc:"Quote's date",placeholder:""},reference:{label:"Reference",desc:"Quote reference",placeholder:""},status:{label:"Status",desc:"Quote status",placeholder:""},lang_code:{label:"Language",desc:"Quote language",placeholder:""},currency_code:{label:"Currency",desc:"Quote currency",placeholder:""},customer_reference:{label:"Customer reference",desc:"Customer reference for this quote",placeholder:""},customer_information:{label:"Customer's contact data",desc:"Recommendation: enter the customer's name on the first line, the address on the second line, and the zip code and city/state on the third line.",placeholder:`Name and surname Street and number -zip code and city or state...`},payment_method:{label:"Payment method",placeholder:"",desc:"Method of payment for this quote"},notes:{label:"Notes",placeholder:"",desc:"Quote's notes"},validity:{label:"Validity time",placeholder:"",desc:"Quote's validity time"},subtotal_price:{label:"Subtotal",placeholder:"",desc:"Quote subtotal"},discount:{label:"Discount (%)",placeholder:"",desc:"Percentage discount"},discount_value:{label:"Discount ({{value}}%)",placeholder:"",desc:"Percentage discount"},discount_price:{label:"Discount price",placeholder:"",desc:"Percentage discount price"},before_tax_price:{label:"Before tax price",placeholder:"",desc:"Before tax price"},tax:{label:"Tax (%)",placeholder:"",desc:"Percentage Tax"},tax_value:{label:"Tax ({{value}}%)",placeholder:"",desc:"Percentage Tax"},tax_price:{label:"Tax price",placeholder:"",desc:"Percentage tax price"},total_price:{label:"Total price",placeholder:"",desc:"Quote total price"},items:{quantity:{label:"Quantity",placeholder:"",desc:""},description:{label:"Description",placeholder:"",desc:""},unit_price:{label:"Unit price",placeholder:"",desc:"Item unit price"},subtotal_price:{label:"Subtotal",placeholder:"",desc:""},discount:{label:"Dto (%)",placeholder:"",desc:"Percentage discount"},total_price:{label:"Total price",placeholder:"",desc:"Total price with percentage discount"}}}},settings:{edit:{title:"Settings",subtitle:"",tabs:{profile:"Profile settings",quotes:"Quote settings",legal:"Legal settings"}},form_fields:{image:{label:"Logotype",placeholder:"",desc:""},contact_information:{label:"Your contact information",placeholder:"",desc:"Your contact information as a dealer that will appear on the quotes given to your customers."},default_tax:{label:"Default tax (%)",placeholder:"",desc:"Default tax rate for your quotes"},default_show_line_discount_column:{label:"Show discount column by default",desc:"New quotes will initially show the discount column in their lines. You can change this option later for each quote."},default_legal_terms:{label:"Legal terms",placeholder:"",desc:"Legal information to be included at the end of your quotes"},default_payment_method:{label:"Payment method",placeholder:"",desc:"Default payment method to be used for new quotes"},default_notes:{label:"Notes",placeholder:"",desc:"Default notes to be used for new quotes"},default_quote_validity:{label:"Quote validity",placeholder:"",desc:"Default validity time to be used for new quotes"}}}},A4e={translation:C4e},R4e={common:{loading:"Cargando...",required:"obligatorio",cancel:"Cancelar",no:"No",yes:"Sí",save:"Guardar",save_close:"Guardar y Cerrar",accept:"Aceptar",discard:"Descartar",hide:"Ocultar",back:"Volver",upload:"Cargar",continue:"Continuar",close:"Cerrar",more:"More",add:"Añadir",sort_asc:"Asc",sort_asc_description:"En order ascendente. Click para ordenar descendentemente.",sort_desc:"Desc",sort_desc_description:"En orden descendente. Click para ordenar ascendentemente.",sort_none_description:"Sin orden. Click para ordenar ascendentemente.",rows_selected:"{{count}} fila(s) seleccionadas.",rows_selected_of_total:"{{count}} de {{total}} fila(s) seleccionadas.",rows_per_page:"Filas por página",num_page_of_total:"Página {{count}} de {{total}}",go_to_first_page:"Ir a la primera página",go_to_prev_page:"Ir a la página anterior",go_to_next_page:"Ir a la página siguiente",go_to_last_page:"Ir a la última página",error:"Error",actions:"Acciones",open_menu:"Abrir el menú",duplicate_row:"Duplicar",duplicate_selected_rows:"Duplicar",duplicate_selected_rows_tooltip:"Duplica las fila(s) seleccionadas(s)",append_empty_row:"Añadir fila",append_empty_row_tooltip:"Añadir una fila vacía",append_article:"Añadir artículo",append_article_tooltip:"Elegir un artículo del catálogo y añadirlo",append_block:"Añadir bloque de texto",append_block_tooltip:"Elegir un bloque de texto y añadirlo",move_row:"Mover fila",remove_row:"Eliminar",remove_selected_rows:"Eliminar",remove_selected_rows_tooltip:"Elimina las fila(s) seleccionadas(s)",reset_selected_rows:"Quitar selection",reset_selected_rows_tooltip:"Dejar de seleccionar la(s) fila(s)",insert_row_above:"Insertar fila encima",insert_row_below:"Insertar fila debajo",pick_date:"Elige una fecha",required_field:"Este campo es obligatorio",unsaved_changes_prompt:"Los últimos cambios no se han guardado. Si continúas, se perderán.",edit:"Editar",remove:"Eliminar",archive:"Archivar",duplicate:"Duplicar",print:"Imprimir",disable_preview:"Ocultar vista previa",enable_preview:"Mostrar vista previa",filter:{reset_filter:"Quitar el filtro",badget_remove_tooltip:"Quitar este término del filtro",input_placeholder:"Escribe aquí para filtrar...",button_add_term:"Añadir término al filtro",button_add_term_tooltip:"Añadir término al filtro (o pulsa Enter)",button_remove_all:"Quitar todos los términos del filtro",help_text:"Presiona Enter o haz clic en el botón + para añadir un término al filtro. Usa múltiples términos para una búsqueda más amplia."}},components:{LoadingIndicator:{title:"Cargando..."},loading_overlay:{title:"Cargando...",subtitle:"Esto puede tardar unos segundos. Por favor, no cierre esta página."}},hooks:{use_unsaved_changes_notifier:{title:"Se han detectado cambios",subtitle:`Atención, hay cambios pendientes de guardar en esta página. +zip code and city or state...`},payment_method:{label:"Payment method",placeholder:"",desc:"Method of payment for this quote"},notes:{label:"Notes",placeholder:"",desc:"Quote's notes"},validity:{label:"Validity time",placeholder:"",desc:"Quote's validity time"},subtotal_price:{label:"Subtotal",placeholder:"",desc:"Quote subtotal"},discount:{label:"Discount (%)",placeholder:"",desc:"Percentage discount"},discount_value:{label:"Discount ({{value}}%)",placeholder:"",desc:"Percentage discount"},discount_price:{label:"Discount price",placeholder:"",desc:"Percentage discount price"},before_tax_price:{label:"Before tax price",placeholder:"",desc:"Before tax price"},tax:{label:"Tax (%)",placeholder:"",desc:"Percentage Tax"},tax_value:{label:"Tax ({{value}}%)",placeholder:"",desc:"Percentage Tax"},tax_price:{label:"Tax price",placeholder:"",desc:"Percentage tax price"},total_price:{label:"Total price",placeholder:"",desc:"Quote total price"},items:{quantity:{label:"Quantity",placeholder:"",desc:""},description:{label:"Description",placeholder:"",desc:""},unit_price:{label:"Unit price",placeholder:"",desc:"Item unit price"},subtotal_price:{label:"Subtotal",placeholder:"",desc:""},discount:{label:"Dto (%)",placeholder:"",desc:"Percentage discount"},total_price:{label:"Total price",placeholder:"",desc:"Total price with percentage discount"}}}},settings:{edit:{title:"Settings",subtitle:"",tabs:{profile:"Profile settings",quotes:"Quote settings",legal:"Legal settings"}},form_fields:{image:{label:"Logotype",placeholder:"",desc:""},contact_information:{label:"Your contact information",placeholder:"",desc:"Your contact information as a dealer that will appear on the quotes given to your customers."},default_tax:{label:"Default tax (%)",placeholder:"",desc:"Default tax rate for your quotes"},default_tax_label:{label:"Tax label",placeholder:"% VAT",desc:"Name or label shown alongside the tax"},default_show_line_discount_column:{label:"Show discount column by default",desc:"New quotes will initially show the discount column in their lines. You can change this option later for each quote."},default_legal_terms:{label:"Legal terms",placeholder:"",desc:"Legal information to be included at the end of your quotes"},default_payment_method:{label:"Payment method",placeholder:"",desc:"Default payment method to be used for new quotes"},default_notes:{label:"Notes",placeholder:"",desc:"Default notes to be used for new quotes"},default_quote_validity:{label:"Quote validity",placeholder:"",desc:"Default validity time to be used for new quotes"}}}},A4e={translation:C4e},R4e={common:{loading:"Cargando...",required:"obligatorio",cancel:"Cancelar",no:"No",yes:"Sí",save:"Guardar",save_close:"Guardar y Cerrar",accept:"Aceptar",discard:"Descartar",hide:"Ocultar",back:"Volver",upload:"Cargar",continue:"Continuar",close:"Cerrar",more:"More",add:"Añadir",sort_asc:"Asc",sort_asc_description:"En order ascendente. Click para ordenar descendentemente.",sort_desc:"Desc",sort_desc_description:"En orden descendente. Click para ordenar ascendentemente.",sort_none_description:"Sin orden. Click para ordenar ascendentemente.",rows_selected:"{{count}} fila(s) seleccionadas.",rows_selected_of_total:"{{count}} de {{total}} fila(s) seleccionadas.",rows_per_page:"Filas por página",num_page_of_total:"Página {{count}} de {{total}}",go_to_first_page:"Ir a la primera página",go_to_prev_page:"Ir a la página anterior",go_to_next_page:"Ir a la página siguiente",go_to_last_page:"Ir a la última página",error:"Error",actions:"Acciones",open_menu:"Abrir el menú",duplicate_row:"Duplicar",duplicate_selected_rows:"Duplicar",duplicate_selected_rows_tooltip:"Duplica las fila(s) seleccionadas(s)",append_empty_row:"Añadir fila",append_empty_row_tooltip:"Añadir una fila vacía",append_article:"Añadir artículo",append_article_tooltip:"Elegir un artículo del catálogo y añadirlo",append_block:"Añadir bloque de texto",append_block_tooltip:"Elegir un bloque de texto y añadirlo",move_row:"Mover fila",remove_row:"Eliminar",remove_selected_rows:"Eliminar",remove_selected_rows_tooltip:"Elimina las fila(s) seleccionadas(s)",reset_selected_rows:"Quitar selection",reset_selected_rows_tooltip:"Dejar de seleccionar la(s) fila(s)",insert_row_above:"Insertar fila encima",insert_row_below:"Insertar fila debajo",pick_date:"Elige una fecha",required_field:"Este campo es obligatorio",unsaved_changes_prompt:"Los últimos cambios no se han guardado. Si continúas, se perderán.",edit:"Editar",remove:"Eliminar",archive:"Archivar",duplicate:"Duplicar",print:"Imprimir",disable_preview:"Ocultar vista previa",enable_preview:"Mostrar vista previa",filter:{reset_filter:"Quitar el filtro",badget_remove_tooltip:"Quitar este término del filtro",input_placeholder:"Escribe aquí para filtrar...",button_add_term:"Añadir término al filtro",button_add_term_tooltip:"Añadir término al filtro (o pulsa Enter)",button_remove_all:"Quitar todos los términos del filtro",help_text:"Presiona Enter o haz clic en el botón + para añadir un término al filtro. Usa múltiples términos para una búsqueda más amplia."}},components:{LoadingIndicator:{title:"Cargando..."},loading_overlay:{title:"Cargando...",subtitle:"Esto puede tardar unos segundos. Por favor, no cierre esta página."}},hooks:{use_unsaved_changes_notifier:{title:"Se han detectado cambios",subtitle:`Atención, hay cambios pendientes de guardar en esta página. Si continúa, perderá los cambios.`,confirm_text:"Continuar",cancel_text:"No continuar"}},main_menu:{home:"Inicio",settings:"Ajustes",dealers:"Distribuidores",catalog:"Catálogo",quotes:"Cotizaciones",orders:"Pedidos",search_placeholder:"Buscar productos, cotizaciones, etc...",user:{user_menu:"Menú del usuario",my_account:"Mi cuenta",profile:"Perfil",settings:"Ajustes",support:"Soporte",logout:"Salir"},logout_dialog:{title:"Salir de la cuenta",description:"¿Desea salir de su cuenta?",confirm_label:"Salir",cancel_label:"Cancelar"}},login_page:{title:"Presupuestador para distribuidores",description:"Introduzca su dirección de correo electrónico y contraseña para acceder",email_label:"Email",email_placeholder:"micorreo@ejemplo.com",password_label:"Contraseña",forgotten_password:"¿Has olvidado tu contraseña?",become_dealer:"¿Quieres ser distribuidor de Uecko?",contact_us:"Contacta con nosotros",login:"Entrar"},dashboard:{welcome:"Bienvenido"},catalog:{list:{title:"Catálogo de artículos",columns:{description:"Descripción",points:"Puntos",retail_price:"PVP",quantity:"Cantidad"}}},quotes:{list:{title:"Cotizaciones",subtitle:"",tabs_title:"Estados",tabs:{all:"Todas",draft:"Borradores",ready:"Preparados",delivered:"Entregado",accepted:"Aceptados",rejected:"Rechazados",archived:"Archivados"},columns:{date:"Fecha",date_sent:"Enviado a Uecko",reference:"Referencia",status:"Estado",customer_reference:"Ref. cliente",customer_information:"Cliente",total_price:"Imp. total",actions:{edit:"Editar",sent_to:"Enviar a Uecko"}},resume:{title:"Cotización",download_quote:"Descargar",tabs:{resume:"Resumen",preview:"Previsualización"},quote_information:"Información",customer_information:"Cliente",payment_information:"Pago",price_information:"Importes"}},create:{title:"Nueva cotización",tabs:{general:"Datos generales",items:"Contenido",preview:"Vista previa",documents:"Documentos",history:"Historial"},form_groups:{general:{title:"Datos generales",desc:"Datos generales y cliente al que va la cotización"},status:{title:"Estado",desc:"Estado de la cotización"},items:{title:"Contenido de la cotización",desc:"Líneas de detalle de la cotización. Ayúdese del catálogo para rellenar más fácilmente el contenido."},documents:{title:"Documentos",desc:"Añada adjuntar con su cotización documentos como fotos, planos, croquis, etc."},history:{title:"Historial",desc:"Historial de la cotización"}},edit:{title:"Cotización"}},edit:{title:"Cotización",buttons:{save_quote:"Guardar cotización"}},duplicate_action:{toast_success:"Cotización duplicada"},downloading_dialog:{title:"Descargando cotización",description:"Espere mientras se genera la cotización y se descarga en formato PDF...",progress:{label:"La descarga está {{status}}",status_in_progress:"en marcha",status_stopped:"parada",value_label:"Elapsed time in seconds {{elapsed}}"},cancel_button:"Cancelar la descarga",toast_success:"Cotización descargada"},catalog_picker_dialog:{title:"Seleccionar artículos del catálogo",description:"Para rellenar su cotización, puede añadir artículos del catálogo.",toast_article_added:"Artículo del catálogo añadido:"},blocks_picker_dialog:{title:"Selecctionar bloques de texto",description:"Para ayudar a rellenar la cotización, puede añadir bloques de texto predefinidos de esta lista.",toast_article_added:"Bloque de texto añadido:"},quote_sent_to_editor:{trigger_button:"Enviar a Uecko",title:"Enviar la cotización a Uecko",description:"¿Desea enviar esta cotización a Uecko? Esta acción no se puede deshacer.",submit_button:"Enviar",toast_status_changed:"Cotización enviada a Uecko"},quote_status_editor:{trigger_button:"Cambiar el estado",title:"Cambiar el estado de la cotización",status:{draft:{title:"Borrador",description:"La cotización está en fase inicial de creación."},ready:{title:"Preparado",description:"La cotización está completo y listo para ser entregado al cliente."},delivered:{title:"Entregado",description:"La cotización ha sido enviado al cliente y se espera su respuesta."},accepted:{title:"Aceptado",description:"El cliente ha aprobado la cotización."},rejected:{title:"Rechazado",description:"El cliente no ha aceptado la cotización."},archived:{title:"Archivado",description:"La cotización se ha guardado para referencia futura."}},submit_button:"Cambiar estado",toast_status_changed:"Estado de la cotización cambiado a: {{newStatus}}"},discount_column:{label:"Mostrar columna descuento",description:"Muestra u oculta la columna de descuento en las líneas.",confirmation:{title:"Ocultar descuentos de línea",description:"Hay líneas con descuento aplicado. Ocultar la columna no eliminará esos descuentos: seguirán afectando al importe de la cotización, pero dejarán de mostrarse en las líneas y en el PDF.",confirm:"Ocultar columna"}},inline_row_actions:{delete_confirmation:{title:"Eliminar fila",description:"¿Seguro que quieres eliminar esta fila? Esta acción no se puede deshacer.",confirm:"Eliminar fila"}},status:{draft:"Borrador",ready:"Preparado",delivered:"Entregado",accepted:"Aceptado",rejected:"Rechazado",archived:"Archivado"},form_fields:{date:{label:"Fecha",desc:"Fecha de esta cotización",placeholder:""},reference:{label:"Referencia",desc:"Referencia para esta cotización",placeholder:""},lang_code:{label:"Idioma",desc:"Idioma de la cotización",placeholder:""},currency_code:{label:"Moneda",desc:"Moneda de la cotización",placeholder:""},customer_reference:{label:"Referencia del cliente",desc:"Referencia para el cliente de esta cotización",placeholder:""},customer_information:{label:"Datos del cliente",desc:"Recomensación: escriba el nombre del cliente en la primera línea, la direccion en la segunda y el código postal y ciudad en la tercera.",placeholder:`Nombre y apellidos Calle y número -Código postal y ciudad...`},payment_method:{label:"Forma de pago",placeholder:"placeholder",desc:"Forma de pago que se utilizará en esta cotización"},notes:{label:"Notas",placeholder:"",desc:"Notas a incluir en la cotización"},validity:{label:"Validez de la cotización",placeholder:"",desc:"Validez de la cotización"},subtotal_price:{label:"Importe neto",placeholder:"",desc:""},discount:{label:"Descuento (%)",placeholder:"",desc:"Porcentaje de descuento"},discount_value:{label:"Descuento ({{value}}%)",placeholder:"",desc:"Porcentaje de descuento"},discount_price:{label:"Imp. descuento",placeholder:"",desc:"Importe del descuento"},before_tax_price:{label:"Base imponible",placeholder:"",desc:""},tax:{label:"IVA (%)",placeholder:"",desc:"Porcentaje de IVA"},tax_value:{label:"IVA ({{value}}%)",placeholder:"",desc:"Porcentaje de IVA"},tax_price:{label:"Imp. IVA",placeholder:"",desc:"Importe del IVA"},total_price:{label:"Total price",placeholder:"",desc:"Quote total price"},items:{quantity:{label:"Cantidad",placeholder:"",desc:""},description:{label:"Descripción",placeholder:"",desc:""},unit_price:{label:"Imp. unitario",placeholder:"",desc:"Importe unitario del artículo"},subtotal_price:{label:"Subtotal",placeholder:"",desc:""},discount:{label:"Dto (%)",placeholder:"",desc:"Porcentaje de descuento"},total_price:{label:"Imp. total",placeholder:"",desc:"Importe total con el descuento ya aplicado"}}}},settings:{edit:{title:"Ajustes",subtitle:"",tabs:{profile:"Ajustes de perfil",quotes:"Ajustes legales",legal:"Ajustes para cotizaciones"}},form_fields:{logo:{label:"Logotipo",placeholder:"",desc:"Este logotipo aparecerá en las propuestas exportadas en PDF",requirements:"Se permiten ficheros JPG o PNG. Las dimensiones del logotipo deben ser 200x100 píxeles o proporcionales.",upload:"Subir logotipo",invalid_format:"Sólo se permiten ficheros JPG o PNG",invalid_dimensions:"Las dimensiones del logotipo deben ser 200x100 píxeles o proporcionales."},contact_information:{label:"Información de contacto",placeholder:"",desc:"Esta información de contacto aparecerá en las cotizaciones que entregue a sus clientes."},default_tax:{label:"IVA por defecto (%)",placeholder:"",desc:"Porcentaje de IVA por defecto en las cotizaciones"},default_show_line_discount_column:{label:"Mostrar columna descuento por defecto",desc:"Los nuevos presupuestos mostrarán inicialmente la columna de descuento en las líneas. Podrás cambiar esta opción posteriormente en cada presupuesto."},default_legal_terms:{label:"Cláusulas legales",placeholder:"",desc:"Texto de texto legal que desee incluir en todas las cotizaciones nuevas"},default_payment_method:{label:"Forma de pago",placeholder:"",desc:"Texto para la forma de pago que se utilizará en las cotizaciones nuevas"},default_notes:{label:"Notas",placeholder:"",desc:"Notas a incluir en todas las cotizaciones nuevas"},default_quote_validity:{label:"Validez por defecto",placeholder:"",desc:"Texto para indicar el tiempo de validez de la cotización"}}},support:{modal:{title:"Enviar una incidencia",subtitle:"Utiliza este formulario para informar sobre cualquier problema que hayas encontrado mientras usabas la aplicación. Nuestro equipo de desarrollo revisará tu incidencia y tratará de resolverla."},form_fields:{}}},P4e={translation:R4e};hs.use(gte).use(s$e).init({detection:{order:["navigator"]},debug:!1,fallbackLng:"es",interpolation:{escapeValue:!1},resources:{ca:E4e,en:A4e,es:P4e}});function T4e(){const t=new lde({defaultOptions:{queries:{retry:!1,staleTime:1e4}}});return P.jsx(i$e,{i18n:hs,children:P.jsx(hde,{client:t,children:P.jsx(hMe,{dataSource:i4e("https://presupuestos.uecko.com:13001/api/v1"),children:P.jsx(Gue,{authActions:s4e("https://presupuestos.uecko.com:13001/api/v1"),children:P.jsxs(aze,{defaultTheme:"light",storageKey:"vite-ui-theme",children:[P.jsx(LDe,{delayDuration:0,children:P.jsx(zee,{children:P.jsx(_.Suspense,{fallback:P.jsx(xs,{}),children:P.jsx(Sze,{})})})}),P.jsx(IX,{}),P.jsx(Qje,{}),!1]})})})})})}xk.createRoot(document.getElementById("uecko")).render(P.jsx(se.StrictMode,{children:P.jsx(T4e,{})}));export{jRe as $,aK as A,no as B,_fe as C,i0 as D,QD as E,ZD as F,oUe as G,BTe as H,aUe as I,dr as J,UTe as K,DUe as L,NC as M,WOe as N,VTe as O,PPe as P,yb as Q,Zl as R,pTe as S,dL as T,n_ as U,RQ as V,LW as W,IW as X,$W as Y,FW as Z,jW as _,MV as a,fL as a$,Ske as a0,kke as a1,Eke as a2,Rke as a3,Pke as a4,Cke as a5,Tke as a6,zW as a7,lK as a8,q1e as a9,Q1e as aA,wMe as aB,Lv as aC,LX as aD,pAe as aE,kIe as aF,z4 as aG,xMe as aH,M1 as aI,V4 as aJ,H4 as aK,vAe as aL,gf as aM,hhe as aN,phe as aO,mhe as aP,xs as aQ,OQ as aR,_U as aS,AIe as aT,a$e as aU,RIe as aV,NIe as aW,LDe as aX,Tfe as aY,gUe as aZ,vUe as a_,Owe as aa,Id as ab,VI as ac,fA as ad,UA as ae,hA as af,cZ as ag,jo as ah,pA as ai,BA as aj,AAe as ak,yZ as al,mZ as am,VUe as an,$$ as ao,HUe as ap,YIe as aq,UUe as ar,HIe as as,Hc as at,_m as au,gMe as av,se as aw,fMe as ax,lze as ay,bUe as az,Cde as b,kC as b$,IDe as b0,vMe as b1,aZ as b2,NUe as b3,jV as b4,W1e as b5,zUe as b6,Jh as b7,iIe as b8,Dd as b9,l0 as bA,ks as bB,jUe as bC,FUe as bD,$Ue as bE,YQ as bF,KQ as bG,dLe as bH,uLe as bI,XLe as bJ,h1e as bK,m1e as bL,g1e as bM,y1e as bN,b1e as bO,v1e as bP,G4e as bQ,K4e as bR,SIe as bS,Pfe as bT,KUe as bU,O6 as bV,dUe as bW,Mke as bX,Lke as bY,Ike as bZ,PUe as b_,yr as ba,SMe as bb,EIe as bc,BUe as bd,CIe as be,yUe as bf,Z1e as bg,L8 as bh,AK as bi,cPe as bj,qUe as bk,xke as bl,wfe as bm,rW as bn,L4e as bo,AL as bp,RL as bq,TL as br,kL as bs,PL as bt,NL as bu,DL as bv,MUe as bw,OUe as bx,IUe as by,LUe as bz,FV as c,yMe as c0,uDe as c1,eAe as c2,Zr as d,ZPe as e,ce as f,eTe as g,_a as h,CQ as i,P as j,$V as k,dMe as l,D4e as m,fxe as n,hxe as o,D8 as p,N8 as q,_ as r,M8 as s,O8 as t,xV as u,z4e as v,tr as w,Bpe as x,z1e as y,B1e as z}; +Código postal y ciudad...`},payment_method:{label:"Forma de pago",placeholder:"placeholder",desc:"Forma de pago que se utilizará en esta cotización"},notes:{label:"Notas",placeholder:"",desc:"Notas a incluir en la cotización"},validity:{label:"Validez de la cotización",placeholder:"",desc:"Validez de la cotización"},subtotal_price:{label:"Importe neto",placeholder:"",desc:""},discount:{label:"Descuento (%)",placeholder:"",desc:"Porcentaje de descuento"},discount_value:{label:"Descuento ({{value}}%)",placeholder:"",desc:"Porcentaje de descuento"},discount_price:{label:"Imp. descuento",placeholder:"",desc:"Importe del descuento"},before_tax_price:{label:"Base imponible",placeholder:"",desc:""},tax:{label:"IVA (%)",placeholder:"",desc:"Porcentaje de IVA"},tax_value:{label:"IVA ({{value}}%)",placeholder:"",desc:"Porcentaje de IVA"},tax_price:{label:"Imp. IVA",placeholder:"",desc:"Importe del IVA"},total_price:{label:"Total price",placeholder:"",desc:"Quote total price"},items:{quantity:{label:"Cantidad",placeholder:"",desc:""},description:{label:"Descripción",placeholder:"",desc:""},unit_price:{label:"Imp. unitario",placeholder:"",desc:"Importe unitario del artículo"},subtotal_price:{label:"Subtotal",placeholder:"",desc:""},discount:{label:"Dto (%)",placeholder:"",desc:"Porcentaje de descuento"},total_price:{label:"Imp. total",placeholder:"",desc:"Importe total con el descuento ya aplicado"}}}},settings:{edit:{title:"Ajustes",subtitle:"",tabs:{profile:"Ajustes de perfil",quotes:"Ajustes legales",legal:"Ajustes para cotizaciones"}},form_fields:{logo:{label:"Logotipo",placeholder:"",desc:"Este logotipo aparecerá en las propuestas exportadas en PDF",requirements:"Se permiten ficheros JPG o PNG. Las dimensiones del logotipo deben ser 200x100 píxeles o proporcionales.",upload:"Subir logotipo",invalid_format:"Sólo se permiten ficheros JPG o PNG",invalid_dimensions:"Las dimensiones del logotipo deben ser 200x100 píxeles o proporcionales."},contact_information:{label:"Información de contacto",placeholder:"",desc:"Esta información de contacto aparecerá en las cotizaciones que entregue a sus clientes."},default_tax:{label:"Impuesto por defecto (%)",placeholder:"",desc:"Porcentaje de impuesto por defecto en las cotizaciones"},default_tax_label:{label:"Etiqueta del impuesto",placeholder:"% IVA",desc:"Nombre o etiqueta que se mostrará junto al impuesto"},default_show_line_discount_column:{label:"Mostrar columna descuento por defecto",desc:"Los nuevos presupuestos mostrarán inicialmente la columna de descuento en las líneas. Podrás cambiar esta opción posteriormente en cada presupuesto."},default_legal_terms:{label:"Cláusulas legales",placeholder:"",desc:"Texto de texto legal que desee incluir en todas las cotizaciones nuevas"},default_payment_method:{label:"Forma de pago",placeholder:"",desc:"Texto para la forma de pago que se utilizará en las cotizaciones nuevas"},default_notes:{label:"Notas",placeholder:"",desc:"Notas a incluir en todas las cotizaciones nuevas"},default_quote_validity:{label:"Validez por defecto",placeholder:"",desc:"Texto para indicar el tiempo de validez de la cotización"}}},support:{modal:{title:"Enviar una incidencia",subtitle:"Utiliza este formulario para informar sobre cualquier problema que hayas encontrado mientras usabas la aplicación. Nuestro equipo de desarrollo revisará tu incidencia y tratará de resolverla."},form_fields:{}}},P4e={translation:R4e};hs.use(gte).use(s$e).init({detection:{order:["navigator"]},debug:!1,fallbackLng:"es",interpolation:{escapeValue:!1},resources:{ca:E4e,en:A4e,es:P4e}});function T4e(){const t=new lde({defaultOptions:{queries:{retry:!1,staleTime:1e4}}});return P.jsx(i$e,{i18n:hs,children:P.jsx(hde,{client:t,children:P.jsx(hMe,{dataSource:i4e("https://presupuestos.uecko.com:13001/api/v1"),children:P.jsx(Gue,{authActions:s4e("https://presupuestos.uecko.com:13001/api/v1"),children:P.jsxs(aze,{defaultTheme:"light",storageKey:"vite-ui-theme",children:[P.jsx(LDe,{delayDuration:0,children:P.jsx(zee,{children:P.jsx(_.Suspense,{fallback:P.jsx(xs,{}),children:P.jsx(Sze,{})})})}),P.jsx(IX,{}),P.jsx(Qje,{}),!1]})})})})})}xk.createRoot(document.getElementById("uecko")).render(P.jsx(se.StrictMode,{children:P.jsx(T4e,{})}));export{jRe as $,aK as A,no as B,_fe as C,i0 as D,QD as E,ZD as F,oUe as G,BTe as H,aUe as I,dr as J,UTe as K,DUe as L,NC as M,WOe as N,VTe as O,PPe as P,yb as Q,Zl as R,pTe as S,dL as T,n_ as U,RQ as V,LW as W,IW as X,$W as Y,FW as Z,jW as _,MV as a,fL as a$,Ske as a0,kke as a1,Eke as a2,Rke as a3,Pke as a4,Cke as a5,Tke as a6,zW as a7,lK as a8,q1e as a9,Q1e as aA,wMe as aB,Lv as aC,LX as aD,pAe as aE,kIe as aF,z4 as aG,xMe as aH,M1 as aI,V4 as aJ,H4 as aK,vAe as aL,gf as aM,hhe as aN,phe as aO,mhe as aP,xs as aQ,OQ as aR,_U as aS,AIe as aT,a$e as aU,RIe as aV,NIe as aW,LDe as aX,Tfe as aY,gUe as aZ,vUe as a_,Owe as aa,Id as ab,VI as ac,fA as ad,UA as ae,hA as af,cZ as ag,jo as ah,pA as ai,BA as aj,AAe as ak,yZ as al,mZ as am,VUe as an,$$ as ao,HUe as ap,YIe as aq,UUe as ar,HIe as as,Hc as at,_m as au,gMe as av,se as aw,fMe as ax,lze as ay,bUe as az,Cde as b,kC as b$,IDe as b0,vMe as b1,aZ as b2,NUe as b3,jV as b4,W1e as b5,zUe as b6,Jh as b7,iIe as b8,Dd as b9,l0 as bA,ks as bB,jUe as bC,FUe as bD,$Ue as bE,YQ as bF,KQ as bG,dLe as bH,uLe as bI,XLe as bJ,h1e as bK,m1e as bL,g1e as bM,y1e as bN,b1e as bO,v1e as bP,G4e as bQ,K4e as bR,SIe as bS,Pfe as bT,KUe as bU,O6 as bV,dUe as bW,Mke as bX,Lke as bY,Ike as bZ,PUe as b_,yr as ba,SMe as bb,EIe as bc,BUe as bd,CIe as be,yUe as bf,Z1e as bg,L8 as bh,AK as bi,cPe as bj,qUe as bk,xke as bl,wfe as bm,rW as bn,L4e as bo,AL as bp,RL as bq,TL as br,kL as bs,PL as bt,NL as bu,DL as bv,MUe as bw,OUe as bx,IUe as by,LUe as bz,FV as c,yMe as c0,uDe as c1,eAe as c2,Zr as d,ZPe as e,ce as f,eTe as g,_a as h,CQ as i,P as j,$V as k,dMe as l,D4e as m,fxe as n,hxe as o,D8 as p,N8 as q,_ as r,M8 as s,O8 as t,xV as u,z4e as v,tr as w,Bpe as x,z1e as y,B1e as z}; diff --git a/dist/client/index.html b/dist/client/index.html index 4f0d2b7..6c49875 100644 --- a/dist/client/index.html +++ b/dist/client/index.html @@ -8,7 +8,7 @@ Presupuestador Uecko - + diff --git a/server/src/contexts/profile/application/UpdateProfile.useCase.ts b/server/src/contexts/profile/application/UpdateProfile.useCase.ts index bc31985..6089245 100644 --- a/server/src/contexts/profile/application/UpdateProfile.useCase.ts +++ b/server/src/contexts/profile/application/UpdateProfile.useCase.ts @@ -61,6 +61,15 @@ export class UpdateProfileUseCase profile.defaultShowLineDiscountColumn = profileDTO.default_show_line_discount_column ?? profile.defaultShowLineDiscountColumn; + if (profileDTO.default_tax_label !== undefined) { + const taxLabelOrError = TextValueObject.create(profileDTO.default_tax_label); + if (taxLabelOrError.isFailure) { + return Result.fail(taxLabelOrError.error); + } + + profile.defaultTaxLabel = taxLabelOrError.object; + } + const taxOrError = Percentage.create(profileDTO.default_tax); if (taxOrError.isFailure) { return Result.fail(taxOrError.error); diff --git a/server/src/contexts/profile/domain/entities/Profile.ts b/server/src/contexts/profile/domain/entities/Profile.ts index 30c10d5..9be8e25 100644 --- a/server/src/contexts/profile/domain/entities/Profile.ts +++ b/server/src/contexts/profile/domain/entities/Profile.ts @@ -24,6 +24,7 @@ export interface IProfileProps { defaultLegalTerms: Note; defaultQuoteValidity: Note; defaultTax: Percentage; + defaultTaxLabel: Note; defaultShowLineDiscountColumn: boolean; logo: ProfileLogotype; @@ -43,6 +44,7 @@ export interface IProfile { defaultQuoteValidity: Note; defaultTax: Percentage; + defaultTaxLabel: Note; defaultShowLineDiscountColumn: boolean; logo: ProfileLogotype; @@ -118,6 +120,14 @@ export class Profile extends AggregateRoot implements IProfile { this.props.defaultTax = newDefaultTax; } + get defaultTaxLabel(): Note { + return this.props.defaultTaxLabel; + } + + set defaultTaxLabel(newDefaultTaxLabel: Note) { + this.props.defaultTaxLabel = newDefaultTaxLabel; + } + get defaultShowLineDiscountColumn(): boolean { return this.props.defaultShowLineDiscountColumn; } diff --git a/server/src/contexts/profile/infrastructure/express/controllers/getProfile/presenter/GetProfile.presenter.ts b/server/src/contexts/profile/infrastructure/express/controllers/getProfile/presenter/GetProfile.presenter.ts index 4785575..31bd9d3 100644 --- a/server/src/contexts/profile/infrastructure/express/controllers/getProfile/presenter/GetProfile.presenter.ts +++ b/server/src/contexts/profile/infrastructure/express/controllers/getProfile/presenter/GetProfile.presenter.ts @@ -36,6 +36,7 @@ export const GetProfilePresenter: IGetProfilePresenter = { default_legal_terms: profile.defaultLegalTerms.toString(), default_quote_validity: profile.defaultQuoteValidity.toString(), default_tax: profile.defaultTax.convertScale(2).toObject(), + default_tax_label: profile.defaultTaxLabel.toString(), default_show_line_discount_column: profile.defaultShowLineDiscountColumn, logo: await profile.logo.toBase64(), diff --git a/server/src/contexts/profile/infrastructure/express/controllers/updateProfile/presenter/UpdateUser.presenter.ts b/server/src/contexts/profile/infrastructure/express/controllers/updateProfile/presenter/UpdateUser.presenter.ts index f1dc577..56bbc6a 100644 --- a/server/src/contexts/profile/infrastructure/express/controllers/updateProfile/presenter/UpdateUser.presenter.ts +++ b/server/src/contexts/profile/infrastructure/express/controllers/updateProfile/presenter/UpdateUser.presenter.ts @@ -16,6 +16,7 @@ export const UpdateProfilePresenter: IUpdateProfilePresenter = { default_legal_terms: profile.defaultLegalTerms.toString(), default_quote_validity: profile.defaultQuoteValidity.toString(), default_tax: profile.defaultTax.convertScale(2).toObject(), + default_tax_label: profile.defaultTaxLabel.toString(), default_show_line_discount_column: profile.defaultShowLineDiscountColumn, }; }, diff --git a/server/src/contexts/profile/infrastructure/mappers/profile.mapper.test.ts b/server/src/contexts/profile/infrastructure/mappers/profile.mapper.test.ts index ff5e293..9617b29 100644 --- a/server/src/contexts/profile/infrastructure/mappers/profile.mapper.test.ts +++ b/server/src/contexts/profile/infrastructure/mappers/profile.mapper.test.ts @@ -1,7 +1,7 @@ import { IProfileContext } from "../Profile.context"; import { createProfileMapper } from "./profile.mapper"; -const source = (defaultShowLineDiscountColumn: boolean | null) => +const source = (defaultShowLineDiscountColumn: boolean | null, defaultTaxLabel?: string | null) => ({ default_show_line_discount_column: defaultShowLineDiscountColumn, dataValues: { @@ -17,6 +17,7 @@ const source = (defaultShowLineDiscountColumn: boolean | null) => default_legal_terms: "", default_quote_validity: "", default_tax: 2100, + default_tax_label: defaultTaxLabel, }, }) as any; @@ -33,4 +34,15 @@ describe("ProfileMapper default_show_line_discount_column", () => { it("uses true for historical null values", () => { expect(mapper.mapToDomain(source(null)).defaultShowLineDiscountColumn).toBe(true); }); + + it("maps a tax label in both persistence directions", () => { + const profile = mapper.mapToDomain(source(true, "% IGIC")); + + expect(profile.defaultTaxLabel.toString()).toBe("% IGIC"); + expect(mapper.mapToPersistence(profile).default_tax_label).toBe("% IGIC"); + }); + + it("uses the default tax label for historical null values", () => { + expect(mapper.mapToDomain(source(true, null)).defaultTaxLabel.toString()).toBe("% IVA"); + }); }); diff --git a/server/src/contexts/profile/infrastructure/mappers/profile.mapper.ts b/server/src/contexts/profile/infrastructure/mappers/profile.mapper.ts index 8cdd2fe..461b83f 100644 --- a/server/src/contexts/profile/infrastructure/mappers/profile.mapper.ts +++ b/server/src/contexts/profile/infrastructure/mappers/profile.mapper.ts @@ -4,7 +4,11 @@ import { SequelizeMapper, } from "@/contexts/common/infrastructure"; import { DealerStatus } from "@/contexts/sales/domain"; -import { Dealer_Model, DealerCreationAttributes } from "@/contexts/sales/infrastructure/sequelize"; +import { + DEFAULT_TAX_LABEL, + Dealer_Model, + DealerCreationAttributes, +} from "@/contexts/sales/infrastructure/sequelize"; import { CurrencyData, Language, @@ -52,6 +56,9 @@ class ProfileMapper "default_quote_validity", TextValueObject.create ); + const defaultTaxLabel = this.mapsValue(source, "default_tax_label", (label) => + TextValueObject.create(label ?? DEFAULT_TAX_LABEL) + ); const defaultTax = this.mapsValue(source, "default_tax", (tax) => Percentage.create({ @@ -72,6 +79,7 @@ class ProfileMapper defaultLegalTerms, defaultQuoteValidity, defaultTax, + defaultTaxLabel, defaultShowLineDiscountColumn: source.default_show_line_discount_column ?? true, logo, @@ -97,6 +105,7 @@ class ProfileMapper default_legal_terms: source.defaultLegalTerms.toPrimitive(), default_quote_validity: source.defaultQuoteValidity.toPrimitive(), default_tax: source.defaultTax.convertScale(2).toPrimitive(), + default_tax_label: source.defaultTaxLabel.toPrimitive(), default_show_line_discount_column: source.defaultShowLineDiscountColumn, logo: source.logo.toPrimitive(), }; diff --git a/server/src/contexts/sales/infrastructure/mappers/dealer.mapper.ts b/server/src/contexts/sales/infrastructure/mappers/dealer.mapper.ts index 875ea2c..cb18415 100644 --- a/server/src/contexts/sales/infrastructure/mappers/dealer.mapper.ts +++ b/server/src/contexts/sales/infrastructure/mappers/dealer.mapper.ts @@ -6,7 +6,7 @@ import { import { CurrencyData, KeyValueMap, Language, Name, UniqueID } from "@shared/contexts"; import { Dealer, DealerLogotype, DealerStatus, IDealerProps } from "../../domain/entities"; import { ISalesContext } from "../Sales.context"; -import { DealerCreationAttributes, Dealer_Model } from "../sequelize"; +import { DEFAULT_TAX_LABEL, DealerCreationAttributes, Dealer_Model } from "../sequelize"; export interface IDealerMapper extends ISequelizeMapper {} @@ -35,6 +35,7 @@ class DealerMapper ["default_quote_validity", source.default_quote_validity], ["default_show_line_discount_column", source.default_show_line_discount_column ?? true], ["default_tax", source.default_tax], + ["default_tax_label", source.default_tax_label ?? DEFAULT_TAX_LABEL], ]); const props: IDealerProps = { @@ -76,6 +77,8 @@ class DealerMapper default_show_line_discount_column: source.additionalInfo.get("default_show_line_discount_column")?.toString() !== "false", default_tax: Number(source.additionalInfo.get("default_tax") ?? 0), + default_tax_label: + source.additionalInfo.get("default_tax_label")?.toString() ?? DEFAULT_TAX_LABEL, logo: source.logo.toPrimitive(), }; } diff --git a/server/src/contexts/sales/infrastructure/sequelize/dealer.model.ts b/server/src/contexts/sales/infrastructure/sequelize/dealer.model.ts index ea05583..af60e15 100644 --- a/server/src/contexts/sales/infrastructure/sequelize/dealer.model.ts +++ b/server/src/contexts/sales/infrastructure/sequelize/dealer.model.ts @@ -19,6 +19,8 @@ export type DealerCreationAttributes = InferCreationAttributes< //quotes?: QuoteCreationAttributes[]; }; +export const DEFAULT_TAX_LABEL = "% IVA"; + export class Dealer_Model extends Model< InferAttributes, InferCreationAttributes @@ -55,6 +57,7 @@ export class Dealer_Model extends Model< declare default_quote_validity: CreationOptional; declare default_show_line_discount_column: CreationOptional; declare default_tax: CreationOptional; + declare default_tax_label: CreationOptional; declare status: CreationOptional; declare lang_code: CreationOptional; declare currency_code: CreationOptional; @@ -99,6 +102,12 @@ export default (sequelize: Sequelize) => { defaultValue: 2100, }, + default_tax_label: { + type: DataTypes.STRING(32), + allowNull: false, + defaultValue: DEFAULT_TAX_LABEL, + }, + logo: { type: DataTypes.STRING, allowNull: true, diff --git a/server/src/infrastructure/http/server.ts b/server/src/infrastructure/http/server.ts index 0b56a9b..e83668c 100644 --- a/server/src/infrastructure/http/server.ts +++ b/server/src/infrastructure/http/server.ts @@ -5,6 +5,10 @@ import { assign } from "lodash"; import { DateTime, Settings } from "luxon"; import { createSequelizeAdapter } from "@/contexts/common/infrastructure/sequelize"; +import { + DEFAULT_TAX_LABEL, + Dealer_Model, +} from "@/contexts/sales/infrastructure/sequelize/dealer.model"; import { trace } from "console"; import { config } from "../../config"; import { app } from "../express/app"; @@ -106,7 +110,12 @@ const server: http.Server = http try { //firebirdConn.sync().then(() => { - sequelizeConn.sync({ force: false, alter: true }).then(() => { + sequelizeConn.sync({ force: false, alter: true }).then(async () => { + await Dealer_Model.update( + { default_tax_label: DEFAULT_TAX_LABEL }, + { where: { default_tax_label: null } } + ); + initStructure(sequelizeConn.connection); insertUsers(); diff --git a/shared/lib/contexts/profile/application/dto/GetProfile.dto/IGetProfile_Response.dto.ts b/shared/lib/contexts/profile/application/dto/GetProfile.dto/IGetProfile_Response.dto.ts index e16ab07..751cb22 100644 --- a/shared/lib/contexts/profile/application/dto/GetProfile.dto/IGetProfile_Response.dto.ts +++ b/shared/lib/contexts/profile/application/dto/GetProfile.dto/IGetProfile_Response.dto.ts @@ -15,6 +15,7 @@ export interface IGetProfileResponse_DTO { default_legal_terms: string; default_quote_validity: string; default_tax: IPercentage_DTO; + default_tax_label: string; default_show_line_discount_column: boolean; status: string; lang_code: string; diff --git a/shared/lib/contexts/profile/application/dto/UpdateProfile.dto/IUpdateProfile_Request.dto.test.ts b/shared/lib/contexts/profile/application/dto/UpdateProfile.dto/IUpdateProfile_Request.dto.test.ts new file mode 100644 index 0000000..d352787 --- /dev/null +++ b/shared/lib/contexts/profile/application/dto/UpdateProfile.dto/IUpdateProfile_Request.dto.test.ts @@ -0,0 +1,28 @@ +import { ensureUpdateProfile_Request_DTOIsValid } from "./IUpdateProfile_Request.dto"; + +const validProfile = { + contact_information: "", + default_payment_method: "", + default_notes: "", + default_legal_terms: "", + default_quote_validity: "", + default_tax: { amount: 2100, scale: 2 }, + logo: "", +}; + +describe("ensureUpdateProfile_Request_DTOIsValid default_tax_label", () => { + it.each([undefined, "% IVA", "% IGIC", " % VAT "])( + "accepts %p", + (default_tax_label) => { + expect( + ensureUpdateProfile_Request_DTOIsValid({ ...validProfile, default_tax_label }) + ).toHaveProperty("isSuccess", true); + } + ); + + it.each(["", " ", "a".repeat(33), 21])("rejects %p", (default_tax_label) => { + expect( + ensureUpdateProfile_Request_DTOIsValid({ ...validProfile, default_tax_label } as any) + ).toHaveProperty("isFailure", true); + }); +}); diff --git a/shared/lib/contexts/profile/application/dto/UpdateProfile.dto/IUpdateProfile_Request.dto.ts b/shared/lib/contexts/profile/application/dto/UpdateProfile.dto/IUpdateProfile_Request.dto.ts index 9252f5f..4bd05ba 100644 --- a/shared/lib/contexts/profile/application/dto/UpdateProfile.dto/IUpdateProfile_Request.dto.ts +++ b/shared/lib/contexts/profile/application/dto/UpdateProfile.dto/IUpdateProfile_Request.dto.ts @@ -8,6 +8,7 @@ export interface IUpdateProfile_Request_DTO { default_legal_terms: string; default_quote_validity: string; default_tax: IPercentage_DTO; + default_tax_label?: string; default_show_line_discount_column?: boolean; logo: string; } @@ -23,6 +24,7 @@ export function ensureUpdateProfile_Request_DTOIsValid(userDTO: IUpdateProfile_R amount: Joi.number().allow(null), scale: Joi.number(), }).optional(), + default_tax_label: Joi.string().trim().min(1).max(32).optional(), default_show_line_discount_column: Joi.boolean(), logo: Joi.string().optional().allow(null).allow("").default(""), }).unknown(true); diff --git a/shared/lib/contexts/profile/application/dto/UpdateProfile.dto/IUpdateProfile_Response.dto.ts b/shared/lib/contexts/profile/application/dto/UpdateProfile.dto/IUpdateProfile_Response.dto.ts index 6b81418..2224632 100644 --- a/shared/lib/contexts/profile/application/dto/UpdateProfile.dto/IUpdateProfile_Response.dto.ts +++ b/shared/lib/contexts/profile/application/dto/UpdateProfile.dto/IUpdateProfile_Response.dto.ts @@ -8,5 +8,6 @@ export interface IUpdateProfileResponse_DTO { default_legal_terms: string; default_quote_validity: string; default_tax: IPercentage_DTO; + default_tax_label: string; default_show_line_discount_column: boolean; }