@wpic/ui 0.8.3 → 0.8.4
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 +6 -0
- package/dist/wpic-ui.cjs +1 -1
- package/dist/wpic-ui.css +1 -1
- package/dist/wpic-ui.js +459 -459
- package/package.json +1 -1
- package/src/style.css +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
## 0.8.4
|
|
2
|
+
|
|
3
|
+
- Make light-mode table borders opaque so their painted color stays identical before and during row hover.
|
|
4
|
+
- Paint the fixed-column separator inside the cell to prevent adjacent cells covering it.
|
|
5
|
+
- Compare outer borders, row separators and fixed-column edges pixel for pixel across hover states.
|
|
6
|
+
|
|
1
7
|
## 0.8.3
|
|
2
8
|
|
|
3
9
|
- Increase light-mode table border contrast against hovered rows. Share the stronger token across table card outlines, separators and fixed-column edges while retaining the dark-mode border color.
|
package/dist/wpic-ui.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),C=require("lucide-vue-next"),n1=require("@floating-ui/vue"),s0=require("pinia");var A1=typeof document<"u"?document.currentScript:null;const d0={key:0,class:"absolute inset-0 flex items-center justify-center rounded-[inherit]","aria-hidden":"true"},F1=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=>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",d0,[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"]))}}),u0={class:"wpic-button-group inline-flex"},x2=e.defineComponent({__name:"WButtonGroup",setup(n){return(d,t)=>(e.openBlock(),e.createElementBlock("div",u0,[e.renderSlot(d.$slots,"default")]))}}),m0={class:"wpic-filter flex items-center gap-1"},h0=["onClick"],p0=e.defineComponent({__name:"WFilter",props:{options:{},modelValue:{}},emits:["update:modelValue"],setup(n){return(d,t)=>(e.openBlock(),e.createElementBlock("div",m0,[(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,h0))),128))]))}}),v0={class:"wpic-form-label block mb-1 font-medium text-zinc-600 dark:text-zinc-400"},f0={key:0,class:"ml-0.5",style:{color:"#EF4444"}},a2=e.defineComponent({__name:"WFormLabel",props:{required:{type:Boolean}},setup(n){return(d,t)=>(e.openBlock(),e.createElementBlock("label",v0,[e.renderSlot(d.$slots,"default"),n.required?(e.openBlock(),e.createElementBlock("span",f0,"*")):e.createCommentVNode("",!0)]))}}),C0={class:"relative flex items-center w-full"},g0={key:1,class:"pointer-events-none absolute left-2.5 text-zinc-400 dark:text-zinc-500"},k0=["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"]),v=e.computed(()=>t.type==="money"?"number":t.type??"text"),p=e.ref();function c(){t.type==="date"&&p.value?.showPicker()}if(typeof document<"u"){const E="winput-date-no-picker";if(!document.getElementById(E)){const V=document.createElement("style");V.id=E,V.textContent='input[type="date"]::-webkit-calendar-picker-indicator { display: none; }',document.head.appendChild(V)}const y="winput-number-no-spinner";if(!document.getElementById(y)){const V=document.createElement("style");V.id=y,V.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(V)}}return(E,y)=>(e.openBlock(),e.createElementBlock("div",e.mergeProps(E.$attrs,{class:"w-full"}),[t.label?(e.openBlock(),e.createBlock(a2,{key:0,required:t.required},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.label),1)]),_:1},8,["required"])):e.createCommentVNode("",!0),e.createElementVNode("div",C0,[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",g0,[e.renderSlot(E.$slots,"prepend",{},()=>[e.createTextVNode(e.toDisplayString(t.prepend),1)])])):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("input",{ref_key:"inputRef",ref:p,class:e.normalizeClass(["wpic-control",["w-full rounded-lg outline-none transition-colors",t.size==="sm"?"text-sm":"text-base",v.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]=V=>d.value=V),type:v.value,placeholder:t.placeholder??"",disabled:t.disabled,required:t.required},null,10,k0),[[e.vModelDynamic,d.value]]),l.value?(e.openBlock(),e.createElementBlock("span",z0,[e.renderSlot(E.$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]=V=>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))}}),b0=["disabled"],l2=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,b0),[[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))}}),O1=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))}}),y0={key:0,class:"text-zinc-400 dark:text-zinc-500 whitespace-nowrap shrink-0"},x0={key:1,role:"status","aria-live":"polite",class:"flex items-center justify-center py-12 gap-3 text-base text-zinc-400 dark:text-zinc-500"},w0={class:"wpic-table__scroll",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:"wpic-table__header wpic-table__divider border-b border-zinc-100 dark:border-zinc-800"},S0=["onClick"],L0={key:1},D0={key:0,class:"wpic-table__summary wpic-table__divider border-b border-zinc-200 font-medium dark:border-zinc-700"},F0={key:0},$0={key:1},A0=["onClick"],T0=["onClick"],H0={key:0,class:"wpic-table__divider 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=["aria-label","disabled"],K0={key:0,class:"w-6 text-center text-base select-none text-zinc-400 dark:text-zinc-500"},O0=["onClick"],Y0=["aria-label","disabled"],q0=e.defineComponent({__name:"WTable",props:{data:{},columns:{},loading:{type:Boolean},loadingSpinner:{type:Boolean,default:!0},labels:{},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},padding:{},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(N){l.value.has(N)?l.value.delete(N):l.value.add(N)}const m=e.useSlots(),v=e.computed(()=>o.pageSize??25),p=e.ref(null),c=e.ref("asc");function E(N){p.value===N?c.value=c.value==="asc"?"desc":"asc":(p.value=N,c.value="asc")}const y=e.ref(""),V=e.computed(()=>o.columns.some(N=>N.searchable)),w=e.computed(()=>{let N=o.data??[];const X=y.value.trim().toLowerCase();if(X){const k=o.columns.filter(D=>D.searchable).map(D=>D.field);N=N.filter(D=>k.some(K=>String(D[K]??"").toLowerCase().includes(X)))}if(p.value){const k=p.value;N=[...N].sort((D,K)=>{const e1=D[k]??"",r1=K[k]??"",h1=typeof e1=="number"&&typeof r1=="number"?e1-r1:String(e1).toLowerCase().localeCompare(String(r1).toLowerCase());return c.value==="asc"?h1:-h1})}return N}),z=e.ref(1),f=e.computed(()=>o.serverTotal!==void 0),F=e.computed({get:()=>f.value?o.serverPage??1:z.value,set:N=>{f.value?s("update:serverPage",N):z.value=N}}),q=e.computed(()=>f.value?o.serverTotal??0:w.value.length),t1=e.computed(()=>Math.max(1,Math.ceil(q.value/v.value)));e.watch([y,()=>o.data],()=>{f.value||(F.value=1),l.value.clear()});const P=e.computed(()=>{if(f.value)return w.value;const N=(F.value-1)*v.value;return w.value.slice(N,N+v.value)});function Z(N,X){const k=N[o.rowKey];return typeof k=="string"||typeof k=="number"?k:`${F.value}:${X}`}const B=e.computed(()=>new Set(o.selectedKeys??[])),A=e.computed(()=>P.value.map(Z)),L=e.computed(()=>o.selectable&&A.value.length>0&&A.value.every(N=>B.value.has(N)));function M(N,X,k){const D=Z(N,X),K=new Set(o.selectedKeys??[]),e1=k===!0;e1?K.add(D):K.delete(D),s("update:selectedKeys",[...K]),s("row-select",N,e1)}function U(N){const X=new Set(o.selectedKeys??[]),k=N===!0;for(const D of A.value)k?X.add(D):X.delete(D);s("update:selectedKeys",[...X])}const O=e.computed(()=>q.value===0?0:(F.value-1)*v.value+1),i1=e.computed(()=>Math.min(F.value*v.value,q.value)),j=e.computed(()=>{const N=t1.value;if(N<=7)return Array.from({length:N},(e1,r1)=>r1+1);const X=F.value,k=[],D=new Set([1,N,X-1,X,X+1].filter(e1=>e1>=1&&e1<=N));let K=0;for(const e1 of[...D].sort((r1,h1)=>r1-h1))e1-K>1&&k.push("…"),k.push(e1),K=e1;return k}),J=e.computed(()=>o.padding?`wpic-table--padding-${o.padding}`:o.compact?"wpic-table--padding-sm":"wpic-table--padding-inherit"),W=N=>N==="right"?"text-right":N==="center"?"text-center":"text-left",l1=(N,X)=>[X,o.flushEdges&&N===0&&!o.expandable&&!o.selectable?"pl-0":"wpic-table__pad-l",o.flushEdges&&N===o.columns.length-1?"pr-0":"wpic-table__pad-r"],s1=N=>({...N.width?{width:N.width}:{},...N.minWidth?{minWidth:N.minWidth}:{}});return d({filteredCount:e.computed(()=>w.value.length),searchQuery:y}),(N,X)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["wpic-table",J.value])},[(V.value||e.unref(m).toolbar)&&!n.loading?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["flex items-center gap-2 wpic-table__divider border-b border-zinc-100 dark:border-zinc-800 wpic-table__pad-x",n.compact?"py-1":"py-2"])},[V.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(o2,{modelValue:y.value,"onUpdate:modelValue":X[0]||(X[0]=k=>y.value=k),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)+" "+e.toDisplayString(n.labels?.results??"results"),1)):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0),e.renderSlot(N.$slots,"toolbar")],2)):e.createCommentVNode("",!0),n.loading?(e.openBlock(),e.createElementBlock("div",x0,[n.loadingSpinner?(e.openBlock(),e.createBlock(O1,{key:0,tone:"muted"})):e.createCommentVNode("",!0),e.createElementVNode("span",null,e.toDisplayString(n.labels?.loading??"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,k=>(e.openBlock(),e.createElementBlock("col",{key:k.field,style:e.normalizeStyle(s1(k))},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(l2,{"model-value":L.value,onClick:X[1]||(X[1]=e.withModifiers(()=>{},["stop"])),"onUpdate:modelValue":U},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,(k,D)=>(e.openBlock(),e.createElementBlock("th",{key:k.field,class:e.normalizeClass([l1(D,n.compact?"py-1":"py-2"),"whitespace-nowrap text-zinc-500 dark:text-zinc-300 font-medium",W(k.align),D===0&&!n.expandable&&!n.selectable?"wpic-table__sticky sticky left-0 z-10":""]),style:e.normalizeStyle({...s1(k)})},[e.renderSlot(N.$slots,"th-"+k.field,{col:k,sortField:p.value,sortDir:c.value,toggleSort:E},()=>[k.sortable?(e.openBlock(),e.createElementBlock("button",{key:0,onClick:K=>E(k.field),class:e.normalizeClass(["inline-flex items-center gap-1 cursor-pointer transition-colors whitespace-nowrap",k.align==="right"?"ml-auto":""]),style:{color:"inherit"}},[e.createTextVNode(e.toDisplayString(k.label)+" ",1),p.value===k.field&&c.value==="asc"?(e.openBlock(),e.createBlock(e.unref(C.ChevronUp),{key:0,size:11,style:{color:"#5E6AD2"}})):p.value===k.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(k.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",D0,[n.selectable?(e.openBlock(),e.createElementBlock("td",F0)):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,(k,D)=>(e.openBlock(),e.createElementBlock("td",{key:k.field,class:e.normalizeClass([l1(D,n.compact?"py-1":"py-2.5"),W(k.align),D===0&&!n.expandable&&!n.selectable?"wpic-table__sticky sticky left-0 z-10 text-zinc-900 dark:text-zinc-100":"text-zinc-700 dark:text-zinc-200"])},[e.renderSlot(N.$slots,"summary-"+k.field,{row:n.summaryRow,value:n.summaryRow[k.field]},()=>[e.createTextVNode(e.toDisplayString(n.summaryRow[k.field]??"—"),1)])],2))),128))])):e.createCommentVNode("",!0),P.value.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(P.value,(k,D)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:D},[e.createElementVNode("tr",{class:e.normalizeClass(["wpic-table__row group wpic-table__divider border-b border-zinc-100 dark:border-zinc-800",[n.expandable&&l.value.has(D)?"border-b-0":"",n.rowClass?.(k)]]),style:e.normalizeStyle({cursor:n.rowClickable||n.expandable?"pointer":"default",...n.rowStyle?.(k)??{}}),onClick:K=>n.expandable?a(D):n.rowClickable&&s("row-click",k)},[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(l2,{"model-value":B.value.has(Z(k,D)),"onUpdate:modelValue":K=>M(k,D,K)},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(D)?(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,(K,e1)=>(e.openBlock(),e.createElementBlock("td",{key:K.field,class:e.normalizeClass([l1(e1,n.compact?"py-1":"py-2.5"),W(K.align),e1===0&&!n.expandable&&!n.selectable?"wpic-table__sticky sticky left-0 z-10 text-zinc-900 dark:text-zinc-100 font-medium":"text-zinc-700 dark:text-zinc-200"]),onClick:r1=>n.expandable?(n.rowClickable&&s("row-click",k),r1.stopPropagation()):void 0},[e.renderSlot(N.$slots,K.field,{row:k,value:k[K.field]},()=>[e.createTextVNode(e.toDisplayString(k[K.field]??"—"),1)])],10,T0))),128))],14,A0),n.expandable&&l.value.has(D)?(e.openBlock(),e.createElementBlock("tr",H0,[e.createElementVNode("td",{colspan:n.columns.length+(n.expandable?1:0)+(n.selectable?1:0),class:"wpic-table__pad-x pb-3 pt-0"},[e.renderSlot(N.$slots,"expand",{row:k})],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(N.$slots,"empty-icon"),e.createTextVNode(" "+e.toDisplayString(n.emptyText??"No data"),1)])],8,W0)]))]))])]),n.showFooter&&q.value>0?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["flex items-center justify-between wpic-table__divider border-t border-zinc-100 dark:border-zinc-800 wpic-table__pad-x",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(O.value)+"–"+e.toDisplayString(i1.value)+" "+e.toDisplayString(n.labels?.of??"of")+" "+e.toDisplayString(q.value),1)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(q.value)+" "+e.toDisplayString(q.value===1?n.labels?.item??"item":n.labels?.items??"items"),1)],64))]),t1.value>1?(e.openBlock(),e.createElementBlock("div",Z0,[e.createElementVNode("button",{"aria-label":n.labels?.previous??"Previous page",onClick:X[3]||(X[3]=k=>F.value--),disabled:F.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(j.value,k=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:k},[k==="…"?(e.openBlock(),e.createElementBlock("span",K0,"…")):(e.openBlock(),e.createElementBlock("button",{key:1,onClick:D=>F.value=k,class:e.normalizeClass(["h-7 min-w-7 px-2 rounded-md text-sm font-medium transition-colors cursor-pointer",F.value===k?"":"text-zinc-700 dark:text-zinc-200 hover:bg-zinc-100 dark:hover:bg-zinc-700"]),style:e.normalizeStyle(F.value===k?"background:rgba(94,106,210,0.1);color:#5E6AD2":void 0)},e.toDisplayString(k),15,O0))],64))),128)),e.createElementVNode("button",{"aria-label":n.labels?.next??"Next page",onClick:X[4]||(X[4]=k=>F.value++),disabled:F.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))],2))}}),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(x=>x.sticky)),v=e.ref(null),p=e.ref("asc"),c=e.ref(o.expanded??!1),E=e.ref(null),y=e.ref(null),V=e.ref(null),w=e.ref(null),z=e.ref(null);function f(){if(!o.downloadable)return;const x=S=>`"${String(S??"").replace(/"/g,'""')}"`,T=B.value.map(S=>o.columns.map(H=>x(P(S,H.key))).join(",")).join(`\r
|
|
2
|
-
`),$=new Blob([`\uFEFF${T}`],{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 F(x,T=!0){if(c.value===x)return;const $=performance.now();console.debug(`[WSpreadsheet] ${x?"expand":"minimize"} requested`),c.value=x,T&&s("update:expanded",x),requestAnimationFrame(()=>requestAnimationFrame(()=>{console.debug(`[WSpreadsheet] ${x?"expand":"minimize"} painted in ${(performance.now()-$).toFixed(1)}ms`)}))}e.watch(()=>o.expanded,x=>{x!=null&&F(x,!1)}),e.watch(()=>o.downloadRequest,(x,T)=>{x!=null&&x!==T&&f()}),d({expand:()=>{o.expandable&&F(!0)},collapse:()=>{F(!1)},toggleExpanded:()=>{o.expandable&&F(!c.value)},download:f});function q(x){x.key==="Escape"&&c.value&&F(!1)}function t1(x){if(x.target?.closest(".w-spreadsheet__cell")?.querySelector(".w-spreadsheet__input"))return;w.value=null,z.value=null;const G=document.activeElement;G&&E.value?.contains(G)&&G.blur()}e.onMounted(()=>{document.addEventListener("keydown",q),document.addEventListener("pointerdown",t1)}),e.onBeforeUnmount(()=>{document.removeEventListener("keydown",q),document.removeEventListener("pointerdown",t1),window.removeEventListener("pointerup",D)});function P(x,T){return x.cells.find($=>$.key===T)?.value??""}function Z(x){if(typeof x=="number")return x;const T=String(x).trim().replace(/[\s,]/g,"");return T!==""&&/^-?\d+(\.\d+)?$/.test(T)?Number(T):String(x).toLocaleLowerCase()}const B=e.computed(()=>{if(!v.value)return o.rows;const x=o.rows.filter(G=>G.sortable!==!1),T=p.value==="asc"?1:-1;x.sort((G,Q)=>{const S=Z(P(G,v.value)),H=Z(P(Q,v.value));return typeof S=="number"&&typeof H=="number"?(S-H)*T:String(S).localeCompare(String(H),void 0,{numeric:!0})*T});let $=0;return o.rows.map(G=>G.sortable===!1?G:x[$++])});function A(x){const T=o.columns.find($=>$.key===x.key);return!!(o.sortable&&x.variant==="header"&&T?.sortable!==!1)}function L(x){A(x)&&(v.value===x.key?p.value=p.value==="asc"?"desc":"asc":(v.value=x.key,p.value="asc"))}function M(x,T){return x.cells.slice(0,T).reduce(($,G)=>$+(G.colspan||1),0)}function U(x,T){return!!o.columns[M(x,T)]?.sticky}function O(x,T){const $=M(x,T);return!!(o.columns[$]?.sticky&&!o.columns.slice(0,$).some(G=>G.sticky))}function i1(x,T){const $=M(x,T);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 j(x,T){return`${x.key}\0${T.key}`}function J(x,T){!T.editable||y.value||(w.value={rowKey:x.key,cellKey:T.key},z.value=null)}function W(x,T){return w.value?.rowKey===x.key&&w.value?.cellKey===T.key}function l1(x,T,$){const G=B.value[x];!o.fillHandle||!$.editable||!G||!W(G,$)||(z.value=null,y.value={row:x,cell:T,value:String($.value??"")},V.value={row:x,cell:T},window.addEventListener("pointerup",D,{once:!0}))}function s1(x,T){y.value&&(V.value={row:x,cell:T})}function N(x,T){if(!y.value||!V.value)return!1;const $=Math.min(y.value.row,V.value.row),G=Math.max(y.value.row,V.value.row),Q=Math.min(y.value.cell,V.value.cell),S=Math.max(y.value.cell,V.value.cell);return x>=$&&x<=G&&T>=Q&&T<=S}function X(x,T){if(!N(x,T)||!y.value||!V.value)return{};const $=Math.min(y.value.row,V.value.row),G=Math.max(y.value.row,V.value.row),Q=Math.min(y.value.cell,V.value.cell),S=Math.max(y.value.cell,V.value.cell);return{"w-spreadsheet__cell--fill-range":!0,"w-spreadsheet__cell--fill-top":x===$,"w-spreadsheet__cell--fill-bottom":x===G,"w-spreadsheet__cell--fill-left":T===Q,"w-spreadsheet__cell--fill-right":T===S}}function k(x,T){const $=j(x,T);return{"w-spreadsheet__cell--fill-completed":!!z.value?.cells.has($),"w-spreadsheet__cell--fill-source":z.value?.source===$}}function D(){if(!y.value||!V.value)return;const x=y.value,T=V.value,$=Math.min(x.row,T.row),G=Math.max(x.row,T.row),Q=Math.min(x.cell,T.cell),S=Math.max(x.cell,T.cell),H=new Set,R=B.value[x.row],c1=R?.cells[x.cell];for(let p1=$;p1<=G;p1++){const x1=B.value[p1];if(x1)for(let B1=Q;B1<=S;B1++){const w1=x1.cells[B1];w1?.editable&&(H.add(j(x1,w1)),s("cell-change",{rowKey:x1.key,cellKey:w1.key,value:x.value,row:x1,cell:w1}))}}y.value=null,V.value=null,z.value=R&&c1?{cells:H,source:j(R,c1)}:null}function K(x){let T=x+1,$="";for(;T>0;)T-=1,$=String.fromCharCode(65+T%26)+$,T=Math.floor(T/26);return $}function e1(x){return[`w-spreadsheet__cell--${x.variant||"default"}`,`w-spreadsheet__cell--${x.align||"left"}`,`w-spreadsheet__cell--tone-${x.tone||"default"}`,{"w-spreadsheet__cell--wrap":!!x.wrap},x.class||""]}function r1(x,T,$){const G=$.target.value;s("cell-change",{rowKey:x.key,cellKey:T.key,value:G,row:x,cell:T})}function h1(x){const $=x.currentTarget.previousElementSibling;$?.focus(),$?.showPicker?.()}return(x,T)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"frameRef",ref:E,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:T[0]||(T[0]=$=>F(!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&&x.$slots["expanded-header"]?(e.openBlock(),e.createElementBlock("div",J0,[e.renderSlot(x.$slots,"expanded-header")])):e.createCommentVNode("",!0),x.$slots["toolbar-status"]?(e.openBlock(),e.createElementBlock("div",X0,[e.renderSlot(x.$slots,"toolbar-status")])):e.createCommentVNode("",!0),e.renderSlot(x.$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:f},[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:T[1]||(T[1]=$=>F(!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(O1),T[2]||(T[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||K(G)),1))),128))])])):e.createCommentVNode("",!0),e.createElementVNode("tbody",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(B.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,S)=>(e.openBlock(),e.createElementBlock("td",{key:Q.key,class:e.normalizeClass(["w-spreadsheet__cell",[e1(Q),{"w-spreadsheet__cell--sortable":A(Q),"w-spreadsheet__cell--sticky":U($,S),"w-spreadsheet__cell--sticky-first":O($,S),"w-spreadsheet__cell--active":W($,Q)},X(G,S),k($,Q)]]),colspan:Q.colspan||1,title:Q.title,style:e.normalizeStyle(i1($,S)),tabindex:A(Q)?0:void 0,onClick:H=>L(Q),onKeydown:[e.withKeys(e.withModifiers(H=>L(Q),["prevent"]),["enter"]),e.withKeys(e.withModifiers(H=>L(Q),["prevent"]),["space"])],onPointerenter:H=>s1(G,S),onPointerdown:H=>J($,Q)},[e.renderSlot(x.$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=>r1($,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:h1},[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))]),A(Q)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(v.value===Q.key?p.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&&W($,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=>l1(G,S,Q),["stop","prevent"])},null,40,r3)):e.createCommentVNode("",!0)],46,c3))),128))],2))),128))])],6)],6))])],2))}}),b1=(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 c2=b1(s3,[["render",u3]]),m3=["disabled"],L1=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))}}),w2={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 M2(n,d={}){const t={...w2[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-table-border":n==="light"?`color-mix(in srgb, ${t.border} 50%, ${t.borderHover})`:t.border,"--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 B2=Symbol("wpic-theme");function T1(){return e.inject(B2,e.computed(()=>null))}const p3=["data-wpic-theme"],y1=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=T1(),s=d,l=Symbol.for("wpic-ui-popover-descendants"),a=e.inject(l,null),m=new Set;e.provide(l,{add(M){m.add(M),a?.add(M)},remove(M){m.delete(M),a?.remove(M)}});const v=e.computed(()=>{const M=t.anchor;return M?e.isRef(M)?M.value:M:null}),p=e.ref(null),c=e.ref(null),E=e.computed(()=>c.value??t.placement??"bottom-start"),y=e.computed(()=>{const M=[n1.offset(t.offset??6)];return t.flip&&!c.value&&M.push(n1.flip()),M.push(n1.shift({padding:4})),M.push(n1.size({padding:8,apply({availableHeight:U,rects:O,elements:i1}){const j=Math.max(U-8,50),W={maxHeight:t.maxHeight?`min(${t.maxHeight}, ${j}px)`:`${j}px`,overflowY:t.panelScroll?"auto":"hidden"};if(t.height&&(W.height=`min(${t.height}, ${j}px)`),t.minHeight&&(W.minHeight=`min(${t.minHeight}, ${j}px)`),t.matchAnchorWidth){const l1=`${O.reference.width}px`;W.width=l1,W.minWidth=l1}Object.assign(i1.floating.style,W)}})),M}),{floatingStyles:V,placement:w,update:z,isPositioned:f}=n1.useFloating(v,p,{placement:E,strategy:"fixed",open:e.computed(()=>t.open),whileElementsMounted:n1.autoUpdate,middleware:y}),F=e.computed(()=>{const M=w.value;return M.startsWith("top")?"bottom":M.startsWith("bottom")?"top":M.startsWith("left")?"right":M.startsWith("right")?"left":"top"}),q=M=>{const U=M.target,O=v.value,i1=p.value;i1&&i1.contains(U)||[...m].some(j=>j.contains(U))||O&&O.contains(U)||t.extraPanels?.some(j=>j?.contains(U))||s("close")},t1=M=>{if(M.key!=="Escape"||!t.open||[...m].some(O=>O.isConnected&&O.style.display!=="none"))return;M.preventDefault(),M.stopImmediatePropagation(),s("close");const U=v.value;U?.matches("button, input, [tabindex]")?U.focus():U?.querySelector("button, input, [tabindex]")?.focus()};let P=!1,Z=!1;function B(){Z||(document.addEventListener("pointerdown",q,!0),document.addEventListener("keydown",t1,!0),Z=!0)}function A(){Z&&(document.removeEventListener("pointerdown",q,!0),document.removeEventListener("keydown",t1,!0),Z=!1)}e.watch(()=>t.open,M=>{M?e.nextTick(()=>{P||!t.open||(z(),B())}):(c.value=null,A())},{immediate:!0}),e.watch(p,(M,U)=>{U&&a?.remove(U),M&&a?.add(M)}),e.watch(f,M=>{M&&t.open&&t.freezePositionOnOpen&&!c.value&&(c.value=w.value)}),e.onBeforeUnmount(()=>{P=!0,A(),p.value&&a?.remove(p.value)});const L=e.computed(()=>({...t.matchAnchorWidth?{}:{width:t.width??"auto"},...t.minWidth?{minWidth:t.minWidth}:{},transformOrigin:F.value,zIndex:t.zIndex}));return(M,U)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body",class:"wpic-popover"},[e.withDirectives(e.createElementVNode("div",{ref_key:"floatingEl",ref:p,"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(V),L.value])},[e.renderSlot(M.$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"},k3={class:"truncate font-medium text-zinc-700 dark:text-zinc-200"},z3={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"},D3={class:"mb-2 flex h-7 items-center justify-between px-2 font-medium text-zinc-500 dark:text-zinc-400"},F3={class:"truncate"},$3=["title"],A3={class:"space-y-0.5"},T3={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"],k4=["src"],z4=["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"},D4={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"},F4=["onMousedown"],$4={class:"min-w-0 truncate font-medium text-zinc-900 dark:text-zinc-100"},A4={key:0,class:"max-w-32 shrink-0 truncate text-xs text-zinc-500 dark:text-zinc-400"},T4=["accept"],H4=["value","placeholder","disabled"],P4={class:"flex items-center justify-between px-2 pb-2"},j4=["disabled","title"],W4=["title"],R4=["disabled","title"],z2=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),v=e.ref(null),p=e.ref(null),c=e.ref(null),E=e.ref(0),y=e.ref(0),V=e.ref(!1),w=e.ref(null),z=e.ref(null);let f=null;const F=e.ref(!1),q=e.ref(!1),t1=e.ref(!1);e.ref(new Set);const P=e.ref(null),Z=e.ref(null),B=e.ref({}),A=e.ref(null);let L=null,M=null;function U(){M?.disconnect(),M=null;const r=a.value,i=p.value;if(!r||!i||typeof ResizeObserver>"u")return;const u=()=>i.style.setProperty("--wpic-chat-footer-height",`${r.getBoundingClientRect().height}px`);u(),M=new ResizeObserver(u),M.observe(r)}const O=e.computed(()=>A.value?[]:t.messages.filter(r=>r.role!=="system")),i1=e.computed(()=>t.loading||A.value!==null),j=e.computed(()=>t.modelValue.trim().length>0&&!t.loading),J=e.computed(()=>t.attachments.length>0),W=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}),l1=e.computed(()=>{const r=W.value;if(!r)return[];const i=r.query;return t.mentionItems.filter(u=>u.label.toLowerCase().includes(i)).slice(0,6)}),s1=e.computed(()=>t.showNavigator&&V.value),N=e.computed(()=>t.selectedProjectId??null),X=e.computed(()=>t.sessions.filter(r=>!r.projectId)),k=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 D(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 K(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 e1(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 b=h[1],I=D(b);!I||u.has(I)||(u.add(I),i.push({label:b,value:I}))}return i}function r1(r,i){return r.match(new RegExp(`${i}=["']([^"']+)["']`,"i"))?.[1]}function h1(r){const i={};for(const g of r.matchAll(/\[SETTING\s+([^\]]+)\]([\s\S]*?)\[\/SETTING\]/gi)){const h=g[1]??"",b=r1(h,"key"),I=r1(h,"value")??g[2]?.trim();if(!(!b||!I))if(b==="duration"||b==="fps"||b==="count"){const Y=Number(I);Number.isFinite(Y)&&(i[b]=Y)}else if(b==="model"){const Y=D(I)??D(g[2]?.trim()??"");Y&&(i.model=Y)}else(b==="aspect"||b==="resolution"||b==="format")&&(i[b]=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 b=g.split(":").slice(1).join(":").trim()||g,I=b.match(/\b(\d{1,2}:\d{1,2})\b/);(h.includes("format")||h.includes("aspect")||h.includes("ratio"))&&I&&(i.aspect=I[1]);const Y=b.match(/\b([1248]K)\b/i);(h.includes("résolution")||h.includes("resolution"))&&Y&&(i.resolution=Y[1].toUpperCase());const _=b.match(/\b(\d{1,3})\s*(?:s|sec|secondes?|seconds?)\b/i);(h.includes("durée")||h.includes("duration"))&&_&&(i.duration=Number(_[1]));const a1=b.match(/\b(\d{1,3})\s*fps\b/i);h.includes("fps")&&a1&&(i.fps=Number(a1[1]));const o1=b.match(/\b(\d{1,2})\b/);if((h.includes("count")||h.includes("nombre")||h.includes("variantes"))&&o1&&(i.count=Number(o1[1])),h.includes("modèle")||h.includes("modele")||h.includes("model")){const v1=D(b);v1&&(i.model=v1)}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 x(r){const i=r.match(/\[TASK(?:\s+([^\]]+))?\](?:([\s\S]*?)\[\/TASK\])?/i);if(i){const g=(r1(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(),b=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(b))return"audio";if(/\bvid[eé]o\b|\bvideo\b|\bfps\b|duration|dur[eé]e/.test(b))return"video";if(/\bimage\b|photo|visuel|illustration|aspect|ratio|resolution|résolution/.test(b))return"image";if(/\btext\b|texte|copy|caption|script/.test(b))return"text"}}}function T(r){const i=r.match(/\[PROMPT\]([\s\S]*?)\[\/PROMPT\]/i)?.[1];if(i){const _=B1(i).trim().replace(/^["“]|["”]$/g,"");if(_)return _}const u=r.replace(/\r\n/g,`
|
|
2
|
+
`),$=new Blob([`\uFEFF${T}`],{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 F(x,T=!0){if(c.value===x)return;const $=performance.now();console.debug(`[WSpreadsheet] ${x?"expand":"minimize"} requested`),c.value=x,T&&s("update:expanded",x),requestAnimationFrame(()=>requestAnimationFrame(()=>{console.debug(`[WSpreadsheet] ${x?"expand":"minimize"} painted in ${(performance.now()-$).toFixed(1)}ms`)}))}e.watch(()=>o.expanded,x=>{x!=null&&F(x,!1)}),e.watch(()=>o.downloadRequest,(x,T)=>{x!=null&&x!==T&&f()}),d({expand:()=>{o.expandable&&F(!0)},collapse:()=>{F(!1)},toggleExpanded:()=>{o.expandable&&F(!c.value)},download:f});function q(x){x.key==="Escape"&&c.value&&F(!1)}function t1(x){if(x.target?.closest(".w-spreadsheet__cell")?.querySelector(".w-spreadsheet__input"))return;w.value=null,z.value=null;const G=document.activeElement;G&&E.value?.contains(G)&&G.blur()}e.onMounted(()=>{document.addEventListener("keydown",q),document.addEventListener("pointerdown",t1)}),e.onBeforeUnmount(()=>{document.removeEventListener("keydown",q),document.removeEventListener("pointerdown",t1),window.removeEventListener("pointerup",D)});function P(x,T){return x.cells.find($=>$.key===T)?.value??""}function Z(x){if(typeof x=="number")return x;const T=String(x).trim().replace(/[\s,]/g,"");return T!==""&&/^-?\d+(\.\d+)?$/.test(T)?Number(T):String(x).toLocaleLowerCase()}const B=e.computed(()=>{if(!v.value)return o.rows;const x=o.rows.filter(G=>G.sortable!==!1),T=p.value==="asc"?1:-1;x.sort((G,Q)=>{const S=Z(P(G,v.value)),H=Z(P(Q,v.value));return typeof S=="number"&&typeof H=="number"?(S-H)*T:String(S).localeCompare(String(H),void 0,{numeric:!0})*T});let $=0;return o.rows.map(G=>G.sortable===!1?G:x[$++])});function A(x){const T=o.columns.find($=>$.key===x.key);return!!(o.sortable&&x.variant==="header"&&T?.sortable!==!1)}function L(x){A(x)&&(v.value===x.key?p.value=p.value==="asc"?"desc":"asc":(v.value=x.key,p.value="asc"))}function M(x,T){return x.cells.slice(0,T).reduce(($,G)=>$+(G.colspan||1),0)}function U(x,T){return!!o.columns[M(x,T)]?.sticky}function O(x,T){const $=M(x,T);return!!(o.columns[$]?.sticky&&!o.columns.slice(0,$).some(G=>G.sticky))}function i1(x,T){const $=M(x,T);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 j(x,T){return`${x.key}\0${T.key}`}function J(x,T){!T.editable||y.value||(w.value={rowKey:x.key,cellKey:T.key},z.value=null)}function W(x,T){return w.value?.rowKey===x.key&&w.value?.cellKey===T.key}function l1(x,T,$){const G=B.value[x];!o.fillHandle||!$.editable||!G||!W(G,$)||(z.value=null,y.value={row:x,cell:T,value:String($.value??"")},V.value={row:x,cell:T},window.addEventListener("pointerup",D,{once:!0}))}function s1(x,T){y.value&&(V.value={row:x,cell:T})}function N(x,T){if(!y.value||!V.value)return!1;const $=Math.min(y.value.row,V.value.row),G=Math.max(y.value.row,V.value.row),Q=Math.min(y.value.cell,V.value.cell),S=Math.max(y.value.cell,V.value.cell);return x>=$&&x<=G&&T>=Q&&T<=S}function X(x,T){if(!N(x,T)||!y.value||!V.value)return{};const $=Math.min(y.value.row,V.value.row),G=Math.max(y.value.row,V.value.row),Q=Math.min(y.value.cell,V.value.cell),S=Math.max(y.value.cell,V.value.cell);return{"w-spreadsheet__cell--fill-range":!0,"w-spreadsheet__cell--fill-top":x===$,"w-spreadsheet__cell--fill-bottom":x===G,"w-spreadsheet__cell--fill-left":T===Q,"w-spreadsheet__cell--fill-right":T===S}}function k(x,T){const $=j(x,T);return{"w-spreadsheet__cell--fill-completed":!!z.value?.cells.has($),"w-spreadsheet__cell--fill-source":z.value?.source===$}}function D(){if(!y.value||!V.value)return;const x=y.value,T=V.value,$=Math.min(x.row,T.row),G=Math.max(x.row,T.row),Q=Math.min(x.cell,T.cell),S=Math.max(x.cell,T.cell),H=new Set,R=B.value[x.row],c1=R?.cells[x.cell];for(let p1=$;p1<=G;p1++){const x1=B.value[p1];if(x1)for(let B1=Q;B1<=S;B1++){const w1=x1.cells[B1];w1?.editable&&(H.add(j(x1,w1)),s("cell-change",{rowKey:x1.key,cellKey:w1.key,value:x.value,row:x1,cell:w1}))}}y.value=null,V.value=null,z.value=R&&c1?{cells:H,source:j(R,c1)}:null}function K(x){let T=x+1,$="";for(;T>0;)T-=1,$=String.fromCharCode(65+T%26)+$,T=Math.floor(T/26);return $}function e1(x){return[`w-spreadsheet__cell--${x.variant||"default"}`,`w-spreadsheet__cell--${x.align||"left"}`,`w-spreadsheet__cell--tone-${x.tone||"default"}`,{"w-spreadsheet__cell--wrap":!!x.wrap},x.class||""]}function r1(x,T,$){const G=$.target.value;s("cell-change",{rowKey:x.key,cellKey:T.key,value:G,row:x,cell:T})}function h1(x){const $=x.currentTarget.previousElementSibling;$?.focus(),$?.showPicker?.()}return(x,T)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"frameRef",ref:E,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:T[0]||(T[0]=$=>F(!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&&x.$slots["expanded-header"]?(e.openBlock(),e.createElementBlock("div",J0,[e.renderSlot(x.$slots,"expanded-header")])):e.createCommentVNode("",!0),x.$slots["toolbar-status"]?(e.openBlock(),e.createElementBlock("div",X0,[e.renderSlot(x.$slots,"toolbar-status")])):e.createCommentVNode("",!0),e.renderSlot(x.$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:f},[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:T[1]||(T[1]=$=>F(!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(O1),T[2]||(T[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||K(G)),1))),128))])])):e.createCommentVNode("",!0),e.createElementVNode("tbody",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(B.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,S)=>(e.openBlock(),e.createElementBlock("td",{key:Q.key,class:e.normalizeClass(["w-spreadsheet__cell",[e1(Q),{"w-spreadsheet__cell--sortable":A(Q),"w-spreadsheet__cell--sticky":U($,S),"w-spreadsheet__cell--sticky-first":O($,S),"w-spreadsheet__cell--active":W($,Q)},X(G,S),k($,Q)]]),colspan:Q.colspan||1,title:Q.title,style:e.normalizeStyle(i1($,S)),tabindex:A(Q)?0:void 0,onClick:H=>L(Q),onKeydown:[e.withKeys(e.withModifiers(H=>L(Q),["prevent"]),["enter"]),e.withKeys(e.withModifiers(H=>L(Q),["prevent"]),["space"])],onPointerenter:H=>s1(G,S),onPointerdown:H=>J($,Q)},[e.renderSlot(x.$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=>r1($,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:h1},[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))]),A(Q)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(v.value===Q.key?p.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&&W($,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=>l1(G,S,Q),["stop","prevent"])},null,40,r3)):e.createCommentVNode("",!0)],46,c3))),128))],2))),128))])],6)],6))])],2))}}),b1=(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 c2=b1(s3,[["render",u3]]),m3=["disabled"],L1=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))}}),w2={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 M2(n,d={}){const t={...w2[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-table-border":n==="light"?`color-mix(in srgb, ${t.text} 11.5%, ${t.surface})`:t.border,"--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 B2=Symbol("wpic-theme");function T1(){return e.inject(B2,e.computed(()=>null))}const p3=["data-wpic-theme"],y1=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=T1(),s=d,l=Symbol.for("wpic-ui-popover-descendants"),a=e.inject(l,null),m=new Set;e.provide(l,{add(M){m.add(M),a?.add(M)},remove(M){m.delete(M),a?.remove(M)}});const v=e.computed(()=>{const M=t.anchor;return M?e.isRef(M)?M.value:M:null}),p=e.ref(null),c=e.ref(null),E=e.computed(()=>c.value??t.placement??"bottom-start"),y=e.computed(()=>{const M=[n1.offset(t.offset??6)];return t.flip&&!c.value&&M.push(n1.flip()),M.push(n1.shift({padding:4})),M.push(n1.size({padding:8,apply({availableHeight:U,rects:O,elements:i1}){const j=Math.max(U-8,50),W={maxHeight:t.maxHeight?`min(${t.maxHeight}, ${j}px)`:`${j}px`,overflowY:t.panelScroll?"auto":"hidden"};if(t.height&&(W.height=`min(${t.height}, ${j}px)`),t.minHeight&&(W.minHeight=`min(${t.minHeight}, ${j}px)`),t.matchAnchorWidth){const l1=`${O.reference.width}px`;W.width=l1,W.minWidth=l1}Object.assign(i1.floating.style,W)}})),M}),{floatingStyles:V,placement:w,update:z,isPositioned:f}=n1.useFloating(v,p,{placement:E,strategy:"fixed",open:e.computed(()=>t.open),whileElementsMounted:n1.autoUpdate,middleware:y}),F=e.computed(()=>{const M=w.value;return M.startsWith("top")?"bottom":M.startsWith("bottom")?"top":M.startsWith("left")?"right":M.startsWith("right")?"left":"top"}),q=M=>{const U=M.target,O=v.value,i1=p.value;i1&&i1.contains(U)||[...m].some(j=>j.contains(U))||O&&O.contains(U)||t.extraPanels?.some(j=>j?.contains(U))||s("close")},t1=M=>{if(M.key!=="Escape"||!t.open||[...m].some(O=>O.isConnected&&O.style.display!=="none"))return;M.preventDefault(),M.stopImmediatePropagation(),s("close");const U=v.value;U?.matches("button, input, [tabindex]")?U.focus():U?.querySelector("button, input, [tabindex]")?.focus()};let P=!1,Z=!1;function B(){Z||(document.addEventListener("pointerdown",q,!0),document.addEventListener("keydown",t1,!0),Z=!0)}function A(){Z&&(document.removeEventListener("pointerdown",q,!0),document.removeEventListener("keydown",t1,!0),Z=!1)}e.watch(()=>t.open,M=>{M?e.nextTick(()=>{P||!t.open||(z(),B())}):(c.value=null,A())},{immediate:!0}),e.watch(p,(M,U)=>{U&&a?.remove(U),M&&a?.add(M)}),e.watch(f,M=>{M&&t.open&&t.freezePositionOnOpen&&!c.value&&(c.value=w.value)}),e.onBeforeUnmount(()=>{P=!0,A(),p.value&&a?.remove(p.value)});const L=e.computed(()=>({...t.matchAnchorWidth?{}:{width:t.width??"auto"},...t.minWidth?{minWidth:t.minWidth}:{},transformOrigin:F.value,zIndex:t.zIndex}));return(M,U)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body",class:"wpic-popover"},[e.withDirectives(e.createElementVNode("div",{ref_key:"floatingEl",ref:p,"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(V),L.value])},[e.renderSlot(M.$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"},k3={class:"truncate font-medium text-zinc-700 dark:text-zinc-200"},z3={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"},D3={class:"mb-2 flex h-7 items-center justify-between px-2 font-medium text-zinc-500 dark:text-zinc-400"},F3={class:"truncate"},$3=["title"],A3={class:"space-y-0.5"},T3={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"],k4=["src"],z4=["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"},D4={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"},F4=["onMousedown"],$4={class:"min-w-0 truncate font-medium text-zinc-900 dark:text-zinc-100"},A4={key:0,class:"max-w-32 shrink-0 truncate text-xs text-zinc-500 dark:text-zinc-400"},T4=["accept"],H4=["value","placeholder","disabled"],P4={class:"flex items-center justify-between px-2 pb-2"},j4=["disabled","title"],W4=["title"],R4=["disabled","title"],z2=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),v=e.ref(null),p=e.ref(null),c=e.ref(null),E=e.ref(0),y=e.ref(0),V=e.ref(!1),w=e.ref(null),z=e.ref(null);let f=null;const F=e.ref(!1),q=e.ref(!1),t1=e.ref(!1);e.ref(new Set);const P=e.ref(null),Z=e.ref(null),B=e.ref({}),A=e.ref(null);let L=null,M=null;function U(){M?.disconnect(),M=null;const r=a.value,i=p.value;if(!r||!i||typeof ResizeObserver>"u")return;const u=()=>i.style.setProperty("--wpic-chat-footer-height",`${r.getBoundingClientRect().height}px`);u(),M=new ResizeObserver(u),M.observe(r)}const O=e.computed(()=>A.value?[]:t.messages.filter(r=>r.role!=="system")),i1=e.computed(()=>t.loading||A.value!==null),j=e.computed(()=>t.modelValue.trim().length>0&&!t.loading),J=e.computed(()=>t.attachments.length>0),W=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}),l1=e.computed(()=>{const r=W.value;if(!r)return[];const i=r.query;return t.mentionItems.filter(u=>u.label.toLowerCase().includes(i)).slice(0,6)}),s1=e.computed(()=>t.showNavigator&&V.value),N=e.computed(()=>t.selectedProjectId??null),X=e.computed(()=>t.sessions.filter(r=>!r.projectId)),k=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 D(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 K(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 e1(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 b=h[1],I=D(b);!I||u.has(I)||(u.add(I),i.push({label:b,value:I}))}return i}function r1(r,i){return r.match(new RegExp(`${i}=["']([^"']+)["']`,"i"))?.[1]}function h1(r){const i={};for(const g of r.matchAll(/\[SETTING\s+([^\]]+)\]([\s\S]*?)\[\/SETTING\]/gi)){const h=g[1]??"",b=r1(h,"key"),I=r1(h,"value")??g[2]?.trim();if(!(!b||!I))if(b==="duration"||b==="fps"||b==="count"){const Y=Number(I);Number.isFinite(Y)&&(i[b]=Y)}else if(b==="model"){const Y=D(I)??D(g[2]?.trim()??"");Y&&(i.model=Y)}else(b==="aspect"||b==="resolution"||b==="format")&&(i[b]=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 b=g.split(":").slice(1).join(":").trim()||g,I=b.match(/\b(\d{1,2}:\d{1,2})\b/);(h.includes("format")||h.includes("aspect")||h.includes("ratio"))&&I&&(i.aspect=I[1]);const Y=b.match(/\b([1248]K)\b/i);(h.includes("résolution")||h.includes("resolution"))&&Y&&(i.resolution=Y[1].toUpperCase());const _=b.match(/\b(\d{1,3})\s*(?:s|sec|secondes?|seconds?)\b/i);(h.includes("durée")||h.includes("duration"))&&_&&(i.duration=Number(_[1]));const a1=b.match(/\b(\d{1,3})\s*fps\b/i);h.includes("fps")&&a1&&(i.fps=Number(a1[1]));const o1=b.match(/\b(\d{1,2})\b/);if((h.includes("count")||h.includes("nombre")||h.includes("variantes"))&&o1&&(i.count=Number(o1[1])),h.includes("modèle")||h.includes("modele")||h.includes("model")){const v1=D(b);v1&&(i.model=v1)}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 x(r){const i=r.match(/\[TASK(?:\s+([^\]]+))?\](?:([\s\S]*?)\[\/TASK\])?/i);if(i){const g=(r1(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(),b=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(b))return"audio";if(/\bvid[eé]o\b|\bvideo\b|\bfps\b|duration|dur[eé]e/.test(b))return"video";if(/\bimage\b|photo|visuel|illustration|aspect|ratio|resolution|résolution/.test(b))return"image";if(/\btext\b|texte|copy|caption|script/.test(b))return"text"}}}function T(r){const i=r.match(/\[PROMPT\]([\s\S]*?)\[\/PROMPT\]/i)?.[1];if(i){const _=B1(i).trim().replace(/^["“]|["”]$/g,"");if(_)return _}const u=r.replace(/\r\n/g,`
|
|
3
3
|
`).split(`
|
|
4
4
|
`),g=[];let h=!1,b=!1,I=!1;for(const _ of u){const a1=_.trim().replace(/^[\s>*-]+/,"").replace(/^#{1,6}\s+/,"").replace(/^\*\*|\*\*$/g,"").trim();if(b){if(/^```/.test(a1))break;g.push(_);continue}if(!h){const o1=a1.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(!o1){I||=/\bprompt\b/i.test(a1),I&&/^```/.test(a1)&&(h=!0,b=!0);continue}h=!0,o1[1]?.trim()&&g.push(o1[1].trim());continue}if(/^(?:r[eé]glages?(?:\s+recommand[eé]s?)?|settings?|mod[eè]le|model)\s*:/i.test(a1))break;g.push(_)}return B1(g.join(`
|
|
5
5
|
`)).trim().replace(/^["“]|["”]$/g,"")||void 0}function $(r){return/\[PROMPT\]([\s\S]*?)\[\/PROMPT\]/i.test(r)}function G(r){return/\[TASK(?:\s+[^\]]+)?\]/i.test(r)}function Q(r){const i=r.match(/\[TASK(?:\s+([^\]]+))?\]([\s\S]*?)\[\/TASK\]/i),u=`${i?.[1]??""} ${i?.[2]??""}`.toLowerCase();return $(r)&&(/\bimage\b/.test(u)||!G(r))}function S(r){return/\[(?:TASK|PROMPT|SETTING)\b/i.test(r)}function H(r){const i=g=>Array.isArray(g)?g.flatMap(h=>{if(!h||typeof h!="object")return[];const b=h,I=typeof b.url=="string"?b.url:null;return I?[{type:typeof b.type=="string"?b.type:"image",url:I,posterUrl:typeof b.posterUrl=="string"?b.posterUrl:null,width:typeof b.width=="number"?b.width:null,height:typeof b.height=="number"?b.height:null,generationId:typeof b.generationId=="string"?b.generationId:null,href:typeof b.href=="string"?b.href:null}]:[]}):[],u=r.metadata?.generatedMedia;return i(u).filter(g=>g.type==="image"||!g.type)}function R(r){const i=r.metadata?.attachments;return Array.isArray(i)?i.flatMap((u,g)=>{if(!u||typeof u!="object")return[];const h=u,b=h.metadata&&typeof h.metadata=="object"?h.metadata:{},I=typeof h.name=="string"&&h.name.trim()?h.name.trim():`Attachment ${g+1}`;return[{id:typeof h.id=="string"?h.id:`${r.id??"message"}-attachment-${g}`,name:I,mimeType:typeof h.mimeType=="string"?h.mimeType:null,bytes:typeof h.bytes=="number"?h.bytes:null,status:"ready",displayUrl:typeof h.displayUrl=="string"?h.displayUrl:typeof b.displayUrl=="string"?b.displayUrl:null,publicUrl:typeof h.publicUrl=="string"?h.publicUrl:typeof b.publicUrl=="string"?b.publicUrl:null,assetId:typeof h.assetId=="string"?h.assetId:null,mediaItemId:typeof h.mediaItemId=="string"?h.mediaItemId:null,metadata:b}]}):[]}function c1(r){const i=r.metadata&&typeof r.metadata=="object"?r.metadata:{},u=r.mimeType??"",g=typeof i.kind=="string"?i.kind:"",h=r.displayUrl??(typeof i.displayUrl=="string"?i.displayUrl:null);return!h||!u.startsWith("image/")&&g!=="image"?null:h}function p1(r){if(r.role!=="assistant"||!r.streaming)return!1;const i=r.content.trim();return i==="Generating image..."||S(i)}function x1(r){return r.replace(/\[PROMPT\]([\s\S]*?)\[\/PROMPT\]/gi,"$1").replace(/\[SETTING\s+[^\]]*\]([\s\S]*?)\[\/SETTING\]/gi,"$1").replace(/\[TASK(?:\s+[^\]]*)?\]([\s\S]*?)\[\/TASK\]/gi,"").replace(/^\s*\[TASK(?:\s+[^\]]*)?\]\s*$/gim,"")}function B1(r){return r.replace(/\[PROMPT\]|\[\/PROMPT\]/gi,"").replace(/\[SETTING\s+[^\]]*\]|\[\/SETTING\]/gi,"").replace(/\[TASK\s+[^\]]*\]|\[\/TASK\]/gi,"").split(`
|
package/dist/wpic-ui.css
CHANGED
|
@@ -452,7 +452,7 @@ input[type="range"].slider-themed::-webkit-slider-thumb {
|
|
|
452
452
|
.wpic-table__row:hover { background: var(--wpic-raised, var(--bg-input)); }
|
|
453
453
|
.wpic-table__sticky {
|
|
454
454
|
background: inherit;
|
|
455
|
-
box-shadow: 1px 0 0 var(--wpic-table-border, var(--border-strong));
|
|
455
|
+
box-shadow: inset -1px 0 0 var(--wpic-table-border, var(--border-strong));
|
|
456
456
|
}
|
|
457
457
|
|
|
458
458
|
/* Match row separators to the enclosing themed card in both modes. */
|