ingred-ui 31.0.0 → 31.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1093,7 +1093,7 @@ object-assign
1093
1093
  z-index: 1;
1094
1094
  `,hd=t=>{var{value:n,multiple:r=!1,disabled:a=!1,placeholder:o="選択してください",size:l="medium",variant:c="light",tagVariant:u,tagOverflow:d="truncate",showBulkActions:p=!1,selectAllLabel:f="すべて選択",clearAllLabel:m="すべてクリア",searchable:h=!1,searchPlaceholder:g="検索",noResultsMessage:b="見つかりませんでした",error:v=!1,applyButtonText:x="適用",cancelButtonText:y="キャンセル",children:w,onChange:C,onTempChange:E,width:I,minWidth:k,placement:M,middleware:A}=t,$=s(t,["value","multiple","disabled","placeholder","size","variant","tagVariant","tagOverflow","showBulkActions","selectAllLabel","clearAllLabel","searchable","searchPlaceholder","noResultsMessage","error","applyButtonText","cancelButtonText","children","onChange","onTempChange","width","minWidth","placement","middleware"]);const[S,L]=e.useState(!1),[O,V]=e.useState(""),[R,H]=e.useState([]),[N,z]=e.useState(!1),T=e.useRef(null),Z=e.useMemo((()=>u||("light"===c?"dark":"light")),[c,u]),B=e.useMemo((()=>r?Array.isArray(n)?n:[]:void 0!==n?[n]:[]),[n,r]),P=e.useMemo((()=>{if(!w)return[];const t=[],n=r=>{e.Children.forEach(r,(r=>{if(!e.isValidElement(r))return;const a=r;if(a.type&&"string"!=typeof a.type){const e=a.type.displayName||a.type.name;if("Select2Option"===e){const e=a.props.value,n=a.props.children,r=!!a.props.disabled,i=a.props.prepend,o=a.props.append;void 0!==e&&t.push({value:e,label:String(n),disabled:r,prepend:i,append:o})}else"Select2OptionGroup"===e&&a.props.children&&n(a.props.children)}}))};return n(w),t}),[w]),_=e.useCallback((e=>{null==C||C(e)}),[C]),F=e.useCallback((e=>{a||(L(e),e&&r&&H([...B]),e||V(""))}),[a,r,B]),G=e.useCallback((e=>{e.disabled||(_(e.value),L(!1),V(""))}),[_]),Y=e.useCallback(((e,t)=>{t.disabled||H((n=>e?[...n,t.value]:n.filter((e=>e!==t.value))))}),[]),j=e.useCallback((()=>{r&&_(R),L(!1),V("")}),[_,r,R]),W=e.useCallback((()=>{L(!1),V("")}),[]),X=e.useCallback((e=>{if(r&&Array.isArray(n)){const t=n.filter((t=>t!==e));_(t)}}),[r,n,_]),J=e.useCallback((e=>{V(e.target.value)}),[]),U=e.useCallback((e=>{e.stopPropagation(),V("")}),[]),Q=e.useCallback((()=>{a||F(!S)}),[a,F,S]),q=e.useMemo((()=>P.find((e=>e.value===n))),[P,n]),K=e.useMemo((()=>r&&Array.isArray(n)?P.filter((e=>n.includes(e.value))):[]),[r,P,n]),ee=e.useMemo((()=>{if(!h||!O)return P;const e=O.trim();if(!e)return P;const t=e.includes(","),n=e.startsWith('"')&&e.endsWith('"'),r=Tc(e);return P.filter((a=>{const i=a.label.toLowerCase();return n?r.some((e=>i===e.toLowerCase())):t?r.some((e=>i.includes(e.toLowerCase()))):i.includes(e.toLowerCase())}))}),[P,O,h]),te=e.useCallback((()=>{const e=ee.filter((e=>!e.disabled)).map((e=>e.value));H((t=>[...new Set([...t,...e])]))}),[ee]),ne=e.useCallback((()=>{H([])}),[]),re=e.useCallback((()=>{T.current&&"wrap"!==d&&z(T.current.scrollWidth>T.current.clientWidth)}),[d]);e.useEffect((()=>{if(!window.ResizeObserver)return;if(!T.current)return;re();const e=new window.ResizeObserver((()=>{T.current&&re()}));return e.observe(T.current),()=>{e.disconnect()}}),[re,K,d]),e.useEffect((()=>{r&&Array.isArray(n)&&H(n)}),[r,n]),e.useEffect((()=>{r&&"function"==typeof E&&E(R)}),[r,R]);const ae=e.useMemo((()=>p&&r?i.default.createElement(fd,null,i.default.createElement(Qu,{content:f,positionPriority:["top"],offset:[0,8],disabled:0===ee.length},i.default.createElement(As,{icon:i.default.createElement(D,{name:"check_thin",color:"currentColor"}),size:"small",color:"secondaryDark",disabled:0===ee.length,onClick:te})),i.default.createElement(Qu,{content:m,positionPriority:["top"],offset:[0,8],disabled:0===ee.length},i.default.createElement(As,{icon:i.default.createElement(D,{name:"close",color:"currentColor"}),size:"small",color:"secondaryDark",disabled:0===ee.length,onClick:ne}))):null),[p,r,f,m,ee,te,ne]),ie=e.useMemo((()=>h&&p&&r?i.default.createElement(dd,null,i.default.createElement(pd,null,i.default.createElement(ud,{autoFocus:!0,placeholder:g,value:O,onChange:J}),O&&i.default.createElement(md,{type:"button","aria-label":"検索をリセット",onClick:U},i.default.createElement(D,{name:"close_circle",type:"fill",color:"currentColor"}))),ae):h?i.default.createElement(dd,null,i.default.createElement(pd,null,i.default.createElement(ud,{autoFocus:!0,placeholder:g,value:O,onChange:J}),O&&i.default.createElement(md,{type:"button","aria-label":"検索をリセット",onClick:U},i.default.createElement(D,{name:"close_circle",type:"fill",color:"currentColor"})))):p&&r?ae:null),[h,p,r,O,g,J,U,ae]),oe=e.useMemo((()=>r?i.default.createElement(is,null,i.default.createElement(As,{color:"clear",size:"small",onClick:W},y),i.default.createElement(As,{color:"primary",size:"small",onClick:j},x)):null),[r,j,W,x,y]),le=i.default.createElement(td,Object.assign({$disabled:a,$error:v,$hasValue:r?Array.isArray(n)&&n.length>0:!!q,$isOpen:S,$multiple:r,$size:l,$variant:c,"aria-expanded":S,"aria-invalid":v,disabled:a,role:"combobox",type:"button"},$),r&&Array.isArray(n)&&0===n.length?i.default.createElement(sd,{$disabled:a,$variant:c},o):!r&&i.default.createElement(rd,null,q?i.default.createElement(i.default.Fragment,null,q.prepend&&i.default.createElement(id,{$size:l,$disabled:a},i.default.isValidElement(q.prepend)&&q.prepend.type===D?i.default.cloneElement(q.prepend,{size:parseInt(qu[l].iconSize,10),color:q.prepend.props.color||"currentColor"}):q.prepend),i.default.createElement(ad,null,q.label)):i.default.createElement(sd,{$disabled:a,$variant:c},o)),i.default.createElement(cd,{$disabled:a,$size:l,$multiple:r},i.default.createElement(D,{name:"arrow_down",color:"currentColor"})));return i.default.createElement(Ku,null,i.default.createElement(ed,{$disabled:a,$error:v,$isOpen:S,$size:l,$variant:c,$tagOverflow:d,"data-disabled":a,"data-overflowing":"wrap"!==d&&N,style:{cursor:r||a?"default":"pointer"}},i.default.createElement(es,null,i.default.createElement(Kl,{noResultsMessage:h?b:void 0,open:S,stickyFooter:oe,stickyHeader:ie,trigger:le,width:I,minWidth:k,placement:M,middleware:A,onOpenChange:F},(()=>{const t=h&&!!O?new Set(ee.map((e=>e.value))):void 0;if(w){const a=((t,a)=>{const o=[];let l=null;const s=(e,t,o)=>{const l=e.props.value,s=!!e.props.disabled,c=e.props.children,u=e.props.prepend,d=e.props.append;if(a&&!a.has(l))return null;const p=r?R.includes(l):l===n;return i.default.createElement(Aa,{key:`${t}-${o}`,checked:p,closeOnChange:!r,disabled:s,tabIndex:0,prepend:u,append:d,onChange:()=>{r?Y(!p,{value:l,label:String(c),disabled:s,prepend:u,append:d}):G({value:l,label:String(c),disabled:s,prepend:u,append:d})}},c)},c=()=>{if(null===l)return;const e=l,t=e.options.map(((t,n)=>s(t,`option-${e.label}`,n))).filter(Boolean);0!==t.length&&(o.push(i.default.createElement(ts,{key:`heading-${e.label}`},e.label)),o.push(...t))};return e.Children.forEach(t,(t=>{if(!e.isValidElement(t))return;const n=t;if(n.type&&"string"!=typeof n.type){const t=n.type.displayName||n.type.name;if("Select2OptionGroup"===t)null!==l&&c(),l={label:n.props.label,options:[]},n.props.children&&e.Children.forEach(n.props.children,(t=>{if(e.isValidElement(t)){const e=t;"Select2Option"===(e.type.displayName||e.type.name)&&null!==l&&l.options.push(e)}}));else if("Select2Separator"===t)o.length>0&&o.push(i.default.createElement(as,{key:`separator-${o.length}`}));else if("Select2Option"===t)if(null!==l)l.options.push(n);else{const e=n.props.value;if(a&&!a.has(e))return;o.push(s(n,"option",o.length))}else o.push(n)}})),null!==l&&c(),o})(w,t);return 0===a.length?i.default.createElement(Fl,{message:b}):a}return ee.length>0?ee.map((e=>{const t=r?R.includes(e.value):e.value===n;return i.default.createElement(Aa,{key:e.value.toString(),checked:t,closeOnChange:!r,disabled:e.disabled,tabIndex:0,prepend:e.prepend,append:e.append,onChange:()=>{r?Y(!t,e):G(e)}},e.label)})):i.default.createElement(Fl,{message:b})})())),r&&i.default.createElement(nd,{$tagOverflow:d},i.default.createElement(od,{ref:T,$tagOverflow:d,"data-testid":"tag-container",onClick:Q},K.map((e=>{const t=a?void 0:()=>X(e.value);return i.default.createElement(ld,{key:e.value.toString(),disabled:a,label:e.label,size:l,variant:Z,onRemove:t})}))))))},gd=e=>null;gd.displayName="Select2Option";const bd=e=>null;bd.displayName="Select2OptionGroup";const vd=()=>null;vd.displayName="Select2Separator";const xd=o.default(X)`
1095
1095
  ${v}
1096
- `,yd=i.forwardRef((function({children:e,size:t="md"},n){const r=k();return i.createElement(V,{ref:n,display:"flex",alignItems:"center"},i.createElement(ms,{pr:.5},i.createElement(D,{name:"alert",type:"fill",color:r.palette.danger.base,size:"sm"===t?"sm-md":t})),i.createElement(xd,{color:r.palette.danger.base,size:t},e))})),wd=e=>{const{inputType:t,selectedValues:n,selectedRadioValue:r,startDate:a,endDate:i,value:o,isRangeOperator:l}=e;return"checkbox"===t?n:"radio"===t?[r]:l?[a,i]:[o]},Cd=(e,t)=>{const n=Ie(e).find((e=>e.value===t));return(null==n?void 0:n.label)||t},Ed=e=>{const{conditionConfig:t,inputType:n,operator:r,values:a,dateFormat:i}=e;return a.map((e=>{if("checkbox"===n||"radio"===n){const n=((e,t)=>{if(t){const n=e.operators.find((e=>e.value===t));if(null==n?void 0:n.options)return n.options}return e.options||[]})(t,r).find((t=>t.value===e));return(null==n?void 0:n.label)||String(e)}if("date"===n&&i){const t=String(e);if(!t||""===t.trim())return t;const n=ss(t,"YYYY-MM-DD");return n.isValid()?n.format(i):t}return String(e)}))},Id=e=>{const{inputType:t,operator:n,selectedValues:r,selectedRadioValue:a,startDate:i,endDate:o,value:l,isRangeOperator:s,customValidation:c}=e;if("checkbox"===t){if(0===r.length)return{isValid:!1,errorMessage:"少なくとも1つの項目を選択してください"}}else if("radio"===t){if(""===a||null==a)return{isValid:!1,errorMessage:"項目を選択してください"}}else if(s){if(!i||!o)return{isValid:!1,errorMessage:"開始日と終了日の両方を選択してください"}}else if(!l||""===l.trim())return{isValid:!1,errorMessage:"date"===t?"日付を選択してください":"値を入力してください"};if(c){let e;return e="checkbox"===t?r:"radio"===t?[a]:s?[i,o]:[l],c(e,n)}return s&&new Date(i)>new Date(o)?{isValid:!1,errorMessage:"開始日は終了日より前である必要があります"}:{isValid:!0,errorMessage:""}},kd=e=>{const{inputType:t,selectedValues:n,selectedRadioValue:r,startDate:a,endDate:i,value:o,isRangeOperator:l}=e;return"checkbox"===t?n.length>0:"radio"===t?""!==r&&null!=r:l?!(!a||!i):!(!o||""===o.trim())},Md=e=>!1!==e.required,Ad=(e,t)=>{const n=Ce(t,e.conditionKey);return n?{condition:e,conditionConfig:n}:null},$d=e=>{const{condition:t,conditionConfig:n}=e,r=ke(n,t.operator),a=Me(n,t.operator);return kd({inputType:r,selectedValues:t.selectedValues,selectedRadioValue:t.selectedRadioValue,startDate:t.startDate,endDate:t.endDate,value:t.value,isRangeOperator:a})},Sd=e=>{const{condition:t,conditionConfig:n}=e,r=ke(n,t.operator),a=Me(n,t.operator);return Id({inputType:r,operator:t.operator,selectedValues:t.selectedValues,selectedRadioValue:t.selectedRadioValue,startDate:t.startDate,endDate:t.endDate,value:t.value,isRangeOperator:a,customValidation:n.customValidation})},Dd={MENU_WIDTH:160,CONFIG_PANEL_WIDTH:264,DEFAULT_MENU_POSITION:24,TAG_SPACING:8,TAG_OFFSET_MULTIPLE:40,ESTIMATED_TAG_WIDTH:120,ICON_AREA_WIDTH:24,CLEAR_BUTTON_WIDTH:16,FALLBACK_POSITION_X:80,FALLBACK_POSITION_Y:148,CONFIG_PANEL_HEADER_HEIGHT:60,CONFIG_PANEL_BUTTON_HEIGHT:50,CONFIG_PANEL_PADDING:16,CONFIG_PANEL_MIN_CONTENT_HEIGHT:200,TRANSITION_DURATION:200,MIN_VALUE_LENGTH:1},Ld="[data-tag]",Od='[role="menu"]',Vd='[data-advanced-filter-trigger="true"]',Rd='[role="button"]',Hd=({options:e,selectedValues:t,onValueToggle:n})=>i.default.createElement(_e,null,e.map((e=>i.default.createElement(Aa,{key:String(e.value),checked:t.includes(e.value),onChange:t=>n(e.value,t)},e.label))));Hd.displayName="CheckboxValueInput";const Nd=({options:e,selectedRadioValue:t,onRadioChange:n})=>i.default.createElement(_e,null,e.map((e=>i.default.createElement(Aa,{key:String(e.value),checked:t===e.value,onChange:t=>{t&&n(e.value)}},e.label))));Nd.displayName="RadioValueInput";const zd=640,Td=["日","月","火","水","木","金","土"],Zd={components:{ConfirmModal:{defaultProps:{confirmText:"確認",cancelText:"キャンセル"}},FullSizeConfirmModal:{defaultProps:{confirmText:"確認",cancelText:"キャンセル"}},FileUploader:{defaultProps:{title:"ファイルをドラッグ&ドロップ、またはここをクリック"}},ItemEmpty:{defaultProps:{title:"見つかりませんでした。"}},Select:{defaultProps:{placeholder:"選択...",emptyMessage:"見つかりません"}},CreatableSelect:{defaultProps:{placeholder:"選択...",emptyMessage:"見つかりません",addMessage:"次の文字列を追加する"}},MultipleFilter:{defaultProps:{placeholder:"新しいフィルターを追加してください"}},FilterCard:{defaultProps:{applyButtonTitle:"適用",inputErrorText:"入力してください",formPlaceholder:"検索",sectionTitle:"セクション"}},EditFilterCard:{defaultProps:{}},DatePicker:{defaultProps:{monthFormat:"YYYY年MM月",weekConfig:{start:0,labels:[...Td]}}},DateRangePicker:{defaultProps:{monthFormat:"YYYY年MM月",weekConfig:{start:0,labels:[...Td]},applyButtonText:"適用",cancelButtonText:"キャンセル"}},WeekTime:{defaultProps:{weekList:["月","火","水","木","金","土","日"]}},WeekTimeSelector:{defaultProps:{weekList:["月","火","水","木","金","土","日"]}},DualListBox:{defaultProps:{selectedItemTitle:"個選択済み"}}}},Bd={components:{DatePicker:{defaultProps:{monthFormat:"MMM YYYY",weekConfig:{start:0,labels:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]}}},DateRangePicker:{defaultProps:{monthFormat:"MMM YYYY",weekConfig:{start:0,labels:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},applyButtonText:"Apply",cancelButtonText:"Cancel"}},WeekTime:{defaultProps:{weekList:["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]}},WeekTimeSelector:{defaultProps:{weekList:["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]}},DualListBox:{defaultProps:{selectedItemTitle:"selected"}}}},Pd=i.createContext({locale:Bd});function _d(e){var t,n;const{name:r,props:a}=e,o=i.default.useContext(Pd).locale,l=Object.assign({},a);if(!o||!o.components)return l;const s=null===(n=null===(t=o.components)||void 0===t?void 0:t[r])||void 0===n?void 0:n.defaultProps;for(const e in s)void 0===l[e]&&(l[e]=s[e]);return l}const Fd=e.forwardRef((function(t,n){const r=_d({props:t,name:"DatePicker"}),{date:a,format:o="YYYY-MM-DD",disabled:l=!1,size:s="medium",variant:c="light",width:u,monthFormat:d,weekConfig:p,showDateFields:f=!1,showTimeFields:m=!1,timeFieldProps:h,useCalendarRange:g=!1,isOutsideRange:b,error:v=!1,errorText:x,defaultPresetButton:y,presetButtons:w,onPresetButtonClick:C,onDateChange:E,onDatesChange:I,endDate:M}=r,A=k(),[$,S]=e.useState(!1),{context:L,refs:O,strategy:R,x:H,y:N}=oa({placement:"bottom-start",open:$,onOpenChange:S,middleware:[sn(10),ln(),cn({padding:8})]}),z=aa(L),T=ha(L),{getReferenceProps:Z,getFloatingProps:B}=sa([z,T]),P=e.useCallback((()=>{l||S((e=>!e))}),[l]),_=e.useCallback((e=>{E(e),S(!1)}),[E]),F=e.useMemo((()=>i.default.createElement(D,{name:"date_range",color:l?A.palette.neutral.base:A.palette.text.accent})),[l,A]),G=e.useMemo((()=>"100%"===u||"string"==typeof u&&u.includes("100%")?{width:"100%"}:{width:"fit-content"}),[u]);return i.default.createElement(V,{ref:n,style:G},i.default.createElement("div",Object.assign({ref:O.setReference},Z()),i.default.createElement(CC,{date:a,format:o,error:v,errorText:x,disabled:l,size:s,variant:c,width:u,append:F,onDateChange:E,onAppendClick:P})),$&&i.default.createElement(Jr,null,i.default.createElement(qr,{context:L,modal:!1,initialFocus:-1,returnFocus:!1},g?i.default.createElement(qf,Object.assign({ref:O.setFloating,startDate:a,endDate:M||a,monthFormat:d,weekConfig:p,defaultPresetButton:y,presetButtons:w,showDateFields:f,showTimeFields:m,timeFieldProps:h,dateFieldFormat:o,isOutsideRange:b,style:{position:R,top:null!=N?N:0,left:null!=H?H:0,zIndex:A.depth.calendarRange,overflow:"hidden",maxWidth:"min(640px, calc(100vw - 16px))"},onPresetButtonClick:C,onDatesChange:I},B())):i.default.createElement(Df,Object.assign({ref:O.setFloating,date:a,monthFormat:d,weekConfig:p,defaultPresetButton:y,presetButtons:w,showDateFields:f,showTimeFields:m,timeFieldProps:h,dateFieldFormat:o,isOutsideRange:b,style:{position:R,top:null!=N?N:0,left:null!=H?H:0,zIndex:A.depth.calendar,overflow:"hidden",maxWidth:"min(640px, calc(100vw - 16px))"},onPresetButtonClick:C,onDateChange:_},B())))))}));var Gd=e.memo(Fd);const Yd=({startDate:t,endDate:n,onStartDateChange:r,onEndDateChange:a,format:o="YYYY-MM-DD"})=>{const l=e.useMemo((()=>{if(t&&""!==t.trim()){const e=ss(t,"YYYY-MM-DD");return e.isValid()?e:ss()}return ss()}),[t]),s=e.useMemo((()=>{if(n&&""!==n.trim()){const e=ss(n,"YYYY-MM-DD");return e.isValid()?e:ss()}return ss()}),[n]);return i.default.createElement(Ne,null,i.default.createElement(Te,null,i.default.createElement(Pe,{htmlFor:"start-date-picker"},"開始日"),i.default.createElement(Gd,{date:l,format:o,variant:"dark",width:"100%",onDateChange:e=>{r(e.format("YYYY-MM-DD"))}})),i.default.createElement(Te,null,i.default.createElement(Pe,{htmlFor:"end-date-picker"},"終了日"),i.default.createElement(Gd,{date:s,format:o,variant:"dark",width:"100%",onDateChange:e=>{a(e.format("YYYY-MM-DD"))}})))};Yd.displayName="DateRangeInput";const jd=({inputType:t,value:n,placeholder:r,onValueChange:a,onKeyDown:o,format:l="YYYY-MM-DD"})=>{const s=e.useMemo((()=>{if("date"===t&&n&&""!==n.trim()){const e=ss(n,"YYYY-MM-DD");return e.isValid()?e:ss()}return ss()}),[t,n]),c=e=>{const t=e.format("YYYY-MM-DD");a(t)};return"date"===t?i.default.createElement(Be,null,i.default.createElement(Gd,{date:s,format:l,variant:"dark",width:"100%",onDateChange:c})):i.default.createElement(Ze,null,i.default.createElement(Zl,{type:"text",value:n,placeholder:r,fullWidth:!0,variant:"dark",onChange:e=>a(e.target.value),onKeyDown:o}))};jd.displayName="TextValueInput";const Wd=({filterConfig:e,operator:t,value:n,selectedValues:r,selectedRadioValue:a,startDate:o,endDate:l,onValueChange:s,onValueToggle:c,onRadioChange:u,onStartDateChange:d,onEndDateChange:p,onKeyDown:f,isRangeOperator:m})=>{const h=de(e,t);return"checkbox"===h?i.default.createElement(Hd,{options:fe(e,t),selectedValues:r,onValueToggle:c}):"radio"===h?i.default.createElement(Nd,{options:fe(e,t),selectedRadioValue:a,onRadioChange:u}):m(t)?i.default.createElement(Yd,{startDate:o,endDate:l,format:me(e),onStartDateChange:d,onEndDateChange:p}):i.default.createElement(jd,{inputType:h,value:n,placeholder:pe(e),format:"date"===h?me(e):void 0,onValueChange:s,onKeyDown:f})};Wd.displayName="ConfigPanelValueInput";const Xd=(e,t,n)=>{if(!t)return((e,t)=>{const n=Ee(e),r=ke(e,n);let a="",i="",o="";return Me(e,n)?(i=t,o=t):"date"===r&&(a=t),{id:`condition_${e.conditionKey}`,conditionKey:e.conditionKey,conditionLabel:e.conditionLabel,operator:n,value:a,selectedValues:[],selectedRadioValue:"",startDate:i,endDate:o}})(e,n);let r="",a=[],i="",o="",l="";if((t.isRange||!1)&&t.values.length>=2)o="string"==typeof t.values[0]?t.values[0]:"",l="string"==typeof t.values[1]?t.values[1]:"";else if(t.values.length>0){const e=t.values[0];"string"==typeof e&&(r=e),a=t.values,i=e}return{id:`condition_${e.conditionKey}`,conditionKey:t.conditionKey,conditionLabel:t.conditionLabel,operator:t.operator,value:r,selectedValues:a,selectedRadioValue:i,startDate:o,endDate:l}},Jd=({filterConfig:e,multiConditionState:t,onKeyDown:n})=>{const{conditions:r,updateConditionOperator:a,updateConditionValue:o,updateConditionSelectedValues:l,updateConditionSelectedRadioValue:s,updateConditionStartDate:c,updateConditionEndDate:u}=t,d=we(e);return i.default.createElement("div",null,d.map(((t,p)=>{const f=r.find((e=>e.conditionKey===t.conditionKey));if(!f)return null;const m=ke(t,f.operator),h=Me(t,f.operator),g=d.length>=2;return i.default.createElement("div",{key:f.id},p>0&&i.default.createElement(as,null),g&&i.default.createElement(ts,null,t.conditionLabel),i.default.createElement(Ke,null,i.default.createElement(hd,{value:f.operator,variant:"dark",onChange:e=>{"string"==typeof e&&a(f.id,e)}},Ie(t).map((e=>i.default.createElement(gd,{key:e.value,value:e.value},e.label))))),i.default.createElement(Ke,null,i.default.createElement(Wd,{endDate:f.endDate,filterConfig:e?Object.assign(Object.assign({},e),{operators:Ie(t),inputType:m,options:t.options}):void 0,isRangeOperator:()=>h,operator:f.operator,selectedRadioValue:f.selectedRadioValue,selectedValues:f.selectedValues,startDate:f.startDate,value:f.value,onEndDateChange:e=>{u(f.id,e)},onKeyDown:n,onRadioChange:e=>{s(f.id,e)},onStartDateChange:e=>{c(f.id,e)},onValueChange:e=>{o(f.id,e)},onValueToggle:(e,t)=>{const n=[...f.selectedValues];if(t)n.push(e);else{const t=n.indexOf(e);t>-1&&n.splice(t,1)}l(f.id,n)}})))})))};Jd.displayName="MultiConditionInput";const Ud=({filterType:t,isOpen:n,onApply:r,onCancel:a,editingFilter:o,filterConfig:l,savedCoordinates:s})=>{const c=(e=>void 0!==(null==e?void 0:e.multiConditionConfigs)&&e.multiConditionConfigs.length>0)(l),[u,d]=e.useState(""),p=e.useCallback((()=>d("")),[]),f=e.useCallback((e=>{const t=ue(l).find((t=>t.value===e));return(null==t?void 0:t.isRange)||!1}),[l]),m=((t,n,r,a)=>{const[i,o]=e.useState(ce(t)),[l,s]=e.useState(""),[c,u]=e.useState([]),[d,p]=e.useState(""),[f,m]=e.useState(""),[h,g]=e.useState("");e.useEffect((()=>{if(n)o(n.operator),s("string"==typeof n.values[0]?n.values[0]:""),u(n.values),p(n.values[0]||""),r&&r(n.operator)?(m("string"==typeof n.values[0]?n.values[0]:""),g("string"==typeof n.values[1]?n.values[1]:"")):(m(""),g(""));else{const e=ce(t);o(e);const n=de(t,e),a=ss().format("YYYY-MM-DD");r&&r(e)?(m(a),g(a),s("")):"date"===n?(s(a),m(""),g("")):(s(""),m(""),g("")),u([]),p("")}}),[n,r,t]);const b=e.useCallback((e=>{s(e),null==a||a()}),[a]),v=e.useCallback(((e,t)=>{u(t?t=>[...t,e]:t=>t.filter((t=>t!==e))),null==a||a()}),[a]),x=e.useCallback((e=>{p(e),null==a||a()}),[a]),y=e.useCallback((e=>{m(e),null==a||a()}),[a]),w=e.useCallback((e=>{g(e),null==a||a()}),[a]);return{operator:i,value:l,selectedValues:c,selectedRadioValue:d,startDate:f,endDate:h,setOperator:o,setValue:s,setSelectedValues:u,setSelectedRadioValue:p,setStartDate:m,setEndDate:g,handleValueChange:b,handleValueToggle:v,handleRadioChange:x,handleStartDateChange:y,handleEndDateChange:w}})(l,o||void 0,f,p),h=((t,n,r)=>{const a=e.useMemo((()=>we(t)),[t]),[i,o]=e.useState([]);e.useEffect((()=>{var e;if(0===a.length)return;const t=ss().format("YYYY-MM-DD"),r=new Map((null===(e=null==n?void 0:n.conditions)||void 0===e?void 0:e.map((e=>[e.conditionKey,e])))||[]),i=a.map((e=>Xd(e,r.get(e.conditionKey),t)));o(i)}),[n,a]);const l=e.useCallback((()=>{if(0===a.length)return;const e=new Set(i.map((e=>e.conditionKey))),t=a.find((t=>!e.has(t.conditionKey)))||a[0],n=Ee(t),l=ke(t,n),s=ss().format("YYYY-MM-DD");let c="",u="",d="";Me(t,n)?(u=s,d=s):"date"===l&&(c=s);const p={id:`condition_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,conditionKey:t.conditionKey,conditionLabel:t.conditionLabel,operator:n,value:c,selectedValues:[],selectedRadioValue:"",startDate:u,endDate:d};o((e=>[...e,p])),null==r||r()}),[a,i,r]),s=e.useCallback((e=>{o((t=>t.filter((t=>t.id!==e)))),null==r||r()}),[r]),c=e.useCallback(((e,t,n)=>{const i=a.find((e=>e.conditionKey===t));if(!i)return;const l=Ee(i),s=ke(i,l),c=ss().format("YYYY-MM-DD");let u="",d="",p="";Me(i,l)?(d=c,p=c):"date"===s&&(u=c),o((r=>r.map((r=>r.id===e?Object.assign(Object.assign({},r),{conditionKey:t,conditionLabel:n,operator:l,value:u,selectedValues:[],selectedRadioValue:"",startDate:d,endDate:p}):r)))),null==r||r()}),[a,r]),u=e.useCallback(((e,t)=>{o((n=>n.map((n=>{if(n.id!==e)return n;const r=a.find((e=>e.conditionKey===n.conditionKey));if(!r)return n;const i=ke(r,t),o=ss().format("YYYY-MM-DD"),l=Me(r,t);let s=n.value,c=n.startDate,u=n.endDate,d=n.selectedValues,p=n.selectedRadioValue;return l?(c&&""!==c.trim()||(c=o),u&&""!==u.trim()||(u=o),s="",d=[],p=""):"date"===i?(s&&""!==s.trim()||(s=o),c="",u="",d=[],p=""):(c="",u=""),Object.assign(Object.assign({},n),{operator:t,value:s,startDate:c,endDate:u,selectedValues:d,selectedRadioValue:p})})))),null==r||r()}),[a,r]),d=e.useCallback(((e,t)=>{o((n=>n.map((n=>n.id===e?Object.assign(Object.assign({},n),{value:t}):n)))),null==r||r()}),[r]),p=e.useCallback(((e,t)=>{o((n=>n.map((n=>n.id===e?Object.assign(Object.assign({},n),{selectedValues:t}):n)))),null==r||r()}),[r]),f=e.useCallback(((e,t)=>{o((n=>n.map((n=>n.id===e?Object.assign(Object.assign({},n),{selectedRadioValue:t}):n)))),null==r||r()}),[r]),m=e.useCallback(((e,t)=>{o((n=>n.map((n=>n.id===e?Object.assign(Object.assign({},n),{startDate:t}):n)))),null==r||r()}),[r]),h=e.useCallback(((e,t)=>{o((n=>n.map((n=>n.id===e?Object.assign(Object.assign({},n),{endDate:t}):n)))),null==r||r()}),[r]),g=e.useCallback((e=>i.find((t=>t.id===e))),[i]);return{conditions:i,addCondition:l,removeCondition:s,updateConditionKey:c,updateConditionOperator:u,updateConditionValue:d,updateConditionSelectedValues:p,updateConditionSelectedRadioValue:f,updateConditionStartDate:m,updateConditionEndDate:h,getConditionById:g}})(l,o||null,p),g=e.useCallback((()=>((e,t)=>{if(0===e.length)return{isValid:!1,errorMessage:"少なくとも1つの条件を設定してください"};if(!e.some((e=>{const n=Ad(e,t);return!!n&&$d(n)})))return{isValid:!1,errorMessage:"少なくとも1つの条件を入力してください"};for(const n of e){const e=Ad(n,t);if(!e)return{isValid:!1,errorMessage:`条件設定 ${n.conditionKey} が見つかりません`};if(!Md(e.conditionConfig))continue;const r=Sd(e);if(!r.isValid)return{isValid:!1,errorMessage:`${n.conditionLabel}: ${r.errorMessage}`}}return{isValid:!0,errorMessage:""}})(h.conditions,l)),[h.conditions,l]),b=e.useCallback((()=>((e,t)=>0!==e.length&&(!!e.some((e=>{const n=Ad(e,t);return!!n&&$d(n)}))&&e.every((e=>{const n=Ad(e,t);return!!n&&(!Md(n.conditionConfig)||$d(n))}))))(h.conditions,l)),[h.conditions,l]),{validateInput:v,canApply:x}=(({filterConfig:t,operator:n,selectedValues:r,selectedRadioValue:a,startDate:i,endDate:o,value:l,isRangeOperator:s})=>({validateInput:e.useCallback((()=>{const e=de(t,n);return Id({inputType:e,operator:n,selectedValues:r,selectedRadioValue:a,startDate:i,endDate:o,value:l,isRangeOperator:s(n),customValidation:null==t?void 0:t.customValidation})}),[t,n,r,a,i,o,l,s]),canApply:e.useCallback((()=>{const e=de(t,n);return kd({inputType:e,selectedValues:r,selectedRadioValue:a,startDate:i,endDate:o,value:l,isRangeOperator:s(n)})}),[t,r,a,n,i,o,l,s])}))({filterConfig:l,operator:m.operator,selectedValues:m.selectedValues,selectedRadioValue:m.selectedRadioValue,startDate:m.startDate,endDate:m.endDate,value:m.value,isRangeOperator:f}),{refs:y,floatingStyles:w,getFloatingProps:C,isPositioned:E,contentMaxHeight:I}=(({isOpen:t,savedCoordinates:n,onCancel:r})=>{const[a,i]=e.useState(!1),[o,l]=e.useState(300),{refs:s,floatingStyles:c,context:u}=oa({open:t,onOpenChange:e=>{e||r()},placement:"bottom-start",middleware:[cn({padding:8,crossAxis:!1}),un({apply({availableWidth:e,availableHeight:t,elements:n}){if(n.floating){const r=Math.max(Dd.CONFIG_PANEL_MIN_CONTENT_HEIGHT,t-Dd.CONFIG_PANEL_HEADER_HEIGHT-Dd.CONFIG_PANEL_BUTTON_HEIGHT-Dd.CONFIG_PANEL_PADDING);l(r),Object.assign(n.floating.style,{maxWidth:`${Math.max(0,e)}px`})}}})]}),d=aa(u,{outsidePress:e=>!e.target.closest("[data-tag]")}),{getFloatingProps:p}=sa([d]);return e.useEffect((()=>{if(n&&t){const e={getBoundingClientRect:()=>({width:0,height:0,x:n.x,y:n.y,top:n.y,left:n.x,right:n.x,bottom:n.y})};s.setReference(e),i(!0)}}),[n,t,s]),e.useEffect((()=>{t||i(!1)}),[t]),{refs:s,floatingStyles:c,getFloatingProps:p,isPositioned:a,contentMaxHeight:o,context:u}})({isOpen:n,savedCoordinates:s||null,onCancel:a}),k=e.useCallback((()=>{if(c){const e=g();if(!e.isValid)return void d(e.errorMessage);d("");const t=(e=>{const{conditions:t,filterConfig:n}=e,r=[],a=[];for(const e of t)try{const t=Ce(n,e.conditionKey);if(!t){a.push(`条件設定 ${e.conditionKey} が見つかりません`);continue}const i=ke(t,e.operator),o=Me(t,e.operator),l=wd({inputType:i,selectedValues:e.selectedValues,selectedRadioValue:e.selectedRadioValue,startDate:e.startDate,endDate:e.endDate,value:e.value,isRangeOperator:o});if(!l||0===l.length||!l.some((e=>""!==e&&null!=e)))continue;const s=Cd(t,e.operator),c=Ed({conditionConfig:t,inputType:i,operator:e.operator,values:l,dateFormat:n?me(n):void 0});r.push({conditionKey:e.conditionKey,conditionLabel:e.conditionLabel,operator:e.operator,operatorLabel:s,values:l,valueLabels:c,isRange:o})}catch(t){const n=t instanceof Error?t.message:"不明なエラーが発生しました";a.push(`条件 ${e.conditionLabel} の処理中にエラーが発生しました: ${n}`)}return{conditions:r,errors:a}})({conditions:h.conditions,filterConfig:l});if(t.errors.length>0)return void d(t.errors.join("\n"));r({operator:"",operatorLabel:"",values:[],valueLabels:[],isRange:!1,conditions:t.conditions})}else{const e=v();if(!e.isValid)return void d(e.errorMessage);d("");const t=de(l,m.operator),n=wd({inputType:t,selectedValues:m.selectedValues,selectedRadioValue:m.selectedRadioValue,startDate:m.startDate,endDate:m.endDate,value:m.value,isRangeOperator:f(m.operator)}),a=((e,t)=>{var n;return e&&(null===(n=ue(e).find((e=>e.value===t)))||void 0===n?void 0:n.label)||t})(l,m.operator),i=(e=>{const{filterConfig:t,inputType:n,operator:r,values:a}=e;return a.map((e=>{if("checkbox"===n||"radio"===n){const n=fe(t,r).find((t=>t.value===e));return(null==n?void 0:n.label)||String(e)}if("date"===n){const n=me(t),r=String(e);if(!r||""===r.trim())return r;const a=ss(r,"YYYY-MM-DD");return a.isValid()?a.format(n):r}return String(e)}))})({filterConfig:l,inputType:t,operator:m.operator,values:n});r({operator:m.operator,operatorLabel:a,values:n,valueLabels:i,isRange:f(m.operator)})}}),[c,l,h,m,v,g,r,f]),{handleKeyDown:M}=(({isOpen:t,canApply:n,handleApply:r,onCancel:a,floatingRef:i})=>{const o=e.useCallback((e=>{if("Enter"===e.key&&!e.shiftKey&&!e.ctrlKey&&!e.altKey){if(e.isComposing||229===e.keyCode)return void e.preventDefault();e.preventDefault(),n()&&r()}}),[n,r]);return e.useEffect((()=>{const e=e=>{"Escape"===e.key&&t&&a()};return t&&document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}}),[t,a]),e.useEffect((()=>{if(!t)return;const e=e=>{var t;const n=e.target;(null===(t=i.current)||void 0===t?void 0:t.contains(n))&&o(e)};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}}),[t,o,i]),{handleKeyDown:e=>{o(e)}}})({isOpen:n,canApply:c?b:x,handleApply:k,onCancel:a,floatingRef:y.floating}),A=e.useMemo((()=>{if(c)return!1;return"text"===de(l,m.operator)&&("contains"===m.operator||"not_contains"===m.operator)}),[l,m.operator,c]);return i.default.createElement(Je,Object.assign({ref:y.setFloating,$isOpen:n,$isPositioned:E,style:w,tabIndex:-1,onKeyDown:M},C()),i.default.createElement(Ue,null,i.default.createElement(Qe,null,t)),i.default.createElement(qe,{style:{maxHeight:`${I}px`}},c?i.default.createElement(Jd,{filterConfig:l,multiConditionState:h,onKeyDown:M}):i.default.createElement(i.default.Fragment,null,i.default.createElement(Ke,null,i.default.createElement(hd,{value:m.operator,variant:"dark",onChange:e=>{if("string"!=typeof e)return;p();const t=e;m.setOperator(t);const n=ss().format("YYYY-MM-DD"),r=(e=>{const{filterConfig:t,newOperator:n,isRangeOperator:r,currentStartDate:a,currentEndDate:i,currentValue:o,todayString:l}=e;if(r(n))return{startDate:a&&""!==a.trim()?void 0:l,endDate:i&&""!==i.trim()?void 0:l};{const e={startDate:"",endDate:""};return"date"!==de(t,n)||o&&""!==o.trim()||(e.value=l),e}})({filterConfig:l,newOperator:t,isRangeOperator:f,currentStartDate:m.startDate,currentEndDate:m.endDate,currentValue:m.value,todayString:n});void 0!==r.startDate&&m.setStartDate(r.startDate),void 0!==r.endDate&&m.setEndDate(r.endDate),void 0!==r.value&&m.setValue(r.value)}},ue(l).map((e=>i.default.createElement(gd,{key:e.value,value:e.value},e.label))))),i.default.createElement(Ke,null,i.default.createElement(Wd,{endDate:m.endDate,filterConfig:l,isRangeOperator:f,operator:m.operator,selectedRadioValue:m.selectedRadioValue,selectedValues:m.selectedValues,startDate:m.startDate,value:m.value,onEndDateChange:m.handleEndDateChange,onKeyDown:M,onRadioChange:m.handleRadioChange,onStartDateChange:m.handleStartDateChange,onValueChange:m.handleValueChange,onValueToggle:m.handleValueToggle}),A&&i.default.createElement(rs,{prepend:i.default.createElement(D,{name:"question"})},"カンマ区切りで複数ワードをOR検索できます。")))),u&&i.default.createElement(et,null,i.default.createElement(yd,{size:"sm"},u)),i.default.createElement(tt,null,i.default.createElement(is,null,i.default.createElement(As,{type:"button",size:"small",color:"clear",onClick:a},"キャンセル"),i.default.createElement(As,{type:"button",size:"small",disabled:c?!b():!x(),onClick:k},"適用"))))};Ud.displayName="AdvancedFilterConfigPanel";const Qd=({types:t,onFiltersChange:n,initialAppliedFilters:r})=>{const[a,i]=e.useState(null),[o,l]=e.useState(!1),[s,c]=e.useState((()=>null!=r?r:[])),[u,d]=e.useState(null),[p,f]=e.useState(!1),m=e.useRef(null),[h,g]=e.useState(24),[b,v]=e.useState(null),x=e.useRef(n);x.current=n;const y=e.useRef(u);y.current=u;const w=e.useRef(s);w.current=s,e.useEffect((()=>{var e;const n=new Set(t.map((e=>e.type))),r=w.current,a=r.filter((e=>n.has(e.type)));if(a.length!==r.length){c(a),null===(e=x.current)||void 0===e||e.call(x,a);const t=y.current;t&&!n.has(t.type)&&(d(null),l(!1),i(null))}}),[t]);return{selectedType:a,isConfigPanelOpen:o,appliedFilters:s,editingFilter:u,isMenuOpen:p,menuPosition:h,savedMenuCoordinates:b,triggerRef:m,setSelectedType:i,setIsConfigPanelOpen:l,setAppliedFilters:c,setEditingFilter:d,setIsMenuOpen:f,setMenuPosition:g,setSavedMenuCoordinates:v,handleTypeSelect:e=>{i(e),l(!0)},handleConfigApply:e=>{let r;if(u){const t=((e,t)=>t.conditions&&t.conditions.length>0?Object.assign(Object.assign({},e),{operator:"",operatorLabel:"",values:[],valueLabels:[],isRange:!1,conditions:t.conditions}):Object.assign(Object.assign({},e),{operator:t.operator,operatorLabel:t.operatorLabel,values:t.values,valueLabels:t.valueLabels,isRange:t.isRange,conditions:void 0}))(u,e);r=s.map((e=>e.id===u.id?t:e)),d(null)}else{const n=xe(t,a),i=((e,t,n)=>n.conditions&&n.conditions.length>0?{id:se(),type:e,typeLabel:t,operator:"",operatorLabel:"",values:[],valueLabels:[],isRange:!1,conditions:n.conditions}:{id:se(),type:e,typeLabel:t,operator:n.operator,operatorLabel:n.operatorLabel,values:n.values,valueLabels:n.valueLabels,isRange:n.isRange})(a,n,e);r=[...s,i]}c(r),null==n||n(r),l(!1),i(null)},handleRemoveFilter:e=>{const t=((e,t)=>e.filter((e=>e.id!==t)))(s,e);c(t),null==n||n(t),u&&u.id===e&&(d(null),l(!1),i(null))},handleClearAll:()=>{const e=[];c(e),null==n||n(e),d(null),l(!1),i(null),f(!1)},handleConfigCancel:()=>{l(!1),i(null),d(null)},handleEditFilter:e=>{u&&u.id===e.id||(p&&f(!1),d(e),i(e.type),l(!0))}}};class qd{static calculateMenuPosition(){const e=document.querySelectorAll(Ld);if(0===e.length)return Dd.DEFAULT_MENU_POSITION;const t=e[0].closest(Rd);if(!t)return Dd.DEFAULT_MENU_POSITION;const n=e[e.length-1].getBoundingClientRect(),r=t.getBoundingClientRect();let a=n.right-r.left+Dd.TAG_SPACING;return e.length>=1&&(a+=Dd.TAG_OFFSET_MULTIPLE),this.calculateSafePosition(a)}static calculateSafePosition(e){const t=window.innerWidth,n=Math.max(Dd.MENU_WIDTH,Dd.CONFIG_PANEL_WIDTH);return e+n>t-16?Math.max(0,t-n-16):e}static calculateConfigPanelPosition(e,t,n){const r=t.findIndex((t=>t.id===e.id));if(-1===r)return this.getFallbackPosition();const a=document.querySelectorAll(Ld);let i=null;for(const t of a){if(t.getAttribute("data-tag")===e.id){i=t;break}}let o=null==n?void 0:n.current;if(!o){const e=document.querySelector(Vd);e&&(o=e)}return i&&o?this.calculateFromActualElements(i,o):o?this.calculateFromTrigger(o,r):this.getFallbackPosition(r)}static calculateFromActualElements(e,t){const n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return{position:r.left-n.left,coordinates:{x:r.left,y:r.bottom+16}}}static calculateFromTrigger(e,t){const n=e.getBoundingClientRect(),r=n.left+Dd.ICON_AREA_WIDTH+t*Dd.ESTIMATED_TAG_WIDTH;return{position:r-n.left,coordinates:{x:r,y:n.bottom+Dd.TAG_SPACING}}}static getFallbackPosition(e=0){const t=Dd.FALLBACK_POSITION_X+e*Dd.ESTIMATED_TAG_WIDTH;return{position:t,coordinates:{x:t,y:Dd.FALLBACK_POSITION_Y}}}static getSavedCoordinates(){const e=document.querySelector(Od);if(!e)return null;const t=e.getBoundingClientRect();return{x:t.left,y:t.top}}}const Kd=({setMenuPosition:t})=>{const n=e.useCallback((()=>{const e=qd.calculateMenuPosition();t(e)}),[t]);return{handleMenuOpen:n}},ep=({types:e,placeholder:t="フィルターを追加",disabled:n=!1,filterConfigs:r={},size:a="medium",variant:o="light",width:l="100%",onFiltersChange:s,initialAppliedFilters:c})=>{const{selectedType:u,isConfigPanelOpen:d,appliedFilters:p,editingFilter:f,isMenuOpen:m,menuPosition:h,savedMenuCoordinates:g,triggerRef:b,setMenuPosition:v,setSavedMenuCoordinates:x,setIsMenuOpen:y,handleTypeSelect:w,handleConfigApply:C,handleRemoveFilter:E,handleClearAll:I,handleConfigCancel:k,handleEditFilter:M}=Qd({types:e,onFiltersChange:s,initialAppliedFilters:c}),{handleMenuOpen:A}=Kd({setMenuPosition:v});i.default.useLayoutEffect((()=>{if(f){const{position:e,coordinates:t}=qd.calculateConfigPanelPosition(f,p,b);v(e),x(t)}}),[f,p,b,v,x]);const $=ve(e,p);return i.default.createElement("div",null,$.length>0&&i.default.createElement(es,null,i.default.createElement(Kl,{open:m,trigger:i.default.createElement(nt,{ref:b,placeholder:t,disabled:n,isOpen:m,appliedFilters:p,size:a,variant:o,width:l,onEditFilter:M,onRemoveFilter:E,onClearAll:I}),minWidth:Dd.MENU_WIDTH,placement:"bottom-start",middleware:[sn({mainAxis:8,crossAxis:h}),cn({padding:8}),un({apply({availableWidth:e,availableHeight:t,elements:n}){if(n.floating){Object.assign(n.floating.style,{width:"max-content",minWidth:`${Dd.MENU_WIDTH}px`,maxWidth:`${Math.max(0,e)}px`,maxHeight:`${Math.max(0,t)}px`});const r=n.floating.getBoundingClientRect();x({x:r.left,y:r.top})}}})],onOpenChange:e=>{y(e),e&&A()}},$.map((e=>i.default.createElement(He,{key:e.type,disabled:e.disabled,closeOnClick:!0,onClick:()=>w(e.type)},e.label))))),0===$.length&&i.default.createElement(nt,{placeholder:"すべてのフィルターが適用済み",disabled:!0,appliedFilters:p,size:a,variant:o,width:l,onEditFilter:M,onRemoveFilter:E,onClearAll:I}),d&&u&&g&&i.default.createElement(Ud,{filterType:xe(e,u),isOpen:d,editingFilter:f,filterConfig:r[u],savedCoordinates:g,onApply:C,onCancel:k}))};ep.displayName="AdvancedFilter";const tp=e=>{if(e instanceof Date)return!isNaN(e.getTime());if("number"==typeof e){const t=new Date(e);return!isNaN(t.getTime())}if("string"==typeof e){if(""===e.trim())return!1;return ss(e).isValid()}return!1},np=e=>{if(e instanceof Date)return isNaN(e.getTime())?null:e;if("number"==typeof e){const t=new Date(e);return isNaN(t.getTime())?null:t}if("string"==typeof e){const t=ss(e);if(t.isValid())return t.toDate()}return null},rp=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate()),ap=(e,t)=>0===((e,t)=>{const n=rp(e),r=rp(t);return n.getTime()-r.getTime()})(e,t),ip=[{value:"equals",label:"次に一致する"},{value:"contains",label:"次を含む"},{value:"starts_with",label:"次で始まる"},{value:"ends_with",label:"次で終わる"},{value:"not_equals",label:"次に一致しない"},{value:"not_contains",label:"次を含まない"}],op=[{value:"equals",label:"次に一致する"},{value:"greater_than",label:"次より大きい"},{value:"less_than",label:"次より小さい"},{value:"greater_than_or_equal",label:"次以上"},{value:"less_than_or_equal",label:"次以下"},{value:"between",label:"次の範囲内",isRange:!0},{value:"not_between",label:"次の範囲外",isRange:!0}],lp=[{value:"equals",label:"次に一致する"},{value:"before",label:"次より前"},{value:"after",label:"次より後"},{value:"between",label:"次の範囲内",isRange:!0},{value:"not_between",label:"次の範囲外",isRange:!0}],sp=[{value:"equals",label:"次に一致する"},{value:"not_equals",label:"次に一致しない"},{value:"in",label:"次のいずれかに一致する"},{value:"not_in",label:"次のいずれにも一致しない"}],cp={text_basic:[ip[0],ip[1],ip[2]],text_search:[ip[1],ip[0],ip[5]],selection_basic:[sp[0],sp[1]],selection_multiple:[sp[2],sp[0],sp[3]],date_basic:[lp[0],lp[2],lp[1]],number_basic:[op[0],op[1],op[2],op[3],op[4]]},up=e=>{const t=cp[e];return t?[...t]:[]},dp=(e,t)=>e.map((e=>Object.assign(Object.assign({},e),{label:t[e.value]||e.label}))),pp=(e,t,n)=>{if("boolean"==typeof e&&"boolean"==typeof n[0])return((e,t,n)=>{switch(t){case"equals":return e===n;case"not_equals":return e!==n;default:return!1}})(e,t,n[0]);if("between"===t||"not_between"===t){if(n.length<2)return!1;if("boolean"==typeof e)return!1;return((e,t,n,r)=>{if(tp(String(e))&&tp(n)&&tp(r)){const a=np(String(e)),i=np(n),o=np(r);if(a&&i&&o){const e=rp(a),n=rp(i),r=rp(o),l=e>=n&&e<=r;return"between"===t?l:!l}}const a=Number(e),i=Number(n),o=Number(r);if(!isNaN(a)&&!isNaN(i)&&!isNaN(o)){const e=a>=i&&a<=o;return"between"===t?e:!e}return!1})(e,t,"string"==typeof n[0]?n[0]:String(n[0]),"string"==typeof n[1]?n[1]:String(n[1]))}if("before"===t||"after"===t){if("boolean"==typeof e)return!1;return((e,t,n)=>{if(tp(String(e))&&tp(n)){const r=np(String(e)),a=np(n);if(r&&a){const e=rp(r),n=rp(a);return"before"===t?e<n:e>n}}const r=Number(e),a=Number(n);return!isNaN(r)&&!isNaN(a)&&("before"===t?r<a:r>a)})(e,t,"string"==typeof n[0]?n[0]:String(n[0]))}if("equals"===t||"not_equals"===t){if("boolean"==typeof e)return!1;if(n.length>1){const r=String(e).toLowerCase(),a=n.map((e=>"string"==typeof e?e.toLowerCase():String(e))).includes(r);return"equals"===t?a:!a}return((e,t,n)=>{if(tp(String(e))&&tp(n)){const r=np(String(e)),a=np(n);if(r&&a){const e=ap(r,a);return"equals"===t?e:!e}}const r=String(e).toLowerCase()===n.toLowerCase();return"equals"===t?r:!r})(e,t,"string"==typeof n[0]?n[0]:String(n[0]||""))}const r="string"==typeof n[0]?n[0]:String(n[0]||"");if("contains"===t||"not_contains"===t||"starts_with"===t||"ends_with"===t)return((e,t,n)=>{const r=e.toLowerCase(),a=n.trim();if(("contains"===t||"not_contains"===t)&&a.includes(",")){const e=Tc(a);return"contains"===t?e.some((e=>r.includes(e.toLowerCase()))):!e.some((e=>r.includes(e.toLowerCase())))}const i=a.toLowerCase();switch(t){case"contains":return r.includes(i);case"not_contains":return!r.includes(i);case"starts_with":return r.startsWith(i);case"ends_with":return r.endsWith(i);default:return!1}})(String(e),t,r);if("in"===t||"not_in"===t){const r=String(e).toLowerCase(),a=n.map((e=>"string"==typeof e?e.toLowerCase():String(e))).includes(r);return"in"===t?a:!a}if("greater_than"===t||"less_than"===t||"greater_than_or_equal"===t||"less_than_or_equal"===t){const n=Number(e);if(!isNaN(n))return((e,t,n)=>{const r=Number(n);if(isNaN(r))return!1;switch(t){case"greater_than":return e>r;case"less_than":return e<r;case"greater_than_or_equal":return e>=r;case"less_than_or_equal":return e<=r;default:return!1}})(n,t,r)}return!0},fp=(e,t,n,r)=>r.length?e.filter((e=>{const a=e[t];return pp(a,n,r)})):e,mp=o.default.div`
1096
+ `,yd=i.forwardRef((function({children:e,size:t="md"},n){const r=k();return i.createElement(V,{ref:n,display:"flex",alignItems:"center"},i.createElement(ms,{pr:.5},i.createElement(D,{name:"alert",type:"fill",color:r.palette.danger.base,size:"sm"===t?"sm-md":t})),i.createElement(xd,{color:r.palette.danger.base,size:t},e))})),wd=e=>{const{inputType:t,selectedValues:n,selectedRadioValue:r,startDate:a,endDate:i,value:o,isRangeOperator:l}=e;return"checkbox"===t?n:"radio"===t?[r]:l?[a,i]:[o]},Cd=(e,t)=>{const n=Ie(e).find((e=>e.value===t));return(null==n?void 0:n.label)||t},Ed=e=>{const{conditionConfig:t,inputType:n,operator:r,values:a,dateFormat:i}=e;return a.map((e=>{if("checkbox"===n||"radio"===n){const n=((e,t)=>{if(t){const n=e.operators.find((e=>e.value===t));if(null==n?void 0:n.options)return n.options}return e.options||[]})(t,r).find((t=>t.value===e));return(null==n?void 0:n.label)||String(e)}if("date"===n&&i){const t=String(e);if(!t||""===t.trim())return t;const n=ss(t,"YYYY-MM-DD");return n.isValid()?n.format(i):t}return String(e)}))},Id=e=>{const{inputType:t,operator:n,selectedValues:r,selectedRadioValue:a,startDate:i,endDate:o,value:l,isRangeOperator:s,customValidation:c}=e;if("checkbox"===t){if(0===r.length)return{isValid:!1,errorMessage:"少なくとも1つの項目を選択してください"}}else if("radio"===t){if(""===a||null==a)return{isValid:!1,errorMessage:"項目を選択してください"}}else if(s){if(!i||!o)return{isValid:!1,errorMessage:"開始日と終了日の両方を選択してください"}}else if(!l||""===l.trim())return{isValid:!1,errorMessage:"date"===t?"日付を選択してください":"値を入力してください"};if(c){let e;return e="checkbox"===t?r:"radio"===t?[a]:s?[i,o]:[l],c(e,n)}return s&&new Date(i)>new Date(o)?{isValid:!1,errorMessage:"開始日は終了日より前である必要があります"}:{isValid:!0,errorMessage:""}},kd=e=>{const{inputType:t,selectedValues:n,selectedRadioValue:r,startDate:a,endDate:i,value:o,isRangeOperator:l}=e;return"checkbox"===t?n.length>0:"radio"===t?""!==r&&null!=r:l?!(!a||!i):!(!o||""===o.trim())},Md=e=>!1!==e.required,Ad=(e,t)=>{const n=Ce(t,e.conditionKey);return n?{condition:e,conditionConfig:n}:null},$d=e=>{const{condition:t,conditionConfig:n}=e,r=ke(n,t.operator),a=Me(n,t.operator);return kd({inputType:r,selectedValues:t.selectedValues,selectedRadioValue:t.selectedRadioValue,startDate:t.startDate,endDate:t.endDate,value:t.value,isRangeOperator:a})},Sd=e=>{const{condition:t,conditionConfig:n}=e,r=ke(n,t.operator),a=Me(n,t.operator);return Id({inputType:r,operator:t.operator,selectedValues:t.selectedValues,selectedRadioValue:t.selectedRadioValue,startDate:t.startDate,endDate:t.endDate,value:t.value,isRangeOperator:a,customValidation:n.customValidation})},Dd={MENU_WIDTH:160,CONFIG_PANEL_WIDTH:264,DEFAULT_MENU_POSITION:24,TAG_SPACING:8,TAG_OFFSET_MULTIPLE:40,ESTIMATED_TAG_WIDTH:120,ICON_AREA_WIDTH:24,CLEAR_BUTTON_WIDTH:16,FALLBACK_POSITION_X:80,FALLBACK_POSITION_Y:148,CONFIG_PANEL_HEADER_HEIGHT:60,CONFIG_PANEL_BUTTON_HEIGHT:50,CONFIG_PANEL_PADDING:16,CONFIG_PANEL_MIN_CONTENT_HEIGHT:200,TRANSITION_DURATION:200,MIN_VALUE_LENGTH:1},Ld="[data-tag]",Od='[role="menu"]',Vd='[data-advanced-filter-trigger="true"]',Rd='[role="button"]',Hd=({options:e,selectedValues:t,onValueToggle:n})=>i.default.createElement(_e,null,e.map((e=>i.default.createElement(Aa,{key:String(e.value),checked:t.includes(e.value),onChange:t=>n(e.value,t)},e.label))));Hd.displayName="CheckboxValueInput";const Nd=({options:e,selectedRadioValue:t,onRadioChange:n})=>i.default.createElement(_e,null,e.map((e=>i.default.createElement(Aa,{key:String(e.value),checked:t===e.value,onChange:t=>{t&&n(e.value)}},e.label))));Nd.displayName="RadioValueInput";const zd=640,Td=["日","月","火","水","木","金","土"],Zd={components:{ConfirmModal:{defaultProps:{confirmText:"確認",cancelText:"キャンセル"}},FullSizeConfirmModal:{defaultProps:{confirmText:"確認",cancelText:"キャンセル"}},FileUploader:{defaultProps:{title:"ファイルをドラッグ&ドロップ、またはここをクリック"}},ItemEmpty:{defaultProps:{title:"見つかりませんでした。"}},Select:{defaultProps:{placeholder:"選択...",emptyMessage:"見つかりません"}},CreatableSelect:{defaultProps:{placeholder:"選択...",emptyMessage:"見つかりません",addMessage:"次の文字列を追加する"}},MultipleFilter:{defaultProps:{placeholder:"新しいフィルターを追加してください"}},FilterCard:{defaultProps:{applyButtonTitle:"適用",inputErrorText:"入力してください",formPlaceholder:"検索",sectionTitle:"セクション"}},EditFilterCard:{defaultProps:{}},DatePicker:{defaultProps:{monthFormat:"YYYY年MM月",weekConfig:{start:0,labels:[...Td]}}},DateRangePicker:{defaultProps:{monthFormat:"YYYY年MM月",weekConfig:{start:0,labels:[...Td]},applyButtonText:"適用",cancelButtonText:"キャンセル"}},WeekTime:{defaultProps:{weekList:["月","火","水","木","金","土","日"]}},WeekTimeSelector:{defaultProps:{weekList:["月","火","水","木","金","土","日"]}},DualListBox:{defaultProps:{selectedItemTitle:"個選択済み"}}}},Bd={components:{DatePicker:{defaultProps:{monthFormat:"MMM YYYY",weekConfig:{start:0,labels:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]}}},DateRangePicker:{defaultProps:{monthFormat:"MMM YYYY",weekConfig:{start:0,labels:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},applyButtonText:"Apply",cancelButtonText:"Cancel"}},WeekTime:{defaultProps:{weekList:["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]}},WeekTimeSelector:{defaultProps:{weekList:["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]}},DualListBox:{defaultProps:{selectedItemTitle:"selected"}}}},Pd=i.createContext({locale:Bd});function _d(e){var t,n;const{name:r,props:a}=e,o=i.default.useContext(Pd).locale,l=Object.assign({},a);if(!o||!o.components)return l;const s=null===(n=null===(t=o.components)||void 0===t?void 0:t[r])||void 0===n?void 0:n.defaultProps;for(const e in s)void 0===l[e]&&(l[e]=s[e]);return l}const Fd=e.forwardRef((function(t,n){const r=_d({props:t,name:"DatePicker"}),{date:a,format:o="YYYY-MM-DD",disabled:l=!1,size:s="medium",variant:c="light",width:u,monthFormat:d,weekConfig:p,showDateFields:f=!1,showTimeFields:m=!1,timeFieldProps:h,useCalendarRange:g=!1,isOutsideRange:b,error:v=!1,errorText:x,defaultPresetButton:y,presetButtons:w,onPresetButtonClick:C,onDateChange:E,onDatesChange:I,endDate:M}=r,A=k(),[$,S]=e.useState(!1),{context:L,refs:O,strategy:R,x:H,y:N}=oa({placement:"bottom-start",open:$,onOpenChange:S,middleware:[sn(10),ln(),cn({padding:8})]}),z=aa(L),T=ha(L),{getReferenceProps:Z,getFloatingProps:B}=sa([z,T]),P=e.useCallback((()=>{l||S((e=>!e))}),[l]),_=e.useCallback((e=>{E(e),S(!1)}),[E]),F=e.useMemo((()=>i.default.createElement(D,{name:"date_range",color:l?A.palette.neutral.base:A.palette.text.accent})),[l,A]),G=e.useMemo((()=>"100%"===u||"string"==typeof u&&u.includes("100%")?{width:"100%"}:{width:"fit-content"}),[u]);return i.default.createElement(V,{ref:n,style:G},i.default.createElement("div",Object.assign({ref:O.setReference},Z()),i.default.createElement(CC,{date:a,format:o,error:v,errorText:x,disabled:l,size:s,variant:c,width:u,append:F,onDateChange:E,onAppendClick:P})),$&&i.default.createElement(Jr,null,i.default.createElement(qr,{context:L,modal:!1,initialFocus:-1,returnFocus:!1},g?i.default.createElement(qf,Object.assign({ref:O.setFloating,startDate:a,endDate:M||a,monthFormat:d,weekConfig:p,defaultPresetButton:y,presetButtons:w,showDateFields:f,showTimeFields:m,timeFieldProps:h,dateFieldFormat:o,isOutsideRange:b,style:{position:R,top:null!=N?N:0,left:null!=H?H:0,zIndex:A.depth.calendarRange,overflow:"hidden",maxWidth:"min(640px, calc(100vw - 16px))"},onPresetButtonClick:C,onDatesChange:I},B())):i.default.createElement(Df,Object.assign({ref:O.setFloating,date:a,monthFormat:d,weekConfig:p,defaultPresetButton:y,presetButtons:w,showDateFields:f,showTimeFields:m,timeFieldProps:h,dateFieldFormat:o,isOutsideRange:b,style:{position:R,top:null!=N?N:0,left:null!=H?H:0,zIndex:A.depth.calendar,overflow:"hidden",maxWidth:"min(640px, calc(100vw - 16px))"},onPresetButtonClick:C,onDateChange:_},B())))))}));var Gd=e.memo(Fd);const Yd=({startDate:t,endDate:n,onStartDateChange:r,onEndDateChange:a,format:o="YYYY-MM-DD"})=>{const l=e.useMemo((()=>{if(t&&""!==t.trim()){const e=ss(t,"YYYY-MM-DD");return e.isValid()?e:ss()}return ss()}),[t]),s=e.useMemo((()=>{if(n&&""!==n.trim()){const e=ss(n,"YYYY-MM-DD");return e.isValid()?e:ss()}return ss()}),[n]);return i.default.createElement(Ne,null,i.default.createElement(Te,null,i.default.createElement(Pe,{htmlFor:"start-date-picker"},"開始日"),i.default.createElement(Gd,{date:l,format:o,variant:"dark",width:"100%",onDateChange:e=>{r(e.format("YYYY-MM-DD"))}})),i.default.createElement(Te,null,i.default.createElement(Pe,{htmlFor:"end-date-picker"},"終了日"),i.default.createElement(Gd,{date:s,format:o,variant:"dark",width:"100%",onDateChange:e=>{a(e.format("YYYY-MM-DD"))}})))};Yd.displayName="DateRangeInput";const jd=({inputType:t,value:n,placeholder:r,onValueChange:a,onKeyDown:o,format:l="YYYY-MM-DD"})=>{const s=e.useMemo((()=>{if("date"===t&&n&&""!==n.trim()){const e=ss(n,"YYYY-MM-DD");return e.isValid()?e:ss()}return ss()}),[t,n]),c=e=>{const t=e.format("YYYY-MM-DD");a(t)};return"date"===t?i.default.createElement(Be,null,i.default.createElement(Gd,{date:s,format:l,variant:"dark",width:"100%",onDateChange:c})):i.default.createElement(Ze,null,i.default.createElement(Zl,{type:"text",value:n,placeholder:r,fullWidth:!0,variant:"dark",onChange:e=>a(e.target.value),onKeyDown:o}))};jd.displayName="TextValueInput";const Wd=({filterConfig:e,operator:t,value:n,selectedValues:r,selectedRadioValue:a,startDate:o,endDate:l,onValueChange:s,onValueToggle:c,onRadioChange:u,onStartDateChange:d,onEndDateChange:p,onKeyDown:f,isRangeOperator:m})=>{const h=de(e,t);return"checkbox"===h?i.default.createElement(Hd,{options:fe(e,t),selectedValues:r,onValueToggle:c}):"radio"===h?i.default.createElement(Nd,{options:fe(e,t),selectedRadioValue:a,onRadioChange:u}):m(t)?i.default.createElement(Yd,{startDate:o,endDate:l,format:me(e),onStartDateChange:d,onEndDateChange:p}):i.default.createElement(jd,{inputType:h,value:n,placeholder:pe(e),format:"date"===h?me(e):void 0,onValueChange:s,onKeyDown:f})};Wd.displayName="ConfigPanelValueInput";const Xd=(e,t,n)=>{if(!t)return((e,t)=>{const n=Ee(e),r=ke(e,n);let a="",i="",o="";return Me(e,n)?(i=t,o=t):"date"===r&&(a=t),{id:`condition_${e.conditionKey}`,conditionKey:e.conditionKey,conditionLabel:e.conditionLabel,operator:n,value:a,selectedValues:[],selectedRadioValue:"",startDate:i,endDate:o}})(e,n);let r="",a=[],i="",o="",l="";if((t.isRange||!1)&&t.values.length>=2)o="string"==typeof t.values[0]?t.values[0]:"",l="string"==typeof t.values[1]?t.values[1]:"";else if(t.values.length>0){const e=t.values[0];"string"==typeof e&&(r=e),a=t.values,i=e}return{id:`condition_${e.conditionKey}`,conditionKey:t.conditionKey,conditionLabel:t.conditionLabel,operator:t.operator,value:r,selectedValues:a,selectedRadioValue:i,startDate:o,endDate:l}},Jd=({filterConfig:e,multiConditionState:t,onKeyDown:n})=>{const{conditions:r,updateConditionOperator:a,updateConditionValue:o,updateConditionSelectedValues:l,updateConditionSelectedRadioValue:s,updateConditionStartDate:c,updateConditionEndDate:u}=t,d=we(e);return i.default.createElement("div",null,d.map(((t,p)=>{const f=r.find((e=>e.conditionKey===t.conditionKey));if(!f)return null;const m=ke(t,f.operator),h=Me(t,f.operator),g=d.length>=2;return i.default.createElement("div",{key:f.id},p>0&&i.default.createElement(as,null),g&&i.default.createElement(ts,null,t.conditionLabel),i.default.createElement(Ke,null,i.default.createElement(hd,{value:f.operator,variant:"dark",onChange:e=>{"string"==typeof e&&a(f.id,e)}},Ie(t).map((e=>i.default.createElement(gd,{key:e.value,value:e.value},e.label))))),i.default.createElement(Ke,null,i.default.createElement(Wd,{endDate:f.endDate,filterConfig:e?Object.assign(Object.assign({},e),{operators:Ie(t),inputType:m,options:t.options}):void 0,isRangeOperator:()=>h,operator:f.operator,selectedRadioValue:f.selectedRadioValue,selectedValues:f.selectedValues,startDate:f.startDate,value:f.value,onEndDateChange:e=>{u(f.id,e)},onKeyDown:n,onRadioChange:e=>{s(f.id,e)},onStartDateChange:e=>{c(f.id,e)},onValueChange:e=>{o(f.id,e)},onValueToggle:(e,t)=>{const n=[...f.selectedValues];if(t)n.push(e);else{const t=n.indexOf(e);t>-1&&n.splice(t,1)}l(f.id,n)}})))})))};Jd.displayName="MultiConditionInput";const Ud=({filterType:t,isOpen:n,onApply:r,onCancel:a,editingFilter:o,filterConfig:l,savedCoordinates:s})=>{const c=(e=>void 0!==(null==e?void 0:e.multiConditionConfigs)&&e.multiConditionConfigs.length>0)(l),[u,d]=e.useState(""),p=e.useCallback((()=>d("")),[]),f=e.useCallback((e=>{const t=ue(l).find((t=>t.value===e));return(null==t?void 0:t.isRange)||!1}),[l]),m=((t,n,r,a)=>{const[i,o]=e.useState(ce(t)),[l,s]=e.useState(""),[c,u]=e.useState([]),[d,p]=e.useState(""),[f,m]=e.useState(""),[h,g]=e.useState("");e.useEffect((()=>{if(n)o(n.operator),s("string"==typeof n.values[0]?n.values[0]:""),u(n.values),p(n.values[0]||""),r&&r(n.operator)?(m("string"==typeof n.values[0]?n.values[0]:""),g("string"==typeof n.values[1]?n.values[1]:"")):(m(""),g(""));else{const e=ce(t);o(e);const n=de(t,e),a=ss().format("YYYY-MM-DD");r&&r(e)?(m(a),g(a),s("")):"date"===n?(s(a),m(""),g("")):(s(""),m(""),g("")),u([]),p("")}}),[n,r,t]);const b=e.useCallback((e=>{s(e),null==a||a()}),[a]),v=e.useCallback(((e,t)=>{u(t?t=>[...t,e]:t=>t.filter((t=>t!==e))),null==a||a()}),[a]),x=e.useCallback((e=>{p(e),null==a||a()}),[a]),y=e.useCallback((e=>{m(e),null==a||a()}),[a]),w=e.useCallback((e=>{g(e),null==a||a()}),[a]);return{operator:i,value:l,selectedValues:c,selectedRadioValue:d,startDate:f,endDate:h,setOperator:o,setValue:s,setSelectedValues:u,setSelectedRadioValue:p,setStartDate:m,setEndDate:g,handleValueChange:b,handleValueToggle:v,handleRadioChange:x,handleStartDateChange:y,handleEndDateChange:w}})(l,o||void 0,f,p),h=((t,n,r)=>{const a=e.useMemo((()=>we(t)),[t]),[i,o]=e.useState([]);e.useEffect((()=>{var e;if(0===a.length)return;const t=ss().format("YYYY-MM-DD"),r=new Map((null===(e=null==n?void 0:n.conditions)||void 0===e?void 0:e.map((e=>[e.conditionKey,e])))||[]),i=a.map((e=>Xd(e,r.get(e.conditionKey),t)));o(i)}),[n,a]);const l=e.useCallback((()=>{if(0===a.length)return;const e=new Set(i.map((e=>e.conditionKey))),t=a.find((t=>!e.has(t.conditionKey)))||a[0],n=Ee(t),l=ke(t,n),s=ss().format("YYYY-MM-DD");let c="",u="",d="";Me(t,n)?(u=s,d=s):"date"===l&&(c=s);const p={id:`condition_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,conditionKey:t.conditionKey,conditionLabel:t.conditionLabel,operator:n,value:c,selectedValues:[],selectedRadioValue:"",startDate:u,endDate:d};o((e=>[...e,p])),null==r||r()}),[a,i,r]),s=e.useCallback((e=>{o((t=>t.filter((t=>t.id!==e)))),null==r||r()}),[r]),c=e.useCallback(((e,t,n)=>{const i=a.find((e=>e.conditionKey===t));if(!i)return;const l=Ee(i),s=ke(i,l),c=ss().format("YYYY-MM-DD");let u="",d="",p="";Me(i,l)?(d=c,p=c):"date"===s&&(u=c),o((r=>r.map((r=>r.id===e?Object.assign(Object.assign({},r),{conditionKey:t,conditionLabel:n,operator:l,value:u,selectedValues:[],selectedRadioValue:"",startDate:d,endDate:p}):r)))),null==r||r()}),[a,r]),u=e.useCallback(((e,t)=>{o((n=>n.map((n=>{if(n.id!==e)return n;const r=a.find((e=>e.conditionKey===n.conditionKey));if(!r)return n;const i=ke(r,t),o=ss().format("YYYY-MM-DD"),l=Me(r,t);let s=n.value,c=n.startDate,u=n.endDate,d=n.selectedValues,p=n.selectedRadioValue;return l?(c&&""!==c.trim()||(c=o),u&&""!==u.trim()||(u=o),s="",d=[],p=""):"date"===i?(s&&""!==s.trim()||(s=o),c="",u="",d=[],p=""):(c="",u=""),Object.assign(Object.assign({},n),{operator:t,value:s,startDate:c,endDate:u,selectedValues:d,selectedRadioValue:p})})))),null==r||r()}),[a,r]),d=e.useCallback(((e,t)=>{o((n=>n.map((n=>n.id===e?Object.assign(Object.assign({},n),{value:t}):n)))),null==r||r()}),[r]),p=e.useCallback(((e,t)=>{o((n=>n.map((n=>n.id===e?Object.assign(Object.assign({},n),{selectedValues:t}):n)))),null==r||r()}),[r]),f=e.useCallback(((e,t)=>{o((n=>n.map((n=>n.id===e?Object.assign(Object.assign({},n),{selectedRadioValue:t}):n)))),null==r||r()}),[r]),m=e.useCallback(((e,t)=>{o((n=>n.map((n=>n.id===e?Object.assign(Object.assign({},n),{startDate:t}):n)))),null==r||r()}),[r]),h=e.useCallback(((e,t)=>{o((n=>n.map((n=>n.id===e?Object.assign(Object.assign({},n),{endDate:t}):n)))),null==r||r()}),[r]),g=e.useCallback((e=>i.find((t=>t.id===e))),[i]);return{conditions:i,addCondition:l,removeCondition:s,updateConditionKey:c,updateConditionOperator:u,updateConditionValue:d,updateConditionSelectedValues:p,updateConditionSelectedRadioValue:f,updateConditionStartDate:m,updateConditionEndDate:h,getConditionById:g}})(l,o||null,p),g=e.useCallback((()=>((e,t)=>{if(0===e.length)return{isValid:!1,errorMessage:"少なくとも1つの条件を設定してください"};if(!e.some((e=>{const n=Ad(e,t);return!!n&&$d(n)})))return{isValid:!1,errorMessage:"少なくとも1つの条件を入力してください"};for(const n of e){const e=Ad(n,t);if(!e)return{isValid:!1,errorMessage:`条件設定 ${n.conditionKey} が見つかりません`};if(!Md(e.conditionConfig))continue;const r=Sd(e);if(!r.isValid)return{isValid:!1,errorMessage:`${n.conditionLabel}: ${r.errorMessage}`}}return{isValid:!0,errorMessage:""}})(h.conditions,l)),[h.conditions,l]),b=e.useCallback((()=>((e,t)=>0!==e.length&&(!!e.some((e=>{const n=Ad(e,t);return!!n&&$d(n)}))&&e.every((e=>{const n=Ad(e,t);return!!n&&(!Md(n.conditionConfig)||$d(n))}))))(h.conditions,l)),[h.conditions,l]),{validateInput:v,canApply:x}=(({filterConfig:t,operator:n,selectedValues:r,selectedRadioValue:a,startDate:i,endDate:o,value:l,isRangeOperator:s})=>({validateInput:e.useCallback((()=>{const e=de(t,n);return Id({inputType:e,operator:n,selectedValues:r,selectedRadioValue:a,startDate:i,endDate:o,value:l,isRangeOperator:s(n),customValidation:null==t?void 0:t.customValidation})}),[t,n,r,a,i,o,l,s]),canApply:e.useCallback((()=>{const e=de(t,n);return kd({inputType:e,selectedValues:r,selectedRadioValue:a,startDate:i,endDate:o,value:l,isRangeOperator:s(n)})}),[t,r,a,n,i,o,l,s])}))({filterConfig:l,operator:m.operator,selectedValues:m.selectedValues,selectedRadioValue:m.selectedRadioValue,startDate:m.startDate,endDate:m.endDate,value:m.value,isRangeOperator:f}),{refs:y,floatingStyles:w,getFloatingProps:C,isPositioned:E,contentMaxHeight:I}=(({isOpen:t,savedCoordinates:n,onCancel:r})=>{const[a,i]=e.useState(!1),[o,l]=e.useState(300),{refs:s,floatingStyles:c,context:u}=oa({open:t,onOpenChange:e=>{e||r()},placement:"bottom-start",middleware:[cn({padding:8,crossAxis:!1}),un({apply({availableWidth:e,availableHeight:t,elements:n}){if(n.floating){const r=Math.max(Dd.CONFIG_PANEL_MIN_CONTENT_HEIGHT,t-Dd.CONFIG_PANEL_HEADER_HEIGHT-Dd.CONFIG_PANEL_BUTTON_HEIGHT-Dd.CONFIG_PANEL_PADDING);l(r),Object.assign(n.floating.style,{maxWidth:`${Math.max(0,e)}px`})}}})]}),d=aa(u,{outsidePress:e=>!e.target.closest("[data-tag]")}),{getFloatingProps:p}=sa([d]);return e.useEffect((()=>{if(n&&t){const e={getBoundingClientRect:()=>({width:0,height:0,x:n.x,y:n.y,top:n.y,left:n.x,right:n.x,bottom:n.y})};s.setReference(e),i(!0)}}),[n,t,s]),e.useEffect((()=>{t||i(!1)}),[t]),{refs:s,floatingStyles:c,getFloatingProps:p,isPositioned:a,contentMaxHeight:o,context:u}})({isOpen:n,savedCoordinates:s||null,onCancel:a}),k=e.useCallback((()=>{if(c){const e=g();if(!e.isValid)return void d(e.errorMessage);d("");const t=(e=>{const{conditions:t,filterConfig:n}=e,r=[],a=[];for(const e of t)try{const t=Ce(n,e.conditionKey);if(!t){a.push(`条件設定 ${e.conditionKey} が見つかりません`);continue}const i=ke(t,e.operator),o=Me(t,e.operator),l=wd({inputType:i,selectedValues:e.selectedValues,selectedRadioValue:e.selectedRadioValue,startDate:e.startDate,endDate:e.endDate,value:e.value,isRangeOperator:o});if(!l||0===l.length||!l.some((e=>""!==e&&null!=e)))continue;const s=Cd(t,e.operator),c=Ed({conditionConfig:t,inputType:i,operator:e.operator,values:l,dateFormat:n?me(n):void 0});r.push({conditionKey:e.conditionKey,conditionLabel:e.conditionLabel,operator:e.operator,operatorLabel:s,values:l,valueLabels:c,isRange:o})}catch(t){const n=t instanceof Error?t.message:"不明なエラーが発生しました";a.push(`条件 ${e.conditionLabel} の処理中にエラーが発生しました: ${n}`)}return{conditions:r,errors:a}})({conditions:h.conditions,filterConfig:l});if(t.errors.length>0)return void d(t.errors.join("\n"));r({operator:"",operatorLabel:"",values:[],valueLabels:[],isRange:!1,conditions:t.conditions})}else{const e=v();if(!e.isValid)return void d(e.errorMessage);d("");const t=de(l,m.operator),n=wd({inputType:t,selectedValues:m.selectedValues,selectedRadioValue:m.selectedRadioValue,startDate:m.startDate,endDate:m.endDate,value:m.value,isRangeOperator:f(m.operator)}),a=((e,t)=>{var n;return e&&(null===(n=ue(e).find((e=>e.value===t)))||void 0===n?void 0:n.label)||t})(l,m.operator),i=(e=>{const{filterConfig:t,inputType:n,operator:r,values:a}=e;return a.map((e=>{if("checkbox"===n||"radio"===n){const n=fe(t,r).find((t=>t.value===e));return(null==n?void 0:n.label)||String(e)}if("date"===n){const n=me(t),r=String(e);if(!r||""===r.trim())return r;const a=ss(r,"YYYY-MM-DD");return a.isValid()?a.format(n):r}return String(e)}))})({filterConfig:l,inputType:t,operator:m.operator,values:n});r({operator:m.operator,operatorLabel:a,values:n,valueLabels:i,isRange:f(m.operator)})}}),[c,l,h,m,v,g,r,f]),{handleKeyDown:M}=(({isOpen:t,canApply:n,handleApply:r,onCancel:a,floatingRef:i})=>{const o=e.useCallback((e=>{if("Enter"===e.key&&!e.shiftKey&&!e.ctrlKey&&!e.altKey){if(e.isComposing||229===e.keyCode)return void e.preventDefault();e.preventDefault(),n()&&r()}}),[n,r]);return e.useEffect((()=>{const e=e=>{"Escape"===e.key&&t&&a()};return t&&document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}}),[t,a]),e.useEffect((()=>{if(!t)return;const e=e=>{var t;const n=e.target;(null===(t=i.current)||void 0===t?void 0:t.contains(n))&&o(e)};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}}),[t,o,i]),{handleKeyDown:e=>{o(e)}}})({isOpen:n,canApply:c?b:x,handleApply:k,onCancel:a,floatingRef:y.floating}),A=e.useMemo((()=>{if(c)return!1;return"text"===de(l,m.operator)&&("contains"===m.operator||"not_contains"===m.operator)}),[l,m.operator,c]);return i.default.createElement(Je,Object.assign({ref:y.setFloating,$isOpen:n,$isPositioned:E,style:w,tabIndex:-1,onKeyDown:M},C()),i.default.createElement(Ue,null,i.default.createElement(Qe,null,t)),i.default.createElement(qe,{style:{maxHeight:`${I}px`}},c?i.default.createElement(Jd,{filterConfig:l,multiConditionState:h,onKeyDown:M}):i.default.createElement(i.default.Fragment,null,i.default.createElement(Ke,null,i.default.createElement(hd,{value:m.operator,variant:"dark",onChange:e=>{if("string"!=typeof e)return;p();const t=e;m.setOperator(t);const n=ss().format("YYYY-MM-DD"),r=(e=>{const{filterConfig:t,newOperator:n,isRangeOperator:r,currentStartDate:a,currentEndDate:i,currentValue:o,todayString:l}=e;if(r(n))return{startDate:a&&""!==a.trim()?void 0:l,endDate:i&&""!==i.trim()?void 0:l};{const e={startDate:"",endDate:""};return"date"!==de(t,n)||o&&""!==o.trim()||(e.value=l),e}})({filterConfig:l,newOperator:t,isRangeOperator:f,currentStartDate:m.startDate,currentEndDate:m.endDate,currentValue:m.value,todayString:n});void 0!==r.startDate&&m.setStartDate(r.startDate),void 0!==r.endDate&&m.setEndDate(r.endDate),void 0!==r.value&&m.setValue(r.value)}},ue(l).map((e=>i.default.createElement(gd,{key:e.value,value:e.value},e.label))))),i.default.createElement(Ke,null,i.default.createElement(Wd,{endDate:m.endDate,filterConfig:l,isRangeOperator:f,operator:m.operator,selectedRadioValue:m.selectedRadioValue,selectedValues:m.selectedValues,startDate:m.startDate,value:m.value,onEndDateChange:m.handleEndDateChange,onKeyDown:M,onRadioChange:m.handleRadioChange,onStartDateChange:m.handleStartDateChange,onValueChange:m.handleValueChange,onValueToggle:m.handleValueToggle}),A&&i.default.createElement(rs,{prepend:i.default.createElement(D,{name:"question"})},"カンマ区切りで複数ワードをOR検索できます。")))),u&&i.default.createElement(et,null,i.default.createElement(yd,{size:"sm"},u)),i.default.createElement(tt,null,i.default.createElement(is,null,i.default.createElement(As,{type:"button",size:"small",color:"clear",onClick:a},"キャンセル"),i.default.createElement(As,{type:"button",size:"small",disabled:c?!b():!x(),onClick:k},"適用"))))};Ud.displayName="AdvancedFilterConfigPanel";const Qd=({types:t,onFiltersChange:n,initialAppliedFilters:r})=>{const[a,i]=e.useState(null),[o,l]=e.useState(!1),[s,c]=e.useState((()=>null!=r?r:[])),[u,d]=e.useState(null),[p,f]=e.useState(!1),m=e.useRef(null),[h,g]=e.useState(24),[b,v]=e.useState(null),x=e.useRef(n);x.current=n;const y=e.useRef(u);y.current=u;const w=e.useRef(s);w.current=s,e.useEffect((()=>{var e;const n=new Set(t.map((e=>e.type))),r=w.current,a=r.filter((e=>n.has(e.type)));if(a.length!==r.length){c(a),null===(e=x.current)||void 0===e||e.call(x,a);const t=y.current;t&&!n.has(t.type)&&(d(null),l(!1),i(null))}}),[t]);return{selectedType:a,isConfigPanelOpen:o,appliedFilters:s,editingFilter:u,isMenuOpen:p,menuPosition:h,savedMenuCoordinates:b,triggerRef:m,setSelectedType:i,setIsConfigPanelOpen:l,setAppliedFilters:c,setEditingFilter:d,setIsMenuOpen:f,setMenuPosition:g,setSavedMenuCoordinates:v,handleTypeSelect:e=>{i(e),l(!0)},handleConfigApply:e=>{let r;if(u){const t=((e,t)=>t.conditions&&t.conditions.length>0?Object.assign(Object.assign({},e),{operator:"",operatorLabel:"",values:[],valueLabels:[],isRange:!1,conditions:t.conditions}):Object.assign(Object.assign({},e),{operator:t.operator,operatorLabel:t.operatorLabel,values:t.values,valueLabels:t.valueLabels,isRange:t.isRange,conditions:void 0}))(u,e);r=s.map((e=>e.id===u.id?t:e)),d(null)}else{const n=xe(t,a),i=((e,t,n)=>n.conditions&&n.conditions.length>0?{id:se(),type:e,typeLabel:t,operator:"",operatorLabel:"",values:[],valueLabels:[],isRange:!1,conditions:n.conditions}:{id:se(),type:e,typeLabel:t,operator:n.operator,operatorLabel:n.operatorLabel,values:n.values,valueLabels:n.valueLabels,isRange:n.isRange})(a,n,e);r=[...s,i]}c(r),null==n||n(r),l(!1),i(null)},handleRemoveFilter:e=>{const t=((e,t)=>e.filter((e=>e.id!==t)))(s,e);c(t),null==n||n(t),u&&u.id===e&&(d(null),l(!1),i(null))},handleClearAll:()=>{const e=[];c(e),null==n||n(e),d(null),l(!1),i(null),f(!1)},handleConfigCancel:()=>{l(!1),i(null),d(null)},handleEditFilter:e=>{u&&u.id===e.id||(p&&f(!1),d(e),i(e.type),l(!0))}}};class qd{static calculateMenuPosition(){const e=document.querySelectorAll(Ld);if(0===e.length)return Dd.DEFAULT_MENU_POSITION;const t=e[0].closest(Rd);if(!t)return Dd.DEFAULT_MENU_POSITION;const n=e[e.length-1].getBoundingClientRect(),r=t.getBoundingClientRect();let a=n.right-r.left+Dd.TAG_SPACING;return e.length>=1&&(a+=Dd.TAG_OFFSET_MULTIPLE),this.calculateSafePosition(a)}static calculateSafePosition(e){const t=window.innerWidth,n=Math.max(Dd.MENU_WIDTH,Dd.CONFIG_PANEL_WIDTH);return e+n>t-16?Math.max(0,t-n-16):e}static calculateConfigPanelPosition(e,t,n){const r=t.findIndex((t=>t.id===e.id));if(-1===r)return this.getFallbackPosition();const a=document.querySelectorAll(Ld);let i=null;for(const t of Array.from(a)){if(t.getAttribute("data-tag")===e.id){i=t;break}}let o=null==n?void 0:n.current;if(!o){const e=document.querySelector(Vd);e&&(o=e)}return i&&o?this.calculateFromActualElements(i,o):o?this.calculateFromTrigger(o,r):this.getFallbackPosition(r)}static calculateFromActualElements(e,t){const n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return{position:r.left-n.left,coordinates:{x:r.left,y:r.bottom+16}}}static calculateFromTrigger(e,t){const n=e.getBoundingClientRect(),r=n.left+Dd.ICON_AREA_WIDTH+t*Dd.ESTIMATED_TAG_WIDTH;return{position:r-n.left,coordinates:{x:r,y:n.bottom+Dd.TAG_SPACING}}}static getFallbackPosition(e=0){const t=Dd.FALLBACK_POSITION_X+e*Dd.ESTIMATED_TAG_WIDTH;return{position:t,coordinates:{x:t,y:Dd.FALLBACK_POSITION_Y}}}static getSavedCoordinates(){const e=document.querySelector(Od);if(!e)return null;const t=e.getBoundingClientRect();return{x:t.left,y:t.top}}}const Kd=({setMenuPosition:t})=>{const n=e.useCallback((()=>{const e=qd.calculateMenuPosition();t(e)}),[t]);return{handleMenuOpen:n}},ep=({types:e,placeholder:t="フィルターを追加",disabled:n=!1,filterConfigs:r={},size:a="medium",variant:o="light",width:l="100%",onFiltersChange:s,initialAppliedFilters:c})=>{const{selectedType:u,isConfigPanelOpen:d,appliedFilters:p,editingFilter:f,isMenuOpen:m,menuPosition:h,savedMenuCoordinates:g,triggerRef:b,setMenuPosition:v,setSavedMenuCoordinates:x,setIsMenuOpen:y,handleTypeSelect:w,handleConfigApply:C,handleRemoveFilter:E,handleClearAll:I,handleConfigCancel:k,handleEditFilter:M}=Qd({types:e,onFiltersChange:s,initialAppliedFilters:c}),{handleMenuOpen:A}=Kd({setMenuPosition:v});i.default.useLayoutEffect((()=>{if(f){const{position:e,coordinates:t}=qd.calculateConfigPanelPosition(f,p,b);v(e),x(t)}}),[f,p,b,v,x]);const $=ve(e,p);return i.default.createElement("div",null,$.length>0&&i.default.createElement(es,null,i.default.createElement(Kl,{open:m,trigger:i.default.createElement(nt,{ref:b,placeholder:t,disabled:n,isOpen:m,appliedFilters:p,size:a,variant:o,width:l,onEditFilter:M,onRemoveFilter:E,onClearAll:I}),minWidth:Dd.MENU_WIDTH,placement:"bottom-start",middleware:[sn({mainAxis:8,crossAxis:h}),cn({padding:8}),un({apply({availableWidth:e,availableHeight:t,elements:n}){if(n.floating){Object.assign(n.floating.style,{width:"max-content",minWidth:`${Dd.MENU_WIDTH}px`,maxWidth:`${Math.max(0,e)}px`,maxHeight:`${Math.max(0,t)}px`});const r=n.floating.getBoundingClientRect();x({x:r.left,y:r.top})}}})],onOpenChange:e=>{y(e),e&&A()}},$.map((e=>i.default.createElement(He,{key:e.type,disabled:e.disabled,closeOnClick:!0,onClick:()=>w(e.type)},e.label))))),0===$.length&&i.default.createElement(nt,{placeholder:"すべてのフィルターが適用済み",disabled:!0,appliedFilters:p,size:a,variant:o,width:l,onEditFilter:M,onRemoveFilter:E,onClearAll:I}),d&&u&&g&&i.default.createElement(Ud,{filterType:xe(e,u),isOpen:d,editingFilter:f,filterConfig:r[u],savedCoordinates:g,onApply:C,onCancel:k}))};ep.displayName="AdvancedFilter";const tp=e=>{if(e instanceof Date)return!isNaN(e.getTime());if("number"==typeof e){const t=new Date(e);return!isNaN(t.getTime())}if("string"==typeof e){if(""===e.trim())return!1;return ss(e).isValid()}return!1},np=e=>{if(e instanceof Date)return isNaN(e.getTime())?null:e;if("number"==typeof e){const t=new Date(e);return isNaN(t.getTime())?null:t}if("string"==typeof e){const t=ss(e);if(t.isValid())return t.toDate()}return null},rp=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate()),ap=(e,t)=>0===((e,t)=>{const n=rp(e),r=rp(t);return n.getTime()-r.getTime()})(e,t),ip=[{value:"equals",label:"次に一致する"},{value:"contains",label:"次を含む"},{value:"starts_with",label:"次で始まる"},{value:"ends_with",label:"次で終わる"},{value:"not_equals",label:"次に一致しない"},{value:"not_contains",label:"次を含まない"}],op=[{value:"equals",label:"次に一致する"},{value:"greater_than",label:"次より大きい"},{value:"less_than",label:"次より小さい"},{value:"greater_than_or_equal",label:"次以上"},{value:"less_than_or_equal",label:"次以下"},{value:"between",label:"次の範囲内",isRange:!0},{value:"not_between",label:"次の範囲外",isRange:!0}],lp=[{value:"equals",label:"次に一致する"},{value:"before",label:"次より前"},{value:"after",label:"次より後"},{value:"between",label:"次の範囲内",isRange:!0},{value:"not_between",label:"次の範囲外",isRange:!0}],sp=[{value:"equals",label:"次に一致する"},{value:"not_equals",label:"次に一致しない"},{value:"in",label:"次のいずれかに一致する"},{value:"not_in",label:"次のいずれにも一致しない"}],cp={text_basic:[ip[0],ip[1],ip[2]],text_search:[ip[1],ip[0],ip[5]],selection_basic:[sp[0],sp[1]],selection_multiple:[sp[2],sp[0],sp[3]],date_basic:[lp[0],lp[2],lp[1]],number_basic:[op[0],op[1],op[2],op[3],op[4]]},up=e=>{const t=cp[e];return t?[...t]:[]},dp=(e,t)=>e.map((e=>Object.assign(Object.assign({},e),{label:t[e.value]||e.label}))),pp=(e,t,n)=>{if("boolean"==typeof e&&"boolean"==typeof n[0])return((e,t,n)=>{switch(t){case"equals":return e===n;case"not_equals":return e!==n;default:return!1}})(e,t,n[0]);if("between"===t||"not_between"===t){if(n.length<2)return!1;if("boolean"==typeof e)return!1;return((e,t,n,r)=>{if(tp(String(e))&&tp(n)&&tp(r)){const a=np(String(e)),i=np(n),o=np(r);if(a&&i&&o){const e=rp(a),n=rp(i),r=rp(o),l=e>=n&&e<=r;return"between"===t?l:!l}}const a=Number(e),i=Number(n),o=Number(r);if(!isNaN(a)&&!isNaN(i)&&!isNaN(o)){const e=a>=i&&a<=o;return"between"===t?e:!e}return!1})(e,t,"string"==typeof n[0]?n[0]:String(n[0]),"string"==typeof n[1]?n[1]:String(n[1]))}if("before"===t||"after"===t){if("boolean"==typeof e)return!1;return((e,t,n)=>{if(tp(String(e))&&tp(n)){const r=np(String(e)),a=np(n);if(r&&a){const e=rp(r),n=rp(a);return"before"===t?e<n:e>n}}const r=Number(e),a=Number(n);return!isNaN(r)&&!isNaN(a)&&("before"===t?r<a:r>a)})(e,t,"string"==typeof n[0]?n[0]:String(n[0]))}if("equals"===t||"not_equals"===t){if("boolean"==typeof e)return!1;if(n.length>1){const r=String(e).toLowerCase(),a=n.map((e=>"string"==typeof e?e.toLowerCase():String(e))).includes(r);return"equals"===t?a:!a}return((e,t,n)=>{if(tp(String(e))&&tp(n)){const r=np(String(e)),a=np(n);if(r&&a){const e=ap(r,a);return"equals"===t?e:!e}}const r=String(e).toLowerCase()===n.toLowerCase();return"equals"===t?r:!r})(e,t,"string"==typeof n[0]?n[0]:String(n[0]||""))}const r="string"==typeof n[0]?n[0]:String(n[0]||"");if("contains"===t||"not_contains"===t||"starts_with"===t||"ends_with"===t)return((e,t,n)=>{const r=e.toLowerCase(),a=n.trim();if(("contains"===t||"not_contains"===t)&&a.includes(",")){const e=Tc(a);return"contains"===t?e.some((e=>r.includes(e.toLowerCase()))):!e.some((e=>r.includes(e.toLowerCase())))}const i=a.toLowerCase();switch(t){case"contains":return r.includes(i);case"not_contains":return!r.includes(i);case"starts_with":return r.startsWith(i);case"ends_with":return r.endsWith(i);default:return!1}})(String(e),t,r);if("in"===t||"not_in"===t){const r=String(e).toLowerCase(),a=n.map((e=>"string"==typeof e?e.toLowerCase():String(e))).includes(r);return"in"===t?a:!a}if("greater_than"===t||"less_than"===t||"greater_than_or_equal"===t||"less_than_or_equal"===t){const n=Number(e);if(!isNaN(n))return((e,t,n)=>{const r=Number(n);if(isNaN(r))return!1;switch(t){case"greater_than":return e>r;case"less_than":return e<r;case"greater_than_or_equal":return e>=r;case"less_than_or_equal":return e<=r;default:return!1}})(n,t,r)}return!0},fp=(e,t,n,r)=>r.length?e.filter((e=>{const a=e[t];return pp(a,n,r)})):e,mp=o.default.div`
1097
1097
  position: fixed;
1098
1098
  display: flex;
1099
1099
  align-items: center;