|
Server : Apache/2.4.58 (Win64) OpenSSL/3.1.3 PHP/8.2.12 System : Windows NT SERVER-PC 10.0 build 26200 (Windows 11) AMD64 User : ServerPC ( 0) PHP Version : 8.2.12 Disable Function : NONE Directory : C:/Users/ServerPC/AppData/Roaming/Emby-Server/system/dashboard-ui/modules/morphdom/ |
Upload File : |
define(["exports"],function(_exports){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0;var range;var NS_XHTML="http://www.w3.org/1999/xhtml",doc="undefined"==typeof document?void 0:document,HAS_TEMPLATE_SUPPORT=!!doc&&"content"in doc.createElement("template"),HAS_RANGE_SUPPORT=!!doc&&doc.createRange&&"createContextualFragment"in doc.createRange();function toElement(str){return str=str.trim(),(HAS_TEMPLATE_SUPPORT?function(str){var template=doc.createElement("template");return template.innerHTML=str,template.content.childNodes[0]}:HAS_RANGE_SUPPORT?function(str){return range||(range=doc.createRange()).selectNode(doc.body),range.createContextualFragment(str).childNodes[0]}:function(str){var fragment=doc.createElement("body");return fragment.innerHTML=str,fragment.childNodes[0]})(str)}function compareNodeNames(fromEl,toEl){var fromCodeStart,toCodeStart,fromEl=fromEl.nodeName,toEl=toEl.nodeName;return fromEl===toEl||(fromCodeStart=fromEl.charCodeAt(0),toCodeStart=toEl.charCodeAt(0),fromCodeStart<=90&&97<=toCodeStart?fromEl===toEl.toUpperCase():toCodeStart<=90&&97<=fromCodeStart&&toEl===fromEl.toUpperCase())}function syncBooleanAttrProp(fromEl,toEl,name){fromEl[name]!==toEl[name]&&(fromEl[name]=toEl[name],fromEl[name]?fromEl.setAttribute(name,""):fromEl.removeAttribute(name))}var specialElHandlers={OPTION:function(fromEl,toEl){var parentName,parentNode=fromEl.parentNode;parentNode&&"SELECT"===(parentName="OPTGROUP"===(parentName=parentNode.nodeName.toUpperCase())?(parentNode=parentNode.parentNode)&&parentNode.nodeName.toUpperCase():parentName)&&!parentNode.hasAttribute("multiple")&&(fromEl.hasAttribute("selected")&&!toEl.selected&&(fromEl.setAttribute("selected","selected"),fromEl.removeAttribute("selected")),parentNode.selectedIndex=-1),syncBooleanAttrProp(fromEl,toEl,"selected")},INPUT:function(fromEl,toEl){syncBooleanAttrProp(fromEl,toEl,"checked"),syncBooleanAttrProp(fromEl,toEl,"disabled"),fromEl.value!==toEl.value&&(fromEl.value=toEl.value),toEl.hasAttribute("value")||fromEl.removeAttribute("value")},TEXTAREA:function(fromEl,toEl){var oldValue,toEl=toEl.value,firstChild=(fromEl.value!==toEl&&(fromEl.value=toEl),fromEl.firstChild);firstChild&&(oldValue=firstChild.nodeValue)!==toEl&&(toEl||oldValue!==fromEl.placeholder)&&(firstChild.nodeValue=toEl)},SELECT:function(fromEl,toEl){if(!toEl.hasAttribute("multiple")){for(var optgroup,nodeName,selectedIndex=-1,i=0,curChild=fromEl.firstChild;curChild;)if("OPTGROUP"===(nodeName=curChild.nodeName&&curChild.nodeName.toUpperCase()))curChild=(optgroup=curChild).firstChild;else{if("OPTION"===nodeName){if(curChild.hasAttribute("selected")){selectedIndex=i;break}i++}!(curChild=curChild.nextSibling)&&optgroup&&(curChild=optgroup.nextSibling,optgroup=null)}fromEl.selectedIndex=selectedIndex}}};function noop(){}function defaultGetNodeKey(node){if(node)return node.getAttribute&&node.getAttribute("id")||node.id}var morphdom=function(morphAttrs){return function(fromNode,toNode,options){options=options||{},"string"==typeof toNode?"#document"===fromNode.nodeName||"HTML"===fromNode.nodeName||"BODY"===fromNode.nodeName?(toNodeHtml=toNode,(toNode=doc.createElement("html")).innerHTML=toNodeHtml):toNode=toElement(toNode):11===toNode.nodeType&&(toNode=toNode.firstElementChild);var getNodeKey=options.getNodeKey||defaultGetNodeKey,onBeforeNodeAdded=options.onBeforeNodeAdded||noop,onNodeAdded=options.onNodeAdded||noop,onBeforeNodeDiscarded=options.onBeforeNodeDiscarded||noop,onNodeDiscarded=options.onNodeDiscarded||noop,onBeforeElChildrenUpdated=options.onBeforeElChildrenUpdated||noop,toNodeHtml=!0===options.childrenOnly,fromNodesLookup=Object.create(null),keyedRemovalList=[];function addKeyedRemoval(key){keyedRemovalList.push(key)}function removeNode(node,parentNode,skipKeyedNodes){!1!==onBeforeNodeDiscarded(node)&&(parentNode&&parentNode.removeChild(node),onNodeDiscarded(node),function walkDiscardedChildNodes(node,skipKeyedNodes){if(1===node.nodeType)for(var curChild=node.firstChild;curChild;){var key=void 0;skipKeyedNodes&&(key=getNodeKey(curChild))?addKeyedRemoval(key):(onNodeDiscarded(curChild),curChild.firstChild&&walkDiscardedChildNodes(curChild,skipKeyedNodes)),curChild=curChild.nextSibling}}(node,skipKeyedNodes))}function morphEl(fromEl,toEl,childrenOnly){var toElKey=getNodeKey(toEl);if(toElKey&&delete fromNodesLookup[toElKey],!childrenOnly){if(!1===function(fromEl,toEl){return!fromEl.isEqualNode(toEl)}(fromEl,toEl))return;if(morphAttrs(fromEl,toEl),!1===onBeforeElChildrenUpdated(fromEl,toEl))return}"TEXTAREA"!==fromEl.nodeName?function(fromEl,toEl){var curToNodeKey,curFromNodeKey,fromNextSibling,toNextSibling,matchingFromEl,curToNodeChild=toEl.firstChild,curFromNodeChild=fromEl.firstChild;outer:for(;curToNodeChild;){for(toNextSibling=curToNodeChild.nextSibling,curToNodeKey=getNodeKey(curToNodeChild);curFromNodeChild;){if(fromNextSibling=curFromNodeChild.nextSibling,curToNodeChild.isSameNode&&curToNodeChild.isSameNode(curFromNodeChild)){curToNodeChild=toNextSibling,curFromNodeChild=fromNextSibling;continue outer}curFromNodeKey=getNodeKey(curFromNodeChild);var curFromNodeType=curFromNodeChild.nodeType,isCompatible=void 0;if(curFromNodeType===curToNodeChild.nodeType&&(1===curFromNodeType?(curToNodeKey?curToNodeKey!==curFromNodeKey&&(!(matchingFromEl=fromNodesLookup[curToNodeKey])||fromNextSibling===matchingFromEl?isCompatible=!1:(fromEl.insertBefore(matchingFromEl,curFromNodeChild),curFromNodeKey?addKeyedRemoval(curFromNodeKey):removeNode(curFromNodeChild,fromEl,!0),curFromNodeChild=matchingFromEl)):curFromNodeKey&&(isCompatible=!1),(isCompatible=!1!==isCompatible&&compareNodeNames(curFromNodeChild,curToNodeChild))&&morphEl(curFromNodeChild,curToNodeChild)):3!==curFromNodeType&&8!==curFromNodeType||(isCompatible=!0,curFromNodeChild.nodeValue!==curToNodeChild.nodeValue&&(curFromNodeChild.nodeValue=curToNodeChild.nodeValue))),isCompatible){curToNodeChild=toNextSibling,curFromNodeChild=fromNextSibling;continue outer}curFromNodeKey?addKeyedRemoval(curFromNodeKey):removeNode(curFromNodeChild,fromEl,!0),curFromNodeChild=fromNextSibling}var onBeforeNodeAddedResult;curToNodeKey&&(matchingFromEl=fromNodesLookup[curToNodeKey])&&compareNodeNames(matchingFromEl,curToNodeChild)?(fromEl.appendChild(matchingFromEl),morphEl(matchingFromEl,curToNodeChild)):!1!==(onBeforeNodeAddedResult=onBeforeNodeAdded(curToNodeChild))&&((curToNodeChild=onBeforeNodeAddedResult?onBeforeNodeAddedResult:curToNodeChild).actualize&&(curToNodeChild=curToNodeChild.actualize(fromEl.ownerDocument||doc)),fromEl.appendChild(curToNodeChild),function handleNodeAdded(el){onNodeAdded(el);for(var curChild=el.firstChild;curChild;){var nextSibling=curChild.nextSibling,key=getNodeKey(curChild);(key=key&&fromNodesLookup[key])&&compareNodeNames(curChild,key)?(curChild.parentNode.replaceChild(key,curChild),morphEl(key,curChild)):handleNodeAdded(curChild),curChild=nextSibling}}(curToNodeChild)),curToNodeChild=toNextSibling,curFromNodeChild=fromNextSibling}!function(fromEl,curFromNodeChild,curFromNodeKey){for(;curFromNodeChild;){var fromNextSibling=curFromNodeChild.nextSibling;(curFromNodeKey=getNodeKey(curFromNodeChild))?addKeyedRemoval(curFromNodeKey):removeNode(curFromNodeChild,fromEl,!0),curFromNodeChild=fromNextSibling}}(fromEl,curFromNodeChild);var specialElHandler=specialElHandlers[fromEl.nodeName];specialElHandler&&specialElHandler(fromEl,toEl)}(fromEl,toEl):specialElHandlers.TEXTAREA(fromEl,toEl)}!function indexTree(node){if(1===node.nodeType||11===node.nodeType)for(var curChild=node.firstChild;curChild;){var key=getNodeKey(curChild);key&&(fromNodesLookup[key]=curChild),indexTree(curChild),curChild=curChild.nextSibling}}(fromNode);var name,namespaceURI,options=fromNode,morphedNodeType=options.nodeType,toNodeType=toNode.nodeType;if(!toNodeHtml)if(1===morphedNodeType)1===toNodeType?compareNodeNames(fromNode,toNode)||(onNodeDiscarded(fromNode),options=function(fromEl,toEl){for(var curChild=fromEl.firstChild;curChild;){var nextChild=curChild.nextSibling;toEl.appendChild(curChild),curChild=nextChild}return toEl}(fromNode,(name=toNode.nodeName,(namespaceURI=toNode.namespaceURI)&&namespaceURI!==NS_XHTML?doc.createElementNS(namespaceURI,name):doc.createElement(name)))):options=toNode;else if(3===morphedNodeType||8===morphedNodeType){if(toNodeType===morphedNodeType)return options.nodeValue!==toNode.nodeValue&&(options.nodeValue=toNode.nodeValue),options;options=toNode}if(options===toNode)onNodeDiscarded(fromNode);else{if(toNode.isSameNode&&toNode.isSameNode(options))return;if(morphEl(options,toNode,toNodeHtml),keyedRemovalList)for(var i=0,len=keyedRemovalList.length;i<len;i++){var elToRemove=fromNodesLookup[keyedRemovalList[i]];elToRemove&&removeNode(elToRemove,elToRemove.parentNode,!1)}}return!toNodeHtml&&options!==fromNode&&fromNode.parentNode&&(options.actualize&&(options=options.actualize(fromNode.ownerDocument||doc)),fromNode.parentNode.replaceChild(options,fromNode)),options}}(function(fromNode,toNode){var attr,attrName,attrNamespaceURI,attrValue,toNodeAttrs=toNode.attributes;if(11!==toNode.nodeType&&11!==fromNode.nodeType){for(var i=toNodeAttrs.length-1;0<=i;i--)attrName=(attr=toNodeAttrs[i]).name,attrNamespaceURI=attr.namespaceURI,attrValue=attr.value,attrNamespaceURI?(attrName=attr.localName||attrName,fromNode.getAttributeNS(attrNamespaceURI,attrName)!==attrValue&&("xmlns"===attr.prefix&&(attrName=attr.name),fromNode.setAttributeNS(attrNamespaceURI,attrName,attrValue))):fromNode.getAttribute(attrName)!==attrValue&&fromNode.setAttribute(attrName,attrValue);for(var fromNodeAttrs=fromNode.attributes,d=fromNodeAttrs.length-1;0<=d;d--)attrName=(attr=fromNodeAttrs[d]).name,(attrNamespaceURI=attr.namespaceURI)?(attrName=attr.localName||attrName,toNode.hasAttributeNS(attrNamespaceURI,attrName)||fromNode.removeAttributeNS(attrNamespaceURI,attrName)):toNode.hasAttribute(attrName)||fromNode.removeAttribute(attrName)}});_exports.default=morphdom});