|
1
|
|
-(()=>{var e,t={799:(e,t,s)=>{"use strict";const n=window.wp.element,r={setAutoConnect:e=>({type:"SET_AUTO_CONNECT",autoConnect:e}),setAPIKey:e=>({type:"SET_API_KEY",apiKey:e}),setAvailableApps:e=>({type:"SET_AVAILABLE_APPS",availableApps:e}),setIsConnected:e=>({type:"SET_IS_CONNECTED",isConnected:e}),setIsConnecting:e=>({type:"SET_IS_CONNECTING",isConnecting:e}),setIsLoading:e=>({type:"SET_IS_LOADING",isLoading:e}),sethasDashboardLoaded:e=>({type:"SET_HAS_DASHBOARD_LOADED",hasDashboardLoaded:e}),setHasRestError:e=>({type:"SET_HAS_REST_ERROR",hasRestError:e}),setHasValidKey:e=>({type:"SET_HAS_VALID_KEY",hasValidKey:e}),setHasApplication:e=>({type:"SET_HAS_APPLICATION",hasApplication:e}),setUserData:e=>({type:"SET_USER_DATA",data:e}),setUserStatus:e=>({type:"SET_USER_STATUS",status:e}),setShowDisconnect:e=>({type:"SET_SHOW_DISCONNECT",showDisconnect:e}),setConflicts:e=>({type:"SET_CONFLICTS",conflicts:e}),setOptimizedImages:e=>({type:"SET_OPTIMIZED_IMAGES",optimizedImages:e}),setSiteSettings:e=>({type:"SET_SITE_SETTINGS",siteSettings:e}),setExtraVisits:e=>({type:"SET_EXTRA_VISITS",extraVisitsStatus:e}),setSampleRate:e=>({type:"SET_SAMPLE_RATE",sampleRate:e}),setTotalNumberOfImages:e=>({type:"SET_TOTAL_NUMBER_OF_IMAGES",totalNumberOfImages:e}),setProcessedImages:e=>({type:"SET_PROCESSED_IMAGES",processedImages:e}),setOffloadLibraryLink:e=>({type:"SET_OFFLOAD_LIBRARY_LINK",offloadLibraryLink:e}),setRollbackLibraryLink:e=>({type:"SET_ROLLBACK_LIBRARY_LINK",rollbackLibraryLink:e}),setLoadingRollback:e=>({type:"SET_LOADING_ROLLBACK",loadingRollback:e}),setLoadingSync:e=>({type:"SET_LOADING_SYNC",loadingSync:e}),setQueryArgs:e=>({type:"SET_QUERY_ARGS",queryArgs:e}),setErrorMedia:e=>({type:"SET_ERROR_MEDIA",errorMedia:e}),setEstimatedTime:e=>({type:"SET_ESTIMATED_TIME",estimatedTime:e}),setCheckedOffloadConflicts:e=>({type:"SET_CHECKED_OFFLOAD_CONFLICTS",checkedOffloadConflicts:e}),setOffloadConflicts:e=>({type:"SET_OFFLOAD_CONFLICTS",offloadConflicts:e}),setLogs:(e,t)=>({type:"SET_LOGS",logsType:e,logs:t})},a={autoConnect:optimoleDashboardApp.auto_connect,isConnected:"yes"===optimoleDashboardApp.connection_status,isConnecting:!1,isLoading:!1,hasRestError:!1,hasValidKey:!0,hasApplication:"yes"===optimoleDashboardApp.has_application,apiKey:optimoleDashboardApp.api_key?optimoleDashboardApp.api_key:"",userStatus:optimoleDashboardApp.user_status?optimoleDashboardApp.user_status:"inactive",userData:optimoleDashboardApp.user_data?optimoleDashboardApp.user_data:null,availableApps:optimoleDashboardApp.available_apps?optimoleDashboardApp.available_apps:null,hasDashboardLoaded:"yes"===optimoleDashboardApp.connection_status,showDisconnect:!1,conflicts:[],optimizedImages:[],siteSettings:optimoleDashboardApp.site_settings,sampleRate:{},totalNumberOfImages:0,processedImages:0,offloadLibraryLink:!1,rollbackLibraryLink:!1,loadingRollback:!1,loadingSync:!1,queryArgs:[],errorMedia:!1,checkedOffloadConflicts:!1,offloadConflicts:[],logs:{offload:"",rollback:""}},o=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:a,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"SET_AUTO_CONNECT":return{...e,autoConnect:t.autoConnect};case"SET_HAS_REST_ERROR":case"SET_HAS_REST_ERROR":return{...e,hasRestError:t.hasRestError};case"SET_API_KEY":return{...e,apiKey:t.apiKey};case"SET_AVAILABLE_APPS":return{...e,availableApps:t.availableApps};case"SET_IS_CONNECTED":return{...e,isConnected:t.isConnected};case"SET_IS_CONNECTING":return{...e,isConnecting:t.isConnecting};case"SET_IS_LOADING":return{...e,isLoading:t.isLoading};case"SET_HAS_DASHBOARD_LOADED":return{...e,hasDashboardLoaded:t.hasDashboardLoaded};case"SET_HAS_VALID_KEY":return{...e,hasValidKey:t.hasValidKey};case"SET_HAS_APPLICATION":return{...e,hasApplication:t.hasApplication};case"SET_USER_DATA":let s="inactive";const{data:n}=t;if(n&&n.app_count&&1<=n.app_count&&n.cdn_key)for(let e of n.available_apps)e.key&&e.key===n.cdn_key&&e.status&&"active"===e.status&&(s="active");return{...e,userData:t.data,userStatus:s};case"SET_USER_STATUS":return{...e,userStatus:t.status};case"SET_SHOW_DISCONNECT":return{...e,showDisconnect:t.showDisconnect};case"SET_CONFLICTS":return{...e,conflicts:t.conflicts};case"SET_OPTIMIZED_IMAGES":return{...e,optimizedImages:t.optimizedImages};case"SET_SITE_SETTINGS":let{siteSettings:r}=e;for(let e in t.siteSettings)r[e]=t.siteSettings[e];return{...e,siteSettings:r};case"SET_EXTRA_VISITS":{let{siteSettings:s}=e;return s.banner_frontend=t.extraVisitsStatus?"enabled":"disabled",{...e,siteSettings:s}}case"SET_SAMPLE_RATE":return{...e,sampleRate:t.sampleRate};case"SET_TOTAL_NUMBER_OF_IMAGES":return{...e,totalNumberOfImages:t.totalNumberOfImages};case"SET_PROCESSED_IMAGES":return{...e,processedImages:t.processedImages};case"SET_OFFLOAD_LIBRARY_LINK":return{...e,offloadLibraryLink:t.offloadLibraryLink};case"SET_ROLLBACK_LIBRARY_LINK":return{...e,rollbackLibraryLink:t.rollbackLibraryLink};case"SET_LOADING_ROLLBACK":return Object.prototype.hasOwnProperty.call(e.queryArgs,"optimole_action")&&(e.rollbackLibraryLink=!t.loadingSync),{...e,loadingRollback:t.loadingRollback};case"SET_LOADING_SYNC":return Object.prototype.hasOwnProperty.call(e.queryArgs,"optimole_action")&&(e.offloadLibraryLink=!t.loadingSync),{...e,loadingSync:t.loadingSync};case"SET_QUERY_ARGS":return{...e,queryArgs:t.queryArgs};case"SET_ERROR_MEDIA":return{...e,errorMedia:t.errorMedia};case"SET_CHECKED_OFFLOAD_CONFLICTS":return{...e,checkedOffloadConflicts:t.checkedOffloadConflicts};case"SET_OFFLOAD_CONFLICTS":return{...e,offloadConflicts:t.offloadConflicts};case"SET_LOGS":let{logs:a}=e;return a[t.logsType]=t.logs,{...e,logs:a};default:return e}},i={getAutoConnect:e=>e.autoConnect,getAPIKey:e=>e.apiKey,getAvailableApps:e=>e.availableApps,hasRestError:e=>e.hasRestError,hasValidKey:e=>e.hasValidKey,hasApplication:e=>e.hasApplication,hasDashboardLoaded:e=>e.hasDashboardLoaded,getUserData:e=>e.userData,getUserStatus:e=>e.userStatus,isConnected:e=>e.isConnected,isConnecting:e=>e.isConnecting,isLoading:e=>e.isLoading,showDisconnect:e=>e.showDisconnect,getConflicts:e=>e.conflicts,getOptimizedImages:e=>e.optimizedImages,getSiteSettings(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;return t?void 0!==e.siteSettings[t]?e.siteSettings[t]:void 0:e.siteSettings},getSampleRate:e=>e.sampleRate,getTotalNumberOfImages:e=>e.totalNumberOfImages,getProcessedImages:e=>e.processedImages,getOffloadLibraryLink:e=>e.offloadLibraryLink,getRollbackLibraryLink:e=>e.rollbackLibraryLink,getLoadingRollback:e=>e.loadingRollback,getLoadingSync:e=>e.loadingSync,getQueryArgs:e=>e.queryArgs,getErrorMedia:e=>e.errorMedia,getCheckedOffloadConflicts:e=>e.checkedOffloadConflicts,getOffloadConflicts:e=>e.offloadConflicts,getLogs(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;return t?void 0!==e.logs[t]?e.logs[t]:void 0:e.logs}};if(void 0!==wp.data.createReduxStore){const e=wp.data.createReduxStore("optimole",{reducer:o,actions:r,selectors:i});wp.data.register(e)}else wp.data.registerStore("optimole",{reducer:o,actions:r,selectors:i});const l=window.wp.data;var d=s(184),c=s.n(d);const u=window.wp.primitives,p=(0,n.createElement)(u.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,n.createElement)(u.Path,{d:"M15.1 4.8l-3-2.5V4c-4.4 0-8 3.6-8 8 0 3.7 2.5 6.9 6 7.7.3.1.6.1 1 .2l.2-1.5c-.4 0-.7-.1-1.1-.2l-.1.2v-.2c-2.6-.8-4.5-3.3-4.5-6.2 0-3.6 2.9-6.5 6.5-6.5v1.8l3-2.5zM20 11c-.2-1.4-.7-2.7-1.6-3.8l-1.2.8c.7.9 1.1 2 1.3 3.1L20 11zm-1.5 1.8c-.1.5-.2 1.1-.4 1.6s-.5 1-.8 1.5l1.2.9c.4-.5.8-1.1 1-1.8s.5-1.3.5-2l-1.5-.2zm-5.6 5.6l.2 1.5c1.4-.2 2.7-.7 3.8-1.6l-.9-1.1c-.9.7-2 1.1-3.1 1.2z"})),m=window.wp.components,h=()=>(0,n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"21",height:"20",viewBox:"0 0 21 20",fill:"none"},(0,n.createElement)("path",{d:"M17.357 2.92894C16.9664 2.53842 16.3333 2.53842 15.9427 2.92894C15.5522 3.31946 15.5522 3.95263 15.9427 4.34315L17.357 2.92894ZM16.6499 16.364L15.9427 17.0711H15.9427L16.6499 16.364ZM14.5285 5.75737C14.138 5.36684 13.5048 5.36684 13.1143 5.75737C12.7238 6.14789 12.7238 6.78106 13.1143 7.17158L14.5285 5.75737ZM13.8214 13.5355L13.1143 14.2426L13.1143 14.2427L13.8214 13.5355ZM6.04325 14.2427C6.43377 14.6332 7.06694 14.6332 7.45746 14.2427C7.84799 13.8521 7.84799 13.219 7.45746 12.8284L6.04325 14.2427ZM6.32586 10.5662C6.24822 10.0194 5.74201 9.63905 5.19521 9.71669C4.64841 9.79434 4.26808 10.3005 4.34573 10.8473L6.32586 10.5662ZM3.21482 17.0711C3.60535 17.4616 4.23851 17.4616 4.62903 17.0711C5.01956 16.6806 5.01956 16.0474 4.62903 15.6569L3.21482 17.0711ZM2.70292 7.44452C2.87885 6.921 2.59707 6.354 2.07355 6.17807C1.55004 6.00215 0.98303 6.28393 0.807105 6.80744L2.70292 7.44452ZM1.993 0.292893C1.60247 -0.0976311 0.969306 -0.0976311 0.578782 0.292893C0.188258 0.683417 0.188258 1.31658 0.578782 1.70711L1.993 0.292893ZM18.5788 19.7071C18.9693 20.0976 19.6025 20.0976 19.993 19.7071C20.3835 19.3166 20.3835 18.6834 19.993 18.2929L18.5788 19.7071ZM15.9427 4.34315C19.0669 7.46735 19.0669 12.5327 15.9427 15.6569L17.357 17.0711C21.2622 13.1658 21.2622 6.83418 17.357 2.92894L15.9427 4.34315ZM13.1143 7.17158C14.6764 8.73368 14.6764 11.2663 13.1143 12.8284L14.5285 14.2427C16.8717 11.8995 16.8717 8.10051 14.5285 5.75737L13.1143 7.17158ZM10.2859 10H12.2859C12.2859 8.89544 11.3905 8.00001 10.2859 8.00001V10ZM7.45746 12.8284C6.81978 12.1908 6.44341 11.394 6.32586 10.5662L4.34573 10.8473C4.52209 12.0894 5.08876 13.2882 6.04325 14.2427L7.45746 12.8284ZM4.62903 15.6569C2.40899 13.4368 1.76507 10.2354 2.70292 7.44452L0.807105 6.80744C-0.363267 10.2902 0.43743 14.2937 3.21482 17.0711L4.62903 15.6569ZM10.2859 10L10.2859 10V8.00001C9.73388 8.00001 9.23252 8.22496 8.87168 8.58578L10.2859 10ZM0.578782 1.70711L8.87168 10L10.2859 8.58579L1.993 0.292893L0.578782 1.70711ZM8.87168 10L10.2859 11.4142L11.7001 10L10.2859 8.58579L8.87168 10ZM10.2859 11.4142L13.1143 14.2426L14.5285 12.8284L11.7001 10L10.2859 11.4142ZM13.1143 14.2427L15.9427 17.0711L17.357 15.6569L14.5285 12.8284L13.1143 14.2427ZM15.9427 17.0711L18.5788 19.7071L19.993 18.2929L17.357 15.6569L15.9427 17.0711ZM10.2859 10L10.2859 10L11.7001 11.4142C12.0609 11.0534 12.2859 10.552 12.2859 10H10.2859Z",fill:"#E77777"})),g=()=>(0,n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"21",height:"16",viewBox:"0 0 21 16",fill:"none"},(0,n.createElement)("path",{d:"M4.00127 14.3639C0.486555 10.8492 0.486555 5.15071 4.00127 1.63599M16.7292 1.63599C20.2439 5.15071 20.2439 10.8492 16.7292 14.3639M6.8297 11.5355C4.87708 9.58286 4.87708 6.41704 6.8297 4.46441M13.9008 4.46441C15.8534 6.41704 15.8534 9.58286 13.9008 11.5355M11.3652 7.99995C11.3652 8.55223 10.9175 8.99995 10.3652 8.99995C9.81295 8.99995 9.36523 8.55223 9.36523 7.99995C9.36523 7.44766 9.81295 6.99995 10.3652 6.99995C10.9175 6.99995 11.3652 7.44766 11.3652 7.99995Z",stroke:"#6D955A","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})),f=()=>(0,n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"55",height:"55",viewBox:"0 0 55 55",fill:"none"},(0,n.createElement)("path",{d:"M46.6215 21.757C44.6278 22.9074 43.5209 25.0684 43.5415 27.3692C43.5415 27.4128 43.5415 27.4563 43.5415 27.4999C43.5415 27.5434 43.5415 27.5892 43.5415 27.6328C43.5209 29.9336 44.6278 32.0947 46.6215 33.2451L46.6399 33.2565C47.9943 34.038 49.7565 33.2657 50.043 31.728C50.5678 28.9047 50.5426 26.0378 50.0178 23.2717C49.7268 21.7386 47.9713 20.9778 46.6215 21.757V21.757Z",stroke:"#577BF9","stroke-width":"1.91406","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.createElement)("path",{d:"M19.8137 13.4291C19.6052 13.5437 19.3989 13.6629 19.195 13.7866C17.2906 14.9462 14.8958 14.9256 12.9639 13.8096C11.621 13.035 11.385 11.1421 12.5583 10.1291C14.701 8.27747 17.1875 6.8131 19.9145 5.85518C21.3812 5.33955 22.912 6.48997 22.912 8.04372V8.06205C22.912 10.2781 21.7547 12.3635 19.8137 13.4291V13.4291Z",stroke:"#577BF9","stroke-width":"1.91406","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.createElement)("path",{d:"M19.8137 13.4291C19.6052 13.5437 19.3989 13.6629 19.195 13.7866C17.2906 14.9462 14.8958 14.9256 12.9639 13.8096C11.621 13.035 11.385 11.1421 12.5583 10.1291C14.701 8.27747 17.1875 6.8131 19.9145 5.85518C21.3812 5.33955 22.912 6.48997 22.912 8.04372V8.06205C22.912 10.2781 21.7547 12.3635 19.8137 13.4291V13.4291Z",stroke:"#577BF9","stroke-width":"1.91406","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.createElement)("path",{d:"M35.2025 41.5616C35.4065 41.4493 35.6081 41.3325 35.8075 41.211C37.7119 40.0514 40.1067 40.0721 42.0386 41.1881C43.3815 41.9627 43.6175 43.8556 42.4442 44.8685C40.3015 46.7202 37.815 48.1846 35.0879 49.1448C33.6213 49.6627 32.0881 48.5123 32.0881 46.9562C32.0881 44.731 33.2523 42.6364 35.2025 41.5616V41.5616Z",stroke:"#577BF9","stroke-width":"1.91406","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.createElement)("path",{d:"M8.37836 33.243C7.02857 34.0221 5.27315 33.2613 4.98211 31.7305C4.45732 28.9644 4.43211 26.0953 4.9569 23.2719C5.24336 21.7342 7.00336 20.9619 8.35773 21.7434L8.37836 21.7548C10.3721 22.9053 11.479 25.0663 11.4584 27.3671C11.4584 27.4107 11.4584 27.4565 11.4584 27.5001C11.4584 27.5436 11.4584 27.5871 11.4584 27.6307C11.479 29.9315 10.3721 32.0926 8.37836 33.243V33.243Z",stroke:"#577BF9","stroke-width":"1.91406","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.createElement)("path",{d:"M8.37836 33.243C7.02857 34.0221 5.27315 33.2613 4.98211 31.7305C4.45732 28.9644 4.43211 26.0953 4.9569 23.2719C5.24336 21.7342 7.00336 20.9619 8.35773 21.7434L8.37836 21.7548C10.3721 22.9053 11.479 25.0663 11.4584 27.3671C11.4584 27.4107 11.4584 27.4565 11.4584 27.5001C11.4584 27.5436 11.4584 27.5871 11.4584 27.6307C11.479 29.9315 10.3721 32.0926 8.37836 33.243V33.243Z",stroke:"#577BF9","stroke-width":"1.91406","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.createElement)("path",{d:"M32.0881 8.06439C32.0881 6.50605 33.6258 5.36709 35.0948 5.88043C37.7531 6.80855 40.2511 8.22022 42.435 10.0902C43.6221 11.1077 43.4113 13.0167 42.0569 13.7981L42.0363 13.8096C40.1044 14.9233 37.7119 14.9463 35.8075 13.7867C35.6036 13.6629 35.3973 13.5415 35.1865 13.4269C33.2454 12.3636 32.0881 10.2781 32.0881 8.06439V8.06439Z",stroke:"#577BF9","stroke-width":"1.91406","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.createElement)("path",{d:"M32.0881 8.06439C32.0881 6.50605 33.6258 5.36709 35.0948 5.88043C37.7531 6.80855 40.2511 8.22022 42.435 10.0902C43.6221 11.1077 43.4113 13.0167 42.0569 13.7981L42.0363 13.8096C40.1044 14.9233 37.7119 14.9463 35.8075 13.7867C35.6036 13.6629 35.3973 13.5415 35.1865 13.4269C33.2454 12.3636 32.0881 10.2781 32.0881 8.06439V8.06439Z",stroke:"#577BF9","stroke-width":"1.91406","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.createElement)("path",{d:"M22.9122 46.9357C22.9122 48.494 21.3745 49.633 19.9055 49.1196C17.2472 48.1915 14.7493 46.7798 12.5653 44.9098C11.3782 43.8923 11.5891 41.9834 12.9434 41.2019C14.8868 40.079 17.2953 40.0607 19.2157 41.2248C19.4128 41.344 19.6122 41.4609 19.8161 41.5709C21.7549 42.6365 22.9122 44.7219 22.9122 46.9357V46.9357Z",stroke:"#577BF9","stroke-width":"1.91406","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.createElement)("path",{d:"M27.5 20.6256L34.3755 27.5011L27.5 34.3766L20.6245 27.5011L27.5 20.6256Z",stroke:"#577BF9","stroke-width":"1.91406","stroke-linecap":"round","stroke-linejoin":"round"})),b=(0,n.createElement)("svg",{width:"18",height:"16",viewBox:"0 0 18 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,n.createElement)("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M8.9581 0C13.5192 0 17.2136 3.58 17.2136 8C17.2136 12.42 13.5192 16 8.9581 16C4.39696 16 0.702637 12.42 0.702637 8C0.702637 3.58 4.39696 0 8.9581 0ZM10.6558 9L11.0219 3H7.92606L8.29211 9H10.6558ZM11.0219 11.5115C11.0219 11.9809 10.8811 12.3473 10.6213 12.6107C10.3507 12.874 9.97188 13 9.48478 13C8.99768 13 8.61882 12.874 8.33739 12.6107C8.06677 12.3473 7.92606 11.9809 7.92606 11.5115C7.92606 11.0305 8.05595 10.6641 8.32656 10.4008C8.59717 10.1374 8.97603 10 9.48478 10C9.99353 10 10.3724 10.1374 10.6322 10.4008C10.892 10.6641 11.0219 11.0305 11.0219 11.5115Z",fill:"#AF3535"})),_=(0,n.createElement)("svg",{width:"20",height:"22",viewBox:"0 0 20 22",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,n.createElement)("path",{d:"M5 15C2.79086 15 1 13.2091 1 11C1 9.09295 2.33457 7.4976 4.12071 7.09695C4.04169 6.74395 4 6.37684 4 6C4 3.23858 6.23858 1 9 1C11.4193 1 13.4373 2.71825 13.9002 5.00098C13.9334 5.00033 13.9666 5 14 5C16.7614 5 19 7.23858 19 10C19 12.419 17.2822 14.4367 15 14.9M13 12L10 9M10 9L7 12M10 9L10 21",stroke:"#577BF9","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})),v=(0,n.createElement)("svg",{width:"20",height:"22",viewBox:"0 0 20 22",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,n.createElement)("path",{d:"M5 15C2.79086 15 1 13.2091 1 11C1 9.09295 2.33457 7.4976 4.12071 7.09695C4.04169 6.74395 4 6.37684 4 6C4 3.23858 6.23858 1 9 1C11.4193 1 13.4373 2.71825 13.9002 5.00098C13.9334 5.00033 13.9666 5 14 5C16.7614 5 19 7.23858 19 10C19 12.419 17.2822 14.4367 15 14.9M7 18L10 21M10 21L13 18M10 21V9",stroke:"#577BF9","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})),y=(0,n.createElement)("svg",{width:"20",height:"18",viewBox:"0 0 20 22",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,n.createElement)("path",{d:"M10.0015 8V10M10.0015 14H10.0115M3.0733 18H16.9297C18.4693 18 19.4316 16.3333 18.6618 15L11.7336 3C10.9637 1.66667 9.03925 1.66667 8.26945 3L1.34125 15C0.571445 16.3333 1.5337 18 3.0733 18Z",stroke:"#DE9F0C","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})),w=window.wp.apiFetch;var x=s.n(w);const k=window.wp.url,E=window.wp.notices,C=window.optimoleDashboardApp.submenu_links,S=function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const t=document.querySelector("li#toplevel_page_optimole");let s=document.querySelector("li#toplevel_page_optimole .wp-submenu");s||(s=document.createElement("ul"),s.classList.add("wp-submenu","wp-submenu-wrap"),t.classList.add("wp-has-submenu","wp-has-current-submenu","wp-menu-open"),t.appendChild(s)),e?(C.forEach((e=>{if(document.querySelector(`li#toplevel_page_optimole a[href="${e.href}"]`))return;const t=document.createElement("li"),n=document.createElement("a");n.href=e.href,n.innerHTML=e.text,t.appendChild(n),e.hash&&e.hash===window.location.hash&&(t.classList.add("current"),n.classList.add("current")),s.appendChild(t)})),s.style.display="block"):s.style.display="none"},{setIsConnected:A,setIsConnecting:j,setIsLoading:N,setHasRestError:L,setHasValidKey:D,setHasApplication:I,setAPIKey:T,setUserData:M,setAvailableApps:O,sethasDashboardLoaded:F,setShowDisconnect:B,setConflicts:z,setOptimizedImages:P,setSiteSettings:R,setSampleRate:q,setCheckedOffloadConflicts:Z,setOffloadConflicts:H,setLoadingSync:U,setLoadingRollback:$,setTotalNumberOfImages:V,setProcessedImages:W,setErrorMedia:K,setOffloadLibraryLink:Q,setRollbackLibraryLink:G,setExtraVisits:Y,setLogs:J}=(0,l.dispatch)("optimole"),{getOptimizedImages:X,getQueryArgs:ee,getTotalNumberOfImages:te}=(0,l.select)("optimole"),{createNotice:se}=(0,l.dispatch)(E.store),ne=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.offset=void 0!==e.offset?e.offset:0,x()({path:optimoleDashboardApp.routes.upload_onboard_images,method:"POST",data:e}).then((t=>{!1===t.data&&1e3>e.offset&&ne({offset:e.offset+100}),"success"===t.code&&console.log("%c Images Crawled.","color: #59B278")})).catch((e=>(console.log("Error while crawling images",e),e.data)))},re=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>{};j(!0),N(!0),L(!1),x()({path:optimoleDashboardApp.routes.register_service,method:"POST",data:e,parse:!1}).then((e=>e.json())).then((e=>(j(!1),N(!1),"success"===e.code&&(A(!0),D(!0),I(!0),T(e.data.api_key),M(e.data),O(e.data),ne(),S(!0)),t&&t(e),e.data))).catch((e=>(j(!1),N(!1),L(!0),e.data)))},ae=()=>{N(!0),x()({path:optimoleDashboardApp.routes.disconnect,method:"GET",parse:!1}).then((e=>{N(!1),I(!1),T(""),M(null),O(null),e.ok?(A(!1),F(!1),B(!1),S(!1),console.log("%c Disconnected from OptiMole API.","color: #59B278")):console.error(e)}))},oe=()=>{N(!0),x()({path:optimoleDashboardApp.routes.request_update,method:"GET",parse:!1}).then((e=>200<=e.status&&300>e.status?e.json():(console.log(`%c Request failed with status ${e.status}`,"color: #E7602A"),Promise.resolve()))).then((e=>{N(!1),e&&(M(e.data),void 0!==e?.data?.extra_visits&&Y(e.data.extra_visits),"disconnected"===e.code&&(A(!1),F(!1),console.log("%c Disconnected from OptiMole API.","color: #59B278")))}))},ie=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>{};if(0<X().length)return console.log("%c Images already exist.","color: #59B278"),e&&e(),!1;x()({path:optimoleDashboardApp.routes.poll_optimized_images,method:"GET"}).then((t=>{"success"===t.code?(P(t.data),console.log("%c Images Fetched.","color: #59B278")):console.log("%c No images available.","color: #E7602A"),e&&e(t)})).catch((e=>(console.log("Error while polling images",e),e.data)))},le=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];N(!0),x()({path:optimoleDashboardApp.routes.update_option,method:"POST",data:{settings:e}}).then((e=>{N(!1),"success"===e.code&&(R(e.data),me(optimoleDashboardApp.strings.options_strings.settings_saved),console.log("%c Settings Saved.","color: #59B278"))})).then((()=>{t&&oe()})).catch((e=>(N(!1),me(optimoleDashboardApp.strings.options_strings.settings_saved_error),console.log("Error while saving settings",e),e.data)))},de=e=>{N(!0),x()({path:optimoleDashboardApp.routes.clear_cache_request,method:"POST",data:{type:e},parse:!1}).then((e=>(N(!1),200<=e.status&&300>e.status?(me(optimoleDashboardApp.strings.options_strings.cache_cleared),void console.log("%c New cache token generated.","color: #59B278")):(me(optimoleDashboardApp.strings.options_strings.cache_cleared_error),void console.log("%c Could not generate cache token.","color: #E7602A")))))},ce=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>{};x()({path:(0,k.addQueryArgs)(optimoleDashboardApp.routes.get_sample_rate,{quality:e.quality,force:e?.force||"no"}),method:"POST"}).then((e=>{"success"===e.code&&q(e.data),t&&t(e)}))},ue=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:()=>{};x()({path:optimoleDashboardApp.routes.get_offload_conflicts,method:"GET"}).then((t=>{Z(!0),0!==t.data.length&&H(t.data),e&&e(t)}))},pe=e=>{const t=ee();"offload_images"===e.action&&(Object.prototype.hasOwnProperty.call(t,"optimole_action")&&Q(!1),U(!0)),"rollback_images"===e.action&&(Object.prototype.hasOwnProperty.call(t,"optimole_action")&&G(!1),$(!0)),N(!0);const s=void 0!==e.images?e.images:[];x()({path:optimoleDashboardApp.routes.number_of_images_and_pages,method:"POST",data:{action:e.action,refresh:e.refresh||!1,images:s},parse:!1}).then((t=>{if(200<=t.status&&300>t.status)return t.json();"offload_images"===e.action&&(U(!1),N(!1)),"rollback_images"===e.action&&($(!1),N(!1))})).then((n=>{if(!n.data.count||0===n.data.count||!1===n.data.status)return console.log("%c No images available.","color: #E7602A"),U(!1),$(!1),N(!1),"offload_images"===e.action&&Object.prototype.hasOwnProperty.call(t,"optimole_action")&&Q(!0),void("rollback_images"===e.action&&Object.prototype.hasOwnProperty.call(t,"optimole_action")&&G(!0));let r=te();e.refresh?(W(0!==r?Math.abs(r-n.data.count):0),0!==n.data.count&&0===r&&V(n.data.count)):V(n.data.count),setTimeout((()=>{pe({action:e.action,refresh:!0,images:s})}),1e4)})).finally((()=>{var t;t="offload_images"===e.action?"offload":"rollback",jQuery.ajax({type:"POST",url:window.ajaxurl,data:{action:"optml_fetch_logs",nonce:optimoleDashboardApp.nonce,type:t},success:e=>{J(t,e)}})})).catch((t=>{K(e.action),U(!1),$(!1)}))},me=e=>{se("info",e,{isDismissible:!0,type:"snackbar"})},he=e=>{let{tab:t,setTab:s}=e;const[r,a]=(0,n.useState)(!1),{setShowDisconnect:o}=(0,l.useDispatch)("optimole"),{isConnected:i,isLoading:d,hasApplication:u,hasDashboardLoaded:f,hasConflicts:b}=(0,l.useSelect)((e=>{const{isConnected:t,isLoading:s,hasApplication:n,hasDashboardLoaded:r,getConflicts:a}=e("optimole"),o=a();return{isConnected:t(),isLoading:s(),hasApplication:n(),hasDashboardLoaded:r(),hasConflicts:0<o.count||0}}));(0,n.useEffect)((()=>{b&&a(!0)}),[b]);const _=[{label:optimoleDashboardApp.strings.dashboard_menu_item,value:"dashboard"},{label:optimoleDashboardApp.strings.conflicts_menu_item,value:"conflicts",isDisabled:!r},{label:optimoleDashboardApp.strings.settings_menu_item,value:"settings"},{label:optimoleDashboardApp.strings.help_menu_item,value:"help"}],v=i&&u&&!f;return(0,n.createElement)("header",{className:"bg-white shadow-sm px-2.5 py-5 pb-0"},(0,n.createElement)("div",{className:"flex flex-col sm:flex-row justify-between items-center max-w-screen-xl mx-auto my-0 pb-5"},(0,n.createElement)("div",{className:"items-center flex justify-start cursor-default"},(0,n.createElement)("img",{className:"max-width-64 w-16 h-16 mr-3",src:`${optimoleDashboardApp.assets_url}/img/logo.png`,alt:optimoleDashboardApp.strings.optimole+" "+optimoleDashboardApp.strings.service_details,title:optimoleDashboardApp.strings.optimole+" "+optimoleDashboardApp.strings.service_details}),(0,n.createElement)("h3",{className:"text-gray-800 text-2 font-serif font-bold"},optimoleDashboardApp.strings.optimole)),(0,n.createElement)("div",{className:"flex items-center"},i?(0,n.createElement)(n.Fragment,null,(0,n.createElement)(m.DropdownMenu,{icon:d||v?(0,n.createElement)(m.Icon,{icon:p,className:"animate-spin fill-success"}):(0,n.createElement)(m.Icon,{icon:g}),toggleProps:{className:"optml-header__dropdown uppercase font-bold text-xs text-success hover:text-success active:text-success focus:text-success mr-3 border border-gray-300 rounded-md border-solid gap-2",iconPosition:"right"},popoverProps:{className:"optml-header__dropdown__popover"},text:v?optimoleDashboardApp.strings.connecting:optimoleDashboardApp.strings.connected,controls:[{title:optimoleDashboardApp.strings.optimole+" "+optimoleDashboardApp.strings.dashboard_menu_item,onClick:()=>window.open("https://dashboard.optimole.com/","_blank")},{title:optimoleDashboardApp.strings.refresh_stats_cta,onClick:oe,isDisabled:v},{title:optimoleDashboardApp.strings.disconnect_btn,onClick:()=>o(!0),isDisabled:v}]})):(0,n.createElement)(n.Fragment,null,(0,n.createElement)("div",{className:"uppercase font-bold text-xs text-danger mr-3"},optimoleDashboardApp.strings.not_connected),(0,n.createElement)(m.Icon,{icon:h})))),i&&u&&f&&(0,n.createElement)("ul",{className:"flex gap-8 items-center max-w-screen-xl mx-auto my-0 justify-center sm:justify-normal"},_.filter((e=>!e?.isDisabled)).map((e=>{let{label:r,value:a}=e;return(0,n.createElement)("li",{key:a,className:c()("cursor-pointer text-purple-gray font-bold text-lg m-0 py-2 px-3 transition-colors duration-200 ease-in-out border-0 border-b-4 border-b-white border-solid",{"text-black !border-b-info":t===a}),onClick:()=>s(a)},r)}))))},ge=()=>{const{setShowDisconnect:e}=(0,l.useDispatch)("optimole"),{isLoading:t}=(0,l.useSelect)((e=>{const{isLoading:t}=e("optimole");return{isLoading:t()}}));return(0,n.createElement)(m.Modal,{title:optimoleDashboardApp.strings.disconnect_title,className:"optml__modal",onRequestClose:()=>e(!1)},(0,n.createElement)("p",{dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.disconnect_desc}}),(0,n.createElement)("div",{className:"flex gap-2"},(0,n.createElement)(m.Button,{variant:"default",className:"optml__button flex w-full justify-center rounded font-bold mt-4 min-h-40",onClick:()=>e(!1)},optimoleDashboardApp.strings.keep_connected),(0,n.createElement)(m.Button,{isDestructive:!0,className:"optml__button flex w-full justify-center rounded font-bold mt-4 min-h-40",isBusy:t,disabled:t,onClick:ae},optimoleDashboardApp.strings.disconnect_btn)))},fe=e=>{let{setMethod:t}=e;const[s,r]=(0,n.useState)(""),[a,o]=(0,n.useState)({}),[i,d]=(0,n.useState)(0),{setShowDisconnect:c}=(0,l.useDispatch)("optimole"),{availableApps:u,hasValidKey:p,isConnected:h,isConnecting:g,isLoading:f}=(0,l.useSelect)((e=>{const{getAvailableApps:t,hasValidKey:s,isConnected:n,isConnecting:r,isLoading:a}=e("optimole");return{availableApps:t(),hasValidKey:s(),isConnected:n(),isConnecting:r(),isLoading:a()}}));return(0,n.createElement)("div",{className:"text-2 font-bold m-0 text-gray-700"},(0,n.createElement)("div",{className:"text-gray-800 font-serif leading-7"},optimoleDashboardApp.strings.connect_btn),(0,n.createElement)("p",{className:"text-xl font-normal text-gray-800",dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.steps_connect_api_desc}}),(0,n.createElement)("div",{className:"flex flex-col gap-8 p-8 bg-light-blue border border-blue-300 rounded-md"},(0,n.createElement)("div",{className:"flex flex-col sm:flex-row gap-8 items-stretch sm:items-end"},(0,n.createElement)(m.TextControl,{label:h?optimoleDashboardApp.strings.your_api_key:optimoleDashboardApp.strings.add_api,placeholder:optimoleDashboardApp.strings.email,disabled:h,value:s,onChange:r,className:"optml__input basis-4/5"}),h?(0,n.createElement)(m.Button,{variant:"default",isBusy:f,disabled:f,className:"optml__button flex w-full justify-center rounded font-bold min-h-40 basis-1/5",onClick:c},optimoleDashboardApp.strings.disconnect_btn):(0,n.createElement)(m.Button,{variant:"primary",isBusy:g,disabled:g||0===s.length,className:"optml__button flex w-full justify-center rounded font-bold min-h-40 basis-1/5",onClick:()=>{o({}),function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>{};j(!0),N(!0),L(!1),x()({path:optimoleDashboardApp.routes.connect,method:"POST",data:e,parse:!1}).then((e=>e.json())).then((e=>(j(!1),N(!1),"success"===e.code?(A(!0),D(!0),T(e.data.api_key),void 0!==e.data.app_count&&1<e.data.app_count?O(e.data):(I(!0),M(e.data)),ne(),S(!0),console.log("%c OptiMole API connection successful.","color: #59B278")):(D(!1),console.log("%c Invalid API Key.","color: #E7602A")),t&&t(e),e.data))).catch((e=>(j(!1),N(!1),L(!0),e.data)))}({api_key:s},(e=>{"success"!==e.code&&o({error_connect:e.data})}))}},optimoleDashboardApp.strings.connect_btn)),u&&(0,n.createElement)("div",{className:"flex flex-col sm:flex-row gap-8 items-stretch sm:items-end"},(0,n.createElement)("div",{className:"basis-4/5"},(0,n.createElement)(m.SelectControl,{label:optimoleDashboardApp.strings.select+" "+optimoleDashboardApp.strings.your_domain,value:i,options:u.available_apps.map(((e,t)=>({label:e.domain,value:t}))),onChange:d,className:"optml__select has_large_title",__nextHasNoMarginBottom:!0})),(0,n.createElement)(m.Button,{variant:"primary",isBusy:g,disabled:g,className:"optml__button flex w-full justify-center rounded font-bold min-h-40 basis-1/5",onClick:()=>{!function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>{};j(!0),L(!1),x()({path:optimoleDashboardApp.routes.select_application,method:"POST",data:e}).then((e=>{j(!1),N(!1),"success"===e.code?(D(!0),I(!0),T(e.data.api_key),M(e.data),O(e.data),console.log("%c OptiMole API connection successful.","color: #59B278")):(D(!1),console.log("%c Invalid API Key.","color: #E7602A")),t&&t(e)})).catch((e=>(j(!1),L(!0),e.data)))}({api_key:s,application:null!=u&&void 0!==u.available_apps?u.available_apps[i].key:""},(e=>{"success"!==e.code&&o({error_connect:e.data})}))}},optimoleDashboardApp.strings.select))),!p&&void 0!==a.error_connect&&(0,n.createElement)("p",{className:"block text-xs mt-1 text-danger"},a.error_connect),(0,n.createElement)("div",{className:"text-center py-3"},(0,n.createElement)(m.Button,{variant:"link",onClick:()=>t("email")},optimoleDashboardApp.strings.back_to_connect)))},be="optml-connect flex flex-col justify-between max-w-screen-xl mt-8 mb-5 mx-auto p-0 transition-all ease-in-out duration-700 relative bg-white text-gray-700 border-0 rounded-lg shadow-md",_e="flex gap-8 p-8 flex-col md:flex-row",ve=()=>(0,n.createElement)("div",{className:"bg-danger text-white rounded relative px-6 py-5 mb-0 m-12",dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.notice_api_not_working}}),ye=()=>{const[e,t]=(0,n.useState)(optimoleDashboardApp.current_user.email),[s,r]=(0,n.useState)("email"),[a,o]=(0,n.useState)({}),{setAutoConnect:i}=(0,l.useDispatch)("optimole"),{autoConnect:d,hasRestError:c,isConnecting:u}=(0,l.useSelect)((e=>{const{getAutoConnect:t,hasRestError:s,isConnecting:n}=e("optimole");return{autoConnect:t(),hasRestError:s(),isConnecting:n()}}));return(0,n.useEffect)((()=>{"no"!==d&&re({email:d,auto_connect:!0},(e=>{i("no"),"email_registered"!==e.code?"site_exists"!==e.code?"success"!==e.code&&e.message&&o({error_autoconnect:e.message}):o({site_exists:e.message}):o({email_registered:e.message})}))}),[]),(0,n.useEffect)((()=>{(0===e.length||(0,k.isEmail)(e))&&a.invalid_email&&(delete a.invalid_email,o(a))}),[e]),"key"===s?(0,n.createElement)("div",{className:be},c&&(0,n.createElement)(ve,null),(0,n.createElement)("div",{className:_e},(0,n.createElement)(fe,{setMethod:r}))):(0,n.createElement)("div",{className:be},c&&(0,n.createElement)(ve,null),(0,n.createElement)("div",{className:_e},(0,n.createElement)("div",{className:"optml-connect__content basis-8/12"},(0,n.createElement)("div",{className:"text-gray-700 font-serif text-2 font-bold leading-7 m-0"},optimoleDashboardApp.strings.account_needed_heading),(0,n.createElement)("p",{className:"text-xl font-normal text-gray-800",dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.account_needed_title}}),(0,n.createElement)("div",{className:"flex py-3"},(0,n.createElement)(m.Icon,{icon:"yes-alt"}),(0,n.createElement)("p",{className:"text-base ml-3 m-0",dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.account_needed_subtitle_1}})),(0,n.createElement)("div",{className:"flex py-3"},(0,n.createElement)(m.Icon,{icon:"yes-alt"}),(0,n.createElement)("p",{className:"text-base ml-3 m-0",dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.account_needed_subtitle_2}}))),(0,n.createElement)("div",{className:"optml-connect__form basis-4/12 p-8 bg-light-blue border border-blue-300 rounded-md"},(0,n.createElement)(m.TextControl,{label:optimoleDashboardApp.strings.email_address_label,placeholder:optimoleDashboardApp.strings.email,value:e,onChange:t,className:"optml__input",onBlur:()=>{0===e.length||(0,k.isEmail)(e)||o({invalid_email:optimoleDashboardApp.strings.invalid_email})}}),0<Object.keys(a).length&&Object.keys(a).map((e=>(0,n.createElement)("p",{key:e,className:"block text-xs mt-1 text-danger",dangerouslySetInnerHTML:{__html:a[e]}})))||(0,n.createElement)("br",null),(0,n.createElement)(m.Button,{variant:"primary",isBusy:u,disabled:u||0===e.length||!(0,k.isEmail)(e),className:"optml__button flex w-full justify-center rounded font-bold min-h-40",onClick:()=>{o({}),re({email:e},(e=>{"email_registered"!==e.code?"site_exists"!==e.code?"success"!==e.code&&o({error_register:optimoleDashboardApp.strings.error_register}):o({site_exists:e.message}):o({email_registered:e.message})}))}},optimoleDashboardApp.strings.register_btn),(0,n.createElement)("br",null),(0,n.createElement)("br",null),(0,n.createElement)("div",{className:"base-control-label"},optimoleDashboardApp.strings.existing_user),(0,n.createElement)(m.Button,{variant:"secondary",className:"optml__button flex w-full justify-center rounded font-bold mt-4 min-h-40",onClick:()=>r("key")},optimoleDashboardApp.strings.api_exists),(0,n.createElement)("p",{className:"mb-0",dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.signup_terms}}))),(0,n.createElement)("div",{className:"bg-grayish-blue text-gray-800 text-center font-bold uppercase p-2.5 rounded-b-lg"},(0,n.createElement)("p",{dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.account_needed_footer}})))};function we(){return we=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n])}return e},we.apply(this,arguments)}const xe=e=>{let{value:t,max:s,className:r,...a}=e;const o=Math.floor(t/s*100),i=a.background||"#FFF";return(0,n.createElement)("div",we({className:c()("w-full h-2.5 border rounded-md border-solid bg-white border-light-gray",r),role:"progressbar","aria-valuemin":"0","aria-valuemax":s,"aria-valuenow":t,style:{background:"linear-gradient(90deg, var( --optml-progress ) "+o+"%, "+i+" "+o+"%)"}},a))},ke=[optimoleDashboardApp.strings.options_strings.connect_step_0,optimoleDashboardApp.strings.options_strings.connect_step_1,optimoleDashboardApp.strings.options_strings.connect_step_2,optimoleDashboardApp.strings.options_strings.connect_step_3],Ee=()=>{const[e,t]=(0,n.useState)(0),[s,r]=(0,n.useState)(0),[a,o]=(0,n.useState)(0),{sethasDashboardLoaded:i}=(0,l.useDispatch)("optimole");(0,n.useEffect)((()=>{a<=25&&setTimeout((()=>{d()}),1e3)}),[a]);const d=()=>{if(o(a+1),a>=25)return i(!0),o(0),r(0),void t(0);t(Math.floor(a/25*100)),e>30*(s+1)&&r(s+1)};return(0,n.createElement)("div",{className:"optml-connecting flex flex-col justify-between max-w-screen-xl mt-8 mb-5 mx-auto p-0 transition-all ease-in-out duration-700 relative bg-white text-gray-700 border-0 rounded-lg shadow-md"},(0,n.createElement)("div",{className:"flex flex-col md:flex-row items-center justify-center gap-5 px-8 sm:px-0 py-24"},(0,n.createElement)("img",{className:"max-w-full",src:optimoleDashboardApp.assets_url+"img/connecting.png"}),(0,n.createElement)("div",{className:"text-center md:text-left"},(0,n.createElement)("div",{className:"font-bold text-2xl"},optimoleDashboardApp.strings.account_connecting_title),(0,n.createElement)("div",{className:"text-base"},optimoleDashboardApp.strings.account_connecting_subtitle),(0,n.createElement)(xe,{className:"mt-2.5 mb-1.5 mx-0 h-5 border-gray-200",value:a,max:25,background:"#e6e6e6"}),(0,n.createElement)("div",{className:"text-xs"},ke[s]+" ("+e+"%)"))))};var Ce=s(196);const Se=function(){const[e,t]=(0,Ce.useState)(null),[s,n]=(0,Ce.useState)({width:0,height:0}),r=(0,Ce.useCallback)((()=>{n({width:(null==e?void 0:e.offsetWidth)||0,height:(null==e?void 0:e.offsetHeight)||0})}),[null==e?void 0:e.offsetHeight,null==e?void 0:e.offsetWidth]);return Ae("resize",r),je((()=>{r()}),[null==e?void 0:e.offsetHeight,null==e?void 0:e.offsetWidth]),[t,s]},Ae=function(e,t,s,n){const r=(0,Ce.useRef)(t);je((()=>{r.current=t}),[t]),(0,Ce.useEffect)((()=>{var t;const a=null!==(t=null==s?void 0:s.current)&&void 0!==t?t:window;if(!a||!a.addEventListener)return;const o=e=>r.current(e);return a.addEventListener(e,o,n),()=>{a.removeEventListener(e,o,n)}}),[e,s,n])},je="undefined"!=typeof window?Ce.useLayoutEffect:Ce.useEffect,Ne="yes"!==optimoleDashboardApp.connection_status,Le=e=>{let{src:t,oldSize:s,newSize:r}=e;const[a,{width:o}]=Se();return(0,n.createElement)("div",{className:"basis-1/4"},(0,n.createElement)("img",{src:t,className:"w-full border border-slate-200 rounded-md border-solid",style:{height:o},ref:a}),(0,n.createElement)("p",{className:"optml__bullet w-full h-4"},(()=>{let e=(100*(1-r/s)).toFixed(1);return 1>e?"1":100<e?(Math.floor(e/10+10)/10).toFixed(1).toString():e.toString()})(),"% ",optimoleDashboardApp.strings.latest_images.saved," "))},De=()=>{const[e,{width:t}]=Se();return(0,n.createElement)("div",{className:"basis-1/4"},(0,n.createElement)("div",{className:"optml__loader w-full rounded-md",style:{height:t},ref:e}),(0,n.createElement)("p",{className:"optml__loader w-full h-4"}))},Ie=()=>{const[e,t]=(0,n.useState)(!1),[s,r]=(0,n.useState)(0),[a,o]=(0,n.useState)(0),[i,d]=(0,n.useState)(0);(0,n.useEffect)((()=>{i<=20&&setTimeout((()=>{u()}),1e3)}),[i]);const{images:c}=(0,l.useSelect)((e=>{const{getOptimizedImages:t}=e("optimole");return{images:t()||[]}}));(0,n.useEffect)((()=>{8<=c.length?t(!0):e||Ne||ie((()=>{t(!0)}))}),[]);const u=()=>{d(i+1),i>=20?ie((()=>{t(!0),d(0),o(0),r(0),oe()})):(r(Math.floor(i/20*100)),s>30*(a+1)&&o(a+1))};return(0,n.createElement)("div",{className:"hidden lg:block pt-5 border-grayish-blue border-0 border-t-2 border-solid"},(0,n.createElement)("h3",{className:"text-base m-0"},optimoleDashboardApp.strings.latest_images.last," ",optimoleDashboardApp.strings.latest_images.optimized_images),Ne&&!e&&(0,n.createElement)("div",{className:"flex items-center flex-col py-2"},(0,n.createElement)("p",{className:"font-semibold"},optimoleDashboardApp.strings.latest_images.loading_latest_images),(0,n.createElement)(xe,{max:20,value:i})),!Ne&&!e&&(0,n.createElement)(n.Fragment,null,(0,n.createElement)("div",{className:"flex justify-between mt-5 gap-5"},[...Array(4)].map((()=>(0,n.createElement)(De,null)))),(0,n.createElement)("div",{className:"flex justify-between mt-5 gap-5"},[...Array(4)].map((()=>(0,n.createElement)(De,null))))),e&&4>c?.length&&(0,n.createElement)("div",{className:"text-center py-12"},(0,n.createElement)("p",{dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.latest_images.no_images_found}})),e&&4<=c?.length&&(0,n.createElement)(n.Fragment,null,(0,n.createElement)("div",{className:"flex justify-between mt-5 gap-5"},[...Array(4)].map(((e,t)=>(0,n.createElement)(Le,{src:c[t].url,oldSize:c[t].ex_size_raw,newSize:c[t].new_size_raw})))),8<=c?.length&&(0,n.createElement)("div",{className:"flex justify-between mt-5 gap-5"},[...Array(4)].map(((e,t)=>(t+=4,(0,n.createElement)(Le,{src:c[t].url,oldSize:c[t].ex_size_raw,newSize:c[t].new_size_raw})))))))},Te="flex p-6 bg-light-blue border border-blue-300 rounded-md",Me=[{label:optimoleDashboardApp.strings.metrics.metricsTitle1,description:optimoleDashboardApp.strings.metrics.metricsSubtitle1,value:"images_number",icon:()=>(0,n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"55",height:"55",viewBox:"0 0 55 55",fill:"none"},(0,n.createElement)("path",{d:"M42.0235 45.3568L45.0279 46.6928C46.5427 47.3666 48.25 46.2574 48.25 44.5982V10.402C48.25 8.74281 46.5427 7.63364 45.0279 8.30739L42.0235 9.64343C32.8569 13.718 22.3931 13.718 13.2265 9.64343L10.2221 8.30739C8.70729 7.63364 7 8.74281 7 10.402V44.5982C7 46.2574 8.70729 47.3666 10.2221 46.6928L13.2265 45.3568C22.3931 41.2845 32.8569 41.2845 42.0235 45.3568Z",stroke:"#577BF9","stroke-width":"1.875","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.createElement)("path",{d:"M34.5002 35.5209H20.7502C19.4852 35.5209 18.4585 34.4942 18.4585 33.2292V21.7709C18.4585 20.5059 19.4852 19.4792 20.7502 19.4792H34.5002C35.7652 19.4792 36.7918 20.5059 36.7918 21.7709V33.2292C36.7918 34.4942 35.7652 35.5209 34.5002 35.5209Z",stroke:"#577BF9","stroke-width":"1.875","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.createElement)("path",{d:"M30.9707 25.0939L36.7915 29.8376",stroke:"#577BF9","stroke-width":"1.875","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.createElement)("path",{d:"M30.9711 25.0939L26.0669 30.2043",stroke:"#577BF9","stroke-width":"1.875","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.createElement)("path",{d:"M26.0665 30.2043L23.3853 28.4167",stroke:"#577BF9","stroke-width":"1.875","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.createElement)("path",{d:"M23.3856 28.4167L18.4585 32.5647",stroke:"#577BF9","stroke-width":"1.875","stroke-linecap":"round","stroke-linejoin":"round"}))},{label:optimoleDashboardApp.strings.metrics.metricsTitle2,description:optimoleDashboardApp.strings.metrics.metricsSubtitle2,value:"saved_size",icon:()=>(0,n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"56",height:"55",viewBox:"0 0 56 55",fill:"none"},(0,n.createElement)("path",{d:"M36.681 6.875H13.7643C8.70203 6.875 4.59766 10.9794 4.59766 16.0417C4.59766 21.104 8.70203 25.2083 13.7643 25.2083H36.681C41.7433 25.2083 45.8477 21.104 45.8477 16.0417C45.8477 10.9794 41.7433 6.875 36.681 6.875Z",stroke:"#577BF9","stroke-width":"1.875","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.createElement)("path",{d:"M13.7643 25.2084C8.70203 25.2084 4.59766 29.3127 4.59766 34.375C4.59766 39.4373 8.70203 43.5417 13.7643 43.5417H29.806",stroke:"#577BF9","stroke-width":"1.875","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.createElement)("path",{d:"M22.9307 16.0416H36.6807",stroke:"#577BF9","stroke-width":"1.875","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.createElement)("path",{d:"M13.845 15.9606C13.8898 16.0053 13.8898 16.0779 13.845 16.1226C13.8003 16.1674 13.7277 16.1674 13.683 16.1226C13.6382 16.0779 13.6382 16.0053 13.683 15.9606C13.7277 15.9158 13.8003 15.9158 13.845 15.9606Z",stroke:"#577BF9","stroke-width":"1.875","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.createElement)("path",{d:"M22.9307 34.375H27.7432",stroke:"#577BF9","stroke-width":"1.875","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.createElement)("path",{d:"M13.845 34.2938C13.8898 34.3386 13.8898 34.4111 13.845 34.4559C13.8003 34.5006 13.7277 34.5006 13.683 34.4559C13.6382 34.4111 13.6382 34.3386 13.683 34.2938C13.7277 34.2491 13.8003 34.2491 13.845 34.2938Z",stroke:"#577BF9","stroke-width":"1.875","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.createElement)("path",{d:"M38.9725 48.125C32.6452 48.125 27.5142 42.994 27.5142 36.6667C27.5142 30.3394 32.6452 25.2084 38.9725 25.2084C45.3021 25.2084 50.4308 30.3394 50.4308 36.6667C50.4308 42.994 45.3021 48.125 38.9725 48.125Z",stroke:"#577BF9","stroke-width":"1.875","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.createElement)("path",{d:"M40.2465 31.5745L36.4263 35.3924L41.5184 37.9407L37.6981 41.7586",stroke:"#577BF9","stroke-width":"1.875","stroke-linecap":"round","stroke-linejoin":"round"}))},{label:optimoleDashboardApp.strings.metrics.metricsTitle3,description:optimoleDashboardApp.strings.metrics.metricsSubtitle3,value:"compression_percentage",icon:()=>(0,n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"55",height:"55",viewBox:"0 0 55 55",fill:"none"},(0,n.createElement)("path",{d:"M43.5418 32.0833C41.0095 32.0833 38.9585 30.0323 38.9585 27.5C38.9585 24.9677 41.0095 22.9166 43.5418 22.9166C46.0741 22.9166 48.1252 24.9677 48.1252 27.5C48.1252 30.0323 46.0741 32.0833 43.5418 32.0833Z",stroke:"#577BF9","stroke-width":"1.97917","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.createElement)("path",{d:"M32.0832 43.5417C32.0832 46.074 30.0321 48.1251 27.4998 48.1251C24.9675 48.1251 22.9165 46.074 22.9165 43.5417C22.9165 41.0094 24.9675 38.9584 27.4998 38.9584C30.0321 38.9584 32.0832 41.0094 32.0832 43.5417Z",stroke:"#577BF9","stroke-width":"1.97917","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.createElement)("path",{d:"M43.5418 48.1251C41.0095 48.1251 38.9585 46.074 38.9585 43.5417C38.9585 41.0094 41.0095 38.9584 43.5418 38.9584C46.0741 38.9584 48.1252 41.0094 48.1252 43.5417C48.1252 46.074 46.0741 48.1251 43.5418 48.1251Z",stroke:"#577BF9","stroke-width":"1.97917","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.createElement)("path",{d:"M27.4998 16.0417C24.9675 16.0417 22.9165 13.9906 22.9165 11.4583C22.9165 8.92604 24.9675 6.875 27.4998 6.875C30.0321 6.875 32.0832 8.92604 32.0832 11.4583C32.0832 13.9906 30.0321 16.0417 27.4998 16.0417Z",stroke:"#577BF9","stroke-width":"1.97917","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.createElement)("path",{d:"M38.9585 11.4583C38.9585 8.92604 41.0095 6.875 43.5418 6.875C46.0741 6.875 48.1252 8.92604 48.1252 11.4583C48.1252 13.9906 46.0741 16.0417 43.5418 16.0417C41.0095 16.0417 38.9585 13.9906 38.9585 11.4583Z",stroke:"#577BF9","stroke-width":"1.97917","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.createElement)("path",{d:"M30.7314 40.3104L40.3106 30.7312",stroke:"#577BF9","stroke-width":"1.97917","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.createElement)("path",{d:"M14.6895 40.3104L24.2686 30.7312",stroke:"#577BF9","stroke-width":"1.97917","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.createElement)("path",{d:"M30.7314 24.2687L40.3106 14.6896",stroke:"#577BF9","stroke-width":"1.97917","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.createElement)("path",{d:"M22.9165 27.5C22.9165 24.9677 24.9675 22.9166 27.4998 22.9166C30.0321 22.9166 32.0832 24.9677 32.0832 27.5C32.0832 30.0323 30.0321 32.0833 27.4998 32.0833C24.9675 32.0833 22.9165 30.0323 22.9165 27.5Z",stroke:"#577BF9","stroke-width":"1.97917","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.createElement)("path",{d:"M14.6895 24.2687L24.2686 14.6896",stroke:"#577BF9","stroke-width":"1.97917","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.createElement)("path",{d:"M11.4583 32.0833C8.92604 32.0833 6.875 30.0323 6.875 27.5C6.875 24.9677 8.92604 22.9166 11.4583 22.9166C13.9906 22.9166 16.0417 24.9677 16.0417 27.5C16.0417 30.0323 13.9906 32.0833 11.4583 32.0833Z",stroke:"#577BF9","stroke-width":"1.97917","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.createElement)("path",{d:"M16.0417 43.5417C16.0417 46.074 13.9906 48.1251 11.4583 48.1251C8.92604 48.1251 6.875 46.074 6.875 43.5417C6.875 41.0094 8.92604 38.9584 11.4583 38.9584C13.9906 38.9584 16.0417 41.0094 16.0417 43.5417Z",stroke:"#577BF9","stroke-width":"1.97917","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.createElement)("path",{d:"M11.4583 16.0417C8.92604 16.0417 6.875 13.9906 6.875 11.4583C6.875 8.92604 8.92604 6.875 11.4583 6.875C13.9906 6.875 16.0417 8.92604 16.0417 11.4583C16.0417 13.9906 13.9906 16.0417 11.4583 16.0417Z",stroke:"#577BF9","stroke-width":"1.97917","stroke-linecap":"round","stroke-linejoin":"round"}))},{label:optimoleDashboardApp.strings.metrics.metricsTitle4,description:optimoleDashboardApp.strings.metrics.metricsSubtitle4,value:"traffic",icon:()=>(0,n.createElement)("svg",{width:"55",height:"55",viewBox:"0 0 64 64",fill:"none",stroke:"currentColor",xmlns:"http://www.w3.org/2000/svg","svg-inline":"",role:"presentation",focusable:"false"},(0,n.createElement)("path",{"data-v-767b24d4":"",d:"M23.997 28c0 2.947-4.178 5.333-9.333 5.333S5.334 30.944 5.334 28",stroke:"#EDF0FF","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.createElement)("path",{"data-v-767b24d4":"",d:"M23.997 28c0 2.947-4.178 5.333-9.333 5.333S5.334 30.944 5.334 28",stroke:"#EDF0FF","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.createElement)("path",{"data-v-767b24d4":"",d:"M23.997 28c0 2.947-4.178 5.333-9.333 5.333S5.334 30.944 5.334 28",stroke:"#577BF9","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.createElement)("path",{"data-v-767b24d4":"",d:"M23.997 36c0 2.947-4.178 5.333-9.333 5.333S5.334 38.944 5.334 36",stroke:"#EDF0FF","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.createElement)("path",{"data-v-767b24d4":"",d:"M23.997 36c0 2.947-4.178 5.333-9.333 5.333S5.334 38.944 5.334 36",stroke:"#EDF0FF","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.createElement)("path",{"data-v-767b24d4":"",d:"M23.997 36c0 2.947-4.178 5.333-9.333 5.333S5.334 38.944 5.334 36",stroke:"#577BF9","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.createElement)("path",{"data-v-767b24d4":"",d:"M23.997 36c0 2.947-4.178 5.333-9.333 5.333S5.334 38.944 5.334 36",stroke:"#EDF0FF","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.createElement)("path",{"data-v-767b24d4":"",d:"M23.997 36c0 2.947-4.178 5.333-9.333 5.333S5.334 38.944 5.334 36",stroke:"#EDF0FF","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.createElement)("path",{"data-v-767b24d4":"",d:"M23.997 36c0 2.947-4.178 5.333-9.333 5.333S5.334 38.944 5.334 36",stroke:"#577BF9","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.createElement)("path",{"data-v-767b24d4":"",d:"M50.667 56H40a5.332 5.332 0 01-5.333-5.333V13.333A5.332 5.332 0 0140 8h10.667A5.332 5.332 0 0156 13.333v37.334A5.332 5.332 0 0150.667 56z",stroke:"#EDF0FF","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.createElement)("path",{"data-v-767b24d4":"",d:"M50.667 56H40a5.332 5.332 0 01-5.333-5.333V13.333A5.332 5.332 0 0140 8h10.667A5.332 5.332 0 0156 13.333v37.334A5.332 5.332 0 0150.667 56z",stroke:"#EDF0FF","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.createElement)("path",{"data-v-767b24d4":"",d:"M50.667 56H40a5.332 5.332 0 01-5.333-5.333V13.333A5.332 5.332 0 0140 8h10.667A5.332 5.332 0 0156 13.333v37.334A5.332 5.332 0 0150.667 56z",stroke:"#577BF9","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.createElement)("path",{"data-v-767b24d4":"",d:"M24 32h10.667M24 32h10.667",stroke:"#EDF0FF","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.createElement)("path",{"data-v-767b24d4":"",d:"M24 32h10.667",stroke:"#577BF9","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.createElement)("path",{"data-v-767b24d4":"",d:"M42.667 16H48M42.667 16H48",stroke:"#EDF0FF","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.createElement)("path",{"data-v-767b24d4":"",d:"M42.667 16H48",stroke:"#577BF9","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.createElement)("path",{"data-v-767b24d4":"",d:"M42.667 26.667H48M42.667 26.667H48",stroke:"#EDF0FF","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.createElement)("path",{"data-v-767b24d4":"",d:"M42.667 26.667H48",stroke:"#577BF9","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.createElement)("path",{"data-v-767b24d4":"",d:"M42.667 37.333H48M42.667 37.333H48",stroke:"#EDF0FF","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.createElement)("path",{"data-v-767b24d4":"",d:"M42.667 37.333H48",stroke:"#577BF9","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.createElement)("path",{"data-v-767b24d4":"",d:"M42.667 48H48M42.667 48H48",stroke:"#EDF0FF","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.createElement)("path",{"data-v-767b24d4":"",d:"M42.667 48H48",stroke:"#577BF9","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.createElement)("path",{"data-v-767b24d4":"",d:"M5.333 20c0 2.947 4.179 5.333 9.334 5.333C19.82 25.333 24 22.947 24 20",stroke:"#EDF0FF","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.createElement)("path",{"data-v-767b24d4":"",d:"M5.333 20c0 2.947 4.179 5.333 9.334 5.333C19.82 25.333 24 22.947 24 20",stroke:"#EDF0FF","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.createElement)("path",{"data-v-767b24d4":"",d:"M5.333 20c0 2.947 4.179 5.333 9.334 5.333C19.82 25.333 24 22.947 24 20",stroke:"#577BF9","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.createElement)("path",{"data-v-767b24d4":"",d:"M5.333 20c.003-2.944 4.182-5.333 9.334-5.333 5.152 0 9.333 2.386 9.33 5.333v24c0 2.947-4.178 5.333-9.333 5.333S5.334 46.944 5.334 44V20v0z",stroke:"#EDF0FF","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.createElement)("path",{"data-v-767b24d4":"",d:"M5.333 20c.003-2.944 4.182-5.333 9.334-5.333 5.152 0 9.333 2.386 9.33 5.333v24c0 2.947-4.178 5.333-9.333 5.333S5.334 46.944 5.334 44V20v0z",stroke:"#EDF0FF","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"}),(0,n.createElement)("path",{"data-v-767b24d4":"",d:"M5.333 20c.003-2.944 4.182-5.333 9.334-5.333 5.152 0 9.333 2.386 9.33 5.333v24c0 2.947-4.178 5.333-9.333 5.333S5.334 46.944 5.334 44V20v0z",stroke:"#577BF9","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"}))}],Oe=()=>(0,n.createElement)("div",{className:"flex gap-2 bg-warning text-danger border border-solid border-danger rounded relative px-6 py-5 mb-5"},(0,n.createElement)(m.Icon,{icon:b}),(0,n.createElement)("p",{className:"m-0",dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.notice_disabled_account}})),Fe=()=>(0,n.createElement)("div",{className:"flex gap-2 bg-success text-white rounded relative px-6 py-5 mb-5"},(0,n.createElement)(m.Icon,{icon:"cloud-saved"}),(0,n.createElement)("p",{className:"m-0",dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.notice_just_activated}})),Be=()=>{const{userData:e,userStatus:t}=(0,l.useSelect)((e=>{const{getUserData:t,getUserStatus:s}=e("optimole");return{userData:t(),userStatus:s()}})),s=(e.visitors/e.visitors_limit*100).toFixed(0);return(0,n.createElement)("div",{className:"bg-white p-8 border-0 rounded-lg shadow-md"},0<optimoleDashboardApp.strings.notice_just_activated.length&&"active"===t&&(0,n.createElement)(Fe,null),"inactive"===t&&(0,n.createElement)(Oe,null),(0,n.createElement)("div",{className:c()(Te,"gap-8 flex-col sm:flex-row items-start sm:items-center")},(0,n.createElement)(m.Icon,{icon:f}),(0,n.createElement)("div",{className:"flex w-full flex-col"},(0,n.createElement)("div",{className:"flex w-full justify-between"},(0,n.createElement)("div",{className:"text-gray-800 text-2xl font-bold"},e.visitors_pretty," / ",e.visitors_limit_pretty,(0,n.createElement)("span",{className:"text-gray-600 text-base font-normal ml-2"},optimoleDashboardApp.strings.quota)),70>s&&(0,n.createElement)(m.Button,{variant:"default",className:"optml__button rounded font-bold min-h-40",href:"https://dashboard.optimole.com/settings/billing",target:"_blank"},optimoleDashboardApp.strings.upgrade.title)),(0,n.createElement)("div",null,(0,n.createElement)(xe,{className:"mt-2.5 mb-3 mx-0",value:e.visitors,max:e.visitors_limit}),(0,n.createElement)("div",{className:"optml__tooltip",style:{left:s+"%",marginLeft:15>s?"-15px":"-20px",display:100<s?"none":"block"}},(0,n.createElement)("span",null,s,"%"))))),(0,n.createElement)("div",{className:"flex py-5 gap-5 flex-col md:flex-row"},Me.map((t=>(0,n.createElement)("div",{key:t.value,className:c()(Te,"basis-1/4 flex-col items-start")},(0,n.createElement)(m.Icon,{icon:t.icon}),(0,n.createElement)("div",{className:"flex w-full flex-col"},(0,n.createElement)("div",{className:"not-italic font-bold text-xl py-2 text-gray-800"},(t=>{const s=(t=>void 0!==e[t]?e[t]:"saved_size"===t?Math.floor(2500*Math.random())+500:Math.floor(40*Math.random())+10)(t);return"saved_size"===t?(s/1e3).toFixed(2)+"MB":"compression_percentage"===t?s.toFixed(2)+"%":"traffic"===t?s.toFixed(2)+"MB":s})(t.value)),(0,n.createElement)("div",{className:"not-italic font-normal text-sm text-gray-800"},t.label),(0,n.createElement)("div",{className:"font-normal text-xs text-gray-600"},t.description)))))),"yes"!==optimoleDashboardApp.remove_latest_images&&(0,n.createElement)(Ie,null))},ze=e=>{let{conflict:t}=e;const[s,r]=(0,n.useState)(!1);return(0,n.createElement)("div",{className:c()("flex gap-2 text-white rounded relative px-6 py-5 mb-5",{"bg-danger":"high"===t.severity,"bg-info":"medium"===t.severity,"bg-success":"high"!==t.severity&&"medium"!==t.severity})},(0,n.createElement)("p",{className:"m-0 text-white",dangerouslySetInnerHTML:{__html:t.message}}),(0,n.createElement)(m.Button,{icon:s?p:"no-alt",label:optimoleDashboardApp.strings.conflicts.conflict_close,disabled:s,className:c()("text-white hover:text-white",{"animate-spin":s}),onClick:()=>{r(!0),function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>{};N(!0),x()({path:optimoleDashboardApp.routes.dismiss_conflict,method:"POST",data:{conflictID:e}}).then((e=>{N(!1),"success"===e.code&&z(e.data),t&&t(e)}))}(t.id,(()=>{r(!1)}))}}))},Pe=()=>{const{conflicts:e}=(0,l.useSelect)((e=>{const{getConflicts:t}=e("optimole");return{conflicts:t().conflicts||[]}}));return(0,n.createElement)("div",{className:"bg-white p-8 border-0 rounded-lg shadow-md"},Boolean(e.length)&&(0,n.createElement)(n.Fragment,null,(0,n.createElement)("p",null,optimoleDashboardApp.strings.conflicts.title),e.map((e=>(0,n.createElement)(ze,{key:e.id,conflict:e})))),!Boolean(e.length)&&(0,n.createElement)("div",{className:"text-center py-12"},(0,n.createElement)("p",{dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.conflicts.no_conflicts_found}})))},Re=(0,n.createElement)(u.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,n.createElement)(u.Path,{d:"M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z"})),qe=(0,n.createElement)(u.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,n.createElement)(u.Path,{d:"M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"})),Ze=[{label:optimoleDashboardApp.strings.general_settings_menu_item,value:"general"},{label:optimoleDashboardApp.strings.advanced_settings_menu_item,value:"compression",children:[{label:optimoleDashboardApp.strings.settings_compression_menu_item,value:"compression"},{label:optimoleDashboardApp.strings.settings_resize_menu_item,value:"resize"},{label:optimoleDashboardApp.strings.lazyload_settings_menu_item,value:"lazyload"},{label:optimoleDashboardApp.strings.settings_exclusions_menu_item,value:"exclusions"}]},{label:optimoleDashboardApp.strings.offload_media_settings_menu_item,value:"offload_media"}],He=e=>{let{children:t,tab:s,setTab:r}=e;return(0,n.createElement)("ul",{className:"flex flex-col gap-1 m-0 mt-3"},t.map((e=>(0,n.createElement)("li",{key:e.value,className:c()("not-italic font-normal text-base text-purple-gray cursor-pointer rounded px-4 py-2 m-0 hover:text-info",{"bg-light-blue hover:text-purple-gray":s===e.value}),onClick:t=>{t.stopPropagation(),r(e.value)}},e.label))))},Ue=e=>{let{tab:t,setTab:s}=e;return(0,n.createElement)("div",{className:"basis-1/5"},(0,n.createElement)("ul",{className:"flex flex-col m-0 gap-3"},Ze.map((e=>{const r=t===e.value||e.children&&e.children.some((e=>e.value===t));return(0,n.createElement)("li",{key:e.value,className:c()("not-italic font-semibold text-base text-purple-gray cursor-pointer hover:text-info",{"!text-info":r}),onClick:()=>s(e.value)},(0,n.createElement)("div",{className:"flex items-center"},e.label,e.children&&(0,n.createElement)(m.Icon,{icon:r?Re:qe,className:"inline-block ml-2"})),e.children&&r&&(0,n.createElement)(He,{children:e.children,tab:t,setTab:s}))}))))},$e=e=>{let{settings:t,setSettings:s,setCanSave:r}=e;const{isLoading:a}=(0,l.useSelect)((e=>{const{isLoading:t}=e("optimole");return{isLoading:t()}})),o="disabled"!==t.image_replacer,i="disabled"!==t.lazyload,d="disabled"!==t.report_script,u="disabled"!==t.cdn,p="disabled"!==t.banner_frontend,h=(e,n)=>{r(!0);const a={...t};a[e]=n?"enabled":"disabled",s(a)};return(0,n.createElement)(n.Fragment,null,(0,n.createElement)(m.ToggleControl,{label:optimoleDashboardApp.strings.options_strings.enable_image_replace,help:()=>(0,n.createElement)("p",{dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.options_strings.replacer_desc}}),checked:o,disabled:a,className:c()({"is-disabled":a}),onChange:e=>h("image_replacer",e)}),(0,n.createElement)("hr",{className:"my-8 border-grayish-blue"}),(0,n.createElement)(m.ToggleControl,{label:optimoleDashboardApp.strings.options_strings.toggle_lazyload,help:()=>(0,n.createElement)("p",{dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.options_strings.lazyload_desc}}),checked:i,disabled:!o||a,className:c()({"is-disabled":!o||a}),onChange:e=>h("lazyload",e)}),(0,n.createElement)("hr",{className:"my-8 border-grayish-blue"}),(0,n.createElement)(m.ToggleControl,{label:optimoleDashboardApp.strings.options_strings.enable_report_title,help:()=>(0,n.createElement)("p",{dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.options_strings.enable_report_desc}}),checked:d,disabled:a,className:c()({"is-disabled":a}),onChange:e=>h("report_script",e)}),(0,n.createElement)("hr",{className:"my-8 border-grayish-blue"}),(0,n.createElement)(m.ToggleControl,{label:optimoleDashboardApp.strings.options_strings.enable_badge_title,help:()=>(0,n.createElement)("p",{dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.options_strings.enable_badge_description}}),checked:p,disabled:a,className:c()({"is-disabled":a}),onChange:e=>h("banner_frontend",e)}),(0,n.createElement)("hr",{className:"my-8 border-grayish-blue"}),(0,n.createElement)(m.BaseControl,{label:optimoleDashboardApp.strings.options_strings.cache_title,className:c()({"is-disabled":a||!o})},(0,n.createElement)("p",{className:"components-base-control__help m-0",dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.options_strings.cache_desc}}),(0,n.createElement)("div",{className:"flex my-4 gap-3"},(0,n.createElement)(m.Button,{variant:"default",isBusy:a,disabled:a||!o,className:"optml__button flex justify-center rounded font-bold min-h-40",onClick:()=>de()},optimoleDashboardApp.strings.options_strings.clear_cache_images),u&&(0,n.createElement)(m.Button,{variant:"default",isBusy:a,disabled:a||!o,className:"optml__button flex justify-center rounded font-bold min-h-40",onClick:()=>de("assets")},optimoleDashboardApp.strings.options_strings.clear_cache_assets))),(0,n.createElement)("div",{className:"flex gap-2 bg-stale-yellow text-gray-800 border border-solid border-yellow-300 rounded relative px-6 py-5 mb-5"},(0,n.createElement)("p",{className:"m-0",dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.options_strings.clear_cache_notice}})))};var Ve=s(864),We=s.n(Ve);const Ke=e=>{let{settings:t,setSettings:s,setCanSave:r,showSample:a,isSampleLoading:o,setIsSampleLoading:i}=e;const{sampleImages:d,isLoading:u}=(0,l.useSelect)((e=>{const{getSampleRate:t,isLoading:s}=e("optimole");return{sampleImages:t(),isLoading:s()}})),h="disabled"!==t.network_optimization,g="disabled"!==t.cdn,f="disabled"!==t.img_to_video,b="disabled"!==t.avif,_="disabled"!==t.strip_metadata,v="disabled"!==t.autoquality,y="disabled"!==t.best_format,w=(e,n)=>{r(!0);const a={...t};a[e]=n?"enabled":"disabled",s(a)},x=()=>d.optimized_size>d.original_size?Math.floor(60*Math.random())+10:(100*parseFloat(d.optimized_size/d.original_size)).toFixed(0);return(0,n.createElement)(n.Fragment,null,(0,n.createElement)(m.ToggleControl,{label:optimoleDashboardApp.strings.options_strings.best_format_title,help:()=>(0,n.createElement)("p",{dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.options_strings.best_format_desc}}),checked:y,disabled:u,className:c()({"is-disabled":u}),onChange:e=>w("best_format",e)}),(0,n.createElement)("hr",{className:"my-8 border-grayish-blue"}),(0,n.createElement)(m.ToggleControl,{label:optimoleDashboardApp.strings.options_strings.enable_network_opt_title,help:()=>(0,n.createElement)("p",{dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.options_strings.enable_network_opt_desc}}),checked:h,disabled:u,className:c()({"is-disabled":u}),onChange:e=>w("network_optimization",e)}),(0,n.createElement)("hr",{className:"my-8 border-grayish-blue"}),(0,n.createElement)(m.ToggleControl,{label:optimoleDashboardApp.strings.options_strings.toggle_cdn,help:()=>(0,n.createElement)("p",{dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.options_strings.cdn_desc}}),checked:g,disabled:u,className:c()({"is-disabled":u}),onChange:e=>w("cdn",e)}),(0,n.createElement)("hr",{className:"my-8 border-grayish-blue"}),(0,n.createElement)(m.ToggleControl,{label:optimoleDashboardApp.strings.options_strings.enable_gif_replace_title,help:()=>(0,n.createElement)("p",{dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.options_strings.gif_replacer_desc}}),checked:f,disabled:u,className:c()({"is-disabled":u}),onChange:e=>w("img_to_video",e)}),(0,n.createElement)("hr",{className:"my-8 border-grayish-blue"}),(0,n.createElement)(m.ToggleControl,{label:optimoleDashboardApp.strings.options_strings.enable_avif_title,help:()=>(0,n.createElement)("p",{dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.options_strings.enable_avif_desc}}),checked:b,disabled:u,className:c()({"is-disabled":u}),onChange:e=>w("avif",e)}),(0,n.createElement)("hr",{className:"my-8 border-grayish-blue"}),(0,n.createElement)(m.ToggleControl,{label:optimoleDashboardApp.strings.options_strings.strip_meta_title,help:()=>(0,n.createElement)("p",{dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.options_strings.strip_meta_desc}}),checked:_,disabled:u,className:c()({"is-disabled":u}),onChange:e=>w("strip_metadata",e)}),(0,n.createElement)("hr",{className:"my-8 border-grayish-blue"}),(0,n.createElement)(m.BaseControl,{help:!v&&optimoleDashboardApp.strings.options_strings.quality_desc},(0,n.createElement)(m.ToggleControl,{label:optimoleDashboardApp.strings.options_strings.quality_title,help:()=>(0,n.createElement)("p",{dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.options_strings.ml_quality_desc}}),checked:v,disabled:u,className:c()({"is-disabled":u}),onChange:e=>w("autoquality",e)})),!v&&(0,n.createElement)(n.Fragment,null,(0,n.createElement)(m.RangeControl,{value:(k=t.quality,"number"==typeof k?k:"auto"===k||"high_c"===k?90:"medium_c"===k?75:"low_c"===k?55:90),min:50,max:100,step:1,withInputField:!1,marks:[{value:55,label:optimoleDashboardApp.strings.options_strings.low_q_title},{value:75,label:optimoleDashboardApp.strings.options_strings.medium_q_title},{value:90,label:optimoleDashboardApp.strings.options_strings.high_q_title}],onChange:e=>{r(!0);const n={...t};n.quality=e,s(n)}}),a&&(0,n.createElement)("div",{className:"flex justify-center w-full text-center"},o?(0,n.createElement)("div",{className:"flex items-center gap-5"},(0,n.createElement)("p",{className:"text-base"},optimoleDashboardApp.strings.options_strings.sample_image_loading),(0,n.createElement)(m.Icon,{icon:p,className:"animate-spin"})):(0,n.createElement)(n.Fragment,null,d.id&&0<d.original_size&&(0,n.createElement)("div",null,0<x()?(0,n.createElement)("p",{className:"text-base"},100-x(),"% ",optimoleDashboardApp.strings.latest_images.smaller):(0,n.createElement)("p",{className:"text-base"},optimoleDashboardApp.strings.latest_images.same_size),(0,n.createElement)(xe,{max:100,value:100-x()}),(0,n.createElement)("hr",{className:"my-4 border-grayish-blue"}),(0,n.createElement)(We(),{leftImageLabel:optimoleDashboardApp.strings.options_strings.image_1_label,rightImageLabel:optimoleDashboardApp.strings.options_strings.image_2_label,leftImage:d.original,rightImage:d.optimized}),(0,n.createElement)(m.Button,{variant:"default",icon:p,className:"mt-2",onClick:()=>{i(!0),ce({quality:t.quality,force:"yes"},(()=>i(!1)))}}),(0,n.createElement)("p",{className:"text-base"},optimoleDashboardApp.strings.options_strings.quality_slider_desc)),!(d.id&&0<d.original_size)&&0>d.id&&(0,n.createElement)("div",{className:"flex items-center gap-5 text-center"},(0,n.createElement)("p",{className:"text-base"},optimoleDashboardApp.strings.options_strings.no_images_found))))));var k},Qe=e=>{let{settings:t,setSettings:s,setCanSave:r}=e;const{isLoading:a}=(0,l.useSelect)((e=>{const{isLoading:t}=e("optimole");return{isLoading:t()}})),[o,i]=(0,n.useState)(""),[d,u]=(0,n.useState)(""),p="disabled"!==t.resize_smart,h="disabled"!==t.retina_images,g="disabled"!==t.limit_dimensions,f=(e,n)=>{r(!0);const a={...t};a[e]=n?"enabled":"disabled",s(a)},b=(e,n)=>{r(!0);const a={...t};a[e]=n,s(a)},_=Object.keys(t.defined_image_sizes).filter((e=>"object"==typeof t.defined_image_sizes[e]));return(0,n.createElement)(n.Fragment,null,(0,n.createElement)(m.ToggleControl,{label:optimoleDashboardApp.strings.options_strings.enable_resize_smart_title,help:()=>(0,n.createElement)("p",{dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.options_strings.enable_resize_smart_desc}}),checked:p,disabled:a,className:c()({"is-disabled":a}),onChange:e=>f("resize_smart",e)}),(0,n.createElement)("hr",{className:"my-8 border-grayish-blue"}),(0,n.createElement)(m.ToggleControl,{label:optimoleDashboardApp.strings.options_strings.enable_retina_title,help:()=>(0,n.createElement)("p",{dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.options_strings.enable_retina_desc}}),checked:h,disabled:a,className:c()({"is-disabled":a}),onChange:e=>f("retina_images",e)}),(0,n.createElement)("hr",{className:"my-8 border-grayish-blue"}),(0,n.createElement)(m.ToggleControl,{label:optimoleDashboardApp.strings.options_strings.enable_limit_dimensions_title,help:()=>(0,n.createElement)("p",{dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.options_strings.enable_limit_dimensions_desc}}),checked:g,disabled:a,className:c()({"is-disabled":a}),onChange:e=>f("limit_dimensions",e)}),g&&(0,n.createElement)(m.BaseControl,null,(0,n.createElement)("div",{className:"flex gap-8"},(0,n.createElement)(m.__experimentalNumberControl,{label:optimoleDashboardApp.strings.options_strings.width_field,labelPosition:"side",value:t.limit_width,type:"number",min:100,max:1e4,className:"basis-1/2 sm:basis-1/4",onChange:e=>b("limit_width",e)}),(0,n.createElement)(m.__experimentalNumberControl,{label:optimoleDashboardApp.strings.options_strings.height_field,labelPosition:"side",value:t.limit_height,type:"number",min:100,max:1e4,className:"basis-1/2 sm:basis-1/4",onChange:e=>b("limit_height",e)})),(0,n.createElement)("div",{className:"flex gap-2 bg-stale-yellow text-gray-800 border border-solid border-yellow-300 rounded relative px-6 py-5 my-5"},(0,n.createElement)("p",{className:"m-0",dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.options_strings.enable_limit_dimensions_notice}}))),(0,n.createElement)("hr",{className:"my-8 border-grayish-blue"}),(0,n.createElement)(m.BaseControl,{label:optimoleDashboardApp.strings.options_strings.add_image_size_desc},(0,n.createElement)("p",{className:"components-base-control__help mt-0",dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.options_strings.image_size_notice}}),(0,n.createElement)("div",{className:"flex flex-col sm:flex-row p-6 bg-light-blue border border-blue-300 rounded-md items-stretch sm:items-center gap-8"},(0,n.createElement)(m.TextControl,{label:optimoleDashboardApp.strings.options_strings.width_field,placeholder:optimoleDashboardApp.strings.options_strings.width_field,hideLabelFromVision:!0,type:"number",min:1,value:o,onChange:i,className:"optml__input sm:basis-2/5"}),(0,n.createElement)(m.TextControl,{label:optimoleDashboardApp.strings.options_strings.height_field,placeholder:optimoleDashboardApp.strings.options_strings.height_field,value:d,onChange:u,hideLabelFromVision:!0,type:"number",min:1,className:"optml__input sm:basis-2/5"}),(0,n.createElement)(m.Button,{variant:"primary",isBusy:a,disabled:a,className:"optml__button flex w-full justify-center rounded font-bold min-h-40 basis-1/5",onClick:()=>{if(!o||!d||isNaN(o)||isNaN(d))return;const e="optimole_"+o+"_"+d+"_crop",n={...t.defined_image_sizes,[e]:{width:o,height:d}};r(!0);const a={...t};a.defined_image_sizes=n,s(a),i(""),u("")}},optimoleDashboardApp.strings.options_strings.add_image_size_button))),0<_.length&&(0,n.createElement)(m.BaseControl,{label:optimoleDashboardApp.strings.options_strings.image_sizes_title,className:"pt-4"},_.map((e=>(0,n.createElement)("div",{key:e,className:"flex p-3 my-3 bg-light-blue border border-blue-300 rounded-md items-center justify-between gap-8"},(0,n.createElement)("div",{className:"flex flex-wrap items-center gap-2"},(0,n.createElement)("div",null,(0,n.createElement)("p",{className:"m-0 inline-block",dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.options_strings.name}})," ",e),(0,n.createElement)("p",{className:"m-0"},(0,n.createElement)("b",null,optimoleDashboardApp.strings.options_strings.width_field),": ",t.defined_image_sizes[e].width),(0,n.createElement)("p",{className:"m-0"},(0,n.createElement)("b",null,optimoleDashboardApp.strings.options_strings.height_field),": ",t.defined_image_sizes[e].height)),(0,n.createElement)(m.Button,{variant:"default",icon:"trash",disabled:a,onClick:()=>(e=>{const n={...t.defined_image_sizes,[e]:"remove"};r(!0);const a={...t};a.defined_image_sizes=n,s(a)})(e)}))))))},Ge=e=>{let{settings:t,setSettings:s,setCanSave:r}=e;const{isLoading:a}=(0,l.useSelect)((e=>{const{isLoading:t}=e("optimole");return{isLoading:t()}})),o="disabled"!==t.lazyload_placeholder,i="disabled"!==t.native_lazyload,d="disabled"===t.scale,u="disabled"!==t.bg_replacer,p="disabled"!==t.video_lazyload,h="disabled"!==t.no_script,g=t.placeholder_color,[f,b]=(0,n.useState)(!1),_=(e,n)=>{r(!0);const a={...t};a[e]=n?"enabled":"disabled",s(a)},v=(e,n)=>{r(!0);const a={...t};a[e]=n,s(a)},y=e=>{v("placeholder_color",e)};return(0,n.createElement)(n.Fragment,null,(0,n.createElement)(m.BaseControl,null,(0,n.createElement)(m.ToggleControl,{label:optimoleDashboardApp.strings.options_strings.enable_lazyload_placeholder_title,help:()=>(0,n.createElement)("p",{dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.options_strings.enable_lazyload_placeholder_desc}}),checked:o,disabled:a,className:c()({"is-disabled":a}),onChange:e=>_("lazyload_placeholder",e)}),o&&(0,n.createElement)("div",{className:"relative inline-block"},(0,n.createElement)(m.Button,{disabled:a,className:"gap-3 mt-2 py-3 h-auto rounded text-inherit border-gray-400 border-2 border-solid font-medium",onClick:()=>{b(!f)}},(0,n.createElement)(m.ColorIndicator,{colorValue:g}),(0,n.createElement)("span",null,optimoleDashboardApp.strings.options_strings.lazyload_placeholder_color)),f&&(0,n.createElement)(m.Popover,{placement:"bottom",position:"middle center",variant:"unstyled",className:"shadow-md border-grayish-blue border border-solid rounded bg-white p-2",onFocusOutside:()=>b(!1)},(0,n.createElement)(m.ColorPicker,{color:g,onChange:y,enableAlpha:!0,defaultValue:""}),(0,n.createElement)(m.Button,{isDestructive:!0,className:"w-full text-center flex justify-center",variant:"secondary",onClick:()=>{y("")}},optimoleDashboardApp.strings.options_strings.clear)))),(0,n.createElement)("hr",{className:"my-8 border-grayish-blue"}),(0,n.createElement)(m.BaseControl,{label:optimoleDashboardApp.strings.options_strings.exclude_first_images_title},(0,n.createElement)("p",{className:"components-base-control__help mt-0",dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.options_strings.exclude_first_images_desc}}),(0,n.createElement)("div",{className:"flex gap-8"},(0,n.createElement)(m.__experimentalNumberControl,{label:optimoleDashboardApp.strings.options_strings.exclude_first,labelPosition:"side",value:t.skip_lazyload_images,type:"number",min:0,className:"basis-1/2 md:basis-1/3",onChange:e=>v("skip_lazyload_images",e)}))),(0,n.createElement)("hr",{className:"my-8 border-grayish-blue"}),(0,n.createElement)(m.ToggleControl,{label:optimoleDashboardApp.strings.options_strings.toggle_native,help:()=>(0,n.createElement)("p",{dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.options_strings.native_desc}}),checked:i,disabled:a,className:c()({"is-disabled":a}),onChange:e=>_("native_lazyload",e)}),(0,n.createElement)("hr",{className:"my-8 border-grayish-blue"}),(0,n.createElement)(m.ToggleControl,{label:optimoleDashboardApp.strings.options_strings.toggle_scale,help:()=>(0,n.createElement)("p",{dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.options_strings.scale_desc}}),checked:d,disabled:a,className:c()({"is-disabled":a}),onChange:e=>_("scale",!e)}),(0,n.createElement)("hr",{className:"my-8 border-grayish-blue"}),(0,n.createElement)(m.ToggleControl,{label:optimoleDashboardApp.strings.options_strings.enable_video_lazyload_title,help:()=>(0,n.createElement)("p",{dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.options_strings.enable_video_lazyload_desc}}),checked:p,disabled:a,className:c()({"is-disabled":a}),onChange:e=>_("video_lazyload",e)}),(0,n.createElement)("hr",{className:"my-8 border-grayish-blue"}),(0,n.createElement)(m.ToggleControl,{label:optimoleDashboardApp.strings.options_strings.enable_noscript_title,help:()=>(0,n.createElement)("p",{dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.options_strings.enable_noscript_desc}}),checked:h,disabled:a,className:c()({"is-disabled":a}),onChange:e=>_("no_script",e)}),(0,n.createElement)("hr",{className:"my-8 border-grayish-blue"}),(0,n.createElement)(m.ToggleControl,{label:optimoleDashboardApp.strings.options_strings.enable_bg_lazyload_title,help:()=>(0,n.createElement)("p",{dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.options_strings.enable_bg_lazyload_desc}}),checked:u,disabled:a,className:c()({"is-disabled":a}),onChange:e=>_("bg_replacer",e)}),u&&(0,n.createElement)(n.Fragment,null,(0,n.createElement)("hr",{className:"my-8 border-grayish-blue"}),(0,n.createElement)(m.BaseControl,{label:optimoleDashboardApp.strings.options_strings.watch_title_lazyload,id:"optml-css-watchers"},(0,n.createElement)("p",{className:"components-base-control__help mt-0",dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.options_strings.watch_desc_lazyload}}),(0,n.createElement)(m.TextareaControl,{id:"optml-css-watchers",placeholder:optimoleDashboardApp.strings.options_strings.watch_placeholder_lazyload,value:t.watchers,onChange:e=>v("watchers",e)}))))},Ye="extension",Je="page_url",Xe="page_url_match",et="filename",tt="class",st=[{label:optimoleDashboardApp.strings.options_strings.filter_filename,value:et},{label:optimoleDashboardApp.strings.options_strings.filter_ext,value:Ye},{label:optimoleDashboardApp.strings.options_strings.filter_url,value:Je},{label:optimoleDashboardApp.strings.options_strings.filter_class,value:tt}],nt=[{label:optimoleDashboardApp.strings.options_strings.exclude_filename_desc,value:et},{label:optimoleDashboardApp.strings.options_strings.exclude_ext_desc,value:Ye},{label:optimoleDashboardApp.strings.options_strings.exclude_url_desc,value:Je},{label:optimoleDashboardApp.strings.options_strings.exclude_url_match_desc,value:Xe},{label:optimoleDashboardApp.strings.options_strings.exclude_class_desc,value:tt}],rt=[{label:".SVG",value:"svg"},{label:".JPG",value:"jpg"},{label:".PNG",value:"png"},{label:".GIF",value:"gif"},{label:".WEBP",value:"webp"}],at=e=>{let{label:t,help:s,type:r,settings:a,setSettings:o,setCanSave:i}=e;const{isLoading:d}=(0,l.useSelect)((e=>{const{isLoading:t}=e("optimole");return{isLoading:t()}})),[c,u]=(0,n.useState)(et),[p,h]=(0,n.useState)(optimoleDashboardApp.strings.options_strings.filter_operator_contains),[g,f]=(0,n.useState)(""),[b,_]=(0,n.useState)(optimoleDashboardApp.strings.options_strings.filter_operator_contains),[v,y]=(0,n.useState)(!1),w=0<Object.keys(a.filters[r][Ye]).length&&Object.values(a.filters[r][Ye]).some((e=>!1!==e))||0<Object.keys(a.filters[r][tt]).length&&Object.values(a.filters[r][tt]).some((e=>!1!==e))||0<Object.keys(a.filters[r][Je]).length&&Object.values(a.filters[r][Je]).some((e=>!1!==e))||0<Object.keys(a.filters[r][Xe]).length&&Object.values(a.filters[r][Xe]).some((e=>!1!==e))||0<Object.keys(a.filters[r][et]).length&&Object.values(a.filters[r][et]).some((e=>!1!==e));return(0,n.createElement)(n.Fragment,null,(0,n.createElement)(m.BaseControl,{label:t,help:c===Je&&optimoleDashboardApp.strings.options_strings.filter_helper},(0,n.createElement)("p",{className:"components-base-control__help mt-0",dangerouslySetInnerHTML:{__html:s}}),(0,n.createElement)("div",{className:"flex flex-col md:flex-row p-6 my-3 bg-light-blue border border-blue-300 rounded-md items-center justify-between gap-8"},(0,n.createElement)("div",{className:"flex justify-start items-center gap-4"},(0,n.createElement)(m.SelectControl,{value:c,options:st,onChange:e=>{let t="";e===Ye&&(t="svg",h(optimoleDashboardApp.strings.options_strings.filter_operator_is)),e===et&&h(optimoleDashboardApp.strings.options_strings.filter_operator_contains),e===tt&&h(optimoleDashboardApp.strings.options_strings.filter_operator_contains),y(!1),f(t),u(e)},className:"optml__select",__nextHasNoMarginBottom:!0}),c===Je?(0,n.createElement)(m.SelectControl,{value:b,options:[{label:optimoleDashboardApp.strings.options_strings.filter_operator_contains,value:optimoleDashboardApp.strings.options_strings.filter_operator_contains},{label:optimoleDashboardApp.strings.options_strings.filter_operator_matches,value:optimoleDashboardApp.strings.options_strings.filter_operator_matches}],onChange:_,className:"optml__select",__nextHasNoMarginBottom:!0}):(0,n.createElement)("p",{className:"m-0"},p),c===Ye?(0,n.createElement)(m.SelectControl,{value:g,options:rt,onChange:f,className:"optml__select",__nextHasNoMarginBottom:!0}):(0,n.createElement)(m.TextControl,{value:g,placeholder:"matches"===b?"path":"word",onChange:e=>{f(e),y(!1)},className:"optml__input"})),(0,n.createElement)(m.Button,{variant:"primary",isBusy:d,disabled:d,className:"optml__button flex w-full justify-center rounded font-bold min-h-40 basis-1/5",onClick:()=>{if(3>g.length)return void y(!0);const e={...a.filters};let t=c;c===Je&&"matches"===b&&(t=Xe),e[r]&&"object"==typeof e[r]||(e[r]={}),e[r][t]&&!Array.isArray(e[r][t])||(e[r][t]={}),e[r][t][g]=!0,o({...a,filters:e}),c!==Ye&&f(""),i(!0)}},optimoleDashboardApp.strings.options_strings.add_filter)),v&&(0,n.createElement)("p",{className:"text-red-500 bg-red-100 p-2 rounded-md border border-solid border-red-200"},optimoleDashboardApp.strings.options_strings.filter_length_error)),w&&(0,n.createElement)(m.BaseControl,{label:"optimize"===r?optimoleDashboardApp.strings.options_strings.active_optimize_exclusions:optimoleDashboardApp.strings.options_strings.active_lazyload_exclusions,className:"py-4"},nt.map((e=>Object.keys(a.filters[r][e.value]).filter((t=>!1!==a.filters[r][e.value][t])).map((t=>(0,n.createElement)("div",{key:t,className:"flex p-3 my-3 bg-light-blue border border-blue-300 rounded-md items-center justify-between gap-8"},(0,n.createElement)("div",{className:"flex items-center gap-1"},(0,n.createElement)("p",{className:"m-0 inline-block",dangerouslySetInnerHTML:{__html:e.label}}),(0,n.createElement)("b",null,t)),(0,n.createElement)(m.Button,{variant:"default",icon:"trash",disabled:d,onClick:()=>((e,t)=>{const s={...a.filters};s[r][e][t]=!1,o({...a,filters:s}),i(!0)})(e.value,t)}))))))))},ot=e=>{let{settings:t,setSettings:s,setCanSave:r}=e;const a="disabled"!==t.lazyload;return(0,n.createElement)(n.Fragment,null,(0,n.createElement)(at,{label:optimoleDashboardApp.strings.options_strings.exclude_title_optimize,help:optimoleDashboardApp.strings.options_strings.exclude_desc_optimize,type:"optimize",settings:t,setSettings:s,setCanSave:r}),a&&(0,n.createElement)(n.Fragment,null,(0,n.createElement)("hr",{className:"my-8 border-grayish-blue"}),(0,n.createElement)(at,{label:optimoleDashboardApp.strings.options_strings.exclude_title_lazyload,help:optimoleDashboardApp.strings.options_strings.exclude_desc_lazyload,type:"lazyload",settings:t,setSettings:s,setCanSave:r})))},it=(0,n.createElement)(u.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,n.createElement)(u.Path,{d:"M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"})),lt=window.wp.compose,dt=(0,n.createElement)(u.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,n.createElement)(u.Path,{d:"M12.5 5L10 19h1.9l2.5-14z"})),ct=e=>{let{type:t}=e;const{logs:s}=(0,l.useSelect)((e=>{const{getLogs:t}=e("optimole");return{logs:t()}})),[r,a]=(0,n.useState)(!1),o=(0,n.useRef)(null);return(0,n.useEffect)((()=>{const e=setInterval((()=>{o.current&&(o.current.innerHTML=s[t],o.current.scrollTop=o.current.scrollHeight)}),15e3);return()=>clearInterval(e)}),[]),(0,n.createElement)(n.Fragment,null,(0,n.createElement)("div",{className:"w-full flex justify-end text-info my-2"},(0,n.createElement)(m.Button,{variant:"tertiary",className:"py-2 px-0",target:"_blank",href:`${window.ajaxurl}?action=optml_fetch_logs&nonce=${optimoleDashboardApp.nonce}&type=${t}`},optimoleDashboardApp.strings.options_strings.view_logs),(0,n.createElement)(m.Icon,{icon:dt,className:"fill-info py-2"}),(0,n.createElement)(m.Button,{variant:"tertiary",className:"py-2 px-0",onClick:()=>a(!r)},r?optimoleDashboardApp.strings.options_strings.hide_logs:optimoleDashboardApp.strings.options_strings.show_logs)),r&&(0,n.createElement)("div",{className:"flex flex-col p-6 bg-light-blue border border-blue-300 rounded-md min-h-[200px] max-h-[200px] overflow-y-scroll",ref:o,dangerouslySetInnerHTML:{__html:s[t]}}))},ut=e=>{let{icon:t,labels:s={},onRequestClose:r=(()=>{}),onConfirm:a=(()=>{}),variant:o="default"}=e;const i=(0,lt.useViewportMatch)("small","<");return(0,n.createElement)(m.Modal,{__experimentalHideHeader:!0,className:"optml__modal",onRequestClose:r,isFullScreen:i},(0,n.createElement)(m.Button,{onClick:r,icon:it,label:optimoleDashboardApp.strings.csat.close,className:"fixed right-3 top-3 cursor-pointer"}),(0,n.createElement)("div",{className:"flex flex-col items-center"},(0,n.createElement)(m.Icon,{icon:t,size:24,className:c()("p-3 rounded-full",{"bg-stale-yellow":"warning"===o,"bg-light-blue":"default"===o})}),(0,n.createElement)("h2",{className:"mb-0",dangerouslySetInnerHTML:{__html:s.title}}),(0,n.createElement)("p",{className:"text-center mx-0 my-4",dangerouslySetInnerHTML:{__html:s.description}}),(0,n.createElement)(m.Button,{variant:"primary",className:c()("optml__button flex justify-center px-5 py-3 rounded font-bold min-h-40 basis-1/5",{"bg-mango-yellow":"warning"===o}),onClick:a},s.action)))},pt=e=>{let{settings:t,canSave:s,setSettings:r,setCanSave:a,onSaveSettings:o}=e;const{offloadConflicts:i,errorMedia:d,offloadLibraryLink:u,isLoading:h,loadingSync:g,loadingRollback:f,rollbackLibraryLink:w,queryArgs:x,totalNumberOfImages:k,processedImages:E}=(0,l.useSelect)((e=>{const{getOffloadConflicts:t,getErrorMedia:s,getLoadingSync:n,getLoadingRollback:r,getOffloadLibraryLink:a,getRollbackLibraryLink:o,getTotalNumberOfImages:i,getProcessedImages:l,getQueryArgs:d,isLoading:c}=e("optimole");return{offloadConflicts:t(),errorMedia:s(),offloadLibraryLink:a(),isLoading:c(),loadingSync:n(),loadingRollback:r(),rollbackLibraryLink:o(),queryArgs:d(),totalNumberOfImages:i(),processedImages:l()}})),{setErrorMedia:C,setCheckedOffloadConflicts:S,setOffloadConflicts:A}=(0,l.useDispatch)("optimole"),[j,N]=(0,n.useState)("yes"),[L,D]=(0,n.useState)(!1),[I,T]=(0,n.useState)(!1),[M,O]=(0,n.useState)(!1),F="disabled"!==t.cloud_images,B="disabled"!==t.offload_media,z="disabled"!==t.offloading_status,P="disabled"!==t.rollback_status,R=optimoleDashboardApp.user_data.whitelist||[];(0,n.useEffect)((()=>{Object.prototype.hasOwnProperty.call(x,"optimole_action")&&("offload_images"===x.optimole_action&&q(x.images),"rollback_images"===x.optimole_action&&Z(x.images))}),[]),(0,n.useEffect)((()=>{z&&pe({action:"offload_images",refresh:!0}),P&&pe({action:"rollback_images",refresh:!0})}),[]),(0,n.useEffect)((()=>{s||(O(!1),"yes"===j&&I&&(Z(),N("no")),T(!1))}),[s]);const q=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];o(),C(!1),pe({action:"offload_images",images:e})},Z=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];S(!1),A([]),ue((t=>{0===t.data.length&&(C(!1),pe({action:"rollback_images",images:e}))}))};return(0,n.createElement)(n.Fragment,null,(0,n.createElement)(m.ToggleControl,{label:optimoleDashboardApp.strings.options_strings.enable_cloud_images_title,help:()=>(0,n.createElement)("p",{dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.options_strings.enable_cloud_images_desc}}),checked:F,disabled:h,className:c()({"is-disabled":h}),onChange:e=>((e,s)=>{a(!0);const n={...t};n.cloud_images=s?"enabled":"disabled",r(n)})(0,e)}),(0,n.createElement)("hr",{className:"my-8 border-grayish-blue"}),F&&(0,n.createElement)(n.Fragment,null,(0,n.createElement)(m.BaseControl,{label:optimoleDashboardApp.strings.options_strings.cloud_site_title},(0,n.createElement)("p",{className:"components-base-control__help mt-0",dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.options_strings.cloud_site_desc}}),(0,n.createElement)("div",{className:"optml__token__base flex p-6 bg-light-blue border border-blue-300 rounded-md items-center gap-8"},(0,n.createElement)(m.FormTokenField,{value:Object.keys(t.cloud_sites).filter((e=>"all"!==e&&"false"!==t.cloud_sites[e])).map((e=>e))||[],suggestions:R,onChange:e=>{a(!0);const s={},n={...t};0===e.length?s.all="true":e.forEach((e=>{s[e]="true"})),Object.keys(n.cloud_sites).forEach((e=>{Object.prototype.hasOwnProperty.call(s,e)||(s[e]="false")})),n.cloud_sites=s,r(n)},__experimentalExpandOnFocus:!0,__experimentalShowHowTo:!1,__experimentalValidateInput:e=>R.includes(e),className:"optml__token"}))),(0,n.createElement)("hr",{className:"my-8 border-grayish-blue"})),(0,n.createElement)(m.ToggleControl,{label:optimoleDashboardApp.strings.options_strings.enable_offload_media_title,help:()=>(0,n.createElement)("p",{dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.options_strings.enable_offload_media_desc}}),checked:B,disabled:h,className:c()({"is-disabled":h}),onChange:e=>{a(!0);const s={...t};s.offload_media=e?"enabled":"disabled",r(s),T("enabled"===optimoleDashboardApp.site_settings.offload_media&&!e),O("disabled"===optimoleDashboardApp.site_settings.offload_media&&!!e)}}),M&&(0,n.createElement)("div",{className:"flex gap-2 bg-stale-yellow text-gray-800 border border-solid border-yellow-300 rounded relative px-6 py-5 mb-5"},(0,n.createElement)("p",{className:"m-0",dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.options_strings.offload_enable_info_desc}})),I&&(0,n.createElement)("div",{className:"flex flex-col gap-2 bg-stale-yellow text-gray-800 border border-solid border-yellow-300 rounded relative px-6 py-5 mb-5"},(0,n.createElement)("div",{className:"flex gap-2 items-center"},(0,n.createElement)(m.Icon,{icon:b,size:16}),(0,n.createElement)("p",{className:"font-bold text-base m-0"},optimoleDashboardApp.strings.options_strings.offload_disable_warning_title)),(0,n.createElement)("p",{className:"m-0",dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.options_strings.offload_disable_warning_desc}}),(0,n.createElement)(m.SelectControl,{value:j,options:[{label:optimoleDashboardApp.strings.options_strings.yes,value:"yes"},{label:optimoleDashboardApp.strings.options_strings.no,value:"no"}],onChange:N,className:"optml__select",__nextHasNoMarginBottom:!0})),B&&(0,n.createElement)(n.Fragment,null,(0,n.createElement)("hr",{className:"my-8 border-grayish-blue"}),(0,n.createElement)(m.BaseControl,{label:optimoleDashboardApp.strings.options_strings.sync_title},(0,n.createElement)("p",{className:"components-base-control__help mt-0",dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.options_strings.sync_desc}}),(0,n.createElement)("div",{className:"flex my-2 gap-3"},(0,n.createElement)(m.Button,{variant:"default",isBusy:g||f||h,disabled:g||f||h,className:c()("optml__button flex justify-center rounded font-bold min-h-40",{"is-disabled":h}),onClick:()=>D("enableOffloading")},optimoleDashboardApp.strings.options_strings.sync_media),"enableOffloading"===L&&(0,n.createElement)(ut,{icon:_,labels:{title:optimoleDashboardApp.strings.options_strings.offloading_start_title,description:optimoleDashboardApp.strings.options_strings.offloading_start_description,action:optimoleDashboardApp.strings.options_strings.offloading_start_action},onRequestClose:()=>D(!1),onConfirm:()=>{D(!1),q()}}),g&&(0,n.createElement)(n.Fragment,null,(0,n.createElement)(m.Button,{variant:"default",isDestructive:!0,className:"optml__button flex justify-center rounded font-bold min-h-40",onClick:()=>D("disableOffloading")},optimoleDashboardApp.strings.options_strings.stop),"disableOffloading"===L&&(0,n.createElement)(ut,{icon:y,labels:{title:optimoleDashboardApp.strings.options_strings.offloading_stop_title,description:optimoleDashboardApp.strings.options_strings.offloading_stop_description,action:optimoleDashboardApp.strings.options_strings.offloading_stop_action},onRequestClose:()=>D(!1),onConfirm:()=>{D(!1);const e=t;e.offloading_status="disabled",le(e)},variant:"warning"})))),g&&(0,n.createElement)(n.Fragment,null,(0,n.createElement)("div",{className:"flex flex-col p-6 bg-light-blue border border-blue-300 rounded-md"},(0,n.createElement)("div",{className:"flex justify-between w-full items-center"},(0,n.createElement)("p",{className:"font-bold text-base m-0"},optimoleDashboardApp.strings.options_strings.sync_media_progress),(0,n.createElement)(m.Icon,{icon:p,className:"animate-spin fill-dark-blue"})),(0,n.createElement)(xe,{className:"mt-2.5 mb-1.5 mx-0",value:Math.round(E/k*100),max:100}),0===k?(0,n.createElement)("p",{className:"m-0"},optimoleDashboardApp.strings.options_strings.calculating_estimated_time):(0,n.createElement)("p",{className:"m-0"},optimoleDashboardApp.strings.options_strings.images_processing)),(0,n.createElement)(ct,{type:"offload"})),!0===u&&(0,n.createElement)("p",{className:"m-0"},optimoleDashboardApp.strings.options_strings.sync_media_link," ",(0,n.createElement)("a",{href:x.url},optimoleDashboardApp.strings.options_strings.here)),"offload_images"===d&&(0,n.createElement)("div",{className:"flex flex-col gap-2 bg-warning text-danger border border-solid border-danger rounded relative px-6 py-5 mb-5"},(0,n.createElement)("div",{className:"flex items-center gap-2"},(0,n.createElement)(m.Icon,{icon:b,size:16}),(0,n.createElement)("p",{className:"font-bold m-0"},optimoleDashboardApp.strings.options_strings.sync_media_error)),(0,n.createElement)("p",{className:"m-0"},optimoleDashboardApp.strings.options_strings.sync_media_error_desc))),(B||f)&&(0,n.createElement)(n.Fragment,null,(0,n.createElement)("hr",{className:"my-8 border-grayish-blue"}),(0,n.createElement)(m.BaseControl,{label:optimoleDashboardApp.strings.options_strings.rollback_title},(0,n.createElement)("p",{className:"components-base-control__help mt-0",dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.options_strings.rollback_desc}}),(0,n.createElement)("div",{className:"flex my-2 gap-3"},(0,n.createElement)(m.Button,{variant:"default",isBusy:g||f||h,disabled:g||f||h||Boolean(i.length),className:c()("optml__button flex justify-center rounded font-bold min-h-40",{"is-disabled":h}),onClick:()=>D("enableRollback")},optimoleDashboardApp.strings.options_strings.rollback_media),"enableRollback"===L&&(0,n.createElement)(ut,{icon:v,labels:{title:optimoleDashboardApp.strings.options_strings.rollback_start_title,description:optimoleDashboardApp.strings.options_strings.rollback_start_description,action:optimoleDashboardApp.strings.options_strings.rollback_start_action},onRequestClose:()=>D(!1),onConfirm:()=>{D(!1),Z()}}),f&&(0,n.createElement)(n.Fragment,null,(0,n.createElement)(m.Button,{variant:"default",isDestructive:!0,className:"optml__button flex justify-center rounded font-bold min-h-40",onClick:()=>D("disableRollback")},optimoleDashboardApp.strings.options_strings.stop),"disableRollback"===L&&(0,n.createElement)(ut,{icon:y,labels:{title:optimoleDashboardApp.strings.options_strings.rollback_stop_title,description:optimoleDashboardApp.strings.options_strings.rollback_stop_description,action:optimoleDashboardApp.strings.options_strings.rollback_stop_action},onRequestClose:()=>D(!1),onConfirm:()=>{D(!1);const e=t;e.rollback_status="disabled",le(e)},variant:"warning"})))),f&&(0,n.createElement)(n.Fragment,null,(0,n.createElement)("div",{className:"flex flex-col p-6 bg-light-blue border border-blue-300 rounded-md"},(0,n.createElement)("div",{className:"flex justify-between w-full items-center"},(0,n.createElement)("p",{className:"font-bold text-base m-0"},optimoleDashboardApp.strings.options_strings.rollback_media_progress),(0,n.createElement)(m.Icon,{icon:p,className:"animate-spin fill-dark-blue"})),(0,n.createElement)(xe,{className:"mt-2.5 mb-1.5 mx-0",value:Math.round(E/k*100),max:100}),0===k?(0,n.createElement)("p",{className:"m-0"},optimoleDashboardApp.strings.options_strings.calculating_estimated_time):(0,n.createElement)("p",{className:"m-0"},optimoleDashboardApp.strings.options_strings.images_processing)),(0,n.createElement)(ct,{type:"rollback"})),Boolean(i.length)&&(0,n.createElement)("div",{className:"flex flex-col gap-2 bg-stale-yellow text-gray-800 border border-solid border-yellow-300 rounded relative px-6 py-5 mb-5"},(0,n.createElement)("p",{className:"m-0"},optimoleDashboardApp.strings.options_strings.offload_conflicts_part_1),i.map(((e,t)=>(0,n.createElement)("p",{key:t,className:"m-0 font-bold"},e))),(0,n.createElement)("p",{className:"m-0"},optimoleDashboardApp.strings.options_strings.offload_conflicts_part_2),(0,n.createElement)(m.Button,{variant:"default",isBusy:h,disabled:h,className:"optml__button flex justify-center rounded font-bold min-h-40",onClick:()=>A([])},optimoleDashboardApp.strings.conflicts.conflict_close)),!0===w&&(0,n.createElement)("p",{className:"m-0"},optimoleDashboardApp.strings.options_strings.rollback_media_link," ",(0,n.createElement)("a",{href:x.url},optimoleDashboardApp.strings.options_strings.here)),"rollback_images"===d&&(0,n.createElement)("div",{className:"flex flex-col gap-2 bg-warning text-danger border border-solid border-danger rounded relative px-6 py-5 mb-5"},(0,n.createElement)("div",{className:"flex items-center gap-2"},(0,n.createElement)(m.Icon,{icon:b,size:16}),(0,n.createElement)("p",{className:"font-bold m-0"},optimoleDashboardApp.strings.options_strings.rollback_media_error)),(0,n.createElement)("p",{className:"m-0"},optimoleDashboardApp.strings.options_strings.rollback_media_error_desc))))},mt=e=>{let{tab:t,setTab:s,canSave:r,setCanSave:a,settings:o,setSettings:i}=e;const{siteSettings:d,isLoading:c,damEnabled:u}=(0,l.useSelect)((e=>{const{getSiteSettings:t,getQueryArgs:s,isLoading:n}=e("optimole"),r=t();return{siteSettings:r,damEnabled:r.cloud_images,isLoading:n(),queryArgs:s()}})),[p,h]=(0,n.useState)(!1),[g,f]=(0,n.useState)(!1);(0,n.useEffect)((()=>{!function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const{dam_url:t,strings:s}=window.optimoleDashboardApp,{cloud_library:n}=s,r=document.querySelector('a[href*="page=optimole-dam"]');if(!e&&!r)return;if(!e){if(!r)return;return void(r.style.display="none")}if(r)return void(r.style={});const a=document.createElement("li"),o=document.createElement("a");a.appendChild(o),o.href=t,o.innerHTML=n;const i=document.querySelector("#toplevel_page_optimole ul");i&&i.insertBefore(a,i.firstChild)}("enabled"===u)}),[u]),(0,n.useEffect)((()=>{const e=localStorage.getItem("optimole_settings_visits");3<e||localStorage.setItem("optimole_settings_visits",e?parseInt(e)+1:1)}),[t]);const b=()=>{le(o,d.banner_frontend!==o.banner_frontend),a(!1)};return(0,n.createElement)("div",{className:"optml-settings flex flex-col sm:flex-row bg-white p-8 border-0 rounded-lg shadow-md gap-8"},(0,n.createElement)(Ue,{tab:t,setTab:s}),(0,n.createElement)("div",{className:"basis-4/5"},"general"===t&&(0,n.createElement)($e,{settings:o,setSettings:i,setCanSave:a}),"compression"===t&&(0,n.createElement)(Ke,{settings:o,setSettings:i,setCanSave:a,showSample:p,isSampleLoading:g,setIsSampleLoading:f}),"resize"===t&&(0,n.createElement)(Qe,{settings:o,setSettings:i,setCanSave:a}),"lazyload"===t&&(0,n.createElement)(Ge,{settings:o,setSettings:i,setCanSave:a}),"exclusions"===t&&(0,n.createElement)(ot,{settings:o,setSettings:i,setCanSave:a}),"offload_media"===t&&(0,n.createElement)(pt,{settings:o,canSave:r,setSettings:i,setCanSave:a,onSaveSettings:b}),(0,n.createElement)("div",{className:"flex justify-start items-center gap-5 mt-8"},(0,n.createElement)(m.Button,{variant:"primary",isBusy:c,disabled:!r,className:"optml__button flex w-full justify-center rounded font-bold min-h-40 basis-1/5",onClick:b},optimoleDashboardApp.strings.options_strings.save_changes),"disabled"===o.autoquality&&"compression"===t&&(0,n.createElement)(m.Button,{variant:"default",disabled:c,onClick:()=>{p||(f(!0),ce({quality:o.quality},(()=>f(!1)))),h(!p)}},optimoleDashboardApp.strings.options_strings.view_sample_image))))},ht=(0,n.createElement)(u.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,n.createElement)(u.Path,{fillRule:"evenodd",d:"M17.375 15.656A6.47 6.47 0 0018.5 12a6.47 6.47 0 00-.943-3.374l-1.262.813c.448.749.705 1.625.705 2.561a4.977 4.977 0 01-.887 2.844l1.262.813zm-1.951 1.87l-.813-1.261A4.976 4.976 0 0112 17c-.958 0-1.852-.27-2.613-.736l-.812 1.261A6.47 6.47 0 0012 18.5a6.47 6.47 0 003.424-.974zm-8.8-1.87A6.47 6.47 0 015.5 12c0-1.235.344-2.39.943-3.373l1.261.812A4.977 4.977 0 007 12c0 1.056.328 2.036.887 2.843l-1.262.813zm2.581-7.803A4.977 4.977 0 0112 7c1.035 0 1.996.314 2.794.853l.812-1.262A6.47 6.47 0 0012 5.5a6.47 6.47 0 00-3.607 1.092l.812 1.261zM12 20a8 8 0 100-16 8 8 0 000 16zm0-4.5a3.5 3.5 0 100-7 3.5 3.5 0 000 7z",clipRule:"evenodd"})),gt=(0,n.createElement)(u.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,n.createElement)(u.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M6.68822 16.625L5.5 17.8145L5.5 5.5L18.5 5.5L18.5 16.625L6.68822 16.625ZM7.31 18.125L19 18.125C19.5523 18.125 20 17.6773 20 17.125L20 5C20 4.44772 19.5523 4 19 4H5C4.44772 4 4 4.44772 4 5V19.5247C4 19.8173 4.16123 20.086 4.41935 20.2237C4.72711 20.3878 5.10601 20.3313 5.35252 20.0845L7.31 18.125ZM16 9.99997H8V8.49997H16V9.99997ZM8 14H13V12.5H8V14Z"})),ft=(0,n.createElement)(u.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,n.createElement)(u.Path,{d:"M11.1 15.8H20v-1.5h-8.9v1.5zm0-8.6v1.5H20V7.2h-8.9zM6 13c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-7c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"})),bt=[{title:optimoleDashboardApp.strings.help.get_support_title,description:optimoleDashboardApp.strings.help.get_support_desc,cta:optimoleDashboardApp.strings.help.get_support_cta,link:"https://wordpress.org/support/plugin/optimole-wp/",icon:ht},{title:optimoleDashboardApp.strings.help.feat_request_title,description:optimoleDashboardApp.strings.help.feat_request_desc,cta:optimoleDashboardApp.strings.help.feat_request_cta,link:"https://github.com/Codeinwp/optimole-wp/discussions",icon:gt},{title:optimoleDashboardApp.strings.help.feedback_title,description:optimoleDashboardApp.strings.help.feedback_desc,cta:optimoleDashboardApp.strings.help.feedback_cta,link:"https://wordpress.org/plugins/optimole-wp/#developers",icon:ft}],_t=[{title:optimoleDashboardApp.strings.help.account_title,items:[{label:optimoleDashboardApp.strings.help.account_item_one,value:"https://docs.optimole.com/article/1134-how-optimole-counts-the-number-of-visitors"},{label:optimoleDashboardApp.strings.help.account_item_two,value:"https://docs.optimole.com/article/1008-what-happens-if-i-exceed-plan-limits"},{label:optimoleDashboardApp.strings.help.account_item_three,value:"https://docs.optimole.com/article/1133-visitors-based-plan"}]},{title:optimoleDashboardApp.strings.help.image_processing_title,items:[{label:optimoleDashboardApp.strings.help.image_processing_item_one,value:"https://docs.optimole.com/article/1173-how-to-get-started-with-optimole-in-just-3-steps"},{label:optimoleDashboardApp.strings.help.image_processing_item_two,value:"https://docs.optimole.com/article/1068-how-optimole-can-serve-webp-images"},{label:optimoleDashboardApp.strings.help.image_processing_item_three,value:"https://docs.optimole.com/article/1475-adding-watermarks-to-your-images"}]},{title:optimoleDashboardApp.strings.help.api_title,items:[{label:optimoleDashboardApp.strings.help.api_item_one,value:"https://docs.optimole.com/article/1323-cloud-library-browsing"},{label:optimoleDashboardApp.strings.help.api_item_two,value:"https://docs.optimole.com/article/1191-exclude-from-optimizing-or-lazy-loading"},{label:optimoleDashboardApp.strings.help.api_item_three,value:"https://docs.optimole.com/article/1307-custom-integration"}]}],vt="flex p-6 border-2 border-solid border-grayish-blue rounded-md items-start gap-8 basis-1/3",yt=()=>(0,n.createElement)("div",{className:"bg-white p-8 border-0 rounded-lg shadow-md"},(0,n.createElement)("p",{className:"font-bold text-base"},optimoleDashboardApp.strings.help.section_one_title),(0,n.createElement)("div",{className:"flex gap-5 flex-col md:flex-row"},bt.map(((e,t)=>(0,n.createElement)("div",{key:t,className:vt},(0,n.createElement)("div",{className:"flex w-full flex-col gap-2"},(0,n.createElement)(m.Icon,{icon:e.icon,className:"fill-info",size:42}),(0,n.createElement)("div",{className:"font-bold text-base py-2 text-gray-800"},e.title),(0,n.createElement)("div",{className:"not-italic font-normal text-s text-gray-800"},e.description),(0,n.createElement)(m.ExternalLink,{href:e.link},e.cta)))))),(0,n.createElement)("hr",{className:"my-8 border-grayish-blue"}),(0,n.createElement)("div",{className:"flex items-center justify-between"},(0,n.createElement)("p",{className:"font-bold text-base"},optimoleDashboardApp.strings.help.section_two_title),(0,n.createElement)(m.ExternalLink,{href:"https://docs.optimole.com/"},optimoleDashboardApp.strings.help.section_two_sub)),(0,n.createElement)("div",{className:"flex gap-5 flex-col md:flex-row"},_t.map(((e,t)=>(0,n.createElement)("div",{key:t,className:vt},(0,n.createElement)("div",{className:"flex w-full flex-col gap-2"},(0,n.createElement)("div",{className:"font-bold text-base py-2 text-gray-800"},e.title),e.items.map(((e,t)=>(0,n.createElement)("a",{key:t,href:e.value,target:"_blank"},e.label))))))))),wt=[optimoleDashboardApp.strings.upgrade.reason_1,optimoleDashboardApp.strings.upgrade.reason_2,optimoleDashboardApp.strings.upgrade.reason_3,optimoleDashboardApp.strings.upgrade.reason_4],xt=()=>{const{name:e,domain:t,plan:s}=(0,l.useSelect)((e=>{const{getUserData:t}=e("optimole"),s=t();let n=s?.cdn_key+".i.optimole.com";return void 0!==s?.domain&&""!==s?.domain&&(n=s?.domain),{name:s?.display_name,domain:n,plan:s?.plan}}));return(0,n.createElement)("div",{className:"flex flex-col mt-8 mb-5 p-0 transition-all ease-in-out duration-700 gap-5 basis-3/12"},(0,n.createElement)("div",{className:"bg-white gap-5 flex flex-col text-gray-700 border-0 rounded-lg shadow-md p-8"},(0,n.createElement)(m.TextControl,{label:optimoleDashboardApp.strings.logged_in_as,value:e,className:"optml__placeholder",disabled:!0}),(0,n.createElement)(m.TextControl,{label:optimoleDashboardApp.strings.private_cdn_url,value:t,className:"optml__placeholder",disabled:!0}),(0,n.createElement)("hr",{className:"m-0 border-grayish-blue"}),(0,n.createElement)("p",{className:"font-semibold text-xs text-light-black m-0"},optimoleDashboardApp.strings.looking_for_api_key),(0,n.createElement)("p",{className:"m-0 -mt-3",dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.optml_dashboard}})),"free"===s?(0,n.createElement)("div",{className:"bg-info flex flex-col text-white border-0 rounded-lg shadow-md p-8 bg-promo bg-no-repeat",style:{backgroundImage:`url( ${optimoleDashboardApp.assets_url}/img/logo2.png )`}},(0,n.createElement)("h3",{className:"mt-0 text-white text-lg"},optimoleDashboardApp.strings.upgrade.title_long),(0,n.createElement)("ul",null,wt.map(((e,t)=>(0,n.createElement)("li",{key:t,className:"flex items-center gap-2"},(0,n.createElement)(m.Icon,{icon:"yes-alt",className:"text-white"}),(0,n.createElement)("span",{className:"text-white font-normal text-base"},e))))),(0,n.createElement)(m.Button,{variant:"link",className:"optml__button flex w-full justify-center font-bold min-h-40 !no-underline !text-white !bg-opaque-black !rounded",href:"https://optimole.com/pricing",target:"_blank"},optimoleDashboardApp.strings.upgrade.cta)):(0,n.createElement)(m.Button,{variant:"default",className:"bg-white flex font-bold border-0 rounded-lg shadow-md p-8 text-sm justify-center",href:(0,k.addQueryArgs)("https://optimole.com/contact/",{contact_name:window.optimoleDashboardApp.user_data.display_name,contact_email:optimoleDashboardApp.user_data.user_email,contact_website:optimoleDashboardApp.home_url}),target:"_blank"},optimoleDashboardApp.strings.premium_support))},kt=(0,n.createElement)(u.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,n.createElement)(u.Path,{d:"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"})),Et=(0,n.createElement)(u.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,n.createElement)(u.Path,{d:"M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"})),Ct=e=>{let{strings:t,onClose:s}=e;return(0,n.createElement)("div",{className:"flex justify-between px-8 pt-8"},(0,n.createElement)("p",{className:"text-purple-gray text-sm m-0 py-2"},t.title),(0,n.createElement)(m.Button,{label:t.close,icon:kt,onClick:s,className:"text-gray-950"}))};window.optimoleCSAT={hasSubmitted:!1,data:{}};const St=e=>{let{id:t,show:s=!1,strings:r={},pages:a=[],onDismiss:o=(()=>{})}=e;const[i,l]=(0,n.useState)(!1),[d,c]=(0,n.useState)(0),[u,p]=(0,n.useState)(!1),[h,g]=(0,n.useState)(!1),[f,b]=(0,n.useState)({});(0,n.useEffect)((()=>{const e=()=>{!window.optimoleCSAT.hasSubmitted&&window.optimoleCSAT.data?.score&&localStorage.setItem(`optimole_csat_data_${t}`,JSON.stringify(window.optimoleCSAT.data))};return window.addEventListener("beforeunload",e),()=>{window.removeEventListener("beforeunload",e)}}),[]),(0,n.useEffect)((()=>{s&&!u&&l(s)}),[s]),(0,n.useEffect)((()=>{window.optimoleCSAT={hasSubmitted:h,data:f}}),[h,f]);const _=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:f;if(o(),h||!t?.score)return p(!0),null;const s={email:optimoleDashboardApp.user_data.user_email,product:"Optimole",site:optimoleDashboardApp.home_url,...t};try{fetch(`https://api.themeisle.com/tracking/csat/${t?.score}`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json, */*;q=0.1","Cache-Control":"no-cache"},body:JSON.stringify(s)})}catch(e){console.warn(e)}g(!0),c(a.length),e&&(l(!1),p(!0))};if((0,n.useEffect)((()=>{const e=localStorage.getItem(`optimole_csat_data_${t}`);e&&(_(!0,JSON.parse(e)),localStorage.removeItem(`optimole_csat_data_${t}`))}),[]),!i)return null;if(0===a.length)return null;const v=d<a.length,y=a[d]?.content;return(0,n.createElement)("div",{className:"bg-white fixed left-0 w-auto sm:right-0 sm:left-auto sm:w-full bottom-0 m-12 gap-2 max-w-lg flex flex-col text-gray-700 border-0 rounded-lg shadow-lg z-50"},a[d]&&(0,n.createElement)(n.Fragment,null,a[d]?.showHeader&&(0,n.createElement)(Ct,{onClose:()=>{l(!1),p(!0),_()},strings:r}),(0,n.createElement)(y,{data:f,changeData:function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];b({...f,...e}),t&&c(d+1)},onSubmit:_})),!v&&(0,n.createElement)("div",{className:"flex flex-col gap-5 p-8 items-center"},(0,n.createElement)(m.Icon,{icon:Et,size:40,className:"bg-success rounded-full fill-white p-2"}),(0,n.createElement)("div",{className:"font-bold text-lg"},optimoleDashboardApp.strings.csat.heading_three),(0,n.createElement)("div",{className:"text-sm text-center"},optimoleDashboardApp.strings.csat.thank_you),(0,n.createElement)(m.Button,{variant:"primary",onClick:()=>l(!1),className:"optml__button basis-full justify-center rounded font-bold min-h-40"},optimoleDashboardApp.strings.csat.close)))},At=window.wp.api;var jt=s.n(At);const Nt=window.wp.i18n,Lt=()=>{const[e,t]=(0,n.useState)(!1),[s,r,a]=(()=>{const[e,t]=(0,n.useState)({}),[s,r]=(0,n.useState)("loading"),a=()=>{jt().loadPromise.then((async()=>{try{const e=new(jt().models.Settings),s=await e.fetch();t(s)}catch(e){r("error")}finally{r("loaded")}}))};return(0,n.useEffect)((()=>{a()}),[]),[t=>e?.[t],function(e,t){arguments.length>2&&void 0!==arguments[2]||(0,Nt.__)("Settings saved.","textdomain"),r("saving");const s=new(jt().models.Settings)({[e]:t}).save();s.success(((e,t)=>{"success"===t&&r("loaded"),"error"===t&&r("error"),a()})),s.error((e=>{r("error")}))},s]})(),o="loaded"===a&&void 0!==s("optml_csat")&&JSON.parse(s("optml_csat")),{hasImages:i,isFirstSite:d}=(0,l.useSelect)((e=>{const{getUserData:t}=e("optimole");return{hasImages:0<t()?.images_number,isFirstSite:1===t()?.whitelist?.length}})),c=localStorage.getItem("optimole_settings_visits");return(0,n.useEffect)((()=>{t(i&&d&&3<=parseInt(c)&&!1!==o&&!0!==o?.firstImpressions)}),[c,o]),(0,n.createElement)(n.Fragment,null,(0,n.createElement)(St,{id:"first-impressions",show:e,onDismiss:()=>r("optml_csat",JSON.stringify({...o,firstImpressions:!0})),strings:{title:optimoleDashboardApp.strings.csat.title,close:optimoleDashboardApp.strings.csat.close},pages:[{showHeader:!0,content:e=>(0,n.createElement)("div",{className:"flex flex-col gap-5 px-8 pb-8"},(0,n.createElement)("div",{className:"font-bold text-lg"},optimoleDashboardApp.strings.csat.heading_one),(0,n.createElement)("div",{className:"flex gap-5"},[1,2,3,4,5].map((t=>(0,n.createElement)(m.Button,{key:t,onClick:()=>e.changeData({score:t},!0),className:"optml__button basis-full justify-center rounded font-bold min-h-40"},t)))),(0,n.createElement)("div",{className:"flex justify-between"},(0,n.createElement)("span",{className:"text-purple-gray text-sm"},optimoleDashboardApp.strings.csat.low),(0,n.createElement)("span",{className:"text-purple-gray text-sm"},optimoleDashboardApp.strings.csat.high)))},{showHeader:!0,content:e=>(0,n.createElement)("div",{className:"flex flex-col gap-5 px-8 pb-8"},(0,n.createElement)("div",{className:"font-bold text-lg"},optimoleDashboardApp.strings.csat.heading_two),(0,n.createElement)(m.TextareaControl,{label:optimoleDashboardApp.strings.csat.heading_two,hideLabelFromVision:!0,value:e.data?.feedback,placeholder:optimoleDashboardApp.strings.csat.feedback_placeholder,onChange:t=>e.changeData({feedback:t})}),(0,n.createElement)("div",{className:"flex justify-end"},(0,n.createElement)("div",{className:"flex gap-2"},(0,n.createElement)(m.Button,{onClick:()=>e.onSubmit(),className:"optml__button basis-full justify-center rounded font-bold min-h-40"},optimoleDashboardApp.strings.csat.skip),(0,n.createElement)(m.Button,{variant:"primary",onClick:()=>e.onSubmit(),className:"optml__button basis-full justify-center rounded font-bold min-h-40"},optimoleDashboardApp.strings.csat.submit))))}]}))};class Dt{constructor(){this.logLevel="error"}static getInstance(){return Dt.instance||(Dt.instance=new Dt),Dt.instance}configure(e){e&&void 0!==e.logLevel&&(this.logLevel=e.logLevel)}logger(e,t){if("debug"===t&&"debug"!==this.logLevel)return;const s=`🧱 Formbricks - ${(new Date).toISOString()} [${t.toUpperCase()}] - ${e}`;"error"===t?console.error(s):console.log(s)}debug(e){this.logger(e,"debug")}error(e){this.logger(e,"error")}}const It=e=>({ok:!0,value:e}),Tt=e=>({ok:!1,error:e}),Mt=e=>(...t)=>{try{return{ok:!0,value:e(...t)}}catch(e){return{ok:!1,error:e}}},Ot=Dt.getInstance(),Ft=class e{constructor(e){this.customized=!1,e?(this.handleError=e,this.customized=!0):this.handleError=e=>Dt.getInstance().error(JSON.stringify(e))}static getInstance(){return e.instance||(e.instance=new e),e.instance}static init(t){this.initialized=!0,e.instance=new e(t)}printStatus(){Ot.debug("Custom error handler: "+(this.customized?"yes":"no"))}handle(e){this.handleError(e)}};Ft.initialized=!1;let Bt=Ft;const zt="formbricks-js";class Pt{constructor(){this.config=null}static getInstance(){return Pt.instance||(Pt.instance=new Pt),Pt.instance}update(e){if(e){const t=new Date((new Date).getTime()+9e5);this.config={...this.config,...e,expiresAt:t},this.saveToLocalStorage()}}get(){if(!this.config)throw new Error("config is null, maybe the init function was not called?");return this.config}loadFromLocalStorage(){if("undefined"!=typeof window){const e=localStorage.getItem(zt);if(e){const t=JSON.parse(e);return t.expiresAt&&new Date(t.expiresAt)<=new Date?Tt(new Error("Config in local storage has expired")):It(JSON.parse(e))}}return Tt(new Error("No or invalid config in local storage"))}saveToLocalStorage(){return Mt((()=>localStorage.setItem(zt,JSON.stringify(this.config))))()}resetConfig(){return this.config=null,Mt((()=>localStorage.removeItem(zt)))()}}const Rt=e=>({ok:!1,error:e});async function qt(e,t,s,n){const r=new URL(t,e),a=JSON.stringify(n),o=(i=fetch,(...e)=>{try{return{ok:!0,data:i(...e)}}catch(e){return{ok:!1,error:e}}})(r.toString(),{method:s,headers:{"Content-Type":"application/json"},body:a});var i;if(!1===o.ok)return Rt(o.error);const l=await o.data,{data:d}=await l.json();return l.ok?(e=>({ok:!0,data:e}))(d):Rt({code:"network_error",message:l.statusText,status:l.status,url:r})}class Zt{constructor(e,t){this.apiHost=e,this.environmentId=t}async create(e){return qt(this.apiHost,`/api/v1/client/${this.environmentId}/responses`,"POST",e)}async update({responseId:e,finished:t,data:s,ttc:n}){return qt(this.apiHost,`/api/v1/client/${this.environmentId}/responses/${e}`,"PUT",{finished:t,data:s,ttc:n})}}class Ht{constructor(e,t){this.apiHost=e,this.environmentId=t}async create(e){return qt(this.apiHost,`/api/v1/client/${this.environmentId}/displays`,"POST",e)}async update(e,t){return qt(this.apiHost,`/api/v1/client/${this.environmentId}/displays/${e}`,"PUT",t)}}class Ut{constructor(e,t){this.apiHost=e,this.environmentId=t}async create(e){return qt(this.apiHost,`/api/v1/client/${this.environmentId}/actions`,"POST",e)}}class $t{constructor(e,t){this.apiHost=e,this.environmentId=t}async create(e){return qt(this.apiHost,`/api/v1/client/${this.environmentId}/people`,"POST",{environmentId:this.environmentId,userId:e})}async update(e,t){return qt(this.apiHost,`/api/v1/client/${this.environmentId}/people/${e}`,"POST",t)}}class Vt{constructor(e,t){this.apiHost=e,this.environmentId=t}async uploadFile(e,{allowedFileExtensions:t,surveyId:s}={}){if(!(e instanceof Blob&&e instanceof File))throw new Error("Invalid file type. Expected Blob or File, but received "+typeof e);const n={fileName:e.name,fileType:e.type,allowedFileExtensions:t,surveyId:s},r=await fetch(`${this.apiHost}/api/v1/client/${this.environmentId}/storage`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!r.ok)throw new Error(`Upload failed with status: ${r.status}`);const a=await r.json(),{data:o}=a,{signedUrl:i,fileUrl:l,signingData:d,presignedFields:c}=o;let u={};if(d){const{signature:t,timestamp:n,uuid:r}=d;u={"X-File-Type":e.type,"X-File-Name":encodeURIComponent(e.name),"X-Survey-ID":s??"","X-Signature":t,"X-Timestamp":String(n),"X-UUID":r}}const p=new FormData;c&&Object.keys(c).forEach((e=>{p.append(e,c[e])})),p.append("file",e);const m=await fetch(i,{method:"POST",...d?{headers:u}:{},body:p});if(!m.ok){const e=await m.json();throw new Error(`${e.message}`)}return l}}class Wt{constructor(e){const{apiHost:t,environmentId:s}=e;this.response=new Zt(t,s),this.display=new Ht(t,s),this.action=new Ut(t,s),this.people=new $t(t,s),this.storage=new Vt(t,s)}}class Kt{constructor(e){this.client=new Wt(e)}}class Qt{constructor(e,t){this.queue=[],this.isRequestInProgress=!1,this.config=e,this.surveyState=t,this.api=new Kt({apiHost:e.apiHost,environmentId:e.environmentId})}add(e){this.surveyState.accumulateResponse(e),this.config.setSurveyState&&this.config.setSurveyState(this.surveyState),this.queue.push(e),this.processQueue()}async processQueue(){if(this.isRequestInProgress)return;if(0===this.queue.length)return;this.isRequestInProgress=!0;const e=this.queue[0];let t=0;for(;t<this.config.retryAttempts;){if(await this.sendResponse(e)){this.queue.shift();break}console.error("Formbricks: Failed to send response. Retrying...",t),t++}t>=this.config.retryAttempts&&(console.error("Failed to send response after 2 attempts."),this.surveyState.responseAcc.finished&&this.config.onResponseSendingFailed&&this.config.onResponseSendingFailed(this.surveyState.responseAcc),this.queue.shift()),this.isRequestInProgress=!1,this.processQueue()}async sendResponse(e){try{if(null!==this.surveyState.responseId)await this.api.client.response.update({...e,responseId:this.surveyState.responseId});else{const t=await this.api.client.response.create({...e,surveyId:this.surveyState.surveyId,userId:this.surveyState.userId||null,singleUseId:this.surveyState.singleUseId||null});if(!t.ok)throw new Error("Could not create response");this.surveyState.displayId&&await this.api.client.display.update(this.surveyState.displayId,{responseId:t.data.id}),this.surveyState.updateResponseId(t.data.id),this.config.setSurveyState&&this.config.setSurveyState(this.surveyState)}return!0}catch(e){return console.error(e),!1}}updateSurveyState(e){this.surveyState=e}}class Gt{constructor(e,t,s,n){this.responseId=null,this.displayId=null,this.userId=null,this.responseAcc={finished:!1,data:{},ttc:{}},this.surveyId=e,this.userId=n??null,this.singleUseId=t??null,this.responseId=s??null}setSurveyId(e){this.surveyId=e,this.clear()}copy(){const e=new Gt(this.surveyId,this.singleUseId??void 0,this.responseId??void 0,this.userId??void 0);return e.responseId=this.responseId,e.responseAcc=this.responseAcc,e}updateResponseId(e){this.responseId=e}updateDisplayId(e){this.displayId=e}updateUserId(e){this.userId=e}accumulateResponse(e){this.responseAcc={finished:e.finished,ttc:e.ttc,data:{...this.responseAcc.data,...e.data}}}isResponseFinished(){return this.responseAcc.finished}clear(){this.responseId=null,this.responseAcc={finished:!1,data:{},ttc:{}}}}const Yt=Gt;var Jt,Xt,es,ts,ss,ns,rs,as={},os=[],is=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,ls=Array.isArray;function ds(e,t){for(var s in t)e[s]=t[s];return e}function cs(e){var t=e.parentNode;t&&t.removeChild(e)}function us(e,t,s){var n,r,a,o={};for(a in t)"key"==a?n=t[a]:"ref"==a?r=t[a]:o[a]=t[a];if(arguments.length>2&&(o.children=arguments.length>3?Jt.call(arguments,2):s),"function"==typeof e&&null!=e.defaultProps)for(a in e.defaultProps)void 0===o[a]&&(o[a]=e.defaultProps[a]);return ps(e,o,n,r,null)}function ps(e,t,s,n,r){var a={type:e,props:t,key:s,ref:n,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:null==r?++es:r,__i:-1,__u:0};return null==r&&null!=Xt.vnode&&Xt.vnode(a),a}function ms(e){return e.children}function hs(e,t){this.props=e,this.context=t}function gs(e,t){if(null==t)return e.__?gs(e.__,e.__i+1):null;for(var s;t<e.__k.length;t++)if(null!=(s=e.__k[t])&&null!=s.__e)return s.__e;return"function"==typeof e.type?gs(e):null}function fs(e){var t,s;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(s=e.__k[t])&&null!=s.__e){e.__e=e.__c.base=s.__e;break}return fs(e)}}function bs(e){(!e.__d&&(e.__d=!0)&&ts.push(e)&&!_s.__r++||ss!==Xt.debounceRendering)&&((ss=Xt.debounceRendering)||ns)(_s)}function _s(){var e,t,s,n,r,a,o,i,l;for(ts.sort(rs);e=ts.shift();)e.__d&&(t=ts.length,n=void 0,a=(r=(s=e).__v).__e,i=[],l=[],(o=s.__P)&&((n=ds({},r)).__v=r.__v+1,Xt.vnode&&Xt.vnode(n),As(o,n,r,s.__n,void 0!==o.ownerSVGElement,32&r.__u?[a]:null,i,null==a?gs(r):a,!!(32&r.__u),l),n.__.__k[n.__i]=n,js(i,n,l),n.__e!=a&&fs(n)),ts.length>t&&ts.sort(rs));_s.__r=0}function vs(e,t,s,n,r,a,o,i,l,d,c){var u,p,m,h,g,f=n&&n.__k||os,b=t.length;for(s.__d=l,function(e,t,s){var n,r,a,o,i,l=t.length,d=s.length,c=d,u=0;for(e.__k=[],n=0;n<l;n++)null!=(r=e.__k[n]=null==(r=t[n])||"boolean"==typeof r||"function"==typeof r?null:"string"==typeof r||"number"==typeof r||"bigint"==typeof r||r.constructor==String?ps(null,r,null,null,r):ls(r)?ps(ms,{children:r},null,null,null):r.__b>0?ps(r.type,r.props,r.key,r.ref?r.ref:null,r.__v):r)?(r.__=e,r.__b=e.__b+1,i=xs(r,s,o=n+u,c),r.__i=i,a=null,-1!==i&&(c--,(a=s[i])&&(a.__u|=131072)),null==a||null===a.__v?(-1==i&&u--,"function"!=typeof r.type&&(r.__u|=65536)):i!==o&&(i===o+1?u++:i>o?c>l-o?u+=i-o:u--:u=i<o&&i==o-1?i-o:0,i!==n+u&&(r.__u|=65536))):(a=s[n])&&null==a.key&&a.__e&&(a.__e==e.__d&&(e.__d=gs(a)),Ls(a,a,!1),s[n]=null,c--);if(c)for(n=0;n<d;n++)null!=(a=s[n])&&0==(131072&a.__u)&&(a.__e==e.__d&&(e.__d=gs(a)),Ls(a,a))}(s,t,f),l=s.__d,u=0;u<b;u++)null!=(m=s.__k[u])&&"boolean"!=typeof m&&"function"!=typeof m&&(p=-1===m.__i?as:f[m.__i]||as,m.__i=u,As(e,m,p,r,a,o,i,l,d,c),h=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&Ns(p.ref,null,m),c.push(m.ref,m.__c||h,m)),null==g&&null!=h&&(g=h),65536&m.__u||p.__k===m.__k?l=ys(m,l,e):"function"==typeof m.type&&void 0!==m.__d?l=m.__d:h&&(l=h.nextSibling),m.__d=void 0,m.__u&=-196609);s.__d=l,s.__e=g}function ys(e,t,s){var n,r;if("function"==typeof e.type){for(n=e.__k,r=0;n&&r<n.length;r++)n[r]&&(n[r].__=e,t=ys(n[r],t,s));return t}return e.__e!=t&&(s.insertBefore(e.__e,t||null),t=e.__e),t&&t.nextSibling}function ws(e,t){return t=t||[],null==e||"boolean"==typeof e||(ls(e)?e.some((function(e){ws(e,t)})):t.push(e)),t}function xs(e,t,s,n){var r=e.key,a=e.type,o=s-1,i=s+1,l=t[s];if(null===l||l&&r==l.key&&a===l.type)return s;if(n>(null!=l&&0==(131072&l.__u)?1:0))for(;o>=0||i<t.length;){if(o>=0){if((l=t[o])&&0==(131072&l.__u)&&r==l.key&&a===l.type)return o;o--}if(i<t.length){if((l=t[i])&&0==(131072&l.__u)&&r==l.key&&a===l.type)return i;i++}}return-1}function ks(e,t,s){"-"===t[0]?e.setProperty(t,null==s?"":s):e[t]=null==s?"":"number"!=typeof s||is.test(t)?s:s+"px"}function Es(e,t,s,n,r){var a;e:if("style"===t)if("string"==typeof s)e.style.cssText=s;else{if("string"==typeof n&&(e.style.cssText=n=""),n)for(t in n)s&&t in s||ks(e.style,t,"");if(s)for(t in s)n&&s[t]===n[t]||ks(e.style,t,s[t])}else if("o"===t[0]&&"n"===t[1])a=t!==(t=t.replace(/(PointerCapture)$|Capture$/,"$1")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+a]=s,s?n?s.u=n.u:(s.u=Date.now(),e.addEventListener(t,a?Ss:Cs,a)):e.removeEventListener(t,a?Ss:Cs,a);else{if(r)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!==t&&"height"!==t&&"href"!==t&&"list"!==t&&"form"!==t&&"tabIndex"!==t&&"download"!==t&&"rowSpan"!==t&&"colSpan"!==t&&"role"!==t&&t in e)try{e[t]=null==s?"":s;break e}catch(e){}"function"==typeof s||(null==s||!1===s&&"-"!==t[4]?e.removeAttribute(t):e.setAttribute(t,s))}}function Cs(e){var t=this.l[e.type+!1];if(e.t){if(e.t<=t.u)return}else e.t=Date.now();return t(Xt.event?Xt.event(e):e)}function Ss(e){return this.l[e.type+!0](Xt.event?Xt.event(e):e)}function As(e,t,s,n,r,a,o,i,l,d){var c,u,p,m,h,g,f,b,_,v,y,w,x,k,E,C=t.type;if(void 0!==t.constructor)return null;128&s.__u&&(l=!!(32&s.__u),a=[i=t.__e=s.__e]),(c=Xt.__b)&&c(t);e:if("function"==typeof C)try{if(b=t.props,_=(c=C.contextType)&&n[c.__c],v=c?_?_.props.value:c.__:n,s.__c?f=(u=t.__c=s.__c).__=u.__E:("prototype"in C&&C.prototype.render?t.__c=u=new C(b,v):(t.__c=u=new hs(b,v),u.constructor=C,u.render=Ds),_&&_.sub(u),u.props=b,u.state||(u.state={}),u.context=v,u.__n=n,p=u.__d=!0,u.__h=[],u._sb=[]),null==u.__s&&(u.__s=u.state),null!=C.getDerivedStateFromProps&&(u.__s==u.state&&(u.__s=ds({},u.__s)),ds(u.__s,C.getDerivedStateFromProps(b,u.__s))),m=u.props,h=u.state,u.__v=t,p)null==C.getDerivedStateFromProps&&null!=u.componentWillMount&&u.componentWillMount(),null!=u.componentDidMount&&u.__h.push(u.componentDidMount);else{if(null==C.getDerivedStateFromProps&&b!==m&&null!=u.componentWillReceiveProps&&u.componentWillReceiveProps(b,v),!u.__e&&(null!=u.shouldComponentUpdate&&!1===u.shouldComponentUpdate(b,u.__s,v)||t.__v===s.__v)){for(t.__v!==s.__v&&(u.props=b,u.state=u.__s,u.__d=!1),t.__e=s.__e,t.__k=s.__k,t.__k.forEach((function(e){e&&(e.__=t)})),y=0;y<u._sb.length;y++)u.__h.push(u._sb[y]);u._sb=[],u.__h.length&&o.push(u);break e}null!=u.componentWillUpdate&&u.componentWillUpdate(b,u.__s,v),null!=u.componentDidUpdate&&u.__h.push((function(){u.componentDidUpdate(m,h,g)}))}if(u.context=v,u.props=b,u.__P=e,u.__e=!1,w=Xt.__r,x=0,"prototype"in C&&C.prototype.render){for(u.state=u.__s,u.__d=!1,w&&w(t),c=u.render(u.props,u.state,u.context),k=0;k<u._sb.length;k++)u.__h.push(u._sb[k]);u._sb=[]}else do{u.__d=!1,w&&w(t),c=u.render(u.props,u.state,u.context),u.state=u.__s}while(u.__d&&++x<25);u.state=u.__s,null!=u.getChildContext&&(n=ds(ds({},n),u.getChildContext())),p||null==u.getSnapshotBeforeUpdate||(g=u.getSnapshotBeforeUpdate(m,h)),vs(e,ls(E=null!=c&&c.type===ms&&null==c.key?c.props.children:c)?E:[E],t,s,n,r,a,o,i,l,d),u.base=t.__e,t.__u&=-161,u.__h.length&&o.push(u),f&&(u.__E=u.__=null)}catch(e){t.__v=null,l||null!=a?(t.__e=i,t.__u|=l?160:32,a[a.indexOf(i)]=null):(t.__e=s.__e,t.__k=s.__k),Xt.__e(e,t,s)}else null==a&&t.__v===s.__v?(t.__k=s.__k,t.__e=s.__e):t.__e=function(e,t,s,n,r,a,o,i,l){var d,c,u,p,m,h,g,f=s.props,b=t.props,_=t.type;if("svg"===_&&(r=!0),null!=a)for(d=0;d<a.length;d++)if((m=a[d])&&"setAttribute"in m==!!_&&(_?m.localName===_:3===m.nodeType)){e=m,a[d]=null;break}if(null==e){if(null===_)return document.createTextNode(b);e=r?document.createElementNS("http://www.w3.org/2000/svg",_):document.createElement(_,b.is&&b),a=null,i=!1}if(null===_)f===b||i&&e.data===b||(e.data=b);else{if(a=a&&Jt.call(e.childNodes),f=s.props||as,!i&&null!=a)for(f={},d=0;d<e.attributes.length;d++)f[(m=e.attributes[d]).name]=m.value;for(d in f)m=f[d],"children"==d||("dangerouslySetInnerHTML"==d?u=m:"key"===d||d in b||Es(e,d,null,m,r));for(d in b)m=b[d],"children"==d?p=m:"dangerouslySetInnerHTML"==d?c=m:"value"==d?h=m:"checked"==d?g=m:"key"===d||i&&"function"!=typeof m||f[d]===m||Es(e,d,m,f[d],r);if(c)i||u&&(c.__html===u.__html||c.__html===e.innerHTML)||(e.innerHTML=c.__html),t.__k=[];else if(u&&(e.innerHTML=""),vs(e,ls(p)?p:[p],t,s,n,r&&"foreignObject"!==_,a,o,a?a[0]:s.__k&&gs(s,0),i,l),null!=a)for(d=a.length;d--;)null!=a[d]&&cs(a[d]);i||(d="value",void 0!==h&&(h!==e[d]||"progress"===_&&!h||"option"===_&&h!==f[d])&&Es(e,d,h,f[d],!1),d="checked",void 0!==g&&g!==e[d]&&Es(e,d,g,f[d],!1))}return e}(s.__e,t,s,n,r,a,o,l,d);(c=Xt.diffed)&&c(t)}function js(e,t,s){t.__d=void 0;for(var n=0;n<s.length;n++)Ns(s[n],s[++n],s[++n]);Xt.__c&&Xt.__c(t,e),e.some((function(t){try{e=t.__h,t.__h=[],e.some((function(e){e.call(t)}))}catch(e){Xt.__e(e,t.__v)}}))}function Ns(e,t,s){try{"function"==typeof e?e(t):e.current=t}catch(e){Xt.__e(e,s)}}function Ls(e,t,s){var n,r;if(Xt.unmount&&Xt.unmount(e),(n=e.ref)&&(n.current&&n.current!==e.__e||Ns(n,null,t)),null!=(n=e.__c)){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(e){Xt.__e(e,t)}n.base=n.__P=null,e.__c=void 0}if(n=e.__k)for(r=0;r<n.length;r++)n[r]&&Ls(n[r],t,s||"function"!=typeof e.type);s||null==e.__e||cs(e.__e),e.__=e.__e=e.__d=void 0}function Ds(e,t,s){return this.constructor(e,s)}Jt=os.slice,Xt={__e:function(e,t,s,n){for(var r,a,o;t=t.__;)if((r=t.__c)&&!r.__)try{if((a=r.constructor)&&null!=a.getDerivedStateFromError&&(r.setState(a.getDerivedStateFromError(e)),o=r.__d),null!=r.componentDidCatch&&(r.componentDidCatch(e,n||{}),o=r.__d),o)return r.__E=r}catch(t){e=t}throw e}},es=0,hs.prototype.setState=function(e,t){var s;s=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=ds({},this.state),"function"==typeof e&&(e=e(ds({},s),this.props)),e&&ds(s,e),null!=e&&this.__v&&(t&&this._sb.push(t),bs(this))},hs.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),bs(this))},hs.prototype.render=ms,ts=[],ns="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,rs=function(e,t){return e.__v.__b-t.__v.__b},_s.__r=0;var Is=0;function Ts(e,t,s,n,r,a){var o,i,l={};for(i in t)"ref"==i?o=t[i]:l[i]=t[i];var d={type:e,props:l,key:s,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--Is,__i:-1,__u:0,__source:r,__self:a};if("function"==typeof e&&(o=e.defaultProps))for(i in o)void 0===l[i]&&(l[i]=o[i]);return Xt.vnode&&Xt.vnode(d),d}function Ms(){return Ts("a",{href:"https://formbricks.com?utm_source=survey_branding",target:"_blank",tabIndex:-1,className:"mb-5 mt-2 flex justify-center",children:Ts("p",{className:"text-signature text-xs",children:["Powered by"," ",Ts("b",{children:Ts("span",{className:"text-info-text hover:text-heading",children:"Formbricks"})})]})})}var Os,Fs,Bs,zs,Ps=0,Rs=[],qs=[],Zs=Xt.__b,Hs=Xt.__r,Us=Xt.diffed,$s=Xt.__c,Vs=Xt.unmount;function Ws(e,t){Xt.__h&&Xt.__h(Fs,e,Ps||t),Ps=0;var s=Fs.__H||(Fs.__H={__:[],__h:[]});return e>=s.__.length&&s.__.push({__V:qs}),s.__[e]}function Ks(e){return Ps=1,function(e,t,s){var n=Ws(Os++,2);if(n.t=e,!n.__c&&(n.__=[an(void 0,t),function(e){var t=n.__N?n.__N[0]:n.__[0],s=n.t(t,e);t!==s&&(n.__N=[s,n.__[1]],n.__c.setState({}))}],n.__c=Fs,!Fs.u)){var r=function(e,t,s){if(!n.__c.__H)return!0;var r=n.__c.__H.__.filter((function(e){return e.__c}));if(r.every((function(e){return!e.__N})))return!a||a.call(this,e,t,s);var o=!1;return r.forEach((function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(o=!0)}})),!(!o&&n.__c.props===e)&&(!a||a.call(this,e,t,s))};Fs.u=!0;var a=Fs.shouldComponentUpdate,o=Fs.componentWillUpdate;Fs.componentWillUpdate=function(e,t,s){if(this.__e){var n=a;a=void 0,r(e,t,s),a=n}o&&o.call(this,e,t,s)},Fs.shouldComponentUpdate=r}return n.__N||n.__}(an,e)}function Qs(e,t){var s=Ws(Os++,3);!Xt.__s&&rn(s.__H,t)&&(s.__=e,s.i=t,Fs.__H.__h.push(s))}function Gs(e){return Ps=5,Ys((function(){return{current:e}}),[])}function Ys(e,t){var s=Ws(Os++,7);return rn(s.__H,t)?(s.__V=e(),s.i=t,s.__h=e,s.__V):s.__}function Js(e,t){return Ps=8,Ys((function(){return e}),t)}function Xs(){for(var e;e=Rs.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(sn),e.__H.__h.forEach(nn),e.__H.__h=[]}catch(t){e.__H.__h=[],Xt.__e(t,e.__v)}}Xt.__b=function(e){Fs=null,Zs&&Zs(e)},Xt.__r=function(e){Hs&&Hs(e),Os=0;var t=(Fs=e.__c).__H;t&&(Bs===Fs?(t.__h=[],Fs.__h=[],t.__.forEach((function(e){e.__N&&(e.__=e.__N),e.__V=qs,e.__N=e.i=void 0}))):(t.__h.forEach(sn),t.__h.forEach(nn),t.__h=[],Os=0)),Bs=Fs},Xt.diffed=function(e){Us&&Us(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==Rs.push(t)&&zs===Xt.requestAnimationFrame||((zs=Xt.requestAnimationFrame)||tn)(Xs)),t.__H.__.forEach((function(e){e.i&&(e.__H=e.i),e.__V!==qs&&(e.__=e.__V),e.i=void 0,e.__V=qs}))),Bs=Fs=null},Xt.__c=function(e,t){t.some((function(e){try{e.__h.forEach(sn),e.__h=e.__h.filter((function(e){return!e.__||nn(e)}))}catch(s){t.some((function(e){e.__h&&(e.__h=[])})),t=[],Xt.__e(s,e.__v)}})),$s&&$s(e,t)},Xt.unmount=function(e){Vs&&Vs(e);var t,s=e.__c;s&&s.__H&&(s.__H.__.forEach((function(e){try{sn(e)}catch(e){t=e}})),s.__H=void 0,t&&Xt.__e(t,s.__v))};var en="function"==typeof requestAnimationFrame;function tn(e){var t,s=function(){clearTimeout(n),en&&cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(s,100);en&&(t=requestAnimationFrame(s))}function sn(e){var t=Fs,s=e.__c;"function"==typeof s&&(e.__c=void 0,s()),Fs=t}function nn(e){var t=Fs;e.__c=e.__(),Fs=t}function rn(e,t){return!e||e.length!==t.length||t.some((function(t,s){return t!==e[s]}))}function an(e,t){return"function"==typeof t?t(e):t}function on({progress:e}){return Ts("div",{className:"bg-accent-bg h-2 w-full rounded-full",children:Ts("div",{className:"transition-width bg-brand z-20 h-2 rounded-full duration-500",style:{width:`${Math.floor(100*e)}%`}})})}function ln({survey:e,onClose:t,children:s}){const[n,r]=Ks(100),[a,o]=Ks(!1),i=Gs(performance.now()),l=Gs(null),d=()=>{null!==l.current&&(o(!0),cancelAnimationFrame(l.current),l.current=null)};return Qs((()=>{if(!e.autoClose)return;const s=()=>{const n=1e3*e.autoClose,a=performance.now()-i.current,o=Math.max(0,n-a);r(o/n),o>0?l.current=requestAnimationFrame(s):(d(),t())};return r(1),l.current=requestAnimationFrame(s),()=>d()}),[e.autoClose,t]),Ts(ms,{children:[!a&&e.autoClose&&Ts(on,{progress:n}),Ts("div",{onClick:d,onMouseOver:d,className:"h-full w-full",children:s})]})}function dn(e,t){switch(e.condition){case"equals":return Array.isArray(t)&&1===t.length&&t.includes(e.value)||(null==t?void 0:t.toString())===e.value;case"notEquals":return t!==e.value;case"lessThan":return void 0!==e.value&&t<e.value;case"lessEqual":return void 0!==e.value&&t<=e.value;case"greaterThan":return void 0!==e.value&&t>e.value;case"greaterEqual":return void 0!==e.value&&t>=e.value;case"includesAll":return Array.isArray(t)&&Array.isArray(e.value)&&e.value.every((e=>t.includes(e)));case"includesOne":return Array.isArray(t)&&Array.isArray(e.value)&&e.value.some((e=>t.includes(e)));case"accepted":return"accepted"===t;case"clicked":return"clicked"===t;case"submitted":return"string"==typeof t?"dismissed"!==t&&""!==t&&null!==t:Array.isArray(t)?t.length>0:"number"==typeof t&&null!==t;case"skipped":return Array.isArray(t)&&0===t.length||""===t||null==t||"dismissed"===t;case"uploaded":return Array.isArray(t)?t.length>0:"skipped"!==t&&""!==t&&null!==t;case"notUploaded":return Array.isArray(t)&&0===t.length||""===t||null===t||"skipped"===t;default:return!1}}const cn=(...e)=>e.filter(Boolean).join(" "),un=e=>{for(let t=0;t<e.length;t++){const s=Math.floor(Math.random()*(t+1));[e[t],e[s]]=[e[s],e[t]]}},pn=(e,t)=>{const s=[...e],n=s.findIndex((e=>"other"===e.id)),r=-1!==n?s.splice(n,1)[0]:null;if("all"===t)un(s);else if("exceptLast"===t){const e=s.pop();un(s),s.push(e)}return r&&s.push(r),s},mn=(e,t)=>{var s;const n=e.questions[t],r=e.questions.length,a=Math.floor(r/2),o=(null==(s=null==n?void 0:n.logic)?void 0:s.map((e=>e.destination)))||[];let i=t||.5;const l=(()=>{const t=e.questions.filter((e=>o.includes(e.id))).sort(((t,s)=>e.questions.indexOf(t)-e.questions.indexOf(s))).pop();return e.questions.findIndex((e=>e.id===(null==t?void 0:t.id)))})();return l>0&&(i=Math.min(a,l-1)),o.includes("end")&&(i=a),i};function hn({onClick:e,backButtonLabel:t,tabIndex:s=2}){return Ts("button",{tabIndex:s,type:"button",className:cn("border-back-button-border text-heading focus:ring-focus flex items-center rounded-md border px-3 py-3 text-base font-medium leading-4 shadow-sm hover:opacity-90 focus:outline-none focus:ring-2 focus:ring-offset-2"),onClick:e,children:t||"Back"})}function gn({buttonLabel:e,isLastQuestion:t,onClick:s,tabIndex:n=1,focus:r=!1,type:a="submit"}){return Ts("button",{ref:Js((e=>{e&&r&&setTimeout((()=>{e.focus()}),200)}),[r]),type:a,tabIndex:n,autoFocus:r,className:"bg-brand border-submit-button-border text-on-brand focus:ring-focus flex items-center rounded-md border px-3 py-3 text-base font-medium leading-4 shadow-sm hover:opacity-90 focus:outline-none focus:ring-2 focus:ring-offset-2",onClick:s,children:e||(t?"Finish":"Next")})}function fn({imgUrl:e,altText:t="Image"}){return Ts("div",{className:"mb-4 rounded-md",children:Ts("img",{src:e,alt:t,className:"mb-4 rounded-md"})})}function bn({headline:e,questionId:t,required:s=!0,alignTextCenter:n=!1}){return Ts("label",{htmlFor:t,className:"text-heading mb-1.5 block text-base font-semibold leading-6",children:Ts("div",{className:"flex items-center "+(n?"justify-center":"mr-[3ch] justify-between"),children:[e,!s&&Ts("span",{className:"text-info-text self-start\ttext-sm font-normal leading-7",tabIndex:-1,children:"Optional"})]})})}function vn(e){function t(e,t){let s=t.replace(/\s+/g,"").toLowerCase();return!(!["src","href","xlink:href"].includes(e)||!s.includes("javascript:")&&!s.includes("data:"))||!!e.startsWith("on")}function s(e){let s=e.attributes;for(let{name:n,value:r}of s)t(n,r)&&e.removeAttribute(n)}let n=(new DOMParser).parseFromString(e,"text/html").body||document.createElement("body");return function(e){let t=e.querySelectorAll("script");for(let e of t)e.remove()}(n),function e(t){let n=t.children;for(let t of n)s(t),e(t)}(n),n.innerHTML}function yn({htmlString:e,questionId:t}){return e?Ts("label",{htmlFor:t,className:"fb-htmlbody",dangerouslySetInnerHTML:{__html:vn(e)}}):null}function wn(e,t){for(var s in e)if("__source"!==s&&!(s in t))return!0;for(var n in t)if("__source"!==n&&e[n]!==t[n])return!0;return!1}function xn(e){this.props=e}(xn.prototype=new hs).isPureReactComponent=!0,xn.prototype.shouldComponentUpdate=function(e,t){return wn(this.props,e)||wn(this.state,t)};var kn=Xt.__b;Xt.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),kn&&kn(e)};var En=Xt.__e;Xt.__e=function(e,t,s,n){if(e.then)for(var r,a=t;a=a.__;)if((r=a.__c)&&r.__c)return null==t.__e&&(t.__e=s.__e,t.__k=s.__k),r.__c(e,t);En(e,t,s,n)};var Cn=Xt.unmount;function Sn(e,t,s){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach((function(e){"function"==typeof e.__c&&e.__c()})),e.__c.__H=null),null!=(e=function(e,t){for(var s in t)e[s]=t[s];return e}({},e)).__c&&(e.__c.__P===s&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map((function(e){return Sn(e,t,s)}))),e}function An(e,t,s){return e&&s&&(e.__v=null,e.__k=e.__k&&e.__k.map((function(e){return An(e,t,s)})),e.__c&&e.__c.__P===t&&(e.__e&&s.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=s)),e}function jn(){this.__u=0,this.t=null,this.__b=null}function Nn(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function Ln(){this.u=null,this.o=null}Xt.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),Cn&&Cn(e)},(jn.prototype=new hs).__c=function(e,t){var s=t.__c,n=this;null==n.t&&(n.t=[]),n.t.push(s);var r=Nn(n.__v),a=!1,o=function(){a||(a=!0,s.__R=null,r?r(i):i())};s.__R=o;var i=function(){if(!--n.__u){if(n.state.__a){var e=n.state.__a;n.__v.__k[0]=An(e,e.__c.__P,e.__c.__O)}var t;for(n.setState({__a:n.__b=null});t=n.t.pop();)t.forceUpdate()}};n.__u++||32&t.__u||n.setState({__a:n.__b=n.__v.__k[0]}),e.then(o,o)},jn.prototype.componentWillUnmount=function(){this.t=[]},jn.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var s=document.createElement("div"),n=this.__v.__k[0].__c;this.__v.__k[0]=Sn(this.__b,s,n.__O=n.__P)}this.__b=null}var r=t.__a&&us(ms,null,e.fallback);return r&&(r.__u&=-33),[us(ms,null,t.__a?null:e.children),r]};var Dn=function(e,t,s){if(++s[1]===s[0]&&e.o.delete(t),e.props.revealOrder&&("t"!==e.props.revealOrder[0]||!e.o.size))for(s=e.u;s;){for(;s.length>3;)s.pop()();if(s[1]<s[0])break;e.u=s=s[2]}};(Ln.prototype=new hs).__a=function(e){var t=this,s=Nn(t.__v),n=t.o.get(e);return n[0]++,function(r){var a=function(){t.props.revealOrder?(n.push(r),Dn(t,e,n)):r()};s?s(a):a()}},Ln.prototype.render=function(e){this.u=null,this.o=new Map;var t=ws(e.children);e.revealOrder&&"b"===e.revealOrder[0]&&t.reverse();for(var s=t.length;s--;)this.o.set(t[s],this.u=[1,0,this.u]);return e.children},Ln.prototype.componentDidUpdate=Ln.prototype.componentDidMount=function(){var e=this;this.o.forEach((function(t,s){Dn(e,s,t)}))};var In="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,Tn=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,Mn=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,On=/[A-Z0-9]/g,Fn="undefined"!=typeof document,Bn=function(e){return("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(e)};hs.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach((function(e){Object.defineProperty(hs.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})}));var zn=Xt.event;function Pn(){}function Rn(){return this.cancelBubble}function qn(){return this.defaultPrevented}Xt.event=function(e){return zn&&(e=zn(e)),e.persist=Pn,e.isPropagationStopped=Rn,e.isDefaultPrevented=qn,e.nativeEvent=e};var Zn={enumerable:!1,configurable:!0,get:function(){return this.class}},Hn=Xt.vnode;Xt.vnode=function(e){"string"==typeof e.type&&function(e){var t=e.props,s=e.type,n={};for(var r in t){var a=t[r];if(!("value"===r&&"defaultValue"in t&&null==a||Fn&&"children"===r&&"noscript"===s||"class"===r||"className"===r)){var o=r.toLowerCase();"defaultValue"===r&&"value"in t&&null==t.value?r="value":"download"===r&&!0===a?a="":"ondoubleclick"===o?r="ondblclick":"onchange"!==o||"input"!==s&&"textarea"!==s||Bn(t.type)?"onfocus"===o?r="onfocusin":"onblur"===o?r="onfocusout":Mn.test(r)?r=o:-1===s.indexOf("-")&&Tn.test(r)?r=r.replace(On,"-$&").toLowerCase():null===a&&(a=void 0):o=r="oninput","oninput"===o&&n[r=o]&&(r="oninputCapture"),n[r]=a}}"select"==s&&n.multiple&&Array.isArray(n.value)&&(n.value=ws(t.children).forEach((function(e){e.props.selected=-1!=n.value.indexOf(e.props.value)}))),"select"==s&&null!=n.defaultValue&&(n.value=ws(t.children).forEach((function(e){e.props.selected=n.multiple?-1!=n.defaultValue.indexOf(e.props.value):n.defaultValue==e.props.value}))),t.class&&!t.className?(n.class=t.class,Object.defineProperty(n,"className",Zn)):(t.className&&!t.class||t.class&&t.className)&&(n.class=n.className=t.className),e.props=n}(e),e.$$typeof=In,Hn&&Hn(e)};var Un=Xt.__r;Xt.__r=function(e){Un&&Un(e),e.__c};var $n=Xt.diffed;Xt.diffed=function(e){$n&&$n(e);var t=e.props,s=e.__e;null!=s&&"textarea"===e.type&&"value"in t&&t.value!==s.value&&(s.value=null==t.value?"":t.value)};const Vn=(e,t,s)=>e.hasOwnProperty(t)?{...e,[t]:e[t]+s}:{...e,[t]:s},Wn=(e,t,s,n,r)=>{Qs((()=>{r(performance.now())}),[e]),Qs((()=>{const a=()=>{if("visible"===document.visibilityState)r(performance.now());else{const r=Vn(t,e,performance.now()-n);s(r)}};return document.addEventListener("visibilitychange",a),()=>{document.removeEventListener("visibilitychange",a)}}),[])};function Kn({question:e,onSubmit:t,onBack:s,isFirstQuestion:n,isLastQuestion:r,ttc:a,setTtc:o}){const[i,l]=Ks(performance.now());return Wn(e.id,a,o,i,l),Ts("div",{children:[e.imageUrl&&Ts(fn,{imgUrl:e.imageUrl}),Ts(bn,{headline:e.headline,questionId:e.id,required:e.required}),Ts(yn,{htmlString:e.html,questionId:e.id}),Ts("div",{className:"mt-4 flex w-full justify-between",children:[!n&&Ts(hn,{backButtonLabel:e.backButtonLabel,onClick:()=>{const n=Vn(a,e.id,performance.now()-i);o(n),t({[e.id]:""},n),s()}}),Ts("div",{className:"flex w-full justify-end",children:[!e.required&&Ts("button",{tabIndex:0,type:"button",onClick:()=>{const s=Vn(a,e.id,performance.now()-i);o(s),t({[e.id]:"dismissed"},s)},className:"text-heading focus:ring-focus mr-4 flex items-center rounded-md px-3 py-3 text-base font-medium leading-4 hover:opacity-90 focus:outline-none focus:ring-2 focus:ring-offset-2",children:e.dismissButtonLabel||"Skip"}),Ts(gn,{buttonLabel:e.buttonLabel,isLastQuestion:r,focus:!0,onClick:()=>{var s;e.buttonExternal&&e.buttonUrl&&(null==(s=null==window?void 0:window.open(e.buttonUrl,"_blank"))||s.focus());const n=Vn(a,e.id,performance.now()-i);o(n),t({[e.id]:"clicked"},n)},type:"button"})]})]})]})}function Qn({question:e,value:t,onChange:s,onSubmit:n,onBack:r,isFirstQuestion:a,isLastQuestion:o,ttc:i,setTtc:l}){const[d,c]=Ks(performance.now());return Wn(e.id,i,l,d,c),Ts("div",{children:[e.imageUrl&&Ts(fn,{imgUrl:e.imageUrl}),Ts(bn,{headline:e.headline,questionId:e.id,required:e.required}),Ts(yn,{htmlString:e.html||"",questionId:e.id}),Ts("form",{onSubmit:s=>{s.preventDefault();const r=Vn(i,e.id,performance.now()-d);l(r),n({[e.id]:t},r)},children:[Ts("label",{tabIndex:1,onKeyDown:t=>{"Enter"==t.key&&s({[e.id]:"accepted"})},className:"border-border bg-survey-bg text-heading hover:bg-accent-bg focus:bg-accent-bg focus:ring-border-highlight relative z-10 mt-4 flex w-full cursor-pointer items-center rounded-md border p-4 text-sm focus:outline-none focus:ring-2 focus:ring-offset-2",children:[Ts("input",{type:"checkbox",id:e.id,name:e.id,value:e.label,onChange:t=>{t.target instanceof HTMLInputElement&&t.target.checked?s({[e.id]:"accepted"}):s({[e.id]:"dismissed"})},checked:"accepted"===t,className:"border-brand text-brand h-4 w-4 border focus:ring-0 focus:ring-offset-0","aria-labelledby":`${e.id}-label`,required:e.required}),Ts("span",{id:`${e.id}-label`,className:"ml-3 font-medium",children:e.label})]}),Ts("div",{className:"mt-4 flex w-full justify-between",children:[!a&&Ts(hn,{tabIndex:3,backButtonLabel:e.backButtonLabel,onClick:()=>{const s=Vn(i,e.id,performance.now()-d);l(s),n({[e.id]:t},s),r()}}),Ts("div",{}),Ts(gn,{tabIndex:2,buttonLabel:e.buttonLabel,isLastQuestion:o,onClick:()=>{}})]})]})]})}function Gn({allowedFileExtensions:e,surveyId:t,onUploadCallback:s,onFileUpload:n,fileUrls:r,maxSizeInMB:a,allowMultipleFiles:o}){const[i,l]=Ks([]),[d,c]=Ks(!1),u=Ys((()=>!(d||!o&&r&&r.length>0)),[o,r,d]);return Ts("div",{className:"items-left relative mt-3 flex w-full cursor-pointer flex-col justify-center rounded-lg border-2 border-dashed border-slate-300 bg-slate-50 hover:bg-slate-100 dark:border-slate-600 dark:bg-slate-700 dark:hover:border-slate-500 dark:hover:bg-slate-800",children:[Ts("div",{children:r&&(null==r?void 0:r.map(((e,t)=>Ts("div",{className:"relative m-2 rounded-md bg-slate-200",children:[Ts("div",{className:"absolute right-0 top-0 m-2",children:Ts("div",{className:"flex h-5 w-5 items-center justify-center rounded-md bg-slate-100 hover:bg-slate-50",children:Ts("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 26 26",strokeWidth:1,stroke:"currentColor",className:"h-5 text-slate-700 hover:text-slate-900",onClick:e=>((e,t)=>{if(t.stopPropagation(),r){const t=[...i];t.splice(e,1),l(t);const n=[...r];n.splice(e,1),s(n)}})(t,e),children:Ts("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 9l10 10m0-10L9 19"})})})}),Ts("div",{className:"flex flex-col items-center justify-center p-2",children:[Ts("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"lucide lucide-file",className:"h-6 text-slate-500",children:[Ts("path",{d:"M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"}),Ts("polyline",{points:"14 2 14 8 20 8"})]}),Ts("p",{className:"mt-1 text-sm text-slate-600 dark:text-slate-400",children:decodeURIComponent(e).split("/").pop()})]})]},t))))}),Ts("div",{children:[d&&Ts("div",{className:"inset-0 flex animate-pulse items-center justify-center rounded-lg bg-slate-100 py-4",children:Ts("label",{htmlFor:"selectedFile",className:"text-sm font-medium text-slate-500",children:"Uploading..."})}),Ts("label",{htmlFor:"selectedFile",onDragOver:e=>(e=>{e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="copy"})(e),onDrop:d=>(async d=>{d.preventDefault(),d.stopPropagation();const u=Array.from(d.dataTransfer.files);if(!o&&u.length>1)alert("Only one file can be uploaded at a time.");else if(u.length>0){const o=u.filter((t=>!(e&&e.length>0)||e.includes(t.type.substring(t.type.lastIndexOf("/")+1))));if(o.length>0){const d=[];for(const s of o)if(a)if((await s.arrayBuffer()).byteLength/1024>1024*a)alert(`File should be less than ${a} MB`);else{c(!0);try{const r=await n(s,{allowedFileExtensions:e,surveyId:t});l([...i,s]),d.push(r)}catch(e){c(!1),"File size exceeds the 10 MB limit"===e.message?alert(e.message):alert("Upload failed! Please try again.")}}else{c(!0);try{const r=await n(s,{allowedFileExtensions:e,surveyId:t});l([...i,s]),d.push(r)}catch(e){c(!1),"File size exceeds the 10 MB limit"===e.message?alert(e.message):alert("Upload failed! Please try again.")}}c(!1),s(r?[...r,...d]:d)}else alert("no selected files are valid")}})(d),children:u&&Ts("div",{className:"flex flex-col items-center justify-center py-6",children:[Ts("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"h-6 text-slate-500",children:Ts("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5m-13.5-9L12 3m0 0l4.5 4.5M12 3v13.5"})}),Ts("p",{className:"mt-2 text-sm text-slate-500 dark:text-slate-400",children:Ts("span",{className:"font-medium",children:"Click or drag to upload files."})}),Ts("input",{type:"file",id:"selectedFile",name:"selectedFile",accept:null==e?void 0:e.map((e=>`.${e}`)).join(","),className:"hidden",onChange:o=>{const d=o.target;d.files&&(async o=>{if(o)if(a)if((await o.arrayBuffer()).byteLength/1024>1024*a)alert(`File should be less than ${a} MB`);else{c(!0);try{const a=await n(o,{allowedFileExtensions:e,surveyId:t});l([...i,o]),c(!1),s(r?[...r,a]:[a])}catch(e){c(!1),"File size exceeds the 10 MB limit"===e.message?alert(e.message):alert("Upload failed! Please try again.")}}else{c(!0);try{const a=await n(o,{allowedFileExtensions:e,surveyId:t});l([...i,o]),c(!1),s(r?[...r,a]:[a])}catch(e){c(!1),"File size exceeds the 10 MB limit"===e.message?alert(e.message):alert("Upload failed! Please try again.")}}else alert("Please select a file")})(d.files[0])}})]})})]})]})}function Yn({subheader:e,questionId:t}){return Ts("label",{htmlFor:t,className:"text-subheading block text-sm font-normal leading-6",children:e})}function Jn({question:e,value:t,onChange:s,onSubmit:n,onBack:r,isFirstQuestion:a,isLastQuestion:o,surveyId:i,onFileUpload:l,ttc:d,setTtc:c}){const[u,p]=Ks(performance.now());return Wn(e.id,d,c,u,p),Ts("form",{onSubmit:s=>{s.preventDefault();const r=Vn(d,e.id,performance.now()-u);c(r),e.required?t&&("string"==typeof t||Array.isArray(t))&&t.length>0?n({[e.id]:"string"==typeof t?[t]:t},r):alert("Please upload a file"):n(t?{[e.id]:"string"==typeof t?[t]:t}:{[e.id]:"skipped"},r)},className:"w-full",children:[Ts(bn,{headline:e.headline,questionId:e.id,required:e.required}),Ts(Yn,{subheader:e.subheader,questionId:e.id}),Ts(Gn,{surveyId:i,onFileUpload:l,onUploadCallback:t=>{s(t?{[e.id]:t}:{[e.id]:"skipped"})},fileUrls:t,allowMultipleFiles:e.allowMultipleFiles,...e.allowedFileExtensions?{allowedFileExtensions:e.allowedFileExtensions}:{},...e.maxSizeInMB?{maxSizeInMB:e.maxSizeInMB}:{}}),Ts("div",{className:"mt-4 flex w-full justify-between",children:[!a&&Ts(hn,{backButtonLabel:e.backButtonLabel,onClick:()=>{r()}}),Ts("div",{}),Ts(gn,{buttonLabel:e.buttonLabel,isLastQuestion:o,onClick:()=>{}})]})]})}function Xn({question:e,value:t,onChange:s,onSubmit:n,onBack:r,isFirstQuestion:a,isLastQuestion:o,ttc:i,setTtc:l}){const[d,c]=Ks(performance.now());Wn(e.id,i,l,d,c);const u=Js((()=>e.choices.filter((e=>"other"!==e.id)).map((e=>e.label))),[e]),[p,m]=Ks(!!t&&(Array.isArray(t)?t:[t]).some((e=>!1===u().includes(e)))),[h,g]=Ks(Array.isArray(t)&&t.filter((t=>!e.choices.find((e=>e.label===t))))[0]||""),f=Ys((()=>{if(!e.choices)return[];const t=e.choices.filter((e=>"other"!==e.id));return e.shuffleOption?pn(t,e.shuffleOption):t}),[e.choices,e.shuffleOption]),b=Ys((()=>e.choices.find((e=>"other"===e.id))),[e.choices]),_=Gs(null);Qs((()=>{var e;p&&(null==(e=_.current)||e.focus())}),[p]);const v=n=>Array.isArray(t)?s({[e.id]:[...t,n]}):s({[e.id]:[n]}),y=n=>Array.isArray(t)?s({[e.id]:t.filter((e=>e!==n))}):s({[e.id]:[]});return Ts("form",{onSubmit:r=>{r.preventDefault();const a=null==t?void 0:t.filter((e=>u().includes(e)||e===h));s({[e.id]:a});const o=Vn(i,e.id,performance.now()-d);l(o),n({[e.id]:t},o)},className:"w-full",children:[e.imageUrl&&Ts(fn,{imgUrl:e.imageUrl}),Ts(bn,{headline:e.headline,questionId:e.id,required:e.required}),Ts(Yn,{subheader:e.subheader,questionId:e.id}),Ts("div",{className:"mt-4",children:Ts("fieldset",{children:[Ts("legend",{className:"sr-only",children:"Options"}),Ts("div",{className:"bg-survey-bg relative max-h-[42vh] space-y-2 overflow-y-auto rounded-md py-0.5 pr-2",children:[f.map(((s,n)=>Ts("label",{tabIndex:n+1,onKeyDown:e=>{"Enter"==e.key&&(Array.isArray(t)&&t.includes(s.label)?y(s.label):v(s.label))},className:cn(t===s.label?"border-border-highlight bg-accent-selected-bg z-10":"border-border","text-heading focus-within:border-border-highlight hover:bg-accent-bg focus:bg-accent-bg relative flex cursor-pointer flex-col rounded-md border p-4 focus:outline-none"),children:Ts("span",{className:"flex items-center text-sm",children:[Ts("input",{type:"checkbox",id:s.id,name:e.id,tabIndex:-1,value:s.label,className:"border-brand text-brand h-4 w-4 border focus:ring-0 focus:ring-offset-0","aria-labelledby":`${s.id}-label`,onChange:e=>{var t;(null==(t=e.target)?void 0:t.checked)?v(s.label):y(s.label)},checked:Array.isArray(t)&&t.includes(s.label),required:!(e.required&&Array.isArray(t)&&t.length)&&e.required}),Ts("span",{id:`${s.id}-label`,className:"ml-3 font-medium",children:s.label})]})},s.id))),b&&Ts("label",{tabIndex:f.length+1,className:cn(t===b.label?"border-border-highlight bg-accent-selected-bg z-10":"border-border","text-heading focus-within:border-border-highlight focus-within:bg-accent-bg hover:bg-accent-bg relative flex cursor-pointer flex-col rounded-md border p-4 focus:outline-none"),onKeyDown:e=>{"Enter"==e.key&&m(!p)},children:[Ts("span",{className:"flex items-center text-sm",children:[Ts("input",{type:"checkbox",tabIndex:-1,id:b.id,name:e.id,value:b.label,className:"border-brand text-brand h-4 w-4 border focus:ring-0 focus:ring-offset-0","aria-labelledby":`${b.id}-label`,onChange:e=>{var t;if(m(!p),null==(t=e.target)?void 0:t.checked){if(!h)return;v(h)}else y(h)},checked:p}),Ts("span",{id:`${b.id}-label`,className:"ml-3 font-medium",children:b.label})]}),p&&Ts("input",{ref:_,id:`${b.id}-label`,name:e.id,tabIndex:f.length+1,value:h,onChange:e=>{g(e.currentTarget.value),v(e.currentTarget.value)},onKeyDown:s=>{if("Enter"==s.key){const s=Vn(i,e.id,performance.now()-d);l(s),setTimeout((()=>{n({[e.id]:t},s)}),100)}},placeholder:"Please specify",className:"placeholder:text-placeholder border-border bg-survey-bg text-heading focus:ring-focus mt-3 flex h-10 w-full rounded-md border px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",required:e.required,"aria-labelledby":`${b.id}-label`})]})]})]})}),Ts("div",{className:"mt-4 flex w-full justify-between",children:[!a&&Ts(hn,{tabIndex:f.length+3,backButtonLabel:e.backButtonLabel,onClick:()=>{const t=Vn(i,e.id,performance.now()-d);l(t),r()}}),Ts("div",{}),Ts(gn,{tabIndex:f.length+2,buttonLabel:e.buttonLabel,isLastQuestion:o,onClick:()=>{}})]})]})}function er({question:e,value:t,onChange:s,onSubmit:n,onBack:r,isFirstQuestion:a,isLastQuestion:o,ttc:i,setTtc:l}){const[d,c]=Ks(performance.now());Wn(e.id,i,l,d,c);const[u,p]=Ks(!!t&&!e.choices.find((e=>e.label===t))),m=Ys((()=>{if(!e.choices)return[];const t=e.choices.filter((e=>"other"!==e.id));return e.shuffleOption?pn(t,e.shuffleOption):t}),[e.choices,e.shuffleOption]),h=Ys((()=>e.choices.find((e=>"other"===e.id))),[e.choices]),g=Gs(null);return Qs((()=>{var e;u&&(null==(e=g.current)||e.focus())}),[u]),Ts("form",{onSubmit:s=>{s.preventDefault();const r=Vn(i,e.id,performance.now()-d);l(r),n({[e.id]:t},r)},className:"w-full",children:[e.imageUrl&&Ts(fn,{imgUrl:e.imageUrl}),Ts(bn,{headline:e.headline,questionId:e.id,required:e.required}),Ts(Yn,{subheader:e.subheader,questionId:e.id}),Ts("div",{className:"mt-4",children:Ts("fieldset",{children:[Ts("legend",{className:"sr-only",children:"Options"}),Ts("div",{className:"bg-survey-bg relative max-h-[42vh] space-y-2 overflow-y-auto rounded-md py-0.5 pr-2",role:"radiogroup",children:[m.map(((r,a)=>Ts("label",{tabIndex:a+1,onKeyDown:t=>{if("Enter"==t.key){s({[e.id]:r.label});const t=Vn(i,e.id,performance.now()-d);l(t),setTimeout((()=>{n({[e.id]:r.label},t)}),350)}},className:cn(t===r.label?"border-border-highlight bg-accent-selected-bg z-10":"border-border","text-heading focus-within:border-border-highlight focus-within:bg-accent-bg hover:bg-accent-bg relative flex cursor-pointer flex-col rounded-md border p-4 focus:outline-none"),children:Ts("span",{className:"flex items-center text-sm",children:[Ts("input",{tabIndex:-1,type:"radio",id:r.id,name:e.id,value:r.label,className:"border-brand text-brand h-4 w-4 border focus:ring-0 focus:ring-offset-0","aria-labelledby":`${r.id}-label`,onChange:()=>{p(!1),s({[e.id]:r.label})},checked:t===r.label,required:e.required&&0===a}),Ts("span",{id:`${r.id}-label`,className:"ml-3 font-medium",children:r.label})]})},r.id))),h&&Ts("label",{tabIndex:m.length+1,className:cn(t===h.label?"border-border-highlight bg-accent-selected-bg z-10":"border-border","text-heading focus-within:border-border-highlight focus-within:bg-accent-bg hover:bg-accent-bg relative flex cursor-pointer flex-col rounded-md border p-4 focus:outline-none"),onKeyDown:t=>{"Enter"==t.key&&(p(!u),u||s({[e.id]:""}))},children:[Ts("span",{className:"flex items-center text-sm",children:[Ts("input",{type:"radio",id:h.id,tabIndex:-1,name:e.id,value:h.label,className:"border-brand text-brand h-4 w-4 border focus:ring-0 focus:ring-offset-0","aria-labelledby":`${h.id}-label`,onChange:()=>{p(!u),s({[e.id]:""})},checked:u}),Ts("span",{id:`${h.id}-label`,className:"ml-3 font-medium",children:h.label})]}),u&&Ts("input",{ref:g,tabIndex:m.length+1,id:`${h.id}-label`,name:e.id,value:t,onChange:t=>{s({[e.id]:t.currentTarget.value})},onKeyDown:s=>{if("Enter"==s.key){const s=Vn(i,e.id,performance.now()-d);l(s),setTimeout((()=>{n({[e.id]:t},s)}),100)}},placeholder:"Please specify",className:"placeholder:text-placeholder border-border bg-survey-bg text-heading focus:ring-focus mt-3 flex h-10 w-full rounded-md border px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",required:e.required,"aria-labelledby":`${h.id}-label`})]})]})]})}),Ts("div",{className:"mt-4 flex w-full justify-between",children:[!a&&Ts(hn,{backButtonLabel:e.backButtonLabel,tabIndex:m.length+3,onClick:()=>{const t=Vn(i,e.id,performance.now()-d);l(t),r()}}),Ts("div",{}),Ts(gn,{tabIndex:m.length+2,buttonLabel:e.buttonLabel,isLastQuestion:o,onClick:()=>{}})]})]})}function tr({question:e,value:t,onChange:s,onSubmit:n,onBack:r,isFirstQuestion:a,isLastQuestion:o,ttc:i,setTtc:l}){const[d,c]=Ks(performance.now());return Wn(e.id,i,l,d,c),Ts("form",{onSubmit:s=>{s.preventDefault();const r=Vn(i,e.id,performance.now()-d);l(r),n({[e.id]:t},r)},children:[e.imageUrl&&Ts(fn,{imgUrl:e.imageUrl}),Ts(bn,{headline:e.headline,questionId:e.id,required:e.required}),Ts(Yn,{subheader:e.subheader,questionId:e.id}),Ts("div",{className:"my-4",children:Ts("fieldset",{children:[Ts("legend",{className:"sr-only",children:"Options"}),Ts("div",{className:"flex",children:Array.from({length:11},((e,t)=>t)).map(((r,a)=>Ts("label",{tabIndex:a+1,onKeyDown:t=>{if("Enter"==t.key){const t=Vn(i,e.id,performance.now()-d);l(t),n({[e.id]:r},t)}},className:cn(t===r?"border-border-highlight bg-accent-selected-bg z-10":"border-border","bg-survey-bg text-heading hover:bg-accent-bg relative h-10 flex-1 cursor-pointer border text-center text-sm leading-10 first:rounded-l-md last:rounded-r-md focus:outline-none"),children:[Ts("input",{type:"radio",name:"nps",value:r,checked:t===r,className:"absolute h-full w-full cursor-pointer opacity-0",onClick:()=>{if(e.required){const t=Vn(i,e.id,performance.now()-d);l(t),n({[e.id]:r},t)}s({[e.id]:r})},required:e.required}),r]},r)))}),Ts("div",{className:"text-info-text flex justify-between px-1.5 text-xs leading-6",children:[Ts("p",{children:e.lowerLabel}),Ts("p",{children:e.upperLabel})]})]})}),Ts("div",{className:"mt-4 flex w-full justify-between",children:[!a&&Ts(hn,{tabIndex:o?12:13,backButtonLabel:e.backButtonLabel,onClick:()=>{const t=Vn(i,e.id,performance.now()-d);l(t),r()}}),Ts("div",{}),!e.required&&Ts(gn,{tabIndex:12,buttonLabel:e.buttonLabel,isLastQuestion:o,onClick:()=>{}})]})]})}function sr({question:e,value:t,onChange:s,onSubmit:n,onBack:r,isFirstQuestion:a,isLastQuestion:o,autoFocus:i=!0,ttc:l,setTtc:d}){const[c,u]=Ks(performance.now());Wn(e.id,l,d,c,u);const p=t=>{s({[e.id]:t})},m=Js((e=>{e&&i&&e.focus()}),[e.id]);return Ts("form",{onSubmit:s=>{s.preventDefault();const r=Vn(l,e.id,performance.now()-c);d(r),n({[e.id]:t,inputType:e.inputType},r)},className:"w-full",children:[e.imageUrl&&Ts(fn,{imgUrl:e.imageUrl}),Ts(bn,{headline:e.headline,questionId:e.id,required:e.required}),Ts(Yn,{subheader:e.subheader,questionId:e.id}),Ts("div",{className:"mt-4",children:!1===e.longAnswer?Ts("input",{ref:m,tabIndex:1,name:e.id,id:e.id,placeholder:e.placeholder,required:e.required,value:t||"",type:e.inputType,onInput:e=>p(e.currentTarget.value),autoFocus:i,className:"border-border bg-survey-bg focus:border-border-highlight block w-full rounded-md border p-2 shadow-sm focus:outline-none focus:ring-0 sm:text-sm",onKeyDown:s=>{if("Enter"===s.key&&(r=t,e.required&&!(null==r?void 0:r.trim())))s.preventDefault();else if("Enter"===s.key){const s=Vn(l,e.id,performance.now()-c);d(s),n({[e.id]:t,inputType:e.inputType},s)}var r},pattern:"phone"===e.inputType?"[+][0-9 ]+":".*",title:"phone"===e.inputType?"Enter a valid phone number":void 0}):Ts("textarea",{ref:m,rows:3,name:e.id,tabIndex:1,id:e.id,placeholder:e.placeholder,required:e.required,value:t,type:e.inputType,onInput:e=>p(e.currentTarget.value),autoFocus:i,className:"border-border bg-survey-bg text-subheading focus:border-border-highlight block w-full rounded-md border p-2 shadow-sm focus:ring-0 sm:text-sm",pattern:"phone"===e.inputType?"[+][0-9 ]+":".*",title:"phone"===e.inputType?"Please enter a valid phone number":void 0})}),Ts("div",{className:"mt-4 flex w-full justify-between",children:[!a&&Ts(hn,{backButtonLabel:e.backButtonLabel,onClick:()=>{const t=Vn(l,e.id,performance.now()-c);d(t),r()}}),Ts("div",{}),Ts(gn,{buttonLabel:e.buttonLabel,isLastQuestion:o,onClick:()=>{}})]})]})}function nr({question:e,value:t,onChange:s,onSubmit:n,onBack:r,isFirstQuestion:a,isLastQuestion:o,ttc:i,setTtc:l}){const[d,c]=Ks(performance.now());Wn(e.id,i,l,d,c);const u=n=>{Array.isArray(t)&&t.includes(n)?(n=>{let r=[];r=e.allowMulti&&Array.isArray(t)?t.filter((e=>e!==n)):[],s({[e.id]:r})})(n):(n=>{let r=[];r=e.allowMulti&&Array.isArray(t)?[...t,n]:[n],s({[e.id]:r})})(n)};Qs((()=>{!e.allowMulti&&Array.isArray(t)&&t.length>1&&s({[e.id]:[]})}),[e.allowMulti]);const p=e.choices;return Ts("form",{onSubmit:s=>{s.preventDefault();const r=Vn(i,e.id,performance.now()-d);l(r),n({[e.id]:t},r)},className:"w-full",children:[e.imageUrl&&Ts(fn,{imgUrl:e.imageUrl}),Ts(bn,{headline:e.headline,questionId:e.id,required:e.required}),Ts(Yn,{subheader:e.subheader,questionId:e.id}),Ts("div",{className:"mt-4",children:Ts("fieldset",{children:[Ts("legend",{className:"sr-only",children:"Options"}),Ts("div",{className:"rounded-m bg-survey-bg relative grid max-h-[42vh] grid-cols-2 gap-x-5 gap-y-4 overflow-y-auto pr-2.5",children:p.map(((s,n)=>Ts("label",{tabIndex:n+1,htmlFor:s.id,onKeyDown:e=>{"Enter"==e.key&&u(s.id)},onClick:()=>u(s.id),className:cn(Array.isArray(t)&&t.includes(s.id)?"border-brand text-brand z-10 border-4 shadow-xl focus:border-4":"","border-border focus:border-border-highlight focus:bg-accent-selected-bg relative box-border inline-block h-28 w-full overflow-hidden rounded-xl border focus:outline-none"),children:[Ts("img",{src:s.imageUrl,id:s.id,alt:s.imageUrl.split("/").pop(),className:"h-full w-full object-cover"}),e.allowMulti?Ts("input",{id:`${s.id}-checked`,name:`${s.id}-checkbox`,type:"checkbox",tabindex:-1,checked:Array.isArray(t)&&t.includes(s.id),className:cn("border-border pointer-events-none absolute right-2 top-2 z-20 h-5 w-5 rounded border",Array.isArray(t)&&t.includes(s.id)?"border-brand text-brand":""),required:!(e.required&&Array.isArray(t)&&t.length)&&e.required}):Ts("input",{id:`${s.id}-radio`,name:`${s.id}-radio`,type:"radio",tabindex:-1,checked:Array.isArray(t)&&t.includes(s.id),className:cn("border-border pointer-events-none absolute right-2 top-2 z-20 h-5 w-5 rounded-full border",Array.isArray(t)&&t.includes(s.id)?"border-brand text-brand":""),required:!(e.required&&Array.isArray(t)&&t.length)&&e.required})]},s.id)))})]})}),Ts("div",{className:"mt-4 flex w-full justify-between",children:[!a&&Ts(hn,{tabIndex:p.length+3,backButtonLabel:e.backButtonLabel,onClick:()=>{const t=Vn(i,e.id,performance.now()-d);l(t),r()}}),Ts("div",{}),Ts(gn,{tabIndex:p.length+2,buttonLabel:e.buttonLabel,isLastQuestion:o,onClick:()=>{}})]})]})}const rr=e=>Ts("svg",{viewBox:"0 0 72 72",xmlns:"http://www.w3.org/2000/svg",width:36,height:36,children:Ts("g",{id:"line",children:[Ts("circle",{cx:"36",cy:"36",r:"23",fill:"none",stroke:"currentColor",strokeMiterlimit:"10",strokeWidth:"2",...e}),Ts("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:"10",strokeWidth:"2",d:"m21.88 23.92c5.102-0.06134 7.273-1.882 8.383-3.346"}),Ts("path",{stroke:"currentColor",strokeMiterlimit:"10",strokeWidth:"2",d:"m46.24 47.56c0-2.592-2.867-7.121-10.25-6.93-6.974 0.1812-10.22 4.518-10.22 7.111s4.271-1.611 10.05-1.492c6.317 0.13 10.43 3.903 10.43 1.311z"}),Ts("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:"10",strokeWidth:"2",d:"m23.16 28.47c5.215 1.438 5.603 0.9096 8.204 1.207 1.068 0.1221-2.03 2.67-7.282 4.397"}),Ts("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:"10",strokeWidth:"2",d:"m50.12 23.92c-5.102-0.06134-7.273-1.882-8.383-3.346"}),Ts("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:"10",strokeWidth:"2",d:"m48.84 28.47c-5.215 1.438-5.603 0.9096-8.204 1.207-1.068 0.1221 2.03 2.67 7.282 4.397"})]})}),ar=e=>Ts("svg",{viewBox:"0 0 72 72",xmlns:"http://www.w3.org/2000/svg",width:36,height:36,children:Ts("g",{id:"line",children:[Ts("circle",{cx:"36",cy:"36",r:"23",fill:"none",stroke:"currentColor",strokeMiterlimit:"10",strokeWidth:"2",...e}),Ts("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:"10",strokeWidth:"2",d:"m22.88 23.92c5.102-0.06134 7.273-1.882 8.383-3.346"}),Ts("path",{stroke:"currentColor",strokeMiterlimit:"10",strokeWidth:"2",d:"m46.24 47.56c0-2.592-2.867-7.121-10.25-6.93-6.974 0.1812-10.22 4.518-10.22 7.111s4.271-1.611 10.05-1.492c6.317 0.13 10.43 3.903 10.43 1.311z"}),Ts("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:"10",strokeWidth:"2",d:"m49.12 23.92c-5.102-0.06134-7.273-1.882-8.383-3.346"}),Ts("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:"10",strokeWidth:"2",d:"m48.24 30.51c-6.199 1.47-7.079 1.059-8.868-1.961"}),Ts("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:"10",strokeWidth:"2",d:"m23.76 30.51c6.199 1.47 7.079 1.059 8.868-1.961"})]})}),or=e=>Ts("svg",{viewBox:"0 0 72 72",xmlns:"http://www.w3.org/2000/svg",width:36,height:36,children:Ts("g",{id:"line",children:[Ts("circle",{cx:"36",cy:"36",r:"23",fill:"none",stroke:"currentColor",strokeMiterlimit:"10",strokeWidth:"2",...e}),Ts("line",{x1:"44.5361",x2:"50.9214",y1:"21.4389",y2:"24.7158",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:"10",strokeWidth:"2"}),Ts("line",{x1:"26.9214",x2:"20.5361",y1:"21.4389",y2:"24.7158",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:"10",strokeWidth:"2"}),Ts("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:"10",strokeWidth:"2",d:"M24,28c2.3334,1.3333,4.6666,2.6667,7,4c-2.3334,1.3333-4.6666,2.6667-7,4"}),Ts("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:"10",strokeWidth:"2",d:"M48,28c-2.3334,1.3333-4.6666,2.6667-7,4c2.3334,1.3333,4.6666,2.6667,7,4"}),Ts("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:"10",strokeWidth:"2",d:"M28,51c0.2704-0.3562,1-8,8.4211-8.0038C43,42.9929,43.6499,50.5372,44,51C38.6667,51,33.3333,51,28,51z"})]})}),ir=e=>Ts("svg",{viewBox:"0 0 72 72",xmlns:"http://www.w3.org/2000/svg",width:36,height:36,children:Ts("g",{id:"line",children:[Ts("circle",{cx:"36",cy:"36",r:"23",fill:"none",stroke:"currentColor",strokeMiterlimit:"10",strokeWidth:"2",...e}),Ts("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:"10",strokeWidth:"2",d:"M26.5,48c1.8768-3.8326,5.8239-6.1965,10-6c3.8343,0.1804,7.2926,2.4926,9,6"}),Ts("path",{d:"M30,31c0,1.6568-1.3448,3-3,3c-1.6553,0-3-1.3433-3-3c0-1.6552,1.3447-3,3-3C28.6552,28,30,29.3448,30,31"}),Ts("path",{d:"M48,31c0,1.6568-1.3447,3-3,3s-3-1.3433-3-3c0-1.6552,1.3447-3,3-3S48,29.3448,48,31"})]})}),lr=e=>Ts("svg",{viewBox:"0 0 72 72",xmlns:"http://www.w3.org/2000/svg",width:36,height:36,children:Ts("g",{id:"line",children:[Ts("circle",{cx:"36",cy:"36",r:"23",fill:"none",stroke:"currentColor",strokeMiterlimit:"10",strokeWidth:"2",...e}),Ts("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m44.7 43.92c-6.328-1.736-11.41-0.906-17.4 1.902"}),Ts("path",{d:"M30,31c0,1.6568-1.3448,3-3,3c-1.6553,0-3-1.3433-3-3c0-1.6552,1.3447-3,3-3C28.6552,28,30,29.3448,30,31"}),Ts("path",{d:"M48,31c0,1.6568-1.3447,3-3,3s-3-1.3433-3-3c0-1.6552,1.3447-3,3-3S48,29.3448,48,31"})]})}),dr=e=>Ts("svg",{viewBox:"0 0 72 72",xmlns:"http://www.w3.org/2000/svg",width:36,height:36,children:Ts("g",{id:"line",children:[Ts("circle",{cx:"36",cy:"36",r:"23",fill:"none",stroke:"currentColor",strokeMiterlimit:"10",strokeWidth:"2",...e}),Ts("line",{x1:"27",x2:"45",y1:"43",y2:"43",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:"10",strokeWidth:"2"}),Ts("path",{d:"M30,31c0,1.6568-1.3448,3-3,3c-1.6553,0-3-1.3433-3-3c0-1.6552,1.3447-3,3-3C28.6552,28,30,29.3448,30,31"}),Ts("path",{d:"M48,31c0,1.6568-1.3447,3-3,3s-3-1.3433-3-3c0-1.6552,1.3447-3,3-3S48,29.3448,48,31"})]})}),cr=e=>Ts("svg",{viewBox:"0 0 72 72",xmlns:"http://www.w3.org/2000/svg",width:36,height:36,children:Ts("g",{id:"line",children:[Ts("circle",{cx:"36",cy:"36",r:"23",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",...e}),Ts("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M45.8149,44.9293 c-2.8995,1.6362-6.2482,2.5699-9.8149,2.5699s-6.9153-0.9336-9.8149-2.5699"}),Ts("path",{d:"M30,31c0,1.6568-1.3448,3-3,3c-1.6553,0-3-1.3433-3-3c0-1.6552,1.3447-3,3-3C28.6552,28,30,29.3448,30,31"}),Ts("path",{d:"M48,31c0,1.6568-1.3447,3-3,3s-3-1.3433-3-3c0-1.6552,1.3447-3,3-3S48,29.3448,48,31"})]})}),ur=e=>Ts("svg",{viewBox:"0 0 72 72",xmlns:"http://www.w3.org/2000/svg",width:36,height:36,children:Ts("g",{id:"line",children:[Ts("circle",{cx:"36",cy:"36",r:"23",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",...e}),Ts("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M45.8147,45.2268a15.4294,15.4294,0,0,1-19.6294,0"}),Ts("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeMiterlimit:"10",strokeWidth:"2",d:"M31.6941,33.4036a4.7262,4.7262,0,0,0-8.6382,0"}),Ts("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeMiterlimit:"10",strokeWidth:"2",d:"M48.9441,33.4036a4.7262,4.7262,0,0,0-8.6382,0"})]})}),pr=e=>Ts("svg",{viewBox:"0 0 72 72",xmlns:"http://www.w3.org/2000/svg",width:36,height:36,children:Ts("g",{id:"line",children:[Ts("circle",{cx:"36",cy:"36",r:"23",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",...e}),Ts("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M50.595,41.64a11.5554,11.5554,0,0,1-.87,4.49c-12.49,3.03-25.43.34-27.49-.13a11.4347,11.4347,0,0,1-.83-4.36h.11s14.8,3.59,28.89.07Z"}),Ts("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M49.7251,46.13c-1.79,4.27-6.35,7.23-13.69,7.23-7.41,0-12.03-3.03-13.8-7.36C24.2951,46.47,37.235,49.16,49.7251,46.13Z"}),Ts("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeMiterlimit:"10",strokeWidth:"2",d:"M31.6941,32.4036a4.7262,4.7262,0,0,0-8.6382,0"}),Ts("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeMiterlimit:"10",strokeWidth:"2",d:"M48.9441,32.4036a4.7262,4.7262,0,0,0-8.6382,0"})]})}),mr=e=>Ts("svg",{viewBox:"0 0 72 72",xmlns:"http://www.w3.org/2000/svg",width:36,height:36,children:Ts("g",{id:"line",children:[Ts("circle",{cx:"36",cy:"36",r:"23",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",...e}),Ts("polyline",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",points:"25.168 27.413 31.755 31.427 25.168 35.165"}),Ts("polyline",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",points:"46.832 27.413 40.245 31.427 46.832 35.165"}),Ts("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M50.595,41.64a11.5554,11.5554,0,0,1-.87,4.49c-12.49,3.03-25.43.34-27.49-.13a11.4347,11.4347,0,0,1-.83-4.36h.11s14.8,3.59,28.89.07Z"}),Ts("path",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M49.7251,46.13c-1.79,4.27-6.35,7.23-13.69,7.23-7.41,0-12.03-3.03-13.8-7.36C24.2951,46.47,37.235,49.16,49.7251,46.13Z"})]})});function hr({question:e,value:t,onChange:s,onSubmit:n,onBack:r,isFirstQuestion:a,isLastQuestion:o,ttc:i,setTtc:l}){const[d,c]=Ks(0),[u,p]=Ks(performance.now());Wn(e.id,i,l,u,p);const m=t=>{if(s({[e.id]:t}),e.required){const s=Vn(i,e.id,performance.now()-u);l(s),n({[e.id]:t},s)}},h=({number:s})=>Ts("input",{type:"radio",name:"rating",value:s,className:"absolute left-0 h-full w-full cursor-pointer opacity-0",onChange:()=>m(s),required:e.required,checked:t===s});return Ts("form",{onSubmit:s=>{s.preventDefault();const r=Vn(i,e.id,performance.now()-u);l(r),n({[e.id]:t},r)},className:"w-full",children:[e.imageUrl&&Ts(fn,{imgUrl:e.imageUrl}),Ts(bn,{headline:e.headline,questionId:e.id,required:e.required}),Ts(Yn,{subheader:e.subheader,questionId:e.id}),Ts("div",{className:"mb-4 mt-8",children:Ts("fieldset",{children:[Ts("legend",{className:"sr-only",children:"Choices"}),Ts("div",{className:"flex",children:Array.from({length:e.range},((e,t)=>t+1)).map(((s,n,r)=>Ts("span",{onMouseOver:()=>c(s),onMouseLeave:()=>c(0),className:"max-w-10 bg-survey-bg relative max-h-10 flex-1 cursor-pointer text-center text-sm leading-10",children:"number"===e.scale?Ts("label",{tabIndex:n+1,onKeyDown:e=>{"Enter"==e.key&&m(s)},className:cn(t===s?"bg-accent-selected-bg border-border-highlight z-10":"",r.length===s?"rounded-r-md":"",1===s?"rounded-l-md":"","text-heading hover:bg-accent-bg focus:bg-accent-bg block h-full w-full border focus:outline-none"),children:[Ts(h,{number:s}),s]}):"star"===e.scale?Ts("label",{tabIndex:n+1,onKeyDown:e=>{"Enter"==e.key&&m(s)},className:cn(s<=d?"text-rating-focus":"text-heading","focus:text-rating-focus flex h-full w-full justify-center focus:outline-none"),onFocus:()=>c(s),onBlur:()=>c(0),children:[Ts(h,{number:s}),"number"==typeof t&&t>=s?Ts("span",{className:"text-rating-fill",children:Ts("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",className:"h-8 max-h-full w-8 ",children:Ts("path",{fillRule:"evenodd",d:"M10.788 3.21c.448-1.077 1.976-1.077 2.424 0l2.082 5.007 5.404.433c1.164.093 1.636 1.545.749 2.305l-4.117 3.527 1.257 5.273c.271 1.136-.964 2.033-1.96 1.425L12 18.354 7.373 21.18c-.996.608-2.231-.29-1.96-1.425l1.257-5.273-4.117-3.527c-.887-.76-.415-2.212.749-2.305l5.404-.433 2.082-5.006z",clipRule:"evenodd"})})}):Ts("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",className:"h-8 max-h-full w-8",children:Ts("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M11.48 3.499a.562.562 0 011.04 0l2.125 5.111a.563.563 0 00.475.345l5.518.442c.499.04.701.663.321.988l-4.204 3.602a.563.563 0 00-.182.557l1.285 5.385a.562.562 0 01-.84.61l-4.725-2.885a.563.563 0 00-.586 0L6.982 20.54a.562.562 0 01-.84-.61l1.285-5.386a.562.562 0 00-.182-.557l-4.204-3.602a.563.563 0 01.321-.988l5.518-.442a.563.563 0 00.475-.345L11.48 3.5z"})})]}):Ts("label",{className:cn("flex h-full w-full justify-center",t===s||d===s?"stroke-rating-selected text-rating-selected":"stroke-heading text-heading"),tabIndex:n+1,onKeyDown:e=>{"Enter"==e.key&&m(s)},onFocus:()=>c(s),onBlur:()=>c(0),children:[Ts(h,{number:s}),Ts(gr,{active:t===s||d===s,idx:n,range:e.range})]})},s)))}),Ts("div",{className:"text-subheading flex justify-between px-1.5 text-xs leading-6",children:[Ts("p",{className:"w-1/2 text-left",children:e.lowerLabel}),Ts("p",{className:"w-1/2 text-right",children:e.upperLabel})]})]})}),Ts("div",{className:"mt-4 flex w-full justify-between",children:[!a&&Ts(hn,{tabIndex:!e.required||t?e.range+2:e.range+1,backButtonLabel:e.backButtonLabel,onClick:()=>{const t=Vn(i,e.id,performance.now()-u);l(t),r()}}),Ts("div",{}),(!e.required||t)&&Ts(gn,{tabIndex:e.range+1,buttonLabel:e.buttonLabel,isLastQuestion:o,onClick:()=>{}})]})]})}function gr({active:e,idx:t,range:s}){const n="fill-rating-fill",r="fill-none";let a=[Ts(rr,{className:e?n:r}),Ts(ar,{className:e?n:r}),Ts(or,{className:e?n:r}),Ts(ir,{className:e?n:r}),Ts(lr,{className:e?n:r}),Ts(dr,{className:e?n:r}),Ts(cr,{className:e?n:r}),Ts(ur,{className:e?n:r}),Ts(pr,{className:e?n:r}),Ts(mr,{className:e?n:r})];return 7==s?a=[a[1],a[3],a[4],a[5],a[6],a[8],a[9]]:5==s?a=[a[3],a[4],a[5],a[6],a[7]]:4==s?a=[a[4],a[5],a[6],a[7]]:3==s&&(a=[a[4],a[5],a[7]]),a[t]}var fr,br,_r;Ts("svg",{viewBox:"0 0 72 72",xmlns:"http://www.w3.org/2000/svg",width:36,height:36}),(br=fr||(fr={})).assertEqual=e=>e,br.assertIs=function(e){},br.assertNever=function(_x){throw new Error},br.arrayToEnum=e=>{const t={};for(const s of e)t[s]=s;return t},br.getValidEnumValues=e=>{const t=br.objectKeys(e).filter((t=>"number"!=typeof e[e[t]])),s={};for(const n of t)s[n]=e[n];return br.objectValues(s)},br.objectValues=e=>br.objectKeys(e).map((function(t){return e[t]})),br.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.push(s);return t},br.find=(e,t)=>{for(const s of e)if(t(s))return s},br.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,br.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},br.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(_r||(_r={})).mergeShapes=(e,t)=>({...e,...t});const vr=fr.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),yr=e=>{switch(typeof e){case"undefined":return vr.undefined;case"string":return vr.string;case"number":return isNaN(e)?vr.nan:vr.number;case"boolean":return vr.boolean;case"function":return vr.function;case"bigint":return vr.bigint;case"symbol":return vr.symbol;case"object":return Array.isArray(e)?vr.array:null===e?vr.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?vr.promise:"undefined"!=typeof Map&&e instanceof Map?vr.map:"undefined"!=typeof Set&&e instanceof Set?vr.set:"undefined"!=typeof Date&&e instanceof Date?vr.date:vr.object;default:return vr.unknown}},wr=fr.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class xr extends Error{constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(e){return e.message},s={_errors:[]},n=e=>{for(const r of e.issues)if("invalid_union"===r.code)r.unionErrors.map(n);else if("invalid_return_type"===r.code)n(r.returnTypeError);else if("invalid_arguments"===r.code)n(r.argumentsError);else if(0===r.path.length)s._errors.push(t(r));else{let e=s,n=0;for(;n<r.path.length;){const s=r.path[n];n===r.path.length-1?(e[s]=e[s]||{_errors:[]},e[s]._errors.push(t(r))):e[s]=e[s]||{_errors:[]},e=e[s],n++}}};return n(this),s}toString(){return this.message}get message(){return JSON.stringify(this.issues,fr.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=(e=>e.message)){const t={},s=[];for(const n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):s.push(e(n));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}}xr.create=e=>new xr(e);const kr=(e,t)=>{let s;switch(e.code){case wr.invalid_type:s=e.received===vr.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case wr.invalid_literal:s=`Invalid literal value, expected ${JSON.stringify(e.expected,fr.jsonStringifyReplacer)}`;break;case wr.unrecognized_keys:s=`Unrecognized key(s) in object: ${fr.joinValues(e.keys,", ")}`;break;case wr.invalid_union:s="Invalid input";break;case wr.invalid_union_discriminator:s=`Invalid discriminator value. Expected ${fr.joinValues(e.options)}`;break;case wr.invalid_enum_value:s=`Invalid enum value. Expected ${fr.joinValues(e.options)}, received '${e.received}'`;break;case wr.invalid_arguments:s="Invalid function arguments";break;case wr.invalid_return_type:s="Invalid function return type";break;case wr.invalid_date:s="Invalid date";break;case wr.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(s=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(s=`${s} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?s=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?s=`Invalid input: must end with "${e.validation.endsWith}"`:fr.assertNever(e.validation):s="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case wr.too_small:s="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case wr.too_big:s="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case wr.custom:s="Invalid input";break;case wr.invalid_intersection_types:s="Intersection results could not be merged";break;case wr.not_multiple_of:s=`Number must be a multiple of ${e.multipleOf}`;break;case wr.not_finite:s="Number must be finite";break;default:s=t.defaultError,fr.assertNever(e)}return{message:s}};let Er=kr;function Cr(){return Er}const Sr=e=>{const{data:t,path:s,errorMaps:n,issueData:r}=e,a=[...s,...r.path||[]],o={...r,path:a};let i="";const l=n.filter((e=>!!e)).slice().reverse();for(const e of l)i=e(o,{data:t,defaultError:i}).message;return{...r,path:a,message:r.message||i}};function Ar(e,t){const s=Sr({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,Cr(),kr].filter((e=>!!e))});e.common.issues.push(s)}class jr{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const s=[];for(const n of t){if("aborted"===n.status)return Nr;"dirty"===n.status&&e.dirty(),s.push(n.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){const s=[];for(const e of t)s.push({key:await e.key,value:await e.value});return jr.mergeObjectSync(e,s)}static mergeObjectSync(e,t){const s={};for(const n of t){const{key:t,value:r}=n;if("aborted"===t.status)return Nr;if("aborted"===r.status)return Nr;"dirty"===t.status&&e.dirty(),"dirty"===r.status&&e.dirty(),"__proto__"===t.value||void 0===r.value&&!n.alwaysSet||(s[t.value]=r.value)}return{status:e.value,value:s}}}const Nr=Object.freeze({status:"aborted"}),Lr=e=>({status:"dirty",value:e}),Dr=e=>({status:"valid",value:e}),Ir=e=>"aborted"===e.status,Tr=e=>"dirty"===e.status,Mr=e=>"valid"===e.status,Or=e=>"undefined"!=typeof Promise&&e instanceof Promise;var Fr,Br;(Br=Fr||(Fr={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},Br.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;class zr{constructor(e,t,s,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=n}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Pr=(e,t)=>{if(Mr(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new xr(e.common.issues);return this._error=t,this._error}}};function Rr(e){if(!e)return{};const{errorMap:t,invalid_type_error:s,required_error:n,description:r}=e;if(t&&(s||n))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:r}:{errorMap:(e,t)=>"invalid_type"!==e.code?{message:t.defaultError}:void 0===t.data?{message:null!=n?n:t.defaultError}:{message:null!=s?s:t.defaultError},description:r}}class qr{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return yr(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:yr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new jr,ctx:{common:e.parent.common,data:e.data,parsedType:yr(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Or(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){var s;const n={common:{issues:[],async:null!==(s=null==t?void 0:t.async)&&void 0!==s&&s,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:yr(e)},r=this._parseSync({data:e,path:n.path,parent:n});return Pr(n,r)}async parseAsync(e,t){const s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){const s={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:yr(e)},n=this._parse({data:e,path:s.path,parent:s}),r=await(Or(n)?n:Promise.resolve(n));return Pr(s,r)}refine(e,t){const s=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,n)=>{const r=e(t),a=()=>n.addIssue({code:wr.custom,...s(t)});return"undefined"!=typeof Promise&&r instanceof Promise?r.then((e=>!!e||(a(),!1))):!!r||(a(),!1)}))}refinement(e,t){return this._refinement(((s,n)=>!!e(s)||(n.addIssue("function"==typeof t?t(s,n):t),!1)))}_refinement(e){return new ja({schema:this,typeName:Ra.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Na.create(this,this._def)}nullable(){return La.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return da.create(this,this._def)}promise(){return Aa.create(this,this._def)}or(e){return pa.create([this,e],this._def)}and(e){return fa.create(this,e,this._def)}transform(e){return new ja({...Rr(this._def),schema:this,typeName:Ra.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new Da({...Rr(this._def),innerType:this,defaultValue:t,typeName:Ra.ZodDefault})}brand(){return new Oa({typeName:Ra.ZodBranded,type:this,...Rr(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new Ia({...Rr(this._def),innerType:this,catchValue:t,typeName:Ra.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return Fa.create(this,e)}readonly(){return Ba.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Zr=/^c[^\s-]{8,}$/i,Hr=/^[a-z][a-z0-9]*$/,Ur=/^[0-9A-HJKMNP-TV-Z]{26}$/,$r=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Vr=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let Wr;const Kr=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,Qr=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;class Gr extends qr{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==vr.string){const t=this._getOrReturnCtx(e);return Ar(t,{code:wr.invalid_type,expected:vr.string,received:t.parsedType}),Nr}const t=new jr;let s;for(const o of this._def.checks)if("min"===o.kind)e.data.length<o.value&&(s=this._getOrReturnCtx(e,s),Ar(s,{code:wr.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),t.dirty());else if("max"===o.kind)e.data.length>o.value&&(s=this._getOrReturnCtx(e,s),Ar(s,{code:wr.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),t.dirty());else if("length"===o.kind){const n=e.data.length>o.value,r=e.data.length<o.value;(n||r)&&(s=this._getOrReturnCtx(e,s),n?Ar(s,{code:wr.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):r&&Ar(s,{code:wr.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),t.dirty())}else if("email"===o.kind)Vr.test(e.data)||(s=this._getOrReturnCtx(e,s),Ar(s,{validation:"email",code:wr.invalid_string,message:o.message}),t.dirty());else if("emoji"===o.kind)Wr||(Wr=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Wr.test(e.data)||(s=this._getOrReturnCtx(e,s),Ar(s,{validation:"emoji",code:wr.invalid_string,message:o.message}),t.dirty());else if("uuid"===o.kind)$r.test(e.data)||(s=this._getOrReturnCtx(e,s),Ar(s,{validation:"uuid",code:wr.invalid_string,message:o.message}),t.dirty());else if("cuid"===o.kind)Zr.test(e.data)||(s=this._getOrReturnCtx(e,s),Ar(s,{validation:"cuid",code:wr.invalid_string,message:o.message}),t.dirty());else if("cuid2"===o.kind)Hr.test(e.data)||(s=this._getOrReturnCtx(e,s),Ar(s,{validation:"cuid2",code:wr.invalid_string,message:o.message}),t.dirty());else if("ulid"===o.kind)Ur.test(e.data)||(s=this._getOrReturnCtx(e,s),Ar(s,{validation:"ulid",code:wr.invalid_string,message:o.message}),t.dirty());else if("url"===o.kind)try{new URL(e.data)}catch(n){s=this._getOrReturnCtx(e,s),Ar(s,{validation:"url",code:wr.invalid_string,message:o.message}),t.dirty()}else"regex"===o.kind?(o.regex.lastIndex=0,o.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),Ar(s,{validation:"regex",code:wr.invalid_string,message:o.message}),t.dirty())):"trim"===o.kind?e.data=e.data.trim():"includes"===o.kind?e.data.includes(o.value,o.position)||(s=this._getOrReturnCtx(e,s),Ar(s,{code:wr.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),t.dirty()):"toLowerCase"===o.kind?e.data=e.data.toLowerCase():"toUpperCase"===o.kind?e.data=e.data.toUpperCase():"startsWith"===o.kind?e.data.startsWith(o.value)||(s=this._getOrReturnCtx(e,s),Ar(s,{code:wr.invalid_string,validation:{startsWith:o.value},message:o.message}),t.dirty()):"endsWith"===o.kind?e.data.endsWith(o.value)||(s=this._getOrReturnCtx(e,s),Ar(s,{code:wr.invalid_string,validation:{endsWith:o.value},message:o.message}),t.dirty()):"datetime"===o.kind?((a=o).precision?a.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${a.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${a.precision}}Z$`):0===a.precision?a.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):a.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$")).test(e.data)||(s=this._getOrReturnCtx(e,s),Ar(s,{code:wr.invalid_string,validation:"datetime",message:o.message}),t.dirty()):"ip"===o.kind?(n=e.data,("v4"!==(r=o.version)&&r||!Kr.test(n))&&("v6"!==r&&r||!Qr.test(n))&&(s=this._getOrReturnCtx(e,s),Ar(s,{validation:"ip",code:wr.invalid_string,message:o.message}),t.dirty())):fr.assertNever(o);var n,r,a;return{status:t.value,value:e.data}}_regex(e,t,s){return this.refinement((t=>e.test(t)),{validation:t,code:wr.invalid_string,...Fr.errToObj(s)})}_addCheck(e){return new Gr({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Fr.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Fr.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Fr.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Fr.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Fr.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Fr.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Fr.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Fr.errToObj(e)})}datetime(e){var t;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,...Fr.errToObj(null==e?void 0:e.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Fr.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...Fr.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Fr.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Fr.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Fr.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Fr.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Fr.errToObj(t)})}nonempty(e){return this.min(1,Fr.errToObj(e))}trim(){return new Gr({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Gr({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Gr({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function Yr(e,t){const s=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,r=s>n?s:n;return parseInt(e.toFixed(r).replace(".",""))%parseInt(t.toFixed(r).replace(".",""))/Math.pow(10,r)}Gr.create=e=>{var t;return new Gr({checks:[],typeName:Ra.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...Rr(e)})};class Jr extends qr{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==vr.number){const t=this._getOrReturnCtx(e);return Ar(t,{code:wr.invalid_type,expected:vr.number,received:t.parsedType}),Nr}let t;const s=new jr;for(const n of this._def.checks)"int"===n.kind?fr.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),Ar(t,{code:wr.invalid_type,expected:"integer",received:"float",message:n.message}),s.dirty()):"min"===n.kind?(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),Ar(t,{code:wr.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),s.dirty()):"max"===n.kind?(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),Ar(t,{code:wr.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),s.dirty()):"multipleOf"===n.kind?0!==Yr(e.data,n.value)&&(t=this._getOrReturnCtx(e,t),Ar(t,{code:wr.not_multiple_of,multipleOf:n.value,message:n.message}),s.dirty()):"finite"===n.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),Ar(t,{code:wr.not_finite,message:n.message}),s.dirty()):fr.assertNever(n);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Fr.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Fr.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Fr.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Fr.toString(t))}setLimit(e,t,s,n){return new Jr({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:Fr.toString(n)}]})}_addCheck(e){return new Jr({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Fr.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Fr.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Fr.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Fr.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Fr.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Fr.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Fr.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Fr.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Fr.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find((e=>"int"===e.kind||"multipleOf"===e.kind&&fr.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const s of this._def.checks){if("finite"===s.kind||"int"===s.kind||"multipleOf"===s.kind)return!0;"min"===s.kind?(null===t||s.value>t)&&(t=s.value):"max"===s.kind&&(null===e||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}}Jr.create=e=>new Jr({checks:[],typeName:Ra.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...Rr(e)});class Xr extends qr{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==vr.bigint){const t=this._getOrReturnCtx(e);return Ar(t,{code:wr.invalid_type,expected:vr.bigint,received:t.parsedType}),Nr}let t;const s=new jr;for(const n of this._def.checks)"min"===n.kind?(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),Ar(t,{code:wr.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),s.dirty()):"max"===n.kind?(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),Ar(t,{code:wr.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),s.dirty()):"multipleOf"===n.kind?e.data%n.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),Ar(t,{code:wr.not_multiple_of,multipleOf:n.value,message:n.message}),s.dirty()):fr.assertNever(n);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Fr.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Fr.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Fr.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Fr.toString(t))}setLimit(e,t,s,n){return new Xr({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:Fr.toString(n)}]})}_addCheck(e){return new Xr({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Fr.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Fr.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Fr.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Fr.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Fr.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}Xr.create=e=>{var t;return new Xr({checks:[],typeName:Ra.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...Rr(e)})};class ea extends qr{_parse(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==vr.boolean){const t=this._getOrReturnCtx(e);return Ar(t,{code:wr.invalid_type,expected:vr.boolean,received:t.parsedType}),Nr}return Dr(e.data)}}ea.create=e=>new ea({typeName:Ra.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...Rr(e)});class ta extends qr{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==vr.date){const t=this._getOrReturnCtx(e);return Ar(t,{code:wr.invalid_type,expected:vr.date,received:t.parsedType}),Nr}if(isNaN(e.data.getTime()))return Ar(this._getOrReturnCtx(e),{code:wr.invalid_date}),Nr;const t=new jr;let s;for(const n of this._def.checks)"min"===n.kind?e.data.getTime()<n.value&&(s=this._getOrReturnCtx(e,s),Ar(s,{code:wr.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),t.dirty()):"max"===n.kind?e.data.getTime()>n.value&&(s=this._getOrReturnCtx(e,s),Ar(s,{code:wr.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),t.dirty()):fr.assertNever(n);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new ta({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Fr.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Fr.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}ta.create=e=>new ta({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:Ra.ZodDate,...Rr(e)});class sa extends qr{_parse(e){if(this._getType(e)!==vr.symbol){const t=this._getOrReturnCtx(e);return Ar(t,{code:wr.invalid_type,expected:vr.symbol,received:t.parsedType}),Nr}return Dr(e.data)}}sa.create=e=>new sa({typeName:Ra.ZodSymbol,...Rr(e)});class na extends qr{_parse(e){if(this._getType(e)!==vr.undefined){const t=this._getOrReturnCtx(e);return Ar(t,{code:wr.invalid_type,expected:vr.undefined,received:t.parsedType}),Nr}return Dr(e.data)}}na.create=e=>new na({typeName:Ra.ZodUndefined,...Rr(e)});class ra extends qr{_parse(e){if(this._getType(e)!==vr.null){const t=this._getOrReturnCtx(e);return Ar(t,{code:wr.invalid_type,expected:vr.null,received:t.parsedType}),Nr}return Dr(e.data)}}ra.create=e=>new ra({typeName:Ra.ZodNull,...Rr(e)});class aa extends qr{constructor(){super(...arguments),this._any=!0}_parse(e){return Dr(e.data)}}aa.create=e=>new aa({typeName:Ra.ZodAny,...Rr(e)});class oa extends qr{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Dr(e.data)}}oa.create=e=>new oa({typeName:Ra.ZodUnknown,...Rr(e)});class ia extends qr{_parse(e){const t=this._getOrReturnCtx(e);return Ar(t,{code:wr.invalid_type,expected:vr.never,received:t.parsedType}),Nr}}ia.create=e=>new ia({typeName:Ra.ZodNever,...Rr(e)});class la extends qr{_parse(e){if(this._getType(e)!==vr.undefined){const t=this._getOrReturnCtx(e);return Ar(t,{code:wr.invalid_type,expected:vr.void,received:t.parsedType}),Nr}return Dr(e.data)}}la.create=e=>new la({typeName:Ra.ZodVoid,...Rr(e)});class da extends qr{_parse(e){const{ctx:t,status:s}=this._processInputParams(e),n=this._def;if(t.parsedType!==vr.array)return Ar(t,{code:wr.invalid_type,expected:vr.array,received:t.parsedType}),Nr;if(null!==n.exactLength){const e=t.data.length>n.exactLength.value,r=t.data.length<n.exactLength.value;(e||r)&&(Ar(t,{code:e?wr.too_big:wr.too_small,minimum:r?n.exactLength.value:void 0,maximum:e?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),s.dirty())}if(null!==n.minLength&&t.data.length<n.minLength.value&&(Ar(t,{code:wr.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),s.dirty()),null!==n.maxLength&&t.data.length>n.maxLength.value&&(Ar(t,{code:wr.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map(((e,s)=>n.type._parseAsync(new zr(t,e,t.path,s))))).then((e=>jr.mergeArray(s,e)));const r=[...t.data].map(((e,s)=>n.type._parseSync(new zr(t,e,t.path,s))));return jr.mergeArray(s,r)}get element(){return this._def.type}min(e,t){return new da({...this._def,minLength:{value:e,message:Fr.toString(t)}})}max(e,t){return new da({...this._def,maxLength:{value:e,message:Fr.toString(t)}})}length(e,t){return new da({...this._def,exactLength:{value:e,message:Fr.toString(t)}})}nonempty(e){return this.min(1,e)}}function ca(e){if(e instanceof ua){const t={};for(const s in e.shape){const n=e.shape[s];t[s]=Na.create(ca(n))}return new ua({...e._def,shape:()=>t})}return e instanceof da?new da({...e._def,type:ca(e.element)}):e instanceof Na?Na.create(ca(e.unwrap())):e instanceof La?La.create(ca(e.unwrap())):e instanceof ba?ba.create(e.items.map((e=>ca(e)))):e}da.create=(e,t)=>new da({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Ra.ZodArray,...Rr(t)});class ua extends qr{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=fr.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==vr.object){const t=this._getOrReturnCtx(e);return Ar(t,{code:wr.invalid_type,expected:vr.object,received:t.parsedType}),Nr}const{status:t,ctx:s}=this._processInputParams(e),{shape:n,keys:r}=this._getCached(),a=[];if(!(this._def.catchall instanceof ia&&"strip"===this._def.unknownKeys))for(const e in s.data)r.includes(e)||a.push(e);const o=[];for(const e of r){const t=n[e],r=s.data[e];o.push({key:{status:"valid",value:e},value:t._parse(new zr(s,r,s.path,e)),alwaysSet:e in s.data})}if(this._def.catchall instanceof ia){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of a)o.push({key:{status:"valid",value:e},value:{status:"valid",value:s.data[e]}});else if("strict"===e)a.length>0&&(Ar(s,{code:wr.unrecognized_keys,keys:a}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of a){const n=s.data[t];o.push({key:{status:"valid",value:t},value:e._parse(new zr(s,n,s.path,t)),alwaysSet:t in s.data})}}return s.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of o){const s=await t.key;e.push({key:s,value:await t.value,alwaysSet:t.alwaysSet})}return e})).then((e=>jr.mergeObjectSync(t,e))):jr.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return Fr.errToObj,new ua({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,s)=>{var n,r,a,o;const i=null!==(a=null===(r=(n=this._def).errorMap)||void 0===r?void 0:r.call(n,t,s).message)&&void 0!==a?a:s.defaultError;return"unrecognized_keys"===t.code?{message:null!==(o=Fr.errToObj(e).message)&&void 0!==o?o:i}:{message:i}}}:{}})}strip(){return new ua({...this._def,unknownKeys:"strip"})}passthrough(){return new ua({...this._def,unknownKeys:"passthrough"})}extend(e){return new ua({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ua({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Ra.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new ua({...this._def,catchall:e})}pick(e){const t={};return fr.objectKeys(e).forEach((s=>{e[s]&&this.shape[s]&&(t[s]=this.shape[s])})),new ua({...this._def,shape:()=>t})}omit(e){const t={};return fr.objectKeys(this.shape).forEach((s=>{e[s]||(t[s]=this.shape[s])})),new ua({...this._def,shape:()=>t})}deepPartial(){return ca(this)}partial(e){const t={};return fr.objectKeys(this.shape).forEach((s=>{const n=this.shape[s];e&&!e[s]?t[s]=n:t[s]=n.optional()})),new ua({...this._def,shape:()=>t})}required(e){const t={};return fr.objectKeys(this.shape).forEach((s=>{if(e&&!e[s])t[s]=this.shape[s];else{let e=this.shape[s];for(;e instanceof Na;)e=e._def.innerType;t[s]=e}})),new ua({...this._def,shape:()=>t})}keyof(){return Ea(fr.objectKeys(this.shape))}}ua.create=(e,t)=>new ua({shape:()=>e,unknownKeys:"strip",catchall:ia.create(),typeName:Ra.ZodObject,...Rr(t)}),ua.strictCreate=(e,t)=>new ua({shape:()=>e,unknownKeys:"strict",catchall:ia.create(),typeName:Ra.ZodObject,...Rr(t)}),ua.lazycreate=(e,t)=>new ua({shape:e,unknownKeys:"strip",catchall:ia.create(),typeName:Ra.ZodObject,...Rr(t)});class pa extends qr{_parse(e){const{ctx:t}=this._processInputParams(e),s=this._def.options;if(t.common.async)return Promise.all(s.map((async e=>{const s={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:s}),ctx:s}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const s of e)if("dirty"===s.result.status)return t.common.issues.push(...s.ctx.common.issues),s.result;const s=e.map((e=>new xr(e.ctx.common.issues)));return Ar(t,{code:wr.invalid_union,unionErrors:s}),Nr}));{let e;const n=[];for(const r of s){const s={...t,common:{...t.common,issues:[]},parent:null},a=r._parseSync({data:t.data,path:t.path,parent:s});if("valid"===a.status)return a;"dirty"!==a.status||e||(e={result:a,ctx:s}),s.common.issues.length&&n.push(s.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const r=n.map((e=>new xr(e)));return Ar(t,{code:wr.invalid_union,unionErrors:r}),Nr}}get options(){return this._def.options}}pa.create=(e,t)=>new pa({options:e,typeName:Ra.ZodUnion,...Rr(t)});const ma=e=>e instanceof xa?ma(e.schema):e instanceof ja?ma(e.innerType()):e instanceof ka?[e.value]:e instanceof Ca?e.options:e instanceof Sa?Object.keys(e.enum):e instanceof Da?ma(e._def.innerType):e instanceof na?[void 0]:e instanceof ra?[null]:null;class ha extends qr{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==vr.object)return Ar(t,{code:wr.invalid_type,expected:vr.object,received:t.parsedType}),Nr;const s=this.discriminator,n=t.data[s],r=this.optionsMap.get(n);return r?t.common.async?r._parseAsync({data:t.data,path:t.path,parent:t}):r._parseSync({data:t.data,path:t.path,parent:t}):(Ar(t,{code:wr.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),Nr)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){const n=new Map;for(const s of t){const t=ma(s.shape[e]);if(!t)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const r of t){if(n.has(r))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(r)}`);n.set(r,s)}}return new ha({typeName:Ra.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...Rr(s)})}}function ga(e,t){const s=yr(e),n=yr(t);if(e===t)return{valid:!0,data:e};if(s===vr.object&&n===vr.object){const s=fr.objectKeys(t),n=fr.objectKeys(e).filter((e=>-1!==s.indexOf(e))),r={...e,...t};for(const s of n){const n=ga(e[s],t[s]);if(!n.valid)return{valid:!1};r[s]=n.data}return{valid:!0,data:r}}if(s===vr.array&&n===vr.array){if(e.length!==t.length)return{valid:!1};const s=[];for(let n=0;n<e.length;n++){const r=ga(e[n],t[n]);if(!r.valid)return{valid:!1};s.push(r.data)}return{valid:!0,data:s}}return s===vr.date&&n===vr.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class fa extends qr{_parse(e){const{status:t,ctx:s}=this._processInputParams(e),n=(e,n)=>{if(Ir(e)||Ir(n))return Nr;const r=ga(e.value,n.value);return r.valid?((Tr(e)||Tr(n))&&t.dirty(),{status:t.value,value:r.data}):(Ar(s,{code:wr.invalid_intersection_types}),Nr)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then((([e,t])=>n(e,t))):n(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}fa.create=(e,t,s)=>new fa({left:e,right:t,typeName:Ra.ZodIntersection,...Rr(s)});class ba extends qr{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==vr.array)return Ar(s,{code:wr.invalid_type,expected:vr.array,received:s.parsedType}),Nr;if(s.data.length<this._def.items.length)return Ar(s,{code:wr.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Nr;!this._def.rest&&s.data.length>this._def.items.length&&(Ar(s,{code:wr.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const n=[...s.data].map(((e,t)=>{const n=this._def.items[t]||this._def.rest;return n?n._parse(new zr(s,e,s.path,t)):null})).filter((e=>!!e));return s.common.async?Promise.all(n).then((e=>jr.mergeArray(t,e))):jr.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new ba({...this._def,rest:e})}}ba.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ba({items:e,typeName:Ra.ZodTuple,rest:null,...Rr(t)})};class _a extends qr{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==vr.object)return Ar(s,{code:wr.invalid_type,expected:vr.object,received:s.parsedType}),Nr;const n=[],r=this._def.keyType,a=this._def.valueType;for(const e in s.data)n.push({key:r._parse(new zr(s,e,s.path,e)),value:a._parse(new zr(s,s.data[e],s.path,e))});return s.common.async?jr.mergeObjectAsync(t,n):jr.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,s){return new _a(t instanceof qr?{keyType:e,valueType:t,typeName:Ra.ZodRecord,...Rr(s)}:{keyType:Gr.create(),valueType:e,typeName:Ra.ZodRecord,...Rr(t)})}}class va extends qr{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==vr.map)return Ar(s,{code:wr.invalid_type,expected:vr.map,received:s.parsedType}),Nr;const n=this._def.keyType,r=this._def.valueType,a=[...s.data.entries()].map((([e,t],a)=>({key:n._parse(new zr(s,e,s.path,[a,"key"])),value:r._parse(new zr(s,t,s.path,[a,"value"]))})));if(s.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const s of a){const n=await s.key,r=await s.value;if("aborted"===n.status||"aborted"===r.status)return Nr;"dirty"!==n.status&&"dirty"!==r.status||t.dirty(),e.set(n.value,r.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const s of a){const n=s.key,r=s.value;if("aborted"===n.status||"aborted"===r.status)return Nr;"dirty"!==n.status&&"dirty"!==r.status||t.dirty(),e.set(n.value,r.value)}return{status:t.value,value:e}}}}va.create=(e,t,s)=>new va({valueType:t,keyType:e,typeName:Ra.ZodMap,...Rr(s)});class ya extends qr{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==vr.set)return Ar(s,{code:wr.invalid_type,expected:vr.set,received:s.parsedType}),Nr;const n=this._def;null!==n.minSize&&s.data.size<n.minSize.value&&(Ar(s,{code:wr.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),null!==n.maxSize&&s.data.size>n.maxSize.value&&(Ar(s,{code:wr.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());const r=this._def.valueType;function a(e){const s=new Set;for(const n of e){if("aborted"===n.status)return Nr;"dirty"===n.status&&t.dirty(),s.add(n.value)}return{status:t.value,value:s}}const o=[...s.data.values()].map(((e,t)=>r._parse(new zr(s,e,s.path,t))));return s.common.async?Promise.all(o).then((e=>a(e))):a(o)}min(e,t){return new ya({...this._def,minSize:{value:e,message:Fr.toString(t)}})}max(e,t){return new ya({...this._def,maxSize:{value:e,message:Fr.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}ya.create=(e,t)=>new ya({valueType:e,minSize:null,maxSize:null,typeName:Ra.ZodSet,...Rr(t)});class wa extends qr{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==vr.function)return Ar(t,{code:wr.invalid_type,expected:vr.function,received:t.parsedType}),Nr;function s(e,s){return Sr({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Cr(),kr].filter((e=>!!e)),issueData:{code:wr.invalid_arguments,argumentsError:s}})}function n(e,s){return Sr({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Cr(),kr].filter((e=>!!e)),issueData:{code:wr.invalid_return_type,returnTypeError:s}})}const r={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof Aa){const e=this;return Dr((async function(...t){const o=new xr([]),i=await e._def.args.parseAsync(t,r).catch((e=>{throw o.addIssue(s(t,e)),o})),l=await Reflect.apply(a,this,i);return await e._def.returns._def.type.parseAsync(l,r).catch((e=>{throw o.addIssue(n(l,e)),o}))}))}{const e=this;return Dr((function(...t){const o=e._def.args.safeParse(t,r);if(!o.success)throw new xr([s(t,o.error)]);const i=Reflect.apply(a,this,o.data),l=e._def.returns.safeParse(i,r);if(!l.success)throw new xr([n(i,l.error)]);return l.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new wa({...this._def,args:ba.create(e).rest(oa.create())})}returns(e){return new wa({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,s){return new wa({args:e||ba.create([]).rest(oa.create()),returns:t||oa.create(),typeName:Ra.ZodFunction,...Rr(s)})}}class xa extends qr{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}xa.create=(e,t)=>new xa({getter:e,typeName:Ra.ZodLazy,...Rr(t)});class ka extends qr{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return Ar(t,{received:t.data,code:wr.invalid_literal,expected:this._def.value}),Nr}return{status:"valid",value:e.data}}get value(){return this._def.value}}function Ea(e,t){return new Ca({values:e,typeName:Ra.ZodEnum,...Rr(t)})}ka.create=(e,t)=>new ka({value:e,typeName:Ra.ZodLiteral,...Rr(t)});class Ca extends qr{_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),s=this._def.values;return Ar(t,{expected:fr.joinValues(s),received:t.parsedType,code:wr.invalid_type}),Nr}if(-1===this._def.values.indexOf(e.data)){const t=this._getOrReturnCtx(e),s=this._def.values;return Ar(t,{received:t.data,code:wr.invalid_enum_value,options:s}),Nr}return Dr(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e){return Ca.create(e)}exclude(e){return Ca.create(this.options.filter((t=>!e.includes(t))))}}Ca.create=Ea;class Sa extends qr{_parse(e){const t=fr.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==vr.string&&s.parsedType!==vr.number){const e=fr.objectValues(t);return Ar(s,{expected:fr.joinValues(e),received:s.parsedType,code:wr.invalid_type}),Nr}if(-1===t.indexOf(e.data)){const e=fr.objectValues(t);return Ar(s,{received:s.data,code:wr.invalid_enum_value,options:e}),Nr}return Dr(e.data)}get enum(){return this._def.values}}Sa.create=(e,t)=>new Sa({values:e,typeName:Ra.ZodNativeEnum,...Rr(t)});class Aa extends qr{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==vr.promise&&!1===t.common.async)return Ar(t,{code:wr.invalid_type,expected:vr.promise,received:t.parsedType}),Nr;const s=t.parsedType===vr.promise?t.data:Promise.resolve(t.data);return Dr(s.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}Aa.create=(e,t)=>new Aa({type:e,typeName:Ra.ZodPromise,...Rr(t)});class ja extends qr{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ra.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:s}=this._processInputParams(e),n=this._def.effect||null,r={addIssue:e=>{Ar(s,e),e.fatal?t.abort():t.dirty()},get path(){return s.path}};if(r.addIssue=r.addIssue.bind(r),"preprocess"===n.type){const e=n.transform(s.data,r);return s.common.issues.length?{status:"dirty",value:s.data}:s.common.async?Promise.resolve(e).then((e=>this._def.schema._parseAsync({data:e,path:s.path,parent:s}))):this._def.schema._parseSync({data:e,path:s.path,parent:s})}if("refinement"===n.type){const e=e=>{const t=n.refinement(e,r);if(s.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===s.common.async){const n=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return"aborted"===n.status?Nr:("dirty"===n.status&&t.dirty(),e(n.value),{status:t.value,value:n.value})}return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then((s=>"aborted"===s.status?Nr:("dirty"===s.status&&t.dirty(),e(s.value).then((()=>({status:t.value,value:s.value}))))))}if("transform"===n.type){if(!1===s.common.async){const e=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!Mr(e))return e;const a=n.transform(e.value,r);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:a}}return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then((e=>Mr(e)?Promise.resolve(n.transform(e.value,r)).then((e=>({status:t.value,value:e}))):e))}fr.assertNever(n)}}ja.create=(e,t,s)=>new ja({schema:e,typeName:Ra.ZodEffects,effect:t,...Rr(s)}),ja.createWithPreprocess=(e,t,s)=>new ja({schema:t,effect:{type:"preprocess",transform:e},typeName:Ra.ZodEffects,...Rr(s)});class Na extends qr{_parse(e){return this._getType(e)===vr.undefined?Dr(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Na.create=(e,t)=>new Na({innerType:e,typeName:Ra.ZodOptional,...Rr(t)});class La extends qr{_parse(e){return this._getType(e)===vr.null?Dr(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}La.create=(e,t)=>new La({innerType:e,typeName:Ra.ZodNullable,...Rr(t)});class Da extends qr{_parse(e){const{ctx:t}=this._processInputParams(e);let s=t.data;return t.parsedType===vr.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Da.create=(e,t)=>new Da({innerType:e,typeName:Ra.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...Rr(t)});class Ia extends qr{_parse(e){const{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return Or(n)?n.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new xr(s.common.issues)},input:s.data})}))):{status:"valid",value:"valid"===n.status?n.value:this._def.catchValue({get error(){return new xr(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}Ia.create=(e,t)=>new Ia({innerType:e,typeName:Ra.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...Rr(t)});class Ta extends qr{_parse(e){if(this._getType(e)!==vr.nan){const t=this._getOrReturnCtx(e);return Ar(t,{code:wr.invalid_type,expected:vr.nan,received:t.parsedType}),Nr}return{status:"valid",value:e.data}}}Ta.create=e=>new Ta({typeName:Ra.ZodNaN,...Rr(e)});const Ma=Symbol("zod_brand");class Oa extends qr{_parse(e){const{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}}class Fa extends qr{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{const e=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return"aborted"===e.status?Nr:"dirty"===e.status?(t.dirty(),Lr(e.value)):this._def.out._parseAsync({data:e.value,path:s.path,parent:s})})();{const e=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return"aborted"===e.status?Nr:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:s.path,parent:s})}}static create(e,t){return new Fa({in:e,out:t,typeName:Ra.ZodPipeline})}}class Ba extends qr{_parse(e){const t=this._def.innerType._parse(e);return Mr(t)&&(t.value=Object.freeze(t.value)),t}}Ba.create=(e,t)=>new Ba({innerType:e,typeName:Ra.ZodReadonly,...Rr(t)});const za=(e,t={},s)=>e?aa.create().superRefine(((n,r)=>{var a,o;if(!e(n)){const e="function"==typeof t?t(n):"string"==typeof t?{message:t}:t,i=null===(o=null!==(a=e.fatal)&&void 0!==a?a:s)||void 0===o||o,l="string"==typeof e?{message:e}:e;r.addIssue({code:"custom",...l,fatal:i})}})):aa.create(),Pa={object:ua.lazycreate};var Ra,qa;(qa=Ra||(Ra={})).ZodString="ZodString",qa.ZodNumber="ZodNumber",qa.ZodNaN="ZodNaN",qa.ZodBigInt="ZodBigInt",qa.ZodBoolean="ZodBoolean",qa.ZodDate="ZodDate",qa.ZodSymbol="ZodSymbol",qa.ZodUndefined="ZodUndefined",qa.ZodNull="ZodNull",qa.ZodAny="ZodAny",qa.ZodUnknown="ZodUnknown",qa.ZodNever="ZodNever",qa.ZodVoid="ZodVoid",qa.ZodArray="ZodArray",qa.ZodObject="ZodObject",qa.ZodUnion="ZodUnion",qa.ZodDiscriminatedUnion="ZodDiscriminatedUnion",qa.ZodIntersection="ZodIntersection",qa.ZodTuple="ZodTuple",qa.ZodRecord="ZodRecord",qa.ZodMap="ZodMap",qa.ZodSet="ZodSet",qa.ZodFunction="ZodFunction",qa.ZodLazy="ZodLazy",qa.ZodLiteral="ZodLiteral",qa.ZodEnum="ZodEnum",qa.ZodEffects="ZodEffects",qa.ZodNativeEnum="ZodNativeEnum",qa.ZodOptional="ZodOptional",qa.ZodNullable="ZodNullable",qa.ZodDefault="ZodDefault",qa.ZodCatch="ZodCatch",qa.ZodPromise="ZodPromise",qa.ZodBranded="ZodBranded",qa.ZodPipeline="ZodPipeline",qa.ZodReadonly="ZodReadonly";const Za=Gr.create,Ha=Jr.create,Ua=Ta.create,$a=Xr.create,Va=ea.create,Wa=ta.create,Ka=sa.create,Qa=na.create,Ga=ra.create,Ya=aa.create,Ja=oa.create,Xa=ia.create,eo=la.create,to=da.create,so=ua.create,no=ua.strictCreate,ro=pa.create,ao=ha.create,oo=fa.create,io=ba.create,lo=_a.create,co=va.create,uo=ya.create,po=wa.create,mo=xa.create,ho=ka.create,go=Ca.create,fo=Sa.create,bo=Aa.create,_o=ja.create,vo=Na.create,yo=La.create,wo=ja.createWithPreprocess,xo=Fa.create,ko={string:e=>Gr.create({...e,coerce:!0}),number:e=>Jr.create({...e,coerce:!0}),boolean:e=>ea.create({...e,coerce:!0}),bigint:e=>Xr.create({...e,coerce:!0}),date:e=>ta.create({...e,coerce:!0})},Eo=Nr;var Co=Object.freeze({__proto__:null,defaultErrorMap:kr,setErrorMap:function(e){Er=e},getErrorMap:Cr,makeIssue:Sr,EMPTY_PATH:[],addIssueToContext:Ar,ParseStatus:jr,INVALID:Nr,DIRTY:Lr,OK:Dr,isAborted:Ir,isDirty:Tr,isValid:Mr,isAsync:Or,get util(){return fr},get objectUtil(){return _r},ZodParsedType:vr,getParsedType:yr,ZodType:qr,ZodString:Gr,ZodNumber:Jr,ZodBigInt:Xr,ZodBoolean:ea,ZodDate:ta,ZodSymbol:sa,ZodUndefined:na,ZodNull:ra,ZodAny:aa,ZodUnknown:oa,ZodNever:ia,ZodVoid:la,ZodArray:da,ZodObject:ua,ZodUnion:pa,ZodDiscriminatedUnion:ha,ZodIntersection:fa,ZodTuple:ba,ZodRecord:_a,ZodMap:va,ZodSet:ya,ZodFunction:wa,ZodLazy:xa,ZodLiteral:ka,ZodEnum:Ca,ZodNativeEnum:Sa,ZodPromise:Aa,ZodEffects:ja,ZodTransformer:ja,ZodOptional:Na,ZodNullable:La,ZodDefault:Da,ZodCatch:Ia,ZodNaN:Ta,BRAND:Ma,ZodBranded:Oa,ZodPipeline:Fa,ZodReadonly:Ba,custom:za,Schema:qr,ZodSchema:qr,late:Pa,get ZodFirstPartyTypeKind(){return Ra},coerce:ko,any:Ya,array:to,bigint:$a,boolean:Va,date:Wa,discriminatedUnion:ao,effect:_o,enum:go,function:po,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>za((t=>t instanceof e),t),intersection:oo,lazy:mo,literal:ho,map:co,nan:Ua,nativeEnum:fo,never:Xa,null:Ga,nullable:yo,number:Ha,object:so,oboolean:()=>Va().optional(),onumber:()=>Ha().optional(),optional:vo,ostring:()=>Za().optional(),pipeline:xo,preprocess:wo,promise:bo,record:lo,set:uo,strictObject:no,string:Za,symbol:Ka,transformer:_o,tuple:io,undefined:Qa,union:ro,unknown:Ja,void:eo,NEVER:Eo,ZodIssueCode:wr,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:xr});Co.string(),Co.number(),Co.number().optional();const So=Co.string().regex(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/),Ao=Co.enum(["bottomLeft","bottomRight","topLeft","topRight","center"]),jo=Co.enum(["png","jpeg","jpg","pdf","doc","docx","xls","xlsx","ppt","pptx","plain","csv","mp4","mov","avi","mkv","webm","zip","rar","7z","tar"]),No=Co.object({enabled:Co.boolean(),headline:Co.optional(Co.string()),subheader:Co.optional(Co.string())});var Lo=(e=>(e.FileUpload="fileUpload",e.OpenText="openText",e.MultipleChoiceSingle="multipleChoiceSingle",e.MultipleChoiceMulti="multipleChoiceMulti",e.NPS="nps",e.CTA="cta",e.Rating="rating",e.Consent="consent",e.PictureSelection="pictureSelection",e))(Lo||{});const Do=Co.object({enabled:Co.boolean(),headline:Co.optional(Co.string()),html:Co.string().optional(),fileUrl:Co.string().optional(),buttonLabel:Co.string().optional(),timeToFinish:Co.boolean().default(!0)}),Io=Co.object({enabled:Co.boolean(),fieldIds:Co.optional(Co.array(Co.string()))}),To=Co.object({brandColor:So.nullish(),highlightBorderColor:So.nullish(),placement:Ao.nullish(),clickOutsideClose:Co.boolean().nullish(),darkOverlay:Co.boolean().nullish()}),Mo=Co.object({enabled:Co.boolean().optional(),heading:Co.string().optional(),subheading:Co.string().optional()}).nullable().optional(),Oo=Co.object({enabled:Co.boolean(),heading:Co.optional(Co.string()),subheading:Co.optional(Co.string()),isEncrypted:Co.boolean()}).nullable(),Fo=Co.object({name:Co.optional(Co.string()),subheading:Co.optional(Co.string())}).optional(),Bo=Co.object({id:Co.string(),label:Co.string()}),zo=Co.object({id:Co.string(),imageUrl:Co.string()}),Po=Co.enum(["accepted","clicked","submitted","skipped","equals","notEquals","lessThan","lessEqual","greaterThan","greaterEqual","includesAll","includesOne","uploaded","notUploaded"]),Ro=Co.object({condition:Po.optional(),value:Co.union([Co.string(),Co.array(Co.string())]).optional(),destination:Co.union([Co.string(),Co.literal("end")]).optional()}),qo=Ro.extend({condition:Co.enum(["uploaded","notUploaded"]).optional(),value:Co.undefined()}),Zo=Ro.extend({condition:Co.enum(["submitted","skipped"]).optional(),value:Co.undefined()}),Ho=Ro.extend({condition:Co.enum(["skipped","accepted"]).optional(),value:Co.undefined()}),Uo=Ro.extend({condition:Co.enum(["submitted","skipped","equals","notEquals"]).optional(),value:Co.string().optional()}),$o=Ro.extend({condition:Co.enum(["submitted","skipped","includesAll","includesOne","equals"]).optional(),value:Co.union([Co.array(Co.string()),Co.string()]).optional()}),Vo=Ro.extend({condition:Co.enum(["equals","notEquals","lessThan","lessEqual","greaterThan","greaterEqual","submitted","skipped"]).optional(),value:Co.union([Co.string(),Co.number()]).optional()}),Wo=Ro.extend({condition:Co.enum(["clicked","submitted","skipped"]).optional(),value:Co.undefined()}),Ko=Ro.extend({condition:Co.enum(["equals","notEquals","lessThan","lessEqual","greaterThan","greaterEqual","submitted","skipped"]).optional(),value:Co.union([Co.string(),Co.number()]).optional()}),Qo=Ro.extend({condition:Co.enum(["submitted","skipped"]).optional(),value:Co.undefined()}),Go=Co.union([Zo,Ho,Uo,$o,Vo,Wo,Ko,Qo,qo]),Yo=Co.object({id:Co.string(),type:Co.string(),headline:Co.string(),subheader:Co.string().optional(),imageUrl:Co.string().optional(),required:Co.boolean(),buttonLabel:Co.string().optional(),backButtonLabel:Co.string().optional(),scale:Co.enum(["number","smiley","star"]).optional(),range:Co.union([Co.literal(5),Co.literal(3),Co.literal(4),Co.literal(7),Co.literal(10)]).optional(),logic:Co.array(Go).optional(),isDraft:Co.boolean().optional()}),Jo=Yo.extend({type:Co.literal("fileUpload"),allowMultipleFiles:Co.boolean(),maxSizeInMB:Co.number().optional(),allowedFileExtensions:Co.array(jo).optional(),logic:Co.array(qo).optional()}),Xo=Co.enum(["text","email","url","number","phone"]),ei=Yo.extend({type:Co.literal("openText"),placeholder:Co.string().optional(),longAnswer:Co.boolean().optional(),logic:Co.array(Zo).optional(),inputType:Xo.optional().default("text")}),ti=Yo.extend({type:Co.literal("consent"),html:Co.string().optional(),label:Co.string(),dismissButtonLabel:Co.string().optional(),placeholder:Co.string().optional(),logic:Co.array(Ho).optional()}),si=Yo.extend({type:Co.literal("multipleChoiceSingle"),choices:Co.array(Bo),logic:Co.array(Uo).optional(),shuffleOption:Co.enum(["none","all","exceptLast"]).optional()}),ni=Yo.extend({type:Co.literal("multipleChoiceMulti"),choices:Co.array(Bo),logic:Co.array($o).optional(),shuffleOption:Co.enum(["none","all","exceptLast"]).optional()}),ri=Yo.extend({type:Co.literal("nps"),lowerLabel:Co.string(),upperLabel:Co.string(),logic:Co.array(Vo).optional()}),ai=Yo.extend({type:Co.literal("cta"),html:Co.string().optional(),buttonUrl:Co.string().optional(),buttonExternal:Co.boolean(),dismissButtonLabel:Co.string().optional(),logic:Co.array(Wo).optional()}),oi=Yo.extend({type:Co.literal("rating"),scale:Co.enum(["number","smiley","star"]),range:Co.union([Co.literal(5),Co.literal(3),Co.literal(4),Co.literal(7),Co.literal(10)]),lowerLabel:Co.string(),upperLabel:Co.string(),logic:Co.array(Ko).optional()}),ii=Yo.extend({type:Co.literal("pictureSelection"),allowMulti:Co.boolean().optional().default(!1),choices:Co.array(zo),logic:Co.array(Qo).optional()}),li=Co.union([ei,ti,si,ni,ri,ai,oi,ii,Jo]),di=Co.array(li),ci=Co.object({attributeClassId:Co.string().cuid2(),condition:Co.enum(["equals","notEquals"]),value:Co.string()}),ui=Co.enum(["displayOnce","displayMultiple","respondMultiple"]),pi=Co.enum(["web","email","link","mobile"]),mi=Co.enum(["draft","inProgress","paused","completed"]);function hi({question:e,value:t,onChange:s,onSubmit:n,onBack:r,isFirstQuestion:a,isLastQuestion:o,autoFocus:i=!0,ttc:l,setTtc:d,surveyId:c,onFileUpload:u}){return e.type===Lo.OpenText?Ts(sr,{question:e,value:t,onChange:s,onSubmit:n,onBack:r,isFirstQuestion:a,isLastQuestion:o,autoFocus:i,ttc:l,setTtc:d}):e.type===Lo.MultipleChoiceSingle?Ts(er,{question:e,value:t,onChange:s,onSubmit:n,onBack:r,isFirstQuestion:a,isLastQuestion:o,ttc:l,setTtc:d}):e.type===Lo.MultipleChoiceMulti?Ts(Xn,{question:e,value:t,onChange:s,onSubmit:n,onBack:r,isFirstQuestion:a,isLastQuestion:o,ttc:l,setTtc:d}):e.type===Lo.NPS?Ts(tr,{question:e,value:t,onChange:s,onSubmit:n,onBack:r,isFirstQuestion:a,isLastQuestion:o,ttc:l,setTtc:d}):e.type===Lo.CTA?Ts(Kn,{question:e,value:t,onChange:s,onSubmit:n,onBack:r,isFirstQuestion:a,isLastQuestion:o,ttc:l,setTtc:d}):e.type===Lo.Rating?Ts(hr,{question:e,value:t,onChange:s,onSubmit:n,onBack:r,isFirstQuestion:a,isLastQuestion:o,ttc:l,setTtc:d}):e.type===Lo.Consent?Ts(Qn,{question:e,value:t,onChange:s,onSubmit:n,onBack:r,isFirstQuestion:a,isLastQuestion:o,ttc:l,setTtc:d}):e.type===Lo.PictureSelection?Ts(nr,{question:e,value:t,onChange:s,onSubmit:n,onBack:r,isFirstQuestion:a,isLastQuestion:o,ttc:l,setTtc:d}):e.type===Lo.FileUpload?Ts(Jn,{surveyId:c,question:e,value:t,onChange:s,onSubmit:n,onBack:r,isFirstQuestion:a,isLastQuestion:o,onFileUpload:u,ttc:l,setTtc:d}):null}Co.object({id:Co.string().cuid2(),createdAt:Co.date(),updatedAt:Co.date(),name:Co.string(),type:pi,environmentId:Co.string(),status:mi,attributeFilters:Co.array(ci),displayOption:ui,autoClose:Co.number().nullable(),triggers:Co.array(Co.string()),redirectUrl:Co.string().url().nullable(),recontactDays:Co.number().nullable(),welcomeCard:Do,questions:di,thankYouCard:No,hiddenFields:Io,delay:Co.number(),autoComplete:Co.number().nullable(),closeOnDate:Co.date().nullable(),productOverwrites:To.nullable(),surveyClosedMessage:Mo.nullable(),singleUse:Oo.nullable(),verifyEmail:Fo.nullable(),pin:Co.string().nullable().optional()}),Co.object({name:Co.string(),type:pi.optional(),status:mi.optional(),displayOption:ui.optional(),autoClose:Co.number().optional(),redirectUrl:Co.string().url().optional(),recontactDays:Co.number().optional(),welcomeCard:Do.optional(),questions:di.optional(),thankYouCard:No.optional(),hiddenFields:Io,delay:Co.number().optional(),autoComplete:Co.number().optional(),closeOnDate:Co.date().optional(),surveyClosedMessage:Mo.optional(),verifyEmail:Fo.optional(),attributeFilters:Co.array(ci).optional(),triggers:Co.array(Co.string()).optional()}),Co.union([Co.literal("fileUpload"),Co.literal("openText"),Co.literal("multipleChoiceSingle"),Co.literal("multipleChoiceMulti"),Co.literal("nps"),Co.literal("cta"),Co.literal("rating"),Co.literal("consent"),Co.literal("pictureSelection")]);const gi=5;function fi({redirectUrl:e,isRedirectDisabled:t}){const[s,n]=Ks(gi);return Qs((()=>{if(e){const s=setInterval((()=>{n((n=>n<=0?(clearInterval(s),t||(window.location.href=e),0):n-1))}),1e3)}return()=>clearInterval(void 0)}),[e,t]),e?Ts("div",{children:Ts("div",{className:"bg-accent-bg text-subheading mt-10 rounded-md p-2 text-sm",children:[Ts("span",{children:"You're redirected in "}),Ts("span",{children:s})]})}):null}function bi({headline:e,subheader:t,redirectUrl:s,isRedirectDisabled:n}){return Ts("div",{className:"text-center",children:[Ts("div",{className:"text-brand flex items-center justify-center",children:Ts("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"h-24 w-24",children:Ts("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),Ts("span",{className:"bg-shadow mb-[10px] inline-block h-1 w-16 rounded-[100%]"}),Ts("div",{children:[Ts(bn,{alignTextCenter:!0,headline:e,questionId:"thankYouCard"}),Ts(Yn,{subheader:t,questionId:"thankYouCard"}),Ts(fi,{redirectUrl:s,isRedirectDisabled:n})]})]})}const _i=()=>Ts("div",{className:"mr-1",children:Ts("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"currentColor",class:"bi bi-stopwatch",viewBox:"0 0 16 16",children:[Ts("path",{d:"M8.5 5.6a.5.5 0 1 0-1 0v2.9h-3a.5.5 0 0 0 0 1H8a.5.5 0 0 0 .5-.5V5.6z"}),Ts("path",{d:"M6.5 1A.5.5 0 0 1 7 .5h2a.5.5 0 0 1 0 1v.57c1.36.196 2.594.78 3.584 1.64a.715.715 0 0 1 .012-.013l.354-.354-.354-.353a.5.5 0 0 1 .707-.708l1.414 1.415a.5.5 0 1 1-.707.707l-.353-.354-.354.354a.512.512 0 0 1-.013.012A7 7 0 1 1 7 2.071V1.5a.5.5 0 0 1-.5-.5zM8 3a6 6 0 1 0 .001 12A6 6 0 0 0 8 3z"})]})});function vi({headline:e,html:t,fileUrl:s,buttonLabel:n,timeToFinish:r,onSubmit:a,survey:o}){return Ts("div",{children:[s&&Ts("img",{src:s,className:"mb-8 max-h-96 w-1/3 rounded-lg object-contain",alt:"Company Logo"}),Ts(bn,{headline:e,questionId:"welcomeCard"}),Ts(yn,{htmlString:t,questionId:"welcomeCard"}),Ts("div",{className:"mt-10 flex w-full justify-between",children:Ts("div",{className:"flex w-full justify-start gap-4",children:[Ts(gn,{buttonLabel:n,isLastQuestion:!1,focus:!0,onClick:()=>{a({welcomeCard:"clicked"},{})},type:"button"}),Ts("div",{className:"text-subheading flex items-center text-xs",children:"Press Enter ↵"})]})}),r&&Ts("div",{className:"item-center mt-4 flex text-slate-500",children:[Ts(_i,{}),Ts("p",{className:"text-xs",children:["Takes ",(()=>{let e=mn(o,0);.5===e&&(e=1);const t=o.questions.length/e*15;if(t>360)return"6+ minutes";const s=Math.floor(t/60);return t%60>0?0===s?"less than 1 minute":`less than ${s+1} minutes`:`${s} minutes`})()]})]})]})}function yi({survey:e,questionId:t}){const s=Ys((()=>e.questions.findIndex((e=>e.id===t))),[e,t]),n=Js(((e,t,s)=>{if(0===t.questions.length)return 0;let n=t.questions.findIndex((t=>t.id===e));-1===n&&(n=0);const r=mn(t,n)/t.questions.length;let a=s;return r>s?a=r:r<=s&&s+.1<=1&&(a=s+.1),a}),[]),r=Ys((()=>{let t=0,s=[];return e.questions.forEach((r=>{t=n(r.id,e,t),s.push(t)})),s}),[n,e]);return Ts(on,{progress:"end"===t?1:r[s]})}function wi({survey:e,isBrandingEnabled:t,activeQuestionId:s,onDisplay:n=(()=>{}),onActiveQuestionChange:r=(()=>{}),onResponse:a=(()=>{}),onClose:o=(()=>{}),onFinished:i=(()=>{}),isRedirectDisabled:l=!1,prefillResponseData:d,onFileUpload:c}){var u;const[p,m]=Ks(s||(e.welcomeCard.enabled?"start":null==(u=null==e?void 0:e.questions[0])?void 0:u.id)),[h,g]=Ks(!1),[f,b]=Ks([]),[_,v]=Ks({}),y=e.questions.findIndex((e=>e.id===p)),w=e.questions[y],x=Gs(null),[k,E]=Ks({});Qs((()=>{var t,n;"hidden"!==s&&("start"!==s||e.welcomeCard.enabled?m(s||(e.welcomeCard.enabled?"start":null==(n=null==e?void 0:e.questions[0])?void 0:n.id)):m(null==(t=null==e?void 0:e.questions[0])?void 0:t.id))}),[s,e.questions,e.welcomeCard.enabled]),Qs((()=>{x.current&&(x.current.scrollTop=0)}),[p]),Qs((()=>{n(),d&&j(d,{},!0)}),[]);let C=y,S=w;const A=e=>{const t={..._,...e};v(t)},j=(t,s,n=!1)=>{const o=Object.keys(t)[0];g(!0);const l=function(t,s=!1){var n,r;const a=e.questions,o=t[p];if("start"===p){if(!s)return(null==(n=a[0])?void 0:n.id)||"end";C=0,S=a[0]}if(-1===C)throw new Error("Question not found");if((null==S?void 0:S.logic)&&(null==S?void 0:S.logic.length)>0)for(let e of S.logic)if(e.destination&&dn(e,o))return e.destination;return(null==(r=a[C+1])?void 0:r.id)||"end"}(t,n),d="end"===l;a({data:t,ttc:s,finished:d}),d&&i(),m(l),b([...f,o]),g(!1),r(l)},N=()=>{var t;let s;if((null==f?void 0:f.length)>0){const t=[...f];if(s=t.pop(),d&&s===e.questions[0].id)return;b(t)}else s=null==(t=e.questions[C-1])?void 0:t.id;if(!s)throw new Error("Question not found");m(s),r(s)};return Ts(ms,{children:Ts(ln,{survey:e,onClose:o,children:Ts("div",{className:"flex h-full w-full flex-col justify-between bg-[--fb-survey-background-color] px-6 pb-3 pt-6",children:[Ts("div",{ref:x,className:cn(h?"animate-pulse opacity-60":"","my-auto"),children:0!==e.questions.length||e.welcomeCard.enabled||e.thankYouCard.enabled?function(){var t;if("start"===p&&e.welcomeCard.enabled)return Ts(vi,{headline:e.welcomeCard.headline,html:e.welcomeCard.html,fileUrl:e.welcomeCard.fileUrl,buttonLabel:e.welcomeCard.buttonLabel,timeToFinish:e.welcomeCard.timeToFinish,onSubmit:j,survey:e});if("end"===p&&e.thankYouCard.enabled)return Ts(bi,{headline:e.thankYouCard.headline,subheader:e.thankYouCard.subheader,redirectUrl:e.redirectUrl,isRedirectDisabled:l});{const s=e.questions.find((e=>e.id===p));return s&&Ts(hi,{surveyId:e.id,question:s,value:_[s.id],onChange:A,onSubmit:j,onBack:N,ttc:k,setTtc:E,onFileUpload:c,isFirstQuestion:f&&d?f[f.length-1]===e.questions[0].id:s.id===(null==(t=null==e?void 0:e.questions[0])?void 0:t.id),isLastQuestion:s.id===e.questions[e.questions.length-1].id})}}():Ts("div",{children:"No questions available."})}),Ts("div",{className:"mt-8",children:[t&&Ts(Ms,{}),Ts(yi,{survey:e,questionId:p})]})]})})})}function xi({children:e,isOpen:t,placement:s,clickOutside:n,darkOverlay:r,highlightBorderColor:a,onClose:o}){const[i,l]=Ks(!1),d="center"===s,c=Gs(null);Qs((()=>{l(t)}),[t]),Qs((()=>{if(d)return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)};function e(e){n&&i&&c.current&&!c.current.contains(e.target)&&o()}}),[i,n,o,d]);const u=Ys((()=>a?{borderRadius:"8px",border:"2px solid",overflow:"hidden",borderColor:a}:{}),[a]);return i?Ts("div",{"aria-live":"assertive",className:cn(d?"pointer-events-auto":"pointer-events-none","z-999999 fixed inset-0 flex items-end"),children:Ts("div",{className:cn("relative h-full w-full",d?r?"bg-gray-700/80":"bg-white/50":"bg-none transition-all duration-500 ease-in-out"),children:Ts("div",{ref:c,className:cn((e=>{switch(e){case"bottomRight":default:return"sm:bottom-3 sm:right-3";case"topRight":return"sm:top-3 sm:right-3 sm:bottom-3";case"topLeft":return"sm:top-3 sm:left-3 sm:bottom-3";case"bottomLeft":return"sm:bottom-3 sm:left-3";case"center":return"sm:top-1/2 sm:left-1/2 sm:transform sm:-translate-x-1/2 sm:-translate-y-1/2"}})(s),i?"opacity-100":"opacity-0","border-border pointer-events-auto absolute bottom-0 h-fit w-full overflow-hidden rounded-lg border bg-white shadow-lg transition-all duration-500 ease-in-out sm:m-4 sm:max-w-sm"),children:[!d&&Ts("div",{class:"absolute right-0 top-0 block pr-2 pt-2",children:Ts("button",{type:"button",onClick:o,class:"text-close-button hover:text-close-button-focus focus:ring-close-button-focus relative h-5 w-5 rounded-md focus:outline-none focus:ring-2 focus:ring-offset-2",children:[Ts("span",{class:"sr-only",children:"Close survey"}),Ts("svg",{class:"h-4 w-4",fill:"none",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor","aria-hidden":"true",children:Ts("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M4 4L20 20M4 20L20 4"})})]})}),Ts("div",{style:u,children:e})]})})}):null}function ki({survey:e,isBrandingEnabled:t,activeQuestionId:s,placement:n,clickOutside:r,darkOverlay:a,highlightBorderColor:o,onDisplay:i=(()=>{}),onActiveQuestionChange:l=(()=>{}),onResponse:d=(()=>{}),onClose:c=(()=>{}),onFinished:u=(()=>{}),onFileUpload:p,isRedirectDisabled:m=!1}){const[h,g]=Ks(!0),f=()=>{g(!1),setTimeout((()=>{c()}),1e3)};return Ts("div",{id:"fbjs",className:"formbricks-form",children:Ts(xi,{placement:n,clickOutside:r,darkOverlay:a,highlightBorderColor:o,isOpen:h,onClose:f,children:Ts(wi,{survey:e,isBrandingEnabled:t,activeQuestionId:s,onDisplay:i,onActiveQuestionChange:l,onResponse:d,onClose:c,onFinished:()=>{u(),setTimeout((()=>{e.redirectUrl||f()}),4e3)},onFileUpload:p,isRedirectDisabled:m})})})}const Ei=e=>{(()=>{if(null===document.getElementById("formbricks__css")){const e=document.createElement("style");e.id="formbricks__css",e.innerHTML='#fbjs *,#fbjs :before,#fbjs :after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}#fbjs :before,#fbjs :after{--tw-content: ""}#fbjs html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal}#fbjs body{margin:0;line-height:inherit}#fbjs hr{height:0;color:inherit;border-top-width:1px}#fbjs abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}#fbjs h1,#fbjs h2,#fbjs h3,#fbjs h4,#fbjs h5,#fbjs h6{font-size:inherit;font-weight:inherit}#fbjs a{color:inherit;text-decoration:inherit}#fbjs b,#fbjs strong{font-weight:bolder}#fbjs code,#fbjs kbd,#fbjs samp,#fbjs pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}#fbjs small{font-size:80%}#fbjs sub,#fbjs sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}#fbjs sub{bottom:-.25em}#fbjs sup{top:-.5em}#fbjs table{text-indent:0;border-color:inherit;border-collapse:collapse}#fbjs button,#fbjs input,#fbjs optgroup,#fbjs select,#fbjs textarea{font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}#fbjs button,#fbjs select{text-transform:none}#fbjs button,#fbjs [type=button],#fbjs [type=reset],#fbjs [type=submit]{-webkit-appearance:button;background-color:transparent;background-image:none}#fbjs :-moz-focusring{outline:auto}#fbjs :-moz-ui-invalid{box-shadow:none}#fbjs progress{vertical-align:baseline}#fbjs ::-webkit-inner-spin-button,#fbjs ::-webkit-outer-spin-button{height:auto}#fbjs [type=search]{-webkit-appearance:textfield;outline-offset:-2px}#fbjs ::-webkit-search-decoration{-webkit-appearance:none}#fbjs ::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}#fbjs summary{display:list-item}#fbjs blockquote,#fbjs dl,#fbjs dd,#fbjs h1,#fbjs h2,#fbjs h3,#fbjs h4,#fbjs h5,#fbjs h6,#fbjs hr,#fbjs figure,#fbjs p,#fbjs pre{margin:0}#fbjs fieldset{margin:0;padding:0}#fbjs legend{padding:0}#fbjs ol,#fbjs ul,#fbjs menu{list-style:none;margin:0;padding:0}#fbjs textarea{resize:vertical}#fbjs input::-moz-placeholder,#fbjs textarea::-moz-placeholder{opacity:1;color:#9ca3af}#fbjs input::placeholder,#fbjs textarea::placeholder{opacity:1;color:#9ca3af}#fbjs button,#fbjs [role=button]{cursor:pointer}#fbjs :disabled{cursor:default}#fbjs img,#fbjs svg,#fbjs video,#fbjs canvas,#fbjs audio,#fbjs iframe,#fbjs embed,#fbjs object{display:block;vertical-align:middle}#fbjs img,#fbjs video{max-width:100%;height:auto}#fbjs [hidden]{display:none}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.container{width:100%}@media (min-width: 640px){.container{max-width:640px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1536px){.container{max-width:1536px}}#fbjs :is(.sr-only){position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}#fbjs :is(.pointer-events-none){pointer-events:none}#fbjs :is(.pointer-events-auto){pointer-events:auto}#fbjs :is(.visible){visibility:visible}#fbjs :is(.fixed){position:fixed}#fbjs :is(.absolute){position:absolute}#fbjs :is(.relative){position:relative}#fbjs :is(.inset-0){top:0;right:0;bottom:0;left:0}#fbjs :is(.bottom-0){bottom:0}#fbjs :is(.left-0){left:0}#fbjs :is(.right-0){right:0}#fbjs :is(.right-2){right:.5em}#fbjs :is(.top-0){top:0}#fbjs :is(.top-2){top:.5em}#fbjs :is(.z-10){z-index:10}#fbjs :is(.z-20){z-index:20}#fbjs :is(.z-999999){z-index:999999}#fbjs :is(.m-2){margin:.5em}#fbjs :is(.my-4){margin-top:1em;margin-bottom:1em}#fbjs :is(.my-auto){margin-top:auto;margin-bottom:auto}#fbjs :is(.mb-1){margin-bottom:.25em}#fbjs :is(.mb-1\\.5){margin-bottom:.375em}#fbjs :is(.mb-4){margin-bottom:1em}#fbjs :is(.mb-5){margin-bottom:1.25em}#fbjs :is(.mb-8){margin-bottom:2em}#fbjs :is(.mb-\\[10px\\]){margin-bottom:10px}#fbjs :is(.ml-3){margin-left:.75em}#fbjs :is(.mr-1){margin-right:.25em}#fbjs :is(.mr-4){margin-right:1em}#fbjs :is(.mr-\\[3ch\\]){margin-right:3ch}#fbjs :is(.mt-1){margin-top:.25em}#fbjs :is(.mt-10){margin-top:2.5em}#fbjs :is(.mt-2){margin-top:.5em}#fbjs :is(.mt-3){margin-top:.75em}#fbjs :is(.mt-4){margin-top:1em}#fbjs :is(.mt-8){margin-top:2em}#fbjs :is(.box-border){box-sizing:border-box}#fbjs :is(.block){display:block}#fbjs :is(.inline-block){display:inline-block}#fbjs :is(.flex){display:flex}#fbjs :is(.grid){display:grid}#fbjs :is(.hidden){display:none}#fbjs :is(.h-1){height:.25em}#fbjs :is(.h-10){height:2.5em}#fbjs :is(.h-2){height:.5em}#fbjs :is(.h-24){height:6em}#fbjs :is(.h-28){height:7em}#fbjs :is(.h-4){height:1em}#fbjs :is(.h-5){height:1.25em}#fbjs :is(.h-6){height:1.5em}#fbjs :is(.h-8){height:2em}#fbjs :is(.h-fit){height:-moz-fit-content;height:fit-content}#fbjs :is(.h-full){height:100%}#fbjs :is(.max-h-10){max-height:2.5em}#fbjs :is(.max-h-96){max-height:24em}#fbjs :is(.max-h-\\[42vh\\]){max-height:42vh}#fbjs :is(.max-h-full){max-height:100%}#fbjs :is(.w-1\\/2){width:50%}#fbjs :is(.w-1\\/3){width:33.333333%}#fbjs :is(.w-16){width:4em}#fbjs :is(.w-24){width:6em}#fbjs :is(.w-4){width:1em}#fbjs :is(.w-5){width:1.25em}#fbjs :is(.w-8){width:2em}#fbjs :is(.w-full){width:100%}#fbjs :is(.flex-1){flex:1 1 0%}@keyframes pulse{50%{opacity:.5}}#fbjs :is(.animate-pulse){animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}#fbjs :is(.cursor-pointer){cursor:pointer}#fbjs :is(.grid-cols-2){grid-template-columns:repeat(2,minmax(0,1fr))}#fbjs :is(.flex-col){flex-direction:column}#fbjs :is(.items-end){align-items:flex-end}#fbjs :is(.items-center){align-items:center}#fbjs :is(.justify-start){justify-content:flex-start}#fbjs :is(.justify-end){justify-content:flex-end}#fbjs :is(.justify-center){justify-content:center}#fbjs :is(.justify-between){justify-content:space-between}#fbjs :is(.gap-4){gap:1em}#fbjs :is(.gap-x-5){-moz-column-gap:1.25em;column-gap:1.25em}#fbjs :is(.gap-y-4){row-gap:1em}#fbjs :is(.space-y-2>:not([hidden])~:not([hidden])){--tw-space-y-reverse: 0;margin-top:calc(.5em * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5em * var(--tw-space-y-reverse))}#fbjs :is(.self-start){align-self:flex-start}#fbjs :is(.overflow-hidden){overflow:hidden}#fbjs :is(.overflow-y-auto){overflow-y:auto}#fbjs :is(.rounded){border-radius:.25em}#fbjs :is(.rounded-\\[100\\%\\]){border-radius:100%}#fbjs :is(.rounded-full){border-radius:9999px}#fbjs :is(.rounded-lg){border-radius:.5em}#fbjs :is(.rounded-md){border-radius:.375em}#fbjs :is(.rounded-xl){border-radius:.75em}#fbjs :is(.rounded-l-md){border-top-left-radius:.375em;border-bottom-left-radius:.375em}#fbjs :is(.rounded-r-md){border-top-right-radius:.375em;border-bottom-right-radius:.375em}#fbjs :is(.border){border-width:1px}#fbjs :is(.border-2){border-width:2px}#fbjs :is(.border-4){border-width:4px}#fbjs :is(.border-dashed){border-style:dashed}#fbjs :is(.border-back-button-border){border-color:var(--fb-back-btn-border)}#fbjs :is(.border-border){border-color:var(--fb-border-color)}#fbjs :is(.border-border-highlight){border-color:var(--fb-border-color-highlight)}#fbjs :is(.border-brand){border-color:var(--fb-brand-color)}#fbjs :is(.border-slate-300){--tw-border-opacity: 1;border-color:rgb(203 213 225 / var(--tw-border-opacity))}#fbjs :is(.border-submit-button-border){border-color:var(--fb-submit-btn-border)}#fbjs :is(.bg-\\[--fb-survey-background-color\\]){background-color:var(--fb-survey-background-color)}#fbjs :is(.bg-accent-bg){background-color:var(--fb-accent-background-color)}#fbjs :is(.bg-accent-selected-bg){background-color:var(--fb-accent-background-color-selected)}#fbjs :is(.bg-brand){background-color:var(--fb-brand-color)}#fbjs :is(.bg-gray-700\\/80){background-color:#374151cc}#fbjs :is(.bg-shadow){background-color:var(--fb-shadow-color)}#fbjs :is(.bg-slate-100){--tw-bg-opacity: 1;background-color:rgb(241 245 249 / var(--tw-bg-opacity))}#fbjs :is(.bg-slate-200){--tw-bg-opacity: 1;background-color:rgb(226 232 240 / var(--tw-bg-opacity))}#fbjs :is(.bg-slate-50){--tw-bg-opacity: 1;background-color:rgb(248 250 252 / var(--tw-bg-opacity))}#fbjs :is(.bg-survey-bg){background-color:var(--fb-survey-background-color)}#fbjs :is(.bg-white){--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}#fbjs :is(.bg-white\\/50){background-color:#ffffff80}#fbjs :is(.bg-none){background-image:none}#fbjs :is(.fill-none){fill:none}#fbjs :is(.fill-rating-fill){fill:var(--fb-rating-fill)}#fbjs :is(.stroke-heading){stroke:var(--fb-heading-color)}#fbjs :is(.stroke-rating-selected){stroke:var(--fb-rating-selected)}#fbjs :is(.object-contain){-o-object-fit:contain;object-fit:contain}#fbjs :is(.object-cover){-o-object-fit:cover;object-fit:cover}#fbjs :is(.p-2){padding:.5em}#fbjs :is(.p-4){padding:1em}#fbjs :is(.px-1){padding-left:.25em;padding-right:.25em}#fbjs :is(.px-1\\.5){padding-left:.375em;padding-right:.375em}#fbjs :is(.px-3){padding-left:.75em;padding-right:.75em}#fbjs :is(.px-6){padding-left:1.5em;padding-right:1.5em}#fbjs :is(.py-0){padding-top:0;padding-bottom:0}#fbjs :is(.py-0\\.5){padding-top:.125em;padding-bottom:.125em}#fbjs :is(.py-2){padding-top:.5em;padding-bottom:.5em}#fbjs :is(.py-3){padding-top:.75em;padding-bottom:.75em}#fbjs :is(.py-4){padding-top:1em;padding-bottom:1em}#fbjs :is(.py-6){padding-top:1.5em;padding-bottom:1.5em}#fbjs :is(.pb-3){padding-bottom:.75em}#fbjs :is(.pr-2){padding-right:.5em}#fbjs :is(.pr-2\\.5){padding-right:.625em}#fbjs :is(.pt-2){padding-top:.5em}#fbjs :is(.pt-6){padding-top:1.5em}#fbjs :is(.text-left){text-align:left}#fbjs :is(.text-center){text-align:center}#fbjs :is(.text-right){text-align:right}#fbjs :is(.text-base){font-size:1em;line-height:1.5em}#fbjs :is(.text-sm){font-size:.875em;line-height:1.25em}#fbjs :is(.text-xs){font-size:.75em;line-height:1em}#fbjs :is(.font-medium){font-weight:500}#fbjs :is(.font-normal){font-weight:400}#fbjs :is(.font-semibold){font-weight:600}#fbjs :is(.leading-10){line-height:2.5em}#fbjs :is(.leading-4){line-height:1em}#fbjs :is(.leading-6){line-height:1.5em}#fbjs :is(.leading-7){line-height:1.75em}#fbjs :is(.text-brand){color:var(--fb-brand-color)}#fbjs :is(.text-close-button){color:var(--fb-close-btn-color)}#fbjs :is(.text-heading){color:var(--fb-heading-color)}#fbjs :is(.text-info-text){color:var(--fb-info-text-color)}#fbjs :is(.text-on-brand){color:var(--fb-brand-text-color)}#fbjs :is(.text-rating-fill){color:var(--fb-rating-fill)}#fbjs :is(.text-rating-focus){color:var(--fb-rating-hover)}#fbjs :is(.text-rating-selected){color:var(--fb-rating-selected)}#fbjs :is(.text-signature){color:var(--fb-signature-text-color)}#fbjs :is(.text-slate-500){--tw-text-opacity: 1;color:rgb(100 116 139 / var(--tw-text-opacity))}#fbjs :is(.text-slate-600){--tw-text-opacity: 1;color:rgb(71 85 105 / var(--tw-text-opacity))}#fbjs :is(.text-slate-700){--tw-text-opacity: 1;color:rgb(51 65 85 / var(--tw-text-opacity))}#fbjs :is(.text-subheading){color:var(--fb-subheading-color)}#fbjs :is(.opacity-0){opacity:0}#fbjs :is(.opacity-100){opacity:1}#fbjs :is(.opacity-60){opacity:.6}#fbjs :is(.shadow-lg){--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}#fbjs :is(.shadow-sm){--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}#fbjs :is(.shadow-xl){--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}#fbjs :is(.filter){filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}#fbjs :is(.transition-all){transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}#fbjs :is(.duration-500){transition-duration:.5s}#fbjs :is(.ease-in-out){transition-timing-function:cubic-bezier(.4,0,.2,1)}#fbjs{font-size:16px}#fbjs *{scrollbar-width:thin;scrollbar-color:#e2e8f0}#fbjs *::-webkit-scrollbar{width:8px;border-radius:99px}#fbjs *::-webkit-scrollbar-track{background:#e2e8f0;border-radius:99px}#fbjs *::-webkit-scrollbar-thumb{background-color:#cbd5e1;border:3px solid #cbd5e1;border-radius:99px}.fb-htmlbody{display:block;font-size:.875em;font-weight:400;line-height:1.5em;color:var(--fb-subheading-color)!important}p.fb-editor-paragraph{color:var(--fb-subheading-color)!important}:root{--slate-50: rgb(248 250 252);--slate-100: rgb(241 245 249);--slate-200: rgb(226 232 240);--slate-300: rgb(203 213 225);--slate-400: rgb(148 163 184);--slate-500: rgb(100 116 139);--slate-600: rgb(71 85 105);--slate-700: rgb(51 65 85);--slate-800: rgb(30 41 59);--slate-900: rgb(15 23 42);--gray-100: rgb(243 244 246);--gray-200: rgb(229 231 235);--yellow-300: rgb(253 224 71);--yellow-500: rgb(234 179 8);--fb-brand-color: rgb(255, 255, 255);--fb-brand-text-color: black;--fb-border-color: var(--slate-300);--fb-border-color-highlight: var(--slate-500);--fb-focus-color: var(--slate-500);--fb-heading-color: var(--slate-900);--fb-subheading-color: var(--slate-700);--fb-info-text-color: var(--slate-500);--fb-signature-text-color: var(--slate-400);--fb-survey-background-color: white;--fb-accent-background-color: var(--slate-200);--fb-accent-background-color-selected: var(--slate-100);--fb-placeholder-color: var(--slate-400);--fb-shadow-color: var(--slate-300);--fb-rating-fill: var(--yellow-300);--fb-rating-hover: var(--yellow-500);--fb-back-btn-border: transparent;--fb-submit-btn-border: transparent;--fb-rating-selected: black;--fb-close-btn-color: var(--slate-500);--fb-close-btn-color-hover: var(--slate-700)}#fbjs :is(.placeholder\\:text-placeholder)::-moz-placeholder{color:var(--fb-placeholder-color)}#fbjs :is(.placeholder\\:text-placeholder)::placeholder{color:var(--fb-placeholder-color)}#fbjs :is(.first\\:rounded-l-md:first-child){border-top-left-radius:.375em;border-bottom-left-radius:.375em}#fbjs :is(.last\\:rounded-r-md:last-child){border-top-right-radius:.375em;border-bottom-right-radius:.375em}#fbjs :is(.focus-within\\:border-border-highlight:focus-within){border-color:var(--fb-border-color-highlight)}#fbjs :is(.focus-within\\:bg-accent-bg:focus-within){background-color:var(--fb-accent-background-color)}#fbjs :is(.hover\\:bg-accent-bg:hover){background-color:var(--fb-accent-background-color)}#fbjs :is(.hover\\:bg-slate-100:hover){--tw-bg-opacity: 1;background-color:rgb(241 245 249 / var(--tw-bg-opacity))}#fbjs :is(.hover\\:bg-slate-50:hover){--tw-bg-opacity: 1;background-color:rgb(248 250 252 / var(--tw-bg-opacity))}#fbjs :is(.hover\\:text-close-button-focus:hover){color:var(--fb-close-btn-hover-color)}#fbjs :is(.hover\\:text-heading:hover){color:var(--fb-heading-color)}#fbjs :is(.hover\\:text-slate-900:hover){--tw-text-opacity: 1;color:rgb(15 23 42 / var(--tw-text-opacity))}#fbjs :is(.hover\\:opacity-90:hover){opacity:.9}#fbjs :is(.focus\\:border-4:focus){border-width:4px}#fbjs :is(.focus\\:border-border-highlight:focus){border-color:var(--fb-border-color-highlight)}#fbjs :is(.focus\\:bg-accent-bg:focus){background-color:var(--fb-accent-background-color)}#fbjs :is(.focus\\:bg-accent-selected-bg:focus){background-color:var(--fb-accent-background-color-selected)}#fbjs :is(.focus\\:text-rating-focus:focus){color:var(--fb-rating-hover)}#fbjs :is(.focus\\:outline-none:focus){outline:2px solid transparent;outline-offset:2px}#fbjs :is(.focus\\:ring-0:focus){--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}#fbjs :is(.focus\\:ring-2:focus){--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}#fbjs :is(.focus\\:ring-border-highlight:focus){--tw-ring-color: var(--fb-border-color-highlight)}#fbjs :is(.focus\\:ring-close-button-focus:focus){--tw-ring-color: var(--fb-close-btn-hover-color)}#fbjs :is(.focus\\:ring-focus:focus){--tw-ring-color: var(--fb-focus-color)}#fbjs :is(.focus\\:ring-offset-0:focus){--tw-ring-offset-width: 0px}#fbjs :is(.focus\\:ring-offset-2:focus){--tw-ring-offset-width: 2px}#fbjs :is(.disabled\\:cursor-not-allowed:disabled){cursor:not-allowed}#fbjs :is(.disabled\\:opacity-50:disabled){opacity:.5}#fbjs :is(.dark .dark\\:border-slate-600){--tw-border-opacity: 1;border-color:rgb(71 85 105 / var(--tw-border-opacity))}#fbjs :is(.dark .dark\\:bg-slate-700){--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity))}#fbjs :is(.dark .dark\\:text-slate-400){--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity))}#fbjs :is(.dark .dark\\:hover\\:border-slate-500:hover){--tw-border-opacity: 1;border-color:rgb(100 116 139 / var(--tw-border-opacity))}#fbjs :is(.dark .dark\\:hover\\:bg-slate-800:hover){--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity))}@media (min-width: 640px){#fbjs :is(.sm\\:bottom-3){bottom:.75em}#fbjs :is(.sm\\:left-1\\/2){left:50%}#fbjs :is(.sm\\:left-3){left:.75em}#fbjs :is(.sm\\:right-3){right:.75em}#fbjs :is(.sm\\:top-1\\/2){top:50%}#fbjs :is(.sm\\:top-3){top:.75em}#fbjs :is(.sm\\:m-4){margin:1em}#fbjs :is(.sm\\:max-w-sm){max-width:24em}#fbjs :is(.sm\\:-translate-x-1\\/2){--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#fbjs :is(.sm\\:-translate-y-1\\/2){--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#fbjs :is(.sm\\:transform){transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}#fbjs :is(.sm\\:text-sm){font-size:.875em;line-height:1.25em}}.fb-editor-text-bold{font-weight:700!important}.fb-editor-text-italic{font-style:italic!important}.fb-editor-link{color:#334155!important;text-decoration:underline!important}.editor-tokenFunction{color:#dd4a68!important}.fb-editor-paragraph{margin:0!important;position:relative!important;color:#334155!important}.fb-editor-paragraph:last-child{margin-bottom:0!important}.fb-editor-heading-h1{font-size:25px!important;font-weight:400!important;margin-bottom:20px!important;font-weight:700!important}.fb-editor-heading-h2{font-size:20px!important;font-weight:700!important;margin-bottom:20px!important}.fb-editor-list-ul,.fb-editor-list-ol{margin-bottom:12px!important}.fb-editor-listitem{margin:0 32px!important}.fb-editor-nested-listitem{list-style-type:none!important}',document.head.appendChild(e)}})(),(({brandColor:e})=>{if(null===document.getElementById("formbricks__css"))return;const t=document.createElement("style");t.id="formbricks__css__custom",t.innerHTML=`\n :root {\n --fb-brand-color: ${e};\n ${function(e){let t,s,n;if(4===e.length?(t=parseInt(e[1]+e[1],16),s=parseInt(e[2]+e[2],16),n=parseInt(e[3]+e[3],16)):7===e.length&&(t=parseInt(e[1]+e[2],16),s=parseInt(e[3]+e[4],16),n=parseInt(e[5]+e[6],16)),void 0===t||void 0===s||void 0===n)throw new Error("Invalid color");return.299*t+.587*s+.114*n>128}(e)?"--fb-brand-text-color: black;":"--fb-brand-text-color: white;"}\n }\n `,document.head.appendChild(t)})({brandColor:e.brandColor});const t=document.createElement("div");var s,n,r,a,o,i;t.id="formbricks-modal-container",document.body.appendChild(t),s=us(ki,e),n=t,Xt.__&&Xt.__(s,n),a=(r=!1)?null:n.__k,o=[],i=[],As(n,s=n.__k=us(ms,null,[s]),a||as,as,void 0!==n.ownerSVGElement,a?null:n.firstChild?Jt.call(n.childNodes):null,o,a?a.__e:n.firstChild,r,i),js(o,s,i)},Ci=Pt.getInstance(),Si=Dt.getInstance();let Ai=null;const ji=(e,t)=>{const s=Math.abs(t.getTime()-e.getTime());return Math.floor(s/864e5)},Ni=async e=>{try{const t=await(async({apiHost:e,environmentId:t,userId:s})=>{const n=`${e}/api/v1/client/${t}/in-app/sync/${s}`,r=`${e}/api/v1/client/${t}/in-app/sync`;if(!s){const e=await fetch(r);if(!e.ok){const t=await e.json();return Tt({code:"network_error",status:e.status,message:"Error syncing with backend",url:n,responseMessage:t.message})}return It((await e.json()).data)}const a=await fetch(n);if(!a.ok){const e=await a.json();return Tt({code:"network_error",status:a.status,message:"Error syncing with backend",url:n,responseMessage:e.message})}const o=await a.json(),{data:i}=o;return It(i)})(e);if(!0!==(null==t?void 0:t.ok))throw Si.error(`Sync failed: ${JSON.stringify(t.error)}`),t.error;let s;try{s=Ci.get().state}catch(e){}let n={surveys:t.value.surveys,noCodeActionClasses:t.value.noCodeActionClasses,product:t.value.product,attributes:(null==s?void 0:s.attributes)||{}};if(e.userId){const e=n.surveys.map((e=>e.name));Si.debug("Fetched "+e.length+" surveys during sync: "+e.join(", "))}else{n={...n,displays:(null==s?void 0:s.displays)||[]},n=Li(n);const e=n.surveys.map((e=>e.name));Si.debug("Fetched "+e.length+" surveys during sync: "+e.join(", "))}Ci.update({apiHost:e.apiHost,environmentId:e.environmentId,userId:e.userId,state:n})}catch(e){throw Si.error(`Error during sync: ${e}`),e}},Li=e=>{const{displays:t,product:s}=e;let{surveys:n}=e;if(!t)return e;let r=n.filter((e=>{if("respondMultiple"===e.displayOption)return!0;if("displayOnce"===e.displayOption)return 0===t.filter((t=>t.surveyId===e.id)).length;if("displayMultiple"===e.displayOption)return 0===t.filter((t=>t.surveyId===e.id&&t.responded)).length;throw Error("Invalid displayOption")}));const a=t.length>0?t[t.length-1]:void 0;return r=r.filter((e=>{if(a){if(null!==e.recontactDays){const s=t.filter((t=>t.surveyId===e.id))[0];return!s||ji(new Date,new Date(s.createdAt))>=e.recontactDays}return null===s.recontactDays||ji(new Date,new Date(a.createdAt))>=s.recontactDays}return!0})),{...e,surveys:r}},Di=()=>{"undefined"!=typeof window&&null!==Ai&&(window.clearInterval(Ai),Ai=null)},Ii="formbricks-web-container",Ti=Pt.getInstance(),Mi=Dt.getInstance(),Oi=Bt.getInstance();let Fi=!1;const Bi=e=>{if(Fi)return void Mi.debug("A survey is already running. Skipping.");Fi=!0,e.delay&&Mi.debug(`Delaying survey by ${e.delay} seconds.`);const t=Ti.get().state.product,s=new Yt(e.id,null,null,Ti.get().userId),n=new Qt({apiHost:Ti.get().apiHost,environmentId:Ti.get().environmentId,retryAttempts:2,onResponseSendingFailed:e=>{alert(`Failed to send response: ${JSON.stringify(e,null,2)}`)}},s),r=e.productOverwrites??{},a=r.brandColor??t.brandColor,o=r.highlightBorderColor??t.highlightBorderColor,i=r.clickOutsideClose??t.clickOutsideClose,l=r.darkOverlay??t.darkOverlay,d=r.placement??t.placement,c=t.inAppSurveyBranding;setTimeout((()=>{Ei({survey:e,brandColor:a,isBrandingEnabled:c,clickOutside:i,darkOverlay:l,highlightBorderColor:o,placement:d,onDisplay:async()=>{const{userId:t}=Ti.get();if(!t){const t={createdAt:new Date,surveyId:e.id,responded:!1},s=Ti.get().state.displays,n=s?[...s,t]:[t],r=Ti.get();let a=Li({...r.state,displays:n});Ti.update({...r,state:a})}const r=new Kt({apiHost:Ti.get().apiHost,environmentId:Ti.get().environmentId}),a=await r.client.display.create({surveyId:e.id,userId:t});if(!a.ok)throw new Error("Could not create display");const{id:o}=a.data;s.updateDisplayId(o),n.updateSurveyState(s)},onResponse:e=>{const{userId:t}=Ti.get();if(!t){const e=Ti.get().state.displays,t=e&&e[e.length-1];if(!t)throw new Error("No lastDisplay found");if(!t.responded){t.responded=!0;const s=Ti.get();let n=Li({...s.state,displays:e});Ti.update({...s,state:n})}}t&&s.updateUserId(t),n.updateSurveyState(s),n.add({data:e.data,ttc:e.ttc,finished:e.finished})},onClose:zi,onFileUpload:async(e,t)=>{const s=new Kt({apiHost:Ti.get().apiHost,environmentId:Ti.get().environmentId});return await s.client.storage.uploadFile(e,t)}})}),1e3*e.delay)},zi=async()=>{var e;if(null==(e=document.getElementById(Ii))||e.remove(),Pi(),!Ti.get().userId){const e=Ti.get().state,t=Li(e);return Ti.update({...Ti.get(),state:t}),void(Fi=!1)}try{await Ni({apiHost:Ti.get().apiHost,environmentId:Ti.get().environmentId,userId:Ti.get().userId}),Fi=!1}catch(e){Oi.handle(e)}},Pi=()=>{const e=document.createElement("div");e.id=Ii,document.body.appendChild(e)},Ri=Dt.getInstance(),qi=Pt.getInstance(),Zi=["Exit Intent (Desktop)","50% Scroll"],Hi=async(e,t={})=>{var s;const{userId:n}=qi.get(),r={environmentId:qi.get().environmentId,userId:n,name:e,properties:t||{}};if(n&&!Zi.includes(e)){Ri.debug(`Sending action "${e}" to backend`);const t=new Kt({apiHost:qi.get().apiHost,environmentId:qi.get().environmentId}),s=await t.client.action.create({...r,userId:n});if(!s.ok)return Tt({code:"network_error",message:`Error tracking action ${e}`,status:500,url:`${qi.get().apiHost}/api/v1/client/${qi.get().environmentId}/actions`,responseMessage:s.error.message})}Ri.debug(`Formbricks: Action "${e}" tracked`);const a=null==(s=qi.get().state)?void 0:s.surveys;return a&&a.length>0?Ui(e,a):Ri.debug("No active surveys to display"),{ok:!0,value:void 0}},Ui=(e,t)=>{for(const s of t)for(const t of s.triggers)if(t===e)return Ri.debug(`Formbricks: survey ${s.id} triggered by action "${e}"`),void Bi(s)};let $i=!1,Vi=async function(e){if(e.clientY<=0){const e=await Hi("Exit Intent (Desktop)");if(!0!==e.ok)return Tt(e.error)}};const Wi=()=>{$i&&(document.removeEventListener("mouseleave",Vi),$i=!1)};let Ki=!1,Qi=!1,Gi=async()=>{const e=window.scrollY,t=window.innerHeight,s=document.documentElement.scrollHeight;if(0===e&&(Qi=!1),!Qi&&e/(s-t)>=.5){Qi=!0;const e=await Hi("50% Scroll");if(!0!==e.ok)return Tt(e.error)}};const Yi=()=>{Ki&&(window.removeEventListener("scroll",Gi),Ki=!1)},Ji=Pt.getInstance(),Xi=Dt.getInstance(),el=Bt.getInstance(),tl=async()=>{var e;Xi.debug(`Checking page url: ${window.location.href}`);const{state:t}=Ji.get();if(void 0===(null==t?void 0:t.noCodeActionClasses))return{ok:!0,value:void 0};const s=((null==t?void 0:t.noCodeActionClasses)||[]).filter((e=>{const{innerHtml:t,cssSelector:s,pageUrl:n}=e.noCodeConfig||{};return n&&!t&&!s}));if(0===s.length)return{ok:!0,value:void 0};for(const t of s){if(!(null==(e=t.noCodeConfig)?void 0:e.pageUrl))continue;const{noCodeConfig:{pageUrl:s}}=t,n=al(window.location.href,s.value,s.rule);if(!0!==n.ok)return Tt(n.error);if(!1===n.value)continue;const r=await Hi(t.name);if(!0!==r.ok)return Tt(r.error)}return{ok:!0,value:void 0}};let sl=!1;const nl=()=>tl(),rl=()=>{"undefined"!=typeof window&&sl&&(window.removeEventListener("hashchange",nl),window.removeEventListener("popstate",nl),window.removeEventListener("pushstate",nl),window.removeEventListener("replacestate",nl),window.removeEventListener("load",nl),sl=!1)};function al(e,t,s){switch(s){case"exactMatch":return It(e===t);case"contains":return It(e.includes(t));case"startsWith":return It(e.startsWith(t));case"endsWith":return It(e.endsWith(t));case"notMatch":return It(e!==t);case"notContains":return It(!e.includes(t));default:return Tt({code:"invalid_match_type",message:"Invalid match type"})}}let ol=!1;const il=e=>(e=>{const{state:t}=Ji.get();if(!t)return;const s=e.target;((null==t?void 0:t.noCodeActionClasses)||[]).forEach((e=>{var t,n,r,a,o,i,l,d;const c=null==(n=null==(t=e.noCodeConfig)?void 0:t.innerHtml)?void 0:n.value,u=null==(a=null==(r=e.noCodeConfig)?void 0:r.cssSelector)?void 0:a.value,p=null==(i=null==(o=e.noCodeConfig)?void 0:o.pageUrl)?void 0:i.value,m=null==(d=null==(l=e.noCodeConfig)?void 0:l.pageUrl)?void 0:d.rule;if((c||u||p)&&(!c||s.innerHTML===c)){if(u){const e=u.split(/\s*(?=[.#])/);for(let t of e)if(!s.matches(t))return}if(p&&m){const e=al(window.location.href,p,m);if(!e.ok||!e.value)return}Hi(e.name).then((e=>{var t,s;s=e=>{el.handle(e)},!0===(t=e).ok?t.value:s(t.error)}))}}))})(e),ll=()=>{ol&&(document.removeEventListener("click",il),ol=!1)};let dl=!1;const cl=Pt.getInstance(),ul=Dt.getInstance();let pl=!1;const ml=async e=>{if(pl)return ul.debug("Already initialized, skipping initialization."),{ok:!0,value:void 0};if((e=>{e.debug&&(ul.debug("Setting log level to debug"),ul.configure({logLevel:"debug"}))})(e),Bt.getInstance().printStatus(),ul.debug("Start initialize"),!e.environmentId)return ul.debug("No environmentId provided"),Tt({code:"missing_field",field:"environmentId"});if(!e.apiHost)return ul.debug("No apiHost provided"),Tt({code:"missing_field",field:"apiHost"});ul.debug("Adding widget container to DOM"),Pi();const t=cl.loadFromLocalStorage();return t.ok&&t.value.state&&t.value.environmentId===e.environmentId&&t.value.apiHost===e.apiHost&&t.value.userId===e.userId&&t.value.expiresAt?(ul.debug("Found existing configuration."),t.value.expiresAt<new Date?(ul.debug("Configuration expired."),await Ni({apiHost:e.apiHost,environmentId:e.environmentId,userId:e.userId})):(ul.debug("Configuration not expired. Extending expiration."),cl.update(t.value))):(ul.debug("No valid configuration found or it has been expired. Creating new config."),ul.debug("Syncing."),await Ni({apiHost:e.apiHost,environmentId:e.environmentId,userId:e.userId}),Hi("New Session")),ul.debug("Adding event listeners"),"undefined"!=typeof window&&null===Ai&&(Ai=window.setInterval((async()=>{Ci.get().expiresAt&&new Date(Ci.get().expiresAt)>=new Date||(Si.debug("Config has expired. Starting sync."),await Ni({apiHost:Ci.get().apiHost,environmentId:Ci.get().environmentId,userId:Ci.get().userId}))}),6e4)),"undefined"==typeof window||sl||(window.addEventListener("hashchange",nl),window.addEventListener("popstate",nl),window.addEventListener("pushstate",nl),window.addEventListener("replacestate",nl),window.addEventListener("load",nl),sl=!0),"undefined"==typeof window||ol||(document.addEventListener("click",il),ol=!0),"undefined"==typeof document||$i||(document.querySelector("body").addEventListener("mouseleave",Vi),$i=!0),"undefined"==typeof window||Ki||(window.addEventListener("load",(()=>{window.addEventListener("scroll",Gi)})),Ki=!0),dl||(window.addEventListener("beforeunload",(()=>{Di(),rl(),ll(),Wi(),Yi()})),dl=!0),pl=!0,ul.debug("Initialized"),tl(),{ok:!0,value:void 0}},hl=Pt.getInstance(),gl=Dt.getInstance(),fl=async(e,t)=>{if(gl.debug("Setting attribute: "+e+" to value: "+t),((e,t)=>hl.get().state.attributes[e]===t)(e,t.toString()))return gl.debug("Attribute already set to this value. Skipping update."),{ok:!0,value:void 0};const s=await(async(e,t)=>{const{apiHost:s,environmentId:n,userId:r}=hl.get();if(!r)return Tt({code:"missing_person",message:"Unable to update attribute. User identification deactivated. No userId set."});const a={attributes:{[e]:t}},o=new Kt({apiHost:hl.get().apiHost,environmentId:hl.get().environmentId}),i=await o.client.people.update(r,a);return i.ok?(gl.debug("Attribute updated. Syncing..."),await Ni({environmentId:n,apiHost:s,userId:r}),{ok:!0,value:void 0}):Tt({code:"network_error",status:500,message:`Error updating person with userId ${r}`,url:`${hl.get().apiHost}/api/v1/client/${n}/people/${r}`,responseMessage:i.error.message})})(e,t.toString());return s.ok?(hl.update({environmentId:hl.get().environmentId,apiHost:hl.get().apiHost,userId:hl.get().userId,state:{...hl.get().state,attributes:{...hl.get().state.attributes,[e]:t.toString()}}}),{ok:!0,value:void 0}):Tt(s.error)};Dt.getInstance().debug("Create command queue");const bl=new class{constructor(){this.queue=[],this.running=!1,this.resolvePromise=null,this.commandPromise=null}add(e=!0,t,...s){this.queue.push({command:t,checkInitialized:e,commandArgs:s}),this.running||(this.commandPromise=new Promise((e=>{this.resolvePromise=e,this.run()})))}async wait(){this.running&&await this.commandPromise}async run(){for(this.running=!0;this.queue.length>0;){const e=Bt.getInstance(),t=this.queue.shift();if(!t)continue;if(t.checkInitialized){const t=(ul.debug("Check if initialized"),pl&&Bt.initialized?{ok:!0,value:void 0}:Tt({code:"not_initialized",message:"Formbricks not initialized. Call initialize() first."}));t&&!0!==t.ok&&e.handle(t.error)}const s=await(null==t?void 0:t.command.apply(null,null==t?void 0:t.commandArgs));s&&!0!==s.ok&&e.handle(s.error)}this.running=!1,this.resolvePromise&&(this.resolvePromise(),this.resolvePromise=null,this.commandPromise=null)}},_l=async(e,t)=>{bl.add(!0,fl,e,t),await bl.wait()},vl=async e=>{Bt.init(e.errorHandler),bl.add(!1,ml,e),await bl.wait()},yl=_l;function wl(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const s=Math.round(e/t);return 0===s||1===s?0:1<s&&8>s?7:8<=s&&31>s?30:30<s&&90>s?90:90>s?91:void 0}"undefined"!=typeof window&&optimoleDashboardApp.user_data.plan&&(vl({environmentId:"clo8wxwzj44orpm0gjchurujm",apiHost:"https://app.formbricks.com",userId:"optml_"+optimoleDashboardApp.user_data.id}),yl("plan",optimoleDashboardApp.user_data.plan),yl("status",optimoleDashboardApp.user_data.status),yl("cname_assigned",optimoleDashboardApp.user_data.is_cname_assigned||"no"),yl("connected_websites",optimoleDashboardApp.user_data.whitelist.length),yl("traffic",wl(optimoleDashboardApp.user_data.traffic,500)),yl("images_number",wl(optimoleDashboardApp.user_data.images_number,100)),yl("days_since_install",wl(optimoleDashboardApp.days_since_install)));const xl=e=>{let{tab:t,setTab:s}=e;const{isConnected:r,hasApplication:a,hasConflicts:o,siteSettings:i,extraVisits:d}=(0,l.useSelect)((e=>{const{isConnected:t,hasApplication:s,getConflicts:n,getSiteSettings:r}=e("optimole"),a=n(),o=r();return{isConnected:t(),hasApplication:s(),hasConflicts:0<a.count||0,siteSettings:o,extraVisits:o.banner_frontend}})),{setQueryArgs:c}=(0,l.useDispatch)("optimole"),[u,p]=(0,n.useState)(!1),[m,h]=(0,n.useState)("general"),[g,f]=(0,n.useState)(!1),[b,_]=(0,n.useState)(i);return(0,n.useEffect)((()=>{const e=new URLSearchParams(window.location.search),t=Object.fromEntries(e.entries());let n=[];if(Object.prototype.hasOwnProperty.call(t,"optimole_action")){for(let e=0;20>e;e++)Object.prototype.hasOwnProperty.call(t,e)&&(isNaN(t[e])||(n[e]=parseInt(t[e],10)));t.images=n,t.url=window.location.href.split("?")[0]+(Object.prototype.hasOwnProperty.call(t,"paged")?"?paged="+t.paged:""),c(t),s("settings"),h("offload_media")}}),[]),(0,n.useEffect)((()=>{r&&a&&(N(!0),x()({path:optimoleDashboardApp.routes.poll_conflicts,method:"GET",parse:!1}).then((e=>200<=e.status&&300>e.status?e.json():(console.log(`%c Request failed with status ${e.status}`,"color: #E7602A"),Promise.resolve()))).then((e=>{N(!1),e&&z(e.data)})))}),[]),(0,n.useEffect)((()=>{o&&p(!0)}),[o]),(0,n.useEffect)((()=>{_({...b,banner_frontend:d})}),[d]),(0,n.useEffect)((()=>{window.onbeforeunload=g?()=>!0:null}),[g]),(0,n.createElement)(n.Fragment,null,(0,n.createElement)("div",{className:"optml-connected max-w-screen-xl flex flex-col lg:flex-row mx-auto gap-5"},(0,n.createElement)("div",{className:"flex flex-col justify-between mt-8 mb-5 p-0 transition-all ease-in-out duration-700 relative text-gray-700 basis-9/12"},"dashboard"===t&&(0,n.createElement)(Be,null),"conflicts"===t&&u&&(0,n.createElement)(Pe,null),"settings"===t&&(0,n.createElement)(mt,{tab:m,setTab:h,canSave:g,setCanSave:f,settings:b,setSettings:_}),"help"===t&&(0,n.createElement)(yt,null)),(0,n.createElement)(xt,null)),(0,n.createElement)(Lt,null))},kl=[{label:optimoleDashboardApp.strings.optimole+" "+optimoleDashboardApp.strings.version,href:"https://optimole.com/"},{label:optimoleDashboardApp.strings.terms_menu,href:"https://optimole.com/terms/"},{label:optimoleDashboardApp.strings.privacy_menu,href:"https://optimole.com/privacy-policy/"},{label:optimoleDashboardApp.strings.testdrive_menu,href:"https://optimole.com/test-drive?url="+optimoleDashboardApp.home_url}],El=()=>(0,n.createElement)("footer",{className:"max-w-screen-xl gap-3 md:gap-0 mx-auto my-5 flex justify-between text-base flex-col md:flex-row"},(0,n.createElement)("div",{dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.account_needed_subtitle_3}}),(0,n.createElement)("nav",{className:"flex gap-0 sm:gap-3 flex-wrap md:flex-nowrap"},kl.map(((e,t)=>(0,n.createElement)(m.ExternalLink,{key:t,href:e.href,className:"basis-1/2 sm:basis-auto"},e.label))))),Cl=window.lodash;function Sl(){const e=(0,l.useSelect)((e=>e(E.store).getNotices()),[]),{removeNotice:t}=(0,l.useDispatch)(E.store),s=(0,Cl.filter)(e,{type:"snackbar"});return(0,n.createElement)(m.SnackbarList,{notices:s,className:"px-2 bottom-4 fixed",onRemove:t})}(0,n.render)((0,n.createElement)((()=>{const e=window.location.hash.replace("#","");let t=["dashboard","settings","help"].includes(e)?e:"dashboard";const[s,r]=(0,n.useState)(t),a=e=>{e.preventDefault(),r("settings")},o=e=>{e.preventDefault(),r("dashboard")},{showDisconnect:i,isConnected:d,hasApplication:c,hasDashboardLoaded:u}=(0,l.useSelect)((e=>{const{showDisconnect:t,isConnected:s,hasApplication:n,hasDashboardLoaded:r}=e("optimole");return{showDisconnect:t(),isConnected:s(),hasApplication:n(),hasDashboardLoaded:r()}}));return(0,n.useEffect)((()=>{d&&(window.location.hash=`#${s}`,C.forEach((e=>{const t=document.querySelector(`a[href="${e.href}"]`);if(!t)return;const s=t.parentNode;if(e.hash&&e.hash===window.location.hash)return t.classList.add("current"),void s.classList.add("current");t.classList.remove("current"),s.classList.remove("current")})))}),[s]),(0,n.useEffect)((()=>{if(!d)return;const e=document.querySelector('a[href*="page=optimole"]'),t=document.querySelector('a[href*="page=optimole#settings"]');return e&&t?(e.addEventListener("click",o),t.addEventListener("click",a),()=>{e&&t&&(e.removeEventListener("click",o),t.removeEventListener("click",a))}):void 0}),[]),(0,n.createElement)(n.Fragment,null,(0,n.createElement)(he,{tab:s,setTab:r}),!(d&&c)&&(0,n.createElement)(n.Fragment,null,(0,n.createElement)(ye,null),(0,n.createElement)(El,null)),d&&c&&!u&&(0,n.createElement)(Ee,null),d&&i&&(0,n.createElement)(ge,null),d&&c&&u&&(0,n.createElement)(xl,{tab:s,setTab:r}),(0,n.createElement)(Sl,null))}),null),document.getElementById("optimole-app"))},184:(e,t)=>{var s;!function(){"use strict";var n={}.hasOwnProperty;function r(){for(var e=[],t=0;t<arguments.length;t++){var s=arguments[t];if(s){var a=typeof s;if("string"===a||"number"===a)e.push(s);else if(Array.isArray(s)){if(s.length){var o=r.apply(null,s);o&&e.push(o)}}else if("object"===a){if(s.toString!==Object.prototype.toString&&!s.toString.toString().includes("[native code]")){e.push(s.toString());continue}for(var i in s)n.call(s,i)&&s[i]&&e.push(i)}}}return e.join(" ")}e.exports?(r.default=r,e.exports=r):void 0===(s=function(){return r}.apply(t,[]))||(e.exports=s)}()},864:(e,t,s)=>{(()=>{"use strict";var t={n:e=>{var s=e&&e.__esModule?()=>e.default:()=>e;return t.d(s,{a:s}),s},d:(e,s)=>{for(var n in s)t.o(s,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:s[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},n={};t.r(n),t.d(n,{default:()=>d});const r=s(196);var a=t.n(r);function o(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),s.push.apply(s,n)}return s}function i(e){for(var t=1;t<arguments.length;t++){var s=null!=arguments[t]?arguments[t]:{};t%2?o(Object(s),!0).forEach((function(t){l(e,t,s[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):o(Object(s)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))}))}return e}function l(e,t,s){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var s=e[Symbol.toPrimitive];if(void 0!==s){var n=s.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}const d=e=>{const{aspectRatio:t="taller",handle:s=null,handleSize:n=40,hover:o=!1,leftImage:l,leftImageAlt:d="",leftImageCss:c={},leftImageLabel:u=null,onSliderPositionChange:p=(()=>{}),rightImage:m,rightImageAlt:h="",rightImageCss:g={},rightImageLabel:f=null,skeleton:b=null,sliderLineColor:_="#ffffff",sliderLineWidth:v=2,sliderPositionPercentage:y=.5,vertical:w=!1}=e,x=!w,[k,E]=(0,r.useState)(y),[C,S]=(0,r.useState)(0),[A,j]=(0,r.useState)(0),[N,L]=(0,r.useState)(!1),[D,I]=(0,r.useState)(!1),[T,M]=(0,r.useState)(!1),O=(0,r.useRef)(null),F=(0,r.useRef)(null),B=(0,r.useRef)(null);(0,r.useEffect)((()=>{const e=O.current,t=new ResizeObserver((e=>{let[t,...s]=e;const n=t.target.getBoundingClientRect().width;S(n)}));return t.observe(e),()=>t.disconnect()}),[]),(0,r.useEffect)((()=>(B.current.complete&&L(!0),()=>{L(!1)})),[l]),(0,r.useEffect)((()=>(F.current.complete&&I(!0),()=>{I(!1)})),[m]);const z=D&&N;(0,r.useEffect)((()=>{const e=e=>{const t=e||window.event,s=t.touches?t.touches[0].pageX:t.pageX,n=t.touches?t.touches[0].pageY:t.pageY,r=s-window.pageXOffset,a=n-window.pageYOffset,o=F.current.getBoundingClientRect();let i=x?r-o.left:a-o.top;const l=0+v/2,d=x?C-v/2:A-v/2;i<l&&(i=l),i>d&&(i=d),E(x?i/C:i/A),p&&p(x?i/C:i/A)},s=t=>{M(!0),"touches"in t||t.preventDefault(),e(t),window.addEventListener("mousemove",e),window.addEventListener("touchmove",e)},n=()=>{M(!1),window.removeEventListener("mousemove",e),window.removeEventListener("touchmove",e)},r=O.current;if(z){r.addEventListener("touchstart",s),window.addEventListener("touchend",n),o?(r.addEventListener("mousemove",e),r.addEventListener("mouseleave",n)):(r.addEventListener("mousedown",s),window.addEventListener("mouseup",n));const a=B.current.naturalHeight/B.current.naturalWidth,i=F.current.naturalHeight/F.current.naturalWidth,l="taller"===t?Math.max(a,i):Math.min(a,i);j(C*l)}return()=>{r.removeEventListener("touchstart",s),window.removeEventListener("touchend",n),r.removeEventListener("mousemove",e),r.removeEventListener("mouseleave",n),r.removeEventListener("mousedown",s),window.removeEventListener("mouseup",n),window.removeEventListener("mousemove",e),window.removeEventListener("touchmove",e)}}),[z,t,A,C,x,o,v,w]);const P={container:{boxSizing:"border-box",position:"relative",width:"100%",height:`${A}px`,overflow:"hidden"},rightImage:i({clip:x?`rect(auto, auto, auto, ${C*k}px)`:`rect(${A*k}px, auto, auto, auto)`,display:"block",height:"100%",objectFit:"cover",position:"absolute",width:"100%"},g),leftImage:i({clip:x?`rect(auto, ${C*k}px, auto, auto)`:`rect(auto, auto, ${A*k}px, auto)`,display:"block",height:"100%",objectFit:"cover",position:"absolute",width:"100%"},c),slider:{alignItems:"center",cursor:!o&&x?"ew-resize":!o&&!x&&"ns-resize",display:"flex",flexDirection:x?"column":"row",height:x?"100%":`${n}px`,justifyContent:"center",left:x?C*k-n/2+"px":0,position:"absolute",top:x?0:A*k-n/2+"px",width:x?`${n}px`:"100%"},line:{background:_,boxShadow:"0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12)",flex:"0 1 auto",height:x?"100%":`${v}px`,width:x?`${v}px`:"100%"},handleCustom:{alignItems:"center",boxSizing:"border-box",display:"flex",flex:"1 0 auto",height:"auto",justifyContent:"center",width:"auto"},handleDefault:{alignItems:"center",border:`${v}px solid ${_}`,borderRadius:"100%",boxShadow:"0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12)",boxSizing:"border-box",display:"flex",flex:"1 0 auto",height:`${n}px`,justifyContent:"center",width:`${n}px`,transform:x?"none":"rotate(90deg)"},leftArrow:{border:`inset ${.15*n}px rgba(0,0,0,0)`,borderRight:`${.15*n}px solid ${_}`,height:"0px",marginLeft:`-${.25*n}px`,marginRight:.25*n+"px",width:"0px"},rightArrow:{border:`inset ${.15*n}px rgba(0,0,0,0)`,borderLeft:`${.15*n}px solid ${_}`,height:"0px",marginRight:`-${.25*n}px`,width:"0px"},leftLabel:{background:"rgba(0, 0, 0, 0.5)",color:"white",left:x?"5%":"50%",opacity:T?0:1,padding:"10px 20px",position:"absolute",top:x?"50%":"3%",transform:x?"translate(0,-50%)":"translate(-50%, 0)",transition:"opacity 0.1s ease-out"},rightLabel:{background:"rgba(0, 0, 0, 0.5)",color:"white",opacity:T?0:1,padding:"10px 20px",position:"absolute",left:x?null:"50%",right:x?"5%":null,top:x?"50%":null,bottom:x?null:"3%",transform:x?"translate(0,-50%)":"translate(-50%, 0)",transition:"opacity 0.1s ease-out"},leftLabelContainer:{clip:x?`rect(auto, ${C*k}px, auto, auto)`:`rect(auto, auto, ${A*k}px, auto)`,height:"100%",position:"absolute",width:"100%"},rightLabelContainer:{clip:x?`rect(auto, auto, auto, ${C*k}px)`:`rect(${A*k}px, auto, auto, auto)`,height:"100%",position:"absolute",width:"100%"}};return a().createElement(a().Fragment,null,b&&!z&&a().createElement("div",{style:i({},P.container)},b),a().createElement("div",{style:i(i({},P.container),{},{display:z?"block":"none"}),ref:O,"data-testid":"container"},a().createElement("img",{onLoad:()=>I(!0),alt:h,"data-testid":"right-image",ref:F,src:m,style:P.rightImage}),a().createElement("img",{onLoad:()=>L(!0),alt:d,"data-testid":"left-image",ref:B,src:l,style:P.leftImage}),a().createElement("div",{style:P.slider},a().createElement("div",{style:P.line}),s?a().createElement("div",{style:P.handleCustom},s):a().createElement("div",{style:P.handleDefault},a().createElement("div",{style:P.leftArrow}),a().createElement("div",{style:P.rightArrow})),a().createElement("div",{style:P.line})),u&&a().createElement("div",{style:P.leftLabelContainer},a().createElement("div",{style:P.leftLabel},u)),f&&a().createElement("div",{style:P.rightLabelContainer},a().createElement("div",{style:P.rightLabel},f))))};e.exports=n})()},196:e=>{"use strict";e.exports=window.React}},s={};function n(e){var r=s[e];if(void 0!==r)return r.exports;var a=s[e]={exports:{}};return t[e](a,a.exports,n),a.exports}n.m=t,e=[],n.O=(t,s,r,a)=>{if(!s){var o=1/0;for(c=0;c<e.length;c++){for(var[s,r,a]=e[c],i=!0,l=0;l<s.length;l++)(!1&a||o>=a)&&Object.keys(n.O).every((e=>n.O[e](s[l])))?s.splice(l--,1):(i=!1,a<o&&(o=a));if(i){e.splice(c--,1);var d=r();void 0!==d&&(t=d)}}return t}a=a||0;for(var c=e.length;c>0&&e[c-1][2]>a;c--)e[c]=e[c-1];e[c]=[s,r,a]},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var s in t)n.o(t,s)&&!n.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={826:0,431:0};n.O.j=t=>0===e[t];var t=(t,s)=>{var r,a,[o,i,l]=s,d=0;if(o.some((t=>0!==e[t]))){for(r in i)n.o(i,r)&&(n.m[r]=i[r]);if(l)var c=l(n)}for(t&&t(s);d<o.length;d++)a=o[d],n.o(e,a)&&e[a]&&e[a][0](),e[a]=0;return n.O(c)},s=globalThis.webpackChunkoptimole_wp=globalThis.webpackChunkoptimole_wp||[];s.forEach(t.bind(null,0)),s.push=t.bind(null,s.push.bind(s))})();var r=n.O(void 0,[431],(()=>n(799)));r=n.O(r)})(); |
|
1
|
+(()=>{var e,t={408:(e,t,a)=>{"use strict";var s=a(196);const o=window.wp.element,l={setAutoConnect:e=>({type:"SET_AUTO_CONNECT",autoConnect:e}),setAPIKey:e=>({type:"SET_API_KEY",apiKey:e}),setAvailableApps:e=>({type:"SET_AVAILABLE_APPS",availableApps:e}),setIsConnected:e=>({type:"SET_IS_CONNECTED",isConnected:e}),setIsConnecting:e=>({type:"SET_IS_CONNECTING",isConnecting:e}),setIsLoading:e=>({type:"SET_IS_LOADING",isLoading:e}),sethasDashboardLoaded:e=>({type:"SET_HAS_DASHBOARD_LOADED",hasDashboardLoaded:e}),setHasRestError:e=>({type:"SET_HAS_REST_ERROR",hasRestError:e}),setHasValidKey:e=>({type:"SET_HAS_VALID_KEY",hasValidKey:e}),setHasApplication:e=>({type:"SET_HAS_APPLICATION",hasApplication:e}),setUserData:e=>({type:"SET_USER_DATA",data:e}),setUserStatus:e=>({type:"SET_USER_STATUS",status:e}),setShowDisconnect:e=>({type:"SET_SHOW_DISCONNECT",showDisconnect:e}),setConflicts:e=>({type:"SET_CONFLICTS",conflicts:e}),setOptimizedImages:e=>({type:"SET_OPTIMIZED_IMAGES",optimizedImages:e}),setSiteSettings:e=>({type:"SET_SITE_SETTINGS",siteSettings:e}),setExtraVisits:e=>({type:"SET_EXTRA_VISITS",extraVisitsStatus:e}),setSampleRate:e=>({type:"SET_SAMPLE_RATE",sampleRate:e}),setTotalNumberOfImages:e=>({type:"SET_TOTAL_NUMBER_OF_IMAGES",totalNumberOfImages:e}),setProcessedImages:e=>({type:"SET_PROCESSED_IMAGES",processedImages:e}),setOffloadLibraryLink:e=>({type:"SET_OFFLOAD_LIBRARY_LINK",offloadLibraryLink:e}),setRollbackLibraryLink:e=>({type:"SET_ROLLBACK_LIBRARY_LINK",rollbackLibraryLink:e}),setLoadingRollback:e=>({type:"SET_LOADING_ROLLBACK",loadingRollback:e}),setLoadingSync:e=>({type:"SET_LOADING_SYNC",loadingSync:e}),setQueryArgs:e=>({type:"SET_QUERY_ARGS",queryArgs:e}),setErrorMedia:e=>({type:"SET_ERROR_MEDIA",errorMedia:e}),setEstimatedTime:e=>({type:"SET_ESTIMATED_TIME",estimatedTime:e}),setCheckedOffloadConflicts:e=>({type:"SET_CHECKED_OFFLOAD_CONFLICTS",checkedOffloadConflicts:e}),setOffloadConflicts:e=>({type:"SET_OFFLOAD_CONFLICTS",offloadConflicts:e}),setLogs:(e,t)=>({type:"SET_LOGS",logsType:e,logs:t}),setShowFinishNotice:e=>({type:"SET_SITE_SETTINGS",siteSettings:{show_offload_finish_notice:e}}),setOffloadLimitReached:e=>({type:"SET_SITE_SETTINGS",siteSettings:{offload_limit_reached:e}}),ensureOffloadingRollbackDisabled:()=>({type:"SET_SITE_SETTINGS",siteSettings:{offloading_status:"disabled",rollback_status:"disabled"}}),setOffloadLimit:e=>({type:"SET_OFFLOAD_LIMIT",offloadLimit:e})},n={autoConnect:optimoleDashboardApp.auto_connect,isConnected:"yes"===optimoleDashboardApp.connection_status,isConnecting:!1,isLoading:!1,hasRestError:!1,hasValidKey:!0,hasApplication:"yes"===optimoleDashboardApp.has_application,apiKey:optimoleDashboardApp.api_key?optimoleDashboardApp.api_key:"",userStatus:optimoleDashboardApp.user_status?optimoleDashboardApp.user_status:"inactive",userData:optimoleDashboardApp.user_data?optimoleDashboardApp.user_data:null,availableApps:optimoleDashboardApp.available_apps?optimoleDashboardApp.available_apps:null,hasDashboardLoaded:"yes"===optimoleDashboardApp.connection_status,showDisconnect:!1,conflicts:[],optimizedImages:[],siteSettings:optimoleDashboardApp.site_settings,sampleRate:{},totalNumberOfImages:0,processedImages:0,offloadLibraryLink:!1,rollbackLibraryLink:!1,loadingRollback:!1,loadingSync:!1,queryArgs:[],errorMedia:!1,checkedOffloadConflicts:!1,offloadConflicts:[],offloadLimit:optimoleDashboardApp.offload_limit||5e4,logs:{offload:"",rollback:""},canShowFreeUserWithOffloadNotice:"yes"===optimoleDashboardApp?.show_free_user_with_offload_notice},r=(e=n,t)=>{switch(t.type){case"SET_AUTO_CONNECT":return{...e,autoConnect:t.autoConnect};case"SET_HAS_REST_ERROR":case"SET_HAS_REST_ERROR":return{...e,hasRestError:t.hasRestError};case"SET_API_KEY":return{...e,apiKey:t.apiKey};case"SET_AVAILABLE_APPS":return{...e,availableApps:t.availableApps};case"SET_IS_CONNECTED":return{...e,isConnected:t.isConnected};case"SET_IS_CONNECTING":return{...e,isConnecting:t.isConnecting};case"SET_IS_LOADING":return{...e,isLoading:t.isLoading};case"SET_HAS_DASHBOARD_LOADED":return{...e,hasDashboardLoaded:t.hasDashboardLoaded};case"SET_HAS_VALID_KEY":return{...e,hasValidKey:t.hasValidKey};case"SET_HAS_APPLICATION":return{...e,hasApplication:t.hasApplication};case"SET_USER_DATA":let a="inactive";const{data:s}=t;if(s&&s.app_count&&1<=s.app_count&&s.cdn_key)for(let e of s.available_apps)e.key&&e.key===s.cdn_key&&e.status&&"active"===e.status&&(a="active");return{...e,userData:t.data,userStatus:a};case"SET_USER_STATUS":return{...e,userStatus:t.status};case"SET_SHOW_DISCONNECT":return{...e,showDisconnect:t.showDisconnect};case"SET_CONFLICTS":return{...e,conflicts:t.conflicts};case"SET_OPTIMIZED_IMAGES":return{...e,optimizedImages:t.optimizedImages};case"SET_SITE_SETTINGS":let{siteSettings:o}=e;for(let e in t.siteSettings)o[e]=t.siteSettings[e];return{...e,siteSettings:o};case"SET_EXTRA_VISITS":{let{siteSettings:a}=e;return a.banner_frontend=t.extraVisitsStatus?"enabled":"disabled",{...e,siteSettings:a}}case"SET_SAMPLE_RATE":return{...e,sampleRate:t.sampleRate};case"SET_TOTAL_NUMBER_OF_IMAGES":return{...e,totalNumberOfImages:t.totalNumberOfImages};case"SET_PROCESSED_IMAGES":return{...e,processedImages:t.processedImages};case"SET_OFFLOAD_LIBRARY_LINK":return{...e,offloadLibraryLink:t.offloadLibraryLink};case"SET_ROLLBACK_LIBRARY_LINK":return{...e,rollbackLibraryLink:t.rollbackLibraryLink};case"SET_LOADING_ROLLBACK":return Object.prototype.hasOwnProperty.call(e.queryArgs,"optimole_action")&&(e.rollbackLibraryLink=!t.loadingSync),{...e,loadingRollback:t.loadingRollback};case"SET_LOADING_SYNC":return Object.prototype.hasOwnProperty.call(e.queryArgs,"optimole_action")&&(e.offloadLibraryLink=!t.loadingSync),{...e,loadingSync:t.loadingSync};case"SET_QUERY_ARGS":return{...e,queryArgs:t.queryArgs};case"SET_ERROR_MEDIA":return{...e,errorMedia:t.errorMedia};case"SET_CHECKED_OFFLOAD_CONFLICTS":return{...e,checkedOffloadConflicts:t.checkedOffloadConflicts};case"SET_OFFLOAD_CONFLICTS":return{...e,offloadConflicts:t.offloadConflicts};case"SET_LOGS":let{logs:l}=e;return l[t.logsType]=t.logs,{...e,logs:l};case"SET_OFFLOAD_LIMIT":return{...e,offloadLimit:t.offloadLimit};default:return e}},i={getAutoConnect:e=>e.autoConnect,getAPIKey:e=>e.apiKey,getAvailableApps:e=>e.availableApps,hasRestError:e=>e.hasRestError,hasValidKey:e=>e.hasValidKey,hasApplication:e=>e.hasApplication,hasDashboardLoaded:e=>e.hasDashboardLoaded,getUserData:e=>e.userData,getUserStatus:e=>e.userStatus,isConnected:e=>e.isConnected,isConnecting:e=>e.isConnecting,isLoading:e=>e.isLoading,showDisconnect:e=>e.showDisconnect,getConflicts:e=>e.conflicts,getOptimizedImages:e=>e.optimizedImages,getSiteSettings:(e,t=void 0)=>t?void 0!==e.siteSettings[t]?e.siteSettings[t]:void 0:e.siteSettings,getSampleRate:e=>e.sampleRate,getTotalNumberOfImages:e=>e.totalNumberOfImages,getProcessedImages:e=>e.processedImages,getOffloadLibraryLink:e=>e.offloadLibraryLink,getRollbackLibraryLink:e=>e.rollbackLibraryLink,getLoadingRollback:e=>e.loadingRollback,getLoadingSync:e=>e.loadingSync,getQueryArgs:e=>e.queryArgs,getErrorMedia:e=>e.errorMedia,getCheckedOffloadConflicts:e=>e.checkedOffloadConflicts,getOffloadConflicts:e=>e.offloadConflicts,getOffloadLimit:e=>e.offloadLimit,getLogs:(e,t=void 0)=>t?void 0!==e.logs[t]?e.logs[t]:void 0:e.logs,isSubApiKey:e=>e.apiKey&&e.apiKey.startsWith("optml-s"),canShowFreeUserWithOffloadNotice:e=>Boolean(e?.canShowFreeUserWithOffloadNotice)};if(void 0!==wp.data.createReduxStore){const e=wp.data.createReduxStore("optimole",{reducer:r,actions:l,selectors:i});wp.data.register(e)}else wp.data.registerStore("optimole",{reducer:r,actions:l,selectors:i});const c=window.wp.data;var d=a(184),m=a.n(d);const p=window.wp.primitives,g=(0,s.createElement)(p.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(p.Path,{d:"M15.1 4.8l-3-2.5V4c-4.4 0-8 3.6-8 8 0 3.7 2.5 6.9 6 7.7.3.1.6.1 1 .2l.2-1.5c-.4 0-.7-.1-1.1-.2l-.1.2v-.2c-2.6-.8-4.5-3.3-4.5-6.2 0-3.6 2.9-6.5 6.5-6.5v1.8l3-2.5zM20 11c-.2-1.4-.7-2.7-1.6-3.8l-1.2.8c.7.9 1.1 2 1.3 3.1L20 11zm-1.5 1.8c-.1.5-.2 1.1-.4 1.6s-.5 1-.8 1.5l1.2.9c.4-.5.8-1.1 1-1.8s.5-1.3.5-2l-1.5-.2zm-5.6 5.6l.2 1.5c1.4-.2 2.7-.7 3.8-1.6l-.9-1.1c-.9.7-2 1.1-3.1 1.2z"})),u=window.wp.components,b=()=>(0,s.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"21",height:"20",viewBox:"0 0 21 20",fill:"none"},(0,s.createElement)("path",{d:"M17.357 2.92894C16.9664 2.53842 16.3333 2.53842 15.9427 2.92894C15.5522 3.31946 15.5522 3.95263 15.9427 4.34315L17.357 2.92894ZM16.6499 16.364L15.9427 17.0711H15.9427L16.6499 16.364ZM14.5285 5.75737C14.138 5.36684 13.5048 5.36684 13.1143 5.75737C12.7238 6.14789 12.7238 6.78106 13.1143 7.17158L14.5285 5.75737ZM13.8214 13.5355L13.1143 14.2426L13.1143 14.2427L13.8214 13.5355ZM6.04325 14.2427C6.43377 14.6332 7.06694 14.6332 7.45746 14.2427C7.84799 13.8521 7.84799 13.219 7.45746 12.8284L6.04325 14.2427ZM6.32586 10.5662C6.24822 10.0194 5.74201 9.63905 5.19521 9.71669C4.64841 9.79434 4.26808 10.3005 4.34573 10.8473L6.32586 10.5662ZM3.21482 17.0711C3.60535 17.4616 4.23851 17.4616 4.62903 17.0711C5.01956 16.6806 5.01956 16.0474 4.62903 15.6569L3.21482 17.0711ZM2.70292 7.44452C2.87885 6.921 2.59707 6.354 2.07355 6.17807C1.55004 6.00215 0.98303 6.28393 0.807105 6.80744L2.70292 7.44452ZM1.993 0.292893C1.60247 -0.0976311 0.969306 -0.0976311 0.578782 0.292893C0.188258 0.683417 0.188258 1.31658 0.578782 1.70711L1.993 0.292893ZM18.5788 19.7071C18.9693 20.0976 19.6025 20.0976 19.993 19.7071C20.3835 19.3166 20.3835 18.6834 19.993 18.2929L18.5788 19.7071ZM15.9427 4.34315C19.0669 7.46735 19.0669 12.5327 15.9427 15.6569L17.357 17.0711C21.2622 13.1658 21.2622 6.83418 17.357 2.92894L15.9427 4.34315ZM13.1143 7.17158C14.6764 8.73368 14.6764 11.2663 13.1143 12.8284L14.5285 14.2427C16.8717 11.8995 16.8717 8.10051 14.5285 5.75737L13.1143 7.17158ZM10.2859 10H12.2859C12.2859 8.89544 11.3905 8.00001 10.2859 8.00001V10ZM7.45746 12.8284C6.81978 12.1908 6.44341 11.394 6.32586 10.5662L4.34573 10.8473C4.52209 12.0894 5.08876 13.2882 6.04325 14.2427L7.45746 12.8284ZM4.62903 15.6569C2.40899 13.4368 1.76507 10.2354 2.70292 7.44452L0.807105 6.80744C-0.363267 10.2902 0.43743 14.2937 3.21482 17.0711L4.62903 15.6569ZM10.2859 10L10.2859 10V8.00001C9.73388 8.00001 9.23252 8.22496 8.87168 8.58578L10.2859 10ZM0.578782 1.70711L8.87168 10L10.2859 8.58579L1.993 0.292893L0.578782 1.70711ZM8.87168 10L10.2859 11.4142L11.7001 10L10.2859 8.58579L8.87168 10ZM10.2859 11.4142L13.1143 14.2426L14.5285 12.8284L11.7001 10L10.2859 11.4142ZM13.1143 14.2427L15.9427 17.0711L17.357 15.6569L14.5285 12.8284L13.1143 14.2427ZM15.9427 17.0711L18.5788 19.7071L19.993 18.2929L17.357 15.6569L15.9427 17.0711ZM10.2859 10L10.2859 10L11.7001 11.4142C12.0609 11.0534 12.2859 10.552 12.2859 10H10.2859Z",fill:"#E77777"})),h=()=>(0,s.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"21",height:"16",viewBox:"0 0 21 16",fill:"none"},(0,s.createElement)("path",{d:"M4.00127 14.3639C0.486555 10.8492 0.486555 5.15071 4.00127 1.63599M16.7292 1.63599C20.2439 5.15071 20.2439 10.8492 16.7292 14.3639M6.8297 11.5355C4.87708 9.58286 4.87708 6.41704 6.8297 4.46441M13.9008 4.46441C15.8534 6.41704 15.8534 9.58286 13.9008 11.5355M11.3652 7.99995C11.3652 8.55223 10.9175 8.99995 10.3652 8.99995C9.81295 8.99995 9.36523 8.55223 9.36523 7.99995C9.36523 7.44766 9.81295 6.99995 10.3652 6.99995C10.9175 6.99995 11.3652 7.44766 11.3652 7.99995Z",stroke:"#6D955A",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})),_=((0,s.createElement)("svg",{width:"18",height:"16",viewBox:"0 0 18 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,s.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.9581 0C13.5192 0 17.2136 3.58 17.2136 8C17.2136 12.42 13.5192 16 8.9581 16C4.39696 16 0.702637 12.42 0.702637 8C0.702637 3.58 4.39696 0 8.9581 0ZM10.6558 9L11.0219 3H7.92606L8.29211 9H10.6558ZM11.0219 11.5115C11.0219 11.9809 10.8811 12.3473 10.6213 12.6107C10.3507 12.874 9.97188 13 9.48478 13C8.99768 13 8.61882 12.874 8.33739 12.6107C8.06677 12.3473 7.92606 11.9809 7.92606 11.5115C7.92606 11.0305 8.05595 10.6641 8.32656 10.4008C8.59717 10.1374 8.97603 10 9.48478 10C9.99353 10 10.3724 10.1374 10.6322 10.4008C10.892 10.6641 11.0219 11.0305 11.0219 11.5115Z",fill:"#AF3535"})),(0,s.createElement)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,s.createElement)("path",{d:"M17.25 8.25H21V4.5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),(0,s.createElement)("path",{d:"M3 12C3 7.029 7.029 3 12 3C15.63 3 18.751 5.154 20.174 8.25",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),(0,s.createElement)("path",{d:"M6.75 15.75H3V19.5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),(0,s.createElement)("path",{d:"M21 12C21 16.971 16.971 21 12 21C8.37 21 5.249 18.846 3.826 15.75",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}))),f=(0,s.createElement)("svg",{width:"44",height:"44",viewBox:"0 0 44 44",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,s.createElement)("path",{d:"M35.8621 13.647L22.0095 27.4996L15.085 20.5733",fill:"none",stroke:"white",strokeWidth:"2.75",strokeLinecap:"round",strokeLinejoin:"round"}),(0,s.createElement)("path",{d:"M38.5 22C38.5 31.1135 31.1135 38.5 22 38.5C12.8865 38.5 5.5 31.1135 5.5 22C5.5 12.8865 12.8865 5.5 22 5.5C24.6638 5.5 27.1718 6.14717 29.3993 7.26733",fill:"none",stroke:"white",strokeWidth:"2.75",strokeLinecap:"round",strokeLinejoin:"round"})),E=(0,s.createElement)("svg",{width:"20",height:"22",viewBox:"0 0 20 22",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,s.createElement)("path",{d:"M5 15C2.79086 15 1 13.2091 1 11C1 9.09295 2.33457 7.4976 4.12071 7.09695C4.04169 6.74395 4 6.37684 4 6C4 3.23858 6.23858 1 9 1C11.4193 1 13.4373 2.71825 13.9002 5.00098C13.9334 5.00033 13.9666 5 14 5C16.7614 5 19 7.23858 19 10C19 12.419 17.2822 14.4367 15 14.9M13 12L10 9M10 9L7 12M10 9L10 21",stroke:"#577BF9",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})),x=(0,s.createElement)("svg",{width:"20",height:"22",viewBox:"0 0 20 22",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,s.createElement)("path",{d:"M5 15C2.79086 15 1 13.2091 1 11C1 9.09295 2.33457 7.4976 4.12071 7.09695C4.04169 6.74395 4 6.37684 4 6C4 3.23858 6.23858 1 9 1C11.4193 1 13.4373 2.71825 13.9002 5.00098C13.9334 5.00033 13.9666 5 14 5C16.7614 5 19 7.23858 19 10C19 12.419 17.2822 14.4367 15 14.9M7 18L10 21M10 21L13 18M10 21V9",stroke:"#577BF9",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})),v=(0,s.createElement)("svg",{width:"20",height:"18",viewBox:"0 0 20 22",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,s.createElement)("path",{d:"M10.0015 8V10M10.0015 14H10.0115M3.0733 18H16.9297C18.4693 18 19.4316 16.3333 18.6618 15L11.7336 3C10.9637 1.66667 9.03925 1.66667 8.26945 3L1.34125 15C0.571445 16.3333 1.5337 18 3.0733 18Z",stroke:"#DE9F0C",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})),y=(0,s.createElement)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"#577BF9",xmlns:"http://www.w3.org/2000/svg","svg-inline":"",className:"absolute w-16 h-16 text-o-blue outline-none",role:"presentation",focusable:"false",tabIndex:"-1"},(0,s.createElement)("path",{d:"M6.08998 13.28H9.17998V20.48C9.17998 22.16 10.09 22.5 11.2 21.24L18.77 12.64C19.7 11.59 19.31 10.72 17.9 10.72H14.81V3.52002C14.81 1.84002 13.9 1.50002 12.79 2.76002L5.21998 11.36C4.29998 12.42 4.68998 13.28 6.08998 13.28Z",stroke:"#577BF9",strokeWidth:"1.5",strokeMiterlimit:"10",strokeLinecap:"round",strokeLinejoin:"round"})),w=(0,s.createElement)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"#577BF9",xmlns:"http://www.w3.org/2000/svg","svg-inline":"",className:"absolute w-16 h-16 text-o-blue outline-none",role:"presentation",focusable:"false",tabIndex:"-1"},(0,s.createElement)("path",{d:"M3 12C3 16.9706 7.02944 21 12 21C14.3051 21 16.4077 20.1334 18 18.7083L21 16M21 12C21 7.02944 16.9706 3 12 3C9.69494 3 7.59227 3.86656 6 5.29168L3 8M21 21V16M21 16H16M3 3V8M3 8H8",stroke:"#577BF9",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})),A=(0,s.createElement)("svg",{viewBox:"0 0 512 512",xmlns:"http://www.w3.org/2000/svg",fill:"none",stroke:"#577BF9","svg-inline":"",className:"absolute w-16 h-16 text-o-blue outline-none",role:"presentation",focusable:"false",tabIndex:"-1"},(0,s.createElement)("polyline",{points:"336 176 225.2 304 176 255.8",stroke:"#577BF9",strokeWidth:"30.5",strokeLinecap:"round",strokeLinejoin:"round"}),(0,s.createElement)("path",{d:"M463.1,112.37C373.68,96.33,336.71,84.45,256,48,175.29,84.45,138.32,96.33,48.9,112.37,32.7,369.13,240.58,457.79,256,464,271.42,457.79,479.3,369.13,463.1,112.37Z",stroke:"#577BF9",strokeWidth:"30.5",strokeLinecap:"round",strokeLinejoin:"round"})),N=(0,s.createElement)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"#577BF9",xmlns:"http://www.w3.org/2000/svg","svg-inline":"",className:"absolute w-16 h-16 text-o-blue outline-none",role:"presentation",focusable:"false",tabIndex:"-1"},(0,s.createElement)("path",{d:"M10.65 3L9.93163 3.53449L9.32754 5.54812L7.47651 4.55141L6.5906 4.68143L4.68141 6.59062L4.55139 7.47652L5.5481 9.32755L3.53449 9.93163L3 10.65V13.35L3.53449 14.0684L5.54811 14.6725L4.55142 16.5235L4.68144 17.4094L6.59063 19.3186L7.47653 19.4486L9.32754 18.4519L9.93163 20.4655L10.65 21H13.35L14.0684 20.4655L14.6725 18.4519L16.5235 19.4486L17.4094 19.3185L19.3186 17.4094L19.4486 16.5235L18.4519 14.6724L20.4655 14.0684L21 13.35V10.65L20.4655 9.93163L18.4519 9.32754L19.4486 7.47654L19.3186 6.59063L17.4094 4.68144L16.5235 4.55142L14.6725 5.54812L14.0684 3.53449L13.35 3H10.65Z",stroke:"#577BF9",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),(0,s.createElement)("circle",{cx:"12",cy:"12",r:"3.75",stroke:"#577BF9",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})),S=(0,s.createElement)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},(0,s.createElement)("circle",{cx:"12",cy:"12",r:"10"}),(0,s.createElement)("path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"}),(0,s.createElement)("path",{d:"M2 12h20"})),L=(0,s.createElement)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},(0,s.createElement)("path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"}),(0,s.createElement)("circle",{cx:"12",cy:"7",r:"4"})),C=(0,s.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},(0,s.createElement)("path",{d:"M12 17V3"}),(0,s.createElement)("path",{d:"m6 11 6 6 6-6"}),(0,s.createElement)("path",{d:"M19 21H5"})),k=(0,s.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},(0,s.createElement)("path",{d:"M12 13v8l-4-4"}),(0,s.createElement)("path",{d:"m12 21 4-4"}),(0,s.createElement)("path",{d:"M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284"})),D=(0,s.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},(0,s.createElement)("path",{d:"M3 3v16a2 2 0 0 0 2 2h16"}),(0,s.createElement)("path",{d:"M7 11h8"}),(0,s.createElement)("path",{d:"M7 16h3"}),(0,s.createElement)("path",{d:"M7 6h12"})),T=window.wp.apiFetch;var I=a.n(T);const M=window.wp.url,O=window.wp.notices,z=window.optimoleDashboardApp.submenu_links,B=(e=!0)=>{const t=document.querySelector("li#toplevel_page_optimole");let a=document.querySelector("li#toplevel_page_optimole .wp-submenu");a||(a=document.createElement("ul"),a.classList.add("wp-submenu","wp-submenu-wrap"),t.classList.add("wp-has-submenu","wp-has-current-submenu","wp-menu-open"),t.appendChild(a)),e?(z.forEach((e=>{if(document.querySelector(`li#toplevel_page_optimole a[href="${e.href}"]`))return;const t=document.createElement("li"),s=document.createElement("a");s.href=e.href,s.innerHTML=e.text,t.appendChild(s),e.hash&&e.hash===window.location.hash&&(t.classList.add("current"),s.classList.add("current")),a.appendChild(t)})),a.style.display="block"):a.style.display="none"},{setIsConnected:j,setIsConnecting:R,setIsLoading:H,setHasRestError:F,setHasValidKey:P,setHasApplication:V,setAPIKey:q,setUserData:G,setAvailableApps:$,sethasDashboardLoaded:K,setShowDisconnect:Z,setConflicts:W,setOptimizedImages:U,setSiteSettings:Y,setSampleRate:Q,setCheckedOffloadConflicts:X,setOffloadConflicts:J,setLoadingSync:ee,setLoadingRollback:te,setTotalNumberOfImages:ae,setProcessedImages:se,setErrorMedia:oe,setOffloadLibraryLink:le,setRollbackLibraryLink:ne,setExtraVisits:re,setLogs:ie,setShowFinishNotice:ce,setOffloadLimitReached:de,ensureOffloadingRollbackDisabled:me,setOffloadLimit:pe}=(0,c.dispatch)("optimole"),{getOptimizedImages:ge,getQueryArgs:ue,getTotalNumberOfImages:be,getSiteSettings:he}=(0,c.select)("optimole"),{createNotice:_e}=(0,c.dispatch)(O.store),fe=(e={})=>{e.offset=void 0!==e.offset?e.offset:0,I()({path:optimoleDashboardApp.routes.upload_onboard_images,method:"POST",data:e}).then((t=>{!1===t.data&&1e3>e.offset&&fe({offset:e.offset+100}),"success"===t.code&&console.log("%c Images Crawled.","color: #59B278")})).catch((e=>(console.log("Error while crawling images",e),e.data)))},Ee=(e,t=(()=>{}))=>{R(!0),H(!0),F(!1),I()({path:optimoleDashboardApp.routes.register_service,method:"POST",data:e,parse:!1}).then((e=>e.json())).then((e=>(R(!1),H(!1),"success"===e.code&&(j(!0),P(!0),V(!0),q(e.data.api_key),G(e.data),$(e.data),fe(),B(!0)),t&&t(e),e.data))).catch((e=>(R(!1),H(!1),F(!0),e.data)))},xe=()=>{H(!0),I()({path:optimoleDashboardApp.routes.disconnect,method:"GET",parse:!1}).then((e=>{H(!1),V(!1),q(""),G(null),$(null),e.ok?(j(!1),K(!1),Z(!1),B(!1),console.log("%c Disconnected from Optimole API.","color: #59B278")):console.error(e)}))},ve=()=>{H(!0),I()({path:optimoleDashboardApp.routes.request_update,method:"GET",parse:!1}).then((e=>200<=e.status&&300>e.status?e.json():(console.log(`%c Request failed with status ${e.status}`,"color: #E7602A"),Promise.resolve()))).then((e=>{H(!1),e&&(G(e.data),void 0!==e?.data?.extra_visits&&re(e.data.extra_visits),"disconnected"===e.code&&(j(!1),K(!1),console.log("%c Disconnected from Optimole API.","color: #59B278")))}))},ye=(e=(()=>{}))=>{if(0<ge().length)return console.log("%c Images already exist.","color: #59B278"),e&&e(),!1;I()({path:optimoleDashboardApp.routes.poll_optimized_images,method:"GET"}).then((t=>{"success"===t.code?(U(t.data),console.log("%c Images Fetched.","color: #59B278")):console.log("%c No images available.","color: #E7602A"),e&&e(t)})).catch((e=>(console.log("Error while polling images",e),e.data)))},we=(e,t=!1,a=!1,s=(()=>{}))=>{H(!0),I()({path:optimoleDashboardApp.routes.update_option,method:"POST",data:{settings:e}}).then((e=>{H(!1),"success"===e.code&&(Y(e.data),a||Ce(optimoleDashboardApp.strings.options_strings.settings_saved),console.log("%c Settings Saved.","color: #59B278"))})).then((()=>{t&&ve()})).then((()=>{s()})).catch((e=>(H(!1),Ce(optimoleDashboardApp.strings.options_strings.settings_saved_error),console.log("Error while saving settings",e),e.data)))},Ae=e=>{H(!0),I()({path:optimoleDashboardApp.routes.clear_cache_request,method:"POST",data:{type:e},parse:!1}).then((e=>(H(!1),200<=e.status&&300>e.status?(Ce(optimoleDashboardApp.strings.options_strings.cache_cleared),void console.log("%c New cache token generated.","color: #59B278")):(Ce(optimoleDashboardApp.strings.options_strings.cache_cleared_error),void console.log("%c Could not generate cache token.","color: #E7602A")))))},Ne=(e=(()=>{}))=>{I()({path:optimoleDashboardApp.routes.get_offload_conflicts,method:"GET"}).then((t=>{X(!0),0!==t.data.length&&J(t.data),e&&e(t)}))},Se=e=>{const t=ue();"offload_images"===e.action&&(Object.prototype.hasOwnProperty.call(t,"optimole_action")&&le(!1),ee(!0)),"rollback_images"===e.action&&(Object.prototype.hasOwnProperty.call(t,"optimole_action")&&ne(!1),te(!0)),H(!0),I()({path:optimoleDashboardApp.routes.number_of_images_and_pages,method:"POST",data:{action:e.action,refresh:e.refresh||!1},parse:!1}).then((t=>{if(200<=t.status&&300>t.status)return t.json();"offload_images"===e.action&&(ee(!1),H(!1)),"rollback_images"===e.action&&(te(!1),H(!1))})).then((a=>{if(!a.data.count||0===a.data.count||!1===a.data.status)return console.log("%c No images available.","color: #E7602A"),ee(!1),te(!1),H(!1),0===a.data.count&&(de("disabled"),ce(a.data.action)),a.data.reached_limit&&de(a.data.reached_limit?"enabled":"disabled"),a.data.offload_limit&&pe(a.data.offload_limit),me(),we(he(),!1),"offload_images"===e.action&&Object.prototype.hasOwnProperty.call(t,"optimole_action")&&le(!0),void("rollback_images"===e.action&&Object.prototype.hasOwnProperty.call(t,"optimole_action")&&ne(!0));let s=be();e.refresh?(se(0!==s?Math.abs(s-a.data.count):0),0!==a.data.count&&0===s&&ae(a.data.count)):ae(a.data.count),setTimeout((()=>{Se({action:e.action,refresh:!0})}),1e4)})).finally((()=>{var t;t="offload_images"===e.action?"offload":"rollback",jQuery.ajax({type:"POST",url:window.ajaxurl,data:{action:"optml_fetch_logs",nonce:optimoleDashboardApp.nonce,type:t},success:e=>{ie(t,e)}})})).catch((t=>{oe(e.action),ee(!1),te(!1)}))},Le=async(e="offload_images")=>{try{return await I()({path:(0,M.addQueryArgs)(optimoleDashboardApp.routes.clear_offload_errors,{action:e}),method:"GET"})}catch(e){console.log(e)}},Ce=e=>{_e("info",e,{isDismissible:!0,type:"snackbar"})},ke=(e,t=(()=>{}))=>{I()({path:optimoleDashboardApp.routes.dismiss_notice,method:"POST",data:{key:e}}).then((e=>{"success"===e.code?t&&t(e):Ce(e?.data?.error||optimoleDashboardApp.strings.options_strings.settings_saved_error)})).catch((e=>{Ce(optimoleDashboardApp.strings.options_strings.settings_saved_error)}))},De=({tab:e,setTab:t})=>{const[a,l]=(0,o.useState)(!1),{setShowDisconnect:n}=(0,c.useDispatch)("optimole"),{isConnected:r,isLoading:i,hasApplication:d,hasDashboardLoaded:p,hasConflicts:_}=(0,c.useSelect)((e=>{const{isConnected:t,isLoading:a,hasApplication:s,hasDashboardLoaded:o,getConflicts:l}=e("optimole"),n=l();return{isConnected:t(),isLoading:a(),hasApplication:s(),hasDashboardLoaded:o(),hasConflicts:0<n.count||0}}));(0,o.useEffect)((()=>{_&&l(!0)}),[_]);const f=[{label:optimoleDashboardApp.strings.dashboard_menu_item,value:"dashboard"},{label:optimoleDashboardApp.strings.conflicts_menu_item,value:"conflicts",isDisabled:!a},{label:optimoleDashboardApp.strings.settings_menu_item,value:"settings"},{label:optimoleDashboardApp.strings.help_menu_item,value:"help"}],E=r&&d&&!p;return(0,s.createElement)("header",{className:"bg-white shadow-sm px-2.5 py-5 pb-0"},(0,s.createElement)("div",{className:"flex flex-col sm:flex-row justify-between items-center max-w-screen-xl mx-auto my-0 pb-5"},(0,s.createElement)("div",{className:"items-center flex justify-start cursor-default"},(0,s.createElement)("img",{className:"max-width-64 w-16 h-16 mr-3",src:`${optimoleDashboardApp.assets_url}/img/logo.png`,alt:optimoleDashboardApp.strings.optimole+" "+optimoleDashboardApp.strings.service_details,title:optimoleDashboardApp.strings.optimole+" "+optimoleDashboardApp.strings.service_details}),(0,s.createElement)("h3",{className:"text-gray-800 text-2 font-serif font-bold"},optimoleDashboardApp.strings.optimole)),(0,s.createElement)("div",{className:"flex items-center"},r?(0,s.createElement)(s.Fragment,null,(0,s.createElement)(u.DropdownMenu,{icon:i||E?(0,s.createElement)(u.Icon,{icon:g,className:"animate-spin fill-success"}):(0,s.createElement)(u.Icon,{icon:h}),toggleProps:{className:"optml-header__dropdown uppercase font-bold text-xs text-success hover:text-success active:text-success focus:text-success mr-3 border border-gray-300 rounded-md border-solid gap-2",iconPosition:"right"},popoverProps:{className:"optml-header__dropdown__popover"},text:E?optimoleDashboardApp.strings.connecting:optimoleDashboardApp.strings.connected,controls:[{title:optimoleDashboardApp.strings.optimole+" "+optimoleDashboardApp.strings.dashboard_menu_item,onClick:()=>window.open(optimoleDashboardApp.optimoleDashHome,"_blank")},{title:optimoleDashboardApp.strings.refresh_stats_cta,onClick:ve,isDisabled:E},{title:optimoleDashboardApp.strings.disconnect_btn,onClick:()=>n(!0),isDisabled:E}]})):(0,s.createElement)(s.Fragment,null,(0,s.createElement)("div",{className:"uppercase font-bold text-xs text-danger mr-3"},optimoleDashboardApp.strings.not_connected),(0,s.createElement)(u.Icon,{icon:b})))),r&&d&&p&&(0,s.createElement)("ul",{className:"flex gap-8 items-center max-w-screen-xl mx-auto my-0 justify-center sm:justify-normal"},f.filter((e=>!e?.isDisabled)).map((({label:a,value:o})=>(0,s.createElement)("li",{key:o,className:m()("cursor-pointer text-purple-gray font-bold text-lg m-0 py-2 px-3 transition-colors duration-200 ease-in-out border-0 border-b-4 border-b-white border-solid",{"text-black !border-b-info":e===o}),onClick:()=>t(o)},a)))))},Te=()=>{const{setShowDisconnect:e}=(0,c.useDispatch)("optimole"),{isLoading:t}=(0,c.useSelect)((e=>{const{isLoading:t}=e("optimole");return{isLoading:t()}}));return(0,s.createElement)(u.Modal,{title:optimoleDashboardApp.strings.disconnect_title,className:"optml__modal",onRequestClose:()=>e(!1)},(0,s.createElement)("p",{dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.disconnect_desc}}),(0,s.createElement)("div",{className:"flex gap-2"},(0,s.createElement)(u.Button,{variant:"default",className:"optml__button flex w-full justify-center rounded font-bold mt-4 min-h-40",onClick:()=>e(!1)},optimoleDashboardApp.strings.keep_connected),(0,s.createElement)(u.Button,{isDestructive:!0,className:"optml__button flex w-full justify-center rounded font-bold mt-4 min-h-40",isBusy:t,disabled:t,onClick:xe},optimoleDashboardApp.strings.disconnect_btn)))},Ie=({setMethod:e})=>{const[t,a]=(0,o.useState)(""),[l,n]=(0,o.useState)({}),[r,i]=(0,o.useState)(0),{setShowDisconnect:d}=(0,c.useDispatch)("optimole"),{availableApps:m,hasValidKey:p,isConnected:g,isConnecting:b,isLoading:h}=(0,c.useSelect)((e=>{const{getAvailableApps:t,hasValidKey:a,isConnected:s,isConnecting:o,isLoading:l}=e("optimole");return{availableApps:t(),hasValidKey:a(),isConnected:s(),isConnecting:o(),isLoading:l()}}));return(0,s.createElement)("div",{className:"text-2 font-bold m-0 text-gray-700"},(0,s.createElement)("div",{className:"text-gray-800 font-serif leading-7"},optimoleDashboardApp.strings.connect_btn),(0,s.createElement)("p",{className:"text-xl font-normal text-gray-800",dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.steps_connect_api_desc}}),(0,s.createElement)("div",{className:"flex flex-col gap-8 p-8 bg-light-blue border border-blue-300 rounded-md"},(0,s.createElement)("div",{className:"flex flex-col sm:flex-row gap-8 items-stretch sm:items-end"},(0,s.createElement)(u.TextControl,{label:g?optimoleDashboardApp.strings.your_api_key:optimoleDashboardApp.strings.add_api,placeholder:optimoleDashboardApp.strings.email,disabled:g,value:t,onChange:a,className:"optml__input basis-4/5"}),g?(0,s.createElement)(u.Button,{variant:"default",isBusy:h,disabled:h,className:"optml__button flex w-full justify-center rounded font-bold min-h-40 basis-1/5",onClick:d},optimoleDashboardApp.strings.disconnect_btn):(0,s.createElement)(u.Button,{variant:"primary",isBusy:b,disabled:b||0===t.length,className:"optml__button flex w-full justify-center rounded font-bold min-h-40 basis-1/5",onClick:()=>{n({}),((e,t=(()=>{}))=>{R(!0),H(!0),F(!1),I()({path:optimoleDashboardApp.routes.connect,method:"POST",data:e,parse:!1}).then((e=>e.json())).then((e=>(R(!1),H(!1),"success"===e.code?(j(!0),P(!0),q(e.data.api_key),void 0!==e.data.app_count&&1<e.data.app_count?$(e.data):(V(!0),G(e.data)),fe(),B(!0),console.log("%c Optimole API connection successful.","color: #59B278")):(P(!1),console.log("%c Invalid API Key.","color: #E7602A")),t&&t(e),e.data))).catch((e=>(R(!1),H(!1),F(!0),e.data)))})({api_key:t},(e=>{"success"!==e.code&&n({error_connect:e.data})}))}},optimoleDashboardApp.strings.connect_btn)),m&&(0,s.createElement)("div",{className:"flex flex-col sm:flex-row gap-8 items-stretch sm:items-end"},(0,s.createElement)("div",{className:"basis-4/5"},(0,s.createElement)(u.SelectControl,{label:optimoleDashboardApp.strings.select+" "+optimoleDashboardApp.strings.your_domain,value:r,options:m.available_apps.map(((e,t)=>({label:e.domain,value:t}))),onChange:i,className:"optml__select has_large_title",__nextHasNoMarginBottom:!0})),(0,s.createElement)(u.Button,{variant:"primary",isBusy:b,disabled:b,className:"optml__button flex w-full justify-center rounded font-bold min-h-40 basis-1/5",onClick:()=>{((e,t=(()=>{}))=>{R(!0),F(!1),I()({path:optimoleDashboardApp.routes.select_application,method:"POST",data:e}).then((e=>{R(!1),H(!1),"success"===e.code?(P(!0),V(!0),q(e.data.api_key),G(e.data),$(e.data),console.log("%c Optimole API connection successful.","color: #59B278")):(P(!1),console.log("%c Invalid API Key.","color: #E7602A")),t&&t(e)})).catch((e=>(R(!1),F(!0),e.data)))})({api_key:t,application:null!=m&&void 0!==m.available_apps?m.available_apps[r].key:""},(e=>{"success"!==e.code&&n({error_connect:e.data})}))}},optimoleDashboardApp.strings.select))),!p&&void 0!==l.error_connect&&(0,s.createElement)("p",{className:"block text-xs mt-1 text-danger",dangerouslySetInnerHTML:{__html:l.error_connect}}),(0,s.createElement)("div",{className:"text-center py-3"},(0,s.createElement)(u.Button,{variant:"link",onClick:()=>e("email")},optimoleDashboardApp.strings.back_to_connect)))},Me="optml-connect flex flex-col justify-between max-w-screen-xl mt-8 mb-5 mx-auto p-0 transition-all ease-in-out duration-700 relative bg-white text-gray-700 border-0 rounded-lg shadow-md",Oe="flex gap-8 p-8 flex-col md:flex-row",ze=()=>(0,s.createElement)("div",{className:"bg-danger text-white rounded relative px-6 py-5 mb-0 m-12",dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.notice_api_not_working}}),Be=()=>{const[e,t]=(0,o.useState)(optimoleDashboardApp.current_user.email),[a,l]=(0,o.useState)("email"),[n,r]=(0,o.useState)({}),[i,d]=(0,o.useState)(!1),{setAutoConnect:m}=(0,c.useDispatch)("optimole"),{autoConnect:p,hasRestError:g,isConnecting:b}=(0,c.useSelect)((e=>{const{getAutoConnect:t,hasRestError:a,isConnecting:s}=e("optimole");return{autoConnect:t(),hasRestError:a(),isConnecting:s()}}));return(0,o.useEffect)((()=>{"no"!==p&&Ee({email:p,auto_connect:!0},(e=>{m("no"),"email_registered"!==e.code?"site_exists"!==e.code?"success"!==e.code&&e.message&&r({error_autoconnect:e.message}):r({site_exists:e.message}):r({email_registered:e.message})}))}),[]),(0,o.useEffect)((()=>{(0===e.length||(0,M.isEmail)(e))&&n.invalid_email&&(delete n.invalid_email,r(n))}),[e]),"key"===a?(0,s.createElement)("div",{className:Me},g&&(0,s.createElement)(ze,null),(0,s.createElement)("div",{className:Oe},(0,s.createElement)(Ie,{setMethod:l}))):(0,s.createElement)("div",{className:Me},g&&(0,s.createElement)(ze,null),(0,s.createElement)("div",{className:Oe},(0,s.createElement)("div",{className:"optml-connect__content basis-8/12"},(0,s.createElement)("div",{className:"inline-block bg-light-blue text-gray-500 text-sm font-medium px-4 py-1.5 rounded-full mb-4"},optimoleDashboardApp.strings.account_needed_trust_badge),(0,s.createElement)("div",{className:"text-gray-700 font-serif text-2xl font-bold leading-7 m-0"},optimoleDashboardApp.strings.account_needed_heading),(0,s.createElement)("p",{className:"text-base font-normal text-gray-500",dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.account_needed_sub_heading}}),(0,s.createElement)("div",{className:"inline-flex items-center bg-light-blue px-4 py-1.5 rounded-full mb-5 text-sm text-gray-800"},(0,s.createElement)("span",{className:"mr-2"},"⏱️"),optimoleDashboardApp.strings.account_needed_setup_time),(0,s.createElement)("p",{className:"text-sm text-gray-700 mb-5 leading-normal",dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.account_needed_title}}),(0,s.createElement)("button",{onClick:()=>d(!i),className:"inline-flex items-center bg-light-blue px-4 py-1.5 rounded-full mb-4 text-sm text-gray-500 cursor-pointer transition-all hover:bg-blue-100 border-none",role:"button"},(0,s.createElement)("span",null,optimoleDashboardApp.strings.account_needed_benefits_toggle),(0,s.createElement)("span",{className:`dashicons dashicons-arrow-${i?"up":"down"} ml-1`})),i&&(0,s.createElement)("div",{className:"mb-4"},(0,s.createElement)("div",{className:"flex py-3 items-center"},(0,s.createElement)(u.Icon,{icon:"yes-alt"}),(0,s.createElement)("p",{className:"text-base ml-3 m-0",dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.account_needed_subtitle_1}})),(0,s.createElement)("div",{className:"flex py-3 items-center"},(0,s.createElement)(u.Icon,{icon:"yes-alt"}),(0,s.createElement)("p",{className:"text-base ml-3 m-0",dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.account_needed_subtitle_2}})),(0,s.createElement)("div",{className:"flex py-3 items-center"},(0,s.createElement)(u.Icon,{icon:"yes-alt"}),(0,s.createElement)("p",{className:"text-base ml-3 m-0",dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.account_needed_subtitle_4}})))),(0,s.createElement)("div",{className:"optml-connect__form basis-4/12 p-8 bg-light-blue border border-blue-300 rounded-md"},(0,s.createElement)(u.TextControl,{label:optimoleDashboardApp.strings.email_address_label,placeholder:optimoleDashboardApp.strings.email,value:e,onChange:t,className:"optml__input",onBlur:()=>{0===e.length||(0,M.isEmail)(e)||r({invalid_email:optimoleDashboardApp.strings.invalid_email})}}),0<Object.keys(n).length&&Object.keys(n).map((e=>(0,s.createElement)("p",{key:e,className:"block text-xs mt-1 text-danger",dangerouslySetInnerHTML:{__html:n[e]}})))||(0,s.createElement)("br",null),(0,s.createElement)(u.Button,{variant:"primary",isBusy:b,disabled:b||0===e.length||!(0,M.isEmail)(e),className:"optml__button flex w-full justify-center rounded font-bold min-h-40",onClick:()=>{r({}),Ee({email:e},(e=>{"email_registered"!==e.code?"site_exists"!==e.code?"domain_not_accessible"!==e.code?"success"!==e.code&&r({error_register:e.message}):r({domain_not_accessible:e.message}):r({site_exists:e.message}):r({email_registered:e.message})}))}},optimoleDashboardApp.strings.register_btn),(0,s.createElement)("br",null),(0,s.createElement)("br",null),(0,s.createElement)("div",{className:"base-control-label"},optimoleDashboardApp.strings.existing_user),(0,s.createElement)(u.Button,{variant:"secondary",className:"optml__button flex w-full justify-center rounded font-bold mt-4 min-h-40 mb-4",style:{backgroundColor:"#EAE7F1",borderColor:"#9CA3AF",color:"#000000"},onClick:()=>l("key")},optimoleDashboardApp.strings.api_exists),(0,s.createElement)("div",{class:"flex items-center justify-center text-gray-600 mb-4"},(0,s.createElement)("span",{class:"mr-1.5"},"🔒"),optimoleDashboardApp.strings.secure_connection),(0,s.createElement)("p",{className:"mb-0",dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.signup_terms}}))))},je=({value:e,max:t=100,className:a,colorOverage:o=!1,...l})=>{const n=Math.round(e/t*100),r=(l.background,m()("w-full h-2.5 border rounded-md border-solid bg-white border-light-gray relative overflow-hidden",a)),i=m()("absolute left-0 h-full",{"bg-info":!o||70>n,"bg-red-500":o&&100<n,"bg-amber-500":o&&70<n&&100>n});return(0,s.createElement)("div",{className:r,role:"progressbar","aria-valuemin":"0","aria-valuemax":t,"aria-valuenow":e,...l},(0,s.createElement)("div",{className:i,style:{width:`${n}%`}}))},Re=[optimoleDashboardApp.strings.options_strings.connect_step_0,optimoleDashboardApp.strings.options_strings.connect_step_1,optimoleDashboardApp.strings.options_strings.connect_step_2,optimoleDashboardApp.strings.options_strings.connect_step_3],He=()=>{const[e,t]=(0,o.useState)(0),[a,l]=(0,o.useState)(0),[n,r]=(0,o.useState)(0),{sethasDashboardLoaded:i}=(0,c.useDispatch)("optimole");(0,o.useEffect)((()=>{if(n<=5){const e=setTimeout((()=>{d()}),1e3);return()=>{e&&clearTimeout(e)}}}),[n]);const d=()=>{if(r(n+1),n>=5)return i(!0),r(0),l(0),void t(0);t(Math.floor(n/5*100)),e>30*(a+1)&&l(a+1)};return(0,s.createElement)("div",{className:"optml-connecting flex flex-col justify-between max-w-screen-xl mt-8 mb-5 mx-auto p-0 transition-all ease-in-out duration-700 relative bg-white text-gray-700 border-0 rounded-lg shadow-md"},(0,s.createElement)("div",{className:"flex flex-col md:flex-row items-center justify-center gap-5 px-8 sm:px-0 py-24"},(0,s.createElement)("img",{className:"max-w-full",src:optimoleDashboardApp.assets_url+"img/connecting.png"}),(0,s.createElement)("div",{className:"text-center md:text-left"},(0,s.createElement)("div",{className:"font-bold text-2xl"},optimoleDashboardApp.strings.account_connecting_title),(0,s.createElement)("div",{className:"text-base"},optimoleDashboardApp.strings.account_connecting_subtitle),(0,s.createElement)(je,{className:"mt-2.5 mb-1.5 mx-0 h-5 border-gray-200",value:n,max:5,background:"#e6e6e6"}),(0,s.createElement)("div",{className:"text-xs"},Re[a]+" ("+e+"%)"))))},Fe=window.wp.i18n,Pe=(0,s.createElement)(p.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},(0,s.createElement)(p.Path,{d:"M10 2c4.42 0 8 3.58 8 8s-3.58 8-8 8-8-3.58-8-8 3.58-8 8-8zm1.13 9.38l.35-6.46H8.52l.35 6.46h2.26zm-.09 3.36c.24-.23.37-.55.37-.96 0-.42-.12-.74-.36-.97s-.59-.35-1.06-.35-.82.12-1.07.35-.37.55-.37.97c0 .41.13.73.38.96.26.23.61.34 1.06.34s.8-.11 1.05-.34z"})),Ve=(0,s.createElement)(p.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(p.Path,{d:"M12 4.75a7.25 7.25 0 100 14.5 7.25 7.25 0 000-14.5zM3.25 12a8.75 8.75 0 1117.5 0 8.75 8.75 0 01-17.5 0zM12 8.75a1.5 1.5 0 01.167 2.99c-.465.052-.917.44-.917 1.01V14h1.5v-.845A3 3 0 109 10.25h1.5a1.5 1.5 0 011.5-1.5zM11.25 15v1.5h1.5V15h-1.5z"})),qe=(0,s.createElement)(p.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(p.Path,{d:"M19.5 4.5h-7V6h4.44l-5.97 5.97 1.06 1.06L18 7.06v4.44h1.5v-7Zm-13 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-3H17v3a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h3V5.5h-3Z"})),Ge=function(){const[e,t]=(0,s.useState)(null),[a,o]=(0,s.useState)({width:0,height:0}),l=(0,s.useCallback)((()=>{o({width:(null==e?void 0:e.offsetWidth)||0,height:(null==e?void 0:e.offsetHeight)||0})}),[null==e?void 0:e.offsetHeight,null==e?void 0:e.offsetWidth]);return $e("resize",l),Ke((()=>{l()}),[null==e?void 0:e.offsetHeight,null==e?void 0:e.offsetWidth]),[t,a]},$e=function(e,t,a,o){const l=(0,s.useRef)(t);Ke((()=>{l.current=t}),[t]),(0,s.useEffect)((()=>{var t;const s=null!==(t=null==a?void 0:a.current)&&void 0!==t?t:window;if(!s||!s.addEventListener)return;const n=e=>l.current(e);return s.addEventListener(e,n,o),()=>{s.removeEventListener(e,n,o)}}),[e,a,o])},Ke="undefined"!=typeof window?s.useLayoutEffect:s.useEffect,Ze="yes"!==optimoleDashboardApp.connection_status,We=({src:e,oldSize:t,newSize:a})=>{const[o,{width:l}]=Ge();return(0,s.createElement)("div",{className:"basis-1/4"},(0,s.createElement)("img",{src:e,className:"w-full border border-slate-200 rounded-md border-solid",style:{height:l},ref:o}),(0,s.createElement)("p",{className:"optml__bullet w-full h-4"},optimoleDashboardApp.strings.latest_images.percentage_saved.replace("{ratio}",(()=>{let e=(100*(1-a/t)).toFixed(1);return 1>e?"1":100<e?(Math.floor(e/10+10)/10).toFixed(1).toString():e.toString()})())," "))},Ue=()=>{const[e,{width:t}]=Ge();return(0,s.createElement)("div",{className:"basis-1/4"},(0,s.createElement)("div",{className:"optml__loader w-full rounded-md",style:{height:t},ref:e}),(0,s.createElement)("p",{className:"optml__loader w-full h-4"}))},Ye=()=>{const[e,t]=(0,o.useState)(!1),[a,l]=(0,o.useState)(0),[n,r]=(0,o.useState)(0),[i,d]=(0,o.useState)(0);(0,o.useEffect)((()=>{i<=20&&setTimeout((()=>{p()}),1e3)}),[i]);const{images:m}=(0,c.useSelect)((e=>{const{getOptimizedImages:t}=e("optimole");return{images:t()||[]}}));(0,o.useEffect)((()=>{8<=m.length?t(!0):e||Ze||ye((()=>{t(!0)}))}),[]);const p=()=>{d(i+1),i>=20?ye((()=>{t(!0),d(0),r(0),l(0),ve()})):(l(Math.floor(i/20*100)),a>30*(n+1)&&r(n+1))};return(0,s.createElement)("div",null,(0,s.createElement)("h3",{className:"text-gray-800 text-xl font-semibold mb-5 m-0"},optimoleDashboardApp.strings.latest_images.last_optimized_images),Ze&&!e&&(0,s.createElement)("div",{className:"flex items-center flex-col py-2"},(0,s.createElement)("p",{className:"font-semibold"},optimoleDashboardApp.strings.latest_images.loading_latest_images),(0,s.createElement)(je,{max:20,value:i})),!Ze&&!e&&(0,s.createElement)(s.Fragment,null,(0,s.createElement)("div",{className:"flex justify-between mt-5 gap-5"},[...Array(4)].map(((e,t)=>(0,s.createElement)(Ue,{key:t})))),(0,s.createElement)("div",{className:"flex justify-between mt-5 gap-5"},[...Array(4)].map(((e,t)=>(0,s.createElement)(Ue,{key:`placeholder-2-${t}`}))))),e&&4>m?.length&&(0,s.createElement)("div",{className:"text-center py-12"},(0,s.createElement)("p",{dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.latest_images.no_images_found}})),e&&4<=m?.length&&(0,s.createElement)(s.Fragment,null,(0,s.createElement)("div",{className:"flex justify-between mt-5 gap-5"},[...Array(4)].map(((e,t)=>(0,s.createElement)(We,{key:t,src:m[t].url,oldSize:m[t].ex_size_raw,newSize:m[t].new_size_raw})))),8<=m?.length&&(0,s.createElement)("div",{className:"flex justify-between mt-5 gap-5"},[...Array(4)].map(((e,t)=>(t+=4,(0,s.createElement)(We,{key:t,src:m[t].url,oldSize:m[t].ex_size_raw,newSize:m[t].new_size_raw})))))))},Qe=e=>{const t=window.optimoleDashboardApp.submenu_links.find((e=>"#settings"===e.hash));t&&(document.querySelector(`a[href="${t.href}"]`).click(),setTimeout((()=>{const t=document.querySelectorAll(".optml-settings ul li");t[e]?.querySelector("button").click(),window.scrollTo(0,0)}),500))},Xe=[{icon:y,title:optimoleDashboardApp.strings.quick_actions.speed_test_title,description:optimoleDashboardApp.strings.quick_actions.speed_test_desc,link:optimoleDashboardApp.strings.quick_actions.speed_test_link,value:"speedTest"},{icon:w,title:optimoleDashboardApp.strings.quick_actions.clear_cache_images,description:optimoleDashboardApp.strings.quick_actions.clear_cache,value:Ae},{icon:A,title:optimoleDashboardApp.strings.quick_actions.offload_images,description:optimoleDashboardApp.strings.quick_actions.offload_images_desc,value:()=>Qe(1)},{icon:N,title:optimoleDashboardApp.strings.quick_actions.advance_settings,description:optimoleDashboardApp.strings.quick_actions.configure_settings,value:()=>Qe(2)}],Je=()=>(0,s.createElement)("div",{className:"flex gap-2 bg-warning text-danger border border-solid border-danger rounded relative px-6 py-5 mb-5"},(0,s.createElement)(u.Icon,{className:"fill-current",icon:Pe}),(0,s.createElement)("p",{className:"m-0",dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.notice_disabled_account}})),et=()=>(0,s.createElement)("div",{className:"flex gap-2 bg-success text-white rounded relative px-6 py-5 mb-5"},(0,s.createElement)(u.Icon,{icon:"cloud-saved"}),(0,s.createElement)("p",{className:"m-0",dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.notice_just_activated}})),tt=()=>{const{userData:e,userStatus:t}=(0,c.useSelect)((e=>{const{getUserData:t,getUserStatus:a}=e("optimole");return{userData:t(),userStatus:a()}})),a=(0,o.useMemo)((()=>{const t=[{icon:C,label:optimoleDashboardApp.strings.metrics.metricsTitle2,description:optimoleDashboardApp.strings.metrics.metricsSubtitle2,value:"saved_size",hasButton:!0,buttonText:optimoleDashboardApp.strings.metrics.adjust_compression},{icon:D,label:optimoleDashboardApp.strings.metrics.metricsTitle3,description:optimoleDashboardApp.strings.metrics.metricsSubtitle3,value:"compression_percentage",hasButton:!0,buttonText:optimoleDashboardApp.strings.metrics.adjust_compression},{icon:S,label:optimoleDashboardApp.strings.metrics.metricsTitle4,description:optimoleDashboardApp.strings.metrics.metricsSubtitle4,value:"traffic",hasButton:!0,buttonText:optimoleDashboardApp.strings.metrics.view_analytics}];return e?.can_use_offloading&&t.push({icon:k,label:optimoleDashboardApp.strings.metrics.metricsTitle5,description:optimoleDashboardApp.strings.metrics.metricsSubtitle5,value:"offloaded_images",hasButton:!0,buttonText:optimoleDashboardApp.strings.metrics.manage_offloading}),t}),[e]),l=(e.visitors/e.visitors_limit*100).toFixed(0),n=(0,o.useMemo)((()=>e.renews_on_formatted),[e.renews_on]);return(0,s.createElement)("div",{className:"grid gap-5"},(0,s.createElement)("div",{className:"bg-white p-8 border-0 rounded-lg shadow-md"},0<optimoleDashboardApp.strings.notice_just_activated.length&&"active"===t&&(0,s.createElement)(et,null),"inactive"===t&&(0,s.createElement)(Je,null),(0,s.createElement)("div",{className:"pb-6 gap-6 flex-col sm:flex-row items-start"},(0,s.createElement)("div",{className:"flex flex-col md:flex-row gap-3 w-full justify-between"},(0,s.createElement)("div",{className:"text-gray-800 text-xl font-semibold"},optimoleDashboardApp.strings.dashboard_title),(0,s.createElement)("div",{className:"flex items-center gap-2"},(0,s.createElement)("div",{className:"text-gray-600 text-base flex items-center gap-1"},optimoleDashboardApp.strings.quota,(0,s.createElement)("span",{className:"text-gray-800 font-bold"},e.visitors_pretty," / ",e.visitors_limit_pretty),(0,s.createElement)(u.Tooltip,{text:(0,s.createElement)("div",{className:"p-2.5 max-w-[320px]"},(0,s.createElement)("div",{className:"font-bold mb-2"},optimoleDashboardApp.strings.tooltip_visits_title),(0,s.createElement)("div",null,(0,Fe.sprintf)(optimoleDashboardApp.strings.tooltip_visits_description,n))),placement:"bottom"},(0,s.createElement)("span",{className:"inline-flex items-center cursor-help ml-1"},(0,s.createElement)(u.Icon,{icon:Ve,size:18,className:"text-gray-400 hover:text-gray-600"})))),(0,s.createElement)("div",{className:"md:w-20 grow md:grow-0"},(0,s.createElement)(je,{value:e.visitors,max:e.visitors_limit})),(0,s.createElement)("span",null,l,"%"),(0,s.createElement)("span",{className:"text-gray-500 text-sm ml-2"},(0,Fe.sprintf)(optimoleDashboardApp.strings.renew_date,n))))),(0,s.createElement)("div",{className:m()("flex p-6 bg-light-blue border border-blue-300 rounded-md","gap-8 flex-col sm:flex-row items-start sm:items-center")},(0,s.createElement)("div",{className:"grid gap-2"},(0,s.createElement)("div",{className:"text-gray-700 text-lg font-semibold"},optimoleDashboardApp.strings.banner_title),(0,s.createElement)("div",{className:"text-gray-600 text-sm"},optimoleDashboardApp.strings.banner_description))),(0,s.createElement)("div",{className:"flex pt-5 gap-5 flex-col md:flex-row"},a.map((t=>{const a=e[t.value],{formattedValue:o,unit:l}=((e,t)=>{let a=0,s="";switch(void 0===t&&(t="saved_size"===e?Math.floor(25e5*Math.random())+5e5:"traffic"===e?Math.floor(2500*Math.random())+500:"offloaded_images"===e?Math.floor(500*Math.random())+50:Math.floor(40*Math.random())+10),e){case"compression_percentage":a=parseFloat(t).toFixed(2),s="%";break;case"saved_size":const e=t/1e3;1e3>e?(a=e.toFixed(2),s="MB"):1e6>e?(a=(e/1e3).toFixed(2),s="GB"):(a=(e/1e6).toFixed(2),s="TB");break;case"traffic":1e3>t?(a=parseFloat(t).toFixed(2),s="MB"):1e6>t?(a=(t/1e3).toFixed(2),s="GB"):(a=(t/1e6).toFixed(2),s="TB");break;case"offloaded_images":a=parseInt(t),s=1===a?optimoleDashboardApp.strings.metrics.image:optimoleDashboardApp.strings.metrics.images;break;default:a=parseFloat(t).toFixed(2),s=""}return{formattedValue:a,unit:s}})(t.value,a),n=(e=>{switch(e){case"saved_size":case"compression_percentage":return{onClick:()=>Qe(2)};case"traffic":return{href:window.optimoleDashboardApp.optimoleDashMetrics,target:"_blank"};case"offloaded_images":return{onClick:()=>Qe(1)}}})(t.value),r="free"!==e.plan&&t.hasButton;return(0,s.createElement)("div",{key:t.value,className:m()("p-3 basis-1/3 flex-col items-start border rounded-md border-solid bg-white border-gray-300")},(0,s.createElement)("div",{className:"flex w-full flex-col"},(0,s.createElement)("div",{className:"flex flex-row items-center gap-2 mb-2"},(0,s.createElement)(u.Icon,{icon:t.icon,size:16,className:"text-info"}),(0,s.createElement)("div",{className:"text-sm text-gray-500"},t.label)),(0,s.createElement)("div",{className:"flex items-end gap-1"},(0,s.createElement)("span",{className:"text-2xl text-black font-bold"},o),(0,s.createElement)("span",{className:"text-sm text-gray-500"},l)),(0,s.createElement)("div",{className:"font-normal text-gray-600 "+(r?"mb-3":"")},t.description),r&&(0,s.createElement)(u.Button,{variant:"secondary",size:"small",className:"mt-auto font-semibold rounded-md w-fit px-3 flex items-center gap-1",...n},t.buttonText,"traffic"===t.value&&(0,s.createElement)(u.Icon,{icon:qe,size:16}))))})))),(0,s.createElement)("div",{className:"bg-white p-8 border-0 rounded-lg shadow-md"},(0,s.createElement)("div",{className:"text-gray-800 text-xl font-semibold mb-5"},optimoleDashboardApp.strings.quick_action_title),(0,s.createElement)("div",{className:"grid md:grid-cols-2 gap-5"},Xe.map(((e,t)=>{const a="speedTest"===e.value?"a":"button",o="speedTest"===e.value?{href:e.link,target:"_blank"}:{onClick:()=>{e.value()}};return(0,s.createElement)(a,{key:t,className:"flex items-center gap-3 p-4 bg-gray-50 rounded-lg hover:bg-light-blue hover:bg-info hover:border-info transition-background duration-300 group shadow-none border-gray-200 border border-solid cursor-pointer",...o},(0,s.createElement)(u.Icon,{icon:e.icon,className:"text-info"}),(0,s.createElement)("div",{className:"flex flex-col items-start gap-1"},(0,s.createElement)("span",{className:"font-medium text-base text-gray-800"},e.title),(0,s.createElement)("span",{className:"text-info text-sm font-medium hover:text-info"},e.description)))})))),(0,s.createElement)("div",{className:"bg-white p-8 border-0 rounded-lg shadow-md hidden lg:block"},"yes"!==optimoleDashboardApp.remove_latest_images&&(0,s.createElement)(Ye,null)))},at=({conflict:e})=>{const[t,a]=(0,o.useState)(!1),l={border:"1px solid #c3c4c7",borderLeftWidth:"4px",borderLeftColor:"high"===e.severity?"#E77777":"medium"===e.severity?"#577BF9":"#5F9D61",margin:"5px 0 15px",padding:"12px",paddingRight:"38px",position:"relative"};return(0,s.createElement)("div",{style:l},(0,s.createElement)("p",{style:{margin:"0",padding:"2px",lineHeight:"1.5",fontSize:"15px"},dangerouslySetInnerHTML:{__html:e.message}}),(0,s.createElement)(u.Button,{icon:t?g:"no-alt",label:optimoleDashboardApp.strings.conflicts.conflict_close,disabled:t,className:m()("text-black hover:text-black",{"animate-spin":t}),onClick:()=>{a(!0),((e,t=(()=>{}))=>{H(!0),I()({path:optimoleDashboardApp.routes.dismiss_conflict,method:"POST",data:{conflictID:e}}).then((e=>{H(!1),"success"===e.code&&W(e.data),t&&t(e)}))})(e.id,(()=>{a(!1)}))},style:{position:"absolute",top:"8px",right:"8px"}}))},st=()=>{const{conflicts:e}=(0,c.useSelect)((e=>{const{getConflicts:t}=e("optimole");return{conflicts:t().conflicts||[]}}));return(0,s.createElement)("div",{className:"bg-white p-8 border-0 rounded-lg shadow-md"},Boolean(e.length)&&(0,s.createElement)(s.Fragment,null,(0,s.createElement)("p",null,optimoleDashboardApp.strings.conflicts.title),e.map((e=>(0,s.createElement)(at,{key:e.id,conflict:e})))),!Boolean(e.length)&&(0,s.createElement)("div",{className:"text-center py-12"},(0,s.createElement)("p",{dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.conflicts.no_conflicts_found}})))},ot=(0,s.createElement)(p.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,s.createElement)(p.Path,{d:"M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z"})),lt=(0,s.createElement)(p.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,s.createElement)(p.Path,{d:"M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"})),{strings:nt}=optimoleDashboardApp,rt=[{label:nt.general_settings_menu_item,value:"general"},{label:nt.image_storage,value:"offload_media"},{label:nt.advanced_settings_menu_item,value:"compression",children:[{label:nt.settings_watermark_menu_item,value:"watermark"},{label:nt.settings_compression_menu_item,value:"compression"},{label:nt.settings_resize_menu_item,value:"resize"},{label:nt.lazyload_settings_menu_item,value:"lazyload"},{label:nt.settings_exclusions_menu_item,value:"exclusions"}]},{label:nt.cloud_library,value:"cloud_library"}],it=({children:e,tab:t,setTab:a})=>(0,s.createElement)("ul",{className:"flex flex-col gap-1 m-0 mt-1"},e.map((e=>{const{value:o,label:l}=e,n=m()({"bg-light-blue hover:text-purple-gray":t===o,"bg-transparent hover:text-info":t!==o},"w-full text-left border-0 font-normal text-base text-purple-gray cursor-pointer rounded px-4 py-2 m-0 hover:text-info");return(0,s.createElement)("li",{key:o},(0,s.createElement)("button",{className:n,onClick:()=>a(o)},l))}))),ct=({tab:e,settings:t,setTab:a})=>(0,s.createElement)("div",{className:"basis-1/5"},(0,s.createElement)("ul",{className:"grid m-0 gap-1"},rt.map((o=>{const l="enabled"!==t?.image_replacer&&"general"!==o.value,n=e===o.value||o.children&&o.children.some((t=>t.value===e)),r=m()({"!text-info":n},{"opacity-50 pointer-events-none":l},"w-full bg-transparent border-0 flex items-center appearance-none not-italic font-semibold text-base text-purple-gray cursor-pointer hover:text-info py-2");return(0,s.createElement)("li",{key:o.value,className:"m-0"},(0,s.createElement)("button",{disabled:l,className:r,onClick:()=>a(o.value)},o.label,o.children&&(0,s.createElement)(u.Icon,{icon:n?ot:lt,className:"inline-block ml-2 fill-current"})),o.children&&n&&(0,s.createElement)(it,{children:o.children,tab:e,settings:t,setTab:a}))})))),dt=(0,o.forwardRef)((function({icon:e,size:t=24,...a},s){return(0,o.cloneElement)(e,{width:t,height:t,...a,ref:s})})),mt=(0,s.createElement)(p.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(p.Path,{d:"M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"})),pt=(0,s.createElement)(p.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,s.createElement)(p.Path,{d:"M12 21C16.9706 21 21 16.9706 21 12C21 7.02944 16.9706 3 12 3C7.02944 3 3 7.02944 3 12C3 16.9706 7.02944 21 12 21ZM15.5303 8.46967C15.8232 8.76256 15.8232 9.23744 15.5303 9.53033L13.0607 12L15.5303 14.4697C15.8232 14.7626 15.8232 15.2374 15.5303 15.5303C15.2374 15.8232 14.7626 15.8232 14.4697 15.5303L12 13.0607L9.53033 15.5303C9.23744 15.8232 8.76256 15.8232 8.46967 15.5303C8.17678 15.2374 8.17678 14.7626 8.46967 14.4697L10.9393 12L8.46967 9.53033C8.17678 9.23744 8.17678 8.76256 8.46967 8.46967C8.76256 8.17678 9.23744 8.17678 9.53033 8.46967L12 10.9393L14.4697 8.46967C14.7626 8.17678 15.2374 8.17678 15.5303 8.46967Z"})),gt=(0,s.createElement)(p.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(p.Path,{d:"M12 3.2c-4.8 0-8.8 3.9-8.8 8.8 0 4.8 3.9 8.8 8.8 8.8 4.8 0 8.8-3.9 8.8-8.8 0-4.8-4-8.8-8.8-8.8zm0 16c-4 0-7.2-3.3-7.2-7.2C4.8 8 8 4.8 12 4.8s7.2 3.3 7.2 7.2c0 4-3.2 7.2-7.2 7.2zM11 17h2v-6h-2v6zm0-8h2V7h-2v2z"})),ut=(0,s.createElement)(p.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(p.Path,{d:"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"}));function bt({text:e,title:t,disableIcon:a=!1,type:o="info",className:l="",smallTitle:n=!1,children:r,onDismiss:i}){const c=m()({"bg-yellow-50 text-yellow-700":"warning"===o,"bg-green-50 text-green-700":"success"===o,"bg-red-50 text-red-700":"error"===o,"bg-blue-50 text-blue-700":"info"===o,"bg-info text-white":"primary"===o},`rounded-md my-5 text-sm p-4 om-notice om-notice-${o} relative`),d=m()({"fill-yellow-500":"warning"===o,"fill-green-500":"success"===o,"fill-red-500":"error"===o,"fill-blue-500":"info"===o,"fill-white":"primary"===o,"h-6 w-6":"primary"!==o,"h-12 w-12":"primary"===o}),p=m()({"ml-3 mt-0.5":!a&&!t,"mt-2 mx-1.5":t}),g=m()({"text-yellow-800":"warning"===o,"text-green-800":"success"===o,"text-red-800":"error"===o,"text-blue-800":"info"===o,"font-bold text-base":"primary"!==o,"text-white text-sm":"primary"===o,"text-s":n},"m-0"),u={warning:Pe,success:mt,error:pt,info:gt,primary:f};return(0,s.createElement)("div",{className:c},i&&(0,s.createElement)("button",{className:"flex items-center justify-center absolute bg-transparent text-current right-1 top-1 border-0 rounded-full p-0 cursor-pointer hover:bg-white transition-all hover:text-info",onClick:i},(0,s.createElement)(dt,{className:"fill-current",icon:ut})),(0,s.createElement)("div",{className:t?"grid":"flex"},(0,s.createElement)("div",{className:m()("flex-shrink-0 flex gap-2",{"items-center":t})},!a&&(0,s.createElement)(dt,{icon:u[o]||null,className:d}),t&&(0,s.createElement)("div",{className:g,dangerouslySetInnerHTML:{__html:t}})),r||e&&(0,s.createElement)("div",{className:p},e&&(0,s.createElement)("p",{className:"m-0",dangerouslySetInnerHTML:{__html:e}}),r)))}const ht=({settings:e,setSettings:t,setCanSave:a})=>{const{isLoading:l,isUserActive:n}=(0,c.useSelect)((e=>{const{isLoading:t,getUserStatus:a}=e("optimole");return{isLoading:t(),isUserActive:"active"===a()}})),r="disabled"!==e.image_replacer,i=(e.lazyload,"disabled"!==e.cdn),d="disabled"!==e.banner_frontend,p="disabled"!==e.show_badge_icon,g=e.badge_position||"right",[b,h]=(0,o.useState)(d),_=(s,o)=>{a(!0);const l={...e};l[s]="badge_position"===s?o:o?"enabled":"disabled",t(l)};return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(u.ToggleControl,{label:optimoleDashboardApp.strings.options_strings.enable_image_replace,help:()=>(0,s.createElement)("span",{dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.options_strings.replacer_desc}}),checked:r,disabled:l,className:m()({"is-disabled":l}),onChange:e=>_("image_replacer",e)}),(0,s.createElement)("hr",{className:"my-8 border-grayish-blue"}),n&&(0,s.createElement)(s.Fragment,null,(0,s.createElement)(u.ToggleControl,{label:optimoleDashboardApp.strings.options_strings.enable_badge_title,help:()=>(0,s.createElement)("span",{dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.options_strings.enable_badge_description}}),checked:d,disabled:l,className:m()({"is-disabled":l}),onChange:e=>{_("banner_frontend",e),h(e)}}),d&&(0,s.createElement)("div",{className:"mt-4 badge-settings"},(0,s.createElement)(u.Button,{className:m()("border border-none bg-transparent text-blue-500 px-2 py-1 rounded-sm flex items-center cursor-pointer",{"is-disabled":l}),onClick:()=>h(!b)},(0,s.createElement)("span",null,optimoleDashboardApp.strings.options_strings.enable_badge_settings),(0,s.createElement)(dt,{icon:b?ot:lt,className:"h-5 w-5",style:{fill:"#3b82f6"}})),b&&(0,s.createElement)("div",{className:"mt-4 space-y-4 pl-4 pt-2"},(0,s.createElement)("div",{className:"flex items-center justify-between mb-4"},(0,s.createElement)("label",{className:"text-gray-600 font-medium"},optimoleDashboardApp.strings.options_strings.enable_badge_show_icon),(0,s.createElement)(u.ToggleControl,{label:"",checked:p,disabled:l,className:m()("flex items-center justify-between mb-4",{"is-disabled":l}),onChange:e=>_("show_badge_icon",e)})),(0,s.createElement)("div",{className:"flex items-center justify-between"},(0,s.createElement)("label",{className:"text-gray-600 font-medium"},optimoleDashboardApp.strings.options_strings.enable_badge_position),(0,s.createElement)("div",{className:"flex space-x-2"},(0,s.createElement)(u.Button,{className:m()("px-4 py-2 border rounded border-[1px]","left"===g?"border-blue-500 text-blue-500 bg-blue-100":"border-gray-300 text-gray-500 bg-gray-100",{"is-disabled":l}),onClick:()=>_("badge_position","left")},optimoleDashboardApp.strings.options_strings.badge_position_text_1),(0,s.createElement)(u.Button,{className:m()("px-4 py-2 border rounded","right"===g?"border-blue-500 text-blue-500 bg-blue-100":"border-gray-300 text-gray-500 bg-gray-100",{"is-disabled":l}),onClick:()=>_("badge_position","right")},optimoleDashboardApp.strings.options_strings.badge_position_text_2))))),(0,s.createElement)("hr",{className:"my-8 border-grayish-blue"})),(0,s.createElement)(u.BaseControl,{label:optimoleDashboardApp.strings.options_strings.cache_title,className:m()({"is-disabled":l||!r})},(0,s.createElement)("p",{className:"components-base-control__help m-0",dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.options_strings.cache_desc}}),(0,s.createElement)("div",{className:"flex my-4 gap-3"},(0,s.createElement)(u.Button,{variant:"default",isBusy:l,disabled:l||!r,className:"optml__button flex justify-center rounded font-bold min-h-40",onClick:()=>Ae()},optimoleDashboardApp.strings.options_strings.clear_cache_images),i&&(0,s.createElement)(u.Button,{variant:"default",isBusy:l,disabled:l||!r,className:"optml__button flex justify-center rounded font-bold min-h-40",onClick:()=>Ae("assets")},optimoleDashboardApp.strings.options_strings.clear_cache_assets))),(0,s.createElement)(bt,{type:"warning",text:optimoleDashboardApp.strings.options_strings.clear_cache_notice,disableIcon:!0}))};var _t=a(864),ft=a.n(_t);const Et=({settings:e,setSettings:t,setCanSave:a,showSample:l,isSampleLoading:n,setIsSampleLoading:r})=>{const{sampleImages:i,isLoading:d}=(0,c.useSelect)((e=>{const{getSampleRate:t,isLoading:a}=e("optimole");return{sampleImages:t(),isLoading:a()}})),p="disabled"!==e.network_optimization,b="disabled"!==e.cdn,h="disabled"!==e.strip_metadata,_="disabled"!==e.autoquality,f="disabled"!==e.best_format,E=e.compression_mode,x="disabled"!==e.retina_images,v=(s,o)=>{a(!0);const l={...e};l[s]=o?"enabled":"disabled",t(l)},y=()=>{r(!0),((e,t=(()=>{}))=>{I()({path:(0,M.addQueryArgs)(optimoleDashboardApp.routes.get_sample_rate,{quality:e.quality,force:e?.force||"no"}),method:"POST"}).then((e=>{"success"===e.code&&Q(e.data),t&&t(e)}))})({quality:e.quality,force:"yes"},(()=>r(!1)))},w=()=>i.optimized_size>i.original_size?Math.floor(60*Math.random())+10:(100*parseFloat(i.optimized_size/i.original_size)).toFixed(0);let A={};return(0,o.useEffect)((()=>{l&&y()}),[l]),(0,s.createElement)(s.Fragment,null,(0,s.createElement)(u.__experimentalToggleGroupControl,{className:" w-4/6","aria-label":optimoleDashboardApp.strings.options_strings.compression_mode,onChange:s=>(s=>{"custom"===E&&"custom"!==s&&(A={best_format:"enabled"===e.best_format,retina_images:"enabled"===e.retina_images,network_optimization:"enabled"===e.network_optimization,avif:"enabled"===e.avif,strip_metadata:"enabled"===e.strip_metadata,autoquality:"enabled"===e.autoquality}),a(!0);const o={...e};var l,n,r,i,c;"speed_optimized"===s&&(o.best_format="enabled",o.retina_images="disabled",o.network_optimization="enabled",o.avif="enabled",o.autoquality="enabled",o.strip_metadata="enabled"),"quality_optimized"===s&&(o.best_format="enabled",o.retina_images="enabled",o.network_optimization="disabled",o.avif="enabled",o.autoquality="enabled",o.strip_metadata="enabled"),"custom"===s&&(o.best_format=(null!==(l=A.best_format)&&void 0!==l?l:f)?"enabled":"disabled",o.retina_images=(null!==(n=A.retina_images)&&void 0!==n?n:x)?"enabled":"disabled",o.network_optimization=(null!==(r=A.network_optimization)&&void 0!==r?r:p)?"enabled":"disabled",o.autoquality=(null!==(i=A.autoquality)&&void 0!==i?i:_)?"enabled":"disabled",o.strip_metadata=(null!==(c=A.strip_metadata)&&void 0!==c?c:h)?"enabled":"disabled"),o.compression_mode=s,t(o)})(s),value:E,label:(0,s.createElement)("div",{className:"mb-4"},(0,s.createElement)("strong",null,optimoleDashboardApp.strings.options_strings.compression_mode))},(0,s.createElement)(u.__experimentalToggleGroupControlOption,{className:"bg-blue-500",label:optimoleDashboardApp.strings.options_strings.compression_mode_speed_optimized,value:"speed_optimized"}),(0,s.createElement)(u.__experimentalToggleGroupControlOption,{label:optimoleDashboardApp.strings.options_strings.compression_mode_quality_optimized,value:"quality_optimized"}),(0,s.createElement)(u.__experimentalToggleGroupControlOption,{label:optimoleDashboardApp.strings.options_strings.compression_mode_custom,value:"custom"})),"speed_optimized"===E&&(0,s.createElement)("p",{className:"text-sm text-gray-600 mb-20"},optimoleDashboardApp.strings.options_strings.compression_mode_speed_optimized_desc),"quality_optimized"===E&&(0,s.createElement)("p",{className:"text-sm text-gray-600 mb-20"},optimoleDashboardApp.strings.options_strings.compression_mode_quality_optimized_desc),"custom"===E&&(0,s.createElement)(s.Fragment,null,(0,s.createElement)("p",{className:"text-sm text-gray-600 mb-10"},optimoleDashboardApp.strings.options_strings.compression_mode_custom_desc)),"custom"===E&&(0,s.createElement)(s.Fragment,null,(0,s.createElement)("hr",{className:"my-8 border-grayish-blue"}),(0,s.createElement)(u.ToggleControl,{label:optimoleDashboardApp.strings.options_strings.best_format_title,help:()=>(0,s.createElement)("span",{dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.options_strings.best_format_desc}}),checked:f,disabled:d,className:m()({"is-disabled":d}),onChange:e=>v("best_format",e)}),(0,s.createElement)("hr",{className:"my-8 border-grayish-blue"}),(0,s.createElement)(u.ToggleControl,{label:optimoleDashboardApp.strings.options_strings.enable_retina_title,help:()=>(0,s.createElement)("span",{dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.options_strings.enable_retina_desc}}),checked:x,disabled:d,className:m()({"is-disabled":d}),onChange:e=>v("retina_images",e)}),(0,s.createElement)("hr",{className:"my-8 border-grayish-blue"}),(0,s.createElement)(u.ToggleControl,{label:optimoleDashboardApp.strings.options_strings.enable_network_opt_title,help:()=>(0,s.createElement)("span",{dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.options_strings.enable_network_opt_desc}}),checked:p,disabled:d,className:m()({"is-disabled":d}),onChange:e=>v("network_optimization",e)}),(0,s.createElement)("hr",{className:"my-8 border-grayish-blue"}),(0,s.createElement)(u.ToggleControl,{label:optimoleDashboardApp.strings.options_strings.toggle_cdn,help:()=>(0,s.createElement)("span",{dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.options_strings.cdn_desc}}),checked:b,disabled:d,className:m()({"is-disabled":d}),onChange:e=>v("cdn",e)}),(0,s.createElement)("hr",{className:"my-8 border-grayish-blue"}),(0,s.createElement)(u.ToggleControl,{label:optimoleDashboardApp.strings.options_strings.strip_meta_title,help:()=>(0,s.createElement)("span",{dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.options_strings.strip_meta_desc}}),checked:h,disabled:d,className:m()({"is-disabled":d}),onChange:e=>v("strip_metadata",e)}),(0,s.createElement)("hr",{className:"my-8 border-grayish-blue"}),(0,s.createElement)(u.BaseControl,{help:!_&&optimoleDashboardApp.strings.options_strings.quality_desc},(0,s.createElement)(u.ToggleControl,{label:optimoleDashboardApp.strings.options_strings.quality_title,help:()=>(0,s.createElement)("span",{dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.options_strings.ml_quality_desc}}),checked:_,disabled:d,className:m()({"is-disabled":d}),onChange:e=>v("autoquality",e)})),!_&&(0,s.createElement)(s.Fragment,null,(0,s.createElement)(u.RangeControl,{value:(N=e.quality,"number"==typeof N?N:"auto"===N||"mauto"===N?80:"high_c"===N?90:"medium_c"===N?75:"low_c"===N?55:80),min:50,max:100,step:1,withInputField:!1,marks:[{value:55,label:optimoleDashboardApp.strings.options_strings.low_q_title},{value:75,label:optimoleDashboardApp.strings.options_strings.medium_q_title},{value:90,label:optimoleDashboardApp.strings.options_strings.high_q_title}],onChange:s=>{a(!0);const o={...e};o.quality=s,t(o)}}),l&&(0,s.createElement)("div",{className:"flex justify-center w-full text-center"},n?(0,s.createElement)("div",{className:"flex items-center gap-5"},(0,s.createElement)("p",{className:"text-base"},optimoleDashboardApp.strings.options_strings.sample_image_loading),(0,s.createElement)(u.Icon,{icon:g,className:"animate-spin"})):(0,s.createElement)(s.Fragment,null,i.id&&0<i.original_size&&(0,s.createElement)("div",null,0<w()?(0,s.createElement)("p",{className:"text-base"},optimoleDashboardApp.strings.latest_images.percentage_smaller.replace("{ratio}",100-w())):(0,s.createElement)("p",{className:"text-base"},optimoleDashboardApp.strings.latest_images.same_size),(0,s.createElement)(je,{max:100,value:100-w()}),(0,s.createElement)("hr",{className:"my-4 border-grayish-blue"}),(0,s.createElement)(ft(),{leftImageLabel:optimoleDashboardApp.strings.options_strings.image_1_label,rightImageLabel:optimoleDashboardApp.strings.options_strings.image_2_label,leftImage:i.original,rightImage:i.optimized}),(0,s.createElement)(u.Button,{variant:"default",icon:g,className:"mt-2",onClick:y}),(0,s.createElement)("p",{className:"text-base"},optimoleDashboardApp.strings.options_strings.quality_slider_desc)),!(i.id&&0<i.original_size)&&0>i.id&&(0,s.createElement)("div",{className:"flex items-center gap-5 text-center"},(0,s.createElement)("p",{className:"text-base"},optimoleDashboardApp.strings.options_strings.no_images_found)))))));var N},xt=({settings:e,setSettings:t,setCanSave:a})=>{const{isLoading:l}=(0,c.useSelect)((e=>{const{isLoading:t}=e("optimole");return{isLoading:t()}})),[n,r]=(0,o.useState)(""),[i,d]=(0,o.useState)(""),p="disabled"!==e.resize_smart,g="disabled"!==e.limit_dimensions,b=(s,o)=>{a(!0);const l={...e};l[s]=o?"enabled":"disabled",t(l)},h=(s,o)=>{a(!0);const l={...e};l[s]=o,t(l)},_=Object.keys(e.defined_image_sizes).filter((t=>"object"==typeof e.defined_image_sizes[t]));return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(u.ToggleControl,{label:optimoleDashboardApp.strings.options_strings.enable_resize_smart_title,help:()=>(0,s.createElement)("span",{dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.options_strings.enable_resize_smart_desc}}),checked:p,disabled:l,className:m()({"is-disabled":l}),onChange:e=>b("resize_smart",e)}),(0,s.createElement)("hr",{className:"my-8 border-grayish-blue"}),(0,s.createElement)(u.ToggleControl,{label:optimoleDashboardApp.strings.options_strings.enable_limit_dimensions_title,help:()=>(0,s.createElement)("span",{dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.options_strings.enable_limit_dimensions_desc}}),checked:g,disabled:l,className:m()({"is-disabled":l}),onChange:e=>b("limit_dimensions",e)}),g&&(0,s.createElement)(u.BaseControl,null,(0,s.createElement)("div",{className:"flex gap-8"},(0,s.createElement)(u.__experimentalNumberControl,{label:optimoleDashboardApp.strings.options_strings.width_field,labelPosition:"side",value:e.limit_width,type:"number",min:100,max:1e4,className:"basis-1/2 sm:basis-1/4",onChange:e=>h("limit_width",e)}),(0,s.createElement)(u.__experimentalNumberControl,{label:optimoleDashboardApp.strings.options_strings.height_field,labelPosition:"side",value:e.limit_height,type:"number",min:100,max:1e4,className:"basis-1/2 sm:basis-1/4",onChange:e=>h("limit_height",e)}))),(0,s.createElement)("hr",{className:"my-8 border-grayish-blue"}),(0,s.createElement)(u.BaseControl,{label:optimoleDashboardApp.strings.options_strings.add_image_size_desc},(0,s.createElement)("p",{className:"components-base-control__help mt-0",dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.options_strings.image_size_notice}}),(0,s.createElement)("div",{className:"flex flex-col sm:flex-row p-6 bg-light-blue border border-blue-300 rounded-md items-stretch sm:items-center gap-8"},(0,s.createElement)(u.TextControl,{label:optimoleDashboardApp.strings.options_strings.width_field,placeholder:optimoleDashboardApp.strings.options_strings.width_field,hideLabelFromVision:!0,type:"number",min:1,value:n,onChange:r,className:"optml__input sm:basis-2/5"}),(0,s.createElement)(u.TextControl,{label:optimoleDashboardApp.strings.options_strings.height_field,placeholder:optimoleDashboardApp.strings.options_strings.height_field,value:i,onChange:d,hideLabelFromVision:!0,type:"number",min:1,className:"optml__input sm:basis-2/5"}),(0,s.createElement)(u.Button,{variant:"primary",isBusy:l,disabled:l,className:"optml__button flex w-full justify-center rounded font-bold min-h-40 basis-1/5",onClick:()=>{if(!n||!i||isNaN(n)||isNaN(i))return;const s="optimole_"+n+"_"+i+"_crop",o={...e.defined_image_sizes,[s]:{width:n,height:i}};a(!0);const l={...e};l.defined_image_sizes=o,t(l),r(""),d("")}},optimoleDashboardApp.strings.options_strings.add_image_size_button))),0<_.length&&(0,s.createElement)(u.BaseControl,{label:optimoleDashboardApp.strings.options_strings.image_sizes_title,className:"pt-4"},_.map((o=>(0,s.createElement)("div",{key:o,className:"flex p-3 my-3 bg-light-blue border border-blue-300 rounded-md items-center justify-between gap-8"},(0,s.createElement)("div",{className:"flex flex-wrap items-center gap-2"},(0,s.createElement)("div",null,(0,s.createElement)("p",{className:"m-0 inline-block",dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.options_strings.name}})," ",o),(0,s.createElement)("p",{className:"m-0"},(0,s.createElement)("b",null,optimoleDashboardApp.strings.options_strings.width_field),": ",e.defined_image_sizes[o].width),(0,s.createElement)("p",{className:"m-0"},(0,s.createElement)("b",null,optimoleDashboardApp.strings.options_strings.height_field),": ",e.defined_image_sizes[o].height)),(0,s.createElement)(u.Button,{variant:"default",icon:"trash",disabled:l,onClick:()=>(s=>{const o={...e.defined_image_sizes,[s]:"remove"};a(!0);const l={...e};l.defined_image_sizes=o,t(l)})(o)}))))))};function vt({options:e,value:t,onChange:a,label:o,disabled:l=!1,className:n}){return m()({"opacity-50":l},"transition-all my-6 gap-6 grid opacity-100"),(0,s.createElement)("fieldset",{className:`my-6 gap-6 grid ${n}`,onChange:e=>{a(e.target.value)}},o&&(0,s.createElement)("legend",{className:"uppercase font-semibold text-s text-light-black mb-6 inline-block"},o),e.map(((e,a)=>{const{title:o,value:n,description:r}=e,i=t===n,c=m()({"outline-info":i,"outline-transparent":!i},"flex gap-6 items-start bg-gray-50 rounded-md p-4 outline -outline-offset-3 outline-3 transition-all");return(0,s.createElement)("label",{htmlFor:n,key:n,className:c},(0,s.createElement)(yt,{isActive:i}),(0,s.createElement)("div",{className:"grid space-y-2"},o&&(0,s.createElement)("div",{className:"text-base font-medium text-gray-700"},o),r&&(0,s.createElement)("div",{className:"text-sm text-gray-500"},r)),(0,s.createElement)("input",{type:"radio",name:"label",value:n,checked:i,onChange:()=>{},id:n,className:"!opacity-0 !w-0 !h-0 !overflow-hidden !absolute !pointer-events-none",disabled:l,checked:i}))})))}const yt=({isActive:e})=>{const t=m()({"bg-white outline-info":e,"bg-gray-200 outline-transparent":!e},"w-[24px] h-[24px] rounded-full flex items-center justify-center flex-shrink-0 outline outline-3 -outline-offset-3 transition-all"),a=m()({"bg-info":e},"w-[12px] h-[12px] rounded-full background-info transition-all");return(0,s.createElement)("div",{className:t},e&&(0,s.createElement)("div",{className:a}))},wt=({children:e,className:t=""})=>(0,s.createElement)("div",{className:m()("my-4 p-4 rounded border-solid border-gray-200 bg-slate-100",t)},e),At=({children:e,className:t=""})=>(0,s.createElement)("h3",{className:m()("text-sm text-slate-500 m-0 font-semibold mb-4 uppercase",t)},e),Nt=({children:e,className:t=""})=>(0,s.createElement)("div",{className:m()("text-sm text-gray-600 px-4 py-2 bg-white flex flex-wrap items-center rounded",t)},e),St=(0,s.createElement)(p.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(p.Path,{d:"M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"})),Lt=window.wp.compose;function Ct({icon:e,labels:t={},onRequestClose:a=(()=>{}),onConfirm:o=(()=>{}),variant:l="default",onSecondaryAction:n=(()=>{}),afterContentChildren:r=null}){const i=(0,Lt.useViewportMatch)("small","<"),c=m()({"bg-stale-yellow":"warning"===l,"bg-light-blue":"default"===l},"p-2 rounded-full flex items-center justify-center"),d=m()({"bg-mango-yellow":"warning"===l},"optml__button flex justify-center px-5 py-3 rounded font-bold min-h-40 basis-1/5");return(0,s.createElement)(u.Modal,{__experimentalHideHeader:!0,className:"max-w-xl antialiased",onRequestClose:a,isFullScreen:i},(0,s.createElement)(u.Button,{icon:St,onClick:a,label:optimoleDashboardApp.strings.csat.close,className:"fixed right-3 top-3 cursor-pointer"}),(0,s.createElement)("div",{className:"flex flex-col items-center"},(0,s.createElement)("span",{className:c},(0,s.createElement)(u.Icon,{icon:e,size:24})),(0,s.createElement)("h2",{className:"mb-0",dangerouslySetInnerHTML:{__html:t.title}}),(0,s.createElement)("p",{className:"text-center mx-0 my-4 text-gray-700",dangerouslySetInnerHTML:{__html:t.description}}),r,(0,s.createElement)("div",{className:"flex gap-4"},(0,s.createElement)(u.Button,{variant:"primary",className:d,onClick:o},t.action),t.secondaryAction&&(0,s.createElement)(u.Button,{variant:"default",className:"optml__button flex justify-center rounded font-bold min-h-40",onClick:n},t.secondaryAction))))}const kt=({text:e,badgeLabel:t})=>(0,s.createElement)(s.Fragment,null,e,(0,s.createElement)("span",{className:"ml-4 text-xs font-bold p-1 rounded bg-yellow-400 text-yellow-800 uppercase"},t)),Dt=({text:e,showAsDisabled:t})=>(0,s.createElement)("span",{className:m()("inline-block text-xs px-2 py-1 rounded mr-2 mt-2 font-medium",{"bg-gray-200 text-gray-800 line-through":t,"bg-blue-200 text-blue-800":!t})},e),Tt=({text:e,tags:t})=>(0,s.createElement)(s.Fragment,null,e,(0,s.createElement)("div",{className:"mt-2"},t.map((({text:e,disabled:t})=>(0,s.createElement)(Dt,{key:e,text:e,showAsDisabled:t}))))),{options_strings:It}=optimoleDashboardApp.strings,Mt="image-scaling",Ot="lazy-load",zt="javascript-loading",Bt=({settings:e,setSettings:t,setCanSave:a})=>{const{isLoading:l}=(0,c.useSelect)((e=>{const{isLoading:t}=e("optimole");return{isLoading:t()}})),n=(0,o.useMemo)((()=>"disabled"!==e.lazyload_placeholder),[e]),r=(0,o.useMemo)((()=>"disabled"!==e.native_lazyload),[e]),i=(0,o.useMemo)((()=>"disabled"!==e.bg_replacer),[e]),d=(0,o.useMemo)((()=>"disabled"!==e.video_lazyload),[e]),p=(0,o.useMemo)((()=>"disabled"!==e.no_script),[e]),g=(0,o.useMemo)((()=>e.placeholder_color),[e.placeholder_color]),b=(0,o.useMemo)((()=>"disabled"===e.scale),[e.scale]),h=(0,o.useMemo)((()=>"disabled"!==e.lazyload),[e.lazyload]),_=(0,o.useMemo)((()=>e.lazyload_type?.includes("viewport")),[e?.lazyload_type]),f=(0,o.useMemo)((()=>e.lazyload_type?.includes("fixed")),[e?.lazyload_type]),[E,x]=(0,o.useState)(!1),[v,y]=(0,o.useState)(!1),w=(0,o.useMemo)((()=>{const e=new URL(window.optimoleDashboardApp.report_issue_url),{contact_support:t}=window.optimoleDashboardApp.strings;let a=t.disable_lazy_load_scaling;return Mt===v?a=t.disable_image_scaling:zt===v&&(a=t.enable_native_lazy_load),e.searchParams.set("contact_subject",(0,Fe.sprintf)(t.title_prefix,a)),e}),[v]),A=(0,o.useCallback)(((s,o)=>{a(!0);const l={...e};l[s]=o?"enabled":"disabled",t(l)}),[a,e,t]),N=(0,o.useCallback)(((e,s)=>{a(!0),t((t=>({...t,[e]:s})))}),[a,t]),S=(0,o.useCallback)((e=>{N("placeholder_color",e)}),[N]),L=(0,o.useCallback)(((t,a)=>{var s,o;const l=new Set(null!==(s=(null!==(o=e?.lazyload_type)&&void 0!==o?o:"")?.split("|").filter((e=>"viewport"===e||"fixed"===e)))&&void 0!==s?s:[]);t?l.add(a):l.delete(a);const n=Array.from(l).toSorted().join("|")||"all";N("lazyload_type",n)}),[e?.lazyload_type,N]);return h?(0,s.createElement)(s.Fragment,null,(0,s.createElement)(u.ToggleControl,{label:It.toggle_lazyload,help:()=>(0,s.createElement)("span",{dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.options_strings.lazyload_desc}}),checked:h,disabled:l,className:m()({"is-disabled":l}),onChange:()=>y(Ot)}),v&&(0,s.createElement)(Ct,{icon:"warning",variant:"warning",labels:{title:It.performance_impact_alert_title,description:Mt===v?It.performance_impact_alert_scale_desc:It.performance_impact_alert_lazy_desc,action:It.performance_impact_alert_action_label,secondaryAction:It.performance_impact_alert_secondary_action_label},onRequestClose:()=>y(!1),onConfirm:()=>{window?.formbricks?.track("disable_lazy_load_feature",{hiddenFields:{feature:`${v}`}}),zt===v?A("native_lazyload",!0):Mt===v?A("scale",!0):Ot===v&&A("lazyload",!1),y(!1)},onSecondaryAction:()=>{window.open(w,"_blank"),y(!1)}}),(0,s.createElement)("hr",{className:"my-8 border-grayish-blue"}),(0,s.createElement)(u.BaseControl,{className:"mt-2",label:It.lazyload_behaviour_title},(0,s.createElement)("div",{className:"ml-4"},(0,s.createElement)(vt,{label:"",options:[{title:It.smart_loading_title,description:(0,s.createElement)(Tt,{text:It.smart_loading_desc,tags:[{text:It.viewport_detection},{text:It.placeholders_color},{text:It.auto_scaling}]}),value:"disabled"},{title:(0,s.createElement)(kt,{text:It.toggle_native,badgeLabel:It.not_recommended}),description:(0,s.createElement)(Tt,{text:It.native_desc,tags:[{text:It.viewport_detection},{text:It.lightweight_native},{text:It.auto_scaling,disabled:!0}]}),value:"enabled"}],value:r?"enabled":"disabled",onChange:e=>{"disabled"===e?A("native_lazyload",!1):y(zt)}}),(0,s.createElement)(wt,null,(0,s.createElement)(At,null,It.lazyload_behaviour_title," (",It.global_option,")"),(0,s.createElement)(Nt,{className:"flex flex-row items-center gap-4"},(0,s.createElement)(u.CheckboxControl,{className:"optml-skip-lazy-load-images",label:It.lazyload_behaviour_fixed,checked:f,onChange:e=>{L(e,"fixed")},disabled:!1,__nextHasNoMarginBottom:!0}),(0,s.createElement)("div",{className:"w-12"},(0,s.createElement)(u.__experimentalNumberControl,{className:"",label:"",labelPosition:"side",value:e.skip_lazyload_images,type:"number",min:0,onChange:e=>N("skip_lazyload_images",e),disabled:!f,__nextHasNoMarginBottom:!0}))),(0,s.createElement)(Nt,{className:"mt-2"},(0,s.createElement)(u.CheckboxControl,{label:It.lazyload_behaviour_viewport,checked:_,onChange:e=>{L(e,"viewport")},disabled:!1,__nextHasNoMarginBottom:!0})),f&&_&&(0,s.createElement)(bt,{type:"warning",title:"",text:It.viewport_skip_images_notice})),(0,s.createElement)(wt,null,(0,s.createElement)(At,null,It.visual_settings),(0,s.createElement)(Nt,null,(0,s.createElement)("div",{className:"grow flex flex-row gap-1",htmlFor:"optml-lazyload-placeholder"},(0,s.createElement)(u.CheckboxControl,{label:It.enable_lazyload_placeholder_title,checked:n,onChange:e=>A("lazyload_placeholder",e),disabled:l,__nextHasNoMarginBottom:!0}),(0,s.createElement)(u.Tooltip,{text:(0,s.createElement)("p",{className:"",dangerouslySetInnerHTML:{__html:It.enable_lazyload_placeholder_desc}})},(0,s.createElement)(dt,{icon:Ve,size:18,className:"text-gray-400 hover:text-gray-600"}))),n&&(0,s.createElement)("div",{className:"relative inline-block"},(0,s.createElement)(u.Button,{disabled:l,className:"",onClick:()=>{x(!E)}},(0,s.createElement)(u.ColorIndicator,{colorValue:g})),E&&(0,s.createElement)(u.Popover,{placement:"bottom-end",variant:"unstyled",className:"shadow-md border-grayish-blue border border-solid rounded bg-white p-2",onFocusOutside:()=>x(!1)},(0,s.createElement)(u.ColorPicker,{color:g,onChange:S,enableAlpha:!0,defaultValue:""}),(0,s.createElement)(u.Button,{isDestructive:!0,className:"w-full text-center flex justify-center",variant:"secondary",onClick:()=>{S("")}},It.clear)))),(0,s.createElement)(Nt,{className:"mt-2"},(0,s.createElement)(u.CheckboxControl,{checked:p,label:(0,o.createInterpolateElement)(It.enable_noscript_title,{custom_component:(0,s.createElement)("code",null,"<noscript>")}),onChange:e=>A("no_script",e),disabled:l,__nextHasNoMarginBottom:!0}))))),r&&(0,s.createElement)(bt,{type:"warning",title:"",text:It.native_lazy_load_warning}),(0,s.createElement)("hr",{className:"my-8 border-grayish-blue"}),(0,s.createElement)(u.ToggleControl,{label:It.toggle_scale,help:It.scale_desc,checked:b,disabled:l,className:m()({"is-disabled":l}),onChange:e=>{e?A("scale",!e):y(Mt)}}),(0,s.createElement)(wt,null,(0,s.createElement)(At,null,It.extended_features),(0,s.createElement)(u.ToggleControl,{label:It.enable_bg_lazyload_title,help:()=>(0,s.createElement)("p",{dangerouslySetInnerHTML:{__html:It.enable_bg_lazyload_desc}}),checked:i,disabled:l,className:m()("text-sm",{"is-disabled":l}),onChange:e=>A("bg_replacer",e)}),i&&(0,s.createElement)(s.Fragment,null,(0,s.createElement)(u.TextareaControl,{id:"optml-css-watchers",placeholder:It.watch_placeholder_lazyload+"\n"+It.watch_placeholder_lazyload_example,value:e.watchers,onChange:e=>N("watchers",e),help:It.watch_desc_lazyload})),(0,s.createElement)(u.ToggleControl,{label:It.enable_video_lazyload_title,help:()=>(0,s.createElement)("p",{dangerouslySetInnerHTML:{__html:It.enable_video_lazyload_desc}}),checked:d,disabled:l,className:m()("mt-8",{"is-disabled":l}),onChange:e=>A("video_lazyload",e),__nextHasNoMarginBottom:!0}))):(0,s.createElement)(s.Fragment,null,(0,s.createElement)(u.ToggleControl,{label:It.toggle_lazyload,help:()=>(0,s.createElement)("span",{dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.options_strings.lazyload_desc}}),checked:h,disabled:l,className:m()({"is-disabled":l}),onChange:e=>A("lazyload",e)}))},jt="extension",Rt="page_url",Ht="page_url_match",Ft="filename",Pt="class",Vt=[{label:optimoleDashboardApp.strings.options_strings.filter_filename,value:Ft},{label:optimoleDashboardApp.strings.options_strings.filter_ext,value:jt},{label:optimoleDashboardApp.strings.options_strings.filter_url,value:Rt},{label:optimoleDashboardApp.strings.options_strings.filter_class,value:Pt}],qt=[{label:optimoleDashboardApp.strings.options_strings.exclude_filename_desc,value:Ft},{label:optimoleDashboardApp.strings.options_strings.exclude_ext_desc,value:jt},{label:optimoleDashboardApp.strings.options_strings.exclude_url_desc,value:Rt},{label:optimoleDashboardApp.strings.options_strings.exclude_url_match_desc,value:Ht},{label:optimoleDashboardApp.strings.options_strings.exclude_class_desc,value:Pt}],Gt=[{label:".SVG",value:"svg"},{label:".JPG",value:"jpg"},{label:".PNG",value:"png"},{label:".GIF",value:"gif"},{label:".WEBP",value:"webp"}],$t=({label:e,help:t,type:a,settings:l,setSettings:n,setCanSave:r})=>{const{isLoading:i}=(0,c.useSelect)((e=>{const{isLoading:t}=e("optimole");return{isLoading:t()}})),d=optimoleDashboardApp.strings.options_strings.filter_operator_contains,[m,p]=(0,o.useState)(Ft),[g,b]=(0,o.useState)(optimoleDashboardApp.strings.options_strings.filter_operator_contains),[h,_]=(0,o.useState)(""),[f,E]=(0,o.useState)(d),[x,v]=(0,o.useState)(!1),y=0<Object.keys(l.filters[a][jt]).length&&Object.values(l.filters[a][jt]).some((e=>!1!==e))||0<Object.keys(l.filters[a][Pt]).length&&Object.values(l.filters[a][Pt]).some((e=>!1!==e))||0<Object.keys(l.filters[a][Rt]).length&&Object.values(l.filters[a][Rt]).some((e=>!1!==e))||0<Object.keys(l.filters[a][Ht]).length&&Object.values(l.filters[a][Ht]).some((e=>!1!==e))||0<Object.keys(l.filters[a][Ft]).length&&Object.values(l.filters[a][Ft]).some((e=>!1!==e));return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(u.BaseControl,{label:e,help:m===Rt&&optimoleDashboardApp.strings.options_strings.filter_helper},(0,s.createElement)("p",{className:"components-base-control__help mt-0",dangerouslySetInnerHTML:{__html:t}}),(0,s.createElement)("div",{className:"flex flex-col md:flex-row p-6 my-3 bg-light-blue border border-blue-300 rounded-md items-center justify-between gap-8"},(0,s.createElement)("div",{className:"flex justify-start items-center gap-4"},(0,s.createElement)(u.SelectControl,{value:m,options:Vt,onChange:e=>{let t="";e===jt&&(t="svg",b(optimoleDashboardApp.strings.options_strings.filter_operator_is)),e===Ft&&b(optimoleDashboardApp.strings.options_strings.filter_operator_contains),e===Pt&&b(optimoleDashboardApp.strings.options_strings.filter_operator_contains),v(!1),_(t),p(e),E(h)},className:"optml__select",__nextHasNoMarginBottom:!0}),m===Rt?(0,s.createElement)(u.SelectControl,{value:f,options:[{label:optimoleDashboardApp.strings.options_strings.filter_operator_contains,value:optimoleDashboardApp.strings.options_strings.filter_operator_contains},{label:optimoleDashboardApp.strings.options_strings.filter_operator_matches,value:optimoleDashboardApp.strings.options_strings.filter_operator_matches}],onChange:E,className:"optml__select",__nextHasNoMarginBottom:!0}):(0,s.createElement)("p",{className:"m-0"},g),m===jt?(0,s.createElement)(u.SelectControl,{value:h,options:Gt,onChange:_,className:"optml__select",__nextHasNoMarginBottom:!0}):(0,s.createElement)(u.TextControl,{value:h,placeholder:"matches"===f?optimoleDashboardApp.strings.path:optimoleDashboardApp.strings.word,onChange:e=>{_(e),v(!1)},className:"optml__input"})),(0,s.createElement)(u.Button,{variant:"primary",isBusy:i,disabled:i,className:"optml__button flex w-full justify-center rounded font-bold min-h-40 basis-1/5",onClick:()=>{if(3>h.length)return void v(!0);const e={...l.filters};let t=m;m===Rt&&"matches"===f&&(t=Ht),e[a]&&"object"==typeof e[a]||(e[a]={}),e[a][t]&&!Array.isArray(e[a][t])||(e[a][t]={}),e[a][t][h]=!0,n({...l,filters:e}),m!==jt&&_(""),r(!0),_(""),p(Ft),E(d)}},optimoleDashboardApp.strings.options_strings.add_filter)),x&&(0,s.createElement)("p",{className:"text-red-500 bg-red-100 p-2 rounded-md border border-solid border-red-200"},optimoleDashboardApp.strings.options_strings.filter_length_error)),y&&(0,s.createElement)(u.BaseControl,{label:"optimize"===a?optimoleDashboardApp.strings.options_strings.active_optimize_exclusions:optimoleDashboardApp.strings.options_strings.active_lazyload_exclusions,className:"py-4"},qt.map((e=>Object.keys(l.filters[a][e.value]).filter((t=>!1!==l.filters[a][e.value][t])).map((t=>(0,s.createElement)("div",{key:t,className:"flex p-3 my-3 bg-light-blue border border-blue-300 rounded-md items-center justify-between gap-8"},(0,s.createElement)("div",{className:"flex items-center gap-1"},(0,s.createElement)("p",{className:"m-0 inline-block",dangerouslySetInnerHTML:{__html:e.label}}),(0,s.createElement)("b",null,t)),(0,s.createElement)(u.Button,{variant:"default",icon:"trash",disabled:i,onClick:()=>((e,t)=>{const s={...l.filters};s[a][e][t]=!1,n({...l,filters:s}),r(!0)})(e.value,t)}))))))))},Kt=({settings:e,setSettings:t,setCanSave:a})=>{const o="disabled"!==e.lazyload;return(0,s.createElement)(s.Fragment,null,(0,s.createElement)($t,{label:optimoleDashboardApp.strings.options_strings.exclude_title_optimize,help:optimoleDashboardApp.strings.options_strings.exclude_desc_optimize,type:"optimize",settings:e,setSettings:t,setCanSave:a}),o&&(0,s.createElement)(s.Fragment,null,(0,s.createElement)("hr",{className:"my-8 border-grayish-blue"}),(0,s.createElement)($t,{label:optimoleDashboardApp.strings.options_strings.exclude_title_lazyload,help:optimoleDashboardApp.strings.options_strings.exclude_desc_lazyload,type:"lazyload",settings:e,setSettings:t,setCanSave:a})))};function Zt({title:e,progress:t,description:a,onCancel:o,hideCancel:l=!1}){const{strings:n}=optimoleDashboardApp;return(0,s.createElement)("div",{className:"bg-gray-50 rounded-md p-4 space-y-4"},(0,s.createElement)("div",{className:"flex gap-3 items-center"},(0,s.createElement)(dt,{icon:_,className:"text-info animate-spin -scale-y-100"}),e&&(0,s.createElement)("p",{className:"uppercase text-s font-semibold text-light-black m-0"},e),!l&&(0,s.createElement)("button",{onClick:o,className:"appearance-none border border-info text-info bg-transparent rounded px-4 py-2 ml-auto text-s hover:border-red-500 hover:bg-red-500 hover:text-white cursor-pointer"},n.cancel)),(0,s.createElement)(je,{value:t}),a&&(0,s.createElement)("p",{className:"text-xs text-gray-500"},a))}const Wt=(0,s.createElement)(p.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(p.Path,{d:"M12.5 5L10 19h1.9l2.5-14z"})),Ut=({type:e})=>{const{logs:t}=(0,c.useSelect)((e=>{const{getLogs:t}=e("optimole");return{logs:t()}})),[a,l]=(0,o.useState)(!1),n=(0,o.useRef)(null);return(0,o.useEffect)((()=>{const a=setInterval((()=>{n.current&&(n.current.innerHTML=t[e],n.current.scrollTop=n.current.scrollHeight)}),15e3);return()=>clearInterval(a)}),[]),(0,s.createElement)(s.Fragment,null,(0,s.createElement)("div",{className:"w-full flex justify-end text-info my-2"},(0,s.createElement)(u.Button,{variant:"tertiary",className:"py-2 px-0",target:"_blank",href:`${window.ajaxurl}?action=optml_fetch_logs&nonce=${optimoleDashboardApp.nonce}&type=${e}`},optimoleDashboardApp.strings.options_strings.view_logs),(0,s.createElement)(u.Icon,{icon:Wt,className:"fill-info py-2"}),(0,s.createElement)(u.Button,{variant:"tertiary",className:"py-2 px-0",onClick:()=>l(!a)},a?optimoleDashboardApp.strings.options_strings.hide_logs:optimoleDashboardApp.strings.options_strings.show_logs)),a&&(0,s.createElement)("div",{className:"flex flex-col p-6 bg-light-blue border border-blue-300 rounded-md min-h-[200px] max-h-[200px] overflow-y-scroll",ref:n,dangerouslySetInnerHTML:{__html:t[e]}}))},Yt=({settings:e,canSave:t,setSettings:a,setCanSave:l})=>{const{strings:n,cron_disabled:r,show_exceed_plan_quota_notice:i}=optimoleDashboardApp,{conflicts:d,options_strings:p}=n,g="offload",u="rollback",b="stopOffload",h="stopRollback",f="planQuotaNotice",{offloadConflicts:y,errorMedia:w,offloadLibraryLink:A,isLoading:N,loadingSync:S,loadingRollback:L,rollbackLibraryLink:C,queryArgs:k,totalNumberOfImages:D,processedImages:T,offloadFinishNotice:I,offloadLimitReached:M,offloadLimit:O,canUseMediaOffloadingFlag:z,canShowFreeUserWithOffloadNoticeFlag:B}=(0,c.useSelect)((e=>{const{getOffloadConflicts:t,getErrorMedia:a,getLoadingSync:s,getLoadingRollback:o,getOffloadLibraryLink:l,getRollbackLibraryLink:n,getTotalNumberOfImages:r,getProcessedImages:i,getQueryArgs:c,isLoading:d,getSiteSettings:m,getOffloadLimit:p,getUserData:g,canShowFreeUserWithOffloadNotice:u}=e("optimole"),b=g();return{offloadConflicts:t(),errorMedia:a(),offloadLibraryLink:l(),isLoading:d(),loadingSync:s(),loadingRollback:o(),rollbackLibraryLink:n(),queryArgs:c(),totalNumberOfImages:r(),processedImages:i(),offloadFinishNotice:m("show_offload_finish_notice"),offloadLimitReached:"enabled"===m("offload_limit_reached"),offloadLimit:p(),canUseMediaOffloadingFlag:Boolean(b?.can_use_offloading),canShowFreeUserWithOffloadNoticeFlag:u()}}),[]),{setErrorMedia:j,setCheckedOffloadConflicts:R,setOffloadConflicts:H,setProcessedImages:F,setOffloadLimitReached:P}=(0,c.useDispatch)("optimole"),[V,q]=(0,o.useState)(null),[G,$]=(0,o.useState)(null),K="disabled"!==e.offloading_status,Z="disabled"!==e.rollback_status,W=(0,o.useMemo)((()=>"enabled"===e?.offload_media&&!z&&B),[e,z,B]);(0,o.useEffect)((()=>{K&&Se({action:"offload_images",refresh:!0}),Z&&Se({action:"rollback_images",refresh:!0})}),[]);const U=async(t=[])=>{await Le();const s={...e};s.show_offload_finish_notice="",s.offloading_status="enabled",s.offload_media="enabled",a(s),we(s,!1,!0,(()=>{j(!1),F(0),P(!1),Se({action:"offload_images"}),l(!1)}))},Y=[{title:p.offload_radio_option_rollback_title,description:p.offload_radio_option_rollback_desc,value:"rollback"},{title:p.offload_radio_option_offload_title,description:p.offload_radio_option_offload_desc,value:"offload"}],Q="enabled"===e.offload_media?"offload":"rollback",X=S||L;return(0,s.createElement)("div",null,(0,s.createElement)("h1",{className:"text-xl font-bold"},p.enable_offload_media_title),(0,s.createElement)("p",{dangerouslySetInnerHTML:{__html:p.enable_offload_media_desc}}),W&&(0,s.createElement)(bt,{type:"warning",title:p.plan_update_notice_title,text:p.plan_update_notice_desc}),I&&(0,s.createElement)(bt,{title:"offload"===I?p.offloading_success:p.rollback_success,type:"primary",onDismiss:()=>{we({show_offload_finish_notice:""},!1,!0)}}),r&&(0,s.createElement)(bt,{type:"error",text:n.cron_error}),!X&&(0,s.createElement)(vt,{className:m()({"opacity-50 pointer-events-none":N||r}),label:p.offloading_radio_legend,options:Y,value:Q,onChange:e=>{$(Q),q("offload"===e?{type:i?f:g,optionValue:e}:{type:u,optionValue:e})}}),X&&(0,s.createElement)(s.Fragment,null,(0,s.createElement)(Zt,{title:S?p.sync_media_progress:p.rollback_media_progress,progress:Math.round(T/D*100),onCancel:()=>{S&&q({type:b,optionValue:G}),L&&q({type:h,optionValue:G})},description:0===D?p.calculating_estimated_time:p.images_processing}),(0,s.createElement)(Ut,{type:S?"offload":"rollback"})),"offload_images"===w&&(0,s.createElement)(bt,{type:"error",smallTitle:!0,title:p.sync_media_error,text:p.sync_media_error_desc}),"rollback_images"===w&&(0,s.createElement)(bt,{type:"error",smallTitle:!0,title:p.rollback_media_error,text:p.rollback_media_error_desc}),0<y.length&&(0,s.createElement)(bt,{type:"warning",title:p.offload_conflicts_part_1},(0,s.createElement)("div",{className:"list-disc grid gap-3 mt-2"},(0,s.createElement)("ul",{className:"grid gap-1"},y.map((e=>(0,s.createElement)("li",{key:e,className:"font-semibold text-base m-0"},e)))),(0,s.createElement)("p",{className:"m-0 text-sm"},p.offload_conflicts_part_2),(0,s.createElement)("button",{disabled:N,className:m()({"opacity-50 pointer-events-none":N},"justify-self-start font-semibold flex items-center appearance-none border border-info text-info bg-white rounded px-4 py-2 text-sm hover:text-white hover:bg-info cursor-pointer"),onClick:()=>H([])},d.conflict_close))),!X&&(0,s.createElement)("button",{onClick:e=>{e.preventDefault(),"offload"===Q&&q({type:i?f:g,optionValue:Q}),"rollback"===Q&&q({type:u,optionValue:Q})},disabled:N||r,className:m()({"opacity-50 pointer-events-none":N||r},"font-semibold flex items-center gap-2 appearance-none border border-info text-info bg-transparent rounded px-4 py-2 ml-auto text-sm hover:text-white hover:bg-info cursor-pointer")},(0,s.createElement)(dt,{icon:_,className:"w-4 h-4"}),(0,s.createElement)("span",null,p.sync_media)),!X&&M&&(0,s.createElement)(bt,{type:"warning",text:p.offload_limit_reached.replace("#offload_limit#",O)}),V&&(0,s.createElement)(Ct,{...(({type:t,optionValue:o})=>{const n={...e};return{onRequestClose:()=>q(null),...{[g]:{icon:E,onConfirm:()=>{z?(n.offload_media="offload"===o?"enabled":"disabled",a(n),l(!0),U()):window.open(optimoleDashboardApp?.offload_upgrade_url,"_blank"),q(null)},labels:{title:p.offloading_start_title,description:p.offloading_start_description,action:z?p.offloading_start_action:optimoleDashboardApp.strings.upgrade.title_long},afterContentChildren:!z&&(0,s.createElement)(bt,{type:"warning",text:p.upgrade_to_use_offloading_notice_desc})},[u]:{icon:x,onConfirm:()=>{n.offload_media="offload"===o?"enabled":"disabled",a(n),l(!0),R(!1),H([]),Ne((async t=>{if(0===t.data.length){await Le("rollback_images");const t={...e};t.show_offload_finish_notice="",t.rollback_status="enabled",t.offload_media="disabled",we(t,!1,!0,(()=>{j(!1),F(0),Se({action:"rollback_images"}),l(!1)}))}})),q(null)},labels:{title:p.rollback_start_title,description:p.rollback_start_description,action:p.rollback_start_action}},[b]:{variant:"warning",icon:v,onConfirm:()=>{q(null);const t=e;t.offloading_status="disabled",t.offload_media="offload"===G?"enabled":"disabled",we(t),$(null)},labels:{title:p.offloading_stop_title,description:p.offloading_stop_description,action:p.offloading_stop_action}},[h]:{variant:"warning",icon:v,onConfirm:()=>{q(null);const t=e;t.rollback_status="disabled",t.offload_media="offload"===G?"enabled":"disabled",we(t),$(null)},labels:{title:p.rollback_stop_title,description:p.rollback_stop_description,action:p.rollback_stop_action}},[f]:{variant:"warning",icon:v,onConfirm:()=>{n.offload_media="offload"===o?"enabled":"disabled",a(n),l(!0),U(),q(null)},onSecondaryAction:()=>{q(null);const t=e;t.offload_media="disabled",we(t),window.onbeforeunload=null},labels:{title:p.exceed_plan_quota_notice_title,description:p.exceed_plan_quota_notice_description,action:p.exceed_plan_quota_notice_start_action,secondaryAction:p.exceed_plan_quota_notice_secondary_action}}}[t]}})(V)}),A&&(0,s.createElement)("p",{className:"m-0"},p.sync_media_link," ",(0,s.createElement)("a",{href:k.url},p.here)),C&&(0,s.createElement)("p",{className:"m-0"},p.rollback_media_link," ",(0,s.createElement)("a",{href:k.url},optimoleDashboardApp.strings.options_strings.here)))},Qt=(0,s.createElement)(p.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(p.Path,{d:"m14.5 6.5-1 1 3.7 3.7H4v1.6h13.2l-3.7 3.7 1 1 5.6-5.5z"}));function Xt(e){const{user_data:t,strings:a}=optimoleDashboardApp,{options_strings:o}=a,{settings:l,setSettings:n,setCanSave:r}=e,i=(0,c.useSelect)((e=>{const{isLoading:t,isSubApiKey:a}=e("optimole");return{isLoading:t(),isSubApiKey:a()}}),[]),{isLoading:d,isSubApiKey:p}=i,g="disabled"!==l.cloud_images,b=!p&&g,h=t.whitelist||[];return(0,s.createElement)(s.Fragment,null,(0,s.createElement)(u.ToggleControl,{label:o.enable_cloud_images_title,help:()=>(0,s.createElement)("p",{dangerouslySetInnerHTML:{__html:o.enable_cloud_images_desc}}),checked:g,disabled:d,className:m()({"is-disabled":d}),onChange:e=>((e,t)=>{r(!0);const a={...l};a.cloud_images=t?"enabled":"disabled",n(a)})(0,e)}),g&&(0,s.createElement)("div",{className:"m-0"},(0,s.createElement)("a",{href:o.cloud_library_btn_link,className:"font-semibold text-info text-sm hover:text-info inline-flex items-center"},o.cloud_library_btn_text,(0,s.createElement)(u.Icon,{icon:Qt,className:"inline-block ml-2 fill-current"}))),(0,s.createElement)("hr",{className:"my-8 border-grayish-blue"}),b&&(0,s.createElement)(u.BaseControl,{label:o.cloud_site_title,help:o.cloud_site_desc},(0,s.createElement)("div",{className:"optml__token__base flex p-6 bg-light-blue border border-blue-300 rounded-md items-center gap-8"},(0,s.createElement)(u.FormTokenField,{value:Object.keys(l.cloud_sites).filter((e=>"all"!==e&&"false"!==l.cloud_sites[e])).map((e=>e))||[],suggestions:h,onChange:e=>{r(!0);const t={},a={...l};0===e.length?t.all="true":e.forEach((e=>{t[e]="true"})),Object.keys(a.cloud_sites).forEach((e=>{Object.prototype.hasOwnProperty.call(t,e)||(t[e]="false")})),a.cloud_sites=t,n(a)},__experimentalExpandOnFocus:!0,__experimentalShowHowTo:!1,__experimentalValidateInput:e=>h.includes(e),className:"optml__token"}))))}const Jt=()=>{const{options_strings:e}=optimoleDashboardApp.strings;return(0,s.createElement)(s.Fragment,null,(0,s.createElement)("div",null,(0,s.createElement)("h1",{className:"text-xl font-bold"},e.watermark_media_title),(0,s.createElement)("p",{className:"text-gray-600 mt-2 mb-2"},e.watermark_media_desc)),(0,s.createElement)("div",{style:{border:"2px solid #DCDCDC",borderRadius:"8px",padding:"16px"}},(0,s.createElement)("div",{className:"mb-4 space-y-2"},(0,s.createElement)("div",{className:"flex items-center gap-2 align-center"},(0,s.createElement)("div",{className:"w-2 h-2 bg-gray-900 rounded-full flex-shrink-0"}),(0,s.createElement)("span",{className:"text-gray-700 text-left"},e.watermark_info_1)),(0,s.createElement)("div",{className:"flex items-center gap-2 align-center"},(0,s.createElement)("div",{className:"w-2 h-2 bg-gray-900 rounded-full flex-shrink-0"}),(0,s.createElement)("span",{className:"text-gray-700 text-left "},e.watermark_info_2)),(0,s.createElement)("div",{className:"flex items-center gap-2 align-center"},(0,s.createElement)("div",{className:"w-2 h-2 bg-gray-900 rounded-full flex-shrink-0"}),(0,s.createElement)("span",{className:"text-gray-700 text-left"},e.watermark_info_3))),(0,s.createElement)("div",{className:"flex gap-4 mb-4"},(0,s.createElement)(u.Button,{variant:"primary",className:"bg-blue-600 text-white px-6 py-3 rounded-lg font-medium flex items-center gap-2 hover:bg-blue-700",target:"_blank",rel:"noopener noreferrer",href:"https://dashboard.optimole.com/watermark"},(0,s.createElement)(dt,{icon:qe,className:"w-4 h-4"}),e.open_optimole_dashboard),(0,s.createElement)(u.Button,{variant:"secondary",className:"border border-gray-300 text-gray-700 px-6 py-3 rounded-lg font-medium hover:bg-gray-50",target:"_blank",rel:"noopener noreferrer",href:"https://docs.optimole.com/article/1475-adding-watermarks-to-your-images"},e.learn_more)),(0,s.createElement)("span",{className:"text-gray-500"},e.watermark_footer)))},ea=({tab:e,setTab:t,canSave:a,setCanSave:l,settings:n,setSettings:r})=>{const{siteSettings:i,isLoading:d,damEnabled:m}=(0,c.useSelect)((e=>{const{getSiteSettings:t,getQueryArgs:a,isLoading:s}=e("optimole"),o=t();return{siteSettings:o,damEnabled:o.cloud_images,isLoading:s(),queryArgs:a()}}),[]),[p,g]=(0,o.useState)(!1),[b,h]=(0,o.useState)(!1);(0,o.useEffect)((()=>{((e=!0)=>{const{dam_url:t,strings:a}=window.optimoleDashboardApp,{cloud_library:s}=a,o=document.querySelector('a[href*="page=optimole-dam"]');if(!e&&!o)return;if(!e){if(!o)return;return void(o.style.display="none")}if(o)return void(o.style={});const l=document.createElement("li"),n=document.createElement("a");l.appendChild(n),n.href=t,n.innerHTML=s;const r=document.querySelector("#toplevel_page_optimole ul");r&&r.insertBefore(l,r.firstChild)})("enabled"===m)}),[m]);const _=()=>{we(n,i.banner_frontend!==n.banner_frontend),l(!1)};return(0,s.createElement)("div",{className:"optml-settings flex flex-col sm:flex-row bg-white p-8 border-0 rounded-lg shadow-md gap-8"},(0,s.createElement)(ct,{tab:e,setTab:t,settings:n}),(0,s.createElement)("div",{className:"basis-4/5"},"general"===e&&(0,s.createElement)(ht,{settings:n,setSettings:r,setCanSave:l}),"compression"===e&&(0,s.createElement)(Et,{settings:n,setSettings:r,setCanSave:l,showSample:p,isSampleLoading:b,setIsSampleLoading:h}),"resize"===e&&(0,s.createElement)(xt,{settings:n,setSettings:r,setCanSave:l}),"lazyload"===e&&(0,s.createElement)(Bt,{settings:n,setSettings:r,setCanSave:l}),"exclusions"===e&&(0,s.createElement)(Kt,{settings:n,setSettings:r,setCanSave:l}),"cloud_library"===e&&(0,s.createElement)(Xt,{settings:n,canSave:a,setSettings:r,setCanSave:l,onSaveSettings:_}),"offload_media"===e&&(0,s.createElement)(Yt,{settings:n,canSave:a,setSettings:r,setCanSave:l,onSaveSettings:_}),"watermark"===e&&(0,s.createElement)(Jt,null),(0,s.createElement)("div",{className:"flex justify-start items-center gap-5 mt-8"},"watermark"!==e&&(0,s.createElement)(u.Button,{variant:"primary",isBusy:d,disabled:!a,className:"optml__button flex w-full justify-center rounded font-bold min-h-40 basis-1/5",onClick:_},optimoleDashboardApp.strings.options_strings.save_changes),"disabled"===n.autoquality&&"compression"===e&&(0,s.createElement)(u.Button,{variant:"default",disabled:d,onClick:()=>{g(!p)}},optimoleDashboardApp.strings.options_strings.view_sample_image))))},ta=(0,s.createElement)(p.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(p.Path,{fillRule:"evenodd",d:"M17.375 15.656A6.47 6.47 0 0018.5 12a6.47 6.47 0 00-.943-3.374l-1.262.813c.448.749.705 1.625.705 2.561a4.977 4.977 0 01-.887 2.844l1.262.813zm-1.951 1.87l-.813-1.261A4.976 4.976 0 0112 17c-.958 0-1.852-.27-2.613-.736l-.812 1.261A6.47 6.47 0 0012 18.5a6.47 6.47 0 003.424-.974zm-8.8-1.87A6.47 6.47 0 015.5 12c0-1.235.344-2.39.943-3.373l1.261.812A4.977 4.977 0 007 12c0 1.056.328 2.036.887 2.843l-1.262.813zm2.581-7.803A4.977 4.977 0 0112 7c1.035 0 1.996.314 2.794.853l.812-1.262A6.47 6.47 0 0012 5.5a6.47 6.47 0 00-3.607 1.092l.812 1.261zM12 20a8 8 0 100-16 8 8 0 000 16zm0-4.5a3.5 3.5 0 100-7 3.5 3.5 0 000 7z",clipRule:"evenodd"})),aa=(0,s.createElement)(p.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,s.createElement)(p.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M6.68822 16.625L5.5 17.8145L5.5 5.5L18.5 5.5L18.5 16.625L6.68822 16.625ZM7.31 18.125L19 18.125C19.5523 18.125 20 17.6773 20 17.125L20 5C20 4.44772 19.5523 4 19 4H5C4.44772 4 4 4.44772 4 5V19.5247C4 19.8173 4.16123 20.086 4.41935 20.2237C4.72711 20.3878 5.10601 20.3313 5.35252 20.0845L7.31 18.125ZM16 9.99997H8V8.49997H16V9.99997ZM8 14H13V12.5H8V14Z"})),sa=(0,s.createElement)(p.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,s.createElement)(p.Path,{d:"M11.1 15.8H20v-1.5h-8.9v1.5zm0-8.6v1.5H20V7.2h-8.9zM6 13c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-7c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"})),oa=[{title:optimoleDashboardApp.strings.help.get_support_title,description:optimoleDashboardApp.strings.help.get_support_desc,cta:optimoleDashboardApp.strings.help.get_support_cta,link:"https://wordpress.org/support/plugin/optimole-wp/",icon:ta},{title:optimoleDashboardApp.strings.help.feat_request_title,description:optimoleDashboardApp.strings.help.feat_request_desc,cta:optimoleDashboardApp.strings.help.feat_request_cta,link:"https://github.com/Codeinwp/optimole-wp/discussions",icon:aa},{title:optimoleDashboardApp.strings.help.feedback_title,description:optimoleDashboardApp.strings.help.feedback_desc,cta:optimoleDashboardApp.strings.help.feedback_cta,link:"https://wordpress.org/plugins/optimole-wp/#developers",icon:sa}],la=[{title:optimoleDashboardApp.strings.help.account_title,items:[{label:optimoleDashboardApp.strings.help.account_item_one,value:"https://docs.optimole.com/article/1134-how-optimole-counts-the-number-of-visitors"},{label:optimoleDashboardApp.strings.help.account_item_two,value:"https://docs.optimole.com/article/1008-what-happens-if-i-exceed-plan-limits"},{label:optimoleDashboardApp.strings.help.account_item_three,value:"https://docs.optimole.com/article/1133-visitors-based-plan"}]},{title:optimoleDashboardApp.strings.help.image_processing_title,items:[{label:optimoleDashboardApp.strings.help.image_processing_item_one,value:"https://docs.optimole.com/article/1173-how-to-get-started-with-optimole-in-just-3-steps"},{label:optimoleDashboardApp.strings.help.image_processing_item_two,value:"https://docs.optimole.com/article/1068-how-optimole-can-serve-webp-images"},{label:optimoleDashboardApp.strings.help.image_processing_item_three,value:"https://docs.optimole.com/article/1475-adding-watermarks-to-your-images"}]},{title:optimoleDashboardApp.strings.help.api_title,items:[{label:optimoleDashboardApp.strings.help.api_item_one,value:"https://docs.optimole.com/article/1323-cloud-library-browsing"},{label:optimoleDashboardApp.strings.help.api_item_two,value:"https://docs.optimole.com/article/1191-exclude-from-optimizing-or-lazy-loading"},{label:optimoleDashboardApp.strings.help.api_item_three,value:"https://docs.optimole.com/article/1307-custom-integration"}]}],na="flex p-6 border-2 border-solid border-grayish-blue rounded-md items-start gap-8 basis-1/3",ra=()=>(0,s.createElement)("div",{className:"bg-white p-8 border-0 rounded-lg shadow-md"},(0,s.createElement)("p",{className:"font-bold text-base"},optimoleDashboardApp.strings.help.section_one_title),(0,s.createElement)("div",{className:"flex gap-5 flex-col md:flex-row"},oa.map(((e,t)=>(0,s.createElement)("div",{key:t,className:na},(0,s.createElement)("div",{className:"flex w-full flex-col gap-2"},(0,s.createElement)(u.Icon,{icon:e.icon,className:"fill-info",size:42}),(0,s.createElement)("div",{className:"font-bold text-base py-2 text-gray-800"},e.title),(0,s.createElement)("div",{className:"not-italic font-normal text-s text-gray-800"},e.description),(0,s.createElement)(u.ExternalLink,{href:e.link},e.cta)))))),(0,s.createElement)("hr",{className:"my-8 border-grayish-blue"}),(0,s.createElement)("div",{className:"flex items-center justify-between"},(0,s.createElement)("p",{className:"font-bold text-base"},optimoleDashboardApp.strings.help.section_two_title),(0,s.createElement)(u.ExternalLink,{href:"https://docs.optimole.com/"},optimoleDashboardApp.strings.help.section_two_sub)),(0,s.createElement)("div",{className:"flex gap-5 flex-col md:flex-row"},la.map(((e,t)=>(0,s.createElement)("div",{key:t,className:na},(0,s.createElement)("div",{className:"flex w-full flex-col gap-2"},(0,s.createElement)("div",{className:"font-bold text-base py-2 text-gray-800"},e.title),e.items.map(((e,t)=>(0,s.createElement)("a",{key:t,href:e.value,target:"_blank"},e.label))))))))),ia=e=>new Promise((t=>{fetch(e).then((()=>{t({success:!0})})).catch((()=>{t({success:!1})}))})),ca={IDLE:"idle",INSTALLING:"installing",ACTIVATING:"activating",ACTIVE:"active",ERROR:"error"},da=()=>{const{i18n:e,activate_url:t,banner_dismiss_key:a,status:l}=optimoleDashboardApp.spc_banner,[n,r]=(0,o.useState)("installed"===l?ca.INSTALLED:ca.IDLE),[i,c]=(0,o.useState)(!0),[d,p]=(0,o.useState)(!0),g=n===ca.INSTALLING||n===ca.ACTIVATING;if((0,o.useEffect)((()=>{if(!i){const e=setTimeout((()=>{p(!1)}),300);return()=>clearTimeout(e)}}),[i]),!d)return null;const b=m()("bg-white flex flex-col text-gray-700 border-0 rounded-lg overflow-hidden shadow-md relative transition-opacity duration-300",{"opacity-0":!i,"opacity-100":i});return(0,s.createElement)("div",{className:b},(0,s.createElement)("button",{onClick:()=>{ke(a,(()=>{c(!1)}))},className:"absolute top-2 right-2 p-1 bg-transparent border-0 text-red z-10 cursor-pointer rounded-full flex items-center justify-center hover:opacity-75 transition-opacity text-gray-500 hover:text-info"},(0,s.createElement)("span",{className:"sr-only"},e.dismiss),(0,s.createElement)(u.Icon,{icon:St,className:"fill-current",size:18})),(0,s.createElement)("div",{className:"p-8 flex flex-col gap-2"},(0,s.createElement)("h3",{className:"text-lg mt-0"},e.title),(0,s.createElement)("p",{className:"text-gray-600 m-0"},e.byline),(0,s.createElement)("ul",{className:"grid gap-2"},e.features.map(((e,t)=>(0,s.createElement)("li",{className:"flex items-center gap-2",key:t},(0,s.createElement)(u.Icon,{icon:mt,className:"fill-info bg-info/20 rounded-full",size:20}),(0,s.createElement)("span",{className:"text-gray-700 font-normal"},e))))),![ca.ACTIVE,ca.ERROR].includes(n)&&(0,s.createElement)(u.Button,{variant:"primary",onClick:e=>{if(e.preventDefault(),n===ca.INSTALLED)return r(ca.ACTIVATING),void ia(t).then((e=>{e.success?r(ca.ACTIVE):r(ca.ERROR)}));r(ca.INSTALLING),("wp-cloudflare-page-cache",new Promise((e=>{wp.updates.ajax("install-plugin",{slug:"wp-cloudflare-page-cache",success:()=>{e({success:!0})},error:t=>{e({success:!1,code:t.errorCode})}})}))).then((e=>{e.success?(r(ca.ACTIVATING),ia(t).then((e=>{e.success?r(ca.ACTIVE):r(ca.ERROR)}))):r(ca.ERROR)}))},className:"flex w-full justify-center font-bold rounded hover:opacity-90 transition-opacity",disabled:g,isBusy:g},n===ca.IDLE&&e.cta,n===ca.INSTALLED&&e.activate,n===ca.INSTALLING&&e.installing,n===ca.ACTIVATING&&e.activating),n===ca.ACTIVE&&(0,s.createElement)("div",{className:"flex items-center justify-center gap-3 py-3 px-4 rounded-md bg-emerald-100 border border-solid border-emerald-200"},(0,s.createElement)("span",{className:"font-medium text-sm text-emerald-700"},e.activated)),n===ca.ERROR&&(0,s.createElement)("div",{className:"text-center py-3 px-4 rounded-md bg-red-100 border border-solid border-red-200"},(0,s.createElement)("span",{className:"font-medium text-sm text-red-700"},e.error))))},ma=({settings:e,setSettings:t,setCanSave:a,setTab:o})=>{const{isLoading:l}=(0,c.useSelect)((e=>{const{isLoading:t}=e("optimole");return{isLoading:t()}}),[]),n="enabled"===e?.lazyload,r="enabled"===e?.image_replacer,{optimization_status:i}=optimoleDashboardApp.strings,d=[{settingType:"image_replacer",active:r,label:i.statusTitle1,description:i.statusSubTitle1,buttonText:r?i.manage:i.enable},{settingType:"lazyload",active:n&&r,label:i.statusTitle2,description:i.statusSubTitle2,buttonText:r?n?i.disable:i.enable:""},{settingType:"scale",active:n&&"disabled"===e?.scale&&r,label:i.statusTitle3,description:i.statusSubTitle3,buttonText:r?n&&"disabled"===e?.scale?i.disable:i.enable:""}];return(0,s.createElement)("div",{className:"bg-white flex flex-col text-gray-700 border-0 rounded-lg shadow-md p-8"},(0,s.createElement)("h3",{className:"text-lg mt-0"},optimoleDashboardApp.strings.optimization_status.title),(0,s.createElement)("ul",{className:"grid gap-3 m-0"},d.map(((n,r)=>(0,s.createElement)("li",{key:r,className:"flex items-start gap-2 justify-between"},(0,s.createElement)("div",{className:"flex items-start gap-2"},n.active?(0,s.createElement)(u.Icon,{icon:mt,className:"fill-success bg-success/20 rounded-full",size:20}):(0,s.createElement)(u.Icon,{icon:ut,className:"fill-danger bg-danger/20 rounded-full",size:20}),(0,s.createElement)("div",null,(0,s.createElement)("span",{className:"text-gray-700 font-semibold"},n.label),(0,s.createElement)("p",{className:"m-0"},n.description))),(0,s.createElement)(u.Button,{variant:"link",className:"text-info text-sm font-medium",style:{textDecoration:"none"},onClick:()=>{"image_replacer"===n.settingType&&n.active?o&&o("settings"):("scale"===n.settingType&&(n.active=!n.active),"disabled"===e?.image_replacer&&"image_replacer"!==n.settingType||((s,o)=>{if(a&&t){a(!0);const l={...e};l[s]=o?"enabled":"disabled","scale"===s&&l.scale&&"disabled"===l.scale&&"disabled"===l.lazyload&&(l.lazyload="enabled"),"lazyload"===s&&l.lazyload&&"disabled"===l.lazyload&&"disabled"===l.scale&&(l.scale="enabled"),t(l),we(l,!1,!1,(()=>{a(!1)}))}})(n.settingType,!n.active))},isBusy:l,disabled:l},n.buttonText))))),(0,s.createElement)("p",{className:"m-0 mt-5",dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.optimization_tips}}))};function pa({children:e,text:t}){const[a,l]=(0,o.useState)(!1);if(!t)return e;if(!e)return null;const n=m()("absolute text-white bg-gray-800 text-xs p-2 rounded shadow-lg z-10 transition-opacity duration-200 pointer-events-none",{"opacity-100":a,"opacity-0":!a});return(0,s.createElement)("div",{className:"relative",onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1)},(0,s.createElement)("div",{className:n,style:{left:"50%",transform:"translateX(-50%)",bottom:"120%"}},t.charAt(0).toUpperCase()+t.slice(1).toLowerCase(),(0,s.createElement)("div",{className:"absolute -bottom-1 w-2 h-2 bg-gray-800",style:{left:"50%",transform:"translateX(-50%) rotate(45deg)"}})),e)}const ga=[optimoleDashboardApp.strings.upgrade.reason_1,optimoleDashboardApp.strings.upgrade.reason_2,optimoleDashboardApp.strings.upgrade.reason_3,optimoleDashboardApp.strings.upgrade.reason_4],ua=({settings:e,setSettings:t,setCanSave:a,setTab:o})=>{var l;const{name:n,domain:r,plan:i}=(0,c.useSelect)((e=>{const{getUserData:t}=e("optimole"),a=t();let s=a?.cdn_key+".i.optimole.com";return void 0!==a?.domain&&""!==a?.domain&&(s=a?.domain),void 0!==a?.domain_dns&&""!==a?.domain_dns&&(s=a?.domain_dns),{name:a?.display_name,domain:s,plan:a?.plan}})),d=null!==optimoleDashboardApp.spc_banner;return(0,s.createElement)("div",{className:"grid md:grid-cols-2 xl:flex xl:flex-col xl:mt-8 xl:mb-5 p-0 transition-all ease-in-out duration-700 gap-5 shrink-0 xl:w-[350px]"},(0,s.createElement)("div",{className:"bg-white gap-3 flex flex-col text-gray-700 border-0 rounded-lg shadow-md p-8"},(0,s.createElement)("div",{className:"grid gap-4"},(0,s.createElement)(ba,{icon:L,value:n,tooltipText:optimoleDashboardApp.strings.logged_in_as}),(0,s.createElement)(ba,{icon:S,value:r,tooltipText:optimoleDashboardApp.strings.private_cdn_url})),(0,s.createElement)("hr",{className:"m-0 border-t-grayish-blue"}),(0,s.createElement)("div",{className:"border-t border-gray-300 block grid gap-2"},(0,s.createElement)("p",{className:"font-semibold text-xs text-light-black m-0"},optimoleDashboardApp.strings.looking_for_api_key),(0,s.createElement)("span",{dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.optml_dashboard}}))),"free"===i?(0,s.createElement)("div",{className:"bg-info flex flex-col text-white border-0 rounded-lg overflow-hidden shadow-md bg-promo bg-no-repeat",style:{backgroundImage:`url( ${optimoleDashboardApp.assets_url}/img/logo2.png )`}},optimoleDashboardApp?.bf_notices?.sidebar&&(0,s.createElement)("a",{href:optimoleDashboardApp.bf_notices.sidebar.cta_link,className:"flex flex-col gap-3 p-3 bg-black !no-underline text-center cursor-pointer hover:opacity-90 transition-opacity",target:"_blank"},(0,s.createElement)("span",{className:"font-extrabold text-[17px] uppercase italic",dangerouslySetInnerHTML:{__html:optimoleDashboardApp.bf_notices.sidebar.title}}),(0,s.createElement)("span",{className:"text-[11px] font-bold",dangerouslySetInnerHTML:{__html:optimoleDashboardApp.bf_notices.sidebar.subtitle}})),(0,s.createElement)("div",{className:"p-8 flex flex-col"},(0,s.createElement)("h3",{className:"mt-0 text-white text-lg"},optimoleDashboardApp.strings.upgrade.title_long),(0,s.createElement)("ul",null,ga.map(((e,t)=>(0,s.createElement)("li",{key:t,className:"flex items-center gap-2"},(0,s.createElement)(u.Icon,{icon:"yes-alt",className:"text-white"}),(0,s.createElement)("span",{className:"text-white font-normal text-base"},e))))),(0,s.createElement)(u.Button,{variant:"link",className:"optml__button flex w-full justify-center font-bold min-h-40 !no-underline !text-white !bg-opaque-black !rounded",href:null!==(l=optimoleDashboardApp?.bf_notices?.sidebar?.cta_link)&&void 0!==l?l:optimoleDashboardApp.upgrade_url,target:"_blank"},optimoleDashboardApp.strings.upgrade.cta))):(0,s.createElement)(u.Button,{variant:"default",className:"bg-white flex font-bold border-0 rounded-lg shadow-md p-8 text-sm justify-center",href:(0,M.addQueryArgs)(optimoleDashboardApp.optimoleHome+"contact/",{contact_name:window.optimoleDashboardApp.user_data.display_name,contact_email:optimoleDashboardApp.user_data.user_email,contact_website:optimoleDashboardApp.home_url}),target:"_blank"},optimoleDashboardApp.strings.premium_support),(0,s.createElement)(ma,{settings:e,setSettings:t,setCanSave:a,setTab:o}),d&&(0,s.createElement)(da,null))},ba=({icon:e=null,value:t,tooltipText:a=""})=>(0,s.createElement)(pa,{text:a},(0,s.createElement)("div",{className:"grid grid-cols-1 text-gray-700 hover:text-info transition-all ease-in-out duration-300"},(0,s.createElement)("input",{value:t,type:"text",disabled:!0,className:"col-start-1 row-start-1 block w-full rounded-md !bg-light-blue py-1.5 !pl-9 pr-3 !text-gray-500 !m-0 text-sm !py-0.5 !border-0"}),(0,s.createElement)("span",{className:"pointer-events-none col-start-1 row-start-1 flex items-center ml-3 w-4 h-4 self-center"},e))),ha=()=>{const{urgency:e,title:t,subtitle:a,cta_link:l,cta_text:n,dismiss_key:r}=optimoleDashboardApp.bf_notices.banner,[i,c]=(0,o.useState)(!0),[d,p]=(0,o.useState)(!0);(0,o.useEffect)((()=>{if(!i){const e=setTimeout((()=>{p(!1)}),300);return()=>clearTimeout(e)}}),[i]);const g=m()("relative flex flex-col items-center text-center xl:flex-row gap-5 justify-between xl:items-center bg-black text-white p-5 py-4 pr-7 box-border rounded-lg mt-5 bg-no-repeat transition-all duration-300",{"opacity-0":!i,"opacity-100":i});return d?(0,s.createElement)("div",{className:g,style:{backgroundImage:`url(${optimoleDashboardApp.assets_url}/img/bf-bg.jpg)`,backgroundPosition:"right 0",backgroundSize:"auto 100%"}},(0,s.createElement)(u.Button,{icon:St,onClick:()=>{ke(r,(()=>{c(!1)}))},label:optimoleDashboardApp.strings.csat.close,className:"absolute right-1 top-1 cursor-pointer text-white hover:text-promo-orange"}),(0,s.createElement)("div",{className:"flex flex-col gap-3 xl:items-start items-center"},(0,s.createElement)("div",{className:"text-sm lg:text-base border-b border-0 border-dashed uppercase pb-1 font-semibold"},e),(0,s.createElement)("div",{className:"text-4xl lg:text-5xl italic uppercase font-extrabold",dangerouslySetInnerHTML:{__html:t}}),(0,s.createElement)("div",{className:"text-sm lg:text-base font-extrabold",dangerouslySetInnerHTML:{__html:a}})),(0,s.createElement)("a",{href:l,target:"_blank",className:"bg-promo-orange text-white px-7 py-3 uppercase text-base font-bold grow flex justify-center max-w-[150px] text-center cursor-pointer hover:bg-white hover:text-orange-400 transition-colors"},n)):null},_a=({tab:e,setTab:t})=>{const{isConnected:a,hasApplication:l,hasConflicts:n,siteSettings:r,extraVisits:i,plan:d}=(0,c.useSelect)((e=>{const{isConnected:t,hasApplication:a,getConflicts:s,getSiteSettings:o,getUserData:l}=e("optimole"),n=s(),r=o(),i=l();return{plan:i?.plan,isConnected:t(),hasApplication:a(),hasConflicts:0<n.count||0,siteSettings:r,extraVisits:r.banner_frontend}})),{setQueryArgs:m}=(0,c.useDispatch)("optimole"),[p,g]=(0,o.useState)(!1),[u,b]=(0,o.useState)("general"),[h,_]=(0,o.useState)(!1),[f,E]=(0,o.useState)(r);(0,o.useEffect)((()=>{a&&l&&(H(!0),I()({path:optimoleDashboardApp.routes.poll_conflicts,method:"GET",parse:!1}).then((e=>200<=e.status&&300>e.status?e.json():(console.log(`%c Request failed with status ${e.status}`,"color: #E7602A"),Promise.resolve()))).then((e=>{H(!1),e&&W(e.data)})))}),[]),(0,o.useEffect)((()=>{n&&g(!0)}),[n]),(0,o.useEffect)((()=>{E({...f,banner_frontend:i})}),[i]),(0,o.useEffect)((()=>{window.onbeforeunload=h?()=>!0:null}),[h]);const x=Boolean(optimoleDashboardApp?.bf_notices?.banner);return(0,s.createElement)("div",{className:"optml-connected 2xl:max-w-screen-xl max-w-screen px-4 mx-auto"},x&&(0,s.createElement)(ha,null),(0,s.createElement)("div",{className:"flex flex-col xl:flex-row mx-auto gap-5"},(0,s.createElement)("div",{className:"flex flex-col mt-8 xl:mb-5 p-0 transition-all ease-in-out duration-700 relative text-gray-700 grow"},"dashboard"===e&&(0,s.createElement)(tt,null),"conflicts"===e&&p&&(0,s.createElement)(st,null),"settings"===e&&(0,s.createElement)(ea,{tab:u,setTab:b,canSave:h,setCanSave:_,settings:f,setSettings:E}),"help"===e&&(0,s.createElement)(ra,null)),(0,s.createElement)(ua,{settings:f,setSettings:E,setCanSave:_,setTab:t})))},fa=[{label:optimoleDashboardApp.strings.optimole+" "+optimoleDashboardApp.strings.version,href:optimoleDashboardApp.optimoleHome},{label:optimoleDashboardApp.strings.terms_menu,href:optimoleDashboardApp.optimoleHome+"terms/"},{label:optimoleDashboardApp.strings.privacy_menu,href:optimoleDashboardApp.optimoleHome+"privacy-policy/"},{label:optimoleDashboardApp.strings.testdrive_menu,href:optimoleDashboardApp.optimoleHome+"test-drive?url="+optimoleDashboardApp.home_url}],Ea=()=>(0,s.createElement)("footer",{className:"max-w-screen-xl gap-3 md:gap-0 mx-auto my-5 flex justify-between text-base flex-col md:flex-row"},(0,s.createElement)("div",{dangerouslySetInnerHTML:{__html:optimoleDashboardApp.strings.account_needed_subtitle_3}}),(0,s.createElement)("nav",{className:"flex gap-0 sm:gap-3 flex-wrap md:flex-nowrap"},fa.map(((e,t)=>(0,s.createElement)(u.ExternalLink,{key:t,href:e.href,className:"basis-1/2 sm:basis-auto"},e.label))))),xa=window.lodash;function va(){const e=(0,c.useSelect)((e=>e(O.store).getNotices()),[]),{removeNotice:t}=(0,c.useDispatch)(O.store),a=(0,xa.filter)(e,{type:"snackbar"});return(0,s.createElement)(u.SnackbarList,{notices:a,className:"px-2 bottom-4 fixed",onRemove:t})}(0,o.render)((0,s.createElement)((()=>{const e=window.location.hash.replace("#","");let t=["dashboard","settings","help"].includes(e)?e:"dashboard";const[a,l]=(0,o.useState)(t),n=e=>{e.preventDefault(),l("settings")},r=e=>{e.preventDefault(),l("dashboard")},{showDisconnect:i,isConnected:d,hasApplication:m,hasDashboardLoaded:p}=(0,c.useSelect)((e=>{const{showDisconnect:t,isConnected:a,hasApplication:s,hasDashboardLoaded:o}=e("optimole");return{showDisconnect:t(),isConnected:a(),hasApplication:s(),hasDashboardLoaded:o()}}));return(0,o.useEffect)((()=>{d&&(window.location.hash=`#${a}`,z.forEach((e=>{const t=document.querySelector(`a[href="${e.href}"]`);if(!t)return;const a=t.parentNode;if(e.hash&&e.hash===window.location.hash)return t.classList.add("current"),void a.classList.add("current");t.classList.remove("current"),a.classList.remove("current")})))}),[a]),(0,o.useEffect)((()=>{if(!d)return;const e=document.querySelector('a[href*="page=optimole"]'),t=document.querySelector('a[href*="page=optimole#settings"]');return e&&t?(e.addEventListener("click",r),t.addEventListener("click",n),()=>{e&&t&&(e.removeEventListener("click",r),t.removeEventListener("click",n))}):void 0}),[]),(0,s.createElement)("div",{className:"antialiased"},(0,s.createElement)(De,{tab:a,setTab:l}),!(d&&m)&&(0,s.createElement)(s.Fragment,null,(0,s.createElement)(Be,null),(0,s.createElement)(Ea,null)),d&&m&&!p&&(0,s.createElement)(He,null),d&&i&&(0,s.createElement)(Te,null),d&&m&&p&&(0,s.createElement)(_a,{tab:a,setTab:l}),(0,s.createElement)(va,null))}),null),document.getElementById("optimole-app"))},184:(e,t)=>{var a;!function(){"use strict";var s={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var a=arguments[t];if(a){var l=typeof a;if("string"===l||"number"===l)e.push(a);else if(Array.isArray(a)){if(a.length){var n=o.apply(null,a);n&&e.push(n)}}else if("object"===l){if(a.toString!==Object.prototype.toString&&!a.toString.toString().includes("[native code]")){e.push(a.toString());continue}for(var r in a)s.call(a,r)&&a[r]&&e.push(r)}}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(a=function(){return o}.apply(t,[]))||(e.exports=a)}()},864:(e,t,a)=>{(()=>{"use strict";var t={n:e=>{var a=e&&e.__esModule?()=>e.default:()=>e;return t.d(a,{a}),a},d:(e,a)=>{for(var s in a)t.o(a,s)&&!t.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:a[s]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},s={};t.r(s),t.d(s,{default:()=>c});const o=a(196);var l=t.n(o);function n(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,s)}return a}function r(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?n(Object(a),!0).forEach((function(t){i(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):n(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}function i(e,t,a){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var a=e[Symbol.toPrimitive];if(void 0!==a){var s=a.call(e,"string");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}const c=e=>{const{aspectRatio:t="taller",handle:a=null,handleSize:s=40,hover:n=!1,leftImage:i,leftImageAlt:c="",leftImageCss:d={},leftImageLabel:m=null,onSliderPositionChange:p=(()=>{}),rightImage:g,rightImageAlt:u="",rightImageCss:b={},rightImageLabel:h=null,skeleton:_=null,sliderLineColor:f="#ffffff",sliderLineWidth:E=2,sliderPositionPercentage:x=.5,vertical:v=!1}=e,y=!v,[w,A]=(0,o.useState)(x),[N,S]=(0,o.useState)(0),[L,C]=(0,o.useState)(0),[k,D]=(0,o.useState)(!1),[T,I]=(0,o.useState)(!1),[M,O]=(0,o.useState)(!1),z=(0,o.useRef)(null),B=(0,o.useRef)(null),j=(0,o.useRef)(null);(0,o.useEffect)((()=>{const e=z.current,t=new ResizeObserver((e=>{let[t,...a]=e;const s=t.target.getBoundingClientRect().width;S(s)}));return t.observe(e),()=>t.disconnect()}),[]),(0,o.useEffect)((()=>(j.current.complete&&D(!0),()=>{D(!1)})),[i]),(0,o.useEffect)((()=>(B.current.complete&&I(!0),()=>{I(!1)})),[g]);const R=T&&k;(0,o.useEffect)((()=>{const e=e=>{const t=e||window.event,a=t.touches?t.touches[0].pageX:t.pageX,s=t.touches?t.touches[0].pageY:t.pageY,o=a-window.pageXOffset,l=s-window.pageYOffset,n=B.current.getBoundingClientRect();let r=y?o-n.left:l-n.top;const i=0+E/2,c=y?N-E/2:L-E/2;r<i&&(r=i),r>c&&(r=c),A(y?r/N:r/L),p&&p(y?r/N:r/L)},a=t=>{O(!0),"touches"in t||t.preventDefault(),e(t),window.addEventListener("mousemove",e),window.addEventListener("touchmove",e)},s=()=>{O(!1),window.removeEventListener("mousemove",e),window.removeEventListener("touchmove",e)},o=z.current;if(R){o.addEventListener("touchstart",a),window.addEventListener("touchend",s),n?(o.addEventListener("mousemove",e),o.addEventListener("mouseleave",s)):(o.addEventListener("mousedown",a),window.addEventListener("mouseup",s));const l=j.current.naturalHeight/j.current.naturalWidth,r=B.current.naturalHeight/B.current.naturalWidth,i="taller"===t?Math.max(l,r):Math.min(l,r);C(N*i)}return()=>{o.removeEventListener("touchstart",a),window.removeEventListener("touchend",s),o.removeEventListener("mousemove",e),o.removeEventListener("mouseleave",s),o.removeEventListener("mousedown",a),window.removeEventListener("mouseup",s),window.removeEventListener("mousemove",e),window.removeEventListener("touchmove",e)}}),[R,t,L,N,y,n,E,v]);const H={container:{boxSizing:"border-box",position:"relative",width:"100%",height:`${L}px`,overflow:"hidden"},rightImage:r({clip:y?`rect(auto, auto, auto, ${N*w}px)`:`rect(${L*w}px, auto, auto, auto)`,display:"block",height:"100%",objectFit:"cover",position:"absolute",width:"100%"},b),leftImage:r({clip:y?`rect(auto, ${N*w}px, auto, auto)`:`rect(auto, auto, ${L*w}px, auto)`,display:"block",height:"100%",objectFit:"cover",position:"absolute",width:"100%"},d),slider:{alignItems:"center",cursor:!n&&y?"ew-resize":!n&&!y&&"ns-resize",display:"flex",flexDirection:y?"column":"row",height:y?"100%":`${s}px`,justifyContent:"center",left:y?N*w-s/2+"px":0,position:"absolute",top:y?0:L*w-s/2+"px",width:y?`${s}px`:"100%"},line:{background:f,boxShadow:"0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12)",flex:"0 1 auto",height:y?"100%":`${E}px`,width:y?`${E}px`:"100%"},handleCustom:{alignItems:"center",boxSizing:"border-box",display:"flex",flex:"1 0 auto",height:"auto",justifyContent:"center",width:"auto"},handleDefault:{alignItems:"center",border:`${E}px solid ${f}`,borderRadius:"100%",boxShadow:"0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12)",boxSizing:"border-box",display:"flex",flex:"1 0 auto",height:`${s}px`,justifyContent:"center",width:`${s}px`,transform:y?"none":"rotate(90deg)"},leftArrow:{border:`inset ${.15*s}px rgba(0,0,0,0)`,borderRight:`${.15*s}px solid ${f}`,height:"0px",marginLeft:`-${.25*s}px`,marginRight:.25*s+"px",width:"0px"},rightArrow:{border:`inset ${.15*s}px rgba(0,0,0,0)`,borderLeft:`${.15*s}px solid ${f}`,height:"0px",marginRight:`-${.25*s}px`,width:"0px"},leftLabel:{background:"rgba(0, 0, 0, 0.5)",color:"white",left:y?"5%":"50%",opacity:M?0:1,padding:"10px 20px",position:"absolute",top:y?"50%":"3%",transform:y?"translate(0,-50%)":"translate(-50%, 0)",transition:"opacity 0.1s ease-out"},rightLabel:{background:"rgba(0, 0, 0, 0.5)",color:"white",opacity:M?0:1,padding:"10px 20px",position:"absolute",left:y?null:"50%",right:y?"5%":null,top:y?"50%":null,bottom:y?null:"3%",transform:y?"translate(0,-50%)":"translate(-50%, 0)",transition:"opacity 0.1s ease-out"},leftLabelContainer:{clip:y?`rect(auto, ${N*w}px, auto, auto)`:`rect(auto, auto, ${L*w}px, auto)`,height:"100%",position:"absolute",width:"100%"},rightLabelContainer:{clip:y?`rect(auto, auto, auto, ${N*w}px)`:`rect(${L*w}px, auto, auto, auto)`,height:"100%",position:"absolute",width:"100%"}};return l().createElement(l().Fragment,null,_&&!R&&l().createElement("div",{style:r({},H.container)},_),l().createElement("div",{style:r(r({},H.container),{},{display:R?"block":"none"}),ref:z,"data-testid":"container"},l().createElement("img",{onLoad:()=>I(!0),alt:u,"data-testid":"right-image",ref:B,src:g,style:H.rightImage}),l().createElement("img",{onLoad:()=>D(!0),alt:c,"data-testid":"left-image",ref:j,src:i,style:H.leftImage}),l().createElement("div",{style:H.slider},l().createElement("div",{style:H.line}),a?l().createElement("div",{style:H.handleCustom},a):l().createElement("div",{style:H.handleDefault},l().createElement("div",{style:H.leftArrow}),l().createElement("div",{style:H.rightArrow})),l().createElement("div",{style:H.line})),m&&l().createElement("div",{style:H.leftLabelContainer},l().createElement("div",{style:H.leftLabel},m)),h&&l().createElement("div",{style:H.rightLabelContainer},l().createElement("div",{style:H.rightLabel},h))))};e.exports=s})()},196:e=>{"use strict";e.exports=window.React}},a={};function s(e){var o=a[e];if(void 0!==o)return o.exports;var l=a[e]={exports:{}};return t[e](l,l.exports,s),l.exports}s.m=t,e=[],s.O=(t,a,o,l)=>{if(!a){var n=1/0;for(d=0;d<e.length;d++){for(var[a,o,l]=e[d],r=!0,i=0;i<a.length;i++)(!1&l||n>=l)&&Object.keys(s.O).every((e=>s.O[e](a[i])))?a.splice(i--,1):(r=!1,l<n&&(n=l));if(r){e.splice(d--,1);var c=o();void 0!==c&&(t=c)}}return t}l=l||0;for(var d=e.length;d>0&&e[d-1][2]>l;d--)e[d]=e[d-1];e[d]=[a,o,l]},s.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},s.d=(e,t)=>{for(var a in t)s.o(t,a)&&!s.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={826:0,431:0};s.O.j=t=>0===e[t];var t=(t,a)=>{var o,l,[n,r,i]=a,c=0;if(n.some((t=>0!==e[t]))){for(o in r)s.o(r,o)&&(s.m[o]=r[o]);if(i)var d=i(s)}for(t&&t(a);c<n.length;c++)l=n[c],s.o(e,l)&&e[l]&&e[l][0](),e[l]=0;return s.O(d)},a=globalThis.webpackChunkoptimole_wp=globalThis.webpackChunkoptimole_wp||[];a.forEach(t.bind(null,0)),a.push=t.bind(null,a.push.bind(a))})();var o=s.O(void 0,[431],(()=>s(408)));o=s.O(o)})(); |