@panphora/clayjs 1.20.0 → 1.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/all.js +1 -1
- package/dist/clay-dom.js +1 -1
- package/dist/clay-events.js +1 -1
- package/dist/clay-internals.js +1 -1
- package/dist/clay-options.js +1 -1
- package/dist/clay-router.js +1 -1
- package/dist/clay-ui.js +1 -1
- package/dist/clay-utils.js +1 -1
- package/dist/clay.js +1 -1
- package/dist/clay.standalone.js +7865 -8022
- package/dist/m/{c-JOH753EJ.js → c-26KVJS6J.js} +1 -1
- package/dist/m/{c-ZE46QDIH.js → c-3TLG3OLG.js} +1 -1
- package/dist/m/{c-RT3C74GY.js → c-4OGEVKR3.js} +1 -1
- package/dist/m/{c-Y33LUUIQ.js → c-4PHDUV3H.js} +1 -1
- package/dist/m/{c-SJPD46ZO.js → c-4RFZROCF.js} +4 -4
- package/dist/m/{c-XQSXKIKM.js → c-4TWARTLS.js} +1 -1
- package/dist/m/{c-S5IEIZCN.js → c-5AQYL27I.js} +1 -1
- package/dist/m/{c-OJYM642Q.js → c-5FKRZNJV.js} +1 -1
- package/dist/m/{c-CJFDLD43.js → c-6KBKYLPO.js} +1 -1
- package/dist/m/{c-DHXPDLW6.js → c-6PBXRWDX.js} +1 -1
- package/dist/m/{c-BRLCTNMC.js → c-6RC66MYY.js} +1 -1
- package/dist/m/{c-PIVIYLTY.js → c-6UEFPHHE.js} +1 -1
- package/dist/m/{c-YQUJ74R3.js → c-BV6FQQXM.js} +1 -1
- package/dist/m/{c-YSB6JKV2.js → c-DEAFCHDO.js} +2 -2
- package/dist/m/{c-NLZ5AN4L.js → c-DKFSOJCV.js} +1 -1
- package/dist/m/c-DP4X4JID.js +1 -0
- package/dist/m/{c-LIBE4HPD.js → c-DZBZ57EE.js} +1 -1
- package/dist/m/c-ECY5AZMH.js +1 -0
- package/dist/m/{c-VAK7SG37.js → c-EUGJVHDD.js} +1 -1
- package/dist/m/{c-GPGYKER7.js → c-F5AER2ID.js} +1 -1
- package/dist/m/{c-RG6XUZFA.js → c-FAXQU7MQ.js} +1 -1
- package/dist/m/{c-XD5MOROJ.js → c-FLBUYV3P.js} +1 -1
- package/dist/m/{c-NFR673TL.js → c-FMCPQ4VT.js} +2 -2
- package/dist/m/{c-VBLFAQD2.js → c-FNIGX4FI.js} +1 -1
- package/dist/m/{c-BTLFLLML.js → c-FWFJUU3T.js} +1 -1
- package/dist/m/{c-2VB555FG.js → c-GPTKI7AQ.js} +1 -1
- package/dist/m/{c-EZ7B5AZT.js → c-GY4ODHO2.js} +1 -1
- package/dist/m/{c-5734MF2P.js → c-H6DXQEH2.js} +1 -1
- package/dist/m/{c-Z32V4MHK.js → c-HAVGDXAL.js} +1 -1
- package/dist/m/{c-D3E4WJ4M.js → c-HDWZEJHM.js} +49 -32
- package/dist/m/{c-W23KVGUO.js → c-HWR6GMGK.js} +1 -1
- package/dist/m/{c-BJ7YQ5QZ.js → c-IHUWUKIU.js} +1 -1
- package/dist/m/{c-AL4RBJF2.js → c-ILGQ3UXQ.js} +1 -1
- package/dist/m/{c-W3K23S72.js → c-IWTTOC2V.js} +1 -1
- package/dist/m/c-JFST6QE7.js +1 -0
- package/dist/m/{c-FNVQAACK.js → c-KE33W4RE.js} +1 -1
- package/dist/m/c-KV7R47FR.js +1 -0
- package/dist/m/{c-LPUJXRXW.js → c-L7K5EXU2.js} +1 -1
- package/dist/m/{c-3YH6JSIL.js → c-LF6HNVPU.js} +1 -1
- package/dist/m/{c-MIL4B2JQ.js → c-MRURHLKV.js} +1 -1
- package/dist/m/{c-LQU7TXIH.js → c-N33TPVTL.js} +1 -1
- package/dist/m/{c-EOCZ2YVL.js → c-NBNRLZXO.js} +1 -1
- package/dist/m/{c-JUE7B4OX.js → c-NLWEZYKJ.js} +1 -1
- package/dist/m/{c-DDDOKPI6.js → c-NNNR7OXA.js} +1 -1
- package/dist/m/{c-E4IBSAQM.js → c-OI2BYWVV.js} +1 -1
- package/dist/m/{c-SBSMJIPC.js → c-P3WATEDR.js} +1 -1
- package/dist/m/{c-ZJLU56DV.js → c-PCEMXY2K.js} +1 -1
- package/dist/m/{c-3GJ4XARY.js → c-PWBJVHA4.js} +1 -1
- package/dist/m/{c-67ILSNPR.js → c-Q5KAQJAG.js} +1 -1
- package/dist/m/{c-U5X57T4L.js → c-QHVCUTJV.js} +1 -1
- package/dist/m/{c-GKEATME6.js → c-QJFYVCJO.js} +1 -1
- package/dist/m/{c-VY6XRBOW.js → c-QTC6VGA4.js} +1 -1
- package/dist/m/{c-44B5ODN7.js → c-TMT5TL65.js} +2 -2
- package/dist/m/{c-OABVRYOT.js → c-TV7JHSRL.js} +1 -1
- package/dist/m/{c-SO63UGPQ.js → c-UWT4CXQ4.js} +1 -1
- package/dist/m/{c-EFD6QNTE.js → c-VFES2BP5.js} +1 -1
- package/dist/m/{c-UXEVJ63W.js → c-VIW5X35H.js} +1 -1
- package/dist/m/{c-EOCKLMKX.js → c-WWE67K5Y.js} +1 -1
- package/dist/m/{c-J3BXFTZS.js → c-XDVAZDUE.js} +1 -1
- package/dist/m/{c-K76AUL4I.js → c-XZJ5IK6Q.js} +1 -1
- package/dist/m/{c-2ZZBC45O.js → c-Z7RJANGO.js} +1 -1
- package/dist/m/{c-I2IFKJX2.js → c-ZAHTFCXQ.js} +1 -1
- package/dist/m/{c-GVPNDIKJ.js → c-ZKELCT4T.js} +1 -1
- package/dist/m/{c-7SXYQCN4.js → c-ZO6VL2SC.js} +1 -1
- package/dist/m/{c-M4FSPNQ2.js → c-ZYEJLZEY.js} +1 -1
- package/dist/m/core/{autosave-VPORYJSE.js → autosave-GI3WNJYN.js} +1 -1
- package/dist/m/core/{conflict-notice-JMAZLVRX.js → conflict-notice-CEI3XY6A.js} +1 -1
- package/dist/m/core/{save-AOJBDSOK.js → save-OJ5NSLS7.js} +1 -1
- package/dist/m/core/{save-core-IOCMXO5L.js → save-core-DX3RFVO3.js} +1 -1
- package/dist/m/core/{unsaved-warning-U5VUJFOE.js → unsaved-warning-HGYH7O4H.js} +1 -1
- package/dist/m/internals/{index-HDRANDWE.js → index-V4WC44FU.js} +1 -1
- package/dist/m/loader-V6VI46HU.js +1 -0
- package/dist/m/{manifest-3AEF5191.js → manifest-83C18DED.js} +1 -1
- package/dist/m/{manifest-edit-29A26F22.js → manifest-edit-B28C1985.js} +1 -1
- package/dist/m/manifest.json +567 -567
- package/dist/m/page/{editor-EY2WAAGB.js → editor-BQEPCJLG.js} +2 -2
- package/dist/m/plugins/ai-edit-45A2J6LC.js +6 -0
- package/dist/m/plugins/cms-IFTKWF4S.js +2235 -0
- package/dist/m/plugins/{derive-FRE5JJQE.js → derive-QVI3LI3A.js} +1 -1
- package/dist/m/plugins/{indicator-4VDXWYTD.js → indicator-IPZJ35K6.js} +1 -1
- package/dist/m/plugins/{live-5EZN2EYP.js → live-GPQXSXSM.js} +1 -1
- package/dist/m/plugins/menu-UN3KRCOF.js +1 -0
- package/dist/m/plugins/{page-LVW5DWA4.js → page-BAVLWCP6.js} +2 -2
- package/dist/m/plugins/{page-view-5KQ76IJB.js → page-view-P3UGJFDZ.js} +1 -1
- package/dist/m/plugins/{people-C7TVBBMR.js → people-Z4RGVQAV.js} +1 -1
- package/dist/m/plugins/{quickcrop-BQ5YYFCH.js → quickcrop-E34PUYA3.js} +2 -2
- package/dist/m/plugins/{richclay-KLGETK77.js → richclay-S4NVJYIK.js} +2 -2
- package/dist/m/plugins/{source-CCEUM3OR.js → source-KVN6YNTY.js} +1 -1
- package/dist/m/plugins/{upgrade-NW556WJD.js → upgrade-KTSICB22.js} +1 -1
- package/dist/m/plugins/{wire-VRYPY6EJ.js → wire-SYVIBNSE.js} +1 -1
- package/dist/m/{reader-core-2GXY7SHY.js → reader-core-RUIFH32Y.js} +2 -2
- package/dist/m/sync/{live-sync-SKPMFYOO.js → live-sync-RGQMMWK2.js} +1 -1
- package/dist/m/ui/{index-QNIPDHXQ.js → index-EZGLEM5P.js} +1 -1
- package/dist/m/vendor/{sap-core.vendor-RN4ZVY4X.js → sap-core.vendor-OA5SKL7Q.js} +1 -1
- package/dist/offline-manifest.json +463 -469
- package/docs/guide.md +16 -8
- package/entries/sap.js +1 -1
- package/package.json +2 -2
- package/src/loader-logic.js +4 -1
- package/src/plugins/ai-edit.js +6 -17
- package/src/plugins/cms.js +3 -6
- package/src/plugins/menu/style.js +59 -31
- package/src/plugins/menu.js +131 -28
- package/src/ui/bevel.js +1 -1
- package/src/ui/skins/cms.js +1 -1
- package/src/ui/skins/quickcrop.js +1 -1
- package/src/ui/skins/richclay.js +1 -1
- package/src/vendor/hypercms.vendor.js +16 -69
- package/src/vendor/sap-core.vendor.js +1 -1
- package/dist/m/c-FSWRGBVQ.js +0 -1
- package/dist/m/c-HMYWIHFG.js +0 -1
- package/dist/m/c-M6FNQCTQ.js +0 -1
- package/dist/m/c-WFMRX5RZ.js +0 -1
- package/dist/m/loader-DZZLUBVB.js +0 -1
- package/dist/m/plugins/ai-edit-J5VLSW5I.js +0 -6
- package/dist/m/plugins/cms-LRAOZHT7.js +0 -2293
- package/dist/m/plugins/menu-KGWKT6CS.js +0 -1
- package/src/ui/skins/cms-toggle.js +0 -15
- /package/dist/m/plugins/{quickcrop-BQ5YYFCH.js.LEGAL.txt → quickcrop-E34PUYA3.js.LEGAL.txt} +0 -0
- /package/dist/m/plugins/{richclay-KLGETK77.js.LEGAL.txt → richclay-S4NVJYIK.js.LEGAL.txt} +0 -0
|
@@ -5,5 +5,5 @@ var SapCoreBundle=(()=>{var At=Object.defineProperty;var rn=Object.getOwnPropert
|
|
|
5
5
|
`)),s}error(e,r,n={}){let o=this.block(e,r,n);return this.errors.push(o),o}warn(e,r,n={}){let o=this.block(e,r,n);return this.warnings.push(o),o}report(){return{ok:this.errors.length===0&&!this.halted,app:this.appName,halted:this.halted,haltReason:this.haltReason,errors:this.errors.slice(),warnings:this.warnings.slice()}}};function B(t,e){t&&t.getAttribute("sap-error")!==e&&t.setAttribute("sap-error",e)}function zt(t){t&&t.hasAttribute("sap-error")&&t.removeAttribute("sap-error")}function vt(t,e){let r=null,n=3;for(let o of e){let s=fn(t,o);s<n&&(n=s,r=o)}return r}function fn(t,e){let r=t.length,n=e.length,o=Array.from({length:r+1},(s,i)=>[i,...new Array(n).fill(0)]);for(let s=0;s<=n;s++)o[0][s]=s;for(let s=1;s<=r;s++)for(let i=1;i<=n;i++)o[s][i]=Math.min(o[s-1][i]+1,o[s][i-1]+1,o[s-1][i-1]+(t[s-1]===e[i-1]?0:1));return o[r][n]}var dn=new Set(z),pn={readonly:"readOnly",novalidate:"noValidate"},mn=0,Ut=new WeakMap;function qt(t,e="sap"){let r=t.getAttribute("data-id");if(r)return r;if(t.id)return t.id;let n=Ut.get(t);return n||(n=`${e}-${(mn++).toString(36)}`,Ut.set(t,n)),n}function Vt(t){let e=[];for(let r=t.firstElementChild;r;r=r.nextElementSibling)r.hasAttribute("item")&&!r.hasAttribute("template")&&!r.hasAttribute("cms-template")&&e.push(r);return e}function St(t,e){if(!t||!e)return null;let r=[...t.querySelectorAll(`template[items="${e}"]`)].find(o=>o.closest("[sap]")===t),n=r&&r.content.firstElementChild;return n&&n.hasAttribute("item")?n:null}function Yt(t){for(let e=t.firstElementChild;e;e=e.nextElementSibling)if(e.hasAttribute("item")&&e.hasAttribute("template"))return e;return St(t.closest("[sap]"),t.getAttribute("items"))}function it(t){let e=[];if(!t)return e;for(let r of t.trim().split(/\s+/)){if(!r)continue;let n=r,o,s=n.indexOf("=");s>=0&&(o=n.slice(s+1),n=n.slice(0,s));let i=n.split(":"),f=i[0],c="string",l=!1;for(let p of i.slice(1))p==="num"?c="num":p==="bool"?c="bool":p==="presence"?c="presence":p==="transient"&&(l=!0);let a=f,d=a.startsWith("data-")&&a.length>5?a.slice(5).replace(/-([a-z])/g,(p,v)=>v.toUpperCase()):a;e.push({name:d,attr:a,type:c,default:o,transient:l})}return e}function st(t,e){if(e==="num"){if(t==null||t==="")return 0;let r=Number(t);return Number.isNaN(r)?0:r}return e==="bool"?t==="true"||t===""||t==="1":t??""}function Gt(t,e){return e==="bool"?t?"true":"false":t==null?"":String(t)}function kt(t,e){return dn.has(e)&&typeof t[pn[e]||e]=="boolean"}function Nt(t,e){return e.type==="presence"||e.type!=="num"&&kt(t,e.attr||e.name)}function Tt(t){return t.default!=null?t.default:t.type==="num"?"0":t.type==="bool"?"false":""}function Xt(t,e){let r=e.attr||e.name,n=t._sapTransient||(t._sapTransient={});if(!(e.name in n)){let o=t.getAttribute(r);o==null&&(o=Tt(e)),n[e.name]=st(o,e.type)}return t.hasAttribute(r)&&t.removeAttribute(r),n[e.name]}function P(t){if(typeof t=="number")return t;if(t==null||t==="")return 0;let e=Number(typeof t=="string"?t.replace(/[$,%\s]/g,""):t);return Number.isNaN(e)?0:e}function at(t,e){return Array.isArray(t)?e==null?t:t.map(r=>typeof e=="function"?e(r):r?.[e]):[]}function Rt(t,e){return at(t,e).reduce((r,n)=>r+P(n),0)}function Kt(t,e){return Array.isArray(t)?e==null?t.length:t.reduce((r,n)=>r+(e(n)?1:0),0):0}function Jt(t,e){let r=at(t,e);return r.length?Rt(t,e)/r.length:0}function Qt(t,e){let r=at(t,e).filter(n=>n!=null&&n!=="");return r.length?r.every(n=>typeof n=="number"||!Number.isNaN(Number(n)))?Math.min(...r.map(Number)):r.reduce((n,o)=>String(n)<=String(o)?n:o):0}function Zt(t,e){let r=at(t,e).filter(n=>n!=null&&n!=="");return r.length?r.every(n=>typeof n=="number"||!Number.isNaN(Number(n)))?Math.max(...r.map(Number)):r.reduce((n,o)=>String(n)>=String(o)?n:o):0}function te(t,e,r){let n=P(t)===1?e:r??e+"s";return`${t} ${n}`}function ee(t,e){let r=new Date(t),n=new Date(e);return Number.isNaN(+r)||Number.isNaN(+n)?0:Math.round((n-r)/864e5)}function O(t){return typeof t=="number"?t:Number(t)}var U={usd:t=>"$"+O(t).toLocaleString("en-US",{maximumFractionDigits:0}),usd2:t=>"$"+O(t).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}),pct:t=>Math.round(O(t))+"%",pct1:t=>O(t).toFixed(1)+"%",int:t=>Math.round(O(t)).toLocaleString("en-US"),num:t=>O(t).toLocaleString("en-US"),num2:t=>O(t).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}),compact:t=>O(t).toLocaleString("en-US",{notation:"compact"}),date:t=>{let e=new Date(t);return Number.isNaN(+e)?String(t):e.toLocaleDateString("en-US")},clock:t=>{let e=O(t),r=Math.floor(e/100),n=r%10,o=Math.floor(r/10)%60;return`${Math.floor(r/600)}:${String(o).padStart(2,"0")}.${n}`}},hn=new Set(["usd","usd2","pct","pct1","int","num","num2","compact","clock"]);function ne(t,e){if(!t)return e==null?"":String(e);let r=U[t];if(typeof r!="function"){let n=new Error(`unknown format "${t}"`);throw n.sapCode="E22",n}if(hn.has(t)){let n=typeof e=="number"?e:Number(e);if(!Number.isFinite(n)){let o=new Error(`format "${t}" received ${typeof e=="string"?`"${e}"`:e}`);throw o.sapCode="E22",o}}return r(e)}var bn=["state","item","el","root","fmt","num","sum","count","avg","min","max","plural","days"],ut=new Map,re=/\bstate\.([a-z][a-z0-9_]*)/g,oe=/\bitem\.([a-z][a-z0-9_]*)/g;function gn(t){let e=new Set,r=new Set,n;for(re.lastIndex=0;n=re.exec(t);)e.add(n[1]);for(oe.lastIndex=0;n=oe.exec(t);)r.add(n[1]);return{state:e,item:r}}function M(t,e=!1){let r=(e?"!":"")+t,n=ut.get(r);if(n)return n;ut.size>512&&ut.clear();try{let o=e?`"use strict";
|
|
6
6
|
${t}`:`"use strict"; return (${t});`;n={fn:new Function(...bn,o),src:t,statement:e,deps:gn(t),error:null}}catch(o){n={fn:null,src:t,statement:e,deps:{state:new Set,item:new Set},error:o}}return ut.set(r,n),n}function ie(t,e,r,n,o){if(t.error)throw t.error;return t.fn(e,r,n,o,U,P,Rt,Kt,Jt,Qt,Zt,te,ee)}var J={},K=null,ae=!0,lt=!1;function ue(){J={}}function ce(t){let e=lt;return K?fe(K.takeRecords()):ae&&yn(),lt=!!K&&t.getRootNode()===document,e}function le(t){lt=t}function yn(){if(typeof document>"u"||typeof MutationObserver!="function"){ae=!1;return}K=new MutationObserver(fe),K.observe(document,{attributes:!0,childList:!0,subtree:!0})}function fe(t){for(let e of t)if(e.type==="attributes")e.target._sapPlan&&(e.target._sapPlan=null);else for(let r of e.addedNodes)r.nodeType===1&&de(r)}function de(t){t._sapPlan&&(t._sapPlan=null);for(let e=t.firstElementChild;e;e=e.nextElementSibling)de(e)}function ft(t){if(!lt)return se(t);let e=t._sapPlan;return e&&e.gen===J?e:t._sapPlan=se(t)}function se(t){let e={gen:J,inert:t.tagName==="TEMPLATE",template:!1,cms:!1,item:!1,scope:!1,items:!1,detail:!1,each:!1,boundary:null,bind:null,transient:!1,decls:null,calcs:null,paints:null,effects:null,invalids:null};for(let r of t.attributes){let n=r.name,o=r.value,s=n.indexOf(":");if(s<0){switch(n){case"sap-ignore":e.inert=!0;break;case"cms-template":e.inert=!0,e.cms=!0;break;case"template":e.inert=!0,e.template=!0;break;case"item":e.item=!0;break;case"scope":e.scope=!0;break;case"items":e.items=!0;break;case"detail":e.detail=!0;break;case"each":e.each=!0;break;case"bind":e.bind=o;break;case"transient":e.transient=!0;break;case"state":e.decls=it(o);break;case"text":(e.paints||(e.paints=[])).push({kind:"text",fmt:null,entry:M(o)});break;case"show":(e.paints||(e.paints=[])).push({kind:"show",entry:M(o)});break;case"effect":(e.effects||(e.effects=[])).push({entry:M(o,!0)});break;case"invalid":(e.invalids||(e.invalids=[])).push({entry:M(o)});break}continue}let i=n.slice(0,s),f=n.slice(s+1);switch(i){case"calc":(e.calcs||(e.calcs=[])).push({name:f,entry:M(o)});break;case"text":(e.paints||(e.paints=[])).push({kind:"text",fmt:f,entry:M(o)});break;case"attr":(e.paints||(e.paints=[])).push({kind:"attr",arg:f,entry:M(o)});break;case"class":(e.paints||(e.paints=[])).push({kind:"class",arg:f,entry:M(o)});break;case"css":(e.paints||(e.paints=[])).push({kind:"css",arg:f,entry:M(o)});break;case"show-when":case"option":(e.paints||(e.paints=[])).push({kind:"when",match:"show",field:f,values:o.split("|")});break;case"hide-when":(e.paints||(e.paints=[])).push({kind:"when",match:"hide",field:f,values:o.split("|")});break;case"option-not":(e.paints||(e.paints=[])).push({kind:"when",match:"show-not",field:f,values:o.split("|")});break}}return e.boundary=e.scope?"scope":e.items?"items":e.detail?"detail":e.each?"each":null,An(e)?wn():e}var ct=null;function wn(){return(!ct||ct.gen!==J)&&(ct=Object.freeze({gen:J,inert:!1,template:!1,cms:!1,item:!1,scope:!1,items:!1,detail:!1,each:!1,boundary:null,bind:null,transient:!1,decls:null,calcs:null,paints:null,effects:null,invalids:null})),ct}function An(t){return!t.inert&&!t.item&&t.boundary===null&&t.bind===null&&!t.transient&&!t.decls&&!t.calcs&&!t.paints&&!t.effects&&!t.invalids}var F=new WeakMap,j=new WeakMap,q=null,D=!1;function me(){F=new WeakMap,j=new WeakMap}function pe(t){for(let e of t){let r=e.target.nodeType===1?e.target:e.target.parentElement;for(let n=r;n;n=n.parentElement)j.delete(n);if(e.type==="attributes"){F.delete(e.target);continue}for(let n=r;n;n=n.parentElement)F.delete(n);for(let n of e.addedNodes||[])if(n.nodeType===1){F.delete(n),j.delete(n);for(let o of n.querySelectorAll("*"))F.delete(o),j.delete(o)}}}function he(){return D}function be(t){return D?j.get(t):void 0}function ge(t,e){D&&j.set(t,e)}function ye(t){j.delete(t)}function we(t){let e=D;return!q&&typeof MutationObserver=="function"&&(q=new MutationObserver(pe),q.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})),q&&pe(q.takeRecords()),D=!!q&&t.getRootNode()===document,e}function Ae(t){D=t}function Ee(t){let e=F.get(t);return e||F.set(t,e={attrs:new Map,hasText:!1,text:""}),e}function xe(t,e){if(!D)return t.getAttribute(e);let r=Ee(t);return r.attrs.has(e)||r.attrs.set(e,t.getAttribute(e)),r.attrs.get(e)}function ve(t){if(!D)return t.textContent;let e=Ee(t);return e.hasText||(e.text=t.textContent,e.hasText=!0),e.text}function Se(t){return(t.getAttribute("type")||"text").toLowerCase()}function V(t){let e=t.tagName;if(e==="INPUT"){let r=Se(t);r==="checkbox"||r==="radio"?t.checked?t.setAttribute("checked",""):t.removeAttribute("checked"):t.setAttribute("value",t.value);return}if(e==="TEXTAREA"){t.setAttribute("data-value",t.value);return}if(e==="SELECT"){let r=t.options;for(let n=0;n<r.length;n++)r[n].selected?r[n].setAttribute("selected",""):r[n].removeAttribute("selected")}}function ke(t,e=t){let r=t.tagName;if(r==="INPUT"){let n=Se(t);n==="checkbox"||n==="radio"?e.checked?t.hasAttribute("checked")||t.setAttribute("checked",""):t.removeAttribute("checked"):e.value!==(t.getAttribute("value")??"")&&t.setAttribute("value",e.value);return}if(r==="TEXTAREA"){let n=e.value.startsWith(`
|
|
7
7
|
`)?`
|
|
8
|
-
`+e.value:e.value;t.textContent!==n&&(t.textContent=n),t.removeAttribute("data-value");return}if(r==="SELECT"){let n=t.options,o=e.options;for(let s=0;s<n.length;s++)o[s]&&o[s].selected?n[s].hasAttribute("selected")||n[s].setAttribute("selected",""):n[s].removeAttribute("selected")}}function dt(t){t.tagName!=="TEXTAREA"||!t.hasAttribute("data-value")||t!==t.ownerDocument.activeElement&&(t.textContent=t.getAttribute("data-value"),t.removeAttribute("data-value"))}function T(t){if(typeof window>"u")return null;let e=window.clay,r=window.hyperclay;return t==="consent"?e?.confirm||r?.consent||null:e?.[t]||r?.[t]||null}function Ne(){let t=T("visitorDrafts");return!!(t&&typeof t.restored=="function"&&t.restored()?.restored)}var Lt=["clay:mutation-ready","hyperclay:mutation-ready"],En=["clay:sync-applied","hyperclay:livesync-applied"],xn=["clay:ready","hyperclay:ready"],vn=["clay:route"],Sn=["clay:modechange"];function Q(t,e,r){let n=null,o=s=>{n!==null&&n!==s.type||(n=s.type,queueMicrotask(()=>{n=null}),r(s))};for(let s of e)t.addEventListener(s,o);return()=>{for(let s of e)t.removeEventListener(s,o)}}function Te(t){let e=typeof window<"u"&&window.clay&&window.clay.ready;e&&typeof e.then=="function"?e.then(()=>t(),()=>t()):t()}function pt(t){let e=T("region");return!e||typeof e.resolveRegionPolicy!="function"||typeof e.skipForPolicy!="function"?!1:e.skipForPolicy(e.resolveRegionPolicy(t),void 0,["no-save","freeze"])}function Re(){return typeof window>"u"?null:window.clay?.modeLifecycle||null}function mt(t,{transient:e=!1}={}){if(e)return!0;let r=Re();return typeof r?.canWrite!="function"||T("region")?.resolveRegionPolicy?.(t)?.persist==="none"?!0:r.canWrite()}function Le(t,e){if(typeof e!="function")throw new Error("Sap.batch(label, fn): fn must be a function");let r=T("undo");r&&r.flush&&r.flush();let n=e();if(n&&typeof n.then=="function")throw new Error("Sap.batch fn must be synchronous (it returned a promise)");return r&&r.commitCaptured&&r.commitCaptured(t),n}function _e(t){if(typeof window>"u"||typeof document>"u")return;let e=()=>{let p=!1;for(let v of t.apps())v.root.isConnected?t.runNow(v,"platform"):p=!0;p&&t.pruneDisconnected(),t.remountIfPresent()},r=T("derived"),n=r&&typeof r.register=="function"?r.register(e):null,o=typeof n=="function"?null:Q(document,En,e),s=Q(document,vn,e),i=null,f=!1,c=()=>{let p=i;i=null,p&&(p[2](),p[3]())},l=()=>{if(f)return!1;let p=T("undo"),v=Re()?.state?.generation;if(i&&i[0]===p&&i[1]===v)return!0;if(c(),!p||typeof p.on!="function")return!1;let R=p.on("undo",e);if(typeof R!="function")return!1;let _=p.on("redo",e);return typeof _!="function"?(R(),!1):(i=[p,v,R,_],!0)};l();let a=[Lt,xn,Sn].map(p=>Q(document,p,l)),d=T("ready");return d&&typeof d.then=="function"&&d.then(l,()=>{}),()=>{f=!0,typeof n=="function"&&n(),o&&o(),s();for(let p of a)p();c()}}function _t(t){let e=t.tagName;if(e==="INPUT"){let r=(t.getAttribute("type")||"text").toLowerCase();return r==="checkbox"?"checkbox":r==="radio"?"radio":r==="number"||r==="range"?"number":r==="hidden"?"hidden":"text"}return e==="TEXTAREA"?"text":e==="SELECT"?t.multiple?"select-multiple":"select-one":"leaf"}function kn(t){if(t.validity&&t.validity.badInput)return t.hasAttribute("value")?Number(t.getAttribute("value"))||0:t._sapLastGood??0;if(t.value==="")return 0;let e=Number(t.value);return Number.isNaN(e)?t._sapLastGood??0:(t._sapLastGood=e,e)}function $e(t,e){switch(e){case"checkbox":return t.checked;case"radio":return t.checked?t.value:void 0;case"number":return kn(t);case"select-one":return t.value;case"select-multiple":return[...t.selectedOptions].map(r=>r.value);case"hidden":case"text":return t.value;case"leaf":return t.textContent;default:return t.value}}function Nn(t,e,r){switch(e){case"checkbox":t.checked=!!r;break;case"radio":t.checked=String(t.value)===String(r);break;case"number":case"text":case"hidden":t.value=r==null?"":String(r);break;case"select-one":t.value=r==null?"":String(r);break;case"select-multiple":{let n=new Set((Array.isArray(r)?r:[r]).map(String));for(let o of t.options)o.selected=n.has(o.value);break}case"leaf":t.textContent=r==null?"":String(r);break;default:t.value=r==null?"":String(r)}}function Ce(t){if(t.hasAttribute("transient")){t.removeAttribute("value"),t.removeAttribute("checked"),t.removeAttribute("data-value");return}pt(t)||V(t)}function Tn(t){t.dispatchEvent(new Event("input",{bubbles:!0})),t.dispatchEvent(new Event("change",{bubbles:!0}))}function Pe(t,e){return $e(t,e)}function Me(t){let e=_t(t);return{el:t,kind:e,read(){return $e(t,e)},write(r,n={}){Nn(t,e,r),n.noMirror||Ce(t),n.silent||Tn(t)},mirror(){Ce(t)}}}var I=null,bt=!1,Y=null;function Oe(t){let e=null;return{kind:"hub",subscribe(r){let n=t.onAnyChange({debounce:0,require:"observed"},r);typeof n=="function"&&(e=n)},suppress(r){t.pause();try{return r()}finally{t.resume()}},teardown(){if(e){try{e()}catch{}e=null}}}}function Rn(){let t=null;return{kind:"native",subscribe(e){t=new MutationObserver(n=>e(Ln(n)));let r=typeof document<"u"&&document.body||typeof document<"u"&&document.documentElement;r&&t.observe(r,{childList:!0,subtree:!0,attributes:!0,characterData:!0})},suppress(e){let r=T("undo");r&&r.pause&&r.pause();try{return e()}finally{t&&t.takeRecords(),r&&r.resume&&r.resume()}},teardown(){t&&(t.disconnect(),t=null)}}}function Ln(t){let e=[];for(let r of t)if(r.type==="attributes"){let n=r.target;n&&n.nodeType===1&&!ht(n)&&e.push({type:"attribute",element:n})}else if(r.type==="characterData"){let n=r.target&&r.target.parentElement;n&&!ht(n)&&e.push({type:"characterData",element:n})}else if(r.type==="childList"){for(let n of r.addedNodes)if(!(n.nodeType!==1||ht(n))&&(e.push({type:"add",element:n}),n.querySelectorAll))for(let o of n.querySelectorAll("*"))ht(o)||e.push({type:"add",element:o});for(let n of r.removedNodes)n.nodeType===1&&e.push({type:"remove",element:n,parent:r.target})}return e}function ht(t){return!!(t.closest&&t.closest("[sap-ignore],[template],[cms-template]"))}function _n(t,e){t.pruneDisconnected();let r=new Set,n=!1;for(let o of e){let s=o.type==="remove"?o.parent:o.element,i=s&&t.appFor(s);i&&r.add(i),o.type==="add"&&o.element&&o.element.nodeType===1&&o.element.hasAttribute&&o.element.hasAttribute("sap")&&!(t.isRegistered&&t.isRegistered(o.element))&&(n=!0)}n&&t.remountIfPresent();for(let o of r)o.root.isConnected&&t.schedule(o,"mutation")}function De(t){if(I)return I.suppress(t);let e=T("undo");if(e&&e.pause&&e.resume){e.pause();try{return t()}finally{e.resume()}}return t()}function Ct(t,e){bt=!0,I=t,t.subscribe(r=>_n(e,r))}function $t(t){if(bt||typeof window>"u"||typeof document>"u")return;let e=T("Mutation");if(e&&typeof e.onAnyChange=="function"){Ct(Oe(e),t);return}typeof MutationObserver=="function"&&(Ct(Rn(),t),Y=Q(document,Lt,function(){let n=T("Mutation");n&&(Y(),Y=null,I&&I.teardown(),bt=!1,Ct(Oe(n),t))}))}function Pt(){if(I)try{I.teardown()}catch{}Y&&typeof document<"u"&&Y(),I=null,bt=!1,Y=null}var Cn=new Set(z),gt=Object.freeze([]),W=[],We={},Be={};function Fe(t){W.includes(t)||(W.push(t),t.boundary&&Object.assign(We,t.boundary),t.paintKinds&&Object.assign(Be,t.paintKinds))}function yt(t,e={}){if(e.breaker){t.diag.error("E26",t.root,{problem:"recompute loop halted after 50 passes; recent triggers: "+(t._breakerRing||[]).join(", ")}),B(t.root,"loop");return}e.full&&(ue(),me());let r=ce(t.root);try{De(()=>$n(t,e))}finally{le(r)}t._viewsChanged&&(t._viewsChanged=!1,t.root.dispatchEvent(new CustomEvent("sap:views-updated",{bubbles:!0})))}function $n(t,e){let r=t.root,n={},o=[],s=[],i=new Set;t.diag.errors=[];let f={root:n,state:n,item:null,ownerEl:r,projection:!1},c=null;function l(u,h,b=!1){let m=h.attr||h.name,g=b?xe(u,m):u.getAttribute(m);return g==null&&(g=Tt(h),s.push({el:u,name:h.name,attr:m,value:Gt(st(g,h.type),h.type)})),st(g,h.type)}function a(u,h,b,m){let g=h.decls;if(!g)return;let E=!!m.item&&!m.projection&&!m.view;for(let k of g){if(k.transient){c&&(c.pure=!1),b[k.name]=Xt(u,k);continue}if(Nt(u,k)){b[k.name]=u.hasAttribute(k.attr);continue}b[k.name]=l(u,k,E)}}function d(u,h,b){let m=h.bind,g=b.item||b.state,E=_t(u);c&&(E!=="leaf"||h.transient)&&(c.pure=!1),E==="radio"?(m in g||(g[m]=""),u.checked&&(g[m]=u.value)):E==="leaf"&&b.item&&!b.projection&&!b.view?g[m]=ve(u):g[m]=Pe(u,E),h.transient&&(u.removeAttribute("value"),u.removeAttribute("checked"))}function p(u,h,b){let m=!1;if(h.paints){m=!0;for(let g of h.paints)g.kind==="when"&&i.add(g.field),o.push({def:g,el:u,ctx:b})}for(let g of W)g.collect&&g.collect(A,u,h,b)!==!1&&(m=!0);c&&m&&(h.calcs&&(c.pure=!1),c.collects.push(u,h))}function v(u,h,b){Object.defineProperty(u,"$key",{value:qt(h,"row"),enumerable:!1}),Object.defineProperty(u,"$index",{value:b,enumerable:!1,configurable:!0}),Object.defineProperty(u,"$el",{value:h,enumerable:!1})}function R(u,h,b){let m=ft(u);a(u,m,h,b),u._sapScope=h,!b.projection&&m.bind!=null&&d(u,m,b),p(u,m,b),m.items?nt(u,h,b):_(u,h,b)}function _(u,h,b){for(let m=u.firstElementChild;m;m=m.nextElementSibling)$(m,h,b)}function $(u,h,b){let m=ft(u);if(!m.inert){if(m.boundary){c&&(c.pure=!1),m.boundary==="scope"?et(u,h,b):m.boundary==="items"?(p(u,m,b),nt(u,h,b)):We[m.boundary](A,u,m,h,b);return}!b.projection&&!b.view&&m.bind!=null&&d(u,m,b),p(u,m,b);for(let g=u.firstElementChild;g;g=g.nextElementSibling)$(g,h,b)}}function et(u,h,b){let m=u.getAttribute("scope"),g={};h[m]=g;let E={root:b.root,state:g,item:null,ownerEl:u,projection:b.projection};R(u,g,E)}function nt(u,h,b){c&&(c.pure=!1);let m=u.getAttribute("items"),g=[];h[m]=g,u._sapList=g;let E=!b.projection&&!b.view&&he(),k=0;for(let N=u.firstElementChild;N;N=N.nextElementSibling){let x=ft(N);if(!x.item||x.template||x.cms)continue;let L=E?be(N):void 0;g.push(L&&L.plan===x&&Object.isExtensible(L.obj)&&rt(L,N,k,b)||X(N,x,k,b,E)),k++}}function X(u,h,b,m,g){let E={};v(E,u,b);let k={root:m.root,state:m.state,item:E,ownerEl:u,projection:m.projection};if(!g)return R(u,E,k),E;let N=c,x={plan:h,obj:E,fields:null,presence:gt,pending:gt,collects:[],pure:!0},L=s.length,nn=t.diag.errors.length;c=x;try{R(u,E,k)}finally{c=N}if(!x.pure||t.halted||t.diag.errors.length!==nn)return E;let Ft=[];for(let H of Object.keys(E)){let wt=E[H];if(wt!==null&&typeof wt=="object")return E;Ft.push(H,wt)}if(h.decls)for(let H of h.decls)Nt(u,H)&&(x.presence===gt?x.presence=[]:x.presence).push(H.name,H.attr);return s.length>L&&(x.pending=s.slice(L)),x.collects.length||(x.collects=gt),x.fields=Ft,ge(u,x),E}function rt(u,h,b,m){let g=u.obj;try{g.$index!==b&&Object.defineProperty(g,"$index",{value:b,enumerable:!1,configurable:!0});let N=u.presence;for(let L=0;L<N.length;L+=2)g[N[L]]=h.hasAttribute(N[L+1]);let x=u.fields;for(let L=0;L<x.length;L+=2)g[x[L]]=x[L+1]}catch{return ye(h),null}h._sapScope=g;let E=u.pending;for(let N=0;N<E.length;N++)s.push(E[N]);let k=u.collects;if(k.length){let N={root:m.root,state:m.state,item:g,ownerEl:h,projection:m.projection};for(let x=0;x<k.length;x+=2)p(k[x],k[x+1],N)}return g}let A={app:t,root:r,rootObj:n,paints:o,stats:{calcs:0,lists:0},resolveDefault:l,collectEl:p,walkScope:_};for(let u of W)u.begin&&u.begin(A);let w=e.cacheReads===!1?null:we(r);try{R(r,n,f)}finally{e.cacheReads!==!1&&Ae(w)}if(t.halted)return;for(let u of W)u.afterIntake&&u.afterIntake(A);if(s.length&&i.size)for(let u of s)i.has(u.attr)&&u.el.getAttribute(u.attr)==null&&u.el.setAttribute(u.attr,u.value);for(let u of W)u.compute&&u.compute(A);let y=0;for(let u of W)u.reconcile&&(y+=u.reconcile(A));let S=0,C=y;for(let u of o){let h=Mn(u,t);u.ctx.view?C+=h:S+=h}for(let u of W)u.afterPaint&&u.afterPaint(A);t._state=n,t._stats={fields:Object.keys(n).filter(u=>typeof n[u]!="function").length,calcs:A.stats.calcs,paints:o.length,lists:A.stats.lists,writes:S,viewWrites:C},t._viewsChanged=C>0,t._lastPass={trigger:e.trigger||"refresh",writes:S},t._debug&&console.log(`sap pass \xB7 trigger: ${t._lastPass.trigger} \xB7 writes ${S}/${o.length}`)}function Pn(t){return t.kind==="text"?t.fmt?"text:"+t.fmt:"text":t.kind==="attr"?"attr:"+t.arg:t.kind==="class"?"class:"+t.arg:t.kind==="css"?"css:"+t.arg:t.kind==="when"?(t.match==="hide"?"hide-when:":t.match==="show-not"?"option-not:":"show-when:")+t.field:t.kind}function Mt(t,e,r,n){let o=t;for(;o&&o.nodeType===1;){if(o.hasAttribute&&o.hasAttribute(e)){let s=r.includes(o.getAttribute(e));if(n?!s:s)return!0}o=o.parentElement}return!1}function Mn(t,e){let r=t.def,n=t.el,o=Be[r.kind];if(o)return o(t,e);if(r.kind==="when")return Ie(r,n,null);try{let s=ie(r.entry,t.ctx.state,t.ctx.item,n,t.ctx.root),i=Ie(r,n,s);return zt(n),i}catch(s){return e.diag.error(s.sapCode==="E22"?"E22":"E24",n,{attr:Pn(r),expr:r.entry&&r.entry.src,problem:String(s.message)}),B(n,s.sapCode||"E24"),0}}function Ie(t,e,r){switch(t.kind){case"text":{let n=t.fmt!=null?ne(t.fmt,r):r==null?"":String(r);return e.textContent!==n?(e.textContent=n,1):0}case"show":{let n=!r;return e.hidden!==n?(e.hidden=n,1):0}case"when":{let n=T("optionVisibility");if(n&&n._started)return e._sapWhen&&e.hidden?(e.hidden=!1,e._sapWhen=!1,1):0;let o;t.match==="hide"?o=!Mt(e,t.field,t.values,!1):t.match==="show-not"?o=Mt(e,t.field,t.values,!0):o=Mt(e,t.field,t.values,!1),e._sapWhen=!0;let s=!o;return e.hidden!==s?(e.hidden=s,1):0}case"attr":{let n=t.arg;if((n==="checked"||n==="selected")&&typeof e[n]=="boolean"&&!e.hasAttribute("bind")&&!e.closest("select[bind]")){let s=0;return e[n]!==!!r&&(e[n]=!!r,s=1),!!r!==e.hasAttribute(n)&&(r?e.setAttribute(n,""):e.removeAttribute(n),s=1),s}if(Cn.has(n)){let s=e.hasAttribute(n);return r&&!s?(e.setAttribute(n,""),1):!r&&s?(e.removeAttribute(n),1):0}let o=typeof r=="boolean"?String(r):r==null?"":String(r);return e.getAttribute(n)!==o?(e.setAttribute(n,o),1):0}case"class":{let n=!!r;return e.classList.contains(t.arg)!==n?(e.classList.toggle(t.arg,n),1):0}case"css":{let n=r==null?"":String(r);return e.style.getPropertyValue("--"+t.arg)!==n?(e.style.setProperty("--"+t.arg,n),1):0}default:return 0}}var On=new Set(z),je=new Set(["calc","text","attr","class","css","set","move","sort","option","option-not","show-when","hide-when","editmode","viewmode"]),Dn=new Set(["show-when","hide-when","option","option-not"]),In=/\b(?:state|item|root)\.|===|!==|&&|\|\||[()]|^\s*!/,He=new Set(["sap","scope","items","item","template","bind","show","effect","invalid","detail","state","transient","confirm","default","persist","sortable","trigger-add","trigger-remove","trigger-reset","sap-ignore","sap-error","no-save","no-watch","no-undo","no-trigger-autosave","freeze","mutations-ignore","save-remove","save-ignore","save-freeze"]),Dt=[];function ze(t){Dt.includes(t)||Dt.push(t)}function Wn(t){return t.tagName==="INPUT"||t.tagName==="SELECT"||t.tagName==="TEXTAREA"}function Ot(t){return t.hasAttribute("bind")}function Bn(t,e){e(t);for(let n=t.firstElementChild;n;n=n.nextElementSibling)r(n);function r(n){if(!n.hasAttribute("sap-ignore")){if(n.tagName==="TEMPLATE"){if(n.hasAttribute("items"))for(let o=n.content.firstElementChild;o;o=o.nextElementSibling)r(o);return}e(n);for(let o=n.firstElementChild;o;o=o.nextElementSibling)r(o)}}}function Ue(t,e){let r=!1,n=(i,f,c)=>{e.error(i,f,c),r=!0},o=t.ownerDocument.createTreeWalker(t,4),s;for(;s=o.nextNode();)if(/\{\{.*\}\}/.test(s.nodeValue||"")){n("E02",s.parentElement||t,{problem:"moustaches in text content are not a Sap feature",fix:'move the expression onto the element: text="state.x"'});break}return Bn(t,i=>{let f=new Set;for(let l of Dt)l(i,n,a=>f.add(a));let c=i.closest&&i.closest("[detail]");for(let l of[...i.attributes]){let a=l.name;if(f.has(a))continue;if(a.includes(":")){let p=a.slice(0,a.indexOf(":"));if(je.has(p)){if(Dn.has(p)&&In.test(l.value)){let v=a.slice(a.indexOf(":")+1);e.warn("W04",i,{attr:a,expr:l.value,problem:`${p}: compares the "${v}" attribute against a literal value, not a JS expression`,fix:`use show="${l.value}" for an expression, or a literal like ${p}:${v}="overview"`})}}else{let v=vt(p,[...je]);e.warn("W03",i,{attr:a,problem:`unknown "${p}:" attribute`,didYouMean:v?`${v}:`:null})}}else if(!He.has(a)&&!xt.has(a)&&!On.has(a)&&!/^(data-|aria-|on)/.test(a)&&!(a in i)){let p=vt(a,[...He]);p&&e.warn("W03",i,{attr:a,problem:`unknown "${a}" attribute`,didYouMean:p})}a==="attr:hidden"&&e.warn("W03",i,{attr:a,problem:"attr:hidden paints the wrong attribute",fix:'use show="expr"'});let d=Ot(i)||a==="attr:selected"&&i.tagName==="OPTION"&&!!i.closest("select[bind]");(a==="attr:value"||a==="attr:checked"||a==="attr:selected")&&d&&n("E30",i,{attr:a,problem:"attr: on a bound control collides with persist ownership",fix:"remove it; bind owns this attribute"}),a==="effect"&&Ot(i)&&/\b(value|checked)\s*=[^=]/.test(l.value)&&n("E30",i,{attr:a,expr:l.value,problem:"effect writes value/checked on a bound control (writes a stale value with no synthetic event)",fix:"write through onclick + Sap(this) instead"}),(a==="text"||a.startsWith("text:")||a==="show")&&Wn(i)&&(a==="show"||n("E18",i,{attr:a,problem:"paint belongs on output elements, not form controls",fix:"move the paint to an <output> or <span>"}))}if(i.hasAttribute("state")){let l=it(i.getAttribute("state")),a=new Set;for(let d of l){d.name.includes("-")&&n("E08",i,{attr:"state",problem:`field "${d.name}" is not a valid identifier (the hyphen parses as subtraction)`,fix:`rename to ${d.name.replace(/-/g,"")}`}),a.has(d.name)&&n("E04",i,{attr:"state",problem:`field "${d.name}" is declared twice in one scope`}),a.add(d.name),Ht.has(d.attr)&&n("E05",i,{attr:"state",problem:`"${d.name}" is a reserved Sap word`}),xt.has(d.attr)&&n("E06",i,{attr:"state",problem:`"${d.name}" is a global HTML attribute name; pick another field name`}),d.name==="open"&&i.tagName==="DIALOG"&&n("E33",i,{attr:"state",problem:"dialog open is transient",fix:"use showModal() \u2014 declare state= only on <details> or popovers"});let p=kt(i,d.attr);p&&(d.attr==="checked"||d.attr==="selected")&&n("E35",i,{attr:"state",problem:`"${d.attr}" on a form control is the control's own state, not a declared field`,fix:'bind the control instead, e.g. <input type="checkbox" bind="done">'}),p&&d.type==="num"&&n("E35",i,{attr:"state",problem:`"${d.attr}" is an HTML boolean attribute; it cannot hold a number`,fix:`declare it bare: state="${d.attr}"`}),d.transient&&(p||d.type==="presence")&&n("E35",i,{attr:"state",problem:`"${d.name}" is carried by attribute presence, which transient would strip`,fix:"declare a separate name:bool:transient field and paint the attribute from it"})}}if(Ot(i)){if(i.hasAttribute("-"),i.tagName==="INPUT"){let l=(i.getAttribute("type")||"text").toLowerCase();l==="file"&&n("E32",i,{attr:"bind",problem:"files never serialize into an HTML file",fix:"use no-save + effect instead of bind"}),l==="password"&&!i.hasAttribute("transient")&&n("E31",i,{attr:"bind",problem:"a password must never serialize into a world-readable file",fix:"add transient to the password input"})}else if(i.tagName!=="SELECT"&&i.tagName!=="TEXTAREA"){let l=i.getAttribute("contenteditable");!(l!=null&&l!=="false")&&i.children.length>0&&n("E20",i,{attr:"bind",problem:"bind on a container element is not a control; a write would overwrite its children",fix:"bind a control (input/select/textarea), a contenteditable, or an empty text leaf"})}}if(i.hasAttribute("transient")&&i.hasAttribute("persist")&&n("E34",i,{problem:"transient and persist are opposite: persist forces the live value into the saved bytes, leaking exactly what transient drops",fix:"remove one \u2014 transient to keep it out of the file, or persist to save it"}),i.tagName==="DIALOG"&&i.hasAttribute("detail")&&!(i.parentElement&&i.parentElement.closest('[clay~="freeze"], [freeze], [save-freeze]'))&&e.warn("W31",i,{attr:"detail",problem:"a detail dialog writes open when it opens, and that attribute would be saved into the file",fix:'wrap the dialog in an element with clay="freeze" (not editor-ui, which removes it from the file), and make its key field transient'}),i.hasAttribute("item")&&!i.hasAttribute("template")&&i.parentNode&&i.parentNode.nodeType===1){let l=i.parentElement;(!l||!l.hasAttribute("items"))&&n("E10",i,{problem:"an [item] must be a direct child of an [items] list",fix:'wrap it in a container with items="name"'})}if(i.hasAttribute("items")&&c&&n("E17",i,{attr:"items",problem:"nested items inside a detail panel is a v1 mount error (nested collections ship in v1.1)"}),i.hasAttribute("items")){let l=t.querySelector(`[trigger-add="${i.getAttribute("items")}"]`);!Yt(i)&&!St(t,i.getAttribute("items"))&&Vt(i).length===0&&l&&n("E17",i,{attr:"items",problem:`trigger-add targets items="${i.getAttribute("items")}" but it has no [item template] to clone`})}}),r&&(e.halted=!0,e.haltReason=e.errors[0]?e.errors[0].code:"halt",B(t,e.haltReason)),!r}var qe="sap-styles",Ve="[item][template]{display:none!important}[hidden]{display:none!important}[sap-error]{outline:2px solid #e5484d;outline-offset:1px}",It=new WeakSet;function Fn(t){if(It.has(t))return;let e=t.defaultView,r=e&&e.CSSStyleSheet;if(r&&"adoptedStyleSheets"in t)try{let n=new r;n.replaceSync(Ve),t.adoptedStyleSheets=[...t.adoptedStyleSheets,n],It.add(t);return}catch{}if(!t.getElementById(qe)){let n=t.createElement("style");n.id=qe,n.textContent=Ve,(t.head||t.documentElement).appendChild(n)}It.add(t)}var jn=0;function Ye(){return typeof performance<"u"&&performance.now?performance.now():0}function Wt(t){let e=t.id||t.getAttribute("sap")||`app-${jn++}`,r=new ot(e),n={root:t,name:e,diag:r,_state:null,_stats:null,_lastPass:null,_passes:0,_broken:!1,_mountMs:0,_mountWrites:0};if(!Ue(t,r))return n.halted=!0,n;Fn(t.ownerDocument);for(let i of t.querySelectorAll("textarea[data-value]"))dt(i);let s=Ye();return yt(n,{trigger:"mount",full:!0}),n._mountMs=Ye()-s,n._mountWrites=n._stats?n._stats.writes:0,n._mountWrites>0&&!Ne()&&!T("derived")&&r.warn("W30",t,{problem:`${n._mountWrites} paint(s) ran at mount; the saved file was out of sync with its declared state`,fix:"re-save once so the file mounts clean (a settled file writes nothing)"}),n}var Ge=/^(set:|move:|sort:|trigger-add$|trigger-remove$|trigger-reset$)/;function Hn(t){return`${t.tagName.toLowerCase()}[sap]`}function zn(t){let e=0;for(let r of t.querySelectorAll("*"))for(let n of r.attributes)if(Ge.test(n.name)){e++;break}for(let r of t.attributes)if(Ge.test(r.name)){e++;break}return e}function Xe(t){function e(f){let c=f._stats||{},l=f.root;return{root:Hn(l),fields:c.fields||0,calcs:c.calcs||0,paints:c.paints||0,actions:zn(l),lists:(l.hasAttribute("items")?1:0)+l.querySelectorAll("[items]").length,rows:l.querySelectorAll("[item]:not([template])").length,warnings:f.diag.warnings.length,errors:f.diag.errors.length,mountWrites:f._mountWrites||0,ms:Math.round((f._mountMs||0)*10)/10,passes:f._passes||0,lastPass:f._lastPass||null,ok:f.diag.errors.length===0&&!f.halted}}function r(){let f=t.apps().map(e);return{ok:f.every(c=>c.ok),apps:f}}function n(f){let c=e(f);return c.ok?`sap \u2713 ${c.root} \xB7 fields ${c.fields} \xB7 calcs ${c.calcs} \xB7 paints ${c.paints} \xB7 actions ${c.actions} \xB7 lists ${c.lists} \xB7 rows ${c.rows} \xB7 warnings ${c.warnings} \xB7 mount writes ${c.mountWrites} \xB7 ${c.ms}ms`:`sap \u2717 ${c.root} \xB7 errors ${c.errors} \xB7 warnings ${c.warnings} \xB7 ${c.ms}ms`}function o(){for(let f of t.apps()){let c=n(f);f.diag.errors.length||f.halted?console.error(c):console.log(c)}}function s(){let f=[],c=[];for(let l of t.apps())f.push(...l.diag.errors),c.push(...l.diag.warnings);return{ok:f.length===0,errors:f,warnings:c,counts:{errors:f.length,warnings:c.length}}}function i(f){let c=f===void 0?!0:!!f;for(let l of t.apps())l._debug=c;return console.log(`sap debug ${c?"on":"off"} \u2014 per-pass headers will ${c?"":"no longer "}log`),c}return{status:r,report:s,debug:i,greenLine:n,printGreenLines:o,REGISTRY:Et}}var Ke="0.7.0";function Je({createAccessor:t,installInput:e,debugExtras:r}){let n=new Map,o=[],s=jt(yt);function i(w){let y=w;for(;y;){if(y.nodeType===1&&y.hasAttribute&&y.hasAttribute("sap"))return n.get(y)||null;y=y.parentNode&&y.parentNode.host?y.parentNode.host:y.parentElement}return null}function f(){for(let w=o.length-1;w>=0;w--){let y=o[w];y.root.isConnected||(n.delete(y.root),o.splice(w,1))}}function c(w,y){if(w.moveBefore)try{w.moveBefore(y,null);return}catch{}w.appendChild(y)}function l(w,y){let S=y.parentElement;if(S){if(S.moveBefore)try{S.moveBefore(w,y);return}catch{}S.insertBefore(w,y)}}let a={apps:()=>o.slice(),appFor:i,isRegistered:w=>n.has(w),pruneDisconnected:f,schedule:(w,y)=>s.schedule(w,y),runNow:(w,y)=>s.runNow(w,y),moveInto:c,placeBefore:l,remountIfPresent:()=>X()},d=t(a),p=Xe(a),v=r?r(a,p):{},R=!1,_=!1,$=null;function et(){R||(R=!0,e(a,d,document),$=_e(a))}function nt(){let w=T("derived");w&&typeof w.mounted=="function"&&w.mounted()}function X(w=document){if(_)return[];et(),$t(a);let y=w.querySelectorAll("[sap]"),S=[];for(let C of y){if(n.has(C))continue;let u=Wt(C);n.set(C,u),o.push(u),S.push(u)}for(let C of S){let u=p.greenLine(C);C.diag.errors.length||C.halted?console.error(u):console.log(u)}return nt(),S}function rt(w){if(_)return null;if(et(),$t(a),!w)return X();let y=typeof w=="string"?document.querySelector(w):w;if(!y)return null;if(n.has(y))return n.get(y);let S=Wt(y);n.set(y,S),o.push(S);let C=p.greenLine(S);return S.diag.errors.length||S.halted?console.error(C):console.log(C),S}let A=d.Sap;return A.version=Ke,A.refresh=function(){for(let y of o)y.root.isConnected&&s.runNow(y,"refresh")},A.batch=Le,A.status=p.status,A.report=p.report,A.why=v.why,A.debug=p.debug,A.doctor=v.doctor,A.greenLine=p.greenLine,A.formats=U,A.serializeControlToAttributes=V,A.finalizeControlForSave=ke,A.rehydrateControlFromAttributes=dt,A.mount=rt,A.config=function(y={}){return y.formats&&Object.assign(U,y.formats),A},A._registry=n,A._reset=function(){n.clear(),o.length=0,Pt()},A.unmount=function(){_=!0,n.clear(),o.length=0,Pt(),typeof $=="function"&&$()},{Sap:A,mountAll:X,mount:rt,runtime:a}}function Qe(t){if(typeof document>"u")return;let e=()=>Te(()=>t());document.readyState==="loading"?document.addEventListener("DOMContentLoaded",e):e()}function Ze(t){let e=[];function r(c){let l=c.target;if(!l||l.nodeType!==1)return;let a=t.appFor(l);if(a){l.hasAttribute("persist")&&!pt(l)&&mt(l)&&V(l);for(let d of e)if(d(l,a))return;t.schedule(a,c.type+" "+(l.id||l.tagName.toLowerCase()))}}function n(c){let l=c.target,a=t.appFor(l);a&&[...l.querySelectorAll("[bind]")].every(d=>mt(d))&&setTimeout(()=>{l.querySelectorAll("[bind]").forEach(d=>{d.dispatchEvent(new Event("input",{bubbles:!0})),d.dispatchEvent(new Event("change",{bubbles:!0}))}),t.schedule(a,"reset")},0)}function o(c){let l=t.appFor(c.target);l&&t.schedule(l,"toggle")}function s(c){let l=c.detail||{};for(let a of[l.from,l.to,c.target]){if(!a||a.nodeType!==1)continue;let d=t.appFor(a);d&&t.schedule(d,"sorted")}}function i(c){if(c.key!=="ArrowUp"&&c.key!=="ArrowDown")return;let l=c.target;if(!l||l.nodeType!==1||l.tagName!=="INPUT"||!l.hasAttribute("bind")||!l.hasAttribute("step"))return;let a=(l.getAttribute("type")||"text").toLowerCase();if(a!=="text"&&a!=="tel"&&a!=="search"||!t.appFor(l)||!mt(l))return;c.preventDefault();let p=P(l.getAttribute("step"))||1,v=c.key==="ArrowUp"?1:-1,R=P(l.value)+p*(c.shiftKey?10:1)*v,_=l.getAttribute("min"),$=l.getAttribute("max");_!==null&&_!==""&&R<P(_)&&(R=P(_)),$!==null&&$!==""&&R>P($)&&(R=P($)),Me(l).write(String(Number(R.toFixed(2))))}function f(c=document){c.addEventListener("reset",n),c.addEventListener("toggle",o,!0),c.addEventListener("input",r),c.addEventListener("change",r),c.addEventListener("clay:sorted",s),c.addEventListener("keydown",i)}return{install:f,addRouter:c=>e.push(c)}}var Z="https://clayjs.com/v1/sap.js",Un=/^(calc|set|move|sort):/,qn=new Set(["each","detail","effect","invalid","confirm","trigger-add","trigger-remove","trigger-reset"]);function Bt(t){return Un.test(t)||qn.has(t)}ze((t,e)=>{for(let r of t.attributes)Bt(r.name)&&e("E50",t,{attr:r.name,expr:r.value,problem:`${r.name} is full sapjs; the sapjs core only paints declared state`,fix:`load ${Z}; the markup stays as it is`})});function G(t,e,r){t.app.diag.error("E50",e,{attr:r,problem:`${r} is full sapjs; the sapjs core only paints declared state`,fix:`load ${Z}; the markup stays as it is`}),B(e,"E50"),t.app.halted=!0}Fe({name:"core-only",collect(t,e,r){r.calcs&&G(t,e,"calc:"+r.calcs[0].name),r.effects&&G(t,e,"effect"),r.invalids&&G(t,e,"invalid");for(let n of e.attributes)Bt(n.name)&&(n.name.startsWith("calc:")&&r.calcs||n.name==="effect"&&r.effects||n.name==="invalid"&&r.invalids||G(t,e,n.name));return!1},boundary:{each(t,e){G(t,e,"each")},detail(t,e){G(t,e,"detail")}}});function Vn(){return{Sap:function(){throw new Error(`Sap(el) is full sapjs; load ${Z}`)}}}var tn=t=>()=>(console.warn(`Sap.${t} is full sapjs; load ${Z}`),null),{Sap:tt,mountAll:en,mount:Yn,runtime:Gn}=Je({createAccessor:Vn,debugExtras:()=>({why:tn("why"),doctor:tn("doctor")}),installInput(t,e,r){Ze(t).install(r)}});tt.core=!0;var Xn=typeof window<"u"&&window.Sap&&!window.Sap.core;Xn?tt.unmount():Qe(en);typeof window<"u"&&!window.Sap&&(window.Sap=tt);var Kn=tt;return cn(Jn);})();
|
|
8
|
+
`+e.value:e.value;t.textContent!==n&&(t.textContent=n),t.removeAttribute("data-value");return}if(r==="SELECT"){let n=t.options,o=e.options;for(let s=0;s<n.length;s++)o[s]&&o[s].selected?n[s].hasAttribute("selected")||n[s].setAttribute("selected",""):n[s].removeAttribute("selected")}}function dt(t){t.tagName!=="TEXTAREA"||!t.hasAttribute("data-value")||t!==t.ownerDocument.activeElement&&(t.textContent=t.getAttribute("data-value"),t.removeAttribute("data-value"))}function T(t){if(typeof window>"u")return null;let e=window.clay,r=window.hyperclay;return t==="consent"?e?.confirm||r?.consent||null:e?.[t]||r?.[t]||null}function Ne(){let t=T("visitorDrafts");return!!(t&&typeof t.restored=="function"&&t.restored()?.restored)}var Lt=["clay:mutation-ready","hyperclay:mutation-ready"],En=["clay:sync-applied","hyperclay:livesync-applied"],xn=["clay:ready","hyperclay:ready"],vn=["clay:route"],Sn=["clay:modechange"];function Q(t,e,r){let n=null,o=s=>{n!==null&&n!==s.type||(n=s.type,queueMicrotask(()=>{n=null}),r(s))};for(let s of e)t.addEventListener(s,o);return()=>{for(let s of e)t.removeEventListener(s,o)}}function Te(t){let e=typeof window<"u"&&window.clay&&window.clay.ready;e&&typeof e.then=="function"?e.then(()=>t(),()=>t()):t()}function pt(t){let e=T("region");return!e||typeof e.resolveRegionPolicy!="function"||typeof e.skipForPolicy!="function"?!1:e.skipForPolicy(e.resolveRegionPolicy(t),void 0,["no-save","freeze"])}function Re(){return typeof window>"u"?null:window.clay?.modeLifecycle||null}function mt(t,{transient:e=!1}={}){if(e)return!0;let r=Re();return typeof r?.canWrite!="function"||T("region")?.resolveRegionPolicy?.(t)?.persist==="none"?!0:r.canWrite()}function Le(t,e){if(typeof e!="function")throw new Error("Sap.batch(label, fn): fn must be a function");let r=T("undo");r&&r.flush&&r.flush();let n=e();if(n&&typeof n.then=="function")throw new Error("Sap.batch fn must be synchronous (it returned a promise)");return r&&r.commitCaptured&&r.commitCaptured(t),n}function _e(t){if(typeof window>"u"||typeof document>"u")return;let e=()=>{let p=!1;for(let v of t.apps())v.root.isConnected?t.runNow(v,"platform"):p=!0;p&&t.pruneDisconnected(),t.remountIfPresent()},r=T("derived"),n=r&&typeof r.register=="function"?r.register(e):null,o=typeof n=="function"?null:Q(document,En,e),s=Q(document,vn,e),i=null,f=!1,c=()=>{let p=i;i=null,p&&(p[2](),p[3]())},l=()=>{if(f)return!1;let p=T("undo"),v=Re()?.state?.generation;if(i&&i[0]===p&&i[1]===v)return!0;if(c(),!p||typeof p.on!="function")return!1;let R=p.on("undo",e);if(typeof R!="function")return!1;let _=p.on("redo",e);return typeof _!="function"?(R(),!1):(i=[p,v,R,_],!0)};l();let a=[Lt,xn,Sn].map(p=>Q(document,p,l)),d=T("ready");return d&&typeof d.then=="function"&&d.then(l,()=>{}),()=>{f=!0,typeof n=="function"&&n(),o&&o(),s();for(let p of a)p();c()}}function _t(t){let e=t.tagName;if(e==="INPUT"){let r=(t.getAttribute("type")||"text").toLowerCase();return r==="checkbox"?"checkbox":r==="radio"?"radio":r==="number"||r==="range"?"number":r==="hidden"?"hidden":"text"}return e==="TEXTAREA"?"text":e==="SELECT"?t.multiple?"select-multiple":"select-one":"leaf"}function kn(t){if(t.validity&&t.validity.badInput)return t.hasAttribute("value")?Number(t.getAttribute("value"))||0:t._sapLastGood??0;if(t.value==="")return 0;let e=Number(t.value);return Number.isNaN(e)?t._sapLastGood??0:(t._sapLastGood=e,e)}function $e(t,e){switch(e){case"checkbox":return t.checked;case"radio":return t.checked?t.value:void 0;case"number":return kn(t);case"select-one":return t.value;case"select-multiple":return[...t.selectedOptions].map(r=>r.value);case"hidden":case"text":return t.value;case"leaf":return t.textContent;default:return t.value}}function Nn(t,e,r){switch(e){case"checkbox":t.checked=!!r;break;case"radio":t.checked=String(t.value)===String(r);break;case"number":case"text":case"hidden":t.value=r==null?"":String(r);break;case"select-one":t.value=r==null?"":String(r);break;case"select-multiple":{let n=new Set((Array.isArray(r)?r:[r]).map(String));for(let o of t.options)o.selected=n.has(o.value);break}case"leaf":t.textContent=r==null?"":String(r);break;default:t.value=r==null?"":String(r)}}function Ce(t){if(t.hasAttribute("transient")){t.removeAttribute("value"),t.removeAttribute("checked"),t.removeAttribute("data-value");return}pt(t)||V(t)}function Tn(t){t.dispatchEvent(new Event("input",{bubbles:!0})),t.dispatchEvent(new Event("change",{bubbles:!0}))}function Pe(t,e){return $e(t,e)}function Me(t){let e=_t(t);return{el:t,kind:e,read(){return $e(t,e)},write(r,n={}){Nn(t,e,r),n.noMirror||Ce(t),n.silent||Tn(t)},mirror(){Ce(t)}}}var I=null,bt=!1,Y=null;function Oe(t){let e=null;return{kind:"hub",subscribe(r){let n=t.onAnyChange({debounce:0,require:"observed"},r);typeof n=="function"&&(e=n)},suppress(r){t.pause();try{return r()}finally{t.resume()}},teardown(){if(e){try{e()}catch{}e=null}}}}function Rn(){let t=null;return{kind:"native",subscribe(e){t=new MutationObserver(n=>e(Ln(n)));let r=typeof document<"u"&&document.body||typeof document<"u"&&document.documentElement;r&&t.observe(r,{childList:!0,subtree:!0,attributes:!0,characterData:!0})},suppress(e){let r=T("undo");r&&r.pause&&r.pause();try{return e()}finally{t&&t.takeRecords(),r&&r.resume&&r.resume()}},teardown(){t&&(t.disconnect(),t=null)}}}function Ln(t){let e=[];for(let r of t)if(r.type==="attributes"){let n=r.target;n&&n.nodeType===1&&!ht(n)&&e.push({type:"attribute",element:n})}else if(r.type==="characterData"){let n=r.target&&r.target.parentElement;n&&!ht(n)&&e.push({type:"characterData",element:n})}else if(r.type==="childList"){for(let n of r.addedNodes)if(!(n.nodeType!==1||ht(n))&&(e.push({type:"add",element:n}),n.querySelectorAll))for(let o of n.querySelectorAll("*"))ht(o)||e.push({type:"add",element:o});for(let n of r.removedNodes)n.nodeType===1&&e.push({type:"remove",element:n,parent:r.target})}return e}function ht(t){return!!(t.closest&&t.closest("[sap-ignore],[template],[cms-template]"))}function _n(t,e){t.pruneDisconnected();let r=new Set,n=!1;for(let o of e){let s=o.type==="remove"?o.parent:o.element,i=s&&t.appFor(s);i&&r.add(i),o.type==="add"&&o.element&&o.element.nodeType===1&&o.element.hasAttribute&&o.element.hasAttribute("sap")&&!(t.isRegistered&&t.isRegistered(o.element))&&(n=!0)}n&&t.remountIfPresent();for(let o of r)o.root.isConnected&&t.schedule(o,"mutation")}function De(t){if(I)return I.suppress(t);let e=T("undo");if(e&&e.pause&&e.resume){e.pause();try{return t()}finally{e.resume()}}return t()}function Ct(t,e){bt=!0,I=t,t.subscribe(r=>_n(e,r))}function $t(t){if(bt||typeof window>"u"||typeof document>"u")return;let e=T("Mutation");if(e&&typeof e.onAnyChange=="function"){Ct(Oe(e),t);return}typeof MutationObserver=="function"&&(Ct(Rn(),t),Y=Q(document,Lt,function(){let n=T("Mutation");n&&(Y(),Y=null,I&&I.teardown(),bt=!1,Ct(Oe(n),t))}))}function Pt(){if(I)try{I.teardown()}catch{}Y&&typeof document<"u"&&Y(),I=null,bt=!1,Y=null}var Cn=new Set(z),gt=Object.freeze([]),W=[],We={},Be={};function Fe(t){W.includes(t)||(W.push(t),t.boundary&&Object.assign(We,t.boundary),t.paintKinds&&Object.assign(Be,t.paintKinds))}function yt(t,e={}){if(e.breaker){t.diag.error("E26",t.root,{problem:"recompute loop halted after 50 passes; recent triggers: "+(t._breakerRing||[]).join(", ")}),B(t.root,"loop");return}e.full&&(ue(),me());let r=ce(t.root);try{De(()=>$n(t,e))}finally{le(r)}t._viewsChanged&&(t._viewsChanged=!1,t.root.dispatchEvent(new CustomEvent("sap:views-updated",{bubbles:!0})))}function $n(t,e){let r=t.root,n={},o=[],s=[],i=new Set;t.diag.errors=[];let f={root:n,state:n,item:null,ownerEl:r,projection:!1},c=null;function l(u,h,b=!1){let m=h.attr||h.name,g=b?xe(u,m):u.getAttribute(m);return g==null&&(g=Tt(h),s.push({el:u,name:h.name,attr:m,value:Gt(st(g,h.type),h.type)})),st(g,h.type)}function a(u,h,b,m){let g=h.decls;if(!g)return;let E=!!m.item&&!m.projection&&!m.view;for(let k of g){if(k.transient){c&&(c.pure=!1),b[k.name]=Xt(u,k);continue}if(Nt(u,k)){b[k.name]=u.hasAttribute(k.attr);continue}b[k.name]=l(u,k,E)}}function d(u,h,b){let m=h.bind,g=b.item||b.state,E=_t(u);c&&(E!=="leaf"||h.transient)&&(c.pure=!1),E==="radio"?(m in g||(g[m]=""),u.checked&&(g[m]=u.value)):E==="leaf"&&b.item&&!b.projection&&!b.view?g[m]=ve(u):g[m]=Pe(u,E),h.transient&&(u.removeAttribute("value"),u.removeAttribute("checked"))}function p(u,h,b){let m=!1;if(h.paints){m=!0;for(let g of h.paints)g.kind==="when"&&i.add(g.field),o.push({def:g,el:u,ctx:b})}for(let g of W)g.collect&&g.collect(A,u,h,b)!==!1&&(m=!0);c&&m&&(h.calcs&&(c.pure=!1),c.collects.push(u,h))}function v(u,h,b){Object.defineProperty(u,"$key",{value:qt(h,"row"),enumerable:!1}),Object.defineProperty(u,"$index",{value:b,enumerable:!1,configurable:!0}),Object.defineProperty(u,"$el",{value:h,enumerable:!1})}function R(u,h,b){let m=ft(u);a(u,m,h,b),u._sapScope=h,!b.projection&&m.bind!=null&&d(u,m,b),p(u,m,b),m.items?nt(u,h,b):_(u,h,b)}function _(u,h,b){for(let m=u.firstElementChild;m;m=m.nextElementSibling)$(m,h,b)}function $(u,h,b){let m=ft(u);if(!m.inert){if(m.boundary){c&&(c.pure=!1),m.boundary==="scope"?et(u,h,b):m.boundary==="items"?(p(u,m,b),nt(u,h,b)):We[m.boundary](A,u,m,h,b);return}!b.projection&&!b.view&&m.bind!=null&&d(u,m,b),p(u,m,b);for(let g=u.firstElementChild;g;g=g.nextElementSibling)$(g,h,b)}}function et(u,h,b){let m=u.getAttribute("scope"),g={};h[m]=g;let E={root:b.root,state:g,item:null,ownerEl:u,projection:b.projection};R(u,g,E)}function nt(u,h,b){c&&(c.pure=!1);let m=u.getAttribute("items"),g=[];h[m]=g,u._sapList=g;let E=!b.projection&&!b.view&&he(),k=0;for(let N=u.firstElementChild;N;N=N.nextElementSibling){let x=ft(N);if(!x.item||x.template||x.cms)continue;let L=E?be(N):void 0;g.push(L&&L.plan===x&&Object.isExtensible(L.obj)&&rt(L,N,k,b)||X(N,x,k,b,E)),k++}}function X(u,h,b,m,g){let E={};v(E,u,b);let k={root:m.root,state:m.state,item:E,ownerEl:u,projection:m.projection};if(!g)return R(u,E,k),E;let N=c,x={plan:h,obj:E,fields:null,presence:gt,pending:gt,collects:[],pure:!0},L=s.length,nn=t.diag.errors.length;c=x;try{R(u,E,k)}finally{c=N}if(!x.pure||t.halted||t.diag.errors.length!==nn)return E;let Ft=[];for(let H of Object.keys(E)){let wt=E[H];if(wt!==null&&typeof wt=="object")return E;Ft.push(H,wt)}if(h.decls)for(let H of h.decls)Nt(u,H)&&(x.presence===gt?x.presence=[]:x.presence).push(H.name,H.attr);return s.length>L&&(x.pending=s.slice(L)),x.collects.length||(x.collects=gt),x.fields=Ft,ge(u,x),E}function rt(u,h,b,m){let g=u.obj;try{g.$index!==b&&Object.defineProperty(g,"$index",{value:b,enumerable:!1,configurable:!0});let N=u.presence;for(let L=0;L<N.length;L+=2)g[N[L]]=h.hasAttribute(N[L+1]);let x=u.fields;for(let L=0;L<x.length;L+=2)g[x[L]]=x[L+1]}catch{return ye(h),null}h._sapScope=g;let E=u.pending;for(let N=0;N<E.length;N++)s.push(E[N]);let k=u.collects;if(k.length){let N={root:m.root,state:m.state,item:g,ownerEl:h,projection:m.projection};for(let x=0;x<k.length;x+=2)p(k[x],k[x+1],N)}return g}let A={app:t,root:r,rootObj:n,paints:o,stats:{calcs:0,lists:0},resolveDefault:l,collectEl:p,walkScope:_};for(let u of W)u.begin&&u.begin(A);let w=e.cacheReads===!1?null:we(r);try{R(r,n,f)}finally{e.cacheReads!==!1&&Ae(w)}if(t.halted)return;for(let u of W)u.afterIntake&&u.afterIntake(A);if(s.length&&i.size)for(let u of s)i.has(u.attr)&&u.el.getAttribute(u.attr)==null&&u.el.setAttribute(u.attr,u.value);for(let u of W)u.compute&&u.compute(A);let y=0;for(let u of W)u.reconcile&&(y+=u.reconcile(A));let S=0,C=y;for(let u of o){let h=Mn(u,t);u.ctx.view?C+=h:S+=h}for(let u of W)u.afterPaint&&u.afterPaint(A);t._state=n,t._stats={fields:Object.keys(n).filter(u=>typeof n[u]!="function").length,calcs:A.stats.calcs,paints:o.length,lists:A.stats.lists,writes:S,viewWrites:C},t._viewsChanged=C>0,t._lastPass={trigger:e.trigger||"refresh",writes:S},t._debug&&console.log(`sap pass \xB7 trigger: ${t._lastPass.trigger} \xB7 writes ${S}/${o.length}`)}function Pn(t){return t.kind==="text"?t.fmt?"text:"+t.fmt:"text":t.kind==="attr"?"attr:"+t.arg:t.kind==="class"?"class:"+t.arg:t.kind==="css"?"css:"+t.arg:t.kind==="when"?(t.match==="hide"?"hide-when:":t.match==="show-not"?"option-not:":"show-when:")+t.field:t.kind}function Mt(t,e,r,n){let o=t;for(;o&&o.nodeType===1;){if(o.hasAttribute&&o.hasAttribute(e)){let s=r.includes(o.getAttribute(e));if(n?!s:s)return!0}o=o.parentElement}return!1}function Mn(t,e){let r=t.def,n=t.el,o=Be[r.kind];if(o)return o(t,e);if(r.kind==="when")return Ie(r,n,null);try{let s=ie(r.entry,t.ctx.state,t.ctx.item,n,t.ctx.root),i=Ie(r,n,s);return zt(n),i}catch(s){return e.diag.error(s.sapCode==="E22"?"E22":"E24",n,{attr:Pn(r),expr:r.entry&&r.entry.src,problem:String(s.message)}),B(n,s.sapCode||"E24"),0}}function Ie(t,e,r){switch(t.kind){case"text":{let n=t.fmt!=null?ne(t.fmt,r):r==null?"":String(r);return e.textContent!==n?(e.textContent=n,1):0}case"show":{let n=!r;return e.hidden!==n?(e.hidden=n,1):0}case"when":{let n=T("optionVisibility");if(n&&n._started)return e._sapWhen&&e.hidden?(e.hidden=!1,e._sapWhen=!1,1):0;let o;t.match==="hide"?o=!Mt(e,t.field,t.values,!1):t.match==="show-not"?o=Mt(e,t.field,t.values,!0):o=Mt(e,t.field,t.values,!1),e._sapWhen=!0;let s=!o;return e.hidden!==s?(e.hidden=s,1):0}case"attr":{let n=t.arg;if((n==="checked"||n==="selected")&&typeof e[n]=="boolean"&&!e.hasAttribute("bind")&&!e.closest("select[bind]")){let s=0;return e[n]!==!!r&&(e[n]=!!r,s=1),!!r!==e.hasAttribute(n)&&(r?e.setAttribute(n,""):e.removeAttribute(n),s=1),s}if(Cn.has(n)){let s=e.hasAttribute(n);return r&&!s?(e.setAttribute(n,""),1):!r&&s?(e.removeAttribute(n),1):0}let o=typeof r=="boolean"?String(r):r==null?"":String(r);return e.getAttribute(n)!==o?(e.setAttribute(n,o),1):0}case"class":{let n=!!r;return e.classList.contains(t.arg)!==n?(e.classList.toggle(t.arg,n),1):0}case"css":{let n=r==null?"":String(r);return e.style.getPropertyValue("--"+t.arg)!==n?(e.style.setProperty("--"+t.arg,n),1):0}default:return 0}}var On=new Set(z),je=new Set(["calc","text","attr","class","css","set","move","sort","option","option-not","show-when","hide-when","editmode","viewmode"]),Dn=new Set(["show-when","hide-when","option","option-not"]),In=/\b(?:state|item|root)\.|===|!==|&&|\|\||[()]|^\s*!/,He=new Set(["sap","scope","items","item","template","bind","show","effect","invalid","detail","state","transient","confirm","default","persist","sortable","trigger-add","trigger-remove","trigger-reset","sap-ignore","sap-error","no-save","no-watch","no-undo","no-trigger-autosave","freeze","mutations-ignore","save-remove","save-ignore","save-freeze"]),Dt=[];function ze(t){Dt.includes(t)||Dt.push(t)}function Wn(t){return t.tagName==="INPUT"||t.tagName==="SELECT"||t.tagName==="TEXTAREA"}function Ot(t){return t.hasAttribute("bind")}function Bn(t,e){e(t);for(let n=t.firstElementChild;n;n=n.nextElementSibling)r(n);function r(n){if(!n.hasAttribute("sap-ignore")){if(n.tagName==="TEMPLATE"){if(n.hasAttribute("items"))for(let o=n.content.firstElementChild;o;o=o.nextElementSibling)r(o);return}e(n);for(let o=n.firstElementChild;o;o=o.nextElementSibling)r(o)}}}function Ue(t,e){let r=!1,n=(i,f,c)=>{e.error(i,f,c),r=!0},o=t.ownerDocument.createTreeWalker(t,4),s;for(;s=o.nextNode();)if(/\{\{.*\}\}/.test(s.nodeValue||"")){n("E02",s.parentElement||t,{problem:"moustaches in text content are not a Sap feature",fix:'move the expression onto the element: text="state.x"'});break}return Bn(t,i=>{let f=new Set;for(let l of Dt)l(i,n,a=>f.add(a));let c=i.closest&&i.closest("[detail]");for(let l of[...i.attributes]){let a=l.name;if(f.has(a))continue;if(a.includes(":")){let p=a.slice(0,a.indexOf(":"));if(je.has(p)){if(Dn.has(p)&&In.test(l.value)){let v=a.slice(a.indexOf(":")+1);e.warn("W04",i,{attr:a,expr:l.value,problem:`${p}: compares the "${v}" attribute against a literal value, not a JS expression`,fix:`use show="${l.value}" for an expression, or a literal like ${p}:${v}="overview"`})}}else{let v=vt(p,[...je]);e.warn("W03",i,{attr:a,problem:`unknown "${p}:" attribute`,didYouMean:v?`${v}:`:null})}}else if(!He.has(a)&&!xt.has(a)&&!On.has(a)&&!/^(data-|aria-|on)/.test(a)&&!(a in i)){let p=vt(a,[...He]);p&&e.warn("W03",i,{attr:a,problem:`unknown "${a}" attribute`,didYouMean:p})}a==="attr:hidden"&&e.warn("W03",i,{attr:a,problem:"attr:hidden paints the wrong attribute",fix:'use show="expr"'});let d=Ot(i)||a==="attr:selected"&&i.tagName==="OPTION"&&!!i.closest("select[bind]");(a==="attr:value"||a==="attr:checked"||a==="attr:selected")&&d&&n("E30",i,{attr:a,problem:"attr: on a bound control collides with persist ownership",fix:"remove it; bind owns this attribute"}),a==="effect"&&Ot(i)&&/\b(value|checked)\s*=[^=]/.test(l.value)&&n("E30",i,{attr:a,expr:l.value,problem:"effect writes value/checked on a bound control (writes a stale value with no synthetic event)",fix:"write through onclick + Sap(this) instead"}),(a==="text"||a.startsWith("text:")||a==="show")&&Wn(i)&&(a==="show"||n("E18",i,{attr:a,problem:"paint belongs on output elements, not form controls",fix:"move the paint to an <output> or <span>"}))}if(i.hasAttribute("state")){let l=it(i.getAttribute("state")),a=new Set;for(let d of l){d.name.includes("-")&&n("E08",i,{attr:"state",problem:`field "${d.name}" is not a valid identifier (the hyphen parses as subtraction)`,fix:`rename to ${d.name.replace(/-/g,"")}`}),a.has(d.name)&&n("E04",i,{attr:"state",problem:`field "${d.name}" is declared twice in one scope`}),a.add(d.name),Ht.has(d.attr)&&n("E05",i,{attr:"state",problem:`"${d.name}" is a reserved Sap word`}),xt.has(d.attr)&&n("E06",i,{attr:"state",problem:`"${d.name}" is a global HTML attribute name; pick another field name`}),d.name==="open"&&i.tagName==="DIALOG"&&n("E33",i,{attr:"state",problem:"dialog open is transient",fix:"use showModal() \u2014 declare state= only on <details> or popovers"});let p=kt(i,d.attr);p&&(d.attr==="checked"||d.attr==="selected")&&n("E35",i,{attr:"state",problem:`"${d.attr}" on a form control is the control's own state, not a declared field`,fix:'bind the control instead, e.g. <input type="checkbox" bind="done">'}),p&&d.type==="num"&&n("E35",i,{attr:"state",problem:`"${d.attr}" is an HTML boolean attribute; it cannot hold a number`,fix:`declare it bare: state="${d.attr}"`}),d.transient&&(p||d.type==="presence")&&n("E35",i,{attr:"state",problem:`"${d.name}" is carried by attribute presence, which transient would strip`,fix:"declare a separate name:bool:transient field and paint the attribute from it"})}}if(Ot(i)){if(i.hasAttribute("-"),i.tagName==="INPUT"){let l=(i.getAttribute("type")||"text").toLowerCase();l==="file"&&n("E32",i,{attr:"bind",problem:"files never serialize into an HTML file",fix:"use no-save + effect instead of bind"}),l==="password"&&!i.hasAttribute("transient")&&n("E31",i,{attr:"bind",problem:"a password must never serialize into a world-readable file",fix:"add transient to the password input"})}else if(i.tagName!=="SELECT"&&i.tagName!=="TEXTAREA"){let l=i.getAttribute("contenteditable");!(l!=null&&l!=="false")&&i.children.length>0&&n("E20",i,{attr:"bind",problem:"bind on a container element is not a control; a write would overwrite its children",fix:"bind a control (input/select/textarea), a contenteditable, or an empty text leaf"})}}if(i.hasAttribute("transient")&&i.hasAttribute("persist")&&n("E34",i,{problem:"transient and persist are opposite: persist forces the live value into the saved bytes, leaking exactly what transient drops",fix:"remove one \u2014 transient to keep it out of the file, or persist to save it"}),i.tagName==="DIALOG"&&i.hasAttribute("detail")&&!(i.parentElement&&i.parentElement.closest('[clay~="freeze"], [freeze], [save-freeze]'))&&e.warn("W31",i,{attr:"detail",problem:"a detail dialog writes open when it opens, and that attribute would be saved into the file",fix:'wrap the dialog in an element with clay="freeze" (not editor-ui, which removes it from the file), and make its key field transient'}),i.hasAttribute("item")&&!i.hasAttribute("template")&&i.parentNode&&i.parentNode.nodeType===1){let l=i.parentElement;(!l||!l.hasAttribute("items"))&&n("E10",i,{problem:"an [item] must be a direct child of an [items] list",fix:'wrap it in a container with items="name"'})}if(i.hasAttribute("items")&&c&&n("E17",i,{attr:"items",problem:"nested items inside a detail panel is a v1 mount error (nested collections ship in v1.1)"}),i.hasAttribute("items")){let l=t.querySelector(`[trigger-add="${i.getAttribute("items")}"]`);!Yt(i)&&!St(t,i.getAttribute("items"))&&Vt(i).length===0&&l&&n("E17",i,{attr:"items",problem:`trigger-add targets items="${i.getAttribute("items")}" but it has no [item template] to clone`})}}),r&&(e.halted=!0,e.haltReason=e.errors[0]?e.errors[0].code:"halt",B(t,e.haltReason)),!r}var qe="sap-styles",Ve="[item][template]{display:none!important}[hidden]{display:none!important}[sap-error]{outline:2px solid #e5484d;outline-offset:1px}",It=new WeakSet;function Fn(t){if(It.has(t))return;let e=t.defaultView,r=e&&e.CSSStyleSheet;if(r&&"adoptedStyleSheets"in t)try{let n=new r;n.replaceSync(Ve),t.adoptedStyleSheets=[...t.adoptedStyleSheets,n],It.add(t);return}catch{}if(!t.getElementById(qe)){let n=t.createElement("style");n.id=qe,n.textContent=Ve,(t.head||t.documentElement).appendChild(n)}It.add(t)}var jn=0;function Ye(){return typeof performance<"u"&&performance.now?performance.now():0}function Wt(t){let e=t.id||t.getAttribute("sap")||`app-${jn++}`,r=new ot(e),n={root:t,name:e,diag:r,_state:null,_stats:null,_lastPass:null,_passes:0,_broken:!1,_mountMs:0,_mountWrites:0};if(!Ue(t,r))return n.halted=!0,n;Fn(t.ownerDocument);for(let i of t.querySelectorAll("textarea[data-value]"))dt(i);let s=Ye();return yt(n,{trigger:"mount",full:!0}),n._mountMs=Ye()-s,n._mountWrites=n._stats?n._stats.writes:0,n._mountWrites>0&&!Ne()&&!T("derived")&&r.warn("W30",t,{problem:`${n._mountWrites} paint(s) ran at mount; the saved file was out of sync with its declared state`,fix:"re-save once so the file mounts clean (a settled file writes nothing)"}),n}var Ge=/^(set:|move:|sort:|trigger-add$|trigger-remove$|trigger-reset$)/;function Hn(t){return`${t.tagName.toLowerCase()}[sap]`}function zn(t){let e=0;for(let r of t.querySelectorAll("*"))for(let n of r.attributes)if(Ge.test(n.name)){e++;break}for(let r of t.attributes)if(Ge.test(r.name)){e++;break}return e}function Xe(t){function e(f){let c=f._stats||{},l=f.root;return{root:Hn(l),fields:c.fields||0,calcs:c.calcs||0,paints:c.paints||0,actions:zn(l),lists:(l.hasAttribute("items")?1:0)+l.querySelectorAll("[items]").length,rows:l.querySelectorAll("[item]:not([template])").length,warnings:f.diag.warnings.length,errors:f.diag.errors.length,mountWrites:f._mountWrites||0,ms:Math.round((f._mountMs||0)*10)/10,passes:f._passes||0,lastPass:f._lastPass||null,ok:f.diag.errors.length===0&&!f.halted}}function r(){let f=t.apps().map(e);return{ok:f.every(c=>c.ok),apps:f}}function n(f){let c=e(f);return c.ok?`sap \u2713 ${c.root} \xB7 fields ${c.fields} \xB7 calcs ${c.calcs} \xB7 paints ${c.paints} \xB7 actions ${c.actions} \xB7 lists ${c.lists} \xB7 rows ${c.rows} \xB7 warnings ${c.warnings} \xB7 mount writes ${c.mountWrites} \xB7 ${c.ms}ms`:`sap \u2717 ${c.root} \xB7 errors ${c.errors} \xB7 warnings ${c.warnings} \xB7 ${c.ms}ms`}function o(){for(let f of t.apps()){let c=n(f);f.diag.errors.length||f.halted?console.error(c):console.log(c)}}function s(){let f=[],c=[];for(let l of t.apps())f.push(...l.diag.errors),c.push(...l.diag.warnings);return{ok:f.length===0,errors:f,warnings:c,counts:{errors:f.length,warnings:c.length}}}function i(f){let c=f===void 0?!0:!!f;for(let l of t.apps())l._debug=c;return console.log(`sap debug ${c?"on":"off"} \u2014 per-pass headers will ${c?"":"no longer "}log`),c}return{status:r,report:s,debug:i,greenLine:n,printGreenLines:o,REGISTRY:Et}}var Ke="0.7.1";function Je({createAccessor:t,installInput:e,debugExtras:r}){let n=new Map,o=[],s=jt(yt);function i(w){let y=w;for(;y;){if(y.nodeType===1&&y.hasAttribute&&y.hasAttribute("sap"))return n.get(y)||null;y=y.parentNode&&y.parentNode.host?y.parentNode.host:y.parentElement}return null}function f(){for(let w=o.length-1;w>=0;w--){let y=o[w];y.root.isConnected||(n.delete(y.root),o.splice(w,1))}}function c(w,y){if(w.moveBefore)try{w.moveBefore(y,null);return}catch{}w.appendChild(y)}function l(w,y){let S=y.parentElement;if(S){if(S.moveBefore)try{S.moveBefore(w,y);return}catch{}S.insertBefore(w,y)}}let a={apps:()=>o.slice(),appFor:i,isRegistered:w=>n.has(w),pruneDisconnected:f,schedule:(w,y)=>s.schedule(w,y),runNow:(w,y)=>s.runNow(w,y),moveInto:c,placeBefore:l,remountIfPresent:()=>X()},d=t(a),p=Xe(a),v=r?r(a,p):{},R=!1,_=!1,$=null;function et(){R||(R=!0,e(a,d,document),$=_e(a))}function nt(){let w=T("derived");w&&typeof w.mounted=="function"&&w.mounted()}function X(w=document){if(_)return[];et(),$t(a);let y=w.querySelectorAll("[sap]"),S=[];for(let C of y){if(n.has(C))continue;let u=Wt(C);n.set(C,u),o.push(u),S.push(u)}for(let C of S){let u=p.greenLine(C);C.diag.errors.length||C.halted?console.error(u):console.log(u)}return nt(),S}function rt(w){if(_)return null;if(et(),$t(a),!w)return X();let y=typeof w=="string"?document.querySelector(w):w;if(!y)return null;if(n.has(y))return n.get(y);let S=Wt(y);n.set(y,S),o.push(S);let C=p.greenLine(S);return S.diag.errors.length||S.halted?console.error(C):console.log(C),S}let A=d.Sap;return A.version=Ke,A.refresh=function(){for(let y of o)y.root.isConnected&&s.runNow(y,"refresh")},A.batch=Le,A.status=p.status,A.report=p.report,A.why=v.why,A.debug=p.debug,A.doctor=v.doctor,A.greenLine=p.greenLine,A.formats=U,A.serializeControlToAttributes=V,A.finalizeControlForSave=ke,A.rehydrateControlFromAttributes=dt,A.mount=rt,A.config=function(y={}){return y.formats&&Object.assign(U,y.formats),A},A._registry=n,A._reset=function(){n.clear(),o.length=0,Pt()},A.unmount=function(){_=!0,n.clear(),o.length=0,Pt(),typeof $=="function"&&$()},{Sap:A,mountAll:X,mount:rt,runtime:a}}function Qe(t){if(typeof document>"u")return;let e=()=>Te(()=>t());document.readyState==="loading"?document.addEventListener("DOMContentLoaded",e):e()}function Ze(t){let e=[];function r(c){let l=c.target;if(!l||l.nodeType!==1)return;let a=t.appFor(l);if(a){l.hasAttribute("persist")&&!pt(l)&&mt(l)&&V(l);for(let d of e)if(d(l,a))return;t.schedule(a,c.type+" "+(l.id||l.tagName.toLowerCase()))}}function n(c){let l=c.target,a=t.appFor(l);a&&[...l.querySelectorAll("[bind]")].every(d=>mt(d))&&setTimeout(()=>{l.querySelectorAll("[bind]").forEach(d=>{d.dispatchEvent(new Event("input",{bubbles:!0})),d.dispatchEvent(new Event("change",{bubbles:!0}))}),t.schedule(a,"reset")},0)}function o(c){let l=t.appFor(c.target);l&&t.schedule(l,"toggle")}function s(c){let l=c.detail||{};for(let a of[l.from,l.to,c.target]){if(!a||a.nodeType!==1)continue;let d=t.appFor(a);d&&t.schedule(d,"sorted")}}function i(c){if(c.key!=="ArrowUp"&&c.key!=="ArrowDown")return;let l=c.target;if(!l||l.nodeType!==1||l.tagName!=="INPUT"||!l.hasAttribute("bind")||!l.hasAttribute("step"))return;let a=(l.getAttribute("type")||"text").toLowerCase();if(a!=="text"&&a!=="tel"&&a!=="search"||!t.appFor(l)||!mt(l))return;c.preventDefault();let p=P(l.getAttribute("step"))||1,v=c.key==="ArrowUp"?1:-1,R=P(l.value)+p*(c.shiftKey?10:1)*v,_=l.getAttribute("min"),$=l.getAttribute("max");_!==null&&_!==""&&R<P(_)&&(R=P(_)),$!==null&&$!==""&&R>P($)&&(R=P($)),Me(l).write(String(Number(R.toFixed(2))))}function f(c=document){c.addEventListener("reset",n),c.addEventListener("toggle",o,!0),c.addEventListener("input",r),c.addEventListener("change",r),c.addEventListener("clay:sorted",s),c.addEventListener("keydown",i)}return{install:f,addRouter:c=>e.push(c)}}var Z="https://clayjs.com/v1/sap.js",Un=/^(calc|set|move|sort):/,qn=new Set(["each","detail","effect","invalid","confirm","trigger-add","trigger-remove","trigger-reset"]);function Bt(t){return Un.test(t)||qn.has(t)}ze((t,e)=>{for(let r of t.attributes)Bt(r.name)&&e("E50",t,{attr:r.name,expr:r.value,problem:`${r.name} is full sapjs; the sapjs core only paints declared state`,fix:`load ${Z}; the markup stays as it is`})});function G(t,e,r){t.app.diag.error("E50",e,{attr:r,problem:`${r} is full sapjs; the sapjs core only paints declared state`,fix:`load ${Z}; the markup stays as it is`}),B(e,"E50"),t.app.halted=!0}Fe({name:"core-only",collect(t,e,r){r.calcs&&G(t,e,"calc:"+r.calcs[0].name),r.effects&&G(t,e,"effect"),r.invalids&&G(t,e,"invalid");for(let n of e.attributes)Bt(n.name)&&(n.name.startsWith("calc:")&&r.calcs||n.name==="effect"&&r.effects||n.name==="invalid"&&r.invalids||G(t,e,n.name));return!1},boundary:{each(t,e){G(t,e,"each")},detail(t,e){G(t,e,"detail")}}});function Vn(){return{Sap:function(){throw new Error(`Sap(el) is full sapjs; load ${Z}`)}}}var tn=t=>()=>(console.warn(`Sap.${t} is full sapjs; load ${Z}`),null),{Sap:tt,mountAll:en,mount:Yn,runtime:Gn}=Je({createAccessor:Vn,debugExtras:()=>({why:tn("why"),doctor:tn("doctor")}),installInput(t,e,r){Ze(t).install(r)}});tt.core=!0;var Xn=typeof window<"u"&&window.Sap&&!window.Sap.core;Xn?tt.unmount():Qe(en);typeof window<"u"&&!window.Sap&&(window.Sap=tt);var Kn=tt;return cn(Jn);})();
|
|
9
9
|
export default SapCoreBundle.default;
|
package/dist/m/c-FSWRGBVQ.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b,c,d,e}from"./c-W23KVGUO.js";import"./c-BRLCTNMC.js";import"./c-QHWJ5ZIJ.js";import"./c-RG6XUZFA.js";import"./c-UL2YUY52.js";import"./c-QY7F6EN6.js";import"./c-CJFDLD43.js";import"./c-BJ7YQ5QZ.js";import"./c-4JZDZFF6.js";import"./c-VAK7SG37.js";import"./c-MHI3GYKF.js";import"./c-46XYM55L.js";import"./c-NUHP2XDB.js";import"./c-VKEDWYDF.js";import"./c-ICMAOOGK.js";import"./c-WRBKEJD4.js";import"./c-VHNSBD2M.js";export{a as ask,b as consent,e as init,d as snippet,c as tell};
|
package/dist/m/c-HMYWIHFG.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b}from"./c-BRLCTNMC.js";import"./c-QHWJ5ZIJ.js";import"./c-CJFDLD43.js";import"./c-BJ7YQ5QZ.js";import"./c-4JZDZFF6.js";import"./c-VAK7SG37.js";import"./c-MHI3GYKF.js";import"./c-46XYM55L.js";import"./c-NUHP2XDB.js";import"./c-VHNSBD2M.js";export{a as SURFACE_THEME,b as default};
|
package/dist/m/c-M6FNQCTQ.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b,c}from"./c-CJFDLD43.js";import"./c-BJ7YQ5QZ.js";import"./c-4JZDZFF6.js";import"./c-VAK7SG37.js";import"./c-MHI3GYKF.js";import"./c-NUHP2XDB.js";import"./c-VHNSBD2M.js";export{c as bevelDialog,a as dismissOf,b as keepFocusIn};
|
package/dist/m/c-WFMRX5RZ.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as b,b as c,c as d,d as e,e as f}from"./c-EOCKLMKX.js";import{g as a}from"./c-SJPD46ZO.js";import"./c-EXKHPOVC.js";import"./c-L5VFATT6.js";import"./c-XQSXKIKM.js";import"./c-67ILSNPR.js";import"./c-W4JCVLAB.js";import"./c-7K4SCQB7.js";import"./c-WMRJKQ2V.js";import"./c-44B5ODN7.js";import"./c-QIXT3Q7C.js";import"./c-E4IBSAQM.js";import"./c-57XDY6HC.js";import"./c-I2SCCUEW.js";import"./c-VHNSBD2M.js";export{e as ChartView,d as chartFromSlash,a as chartTables,b as insertChartAfterTable,f as refreshCharts,c as tableLabel};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{f as W}from"./c-46XYM55L.js";import{a as J}from"./c-RS77ODLY.js";import"./c-7SWMYKAI.js";import{b as V}from"./c-FILLTJA7.js";import{a as $}from"./c-VKEDWYDF.js";import"./c-UGHH4MB3.js";import"./c-LA2BW7UY.js";import"./c-IJUK2GPW.js";import{b as F}from"./c-CYWLPPUS.js";import{i as H}from"./c-VG5XIN4T.js";import{a as G}from"./c-2YYDMLNZ.js";import{c as B,l as z}from"./c-HA6INT6J.js";import"./c-ICMAOOGK.js";import"./c-WRBKEJD4.js";import"./c-VHNSBD2M.js";var X={always:["lib/mutation.js","core/preserve-authored.js","core/edit-mode.js","core/mode-key.js","core/stale-host-notice.js","core/page-data.js"],editOnly:["core/snapshot.js","core/persist.js","core/admin-attrs.js","core/save-core.js","core/save.js","core/conflict-notice.js","core/recovery.js","core/unsaved-warning.js","core/autosave.js","attrs/save-freeze.js","attrs/onaftersave.js","attrs/refetch-on-save.js","attrs/add-from.js","lib/cache-bust.js"]},w={richclay:{path:"plugins/richclay.js",editOnly:!0,default:!0},indicator:{path:"plugins/indicator.js",editOnly:!0,default:!1},sync:{path:"sync/live-sync.js",editOnly:!1,default:!1},live:{path:"plugins/live.js",editOnly:!1,default:!1},page:{path:"plugins/page.js",editOnly:!0,default:!1},"page-view":{path:"plugins/page-view.js",editOnly:!1,default:!1,internal:!0},sortable:{path:"plugins/sortable.js",editOnly:!0,default:!1},undo:{path:"plugins/undo.js",editOnly:!0,default:!1},unsent:{path:"plugins/unsent.js",editOnly:!0,default:!1},cms:{path:"plugins/cms.js",editOnly:!1,default:!1},quickcrop:{path:"plugins/quickcrop.js",editOnly:!1,default:!1},upload:{path:"plugins/upload.js",editOnly:!0,default:!1},people:{path:"plugins/people.js",editOnly:!1,default:!1},menu:{path:"plugins/menu.js",editOnly:!1,default:!1},wire:{path:"plugins/wire.js",editOnly:!1,default:!1},message:{path:"plugins/message.js",editOnly:!1,default:!1},like:{path:"plugins/like.js",editOnly:!1,default:!1},"ai-edit":{path:"plugins/ai-edit.js",editOnly:!0,default:!1},demo:{path:"plugins/demo.js",editOnly:!1,default:!1},source:{path:"plugins/source.js",editOnly:!0,default:!0},"visitor-drafts":{path:"plugins/visitor-drafts.js",ownerPath:"plugins/visitor-drafts-owner.js",editOnly:!1,default:!1},"bind-text":{path:"plugins/bind-text.js",editOnly:!0,default:!1},derive:{path:"plugins/derive.js",editOnly:!1,default:!1},upgrade:{path:"plugins/upgrade.js",editOnly:!1,default:!1}},b={"core/is-edit-mode.js":()=>import("./core/is-edit-mode-GCX6767E.js"),"core/draft-mode.js":()=>import("./core/draft-mode-WSQAT67S.js"),"lib/region-policy.js":()=>import("./lib/region-policy-KWBPROWF.js"),"lib/mutation.js":()=>import("./reader-core-2GXY7SHY.js").then(t=>t.core["lib/mutation.js"]),"core/edit-mode.js":()=>import("./reader-core-2GXY7SHY.js").then(t=>t.core["core/edit-mode.js"]),"core/mode-key.js":()=>import("./reader-core-2GXY7SHY.js").then(t=>t.core["core/mode-key.js"]),"core/stale-host-notice.js":()=>import("./reader-core-2GXY7SHY.js").then(t=>t.core["core/stale-host-notice.js"]),"core/page-data.js":()=>import("./reader-core-2GXY7SHY.js").then(t=>t.core["core/page-data.js"]),"core/preserve-authored.js":()=>import("./reader-core-2GXY7SHY.js").then(t=>t.core["core/preserve-authored.js"]),"core/snapshot.js":()=>import("./core/snapshot-O7II2AGG.js"),"core/save-core.js":()=>import("./core/save-core-IOCMXO5L.js"),"core/save.js":()=>import("./core/save-AOJBDSOK.js"),"core/conflict-notice.js":()=>import("./core/conflict-notice-JMAZLVRX.js"),"core/recovery.js":()=>import("./core/recovery-DRFZRJED.js"),"core/unsaved-warning.js":()=>import("./core/unsaved-warning-U5VUJFOE.js"),"core/persist.js":()=>import("./core/persist-3OPWJKZS.js"),"core/admin-attrs.js":()=>import("./core/admin-attrs-ZG7R5V3E.js"),"core/autosave.js":()=>import("./core/autosave-VPORYJSE.js"),"attrs/save-freeze.js":()=>import("./attrs/save-freeze-MTFVVYV5.js"),"attrs/onaftersave.js":()=>import("./attrs/onaftersave-OKSWEJQF.js"),"attrs/refetch-on-save.js":()=>import("./attrs/refetch-on-save-DPGJJMGN.js"),"attrs/add-from.js":()=>import("./attrs/add-from-T5LJXFFI.js"),"lib/cache-bust.js":()=>import("./lib/cache-bust-NH7VBWHO.js"),"plugins/richclay.js":()=>import("./plugins/richclay-KLGETK77.js"),"plugins/indicator.js":()=>import("./plugins/indicator-4VDXWYTD.js"),"sync/live-sync.js":()=>import("./sync/live-sync-SKPMFYOO.js"),"plugins/live.js":()=>import("./plugins/live-5EZN2EYP.js"),"plugins/page.js":()=>import("./plugins/page-LVW5DWA4.js"),"plugins/page-view.js":()=>import("./plugins/page-view-5KQ76IJB.js"),"plugins/sortable.js":()=>import("./plugins/sortable-WJZZBM7R.js"),"plugins/undo.js":()=>import("./plugins/undo-3JEYK5QY.js"),"plugins/unsent.js":()=>import("./plugins/unsent-OA4RGBUT.js"),"plugins/cms.js":()=>import("./plugins/cms-LRAOZHT7.js"),"plugins/quickcrop.js":()=>import("./plugins/quickcrop-BQ5YYFCH.js"),"plugins/upload.js":()=>import("./plugins/upload-TTCQRIM5.js"),"plugins/people.js":()=>import("./plugins/people-C7TVBBMR.js"),"plugins/menu.js":()=>import("./plugins/menu-KGWKT6CS.js"),"plugins/wire.js":()=>import("./plugins/wire-VRYPY6EJ.js"),"plugins/message.js":()=>import("./plugins/message-LQ6EDH4V.js"),"plugins/like.js":()=>import("./plugins/like-EV7MTZ56.js"),"plugins/ai-edit.js":()=>import("./plugins/ai-edit-J5VLSW5I.js"),"plugins/demo.js":()=>import("./plugins/demo-42BSYQ7T.js"),"plugins/visitor-drafts.js":()=>import("./plugins/visitor-drafts-2AWNT23K.js"),"plugins/visitor-drafts-owner.js":()=>import("./plugins/visitor-drafts-owner-MZP45XSG.js"),"plugins/bind-text.js":()=>import("./plugins/bind-text-NX46N5UV.js"),"plugins/source.js":()=>import("./plugins/source-CCEUM3OR.js"),"plugins/derive.js":()=>import("./plugins/derive-FRE5JJQE.js"),"plugins/upgrade.js":()=>import("./plugins/upgrade-NW556WJD.js")},ie=["visitor-drafts","richclay","indicator","sortable","undo","unsent","quickcrop","upload","people","menu","upgrade","cms","page-view","sync","live","page","message","like","wire","ai-edit","demo","derive","bind-text","source"],re={cms:["quickcrop","upload"],"ai-edit":["wire"],page:["live","sync","upload"]},ae={page:["richclay"]},ce=new Set(["source","sortable","menu","upgrade"]);function K(t,e,o,s){let u=t.get(e);if(u)for(let n of u.split(",")){let r=n.trim();if(r){if(!w[r]||w[r].internal){console.warn(`clayjs: unknown plugin "${r}"`);continue}s(o,r)}}}var le=["sync","live","page","upload","quickcrop","cms","people","menu","upgrade","wire","ai-edit","demo","source"],ue=["attrs/refetch-on-save.js","core/conflict-notice.js"],de="https://hyperclay.com/templates/";function P(t,e,{isDraftMode:o=!1,hasSap:s=!1,hasVariants:u=!1,canEdit:n=!1,templateSource:r=null}={}){let g=[...X.always];e&&g.push(...X.editOnly);let m=new Set;K(t,"plugins",m,(i,l)=>i.add(l));let a=new Set;K(t,"exclude",a,(i,l)=>i.add(l));let d=new Set(m);for(let[i,l]of Object.entries(w))l.default&&d.add(i);s&&d.add("derive"),u&&(e||n)&&d.add("menu"),a.has("wire")&&d.delete("ai-edit"),!e&&!o&&d.has("page")&&d.add("page-view");for(let i of[...d])if(!a.has(i)&&!(w[i].editOnly&&!e))for(let l of re[i]||[])d.add(l);for(let i of a)d.delete(i);if(o){for(let i of le)d.delete(i);for(let i of ue){let l=g.indexOf(i);l>-1&&g.splice(l,1)}d.add("visitor-drafts")}!o&&n&&!a.has("upgrade")&&r&&r.startsWith(de)&&d.add("upgrade");for(let[i,l]of Object.entries(ae))if(d.has(i))for(let v of l)m.has(v)||d.delete(v);let c=[],h=[];for(let i of ie){if(!d.has(i))continue;let l=w[i];l.editOnly&&!e||(ce.has(i)?h:c).push(l.ownerPath&&!o?l.ownerPath:l.path)}return{core:g,plugins:c,late:h}}var C="data-deleted-at",R=(t,e)=>window.clay?.undo?.commit?window.clay.undo.commit(t,e):e(),Q=(t,e)=>t.dispatchEvent(new CustomEvent(e,{bubbles:!0})),I=Object.assign((t,{at:e=new Date().toISOString()}={})=>(R("Move to Trash",()=>t.setAttribute(C,e)),Q(t,"clay:trashed"),{undo:()=>I.restore(t)}),{is:t=>!!t.getAttribute(C),restore(t){R("Restore",()=>t.removeAttribute(C)),Q(t,"clay:restored")},purge(t){R("Delete forever",()=>t.remove())}});var Y=50,pe=1e3,fe='[clay~="no-snapshot"], [no-snapshot], [snapshot-remove]',k=0,ge=t=>{let e=t.nodeType===1?t:t.parentElement;if(!e)return"a detached node";let o=e.localName;return e.id?o+="#"+e.id:e.classList.length&&(o+="."+[...e.classList].slice(0,2).join(".")),"<"+o+">"};function me(t){let e=window.clay?.region?.resolveRegionPolicy;if(!e)return null;let o=s=>!!s&&!s.closest(fe)&&e(s).dirtyTracked;for(let s of t){if(s.type==="attributes"&&z(s.attributeName,s.target))continue;let u=s.target.nodeType===1?s.target:s.target.parentElement;if(o(u)&&!(s.type==="childList"&&![...s.addedNodes,...s.removedNodes].some(n=>n.nodeType!==1||o(n))))return s.target}return null}function _(t){let e=window.clay,o=e.Mutation,s=new Set,u=(y,p)=>{s.has(y)||(s.add(y),console.warn("clay.effect: "+p))},n=!1,r=!1,g=0,m=0;k&&e.isEditMode&&console.warn("clay.effect: an effect was created inside another effect, so a new one starts on every run. Create effects once, in clay.start.");let a=()=>{let y=Date.now();y-g>pe&&(g=y,m=0),++m>Y&&u("loop",`this effect ran more than ${Y} times in a second. Something keeps changing the document, often a timer or async callback the effect started.`)},d=()=>{if(n=!1,r)return;let y=null;o.pause(),k++;try{e.isEditMode===!0&&(a(),s.has("saved")||(y=new MutationObserver(()=>{}),y.observe(document.documentElement,{subtree:!0,childList:!0,attributes:!0,characterData:!0})));let p=t();p&&typeof p.then=="function"&&(v(),console.error("clay.effect: fn returned a promise. It must be synchronous, so this effect was stopped."))}catch(p){console.error("clay.effect:",p)}finally{k--,o.resume();let p=y?y.takeRecords():[];if(y?.disconnect(),p.length){let O=me(p);O&&u("saved",`this effect changed ${ge(O)}, which is saved with the file. Effect writes never mark the page unsaved, so a merge can leave it dirty with no save scheduled. Draw derived values inside clay="no-dirty" or clay="editor-ui".`)}}},c=()=>{n||r||(n=!0,queueMicrotask(d))},h=["undo","redo"],i=()=>{for(let y of h)e.undo?.on?.(y,c)},l=o.onAnyChange({debounce:0,require:"observed"},c);document.addEventListener("clay:sync-applied",c),document.addEventListener("clay:modechange",i),i();let v=()=>{r=!0,l(),document.removeEventListener("clay:sync-applied",c),document.removeEventListener("clay:modechange",i);for(let y of h)e.undo?.off?.(y,c)};return c(),v}Object.defineProperty(_,"running",{get:()=>k>0});var he={overtype:()=>import("./c-PQ5LK6QE.js"),marked:()=>import("./c-XN6MBKI6.js"),highlight:()=>import("./c-33JJ6CBX.js"),"highlight/bash":()=>import("./c-KI7M4AY3.js"),"highlight/css":()=>import("./c-H4LG442Q.js"),"highlight/javascript":()=>import("./c-VDSS4K3Z.js"),"highlight/json":()=>import("./c-NRPJEVJS.js"),"highlight/python":()=>import("./c-5YIHJ3TJ.js"),"highlight/xml":()=>import("./c-WN5AY3OZ.js"),uimotion:()=>import("./c-B5CS55WR.js")};function ye(t){let e=new Map;function o(s){return Object.hasOwn(t,s)?(e.has(s)||e.set(s,t[s]().catch(u=>{throw e.delete(s),u})),e.get(s)):Promise.reject(new Error(`clay.assets: no asset named "${s}"`))}return{load:o,names:()=>Object.keys(t)}}var Z=ye(he);function L(t,e){if(!t||!e)return t;let o={...e,...t};for(let s of["entries","imports","bootImports"])o[s]={...e[s],...t[s]};return o}var je="plugins/page.js";function M(t,e,{isEditMode:o=!1,isDraftMode:s=!1,hasSapJs:u=!1}={},n=document){if(!t?.entries)return 0;let r=[...e];for(let c of e)for(let h of t.bootImports?.[c]??[])u&&h==="vendor/sap-core.vendor.js"||r.push(h);o&&!s&&r.push(...t.editBootImports??[]),o&&!s&&e.includes(je)&&r.push(...t.editorBootImports??[]);let g=new Set,m=c=>{if(!(!c||g.has(c))){g.add(c);for(let h of t.imports?.[c]??[])m(h)}};for(let c of r)m(t.entries[c]);let a=new Set([...n.querySelectorAll('link[rel="modulepreload"]')].map(c=>c.href)),d=0;for(let c of g){let h=new URL(c,t.base).href;if(a.has(h))continue;let i=n.createElement("link");i.rel="modulepreload",i.href=h,i.setAttribute("clay","no-save"),n.head.append(i),d++}return d}var E=Object.fromEntries(Object.entries(w).flatMap(([t,e])=>e.ownerPath?[[e.path,t],[e.ownerPath,t]]:[[e.path,t]])),j={},ee=new Set;function se(t){ee.has(t)||(ee.add(t),document.dispatchEvent(new CustomEvent("clay:plugin-ready",{detail:{plugin:E[t]}})))}var ve=(t,e,o,s)=>()=>t().then(u=>(M(L(e,u),[...o.core,...o.plugins,...o.late],{isEditMode:!0,hasSapJs:s}),u));function we(){return new Promise(t=>$(t))}function A(){let t=document.querySelector('meta[name="hyper-source"]');return t?t.getAttribute("content"):null}async function He(t,e,o,s=null,u=null,n=null){W(),(await b["core/draft-mode.js"]()).noteBootParams(e),await we();let g=await b["core/is-edit-mode.js"](),{isEditMode:m,isDraftMode:a,isOwner:d,siteVisibility:c,canEdit:h}=g;m&&!a&&import("./core/host-permission-6EVJGNPL.js").then(f=>f.checkHostPermission()).catch(()=>{}),window.__hyperclayEditMode=m;let i=await b["lib/region-policy.js"](),l=!!document.querySelector("[sap]"),v=document.querySelectorAll("head style[clay-variant]").length>=2,y=!!document.querySelector('script[src*="sap.js"]');G.holdSettle=l&&m;let p=P(e,m,{isDraftMode:a,hasSap:l,hasVariants:v,canEdit:h,templateSource:A()});p.plugins.includes("plugins/demo.js")&&g.commitModeFacts({destination:"demo"}),M(L(s,u),[...p.core,...p.plugins],{isEditMode:m,isDraftMode:a,hasSapJs:y}),(m||a)&&!u&&n&&n().then(f=>M(L(s,f),[...p.core,...p.plugins],{isEditMode:m,isDraftMode:a,hasSapJs:y})).catch(()=>{});let O,oe=new Promise(f=>{O=f}),ne={sync:p.plugins.includes("sync/live-sync.js")};for(let f of p.core)j[f]=await b[f](),j[f].install?.();if(Se(j,{isDraftMode:a,isOwner:d,siteVisibility:c},i),te(j),document.documentElement.getAttribute("clay-mode-switch")==="live"){let f=P(e,!0,{isDraftMode:a,hasSap:l,hasVariants:v,canEdit:h,templateSource:A()});j["core/edit-mode.js"].noteLiveSwitch({edit:f,view:P(e,!1,{isDraftMode:a,hasSap:l,hasVariants:v,canEdit:h,templateSource:A()}),loaded:j,modules:b,attach:(S,D)=>{N(S,D);let T=E[S],x=window.clay.plugins;T&&Array.isArray(x)&&!x.includes(T)&&(window.clay.plugins=Object.freeze([...x,T]))},attachEditCore:te,announce:se,loadEditHints:n?ve(n,s,f,y):null,late:oe})}await j["core/edit-mode.js"].activateInitialMode(),window.clay.plugins=Object.freeze([...p.plugins,...p.late].map(f=>E[f]));let U=m?p:P(e,!0,{isDraftMode:a,hasSap:l,hasVariants:v,canEdit:h,templateSource:A()});window.clay.editPlugins=Object.freeze([...U.plugins,...U.late].map(f=>E[f]));for(let f of p.plugins){let S;try{S=await b[f]()}catch(D){console.error(`clayjs: plugin "${f}" failed to load, continuing without it:`,D);continue}j[f]=S,f==="plugins/page-view.js"&&S.start(ne),N(f,S,j)}await Promise.allSettled(p.plugins.map(f=>j[f]?.ready).filter(Boolean)),l&&Oe(j),Ee(g),o(window.clay),document.dispatchEvent(new CustomEvent("clay:ready",{detail:{clay:window.clay}})),p.late.length?be(p.late,g).then(O,O):O()}var q=(t,e)=>w[E[t]]?.editOnly&&!e.startsAtImport();async function be(t,e){try{await window.clay.page?.ready}catch{}for(let o of t)if(!q(o,e))try{let s=await b[o]();if(q(o,e)||(j[o]=s,N(o,s,j),await s.ready,q(o,e)))continue;se(o)}catch(s){console.error(`clayjs: plugin "${o}" failed to load, continuing without it:`,s),document.dispatchEvent(new CustomEvent("clay:plugin-failed",{detail:{plugin:E[o]}}))}}function Oe(t){let e=t["core/save.js"],o=null;try{o=e?e.currentPaintSignature():null}catch(s){console.error("clayjs: could not read the page's painted values:",s)}try{window.Sap&&typeof window.Sap.mount=="function"&&window.Sap.mount()}catch(s){console.error("clayjs: the derive engine failed to mount:",s)}finally{e?.releaseBootSettle()}e&&o!=null&&e.schedulePaintHeal(o)}function Se(t,{isDraftMode:e,isOwner:o,siteVisibility:s},u){let n=window.clay,r=t["lib/mutation.js"],g=t["core/edit-mode.js"];Object.assign(n,{toggleEditMode:g.toggleEditMode,setMode:g.setMode,modeLifecycle:g.modeLifecycle,isDraftMode:e,isOwner:o,siteVisibility:s,Mutation:r.default,region:u.windowRegionShape});for(let a of["mode","isEditMode","canEdit"])Object.defineProperty(n,a,{get:()=>g[a],enumerable:!0,configurable:!0});n.assets=Z;let m=t["core/page-data.js"];n.readData=m.readData,n.writeData=m.writeData,n.ephemeral=B,n.storage=F,n.host={get versions(){return import("./c-ZRXJD4G6.js").then(a=>a.hostVersions())}},n.trash=I,n.derived=H,n.effect=_,n.style=J,n.morph=(a,d,c)=>V().then(({morph:h})=>h(a,d,c))}function te(t){let e=window.clay,o=t["core/save.js"];if(o){let r=o.savePage||o.default;r.force=o.savePageForce,r.overwrite=o.saveOverwritingConflict,r.flush=o.flushSave,r.soon=o.savePageSoon,r.limits=o.saveLimits,r.inspect=o.inspectSaveSize,e.save!==r&&typeof e.save?.replace=="function"&&(r.replace=e.save.replace),e.save!==r&&(e.save=r)}e.hasUnsavedChanges=t["core/unsaved-warning.js"]?.hasUnsavedChanges??e.hasUnsavedChanges??(()=>!1);let s=t["core/snapshot.js"];s&&(e.getHTML||(e.getHTML=s.getPageContents),e.addDocumentTransform||(e.addDocumentTransform=s.addDocumentTransform),e.onSnapshot||(e.onSnapshot=s.onSnapshot));let u=t["lib/cache-bust.js"];u&&!e.cacheBust&&(e.cacheBust=u.default);let n=t["core/recovery.js"];n&&!e.recovery&&(e.recovery=n.recovery)}function N(t,e,o=j){let s=window.clay;t==="plugins/undo.js"?s.undo=e.undo||e.default:t==="plugins/unsent.js"?s.unsent=e.unsent:t==="sync/live-sync.js"?(s.morph=e.morph,s.conflicts=e.conflicts,o["core/page-data.js"].setPageDataLiveSync(e.liveSync)):t==="plugins/live.js"?s.live=e.live:t==="plugins/page.js"?s.page=e.page:t==="plugins/upgrade.js"?(s.save=s.save||{},s.save.replace=e.replace):t==="plugins/cms.js"?s.cms=e.cms||e.default:t==="plugins/upload.js"?s.upload=e.upload||e.default:t==="plugins/people.js"?(s.people=e.people,s.author=e.author,Object.defineProperty(s,"me",{get:e.currentMe,configurable:!0,enumerable:!0})):t==="plugins/message.js"?s.message=e.message:t==="plugins/like.js"?s.like=e.like:t==="plugins/wire.js"?s.wire=e.wire||e.default:t==="plugins/ai-edit.js"?s.aiEdit=e.aiEdit||e.default:t==="plugins/demo.js"?s.demo=e.demo:t==="plugins/richclay.js"?s.RichClay=e.RichClay||e.default:t==="plugins/quickcrop.js"?s.quickcrop=e.quickcrop||e.default:t==="plugins/sortable.js"?s.sortable=e.sortable:t==="plugins/source.js"?s.source=e.source||e.default:t==="plugins/visitor-drafts.js"||t==="plugins/visitor-drafts-owner.js"?s.visitorDrafts=e.visitorDrafts:t==="plugins/bind-text.js"&&(s.bindText=e.bindText)}function Ee(t){t.isEditMode||document.addEventListener("click",e=>{e.target.closest?.("[trigger-save]")&&(t.isEditMode||(console.info("clayjs: you're not the owner of this page; changes stay local"),document.dispatchEvent(new CustomEvent("clay:view-save-attempt"))))})}export{He as boot,Oe as mountDerivedEngine};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{a as Ce}from"../c-AQYCG7QW.js";import{c as Se}from"../c-I2IFKJX2.js";import{e as $e,g as N,h as Be,j as ae,l as ve,n as Ee,p as Pe,q as d}from"../c-BJ7YQ5QZ.js";import{a as De}from"../c-4JZDZFF6.js";import{b as W,c as ye,d as re,e as w,f as Fe}from"../c-VAK7SG37.js";import{b as T}from"../c-MHI3GYKF.js";import{b as Ke}from"../c-TUGVINJR.js";import{a as le,b as We}from"../c-FILLTJA7.js";import{b as m}from"../c-NUHP2XDB.js";import"../c-TWCXBWS3.js";import{a as Ne}from"../c-VKEDWYDF.js";import{m as _e,n as se}from"../c-NLZ5AN4L.js";import"../c-4ASQPRQL.js";import"../c-GQ6F6IDK.js";import"../c-I2SCCUEW.js";import"../c-5VYOWDTI.js";import"../c-GSRLXYWL.js";import"../c-X5LNHET5.js";import"../c-WYFDLITL.js";import"../c-UGHH4MB3.js";import{a as xe}from"../c-LA2BW7UY.js";import"../c-GVPNDIKJ.js";import"../c-ATKAOH23.js";import"../c-EK63G3CG.js";import"../c-NQJRVJ56.js";import"../c-XGH4GS2T.js";import"../c-IJUK2GPW.js";import{k as He}from"../c-3O7OBDCM.js";import"../c-BPF2NSPV.js";import"../c-P7KNDG34.js";import"../c-CYWLPPUS.js";import"../c-N7JPUPGC.js";import"../c-EGTIAL6P.js";import"../c-XQXZAO7N.js";import"../c-S7LK4KUE.js";import"../c-VG5XIN4T.js";import"../c-2YYDMLNZ.js";import"../c-HA6INT6J.js";import{h as J,o as Ie}from"../c-ICMAOOGK.js";import"../c-WRBKEJD4.js";import"../c-VHNSBD2M.js";var Ye="ai-edit",ft="h1,h2,h3,h4,h5,h6,p,figure",pt="p,h1,h2,h3,h4,h5,h6,li,dt,dd,blockquote,pre,figcaption,td,th",ht="section,article,aside,header,footer,nav,main,div,ul,ol,dl,table,figure,form",Je="script,style,template,textarea,input,select,button,iframe,svg,math",mt=900*1024,gt="This section is too large for AI editing; select a smaller part.",bt="The save did not finish; the edit is still on the page.",wt=0,a=null,r,g,c,y,E,h,b,v,L,D,$,B,R,F={},p=null,k=null,H=null,de=!1,ie=new WeakMap,ge=new Set,f=null,U=null,x=null,_,P,ue=null,C=null,z=null,A=null,Z=null,fe=[],q=null,Ae=0;function Xe(e){ie.delete(e),ge.delete(e)}function Me(e,t){if(!t){Xe(e);return}ie.set(e,t),ge.add(e)}var Qe="clay-ai-edit",qe="AI editing is turned off. Turn it on from the app\u2019s menu.";async function Ze(){let t=(await Se.helpers()).find(n=>n.name===Ye);return t&&(t.state==="ready"||t.state==="unavailable")?t.state:null}function xt(){xe.pause()}function Re(){xe.resume()}function ce(e){if(!(e instanceof Element))return null;let t=e.closest("[data-edit-id]");if(!t)return null;let n=e.closest(ft);return n&&t.contains(n)?n:t}function yt(e){if(e===document.body)return"document";let t=e.getAttribute("data-edit-id");if(t)return t;let n=e.closest("[data-edit-id]");return n?n.getAttribute("data-edit-id")+" \u203A "+e.tagName.toLowerCase():e.id?"#"+e.id:e.tagName.toLowerCase()}function be(){let e=window.getSelection();return!e||e.rangeCount===0||e.isCollapsed?null:e.getRangeAt(0)}function et(e){let t=e.commonAncestorContainer;if(t.nodeType!==1&&(t=t.parentElement),!t||!document.body.contains(t))return null;if(t===document.body)return document.body;if(t.closest("[data-clay-ai-edit]")||t.closest(J)||t.closest(Je))return null;if(t.closest("[data-edit-id]"))return ce(t);let n=t.closest(pt)||t.closest(ht);return n&&n!==document.body?n:null}function tt(e,t){if(!e||!t||!t.contains(e.commonAncestorContainer))return;let n=e.toString();if(!n.trim())return;let i=document.createRange();i.selectNodeContents(t),i.setEnd(e.startContainer,e.startOffset);let o=i.toString().length;return{text:n,start:o,end:o+n.length}}function pe(e){let t=be();if(t){if(e===document.body){let n=t.toString();return n.trim()?{text:n,start:void 0,end:void 0}:void 0}return tt(t,e)}}function nt(){let e=document.body.cloneNode(!0);return e.querySelectorAll(J).forEach(t=>t.remove()),e.outerHTML}function vt(e,t,n){let{HyperMorph:i}=le();return i.morph(e,t,{morphStyle:"outerHTML",restoreFocus:!0,scripts:n})}function he(e,t,{rewind:n=!1}={}){let{HyperMorph:i,mergeTagRecognizers:o}=le(),s=n?{merge:!1,handle:!1}:{mergeBase:e.snapshot,mergeTags:o,handle:!1};e.docMode?(typeof t=="string"&&(t=new DOMParser().parseFromString(t,"text/html").body),i.morph(document.body,t,{morphStyle:"outerHTML",restoreFocus:document.activeElement?.localName!=="clay-editor-ui",scripts:s,callbacks:{beforeNodeRemoved:l=>!(l.nodeType===1&&l.matches(J))}})):vt(e.el,t,s),Ke()}function Et(e,t){let n=e.search(new RegExp("<"+t+"(\\s|>)","i"));if(n===-1)return null;let i=e.slice(n).replace(/\s*`{1,3}\s*$/,"");if(t.toLowerCase()==="body")return new DOMParser().parseFromString(i,"text/html").body;let o=document.createElement("template");o.innerHTML=i;let s=o.content.firstElementChild;return!s||s.tagName.toLowerCase()!==t.toLowerCase()?null:s}function Ct(e,t,n){let i=e===document.body,o=[...t.matchAll(/(?<![\w\u00C0-\u024F.@\/:-])@([\w.-]*[/.][\w./-]*)/g)].map(u=>u[1].replace(/\.+$/,"")).filter(u=>u!=="page").filter(u=>/[/.]/.test(u)),s=i?nt():e.outerHTML,l={id:"req-"+Date.now().toString(36)+"-"+ ++wt,editId:yt(e),tag:e.tagName.toLowerCase(),elementHTML:s,comment:t,contextRefs:o};return n&&(l.quote=n.text,Number.isInteger(n.start)&&(l.selection={start:n.start,end:n.end})),!i&&/(?<![\w\u00C0-\u024F.@\/:-])@page(?![\w\/-]|\.\w)/.test(t)&&(l.page=!0),{id:l.id,el:e,docMode:i,tag:l.tag,reassertId:i?null:e.getAttribute("data-edit-id"),snapshot:s,payload:l,state:"requesting",paused:!1,handle:null,finalCandidate:null}}async function St(e,t,n){if(a=Ct(e,t,n),new Blob([JSON.stringify(a.payload)]).size>mt){a=null,me(gt,"warn");return}if(Me(e,t),Pt(),a.paused=!0,xt(),k={},te("working"),O("Sending\u2026"),a.payload.page&&await window.clay.save(),!a)return;let i=Se.send(a.payload,{helper:Ye,onStatus:({text:s})=>{a?.handle===i&&O(s)}});a.handle=i;let o=await i.done;!a||a.handle!==i||(await We(),!(!a||a.handle!==i)&&(o.state==="done"?kt(o.result||{}):o.state==="cancelled"?Q("HTML Clay stopped this edit."):Q(o.error||"the helper reported an error")))}var Tt=/^(on|hx-on|x-|@|:|v-on:|v-bind:|data-on[-:])/,Lt=new Set(["iframe","frame","object","embed","base","link"]);function At(e){let t=e.replace(/[\t\n\r]/g,"").replace(/^[\u0000- ]+/,"").toLowerCase();return t.startsWith("javascript:")||t.startsWith("vbscript:")}function Mt(e){let t=(e.getAttribute("type")||"").trim().toLowerCase();return!t||/javascript|ecmascript/.test(t)||["module","importmap","speculationrules"].includes(t)}function Te(e){return[...e.attributes].map(t=>t.name.toLowerCase()+"="+t.value).sort().join(" ")}function ze(e){let t=new Map,n=i=>t.set(i,(t.get(i)||0)+1);for(let i of[e,...e.querySelectorAll("*")]){let o=i.tagName.toLowerCase();o==="script"?Mt(i)&&n("script "+Te(i)+"|"+i.textContent.trim()):(Lt.has(o)||o==="meta"&&i.hasAttribute("http-equiv")||(o==="animate"||o==="set")&&/href/i.test(i.getAttribute("attributeName")||""))&&n(o+" "+Te(i));for(let s of i.attributes){let l=s.name.toLowerCase();Tt.test(l)?n(o+" "+l+"="+s.value.trim()):l==="srcdoc"?n(o+" srcdoc="+s.value):At(s.value)&&n(o+" "+l+"="+s.value)}}return t}function Rt(e,t,n){let i=n?new DOMParser().parseFromString(t,"text/html").body:(()=>{let s=document.createElement("template");return s.innerHTML=t,s.content.firstElementChild})(),o=i?ze(i):new Map;for(let[s,l]of ze(e))if(l>(o.get(s)||0))return!0;return!1}var Ot="The reply adds a script or event handler, so it was not applied. AI editing changes content, not code.";function kt(e){if(!a||a.state!=="requesting")return;a.state="deciding";let t=[],n=Et(e.html||"",a.tag);if(!n){Q(`reply is not a single <${a.tag}> element`);return}if(!a.docMode){let i=document.createElement("template");i.innerHTML=e.html||"",i.content.children.length>1&&t.push("reply had extra root elements \u2014 kept the first")}if(a.reassertId&&n.setAttribute("data-edit-id",a.reassertId),Rt(n,a.snapshot,a.docMode)){Q(Ot);return}_e(),a.held=!0,a.finalCandidate=n;try{he(a,n)}catch(i){Q("the reply could not be applied: "+(i?.message||i));return}S(),Xe(a.el),te("ready"),O(Ht(t,e.model),t.length?"warn":"")}function Ht(e,t){let n=["Edit ready.",...e.map(i=>"\u26A0 "+i)];return t&&n.push(`(${t})`),n.join(" ")}function Q(e){a&&(oe(),te("error"),O(e,"warn"))}function oe(){let e=a;if(a=null,!!e)try{(e.state==="requesting"||e.state==="deciding")&&le()&&he(e,e.snapshot,{rewind:!0})}finally{e.paused&&Re(),e.held&&se(),S()}}async function it(){let e=a;if(!e)return;a=null;let t=e.docMode?nt():e.el.outerHTML;try{he(e,e.snapshot,{rewind:!0})}finally{e.paused&&Re(),e.held&&se({replay:!1})}he(e,t),S(),te("saving"),O("Saving\u2026");let n=k,i=await window.clay.save();if(n===k){if(i&&i.ok===!1){te("error"),O(i.msg||bt,"warn");return}O(i&&i.msg||"Saved",i&&i.msgType==="error"?"warn":""),Bt()}}function ot(){a?.handle?.cancel(),oe(),V()}var Ge=["z-index:99999","padding:0","display:inline-grid","place-items:center","line-height:1",`box-shadow:${re}`];function K(e,t,n){return e.setAttribute(t,n),e}function It(){let{signal:e}=Z;q=document.createElement("style"),q.setAttribute("clay",$e),q.textContent=`
|
|
2
|
-
[editmode\\:contenteditable][contenteditable]:focus {
|
|
3
|
-
outline: 1px solid #4a4a6a; outline-offset: 4px; border-radius: 2px;
|
|
4
|
-
}
|
|
5
|
-
::highlight(clay-ai-edit) { background-color: ${w["brass-soft"]} !important; }
|
|
6
|
-
`,document.head.appendChild(q);let t=`color-scheme:${De()}`;g=K(ae("div",["box-sizing:content-box","position:fixed","z-index:99998","pointer-events:none",`border:2px solid ${w.brass}`,"border-radius:0",t]),"data-clay-ai-edit","ring"),d(g,!1),r=K(ve("div",["position:fixed","z-index:99999","width:min(28rem, calc(100vw - 32px))","padding:12px","border-radius:12px",`box-shadow:${re}`,`font:13px/1.5 ${W}`,t]),"data-clay-ai-edit","panel"),d(r,!1),r.setAttribute("role","dialog"),r.setAttribute("aria-label","AI edit");let n=(u,M)=>K(u,"data-clay-ai-edit-part",M);E=n(ae("div",["position:absolute","width:12px","height:12px","pointer-events:none",`background:${w.surface}`,`border-left:1px solid ${w["line-2"]}`,`border-top:1px solid ${w["line-2"]}`]),"pointer"),d(E,!1),c=n(Pe("textarea",{rules:["flex:1","min-width:0","min-height:40px","max-height:9.5em","resize:none","overflow-y:auto","padding:8px 12px",`font:15px/1.45 ${W}`]}),"input"),c.rows=1,c.placeholder="Describe the change",c.setAttribute("aria-label","Describe the change"),c.title="Enter sends \xB7 Shift+Enter adds a line \xB7 @fable or @codex picks another agent \xB7 @file.ext adds context",y=n(Ee("div",["display:block","margin-top:0",`color:${w.muted}`,`font:12.5px/1.5 ${ye}`]),"status"),y.setAttribute("role","status"),y.setAttribute("aria-live","polite"),F.send=n(N("Send",{variant:"primary",extra:["min-height:40px","flex:none"]}),"send"),d(F.send,!0,"inline-flex");let i=ae("div",["display:flex","align-items:flex-start","gap:8px"]);i.append(c,F.send),r.append(E,i,y),v=K(ve("div",["position:fixed","left:50%","bottom:16px","transform:translateX(-50%)","z-index:99999","width:min(35rem, calc(100vw - 32px))","padding:8px 10px","border-radius:12px","gap:8px","align-items:center",`box-shadow:${re}`,`font:13px/1.5 ${W}`,t]),"data-clay-ai-edit","status-bar"),d(v,!1,"flex"),L=n(Ee("div",["display:block","flex:1","min-width:0","overflow:hidden","text-overflow:ellipsis","white-space:nowrap",`color:${w.muted}`,`font:12.5px/1.5 ${ye}`]),"bar-status"),L.setAttribute("role","status"),L.setAttribute("aria-live","polite"),D=n(N("Stop",{extra:["flex:none"]}),"bar-stop"),$=n(N("Keep",{variant:"primary",extra:["flex:none"]}),"bar-keep"),B=n(N("Revert",{variant:"quiet",extra:["flex:none"]}),"bar-revert"),R=n(Be(Fe.toastClose,{label:"Dismiss error"}),"bar-close"),R.pin({flex:"none"});for(let u of[D,$,B,R])d(u,!1,"inline-flex");v.append(L,D,$,B,R),h=K(N("AI",{small:!0,extra:["position:fixed","width:26px","height:26px",`font:600 11px/1 ${W}`,...Ge,t]}),"data-clay-ai-edit","chip"),h.title="Comment on this (\u2318J)",d(h,!1,"inline-grid"),b=K(N("AI",{extra:["position:fixed","width:40px","height:40px",`font:600 14px/1 ${W}`,...Ge,t]}),"data-clay-ai-edit","bubble"),b.title="Comment on the whole page",Le(),document.body.append(g,r,v,h,b),G(),F.send.addEventListener("click",Ve),D.addEventListener("click",ot),$.addEventListener("click",it),B.addEventListener("click",()=>{oe(),V()}),R.addEventListener("click",()=>{p==="error"&&V()}),c.addEventListener("keydown",u=>{u.key==="Enter"&&!u.shiftKey&&(u.preventDefault(),F.send.hidden||Ve())}),c.addEventListener("input",ee),h.addEventListener("mousedown",u=>u.preventDefault()),h.addEventListener("click",()=>{let u=U,M=P;j(),u&&!a&&!p&&ne(u,M||pe(u))}),b.addEventListener("click",()=>{if(!(a||p)){if(!r.hidden&&f===document.body){c.value.trim()?c.focus():X();return}ne(document.body,pe(document.body))}}),window.addEventListener("scroll",()=>{S(),j()},{passive:!0,signal:e}),window.addEventListener("resize",()=>{Le(),r&&!r.hidden&&ee(),S()},{passive:!0,signal:e});let o=()=>{Le(),S()};document.addEventListener("hcms:open",()=>{o(),setTimeout(o,350)},{signal:e}),document.addEventListener("hcms:close",()=>{o(),setTimeout(o,350)},{signal:e});let s=new MutationObserver(u=>{G();let M=I=>[...I].some(Y=>Y.nodeType===1&&Y.hasAttribute("data-hcms-toggle-host"));u.some(I=>M(I.addedNodes)||M(I.removedNodes))&&o()});s.observe(document.body,{childList:!0}),fe.push(s);let l=new MutationObserver(()=>{f&&!f.isConnected&&st()});l.observe(document.body,{childList:!0,subtree:!0}),fe.push(l)}function rt(){f?.isConnected&&S()}function ee(){m(c,"height","auto"),c.value&&m(c,"height",c.scrollHeight+2+"px"),rt()}function G(){let e=b?.ownerDocument;if(!e)return;let t=!p&&A==="ready"&&!!e.querySelector("[data-edit-id]");d(b,t,"inline-grid"),t&&T(b)}function Nt(e){!e||typeof window.Highlight!="function"||!window.CSS?.highlights||window.CSS.highlights.set(Qe,new window.Highlight(e))}function we(){window.CSS?.highlights?.delete(Qe)}function at(){let e=A==="ready";c.disabled=!e,e?y.textContent===qe&&me(""):me(qe,"warn"),d(F.send,e,"inline-flex"),G()}function Ft(){Ze().then(e=>{r&&(A=e||"unavailable",!r.hidden&&!a?at():G())}).catch(()=>{})}function Le(){if(!b)return;let e=document.querySelector("[data-hcms-toggle-host]"),t=e&&e.getBoundingClientRect(),n=!!t&&t.width>0&&t.height>0;b.pin({right:n?`${Math.round((document.documentElement.clientWidth||window.innerWidth)-t.left+8)}px`:"16px",bottom:n?`${Math.round((document.documentElement.clientHeight||window.innerHeight)-t.bottom)}px`:"16px"}),T(b)}function Dt(e){clearTimeout(x),x=null,U=e,P=void 0;let t=e.getBoundingClientRect();h.pin({left:Math.min(t.right+8,window.innerWidth-34)+"px",top:Math.max(8,t.top)+"px"}),d(h,!0,"inline-grid"),T(h)}function j(){clearTimeout(x),x=null,d(h,!1,"inline-grid"),U=null,P=void 0}function je(){h.hidden||x||(x=setTimeout(j,400))}function $t(){if(a||p||!r.hidden||A!=="ready"||lt())return;let e=be(),t=e&&et(e),n=t&&tt(e,t);if(!n){P&&j();return}let i=typeof e.getClientRects=="function"?e.getClientRects():[],o=i.length?i[i.length-1]:t.getBoundingClientRect();clearTimeout(x),x=null,U=t,P=n,h.pin({left:Math.min(o.right+6,window.innerWidth-34)+"px",top:Math.max(8,o.top+o.height/2-13)+"px"}),d(h,!0,"inline-grid"),T(h)}function me(e,t){m(y,"margin-top",e?"8px":"0"),y.textContent=e||"",t==="warn"?y.setAttribute("data-tone","warn"):y.removeAttribute("data-tone"),m(y,"color",t==="warn"?w.ox:w.muted),rt()}function O(e,t){L.textContent=e||"",t==="warn"?L.setAttribute("data-tone","warn"):L.removeAttribute("data-tone"),m(L,"color",t==="warn"?w.ox:w.muted)}function te(e){clearTimeout(H),H=null;let t=!!p,n=document.activeElement;p=e;let i={working:[D],ready:[$,B],error:[R],saving:[]}[e]||[],o=[D,$,B,R];for(let l of o)d(l,i.includes(l),"inline-flex");j(),d(v,!0,"flex"),G(),S(),T(v);let s=i[0];s&&(!t||o.includes(n)&&!i.includes(n))&&s.focus({preventScroll:!0})}function Bt(){clearTimeout(H);let e=k;H=setTimeout(()=>{e&&e===k&&V()},1500)}function V(e){e!==void 0&&e!==k||(clearTimeout(H),H=null,k=null,r.hidden||Oe(),p=null,d(v,!1,"flex"),O(""),f=null,C=null,z=null,_=void 0,we(),d(r,!1),c.value="",d(g,!1),d(E,!1),G())}function S(){if(!f)return;if(!f.isConnected){st();return}if(f===document.body){if(d(g,!1),d(E,!1),r.hidden)return;let I=b.getBoundingClientRect(),Y=r.offsetWidth||480;m(r,"left",Math.max(16,Math.min((I.right||window.innerWidth-16)-Y,window.innerWidth-Y-16))+"px"),m(r,"top",Math.max(16,(I.top||window.innerHeight-56)-(r.offsetHeight||120)-12)+"px");return}let e=f.getBoundingClientRect();if(d(g,!!p||!_||!!a),m(g,"left",e.left-5+"px"),m(g,"top",e.top-5+"px"),m(g,"width",e.width+6+"px"),m(g,"height",e.height+6+"px"),r.hidden)return;let t=C&&C.startContainer.isConnected&&typeof C.getBoundingClientRect=="function"?C.getBoundingClientRect():null,n=t&&(t.width||t.height)?t:e,i=r.offsetWidth||480,o=Math.max(16,Math.min(n.left,window.innerWidth-i-16)),s=n.bottom+10,l=r.offsetHeight||120;s+l>window.innerHeight-16&&(s=Math.max(16,n.top-l-10)),m(r,"left",o+"px"),m(r,"top",s+"px");let u=s>=n.bottom,M=Math.max(14,Math.min(n.left+10-o,i-28));d(E,!0),m(E,"left",M+"px"),m(E,"top",u?"-7px":l-6+"px"),m(E,"transform",u?"rotate(45deg)":"rotate(225deg)")}function ne(e,t){!r.hidden&&f&&f!==e&&Oe();let n=t?be():null,i=document.activeElement;z=i&&i!==document.body&&!r.contains(i)?i:null,f=e,C=n?n.cloneRange():null,j(),d(r,!0),_=t;let o=t?t.text.trim().length>400?t.text.trim().slice(0,400)+"\u2026":t.text.trim():"";r.dataset.quote=o,me(""),c.value=ie.get(e)||"",Nt(C),at(),S(),ee(),T(r),T(g),c.focus(),Ft()}function Oe(){f&&Me(f,c.value)}function X(){a&&(a.handle?.cancel(),oe());let e=z,t=r.contains(document.activeElement);Oe(),f=null,C=null,z=null,_=void 0,we(),d(r,!1),d(g,!1),c.value="",ee(),t&&e&&e.isConnected&&e.focus({preventScroll:!0})}function Pt(){C=null,z=null,_=void 0,we(),d(r,!1),c.value="",ee(),S(),T(g)}function st(){let e=a;e&&(e.handle?.cancel(),oe()),V()}function Ve(){let e=c.value.trim();!e||!f||a||A!=="ready"||St(f,e,_)}var _t=/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent||"");function Wt(e){return!(_t?e.metaKey&&!e.ctrlKey:e.ctrlKey&&!e.metaKey)||e.shiftKey||e.altKey||e.repeat||e.isComposing?!1:e.code==="KeyJ"||(e.key||"").toLowerCase()==="j"}function lt(){let e=Ce();return!e||e===document.body?!1:r&&r.contains(e)?!r.hidden:e.matches("input,textarea,select")}var Kt='[data-clay-modal], dialog[open], [aria-modal="true"]',qt='input,textarea,select,[contenteditable=""],[contenteditable="true"]';function zt(e){if(e.defaultPrevented||document.querySelector(Kt))return!1;let t=Ce();return!t||t===document.body||r.contains(t)||v.contains(t)?!0:t.isContentEditable===!0?!1:!t.matches(qt)}function Gt(){let{signal:e}=Z;document.addEventListener("pointerdown",n=>{de=r.contains(n.target)},{capture:!0,signal:e}),document.addEventListener("click",n=>{let i=de;if(de=!1,i||r.contains(n.target)||v.contains(n.target)||h.contains(n.target)||b.contains(n.target)||a||p)return;let o=n.target.closest?.("[data-edit-id]"),s=o?ce(n.target):null;if(o&&s===o){let l=!r.hidden&&o===f;r.hidden||X(),l||ne(o,pe(o))}else r.hidden||X()},{signal:e});let t=0;document.addEventListener("mousemove",n=>{let i=Date.now();if(i-t<80)return;if(t=i,a||p||!r.hidden){je();return}if(A!=="ready"||P)return;if(h.contains(n.target)){clearTimeout(x),x=null;return}let o=ce(n.target);o?Dt(o):je()},{signal:e}),document.addEventListener("keydown",n=>{if(Wt(n)){if(p||a||lt())return;f&&!f.isConnected&&X();let i=be(),o=i?et(i):null;if(!o){let s=window.getSelection(),l=s&&s.anchorNode;l&&l.nodeType!==1&&(l=l.parentElement),o=l&&ce(l)||U}if(!o)return;n.preventDefault(),ne(o,pe(o));return}if(n.key==="Escape"&&zt(n)){if(p==="working"){ot();return}if(p==="ready"){it();return}if(p==="error"){V();return}p||r.hidden||X()}},{signal:e}),document.addEventListener("selectionchange",()=>{clearTimeout(ue),ue=setTimeout($t,150)},{signal:e})}async function dt(){let e=++Ae;return A=await Ze(),e===Ae}function ct(){!A||r||(Z=new AbortController,It(),Gt())}async function ke(){!He()||r||await dt()&&ct()}function Ue(e){return e instanceof Element&&e.ownerDocument===document&&document.body.contains(e)&&!e.closest("[data-clay-ai-edit]")&&!e.closest(J)&&!e.closest(Ie)&&!e.closest(Je)}async function jt(e,{prompt:t}={}){return!Ue(e)||(await ke(),await new Promise(n=>setTimeout(n,0)),!r||a||p||!Ue(e))?!1:!r.hidden&&f===e?(c.focus(),!0):(typeof t=="string"&&!ie.has(e)&&Me(e,t),ne(e,null),!0)}function Vt(){Ae++;let e=a;a=null;try{e?.handle?.cancel(),e&&(e.paused&&Re(),e.held&&se())}catch{}clearTimeout(ue),ue=null,clearTimeout(x),x=null,clearTimeout(H),H=null,we(),Z?.abort(),Z=null;for(let t of fe)t.disconnect();fe=[];for(let t of[q,g,r,v,h,b])t?.remove();q=g=r=c=y=E=v=L=null,D=$=B=R=h=b=null,F={},p=null,k=null,f=null,C=null,z=null,_=void 0,U=null,P=void 0,de=!1,A=null,ie=new WeakMap,ge.clear()}function sn(){return{id:"clay:ai-edit",order:950,prepare(e={}){let t=e.initial===!0;return{ready:t?ut:dt(),enable(){t||ct()},quiesce(){let n=r&&!r.hidden&&c.value.trim()!==""||[...ge].some(o=>o.isConnected),i=[];if(a&&i.push(a.id),p==="saving"&&i.push("save"),n&&i.push("prompt"),!!i.length)throw Object.assign(new Error("clay.aiEdit: an edit here is still unresolved"),{code:"pending-input",pending:i})},resume(){},dispose(){Vt()}}}}}var ut=null;Ne(()=>{ut=ke().then(()=>{},()=>{})});var ln={init:ke,open:jt};export{ln as aiEdit,sn as aiEditParticipant,sn as modeParticipant};
|