@wpic/ui 0.6.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/dist/wpic-ui.cjs +1 -1
- package/dist/wpic-ui.css +2 -1
- package/dist/wpic-ui.js +2 -2
- package/package.json +1 -1
- package/src/style.css +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.6.1 — 2026-09-09
|
|
4
|
+
|
|
5
|
+
- Fix loading button spinners inheriting the wrong foreground in dark themes.
|
|
6
|
+
- Restore themed segmented-control backgrounds in dark mode, including Appearance controls in popovers.
|
|
7
|
+
|
|
3
8
|
## 0.6.0 — 2026-09-08
|
|
4
9
|
|
|
5
10
|
- Add WTrendBadge and optional below-value trends in WStatCard, with green/rose tinted pills, directional markers and keyboard-accessible comparison tooltips.
|
package/dist/wpic-ui.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),C=require("lucide-vue-next"),l1=require("@floating-ui/vue"),r0=require("pinia");var $1=typeof document<"u"?document.currentScript:null;const i0={key:0,class:"absolute inset-0 flex items-center justify-center rounded-[inherit]","aria-hidden":"true"},W1=e.defineComponent({__name:"WButton",props:{variant:{},size:{},loading:{type:Boolean},disabled:{type:Boolean},active:{type:Boolean},icon:{type:[Object,Function]},href:{}},emits:["click"],setup(n,{emit:d}){const t=n,o=d;return(s,l)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n.href?"a":"button"),{href:n.href,disabled:n.disabled||n.loading,"data-variant":t.variant??"primary","data-size":t.size??"md","data-active":n.active?"true":void 0,onClick:l[0]||(l[0]=a=>!n.href&&o("click",a)),class:e.normalizeClass(["wpic-button","relative inline-flex items-center justify-center font-medium transition-all duration-150 cursor-pointer select-none","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500/50 focus-visible:ring-offset-1","active:scale-[0.98]",n.disabled||n.loading?"opacity-40 cursor-not-allowed pointer-events-none":"",n.active?"wpic-button--active":"",(t.size??"md")==="sm"?"h-8 touch-manipulation px-2.5 gap-1.5 rounded-md text-sm":"",(t.size??"md")==="md"?(t.variant==="subtle"?"h-11":"h-9")+" px-3.5 gap-2 rounded-lg":"",(t.size??"md")==="lg"?(t.variant==="subtle"?"h-12":"h-11")+" px-4 gap-2 rounded-lg":"",(t.size??"md")==="xs"?"h-5 w-5 p-0 rounded-full text-xs":"",(t.variant??"primary")==="primary"?"wpic-btn-primary text-white":"",(t.variant??"primary")==="secondary"?"bg-zinc-100 hover:bg-zinc-200 text-zinc-700 dark:bg-zinc-800 dark:hover:bg-zinc-700 dark:text-zinc-200":"",(t.variant??"primary")==="subtle"?"bg-zinc-100 border border-zinc-100 hover:bg-zinc-200/70 text-zinc-700 dark:bg-zinc-800 dark:border-zinc-800 dark:hover:bg-zinc-700 dark:text-zinc-200":"",(t.variant??"primary")==="destructive"?"bg-red-500 hover:bg-red-600 text-white":"",(t.variant??"primary")==="ghost"?"bg-transparent hover:bg-zinc-100 text-zinc-600 hover:text-zinc-900 dark:hover:bg-zinc-800 dark:text-zinc-400 dark:hover:text-zinc-100":"",(t.variant??"primary")==="outline"?"bg-transparent border border-zinc-200 hover:bg-zinc-50 text-zinc-700 dark:border-zinc-800 dark:hover:bg-zinc-800 dark:text-zinc-300":""])},{default:e.withCtx(()=>[e.createElementVNode("span",{class:e.normalizeClass(["inline-flex items-center justify-center gap-[inherit]",n.loading?"invisible":""])},[n.icon?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n.icon),{key:0,size:(t.size??"md")==="xs"?10:(t.size??"md")==="sm"?12:((t.size??"md")==="lg",15)},null,8,["size"])):e.createCommentVNode("",!0),e.renderSlot(s.$slots,"default")],2),n.loading?(e.openBlock(),e.createElementBlock("span",i0,[e.createVNode(e.unref(C.Loader2),{size:(t.size??"md")==="xs"?10:(t.size??"md")==="sm"?13:(t.size??"md")==="lg"?17:15,class:e.normalizeClass(["animate-spin",["primary","destructive"].includes(t.variant??"primary")?"text-white":""])},null,8,["size","class"])])):e.createCommentVNode("",!0)]),_:3},8,["href","disabled","data-variant","data-size","data-active","class"]))}}),s0={class:"wpic-button-group inline-flex"},d0=e.defineComponent({__name:"WButtonGroup",setup(n){return(d,t)=>(e.openBlock(),e.createElementBlock("div",s0,[e.renderSlot(d.$slots,"default")]))}}),u0={class:"wpic-filter flex items-center gap-1"},m0=["onClick"],h0=e.defineComponent({__name:"WFilter",props:{options:{},modelValue:{}},emits:["update:modelValue"],setup(n){return(d,t)=>(e.openBlock(),e.createElementBlock("div",u0,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.options,(o,s)=>(e.openBlock(),e.createElementBlock("button",{key:s,type:"button",onClick:l=>d.$emit("update:modelValue",o.value),class:e.normalizeClass(["px-2.5 py-1 text-base font-medium rounded-full transition-all duration-150 cursor-pointer whitespace-nowrap",n.modelValue===o.value?"bg-zinc-100 dark:bg-zinc-800 text-zinc-900 dark:text-zinc-100 border border-zinc-300 dark:border-zinc-600":"text-zinc-400 dark:text-zinc-500 hover:text-zinc-600 dark:hover:text-zinc-300 border border-transparent"])},e.toDisplayString(o.label),11,m0))),128))]))}}),p0={class:"wpic-form-label block mb-1 font-medium text-zinc-600 dark:text-zinc-400"},v0={key:0,class:"ml-0.5",style:{color:"#EF4444"}},b2=e.defineComponent({__name:"WFormLabel",props:{required:{type:Boolean}},setup(n){return(d,t)=>(e.openBlock(),e.createElementBlock("label",p0,[e.renderSlot(d.$slots,"default"),n.required?(e.openBlock(),e.createElementBlock("span",v0,"*")):e.createCommentVNode("",!0)]))}}),f0={class:"relative flex items-center w-full"},C0={key:1,class:"pointer-events-none absolute left-2.5 text-zinc-400 dark:text-zinc-500"},g0=["data-size","data-variant","type","placeholder","disabled","required"],z0={key:2,class:"pointer-events-none absolute right-2.5 text-zinc-400 dark:text-zinc-500"},o2=e.defineComponent({inheritAttrs:!1,__name:"WInput",props:e.mergeModels({icon:{type:[Object,Function]},label:{},placeholder:{},required:{type:Boolean},type:{},disabled:{type:Boolean},size:{},clearable:{type:Boolean},loading:{type:Boolean},variant:{},prepend:{},append:{}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const d=e.useModel(n,"modelValue"),t=n,o=e.useSlots(),s=e.computed(()=>t.prepend!==void 0||!!o.prepend),l=e.computed(()=>t.append!==void 0||!!o.append),a=e.computed(()=>{if(t.icon)return t.icon;if(t.type==="date")return C.Calendar;if(t.type==="money")return C.DollarSign}),m=e.computed(()=>({sm:12,md:13,lg:14,xl:16})[t.size??"md"]),p=e.computed(()=>t.type==="money"?"number":t.type??"text"),f=e.ref();function c(){t.type==="date"&&f.value?.showPicker()}if(typeof document<"u"){const F="winput-date-no-picker";if(!document.getElementById(F)){const B=document.createElement("style");B.id=F,B.textContent='input[type="date"]::-webkit-calendar-picker-indicator { display: none; }',document.head.appendChild(B)}const y="winput-number-no-spinner";if(!document.getElementById(y)){const B=document.createElement("style");B.id=y,B.textContent="input.winput-number::-webkit-outer-spin-button, input.winput-number::-webkit-inner-spin-button { display: none; } input.winput-number { -moz-appearance: textfield; }",document.head.appendChild(B)}}return(F,y)=>(e.openBlock(),e.createElementBlock("div",e.mergeProps(F.$attrs,{class:"w-full"}),[t.label?(e.openBlock(),e.createBlock(b2,{key:0,required:t.required},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.label),1)]),_:1},8,["required"])):e.createCommentVNode("",!0),e.createElementVNode("div",f0,[a.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(a.value),{key:0,size:m.value,class:e.normalizeClass(["absolute shrink-0 text-zinc-400 dark:text-zinc-500",[t.size==="xl"?"left-4":"left-2.5",t.type==="date"?"cursor-pointer":"pointer-events-none"]]),onClick:c},null,8,["size","class"])):s.value?(e.openBlock(),e.createElementBlock("span",C0,[e.renderSlot(F.$slots,"prepend",{},()=>[e.createTextVNode(e.toDisplayString(t.prepend),1)])])):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("input",{ref_key:"inputRef",ref:f,class:e.normalizeClass(["wpic-control",["w-full rounded-lg outline-none transition-colors",t.size==="sm"?"text-sm":"text-base",p.value==="number"?"winput-number":"",t.size==="sm"?"h-8":t.size==="lg"?"h-11":t.size==="xl"?"h-14":"h-9",a.value||s.value?t.size==="xl"?"pl-11":"pl-9":t.size==="xl"?"pl-4":"pl-2.5",l.value&&(t.clearable&&d.value||t.loading)?"pr-14":l.value?"pr-9":t.clearable&&d.value||t.loading?t.size==="xl"?"pr-10":"pr-7":t.size==="xl"?"pr-4":"pr-2.5",t.disabled?(t.variant??"default")==="subtle"?"bg-zinc-100 dark:bg-zinc-800 border border-zinc-100 dark:border-zinc-800 text-zinc-400 dark:text-zinc-500 cursor-not-allowed opacity-60":"bg-zinc-50 dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-800 text-zinc-400 dark:text-zinc-500 cursor-not-allowed opacity-60":(t.variant??"default")==="subtle"?"bg-zinc-100 dark:bg-zinc-800 border border-zinc-100 dark:border-zinc-800 text-zinc-900 dark:text-zinc-100 placeholder:text-zinc-400 dark:placeholder:text-zinc-500 cursor-text hover:bg-zinc-200/70 dark:hover:bg-zinc-700":"bg-white dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-800 text-zinc-900 dark:text-zinc-100 placeholder:text-zinc-400 dark:placeholder:text-zinc-500 wpic-input-field cursor-text"]]),"data-size":t.size??"md","data-variant":t.variant??"default","onUpdate:modelValue":y[0]||(y[0]=B=>d.value=B),type:p.value,placeholder:t.placeholder??"",disabled:t.disabled,required:t.required},null,10,g0),[[e.vModelDynamic,d.value]]),l.value?(e.openBlock(),e.createElementBlock("span",z0,[e.renderSlot(F.$slots,"append",{},()=>[e.createTextVNode(e.toDisplayString(t.append),1)])])):e.createCommentVNode("",!0),t.loading?(e.openBlock(),e.createBlock(e.unref(C.Loader2),{key:3,size:t.size==="xl"?14:11,class:e.normalizeClass(["absolute animate-spin text-zinc-400 dark:text-zinc-500",l.value?"right-8":t.size==="xl"?"right-4":"right-2"])},null,8,["size","class"])):t.clearable&&d.value?(e.openBlock(),e.createElementBlock("button",{key:4,type:"button",onClick:y[1]||(y[1]=B=>d.value=""),class:e.normalizeClass(["absolute flex items-center justify-center text-zinc-400 hover:text-zinc-600 dark:hover:text-zinc-300 transition-colors cursor-pointer",l.value?"right-8":t.size==="xl"?"right-4":"right-2"])},[e.createVNode(e.unref(C.X),{size:t.size==="xl"?14:11},null,8,["size"])],2)):e.createCommentVNode("",!0)])],16))}}),k0=["disabled"],c2=e.defineComponent({__name:"WCheckbox",props:e.mergeModels({disabled:{type:Boolean}},{modelValue:{type:Boolean},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const d=e.useModel(n,"modelValue");return(t,o)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(["wpic-checkbox relative inline-flex items-center gap-2 select-none",n.disabled?"cursor-not-allowed opacity-50":"cursor-pointer"])},[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":o[0]||(o[0]=s=>d.value=s),disabled:n.disabled,class:"peer sr-only"},null,8,k0),[[e.vModelCheckbox,d.value]]),e.createElementVNode("span",{class:e.normalizeClass(["wpic-checkbox-box",["flex h-4 w-4 shrink-0 items-center justify-center rounded-[4px] border transition-all duration-150","peer-focus-visible:ring-2 peer-focus-visible:ring-zinc-400/40 peer-focus-visible:ring-offset-1 peer-focus-visible:ring-offset-white dark:peer-focus-visible:ring-offset-zinc-950",d.value?"border-zinc-900 bg-zinc-900 text-white dark:border-zinc-100 dark:bg-zinc-100 dark:text-zinc-950":"border-zinc-300 bg-white text-transparent shadow-sm hover:border-zinc-400 dark:border-zinc-700 dark:bg-zinc-900 dark:hover:border-zinc-500"]])},[e.createVNode(e.unref(C.Check),{size:11,"stroke-width":"2.6"})],2),e.renderSlot(t.$slots,"default")],2))}}),Y1=e.defineComponent({__name:"WSpinner",props:{size:{default:"md"},tone:{default:"muted"}},setup(n){const d=n,t={sm:"h-4 w-4 border-2",md:"h-5 w-5 border-2",lg:"h-7 w-7 border-[3px]"};return(o,s)=>(e.openBlock(),e.createElementBlock("span",{role:"status","aria-live":"polite","aria-label":"Loading",class:e.normalizeClass(["wpic-spinner","inline-block shrink-0 animate-spin rounded-full border-current border-t-transparent",t[d.size],d.tone==="muted"?"text-zinc-300 dark:text-zinc-700":"text-[var(--wpic-primary,#6366f1)]"])},null,2))}}),b0={class:"wpic-table"},y0={key:0,class:"text-zinc-400 dark:text-zinc-500 whitespace-nowrap shrink-0"},x0={key:1,class:"flex items-center justify-center py-20 gap-3 text-zinc-400 dark:text-zinc-500"},w0={style:{"overflow-x":"auto"}},M0={class:"w-full border-collapse"},B0={key:0,style:{width:"36px"}},V0={key:1,style:{width:"32px"}},E0={key:0},N0={class:"border-b border-zinc-100 dark:border-zinc-800"},S0=["onClick"],L0={key:1},F0={key:0,class:"border-b border-zinc-200 bg-zinc-50 font-medium dark:border-zinc-700 dark:bg-zinc-800/60"},D0={key:0},$0={key:1},T0=["onClick"],A0=["onClick"],H0={key:0,class:"border-b border-zinc-100 dark:border-zinc-800"},P0=["colspan"],j0={key:2},W0=["colspan"],R0={class:"flex flex-col items-center gap-2"},I0={class:"tabular-nums text-zinc-400 dark:text-zinc-500"},Z0={key:0,class:"flex items-center gap-0.5"},U0=["disabled"],K0={key:0,class:"w-6 text-center text-base select-none text-zinc-400 dark:text-zinc-500"},O0=["onClick"],Y0=["disabled"],q0=e.defineComponent({__name:"WTable",props:{data:{},columns:{},loading:{type:Boolean},emptyText:{},pageSize:{},serverTotal:{},serverPage:{},searchPlaceholder:{default:"Search…"},rowClickable:{type:Boolean,default:!1},showHeader:{type:Boolean,default:!0},expandable:{type:Boolean,default:!1},selectable:{type:Boolean,default:!1},selectedKeys:{},rowKey:{default:"id"},flushEdges:{type:Boolean,default:!1},rowClass:{},rowStyle:{},summaryRow:{},compact:{type:Boolean},showFooter:{type:Boolean,default:!0}},emits:["row-click","update:selectedKeys","row-select","update:serverPage"],setup(n,{expose:d,emit:t}){const o=n,s=t,l=e.ref(new Set);function a(M){l.value.has(M)?l.value.delete(M):l.value.add(M)}const m=e.useSlots(),p=e.computed(()=>o.pageSize??25),f=e.ref(null),c=e.ref("asc");function F(M){f.value===M?c.value=c.value==="asc"?"desc":"asc":(f.value=M,c.value="asc")}const y=e.ref(""),B=e.computed(()=>o.columns.some(M=>M.searchable)),w=e.computed(()=>{let M=o.data??[];const X=y.value.trim().toLowerCase();if(X){const j=o.columns.filter(L=>L.searchable).map(L=>L.field);M=M.filter(L=>j.some(P=>String(L[P]??"").toLowerCase().includes(X)))}if(f.value){const j=f.value;M=[...M].sort((L,P)=>{const O=L[j]??"",i1=P[j]??"",s1=typeof O=="number"&&typeof i1=="number"?O-i1:String(O).toLowerCase().localeCompare(String(i1).toLowerCase());return c.value==="asc"?s1:-s1})}return M}),z=e.ref(1),v=e.computed(()=>o.serverTotal!==void 0),T=e.computed({get:()=>v.value?o.serverPage??1:z.value,set:M=>{v.value?s("update:serverPage",M):z.value=M}}),J=e.computed(()=>v.value?o.serverTotal??0:w.value.length),t1=e.computed(()=>Math.max(1,Math.ceil(J.value/p.value)));e.watch([y,()=>o.data],()=>{v.value||(T.value=1),l.value.clear()});const D=e.computed(()=>{if(v.value)return w.value;const M=(T.value-1)*p.value;return w.value.slice(M,M+p.value)});function S(M,X){const j=M[o.rowKey];return typeof j=="string"||typeof j=="number"?j:`${T.value}:${X}`}const V=e.computed(()=>new Set(o.selectedKeys??[])),x=e.computed(()=>D.value.map(S)),_=e.computed(()=>o.selectable&&x.value.length>0&&x.value.every(M=>V.value.has(M)));function E(M,X,j){const L=S(M,X),P=new Set(o.selectedKeys??[]),O=j===!0;O?P.add(L):P.delete(L),s("update:selectedKeys",[...P]),s("row-select",M,O)}function Z(M){const X=new Set(o.selectedKeys??[]),j=M===!0;for(const L of x.value)j?X.add(L):X.delete(L);s("update:selectedKeys",[...X])}const U=e.computed(()=>J.value===0?0:(T.value-1)*p.value+1),W=e.computed(()=>Math.min(T.value*p.value,J.value)),Y=e.computed(()=>{const M=t1.value;if(M<=7)return Array.from({length:M},(O,i1)=>i1+1);const X=T.value,j=[],L=new Set([1,M,X-1,X,X+1].filter(O=>O>=1&&O<=M));let P=0;for(const O of[...L].sort((i1,s1)=>i1-s1))O-P>1&&j.push("…"),j.push(O),P=O;return j}),K=M=>M==="right"?"text-right":M==="center"?"text-center":"text-left",n1=(M,X)=>[X,o.flushEdges&&M===0&&!o.expandable&&!o.selectable?"pl-0":"pl-3",o.flushEdges&&M===o.columns.length-1?"pr-0":"pr-3"],c1=M=>({...M.width?{width:M.width}:{},...M.minWidth?{minWidth:M.minWidth}:{}});return d({filteredCount:e.computed(()=>w.value.length),searchQuery:y}),(M,X)=>(e.openBlock(),e.createElementBlock("div",b0,[(B.value||e.unref(m).toolbar)&&!n.loading?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["flex items-center gap-2 px-3 border-b border-zinc-100 dark:border-zinc-800",n.compact?"py-1":"py-2"])},[B.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(o2,{modelValue:y.value,"onUpdate:modelValue":X[0]||(X[0]=j=>y.value=j),placeholder:n.searchPlaceholder,icon:e.unref(C.Search),class:"flex-1"},null,8,["modelValue","placeholder","icon"]),y.value?(e.openBlock(),e.createElementBlock("span",y0,e.toDisplayString(w.value.length)+" results ",1)):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0),e.renderSlot(M.$slots,"toolbar")],2)):e.createCommentVNode("",!0),n.loading?(e.openBlock(),e.createElementBlock("div",x0,[e.createVNode(Y1,{tone:"muted"}),X[5]||(X[5]=e.createElementVNode("span",{class:""},"Loading…",-1))])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createElementVNode("div",w0,[e.createElementVNode("table",M0,[e.createElementVNode("colgroup",null,[n.selectable?(e.openBlock(),e.createElementBlock("col",B0)):e.createCommentVNode("",!0),n.expandable?(e.openBlock(),e.createElementBlock("col",V0)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.columns,j=>(e.openBlock(),e.createElementBlock("col",{key:j.field,style:e.normalizeStyle(c1(j))},null,4))),128))]),o.showHeader!==!1?(e.openBlock(),e.createElementBlock("thead",E0,[e.createElementVNode("tr",N0,[n.selectable?(e.openBlock(),e.createElementBlock("th",{key:0,class:e.normalizeClass(["w-9 pr-2",n.compact?"py-1":"py-2",n.flushEdges?"pl-0":"pl-2"])},[e.createVNode(c2,{"model-value":_.value,onClick:X[1]||(X[1]=e.withModifiers(()=>{},["stop"])),"onUpdate:modelValue":Z},null,8,["model-value"])],2)):e.createCommentVNode("",!0),n.expandable?(e.openBlock(),e.createElementBlock("th",{key:1,class:e.normalizeClass(["w-8 pr-2",n.compact?"py-1":"py-2",n.flushEdges&&!n.selectable?"pl-0":"pl-2"])},null,2)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.columns,(j,L)=>(e.openBlock(),e.createElementBlock("th",{key:j.field,class:e.normalizeClass([n1(L,n.compact?"py-1":"py-2"),"whitespace-nowrap text-zinc-500 dark:text-zinc-300 font-medium",K(j.align),L===0&&!n.expandable&&!n.selectable?"sticky left-0 z-10":""]),style:e.normalizeStyle({...c1(j)})},[e.renderSlot(M.$slots,"th-"+j.field,{col:j,sortField:f.value,sortDir:c.value,toggleSort:F},()=>[j.sortable?(e.openBlock(),e.createElementBlock("button",{key:0,onClick:P=>F(j.field),class:e.normalizeClass(["inline-flex items-center gap-1 cursor-pointer transition-colors whitespace-nowrap",j.align==="right"?"ml-auto":""]),style:{color:"inherit"}},[e.createTextVNode(e.toDisplayString(j.label)+" ",1),f.value===j.field&&c.value==="asc"?(e.openBlock(),e.createBlock(e.unref(C.ChevronUp),{key:0,size:11,style:{color:"#5E6AD2"}})):f.value===j.field&&c.value==="desc"?(e.openBlock(),e.createBlock(e.unref(C.ChevronDown),{key:1,size:11,style:{color:"#5E6AD2"}})):(e.openBlock(),e.createBlock(e.unref(C.ChevronsUpDown),{key:2,size:10,style:{opacity:"0.3"}}))],10,S0)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(j.label),1)],64))])],6))),128))])])):e.createCommentVNode("",!0),n.loading?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("tbody",L0,[n.summaryRow?(e.openBlock(),e.createElementBlock("tr",F0,[n.selectable?(e.openBlock(),e.createElementBlock("td",D0)):e.createCommentVNode("",!0),n.expandable?(e.openBlock(),e.createElementBlock("td",$0)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.columns,(j,L)=>(e.openBlock(),e.createElementBlock("td",{key:j.field,class:e.normalizeClass([n1(L,n.compact?"py-1":"py-2.5"),K(j.align),L===0?"sticky left-0 z-10 text-zinc-900 dark:text-zinc-100":"text-zinc-700 dark:text-zinc-200"]),style:e.normalizeStyle(L===0?{background:"inherit"}:{})},[e.renderSlot(M.$slots,"summary-"+j.field,{row:n.summaryRow,value:n.summaryRow[j.field]},()=>[e.createTextVNode(e.toDisplayString(n.summaryRow[j.field]??"—"),1)])],6))),128))])):e.createCommentVNode("",!0),D.value.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(D.value,(j,L)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:L},[e.createElementVNode("tr",{class:e.normalizeClass(["group border-b border-zinc-100 dark:border-zinc-800 hover:bg-zinc-50 dark:hover:bg-zinc-800/50 transition-colors",[n.expandable&&l.value.has(L)?"border-b-0":"",n.rowClass?.(j)]]),style:e.normalizeStyle({cursor:n.rowClickable||n.expandable?"pointer":"default",...n.rowStyle?.(j)??{}}),onClick:P=>n.expandable?a(L):n.rowClickable&&s("row-click",j)},[n.selectable?(e.openBlock(),e.createElementBlock("td",{key:0,class:e.normalizeClass(["w-9 pr-2",n.compact?"py-1":"py-2.5",n.flushEdges?"pl-0":"pl-2"]),onClick:X[2]||(X[2]=e.withModifiers(()=>{},["stop"]))},[e.createVNode(c2,{"model-value":V.value.has(S(j,L)),"onUpdate:modelValue":P=>E(j,L,P)},null,8,["model-value","onUpdate:modelValue"])],2)):e.createCommentVNode("",!0),n.expandable?(e.openBlock(),e.createElementBlock("td",{key:1,class:e.normalizeClass(["w-8 pr-1 text-zinc-400 dark:text-zinc-500",n.compact?"py-1":"py-2.5",n.flushEdges&&!n.selectable?"pl-0":"pl-3"])},[l.value.has(L)?(e.openBlock(),e.createBlock(e.unref(C.ChevronDown),{key:0,size:13,style:{transition:"transform .15s"}})):(e.openBlock(),e.createBlock(e.unref(C.ChevronRight),{key:1,size:13,style:{transition:"transform .15s"}}))],2)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.columns,(P,O)=>(e.openBlock(),e.createElementBlock("td",{key:P.field,class:e.normalizeClass([n1(O,n.compact?"py-1":"py-2.5"),K(P.align),O===0&&!n.expandable&&!n.selectable?"sticky left-0 text-zinc-900 dark:text-zinc-100 font-medium":"text-zinc-700 dark:text-zinc-200"]),style:e.normalizeStyle(O===0&&!n.expandable&&!n.selectable?{background:"inherit",zIndex:1}:{}),onClick:i1=>n.expandable?(n.rowClickable&&s("row-click",j),i1.stopPropagation()):void 0},[e.renderSlot(M.$slots,P.field,{row:j,value:j[P.field]},()=>[e.createTextVNode(e.toDisplayString(j[P.field]??"—"),1)])],14,A0))),128))],14,T0),n.expandable&&l.value.has(L)?(e.openBlock(),e.createElementBlock("tr",H0,[e.createElementVNode("td",{colspan:n.columns.length+(n.expandable?1:0)+(n.selectable?1:0),class:"px-4 pb-3 pt-0"},[e.renderSlot(M.$slots,"expand",{row:j})],8,P0)])):e.createCommentVNode("",!0)],64))),128)):(e.openBlock(),e.createElementBlock("tr",j0,[e.createElementVNode("td",{colspan:n.columns.length+(n.expandable?1:0)+(n.selectable?1:0),class:"py-16 text-center text-zinc-400 dark:text-zinc-500"},[e.createElementVNode("div",R0,[e.renderSlot(M.$slots,"empty-icon"),e.createTextVNode(" "+e.toDisplayString(n.emptyText??"No data"),1)])],8,W0)]))]))])]),n.showFooter&&J.value>0?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["flex items-center justify-between px-4 border-t border-zinc-100 dark:border-zinc-800",n.compact?"py-1":"py-2.5"])},[e.createElementVNode("span",I0,[t1.value>1?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(e.toDisplayString(U.value)+"–"+e.toDisplayString(W.value)+" of "+e.toDisplayString(J.value),1)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(J.value)+" "+e.toDisplayString(J.value===1?"item":"items"),1)],64))]),t1.value>1?(e.openBlock(),e.createElementBlock("div",Z0,[e.createElementVNode("button",{onClick:X[3]||(X[3]=j=>T.value--),disabled:T.value===1,class:"h-7 w-7 flex items-center justify-center rounded-md transition-colors cursor-pointer disabled:opacity-30 hover:bg-zinc-50 dark:hover:bg-zinc-800/50 text-zinc-400"},[e.createVNode(e.unref(C.ChevronLeft),{size:13})],8,U0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Y.value,j=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:j},[j==="…"?(e.openBlock(),e.createElementBlock("span",K0,"…")):(e.openBlock(),e.createElementBlock("button",{key:1,onClick:L=>T.value=j,class:e.normalizeClass(["h-7 min-w-7 px-2 rounded-md text-sm font-medium transition-colors cursor-pointer",T.value===j?"":"text-zinc-700 dark:text-zinc-200 hover:bg-zinc-100 dark:hover:bg-zinc-700"]),style:e.normalizeStyle(T.value===j?"background:rgba(94,106,210,0.1);color:#5E6AD2":void 0)},e.toDisplayString(j),15,O0))],64))),128)),e.createElementVNode("button",{onClick:X[4]||(X[4]=j=>T.value++),disabled:T.value===t1.value,class:"h-7 w-7 flex items-center justify-center rounded-md transition-colors cursor-pointer disabled:opacity-30 hover:bg-zinc-50 dark:hover:bg-zinc-800/50 text-zinc-400"},[e.createVNode(e.unref(C.ChevronRight),{size:13})],8,Y0)])):e.createCommentVNode("",!0)],2)):e.createCommentVNode("",!0)],64))]))}}),Q0={class:"w-spreadsheet-frame__surface"},J0={key:0,class:"w-spreadsheet-frame__heading"},X0={key:1,class:"w-spreadsheet-frame__status"},G0=["title","aria-label"],_0={key:1,class:"flex min-h-64 items-center justify-center gap-3 text-zinc-400 dark:text-zinc-500"},e3={key:0,class:"w-spreadsheet__row-axis-col"},n3={key:0},t3={key:0,class:"w-spreadsheet__corner"},l3={key:0,class:"w-spreadsheet__axis"},c3=["colspan","title","tabindex","onClick","onKeydown","onPointerenter","onPointerdown"],a3={key:0,class:"w-spreadsheet__editor"},o3=["type","value","min","placeholder","onInput"],r3=["onPointerdown"],i3=e.defineComponent({__name:"WSpreadsheet",props:{columns:{},rows:{},showAxes:{type:Boolean,default:!0},showColumnLetters:{type:Boolean,default:!0},showRowNumbers:{type:Boolean,default:!0},minWidth:{default:"960px"},maxHeight:{default:"68vh"},sortable:{type:Boolean},expandable:{type:Boolean},showExpandButton:{type:Boolean},actionsOnHover:{type:Boolean},downloadable:{type:Boolean},showDownloadButton:{type:Boolean},downloadFilename:{},fillHandle:{type:Boolean},expanded:{type:Boolean},downloadRequest:{},loading:{type:Boolean}},emits:["update:expanded","cell-change"],setup(n,{expose:d,emit:t}){const o=n,s=t,l=e.computed(()=>o.showAxes&&o.showColumnLetters),a=e.computed(()=>o.showAxes&&o.showRowNumbers),m=e.computed(()=>o.columns.some(b=>b.sticky)),p=e.ref(null),f=e.ref("asc"),c=e.ref(o.expanded??!1),F=e.ref(null),y=e.ref(null),B=e.ref(null),w=e.ref(null),z=e.ref(null);function v(){if(!o.downloadable)return;const b=N=>`"${String(N??"").replace(/"/g,'""')}"`,A=V.value.map(N=>o.columns.map(H=>b(D(N,H.key))).join(",")).join(`\r
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),C=require("lucide-vue-next"),l1=require("@floating-ui/vue"),r0=require("pinia");var $1=typeof document<"u"?document.currentScript:null;const i0={key:0,class:"absolute inset-0 flex items-center justify-center rounded-[inherit]","aria-hidden":"true"},W1=e.defineComponent({__name:"WButton",props:{variant:{},size:{},loading:{type:Boolean},disabled:{type:Boolean},active:{type:Boolean},icon:{type:[Object,Function]},href:{}},emits:["click"],setup(n,{emit:d}){const t=n,o=d;return(s,l)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n.href?"a":"button"),{href:n.href,disabled:n.disabled||n.loading,"data-variant":t.variant??"primary","data-size":t.size??"md","data-active":n.active?"true":void 0,onClick:l[0]||(l[0]=a=>!n.href&&o("click",a)),class:e.normalizeClass(["wpic-button","relative inline-flex items-center justify-center font-medium transition-all duration-150 cursor-pointer select-none","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500/50 focus-visible:ring-offset-1","active:scale-[0.98]",n.disabled||n.loading?"opacity-40 cursor-not-allowed pointer-events-none":"",n.active?"wpic-button--active":"",(t.size??"md")==="sm"?"h-8 touch-manipulation px-2.5 gap-1.5 rounded-md text-sm":"",(t.size??"md")==="md"?(t.variant==="subtle"?"h-11":"h-9")+" px-3.5 gap-2 rounded-lg":"",(t.size??"md")==="lg"?(t.variant==="subtle"?"h-12":"h-11")+" px-4 gap-2 rounded-lg":"",(t.size??"md")==="xs"?"h-5 w-5 p-0 rounded-full text-xs":"",(t.variant??"primary")==="primary"?"wpic-btn-primary text-white":"",(t.variant??"primary")==="secondary"?"bg-zinc-100 hover:bg-zinc-200 text-zinc-700 dark:bg-zinc-800 dark:hover:bg-zinc-700 dark:text-zinc-200":"",(t.variant??"primary")==="subtle"?"bg-zinc-100 border border-zinc-100 hover:bg-zinc-200/70 text-zinc-700 dark:bg-zinc-800 dark:border-zinc-800 dark:hover:bg-zinc-700 dark:text-zinc-200":"",(t.variant??"primary")==="destructive"?"bg-red-500 hover:bg-red-600 text-white":"",(t.variant??"primary")==="ghost"?"bg-transparent hover:bg-zinc-100 text-zinc-600 hover:text-zinc-900 dark:hover:bg-zinc-800 dark:text-zinc-400 dark:hover:text-zinc-100":"",(t.variant??"primary")==="outline"?"bg-transparent border border-zinc-200 hover:bg-zinc-50 text-zinc-700 dark:border-zinc-800 dark:hover:bg-zinc-800 dark:text-zinc-300":""])},{default:e.withCtx(()=>[e.createElementVNode("span",{class:e.normalizeClass(["inline-flex items-center justify-center gap-[inherit]",n.loading?"invisible":""])},[n.icon?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n.icon),{key:0,size:(t.size??"md")==="xs"?10:(t.size??"md")==="sm"?12:((t.size??"md")==="lg",15)},null,8,["size"])):e.createCommentVNode("",!0),e.renderSlot(s.$slots,"default")],2),n.loading?(e.openBlock(),e.createElementBlock("span",i0,[e.createVNode(e.unref(C.Loader2),{size:(t.size??"md")==="xs"?10:(t.size??"md")==="sm"?13:(t.size??"md")==="lg"?17:15,class:"animate-spin"},null,8,["size"])])):e.createCommentVNode("",!0)]),_:3},8,["href","disabled","data-variant","data-size","data-active","class"]))}}),s0={class:"wpic-button-group inline-flex"},d0=e.defineComponent({__name:"WButtonGroup",setup(n){return(d,t)=>(e.openBlock(),e.createElementBlock("div",s0,[e.renderSlot(d.$slots,"default")]))}}),u0={class:"wpic-filter flex items-center gap-1"},m0=["onClick"],h0=e.defineComponent({__name:"WFilter",props:{options:{},modelValue:{}},emits:["update:modelValue"],setup(n){return(d,t)=>(e.openBlock(),e.createElementBlock("div",u0,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.options,(o,s)=>(e.openBlock(),e.createElementBlock("button",{key:s,type:"button",onClick:l=>d.$emit("update:modelValue",o.value),class:e.normalizeClass(["px-2.5 py-1 text-base font-medium rounded-full transition-all duration-150 cursor-pointer whitespace-nowrap",n.modelValue===o.value?"bg-zinc-100 dark:bg-zinc-800 text-zinc-900 dark:text-zinc-100 border border-zinc-300 dark:border-zinc-600":"text-zinc-400 dark:text-zinc-500 hover:text-zinc-600 dark:hover:text-zinc-300 border border-transparent"])},e.toDisplayString(o.label),11,m0))),128))]))}}),p0={class:"wpic-form-label block mb-1 font-medium text-zinc-600 dark:text-zinc-400"},v0={key:0,class:"ml-0.5",style:{color:"#EF4444"}},b2=e.defineComponent({__name:"WFormLabel",props:{required:{type:Boolean}},setup(n){return(d,t)=>(e.openBlock(),e.createElementBlock("label",p0,[e.renderSlot(d.$slots,"default"),n.required?(e.openBlock(),e.createElementBlock("span",v0,"*")):e.createCommentVNode("",!0)]))}}),f0={class:"relative flex items-center w-full"},C0={key:1,class:"pointer-events-none absolute left-2.5 text-zinc-400 dark:text-zinc-500"},g0=["data-size","data-variant","type","placeholder","disabled","required"],z0={key:2,class:"pointer-events-none absolute right-2.5 text-zinc-400 dark:text-zinc-500"},o2=e.defineComponent({inheritAttrs:!1,__name:"WInput",props:e.mergeModels({icon:{type:[Object,Function]},label:{},placeholder:{},required:{type:Boolean},type:{},disabled:{type:Boolean},size:{},clearable:{type:Boolean},loading:{type:Boolean},variant:{},prepend:{},append:{}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const d=e.useModel(n,"modelValue"),t=n,o=e.useSlots(),s=e.computed(()=>t.prepend!==void 0||!!o.prepend),l=e.computed(()=>t.append!==void 0||!!o.append),a=e.computed(()=>{if(t.icon)return t.icon;if(t.type==="date")return C.Calendar;if(t.type==="money")return C.DollarSign}),m=e.computed(()=>({sm:12,md:13,lg:14,xl:16})[t.size??"md"]),p=e.computed(()=>t.type==="money"?"number":t.type??"text"),f=e.ref();function c(){t.type==="date"&&f.value?.showPicker()}if(typeof document<"u"){const F="winput-date-no-picker";if(!document.getElementById(F)){const B=document.createElement("style");B.id=F,B.textContent='input[type="date"]::-webkit-calendar-picker-indicator { display: none; }',document.head.appendChild(B)}const y="winput-number-no-spinner";if(!document.getElementById(y)){const B=document.createElement("style");B.id=y,B.textContent="input.winput-number::-webkit-outer-spin-button, input.winput-number::-webkit-inner-spin-button { display: none; } input.winput-number { -moz-appearance: textfield; }",document.head.appendChild(B)}}return(F,y)=>(e.openBlock(),e.createElementBlock("div",e.mergeProps(F.$attrs,{class:"w-full"}),[t.label?(e.openBlock(),e.createBlock(b2,{key:0,required:t.required},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.label),1)]),_:1},8,["required"])):e.createCommentVNode("",!0),e.createElementVNode("div",f0,[a.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(a.value),{key:0,size:m.value,class:e.normalizeClass(["absolute shrink-0 text-zinc-400 dark:text-zinc-500",[t.size==="xl"?"left-4":"left-2.5",t.type==="date"?"cursor-pointer":"pointer-events-none"]]),onClick:c},null,8,["size","class"])):s.value?(e.openBlock(),e.createElementBlock("span",C0,[e.renderSlot(F.$slots,"prepend",{},()=>[e.createTextVNode(e.toDisplayString(t.prepend),1)])])):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("input",{ref_key:"inputRef",ref:f,class:e.normalizeClass(["wpic-control",["w-full rounded-lg outline-none transition-colors",t.size==="sm"?"text-sm":"text-base",p.value==="number"?"winput-number":"",t.size==="sm"?"h-8":t.size==="lg"?"h-11":t.size==="xl"?"h-14":"h-9",a.value||s.value?t.size==="xl"?"pl-11":"pl-9":t.size==="xl"?"pl-4":"pl-2.5",l.value&&(t.clearable&&d.value||t.loading)?"pr-14":l.value?"pr-9":t.clearable&&d.value||t.loading?t.size==="xl"?"pr-10":"pr-7":t.size==="xl"?"pr-4":"pr-2.5",t.disabled?(t.variant??"default")==="subtle"?"bg-zinc-100 dark:bg-zinc-800 border border-zinc-100 dark:border-zinc-800 text-zinc-400 dark:text-zinc-500 cursor-not-allowed opacity-60":"bg-zinc-50 dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-800 text-zinc-400 dark:text-zinc-500 cursor-not-allowed opacity-60":(t.variant??"default")==="subtle"?"bg-zinc-100 dark:bg-zinc-800 border border-zinc-100 dark:border-zinc-800 text-zinc-900 dark:text-zinc-100 placeholder:text-zinc-400 dark:placeholder:text-zinc-500 cursor-text hover:bg-zinc-200/70 dark:hover:bg-zinc-700":"bg-white dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-800 text-zinc-900 dark:text-zinc-100 placeholder:text-zinc-400 dark:placeholder:text-zinc-500 wpic-input-field cursor-text"]]),"data-size":t.size??"md","data-variant":t.variant??"default","onUpdate:modelValue":y[0]||(y[0]=B=>d.value=B),type:p.value,placeholder:t.placeholder??"",disabled:t.disabled,required:t.required},null,10,g0),[[e.vModelDynamic,d.value]]),l.value?(e.openBlock(),e.createElementBlock("span",z0,[e.renderSlot(F.$slots,"append",{},()=>[e.createTextVNode(e.toDisplayString(t.append),1)])])):e.createCommentVNode("",!0),t.loading?(e.openBlock(),e.createBlock(e.unref(C.Loader2),{key:3,size:t.size==="xl"?14:11,class:e.normalizeClass(["absolute animate-spin text-zinc-400 dark:text-zinc-500",l.value?"right-8":t.size==="xl"?"right-4":"right-2"])},null,8,["size","class"])):t.clearable&&d.value?(e.openBlock(),e.createElementBlock("button",{key:4,type:"button",onClick:y[1]||(y[1]=B=>d.value=""),class:e.normalizeClass(["absolute flex items-center justify-center text-zinc-400 hover:text-zinc-600 dark:hover:text-zinc-300 transition-colors cursor-pointer",l.value?"right-8":t.size==="xl"?"right-4":"right-2"])},[e.createVNode(e.unref(C.X),{size:t.size==="xl"?14:11},null,8,["size"])],2)):e.createCommentVNode("",!0)])],16))}}),k0=["disabled"],c2=e.defineComponent({__name:"WCheckbox",props:e.mergeModels({disabled:{type:Boolean}},{modelValue:{type:Boolean},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const d=e.useModel(n,"modelValue");return(t,o)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(["wpic-checkbox relative inline-flex items-center gap-2 select-none",n.disabled?"cursor-not-allowed opacity-50":"cursor-pointer"])},[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":o[0]||(o[0]=s=>d.value=s),disabled:n.disabled,class:"peer sr-only"},null,8,k0),[[e.vModelCheckbox,d.value]]),e.createElementVNode("span",{class:e.normalizeClass(["wpic-checkbox-box",["flex h-4 w-4 shrink-0 items-center justify-center rounded-[4px] border transition-all duration-150","peer-focus-visible:ring-2 peer-focus-visible:ring-zinc-400/40 peer-focus-visible:ring-offset-1 peer-focus-visible:ring-offset-white dark:peer-focus-visible:ring-offset-zinc-950",d.value?"border-zinc-900 bg-zinc-900 text-white dark:border-zinc-100 dark:bg-zinc-100 dark:text-zinc-950":"border-zinc-300 bg-white text-transparent shadow-sm hover:border-zinc-400 dark:border-zinc-700 dark:bg-zinc-900 dark:hover:border-zinc-500"]])},[e.createVNode(e.unref(C.Check),{size:11,"stroke-width":"2.6"})],2),e.renderSlot(t.$slots,"default")],2))}}),Y1=e.defineComponent({__name:"WSpinner",props:{size:{default:"md"},tone:{default:"muted"}},setup(n){const d=n,t={sm:"h-4 w-4 border-2",md:"h-5 w-5 border-2",lg:"h-7 w-7 border-[3px]"};return(o,s)=>(e.openBlock(),e.createElementBlock("span",{role:"status","aria-live":"polite","aria-label":"Loading",class:e.normalizeClass(["wpic-spinner","inline-block shrink-0 animate-spin rounded-full border-current border-t-transparent",t[d.size],d.tone==="muted"?"text-zinc-300 dark:text-zinc-700":"text-[var(--wpic-primary,#6366f1)]"])},null,2))}}),b0={class:"wpic-table"},y0={key:0,class:"text-zinc-400 dark:text-zinc-500 whitespace-nowrap shrink-0"},x0={key:1,class:"flex items-center justify-center py-20 gap-3 text-zinc-400 dark:text-zinc-500"},w0={style:{"overflow-x":"auto"}},M0={class:"w-full border-collapse"},B0={key:0,style:{width:"36px"}},V0={key:1,style:{width:"32px"}},E0={key:0},N0={class:"border-b border-zinc-100 dark:border-zinc-800"},S0=["onClick"],L0={key:1},F0={key:0,class:"border-b border-zinc-200 bg-zinc-50 font-medium dark:border-zinc-700 dark:bg-zinc-800/60"},D0={key:0},$0={key:1},T0=["onClick"],A0=["onClick"],H0={key:0,class:"border-b border-zinc-100 dark:border-zinc-800"},P0=["colspan"],j0={key:2},W0=["colspan"],R0={class:"flex flex-col items-center gap-2"},I0={class:"tabular-nums text-zinc-400 dark:text-zinc-500"},Z0={key:0,class:"flex items-center gap-0.5"},U0=["disabled"],K0={key:0,class:"w-6 text-center text-base select-none text-zinc-400 dark:text-zinc-500"},O0=["onClick"],Y0=["disabled"],q0=e.defineComponent({__name:"WTable",props:{data:{},columns:{},loading:{type:Boolean},emptyText:{},pageSize:{},serverTotal:{},serverPage:{},searchPlaceholder:{default:"Search…"},rowClickable:{type:Boolean,default:!1},showHeader:{type:Boolean,default:!0},expandable:{type:Boolean,default:!1},selectable:{type:Boolean,default:!1},selectedKeys:{},rowKey:{default:"id"},flushEdges:{type:Boolean,default:!1},rowClass:{},rowStyle:{},summaryRow:{},compact:{type:Boolean},showFooter:{type:Boolean,default:!0}},emits:["row-click","update:selectedKeys","row-select","update:serverPage"],setup(n,{expose:d,emit:t}){const o=n,s=t,l=e.ref(new Set);function a(M){l.value.has(M)?l.value.delete(M):l.value.add(M)}const m=e.useSlots(),p=e.computed(()=>o.pageSize??25),f=e.ref(null),c=e.ref("asc");function F(M){f.value===M?c.value=c.value==="asc"?"desc":"asc":(f.value=M,c.value="asc")}const y=e.ref(""),B=e.computed(()=>o.columns.some(M=>M.searchable)),w=e.computed(()=>{let M=o.data??[];const X=y.value.trim().toLowerCase();if(X){const j=o.columns.filter(L=>L.searchable).map(L=>L.field);M=M.filter(L=>j.some(P=>String(L[P]??"").toLowerCase().includes(X)))}if(f.value){const j=f.value;M=[...M].sort((L,P)=>{const O=L[j]??"",i1=P[j]??"",s1=typeof O=="number"&&typeof i1=="number"?O-i1:String(O).toLowerCase().localeCompare(String(i1).toLowerCase());return c.value==="asc"?s1:-s1})}return M}),z=e.ref(1),v=e.computed(()=>o.serverTotal!==void 0),T=e.computed({get:()=>v.value?o.serverPage??1:z.value,set:M=>{v.value?s("update:serverPage",M):z.value=M}}),J=e.computed(()=>v.value?o.serverTotal??0:w.value.length),t1=e.computed(()=>Math.max(1,Math.ceil(J.value/p.value)));e.watch([y,()=>o.data],()=>{v.value||(T.value=1),l.value.clear()});const D=e.computed(()=>{if(v.value)return w.value;const M=(T.value-1)*p.value;return w.value.slice(M,M+p.value)});function S(M,X){const j=M[o.rowKey];return typeof j=="string"||typeof j=="number"?j:`${T.value}:${X}`}const V=e.computed(()=>new Set(o.selectedKeys??[])),x=e.computed(()=>D.value.map(S)),_=e.computed(()=>o.selectable&&x.value.length>0&&x.value.every(M=>V.value.has(M)));function E(M,X,j){const L=S(M,X),P=new Set(o.selectedKeys??[]),O=j===!0;O?P.add(L):P.delete(L),s("update:selectedKeys",[...P]),s("row-select",M,O)}function Z(M){const X=new Set(o.selectedKeys??[]),j=M===!0;for(const L of x.value)j?X.add(L):X.delete(L);s("update:selectedKeys",[...X])}const U=e.computed(()=>J.value===0?0:(T.value-1)*p.value+1),W=e.computed(()=>Math.min(T.value*p.value,J.value)),Y=e.computed(()=>{const M=t1.value;if(M<=7)return Array.from({length:M},(O,i1)=>i1+1);const X=T.value,j=[],L=new Set([1,M,X-1,X,X+1].filter(O=>O>=1&&O<=M));let P=0;for(const O of[...L].sort((i1,s1)=>i1-s1))O-P>1&&j.push("…"),j.push(O),P=O;return j}),K=M=>M==="right"?"text-right":M==="center"?"text-center":"text-left",n1=(M,X)=>[X,o.flushEdges&&M===0&&!o.expandable&&!o.selectable?"pl-0":"pl-3",o.flushEdges&&M===o.columns.length-1?"pr-0":"pr-3"],c1=M=>({...M.width?{width:M.width}:{},...M.minWidth?{minWidth:M.minWidth}:{}});return d({filteredCount:e.computed(()=>w.value.length),searchQuery:y}),(M,X)=>(e.openBlock(),e.createElementBlock("div",b0,[(B.value||e.unref(m).toolbar)&&!n.loading?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["flex items-center gap-2 px-3 border-b border-zinc-100 dark:border-zinc-800",n.compact?"py-1":"py-2"])},[B.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(o2,{modelValue:y.value,"onUpdate:modelValue":X[0]||(X[0]=j=>y.value=j),placeholder:n.searchPlaceholder,icon:e.unref(C.Search),class:"flex-1"},null,8,["modelValue","placeholder","icon"]),y.value?(e.openBlock(),e.createElementBlock("span",y0,e.toDisplayString(w.value.length)+" results ",1)):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0),e.renderSlot(M.$slots,"toolbar")],2)):e.createCommentVNode("",!0),n.loading?(e.openBlock(),e.createElementBlock("div",x0,[e.createVNode(Y1,{tone:"muted"}),X[5]||(X[5]=e.createElementVNode("span",{class:""},"Loading…",-1))])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:2},[e.createElementVNode("div",w0,[e.createElementVNode("table",M0,[e.createElementVNode("colgroup",null,[n.selectable?(e.openBlock(),e.createElementBlock("col",B0)):e.createCommentVNode("",!0),n.expandable?(e.openBlock(),e.createElementBlock("col",V0)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.columns,j=>(e.openBlock(),e.createElementBlock("col",{key:j.field,style:e.normalizeStyle(c1(j))},null,4))),128))]),o.showHeader!==!1?(e.openBlock(),e.createElementBlock("thead",E0,[e.createElementVNode("tr",N0,[n.selectable?(e.openBlock(),e.createElementBlock("th",{key:0,class:e.normalizeClass(["w-9 pr-2",n.compact?"py-1":"py-2",n.flushEdges?"pl-0":"pl-2"])},[e.createVNode(c2,{"model-value":_.value,onClick:X[1]||(X[1]=e.withModifiers(()=>{},["stop"])),"onUpdate:modelValue":Z},null,8,["model-value"])],2)):e.createCommentVNode("",!0),n.expandable?(e.openBlock(),e.createElementBlock("th",{key:1,class:e.normalizeClass(["w-8 pr-2",n.compact?"py-1":"py-2",n.flushEdges&&!n.selectable?"pl-0":"pl-2"])},null,2)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.columns,(j,L)=>(e.openBlock(),e.createElementBlock("th",{key:j.field,class:e.normalizeClass([n1(L,n.compact?"py-1":"py-2"),"whitespace-nowrap text-zinc-500 dark:text-zinc-300 font-medium",K(j.align),L===0&&!n.expandable&&!n.selectable?"sticky left-0 z-10":""]),style:e.normalizeStyle({...c1(j)})},[e.renderSlot(M.$slots,"th-"+j.field,{col:j,sortField:f.value,sortDir:c.value,toggleSort:F},()=>[j.sortable?(e.openBlock(),e.createElementBlock("button",{key:0,onClick:P=>F(j.field),class:e.normalizeClass(["inline-flex items-center gap-1 cursor-pointer transition-colors whitespace-nowrap",j.align==="right"?"ml-auto":""]),style:{color:"inherit"}},[e.createTextVNode(e.toDisplayString(j.label)+" ",1),f.value===j.field&&c.value==="asc"?(e.openBlock(),e.createBlock(e.unref(C.ChevronUp),{key:0,size:11,style:{color:"#5E6AD2"}})):f.value===j.field&&c.value==="desc"?(e.openBlock(),e.createBlock(e.unref(C.ChevronDown),{key:1,size:11,style:{color:"#5E6AD2"}})):(e.openBlock(),e.createBlock(e.unref(C.ChevronsUpDown),{key:2,size:10,style:{opacity:"0.3"}}))],10,S0)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(j.label),1)],64))])],6))),128))])])):e.createCommentVNode("",!0),n.loading?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("tbody",L0,[n.summaryRow?(e.openBlock(),e.createElementBlock("tr",F0,[n.selectable?(e.openBlock(),e.createElementBlock("td",D0)):e.createCommentVNode("",!0),n.expandable?(e.openBlock(),e.createElementBlock("td",$0)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.columns,(j,L)=>(e.openBlock(),e.createElementBlock("td",{key:j.field,class:e.normalizeClass([n1(L,n.compact?"py-1":"py-2.5"),K(j.align),L===0?"sticky left-0 z-10 text-zinc-900 dark:text-zinc-100":"text-zinc-700 dark:text-zinc-200"]),style:e.normalizeStyle(L===0?{background:"inherit"}:{})},[e.renderSlot(M.$slots,"summary-"+j.field,{row:n.summaryRow,value:n.summaryRow[j.field]},()=>[e.createTextVNode(e.toDisplayString(n.summaryRow[j.field]??"—"),1)])],6))),128))])):e.createCommentVNode("",!0),D.value.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(D.value,(j,L)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:L},[e.createElementVNode("tr",{class:e.normalizeClass(["group border-b border-zinc-100 dark:border-zinc-800 hover:bg-zinc-50 dark:hover:bg-zinc-800/50 transition-colors",[n.expandable&&l.value.has(L)?"border-b-0":"",n.rowClass?.(j)]]),style:e.normalizeStyle({cursor:n.rowClickable||n.expandable?"pointer":"default",...n.rowStyle?.(j)??{}}),onClick:P=>n.expandable?a(L):n.rowClickable&&s("row-click",j)},[n.selectable?(e.openBlock(),e.createElementBlock("td",{key:0,class:e.normalizeClass(["w-9 pr-2",n.compact?"py-1":"py-2.5",n.flushEdges?"pl-0":"pl-2"]),onClick:X[2]||(X[2]=e.withModifiers(()=>{},["stop"]))},[e.createVNode(c2,{"model-value":V.value.has(S(j,L)),"onUpdate:modelValue":P=>E(j,L,P)},null,8,["model-value","onUpdate:modelValue"])],2)):e.createCommentVNode("",!0),n.expandable?(e.openBlock(),e.createElementBlock("td",{key:1,class:e.normalizeClass(["w-8 pr-1 text-zinc-400 dark:text-zinc-500",n.compact?"py-1":"py-2.5",n.flushEdges&&!n.selectable?"pl-0":"pl-3"])},[l.value.has(L)?(e.openBlock(),e.createBlock(e.unref(C.ChevronDown),{key:0,size:13,style:{transition:"transform .15s"}})):(e.openBlock(),e.createBlock(e.unref(C.ChevronRight),{key:1,size:13,style:{transition:"transform .15s"}}))],2)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.columns,(P,O)=>(e.openBlock(),e.createElementBlock("td",{key:P.field,class:e.normalizeClass([n1(O,n.compact?"py-1":"py-2.5"),K(P.align),O===0&&!n.expandable&&!n.selectable?"sticky left-0 text-zinc-900 dark:text-zinc-100 font-medium":"text-zinc-700 dark:text-zinc-200"]),style:e.normalizeStyle(O===0&&!n.expandable&&!n.selectable?{background:"inherit",zIndex:1}:{}),onClick:i1=>n.expandable?(n.rowClickable&&s("row-click",j),i1.stopPropagation()):void 0},[e.renderSlot(M.$slots,P.field,{row:j,value:j[P.field]},()=>[e.createTextVNode(e.toDisplayString(j[P.field]??"—"),1)])],14,A0))),128))],14,T0),n.expandable&&l.value.has(L)?(e.openBlock(),e.createElementBlock("tr",H0,[e.createElementVNode("td",{colspan:n.columns.length+(n.expandable?1:0)+(n.selectable?1:0),class:"px-4 pb-3 pt-0"},[e.renderSlot(M.$slots,"expand",{row:j})],8,P0)])):e.createCommentVNode("",!0)],64))),128)):(e.openBlock(),e.createElementBlock("tr",j0,[e.createElementVNode("td",{colspan:n.columns.length+(n.expandable?1:0)+(n.selectable?1:0),class:"py-16 text-center text-zinc-400 dark:text-zinc-500"},[e.createElementVNode("div",R0,[e.renderSlot(M.$slots,"empty-icon"),e.createTextVNode(" "+e.toDisplayString(n.emptyText??"No data"),1)])],8,W0)]))]))])]),n.showFooter&&J.value>0?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["flex items-center justify-between px-4 border-t border-zinc-100 dark:border-zinc-800",n.compact?"py-1":"py-2.5"])},[e.createElementVNode("span",I0,[t1.value>1?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(e.toDisplayString(U.value)+"–"+e.toDisplayString(W.value)+" of "+e.toDisplayString(J.value),1)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(J.value)+" "+e.toDisplayString(J.value===1?"item":"items"),1)],64))]),t1.value>1?(e.openBlock(),e.createElementBlock("div",Z0,[e.createElementVNode("button",{onClick:X[3]||(X[3]=j=>T.value--),disabled:T.value===1,class:"h-7 w-7 flex items-center justify-center rounded-md transition-colors cursor-pointer disabled:opacity-30 hover:bg-zinc-50 dark:hover:bg-zinc-800/50 text-zinc-400"},[e.createVNode(e.unref(C.ChevronLeft),{size:13})],8,U0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Y.value,j=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:j},[j==="…"?(e.openBlock(),e.createElementBlock("span",K0,"…")):(e.openBlock(),e.createElementBlock("button",{key:1,onClick:L=>T.value=j,class:e.normalizeClass(["h-7 min-w-7 px-2 rounded-md text-sm font-medium transition-colors cursor-pointer",T.value===j?"":"text-zinc-700 dark:text-zinc-200 hover:bg-zinc-100 dark:hover:bg-zinc-700"]),style:e.normalizeStyle(T.value===j?"background:rgba(94,106,210,0.1);color:#5E6AD2":void 0)},e.toDisplayString(j),15,O0))],64))),128)),e.createElementVNode("button",{onClick:X[4]||(X[4]=j=>T.value++),disabled:T.value===t1.value,class:"h-7 w-7 flex items-center justify-center rounded-md transition-colors cursor-pointer disabled:opacity-30 hover:bg-zinc-50 dark:hover:bg-zinc-800/50 text-zinc-400"},[e.createVNode(e.unref(C.ChevronRight),{size:13})],8,Y0)])):e.createCommentVNode("",!0)],2)):e.createCommentVNode("",!0)],64))]))}}),Q0={class:"w-spreadsheet-frame__surface"},J0={key:0,class:"w-spreadsheet-frame__heading"},X0={key:1,class:"w-spreadsheet-frame__status"},G0=["title","aria-label"],_0={key:1,class:"flex min-h-64 items-center justify-center gap-3 text-zinc-400 dark:text-zinc-500"},e3={key:0,class:"w-spreadsheet__row-axis-col"},n3={key:0},t3={key:0,class:"w-spreadsheet__corner"},l3={key:0,class:"w-spreadsheet__axis"},c3=["colspan","title","tabindex","onClick","onKeydown","onPointerenter","onPointerdown"],a3={key:0,class:"w-spreadsheet__editor"},o3=["type","value","min","placeholder","onInput"],r3=["onPointerdown"],i3=e.defineComponent({__name:"WSpreadsheet",props:{columns:{},rows:{},showAxes:{type:Boolean,default:!0},showColumnLetters:{type:Boolean,default:!0},showRowNumbers:{type:Boolean,default:!0},minWidth:{default:"960px"},maxHeight:{default:"68vh"},sortable:{type:Boolean},expandable:{type:Boolean},showExpandButton:{type:Boolean},actionsOnHover:{type:Boolean},downloadable:{type:Boolean},showDownloadButton:{type:Boolean},downloadFilename:{},fillHandle:{type:Boolean},expanded:{type:Boolean},downloadRequest:{},loading:{type:Boolean}},emits:["update:expanded","cell-change"],setup(n,{expose:d,emit:t}){const o=n,s=t,l=e.computed(()=>o.showAxes&&o.showColumnLetters),a=e.computed(()=>o.showAxes&&o.showRowNumbers),m=e.computed(()=>o.columns.some(b=>b.sticky)),p=e.ref(null),f=e.ref("asc"),c=e.ref(o.expanded??!1),F=e.ref(null),y=e.ref(null),B=e.ref(null),w=e.ref(null),z=e.ref(null);function v(){if(!o.downloadable)return;const b=N=>`"${String(N??"").replace(/"/g,'""')}"`,A=V.value.map(N=>o.columns.map(H=>b(D(N,H.key))).join(",")).join(`\r
|
|
2
2
|
`),$=new Blob([`\uFEFF${A}`],{type:"text/csv;charset=utf-8"}),G=URL.createObjectURL($),Q=document.createElement("a");Q.href=G,Q.download=o.downloadFilename||"spreadsheet.csv",Q.click(),URL.revokeObjectURL(G)}function T(b,A=!0){if(c.value===b)return;const $=performance.now();console.debug(`[WSpreadsheet] ${b?"expand":"minimize"} requested`),c.value=b,A&&s("update:expanded",b),requestAnimationFrame(()=>requestAnimationFrame(()=>{console.debug(`[WSpreadsheet] ${b?"expand":"minimize"} painted in ${(performance.now()-$).toFixed(1)}ms`)}))}e.watch(()=>o.expanded,b=>{b!=null&&T(b,!1)}),e.watch(()=>o.downloadRequest,(b,A)=>{b!=null&&b!==A&&v()}),d({expand:()=>{o.expandable&&T(!0)},collapse:()=>{T(!1)},toggleExpanded:()=>{o.expandable&&T(!c.value)},download:v});function J(b){b.key==="Escape"&&c.value&&T(!1)}function t1(b){if(b.target?.closest(".w-spreadsheet__cell")?.querySelector(".w-spreadsheet__input"))return;w.value=null,z.value=null;const G=document.activeElement;G&&F.value?.contains(G)&&G.blur()}e.onMounted(()=>{document.addEventListener("keydown",J),document.addEventListener("pointerdown",t1)}),e.onBeforeUnmount(()=>{document.removeEventListener("keydown",J),document.removeEventListener("pointerdown",t1),window.removeEventListener("pointerup",P)});function D(b,A){return b.cells.find($=>$.key===A)?.value??""}function S(b){if(typeof b=="number")return b;const A=String(b).trim().replace(/[\s,]/g,"");return A!==""&&/^-?\d+(\.\d+)?$/.test(A)?Number(A):String(b).toLocaleLowerCase()}const V=e.computed(()=>{if(!p.value)return o.rows;const b=o.rows.filter(G=>G.sortable!==!1),A=f.value==="asc"?1:-1;b.sort((G,Q)=>{const N=S(D(G,p.value)),H=S(D(Q,p.value));return typeof N=="number"&&typeof H=="number"?(N-H)*A:String(N).localeCompare(String(H),void 0,{numeric:!0})*A});let $=0;return o.rows.map(G=>G.sortable===!1?G:b[$++])});function x(b){const A=o.columns.find($=>$.key===b.key);return!!(o.sortable&&b.variant==="header"&&A?.sortable!==!1)}function _(b){x(b)&&(p.value===b.key?f.value=f.value==="asc"?"desc":"asc":(p.value=b.key,f.value="asc"))}function E(b,A){return b.cells.slice(0,A).reduce(($,G)=>$+(G.colspan||1),0)}function Z(b,A){return!!o.columns[E(b,A)]?.sticky}function U(b,A){const $=E(b,A);return!!(o.columns[$]?.sticky&&!o.columns.slice(0,$).some(G=>G.sticky))}function W(b,A){const $=E(b,A);if(!o.columns[$]?.sticky)return;const G=o.columns.slice(0,$).map(Q=>Q.width||"0px");return{left:G.length?`calc(${G.join(" + ")})`:"0px"}}function Y(b,A){return`${b.key}\0${A.key}`}function K(b,A){!A.editable||y.value||(w.value={rowKey:b.key,cellKey:A.key},z.value=null)}function n1(b,A){return w.value?.rowKey===b.key&&w.value?.cellKey===A.key}function c1(b,A,$){const G=V.value[b];!o.fillHandle||!$.editable||!G||!n1(G,$)||(z.value=null,y.value={row:b,cell:A,value:String($.value??"")},B.value={row:b,cell:A},window.addEventListener("pointerup",P,{once:!0}))}function M(b,A){y.value&&(B.value={row:b,cell:A})}function X(b,A){if(!y.value||!B.value)return!1;const $=Math.min(y.value.row,B.value.row),G=Math.max(y.value.row,B.value.row),Q=Math.min(y.value.cell,B.value.cell),N=Math.max(y.value.cell,B.value.cell);return b>=$&&b<=G&&A>=Q&&A<=N}function j(b,A){if(!X(b,A)||!y.value||!B.value)return{};const $=Math.min(y.value.row,B.value.row),G=Math.max(y.value.row,B.value.row),Q=Math.min(y.value.cell,B.value.cell),N=Math.max(y.value.cell,B.value.cell);return{"w-spreadsheet__cell--fill-range":!0,"w-spreadsheet__cell--fill-top":b===$,"w-spreadsheet__cell--fill-bottom":b===G,"w-spreadsheet__cell--fill-left":A===Q,"w-spreadsheet__cell--fill-right":A===N}}function L(b,A){const $=Y(b,A);return{"w-spreadsheet__cell--fill-completed":!!z.value?.cells.has($),"w-spreadsheet__cell--fill-source":z.value?.source===$}}function P(){if(!y.value||!B.value)return;const b=y.value,A=B.value,$=Math.min(b.row,A.row),G=Math.max(b.row,A.row),Q=Math.min(b.cell,A.cell),N=Math.max(b.cell,A.cell),H=new Set,R=V.value[b.row],a1=R?.cells[b.cell];for(let h1=$;h1<=G;h1++){const b1=V.value[h1];if(b1)for(let V1=Q;V1<=N;V1++){const y1=b1.cells[V1];y1?.editable&&(H.add(Y(b1,y1)),s("cell-change",{rowKey:b1.key,cellKey:y1.key,value:b.value,row:b1,cell:y1}))}}y.value=null,B.value=null,z.value=R&&a1?{cells:H,source:Y(R,a1)}:null}function O(b){let A=b+1,$="";for(;A>0;)A-=1,$=String.fromCharCode(65+A%26)+$,A=Math.floor(A/26);return $}function i1(b){return[`w-spreadsheet__cell--${b.variant||"default"}`,`w-spreadsheet__cell--${b.align||"left"}`,`w-spreadsheet__cell--tone-${b.tone||"default"}`,{"w-spreadsheet__cell--wrap":!!b.wrap},b.class||""]}function s1(b,A,$){const G=$.target.value;s("cell-change",{rowKey:b.key,cellKey:A.key,value:G,row:b,cell:A})}function B1(b){const $=b.currentTarget.previousElementSibling;$?.focus(),$?.showPicker?.()}return(b,A)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"frameRef",ref:F,class:e.normalizeClass(["w-spreadsheet-frame",{"w-spreadsheet-frame--expanded":c.value}])},[c.value?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"w-spreadsheet-frame__backdrop","aria-label":"Restore spreadsheet",onClick:A[0]||(A[0]=$=>T(!1))})):e.createCommentVNode("",!0),e.createElementVNode("div",Q0,[n.expandable&&(n.showExpandButton!==!1||c.value)||n.downloadable&&(n.showDownloadButton!==!1||c.value)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["w-spreadsheet-frame__toolbar",{"w-spreadsheet-frame__toolbar--hover":n.actionsOnHover&&!c.value}])},[c.value&&b.$slots["expanded-header"]?(e.openBlock(),e.createElementBlock("div",J0,[e.renderSlot(b.$slots,"expanded-header")])):e.createCommentVNode("",!0),b.$slots["toolbar-status"]?(e.openBlock(),e.createElementBlock("div",X0,[e.renderSlot(b.$slots,"toolbar-status")])):e.createCommentVNode("",!0),e.renderSlot(b.$slots,"toolbar"),n.downloadable&&(n.showDownloadButton!==!1||c.value)?(e.openBlock(),e.createElementBlock("button",{key:2,type:"button",class:"w-spreadsheet-frame__expand",title:"Download spreadsheet","aria-label":"Download spreadsheet",onClick:v},[e.createVNode(e.unref(C.Download),{size:16})])):e.createCommentVNode("",!0),n.expandable&&(n.showExpandButton!==!1||c.value)?(e.openBlock(),e.createElementBlock("button",{key:3,type:"button",class:"w-spreadsheet-frame__expand",title:c.value?"Restore spreadsheet":"Expand spreadsheet","aria-label":c.value?"Restore spreadsheet":"Expand spreadsheet",onClick:A[1]||(A[1]=$=>T(!c.value))},[c.value?(e.openBlock(),e.createBlock(e.unref(C.Minimize),{key:0,size:16})):(e.openBlock(),e.createBlock(e.unref(C.Expand),{key:1,size:16}))],8,G0)):e.createCommentVNode("",!0)],2)):e.createCommentVNode("",!0),n.loading?(e.openBlock(),e.createElementBlock("div",_0,[e.createVNode(Y1),A[2]||(A[2]=e.createElementVNode("span",null,"Preparing sales estimate…",-1))])):(e.openBlock(),e.createElementBlock("div",{key:2,class:e.normalizeClass(["w-spreadsheet",{"w-spreadsheet--with-column-axis":l.value}]),style:e.normalizeStyle({maxHeight:c.value?"calc(100vh - 96px)":n.maxHeight})},[e.createElementVNode("table",{class:e.normalizeClass(["w-spreadsheet__table",{"w-spreadsheet__table--sticky-columns":m.value}]),style:e.normalizeStyle({minWidth:n.minWidth})},[e.createElementVNode("colgroup",null,[a.value?(e.openBlock(),e.createElementBlock("col",e3)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.columns,$=>(e.openBlock(),e.createElementBlock("col",{key:$.key,style:e.normalizeStyle({width:$.width})},null,4))),128))]),l.value?(e.openBlock(),e.createElementBlock("thead",n3,[e.createElementVNode("tr",null,[a.value?(e.openBlock(),e.createElementBlock("th",t3)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.columns,($,G)=>(e.openBlock(),e.createElementBlock("th",{key:$.key,class:"w-spreadsheet__axis"},e.toDisplayString($.label||O(G)),1))),128))])])):e.createCommentVNode("",!0),e.createElementVNode("tbody",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(V.value,($,G)=>(e.openBlock(),e.createElementBlock("tr",{key:$.key,class:e.normalizeClass({"w-spreadsheet__row--sticky":$.sticky})},[a.value?(e.openBlock(),e.createElementBlock("th",l3,e.toDisplayString(G+1),1)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList($.cells,(Q,N)=>(e.openBlock(),e.createElementBlock("td",{key:Q.key,class:e.normalizeClass(["w-spreadsheet__cell",[i1(Q),{"w-spreadsheet__cell--sortable":x(Q),"w-spreadsheet__cell--sticky":Z($,N),"w-spreadsheet__cell--sticky-first":U($,N),"w-spreadsheet__cell--active":n1($,Q)},j(G,N),L($,Q)]]),colspan:Q.colspan||1,title:Q.title,style:e.normalizeStyle(W($,N)),tabindex:x(Q)?0:void 0,onClick:H=>_(Q),onKeydown:[e.withKeys(e.withModifiers(H=>_(Q),["prevent"]),["enter"]),e.withKeys(e.withModifiers(H=>_(Q),["prevent"]),["space"])],onPointerenter:H=>M(G,N),onPointerdown:H=>K($,Q)},[e.renderSlot(b.$slots,`cell-${Q.key}`,{row:$,cell:Q,rowIndex:G},()=>[Q.editable?(e.openBlock(),e.createElementBlock("div",a3,[e.createElementVNode("input",{class:e.normalizeClass(["w-spreadsheet__input",{"w-spreadsheet__input--date":Q.inputType==="date"}]),type:Q.inputType||"text",value:Q.value??"",min:Q.min,placeholder:Q.placeholder,onInput:H=>s1($,Q,H)},null,42,o3),Q.inputType==="date"?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"w-spreadsheet__calendar","aria-label":"Choose date",title:"Choose date",onClick:B1},[e.createVNode(e.unref(C.CalendarDays),{size:16})])):e.createCommentVNode("",!0)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(Q.value??""),1)],64))]),x(Q)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(p.value===Q.key?f.value==="asc"?e.unref(C.ChevronUp):e.unref(C.ChevronDown):e.unref(C.ChevronsUpDown)),{key:0,class:"w-spreadsheet__sort-icon",size:14})):e.createCommentVNode("",!0),n.fillHandle&&Q.editable&&n1($,Q)?(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:"w-spreadsheet__fill-handle","aria-label":"Fill adjacent cells",title:"Drag to fill adjacent cells",onPointerdown:e.withModifiers(H=>c1(G,N,Q),["stop","prevent"])},null,40,r3)):e.createCommentVNode("",!0)],46,c3))),128))],2))),128))])],6)],6))])],2))}}),k1=(n,d)=>{const t=n.__vccOpts||n;for(const[o,s]of d)t[o]=s;return t},s3={},d3={class:"min-w-40 rounded-lg bg-white p-1.5 shadow-md shadow-zinc-900/5 dark:bg-zinc-700 dark:shadow-black/20"};function u3(n,d){return e.openBlock(),e.createElementBlock("div",d3,[e.renderSlot(n.$slots,"default")])}const a2=k1(s3,[["render",u3]]),m3=["disabled"],T1=e.defineComponent({__name:"WActionMenuItem",props:{danger:{type:Boolean},disabled:{type:Boolean}},emits:["click"],setup(n,{emit:d}){const t=d;return(o,s)=>(e.openBlock(),e.createElementBlock("button",{type:"button",disabled:n.disabled,onClick:s[0]||(s[0]=l=>t("click",l)),class:e.normalizeClass(["flex h-8 w-full items-center gap-2 rounded-md px-2 text-left font-medium transition disabled:cursor-not-allowed disabled:opacity-40",n.danger?"text-red-500 hover:bg-red-50 dark:hover:bg-red-950/30":"text-zinc-600 hover:bg-zinc-100 hover:text-zinc-900 dark:text-zinc-100 dark:hover:bg-zinc-600 dark:hover:text-white"])},[e.renderSlot(o.$slots,"default")],10,m3))}}),y2={light:{trendPositive:"#15803D",trendNegative:"#DB2777",canvas:"#F8F8F8",surface:"#FFFFFF",input:"#FFFFFF",raised:"#F2F3EF",popover:"#FFFFFF",border:"rgb(32 33 29 / 0.07)",borderHover:"rgb(32 33 29 / 0.16)",text:"#20211D",muted:"#64675C",dim:"#707467",accent:"#85C531",onAccent:"#17210B",primary:"#171717",primaryHover:"#303030",onPrimary:"#FFFFFF",secondary:"#EFEFEF",secondaryHover:"#E3E3E3",onSecondary:"#20211D",secondaryShadow:"none",switchOn:"linear-gradient(35deg, #32dc08 0%, #9de400 48%, #e9e600 100%)",switchOff:"#D4D4D8",switchDisabled:"#E4E4E7",switchThumb:"#FFFFFF",focusRing:"color-mix(in srgb, var(--wpic-accent) 18%, transparent)",positive:"#85C531",negative:"#B94238"},dark:{trendPositive:"#86EFAC",trendNegative:"#FDA4AF",canvas:"#090A05",surface:"#151515",input:"#151515",raised:"#2A2A28",popover:"#1F201D",border:"rgb(255 255 255 / 0.06)",borderHover:"rgb(255 255 255 / 0.14)",text:"#F5F5F5",muted:"#B4B4B4",dim:"#969696",accent:"#85C531",onAccent:"#17210B",primary:"#FFFFFF",primaryHover:"#E8E8E8",onPrimary:"#171717",secondary:"linear-gradient(180deg, #3A3B36, #30312D)",secondaryHover:"linear-gradient(180deg, #40413B, #353630)",onSecondary:"#F5F5F5",secondaryShadow:"inset 0 1px 0 rgb(255 255 255 / 0.15), 0 1px 2px rgb(0 0 0 / 0.12)",switchOn:"linear-gradient(35deg, #32dc08 0%, #9de400 48%, #e9e600 100%)",switchOff:"#343530",switchDisabled:"#252525",switchThumb:"#FFFFFF",focusRing:"color-mix(in srgb, var(--wpic-accent) 18%, transparent)",positive:"#85C531",negative:"#F0A09A"}},h3={light:["#3B73E1","#0891A6","#8B5CD6","#C58A16","#D64D79","#527FA8"],dark:["#7C9FE0","#5FB8C4","#AF94D5","#D8B26A","#D88FA5","#94A8BD"]};function x2(n,d={}){const t={...y2[n],...d},o={};for(const[s,l]of Object.entries(t))o[`--wpic-${s.replace(/[A-Z]/g,a=>`-${a.toLowerCase()}`)}`]=l;return Object.assign(o,{"--bg-main":t.canvas,"--bg-card":t.surface,"--bg-input":t.input,"--border-subtle":t.border,"--border-strong":t.border,"--border-hover":t.borderHover,"--text-main":t.text,"--text-muted":t.muted,"--text-dim":t.dim,"--wpic-primary":t.accent,"--wpic-primary-hover":t.accent,"--wpic-control-height":"36px","--wpic-segment-active":n==="dark"?t.secondaryHover:t.surface,"--wpic-segment-shadow":n==="dark"?t.secondaryShadow:`inset 0 0 0 1px ${t.border}, 0 1px 2px rgb(0 0 0 / 0.08)`,"--wpic-button-primary":t.primary,"--wpic-button-primary-hover":t.primaryHover}),o}const w2=Symbol("wpic-theme");function A1(){return e.inject(w2,e.computed(()=>null))}const p3=["data-wpic-theme"],M1=e.defineComponent({__name:"WPopover",props:{open:{type:Boolean},anchor:{},placement:{},width:{},minWidth:{},height:{},minHeight:{},maxHeight:{},panelScroll:{type:Boolean,default:!0},offset:{},matchAnchorWidth:{type:Boolean},freezePositionOnOpen:{type:Boolean,default:!0},flip:{type:Boolean,default:!0},zIndex:{default:9999},extraPanels:{}},emits:["close"],setup(n,{emit:d}){const t=n,o=A1(),s=d,l=Symbol.for("wpic-ui-popover-descendants"),a=e.inject(l,null),m=new Set;e.provide(l,{add(E){m.add(E),a?.add(E)},remove(E){m.delete(E),a?.remove(E)}});const p=e.computed(()=>{const E=t.anchor;return E?e.isRef(E)?E.value:E:null}),f=e.ref(null),c=e.ref(null),F=e.computed(()=>c.value??t.placement??"bottom-start"),y=e.computed(()=>{const E=[l1.offset(t.offset??6)];return t.flip&&!c.value&&E.push(l1.flip()),E.push(l1.shift({padding:4})),E.push(l1.size({padding:8,apply({availableHeight:Z,rects:U,elements:W}){const Y=Math.max(Z-8,50),n1={maxHeight:t.maxHeight?`min(${t.maxHeight}, ${Y}px)`:`${Y}px`,overflowY:t.panelScroll?"auto":"hidden"};if(t.height&&(n1.height=`min(${t.height}, ${Y}px)`),t.minHeight&&(n1.minHeight=`min(${t.minHeight}, ${Y}px)`),t.matchAnchorWidth){const c1=`${U.reference.width}px`;n1.width=c1,n1.minWidth=c1}Object.assign(W.floating.style,n1)}})),E}),{floatingStyles:B,placement:w,update:z,isPositioned:v}=l1.useFloating(p,f,{placement:F,strategy:"fixed",open:e.computed(()=>t.open),whileElementsMounted:l1.autoUpdate,middleware:y}),T=e.computed(()=>{const E=w.value;return E.startsWith("top")?"bottom":E.startsWith("bottom")?"top":E.startsWith("left")?"right":E.startsWith("right")?"left":"top"}),J=E=>{const Z=E.target,U=p.value,W=f.value;W&&W.contains(Z)||[...m].some(Y=>Y.contains(Z))||U&&U.contains(Z)||t.extraPanels?.some(Y=>Y?.contains(Z))||s("close")},t1=E=>{if(E.key!=="Escape"||!t.open||[...m].some(U=>U.isConnected&&U.style.display!=="none"))return;E.preventDefault(),E.stopImmediatePropagation(),s("close");const Z=p.value;Z?.matches("button, input, [tabindex]")?Z.focus():Z?.querySelector("button, input, [tabindex]")?.focus()};let D=!1,S=!1;function V(){S||(document.addEventListener("pointerdown",J,!0),document.addEventListener("keydown",t1,!0),S=!0)}function x(){S&&(document.removeEventListener("pointerdown",J,!0),document.removeEventListener("keydown",t1,!0),S=!1)}e.watch(()=>t.open,E=>{E?e.nextTick(()=>{D||!t.open||(z(),V())}):(c.value=null,x())},{immediate:!0}),e.watch(f,(E,Z)=>{Z&&a?.remove(Z),E&&a?.add(E)}),e.watch(v,E=>{E&&t.open&&t.freezePositionOnOpen&&!c.value&&(c.value=w.value)}),e.onBeforeUnmount(()=>{D=!0,x(),f.value&&a?.remove(f.value)});const _=e.computed(()=>({...t.matchAnchorWidth?{}:{width:t.width??"auto"},...t.minWidth?{minWidth:t.minWidth}:{},transformOrigin:T.value,zIndex:t.zIndex}));return(E,Z)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body",class:"wpic-popover"},[e.withDirectives(e.createElementVNode("div",{ref_key:"floatingEl",ref:f,"data-wpic-theme":e.unref(o)?.mode,class:e.normalizeClass([{"wpic-theme":e.unref(o),dark:e.unref(o)?.mode==="dark"},"wpic-popover-panel flex flex-col bg-white dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-800 rounded-xl shadow-xl dark:shadow-black/40 overflow-hidden"]),style:e.normalizeStyle([e.unref(o)?.variables,e.unref(B),_.value])},[e.renderSlot(E.$slots,"default")],14,p3),[[e.vShow,n.open]])]))}}),v3={key:0,class:"fixed right-0 top-0 z-[9997] flex h-full w-20 items-center justify-center border-l-2 border-[var(--wpic-primary)] bg-[var(--wpic-primary)]/10 text-[var(--wpic-primary)] pointer-events-none"},f3=["data-variant","data-maximized"],C3=["title"],g3={class:"min-w-0 flex-1 px-2 text-center"},z3={class:"truncate font-medium text-zinc-700 dark:text-zinc-200"},k3={key:0,class:"truncate text-zinc-500 dark:text-zinc-400"},b3={class:"flex shrink-0 items-center gap-1"},y3=["title"],x3=["title"],w3=["title"],M3=["title"],B3={class:"flex h-11 shrink-0 items-center justify-between px-3"},V3={class:"font-medium text-zinc-700 dark:text-zinc-200"},E3=["title"],N3={class:"space-y-2 px-3 pb-3"},S3={class:"truncate"},L3={class:"flex-1 overflow-y-auto overflow-x-visible px-2 pb-3"},F3={class:"mb-2 flex h-7 items-center justify-between px-2 font-medium text-zinc-500 dark:text-zinc-400"},D3={class:"truncate"},$3=["title"],T3={class:"space-y-0.5"},A3={key:0,class:"rounded-lg border border-dashed border-zinc-200 px-2 py-2 text-zinc-500 dark:border-zinc-700 dark:text-zinc-400"},H3=["onMouseenter"],P3=["onClick"],j3={class:"min-w-0 flex-1 truncate"},W3={key:0,class:"shrink-0 text-zinc-400"},R3={key:0,class:"px-3 py-2 text-zinc-400 dark:text-zinc-500"},I3=["onPointerdown","onClick"],Z3={class:"min-w-0 flex-1 truncate"},U3={class:"shrink-0 text-zinc-400"},K3={class:"mt-4"},O3={class:"flex h-7 items-center px-2 font-medium text-zinc-500 dark:text-zinc-400"},Y3={class:"truncate"},q3={class:"space-y-0.5"},Q3={key:0,class:"rounded-lg border border-dashed border-zinc-200 px-2 py-2 text-zinc-500 dark:border-zinc-700 dark:text-zinc-400"},J3=["onPointerdown","onClick"],X3={class:"block truncate"},G3={class:"shrink-0 text-zinc-400"},_3=["onClick"],e4=["onPointerenter","onMouseenter"],n4={class:"truncate"},t4={class:"flex min-h-0 flex-1"},l4={class:"flex min-w-0 flex-1 flex-col"},c4={key:0,class:"flex h-full flex-col items-center justify-center px-5 text-center text-zinc-500 dark:text-zinc-400"},a4={class:"font-medium"},o4={key:1,class:"flex h-full flex-col items-center justify-center px-5 text-center"},r4={class:"mb-3 flex h-11 w-11 items-center justify-center rounded-xl bg-zinc-100 text-zinc-500 dark:bg-zinc-700 dark:text-zinc-300"},i4={class:"font-semibold text-zinc-800 dark:text-zinc-100"},s4={key:0,class:"mt-1 max-w-xs text-zinc-500 dark:text-zinc-400"},d4={key:2,class:"space-y-4"},u4={class:"max-w-[82%]"},m4=["src","alt"],h4={class:"max-w-40 truncate"},p4={key:0,class:"shrink-0 text-zinc-400"},v4={key:0,class:"flex items-center gap-2 text-zinc-500 dark:text-zinc-400"},f4={key:1,class:"wpic-chat-loading-card",role:"status","aria-label":"Generating image"},C4=["innerHTML","onClick"],g4=["href","onClick"],z4=["src"],k4=["title","aria-label","onClick"],b4=["title","aria-label","onClick"],y4=["title","onClick"],x4=["onClick"],w4=["title","onClick"],M4={key:0,class:"mb-2 flex flex-wrap justify-end gap-1.5"},B4=["src","alt"],V4={class:"max-w-40 truncate"},E4={key:0,class:"shrink-0 text-zinc-400"},N4={key:1,class:"shrink-0 text-zinc-400"},S4=["title","onClick"],L4={class:"wpic-chat-panel__composer rounded-xl border border-zinc-200 bg-zinc-50 transition-colors focus-within:border-[var(--wpic-primary)]/50 dark:border-zinc-700 dark:bg-zinc-700"},F4={key:0,class:"mx-2 mt-2 overflow-hidden rounded-lg bg-white shadow-sm ring-1 ring-zinc-200 dark:bg-zinc-800 dark:ring-zinc-600"},D4=["onMousedown"],$4={class:"min-w-0 truncate font-medium text-zinc-900 dark:text-zinc-100"},T4={key:0,class:"max-w-32 shrink-0 truncate text-xs text-zinc-500 dark:text-zinc-400"},A4=["accept"],H4=["value","placeholder","disabled"],P4={class:"flex items-center justify-between px-2 pb-2"},j4=["disabled","title"],W4=["title"],R4=["disabled","title"],k2=80,I4=e.defineComponent({__name:"WChatPanel",props:{open:{type:Boolean},messages:{},mentionItems:{default:()=>[]},projects:{default:()=>[]},sessions:{default:()=>[]},modelValue:{default:""},title:{default:"Chat"},subtitle:{default:""},selectedProjectId:{default:null},selectedSessionId:{default:null},placeholder:{default:"Ask anything..."},emptyTitle:{default:"How can I help?"},emptyDescription:{default:""},noProjectsLabel:{default:"No projects yet"},noConversationsLabel:{default:"No conversations yet"},allLabel:{default:"All"},recentLabel:{default:"Recent"},projectsLabel:{default:"Projects"},conversationsLabel:{default:"Conversations"},sendLabel:{default:"Send"},newLabel:{default:"New chat"},newProjectLabel:{default:"New project"},newConversationLabel:{default:"New conversation"},renameProjectLabel:{default:"Rename project"},renameConversationLabel:{default:"Rename conversation"},deleteProjectLabel:{default:"Delete project"},deleteConversationLabel:{default:"Delete conversation"},clearLabel:{default:"Clear"},copyLabel:{default:"Copy"},copiedLabel:{default:"Copied"},newChatFromMessageLabel:{default:"Start new chat from this message"},attachFilesLabel:{default:"Attach files"},removeAttachmentLabel:{default:"Remove attachment"},stopLabel:{default:"Stop"},applyPromptLabel:{default:"Apply prompt"},applyAllLabel:{default:"Apply all"},applySettingLabel:{default:"Apply setting"},thinkingLabel:{default:"Thinking..."},dockLabel:{default:"Dock"},undockLabel:{default:"Undock"},closeLabel:{default:"Close"},helpfulLabel:{default:"Helpful"},notHelpfulLabel:{default:"Not helpful"},attachments:{default:()=>[]},accept:{default:""},customAttachmentPicker:{type:Boolean,default:!1},showNavigator:{type:Boolean,default:!0},hideNewConversation:{type:Boolean,default:!1},hideClear:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},cancellable:{type:Boolean,default:!1},docked:{type:Boolean,default:!1},maximized:{type:Boolean,default:!1},maximizedMargin:{default:20},width:{default:420},height:{default:560},x:{default:-1},y:{default:-1},topOffset:{default:0},minWidth:{default:340},minHeight:{default:400},zIndex:{default:80},variant:{default:"default"}},emits:["close","send","clear","new","new-project","new-conversation","select-project","select-session","rename-project","rename-session","delete-project","delete-session","move-session","edit-message","new-chat-from-message","message-feedback","apply-message-proposal","navigate","cancel","attach","files-selected","remove-attachment","update:modelValue","update:docked","update:maximized","update:width","update:height","update:x","update:y"],setup(n,{emit:d}){const t=n,o=d,s=e.useSlots(),l=e.ref(null),a=e.ref(null),m=e.ref(null),p=e.ref(null),f=e.ref(null),c=e.ref(null),F=e.ref(0),y=e.ref(0),B=e.ref(!1),w=e.ref(null),z=e.ref(null);let v=null;const T=e.ref(!1),J=e.ref(!1),t1=e.ref(!1);e.ref(new Set);const D=e.ref(null),S=e.ref(null),V=e.ref({}),x=e.ref(null);let _=null,E=null;function Z(){E?.disconnect(),E=null;const r=a.value,i=f.value;if(!r||!i||typeof ResizeObserver>"u")return;const u=()=>i.style.setProperty("--wpic-chat-footer-height",`${r.getBoundingClientRect().height}px`);u(),E=new ResizeObserver(u),E.observe(r)}const U=e.computed(()=>x.value?[]:t.messages.filter(r=>r.role!=="system")),W=e.computed(()=>t.loading||x.value!==null),Y=e.computed(()=>t.modelValue.trim().length>0&&!t.loading),K=e.computed(()=>t.attachments.length>0),n1=e.computed(()=>{const r=t.modelValue.slice(0,y.value),i=r.match(/(?:^|\s)@([^\s@]*)$/);return i?{start:r.length-i[0].length+(i[0].startsWith(" ")?1:0),query:i[1].toLowerCase()}:null}),c1=e.computed(()=>{const r=n1.value;if(!r)return[];const i=r.query;return t.mentionItems.filter(u=>u.label.toLowerCase().includes(i)).slice(0,6)}),M=e.computed(()=>t.showNavigator&&B.value),X=e.computed(()=>t.selectedProjectId??null),j=e.computed(()=>t.sessions.filter(r=>!r.projectId)),L=e.computed(()=>{const r=new Map;for(const i of t.projects)r.set(i.id,[]);for(const i of t.sessions){if(!i.projectId)continue;const u=r.get(i.projectId);u&&u.push(i)}return r});function P(r){const i=r.toLowerCase();if(i.includes("doubao-seedance-1-5-pro-251215")||i.includes("doubao seedance 1.5")||i.includes("seedance 1.5")||i.includes("seedance video"))return"jimeng:doubao-seedance-1-5-pro-251215";if(i.includes("imagen 4")||i.includes("imagen-4"))return"google:imagen-4.0-generate-001";if(i.includes("gpt-image-1")||i.includes("gpt image 1"))return"openai:gpt-image-1";if(i.includes("gpt-image-2")||i.includes("gpt image 2"))return"openai:gpt-image-2";if(i.includes("doubao-seedream-4-5-251128"))return"jimeng:doubao-seedream-4-5-251128";if(i.includes("doubao-seedream-4-0-250828"))return"jimeng:doubao-seedream-4-0-250828";if(i.includes("doubao seedream 5")||i.includes("seedream 5")||i.includes("doubao seedream 4.5")||i.includes("seedream 4.5"))return"jimeng:doubao-seedream-4-5-251128";if(i.includes("doubao seedream 4")||i.includes("seedream 4"))return"jimeng:doubao-seedream-4-0-250828";if(i.includes("auto"))return"auto";const u=r.match(/\b([a-z][a-z0-9_-]+):([a-z0-9._-]+)\b/i);if(u)return`${u[1].toLowerCase()}:${u[2]}`}function O(r){if(r!=="auto"){if(r.includes("seedance"))return"video";if(r.includes("gpt-image")||r.includes("imagen")||r.includes("seedream")||r.includes("jimeng:"))return"image"}}function i1(r){const i=[],u=new Set,g=/\b(gpt[-\s]?image[-\s]?[12]|imagen\s*4|doubao\s+seedance\s+1\.5(?:\s+pro)?|seedance\s+1\.5(?:\s+pro)?|doubao\s+seedream\s+(?:5(?:\.0)?|4\.5|4)|seedream\s+(?:5(?:\.0)?|4\.5|4)|[a-z][a-z0-9_-]+:[a-z0-9._-]+|auto)\b/gi;for(const h of r.matchAll(g)){const k=h[1],I=P(k);!I||u.has(I)||(u.add(I),i.push({label:k,value:I}))}return i}function s1(r,i){return r.match(new RegExp(`${i}=["']([^"']+)["']`,"i"))?.[1]}function B1(r){const i={};for(const g of r.matchAll(/\[SETTING\s+([^\]]+)\]([\s\S]*?)\[\/SETTING\]/gi)){const h=g[1]??"",k=s1(h,"key"),I=s1(h,"value")??g[2]?.trim();if(!(!k||!I))if(k==="duration"||k==="fps"||k==="count"){const q=Number(I);Number.isFinite(q)&&(i[k]=q)}else if(k==="model"){const q=P(I)??P(g[2]?.trim()??"");q&&(i.model=q)}else(k==="aspect"||k==="resolution"||k==="format")&&(i[k]=I)}const u=r.split(/\r?\n/).map(g=>g.replace(/^[\s>*-]+/,"").trim()).filter(Boolean);for(const g of u){const h=g.toLowerCase();if(/(supporte|supports?|disponible|available|dur[eé]es?\s*:|ratios?\s*:|jusqu['’]?à|up to)/i.test(h))continue;const k=g.split(":").slice(1).join(":").trim()||g,I=k.match(/\b(\d{1,2}:\d{1,2})\b/);(h.includes("format")||h.includes("aspect")||h.includes("ratio"))&&I&&(i.aspect=I[1]);const q=k.match(/\b([1248]K)\b/i);(h.includes("résolution")||h.includes("resolution"))&&q&&(i.resolution=q[1].toUpperCase());const e1=k.match(/\b(\d{1,3})\s*(?:s|sec|secondes?|seconds?)\b/i);(h.includes("durée")||h.includes("duration"))&&e1&&(i.duration=Number(e1[1]));const o1=k.match(/\b(\d{1,3})\s*fps\b/i);h.includes("fps")&&o1&&(i.fps=Number(o1[1]));const r1=k.match(/\b(\d{1,2})\b/);if((h.includes("count")||h.includes("nombre")||h.includes("variantes"))&&r1&&(i.count=Number(r1[1])),h.includes("modèle")||h.includes("modele")||h.includes("model")){const p1=P(k);p1&&(i.model=p1)}h.includes("jpg")||h.includes("jpeg")?i.format="jpg":h.includes("png")?i.format="png":h.includes("webp")&&(i.format="webp")}return Object.keys(i).length?i:void 0}function b(r){const i=r.match(/\[TASK(?:\s+([^\]]+))?\](?:([\s\S]*?)\[\/TASK\])?/i);if(i){const g=(s1(i[1]??"","value")??i[2]?.trim())?.toLowerCase();if(["image","video","audio","text"].includes(String(g)))return g}const u=r.split(/\r?\n/).map(g=>g.replace(/^[\s>*-]+/,"").trim()).filter(Boolean);for(const g of u){const h=g.toLowerCase(),k=g.split(":").slice(1).join(":").trim().toLowerCase()||h;if(/(task|type|mode|surface|format|réglage|reglage|setting)/i.test(h)){if(/\baudio\b|subtitles?|sous-titres?|transcri|tts|voice|voix/.test(k))return"audio";if(/\bvid[eé]o\b|\bvideo\b|\bfps\b|duration|dur[eé]e/.test(k))return"video";if(/\bimage\b|photo|visuel|illustration|aspect|ratio|resolution|résolution/.test(k))return"image";if(/\btext\b|texte|copy|caption|script/.test(k))return"text"}}}function A(r){const i=r.match(/\[PROMPT\]([\s\S]*?)\[\/PROMPT\]/i)?.[1];if(i){const e1=V1(i).trim().replace(/^["“]|["”]$/g,"");if(e1)return e1}const u=r.replace(/\r\n/g,`
|
|
3
3
|
`).split(`
|
|
4
4
|
`),g=[];let h=!1,k=!1,I=!1;for(const e1 of u){const o1=e1.trim().replace(/^[\s>*-]+/,"").replace(/^#{1,6}\s+/,"").replace(/^\*\*|\*\*$/g,"").trim();if(k){if(/^```/.test(o1))break;g.push(e1);continue}if(!h){const r1=o1.match(/^(?:(?:voici|essayez|utilisez|use|try)\s+(?:ce\s+)?(?:prompt)|prompt\s+(?:modifi[eé]|am[eé]lior[eé]|propos[eé]|recommand[eé])|prompt)\s*:\s*(.*)$/i);if(!r1){I||=/\bprompt\b/i.test(o1),I&&/^```/.test(o1)&&(h=!0,k=!0);continue}h=!0,r1[1]?.trim()&&g.push(r1[1].trim());continue}if(/^(?:r[eé]glages?(?:\s+recommand[eé]s?)?|settings?|mod[eè]le|model)\s*:/i.test(o1))break;g.push(e1)}return V1(g.join(`
|
package/dist/wpic-ui.css
CHANGED
|
@@ -397,7 +397,8 @@ input[type="range"].slider-themed::-webkit-slider-thumb {
|
|
|
397
397
|
.wpic-theme .wpic-stat-card--featured .wpic-stat-card__label { margin-inline: calc(-1 * var(--wpic-card-padding-x)); padding: 0.75rem var(--wpic-card-padding-x); background: var(--wpic-accent); color: var(--wpic-on-accent); font-weight: 600; }
|
|
398
398
|
|
|
399
399
|
/* UI5 segmented options and teleported surfaces. */
|
|
400
|
-
|
|
400
|
+
/* Outrank the component's legacy dark/subtle rules, regardless of CSS order. */
|
|
401
|
+
.wpic-theme .wpic-segmented-control:is(.wpic-segmented-control--default, .wpic-segmented-control--subtle) { background: var(--wpic-raised); border: 0; padding: 3px; border-radius: 9px; gap: 2px; }
|
|
401
402
|
.wpic-theme .wpic-segmented-control .wpic-segmented-control__button { border: 0; border-radius: 6px; color: var(--wpic-muted); background: transparent; }
|
|
402
403
|
.wpic-theme .wpic-segmented-control .wpic-segmented-control__button:hover:not(:disabled) { color: var(--wpic-text); background: var(--wpic-border); }
|
|
403
404
|
.wpic-theme .wpic-segmented-control .wpic-segmented-control__button--active,
|
package/dist/wpic-ui.js
CHANGED
|
@@ -61,8 +61,8 @@ const $3 = {
|
|
|
61
61
|
n.loading ? (e(), l("span", $3, [
|
|
62
62
|
w(f(i2), {
|
|
63
63
|
size: (t.size ?? "md") === "xs" ? 10 : (t.size ?? "md") === "sm" ? 13 : (t.size ?? "md") === "lg" ? 17 : 15,
|
|
64
|
-
class:
|
|
65
|
-
}, null, 8, ["size"
|
|
64
|
+
class: "animate-spin"
|
|
65
|
+
}, null, 8, ["size"])
|
|
66
66
|
])) : m("", !0)
|
|
67
67
|
]),
|
|
68
68
|
_: 3
|
package/package.json
CHANGED
package/src/style.css
CHANGED
|
@@ -396,7 +396,8 @@ input[type="range"].slider-themed::-webkit-slider-thumb {
|
|
|
396
396
|
.wpic-theme .wpic-stat-card--featured .wpic-stat-card__label { margin-inline: calc(-1 * var(--wpic-card-padding-x)); padding: 0.75rem var(--wpic-card-padding-x); background: var(--wpic-accent); color: var(--wpic-on-accent); font-weight: 600; }
|
|
397
397
|
|
|
398
398
|
/* UI5 segmented options and teleported surfaces. */
|
|
399
|
-
|
|
399
|
+
/* Outrank the component's legacy dark/subtle rules, regardless of CSS order. */
|
|
400
|
+
.wpic-theme .wpic-segmented-control:is(.wpic-segmented-control--default, .wpic-segmented-control--subtle) { background: var(--wpic-raised); border: 0; padding: 3px; border-radius: 9px; gap: 2px; }
|
|
400
401
|
.wpic-theme .wpic-segmented-control .wpic-segmented-control__button { border: 0; border-radius: 6px; color: var(--wpic-muted); background: transparent; }
|
|
401
402
|
.wpic-theme .wpic-segmented-control .wpic-segmented-control__button:hover:not(:disabled) { color: var(--wpic-text); background: var(--wpic-border); }
|
|
402
403
|
.wpic-theme .wpic-segmented-control .wpic-segmented-control__button--active,
|