import{g as M,e as E,s as S,S as H,z as k,_ as x,a as O,W as V,u as D,c as U,b as A}from"./iconBase-1.0.13-98e06aa9.js";import{r as i,j as o}from"./main-1.0.13.js";import{L as z,B as N}from"./main-1.0.13-4cbe632d.js";import{a as I}from"./TextField-1.0.13-7258d491.js";import{L}from"./Link-1.0.13-03de5435.js";function Q(t){return i.Children.toArray(t).filter(e=>i.isValidElement(e))}function J(t){return E("MuiToggleButton",t)}const K=M("MuiToggleButton",["root","disabled","selected","standard","primary","secondary","sizeSmall","sizeMedium","sizeLarge","fullWidth"]),C=K,X=i.createContext({}),F=X,Y=i.createContext(void 0),q=Y;function Z(t,e){return e===void 0||t===void 0?!1:Array.isArray(e)?e.indexOf(t)>=0:t===e}const tt=["value"],et=["children","className","color","disabled","disableFocusRipple","fullWidth","onChange","onClick","selected","size","value"],ot=t=>{const{classes:e,fullWidth:r,selected:n,disabled:f,size:p,color:B}=t,h={root:["root",n&&"selected",f&&"disabled",r&&"fullWidth",`size${k(p)}`,B]};return A(h,J,e)},st=S(H,{name:"MuiToggleButton",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:r}=t;return[e.root,e[`size${k(r.size)}`]]}})(({theme:t,ownerState:e})=>{let r=e.color==="standard"?t.palette.text.primary:t.palette[e.color].main,n;return t.vars&&(r=e.color==="standard"?t.vars.palette.text.primary:t.vars.palette[e.color].main,n=e.color==="standard"?t.vars.palette.text.primaryChannel:t.vars.palette[e.color].mainChannel),x({},t.typography.button,{borderRadius:(t.vars||t).shape.borderRadius,padding:11,border:`1px solid ${(t.vars||t).palette.divider}`,color:(t.vars||t).palette.action.active},e.fullWidth&&{width:"100%"},{[`&.${C.disabled}`]:{color:(t.vars||t).palette.action.disabled,border:`1px solid ${(t.vars||t).palette.action.disabledBackground}`},"&:hover":{textDecoration:"none",backgroundColor:t.vars?`rgba(${t.vars.palette.text.primaryChannel} / ${t.vars.palette.action.hoverOpacity})`:z(t.palette.text.primary,t.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:"transparent"}},[`&.${C.selected}`]:{color:r,backgroundColor:t.vars?`rgba(${n} / ${t.vars.palette.action.selectedOpacity})`:z(r,t.palette.action.selectedOpacity),"&:hover":{backgroundColor:t.vars?`rgba(${n} / calc(${t.vars.palette.action.selectedOpacity} + ${t.vars.palette.action.hoverOpacity}))`:z(r,t.palette.action.selectedOpacity+t.palette.action.hoverOpacity),"@media (hover: none)":{backgroundColor:t.vars?`rgba(${n} / ${t.vars.palette.action.selectedOpacity})`:z(r,t.palette.action.selectedOpacity)}}}},e.size==="small"&&{padding:7,fontSize:t.typography.pxToRem(13)},e.size==="large"&&{padding:15,fontSize:t.typography.pxToRem(15)})}),rt=i.forwardRef(function(e,r){const n=i.useContext(F),{value:f}=n,p=O(n,tt),B=i.useContext(q),h=V(x({},p,{selected:Z(e.value,f)}),e),v=D({props:h,name:"MuiToggleButton"}),{children:$,className:g,color:P="standard",disabled:m=!1,disableFocusRipple:a=!1,fullWidth:G=!1,onChange:b,onClick:u,selected:_,size:y="medium",value:T}=v,j=O(v,et),R=x({},v,{color:P,disabled:m,disableFocusRipple:a,fullWidth:G,size:y}),W=ot(R),d=c=>{u&&(u(c,T),c.defaultPrevented)||b&&b(c,T)},l=B||"";return o.jsx(st,x({className:U(p.className,W.root,g,l),disabled:m,focusRipple:!a,ref:r,onClick:d,onChange:b,value:T,ownerState:R,"aria-pressed":_},j,{children:$}))}),ht=rt;function nt(t){return E("MuiToggleButtonGroup",t)}const at=M("MuiToggleButtonGroup",["root","selected","vertical","disabled","grouped","groupedHorizontal","groupedVertical","fullWidth","firstButton","lastButton","middleButton"]),s=at,lt=["children","className","color","disabled","exclusive","fullWidth","onChange","orientation","size","value"],it=t=>{const{classes:e,orientation:r,fullWidth:n,disabled:f}=t,p={root:["root",r==="vertical"&&"vertical",n&&"fullWidth"],grouped:["grouped",`grouped${k(r)}`,f&&"disabled"],firstButton:["firstButton"],lastButton:["lastButton"],middleButton:["middleButton"]};return A(p,nt,e)},dt=S("div",{name:"MuiToggleButtonGroup",slot:"Root",overridesResolver:(t,e)=>{const{ownerState:r}=t;return[{[`& .${s.grouped}`]:e.grouped},{[`& .${s.grouped}`]:e[`grouped${k(r.orientation)}`]},{[`& .${s.firstButton}`]:e.firstButton},{[`& .${s.lastButton}`]:e.lastButton},{[`& .${s.middleButton}`]:e.middleButton},e.root,r.orientation==="vertical"&&e.vertical,r.fullWidth&&e.fullWidth]}})(({ownerState:t,theme:e})=>x({display:"inline-flex",borderRadius:(e.vars||e).shape.borderRadius},t.orientation==="vertical"&&{flexDirection:"column"},t.fullWidth&&{width:"100%"},{[`& .${s.grouped}`]:x({},t.orientation==="horizontal"?{[`&.${s.selected} + .${s.grouped}.${s.selected}`]:{borderLeft:0,marginLeft:0}}:{[`&.${s.selected} + .${s.grouped}.${s.selected}`]:{borderTop:0,marginTop:0}})},t.orientation==="horizontal"?{[`& .${s.firstButton},& .${s.middleButton}`]:{borderTopRightRadius:0,borderBottomRightRadius:0},[`& .${s.lastButton},& .${s.middleButton}`]:{marginLeft:-1,borderLeft:"1px solid transparent",borderTopLeftRadius:0,borderBottomLeftRadius:0}}:{[`& .${s.firstButton},& .${s.middleButton}`]:{borderBottomLeftRadius:0,borderBottomRightRadius:0},[`& .${s.lastButton},& .${s.middleButton}`]:{marginTop:-1,borderTop:"1px solid transparent",borderTopLeftRadius:0,borderTopRightRadius:0}},t.orientation==="horizontal"?{[`& .${s.lastButton}.${C.disabled},& .${s.middleButton}.${C.disabled}`]:{borderLeft:"1px solid transparent"}}:{[`& .${s.lastButton}.${C.disabled},& .${s.middleButton}.${C.disabled}`]:{borderTop:"1px solid transparent"}})),ut=i.forwardRef(function(e,r){const n=D({props:e,name:"MuiToggleButtonGroup"}),{children:f,className:p,color:B="standard",disabled:h=!1,exclusive:v=!1,fullWidth:$=!1,onChange:g,orientation:P="horizontal",size:m="medium",value:a}=n,G=O(n,lt),b=x({},n,{disabled:h,fullWidth:$,orientation:P,size:m}),u=it(b),_=i.useCallback((d,l)=>{if(!g)return;const c=a&&a.indexOf(l);let w;a&&c>=0?(w=a.slice(),w.splice(c,1)):w=a?a.concat(l):[l],g(d,w)},[g,a]),y=i.useCallback((d,l)=>{g&&g(d,a===l?null:l)},[g,a]),T=i.useMemo(()=>({className:u.grouped,onChange:v?y:_,value:a,size:m,fullWidth:$,color:B,disabled:h}),[u.grouped,v,y,_,a,m,$,B,h]),j=Q(f),R=j.length,W=d=>{const l=d===0,c=d===R-1;return l&&c?"":l?u.firstButton:c?u.lastButton:u.middleButton};return o.jsx(dt,x({role:"group",className:U(u.root,p),ref:r,ownerState:b},G,{children:o.jsx(F.Provider,{value:T,children:j.map((d,l)=>o.jsx(q.Provider,{value:W(l),children:d},l))})}))}),Bt=ut,vt=()=>{const[t,e]=i.useState(!1);return o.jsxs(I,{component:"div",children:["Only valid SQL. ",t?o.jsxs(o.Fragment,{children:[o.jsx("span",{children:o.jsx(L,{sx:{cursor:"pointer"},underline:"none",onClick:()=>{e(!1)},children:"(hide examples)"})}),o.jsxs("ul",{style:{listStyle:"disc",padding:"0 40px"},children:[o.jsx("li",{children:"first_name like 'Sacha%'"}),o.jsx("li",{children:"product_id = httpPost['my_product_id'] and httpPost['my_product_id'] is not null"}),o.jsx("li",{children:"user_id = @wpda_wp_user_id"}),o.jsx("li",{children:"user_id in (select user_id from wp_usermeta where meta_key = 'wp_capabilities' and meta_value like '%coach%')"}),o.jsx("li",{children:"order_date between date_sub(now(), interval 1 week) and now()"}),o.jsx("li",{children:"status = 'send' and order_date > date_sub(now(), interval 1 week)"})]}),o.jsx("div",{children:o.jsx("strong",{children:"Advanced features:"})}),o.jsxs("ul",{style:{listStyle:"disc",padding:"0 40px",marginBottom:0},children:[o.jsxs("li",{children:["Session variable ",o.jsx("strong",{children:"@wpda_wp_user_id"})," is available to access the WordPress user ID.",o.jsx(L,{href:"https://wpdataaccess.com/docs/variable/wordpress-user-id-in-sql/",target:"_blank",style:{marginLeft:"5px",textDecoration:"none"},children:"(visit documentation page)"})]}),o.jsxs("li",{children:["The functions ",o.jsx("strong",{children:"httpGet"}),", ",o.jsx("strong",{children:"httpPost"})," and ",o.jsx("strong",{children:"httpRequest"})," can be used to access HTTP GET and POST parameters in a query. All functions return null when the requested parameter was not provided. The following condition returns no rows if no parameter was provided:",o.jsx("br",{}),o.jsx(N,{sx:{margin:"5px 20px"},children:o.jsxs("strong",{children:["where product_id = httpPost['my_product_id']",o.jsx("br",{}),"and httpPost['my_product_id'] is not null"]})}),"The condition below returns all rows if no parameter was provided:",o.jsx(N,{sx:{margin:"5px 20px"},children:o.jsxs("strong",{children:["where product_id = httpPost['my_product_id']",o.jsx("br",{}),"and httpPost['my_product_id'] is null"]})})]})]})]}):o.jsx("span",{children:o.jsx(L,{sx:{cursor:"pointer"},underline:"none",onClick:()=>{e(!0)},children:"(show examples)"})})]})};export{vt as D,Bt as T,ht as a};