@wpic/ui 0.9.49 → 0.9.50
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/dist/components/WPopover.vue.d.ts +2 -0
- package/dist/wpic-ui.cjs +1 -1
- package/dist/wpic-ui.css +1 -1
- package/dist/wpic-ui.js +4 -2
- package/package.json +1 -1
- package/src/style.css +1 -1
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"),k=require("lucide-vue-next"),i1=require("@floating-ui/vue"),g0=require("pinia"),J1=require("@tiptap/vue-3"),k0=require("@tiptap/extension-document"),C0=require("@tiptap/extension-paragraph"),z0=require("@tiptap/extension-text"),y0=require("@tiptap/extension-character-count"),x0=require("@tiptap/starter-kit"),B0=require("@tiptap/extension-placeholder");var P1=typeof document<"u"?document.currentScript:null;const M0={key:0,class:"wpic:absolute wpic:inset-0 wpic:flex wpic:items-center wpic:justify-center wpic:rounded-[inherit]","aria-hidden":"true"},x1=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:p}){const t=n,l=p;return(r,c)=>(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:c[0]||(c[0]=i=>l("click",i)),class:e.normalizeClass(["wpic-button","wpic:relative wpic:inline-flex wpic:items-center wpic:justify-center wpic:font-medium wpic:transition-all wpic:duration-150 wpic:cursor-pointer wpic:select-none","wpic:focus-visible:outline-none wpic:focus-visible:ring-2 wpic:focus-visible:ring-indigo-500/50 wpic:focus-visible:ring-offset-1",t.variant==="ghost-transparent"?"wpic:active:scale-95":"wpic:active:scale-[0.98]",n.disabled||n.loading?"wpic:opacity-40 wpic:cursor-not-allowed wpic:pointer-events-none":"",n.active&&!["text","ghost-transparent"].includes(t.variant??"")?"wpic-button--active":"",(t.size??"md")==="sm"?"wpic:h-8 wpic:touch-manipulation wpic:px-2.5 wpic:gap-1.5 wpic:rounded-md wpic:text-sm":"",(t.size??"md")==="md"?(t.variant==="subtle"?"wpic:h-11":"wpic:h-9")+" wpic:px-3.5 wpic:gap-2 wpic:rounded-lg":"",(t.size??"md")==="lg"?(t.variant==="subtle"?"wpic:h-12":"wpic:h-11")+" wpic:px-4 wpic:gap-2 wpic:rounded-lg":"",(t.size??"md")==="xs"?"wpic:h-5 wpic:w-5 wpic:p-0 wpic:rounded-full wpic:text-xs":"",t.variant==="text"?n.active?"wpic:bg-transparent wpic:text-indigo-600 wpic:dark:text-indigo-400":"wpic:bg-transparent wpic:text-zinc-500 wpic:hover:text-zinc-600 wpic:dark:text-zinc-500 wpic:dark:hover:text-zinc-400":"",(t.variant??"primary")==="primary"?"wpic-btn-primary wpic:text-white":"",(t.variant??"primary")==="secondary"?"wpic:bg-zinc-100 wpic:hover:bg-zinc-200 wpic:text-zinc-700 wpic:dark:bg-zinc-800 wpic:dark:hover:bg-zinc-700 wpic:dark:text-zinc-200":"",(t.variant??"primary")==="subtle"?"wpic:bg-zinc-100 wpic:border wpic:border-zinc-100 wpic:hover:bg-zinc-200/70 wpic:text-zinc-700 wpic:dark:bg-zinc-800 wpic:dark:border-zinc-800 wpic:dark:hover:bg-zinc-700 wpic:dark:text-zinc-200":"",(t.variant??"primary")==="destructive"?"wpic:bg-red-500 wpic:hover:bg-red-600 wpic:text-white":"",(t.variant??"primary")==="ghost"?"wpic:bg-transparent wpic:hover:bg-zinc-100 wpic:text-zinc-600 wpic:hover:text-zinc-900 wpic:dark:hover:bg-zinc-800 wpic:dark:text-zinc-400 wpic:dark:hover:text-zinc-100":"",t.variant==="ghost-transparent"?n.active?"wpic:bg-transparent wpic:hover:bg-[#80808026] wpic:text-indigo-600 wpic:dark:text-indigo-400":"wpic:bg-transparent wpic:hover:bg-[#80808026] wpic:text-zinc-500 wpic:dark:text-zinc-500":"",t.variant==="ghost-transparent"&&!n.active&&!n.disabled&&!n.loading?"wpic:opacity-60 wpic:hover:opacity-100 wpic:focus-visible:opacity-100":"",(t.variant??"primary")==="outline"?"wpic:bg-transparent wpic:border wpic:border-zinc-200 wpic:hover:bg-zinc-50 wpic:text-zinc-700 wpic:dark:border-zinc-800 wpic:dark:hover:bg-zinc-800 wpic:dark:text-zinc-300":""])},{default:e.withCtx(()=>[e.createElementVNode("span",{class:e.normalizeClass(["wpic:inline-flex wpic:items-center wpic:justify-center wpic:gap-[inherit]",n.loading?"wpic: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(r.$slots,"default")],2),n.loading?(e.openBlock(),e.createElementBlock("span",M0,[e.createVNode(e.unref(k.Loader2),{size:(t.size??"md")==="xs"?10:(t.size??"md")==="sm"?13:(t.size??"md")==="lg"?17:15,class:"wpic:animate-spin"},null,8,["size"])])):e.createCommentVNode("",!0)]),_:3},8,["href","disabled","data-variant","data-size","data-active","class"]))}}),V0={class:"wpic-button-group wpic:inline-flex"},$2=e.defineComponent({__name:"WButtonGroup",setup(n){return(p,t)=>(e.openBlock(),e.createElementBlock("div",V0,[e.renderSlot(p.$slots,"default")]))}}),E0={class:"wpic-filter wpic:flex wpic:items-center wpic:gap-1"},N0=["onClick"],S0=e.defineComponent({__name:"WFilter",props:{options:{},modelValue:{}},emits:["update:modelValue"],setup(n){return(p,t)=>(e.openBlock(),e.createElementBlock("div",E0,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.options,(l,r)=>(e.openBlock(),e.createElementBlock("button",{key:r,type:"button",onClick:c=>p.$emit("update:modelValue",l.value),class:e.normalizeClass(["wpic:px-2.5 wpic:py-1 wpic:text-base wpic:font-medium wpic:rounded-full wpic:transition-all wpic:duration-150 wpic:cursor-pointer wpic:whitespace-nowrap",n.modelValue===l.value?"wpic:bg-zinc-100 wpic:dark:bg-zinc-800 wpic:text-zinc-900 wpic:dark:text-zinc-100 wpic:border wpic:border-zinc-300 wpic:dark:border-zinc-600":"wpic:text-zinc-400 wpic:dark:text-zinc-500 wpic:hover:text-zinc-600 wpic:dark:hover:text-zinc-300 wpic:border wpic:border-transparent"])},e.toDisplayString(l.label),11,N0))),128))]))}}),L0={class:"wpic-form-label wpic:block wpic:mb-1 wpic:font-medium wpic:text-zinc-600 wpic:dark:text-zinc-400"},$0={key:0,class:"wpic:ml-0.5",style:{color:"#EF4444"}},w2=e.defineComponent({__name:"WFormLabel",props:{required:{type:Boolean}},setup(n){return(p,t)=>(e.openBlock(),e.createElementBlock("label",L0,[e.renderSlot(p.$slots,"default"),n.required?(e.openBlock(),e.createElementBlock("span",$0,"*")):e.createCommentVNode("",!0)]))}}),D0={class:"wpic:relative wpic:flex wpic:items-center wpic:w-full"},F0=["data-size","data-variant","type","placeholder","disabled","required"],T0={key:2,class:"wpic:pointer-events-none wpic:absolute wpic:right-2.5 wpic:text-zinc-400 wpic:dark:text-zinc-500"},u2=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 p=e.useModel(n,"modelValue"),t=n,l=e.useSlots(),r=e.computed(()=>t.prepend!==void 0||!!l.prepend),c=e.computed(()=>t.append!==void 0||!!l.append),i=e.computed(()=>{if(t.icon)return t.icon;if(t.type==="date")return k.Calendar;if(t.type==="money")return k.DollarSign}),w=e.computed(()=>({sm:12,md:13,lg:14,xl:16})[t.size??"md"]),u=e.computed(()=>t.type==="money"?"number":t.type??"text"),C=e.ref(),a=e.ref(),M=e.ref(0);let g;e.watch(a,V=>{g?.disconnect(),M.value=V?.getBoundingClientRect().width??0,V&&(g=new ResizeObserver(()=>{M.value=V.getBoundingClientRect().width}),g.observe(V))},{flush:"post"}),e.onBeforeUnmount(()=>g?.disconnect());function y(){t.type==="date"&&C.value?.showPicker()}if(typeof document<"u"){const V="winput-date-no-picker";if(!document.getElementById(V)){const f=document.createElement("style");f.id=V,f.textContent='input[type="date"]::-webkit-calendar-picker-indicator { display: none; }',document.head.appendChild(f)}const b="winput-number-no-spinner";if(!document.getElementById(b)){const f=document.createElement("style");f.id=b,f.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(f)}}return(V,b)=>(e.openBlock(),e.createElementBlock("div",e.mergeProps(V.$attrs,{class:"wpic:w-full"}),[t.label?(e.openBlock(),e.createBlock(w2,{key:0,required:t.required},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.label),1)]),_:1},8,["required"])):e.createCommentVNode("",!0),e.createElementVNode("div",D0,[i.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(i.value),{key:0,size:w.value,class:e.normalizeClass(["wpic:absolute wpic:shrink-0 wpic:text-zinc-400 wpic:dark:text-zinc-500",[t.size==="xl"?"wpic:left-4":"wpic:left-2.5",t.type==="date"?"wpic:cursor-pointer":"wpic:pointer-events-none"]]),onClick:y},null,8,["size","class"])):r.value?(e.openBlock(),e.createElementBlock("span",{key:1,ref_key:"prependRef",ref:a,class:"wpic:pointer-events-none wpic:absolute wpic:left-2.5 wpic:text-zinc-400 wpic:dark:text-zinc-500"},[e.renderSlot(V.$slots,"prepend",{},()=>[e.createTextVNode(e.toDisplayString(t.prepend),1)])],512)):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("input",{ref_key:"inputRef",ref:C,class:e.normalizeClass(["wpic-control",["wpic:w-full wpic:rounded-lg wpic:outline-none wpic:transition-colors",t.size==="sm"?"wpic:text-sm":"wpic:text-base",u.value==="number"?"winput-number":"",t.size==="sm"?"wpic:h-8":t.size==="lg"?"wpic:h-11":t.size==="xl"?"wpic:h-14":"wpic:h-9",i.value||r.value?t.size==="xl"?"wpic:pl-11":"wpic:pl-9":t.size==="xl"?"wpic:pl-4":"wpic:pl-2.5",c.value&&(t.clearable&&p.value||t.loading)?"wpic:pr-14":c.value?"wpic:pr-9":t.clearable&&p.value||t.loading?t.size==="xl"?"wpic:pr-10":"wpic:pr-7":t.size==="xl"?"wpic:pr-4":"wpic:pr-2.5",t.variant==="plain"?"wpic:bg-transparent wpic:border-0 wpic:text-zinc-900 wpic:dark:text-zinc-100 wpic:placeholder:text-zinc-400 wpic:focus-visible:ring-1 wpic:focus-visible:ring-current wpic:disabled:opacity-60 wpic:disabled:cursor-not-allowed":t.disabled?(t.variant??"default")==="subtle"?"wpic:bg-zinc-100 wpic:dark:bg-zinc-800 wpic:border wpic:border-zinc-100 wpic:dark:border-zinc-800 wpic:text-zinc-400 wpic:dark:text-zinc-500 wpic:cursor-not-allowed wpic:opacity-60":"wpic:bg-zinc-50 wpic:dark:bg-zinc-800 wpic:border wpic:border-zinc-200 wpic:dark:border-zinc-800 wpic:text-zinc-400 wpic:dark:text-zinc-500 wpic:cursor-not-allowed wpic:opacity-60":(t.variant??"default")==="subtle"?"wpic:bg-zinc-100 wpic:dark:bg-zinc-800 wpic:border wpic:border-zinc-100 wpic:dark:border-zinc-800 wpic:text-zinc-900 wpic:dark:text-zinc-100 wpic:placeholder:text-zinc-400 wpic:dark:placeholder:text-zinc-500 wpic:cursor-text wpic:hover:bg-zinc-200/70 wpic:dark:hover:bg-zinc-700":"wpic:bg-white wpic:dark:bg-zinc-900 wpic:border wpic:border-zinc-200 wpic:dark:border-zinc-800 wpic:text-zinc-900 wpic:dark:text-zinc-100 wpic:placeholder:text-zinc-400 wpic:dark:placeholder:text-zinc-500 wpic-input-field wpic:cursor-text"]]),style:e.normalizeStyle(r.value&&!i.value?{paddingLeft:`calc(${M.value}px + 1.25rem)`}:void 0),"data-size":t.size??"md","data-variant":t.variant??"default","onUpdate:modelValue":b[0]||(b[0]=f=>p.value=f),type:u.value,placeholder:t.placeholder??"",disabled:t.disabled,required:t.required},null,14,F0),[[e.vModelDynamic,p.value]]),c.value?(e.openBlock(),e.createElementBlock("span",T0,[e.renderSlot(V.$slots,"append",{},()=>[e.createTextVNode(e.toDisplayString(t.append),1)])])):e.createCommentVNode("",!0),t.loading?(e.openBlock(),e.createBlock(e.unref(k.Loader2),{key:3,size:t.size==="xl"?14:11,class:e.normalizeClass(["wpic:absolute wpic:animate-spin wpic:text-zinc-400 wpic:dark:text-zinc-500",c.value?"wpic:right-8":t.size==="xl"?"wpic:right-4":"wpic:right-2"])},null,8,["size","class"])):t.clearable&&p.value?(e.openBlock(),e.createElementBlock("button",{key:4,type:"button",onClick:b[1]||(b[1]=f=>p.value=""),class:e.normalizeClass(["wpic:absolute wpic:flex wpic:items-center wpic:justify-center wpic:text-zinc-400 wpic:hover:text-zinc-600 wpic:dark:hover:text-zinc-300 wpic:transition-colors wpic:cursor-pointer",c.value?"wpic:right-8":t.size==="xl"?"wpic:right-4":"wpic:right-2"])},[e.createVNode(e.unref(k.X),{size:t.size==="xl"?14:11},null,8,["size"])],2)):e.createCommentVNode("",!0)])],16))}}),A0=["disabled"],p2=e.defineComponent({__name:"WCheckbox",props:e.mergeModels({disabled:{type:Boolean}},{modelValue:{type:Boolean},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const p=e.useModel(n,"modelValue");return(t,l)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(["wpic-checkbox wpic:relative wpic:inline-flex wpic:items-center wpic:gap-2 wpic:select-none",n.disabled?"wpic:cursor-not-allowed wpic:opacity-50":"wpic:cursor-pointer"])},[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":l[0]||(l[0]=r=>p.value=r),disabled:n.disabled,class:"wpic:peer wpic:sr-only"},null,8,A0),[[e.vModelCheckbox,p.value]]),e.createElementVNode("span",{class:e.normalizeClass(["wpic-checkbox-box",["wpic:flex wpic:h-4 wpic:w-4 wpic:shrink-0 wpic:items-center wpic:justify-center wpic:rounded-[4px] wpic:border wpic:transition-all wpic:duration-150","wpic:peer-focus-visible:ring-2 wpic:peer-focus-visible:ring-zinc-400/40 wpic:peer-focus-visible:ring-offset-1 wpic:peer-focus-visible:ring-offset-white wpic:dark:peer-focus-visible:ring-offset-zinc-950",p.value?"wpic:border-zinc-900 wpic:bg-zinc-900 wpic:text-white wpic:dark:border-zinc-100 wpic:dark:bg-zinc-100 wpic:dark:text-zinc-950":"wpic:border-zinc-300 wpic:bg-white wpic:text-transparent wpic:shadow-sm wpic:hover:border-zinc-400 wpic:dark:border-zinc-700 wpic:dark:bg-zinc-900 wpic:dark:hover:border-zinc-500"]])},[e.createVNode(e.unref(k.Check),{size:11,"stroke-width":"2.6"})],2),e.renderSlot(t.$slots,"default")],2))}}),G1=e.defineComponent({__name:"WSpinner",props:{size:{default:"md"},tone:{default:"muted"}},setup(n){const p=n,t={sm:"wpic:h-4 wpic:w-4 wpic:border-2",md:"wpic:h-5 wpic:w-5 wpic:border-2",lg:"wpic:h-7 wpic:w-7 wpic:border-[3px]"};return(l,r)=>(e.openBlock(),e.createElementBlock("span",{role:"status","aria-live":"polite","aria-label":"Loading",class:e.normalizeClass(["wpic-spinner","wpic:inline-block wpic:shrink-0 wpic:animate-spin wpic:rounded-full wpic:border-current wpic:border-t-transparent",t[p.size],p.tone==="muted"?"wpic:text-zinc-300 wpic:dark:text-zinc-700":"wpic:text-[var(--wpic-primary,#6366f1)]"])},null,2))}}),H0={key:0,class:"wpic:text-zinc-400 wpic:dark:text-zinc-500 wpic:whitespace-nowrap wpic:shrink-0"},P0={key:1,role:"status","aria-live":"polite",class:"wpic:flex wpic:items-center wpic:justify-center wpic:py-12 wpic:gap-3 wpic:text-base wpic:text-zinc-400 wpic:dark:text-zinc-500"},j0={class:"wpic-table__scroll",style:{"overflow-x":"auto"}},W0={class:"wpic:w-full wpic:border-collapse"},R0={key:0,style:{width:"36px"}},I0={key:1,style:{width:"32px"}},Z0={key:0},U0={class:"wpic-table__header wpic-table__divider wpic:border-b wpic:border-zinc-100 wpic:dark:border-zinc-800"},K0=["onClick"],O0={key:1},q0={key:0,class:"wpic-table__summary wpic-table__divider wpic:border-b wpic:border-zinc-200 wpic:font-medium wpic:dark:border-zinc-700"},Y0={key:0},Q0={key:1},J0=["onClick"],X0=["onClick"],G0={key:0,class:"wpic-table__divider wpic:border-b wpic:last:border-b-0 wpic:border-zinc-100 wpic:dark:border-zinc-800"},_0=["colspan"],e3={key:2},n3=["colspan"],t3={class:"wpic:flex wpic:flex-col wpic:items-center wpic:gap-2"},c3={key:0,class:"wpic-table__footer wpic:flex wpic:flex-wrap wpic:min-h-14 wpic:items-center wpic:justify-between wpic:gap-3 wpic-table__divider wpic:border-t wpic:border-zinc-100 wpic:dark:border-zinc-800 wpic-table__pad-x wpic:py-3"},i3={class:"wpic:tabular-nums wpic:text-zinc-400 wpic:dark:text-zinc-500"},l3={key:0,class:"wpic-table__pagination wpic:flex wpic:items-center wpic:gap-1"},a3=["aria-label","disabled"],o3={key:0,class:"wpic:w-6 wpic:text-center wpic:text-base wpic:select-none wpic:text-zinc-400 wpic:dark:text-zinc-500"},r3=["aria-current","onClick"],s3=["aria-label","disabled"],p3=e.defineComponent({__name:"WTable",props:{data:{},columns:{},loading:{type:Boolean},loadingSpinner:{type:Boolean,default:!0},labels:{},emptyText:{},pageSize:{},serverTotal:{},serverPage:{},serverSort:{},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:{},cellStyle:{},summaryRow:{},compact:{type:Boolean},padding:{},showFooter:{type:Boolean,default:!0},columnDividers:{type:Boolean,default:!1}},emits:["row-click","update:selectedKeys","row-select","update:serverPage","update:serverSort"],setup(n,{expose:p,emit:t}){const l=n,r=t,c=e.ref(new Set);function i(j){c.value.has(j)?c.value.delete(j):c.value.add(j)}const w=e.useSlots(),u=e.computed(()=>l.pageSize??25),C=e.ref({field:null,direction:"asc"}),a=e.computed(()=>(l.serverSort??C.value).field),M=e.computed(()=>(l.serverSort??C.value).direction);function g(j){const D=a.value===j&&M.value==="asc"?"desc":"asc",x={field:j,direction:D};l.serverSort?r("update:serverSort",x):C.value=x}const y=e.ref(""),V=e.computed(()=>l.columns.some(j=>j.searchable)),b=e.computed(()=>{let j=l.data??[];const D=y.value.trim().toLowerCase();if(D){const x=l.columns.filter(R=>R.searchable).map(R=>R.field);j=j.filter(R=>x.some(n1=>String(R[n1]??"").toLowerCase().includes(D)))}if(a.value&&!l.serverSort){const x=a.value;j=[...j].sort((R,n1)=>{const t1=R[x]??"",d1=n1[x]??"",h=typeof t1=="number"&&typeof d1=="number"?t1-d1:String(t1).toLowerCase().localeCompare(String(d1).toLowerCase());return M.value==="asc"?h:-h})}return j}),f=e.ref(1),T=e.computed(()=>l.serverTotal!==void 0),U=e.computed({get:()=>T.value?l.serverPage??1:f.value,set:j=>{T.value?r("update:serverPage",j):f.value=j}}),Y=e.computed(()=>T.value?l.serverTotal??0:b.value.length),Q=e.computed(()=>Math.max(1,Math.ceil(Y.value/u.value)));e.watch([y,()=>l.data],()=>{T.value||(U.value=1),c.value.clear()});const I=e.computed(()=>{if(T.value)return b.value;const j=(U.value-1)*u.value;return b.value.slice(j,j+u.value)});function F(j,D){const x=j[l.rowKey];return typeof x=="string"||typeof x=="number"?x:`${U.value}:${D}`}const N=e.computed(()=>new Set(l.selectedKeys??[])),A=e.computed(()=>I.value.map(F)),m=e.computed(()=>l.selectable&&A.value.length>0&&A.value.every(j=>N.value.has(j)));function W(j,D,x){const R=F(j,D),n1=new Set(l.selectedKeys??[]),t1=x===!0;t1?n1.add(R):n1.delete(R),r("update:selectedKeys",[...n1]),r("row-select",j,t1)}function J(j){const D=new Set(l.selectedKeys??[]),x=j===!0;for(const R of A.value)x?D.add(R):D.delete(R);r("update:selectedKeys",[...D])}const o1=e.computed(()=>Y.value===0?0:(U.value-1)*u.value+1),E=e.computed(()=>Math.min(U.value*u.value,Y.value)),Z=e.computed(()=>{const j=Q.value;if(j<=7)return Array.from({length:j},(t1,d1)=>d1+1);const D=U.value,x=[],R=new Set([1,j,D-1,D,D+1].filter(t1=>t1>=1&&t1<=j));let n1=0;for(const t1 of[...R].sort((d1,h)=>d1-h))t1-n1>1&&x.push("…"),x.push(t1),n1=t1;return x}),H=e.computed(()=>l.padding?`wpic-table--padding-${l.padding}`:l.compact?"wpic-table--padding-sm":"wpic-table--padding-inherit"),r1=j=>j==="right"?"wpic:text-right":j==="center"?"wpic:text-center":"wpic:text-left",a1=(j,D)=>[D,l.flushEdges&&j===0&&!l.expandable&&!l.selectable?"wpic:pl-0":"wpic-table__pad-l",l.flushEdges&&j===l.columns.length-1?"wpic:pr-0":"wpic-table__pad-r"],X=j=>({...j.width?{width:j.width}:{},...j.minWidth?{minWidth:j.minWidth}:{}});return p({filteredCount:e.computed(()=>b.value.length),searchQuery:y}),(j,D)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["wpic-table",[H.value,{"wpic-table--column-dividers":n.columnDividers}]])},[(V.value||e.unref(w).toolbar)&&!n.loading?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["wpic:flex wpic:items-center wpic:gap-2 wpic-table__divider wpic:border-b wpic:border-zinc-100 wpic:dark:border-zinc-800 wpic-table__pad-x",n.compact?"wpic:py-1":"wpic:py-2"])},[V.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(u2,{modelValue:y.value,"onUpdate:modelValue":D[0]||(D[0]=x=>y.value=x),placeholder:n.searchPlaceholder,icon:e.unref(k.Search),class:"wpic:flex-1"},null,8,["modelValue","placeholder","icon"]),y.value?(e.openBlock(),e.createElementBlock("span",H0,e.toDisplayString(b.value.length)+" "+e.toDisplayString(n.labels?.results??"results"),1)):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0),e.renderSlot(j.$slots,"toolbar")],2)):e.createCommentVNode("",!0),n.loading?(e.openBlock(),e.createElementBlock("div",P0,[n.loadingSpinner?(e.openBlock(),e.createBlock(G1,{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",j0,[e.createElementVNode("table",W0,[e.createElementVNode("colgroup",null,[n.selectable?(e.openBlock(),e.createElementBlock("col",R0)):e.createCommentVNode("",!0),n.expandable?(e.openBlock(),e.createElementBlock("col",I0)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.columns,x=>(e.openBlock(),e.createElementBlock("col",{key:x.field,style:e.normalizeStyle(X(x))},null,4))),128))]),l.showHeader!==!1?(e.openBlock(),e.createElementBlock("thead",Z0,[e.createElementVNode("tr",U0,[n.selectable?(e.openBlock(),e.createElementBlock("th",{key:0,class:e.normalizeClass(["wpic:w-9 wpic:pr-2",n.compact?"wpic:py-1.5":"wpic:py-3",n.flushEdges?"wpic:pl-0":"wpic:pl-2"])},[e.createVNode(p2,{"model-value":m.value,onClick:D[1]||(D[1]=e.withModifiers(()=>{},["stop"])),"onUpdate:modelValue":J},null,8,["model-value"])],2)):e.createCommentVNode("",!0),n.expandable?(e.openBlock(),e.createElementBlock("th",{key:1,class:e.normalizeClass(["wpic:w-8 wpic:pr-2",n.compact?"wpic:py-1.5":"wpic:py-3",n.flushEdges&&!n.selectable?"wpic:pl-0":"wpic:pl-2"])},null,2)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.columns,(x,R)=>(e.openBlock(),e.createElementBlock("th",{key:x.field,class:e.normalizeClass([a1(R,n.compact?"wpic:py-1.5":"wpic:py-3"),"wpic:whitespace-nowrap wpic:text-zinc-500 wpic:dark:text-zinc-300 wpic:font-medium",r1(x.align),R===0&&!n.expandable&&!n.selectable?"wpic-table__sticky wpic:sticky wpic:left-0 wpic:z-10":""]),style:e.normalizeStyle({...X(x)})},[e.renderSlot(j.$slots,"th-"+x.field,{col:x,sortField:a.value,sortDir:M.value,toggleSort:g},()=>[x.sortable?(e.openBlock(),e.createElementBlock("button",{key:0,onClick:n1=>g(x.field),class:e.normalizeClass(["wpic:inline-flex wpic:items-center wpic:gap-1 wpic:cursor-pointer wpic:transition-colors wpic:whitespace-nowrap",x.align==="right"?"wpic:ml-auto":""]),style:{color:"inherit"}},[e.createTextVNode(e.toDisplayString(x.label)+" ",1),a.value===x.field&&M.value==="asc"?(e.openBlock(),e.createBlock(e.unref(k.ChevronUp),{key:0,size:11,style:{color:"#5E6AD2"}})):a.value===x.field&&M.value==="desc"?(e.openBlock(),e.createBlock(e.unref(k.ChevronDown),{key:1,size:11,style:{color:"#5E6AD2"}})):(e.openBlock(),e.createBlock(e.unref(k.ChevronsUpDown),{key:2,size:10,style:{opacity:"0.3"}}))],10,K0)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(x.label),1)],64))])],6))),128))])])):e.createCommentVNode("",!0),n.loading?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("tbody",O0,[n.summaryRow?(e.openBlock(),e.createElementBlock("tr",q0,[n.selectable?(e.openBlock(),e.createElementBlock("td",Y0)):e.createCommentVNode("",!0),n.expandable?(e.openBlock(),e.createElementBlock("td",Q0)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.columns,(x,R)=>(e.openBlock(),e.createElementBlock("td",{key:x.field,class:e.normalizeClass([a1(R,n.compact?"wpic:py-1":"wpic:py-2.5"),r1(x.align),R===0&&!n.expandable&&!n.selectable?"wpic-table__sticky wpic:sticky wpic:left-0 wpic:z-10 wpic:text-zinc-900 wpic:dark:text-zinc-100":"wpic:text-zinc-700 wpic:dark:text-zinc-200"])},[e.renderSlot(j.$slots,"summary-"+x.field,{row:n.summaryRow,value:n.summaryRow[x.field]},()=>[e.createTextVNode(e.toDisplayString(n.summaryRow[x.field]??"—"),1)])],2))),128))])):e.createCommentVNode("",!0),I.value.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(I.value,(x,R)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:R},[e.createElementVNode("tr",{class:e.normalizeClass(["wpic-table__row wpic:group wpic-table__divider wpic:border-b wpic:last:border-b-0 wpic:border-zinc-100 wpic:dark:border-zinc-800",[n.expandable&&c.value.has(R)?"wpic:border-b-0":"",n.rowClass?.(x)]]),style:e.normalizeStyle({cursor:n.rowClickable||n.expandable?"pointer":"default",...n.rowStyle?.(x)??{}}),onClick:n1=>n.expandable?i(R):n.rowClickable&&r("row-click",x)},[n.selectable?(e.openBlock(),e.createElementBlock("td",{key:0,class:e.normalizeClass(["wpic:w-9 wpic:pr-2",n.compact?"wpic:py-1":"wpic:py-2.5",n.flushEdges?"wpic:pl-0":"wpic:pl-2"]),onClick:D[2]||(D[2]=e.withModifiers(()=>{},["stop"]))},[e.createVNode(p2,{"model-value":N.value.has(F(x,R)),"onUpdate:modelValue":n1=>W(x,R,n1)},null,8,["model-value","onUpdate:modelValue"])],2)):e.createCommentVNode("",!0),n.expandable?(e.openBlock(),e.createElementBlock("td",{key:1,class:e.normalizeClass(["wpic:w-8 wpic:pr-1 wpic:text-zinc-400 wpic:dark:text-zinc-500",n.compact?"wpic:py-1":"wpic:py-2.5",n.flushEdges&&!n.selectable?"wpic:pl-0":"wpic:pl-3"])},[c.value.has(R)?(e.openBlock(),e.createBlock(e.unref(k.ChevronDown),{key:0,size:13,style:{transition:"transform .15s"}})):(e.openBlock(),e.createBlock(e.unref(k.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,(n1,t1)=>(e.openBlock(),e.createElementBlock("td",{key:n1.field,class:e.normalizeClass([a1(t1,n.compact?"wpic:py-1":"wpic:py-2.5"),r1(n1.align),t1===0&&!n.expandable&&!n.selectable?"wpic-table__sticky wpic:sticky wpic:left-0 wpic:z-10 wpic:text-zinc-900 wpic:dark:text-zinc-100 wpic:font-medium":"wpic:text-zinc-700 wpic:dark:text-zinc-200"]),style:e.normalizeStyle(n.cellStyle?.(x,n1)),onClick:d1=>n.expandable?(n.rowClickable&&r("row-click",x),d1.stopPropagation()):void 0},[e.renderSlot(j.$slots,n1.field,{row:x,value:x[n1.field]},()=>[e.createTextVNode(e.toDisplayString(x[n1.field]??"—"),1)])],14,X0))),128))],14,J0),n.expandable&&c.value.has(R)?(e.openBlock(),e.createElementBlock("tr",G0,[e.createElementVNode("td",{colspan:n.columns.length+(n.expandable?1:0)+(n.selectable?1:0),class:"wpic-table__pad-x wpic:pb-3 wpic:pt-0"},[e.renderSlot(j.$slots,"expand",{row:x})],8,_0)])):e.createCommentVNode("",!0)],64))),128)):(e.openBlock(),e.createElementBlock("tr",e3,[e.createElementVNode("td",{colspan:n.columns.length+(n.expandable?1:0)+(n.selectable?1:0),class:"wpic:py-16 wpic:text-center wpic:text-zinc-400 wpic:dark:text-zinc-500"},[e.createElementVNode("div",t3,[e.renderSlot(j.$slots,"empty-icon"),e.createTextVNode(" "+e.toDisplayString(n.emptyText??"No data"),1)])],8,n3)]))]))])]),n.showFooter&&Y.value>0?(e.openBlock(),e.createElementBlock("div",c3,[e.createElementVNode("span",i3,[Q.value>1?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(e.toDisplayString(o1.value)+"–"+e.toDisplayString(E.value)+" "+e.toDisplayString(n.labels?.of??"of")+" "+e.toDisplayString(Y.value),1)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(Y.value)+" "+e.toDisplayString(Y.value===1?n.labels?.item??"item":n.labels?.items??"items"),1)],64))]),Q.value>1?(e.openBlock(),e.createElementBlock("div",l3,[e.createElementVNode("button",{type:"button","aria-label":n.labels?.previous??"Previous page",onClick:D[3]||(D[3]=x=>U.value--),disabled:U.value===1,class:"wpic:h-8 wpic:w-8 wpic:flex wpic:items-center wpic:justify-center wpic:rounded-lg wpic:transition-colors wpic:cursor-pointer wpic:disabled:opacity-30 wpic:hover:bg-zinc-50 wpic:dark:hover:bg-zinc-800/50 wpic:text-zinc-400"},[e.createVNode(e.unref(k.ChevronLeft),{size:13})],8,a3),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Z.value,x=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:x},[x==="…"?(e.openBlock(),e.createElementBlock("span",o3,"…")):(e.openBlock(),e.createElementBlock("button",{key:1,type:"button","aria-current":U.value===x?"page":void 0,onClick:R=>U.value=x,class:e.normalizeClass(["wpic:h-8 wpic:min-w-8 wpic:px-2 wpic:rounded-lg wpic:text-sm wpic:font-medium wpic:transition-colors wpic:cursor-pointer",U.value===x?"":"wpic:text-zinc-700 wpic:dark:text-zinc-200 wpic:hover:bg-zinc-100 wpic:dark:hover:bg-zinc-700"]),style:e.normalizeStyle(U.value===x?"background:rgba(94,106,210,0.1);color:#5E6AD2":void 0)},e.toDisplayString(x),15,r3))],64))),128)),e.createElementVNode("button",{type:"button","aria-label":n.labels?.next??"Next page",onClick:D[4]||(D[4]=x=>U.value++),disabled:U.value===Q.value,class:"wpic:h-8 wpic:w-8 wpic:flex wpic:items-center wpic:justify-center wpic:rounded-lg wpic:transition-colors wpic:cursor-pointer wpic:disabled:opacity-30 wpic:hover:bg-zinc-50 wpic:dark:hover:bg-zinc-800/50 wpic:text-zinc-400"},[e.createVNode(e.unref(k.ChevronRight),{size:13})],8,s3)])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)],64))],2))}}),d3={key:0,class:"w-spreadsheet-frame__heading"},w3={key:1,class:"w-spreadsheet-frame__status"},u3=["title","aria-label"],m3={key:1,class:"wpic:flex wpic:min-h-64 wpic:items-center wpic:justify-center wpic:gap-3 wpic:text-zinc-400 wpic:dark:text-zinc-500"},h3={key:0,class:"w-spreadsheet__row-axis-col"},f3={key:0},v3={key:0,class:"w-spreadsheet__corner"},b3={key:0,class:"w-spreadsheet__axis"},g3=["colspan","title","tabindex","onClick","onKeydown","onPointerenter","onPointerdown"],k3={key:0,class:"w-spreadsheet__editor"},C3=["type","value","min","placeholder","onInput"],z3=["onPointerdown"],y3=e.defineComponent({__name:"WSpreadsheet",props:{appearance:{},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:p,emit:t}){const l=n,r=t,c=e.computed(()=>l.showAxes&&l.showColumnLetters),i=e.computed(()=>l.showAxes&&l.showRowNumbers),w=e.computed(()=>l.columns.some(h=>h.sticky)),u=e.ref(null),C=e.ref("asc"),a=e.ref(l.expanded??!1),M=e.ref(null),g=e.ref(null),y=e.ref(null),V=e.ref(null),b=e.ref(null);function f(){if(!l.downloadable)return;const h=$=>`"${String($??"").replace(/"/g,'""')}"`,L=F.value.map($=>l.columns.map(P=>h(Q($,P.key))).join(",")).join(`\r
|
|
2
|
-
`),B=new Blob([`\uFEFF${L}`],{type:"text/csv;charset=utf-8"}),q=URL.createObjectURL(B),G=document.createElement("a");G.href=q,G.download=l.downloadFilename||"spreadsheet.csv",G.click(),URL.revokeObjectURL(q)}function T(h,L=!0){if(a.value===h)return;const B=performance.now();console.debug(`[WSpreadsheet] ${h?"expand":"minimize"} requested`),a.value=h,L&&r("update:expanded",h),requestAnimationFrame(()=>requestAnimationFrame(()=>{console.debug(`[WSpreadsheet] ${h?"expand":"minimize"} painted in ${(performance.now()-B).toFixed(1)}ms`)}))}e.watch(()=>l.expanded,h=>{h!=null&&T(h,!1)}),e.watch(()=>l.downloadRequest,(h,L)=>{h!=null&&h!==L&&f()}),p({expand:()=>{l.expandable&&T(!0)},collapse:()=>{T(!1)},toggleExpanded:()=>{l.expandable&&T(!a.value)},download:f});function U(h){h.key==="Escape"&&a.value&&T(!1)}function Y(h){if(h.target?.closest(".w-spreadsheet__cell")?.querySelector(".w-spreadsheet__input"))return;V.value=null,b.value=null;const q=document.activeElement;q&&M.value?.contains(q)&&q.blur()}e.onMounted(()=>{document.addEventListener("keydown",U),document.addEventListener("pointerdown",Y)}),e.onBeforeUnmount(()=>{document.removeEventListener("keydown",U),document.removeEventListener("pointerdown",Y),window.removeEventListener("pointerup",x)});function Q(h,L){return h.cells.find(B=>B.key===L)?.value??""}function I(h){if(typeof h=="number")return h;const L=String(h).trim().replace(/[\s,]/g,"");return L!==""&&/^-?\d+(\.\d+)?$/.test(L)?Number(L):String(h).toLocaleLowerCase()}const F=e.computed(()=>{if(!u.value)return l.rows;const h=l.rows.filter(q=>q.sortable!==!1),L=C.value==="asc"?1:-1;h.sort((q,G)=>{const $=I(Q(q,u.value)),P=I(Q(G,u.value));return typeof $=="number"&&typeof P=="number"?($-P)*L:String($).localeCompare(String(P),void 0,{numeric:!0})*L});let B=0;return l.rows.map(q=>q.sortable===!1?q:h[B++])});function N(h){const L=l.columns.find(B=>B.key===h.key);return!!(l.sortable&&h.variant==="header"&&L?.sortable!==!1)}function A(h){N(h)&&(u.value===h.key?C.value=C.value==="asc"?"desc":"asc":(u.value=h.key,C.value="asc"))}function m(h,L){return h.cells.slice(0,L).reduce((B,q)=>B+(q.colspan||1),0)}function W(h,L){return!!l.columns[m(h,L)]?.sticky}function J(h,L){const B=m(h,L);return!!(l.columns[B]?.sticky&&!l.columns.slice(0,B).some(q=>q.sticky))}function o1(h,L){const B=m(h,L);if(!l.columns[B]?.sticky)return;const q=l.columns.slice(0,B).map(G=>G.width||"0px");return{left:q.length?`calc(${q.join(" + ")})`:"0px"}}function E(h,L){return`${h.key}\0${L.key}`}function Z(h,L){!L.editable||g.value||(V.value={rowKey:h.key,cellKey:L.key},b.value=null)}function H(h,L){return V.value?.rowKey===h.key&&V.value?.cellKey===L.key}function r1(h,L,B){const q=F.value[h];!l.fillHandle||!B.editable||!q||!H(q,B)||(b.value=null,g.value={row:h,cell:L,value:String(B.value??"")},y.value={row:h,cell:L},window.addEventListener("pointerup",x,{once:!0}))}function a1(h,L){g.value&&(y.value={row:h,cell:L})}function X(h,L){if(!g.value||!y.value)return!1;const B=Math.min(g.value.row,y.value.row),q=Math.max(g.value.row,y.value.row),G=Math.min(g.value.cell,y.value.cell),$=Math.max(g.value.cell,y.value.cell);return h>=B&&h<=q&&L>=G&&L<=$}function j(h,L){if(!X(h,L)||!g.value||!y.value)return{};const B=Math.min(g.value.row,y.value.row),q=Math.max(g.value.row,y.value.row),G=Math.min(g.value.cell,y.value.cell),$=Math.max(g.value.cell,y.value.cell);return{"w-spreadsheet__cell--fill-range":!0,"w-spreadsheet__cell--fill-top":h===B,"w-spreadsheet__cell--fill-bottom":h===q,"w-spreadsheet__cell--fill-left":L===G,"w-spreadsheet__cell--fill-right":L===$}}function D(h,L){const B=E(h,L);return{"w-spreadsheet__cell--fill-completed":!!b.value?.cells.has(B),"w-spreadsheet__cell--fill-source":b.value?.source===B}}function x(){if(!g.value||!y.value)return;const h=g.value,L=y.value,B=Math.min(h.row,L.row),q=Math.max(h.row,L.row),G=Math.min(h.cell,L.cell),$=Math.max(h.cell,L.cell),P=new Set,O=F.value[h.row],s1=O?.cells[h.cell];for(let m1=B;m1<=q;m1++){const V1=F.value[m1];if(V1)for(let B1=G;B1<=$;B1++){const E1=V1.cells[B1];E1?.editable&&(P.add(E(V1,E1)),r("cell-change",{rowKey:V1.key,cellKey:E1.key,value:h.value,row:V1,cell:E1}))}}g.value=null,y.value=null,b.value=O&&s1?{cells:P,source:E(O,s1)}:null}function R(h){let L=h+1,B="";for(;L>0;)L-=1,B=String.fromCharCode(65+L%26)+B,L=Math.floor(L/26);return B}function n1(h){return[`w-spreadsheet__cell--${h.variant||"default"}`,`w-spreadsheet__cell--${h.align||"left"}`,`w-spreadsheet__cell--tone-${h.tone||"default"}`,{"w-spreadsheet__cell--wrap":!!h.wrap},h.class||""]}function t1(h,L,B){const q=B.target.value;r("cell-change",{rowKey:h.key,cellKey:L.key,value:q,row:h,cell:L})}function d1(h){const B=h.currentTarget.previousElementSibling;B?.focus(),B?.showPicker?.()}return(h,L)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"frameRef",ref:M,class:e.normalizeClass(["w-spreadsheet-frame",{"w-spreadsheet-frame--expanded":a.value}])},[a.value?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"w-spreadsheet-frame__backdrop","aria-label":"Restore spreadsheet",onClick:L[0]||(L[0]=B=>T(!1))})):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["w-spreadsheet-frame__surface",{"w-spreadsheet--plain":n.appearance==="plain"}])},[n.expandable&&(n.showExpandButton!==!1||a.value)||n.downloadable&&(n.showDownloadButton!==!1||a.value)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["w-spreadsheet-frame__toolbar",{"w-spreadsheet-frame__toolbar--hover":n.actionsOnHover&&!a.value}])},[a.value&&h.$slots["expanded-header"]?(e.openBlock(),e.createElementBlock("div",d3,[e.renderSlot(h.$slots,"expanded-header")])):e.createCommentVNode("",!0),h.$slots["toolbar-status"]?(e.openBlock(),e.createElementBlock("div",w3,[e.renderSlot(h.$slots,"toolbar-status")])):e.createCommentVNode("",!0),e.renderSlot(h.$slots,"toolbar"),n.downloadable&&(n.showDownloadButton!==!1||a.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(k.Download),{size:16})])):e.createCommentVNode("",!0),n.expandable&&(n.showExpandButton!==!1||a.value)?(e.openBlock(),e.createElementBlock("button",{key:3,type:"button",class:"w-spreadsheet-frame__expand",title:a.value?"Restore spreadsheet":"Expand spreadsheet","aria-label":a.value?"Restore spreadsheet":"Expand spreadsheet",onClick:L[1]||(L[1]=B=>T(!a.value))},[a.value?(e.openBlock(),e.createBlock(e.unref(k.Minimize),{key:0,size:16})):(e.openBlock(),e.createBlock(e.unref(k.Expand),{key:1,size:16}))],8,u3)):e.createCommentVNode("",!0)],2)):e.createCommentVNode("",!0),n.loading?(e.openBlock(),e.createElementBlock("div",m3,[e.createVNode(G1),L[2]||(L[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":c.value}]),style:e.normalizeStyle({maxHeight:a.value?"calc(100vh - 96px)":n.maxHeight})},[e.createElementVNode("table",{class:e.normalizeClass(["w-spreadsheet__table",{"w-spreadsheet__table--sticky-columns":w.value}]),style:e.normalizeStyle({minWidth:n.minWidth})},[e.createElementVNode("colgroup",null,[i.value?(e.openBlock(),e.createElementBlock("col",h3)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.columns,B=>(e.openBlock(),e.createElementBlock("col",{key:B.key,style:e.normalizeStyle({width:B.width})},null,4))),128))]),c.value?(e.openBlock(),e.createElementBlock("thead",f3,[e.createElementVNode("tr",null,[i.value?(e.openBlock(),e.createElementBlock("th",v3)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.columns,(B,q)=>(e.openBlock(),e.createElementBlock("th",{key:B.key,class:"w-spreadsheet__axis"},e.toDisplayString(B.label||R(q)),1))),128))])])):e.createCommentVNode("",!0),e.createElementVNode("tbody",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(F.value,(B,q)=>(e.openBlock(),e.createElementBlock("tr",{key:B.key,class:e.normalizeClass({"w-spreadsheet__row--sticky":B.sticky})},[i.value?(e.openBlock(),e.createElementBlock("th",b3,e.toDisplayString(q+1),1)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(B.cells,(G,$)=>(e.openBlock(),e.createElementBlock("td",{key:G.key,class:e.normalizeClass(["w-spreadsheet__cell",[n1(G),{"w-spreadsheet__cell--sortable":N(G),"w-spreadsheet__cell--sticky":W(B,$),"w-spreadsheet__cell--sticky-first":J(B,$),"w-spreadsheet__cell--active":H(B,G)},j(q,$),D(B,G)]]),colspan:G.colspan||1,title:G.title,style:e.normalizeStyle(o1(B,$)),tabindex:N(G)?0:void 0,onClick:P=>A(G),onKeydown:[e.withKeys(e.withModifiers(P=>A(G),["prevent"]),["enter"]),e.withKeys(e.withModifiers(P=>A(G),["prevent"]),["space"])],onPointerenter:P=>a1(q,$),onPointerdown:P=>Z(B,G)},[e.renderSlot(h.$slots,`cell-${G.key}`,{row:B,cell:G,rowIndex:q},()=>[G.editable?(e.openBlock(),e.createElementBlock("div",k3,[e.createElementVNode("input",{class:e.normalizeClass(["w-spreadsheet__input",{"w-spreadsheet__input--date":G.inputType==="date"}]),type:G.inputType||"text",value:G.value??"",min:G.min,placeholder:G.placeholder,onInput:P=>t1(B,G,P)},null,42,C3),G.inputType==="date"?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"w-spreadsheet__calendar","aria-label":"Choose date",title:"Choose date",onClick:d1},[e.createVNode(e.unref(k.CalendarDays),{size:16})])):e.createCommentVNode("",!0)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(G.value??""),1)],64))]),N(G)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(u.value===G.key?C.value==="asc"?e.unref(k.ChevronUp):e.unref(k.ChevronDown):e.unref(k.ChevronsUpDown)),{key:0,class:"w-spreadsheet__sort-icon",size:14})):e.createCommentVNode("",!0),n.fillHandle&&G.editable&&H(B,G)?(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(P=>r1(q,$,G),["stop","prevent"])},null,40,z3)):e.createCommentVNode("",!0)],46,g3))),128))],2))),128))])],6)],6))],2)],2))}}),h1=(n,p)=>{const t=n.__vccOpts||n;for(const[l,r]of p)t[l]=r;return t},x3={},B3={class:"wpic:min-w-40 wpic:rounded-lg wpic:bg-white wpic:p-1.5 wpic:shadow-md wpic:shadow-zinc-900/5 wpic:dark:bg-zinc-700 wpic:dark:shadow-black/20"};function M3(n,p){return e.openBlock(),e.createElementBlock("div",B3,[e.renderSlot(n.$slots,"default")])}const d2=h1(x3,[["render",M3]]),V3=["disabled"],D1=e.defineComponent({__name:"WActionMenuItem",props:{danger:{type:Boolean},disabled:{type:Boolean}},emits:["click"],setup(n,{emit:p}){const t=p;return(l,r)=>(e.openBlock(),e.createElementBlock("button",{type:"button",disabled:n.disabled,onClick:r[0]||(r[0]=c=>t("click",c)),class:e.normalizeClass(["wpic:flex wpic:h-8 wpic:w-full wpic:items-center wpic:gap-2 wpic:rounded-md wpic:px-2 wpic:text-left wpic:font-medium wpic:transition wpic:disabled:cursor-not-allowed wpic:disabled:opacity-40",n.danger?"wpic:text-red-500 wpic:hover:bg-red-50 wpic:dark:hover:bg-red-950/30":"wpic:text-zinc-600 wpic:hover:bg-zinc-100 wpic:hover:text-zinc-900 wpic:dark:text-zinc-100 wpic:dark:hover:bg-zinc-600 wpic:dark:hover:text-white"])},[e.renderSlot(l.$slots,"default")],10,V3))}}),D2={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"}},E3={light:["#3B73E1","#0891A6","#8B5CD6","#C58A16","#D64D79","#527FA8"],dark:["#7C9FE0","#5FB8C4","#AF94D5","#D8B26A","#D88FA5","#94A8BD"]};function F2(n,p={}){const t={...D2[n],...p},l={};for(const[r,c]of Object.entries(t))l[`--wpic-${r.replace(/[A-Z]/g,i=>`-${i.toLowerCase()}`)}`]=c;Object.assign(l,{"--wpic-legacy-bg-main":t.canvas,"--wpic-legacy-bg-card":t.surface,"--wpic-legacy-bg-input":t.input,"--wpic-legacy-border-subtle":t.border,"--wpic-legacy-border-strong":t.border,"--wpic-legacy-border-hover":t.borderHover,"--wpic-legacy-text-main":t.text,"--wpic-legacy-text-muted":t.muted,"--wpic-legacy-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});for(const[r,c]of Object.entries(l))r.startsWith("--wpic-legacy-")&&(l[r.replace("--wpic-legacy-","--")]=c);return l}const T2=Symbol("wpic-theme");function T1(){return e.inject(T2,e.computed(()=>null))}let N2=0,S2="";function A2(){N2++===0&&(S2=document.body.style.overflow,document.body.style.overflow="hidden");let n=!1;return()=>{n||(n=!0,--N2===0&&(document.body.style.overflow=S2))}}const N3=["data-wpic-theme"],S3=["aria-label"],L3={class:"wpic-bottom-sheet-header"},$3=["aria-label"],D3={key:0,class:"wpic-bottom-sheet-footer"},y1=[],r2=new Map,m2=e.defineComponent({__name:"WBottomSheet",props:{returnFocus:{},modelValue:{type:Boolean},title:{},closeLabel:{default:"Close"},noPadding:{type:Boolean}},emits:["update:modelValue"],setup(n,{emit:p}){const t=n,l=p,r=T1(),c=e.ref(null),i=Symbol("sheet"),w=e.inject("wpic-overlay-layer",e.ref(9998)),u=e.ref(1e4);e.provide("wpic-overlay-layer",u);const C=e.ref({height:0,top:0}),a=e.computed(()=>C.value.height?{height:`${C.value.height}px`,top:`${C.value.top}px`}:{}),M=Symbol.for("wpic-ui-popover-descendants"),g=e.inject(M,null),y=new Set;e.provide(M,{add(m){y.add(m),g?.add(m)},remove(m){y.delete(m),g?.remove(m)}}),e.provide("wpic-pagination-url-sync",!1),e.watch(c,(m,W)=>{W&&g?.remove(W),m&&g?.add(m)});let V=null,b=!1,f;const T=m=>!!m.getClientRects().length&&getComputedStyle(m).visibility!=="hidden";function U(){return[c.value,...y].filter(m=>!!m&&T(m)).flatMap(m=>[...m.querySelectorAll('a[href],button:not(:disabled),input:not(:disabled),select:not(:disabled),textarea:not(:disabled),[tabindex="0"]')]).filter(T)}function Y(){l("update:modelValue",!1)}function Q(m){if(!(y1[y1.length-1]!==i||I(m.target))){if(m.key==="Escape"){if([...y].some(T))return;m.preventDefault(),m.stopPropagation(),Y()}else if(m.key==="Tab"){const W=U(),J=W.indexOf(document.activeElement);if(!W.length){m.preventDefault(),c.value?.focus();return}m.shiftKey&&J<=0?(m.preventDefault(),W[W.length-1]?.focus()):!m.shiftKey&&(J<0||J===W.length-1)&&(m.preventDefault(),W[0]?.focus())}}}function I(m){const W=m.closest?.(".wpic-modal-overlay");return!!W&&Number(getComputedStyle(W).zIndex)>u.value}function F(m){if(y1[y1.length-1]!==i||I(m.target))return;const W=m.target;c.value?.contains(W)||[...y].some(J=>J.contains(W))||c.value?.focus({preventScroll:!0})}function N(){const m=window.visualViewport;C.value={height:m?.height??window.innerHeight,top:m?.offsetTop??0}}function A(){if(!b)return;b=!1;const m=y1[y1.length-1]===i;y1.splice(y1.indexOf(i),1),r2.delete(i),f?.(),f=void 0,document.removeEventListener("keydown",Q),document.removeEventListener("focusin",F),window.visualViewport?.removeEventListener("resize",N),window.visualViewport?.removeEventListener("scroll",N),m&&V?.isConnected&&V.focus({preventScroll:!0})}return e.watch(()=>t.modelValue,async m=>{if(!m){A();return}b||(b=!0,V=t.returnFocus??document.activeElement,f=A2(),u.value=Math.max(w.value,9998,...r2.values())+2,y1.push(i),r2.set(i,u.value),N(),document.addEventListener("keydown",Q),document.addEventListener("focusin",F),window.visualViewport?.addEventListener("resize",N),window.visualViewport?.addEventListener("scroll",N),await e.nextTick(),t.modelValue&&c.value?.focus({preventScroll:!0}))},{immediate:!0}),e.onBeforeUnmount(()=>{c.value&&g?.remove(c.value),A()}),(m,W)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[n.modelValue?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["wpic-bottom-sheet-overlay",{"wpic-theme":e.unref(r),dark:e.unref(r)?.mode==="dark"}]),style:e.normalizeStyle([e.unref(r)?.variables,a.value,{zIndex:u.value}]),"data-wpic-theme":e.unref(r)?.mode,onClick:e.withModifiers(Y,["self"])},[e.createElementVNode("section",{ref_key:"panel",ref:c,role:"dialog","aria-modal":"true","aria-label":n.title||n.closeLabel,tabindex:"-1",class:"wpic-bottom-sheet"},[W[0]||(W[0]=e.createElementVNode("div",{class:"wpic-bottom-sheet-handle","aria-hidden":"true"},null,-1)),e.createElementVNode("header",L3,[e.renderSlot(m.$slots,"header",{},()=>[e.createElementVNode("h2",null,e.toDisplayString(n.title),1)]),e.createElementVNode("button",{type:"button","aria-label":n.closeLabel,onClick:Y},[e.createVNode(e.unref(k.X),{size:20})],8,$3)]),e.createElementVNode("div",{class:e.normalizeClass(["wpic-bottom-sheet-body",{"wpic-bottom-sheet-padded":!n.noPadding}])},[e.renderSlot(m.$slots,"default")],2),m.$slots.footer?(e.openBlock(),e.createElementBlock("footer",D3,[e.renderSlot(m.$slots,"footer")])):e.createCommentVNode("",!0)],8,S3)],14,N3)):e.createCommentVNode("",!0)]))}});function h2(){const n=typeof window<"u"?window.matchMedia("(max-width: 767px)"):null,p=e.ref(n?.matches??!1),t=()=>{p.value=n?.matches??!1};return n?.addEventListener("change",t),e.onBeforeUnmount(()=>n?.removeEventListener("change",t)),p}const F3=["data-wpic-theme"],v1=e.defineComponent({__name:"WPopover",props:{mobileSheet:{type:Boolean},sheetTitle:{},closeLabel:{},open:{type:Boolean},anchor:{},placement:{},width:{},minWidth:{},height:{},minHeight:{},maxHeight:{},panelScroll:{type:Boolean,default:!0},offset:{},matchAnchorWidth:{type:Boolean},fitAnchorContent:{type:Boolean},freezePositionOnOpen:{type:Boolean,default:!0},flip:{type:Boolean,default:!0},autoPlacement:{type:Boolean},shiftCrossAxis:{type:Boolean},zIndex:{default:9999},extraPanels:{}},emits:["close"],setup(n,{emit:p}){const t=n,l=e.inject("wpic-overlay-layer",e.ref(0)),r=e.computed(()=>Math.max(Number(t.zIndex)||9999,l.value+1));e.provide("wpic-overlay-layer",r);const c=T1(),i=h2(),w=e.computed(()=>i.value&&t.mobileSheet),u=p,C=Symbol.for("wpic-ui-popover-descendants"),a=e.inject(C,null),M=new Set;e.provide(C,{add(E){M.add(E),a?.add(E)},remove(E){M.delete(E),a?.remove(E)}});const g=e.computed(()=>{const E=t.anchor;return E?e.isRef(E)?E.value:E:null}),y=e.ref(null),V=e.ref(null),b=e.computed(()=>V.value??t.placement??"bottom-start"),f=e.computed(()=>{const E=[i1.offset(t.offset??6)];return V.value||(t.autoPlacement?E.push(i1.autoPlacement({alignment:"start"})):t.flip&&E.push(i1.flip({crossAxis:!t.shiftCrossAxis}))),E.push(i1.shift({padding:t.autoPlacement?8:4,crossAxis:t.autoPlacement||t.shiftCrossAxis})),E.push(i1.size({padding:8,apply({availableHeight:Z,availableWidth:H,rects:r1,elements:a1}){const X=Math.max(Z-8,50),j=t.maxHeight?`min(${t.maxHeight}, ${X}px)`:`${X}px`,D={maxWidth:`${Math.max(H,0)}px`,maxHeight:j,overflowY:t.panelScroll?"auto":"hidden"};if(t.height&&(D.height=`min(${t.height}, ${X}px)`),t.minHeight&&(D.minHeight=`min(${t.minHeight}, ${X}px)`),t.matchAnchorWidth){const x=`${Math.min(r1.reference.width,Math.max(H,0))}px`;D.width=t.fitAnchorContent?"max-content":x,D.minWidth=x}Object.assign(a1.floating.style,D)}})),E}),{floatingStyles:T,placement:U,update:Y,isPositioned:Q}=i1.useFloating(g,y,{placement:b,strategy:"fixed",open:e.computed(()=>t.open),whileElementsMounted:i1.autoUpdate,middleware:f}),I=e.computed(()=>{const E=U.value;return E.startsWith("top")?"bottom":E.startsWith("bottom")?"top":E.startsWith("left")?"right":E.startsWith("right")?"left":"top"}),F=E=>{if(w.value)return;const Z=E.target,H=g.value,r1=y.value;r1&&r1.contains(Z)||[...M].some(a1=>a1.contains(Z))||H&&H.contains(Z)||t.extraPanels?.some(a1=>a1?.contains(Z))||u("close")},N=E=>{if(w.value||E.key!=="Escape"||!t.open||[...M].some(H=>H.isConnected&&H.style.display!=="none"))return;E.preventDefault(),E.stopImmediatePropagation(),u("close");const Z=g.value;Z?.matches("button, input, [tabindex]")?Z.focus():Z?.querySelector("button, input, [tabindex]")?.focus()};let A=!1,m=!1;function W(){m||(document.addEventListener("pointerdown",F,!0),document.addEventListener("keydown",N,!0),m=!0)}function J(){m&&(document.removeEventListener("pointerdown",F,!0),document.removeEventListener("keydown",N,!0),m=!1)}e.watch(()=>t.open,E=>{E?e.nextTick(()=>{A||!t.open||(t.autoPlacement&&y.value&&(y.value.style.maxHeight=""),Y(),W())}):(V.value=null,J())},{immediate:!0}),e.watch(y,(E,Z)=>{Z&&a?.remove(Z),E&&a?.add(E)}),e.watch(Q,E=>{E&&t.open&&t.freezePositionOnOpen&&!V.value&&(V.value=U.value)}),e.onBeforeUnmount(()=>{A=!0,J(),y.value&&a?.remove(y.value)});const o1=e.computed(()=>({...t.matchAnchorWidth?{}:{width:t.width??"auto"},...t.minWidth?{minWidth:t.minWidth}:{},transformOrigin:I.value,zIndex:r.value}));return(E,Z)=>w.value?(e.openBlock(),e.createBlock(m2,{key:0,"return-focus":g.value,"model-value":n.open,title:n.sheetTitle,"close-label":n.closeLabel,"no-padding":"","onUpdate:modelValue":Z[0]||(Z[0]=H=>!H&&u("close"))},{default:e.withCtx(()=>[e.renderSlot(E.$slots,"default")]),_:3},8,["return-focus","model-value","title","close-label"])):(e.openBlock(),e.createBlock(e.Teleport,{key:1,to:"body",class:"wpic-popover"},[e.withDirectives(e.createElementVNode("div",{ref_key:"floatingEl",ref:y,"data-wpic-theme":e.unref(c)?.mode,class:e.normalizeClass([{"wpic-theme":e.unref(c),dark:e.unref(c)?.mode==="dark"},"wpic-popover-panel wpic:flex wpic:flex-col wpic:bg-white wpic:dark:bg-zinc-900 wpic:border wpic:border-zinc-200 wpic:dark:border-zinc-800 wpic:rounded-xl wpic:shadow-xl wpic:dark:shadow-black/40 wpic:overflow-hidden"]),style:e.normalizeStyle([e.unref(c)?.variables,e.unref(T),o1.value])},[e.renderSlot(E.$slots,"default")],14,F3),[[e.vShow,n.open]])]))}}),T3={key:0,class:"wpic:fixed wpic:right-0 wpic:top-0 wpic:z-[9997] wpic:flex wpic:h-full wpic:w-20 wpic:items-center wpic:justify-center wpic:border-l-2 wpic:border-[var(--wpic-primary)] wpic:bg-[var(--wpic-primary)]/10 wpic:text-[var(--wpic-primary)] wpic:pointer-events-none"},A3=["data-variant","data-maximized","data-docked"],H3=["title"],P3={class:"wpic:min-w-0 wpic:flex-1 wpic:px-2 wpic:text-center"},j3={class:"wpic:truncate wpic:font-medium wpic:text-zinc-700 wpic:dark:text-zinc-200"},W3={key:0,class:"wpic:truncate wpic:text-zinc-500 wpic:dark:text-zinc-400"},R3={class:"wpic:flex wpic:shrink-0 wpic:items-center wpic:gap-1"},I3=["title"],Z3=["title"],U3=["title"],K3=["title"],O3={class:"wpic:flex wpic:h-11 wpic:shrink-0 wpic:items-center wpic:justify-between wpic:px-3"},q3={class:"wpic:font-medium wpic:text-zinc-700 wpic:dark:text-zinc-200"},Y3=["title"],Q3={class:"wpic:space-y-2 wpic:px-3 wpic:pb-3"},J3={class:"wpic:truncate"},X3={class:"wpic:flex-1 wpic:overflow-y-auto wpic:overflow-x-visible wpic:px-2 wpic:pb-3"},G3={class:"wpic:mb-2 wpic:flex wpic:h-7 wpic:items-center wpic:justify-between wpic:px-2 wpic:font-medium wpic:text-zinc-500 wpic:dark:text-zinc-400"},_3={class:"wpic:truncate"},e5=["title"],n5={class:"wpic:space-y-0.5"},t5={key:0,class:"wpic:rounded-lg wpic:border wpic:border-dashed wpic:border-zinc-200 wpic:px-2 wpic:py-2 wpic:text-zinc-500 wpic:dark:border-zinc-700 wpic:dark:text-zinc-400"},c5=["onMouseenter"],i5=["onClick"],l5={class:"wpic:min-w-0 wpic:flex-1 wpic:truncate"},a5={key:0,class:"wpic:shrink-0 wpic:text-zinc-400"},o5={key:0,class:"wpic:px-3 wpic:py-2 wpic:text-zinc-400 wpic:dark:text-zinc-500"},r5=["onPointerdown","onClick"],s5={class:"wpic:min-w-0 wpic:flex-1 wpic:truncate"},p5={class:"wpic:shrink-0 wpic:text-zinc-400"},d5={class:"wpic:mt-4"},w5={class:"wpic:flex wpic:h-7 wpic:items-center wpic:px-2 wpic:font-medium wpic:text-zinc-500 wpic:dark:text-zinc-400"},u5={class:"wpic:truncate"},m5={class:"wpic:space-y-0.5"},h5={key:0,class:"wpic:rounded-lg wpic:border wpic:border-dashed wpic:border-zinc-200 wpic:px-2 wpic:py-2 wpic:text-zinc-500 wpic:dark:border-zinc-700 wpic:dark:text-zinc-400"},f5=["onPointerdown","onClick"],v5={class:"wpic:block wpic:truncate"},b5={class:"wpic:shrink-0 wpic:text-zinc-400"},g5=["onClick"],k5=["onPointerenter","onMouseenter"],C5={class:"wpic:truncate"},z5={class:"wpic:flex wpic:min-h-0 wpic:flex-1"},y5={class:"wpic:flex wpic:min-h-0 wpic:min-w-0 wpic:flex-1 wpic:flex-col"},x5={class:"wpic:relative wpic:flex wpic:min-h-0 wpic:flex-1"},B5={key:0,class:"wpic:flex wpic:h-full wpic:flex-col wpic:items-center wpic:justify-center wpic:px-5 wpic:text-center wpic:text-zinc-500 wpic:dark:text-zinc-400"},M5={class:"wpic:font-medium"},V5={key:1,class:"wpic:flex wpic:h-full wpic:flex-col wpic:items-center wpic:justify-center wpic:px-5 wpic:text-center"},E5={class:"wpic:mb-3 wpic:flex wpic:h-11 wpic:w-11 wpic:items-center wpic:justify-center wpic:rounded-xl wpic:bg-zinc-100 wpic:text-zinc-500 wpic:dark:bg-zinc-700 wpic:dark:text-zinc-300"},N5={class:"wpic:font-semibold wpic:text-zinc-800 wpic:dark:text-zinc-100"},S5={key:0,class:"wpic:mt-1 wpic:max-w-xs wpic:text-zinc-500 wpic:dark:text-zinc-400"},L5={key:2,class:"wpic:space-y-4"},$5=["data-chat-message-index"],D5=["datetime"],F5=["src","alt"],T5={class:"wpic:max-w-40 wpic:truncate"},A5={key:0,class:"wpic:shrink-0 wpic:text-zinc-400"},H5={key:0,class:"wpic:flex wpic:items-center wpic:gap-2 wpic:text-zinc-500 wpic:dark:text-zinc-400"},P5={key:1,class:"wpic-chat-loading-card",role:"status","aria-label":"Generating image"},j5=["innerHTML","onClick"],W5=["href","onClick"],R5=["src"],I5=["title","aria-label","aria-pressed","onClick"],Z5=["title","aria-label","aria-pressed","onClick"],U5=["title","onClick"],K5=["onClick"],O5=["title","onClick"],q5=["aria-label"],Y5=["aria-label","title","aria-current","onClick"],Q5={class:"wpic-chat-panel__footer wpic:shrink-0 wpic:bg-white wpic:p-3 wpic:dark:bg-zinc-800"},J5={key:0,class:"wpic:mb-2 wpic:flex wpic:flex-wrap wpic:justify-end wpic:gap-1.5"},X5=["src","alt"],G5={class:"wpic:max-w-40 wpic:truncate"},_5={key:0,class:"wpic:shrink-0 wpic:text-zinc-400"},e4={key:1,class:"wpic:shrink-0 wpic:text-zinc-400"},n4=["title","onClick"],t4={class:"wpic-chat-panel__composer wpic:rounded-xl wpic:border wpic:border-zinc-200 wpic:bg-zinc-50 wpic:transition-colors wpic:focus-within:border-[var(--wpic-primary)]/50 wpic:dark:border-zinc-700 wpic:dark:bg-zinc-700"},c4={key:0,class:"wpic:mx-2 wpic:mt-2 wpic:overflow-hidden wpic:rounded-lg wpic:bg-white wpic:shadow-sm wpic:ring-1 wpic:ring-zinc-200 wpic:dark:bg-zinc-800 wpic:dark:ring-zinc-600"},i4=["onMousedown"],l4={class:"wpic:min-w-0 wpic:truncate wpic:font-medium wpic:text-zinc-900 wpic:dark:text-zinc-100"},a4={key:0,class:"wpic:max-w-32 wpic:shrink-0 wpic:truncate wpic:text-xs wpic:text-zinc-500 wpic:dark:text-zinc-400"},o4=["accept"],r4=["value","placeholder","disabled"],s4={class:"wpic:flex wpic:items-center wpic:gap-1"},p4=["title"],d4=["disabled","title"],L2=80,w4=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"},showAttachments:{type:Boolean,default:!0},attachments:{default:()=>[]},accept:{default:""},customAttachmentPicker:{type:Boolean,default:!1},showQuestionRail:{type:Boolean,default:!1},questionRailLabel:{default:"Questions"},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},dockedInset:{default:8},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:p}){const t=n,l=p,r=e.useSlots(),c=e.ref(null),i=e.ref(null),w=e.ref(null),u=e.ref(null),C=e.ref(null),a=e.ref(0),M=e.ref(0),g=e.ref(!1),y=e.ref(null),V=e.ref(null);let b=null;const f=e.ref(!1),T=e.ref(!1),U=e.ref(!1);e.ref(new Set);const Y=e.ref(null),Q=e.ref(null),I=e.ref({}),F=e.ref(null);let N=null;const A=e.computed(()=>F.value?[]:t.messages.filter(o=>o.role!=="system")),m=e.computed(()=>t.loading||F.value!==null),W=e.computed(()=>t.modelValue.trim().length>0&&!t.loading),J=e.computed(()=>t.attachments.length>0),o1=e.computed(()=>{const o=t.modelValue.slice(0,M.value),s=o.match(/(?:^|\s)@([^\s@]*)$/);return s?{start:o.length-s[0].length+(s[0].startsWith(" ")?1:0),query:s[1].toLowerCase()}:null}),E=e.computed(()=>{const o=o1.value;if(!o)return[];const s=o.query;return t.mentionItems.filter(d=>d.label.toLowerCase().includes(s)).slice(0,6)}),Z=e.computed(()=>t.showNavigator&&g.value),H=e.computed(()=>t.selectedProjectId??null),r1=e.computed(()=>t.sessions.filter(o=>!o.projectId)),a1=e.computed(()=>{const o=new Map;for(const s of t.projects)o.set(s.id,[]);for(const s of t.sessions){if(!s.projectId)continue;const d=o.get(s.projectId);d&&d.push(s)}return o});function X(o){const s=o.toLowerCase();if(s.includes("doubao-seedance-1-5-pro-251215")||s.includes("doubao seedance 1.5")||s.includes("seedance 1.5")||s.includes("seedance video"))return"jimeng:doubao-seedance-1-5-pro-251215";if(s.includes("imagen 4")||s.includes("imagen-4"))return"google:imagen-4.0-generate-001";if(s.includes("gpt-image-1")||s.includes("gpt image 1"))return"openai:gpt-image-1";if(s.includes("gpt-image-2")||s.includes("gpt image 2"))return"openai:gpt-image-2";if(s.includes("doubao-seedream-4-5-251128"))return"jimeng:doubao-seedream-4-5-251128";if(s.includes("doubao-seedream-4-0-250828"))return"jimeng:doubao-seedream-4-0-250828";if(s.includes("doubao seedream 5")||s.includes("seedream 5")||s.includes("doubao seedream 4.5")||s.includes("seedream 4.5"))return"jimeng:doubao-seedream-4-5-251128";if(s.includes("doubao seedream 4")||s.includes("seedream 4"))return"jimeng:doubao-seedream-4-0-250828";if(s.includes("auto"))return"auto";const d=o.match(/\b([a-z][a-z0-9_-]+):([a-z0-9._-]+)\b/i);if(d)return`${d[1].toLowerCase()}:${d[2]}`}function j(o){if(o!=="auto"){if(o.includes("seedance"))return"video";if(o.includes("gpt-image")||o.includes("imagen")||o.includes("seedream")||o.includes("jimeng:"))return"image"}}function D(o){const s=[],d=new Set,z=/\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 v of o.matchAll(z)){const S=v[1],K=X(S);!K||d.has(K)||(d.add(K),s.push({label:S,value:K}))}return s}function x(o,s){return o.match(new RegExp(`${s}=["']([^"']+)["']`,"i"))?.[1]}function R(o){const s={};for(const z of o.matchAll(/\[SETTING\s+([^\]]+)\]([\s\S]*?)\[\/SETTING\]/gi)){const v=z[1]??"",S=x(v,"key"),K=x(v,"value")??z[2]?.trim();if(!(!S||!K))if(S==="duration"||S==="fps"||S==="count"){const e1=Number(K);Number.isFinite(e1)&&(s[S]=e1)}else if(S==="model"){const e1=X(K)??X(z[2]?.trim()??"");e1&&(s.model=e1)}else(S==="aspect"||S==="resolution"||S==="format")&&(s[S]=K)}const d=o.split(/\r?\n/).map(z=>z.replace(/^[\s>*-]+/,"").trim()).filter(Boolean);for(const z of d){const v=z.toLowerCase();if(/(supporte|supports?|disponible|available|dur[eé]es?\s*:|ratios?\s*:|jusqu['’]?à|up to)/i.test(v))continue;const S=z.split(":").slice(1).join(":").trim()||z,K=S.match(/\b(\d{1,2}:\d{1,2})\b/);(v.includes("format")||v.includes("aspect")||v.includes("ratio"))&&K&&(s.aspect=K[1]);const e1=S.match(/\b([1248]K)\b/i);(v.includes("résolution")||v.includes("resolution"))&&e1&&(s.resolution=e1[1].toUpperCase());const _=S.match(/\b(\d{1,3})\s*(?:s|sec|secondes?|seconds?)\b/i);(v.includes("durée")||v.includes("duration"))&&_&&(s.duration=Number(_[1]));const c1=S.match(/\b(\d{1,3})\s*fps\b/i);v.includes("fps")&&c1&&(s.fps=Number(c1[1]));const l1=S.match(/\b(\d{1,2})\b/);if((v.includes("count")||v.includes("nombre")||v.includes("variantes"))&&l1&&(s.count=Number(l1[1])),v.includes("modèle")||v.includes("modele")||v.includes("model")){const b1=X(S);b1&&(s.model=b1)}v.includes("jpg")||v.includes("jpeg")?s.format="jpg":v.includes("png")?s.format="png":v.includes("webp")&&(s.format="webp")}return Object.keys(s).length?s:void 0}function n1(o){const s=o.match(/\[TASK(?:\s+([^\]]+))?\](?:([\s\S]*?)\[\/TASK\])?/i);if(s){const z=(x(s[1]??"","value")??s[2]?.trim())?.toLowerCase();if(["image","video","audio","text"].includes(String(z)))return z}const d=o.split(/\r?\n/).map(z=>z.replace(/^[\s>*-]+/,"").trim()).filter(Boolean);for(const z of d){const v=z.toLowerCase(),S=z.split(":").slice(1).join(":").trim().toLowerCase()||v;if(/(task|type|mode|surface|format|réglage|reglage|setting)/i.test(v)){if(/\baudio\b|subtitles?|sous-titres?|transcri|tts|voice|voix/.test(S))return"audio";if(/\bvid[eé]o\b|\bvideo\b|\bfps\b|duration|dur[eé]e/.test(S))return"video";if(/\bimage\b|photo|visuel|illustration|aspect|ratio|resolution|résolution/.test(S))return"image";if(/\btext\b|texte|copy|caption|script/.test(S))return"text"}}}function t1(o){const s=o.match(/\[PROMPT\]([\s\S]*?)\[\/PROMPT\]/i)?.[1];if(s){const _=s1(s).trim().replace(/^["“]|["”]$/g,"");if(_)return _}const d=o.replace(/\r\n/g,`
|
|
2
|
+
`),B=new Blob([`\uFEFF${L}`],{type:"text/csv;charset=utf-8"}),q=URL.createObjectURL(B),G=document.createElement("a");G.href=q,G.download=l.downloadFilename||"spreadsheet.csv",G.click(),URL.revokeObjectURL(q)}function T(h,L=!0){if(a.value===h)return;const B=performance.now();console.debug(`[WSpreadsheet] ${h?"expand":"minimize"} requested`),a.value=h,L&&r("update:expanded",h),requestAnimationFrame(()=>requestAnimationFrame(()=>{console.debug(`[WSpreadsheet] ${h?"expand":"minimize"} painted in ${(performance.now()-B).toFixed(1)}ms`)}))}e.watch(()=>l.expanded,h=>{h!=null&&T(h,!1)}),e.watch(()=>l.downloadRequest,(h,L)=>{h!=null&&h!==L&&f()}),p({expand:()=>{l.expandable&&T(!0)},collapse:()=>{T(!1)},toggleExpanded:()=>{l.expandable&&T(!a.value)},download:f});function U(h){h.key==="Escape"&&a.value&&T(!1)}function Y(h){if(h.target?.closest(".w-spreadsheet__cell")?.querySelector(".w-spreadsheet__input"))return;V.value=null,b.value=null;const q=document.activeElement;q&&M.value?.contains(q)&&q.blur()}e.onMounted(()=>{document.addEventListener("keydown",U),document.addEventListener("pointerdown",Y)}),e.onBeforeUnmount(()=>{document.removeEventListener("keydown",U),document.removeEventListener("pointerdown",Y),window.removeEventListener("pointerup",x)});function Q(h,L){return h.cells.find(B=>B.key===L)?.value??""}function I(h){if(typeof h=="number")return h;const L=String(h).trim().replace(/[\s,]/g,"");return L!==""&&/^-?\d+(\.\d+)?$/.test(L)?Number(L):String(h).toLocaleLowerCase()}const F=e.computed(()=>{if(!u.value)return l.rows;const h=l.rows.filter(q=>q.sortable!==!1),L=C.value==="asc"?1:-1;h.sort((q,G)=>{const $=I(Q(q,u.value)),P=I(Q(G,u.value));return typeof $=="number"&&typeof P=="number"?($-P)*L:String($).localeCompare(String(P),void 0,{numeric:!0})*L});let B=0;return l.rows.map(q=>q.sortable===!1?q:h[B++])});function N(h){const L=l.columns.find(B=>B.key===h.key);return!!(l.sortable&&h.variant==="header"&&L?.sortable!==!1)}function A(h){N(h)&&(u.value===h.key?C.value=C.value==="asc"?"desc":"asc":(u.value=h.key,C.value="asc"))}function m(h,L){return h.cells.slice(0,L).reduce((B,q)=>B+(q.colspan||1),0)}function W(h,L){return!!l.columns[m(h,L)]?.sticky}function J(h,L){const B=m(h,L);return!!(l.columns[B]?.sticky&&!l.columns.slice(0,B).some(q=>q.sticky))}function o1(h,L){const B=m(h,L);if(!l.columns[B]?.sticky)return;const q=l.columns.slice(0,B).map(G=>G.width||"0px");return{left:q.length?`calc(${q.join(" + ")})`:"0px"}}function E(h,L){return`${h.key}\0${L.key}`}function Z(h,L){!L.editable||g.value||(V.value={rowKey:h.key,cellKey:L.key},b.value=null)}function H(h,L){return V.value?.rowKey===h.key&&V.value?.cellKey===L.key}function r1(h,L,B){const q=F.value[h];!l.fillHandle||!B.editable||!q||!H(q,B)||(b.value=null,g.value={row:h,cell:L,value:String(B.value??"")},y.value={row:h,cell:L},window.addEventListener("pointerup",x,{once:!0}))}function a1(h,L){g.value&&(y.value={row:h,cell:L})}function X(h,L){if(!g.value||!y.value)return!1;const B=Math.min(g.value.row,y.value.row),q=Math.max(g.value.row,y.value.row),G=Math.min(g.value.cell,y.value.cell),$=Math.max(g.value.cell,y.value.cell);return h>=B&&h<=q&&L>=G&&L<=$}function j(h,L){if(!X(h,L)||!g.value||!y.value)return{};const B=Math.min(g.value.row,y.value.row),q=Math.max(g.value.row,y.value.row),G=Math.min(g.value.cell,y.value.cell),$=Math.max(g.value.cell,y.value.cell);return{"w-spreadsheet__cell--fill-range":!0,"w-spreadsheet__cell--fill-top":h===B,"w-spreadsheet__cell--fill-bottom":h===q,"w-spreadsheet__cell--fill-left":L===G,"w-spreadsheet__cell--fill-right":L===$}}function D(h,L){const B=E(h,L);return{"w-spreadsheet__cell--fill-completed":!!b.value?.cells.has(B),"w-spreadsheet__cell--fill-source":b.value?.source===B}}function x(){if(!g.value||!y.value)return;const h=g.value,L=y.value,B=Math.min(h.row,L.row),q=Math.max(h.row,L.row),G=Math.min(h.cell,L.cell),$=Math.max(h.cell,L.cell),P=new Set,O=F.value[h.row],s1=O?.cells[h.cell];for(let m1=B;m1<=q;m1++){const V1=F.value[m1];if(V1)for(let B1=G;B1<=$;B1++){const E1=V1.cells[B1];E1?.editable&&(P.add(E(V1,E1)),r("cell-change",{rowKey:V1.key,cellKey:E1.key,value:h.value,row:V1,cell:E1}))}}g.value=null,y.value=null,b.value=O&&s1?{cells:P,source:E(O,s1)}:null}function R(h){let L=h+1,B="";for(;L>0;)L-=1,B=String.fromCharCode(65+L%26)+B,L=Math.floor(L/26);return B}function n1(h){return[`w-spreadsheet__cell--${h.variant||"default"}`,`w-spreadsheet__cell--${h.align||"left"}`,`w-spreadsheet__cell--tone-${h.tone||"default"}`,{"w-spreadsheet__cell--wrap":!!h.wrap},h.class||""]}function t1(h,L,B){const q=B.target.value;r("cell-change",{rowKey:h.key,cellKey:L.key,value:q,row:h,cell:L})}function d1(h){const B=h.currentTarget.previousElementSibling;B?.focus(),B?.showPicker?.()}return(h,L)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"frameRef",ref:M,class:e.normalizeClass(["w-spreadsheet-frame",{"w-spreadsheet-frame--expanded":a.value}])},[a.value?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"w-spreadsheet-frame__backdrop","aria-label":"Restore spreadsheet",onClick:L[0]||(L[0]=B=>T(!1))})):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["w-spreadsheet-frame__surface",{"w-spreadsheet--plain":n.appearance==="plain"}])},[n.expandable&&(n.showExpandButton!==!1||a.value)||n.downloadable&&(n.showDownloadButton!==!1||a.value)?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["w-spreadsheet-frame__toolbar",{"w-spreadsheet-frame__toolbar--hover":n.actionsOnHover&&!a.value}])},[a.value&&h.$slots["expanded-header"]?(e.openBlock(),e.createElementBlock("div",d3,[e.renderSlot(h.$slots,"expanded-header")])):e.createCommentVNode("",!0),h.$slots["toolbar-status"]?(e.openBlock(),e.createElementBlock("div",w3,[e.renderSlot(h.$slots,"toolbar-status")])):e.createCommentVNode("",!0),e.renderSlot(h.$slots,"toolbar"),n.downloadable&&(n.showDownloadButton!==!1||a.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(k.Download),{size:16})])):e.createCommentVNode("",!0),n.expandable&&(n.showExpandButton!==!1||a.value)?(e.openBlock(),e.createElementBlock("button",{key:3,type:"button",class:"w-spreadsheet-frame__expand",title:a.value?"Restore spreadsheet":"Expand spreadsheet","aria-label":a.value?"Restore spreadsheet":"Expand spreadsheet",onClick:L[1]||(L[1]=B=>T(!a.value))},[a.value?(e.openBlock(),e.createBlock(e.unref(k.Minimize),{key:0,size:16})):(e.openBlock(),e.createBlock(e.unref(k.Expand),{key:1,size:16}))],8,u3)):e.createCommentVNode("",!0)],2)):e.createCommentVNode("",!0),n.loading?(e.openBlock(),e.createElementBlock("div",m3,[e.createVNode(G1),L[2]||(L[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":c.value}]),style:e.normalizeStyle({maxHeight:a.value?"calc(100vh - 96px)":n.maxHeight})},[e.createElementVNode("table",{class:e.normalizeClass(["w-spreadsheet__table",{"w-spreadsheet__table--sticky-columns":w.value}]),style:e.normalizeStyle({minWidth:n.minWidth})},[e.createElementVNode("colgroup",null,[i.value?(e.openBlock(),e.createElementBlock("col",h3)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.columns,B=>(e.openBlock(),e.createElementBlock("col",{key:B.key,style:e.normalizeStyle({width:B.width})},null,4))),128))]),c.value?(e.openBlock(),e.createElementBlock("thead",f3,[e.createElementVNode("tr",null,[i.value?(e.openBlock(),e.createElementBlock("th",v3)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.columns,(B,q)=>(e.openBlock(),e.createElementBlock("th",{key:B.key,class:"w-spreadsheet__axis"},e.toDisplayString(B.label||R(q)),1))),128))])])):e.createCommentVNode("",!0),e.createElementVNode("tbody",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(F.value,(B,q)=>(e.openBlock(),e.createElementBlock("tr",{key:B.key,class:e.normalizeClass({"w-spreadsheet__row--sticky":B.sticky})},[i.value?(e.openBlock(),e.createElementBlock("th",b3,e.toDisplayString(q+1),1)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(B.cells,(G,$)=>(e.openBlock(),e.createElementBlock("td",{key:G.key,class:e.normalizeClass(["w-spreadsheet__cell",[n1(G),{"w-spreadsheet__cell--sortable":N(G),"w-spreadsheet__cell--sticky":W(B,$),"w-spreadsheet__cell--sticky-first":J(B,$),"w-spreadsheet__cell--active":H(B,G)},j(q,$),D(B,G)]]),colspan:G.colspan||1,title:G.title,style:e.normalizeStyle(o1(B,$)),tabindex:N(G)?0:void 0,onClick:P=>A(G),onKeydown:[e.withKeys(e.withModifiers(P=>A(G),["prevent"]),["enter"]),e.withKeys(e.withModifiers(P=>A(G),["prevent"]),["space"])],onPointerenter:P=>a1(q,$),onPointerdown:P=>Z(B,G)},[e.renderSlot(h.$slots,`cell-${G.key}`,{row:B,cell:G,rowIndex:q},()=>[G.editable?(e.openBlock(),e.createElementBlock("div",k3,[e.createElementVNode("input",{class:e.normalizeClass(["w-spreadsheet__input",{"w-spreadsheet__input--date":G.inputType==="date"}]),type:G.inputType||"text",value:G.value??"",min:G.min,placeholder:G.placeholder,onInput:P=>t1(B,G,P)},null,42,C3),G.inputType==="date"?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"w-spreadsheet__calendar","aria-label":"Choose date",title:"Choose date",onClick:d1},[e.createVNode(e.unref(k.CalendarDays),{size:16})])):e.createCommentVNode("",!0)])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(G.value??""),1)],64))]),N(G)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(u.value===G.key?C.value==="asc"?e.unref(k.ChevronUp):e.unref(k.ChevronDown):e.unref(k.ChevronsUpDown)),{key:0,class:"w-spreadsheet__sort-icon",size:14})):e.createCommentVNode("",!0),n.fillHandle&&G.editable&&H(B,G)?(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(P=>r1(q,$,G),["stop","prevent"])},null,40,z3)):e.createCommentVNode("",!0)],46,g3))),128))],2))),128))])],6)],6))],2)],2))}}),h1=(n,p)=>{const t=n.__vccOpts||n;for(const[l,r]of p)t[l]=r;return t},x3={},B3={class:"wpic:min-w-40 wpic:rounded-lg wpic:bg-white wpic:p-1.5 wpic:shadow-md wpic:shadow-zinc-900/5 wpic:dark:bg-zinc-700 wpic:dark:shadow-black/20"};function M3(n,p){return e.openBlock(),e.createElementBlock("div",B3,[e.renderSlot(n.$slots,"default")])}const d2=h1(x3,[["render",M3]]),V3=["disabled"],D1=e.defineComponent({__name:"WActionMenuItem",props:{danger:{type:Boolean},disabled:{type:Boolean}},emits:["click"],setup(n,{emit:p}){const t=p;return(l,r)=>(e.openBlock(),e.createElementBlock("button",{type:"button",disabled:n.disabled,onClick:r[0]||(r[0]=c=>t("click",c)),class:e.normalizeClass(["wpic:flex wpic:h-8 wpic:w-full wpic:items-center wpic:gap-2 wpic:rounded-md wpic:px-2 wpic:text-left wpic:font-medium wpic:transition wpic:disabled:cursor-not-allowed wpic:disabled:opacity-40",n.danger?"wpic:text-red-500 wpic:hover:bg-red-50 wpic:dark:hover:bg-red-950/30":"wpic:text-zinc-600 wpic:hover:bg-zinc-100 wpic:hover:text-zinc-900 wpic:dark:text-zinc-100 wpic:dark:hover:bg-zinc-600 wpic:dark:hover:text-white"])},[e.renderSlot(l.$slots,"default")],10,V3))}}),D2={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"}},E3={light:["#3B73E1","#0891A6","#8B5CD6","#C58A16","#D64D79","#527FA8"],dark:["#7C9FE0","#5FB8C4","#AF94D5","#D8B26A","#D88FA5","#94A8BD"]};function F2(n,p={}){const t={...D2[n],...p},l={};for(const[r,c]of Object.entries(t))l[`--wpic-${r.replace(/[A-Z]/g,i=>`-${i.toLowerCase()}`)}`]=c;Object.assign(l,{"--wpic-legacy-bg-main":t.canvas,"--wpic-legacy-bg-card":t.surface,"--wpic-legacy-bg-input":t.input,"--wpic-legacy-border-subtle":t.border,"--wpic-legacy-border-strong":t.border,"--wpic-legacy-border-hover":t.borderHover,"--wpic-legacy-text-main":t.text,"--wpic-legacy-text-muted":t.muted,"--wpic-legacy-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});for(const[r,c]of Object.entries(l))r.startsWith("--wpic-legacy-")&&(l[r.replace("--wpic-legacy-","--")]=c);return l}const T2=Symbol("wpic-theme");function T1(){return e.inject(T2,e.computed(()=>null))}let N2=0,S2="";function A2(){N2++===0&&(S2=document.body.style.overflow,document.body.style.overflow="hidden");let n=!1;return()=>{n||(n=!0,--N2===0&&(document.body.style.overflow=S2))}}const N3=["data-wpic-theme"],S3=["aria-label"],L3={class:"wpic-bottom-sheet-header"},$3=["aria-label"],D3={key:0,class:"wpic-bottom-sheet-footer"},y1=[],r2=new Map,m2=e.defineComponent({__name:"WBottomSheet",props:{returnFocus:{},modelValue:{type:Boolean},title:{},closeLabel:{default:"Close"},noPadding:{type:Boolean}},emits:["update:modelValue"],setup(n,{emit:p}){const t=n,l=p,r=T1(),c=e.ref(null),i=Symbol("sheet"),w=e.inject("wpic-overlay-layer",e.ref(9998)),u=e.ref(1e4);e.provide("wpic-overlay-layer",u);const C=e.ref({height:0,top:0}),a=e.computed(()=>C.value.height?{height:`${C.value.height}px`,top:`${C.value.top}px`}:{}),M=Symbol.for("wpic-ui-popover-descendants"),g=e.inject(M,null),y=new Set;e.provide(M,{add(m){y.add(m),g?.add(m)},remove(m){y.delete(m),g?.remove(m)}}),e.provide("wpic-pagination-url-sync",!1),e.watch(c,(m,W)=>{W&&g?.remove(W),m&&g?.add(m)});let V=null,b=!1,f;const T=m=>!!m.getClientRects().length&&getComputedStyle(m).visibility!=="hidden";function U(){return[c.value,...y].filter(m=>!!m&&T(m)).flatMap(m=>[...m.querySelectorAll('a[href],button:not(:disabled),input:not(:disabled),select:not(:disabled),textarea:not(:disabled),[tabindex="0"]')]).filter(T)}function Y(){l("update:modelValue",!1)}function Q(m){if(!(y1[y1.length-1]!==i||I(m.target))){if(m.key==="Escape"){if([...y].some(T))return;m.preventDefault(),m.stopPropagation(),Y()}else if(m.key==="Tab"){const W=U(),J=W.indexOf(document.activeElement);if(!W.length){m.preventDefault(),c.value?.focus();return}m.shiftKey&&J<=0?(m.preventDefault(),W[W.length-1]?.focus()):!m.shiftKey&&(J<0||J===W.length-1)&&(m.preventDefault(),W[0]?.focus())}}}function I(m){const W=m.closest?.(".wpic-modal-overlay");return!!W&&Number(getComputedStyle(W).zIndex)>u.value}function F(m){if(y1[y1.length-1]!==i||I(m.target))return;const W=m.target;c.value?.contains(W)||[...y].some(J=>J.contains(W))||c.value?.focus({preventScroll:!0})}function N(){const m=window.visualViewport;C.value={height:m?.height??window.innerHeight,top:m?.offsetTop??0}}function A(){if(!b)return;b=!1;const m=y1[y1.length-1]===i;y1.splice(y1.indexOf(i),1),r2.delete(i),f?.(),f=void 0,document.removeEventListener("keydown",Q),document.removeEventListener("focusin",F),window.visualViewport?.removeEventListener("resize",N),window.visualViewport?.removeEventListener("scroll",N),m&&V?.isConnected&&V.focus({preventScroll:!0})}return e.watch(()=>t.modelValue,async m=>{if(!m){A();return}b||(b=!0,V=t.returnFocus??document.activeElement,f=A2(),u.value=Math.max(w.value,9998,...r2.values())+2,y1.push(i),r2.set(i,u.value),N(),document.addEventListener("keydown",Q),document.addEventListener("focusin",F),window.visualViewport?.addEventListener("resize",N),window.visualViewport?.addEventListener("scroll",N),await e.nextTick(),t.modelValue&&c.value?.focus({preventScroll:!0}))},{immediate:!0}),e.onBeforeUnmount(()=>{c.value&&g?.remove(c.value),A()}),(m,W)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[n.modelValue?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["wpic-bottom-sheet-overlay",{"wpic-theme":e.unref(r),dark:e.unref(r)?.mode==="dark"}]),style:e.normalizeStyle([e.unref(r)?.variables,a.value,{zIndex:u.value}]),"data-wpic-theme":e.unref(r)?.mode,onClick:e.withModifiers(Y,["self"])},[e.createElementVNode("section",{ref_key:"panel",ref:c,role:"dialog","aria-modal":"true","aria-label":n.title||n.closeLabel,tabindex:"-1",class:"wpic-bottom-sheet"},[W[0]||(W[0]=e.createElementVNode("div",{class:"wpic-bottom-sheet-handle","aria-hidden":"true"},null,-1)),e.createElementVNode("header",L3,[e.renderSlot(m.$slots,"header",{},()=>[e.createElementVNode("h2",null,e.toDisplayString(n.title),1)]),e.createElementVNode("button",{type:"button","aria-label":n.closeLabel,onClick:Y},[e.createVNode(e.unref(k.X),{size:20})],8,$3)]),e.createElementVNode("div",{class:e.normalizeClass(["wpic-bottom-sheet-body",{"wpic-bottom-sheet-padded":!n.noPadding}])},[e.renderSlot(m.$slots,"default")],2),m.$slots.footer?(e.openBlock(),e.createElementBlock("footer",D3,[e.renderSlot(m.$slots,"footer")])):e.createCommentVNode("",!0)],8,S3)],14,N3)):e.createCommentVNode("",!0)]))}});function h2(){const n=typeof window<"u"?window.matchMedia("(max-width: 767px)"):null,p=e.ref(n?.matches??!1),t=()=>{p.value=n?.matches??!1};return n?.addEventListener("change",t),e.onBeforeUnmount(()=>n?.removeEventListener("change",t)),p}const F3=["data-wpic-theme","data-unstyled"],v1=e.defineComponent({__name:"WPopover",props:{unstyled:{type:Boolean},mobileSheet:{type:Boolean},sheetTitle:{},closeLabel:{},open:{type:Boolean},anchor:{},placement:{},width:{},minWidth:{},height:{},minHeight:{},maxHeight:{},panelScroll:{type:Boolean,default:!0},offset:{},matchAnchorWidth:{type:Boolean},fitAnchorContent:{type:Boolean},freezePositionOnOpen:{type:Boolean,default:!0},flip:{type:Boolean,default:!0},autoPlacement:{type:Boolean},shiftCrossAxis:{type:Boolean},zIndex:{default:9999},extraPanels:{}},emits:["close"],setup(n,{emit:p}){const t=n,l=e.inject("wpic-overlay-layer",e.ref(0)),r=e.computed(()=>Math.max(Number(t.zIndex)||9999,l.value+1));e.provide("wpic-overlay-layer",r);const c=T1(),i=h2(),w=e.computed(()=>i.value&&t.mobileSheet),u=p,C=Symbol.for("wpic-ui-popover-descendants"),a=e.inject(C,null),M=new Set;e.provide(C,{add(E){M.add(E),a?.add(E)},remove(E){M.delete(E),a?.remove(E)}});const g=e.computed(()=>{const E=t.anchor;return E?e.isRef(E)?E.value:E:null}),y=e.ref(null),V=e.ref(null),b=e.computed(()=>V.value??t.placement??"bottom-start"),f=e.computed(()=>{const E=[i1.offset(t.offset??6)];return V.value||(t.autoPlacement?E.push(i1.autoPlacement({alignment:"start"})):t.flip&&E.push(i1.flip({crossAxis:!t.shiftCrossAxis}))),E.push(i1.shift({padding:t.autoPlacement?8:4,crossAxis:t.autoPlacement||t.shiftCrossAxis})),E.push(i1.size({padding:8,apply({availableHeight:Z,availableWidth:H,rects:r1,elements:a1}){const X=Math.max(Z-8,50),j=t.maxHeight?`min(${t.maxHeight}, ${X}px)`:`${X}px`,D={maxWidth:`${Math.max(H,0)}px`,maxHeight:j,overflowY:t.panelScroll?"auto":"hidden"};if(t.height&&(D.height=`min(${t.height}, ${X}px)`),t.minHeight&&(D.minHeight=`min(${t.minHeight}, ${X}px)`),t.matchAnchorWidth){const x=`${Math.min(r1.reference.width,Math.max(H,0))}px`;D.width=t.fitAnchorContent?"max-content":x,D.minWidth=x}Object.assign(a1.floating.style,D)}})),E}),{floatingStyles:T,placement:U,update:Y,isPositioned:Q}=i1.useFloating(g,y,{placement:b,strategy:"fixed",open:e.computed(()=>t.open),whileElementsMounted:i1.autoUpdate,middleware:f}),I=e.computed(()=>{const E=U.value;return E.startsWith("top")?"bottom":E.startsWith("bottom")?"top":E.startsWith("left")?"right":E.startsWith("right")?"left":"top"}),F=E=>{if(w.value)return;const Z=E.target,H=g.value,r1=y.value;r1&&r1.contains(Z)||[...M].some(a1=>a1.contains(Z))||H&&H.contains(Z)||t.extraPanels?.some(a1=>a1?.contains(Z))||u("close")},N=E=>{if(w.value||E.key!=="Escape"||!t.open||[...M].some(H=>H.isConnected&&H.style.display!=="none"))return;E.preventDefault(),E.stopImmediatePropagation(),u("close");const Z=g.value;Z?.matches("button, input, [tabindex]")?Z.focus():Z?.querySelector("button, input, [tabindex]")?.focus()};let A=!1,m=!1;function W(){m||(document.addEventListener("pointerdown",F,!0),document.addEventListener("keydown",N,!0),m=!0)}function J(){m&&(document.removeEventListener("pointerdown",F,!0),document.removeEventListener("keydown",N,!0),m=!1)}e.watch(()=>t.open,E=>{E?e.nextTick(()=>{A||!t.open||(t.autoPlacement&&y.value&&(y.value.style.maxHeight=""),Y(),W())}):(V.value=null,J())},{immediate:!0}),e.watch(y,(E,Z)=>{Z&&a?.remove(Z),E&&a?.add(E)}),e.watch(Q,E=>{E&&t.open&&t.freezePositionOnOpen&&!V.value&&(V.value=U.value)}),e.onBeforeUnmount(()=>{A=!0,J(),y.value&&a?.remove(y.value)});const o1=e.computed(()=>({...t.matchAnchorWidth?{}:{width:t.width??"auto"},...t.minWidth?{minWidth:t.minWidth}:{},transformOrigin:I.value,zIndex:r.value}));return(E,Z)=>w.value?(e.openBlock(),e.createBlock(m2,{key:0,"return-focus":g.value,"model-value":n.open,title:n.sheetTitle,"close-label":n.closeLabel,"no-padding":"","onUpdate:modelValue":Z[0]||(Z[0]=H=>!H&&u("close"))},{default:e.withCtx(()=>[e.renderSlot(E.$slots,"default")]),_:3},8,["return-focus","model-value","title","close-label"])):(e.openBlock(),e.createBlock(e.Teleport,{key:1,to:"body",class:"wpic-popover"},[e.withDirectives(e.createElementVNode("div",{ref_key:"floatingEl",ref:y,"data-wpic-theme":e.unref(c)?.mode,"data-unstyled":n.unstyled||void 0,class:e.normalizeClass([[{"wpic-theme":e.unref(c),dark:e.unref(c)?.mode==="dark"},!n.unstyled&&"wpic:bg-white wpic:dark:bg-zinc-900 wpic:border wpic:border-zinc-200 wpic:dark:border-zinc-800 wpic:rounded-xl wpic:shadow-xl wpic:dark:shadow-black/40 wpic:overflow-hidden"],"wpic-popover-panel wpic:flex wpic:flex-col"]),style:e.normalizeStyle([e.unref(c)?.variables,e.unref(T),o1.value])},[e.renderSlot(E.$slots,"default")],14,F3),[[e.vShow,n.open]])]))}}),T3={key:0,class:"wpic:fixed wpic:right-0 wpic:top-0 wpic:z-[9997] wpic:flex wpic:h-full wpic:w-20 wpic:items-center wpic:justify-center wpic:border-l-2 wpic:border-[var(--wpic-primary)] wpic:bg-[var(--wpic-primary)]/10 wpic:text-[var(--wpic-primary)] wpic:pointer-events-none"},A3=["data-variant","data-maximized","data-docked"],H3=["title"],P3={class:"wpic:min-w-0 wpic:flex-1 wpic:px-2 wpic:text-center"},j3={class:"wpic:truncate wpic:font-medium wpic:text-zinc-700 wpic:dark:text-zinc-200"},W3={key:0,class:"wpic:truncate wpic:text-zinc-500 wpic:dark:text-zinc-400"},R3={class:"wpic:flex wpic:shrink-0 wpic:items-center wpic:gap-1"},I3=["title"],Z3=["title"],U3=["title"],K3=["title"],O3={class:"wpic:flex wpic:h-11 wpic:shrink-0 wpic:items-center wpic:justify-between wpic:px-3"},q3={class:"wpic:font-medium wpic:text-zinc-700 wpic:dark:text-zinc-200"},Y3=["title"],Q3={class:"wpic:space-y-2 wpic:px-3 wpic:pb-3"},J3={class:"wpic:truncate"},X3={class:"wpic:flex-1 wpic:overflow-y-auto wpic:overflow-x-visible wpic:px-2 wpic:pb-3"},G3={class:"wpic:mb-2 wpic:flex wpic:h-7 wpic:items-center wpic:justify-between wpic:px-2 wpic:font-medium wpic:text-zinc-500 wpic:dark:text-zinc-400"},_3={class:"wpic:truncate"},e5=["title"],n5={class:"wpic:space-y-0.5"},t5={key:0,class:"wpic:rounded-lg wpic:border wpic:border-dashed wpic:border-zinc-200 wpic:px-2 wpic:py-2 wpic:text-zinc-500 wpic:dark:border-zinc-700 wpic:dark:text-zinc-400"},c5=["onMouseenter"],i5=["onClick"],l5={class:"wpic:min-w-0 wpic:flex-1 wpic:truncate"},a5={key:0,class:"wpic:shrink-0 wpic:text-zinc-400"},o5={key:0,class:"wpic:px-3 wpic:py-2 wpic:text-zinc-400 wpic:dark:text-zinc-500"},r5=["onPointerdown","onClick"],s5={class:"wpic:min-w-0 wpic:flex-1 wpic:truncate"},p5={class:"wpic:shrink-0 wpic:text-zinc-400"},d5={class:"wpic:mt-4"},w5={class:"wpic:flex wpic:h-7 wpic:items-center wpic:px-2 wpic:font-medium wpic:text-zinc-500 wpic:dark:text-zinc-400"},u5={class:"wpic:truncate"},m5={class:"wpic:space-y-0.5"},h5={key:0,class:"wpic:rounded-lg wpic:border wpic:border-dashed wpic:border-zinc-200 wpic:px-2 wpic:py-2 wpic:text-zinc-500 wpic:dark:border-zinc-700 wpic:dark:text-zinc-400"},f5=["onPointerdown","onClick"],v5={class:"wpic:block wpic:truncate"},b5={class:"wpic:shrink-0 wpic:text-zinc-400"},g5=["onClick"],k5=["onPointerenter","onMouseenter"],C5={class:"wpic:truncate"},z5={class:"wpic:flex wpic:min-h-0 wpic:flex-1"},y5={class:"wpic:flex wpic:min-h-0 wpic:min-w-0 wpic:flex-1 wpic:flex-col"},x5={class:"wpic:relative wpic:flex wpic:min-h-0 wpic:flex-1"},B5={key:0,class:"wpic:flex wpic:h-full wpic:flex-col wpic:items-center wpic:justify-center wpic:px-5 wpic:text-center wpic:text-zinc-500 wpic:dark:text-zinc-400"},M5={class:"wpic:font-medium"},V5={key:1,class:"wpic:flex wpic:h-full wpic:flex-col wpic:items-center wpic:justify-center wpic:px-5 wpic:text-center"},E5={class:"wpic:mb-3 wpic:flex wpic:h-11 wpic:w-11 wpic:items-center wpic:justify-center wpic:rounded-xl wpic:bg-zinc-100 wpic:text-zinc-500 wpic:dark:bg-zinc-700 wpic:dark:text-zinc-300"},N5={class:"wpic:font-semibold wpic:text-zinc-800 wpic:dark:text-zinc-100"},S5={key:0,class:"wpic:mt-1 wpic:max-w-xs wpic:text-zinc-500 wpic:dark:text-zinc-400"},L5={key:2,class:"wpic:space-y-4"},$5=["data-chat-message-index"],D5=["datetime"],F5=["src","alt"],T5={class:"wpic:max-w-40 wpic:truncate"},A5={key:0,class:"wpic:shrink-0 wpic:text-zinc-400"},H5={key:0,class:"wpic:flex wpic:items-center wpic:gap-2 wpic:text-zinc-500 wpic:dark:text-zinc-400"},P5={key:1,class:"wpic-chat-loading-card",role:"status","aria-label":"Generating image"},j5=["innerHTML","onClick"],W5=["href","onClick"],R5=["src"],I5=["title","aria-label","aria-pressed","onClick"],Z5=["title","aria-label","aria-pressed","onClick"],U5=["title","onClick"],K5=["onClick"],O5=["title","onClick"],q5=["aria-label"],Y5=["aria-label","title","aria-current","onClick"],Q5={class:"wpic-chat-panel__footer wpic:shrink-0 wpic:bg-white wpic:p-3 wpic:dark:bg-zinc-800"},J5={key:0,class:"wpic:mb-2 wpic:flex wpic:flex-wrap wpic:justify-end wpic:gap-1.5"},X5=["src","alt"],G5={class:"wpic:max-w-40 wpic:truncate"},_5={key:0,class:"wpic:shrink-0 wpic:text-zinc-400"},e4={key:1,class:"wpic:shrink-0 wpic:text-zinc-400"},n4=["title","onClick"],t4={class:"wpic-chat-panel__composer wpic:rounded-xl wpic:border wpic:border-zinc-200 wpic:bg-zinc-50 wpic:transition-colors wpic:focus-within:border-[var(--wpic-primary)]/50 wpic:dark:border-zinc-700 wpic:dark:bg-zinc-700"},c4={key:0,class:"wpic:mx-2 wpic:mt-2 wpic:overflow-hidden wpic:rounded-lg wpic:bg-white wpic:shadow-sm wpic:ring-1 wpic:ring-zinc-200 wpic:dark:bg-zinc-800 wpic:dark:ring-zinc-600"},i4=["onMousedown"],l4={class:"wpic:min-w-0 wpic:truncate wpic:font-medium wpic:text-zinc-900 wpic:dark:text-zinc-100"},a4={key:0,class:"wpic:max-w-32 wpic:shrink-0 wpic:truncate wpic:text-xs wpic:text-zinc-500 wpic:dark:text-zinc-400"},o4=["accept"],r4=["value","placeholder","disabled"],s4={class:"wpic:flex wpic:items-center wpic:gap-1"},p4=["title"],d4=["disabled","title"],L2=80,w4=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"},showAttachments:{type:Boolean,default:!0},attachments:{default:()=>[]},accept:{default:""},customAttachmentPicker:{type:Boolean,default:!1},showQuestionRail:{type:Boolean,default:!1},questionRailLabel:{default:"Questions"},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},dockedInset:{default:8},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:p}){const t=n,l=p,r=e.useSlots(),c=e.ref(null),i=e.ref(null),w=e.ref(null),u=e.ref(null),C=e.ref(null),a=e.ref(0),M=e.ref(0),g=e.ref(!1),y=e.ref(null),V=e.ref(null);let b=null;const f=e.ref(!1),T=e.ref(!1),U=e.ref(!1);e.ref(new Set);const Y=e.ref(null),Q=e.ref(null),I=e.ref({}),F=e.ref(null);let N=null;const A=e.computed(()=>F.value?[]:t.messages.filter(o=>o.role!=="system")),m=e.computed(()=>t.loading||F.value!==null),W=e.computed(()=>t.modelValue.trim().length>0&&!t.loading),J=e.computed(()=>t.attachments.length>0),o1=e.computed(()=>{const o=t.modelValue.slice(0,M.value),s=o.match(/(?:^|\s)@([^\s@]*)$/);return s?{start:o.length-s[0].length+(s[0].startsWith(" ")?1:0),query:s[1].toLowerCase()}:null}),E=e.computed(()=>{const o=o1.value;if(!o)return[];const s=o.query;return t.mentionItems.filter(d=>d.label.toLowerCase().includes(s)).slice(0,6)}),Z=e.computed(()=>t.showNavigator&&g.value),H=e.computed(()=>t.selectedProjectId??null),r1=e.computed(()=>t.sessions.filter(o=>!o.projectId)),a1=e.computed(()=>{const o=new Map;for(const s of t.projects)o.set(s.id,[]);for(const s of t.sessions){if(!s.projectId)continue;const d=o.get(s.projectId);d&&d.push(s)}return o});function X(o){const s=o.toLowerCase();if(s.includes("doubao-seedance-1-5-pro-251215")||s.includes("doubao seedance 1.5")||s.includes("seedance 1.5")||s.includes("seedance video"))return"jimeng:doubao-seedance-1-5-pro-251215";if(s.includes("imagen 4")||s.includes("imagen-4"))return"google:imagen-4.0-generate-001";if(s.includes("gpt-image-1")||s.includes("gpt image 1"))return"openai:gpt-image-1";if(s.includes("gpt-image-2")||s.includes("gpt image 2"))return"openai:gpt-image-2";if(s.includes("doubao-seedream-4-5-251128"))return"jimeng:doubao-seedream-4-5-251128";if(s.includes("doubao-seedream-4-0-250828"))return"jimeng:doubao-seedream-4-0-250828";if(s.includes("doubao seedream 5")||s.includes("seedream 5")||s.includes("doubao seedream 4.5")||s.includes("seedream 4.5"))return"jimeng:doubao-seedream-4-5-251128";if(s.includes("doubao seedream 4")||s.includes("seedream 4"))return"jimeng:doubao-seedream-4-0-250828";if(s.includes("auto"))return"auto";const d=o.match(/\b([a-z][a-z0-9_-]+):([a-z0-9._-]+)\b/i);if(d)return`${d[1].toLowerCase()}:${d[2]}`}function j(o){if(o!=="auto"){if(o.includes("seedance"))return"video";if(o.includes("gpt-image")||o.includes("imagen")||o.includes("seedream")||o.includes("jimeng:"))return"image"}}function D(o){const s=[],d=new Set,z=/\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 v of o.matchAll(z)){const S=v[1],K=X(S);!K||d.has(K)||(d.add(K),s.push({label:S,value:K}))}return s}function x(o,s){return o.match(new RegExp(`${s}=["']([^"']+)["']`,"i"))?.[1]}function R(o){const s={};for(const z of o.matchAll(/\[SETTING\s+([^\]]+)\]([\s\S]*?)\[\/SETTING\]/gi)){const v=z[1]??"",S=x(v,"key"),K=x(v,"value")??z[2]?.trim();if(!(!S||!K))if(S==="duration"||S==="fps"||S==="count"){const e1=Number(K);Number.isFinite(e1)&&(s[S]=e1)}else if(S==="model"){const e1=X(K)??X(z[2]?.trim()??"");e1&&(s.model=e1)}else(S==="aspect"||S==="resolution"||S==="format")&&(s[S]=K)}const d=o.split(/\r?\n/).map(z=>z.replace(/^[\s>*-]+/,"").trim()).filter(Boolean);for(const z of d){const v=z.toLowerCase();if(/(supporte|supports?|disponible|available|dur[eé]es?\s*:|ratios?\s*:|jusqu['’]?à|up to)/i.test(v))continue;const S=z.split(":").slice(1).join(":").trim()||z,K=S.match(/\b(\d{1,2}:\d{1,2})\b/);(v.includes("format")||v.includes("aspect")||v.includes("ratio"))&&K&&(s.aspect=K[1]);const e1=S.match(/\b([1248]K)\b/i);(v.includes("résolution")||v.includes("resolution"))&&e1&&(s.resolution=e1[1].toUpperCase());const _=S.match(/\b(\d{1,3})\s*(?:s|sec|secondes?|seconds?)\b/i);(v.includes("durée")||v.includes("duration"))&&_&&(s.duration=Number(_[1]));const c1=S.match(/\b(\d{1,3})\s*fps\b/i);v.includes("fps")&&c1&&(s.fps=Number(c1[1]));const l1=S.match(/\b(\d{1,2})\b/);if((v.includes("count")||v.includes("nombre")||v.includes("variantes"))&&l1&&(s.count=Number(l1[1])),v.includes("modèle")||v.includes("modele")||v.includes("model")){const b1=X(S);b1&&(s.model=b1)}v.includes("jpg")||v.includes("jpeg")?s.format="jpg":v.includes("png")?s.format="png":v.includes("webp")&&(s.format="webp")}return Object.keys(s).length?s:void 0}function n1(o){const s=o.match(/\[TASK(?:\s+([^\]]+))?\](?:([\s\S]*?)\[\/TASK\])?/i);if(s){const z=(x(s[1]??"","value")??s[2]?.trim())?.toLowerCase();if(["image","video","audio","text"].includes(String(z)))return z}const d=o.split(/\r?\n/).map(z=>z.replace(/^[\s>*-]+/,"").trim()).filter(Boolean);for(const z of d){const v=z.toLowerCase(),S=z.split(":").slice(1).join(":").trim().toLowerCase()||v;if(/(task|type|mode|surface|format|réglage|reglage|setting)/i.test(v)){if(/\baudio\b|subtitles?|sous-titres?|transcri|tts|voice|voix/.test(S))return"audio";if(/\bvid[eé]o\b|\bvideo\b|\bfps\b|duration|dur[eé]e/.test(S))return"video";if(/\bimage\b|photo|visuel|illustration|aspect|ratio|resolution|résolution/.test(S))return"image";if(/\btext\b|texte|copy|caption|script/.test(S))return"text"}}}function t1(o){const s=o.match(/\[PROMPT\]([\s\S]*?)\[\/PROMPT\]/i)?.[1];if(s){const _=s1(s).trim().replace(/^["“]|["”]$/g,"");if(_)return _}const d=o.replace(/\r\n/g,`
|
|
3
3
|
`).split(`
|
|
4
4
|
`),z=[];let v=!1,S=!1,K=!1;for(const _ of d){const c1=_.trim().replace(/^[\s>*-]+/,"").replace(/^#{1,6}\s+/,"").replace(/^\*\*|\*\*$/g,"").trim();if(S){if(/^```/.test(c1))break;z.push(_);continue}if(!v){const l1=c1.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(!l1){K||=/\bprompt\b/i.test(c1),K&&/^```/.test(c1)&&(v=!0,S=!0);continue}v=!0,l1[1]?.trim()&&z.push(l1[1].trim());continue}if(/^(?:r[eé]glages?(?:\s+recommand[eé]s?)?|settings?|mod[eè]le|model)\s*:/i.test(c1))break;z.push(_)}return s1(z.join(`
|
|
5
5
|
`)).trim().replace(/^["“]|["”]$/g,"")||void 0}function d1(o){return/\[PROMPT\]([\s\S]*?)\[\/PROMPT\]/i.test(o)}function h(o){return/\[TASK(?:\s+[^\]]+)?\]/i.test(o)}function L(o){const s=o.match(/\[TASK(?:\s+([^\]]+))?\]([\s\S]*?)\[\/TASK\]/i),d=`${s?.[1]??""} ${s?.[2]??""}`.toLowerCase();return d1(o)&&(/\bimage\b/.test(d)||!h(o))}function B(o){return/\[(?:TASK|PROMPT|SETTING)\b/i.test(o)}function q(o){const s=z=>Array.isArray(z)?z.flatMap(v=>{if(!v||typeof v!="object")return[];const S=v,K=typeof S.url=="string"?S.url:null;return K?[{type:typeof S.type=="string"?S.type:"image",url:K,posterUrl:typeof S.posterUrl=="string"?S.posterUrl:null,width:typeof S.width=="number"?S.width:null,height:typeof S.height=="number"?S.height:null,generationId:typeof S.generationId=="string"?S.generationId:null,href:typeof S.href=="string"?S.href:null}]:[]}):[],d=o.metadata?.generatedMedia;return s(d).filter(z=>z.type==="image"||!z.type)}function G(o){const s=o.metadata?.attachments;return Array.isArray(s)?s.flatMap((d,z)=>{if(!d||typeof d!="object")return[];const v=d,S=v.metadata&&typeof v.metadata=="object"?v.metadata:{},K=typeof v.name=="string"&&v.name.trim()?v.name.trim():`Attachment ${z+1}`;return[{id:typeof v.id=="string"?v.id:`${o.id??"message"}-attachment-${z}`,name:K,mimeType:typeof v.mimeType=="string"?v.mimeType:null,bytes:typeof v.bytes=="number"?v.bytes:null,status:"ready",displayUrl:typeof v.displayUrl=="string"?v.displayUrl:typeof S.displayUrl=="string"?S.displayUrl:null,publicUrl:typeof v.publicUrl=="string"?v.publicUrl:typeof S.publicUrl=="string"?S.publicUrl:null,assetId:typeof v.assetId=="string"?v.assetId:null,mediaItemId:typeof v.mediaItemId=="string"?v.mediaItemId:null,metadata:S}]}):[]}function $(o){const s=o.metadata&&typeof o.metadata=="object"?o.metadata:{},d=o.mimeType??"",z=typeof s.kind=="string"?s.kind:"",v=o.displayUrl??(typeof s.displayUrl=="string"?s.displayUrl:null);return!v||!d.startsWith("image/")&&z!=="image"?null:v}function P(o){if(o.role!=="assistant"||!o.streaming)return!1;const s=o.content.trim();return s==="Generating image..."||B(s)}function O(o){return o.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 s1(o){return o.replace(/\[PROMPT\]|\[\/PROMPT\]/gi,"").replace(/\[SETTING\s+[^\]]*\]|\[\/SETTING\]/gi,"").replace(/\[TASK\s+[^\]]*\]|\[\/TASK\]/gi,"").split(`
|
package/dist/wpic-ui.css
CHANGED
|
@@ -392,7 +392,7 @@ input[type="range"].wpic-legacy-slider-themed::-webkit-slider-thumb {
|
|
|
392
392
|
outline-offset: 0;
|
|
393
393
|
box-shadow: 0 0 0 3px var(--wpic-focus-ring);
|
|
394
394
|
}
|
|
395
|
-
.wpic-theme.wpic-popover-panel {
|
|
395
|
+
.wpic-theme.wpic-popover-panel:not([data-unstyled]) {
|
|
396
396
|
background: var(--wpic-popover);
|
|
397
397
|
border-color: var(--wpic-border);
|
|
398
398
|
color: var(--wpic-text);
|
package/dist/wpic-ui.js
CHANGED
|
@@ -1285,9 +1285,10 @@ function a0() {
|
|
|
1285
1285
|
};
|
|
1286
1286
|
return n?.addEventListener("change", c), O1(() => n?.removeEventListener("change", c)), w;
|
|
1287
1287
|
}
|
|
1288
|
-
const i4 = ["data-wpic-theme"], U1 = /* @__PURE__ */ X({
|
|
1288
|
+
const i4 = ["data-wpic-theme", "data-unstyled"], U1 = /* @__PURE__ */ X({
|
|
1289
1289
|
__name: "WPopover",
|
|
1290
1290
|
props: {
|
|
1291
|
+
unstyled: { type: Boolean },
|
|
1291
1292
|
mobileSheet: { type: Boolean },
|
|
1292
1293
|
sheetTitle: {},
|
|
1293
1294
|
closeLabel: {},
|
|
@@ -1409,7 +1410,8 @@ const i4 = ["data-wpic-theme"], U1 = /* @__PURE__ */ X({
|
|
|
1409
1410
|
ref_key: "floatingEl",
|
|
1410
1411
|
ref: S,
|
|
1411
1412
|
"data-wpic-theme": m(l)?.mode,
|
|
1412
|
-
|
|
1413
|
+
"data-unstyled": n.unstyled || void 0,
|
|
1414
|
+
class: g([[{ "wpic-theme": m(l), dark: m(l)?.mode === "dark" }, !n.unstyled && "wpic:bg-white wpic:dark:bg-zinc-900 wpic:border wpic:border-zinc-200 wpic:dark:border-zinc-800 wpic:rounded-xl wpic:shadow-xl wpic:dark:shadow-black/40 wpic:overflow-hidden"], "wpic-popover-panel wpic:flex wpic:flex-col"]),
|
|
1413
1415
|
style: h1([m(l)?.variables, m(O), y1.value])
|
|
1414
1416
|
}, [
|
|
1415
1417
|
N(j.$slots, "default")
|
package/package.json
CHANGED
package/src/style.css
CHANGED
|
@@ -391,7 +391,7 @@ input[type="range"].wpic-legacy-slider-themed::-webkit-slider-thumb {
|
|
|
391
391
|
outline-offset: 0;
|
|
392
392
|
box-shadow: 0 0 0 3px var(--wpic-focus-ring);
|
|
393
393
|
}
|
|
394
|
-
.wpic-theme.wpic-popover-panel {
|
|
394
|
+
.wpic-theme.wpic-popover-panel:not([data-unstyled]) {
|
|
395
395
|
background: var(--wpic-popover);
|
|
396
396
|
border-color: var(--wpic-border);
|
|
397
397
|
color: var(--wpic-text);
|