| @@ -1,30 +1,20 @@ | ||
| 1 | -(function(){"use strict";function z(o,...e){return{__wpdHtml:!0,strings:o,values:e}}function me(o){return!!o&&o.__wpdHtml===!0}const be="$$wpd$$",w=/\$\$wpd\$\$(\d+)\$\$/g;function ge(o){let e=o[0];for(let t=1;t<o.length;t++)e+=`${be}${t-1}$$`+o[t];return e}const Z=new WeakMap;function Q(o){const e=Z.get(o);if(e)return e;const t=document.createElement("template");t.innerHTML=ge(o);const n=[],s=(h,d)=>{if(h.nodeType===Node.ELEMENT_NODE){const v=h;for(const f of Array.from(v.attributes)){const b=f.name,p=f.value,g=b[0];if(w.test(p))if(w.lastIndex=0,g==="@"){const u=w.exec(p);w.lastIndex=0,n.push({path:d,kind:"event",name:b.slice(1),valueIndex:u?Number(u[1]):0}),v.removeAttribute(b)}else if(g==="."){const u=w.exec(p);w.lastIndex=0,n.push({path:d,kind:"prop",name:b.slice(1),valueIndex:u?Number(u[1]):0}),v.removeAttribute(b)}else if(g==="?"){const u=w.exec(p);w.lastIndex=0,n.push({path:d,kind:"bool",name:b.slice(1),valueIndex:u?Number(u[1]):0}),v.removeAttribute(b)}else{const u=[],y=[];let x=0,E;for(w.lastIndex=0;(E=w.exec(p))!==null;)u.push(p.slice(x,E.index)),y.push(Number(E[1])),x=E.index+E[0].length;u.push(p.slice(x)),n.push({path:d,kind:"attr",name:b,template:u,valueIndices:y}),v.setAttribute(b,"")}}}const a=Array.from(h.childNodes);let m=0;for(let v=0;v<a.length;v++){const f=a[v],b=v+m;if(f.nodeType===Node.TEXT_NODE){const p=f.textContent||"";if(!w.test(p)){w.lastIndex=0;continue}w.lastIndex=0;const g=f.parentNode;let u=0,y;const x=[],E=[];for(w.lastIndex=0;(y=w.exec(p))!==null;){y.index>u&&x.push(document.createTextNode(p.slice(u,y.index)));const A=document.createTextNode("");x.push(A),E.push({path:[...d,b+x.length-1],kind:"node",valueIndex:Number(y[1])}),u=y.index+y[0].length}u<p.length&&x.push(document.createTextNode(p.slice(u)));for(const A of x)g.insertBefore(A,f);g.removeChild(f),m+=x.length-1,n.push(...E)}else s(f,[...d,b])}};s(t.content,[]);const i={template:t,buildParts:h=>{const d=[];for(const a of n){let m=h;for(const v of a.path)m=m.childNodes[v];a.kind==="node"?d.push({kind:"node",valueIndex:a.valueIndex,child:{anchor:m,state:null}}):a.kind==="attr"?d.push({kind:"attr",element:m,name:a.name,template:a.template,valueIndices:a.valueIndices}):a.kind==="event"?d.push({kind:"event",valueIndex:a.valueIndex,element:m,name:a.name}):a.kind==="prop"?d.push({kind:"prop",valueIndex:a.valueIndex,element:m,name:a.name}):a.kind==="bool"&&d.push({kind:"bool",valueIndex:a.valueIndex,element:m,name:a.name})}return d}};return Z.set(o,i),i}const ee=new WeakMap;function ve(o,e){for(const t of o.nodes)if(t.parentNode!==e)return!1;return!0}function xe(o,e){const t=ee.get(e);if(t&&t.strings===o.strings&&ve(t,e)){D(t.parts,o.values);return}const n=Q(o.strings),s=n.template.content.cloneNode(!0),r=n.buildParts(s),i=Array.from(s.childNodes);for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(s),D(r,o.values),ee.set(e,{strings:o.strings,parts:r,nodes:i})}function D(o,e){for(const t of o)if(t.kind==="node")U(t.child,e[t.valueIndex]);else if(t.kind==="attr"){let n=t.template[0];for(let s=0;s<t.valueIndices.length;s++)n+=te(e[t.valueIndices[s]]),n+=t.template[s+1];n!==t.last&&(t.last=n,n===""?t.element.removeAttribute(t.name):t.element.setAttribute(t.name,n))}else if(t.kind==="event"){const n=e[t.valueIndex];n!==t.current&&(t.current&&t.element.removeEventListener(t.name,t.current),n&&t.element.addEventListener(t.name,n),t.current=n)}else if(t.kind==="prop"){const n=e[t.valueIndex];n!==t.last&&(t.last=n,t.element[t.name]=n)}else if(t.kind==="bool"){const n=!!e[t.valueIndex];n!==t.last&&(t.last=n,n?t.element.setAttribute(t.name,""):t.element.removeAttribute(t.name))}}function U(o,e){if(e==null||e===!1){o.state&&(I(o.state),o.state=null);return}if(Array.isArray(e)){ke(o,e);return}if(me(e)){ye(o,e);return}if(e instanceof Node){we(o,e);return}_e(o,te(e))}function we(o,e){const t=o.state;t?.shape==="node"&&t.node===e||(t&&I(t),M(o,[e]),o.state={shape:"node",node:e})}function _e(o,e){const t=o.state;if(t?.shape==="text"){t.text!==e&&(t.node.textContent=e,t.text=e);return}t&&I(t);const n=document.createTextNode(e);M(o,[n]),o.state={shape:"text",node:n,text:e}}function ye(o,e){const t=o.state;if(t?.shape==="template"&&t.strings===e.strings){D(t.parts,e.values);return}t&&I(t);const n=Q(e.strings),s=n.template.content.cloneNode(!0),r=n.buildParts(s),i=Array.from(s.childNodes);M(o,[s]),D(r,e.values),o.state={shape:"template",strings:e.strings,parts:r,nodes:i}}function ke(o,e){const t=o.state;if(t?.shape==="array"&&t.entries.length===e.length){for(let s=0;s<e.length;s++)U(t.entries[s],e[s]);return}t&&I(t);const n=[];for(const s of e){const r=document.createTextNode("");M(o,[r]);const i={anchor:r,state:null};U(i,s),n.push(i)}o.state={shape:"array",entries:n}}function M(o,e){const t=o.anchor.parentNode;if(t)for(const n of e)t.insertBefore(n,o.anchor)}function I(o){if(o.shape==="text"){o.node.remove();return}if(o.shape==="template"){for(const e of o.parts)e.kind==="node"&&e.child.state&&(I(e.child.state),e.child.state=null);for(const e of o.nodes)e.parentNode&&e.parentNode.removeChild(e);return}if(o.shape==="node"){o.node.parentNode&&o.node.parentNode.removeChild(o.node);return}for(const e of o.entries)e.state&&I(e.state),e.anchor.remove()}function te(o){return o==null||o===!1?"":String(o)}const S=class S extends HTMLElement{constructor(){super(),this._renderScheduled=!1,this._propValues={},this.constructor.shadow?(this.attachShadow({mode:"open"}),this._renderRoot=this.shadowRoot):this._renderRoot=this,this._installPropAccessors()}static get observedAttributes(){return this.props.map(ne)}connectedCallback(){this._adoptStyles(),this.requestUpdate()}attributeChangedCallback(e,t,n){if(t===n)return;const s=Ee(e);this._propValues[s]=n,this.requestUpdate()}get classNames(){return Array.from(this.classList)}set classNames(e){if(e==null){this.removeAttribute("class");return}const n=(Array.isArray(e)?e:String(e).split(/\s+/)).map(s=>String(s).trim()).filter(s=>s!=="");this.className=n.join(" ")}requestUpdate(){this._scheduleRender()}emit(e,t){return this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0}))}_installPropAccessors(){const e=this.constructor;for(const t of e.props){if(Object.getOwnPropertyDescriptor(this,t))continue;const n=ne(t);Object.defineProperty(this,t,{get:()=>t in this._propValues?this._propValues[t]:this.getAttribute(n),set:s=>{let r;s==null||s===!1?r=null:s===!0?r="":r=String(s),this._propValues[t]=r,r===null?this.removeAttribute(n):this.setAttribute(n,r),this.requestUpdate()},enumerable:!0,configurable:!0})}}_scheduleRender(){this._renderScheduled||!this.isConnected||(this._renderScheduled=!0,queueMicrotask(()=>{this._renderScheduled=!1,this.isConnected&&xe(this.render(),this._renderRoot)}))}_adoptStyles(){const e=this.constructor;if(e.styles.length!==0)if(e.shadow&&this.shadowRoot){const t=e.styles.map(n=>n.sheet).filter(n=>n!==null);if(this.shadowRoot.adoptedStyleSheets=t,t.length!==e.styles.length){for(const n of e.styles)if(!n.sheet){const s=document.createElement("style");s.textContent=n.cssText,this.shadowRoot.appendChild(s)}}}else this._adoptLightStyles(e)}_adoptLightStyles(e){if(!S._lightStylesAdopted.has(e)){S._lightStylesAdopted.add(e);for(const t of e.styles){const n=document.createElement("style");n.dataset.osUi=this.tagName.toLowerCase(),n.textContent=t.cssText,document.head.appendChild(n)}}}};S.props=[],S.styles=[],S.shadow=!0,S._lightStylesAdopted=new WeakSet;let O=S;function oe(o,e){customElements.get(o)||customElements.define(o,e)}function ne(o){return o.replace(/[A-Z]/g,e=>"-"+e.toLowerCase())}function Ee(o){return o.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}const Ne=(()=>{try{return typeof new CSSStyleSheet().replaceSync=="function"}catch{return!1}})();function _(o,...e){let t=o[0];for(let n=1;n<o.length;n++){const s=e[n-1];if(typeof s=="string"||typeof s=="number")t+=String(s);else if(s&&s.__wpdCss)t+=s.cssText;else throw new TypeError("[os-ui] css`` interpolations must be strings, numbers, or other css`` results. Got: "+typeof s);t+=o[n]}if(Ne){const n=new CSSStyleSheet;return n.replaceSync(t),{__wpdCss:!0,sheet:n,cssText:t}}return{__wpdCss:!0,sheet:null,cssText:t}}function Ce(o){const e=[],t=[];let n=null,s=o.parentElement;for(;s&&!(s===document.body||s===document.documentElement);){const i=s.id||"";if(i.startsWith("wp-window-")){n=i.slice(10);break}if(s.tagName.toLowerCase()==="os-tabpanel"){const h=s.getAttribute("for");h&&t.unshift(h)}s=s.parentElement}n&&e.push(X(n));for(const i of t)e.push("tab-"+X(i));const r=o.getAttribute("label");return r&&e.push(X(r)),e.length===0?"os-unnamed":"os-"+e.filter(i=>i!=="").join("-")}function X(o){return o.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function Ae(o){if(o.id)return o.id;const e=Ce(o);return o.id=e,e}const q=_`:host{--_holo-fill:var( --os-ui-holo-fill,${"linear-gradient( 124deg, #afa2e8 0%, #f5a8ea 46%, #8ee9f7 100% )"} );--_holo-ink:var( --os-ui-holo-ink,#0c0b0f );--_holo-sheen:var( --os-ui-holo-sheen,linear-gradient( 124deg,rgba( 159,214,255,0.1 ) 0%,rgba( 236,155,255,0.12 ) 34%,rgba( 242,82,252,0.1 ) 58%,rgba( 147,240,198,0.09 ) 100% ) );--_holo-edge:var( --os-ui-holo-edge,linear-gradient( 124deg,rgba( 154,242,255,0.7 ) 0%,rgba( 236,155,255,0.85 ) 38%,rgba( 242,82,252,0.7 ) 62%,rgba( 159,152,255,0.6 ) 100% ) );--_holo-edge-quiet:var( --os-ui-holo-edge-quiet,linear-gradient( 124deg,rgba( 154,242,255,0.22 ) 0%,rgba( 236,155,255,0.28 ) 38%,rgba( 242,82,252,0.22 ) 62%,rgba( 159,152,255,0.2 ) 100% ) );--_holo-glow:var( --os-ui-holo-glow,0 0 0 1px rgba( 242,82,252,0.28 ),0 2px 10px rgba( 242,82,252,0.22 ) );--_holo-glow-strong:var( --os-ui-holo-glow-strong,0 0 0 1px rgba( 242,82,252,0.42 ),0 4px 18px rgba( 242,82,252,0.38 ),0 1px 3px rgba( 12,11,15,0.6 ) );--_holo-track:var( --os-ui-holo-track,rgba( 255,251,255,0.16 ) );--_holo-track-edge:var( --os-ui-holo-track-edge,#8c8f94 );--_holo-ring-color:var( --os-ui-accent-dim,#2271b1 );--_holo-focus:var( --os-ui-focus-ring,0 0 0 2px rgba( 12,11,15,0.9 ),0 0 0 4px #f252fc,0 0 12px 2px rgba( 242,82,252,0.45 ) );--_holo-focus-field:var( --os-ui-focus-ring-field,0 0 0 1px #f252fc,0 0 0 4px rgba( 242,82,252,0.18 ) );--_holo-t:var( --os-ui-holo-transition,220ms );--_holo-t-fast:var( --os-ui-motion-fast,140ms );--_holo-t-slow:var( --os-ui-motion-slow,340ms );--_holo-t-ambient:var( --os-ui-motion-ambient,12s );--_holo-spring:var( --os-ui-ease-spring,cubic-bezier( 0.32,1.5,0.55,1 ) );--_holo-ease:var( --os-ui-ease-out,cubic-bezier( 0.22,0.9,0.28,1 ) );--_holo-loop:var( --os-ui-ease-loop,cubic-bezier( 0.45,0,0.55,1 ) )}`,$e=_` .os-holo-fill{background-color:transparent;background-image:var( --_holo-fill );background-size:220% 220%;background-position:22% 28%;background-repeat:no-repeat;color:var( --_holo-ink );transition:background-position var( --_holo-t ) ease,box-shadow var( --_holo-t ) ease,filter var( --_holo-t ) ease}.os-holo-fill:hover{background-position:74% 66%}.os-holo-fill:active{background-position:88% 82%;filter:brightness( 0.94 )}@media ( prefers-reduced-motion:reduce ){.os-holo-fill{transition-duration:1ms}.os-holo-fill:hover,.os-holo-fill:active{background-position:22% 28%}}`,Se=_` .os-holo-sheen{position:relative;isolation:isolate}.os-holo-sheen::before{content:'';position:absolute;inset:0;z-index:-1;border-radius:inherit;background-image:var( --_holo-sheen );background-size:200% 200%;background-position:20% 30%;opacity:0;pointer-events:none;transition:opacity var( --_holo-t ) ease,background-position var( --_holo-t ) ease}.os-holo-sheen:hover::before,.os-holo-sheen:focus-visible::before{opacity:1;background-position:76% 68%}@media ( prefers-reduced-motion:reduce ){.os-holo-sheen::before{transition-duration:1ms}.os-holo-sheen:hover::before,.os-holo-sheen:focus-visible::before{background-position:20% 30%}}`,Ie=_` .os-holo-edge{position:relative}.os-holo-edge::after{content:'';position:absolute;inset:0;border-radius:inherit;padding:1px;background-image:var( --_holo-edge-quiet );opacity:0;pointer-events:none;-webkit-mask:linear-gradient( #000 0 0 ) content-box,linear-gradient( #000 0 0 );-webkit-mask-composite:xor;mask:linear-gradient( #000 0 0 ) content-box,linear-gradient( #000 0 0 );mask-composite:exclude;transition:opacity var( --_holo-t ) ease}.os-holo-edge:hover::after,.os-holo-edge:focus-visible::after{background-image:var( --_holo-edge );opacity:1}.os-holo-edge.is-lit::after{background-image:var( --_holo-edge );opacity:1}@media ( prefers-reduced-motion:reduce ){.os-holo-edge::after{transition-duration:1ms}}`,Re=_` .os-holo-glint{position:absolute;inset:0;border-radius:inherit;overflow:hidden;pointer-events:none}.os-holo-glint::before{content:'';position:absolute;top:-60%;bottom:-60%;width:45%;inset-inline-start:-60%;background:linear-gradient( 90deg,transparent 0%,rgba( 255,251,255,0.14 ) 45%,rgba( 255,251,255,0.22 ) 50%,rgba( 255,251,255,0.14 ) 55%,transparent 100% );transform:rotate( 18deg ) translateX( 0 );opacity:0}:hover>.os-holo-glint::before,:focus-visible>.os-holo-glint::before,:host(:hover )>.os-holo-glint::before,:host(:focus-visible )>.os-holo-glint::before{animation:os-holo-glint var( --_holo-t-slow ) var( --_holo-ease )}@keyframes os-holo-glint{0%{opacity:0;transform:rotate( 18deg ) translateX( 0 )}15%{opacity:1}85%{opacity:1}100%{opacity:0;transform:rotate( 18deg ) translateX( 240vw )}}@media ( prefers-reduced-motion:reduce ){:hover>.os-holo-glint::before,:focus-visible>.os-holo-glint::before,:host(:hover )>.os-holo-glint::before,:host(:focus-visible )>.os-holo-glint::before{animation:none}}`,Te=_` .os-holo-ring{position:absolute;inset:0;border-radius:inherit;box-shadow:0 0 0 0 var( --_holo-ring-color );opacity:0;pointer-events:none}:active:not(:disabled )>.os-holo-ring,:host(:active:not( [ disabled ] ) )>.os-holo-ring{animation:os-holo-ring var( --_holo-t-slow ) var( --_holo-ease )}@keyframes os-holo-ring{0%{opacity:0.45;box-shadow:0 0 0 0 var( --_holo-ring-color )}100%{opacity:0;box-shadow:0 0 0 10px transparent}}@media ( prefers-reduced-motion:reduce ){:active:not(:disabled )>.os-holo-ring,:host(:active:not( [ disabled ] ) )>.os-holo-ring{animation:none}}`,Le=_` .os-holo-shimmer{background-image:var( --_holo-fill );background-size:300% 300%;background-repeat:no-repeat;animation:os-holo-shimmer 2.4s var( --_holo-loop ) infinite}@keyframes os-holo-shimmer{0%{background-position:0% 50%}100%{background-position:100% 50%}}@media ( prefers-reduced-motion:reduce ){.os-holo-shimmer{animation:none;background-position:30% 50%}}`,Pe=_` .os-holo-enter{animation:os-holo-enter var( --_holo-t ) var( --_holo-spring )}@keyframes os-holo-enter{from{opacity:0;transform:scale( 0.96 )}}@media ( prefers-reduced-motion:reduce ){.os-holo-enter{animation:none}}`,se=_` input:where(:not( [ type='checkbox' ] ):not( [ type='radio' ] ) ),select,textarea{transition:background-color var( --_holo-t ) ease,border-color var( --_holo-t ) ease,box-shadow var( --_holo-t ) ease}input:where(:not( [ type='checkbox' ] ):not( [ type='radio' ] ) ):hover:not(:disabled ),select:hover:not(:disabled ),textarea:hover:not(:disabled ){border-color:var( --os-ui-border-strong,#8c8f94 )}input:where(:not( [ type='checkbox' ] ):not( [ type='radio' ] ) ):focus,input:where(:not( [ type='checkbox' ] ):not( [ type='radio' ] ) ):focus-visible,select:focus,select:focus-visible,textarea:focus,textarea:focus-visible{outline:none;border-color:var( --os-ui-accent,#2271b1 );box-shadow:var( --_holo-focus-field )}input::placeholder,textarea::placeholder{color:var( --os-ui-fg-faint,#8c8f94 );opacity:1}input::selection,textarea::selection{background:var( --os-ui-selection-bg,rgba( 159,152,255,0.6 ) );color:var( --os-ui-selection-fg,#fffbff )}@media ( prefers-reduced-motion:reduce ){input:where(:not( [ type='checkbox' ] ):not( [ type='radio' ] ) ),select,textarea{transition-duration:1ms}}`,re=_` input[ type='checkbox' ],input[ type='radio' ]{appearance:none;-webkit-appearance:none;position:relative;flex:0 0 auto;box-sizing:border-box;width:16px;height:16px;margin:0;padding:0;border:1px solid var( --_holo-track-edge );border-radius:4px;background-color:var( --_holo-track );background-image:none;background-repeat:no-repeat;cursor:inherit;transition:background-position var( --_holo-t ) ease,border-color var( --_holo-t ) ease,box-shadow var( --_holo-t ) ease}input[ type='radio' ]{border-radius:50%}input[ type='checkbox' ]:hover:not(:disabled ),input[ type='radio' ]:hover:not(:disabled ){border-color:var( --os-ui-accent,#2271b1 )}input[ type='checkbox' ]:focus-visible,input[ type='radio' ]:focus-visible{outline:none;box-shadow:var( --_holo-focus )}input[ type='checkbox' ]:checked,input[ type='checkbox' ]:indeterminate,input[ type='radio' ]:checked{border-color:transparent;background-image:var( --_holo-fill );background-size:220% 220%;background-position:22% 28%;box-shadow:var( --_holo-glow )}input[ type='checkbox' ]:checked:hover:not(:disabled ),input[ type='radio' ]:checked:hover:not(:disabled ){background-position:74% 66%}input[ type='checkbox' ]:checked:focus-visible,input[ type='radio' ]:checked:focus-visible{box-shadow:var( --_holo-focus )}input[ type='checkbox' ]:checked::after{content:'';position:absolute;inset-inline-start:50%;top:46%;width:3.5px;height:7.5px;border:solid var( --_holo-ink );border-width:0 2px 2px 0;transform:translate( -50%,-50% ) rotate( 45deg );animation:os-holo-tick 180ms cubic-bezier( 0.3,1.4,0.6,1 )}input[ type='checkbox' ]:indeterminate::after{content:'';position:absolute;inset-inline-start:50%;top:50%;width:8px;height:2px;border:0;border-radius:1px;background:var( --_holo-ink );transform:translate( -50%,-50% )}input[ type='radio' ]:checked::after{content:'';position:absolute;inset-inline-start:50%;top:50%;width:6px;height:6px;border-radius:50%;background:var( --_holo-ink );transform:translate( -50%,-50% );animation:os-holo-tick 180ms cubic-bezier( 0.3,1.4,0.6,1 )}input[ type='checkbox' ]:disabled,input[ type='radio' ]:disabled{cursor:not-allowed}@keyframes os-holo-tick{from{opacity:0;transform:translate( -50%,-50% ) rotate( 45deg ) scale( 0.4 )}}@media ( prefers-reduced-motion:reduce ){input[ type='checkbox' ]:checked::after,input[ type='radio' ]:checked::after{animation:none}}`,ze=_` @keyframes os-holo-drift{0%{background-position:16% 26%}50%{background-position:84% 74%}100%{background-position:16% 26%}}.os-holo-alive{animation:os-holo-drift var( --_holo-t-ambient ) var( --_holo-loop ) infinite}@media ( prefers-reduced-motion:reduce ){.os-holo-alive{animation:none}}`;_` ${q} ${$e} ${Se} ${Ie} ${Re} ${Te} ${Le} ${Pe} ${se} ${re} ${ze} `;const De=_` ${q} ${re}:host{display:inline-flex;align-items:center;gap:8px;font-size:12px;color:var( --os-ui-fg,#1d2327 );cursor:pointer;-webkit-user-select:none;user-select:none}label{display:inline-flex;align-items:center;gap:8px;cursor:pointer}:host( [ disabled ] ){opacity:0.5;cursor:not-allowed}:host( [ disabled ] ) label,:host( [ disabled ] ) input[ type='checkbox' ]{cursor:not-allowed}`,T=class T extends O{render(){const e=this.label||"",t=this.checked!==null,n=this.disabled!==null;return z` | |
| 2 | - <label> | |
| 3 | - <input | |
| 4 | - type="checkbox" | |
| 5 | - ?checked=${t} | |
| 6 | - ?disabled=${n} | |
| 7 | - @change=${s=>this._onChange(s)} | |
| 8 | - /> | |
| 9 | - <span class="os-checkbox-label__text">${e}</span> | |
| 10 | - </label> | |
| 11 | - `}_onChange(e){if(this.disabled!==null)return;const t=e.target.checked;t?this.setAttribute("checked",""):this.removeAttribute("checked"),this.emit("os-checkbox-change",{checked:t})}};T.props=["label","checked","disabled"],T.styles=[De],T.help=void 0;let W=T;oe("os-checkbox-label",W);const Me=_` ${q} ${se}:host{display:flex;flex-direction:column;gap:4px;font-size:13px;color:var( --os-ui-fg,#1d2327 );min-width:0}:host( [ hidden ] ){display:none}.os-textarea__label{font-size:12px;color:var( --os-ui-fg-muted,#646970 )}textarea{appearance:none;-webkit-appearance:none;display:block;width:100%;min-width:0;box-sizing:border-box;padding:8px 10px;background:var( --os-window-bg,#fff );border:1px solid var( --os-ui-border,#dcdcde );border-radius:6px;font:inherit;font-size:13px;line-height:1.45;color:var( --os-ui-fg,#1d2327 );resize:vertical}textarea:disabled{opacity:0.55;cursor:not-allowed;background:var( --os-ui-hover,rgba( 0,0,0,0.03 ) )}textarea[ aria-invalid='true' ],textarea[ aria-invalid='true' ]:hover:not(:disabled ){border-color:var( --os-ui-danger,#d63638 )}textarea[ aria-invalid='true' ]:focus,textarea[ aria-invalid='true' ]:focus-visible{border-color:var( --os-ui-danger,#d63638 );box-shadow:0 0 0 1px var( --os-ui-danger,#d63638 ),0 0 0 4px rgba( 214,54,56,0.18 )}:host( [ auto-grow ] ) textarea{resize:none;overflow:hidden}`,L=class L extends O{constructor(){super(...arguments),this._textareaEl=null}connectedCallback(){super.connectedCallback(),Ae(this)}render(){const e=this._attr("label")||"",t=this._attr("value")??"",n=this._attr("placeholder")||"",s=this._boolAttr("disabled"),r=this._boolAttr("readonly"),i=this._attr("aria-label")||e,h=this._attr("name")||"",d=Number(this._attr("rows"))||3,a=this._attr("maxlength"),m=this._attr("minlength"),v=this._boolAttr("invalid"),b=`${this.id||"os-unnamed"}__field`;return z` | |
| 12 | - ${e?z`<label class="os-textarea__label" for=${b}>${e}</label>`:z``} | |
| 1 | +(function(){"use strict";function O(t,...e){return{__wpdHtml:!0,strings:t,values:e}}function be(t){return!!t&&t.__wpdHtml===!0}const ve="$$wpd$$",x=/\$\$wpd\$\$(\d+)\$\$/g,we="$$wpd-node$$",xe=/^\$\$wpd-node\$\$(\d+)\$\$$/,_e=new Set(["style","script","textarea","title"]);function ye(t){let e="",o=!1,n=null,s=!1,r=null,a="",l=!1;for(let c=0;c<t.length;c++){const i=t[c];e+=i;for(let d=0;d<i.length;d++){const u=i[d];if(s){i.startsWith("-->",d)&&(s=!1,d+=2);continue}if(r!==null){u==="<"&&i[d+1]==="/"&&i.slice(d+2,d+2+r.length).toLowerCase()===r&&(d+=1+r.length,r=null,o=!0,l=!1,a="");continue}if(n!==null){u===n&&(n=null);continue}if(o){u==='"'||u==="'"?(n=u,l=!1):u===">"?(o=!1,l=!1,_e.has(a)&&(r=a),a=""):l&&(/[a-zA-Z0-9-]/.test(u)?a+=u.toLowerCase():l=!1);continue}if(i.startsWith("<!--",d)){s=!0,d+=3;continue}const h=i[d+1]??"";u==="<"&&/[a-zA-Z/!]/.test(h)&&(o=!0,a="",l=/[a-zA-Z]/.test(h))}c<t.length-1&&(e+=o||s||r!==null?`${ve}${c}$$`:`<!--${we}${c}$$-->`)}return e}const G=new WeakMap;function Z(t){const e=G.get(t);if(e)return e;const o=document.createElement("template");o.innerHTML=ye(t);const n=[],s=(l,c)=>{if(l.nodeType===Node.ELEMENT_NODE){const u=l;for(const h of Array.from(u.attributes)){const b=h.name,m=h.value,v=b[0];if(x.test(m))if(x.lastIndex=0,v==="@"){const g=x.exec(m);x.lastIndex=0,n.push({path:c,kind:"event",name:b.slice(1),valueIndex:g?Number(g[1]):0}),u.removeAttribute(b)}else if(v==="."){const g=x.exec(m);x.lastIndex=0,n.push({path:c,kind:"prop",name:b.slice(1),valueIndex:g?Number(g[1]):0}),u.removeAttribute(b)}else if(v==="?"){const g=x.exec(m);x.lastIndex=0,n.push({path:c,kind:"bool",name:b.slice(1),valueIndex:g?Number(g[1]):0}),u.removeAttribute(b)}else{const g=[],k=[];let w=0,E;for(x.lastIndex=0;(E=x.exec(m))!==null;)g.push(m.slice(w,E.index)),k.push(Number(E[1])),w=E.index+E[0].length;g.push(m.slice(w)),n.push({path:c,kind:"attr",name:b,template:g,valueIndices:k}),u.setAttribute(b,"")}}}const i=Array.from(l.childNodes);let d=0;for(let u=0;u<i.length;u++){const h=i[u],b=u+d;if(h.nodeType===Node.COMMENT_NODE){const m=xe.exec(h.data);if(m){const v=document.createTextNode("");h.parentNode.replaceChild(v,h),n.push({path:[...c,b],kind:"node",valueIndex:Number(m[1])})}continue}if(h.nodeType===Node.TEXT_NODE){const m=h.textContent||"";if(!x.test(m)){x.lastIndex=0;continue}x.lastIndex=0;const v=h.parentNode;let g=0,k;const w=[],E=[];for(x.lastIndex=0;(k=x.exec(m))!==null;){k.index>g&&w.push(document.createTextNode(m.slice(g,k.index)));const T=document.createTextNode("");w.push(T),E.push({path:[...c,b+w.length-1],kind:"node",valueIndex:Number(k[1])}),g=k.index+k[0].length}g<m.length&&w.push(document.createTextNode(m.slice(g)));for(const T of w)v.insertBefore(T,h);v.removeChild(h),d+=w.length-1,n.push(...E)}else s(h,[...c,b])}};s(o.content,[]);const a={template:o,buildParts:l=>{const c=[];for(const i of n){let d=l;for(const u of i.path)d=d.childNodes[u];i.kind==="node"?c.push({kind:"node",valueIndex:i.valueIndex,child:{anchor:d,state:null}}):i.kind==="attr"?c.push({kind:"attr",element:d,name:i.name,template:i.template,valueIndices:i.valueIndices}):i.kind==="event"?c.push({kind:"event",valueIndex:i.valueIndex,element:d,name:i.name}):i.kind==="prop"?c.push({kind:"prop",valueIndex:i.valueIndex,element:d,name:i.name}):i.kind==="bool"&&c.push({kind:"bool",valueIndex:i.valueIndex,element:d,name:i.name})}return c}};return G.set(t,a),a}const J=new WeakMap;function ke(t,e){for(const o of t.nodes)if(o.parentNode!==e)return!1;return!0}function Ee(t,e){const o=J.get(e);if(o&&o.strings===t.strings&&ke(o,e)){M(o.parts,t.values);return}const n=Z(t.strings),s=n.template.content.cloneNode(!0),r=n.buildParts(s),a=Array.from(s.childNodes);for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(s),M(r,t.values),J.set(e,{strings:t.strings,parts:r,nodes:a})}function M(t,e){for(const o of t)if(o.kind==="node")P(o.child,e[o.valueIndex]);else if(o.kind==="attr"){let n=o.template[0];for(let s=0;s<o.valueIndices.length;s++)n+=Q(e[o.valueIndices[s]]),n+=o.template[s+1];n!==o.last&&(o.last=n,n===""?o.element.removeAttribute(o.name):o.element.setAttribute(o.name,n))}else if(o.kind==="event"){const n=e[o.valueIndex];n!==o.current&&(o.current&&o.element.removeEventListener(o.name,o.current),n&&o.element.addEventListener(o.name,n),o.current=n)}else if(o.kind==="prop"){const n=e[o.valueIndex];n!==o.last&&(o.last=n,o.element[o.name]=n)}else if(o.kind==="bool"){const n=!!e[o.valueIndex];n!==o.last&&(o.last=n,n?o.element.setAttribute(o.name,""):o.element.removeAttribute(o.name))}}function P(t,e){if(e==null||e===!1){t.state&&(A(t.state),t.state=null);return}if(Array.isArray(e)){$e(t,e);return}if(be(e)){Ae(t,e);return}if(e instanceof Node){Ne(t,e);return}Ce(t,Q(e))}function Ne(t,e){const o=t.state;o?.shape==="node"&&o.node===e||(o&&A(o),R(t,[e]),t.state={shape:"node",node:e})}function Ce(t,e){const o=t.state;if(o?.shape==="text"){o.text!==e&&(o.node.textContent=e,o.text=e);return}o&&A(o);const n=document.createTextNode(e);R(t,[n]),t.state={shape:"text",node:n,text:e}}function Ae(t,e){const o=t.state;if(o?.shape==="template"&&o.strings===e.strings){M(o.parts,e.values);return}o&&A(o);const n=Z(e.strings),s=n.template.content.cloneNode(!0),r=n.buildParts(s),a=Array.from(s.childNodes);R(t,[s]),M(r,e.values),t.state={shape:"template",strings:e.strings,parts:r,nodes:a}}function $e(t,e){const o=t.state;if(o?.shape==="array"){const s=Math.min(o.entries.length,e.length);for(let r=0;r<s;r++)P(o.entries[r],e[r]);if(e.length<o.entries.length){for(let r=e.length;r<o.entries.length;r++){const a=o.entries[r];a.state&&A(a.state),a.anchor.remove()}o.entries.length=e.length}else for(let r=o.entries.length;r<e.length;r++){const a=document.createTextNode("");R(t,[a]);const l={anchor:a,state:null};P(l,e[r]),o.entries.push(l)}return}o&&A(o);const n=[];for(const s of e){const r=document.createTextNode("");R(t,[r]);const a={anchor:r,state:null};P(a,s),n.push(a)}t.state={shape:"array",entries:n}}function R(t,e){const o=t.anchor.parentNode;if(o)for(const n of e)o.insertBefore(n,t.anchor)}function A(t){if(t.shape==="text"){t.node.remove();return}if(t.shape==="template"){for(const e of t.parts)e.kind==="node"&&e.child.state&&(A(e.child.state),e.child.state=null);for(const e of t.nodes)e.parentNode&&e.parentNode.removeChild(e);return}if(t.shape==="node"){t.node.parentNode&&t.node.parentNode.removeChild(t.node);return}for(const e of t.entries)e.state&&A(e.state),e.anchor.remove()}function Q(t){return t==null||t===!1?"":String(t)}const $=class $ extends HTMLElement{constructor(){super(),this._renderScheduled=!1,this._propValues={},this.constructor.shadow?(this.attachShadow({mode:"open"}),this._renderRoot=this.shadowRoot):this._renderRoot=this,this._installPropAccessors()}static get observedAttributes(){return this.props.map(ee)}connectedCallback(){this._adoptStyles(),this.requestUpdate()}attributeChangedCallback(e,o,n){if(o===n)return;const s=Te(e);this._propValues[s]=n,this.requestUpdate()}get classNames(){return Array.from(this.classList)}set classNames(e){if(e==null){this.removeAttribute("class");return}const n=(Array.isArray(e)?e:String(e).split(/\s+/)).map(s=>String(s).trim()).filter(s=>s!=="");this.className=n.join(" ")}requestUpdate(){this._scheduleRender()}emit(e,o){return this.dispatchEvent(new CustomEvent(e,{detail:o,bubbles:!0,composed:!0}))}_installPropAccessors(){const e=this.constructor;for(const o of e.props){if(Object.getOwnPropertyDescriptor(this,o))continue;const n=ee(o);Object.defineProperty(this,o,{get:()=>o in this._propValues?this._propValues[o]:this.getAttribute(n),set:s=>{let r;s==null||s===!1?r=null:s===!0?r="":r=String(s),this._propValues[o]=r,r===null?this.removeAttribute(n):this.setAttribute(n,r),this.requestUpdate()},enumerable:!0,configurable:!0})}}_scheduleRender(){this._renderScheduled||!this.isConnected||(this._renderScheduled=!0,queueMicrotask(()=>{this._renderScheduled=!1,this.isConnected&&Ee(this.render(),this._renderRoot)}))}_adoptStyles(){const e=this.constructor;if(e.styles.length!==0)if(e.shadow&&this.shadowRoot){const o=e.styles.map(n=>n.sheet).filter(n=>n!==null);if(this.shadowRoot.adoptedStyleSheets=o,o.length!==e.styles.length){for(const n of e.styles)if(!n.sheet){const s=document.createElement("style");s.textContent=n.cssText,this.shadowRoot.appendChild(s)}}}else this._adoptLightStyles(e)}_adoptLightStyles(e){if(!$._lightStylesAdopted.has(e)){$._lightStylesAdopted.add(e);for(const o of e.styles){const n=document.createElement("style");n.dataset.osUi=this.tagName.toLowerCase(),n.textContent=o.cssText,document.head.appendChild(n)}}}};$.props=[],$.styles=[],$.shadow=!0,$._lightStylesAdopted=new WeakSet;let D=$;function Se(t,e){customElements.get(t)||customElements.define(t,e)}function ee(t){return t.replace(/[A-Z]/g,e=>"-"+e.toLowerCase())}function Te(t){return t.replace(/-([a-z])/g,(e,o)=>o.toUpperCase())}const Re=(()=>{try{return typeof new CSSStyleSheet().replaceSync=="function"}catch{return!1}})();function y(t,...e){let o=t[0];for(let n=1;n<t.length;n++){const s=e[n-1];if(typeof s=="string"||typeof s=="number")o+=String(s);else if(s&&s.__wpdCss)o+=s.cssText;else throw new TypeError("[os-ui] css`` interpolations must be strings, numbers, or other css`` results. Got: "+typeof s);o+=t[n]}if(Re){const n=new CSSStyleSheet;return n.replaceSync(o),{__wpdCss:!0,sheet:n,cssText:o}}return{__wpdCss:!0,sheet:null,cssText:o}}function Ie(t){const e=[],o=[];let n=null,s=t.parentElement;for(;s&&!(s===document.body||s===document.documentElement);){const a=s.id||"";if(a.startsWith("wp-window-")){n=a.slice(10);break}if(s.tagName.toLowerCase()==="os-tabpanel"){const l=s.getAttribute("for");l&&o.unshift(l)}s=s.parentElement}n&&e.push(F(n));for(const a of o)e.push("tab-"+F(a));const r=t.getAttribute("label");return r&&e.push(F(r)),e.length===0?"os-unnamed":"os-"+e.filter(a=>a!=="").join("-")}function F(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function Le(t){if(t.id)return t.id;const e=Ie(t);return t.id=e,e}const te=y`:host{--_holo-fill:var( --os-ui-holo-fill,${"linear-gradient( 124deg, #afa2e8 0%, #f5a8ea 46%, #8ee9f7 100% )"} );--_holo-ink:var( --os-ui-holo-ink,#0c0b0f );--_holo-sheen:var( --os-ui-holo-sheen,linear-gradient( 124deg,rgba( 159,214,255,0.1 ) 0%,rgba( 236,155,255,0.12 ) 34%,rgba( 242,82,252,0.1 ) 58%,rgba( 147,240,198,0.09 ) 100% ) );--_holo-edge:var( --os-ui-holo-edge,linear-gradient( 124deg,rgba( 154,242,255,0.7 ) 0%,rgba( 236,155,255,0.85 ) 38%,rgba( 242,82,252,0.7 ) 62%,rgba( 159,152,255,0.6 ) 100% ) );--_holo-edge-quiet:var( --os-ui-holo-edge-quiet,linear-gradient( 124deg,rgba( 154,242,255,0.22 ) 0%,rgba( 236,155,255,0.28 ) 38%,rgba( 242,82,252,0.22 ) 62%,rgba( 159,152,255,0.2 ) 100% ) );--_holo-glow:var( --os-ui-holo-glow,0 0 0 1px rgba( 242,82,252,0.28 ),0 2px 10px rgba( 242,82,252,0.22 ) );--_holo-glow-strong:var( --os-ui-holo-glow-strong,0 0 0 1px rgba( 242,82,252,0.42 ),0 4px 18px rgba( 242,82,252,0.38 ),0 1px 3px rgba( 12,11,15,0.6 ) );--_holo-track:var( --os-ui-holo-track,rgba( 255,251,255,0.16 ) );--_holo-track-edge:var( --os-ui-holo-track-edge,#8c8f94 );--_holo-ring-color:var( --os-ui-accent-dim,#2271b1 );--_holo-focus:var( --os-ui-focus-ring,0 0 0 2px rgba( 12,11,15,0.9 ),0 0 0 4px #f252fc,0 0 12px 2px rgba( 242,82,252,0.45 ) );--_holo-focus-field:var( --os-ui-focus-ring-field,0 0 0 1px #f252fc,0 0 0 4px rgba( 242,82,252,0.18 ) );--_holo-t:var( --os-ui-holo-transition,220ms );--_holo-t-fast:var( --os-ui-motion-fast,140ms );--_holo-t-slow:var( --os-ui-motion-slow,340ms );--_holo-t-ambient:var( --os-ui-motion-ambient,12s );--_holo-spring:var( --os-ui-ease-spring,cubic-bezier( 0.32,1.5,0.55,1 ) );--_holo-ease:var( --os-ui-ease-out,cubic-bezier( 0.22,0.9,0.28,1 ) );--_holo-loop:var( --os-ui-ease-loop,cubic-bezier( 0.45,0,0.55,1 ) )}`,Me=y` .os-holo-fill{background-color:transparent;background-image:var( --_holo-fill );background-size:220% 220%;background-position:22% 28%;background-repeat:no-repeat;color:var( --_holo-ink );transition:background-position var( --_holo-t ) ease,box-shadow var( --_holo-t ) ease,filter var( --_holo-t ) ease}.os-holo-fill:hover{background-position:74% 66%}.os-holo-fill:active{background-position:88% 82%;filter:brightness( 0.94 )}@media ( prefers-reduced-motion:reduce ){.os-holo-fill{transition-duration:1ms}.os-holo-fill:hover,.os-holo-fill:active{background-position:22% 28%}}`,Pe=y` .os-holo-sheen{position:relative;isolation:isolate}.os-holo-sheen::before{content:'';position:absolute;inset:0;z-index:-1;border-radius:inherit;background-image:var( --_holo-sheen );background-size:200% 200%;background-position:20% 30%;opacity:0;pointer-events:none;transition:opacity var( --_holo-t ) ease,background-position var( --_holo-t ) ease}.os-holo-sheen:hover::before,.os-holo-sheen:focus-visible::before{opacity:1;background-position:76% 68%}@media ( prefers-reduced-motion:reduce ){.os-holo-sheen::before{transition-duration:1ms}.os-holo-sheen:hover::before,.os-holo-sheen:focus-visible::before{background-position:20% 30%}}`,ze=y` .os-holo-edge{position:relative}.os-holo-edge::after{content:'';position:absolute;inset:0;border-radius:inherit;padding:1px;background-image:var( --_holo-edge-quiet );opacity:0;pointer-events:none;-webkit-mask:linear-gradient( #000 0 0 ) content-box,linear-gradient( #000 0 0 );-webkit-mask-composite:xor;mask:linear-gradient( #000 0 0 ) content-box,linear-gradient( #000 0 0 );mask-composite:exclude;transition:opacity var( --_holo-t ) ease}.os-holo-edge:hover::after,.os-holo-edge:focus-visible::after{background-image:var( --_holo-edge );opacity:1}.os-holo-edge.is-lit::after{background-image:var( --_holo-edge );opacity:1}@media ( prefers-reduced-motion:reduce ){.os-holo-edge::after{transition-duration:1ms}}`,Oe=y` .os-holo-glint{position:absolute;inset:0;border-radius:inherit;overflow:hidden;pointer-events:none}.os-holo-glint::before{content:'';position:absolute;top:-60%;bottom:-60%;width:45%;inset-inline-start:-60%;background:linear-gradient( 90deg,transparent 0%,rgba( 255,251,255,0.14 ) 45%,rgba( 255,251,255,0.22 ) 50%,rgba( 255,251,255,0.14 ) 55%,transparent 100% );transform:rotate( 18deg ) translateX( 0 );opacity:0}:hover>.os-holo-glint::before,:focus-visible>.os-holo-glint::before,:host(:hover )>.os-holo-glint::before,:host(:focus-visible )>.os-holo-glint::before{animation:os-holo-glint var( --_holo-t-slow ) var( --_holo-ease )}@keyframes os-holo-glint{0%{opacity:0;transform:rotate( 18deg ) translateX( 0 )}15%{opacity:1}85%{opacity:1}100%{opacity:0;transform:rotate( 18deg ) translateX( 240vw )}}@media ( prefers-reduced-motion:reduce ){:hover>.os-holo-glint::before,:focus-visible>.os-holo-glint::before,:host(:hover )>.os-holo-glint::before,:host(:focus-visible )>.os-holo-glint::before{animation:none}}`,De=y` .os-holo-ring{position:absolute;inset:0;border-radius:inherit;box-shadow:0 0 0 0 var( --_holo-ring-color );opacity:0;pointer-events:none}:active:not(:disabled )>.os-holo-ring,:host(:active:not( [ disabled ] ) )>.os-holo-ring{animation:os-holo-ring var( --_holo-t-slow ) var( --_holo-ease )}@keyframes os-holo-ring{0%{opacity:0.45;box-shadow:0 0 0 0 var( --_holo-ring-color )}100%{opacity:0;box-shadow:0 0 0 10px transparent}}@media ( prefers-reduced-motion:reduce ){:active:not(:disabled )>.os-holo-ring,:host(:active:not( [ disabled ] ) )>.os-holo-ring{animation:none}}`,Fe=y` .os-holo-shimmer{background-image:var( --_holo-fill );background-size:300% 300%;background-repeat:no-repeat;animation:os-holo-shimmer 2.4s var( --_holo-loop ) infinite}@keyframes os-holo-shimmer{0%{background-position:0% 50%}100%{background-position:100% 50%}}@media ( prefers-reduced-motion:reduce ){.os-holo-shimmer{animation:none;background-position:30% 50%}}`,He=y` .os-holo-enter{animation:os-holo-enter var( --_holo-t ) var( --_holo-spring )}@keyframes os-holo-enter{from{opacity:0;transform:scale( 0.96 )}}@media ( prefers-reduced-motion:reduce ){.os-holo-enter{animation:none}}`,oe=y` input:where(:not( [ type='checkbox' ] ):not( [ type='radio' ] ) ),select,textarea{transition:background-color var( --_holo-t ) ease,border-color var( --_holo-t ) ease,box-shadow var( --_holo-t ) ease}input:where(:not( [ type='checkbox' ] ):not( [ type='radio' ] ) ):hover:not(:disabled ),select:hover:not(:disabled ),textarea:hover:not(:disabled ){border-color:var( --os-ui-border-strong,#8c8f94 )}input:where(:not( [ type='checkbox' ] ):not( [ type='radio' ] ) ):focus,input:where(:not( [ type='checkbox' ] ):not( [ type='radio' ] ) ):focus-visible,select:focus,select:focus-visible,textarea:focus,textarea:focus-visible{outline:none;border-color:var( --os-ui-accent,#2271b1 );box-shadow:var( --_holo-focus-field )}input::placeholder,textarea::placeholder{color:var( --os-ui-fg-faint,#8c8f94 );opacity:1}input::selection,textarea::selection{background:var( --os-ui-selection-bg,rgba( 159,152,255,0.6 ) );color:var( --os-ui-selection-fg,#fffbff )}@media ( prefers-reduced-motion:reduce ){input:where(:not( [ type='checkbox' ] ):not( [ type='radio' ] ) ),select,textarea{transition-duration:1ms}}`,Ue=y` input[ type='checkbox' ],input[ type='radio' ]{appearance:none;-webkit-appearance:none;position:relative;flex:0 0 auto;box-sizing:border-box;width:16px;height:16px;margin:0;padding:0;border:1px solid var( --_holo-track-edge );border-radius:4px;background-color:var( --_holo-track );background-image:none;background-repeat:no-repeat;cursor:inherit;transition:background-color var( --_holo-t ) ease,border-color var( --_holo-t ) ease,box-shadow var( --_holo-t ) ease}input[ type='radio' ]{border-radius:50%}input[ type='checkbox' ]:hover:not(:disabled ),input[ type='radio' ]:hover:not(:disabled ){border-color:var( --os-ui-accent,#2271b1 )}input[ type='checkbox' ]:focus-visible,input[ type='radio' ]:focus-visible{outline:none;box-shadow:var( --_holo-focus )}input[ type='checkbox' ]:checked,input[ type='checkbox' ]:indeterminate,input[ type='radio' ]:checked{border-color:transparent;background-color:var( --os-ui-accent,#2271b1 )}input[ type='checkbox' ]:checked:focus-visible,input[ type='radio' ]:checked:focus-visible{box-shadow:var( --_holo-focus )}input[ type='checkbox' ]:checked::after{content:'';position:absolute;inset-inline-start:50%;top:46%;width:3.5px;height:7.5px;border:solid var( --os-ui-accent-ink,var( --os-ui-fg-on-accent,#fff ) );border-width:0 2px 2px 0;transform:translate( -50%,-50% ) rotate( 45deg );animation:os-holo-tick 180ms cubic-bezier( 0.3,1.4,0.6,1 )}input[ type='checkbox' ]:indeterminate::after{content:'';position:absolute;inset-inline-start:50%;top:50%;width:8px;height:2px;border:0;border-radius:1px;background:var( --os-ui-accent-ink,var( --os-ui-fg-on-accent,#fff ) );transform:translate( -50%,-50% )}input[ type='radio' ]:checked::after{content:'';position:absolute;inset-inline-start:50%;top:50%;width:6px;height:6px;border-radius:50%;background:var( --os-ui-accent-ink,var( --os-ui-fg-on-accent,#fff ) );transform:translate( -50%,-50% );animation:os-holo-tick 180ms cubic-bezier( 0.3,1.4,0.6,1 )}input[ type='checkbox' ]:disabled,input[ type='radio' ]:disabled{cursor:not-allowed}@keyframes os-holo-tick{from{opacity:0;transform:translate( -50%,-50% ) rotate( 45deg ) scale( 0.4 )}}@media ( prefers-reduced-motion:reduce ){input[ type='checkbox' ]:checked::after,input[ type='radio' ]:checked::after{animation:none}}`,We=y` @keyframes os-holo-drift{0%{background-position:16% 26%}50%{background-position:84% 74%}100%{background-position:16% 26%}}.os-holo-alive{animation:os-holo-drift var( --_holo-t-ambient ) var( --_holo-loop ) infinite}@media ( prefers-reduced-motion:reduce ){.os-holo-alive{animation:none}}`;y` ${te} ${Me} ${Pe} ${ze} ${Oe} ${De} ${Fe} ${He} ${oe} ${Ue} ${We} `;const qe=y` ${te} ${oe}:host{--_field-size:var( --os-ui-field-font-size,13px );--_field-radius:var( --os-ui-field-radius,6px );display:flex;flex-direction:column;gap:4px;font-size:var( --_field-size );color:var( --os-ui-fg,#1d2327 );min-width:0}:host( [ hidden ] ){display:none}.os-textarea__label{font-size:12px;color:var( --os-ui-fg-muted,#646970 )}textarea{appearance:none;-webkit-appearance:none;display:block;width:100%;min-width:0;box-sizing:border-box;padding:8px 10px;background:var( --os-window-bg,#fff );border:1px solid var( --os-ui-border,#dcdcde );border-radius:var( --_field-radius );font:inherit;font-size:var( --_field-size );line-height:1.45;color:var( --os-ui-fg,#1d2327 );resize:vertical}textarea:disabled{opacity:0.55;cursor:not-allowed;background:var( --os-ui-hover,rgba( 0,0,0,0.03 ) )}textarea[ aria-invalid='true' ],textarea[ aria-invalid='true' ]:hover:not(:disabled ){border-color:var( --os-ui-danger,#d63638 )}textarea[ aria-invalid='true' ]:focus,textarea[ aria-invalid='true' ]:focus-visible{border-color:var( --os-ui-danger,#d63638 );box-shadow:0 0 0 1px var( --os-ui-danger,#d63638 ),0 0 0 4px rgba( 214,54,56,0.18 )}:host( [ auto-grow ] ) textarea{resize:none;overflow:hidden}`,I=class I extends D{constructor(){super(...arguments),this._textareaEl=null}connectedCallback(){super.connectedCallback(),Le(this)}render(){const e=this._attr("label")||"",o=this._attr("value")??"",n=this._attr("placeholder")||"",s=this._boolAttr("disabled"),r=this._boolAttr("readonly"),a=this._attr("aria-label")||e,l=this._attr("name")||"",c=Number(this._attr("rows"))||3,i=this._attr("maxlength"),d=this._attr("minlength"),u=this._boolAttr("invalid"),b=`${this.id||"os-unnamed"}__field`;return O` | |
| 2 | + ${e?O`<label class="os-textarea__label" for=${b}>${e}</label>`:O``} | |
| 13 | 3 | <textarea |
| 14 | 4 | id=${b} |
| 15 | 5 | part="textarea" |
| 16 | - .value=${t} | |
| 6 | + .value=${o} | |
| 17 | 7 | placeholder=${n} |
| 18 | 8 | ?disabled=${s} |
| 19 | 9 | ?readonly=${r} |
| 20 | - rows=${d} | |
| 21 | - maxlength=${a??""} | |
| 22 | - minlength=${m??""} | |
| 23 | - name=${h} | |
| 24 | - aria-invalid=${v?"true":"false"} | |
| 25 | - aria-label=${i||""} | |
| 26 | - @input=${p=>this._onInput(p)} | |
| 27 | - @change=${p=>this._onChange(p)} | |
| 28 | - @keydown=${p=>this._onKeyDown(p)} | |
| 10 | + rows=${c} | |
| 11 | + maxlength=${i??""} | |
| 12 | + minlength=${d??""} | |
| 13 | + name=${l} | |
| 14 | + aria-invalid=${u?"true":"false"} | |
| 15 | + aria-label=${a||""} | |
| 16 | + @input=${m=>this._onInput(m)} | |
| 17 | + @change=${m=>this._onChange(m)} | |
| 18 | + @keydown=${m=>this._onKeyDown(m)} | |
| 29 | 19 | ></textarea> |
| 30 | - `}_attr(e){return this.getAttribute(e)}_boolAttr(e){return this.getAttribute(e)!==null}_onInput(e){const t=e.target;this._textareaEl=t,this.setAttribute("value",t.value),this.emit("os-input-change",{value:t.value}),this._boolAttr("auto-grow")&&this._autosize(t)}_onChange(e){const t=e.target;this.emit("os-input-commit",{value:t.value})}_onKeyDown(e){if(this._boolAttr("submit-on-enter")&&e.key==="Enter"&&!e.shiftKey&&!e.altKey&&!e.metaKey&&!e.ctrlKey){e.preventDefault();const t=e.target;this.emit("os-submit",{value:t.value})}}_autosize(e){const t=Number(this._attr("max-rows"))||8,n=window.getComputedStyle(e),s=parseFloat(n.fontSize)||13,r=n.lineHeight,i=r==="normal"?s*1.45:parseFloat(r)||s*1.45,h=parseFloat(n.paddingTop)||0,d=parseFloat(n.paddingBottom)||0,a=i*t+h+d;e.style.height="auto";const m=Math.min(e.scrollHeight,a);e.style.height=`${m}px`}refreshAutosize(){this._textareaEl&&this._boolAttr("auto-grow")&&this._autosize(this._textareaEl)}focusInput(){(this.shadowRoot??this).querySelector("textarea")?.focus()}clear(){this.setAttribute("value","");const t=(this.shadowRoot??this).querySelector("textarea");t&&(t.value="",this._boolAttr("auto-grow")&&this._autosize(t))}};L.props=["label","value","placeholder","disabled","readonly","ariaLabel","name","rows","maxlength","minlength","invalid","autoGrow","maxRows","submitOnEnter"],L.styles=[Me],L.help=void 0;let K=L;oe("os-textarea",K);const Oe="openstation";function He(){return window.wp?.i18n}function k(o,e=Oe){return He()?.__(o,e)??o}const R=["butter","blush","sky","mint","lilac","peach"];function B(o){return R.includes(o)?o:R[0]}function F(o){const e=R.indexOf(B(o));return R[(e+1)%R.length]}function Ue(o){let e=2166136261;for(let n=0;n<o.length;n++)e^=o.charCodeAt(n),e=Math.imul(e,16777619)>>>0;return e>>>1||1}const Xe=56,qe=52;function We(o){return`${o.replace(/\/$/,"")}/assets/images/pushpin.svg`}function Ke(o){const e=document.createElement("img");return e.src=We(o),e.alt="",e.width=Xe,e.height=qe,e.draggable=!1,e.className="os-pinned-note__pin-img",e}const ie="X-WP-Nonce";function Be(o,e){const t=Fe();if(!t)return e;const n=je(o);if(!n||!Ve(n))return e;const s=e?.headers??(typeof Request<"u"&&o instanceof Request?o.headers:void 0),r=new Headers(s??{});return r.has(ie)?e:(r.set(ie,t),{...e??{},headers:r})}function Fe(){if(typeof window>"u")return;const e=window.openStationConfig?.restNonce;return typeof e=="string"&&e.length>0?e:void 0}function je(o){try{const e=typeof window<"u"&&window.location?window.location.href:void 0;return typeof o=="string"?new URL(o,e):o instanceof URL?o:typeof Request<"u"&&o instanceof Request?new URL(o.url,e):null}catch{return null}}function Ve(o){return typeof window>"u"||!window.location||o.origin!==window.location.origin?!1:!!(o.pathname.includes("/wp-json/")||o.searchParams.has("rest_route"))}function Ge(o,e,t={}){const n=window.wp?.os?.fetch;if(typeof n=="function")return n(o,e,t);const s=Be(o,e);return fetch(o,s)}let j=null;function Ye(o){j=o}function Je(){if(!j)throw new Error("[openstation] notes REST client called before installNotesRestDeps().");return j}function Ze(o){const e=window.openStationConfig;return typeof e?.restNonce=="string"&&e.restNonce?e.restNonce:o}class Qe extends Error{constructor(e){super("Note was changed by another session."),this.status=409,this.name="NotesConflictError",this.current=e}}async function et(o,e){const{baseUrl:t,nonce:n}=Je(),s=t,r=new Headers(e.headers??{});r.set("X-WP-Nonce",Ze(n)),e.body&&!r.has("Content-Type")&&r.set("Content-Type","application/json");const i=await Ge(s,{...e,headers:r,credentials:"same-origin"},{source:"desktop-mode/notes"}),h=await i.text();let d=null;if(h)try{d=JSON.parse(h)}catch{d=null}if(!i.ok){if(i.status===409){const m=d?.data?.current;throw new Qe(m??null)}const a=d;throw new Error(`[openstation] notes REST ${i.status}: ${a?.code??""} ${a?.message??""}`.trim())}if(d===null)throw new Error(`[openstation] notes REST ${i.status}: empty or unparseable body.`);return d}function tt(o){return et("",{method:"POST",body:JSON.stringify(o)})}const ot="note-draft",nt="os-note-created",st="desktop-mode/notes";function rt(){return window.openStationConfig??{}}function it(){return window.wp?.os?.dragManager??null}const at=(o,e)=>{let t=!1;const n=rt(),s=!!n.notesUrl;s&&Ye({baseUrl:n.notesUrl,nonce:n.restNonce??""});let r=B(e.storage.get("color")??R[0]),i=e.storage.get("public")??!1,h="";const d=document.createElement("div");d.className="dm-notes-pad";const a=document.createElement("div");a.className="dm-notes-pad__stack";const m=document.createElement("div");m.className="dm-notes-pad__under dm-notes-pad__under--2";const v=document.createElement("div");v.className="dm-notes-pad__under dm-notes-pad__under--1";const f=document.createElement("div");f.className="dm-notes-pad__sheet";const b=document.createElement("div");b.className="dm-notes-pad__peel",b.setAttribute("aria-hidden","true");const p=document.createElement("span");p.className="dm-notes-pad__peel-hint",p.textContent=k("Drag to pin","desktop-mode"),b.appendChild(p);const g=document.createElement("os-textarea");g.className="dm-notes-pad__editor",g.setAttribute("aria-label",k("New note","desktop-mode")),g.setAttribute("placeholder",k("Write a note…","desktop-mode")),g.setAttribute("rows","5"),g.setAttribute("auto-grow",""),g.setAttribute("max-rows","8");const u=document.createElement("button");u.type="button",u.className="dm-notes-pad__corner",f.append(b,g,u),a.append(m,v,f);const y=document.createElement("div");y.className="dm-notes-pad__footer";const x=document.createElement("div");x.className="dm-notes-pad__swatches",x.setAttribute("role","radiogroup"),x.setAttribute("aria-label",k("Paper color","desktop-mode"));const E=new Map;for(const l of R){const c=document.createElement("button");c.type="button",c.className="dm-notes-pad__swatch",c.dataset.noteColor=l,c.setAttribute("role","radio"),c.setAttribute("aria-label",l),c.addEventListener("click",()=>le(l)),E.set(l,c),x.appendChild(c)}const A=document.createElement("os-checkbox-label");A.className="dm-notes-pad__public",A.setAttribute("label",k("Public — visible to other desktop users","desktop-mode")),i&&A.setAttribute("checked",""),A.addEventListener("os-checkbox-change",l=>{i=l.detail.checked,e.storage.set("public",i)});const C=document.createElement("button");C.type="button",C.className="dm-notes-pad__pin-btn",C.textContent=k("Pin to desktop","desktop-mode"),C.title=k("Pin the note without dragging (Ctrl+Enter)","desktop-mode"),y.append(x,A,C),d.append(a,y),o.appendChild(d);function ae(){const l=F(r),c=F(l);f.dataset.noteColor=r,a.dataset.noteColor=r,v.dataset.noteColor=l,m.dataset.noteColor=c,u.dataset.noteColor=l,u.setAttribute("aria-label",`${k("Next paper color","desktop-mode")}: ${l}`);for(const[N,$]of E)$.setAttribute("aria-checked",N===r?"true":"false"),$.classList.toggle("is-selected",N===r)}function le(l){r=B(l),e.storage.set("color",r),ae()}const ce=()=>le(F(r));u.addEventListener("click",ce),ae();const lt=l=>{h=l.detail.value};g.addEventListener("os-input-change",lt);const ct=l=>{const c=l;c.key==="Enter"&&(c.ctrlKey||c.metaKey)&&(c.preventDefault(),pe()),c.stopPropagation()};["keydown","keypress","keyup"].forEach(l=>g.addEventListener(l,c=>{l==="keydown"?ct(c):c.stopPropagation()}));const de=()=>{h="",g.setAttribute("value","")},G=()=>{typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches||f.animate?.([{transform:"translateX(0)"},{transform:"translateX(-4px)"},{transform:"translateX(4px)"},{transform:"translateX(0)"}],{duration:200,easing:"ease-out"})},dt=()=>{const c=document.createElement("div");c.className="os-pinned-note-ghost",c.dataset.noteColor=r,c.style.width="208px";const N=document.createElement("div");N.className="os-pinned-note-ghost__swing",N.dataset.noteColor=r;const $=208/2,H=10;N.style.transformOrigin=`${$}px ${H}px`;const P=document.createElement("span");P.className="os-pinned-note__pin",P.style.setProperty("--dm-pin-dx","0px"),P.style.setProperty("--dm-pin-rot","0deg"),P.appendChild(Ke(e.pluginUrl));const Y=document.createElement("div");Y.className="os-pinned-note__paper os-pinned-note-ghost__paper";const J=document.createElement("div");return J.className="os-pinned-note__body",J.textContent=h,Y.appendChild(J),N.append(P,Y),c.appendChild(N),{root:c,tipX:$,tipY:H}},ue=l=>{if(t||!s||l.target?.closest("os-textarea, .dm-notes-pad__corner"))return;if(!h.trim()){G();return}const N=it();if(!N)return;l.preventDefault(),f.ownerDocument.defaultView?.getSelection()?.removeAllRanges();const $=dt(),H={text:h,color:r,isPublic:i};N.start({payload:{type:ot,source:f,data:H,ghost:{element:$.root,offsetX:$.tipX,offsetY:$.tipY,hint:{neutral:k("Drop on the desktop to pin","desktop-mode"),accept:k("Pin here","desktop-mode"),reject:k("Can’t pin here","desktop-mode")}}},origin:l,onClickOnly:()=>g.focusInput?.(),onCommit:()=>{de(),he()}})};f.addEventListener("pointerdown",ue);const he=()=>{typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches||f.animate?.([{transform:"translate(3px, 4px) rotate(1.1deg)",opacity:.9},{transform:"translate(-1px, -2px) rotate(-0.4deg)",offset:.7},{transform:"translate(0, 0) rotate(0deg)",opacity:1}],{duration:260,easing:"cubic-bezier(0.2, 0.7, 0.2, 1)"})};async function pe(){if(!(t||!s)){if(!h.trim()){G(),g.focusInput?.();return}C.disabled=!0;try{const l=Math.floor(Date.now()/1e3)%5,c=await tt({text:h,color:r,x:.55+l*.04,y:.12+l*.05,public:i,seed:Ue(h)});if(t)return;de(),he(),document.dispatchEvent(new CustomEvent(nt,{detail:{note:c}}))}catch(l){console.error("[openstation] note pad: create failed:",l),G();const c=window.wp?.os?.showToast;c?.({message:k("Could not pin the note. Please try again.","desktop-mode"),duration:5e3})}finally{C.disabled=!1}}}const fe=()=>{pe()};return C.addEventListener("click",fe),s||(d.classList.add("dm-notes-pad--unavailable"),g.setAttribute("disabled",""),C.disabled=!0),()=>{t=!0,f.removeEventListener("pointerdown",ue),u.removeEventListener("click",ce),C.removeEventListener("click",fe)}},V=window;V.openStationWidgets=V.openStationWidgets??{},V.openStationWidgets[st]=at})(); | |
| 20 | + `}_attr(e){return this.getAttribute(e)}_boolAttr(e){return this.getAttribute(e)!==null}_onInput(e){const o=e.target;this._textareaEl=o,this.setAttribute("value",o.value),this.emit("os-input-change",{value:o.value}),this._boolAttr("auto-grow")&&this._autosize(o)}_onChange(e){const o=e.target;this.emit("os-input-commit",{value:o.value})}_onKeyDown(e){if(!(!this._boolAttr("submit-on-enter")||e.isComposing||e.keyCode===229)&&e.key==="Enter"&&!e.shiftKey&&!e.altKey&&!e.metaKey&&!e.ctrlKey){e.preventDefault();const o=e.target;this.emit("os-submit",{value:o.value})}}_autosize(e){const o=Number(this._attr("max-rows"))||8,n=window.getComputedStyle(e),s=parseFloat(n.fontSize)||13,r=n.lineHeight,a=r==="normal"?s*1.45:parseFloat(r)||s*1.45,l=parseFloat(n.paddingTop)||0,c=parseFloat(n.paddingBottom)||0,i=(parseFloat(n.borderTopWidth)||0)+(parseFloat(n.borderBottomWidth)||0),d=a*o+l+c+i;e.style.height="auto",e.style.overflowY="hidden";const u=e.value?e.scrollHeight+i:a*(Number(this._attr("rows"))||3)+l+c+i,h=Math.min(u,d);e.style.height=`${Math.ceil(h)}px`,e.style.overflowY=u>Math.ceil(d)?"auto":"hidden"}refreshAutosize(){this._textareaEl&&this._boolAttr("auto-grow")&&this._autosize(this._textareaEl)}focusInput(){(this.shadowRoot??this).querySelector("textarea")?.focus()}clear(){this.setAttribute("value","");const o=(this.shadowRoot??this).querySelector("textarea");o&&(o.value="",this._boolAttr("auto-grow")&&this._autosize(o))}};I.props=["label","value","placeholder","disabled","readonly","ariaLabel","name","rows","maxlength","minlength","invalid","autoGrow","maxRows","submitOnEnter"],I.styles=[qe],I.help=void 0;let H=I;Se("os-textarea",H);const Ke="desktop-mode";function ne(){return window.wp?.i18n}function _(t,e=Ke){return ne()?.__(t,e)??t}function se(t,...e){const o=ne()?.sprintf;if(o)return o(t,...e);let n=0;return t.replace(/%(?:(\d+)\$)?[sd]/g,(s,r)=>{const a=r?Number.parseInt(r,10)-1:n++;return String(e[a]??"")})}const re="X-WP-Nonce";function Xe(t,e){const o=Be();if(!o)return e;const n=je(t);if(!n||!Ve(n))return e;const s=e?.headers??(typeof Request<"u"&&t instanceof Request?t.headers:void 0),r=new Headers(s??{});return r.has(re)?e:(r.set(re,o),{...e??{},headers:r})}function Be(){if(typeof window>"u")return;const e=window.openStationConfig?.restNonce;return typeof e=="string"&&e.length>0?e:void 0}function je(t){try{const e=typeof window<"u"&&window.location?window.location.href:void 0;return typeof t=="string"?new URL(t,e):t instanceof URL?t:typeof Request<"u"&&t instanceof Request?new URL(t.url,e):null}catch{return null}}function Ve(t){return typeof window>"u"||!window.location||t.origin!==window.location.origin?!1:!!(t.pathname.includes("/wp-json/")||t.searchParams.has("rest_route"))}function Ye(t,e,o={}){const n=window.wp?.os?.fetch;if(typeof n=="function")return n(t,e,o);const s=Xe(t,e);return fetch(t,s)}class U extends Error{constructor(e,o){super(e||o.serverMessage||`HTTP ${o.status}`),this.name="RestError",this.status=o.status,this.code=o.code,this.data=o.data,this.serverMessage=o.serverMessage??""}}function ae(t){return t instanceof U}function ie(t){const e=typeof t=="object"&&t!==null?t:void 0;return{code:typeof e?.code=="string"?e.code:void 0,data:e?.data,serverMessage:typeof e?.message=="string"?e.message:""}}function Ge(t,e,o=""){return new U(o,{status:t,...ie(e)})}function le(t,e){return new U(e,{status:t,code:"openstation_bad_response"})}function Ze(t){const{prefix:e,source:o,conflict:n}=t;return async(s,r={})=>{const a=new Headers(r.headers??{});a.set("X-WP-Nonce",t.nonce()),r.body&&!a.has("Content-Type")&&a.set("Content-Type","application/json");const l=await Ye(t.url(s),{...r,headers:a,credentials:"same-origin"},{source:o}),c=await l.text();let i=null,d=null;if(c)try{i=JSON.parse(c)}catch(u){d=u}if(!l.ok){if(l.status===409&&n){const b=n(i);if(b)throw b}const{code:u,serverMessage:h}=ie(i);throw Ge(l.status,i,`${e} ${l.status}: ${u??""} ${h}`.trim())}if(i===null){if(d&&c){const u=c.slice(0,120).replace(/\s+/g," ");throw le(l.status,`${e} ${l.status} returned non-JSON body — ${d.message}. First 120 chars: ${u}`)}throw le(l.status,`${e} ${l.status}: empty or unparseable body.`)}return i}}const Je="rest_cookie_invalid_nonce",ce=()=>_("Could not reach the site. Check your connection and try again.","desktop-mode");function de(t){return typeof navigator<"u"&&navigator.onLine===!1?!0:t instanceof TypeError}function Qe(t){return ae(t)?t.code===Je||t.status===401?"session":t.status>=200&&t.status<300?"unreadable":t.status===404?"gone":t.status>=500?"server":t.status>=400?"refused":"unknown":de(t)?"offline":"unknown"}function et(t){return ae(t)?t.serverMessage:de(t)?ce():t instanceof Error?t.message:""}function tt(t,e){const{fallback:o,lead:n}=e,s=Qe(t),r=s==="offline"||s==="unreadable"?"warning":"error";let a="",l=!0;switch(s){case"offline":a=ce();break;case"session":a=_("Your session has expired. Reload the page and try again.","desktop-mode");break;case"unreadable":a=_("The site sent an unreadable reply. Reload the page to check whether the change went through.","desktop-mode");break;case"gone":case"refused":case"server":{const i=t;i.serverMessage?a=i.serverMessage:s==="gone"?(a=_("It no longer exists. Reload the page to catch up.","desktop-mode"),l=!1):s==="server"?(a=se(_("The server answered with error %d.","desktop-mode"),i.status),l=!1):(a=se(_("The server refused the request (HTTP %d).","desktop-mode"),i.status),l=!1);break}case"unknown":default:a=et(t);break}let c;return n?c=a?`${n}: ${a}`:o:a?l?c=a:c=`${o} ${a}`:c=o,{message:c,reason:a,kind:s,type:r}}function ot(t,e,o){if(!t)return;const{duration:n,...s}=o,r=tt(e,s),a={message:r.message,type:r.type};n&&(a.duration=n),t(a)}function nt(t){const e=window.wp?.os;return typeof e?.showToast!="function"?()=>{}:e.showToast(t)??(()=>{})}const S=["butter","blush","sky","mint","lilac","peach"];function W(t){return S.includes(t)?t:S[0]}function q(t){const e=S.indexOf(W(t));return S[(e+1)%S.length]}function st(t){let e=2166136261;for(let n=0;n<t.length;n++)e^=t.charCodeAt(n),e=Math.imul(e,16777619)>>>0;return e>>>1||1}const rt=56,at=52;function it(t){return`${t.replace(/\/$/,"")}/assets/images/pushpin.svg`}function lt(t){const e=document.createElement("img");return e.src=it(t),e.alt="",e.width=rt,e.height=at,e.draggable=!1,e.className="os-pinned-note__pin-img",e}const ct="http://localhost/";function dt(t,e){const o=typeof window<"u"&&window.location?window.location.href:ct,n=new URL(t,o),s=e.replace(/^\/+/,""),r=s.indexOf("?"),a=r===-1?s:s.slice(0,r),l=r===-1?"":s.slice(r+1);if(n.searchParams.has("rest_route")){const c=n.searchParams.get("rest_route")??"/",i=c.endsWith("/")?c:c+"/";n.searchParams.set("rest_route",i+a)}else{const c=n.pathname.endsWith("/")?n.pathname:n.pathname+"/";n.pathname=c+a}return l&&new URLSearchParams(l).forEach((i,d)=>{n.searchParams.append(d,i)}),n.toString()}let K=null;function ut(t){K=t}function ue(){if(!K)throw new Error("[openstation] notes REST client called before installNotesRestDeps().");return K}function ht(t){const e=window.openStationConfig;return typeof e?.restNonce=="string"&&e.restNonce?e.restNonce:t}class pt extends Error{constructor(e){super("Note was changed by another session."),this.status=409,this.name="NotesConflictError",this.current=e}}const ft=Ze({prefix:"[openstation] notes REST",source:"desktop-mode/notes",url:t=>{const{baseUrl:e}=ue();return t?dt(e,t):e},nonce:()=>ht(ue().nonce),conflict:t=>{const e=t?.data?.current;return new pt(e??null)}});function mt(t){return ft("",{method:"POST",body:JSON.stringify(t)})}const gt="note-draft",bt="os-note-created",vt="desktop-mode/notes";function wt(){return window.openStationConfig??{}}function xt(){return window.wp?.os?.dragManager??null}const _t=(t,e)=>{let o=!1;const n=wt(),s=!!n.notesUrl;s&&ut({baseUrl:n.notesUrl,nonce:n.restNonce??""});let r=W(e.storage.get("color")??S[0]);const a=!1;let l="";const c=document.createElement("div");c.className="dm-notes-pad";const i=document.createElement("div");i.className="dm-notes-pad__stack";const d=document.createElement("div");d.className="dm-notes-pad__under dm-notes-pad__under--2";const u=document.createElement("div");u.className="dm-notes-pad__under dm-notes-pad__under--1";const h=document.createElement("div");h.className="dm-notes-pad__sheet";const b=document.createElement("div");b.className="dm-notes-pad__peel",b.setAttribute("aria-hidden","true");const m=document.createElement("span");m.className="dm-notes-pad__peel-hint",m.textContent=_("Drag to pin","desktop-mode"),b.appendChild(m);const v=document.createElement("os-textarea");v.className="dm-notes-pad__editor",v.setAttribute("aria-label",_("New note","desktop-mode")),v.setAttribute("placeholder",_("Write a note…","desktop-mode")),v.setAttribute("rows","5"),v.setAttribute("auto-grow",""),v.setAttribute("max-rows","8");const g=document.createElement("button");g.type="button",g.className="dm-notes-pad__corner",h.append(b,v,g),i.append(d,u,h);const k=document.createElement("div");k.className="dm-notes-pad__footer";const w=document.createElement("div");w.className="dm-notes-pad__swatches",w.setAttribute("role","radiogroup"),w.setAttribute("aria-label",_("Paper color","desktop-mode"));const E=new Map;for(const p of S){const f=document.createElement("button");f.type="button",f.className="dm-notes-pad__swatch",f.dataset.noteColor=p,f.setAttribute("role","radio"),f.setAttribute("aria-label",p),f.addEventListener("click",()=>he(p)),E.set(p,f),w.appendChild(f)}k.append(w),c.append(i,k),t.appendChild(c);function T(){const p=q(r),f=q(p);h.dataset.noteColor=r,i.dataset.noteColor=r,u.dataset.noteColor=p,d.dataset.noteColor=f,g.dataset.noteColor=p,g.setAttribute("aria-label",`${_("Next paper color","desktop-mode")}: ${p}`);for(const[N,C]of E)C.setAttribute("aria-checked",N===r?"true":"false"),C.classList.toggle("is-selected",N===r)}function he(p){r=W(p),e.storage.set("color",r),T()}const pe=()=>he(q(r));g.addEventListener("click",pe),T();const yt=p=>{l=p.detail.value};v.addEventListener("os-input-change",yt);const kt=p=>{const f=p;f.key==="Enter"&&(f.ctrlKey||f.metaKey)&&(f.preventDefault(),Nt()),f.stopPropagation()};["keydown","keypress","keyup"].forEach(p=>v.addEventListener(p,f=>{p==="keydown"?kt(f):f.stopPropagation()}));const fe=()=>{l="",v.setAttribute("value","")},B=()=>{typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches||h.animate?.([{transform:"translateX(0)"},{transform:"translateX(-4px)"},{transform:"translateX(4px)"},{transform:"translateX(0)"}],{duration:200,easing:"ease-out"})},Et=()=>{const f=document.createElement("div");f.className="os-pinned-note-ghost",f.dataset.noteColor=r,f.style.width="208px";const N=document.createElement("div");N.className="os-pinned-note-ghost__swing",N.dataset.noteColor=r;const C=208/2,z=10;N.style.transformOrigin=`${C}px ${z}px`;const L=document.createElement("span");L.className="os-pinned-note__pin",L.style.setProperty("--dm-pin-dx","0px"),L.style.setProperty("--dm-pin-rot","0deg"),L.appendChild(lt(e.pluginUrl));const V=document.createElement("div");V.className="os-pinned-note__paper os-pinned-note-ghost__paper";const Y=document.createElement("div");return Y.className="os-pinned-note__body",Y.textContent=l,V.appendChild(Y),N.append(L,V),f.appendChild(N),{root:f,tipX:C,tipY:z}},me=p=>{if(o||!s||p.target?.closest("os-textarea, .dm-notes-pad__corner"))return;if(!l.trim()){B();return}const N=xt();if(!N)return;p.preventDefault(),h.ownerDocument.defaultView?.getSelection()?.removeAllRanges();const C=Et(),z={text:l,color:r,isPublic:a};N.start({payload:{type:gt,source:h,data:z,ghost:{element:C.root,offsetX:C.tipX,offsetY:C.tipY,hint:{neutral:_("Drop on the desktop to pin","desktop-mode"),accept:_("Pin here","desktop-mode"),reject:_("Can’t pin here","desktop-mode")}}},origin:p,onClickOnly:()=>v.focusInput?.(),onCommit:()=>{fe(),ge()}})};h.addEventListener("pointerdown",me);const ge=()=>{typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches||h.animate?.([{transform:"translate(3px, 4px) rotate(1.1deg)",opacity:.9},{transform:"translate(-1px, -2px) rotate(-0.4deg)",offset:.7},{transform:"translate(0, 0) rotate(0deg)",opacity:1}],{duration:260,easing:"cubic-bezier(0.2, 0.7, 0.2, 1)"})};let j=!1;async function Nt(){if(!(o||!s||j)){if(!l.trim()){B(),v.focusInput?.();return}j=!0;try{const p=Math.floor(Date.now()/1e3)%5,f=await mt({text:l,color:r,x:.55+p*.04,y:.12+p*.05,public:a,seed:st(l)});if(o)return;fe(),ge(),document.dispatchEvent(new CustomEvent(bt,{detail:{note:f}}))}catch(p){console.error("[openstation] note pad: create failed:",p),B(),ot(nt,p,{fallback:_("Could not pin the note. Please try again.","desktop-mode"),duration:5e3})}finally{j=!1}}}return s||(c.classList.add("dm-notes-pad--unavailable"),v.setAttribute("disabled","")),()=>{o=!0,h.removeEventListener("pointerdown",me),g.removeEventListener("click",pe)}},X=window;X.openStationWidgets=X.openStationWidgets??{},X.openStationWidgets[vt]=_t})(); | |