vendor: 6,038 bytes, lines 1-2
1/* github/keithamus/invokers-polyfill */ 2(()=>{function g(){return typeof HTMLButtonElement<"u"&&"command"in HTMLButtonElement.prototype&&"source"in((globalThis.CommandEvent||{}).prototype||{})}function E(){document.addEventListener("invoke",e=>{e.type=="invoke"&&e.isTrusted&&(e.stopImmediatePropagation(),e.preventDefault())},!0),document.addEventListener("command",e=>{e.type=="command"&&e.isTrusted&&(e.stopImmediatePropagation(),e.preventDefault())},!0);function v(e,o,t=!0){Object.defineProperty(e,o,{...Object.getOwnPropertyDescriptor(e,o),enumerable:t})}function s(e){return e&&typeof e.getRootNode=="function"?e.getRootNode():e&&e.parentNode?s(e.parentNode):e}let l=new WeakMap,p=new WeakMap;class u extends Event{constructor(o,t={}){super(o,t);let{source:n,command:r}=t;if(n!=null&&!(n instanceof Element))throw new TypeError("source must be an element");l.set(this,n||null),p.set(this,r!==void 0?String(r):"")}get[Symbol.toStringTag](){return"CommandEvent"}get source(){if(!l.has(this))throw new TypeError("illegal invocation");let o=l.get(this);if(!(o instanceof Element))return null;let t=s(o);return t!==s(this.target||document)?t.host:o}get command(){if(!p.has(this))throw new TypeError("illegal invocation");return p.get(this)}get action(){throw new Error("CommandEvent#action was renamed to CommandEvent#command")}get invoker(){throw new Error("CommandEvent#invoker was renamed to CommandEvent#source")}}v(u.prototype,"source"),v(u.prototype,"command");class y extends Event{constructor(o,t={}){throw super(o,t),new Error("InvokeEvent has been deprecated, it has been renamed to `CommandEvent`")}}let c=new WeakMap;function k(e){Object.defineProperties(e.prototype,{commandForElement:{enumerable:!0,configurable:!0,set(o){if(this.hasAttribute("invokeaction"))throw new TypeError("Element has deprecated `invokeaction` attribute, replace with `command`");if(this.hasAttribute("invoketarget"))throw new TypeError("Element has deprecated `invoketarget` attribute, replace with `commandfor`");if(o===null)this.removeAttribute("commandfor"),c.delete(this);else if(o instanceof Element){this.setAttribute("commandfor","");let t=s(o);s(this)===t||t===this.ownerDocument?c.set(this,o):c.delete(this)}else throw new TypeError("commandForElement must be an element or null")},get(){if(this.localName!=="button")return null;if(this.hasAttribute("invokeaction")||this.hasAttribute("invoketarget"))return console.warn("Element has deprecated `invoketarget` or `invokeaction` attribute, use `commandfor` and `command` instead"),null;if(this.disabled)return null;if(this.form&&this.getAttribute("type")!=="button")return console.warn("Element with `commandFor` is a form participant. It should explicitly set `type=button` in order for `commandFor` to work"),null;let o=c.get(this);if(o)return o.isConnected?o:(c.delete(this),null);let t=s(this),n=this.getAttribute("commandfor");return(t instanceof Document||t instanceof ShadowRoot)&&n&&t.getElementById(n)||null}},command:{enumerable:!0,configurable:!0,get(){let o=this.getAttribute("command")||"";if(o.startsWith("--"))return o;let t=o.toLowerCase();switch(t){case"show-modal":case"request-close":case"close":case"toggle-popover":case"hide-popover":case"show-popover":return t}return""},set(o){this.setAttribute("command",o)}},invokeAction:{enumerable:!1,configurable:!0,get(){throw new Error("invokeAction is deprecated. It has been renamed to command")},set(o){throw new Error("invokeAction is deprecated. It has been renamed to command")}},invokeTargetElement:{enumerable:!1,configurable:!0,get(){throw new Error("invokeTargetElement is deprecated. It has been renamed to command")},set(o){throw new Error("invokeTargetElement is deprecated. It has been renamed to command")}}})}let h=new WeakMap;Object.defineProperties(HTMLElement.prototype,{oncommand:{enumerable:!0,configurable:!0,get(){return f.takeRecords(),h.get(this)||null},set(e){let o=h.get(this)||null;o&&this.removeEventListener("command",o),h.set(this,typeof e=="object"||typeof e=="function"?e:null),typeof e=="function"&&this.addEventListener("command",e)}}});function d(e){for(let o of e)o.oncommand=new Function("event",o.getAttribute("oncommand"))}let f=new MutationObserver(e=>{for(let o of e){let{target:t}=o;o.type==="childList"?d(t.querySelectorAll("[oncommand]")):d([t])}});f.observe(document,{subtree:!0,childList:!0,attributeFilter:["oncommand"]}),d(document.querySelectorAll("[oncommand]"));let w=new WeakSet;function A(e){if(w.has(e)||(w.add(e),e.defaultPrevented)||e.type!=="click")return;let o=e.target.closest("button[invoketarget], button[invokeaction], input[invoketarget], input[invokeaction]");if(o&&(console.warn("Elements with `invoketarget` or `invokeaction` are deprecated and should be renamed to use `commandfor` and `command` respectively"),o.matches("input")))throw new Error("Input elements no longer support `commandfor`");let t=e.target.closest("button[commandfor], button[command]");if(!t)return;if(t.form&&t.getAttribute("type")!=="button")throw e.preventDefault(),new Error("Element with `commandFor` is a form participant. It should explicitly set `type=button` in order for `commandFor` to work. In order for it to act as a Submit button, it must not have command or commandfor attributes");if(t.hasAttribute("command")!==t.hasAttribute("commandfor")){let i=t.hasAttribute("command")?"command":"commandfor",m=t.hasAttribute("command")?"commandfor":"command";throw new Error(`Element with ${i} attribute must also have a ${m} attribute to function.`)}if(t.command!=="show-popover"&&t.command!=="hide-popover"&&t.command!=="toggle-popover"&&t.command!=="show-modal"&&t.command!=="request-close"&&t.command!=="close"&&!t.command.startsWith("--")){console.warn(`"${t.command}" is not a valid command value. Custom commands must begin with --`);return}let n=t.commandForElement;if(!n)return;let r=new u("command",{command:t.command,source:t,cancelable:!0});if(n.dispatchEvent(r),r.defaultPrevented)return;let a=r.command.toLowerCase();if(n.popover){let i=!n.matches(":popover-open");
vendor: 1,024 bytes, line 2
2i&&(a==="toggle-popover"||a==="show-popover")?n.showPopover({source:t}):!i&&a==="hide-popover"&&n.hidePopover()}else if(n.localName==="dialog"){let i=!n.hasAttribute("open");i&&a=="show-modal"?n.showModal():!i&&a=="close"?n.close(t.value?t.value:void 0):!i&&a=="request-close"&&(HTMLDialogElement.prototype.requestClose||(HTMLDialogElement.prototype.requestClose=function(){let m=new Event("cancel",{cancelable:!0});this.dispatchEvent(m),m.defaultPrevented||this.close()}),n.requestClose(t.value?t.value:void 0))}}function b(e){e.addEventListener("click",A,!0)}function T(e,o){let t=e.prototype.attachShadow;e.prototype.attachShadow=function(r){let a=t.call(this,r);return o(a),a};let n=e.prototype.attachInternals;e.prototype.attachInternals=function(){let r=n.call(this);return r.shadowRoot&&o(r.shadowRoot),r}}k(HTMLButtonElement),T(HTMLElement,e=>{b(e),f.observe(e,{attributeFilter:["oncommand"]}),d(e.querySelectorAll("[oncommand]"))}),b(document),Object.assign(globalThis,{CommandEvent:u,InvokeEvent:y})}g()||E();})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.