import{d as e,l as t,o as n,s as r}from"./fillPublishForm-SvRJN5-l.js";var i={publish_now:`立即发布`,draft:`放入草稿箱`,pending:`放入待发布`};function a(){for(let e of document.querySelectorAll(`.el-form-item__label`))if(e.textContent?.trim()===`发布时间`)return e.closest(`.el-form-item`);return null}function o(e){let t=a();if(!t)return null;for(let n of t.querySelectorAll(`label.el-radio`))if((n.querySelector(`.el-radio__label`)?.textContent?.replace(/\s+/g,``)??``).includes(e.replace(/\s+/g,``)))return n;return null}function s(){let e=document.querySelector(`.save-box`);if(!e)return null;let t=e.querySelector(`.submit-btn button.el-button--primary`);return t instanceof HTMLButtonElement?t:null}function c(e){let t=e.querySelector(`.el-icon-loading`);return t?window.getComputedStyle(t).display!==`none`:!1}async function l(e,t=2e4){let r=Date.now();for(;Date.now()-r<800&&!c(e);)await new Promise(e=>setTimeout(e,80));let i=Date.now()+t;for(;Date.now()<i;){if(!c(e)){await n();return}await new Promise(e=>setTimeout(e,120))}}async function u(a){if(a===`none`)return{ok:!0};await r();let c=i[a],u=await t(()=>o(c),8e3);if(!u)return{ok:!1,error:`未找到「${c}」选项`};await e(u),await n();let d=await t(()=>s(),8e3);if(!(d instanceof HTMLButtonElement))return{ok:!1,error:`未找到「确定」按钮`};let f=d;return f.disabled?{ok:!1,error:`「确定」按钮不可用，请检查表单必填项`}:(await e(f),await l(f),{ok:!0})}export{u as submitXianguanjiaPublishForm};