blob: 24ab2cf4e134bca14983bc841eb2dbf6ff02fe50 [file] [log] [blame]
/*
* Copyright (C) 2007-2016 Apple Inc. All rights reserved.
* Copyright (C) 2008 Matt Lilek. All rights reserved.
* Copyright (C) 2008-2009 Anthony Ricaud <rik@webkit.org>
* Copyright (C) 2009-2010 Joseph Pecoraro. All rights reserved.
* Copyright (C) 2009-2011 Google Inc. All rights reserved.
* Copyright (C) 2009 280 North Inc. All Rights Reserved.
* Copyright (C) 2010 Nikita Vasilyev. All rights reserved.
* Copyright (C) 2011 Brian Grinstead All rights reserved.
* Copyright (C) 2013 Matt Holden <jftholden@yahoo.com>
* Copyright (C) 2013 Samsung Electronics. All rights reserved.
* Copyright (C) 2013 Seokju Kwon (seokju.kwon@gmail.com)
* Copyright (C) 2013 Adobe Systems Inc. All rights reserved.
* Copyright (C) 2013-2015 University of Washington. All rights reserved.
* Copyright (C) 2014-2015 Saam Barati <saambarati1@gmail.com>
* Copyright (C) 2014 Antoine Quint
* Copyright (C) 2015 Tobias Reiss <tobi+webkit@basecode.de>
* Copyright (C) 2015-2016 Devin Rousso <dcrousso+webkit@gmail.com>. All rights reserved.
* Copyright (C) 2017 Sony Interactive Entertainment Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
var WebInspector={};WebInspector.Platform={name:InspectorFrontendHost.platform(),isNightlyBuild:false,version:{base:0,release:0,name:""}};(function(){var versionMatch=/ AppleWebKit\/([^ ]+)/.exec(navigator.userAgent);if(versionMatch&&versionMatch[1].indexOf("+")!==-1&&document.styleSheets.length<10)
WebInspector.Platform.isNightlyBuild=true;var osVersionMatch=/ Mac OS X (\d+)_(\d+)/.exec(navigator.appVersion);if(osVersionMatch&&osVersionMatch[1]==="10"){WebInspector.Platform.version.base=10;WebInspector.Platform.version.release=parseInt(osVersionMatch[2]);switch(osVersionMatch[2]){case"12":WebInspector.Platform.version.name="sierra";break;case"11":WebInspector.Platform.version.name="el-capitan";break;case"10":WebInspector.Platform.version.name="yosemite";break;default:WebInspector.Platform.version.name="unknown-mac";break;}}})();class LinkedList
{constructor()
{this.head=new LinkedListNode;this.head.next=this.head.prev=this.head;this.length=0;}
clear()
{this.head.next=this.head.prev=this.head;this.length=0;}
get last()
{return this.head.prev;}
push(item)
{let newNode=new LinkedListNode(item);let last=this.last;let head=this.head;last.next=newNode;newNode.next=head;head.prev=newNode;newNode.prev=last;this.length++;return newNode;}
remove(node)
{if(!node)
return false;node.prev.next=node.next;node.next.prev=node.prev;this.length--;return true;}
forEach(callback)
{let node=this.head;for(let i=0,length=this.length;i<length;i++){node=node.next;let returnValue=callback(node.value,i);if(returnValue===false)
return;}}
toArray()
{let node=this.head;let i=this.length;let result=new Array(i);while(i--){node=node.prev;result[i]=node.value;}
return result;}
toJSON()
{return this.toArray();}}
class LinkedListNode
{constructor(value)
{this.value=value;this.prev=null;this.next=null;}}
class ListMultimap
{constructor()
{this._insertionOrderedEntries=new LinkedList;this._keyMap=new Map;}
get size()
{return this._insertionOrderedEntries.length;}
add(key,value)
{let nodeMap=this._keyMap.get(key);if(!nodeMap){nodeMap=new Map;this._keyMap.set(key,nodeMap);}
let node=nodeMap.get(value);if(!node){node=this._insertionOrderedEntries.push([key,value]);nodeMap.set(value,node);}
return this;}
delete(key,value)
{let nodeMap=this._keyMap.get(key);if(!nodeMap)
return false;let node=nodeMap.get(value);if(!node)
return false;nodeMap.delete(value);this._insertionOrderedEntries.remove(node);return true;}
deleteAll(key)
{let nodeMap=this._keyMap.get(key);if(!nodeMap)
return false;let list=this._insertionOrderedEntries;let didDelete=false;nodeMap.forEach(function(node){list.remove(node);didDelete=true;});this._keyMap.delete(key);return didDelete;}
has(key,value)
{let nodeMap=this._keyMap.get(key);if(!nodeMap)
return false;return nodeMap.has(value);}
clear()
{this._keyMap=new Map;this._insertionOrderedEntries=new LinkedList;}
forEach(callback)
{this._insertionOrderedEntries.forEach(callback);}
toArray()
{return this._insertionOrderedEntries.toArray();}
toJSON()
{return this.toArray();}}
WebInspector.Object=class WebInspectorObject
{constructor()
{this._listeners=null;}
static addEventListener(eventType,listener,thisObject)
{thisObject=thisObject||null;if(!eventType)
return null;if(!listener)
return null;if(!this._listeners)
this._listeners=new Map();let listenersTable=this._listeners.get(eventType);if(!listenersTable){listenersTable=new ListMultimap();this._listeners.set(eventType,listenersTable);}
listenersTable.add(thisObject,listener);return listener;}
static singleFireEventListener(eventType,listener,thisObject)
{let wrappedCallback=function(){this.removeEventListener(eventType,wrappedCallback,null);listener.apply(thisObject,arguments);}.bind(this);this.addEventListener(eventType,wrappedCallback,null);return wrappedCallback;}
static removeEventListener(eventType,listener,thisObject)
{eventType=eventType||null;listener=listener||null;thisObject=thisObject||null;if(!this._listeners)
return;if(thisObject&&!eventType){this._listeners.forEach(function(listenersTable){let listenerPairs=listenersTable.toArray();for(let i=0,length=listenerPairs.length;i<length;++i){let existingThisObject=listenerPairs[i][0];if(existingThisObject===thisObject)
listenersTable.deleteAll(existingThisObject);}});return;}
let listenersTable=this._listeners.get(eventType);if(!listenersTable||listenersTable.size===0)
return;let didDelete=listenersTable.delete(thisObject,listener);}
static awaitEvent(eventType)
{let wrapper=new WebInspector.WrappedPromise;this.singleFireEventListener(eventType,(event)=>wrapper.resolve(event));return wrapper.promise;}
static hasEventListeners(eventType)
{if(!this._listeners)
return false;let listenersTable=this._listeners.get(eventType);return listenersTable&&listenersTable.size>0;}
static retainedObjectsWithPrototype(proto)
{let results=new Set;if(this._listeners){this._listeners.forEach(function(listenersTable,eventType){listenersTable.forEach(function(pair){let thisObject=pair[0];if(thisObject instanceof proto)
results.add(thisObject);});});}
return results;}
addEventListener(){return WebInspector.Object.addEventListener.apply(this,arguments);}
singleFireEventListener(){return WebInspector.Object.singleFireEventListener.apply(this,arguments);}
removeEventListener(){return WebInspector.Object.removeEventListener.apply(this,arguments);}
awaitEvent(){return WebInspector.Object.awaitEvent.apply(this,arguments);}
hasEventListeners(){return WebInspector.Object.hasEventListeners.apply(this,arguments);}
retainedObjectsWithPrototype(){return WebInspector.Object.retainedObjectsWithPrototype.apply(this,arguments);}
dispatchEventToListeners(eventType,eventData)
{let event=new WebInspector.Event(this,eventType,eventData);function dispatch(object)
{if(!object||event._stoppedPropagation)
return;let listenerTypesMap=object._listeners;if(!listenerTypesMap||!object.hasOwnProperty("_listeners"))
return;let listenersTable=listenerTypesMap.get(eventType);if(!listenersTable)
return;let listeners=listenersTable.toArray();for(let i=0,length=listeners.length;i<length;++i){let[thisObject,listener]=listeners[i];listener.call(thisObject,event);if(event._stoppedPropagation)
break;}}
dispatch(this);event._stoppedPropagation=false;let constructor=this.constructor;while(constructor){dispatch(constructor);if(!constructor.prototype.__proto__)
break;constructor=constructor.prototype.__proto__.constructor;}
return event.defaultPrevented;}};WebInspector.Event=class Event
{constructor(target,type,data)
{this.target=target;this.type=type;this.data=data;this.defaultPrevented=false;this._stoppedPropagation=false;}
stopPropagation()
{this._stoppedPropagation=true;}
preventDefault()
{this.defaultPrevented=true;}};WebInspector.notifications=new WebInspector.Object;WebInspector.Notification={GlobalModifierKeysDidChange:"global-modifiers-did-change",PageArchiveStarted:"page-archive-started",PageArchiveEnded:"page-archive-ended",ExtraDomainsActivated:"extra-domains-activated",TabTypesChanged:"tab-types-changed",DebugUIEnabledDidChange:"debug-ui-enabled-did-change",VisibilityStateDidChange:"visibility-state-did-change",};WebInspector.roleSelectorForNode=function(node)
{ var title="";var role=node.computedRole();if(role)
title=":role("+role+")";return title;};WebInspector.linkifyAccessibilityNodeReference=function(node)
{if(!node)
return null;var link=WebInspector.linkifyNodeReference(node);var tagIdSelector=link.title;var classSelectorIndex=tagIdSelector.indexOf(".");if(classSelectorIndex>-1)
tagIdSelector=tagIdSelector.substring(0,classSelectorIndex);var roleSelector=WebInspector.roleSelectorForNode(node);link.textContent=tagIdSelector+roleSelector;link.title+=roleSelector;return link;};WebInspector.linkifyNodeReference=function(node,options={})
{let displayName=node.displayName;if(!isNaN(options.maxLength))
displayName=displayName.truncate(options.maxLength);let link=document.createElement("span");link.append(displayName);return WebInspector.linkifyNodeReferenceElement(node,link,Object.shallowMerge(options,{displayName}));};WebInspector.linkifyNodeReferenceElement=function(node,element,options={})
{element.setAttribute("role","link");element.title=options.displayName||node.displayName;let nodeType=node.nodeType();if((nodeType!==Node.DOCUMENT_NODE||node.parentNode)&&nodeType!==Node.TEXT_NODE)
element.classList.add("node-link");element.addEventListener("click",WebInspector.domTreeManager.inspectElement.bind(WebInspector.domTreeManager,node.id));element.addEventListener("mouseover",WebInspector.domTreeManager.highlightDOMNode.bind(WebInspector.domTreeManager,node.id,"all"));element.addEventListener("mouseout",WebInspector.domTreeManager.hideDOMNodeHighlight.bind(WebInspector.domTreeManager));element.addEventListener("contextmenu",(event)=>{let contextMenu=WebInspector.ContextMenu.createFromEvent(event);WebInspector.appendContextMenuItemsForDOMNode(contextMenu,node,options);});return element;};function createSVGElement(tagName)
{return document.createElementNS("http://www.w3.org/2000/svg",tagName);}
WebInspector.cssPath=function(node)
{if(node.nodeType()!==Node.ELEMENT_NODE)
return"";let suffix="";if(node.isPseudoElement()){suffix="::"+node.pseudoType();node=node.parentNode;}
let components=[];while(node){let component=WebInspector.cssPathComponent(node);if(!component)
break;components.push(component);if(component.done)
break;node=node.parentNode;}
components.reverse();return components.map((x)=>x.value).join(" > ")+suffix;};WebInspector.cssPathComponent=function(node)
{if(node.nodeType()!==Node.ELEMENT_NODE)
return null;let nodeName=node.nodeNameInCorrectCase();let lowerNodeName=node.nodeName().toLowerCase();if(lowerNodeName==="body"||lowerNodeName==="head"||lowerNodeName==="html")
return{value:nodeName,done:true};let id=node.getAttribute("id");if(id)
return{value:node.escapedIdSelector,done:true};if(!node.parentNode||node.parentNode.nodeType()===Node.DOCUMENT_NODE)
return{value:nodeName,done:true};
function classNames(node){let classAttribute=node.getAttribute("class");return classAttribute?classAttribute.trim().split(/\s+/):[];}
let nthChildIndex=-1;let hasUniqueTagName=true;let uniqueClasses=new Set(classNames(node));let siblings=node.parentNode.children;let elementIndex=0;for(let sibling of siblings){if(sibling.nodeType()!==Node.ELEMENT_NODE)
continue;elementIndex++;if(sibling===node){nthChildIndex=elementIndex;continue;}
if(sibling.nodeNameInCorrectCase()===nodeName)
hasUniqueTagName=false;if(uniqueClasses.size){let siblingClassNames=classNames(sibling);for(let className of siblingClassNames)
uniqueClasses.delete(className);}}
let selector=nodeName;if(lowerNodeName==="input"&&node.getAttribute("type")&&!uniqueClasses.size)
selector+=`[type="${node.getAttribute("type")}"]`;if(!hasUniqueTagName){if(uniqueClasses.size)
selector+=node.escapedClassSelector;else
selector+=`:nth-child(${nthChildIndex})`;}
return{value:selector,done:false};};WebInspector.xpath=function(node)
{if(node.nodeType()===Node.DOCUMENT_NODE)
return"/";let components=[];while(node){let component=WebInspector.xpathComponent(node);if(!component)
break;components.push(component);if(component.done)
break;node=node.parentNode;}
components.reverse();let prefix=components.length&&components[0].done?"":"/";return prefix+components.map((x)=>x.value).join("/");};WebInspector.xpathComponent=function(node)
{let index=WebInspector.xpathIndex(node);if(index===-1)
return null;let value;switch(node.nodeType()){case Node.DOCUMENT_NODE:return{value:"",done:true};case Node.ELEMENT_NODE:var id=node.getAttribute("id");if(id)
return{value:`//*[@id="${id}"]`,done:true};value=node.localName();break;case Node.ATTRIBUTE_NODE:value=`@${node.nodeName()}`;break;case Node.TEXT_NODE:case Node.CDATA_SECTION_NODE:value="text()";break;case Node.COMMENT_NODE:value="comment()";break;case Node.PROCESSING_INSTRUCTION_NODE:value="processing-instruction()";break;default:value="";break;}
if(index>0)
value+=`[${index}]`;return{value,done:false};};WebInspector.xpathIndex=function(node)
{if(!node.parentNode)
return 0;let siblings=node.parentNode.children;if(siblings.length<=1)
return 0;
function isSimiliarNode(a,b){if(a===b)
return true;let aType=a.nodeType();let bType=b.nodeType();if(aType===Node.ELEMENT_NODE&&bType===Node.ELEMENT_NODE)
return a.localName()===b.localName();if(aType===Node.CDATA_SECTION_NODE)
return aType===Node.TEXT_NODE;if(bType===Node.CDATA_SECTION_NODE)
return bType===Node.TEXT_NODE;return aType===bType;}
let unique=true;let xPathIndex=-1;let xPathIndexCounter=1;for(let sibling of siblings){if(!isSimiliarNode(node,sibling))
continue;if(node===sibling){xPathIndex=xPathIndexCounter;if(!unique)
return xPathIndex;}else{unique=false;if(xPathIndex!==-1)
return xPathIndex;}
xPathIndexCounter++;}
if(unique)
return 0;return xPathIndex;};WebInspector.EventListener=class EventListener
{constructor(thisObject,fireOnce)
{this._thisObject=thisObject;this._emitter=null;this._callback=null;this._fireOnce=fireOnce;}
connect(emitter,type,callback,usesCapture)
{var emitterIsValid=emitter&&(emitter instanceof WebInspector.Object||emitter instanceof Node||(typeof emitter.addEventListener==="function"));if(!emitterIsValid||!type||!callback)
return;this._emitter=emitter;this._type=type;this._usesCapture=!!usesCapture;if(emitter instanceof Node)
callback=callback.bind(this._thisObject);if(this._fireOnce){var listener=this;this._callback=function(){listener.disconnect();callback.apply(this,arguments);};}else
this._callback=callback;if(this._emitter instanceof Node)
this._emitter.addEventListener(this._type,this._callback,this._usesCapture);else
this._emitter.addEventListener(this._type,this._callback,this._thisObject);}
disconnect()
{if(!this._emitter||!this._callback)
return;if(this._emitter instanceof Node)
this._emitter.removeEventListener(this._type,this._callback,this._usesCapture);else
this._emitter.removeEventListener(this._type,this._callback,this._thisObject);if(this._fireOnce)
delete this._thisObject;delete this._emitter;delete this._type;delete this._callback;}};
WebInspector.EventListenerSet=class EventListenerSet
{constructor(defaultThisObject,name)
{this.name=name;this._defaultThisObject=defaultThisObject;this._listeners=[];this._installed=false;}
register(emitter,type,callback,thisObject,usesCapture)
{var emitterIsValid=emitter&&(emitter instanceof WebInspector.Object||emitter instanceof Node||(typeof emitter.addEventListener==="function"));if(!emitterIsValid||!type||!callback)
return;this._listeners.push({listener:new WebInspector.EventListener(thisObject||this._defaultThisObject),emitter,type,callback,usesCapture});}
unregister()
{if(this._installed)
this.uninstall();this._listeners=[];}
install()
{if(this._installed)
return;this._installed=true;for(var data of this._listeners)
data.listener.connect(data.emitter,data.type,data.callback,data.usesCapture);}
uninstall(unregisterListeners)
{if(!this._installed)
return;this._installed=false;for(var data of this._listeners)
data.listener.disconnect();if(unregisterListeners)
this._listeners=[];}};function useSVGSymbol(url,className,title)
{const svgNamespace="http://www.w3.org/2000/svg";const xlinkNamespace="http://www.w3.org/1999/xlink";let svgElement=document.createElementNS(svgNamespace,"svg");svgElement.style.width="100%";svgElement.style.height="100%";
if(!url.includes("#"))
url+="#root";let useElement=document.createElementNS(svgNamespace,"use");useElement.setAttributeNS(xlinkNamespace,"xlink:href",url);svgElement.appendChild(useElement);let wrapper=document.createElement("div");wrapper.appendChild(svgElement);if(className)
wrapper.className=className;if(title)
wrapper.title=title;return wrapper;}
(function(){if(WebInspector.dontLocalizeUserInterface)
return;let localizedStringsURL=InspectorFrontendHost.localizedStringsURL();if(localizedStringsURL)
document.write("<script src=\""+localizedStringsURL+"\"></script>");})();WebInspector.unlocalizedString=function(string)
{
return string;};WebInspector.UIString=function(string,vararg)
{if(WebInspector.dontLocalizeUserInterface)
return string;if(window.localizedStrings&&string in window.localizedStrings)
return window.localizedStrings[string];if(!window.localizedStrings)
console.error(`Attempted to load localized string "${string}" before localizedStrings was initialized.`);if(!this._missingLocalizedStrings)
this._missingLocalizedStrings={};if(!(string in this._missingLocalizedStrings)){console.error("Localized string \""+string+"\" was not found.");this._missingLocalizedStrings[string]=true;}
return"LOCALIZED STRING NOT FOUND";};WebInspector.fileExtensionForURL=function(url)
{var lastPathComponent=parseURL(url).lastPathComponent;if(!lastPathComponent)
return"";var index=lastPathComponent.indexOf(".");if(index===-1)
return"";return lastPathComponent.substr(index+1);};WebInspector.mimeTypeForFileExtension=function(extension)
{const extensionToMIMEType={"html":"text/html","xhtml":"application/xhtml+xml","xml":"text/xml","js":"text/javascript","json":"application/json","clj":"text/x-clojure","coffee":"text/x-coffeescript","ls":"text/x-livescript","ts":"text/typescript","css":"text/css","less":"text/x-less","sass":"text/x-sass","scss":"text/x-scss","bmp":"image/bmp","gif":"image/gif","jpeg":"image/jpeg","jpg":"image/jpeg","pdf":"application/pdf","png":"image/png","tif":"image/tiff","tiff":"image/tiff","svg":"image/svg+xml","txt":"text/plain","xsl":"text/xsl"};return extensionToMIMEType[extension]||null;};WebInspector.fileExtensionForMIMEType=function(mimeType)
{const mimeTypeToExtension={"text/html":"html","application/xhtml+xml":"xhtml","text/xml":"xml","text/javascript":"js","application/json":"json","text/x-clojure":"clj","text/x-coffeescript":"coffee","text/x-livescript":"ls","text/typescript":"ts","text/css":"css","text/x-less":"less","text/x-sass":"sass","text/x-scss":"scss","image/bmp":"bmp","image/gif":"gif","image/jpeg":"jpg","application/pdf":"pdf","image/png":"png","image/tiff":"tiff","image/svg+xml":"svg","text/plain":"txt","text/xsl":"xsl",};let extension=mimeTypeToExtension[mimeType];return extension?`.${extension}`:null;};WebInspector.rangeForNextCSSNameOrValue=function(text,index=0){let from=0;let to=0;let colonIndex=text.indexOf(":");if(index<colonIndex){from=0;to=colonIndex;}else{from=colonIndex+1;to=text.length;}
let substring=text.substring(from,to);from+=substring.match(/^\s*/)[0].length;to-=substring.match(/[\s\;]*$/)[0].length;return{from,to};};function removeURLFragment(url)
{var hashIndex=url.indexOf("#");if(hashIndex>=0)
return url.substring(0,hashIndex);return url;}
function relativePath(path,basePath)
{var pathComponents=path.split("/");var baseComponents=basePath.replace(/\/$/,"").split("/");var finalComponents=[];var index=1;for(;index<pathComponents.length&&index<baseComponents.length;++index){if(pathComponents[index]!==baseComponents[index])
break;}
for(var i=index;i<baseComponents.length;++i)
finalComponents.push("..");for(var i=index;i<pathComponents.length;++i)
finalComponents.push(pathComponents[i]);return finalComponents.join("/");}
function parseSecurityOrigin(securityOrigin)
{securityOrigin=securityOrigin?securityOrigin.trim():"";var match=securityOrigin.match(/^([^:]+):\/\/([^\/:]*)(?::([\d]+))?$/i);if(!match)
return{scheme:null,host:null,port:null};var scheme=match[1].toLowerCase();var host=match[2].toLowerCase();var port=Number(match[3])||null;return{scheme,host,port};}
function parseDataURL(url)
{if(!url.startsWith("data:"))
return null;let match=url.match(/^data:([^;,]*)?(?:;charset=([^;,]*?))?(;base64)?,(.*)$/);if(!match)
return null;let scheme="data";let mimeType=match[1]||"text/plain";let charset=match[2]||"US-ASCII";let base64=!!match[3];let data=decodeURIComponent(match[4]);return{scheme,mimeType,charset,base64,data};}
function parseURL(url)
{url=url?url.trim():"";if(url.startsWith("data:"))
return{scheme:"data",host:null,port:null,path:null,queryString:null,fragment:null,lastPathComponent:null};var match=url.match(/^([^\/:]+):\/\/([^\/#:]*)(?::([\d]+))?(?:(\/[^#]*)?(?:#(.*))?)?$/i);if(!match)
return{scheme:null,host:null,port:null,path:null,queryString:null,fragment:null,lastPathComponent:null};var scheme=match[1].toLowerCase();var host=match[2].toLowerCase();var port=Number(match[3])||null;var wholePath=match[4]||null;var fragment=match[5]||null;var path=wholePath;var queryString=null;if(wholePath){var indexOfQuery=wholePath.indexOf("?");if(indexOfQuery!==-1){path=wholePath.substring(0,indexOfQuery);queryString=wholePath.substring(indexOfQuery+1);}
path=resolveDotsInPath(path);}
var lastPathComponent=null;if(path&&path!=="/"){var endOffset=path[path.length-1]==="/"?1:0;var lastSlashIndex=path.lastIndexOf("/",path.length-1-endOffset);if(lastSlashIndex!==-1)
lastPathComponent=path.substring(lastSlashIndex+1,path.length-endOffset);}
return{scheme,host,port,path,queryString,fragment,lastPathComponent};}
function absoluteURL(partialURL,baseURL)
{partialURL=partialURL?partialURL.trim():"";if(partialURL.startsWith("data:")||partialURL.startsWith("javascript:")||partialURL.startsWith("mailto:"))
return partialURL;if(parseURL(partialURL).scheme)
return partialURL;if(!partialURL)
return baseURL||null;var baseURLComponents=parseURL(baseURL);if(!baseURLComponents.scheme)
return null;if(partialURL[0]==="/"&&partialURL[1]==="/")
return baseURLComponents.scheme+":"+partialURL;if(!baseURLComponents.path)
baseURLComponents.path="/";var baseURLPrefix=baseURLComponents.scheme+"://"+baseURLComponents.host+(baseURLComponents.port?(":"+baseURLComponents.port):"");if(partialURL[0]==="?")
return baseURLPrefix+baseURLComponents.path+partialURL;if(partialURL[0]==="/")
return baseURLPrefix+resolveDotsInPath(partialURL);if(partialURL[0]==="#"){let queryStringComponent=baseURLComponents.queryString?"?"+baseURLComponents.queryString:"";return baseURLPrefix+baseURLComponents.path+queryStringComponent+partialURL;}
var basePath=baseURLComponents.path.substring(0,baseURLComponents.path.lastIndexOf("/"))+"/";return baseURLPrefix+resolveDotsInPath(basePath+partialURL);}
function parseLocationQueryParameters(arrayResult)
{return parseQueryString(window.location.search.substring(1),arrayResult);}
function parseQueryString(queryString,arrayResult)
{if(!queryString)
return arrayResult?[]:{};function decode(string)
{try{return decodeURIComponent(string.replace(/\+/g," "));}catch(e){return string;}}
var parameters=arrayResult?[]:{};var parameterStrings=queryString.split("&");for(var i=0;i<parameterStrings.length;++i){var pair=parameterStrings[i].split("=").map(decode);if(arrayResult)
parameters.push({name:pair[0],value:pair[1]});else
parameters[pair[0]]=pair[1];}
return parameters;}
WebInspector.displayNameForURL=function(url,urlComponents)
{if(url.startsWith("data:"))
return WebInspector.truncateURL(url);if(!urlComponents)
urlComponents=parseURL(url);var displayName;try{displayName=decodeURIComponent(urlComponents.lastPathComponent||"");}catch(e){displayName=urlComponents.lastPathComponent;}
return displayName||WebInspector.displayNameForHost(urlComponents.host)||url;};WebInspector.truncateURL=function(url,multiline=false,dataURIMaxSize=6)
{if(!url.startsWith("data:"))
return url;const dataIndex=url.indexOf(",")+1;let header=url.slice(0,dataIndex);if(multiline)
header+="\n";const data=url.slice(dataIndex);if(data.length<dataURIMaxSize)
return header+data;const firstChunk=data.slice(0,Math.ceil(dataURIMaxSize/2));const ellipsis="\u2026";const middleChunk=multiline?`\n${ellipsis}\n`:ellipsis;const lastChunk=data.slice(-Math.floor(dataURIMaxSize/2));return header+firstChunk+middleChunk+lastChunk;};WebInspector.displayNameForHost=function(host)
{return host;};var emDash="\u2014";var enDash="\u2013";var figureDash="\u2012";var ellipsis="\u2026";var zeroWidthSpace="\u200b";Object.defineProperty(Object,"shallowCopy",{value:function(object)
{var copy={};var keys=Object.keys(object);for(var i=0;i<keys.length;++i)
copy[keys[i]]=object[keys[i]];return copy;}});Object.defineProperty(Object,"shallowEqual",{value:function(a,b)
{if(!(a instanceof Object)||!(b instanceof Object))
return false;if(a===b)
return true;if(Array.isArray(a)&&Array.isArray(b))
return Array.shallowEqual(a,b);if(a.constructor!==b.constructor)
return false;var aKeys=Object.keys(a);var bKeys=Object.keys(b);if(aKeys.length!==bKeys.length)
return false;for(var i=0;i<aKeys.length;++i){if(!(aKeys[i]in b))
return false;
if(a[aKeys[i]]!==b[aKeys[i]])
return false;}
return true;}});Object.defineProperty(Object,"shallowMerge",{value(a,b)
{let result=Object.shallowCopy(a);let keys=Object.keys(b);for(let i=0;i<keys.length;++i){result[keys[i]]=b[keys[i]];}
return result;}});Object.defineProperty(Object.prototype,"valueForCaseInsensitiveKey",{value:function(key)
{if(this.hasOwnProperty(key))
return this[key];var lowerCaseKey=key.toLowerCase();for(var currentKey in this){if(currentKey.toLowerCase()===lowerCaseKey)
return this[currentKey];}
return undefined;}});Object.defineProperty(Map,"fromObject",{value:function(object)
{let map=new Map;for(let key in object)
map.set(key,object[key]);return map;}});Object.defineProperty(Map.prototype,"take",{value:function(key)
{var deletedValue=this.get(key);this.delete(key);return deletedValue;}});Object.defineProperty(Node.prototype,"enclosingNodeOrSelfWithClass",{value:function(className)
{for(var node=this;node&&node!==this.ownerDocument;node=node.parentNode)
if(node.nodeType===Node.ELEMENT_NODE&&node.classList.contains(className))
return node;return null;}});Object.defineProperty(Node.prototype,"enclosingNodeOrSelfWithNodeNameInArray",{value:function(nameArray)
{var lowerCaseNameArray=nameArray.map(function(name){return name.toLowerCase();});for(var node=this;node&&node!==this.ownerDocument;node=node.parentNode){for(var i=0;i<nameArray.length;++i){if(node.nodeName.toLowerCase()===lowerCaseNameArray[i])
return node;}}
return null;}});Object.defineProperty(Node.prototype,"enclosingNodeOrSelfWithNodeName",{value:function(nodeName)
{return this.enclosingNodeOrSelfWithNodeNameInArray([nodeName]);}});Object.defineProperty(Node.prototype,"isAncestor",{value:function(node)
{if(!node)
return false;var currentNode=node.parentNode;while(currentNode){if(this===currentNode)
return true;currentNode=currentNode.parentNode;}
return false;}});Object.defineProperty(Node.prototype,"isDescendant",{value:function(descendant)
{return!!descendant&&descendant.isAncestor(this);}});Object.defineProperty(Node.prototype,"isSelfOrAncestor",{value:function(node)
{return!!node&&(node===this||this.isAncestor(node));}});Object.defineProperty(Node.prototype,"isSelfOrDescendant",{value:function(node)
{return!!node&&(node===this||this.isDescendant(node));}});Object.defineProperty(Node.prototype,"traverseNextNode",{value:function(stayWithin)
{var node=this.firstChild;if(node)
return node;if(stayWithin&&this===stayWithin)
return null;node=this.nextSibling;if(node)
return node;node=this;while(node&&!node.nextSibling&&(!stayWithin||!node.parentNode||node.parentNode!==stayWithin))
node=node.parentNode;if(!node)
return null;return node.nextSibling;}});Object.defineProperty(Node.prototype,"traversePreviousNode",{value:function(stayWithin)
{if(stayWithin&&this===stayWithin)
return null;var node=this.previousSibling;while(node&&node.lastChild)
node=node.lastChild;if(node)
return node;return this.parentNode;}});Object.defineProperty(Node.prototype,"rangeOfWord",{value:function(offset,stopCharacters,stayWithinNode,direction)
{var startNode;var startOffset=0;var endNode;var endOffset=0;if(!stayWithinNode)
stayWithinNode=this;if(!direction||direction==="backward"||direction==="both"){var node=this;while(node){if(node===stayWithinNode){if(!startNode)
startNode=stayWithinNode;break;}
if(node.nodeType===Node.TEXT_NODE){var start=(node===this?(offset-1):(node.nodeValue.length-1));for(var i=start;i>=0;--i){if(stopCharacters.indexOf(node.nodeValue[i])!==-1){startNode=node;startOffset=i+1;break;}}}
if(startNode)
break;node=node.traversePreviousNode(stayWithinNode);}
if(!startNode){startNode=stayWithinNode;startOffset=0;}}else{startNode=this;startOffset=offset;}
if(!direction||direction==="forward"||direction==="both"){node=this;while(node){if(node===stayWithinNode){if(!endNode)
endNode=stayWithinNode;break;}
if(node.nodeType===Node.TEXT_NODE){var start=(node===this?offset:0);for(var i=start;i<node.nodeValue.length;++i){if(stopCharacters.indexOf(node.nodeValue[i])!==-1){endNode=node;endOffset=i;break;}}}
if(endNode)
break;node=node.traverseNextNode(stayWithinNode);}
if(!endNode){endNode=stayWithinNode;endOffset=stayWithinNode.nodeType===Node.TEXT_NODE?stayWithinNode.nodeValue.length:stayWithinNode.childNodes.length;}}else{endNode=this;endOffset=offset;}
var result=this.ownerDocument.createRange();result.setStart(startNode,startOffset);result.setEnd(endNode,endOffset);return result;}});Object.defineProperty(Element.prototype,"realOffsetWidth",{get:function()
{return this.getBoundingClientRect().width;}});Object.defineProperty(Element.prototype,"realOffsetHeight",{get:function()
{return this.getBoundingClientRect().height;}});Object.defineProperty(Element.prototype,"totalOffsetLeft",{get:function()
{return this.getBoundingClientRect().left;}});Object.defineProperty(Element.prototype,"totalOffsetRight",{get:function()
{return this.getBoundingClientRect().right;}});Object.defineProperty(Element.prototype,"totalOffsetTop",{get:function()
{return this.getBoundingClientRect().top;}});Object.defineProperty(Element.prototype,"removeChildren",{value:function()
{if(this.firstChild)
this.textContent="";}});Object.defineProperty(Element.prototype,"isInsertionCaretInside",{value:function()
{var selection=window.getSelection();if(!selection.rangeCount||!selection.isCollapsed)
return false;var selectionRange=selection.getRangeAt(0);return selectionRange.startContainer===this||selectionRange.startContainer.isDescendant(this);}});Object.defineProperty(Element.prototype,"removeMatchingStyleClasses",{value:function(classNameRegex)
{var regex=new RegExp("(^|\\s+)"+classNameRegex+"($|\\s+)");if(regex.test(this.className))
this.className=this.className.replace(regex," ");}});Object.defineProperty(Element.prototype,"createChild",{value:function(elementName,className)
{var element=this.ownerDocument.createElement(elementName);if(className)
element.className=className;this.appendChild(element);return element;}});Object.defineProperty(Element.prototype,"isScrolledToBottom",{value:function()
{ return this.scrollTop+this.clientHeight===this.scrollHeight;}});Object.defineProperty(Element.prototype,"recalculateStyles",{value:function()
{this.ownerDocument.defaultView.getComputedStyle(this);}});Object.defineProperty(DocumentFragment.prototype,"createChild",{value:Element.prototype.createChild});Object.defineProperty(Array,"shallowEqual",{value:function(a,b)
{if(!Array.isArray(a)||!Array.isArray(b))
return false;if(a===b)
return true;let length=a.length;if(length!==b.length)
return false;for(let i=0;i<length;++i){if(a[i]===b[i])
continue;if(!Object.shallowEqual(a[i],b[i]))
return false;}
return true;}});Object.defineProperty(Array.prototype,"lastValue",{get:function()
{if(!this.length)
return undefined;return this[this.length-1];}});Object.defineProperty(Array.prototype,"remove",{value:function(value,onlyFirst)
{for(var i=this.length-1;i>=0;--i){if(this[i]===value){this.splice(i,1);if(onlyFirst)
return;}}}});Object.defineProperty(Array.prototype,"toggleIncludes",{value:function(value,force)
{let exists=this.includes(value);if(exists===!!force)
return;if(exists)
this.remove(value);else
this.push(value);}});Object.defineProperty(Array.prototype,"insertAtIndex",{value:function(value,index)
{this.splice(index,0,value);}});Object.defineProperty(Array.prototype,"keySet",{value:function()
{let keys=Object.create(null);for(var i=0;i<this.length;++i)
keys[this[i]]=true;return keys;}});Object.defineProperty(Array.prototype,"partition",{value:function(callback)
{let positive=[];let negative=[];for(let i=0;i<this.length;++i){let value=this[i];if(callback(value))
positive.push(value);else
negative.push(value);}
return[positive,negative];}});Object.defineProperty(String.prototype,"isLowerCase",{value:function()
{return String(this)===this.toLowerCase();}});Object.defineProperty(String.prototype,"isUpperCase",{value:function()
{return String(this)===this.toUpperCase();}});Object.defineProperty(String.prototype,"trimMiddle",{value:function(maxLength)
{if(this.length<=maxLength)
return this;var leftHalf=maxLength>>1;var rightHalf=maxLength-leftHalf-1;return this.substr(0,leftHalf)+ellipsis+this.substr(this.length-rightHalf,rightHalf);}});Object.defineProperty(String.prototype,"trimEnd",{value:function(maxLength)
{if(this.length<=maxLength)
return this;return this.substr(0,maxLength-1)+ellipsis;}});Object.defineProperty(String.prototype,"truncate",{value:function(maxLength)
{"use strict";if(this.length<=maxLength)
return this;let clipped=this.slice(0,maxLength);let indexOfLastWhitespace=clipped.search(/\s\S*$/);if(indexOfLastWhitespace>Math.floor(maxLength/2))
clipped=clipped.slice(0,indexOfLastWhitespace-1);return clipped+ellipsis;}});Object.defineProperty(String.prototype,"collapseWhitespace",{value:function()
{return this.replace(/[\s\xA0]+/g," ");}});Object.defineProperty(String.prototype,"removeWhitespace",{value:function()
{return this.replace(/[\s\xA0]+/g,"");}});Object.defineProperty(String.prototype,"escapeCharacters",{value:function(chars)
{var foundChar=false;for(var i=0;i<chars.length;++i){if(this.indexOf(chars.charAt(i))!==-1){foundChar=true;break;}}
if(!foundChar)
return this;var result="";for(var i=0;i<this.length;++i){if(chars.indexOf(this.charAt(i))!==-1)
result+="\\";result+=this.charAt(i);}
return result;}});Object.defineProperty(String.prototype,"escapeForRegExp",{value:function()
{return this.escapeCharacters("^[]{}()\\.$*+?|");}});Object.defineProperty(String.prototype,"capitalize",{value:function()
{return this.charAt(0).toUpperCase()+this.slice(1);}});Object.defineProperty(String.prototype,"extendedLocaleCompare",{value(other)
{return this.localeCompare(other,undefined,{numeric:true});}});Object.defineProperty(String,"tokenizeFormatString",{value:function(format)
{var tokens=[];var substitutionIndex=0;function addStringToken(str)
{tokens.push({type:"string",value:str});}
function addSpecifierToken(specifier,precision,substitutionIndex)
{tokens.push({type:"specifier",specifier,precision,substitutionIndex});}
var index=0;for(var precentIndex=format.indexOf("%",index);precentIndex!==-1;precentIndex=format.indexOf("%",index)){addStringToken(format.substring(index,precentIndex));index=precentIndex+1;if(format[index]==="%"){addStringToken("%");++index;continue;}
if(!isNaN(format[index])){var number=parseInt(format.substring(index),10);while(!isNaN(format[index]))
++index;if(number>0&&format[index]==="$"){substitutionIndex=(number-1);++index;}}
const defaultPrecision=6;let precision=defaultPrecision;if(format[index]==="."){++index;precision=parseInt(format.substring(index),10);if(isNaN(precision))
precision=defaultPrecision;while(!isNaN(format[index]))
++index;}
addSpecifierToken(format[index],precision,substitutionIndex);++substitutionIndex;++index;}
addStringToken(format.substring(index));return tokens;}});Object.defineProperty(String.prototype,"hash",{get:function()
{const stringHashingStartValue=0x9e3779b9;var result=stringHashingStartValue;var pendingCharacter=null;for(var i=0;i<this.length;++i){var currentCharacter=this[i].charCodeAt(0);if(pendingCharacter===null){pendingCharacter=currentCharacter;continue;}
result+=pendingCharacter;result=(result<<16)^((currentCharacter<<11)^result);result+=result>>11;pendingCharacter=null;}
if(pendingCharacter!==null){result+=pendingCharacter;result^=result<<11;result+=result>>17;}
result^=result<<3;result+=result>>5;result^=result<<2;result+=result>>15;result^=result<<10;return(0xffffffff+result+1).toString(36);}});Object.defineProperty(String,"standardFormatters",{value:{d:function(substitution)
{return parseInt(substitution).toLocaleString();},f:function(substitution,token)
{let value=parseFloat(substitution);if(isNaN(value))
return NaN;let options={minimumFractionDigits:token.precision,maximumFractionDigits:token.precision,useGrouping:false};return value.toLocaleString(undefined,options);},s:function(substitution)
{return substitution;}}});Object.defineProperty(String,"format",{value:function(format,substitutions,formatters,initialValue,append)
{if(!format||!substitutions||!substitutions.length)
return{formattedResult:append(initialValue,format),unusedSubstitutions:substitutions};function prettyFunctionName()
{return"String.format(\""+format+"\", \""+Array.from(substitutions).join("\", \"")+"\")";}
function warn(msg)
{console.warn(prettyFunctionName()+": "+msg);}
function error(msg)
{console.error(prettyFunctionName()+": "+msg);}
var result=initialValue;var tokens=String.tokenizeFormatString(format);var usedSubstitutionIndexes={};for(var i=0;i<tokens.length;++i){var token=tokens[i];if(token.type==="string"){result=append(result,token.value);continue;}
if(token.type!=="specifier"){error("Unknown token type \""+token.type+"\" found.");continue;}
if(token.substitutionIndex>=substitutions.length){
error("not enough substitution arguments. Had "+substitutions.length+" but needed "+(token.substitutionIndex+1)+", so substitution was skipped.");result=append(result,"%"+(token.precision>-1?token.precision:"")+token.specifier);continue;}
usedSubstitutionIndexes[token.substitutionIndex]=true;if(!(token.specifier in formatters)){warn("unsupported format character \u201C"+token.specifier+"\u201D. Treating as a string.");result=append(result,substitutions[token.substitutionIndex]);continue;}
result=append(result,formatters[token.specifier](substitutions[token.substitutionIndex],token));}
var unusedSubstitutions=[];for(var i=0;i<substitutions.length;++i){if(i in usedSubstitutionIndexes)
continue;unusedSubstitutions.push(substitutions[i]);}
return{formattedResult:result,unusedSubstitutions};}});Object.defineProperty(String.prototype,"format",{value:function()
{return String.format(this,arguments,String.standardFormatters,"",function(a,b){return a+b;}).formattedResult;}});Object.defineProperty(String.prototype,"insertWordBreakCharacters",{value:function()
{return this.replace(/([\/;:\)\]\}&?])/g,"$1\u200b");}});Object.defineProperty(String.prototype,"removeWordBreakCharacters",{value:function()
{return this.replace(/\u200b/g,"");}});Object.defineProperty(String.prototype,"getMatchingIndexes",{value:function(needle)
{var indexesOfNeedle=[];var index=this.indexOf(needle);while(index>=0){indexesOfNeedle.push(index);index=this.indexOf(needle,index+1);}
return indexesOfNeedle;}});Object.defineProperty(String.prototype,"levenshteinDistance",{value:function(s)
{var m=this.length;var n=s.length;var d=new Array(m+1);for(var i=0;i<=m;++i){d[i]=new Array(n+1);d[i][0]=i;}
for(var j=0;j<=n;++j)
d[0][j]=j;for(var j=1;j<=n;++j){for(var i=1;i<=m;++i){if(this[i-1]===s[j-1])
d[i][j]=d[i-1][j-1];else{var deletion=d[i-1][j]+1;var insertion=d[i][j-1]+1;var substitution=d[i-1][j-1]+1;d[i][j]=Math.min(deletion,insertion,substitution);}}}
return d[m][n];}});Object.defineProperty(String.prototype,"toCamelCase",{value:function()
{return this.toLowerCase().replace(/[^\w]+(\w)/g,(match,group)=>group.toUpperCase());}});Object.defineProperty(String.prototype,"hasMatchingEscapedQuotes",{value:function()
{return/^\"(?:[^\"\\]|\\.)*\"$/.test(this) || /^\'(?:[^\'\\]|\\.)*\'$/.test(this);
}
});
Object.defineProperty(Math, "roundTo",
{
value: function(num, step)
{
return Math.round(num / step) * step;
}
});
Object.defineProperty(Number, "constrain",
{
value: function(num, min, max)
{
if (max < min)
return min;
if (num < min)
num = min;
else if (num > max)
num = max;
return num;
}
});
Object.defineProperty(Number, "percentageString",
{
value: function(fraction, precision = 1)
{
return fraction.toLocaleString(undefined, {minimumFractionDigits: precision, style: "percent"});
}
});
Object.defineProperty(Number, "secondsToMillisecondsString",
{
value: function(seconds, higherResolution)
{
let ms = seconds * 1000;
if (higherResolution)
return WebInspector.UIString("%.2fms").format(ms);
return WebInspector.UIString("%.1fms").format(ms);
}
});
Object.defineProperty(Number, "secondsToString",
{
value: function(seconds, higherResolution)
{
let ms = seconds * 1000;
if (!ms)
return WebInspector.UIString("%.0fms").format(0);
if (Math.abs(ms) < 10) {
if (higherResolution)
return WebInspector.UIString("%.3fms").format(ms);
return WebInspector.UIString("%.2fms").format(ms);
}
if (Math.abs(ms) < 100) {
if (higherResolution)
return WebInspector.UIString("%.2fms").format(ms);
return WebInspector.UIString("%.1fms").format(ms);
}
if (Math.abs(ms) < 1000) {
if (higherResolution)
return WebInspector.UIString("%.1fms").format(ms);
return WebInspector.UIString("%.0fms").format(ms);
}
// Do not go over seconds when in high resolution mode.
if (higherResolution || Math.abs(seconds) < 60)
return WebInspector.UIString("%.2fs").format(seconds);
let minutes = seconds / 60;
if (Math.abs(minutes) < 60)
return WebInspector.UIString("%.1fmin").format(minutes);
let hours = minutes / 60;
if (Math.abs(hours) < 24)
return WebInspector.UIString("%.1fhrs").format(hours);
let days = hours / 24;
return WebInspector.UIString("%.1f days").format(days);
}
});
Object.defineProperty(Number, "bytesToString",
{
value: function(bytes, higherResolution)
{
if (higherResolution === undefined)
higherResolution = true;
if (Math.abs(bytes) < 1024)
return WebInspector.UIString("%.0f B").format(bytes);
let kilobytes = bytes / 1024;
if (Math.abs(kilobytes) < 1024) {
if (higherResolution || Math.abs(kilobytes) < 10)
return WebInspector.UIString("%.2f KB").format(kilobytes);
return WebInspector.UIString("%.1f KB").format(kilobytes);
}
let megabytes = kilobytes / 1024;
if (Math.abs(megabytes) < 1024) {
if (higherResolution || Math.abs(megabytes) < 10)
return WebInspector.UIString("%.2f MB").format(megabytes);
return WebInspector.UIString("%.1f MB").format(megabytes);
}
let gigabytes = megabytes / 1024;
if (higherResolution || Math.abs(gigabytes) < 10)
return WebInspector.UIString("%.2f GB").format(gigabytes);
return WebInspector.UIString("%.1f GB").format(gigabytes);
}
});
Object.defineProperty(Number, "abbreviate",
{
value: function(num)
{
if (num < 1000)
return num.toLocaleString();
if (num < 1000000)
return WebInspector.UIString("%.1fK").format(Math.round(num / 100) / 10);
if (num < 1000000000)
return WebInspector.UIString("%.1fM").format(Math.round(num / 100000) / 10);
return WebInspector.UIString("%.1fB").format(Math.round(num / 100000000) / 10);
}
});
Object.defineProperty(Number.prototype, "maxDecimals",
{
value(decimals)
{
let power = 10 ** decimals;
return Math.round(this * power) / power;
}
});
Object.defineProperty(Uint32Array, "isLittleEndian",
{
value: function()
{
if ("_isLittleEndian" in this)
return this._isLittleEndian;
var buffer = new ArrayBuffer(4);
var longData = new Uint32Array(buffer);
var data = new Uint8Array(buffer);
longData[0] = 0x0a0b0c0d;
this._isLittleEndian = data[0] === 0x0d && data[1] === 0x0c && data[2] === 0x0b && data[3] === 0x0a;
return this._isLittleEndian;
}
});
function isEmptyObject(object)
{
for (var property in object)
return false;
return true;
}
function isEnterKey(event)
{
// Check if this is an IME event.
return event.keyCode !== 229 && event.keyIdentifier === "Enter";
}
function resolveDotsInPath(path)
{
if (!path)
return path;
if (path.indexOf("./") === -1)
return path;
var result = [];
var components = path.split("/");
for (var i = 0; i < components.length; ++i) {
var component = components[i];
// Skip over "./".
if (component === ".")
continue;
// Rewind one component for "../".
if (component === "..") {
if (result.length === 1)
continue;
result.pop();
continue;
}
result.push(component);
}
return result.join("/");
}
function parseMIMEType(fullMimeType)
{
if (!fullMimeType)
return {type: fullMimeType, boundary: null, encoding: null};
var typeParts = fullMimeType.split(/\s*;\s*/);
var type = typeParts[0];
var boundary = null;
var encoding = null;
for (var i = 1; i < typeParts.length; ++i) {
var subparts = typeParts[i].split(/\s*=\s*/);
if (subparts.length !== 2)
continue;
if (subparts[0].toLowerCase() === "boundary")
boundary = subparts[1];
else if (subparts[0].toLowerCase() === "charset")
encoding = subparts[1].replace("^\"|\"$","");}
return{type,boundary:boundary||null,encoding:encoding||null};}
function simpleGlobStringToRegExp(globString,regExpFlags)
{if(!globString)
return null;var regexString=globString.escapeCharacters("^[]{}()\\.$+?|");regexString=regexString.replace(/\\\\\*/g,"\\*");var unescapedAsteriskRegex=/(^|[^\\])\*+/g;if(unescapedAsteriskRegex.test(globString)){regexString=regexString.replace(unescapedAsteriskRegex,"$1.*");
regexString="\\b"+regexString+"\\b";}
return new RegExp(regexString,regExpFlags);}
Object.defineProperty(Array.prototype,"lowerBound",{
value:function(object,comparator)
{function defaultComparator(a,b)
{return a-b;}
comparator=comparator||defaultComparator;var l=0;var r=this.length;while(l<r){var m=(l+r)>>1;if(comparator(object,this[m])>0)
l=m+1;else
r=m;}
return r;}});Object.defineProperty(Array.prototype,"upperBound",{
value:function(object,comparator)
{function defaultComparator(a,b)
{return a-b;}
comparator=comparator||defaultComparator;var l=0;var r=this.length;while(l<r){var m=(l+r)>>1;if(comparator(object,this[m])>=0)
l=m+1;else
r=m;}
return r;}});Object.defineProperty(Array.prototype,"binaryIndexOf",{value:function(value,comparator)
{var index=this.lowerBound(value,comparator);return index<this.length&&comparator(value,this[index])===0?index:-1;}});(function(){
const debounceTimeoutSymbol=Symbol("debounce-timeout");const debounceSoonProxySymbol=Symbol("debounce-soon-proxy");Object.defineProperty(Object.prototype,"soon",{get:function()
{if(!this[debounceSoonProxySymbol])
this[debounceSoonProxySymbol]=this.debounce(0);return this[debounceSoonProxySymbol];}});Object.defineProperty(Object.prototype,"debounce",{value:function(delay)
{return new Proxy(this,{get(target,property,receiver){return(...args)=>{let original=target[property];if(original[debounceTimeoutSymbol])
clearTimeout(original[debounceTimeoutSymbol]);let performWork=()=>{original[debounceTimeoutSymbol]=undefined;original.apply(target,args);};original[debounceTimeoutSymbol]=setTimeout(performWork,delay);};}});}});Object.defineProperty(Function.prototype,"cancelDebounce",{value:function()
{if(!this[debounceTimeoutSymbol])
return;clearTimeout(this[debounceTimeoutSymbol]);this[debounceTimeoutSymbol]=undefined;}});const requestAnimationFrameSymbol=Symbol("peform-on-animation-frame");const requestAnimationFrameProxySymbol=Symbol("perform-on-animation-frame-proxy");Object.defineProperty(Object.prototype,"onNextFrame",{get:function()
{if(!this[requestAnimationFrameProxySymbol]){this[requestAnimationFrameProxySymbol]=new Proxy(this,{get(target,property,receiver){return(...args)=>{let original=target[property];if(original[requestAnimationFrameSymbol])
return;let performWork=()=>{original[requestAnimationFrameSymbol]=undefined;original.apply(target,args);};original[requestAnimationFrameSymbol]=requestAnimationFrame(performWork);};}});}
return this[requestAnimationFrameProxySymbol];}});})();function appendWebInspectorSourceURL(string)
{if(string.includes("//# sourceURL"))
return string;return"\n//# sourceURL=__WebInspectorInternal__\n"+string;}
function appendWebInspectorConsoleEvaluationSourceURL(string)
{if(string.includes("//# sourceURL"))
return string;return"\n//# sourceURL=__WebInspectorConsoleEvaluation__\n"+string;}
function isWebInspectorInternalScript(url)
{return url==="__WebInspectorInternal__";}
function isWebInspectorConsoleEvaluationScript(url)
{return url==="__WebInspectorConsoleEvaluation__";}
function isWebKitInjectedScript(url)
{return url&&url.startsWith("__InjectedScript_")&&url.endsWith(".js");}
function isWebKitInternalScript(url)
{if(isWebInspectorConsoleEvaluationScript(url))
return false;if(isWebKitInjectedScript(url))
return true;return url&&url.startsWith("__Web")&&url.endsWith("__");}
function isFunctionStringNativeCode(str)
{return str.endsWith("{\n [native code]\n}");}
function isTextLikelyMinified(content)
{const autoFormatMaxCharactersToCheck=5000;const autoFormatWhitespaceRatio=0.2;let whitespaceScore=0;let size=Math.min(autoFormatMaxCharactersToCheck,content.length);for(let i=0;i<size;i++){let char=content[i];if(char===" ")
whitespaceScore++;else if(char==="\t")
whitespaceScore+=4;else if(char==="\n")
whitespaceScore+=8;}
let ratio=whitespaceScore/size;return ratio<autoFormatWhitespaceRatio;}
function doubleQuotedString(str)
{return"\""+str.replace(/\\/g,"\\\\").replace(/"/g,"\\\"")+"\"";}
function insertionIndexForObjectInListSortedByFunction(object,list,comparator,insertionIndexAfter)
{if(insertionIndexAfter){return list.upperBound(object,comparator);}else{return list.lowerBound(object,comparator);}}
function insertObjectIntoSortedArray(object,array,comparator)
{array.splice(insertionIndexForObjectInListSortedByFunction(object,array,comparator),0,object);}
function decodeBase64ToBlob(base64Data,mimeType)
{mimeType=mimeType||'';const sliceSize=1024;var byteCharacters=atob(base64Data);var bytesLength=byteCharacters.length;var slicesCount=Math.ceil(bytesLength/sliceSize);var byteArrays=new Array(slicesCount);for(var sliceIndex=0;sliceIndex<slicesCount;++sliceIndex){var begin=sliceIndex*sliceSize;var end=Math.min(begin+sliceSize,bytesLength);var bytes=new Array(end-begin);for(var offset=begin,i=0;offset<end;++i,++offset)
bytes[i]=byteCharacters[offset].charCodeAt(0);byteArrays[sliceIndex]=new Uint8Array(bytes);}
return new Blob(byteArrays,{type:mimeType});}
function timestamp()
{return window.performance?performance.now():Date.now();}
if(!window.handlePromiseException){window.handlePromiseException=function handlePromiseException(error)
{console.error("Uncaught exception in Promise",error);};}
WebInspector.Setting=class Setting extends WebInspector.Object
{constructor(name,defaultValue)
{super();this._name=name;let inspectionLevel=InspectorFrontendHost?InspectorFrontendHost.inspectionLevel():1;let levelString=inspectionLevel>1?"-"+inspectionLevel:"";this._localStorageKey=`com.apple.WebInspector${levelString}.${name}`;this._defaultValue=defaultValue;}
get name()
{return this._name;}
get value()
{if("_value"in this)
return this._value;this._value=JSON.parse(JSON.stringify(this._defaultValue));if(!window.InspectorTest&&window.localStorage&&this._localStorageKey in window.localStorage){try{this._value=JSON.parse(window.localStorage[this._localStorageKey]);}catch(e){delete window.localStorage[this._localStorageKey];}}
return this._value;}
set value(value)
{if(this._value===value)
return;this._value=value;if(!window.InspectorTest&&window.localStorage){try{if(Object.shallowEqual(this._value,this._defaultValue))
delete window.localStorage[this._localStorageKey];else
window.localStorage[this._localStorageKey]=JSON.stringify(this._value);}catch(e){console.error("Error saving setting with name: "+this._name);}}
this.dispatchEventToListeners(WebInspector.Setting.Event.Changed,this._value,{name:this._name});}
reset()
{this.value=JSON.parse(JSON.stringify(this._defaultValue));}};WebInspector.Setting.Event={Changed:"setting-changed"};WebInspector.settings={autoLogProtocolMessages:new WebInspector.Setting("auto-collect-protocol-messages",false),autoLogTimeStats:new WebInspector.Setting("auto-collect-time-stats",false),enableUncaughtExceptionReporter:new WebInspector.Setting("enable-uncaught-exception-reporter",true),enableLineWrapping:new WebInspector.Setting("enable-line-wrapping",false),indentUnit:new WebInspector.Setting("indent-unit",4),tabSize:new WebInspector.Setting("tab-size",4),indentWithTabs:new WebInspector.Setting("indent-with-tabs",false),showWhitespaceCharacters:new WebInspector.Setting("show-whitespace-characters",false),showInvalidCharacters:new WebInspector.Setting("show-invalid-characters",false),clearLogOnNavigate:new WebInspector.Setting("clear-log-on-navigate",true),clearNetworkOnNavigate:new WebInspector.Setting("clear-network-on-navigate",true),zoomFactor:new WebInspector.Setting("zoom-factor",1),layoutDirection:new WebInspector.Setting("layout-direction-override","system"),stylesShowInlineWarnings:new WebInspector.Setting("styles-show-inline-warning",true),stylesInsertNewline:new WebInspector.Setting("styles-insert-newline",true),stylesSelectOnFirstClick:new WebInspector.Setting("styles-select-on-first-click",true),showScopeChainOnPause:new WebInspector.Setting("show-scope-chain-sidebar",true),showImageGrid:new WebInspector.Setting("show-image-grid",false), experimentalShowCanvasContextsInResources:new WebInspector.Setting("experimental-show-canvas-contexts-in-resources",false),};WebInspector.YieldableTask=class YieldableTask extends WebInspector.Object
{constructor(delegate,items,options={})
{super();let{workInterval,idleInterval}=options;this._workInterval=workInterval||10;this._idleInterval=idleInterval||0;this._delegate=delegate;this._items=items;this._idleTimeoutIdentifier=undefined;this._processing=false;this._processing=false;this._cancelled=false;}
get processing(){return this._processing;}
get cancelled(){return this._cancelled;}
get idleInterval(){return this._idleInterval;}
get workInterval(){return this._workInterval;}
start()
{if(this._processing)
return;if(this._cancelled)
return;function*createIteratorForProcessingItems()
{let startTime=Date.now();let processedItems=[];for(let item of this._items){if(this._cancelled)
break;this._delegate.yieldableTaskWillProcessItem(this,item);processedItems.push(item);if(this._cancelled)
break;let elapsedTime=Date.now()-startTime;if(elapsedTime>this._workInterval){let returnedItems=processedItems.slice();processedItems=[];this._willYield(returnedItems,elapsedTime);yield;startTime=Date.now();}}
if(processedItems.length)
this._willYield(processedItems,Date.now()-startTime);}
this._processing=true;this._pendingItemsIterator=createIteratorForProcessingItems.call(this);this._processPendingItems();}
cancel()
{if(!this._processing)
return;this._cancelled=true;}
_processPendingItems()
{if(this._cancelled)
return;if(!this._pendingItemsIterator.next().done){this._idleTimeoutIdentifier=setTimeout(()=>{this._processPendingItems();},this._idleInterval);return;}
this._didFinish();}
_willYield(processedItems,elapsedTime)
{if(typeof this._delegate.yieldableTaskDidYield==="function")
this._delegate.yieldableTaskDidYield(this,processedItems,elapsedTime);}
_didFinish()
{this._processing=false;this._pendingItemsIterator=null;if(this._idleTimeoutIdentifier){clearTimeout(this._idleTimeoutIdentifier);this._idleTimeoutIdentifier=undefined;}
if(typeof this._delegate.yieldableTaskDidFinish==="function")
this._delegate.yieldableTaskDidFinish(this);}};WebInspector.ProtocolTracer=class ProtocolTracer extends WebInspector.Object
{ logStarted()
{}
logFrontendException(message,exception)
{}
logProtocolError(message,error)
{}
logFrontendRequest(message)
{}
logWillHandleResponse(message)
{}
logDidHandleResponse(message,timings=null)
{}
logWillHandleEvent(message)
{}
logDidHandleEvent(message,timings=null)
{}
logFinished()
{}};WebInspector.LoggingProtocolTracer=class LoggingProtocolTracer extends WebInspector.ProtocolTracer
{constructor()
{super();this._dumpMessagesToConsole=false;this._dumpTimingDataToConsole=false;this._logToConsole=window.InspectorTest?InspectorFrontendHost.unbufferedLog.bind(InspectorFrontendHost):console.log.bind(console);}
set dumpMessagesToConsole(value)
{this._dumpMessagesToConsole=!!value;}
get dumpMessagesToConsole()
{return this._dumpMessagesToConsole;}
set dumpTimingDataToConsole(value)
{this._dumpTimingDataToConsole=!!value;}
get dumpTimingDataToConsole()
{return this._dumpTimingDataToConsole;}
logFrontendException(message,exception)
{this._processEntry({type:"exception",message,exception});}
logProtocolError(message,error)
{this._processEntry({type:"error",message,error});}
logFrontendRequest(message)
{this._processEntry({type:"request",message});}
logWillHandleResponse(message)
{let entry={type:"response",message};this._processEntry(entry);}
logDidHandleResponse(message,timings=null)
{let entry={type:"response",message};if(timings)
entry.timings=Object.shallowCopy(timings);this._processEntry(entry);}
logWillHandleEvent(message)
{let entry={type:"event",message};this._processEntry(entry);}
logDidHandleEvent(message,timings=null)
{let entry={type:"event",message};if(timings)
entry.timings=Object.shallowCopy(timings);this._processEntry(entry);}
_processEntry(entry)
{if(this._dumpTimingDataToConsole&&entry.timings){if(entry.timings.rtt&&entry.timings.dispatch)
this._logToConsole(`time-stats: Handling: ${entry.timings.dispatch || NaN}ms; RTT: ${entry.timings.rtt}ms`);else if(entry.timings.dispatch)
this._logToConsole(`time-stats: Handling: ${entry.timings.dispatch || NaN}ms`);}else if(this._dumpMessagesToConsole&&!entry.timings){this._logToConsole(`${entry.type}: ${JSON.stringify(entry.message)}`);if(entry.exception){this._logToConsole(entry.exception);if(entry.exception.stack)
this._logToConsole(entry.exception.stack);}}}};InspectorBackendClass=class InspectorBackendClass
{constructor()
{this._agents={};this._customTracer=null;this._defaultTracer=new WebInspector.LoggingProtocolTracer;this._activeTracers=[this._defaultTracer];this._workerSupportedDomains=[];WebInspector.settings.autoLogProtocolMessages.addEventListener(WebInspector.Setting.Event.Changed,this._startOrStopAutomaticTracing,this);WebInspector.settings.autoLogTimeStats.addEventListener(WebInspector.Setting.Event.Changed,this._startOrStopAutomaticTracing,this);this._startOrStopAutomaticTracing();this.currentDispatchState={event:null,request:null,response:null,};}
get workerSupportedDomains(){return this._workerSupportedDomains;}
set dumpInspectorProtocolMessages(value)
{WebInspector.settings.autoLogProtocolMessages.value=value;this._defaultTracer.dumpMessagesToConsole=value;}
get dumpInspectorProtocolMessages()
{return WebInspector.settings.autoLogProtocolMessages.value;}
set dumpInspectorTimeStats(value)
{WebInspector.settings.autoLogTimeStats.value=value;if(!this.dumpInspectorProtocolMessages)
this.dumpInspectorProtocolMessages=true;this._defaultTracer.dumpTimingDataToConsole=value;}
get dumpInspectorTimeStats()
{return WebInspector.settings.autoLogTimeStats.value;}
set customTracer(tracer)
{if(!tracer&&!this._customTracer)
return;if(tracer===this._customTracer)
return;if(tracer===this._defaultTracer)
return;if(this._customTracer)
this._customTracer.logFinished();this._customTracer=tracer;this._activeTracers=[this._defaultTracer];if(this._customTracer){this._customTracer.logStarted();this._activeTracers.push(this._customTracer);}}
get activeTracers()
{return this._activeTracers;}
registerCommand(qualifiedName,callSignature,replySignature)
{var[domainName,commandName]=qualifiedName.split(".");var agent=this._agentForDomain(domainName);agent.addCommand(InspectorBackend.Command.create(agent,qualifiedName,callSignature,replySignature));}
registerEnum(qualifiedName,enumValues)
{var[domainName,enumName]=qualifiedName.split(".");var agent=this._agentForDomain(domainName);agent.addEnum(enumName,enumValues);}
registerEvent(qualifiedName,signature)
{var[domainName,eventName]=qualifiedName.split(".");var agent=this._agentForDomain(domainName);agent.addEvent(new InspectorBackend.Event(eventName,signature));}
registerDomainDispatcher(domainName,dispatcher)
{var agent=this._agentForDomain(domainName);agent.dispatcher=dispatcher;}
dispatch(message)
{InspectorBackend.mainConnection.dispatch(message);}
runAfterPendingDispatches(script)
{InspectorBackend.mainConnection.runAfterPendingDispatches(script);}
activateDomain(domainName,activationDebuggableType)
{if(!activationDebuggableType||InspectorFrontendHost.debuggableType()===activationDebuggableType){var agent=this._agents[domainName];agent.activate();return agent;}
return null;}
workerSupportedDomain(domainName)
{this._workerSupportedDomains.push(domainName);}
_startOrStopAutomaticTracing()
{this._defaultTracer.dumpMessagesToConsole=this.dumpInspectorProtocolMessages;this._defaultTracer.dumpTimingDataToConsole=this.dumpTimingDataToConsole;}
_agentForDomain(domainName)
{if(this._agents[domainName])
return this._agents[domainName];var agent=new InspectorBackend.Agent(domainName);this._agents[domainName]=agent;return agent;}};InspectorBackend=new InspectorBackendClass;InspectorBackend.Agent=class InspectorBackendAgent
{constructor(domainName)
{this._domainName=domainName;this._connection=InspectorBackend.mainConnection;this._dispatcher=null;this._active=false;
this._events={};}
get domainName()
{return this._domainName;}
get active()
{return this._active;}
get connection()
{return this._connection;}
set connection(connection)
{this._connection=connection;}
get dispatcher()
{return this._dispatcher;}
set dispatcher(value)
{this._dispatcher=value;}
addEnum(enumName,enumValues)
{this[enumName]=enumValues;}
addCommand(command)
{this[command.commandName]=command;}
addEvent(event)
{this._events[event.eventName]=event;}
getEvent(eventName)
{return this._events[eventName];}
hasEvent(eventName)
{return eventName in this._events;}
hasEventParameter(eventName,eventParameterName)
{let event=this._events[eventName];return event&&event.parameterNames.includes(eventParameterName);}
activate()
{this._active=true;window[this._domainName+"Agent"]=this;}
dispatchEvent(eventName,eventArguments)
{if(!(eventName in this._dispatcher)){console.error("Protocol Error: Attempted to dispatch an unimplemented method '"+this._domainName+"."+eventName+"'");return false;}
this._dispatcher[eventName].apply(this._dispatcher,eventArguments);return true;}};InspectorBackend.Command=function(agent,qualifiedName,callSignature,replySignature)
{"use strict";this._agent=agent;this._instance=this;let[domainName,commandName]=qualifiedName.split(".");this._qualifiedName=qualifiedName;this._commandName=commandName;this._callSignature=callSignature||[];this._replySignature=replySignature||[];};InspectorBackend.Command.create=function(agent,commandName,callSignature,replySignature)
{"use strict";let instance=new InspectorBackend.Command(agent,commandName,callSignature,replySignature);function callable(){return instance._invokeWithArguments.call(instance,this,Array.from(arguments));}
callable._instance=instance;Object.setPrototypeOf(callable,InspectorBackend.Command.prototype);return callable;};InspectorBackend.Command.prototype={__proto__:Function.prototype, get qualifiedName()
{return this._instance._qualifiedName;},get commandName()
{return this._instance._commandName;},get callSignature()
{return this._instance._callSignature;},get replySignature()
{return this._instance._replySignature;},invoke(commandArguments,callback,agent)
{"use strict";agent=agent||this._instance._agent;if(typeof callback==="function")
agent._connection._sendCommandToBackendWithCallback(this._instance,commandArguments,callback);else
return agent._connection._sendCommandToBackendExpectingPromise(this._instance,commandArguments);},supports(parameterName)
{"use strict";return this._instance.callSignature.some((parameter)=>parameter["name"]===parameterName);}, _invokeWithArguments(agent,commandArguments)
{"use strict";let instance=this._instance;let callback=typeof commandArguments.lastValue==="function"?commandArguments.pop():null;function deliverFailure(message){console.error(`Protocol Error: ${message}`);if(callback)
setTimeout(callback.bind(null,message),0);else
return Promise.reject(new Error(message));}
let parameters={};for(let parameter of instance.callSignature){let parameterName=parameter["name"];let typeName=parameter["type"];let optionalFlag=parameter["optional"];if(!commandArguments.length&&!optionalFlag)
return deliverFailure(`Invalid number of arguments for command '${instance.qualifiedName}'.`);let value=commandArguments.shift();if(optionalFlag&&value===undefined)
continue;if(typeof value!==typeName)
return deliverFailure(`Invalid type of argument '${parameterName}' for command '${instance.qualifiedName}' call. It must be '${typeName}' but it is '${typeof value}'.`);parameters[parameterName]=value;}
if(!callback&&commandArguments.length===1&&commandArguments[0]!==undefined)
return deliverFailure(`Protocol Error: Optional callback argument for command '${instance.qualifiedName}' call must be a function but its type is '${typeof commandArguments[0]}'.`);if(callback)
agent._connection._sendCommandToBackendWithCallback(instance,parameters,callback);else
return agent._connection._sendCommandToBackendExpectingPromise(instance,parameters);}};InspectorBackend.Event=class Event
{constructor(eventName,parameterNames)
{this.eventName=eventName;this.parameterNames=parameterNames;}};InspectorBackend.Connection=class InspectorBackendConnection
{constructor()
{this._lastSequenceId=1;this._pendingResponses=new Map;this._agents={};this._deferredScripts=[];this._target=null;}
get target()
{return this._target;}
set target(target)
{this._target=target;for(let domain in this._agents){let dispatcher=this._agents[domain].dispatcher;if(dispatcher)
dispatcher.target=target;}}
dispatch(message)
{let messageObject=(typeof message==="string")?JSON.parse(message):message;if("id"in messageObject)
this._dispatchResponse(messageObject);else
this._dispatchEvent(messageObject);}
runAfterPendingDispatches(script)
{if(!this._pendingResponses.size)
script.call(this);else
this._deferredScripts.push(script);}
sendMessageToBackend(message)
{throw new Error("Should be implemented by a InspectorBackend.Connection subclass");}
_dispatchResponse(messageObject)
{if(messageObject["error"]){if(messageObject["error"].code!==-32000)
console.error("Request with id = "+messageObject["id"]+" failed. "+JSON.stringify(messageObject["error"]));}
let sequenceId=messageObject["id"];let responseData=this._pendingResponses.take(sequenceId)||{};let{request,command,callback,promise}=responseData;let processingStartTimestamp=timestamp();for(let tracer of InspectorBackend.activeTracers)
tracer.logWillHandleResponse(messageObject);InspectorBackend.currentDispatchState.request=request;InspectorBackend.currentDispatchState.response=messageObject;if(typeof callback==="function")
this._dispatchResponseToCallback(command,request,messageObject,callback);else if(typeof promise==="object")
this._dispatchResponseToPromise(command,messageObject,promise);else
console.error("Received a command response without a corresponding callback or promise.",messageObject,command);InspectorBackend.currentDispatchState.request=null;InspectorBackend.currentDispatchState.response=null;let processingTime=(timestamp()-processingStartTimestamp).toFixed(3);let roundTripTime=(processingStartTimestamp-responseData.sendRequestTimestamp).toFixed(3);for(let tracer of InspectorBackend.activeTracers)
tracer.logDidHandleResponse(messageObject,{rtt:roundTripTime,dispatch:processingTime});if(this._deferredScripts.length&&!this._pendingResponses.size)
this._flushPendingScripts();}
_dispatchResponseToCallback(command,requestObject,responseObject,callback)
{let callbackArguments=[];callbackArguments.push(responseObject["error"]?responseObject["error"].message:null);if(responseObject["result"]){for(let parameterName of command.replySignature)
callbackArguments.push(responseObject["result"][parameterName]);}
try{callback.apply(null,callbackArguments);}catch(e){WebInspector.reportInternalError(e,{"cause":`An uncaught exception was thrown while dispatching response callback for command ${command.qualifiedName}.`});}}
_dispatchResponseToPromise(command,messageObject,promise)
{let{resolve,reject}=promise;if(messageObject["error"])
reject(new Error(messageObject["error"].message));else
resolve(messageObject["result"]);}
_dispatchEvent(messageObject)
{let qualifiedName=messageObject["method"];let[domainName,eventName]=qualifiedName.split(".");if(!(domainName in this._agents)){console.error("Protocol Error: Attempted to dispatch method '"+eventName+"' for non-existing domain '"+domainName+"'");return;}
let agent=this._agents[domainName];if(!agent.active){console.error("Protocol Error: Attempted to dispatch method for domain '"+domainName+"' which exists but is not active.");return;}
let event=agent.getEvent(eventName);if(!event){console.error("Protocol Error: Attempted to dispatch an unspecified method '"+qualifiedName+"'");return;}
let eventArguments=[];if(messageObject["params"])
eventArguments=event.parameterNames.map((name)=>messageObject["params"][name]);let processingStartTimestamp=timestamp();for(let tracer of InspectorBackend.activeTracers)
tracer.logWillHandleEvent(messageObject);InspectorBackend.currentDispatchState.event=messageObject;try{agent.dispatchEvent(eventName,eventArguments);}catch(e){for(let tracer of InspectorBackend.activeTracers)
tracer.logFrontendException(messageObject,e);WebInspector.reportInternalError(e,{"cause":`An uncaught exception was thrown while handling event: ${qualifiedName}`});}
InspectorBackend.currentDispatchState.event=null;let processingDuration=(timestamp()-processingStartTimestamp).toFixed(3);for(let tracer of InspectorBackend.activeTracers)
tracer.logDidHandleEvent(messageObject,{dispatch:processingDuration});}
_sendCommandToBackendWithCallback(command,parameters,callback)
{let sequenceId=this._lastSequenceId++;let messageObject={"id":sequenceId,"method":command.qualifiedName,};if(!isEmptyObject(parameters))
messageObject["params"]=parameters;let responseData={command,request:messageObject,callback};if(InspectorBackend.activeTracer)
responseData.sendRequestTimestamp=timestamp();this._pendingResponses.set(sequenceId,responseData);this._sendMessageToBackend(messageObject);}
_sendCommandToBackendExpectingPromise(command,parameters)
{let sequenceId=this._lastSequenceId++;let messageObject={"id":sequenceId,"method":command.qualifiedName,};if(!isEmptyObject(parameters))
messageObject["params"]=parameters;let responseData={command,request:messageObject};if(InspectorBackend.activeTracer)
responseData.sendRequestTimestamp=timestamp();let responsePromise=new Promise(function(resolve,reject){responseData.promise={resolve,reject};});this._pendingResponses.set(sequenceId,responseData);this._sendMessageToBackend(messageObject);return responsePromise;}
_sendMessageToBackend(messageObject)
{for(let tracer of InspectorBackend.activeTracers)
tracer.logFrontendRequest(messageObject);this.sendMessageToBackend(JSON.stringify(messageObject));}
_flushPendingScripts()
{let scriptsToRun=this._deferredScripts;this._deferredScripts=[];for(let script of scriptsToRun)
script.call(this);}};InspectorBackend.MainConnection=class InspectorBackendPageConnection extends InspectorBackend.Connection
{constructor()
{super();this._agents=InspectorBackend._agents;}
sendMessageToBackend(message)
{InspectorFrontendHost.sendMessageToBackend(message);}};InspectorBackend.WorkerConnection=class InspectorBackendWorkerConnection extends InspectorBackend.Connection
{constructor(workerId)
{super();this._workerId=workerId;const workerDomains=InspectorBackend.workerSupportedDomains;for(let domain of workerDomains){let agent=InspectorBackend._agents[domain];let clone=Object.create(InspectorBackend._agents[domain]);clone.connection=this;clone.dispatcher=new agent.dispatcher.constructor;this._agents[domain]=clone;}}
sendMessageToBackend(message)
{WorkerAgent.sendMessageToWorker(this._workerId,message);}};InspectorBackend.mainConnection=new InspectorBackend.MainConnection;InspectorFrontendAPI={_loaded:false,_pendingCommands:[],savedURL:function(url)
{},appendedToURL:function(url)
{},isTimelineProfilingEnabled:function()
{return WebInspector.timelineManager.isCapturing();},setTimelineProfilingEnabled:function(enabled)
{if(WebInspector.timelineManager.isCapturing()===enabled)
return;if(enabled)
WebInspector.timelineManager.startCapturing();else
WebInspector.timelineManager.stopCapturing();},setElementSelectionEnabled:function(enabled)
{WebInspector.domTreeManager.inspectModeEnabled=enabled;},setDockingUnavailable:function(unavailable)
{WebInspector.updateDockingAvailability(!unavailable);},setDockSide:function(side)
{WebInspector.updateDockedState(side);},setIsVisible:function(visible)
{WebInspector.updateVisibilityState(visible);},showConsole:function()
{WebInspector.showConsoleTab();WebInspector.quickConsole.prompt.focus();if(document.readyState!=="complete")
document.addEventListener("readystatechange",this);if(document.visibilityState!=="visible")
document.addEventListener("visibilitychange",this);},handleEvent:function(event)
{if(document.readyState==="complete"&&document.visibilityState==="visible"){WebInspector.quickConsole.prompt.focus();document.removeEventListener("readystatechange",this);document.removeEventListener("visibilitychange",this);}},showResources:function()
{WebInspector.showResourcesTab();},showTimelines:function()
{WebInspector.showTimelineTab();},showMainResourceForFrame:function(frameIdentifier)
{const options={ignoreNetworkTab:true,ignoreSearchTab:true,};WebInspector.showSourceCodeForFrame(frameIdentifier,options);},contextMenuItemSelected:function(id)
{try{WebInspector.ContextMenu.contextMenuItemSelected(id);}catch(e){console.error("Uncaught exception in inspector page under contextMenuItemSelected",e);}},contextMenuCleared:function()
{WebInspector.ContextMenu.contextMenuCleared();},dispatchMessageAsync:function(messageObject)
{WebInspector.dispatchMessageFromBackend(messageObject);},dispatchMessage:function(messageObject)
{InspectorBackend.dispatch(messageObject);},dispatch:function(signature)
{if(!InspectorFrontendAPI._loaded){InspectorFrontendAPI._pendingCommands.push(signature);return null;}
var methodName=signature.shift();if(!InspectorFrontendAPI[methodName])
return null;return InspectorFrontendAPI[methodName].apply(InspectorFrontendAPI,signature);},loadCompleted:function()
{InspectorFrontendAPI._loaded=true;for(var i=0;i<InspectorFrontendAPI._pendingCommands.length;++i)
InspectorFrontendAPI.dispatch(InspectorFrontendAPI._pendingCommands[i]);delete InspectorFrontendAPI._pendingCommands;}};(function(){let backendCommandsURL=InspectorFrontendHost.backendCommandsURL()||"Protocol/InspectorBackendCommands.js";document.write("<script src=\""+backendCommandsURL+"\"></script>");})();WebInspector._messagesToDispatch=[];WebInspector.dispatchNextQueuedMessageFromBackend=function()
{const startCount=WebInspector._messagesToDispatch.length;const startTimestamp=timestamp();const timeLimitPerRunLoop=10; let i=0;for(;i<WebInspector._messagesToDispatch.length;++i){
if(timestamp()-startTimestamp>timeLimitPerRunLoop)
break;InspectorBackend.dispatch(WebInspector._messagesToDispatch[i]);}
if(i===WebInspector._messagesToDispatch.length){WebInspector._messagesToDispatch=[];WebInspector._dispatchTimeout=null;}else{WebInspector._messagesToDispatch=WebInspector._messagesToDispatch.slice(i);WebInspector._dispatchTimeout=setTimeout(WebInspector.dispatchNextQueuedMessageFromBackend,0);}
if(InspectorBackend.dumpInspectorTimeStats){let messageDuration=(timestamp()-startTimestamp).toFixed(3);let dispatchedCount=startCount-WebInspector._messagesToDispatch.length;let remainingCount=WebInspector._messagesToDispatch.length;console.log(`time-stats: --- RunLoop duration: ${messageDuration}ms; dispatched: ${dispatchedCount}; remaining: ${remainingCount}`);}};WebInspector.dispatchMessageFromBackend=function(message)
{this._messagesToDispatch.push(message);
if(window.__uncaughtExceptions&&window.__uncaughtExceptions.length)
return;if(this._dispatchTimeout)
return;this._dispatchTimeout=setTimeout(this.dispatchNextQueuedMessageFromBackend,0);};WebInspector.RemoteObject=class RemoteObject
{constructor(target,objectId,type,subtype,value,description,size,classPrototype,className,preview)
{this._target=target||WebInspector.mainTarget;this._type=type;this._subtype=subtype;if(objectId){this._objectId=objectId;this._description=description||"";this._hasChildren=type!=="symbol";this._size=size;this._classPrototype=classPrototype;this._preview=preview;if(subtype==="class"){this._functionDescription=this._description;this._description="class "+className;}}else{this._description=description||(value+"");this._hasChildren=false;this._value=value;}}
static createFakeRemoteObject()
{return new WebInspector.RemoteObject(undefined,WebInspector.RemoteObject.FakeRemoteObjectId,"object");}
static fromPrimitiveValue(value)
{return new WebInspector.RemoteObject(undefined,undefined,typeof value,undefined,value,undefined,undefined,undefined,undefined);}
static fromPayload(payload,target)
{if(payload.subtype==="array"){var match=payload.description.match(/\[(\d+)\]$/);if(match){payload.size=parseInt(match[1]);payload.description=payload.description.replace(/\[\d+\]$/,"");}}
if(payload.classPrototype)
payload.classPrototype=WebInspector.RemoteObject.fromPayload(payload.classPrototype,target);if(payload.preview){
if(!payload.preview.type){payload.preview.type=payload.type;payload.preview.subtype=payload.subtype;payload.preview.description=payload.description;payload.preview.size=payload.size;}
payload.preview=WebInspector.ObjectPreview.fromPayload(payload.preview);}
return new WebInspector.RemoteObject(target,payload.objectId,payload.type,payload.subtype,payload.value,payload.description,payload.size,payload.classPrototype,payload.className,payload.preview);}
static createCallArgument(valueOrObject)
{if(valueOrObject instanceof WebInspector.RemoteObject){if(valueOrObject.objectId)
return{objectId:valueOrObject.objectId};return{value:valueOrObject.value};}
return{value:valueOrObject};}
static resolveNode(node,objectGroup,callback)
{DOMAgent.resolveNode(node.id,objectGroup,function(error,object){if(!callback)
return;if(error||!object)
callback(null);else
callback(WebInspector.RemoteObject.fromPayload(object,WebInspector.mainTarget));});}
static resolveWebSocket(webSocketResource,objectGroup,callback)
{NetworkAgent.resolveWebSocket(webSocketResource.requestIdentifier,objectGroup,(error,object)=>{if(error||!object)
callback(null);else
callback(WebInspector.RemoteObject.fromPayload(object,webSocketResource.target));});}
static resolveCanvasContext(canvas,objectGroup,callback)
{CanvasAgent.resolveCanvasContext(canvas.identifier,objectGroup,(error,object)=>{if(error||!object)
callback(null);else
callback(WebInspector.RemoteObject.fromPayload(object,WebInspector.mainTarget));});}
static type(remoteObject)
{if(remoteObject===null)
return"null";var type=typeof remoteObject;if(type!=="object"&&type!=="function")
return type;return remoteObject.type;}
get target()
{return this._target;}
get objectId()
{return this._objectId;}
get type()
{return this._type;}
get subtype()
{return this._subtype;}
get description()
{return this._description;}
get functionDescription()
{return this._functionDescription||this._description;}
get hasChildren()
{return this._hasChildren;}
get value()
{return this._value;}
get size()
{return this._size||0;}
get classPrototype()
{return this._classPrototype;}
get preview()
{return this._preview;}
hasSize()
{return this.isArray()||this.isCollectionType();}
hasValue()
{return"_value"in this;}
canLoadPreview()
{if(this._failedToLoadPreview)
return false;if(this._type!=="object")
return false;if(!this._objectId||this._isSymbol()||this._isFakeObject())
return false;return true;}
updatePreview(callback)
{if(!this.canLoadPreview()){callback(null);return;}
if(!RuntimeAgent.getPreview){this._failedToLoadPreview=true;callback(null);return;}
this._target.RuntimeAgent.getPreview(this._objectId,(error,payload)=>{if(error){this._failedToLoadPreview=true;callback(null);return;}
this._preview=WebInspector.ObjectPreview.fromPayload(payload);callback(this._preview);});}
getOwnPropertyDescriptors(callback)
{this._getPropertyDescriptors(true,callback);}
getAllPropertyDescriptors(callback)
{this._getPropertyDescriptors(false,callback);}
getDisplayablePropertyDescriptors(callback)
{if(!this._objectId||this._isSymbol()||this._isFakeObject()){callback([]);return;}
if(!RuntimeAgent.getDisplayableProperties){this._target.RuntimeAgent.getProperties(this._objectId,function(error,allProperties){var ownOrGetterPropertiesList=[];if(allProperties){for(var property of allProperties){if(property.isOwn||property.name==="__proto__"){ownOrGetterPropertiesList.push(property);}else if(property.value&&property.name!==property.name.toUpperCase()){var type=property.value.type;if(type&&type!=="function"&&property.name!=="constructor"){ownOrGetterPropertiesList.push(property);}}}}
this._getPropertyDescriptorsResolver(callback,error,ownOrGetterPropertiesList);}.bind(this));return;}
this._target.RuntimeAgent.getDisplayableProperties(this._objectId,true,this._getPropertyDescriptorsResolver.bind(this,callback));}
deprecatedGetOwnProperties(callback)
{this._deprecatedGetProperties(true,callback);}
deprecatedGetAllProperties(callback)
{this._deprecatedGetProperties(false,callback);}
deprecatedGetDisplayableProperties(callback)
{if(!this._objectId||this._isSymbol()||this._isFakeObject()){callback([]);return;}
if(!RuntimeAgent.getDisplayableProperties){this._target.RuntimeAgent.getProperties(this._objectId,function(error,allProperties){var ownOrGetterPropertiesList=[];if(allProperties){for(var property of allProperties){if(property.isOwn||property.get||property.name==="__proto__"){ownOrGetterPropertiesList.push(property);}else if(property.value&&property.name!==property.name.toUpperCase()){var type=property.value.type;if(type&&type!=="function"&&property.name!=="constructor"){ownOrGetterPropertiesList.push(property);}}}}
this._deprecatedGetPropertiesResolver(callback,error,ownOrGetterPropertiesList);}.bind(this));return;}
this._target.RuntimeAgent.getDisplayableProperties(this._objectId,this._deprecatedGetPropertiesResolver.bind(this,callback));}
setPropertyValue(name,value,callback)
{if(!this._objectId||this._isSymbol()||this._isFakeObject()){callback("Can't set a property of non-object.");return;}
this._target.RuntimeAgent.evaluate.invoke({expression:appendWebInspectorSourceURL(value),doNotPauseOnExceptionsAndMuteConsole:true},evaluatedCallback.bind(this),this._target.RuntimeAgent);function evaluatedCallback(error,result,wasThrown)
{if(error||wasThrown){callback(error||result.description);return;}
function setPropertyValue(propertyName,propertyValue)
{this[propertyName]=propertyValue;}
delete result.description;this._target.RuntimeAgent.callFunctionOn(this._objectId,appendWebInspectorSourceURL(setPropertyValue.toString()),[{value:name},result],true,undefined,propertySetCallback.bind(this));if(result._objectId)
this._target.RuntimeAgent.releaseObject(result._objectId);}
function propertySetCallback(error,result,wasThrown)
{if(error||wasThrown){callback(error||result.description);return;}
callback();}}
isUndefined()
{return this._type==="undefined";}
isNode()
{return this._subtype==="node";}
isArray()
{return this._subtype==="array";}
isClass()
{return this._subtype==="class";}
isCollectionType()
{return this._subtype==="map"||this._subtype==="set"||this._subtype==="weakmap"||this._subtype==="weakset";}
isWeakCollection()
{return this._subtype==="weakmap"||this._subtype==="weakset";}
getCollectionEntries(start,numberToFetch,callback)
{start=typeof start==="number"?start:0;numberToFetch=typeof numberToFetch==="number"?numberToFetch:100;let objectGroup=this.isWeakCollection()?this._weakCollectionObjectGroup():"";this._target.RuntimeAgent.getCollectionEntries(this._objectId,objectGroup,start,numberToFetch,(error,entries)=>{entries=entries.map((x)=>WebInspector.CollectionEntry.fromPayload(x,this._target));callback(entries);});}
releaseWeakCollectionEntries()
{this._target.RuntimeAgent.releaseObjectGroup(this._weakCollectionObjectGroup());}
pushNodeToFrontend(callback)
{if(this._objectId)
WebInspector.domTreeManager.pushNodeToFrontend(this._objectId,callback);else
callback(0);}
getProperty(propertyName,callback)
{function inspectedPage_object_getProperty(property){return this[property];}
this.callFunction(inspectedPage_object_getProperty,[propertyName],true,callback);}
callFunction(functionDeclaration,args,generatePreview,callback)
{function mycallback(error,result,wasThrown)
{result=result?WebInspector.RemoteObject.fromPayload(result,this._target):null;if(callback&&typeof callback==="function")
callback(error,result,wasThrown);}
if(args)
args=args.map(WebInspector.RemoteObject.createCallArgument);this._target.RuntimeAgent.callFunctionOn(this._objectId,appendWebInspectorSourceURL(functionDeclaration.toString()),args,true,undefined,!!generatePreview,mycallback.bind(this));}
callFunctionJSON(functionDeclaration,args,callback)
{function mycallback(error,result,wasThrown)
{callback((error||wasThrown)?null:result.value);}
this._target.RuntimeAgent.callFunctionOn(this._objectId,appendWebInspectorSourceURL(functionDeclaration.toString()),args,true,true,mycallback);}
invokeGetter(getterRemoteObject,callback)
{function backendInvokeGetter(getter)
{return getter?getter.call(this):undefined;}
this.callFunction(backendInvokeGetter,[getterRemoteObject],true,callback);}
getOwnPropertyDescriptor(propertyName,callback)
{function backendGetOwnPropertyDescriptor(propertyName)
{return this[propertyName];}
function wrappedCallback(error,result,wasThrown)
{if(error||wasThrown||!(result instanceof WebInspector.RemoteObject)){callback(null);return;}
var fakeDescriptor={name:propertyName,value:result,writable:true,configurable:true,enumerable:false};var fakePropertyDescriptor=new WebInspector.PropertyDescriptor(fakeDescriptor,null,true,false,false,false);callback(fakePropertyDescriptor);}
this.callFunction(backendGetOwnPropertyDescriptor,[propertyName],false,wrappedCallback.bind(this));}
release()
{if(this._objectId&&!this._isFakeObject())
this._target.RuntimeAgent.releaseObject(this._objectId);}
arrayLength()
{if(this._subtype!=="array")
return 0;var matches=this._description.match(/\[([0-9]+)\]/);if(!matches)
return 0;return parseInt(matches[1],10);}
asCallArgument()
{return WebInspector.RemoteObject.createCallArgument(this);}
findFunctionSourceCodeLocation()
{var result=new WebInspector.WrappedPromise;if(!this._isFunction()||!this._objectId){result.resolve(WebInspector.RemoteObject.SourceCodeLocationPromise.MissingObjectId);return result.promise;}
this._target.DebuggerAgent.getFunctionDetails(this._objectId,(error,response)=>{if(error){result.reject(error);return;}
var location=response.location;var sourceCode=WebInspector.debuggerManager.scriptForIdentifier(location.scriptId,this._target);if(!sourceCode||(!WebInspector.isDebugUIEnabled()&&isWebKitInternalScript(sourceCode.sourceURL))){result.resolve(WebInspector.RemoteObject.SourceCodeLocationPromise.NoSourceFound);return;}
var sourceCodeLocation=sourceCode.createSourceCodeLocation(location.lineNumber,location.columnNumber||0);result.resolve(sourceCodeLocation);});return result.promise;}
_isFakeObject()
{return this._objectId===WebInspector.RemoteObject.FakeRemoteObjectId;}
_isSymbol()
{return this._type==="symbol";}
_isFunction()
{return this._type==="function";}
_weakCollectionObjectGroup()
{return JSON.stringify(this._objectId)+"-"+this._subtype;}
_getPropertyDescriptors(ownProperties,callback)
{if(!this._objectId||this._isSymbol()||this._isFakeObject()){callback([]);return;}
this._target.RuntimeAgent.getProperties(this._objectId,ownProperties,true,this._getPropertyDescriptorsResolver.bind(this,callback));}
getOwnPropertyDescriptorsAsObject(callback)
{this.getOwnPropertyDescriptors(function(properties){var propertiesResult={};var internalPropertiesResult={};for(var propertyDescriptor of properties){var object=propertyDescriptor.isInternalProperty?internalPropertiesResult:propertiesResult;object[propertyDescriptor.name]=propertyDescriptor;}
callback(propertiesResult,internalPropertiesResult);});}
_getPropertyDescriptorsResolver(callback,error,properties,internalProperties)
{if(error){callback(null);return;}
let descriptors=properties.map((payload)=>{return WebInspector.PropertyDescriptor.fromPayload(payload,false,this._target);});if(internalProperties){descriptors=descriptors.concat(internalProperties.map((payload)=>{return WebInspector.PropertyDescriptor.fromPayload(payload,true,this._target);}));}
callback(descriptors);}
_deprecatedGetProperties(ownProperties,callback)
{if(!this._objectId||this._isSymbol()||this._isFakeObject()){callback([]);return;}
this._target.RuntimeAgent.getProperties(this._objectId,ownProperties,this._deprecatedGetPropertiesResolver.bind(this,callback));}
_deprecatedGetPropertiesResolver(callback,error,properties,internalProperties)
{if(error){callback(null);return;}
if(internalProperties){properties=properties.concat(internalProperties.map(function(descriptor){descriptor.writable=false;descriptor.configurable=false;descriptor.enumerable=false;descriptor.isOwn=true;return descriptor;}));}
var result=[];for(var i=0;properties&&i<properties.length;++i){var property=properties[i];if(property.get||property.set){if(property.get)
result.push(new WebInspector.DeprecatedRemoteObjectProperty("get "+property.name,WebInspector.RemoteObject.fromPayload(property.get,this._target),property));if(property.set)
result.push(new WebInspector.DeprecatedRemoteObjectProperty("set "+property.name,WebInspector.RemoteObject.fromPayload(property.set,this._target),property));}else
result.push(new WebInspector.DeprecatedRemoteObjectProperty(property.name,WebInspector.RemoteObject.fromPayload(property.value,this._target),property));}
callback(result);}};WebInspector.RemoteObject.FakeRemoteObjectId="fake-remote-object";WebInspector.RemoteObject.SourceCodeLocationPromise={NoSourceFound:"remote-object-source-code-location-promise-no-source-found",MissingObjectId:"remote-object-source-code-location-promise-missing-object-id"};WebInspector.DeprecatedRemoteObjectProperty=class DeprecatedRemoteObjectProperty
{constructor(name,value,descriptor)
{this.name=name;this.value=value;this.enumerable=descriptor?!!descriptor.enumerable:true;this.writable=descriptor?!!descriptor.writable:true;if(descriptor&&descriptor.wasThrown)
this.wasThrown=true;}
fromPrimitiveValue(name,value)
{return new WebInspector.DeprecatedRemoteObjectProperty(name,WebInspector.RemoteObject.fromPrimitiveValue(value));}};WebInspector.Target=class Target extends WebInspector.Object
{constructor(identifier,name,type,connection)
{super();this._identifier=identifier;this._name=name;this._type=type;this._connection=connection;this._executionContext=null;this._mainResource=null;this._resourceCollection=new WebInspector.ResourceCollection;this._extraScriptCollection=new WebInspector.Collection(WebInspector.Collection.TypeVerifier.Script);this._connection.target=this;}
get RuntimeAgent(){return this._connection._agents.Runtime;}
get ConsoleAgent(){return this._connection._agents.Console;}
get DebuggerAgent(){return this._connection._agents.Debugger;}
get HeapAgent(){return this._connection._agents.Heap;}
get identifier(){return this._identifier;}
get name(){return this._name;}
get type(){return this._type;}
get connection(){return this._connection;}
get executionContext(){return this._executionContext;}
get resourceCollection(){return this._resourceCollection;}
get extraScriptCollection(){return this._extraScriptCollection;}
get mainResource(){return this._mainResource;}
set mainResource(resource){this._mainResource=resource;}
addResource(resource)
{this._resourceCollection.add(resource);this.dispatchEventToListeners(WebInspector.Target.Event.ResourceAdded,{resource});}
adoptResource(resource)
{resource._target=this;this.addResource(resource);}
addScript(script)
{this._extraScriptCollection.add(script);this.dispatchEventToListeners(WebInspector.Target.Event.ScriptAdded,{script});}};WebInspector.Target.Type={Main:Symbol("main"),Worker:Symbol("worker"),};WebInspector.Target.Event={ResourceAdded:"target-resource-added",ScriptAdded:"target-script-added",};WebInspector.MainTarget=class MainTarget extends WebInspector.Target
{constructor(connection)
{super("main","",WebInspector.Target.Type.Main,InspectorBackend.mainConnection);let displayName=WebInspector.debuggableType===WebInspector.DebuggableType.Web?WebInspector.UIString("Main Frame"):this.displayName;this._executionContext=new WebInspector.ExecutionContext(this,WebInspector.RuntimeManager.TopLevelContextExecutionIdentifier,displayName,true,null);}
get displayName()
{switch(WebInspector.debuggableType){case WebInspector.DebuggableType.Web:return WebInspector.UIString("Page");case WebInspector.DebuggableType.JavaScript:return WebInspector.UIString("JavaScript Context");default:console.error("Unexpected debuggable type: ",WebInspector.debuggableType);return WebInspector.UIString("Main");}}
get mainResource()
{let mainFrame=WebInspector.frameResourceManager.mainFrame;return mainFrame?mainFrame.mainResource:null;}};WebInspector.WorkerTarget=class WorkerTarget extends WebInspector.Target
{constructor(workerId,name,connection)
{super(workerId,name,WebInspector.Target.Type.Worker,connection);WebInspector.frameResourceManager.adoptOrphanedResourcesForTarget(this);if(this.RuntimeAgent){this._executionContext=new WebInspector.ExecutionContext(this,WebInspector.RuntimeManager.TopLevelContextExecutionIdentifier,this.displayName,false,null);this.RuntimeAgent.enable();if(WebInspector.showJavaScriptTypeInformationSetting&&WebInspector.showJavaScriptTypeInformationSetting.value)
this.RuntimeAgent.enableTypeProfiler();if(WebInspector.enableControlFlowProfilerSetting&&WebInspector.enableControlFlowProfilerSetting.value)
this.RuntimeAgent.enableControlFlowProfiler();}
if(this.DebuggerAgent)
WebInspector.debuggerManager.initializeTarget(this);if(this.ConsoleAgent)
this.ConsoleAgent.enable();if(this.HeapAgent)
this.HeapAgent.enable();}
get displayName()
{return WebInspector.displayNameForURL(this._name);}};WebInspector.ApplicationCacheObserver=class ApplicationCacheObserver
{applicationCacheStatusUpdated(frameId,manifestURL,status)
{WebInspector.applicationCacheManager.applicationCacheStatusUpdated(frameId,manifestURL,status);}
networkStateUpdated(isNowOnline)
{WebInspector.applicationCacheManager.networkStateUpdated(isNowOnline);}};WebInspector.CSSObserver=class CSSObserver
{mediaQueryResultChanged()
{WebInspector.cssStyleManager.mediaQueryResultChanged();}
styleSheetChanged(styleSheetId)
{WebInspector.cssStyleManager.styleSheetChanged(styleSheetId);}
styleSheetAdded(styleSheetInfo)
{WebInspector.cssStyleManager.styleSheetAdded(styleSheetInfo);}
styleSheetRemoved(id)
{WebInspector.cssStyleManager.styleSheetRemoved(id);}
namedFlowCreated(namedFlow)
{WebInspector.domTreeManager.namedFlowCreated(namedFlow);}
namedFlowRemoved(documentNodeId,flowName)
{WebInspector.domTreeManager.namedFlowRemoved(documentNodeId,flowName);}
regionLayoutUpdated(namedFlow)
{this.regionOversetChanged(namedFlow);}
regionOversetChanged(namedFlow)
{WebInspector.domTreeManager.regionOversetChanged(namedFlow);}
registeredNamedFlowContentElement(documentNodeId,flowName,contentNodeId,nextContentElementNodeId)
{WebInspector.domTreeManager.registeredNamedFlowContentElement(documentNodeId,flowName,contentNodeId,nextContentElementNodeId);}
unregisteredNamedFlowContentElement(documentNodeId,flowName,contentNodeId)
{WebInspector.domTreeManager.unregisteredNamedFlowContentElement(documentNodeId,flowName,contentNodeId);}};WebInspector.CanvasObserver=class CanvasObserver
{canvasAdded(canvas)
{WebInspector.canvasManager.canvasAdded(canvas);}
canvasRemoved(canvasId)
{WebInspector.canvasManager.canvasRemoved(canvasId);}
canvasMemoryChanged(canvasId,memoryCost)
{WebInspector.canvasManager.canvasMemoryChanged(canvasId,memoryCost);}
cssCanvasClientNodesChanged(canvasId)
{WebInspector.canvasManager.cssCanvasClientNodesChanged(canvasId);}};WebInspector.ConsoleObserver=class ConsoleObserver
{messageAdded(message)
{if(message.source==="console-api"&&message.type==="clear")
return;if(message.type==="assert"&&!message.text)
message.text=WebInspector.UIString("Assertion");WebInspector.logManager.messageWasAdded(this.target,message.source,message.level,message.text,message.type,message.url,message.line,message.column||0,message.repeatCount,message.parameters,message.stackTrace,message.networkRequestId);}
messageRepeatCountUpdated(count)
{WebInspector.logManager.messageRepeatCountUpdated(count);}
messagesCleared()
{WebInspector.logManager.messagesCleared();}
heapSnapshot(timestamp,snapshotStringData,title)
{let workerProxy=WebInspector.HeapSnapshotWorkerProxy.singleton();workerProxy.createSnapshot(snapshotStringData,title||null,({objectId,snapshot:serializedSnapshot})=>{let snapshot=WebInspector.HeapSnapshotProxy.deserialize(objectId,serializedSnapshot);WebInspector.timelineManager.heapSnapshotAdded(timestamp,snapshot);});}};WebInspector.DOMObserver=class DOMObserver
{documentUpdated()
{WebInspector.domTreeManager._documentUpdated();}
setChildNodes(parentId,payloads)
{WebInspector.domTreeManager._setChildNodes(parentId,payloads);}
attributeModified(nodeId,name,value)
{WebInspector.domTreeManager._attributeModified(nodeId,name,value);}
attributeRemoved(nodeId,name)
{WebInspector.domTreeManager._attributeRemoved(nodeId,name);}
inlineStyleInvalidated(nodeIds)
{WebInspector.domTreeManager._inlineStyleInvalidated(nodeIds);}
characterDataModified(nodeId,characterData)
{WebInspector.domTreeManager._characterDataModified(nodeId,characterData);}
childNodeCountUpdated(nodeId,childNodeCount)
{WebInspector.domTreeManager._childNodeCountUpdated(nodeId,childNodeCount);}
childNodeInserted(parentNodeId,previousNodeId,payload)
{WebInspector.domTreeManager._childNodeInserted(parentNodeId,previousNodeId,payload);}
childNodeRemoved(parentNodeId,nodeId)
{WebInspector.domTreeManager._childNodeRemoved(parentNodeId,nodeId);}
shadowRootPushed(parentNodeId,nodeId)
{WebInspector.domTreeManager._childNodeInserted(parentNodeId,0,nodeId);}
shadowRootPopped(parentNodeId,nodeId)
{WebInspector.domTreeManager._childNodeRemoved(parentNodeId,nodeId);}
customElementStateChanged(nodeId,customElementState)
{WebInspector.domTreeManager._customElementStateChanged(nodeId,customElementState);}
pseudoElementAdded(parentNodeId,pseudoElement)
{WebInspector.domTreeManager._pseudoElementAdded(parentNodeId,pseudoElement);}
pseudoElementRemoved(parentNodeId,pseudoElementId)
{WebInspector.domTreeManager._pseudoElementRemoved(parentNodeId,pseudoElementId);}};WebInspector.DOMStorageObserver=class DOMStorageObserver
{domStorageItemsCleared(storageId)
{WebInspector.storageManager.itemsCleared(storageId);}
domStorageItemRemoved(storageId,key)
{WebInspector.storageManager.itemRemoved(storageId,key);}
domStorageItemAdded(storageId,key,value)
{WebInspector.storageManager.itemAdded(storageId,key,value);}
domStorageItemUpdated(storageId,key,oldValue,value)
{WebInspector.storageManager.itemUpdated(storageId,key,oldValue,value);}};WebInspector.DatabaseObserver=class DatabaseObserver
{addDatabase(database)
{WebInspector.storageManager.databaseWasAdded(database.id,database.domain,database.name,database.version);}};WebInspector.DebuggerObserver=class DebuggerObserver
{constructor()
{this._legacyScriptParsed=DebuggerAgent.hasEventParameter("scriptParsed","hasSourceURL");}
globalObjectCleared()
{WebInspector.debuggerManager.reset();}
scriptParsed(scriptId,url,startLine,startColumn,endLine,endColumn,isContentScript,sourceURL,sourceMapURL,isModule)
{if(this._legacyScriptParsed){
let legacySourceMapURL=arguments[7];let hasSourceURL=arguments[8];let legacySourceURL=hasSourceURL?url:undefined;WebInspector.debuggerManager.scriptDidParse(this.target,scriptId,url,startLine,startColumn,endLine,endColumn,isModule,isContentScript,legacySourceURL,legacySourceMapURL);return;}
WebInspector.debuggerManager.scriptDidParse(this.target,scriptId,url,startLine,startColumn,endLine,endColumn,isModule,isContentScript,sourceURL,sourceMapURL);}
scriptFailedToParse(url,scriptSource,startLine,errorLine,errorMessage)
{}
breakpointResolved(breakpointId,location)
{WebInspector.debuggerManager.breakpointResolved(this.target,breakpointId,location);}
paused(callFrames,reason,data,asyncStackTrace)
{WebInspector.debuggerManager.debuggerDidPause(this.target,callFrames,reason,data,asyncStackTrace);}
resumed()
{WebInspector.debuggerManager.debuggerDidResume(this.target);}
playBreakpointActionSound(breakpointActionIdentifier)
{WebInspector.debuggerManager.playBreakpointActionSound(breakpointActionIdentifier);}
didSampleProbe(sample)
{WebInspector.probeManager.didSampleProbe(this.target,sample);}};WebInspector.HeapObserver=class HeapObserver
{garbageCollected(collection)
{WebInspector.heapManager.garbageCollected(this.target,collection);}
trackingStart(timestamp,snapshotStringData)
{let workerProxy=WebInspector.HeapSnapshotWorkerProxy.singleton();workerProxy.createSnapshot(snapshotStringData,({objectId,snapshot:serializedSnapshot})=>{let snapshot=WebInspector.HeapSnapshotProxy.deserialize(objectId,serializedSnapshot);WebInspector.timelineManager.heapTrackingStarted(timestamp,snapshot);});}
trackingComplete(timestamp,snapshotStringData)
{let workerProxy=WebInspector.HeapSnapshotWorkerProxy.singleton();workerProxy.createSnapshot(snapshotStringData,({objectId,snapshot:serializedSnapshot})=>{let snapshot=WebInspector.HeapSnapshotProxy.deserialize(objectId,serializedSnapshot);WebInspector.timelineManager.heapTrackingCompleted(timestamp,snapshot);});}};WebInspector.InspectorObserver=class InspectorObserver
{evaluateForTestInFrontend(script)
{if(!InspectorFrontendHost.isUnderTest())
return;InspectorBackend.runAfterPendingDispatches(function(){window.eval(script);});}
inspect(payload,hints)
{var remoteObject=WebInspector.RemoteObject.fromPayload(payload,WebInspector.mainTarget);if(remoteObject.subtype==="node"){WebInspector.domTreeManager.inspectNodeObject(remoteObject);return;}
if(hints.databaseId)
WebInspector.storageManager.inspectDatabase(hints.databaseId);else if(hints.domStorageId)
WebInspector.storageManager.inspectDOMStorage(hints.domStorageId);remoteObject.release();}
activateExtraDomains(domains)
{WebInspector.activateExtraDomains(domains);}};WebInspector.LayerTreeObserver=class LayerTreeObserver
{layerTreeDidChange()
{if(WebInspector.layerTreeManager.supported)
WebInspector.layerTreeManager.layerTreeDidChange();}};WebInspector.MemoryObserver=class MemoryObserver
{memoryPressure(timestamp,severity)
{WebInspector.memoryManager.memoryPressure(timestamp,severity);}
trackingStart(timestamp)
{WebInspector.timelineManager.memoryTrackingStart(timestamp);}
trackingUpdate(event)
{WebInspector.timelineManager.memoryTrackingUpdate(event);}
trackingComplete()
{WebInspector.timelineManager.memoryTrackingComplete();}};WebInspector.NetworkObserver=class NetworkObserver
{requestWillBeSent(requestId,frameId,loaderId,documentURL,request,timestamp,initiator,redirectResponse,type,targetId)
{WebInspector.frameResourceManager.resourceRequestWillBeSent(requestId,frameId,loaderId,request,type,redirectResponse,timestamp,initiator,targetId);}
requestServedFromCache(requestId)
{WebInspector.frameResourceManager.markResourceRequestAsServedFromMemoryCache(requestId);}
responseReceived(requestId,frameId,loaderId,timestamp,type,response)
{WebInspector.frameResourceManager.resourceRequestDidReceiveResponse(requestId,frameId,loaderId,type,response,timestamp);}
dataReceived(requestId,timestamp,dataLength,encodedDataLength)
{WebInspector.frameResourceManager.resourceRequestDidReceiveData(requestId,dataLength,encodedDataLength,timestamp);}
loadingFinished(requestId,timestamp,sourceMapURL,metrics)
{WebInspector.frameResourceManager.resourceRequestDidFinishLoading(requestId,timestamp,sourceMapURL,metrics);}
loadingFailed(requestId,timestamp,errorText,canceled)
{WebInspector.frameResourceManager.resourceRequestDidFailLoading(requestId,canceled,timestamp,errorText);}
requestServedFromMemoryCache(requestId,frameId,loaderId,documentURL,timestamp,initiator,resource)
{WebInspector.frameResourceManager.resourceRequestWasServedFromMemoryCache(requestId,frameId,loaderId,resource,timestamp,initiator);}
webSocketCreated(requestId,url)
{WebInspector.frameResourceManager.webSocketCreated(requestId,url);}
webSocketWillSendHandshakeRequest(requestId,timestamp,walltime,request)
{WebInspector.frameResourceManager.webSocketWillSendHandshakeRequest(requestId,timestamp,walltime,request);}
webSocketHandshakeResponseReceived(requestId,timestamp,response)
{WebInspector.frameResourceManager.webSocketHandshakeResponseReceived(requestId,timestamp,response);}
webSocketClosed(requestId,timestamp)
{WebInspector.frameResourceManager.webSocketClosed(requestId,timestamp);}
webSocketFrameReceived(requestId,timestamp,response)
{WebInspector.frameResourceManager.webSocketFrameReceived(requestId,timestamp,response);}
webSocketFrameSent(requestId,timestamp,response)
{WebInspector.frameResourceManager.webSocketFrameSent(requestId,timestamp,response);}
webSocketFrameError(requestId,timestamp,errorMessage)
{}};WebInspector.PageObserver=class PageObserver
{domContentEventFired(timestamp)
{WebInspector.timelineManager.pageDOMContentLoadedEventFired(timestamp);}
loadEventFired(timestamp)
{WebInspector.timelineManager.pageLoadEventFired(timestamp);}
frameNavigated(frame,loaderId)
{WebInspector.frameResourceManager.frameDidNavigate(frame,loaderId);}
frameDetached(frameId)
{WebInspector.frameResourceManager.frameDidDetach(frameId);}
frameStartedLoading(frameId)
{}
frameStoppedLoading(frameId)
{}
frameScheduledNavigation(frameId,delay)
{}
frameClearedScheduledNavigation(frameId)
{}
javascriptDialogOpening(message)
{}
javascriptDialogClosed()
{}
scriptsEnabled(enabled)
{}};WebInspector.RuntimeObserver=class RuntimeObserver
{executionContextCreated(contextPayload)
{WebInspector.frameResourceManager.executionContextCreated(contextPayload);}};WebInspector.ScriptProfilerObserver=class ScriptProfilerObserver
{trackingStart(timestamp)
{WebInspector.timelineManager.scriptProfilerTrackingStarted(timestamp);}
trackingUpdate(event)
{WebInspector.timelineManager.scriptProfilerTrackingUpdated(event);}
trackingComplete(samples)
{WebInspector.timelineManager.scriptProfilerTrackingCompleted(samples);}
programmaticCaptureStarted()
{WebInspector.timelineManager.scriptProfilerProgrammaticCaptureStarted();}
programmaticCaptureStopped()
{WebInspector.timelineManager.scriptProfilerProgrammaticCaptureStopped();}};WebInspector.TimelineObserver=class TimelineObserver
{eventRecorded(record)
{WebInspector.timelineManager.eventRecorded(record);}
recordingStarted(startTime)
{WebInspector.timelineManager.capturingStarted(startTime);}
recordingStopped(endTime)
{WebInspector.timelineManager.capturingStopped(endTime);}
autoCaptureStarted()
{WebInspector.timelineManager.autoCaptureStarted();}
programmaticCaptureStarted()
{WebInspector.timelineManager.programmaticCaptureStarted();}
programmaticCaptureStopped()
{WebInspector.timelineManager.programmaticCaptureStopped();}};WebInspector.WorkerObserver=class WorkerObserver
{workerCreated(workerId,url)
{WebInspector.workerManager.workerCreated(workerId,url);}
workerTerminated(workerId)
{WebInspector.workerManager.workerTerminated(workerId);}
dispatchMessageFromWorker(workerId,message)
{WebInspector.workerManager.dispatchMessageFromWorker(workerId,message);}};WebInspector.BreakpointAction=class BreakpointAction extends WebInspector.Object
{constructor(breakpoint,typeOrInfo,data)
{super();this._breakpoint=breakpoint;if(typeof typeOrInfo==="string"){this._type=typeOrInfo;this._data=data||null;}else if(typeof typeOrInfo==="object"){this._type=typeOrInfo.type;this._data=typeOrInfo.data||null;}else
console.error("Unexpected type passed to WebInspector.BreakpointAction");this._id=WebInspector.debuggerManager.nextBreakpointActionIdentifier();}
get breakpoint(){return this._breakpoint;}
get id(){return this._id;}
get type(){return this._type;}
get data()
{return this._data;}
set data(data)
{if(this._data===data)
return;this._data=data;this._breakpoint.breakpointActionDidChange(this);}
get info()
{var obj={type:this._type,id:this._id};if(this._data)
obj.data=this._data;return obj;}};WebInspector.BreakpointAction.Type={Log:"log",Evaluate:"evaluate",Sound:"sound",Probe:"probe"};WebInspector.ConsoleMessage=class ConsoleMessage extends WebInspector.Object
{constructor(target,source,level,message,type,url,line,column,repeatCount,parameters,callFrames,request)
{super();this._target=target;this._source=source;this._level=level;this._messageText=message;this._type=type||WebInspector.ConsoleMessage.MessageType.Log;this._url=url||null;this._line=line||0;this._column=column||0;this._sourceCodeLocation=undefined;this._repeatCount=repeatCount||0;this._parameters=parameters;callFrames=callFrames||[];this._stackTrace=WebInspector.StackTrace.fromPayload(this._target,{callFrames});this._request=request;}
get target(){return this._target;}
get source(){return this._source;}
get level(){return this._level;}
get messageText(){return this._messageText;}
get type(){return this._type;}
get url(){return this._url;}
get line(){return this._line;}
get column(){return this._column;}
get repeatCount(){return this._repeatCount;}
get parameters(){return this._parameters;}
get stackTrace(){return this._stackTrace;}
get request(){return this._request;}
get sourceCodeLocation()
{if(this._sourceCodeLocation!==undefined)
return this._sourceCodeLocation;let topCallFrame=this._stackTrace.callFrames[0];if(topCallFrame&&topCallFrame.sourceCodeLocation){this._sourceCodeLocation=topCallFrame.sourceCodeLocation;return this._sourceCodeLocation;}
if(this._url&&this._url!=="undefined"){let sourceCode=WebInspector.frameResourceManager.resourceForURL(this._url);if(sourceCode){let lineNumber=this._line>0?this._line-1:0;let columnNumber=this._column>0?this._column-1:0;this._sourceCodeLocation=new WebInspector.SourceCodeLocation(sourceCode,lineNumber,columnNumber);return this._sourceCodeLocation;}}
this._sourceCodeLocation=null;return this._sourceCodeLocation;}};WebInspector.ConsoleMessage.MessageSource={HTML:"html",XML:"xml",JS:"javascript",Network:"network",ConsoleAPI:"console-api",Storage:"storage",Appcache:"appcache",Rendering:"rendering",CSS:"css",Security:"security",Other:"other",};WebInspector.ConsoleMessage.MessageType={Log:"log",Dir:"dir",DirXML:"dirxml",Table:"table",Trace:"trace",StartGroup:"startGroup",StartGroupCollapsed:"startGroupCollapsed",EndGroup:"endGroup",Assert:"assert",Timing:"timing",Profile:"profile",ProfileEnd:"profileEnd",Result:"result",};WebInspector.ConsoleMessage.MessageLevel={Log:"log",Info:"info",Warning:"warning",Error:"error",Debug:"debug",};WebInspector.Instrument=class Instrument extends WebInspector.Object
{ static createForTimelineType(type)
{switch(type){case WebInspector.TimelineRecord.Type.Network:return new WebInspector.NetworkInstrument;case WebInspector.TimelineRecord.Type.Layout:return new WebInspector.LayoutInstrument;case WebInspector.TimelineRecord.Type.Script:return new WebInspector.ScriptInstrument;case WebInspector.TimelineRecord.Type.RenderingFrame:return new WebInspector.FPSInstrument;case WebInspector.TimelineRecord.Type.Memory:return new WebInspector.MemoryInstrument;case WebInspector.TimelineRecord.Type.HeapAllocations:return new WebInspector.HeapAllocationsInstrument;default:console.error("Unknown TimelineRecord.Type: "+type);return null;}}
static startLegacyTimelineAgent(initiatedByBackend)
{if(WebInspector.Instrument._legacyTimelineAgentStarted)
return;WebInspector.Instrument._legacyTimelineAgentStarted=true;if(initiatedByBackend)
return;let result=TimelineAgent.start();if(!TimelineAgent.hasEvent("recordingStarted")){result.then(function(){WebInspector.timelineManager.capturingStarted();});}}
static stopLegacyTimelineAgent(initiatedByBackend)
{if(!WebInspector.Instrument._legacyTimelineAgentStarted)
return;WebInspector.Instrument._legacyTimelineAgentStarted=false;if(initiatedByBackend)
return;TimelineAgent.stop();}
get timelineRecordType()
{return null;}
startInstrumentation(initiatedByBackend)
{WebInspector.Instrument.startLegacyTimelineAgent(initiatedByBackend);}
stopInstrumentation(initiatedByBackend)
{WebInspector.Instrument.stopLegacyTimelineAgent(initiatedByBackend);}};WebInspector.Instrument._legacyTimelineAgentStarted=false;WebInspector.SourceCode=class SourceCode extends WebInspector.Object
{constructor()
{super();this._originalRevision=new WebInspector.SourceCodeRevision(this,null,false);this._currentRevision=this._originalRevision;this._sourceMaps=null;this._formatterSourceMap=null;this._requestContentPromise=null;}
get displayName()
{console.error("Needs to be implemented by a subclass.");return"";}
get originalRevision()
{return this._originalRevision;}
get currentRevision()
{return this._currentRevision;}
set currentRevision(revision)
{if(!(revision instanceof WebInspector.SourceCodeRevision))
return;if(revision.sourceCode!==this)
return;this._currentRevision=revision;this.dispatchEventToListeners(WebInspector.SourceCode.Event.ContentDidChange);}
get content()
{return this._currentRevision.content;}
get url()
{}
get contentIdentifier()
{
return this.url;}
get sourceMaps()
{return this._sourceMaps||[];}
addSourceMap(sourceMap)
{if(!this._sourceMaps)
this._sourceMaps=[];this._sourceMaps.push(sourceMap);this.dispatchEventToListeners(WebInspector.SourceCode.Event.SourceMapAdded);}
get formatterSourceMap()
{return this._formatterSourceMap;}
set formatterSourceMap(formatterSourceMap)
{this._formatterSourceMap=formatterSourceMap;this.dispatchEventToListeners(WebInspector.SourceCode.Event.FormatterDidChange);}
requestContent()
{this._requestContentPromise=this._requestContentPromise||this.requestContentFromBackend().then(this._processContent.bind(this));return this._requestContentPromise;}
createSourceCodeLocation(lineNumber,columnNumber)
{return new WebInspector.SourceCodeLocation(this,lineNumber,columnNumber);}
createLazySourceCodeLocation(lineNumber,columnNumber)
{return new WebInspector.LazySourceCodeLocation(this,lineNumber,columnNumber);}
createSourceCodeTextRange(textRange)
{return new WebInspector.SourceCodeTextRange(this,textRange);}
revisionContentDidChange(revision)
{if(this._ignoreRevisionContentDidChangeEvent)
return;if(revision!==this._currentRevision)
return;this.handleCurrentRevisionContentChange();this.dispatchEventToListeners(WebInspector.SourceCode.Event.ContentDidChange);}
handleCurrentRevisionContentChange()
{}
get revisionForRequestedContent()
{return this._originalRevision;}
markContentAsStale()
{this._requestContentPromise=null;this._contentReceived=false;}
requestContentFromBackend()
{console.error("Needs to be implemented by a subclass.");return Promise.reject(new Error("Needs to be implemented by a subclass."));}
get mimeType()
{console.error("Needs to be implemented by a subclass.");}
_processContent(parameters)
{var content=parameters.content||parameters.body||parameters.text||parameters.scriptSource;var error=parameters.error;if(parameters.base64Encoded)
content=decodeBase64ToBlob(content,this.mimeType);var revision=this.revisionForRequestedContent;this._ignoreRevisionContentDidChangeEvent=true;revision.content=content||null;this._ignoreRevisionContentDidChangeEvent=false;
return Promise.resolve({error,sourceCode:this,content,});}};WebInspector.SourceCode.Event={ContentDidChange:"source-code-content-did-change",SourceMapAdded:"source-code-source-map-added",FormatterDidChange:"source-code-formatter-did-change",LoadingDidFinish:"source-code-loading-did-finish",LoadingDidFail:"source-code-loading-did-fail"};WebInspector.SourceCodeLocation=class SourceCodeLocation extends WebInspector.Object
{constructor(sourceCode,lineNumber,columnNumber)
{super();this._sourceCode=sourceCode||null;this._lineNumber=lineNumber;this._columnNumber=columnNumber;this._resolveFormattedLocation();if(this._sourceCode){this._sourceCode.addEventListener(WebInspector.SourceCode.Event.SourceMapAdded,this._sourceCodeSourceMapAdded,this);this._sourceCode.addEventListener(WebInspector.SourceCode.Event.FormatterDidChange,this._sourceCodeFormatterDidChange,this);}
this._resetMappedLocation();}
isEqual(other)
{if(!other)
return false;return this._sourceCode===other._sourceCode&&this._lineNumber===other._lineNumber&&this._columnNumber===other._columnNumber;}
get sourceCode()
{return this._sourceCode;}
set sourceCode(sourceCode)
{this.setSourceCode(sourceCode);}
get lineNumber()
{return this._lineNumber;}
get columnNumber()
{return this._columnNumber;}
position()
{return new WebInspector.SourceCodePosition(this.lineNumber,this.columnNumber);}
get formattedLineNumber()
{return this._formattedLineNumber;}
get formattedColumnNumber()
{return this._formattedColumnNumber;}
formattedPosition()
{return new WebInspector.SourceCodePosition(this.formattedLineNumber,this.formattedColumnNumber);}
get displaySourceCode()
{this.resolveMappedLocation();return this._mappedResource||this._sourceCode;}
get displayLineNumber()
{this.resolveMappedLocation();return isNaN(this._mappedLineNumber)?this._formattedLineNumber:this._mappedLineNumber;}
get displayColumnNumber()
{this.resolveMappedLocation();return isNaN(this._mappedColumnNumber)?this._formattedColumnNumber:this._mappedColumnNumber;}
displayPosition()
{return new WebInspector.SourceCodePosition(this.displayLineNumber,this.displayColumnNumber);}
originalLocationString(columnStyle,nameStyle,prefix)
{return this._locationString(this.sourceCode,this.lineNumber,this.columnNumber,columnStyle,nameStyle,prefix);}
formattedLocationString(columnStyle,nameStyle,prefix)
{return this._locationString(this.sourceCode,this.formattedLineNumber,this.formattedColumn,columnStyle,nameStyle,prefix);}
displayLocationString(columnStyle,nameStyle,prefix)
{return this._locationString(this.displaySourceCode,this.displayLineNumber,this.displayColumnNumber,columnStyle,nameStyle,prefix);}
tooltipString()
{if(!this.hasDifferentDisplayLocation())
return this.originalLocationString(WebInspector.SourceCodeLocation.ColumnStyle.Shown,WebInspector.SourceCodeLocation.NameStyle.Full);var tooltip=WebInspector.UIString("Located at %s").format(this.displayLocationString(WebInspector.SourceCodeLocation.ColumnStyle.Shown,WebInspector.SourceCodeLocation.NameStyle.Full));tooltip+="\n"+WebInspector.UIString("Originally %s").format(this.originalLocationString(WebInspector.SourceCodeLocation.ColumnStyle.Shown,WebInspector.SourceCodeLocation.NameStyle.Full));return tooltip;}
hasMappedLocation()
{this.resolveMappedLocation();return this._mappedResource!==null;}
hasFormattedLocation()
{return this._formattedLineNumber!==this._lineNumber||this._formattedColumnNumber!==this._columnNumber;}
hasDifferentDisplayLocation()
{return this.hasMappedLocation()||this.hasFormattedLocation();}
update(sourceCode,lineNumber,columnNumber)
{if(sourceCode===this._sourceCode&&lineNumber===this._lineNumber&&columnNumber===this._columnNumber)
return;if(this._mappedResource&&sourceCode===this._mappedResource&&lineNumber===this._mappedLineNumber&&columnNumber===this._mappedColumnNumber)
return;var newSourceCodeLocation=sourceCode.createSourceCodeLocation(lineNumber,columnNumber);this._makeChangeAndDispatchChangeEventIfNeeded(function(){this._lineNumber=newSourceCodeLocation._lineNumber;this._columnNumber=newSourceCodeLocation._columnNumber;if(newSourceCodeLocation._mappedLocationIsResolved){this._mappedLocationIsResolved=true;this._mappedResource=newSourceCodeLocation._mappedResource;this._mappedLineNumber=newSourceCodeLocation._mappedLineNumber;this._mappedColumnNumber=newSourceCodeLocation._mappedColumnNumber;}});}
populateLiveDisplayLocationTooltip(element,prefix)
{prefix=prefix||"";element.title=prefix+this.tooltipString();this.addEventListener(WebInspector.SourceCodeLocation.Event.DisplayLocationChanged,function(event){if(this.sourceCode)
element.title=prefix+this.tooltipString();},this);}
populateLiveDisplayLocationString(element,propertyName,columnStyle,nameStyle,prefix)
{var currentDisplay;function updateDisplayString(showAlternativeLocation,forceUpdate)
{if(!forceUpdate&&currentDisplay===showAlternativeLocation)
return;currentDisplay=showAlternativeLocation;if(!showAlternativeLocation){element[propertyName]=this.displayLocationString(columnStyle,nameStyle,prefix);element.classList.toggle(WebInspector.SourceCodeLocation.DisplayLocationClassName,this.hasDifferentDisplayLocation());}else if(this.hasDifferentDisplayLocation()){element[propertyName]=this.originalLocationString(columnStyle,nameStyle,prefix);element.classList.remove(WebInspector.SourceCodeLocation.DisplayLocationClassName);}}
function mouseOverOrMove(event)
{updateDisplayString.call(this,event.metaKey&&!event.altKey&&!event.shiftKey);}
updateDisplayString.call(this,false);this.addEventListener(WebInspector.SourceCodeLocation.Event.DisplayLocationChanged,function(event){if(this.sourceCode)
updateDisplayString.call(this,currentDisplay,true);},this);var boundMouseOverOrMove=mouseOverOrMove.bind(this);element.addEventListener("mouseover",boundMouseOverOrMove);element.addEventListener("mousemove",boundMouseOverOrMove);element.addEventListener("mouseout",(event)=>{updateDisplayString.call(this,false);});}
setSourceCode(sourceCode)
{if(sourceCode===this._sourceCode)
return;this._makeChangeAndDispatchChangeEventIfNeeded(function(){if(this._sourceCode){this._sourceCode.removeEventListener(WebInspector.SourceCode.Event.SourceMapAdded,this._sourceCodeSourceMapAdded,this);this._sourceCode.removeEventListener(WebInspector.SourceCode.Event.FormatterDidChange,this._sourceCodeFormatterDidChange,this);}
this._sourceCode=sourceCode;if(this._sourceCode){this._sourceCode.addEventListener(WebInspector.SourceCode.Event.SourceMapAdded,this._sourceCodeSourceMapAdded,this);this._sourceCode.addEventListener(WebInspector.SourceCode.Event.FormatterDidChange,this._sourceCodeFormatterDidChange,this);}});}
resolveMappedLocation()
{if(this._mappedLocationIsResolved)
return;this._mappedLocationIsResolved=true;if(!this._sourceCode)
return;var sourceMaps=this._sourceCode.sourceMaps;if(!sourceMaps.length)
return;for(var i=0;i<sourceMaps.length;++i){var sourceMap=sourceMaps[i];var entry=sourceMap.findEntry(this._lineNumber,this._columnNumber);if(!entry||entry.length===2)
continue;var url=entry[2];var sourceMapResource=sourceMap.resourceForURL(url);if(!sourceMapResource)
return;this._mappedResource=sourceMapResource;this._mappedLineNumber=entry[3];this._mappedColumnNumber=entry[4];return;}}
_locationString(sourceCode,lineNumber,columnNumber,columnStyle,nameStyle,prefix)
{if(!sourceCode)
return"";columnStyle=columnStyle||WebInspector.SourceCodeLocation.ColumnStyle.OnlyIfLarge;nameStyle=nameStyle||WebInspector.SourceCodeLocation.NameStyle.Short;prefix=prefix||"";let lineString=lineNumber+1;if(columnStyle===WebInspector.SourceCodeLocation.ColumnStyle.Shown&&columnNumber>0)
lineString+=":"+(columnNumber+1);else if(columnStyle===WebInspector.SourceCodeLocation.ColumnStyle.OnlyIfLarge&&columnNumber>WebInspector.SourceCodeLocation.LargeColumnNumber)
lineString+=":"+(columnNumber+1);else if(columnStyle===WebInspector.SourceCodeLocation.ColumnStyle.Hidden)
lineString="";switch(nameStyle){case WebInspector.SourceCodeLocation.NameStyle.None:return prefix+lineString;case WebInspector.SourceCodeLocation.NameStyle.Short:case WebInspector.SourceCodeLocation.NameStyle.Full:var displayURL=sourceCode.displayURL;var name=nameStyle===WebInspector.SourceCodeLocation.NameStyle.Full&&displayURL?displayURL:sourceCode.displayName;if(columnStyle===WebInspector.SourceCodeLocation.ColumnStyle.Hidden)
return prefix+name;var lineSuffix=displayURL?":"+lineString:WebInspector.UIString(" (line %s)").format(lineString);return prefix+name+lineSuffix;default:console.error("Unknown nameStyle: "+nameStyle);return prefix+lineString;}}
_resetMappedLocation()
{this._mappedLocationIsResolved=false;this._mappedResource=null;this._mappedLineNumber=NaN;this._mappedColumnNumber=NaN;}
_setMappedLocation(mappedResource,mappedLineNumber,mappedColumnNumber)
{this._mappedLocationIsResolved=true;this._mappedResource=mappedResource;this._mappedLineNumber=mappedLineNumber;this._mappedColumnNumber=mappedColumnNumber;}
_resolveFormattedLocation()
{if(this._sourceCode&&this._sourceCode.formatterSourceMap){var formattedLocation=this._sourceCode.formatterSourceMap.originalToFormatted(this._lineNumber,this._columnNumber);this._formattedLineNumber=formattedLocation.lineNumber;this._formattedColumnNumber=formattedLocation.columnNumber;}else{this._formattedLineNumber=this._lineNumber;this._formattedColumnNumber=this._columnNumber;}}
_makeChangeAndDispatchChangeEventIfNeeded(changeFunction)
{var oldSourceCode=this._sourceCode;var oldLineNumber=this._lineNumber;var oldColumnNumber=this._columnNumber;var oldFormattedLineNumber=this._formattedLineNumber;var oldFormattedColumnNumber=this._formattedColumnNumber;var oldDisplaySourceCode=this.displaySourceCode;var oldDisplayLineNumber=this.displayLineNumber;var oldDisplayColumnNumber=this.displayColumnNumber;this._resetMappedLocation();if(changeFunction)
changeFunction.call(this);this.resolveMappedLocation();this._resolveFormattedLocation();var displayLocationChanged=false;var newDisplaySourceCode=this.displaySourceCode;if(oldDisplaySourceCode!==newDisplaySourceCode)
displayLocationChanged=true;else if(newDisplaySourceCode&&(oldDisplayLineNumber!==this.displayLineNumber||oldDisplayColumnNumber!==this.displayColumnNumber))
displayLocationChanged=true;var anyLocationChanged=false;if(displayLocationChanged)
anyLocationChanged=true;else if(oldSourceCode!==this._sourceCode)
anyLocationChanged=true;else if(this._sourceCode&&(oldLineNumber!==this._lineNumber||oldColumnNumber!==this._columnNumber))
anyLocationChanged=true;else if(this._sourceCode&&(oldFormattedLineNumber!==this._formattedLineNumber||oldFormattedColumnNumber!==this._formattedColumnNumber))
anyLocationChanged=true;if(displayLocationChanged||anyLocationChanged){var oldData={oldSourceCode,oldLineNumber,oldColumnNumber,oldFormattedLineNumber,oldFormattedColumnNumber,oldDisplaySourceCode,oldDisplayLineNumber,oldDisplayColumnNumber};if(displayLocationChanged)
this.dispatchEventToListeners(WebInspector.SourceCodeLocation.Event.DisplayLocationChanged,oldData);if(anyLocationChanged)
this.dispatchEventToListeners(WebInspector.SourceCodeLocation.Event.LocationChanged,oldData);}}
_sourceCodeSourceMapAdded()
{this._makeChangeAndDispatchChangeEventIfNeeded(null);}
_sourceCodeFormatterDidChange()
{this._makeChangeAndDispatchChangeEventIfNeeded(null);}};WebInspector.SourceCodeLocation.DisplayLocationClassName="display-location";WebInspector.SourceCodeLocation.LargeColumnNumber=80;WebInspector.SourceCodeLocation.NameStyle={None:"none",Short:"short",Full:"full"};WebInspector.SourceCodeLocation.ColumnStyle={Hidden:"hidden",OnlyIfLarge:"only-if-large",Shown:"shown"};WebInspector.SourceCodeLocation.Event={LocationChanged:"source-code-location-location-changed",DisplayLocationChanged:"source-code-location-display-location-changed"};WebInspector.Timeline=class Timeline extends WebInspector.Object
{constructor(type)
{super();this._type=type;this.reset(true);}
static create(type)
{if(type===WebInspector.TimelineRecord.Type.Network)
return new WebInspector.NetworkTimeline(type);if(type===WebInspector.TimelineRecord.Type.Memory)
return new WebInspector.MemoryTimeline(type);return new WebInspector.Timeline(type);}
get type(){return this._type;}
get startTime(){return this._startTime;}
get endTime(){return this._endTime;}
get records(){return this._records;}
reset(suppressEvents)
{this._records=[];this._startTime=NaN;this._endTime=NaN;if(!suppressEvents){this.dispatchEventToListeners(WebInspector.Timeline.Event.TimesUpdated);this.dispatchEventToListeners(WebInspector.Timeline.Event.Reset);}}
addRecord(record)
{if(record.updatesDynamically)
record.addEventListener(WebInspector.TimelineRecord.Event.Updated,this._recordUpdated,this);
this._tryInsertingRecordInSortedOrder(record);this._updateTimesIfNeeded(record);this.dispatchEventToListeners(WebInspector.Timeline.Event.RecordAdded,{record});}
saveIdentityToCookie(cookie)
{cookie[WebInspector.Timeline.TimelineTypeCookieKey]=this._type;}
refresh()
{this.dispatchEventToListeners(WebInspector.Timeline.Event.Refreshed);}
recordsInTimeRange(startTime,endTime,includeRecordBeforeStart)
{let lowerIndex=this._records.lowerBound(startTime,(time,record)=>time-record.timestamp);let upperIndex=this._records.upperBound(endTime,(time,record)=>time-record.timestamp);if(includeRecordBeforeStart&&lowerIndex>0)
lowerIndex--;return this._records.slice(lowerIndex,upperIndex);}
_updateTimesIfNeeded(record)
{var changed=false;if(isNaN(this._startTime)||record.startTime<this._startTime){this._startTime=record.startTime;changed=true;}
if(isNaN(this._endTime)||this._endTime<record.endTime){this._endTime=record.endTime;changed=true;}
if(changed)
this.dispatchEventToListeners(WebInspector.Timeline.Event.TimesUpdated);}
_recordUpdated(event)
{this._updateTimesIfNeeded(event.target);}
_tryInsertingRecordInSortedOrder(record)
{let lastValue=this._records.lastValue;if(!lastValue||lastValue.startTime<record.startTime||record.updatesDynamically){this._records.push(record);return;}
let start=this._records.length-2;let end=Math.max(this._records.length-20,0);for(let i=start;i>=end;--i){if(this._records[i].startTime<record.startTime){this._records.insertAtIndex(record,i+1);return;}}
this._records.push(record);}};WebInspector.Timeline.Event={Reset:"timeline-reset",RecordAdded:"timeline-record-added",TimesUpdated:"timeline-times-updated",Refreshed:"timeline-refreshed",};WebInspector.Timeline.TimelineTypeCookieKey="timeline-type";WebInspector.TimelineRange=class TimelineRange extends WebInspector.Object
{constructor(startValue,endValue)
{super();this._startValue=startValue;this._endValue=endValue;}
get startValue(){return this._startValue;}
set startValue(x){this._startValue=x;}
get endValue(){return this._endValue;}
set endValue(x){this._endValue=x;}};WebInspector.TimelineRecord=class TimelineRecord extends WebInspector.Object
{constructor(type,startTime,endTime,callFrames,sourceCodeLocation)
{super();if(type in WebInspector.TimelineRecord.Type)
type=WebInspector.TimelineRecord.Type[type];this._type=type;this._startTime=startTime||NaN;this._endTime=endTime||NaN;this._callFrames=callFrames||null;this._sourceCodeLocation=sourceCodeLocation||null;this._children=[];}
get type()
{return this._type;}
get startTime()
{return this._startTime;}
get activeStartTime()
{return this._startTime;}
get endTime()
{return this._endTime;}
get duration()
{return this.endTime-this.startTime;}
get inactiveDuration()
{return this.activeStartTime-this.startTime;}
get activeDuration()
{return this.endTime-this.activeStartTime;}
get updatesDynamically()
{return false;}
get usesActiveStartTime()
{return false;}
get callFrames()
{return this._callFrames;}
get initiatorCallFrame()
{if(!this._callFrames||!this._callFrames.length)
return null;for(var i=0;i<this._callFrames.length;++i){if(this._callFrames[i].nativeCode)
continue;return this._callFrames[i];}
return null;}
get sourceCodeLocation()
{return this._sourceCodeLocation;}
get parent()
{return this._parent;}
set parent(x)
{if(this._parent===x)
return;this._parent=x;}
get children()
{return this._children;}
saveIdentityToCookie(cookie)
{cookie[WebInspector.TimelineRecord.SourceCodeURLCookieKey]=this._sourceCodeLocation?this._sourceCodeLocation.sourceCode.url?this._sourceCodeLocation.sourceCode.url.hash:null:null;cookie[WebInspector.TimelineRecord.SourceCodeLocationLineCookieKey]=this._sourceCodeLocation?this._sourceCodeLocation.lineNumber:null;cookie[WebInspector.TimelineRecord.SourceCodeLocationColumnCookieKey]=this._sourceCodeLocation?this._sourceCodeLocation.columnNumber:null;cookie[WebInspector.TimelineRecord.TypeCookieKey]=this._type||null;}};WebInspector.TimelineRecord.Event={Updated:"timeline-record-updated"};WebInspector.TimelineRecord.Type={Network:"timeline-record-type-network",Layout:"timeline-record-type-layout",Script:"timeline-record-type-script",RenderingFrame:"timeline-record-type-rendering-frame",Memory:"timeline-record-type-memory",HeapAllocations:"timeline-record-type-heap-allocations",};WebInspector.TimelineRecord.TypeIdentifier="timeline-record";WebInspector.TimelineRecord.SourceCodeURLCookieKey="timeline-record-source-code-url";WebInspector.TimelineRecord.SourceCodeLocationLineCookieKey="timeline-record-source-code-location-line";WebInspector.TimelineRecord.SourceCodeLocationColumnCookieKey="timeline-record-source-code-location-column";WebInspector.TimelineRecord.TypeCookieKey="timeline-record-type";WebInspector.AnalyzerMessage=class AnalyzerMessage extends WebInspector.Object
{constructor(sourceCodeLocation,text,ruleIdentifier)
{super();this._sourceCodeLocation=sourceCodeLocation;this._text=text;this._ruleIdentifier=ruleIdentifier;}
get sourceCodeLocation(){return this._sourceCodeLocation;}
get sourceCode(){return this._sourceCodeLocation.sourceCode;}
get text(){return this._text;}
get ruleIdentifier(){return this._ruleIdentifier;}};WebInspector.ApplicationCacheFrame=class ApplicationCacheFrame extends WebInspector.Object
{constructor(frame,manifest,status)
{super();this._frame=frame;this._manifest=manifest;this._status=status;}
get frame(){return this._frame;}
get manifest(){return this._manifest;}
get status(){return this._status;}
set status(status){this._status=status;}
saveIdentityToCookie(cookie)
{cookie[WebInspector.ApplicationCacheFrame.FrameURLCookieKey]=this.frame.url;cookie[WebInspector.ApplicationCacheFrame.ManifestURLCookieKey]=this.manifest.manifestURL;}};WebInspector.ApplicationCacheFrame.TypeIdentifier="application-cache-frame";WebInspector.ApplicationCacheFrame.FrameURLCookieKey="application-cache-frame-url";WebInspector.ApplicationCacheFrame.ManifestURLCookieKey="application-cache-frame-manifest-url";WebInspector.ApplicationCacheManifest=class ApplicationCacheManifest extends WebInspector.Object
{constructor(manifestURL)
{super();this._manifestURL=manifestURL;}
get manifestURL(){return this._manifestURL;}};WebInspector.BackForwardEntry=class BackForwardEntry extends WebInspector.Object
{constructor(contentView,cookie)
{super();this._contentView=contentView;
this._tombstone=false;this._cookie=cookie||{};this._scrollPositions=[];contentView.saveToCookie(this._cookie);}
makeCopy(newCookie)
{let copy=new WebInspector.BackForwardEntry(this._contentView,newCookie||this.cookie);copy._tombstone=this._tombstone;copy._scrollPositions=this._scrollPositions.slice();return copy;}
get contentView()
{return this._contentView;}
get cookie()
{return Object.shallowCopy(this._cookie);}
get tombstone()
{return this._tombstone;}
set tombstone(tombstone)
{this._tombstone=tombstone;}
prepareToShow(shouldCallShown)
{this._restoreFromCookie();this.contentView.visible=true;if(shouldCallShown)
this.contentView.shown();this.contentView.needsLayout();}
prepareToHide()
{this.contentView.visible=false;this.contentView.hidden();this._saveScrollPositions();}
isEqual(other)
{if(!other)
return false;return this._contentView===other._contentView&&Object.shallowEqual(this._cookie,other._cookie);}
_restoreFromCookie()
{this._restoreScrollPositions();this.contentView.restoreFromCookie(this.cookie);}
_restoreScrollPositions()
{if(!this._scrollPositions.length)
return;var scrollableElements=this.contentView.scrollableElements||[];for(var i=0;i<scrollableElements.length;++i){var position=this._scrollPositions[i];var element=scrollableElements[i];if(!element)
continue;element.scrollTop=position.isScrolledToBottom?element.scrollHeight:position.scrollTop;
element.scrollLeft=position.isScrolledToBottom?0:position.scrollLeft;}}
_saveScrollPositions()
{var scrollableElements=this.contentView.scrollableElements||[];var scrollPositions=[];for(var i=0;i<scrollableElements.length;++i){var element=scrollableElements[i];if(!element)
continue;let position={scrollTop:element.scrollTop,scrollLeft:element.scrollLeft};if(this.contentView.shouldKeepElementsScrolledToBottom)
position.isScrolledToBottom=element.isScrolledToBottom();scrollPositions.push(position);}
this._scrollPositions=scrollPositions;}};WebInspector.Branch=class Branch extends WebInspector.Object
{constructor(displayName,revisions,locked)
{super();this._displayName=displayName;this._revisions=revisions instanceof Array?revisions.slice():[];this._locked=locked||false;}
get displayName()
{return this._displayName;}
set displayName(displayName)
{if(!displayName)
return;this._displayName=displayName;}
get revisions()
{return this._revisions;}
get locked()
{return this._locked;}
revisionForRepresentedObject(representedObject,doNotCreateIfNeeded)
{for(var i=0;i<this._revisions.length;++i){var revision=this._revisions[i];if(revision instanceof WebInspector.SourceCodeRevision&&revision.sourceCode===representedObject)
return revision;}
if(doNotCreateIfNeeded)
return null;if(representedObject instanceof WebInspector.SourceCode){var revision=representedObject.originalRevision.copy();representedObject.currentRevision=revision;this.addRevision(revision);return revision;}
return null;}
addRevision(revision)
{if(this._locked)
return;if(this._revisions.includes(revision))
return;this._revisions.push(revision);}
removeRevision(revision)
{if(this._locked)
return;this._revisions.remove(revision);}
reset()
{if(this._locked)
return;this._revisions=[];}
fork(displayName)
{var copiedRevisions=this._revisions.map(function(revision){return revision.copy();});return new WebInspector.Branch(displayName,copiedRevisions);}
apply()
{for(var i=0;i<this._revisions.length;++i)
this._revisions[i].apply();}
revert()
{for(var i=this._revisions.length-1;i>=0;--i)
this._revisions[i].revert();}
lock()
{this._locked=true;}
unlock()
{this._locked=false;}};WebInspector.Breakpoint=class Breakpoint extends WebInspector.Object
{constructor(sourceCodeLocationOrInfo,disabled,condition)
{super();if(sourceCodeLocationOrInfo instanceof WebInspector.SourceCodeLocation){var sourceCode=sourceCodeLocationOrInfo.sourceCode;var contentIdentifier=sourceCode?sourceCode.contentIdentifier:null;var scriptIdentifier=sourceCode instanceof WebInspector.Script?sourceCode.id:null;var target=sourceCode instanceof WebInspector.Script?sourceCode.target:null;var location=sourceCodeLocationOrInfo;}else if(sourceCodeLocationOrInfo&&typeof sourceCodeLocationOrInfo==="object"){var contentIdentifier=sourceCodeLocationOrInfo.contentIdentifier||sourceCodeLocationOrInfo.url;var lineNumber=sourceCodeLocationOrInfo.lineNumber||0;var columnNumber=sourceCodeLocationOrInfo.columnNumber||0;var location=new WebInspector.SourceCodeLocation(null,lineNumber,columnNumber);var ignoreCount=sourceCodeLocationOrInfo.ignoreCount||0;var autoContinue=sourceCodeLocationOrInfo.autoContinue||false;var actions=sourceCodeLocationOrInfo.actions||[];for(var i=0;i<actions.length;++i)
actions[i]=new WebInspector.BreakpointAction(this,actions[i]);disabled=sourceCodeLocationOrInfo.disabled;condition=sourceCodeLocationOrInfo.condition;}else
console.error("Unexpected type passed to WebInspector.Breakpoint",sourceCodeLocationOrInfo);this._id=null;this._contentIdentifier=contentIdentifier||null;this._scriptIdentifier=scriptIdentifier||null;this._target=target||null;this._disabled=disabled||false;this._condition=condition||"";this._ignoreCount=ignoreCount||0;this._autoContinue=autoContinue||false;this._actions=actions||[];this._resolved=false;this._sourceCodeLocation=location;this._sourceCodeLocation.addEventListener(WebInspector.SourceCodeLocation.Event.LocationChanged,this._sourceCodeLocationLocationChanged,this);this._sourceCodeLocation.addEventListener(WebInspector.SourceCodeLocation.Event.DisplayLocationChanged,this._sourceCodeLocationDisplayLocationChanged,this);}
get identifier()
{return this._id;}
set identifier(id)
{this._id=id||null;}
get contentIdentifier()
{return this._contentIdentifier;}
get scriptIdentifier()
{return this._scriptIdentifier;}
get target()
{return this._target;}
get sourceCodeLocation()
{return this._sourceCodeLocation;}
get resolved()
{return this._resolved;}
set resolved(resolved)
{if(this._resolved===resolved)
return;function isSpecialBreakpoint()
{return this._sourceCodeLocation.isEqual(new WebInspector.SourceCodeLocation(null,Infinity,Infinity));}
this._resolved=resolved||false;this.dispatchEventToListeners(WebInspector.Breakpoint.Event.ResolvedStateDidChange);}
get disabled()
{return this._disabled;}
set disabled(disabled)
{if(this._disabled===disabled)
return;this._disabled=disabled||false;this.dispatchEventToListeners(WebInspector.Breakpoint.Event.DisabledStateDidChange);}
get condition()
{return this._condition;}
set condition(condition)
{if(this._condition===condition)
return;this._condition=condition;this.dispatchEventToListeners(WebInspector.Breakpoint.Event.ConditionDidChange);}
get ignoreCount()
{return this._ignoreCount;}
set ignoreCount(ignoreCount)
{if(ignoreCount<0)
return;if(this._ignoreCount===ignoreCount)
return;this._ignoreCount=ignoreCount;this.dispatchEventToListeners(WebInspector.Breakpoint.Event.IgnoreCountDidChange);}
get autoContinue()
{return this._autoContinue;}
set autoContinue(cont)
{if(this._autoContinue===cont)
return;this._autoContinue=cont;this.dispatchEventToListeners(WebInspector.Breakpoint.Event.AutoContinueDidChange);}
get actions()
{return this._actions;}
get options()
{return{condition:this._condition,ignoreCount:this._ignoreCount,actions:this._serializableActions(),autoContinue:this._autoContinue};}
get info()
{return{contentIdentifier:this._contentIdentifier,lineNumber:this._sourceCodeLocation.lineNumber,columnNumber:this._sourceCodeLocation.columnNumber,disabled:this._disabled,condition:this._condition,ignoreCount:this._ignoreCount,actions:this._serializableActions(),autoContinue:this._autoContinue};}
get probeActions()
{return this._actions.filter(function(action){return action.type===WebInspector.BreakpointAction.Type.Probe;});}
cycleToNextMode()
{if(this.disabled){this.autoContinue=false;this.disabled=false;return;}
if(this.autoContinue){this.disabled=true;return;}
if(this.actions.length){this.autoContinue=true;return;}
this.disabled=true;}
createAction(type,precedingAction,data)
{var newAction=new WebInspector.BreakpointAction(this,type,data||null);if(!precedingAction)
this._actions.push(newAction);else{var index=this._actions.indexOf(precedingAction);if(index===-1)
this._actions.push(newAction);else
this._actions.splice(index+1,0,newAction);}
this.dispatchEventToListeners(WebInspector.Breakpoint.Event.ActionsDidChange);return newAction;}
recreateAction(type,actionToReplace)
{var newAction=new WebInspector.BreakpointAction(this,type,null);var index=this._actions.indexOf(actionToReplace);if(index===-1)
return null;this._actions[index]=newAction;this.dispatchEventToListeners(WebInspector.Breakpoint.Event.ActionsDidChange);return newAction;}
removeAction(action)
{var index=this._actions.indexOf(action);if(index===-1)
return;this._actions.splice(index,1);if(!this._actions.length)
this.autoContinue=false;this.dispatchEventToListeners(WebInspector.Breakpoint.Event.ActionsDidChange);}
clearActions(type)
{if(!type)
this._actions=[];else
this._actions=this._actions.filter(function(action){return action.type!==type;});this.dispatchEventToListeners(WebInspector.Breakpoint.Event.ActionsDidChange);}
saveIdentityToCookie(cookie)
{cookie[WebInspector.Breakpoint.ContentIdentifierCookieKey]=this.contentIdentifier;cookie[WebInspector.Breakpoint.LineNumberCookieKey]=this.sourceCodeLocation.lineNumber;cookie[WebInspector.Breakpoint.ColumnNumberCookieKey]=this.sourceCodeLocation.columnNumber;}
breakpointActionDidChange(action)
{var index=this._actions.indexOf(action);if(index===-1)
return;this.dispatchEventToListeners(WebInspector.Breakpoint.Event.ActionsDidChange);}
_serializableActions()
{var actions=[];for(var i=0;i<this._actions.length;++i)
actions.push(this._actions[i].info);return actions;}
_sourceCodeLocationLocationChanged(event)
{this.dispatchEventToListeners(WebInspector.Breakpoint.Event.LocationDidChange,event.data);}
_sourceCodeLocationDisplayLocationChanged(event)
{this.dispatchEventToListeners(WebInspector.Breakpoint.Event.DisplayLocationDidChange,event.data);}};WebInspector.Breakpoint.DefaultBreakpointActionType=WebInspector.BreakpointAction.Type.Log;WebInspector.Breakpoint.TypeIdentifier="breakpoint";WebInspector.Breakpoint.ContentIdentifierCookieKey="breakpoint-content-identifier";WebInspector.Breakpoint.LineNumberCookieKey="breakpoint-line-number";WebInspector.Breakpoint.ColumnNumberCookieKey="breakpoint-column-number";WebInspector.Breakpoint.Event={DisabledStateDidChange:"breakpoint-disabled-state-did-change",ResolvedStateDidChange:"breakpoint-resolved-state-did-change",ConditionDidChange:"breakpoint-condition-did-change",IgnoreCountDidChange:"breakpoint-ignore-count-did-change",ActionsDidChange:"breakpoint-actions-did-change",AutoContinueDidChange:"breakpoint-auto-continue-did-change",LocationDidChange:"breakpoint-location-did-change",DisplayLocationDidChange:"breakpoint-display-location-did-change",};WebInspector.CallingContextTree=class CallingContextTree extends WebInspector.Object
{constructor(type)
{super();this._type=type||WebInspector.CallingContextTree.Type.TopDown;this.reset();}
get type(){return this._type;}
get totalNumberOfSamples(){return this._totalNumberOfSamples;}
reset()
{this._root=new WebInspector.CallingContextTreeNode(-1,-1,-1,"<root>",null);this._totalNumberOfSamples=0;}
totalDurationInTimeRange(startTime,endTime)
{return this._root.filteredTimestampsAndDuration(startTime,endTime).duration;}
updateTreeWithStackTrace({timestamp,stackFrames},duration)
{this._totalNumberOfSamples++;let node=this._root;node.addTimestampAndExpressionLocation(timestamp,duration,null);switch(this._type){case WebInspector.CallingContextTree.Type.TopDown:for(let i=stackFrames.length;i--;){let stackFrame=stackFrames[i];node=node.findOrMakeChild(stackFrame);node.addTimestampAndExpressionLocation(timestamp,duration,stackFrame.expressionLocation||null,i===0);}
break;case WebInspector.CallingContextTree.Type.BottomUp:for(let i=0;i<stackFrames.length;++i){let stackFrame=stackFrames[i];node=node.findOrMakeChild(stackFrame);node.addTimestampAndExpressionLocation(timestamp,duration,stackFrame.expressionLocation||null,i===0);}
break;case WebInspector.CallingContextTree.Type.TopFunctionsTopDown:for(let i=stackFrames.length;i--;){node=this._root;for(let j=i+1;j--;){let stackFrame=stackFrames[j];node=node.findOrMakeChild(stackFrame);node.addTimestampAndExpressionLocation(timestamp,duration,stackFrame.expressionLocation||null,j===0);}}
break;case WebInspector.CallingContextTree.Type.TopFunctionsBottomUp:for(let i=0;i<stackFrames.length;i++){node=this._root;for(let j=i;j<stackFrames.length;j++){let stackFrame=stackFrames[j];node=node.findOrMakeChild(stackFrame);node.addTimestampAndExpressionLocation(timestamp,duration,stackFrame.expressionLocation||null,j===0);}}
break;default:break;}}
toCPUProfilePayload(startTime,endTime)
{let cpuProfile={};let roots=[];let numSamplesInTimeRange=this._root.filteredTimestampsAndDuration(startTime,endTime).timestamps.length;this._root.forEachChild((child)=>{if(child.hasStackTraceInTimeRange(startTime,endTime))
roots.push(child.toCPUProfileNode(numSamplesInTimeRange,startTime,endTime));});cpuProfile.rootNodes=roots;return cpuProfile;}
forEachChild(callback)
{this._root.forEachChild(callback);}
forEachNode(callback)
{this._root.forEachNode(callback);}
static __test_makeTreeFromProtocolMessageObject(messageObject)
{let tree=new WebInspector.CallingContextTree;let stackTraces=messageObject.params.samples.stackTraces;for(let i=0;i<stackTraces.length;i++)
tree.updateTreeWithStackTrace(stackTraces[i]);return tree;}
__test_matchesStackTrace(stackTrace)
{
let leaves=this.__test_buildLeafLinkedLists();outer:for(let node of leaves){for(let stackNode of stackTrace){for(let propertyName of Object.getOwnPropertyNames(stackNode)){if(stackNode[propertyName]!==node[propertyName])
continue outer;}
node=node.parent;}
return true;}
return false;}
__test_buildLeafLinkedLists()
{let result=[];let parent=null;this._root.__test_buildLeafLinkedLists(parent,result);return result;}};WebInspector.CallingContextTree.Type={TopDown:Symbol("TopDown"),BottomUp:Symbol("BottomUp"),TopFunctionsTopDown:Symbol("TopFunctionsTopDown"),TopFunctionsBottomUp:Symbol("TopFunctionsBottomUp"),};WebInspector.CallingContextTreeNode=class CallingContextTreeNode extends WebInspector.Object
{constructor(sourceID,line,column,name,url,hash)
{super();this._children={};this._sourceID=sourceID;this._line=line;this._column=column;this._name=name;this._url=url;this._uid=WebInspector.CallingContextTreeNode.__uid++;this._timestamps=[];this._durations=[];this._leafTimestamps=[];this._leafDurations=[];this._expressionLocations={};this._hash=hash||WebInspector.CallingContextTreeNode._hash(this);}
static _hash(stackFrame)
{return stackFrame.name+":"+stackFrame.sourceID+":"+stackFrame.line+":"+stackFrame.column;}
get sourceID(){return this._sourceID;}
get line(){return this._line;}
get column(){return this._column;}
get name(){return this._name;}
get uid(){return this._uid;}
get url(){return this._url;}
get hash(){return this._hash;}
hasChildrenInTimeRange(startTime,endTime)
{for(let propertyName of Object.getOwnPropertyNames(this._children)){let child=this._children[propertyName];if(child.hasStackTraceInTimeRange(startTime,endTime))
return true;}
return false;}
hasStackTraceInTimeRange(startTime,endTime)
{if(startTime>endTime)
return false;let timestamps=this._timestamps;let length=timestamps.length;if(!length)
return false;let index=timestamps.lowerBound(startTime);if(index===length)
return false;let hasTimestampInRange=timestamps[index]<=endTime;return hasTimestampInRange;}
filteredTimestampsAndDuration(startTime,endTime)
{let lowerIndex=this._timestamps.lowerBound(startTime);let upperIndex=this._timestamps.upperBound(endTime);let totalDuration=0;for(let i=lowerIndex;i<upperIndex;++i)
totalDuration+=this._durations[i];return{timestamps:this._timestamps.slice(lowerIndex,upperIndex),duration:totalDuration,};}
filteredLeafTimestampsAndDuration(startTime,endTime)
{let lowerIndex=this._leafTimestamps.lowerBound(startTime);let upperIndex=this._leafTimestamps.upperBound(endTime);let totalDuration=0;for(let i=lowerIndex;i<upperIndex;++i)
totalDuration+=this._leafDurations[i];return{leafTimestamps:this._leafTimestamps.slice(lowerIndex,upperIndex),leafDuration:totalDuration,};}
hasChildren()
{return!isEmptyObject(this._children);}
findOrMakeChild(stackFrame)
{let hash=WebInspector.CallingContextTreeNode._hash(stackFrame);let node=this._children[hash];if(node)
return node;node=new WebInspector.CallingContextTreeNode(stackFrame.sourceID,stackFrame.line,stackFrame.column,stackFrame.name,stackFrame.url,hash);this._children[hash]=node;return node;}
addTimestampAndExpressionLocation(timestamp,duration,expressionLocation,leaf)
{this._timestamps.push(timestamp);this._durations.push(duration);if(leaf){this._leafTimestamps.push(timestamp);this._leafDurations.push(duration);}
if(!expressionLocation)
return;let{line,column}=expressionLocation;let hashCons=line+":"+column;let timestamps=this._expressionLocations[hashCons];if(!timestamps){timestamps=[];this._expressionLocations[hashCons]=timestamps;}
timestamps.push(timestamp);}
forEachChild(callback)
{for(let propertyName of Object.getOwnPropertyNames(this._children))
callback(this._children[propertyName]);}
forEachNode(callback)
{callback(this);this.forEachChild(function(child){child.forEachNode(callback);});}
equals(other)
{return this._hash===other.hash;}
toCPUProfileNode(numSamples,startTime,endTime)
{let children=[];this.forEachChild((child)=>{if(child.hasStackTraceInTimeRange(startTime,endTime))
children.push(child.toCPUProfileNode(numSamples,startTime,endTime));});let cpuProfileNode={id:this._uid,functionName:this._name,url:this._url,lineNumber:this._line,columnNumber:this._column,children:children};let timestamps=[];let frameStartTime=Number.MAX_VALUE;let frameEndTime=Number.MIN_VALUE;for(let i=0;i<this._timestamps.length;i++){let timestamp=this._timestamps[i];if(startTime<=timestamp&&timestamp<=endTime){timestamps.push(timestamp);frameStartTime=Math.min(frameStartTime,timestamp);frameEndTime=Math.max(frameEndTime,timestamp);}}
cpuProfileNode.callInfo={callCount:timestamps.length,startTime:frameStartTime,endTime:frameEndTime,totalTime:(timestamps.length/numSamples)*(endTime-startTime)};return cpuProfileNode;}
__test_buildLeafLinkedLists(parent,result)
{let linkedListNode={name:this._name,url:this._url,parent:parent};if(this.hasChildren()){this.forEachChild((child)=>{child.__test_buildLeafLinkedLists(linkedListNode,result);});}else{result.push(linkedListNode);}}};WebInspector.CallingContextTreeNode.__uid=0;WebInspector.CSSCompletions=class CSSCompletions
{constructor(properties,acceptEmptyPrefix)
{this._values=[];this._longhands={};this._shorthands={};if(properties.length&&typeof properties[0]==="string")
this._values=this._values.concat(properties);else{for(var property of properties){var propertyName=property.name;this._values.push(propertyName);var longhands=property.longhands;if(longhands){this._longhands[propertyName]=longhands;for(var j=0;j<longhands.length;++j){var longhandName=longhands[j];var shorthands=this._shorthands[longhandName];if(!shorthands){shorthands=[];this._shorthands[longhandName]=shorthands;}
shorthands.push(propertyName);}}}}
this._values.sort();this._acceptEmptyPrefix=acceptEmptyPrefix;}
static requestCSSCompletions()
{if(WebInspector.CSSCompletions.cssNameCompletions)
return;function propertyNamesCallback(error,names)
{if(error)
return;WebInspector.CSSCompletions.cssNameCompletions=new WebInspector.CSSCompletions(names,false);WebInspector.CSSKeywordCompletions.addCustomCompletions(names);if(!window.CodeMirror)
return;var propertyNamesForCodeMirror={};var valueKeywordsForCodeMirror={"inherit":true,"initial":true,"unset":true,"revert":true,"var":true};var colorKeywordsForCodeMirror={};function nameForCodeMirror(name)
{return name.replace(/^-[^-]+-/,"").replace(/\(\)$/,"").toLowerCase();}
function collectPropertyNameForCodeMirror(propertyName)
{var codeMirrorPropertyName=nameForCodeMirror(propertyName);propertyNamesForCodeMirror[codeMirrorPropertyName]=true;valueKeywordsForCodeMirror[codeMirrorPropertyName]=true;}
for(var property of names)
collectPropertyNameForCodeMirror(property.name);for(var propertyName in WebInspector.CSSKeywordCompletions._propertyKeywordMap){var keywords=WebInspector.CSSKeywordCompletions._propertyKeywordMap[propertyName];for(var i=0;i<keywords.length;++i){if(!isNaN(Number(keywords[i])))
continue;valueKeywordsForCodeMirror[nameForCodeMirror(keywords[i])]=true;}}
WebInspector.CSSKeywordCompletions._colors.forEach(function(colorName){colorKeywordsForCodeMirror[nameForCodeMirror(colorName)]=true;});function updateCodeMirrorCSSMode(mimeType)
{var modeSpec=CodeMirror.resolveMode(mimeType);modeSpec.propertyKeywords=propertyNamesForCodeMirror;modeSpec.valueKeywords=valueKeywordsForCodeMirror;modeSpec.colorKeywords=colorKeywordsForCodeMirror;CodeMirror.defineMIME(mimeType,modeSpec);}
updateCodeMirrorCSSMode("text/css");updateCodeMirrorCSSMode("text/x-scss");}
function fontFamilyNamesCallback(error,fontFamilyNames)
{if(error)
return;WebInspector.CSSKeywordCompletions.addPropertyCompletionValues("font-family",fontFamilyNames);WebInspector.CSSKeywordCompletions.addPropertyCompletionValues("font",fontFamilyNames);}
if(window.CSSAgent){CSSAgent.getSupportedCSSProperties(propertyNamesCallback);if(CSSAgent.getSupportedSystemFontFamilyNames)
CSSAgent.getSupportedSystemFontFamilyNames(fontFamilyNamesCallback);}}
get values()
{return this._values;}
startsWith(prefix)
{var firstIndex=this._firstIndexOfPrefix(prefix);if(firstIndex===-1)
return[];var results=[];while(firstIndex<this._values.length&&this._values[firstIndex].startsWith(prefix))
results.push(this._values[firstIndex++]);return results;}
_firstIndexOfPrefix(prefix)
{if(!this._values.length)
return-1;if(!prefix)
return this._acceptEmptyPrefix?0:-1;var maxIndex=this._values.length-1;var minIndex=0;var foundIndex;do{var middleIndex=(maxIndex+minIndex)>>1;if(this._values[middleIndex].startsWith(prefix)){foundIndex=middleIndex;break;}
if(this._values[middleIndex]<prefix)
minIndex=middleIndex+1;else
maxIndex=middleIndex-1;}while(minIndex<=maxIndex);if(foundIndex===undefined)
return-1;while(foundIndex&&this._values[foundIndex-1].startsWith(prefix))
foundIndex--;return foundIndex;}
keySet()
{if(!this._keySet)
this._keySet=this._values.keySet();return this._keySet;}
next(str,prefix)
{return this._closest(str,prefix,1);}
previous(str,prefix)
{return this._closest(str,prefix,-1);}
_closest(str,prefix,shift)
{if(!str)
return"";var index=this._values.indexOf(str);if(index===-1)
return"";if(!prefix){index=(index+this._values.length+shift)%this._values.length;return this._values[index];}
var propertiesWithPrefix=this.startsWith(prefix);var j=propertiesWithPrefix.indexOf(str);j=(j+propertiesWithPrefix.length+shift)%propertiesWithPrefix.length;return propertiesWithPrefix[j];}
isShorthandPropertyName(shorthand)
{return shorthand in this._longhands;}
shorthandsForLonghand(longhand)
{return this._shorthands[longhand]||[];}
isValidPropertyName(name)
{return this._values.includes(name);}
propertyRequiresWebkitPrefix(name)
{return this._values.includes("-webkit-"+name)&&!this._values.includes(name);}
getClosestPropertyName(name)
{var bestMatches=[{distance:Infinity,name:null}];for(var property of this._values){var distance=name.levenshteinDistance(property);if(distance<bestMatches[0].distance)
bestMatches=[{distance,name:property}];else if(distance===bestMatches[0].distance)
bestMatches.push({distance,name:property});}
return bestMatches.length<3?bestMatches[0].name:false;}};WebInspector.CSSCompletions.cssNameCompletions=null;WebInspector.CSSKeywordCompletions={};WebInspector.CSSKeywordCompletions.forProperty=function(propertyName)
{let acceptedKeywords=["initial","unset","revert","var()"];let isNotPrefixed=propertyName.charAt(0)!=="-";if(propertyName in WebInspector.CSSKeywordCompletions._propertyKeywordMap)
acceptedKeywords=acceptedKeywords.concat(WebInspector.CSSKeywordCompletions._propertyKeywordMap[propertyName]);else if(isNotPrefixed&&("-webkit-"+propertyName)in WebInspector.CSSKeywordCompletions._propertyKeywordMap)
acceptedKeywords=acceptedKeywords.concat(WebInspector.CSSKeywordCompletions._propertyKeywordMap["-webkit-"+propertyName]);if(propertyName in WebInspector.CSSKeywordCompletions._colorAwareProperties)
acceptedKeywords=acceptedKeywords.concat(WebInspector.CSSKeywordCompletions._colors);else if(isNotPrefixed&&("-webkit-"+propertyName)in WebInspector.CSSKeywordCompletions._colorAwareProperties)
acceptedKeywords=acceptedKeywords.concat(WebInspector.CSSKeywordCompletions._colors);else if(propertyName.endsWith("color"))
acceptedKeywords=acceptedKeywords.concat(WebInspector.CSSKeywordCompletions._colors);if(propertyName in WebInspector.CSSKeywordCompletions.InheritedProperties)
acceptedKeywords.push("inherit");else if(isNotPrefixed&&("-webkit-"+propertyName)in WebInspector.CSSKeywordCompletions.InheritedProperties)
acceptedKeywords.push("inherit");if(acceptedKeywords.includes(WebInspector.CSSKeywordCompletions.AllPropertyNamesPlaceholder)&&WebInspector.CSSCompletions.cssNameCompletions){acceptedKeywords.remove(WebInspector.CSSKeywordCompletions.AllPropertyNamesPlaceholder);acceptedKeywords=acceptedKeywords.concat(WebInspector.CSSCompletions.cssNameCompletions.values);}
return new WebInspector.CSSCompletions(acceptedKeywords,true);};WebInspector.CSSKeywordCompletions.forFunction=function(functionName)
{let suggestions=["var()"];if(functionName==="var")
suggestions=[];else if(functionName=="env")
suggestions=suggestions.concat(["safe-area-inset-top","safe-area-inset-right","safe-area-inset-bottom","safe-area-inset-left"]);else if(functionName==="image-set")
suggestions.push("url()");else if(functionName==="repeat")
suggestions=suggestions.concat(["auto","auto-fill","auto-fit","min-content","max-content"]);else if(functionName.endsWith("gradient")){suggestions=suggestions.concat(["to","left","right","top","bottom"]);suggestions=suggestions.concat(WebInspector.CSSKeywordCompletions._colors);}
return new WebInspector.CSSCompletions(suggestions,true);}
WebInspector.CSSKeywordCompletions.addCustomCompletions=function(properties)
{for(var property of properties){if(property.values)
WebInspector.CSSKeywordCompletions.addPropertyCompletionValues(property.name,property.values);}};WebInspector.CSSKeywordCompletions.addPropertyCompletionValues=function(propertyName,newValues)
{var existingValues=WebInspector.CSSKeywordCompletions._propertyKeywordMap[propertyName];if(!existingValues){WebInspector.CSSKeywordCompletions._propertyKeywordMap[propertyName]=newValues;return;}
var union=new Set;for(var value of existingValues)
union.add(value);for(var value of newValues)
union.add(value);WebInspector.CSSKeywordCompletions._propertyKeywordMap[propertyName]=[...union.values()];};WebInspector.CSSKeywordCompletions.AllPropertyNamesPlaceholder="__all-properties__";WebInspector.CSSKeywordCompletions.InheritedProperties=["azimuth","border-collapse","border-spacing","caption-side","clip-rule","color","color-interpolation","color-interpolation-filters","color-rendering","cursor","direction","elevation","empty-cells","fill","fill-opacity","fill-rule","font","font-family","font-size","font-style","font-variant","font-variant-numeric","font-weight","font-optical-sizing","glyph-orientation-horizontal","glyph-orientation-vertical","hanging-punctuation","image-rendering","kerning","letter-spacing","line-height","list-style","list-style-image","list-style-position","list-style-type","marker","marker-end","marker-mid","marker-start","orphans","pitch","pitch-range","pointer-events","quotes","resize","richness","shape-rendering","speak","speak-header","speak-numeral","speak-punctuation","speech-rate","stress","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","text-align","text-anchor","text-decoration","text-indent","text-rendering","text-shadow","text-transform","visibility","voice-family","volume","white-space","widows","word-break","word-spacing","word-wrap","writing-mode","-webkit-aspect-ratio","-webkit-border-horizontal-spacing","-webkit-border-vertical-spacing","-webkit-box-direction","-webkit-color-correction","font-feature-settings","-webkit-font-kerning","-webkit-font-smoothing","-webkit-font-variant-ligatures","-webkit-hyphenate-character","-webkit-hyphenate-limit-after","-webkit-hyphenate-limit-before","-webkit-hyphenate-limit-lines","-webkit-hyphens","-webkit-line-align","-webkit-line-box-contain","-webkit-line-break","-webkit-line-grid","-webkit-line-snap","-webkit-locale","-webkit-nbsp-mode","-webkit-print-color-adjust","-webkit-rtl-ordering","-webkit-text-combine","-webkit-text-decorations-in-effect","-webkit-text-emphasis","-webkit-text-emphasis-color","-webkit-text-emphasis-position","-webkit-text-emphasis-style","-webkit-text-fill-color","-webkit-text-orientation","-webkit-text-security","-webkit-text-size-adjust","-webkit-text-stroke","-webkit-text-stroke-color","-webkit-text-stroke-width","-webkit-user-modify","-webkit-user-select","-webkit-writing-mode","-webkit-cursor-visibility","image-orientation","image-resolution","overflow-wrap","-webkit-text-align-last","-webkit-text-justify","-webkit-ruby-position","-webkit-text-decoration-line","font-synthesis","-webkit-overflow-scrolling","-webkit-touch-callout","-webkit-tap-highlight-color"].keySet();WebInspector.CSSKeywordCompletions._colors=["aqua","black","blue","fuchsia","gray","green","lime","maroon","navy","olive","orange","purple","red","silver","teal","white","yellow","transparent","currentcolor","grey","aliceblue","antiquewhite","aquamarine","azure","beige","bisque","blanchedalmond","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","gainsboro","ghostwhite","gold","goldenrod","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","limegreen","linen","magenta","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","oldlace","olivedrab","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","rebeccapurple","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","thistle","tomato","turquoise","violet","wheat","whitesmoke","yellowgreen","rgb()","rgba()","hsl()","hsla()"];WebInspector.CSSKeywordCompletions._colorAwareProperties=["background","background-color","background-image","border","border-color","border-top","border-right","border-bottom","border-left","border-top-color","border-right-color","border-bottom-color","border-left-color","box-shadow","color","fill","outline","outline-color","stroke","text-line-through","text-line-through-color","text-overline","text-overline-color","text-shadow","text-underline","text-underline-color","-webkit-box-shadow","-webkit-column-rule","-webkit-column-rule-color","-webkit-text-emphasis","-webkit-text-emphasis-color","-webkit-text-fill-color","-webkit-text-stroke","-webkit-text-stroke-color","-webkit-text-decoration-color","-webkit-tap-highlight-color"].keySet();WebInspector.CSSKeywordCompletions._propertyKeywordMap={"table-layout":["auto","fixed"],"visibility":["hidden","visible","collapse"],"text-underline":["none","dotted","dashed","solid","double","dot-dash","dot-dot-dash","wave"],"content":["list-item","close-quote","no-close-quote","no-open-quote","open-quote","attr()","counter()","counters()","url()","linear-gradient()","radial-gradient()","repeating-linear-gradient()","repeating-radial-gradient()","-webkit-canvas()","cross-fade()","image-set()"],"list-style-image":["none","url()","linear-gradient()","radial-gradient()","repeating-linear-gradient()","repeating-radial-gradient()","-webkit-canvas()","cross-fade()","image-set()"],"clear":["none","left","right","both"],"fill-rule":["nonzero","evenodd"],"stroke-linecap":["butt","round","square"],"stroke-linejoin":["round","miter","bevel"],"baseline-shift":["baseline","sub","super"],"border-bottom-width":["medium","thick","thin","calc()"],"margin-top-collapse":["collapse","separate","discard"],"-webkit-box-orient":["horizontal","vertical","inline-axis","block-axis"],"font-stretch":["normal","wider","narrower","ultra-condensed","extra-condensed","condensed","semi-condensed","semi-expanded","expanded","extra-expanded","ultra-expanded"],"font-optical-sizing":["auto","none",],"-webkit-color-correction":["default","srgb"],"border-left-width":["medium","thick","thin","calc()"],"-webkit-writing-mode":["lr","rl","tb","lr-tb","rl-tb","tb-rl","horizontal-tb","vertical-rl","vertical-lr","horizontal-bt"],"text-line-through-mode":["continuous","skip-white-space"],"text-overline-mode":["continuous","skip-white-space"],"text-underline-mode":["continuous","skip-white-space"],"text-line-through-style":["none","dotted","dashed","solid","double","dot-dash","dot-dot-dash","wave"],"text-overline-style":["none","dotted","dashed","solid","double","dot-dash","dot-dot-dash","wave"],"text-underline-style":["none","dotted","dashed","solid","double","dot-dash","dot-dot-dash","wave"],"border-collapse":["collapse","separate"],"border-top-width":["medium","thick","thin","calc()"],"outline-color":["invert","-webkit-focus-ring-color"],"outline-style":["none","hidden","inset","groove","ridge","outset","dotted","dashed","solid","double","auto"],"cursor":["auto","default","none","context-menu","help","pointer","progress","wait","cell","crosshair","text","vertical-text","alias","copy","move","no-drop","not-allowed","grab","grabbing","e-resize","n-resize","ne-resize","nw-resize","s-resize","se-resize","sw-resize","w-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","col-resize","row-resize","all-scroll","zoom-in","zoom-out","-webkit-grab","-webkit-grabbing","-webkit-zoom-in","-webkit-zoom-out","url()","image-set()"],"border-width":["medium","thick","thin","calc()"],"size":["a3","a4","a5","b4","b5","landscape","ledger","legal","letter","portrait"],"background":["none","url()","linear-gradient()","radial-gradient()","repeating-linear-gradient()","repeating-radial-gradient()","-webkit-canvas()","cross-fade()","image-set()","repeat","repeat-x","repeat-y","no-repeat","space","round","scroll","fixed","local","auto","contain","cover","top","right","left","bottom","center","border-box","padding-box","content-box"],"background-image":["none","url()","linear-gradient()","radial-gradient()","repeating-linear-gradient()","repeating-radial-gradient()","-webkit-canvas()","cross-fade()","image-set()"],"background-size":["auto","contain","cover"],"background-attachment":["scroll","fixed","local"],"background-repeat":["repeat","repeat-x","repeat-y","no-repeat","space","round"],"background-blend-mode":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],"background-position":["top","right","left","bottom","center"],"background-origin":["border-box","padding-box","content-box"],"background-clip":["border-box","padding-box","content-box"],"direction":["ltr","rtl"],"enable-background":["accumulate","new"],"float":["none","left","right"],"hanging-punctuation":["none","first","last","allow-end","force-end"],"overflow-x":["hidden","auto","visible","overlay","scroll","marquee"],"overflow-y":["hidden","auto","visible","overlay","scroll","marquee","-webkit-paged-x","-webkit-paged-y"],"overflow":["hidden","auto","visible","overlay","scroll","marquee","-webkit-paged-x","-webkit-paged-y"],"margin-bottom-collapse":["collapse","separate","discard"],"-webkit-box-reflect":["none","left","right","above","below"],"text-rendering":["auto","optimizeSpeed","optimizeLegibility","geometricPrecision"],"text-align":["-webkit-auto","left","right","center","justify","-webkit-left","-webkit-right","-webkit-center","-webkit-match-parent","start","end"],"list-style-position":["outside","inside"],"margin-bottom":["auto"],"color-interpolation":["linearrgb"],"word-wrap":["normal","break-word"],"font-weight":["normal","bold","bolder","lighter","100","200","300","400","500","600","700","800","900"],"font-synthesis":["none","weight","style"],"margin-before-collapse":["collapse","separate","discard"],"text-overline-width":["normal","medium","auto","thick","thin","calc()"],"text-transform":["none","capitalize","uppercase","lowercase"],"border-right-style":["none","hidden","inset","groove","ridge","outset","dotted","dashed","solid","double"],"border-left-style":["none","hidden","inset","groove","ridge","outset","dotted","dashed","solid","double"],"font-style":["italic","oblique","normal"],"speak":["none","normal","spell-out","digits","literal-punctuation","no-punctuation"],"text-line-through":["none","dotted","dashed","solid","double","dot-dash","dot-dot-dash","wave","continuous","skip-white-space"],"color-rendering":["auto","optimizeSpeed","optimizeQuality"],"list-style-type":["none","disc","circle","square","decimal","decimal-leading-zero","arabic-indic","binary","bengali","cambodian","khmer","devanagari","gujarati","gurmukhi","kannada","lower-hexadecimal","lao","malayalam","mongolian","myanmar","octal","oriya","persian","urdu","telugu","tibetan","thai","upper-hexadecimal","lower-roman","upper-roman","lower-greek","lower-alpha","lower-latin","upper-alpha","upper-latin","afar","ethiopic-halehame-aa-et","ethiopic-halehame-aa-er","amharic","ethiopic-halehame-am-et","amharic-abegede","ethiopic-abegede-am-et","cjk-earthly-branch","cjk-heavenly-stem","ethiopic","ethiopic-halehame-gez","ethiopic-abegede","ethiopic-abegede-gez","hangul-consonant","hangul","lower-norwegian","oromo","ethiopic-halehame-om-et","sidama","ethiopic-halehame-sid-et","somali","ethiopic-halehame-so-et","tigre","ethiopic-halehame-tig","tigrinya-er","ethiopic-halehame-ti-er","tigrinya-er-abegede","ethiopic-abegede-ti-er","tigrinya-et","ethiopic-halehame-ti-et","tigrinya-et-abegede","ethiopic-abegede-ti-et","upper-greek","upper-norwegian","asterisks","footnotes","hebrew","armenian","lower-armenian","upper-armenian","georgian","cjk-ideographic","hiragana","katakana","hiragana-iroha","katakana-iroha"],"-webkit-text-combine":["none","horizontal"],"outline":["none","hidden","inset","groove","ridge","outset","dotted","dashed","solid","double"],"font":["caption","icon","menu","message-box","small-caption","-webkit-mini-control","-webkit-small-control","-webkit-control","status-bar","italic","oblique","small-caps","normal","bold","bolder","lighter","100","200","300","400","500","600","700","800","900","xx-small","x-small","small","medium","large","x-large","xx-large","-webkit-xxx-large","smaller","larger","serif","sans-serif","cursive","fantasy","monospace","-webkit-body","-webkit-pictograph","-apple-system","-apple-system-headline","-apple-system-body","-apple-system-subheadline","-apple-system-footnote","-apple-system-caption1","-apple-system-caption2","-apple-system-short-headline","-apple-system-short-body","-apple-system-short-subheadline","-apple-system-short-footnote","-apple-system-short-caption1","-apple-system-tall-body","-apple-system-title0","-apple-system-title1","-apple-system-title2","-apple-system-title3","-apple-system-title4","system-ui"],"dominant-baseline":["middle","auto","central","text-before-edge","text-after-edge","ideographic","alphabetic","hanging","mathematical","use-script","no-change","reset-size"],"display":["none","inline","block","list-item","compact","inline-block","table","inline-table","table-row-group","table-header-group","table-footer-group","table-row","table-column-group","table-column","table-cell","table-caption","-webkit-box","-webkit-inline-box","-wap-marquee","flex","inline-flex","grid","inline-grid"],"image-rendering":["auto","optimizeSpeed","optimizeQuality","-webkit-crisp-edges","-webkit-optimize-contrast","crisp-edges","pixelated"],"alignment-baseline":["baseline","middle","auto","before-edge","after-edge","central","text-before-edge","text-after-edge","ideographic","alphabetic","hanging","mathematical"],"outline-width":["medium","thick","thin","calc()"],"text-line-through-width":["normal","medium","auto","thick","thin"],"box-align":["baseline","center","stretch","start","end"],"box-shadow":["none"],"text-shadow":["none"],"-webkit-box-shadow":["none"],"border-right-width":["medium","thick","thin"],"border-top-style":["none","hidden","inset","groove","ridge","outset","dotted","dashed","solid","double"],"line-height":["normal"],"counter-increment":["none"],"counter-reset":["none"],"text-overflow":["clip","ellipsis"],"-webkit-box-direction":["normal","reverse"],"margin-after-collapse":["collapse","separate","discard"],"break-after":["left","right","recto","verso","auto","avoid","page","column","region","avoid-page","avoid-column","avoid-region"],"break-before":["left","right","recto","verso","auto","avoid","page","column","region","avoid-page","avoid-column","avoid-region"],"break-inside":["auto","avoid","avoid-page","avoid-column","avoid-region"],"page-break-after":["left","right","auto","always","avoid"],"page-break-before":["left","right","auto","always","avoid"],"page-break-inside":["auto","avoid"],"-webkit-column-break-after":["left","right","auto","always","avoid"],"-webkit-column-break-before":["left","right","auto","always","avoid"],"-webkit-column-break-inside":["auto","avoid"],"-webkit-hyphens":["none","auto","manual"],"border-image":["repeat","stretch","url()","linear-gradient()","radial-gradient()","repeating-linear-gradient()","repeating-radial-gradient()","-webkit-canvas()","cross-fade()","image-set()"],"border-image-repeat":["repeat","stretch","space","round"],"-webkit-mask-box-image-repeat":["repeat","stretch","space","round"],"position":["absolute","fixed","relative","static","-webkit-sticky"],"font-family":["serif","sans-serif","cursive","fantasy","monospace","-webkit-body","-webkit-pictograph","-apple-system","-apple-system-headline","-apple-system-body","-apple-system-subheadline","-apple-system-footnote","-apple-system-caption1","-apple-system-caption2","-apple-system-short-headline","-apple-system-short-body","-apple-system-short-subheadline","-apple-system-short-footnote","-apple-system-short-caption1","-apple-system-tall-body","-apple-system-title0","-apple-system-title1","-apple-system-title2","-apple-system-title3","-apple-system-title4","system-ui"],"text-overflow-mode":["clip","ellipsis"],"border-bottom-style":["none","hidden","inset","groove","ridge","outset","dotted","dashed","solid","double"],"unicode-bidi":["normal","bidi-override","embed","plaintext","isolate","isolate-override"],"clip-rule":["nonzero","evenodd"],"margin-left":["auto"],"margin-top":["auto"],"zoom":["normal","document","reset"],"z-index":["auto"],"width":["intrinsic","min-intrinsic","-webkit-min-content","-webkit-max-content","-webkit-fill-available","-webkit-fit-content","calc()"],"height":["intrinsic","min-intrinsic","calc()"],"max-width":["none","intrinsic","min-intrinsic","-webkit-min-content","-webkit-max-content","-webkit-fill-available","-webkit-fit-content","calc()"],"min-width":["intrinsic","min-intrinsic","-webkit-min-content","-webkit-max-content","-webkit-fill-available","-webkit-fit-content","calc()"],"max-height":["none","intrinsic","min-intrinsic","calc()"],"min-height":["intrinsic","min-intrinsic","calc()"],"-webkit-logical-width":["intrinsic","min-intrinsic","-webkit-min-content","-webkit-max-content","-webkit-fill-available","-webkit-fit-content","calc()"],"-webkit-logical-height":["intrinsic","min-intrinsic","calc()"],"-webkit-max-logical-width":["none","intrinsic","min-intrinsic","-webkit-min-content","-webkit-max-content","-webkit-fill-available","-webkit-fit-content","calc()"],"-webkit-min-logical-width":["intrinsic","min-intrinsic","-webkit-min-content","-webkit-max-content","-webkit-fill-available","-webkit-fit-content","calc()"],"-webkit-max-logical-height":["none","intrinsic","min-intrinsic","calc()"],"-webkit-min-logical-height":["intrinsic","min-intrinsic","calc()"],"empty-cells":["hide","show"],"pointer-events":["none","all","auto","visible","visiblepainted","visiblefill","visiblestroke","painted","fill","stroke"],"letter-spacing":["normal","calc()"],"word-spacing":["normal","calc()"],"-webkit-font-kerning":["auto","normal","none"],"-webkit-font-smoothing":["none","auto","antialiased","subpixel-antialiased"],"border":["none","hidden","inset","groove","ridge","outset","dotted","dashed","solid","double"],"font-size":["xx-small","x-small","small","medium","large","x-large","xx-large","-webkit-xxx-large","smaller","larger"],"font-variant":["small-caps","normal"],"font-variant-numeric":["normal","ordinal","slashed-zero","lining-nums","oldstyle-nums","proportional-nums","tabular-nums","diagonal-fractions","stacked-fractions"],"vertical-align":["baseline","middle","sub","super","text-top","text-bottom","top","bottom","-webkit-baseline-middle"],"white-space":["normal","nowrap","pre","pre-line","pre-wrap"],"word-break":["normal","break-all","break-word"],"text-underline-width":["normal","medium","auto","thick","thin","calc()"],"text-indent":["-webkit-each-line","-webkit-hanging"],"-webkit-box-lines":["single","multiple"],"clip":["auto","rect()"],"clip-path":["none","url()","circle()","ellipse()","inset()","polygon()","margin-box","border-box","padding-box","content-box"],"shape-outside":["none","url()","circle()","ellipse()","inset()","polygon()","margin-box","border-box","padding-box","content-box"],"orphans":["auto"],"widows":["auto"],"margin":["auto"],"page":["auto"],"perspective":["none"],"perspective-origin":["none","left","right","bottom","top","center"],"-webkit-marquee-increment":["small","large","medium"],"-webkit-marquee-direction":["left","right","auto","reverse","forwards","backwards","ahead","up","down"],"-webkit-marquee-style":["none","scroll","slide","alternate"],"-webkit-marquee-repetition":["infinite"],"-webkit-marquee-speed":["normal","slow","fast"],"margin-right":["auto"],"marquee-speed":["normal","slow","fast"],"-webkit-text-emphasis":["circle","filled","open","dot","double-circle","triangle","sesame"],"-webkit-text-emphasis-style":["circle","filled","open","dot","double-circle","triangle","sesame"],"-webkit-text-emphasis-position":["over","under","left","right"],"transform":["none","scale()","scaleX()","scaleY()","scale3d()","rotate()","rotateX()","rotateY()","rotateZ()","rotate3d()","skew()","skewX()","skewY()","translate()","translateX()","translateY()","translateZ()","translate3d()","matrix()","matrix3d()","perspective()"],"transform-style":["flat","preserve-3d"],"-webkit-cursor-visibility":["auto","auto-hide"],"text-decoration":["none","underline","overline","line-through","blink"],"-webkit-text-decorations-in-effect":["none","underline","overline","line-through","blink"],"-webkit-text-decoration-line":["none","underline","overline","line-through","blink"],"-webkit-text-decoration-style":["solid","double","dotted","dashed","wavy"],"-webkit-text-decoration-skip":["auto","none","objects","ink"],"-webkit-text-underline-position":["auto","alphabetic","under"],"image-resolution":["from-image","snap"],"-webkit-blend-mode":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","plus-darker","plus-lighter","hue","saturation","color","luminosity",],"mix-blend-mode":["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","plus-darker","plus-lighter","hue","saturation","color","luminosity",],"mix":["auto","normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","plus-darker","plus-lighter","hue","saturation","color","luminosity","clear","copy","destination","source-over","destination-over","source-in","destination-in","source-out","destination-out","source-atop","destination-atop","xor"],"geometry":["detached","attached","grid()"],"overflow-wrap":["normal","break-word"],"transition":["none","ease","linear","ease-in","ease-out","ease-in-out","step-start","step-end","steps()","cubic-bezier()","spring()","all",WebInspector.CSSKeywordCompletions.AllPropertyNamesPlaceholder],"transition-timing-function":["ease","linear","ease-in","ease-out","ease-in-out","step-start","step-end","steps()","cubic-bezier()","spring()"],"transition-property":["all","none",WebInspector.CSSKeywordCompletions.AllPropertyNamesPlaceholder],"-webkit-column-progression":["normal","reverse"],"-webkit-box-decoration-break":["slice","clone"],"align-content":["auto","baseline","last-baseline","space-between","space-around","space-evenly","stretch","center","start","end","flex-start","flex-end","left","right","true","safe"],"justify-content":["auto","baseline","last-baseline","space-between","space-around","space-evenly","stretch","center","start","end","flex-start","flex-end","left","right","true","safe"],"align-items":["auto","stretch","baseline","last-baseline","center","start","end","self-start","self-end","flex-start","flex-end","left","right","true","safe"],"align-self":["auto","stretch","baseline","last-baseline","center","start","end","self-start","self-end","flex-start","flex-end","left","right","true","safe"],"justify-items":["auto","stretch","baseline","last-baseline","center","start","end","self-start","self-end","flex-start","flex-end","left","right","true","safe"],"justify-self":["auto","stretch","baseline","last-baseline","center","start","end","self-start","self-end","flex-start","flex-end","left","right","true","safe"],"flex-direction":["row","row-reverse","column","column-reverse"],"flex-wrap":["nowrap","wrap","wrap-reverse"],"flex-flow":["row","row-reverse","column","column-reverse","nowrap","wrap","wrap-reverse"],"flex":["none"],"flex-basis":["auto"],"grid":["none"],"grid-area":["auto"],"grid-auto-columns":["auto","-webkit-max-content","-webkit-min-content","minmax()",],"grid-auto-flow":["row","column","dense"],"grid-auto-rows":["auto","-webkit-max-content","-webkit-min-content","minmax()",],"grid-column":["auto"],"grid-column-start":["auto"],"grid-column-end":["auto"],"grid-row":["auto"],"grid-row-start":["auto"],"grid-row-end":["auto"],"grid-template":["none"],"grid-template-areas":["none"],"grid-template-columns":["none","auto","-webkit-max-content","-webkit-min-content","minmax()","repeat()"],"grid-template-rows":["none","auto","-webkit-max-content","-webkit-min-content","minmax()","repeat()"],"-webkit-ruby-position":["after","before","inter-character"],"-webkit-text-align-last":["auto","start","end","left","right","center","justify"],"-webkit-text-justify":["auto","none","inter-word","inter-ideograph","inter-cluster","distribute","kashida"],"max-zoom":["auto"],"min-zoom":["auto"],"orientation":["auto","portait","landscape"],"scroll-snap-align":["none","start","center","end"],"scroll-snap-type":["none","mandatory","proximity","x","y","inline","block","both"],"user-zoom":["zoom","fixed"],"-webkit-app-region":["drag","no-drag"],"-webkit-line-break":["auto","loose","normal","strict","after-white-space"],"-webkit-background-composite":["clear","copy","source-over","source-in","source-out","source-atop","destination-over","destination-in","destination-out","destination-atop","xor","plus-darker","plus-lighter"],"-webkit-mask-composite":["clear","copy","source-over","source-in","source-out","source-atop","destination-over","destination-in","destination-out","destination-atop","xor","plus-darker","plus-lighter"],"-webkit-animation-direction":["normal","alternate","reverse","alternate-reverse"],"-webkit-animation-fill-mode":["none","forwards","backwards","both"],"-webkit-animation-iteration-count":["infinite"],"-webkit-animation-play-state":["paused","running"],"-webkit-animation-timing-function":["ease","linear","ease-in","ease-out","ease-in-out","step-start","step-end","steps()","cubic-bezier()","spring()"],"-webkit-column-span":["all","none","calc()"],"-webkit-region-break-after":["auto","always","avoid","left","right"],"-webkit-region-break-before":["auto","always","avoid","left","right"],"-webkit-region-break-inside":["auto","avoid"],"-webkit-region-overflow":["auto","break"],"-webkit-backface-visibility":["visible","hidden"],"resize":["none","both","horizontal","vertical","auto"],"caption-side":["top","bottom","left","right"],"box-sizing":["border-box","content-box"],"-webkit-alt":["attr()"],"-webkit-border-fit":["border","lines"],"-webkit-line-align":["none","edges"],"-webkit-line-snap":["none","baseline","contain"],"-webkit-nbsp-mode":["normal","space"],"-webkit-print-color-adjust":["exact","economy"],"-webkit-rtl-ordering":["logical","visual"],"-webkit-text-security":["disc","circle","square","none"],"-webkit-user-drag":["auto","none","element"],"-webkit-user-modify":["read-only","read-write","read-write-plaintext-only"],"-webkit-user-select":["auto","none","text","all"],"-webkit-text-stroke-width":["medium","thick","thin","calc()"],"-webkit-border-start-width":["medium","thick","thin","calc()"],"-webkit-border-end-width":["medium","thick","thin","calc()"],"-webkit-border-before-width":["medium","thick","thin","calc()"],"-webkit-border-after-width":["medium","thick","thin","calc()"],"-webkit-column-rule-width":["medium","thick","thin","calc()"],"-webkit-aspect-ratio":["auto","from-dimensions","from-intrinsic","/"],"filter":["none","grayscale()","sepia()","saturate()","hue-rotate()","invert()","opacity()","brightness()","contrast()","blur()","drop-shadow()","custom()"],"-webkit-backdrop-filter":["none","grayscale()","sepia()","saturate()","hue-rotate()","invert()","opacity()","brightness()","contrast()","blur()","drop-shadow()","custom()"],"-webkit-column-count":["auto","calc()"],"-webkit-column-gap":["normal","calc()"],"-webkit-column-axis":["horizontal","vertical","auto"],"-webkit-column-width":["auto","calc()"],"-webkit-column-fill":["auto","balance"],"-webkit-hyphenate-character":["none"],"-webkit-hyphenate-limit-after":["auto"],"-webkit-hyphenate-limit-before":["auto"],"-webkit-hyphenate-limit-lines":["no-limit"],"-webkit-line-grid":["none"],"-webkit-locale":["auto"],"-webkit-text-orientation":["sideways","sideways-right","vertical-right","upright"],"-webkit-line-box-contain":["block","inline","font","glyphs","replaced","inline-box","none"],"font-feature-settings":["normal"],"-webkit-font-variant-ligatures":["normal","common-ligatures","no-common-ligatures","discretionary-ligatures","no-discretionary-ligatures","historical-ligatures","no-historical-ligatures"],"-webkit-animation-trigger":["auto","container-scroll()"],"-webkit-text-size-adjust":["none","auto"],"-webkit-touch-callout":["default","none"],"-webkit-overflow-scrolling":["auto","touch"]};WebInspector.CSSMedia=class CSSMedia extends WebInspector.Object
{constructor(type,text,sourceCodeLocation)
{super();this._type=type||null;this._text=text||"";this._sourceCodeLocation=sourceCodeLocation||null;}
get type(){return this._type;}
get text(){return this._text;}
get sourceCodeLocation(){return this._sourceCodeLocation;}};WebInspector.CSSMedia.Type={MediaRule:"css-media-type-media-rule",ImportRule:"css-media-type-import-rule",LinkedStyleSheet:"css-media-type-linked-stylesheet",InlineStyleSheet:"css-media-type-inline-stylesheet"};WebInspector.CSSProperty=class CSSProperty extends WebInspector.Object
{constructor(index,text,name,value,priority,enabled,overridden,implicit,anonymous,valid,styleSheetTextRange)
{super();this._ownerStyle=null;this._index=index;this.update(text,name,value,priority,enabled,overridden,implicit,anonymous,valid,styleSheetTextRange,true);}
static isInheritedPropertyName(name)
{if(name in WebInspector.CSSKeywordCompletions.InheritedProperties)
return true;return name.startsWith("--");}
get ownerStyle()
{return this._ownerStyle;}
set ownerStyle(ownerStyle)
{this._ownerStyle=ownerStyle||null;}
get index()
{return this._index;}
set index(index)
{this._index=index;}
update(text,name,value,priority,enabled,overridden,implicit,anonymous,valid,styleSheetTextRange,dontFireEvents)
{text=text||"";name=name||"";value=value||"";priority=priority||"";enabled=enabled||false;overridden=overridden||false;implicit=implicit||false;anonymous=anonymous||false;valid=valid||false;var changed=false;if(!dontFireEvents){changed=this._name!==name||this._value!==value||this._priority!==priority||this._enabled!==enabled||this._implicit!==implicit||this._anonymous!==anonymous||this._valid!==valid;}
if(!dontFireEvents)
this.overridden=overridden;else
this._overridden=overridden;this._text=text;this._name=name;this._value=value;this._priority=priority;this._enabled=enabled;this._implicit=implicit;this._anonymous=anonymous;this._inherited=WebInspector.CSSProperty.isInheritedPropertyName(name);this._valid=valid;this._variable=name.startsWith("--");this._styleSheetTextRange=styleSheetTextRange||null;this._relatedShorthandProperty=null;this._relatedLonghandProperties=[];delete this._styleDeclarationTextRange;delete this._canonicalName;delete this._hasOtherVendorNameOrKeyword;if(changed)
this.dispatchEventToListeners(WebInspector.CSSProperty.Event.Changed);}
get synthesizedText()
{var name=this.name;if(!name)
return"";var priority=this.priority;return name+": "+this.value.trim()+(priority?" !"+priority:"")+";";}
get text()
{return this._text||this.synthesizedText;}
get name(){return this._name;}
get canonicalName()
{if(this._canonicalName)
return this._canonicalName;this._canonicalName=WebInspector.cssStyleManager.canonicalNameForPropertyName(this.name);return this._canonicalName;}
get value(){return this._value;}
get important()
{return this.priority==="important";}
get priority(){return this._priority;}
get enabled()
{return this._enabled&&this._ownerStyle&&(!isNaN(this._index)||this._ownerStyle.type===WebInspector.CSSStyleDeclaration.Type.Computed);}
get overridden(){return this._overridden;}
set overridden(overridden)
{overridden=overridden||false;if(this._overridden===overridden)
return;var previousOverridden=this._overridden;this._overridden=overridden;if(this._overriddenStatusChangedTimeout)
return;function delayed()
{delete this._overriddenStatusChangedTimeout;if(this._overridden===previousOverridden)
return;this.dispatchEventToListeners(WebInspector.CSSProperty.Event.OverriddenStatusChanged);}
this._overriddenStatusChangedTimeout=setTimeout(delayed.bind(this),0);}
get implicit(){return this._implicit;}
set implicit(implicit){this._implicit=implicit;}
get anonymous(){return this._anonymous;}
get inherited(){return this._inherited;}
get valid(){return this._valid;}
get variable(){return this._variable;}
get styleSheetTextRange(){return this._styleSheetTextRange;}
get styleDeclarationTextRange()
{if("_styleDeclarationTextRange"in this)
return this._styleDeclarationTextRange;if(!this._ownerStyle||!this._styleSheetTextRange)
return null;var styleTextRange=this._ownerStyle.styleSheetTextRange;if(!styleTextRange)
return null;var startLine=this._styleSheetTextRange.startLine-styleTextRange.startLine;var endLine=this._styleSheetTextRange.endLine-styleTextRange.startLine;var startColumn=this._styleSheetTextRange.startColumn;if(!startLine)
startColumn-=styleTextRange.startColumn;var endColumn=this._styleSheetTextRange.endColumn;if(!endLine)
endColumn-=styleTextRange.startColumn;this._styleDeclarationTextRange=new WebInspector.TextRange(startLine,startColumn,endLine,endColumn);return this._styleDeclarationTextRange;}
get relatedShorthandProperty(){return this._relatedShorthandProperty;}
set relatedShorthandProperty(property)
{this._relatedShorthandProperty=property||null;}
get relatedLonghandProperties(){return this._relatedLonghandProperties;}
addRelatedLonghandProperty(property)
{this._relatedLonghandProperties.push(property);}
clearRelatedLonghandProperties(property)
{this._relatedLonghandProperties=[];}
hasOtherVendorNameOrKeyword()
{if("_hasOtherVendorNameOrKeyword"in this)
return this._hasOtherVendorNameOrKeyword;this._hasOtherVendorNameOrKeyword=WebInspector.cssStyleManager.propertyNameHasOtherVendorPrefix(this.name)||WebInspector.cssStyleManager.propertyValueHasOtherVendorKeyword(this.value);return this._hasOtherVendorNameOrKeyword;}};WebInspector.CSSProperty.Event={Changed:"css-property-changed",OverriddenStatusChanged:"css-property-overridden-status-changed"};WebInspector.CSSRule=class CSSRule extends WebInspector.Object
{constructor(nodeStyles,ownerStyleSheet,id,type,sourceCodeLocation,selectorText,selectors,matchedSelectorIndices,style,mediaList)
{super();this._nodeStyles=nodeStyles;this._ownerStyleSheet=ownerStyleSheet||null;this._id=id||null;this._type=type||null;this.update(sourceCodeLocation,selectorText,selectors,matchedSelectorIndices,style,mediaList,true);}
get id()
{return this._id;}
get ownerStyleSheet()
{return this._ownerStyleSheet;}
get editable()
{return!!this._id&&(this._type===WebInspector.CSSStyleSheet.Type.Author||this._type===WebInspector.CSSStyleSheet.Type.Inspector);}
update(sourceCodeLocation,selectorText,selectors,matchedSelectorIndices,style,mediaList,dontFireEvents)
{sourceCodeLocation=sourceCodeLocation||null;selectorText=selectorText||"";selectors=selectors||[];matchedSelectorIndices=matchedSelectorIndices||[];style=style||null;mediaList=mediaList||[];var changed=false;if(!dontFireEvents){changed=this._selectorText!==selectorText||!Array.shallowEqual(this._selectors,selectors)||!Array.shallowEqual(this._matchedSelectorIndices,matchedSelectorIndices)||this._style!==style||!!this._sourceCodeLocation!==!!sourceCodeLocation||this._mediaList.length!==mediaList.length;}
if(this._style)
this._style.ownerRule=null;this._sourceCodeLocation=sourceCodeLocation;this._selectorText=selectorText;this._selectors=selectors;this._matchedSelectorIndices=matchedSelectorIndices;this._mostSpecificSelector=null;this._style=style;this._mediaList=mediaList;this._matchedSelectors=null;this._matchedSelectorText=null;if(this._style)
this._style.ownerRule=this;if(changed)
this.dispatchEventToListeners(WebInspector.CSSRule.Event.Changed);}
get type()
{return this._type;}
get sourceCodeLocation()
{return this._sourceCodeLocation;}
get selectorText()
{return this._selectorText;}
set selectorText(selectorText)
{if(!this.editable)
return;if(this._selectorText===selectorText){this._selectorResolved(true);return;}
this._nodeStyles.changeRuleSelector(this,selectorText).then(this._selectorResolved.bind(this),this._selectorRejected.bind(this));}
get selectors()
{return this._selectors;}
get matchedSelectorIndices()
{return this._matchedSelectorIndices;}
get matchedSelectors()
{if(this._matchedSelectors)
return this._matchedSelectors;this._matchedSelectors=this._selectors.filter(function(element,index){return this._matchedSelectorIndices.includes(index);},this);return this._matchedSelectors;}
get matchedSelectorText()
{if("_matchedSelectorText"in this)
return this._matchedSelectorText;this._matchedSelectorText=this.matchedSelectors.map(function(x){return x.text;}).join(", ");return this._matchedSelectorText;}
hasMatchedPseudoElementSelector()
{if(this.nodeStyles&&this.nodeStyles.node&&this.nodeStyles.node.isPseudoElement())
return true;return this.matchedSelectors.some((selector)=>selector.isPseudoElementSelector());}
get style()
{return this._style;}
get mediaList()
{return this._mediaList;}
get mediaText()
{if(!this._mediaList.length)
return"";let mediaText="";for(let media of this._mediaList)
mediaText+=media.text;return mediaText;}
isEqualTo(rule)
{if(!rule)
return false;return Object.shallowEqual(this._id,rule.id);}
get mostSpecificSelector()
{if(!this._mostSpecificSelector)
this._mostSpecificSelector=this._determineMostSpecificSelector();return this._mostSpecificSelector;}
selectorIsGreater(otherSelector)
{var mostSpecificSelector=this.mostSpecificSelector;if(!mostSpecificSelector)
return false;return mostSpecificSelector.isGreaterThan(otherSelector);}
get nodeStyles()
{return this._nodeStyles;}
_determineMostSpecificSelector()
{if(!this._selectors||!this._selectors.length)
return null;var selectors=this.matchedSelectors;if(!selectors.length)
selectors=this._selectors;var specificSelector=selectors[0];for(var selector of selectors){if(selector.isGreaterThan(specificSelector))
specificSelector=selector;}
return specificSelector;}
_selectorRejected(error)
{this.dispatchEventToListeners(WebInspector.CSSRule.Event.SelectorChanged,{valid:!error});}
_selectorResolved(rulePayload)
{this.dispatchEventToListeners(WebInspector.CSSRule.Event.SelectorChanged,{valid:!!rulePayload});}};WebInspector.CSSRule.Event={Changed:"css-rule-changed",SelectorChanged:"css-rule-invalid-selector"};WebInspector.CSSSelector=class CSSSelector extends WebInspector.Object
{constructor(text,specificity,dynamic)
{super();this._text=text;this._specificity=specificity||null;this._dynamic=dynamic||false;}
get text(){return this._text;}
get specificity(){return this._specificity;}
get dynamic(){return this._dynamic;}
isGreaterThan(selector)
{if(!selector||!selector.specificity)
return true;for(var i=0;i<this._specificity.length;++i){if(this._specificity[i]===selector.specificity[i])
continue;return this._specificity[i]>selector.specificity[i];}
return false;}
isPseudoElementSelector()
{return WebInspector.CSSStyleManager.PseudoElementNames.some((name)=>this._text.includes(`:${name}`));}};WebInspector.CSSStyleDeclaration=class CSSStyleDeclaration extends WebInspector.Object
{constructor(nodeStyles,ownerStyleSheet,id,type,node,inherited,text,properties,styleSheetTextRange)
{super();this._nodeStyles=nodeStyles;this._ownerRule=null;this._ownerStyleSheet=ownerStyleSheet||null;this._id=id||null;this._type=type||null;this._node=node||null;this._inherited=inherited||false;this._pendingProperties=[];this._propertyNameMap={};this._initialText=text;this._hasModifiedInitialText=false;this.update(text,properties,styleSheetTextRange,true);}
get id()
{return this._id;}
get ownerStyleSheet()
{return this._ownerStyleSheet;}
get type()
{return this._type;}
get inherited()
{return this._inherited;}
get node()
{return this._node;}
get editable()
{if(!this._id)
return false;if(this._type===WebInspector.CSSStyleDeclaration.Type.Rule)
return this._ownerRule&&this._ownerRule.editable;if(this._type===WebInspector.CSSStyleDeclaration.Type.Inline)
return!this._node.isInUserAgentShadowTree();return false;}
update(text,properties,styleSheetTextRange,dontFireEvents)
{text=text||"";properties=properties||[];var oldProperties=this._properties||[];var oldText=this._text;this._text=text;this._properties=properties;this._styleSheetTextRange=styleSheetTextRange;this._propertyNameMap={};delete this._visibleProperties;var editable=this.editable;for(var i=0;i<this._properties.length;++i){var property=this._properties[i];property.ownerStyle=this;
if(!editable)
this._propertyNameMap[property.name]=property;else{this._pendingProperties.remove(property);}}
var removedProperties=[];for(var i=0;i<oldProperties.length;++i){var oldProperty=oldProperties[i];if(!this._properties.includes(oldProperty)){oldProperty.index=NaN;removedProperties.push(oldProperty);
if(editable)
this._pendingProperties.push(oldProperty);}}
if(dontFireEvents)
return;var addedProperties=[];for(var i=0;i<this._properties.length;++i){if(!oldProperties.includes(this._properties[i]))
addedProperties.push(this._properties[i]);}
if(oldText&&this._text&&oldText===this._text){if(!addedProperties.length&&!removedProperties.length)
return;}
function delayed()
{this.dispatchEventToListeners(WebInspector.CSSStyleDeclaration.Event.PropertiesChanged,{addedProperties,removedProperties});}
setTimeout(delayed.bind(this),0);}
get ownerRule()
{return this._ownerRule;}
set ownerRule(rule)
{this._ownerRule=rule||null;}
get text()
{return this._text;}
set text(text)
{if(this._text===text)
return;let trimmedText=WebInspector.CSSStyleDeclarationTextEditor.PrefixWhitespace+text.trim();if(this._text===trimmedText)
return;if(trimmedText===WebInspector.CSSStyleDeclarationTextEditor.PrefixWhitespace||this._type===WebInspector.CSSStyleDeclaration.Type.Inline)
text=trimmedText;let modified=text!==this._initialText;if(modified!==this._hasModifiedInitialText){this._hasModifiedInitialText=modified;this.dispatchEventToListeners(WebInspector.CSSStyleDeclaration.Event.InitialTextModified);}
this._nodeStyles.changeStyleText(this,text);}
resetText()
{this.text=this._initialText;}
get modified()
{return this._hasModifiedInitialText;}
get properties()
{return this._properties;}
get visibleProperties()
{if(this._visibleProperties)
return this._visibleProperties;this._visibleProperties=this._properties.filter(function(property){return!!property.styleDeclarationTextRange;});return this._visibleProperties;}
get pendingProperties()
{return this._pendingProperties;}
get styleSheetTextRange()
{return this._styleSheetTextRange;}
get mediaList()
{if(this._ownerRule)
return this._ownerRule.mediaList;return[];}
get selectorText()
{if(this._ownerRule)
return this._ownerRule.selectorText;return this._node.appropriateSelectorFor(true);}
propertyForName(name,dontCreateIfMissing)
{if(!name)
return null;if(!this.editable)
return this._propertyNameMap[name]||null;
function findMatch(properties)
{for(var i=0;i<properties.length;++i){var property=properties[i];if(property.canonicalName!==name&&property.name!==name)
continue;if(bestMatchProperty&&!bestMatchProperty.overridden&&property.overridden)
continue;bestMatchProperty=property;}}
var bestMatchProperty=null;findMatch(this._properties);if(bestMatchProperty)
return bestMatchProperty;if(dontCreateIfMissing||!this.editable)
return null;findMatch(this._pendingProperties,true);if(bestMatchProperty)
return bestMatchProperty;var newProperty=new WebInspector.CSSProperty(NaN,null,name);newProperty.ownerStyle=this;this._pendingProperties.push(newProperty);return newProperty;}
generateCSSRuleString()
{let indentString=WebInspector.indentString();let styleText="";let mediaList=this.mediaList;let mediaQueriesCount=mediaList.length;for(let i=mediaQueriesCount-1;i>=0;--i)
styleText+=indentString.repeat(mediaQueriesCount-i-1)+"@media "+mediaList[i].text+" {\n";styleText+=indentString.repeat(mediaQueriesCount)+this.selectorText+" {\n";for(let property of this._properties){if(property.anonymous)
continue;styleText+=indentString.repeat(mediaQueriesCount+1)+property.text.trim();if(!styleText.endsWith(";"))
styleText+=";";styleText+="\n";}
for(let i=mediaQueriesCount;i>0;--i)
styleText+=indentString.repeat(i)+"}\n";styleText+="}";return styleText;}
isInspectorRule()
{return this._ownerRule&&this._ownerRule.type===WebInspector.CSSStyleSheet.Type.Inspector;}
hasProperties()
{return!!this._properties.length;}
get nodeStyles()
{return this._nodeStyles;}};WebInspector.CSSStyleDeclaration.Event={PropertiesChanged:"css-style-declaration-properties-changed",InitialTextModified:"css-style-declaration-initial-text-modified"};WebInspector.CSSStyleDeclaration.Type={Rule:"css-style-declaration-type-rule",Inline:"css-style-declaration-type-inline",Attribute:"css-style-declaration-type-attribute",Computed:"css-style-declaration-type-computed"};WebInspector.CSSStyleSheet=class CSSStyleSheet extends WebInspector.SourceCode
{constructor(id)
{super();this._id=id||null;this._url=null;this._parentFrame=null;this._origin=null;this._startLineNumber=0;this._startColumnNumber=0;this._inlineStyleAttribute=false;this._inlineStyleTag=false;this._hasInfo=false;}
static resetUniqueDisplayNameNumbers()
{WebInspector.CSSStyleSheet._nextUniqueDisplayNameNumber=1;}
get id()
{return this._id;}
get parentFrame()
{return this._parentFrame;}
get origin()
{return this._origin;}
get url()
{return this._url;}
get urlComponents()
{if(!this._urlComponents)
this._urlComponents=parseURL(this._url);return this._urlComponents;}
get mimeType()
{return"text/css";}
get displayName()
{if(this._url)
return WebInspector.displayNameForURL(this._url,this.urlComponents);if(!this._uniqueDisplayNameNumber)
this._uniqueDisplayNameNumber=this.constructor._nextUniqueDisplayNameNumber++;return WebInspector.UIString("Anonymous StyleSheet %d").format(this._uniqueDisplayNameNumber);}
get startLineNumber()
{return this._startLineNumber;}
get startColumnNumber()
{return this._startColumnNumber;}
hasInfo()
{return this._hasInfo;}
isInspectorStyleSheet()
{return this._origin===WebInspector.CSSStyleSheet.Type.Inspector;}
isInlineStyleTag()
{return this._inlineStyleTag;}
isInlineStyleAttributeStyleSheet()
{return this._inlineStyleAttribute;}
markAsInlineStyleAttributeStyleSheet()
{this._inlineStyleAttribute=true;}
offsetSourceCodeLocation(sourceCodeLocation)
{if(!sourceCodeLocation)
return null;if(!this._hasInfo)
return sourceCodeLocation;let sourceCode=sourceCodeLocation.sourceCode;let lineNumber=this._startLineNumber+sourceCodeLocation.lineNumber;let columnNumber=this._startColumnNumber+sourceCodeLocation.columnNumber;return sourceCode.createSourceCodeLocation(lineNumber,columnNumber);}
updateInfo(url,parentFrame,origin,inlineStyle,startLineNumber,startColumnNumber)
{this._hasInfo=true;this._url=url||null;this._urlComponents=undefined;this._parentFrame=parentFrame||null;this._origin=origin;this._inlineStyleTag=inlineStyle;this._startLineNumber=startLineNumber;this._startColumnNumber=startColumnNumber;}
get revisionForRequestedContent()
{return this.currentRevision;}
handleCurrentRevisionContentChange()
{if(!this._id)
return;function contentDidChange(error)
{if(error)
return;DOMAgent.markUndoableState();this.dispatchEventToListeners(WebInspector.CSSStyleSheet.Event.ContentDidChange);}
this._ignoreNextContentDidChangeNotification=true;CSSAgent.setStyleSheetText(this._id,this.currentRevision.content,contentDidChange.bind(this));}
requestContentFromBackend()
{if(!this._id){
return Promise.reject(new Error("There is no identifier to request content with."));}
return CSSAgent.getStyleSheetText(this._id);}
noteContentDidChange()
{if(this._ignoreNextContentDidChangeNotification){this._ignoreNextContentDidChangeNotification=false;return false;}
this.markContentAsStale();this.dispatchEventToListeners(WebInspector.CSSStyleSheet.Event.ContentDidChange);return true;}};WebInspector.CSSStyleSheet._nextUniqueDisplayNameNumber=1;WebInspector.CSSStyleSheet.Event={ContentDidChange:"stylesheet-content-did-change"};WebInspector.CSSStyleSheet.Type={Author:"css-stylesheet-type-author",User:"css-stylesheet-type-user",UserAgent:"css-stylesheet-type-user-agent",Inspector:"css-stylesheet-type-inspector"};WebInspector.CallFrame=class CallFrame extends WebInspector.Object
{constructor(target,id,sourceCodeLocation,functionName,thisObject,scopeChain,nativeCode,programCode,isTailDeleted)
{super();this._isConsoleEvaluation=sourceCodeLocation&&isWebInspectorConsoleEvaluationScript(sourceCodeLocation.sourceCode.sourceURL);if(this._isConsoleEvaluation){functionName=WebInspector.UIString("Console Evaluation");programCode=true;}
this._target=target;this._id=id||null;this._sourceCodeLocation=sourceCodeLocation||null;this._functionName=functionName||"";this._thisObject=thisObject||null;this._scopeChain=scopeChain||[];this._nativeCode=nativeCode||false;this._programCode=programCode||false;this._isTailDeleted=isTailDeleted||false;}
get target(){return this._target;}
get id(){return this._id;}
get sourceCodeLocation(){return this._sourceCodeLocation;}
get functionName(){return this._functionName;}
get nativeCode(){return this._nativeCode;}
get programCode(){return this._programCode;}
get thisObject(){return this._thisObject;}
get scopeChain(){return this._scopeChain;}
get isTailDeleted(){return this._isTailDeleted;}
get isConsoleEvaluation(){return this._isConsoleEvaluation;}
saveIdentityToCookie()
{
}
collectScopeChainVariableNames(callback)
{var result={this:true,__proto__:null};var pendingRequests=this._scopeChain.length;function propertiesCollected(properties)
{for(var i=0;properties&&i<properties.length;++i)
result[properties[i].name]=true;if(--pendingRequests)
return;callback(result);}
for(var i=0;i<this._scopeChain.length;++i)
this._scopeChain[i].objects[0].deprecatedGetAllProperties(propertiesCollected);}
mergedScopeChain()
{let mergedScopes=[];
let scopes=this._scopeChain.slice();
let lastMarkedHash=null;function markAsBaseIfNeeded(scope){if(!scope.hash)
return false;if(scope.type!==WebInspector.ScopeChainNode.Type.Closure)
return false;if(scope.hash===lastMarkedHash)
return false;lastMarkedHash=scope.hash;scope.__baseClosureScope=true;return true;}
function shouldMergeClosureScopes(youngScope,oldScope,lastMerge){if(!youngScope||!oldScope)
return false;if(!youngScope.hash||!oldScope.hash)
return false;if(youngScope.type!==WebInspector.ScopeChainNode.Type.Closure)
return false;if(oldScope.type!==WebInspector.ScopeChainNode.Type.Closure)
return false;if(youngScope.hash!==oldScope.hash)
return false;if(lastMerge&&youngScope.hash===lastMerge.hash)
return false;return true;}
let lastScope=null;let lastMerge=null;for(let i=scopes.length-1;i>=0;--i){let scope=scopes[i];markAsBaseIfNeeded(scope);if(shouldMergeClosureScopes(scope,lastScope,lastMerge)){let type=WebInspector.ScopeChainNode.Type.Closure;let objects=lastScope.objects.concat(scope.objects);let merged=new WebInspector.ScopeChainNode(type,objects,scope.name,scope.location);merged.__baseClosureScope=true;mergedScopes.pop();mergedScopes.push(merged);lastMerge=merged;lastScope=null;}else{mergedScopes.push(scope);lastMerge=null;lastScope=scope;}}
mergedScopes=mergedScopes.reverse();for(let scope of mergedScopes){if(scope.type===WebInspector.ScopeChainNode.Type.Closure){if(scope.name===this._functionName)
scope.convertToLocalScope();break;}}
return mergedScopes;}
static functionNameFromPayload(payload)
{let functionName=payload.functionName;if(functionName==="global code")
return WebInspector.UIString("Global Code");if(functionName==="eval code")
return WebInspector.UIString("Eval Code");if(functionName==="module code")
return WebInspector.UIString("Module Code");return functionName;}
static programCodeFromPayload(payload)
{return payload.functionName.endsWith(" code");}
static fromDebuggerPayload(target,payload,scopeChain,sourceCodeLocation)
{let id=payload.callFrameId;let thisObject=WebInspector.RemoteObject.fromPayload(payload.this,target);let functionName=WebInspector.CallFrame.functionNameFromPayload(payload);let nativeCode=false;let programCode=WebInspector.CallFrame.programCodeFromPayload(payload);let isTailDeleted=payload.isTailDeleted;return new WebInspector.CallFrame(target,id,sourceCodeLocation,functionName,thisObject,scopeChain,nativeCode,programCode,isTailDeleted);}
static fromPayload(target,payload)
{let{url,scriptId}=payload;let nativeCode=false;let sourceCodeLocation=null;let functionName=WebInspector.CallFrame.functionNameFromPayload(payload);let programCode=WebInspector.CallFrame.programCodeFromPayload(payload);if(url==="[native code]"){nativeCode=true;url=null;}else if(url||scriptId){let sourceCode=null;if(scriptId){sourceCode=WebInspector.debuggerManager.scriptForIdentifier(scriptId,target);if(sourceCode&&sourceCode.resource)
sourceCode=sourceCode.resource;}
if(!sourceCode)
sourceCode=WebInspector.frameResourceManager.resourceForURL(url);if(!sourceCode)
sourceCode=WebInspector.debuggerManager.scriptsForURL(url,target)[0];if(sourceCode){let lineNumber=payload.lineNumber-1;sourceCodeLocation=sourceCode.createLazySourceCodeLocation(lineNumber,payload.columnNumber);}else{nativeCode=true;url=null;}}
const id=null;const thisObject=null;const scopeChain=null;const isTailDeleted=false;return new WebInspector.CallFrame(target,id,sourceCodeLocation,functionName,thisObject,scopeChain,nativeCode,programCode,isTailDeleted);}};WebInspector.Canvas=class Canvas extends WebInspector.Object
{constructor(identifier,contextType,frame,{domNode,cssCanvasName,contextAttributes,memoryCost}={})
{super();this._identifier=identifier;this._contextType=contextType;this._frame=frame;this._domNode=domNode||null;this._cssCanvasName=cssCanvasName||"";this._contextAttributes=contextAttributes||{};this._memoryCost=memoryCost||NaN;this._cssCanvasClientNodes=null;}
static fromPayload(payload)
{let contextType=null;switch(payload.contextType){case CanvasAgent.ContextType.Canvas2D:contextType=WebInspector.Canvas.ContextType.Canvas2D;break;case CanvasAgent.ContextType.WebGL:contextType=WebInspector.Canvas.ContextType.WebGL;break;case CanvasAgent.ContextType.WebGL2:contextType=WebInspector.Canvas.ContextType.WebGL2;break;case CanvasAgent.ContextType.WebGPU:contextType=WebInspector.Canvas.ContextType.WebGPU;break;default:console.error("Invalid canvas context type",payload.contextType);}
let frame=WebInspector.frameResourceManager.frameForIdentifier(payload.frameId);return new WebInspector.Canvas(payload.canvasId,contextType,frame,{domNode:payload.nodeId?WebInspector.domTreeManager.nodeForId(payload.nodeId):null,cssCanvasName:payload.cssCanvasName,contextAttributes:payload.contextAttributes,memoryCost:payload.memoryCost,});}
static displayNameForContextType(contextType)
{switch(contextType){case WebInspector.Canvas.ContextType.Canvas2D:return WebInspector.UIString("2D");case WebInspector.Canvas.ContextType.WebGL:return WebInspector.unlocalizedString("WebGL");case WebInspector.Canvas.ContextType.WebGL2:return WebInspector.unlocalizedString("WebGL2");case WebInspector.Canvas.ContextType.WebGPU:return WebInspector.unlocalizedString("WebGPU");default:console.error("Invalid canvas context type",contextType);}}
static resetUniqueDisplayNameNumbers()
{WebInspector.Canvas._nextUniqueDisplayNameNumber=1;}
get identifier(){return this._identifier;}
get contextType(){return this._contextType;}
get frame(){return this._frame;}
get cssCanvasName(){return this._cssCanvasName;}
get contextAttributes(){return this._contextAttributes;}
get memoryCost()
{return this._memoryCost;}
set memoryCost(memoryCost)
{if(memoryCost===this._memoryCost)
return;this._memoryCost=memoryCost;this.dispatchEventToListeners(WebInspector.Canvas.Event.MemoryChanged);}
get displayName()
{if(this._cssCanvasName)
return WebInspector.UIString("CSS canvas “%s”").format(this._cssCanvasName);if(this._domNode){let idSelector=this._domNode.escapedIdSelector;if(idSelector)
return WebInspector.UIString("Canvas %s").format(idSelector);}
if(!this._uniqueDisplayNameNumber)
this._uniqueDisplayNameNumber=this.constructor._nextUniqueDisplayNameNumber++;return WebInspector.UIString("Canvas %d").format(this._uniqueDisplayNameNumber);}
requestNode(callback)
{if(this._domNode){callback(this._domNode);return;}
WebInspector.domTreeManager.ensureDocument();CanvasAgent.requestNode(this._identifier,(error,nodeId)=>{if(error){callback(null);return;}
this._domNode=WebInspector.domTreeManager.nodeForId(nodeId);callback(this._domNode);});}
requestContent(callback)
{CanvasAgent.requestContent(this._identifier,(error,content)=>{if(error){callback(null);return;}
callback(content);});}
requestCSSCanvasClientNodes(callback)
{if(!this._cssCanvasName){callback([]);return;}
if(this._cssCanvasClientNodes){callback(this._cssCanvasClientNodes);return;}
WebInspector.domTreeManager.ensureDocument();CanvasAgent.requestCSSCanvasClientNodes(this._identifier,(error,clientNodeIds)=>{if(error){callback([]);return;}
clientNodeIds=Array.isArray(clientNodeIds)?clientNodeIds:[];this._cssCanvasClientNodes=clientNodeIds.map((clientNodeId)=>WebInspector.domTreeManager.nodeForId(clientNodeId));callback(this._cssCanvasClientNodes);});}
saveIdentityToCookie(cookie)
{cookie[WebInspector.Canvas.FrameURLCookieKey]=this._frame.url.hash;if(this._cssCanvasName)
cookie[WebInspector.Canvas.CSSCanvasNameCookieKey]=this._cssCanvasName;else if(this._domNode)
cookie[WebInspector.Canvas.NodePathCookieKey]=this._domNode.path;}
cssCanvasClientNodesChanged()
{if(!this._cssCanvasName)
return;this._cssCanvasClientNodes=null;this.dispatchEventToListeners(WebInspector.Canvas.Event.CSSCanvasClientNodesChanged);}};WebInspector.Canvas._nextUniqueDisplayNameNumber=1;WebInspector.Canvas.FrameURLCookieKey="canvas-frame-url";WebInspector.Canvas.CSSCanvasNameCookieKey="canvas-css-canvas-name";WebInspector.Canvas.ContextType={Canvas2D:"canvas-2d",WebGL:"webgl",WebGL2:"webgl2",WebGPU:"webgpu",};WebInspector.Canvas.ResourceSidebarType="resource-type-canvas";WebInspector.Canvas.Event={MemoryChanged:"canvas-memory-changed",CSSCanvasClientNodesChanged:"canvas-css-canvas-client-nodes-changed",};WebInspector.Collection=class Collection extends WebInspector.Object
{constructor(typeVerifier)
{super();this._items=new Set;this._typeVerifier=typeVerifier||WebInspector.Collection.TypeVerifier.Any;}
get items(){return this._items;}
get typeVerifier(){return this._typeVerifier;}
add(item)
{let isValidType=this._typeVerifier(item);if(!isValidType)
return;this._items.add(item);this.itemAdded(item);this.dispatchEventToListeners(WebInspector.Collection.Event.ItemAdded,{item});}
remove(item)
{let wasRemoved=this._items.delete(item);this.itemRemoved(item);this.dispatchEventToListeners(WebInspector.Collection.Event.ItemRemoved,{item});}
clear()
{let items=new Set(this._items);this._items.clear();this.itemsCleared(items);for(let item of items)
this.dispatchEventToListeners(WebInspector.Collection.Event.ItemRemoved,{item});}
toArray()
{return Array.from(this._items);}
toJSON()
{return this.toArray();}
itemAdded(item)
{}
itemRemoved(item)
{}
itemsCleared(items)
{}};WebInspector.Collection.Event={ItemAdded:"collection-item-added",ItemRemoved:"collection-item-removed",};WebInspector.Collection.TypeVerifier={Any:(object)=>true,ContentFlow:(object)=>object instanceof WebInspector.ContentFlow,Frame:(object)=>object instanceof WebInspector.Frame,Resource:(object)=>object instanceof WebInspector.Resource,Script:(object)=>object instanceof WebInspector.Script,CSSStyleSheet:(object)=>object instanceof WebInspector.CSSStyleSheet,Canvas:(object)=>object instanceof WebInspector.Canvas,};WebInspector.CollectionEntry=class CollectionEntry extends WebInspector.Object
{constructor(key,value)
{super();this._key=key;this._value=value;}
static fromPayload(payload,target)
{if(payload.key)
payload.key=WebInspector.RemoteObject.fromPayload(payload.key,target);if(payload.value)
payload.value=WebInspector.RemoteObject.fromPayload(payload.value,target);return new WebInspector.CollectionEntry(payload.key,payload.value);}
get key(){return this._key;}
get value(){return this._value;}};WebInspector.CollectionEntryPreview=class CollectionEntryPreview extends WebInspector.Object
{constructor(keyPreview,valuePreview)
{super();this._key=keyPreview;this._value=valuePreview;}
static fromPayload(payload)
{if(payload.key)
payload.key=WebInspector.ObjectPreview.fromPayload(payload.key);if(payload.value)
payload.value=WebInspector.ObjectPreview.fromPayload(payload.value);return new WebInspector.CollectionEntryPreview(payload.key,payload.value);}
get keyPreview(){return this._key;}
get valuePreview(){return this._value;}};WebInspector.Color=class Color
{constructor(format,components)
{this.format=format;if(format===WebInspector.Color.Format.HSL||format===WebInspector.Color.Format.HSLA)
this._hsla=components;else
this._rgba=components;this.valid=!components.some(isNaN);}
static fromString(colorString)
{let value=colorString.toLowerCase().replace(/%|\s+/g,"");let transparentKeywords=["transparent","rgba(0,0,0,0)","hsla(0,0,0,0)"];if(transparentKeywords.includes(value)){let color=new WebInspector.Color(WebInspector.Color.Format.Keyword,[0,0,0,0]);color.keyword="transparent";color.original=colorString;return color;}
let simple=/^(?:#([0-9a-f]{3,8})|rgb\(([^)]+)\)|(\w+)|hsl\(([^)]+)\))$/i;let match=colorString.match(simple);if(match){if(match[1]){ let hex=match[1].toUpperCase();let len=hex.length;if(len===3){return new WebInspector.Color(WebInspector.Color.Format.ShortHEX,[parseInt(hex.charAt(0)+hex.charAt(0),16),parseInt(hex.charAt(1)+hex.charAt(1),16),parseInt(hex.charAt(2)+hex.charAt(2),16),1]);}else if(len===6){return new WebInspector.Color(WebInspector.Color.Format.HEX,[parseInt(hex.substring(0,2),16),parseInt(hex.substring(2,4),16),parseInt(hex.substring(4,6),16),1]);}else if(len===4){return new WebInspector.Color(WebInspector.Color.Format.ShortHEXAlpha,[parseInt(hex.charAt(0)+hex.charAt(0),16),parseInt(hex.charAt(1)+hex.charAt(1),16),parseInt(hex.charAt(2)+hex.charAt(2),16),parseInt(hex.charAt(3)+hex.charAt(3),16)/255]);}else if(len===8){return new WebInspector.Color(WebInspector.Color.Format.HEXAlpha,[parseInt(hex.substring(0,2),16),parseInt(hex.substring(2,4),16),parseInt(hex.substring(4,6),16),parseInt(hex.substring(6,8),16)/255]);}else
return null;}else if(match[2]){ let rgb=match[2].split(/\s*,\s*/);if(rgb.length!==3)
return null;return new WebInspector.Color(WebInspector.Color.Format.RGB,[parseInt(rgb[0]),parseInt(rgb[1]),parseInt(rgb[2]),1]);}else if(match[3]){ let keyword=match[3].toLowerCase();if(!WebInspector.Color.Keywords.hasOwnProperty(keyword))
return null;let color=new WebInspector.Color(WebInspector.Color.Format.Keyword,WebInspector.Color.Keywords[keyword].concat(1));color.keyword=keyword;color.original=colorString;return color;}else if(match[4]){ let hsl=match[4].replace(/%/g,"").split(/\s*,\s*/);if(hsl.length!==3)
return null;return new WebInspector.Color(WebInspector.Color.Format.HSL,[parseInt(hsl[0]),parseInt(hsl[1]),parseInt(hsl[2]),1]);}}
let advanced=/^(?:rgba\(([^)]+)\)|hsla\(([^)]+)\))$/i;match=colorString.match(advanced);if(match){if(match[1]){ let rgba=match[1].split(/\s*,\s*/);if(rgba.length!==4)
return null;return new WebInspector.Color(WebInspector.Color.Format.RGBA,[parseInt(rgba[0]),parseInt(rgba[1]),parseInt(rgba[2]),Number.constrain(parseFloat(rgba[3]),0,1)]);}else if(match[2]){ let hsla=match[2].replace(/%/g,"").split(/\s*,\s*/);if(hsla.length!==4)
return null;return new WebInspector.Color(WebInspector.Color.Format.HSLA,[parseInt(hsla[0]),parseInt(hsla[1]),parseInt(hsla[2]),Number.constrain(parseFloat(hsla[3]),0,1)]);}}
return null;}
static rgb2hsv(r,g,b)
{r/=255;g/=255;b/=255;let min=Math.min(Math.min(r,g),b);let max=Math.max(Math.max(r,g),b);let delta=max-min;let h;let s;let v=max;if(delta===0)
h=0;else if(max===r)
h=(60*((g-b)/delta))%360;else if(max===g)
h=60*((b-r)/delta)+120;else if(max===b)
h=60*((r-g)/delta)+240;if(h<0)
h+=360; if(max===0)
s=0;else
s=1-(min/max);return[h,s,v];}
static hsv2rgb(h,s,v)
{if(s===0)
return[v,v,v];h/=60;let i=Math.floor(h);let data=[v*(1-s),v*(1-s*(h-i)),v*(1-s*(1-(h-i)))];let rgb;switch(i){case 0:rgb=[v,data[2],data[0]];break;case 1:rgb=[data[1],v,data[0]];break;case 2:rgb=[data[0],v,data[2]];break;case 3:rgb=[data[0],data[1],v];break;case 4:rgb=[data[2],data[0],v];break;default:rgb=[v,data[0],data[1]];break;}
return rgb;}
nextFormat(format)
{format=format||this.format;switch(format){case WebInspector.Color.Format.Original:case WebInspector.Color.Format.HEX:case WebInspector.Color.Format.HEXAlpha:return this.simple?WebInspector.Color.Format.RGB:WebInspector.Color.Format.RGBA;case WebInspector.Color.Format.RGB:case WebInspector.Color.Format.RGBA:return this.simple?WebInspector.Color.Format.HSL:WebInspector.Color.Format.HSLA;case WebInspector.Color.Format.HSL:case WebInspector.Color.Format.HSLA:if(this.isKeyword())
return WebInspector.Color.Format.Keyword;if(this.simple)
return this.canBeSerializedAsShortHEX()?WebInspector.Color.Format.ShortHEX:WebInspector.Color.Format.HEX;return this.canBeSerializedAsShortHEX()?WebInspector.Color.Format.ShortHEXAlpha:WebInspector.Color.Format.HEXAlpha;case WebInspector.Color.Format.ShortHEX:return WebInspector.Color.Format.HEX;case WebInspector.Color.Format.ShortHEXAlpha:return WebInspector.Color.Format.HEXAlpha;case WebInspector.Color.Format.Keyword:if(this.simple)
return this.canBeSerializedAsShortHEX()?WebInspector.Color.Format.ShortHEX:WebInspector.Color.Format.HEX;return this.canBeSerializedAsShortHEX()?WebInspector.Color.Format.ShortHEXAlpha:WebInspector.Color.Format.HEXAlpha;default:console.error("Unknown color format.");return null;}}
get alpha()
{return this._rgba?this._rgba[3]:this._hsla[3];}
get simple()
{return this.alpha===1;}
get rgb()
{let rgb=this.rgba.slice();rgb.pop();return rgb;}
get hsl()
{let hsl=this.hsla.slice();hsl.pop();return hsl;}
get rgba()
{if(!this._rgba)
this._rgba=this._hslaToRGBA(this._hsla);return this._rgba;}
get hsla()
{if(!this._hsla)
this._hsla=this._rgbaToHSLA(this.rgba);return this._hsla;}
copy()
{switch(this.format){case WebInspector.Color.Format.RGB:case WebInspector.Color.Format.HEX:case WebInspector.Color.Format.ShortHEX:case WebInspector.Color.Format.HEXAlpha:case WebInspector.Color.Format.ShortHEXAlpha:case WebInspector.Color.Format.Keyword:case WebInspector.Color.Format.RGBA:return new WebInspector.Color(this.format,this.rgba);case WebInspector.Color.Format.HSL:case WebInspector.Color.Format.HSLA:return new WebInspector.Color(this.format,this.hsla);}}
toString(format)
{if(!format)
format=this.format;switch(format){case WebInspector.Color.Format.Original:return this._toOriginalString();case WebInspector.Color.Format.RGB:return this._toRGBString();case WebInspector.Color.Format.RGBA:return this._toRGBAString();case WebInspector.Color.Format.HSL:return this._toHSLString();case WebInspector.Color.Format.HSLA:return this._toHSLAString();case WebInspector.Color.Format.HEX:return this._toHEXString();case WebInspector.Color.Format.ShortHEX:return this._toShortHEXString();case WebInspector.Color.Format.HEXAlpha:return this._toHEXAlphaString();case WebInspector.Color.Format.ShortHEXAlpha:return this._toShortHEXAlphaString();case WebInspector.Color.Format.Keyword:return this._toKeywordString();}
throw"invalid color format";}
isKeyword()
{if(this.keyword)
return true;if(!this.simple)
return Array.shallowEqual(this._rgba,[0,0,0,0])||Array.shallowEqual(this._hsla,[0,0,0,0]);let rgb=(this._rgba&&this._rgba.slice(0,3))||this._hslToRGB(this._hsla);return Object.keys(WebInspector.Color.Keywords).some(key=>Array.shallowEqual(WebInspector.Color.Keywords[key],rgb));}
canBeSerializedAsShortHEX()
{let rgba=this.rgba||this._hslaToRGBA(this._hsla);let r=this._componentToHexValue(rgba[0]);if(r[0]!==r[1])
return false;let g=this._componentToHexValue(rgba[1]);if(g[0]!==g[1])
return false;let b=this._componentToHexValue(rgba[2]);if(b[0]!==b[1])
return false;if(!this.simple){let a=this._componentToHexValue(Math.round(rgba[3]*255));if(a[0]!==a[1])
return false;}
return true;}
_toOriginalString()
{return this.original||this._toKeywordString();}
_toKeywordString()
{if(this.keyword)
return this.keyword;let rgba=this.rgba;if(!this.simple){if(rgba[0]===0&&rgba[1]===0&&rgba[2]===0&&rgba[3]===0)
return"transparent";return this._toRGBAString();}
let keywords=WebInspector.Color.Keywords;for(let keyword in keywords){if(!keywords.hasOwnProperty(keyword))
continue;let keywordRGB=keywords[keyword];if(keywordRGB[0]===rgba[0]&&keywordRGB[1]===rgba[1]&&keywordRGB[2]===rgba[2])
return keyword;}
return this._toRGBString();}
_toShortHEXString()
{if(!this.simple)
return this._toRGBAString();let rgba=this.rgba;let r=this._componentToHexValue(rgba[0]);let g=this._componentToHexValue(rgba[1]);let b=this._componentToHexValue(rgba[2]);if(r[0]===r[1]&&g[0]===g[1]&&b[0]===b[1])
return"#"+r[0]+g[0]+b[0];else
return"#"+r+g+b;}
_toHEXString()
{if(!this.simple)
return this._toRGBAString();let rgba=this.rgba;let r=this._componentToHexValue(rgba[0]);let g=this._componentToHexValue(rgba[1]);let b=this._componentToHexValue(rgba[2]);return"#"+r+g+b;}
_toShortHEXAlphaString()
{let rgba=this.rgba;let r=this._componentToHexValue(rgba[0]);let g=this._componentToHexValue(rgba[1]);let b=this._componentToHexValue(rgba[2]);let a=this._componentToHexValue(Math.round(rgba[3]*255));if(r[0]===r[1]&&g[0]===g[1]&&b[0]===b[1]&&a[0]===a[1])
return"#"+r[0]+g[0]+b[0]+a[0];else
return"#"+r+g+b+a;}
_toHEXAlphaString()
{let rgba=this.rgba;let r=this._componentToHexValue(rgba[0]);let g=this._componentToHexValue(rgba[1]);let b=this._componentToHexValue(rgba[2]);let a=this._componentToHexValue(Math.round(rgba[3]*255));return"#"+r+g+b+a;}
_toRGBString()
{if(!this.simple)
return this._toRGBAString();let rgba=this.rgba.slice(0,-1);rgba=rgba.map((value)=>value.maxDecimals(2));return"rgb("+rgba.join(", ")+")";}
_toRGBAString()
{let rgba=this.rgba;rgba=rgba.map((value)=>value.maxDecimals(2));return"rgba("+rgba.join(", ")+")";}
_toHSLString()
{if(!this.simple)
return this._toHSLAString();let hsla=this.hsla;hsla=hsla.map((value)=>value.maxDecimals(2));return"hsl("+hsla[0]+", "+hsla[1]+"%, "+hsla[2]+"%)";}
_toHSLAString()
{let hsla=this.hsla;hsla=hsla.map((value)=>value.maxDecimals(2));return"hsla("+hsla[0]+", "+hsla[1]+"%, "+hsla[2]+"%, "+hsla[3]+")";}
_componentToNumber(value)
{return Number.constrain(value,0,255);}
_componentToHexValue(value)
{let hex=this._componentToNumber(value).toString(16);if(hex.length===1)
hex="0"+hex;return hex;}
_rgbToHSL(rgb)
{let r=this._componentToNumber(rgb[0])/255;let g=this._componentToNumber(rgb[1])/255;let b=this._componentToNumber(rgb[2])/255;let max=Math.max(r,g,b);let min=Math.min(r,g,b);let diff=max-min;let add=max+min;let h;let s;let l=0.5*add;if(min===max)
h=0;else if(r===max)
h=((60*(g-b)/diff)+360)%360;else if(g===max)
h=(60*(b-r)/diff)+120;else
h=(60*(r-g)/diff)+240;if(l===0)
s=0;else if(l===1)
s=1;else if(l<=0.5)
s=diff/add;else
s=diff/(2-add);return[Math.round(h),Math.round(s*100),Math.round(l*100)];}
_hslToRGB(hsl)
{let h=parseFloat(hsl[0])/360;let s=parseFloat(hsl[1])/100;let l=parseFloat(hsl[2])/100;h*=6;let sArray=[l+=s*=l<.5?l:1-l,l-h%1*s*2,l-=s*=2,l,l+h%1*s,l+s];return[Math.round(sArray[~~h%6]*255),Math.round(sArray[(h|16)%6]*255),Math.round(sArray[(h|8)%6]*255)];}
_rgbaToHSLA(rgba)
{let hsl=this._rgbToHSL(rgba);hsl.push(rgba[3]);return hsl;}
_hslaToRGBA(hsla)
{let rgba=this._hslToRGB(hsla);rgba.push(hsla[3]);return rgba;}};WebInspector.Color.Format={Original:"color-format-original",Keyword:"color-format-keyword",HEX:"color-format-hex",ShortHEX:"color-format-short-hex",HEXAlpha:"color-format-hex-alpha",ShortHEXAlpha:"color-format-short-hex-alpha",RGB:"color-format-rgb",RGBA:"color-format-rgba",HSL:"color-format-hsl",HSLA:"color-format-hsla"};WebInspector.Color.Keywords={"aliceblue":[240,248,255],"antiquewhite":[250,235,215],"aquamarine":[127,255,212],"azure":[240,255,255],"beige":[245,245,220],"bisque":[255,228,196],"black":[0,0,0],"blanchedalmond":[255,235,205],"blue":[0,0,255],"blueviolet":[138,43,226],"brown":[165,42,42],"burlywood":[222,184,135],"cadetblue":[95,158,160],"chartreuse":[127,255,0],"chocolate":[210,105,30],"coral":[255,127,80],"cornflowerblue":[100,149,237],"cornsilk":[255,248,220],"crimson":[237,164,61],"cyan":[0,255,255],"darkblue":[0,0,139],"darkcyan":[0,139,139],"darkgoldenrod":[184,134,11],"darkgray":[169,169,169],"darkgreen":[0,100,0],"darkgrey":[169,169,169],"darkkhaki":[189,183,107],"darkmagenta":[139,0,139],"darkolivegreen":[85,107,47],"darkorange":[255,140,0],"darkorchid":[153,50,204],"darkred":[139,0,0],"darksalmon":[233,150,122],"darkseagreen":[143,188,143],"darkslateblue":[72,61,139],"darkslategray":[47,79,79],"darkslategrey":[47,79,79],"darkturquoise":[0,206,209],"darkviolet":[148,0,211],"deeppink":[255,20,147],"deepskyblue":[0,191,255],"dimgray":[105,105,105],"dimgrey":[105,105,105],"dodgerblue":[30,144,255],"firebrick":[178,34,34],"floralwhite":[255,250,240],"forestgreen":[34,139,34],"gainsboro":[220,220,220],"ghostwhite":[248,248,255],"gold":[255,215,0],"goldenrod":[218,165,32],"gray":[128,128,128],"green":[0,128,0],"greenyellow":[173,255,47],"grey":[128,128,128],"honeydew":[240,255,240],"hotpink":[255,105,180],"indianred":[205,92,92],"indigo":[75,0,130],"ivory":[255,255,240],"khaki":[240,230,140],"lavender":[230,230,250],"lavenderblush":[255,240,245],"lawngreen":[124,252,0],"lemonchiffon":[255,250,205],"lightblue":[173,216,230],"lightcoral":[240,128,128],"lightcyan":[224,255,255],"lightgoldenrodyellow":[250,250,210],"lightgray":[211,211,211],"lightgreen":[144,238,144],"lightgrey":[211,211,211],"lightpink":[255,182,193],"lightsalmon":[255,160,122],"lightseagreen":[32,178,170],"lightskyblue":[135,206,250],"lightslategray":[119,136,153],"lightslategrey":[119,136,153],"lightsteelblue":[176,196,222],"lightyellow":[255,255,224],"lime":[0,255,0],"limegreen":[50,205,50],"linen":[250,240,230],"magenta":[255,0,255],"maroon":[128,0,0],"mediumaquamarine":[102,205,170],"mediumblue":[0,0,205],"mediumorchid":[186,85,211],"mediumpurple":[147,112,219],"mediumseagreen":[60,179,113],"mediumslateblue":[123,104,238],"mediumspringgreen":[0,250,154],"mediumturquoise":[72,209,204],"mediumvioletred":[199,21,133],"midnightblue":[25,25,112],"mintcream":[245,255,250],"mistyrose":[255,228,225],"moccasin":[255,228,181],"navajowhite":[255,222,173],"navy":[0,0,128],"oldlace":[253,245,230],"olive":[128,128,0],"olivedrab":[107,142,35],"orange":[255,165,0],"orangered":[255,69,0],"orchid":[218,112,214],"palegoldenrod":[238,232,170],"palegreen":[152,251,152],"paleturquoise":[175,238,238],"palevioletred":[219,112,147],"papayawhip":[255,239,213],"peachpuff":[255,218,185],"peru":[205,133,63],"pink":[255,192,203],"plum":[221,160,221],"powderblue":[176,224,230],"purple":[128,0,128],"rebeccapurple":[102,51,153],"red":[255,0,0],"rosybrown":[188,143,143],"royalblue":[65,105,225],"saddlebrown":[139,69,19],"salmon":[250,128,114],"sandybrown":[244,164,96],"seagreen":[46,139,87],"seashell":[255,245,238],"sienna":[160,82,45],"silver":[192,192,192],"skyblue":[135,206,235],"slateblue":[106,90,205],"slategray":[112,128,144],"slategrey":[112,128,144],"snow":[255,250,250],"springgreen":[0,255,127],"steelblue":[70,130,180],"tan":[210,180,140],"teal":[0,128,128],"thistle":[216,191,216],"tomato":[255,99,71],"turquoise":[64,224,208],"violet":[238,130,238],"wheat":[245,222,179],"white":[255,255,255],"whitesmoke":[245,245,245],"yellow":[255,255,0],"yellowgreen":[154,205,50]};WebInspector.ConsoleCommandResultMessage=class ConsoleCommandResult extends WebInspector.ConsoleMessage
{constructor(target,result,wasThrown,savedResultIndex,shouldRevealConsole=true)
{let source=WebInspector.ConsoleMessage.MessageSource.JS;let level=wasThrown?WebInspector.ConsoleMessage.MessageLevel.Error:WebInspector.ConsoleMessage.MessageLevel.Log;let type=WebInspector.ConsoleMessage.MessageType.Result;super(target,source,level,"",type,undefined,undefined,undefined,0,[result],undefined,undefined);this._savedResultIndex=savedResultIndex;this._shouldRevealConsole=shouldRevealConsole;if(this._savedResultIndex&&this._savedResultIndex>WebInspector.ConsoleCommandResultMessage.maximumSavedResultIndex)
WebInspector.ConsoleCommandResultMessage.maximumSavedResultIndex=this._savedResultIndex;}
static clearMaximumSavedResultIndex()
{WebInspector.ConsoleCommandResultMessage.maximumSavedResultIndex=0;}
get savedResultIndex()
{return this._savedResultIndex;}
get shouldRevealConsole()
{return this._shouldRevealConsole;}};WebInspector.ConsoleCommandResultMessage.maximumSavedResultIndex=0;WebInspector.ContentFlow=class ContentFlow extends WebInspector.Object
{constructor(documentNodeIdentifier,name,overset,contentNodes)
{super();this._documentNodeIdentifier=documentNodeIdentifier;this._name=name;this._overset=overset;this._contentNodes=contentNodes;}
get id()
{return this._documentNodeIdentifier+":"+this._name;}
get documentNodeIdentifier()
{return this._documentNodeIdentifier;}
get name()
{return this._name;}
get overset()
{return this._overset;}
set overset(overset)
{if(this._overset===overset)
return;this._overset=overset;this.dispatchEventToListeners(WebInspector.ContentFlow.Event.FlowOversetWasChanged);}
get contentNodes()
{return this._contentNodes;}
insertContentNodeBefore(contentNode,referenceNode)
{var index=this._contentNodes.indexOf(referenceNode);this._contentNodes.splice(index,0,contentNode);this.dispatchEventToListeners(WebInspector.ContentFlow.Event.ContentNodeWasAdded,{node:contentNode,before:referenceNode});}
appendContentNode(contentNode)
{this._contentNodes.push(contentNode);this.dispatchEventToListeners(WebInspector.ContentFlow.Event.ContentNodeWasAdded,{node:contentNode});}
removeContentNode(contentNode)
{var index=this._contentNodes.indexOf(contentNode);this._contentNodes.splice(index,1);this.dispatchEventToListeners(WebInspector.ContentFlow.Event.ContentNodeWasRemoved,{node:contentNode});}};WebInspector.ContentFlow.Event={OversetWasChanged:"content-flow-overset-was-changed",ContentNodeWasAdded:"content-flow-content-node-was-added",ContentNodeWasRemoved:"content-flow-content-node-was-removed"};WebInspector.CookieStorageObject=class CookieStorageObject
{constructor(host)
{this._host=host;}
static cookieMatchesResourceURL(cookie,resourceURL)
{var parsedURL=parseURL(resourceURL);if(!parsedURL||!WebInspector.CookieStorageObject.cookieDomainMatchesResourceDomain(cookie.domain,parsedURL.host))
return false;return parsedURL.path.startsWith(cookie.path)&&(!cookie.port||parsedURL.port===cookie.port)&&(!cookie.secure||parsedURL.scheme==="https");}
static cookieDomainMatchesResourceDomain(cookieDomain,resourceDomain)
{if(cookieDomain.charAt(0)!==".")
return resourceDomain===cookieDomain;return!!resourceDomain.match(new RegExp("^(?:[^\\.]+\\.)*"+cookieDomain.substring(1).escapeForRegExp()+"$"),"i");}
get host()
{return this._host;}
saveIdentityToCookie(cookie)
{cookie[WebInspector.CookieStorageObject.CookieHostCookieKey]=this.host;}};WebInspector.CookieStorageObject.TypeIdentifier="cookie-storage";WebInspector.CookieStorageObject.CookieHostCookieKey="cookie-storage-host";WebInspector.DOMBreakpoint=class DOMBreakpoint extends WebInspector.Object
{constructor(domNodeOrInfo,type,disabled)
{super();if(domNodeOrInfo instanceof WebInspector.DOMNode){this._domNodeIdentifier=domNodeOrInfo.id;this._path=domNodeOrInfo.path();this._url=WebInspector.frameResourceManager.mainFrame.url;}else if(domNodeOrInfo&&typeof domNodeOrInfo==="object"){this._domNodeIdentifier=null;this._path=domNodeOrInfo.path;this._url=domNodeOrInfo.url;}
this._type=type;this._disabled=disabled||false;}
get type(){return this._type;}
get url(){return this._url;}
get path(){return this._path;}
get disabled()
{return this._disabled;}
set disabled(disabled)
{if(this._disabled===disabled)
return;this._disabled=disabled;this.dispatchEventToListeners(WebInspector.DOMBreakpoint.Event.DisabledStateDidChange);}
get domNodeIdentifier()
{return this._domNodeIdentifier;}
set domNodeIdentifier(nodeIdentifier)
{if(this._domNodeIdentifier===nodeIdentifier)
return;let data={};if(!nodeIdentifier)
data.oldNodeIdentifier=this._domNodeIdentifier;this._domNodeIdentifier=nodeIdentifier;this.dispatchEventToListeners(WebInspector.DOMBreakpoint.Event.ResolvedStateDidChange,data);}
get serializableInfo()
{let info={url:this._url,path:this._path,type:this._type};if(this._disabled)
info.disabled=true;return info;}
saveIdentityToCookie(cookie)
{cookie[WebInspector.DOMBreakpoint.DocumentURLCookieKey]=this.url;cookie[WebInspector.DOMBreakpoint.NodePathCookieKey]=this.path;cookie[WebInspector.DOMBreakpoint.TypeCookieKey]=this.type;}};WebInspector.DOMBreakpoint.DocumentURLCookieKey="dom-breakpoint-document-url";WebInspector.DOMBreakpoint.NodePathCookieKey="dom-breakpoint-node-path";WebInspector.DOMBreakpoint.TypeCookieKey="dom-breakpoint-type";WebInspector.DOMBreakpoint.Type={SubtreeModified:"subtree-modified",AttributeModified:"attribute-modified",NodeRemoved:"node-removed",};WebInspector.DOMBreakpoint.Event={DisabledStateDidChange:"dom-breakpoint-disabled-state-did-change",ResolvedStateDidChange:"dom-breakpoint-resolved-state-did-change",};WebInspector.DOMNode=class DOMNode extends WebInspector.Object
{constructor(domTreeManager,doc,isInShadowTree,payload)
{super();this._domTreeManager=domTreeManager;this._isInShadowTree=isInShadowTree;this.id=payload.nodeId;this._domTreeManager._idToDOMNode[this.id]=this;this._nodeType=payload.nodeType;this._nodeName=payload.nodeName;this._localName=payload.localName;this._nodeValue=payload.nodeValue;this._pseudoType=payload.pseudoType;this._shadowRootType=payload.shadowRootType;this._computedRole=payload.role;this._contentSecurityPolicyHash=payload.contentSecurityPolicyHash;if(this._nodeType===Node.DOCUMENT_NODE)
this.ownerDocument=this;else
this.ownerDocument=doc;this._attributes=[];this._attributesMap=new Map;if(payload.attributes)
this._setAttributesPayload(payload.attributes);this._childNodeCount=payload.childNodeCount;this._children=null;this._filteredChildren=null;this._filteredChildrenNeedsUpdating=true;this._nextSibling=null;this._previousSibling=null;this.parentNode=null;this._enabledPseudoClasses=[];
this._shadowRoots=[];if(payload.shadowRoots){for(var i=0;i<payload.shadowRoots.length;++i){var root=payload.shadowRoots[i];var node=new WebInspector.DOMNode(this._domTreeManager,this.ownerDocument,true,root);node.parentNode=this;this._shadowRoots.push(node);}}
if(payload.children)
this._setChildrenPayload(payload.children);else if(this._shadowRoots.length&&!this._childNodeCount)
this._children=this._shadowRoots.slice();if(this._nodeType===Node.ELEMENT_NODE)
this._customElementState=payload.customElementState||WebInspector.DOMNode.CustomElementState.Builtin;else
this._customElementState=null;if(payload.templateContent){this._templateContent=new WebInspector.DOMNode(this._domTreeManager,this.ownerDocument,false,payload.templateContent);this._templateContent.parentNode=this;}
this._pseudoElements=new Map;if(payload.pseudoElements){for(var i=0;i<payload.pseudoElements.length;++i){var node=new WebInspector.DOMNode(this._domTreeManager,this.ownerDocument,this._isInShadowTree,payload.pseudoElements[i]);node.parentNode=this;this._pseudoElements.set(node.pseudoType(),node);}}
if(payload.contentDocument){this._contentDocument=new WebInspector.DOMNode(this._domTreeManager,null,false,payload.contentDocument);this._children=[this._contentDocument];this._renumber();}
if(payload.frameId)
this._frameIdentifier=payload.frameId;if(this._nodeType===Node.ELEMENT_NODE){if(this.ownerDocument&&!this.ownerDocument.documentElement&&this._nodeName==="HTML")
this.ownerDocument.documentElement=this;if(this.ownerDocument&&!this.ownerDocument.body&&this._nodeName==="BODY")
this.ownerDocument.body=this;if(payload.documentURL)
this.documentURL=payload.documentURL;}else if(this._nodeType===Node.DOCUMENT_TYPE_NODE){this.publicId=payload.publicId;this.systemId=payload.systemId;}else if(this._nodeType===Node.DOCUMENT_NODE){this.documentURL=payload.documentURL;this.xmlVersion=payload.xmlVersion;}else if(this._nodeType===Node.ATTRIBUTE_NODE){this.name=payload.name;this.value=payload.value;}}
get frameIdentifier()
{return this._frameIdentifier||this.ownerDocument.frameIdentifier;}
get frame()
{if(!this._frame)
this._frame=WebInspector.frameResourceManager.frameForIdentifier(this.frameIdentifier);return this._frame;}
get children()
{if(!this._children)
return null;if(WebInspector.showShadowDOMSetting.value)
return this._children;if(this._filteredChildrenNeedsUpdating){this._filteredChildrenNeedsUpdating=false;this._filteredChildren=this._children.filter(function(node){return!node._isInShadowTree;});}
return this._filteredChildren;}
get firstChild()
{var children=this.children;if(children&&children.length>0)
return children[0];return null;}
get lastChild()
{var children=this.children;if(children&&children.length>0)
return children.lastValue;return null;}
get nextSibling()
{if(WebInspector.showShadowDOMSetting.value)
return this._nextSibling;var node=this._nextSibling;while(node){if(!node._isInShadowTree)
return node;node=node._nextSibling;}
return null;}
get previousSibling()
{if(WebInspector.showShadowDOMSetting.value)
return this._previousSibling;var node=this._previousSibling;while(node){if(!node._isInShadowTree)
return node;node=node._previousSibling;}
return null;}
get childNodeCount()
{var children=this.children;if(children)
return children.length;if(WebInspector.showShadowDOMSetting.value)
return this._childNodeCount+this._shadowRoots.length;return this._childNodeCount;}
set childNodeCount(count)
{this._childNodeCount=count;}
computedRole()
{return this._computedRole;}
contentSecurityPolicyHash()
{return this._contentSecurityPolicyHash;}
hasAttributes()
{return this._attributes.length>0;}
hasChildNodes()
{return this.childNodeCount>0;}
hasShadowRoots()
{return!!this._shadowRoots.length;}
isInShadowTree()
{return this._isInShadowTree;}
isInUserAgentShadowTree()
{return this._isInShadowTree&&this.ancestorShadowRoot().isUserAgentShadowRoot();}
isCustomElement()
{return this._customElementState===WebInspector.DOMNode.CustomElementState.Custom;}
customElementState()
{return this._customElementState;}
isShadowRoot()
{return!!this._shadowRootType;}
isUserAgentShadowRoot()
{return this._shadowRootType===WebInspector.DOMNode.ShadowRootType.UserAgent;}
ancestorShadowRoot()
{if(!this._isInShadowTree)
return null;let node=this;while(node&&!node.isShadowRoot())
node=node.parentNode;return node;}
ancestorShadowHost()
{let shadowRoot=this.ancestorShadowRoot();return shadowRoot?shadowRoot.parentNode:null;}
isPseudoElement()
{return this._pseudoType!==undefined;}
nodeType()
{return this._nodeType;}
nodeName()
{return this._nodeName;}
nodeNameInCorrectCase()
{return this.isXMLNode()?this.nodeName():this.nodeName().toLowerCase();}
setNodeName(name,callback)
{DOMAgent.setNodeName(this.id,name,this._makeUndoableCallback(callback));}
localName()
{return this._localName;}
templateContent()
{return this._templateContent||null;}
pseudoType()
{return this._pseudoType;}
hasPseudoElements()
{return this._pseudoElements.size>0;}
pseudoElements()
{return this._pseudoElements;}
beforePseudoElement()
{return this._pseudoElements.get(WebInspector.DOMNode.PseudoElementType.Before)||null;}
afterPseudoElement()
{return this._pseudoElements.get(WebInspector.DOMNode.PseudoElementType.After)||null;}
shadowRoots()
{return this._shadowRoots;}
shadowRootType()
{return this._shadowRootType;}
nodeValue()
{return this._nodeValue;}
setNodeValue(value,callback)
{DOMAgent.setNodeValue(this.id,value,this._makeUndoableCallback(callback));}
getAttribute(name)
{let attr=this._attributesMap.get(name);return attr?attr.value:undefined;}
setAttribute(name,text,callback)
{DOMAgent.setAttributesAsText(this.id,text,name,this._makeUndoableCallback(callback));}
setAttributeValue(name,value,callback)
{DOMAgent.setAttributeValue(this.id,name,value,this._makeUndoableCallback(callback));}
attributes()
{return this._attributes;}
removeAttribute(name,callback)
{function mycallback(error,success)
{if(!error){this._attributesMap.delete(name);for(var i=0;i<this._attributes.length;++i){if(this._attributes[i].name===name){this._attributes.splice(i,1);break;}}}
this._makeUndoableCallback(callback)(error);}
DOMAgent.removeAttribute(this.id,name,mycallback.bind(this));}
toggleClass(className,flag)
{if(!className||!className.length)
return;if(this.isPseudoElement()){this.parentNode.toggleClass(className,flag);return;}
if(this.nodeType()!==Node.ELEMENT_NODE)
return;function resolvedNode(object)
{if(!object)
return;function inspectedPage_node_toggleClass(className,flag)
{this.classList.toggle(className,flag);}
object.callFunction(inspectedPage_node_toggleClass,[className,flag]);object.release();}
WebInspector.RemoteObject.resolveNode(this,"",resolvedNode);}
getChildNodes(callback)
{if(this.children){if(callback)
callback(this.children);return;}
function mycallback(error){if(!error&&callback)
callback(this.children);}
DOMAgent.requestChildNodes(this.id,mycallback.bind(this));}
getSubtree(depth,callback)
{function mycallback(error)
{if(callback)
callback(error?null:this.children);}
DOMAgent.requestChildNodes(this.id,depth,mycallback.bind(this));}
getOuterHTML(callback)
{DOMAgent.getOuterHTML(this.id,callback);}
setOuterHTML(html,callback)
{DOMAgent.setOuterHTML(this.id,html,this._makeUndoableCallback(callback));}
removeNode(callback)
{DOMAgent.removeNode(this.id,this._makeUndoableCallback(callback));}
copyNode()
{function copy(error,text)
{if(!error)
InspectorFrontendHost.copyText(text);}
DOMAgent.getOuterHTML(this.id,copy);}
getEventListeners(callback)
{DOMAgent.getEventListenersForNode(this.id,callback);}
accessibilityProperties(callback)
{function accessibilityPropertiesCallback(error,accessibilityProperties)
{if(!error&&callback&&accessibilityProperties){callback({activeDescendantNodeId:accessibilityProperties.activeDescendantNodeId,busy:accessibilityProperties.busy,checked:accessibilityProperties.checked,childNodeIds:accessibilityProperties.childNodeIds,controlledNodeIds:accessibilityProperties.controlledNodeIds,current:accessibilityProperties.current,disabled:accessibilityProperties.disabled,exists:accessibilityProperties.exists,expanded:accessibilityProperties.expanded,flowedNodeIds:accessibilityProperties.flowedNodeIds,focused:accessibilityProperties.focused,ignored:accessibilityProperties.ignored,ignoredByDefault:accessibilityProperties.ignoredByDefault,invalid:accessibilityProperties.invalid,isPopupButton:accessibilityProperties.isPopUpButton,headingLevel:accessibilityProperties.headingLevel,hierarchyLevel:accessibilityProperties.hierarchyLevel,hidden:accessibilityProperties.hidden,label:accessibilityProperties.label,liveRegionAtomic:accessibilityProperties.liveRegionAtomic,liveRegionRelevant:accessibilityProperties.liveRegionRelevant,liveRegionStatus:accessibilityProperties.liveRegionStatus,mouseEventNodeId:accessibilityProperties.mouseEventNodeId,nodeId:accessibilityProperties.nodeId,ownedNodeIds:accessibilityProperties.ownedNodeIds,parentNodeId:accessibilityProperties.parentNodeId,pressed:accessibilityProperties.pressed,readonly:accessibilityProperties.readonly,required:accessibilityProperties.required,role:accessibilityProperties.role,selected:accessibilityProperties.selected,selectedChildNodeIds:accessibilityProperties.selectedChildNodeIds});}}
DOMAgent.getAccessibilityPropertiesForNode(this.id,accessibilityPropertiesCallback.bind(this));}
path()
{var path=[];var node=this;while(node&&"index"in node&&node._nodeName.length){path.push([node.index,node._nodeName]);node=node.parentNode;}
path.reverse();return path.join(",");}
get escapedIdSelector()
{let id=this.getAttribute("id");if(!id)
return"";id=id.trim();if(!id.length)
return"";id=CSS.escape(id);if(/[\s'"]/.test(id))
return`[id=\"${id}\"]`;return`#${id}`;}
get escapedClassSelector()
{let classes=this.getAttribute("class");if(!classes)
return"";classes=classes.trim();if(!classes.length)
return"";let foundClasses=new Set;return classes.split(/\s+/).reduce((selector,className)=>{if(!className.length||foundClasses.has(className))
return selector;foundClasses.add(className);return`${selector}.${CSS.escape(className)}`;},"");}
get displayName()
{return this.nodeNameInCorrectCase()+this.escapedIdSelector+this.escapedClassSelector;}
appropriateSelectorFor(justSelector)
{if(this.isPseudoElement())
return this.parentNode.appropriateSelectorFor()+"::"+this._pseudoType;let lowerCaseName=this.localName()||this.nodeName().toLowerCase();let id=this.escapedIdSelector;if(id.length)
return justSelector?id:lowerCaseName+id;let classes=this.escapedClassSelector;if(classes.length)
return justSelector?classes:lowerCaseName+classes;if(lowerCaseName==="input"&&this.getAttribute("type"))
return lowerCaseName+"[type=\""+this.getAttribute("type")+"\"]";return lowerCaseName;}
isAncestor(node)
{if(!node)
return false;var currentNode=node.parentNode;while(currentNode){if(this===currentNode)
return true;currentNode=currentNode.parentNode;}
return false;}
isDescendant(descendant)
{return descendant!==null&&descendant.isAncestor(this);}
get ownerSVGElement()
{if(this._nodeName==="svg")
return this;if(!this.parentNode)
return null;return this.parentNode.ownerSVGElement;}
isSVGElement()
{return!!this.ownerSVGElement;}
_setAttributesPayload(attrs)
{this._attributes=[];this._attributesMap=new Map;for(var i=0;i<attrs.length;i+=2)
this._addAttribute(attrs[i],attrs[i+1]);}
_insertChild(prev,payload)
{var node=new WebInspector.DOMNode(this._domTreeManager,this.ownerDocument,this._isInShadowTree,payload);if(!prev){if(!this._children){ this._children=this._shadowRoots.concat([node]);}else
this._children.unshift(node);}else
this._children.splice(this._children.indexOf(prev)+1,0,node);this._renumber();return node;}
_removeChild(node)
{if(node.isPseudoElement()){this._pseudoElements.delete(node.pseudoType());node.parentNode=null;}else{this._children.splice(this._children.indexOf(node),1);node.parentNode=null;this._renumber();}}
_setChildrenPayload(payloads)
{if(this._contentDocument)
return;this._children=this._shadowRoots.slice();for(var i=0;i<payloads.length;++i){var node=new WebInspector.DOMNode(this._domTreeManager,this.ownerDocument,this._isInShadowTree,payloads[i]);this._children.push(node);}
this._renumber();}
_renumber()
{this._filteredChildrenNeedsUpdating=true;var childNodeCount=this._children.length;if(childNodeCount===0)
return;for(var i=0;i<childNodeCount;++i){var child=this._children[i];child.index=i;child._nextSibling=i+1<childNodeCount?this._children[i+1]:null;child._previousSibling=i-1>=0?this._children[i-1]:null;child.parentNode=this;}}
_addAttribute(name,value)
{let attr={name,value,_node:this};this._attributesMap.set(name,attr);this._attributes.push(attr);}
_setAttribute(name,value)
{let attr=this._attributesMap.get(name);if(attr)
attr.value=value;else
this._addAttribute(name,value);}
_removeAttribute(name)
{let attr=this._attributesMap.get(name);if(attr){this._attributes.remove(attr);this._attributesMap.delete(name);}}
moveTo(targetNode,anchorNode,callback)
{DOMAgent.moveTo(this.id,targetNode.id,anchorNode?anchorNode.id:undefined,this._makeUndoableCallback(callback));}
isXMLNode()
{return!!this.ownerDocument&&!!this.ownerDocument.xmlVersion;}
get enabledPseudoClasses()
{return this._enabledPseudoClasses;}
setPseudoClassEnabled(pseudoClass,enabled)
{var pseudoClasses=this._enabledPseudoClasses;if(enabled){if(pseudoClasses.includes(pseudoClass))
return;pseudoClasses.push(pseudoClass);}else{if(!pseudoClasses.includes(pseudoClass))
return;pseudoClasses.remove(pseudoClass);}
function changed(error)
{if(!error)
this.dispatchEventToListeners(WebInspector.DOMNode.Event.EnabledPseudoClassesChanged);}
CSSAgent.forcePseudoState(this.id,pseudoClasses,changed.bind(this));}
_makeUndoableCallback(callback)
{return function(error)
{if(!error)
DOMAgent.markUndoableState();if(callback)
callback.apply(null,arguments);};}};WebInspector.DOMNode.Event={EnabledPseudoClassesChanged:"dom-node-enabled-pseudo-classes-did-change",AttributeModified:"dom-node-attribute-modified",AttributeRemoved:"dom-node-attribute-removed"};WebInspector.DOMNode.PseudoElementType={Before:"before",After:"after",};WebInspector.DOMNode.ShadowRootType={UserAgent:"user-agent",Closed:"closed",Open:"open",};WebInspector.DOMNode.CustomElementState={Builtin:"builtin",Custom:"custom",Waiting:"waiting",Failed:"failed",};WebInspector.DOMNodeStyles=class DOMNodeStyles extends WebInspector.Object
{constructor(node)
{super();this._node=node||null;this._rulesMap={};this._styleDeclarationsMap={};this._matchedRules=[];this._inheritedRules=[];this._pseudoElements={};this._inlineStyle=null;this._attributesStyle=null;this._computedStyle=null;this._orderedStyles=[];this._propertyNameToEffectivePropertyMap={};this._pendingRefreshTask=null;this.refresh();}
get node()
{return this._node;}
get needsRefresh()
{return this._pendingRefreshTask||this._needsRefresh;}
refreshIfNeeded()
{if(!this._needsRefresh)
return;this.refresh();}
refresh()
{if(this._pendingRefreshTask)
return this._pendingRefreshTask;this._needsRefresh=false;let fetchedMatchedStylesPromise=new WebInspector.WrappedPromise;let fetchedInlineStylesPromise=new WebInspector.WrappedPromise;let fetchedComputedStylesPromise=new WebInspector.WrappedPromise;function wrap(func,promise){return(...args)=>{try{func.apply(this,args);}catch(e){console.error(e);promise.resolve();}};}
function parseRuleMatchArrayPayload(matchArray,node,inherited)
{var result=[];var ruleOccurrences={};for(var i=matchArray.length-1;i>=0;--i){var rule=this._parseRulePayload(matchArray[i].rule,matchArray[i].matchingSelectors,node,inherited,ruleOccurrences);if(!rule)
continue;result.push(rule);}
return result;}
function fetchedMatchedStyles(error,matchedRulesPayload,pseudoElementRulesPayload,inheritedRulesPayload)
{matchedRulesPayload=matchedRulesPayload||[];pseudoElementRulesPayload=pseudoElementRulesPayload||[];inheritedRulesPayload=inheritedRulesPayload||[];this._previousRulesMap=this._rulesMap;this._previousStyleDeclarationsMap=this._styleDeclarationsMap;this._rulesMap={};this._styleDeclarationsMap={};this._matchedRules=parseRuleMatchArrayPayload.call(this,matchedRulesPayload,this._node);this._pseudoElements={};for(var pseudoElementRulePayload of pseudoElementRulesPayload){var pseudoElementRules=parseRuleMatchArrayPayload.call(this,pseudoElementRulePayload.matches,this._node);this._pseudoElements[pseudoElementRulePayload.pseudoId]={matchedRules:pseudoElementRules};}
this._inheritedRules=[];var i=0;var currentNode=this._node.parentNode;while(currentNode&&i<inheritedRulesPayload.length){var inheritedRulePayload=inheritedRulesPayload[i];var inheritedRuleInfo={node:currentNode};inheritedRuleInfo.inlineStyle=inheritedRulePayload.inlineStyle?this._parseStyleDeclarationPayload(inheritedRulePayload.inlineStyle,currentNode,true,WebInspector.CSSStyleDeclaration.Type.Inline):null;inheritedRuleInfo.matchedRules=inheritedRulePayload.matchedCSSRules?parseRuleMatchArrayPayload.call(this,inheritedRulePayload.matchedCSSRules,currentNode,true):[];if(inheritedRuleInfo.inlineStyle||inheritedRuleInfo.matchedRules.length)
this._inheritedRules.push(inheritedRuleInfo);currentNode=currentNode.parentNode;++i;}
fetchedMatchedStylesPromise.resolve();}
function fetchedInlineStyles(error,inlineStylePayload,attributesStylePayload)
{this._inlineStyle=inlineStylePayload?this._parseStyleDeclarationPayload(inlineStylePayload,this._node,false,WebInspector.CSSStyleDeclaration.Type.Inline):null;this._attributesStyle=attributesStylePayload?this._parseStyleDeclarationPayload(attributesStylePayload,this._node,false,WebInspector.CSSStyleDeclaration.Type.Attribute):null;this._updateStyleCascade();fetchedInlineStylesPromise.resolve();}
function fetchedComputedStyle(error,computedPropertiesPayload)
{var properties=[];for(var i=0;computedPropertiesPayload&&i<computedPropertiesPayload.length;++i){var propertyPayload=computedPropertiesPayload[i];var canonicalName=WebInspector.cssStyleManager.canonicalNameForPropertyName(propertyPayload.name);propertyPayload.implicit=!this._propertyNameToEffectivePropertyMap[canonicalName];var property=this._parseStylePropertyPayload(propertyPayload,NaN,this._computedStyle);if(!property.implicit)
property.implicit=!this._isPropertyFoundInMatchingRules(property.name);properties.push(property);}
if(this._computedStyle)
this._computedStyle.update(null,properties);else
this._computedStyle=new WebInspector.CSSStyleDeclaration(this,null,null,WebInspector.CSSStyleDeclaration.Type.Computed,this._node,false,null,properties);let significantChange=false;for(let key in this._styleDeclarationsMap){if(key in this._previousStyleDeclarationsMap){if(Array.shallowEqual(this._styleDeclarationsMap[key],this._previousStyleDeclarationsMap[key]))
continue;
let styleFound=false;for(let style of this._styleDeclarationsMap[key]){if(this._previousStyleDeclarationsMap[key].includes(style)){styleFound=true;break;}}
if(styleFound)
continue;}
if(!this._includeUserAgentRulesOnNextRefresh){let firstStyle=this._styleDeclarationsMap[key][0];if(firstStyle&&firstStyle.ownerRule&&firstStyle.ownerRule.type===WebInspector.CSSStyleSheet.Type.UserAgent){
continue;}}
significantChange=true;break;}
if(!significantChange){for(var key in this._previousStyleDeclarationsMap){if(key in this._styleDeclarationsMap)
continue;if(!this._includeUserAgentRulesOnNextRefresh){var firstStyle=this._previousStyleDeclarationsMap[key][0];if(firstStyle&&firstStyle.ownerRule&&firstStyle.ownerRule.type===WebInspector.CSSStyleSheet.Type.UserAgent)
continue;}
significantChange=true;break;}}
delete this._includeUserAgentRulesOnNextRefresh;delete this._previousRulesMap;delete this._previousStyleDeclarationsMap;this.dispatchEventToListeners(WebInspector.DOMNodeStyles.Event.Refreshed,{significantChange});fetchedComputedStylesPromise.resolve();}
WebInspector.cssStyleManager.fetchStyleSheetsIfNeeded();CSSAgent.getMatchedStylesForNode.invoke({nodeId:this._node.id,includePseudo:true,includeInherited:true},wrap.call(this,fetchedMatchedStyles,fetchedMatchedStylesPromise));CSSAgent.getInlineStylesForNode.invoke({nodeId:this._node.id},wrap.call(this,fetchedInlineStyles,fetchedInlineStylesPromise));CSSAgent.getComputedStyleForNode.invoke({nodeId:this._node.id},wrap.call(this,fetchedComputedStyle,fetchedComputedStylesPromise));this._pendingRefreshTask=Promise.all([fetchedMatchedStylesPromise.promise,fetchedInlineStylesPromise.promise,fetchedComputedStylesPromise.promise]).then(()=>{this._pendingRefreshTask=null;});return this._pendingRefreshTask;}
addRule(selector,text,styleSheetId)
{selector=selector||this._node.appropriateSelectorFor(true);function completed()
{DOMAgent.markUndoableState();this.refresh();}
function styleChanged(error,stylePayload)
{if(error)
return;completed.call(this);}
function addedRule(error,rulePayload)
{if(error)
return;if(!text||!text.length){completed.call(this);return;}
CSSAgent.setStyleText(rulePayload.style.styleId,text,styleChanged.bind(this));}
if(!CSSAgent.createStyleSheet){CSSAgent.addRule.invoke({contextNodeId:this._node.id,selector},addedRule.bind(this));return;}
function inspectorStyleSheetAvailable(styleSheet)
{if(!styleSheet)
return;CSSAgent.addRule(styleSheet.id,selector,addedRule.bind(this));}
if(styleSheetId)
inspectorStyleSheetAvailable.call(this,WebInspector.cssStyleManager.styleSheetForIdentifier(styleSheetId));else
WebInspector.cssStyleManager.preferredInspectorStyleSheetForFrame(this._node.frame,inspectorStyleSheetAvailable.bind(this));}
rulesForSelector(selector)
{selector=selector||this._node.appropriateSelectorFor(true);function ruleHasSelector(rule){return!rule.mediaList.length&&rule.selectorText===selector;}
let rules=this._matchedRules.filter(ruleHasSelector);for(let id in this._pseudoElements)
rules=rules.concat(this._pseudoElements[id].matchedRules.filter(ruleHasSelector));return rules;}
get matchedRules()
{return this._matchedRules;}
get inheritedRules()
{return this._inheritedRules;}
get inlineStyle()
{return this._inlineStyle;}
get attributesStyle()
{return this._attributesStyle;}
get pseudoElements()
{return this._pseudoElements;}
get computedStyle()
{return this._computedStyle;}
get orderedStyles()
{return this._orderedStyles;}
effectivePropertyForName(name)
{let property=this._propertyNameToEffectivePropertyMap[name];if(property)
return property;let canonicalName=WebInspector.cssStyleManager.canonicalNameForPropertyName(name);return this._propertyNameToEffectivePropertyMap[canonicalName]||null;}
mediaQueryResultDidChange()
{this._markAsNeedsRefresh();}
pseudoClassesDidChange(node)
{this._includeUserAgentRulesOnNextRefresh=true;this._markAsNeedsRefresh();}
attributeDidChange(node,attributeName)
{this._markAsNeedsRefresh();}
changeRule(rule,selector,text)
{if(!rule)
return;selector=selector||"";function changeCompleted()
{DOMAgent.markUndoableState();this.refresh();}
function styleChanged(error,stylePayload)
{if(error)
return;changeCompleted.call(this);}
function changeText(styleId)
{if(!text||!text.length){changeCompleted.call(this);return;}
CSSAgent.setStyleText(styleId,text,styleChanged.bind(this));}
function ruleSelectorChanged(error,rulePayload)
{if(error)
return;changeText.call(this,rulePayload.style.styleId);}
this._needsRefresh=true;this._ignoreNextContentDidChangeForStyleSheet=rule.ownerStyleSheet;CSSAgent.setRuleSelector(rule.id,selector,ruleSelectorChanged.bind(this));}
changeRuleSelector(rule,selector)
{selector=selector||"";let result=new WebInspector.WrappedPromise;function ruleSelectorChanged(error,rulePayload)
{if(error){result.reject(error);return;}
DOMAgent.markUndoableState();
this.refresh().then(()=>{result.resolve(rulePayload);});}
this._needsRefresh=true;this._ignoreNextContentDidChangeForStyleSheet=rule.ownerStyleSheet;CSSAgent.setRuleSelector(rule.id,selector,ruleSelectorChanged.bind(this));return result.promise;}
changeStyleText(style,text)
{if(!style.ownerStyleSheet||!style.styleSheetTextRange)
return;text=text||"";function styleChanged(error,stylePayload)
{if(error)
return;this.refresh();}
CSSAgent.setStyleText(style.id,text,styleChanged.bind(this));}
_createSourceCodeLocation(sourceURL,sourceLine,sourceColumn)
{if(!sourceURL)
return null;var sourceCode;if(this._node.ownerDocument){var mainResource=WebInspector.frameResourceManager.resourceForURL(this._node.ownerDocument.documentURL);if(mainResource){var parentFrame=mainResource.parentFrame;sourceCode=parentFrame.resourceForURL(sourceURL);}}
if(!sourceCode)
sourceCode=WebInspector.frameResourceManager.resourceForURL(sourceURL);if(!sourceCode)
return null;return sourceCode.createSourceCodeLocation(sourceLine||0,sourceColumn||0);}
_parseSourceRangePayload(payload)
{if(!payload)
return null;return new WebInspector.TextRange(payload.startLine,payload.startColumn,payload.endLine,payload.endColumn);}
_parseStylePropertyPayload(payload,index,styleDeclaration,styleText)
{var text=payload.text||"";var name=payload.name;var value=(payload.value||"").replace(/\s*!important\s*$/,"");var priority=payload.priority||"";var enabled=true;var overridden=false;var implicit=payload.implicit||false;var anonymous=false;var valid="parsedOk"in payload?payload.parsedOk:true;switch(payload.status||"style"){case"active":enabled=true;break;case"inactive":overridden=true;enabled=true;break;case"disabled":enabled=false;break;case"style":anonymous=true;break;}
var styleSheetTextRange=this._parseSourceRangePayload(payload.range);if(styleDeclaration){var property=isNaN(index)?styleDeclaration.propertyForName(name,true):styleDeclaration.properties[index];
if(property&&property.name===name&&(property.index===index||(isNaN(property.index)&&isNaN(index)))){property.update(text,name,value,priority,enabled,overridden,implicit,anonymous,valid,styleSheetTextRange);return property;}
var pendingProperties=styleDeclaration.pendingProperties;for(var i=0;i<pendingProperties.length;++i){var pendingProperty=pendingProperties[i];if(pendingProperty.name===name&&isNaN(pendingProperty.index)){pendingProperty.index=index;pendingProperty.update(text,name,value,priority,enabled,overridden,implicit,anonymous,valid,styleSheetTextRange);return pendingProperty;}}}
return new WebInspector.CSSProperty(index,text,name,value,priority,enabled,overridden,implicit,anonymous,valid,styleSheetTextRange);}
_parseStyleDeclarationPayload(payload,node,inherited,type,rule,updateAllStyles)
{if(!payload)
return null;rule=rule||null;inherited=inherited||false;var id=payload.styleId;var mapKey=id?id.styleSheetId+":"+id.ordinal:null;if(type===WebInspector.CSSStyleDeclaration.Type.Attribute)
mapKey=node.id+":attribute";var styleDeclaration=rule?rule.style:null;var styleDeclarations=[];var previousStyleDeclarationsMap=this._previousStyleDeclarationsMap||this._styleDeclarationsMap;if(mapKey&&mapKey in previousStyleDeclarationsMap){styleDeclarations=previousStyleDeclarationsMap[mapKey];if(updateAllStyles&&styleDeclarations.length){for(var i=0;i<styleDeclarations.length;++i){var styleDeclaration=styleDeclarations[i];this._parseStyleDeclarationPayload(payload,styleDeclaration.node,styleDeclaration.inherited,styleDeclaration.type,styleDeclaration.ownerRule);}
return null;}
if(!styleDeclaration){var filteredStyleDeclarations=styleDeclarations.filter(function(styleDeclaration){if(styleDeclaration.ownerRule){return false;}
if(styleDeclaration.node!==node)
return false;if(styleDeclaration.inherited!==inherited)
return false;return true;});styleDeclaration=filteredStyleDeclarations[0]||null;}}
if(previousStyleDeclarationsMap!==this._styleDeclarationsMap){styleDeclarations=mapKey&&mapKey in this._styleDeclarationsMap?this._styleDeclarationsMap[mapKey]:[];if(styleDeclaration&&!styleDeclarations.includes(styleDeclaration)){styleDeclarations.push(styleDeclaration);this._styleDeclarationsMap[mapKey]=styleDeclarations;}}
var shorthands={};for(var i=0;payload.shorthandEntries&&i<payload.shorthandEntries.length;++i){var shorthand=payload.shorthandEntries[i];shorthands[shorthand.name]=shorthand.value;}
var text=payload.cssText;var inheritedPropertyCount=0;var properties=[];for(var i=0;payload.cssProperties&&i<payload.cssProperties.length;++i){var propertyPayload=payload.cssProperties[i];if(inherited&&WebInspector.CSSProperty.isInheritedPropertyName(propertyPayload.name))
++inheritedPropertyCount;var property=this._parseStylePropertyPayload(propertyPayload,i,styleDeclaration,text);properties.push(property);}
var styleSheetTextRange=this._parseSourceRangePayload(payload.range);if(styleDeclaration){styleDeclaration.update(text,properties,styleSheetTextRange);return styleDeclaration;}
var styleSheet=id?WebInspector.cssStyleManager.styleSheetForIdentifier(id.styleSheetId):null;if(styleSheet){if(type===WebInspector.CSSStyleDeclaration.Type.Inline)
styleSheet.markAsInlineStyleAttributeStyleSheet();styleSheet.addEventListener(WebInspector.CSSStyleSheet.Event.ContentDidChange,this._styleSheetContentDidChange,this);}
if(inherited&&!inheritedPropertyCount)
return null;styleDeclaration=new WebInspector.CSSStyleDeclaration(this,styleSheet,id,type,node,inherited,text,properties,styleSheetTextRange);if(mapKey){styleDeclarations.push(styleDeclaration);this._styleDeclarationsMap[mapKey]=styleDeclarations;}
return styleDeclaration;}
_parseSelectorListPayload(selectorList)
{var selectors=selectorList.selectors;if(!selectors.length)
return[];if(typeof selectors[0]==="string"){return selectors.map(function(selectorText){return new WebInspector.CSSSelector(selectorText);});}
return selectors.map(function(selectorPayload){return new WebInspector.CSSSelector(selectorPayload.text,selectorPayload.specificity,selectorPayload.dynamic);});}
_parseRulePayload(payload,matchedSelectorIndices,node,inherited,ruleOccurrences)
{if(!payload)
return null;
var id=payload.ruleId||payload.style.styleId;var mapKey=id?id.styleSheetId+":"+id.ordinal+":"+(inherited?"I":"N")+":"+node.id:null;
var occurrence=0;if(mapKey){if(mapKey in ruleOccurrences)
occurrence=++ruleOccurrences[mapKey];else
ruleOccurrences[mapKey]=occurrence;mapKey+=":"+occurrence;}
var rule=null;var previousRulesMap=this._previousRulesMap||this._rulesMap;if(mapKey&&mapKey in previousRulesMap){rule=previousRulesMap[mapKey];if(previousRulesMap!==this._rulesMap){this._rulesMap[mapKey]=rule;}}
var style=this._parseStyleDeclarationPayload(payload.style,node,inherited,WebInspector.CSSStyleDeclaration.Type.Rule,rule);if(!style)
return null;var styleSheet=id?WebInspector.cssStyleManager.styleSheetForIdentifier(id.styleSheetId):null;var selectorText=payload.selectorList.text;var selectors=this._parseSelectorListPayload(payload.selectorList);var type=WebInspector.CSSStyleManager.protocolStyleSheetOriginToEnum(payload.origin);var sourceCodeLocation=null;var sourceRange=payload.selectorList.range;if(sourceRange)
sourceCodeLocation=this._createSourceCodeLocation(payload.sourceURL,sourceRange.startLine,sourceRange.startColumn);else{sourceCodeLocation=this._createSourceCodeLocation(payload.sourceURL,payload.sourceLine);}
if(styleSheet){if(!sourceCodeLocation&&styleSheet.isInspectorStyleSheet())
sourceCodeLocation=styleSheet.createSourceCodeLocation(sourceRange.startLine,sourceRange.startColumn)
sourceCodeLocation=styleSheet.offsetSourceCodeLocation(sourceCodeLocation);}
var mediaList=[];for(var i=0;payload.media&&i<payload.media.length;++i){var mediaItem=payload.media[i];var mediaType=WebInspector.CSSStyleManager.protocolMediaSourceToEnum(mediaItem.source);var mediaText=mediaItem.text;var mediaSourceCodeLocation=this._createSourceCodeLocation(mediaItem.sourceURL,mediaItem.sourceLine);if(styleSheet)
mediaSourceCodeLocation=styleSheet.offsetSourceCodeLocation(mediaSourceCodeLocation);mediaList.push(new WebInspector.CSSMedia(mediaType,mediaText,mediaSourceCodeLocation));}
if(rule){rule.update(sourceCodeLocation,selectorText,selectors,matchedSelectorIndices,style,mediaList);return rule;}
if(styleSheet)
styleSheet.addEventListener(WebInspector.CSSStyleSheet.Event.ContentDidChange,this._styleSheetContentDidChange,this);rule=new WebInspector.CSSRule(this,styleSheet,id,type,sourceCodeLocation,selectorText,selectors,matchedSelectorIndices,style,mediaList);if(mapKey)
this._rulesMap[mapKey]=rule;return rule;}
_markAsNeedsRefresh()
{this._needsRefresh=true;this.dispatchEventToListeners(WebInspector.DOMNodeStyles.Event.NeedsRefresh);}
_styleSheetContentDidChange(event)
{var styleSheet=event.target;if(!styleSheet)
return;if(styleSheet===this._ignoreNextContentDidChangeForStyleSheet){delete this._ignoreNextContentDidChangeForStyleSheet;return;}
this._markAsNeedsRefresh();}
_updateStyleCascade()
{var cascadeOrderedStyleDeclarations=this._collectStylesInCascadeOrder(this._matchedRules,this._inlineStyle,this._attributesStyle);for(var i=0;i<this._inheritedRules.length;++i){var inheritedStyleInfo=this._inheritedRules[i];var inheritedCascadeOrder=this._collectStylesInCascadeOrder(inheritedStyleInfo.matchedRules,inheritedStyleInfo.inlineStyle,null);cascadeOrderedStyleDeclarations=cascadeOrderedStyleDeclarations.concat(inheritedCascadeOrder);}
this._orderedStyles=cascadeOrderedStyleDeclarations;this._propertyNameToEffectivePropertyMap={};this._markOverriddenProperties(cascadeOrderedStyleDeclarations,this._propertyNameToEffectivePropertyMap);this._associateRelatedProperties(cascadeOrderedStyleDeclarations,this._propertyNameToEffectivePropertyMap);for(var pseudoIdentifier in this._pseudoElements){var pseudoElementInfo=this._pseudoElements[pseudoIdentifier];pseudoElementInfo.orderedStyles=this._collectStylesInCascadeOrder(pseudoElementInfo.matchedRules,null,null);this._markOverriddenProperties(pseudoElementInfo.orderedStyles);this._associateRelatedProperties(pseudoElementInfo.orderedStyles);}}
_collectStylesInCascadeOrder(matchedRules,inlineStyle,attributesStyle)
{var result=[];if(inlineStyle)
result.push(inlineStyle);var userAndUserAgentStyles=[];for(var i=0;i<matchedRules.length;++i){var rule=matchedRules[i];
switch(rule.type){case WebInspector.CSSStyleSheet.Type.Inspector:case WebInspector.CSSStyleSheet.Type.Author:result.push(rule.style);break;case WebInspector.CSSStyleSheet.Type.User:case WebInspector.CSSStyleSheet.Type.UserAgent:userAndUserAgentStyles.push(rule.style);break;}}
if(attributesStyle)
result.push(attributesStyle);result=result.concat(userAndUserAgentStyles);return result;}
_markOverriddenProperties(styles,propertyNameToEffectiveProperty)
{propertyNameToEffectiveProperty=propertyNameToEffectiveProperty||{};for(var i=0;i<styles.length;++i){var style=styles[i];var properties=style.properties;for(var j=0;j<properties.length;++j){var property=properties[j];if(!property.enabled||!property.valid){property.overridden=false;continue;}
if(style.inherited&&!property.inherited){property.overridden=false;continue;}
var canonicalName=property.canonicalName;if(canonicalName in propertyNameToEffectiveProperty){var effectiveProperty=propertyNameToEffectiveProperty[canonicalName];if(effectiveProperty.ownerStyle===property.ownerStyle){if(effectiveProperty.important&&!property.important){property.overridden=true;continue;}}else if(effectiveProperty.important||!property.important||effectiveProperty.ownerStyle.node!==property.ownerStyle.node){property.overridden=true;continue;}
if(!property.anonymous)
effectiveProperty.overridden=true;}
property.overridden=false;propertyNameToEffectiveProperty[canonicalName]=property;}}}
_associateRelatedProperties(styles,propertyNameToEffectiveProperty)
{for(var i=0;i<styles.length;++i){var properties=styles[i].properties;var knownShorthands={};for(var j=0;j<properties.length;++j){var property=properties[j];if(!property.valid)
continue;if(!WebInspector.CSSCompletions.cssNameCompletions.isShorthandPropertyName(property.name))
continue;if(knownShorthands[property.canonicalName]&&!knownShorthands[property.canonicalName].overridden){continue;}
knownShorthands[property.canonicalName]=property;}
for(var j=0;j<properties.length;++j){var property=properties[j];if(!property.valid)
continue;var shorthandProperty=null;if(!isEmptyObject(knownShorthands)){var possibleShorthands=WebInspector.CSSCompletions.cssNameCompletions.shorthandsForLonghand(property.canonicalName);for(var k=0;k<possibleShorthands.length;++k){if(possibleShorthands[k]in knownShorthands){shorthandProperty=knownShorthands[possibleShorthands[k]];break;}}}
if(!shorthandProperty||shorthandProperty.overridden!==property.overridden){property.relatedShorthandProperty=null;property.clearRelatedLonghandProperties();continue;}
shorthandProperty.addRelatedLonghandProperty(property);property.relatedShorthandProperty=shorthandProperty;if(propertyNameToEffectiveProperty&&propertyNameToEffectiveProperty[shorthandProperty.canonicalName]===shorthandProperty)
propertyNameToEffectiveProperty[property.canonicalName]=property;}}}
_isPropertyFoundInMatchingRules(propertyName)
{return this._orderedStyles.some((style)=>{return style.properties.some((property)=>property.name===propertyName);});}};WebInspector.DOMNodeStyles.Event={NeedsRefresh:"dom-node-styles-needs-refresh",Refreshed:"dom-node-styles-refreshed"};WebInspector.DOMSearchMatchObject=class DOMSearchMatchObject extends WebInspector.Object
{constructor(resource,domNode,title,searchTerm,textRange)
{super();this._resource=resource;this._domNode=domNode;this._title=title;this._searchTerm=searchTerm;this._sourceCodeTextRange=resource.createSourceCodeTextRange(textRange);}
static titleForDOMNode(domNode)
{switch(domNode.nodeType()){case Node.ELEMENT_NODE:var title="<"+domNode.nodeNameInCorrectCase();for(var attribute of domNode.attributes()){title+=" "+attribute.name;if(attribute.value.length)
title+="=\""+attribute.value+"\"";}
return title+">";case Node.TEXT_NODE:return"\""+domNode.nodeValue()+"\"";case Node.COMMENT_NODE:return"<!--"+domNode.nodeValue()+"-->";case Node.DOCUMENT_TYPE_NODE:var title="<!DOCTYPE "+domNode.nodeName();if(domNode.publicId){title+=" PUBLIC \""+domNode.publicId+"\"";if(domNode.systemId)
title+=" \""+domNode.systemId+"\"";}else if(domNode.systemId)
title+=" SYSTEM \""+domNode.systemId+"\"";return title+">";case Node.CDATA_SECTION_NODE:return"<![CDATA["+domNode+"]]>";case Node.PROCESSING_INSTRUCTION_NODE:var data=domNode.nodeValue();var dataString=data.length?" "+data:"";var title="<?"+domNode.nodeNameInCorrectCase()+dataString+"?>";return title;default:console.error("Unknown DOM node type: ",domNode.nodeType());return domNode.nodeNameInCorrectCase();}}
get resource()
{return this._resource;}
get domNode()
{return this._domNode;}
get title()
{return this._title;}
get className()
{if(!this._className)
this._className=this._generateClassName();return this._className;}
get searchTerm()
{return this._searchTerm;}
get sourceCodeTextRange()
{return this._sourceCodeTextRange;}
saveIdentityToCookie(cookie)
{cookie[WebInspector.DOMSearchMatchObject.URLCookieKey]=this._resource.url.hash;cookie[WebInspector.DOMSearchMatchObject.TitleKey]=this._title;var textRange=this._sourceCodeTextRange.textRange;cookie[WebInspector.DOMSearchMatchObject.TextRangeKey]=[textRange.startLine,textRange.startColumn,textRange.endLine,textRange.endColumn].join();}
_generateClassName()
{switch(this._domNode.nodeType()){case Node.ELEMENT_NODE:return WebInspector.DOMSearchMatchObject.DOMMatchElementIconStyleClassName;case Node.TEXT_NODE:return WebInspector.DOMSearchMatchObject.DOMMatchTextNodeIconStyleClassName;case Node.COMMENT_NODE:return WebInspector.DOMSearchMatchObject.DOMMatchCommentIconStyleClassName;case Node.DOCUMENT_TYPE_NODE:return WebInspector.DOMSearchMatchObject.DOMMatchDocumentTypeIconStyleClassName;case Node.CDATA_SECTION_NODE:return WebInspector.DOMSearchMatchObject.DOMMatchCharacterDataIconStyleClassName;case Node.PROCESSING_INSTRUCTION_NODE: return WebInspector.DOMSearchMatchObject.DOMMatchDocumentTypeIconStyleClassName;default:console.error("Unknown DOM node type: ",this._domNode.nodeType());return WebInspector.DOMSearchMatchObject.DOMMatchNodeIconStyleClassName;}}};WebInspector.DOMSearchMatchObject.DOMMatchElementIconStyleClassName="dom-match-element-icon";WebInspector.DOMSearchMatchObject.DOMMatchTextNodeIconStyleClassName="dom-match-text-node-icon";WebInspector.DOMSearchMatchObject.DOMMatchCommentIconStyleClassName="dom-match-comment-icon";WebInspector.DOMSearchMatchObject.DOMMatchDocumentTypeIconStyleClassName="dom-match-document-type-icon";WebInspector.DOMSearchMatchObject.DOMMatchCharacterDataIconStyleClassName="dom-match-character-data-icon";WebInspector.DOMSearchMatchObject.DOMMatchNodeIconStyleClassName="dom-match-node-icon";WebInspector.DOMSearchMatchObject.TypeIdentifier="dom-search-match-object";WebInspector.DOMSearchMatchObject.URLCookieKey="resource-url";WebInspector.DOMSearchMatchObject.TitleKey="title";WebInspector.DOMSearchMatchObject.TextRangeKey="text-range";WebInspector.DOMStorageObject=class DOMStorageObject extends WebInspector.Object
{constructor(id,host,isLocalStorage)
{super();this._id=id;this._host=host;this._isLocalStorage=isLocalStorage;this._entries=new Map;}
get id(){return this._id;}
get host(){return this._host;}
get entries(){return this._entries;}
saveIdentityToCookie(cookie)
{cookie[WebInspector.DOMStorageObject.HostCookieKey]=this.host;cookie[WebInspector.DOMStorageObject.LocalStorageCookieKey]=this.isLocalStorage();}
isLocalStorage()
{return this._isLocalStorage;}
getEntries(callback)
{function innerCallback(error,entries)
{if(error)
return;for(let[key,value]of entries){if(!key||!value)
continue;this._entries.set(key,value);}
callback(error,entries);}
DOMStorageAgent.getDOMStorageItems(this._id,innerCallback.bind(this));}
removeItem(key)
{DOMStorageAgent.removeDOMStorageItem(this._id,key);}
setItem(key,value)
{DOMStorageAgent.setDOMStorageItem(this._id,key,value);}
itemsCleared()
{this._entries.clear();this.dispatchEventToListeners(WebInspector.DOMStorageObject.Event.ItemsCleared);}
itemRemoved(key)
{this._entries.delete(key);this.dispatchEventToListeners(WebInspector.DOMStorageObject.Event.ItemRemoved,{key});}
itemAdded(key,value)
{this._entries.set(key,value);this.dispatchEventToListeners(WebInspector.DOMStorageObject.Event.ItemAdded,{key,value});}
itemUpdated(key,oldValue,value)
{this._entries.set(key,value);this.dispatchEventToListeners(WebInspector.DOMStorageObject.Event.ItemUpdated,{key,oldValue,value});}};WebInspector.DOMStorageObject.TypeIdentifier="dom-storage";WebInspector.DOMStorageObject.HostCookieKey="dom-storage-object-host";WebInspector.DOMStorageObject.LocalStorageCookieKey="dom-storage-object-local-storage";WebInspector.DOMStorageObject.Event={ItemsCleared:"dom-storage-object-items-cleared",ItemAdded:"dom-storage-object-item-added",ItemRemoved:"dom-storage-object-item-removed",ItemUpdated:"dom-storage-object-updated",};WebInspector.DOMTree=class DOMTree extends WebInspector.Object
{constructor(frame)
{super();this._frame=frame;this._rootDOMNode=null;this._requestIdentifier=0;this._contentFlowCollection=new WebInspector.Collection(WebInspector.Collection.TypeVerifier.ContentFlow);this._frame.addEventListener(WebInspector.Frame.Event.PageExecutionContextChanged,this._framePageExecutionContextChanged,this);WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.DocumentUpdated,this._documentUpdated,this);if(!this._frame.isMainFrame()){WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.NodeRemoved,this._nodeRemoved,this);this._frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange,this._frameMainResourceDidChange,this);}
WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.ContentFlowListWasUpdated,this._contentFlowListWasUpdated,this);WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.ContentFlowWasAdded,this._contentFlowWasAdded,this);WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.ContentFlowWasRemoved,this._contentFlowWasRemoved,this);}
get frame(){return this._frame;}
get contentFlowCollection(){return this._contentFlowCollection;}
disconnect()
{WebInspector.domTreeManager.removeEventListener(null,null,this);this._frame.removeEventListener(null,null,this);}
invalidate()
{this._rootDOMNode=null;
this._pendingRootDOMNodeRequests=null;if(this._invalidateTimeoutIdentifier)
return;function performInvalidate()
{this._invalidateTimeoutIdentifier=undefined;this.dispatchEventToListeners(WebInspector.DOMTree.Event.RootDOMNodeInvalidated);}
this._invalidateTimeoutIdentifier=setTimeout(performInvalidate.bind(this),0);}
requestRootDOMNode(callback)
{if(typeof callback!=="function")
return;if(this._rootDOMNode){callback(this._rootDOMNode);return;}
if(!this._frame.isMainFrame()&&!this._frame.pageExecutionContext){this._rootDOMNodeRequestWaitingForExecutionContext=true;if(!this._pendingRootDOMNodeRequests)
this._pendingRootDOMNodeRequests=[];this._pendingRootDOMNodeRequests.push(callback);return;}
if(this._pendingRootDOMNodeRequests){this._pendingRootDOMNodeRequests.push(callback);return;}
this._pendingRootDOMNodeRequests=[callback];this._requestRootDOMNode();}
requestContentFlowList()
{this.requestRootDOMNode(function(rootNode){WebInspector.domTreeManager.getNamedFlowCollection(rootNode.id);});}
_requestRootDOMNode()
{var requestIdentifier=++this._requestIdentifier;function rootObjectAvailable(error,result)
{if(!this._pendingRootDOMNodeRequests||requestIdentifier!==this._requestIdentifier)
return;if(error){console.error(JSON.stringify(error));this._rootDOMNode=null;dispatchCallbacks.call(this);return;}
var remoteObject=WebInspector.RemoteObject.fromPayload(result);remoteObject.pushNodeToFrontend(rootDOMNodeAvailable.bind(this,remoteObject));}
function rootDOMNodeAvailable(remoteObject,nodeId)
{remoteObject.release();if(!this._pendingRootDOMNodeRequests||requestIdentifier!==this._requestIdentifier)
return;if(!nodeId){this._rootDOMNode=null;dispatchCallbacks.call(this);return;}
this._rootDOMNode=WebInspector.domTreeManager.nodeForId(nodeId);if(!this._rootDOMNode){dispatchCallbacks.call(this);return;}
this._rootDOMNode.getChildNodes(dispatchCallbacks.bind(this));}
function mainDocumentAvailable(document)
{this._rootDOMNode=document;dispatchCallbacks.call(this);}
function dispatchCallbacks()
{if(!this._pendingRootDOMNodeRequests||requestIdentifier!==this._requestIdentifier)
return;for(var i=0;i<this._pendingRootDOMNodeRequests.length;++i)
this._pendingRootDOMNodeRequests[i](this._rootDOMNode);this._pendingRootDOMNodeRequests=null;}
if(this._frame.isMainFrame())
WebInspector.domTreeManager.requestDocument(mainDocumentAvailable.bind(this));else{var contextId=this._frame.pageExecutionContext.id;RuntimeAgent.evaluate.invoke({expression:appendWebInspectorSourceURL("document"),objectGroup:"",includeCommandLineAPI:false,doNotPauseOnExceptionsAndMuteConsole:true,contextId,returnByValue:false,generatePreview:false},rootObjectAvailable.bind(this));}}
_nodeRemoved(event)
{if(event.data.node!==this._rootDOMNode)
return;this.invalidate();}
_documentUpdated(event)
{this.invalidate();}
_frameMainResourceDidChange(event)
{this.invalidate();}
_framePageExecutionContextChanged(event)
{if(this._rootDOMNodeRequestWaitingForExecutionContext){this._rootDOMNodeRequestWaitingForExecutionContext=false;this._requestRootDOMNode();}}
_isContentFlowInCurrentDocument(flow)
{return this._rootDOMNode&&this._rootDOMNode.id===flow.documentNodeIdentifier;}
_contentFlowListWasUpdated(event)
{if(!this._rootDOMNode||this._rootDOMNode.id!==event.data.documentNodeIdentifier)
return;let deletedFlows=new Set(this._contentFlowCollection.items);let newFlows=new Set;for(let flow of event.data.flows){if(this._contentFlowCollection.items.has(flow)){deletedFlows.delete(flow);}else{this._contentFlowCollection.add(flow);newFlows.add(flow);}}
for(let flow of deletedFlows)
this._contentFlowCollection.remove(flow);for(let flow of deletedFlows)
this.dispatchEventToListeners(WebInspector.DOMTree.Event.ContentFlowWasRemoved,{flow});for(let flow of newFlows)
this.dispatchEventToListeners(WebInspector.DOMTree.Event.ContentFlowWasAdded,{flow});}
_contentFlowWasAdded(event)
{let flow=event.data.flow;if(!this._isContentFlowInCurrentDocument(flow))
return;this._contentFlowCollection.add(flow);this.dispatchEventToListeners(WebInspector.DOMTree.Event.ContentFlowWasAdded,{flow});}
_contentFlowWasRemoved(event)
{let flow=event.data.flow;if(!this._isContentFlowInCurrentDocument(flow))
return;this._contentFlowCollection.remove(flow);this.dispatchEventToListeners(WebInspector.DOMTree.Event.ContentFlowWasRemoved,{flow});}};WebInspector.DOMTree.Event={RootDOMNodeInvalidated:"dom-tree-root-dom-node-invalidated",ContentFlowWasAdded:"dom-tree-content-flow-was-added",ContentFlowWasRemoved:"dom-tree-content-flow-was-removed"};WebInspector.DatabaseObject=class DatabaseObject extends WebInspector.Object
{constructor(id,host,name,version)
{super();this._id=id;this._host=host?host:WebInspector.UIString("Local File");this._name=name;this._version=version;}
get id(){return this._id;}
get host(){return this._host;}
get name(){return this._name;}
get version(){return this._version;}
saveIdentityToCookie(cookie)
{cookie[WebInspector.DatabaseObject.HostCookieKey]=this.host;cookie[WebInspector.DatabaseObject.NameCookieKey]=this.name;}
getTableNames(callback)
{function sortingCallback(error,names)
{if(!error)
callback(names.sort());}
DatabaseAgent.getDatabaseTableNames(this._id,sortingCallback);}
executeSQL(query,successCallback,errorCallback)
{function queryCallback(error,columnNames,values,sqlError)
{if(error){errorCallback(WebInspector.UIString("An unexpected error occurred."));return;}
if(sqlError){switch(sqlError.code){case SQLException.VERSION_ERR:errorCallback(WebInspector.UIString("Database no longer has expected version."));break;case SQLException.TOO_LARGE_ERR:errorCallback(WebInspector.UIString("Data returned from the database is too large."));break;default:errorCallback(WebInspector.UIString("An unexpected error occurred."));break;}
return;}
successCallback(columnNames,values);}
DatabaseAgent.executeSQL(this._id,query,queryCallback);}};WebInspector.DatabaseObject.TypeIdentifier="database";WebInspector.DatabaseObject.HostCookieKey="database-object-host";WebInspector.DatabaseObject.NameCookieKey="database-object-name";WebInspector.DatabaseTableObject=class DatabaseTableObject extends WebInspector.Object
{constructor(name,database)
{super();this._name=name;this._database=database;}
get name(){return this._name;}
get database(){return this._database;}
saveIdentityToCookie(cookie)
{cookie[WebInspector.DatabaseTableObject.NameCookieKey]=this.name;}};WebInspector.DatabaseTableObject.TypeIdentifier="database-table";WebInspector.DatabaseTableObject.NameCookieKey="database-table-object-name";WebInspector.DebuggerDashboard=class DebuggerDashboard extends WebInspector.Object
{};WebInspector.DebuggerData=class DebuggerData extends WebInspector.Object
{constructor(target)
{super();this._target=target;this._paused=false;this._pausing=false;this._pauseReason=null;this._pauseData=null;this._callFrames=[];this._asyncStackTrace=null;this._scriptIdMap=new Map;this._scriptContentIdentifierMap=new Map;this._makePausingAfterNextResume=false;}
get target(){return this._target;}
get paused(){return this._paused;}
get pausing(){return this._pausing;}
get pauseReason(){return this._pauseReason;}
get pauseData(){return this._pauseData;}
get callFrames(){return this._callFrames;}
get asyncStackTrace(){return this._asyncStackTrace;}
get scripts()
{return Array.from(this._scriptIdMap.values());}
scriptForIdentifier(id)
{return this._scriptIdMap.get(id);}
scriptsForURL(url)
{return this._scriptContentIdentifierMap.get(url)||[];}
reset()
{this._scriptIdMap.clear();}
addScript(script)
{this._scriptIdMap.set(script.id,script);if(script.contentIdentifier){let scripts=this._scriptContentIdentifierMap.get(script.contentIdentifier);if(!scripts){scripts=[];this._scriptContentIdentifierMap.set(script.contentIdentifier,scripts);}
scripts.push(script);}}
pauseIfNeeded()
{if(this._paused||this._pausing)
return Promise.resolve();this._pausing=true;return this._target.DebuggerAgent.pause();}
resumeIfNeeded()
{if(!this._paused&&!this._pausing)
return Promise.resolve();this._pausing=false;return this._target.DebuggerAgent.resume();}
continueUntilNextRunLoop()
{if(!this._paused||this._pausing)
return Promise.resolve();
this._makePausingAfterNextResume=true;return this._target.DebuggerAgent.continueUntilNextRunLoop();}
updateForPause(callFrames,pauseReason,pauseData,asyncStackTrace)
{this._paused=true;this._pausing=false;this._pauseReason=pauseReason;this._pauseData=pauseData;this._callFrames=callFrames;this._asyncStackTrace=asyncStackTrace;this._makePausingAfterNextResume=false;}
updateForResume()
{this._paused=false;this._pausing=false;this._pauseReason=null;this._pauseData=null;this._callFrames=[];this._asyncStackTrace=null;if(this._makePausingAfterNextResume){this._makePausingAfterNextResume=false;this._pausing=true;}}};WebInspector.DefaultDashboard=class DefaultDashboard extends WebInspector.Object
{constructor()
{super();this._waitingForFirstMainResourceToStartTrackingSize=true;WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange,this._mainResourceDidChange,this);WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.Event.CapturingStopped,this._capturingStopped,this);WebInspector.Frame.addEventListener(WebInspector.Frame.Event.ResourceWasAdded,this._resourceWasAdded,this);WebInspector.Target.addEventListener(WebInspector.Target.Event.ResourceAdded,this._resourceWasAdded,this);WebInspector.frameResourceManager.addEventListener(WebInspector.FrameResourceManager.Event.FrameWasAdded,this._frameWasAdded,this);var logManager=WebInspector.logManager;logManager.addEventListener(WebInspector.LogManager.Event.Cleared,this._consoleWasCleared,this);logManager.addEventListener(WebInspector.LogManager.Event.MessageAdded,this._consoleMessageAdded,this);logManager.addEventListener(WebInspector.LogManager.Event.PreviousMessageRepeatCountUpdated,this._consoleMessageWasRepeated,this);this._resourcesCount=0;this._resourcesSize=0;this._time=0;this._logs=0;this._errors=0;this._issues=0;}
get resourcesCount()
{return this._resourcesCount;}
set resourcesCount(value)
{this._resourcesCount=value;this._dataDidChange();}
get resourcesSize()
{return this._resourcesSize;}
set resourcesSize(value)
{this._resourcesSize=value;this._dataDidChange();}
get time()
{return this._time;}
set time(value)
{this._time=value;this._dataDidChange();}
get logs()
{return this._logs;}
set logs(value)
{this._logs=value;this._dataDidChange();}
get errors()
{return this._errors;}
set errors(value)
{this._errors=value;this._dataDidChange();}
get issues()
{return this._issues;}
set issues(value)
{this._issues=value;this._dataDidChange();}
_dataDidChange()
{this.dispatchEventToListeners(WebInspector.DefaultDashboard.Event.DataDidChange);}
_mainResourceDidChange(event)
{if(!event.target.isMainFrame())
return;this._time=0;this._resourcesCount=1;this._resourcesSize=WebInspector.frameResourceManager.mainFrame.mainResource.size||0;if(this._waitingForFirstMainResourceToStartTrackingSize){this._waitingForFirstMainResourceToStartTrackingSize=false;WebInspector.Resource.addEventListener(WebInspector.Resource.Event.SizeDidChange,this._resourceSizeDidChange,this);}
this._dataDidChange();this._startUpdatingTime();}
_capturingStopped(event)
{this._stopUpdatingTime();}
_resourceWasAdded(event)
{++this.resourcesCount;}
_frameWasAdded(event)
{++this.resourcesCount;}
_resourceSizeDidChange(event)
{if(event.target.urlComponents.scheme==="data")
return;this.resourcesSize+=event.target.size-event.data.previousSize;}
_startUpdatingTime()
{this._stopUpdatingTime();this.time=0;this._timelineBaseTime=Date.now();this._timeIntervalDelay=50;this._timeIntervalIdentifier=setInterval(this._updateTime.bind(this),this._timeIntervalDelay);}
_stopUpdatingTime()
{if(!this._timeIntervalIdentifier)
return;clearInterval(this._timeIntervalIdentifier);this._timeIntervalIdentifier=undefined;}
_updateTime()
{var duration=Date.now()-this._timelineBaseTime;var timeIntervalDelay=this._timeIntervalDelay;if(duration>=1000)
timeIntervalDelay=100;else if(duration>=60000)
timeIntervalDelay=1000;else if(duration>=3600000)
timeIntervalDelay=10000;if(timeIntervalDelay!==this._timeIntervalDelay){this._timeIntervalDelay=timeIntervalDelay;clearInterval(this._timeIntervalIdentifier);this._timeIntervalIdentifier=setInterval(this._updateTime.bind(this),this._timeIntervalDelay);}
var mainFrame=WebInspector.frameResourceManager.mainFrame;var mainFrameStartTime=mainFrame.mainResource.firstTimestamp;var mainFrameLoadEventTime=mainFrame.loadEventTimestamp;if(isNaN(mainFrameStartTime)||isNaN(mainFrameLoadEventTime)){this.time=duration/1000;return;}
this.time=mainFrameLoadEventTime-mainFrameStartTime;this._stopUpdatingTime();}
_consoleMessageAdded(event)
{var message=event.data.message;this._lastConsoleMessageType=message.level;this._incrementConsoleMessageType(message.level,message.repeatCount);}
_consoleMessageWasRepeated(event)
{this._incrementConsoleMessageType(this._lastConsoleMessageType,1);}
_incrementConsoleMessageType(type,increment)
{switch(type){case WebInspector.ConsoleMessage.MessageLevel.Log:case WebInspector.ConsoleMessage.MessageLevel.Info:case WebInspector.ConsoleMessage.MessageLevel.Debug:this.logs+=increment;break;case WebInspector.ConsoleMessage.MessageLevel.Warning:this.issues+=increment;break;case WebInspector.ConsoleMessage.MessageLevel.Error:this.errors+=increment;break;}}
_consoleWasCleared(event)
{this._logs=0;this._issues=0;this._errors=0;this._dataDidChange();}};WebInspector.DefaultDashboard.Event={DataDidChange:"default-dashboard-data-did-change"};WebInspector.ExecutionContext=class ExecutionContext extends WebInspector.Object
{constructor(target,id,name,isPageContext,frame)
{super();this._target=target;this._id=id;this._name=name;this._isPageContext=isPageContext||false;this._frame=frame||null;}
get target(){return this._target;}
get id(){return this._id;}
get name(){return this._name;}
get isPageContext(){return this._isPageContext;}
get frame(){return this._frame;}};WebInspector.ExecutionContextList=class ExecutionContextList extends WebInspector.Object
{constructor()
{super();this._contexts=[];this._pageExecutionContext=null;}
get pageExecutionContext()
{return this._pageExecutionContext;}
get contexts()
{return this._contexts;}
add(context)
{if(context.isPageContext&&this._pageExecutionContext){return false;}
this._contexts.push(context);if(context.isPageContext){this._pageExecutionContext=context;return true;}
return false;}
clear()
{this._contexts=[];this._pageExecutionContext=null;}};WebInspector.FPSInstrument=class FPSInstrument extends WebInspector.Instrument
{constructor()
{super();}
static supported()
{return window.TimelineAgent&&TimelineAgent.EventType.RenderingFrame;}
get timelineRecordType()
{return WebInspector.TimelineRecord.Type.RenderingFrame;}};WebInspector.Frame=class Frame extends WebInspector.Object
{constructor(id,name,securityOrigin,loaderIdentifier,mainResource)
{super();this._id=id;this._name=null;this._securityOrigin=null;this._resourceCollection=new WebInspector.ResourceCollection;this._provisionalResourceCollection=new WebInspector.ResourceCollection;this._extraScriptCollection=new WebInspector.Collection(WebInspector.Collection.TypeVerifier.Script);this._canvasCollection=new WebInspector.Collection(WebInspector.Collection.TypeVerifier.Canvas);this._childFrameCollection=new WebInspector.Collection(WebInspector.Collection.TypeVerifier.Frame);this._childFrameIdentifierMap=new Map;this._parentFrame=null;this._isMainFrame=false;this._domContentReadyEventTimestamp=NaN;this._loadEventTimestamp=NaN;this._executionContextList=new WebInspector.ExecutionContextList;this.initialize(name,securityOrigin,loaderIdentifier,mainResource);}
get resourceCollection(){return this._resourceCollection;}
get extraScriptCollection(){return this._extraScriptCollection;}
get canvasCollection(){return this._canvasCollection;}
get childFrameCollection(){return this._childFrameCollection;}
initialize(name,securityOrigin,loaderIdentifier,mainResource)
{var oldName=this._name;var oldSecurityOrigin=this._securityOrigin;var oldMainResource=this._mainResource;this._name=name||null;this._securityOrigin=securityOrigin||null;this._loaderIdentifier=loaderIdentifier||null;this._mainResource=mainResource;this._mainResource._parentFrame=this;if(oldMainResource&&this._mainResource!==oldMainResource)
this._disassociateWithResource(oldMainResource);this.removeAllResources();this.removeAllChildFrames();this.clearExecutionContexts();this.clearProvisionalLoad();if(this._mainResource!==oldMainResource)
this._dispatchMainResourceDidChangeEvent(oldMainResource);if(this._securityOrigin!==oldSecurityOrigin)
this.dispatchEventToListeners(WebInspector.Frame.Event.SecurityOriginDidChange,{oldSecurityOrigin});if(this._name!==oldName)
this.dispatchEventToListeners(WebInspector.Frame.Event.NameDidChange,{oldName});}
startProvisionalLoad(provisionalMainResource)
{this._provisionalMainResource=provisionalMainResource;this._provisionalMainResource._parentFrame=this;this._provisionalLoaderIdentifier=provisionalMainResource.loaderIdentifier;this._provisionalResourceCollection.clear();this.dispatchEventToListeners(WebInspector.Frame.Event.ProvisionalLoadStarted);}
commitProvisionalLoad(securityOrigin)
{if(!this._provisionalLoaderIdentifier)
return;var oldSecurityOrigin=this._securityOrigin;var oldMainResource=this._mainResource;this._securityOrigin=securityOrigin||null;this._loaderIdentifier=this._provisionalLoaderIdentifier;this._mainResource=this._provisionalMainResource;this._domContentReadyEventTimestamp=NaN;this._loadEventTimestamp=NaN;if(oldMainResource&&this._mainResource!==oldMainResource)
this._disassociateWithResource(oldMainResource);this.removeAllResources();this._resourceCollection=this._provisionalResourceCollection;this._provisionalResourceCollection=new WebInspector.ResourceCollection;this._extraScriptCollection.clear();this._canvasCollection.clear();this.clearExecutionContexts(true);this.clearProvisionalLoad(true);this.removeAllChildFrames();this.dispatchEventToListeners(WebInspector.Frame.Event.ProvisionalLoadCommitted);if(this._mainResource!==oldMainResource)
this._dispatchMainResourceDidChangeEvent(oldMainResource);if(this._securityOrigin!==oldSecurityOrigin)
this.dispatchEventToListeners(WebInspector.Frame.Event.SecurityOriginDidChange,{oldSecurityOrigin});}
clearProvisionalLoad(skipProvisionalLoadClearedEvent)
{if(!this._provisionalLoaderIdentifier)
return;this._provisionalLoaderIdentifier=null;this._provisionalMainResource=null;this._provisionalResourceCollection.clear();if(!skipProvisionalLoadClearedEvent)
this.dispatchEventToListeners(WebInspector.Frame.Event.ProvisionalLoadCleared);}
get id()
{return this._id;}
get loaderIdentifier()
{return this._loaderIdentifier;}
get provisionalLoaderIdentifier()
{return this._provisionalLoaderIdentifier;}
get name()
{return this._name;}
get securityOrigin()
{return this._securityOrigin;}
get url()
{return this._mainResource._url;}
get domTree()
{if(!this._domTree)
this._domTree=new WebInspector.DOMTree(this);return this._domTree;}
get pageExecutionContext()
{return this._executionContextList.pageExecutionContext;}
get executionContextList()
{return this._executionContextList;}
clearExecutionContexts(committingProvisionalLoad)
{if(this._executionContextList.contexts.length){let contexts=this._executionContextList.contexts.slice();this._executionContextList.clear();this.dispatchEventToListeners(WebInspector.Frame.Event.ExecutionContextsCleared,{committingProvisionalLoad:!!committingProvisionalLoad,contexts});}}
addExecutionContext(context)
{var changedPageContext=this._executionContextList.add(context);if(changedPageContext)
this.dispatchEventToListeners(WebInspector.Frame.Event.PageExecutionContextChanged);}
get mainResource()
{return this._mainResource;}
get provisionalMainResource()
{return this._provisionalMainResource;}
get parentFrame()
{return this._parentFrame;}
get domContentReadyEventTimestamp()
{return this._domContentReadyEventTimestamp;}
get loadEventTimestamp()
{return this._loadEventTimestamp;}
isMainFrame()
{return this._isMainFrame;}
markAsMainFrame()
{this._isMainFrame=true;}
unmarkAsMainFrame()
{this._isMainFrame=false;}
markDOMContentReadyEvent(timestamp)
{this._domContentReadyEventTimestamp=timestamp||NaN;}
markLoadEvent(timestamp)
{this._loadEventTimestamp=timestamp||NaN;}
isDetached()
{var frame=this;while(frame){if(frame.isMainFrame())
return false;frame=frame.parentFrame;}
return true;}
childFrameForIdentifier(frameId)
{return this._childFrameIdentifierMap.get(frameId)||null;}
addChildFrame(frame)
{if(!(frame instanceof WebInspector.Frame))
return;if(frame._parentFrame===this)
return;if(frame._parentFrame)
frame._parentFrame.removeChildFrame(frame);this._childFrameCollection.add(frame);this._childFrameIdentifierMap.set(frame._id,frame);frame._parentFrame=this;this.dispatchEventToListeners(WebInspector.Frame.Event.ChildFrameWasAdded,{childFrame:frame});}
removeChildFrame(frameOrFrameId)
{let childFrameId=frameOrFrameId;if(childFrameId instanceof WebInspector.Frame)
childFrameId=frameOrFrameId._id;
let childFrame=this.childFrameForIdentifier(childFrameId);if(!(childFrame instanceof WebInspector.Frame))
return;this._childFrameCollection.remove(childFrame);this._childFrameIdentifierMap.delete(childFrame._id);childFrame._detachFromParentFrame();this.dispatchEventToListeners(WebInspector.Frame.Event.ChildFrameWasRemoved,{childFrame});}
removeAllChildFrames()
{this._detachFromParentFrame();for(let childFrame of this._childFrameCollection.items)
childFrame.removeAllChildFrames();this._childFrameCollection.clear();this._childFrameIdentifierMap.clear();this.dispatchEventToListeners(WebInspector.Frame.Event.AllChildFramesRemoved);}
resourceForURL(url,recursivelySearchChildFrames)
{var resource=this._resourceCollection.resourceForURL(url);if(resource)
return resource;for(let childFrame of this._childFrameCollection.items){resource=childFrame.mainResource;if(resource.url===url)
return resource;}
if(!recursivelySearchChildFrames)
return null;for(let childFrame of this._childFrameCollection.items){resource=childFrame.resourceForURL(url,true);if(resource)
return resource;}
return null;}
resourceCollectionForType(type)
{return this._resourceCollection.resourceCollectionForType(type);}
addResource(resource)
{if(!(resource instanceof WebInspector.Resource))
return;if(resource.parentFrame===this)
return;if(resource.parentFrame)
resource.parentFrame.remove(resource);this._associateWithResource(resource);if(this._isProvisionalResource(resource)){this._provisionalResourceCollection.add(resource);this.dispatchEventToListeners(WebInspector.Frame.Event.ProvisionalResourceWasAdded,{resource});}else{this._resourceCollection.add(resource);this.dispatchEventToListeners(WebInspector.Frame.Event.ResourceWasAdded,{resource});}}
removeResource(resource)
{this._resourceCollection.remove(resource);this._disassociateWithResource(resource);this.dispatchEventToListeners(WebInspector.Frame.Event.ResourceWasRemoved,{resource});}
removeAllResources()
{let resources=this._resourceCollection.items;if(!resources.size)
return;for(let resource of resources)
this._disassociateWithResource(resource);this._resourceCollection.clear();this.dispatchEventToListeners(WebInspector.Frame.Event.AllResourcesRemoved);}
addExtraScript(script)
{this._extraScriptCollection.add(script);this.dispatchEventToListeners(WebInspector.Frame.Event.ExtraScriptAdded,{script});}
saveIdentityToCookie(cookie)
{cookie[WebInspector.Frame.MainResourceURLCookieKey]=this.mainResource.url.hash;cookie[WebInspector.Frame.IsMainFrameCookieKey]=this._isMainFrame;}
_detachFromParentFrame()
{if(this._domTree){this._domTree.disconnect();this._domTree=null;}
this._parentFrame=null;}
_isProvisionalResource(resource)
{return resource.loaderIdentifier&&this._provisionalLoaderIdentifier&&resource.loaderIdentifier===this._provisionalLoaderIdentifier;}
_associateWithResource(resource)
{if(resource._parentFrame)
return;resource._parentFrame=this;}
_disassociateWithResource(resource)
{if(resource.parentFrame!==this)
return;resource._parentFrame=null;}
_dispatchMainResourceDidChangeEvent(oldMainResource)
{this.dispatchEventToListeners(WebInspector.Frame.Event.MainResourceDidChange,{oldMainResource});}};WebInspector.Frame.Event={NameDidChange:"frame-name-did-change",SecurityOriginDidChange:"frame-security-origin-did-change",MainResourceDidChange:"frame-main-resource-did-change",ProvisionalLoadStarted:"frame-provisional-load-started",ProvisionalLoadCommitted:"frame-provisional-load-committed",ProvisionalLoadCleared:"frame-provisional-load-cleared",ProvisionalResourceWasAdded:"frame-provisional-resource-was-added",ResourceWasAdded:"frame-resource-was-added",ResourceWasRemoved:"frame-resource-was-removed",AllResourcesRemoved:"frame-all-resources-removed",ExtraScriptAdded:"frame-extra-script-added",ChildFrameWasAdded:"frame-child-frame-was-added",ChildFrameWasRemoved:"frame-child-frame-was-removed",AllChildFramesRemoved:"frame-all-child-frames-removed",PageExecutionContextChanged:"frame-page-execution-context-changed",ExecutionContextsCleared:"frame-execution-contexts-cleared"};WebInspector.Frame.TypeIdentifier="Frame";WebInspector.Frame.MainResourceURLCookieKey="frame-main-resource-url";WebInspector.Frame.IsMainFrameCookieKey="frame-is-main-frame";WebInspector.GarbageCollection=class GarbageCollection extends WebInspector.Object
{constructor(type,startTime,endTime)
{super();this._type=type;this._startTime=startTime;this._endTime=endTime;}
static fromPayload(payload)
{let type=WebInspector.GarbageCollection.Type.Full;if(payload.type===HeapAgent.GarbageCollectionType.Partial)
type=WebInspector.GarbageCollection.Type.Partial;return new WebInspector.GarbageCollection(type,payload.startTime,payload.endTime);}
get type(){return this._type;}
get startTime(){return this._startTime;}
get endTime(){return this._endTime;}
get duration()
{return this._endTime-this._startTime;}};WebInspector.GarbageCollection.Type={Partial:Symbol("Partial"),Full:Symbol("Full")};WebInspector.Point=class Point
{constructor(x,y)
{this.x=x||0;this.y=y||0;}
static fromEvent(event)
{return new WebInspector.Point(event.pageX,event.pageY);}
static fromEventInElement(event,element)
{var wkPoint=window.webkitConvertPointFromPageToNode(element,new WebKitPoint(event.pageX,event.pageY));return new WebInspector.Point(wkPoint.x,wkPoint.y);}
toString()
{return"WebInspector.Point["+this.x+","+this.y+"]";}
copy()
{return new WebInspector.Point(this.x,this.y);}
equals(anotherPoint)
{return this.x===anotherPoint.x&&this.y===anotherPoint.y;}
distance(anotherPoint)
{var dx=anotherPoint.x-this.x;var dy=anotherPoint.y-this.y;return Math.sqrt(dx*dx,dy*dy);}};WebInspector.Size=class Size
{constructor(width,height)
{this.width=width||0;this.height=height||0;}
toString()
{return"WebInspector.Size["+this.width+","+this.height+"]";}
copy()
{return new WebInspector.Size(this.width,this.height);}
equals(anotherSize)
{return this.width===anotherSize.width&&this.height===anotherSize.height;}};WebInspector.Size.ZERO_SIZE=new WebInspector.Size(0,0);WebInspector.Rect=class Rect
{constructor(x,y,width,height)
{this.origin=new WebInspector.Point(x||0,y||0);this.size=new WebInspector.Size(width||0,height||0);}
static rectFromClientRect(clientRect)
{return new WebInspector.Rect(clientRect.left,clientRect.top,clientRect.width,clientRect.height);}
static unionOfRects(rects)
{var union=rects[0];for(var i=1;i<rects.length;++i)
union=union.unionWithRect(rects[i]);return union;}
toString()
{return"WebInspector.Rect["+[this.origin.x,this.origin.y,this.size.width,this.size.height].join(", ")+"]";}
copy()
{return new WebInspector.Rect(this.origin.x,this.origin.y,this.size.width,this.size.height);}
equals(anotherRect)
{return this.origin.equals(anotherRect.origin)&&this.size.equals(anotherRect.size);}
inset(insets)
{return new WebInspector.Rect(this.origin.x+insets.left,this.origin.y+insets.top,this.size.width-insets.left-insets.right,this.size.height-insets.top-insets.bottom);}
pad(padding)
{return new WebInspector.Rect(this.origin.x-padding,this.origin.y-padding,this.size.width+padding*2,this.size.height+padding*2);}
minX()
{return this.origin.x;}
minY()
{return this.origin.y;}
midX()
{return this.origin.x+(this.size.width/2);}
midY()
{return this.origin.y+(this.size.height/2);}
maxX()
{return this.origin.x+this.size.width;}
maxY()
{return this.origin.y+this.size.height;}
intersectionWithRect(rect)
{var x1=Math.max(this.minX(),rect.minX());var x2=Math.min(this.maxX(),rect.maxX());if(x1>x2)
return WebInspector.Rect.ZERO_RECT;var intersection=new WebInspector.Rect;intersection.origin.x=x1;intersection.size.width=x2-x1;var y1=Math.max(this.minY(),rect.minY());var y2=Math.min(this.maxY(),rect.maxY());if(y1>y2)
return WebInspector.Rect.ZERO_RECT;intersection.origin.y=y1;intersection.size.height=y2-y1;return intersection;}
unionWithRect(rect)
{var x=Math.min(this.minX(),rect.minX());var y=Math.min(this.minY(),rect.minY());var width=Math.max(this.maxX(),rect.maxX())-x;var height=Math.max(this.maxY(),rect.maxY())-y;return new WebInspector.Rect(x,y,width,height);}
round()
{return new WebInspector.Rect(Math.floor(this.origin.x),Math.floor(this.origin.y),Math.ceil(this.size.width),Math.ceil(this.size.height));}};WebInspector.Rect.ZERO_RECT=new WebInspector.Rect(0,0,0,0);WebInspector.EdgeInsets=class EdgeInsets
{constructor(top,right,bottom,left)
{if(arguments.length===1){this.top=top;this.right=top;this.bottom=top;this.left=top;}else if(arguments.length===4){this.top=top;this.right=right;this.bottom=bottom;this.left=left;}}
equals(anotherInset)
{return this.top===anotherInset.top&&this.right===anotherInset.right&&this.bottom===anotherInset.bottom&&this.left===anotherInset.left;}
copy()
{return new WebInspector.EdgeInsets(this.top,this.right,this.bottom,this.left);}};WebInspector.RectEdge={MIN_X:0,MIN_Y:1,MAX_X:2,MAX_Y:3};WebInspector.Quad=class Quad
{constructor(quad)
{this.points=[new WebInspector.Point(quad[0],quad[1]), new WebInspector.Point(quad[2],quad[3]), new WebInspector.Point(quad[4],quad[5]), new WebInspector.Point(quad[6],quad[7])
];this.width=Math.round(Math.sqrt(Math.pow(quad[0]-quad[2],2)+Math.pow(quad[1]-quad[3],2)));this.height=Math.round(Math.sqrt(Math.pow(quad[0]-quad[6],2)+Math.pow(quad[1]-quad[7],2)));}
toProtocol()
{return[this.points[0].x,this.points[0].y,this.points[1].x,this.points[1].y,this.points[2].x,this.points[2].y,this.points[3].x,this.points[3].y];}};WebInspector.Polygon=class Polygon
{constructor(points)
{this.points=points;}
bounds()
{var minX=Number.MAX_VALUE;var minY=Number.MAX_VALUE;var maxX=-Number.MAX_VALUE;var maxY=-Number.MAX_VALUE;for(var point of this.points){minX=Math.min(minX,point.x);maxX=Math.max(maxX,point.x);minY=Math.min(minY,point.y);maxY=Math.max(maxY,point.y);}
return new WebInspector.Rect(minX,minY,maxX-minX,maxY-minY);}};WebInspector.CubicBezier=class CubicBezier
{constructor(x1,y1,x2,y2)
{this._inPoint=new WebInspector.Point(x1,y1);this._outPoint=new WebInspector.Point(x2,y2);this._curveInfo={x:{c:3.0*x1},y:{c:3.0*y1}};this._curveInfo.x.b=3.0*(x2-x1)-this._curveInfo.x.c;this._curveInfo.x.a=1.0-this._curveInfo.x.c-this._curveInfo.x.b;this._curveInfo.y.b=3.0*(y2-y1)-this._curveInfo.y.c;this._curveInfo.y.a=1.0-this._curveInfo.y.c-this._curveInfo.y.b;}
static fromCoordinates(coordinates)
{if(!coordinates||coordinates.length<4)
return null;coordinates=coordinates.map(Number);if(coordinates.includes(NaN))
return null;return new WebInspector.CubicBezier(coordinates[0],coordinates[1],coordinates[2],coordinates[3]);}
static fromString(text)
{if(!text||!text.length)
return null;var trimmedText=text.toLowerCase().replace(/\s/g,"");if(!trimmedText.length)
return null;if(Object.keys(WebInspector.CubicBezier.keywordValues).includes(trimmedText))
return WebInspector.CubicBezier.fromCoordinates(WebInspector.CubicBezier.keywordValues[trimmedText]);var matches=trimmedText.match(/^cubic-bezier\(([-\d.]+),([-\d.]+),([-\d.]+),([-\d.]+)\)$/);if(!matches)
return null;matches.splice(0,1);return WebInspector.CubicBezier.fromCoordinates(matches);}
get inPoint()
{return this._inPoint;}
get outPoint()
{return this._outPoint;}
copy()
{return new WebInspector.CubicBezier(this._inPoint.x,this._inPoint.y,this._outPoint.x,this._outPoint.y);}
toString()
{var values=[this._inPoint.x,this._inPoint.y,this._outPoint.x,this._outPoint.y];for(var key in WebInspector.CubicBezier.keywordValues){if(Array.shallowEqual(WebInspector.CubicBezier.keywordValues[key],values))
return key;}
return"cubic-bezier("+values.join(", ")+")";}
solve(x,epsilon)
{return this._sampleCurveY(this._solveCurveX(x,epsilon));}
_sampleCurveX(t)
{return((this._curveInfo.x.a*t+this._curveInfo.x.b)*t+this._curveInfo.x.c)*t;}
_sampleCurveY(t)
{return((this._curveInfo.y.a*t+this._curveInfo.y.b)*t+this._curveInfo.y.c)*t;}
_sampleCurveDerivativeX(t)
{return(3.0*this._curveInfo.x.a*t+2.0*this._curveInfo.x.b)*t+this._curveInfo.x.c;}
_solveCurveX(x,epsilon)
{var t0,t1,t2,x2,d2,i;for(t2=x,i=0;i<8;i++){x2=this._sampleCurveX(t2)-x;if(Math.abs(x2)<epsilon)
return t2;d2=this._sampleCurveDerivativeX(t2);if(Math.abs(d2)<1e-6)
break;t2=t2-x2/d2;}
t0=0.0;t1=1.0;t2=x;if(t2<t0)
return t0;if(t2>t1)
return t1;while(t0<t1){x2=this._sampleCurveX(t2);if(Math.abs(x2-x)<epsilon)
return t2;if(x>x2)
t0=t2;else
t1=t2;t2=(t1-t0)*0.5+t0;}
return t2;}};WebInspector.CubicBezier.keywordValues={"ease":[0.25,0.1,0.25,1],"ease-in":[0.42,0,1,1],"ease-out":[0,0,0.58,1],"ease-in-out":[0.42,0,0.58,1],"linear":[0,0,1,1]};WebInspector.Spring=class Spring
{constructor(mass,stiffness,damping,initialVelocity)
{this.mass=Math.max(1,mass);this.stiffness=Math.max(1,stiffness);this.damping=Math.max(0,damping);this.initialVelocity=initialVelocity;}
static fromValues(values)
{if(!values||values.length<4)
return null;values=values.map(Number);if(values.includes(NaN))
return null;return new WebInspector.Spring(...values);}
static fromString(text)
{if(!text||!text.length)
return null;let trimmedText=text.toLowerCase().trim();if(!trimmedText.length)
return null;let matches=trimmedText.match(/^spring\(([\d.]+)\s+([\d.]+)\s+([\d.]+)\s+([-\d.]+)\)$/);if(!matches)
return null;return WebInspector.Spring.fromValues(matches.slice(1));}
copy()
{return new WebInspector.Spring(this.mass,this.stiffness,this.damping,this.initialVelocity);}
toString()
{return`spring(${this.mass} ${this.stiffness} ${this.damping} ${this.initialVelocity})`;}
solve(t)
{let w0=Math.sqrt(this.stiffness/this.mass);let zeta=this.damping/(2*Math.sqrt(this.stiffness*this.mass));let wd=0;let A=1;let B=-this.initialVelocity+w0;if(zeta<1){wd=w0*Math.sqrt(1-zeta*zeta);A=1;B=(zeta*w0+-this.initialVelocity)/wd;}
if(zeta<1)
t=Math.exp(-t*zeta*w0)*(A*Math.cos(wd*t)+B*Math.sin(wd*t));else
t=(A+B*t)*Math.exp(-t*w0);return 1-t;}
calculateDuration(epsilon)
{epsilon=epsilon||0.0001;let t=0;let current=0;let minimum=Number.POSITIVE_INFINITY;while(current>=epsilon||minimum>=epsilon){current=Math.abs(1-this.solve(t)); if(minimum<epsilon&&current>=epsilon)
minimum=Number.POSITIVE_INFINITY; else if(current<minimum)
minimum=current;t+=0.1;}
return t;}};WebInspector.Gradient=class Gradient
{constructor(type,stops)
{this.type=type;this.stops=stops;}
static fromString(cssString)
{var type;var openingParenthesisIndex=cssString.indexOf("(");var typeString=cssString.substring(0,openingParenthesisIndex);if(typeString.indexOf(WebInspector.Gradient.Types.Linear)!==-1)
type=WebInspector.Gradient.Types.Linear;else if(typeString.indexOf(WebInspector.Gradient.Types.Radial)!==-1)
type=WebInspector.Gradient.Types.Radial;else
return null;var components=[];var currentParams=[];var currentParam="";var openParentheses=0;var ch=openingParenthesisIndex+1;var c=null;while(c=cssString[ch]){if(c==="(")
openParentheses++;if(c===")")
openParentheses--;var isComma=c===",";var isSpace=/\s/.test(c);if(openParentheses===0){if(isSpace){if(currentParam!=="")
currentParams.push(currentParam);currentParam="";}else if(isComma){currentParams.push(currentParam);components.push(currentParams);currentParams=[];currentParam="";}}
if(openParentheses===-1){currentParams.push(currentParam);components.push(currentParams);break;}
if(openParentheses>0||(!isComma&&!isSpace))
currentParam+=c;ch++;}
if(openParentheses!==-1)
return null;var gradient;if(type===WebInspector.Gradient.Types.Linear)
gradient=WebInspector.LinearGradient.fromComponents(components);else
gradient=WebInspector.RadialGradient.fromComponents(components);if(gradient)
gradient.repeats=typeString.startsWith("repeating");return gradient;}
static stopsWithComponents(components)
{var stops=components.map(function(component){while(component.length){var color=WebInspector.Color.fromString(component.shift());if(!color)
continue;var stop={color};if(component.length&&component[0].substr(-1)==="%")
stop.offset=parseFloat(component.shift())/100;return stop;}});if(!stops.length)
return null;for(var i=0,count=stops.length;i<count;++i){var stop=stops[i];
if(!stop)
return null;if(!stop.offset)
stop.offset=i/(count-1);}
return stops;}
stringFromStops(stops)
{var count=stops.length-1;return stops.map(function(stop,index){var str=stop.color;if(stop.offset!==index/count)
str+=" "+Math.round(stop.offset*10000)/100+"%";return str;}).join(", ");}
copy()
{}
toString()
{}};WebInspector.Gradient.Types={Linear:"linear-gradient",Radial:"radial-gradient"};WebInspector.LinearGradient=class LinearGradient extends WebInspector.Gradient
{constructor(angle,stops)
{super(WebInspector.Gradient.Types.Linear,stops);this._angle=angle;}
static fromComponents(components)
{let angle={value:180,units:WebInspector.LinearGradient.AngleUnits.DEG};if(components[0].length===1&&!WebInspector.Color.fromString(components[0][0])){let match=components[0][0].match(/([-\d\.]+)(\w+)/);if(!match||!Object.values(WebInspector.LinearGradient.AngleUnits).includes(match[2]))
return null;angle.value=parseFloat(match[1]);angle.units=match[2];components.shift();}else if(components[0][0]==="to"){components[0].shift();switch(components[0].sort().join(" ")){case"top":angle.value=0;break;case"right top":angle.value=45;break;case"right":angle.value=90;break;case"bottom right":angle.value=135;break;case"bottom":angle.value=180;break;case"bottom left":angle.value=225;break;case"left":angle.value=270;break;case"left top":angle.value=315;break;default:return null;}
components.shift();}else if(components[0].length!==1&&!WebInspector.Color.fromString(components[0][0])){
return null;}
var stops=WebInspector.Gradient.stopsWithComponents(components);if(!stops)
return null;return new WebInspector.LinearGradient(angle,stops);}
set angleValue(value){this._angle.value=value;}
get angleValue()
{return this._angle.value.maxDecimals(2);}
set angleUnits(units)
{if(units===this._angle.units)
return;this._angle.value=this._angleValueForUnits(units);this._angle.units=units;}
get angleUnits(){return this._angle.units;}
copy()
{return new WebInspector.LinearGradient(this._angle,this.stops.concat());}
toString()
{let str="";let deg=this._angleValueForUnits(WebInspector.LinearGradient.AngleUnits.DEG);if(deg===0)
str+="to top";else if(deg===45)
str+="to top right";else if(deg===90)
str+="to right";else if(deg===135)
str+="to bottom right";else if(deg===225)
str+="to bottom left";else if(deg===270)
str+="to left";else if(deg===315)
str+="to top left";else if(deg!==180)
str+=this.angleValue+this.angleUnits;if(str!=="")
str+=", ";str+=this.stringFromStops(this.stops);return(this.repeats?"repeating-":"")+this.type+"("+str+")";}
_angleValueForUnits(units)
{if(units===this._angle.units)
return this._angle.value;let deg=0;switch(this._angle.units){case WebInspector.LinearGradient.AngleUnits.DEG:deg=this._angle.value;break;case WebInspector.LinearGradient.AngleUnits.RAD:deg=this._angle.value*180/Math.PI;break;case WebInspector.LinearGradient.AngleUnits.GRAD:deg=this._angle.value/400*360;break;case WebInspector.LinearGradient.AngleUnits.TURN:deg=this._angle.value*360;break;default:WebInspector.reportInternalError(`Unknown angle units "${this._angle.units}"`);return 0;}
let value=0;switch(units){case WebInspector.LinearGradient.AngleUnits.DEG:value=deg;break;case WebInspector.LinearGradient.AngleUnits.RAD:value=deg*Math.PI/180;break;case WebInspector.LinearGradient.AngleUnits.GRAD:value=deg/360*400;break;case WebInspector.LinearGradient.AngleUnits.TURN:value=deg/360;break;}
return value;}};WebInspector.LinearGradient.AngleUnits={DEG:"deg",RAD:"rad",GRAD:"grad",TURN:"turn",};WebInspector.RadialGradient=class RadialGradient extends WebInspector.Gradient
{constructor(sizing,stops)
{super(WebInspector.Gradient.Types.Radial,stops);this.sizing=sizing;}
static fromComponents(components)
{var sizing=!WebInspector.Color.fromString(components[0].join(" "))?components.shift().join(" "):"";var stops=WebInspector.Gradient.stopsWithComponents(components);if(!stops)
return null;return new WebInspector.RadialGradient(sizing,stops);}
copy()
{return new WebInspector.RadialGradient(this.sizing,this.stops.concat());}
toString()
{var str=this.sizing;if(str!=="")
str+=", ";str+=this.stringFromStops(this.stops);return(this.repeats?"repeating-":"")+this.type+"("+str+")";}};WebInspector.HeapAllocationsInstrument=class HeapAllocationsInstrument extends WebInspector.Instrument
{constructor()
{super();this._snapshotIntervalIdentifier=undefined;}
static supported()
{return window.HeapAgent;}
get timelineRecordType()
{return WebInspector.TimelineRecord.Type.HeapAllocations;}
startInstrumentation(initiatedByBackend)
{if(!initiatedByBackend)
HeapAgent.startTracking();const snapshotInterval=10000;this._snapshotIntervalIdentifier=setInterval(this._takeHeapSnapshot.bind(this),snapshotInterval);}
stopInstrumentation(initiatedByBackend)
{if(!initiatedByBackend)
HeapAgent.stopTracking();window.clearInterval(this._snapshotIntervalIdentifier);this._snapshotIntervalIdentifier=undefined;}
_takeHeapSnapshot()
{HeapAgent.snapshot(function(error,timestamp,snapshotStringData){let workerProxy=WebInspector.HeapSnapshotWorkerProxy.singleton();workerProxy.createSnapshot(snapshotStringData,({objectId,snapshot:serializedSnapshot})=>{let snapshot=WebInspector.HeapSnapshotProxy.deserialize(objectId,serializedSnapshot);WebInspector.timelineManager.heapSnapshotAdded(timestamp,snapshot);});});}};WebInspector.HeapAllocationsTimelineRecord=class HeapAllocationsTimelineRecord extends WebInspector.TimelineRecord
{constructor(timestamp,heapSnapshot)
{super(WebInspector.TimelineRecord.Type.HeapAllocations,timestamp,timestamp);this._timestamp=timestamp;this._heapSnapshot=heapSnapshot;}
get timestamp(){return this._timestamp;}
get heapSnapshot(){return this._heapSnapshot;}};WebInspector.HeapSnapshotRootPath=class HeapSnapshotRootPath extends WebInspector.Object
{constructor(node,pathComponent,parent,isGlobalScope)
{super();this._node=node||null;this._parent=parent||null;this._pathComponent=typeof pathComponent==="string"?pathComponent:null;this._isGlobalScope=isGlobalScope||false;if(this._parent&&this._parent.isEmpty())
this._parent=null;}
static emptyPath()
{return new WebInspector.HeapSnapshotRootPath(null);}
static pathComponentForIndividualEdge(edge)
{switch(edge.type){case WebInspector.HeapSnapshotEdgeProxy.EdgeType.Internal:return null;case WebInspector.HeapSnapshotEdgeProxy.EdgeType.Index:return"["+edge.data+"]";case WebInspector.HeapSnapshotEdgeProxy.EdgeType.Property:case WebInspector.HeapSnapshotEdgeProxy.EdgeType.Variable:if(WebInspector.HeapSnapshotRootPath.canPropertyNameBeDotAccess(edge.data))
return edge.data;return"["+doubleQuotedString(edge.data)+"]";}}
static canPropertyNameBeDotAccess(propertyName)
{return/^(?![0-9])\w+$/.test(propertyName);}
get node(){return this._node;}
get parent(){return this._parent;}
get pathComponent(){return this._pathComponent;}
get rootNode()
{return this._parent?this._parent.rootNode:this._node;}
get fullPath()
{let components=[];for(let p=this;p&&p.pathComponent;p=p.parent)
components.push(p.pathComponent);components.reverse();return components.join("");}
isRoot()
{return!this._parent;}
isEmpty()
{return!this._node;}
isGlobalScope()
{return this._isGlobalScope;}
isPathComponentImpossible()
{return this._pathComponent&&this._pathComponent.startsWith("@");}
isFullPathImpossible()
{if(this.isEmpty())
return true;if(this.isPathComponentImpossible())
return true;if(this._parent)
return this._parent.isFullPathImpossible();return false;}
appendInternal(node)
{return new WebInspector.HeapSnapshotRootPath(node,WebInspector.HeapSnapshotRootPath.SpecialPathComponent.InternalPropertyName,this);}
appendArrayIndex(node,index)
{let component="["+index+"]";return new WebInspector.HeapSnapshotRootPath(node,component,this);}
appendPropertyName(node,propertyName)
{let component=WebInspector.HeapSnapshotRootPath.canPropertyNameBeDotAccess(propertyName)?"."+propertyName:"["+doubleQuotedString(propertyName)+"]";return new WebInspector.HeapSnapshotRootPath(node,component,this);}
appendVariableName(node,variableName)
{if(this._isGlobalScope)
return this.appendPropertyName(node,variableName);return new WebInspector.HeapSnapshotRootPath(node,variableName,this);}
appendGlobalScopeName(node,globalScopeName)
{return new WebInspector.HeapSnapshotRootPath(node,globalScopeName,this,true);}
appendEdge(edge)
{switch(edge.type){case WebInspector.HeapSnapshotEdgeProxy.EdgeType.Internal:return this.appendInternal(edge.to);case WebInspector.HeapSnapshotEdgeProxy.EdgeType.Index:return this.appendArrayIndex(edge.to,edge.data);case WebInspector.HeapSnapshotEdgeProxy.EdgeType.Property:return this.appendPropertyName(edge.to,edge.data);case WebInspector.HeapSnapshotEdgeProxy.EdgeType.Variable:return this.appendVariableName(edge.to,edge.data);}
console.error("Unexpected edge type",edge.type);}};WebInspector.HeapSnapshotRootPath.SpecialPathComponent={InternalPropertyName:"@internal",};WebInspector.IndexedDatabase=class IndexedDatabase extends WebInspector.Object
{constructor(name,securityOrigin,version,objectStores)
{super();this._name=name;this._securityOrigin=securityOrigin;this._host=parseSecurityOrigin(securityOrigin).host;this._version=version;this._objectStores=objectStores||[];for(var objectStore of this._objectStores)
objectStore.establishRelationship(this);}
get name(){return this._name;}
get securityOrigin(){return this._securityOrigin;}
get host(){return this._host;}
get version(){return this._version;}
get objectStores(){return this._objectStores;}
saveIdentityToCookie(cookie)
{cookie[WebInspector.IndexedDatabase.NameCookieKey]=this._name;cookie[WebInspector.IndexedDatabase.HostCookieKey]=this._host;}};WebInspector.IndexedDatabase.TypeIdentifier="indexed-database";WebInspector.IndexedDatabase.NameCookieKey="indexed-database-name";WebInspector.IndexedDatabase.HostCookieKey="indexed-database-host";WebInspector.IndexedDatabaseObjectStore=class IndexedDatabaseObjectStore extends WebInspector.Object
{constructor(name,keyPath,autoIncrement,indexes)
{super();this._name=name;this._keyPath=keyPath;this._autoIncrement=autoIncrement||false;this._indexes=indexes||[];this._parentDatabase=null;for(var index of this._indexes)
index.establishRelationship(this);}
get name(){return this._name;}
get keyPath(){return this._keyPath;}
get autoIncrement(){return this._autoIncrement;}
get parentDatabase(){return this._parentDatabase;}
get indexes(){return this._indexes;}
saveIdentityToCookie(cookie)
{cookie[WebInspector.IndexedDatabaseObjectStore.NameCookieKey]=this._name;cookie[WebInspector.IndexedDatabaseObjectStore.KeyPathCookieKey]=this._keyPath;}
establishRelationship(parentDatabase)
{this._parentDatabase=parentDatabase||null;}};WebInspector.IndexedDatabaseObjectStore.TypeIdentifier="indexed-database-object-store";WebInspector.IndexedDatabaseObjectStore.NameCookieKey="indexed-database-object-store-name";WebInspector.IndexedDatabaseObjectStore.KeyPathCookieKey="indexed-database-object-store-key-path";WebInspector.IndexedDatabaseObjectStoreIndex=class IndexedDatabaseObjectStoreIndex extends WebInspector.Object
{constructor(name,keyPath,unique,multiEntry)
{super();this._name=name;this._keyPath=keyPath;this._unique=unique||false;this._multiEntry=multiEntry||false;this._parentObjectStore=null;}
get name(){return this._name;}
get keyPath(){return this._keyPath;}
get unique(){return this._unique;}
get multiEntry(){return this._multiEntry;}
get parentObjectStore(){return this._parentObjectStore;}
saveIdentityToCookie(cookie)
{cookie[WebInspector.IndexedDatabaseObjectStoreIndex.NameCookieKey]=this._name;cookie[WebInspector.IndexedDatabaseObjectStoreIndex.KeyPathCookieKey]=this._keyPath;}
establishRelationship(parentObjectStore)
{this._parentObjectStore=parentObjectStore||null;}};WebInspector.IndexedDatabaseObjectStoreIndex.TypeIdentifier="indexed-database-object-store-index";WebInspector.IndexedDatabaseObjectStoreIndex.NameCookieKey="indexed-database-object-store-index-name";WebInspector.IndexedDatabaseObjectStoreIndex.KeyPathCookieKey="indexed-database-object-store-index-key-path";WebInspector.IssueMessage=class IssueMessage extends WebInspector.Object
{constructor(consoleMessage)
{super();this._consoleMessage=consoleMessage;this._text=this._issueText();switch(this._consoleMessage.source){case"javascript":
var prefixRegex=/^([^:]+): (?:DOM Exception \d+: )?/;var match=prefixRegex.exec(this._text);if(match&&match[1]in WebInspector.IssueMessage.Type._prefixTypeMap){this._type=WebInspector.IssueMessage.Type._prefixTypeMap[match[1]];this._text=this._text.substring(match[0].length);}else
this._type=WebInspector.IssueMessage.Type.OtherIssue;break;case"css":case"xml":this._type=WebInspector.IssueMessage.Type.PageIssue;break;case"network":this._type=WebInspector.IssueMessage.Type.NetworkIssue;break;case"security":this._type=WebInspector.IssueMessage.Type.SecurityIssue;break;case"console-api":case"storage":case"appcache":case"rendering":case"other":this._type=WebInspector.IssueMessage.Type.OtherIssue;break;default:console.error("Unknown issue source:",this._consoleMessage.source);this._type=WebInspector.IssueMessage.Type.OtherIssue;}
this._sourceCodeLocation=consoleMessage.sourceCodeLocation;if(this._sourceCodeLocation)
this._sourceCodeLocation.addEventListener(WebInspector.SourceCodeLocation.Event.DisplayLocationChanged,this._sourceCodeLocationDisplayLocationChanged,this);}
static displayName(type)
{switch(type){case WebInspector.IssueMessage.Type.SemanticIssue:return WebInspector.UIString("Semantic Issue");case WebInspector.IssueMessage.Type.RangeIssue:return WebInspector.UIString("Range Issue");case WebInspector.IssueMessage.Type.ReferenceIssue:return WebInspector.UIString("Reference Issue");case WebInspector.IssueMessage.Type.TypeIssue:return WebInspector.UIString("Type Issue");case WebInspector.IssueMessage.Type.PageIssue:return WebInspector.UIString("Page Issue");case WebInspector.IssueMessage.Type.NetworkIssue:return WebInspector.UIString("Network Issue");case WebInspector.IssueMessage.Type.SecurityIssue:return WebInspector.UIString("Security Issue");case WebInspector.IssueMessage.Type.OtherIssue:return WebInspector.UIString("Other Issue");default:console.error("Unknown issue message type:",type);return WebInspector.UIString("Other Issue");}}
get text(){return this._text;}
get type(){return this._type;}
get level(){return this._consoleMessage.level;}
get source(){return this._consoleMessage.source;}
get url(){return this._consoleMessage.url;}
get sourceCodeLocation(){return this._sourceCodeLocation;}
saveIdentityToCookie(cookie)
{cookie[WebInspector.IssueMessage.URLCookieKey]=this.url;cookie[WebInspector.IssueMessage.LineNumberCookieKey]=this._sourceCodeLocation?this._sourceCodeLocation.lineNumber:0;cookie[WebInspector.IssueMessage.ColumnNumberCookieKey]=this._sourceCodeLocation?this._sourceCodeLocation.columnNumber:0;}
_issueText()
{let parameters=this._consoleMessage.parameters;if(!parameters)
return this._consoleMessage.messageText;if(WebInspector.RemoteObject.type(parameters[0])!=="string")
return this._consoleMessage.messageText;function valueFormatter(obj)
{return obj.description;}
let formatters={};formatters.o=valueFormatter;formatters.s=valueFormatter;formatters.f=valueFormatter;formatters.i=valueFormatter;formatters.d=valueFormatter;function append(a,b)
{a+=b;return a;}
let result=String.format(parameters[0].description,parameters.slice(1),formatters,"",append);let resultText=result.formattedResult;for(let i=0;i<result.unusedSubstitutions.length;++i)
resultText+=" "+result.unusedSubstitutions[i].description;return resultText;}
_sourceCodeLocationDisplayLocationChanged(event)
{this.dispatchEventToListeners(WebInspector.IssueMessage.Event.DisplayLocationDidChange,event.data);}};WebInspector.IssueMessage.Level={Error:"error",Warning:"warning"};WebInspector.IssueMessage.Type={SemanticIssue:"issue-message-type-semantic-issue",RangeIssue:"issue-message-type-range-issue",ReferenceIssue:"issue-message-type-reference-issue",TypeIssue:"issue-message-type-type-issue",PageIssue:"issue-message-type-page-issue",NetworkIssue:"issue-message-type-network-issue",SecurityIssue:"issue-message-type-security-issue",OtherIssue:"issue-message-type-other-issue"};WebInspector.IssueMessage.TypeIdentifier="issue-message";WebInspector.IssueMessage.URLCookieKey="issue-message-url";WebInspector.IssueMessage.LineNumberCookieKey="issue-message-line-number";WebInspector.IssueMessage.ColumnNumberCookieKey="issue-message-column-number";WebInspector.IssueMessage.Event={LocationDidChange:"issue-message-location-did-change",DisplayLocationDidChange:"issue-message-display-location-did-change"};WebInspector.IssueMessage.Type._prefixTypeMap={"SyntaxError":WebInspector.IssueMessage.Type.SemanticIssue,"URIError":WebInspector.IssueMessage.Type.SemanticIssue,"EvalError":WebInspector.IssueMessage.Type.SemanticIssue,"INVALID_CHARACTER_ERR":WebInspector.IssueMessage.Type.SemanticIssue,"SYNTAX_ERR":WebInspector.IssueMessage.Type.SemanticIssue,"RangeError":WebInspector.IssueMessage.Type.RangeIssue,"INDEX_SIZE_ERR":WebInspector.IssueMessage.Type.RangeIssue,"DOMSTRING_SIZE_ERR":WebInspector.IssueMessage.Type.RangeIssue,"ReferenceError":WebInspector.IssueMessage.Type.ReferenceIssue,"HIERARCHY_REQUEST_ERR":WebInspector.IssueMessage.Type.ReferenceIssue,"INVALID_STATE_ERR":WebInspector.IssueMessage.Type.ReferenceIssue,"NOT_FOUND_ERR":WebInspector.IssueMessage.Type.ReferenceIssue,"WRONG_DOCUMENT_ERR":WebInspector.IssueMessage.Type.ReferenceIssue,"TypeError":WebInspector.IssueMessage.Type.TypeIssue,"INVALID_NODE_TYPE_ERR":WebInspector.IssueMessage.Type.TypeIssue,"TYPE_MISMATCH_ERR":WebInspector.IssueMessage.Type.TypeIssue,"SECURITY_ERR":WebInspector.IssueMessage.Type.SecurityIssue,"NETWORK_ERR":WebInspector.IssueMessage.Type.NetworkIssue,"ABORT_ERR":WebInspector.IssueMessage.Type.OtherIssue,"DATA_CLONE_ERR":WebInspector.IssueMessage.Type.OtherIssue,"INUSE_ATTRIBUTE_ERR":WebInspector.IssueMessage.Type.OtherIssue,"INVALID_ACCESS_ERR":WebInspector.IssueMessage.Type.OtherIssue,"INVALID_MODIFICATION_ERR":WebInspector.IssueMessage.Type.OtherIssue,"NAMESPACE_ERR":WebInspector.IssueMessage.Type.OtherIssue,"NOT_SUPPORTED_ERR":WebInspector.IssueMessage.Type.OtherIssue,"NO_DATA_ALLOWED_ERR":WebInspector.IssueMessage.Type.OtherIssue,"NO_MODIFICATION_ALLOWED_ERR":WebInspector.IssueMessage.Type.OtherIssue,"QUOTA_EXCEEDED_ERR":WebInspector.IssueMessage.Type.OtherIssue,"TIMEOUT_ERR":WebInspector.IssueMessage.Type.OtherIssue,"URL_MISMATCH_ERR":WebInspector.IssueMessage.Type.OtherIssue,"VALIDATION_ERR":WebInspector.IssueMessage.Type.OtherIssue};WebInspector.KeyboardShortcut=class KeyboardShortcut extends WebInspector.Object
{constructor(modifiers,key,callback,targetElement)
{super();if(typeof key==="string"){key=key[0].toUpperCase();key=new WebInspector.Key(key.charCodeAt(0),key);}
if(callback&&!targetElement)
targetElement=document;this._modifiers=modifiers||WebInspector.KeyboardShortcut.Modifier.None;this._key=key;this._targetElement=targetElement;this._callback=callback;this._disabled=false;this._implicitlyPreventsDefault=true;if(targetElement){var targetKeyboardShortcuts=targetElement._keyboardShortcuts;if(!targetKeyboardShortcuts)
targetKeyboardShortcuts=targetElement._keyboardShortcuts=[];targetKeyboardShortcuts.push(this);if(!WebInspector.KeyboardShortcut._registeredKeyDownListener){WebInspector.KeyboardShortcut._registeredKeyDownListener=true;window.addEventListener("keydown",WebInspector.KeyboardShortcut._handleKeyDown);}}}
static _handleKeyDown(event)
{if(event.defaultPrevented)
return;for(var targetElement=event.target;targetElement;targetElement=targetElement.parentNode){if(!targetElement._keyboardShortcuts)
continue;for(var i=0;i<targetElement._keyboardShortcuts.length;++i){var keyboardShortcut=targetElement._keyboardShortcuts[i];if(!keyboardShortcut.matchesEvent(event))
continue;if(!keyboardShortcut.callback)
continue;keyboardShortcut.callback(event,keyboardShortcut);if(keyboardShortcut.implicitlyPreventsDefault)
event.preventDefault();return;}}}
get modifiers()
{return this._modifiers;}
get key()
{return this._key;}
get displayName()
{var result="";if(this._modifiers&WebInspector.KeyboardShortcut.Modifier.Control)
result+="\u2303";if(this._modifiers&WebInspector.KeyboardShortcut.Modifier.Option)
result+=WebInspector.Platform.name==="mac"?"\u2325":"\u2387";if(this._modifiers&WebInspector.KeyboardShortcut.Modifier.Shift)
result+="\u21e7";if(this._modifiers&WebInspector.KeyboardShortcut.Modifier.Command)
result+="\u2318";result+=this._key.toString();return result;}
get callback()
{return this._callback;}
set callback(callback)
{this._callback=callback||null;}
get disabled()
{return this._disabled;}
set disabled(disabled)
{this._disabled=disabled||false;}
get implicitlyPreventsDefault()
{return this._implicitlyPreventsDefault;}
set implicitlyPreventsDefault(implicitly)
{this._implicitlyPreventsDefault=implicitly;}
unbind()
{this._disabled=true;if(!this._targetElement)
return;var targetKeyboardShortcuts=this._targetElement._keyboardShortcuts;if(!targetKeyboardShortcuts)
return;targetKeyboardShortcuts.remove(this);}
matchesEvent(event)
{if(this._disabled)
return false;if(this._key.keyCode!==event.keyCode)
return false;var eventModifiers=WebInspector.KeyboardShortcut.Modifier.None;if(event.shiftKey)
eventModifiers|=WebInspector.KeyboardShortcut.Modifier.Shift;if(event.ctrlKey)
eventModifiers|=WebInspector.KeyboardShortcut.Modifier.Control;if(event.altKey)
eventModifiers|=WebInspector.KeyboardShortcut.Modifier.Option;if(event.metaKey)
eventModifiers|=WebInspector.KeyboardShortcut.Modifier.Command;return this._modifiers===eventModifiers;}};WebInspector.Key=class Key
{constructor(keyCode,displayName)
{this._keyCode=keyCode;this._displayName=displayName;}
get keyCode()
{return this._keyCode;}
get displayName()
{return this._displayName;}
toString()
{return this._displayName;}};WebInspector.KeyboardShortcut.Modifier={None:0,Shift:1,Control:2,Option:4,Command:8,get CommandOrControl()
{return WebInspector.Platform.name==="mac"?this.Command:this.Control;}};WebInspector.KeyboardShortcut.Key={Backspace:new WebInspector.Key(8,"\u232b"),Tab:new WebInspector.Key(9,"\u21e5"),Enter:new WebInspector.Key(13,"\u21a9"),Escape:new WebInspector.Key(27,"\u238b"),Space:new WebInspector.Key(32,"Space"),PageUp:new WebInspector.Key(33,"\u21de"),PageDown:new WebInspector.Key(34,"\u21df"),End:new WebInspector.Key(35,"\u2198"),Home:new WebInspector.Key(36,"\u2196"),Left:new WebInspector.Key(37,"\u2190"),Up:new WebInspector.Key(38,"\u2191"),Right:new WebInspector.Key(39,"\u2192"),Down:new WebInspector.Key(40,"\u2193"),Delete:new WebInspector.Key(46,"\u2326"),Zero:new WebInspector.Key(48,"0"),F1:new WebInspector.Key(112,"F1"),F2:new WebInspector.Key(113,"F2"),F3:new WebInspector.Key(114,"F3"),F4:new WebInspector.Key(115,"F4"),F5:new WebInspector.Key(116,"F5"),F6:new WebInspector.Key(117,"F6"),F7:new WebInspector.Key(118,"F7"),F8:new WebInspector.Key(119,"F8"),F9:new WebInspector.Key(120,"F9"),F10:new WebInspector.Key(121,"F10"),F11:new WebInspector.Key(122,"F11"),F12:new WebInspector.Key(123,"F12"),Semicolon:new WebInspector.Key(186,";"),Plus:new WebInspector.Key(187,"+"),Comma:new WebInspector.Key(188,","),Minus:new WebInspector.Key(189,"-"),Period:new WebInspector.Key(190,"."),Slash:new WebInspector.Key(191,"/"),Apostrophe:new WebInspector.Key(192,"`"),LeftCurlyBrace:new WebInspector.Key(219,"{"),Backslash:new WebInspector.Key(220,"\\"),RightCurlyBrace:new WebInspector.Key(221,"}"),SingleQuote:new WebInspector.Key(222,"\'")};WebInspector.LayoutInstrument=class LayoutInstrument extends WebInspector.Instrument
{ get timelineRecordType()
{return WebInspector.TimelineRecord.Type.Layout;}};WebInspector.LayoutTimelineRecord=class LayoutTimelineRecord extends WebInspector.TimelineRecord
{constructor(eventType,startTime,endTime,callFrames,sourceCodeLocation,quad)
{super(WebInspector.TimelineRecord.Type.Layout,startTime,endTime,callFrames,sourceCodeLocation);if(eventType in WebInspector.LayoutTimelineRecord.EventType)
eventType=WebInspector.LayoutTimelineRecord.EventType[eventType];this._eventType=eventType;this._quad=quad||null;}
static displayNameForEventType(eventType)
{switch(eventType){case WebInspector.LayoutTimelineRecord.EventType.InvalidateStyles:return WebInspector.UIString("Styles Invalidated");case WebInspector.LayoutTimelineRecord.EventType.RecalculateStyles:return WebInspector.UIString("Styles Recalculated");case WebInspector.LayoutTimelineRecord.EventType.InvalidateLayout:return WebInspector.UIString("Layout Invalidated");case WebInspector.LayoutTimelineRecord.EventType.ForcedLayout:return WebInspector.UIString("Forced Layout");case WebInspector.LayoutTimelineRecord.EventType.Layout:return WebInspector.UIString("Layout");case WebInspector.LayoutTimelineRecord.EventType.Paint:return WebInspector.UIString("Paint");case WebInspector.LayoutTimelineRecord.EventType.Composite:return WebInspector.UIString("Composite");}}
get eventType()
{return this._eventType;}
get width()
{return this._quad?this._quad.width:NaN;}
get height()
{return this._quad?this._quad.height:NaN;}
get area()
{return this.width*this.height;}
get quad()
{return this._quad;}
saveIdentityToCookie(cookie)
{super.saveIdentityToCookie(cookie);cookie[WebInspector.LayoutTimelineRecord.EventTypeCookieKey]=this._eventType;}};WebInspector.LayoutTimelineRecord.EventType={InvalidateStyles:"layout-timeline-record-invalidate-styles",RecalculateStyles:"layout-timeline-record-recalculate-styles",InvalidateLayout:"layout-timeline-record-invalidate-layout",ForcedLayout:"layout-timeline-record-forced-layout",Layout:"layout-timeline-record-layout",Paint:"layout-timeline-record-paint",Composite:"layout-timeline-record-composite"};WebInspector.LayoutTimelineRecord.TypeIdentifier="layout-timeline-record";WebInspector.LayoutTimelineRecord.EventTypeCookieKey="layout-timeline-record-event-type";
WebInspector.LazySourceCodeLocation=class LazySourceCodeLocation extends WebInspector.SourceCodeLocation
{constructor(sourceCode,lineNumber,columnNumber)
{super(null,lineNumber,columnNumber);this._initialized=false;this._lazySourceCode=sourceCode;}
isEqual(other)
{if(!other)
return false;return this._lazySourceCode===other._sourceCode&&this._lineNumber===other._lineNumber&&this._columnNumber===other._columnNumber;}
get sourceCode()
{return this._lazySourceCode;}
set sourceCode(sourceCode)
{this.setSourceCode(sourceCode);}
get formattedLineNumber()
{this._lazyInitialization();return this._formattedLineNumber;}
get formattedColumnNumber()
{this._lazyInitialization();return this._formattedColumnNumber;}
formattedPosition()
{this._lazyInitialization();return new WebInspector.SourceCodePosition(this._formattedLineNumber,this._formattedColumnNumber);}
hasFormattedLocation()
{this._lazyInitialization();return super.hasFormattedLocation();}
hasDifferentDisplayLocation()
{this._lazyInitialization();return super.hasDifferentDisplayLocation();}
resolveMappedLocation()
{this._lazyInitialization();super.resolveMappedLocation();}
_lazyInitialization()
{if(!this._initialized){this._initialized=true;this.sourceCode=this._lazySourceCode;}}};WebInspector.LineWidget=class LineWidget extends WebInspector.Object
{constructor(codeMirrorLineWidget,widgetElement)
{super();this._codeMirrorLineWidget=codeMirrorLineWidget;this._widgetElement=widgetElement;}
get codeMirrorLineWidget()
{return this._codeMirrorLineWidget;}
get widgetElement()
{return this._widgetElement;}
clear()
{this._codeMirrorLineWidget.clear();}
update()
{if(this._codeMirrorLineWidget.update)
this._codeMirrorLineWidget.update();}};WebInspector.LogObject=class LogObject extends WebInspector.Object
{constructor()
{super();this._startDate=new Date;}
get startDate()
{return this._startDate;}};WebInspector.MemoryCategory=class MemoryCategory extends WebInspector.Object
{constructor(type,size)
{super();this.type=type;this.size=size;}};WebInspector.MemoryCategory.Type={JavaScript:"javascript",Images:"images",Layers:"layers",Page:"page",};WebInspector.MemoryInstrument=class MemoryInstrument extends WebInspector.Instrument
{constructor()
{super();}
static supported()
{return window.MemoryAgent;}
get timelineRecordType()
{return WebInspector.TimelineRecord.Type.Memory;}
startInstrumentation(initiatedByBackend)
{if(!initiatedByBackend)
MemoryAgent.startTracking();}
stopInstrumentation(initiatedByBackend)
{if(!initiatedByBackend)
MemoryAgent.stopTracking();}};WebInspector.MemoryPressureEvent=class MemoryPressureEvent extends WebInspector.Object
{constructor(timestamp,severity)
{super();this._timestamp=timestamp;this._severity=severity;}
static fromPayload(timestamp,protocolSeverity)
{let severity;switch(protocolSeverity){case MemoryAgent.MemoryPressureSeverity.Critical:severity=WebInspector.MemoryPressureEvent.Severity.Critical;break;case MemoryAgent.MemoryPressureSeverity.NonCritical:severity=WebInspector.MemoryPressureEvent.Severity.NonCritical;break;default:console.error("Unexpected memory pressure severity",protocolSeverity);severity=WebInspector.MemoryPressureEvent.Severity.NonCritical;break;}
return new WebInspector.MemoryPressureEvent(timestamp,severity);}
get timestamp(){return this._timestamp;}
get severity(){return this._severity;}};WebInspector.MemoryPressureEvent.Severity={Critical:Symbol("Critical"),NonCritical:Symbol("NonCritical"),};WebInspector.MemoryTimeline=class MemoryTimeline extends WebInspector.Timeline
{ get memoryPressureEvents(){return this._pressureEvents;}
addMemoryPressureEvent(memoryPressureEvent)
{this._pressureEvents.push(memoryPressureEvent);this.dispatchEventToListeners(WebInspector.MemoryTimeline.Event.MemoryPressureEventAdded,{memoryPressureEvent});}
reset(suppressEvents)
{super.reset(suppressEvents);this._pressureEvents=[];}};WebInspector.MemoryTimeline.Event={MemoryPressureEventAdded:"memory-timeline-memory-pressure-event-added",};WebInspector.MemoryTimelineRecord=class MemoryTimelineRecord extends WebInspector.TimelineRecord
{constructor(timestamp,categories)
{super(WebInspector.TimelineRecord.Type.Memory,timestamp,timestamp);this._timestamp=timestamp;this._categories=WebInspector.MemoryTimelineRecord.memoryCategoriesFromProtocol(categories);this._totalSize=0;for(let{size}of categories)
this._totalSize+=size;}
static memoryCategoriesFromProtocol(categories)
{let javascriptSize=0;let imagesSize=0;let layersSize=0;let pageSize=0;for(let{type,size}of categories){switch(type){case MemoryAgent.CategoryDataType.Javascript:case MemoryAgent.CategoryDataType.JIT:javascriptSize+=size;break;case MemoryAgent.CategoryDataType.Images:imagesSize+=size;break;case MemoryAgent.CategoryDataType.Layers:layersSize+=size;break;case MemoryAgent.CategoryDataType.Page:case MemoryAgent.CategoryDataType.Other:pageSize+=size;break;default:console.warn("Unhandled Memory.CategoryDataType: "+type);break;}}
return[{type:WebInspector.MemoryCategory.Type.JavaScript,size:javascriptSize},{type:WebInspector.MemoryCategory.Type.Images,size:imagesSize},{type:WebInspector.MemoryCategory.Type.Layers,size:layersSize},{type:WebInspector.MemoryCategory.Type.Page,size:pageSize},];}
get timestamp(){return this._timestamp;}
get categories(){return this._categories;}
get totalSize(){return this._totalSize;}};WebInspector.NativeConstructorFunctionParameters={Object:{assign:"target, ...sources",create:"prototype, [propertiesObject]",defineProperties:"object, properties",defineProperty:"object, propertyName, descriptor",freeze:"object",getOwnPropertyDescriptor:"object, propertyName",getOwnPropertyNames:"object",getOwnPropertySymbols:"object",getPrototypeOf:"object",is:"value1, value2",isExtensible:"object",isFrozen:"object",isSealed:"object",keys:"object",preventExtensions:"object",seal:"object",setPrototypeOf:"object, prototype",__proto__:null,},Array:{from:"arrayLike, [mapFunction], [thisArg]",isArray:"object",of:"[...values]",__proto__:null,},ArrayBuffer:{isView:"object",transfer:"oldBuffer, [newByteLength=length]",__proto__:null,},Number:{isFinite:"value",isInteger:"value",isNaN:"value",isSafeInteger:"value",parseFloat:"string",parseInt:"string, [radix]",__proto__:null,},Math:{abs:"x",acos:"x",acosh:"x",asin:"x",asinh:"x",atan2:"y, x",atan:"x",atanh:"x",cbrt:"x",ceil:"x",clz32:"x",cos:"x",cosh:"x",exp:"x",expm1:"x",floor:"x",fround:"x",hypot:"[...x]",imul:"x",log:"x",log1p:"x",log2:"x",log10:"x",max:"[...x]",min:"[...x]",pow:"x, y",round:"x",sign:"x",sin:"x",sinh:"x",sqrt:"x",tan:"x",tanh:"x",trunc:"x",__proto__:null,},JSON:{parse:"text, [reviver]",stringify:"value, [replacer], [space]",__proto__:null,},Date:{parse:"dateString",UTC:"year, [month], [day], [hour], [minute], [second], [ms]",__proto__:null,},Promise:{all:"iterable",race:"iterable",reject:"reason",resolve:"value",__proto__:null,},Reflect:{apply:"target, thisArgument, argumentsList",construct:"target, argumentsList, [newTarget=target]",defineProperty:"target, propertyKey, attributes",deleteProperty:"target, propertyKey",get:"target, propertyKey, [receiver]",getOwnPropertyDescriptor:"target, propertyKey",getPrototypeOf:"target",has:"target, propertyKey",isExtensible:"target",ownKeys:"target",preventExtensions:"target",set:"target, propertyKey, value, [receiver]",setPrototypeOf:"target, prototype",__proto__:null,},String:{fromCharCode:"...codeUnits",fromCodePoint:"...codePoints",raw:"template, ...substitutions",__proto__:null,},Symbol:{for:"key",keyFor:"symbol",__proto__:null,},Console:{assert:"condition, [message], [...values]",count:"[label]",debug:"message, [...values]",dir:"object",dirxml:"object",error:"message, [...values]",group:"[name]",groupCollapsed:"[name]",groupEnd:"[name]",info:"message, [...values]",log:"message, [...values]",profile:"name",profileEnd:"name",table:"data, [columns]",takeHeapSnapshot:"[label]",time:"name = \"default\"",timeEnd:"name = \"default\"",timeStamp:"[label]",trace:"message, [...values]",warn:"message, [...values]",__proto__:null,},IDBKeyRangeConstructor:{bound:"lower, upper, [lowerOpen], [upperOpen]",lowerBound:"lower, [open]",only:"value",upperBound:"upper, [open]",__proto__:null,},MediaSourceConstructor:{isTypeSupported:"type",__proto__:null,},MediaStreamTrackConstructor:{getSources:"callback",__proto__:null,},NotificationConstructor:{requestPermission:"[callback]",__proto__:null,},URLConstructor:{createObjectURL:"blob",revokeObjectURL:"url",__proto__:null,},WebKitMediaKeysConstructor:{isTypeSupported:"keySystem, [type]",__proto__:null,},};WebInspector.NativePrototypeFunctionParameters={Object:{__defineGetter__:"propertyName, getterFunction",__defineSetter__:"propertyName, setterFunction",__lookupGetter__:"propertyName",__lookupSetter__:"propertyName",hasOwnProperty:"propertyName",isPrototypeOf:"property",propertyIsEnumerable:"propertyName",__proto__:null,},Array:{concat:"value, ...",copyWithin:"targetIndex, startIndex, [endIndex=length]",every:"callback, [thisArg]",fill:"value, [startIndex=0], [endIndex=length]",filter:"callback, [thisArg]",find:"callback, [thisArg]",findIndex:"callback, [thisArg]",forEach:"callback, [thisArg]",includes:"searchValue, [startIndex=0]",indexOf:"searchValue, [startIndex=0]",join:"[separator=\",\"]",lastIndexOf:"searchValue, [startIndex=length]",map:"callback, [thisArg]",push:"value, ...",reduce:"callback, [initialValue]",reduceRight:"callback, [initialValue]",slice:"[startIndex=0], [endIndex=length]",some:"callback, [thisArg]",sort:"[compareFunction]",splice:"startIndex, [deleteCount=0], ...itemsToAdd",__proto__:null,},ArrayBuffer:{slice:"startIndex, [endIndex=byteLength]",__proto__:null,},DataView:{setInt8:"byteOffset, value",setInt16:"byteOffset, value, [littleEndian=false]",setInt23:"byteOffset, value, [littleEndian=false]",setUint8:"byteOffset, value",setUint16:"byteOffset, value, [littleEndian=false]",setUint32:"byteOffset, value, [littleEndian=false]",setFloat32:"byteOffset, value, [littleEndian=false]",setFloat64:"byteOffset, value, [littleEndian=false]",getInt8:"byteOffset",getInt16:"byteOffset, [littleEndian=false]",getInt23:"byteOffset, [littleEndian=false]",getUint8:"byteOffset",getUint16:"byteOffset, [littleEndian=false]",getUint32:"byteOffset, [littleEndian=false]",getFloat32:"byteOffset, [littleEndian=false]",getFloat64:"byteOffset, [littleEndian=false]",__proto__:null,},Date:{setDate:"day",setFullYear:"year, [month=getMonth()], [day=getDate()]",setHours:"hours, [minutes=getMinutes()], [seconds=getSeconds()], [ms=getMilliseconds()]",setMilliseconds:"ms",setMinutes:"minutes, [seconds=getSeconds()], [ms=getMilliseconds()]",setMonth:"month, [day=getDate()]",setSeconds:"seconds, [ms=getMilliseconds()]",setTime:"time",setUTCDate:"day",setUTCFullYear:"year, [month=getUTCMonth()], [day=getUTCDate()]",setUTCHours:"hours, [minutes=getUTCMinutes()], [seconds=getUTCSeconds()], [ms=getUTCMilliseconds()]",setUTCMilliseconds:"ms",setUTCMinutes:"minutes, [seconds=getUTCSeconds()], [ms=getUTCMilliseconds()]",setUTCMonth:"month, [day=getUTCDate()]",setUTCSeconds:"seconds, [ms=getUTCMilliseconds()]",setUTCTime:"time",setYear:"year",__proto__:null,},Function:{apply:"thisObject, [argumentsArray]",bind:"thisObject, ...arguments",call:"thisObject, ...arguments",__proto__:null,},Map:{delete:"key",forEach:"callback, [thisArg]",get:"key",has:"key",set:"key, value",__proto__:null,},Number:{toExponential:"[digits]",toFixed:"[digits]",toPrecision:"[significantDigits]",toString:"[radix=10]",__proto__:null,},RegExp:{compile:"pattern, flags",exec:"string",test:"string",__proto__:null,},Set:{delete:"value",forEach:"callback, [thisArg]",has:"value",add:"value",__proto__:null,},String:{charAt:"index",charCodeAt:"index",codePoints:"index",concat:"string, ...",includes:"searchValue, [startIndex=0]",indexOf:"searchValue, [startIndex=0]",lastIndexOf:"searchValue, [startIndex=length]",localeCompare:"string",match:"regex",repeat:"count",replace:"regex|string, replaceString|replaceHandler, [flags]",search:"regex",slice:"startIndex, [endIndex=length]",split:"[separator], [limit]",substr:"startIndex, [numberOfCharacters]",substring:"startIndex, [endIndex=length]",__proto__:null,},WeakMap:{delete:"key",get:"key",has:"key",set:"key, value",__proto__:null,},WeakSet:{delete:"value",has:"value",add:"value",__proto__:null,},Promise:{catch:"rejectionHandler",then:"resolvedHandler, rejectionHandler",__proto__:null,},Generator:{next:"value",return:"value",throw:"exception",__proto__:null,},Element:{closest:"selectors",getAttribute:"attributeName",getAttributeNS:"namespace, attributeName",getAttributeNode:"attributeName",getAttributeNodeNS:"namespace, attributeName",hasAttribute:"attributeName",hasAttributeNS:"namespace, attributeName",matches:"selector",removeAttribute:"attributeName",removeAttributeNS:"namespace, attributeName",removeAttributeNode:"attributeName",scrollIntoView:"[alignWithTop]",scrollIntoViewIfNeeded:"[centerIfNeeded]",setAttribute:"name, value",setAttributeNS:"namespace, name, value",setAttributeNode:"attributeNode",setAttributeNodeNS:"namespace, attributeNode",webkitMatchesSelector:"selectors",__proto__:null,},Node:{appendChild:"child",cloneNode:"[deep]",compareDocumentPosition:"[node]",contains:"[node]",insertBefore:"insertElement, referenceElement",isDefaultNamespace:"[namespace]",isEqualNode:"[node]",lookupNamespaceURI:"prefix",removeChild:"node",replaceChild:"newChild, oldChild",__proto__:null,},Window:{alert:"[message]",atob:"encodedData",btoa:"stringToEncode",cancelAnimationFrame:"id",clearInterval:"intervalId",clearTimeout:"timeoutId",confirm:"[message]",find:"string, [caseSensitive], [backwards], [wrapAround]",getComputedStyle:"[element], [pseudoElement]",getMatchedCSSRules:"[element], [pseudoElement]",matchMedia:"mediaQueryString",moveBy:"[deltaX], [deltaY]",moveTo:"[screenX], [screenY]",open:"url, windowName, [featuresString]",openDatabase:"name, version, displayName, estimatedSize, [creationCallback]",postMessage:"message, targetOrigin, [...transferables]",prompt:"[message], [value]",requestAnimationFrame:"callback",resizeBy:"[deltaX], [deltaY]",resizeTo:"[width], [height]",scrollBy:"[deltaX], [deltaY]",scrollTo:"[x], [y]",setInterval:"func, [delay], [...params]",setTimeout:"func, [delay], [...params]",showModalDialog:"url, [arguments], [options]",__proto__:null,},Document:{adoptNode:"[node]",caretRangeFromPoint:"[x], [y]",createAttribute:"attributeName",createAttributeNS:"namespace, qualifiedName",createCDATASection:"data",createComment:"data",createElement:"tagName",createElementNS:"namespace, qualifiedName",createEntityReference:"name",createEvent:"type",createExpression:"xpath, resolver",createNSResolver:"node",createNodeIterator:"root, whatToShow, filter",createProcessingInstruction:"target, data",createTextNode:"data",createTreeWalker:"root, whatToShow, filter, entityReferenceExpansion",elementFromPoint:"x, y",evaluate:"xpath, contextNode, namespaceResolver, resultType, result",execCommand:"command, userInterface, value",getCSSCanvasContext:"contextId, name, width, height",getElementById:"id",getElementsByName:"name",getOverrideStyle:"[element], [pseudoElement]",importNode:"node, deep",queryCommandEnabled:"command",queryCommandIndeterm:"command",queryCommandState:"command",queryCommandSupported:"command",queryCommandValue:"command",__proto__:null,},ANGLEInstancedArrays:{drawArraysInstancedANGLE:"mode, first, count, primcount",drawElementsInstancedANGLE:"mode, count, type, offset, primcount",vertexAttribDivisorANGLE:"index, divisor",__proto__:null,},AnalyserNode:{getByteFrequencyData:"array",getByteTimeDomainData:"array",getFloatFrequencyData:"array",__proto__:null,},AudioBuffer:{getChannelData:"channelIndex",__proto__:null,},AudioBufferCallback:{handleEvent:"audioBuffer",__proto__:null,},AudioBufferSourceNode:{noteGrainOn:"when, grainOffset, grainDuration",noteOff:"when",noteOn:"when",start:"[when], [grainOffset], [grainDuration]",stop:"[when]",__proto__:null,},AudioListener:{setOrientation:"x, y, z, xUp, yUp, zUp",setPosition:"x, y, z",setVelocity:"x, y, z",__proto__:null,},AudioNode:{connect:"destination, [output], [input]",disconnect:"[output]",__proto__:null,},AudioParam:{cancelScheduledValues:"startTime",exponentialRampToValueAtTime:"value, time",linearRampToValueAtTime:"value, time",setTargetAtTime:"target, time, timeConstant",setTargetValueAtTime:"targetValue, time, timeConstant",setValueAtTime:"value, time",setValueCurveAtTime:"values, time, duration",__proto__:null,},AudioTrackList:{getTrackById:"id",item:"index",__proto__:null,},BiquadFilterNode:{getFrequencyResponse:"frequencyHz, magResponse, phaseResponse",__proto__:null,},Blob:{slice:"[start], [end], [contentType]",__proto__:null,},CSS:{supports:"property, value",__proto__:null,},CSSKeyframesRule:{appendRule:"[rule]",deleteRule:"[key]",findRule:"[key]",insertRule:"[rule]",__proto__:null,},CSSMediaRule:{deleteRule:"[index]",insertRule:"[rule], [index]",__proto__:null,},CSSPrimitiveValue:{getFloatValue:"[unitType]",setFloatValue:"[unitType], [floatValue]",setStringValue:"[stringType], [stringValue]",__proto__:null,},CSSRuleList:{item:"[index]",__proto__:null,},CSSStyleDeclaration:{getPropertyCSSValue:"[propertyName]",getPropertyPriority:"[propertyName]",getPropertyShorthand:"[propertyName]",getPropertyValue:"[propertyName]",isPropertyImplicit:"[propertyName]",item:"[index]",removeProperty:"[propertyName]",setProperty:"[propertyName], [value], [priority]",__proto__:null,},CSSStyleSheet:{addRule:"[selector], [style], [index]",deleteRule:"[index]",insertRule:"[rule], [index]",removeRule:"[index]",__proto__:null,},CSSSupportsRule:{deleteRule:"[index]",insertRule:"[rule], [index]",__proto__:null,},CSSValueList:{item:"[index]",__proto__:null,},CanvasGradient:{addColorStop:"[offset], [color]",__proto__:null,},CanvasRenderingContext2D:{arc:"x, y, radius, startAngle, endAngle, [anticlockwise]",arcTo:"x1, y1, x2, y2, radius",bezierCurveTo:"cp1x, cp1y, cp2x, cp2y, x, y",clearRect:"x, y, width, height",clip:"path, [winding]",createImageData:"imagedata",createLinearGradient:"x0, y0, x1, y1",createPattern:"canvas, repetitionType",createRadialGradient:"x0, y0, r0, x1, y1, r1",drawFocusIfNeeded:"element",drawImage:"image, x, y",drawImageFromRect:"image, [sx], [sy], [sw], [sh], [dx], [dy], [dw], [dh], [compositeOperation]",ellipse:"x, y, radiusX, radiusY, rotation, startAngle, endAngle, [anticlockwise]",fill:"path, [winding]",fillRect:"x, y, width, height",fillText:"text, x, y, [maxWidth]",getImageData:"sx, sy, sw, sh",isPointInPath:"path, x, y, [winding]",isPointInStroke:"path, x, y",lineTo:"x, y",measureText:"text",moveTo:"x, y",putImageData:"imagedata, dx, dy",quadraticCurveTo:"cpx, cpy, x, y",rect:"x, y, width, height",rotate:"angle",scale:"sx, sy",setAlpha:"[alpha]",setCompositeOperation:"[compositeOperation]",setFillColor:"color, [alpha]",setLineCap:"[cap]",setLineDash:"dash",setLineJoin:"[join]",setLineWidth:"[width]",setMiterLimit:"[limit]",setShadow:"width, height, blur, [color], [alpha]",setStrokeColor:"color, [alpha]",setTransform:"m11, m12, m21, m22, dx, dy",stroke:"path",strokeRect:"x, y, width, height",strokeText:"text, x, y, [maxWidth]",transform:"m11, m12, m21, m22, dx, dy",translate:"tx, ty",webkitGetImageDataHD:"sx, sy, sw, sh",webkitPutImageDataHD:"imagedata, dx, dy",__proto__:null,},CharacterData:{appendData:"[data]",deleteData:"[offset], [length]",insertData:"[offset], [data]",replaceData:"[offset], [length], [data]",substringData:"[offset], [length]",__proto__:null,},CommandLineAPIHost:{copyText:"text",databaseId:"database",getEventListeners:"node",inspect:"objectId, hints",storageId:"storage",__proto__:null,},CompositionEvent:{initCompositionEvent:"[typeArg], [canBubbleArg], [cancelableArg], [viewArg], [dataArg]",__proto__:null,},Crypto:{getRandomValues:"array",__proto__:null,},CustomElementRegistry:{define:"name, constructor",get:"name",whenDefined:"name",__proto__:null,},CustomEvent:{initCustomEvent:"type, [bubbles], [cancelable], [detail]",__proto__:null,},DOMApplicationCache:{__proto__:null,},DOMImplementation:{createCSSStyleSheet:"[title], [media]",createDocument:"[namespaceURI], [qualifiedName], [doctype]",createDocumentType:"[qualifiedName], [publicId], [systemId]",createHTMLDocument:"[title]",hasFeature:"[feature], [version]",__proto__:null,},DOMParser:{parseFromString:"[str], [contentType]",__proto__:null,},DOMStringList:{contains:"[string]",item:"[index]",__proto__:null,},DOMTokenList:{add:"tokens...",contains:"token",item:"index",remove:"tokens...",toggle:"token, [force]",__proto__:null,},DataTransfer:{clearData:"[type]",getData:"type",setData:"type, data",setDragImage:"image, x, y",__proto__:null,},DataTransferItem:{getAsString:"[callback]",__proto__:null,},DataTransferItemList:{add:"file",item:"[index]",__proto__:null,},Database:{changeVersion:"oldVersion, newVersion, [callback], [errorCallback], [successCallback]",readTransaction:"callback, [errorCallback], [successCallback]",transaction:"callback, [errorCallback], [successCallback]",__proto__:null,},DatabaseCallback:{handleEvent:"database",__proto__:null,},DedicatedWorkerGlobalScope:{postMessage:"message, [messagePorts]",__proto__:null,},DeviceMotionEvent:{initDeviceMotionEvent:"[type], [bubbles], [cancelable], [acceleration], [accelerationIncludingGravity], [rotationRate], [interval]",__proto__:null,},DeviceOrientationEvent:{initDeviceOrientationEvent:"[type], [bubbles], [cancelable], [alpha], [beta], [gamma], [absolute]",__proto__:null,},DocumentFragment:{getElementById:"id",querySelector:"selectors",querySelectorAll:"selectors",__proto__:null,},Event:{initEvent:"type, [bubbles], [cancelable]",__proto__:null,},FileList:{item:"index",__proto__:null,},FileReader:{readAsArrayBuffer:"blob",readAsBinaryString:"blob",readAsDataURL:"blob",readAsText:"blob, [encoding]",__proto__:null,},FileReaderSync:{readAsArrayBuffer:"blob",readAsBinaryString:"blob",readAsDataURL:"blob",readAsText:"blob, [encoding]",__proto__:null,},FontFaceSet:{add:"font",check:"font, [text=\" \"]",delete:"font",load:"font, [text=\" \"]",__proto__:null,},FormData:{append:"[name], [value], [filename]",__proto__:null,},Geolocation:{clearWatch:"watchID",getCurrentPosition:"successCallback, [errorCallback], [options]",watchPosition:"successCallback, [errorCallback], [options]",__proto__:null,},HTMLAllCollection:{item:"[index]",namedItem:"name",tags:"name",__proto__:null,},HTMLButtonElement:{setCustomValidity:"error",__proto__:null,},HTMLCanvasElement:{getContext:"contextId",toDataURL:"[type]",__proto__:null,},HTMLCollection:{item:"[index]",namedItem:"[name]",__proto__:null,},HTMLDocument:{write:"[html]",writeln:"[html]",__proto__:null,},HTMLElement:{insertAdjacentElement:"[position], [element]",insertAdjacentHTML:"[position], [html]",insertAdjacentText:"[position], [text]",__proto__:null,},HTMLFieldSetElement:{setCustomValidity:"error",__proto__:null,},HTMLFormControlsCollection:{namedItem:"[name]",__proto__:null,},HTMLInputElement:{setCustomValidity:"error",setRangeText:"replacement",setSelectionRange:"start, end, [direction]",stepDown:"[n]",stepUp:"[n]",__proto__:null,},HTMLKeygenElement:{setCustomValidity:"error",__proto__:null,},HTMLMediaElement:{addTextTrack:"kind, [label], [language]",canPlayType:"[type], [keySystem]",fastSeek:"time",webkitAddKey:"keySystem, key, [initData], [sessionId]",webkitCancelKeyRequest:"keySystem, [sessionId]",webkitGenerateKeyRequest:"keySystem, [initData]",webkitSetMediaKeys:"mediaKeys",__proto__:null,},HTMLObjectElement:{setCustomValidity:"error",__proto__:null,},HTMLOptionsCollection:{add:"element, [before]",namedItem:"[name]",remove:"[index]",__proto__:null,},HTMLOutputElement:{setCustomValidity:"error",__proto__:null,},HTMLSelectElement:{add:"element, [before]",item:"index",namedItem:"[name]",setCustomValidity:"error",__proto__:null,},HTMLSlotElement:{assignedNodes:"[options]",__proto__:null,},HTMLTableElement:{deleteRow:"index",insertRow:"[index]",__proto__:null,},HTMLTableRowElement:{deleteCell:"index",insertCell:"[index]",__proto__:null,},HTMLTableSectionElement:{deleteRow:"index",insertRow:"[index]",__proto__:null,},HTMLTextAreaElement:{setCustomValidity:"error",setRangeText:"replacement",setSelectionRange:"[start], [end], [direction]",__proto__:null,},HTMLVideoElement:{webkitSetPresentationMode:"mode",webkitSupportsPresentationMode:"mode",__proto__:null,},HashChangeEvent:{initHashChangeEvent:"[type], [canBubble], [cancelable], [oldURL], [newURL]",__proto__:null,},History:{go:"[distance]",pushState:"data, title, [url]",replaceState:"data, title, [url]",__proto__:null,},IDBCursor:{advance:"count",continue:"[key]",update:"value",__proto__:null,},IDBDatabase:{createObjectStore:"name, [options]",deleteObjectStore:"name",transaction:"storeName, [mode]",__proto__:null,},IDBFactory:{cmp:"first, second",deleteDatabase:"name",open:"name, [version]",__proto__:null,},IDBIndex:{count:"[range]",get:"key",getKey:"key",openCursor:"[range], [direction]",openKeyCursor:"[range], [direction]",__proto__:null,},IDBObjectStore:{add:"value, [key]",count:"[range]",createIndex:"name, keyPath, [options]",delete:"keyRange",deleteIndex:"name",get:"key",index:"name",openCursor:"[range], [direction]",put:"value, [key]",__proto__:null,},IDBTransaction:{objectStore:"name",__proto__:null,},KeyboardEvent:{initKeyboardEvent:"[type], [canBubble], [cancelable], [view], [keyIdentifier], [location], [ctrlKey], [altKey], [shiftKey], [metaKey], [altGraphKey]",__proto__:null,},Location:{assign:"[url]",reload:"[force=false]",replace:"[url]",__proto__:null,},MediaController:{__proto__:null,},MediaControlsHost:{displayNameForTrack:"track",mediaUIImageData:"partID",setSelectedTextTrack:"track",sortedTrackListForMenu:"trackList",__proto__:null,},MediaList:{appendMedium:"[newMedium]",deleteMedium:"[oldMedium]",item:"[index]",__proto__:null,},MediaQueryList:{addListener:"[listener]",removeListener:"[listener]",__proto__:null,},MediaQueryListListener:{queryChanged:"[list]",__proto__:null,},MediaSource:{addSourceBuffer:"type",endOfStream:"[error]",removeSourceBuffer:"buffer",__proto__:null,},MediaStreamTrack:{applyConstraints:"constraints",__proto__:null,},MediaStreamTrackSourcesCallback:{handleEvent:"sources",__proto__:null,},MessageEvent:{initMessageEvent:"type, [bubbles], [cancelable], [data], [origin], [lastEventId], [source], [messagePorts]",__proto__:null,},MessagePort:{__proto__:null,},MimeTypeArray:{item:"[index]",namedItem:"[name]",__proto__:null,},MouseEvent:{initMouseEvent:"[type], [canBubble], [cancelable], [view], [detail], [screenX], [screenY], [clientX], [clientY], [ctrlKey], [altKey], [shiftKey], [metaKey], [button], [relatedTarget]",__proto__:null,},MutationEvent:{initMutationEvent:"[type], [canBubble], [cancelable], [relatedNode], [prevValue], [newValue], [attrName], [attrChange]",__proto__:null,},MutationObserver:{observe:"target, options",__proto__:null,},NamedNodeMap:{getNamedItem:"[name]",getNamedItemNS:"[namespaceURI], [localName]",item:"[index]",removeNamedItem:"[name]",removeNamedItemNS:"[namespaceURI], [localName]",setNamedItem:"[node]",setNamedItemNS:"[node]",__proto__:null,},Navigator:{getUserMedia:"options, successCallback, errorCallback",__proto__:null,},NavigatorUserMediaErrorCallback:{handleEvent:"error",__proto__:null,},NavigatorUserMediaSuccessCallback:{handleEvent:"stream",__proto__:null,},NodeFilter:{acceptNode:"[n]",__proto__:null,},NodeList:{item:"index",__proto__:null,},Notification:{__proto__:null,},NotificationCenter:{createNotification:"iconUrl, title, body",requestPermission:"[callback]",__proto__:null,},NotificationPermissionCallback:{handleEvent:"permission",__proto__:null,},OESVertexArrayObject:{bindVertexArrayOES:"[arrayObject]",deleteVertexArrayOES:"[arrayObject]",isVertexArrayOES:"[arrayObject]",__proto__:null,},OscillatorNode:{noteOff:"when",noteOn:"when",setPeriodicWave:"wave",start:"[when]",stop:"[when]",__proto__:null,},Path2D:{addPath:"path, [transform]",arc:"[x], [y], [radius], [startAngle], [endAngle], [anticlockwise]",arcTo:"[x1], [y1], [x2], [y2], [radius]",bezierCurveTo:"[cp1x], [cp1y], [cp2x], [cp2y], [x], [y]",ellipse:"x, y, radiusX, radiusY, rotation, startAngle, endAngle, [anticlockwise]",lineTo:"[x], [y]",moveTo:"[x], [y]",quadraticCurveTo:"[cpx], [cpy], [x], [y]",rect:"[x], [y], [width], [height]",__proto__:null,},Performance:{clearMarks:"[name]",clearMeasures:"name",getEntriesByName:"name, [type]",getEntriesByType:"type",mark:"name",measure:"name, [startMark], [endMark]",__proto__:null,},PerformanceObserver:{observe:"options",__proto__:null,},PerformanceObserverEntryList:{getEntriesByName:"name, [type]",getEntriesByType:"type",__proto__:null,},Plugin:{item:"[index]",namedItem:"[name]",__proto__:null,},PluginArray:{item:"[index]",namedItem:"[name]",refresh:"[reload]",__proto__:null,},PositionCallback:{handleEvent:"position",__proto__:null,},PositionErrorCallback:{handleEvent:"error",__proto__:null,},QuickTimePluginReplacement:{postEvent:"eventName",__proto__:null,},RTCDTMFSender:{insertDTMF:"tones, [duration], [interToneGap]",__proto__:null,},RTCDataChannel:{send:"data",__proto__:null,},RTCPeerConnectionErrorCallback:{handleEvent:"error",__proto__:null,},RTCSessionDescriptionCallback:{handleEvent:"sdp",__proto__:null,},RTCStatsCallback:{handleEvent:"response",__proto__:null,},RTCStatsReport:{stat:"name",__proto__:null,},RTCStatsResponse:{namedItem:"[name]",__proto__:null,},Range:{collapse:"[toStart]",compareBoundaryPoints:"[how], [sourceRange]",compareNode:"[refNode]",comparePoint:"[refNode], [offset]",createContextualFragment:"[html]",expand:"[unit]",insertNode:"[newNode]",intersectsNode:"[refNode]",isPointInRange:"[refNode], [offset]",selectNode:"[refNode]",selectNodeContents:"[refNode]",setEnd:"[refNode], [offset]",setEndAfter:"[refNode]",setEndBefore:"[refNode]",setStart:"[refNode], [offset]",setStartAfter:"[refNode]",setStartBefore:"[refNode]",surroundContents:"[newParent]",__proto__:null,},ReadableStream:{cancel:"reason",pipeThrough:"dest, options",pipeTo:"streams, options",__proto__:null,},WritableStream:{abort:"reason",close:"",write:"chunk",__proto__:null,},RequestAnimationFrameCallback:{handleEvent:"highResTime",__proto__:null,},SQLResultSetRowList:{item:"index",__proto__:null,},SQLStatementCallback:{handleEvent:"transaction, resultSet",__proto__:null,},SQLStatementErrorCallback:{handleEvent:"transaction, error",__proto__:null,},SQLTransaction:{executeSql:"sqlStatement, arguments, [callback], [errorCallback]",__proto__:null,},SQLTransactionCallback:{handleEvent:"transaction",__proto__:null,},SQLTransactionErrorCallback:{handleEvent:"error",__proto__:null,},SVGAngle:{convertToSpecifiedUnits:"unitType",newValueSpecifiedUnits:"unitType, valueInSpecifiedUnits",__proto__:null,},SVGAnimationElement:{beginElementAt:"[offset]",endElementAt:"[offset]",hasExtension:"[extension]",__proto__:null,},SVGColor:{setColor:"colorType, rgbColor, iccColor",setRGBColor:"rgbColor",setRGBColorICCColor:"rgbColor, iccColor",__proto__:null,},SVGCursorElement:{hasExtension:"[extension]",__proto__:null,},SVGDocument:{createEvent:"[eventType]",__proto__:null,},SVGElement:{getPresentationAttribute:"[name]",__proto__:null,},SVGFEDropShadowElement:{setStdDeviation:"[stdDeviationX], [stdDeviationY]",__proto__:null,},SVGFEGaussianBlurElement:{setStdDeviation:"[stdDeviationX], [stdDeviationY]",__proto__:null,},SVGFEMorphologyElement:{setRadius:"[radiusX], [radiusY]",__proto__:null,},SVGFilterElement:{setFilterRes:"[filterResX], [filterResY]",__proto__:null,},SVGGraphicsElement:{getTransformToElement:"[element]",hasExtension:"[extension]",__proto__:null,},SVGLength:{convertToSpecifiedUnits:"unitType",newValueSpecifiedUnits:"unitType, valueInSpecifiedUnits",__proto__:null,},SVGLengthList:{appendItem:"item",getItem:"index",initialize:"item",insertItemBefore:"item, index",removeItem:"index",replaceItem:"item, index",__proto__:null,},SVGMarkerElement:{setOrientToAngle:"[angle]",__proto__:null,},SVGMaskElement:{hasExtension:"[extension]",__proto__:null,},SVGMatrix:{multiply:"secondMatrix",rotate:"angle",rotateFromVector:"x, y",scale:"scaleFactor",scaleNonUniform:"scaleFactorX, scaleFactorY",skewX:"angle",skewY:"angle",translate:"x, y",__proto__:null,},SVGNumberList:{appendItem:"item",getItem:"index",initialize:"item",insertItemBefore:"item, index",removeItem:"index",replaceItem:"item, index",__proto__:null,},SVGPaint:{setPaint:"paintType, uri, rgbColor, iccColor",setUri:"uri",__proto__:null,},SVGPathElement:{createSVGPathSegArcAbs:"[x], [y], [r1], [r2], [angle], [largeArcFlag], [sweepFlag]",createSVGPathSegArcRel:"[x], [y], [r1], [r2], [angle], [largeArcFlag], [sweepFlag]",createSVGPathSegCurvetoCubicAbs:"[x], [y], [x1], [y1], [x2], [y2]",createSVGPathSegCurvetoCubicRel:"[x], [y], [x1], [y1], [x2], [y2]",createSVGPathSegCurvetoCubicSmoothAbs:"[x], [y], [x2], [y2]",createSVGPathSegCurvetoCubicSmoothRel:"[x], [y], [x2], [y2]",createSVGPathSegCurvetoQuadraticAbs:"[x], [y], [x1], [y1]",createSVGPathSegCurvetoQuadraticRel:"[x], [y], [x1], [y1]",createSVGPathSegCurvetoQuadraticSmoothAbs:"[x], [y]",createSVGPathSegCurvetoQuadraticSmoothRel:"[x], [y]",createSVGPathSegLinetoAbs:"[x], [y]",createSVGPathSegLinetoHorizontalAbs:"[x]",createSVGPathSegLinetoHorizontalRel:"[x]",createSVGPathSegLinetoRel:"[x], [y]",createSVGPathSegLinetoVerticalAbs:"[y]",createSVGPathSegLinetoVerticalRel:"[y]",createSVGPathSegMovetoAbs:"[x], [y]",createSVGPathSegMovetoRel:"[x], [y]",getPathSegAtLength:"[distance]",getPointAtLength:"[distance]",__proto__:null,},SVGPathSegList:{appendItem:"newItem",getItem:"index",initialize:"newItem",insertItemBefore:"newItem, index",removeItem:"index",replaceItem:"newItem, index",__proto__:null,},SVGPatternElement:{hasExtension:"[extension]",__proto__:null,},SVGPoint:{matrixTransform:"matrix",__proto__:null,},SVGPointList:{appendItem:"item",getItem:"index",initialize:"item",insertItemBefore:"item, index",removeItem:"index",replaceItem:"item, index",__proto__:null,},SVGSVGElement:{checkEnclosure:"[element], [rect]",checkIntersection:"[element], [rect]",createSVGTransformFromMatrix:"[matrix]",getElementById:"[elementId]",getEnclosureList:"[rect], [referenceElement]",getIntersectionList:"[rect], [referenceElement]",setCurrentTime:"[seconds]",suspendRedraw:"[maxWaitMilliseconds]",unsuspendRedraw:"[suspendHandleId]",__proto__:null,},SVGStringList:{appendItem:"item",getItem:"index",initialize:"item",insertItemBefore:"item, index",removeItem:"index",replaceItem:"item, index",__proto__:null,},SVGTextContentElement:{getCharNumAtPosition:"[point]",getEndPositionOfChar:"[offset]",getExtentOfChar:"[offset]",getRotationOfChar:"[offset]",getStartPositionOfChar:"[offset]",getSubStringLength:"[offset], [length]",selectSubString:"[offset], [length]",__proto__:null,},SVGTransform:{setMatrix:"matrix",setRotate:"angle, cx, cy",setScale:"sx, sy",setSkewX:"angle",setSkewY:"angle",setTranslate:"tx, ty",__proto__:null,},SVGTransformList:{appendItem:"item",createSVGTransformFromMatrix:"matrix",getItem:"index",initialize:"item",insertItemBefore:"item, index",removeItem:"index",replaceItem:"item, index",__proto__:null,},SecurityPolicy:{allowsConnectionTo:"url",allowsFontFrom:"url",allowsFormAction:"url",allowsFrameFrom:"url",allowsImageFrom:"url",allowsMediaFrom:"url",allowsObjectFrom:"url",allowsPluginType:"type",allowsScriptFrom:"url",allowsStyleFrom:"url",__proto__:null,},Selection:{addRange:"[range]",collapse:"[node], [index]",containsNode:"[node], [allowPartial]",extend:"[node], [offset]",getRangeAt:"[index]",modify:"[alter], [direction], [granularity]",selectAllChildren:"[node]",setBaseAndExtent:"[baseNode], [baseOffset], [extentNode], [extentOffset]",setPosition:"[node], [offset]",__proto__:null,},SourceBuffer:{appendBuffer:"data",remove:"start, end",__proto__:null,},SourceBufferList:{item:"index",__proto__:null,},SpeechSynthesis:{speak:"utterance",__proto__:null,},SpeechSynthesisUtterance:{__proto__:null,},Storage:{getItem:"key",key:"index",removeItem:"key",setItem:"key, data",__proto__:null,},StorageErrorCallback:{handleEvent:"error",__proto__:null,},StorageEvent:{initStorageEvent:"[typeArg], [canBubbleArg], [cancelableArg], [keyArg], [oldValueArg], [newValueArg], [urlArg], [storageAreaArg]",__proto__:null,},StorageInfo:{queryUsageAndQuota:"storageType, [usageCallback], [errorCallback]",requestQuota:"storageType, newQuotaInBytes, [quotaCallback], [errorCallback]",__proto__:null,},StorageQuota:{queryUsageAndQuota:"usageCallback, [errorCallback]",requestQuota:"newQuotaInBytes, [quotaCallback], [errorCallback]",__proto__:null,},StorageQuotaCallback:{handleEvent:"grantedQuotaInBytes",__proto__:null,},StorageUsageCallback:{handleEvent:"currentUsageInBytes, currentQuotaInBytes",__proto__:null,},StringCallback:{handleEvent:"data",__proto__:null,},StyleMedia:{matchMedium:"[mediaquery]",__proto__:null,},StyleSheetList:{item:"[index]",__proto__:null,},Text:{replaceWholeText:"[content]",splitText:"offset",__proto__:null,},TextEvent:{initTextEvent:"[typeArg], [canBubbleArg], [cancelableArg], [viewArg], [dataArg]",__proto__:null,},TextTrack:{addCue:"cue",addRegion:"region",removeCue:"cue",removeRegion:"region",__proto__:null,},TextTrackCue:{__proto__:null,},TextTrackCueList:{getCueById:"id",item:"index",__proto__:null,},TextTrackList:{getTrackById:"id",item:"index",__proto__:null,},TimeRanges:{end:"index",start:"index",__proto__:null,},TouchEvent:{initTouchEvent:"[touches], [targetTouches], [changedTouches], [type], [view], [screenX], [screenY], [clientX], [clientY], [ctrlKey], [altKey], [shiftKey], [metaKey]",__proto__:null,},TouchList:{item:"index",__proto__:null,},UIEvent:{initUIEvent:"[type], [canBubble], [cancelable], [view], [detail]",__proto__:null,},UserMessageHandler:{postMessage:"message",__proto__:null,},VTTRegionList:{getRegionById:"id",item:"index",__proto__:null,},VideoTrackList:{getTrackById:"id",item:"index",__proto__:null,},WebGL2RenderingContext:{beginQuery:"target, query",beginTransformFeedback:"primitiveMode",bindBufferBase:"target, index, buffer",bindBufferRange:"target, index, buffer, offset, size",bindSampler:"unit, sampler",bindTransformFeedback:"target, id",bindVertexArray:"vertexArray",blitFramebuffer:"srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter",clearBufferfi:"buffer, drawbuffer, depth, stencil",clearBufferfv:"buffer, drawbuffer, value",clearBufferiv:"buffer, drawbuffer, value",clearBufferuiv:"buffer, drawbuffer, value",clientWaitSync:"sync, flags, timeout",compressedTexImage3D:"target, level, internalformat, width, height, depth, border, imageSize, data",compressedTexSubImage3D:"target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data",copyBufferSubData:"readTarget, writeTarget, readOffset, writeOffset, size",copyTexSubImage3D:"target, level, xoffset, yoffset, zoffset, x, y, width, height",deleteQuery:"query",deleteSampler:"sampler",deleteSync:"sync",deleteTransformFeedback:"id",deleteVertexArray:"vertexArray",drawArraysInstanced:"mode, first, count, instanceCount",drawBuffers:"buffers",drawElementsInstanced:"mode, count, type, offset, instanceCount",drawRangeElements:"mode, start, end, count, type, offset",endQuery:"target",fenceSync:"condition, flags",framebufferTextureLayer:"target, attachment, texture, level, layer",getActiveUniformBlockName:"program, uniformBlockIndex",getActiveUniformBlockParameter:"program, uniformBlockIndex, pname",getActiveUniforms:"program, uniformIndices, pname",getBufferSubData:"target, offset, returnedData",getFragDataLocation:"program, name",getIndexedParameter:"target, index",getInternalformatParameter:"target, internalformat, pname",getQuery:"target, pname",getQueryParameter:"query, pname",getSamplerParameter:"sampler, pname",getSyncParameter:"sync, pname",getTransformFeedbackVarying:"program, index",getUniformBlockIndex:"program, uniformBlockName",getUniformIndices:"program, uniformNames",invalidateFramebuffer:"target, attachments",invalidateSubFramebuffer:"target, attachments, x, y, width, height",isQuery:"query",isSampler:"sampler",isSync:"sync",isTransformFeedback:"id",isVertexArray:"vertexArray",readBuffer:"src",renderbufferStorageMultisample:"target, samples, internalformat, width, height",samplerParameterf:"sampler, pname, param",samplerParameteri:"sampler, pname, param",texImage3D:"target, level, internalformat, width, height, depth, border, format, type, pixels",texStorage2D:"target, levels, internalformat, width, height",texStorage3D:"target, levels, internalformat, width, height, depth",texSubImage3D:"target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels",transformFeedbackVaryings:"program, varyings, bufferMode",uniform1ui:"location, v0",uniform1uiv:"location, value",uniform2ui:"location, v0, v1",uniform2uiv:"location, value",uniform3ui:"location, v0, v1, v2",uniform3uiv:"location, value",uniform4ui:"location, v0, v1, v2, v3",uniform4uiv:"location, value",uniformBlockBinding:"program, uniformBlockIndex, uniformBlockBinding",uniformMatrix2x3fv:"location, transpose, value",uniformMatrix2x4fv:"location, transpose, value",uniformMatrix3x2fv:"location, transpose, value",uniformMatrix3x4fv:"location, transpose, value",uniformMatrix4x2fv:"location, transpose, value",uniformMatrix4x3fv:"location, transpose, value",vertexAttribDivisor:"index, divisor",vertexAttribI4i:"index, x, y, z, w",vertexAttribI4iv:"index, v",vertexAttribI4ui:"index, x, y, z, w",vertexAttribI4uiv:"index, v",vertexAttribIPointer:"index, size, type, stride, offset",waitSync:"sync, flags, timeout",__proto__:null,},WebGLDebugShaders:{getTranslatedShaderSource:"shader",__proto__:null,},WebGLDrawBuffers:{drawBuffersWEBGL:"buffers",__proto__:null,},WebGLRenderingContextBase:{activeTexture:"texture",attachShader:"program, shader",bindAttribLocation:"program, index, name",bindBuffer:"target, buffer",bindFramebuffer:"target, framebuffer",bindRenderbuffer:"target, renderbuffer",bindTexture:"target, texture",blendColor:"red, green, blue, alpha",blendEquation:"mode",blendEquationSeparate:"modeRGB, modeAlpha",blendFunc:"sfactor, dfactor",blendFuncSeparate:"srcRGB, dstRGB, srcAlpha, dstAlpha",bufferData:"target, data, usage",bufferSubData:"target, offset, data",checkFramebufferStatus:"target",clear:"mask",clearColor:"red, green, blue, alpha",clearDepth:"depth",clearStencil:"s",colorMask:"red, green, blue, alpha",compileShader:"shader",compressedTexImage2D:"target, level, internalformat, width, height, border, data",compressedTexSubImage2D:"target, level, xoffset, yoffset, width, height, format, data",copyTexImage2D:"target, level, internalformat, x, y, width, height, border",copyTexSubImage2D:"target, level, xoffset, yoffset, x, y, width, height",createShader:"type",cullFace:"mode",deleteBuffer:"buffer",deleteFramebuffer:"framebuffer",deleteProgram:"program",deleteRenderbuffer:"renderbuffer",deleteShader:"shader",deleteTexture:"texture",depthFunc:"func",depthMask:"flag",depthRange:"zNear, zFar",detachShader:"program, shader",disable:"cap",disableVertexAttribArray:"index",drawArrays:"mode, first, count",drawElements:"mode, count, type, offset",enable:"cap",enableVertexAttribArray:"index",framebufferRenderbuffer:"target, attachment, renderbuffertarget, renderbuffer",framebufferTexture2D:"target, attachment, textarget, texture, level",frontFace:"mode",generateMipmap:"target",getActiveAttrib:"program, index",getActiveUniform:"program, index",getAttachedShaders:"program",getAttribLocation:"program, name",getBufferParameter:"target, pname",getExtension:"name",getFramebufferAttachmentParameter:"target, attachment, pname",getParameter:"pname",getProgramInfoLog:"program",getProgramParameter:"program, pname",getRenderbufferParameter:"target, pname",getShaderInfoLog:"shader",getShaderParameter:"shader, pname",getShaderPrecisionFormat:"shadertype, precisiontype",getShaderSource:"shader",getTexParameter:"target, pname",getUniform:"program, location",getUniformLocation:"program, name",getVertexAttrib:"index, pname",getVertexAttribOffset:"index, pname",hint:"target, mode",isBuffer:"buffer",isEnabled:"cap",isFramebuffer:"framebuffer",isProgram:"program",isRenderbuffer:"renderbuffer",isShader:"shader",isTexture:"texture",lineWidth:"width",linkProgram:"program",pixelStorei:"pname, param",polygonOffset:"factor, units",readPixels:"x, y, width, height, format, type, pixels",renderbufferStorage:"target, internalformat, width, height",sampleCoverage:"value, invert",scissor:"x, y, width, height",shaderSource:"shader, string",stencilFunc:"func, ref, mask",stencilFuncSeparate:"face, func, ref, mask",stencilMask:"mask",stencilMaskSeparate:"face, mask",stencilOp:"fail, zfail, zpass",stencilOpSeparate:"face, fail, zfail, zpass",texImage2D:"target, level, internalformat, width, height, border, format, type, pixels",texParameterf:"target, pname, param",texParameteri:"target, pname, param",texSubImage2D:"target, level, xoffset, yoffset, width, height, format, type, pixels",uniform1f:"location, x",uniform1fv:"location, v",uniform1i:"location, x",uniform1iv:"location, v",uniform2f:"location, x, y",uniform2fv:"location, v",uniform2i:"location, x, y",uniform2iv:"location, v",uniform3f:"location, x, y, z",uniform3fv:"location, v",uniform3i:"location, x, y, z",uniform3iv:"location, v",uniform4f:"location, x, y, z, w",uniform4fv:"location, v",uniform4i:"location, x, y, z, w",uniform4iv:"location, v",uniformMatrix2fv:"location, transpose, array",uniformMatrix3fv:"location, transpose, array",uniformMatrix4fv:"location, transpose, array",useProgram:"program",validateProgram:"program",vertexAttrib1f:"indx, x",vertexAttrib1fv:"indx, values",vertexAttrib2f:"indx, x, y",vertexAttrib2fv:"indx, values",vertexAttrib3f:"indx, x, y, z",vertexAttrib3fv:"indx, values",vertexAttrib4f:"indx, x, y, z, w",vertexAttrib4fv:"indx, values",vertexAttribPointer:"indx, size, type, normalized, stride, offset",viewport:"x, y, width, height",__proto__:null,},WebKitCSSMatrix:{multiply:"[secondMatrix]",rotate:"[rotX], [rotY], [rotZ]",rotateAxisAngle:"[x], [y], [z], [angle]",scale:"[scaleX], [scaleY], [scaleZ]",setMatrixValue:"[string]",skewX:"[angle]",skewY:"[angle]",translate:"[x], [y], [z]",__proto__:null,},WebKitMediaKeySession:{update:"key",__proto__:null,},WebKitMediaKeys:{createSession:"[type], [initData]",__proto__:null,},WebKitNamedFlow:{getRegionsByContent:"contentNode",__proto__:null,},WebKitNamedFlowCollection:{item:"index",namedItem:"name",__proto__:null,},WebKitSubtleCrypto:{decrypt:"algorithm, key, data",digest:"algorithm, data",encrypt:"algorithm, key, data",exportKey:"format, key",generateKey:"algorithm, [extractable], [keyUsages]",importKey:"format, keyData, algorithm, [extractable], [keyUsages]",sign:"algorithm, key, data",unwrapKey:"format, wrappedKey, unwrappingKey, unwrapAlgorithm, unwrappedKeyAlgorithm, [extractable], [keyUsages]",verify:"algorithm, key, signature, data",wrapKey:"format, key, wrappingKey, wrapAlgorithm",__proto__:null,},WebSocket:{close:"[code], [reason]",send:"data",__proto__:null,},WheelEvent:{initWebKitWheelEvent:"[wheelDeltaX], [wheelDeltaY], [view], [screenX], [screenY], [clientX], [clientY], [ctrlKey], [altKey], [shiftKey], [metaKey]",__proto__:null,},Worker:{postMessage:"message, [messagePorts]",__proto__:null,},WorkerGlobalScope:{clearInterval:"[handle]",clearTimeout:"[handle]",setInterval:"handler, [timeout]",setTimeout:"handler, [timeout]",__proto__:null,},XMLHttpRequest:{getResponseHeader:"header",open:"method, url, [async], [user], [password]",overrideMimeType:"override",setRequestHeader:"header, value",__proto__:null,},XMLHttpRequestUpload:{__proto__:null,},XMLSerializer:{serializeToString:"[node]",__proto__:null,},XPathEvaluator:{createExpression:"[expression], [resolver]",createNSResolver:"[nodeResolver]",evaluate:"[expression], [contextNode], [resolver], [type], [inResult]",__proto__:null,},XPathExpression:{evaluate:"[contextNode], [type], [inResult]",__proto__:null,},XPathNSResolver:{lookupNamespaceURI:"[prefix]",__proto__:null,},XPathResult:{snapshotItem:"[index]",__proto__:null,},XSLTProcessor:{getParameter:"namespaceURI, localName",importStylesheet:"[stylesheet]",removeParameter:"namespaceURI, localName",setParameter:"namespaceURI, localName, value",transformToDocument:"[source]",transformToFragment:"[source], [docVal]",__proto__:null,},webkitAudioContext:{createBuffer:"numberOfChannels, numberOfFrames, sampleRate",createChannelMerger:"[numberOfInputs]",createChannelSplitter:"[numberOfOutputs]",createDelay:"[maxDelayTime]",createDelayNode:"[maxDelayTime]",createJavaScriptNode:"bufferSize, [numberOfInputChannels], [numberOfOutputChannels]",createMediaElementSource:"mediaElement",createPeriodicWave:"real, imag",createScriptProcessor:"bufferSize, [numberOfInputChannels], [numberOfOutputChannels]",decodeAudioData:"audioData, successCallback, [errorCallback]",__proto__:null,},webkitAudioPannerNode:{setOrientation:"x, y, z",setPosition:"x, y, z",setVelocity:"x, y, z",__proto__:null,},webkitMediaStream:{addTrack:"track",getTrackById:"trackId",removeTrack:"track",__proto__:null,},webkitRTCPeerConnection:{addIceCandidate:"candidate, successCallback, failureCallback",addStream:"stream",createAnswer:"successCallback, failureCallback, [answerOptions]",createDTMFSender:"track",createDataChannel:"label, [options]",createOffer:"successCallback, failureCallback, [offerOptions]",getStats:"successCallback, failureCallback, [selector]",getStreamById:"streamId",removeStream:"stream",setLocalDescription:"description, successCallback, failureCallback",setRemoteDescription:"description, successCallback, failureCallback",updateIce:"configuration",__proto__:null,},EventTarget:{addEventListener:"type, listener, [useCapture=false]",removeEventListener:"type, listener, [useCapture=false]",dispatchEvent:"event",__proto__:null,},};(function(){
var EventTarget=WebInspector.NativePrototypeFunctionParameters.EventTarget;var eventTargetTypes=["Node","Window","AudioNode","AudioTrackList","DOMApplicationCache","FileReader","MediaController","MediaStreamTrack","MessagePort","Notification","RTCDTMFSender","SpeechSynthesisUtterance","TextTrack","TextTrackCue","TextTrackList","VideoTrackList","WebKitMediaKeySession","WebKitNamedFlow","WebSocket","WorkerGlobalScope","XMLHttpRequest","webkitMediaStream","webkitRTCPeerConnection"];for(var type of eventTargetTypes)
Object.assign(WebInspector.NativePrototypeFunctionParameters[type],EventTarget);var ElementQueries={getElementsByClassName:"classNames",getElementsByTagName:"tagName",getElementsByTagNameNS:"namespace, localName",querySelector:"selectors",querySelectorAll:"selectors",};Object.assign(WebInspector.NativePrototypeFunctionParameters.Element,ElementQueries);Object.assign(WebInspector.NativePrototypeFunctionParameters.Document,ElementQueries);var ChildNode={after:"[node|string]...",before:"[node|string]...",replaceWith:"[node|string]...",};Object.assign(WebInspector.NativePrototypeFunctionParameters.Element,ChildNode);Object.assign(WebInspector.NativePrototypeFunctionParameters.CharacterData,ChildNode);var ParentNode={append:"[node|string]...",prepend:"[node|string]...",};Object.assign(WebInspector.NativePrototypeFunctionParameters.Element,ParentNode);Object.assign(WebInspector.NativePrototypeFunctionParameters.Document,ParentNode);Object.assign(WebInspector.NativePrototypeFunctionParameters.DocumentFragment,ParentNode);WebInspector.NativePrototypeFunctionParameters.Console=WebInspector.NativeConstructorFunctionParameters.Console;})();WebInspector.NetworkInstrument=class NetworkInstrument extends WebInspector.Instrument
{ get timelineRecordType()
{return WebInspector.TimelineRecord.Type.Network;}
startInstrumentation(initiatedByBackend)
{}
stopInstrumentation(initiatedByBackend)
{}};WebInspector.NetworkTimeline=class NetworkTimeline extends WebInspector.Timeline
{ recordForResource(resource)
{return this._resourceRecordMap.get(resource)||null;}
reset(suppressEvents)
{this._resourceRecordMap=new Map;super.reset(suppressEvents);}
addRecord(record)
{if(this._resourceRecordMap.has(record.resource))
return;this._resourceRecordMap.set(record.resource,record);super.addRecord(record);}};WebInspector.ObjectPreview=class ObjectPreview extends WebInspector.Object
{constructor(type,subtype,description,lossless,overflow,properties,entries,size)
{super();this._type=type;this._subtype=subtype;this._description=description||"";this._lossless=lossless;this._overflow=overflow||false;this._size=size;this._properties=properties||null;this._entries=entries||null;}
static fromPayload(payload)
{if(payload.properties)
payload.properties=payload.properties.map(WebInspector.PropertyPreview.fromPayload);if(payload.entries)
payload.entries=payload.entries.map(WebInspector.CollectionEntryPreview.fromPayload);if(payload.subtype==="array"){var match=payload.description.match(/\[(\d+)\]$/);if(match){payload.size=parseInt(match[1]);payload.description=payload.description.replace(/\[\d+\]$/,"");}}
return new WebInspector.ObjectPreview(payload.type,payload.subtype,payload.description,payload.lossless,payload.overflow,payload.properties,payload.entries,payload.size);}
get type(){return this._type;}
get subtype(){return this._subtype;}
get description(){return this._description;}
get lossless(){return this._lossless;}
get overflow(){return this._overflow;}
get propertyPreviews(){return this._properties;}
get collectionEntryPreviews(){return this._entries;}
get size(){return this._size;}
hasSize()
{return this._size!==undefined&&(this._subtype==="array"||this._subtype==="set"||this._subtype==="map"||this._subtype==="weakmap"||this._subtype==="weakset");}};WebInspector.ProbeSample=class ProbeSample extends WebInspector.Object
{constructor(sampleId,batchId,elapsedTime,object)
{super();this.sampleId=sampleId;this.batchId=batchId;this.timestamp=elapsedTime;this.object=object;}};WebInspector.Probe=class Probe extends WebInspector.Object
{constructor(id,breakpoint,expression)
{super();this._id=id;this._breakpoint=breakpoint;this._expression=expression;this._samples=[];}
get id()
{return this._id;}
get breakpoint()
{return this._breakpoint;}
get expression()
{return this._expression;}
set expression(value)
{if(this._expression===value)
return;var data={oldValue:this._expression,newValue:value};this._expression=value;this.clearSamples();this.dispatchEventToListeners(WebInspector.Probe.Event.ExpressionChanged,data);}
get samples()
{return this._samples.slice();}
clearSamples()
{this._samples=[];this.dispatchEventToListeners(WebInspector.Probe.Event.SamplesCleared);}
addSample(sample)
{this._samples.push(sample);this.dispatchEventToListeners(WebInspector.Probe.Event.SampleAdded,sample);}};WebInspector.Probe.Event={ExpressionChanged:"probe-object-expression-changed",SampleAdded:"probe-object-sample-added",SamplesCleared:"probe-object-samples-cleared"};WebInspector.ProbeSet=class ProbeSet extends WebInspector.Object
{constructor(breakpoint)
{super();this._breakpoint=breakpoint;this._probes=[];this._probesByIdentifier=new Map;this._createDataTable();WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange,this._mainResourceChanged,this);WebInspector.Probe.addEventListener(WebInspector.Probe.Event.SampleAdded,this._sampleCollected,this);WebInspector.Breakpoint.addEventListener(WebInspector.Breakpoint.Event.ResolvedStateDidChange,this._breakpointResolvedStateDidChange,this);}
get breakpoint(){return this._breakpoint;}
get probes(){return this._probes.slice();}
get dataTable(){return this._dataTable;}
clear()
{this._breakpoint.clearActions(WebInspector.BreakpointAction.Type.Probe);}
clearSamples()
{for(var probe of this._probes)
probe.clearSamples();var oldTable=this._dataTable;this._createDataTable();this.dispatchEventToListeners(WebInspector.ProbeSet.Event.SamplesCleared,{oldTable});}
createProbe(expression)
{this.breakpoint.createAction(WebInspector.BreakpointAction.Type.Probe,null,expression);}
addProbe(probe)
{this._probes.push(probe);this._probesByIdentifier.set(probe.id,probe);this.dataTable.addProbe(probe);this.dispatchEventToListeners(WebInspector.ProbeSet.Event.ProbeAdded,probe);}
removeProbe(probe)
{this._probes.splice(this._probes.indexOf(probe),1);this._probesByIdentifier.delete(probe.id);this.dataTable.removeProbe(probe);this.dispatchEventToListeners(WebInspector.ProbeSet.Event.ProbeRemoved,probe);}
willRemove()
{WebInspector.Frame.removeEventListener(WebInspector.Frame.Event.MainResourceDidChange,this._mainResourceChanged,this);WebInspector.Probe.removeEventListener(WebInspector.Probe.Event.SampleAdded,this._sampleCollected,this);WebInspector.Breakpoint.removeEventListener(WebInspector.Breakpoint.Event.ResolvedStateDidChange,this._breakpointResolvedStateDidChange,this);}
_mainResourceChanged()
{this.dataTable.mainResourceChanged();}
_createDataTable()
{if(this.dataTable)
this.dataTable.willRemove();this._dataTable=new WebInspector.ProbeSetDataTable(this);}
_sampleCollected(event)
{var sample=event.data;var probe=event.target;if(!this._probesByIdentifier.has(probe.id))
return;this.dataTable.addSampleForProbe(probe,sample);this.dispatchEventToListeners(WebInspector.ProbeSet.Event.SampleAdded,{probe,sample});}
_breakpointResolvedStateDidChange(event)
{this.dispatchEventToListeners(WebInspector.ProbeSet.Event.ResolvedStateDidChange);}};WebInspector.ProbeSet.Event={ProbeAdded:"probe-set-probe-added",ProbeRemoved:"probe-set-probe-removed",ResolvedStateDidChange:"probe-set-resolved-state-did-change",SampleAdded:"probe-set-sample-added",SamplesCleared:"probe-set-samples-cleared",};WebInspector.ProbeSetDataFrame=class ProbeSetDataFrame extends WebInspector.Object
{constructor(index)
{super();this._count=0;this._index=index;this._separator=false;}
static compare(a,b)
{return a.index-b.index;}
get key()
{return String(this._index);}
get count()
{return this._count;}
get index()
{return this._index;}
get isSeparator()
{return this._separator;}
set isSeparator(value)
{this._separator=!!value;}
addSampleForProbe(probe,sample)
{this[probe.id]=sample;this._count++;}
missingKeys(probeSet)
{return probeSet.probes.filter(function(probe){return!this.hasOwnProperty(probe.id);},this);}
isComplete(probeSet)
{return!this.missingKeys(probeSet).length;}
fillMissingValues(probeSet)
{for(var key of this.missingKeys(probeSet))
this[key]=WebInspector.ProbeSetDataFrame.MissingValue;}};WebInspector.ProbeSetDataFrame.MissingValue="?";WebInspector.ProbeSetDataTable=class ProbeSetDataTable extends WebInspector.Object
{constructor(probeSet)
{super();this._probeSet=probeSet;this._frames=[];this._previousBatchIdentifier=WebInspector.ProbeSetDataTable.SentinelValue;}
get frames()
{return this._frames.slice();}
get separators()
{return this._frames.filter(function(frame){return frame.isSeparator;});}
willRemove()
{this.dispatchEventToListeners(WebInspector.ProbeSetDataTable.Event.WillRemove);this._frames=[];delete this._probeSet;}
mainResourceChanged()
{this.addSeparator();}
addSampleForProbe(probe,sample)
{if(sample.batchId!==this._previousBatchIdentifier){if(this._openFrame){this._openFrame.fillMissingValues(this._probeSet);this.addFrame(this._openFrame);}
this._openFrame=this.createFrame();this._previousBatchIdentifier=sample.batchId;}
this._openFrame.addSampleForProbe(probe,sample);if(this._openFrame.count===this._probeSet.probes.length){this.addFrame(this._openFrame);this._openFrame=null;}}
addProbe(probe)
{for(var frame of this.frames)
if(!frame[probe.id])
frame[probe.id]=WebInspector.ProbeSetDataTable.UnknownValue;}
removeProbe(probe)
{for(var frame of this.frames)
delete frame[probe.id];}
createFrame()
{return new WebInspector.ProbeSetDataFrame(this._frames.length);}
addFrame(frame)
{this._frames.push(frame);this.dispatchEventToListeners(WebInspector.ProbeSetDataTable.Event.FrameInserted,frame);}
addSeparator()
{if(!this._frames.length)
return;var previousFrame=this._frames.lastValue;if(previousFrame.isSeparator)
return;previousFrame.isSeparator=true;this.dispatchEventToListeners(WebInspector.ProbeSetDataTable.Event.SeparatorInserted,previousFrame);}};WebInspector.ProbeSetDataTable.Event={FrameInserted:"probe-set-data-table-frame-inserted",SeparatorInserted:"probe-set-data-table-separator-inserted",WillRemove:"probe-set-data-table-will-remove"};WebInspector.ProbeSetDataTable.SentinelValue=-1;WebInspector.ProbeSetDataTable.UnknownValue="?";WebInspector.Profile=class Profile extends WebInspector.Object
{constructor(topDownRootNodes)
{super();topDownRootNodes=topDownRootNodes||[];this._topDownRootNodes=topDownRootNodes;}
get topDownRootNodes()
{return this._topDownRootNodes;}
get bottomUpRootNodes()
{return[];}};WebInspector.ProfileNode=class ProfileNode extends WebInspector.Object
{constructor(id,type,functionName,sourceCodeLocation,callInfo,calls,childNodes)
{super();childNodes=childNodes||[];this._id=id;this._type=type||WebInspector.ProfileNode.Type.Function;this._functionName=functionName||null;this._sourceCodeLocation=sourceCodeLocation||null;this._calls=calls||null;this._callInfo=callInfo||null;this._childNodes=childNodes;this._parentNode=null;this._previousSibling=null;this._nextSibling=null;this._computedTotalTimes=false;if(this._callInfo){this._startTime=this._callInfo.startTime;this._endTime=this._callInfo.endTime;this._totalTime=this._callInfo.totalTime;this._callCount=this._callInfo.callCount;}
for(var i=0;i<this._childNodes.length;++i)
this._childNodes[i].establishRelationships(this,this._childNodes[i-1],this._childNodes[i+1]);if(this._calls){for(var i=0;i<this._calls.length;++i)
this._calls[i].establishRelationships(this,this._calls[i-1],this._calls[i+1]);}}
get id()
{return this._id;}
get type()
{return this._type;}
get functionName()
{return this._functionName;}
get sourceCodeLocation()
{return this._sourceCodeLocation;}
get startTime()
{if(this._startTime===undefined)
this._startTime=Math.max(0,this._calls[0].startTime);return this._startTime;}
get endTime()
{if(this._endTime===undefined)
this._endTime=Math.min(this._calls.lastValue.endTime,Infinity);return this._endTime;}
get selfTime()
{this._computeTotalTimesIfNeeded();return this._selfTime;}
get totalTime()
{this._computeTotalTimesIfNeeded();return this._totalTime;}
get callInfo()
{return this._callInfo;}
get calls()
{return this._calls;}
get previousSibling()
{return this._previousSibling;}
get nextSibling()
{return this._nextSibling;}
get parentNode()
{return this._parentNode;}
get childNodes()
{return this._childNodes;}
computeCallInfoForTimeRange(rangeStartTime,rangeEndTime)
{
if(this._callInfo){if(this._selfTime===undefined){var childNodesTotalTime=0;for(var childNode of this._childNodes)
childNodesTotalTime+=childNode.totalTime;this._selfTime=this._totalTime-childNodesTotalTime;if(this._selfTime<0.0001)
this._selfTime=0.0;}
return{callCount:this._callCount,startTime:this._startTime,endTime:this._endTime,selfTime:this._selfTime,totalTime:this._totalTime,averageTime:(this._selfTime/this._callCount),};}
var recordCallCount=true;var callCount=0;function totalTimeInRange(previousValue,call)
{if(rangeStartTime>call.endTime||rangeEndTime<call.startTime)
return previousValue;if(recordCallCount)
++callCount;return previousValue+Math.min(call.endTime,rangeEndTime)-Math.max(rangeStartTime,call.startTime);}
var startTime=Math.max(rangeStartTime,this._calls[0].startTime);var endTime=Math.min(this._calls.lastValue.endTime,rangeEndTime);var totalTime=this._calls.reduce(totalTimeInRange,0);recordCallCount=false;var childNodesTotalTime=0;for(var childNode of this._childNodes)
childNodesTotalTime+=childNode.calls.reduce(totalTimeInRange,0);var selfTime=totalTime-childNodesTotalTime;var averageTime=selfTime/callCount;return{startTime,endTime,totalTime,selfTime,callCount,averageTime};}
traverseNextProfileNode(stayWithin)
{var profileNode=this._childNodes[0];if(profileNode)
return profileNode;if(this===stayWithin)
return null;profileNode=this._nextSibling;if(profileNode)
return profileNode;profileNode=this;while(profileNode&&!profileNode.nextSibling&&profileNode.parentNode!==stayWithin)
profileNode=profileNode.parentNode;if(!profileNode)
return null;return profileNode.nextSibling;}
saveIdentityToCookie(cookie)
{cookie[WebInspector.ProfileNode.TypeCookieKey]=this._type||null;cookie[WebInspector.ProfileNode.FunctionNameCookieKey]=this._functionName||null;cookie[WebInspector.ProfileNode.SourceCodeURLCookieKey]=this._sourceCodeLocation?this._sourceCodeLocation.sourceCode.url?this._sourceCodeLocation.sourceCode.url.hash:null:null;cookie[WebInspector.ProfileNode.SourceCodeLocationLineCookieKey]=this._sourceCodeLocation?this._sourceCodeLocation.lineNumber:null;cookie[WebInspector.ProfileNode.SourceCodeLocationColumnCookieKey]=this._sourceCodeLocation?this._sourceCodeLocation.columnNumber:null;}
establishRelationships(parentNode,previousSibling,nextSibling)
{this._parentNode=parentNode||null;this._previousSibling=previousSibling||null;this._nextSibling=nextSibling||null;}
_computeTotalTimesIfNeeded()
{if(this._computedTotalTimes)
return;this._computedTotalTimes=true;var info=this.computeCallInfoForTimeRange(0,Infinity);this._startTime=info.startTime;this._endTime=info.endTime;this._selfTime=info.selfTime;this._totalTime=info.totalTime;}};WebInspector.ProfileNode.Type={Function:"profile-node-type-function",Program:"profile-node-type-program"};WebInspector.ProfileNode.TypeIdentifier="profile-node";WebInspector.ProfileNode.TypeCookieKey="profile-node-type";WebInspector.ProfileNode.FunctionNameCookieKey="profile-node-function-name";WebInspector.ProfileNode.SourceCodeURLCookieKey="profile-node-source-code-url";WebInspector.ProfileNode.SourceCodeLocationLineCookieKey="profile-node-source-code-location-line";WebInspector.ProfileNode.SourceCodeLocationColumnCookieKey="profile-node-source-code-location-column";WebInspector.ProfileNodeCall=class ProfileNodeCall extends WebInspector.Object
{constructor(startTime,totalTime)
{super();this._startTime=startTime;this._totalTime=totalTime||0;this._parentNode=null;this._previousSibling=null;this._nextSibling=null;}
get startTime()
{return this._startTime;}
get totalTime()
{return this._totalTime;}
get endTime()
{return this._startTime+this._totalTime;}
establishRelationships(parentNode,previousSibling,nextSibling)
{this._parentNode=parentNode||null;this._previousSibling=previousSibling||null;this._nextSibling=nextSibling||null;}};WebInspector.PropertyDescriptor=class PropertyDescriptor extends WebInspector.Object
{constructor(descriptor,symbol,isOwnProperty,wasThrown,nativeGetter,isInternalProperty)
{super();this._name=descriptor.name;this._value=descriptor.value;this._hasValue="value"in descriptor;this._get=descriptor.get;this._set=descriptor.set;this._symbol=symbol;this._writable=descriptor.writable||false;this._configurable=descriptor.configurable||false;this._enumerable=descriptor.enumerable||false;this._own=isOwnProperty||false;this._wasThrown=wasThrown||false;this._nativeGetterValue=nativeGetter||false;this._internal=isInternalProperty||false;}
static fromPayload(payload,internal,target)
{if(payload.value)
payload.value=WebInspector.RemoteObject.fromPayload(payload.value,target);if(payload.get)
payload.get=WebInspector.RemoteObject.fromPayload(payload.get,target);if(payload.set)
payload.set=WebInspector.RemoteObject.fromPayload(payload.set,target);if(payload.symbol)
payload.symbol=WebInspector.RemoteObject.fromPayload(payload.symbol,target);if(internal){payload.writable=payload.configurable=payload.enumerable=false;payload.isOwn=true;}
return new WebInspector.PropertyDescriptor(payload,payload.symbol,payload.isOwn,payload.wasThrown,payload.nativeGetter,internal);}
get name(){return this._name;}
get value(){return this._value;}
get get(){return this._get;}
get set(){return this._set;}
get writable(){return this._writable;}
get configurable(){return this._configurable;}
get enumerable(){return this._enumerable;}
get symbol(){return this._symbol;}
get isOwnProperty(){return this._own;}
get wasThrown(){return this._wasThrown;}
get nativeGetter(){return this._nativeGetterValue;}
get isInternalProperty(){return this._internal;}
hasValue()
{return this._hasValue;}
hasGetter()
{return this._get&&this._get.type==="function";}
hasSetter()
{return this._set&&this._set.type==="function";}
isIndexProperty()
{return!isNaN(Number(this._name));}
isSymbolProperty()
{return!!this._symbol;}};WebInspector.PropertyPath=class PropertyPath extends WebInspector.Object
{constructor(object,pathComponent,parent,isPrototype)
{super();if(parent&&!parent.object)
throw new Error("Attempted to append to a PropertyPath with null object.");this._object=object;this._pathComponent=typeof pathComponent==="string"?pathComponent:null;this._parent=parent||null;this._isPrototype=isPrototype||false;}
static emptyPropertyPathForScope(object)
{return new WebInspector.PropertyPath(object,WebInspector.PropertyPath.SpecialPathComponent.EmptyPathComponentForScope);}
get object(){return this._object;}
get parent(){return this._parent;}
get isPrototype(){return this._isPrototype;}
get pathComponent(){return this._pathComponent;}
get rootObject()
{return this._parent?this._parent.rootObject:this._object;}
get lastNonPrototypeObject()
{if(!this._parent)
return this._object;var p=this._parent;while(p){if(!p.isPrototype)
break;if(!p.parent)
break;p=p.parent;}
return p.object;}
get fullPath()
{var components=[];for(var p=this;p&&p.pathComponent;p=p.parent)
components.push(p.pathComponent);components.reverse();return components.join("");}
get reducedPath()
{var components=[];var p=this;for(;p&&p.isPrototype;p=p.parent)
components.push(p.pathComponent);for(;p&&p.pathComponent;p=p.parent){if(p.isPrototype)
continue;components.push(p.pathComponent);}
components.reverse();return components.join("");}
displayPath(type)
{return type===WebInspector.PropertyPath.Type.Value?this.reducedPath:this.fullPath;}
isRoot()
{return!this._parent;}
isScope()
{return this._pathComponent===WebInspector.PropertyPath.SpecialPathComponent.EmptyPathComponentForScope;}
isPathComponentImpossible()
{return this._pathComponent&&this._pathComponent.startsWith("@");}
isFullPathImpossible()
{if(this.isPathComponentImpossible())
return true;if(this._parent)
return this._parent.isFullPathImpossible();return false;}
appendPropertyName(object,propertyName)
{var isPrototype=propertyName==="__proto__";if(this.isScope())
return new WebInspector.PropertyPath(object,propertyName,this,isPrototype);var component=this._canPropertyNameBeDotAccess(propertyName)?"."+propertyName:"["+doubleQuotedString(propertyName)+"]";return new WebInspector.PropertyPath(object,component,this,isPrototype);}
appendPropertySymbol(object,symbolName)
{var component=WebInspector.PropertyPath.SpecialPathComponent.SymbolPropertyName+(symbolName.length?"("+symbolName+")":"");return new WebInspector.PropertyPath(object,component,this);}
appendInternalPropertyName(object,propertyName)
{var component=WebInspector.PropertyPath.SpecialPathComponent.InternalPropertyName+"["+propertyName+"]";return new WebInspector.PropertyPath(object,component,this);}
appendGetterPropertyName(object,propertyName)
{var component=".__lookupGetter__("+doubleQuotedString(propertyName)+")";return new WebInspector.PropertyPath(object,component,this);}
appendSetterPropertyName(object,propertyName)
{var component=".__lookupSetter__("+doubleQuotedString(propertyName)+")";return new WebInspector.PropertyPath(object,component,this);}
appendArrayIndex(object,indexString)
{var component="["+indexString+"]";return new WebInspector.PropertyPath(object,component,this);}
appendMapKey(object)
{var component=WebInspector.PropertyPath.SpecialPathComponent.MapKey;return new WebInspector.PropertyPath(object,component,this);}
appendMapValue(object,keyObject)
{if(keyObject&&keyObject.hasValue()){if(keyObject.type==="string"){var component=".get("+doubleQuotedString(keyObject.description)+")";return new WebInspector.PropertyPath(object,component,this);}
var component=".get("+keyObject.description+")";return new WebInspector.PropertyPath(object,component,this);}
var component=WebInspector.PropertyPath.SpecialPathComponent.MapValue;return new WebInspector.PropertyPath(object,component,this);}
appendSetIndex(object)
{var component=WebInspector.PropertyPath.SpecialPathComponent.SetIndex;return new WebInspector.PropertyPath(object,component,this);}
appendSymbolProperty(object)
{var component=WebInspector.PropertyPath.SpecialPathComponent.SymbolPropertyName;return new WebInspector.PropertyPath(object,component,this);}
appendPropertyDescriptor(object,descriptor,type)
{if(descriptor.isInternalProperty)
return this.appendInternalPropertyName(object,descriptor.name);if(descriptor.symbol)
return this.appendSymbolProperty(object);if(type===WebInspector.PropertyPath.Type.Getter)
return this.appendGetterPropertyName(object,descriptor.name);if(type===WebInspector.PropertyPath.Type.Setter)
return this.appendSetterPropertyName(object,descriptor.name);if(this._object.subtype==="array"&&!isNaN(parseInt(descriptor.name)))
return this.appendArrayIndex(object,descriptor.name);return this.appendPropertyName(object,descriptor.name);}
_canPropertyNameBeDotAccess(propertyName)
{return/^(?![0-9])\w+$/.test(propertyName);}};WebInspector.PropertyPath.SpecialPathComponent={InternalPropertyName:"@internal",SymbolPropertyName:"@symbol",MapKey:"@mapkey",MapValue:"@mapvalue",SetIndex:"@setindex",EmptyPathComponentForScope:"",};WebInspector.PropertyPath.Type={Value:"value",Getter:"getter",Setter:"setter",};WebInspector.PropertyPreview=class PropertyPreview extends WebInspector.Object
{constructor(name,type,subtype,value,valuePreview,isInternalProperty)
{super();this._name=name;this._type=type;this._subtype=subtype;this._value=value;this._valuePreview=valuePreview;this._internal=isInternalProperty;}
static fromPayload(payload)
{if(payload.valuePreview)
payload.valuePreview=WebInspector.ObjectPreview.fromPayload(payload.valuePreview);return new WebInspector.PropertyPreview(payload.name,payload.type,payload.subtype,payload.value,payload.valuePreview,payload.internal);}
get name(){return this._name;}
get type(){return this._type;}
get subtype(){return this._subtype;}
get value(){return this._value;}
get valuePreview(){return this._valuePreview;}
get internal(){return this._internal;}};WebInspector.RenderingFrameTimelineRecord=class RenderingFrameTimelineRecord extends WebInspector.TimelineRecord
{constructor(startTime,endTime)
{super(WebInspector.TimelineRecord.Type.RenderingFrame,startTime,endTime);this._durationByTaskType=new Map;this._frameIndex=-1;}
static resetFrameIndex()
{WebInspector.RenderingFrameTimelineRecord._nextFrameIndex=0;}
static displayNameForTaskType(taskType)
{switch(taskType){case WebInspector.RenderingFrameTimelineRecord.TaskType.Script:return WebInspector.UIString("Script");case WebInspector.RenderingFrameTimelineRecord.TaskType.Layout:return WebInspector.UIString("Layout");case WebInspector.RenderingFrameTimelineRecord.TaskType.Paint:return WebInspector.UIString("Paint");case WebInspector.RenderingFrameTimelineRecord.TaskType.Other:return WebInspector.UIString("Other");}}
static taskTypeForTimelineRecord(record)
{switch(record.type){case WebInspector.TimelineRecord.Type.Script:return WebInspector.RenderingFrameTimelineRecord.TaskType.Script;case WebInspector.TimelineRecord.Type.Layout:if(record.eventType===WebInspector.LayoutTimelineRecord.EventType.Paint||record.eventType===WebInspector.LayoutTimelineRecord.EventType.Composite)
return WebInspector.RenderingFrameTimelineRecord.TaskType.Paint;return WebInspector.RenderingFrameTimelineRecord.TaskType.Layout;default:console.error("Unsupported timeline record type: "+record.type);return null;}}
get frameIndex()
{return this._frameIndex;}
get frameNumber()
{return this._frameIndex+1;}
setupFrameIndex()
{if(this._frameIndex>=0)
return;this._frameIndex=WebInspector.RenderingFrameTimelineRecord._nextFrameIndex++;}
durationForTask(taskType)
{if(this._durationByTaskType.has(taskType))
return this._durationByTaskType.get(taskType);var duration;if(taskType===WebInspector.RenderingFrameTimelineRecord.TaskType.Other)
duration=this._calculateDurationRemainder();else{duration=this.children.reduce(function(previousValue,currentValue){if(taskType!==WebInspector.RenderingFrameTimelineRecord.taskTypeForTimelineRecord(currentValue))
return previousValue;var currentDuration=currentValue.duration;if(currentValue.usesActiveStartTime)
currentDuration-=currentValue.inactiveDuration;return previousValue+currentDuration;},0);if(taskType===WebInspector.RenderingFrameTimelineRecord.TaskType.Script){
duration-=this.children.reduce(function(previousValue,currentValue){if(currentValue.type===WebInspector.TimelineRecord.Type.Layout&&(currentValue.sourceCodeLocation||currentValue.callFrames))
return previousValue+currentValue.duration;return previousValue;},0);}}
this._durationByTaskType.set(taskType,duration);return duration;}
_calculateDurationRemainder()
{return Object.keys(WebInspector.RenderingFrameTimelineRecord.TaskType).reduce((previousValue,key)=>{let taskType=WebInspector.RenderingFrameTimelineRecord.TaskType[key];if(taskType===WebInspector.RenderingFrameTimelineRecord.TaskType.Other)
return previousValue;return previousValue-this.durationForTask(taskType);},this.duration);}};WebInspector.RenderingFrameTimelineRecord.TaskType={Script:"rendering-frame-timeline-record-script",Layout:"rendering-frame-timeline-record-layout",Paint:"rendering-frame-timeline-record-paint",Other:"rendering-frame-timeline-record-other"};WebInspector.RenderingFrameTimelineRecord.TypeIdentifier="rendering-frame-timeline-record";WebInspector.RenderingFrameTimelineRecord._nextFrameIndex=0;WebInspector.Resource=class Resource extends WebInspector.SourceCode
{constructor(url,mimeType,type,loaderIdentifier,targetId,requestIdentifier,requestMethod,requestHeaders,requestData,requestSentTimestamp,initiatorSourceCodeLocation,originalRequestWillBeSentTimestamp)
{super();if(type in WebInspector.Resource.Type)
type=WebInspector.Resource.Type[type];this._url=url;this._urlComponents=null;this._mimeType=mimeType;this._mimeTypeComponents=null;this._type=type||WebInspector.Resource.typeFromMIMEType(mimeType);this._loaderIdentifier=loaderIdentifier||null;this._requestIdentifier=requestIdentifier||null;this._requestMethod=requestMethod||null;this._requestData=requestData||null;this._requestHeaders=requestHeaders||{};this._responseHeaders={};this._parentFrame=null;this._initiatorSourceCodeLocation=initiatorSourceCodeLocation||null;this._initiatedResources=[];this._originalRequestWillBeSentTimestamp=originalRequestWillBeSentTimestamp||null;this._requestSentTimestamp=requestSentTimestamp||NaN;this._responseReceivedTimestamp=NaN;this._lastRedirectReceivedTimestamp=NaN;this._lastDataReceivedTimestamp=NaN;this._finishedOrFailedTimestamp=NaN;this._finishThenRequestContentPromise=null;this._statusCode=NaN;this._statusText=null;this._cached=false;this._canceled=false;this._failed=false;this._failureReasonText=null;this._receivedNetworkLoadMetrics=false;this._responseSource=WebInspector.Resource.ResponseSource.Unknown;this._timingData=new WebInspector.ResourceTimingData(this);this._protocol=null;this._priority=WebInspector.Resource.NetworkPriority.Unknown;this._remoteAddress=null;this._connectionIdentifier=null;this._target=targetId?WebInspector.targetManager.targetForIdentifier(targetId):WebInspector.mainTarget;this._requestHeadersTransferSize=NaN;this._requestBodyTransferSize=NaN;this._responseHeadersTransferSize=NaN;this._responseBodyTransferSize=NaN;this._responseBodySize=NaN;this._cachedResponseBodySize=NaN;this._estimatedSize=NaN;this._estimatedTransferSize=NaN;this._estimatedResponseHeadersSize=NaN;if(this._initiatorSourceCodeLocation&&this._initiatorSourceCodeLocation.sourceCode instanceof WebInspector.Resource)
this._initiatorSourceCodeLocation.sourceCode.addInitiatedResource(this);}
static typeFromMIMEType(mimeType)
{if(!mimeType)
return WebInspector.Resource.Type.Other;mimeType=parseMIMEType(mimeType).type;if(mimeType in WebInspector.Resource._mimeTypeMap)
return WebInspector.Resource._mimeTypeMap[mimeType];if(mimeType.startsWith("image/"))
return WebInspector.Resource.Type.Image;if(mimeType.startsWith("font/"))
return WebInspector.Resource.Type.Font;return WebInspector.Resource.Type.Other;}
static displayNameForType(type,plural)
{switch(type){case WebInspector.Resource.Type.Document:if(plural)
return WebInspector.UIString("Documents");return WebInspector.UIString("Document");case WebInspector.Resource.Type.Stylesheet:if(plural)
return WebInspector.UIString("Stylesheets");return WebInspector.UIString("Stylesheet");case WebInspector.Resource.Type.Image:if(plural)
return WebInspector.UIString("Images");return WebInspector.UIString("Image");case WebInspector.Resource.Type.Font:if(plural)
return WebInspector.UIString("Fonts");return WebInspector.UIString("Font");case WebInspector.Resource.Type.Script:if(plural)
return WebInspector.UIString("Scripts");return WebInspector.UIString("Script");case WebInspector.Resource.Type.XHR:if(plural)
return WebInspector.UIString("XHRs");return WebInspector.UIString("XHR");case WebInspector.Resource.Type.Fetch:if(plural)
return WebInspector.UIString("Fetches");return WebInspector.UIString("Fetch");case WebInspector.Resource.Type.WebSocket:if(plural)
return WebInspector.UIString("Sockets");return WebInspector.UIString("Socket");case WebInspector.Resource.Type.Other:return WebInspector.UIString("Other");default:console.error("Unknown resource type",type);return null;}}
static displayNameForProtocol(protocol)
{switch(protocol){case"h2":return"HTTP/2";case"http/1.0":return"HTTP/1.0";case"http/1.1":return"HTTP/1.1";case"spdy/2":return"SPDY/2";case"spdy/3":return"SPDY/3";case"spdy/3.1":return"SPDY/3.1";default:return null;}}
static comparePriority(a,b)
{const map={[WebInspector.Resource.NetworkPriority.Unknown]:0,[WebInspector.Resource.NetworkPriority.Low]:1,[WebInspector.Resource.NetworkPriority.Medium]:2,[WebInspector.Resource.NetworkPriority.High]:3,};let aNum=map[a]||0;let bNum=map[b]||0;return aNum-bNum;}
static displayNameForPriority(priority)
{switch(priority){case WebInspector.Resource.NetworkPriority.Low:return WebInspector.UIString("Low");case WebInspector.Resource.NetworkPriority.Medium:return WebInspector.UIString("Medium");case WebInspector.Resource.NetworkPriority.High:return WebInspector.UIString("High");default:return null;}}
static responseSourceFromPayload(source)
{if(!source)
return WebInspector.Resource.ResponseSource.Unknown;switch(source){case NetworkAgent.ResponseSource.Unknown:return WebInspector.Resource.ResponseSource.Unknown;case NetworkAgent.ResponseSource.Network:return WebInspector.Resource.ResponseSource.Network;case NetworkAgent.ResponseSource.MemoryCache:return WebInspector.Resource.ResponseSource.MemoryCache;case NetworkAgent.ResponseSource.DiskCache:return WebInspector.Resource.ResponseSource.DiskCache;default:console.error("Unknown response source type",source);return WebInspector.Resource.ResponseSource.Unknown;}}
static networkPriorityFromPayload(priority)
{switch(priority){case NetworkAgent.MetricsPriority.Low:return WebInspector.Resource.NetworkPriority.Low;case NetworkAgent.MetricsPriority.Medium:return WebInspector.Resource.NetworkPriority.Medium;case NetworkAgent.MetricsPriority.High:return WebInspector.Resource.NetworkPriority.High;default:console.error("Unknown metrics priority",priority);return WebInspector.Resource.NetworkPriority.Unknown;}}
static connectionIdentifierFromPayload(connectionIdentifier)
{if(!WebInspector.Resource.connectionIdentifierMap){WebInspector.Resource.connectionIdentifierMap=new Map;WebInspector.Resource.nextConnectionIdentifier=1;}
let id=WebInspector.Resource.connectionIdentifierMap.get(connectionIdentifier);if(id)
return id;id=WebInspector.Resource.nextConnectionIdentifier++;WebInspector.Resource.connectionIdentifierMap.set(connectionIdentifier,id);return id;}
get target(){return this._target;}
get type(){return this._type;}
get loaderIdentifier(){return this._loaderIdentifier;}
get requestIdentifier(){return this._requestIdentifier;}
get requestMethod(){return this._requestMethod;}
get requestData(){return this._requestData;}
get statusCode(){return this._statusCode;}
get statusText(){return this._statusText;}
get responseSource(){return this._responseSource;}
get timingData(){return this._timingData;}
get protocol(){return this._protocol;}
get priority(){return this._priority;}
get remoteAddress(){return this._remoteAddress;}
get connectionIdentifier(){return this._connectionIdentifier;}
get url()
{return this._url;}
get urlComponents()
{if(!this._urlComponents)
this._urlComponents=parseURL(this._url);return this._urlComponents;}
get displayName()
{return WebInspector.displayNameForURL(this._url,this.urlComponents);}
get displayURL()
{const isMultiLine=true;const dataURIMaxSize=64;return WebInspector.truncateURL(this._url,isMultiLine,dataURIMaxSize);}
get initiatorSourceCodeLocation()
{return this._initiatorSourceCodeLocation;}
get initiatedResources()
{return this._initiatedResources;}
get originalRequestWillBeSentTimestamp()
{return this._originalRequestWillBeSentTimestamp;}
get mimeType()
{return this._mimeType;}
get mimeTypeComponents()
{if(!this._mimeTypeComponents)
this._mimeTypeComponents=parseMIMEType(this._mimeType);return this._mimeTypeComponents;}
get syntheticMIMEType()
{
if(this._type===WebInspector.Resource.typeFromMIMEType(this._mimeType))
return this._mimeType;
switch(this._type){case WebInspector.Resource.Type.Stylesheet:return"text/css";case WebInspector.Resource.Type.Script:return"text/javascript";}
return this._mimeType;}
createObjectURL()
{let content=this.content;if(!content)
return this._url;if(content instanceof Blob)
return URL.createObjectURL(content);return null;}
isMainResource()
{return this._parentFrame?this._parentFrame.mainResource===this:false;}
addInitiatedResource(resource)
{if(!(resource instanceof WebInspector.Resource))
return;this._initiatedResources.push(resource);this.dispatchEventToListeners(WebInspector.Resource.Event.InitiatedResourcesDidChange);}
get parentFrame()
{return this._parentFrame;}
get finished()
{return this._finished;}
get failed()
{return this._failed;}
get canceled()
{return this._canceled;}
get failureReasonText()
{return this._failureReasonText;}
get requestDataContentType()
{return this._requestHeaders.valueForCaseInsensitiveKey("Content-Type")||null;}
get requestHeaders()
{return this._requestHeaders;}
get responseHeaders()
{return this._responseHeaders;}
get requestSentTimestamp()
{return this._requestSentTimestamp;}
get lastRedirectReceivedTimestamp()
{return this._lastRedirectReceivedTimestamp;}
get responseReceivedTimestamp()
{return this._responseReceivedTimestamp;}
get lastDataReceivedTimestamp()
{return this._lastDataReceivedTimestamp;}
get finishedOrFailedTimestamp()
{return this._finishedOrFailedTimestamp;}
get firstTimestamp()
{return this.timingData.startTime||this.lastRedirectReceivedTimestamp||this.responseReceivedTimestamp||this.lastDataReceivedTimestamp||this.finishedOrFailedTimestamp;}
get lastTimestamp()
{return this.timingData.responseEnd||this.lastDataReceivedTimestamp||this.responseReceivedTimestamp||this.lastRedirectReceivedTimestamp||this.requestSentTimestamp;}
get duration()
{return this.timingData.responseEnd-this.timingData.requestStart;}
get latency()
{return this.timingData.responseStart-this.timingData.requestStart;}
get receiveDuration()
{return this.timingData.responseEnd-this.timingData.responseStart;}
get cached()
{return this._cached;}
get requestHeadersTransferSize(){return this._requestHeadersTransferSize;}
get requestBodyTransferSize(){return this._requestBodyTransferSize;}
get responseHeadersTransferSize(){return this._responseHeadersTransferSize;}
get responseBodyTransferSize(){return this._responseBodyTransferSize;}
get cachedResponseBodySize(){return this._cachedResponseBodySize;}
get size()
{if(!isNaN(this._cachedResponseBodySize))
return this._cachedResponseBodySize;if(!isNaN(this._responseBodySize)&&this._responseBodySize!==0)
return this._responseBodySize;return this._estimatedSize;}
get networkEncodedSize()
{return this._responseBodyTransferSize;}
get networkDecodedSize()
{return this._responseBodySize;}
get networkTotalTransferSize()
{return this._responseHeadersTransferSize+this._responseBodyTransferSize;}
get estimatedNetworkEncodedSize()
{let exact=this.networkEncodedSize;if(!isNaN(exact))
return exact;if(this._cached)
return 0;
if(WebInspector.Platform.name==="mac"){let contentLength=Number(this._responseHeaders.valueForCaseInsensitiveKey("Content-Length"));if(!isNaN(contentLength))
return contentLength;}
if(!isNaN(this._estimatedTransferSize))
return this._estimatedTransferSize;
return Number(this._responseHeaders.valueForCaseInsensitiveKey("Content-Length")||this._estimatedSize);}
get estimatedTotalTransferSize()
{let exact=this.networkTotalTransferSize;if(!isNaN(exact))
return exact;if(this.statusCode===304)
return this._estimatedResponseHeadersSize;if(this._cached)
return 0;return this._estimatedResponseHeadersSize+this.estimatedNetworkEncodedSize;}
get compressed()
{let contentEncoding=this._responseHeaders.valueForCaseInsensitiveKey("Content-Encoding");return!!(contentEncoding&&/\b(?:gzip|deflate)\b/.test(contentEncoding));}
get scripts()
{return this._scripts||[];}
scriptForLocation(sourceCodeLocation)
{if(sourceCodeLocation.sourceCode!==this)
return null;var lineNumber=sourceCodeLocation.lineNumber;var columnNumber=sourceCodeLocation.columnNumber;for(var i=0;i<this._scripts.length;++i){var script=this._scripts[i];if(script.range.startLine<=lineNumber&&script.range.endLine>=lineNumber){if(script.range.startLine===lineNumber&&columnNumber<script.range.startColumn)
continue;if(script.range.endLine===lineNumber&&columnNumber>script.range.endColumn)
continue;return script;}}
return null;}
updateForRedirectResponse(url,requestHeaders,elapsedTime)
{var oldURL=this._url;this._url=url;this._requestHeaders=requestHeaders||{};this._lastRedirectReceivedTimestamp=elapsedTime||NaN;if(oldURL!==url){this._urlComponents=null;this.dispatchEventToListeners(WebInspector.Resource.Event.URLDidChange,{oldURL});}
this.dispatchEventToListeners(WebInspector.Resource.Event.RequestHeadersDidChange);this.dispatchEventToListeners(WebInspector.Resource.Event.TimestampsDidChange);}
hasResponse()
{return!isNaN(this._statusCode);}
updateForResponse(url,mimeType,type,responseHeaders,statusCode,statusText,elapsedTime,timingData,source)
{let oldURL=this._url;let oldMIMEType=this._mimeType;let oldType=this._type;if(type in WebInspector.Resource.Type)
type=WebInspector.Resource.Type[type];this._url=url;this._mimeType=mimeType;this._type=type||WebInspector.Resource.typeFromMIMEType(mimeType);this._statusCode=statusCode;this._statusText=statusText;this._responseHeaders=responseHeaders||{};this._responseReceivedTimestamp=elapsedTime||NaN;this._timingData=WebInspector.ResourceTimingData.fromPayload(timingData,this);if(source)
this._responseSource=WebInspector.Resource.responseSourceFromPayload(source);const headerBaseSize=12;const headerPad=4;this._estimatedResponseHeadersSize=String(this._statusCode).length+this._statusText.length+headerBaseSize;for(let name in this._responseHeaders)
this._estimatedResponseHeadersSize+=name.length+this._responseHeaders[name].length+headerPad;if(!this._cached){if(statusCode===304||(this._responseSource===WebInspector.Resource.ResponseSource.MemoryCache||this._responseSource===WebInspector.Resource.ResponseSource.DiskCache))
this.markAsCached();}
if(oldURL!==url){this._urlComponents=null;this.dispatchEventToListeners(WebInspector.Resource.Event.URLDidChange,{oldURL});}
if(oldMIMEType!==mimeType){this._mimeTypeComponents=null;this.dispatchEventToListeners(WebInspector.Resource.Event.MIMETypeDidChange,{oldMIMEType});}
if(oldType!==type)
this.dispatchEventToListeners(WebInspector.Resource.Event.TypeDidChange,{oldType});
if(statusCode===304||this._responseHeaders.valueForCaseInsensitiveKey("Content-Length"))
this.dispatchEventToListeners(WebInspector.Resource.Event.TransferSizeDidChange);this.dispatchEventToListeners(WebInspector.Resource.Event.ResponseReceived);this.dispatchEventToListeners(WebInspector.Resource.Event.TimestampsDidChange);}
updateWithMetrics(metrics)
{this._receivedNetworkLoadMetrics=true;if(metrics.protocol)
this._protocol=metrics.protocol;if(metrics.priority)
this._priority=WebInspector.Resource.networkPriorityFromPayload(metrics.priority);if(metrics.remoteAddress)
this._remoteAddress=metrics.remoteAddress;if(metrics.connectionIdentifier)
this._connectionIdentifier=WebInspector.Resource.connectionIdentifierFromPayload(metrics.connectionIdentifier);if(metrics.requestHeaders){this._requestHeaders=metrics.requestHeaders;this.dispatchEventToListeners(WebInspector.Resource.Event.RequestHeadersDidChange);}
if("requestHeaderBytesSent"in metrics){this._requestHeadersTransferSize=metrics.requestHeaderBytesSent;this._requestBodyTransferSize=metrics.requestBodyBytesSent;this._responseHeadersTransferSize=metrics.responseHeaderBytesReceived;this._responseBodyTransferSize=metrics.responseBodyBytesReceived;this._responseBodySize=metrics.responseBodyDecodedSize;this.dispatchEventToListeners(WebInspector.Resource.Event.SizeDidChange,{previousSize:this._estimatedSize});this.dispatchEventToListeners(WebInspector.Resource.Event.TransferSizeDidChange);}}
setCachedResponseBodySize(size)
{this._cachedResponseBodySize=size;}
requestContentFromBackend()
{if(this._requestIdentifier)
return NetworkAgent.getResponseBody(this._requestIdentifier);if(this._parentFrame)
return PageAgent.getResourceContent(this._parentFrame.id,this._url);return Promise.reject(new Error("Content request failed."));}
increaseSize(dataLength,elapsedTime)
{if(isNaN(this._estimatedSize))
this._estimatedSize=0;let previousSize=this._estimatedSize;this._estimatedSize+=dataLength;this._lastDataReceivedTimestamp=elapsedTime||NaN;this.dispatchEventToListeners(WebInspector.Resource.Event.SizeDidChange,{previousSize});if(isNaN(this._estimatedTransferSize)&&this._statusCode!==304&&!this._responseHeaders.valueForCaseInsensitiveKey("Content-Length"))
this.dispatchEventToListeners(WebInspector.Resource.Event.TransferSizeDidChange);}
increaseTransferSize(encodedDataLength)
{if(isNaN(this._estimatedTransferSize))
this._estimatedTransferSize=0;this._estimatedTransferSize+=encodedDataLength;this.dispatchEventToListeners(WebInspector.Resource.Event.TransferSizeDidChange);}
markAsCached()
{this._cached=true;this.dispatchEventToListeners(WebInspector.Resource.Event.CacheStatusDidChange);if(this._statusCode!==304)
this.dispatchEventToListeners(WebInspector.Resource.Event.TransferSizeDidChange);}
markAsFinished(elapsedTime)
{this._finished=true;this._finishedOrFailedTimestamp=elapsedTime||NaN;this._timingData.markResponseEndTime(elapsedTime||NaN);if(this._finishThenRequestContentPromise)
this._finishThenRequestContentPromise=null;this.dispatchEventToListeners(WebInspector.Resource.Event.LoadingDidFinish);this.dispatchEventToListeners(WebInspector.Resource.Event.TimestampsDidChange);}
markAsFailed(canceled,elapsedTime,errorText)
{this._failed=true;this._canceled=canceled;this._finishedOrFailedTimestamp=elapsedTime||NaN;if(!this._failureReasonText)
this._failureReasonText=errorText||null;this.dispatchEventToListeners(WebInspector.Resource.Event.LoadingDidFail);this.dispatchEventToListeners(WebInspector.Resource.Event.TimestampsDidChange);}
revertMarkAsFinished()
{this._finished=false;this._finishedOrFailedTimestamp=NaN;}
legacyMarkServedFromMemoryCache()
{this._responseSource=WebInspector.Resource.ResponseSource.MemoryCache;this.markAsCached();}
legacyMarkServedFromDiskCache()
{this._responseSource=WebInspector.Resource.ResponseSource.DiskCache;this.markAsCached();}
hadLoadingError()
{return this._failed||this._canceled||this._statusCode>=400;}
getImageSize(callback)
{if(this.type!==WebInspector.Resource.Type.Image)
throw"Resource is not an image.";if(this._imageSize!==undefined){callback(this._imageSize);return;}
var objectURL=null;function imageDidLoad(){URL.revokeObjectURL(objectURL);this._imageSize={width:image.width,height:image.height};callback(this._imageSize);}
function requestContentFailure(){this._imageSize=null;callback(this._imageSize);}
var image=new Image;image.addEventListener("load",imageDidLoad.bind(this),false);this.requestContent().then((content)=>{objectURL=image.src=content.sourceCode.createObjectURL();if(!objectURL)
requestContentFailure.call(this);},requestContentFailure.bind(this));}
requestContent()
{if(this._finished)
return super.requestContent();if(this._failed)
return Promise.resolve({error:WebInspector.UIString("An error occurred trying to load the resource.")});if(!this._finishThenRequestContentPromise){this._finishThenRequestContentPromise=new Promise((resolve,reject)=>{this.addEventListener(WebInspector.Resource.Event.LoadingDidFinish,resolve);this.addEventListener(WebInspector.Resource.Event.LoadingDidFail,reject);}).then(WebInspector.SourceCode.prototype.requestContent.bind(this));}
return this._finishThenRequestContentPromise;}
associateWithScript(script)
{if(!this._scripts)
this._scripts=[];this._scripts.push(script);if(this._type===WebInspector.Resource.Type.Other||this._type===WebInspector.Resource.Type.XHR){let oldType=this._type;this._type=WebInspector.Resource.Type.Script;this.dispatchEventToListeners(WebInspector.Resource.Event.TypeDidChange,{oldType});}}
saveIdentityToCookie(cookie)
{cookie[WebInspector.Resource.URLCookieKey]=this.url.hash;cookie[WebInspector.Resource.MainResourceCookieKey]=this.isMainResource();}
generateCURLCommand()
{function escapeStringPosix(str){function escapeCharacter(x){let code=x.charCodeAt(0);let hex=code.toString(16);if(code<256)
return"\\x"+hex.padStart(2,"0");return"\\u"+hex.padStart(4,"0");}
if(/[^\x20-\x7E]|'/.test(str)){return"$'"+str.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/!/g,"\\041").replace(/[^\x20-\x7E]/g,escapeCharacter)+"'";}else{return`'${str}'`;}}
let command=["curl "+escapeStringPosix(this.url).replace(/[[{}\]]/g,"\\$&")];command.push(`-X${this.requestMethod}`);for(let key in this.requestHeaders)
command.push("-H "+escapeStringPosix(`${key}: ${this.requestHeaders[key]}`));if(this.requestDataContentType&&this.requestMethod!=="GET"&&this.requestData){if(this.requestDataContentType.match(/^application\/x-www-form-urlencoded\s*(;.*)?$/i))
command.push("--data "+escapeStringPosix(this.requestData));else
command.push("--data-binary "+escapeStringPosix(this.requestData));}
let curlCommand=command.join(" \\\n");InspectorFrontendHost.copyText(curlCommand);return curlCommand;}};WebInspector.Resource.TypeIdentifier="resource";WebInspector.Resource.URLCookieKey="resource-url";WebInspector.Resource.MainResourceCookieKey="resource-is-main-resource";WebInspector.Resource.Event={URLDidChange:"resource-url-did-change",MIMETypeDidChange:"resource-mime-type-did-change",TypeDidChange:"resource-type-did-change",RequestHeadersDidChange:"resource-request-headers-did-change",ResponseReceived:"resource-response-received",LoadingDidFinish:"resource-loading-did-finish",LoadingDidFail:"resource-loading-did-fail",TimestampsDidChange:"resource-timestamps-did-change",SizeDidChange:"resource-size-did-change",TransferSizeDidChange:"resource-transfer-size-did-change",CacheStatusDidChange:"resource-cached-did-change",InitiatedResourcesDidChange:"resource-initiated-resources-did-change",};WebInspector.Resource.Type={Document:"resource-type-document",Stylesheet:"resource-type-stylesheet",Image:"resource-type-image",Font:"resource-type-font",Script:"resource-type-script",XHR:"resource-type-xhr",Fetch:"resource-type-fetch",WebSocket:"resource-type-websocket",Other:"resource-type-other"};WebInspector.Resource.ResponseSource={Unknown:Symbol("unknown"),Network:Symbol("network"),MemoryCache:Symbol("memory-cache"),DiskCache:Symbol("disk-cache"),};WebInspector.Resource.NetworkPriority={Unknown:Symbol("unknown"),Low:Symbol("low"),Medium:Symbol("medium"),High:Symbol("high"),};WebInspector.Resource._mimeTypeMap={"text/html":WebInspector.Resource.Type.Document,"text/xml":WebInspector.Resource.Type.Document,"text/plain":WebInspector.Resource.Type.Document,"application/xhtml+xml":WebInspector.Resource.Type.Document,"image/svg+xml":WebInspector.Resource.Type.Document,"text/css":WebInspector.Resource.Type.Stylesheet,"text/xsl":WebInspector.Resource.Type.Stylesheet,"text/x-less":WebInspector.Resource.Type.Stylesheet,"text/x-sass":WebInspector.Resource.Type.Stylesheet,"text/x-scss":WebInspector.Resource.Type.Stylesheet,"application/pdf":WebInspector.Resource.Type.Image,"application/x-font-type1":WebInspector.Resource.Type.Font,"application/x-font-ttf":WebInspector.Resource.Type.Font,"application/x-font-woff":WebInspector.Resource.Type.Font,"application/x-truetype-font":WebInspector.Resource.Type.Font,"text/javascript":WebInspector.Resource.Type.Script,"text/ecmascript":WebInspector.Resource.Type.Script,"application/javascript":WebInspector.Resource.Type.Script,"application/ecmascript":WebInspector.Resource.Type.Script,"application/x-javascript":WebInspector.Resource.Type.Script,"application/json":WebInspector.Resource.Type.Script,"application/x-json":WebInspector.Resource.Type.Script,"text/x-javascript":WebInspector.Resource.Type.Script,"text/x-json":WebInspector.Resource.Type.Script,"text/javascript1.1":WebInspector.Resource.Type.Script,"text/javascript1.2":WebInspector.Resource.Type.Script,"text/javascript1.3":WebInspector.Resource.Type.Script,"text/jscript":WebInspector.Resource.Type.Script,"text/livescript":WebInspector.Resource.Type.Script,"text/x-livescript":WebInspector.Resource.Type.Script,"text/typescript":WebInspector.Resource.Type.Script,"text/x-clojure":WebInspector.Resource.Type.Script,"text/x-coffeescript":WebInspector.Resource.Type.Script};WebInspector.ResourceCollection=class ResourceCollection extends WebInspector.Collection
{constructor(resourceType)
{super(WebInspector.ResourceCollection.verifierForType(resourceType));this._resourceType=resourceType||null;this._resourceURLMap=new Map;this._resourcesTypeMap=new Map;}
static verifierForType(type){switch(type){case WebInspector.Resource.Type.Document:return WebInspector.ResourceCollection.TypeVerifier.Document;case WebInspector.Resource.Type.Stylesheet:return WebInspector.ResourceCollection.TypeVerifier.Stylesheet;case WebInspector.Resource.Type.Image:return WebInspector.ResourceCollection.TypeVerifier.Image;case WebInspector.Resource.Type.Font:return WebInspector.ResourceCollection.TypeVerifier.Font;case WebInspector.Resource.Type.Script:return WebInspector.ResourceCollection.TypeVerifier.Script;case WebInspector.Resource.Type.XHR:return WebInspector.ResourceCollection.TypeVerifier.XHR;case WebInspector.Resource.Type.Fetch:return WebInspector.ResourceCollection.TypeVerifier.Fetch;case WebInspector.Resource.Type.WebSocket:return WebInspector.ResourceCollection.TypeVerifier.WebSocket;case WebInspector.Resource.Type.Other:return WebInspector.ResourceCollection.TypeVerifier.Other;default:return WebInspector.Collection.TypeVerifier.Resource;}}
resourceForURL(url)
{return this._resourceURLMap.get(url)||null;}
resourceCollectionForType(type)
{if(this._resourceType){return this;}
let resourcesCollectionForType=this._resourcesTypeMap.get(type);if(!resourcesCollectionForType){resourcesCollectionForType=new WebInspector.ResourceCollection(type);this._resourcesTypeMap.set(type,resourcesCollectionForType);}
return resourcesCollectionForType;}
clear()
{super.clear();this._resourceURLMap.clear();if(!this._resourceType)
this._resourcesTypeMap.clear();}
itemAdded(item)
{this._associateWithResource(item);}
itemRemoved(item)
{this._disassociateWithResource(item);}
itemsCleared(items)
{const skipRemoval=true;for(let item of items)
this._disassociateWithResource(item,skipRemoval);}
_associateWithResource(resource)
{this._resourceURLMap.set(resource.url,resource);if(!this._resourceType){let resourcesCollectionForType=this.resourceCollectionForType(resource.type);resourcesCollectionForType.add(resource);}
resource.addEventListener(WebInspector.Resource.Event.URLDidChange,this._resourceURLDidChange,this);resource.addEventListener(WebInspector.Resource.Event.TypeDidChange,this._resourceTypeDidChange,this);}
_disassociateWithResource(resource,skipRemoval)
{resource.removeEventListener(WebInspector.Resource.Event.URLDidChange,this._resourceURLDidChange,this);resource.removeEventListener(WebInspector.Resource.Event.TypeDidChange,this._resourceTypeDidChange,this);if(skipRemoval)
return;if(!this._resourceType){let resourcesCollectionForType=this.resourceCollectionForType(resource.type);resourcesCollectionForType.remove(resource);}
this._resourceURLMap.delete(resource.url);}
_resourceURLDidChange(event)
{let resource=event.target;if(!(resource instanceof WebInspector.Resource))
return;let oldURL=event.data.oldURL;if(!oldURL)
return;this._resourceURLMap.set(resource.url,resource);this._resourceURLMap.delete(oldURL);}
_resourceTypeDidChange(event)
{let resource=event.target;if(!(resource instanceof WebInspector.Resource))
return;if(this._resourceType){this.remove(resource);return;}
let resourcesWithNewType=this.resourceCollectionForType(resource.type);resourcesWithNewType.add(resource);
}};WebInspector.ResourceCollection.TypeVerifier={Document:(object)=>WebInspector.Collection.TypeVerifier.Resource(object)&&object.type===WebInspector.Resource.Type.Document,Stylesheet:(object)=>{if(WebInspector.Collection.TypeVerifier.CSSStyleSheet(object))
return true;return WebInspector.Collection.TypeVerifier.Resource(object)&&object.type===WebInspector.Resource.Type.Stylesheet},Image:(object)=>WebInspector.Collection.TypeVerifier.Resource(object)&&object.type===WebInspector.Resource.Type.Image,Font:(object)=>WebInspector.Collection.TypeVerifier.Resource(object)&&object.type===WebInspector.Resource.Type.Font,Script:(object)=>WebInspector.Collection.TypeVerifier.Resource(object)&&object.type===WebInspector.Resource.Type.Script,XHR:(object)=>WebInspector.Collection.TypeVerifier.Resource(object)&&object.type===WebInspector.Resource.Type.XHR,Fetch:(object)=>WebInspector.Collection.TypeVerifier.Resource(object)&&object.type===WebInspector.Resource.Type.Fetch,WebSocket:(object)=>WebInspector.Collection.TypeVerifier.Resource(object)&&object.type===WebInspector.Resource.Type.WebSocket,Other:(object)=>WebInspector.Collection.TypeVerifier.Resource(object)&&object.type===WebInspector.Resource.Type.Other,};WebInspector.ResourceQueryMatch=class QueryMatch extends WebInspector.Object
{constructor(type,index,queryIndex)
{super();this._type=type;this._index=index;this._queryIndex=queryIndex;this._rank=undefined;}
get type(){return this._type;}
get index(){return this._index;}
get queryIndex(){return this._queryIndex;}};WebInspector.ResourceQueryMatch.Type={Normal:Symbol("normal"),Special:Symbol("special")};WebInspector.ResourceQueryResult=class QueryResult extends WebInspector.Object
{constructor(resource,matches,cookie)
{super();this._resource=resource;this._matches=matches;this._cookie=cookie||null;}
get resource(){return this._resource;}
get cookie(){return this._cookie;}
get rank()
{if(this._rank===undefined)
this._calculateRank();return this._rank;}
get matchingTextRanges()
{if(!this._matchingTextRanges)
this._matchingTextRanges=this._createMatchingTextRanges();return this._matchingTextRanges;}
_calculateRank()
{const normalWeight=10;const consecutiveWeight=5;const specialMultiplier=5;function getMultiplier(match){if(match.type===WebInspector.ResourceQueryMatch.Type.Special)
return specialMultiplier;return 1;}
this._rank=0;let previousMatch=null;let consecutiveMatchStart=null;for(let match of this._matches){this._rank+=normalWeight*getMultiplier(match);let consecutive=previousMatch&&previousMatch.index===match.index-1;if(consecutive){if(!consecutiveMatchStart)
consecutiveMatchStart=previousMatch;
this._rank+=consecutiveWeight*getMultiplier(consecutiveMatchStart)*(match.index-consecutiveMatchStart.index);}else if(consecutiveMatchStart)
consecutiveMatchStart=null;previousMatch=match;
if(!consecutive)
this._rank-=match.index*getMultiplier(match);}}
_createMatchingTextRanges()
{if(!this._matches.length)
return[];let ranges=[];let startIndex=this._matches[0].index;let endIndex=startIndex;for(let i=1;i<this._matches.length;++i){let match=this._matches[i];if(match.index===endIndex+1){endIndex++;continue;}
ranges.push(new WebInspector.TextRange(0,startIndex,0,endIndex+1));startIndex=match.index;endIndex=startIndex;}
ranges.push(new WebInspector.TextRange(0,startIndex,0,endIndex+1));return ranges;}
__test_createMatchesMask()
{let filename=this._resource.displayName;let lastIndex=-1;let result="";for(let match of this._matches){let gap=" ".repeat(match.index-lastIndex-1);result+=gap;result+=filename[match.index];lastIndex=match.index;}
return result;}};WebInspector.ResourceTimelineRecord=class ResourceTimelineRecord extends WebInspector.TimelineRecord
{constructor(resource)
{super(WebInspector.TimelineRecord.Type.Network);this._resource=resource;this._resource.addEventListener(WebInspector.Resource.Event.TimestampsDidChange,this._dispatchUpdatedEvent,this);}
get resource()
{return this._resource;}
get updatesDynamically()
{return true;}
get usesActiveStartTime()
{return true;}
get startTime()
{return this._resource.timingData.startTime;}
get activeStartTime()
{return this._resource.timingData.responseStart;}
get endTime()
{return this._resource.timingData.responseEnd;}
_dispatchUpdatedEvent()
{this.dispatchEventToListeners(WebInspector.TimelineRecord.Event.Updated);}};WebInspector.ResourceTimingData=class ResourceTimingData extends WebInspector.Object
{constructor(resource,data)
{super();data=data||{};this._resource=resource;this._startTime=data.startTime||NaN;this._domainLookupStart=data.domainLookupStart||NaN;this._domainLookupEnd=data.domainLookupEnd||NaN;this._connectStart=data.connectStart||NaN;this._connectEnd=data.connectEnd||NaN;this._secureConnectionStart=data.secureConnectionStart||NaN;this._requestStart=data.requestStart||NaN;this._responseStart=data.responseStart||NaN;this._responseEnd=data.responseEnd||NaN;if(this._domainLookupStart>=this._domainLookupEnd)
this._domainLookupStart=this._domainLookupEnd=NaN;if(this._connectStart>=this._connectEnd)
this._connectStart=this._connectEnd=NaN;}
static fromPayload(payload,resource)
{payload=payload||{};if(typeof payload.requestTime==="number"||typeof payload.navigationStart==="number")
payload={};function offsetToTimestamp(offset){return offset>0?payload.startTime+(offset/1000):NaN;}
let data={startTime:payload.startTime,domainLookupStart:offsetToTimestamp(payload.domainLookupStart),domainLookupEnd:offsetToTimestamp(payload.domainLookupEnd),connectStart:offsetToTimestamp(payload.connectStart),connectEnd:offsetToTimestamp(payload.connectEnd),secureConnectionStart:offsetToTimestamp(payload.secureConnectionStart),requestStart:offsetToTimestamp(payload.requestStart),responseStart:offsetToTimestamp(payload.responseStart),responseEnd:offsetToTimestamp(payload.responseEnd)};if(isNaN(data.connectStart)&&!isNaN(data.secureConnectionStart))
data.connectStart=data.secureConnectionStart;return new WebInspector.ResourceTimingData(resource,data);}
get startTime(){return this._startTime||this._resource.requestSentTimestamp;}
get domainLookupStart(){return this._domainLookupStart;}
get domainLookupEnd(){return this._domainLookupEnd;}
get connectStart(){return this._connectStart;}
get connectEnd(){return this._connectEnd;}
get secureConnectionStart(){return this._secureConnectionStart;}
get requestStart(){return this._requestStart||this._startTime||this._resource.requestSentTimestamp;}
get responseStart(){return this._responseStart||this._startTime||this._resource.responseReceivedTimestamp;}
get responseEnd(){return this._responseEnd||this._resource.finishedOrFailedTimestamp;}
markResponseEndTime(responseEnd)
{this._responseEnd=responseEnd;}};WebInspector.Revision=class Revision extends WebInspector.Object
{ apply()
{console.error("Needs to be implemented by a subclass.");}
revert()
{console.error("Needs to be implemented by a subclass.");}
copy()
{return this;}};WebInspector.ScopeChainNode=class ScopeChainNode extends WebInspector.Object
{constructor(type,objects,name,location,empty)
{super();if(type in WebInspector.ScopeChainNode.Type)
type=WebInspector.ScopeChainNode.Type[type];this._type=type||null;this._objects=objects||[];this._name=name||"";this._location=location||null;this._empty=empty||false;}
get type(){return this._type;}
get objects(){return this._objects;}
get name(){return this._name;}
get location(){return this._location;}
get empty(){return this._empty;}
get hash()
{if(this._hash)
return this._hash;this._hash=this._name;if(this._location)
this._hash+=`:${this._location.scriptId}:${this._location.lineNumber}:${this._location.columnNumber}`;return this._hash;}
convertToLocalScope()
{this._type=WebInspector.ScopeChainNode.Type.Local;}};WebInspector.ScopeChainNode.Type={Local:"scope-chain-type-local",Global:"scope-chain-type-global",GlobalLexicalEnvironment:"scope-chain-type-global-lexical-environment",With:"scope-chain-type-with",Closure:"scope-chain-type-closure",Catch:"scope-chain-type-catch",FunctionName:"scope-chain-type-function-name",Block:"scope-chain-type-block",};WebInspector.Script=class Script extends WebInspector.SourceCode
{constructor(target,id,range,url,sourceType,injected,sourceURL,sourceMapURL)
{super();this._target=target;this._id=id||null;this._range=range||null;this._url=url||null;this._sourceType=sourceType||WebInspector.Script.SourceType.Program;this._sourceURL=sourceURL||null;this._sourceMappingURL=sourceMapURL||null;this._injected=injected||false;this._dynamicallyAddedScriptElement=false;this._scriptSyntaxTree=null;this._resource=this._resolveResource();
if(this._resource&&this._resource.type===WebInspector.Resource.Type.Document&&!this._range.startLine&&!this._range.startColumn){let documentResource=this._resource;this._resource=null;this._dynamicallyAddedScriptElement=true;documentResource.parentFrame.addExtraScript(this);this._dynamicallyAddedScriptElementNumber=documentResource.parentFrame.extraScriptCollection.items.size;}else if(this._resource)
this._resource.associateWithScript(this);if(isWebInspectorConsoleEvaluationScript(this._sourceURL)){this._uniqueDisplayNameNumber=this.constructor._nextUniqueConsoleDisplayNameNumber++;}
if(this._sourceMappingURL)
WebInspector.sourceMapManager.downloadSourceMap(this._sourceMappingURL,this._url,this);}
static resetUniqueDisplayNameNumbers()
{WebInspector.Script._nextUniqueDisplayNameNumber=1;WebInspector.Script._nextUniqueConsoleDisplayNameNumber=1;}
get target(){return this._target;}
get id(){return this._id;}
get range(){return this._range;}
get url(){return this._url;}
get sourceType(){return this._sourceType;}
get sourceURL(){return this._sourceURL;}
get sourceMappingURL(){return this._sourceMappingURL;}
get injected(){return this._injected;}
get contentIdentifier()
{if(this._url)
return this._url;if(!this._sourceURL)
return null;
if(isWebInspectorConsoleEvaluationScript(this._sourceURL))
return null;if(isWebInspectorInternalScript(this._sourceURL))
return null;return this._sourceURL;}
get urlComponents()
{if(!this._urlComponents)
this._urlComponents=parseURL(this._url);return this._urlComponents;}
get mimeType()
{return this._resource.mimeType;}
get displayName()
{if(this._url&&!this._dynamicallyAddedScriptElement)
return WebInspector.displayNameForURL(this._url,this.urlComponents);if(isWebInspectorConsoleEvaluationScript(this._sourceURL)){return WebInspector.UIString("Console Evaluation %d").format(this._uniqueDisplayNameNumber);}
if(this._sourceURL){if(!this._sourceURLComponents)
this._sourceURLComponents=parseURL(this._sourceURL);return WebInspector.displayNameForURL(this._sourceURL,this._sourceURLComponents);}
if(this._dynamicallyAddedScriptElement)
return WebInspector.UIString("Script Element %d").format(this._dynamicallyAddedScriptElementNumber);if(!this._uniqueDisplayNameNumber)
this._uniqueDisplayNameNumber=this.constructor._nextUniqueDisplayNameNumber++;return WebInspector.UIString("Anonymous Script %d").format(this._uniqueDisplayNameNumber);}
get displayURL()
{const isMultiLine=true;const dataURIMaxSize=64;if(this._url)
return WebInspector.truncateURL(this._url,isMultiLine,dataURIMaxSize);if(this._sourceURL)
return WebInspector.truncateURL(this._sourceURL,isMultiLine,dataURIMaxSize);return null;}
get dynamicallyAddedScriptElement()
{return this._dynamicallyAddedScriptElement;}
get anonymous()
{return!this._resource&&!this._url&&!this._sourceURL;}
get resource()
{return this._resource;}
get scriptSyntaxTree()
{return this._scriptSyntaxTree;}
isMainResource()
{return this._target.mainResource===this;}
requestContentFromBackend()
{if(!this._id){
return Promise.reject(new Error("There is no identifier to request content with."));}
return this._target.DebuggerAgent.getScriptSource(this._id);}
saveIdentityToCookie(cookie)
{cookie[WebInspector.Script.URLCookieKey]=this.url;cookie[WebInspector.Script.DisplayNameCookieKey]=this.displayName;}
requestScriptSyntaxTree(callback)
{if(this._scriptSyntaxTree){setTimeout(()=>{callback(this._scriptSyntaxTree);},0);return;}
var makeSyntaxTreeAndCallCallback=(content)=>{this._makeSyntaxTree(content);callback(this._scriptSyntaxTree);};var content=this.content;if(!content&&this._resource&&this._resource.type===WebInspector.Resource.Type.Script&&this._resource.finished)
content=this._resource.content;if(content){setTimeout(makeSyntaxTreeAndCallCallback,0,content);return;}
this.requestContent().then(function(parameters){makeSyntaxTreeAndCallCallback(parameters.sourceCode.content);}).catch(function(error){makeSyntaxTreeAndCallCallback(null);});}
_resolveResource()
{
if(!this._url)
return null;let resolver=WebInspector.frameResourceManager;if(this._target!==WebInspector.mainTarget)
resolver=this._target.resourceCollection;try{let resource=resolver.resourceForURL(this._url);if(resource)
return resource;let decodedURL=decodeURI(this._url);if(decodedURL!==this._url){resource=resolver.resourceForURL(decodedURL);if(resource)
return resource;}
let urlWithoutFragment=removeURLFragment(this._url);if(urlWithoutFragment!==this._url){resource=resolver.resourceForURL(urlWithoutFragment);if(resource)
return resource;}
let decodedURLWithoutFragment=removeURLFragment(decodedURL);if(decodedURLWithoutFragment!==decodedURL){resource=resolver.resourceForURL(decodedURLWithoutFragment);if(resource)
return resource;}}catch(e){}
return null;}
_makeSyntaxTree(sourceText)
{if(this._scriptSyntaxTree||!sourceText)
return;this._scriptSyntaxTree=new WebInspector.ScriptSyntaxTree(sourceText,this);}};WebInspector.Script.SourceType={Program:"script-source-type-program",Module:"script-source-type-module",};WebInspector.Script.TypeIdentifier="script";WebInspector.Script.URLCookieKey="script-url";WebInspector.Script.DisplayNameCookieKey="script-display-name";WebInspector.Script._nextUniqueDisplayNameNumber=1;WebInspector.Script._nextUniqueConsoleDisplayNameNumber=1;WebInspector.ScriptInstrument=class ScriptInstrument extends WebInspector.Instrument
{ get timelineRecordType()
{return WebInspector.TimelineRecord.Type.Script;}
startInstrumentation(initiatedByBackend)
{if(!window.ScriptProfilerAgent){super.startInstrumentation();return;}
const includeSamples=true;if(!initiatedByBackend)
ScriptProfilerAgent.startTracking(includeSamples);}
stopInstrumentation(initiatedByBackend)
{if(!window.ScriptProfilerAgent){super.stopInstrumentation();return;}
if(!initiatedByBackend)
ScriptProfilerAgent.stopTracking();}};WebInspector.ScriptSyntaxTree=class ScriptSyntaxTree extends WebInspector.Object
{constructor(sourceText,script)
{super();this._script=script;try{let sourceType=this._script.sourceType===WebInspector.Script.SourceType.Module?"module":"script";let esprimaSyntaxTree=esprima.parse(sourceText,{range:true,sourceType});this._syntaxTree=this._createInternalSyntaxTree(esprimaSyntaxTree);this._parsedSuccessfully=true;}catch(error){this._parsedSuccessfully=false;this._syntaxTree=null;console.error("Couldn't parse JavaScript File: "+script.url,error);}}
get parsedSuccessfully()
{return this._parsedSuccessfully;}
forEachNode(callback)
{if(!this._parsedSuccessfully)
return;this._recurse(this._syntaxTree,callback,this._defaultParserState());}
filter(predicate,startNode)
{if(!this._parsedSuccessfully)
return[];var nodes=[];function filter(node,state)
{if(predicate(node))
nodes.push(node);else
state.skipChildNodes=true;}
this._recurse(startNode,filter,this._defaultParserState());return nodes;}
containersOfOffset(offset)
{if(!this._parsedSuccessfully)
return[];let allNodes=[];const start=0;const end=1;this.forEachNode((node,state)=>{if(node.range[end]<offset)
state.skipChildNodes=true;if(node.range[start]>offset)
state.shouldStopEarly=true;if(node.range[start]<=offset&&node.range[end]>=offset)
allNodes.push(node);});return allNodes;}
filterByRange(startOffset,endOffset)
{if(!this._parsedSuccessfully)
return[];var allNodes=[];var start=0;var end=1;function filterForNodesInRange(node,state)
{
if(node.range[end]<startOffset)
state.skipChildNodes=true;if(startOffset<=node.range[start]&&node.range[start]<=endOffset)
allNodes.push(node);
if(node.range[start]>endOffset)
state.shouldStopEarly=true;}
this.forEachNode(filterForNodesInRange);return allNodes;}
containsNonEmptyReturnStatement(startNode)
{if(!this._parsedSuccessfully)
return false;if(startNode.attachments._hasNonEmptyReturnStatement!==undefined)
return startNode.attachments._hasNonEmptyReturnStatement;function removeFunctionsFilter(node)
{return node.type!==WebInspector.ScriptSyntaxTree.NodeType.FunctionExpression&&node.type!==WebInspector.ScriptSyntaxTree.NodeType.FunctionDeclaration&&node.type!==WebInspector.ScriptSyntaxTree.NodeType.ArrowFunctionExpression;}
var nodes=this.filter(removeFunctionsFilter,startNode);var hasNonEmptyReturnStatement=false;var returnStatementType=WebInspector.ScriptSyntaxTree.NodeType.ReturnStatement;for(var node of nodes){if(node.type===returnStatementType&&node.argument){hasNonEmptyReturnStatement=true;break;}}
startNode.attachments._hasNonEmptyReturnStatement=hasNonEmptyReturnStatement;return hasNonEmptyReturnStatement;}
static functionReturnDivot(node)
{if(!DOMAgent.hasEvent("pseudoElementAdded"))
return node.body.range[0];return node.typeProfilingReturnDivot;}
updateTypes(nodesToUpdate,callback)
{if(!this._parsedSuccessfully)
return;var allRequests=[];var allRequestNodes=[];var sourceID=this._script.id;for(var node of nodesToUpdate){switch(node.type){case WebInspector.ScriptSyntaxTree.NodeType.FunctionDeclaration:case WebInspector.ScriptSyntaxTree.NodeType.FunctionExpression:case WebInspector.ScriptSyntaxTree.NodeType.ArrowFunctionExpression:for(var param of node.params){for(var identifier of this._gatherIdentifiersInDeclaration(param)){allRequests.push({typeInformationDescriptor:WebInspector.ScriptSyntaxTree.TypeProfilerSearchDescriptor.NormalExpression,sourceID,divot:identifier.range[0]});allRequestNodes.push(identifier);}}
allRequests.push({typeInformationDescriptor:WebInspector.ScriptSyntaxTree.TypeProfilerSearchDescriptor.FunctionReturn,sourceID,divot:WebInspector.ScriptSyntaxTree.functionReturnDivot(node)});allRequestNodes.push(node);break;case WebInspector.ScriptSyntaxTree.NodeType.VariableDeclarator:for(var identifier of this._gatherIdentifiersInDeclaration(node.id)){allRequests.push({typeInformationDescriptor:WebInspector.ScriptSyntaxTree.TypeProfilerSearchDescriptor.NormalExpression,sourceID,divot:identifier.range[0]});allRequestNodes.push(identifier);}
break;}}
function handleTypes(error,typeInformationArray)
{if(error)
return;for(var i=0;i<typeInformationArray.length;i++){var node=allRequestNodes[i];var typeInformation=WebInspector.TypeDescription.fromPayload(typeInformationArray[i]);if(allRequests[i].typeInformationDescriptor===WebInspector.ScriptSyntaxTree.TypeProfilerSearchDescriptor.FunctionReturn)
node.attachments.returnTypes=typeInformation;else
node.attachments.types=typeInformation;}
callback(allRequestNodes);}
this._script.target.RuntimeAgent.getRuntimeTypesForVariablesAtOffsets(allRequests,handleTypes);}
_gatherIdentifiersInDeclaration(node)
{function gatherIdentifiers(node)
{switch(node.type){case WebInspector.ScriptSyntaxTree.NodeType.Identifier:return[node];case WebInspector.ScriptSyntaxTree.NodeType.Property:return gatherIdentifiers(node.value);case WebInspector.ScriptSyntaxTree.NodeType.ObjectPattern:var identifiers=[];for(var property of node.properties){for(var identifier of gatherIdentifiers(property))
identifiers.push(identifier);}
return identifiers;case WebInspector.ScriptSyntaxTree.NodeType.ArrayPattern:var identifiers=[];for(var element of node.elements){for(var identifier of gatherIdentifiers(element))
identifiers.push(identifier);}
return identifiers;case WebInspector.ScriptSyntaxTree.NodeType.AssignmentPattern:return gatherIdentifiers(node.left);case WebInspector.ScriptSyntaxTree.NodeType.RestElement:case WebInspector.ScriptSyntaxTree.NodeType.RestProperty:return gatherIdentifiers(node.argument);default:return[];}}
return gatherIdentifiers(node);}
_defaultParserState()
{return{shouldStopEarly:false,skipChildNodes:false};}
_recurse(node,callback,state)
{if(!node)
return;if(state.shouldStopEarly||state.skipChildNodes)
return;callback(node,state);switch(node.type){case WebInspector.ScriptSyntaxTree.NodeType.AssignmentExpression:this._recurse(node.left,callback,state);this._recurse(node.right,callback,state);break;case WebInspector.ScriptSyntaxTree.NodeType.ArrayExpression:case WebInspector.ScriptSyntaxTree.NodeType.ArrayPattern:this._recurseArray(node.elements,callback,state);break;case WebInspector.ScriptSyntaxTree.NodeType.AssignmentPattern:this._recurse(node.left,callback,state);this._recurse(node.right,callback,state);break;case WebInspector.ScriptSyntaxTree.NodeType.AwaitExpression:this._recurse(node.argument,callback,state);break;case WebInspector.ScriptSyntaxTree.NodeType.BlockStatement:this._recurseArray(node.body,callback,state);break;case WebInspector.ScriptSyntaxTree.NodeType.BinaryExpression:this._recurse(node.left,callback,state);this._recurse(node.right,callback,state);break;case WebInspector.ScriptSyntaxTree.NodeType.BreakStatement:this._recurse(node.label,callback,state);break;case WebInspector.ScriptSyntaxTree.NodeType.CatchClause:this._recurse(node.param,callback,state);this._recurse(node.body,callback,state);break;case WebInspector.ScriptSyntaxTree.NodeType.CallExpression:this._recurse(node.callee,callback,state);this._recurseArray(node.arguments,callback,state);break;case WebInspector.ScriptSyntaxTree.NodeType.ClassBody:this._recurseArray(node.body,callback,state);break;case WebInspector.ScriptSyntaxTree.NodeType.ClassDeclaration:case WebInspector.ScriptSyntaxTree.NodeType.ClassExpression:this._recurse(node.id,callback,state);this._recurse(node.superClass,callback,state);this._recurse(node.body,callback,state);break;case WebInspector.ScriptSyntaxTree.NodeType.ContinueStatement:this._recurse(node.label,callback,state);break;case WebInspector.ScriptSyntaxTree.NodeType.DoWhileStatement:this._recurse(node.body,callback,state);this._recurse(node.test,callback,state);break;case WebInspector.ScriptSyntaxTree.NodeType.ExpressionStatement:this._recurse(node.expression,callback,state);break;case WebInspector.ScriptSyntaxTree.NodeType.ForStatement:this._recurse(node.init,callback,state);this._recurse(node.test,callback,state);this._recurse(node.update,callback,state);this._recurse(node.body,callback,state);break;case WebInspector.ScriptSyntaxTree.NodeType.ForInStatement:case WebInspector.ScriptSyntaxTree.NodeType.ForOfStatement:this._recurse(node.left,callback,state);this._recurse(node.right,callback,state);this._recurse(node.body,callback,state);break;case WebInspector.ScriptSyntaxTree.NodeType.FunctionDeclaration:case WebInspector.ScriptSyntaxTree.NodeType.FunctionExpression:case WebInspector.ScriptSyntaxTree.NodeType.ArrowFunctionExpression:this._recurse(node.id,callback,state);this._recurseArray(node.params,callback,state);this._recurse(node.body,callback,state);break;case WebInspector.ScriptSyntaxTree.NodeType.IfStatement:this._recurse(node.test,callback,state);this._recurse(node.consequent,callback,state);this._recurse(node.alternate,callback,state);break;case WebInspector.ScriptSyntaxTree.NodeType.LabeledStatement:this._recurse(node.label,callback,state);this._recurse(node.body,callback,state);break;case WebInspector.ScriptSyntaxTree.NodeType.LogicalExpression:this._recurse(node.left,callback,state);this._recurse(node.right,callback,state);break;case WebInspector.ScriptSyntaxTree.NodeType.MemberExpression:this._recurse(node.object,callback,state);this._recurse(node.property,callback,state);break;case WebInspector.ScriptSyntaxTree.NodeType.MethodDefinition:this._recurse(node.key,callback,state);this._recurse(node.value,callback,state);break;case WebInspector.ScriptSyntaxTree.NodeType.NewExpression:this._recurse(node.callee,callback,state);this._recurseArray(node.arguments,callback,state);break;case WebInspector.ScriptSyntaxTree.NodeType.ObjectExpression:case WebInspector.ScriptSyntaxTree.NodeType.ObjectPattern:this._recurseArray(node.properties,callback,state);break;case WebInspector.ScriptSyntaxTree.NodeType.Program:this._recurseArray(node.body,callback,state);break;case WebInspector.ScriptSyntaxTree.NodeType.Property:this._recurse(node.key,callback,state);this._recurse(node.value,callback,state);break;case WebInspector.ScriptSyntaxTree.NodeType.RestElement:this._recurse(node.argument,callback,state);break;case WebInspector.ScriptSyntaxTree.NodeType.RestProperty:this._recurse(node.argument,callback,state);break;case WebInspector.ScriptSyntaxTree.NodeType.ReturnStatement:this._recurse(node.argument,callback,state);break;case WebInspector.ScriptSyntaxTree.NodeType.SequenceExpression:this._recurseArray(node.expressions,callback,state);break;case WebInspector.ScriptSyntaxTree.NodeType.SpreadElement:this._recurse(node.argument,callback,state);break;case WebInspector.ScriptSyntaxTree.NodeType.SpreadProperty:this._recurse(node.argument,callback,state);break;case WebInspector.ScriptSyntaxTree.NodeType.SwitchStatement:this._recurse(node.discriminant,callback,state);this._recurseArray(node.cases,callback,state);break;case WebInspector.ScriptSyntaxTree.NodeType.SwitchCase:this._recurse(node.test,callback,state);this._recurseArray(node.consequent,callback,state);break;case WebInspector.ScriptSyntaxTree.NodeType.ConditionalExpression:this._recurse(node.test,callback,state);this._recurse(node.consequent,callback,state);this._recurse(node.alternate,callback,state);break;case WebInspector.ScriptSyntaxTree.NodeType.TaggedTemplateExpression:this._recurse(node.tag,callback,state);this._recurse(node.quasi,callback,state);break;case WebInspector.ScriptSyntaxTree.NodeType.TemplateLiteral:this._recurseArray(node.quasis,callback,state);this._recurseArray(node.expressions,callback,state);break;case WebInspector.ScriptSyntaxTree.NodeType.ThrowStatement:this._recurse(node.argument,callback,state);break;case WebInspector.ScriptSyntaxTree.NodeType.TryStatement:this._recurse(node.block,callback,state);this._recurse(node.handler,callback,state);this._recurse(node.finalizer,callback,state);break;case WebInspector.ScriptSyntaxTree.NodeType.UnaryExpression:this._recurse(node.argument,callback,state);break;case WebInspector.ScriptSyntaxTree.NodeType.UpdateExpression:this._recurse(node.argument,callback,state);break;case WebInspector.ScriptSyntaxTree.NodeType.VariableDeclaration:this._recurseArray(node.declarations,callback,state);break;case WebInspector.ScriptSyntaxTree.NodeType.VariableDeclarator:this._recurse(node.id,callback,state);this._recurse(node.init,callback,state);break;case WebInspector.ScriptSyntaxTree.NodeType.WhileStatement:this._recurse(node.test,callback,state);this._recurse(node.body,callback,state);break;case WebInspector.ScriptSyntaxTree.NodeType.WithStatement:this._recurse(node.object,callback,state);this._recurse(node.body,callback,state);break;case WebInspector.ScriptSyntaxTree.NodeType.YieldExpression:this._recurse(node.argument,callback,state);break;case WebInspector.ScriptSyntaxTree.NodeType.ExportAllDeclaration:this._recurse(node.source,callback,state);break;case WebInspector.ScriptSyntaxTree.NodeType.ExportNamedDeclaration:this._recurse(node.declaration,callback,state);this._recurseArray(node.specifiers,callback,state);this._recurse(node.source,callback,state);break;case WebInspector.ScriptSyntaxTree.NodeType.ExportDefaultDeclaration:this._recurse(node.declaration,callback,state);break;case WebInspector.ScriptSyntaxTree.NodeType.ExportSpecifier:this._recurse(node.local,callback,state);this._recurse(node.exported,callback,state);break;case WebInspector.ScriptSyntaxTree.NodeType.ImportDeclaration:this._recurseArray(node.specifiers,callback,state);this._recurse(node.source,callback,state);break;case WebInspector.ScriptSyntaxTree.NodeType.ImportDefaultSpecifier:this._recurse(node.local,callback,state);break;case WebInspector.ScriptSyntaxTree.NodeType.ImportNamespaceSpecifier:this._recurse(node.local,callback,state);break;case WebInspector.ScriptSyntaxTree.NodeType.ImportSpecifier:this._recurse(node.imported,callback,state);this._recurse(node.local,callback,state);break;case WebInspector.ScriptSyntaxTree.NodeType.DebuggerStatement:case WebInspector.ScriptSyntaxTree.NodeType.EmptyStatement:case WebInspector.ScriptSyntaxTree.NodeType.Identifier:case WebInspector.ScriptSyntaxTree.NodeType.Import:case WebInspector.ScriptSyntaxTree.NodeType.Literal:case WebInspector.ScriptSyntaxTree.NodeType.MetaProperty:case WebInspector.ScriptSyntaxTree.NodeType.Super:case WebInspector.ScriptSyntaxTree.NodeType.ThisExpression:case WebInspector.ScriptSyntaxTree.NodeType.TemplateElement:break;}
state.skipChildNodes=false;}
_recurseArray(array,callback,state)
{for(var node of array)
this._recurse(node,callback,state);}
_createInternalSyntaxTree(node)
{if(!node)
return null;var result=null;switch(node.type){case"ArrayExpression":result={type:WebInspector.ScriptSyntaxTree.NodeType.ArrayExpression,elements:node.elements.map(this._createInternalSyntaxTree,this)};break;case"ArrayPattern":result={type:WebInspector.ScriptSyntaxTree.NodeType.ArrayPattern,elements:node.elements.map(this._createInternalSyntaxTree,this)};break;case"ArrowFunctionExpression":result={type:WebInspector.ScriptSyntaxTree.NodeType.ArrowFunctionExpression,id:this._createInternalSyntaxTree(node.id),params:node.params.map(this._createInternalSyntaxTree,this),body:this._createInternalSyntaxTree(node.body),generator:node.generator,expression:node.expression,async:node.async,typeProfilingReturnDivot:node.range[0]};break;case"AssignmentExpression":result={type:WebInspector.ScriptSyntaxTree.NodeType.AssignmentExpression,operator:node.operator,left:this._createInternalSyntaxTree(node.left),right:this._createInternalSyntaxTree(node.right)};break;case"AssignmentPattern":result={type:WebInspector.ScriptSyntaxTree.NodeType.AssignmentPattern,left:this._createInternalSyntaxTree(node.left),right:this._createInternalSyntaxTree(node.right),};break;case"AwaitExpression":result={type:WebInspector.ScriptSyntaxTree.NodeType.AwaitExpression,argument:this._createInternalSyntaxTree(node.argument),};break;case"BlockStatement":result={type:WebInspector.ScriptSyntaxTree.NodeType.BlockStatement,body:node.body.map(this._createInternalSyntaxTree,this)};break;case"BinaryExpression":result={type:WebInspector.ScriptSyntaxTree.NodeType.BinaryExpression,operator:node.operator,left:this._createInternalSyntaxTree(node.left),right:this._createInternalSyntaxTree(node.right)};break;case"BreakStatement":result={type:WebInspector.ScriptSyntaxTree.NodeType.BreakStatement,label:this._createInternalSyntaxTree(node.label)};break;case"CallExpression":result={type:WebInspector.ScriptSyntaxTree.NodeType.CallExpression,callee:this._createInternalSyntaxTree(node.callee),arguments:node.arguments.map(this._createInternalSyntaxTree,this)};break;case"CatchClause":result={type:WebInspector.ScriptSyntaxTree.NodeType.CatchClause,param:this._createInternalSyntaxTree(node.param),body:this._createInternalSyntaxTree(node.body)};break;case"ClassBody":result={type:WebInspector.ScriptSyntaxTree.NodeType.ClassBody,body:node.body.map(this._createInternalSyntaxTree,this)};break;case"ClassDeclaration":result={type:WebInspector.ScriptSyntaxTree.NodeType.ClassDeclaration,id:this._createInternalSyntaxTree(node.id),superClass:this._createInternalSyntaxTree(node.superClass),body:this._createInternalSyntaxTree(node.body),};break;case"ClassExpression":result={type:WebInspector.ScriptSyntaxTree.NodeType.ClassExpression,id:this._createInternalSyntaxTree(node.id),superClass:this._createInternalSyntaxTree(node.superClass),body:this._createInternalSyntaxTree(node.body),};break;case"ConditionalExpression":result={type:WebInspector.ScriptSyntaxTree.NodeType.ConditionalExpression,test:this._createInternalSyntaxTree(node.test),consequent:this._createInternalSyntaxTree(node.consequent),alternate:this._createInternalSyntaxTree(node.alternate)};break;case"ContinueStatement":result={type:WebInspector.ScriptSyntaxTree.NodeType.ContinueStatement,label:this._createInternalSyntaxTree(node.label)};break;case"DoWhileStatement":result={type:WebInspector.ScriptSyntaxTree.NodeType.DoWhileStatement,body:this._createInternalSyntaxTree(node.body),test:this._createInternalSyntaxTree(node.test)};break;case"DebuggerStatement":result={type:WebInspector.ScriptSyntaxTree.NodeType.DebuggerStatement};break;case"EmptyStatement":result={type:WebInspector.ScriptSyntaxTree.NodeType.EmptyStatement};break;case"ExpressionStatement":result={type:WebInspector.ScriptSyntaxTree.NodeType.ExpressionStatement,expression:this._createInternalSyntaxTree(node.expression)};break;case"ForStatement":result={type:WebInspector.ScriptSyntaxTree.NodeType.ForStatement,init:this._createInternalSyntaxTree(node.init),test:this._createInternalSyntaxTree(node.test),update:this._createInternalSyntaxTree(node.update),body:this._createInternalSyntaxTree(node.body)};break;case"ForInStatement":result={type:WebInspector.ScriptSyntaxTree.NodeType.ForInStatement,left:this._createInternalSyntaxTree(node.left),right:this._createInternalSyntaxTree(node.right),body:this._createInternalSyntaxTree(node.body)};break;case"ForOfStatement":result={type:WebInspector.ScriptSyntaxTree.NodeType.ForOfStatement,left:this._createInternalSyntaxTree(node.left),right:this._createInternalSyntaxTree(node.right),body:this._createInternalSyntaxTree(node.body)};break;case"FunctionDeclaration":result={type:WebInspector.ScriptSyntaxTree.NodeType.FunctionDeclaration,id:this._createInternalSyntaxTree(node.id),params:node.params.map(this._createInternalSyntaxTree,this),body:this._createInternalSyntaxTree(node.body),generator:node.generator,async:node.async,typeProfilingReturnDivot:node.range[0]};break;case"FunctionExpression":result={type:WebInspector.ScriptSyntaxTree.NodeType.FunctionExpression,id:this._createInternalSyntaxTree(node.id),params:node.params.map(this._createInternalSyntaxTree,this),body:this._createInternalSyntaxTree(node.body),generator:node.generator,async:node.async,typeProfilingReturnDivot:node.range[0]
};break;case"Identifier":result={type:WebInspector.ScriptSyntaxTree.NodeType.Identifier,name:node.name};break;case"IfStatement":result={type:WebInspector.ScriptSyntaxTree.NodeType.IfStatement,test:this._createInternalSyntaxTree(node.test),consequent:this._createInternalSyntaxTree(node.consequent),alternate:this._createInternalSyntaxTree(node.alternate)};break;case"Literal":result={type:WebInspector.ScriptSyntaxTree.NodeType.Literal,value:node.value,raw:node.raw};break;case"LabeledStatement":result={type:WebInspector.ScriptSyntaxTree.NodeType.LabeledStatement,label:this._createInternalSyntaxTree(node.label),body:this._createInternalSyntaxTree(node.body)};break;case"LogicalExpression":result={type:WebInspector.ScriptSyntaxTree.NodeType.LogicalExpression,left:this._createInternalSyntaxTree(node.left),right:this._createInternalSyntaxTree(node.right),operator:node.operator};break;case"MemberExpression":result={type:WebInspector.ScriptSyntaxTree.NodeType.MemberExpression,object:this._createInternalSyntaxTree(node.object),property:this._createInternalSyntaxTree(node.property),computed:node.computed};break;case"MetaProperty":result={type:WebInspector.ScriptSyntaxTree.NodeType.MetaProperty,meta:this._createInternalSyntaxTree(node.meta),property:this._createInternalSyntaxTree(node.property),};break;case"MethodDefinition":result={type:WebInspector.ScriptSyntaxTree.NodeType.MethodDefinition,key:this._createInternalSyntaxTree(node.key),value:this._createInternalSyntaxTree(node.value),computed:node.computed,kind:node.kind,static:node.static};result.value.typeProfilingReturnDivot=node.range[0];break;case"NewExpression":result={type:WebInspector.ScriptSyntaxTree.NodeType.NewExpression,callee:this._createInternalSyntaxTree(node.callee),arguments:node.arguments.map(this._createInternalSyntaxTree,this)};break;case"ObjectExpression":result={type:WebInspector.ScriptSyntaxTree.NodeType.ObjectExpression,properties:node.properties.map(this._createInternalSyntaxTree,this)};break;case"ObjectPattern":result={type:WebInspector.ScriptSyntaxTree.NodeType.ObjectPattern,properties:node.properties.map(this._createInternalSyntaxTree,this)};break;case"Program":result={type:WebInspector.ScriptSyntaxTree.NodeType.Program,sourceType:node.sourceType,body:node.body.map(this._createInternalSyntaxTree,this)};break;case"Property":result={type:WebInspector.ScriptSyntaxTree.NodeType.Property,key:this._createInternalSyntaxTree(node.key),value:this._createInternalSyntaxTree(node.value),kind:node.kind,method:node.method,computed:node.computed};if(result.kind==="get"||result.kind==="set"||result.method)
result.value.typeProfilingReturnDivot=node.range[0];break;case"RestElement":result={type:WebInspector.ScriptSyntaxTree.NodeType.RestElement,argument:this._createInternalSyntaxTree(node.argument)};break;case"RestProperty":result={type:WebInspector.ScriptSyntaxTree.NodeType.RestProperty,argument:this._createInternalSyntaxTree(node.argument),};break;case"ReturnStatement":result={type:WebInspector.ScriptSyntaxTree.NodeType.ReturnStatement,argument:this._createInternalSyntaxTree(node.argument)};break;case"SequenceExpression":result={type:WebInspector.ScriptSyntaxTree.NodeType.SequenceExpression,expressions:node.expressions.map(this._createInternalSyntaxTree,this)};break;case"SpreadElement":result={type:WebInspector.ScriptSyntaxTree.NodeType.SpreadElement,argument:this._createInternalSyntaxTree(node.argument),};break;case"SpreadProperty":result={type:WebInspector.ScriptSyntaxTree.NodeType.SpreadProperty,argument:this._createInternalSyntaxTree(node.argument),};break;case"Super":result={type:WebInspector.ScriptSyntaxTree.NodeType.Super};break;case"SwitchStatement":result={type:WebInspector.ScriptSyntaxTree.NodeType.SwitchStatement,discriminant:this._createInternalSyntaxTree(node.discriminant),cases:node.cases.map(this._createInternalSyntaxTree,this)};break;case"SwitchCase":result={type:WebInspector.ScriptSyntaxTree.NodeType.SwitchCase,test:this._createInternalSyntaxTree(node.test),consequent:node.consequent.map(this._createInternalSyntaxTree,this)};break;case"TaggedTemplateExpression":result={type:WebInspector.ScriptSyntaxTree.NodeType.TaggedTemplateExpression,tag:this._createInternalSyntaxTree(node.tag),quasi:this._createInternalSyntaxTree(node.quasi)};break;case"TemplateElement":result={type:WebInspector.ScriptSyntaxTree.NodeType.TemplateElement,value:node.value,tail:node.tail};break;case"TemplateLiteral":result={type:WebInspector.ScriptSyntaxTree.NodeType.TemplateLiteral,quasis:node.quasis.map(this._createInternalSyntaxTree,this),expressions:node.expressions.map(this._createInternalSyntaxTree,this)};break;case"ThisExpression":result={type:WebInspector.ScriptSyntaxTree.NodeType.ThisExpression};break;case"ThrowStatement":result={type:WebInspector.ScriptSyntaxTree.NodeType.ThrowStatement,argument:this._createInternalSyntaxTree(node.argument)};break;case"TryStatement":result={type:WebInspector.ScriptSyntaxTree.NodeType.TryStatement,block:this._createInternalSyntaxTree(node.block),handler:this._createInternalSyntaxTree(node.handler),finalizer:this._createInternalSyntaxTree(node.finalizer)};break;case"UnaryExpression":result={type:WebInspector.ScriptSyntaxTree.NodeType.UnaryExpression,operator:node.operator,argument:this._createInternalSyntaxTree(node.argument)};break;case"UpdateExpression":result={type:WebInspector.ScriptSyntaxTree.NodeType.UpdateExpression,operator:node.operator,prefix:node.prefix,argument:this._createInternalSyntaxTree(node.argument)};break;case"VariableDeclaration":result={type:WebInspector.ScriptSyntaxTree.NodeType.VariableDeclaration,declarations:node.declarations.map(this._createInternalSyntaxTree,this),kind:node.kind};break;case"VariableDeclarator":result={type:WebInspector.ScriptSyntaxTree.NodeType.VariableDeclarator,id:this._createInternalSyntaxTree(node.id),init:this._createInternalSyntaxTree(node.init)};break;case"WhileStatement":result={type:WebInspector.ScriptSyntaxTree.NodeType.WhileStatement,test:this._createInternalSyntaxTree(node.test),body:this._createInternalSyntaxTree(node.body)};break;case"WithStatement":result={type:WebInspector.ScriptSyntaxTree.NodeType.WithStatement,object:this._createInternalSyntaxTree(node.object),body:this._createInternalSyntaxTree(node.body)};break;case"YieldExpression":result={type:WebInspector.ScriptSyntaxTree.NodeType.YieldExpression,argument:this._createInternalSyntaxTree(node.argument),delegate:node.delegate};break;case"ExportAllDeclaration":result={type:WebInspector.ScriptSyntaxTree.NodeType.ExportAllDeclaration,source:this._createInternalSyntaxTree(node.source),};break;case"ExportNamedDeclaration":result={type:WebInspector.ScriptSyntaxTree.NodeType.ExportNamedDeclaration,declaration:this._createInternalSyntaxTree(node.declaration),specifiers:node.specifiers.map(this._createInternalSyntaxTree,this),source:this._createInternalSyntaxTree(node.source),};break;case"ExportDefaultDeclaration":result={type:WebInspector.ScriptSyntaxTree.NodeType.ExportDefaultDeclaration,declaration:this._createInternalSyntaxTree(node.declaration),};break;case"ExportSpecifier":result={type:WebInspector.ScriptSyntaxTree.NodeType.ExportSpecifier,local:this._createInternalSyntaxTree(node.local),exported:this._createInternalSyntaxTree(node.exported),};break;case"Import":result={type:WebInspector.ScriptSyntaxTree.NodeType.Import,};break;case"ImportDeclaration":result={type:WebInspector.ScriptSyntaxTree.NodeType.ImportDeclaration,specifiers:node.specifiers.map(this._createInternalSyntaxTree,this),source:this._createInternalSyntaxTree(node.source),};break;case"ImportDefaultSpecifier":result={type:WebInspector.ScriptSyntaxTree.NodeType.ImportDefaultSpecifier,local:this._createInternalSyntaxTree(node.local),};break;case"ImportNamespaceSpecifier":result={type:WebInspector.ScriptSyntaxTree.NodeType.ImportNamespaceSpecifier,local:this._createInternalSyntaxTree(node.local),};break;case"ImportSpecifier":result={type:WebInspector.ScriptSyntaxTree.NodeType.ImportSpecifier,imported:this._createInternalSyntaxTree(node.imported),local:this._createInternalSyntaxTree(node.local),};break;default:console.error("Unsupported Syntax Tree Node: "+node.type,node);return null;}
result.range=node.range;result.attachments={};return result;}};WebInspector.ScriptSyntaxTree.TypeProfilerSearchDescriptor={NormalExpression:1,FunctionReturn:2};WebInspector.ScriptSyntaxTree.NodeType={ArrayExpression:Symbol("array-expression"),ArrayPattern:Symbol("array-pattern"),ArrowFunctionExpression:Symbol("arrow-function-expression"),AssignmentExpression:Symbol("assignment-expression"),AssignmentPattern:Symbol("assignment-pattern"),AwaitExpression:Symbol("await-expression"),BinaryExpression:Symbol("binary-expression"),BlockStatement:Symbol("block-statement"),BreakStatement:Symbol("break-statement"),CallExpression:Symbol("call-expression"),CatchClause:Symbol("catch-clause"),ClassBody:Symbol("class-body"),ClassDeclaration:Symbol("class-declaration"),ClassExpression:Symbol("class-expression"),ConditionalExpression:Symbol("conditional-expression"),ContinueStatement:Symbol("continue-statement"),DebuggerStatement:Symbol("debugger-statement"),DoWhileStatement:Symbol("do-while-statement"),EmptyStatement:Symbol("empty-statement"),ExportAllDeclaration:Symbol("export-all-declaration"),ExportDefaultDeclaration:Symbol("export-default-declaration"),ExportNamedDeclaration:Symbol("export-named-declaration"),ExportSpecifier:Symbol("export-specifier"),ExpressionStatement:Symbol("expression-statement"),ForInStatement:Symbol("for-in-statement"),ForOfStatement:Symbol("for-of-statement"),ForStatement:Symbol("for-statement"),FunctionDeclaration:Symbol("function-declaration"),FunctionExpression:Symbol("function-expression"),Identifier:Symbol("identifier"),IfStatement:Symbol("if-statement"),Import:Symbol("import"),ImportDeclaration:Symbol("import-declaration"),ImportDefaultSpecifier:Symbol("import-default-specifier"),ImportNamespaceSpecifier:Symbol("import-namespace-specifier"),ImportSpecifier:Symbol("import-specifier"),LabeledStatement:Symbol("labeled-statement"),Literal:Symbol("literal"),LogicalExpression:Symbol("logical-expression"),MemberExpression:Symbol("member-expression"),MetaProperty:Symbol("meta-property"),MethodDefinition:Symbol("method-definition"),NewExpression:Symbol("new-expression"),ObjectExpression:Symbol("object-expression"),ObjectPattern:Symbol("object-pattern"),Program:Symbol("program"),Property:Symbol("property"),RestElement:Symbol("rest-element"),RestProperty:Symbol("rest-property"),ReturnStatement:Symbol("return-statement"),SequenceExpression:Symbol("sequence-expression"),SpreadElement:Symbol("spread-element"),SpreadProperty:Symbol("spread-property"),Super:Symbol("super"),SwitchCase:Symbol("switch-case"),SwitchStatement:Symbol("switch-statement"),TaggedTemplateExpression:Symbol("tagged-template-expression"),TemplateElement:Symbol("template-element"),TemplateLiteral:Symbol("template-literal"),ThisExpression:Symbol("this-expression"),ThrowStatement:Symbol("throw-statement"),TryStatement:Symbol("try-statement"),UnaryExpression:Symbol("unary-expression"),UpdateExpression:Symbol("update-expression"),VariableDeclaration:Symbol("variable-declaration"),VariableDeclarator:Symbol("variable-declarator"),WhileStatement:Symbol("while-statement"),WithStatement:Symbol("with-statement"),YieldExpression:Symbol("yield-expression"),};WebInspector.ScriptTimelineRecord=class ScriptTimelineRecord extends WebInspector.TimelineRecord
{constructor(eventType,startTime,endTime,callFrames,sourceCodeLocation,details,profilePayload)
{super(WebInspector.TimelineRecord.Type.Script,startTime,endTime,callFrames,sourceCodeLocation);if(eventType in WebInspector.ScriptTimelineRecord.EventType)
eventType=WebInspector.ScriptTimelineRecord.EventType[eventType];this._eventType=eventType;this._details=details||"";this._profilePayload=profilePayload||null;this._profile=null;if(!window.ScriptProfilerAgent)
this._callCountOrSamples=NaN;else{this._callCountOrSamples=0;}}
get eventType()
{return this._eventType;}
get details()
{return this._details;}
get profile()
{this._initializeProfileFromPayload();return this._profile;}
get callCountOrSamples()
{return this._callCountOrSamples;}
isGarbageCollection()
{return this._eventType===WebInspector.ScriptTimelineRecord.EventType.GarbageCollected;}
saveIdentityToCookie(cookie)
{super.saveIdentityToCookie(cookie);cookie[WebInspector.ScriptTimelineRecord.EventTypeCookieKey]=this._eventType;cookie[WebInspector.ScriptTimelineRecord.DetailsCookieKey]=this._details;}
get profilePayload()
{return this._profilePayload;}
set profilePayload(payload)
{this._profilePayload=payload;}
_initializeProfileFromPayload(payload)
{if(this._profile||!this._profilePayload)
return;var payload=this._profilePayload;this._profilePayload=undefined;function profileNodeFromPayload(nodePayload)
{if(nodePayload.url){var sourceCode=WebInspector.frameResourceManager.resourceForURL(nodePayload.url);if(!sourceCode)
sourceCode=WebInspector.debuggerManager.scriptsForURL(nodePayload.url,WebInspector.assumingMainTarget())[0];var lineNumber=nodePayload.lineNumber-1;var sourceCodeLocation=sourceCode?sourceCode.createLazySourceCodeLocation(lineNumber,nodePayload.columnNumber):null;}
var isProgramCode=nodePayload.functionName==="(program)";var isAnonymousFunction=nodePayload.functionName==="(anonymous function)";var type=isProgramCode?WebInspector.ProfileNode.Type.Program:WebInspector.ProfileNode.Type.Function;var functionName=!isProgramCode&&!isAnonymousFunction&&nodePayload.functionName!=="(unknown)"?nodePayload.functionName:null;
var calls=null;if("calls"in nodePayload){calls=nodePayload.calls.map(profileNodeCallFromPayload);}
return new WebInspector.ProfileNode(nodePayload.id,type,functionName,sourceCodeLocation,nodePayload.callInfo,calls,nodePayload.children);}
function profileNodeCallFromPayload(nodeCallPayload)
{var startTime=WebInspector.timelineManager.computeElapsedTime(nodeCallPayload.startTime);return new WebInspector.ProfileNodeCall(startTime,nodeCallPayload.totalTime);}
var rootNodes=payload.rootNodes;var stack=[{parent:{children:rootNodes},index:0,root:true}];while(stack.length){var entry=stack.lastValue;if(entry.index<entry.parent.children.length){var childNodePayload=entry.parent.children[entry.index];if(childNodePayload.children&&childNodePayload.children.length)
stack.push({parent:childNodePayload,index:0});++entry.index;}else{if(!entry.root)
entry.parent.children=entry.parent.children.map(profileNodeFromPayload);else
rootNodes=rootNodes.map(profileNodeFromPayload);stack.pop();}}
if(window.ScriptProfilerAgent){for(let i=0;i<rootNodes.length;i++)
this._callCountOrSamples+=rootNodes[i].callInfo.callCount;}
this._profile=new WebInspector.Profile(rootNodes);}};WebInspector.ScriptTimelineRecord.EventType={ScriptEvaluated:"script-timeline-record-script-evaluated",APIScriptEvaluated:"script-timeline-record-api-script-evaluated",MicrotaskDispatched:"script-timeline-record-microtask-dispatched",EventDispatched:"script-timeline-record-event-dispatched",ProbeSampleRecorded:"script-timeline-record-probe-sample-recorded",TimerFired:"script-timeline-record-timer-fired",TimerInstalled:"script-timeline-record-timer-installed",TimerRemoved:"script-timeline-record-timer-removed",AnimationFrameFired:"script-timeline-record-animation-frame-fired",AnimationFrameRequested:"script-timeline-record-animation-frame-requested",AnimationFrameCanceled:"script-timeline-record-animation-frame-canceled",ConsoleProfileRecorded:"script-timeline-record-console-profile-recorded",GarbageCollected:"script-timeline-record-garbage-collected",};WebInspector.ScriptTimelineRecord.EventType.displayName=function(eventType,details,includeDetailsInMainTitle)
{if(details&&!WebInspector.ScriptTimelineRecord._eventDisplayNames){
var nameMap=new Map;nameMap.set("DOMActivate","DOM Activate");nameMap.set("DOMCharacterDataModified","DOM Character Data Modified");nameMap.set("DOMContentLoaded","DOM Content Loaded");nameMap.set("DOMFocusIn","DOM Focus In");nameMap.set("DOMFocusOut","DOM Focus Out");nameMap.set("DOMNodeInserted","DOM Node Inserted");nameMap.set("DOMNodeInsertedIntoDocument","DOM Node Inserted Into Document");nameMap.set("DOMNodeRemoved","DOM Node Removed");nameMap.set("DOMNodeRemovedFromDocument","DOM Node Removed From Document");nameMap.set("DOMSubtreeModified","DOM Sub-Tree Modified");nameMap.set("addsourcebuffer","Add Source Buffer");nameMap.set("addstream","Add Stream");nameMap.set("addtrack","Add Track");nameMap.set("animationend","Animation End");nameMap.set("animationiteration","Animation Iteration");nameMap.set("animationstart","Animation Start");nameMap.set("audioend","Audio End");nameMap.set("audioprocess","Audio Process");nameMap.set("audiostart","Audio Start");nameMap.set("beforecopy","Before Copy");nameMap.set("beforecut","Before Cut");nameMap.set("beforeload","Before Load");nameMap.set("beforepaste","Before Paste");nameMap.set("beforeunload","Before Unload");nameMap.set("canplay","Can Play");nameMap.set("canplaythrough","Can Play Through");nameMap.set("chargingchange","Charging Change");nameMap.set("chargingtimechange","Charging Time Change");nameMap.set("compositionend","Composition End");nameMap.set("compositionstart","Composition Start");nameMap.set("compositionupdate","Composition Update");nameMap.set("contextmenu","Context Menu");nameMap.set("cuechange","Cue Change");nameMap.set("datachannel","Data Channel");nameMap.set("dblclick","Double Click");nameMap.set("devicemotion","Device Motion");nameMap.set("deviceorientation","Device Orientation");nameMap.set("dischargingtimechange","Discharging Time Change");nameMap.set("dragend","Drag End");nameMap.set("dragenter","Drag Enter");nameMap.set("dragleave","Drag Leave");nameMap.set("dragover","Drag Over");nameMap.set("dragstart","Drag Start");nameMap.set("durationchange","Duration Change");nameMap.set("focusin","Focus In");nameMap.set("focusout","Focus Out");nameMap.set("gesturechange","Gesture Change");nameMap.set("gestureend","Gesture End");nameMap.set("gesturescrollend","Gesture Scroll End");nameMap.set("gesturescrollstart","Gesture Scroll Start");nameMap.set("gesturescrollupdate","Gesture Scroll Update");nameMap.set("gesturestart","Gesture Start");nameMap.set("gesturetap","Gesture Tap");nameMap.set("gesturetapdown","Gesture Tap Down");nameMap.set("hashchange","Hash Change");nameMap.set("icecandidate","ICE Candidate");nameMap.set("iceconnectionstatechange","ICE Connection State Change");nameMap.set("keydown","Key Down");nameMap.set("keypress","Key Press");nameMap.set("keyup","Key Up");nameMap.set("levelchange","Level Change");nameMap.set("loadeddata","Loaded Data");nameMap.set("loadedmetadata","Loaded Metadata");nameMap.set("loadend","Load End");nameMap.set("loadingdone","Loading Done");nameMap.set("loadstart","Load Start");nameMap.set("mousedown","Mouse Down");nameMap.set("mouseenter","Mouse Enter");nameMap.set("mouseleave","Mouse Leave");nameMap.set("mousemove","Mouse Move");nameMap.set("mouseout","Mouse Out");nameMap.set("mouseover","Mouse Over");nameMap.set("mouseup","Mouse Up");nameMap.set("mousewheel","Mouse Wheel");nameMap.set("negotiationneeded","Negotiation Needed");nameMap.set("nomatch","No Match");nameMap.set("noupdate","No Update");nameMap.set("orientationchange","Orientation Change");nameMap.set("overflowchanged","Overflow Changed");nameMap.set("pagehide","Page Hide");nameMap.set("pageshow","Page Show");nameMap.set("popstate","Pop State");nameMap.set("ratechange","Rate Change");nameMap.set("readystatechange","Ready State Change");nameMap.set("removesourcebuffer","Remove Source Buffer");nameMap.set("removestream","Remove Stream");nameMap.set("removetrack","Remove Track");nameMap.set("resize","Resize");nameMap.set("securitypolicyviolation","Security Policy Violation");nameMap.set("selectionchange","Selection Change");nameMap.set("selectstart","Select Start");nameMap.set("signalingstatechange","Signaling State Change");nameMap.set("soundend","Sound End");nameMap.set("soundstart","Sound Start");nameMap.set("sourceclose","Source Close");nameMap.set("sourceended","Source Ended");nameMap.set("sourceopen","Source Open");nameMap.set("speechend","Speech End");nameMap.set("speechstart","Speech Start");nameMap.set("textInput","Text Input");nameMap.set("timeupdate","Time Update");nameMap.set("tonechange","Tone Change");nameMap.set("touchcancel","Touch Cancel");nameMap.set("touchend","Touch End");nameMap.set("touchmove","Touch Move");nameMap.set("touchstart","Touch Start");nameMap.set("transitionend","Transition End");nameMap.set("updateend","Update End");nameMap.set("updateready","Update Ready");nameMap.set("updatestart","Update Start");nameMap.set("upgradeneeded","Upgrade Needed");nameMap.set("versionchange","Version Change");nameMap.set("visibilitychange","Visibility Change");nameMap.set("volumechange","Volume Change");nameMap.set("webglcontextcreationerror","WebGL Context Creation Error");nameMap.set("webglcontextlost","WebGL Context Lost");nameMap.set("webglcontextrestored","WebGL Context Restored");nameMap.set("webkitAnimationEnd","Animation End");nameMap.set("webkitAnimationIteration","Animation Iteration");nameMap.set("webkitAnimationStart","Animation Start");nameMap.set("webkitBeforeTextInserted","Before Text Inserted");nameMap.set("webkitEditableContentChanged","Editable Content Changed");nameMap.set("webkitTransitionEnd","Transition End");nameMap.set("webkitaddsourcebuffer","Add Source Buffer");nameMap.set("webkitbeginfullscreen","Begin Full Screen");nameMap.set("webkitcurrentplaybacktargetiswirelesschanged","Current Playback Target Is Wireless Changed");nameMap.set("webkitdeviceproximity","Device Proximity");nameMap.set("webkitendfullscreen","End Full Screen");nameMap.set("webkitfullscreenchange","Full Screen Change");nameMap.set("webkitfullscreenerror","Full Screen Error");nameMap.set("webkitkeyadded","Key Added");nameMap.set("webkitkeyerror","Key Error");nameMap.set("webkitkeymessage","Key Message");nameMap.set("webkitneedkey","Need Key");nameMap.set("webkitnetworkinfochange","Network Info Change");nameMap.set("webkitplaybacktargetavailabilitychanged","Playback Target Availability Changed");nameMap.set("webkitpointerlockchange","Pointer Lock Change");nameMap.set("webkitpointerlockerror","Pointer Lock Error");nameMap.set("webkitregionlayoutupdate","Region Layout Update");nameMap.set("webkitregionoversetchange","Region Overset Change");nameMap.set("webkitremovesourcebuffer","Remove Source Buffer");nameMap.set("webkitresourcetimingbufferfull","Resource Timing Buffer Full");nameMap.set("webkitsourceclose","Source Close");nameMap.set("webkitsourceended","Source Ended");nameMap.set("webkitsourceopen","Source Open");nameMap.set("webkitspeechchange","Speech Change");nameMap.set("writeend","Write End");nameMap.set("writestart","Write Start");WebInspector.ScriptTimelineRecord._eventDisplayNames=nameMap;}
switch(eventType){case WebInspector.ScriptTimelineRecord.EventType.ScriptEvaluated:case WebInspector.ScriptTimelineRecord.EventType.APIScriptEvaluated:return WebInspector.UIString("Script Evaluated");case WebInspector.ScriptTimelineRecord.EventType.MicrotaskDispatched:return WebInspector.UIString("Microtask Dispatched");case WebInspector.ScriptTimelineRecord.EventType.EventDispatched:if(details&&(details instanceof String||typeof details==="string")){var eventDisplayName=WebInspector.ScriptTimelineRecord._eventDisplayNames.get(details)||details.capitalize();return WebInspector.UIString("%s Event Dispatched").format(eventDisplayName);}
return WebInspector.UIString("Event Dispatched");case WebInspector.ScriptTimelineRecord.EventType.ProbeSampleRecorded:return WebInspector.UIString("Probe Sample Recorded");case WebInspector.ScriptTimelineRecord.EventType.ConsoleProfileRecorded:if(details&&(details instanceof String||typeof details==="string"))
return WebInspector.UIString("“%s” Profile Recorded").format(details);return WebInspector.UIString("Console Profile Recorded");case WebInspector.ScriptTimelineRecord.EventType.GarbageCollected:if(details&&(details instanceof WebInspector.GarbageCollection)&&includeDetailsInMainTitle){switch(details.type){case WebInspector.GarbageCollection.Type.Partial:return WebInspector.UIString("Partial Garbage Collection");case WebInspector.GarbageCollection.Type.Full:return WebInspector.UIString("Full Garbage Collection");}}
return WebInspector.UIString("Garbage Collection");case WebInspector.ScriptTimelineRecord.EventType.TimerFired:if(details&&includeDetailsInMainTitle)
return WebInspector.UIString("Timer %d Fired").format(details);return WebInspector.UIString("Timer Fired");case WebInspector.ScriptTimelineRecord.EventType.TimerInstalled:if(details&&includeDetailsInMainTitle)
return WebInspector.UIString("Timer %d Installed").format(details.timerId);return WebInspector.UIString("Timer Installed");case WebInspector.ScriptTimelineRecord.EventType.TimerRemoved:if(details&&includeDetailsInMainTitle)
return WebInspector.UIString("Timer %d Removed").format(details);return WebInspector.UIString("Timer Removed");case WebInspector.ScriptTimelineRecord.EventType.AnimationFrameFired:if(details&&includeDetailsInMainTitle)
return WebInspector.UIString("Animation Frame %d Fired").format(details);return WebInspector.UIString("Animation Frame Fired");case WebInspector.ScriptTimelineRecord.EventType.AnimationFrameRequested:if(details&&includeDetailsInMainTitle)
return WebInspector.UIString("Animation Frame %d Requested").format(details);return WebInspector.UIString("Animation Frame Requested");case WebInspector.ScriptTimelineRecord.EventType.AnimationFrameCanceled:if(details&&includeDetailsInMainTitle)
return WebInspector.UIString("Animation Frame %d Canceled").format(details);return WebInspector.UIString("Animation Frame Canceled");}};WebInspector.ScriptTimelineRecord.TypeIdentifier="script-timeline-record";WebInspector.ScriptTimelineRecord.EventTypeCookieKey="script-timeline-record-event-type";WebInspector.ScriptTimelineRecord.DetailsCookieKey="script-timeline-record-details";WebInspector.SourceCodePosition=class SourceCodePosition extends WebInspector.Object
{constructor(lineNumber,columNumber)
{super();this._lineNumber=lineNumber||0;this._columnNumber=columNumber||0;}
get lineNumber(){return this._lineNumber;}
get columnNumber(){return this._columnNumber;}};WebInspector.SourceCodeRevision=class SourceCodeRevision extends WebInspector.Revision
{constructor(sourceCode,content)
{super();this._sourceCode=sourceCode;this._content=content||"";}
get sourceCode()
{return this._sourceCode;}
get content()
{return this._content;}
set content(content)
{content=content||"";if(this._content===content)
return;this._content=content;this._sourceCode.revisionContentDidChange(this);}
apply()
{this._sourceCode.currentRevision=this;}
revert()
{this._sourceCode.currentRevision=this._sourceCode.originalRevision;}
copy()
{return new WebInspector.SourceCodeRevision(this._sourceCode,this._content);}};WebInspector.SourceCodeSearchMatchObject=class SourceCodeSearchMatchObject extends WebInspector.Object
{constructor(sourceCode,lineText,searchTerm,textRange)
{super();this._sourceCode=sourceCode;this._lineText=lineText;this._searchTerm=searchTerm;this._sourceCodeTextRange=sourceCode.createSourceCodeTextRange(textRange);}
get sourceCode(){return this._sourceCode;}
get title(){return this._lineText;}
get searchTerm(){return this._searchTerm;}
get sourceCodeTextRange(){return this._sourceCodeTextRange;}
get className()
{return"source-code-match";}
saveIdentityToCookie(cookie)
{if(this._sourceCode.url)
cookie[WebInspector.SourceCodeSearchMatchObject.URLCookieKey]=this._sourceCode.url.hash;var textRange=this._sourceCodeTextRange.textRange;cookie[WebInspector.SourceCodeSearchMatchObject.TextRangeKey]=[textRange.startLine,textRange.startColumn,textRange.endLine,textRange.endColumn].join();}};WebInspector.SourceCodeSearchMatchObject.TypeIdentifier="source-code-search-match-object";WebInspector.SourceCodeSearchMatchObject.URLCookieKey="source-code-url";WebInspector.SourceCodeSearchMatchObject.TextRangeKey="text-range";WebInspector.SourceCodeTextRange=class SourceCodeTextRange extends WebInspector.Object
{constructor(sourceCode){super();this._sourceCode=sourceCode;if(arguments.length===2){var textRange=arguments[1];this._startLocation=sourceCode.createSourceCodeLocation(textRange.startLine,textRange.startColumn);this._endLocation=sourceCode.createSourceCodeLocation(textRange.endLine,textRange.endColumn);}else{this._startLocation=arguments[1];this._endLocation=arguments[2];}
this._startLocation.addEventListener(WebInspector.SourceCodeLocation.Event.LocationChanged,this._sourceCodeLocationChanged,this);this._endLocation.addEventListener(WebInspector.SourceCodeLocation.Event.LocationChanged,this._sourceCodeLocationChanged,this);}
get sourceCode()
{return this._sourceCode;}
get textRange()
{var startLine=this._startLocation.lineNumber;var startColumn=this._startLocation.columnNumber;var endLine=this._endLocation.lineNumber;var endColumn=this._endLocation.columnNumber;return new WebInspector.TextRange(startLine,startColumn,endLine,endColumn);}
get formattedTextRange()
{var startLine=this._startLocation.formattedLineNumber;var startColumn=this._startLocation.formattedColumnNumber;var endLine=this._endLocation.formattedLineNumber;var endColumn=this._endLocation.formattedColumnNumber;return new WebInspector.TextRange(startLine,startColumn,endLine,endColumn);}
get displaySourceCode()
{if(!this._startAndEndLocationsInSameMappedResource())
return this._sourceCode;return this._startLocation.displaySourceCode;}
get displayTextRange()
{if(!this._startAndEndLocationsInSameMappedResource())
return this.formattedTextRange;var startLine=this._startLocation.displayLineNumber;var startColumn=this._startLocation.displayColumnNumber;var endLine=this._endLocation.displayLineNumber;var endColumn=this._endLocation.displayColumnNumber;return new WebInspector.TextRange(startLine,startColumn,endLine,endColumn);}
get synthesizedTextValue()
{return this._sourceCode.url+":"+(this._startLocation.lineNumber+1);}
_startAndEndLocationsInSameMappedResource()
{return this._startLocation.hasMappedLocation()&&this._endLocation.hasMappedLocation()&&this._startLocation.displaySourceCode===this._endLocation.displaySourceCode;}
_sourceCodeLocationChanged(event)
{this.dispatchEventToListeners(WebInspector.SourceCodeLocation.Event.RangeChanged);}};WebInspector.SourceCodeTextRange.Event={RangeChanged:"source-code-text-range-range-changed"};WebInspector.SourceCodeTimeline=class SourceCodeTimeline extends WebInspector.Timeline
{constructor(sourceCode,sourceCodeLocation,recordType,recordEventType)
{super();this._sourceCode=sourceCode;this._sourceCodeLocation=sourceCodeLocation||null;this._recordType=recordType;this._recordEventType=recordEventType||null;}
get sourceCode(){return this._sourceCode;}
get sourceCodeLocation(){return this._sourceCodeLocation;}
get recordType(){return this._recordType;}
get recordEventType(){return this._recordEventType;}
saveIdentityToCookie(cookie)
{cookie[WebInspector.SourceCodeTimeline.SourceCodeURLCookieKey]=this._sourceCode.url?this._sourceCode.url.hash:null;cookie[WebInspector.SourceCodeTimeline.SourceCodeLocationLineCookieKey]=this._sourceCodeLocation?this._sourceCodeLocation.lineNumber:null;cookie[WebInspector.SourceCodeTimeline.SourceCodeLocationColumnCookieKey]=this._sourceCodeLocation?this._sourceCodeLocation.columnNumber:null;cookie[WebInspector.SourceCodeTimeline.RecordTypeCookieKey]=this._recordType||null;cookie[WebInspector.SourceCodeTimeline.RecordEventTypeCookieKey]=this._recordEventType||null;}};WebInspector.SourceCodeTimeline.TypeIdentifier="source-code-timeline";WebInspector.SourceCodeTimeline.SourceCodeURLCookieKey="source-code-timeline-source-code-url";WebInspector.SourceCodeTimeline.SourceCodeLocationLineCookieKey="source-code-timeline-source-code-location-line";WebInspector.SourceCodeTimeline.SourceCodeLocationColumnCookieKey="source-code-timeline-source-code-location-column";WebInspector.SourceCodeTimeline.SourceCodeURLCookieKey="source-code-timeline-source-code-url";WebInspector.SourceCodeTimeline.RecordTypeCookieKey="source-code-timeline-record-type";WebInspector.SourceCodeTimeline.RecordEventTypeCookieKey="source-code-timeline-record-event-type";WebInspector.SourceMap=class SourceMap extends WebInspector.Object
{constructor(sourceMappingURL,payload,originalSourceCode)
{super();if(!WebInspector.SourceMap._base64Map){var base64Digits="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";WebInspector.SourceMap._base64Map={};for(var i=0;i<base64Digits.length;++i)
WebInspector.SourceMap._base64Map[base64Digits.charAt(i)]=i;}
this._originalSourceCode=originalSourceCode||null;this._sourceMapResources={};this._sourceMapResourcesList=[];this._sourceMappingURL=sourceMappingURL;this._reverseMappingsBySourceURL={};this._mappings=[];this._sources={};this._sourceRoot=null;this._sourceContentByURL={};this._parseMappingPayload(payload);}
get originalSourceCode()
{return this._originalSourceCode;}
get sourceMappingBasePathURLComponents()
{if(this._sourceMappingURLBasePathComponents)
return this._sourceMappingURLBasePathComponents;if(this._sourceRoot){var baseURLPath=absoluteURL(this._sourceRoot,this._sourceMappingURL);if(baseURLPath){var urlComponents=parseURL(baseURLPath);if(!/\/$/.test(urlComponents.path))
urlComponents.path+="/";this._sourceMappingURLBasePathComponents=urlComponents;return this._sourceMappingURLBasePathComponents;}}
var urlComponents=parseURL(this._sourceMappingURL);if(!urlComponents.path)
urlComponents.path=this._sourceMappingURL||"";urlComponents.path=urlComponents.path.substr(0,urlComponents.path.lastIndexOf(urlComponents.lastPathComponent));urlComponents.lastPathComponent=null;this._sourceMappingURLBasePathComponents=urlComponents;return this._sourceMappingURLBasePathComponents;}
get resources()
{return this._sourceMapResourcesList;}
addResource(resource)
{this._sourceMapResources[resource.url]=resource;this._sourceMapResourcesList.push(resource);}
resourceForURL(url)
{return this._sourceMapResources[url];}
sources()
{return Object.keys(this._sources);}
sourceContent(sourceURL)
{return this._sourceContentByURL[sourceURL];}
_parseMappingPayload(mappingPayload)
{if(mappingPayload.sections)
this._parseSections(mappingPayload.sections);else
this._parseMap(mappingPayload,0,0);}
_parseSections(sections)
{for(var i=0;i<sections.length;++i){var section=sections[i];this._parseMap(section.map,section.offset.line,section.offset.column);}}
findEntry(lineNumber,columnNumber)
{var first=0;var count=this._mappings.length;while(count>1){var step=count>>1;var middle=first+step;var mapping=this._mappings[middle];if(lineNumber<mapping[0]||(lineNumber===mapping[0]&&columnNumber<mapping[1]))
count=step;else{first=middle;count-=step;}}
var entry=this._mappings[first];if(!first&&entry&&(lineNumber<entry[0]||(lineNumber===entry[0]&&columnNumber<entry[1])))
return null;return entry;}
findEntryReversed(sourceURL,lineNumber)
{var mappings=this._reverseMappingsBySourceURL[sourceURL];for(;lineNumber<mappings.length;++lineNumber){var mapping=mappings[lineNumber];if(mapping)
return mapping;}
return this._mappings[0];}
_parseMap(map,lineNumber,columnNumber)
{var sourceIndex=0;var sourceLineNumber=0;var sourceColumnNumber=0;var nameIndex=0;var sources=[];var originalToCanonicalURLMap={};for(var i=0;i<map.sources.length;++i){var originalSourceURL=map.sources[i];var href=originalSourceURL;if(map.sourceRoot&&href.charAt(0)!=="/")
href=map.sourceRoot.replace(/\/+$/,"")+"/"+href;var url=absoluteURL(href,this._sourceMappingURL)||href;originalToCanonicalURLMap[originalSourceURL]=url;sources.push(url);this._sources[url]=true;if(map.sourcesContent&&map.sourcesContent[i])
this._sourceContentByURL[url]=map.sourcesContent[i];}
this._sourceRoot=map.sourceRoot||null;var stringCharIterator=new WebInspector.SourceMap.StringCharIterator(map.mappings);var sourceURL=sources[sourceIndex];while(true){if(stringCharIterator.peek()===",")
stringCharIterator.next();else{while(stringCharIterator.peek()===";"){lineNumber+=1;columnNumber=0;stringCharIterator.next();}
if(!stringCharIterator.hasNext())
break;}
columnNumber+=this._decodeVLQ(stringCharIterator);if(this._isSeparator(stringCharIterator.peek())){this._mappings.push([lineNumber,columnNumber]);continue;}
var sourceIndexDelta=this._decodeVLQ(stringCharIterator);if(sourceIndexDelta){sourceIndex+=sourceIndexDelta;sourceURL=sources[sourceIndex];}
sourceLineNumber+=this._decodeVLQ(stringCharIterator);sourceColumnNumber+=this._decodeVLQ(stringCharIterator);if(!this._isSeparator(stringCharIterator.peek()))
nameIndex+=this._decodeVLQ(stringCharIterator);this._mappings.push([lineNumber,columnNumber,sourceURL,sourceLineNumber,sourceColumnNumber]);}
for(var i=0;i<this._mappings.length;++i){var mapping=this._mappings[i];var url=mapping[2];if(!url)
continue;if(!this._reverseMappingsBySourceURL[url])
this._reverseMappingsBySourceURL[url]=[];var reverseMappings=this._reverseMappingsBySourceURL[url];var sourceLine=mapping[3];if(!reverseMappings[sourceLine])
reverseMappings[sourceLine]=[mapping[0],mapping[1]];}}
_isSeparator(char)
{return char===","||char===";";}
_decodeVLQ(stringCharIterator)
{var result=0;var shift=0;do{var digit=WebInspector.SourceMap._base64Map[stringCharIterator.next()];result+=(digit&WebInspector.SourceMap.VLQ_BASE_MASK)<<shift;shift+=WebInspector.SourceMap.VLQ_BASE_SHIFT;}while(digit&WebInspector.SourceMap.VLQ_CONTINUATION_MASK);var negative=result&1;result>>=1;return negative?-result:result;}};WebInspector.SourceMap.VLQ_BASE_SHIFT=5;WebInspector.SourceMap.VLQ_BASE_MASK=(1<<5)-1;WebInspector.SourceMap.VLQ_CONTINUATION_MASK=1<<5;WebInspector.SourceMap.StringCharIterator=class StringCharIterator
{constructor(string)
{this._string=string;this._position=0;}
next()
{return this._string.charAt(this._position++);}
peek()
{return this._string.charAt(this._position);}
hasNext()
{return this._position<this._string.length;}};WebInspector.SourceMapResource=class SourceMapResource extends WebInspector.Resource
{constructor(url,sourceMap)
{super(url,null);this._sourceMap=sourceMap;var inheritedMIMEType=this._sourceMap.originalSourceCode instanceof WebInspector.Resource?this._sourceMap.originalSourceCode.syntheticMIMEType:null;var fileExtension=WebInspector.fileExtensionForURL(url);var fileExtensionMIMEType=WebInspector.mimeTypeForFileExtension(fileExtension,true);
this._mimeType=fileExtensionMIMEType||inheritedMIMEType||"text/javascript";this._type=WebInspector.Resource.typeFromMIMEType(this._mimeType);this.markAsFinished();}
get sourceMap()
{return this._sourceMap;}
get sourceMapDisplaySubpath()
{var sourceMappingBasePathURLComponents=this._sourceMap.sourceMappingBasePathURLComponents;var resourceURLComponents=this.urlComponents;if(!resourceURLComponents.path)
resourceURLComponents.path=this.url;if(resourceURLComponents.scheme!==sourceMappingBasePathURLComponents.scheme||resourceURLComponents.host!==sourceMappingBasePathURLComponents.host)
return resourceURLComponents.host+(resourceURLComponents.port?(":"+resourceURLComponents.port):"")+resourceURLComponents.path;if(!resourceURLComponents.path.startsWith(sourceMappingBasePathURLComponents.path))
return relativePath(resourceURLComponents.path,sourceMappingBasePathURLComponents.path);return resourceURLComponents.path.substring(sourceMappingBasePathURLComponents.path.length,resourceURLComponents.length);}
requestContentFromBackend(callback)
{this.revertMarkAsFinished();var inlineContent=this._sourceMap.sourceContent(this.url);if(inlineContent){return sourceMapResourceLoaded.call(this,{content:inlineContent,mimeType:this.mimeType,statusCode:200});}
function sourceMapResourceNotAvailable(error,content,mimeType,statusCode)
{this.markAsFailed();return Promise.resolve({error:WebInspector.UIString("An error occurred trying to load the resource."),content,mimeType,statusCode});}
function sourceMapResourceLoadError(error)
{console.error(error||"There was an unknown error calling NetworkAgent.loadResource.");this.markAsFailed();return Promise.resolve({error:WebInspector.UIString("An error occurred trying to load the resource.")});}
function sourceMapResourceLoaded(parameters)
{var{error,content,mimeType,statusCode}=parameters;var base64encoded=false;if(statusCode>=400||error)
return sourceMapResourceNotAvailable(error,content,mimeType,statusCode);this.markAsFinished();return Promise.resolve({content,mimeType,base64encoded,statusCode});}
if(!window.NetworkAgent||!NetworkAgent.loadResource)
return sourceMapResourceLoadError.call(this);var frameIdentifier=null;if(this._sourceMap.originalSourceCode instanceof WebInspector.Resource&&this._sourceMap.originalSourceCode.parentFrame)
frameIdentifier=this._sourceMap.originalSourceCode.parentFrame.id;if(!frameIdentifier)
frameIdentifier=WebInspector.frameResourceManager.mainFrame.id;return NetworkAgent.loadResource(frameIdentifier,this.url).then(sourceMapResourceLoaded.bind(this)).catch(sourceMapResourceLoadError.bind(this));}
createSourceCodeLocation(lineNumber,columnNumber)
{var entry=this._sourceMap.findEntryReversed(this.url,lineNumber);var rawLineNumber=entry[0];var rawColumnNumber=entry[1];var originalSourceCode=this._sourceMap.originalSourceCode;if(originalSourceCode instanceof WebInspector.Script){if(rawLineNumber===0)
rawColumnNumber+=originalSourceCode.range.startColumn;rawLineNumber+=originalSourceCode.range.startLine;}
var location=originalSourceCode.createSourceCodeLocation(rawLineNumber,rawColumnNumber);location._setMappedLocation(this,lineNumber,columnNumber);return location;}
createSourceCodeTextRange(textRange)
{var startSourceCodeLocation=this.createSourceCodeLocation(textRange.startLine,textRange.startColumn);var endSourceCodeLocation=this.createSourceCodeLocation(textRange.endLine,textRange.endColumn);return new WebInspector.SourceCodeTextRange(this._sourceMap.originalSourceCode,startSourceCodeLocation,endSourceCodeLocation);}};WebInspector.StackTrace=class StackTrace extends WebInspector.Object
{constructor(callFrames,topCallFrameIsBoundary,truncated,parentStackTrace)
{super();this._callFrames=callFrames;this._topCallFrameIsBoundary=topCallFrameIsBoundary||false;this._truncated=truncated||false;this._parentStackTrace=parentStackTrace||null;}
static fromPayload(target,payload)
{let result=null;let previousStackTrace=null;while(payload){let callFrames=payload.callFrames.map((x)=>WebInspector.CallFrame.fromPayload(target,x));let stackTrace=new WebInspector.StackTrace(callFrames,payload.topCallFrameIsBoundary,payload.truncated);if(!result)
result=stackTrace;if(previousStackTrace)
previousStackTrace._parentStackTrace=stackTrace;previousStackTrace=stackTrace;payload=payload.parentStackTrace;}
return result;}
static fromString(target,stack)
{let callFrames=WebInspector.StackTrace._parseStackTrace(stack);return WebInspector.StackTrace.fromPayload(target,{callFrames});}
static isLikelyStackTrace(stack)
{const smallestPossibleStackTraceLength="http://a.bc/:9:1".length;if(stack.length<smallestPossibleStackTraceLength.length*2)
return false;const approximateStackLengthOf50Items=5000;if(stack.length>approximateStackLengthOf50Items)
return false;if(/^[^a-z$_]/i.test(stack[0]))
return false;const reasonablyLongLineLength=500;const reasonablyLongNativeMethodLength=120;const stackTraceLine=`(.{1,${reasonablyLongLineLength}}:\\d+:\\d+|eval code|.{1,${reasonablyLongNativeMethodLength}}@\\[native code\\])`;const stackTrace=new RegExp(`^${stackTraceLine}(\\n${stackTraceLine})*$`,"g");return stackTrace.test(stack);}
static _parseStackTrace(stack)
{var lines=stack.split(/\n/g);var result=[];for(var line of lines){var functionName="";var url="";var lineNumber=0;var columnNumber=0;var atIndex=line.indexOf("@");if(atIndex!==-1){functionName=line.slice(0,atIndex);({url,lineNumber,columnNumber}=WebInspector.StackTrace._parseLocation(line.slice(atIndex+1)));}else if(line.includes("/"))
({url,lineNumber,columnNumber}=WebInspector.StackTrace._parseLocation(line));else
functionName=line;result.push({functionName,url,lineNumber,columnNumber});}
return result;}
static _parseLocation(locationString)
{var result={url:"",lineNumber:0,columnNumber:0};var locationRegEx=/(.+?)(?::(\d+)(?::(\d+))?)?$/;var matched=locationString.match(locationRegEx);if(!matched)
return result;result.url=matched[1];if(matched[2])
result.lineNumber=parseInt(matched[2]);if(matched[3])
result.columnNumber=parseInt(matched[3]);return result;}
get callFrames()
{return this._callFrames;}
get firstNonNativeCallFrame()
{for(let frame of this._callFrames){if(!frame.nativeCode)
return frame;}
return null;}
get firstNonNativeNonAnonymousCallFrame()
{for(let frame of this._callFrames){if(frame.nativeCode)
continue;if(frame.sourceCodeLocation){let sourceCode=frame.sourceCodeLocation.sourceCode;if(sourceCode instanceof WebInspector.Script&&sourceCode.anonymous)
continue;}
return frame;}
return null;}
get topCallFrameIsBoundary(){return this._topCallFrameIsBoundary;}
get truncated(){return this._truncated;}
get parentStackTrace(){return this._parentStackTrace;}};WebInspector.StructureDescription=class StructureDescription extends WebInspector.Object
{constructor(fields,optionalFields,constructorName,prototypeStructure,imprecise)
{super();this._fields=fields||null;this._optionalFields=optionalFields||null;this._constructorName=constructorName||"";this._prototypeStructure=prototypeStructure||null;this._imprecise=imprecise||false;}
static fromPayload(payload)
{if(payload.prototypeStructure)
payload.prototypeStructure=WebInspector.StructureDescription.fromPayload(payload.prototypeStructure);return new WebInspector.StructureDescription(payload.fields,payload.optionalFields,payload.constructorName,payload.prototypeStructure,payload.imprecise);}
get fields(){return this._fields;}
get optionalFields(){return this._optionalFields;}
get constructorName(){return this._constructorName;}
get prototypeStructure(){return this._prototypeStructure;}
get imprecise(){return this._imprecise;}};WebInspector.TextMarker=class TextMarker extends WebInspector.Object
{constructor(codeMirrorTextMarker,type)
{super();this._codeMirrorTextMarker=codeMirrorTextMarker;codeMirrorTextMarker.__webInspectorTextMarker=this;this._type=type||WebInspector.TextMarker.Type.Plain;}
static textMarkerForCodeMirrorTextMarker(codeMirrorTextMarker)
{return codeMirrorTextMarker.__webInspectorTextMarker||new WebInspector.TextMarker(codeMirrorTextMarker);}
get codeMirrorTextMarker()
{return this._codeMirrorTextMarker;}
get type()
{return this._type;}
get range()
{var range=this._codeMirrorTextMarker.find();if(!range)
return null;return new WebInspector.TextRange(range.from.line,range.from.ch,range.to.line,range.to.ch);}
get rects()
{var range=this._codeMirrorTextMarker.find();if(!range)
return WebInspector.Rect.ZERO_RECT;return this._codeMirrorTextMarker.doc.cm.rectsForRange({start:range.from,end:range.to});}
clear()
{this._codeMirrorTextMarker.clear();}};WebInspector.TextMarker.Type={Color:"text-marker-type-color",Gradient:"text-marker-type-gradient",Plain:"text-marker-type-plain",CubicBezier:"text-marker-type-cubic-bezier",Spring:"text-marker-type-spring",Variable:"text-marker-type-variable",};WebInspector.TextRange=class TextRange extends WebInspector.Object
{constructor(startLineOrStartOffset,startColumnOrEndOffset,endLine,endColumn)
{super();if(arguments.length===4){this._startLine=typeof startLineOrStartOffset==="number"?startLineOrStartOffset:NaN;this._startColumn=typeof startColumnOrEndOffset==="number"?startColumnOrEndOffset:NaN;this._endLine=typeof endLine==="number"?endLine:NaN;this._endColumn=typeof endColumn==="number"?endColumn:NaN;this._startOffset=NaN;this._endOffset=NaN;}else if(arguments.length===2){this._startOffset=typeof startLineOrStartOffset==="number"?startLineOrStartOffset:NaN;this._endOffset=typeof startColumnOrEndOffset==="number"?startColumnOrEndOffset:NaN;this._startLine=NaN;this._startColumn=NaN;this._endLine=NaN;this._endColumn=NaN;}}
get startLine(){return this._startLine;}
get startColumn(){return this._startColumn;}
get endLine(){return this._endLine;}
get endColumn(){return this._endColumn;}
get startOffset(){return this._startOffset;}
get endOffset(){return this._endOffset;}
startPosition()
{return new WebInspector.SourceCodePosition(this._startLine,this._startColumn);}
endPosition()
{return new WebInspector.SourceCodePosition(this._endLine,this._endColumn);}
resolveOffsets(text)
{if(typeof text!=="string")
return;if(isNaN(this._startLine)||isNaN(this._startColumn)||isNaN(this._endLine)||isNaN(this._endColumn))
return;var lastNewLineOffset=0;for(var i=0;i<this._startLine;++i)
lastNewLineOffset=text.indexOf("\n",lastNewLineOffset)+1;this._startOffset=lastNewLineOffset+this._startColumn;for(var i=this._startLine;i<this._endLine;++i)
lastNewLineOffset=text.indexOf("\n",lastNewLineOffset)+1;this._endOffset=lastNewLineOffset+this._endColumn;}
contains(line,column)
{if(line<this._startLine||line>this._endLine)
return false;if(line===this._startLine&&column<this._startColumn)
return false;if(line===this._endLine&&column>this._endColumn)
return false;return true;}};WebInspector.TimelineMarker=class TimelineMarker extends WebInspector.Object
{constructor(time,type,details)
{super();this._time=time||0;this._type=type;this._details=details||null;}
get time()
{return this._time;}
set time(x)
{x=x||0;if(this._time===x)
return;this._time=x;this.dispatchEventToListeners(WebInspector.TimelineMarker.Event.TimeChanged);}
get type()
{return this._type;}
get details()
{return this._details;}};WebInspector.TimelineMarker.Event={TimeChanged:"timeline-marker-time-changed"};WebInspector.TimelineMarker.Type={CurrentTime:"current-time",LoadEvent:"load-event",DOMContentEvent:"dom-content-event",TimeStamp:"timestamp"};WebInspector.TimelineRecording=class TimelineRecording extends WebInspector.Object
{constructor(identifier,displayName,instruments)
{super();this._identifier=identifier;this._timelines=new Map;this._displayName=displayName;this._capturing=false;this._readonly=false;this._instruments=instruments||[];this._topDownCallingContextTree=new WebInspector.CallingContextTree(WebInspector.CallingContextTree.Type.TopDown);this._bottomUpCallingContextTree=new WebInspector.CallingContextTree(WebInspector.CallingContextTree.Type.BottomUp);this._topFunctionsTopDownCallingContextTree=new WebInspector.CallingContextTree(WebInspector.CallingContextTree.Type.TopFunctionsTopDown);this._topFunctionsBottomUpCallingContextTree=new WebInspector.CallingContextTree(WebInspector.CallingContextTree.Type.TopFunctionsBottomUp);for(let type of WebInspector.TimelineManager.availableTimelineTypes()){let timeline=WebInspector.Timeline.create(type);this._timelines.set(type,timeline);timeline.addEventListener(WebInspector.Timeline.Event.TimesUpdated,this._timelineTimesUpdated,this);}
this._legacyFirstRecordedTimestamp=NaN;this.reset(true);}
static sourceCodeTimelinesSupported()
{return WebInspector.debuggableType===WebInspector.DebuggableType.Web;}
get displayName(){return this._displayName;}
get identifier(){return this._identifier;}
get timelines(){return this._timelines;}
get instruments(){return this._instruments;}
get readonly(){return this._readonly;}
get startTime(){return this._startTime;}
get endTime(){return this._endTime;}
get topDownCallingContextTree(){return this._topDownCallingContextTree;}
get bottomUpCallingContextTree(){return this._bottomUpCallingContextTree;}
get topFunctionsTopDownCallingContextTree(){return this._topFunctionsTopDownCallingContextTree;}
get topFunctionsBottomUpCallingContextTree(){return this._topFunctionsBottomUpCallingContextTree;}
start(initiatedByBackend)
{this._capturing=true;for(let instrument of this._instruments)
instrument.startInstrumentation(initiatedByBackend);}
stop(initiatedByBackend)
{this._capturing=false;for(let instrument of this._instruments)
instrument.stopInstrumentation(initiatedByBackend);}
saveIdentityToCookie()
{
}
isEmpty()
{for(var timeline of this._timelines.values()){if(timeline.records.length)
return false;}
return true;}
unloaded()
{this._readonly=true;this.dispatchEventToListeners(WebInspector.TimelineRecording.Event.Unloaded);}
reset(suppressEvents)
{this._sourceCodeTimelinesMap=new Map;this._eventMarkers=[];this._startTime=NaN;this._endTime=NaN;this._discontinuities=[];this._topDownCallingContextTree.reset();this._bottomUpCallingContextTree.reset();this._topFunctionsTopDownCallingContextTree.reset();this._topFunctionsBottomUpCallingContextTree.reset();for(var timeline of this._timelines.values())
timeline.reset(suppressEvents);WebInspector.RenderingFrameTimelineRecord.resetFrameIndex();if(!suppressEvents){this.dispatchEventToListeners(WebInspector.TimelineRecording.Event.Reset);this.dispatchEventToListeners(WebInspector.TimelineRecording.Event.TimesUpdated);}}
sourceCodeTimelinesForSourceCode(sourceCode)
{var timelines=this._sourceCodeTimelinesMap.get(sourceCode);if(!timelines)
return[];return[...timelines.values()];}
timelineForInstrument(instrument)
{return this._timelines.get(instrument.timelineRecordType);}
instrumentForTimeline(timeline)
{return this._instruments.find((instrument)=>instrument.timelineRecordType===timeline.type);}
timelineForRecordType(recordType)
{return this._timelines.get(recordType);}
addInstrument(instrument)
{this._instruments.push(instrument);this.dispatchEventToListeners(WebInspector.TimelineRecording.Event.InstrumentAdded,{instrument});}
removeInstrument(instrument)
{this._instruments.remove(instrument);this.dispatchEventToListeners(WebInspector.TimelineRecording.Event.InstrumentRemoved,{instrument});}
addEventMarker(marker)
{if(!this._capturing)
return;this._eventMarkers.push(marker);this.dispatchEventToListeners(WebInspector.TimelineRecording.Event.MarkerAdded,{marker});}
addRecord(record)
{var timeline=this._timelines.get(record.type);if(!timeline)
return;timeline.addRecord(record);if(record.type===WebInspector.TimelineRecord.Type.Network||record.type===WebInspector.TimelineRecord.Type.RenderingFrame||record.type===WebInspector.TimelineRecord.Type.Memory||record.type===WebInspector.TimelineRecord.Type.HeapAllocations)
return;if(!WebInspector.TimelineRecording.sourceCodeTimelinesSupported())
return;var activeMainResource=WebInspector.frameResourceManager.mainFrame.provisionalMainResource||WebInspector.frameResourceManager.mainFrame.mainResource;var sourceCode=record.sourceCodeLocation?record.sourceCodeLocation.sourceCode:activeMainResource;var sourceCodeTimelines=this._sourceCodeTimelinesMap.get(sourceCode);if(!sourceCodeTimelines){sourceCodeTimelines=new Map;this._sourceCodeTimelinesMap.set(sourceCode,sourceCodeTimelines);}
var newTimeline=false;var key=this._keyForRecord(record);var sourceCodeTimeline=sourceCodeTimelines.get(key);if(!sourceCodeTimeline){sourceCodeTimeline=new WebInspector.SourceCodeTimeline(sourceCode,record.sourceCodeLocation,record.type,record.eventType);sourceCodeTimelines.set(key,sourceCodeTimeline);newTimeline=true;}
sourceCodeTimeline.addRecord(record);if(newTimeline)
this.dispatchEventToListeners(WebInspector.TimelineRecording.Event.SourceCodeTimelineAdded,{sourceCodeTimeline});}
addMemoryPressureEvent(memoryPressureEvent)
{let memoryTimeline=this._timelines.get(WebInspector.TimelineRecord.Type.Memory);if(!memoryTimeline)
return;memoryTimeline.addMemoryPressureEvent(memoryPressureEvent);}
addDiscontinuity(startTime,endTime)
{this._discontinuities.push({startTime,endTime});}
discontinuitiesInTimeRange(startTime,endTime)
{return this._discontinuities.filter((item)=>item.startTime<endTime&&item.endTime>startTime);}
addScriptInstrumentForProgrammaticCapture()
{for(let instrument of this._instruments){if(instrument instanceof WebInspector.ScriptInstrument)
return;}
this.addInstrument(new WebInspector.ScriptInstrument);let instrumentTypes=this._instruments.map((instrument)=>instrument.timelineRecordType);WebInspector.timelineManager.enabledTimelineTypes=instrumentTypes;}
computeElapsedTime(timestamp)
{if(!timestamp||isNaN(timestamp))
return NaN;
if(WebInspector.TimelineRecording.isLegacy===undefined)
WebInspector.TimelineRecording.isLegacy=timestamp>WebInspector.TimelineRecording.TimestampThresholdForLegacyRecordConversion;if(!WebInspector.TimelineRecording.isLegacy)
return timestamp;
if(timestamp<WebInspector.TimelineRecording.TimestampThresholdForLegacyAssumedMilliseconds)
timestamp*=1000;if(isNaN(this._legacyFirstRecordedTimestamp))
this._legacyFirstRecordedTimestamp=timestamp;return(timestamp-this._legacyFirstRecordedTimestamp)/1000.0;}
setLegacyBaseTimestamp(timestamp)
{if(timestamp<WebInspector.TimelineRecording.TimestampThresholdForLegacyAssumedMilliseconds)
timestamp*=1000;this._legacyFirstRecordedTimestamp=timestamp;}
initializeTimeBoundsIfNecessary(timestamp)
{if(isNaN(this._startTime)){this._startTime=timestamp;this._endTime=timestamp;this.dispatchEventToListeners(WebInspector.TimelineRecording.Event.TimesUpdated);}}
_keyForRecord(record)
{var key=record.type;if(record instanceof WebInspector.ScriptTimelineRecord||record instanceof WebInspector.LayoutTimelineRecord)
key+=":"+record.eventType;if(record instanceof WebInspector.ScriptTimelineRecord&&record.eventType===WebInspector.ScriptTimelineRecord.EventType.EventDispatched)
key+=":"+record.details;if(record.sourceCodeLocation)
key+=":"+record.sourceCodeLocation.lineNumber+":"+record.sourceCodeLocation.columnNumber;return key;}
_timelineTimesUpdated(event)
{var timeline=event.target;var changed=false;if(isNaN(this._startTime)||timeline.startTime<this._startTime){this._startTime=timeline.startTime;changed=true;}
if(isNaN(this._endTime)||this._endTime<timeline.endTime){this._endTime=timeline.endTime;changed=true;}
if(changed)
this.dispatchEventToListeners(WebInspector.TimelineRecording.Event.TimesUpdated);}};WebInspector.TimelineRecording.Event={Reset:"timeline-recording-reset",Unloaded:"timeline-recording-unloaded",SourceCodeTimelineAdded:"timeline-recording-source-code-timeline-added",InstrumentAdded:"timeline-recording-instrument-added",InstrumentRemoved:"timeline-recording-instrument-removed",TimesUpdated:"timeline-recording-times-updated",MarkerAdded:"timeline-recording-marker-added",};WebInspector.TimelineRecording.isLegacy=undefined;WebInspector.TimelineRecording.TimestampThresholdForLegacyRecordConversion=10000000;WebInspector.TimelineRecording.TimestampThresholdForLegacyAssumedMilliseconds=1420099200000;WebInspector.TypeDescription=class TypeDescription extends WebInspector.Object
{constructor(leastCommonAncestor,typeSet,structures,valid,truncated)
{super();this._leastCommonAncestor=leastCommonAncestor||null;this._typeSet=typeSet||null;this._structures=structures||null;this._valid=valid||false;this._truncated=truncated||false;}
static fromPayload(payload)
{var typeSet=undefined;if(payload.typeSet)
typeSet=WebInspector.TypeSet.fromPayload(payload.typeSet);var structures=undefined;if(payload.structures)
structures=payload.structures.map(WebInspector.StructureDescription.fromPayload);return new WebInspector.TypeDescription(payload.leastCommonAncestor,typeSet,structures,payload.isValid,payload.isTruncated);}
get leastCommonAncestor(){return this._leastCommonAncestor;}
get typeSet(){return this._typeSet;}
get structures(){return this._structures;}
get valid(){return this._valid;}
get truncated(){return this._truncated;}};WebInspector.TypeSet=class TypeSet extends WebInspector.Object
{constructor(typeSet)
{super();var bitString=0x0;if(typeSet.isFunction)
bitString|=WebInspector.TypeSet.TypeBit.Function;if(typeSet.isUndefined)
bitString|=WebInspector.TypeSet.TypeBit.Undefined;if(typeSet.isNull)
bitString|=WebInspector.TypeSet.TypeBit.Null;if(typeSet.isBoolean)
bitString|=WebInspector.TypeSet.TypeBit.Boolean;if(typeSet.isInteger)
bitString|=WebInspector.TypeSet.TypeBit.Integer;if(typeSet.isNumber)
bitString|=WebInspector.TypeSet.TypeBit.Number;if(typeSet.isString)
bitString|=WebInspector.TypeSet.TypeBit.String;if(typeSet.isObject)
bitString|=WebInspector.TypeSet.TypeBit.Object;if(typeSet.isSymbol)
bitString|=WebInspector.TypeSet.TypeBit.Symbol;this._typeSet=typeSet;this._bitString=bitString;this._primitiveTypeNames=null;}
static fromPayload(payload)
{return new WebInspector.TypeSet(payload);}
isContainedIn(test)
{
return this._bitString&&(this._bitString&test)===this._bitString;}
get primitiveTypeNames()
{if(this._primitiveTypeNames)
return this._primitiveTypeNames;this._primitiveTypeNames=[];var typeSet=this._typeSet;if(typeSet.isUndefined)
this._primitiveTypeNames.push("Undefined");if(typeSet.isNull)
this._primitiveTypeNames.push("Null");if(typeSet.isBoolean)
this._primitiveTypeNames.push("Boolean");if(typeSet.isString)
this._primitiveTypeNames.push("String");if(typeSet.isSymbol)
this._primitiveTypeNames.push("Symbol");
if(typeSet.isNumber)
this._primitiveTypeNames.push("Number");else if(typeSet.isInteger)
this._primitiveTypeNames.push("Integer");return this._primitiveTypeNames;}};WebInspector.TypeSet.TypeBit={"Function":0x1,"Undefined":0x2,"Null":0x4,"Boolean":0x8,"Integer":0x10,"Number":0x20,"String":0x40,"Object":0x80,"Symbol":0x100};WebInspector.TypeSet.NullOrUndefinedTypeBits=WebInspector.TypeSet.TypeBit.Null|WebInspector.TypeSet.TypeBit.Undefined;WebInspector.WebSocketResource=class WebSocketResource extends WebInspector.Resource
{constructor(url,loaderIdentifier,targetId,requestIdentifier,requestHeaders,requestData,timestamp,walltime,requestSentTimestamp,initiatorSourceCodeLocation)
{const type=WebInspector.Resource.Type.WebSocket;const mimeType=null;const requestMethod="GET";super(url,mimeType,type,loaderIdentifier,targetId,requestIdentifier,requestMethod,requestHeaders,requestData,requestSentTimestamp,initiatorSourceCodeLocation);this._timestamp=timestamp;this._walltime=walltime;this._readyState=WebInspector.WebSocketResource.ReadyState.Connecting;this._frames=[];}
get frames(){return this._frames;}
get walltime(){return this._walltime;}
get readyState()
{return this._readyState;}
set readyState(state)
{if(state===this._readyState)
return;let previousState=this._readyState;this._readyState=state;this.dispatchEventToListeners(WebInspector.WebSocketResource.Event.ReadyStateChanged,{previousState,state});}
addFrame(data,payloadLength,isOutgoing,opcode,timestamp,elapsedTime)
{let frameData;if(opcode===WebInspector.WebSocketResource.OpCodes.BinaryFrame)
frameData=null;else
frameData=data;let frame={data:frameData,isOutgoing,opcode,walltime:this._walltimeForWebSocketTimestamp(timestamp)};this._frames.push(frame);if(payloadLength===undefined)
payloadLength=new TextEncoder("utf-8").encode(data).length;this.increaseSize(payloadLength,elapsedTime);this.dispatchEventToListeners(WebInspector.WebSocketResource.Event.FrameAdded,frame);}
_walltimeForWebSocketTimestamp(timestamp)
{return this._walltime+(timestamp-this._timestamp);}};WebInspector.WebSocketResource.Event={FrameAdded:Symbol("web-socket-frame-added"),ReadyStateChanged:Symbol("web-socket-resource-ready-state-changed"),};WebInspector.WebSocketResource.ReadyState={Closed:Symbol("closed"),Connecting:Symbol("connecting"),Open:Symbol("open"),};WebInspector.WebSocketResource.OpCodes={ContinuationFrame:0,TextFrame:1,BinaryFrame:2,ConnectionCloseFrame:8,PingFrame:9,PongFrame:10,};WebInspector.WrappedPromise=class WrappedPromise
{constructor(work)
{this._settled=false;this._promise=new Promise((resolve,reject)=>{this._resolveCallback=resolve;this._rejectCallback=reject;
if(work&&typeof work==="function")
return work(this.resolve.bind(this),this.reject.bind(this));});}
get settled()
{return this._settled;}
get promise()
{return this._promise;}
resolve(value)
{if(this._settled)
throw new Error("Promise is already settled, cannot call resolve().");this._settled=true;this._resolveCallback(value);}
reject(value)
{if(this._settled)
throw new Error("Promise is already settled, cannot call reject().");this._settled=true;this._rejectCallback(value);}};WebInspector.XHRBreakpoint=class XHRBreakpoint extends WebInspector.Object
{constructor(type,url,disabled)
{super();this._type=type||WebInspector.XHRBreakpoint.Type.Text;this._url=url||"";this._disabled=disabled||false;}
get type(){return this._type;}
get url(){return this._url;}
get disabled()
{return this._disabled;}
set disabled(disabled)
{if(this._disabled===disabled)
return;this._disabled=disabled;this.dispatchEventToListeners(WebInspector.XHRBreakpoint.Event.DisabledStateDidChange);}
get serializableInfo()
{let info={type:this._type,url:this._url};if(this._disabled)
info.disabled=true;return info;}
saveIdentityToCookie(cookie)
{cookie[WebInspector.XHRBreakpoint.URLCookieKey]=this._url;}};WebInspector.XHRBreakpoint.URLCookieKey="xhr-breakpoint-url";WebInspector.XHRBreakpoint.Event={DisabledStateDidChange:"xhr-breakpoint-disabled-state-did-change",ResolvedStateDidChange:"xhr-breakpoint-resolved-state-did-change",};WebInspector.XHRBreakpoint.Type={Text:"text",RegularExpression:"regex",};WebInspector.FormatterWorkerProxy=class FormatterWorkerProxy extends WebInspector.Object
{constructor()
{super();this._formatterWorker=new Worker("Workers/Formatter/FormatterWorker.js");this._formatterWorker.addEventListener("message",this._handleMessage.bind(this));this._nextCallId=1;this._callbacks=new Map;}
static singleton()
{if(!FormatterWorkerProxy.instance)
FormatterWorkerProxy.instance=new FormatterWorkerProxy;return FormatterWorkerProxy.instance;}
formatJavaScript(sourceText,isModule,indentString,includeSourceMapData)
{this.performAction("formatJavaScript",...arguments);}
performAction(actionName)
{let callId=this._nextCallId++;let callback=arguments[arguments.length-1];let actionArguments=Array.prototype.slice.call(arguments,1,arguments.length-1);this._callbacks.set(callId,callback);this._postMessage({callId,actionName,actionArguments});}
_postMessage()
{this._formatterWorker.postMessage(...arguments);}
_handleMessage(event)
{let data=event.data;if(data.callId){let callback=this._callbacks.get(data.callId);this._callbacks.delete(data.callId);callback(data.result);return;}
console.error("Unexpected FormatterWorker message",data);}};WebInspector.HeapSnapshotDiffProxy=class HeapSnapshotDiffProxy extends WebInspector.Object
{constructor(snapshotDiffObjectId,snapshot1,snapshot2,totalSize,totalObjectCount,categories)
{super();this._proxyObjectId=snapshotDiffObjectId;this._snapshot1=snapshot1;this._snapshot2=snapshot2;this._totalSize=totalSize;this._totalObjectCount=totalObjectCount;this._categories=Map.fromObject(categories);}
static deserialize(objectId,serializedSnapshotDiff)
{let{snapshot1:serializedSnapshot1,snapshot2:serializedSnapshot2,totalSize,totalObjectCount,categories}=serializedSnapshotDiff;
let snapshot1=WebInspector.HeapSnapshotProxy.deserialize(objectId,serializedSnapshot1);let snapshot2=WebInspector.HeapSnapshotProxy.deserialize(objectId,serializedSnapshot2);return new WebInspector.HeapSnapshotDiffProxy(objectId,snapshot1,snapshot2,totalSize,totalObjectCount,categories);}
get snapshot1(){return this._snapshot1;}
get snapshot2(){return this._snapshot2;}
get totalSize(){return this._totalSize;}
get totalObjectCount(){return this._totalObjectCount;}
get categories(){return this._categories;}
get invalid(){return this._snapshot1.invalid||this._snapshot2.invalid;}
updateForCollectionEvent(event)
{if(!event.data.affectedSnapshots.includes(this._snapshot2._identifier))
return;this.update(()=>{this.dispatchEventToListeners(WebInspector.HeapSnapshotProxy.Event.CollectedNodes,event.data);});}
allocationBucketCounts(bucketSizes,callback)
{WebInspector.HeapSnapshotWorkerProxy.singleton().callMethod(this._proxyObjectId,"allocationBucketCounts",bucketSizes,callback);}
instancesWithClassName(className,callback)
{WebInspector.HeapSnapshotWorkerProxy.singleton().callMethod(this._proxyObjectId,"instancesWithClassName",className,(serializedNodes)=>{callback(serializedNodes.map(WebInspector.HeapSnapshotNodeProxy.deserialize.bind(null,this._proxyObjectId)));});}
update(callback)
{WebInspector.HeapSnapshotWorkerProxy.singleton().callMethod(this._proxyObjectId,"update",({liveSize,categories})=>{this._categories=Map.fromObject(categories);callback();});}
nodeWithIdentifier(nodeIdentifier,callback)
{WebInspector.HeapSnapshotWorkerProxy.singleton().callMethod(this._proxyObjectId,"nodeWithIdentifier",nodeIdentifier,(serializedNode)=>{callback(WebInspector.HeapSnapshotNodeProxy.deserialize(this._proxyObjectId,serializedNode));});}};WebInspector.HeapSnapshotEdgeProxy=class HeapSnapshotEdgeProxy
{constructor(objectId,fromIdentifier,toIdentifier,type,data)
{this._proxyObjectId=objectId;this.fromIdentifier=fromIdentifier;this.toIdentifier=toIdentifier;this.type=type;this.data=data;this.from=null;this.to=null;}
isPrivateSymbol()
{if(WebInspector.isDebugUIEnabled())
return false;return typeof this.data==="string"&&this.data.startsWith("PrivateSymbol");}
static deserialize(objectId,serializedEdge)
{let{from,to,type,data}=serializedEdge;return new WebInspector.HeapSnapshotEdgeProxy(objectId,from,to,type,data);}};WebInspector.HeapSnapshotEdgeProxy.EdgeType={Internal:"Internal",Property:"Property",Index:"Index",Variable:"Variable",};WebInspector.HeapSnapshotNodeProxy=class HeapSnapshotNodeProxy
{constructor(snapshotObjectId,identifier,className,size,retainedSize,internal,gcRoot,dead,dominatorNodeIdentifier,hasChildren)
{this._proxyObjectId=snapshotObjectId;this.id=identifier;this.className=className;this.size=size;this.retainedSize=retainedSize;this.internal=internal;this.gcRoot=gcRoot;this.dead=dead;this.dominatorNodeIdentifier=dominatorNodeIdentifier;this.hasChildren=hasChildren;}
static deserialize(objectId,serializedNode)
{let{id,className,size,retainedSize,internal,gcRoot,dead,dominatorNodeIdentifier,hasChildren}=serializedNode;return new WebInspector.HeapSnapshotNodeProxy(objectId,id,className,size,retainedSize,internal,gcRoot,dead,dominatorNodeIdentifier,hasChildren);}
shortestGCRootPath(callback)
{WebInspector.HeapSnapshotWorkerProxy.singleton().callMethod(this._proxyObjectId,"shortestGCRootPath",this.id,(serializedPath)=>{let isNode=false;let path=serializedPath.map((component)=>{isNode=!isNode;if(isNode)
return WebInspector.HeapSnapshotNodeProxy.deserialize(this._proxyObjectId,component);return WebInspector.HeapSnapshotEdgeProxy.deserialize(this._proxyObjectId,component);});for(let i=1;i<path.length;i+=2){let edge=path[i];edge.from=path[i-1];edge.to=path[i+1];}
callback(path);});}
dominatedNodes(callback)
{WebInspector.HeapSnapshotWorkerProxy.singleton().callMethod(this._proxyObjectId,"dominatedNodes",this.id,(serializedNodes)=>{callback(serializedNodes.map(WebInspector.HeapSnapshotNodeProxy.deserialize.bind(null,this._proxyObjectId)));});}
retainedNodes(callback)
{WebInspector.HeapSnapshotWorkerProxy.singleton().callMethod(this._proxyObjectId,"retainedNodes",this.id,({retainedNodes:serializedNodes,edges:serializedEdges})=>{let deserializedNodes=serializedNodes.map(WebInspector.HeapSnapshotNodeProxy.deserialize.bind(null,this._proxyObjectId));let deserializedEdges=serializedEdges.map(WebInspector.HeapSnapshotEdgeProxy.deserialize.bind(null,this._proxyObjectId));callback(deserializedNodes,deserializedEdges);});}
retainers(callback)
{WebInspector.HeapSnapshotWorkerProxy.singleton().callMethod(this._proxyObjectId,"retainers",this.id,({retainers:serializedNodes,edges:serializedEdges})=>{let deserializedNodes=serializedNodes.map(WebInspector.HeapSnapshotNodeProxy.deserialize.bind(null,this._proxyObjectId));let deserializedEdges=serializedEdges.map(WebInspector.HeapSnapshotEdgeProxy.deserialize.bind(null,this._proxyObjectId));callback(deserializedNodes,deserializedEdges);});}};WebInspector.HeapSnapshotProxy=class HeapSnapshotProxy extends WebInspector.Object
{constructor(snapshotObjectId,identifier,title,totalSize,totalObjectCount,liveSize,categories)
{super();this._proxyObjectId=snapshotObjectId;this._identifier=identifier;this._title=title;this._totalSize=totalSize;this._totalObjectCount=totalObjectCount;this._liveSize=liveSize;this._categories=Map.fromObject(categories);if(!WebInspector.HeapSnapshotProxy.ValidSnapshotProxies)
WebInspector.HeapSnapshotProxy.ValidSnapshotProxies=[];WebInspector.HeapSnapshotProxy.ValidSnapshotProxies.push(this);}
static deserialize(objectId,serializedSnapshot)
{let{identifier,title,totalSize,totalObjectCount,liveSize,categories}=serializedSnapshot;return new WebInspector.HeapSnapshotProxy(objectId,identifier,title,totalSize,totalObjectCount,liveSize,categories);}
static invalidateSnapshotProxies()
{if(!WebInspector.HeapSnapshotProxy.ValidSnapshotProxies)
return;for(let snapshotProxy of WebInspector.HeapSnapshotProxy.ValidSnapshotProxies)
snapshotProxy._invalidate();WebInspector.HeapSnapshotProxy.ValidSnapshotProxies=null;}
get proxyObjectId(){return this._proxyObjectId;}
get identifier(){return this._identifier;}
get title(){return this._title;}
get totalSize(){return this._totalSize;}
get totalObjectCount(){return this._totalObjectCount;}
get liveSize(){return this._liveSize;}
get categories(){return this._categories;}
get invalid(){return this._proxyObjectId===0;}
updateForCollectionEvent(event)
{if(!event.data.affectedSnapshots.includes(this._identifier))
return;this.update(()=>{this.dispatchEventToListeners(WebInspector.HeapSnapshotProxy.Event.CollectedNodes,event.data);});}
allocationBucketCounts(bucketSizes,callback)
{WebInspector.HeapSnapshotWorkerProxy.singleton().callMethod(this._proxyObjectId,"allocationBucketCounts",bucketSizes,callback);}
instancesWithClassName(className,callback)
{WebInspector.HeapSnapshotWorkerProxy.singleton().callMethod(this._proxyObjectId,"instancesWithClassName",className,(serializedNodes)=>{callback(serializedNodes.map(WebInspector.HeapSnapshotNodeProxy.deserialize.bind(null,this._proxyObjectId)));});}
update(callback)
{WebInspector.HeapSnapshotWorkerProxy.singleton().callMethod(this._proxyObjectId,"update",({liveSize,categories})=>{this._liveSize=liveSize;this._categories=Map.fromObject(categories);callback();});}
nodeWithIdentifier(nodeIdentifier,callback)
{WebInspector.HeapSnapshotWorkerProxy.singleton().callMethod(this._proxyObjectId,"nodeWithIdentifier",nodeIdentifier,(serializedNode)=>{callback(WebInspector.HeapSnapshotNodeProxy.deserialize(this._proxyObjectId,serializedNode));});}
_invalidate()
{this._proxyObjectId=0;this._liveSize=0;this.dispatchEventToListeners(WebInspector.HeapSnapshotProxy.Event.Invalidated);}};WebInspector.HeapSnapshotProxy.Event={CollectedNodes:"heap-snapshot-proxy-collected-nodes",Invalidated:"heap-snapshot-proxy-invalidated",};WebInspector.HeapSnapshotWorkerProxy=class HeapSnapshotWorkerProxy extends WebInspector.Object
{constructor()
{super();this._heapSnapshotWorker=new Worker("Workers/HeapSnapshot/HeapSnapshotWorker.js");this._heapSnapshotWorker.addEventListener("message",this._handleMessage.bind(this));this._nextCallId=1;this._callbacks=new Map;WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange,this._mainResourceDidChange,this);}
static singleton()
{if(!HeapSnapshotWorkerProxy.instance)
HeapSnapshotWorkerProxy.instance=new HeapSnapshotWorkerProxy;return HeapSnapshotWorkerProxy.instance;}
clearSnapshots(callback)
{this.performAction("clearSnapshots",callback);}
createSnapshot(snapshotStringData,callback)
{this.performAction("createSnapshot",...arguments);}
createSnapshotDiff(objectId1,objectId2,callback)
{this.performAction("createSnapshotDiff",...arguments);}
performAction(actionName)
{let callId=this._nextCallId++;let callback=arguments[arguments.length-1];let actionArguments=Array.prototype.slice.call(arguments,1,arguments.length-1);this._callbacks.set(callId,callback);this._postMessage({callId,actionName,actionArguments});}
callMethod(objectId,methodName)
{let callId=this._nextCallId++;let callback=arguments[arguments.length-1];let methodArguments=Array.prototype.slice.call(arguments,2,arguments.length-1);this._callbacks.set(callId,callback);this._postMessage({callId,objectId,methodName,methodArguments});}
_mainResourceDidChange(event)
{if(!event.target.isMainFrame())
return;this.clearSnapshots(()=>{WebInspector.HeapSnapshotProxy.invalidateSnapshotProxies();});}
_postMessage()
{this._heapSnapshotWorker.postMessage(...arguments);}
_handleMessage(event)
{let data=event.data;if(data.error){this._callbacks.delete(data.callId);return;}
if(data.eventName){this.dispatchEventToListeners(data.eventName,data.eventData);return;}
if(data.callId){let callback=this._callbacks.get(data.callId);this._callbacks.delete(data.callId);callback(data.result);return;}
console.error("Unexpected HeapSnapshotWorker message",data);}};WebInspector.View=class View extends WebInspector.Object
{constructor(element)
{super();this._element=element||document.createElement("div");this._element.__view=this;this._parentView=null;this._subviews=[];this._dirty=false;this._dirtyDescendantsCount=0;this._needsLayoutWhenAttachedToRoot=false;this._isAttachedToRoot=false;this._layoutReason=null;this._didInitialLayout=false;}
static rootView()
{if(!WebInspector.View._rootView)
WebInspector.View._rootView=new WebInspector.View(document.body);return WebInspector.View._rootView;}
get element()
{return this._element;}
get layoutPending()
{return this._dirty;}
get parentView()
{return this._parentView;}
get subviews()
{return this._subviews;}
isDescendantOf(view)
{let parentView=this._parentView;while(parentView){if(parentView===view)
return true;parentView=parentView.parentView;}
return false;}
addSubview(view)
{this.insertSubviewBefore(view,null);}
insertSubviewBefore(view,referenceView)
{if(this._subviews.includes(view)){return;}
const beforeIndex=referenceView?this._subviews.indexOf(referenceView):this._subviews.length;if(beforeIndex===-1){return;}
this._subviews.insertAtIndex(view,beforeIndex);if(!view.element.parentNode)
this._element.insertBefore(view.element,referenceView?referenceView.element:null);view.didMoveToParent(this);}
removeSubview(view)
{if(!this._subviews.includes(view)){return;}
this._subviews.remove(view,true);this._element.removeChild(view.element);view.didMoveToParent(null);}
replaceSubview(oldView,newView)
{this.insertSubviewBefore(newView,oldView);this.removeSubview(oldView);}
updateLayout(layoutReason)
{this.cancelLayout();this._setLayoutReason(layoutReason);this._layoutSubtree();}
updateLayoutIfNeeded(layoutReason)
{if(!this._dirty&&this._didInitialLayout)
return;this.updateLayout(layoutReason);}
needsLayout(layoutReason)
{this._setLayoutReason(layoutReason);if(this._dirty)
return;WebInspector.View._scheduleLayoutForView(this);}
cancelLayout()
{WebInspector.View._cancelScheduledLayoutForView(this);}
get layoutReason(){return this._layoutReason;}
didMoveToWindow(isAttachedToRoot)
{this._isAttachedToRoot=isAttachedToRoot;if(this._isAttachedToRoot&&this._needsLayoutWhenAttachedToRoot){WebInspector.View._scheduleLayoutForView(this);this._needsLayoutWhenAttachedToRoot=false;}
for(let view of this._subviews)
view.didMoveToWindow(isAttachedToRoot);}
didMoveToParent(parentView)
{this._parentView=parentView;let isAttachedToRoot=this.isDescendantOf(WebInspector.View._rootView);this.didMoveToWindow(isAttachedToRoot);if(!this._parentView)
return;let pendingLayoutsCount=this._dirtyDescendantsCount;if(this._dirty)
pendingLayoutsCount++;let view=this._parentView;while(view){view._dirtyDescendantsCount+=pendingLayoutsCount;view=view.parentView;}}
initialLayout()
{
}
layout()
{}
sizeDidChange()
{}
_layoutSubtree()
{this._dirty=false;this._dirtyDescendantsCount=0;if(!this._didInitialLayout){this.initialLayout();this._didInitialLayout=true;}
if(this._layoutReason===WebInspector.View.LayoutReason.Resize)
this.sizeDidChange();this.layout();for(let view of this._subviews){view._setLayoutReason(this._layoutReason);view._layoutSubtree();}
this._layoutReason=null;}
_setLayoutReason(layoutReason)
{if(this._layoutReason===WebInspector.View.LayoutReason.Resize)
return;this._layoutReason=layoutReason||WebInspector.View.LayoutReason.Dirty;}
static _scheduleLayoutForView(view)
{view._dirty=true;let parentView=view.parentView;while(parentView){parentView._dirtyDescendantsCount++;parentView=parentView.parentView;}
if(!view._isAttachedToRoot){view._needsLayoutWhenAttachedToRoot=true;return;}
if(WebInspector.View._scheduledLayoutUpdateIdentifier)
return;WebInspector.View._scheduledLayoutUpdateIdentifier=requestAnimationFrame(WebInspector.View._visitViewTreeForLayout);}
static _cancelScheduledLayoutForView(view)
{let cancelledLayoutsCount=view._dirtyDescendantsCount;if(view.layoutPending)
cancelledLayoutsCount++;let parentView=view.parentView;while(parentView){parentView._dirtyDescendantsCount=Math.max(0,parentView._dirtyDescendantsCount-cancelledLayoutsCount);parentView=parentView.parentView;}
if(!WebInspector.View._scheduledLayoutUpdateIdentifier)
return;let rootView=WebInspector.View._rootView;if(!rootView||rootView._dirtyDescendantsCount)
return;cancelAnimationFrame(WebInspector.View._scheduledLayoutUpdateIdentifier);WebInspector.View._scheduledLayoutUpdateIdentifier=undefined;}
static _visitViewTreeForLayout()
{WebInspector.View._scheduledLayoutUpdateIdentifier=undefined;let views=[WebInspector.View._rootView];while(views.length){let view=views.shift();if(view.layoutPending)
view._layoutSubtree();else if(view._dirtyDescendantsCount){views=views.concat(view.subviews);view._dirtyDescendantsCount=0;}}}};WebInspector.View.LayoutReason={Dirty:Symbol("layout-reason-dirty"),Resize:Symbol("layout-reason-resize")};WebInspector.View._rootView=null;WebInspector.View._scheduledLayoutUpdateIdentifier=undefined;WebInspector.ConsoleCommandView=class ConsoleCommandView extends WebInspector.Object
{constructor(commandText,className)
{super();this._commandText=commandText;this._className=className||"";}
render()
{this._element=document.createElement("div");this._element.classList.add("console-user-command");this._element.setAttribute("data-labelprefix",WebInspector.UIString("Input: "));if(this._className)
this._element.classList.add(this._className);this._formattedCommandElement=this._element.appendChild(document.createElement("span"));this._formattedCommandElement.classList.add("console-message-text");this._formattedCommandElement.textContent=this._commandText; this._element.__commandView=this;}
get element()
{return this._element;}
get commandText()
{return this._commandText;}
toClipboardString(isPrefixOptional)
{return(isPrefixOptional?"":"> ")+this._commandText.removeWordBreakCharacters();}};WebInspector.ConsoleMessageView=class ConsoleMessageView extends WebInspector.Object
{constructor(message)
{super();this._message=message;this._expandable=false;this._repeatCount=message._repeatCount||0;this._extraParameters=message.parameters;}
render()
{this._element=document.createElement("div");this._element.classList.add("console-message"); this._element.__message=this._message;this._element.__messageView=this;if(this._message.type===WebInspector.ConsoleMessage.MessageType.Result){this._element.classList.add("console-user-command-result");this._element.setAttribute("data-labelprefix",WebInspector.UIString("Output: "));}else if(this._message.type===WebInspector.ConsoleMessage.MessageType.StartGroup||this._message.type===WebInspector.ConsoleMessage.MessageType.StartGroupCollapsed)
this._element.classList.add("console-group-title");switch(this._message.level){case WebInspector.ConsoleMessage.MessageLevel.Log:this._element.classList.add("console-log-level");this._element.setAttribute("data-labelprefix",WebInspector.UIString("Log: "));break;case WebInspector.ConsoleMessage.MessageLevel.Info:this._element.classList.add("console-info-level");this._element.setAttribute("data-labelprefix",WebInspector.UIString("Info: "));break;case WebInspector.ConsoleMessage.MessageLevel.Debug:this._element.classList.add("console-debug-level");this._element.setAttribute("data-labelprefix",WebInspector.UIString("Debug: "));break;case WebInspector.ConsoleMessage.MessageLevel.Warning:this._element.classList.add("console-warning-level");this._element.setAttribute("data-labelprefix",WebInspector.UIString("Warning: "));break;case WebInspector.ConsoleMessage.MessageLevel.Error:this._element.classList.add("console-error-level");this._element.setAttribute("data-labelprefix",WebInspector.UIString("Error: "));break;}
this._appendLocationLink();this._messageTextElement=this._element.appendChild(document.createElement("span"));this._messageTextElement.classList.add("console-top-level-message");this._messageTextElement.classList.add("console-message-text");this._appendMessageTextAndArguments(this._messageTextElement);this._appendSavedResultIndex();this._appendExtraParameters();this._appendStackTrace();this._renderRepeatCount();}
get element()
{return this._element;}
get message()
{return this._message;}
get repeatCount()
{return this._repeatCount;}
set repeatCount(count)
{if(this._repeatCount===count)
return;this._repeatCount=count;if(this._element)
this._renderRepeatCount();}
_renderRepeatCount()
{let count=this._repeatCount;if(count<=1){if(this._repeatCountElement){this._repeatCountElement.remove();this._repeatCountElement=null;}
return;}
if(!this._repeatCountElement){this._repeatCountElement=document.createElement("span");this._repeatCountElement.classList.add("repeat-count");this._element.insertBefore(this._repeatCountElement,this._element.firstChild);}
this._repeatCountElement.textContent=Number.abbreviate(count);}
get expandable()
{if(this._expandable)
return true;if(this._objectTree)
return true;return false;}
expand()
{if(this._expandable)
this._element.classList.add("expanded");if(this._objectTree&&this._message.type!==WebInspector.ConsoleMessage.MessageType.Trace){if(!this._extraParameters||this._extraParameters.length<=1)
this._objectTree.expand();}}
collapse()
{if(this._expandable)
this._element.classList.remove("expanded");if(this._objectTree){if(!this._extraParameters||this._extraParameters.length<=1)
this._objectTree.collapse();}}
toggle()
{if(this._element.classList.contains("expanded"))
this.collapse();else
this.expand();}
toClipboardString(isPrefixOptional)
{let clipboardString=this._messageTextElement.innerText.removeWordBreakCharacters();if(this._message.savedResultIndex)
clipboardString=clipboardString.replace(/\s*=\s*(\$\d+)$/,"");let hasStackTrace=this._shouldShowStackTrace();if(!hasStackTrace){let repeatString=this.repeatCount>1?"x"+this.repeatCount:"";let urlLine="";if(this._message.url){let components=[WebInspector.displayNameForURL(this._message.url),"line "+this._message.line];if(repeatString)
components.push(repeatString);urlLine=" ("+components.join(", ")+")";}else if(repeatString)
urlLine=" ("+repeatString+")";if(urlLine){let lines=clipboardString.split("\n");lines[0]+=urlLine;clipboardString=lines.join("\n");}}
if(this._extraElementsList)
clipboardString+="\n"+this._extraElementsList.innerText.removeWordBreakCharacters().trim();if(hasStackTrace){this._message.stackTrace.callFrames.forEach(function(frame){clipboardString+="\n\t"+(frame.functionName||WebInspector.UIString("(anonymous function)"));if(frame.sourceCodeLocation)
clipboardString+=" ("+frame.sourceCodeLocation.originalLocationString()+")";});}
if(!isPrefixOptional||this._enforcesClipboardPrefixString())
return this._clipboardPrefixString()+clipboardString;return clipboardString;}
_appendMessageTextAndArguments(element)
{if(this._message.source===WebInspector.ConsoleMessage.MessageSource.ConsoleAPI){switch(this._message.type){case WebInspector.ConsoleMessage.MessageType.Trace:var args=[WebInspector.UIString("Trace")];if(this._message.parameters){if(this._message.parameters[0].type==="string"){var prefixedFormatString=WebInspector.UIString("Trace: %s").format(this._message.parameters[0].description);args=[prefixedFormatString].concat(this._message.parameters.slice(1));}else
args=args.concat(this._message.parameters);}
this._appendFormattedArguments(element,args);break;case WebInspector.ConsoleMessage.MessageType.Assert:var args=[WebInspector.UIString("Assertion Failed")];if(this._message.parameters){if(this._message.parameters[0].type==="string"){var prefixedFormatString=WebInspector.UIString("Assertion Failed: %s").format(this._message.parameters[0].description);args=[prefixedFormatString].concat(this._message.parameters.slice(1));}else
args=args.concat(this._message.parameters);}
this._appendFormattedArguments(element,args);break;case WebInspector.ConsoleMessage.MessageType.Dir:var obj=this._message.parameters?this._message.parameters[0]:undefined;this._appendFormattedArguments(element,["%O",obj]);break;case WebInspector.ConsoleMessage.MessageType.Table:var args=this._message.parameters;element.appendChild(this._formatParameterAsTable(args));this._extraParameters=null;break;case WebInspector.ConsoleMessage.MessageType.StartGroup:case WebInspector.ConsoleMessage.MessageType.StartGroupCollapsed:var args=this._message.parameters||[this._message.messageText||WebInspector.UIString("Group")];this._formatWithSubstitutionString(args,element);this._extraParameters=null;break;default:var args=this._message.parameters||[this._message.messageText];this._appendFormattedArguments(element,args);break;}
return;}
var args=this._message.parameters||[this._message.messageText];this._appendFormattedArguments(element,args);}
_appendSavedResultIndex(element)
{if(!this._message.savedResultIndex)
return;var savedVariableElement=document.createElement("span");savedVariableElement.classList.add("console-saved-variable");savedVariableElement.textContent=" = $"+this._message.savedResultIndex;if(this._objectTree)
this._objectTree.appendTitleSuffix(savedVariableElement);else
this._messageTextElement.appendChild(savedVariableElement);}
_appendLocationLink()
{if(this._message.source===WebInspector.ConsoleMessage.MessageSource.Network){if(this._message.url){var anchor=WebInspector.linkifyURLAsNode(this._message.url,this._message.url,"console-message-url");anchor.classList.add("console-message-location");this._element.appendChild(anchor);}
return;}
var firstNonNativeNonAnonymousCallFrame=this._message.stackTrace.firstNonNativeNonAnonymousCallFrame;var callFrame;if(firstNonNativeNonAnonymousCallFrame){callFrame=firstNonNativeNonAnonymousCallFrame;}else if(this._message.url&&!this._shouldHideURL(this._message.url)){callFrame=WebInspector.CallFrame.fromPayload(this._message.target,{functionName:"",url:this._message.url,lineNumber:this._message.line,columnNumber:this._message.column});}
if(callFrame&&(!callFrame.isConsoleEvaluation||WebInspector.isDebugUIEnabled())){const showFunctionName=!!callFrame.functionName;var locationElement=new WebInspector.CallFrameView(callFrame,showFunctionName);locationElement.classList.add("console-message-location");this._element.appendChild(locationElement);return;}
if(this._message.parameters&&this._message.parameters.length===1){var parameter=this._createRemoteObjectIfNeeded(this._message.parameters[0]);parameter.findFunctionSourceCodeLocation().then(function(result){if(result===WebInspector.RemoteObject.SourceCodeLocationPromise.NoSourceFound||result===WebInspector.RemoteObject.SourceCodeLocationPromise.MissingObjectId)
return;var link=this._linkifyLocation(result.sourceCode.url,result.lineNumber,result.columnNumber);link.classList.add("console-message-location");if(this._element.hasChildNodes())
this._element.insertBefore(link,this._element.firstChild);else
this._element.appendChild(link);}.bind(this));}}
_appendExtraParameters()
{if(!this._extraParameters||!this._extraParameters.length)
return;this._makeExpandable();if(this._extraParameters.length>1)
this.expand();this._extraElementsList=this._element.appendChild(document.createElement("ol"));this._extraElementsList.classList.add("console-message-extra-parameters-container");for(var parameter of this._extraParameters){var listItemElement=this._extraElementsList.appendChild(document.createElement("li"));const forceObjectFormat=parameter.type==="object"&&(parameter.subtype!=="null"&&parameter.subtype!=="regexp"&&parameter.subtype!=="node"&&parameter.subtype!=="error");listItemElement.classList.add("console-message-extra-parameter");listItemElement.appendChild(this._formatParameter(parameter,forceObjectFormat));}}
_appendStackTrace()
{if(!this._shouldShowStackTrace())
return;this._makeExpandable();if(this._message.type===WebInspector.ConsoleMessage.MessageType.Trace)
this.expand();this._stackTraceElement=this._element.appendChild(document.createElement("div"));this._stackTraceElement.classList.add("console-message-text","console-message-stack-trace-container");var callFramesElement=new WebInspector.StackTraceView(this._message.stackTrace).element;this._stackTraceElement.appendChild(callFramesElement);}
_createRemoteObjectIfNeeded(parameter)
{if(parameter instanceof WebInspector.RemoteObject)
return parameter;if(typeof parameter==="object")
return WebInspector.RemoteObject.fromPayload(parameter,this._message.target);return WebInspector.RemoteObject.fromPrimitiveValue(parameter);}
_appendFormattedArguments(element,parameters)
{if(!parameters.length)
return;for(var i=0;i<parameters.length;++i)
parameters[i]=this._createRemoteObjectIfNeeded(parameters[i]);var builderElement=element.appendChild(document.createElement("span"));var shouldFormatWithStringSubstitution=WebInspector.RemoteObject.type(parameters[0])==="string"&&this._message.type!==WebInspector.ConsoleMessage.MessageType.Result;if(parameters.length===1&&!shouldFormatWithStringSubstitution){this._extraParameters=null;builderElement.appendChild(this._formatParameter(parameters[0],false));return;}
if(shouldFormatWithStringSubstitution&&this._isStackTrace(parameters[0]))
shouldFormatWithStringSubstitution=false;if(shouldFormatWithStringSubstitution){var result=this._formatWithSubstitutionString(parameters,builderElement);parameters=result.unusedSubstitutions;this._extraParameters=parameters;}else{var defaultMessage=WebInspector.UIString("No message");builderElement.append(defaultMessage);}
if(parameters.length){let enclosedElement=document.createElement("span");if(parameters.length===1&&!this._isStackTrace(parameters[0])){let parameter=parameters[0];builderElement.append(enclosedElement);enclosedElement.classList.add("console-message-preview-divider");enclosedElement.textContent=" \u2013 ";var previewContainer=builderElement.appendChild(document.createElement("span"));previewContainer.classList.add("console-message-preview");var preview=WebInspector.FormattedValue.createObjectPreviewOrFormattedValueForRemoteObject(parameter,WebInspector.ObjectPreviewView.Mode.Brief);var isPreviewView=preview instanceof WebInspector.ObjectPreviewView;if(isPreviewView)
preview.setOriginatingObjectInfo(parameter,null);var previewElement=isPreviewView?preview.element:preview;previewContainer.appendChild(previewElement);if((isPreviewView&&preview.lossless)||(!isPreviewView&&this._shouldConsiderObjectLossless(parameter))){this._extraParameters=null;enclosedElement.classList.add("inline-lossless");previewContainer.classList.add("inline-lossless");}}else{builderElement.append(" ",enclosedElement);enclosedElement.classList.add("console-message-enclosed");enclosedElement.textContent="("+parameters.length+")";}}}
_isStackTrace(parameter)
{if(WebInspector.RemoteObject.type(parameter)!=="string")
return false;return WebInspector.StackTrace.isLikelyStackTrace(parameter.description);}
_shouldConsiderObjectLossless(object)
{if(object.type==="string"){const description=object.description;const maxLength=WebInspector.FormattedValue.MAX_PREVIEW_STRING_LENGTH;const longOrMultiLineString=description.length>maxLength||description.slice(0,maxLength).includes("\n");return!longOrMultiLineString;}
return object.type!=="object"||object.subtype==="null"||object.subtype==="regexp";}
_formatParameter(parameter,forceObjectFormat)
{var type;if(forceObjectFormat)
type="object";else if(parameter instanceof WebInspector.RemoteObject)
type=parameter.subtype||parameter.type;else{type=typeof parameter;}
var formatters={"object":this._formatParameterAsObject,"error":this._formatParameterAsError,"map":this._formatParameterAsObject,"set":this._formatParameterAsObject,"weakmap":this._formatParameterAsObject,"weakset":this._formatParameterAsObject,"iterator":this._formatParameterAsObject,"class":this._formatParameterAsObject,"proxy":this._formatParameterAsObject,"array":this._formatParameterAsArray,"node":this._formatParameterAsNode,"string":this._formatParameterAsString,};var formatter=formatters[type]||this._formatParameterAsValue;const fragment=document.createDocumentFragment();formatter.call(this,parameter,fragment,forceObjectFormat);return fragment;}
_formatParameterAsValue(value,fragment)
{fragment.appendChild(WebInspector.FormattedValue.createElementForRemoteObject(value));}
_formatParameterAsString(object,fragment)
{if(this._isStackTrace(object)){let stackTrace=WebInspector.StackTrace.fromString(this._message.target,object.description);if(stackTrace.callFrames.length){let stackView=new WebInspector.StackTraceView(stackTrace);fragment.appendChild(stackView.element);return;}}
fragment.appendChild(WebInspector.FormattedValue.createLinkifiedElementString(object.description));}
_formatParameterAsNode(object,fragment)
{fragment.appendChild(WebInspector.FormattedValue.createElementForNode(object));}
_formatParameterAsObject(object,fragment,forceExpansion)
{this._objectTree=new WebInspector.ObjectTreeView(object,null,this._rootPropertyPathForObject(object),forceExpansion);fragment.appendChild(this._objectTree.element);}
_formatParameterAsError(object,fragment)
{this._objectTree=new WebInspector.ErrorObjectView(object);fragment.appendChild(this._objectTree.element);}
_formatParameterAsArray(array,fragment)
{this._objectTree=new WebInspector.ObjectTreeView(array,WebInspector.ObjectTreeView.Mode.Properties,this._rootPropertyPathForObject(array));fragment.appendChild(this._objectTree.element);}
_rootPropertyPathForObject(object)
{if(!this._message.savedResultIndex)
return null;return new WebInspector.PropertyPath(object,"$"+this._message.savedResultIndex);}
_formatWithSubstitutionString(parameters,formattedResult)
{function parameterFormatter(force,obj)
{return this._formatParameter(obj,force);}
function stringFormatter(obj)
{return obj.description;}
function floatFormatter(obj,token)
{let value=typeof obj.value==="number"?obj.value:obj.description;return String.standardFormatters.f(value,token);}
function integerFormatter(obj)
{let value=typeof obj.value==="number"?obj.value:obj.description;return String.standardFormatters.d(value);}
var currentStyle=null;function styleFormatter(obj)
{currentStyle={};var buffer=document.createElement("span");buffer.setAttribute("style",obj.description);for(var i=0;i<buffer.style.length;i++){var property=buffer.style[i];if(isAllowlistedProperty(property))
currentStyle[property]=buffer.style[property];}}
function isAllowlistedProperty(property)
{for(var prefix of["background","border","color","font","line","margin","padding","text"]){if(property.startsWith(prefix)||property.startsWith("-webkit-"+prefix))
return true;}
return false;}
var formatters={};formatters.o=parameterFormatter.bind(this,false);formatters.s=stringFormatter;formatters.f=floatFormatter;formatters.i=integerFormatter;formatters.d=integerFormatter;formatters.c=styleFormatter;formatters.O=parameterFormatter.bind(this,true);function append(a,b)
{if(b instanceof Node)
a.appendChild(b);else if(b!==undefined){var toAppend=WebInspector.linkifyStringAsFragment(b.toString());if(currentStyle){var wrapper=document.createElement("span");for(var key in currentStyle)
wrapper.style[key]=currentStyle[key];wrapper.appendChild(toAppend);toAppend=wrapper;}
a.appendChild(toAppend);}
return a;}
return String.format(parameters[0].description,parameters.slice(1),formatters,formattedResult,append);}
_shouldShowStackTrace()
{if(!this._message.stackTrace.callFrames.length)
return false;return this._message.source===WebInspector.ConsoleMessage.MessageSource.Network||this._message.level===WebInspector.ConsoleMessage.MessageLevel.Error||this._message.type===WebInspector.ConsoleMessage.MessageType.Trace;}
_shouldHideURL(url)
{return url==="undefined"||url==="[native code]";}
_linkifyLocation(url,lineNumber,columnNumber)
{const options={className:"console-message-url",ignoreNetworkTab:true,ignoreSearchTab:true,};return WebInspector.linkifyLocation(url,new WebInspector.SourceCodePosition(lineNumber,columnNumber),options);}
_userProvidedColumnNames(columnNamesArgument)
{if(!columnNamesArgument)
return null;if(columnNamesArgument.type==="string"||columnNamesArgument.type==="number")
return[String(columnNamesArgument.value)];if(columnNamesArgument.type!=="object"||columnNamesArgument.subtype!=="array"||!columnNamesArgument.preview||!columnNamesArgument.preview.propertyPreviews)
return null;var extractedColumnNames=[];for(var propertyPreview of columnNamesArgument.preview.propertyPreviews){if(propertyPreview.type==="string"||propertyPreview.type==="number")
extractedColumnNames.push(String(propertyPreview.value));}
return extractedColumnNames.length?extractedColumnNames:null;}
_formatParameterAsTable(parameters)
{var element=document.createElement("span");var table=parameters[0];if(!table||!table.preview)
return element;var rows=[];var columnNames=[];var flatValues=[];var preview=table.preview;var userProvidedColumnNames=false;var extractedColumnNames=this._userProvidedColumnNames(parameters[1]);if(extractedColumnNames){userProvidedColumnNames=true;columnNames=extractedColumnNames;}
if(preview.propertyPreviews){for(var i=0;i<preview.propertyPreviews.length;++i){var rowProperty=preview.propertyPreviews[i];var rowPreview=rowProperty.valuePreview;if(!rowPreview||!rowPreview.propertyPreviews)
continue;var rowValue={};var maxColumnsToRender=15;for(var j=0;j<rowPreview.propertyPreviews.length;++j){var cellProperty=rowPreview.propertyPreviews[j];var columnRendered=columnNames.includes(cellProperty.name);if(!columnRendered){if(userProvidedColumnNames||columnNames.length===maxColumnsToRender)
continue;columnRendered=true;columnNames.push(cellProperty.name);}
rowValue[cellProperty.name]=WebInspector.FormattedValue.createElementForPropertyPreview(cellProperty);}
rows.push([rowProperty.name,rowValue]);}}
if(rows.length){columnNames.unshift(WebInspector.UIString("(Index)"));for(var i=0;i<rows.length;++i){var rowName=rows[i][0];var rowValue=rows[i][1];flatValues.push(rowName);for(var j=1;j<columnNames.length;++j){var columnName=columnNames[j];if(!(columnName in rowValue))
flatValues.push(emDash);else
flatValues.push(rowValue[columnName]);}}}
if(!flatValues.length&&preview.propertyPreviews){for(var i=0;i<preview.propertyPreviews.length;++i){var rowProperty=preview.propertyPreviews[i];if(!("value"in rowProperty))
continue;if(!columnNames.length){columnNames.push(WebInspector.UIString("Index"));columnNames.push(WebInspector.UIString("Value"));}
flatValues.push(rowProperty.name);flatValues.push(WebInspector.FormattedValue.createElementForPropertyPreview(rowProperty));}}
if(!flatValues.length)
return element;var dataGrid=WebInspector.DataGrid.createSortableDataGrid(columnNames,flatValues);dataGrid.inline=true;dataGrid.variableHeightRows=true;element.appendChild(dataGrid.element);dataGrid.updateLayoutIfNeeded();return element;}
_levelString()
{switch(this._message.level){case WebInspector.ConsoleMessage.MessageLevel.Log:return"Log";case WebInspector.ConsoleMessage.MessageLevel.Info:return"Info";case WebInspector.ConsoleMessage.MessageLevel.Warning:return"Warning";case WebInspector.ConsoleMessage.MessageLevel.Debug:return"Debug";case WebInspector.ConsoleMessage.MessageLevel.Error:return"Error";}}
_enforcesClipboardPrefixString()
{return this._message.type!==WebInspector.ConsoleMessage.MessageType.Result;}
_clipboardPrefixString()
{if(this._message.type===WebInspector.ConsoleMessage.MessageType.Result)
return"< ";return"["+this._levelString()+"] ";}
_makeExpandable()
{if(this._expandable)
return;this._expandable=true;this._element.classList.add("expandable");this._boundClickHandler=this.toggle.bind(this);this._messageTextElement.addEventListener("click",this._boundClickHandler);}};WebInspector.ContentBrowser=class ContentBrowser extends WebInspector.View
{constructor(element,delegate,disableBackForward,disableFindBanner)
{super(element);this.element.classList.add("content-browser");this._navigationBar=new WebInspector.NavigationBar;this.addSubview(this._navigationBar);this._contentViewContainer=new WebInspector.ContentViewContainer;this._contentViewContainer.addEventListener(WebInspector.ContentViewContainer.Event.CurrentContentViewDidChange,this._currentContentViewDidChange,this);this.addSubview(this._contentViewContainer);if(!disableBackForward){let isRTL=WebInspector.resolvedLayoutDirection()===WebInspector.LayoutDirection.RTL;let goBack=()=>{this.goBack();};let goForward=()=>{this.goForward();};let backShortcutKey=isRTL?WebInspector.KeyboardShortcut.Key.Right:WebInspector.KeyboardShortcut.Key.Left;let forwardShortcutKey=isRTL?WebInspector.KeyboardShortcut.Key.Left:WebInspector.KeyboardShortcut.Key.Right;this._backKeyboardShortcut=new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl|WebInspector.KeyboardShortcut.Modifier.Control,backShortcutKey,goBack,this.element);this._forwardKeyboardShortcut=new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl|WebInspector.KeyboardShortcut.Modifier.Control,forwardShortcutKey,goForward,this.element);let leftArrow="Images/BackForwardArrows.svg#left-arrow-mask";let rightArrow="Images/BackForwardArrows.svg#right-arrow-mask";let backButtonImage=isRTL?rightArrow:leftArrow;let forwardButtonImage=isRTL?leftArrow:rightArrow;this._backNavigationItem=new WebInspector.ButtonNavigationItem("back",WebInspector.UIString("Back (%s)").format(this._backKeyboardShortcut.displayName),backButtonImage,8,13);this._backNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,goBack);this._backNavigationItem.enabled=false;this._navigationBar.addNavigationItem(this._backNavigationItem);this._forwardNavigationItem=new WebInspector.ButtonNavigationItem("forward",WebInspector.UIString("Forward (%s)").format(this._forwardKeyboardShortcut.displayName),forwardButtonImage,8,13);this._forwardNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,goForward);this._forwardNavigationItem.enabled=false;this._navigationBar.addNavigationItem(this._forwardNavigationItem);this._navigationBar.addNavigationItem(new WebInspector.DividerNavigationItem);}
if(!disableFindBanner){this._findBanner=new WebInspector.FindBanner(this);this._findBanner.addEventListener(WebInspector.FindBanner.Event.DidShow,this._findBannerDidShow,this);this._findBanner.addEventListener(WebInspector.FindBanner.Event.DidHide,this._findBannerDidHide,this);}
this._hierarchicalPathNavigationItem=new WebInspector.HierarchicalPathNavigationItem;this._hierarchicalPathNavigationItem.addEventListener(WebInspector.HierarchicalPathNavigationItem.Event.PathComponentWasSelected,this._hierarchicalPathComponentWasSelected,this);this._navigationBar.addNavigationItem(this._hierarchicalPathNavigationItem);this._contentViewSelectionPathNavigationItem=new WebInspector.HierarchicalPathNavigationItem;this._dividingFlexibleSpaceNavigationItem=new WebInspector.FlexibleSpaceNavigationItem;this._navigationBar.addNavigationItem(this._dividingFlexibleSpaceNavigationItem);WebInspector.ContentView.addEventListener(WebInspector.ContentView.Event.SelectionPathComponentsDidChange,this._contentViewSelectionPathComponentDidChange,this);WebInspector.ContentView.addEventListener(WebInspector.ContentView.Event.SupplementalRepresentedObjectsDidChange,this._contentViewSupplementalRepresentedObjectsDidChange,this);WebInspector.ContentView.addEventListener(WebInspector.ContentView.Event.NumberOfSearchResultsDidChange,this._contentViewNumberOfSearchResultsDidChange,this);WebInspector.ContentView.addEventListener(WebInspector.ContentView.Event.NavigationItemsDidChange,this._contentViewNavigationItemsDidChange,this);this._delegate=delegate||null;this._currentContentViewNavigationItems=[];}
get navigationBar()
{return this._navigationBar;}
get contentViewContainer()
{return this._contentViewContainer;}
get delegate()
{return this._delegate;}
set delegate(newDelegate)
{this._delegate=newDelegate||null;}
get currentContentView()
{return this._contentViewContainer.currentContentView;}
get currentRepresentedObjects()
{var representedObjects=[];var lastComponent=this._hierarchicalPathNavigationItem.lastComponent;if(lastComponent&&lastComponent.representedObject)
representedObjects.push(lastComponent.representedObject);lastComponent=this._contentViewSelectionPathNavigationItem.lastComponent;if(lastComponent&&lastComponent.representedObject)
representedObjects.push(lastComponent.representedObject);var currentContentView=this.currentContentView;if(currentContentView){var supplementalRepresentedObjects=currentContentView.supplementalRepresentedObjects;if(supplementalRepresentedObjects&&supplementalRepresentedObjects.length)
representedObjects=representedObjects.concat(supplementalRepresentedObjects);}
return representedObjects;}
showContentViewForRepresentedObject(representedObject,cookie,extraArguments)
{var contentView=this.contentViewForRepresentedObject(representedObject,false,extraArguments);return this._contentViewContainer.showContentView(contentView,cookie);}
showContentView(contentView,cookie)
{return this._contentViewContainer.showContentView(contentView,cookie);}
contentViewForRepresentedObject(representedObject,onlyExisting,extraArguments)
{return this._contentViewContainer.contentViewForRepresentedObject(representedObject,onlyExisting,extraArguments);}
updateHierarchicalPathForCurrentContentView()
{var currentContentView=this.currentContentView;this._updateHierarchicalPathNavigationItem(currentContentView?currentContentView.representedObject:null);}
canGoBack()
{var currentContentView=this.currentContentView;if(currentContentView&&currentContentView.canGoBack())
return true;return this._contentViewContainer.canGoBack();}
canGoForward()
{var currentContentView=this.currentContentView;if(currentContentView&&currentContentView.canGoForward())
return true;return this._contentViewContainer.canGoForward();}
goBack()
{var currentContentView=this.currentContentView;if(currentContentView&&currentContentView.canGoBack()){currentContentView.goBack();this._updateBackForwardButtons();return;}
this._contentViewContainer.goBack();}
goForward()
{var currentContentView=this.currentContentView;if(currentContentView&&currentContentView.canGoForward()){currentContentView.goForward();this._updateBackForwardButtons();return;}
this._contentViewContainer.goForward();}
showFindBanner()
{if(!this._findBanner)
return;var currentContentView=this.currentContentView;if(!currentContentView||!currentContentView.supportsSearch)
return;if(currentContentView.supportsCustomFindBanner){currentContentView.showCustomFindBanner();return;}
this._findBanner.show();}
findBannerPerformSearch(findBanner,query)
{var currentContentView=this.currentContentView;if(!currentContentView||!currentContentView.supportsSearch)
return;currentContentView.performSearch(query);}
findBannerSearchCleared(findBanner)
{var currentContentView=this.currentContentView;if(!currentContentView||!currentContentView.supportsSearch)
return;currentContentView.searchCleared();}
findBannerSearchQueryForSelection(findBanner)
{var currentContentView=this.currentContentView;if(!currentContentView||!currentContentView.supportsSearch)
return null;return currentContentView.searchQueryWithSelection();}
findBannerRevealPreviousResult(findBanner)
{var currentContentView=this.currentContentView;if(!currentContentView||!currentContentView.supportsSearch)
return;currentContentView.revealPreviousSearchResult(!findBanner.showing);}
findBannerRevealNextResult(findBanner)
{var currentContentView=this.currentContentView;if(!currentContentView||!currentContentView.supportsSearch)
return;currentContentView.revealNextSearchResult(!findBanner.showing);}
shown()
{this._contentViewContainer.shown();if(this._findBanner)
this._findBanner.enableKeyboardShortcuts();}
hidden()
{this._contentViewContainer.hidden();if(this._findBanner)
this._findBanner.disableKeyboardShortcuts();}
_findBannerDidShow(event)
{var currentContentView=this.currentContentView;if(!currentContentView||!currentContentView.supportsSearch)
return;currentContentView.automaticallyRevealFirstSearchResult=true;if(this._findBanner.searchQuery!=="")
currentContentView.performSearch(this._findBanner.searchQuery);}
_findBannerDidHide(event)
{var currentContentView=this.currentContentView;if(!currentContentView||!currentContentView.supportsSearch)
return;currentContentView.automaticallyRevealFirstSearchResult=false;currentContentView.searchCleared();}
_contentViewNumberOfSearchResultsDidChange(event)
{if(!this._findBanner)
return;if(event.target!==this.currentContentView)
return;this._findBanner.numberOfResults=this.currentContentView.numberOfSearchResults;}
_updateHierarchicalPathNavigationItem(representedObject)
{if(!this.delegate||typeof this.delegate.contentBrowserTreeElementForRepresentedObject!=="function")
return;var treeElement=representedObject?this.delegate.contentBrowserTreeElementForRepresentedObject(this,representedObject):null;var pathComponents=[];while(treeElement&&!treeElement.root){var pathComponent=new WebInspector.GeneralTreeElementPathComponent(treeElement);pathComponents.unshift(pathComponent);treeElement=treeElement.parent;}
this._hierarchicalPathNavigationItem.components=pathComponents;}
_updateContentViewSelectionPathNavigationItem(contentView)
{var selectionPathComponents=contentView?contentView.selectionPathComponents||[]:[];this._contentViewSelectionPathNavigationItem.components=selectionPathComponents;if(!selectionPathComponents.length){this._hierarchicalPathNavigationItem.alwaysShowLastPathComponentSeparator=false;this._navigationBar.removeNavigationItem(this._contentViewSelectionPathNavigationItem);return;}
if(!this._navigationBar.navigationItems.includes(this._contentViewSelectionPathNavigationItem)){var hierarchicalPathItemIndex=this._navigationBar.navigationItems.indexOf(this._hierarchicalPathNavigationItem);this._navigationBar.insertNavigationItem(this._contentViewSelectionPathNavigationItem,hierarchicalPathItemIndex+1);this._hierarchicalPathNavigationItem.alwaysShowLastPathComponentSeparator=true;}}
_updateBackForwardButtons()
{if(!this._backNavigationItem||!this._forwardNavigationItem)
return;this._backNavigationItem.enabled=this.canGoBack();this._forwardNavigationItem.enabled=this.canGoForward();}
_updateContentViewNavigationItems(forceUpdate)
{let currentContentView=this.currentContentView;if(!currentContentView){this._removeAllNavigationItems();this._currentContentViewNavigationItems=[];return;}
if(currentContentView.parentContainer!==this._contentViewContainer)
return;if(!forceUpdate){let previousItems=this._currentContentViewNavigationItems.filter((item)=>!(item instanceof WebInspector.DividerNavigationItem));let isUnchanged=Array.shallowEqual(previousItems,currentContentView.navigationItems);if(isUnchanged)
return;}
this._removeAllNavigationItems();let navigationBar=this.navigationBar;let insertionIndex=navigationBar.navigationItems.indexOf(this._dividingFlexibleSpaceNavigationItem)+1;let newNavigationItems=[];currentContentView.navigationItems.forEach(function(navigationItem,index){if(index!==0||navigationItem instanceof WebInspector.ButtonNavigationItem){let divider=new WebInspector.DividerNavigationItem;navigationBar.insertNavigationItem(divider,insertionIndex++);newNavigationItems.push(divider);}
navigationBar.insertNavigationItem(navigationItem,insertionIndex++);newNavigationItems.push(navigationItem);});
this._currentContentViewNavigationItems=newNavigationItems;}
_removeAllNavigationItems()
{for(let navigationItem of this._currentContentViewNavigationItems){if(navigationItem.parentNavigationBar)
navigationItem.parentNavigationBar.removeNavigationItem(navigationItem);}}
_updateFindBanner(currentContentView)
{if(!this._findBanner)
return;if(!currentContentView){this._findBanner.targetElement=null;this._findBanner.numberOfResults=null;return;}
this._findBanner.targetElement=currentContentView.element;this._findBanner.numberOfResults=currentContentView.hasPerformedSearch?currentContentView.numberOfSearchResults:null;if(currentContentView.supportsSearch&&this._findBanner.searchQuery){currentContentView.automaticallyRevealFirstSearchResult=this._findBanner.showing;currentContentView.performSearch(this._findBanner.searchQuery);}}
_dispatchCurrentRepresentedObjectsDidChangeEvent()
{this._dispatchCurrentRepresentedObjectsDidChangeEvent.cancelDebounce();this.dispatchEventToListeners(WebInspector.ContentBrowser.Event.CurrentRepresentedObjectsDidChange);}
_contentViewSelectionPathComponentDidChange(event)
{if(event.target!==this.currentContentView)
return;this._updateContentViewSelectionPathNavigationItem(event.target);this._updateBackForwardButtons();this._updateContentViewNavigationItems();this._navigationBar.needsLayout();this.soon._dispatchCurrentRepresentedObjectsDidChangeEvent();}
_contentViewSupplementalRepresentedObjectsDidChange(event)
{if(event.target!==this.currentContentView)
return;this.soon._dispatchCurrentRepresentedObjectsDidChangeEvent();}
_currentContentViewDidChange(event)
{var currentContentView=this.currentContentView;this._updateHierarchicalPathNavigationItem(currentContentView?currentContentView.representedObject:null);this._updateContentViewSelectionPathNavigationItem(currentContentView);this._updateBackForwardButtons();this._updateContentViewNavigationItems();this._updateFindBanner(currentContentView);this._navigationBar.needsLayout();this.dispatchEventToListeners(WebInspector.ContentBrowser.Event.CurrentContentViewDidChange);this._dispatchCurrentRepresentedObjectsDidChangeEvent();}
_contentViewNavigationItemsDidChange(event)
{if(event.target!==this.currentContentView)
return;const forceUpdate=true;this._updateContentViewNavigationItems(forceUpdate);this._navigationBar.needsLayout();}
_hierarchicalPathComponentWasSelected(event)
{var treeElement=event.data.pathComponent.generalTreeElement;var originalTreeElement=treeElement;while(treeElement&&!WebInspector.ContentView.isViewable(treeElement.representedObject))
treeElement=treeElement.traverseNextTreeElement(false,originalTreeElement,false);if(!treeElement)
return;treeElement.revealAndSelect();}};WebInspector.ContentBrowser.Event={CurrentRepresentedObjectsDidChange:"content-browser-current-represented-objects-did-change",CurrentContentViewDidChange:"content-browser-current-content-view-did-change"};WebInspector.ContentView=class ContentView extends WebInspector.View
{constructor(representedObject,extraArguments)
{super();this._representedObject=representedObject;this.element.classList.add("content-view");this._parentContainer=null;}
static createFromRepresentedObject(representedObject,extraArguments)
{if(representedObject instanceof WebInspector.Frame)
return new WebInspector.ResourceClusterContentView(representedObject.mainResource,extraArguments);if(representedObject instanceof WebInspector.Resource)
return new WebInspector.ResourceClusterContentView(representedObject,extraArguments);if(representedObject instanceof WebInspector.Script)
return new WebInspector.ScriptContentView(representedObject,extraArguments);if(representedObject instanceof WebInspector.CSSStyleSheet)
return new WebInspector.TextResourceContentView(representedObject,extraArguments);if(representedObject instanceof WebInspector.Canvas)
return new WebInspector.CanvasContentView(representedObject,extraArguments);if(representedObject instanceof WebInspector.TimelineRecording)
return new WebInspector.TimelineRecordingContentView(representedObject,extraArguments);if(representedObject instanceof WebInspector.Timeline){var timelineType=representedObject.type;if(timelineType===WebInspector.TimelineRecord.Type.Network)
return new WebInspector.NetworkTimelineView(representedObject,extraArguments);if(timelineType===WebInspector.TimelineRecord.Type.Layout)
return new WebInspector.LayoutTimelineView(representedObject,extraArguments);if(timelineType===WebInspector.TimelineRecord.Type.Script)
return new WebInspector.ScriptClusterTimelineView(representedObject,extraArguments);if(timelineType===WebInspector.TimelineRecord.Type.RenderingFrame)
return new WebInspector.RenderingFrameTimelineView(representedObject,extraArguments);if(timelineType===WebInspector.TimelineRecord.Type.Memory)
return new WebInspector.MemoryTimelineView(representedObject,extraArguments);if(timelineType===WebInspector.TimelineRecord.Type.HeapAllocations)
return new WebInspector.HeapAllocationsTimelineView(representedObject,extraArguments);}
if(representedObject instanceof WebInspector.Breakpoint||representedObject instanceof WebInspector.IssueMessage){if(representedObject.sourceCodeLocation)
return WebInspector.ContentView.createFromRepresentedObject(representedObject.sourceCodeLocation.displaySourceCode,extraArguments);}
if(representedObject instanceof WebInspector.DOMStorageObject)
return new WebInspector.DOMStorageContentView(representedObject,extraArguments);if(representedObject instanceof WebInspector.CookieStorageObject)
return new WebInspector.CookieStorageContentView(representedObject,extraArguments);if(representedObject instanceof WebInspector.DatabaseTableObject)
return new WebInspector.DatabaseTableContentView(representedObject,extraArguments);if(representedObject instanceof WebInspector.DatabaseObject)
return new WebInspector.DatabaseContentView(representedObject,extraArguments);if(representedObject instanceof WebInspector.IndexedDatabase)
return new WebInspector.IndexedDatabaseContentView(representedObject,extraArguments);if(representedObject instanceof WebInspector.IndexedDatabaseObjectStore)
return new WebInspector.IndexedDatabaseObjectStoreContentView(representedObject,extraArguments);if(representedObject instanceof WebInspector.IndexedDatabaseObjectStoreIndex)
return new WebInspector.IndexedDatabaseObjectStoreContentView(representedObject,extraArguments);if(representedObject instanceof WebInspector.ApplicationCacheFrame)
return new WebInspector.ApplicationCacheFrameContentView(representedObject,extraArguments);if(representedObject instanceof WebInspector.DOMTree)
return new WebInspector.FrameDOMTreeContentView(representedObject,extraArguments);if(representedObject instanceof WebInspector.DOMSearchMatchObject){var resultView=new WebInspector.FrameDOMTreeContentView(WebInspector.frameResourceManager.mainFrame.domTree,extraArguments);resultView.restoreFromCookie({nodeToSelect:representedObject.domNode});return resultView;}
if(representedObject instanceof WebInspector.DOMNode){if(representedObject.frame){let resultView=WebInspector.ContentView.createFromRepresentedObject(representedObject.frame,extraArguments);resultView.restoreFromCookie({nodeToSelect:representedObject});return resultView;}}
if(representedObject instanceof WebInspector.SourceCodeSearchMatchObject){var resultView;if(representedObject.sourceCode instanceof WebInspector.Resource)
resultView=new WebInspector.ResourceClusterContentView(representedObject.sourceCode,extraArguments);else if(representedObject.sourceCode instanceof WebInspector.Script)
resultView=new WebInspector.ScriptContentView(representedObject.sourceCode,extraArguments);else
console.error("Unknown SourceCode",representedObject.sourceCode);var textRangeToSelect=representedObject.sourceCodeTextRange.formattedTextRange;var startPosition=textRangeToSelect.startPosition();resultView.restoreFromCookie({lineNumber:startPosition.lineNumber,columnNumber:startPosition.columnNumber});return resultView;}
if(representedObject instanceof WebInspector.LogObject)
return new WebInspector.LogContentView(representedObject,extraArguments);if(representedObject instanceof WebInspector.ContentFlow)
return new WebInspector.ContentFlowDOMTreeContentView(representedObject,extraArguments);if(representedObject instanceof WebInspector.CallingContextTree)
return new WebInspector.ProfileView(representedObject,extraArguments);if(representedObject instanceof WebInspector.HeapSnapshotProxy||representedObject instanceof WebInspector.HeapSnapshotDiffProxy)
return new WebInspector.HeapSnapshotClusterContentView(representedObject,extraArguments);if(representedObject instanceof WebInspector.Collection)
return new WebInspector.CollectionContentView(representedObject,extraArguments);if(typeof representedObject==="string"||representedObject instanceof String)
return new WebInspector.TextContentView(representedObject,extraArguments);throw new Error("Can't make a ContentView for an unknown representedObject of type: "+representedObject.constructor.name);}
static contentViewForRepresentedObject(representedObject,onlyExisting,extraArguments)
{let resolvedRepresentedObject=WebInspector.ContentView.resolvedRepresentedObjectForRepresentedObject(representedObject);if(!resolvedRepresentedObject)
return null;let existingContentView=resolvedRepresentedObject[WebInspector.ContentView.ContentViewForRepresentedObjectSymbol];if(existingContentView)
return existingContentView;if(onlyExisting)
return null;let newContentView=WebInspector.ContentView.createFromRepresentedObject(representedObject,extraArguments);if(!newContentView)
return null;newContentView.representedObject[WebInspector.ContentView.ContentViewForRepresentedObjectSymbol]=newContentView;return newContentView;}
static closedContentViewForRepresentedObject(representedObject)
{let resolvedRepresentedObject=WebInspector.ContentView.resolvedRepresentedObjectForRepresentedObject(representedObject);resolvedRepresentedObject[WebInspector.ContentView.ContentViewForRepresentedObjectSymbol]=null;}
static resolvedRepresentedObjectForRepresentedObject(representedObject)
{if(representedObject instanceof WebInspector.Frame)
return representedObject.mainResource;if(representedObject instanceof WebInspector.Breakpoint||representedObject instanceof WebInspector.IssueMessage){if(representedObject.sourceCodeLocation)
return representedObject.sourceCodeLocation.displaySourceCode;}
if(representedObject instanceof WebInspector.DOMBreakpoint){if(representedObject.domNode)
return WebInspector.ContentView.resolvedRepresentedObjectForRepresentedObject(representedObject.domNode);}
if(representedObject instanceof WebInspector.DOMNode){if(representedObject.frame)
return WebInspector.ContentView.resolvedRepresentedObjectForRepresentedObject(representedObject.frame);}
if(representedObject instanceof WebInspector.DOMSearchMatchObject)
return WebInspector.frameResourceManager.mainFrame.domTree;if(representedObject instanceof WebInspector.SourceCodeSearchMatchObject)
return representedObject.sourceCode;return representedObject;}
static isViewable(representedObject)
{if(representedObject instanceof WebInspector.Frame)
return true;if(representedObject instanceof WebInspector.Resource)
return true;if(representedObject instanceof WebInspector.Script)
return true;if(representedObject instanceof WebInspector.CSSStyleSheet)
return true;if(representedObject instanceof WebInspector.Canvas)
return true;if(representedObject instanceof WebInspector.TimelineRecording)
return true;if(representedObject instanceof WebInspector.Timeline)
return true;if(representedObject instanceof WebInspector.Breakpoint||representedObject instanceof WebInspector.IssueMessage)
return representedObject.sourceCodeLocation;if(representedObject instanceof WebInspector.DOMStorageObject)
return true;if(representedObject instanceof WebInspector.CookieStorageObject)
return true;if(representedObject instanceof WebInspector.DatabaseTableObject)
return true;if(representedObject instanceof WebInspector.DatabaseObject)
return true;if(representedObject instanceof WebInspector.IndexedDatabase)
return true;if(representedObject instanceof WebInspector.IndexedDatabaseObjectStore)
return true;if(representedObject instanceof WebInspector.IndexedDatabaseObjectStoreIndex)
return true;if(representedObject instanceof WebInspector.ApplicationCacheFrame)
return true;if(representedObject instanceof WebInspector.DOMTree)
return true;if(representedObject instanceof WebInspector.DOMSearchMatchObject)
return true;if(representedObject instanceof WebInspector.SourceCodeSearchMatchObject)
return true;if(representedObject instanceof WebInspector.LogObject)
return true;if(representedObject instanceof WebInspector.ContentFlow)
return true;if(representedObject instanceof WebInspector.CallingContextTree)
return true;if(representedObject instanceof WebInspector.HeapSnapshotProxy||representedObject instanceof WebInspector.HeapSnapshotDiffProxy)
return true;if(representedObject instanceof WebInspector.Collection)
return true;if(typeof representedObject==="string"||representedObject instanceof String)
return true;return false;}
get representedObject()
{return this._representedObject;}
get navigationItems()
{return[];}
get parentContainer()
{return this._parentContainer;}
get visible()
{return this._visible;}
set visible(flag)
{this._visible=flag;}
get scrollableElements()
{return[];}
get shouldKeepElementsScrolledToBottom()
{return false;}
get selectionPathComponents()
{return[];}
get supplementalRepresentedObjects()
{return[];}
get supportsSplitContentBrowser()
{return WebInspector.dockedConfigurationSupportsSplitContentBrowser();}
shown()
{}
hidden()
{}
closed()
{}
saveToCookie(cookie)
{}
restoreFromCookie(cookie)
{}
canGoBack()
{return false;}
canGoForward()
{return false;}
goBack()
{}
goForward()
{}
get supportsSearch()
{return false;}
get supportsCustomFindBanner()
{return false;}
showCustomFindBanner()
{}
get numberOfSearchResults()
{return null;}
get hasPerformedSearch()
{return false;}
set automaticallyRevealFirstSearchResult(reveal)
{}
performSearch(query)
{}
searchCleared()
{}
searchQueryWithSelection()
{return null;}
revealPreviousSearchResult(changeFocus)
{}
revealNextSearchResult(changeFocus)
{}};WebInspector.ContentView.Event={SelectionPathComponentsDidChange:"content-view-selection-path-components-did-change",SupplementalRepresentedObjectsDidChange:"content-view-supplemental-represented-objects-did-change",NumberOfSearchResultsDidChange:"content-view-number-of-search-results-did-change",NavigationItemsDidChange:"content-view-navigation-items-did-change"};WebInspector.ContentView.ContentViewForRepresentedObjectSymbol=Symbol("content-view-for-represented-object");WebInspector.DataGrid=class DataGrid extends WebInspector.View
{constructor(columnsData,editCallback,deleteCallback,preferredColumnOrder)
{super();this.columns=new Map;this.orderedColumns=[];this._settingsIdentifier=null;this._sortColumnIdentifier=null;this._sortColumnIdentifierSetting=null;this._sortOrder=WebInspector.DataGrid.SortOrder.Indeterminate;this._sortOrderSetting=null;this._columnVisibilitySetting=null;this._columnChooserEnabled=false;this._headerVisible=true;this._rows=[];this.children=[];this.selectedNode=null;this.expandNodesWhenArrowing=false;this.root=true;this.hasChildren=false;this.expanded=true;this.revealed=true;this.selected=false;this.dataGrid=this;this.indentWidth=15;this.rowHeight=20;this.resizers=[];this._columnWidthsInitialized=false;this._scrollbarWidth=0;this._cachedScrollTop=NaN;this._cachedScrollableOffsetHeight=NaN;this._previousRevealedRowCount=NaN;this._topDataTableMarginHeight=NaN;this._bottomDataTableMarginHeight=NaN;this._filterText="";this._filterDelegate=null;this._filterDidModifyNodeWhileProcessingItems=false;this.element.className="data-grid";this.element.tabIndex=0;this.element.addEventListener("keydown",this._keyDown.bind(this),false);this.element.copyHandler=this;this._headerWrapperElement=document.createElement("div");this._headerWrapperElement.classList.add("header-wrapper");this._headerTableElement=document.createElement("table");this._headerTableElement.className="header";this._headerWrapperElement.appendChild(this._headerTableElement);this._headerTableColumnGroupElement=this._headerTableElement.createChild("colgroup");this._headerTableBodyElement=this._headerTableElement.createChild("tbody");this._headerTableRowElement=this._headerTableBodyElement.createChild("tr");this._headerTableRowElement.addEventListener("contextmenu",this._contextMenuInHeader.bind(this),true);this._headerTableCellElements=new Map;this._scrollContainerElement=document.createElement("div");this._scrollContainerElement.className="data-container";this._scrollListener=()=>this._noteScrollPositionChanged();this._updateScrollListeners();this._topDataTableMarginElement=this._scrollContainerElement.createChild("div");this._dataTableElement=this._scrollContainerElement.createChild("table","data");this._bottomDataTableMarginElement=this._scrollContainerElement.createChild("div");this._dataTableElement.addEventListener("mousedown",this._mouseDownInDataTable.bind(this));this._dataTableElement.addEventListener("click",this._clickInDataTable.bind(this));this._dataTableElement.addEventListener("contextmenu",this._contextMenuInDataTable.bind(this),true);
if(editCallback){this._dataTableElement.addEventListener("dblclick",this._ondblclick.bind(this),false);this._editCallback=editCallback;}
if(deleteCallback)
this._deleteCallback=deleteCallback;this._dataTableColumnGroupElement=this._headerTableColumnGroupElement.cloneNode(true);this._dataTableElement.appendChild(this._dataTableColumnGroupElement);this.dataTableBodyElement=this._dataTableElement.createChild("tbody");this._fillerRowElement=this.dataTableBodyElement.createChild("tr","filler");this.element.appendChild(this._headerWrapperElement);this.element.appendChild(this._scrollContainerElement);if(preferredColumnOrder){for(var columnIdentifier of preferredColumnOrder)
this.insertColumn(columnIdentifier,columnsData[columnIdentifier]);}else{for(var columnIdentifier in columnsData)
this.insertColumn(columnIdentifier,columnsData[columnIdentifier]);}
this._updateScrollbarPadding();this._copyTextDelimiter="\t";}
_updateScrollbarPadding()
{if(this._inline)
return;let scrollbarWidth=this._scrollContainerElement.offsetWidth-this._scrollContainerElement.scrollWidth;if(this._scrollbarWidth===scrollbarWidth)
return;if(WebInspector.resolvedLayoutDirection()===WebInspector.LayoutDirection.RTL)
this._headerWrapperElement.style.setProperty("padding-left",`${scrollbarWidth}px`);else
this._headerWrapperElement.style.setProperty("padding-right",`${scrollbarWidth}px`);this._scrollbarWidth=scrollbarWidth;}
static createSortableDataGrid(columnNames,values)
{var numColumns=columnNames.length;if(!numColumns)
return null;var columnsData={};for(var columnName of columnNames){columnsData[columnName]={width:columnName.length,title:columnName,sortable:true,};}
var dataGrid=new WebInspector.DataGrid(columnsData,undefined,undefined,columnNames);for(var i=0;i<values.length/numColumns;++i){var data={};for(var j=0;j<columnNames.length;++j)
data[columnNames[j]]=values[numColumns*i+j];var node=new WebInspector.DataGridNode(data,false);dataGrid.appendChild(node);}
function sortDataGrid()
{var sortColumnIdentifier=dataGrid.sortColumnIdentifier;var columnIsNumeric=true;for(var node of dataGrid.children){var value=dataGrid.textForDataGridNodeColumn(node,sortColumnIdentifier);if(isNaN(Number(value)))
columnIsNumeric=false;}
function comparator(dataGridNode1,dataGridNode2)
{var item1=dataGrid.textForDataGridNodeColumn(dataGridNode1,sortColumnIdentifier);var item2=dataGrid.textForDataGridNodeColumn(dataGridNode2,sortColumnIdentifier);var comparison;if(columnIsNumeric){var number1=parseFloat(item1);var number2=parseFloat(item2);comparison=number1<number2?-1:(number1>number2?1:0);}else
comparison=item1<item2?-1:(item1>item2?1:0);return comparison;}
dataGrid.sortNodes(comparator);}
dataGrid.addEventListener(WebInspector.DataGrid.Event.SortChanged,sortDataGrid,this);dataGrid.sortOrder=WebInspector.DataGrid.SortOrder.Ascending;dataGrid.sortColumnIdentifier=columnNames[0];return dataGrid;}
get headerVisible(){return this._headerVisible;}
set headerVisible(x)
{if(x===this._headerVisible)
return;this._headerVisible=x;this.element.classList.toggle("no-header",!this._headerVisible);}
get columnChooserEnabled(){return this._columnChooserEnabled;}
set columnChooserEnabled(x){this._columnChooserEnabled=x;}
get refreshCallback()
{return this._refreshCallback;}
set refreshCallback(refreshCallback)
{this._refreshCallback=refreshCallback;}
get sortOrder()
{return this._sortOrder;}
set sortOrder(order)
{if(!order||order===this._sortOrder)
return;this._sortOrder=order;if(this._sortOrderSetting)
this._sortOrderSetting.value=this._sortOrder;if(!this._sortColumnIdentifier)
return;var sortHeaderCellElement=this._headerTableCellElements.get(this._sortColumnIdentifier);sortHeaderCellElement.classList.toggle(WebInspector.DataGrid.SortColumnAscendingStyleClassName,this._sortOrder===WebInspector.DataGrid.SortOrder.Ascending);sortHeaderCellElement.classList.toggle(WebInspector.DataGrid.SortColumnDescendingStyleClassName,this._sortOrder===WebInspector.DataGrid.SortOrder.Descending);this.dispatchEventToListeners(WebInspector.DataGrid.Event.SortChanged);}
get sortColumnIdentifier()
{return this._sortColumnIdentifier;}
set sortColumnIdentifier(columnIdentifier)
{if(this._sortColumnIdentifier===columnIdentifier)
return;let oldSortColumnIdentifier=this._sortColumnIdentifier;this._sortColumnIdentifier=columnIdentifier;this._updateSortedColumn(oldSortColumnIdentifier);}
get inline(){return this._inline;}
set inline(x)
{if(this._inline===x)
return;this._inline=x||false;this._element.classList.toggle("inline",this._inline);this._updateScrollListeners();}
get variableHeightRows(){return this._variableHeightRows;}
set variableHeightRows(x)
{if(this._variableHeightRows===x)
return;this._variableHeightRows=x||false;this._element.classList.toggle("variable-height-rows",this._variableHeightRows);this._updateScrollListeners();}
get filterText(){return this._filterText;}
set filterText(x)
{if(this._filterText===x)
return;this._filterText=x;this.filterDidChange();}
get filterDelegate(){return this._filterDelegate;}
set filterDelegate(delegate)
{this._filterDelegate=delegate;this.filterDidChange();}
filterDidChange()
{if(this._scheduledFilterUpdateIdentifier)
return;if(this._applyFilterToNodesTask){this._applyFilterToNodesTask.cancel();this._applyFilterToNodesTask=null;}
this._scheduledFilterUpdateIdentifier=requestAnimationFrame(this._updateFilter.bind(this));}
hasFilters()
{return this._textFilterRegex||this._hasFilterDelegate();}
matchNodeAgainstCustomFilters(node)
{if(!this._hasFilterDelegate())
return true;return this._filterDelegate.dataGridMatchNodeAgainstCustomFilters(node);}
createSettings(identifier)
{if(this._settingsIdentifier===identifier)
return;this._settingsIdentifier=identifier;this._sortColumnIdentifierSetting=new WebInspector.Setting(this._settingsIdentifier+"-sort",this._sortColumnIdentifier);this._sortOrderSetting=new WebInspector.Setting(this._settingsIdentifier+"-sort-order",this._sortOrder);this._columnVisibilitySetting=new WebInspector.Setting(this._settingsIdentifier+"-column-visibility",{});if(!this.columns)
return;if(this._sortColumnIdentifierSetting.value){this.sortColumnIdentifier=this._sortColumnIdentifierSetting.value;this.sortOrder=this._sortOrderSetting.value;}
let visibilitySettings=this._columnVisibilitySetting.value;for(let columnIdentifier in visibilitySettings){let visible=visibilitySettings[columnIdentifier];this.setColumnVisible(columnIdentifier,visible);}}
_updateScrollListeners()
{if(this._inline||this._variableHeightRows){this._scrollContainerElement.removeEventListener("scroll",this._scrollListener);this._scrollContainerElement.removeEventListener("mousewheel",this._scrollListener);}else{this._scrollContainerElement.addEventListener("scroll",this._scrollListener);this._scrollContainerElement.addEventListener("mousewheel",this._scrollListener);}}
_applyFiltersToNodeAndDispatchEvent(node)
{const nodeWasHidden=node.hidden;this._applyFiltersToNode(node);if(nodeWasHidden!==node.hidden)
this.dispatchEventToListeners(WebInspector.DataGrid.Event.NodeWasFiltered,{node});return nodeWasHidden!==node.hidden;}
_applyFiltersToNode(node)
{if(!this.hasFilters()){node.hidden=false;if(node.expanded&&node[WebInspector.DataGrid.WasExpandedDuringFilteringSymbol]){node[WebInspector.DataGrid.WasExpandedDuringFilteringSymbol]=false;node.collapse();}
return;}
let filterableData=node.filterableData||[];let flags={expandNode:false};let filterRegex=this._textFilterRegex;function matchTextFilter()
{if(!filterableData.length||!filterRegex)
return true;if(filterableData.some((value)=>filterRegex.test(value))){flags.expandNode=true;return true;}
return false;}
function makeVisible()
{node.hidden=false;let currentAncestor=node.parent;while(currentAncestor&&!currentAncestor.root){currentAncestor.hidden=false;if(flags.expandNode&&!currentAncestor.expanded){currentAncestor[WebInspector.DataGrid.WasExpandedDuringFilteringSymbol]=true;currentAncestor.expand();}
currentAncestor=currentAncestor.parent;}}
if(matchTextFilter()&&this.matchNodeAgainstCustomFilters(node)){makeVisible();if(!flags.expandNode&&node.expanded&&node[WebInspector.DataGrid.WasExpandedDuringFilteringSymbol]){node[WebInspector.DataGrid.WasExpandedDuringFilteringSymbol]=false;node.collapse();}
return;}
node.hidden=true;}
_updateSortedColumn(oldSortColumnIdentifier)
{if(this._sortColumnIdentifierSetting)
this._sortColumnIdentifierSetting.value=this._sortColumnIdentifier;if(oldSortColumnIdentifier){let oldSortHeaderCellElement=this._headerTableCellElements.get(oldSortColumnIdentifier);oldSortHeaderCellElement.classList.remove(WebInspector.DataGrid.SortColumnAscendingStyleClassName);oldSortHeaderCellElement.classList.remove(WebInspector.DataGrid.SortColumnDescendingStyleClassName);}
if(this._sortColumnIdentifier){let newSortHeaderCellElement=this._headerTableCellElements.get(this._sortColumnIdentifier);newSortHeaderCellElement.classList.toggle(WebInspector.DataGrid.SortColumnAscendingStyleClassName,this._sortOrder===WebInspector.DataGrid.SortOrder.Ascending);newSortHeaderCellElement.classList.toggle(WebInspector.DataGrid.SortColumnDescendingStyleClassName,this._sortOrder===WebInspector.DataGrid.SortOrder.Descending);}
this.dispatchEventToListeners(WebInspector.DataGrid.Event.SortChanged);}
_hasFilterDelegate()
{return this._filterDelegate&&typeof this._filterDelegate.dataGridMatchNodeAgainstCustomFilters==="function";}
_ondblclick(event)
{if(this._editing||this._editingNode)
return;this._startEditing(event.target);}
_startEditingNodeAtColumnIndex(node,columnIndex)
{this._editing=true;this._editingNode=node;this._editingNode.select();var element=this._editingNode._element.children[columnIndex];WebInspector.startEditing(element,this._startEditingConfig(element));window.getSelection().setBaseAndExtent(element,0,element,1);}
_startEditing(target)
{var element=target.enclosingNodeOrSelfWithNodeName("td");if(!element)
return;this._editingNode=this.dataGridNodeFromNode(target);if(!this._editingNode){if(!this.placeholderNode)
return;this._editingNode=this.placeholderNode;}
if(this._editingNode.isPlaceholderNode)
return this._startEditingNodeAtColumnIndex(this._editingNode,0);this._editing=true;WebInspector.startEditing(element,this._startEditingConfig(element));window.getSelection().setBaseAndExtent(element,0,element,1);}
_startEditingConfig(element)
{return new WebInspector.EditingConfig(this._editingCommitted.bind(this),this._editingCancelled.bind(this),element.textContent);}
_editingCommitted(element,newText,oldText,context,moveDirection)
{var columnIdentifier=element.__columnIdentifier;var columnIndex=this.orderedColumns.indexOf(columnIdentifier);var textBeforeEditing=this._editingNode.data[columnIdentifier]||"";var currentEditingNode=this._editingNode;
function determineNextCell(valueDidChange){if(moveDirection==="forward"){if(columnIndex<this.orderedColumns.length-1)
return{shouldSort:false,editingNode:currentEditingNode,columnIndex:columnIndex+1};var nextDataGridNode=currentEditingNode.traverseNextNode(true,null,true);return{shouldSort:true,editingNode:nextDataGridNode||currentEditingNode,columnIndex:0};}
if(moveDirection==="backward"){if(columnIndex>0)
return{shouldSort:false,editingNode:currentEditingNode,columnIndex:columnIndex-1};var previousDataGridNode=currentEditingNode.traversePreviousNode(true,null,true);return{shouldSort:true,editingNode:previousDataGridNode||currentEditingNode,columnIndex:this.orderedColumns.length-1};}
return{shouldSort:true};}
function moveToNextCell(valueDidChange){var moveCommand=determineNextCell.call(this,valueDidChange);if(moveCommand.shouldSort&&this._sortAfterEditingCallback){this._sortAfterEditingCallback();this._sortAfterEditingCallback=null;}
if(moveCommand.editingNode)
this._startEditingNodeAtColumnIndex(moveCommand.editingNode,moveCommand.columnIndex);}
this._editingCancelled(element);currentEditingNode.data[columnIdentifier]=newText.trim();this._editCallback(currentEditingNode,columnIdentifier,textBeforeEditing,newText,moveDirection);var textDidChange=textBeforeEditing.trim()!==newText.trim();moveToNextCell.call(this,textDidChange);}
_editingCancelled(element)
{this._editingNode.refresh();this._editing=false;this._editingNode=null;}
autoSizeColumns(minPercent,maxPercent,maxDescentLevel)
{if(minPercent)
minPercent=Math.min(minPercent,Math.floor(100/this.orderedColumns.length));var widths={};for(var[identifier,column]of this.columns)
widths[identifier]=(column["title"]||"").length;var children=maxDescentLevel?this._enumerateChildren(this,[],maxDescentLevel+1):this.children;for(var node of children){for(var identifier of this.columns.keys()){var text=this.textForDataGridNodeColumn(node,identifier);if(text.length>widths[identifier])
widths[identifier]=text.length;}}
var totalColumnWidths=0;for(var identifier of this.columns.keys())
totalColumnWidths+=widths[identifier];var recoupPercent=0;for(var identifier of this.columns.keys()){var width=Math.round(100*widths[identifier]/totalColumnWidths);if(minPercent&&width<minPercent){recoupPercent+=(minPercent-width);width=minPercent;}else if(maxPercent&&width>maxPercent){recoupPercent-=(width-maxPercent);width=maxPercent;}
widths[identifier]=width;}
while(minPercent&&recoupPercent>0){for(var identifier of this.columns.keys()){if(widths[identifier]>minPercent){--widths[identifier];--recoupPercent;if(!recoupPercent)
break;}}}
while(maxPercent&&recoupPercent<0){for(var identifier of this.columns.keys()){if(widths[identifier]<maxPercent){++widths[identifier];++recoupPercent;if(!recoupPercent)
break;}}}
for(var[identifier,column]of this.columns){column["element"].style.width=widths[identifier]+"%";column["bodyElement"].style.width=widths[identifier]+"%";}
this._columnWidthsInitialized=false;this.needsLayout();}
insertColumn(columnIdentifier,columnData,insertionIndex)
{if(insertionIndex===undefined)
insertionIndex=this.orderedColumns.length;insertionIndex=Number.constrain(insertionIndex,0,this.orderedColumns.length);var listeners=new WebInspector.EventListenerSet(this,"DataGrid column DOM listeners");var column=Object.shallowCopy(columnData);column["listeners"]=listeners;column["ordinal"]=insertionIndex;column["columnIdentifier"]=columnIdentifier;this.orderedColumns.splice(insertionIndex,0,columnIdentifier);for(var[identifier,existingColumn]of this.columns){var ordinal=existingColumn["ordinal"];if(ordinal>=insertionIndex)
existingColumn["ordinal"]=ordinal+1;}
this.columns.set(columnIdentifier,column);if(column["disclosure"])
this.disclosureColumnIdentifier=columnIdentifier;var headerColumnElement=document.createElement("col");if(column["width"])
headerColumnElement.style.width=column["width"];column["element"]=headerColumnElement;var referenceElement=this._headerTableColumnGroupElement.children[insertionIndex];this._headerTableColumnGroupElement.insertBefore(headerColumnElement,referenceElement);var headerCellElement=document.createElement("th");headerCellElement.className=columnIdentifier+"-column";headerCellElement.columnIdentifier=columnIdentifier;if(column["aligned"])
headerCellElement.classList.add(column["aligned"]);this._headerTableCellElements.set(columnIdentifier,headerCellElement);var referenceElement=this._headerTableRowElement.children[insertionIndex];this._headerTableRowElement.insertBefore(headerCellElement,referenceElement);if(column["headerView"]){let headerView=column["headerView"];headerCellElement.appendChild(headerView.element);this.addSubview(headerView);}else{let titleElement=headerCellElement.createChild("div");if(column["titleDOMFragment"])
titleElement.appendChild(column["titleDOMFragment"]);else
titleElement.textContent=column["title"]||"";}
if(column["sortable"]){listeners.register(headerCellElement,"click",this._headerCellClicked);headerCellElement.classList.add(WebInspector.DataGrid.SortableColumnStyleClassName);}
if(column["group"])
headerCellElement.classList.add("column-group-"+column["group"]);if(column["tooltip"])
headerCellElement.title=column["tooltip"];if(column["collapsesGroup"]){headerCellElement.createChild("div","divider");var collapseDiv=headerCellElement.createChild("div","collapser-button");collapseDiv.title=this._collapserButtonCollapseColumnsToolTip();listeners.register(collapseDiv,"mouseover",this._mouseoverColumnCollapser);listeners.register(collapseDiv,"mouseout",this._mouseoutColumnCollapser);listeners.register(collapseDiv,"click",this._clickInColumnCollapser);headerCellElement.collapsesGroup=column["collapsesGroup"];headerCellElement.classList.add("collapser");}
this._headerTableColumnGroupElement.span=this.orderedColumns.length;var dataColumnElement=headerColumnElement.cloneNode();var referenceElement=this._dataTableColumnGroupElement.children[insertionIndex];this._dataTableColumnGroupElement.insertBefore(dataColumnElement,referenceElement);column["bodyElement"]=dataColumnElement;var fillerCellElement=document.createElement("td");fillerCellElement.className=columnIdentifier+"-column";fillerCellElement.__columnIdentifier=columnIdentifier;if(column["group"])
fillerCellElement.classList.add("column-group-"+column["group"]);var referenceElement=this._fillerRowElement.children[insertionIndex];this._fillerRowElement.insertBefore(fillerCellElement,referenceElement);listeners.install();this.setColumnVisible(columnIdentifier,!column.hidden);}
removeColumn(columnIdentifier)
{var removedColumn=this.columns.get(columnIdentifier);this.columns.delete(columnIdentifier);this.orderedColumns.splice(this.orderedColumns.indexOf(columnIdentifier),1);var removedOrdinal=removedColumn["ordinal"];for(var[identifier,column]of this.columns){var ordinal=column["ordinal"];if(ordinal>removedOrdinal)
column["ordinal"]=ordinal-1;}
removedColumn["listeners"].uninstall(true);if(removedColumn["disclosure"])
this.disclosureColumnIdentifier=undefined;if(this.sortColumnIdentifier===columnIdentifier)
this.sortColumnIdentifier=null;this._headerTableCellElements.delete(columnIdentifier);this._headerTableRowElement.children[removedOrdinal].remove();this._headerTableColumnGroupElement.children[removedOrdinal].remove();this._dataTableColumnGroupElement.children[removedOrdinal].remove();this._fillerRowElement.children[removedOrdinal].remove();this._headerTableColumnGroupElement.span=this.orderedColumns.length;for(var child of this.children)
child.refresh();}
_enumerateChildren(rootNode,result,maxLevel)
{if(!rootNode.root)
result.push(rootNode);if(!maxLevel)
return;for(var i=0;i<rootNode.children.length;++i)
this._enumerateChildren(rootNode.children[i],result,maxLevel-1);return result;}
layout()
{if(!this._columnWidthsInitialized&&this.element.offsetWidth){
let headerTableColumnElements=this._headerTableColumnGroupElement.children;let tableWidth=this._dataTableElement.offsetWidth;let numColumns=headerTableColumnElements.length;let cells=this._headerTableBodyElement.rows[0].cells;let columnWidths=[];for(let i=0;i<numColumns;++i){let headerCellElement=cells[i];if(this._isColumnVisible(headerCellElement.columnIdentifier)){let columnWidth=headerCellElement.offsetWidth;let percentWidth=((columnWidth/tableWidth)*100)+"%";columnWidths.push(percentWidth);}else
columnWidths.push(0);}
for(let i=0;i<numColumns;i++){let percentWidth=columnWidths[i];this._headerTableColumnGroupElement.children[i].style.width=percentWidth;this._dataTableColumnGroupElement.children[i].style.width=percentWidth;}
this._columnWidthsInitialized=true;this._updateHeaderAndScrollbar();}
this._updateVisibleRows();}
sizeDidChange()
{this._updateHeaderAndScrollbar();}
_updateHeaderAndScrollbar()
{this._positionResizerElements();this._positionHeaderViews();this._updateScrollbarPadding();this._cachedScrollTop=NaN;this._cachedScrollableOffsetHeight=NaN;}
columnWidthsMap()
{var result={};for(var[identifier,column]of this.columns){var width=this._headerTableColumnGroupElement.children[column["ordinal"]].style.width;result[identifier]=parseFloat(width);}
return result;}
applyColumnWidthsMap(columnWidthsMap)
{for(var[identifier,column]of this.columns){var width=(columnWidthsMap[identifier]||0)+"%";var ordinal=column["ordinal"];this._headerTableColumnGroupElement.children[ordinal].style.width=width;this._dataTableColumnGroupElement.children[ordinal].style.width=width;}
this.needsLayout();}
_isColumnVisible(columnIdentifier)
{return!this.columns.get(columnIdentifier)["hidden"];}
setColumnVisible(columnIdentifier,visible)
{let column=this.columns.get(columnIdentifier);if(!column||visible===!column.hidden)
return;column.element.style.width=visible?column.width:0;column.hidden=!visible;if(this._columnVisibilitySetting){if(this._columnVisibilitySetting.value[columnIdentifier]!==visible){let copy=Object.shallowCopy(this._columnVisibilitySetting.value);copy[columnIdentifier]=visible;this._columnVisibilitySetting.value=copy;}}
this._columnWidthsInitialized=false;this.updateLayout();}
get scrollContainer()
{return this._scrollContainerElement;}
isScrolledToLastRow()
{return this._scrollContainerElement.isScrolledToBottom();}
scrollToLastRow()
{this._scrollContainerElement.scrollTop=this._scrollContainerElement.scrollHeight-this._scrollContainerElement.offsetHeight;}
_positionResizerElements()
{let leadingOffset=0;var previousResizer=null;var numResizers=this.orderedColumns.length-1;
var cells=this._headerTableBodyElement.rows[0].cells;var columnWidths=[];for(var i=0;i<numResizers;++i){leadingOffset+=cells[i].getBoundingClientRect().width;columnWidths.push(leadingOffset);}
for(var i=0;i<numResizers;++i){var resizer=this.resizers[i];if(!resizer){resizer=this.resizers[i]=new WebInspector.Resizer(WebInspector.Resizer.RuleOrientation.Vertical,this);this.element.appendChild(resizer.element);}
leadingOffset=columnWidths[i];if(this._isColumnVisible(this.orderedColumns[i])){resizer.element.style.removeProperty("display");resizer.element.style.setProperty(WebInspector.resolvedLayoutDirection()===WebInspector.LayoutDirection.RTL?"right":"left",`${leadingOffset}px`);resizer[WebInspector.DataGrid.PreviousColumnOrdinalSymbol]=i;if(previousResizer)
previousResizer[WebInspector.DataGrid.NextColumnOrdinalSymbol]=i;previousResizer=resizer;}else{resizer.element.style.setProperty("display","none");resizer[WebInspector.DataGrid.PreviousColumnOrdinalSymbol]=0;resizer[WebInspector.DataGrid.NextColumnOrdinalSymbol]=0;}}
if(previousResizer)
previousResizer[WebInspector.DataGrid.NextColumnOrdinalSymbol]=this.orderedColumns.length-1;}
_positionHeaderViews()
{let leadingOffset=0;let headerViews=[];let offsets=[];let columnWidths=[];for(let columnIdentifier of this.orderedColumns){let column=this.columns.get(columnIdentifier);if(!column)
continue;let columnWidth=this._headerTableCellElements.get(columnIdentifier).offsetWidth;let headerView=column["headerView"];if(headerView){headerViews.push(headerView);offsets.push(leadingOffset);columnWidths.push(columnWidth);}
leadingOffset+=columnWidth;}
for(let i=0;i<headerViews.length;++i){let headerView=headerViews[i];headerView.element.style.setProperty(WebInspector.resolvedLayoutDirection()===WebInspector.LayoutDirection.RTL?"right":"left",`${offsets[i]}px`);headerView.element.style.width=columnWidths[i]+"px";headerView.updateLayout(WebInspector.View.LayoutReason.Resize);}}
_noteRowsChanged()
{this._previousRevealedRowCount=NaN;this.needsLayout();}
_noteRowRemoved(dataGridNode)
{if(this._inline||this._variableHeightRows){
if(dataGridNode.element&&dataGridNode.element.parentNode)
dataGridNode.element.parentNode.removeChild(dataGridNode.element);return;}
this._noteRowsChanged();}
_noteScrollPositionChanged()
{this._cachedScrollTop=NaN;this.needsLayout();}
_updateVisibleRows()
{if(this._inline||this._variableHeightRows){
let nextElement=this.dataTableBodyElement.lastChild;for(let i=this._rows.length-1;i>=0;--i){let rowElement=this._rows[i].element;if(rowElement.nextSibling!==nextElement)
this.dataTableBodyElement.insertBefore(rowElement,nextElement);nextElement=rowElement;}
return;}
let rowHeight=this.rowHeight;let updateOffsetThreshold=rowHeight*5;let overflowPadding=updateOffsetThreshold*3;if(isNaN(this._cachedScrollTop))
this._cachedScrollTop=this._scrollContainerElement.scrollTop;if(isNaN(this._cachedScrollableOffsetHeight))
this._cachedScrollableOffsetHeight=this._scrollContainerElement.offsetHeight;let scrollTop=this._cachedScrollTop;let scrollableOffsetHeight=this._cachedScrollableOffsetHeight;let visibleRowCount=Math.ceil((scrollableOffsetHeight+(overflowPadding*2))/rowHeight);let currentTopMargin=this._topDataTableMarginHeight;let currentBottomMargin=this._bottomDataTableMarginHeight;let currentTableBottom=currentTopMargin+(visibleRowCount*rowHeight);let belowTopThreshold=!currentTopMargin||scrollTop>currentTopMargin+updateOffsetThreshold;let aboveBottomThreshold=!currentBottomMargin||scrollTop+scrollableOffsetHeight<currentTableBottom-updateOffsetThreshold;if(belowTopThreshold&&aboveBottomThreshold&&!isNaN(this._previousRevealedRowCount))
return;let revealedRows=this._rows.filter((row)=>row.revealed&&!row.hidden);this._previousRevealedRowCount=revealedRows.length;let topHiddenRowCount=Math.max(0,Math.floor((scrollTop-overflowPadding)/rowHeight));let bottomHiddenRowCount=Math.max(0,this._previousRevealedRowCount-topHiddenRowCount-visibleRowCount);let marginTop=topHiddenRowCount*rowHeight;let marginBottom=bottomHiddenRowCount*rowHeight;if(this._topDataTableMarginHeight!==marginTop){this._topDataTableMarginHeight=marginTop;this._topDataTableMarginElement.style.height=marginTop+"px";}
if(this._bottomDataTableMarginElement!==marginBottom){this._bottomDataTableMarginHeight=marginBottom;this._bottomDataTableMarginElement.style.height=marginBottom+"px";}
this._dataTableElement.classList.toggle("odd-first-zebra-stripe",!!(topHiddenRowCount%2));this.dataTableBodyElement.removeChildren();for(let i=topHiddenRowCount;i<topHiddenRowCount+visibleRowCount;++i){let rowDataGridNode=revealedRows[i];if(!rowDataGridNode)
continue;this.dataTableBodyElement.appendChild(rowDataGridNode.element);}
this.dataTableBodyElement.appendChild(this._fillerRowElement);}
addPlaceholderNode()
{if(this.placeholderNode)
this.placeholderNode.makeNormal();var emptyData={};for(var identifier of this.columns.keys())
emptyData[identifier]="";this.placeholderNode=new WebInspector.PlaceholderDataGridNode(emptyData);this.appendChild(this.placeholderNode);}
appendChild(child)
{this.insertChild(child,this.children.length);}
insertChild(child,index)
{if(!child)
return;if(child.parent===this)
return;if(child.parent)
child.parent.removeChild(child);this.children.splice(index,0,child);this.hasChildren=true;child.parent=this;child.dataGrid=this.dataGrid;child._recalculateSiblings(index);delete child._depth;delete child._revealed;delete child._attached;delete child._leftPadding;child._shouldRefreshChildren=true;var current=child.children[0];while(current){current.dataGrid=this.dataGrid;delete current._depth;delete current._revealed;delete current._attached;delete current._leftPadding;current._shouldRefreshChildren=true;current=current.traverseNextNode(false,child,true);}
if(this.expanded)
child._attach();if(!this.dataGrid.hasFilters())
return;this.dataGrid._applyFiltersToNodeAndDispatchEvent(child);}
removeChild(child)
{if(!child)
return;if(child.parent!==this)
return;child.deselect();child._detach();this.children.remove(child,true);if(child.previousSibling)
child.previousSibling.nextSibling=child.nextSibling;if(child.nextSibling)
child.nextSibling.previousSibling=child.previousSibling;child.dataGrid=null;child.parent=null;child.nextSibling=null;child.previousSibling=null;if(this.children.length<=0)
this.hasChildren=false;}
removeChildren()
{for(var i=0;i<this.children.length;++i){var child=this.children[i];child.deselect();child._detach();child.dataGrid=null;child.parent=null;child.nextSibling=null;child.previousSibling=null;}
this.children=[];this.hasChildren=false;}
removeChildrenRecursive()
{var childrenToRemove=this.children;var child=this.children[0];while(child){if(child.children.length)
childrenToRemove=childrenToRemove.concat(child.children);child=child.traverseNextNode(false,this,true);}
for(var i=0;i<childrenToRemove.length;++i){child=childrenToRemove[i];child.deselect();child._detach();child.children=[];child.dataGrid=null;child.parent=null;child.nextSibling=null;child.previousSibling=null;}
this.children=[];}
findNode(comparator,skipHidden,stayWithin,dontPopulate)
{let currentNode=this._rows[0];while(currentNode&&!currentNode.root){if(!currentNode.isPlaceholderNode&&!(skipHidden&&currentNode.hidden)){if(comparator(currentNode))
return currentNode;}
currentNode=currentNode.traverseNextNode(skipHidden,stayWithin,dontPopulate);}
return null;}
sortNodes(comparator)
{if(this._sortNodesRequestId)
return;this._sortNodesRequestId=window.requestAnimationFrame(this._sortNodesCallback.bind(this,comparator));}
sortNodesImmediately(comparator)
{this._sortNodesCallback(comparator);}
_sortNodesCallback(comparator)
{function comparatorWrapper(aNode,bNode)
{if(aNode.isPlaceholderNode)
return 1;if(bNode.isPlaceholderNode)
return-1;var reverseFactor=this.sortOrder!==WebInspector.DataGrid.SortOrder.Ascending?-1:1;return reverseFactor*comparator(aNode,bNode);}
this._sortNodesRequestId=undefined;if(this._editing){this._sortAfterEditingCallback=this.sortNodes.bind(this,comparator);return;}
this._rows.sort(comparatorWrapper.bind(this));this._noteRowsChanged();let previousSiblingNode=null;for(let node of this._rows){node.previousSibling=previousSiblingNode;if(previousSiblingNode)
previousSiblingNode.nextSibling=node;previousSiblingNode=node;}
if(previousSiblingNode)
previousSiblingNode.nextSibling=null;if(!this.parentView)
this.updateLayoutIfNeeded();}
_toggledSortOrder()
{return this._sortOrder!==WebInspector.DataGrid.SortOrder.Descending?WebInspector.DataGrid.SortOrder.Descending:WebInspector.DataGrid.SortOrder.Ascending;}
_selectSortColumnAndSetOrder(columnIdentifier,sortOrder)
{this.sortColumnIdentifier=columnIdentifier;this.sortOrder=sortOrder;}
_keyDown(event)
{if(!this.selectedNode||event.shiftKey||event.metaKey||event.ctrlKey||this._editing)
return;let isRTL=WebInspector.resolvedLayoutDirection()===WebInspector.LayoutDirection.RTL;var handled=false;var nextSelectedNode;if(event.keyIdentifier==="Up"&&!event.altKey){nextSelectedNode=this.selectedNode.traversePreviousNode(true);while(nextSelectedNode&&!nextSelectedNode.selectable)
nextSelectedNode=nextSelectedNode.traversePreviousNode(true);handled=nextSelectedNode?true:false;}else if(event.keyIdentifier==="Down"&&!event.altKey){nextSelectedNode=this.selectedNode.traverseNextNode(true);while(nextSelectedNode&&!nextSelectedNode.selectable)
nextSelectedNode=nextSelectedNode.traverseNextNode(true);handled=nextSelectedNode?true:false;}else if((!isRTL&&event.keyIdentifier==="Left")||(isRTL&&event.keyIdentifier==="Right")){if(this.selectedNode.expanded){if(event.altKey)
this.selectedNode.collapseRecursively();else
this.selectedNode.collapse();handled=true;}else if(this.selectedNode.parent&&!this.selectedNode.parent.root){handled=true;if(this.selectedNode.parent.selectable){nextSelectedNode=this.selectedNode.parent;handled=nextSelectedNode?true:false;}else if(this.selectedNode.parent)
this.selectedNode.parent.collapse();}}else if((!isRTL&&event.keyIdentifier==="Right")||(isRTL&&event.keyIdentifier==="Left")){if(!this.selectedNode.revealed){this.selectedNode.reveal();handled=true;}else if(this.selectedNode.hasChildren){handled=true;if(this.selectedNode.expanded){nextSelectedNode=this.selectedNode.children[0];handled=nextSelectedNode?true:false;}else{if(event.altKey)
this.selectedNode.expandRecursively();else
this.selectedNode.expand();}}}else if(event.keyCode===8||event.keyCode===46){if(this._deleteCallback){handled=true;this._deleteCallback(this.selectedNode);}}else if(isEnterKey(event)){if(this._editCallback){handled=true;this._startEditing(this.selectedNode._element.children[0]);}}
if(nextSelectedNode){nextSelectedNode.reveal();nextSelectedNode.select();}
if(handled){event.preventDefault();event.stopPropagation();}}
closed()
{}
expand()
{}
collapse()
{}
reveal()
{}
revealAndSelect()
{}
dataGridNodeFromNode(target)
{var rowElement=target.enclosingNodeOrSelfWithNodeName("tr");return rowElement&&rowElement._dataGridNode;}
dataGridNodeFromPoint(x,y)
{var node=this._dataTableElement.ownerDocument.elementFromPoint(x,y);var rowElement=node.enclosingNodeOrSelfWithNodeName("tr");return rowElement&&rowElement._dataGridNode;}
_headerCellClicked(event)
{let cell=event.target.enclosingNodeOrSelfWithNodeName("th");if(!cell||!cell.columnIdentifier||!cell.classList.contains(WebInspector.DataGrid.SortableColumnStyleClassName))
return;let sortOrder=this._sortColumnIdentifier===cell.columnIdentifier?this._toggledSortOrder():this.sortOrder;this._selectSortColumnAndSetOrder(cell.columnIdentifier,sortOrder);}
_mouseoverColumnCollapser(event)
{var cell=event.target.enclosingNodeOrSelfWithNodeName("th");if(!cell||!cell.collapsesGroup)
return;cell.classList.add("mouse-over-collapser");}
_mouseoutColumnCollapser(event)
{var cell=event.target.enclosingNodeOrSelfWithNodeName("th");if(!cell||!cell.collapsesGroup)
return;cell.classList.remove("mouse-over-collapser");}
_clickInColumnCollapser(event)
{var cell=event.target.enclosingNodeOrSelfWithNodeName("th");if(!cell||!cell.collapsesGroup)
return;this._collapseColumnGroupWithCell(cell);event.stopPropagation();event.preventDefault();}
collapseColumnGroup(columnGroup)
{var collapserColumnIdentifier=null;for(var[identifier,column]of this.columns){if(column["collapsesGroup"]===columnGroup){collapserColumnIdentifier=identifier;break;}}
if(!collapserColumnIdentifier)
return;var cell=this._headerTableCellElements.get(collapserColumnIdentifier);this._collapseColumnGroupWithCell(cell);}
_collapseColumnGroupWithCell(cell)
{var columnsWillCollapse=cell.classList.toggle("collapsed");this.willToggleColumnGroup(cell.collapsesGroup,columnsWillCollapse);for(var[identifier,column]of this.columns){if(column["group"]===cell.collapsesGroup)
this.setColumnVisible(identifier,!columnsWillCollapse);}
var collapserButton=cell.querySelector(".collapser-button");if(collapserButton)
collapserButton.title=columnsWillCollapse?this._collapserButtonExpandColumnsToolTip():this._collapserButtonCollapseColumnsToolTip();this.didToggleColumnGroup(cell.collapsesGroup,columnsWillCollapse);}
_collapserButtonCollapseColumnsToolTip()
{return WebInspector.UIString("Collapse columns");}
_collapserButtonExpandColumnsToolTip()
{return WebInspector.UIString("Expand columns");}
willToggleColumnGroup(columnGroup,willCollapse)
{}
didToggleColumnGroup(columnGroup,didCollapse)
{}
headerTableHeader(columnIdentifier)
{return this._headerTableCellElements.get(columnIdentifier);}
_mouseDownInDataTable(event)
{var gridNode=this.dataGridNodeFromNode(event.target);if(!gridNode||!gridNode.selectable)
return;if(gridNode.isEventWithinDisclosureTriangle(event))
return;if(event.metaKey){if(gridNode.selected)
gridNode.deselect();else
gridNode.select();}else
gridNode.select();}
_contextMenuInHeader(event)
{let contextMenu=WebInspector.ContextMenu.createFromEvent(event);if(this._hasCopyableData())
contextMenu.appendItem(WebInspector.UIString("Copy Table"),this._copyTable.bind(this));let headerCellElement=event.target.enclosingNodeOrSelfWithNodeName("th");if(!headerCellElement)
return;let columnIdentifier=headerCellElement.columnIdentifier;let column=this.columns.get(columnIdentifier);if(!column)
return;if(column.sortable){contextMenu.appendSeparator();if(this.sortColumnIdentifier!==columnIdentifier||this.sortOrder!==WebInspector.DataGrid.SortOrder.Ascending){contextMenu.appendItem(WebInspector.UIString("Sort Ascending"),()=>{this._selectSortColumnAndSetOrder(columnIdentifier,WebInspector.DataGrid.SortOrder.Ascending);});}
if(this.sortColumnIdentifier!==columnIdentifier||this.sortOrder!==WebInspector.DataGrid.SortOrder.Descending){contextMenu.appendItem(WebInspector.UIString("Sort Descending"),()=>{this._selectSortColumnAndSetOrder(columnIdentifier,WebInspector.DataGrid.SortOrder.Descending);});}}
if(this._columnChooserEnabled){let didAddSeparator=false;for(let[identifier,columnInfo]of this.columns){if(columnInfo.locked)
continue;if(!didAddSeparator){contextMenu.appendSeparator();didAddSeparator=true;}
contextMenu.appendCheckboxItem(columnInfo.title,()=>{this.setColumnVisible(identifier,!!columnInfo.hidden);},!columnInfo.hidden);}}}
_contextMenuInDataTable(event)
{let contextMenu=WebInspector.ContextMenu.createFromEvent(event);let gridNode=this.dataGridNodeFromNode(event.target);if(gridNode)
gridNode.appendContextMenuItems(contextMenu);if(this.dataGrid._refreshCallback&&(!gridNode||gridNode!==this.placeholderNode))
contextMenu.appendItem(WebInspector.UIString("Refresh"),this._refreshCallback.bind(this));if(gridNode){if(gridNode.selectable&&gridNode.copyable&&!gridNode.isEventWithinDisclosureTriangle(event)){contextMenu.appendItem(WebInspector.UIString("Copy Row"),this._copyRow.bind(this,event.target));contextMenu.appendItem(WebInspector.UIString("Copy Table"),this._copyTable.bind(this));if(this.dataGrid._editCallback){if(gridNode===this.placeholderNode)
contextMenu.appendItem(WebInspector.UIString("Add New"),this._startEditing.bind(this,event.target));else{let element=event.target.enclosingNodeOrSelfWithNodeName("td");let columnIdentifier=element.__columnIdentifier;let columnTitle=this.dataGrid.columns.get(columnIdentifier)["title"];contextMenu.appendItem(WebInspector.UIString("Edit “%s”").format(columnTitle),this._startEditing.bind(this,event.target));}}
if(this.dataGrid._deleteCallback&&gridNode!==this.placeholderNode)
contextMenu.appendItem(WebInspector.UIString("Delete"),this._deleteCallback.bind(this,gridNode));}
if(gridNode.children.some((child)=>child.hasChildren)||(gridNode.hasChildren&&!gridNode.children.length)){contextMenu.appendSeparator();contextMenu.appendItem(WebInspector.UIString("Expand All"),gridNode.expandRecursively.bind(gridNode));contextMenu.appendItem(WebInspector.UIString("Collapse All"),gridNode.collapseRecursively.bind(gridNode));}}}
_clickInDataTable(event)
{var gridNode=this.dataGridNodeFromNode(event.target);if(!gridNode||!gridNode.hasChildren)
return;if(!gridNode.isEventWithinDisclosureTriangle(event))
return;if(gridNode.expanded){if(event.altKey)
gridNode.collapseRecursively();else
gridNode.collapse();}else{if(event.altKey)
gridNode.expandRecursively();else
gridNode.expand();}}
textForDataGridNodeColumn(node,columnIdentifier)
{var data=node.data[columnIdentifier];return(data instanceof Node?data.textContent:data)||"";}
set copyTextDelimiter(value){this._copyTextDelimiter=value;}
_copyTextForDataGridNode(node)
{let fields=node.dataGrid.orderedColumns.map((identifier)=>this.textForDataGridNodeColumn(node,identifier));return fields.join(this._copyTextDelimiter);}
_copyTextForDataGridHeaders()
{let fields=this.orderedColumns.map((identifier)=>this.headerTableHeader(identifier).textContent);return fields.join(this._copyTextDelimiter);}
handleBeforeCopyEvent(event)
{if(this.selectedNode&&window.getSelection().isCollapsed)
event.preventDefault();}
handleCopyEvent(event)
{if(!this.selectedNode||!window.getSelection().isCollapsed)
return;var copyText=this._copyTextForDataGridNode(this.selectedNode);event.clipboardData.setData("text/plain",copyText);event.stopPropagation();event.preventDefault();}
_copyRow(target)
{var gridNode=this.dataGridNodeFromNode(target);if(!gridNode)
return;var copyText=this._copyTextForDataGridNode(gridNode);InspectorFrontendHost.copyText(copyText);}
_copyTable()
{let copyData=[];copyData.push(this._copyTextForDataGridHeaders());for(let gridNode of this.children){if(!gridNode.copyable)
continue;copyData.push(this._copyTextForDataGridNode(gridNode));}
InspectorFrontendHost.copyText(copyData.join("\n"));}
_hasCopyableData()
{let gridNode=this.children[0];return gridNode&&gridNode.selectable&&gridNode.copyable;}
get resizeMethod()
{if(!this._resizeMethod)
return WebInspector.DataGrid.ResizeMethod.Nearest;return this._resizeMethod;}
set resizeMethod(method)
{this._resizeMethod=method;}
resizerDragStarted(resizer)
{if(!resizer[WebInspector.DataGrid.NextColumnOrdinalSymbol])
return true;this._currentResizer=resizer;}
resizerDragging(resizer,positionDelta)
{if(resizer!==this._currentResizer)
return;let isRTL=WebInspector.resolvedLayoutDirection()===WebInspector.LayoutDirection.RTL;if(isRTL)
positionDelta*=-1;let dragPoint=0;if(isRTL)
dragPoint+=this.element.totalOffsetRight-resizer.initialPosition-positionDelta;else
dragPoint+=resizer.initialPosition-this.element.totalOffsetLeft-positionDelta;
var leftColumnIndex=resizer[WebInspector.DataGrid.PreviousColumnOrdinalSymbol];var rightColumnIndex=resizer[WebInspector.DataGrid.NextColumnOrdinalSymbol];var firstRowCells=this._headerTableBodyElement.rows[0].cells;let leadingEdgeOfPreviousColumn=0;for(let i=0;i<leftColumnIndex;++i)
leadingEdgeOfPreviousColumn+=firstRowCells[i].offsetWidth; if(this.resizeMethod===WebInspector.DataGrid.ResizeMethod.Last){rightColumnIndex=this.resizers.length;}else if(this.resizeMethod===WebInspector.DataGrid.ResizeMethod.First){leadingEdgeOfPreviousColumn+=firstRowCells[leftColumnIndex].offsetWidth-firstRowCells[0].offsetWidth;leftColumnIndex=0;}
let trailingEdgeOfNextColumn=leadingEdgeOfPreviousColumn+firstRowCells[leftColumnIndex].offsetWidth+firstRowCells[rightColumnIndex].offsetWidth;let leftMinimum=leadingEdgeOfPreviousColumn+WebInspector.DataGrid.ColumnResizePadding;let rightMaximum=trailingEdgeOfNextColumn-WebInspector.DataGrid.ColumnResizePadding;dragPoint=Number.constrain(dragPoint,leftMinimum,rightMaximum);resizer.element.style.setProperty(isRTL?"right":"left",`${dragPoint - this.CenterResizerOverBorderAdjustment}px`);let percentLeftColumn=(((dragPoint-leadingEdgeOfPreviousColumn)/this._dataTableElement.offsetWidth)*100)+"%";this._headerTableColumnGroupElement.children[leftColumnIndex].style.width=percentLeftColumn;this._dataTableColumnGroupElement.children[leftColumnIndex].style.width=percentLeftColumn;let percentRightColumn=(((trailingEdgeOfNextColumn-dragPoint)/this._dataTableElement.offsetWidth)*100)+"%";this._headerTableColumnGroupElement.children[rightColumnIndex].style.width=percentRightColumn;this._dataTableColumnGroupElement.children[rightColumnIndex].style.width=percentRightColumn;this._positionResizerElements();this._positionHeaderViews();const skipHidden=true;const dontPopulate=true;let leftColumnIdentifier=this.orderedColumns[leftColumnIndex];let rightColumnIdentifier=this.orderedColumns[rightColumnIndex];let child=this.children[0];while(child){child.didResizeColumn(leftColumnIdentifier);child.didResizeColumn(rightColumnIdentifier);child=child.traverseNextNode(skipHidden,this,dontPopulate);}
event.preventDefault();}
resizerDragEnded(resizer)
{if(resizer!==this._currentResizer)
return;this._currentResizer=null;}
_updateFilter()
{if(this._scheduledFilterUpdateIdentifier){cancelAnimationFrame(this._scheduledFilterUpdateIdentifier);this._scheduledFilterUpdateIdentifier=undefined;}
if(!this._rows.length)
return;this._textFilterRegex=simpleGlobStringToRegExp(this._filterText,"i");if(this._applyFilterToNodesTask&&this._applyFilterToNodesTask.processing)
this._applyFilterToNodesTask.cancel();function*createIteratorForNodesToBeFiltered()
{let dontPopulate=!this.hasFilters();let currentNode=this._rows[0];while(currentNode&&!currentNode.root){yield currentNode;currentNode=currentNode.traverseNextNode(false,null,dontPopulate);}}
let items=createIteratorForNodesToBeFiltered.call(this);this._applyFilterToNodesTask=new WebInspector.YieldableTask(this,items,{workInterval:100});this._filterDidModifyNodeWhileProcessingItems=false;this._applyFilterToNodesTask.start();}
yieldableTaskWillProcessItem(task,node)
{let nodeWasModified=this._applyFiltersToNodeAndDispatchEvent(node);if(nodeWasModified)
this._filterDidModifyNodeWhileProcessingItems=true;}
yieldableTaskDidYield(task,processedItems,elapsedTime)
{if(!this._filterDidModifyNodeWhileProcessingItems)
return;this._filterDidModifyNodeWhileProcessingItems=false;this.dispatchEventToListeners(WebInspector.DataGrid.Event.FilterDidChange);}
yieldableTaskDidFinish(task)
{this._applyFilterToNodesTask=null;}};WebInspector.DataGrid.Event={SortChanged:"datagrid-sort-changed",SelectedNodeChanged:"datagrid-selected-node-changed",ExpandedNode:"datagrid-expanded-node",CollapsedNode:"datagrid-collapsed-node",FilterDidChange:"datagrid-filter-did-change",NodeWasFiltered:"datagrid-node-was-filtered"};WebInspector.DataGrid.ResizeMethod={Nearest:"nearest",First:"first",Last:"last"};WebInspector.DataGrid.SortOrder={Indeterminate:"data-grid-sort-order-indeterminate",Ascending:"data-grid-sort-order-ascending",Descending:"data-grid-sort-order-descending"};WebInspector.DataGrid.PreviousColumnOrdinalSymbol=Symbol("previous-column-ordinal");WebInspector.DataGrid.NextColumnOrdinalSymbol=Symbol("next-column-ordinal");WebInspector.DataGrid.WasExpandedDuringFilteringSymbol=Symbol("was-expanded-during-filtering");WebInspector.DataGrid.ColumnResizePadding=10;WebInspector.DataGrid.CenterResizerOverBorderAdjustment=3;WebInspector.DataGrid.SortColumnAscendingStyleClassName="sort-ascending";WebInspector.DataGrid.SortColumnDescendingStyleClassName="sort-descending";WebInspector.DataGrid.SortableColumnStyleClassName="sortable";WebInspector.DataGridNode=class DataGridNode extends WebInspector.Object
{constructor(data,hasChildren)
{super();this._expanded=false;this._hidden=false;this._selected=false;this._copyable=true;this._shouldRefreshChildren=true;this._data=data||{};this.hasChildren=hasChildren||false;this.children=[];this.dataGrid=null;this.parent=null;this.previousSibling=null;this.nextSibling=null;this.disclosureToggleWidth=10;}
get hidden()
{return this._hidden;}
set hidden(x)
{x=!!x;if(this._hidden===x)
return;this._hidden=x;if(this._element)
this._element.classList.toggle("hidden",this._hidden);if(this.dataGrid)
this.dataGrid._noteRowsChanged();}
get selectable()
{return this._element&&!this._hidden;}
get copyable()
{return this._copyable;}
set copyable(x)
{this._copyable=x;}
get element()
{if(this._element)
return this._element;if(!this.dataGrid)
return null;this._element=document.createElement("tr");this._element._dataGridNode=this;if(this.hasChildren)
this._element.classList.add("parent");if(this.expanded)
this._element.classList.add("expanded");if(this.selected)
this._element.classList.add("selected");if(this.revealed)
this._element.classList.add("revealed");if(this._hidden)
this._element.classList.add("hidden");this.createCells();return this._element;}
createCells()
{for(var columnIdentifier of this.dataGrid.orderedColumns)
this._element.appendChild(this.createCell(columnIdentifier));}
refreshIfNeeded()
{if(!this._needsRefresh)
return;this._needsRefresh=false;this.refresh();}
needsRefresh()
{this._needsRefresh=true;if(!this._revealed)
return;if(this._scheduledRefreshIdentifier)
return;this._scheduledRefreshIdentifier=requestAnimationFrame(this.refresh.bind(this));}
get data()
{return this._data;}
set data(x)
{x=x||{};if(Object.shallowEqual(this._data,x))
return;this._data=x;this.needsRefresh();}
get filterableData()
{if(this._cachedFilterableData)
return this._cachedFilterableData;this._cachedFilterableData=[];for(let column of this.dataGrid.columns.values()){if(column.hidden)
continue;let value=this.filterableDataForColumn(column.columnIdentifier);if(!value)
continue;if(!(value instanceof Array))
value=[value];if(!value.length)
continue;this._cachedFilterableData=this._cachedFilterableData.concat(value);}
return this._cachedFilterableData;}
get revealed()
{if("_revealed"in this)
return this._revealed;var currentAncestor=this.parent;while(currentAncestor&&!currentAncestor.root){if(!currentAncestor.expanded){this._revealed=false;return false;}
currentAncestor=currentAncestor.parent;}
this._revealed=true;return true;}
set hasChildren(x)
{if(this._hasChildren===x)
return;this._hasChildren=x;if(!this._element)
return;if(this._hasChildren){this._element.classList.add("parent");if(this.expanded)
this._element.classList.add("expanded");}else
this._element.classList.remove("parent","expanded");}
get hasChildren()
{return this._hasChildren;}
set revealed(x)
{if(this._revealed===x)
return;this._revealed=x;if(this._element){if(this._revealed)
this._element.classList.add("revealed");else
this._element.classList.remove("revealed");}
this.refreshIfNeeded();for(var i=0;i<this.children.length;++i)
this.children[i].revealed=x&&this.expanded;}
get depth()
{if("_depth"in this)
return this._depth;if(this.parent&&!this.parent.root)
this._depth=this.parent.depth+1;else
this._depth=0;return this._depth;}
get indentPadding()
{if(typeof this._indentPadding==="number")
return this._indentPadding;this._indentPadding=this.depth*this.dataGrid.indentWidth;return this._indentPadding;}
get shouldRefreshChildren()
{return this._shouldRefreshChildren;}
set shouldRefreshChildren(x)
{this._shouldRefreshChildren=x;if(x&&this.expanded)
this.expand();}
get selected()
{return this._selected;}
set selected(x)
{if(x)
this.select();else
this.deselect();}
get expanded()
{return this._expanded;}
set expanded(x)
{if(x)
this.expand();else
this.collapse();}
hasAncestor(ancestor)
{if(!ancestor)
return false;let currentAncestor=this.parent;while(currentAncestor){if(ancestor===currentAncestor)
return true;currentAncestor=currentAncestor.parent;}
return false;}
refresh()
{if(!this._element||!this.dataGrid)
return;if(this._scheduledRefreshIdentifier){cancelAnimationFrame(this._scheduledRefreshIdentifier);this._scheduledRefreshIdentifier=undefined;}
this._cachedFilterableData=null;this._needsRefresh=false;this._element.removeChildren();this.createCells();}
refreshRecursively()
{this.refresh();this.forEachChildInSubtree((node)=>node.refresh());}
updateLayout()
{}
createCell(columnIdentifier)
{var cellElement=document.createElement("td");cellElement.className=columnIdentifier+"-column";cellElement.__columnIdentifier=columnIdentifier;var div=cellElement.createChild("div","cell-content");var content=this.createCellContent(columnIdentifier,cellElement);div.append(content);let column=this.dataGrid.columns.get(columnIdentifier);if(column){if(column["aligned"])
cellElement.classList.add(column["aligned"]);if(column["group"])
cellElement.classList.add("column-group-"+column["group"]);if(column["icon"]){let iconElement=document.createElement("div");iconElement.classList.add("icon");div.insertBefore(iconElement,div.firstChild);}}
if(columnIdentifier===this.dataGrid.disclosureColumnIdentifier){cellElement.classList.add("disclosure");if(this.indentPadding){if(WebInspector.resolvedLayoutDirection()===WebInspector.LayoutDirection.RTL)
cellElement.style.setProperty("padding-right",`${this.indentPadding}px`);else
cellElement.style.setProperty("padding-left",`${this.indentPadding}px`);}}
return cellElement;}
createCellContent(columnIdentifier)
{if(!(columnIdentifier in this.data))
return zeroWidthSpace;let data=this.data[columnIdentifier];return(typeof data==="number")?data.maxDecimals(2).toLocaleString():data;}
elementWithColumnIdentifier(columnIdentifier)
{if(!this.dataGrid)
return null;let index=this.dataGrid.orderedColumns.indexOf(columnIdentifier);if(index===-1)
return null;return this.element.children[index];}
appendChild(){return WebInspector.DataGrid.prototype.appendChild.apply(this,arguments);}
insertChild(){return WebInspector.DataGrid.prototype.insertChild.apply(this,arguments);}
removeChild(){return WebInspector.DataGrid.prototype.removeChild.apply(this,arguments);}
removeChildren(){return WebInspector.DataGrid.prototype.removeChildren.apply(this,arguments);}
removeChildrenRecursive(){return WebInspector.DataGrid.prototype.removeChildrenRecursive.apply(this,arguments);}
_recalculateSiblings(myIndex)
{if(!this.parent)
return;var previousChild=myIndex>0?this.parent.children[myIndex-1]:null;if(previousChild){previousChild.nextSibling=this;this.previousSibling=previousChild;}else
this.previousSibling=null;var nextChild=this.parent.children[myIndex+1];if(nextChild){nextChild.previousSibling=this;this.nextSibling=nextChild;}else
this.nextSibling=null;}
collapse()
{if(this._element)
this._element.classList.remove("expanded");this._expanded=false;for(var i=0;i<this.children.length;++i)
this.children[i].revealed=false;this.dispatchEventToListeners("collapsed");if(this.dataGrid){this.dataGrid.dispatchEventToListeners(WebInspector.DataGrid.Event.CollapsedNode,{dataGridNode:this});this.dataGrid._noteRowsChanged();}}
collapseRecursively()
{var item=this;while(item){if(item.expanded)
item.collapse();item=item.traverseNextNode(false,this,true);}}
expand()
{if(!this.hasChildren||this.expanded)
return;if(this.revealed&&!this._shouldRefreshChildren)
for(var i=0;i<this.children.length;++i)
this.children[i].revealed=true;if(this._shouldRefreshChildren){for(var i=0;i<this.children.length;++i)
this.children[i]._detach();this.dispatchEventToListeners("populate");if(this._attached){for(var i=0;i<this.children.length;++i){var child=this.children[i];if(this.revealed)
child.revealed=true;child._attach();}}
this._shouldRefreshChildren=false;}
if(this._element)
this._element.classList.add("expanded");this._expanded=true;this.dispatchEventToListeners("expanded");if(this.dataGrid){this.dataGrid.dispatchEventToListeners(WebInspector.DataGrid.Event.ExpandedNode,{dataGridNode:this});this.dataGrid._noteRowsChanged();}}
expandRecursively()
{var item=this;while(item){item.expand();item=item.traverseNextNode(false,this);}}
forEachImmediateChild(callback)
{for(let node of this.children)
callback(node);}
forEachChildInSubtree(callback)
{let node=this.traverseNextNode(false,this,true);while(node){callback(node);node=node.traverseNextNode(false,this,true);}}
isInSubtreeOfNode(baseNode)
{let node=baseNode;while(node){if(node===this)
return true;node=node.traverseNextNode(false,baseNode,true);}
return false;}
reveal()
{var currentAncestor=this.parent;while(currentAncestor&&!currentAncestor.root){if(!currentAncestor.expanded)
currentAncestor.expand();currentAncestor=currentAncestor.parent;}
this.element.scrollIntoViewIfNeeded(false);this.dispatchEventToListeners("revealed");}
select(suppressSelectedEvent)
{if(!this.dataGrid||!this.selectable||this.selected)
return;let oldSelectedNode=this.dataGrid.selectedNode;if(oldSelectedNode)
oldSelectedNode.deselect(true);this._selected=true;this.dataGrid.selectedNode=this;if(this._element)
this._element.classList.add("selected");if(!suppressSelectedEvent)
this.dataGrid.dispatchEventToListeners(WebInspector.DataGrid.Event.SelectedNodeChanged,{oldSelectedNode});}
revealAndSelect()
{this.reveal();this.select();}
deselect(suppressDeselectedEvent)
{if(!this.dataGrid||this.dataGrid.selectedNode!==this||!this.selected)
return;this._selected=false;this.dataGrid.selectedNode=null;if(this._element)
this._element.classList.remove("selected");if(!suppressDeselectedEvent)
this.dataGrid.dispatchEventToListeners(WebInspector.DataGrid.Event.SelectedNodeChanged,{oldSelectedNode:this});}
traverseNextNode(skipHidden,stayWithin,dontPopulate,info)
{if(!dontPopulate&&this.hasChildren)
this.dispatchEventToListeners("populate");if(info)
info.depthChange=0;var node=(!skipHidden||this.revealed)?this.children[0]:null;if(node&&(!skipHidden||this.expanded)){if(info)
info.depthChange=1;return node;}
if(this===stayWithin)
return null;node=(!skipHidden||this.revealed)?this.nextSibling:null;if(node)
return node;node=this;while(node&&!node.root&&!((!skipHidden||node.revealed)?node.nextSibling:null)&&node.parent!==stayWithin){if(info)
info.depthChange-=1;node=node.parent;}
if(!node)
return null;return(!skipHidden||node.revealed)?node.nextSibling:null;}
traversePreviousNode(skipHidden,dontPopulate)
{var node=(!skipHidden||this.revealed)?this.previousSibling:null;if(!dontPopulate&&node&&node.hasChildren)
node.dispatchEventToListeners("populate");while(node&&((!skipHidden||(node.revealed&&node.expanded))?node.children.lastValue:null)){if(!dontPopulate&&node.hasChildren)
node.dispatchEventToListeners("populate");node=((!skipHidden||(node.revealed&&node.expanded))?node.children.lastValue:null);}
if(node)
return node;if(!this.parent||this.parent.root)
return null;return this.parent;}
isEventWithinDisclosureTriangle(event)
{if(!this.hasChildren)
return false;let cell=event.target.enclosingNodeOrSelfWithNodeName("td");if(!cell||!cell.classList.contains("disclosure"))
return false;let computedStyle=window.getComputedStyle(cell);let start=0;if(WebInspector.resolvedLayoutDirection()===WebInspector.LayoutDirection.RTL)
start+=cell.totalOffsetRight-computedStyle.getPropertyCSSValue("padding-right").getFloatValue(CSSPrimitiveValue.CSS_PX)-this.disclosureToggleWidth;else
start+=cell.totalOffsetLeft+computedStyle.getPropertyCSSValue("padding-left").getFloatValue(CSSPrimitiveValue.CSS_PX);return event.pageX>=start&&event.pageX<=start+this.disclosureToggleWidth;}
_attach()
{if(!this.dataGrid||this._attached)
return;this._attached=true;let insertionIndex=-1;if(!this.isPlaceholderNode){var previousGridNode=this.traversePreviousNode(true,true);insertionIndex=this.dataGrid._rows.indexOf(previousGridNode);if(insertionIndex===-1)
insertionIndex=0;else
insertionIndex++;}
if(insertionIndex===-1)
this.dataGrid._rows.push(this);else
this.dataGrid._rows.insertAtIndex(this,insertionIndex);this.dataGrid._noteRowsChanged();if(this.expanded){for(var i=0;i<this.children.length;++i)
this.children[i]._attach();}}
_detach()
{if(!this._attached)
return;this._attached=false;this.dataGrid._rows.remove(this,true);this.dataGrid._noteRowRemoved(this);for(var i=0;i<this.children.length;++i)
this.children[i]._detach();}
savePosition()
{if(this._savedPosition)
return;if(!this.parent)
return;this._savedPosition={parent:this.parent,index:this.parent.children.indexOf(this)};}
restorePosition()
{if(!this._savedPosition)
return;if(this.parent!==this._savedPosition.parent)
this._savedPosition.parent.insertChild(this,this._savedPosition.index);this._savedPosition=null;}
appendContextMenuItems(contextMenu)
{ return null;}
filterableDataForColumn(columnIdentifier)
{let value=this.data[columnIdentifier];return typeof value==="string"?value:null;}
didResizeColumn(columnIdentifier)
{}};WebInspector.PlaceholderDataGridNode=class PlaceholderDataGridNode extends WebInspector.DataGridNode
{constructor(data)
{super(data,false);this.isPlaceholderNode=true;}
makeNormal()
{this.isPlaceholderNode=false;}};WebInspector.DetailsSectionRow=class DetailsSectionRow extends WebInspector.Object
{constructor(emptyMessage)
{super();this._element=document.createElement("div");this._element.className="row";this._emptyMessage=emptyMessage||"";}
get element()
{return this._element;}
get emptyMessage()
{return this._emptyMessage;}
set emptyMessage(emptyMessage)
{this._emptyMessage=emptyMessage||"";if(!this._element.childNodes.length)
this.showEmptyMessage();}
showEmptyMessage()
{this.element.classList.add(WebInspector.DetailsSectionRow.EmptyStyleClassName);if(this._emptyMessage instanceof Node){this.element.removeChildren();this.element.appendChild(this._emptyMessage);}else
this.element.textContent=this._emptyMessage;}
hideEmptyMessage()
{this.element.classList.remove(WebInspector.DetailsSectionRow.EmptyStyleClassName);this.element.removeChildren();}};WebInspector.DetailsSectionRow.EmptyStyleClassName="empty";WebInspector.Dialog=class Dialog extends WebInspector.View
{constructor(delegate)
{super();this._delegate=delegate;this._dismissing=false;this._representedObject=null;this._cookie=null;this._visible=false;}
get visible(){return this._visible;}
get delegate(){return this._delegate;}
get representedObject(){return this._representedObject;}
get cookie(){return this._cookie;}
present(parentElement)
{parentElement.appendChild(this.element);this._visible=true;this.didPresentDialog();}
dismiss(representedObject,cookie)
{if(this._dismissing)
return;let parent=this.element.parentNode;if(!parent)
return;this._dismissing=true;this._representedObject=representedObject||null;this._cookie=cookie||null;this._visible=false;this.element.remove();if(this._delegate&&typeof this._delegate.dialogWasDismissed==="function")
this._delegate.dialogWasDismissed(this);this._dismissing=false;this.didDismissDialog();}
didDismissDialog()
{}
didPresetDialog()
{}
representedObjectIsValid(value)
{if(this.delegate&&typeof this.delegate.isDialogRepresentedObjectValid==="function")
return this.delegate.isDialogRepresentedObjectValid(this,value);return true;}};WebInspector.HierarchicalPathComponent=class HierarchicalPathComponent extends WebInspector.Object
{constructor(displayName,styleClassNames,representedObject,textOnly,showSelectorArrows)
{super();this._representedObject=representedObject||null;this._element=document.createElement("div");this._element.className="hierarchical-path-component";if(!Array.isArray(styleClassNames))
styleClassNames=[styleClassNames];this._element.classList.add(...styleClassNames);if(!textOnly){this._iconElement=document.createElement("img");this._iconElement.className="icon";this._element.appendChild(this._iconElement);}else
this._element.classList.add("text-only");this._titleElement=document.createElement("div");this._titleElement.className="title";this._titleElement.setAttribute("dir","auto");this._element.appendChild(this._titleElement);this._titleContentElement=document.createElement("div");this._titleContentElement.className="content";this._titleElement.appendChild(this._titleContentElement);this._separatorElement=document.createElement("div");this._separatorElement.className="separator";this._element.appendChild(this._separatorElement);this._selectElement=document.createElement("select");this._selectElement.setAttribute("dir","auto");this._selectElement.addEventListener("mouseover",this._selectElementMouseOver.bind(this));this._selectElement.addEventListener("mouseout",this._selectElementMouseOut.bind(this));this._selectElement.addEventListener("mousedown",this._selectElementMouseDown.bind(this));this._selectElement.addEventListener("mouseup",this._selectElementMouseUp.bind(this));this._selectElement.addEventListener("change",this._selectElementSelectionChanged.bind(this));this._element.appendChild(this._selectElement);this._previousSibling=null;this._nextSibling=null;this._truncatedDisplayNameLength=0;this._collapsed=false;this._hidden=false;this._selectorArrows=false;this.displayName=displayName;this.selectorArrows=showSelectorArrows;}
get selectedPathComponent()
{let selectedOption=this._selectElement[this._selectElement.selectedIndex];if(!selectedOption&&this._selectElement.options.length===1)
selectedOption=this._selectElement.options[0];return selectedOption&&selectedOption._pathComponent||null;}
get element(){return this._element;}
get representedObject(){return this._representedObject;}
get displayName()
{return this._displayName;}
set displayName(newDisplayName)
{if(newDisplayName===this._displayName)
return;this._displayName=newDisplayName;this._updateElementTitleAndText();}
get truncatedDisplayNameLength()
{return this._truncatedDisplayNameLength;}
set truncatedDisplayNameLength(truncatedDisplayNameLength)
{truncatedDisplayNameLength=truncatedDisplayNameLength||0;if(truncatedDisplayNameLength===this._truncatedDisplayNameLength)
return;this._truncatedDisplayNameLength=truncatedDisplayNameLength;this._updateElementTitleAndText();}
get minimumWidth()
{if(this._collapsed)
return WebInspector.HierarchicalPathComponent.MinimumWidthCollapsed;if(this._selectorArrows)
return WebInspector.HierarchicalPathComponent.MinimumWidth+WebInspector.HierarchicalPathComponent.SelectorArrowsWidth;return WebInspector.HierarchicalPathComponent.MinimumWidth;}
get forcedWidth()
{let maxWidth=this._element.style.getProperty("width");if(typeof maxWidth==="string")
return parseInt(maxWidth);return null;}
set forcedWidth(width)
{if(typeof width==="number"){let minimumWidthForOneCharacterTruncatedTitle=WebInspector.HierarchicalPathComponent.MinimumWidthForOneCharacterTruncatedTitle;if(this.selectorArrows)
minimumWidthForOneCharacterTruncatedTitle+=WebInspector.HierarchicalPathComponent.SelectorArrowsWidth;
if(width<minimumWidthForOneCharacterTruncatedTitle)
width=0;
this._element.style.setProperty("width",Math.max(1,width)+"px");}else
this._element.style.removeProperty("width");}
get hidden()
{return this._hidden;}
set hidden(flag)
{if(this._hidden===flag)
return;this._hidden=flag;this._element.classList.toggle("hidden",this._hidden);}
get collapsed()
{return this._collapsed;}
set collapsed(flag)
{if(this._collapsed===flag)
return;this._collapsed=flag;this._element.classList.toggle("collapsed",this._collapsed);}
get selectorArrows()
{return this._selectorArrows;}
set selectorArrows(flag)
{if(this._selectorArrows===flag)
return;this._selectorArrows=flag;if(this._selectorArrows){this._selectorArrowsElement=document.createElement("img");this._selectorArrowsElement.className="selector-arrows";this._element.insertBefore(this._selectorArrowsElement,this._separatorElement);}else if(this._selectorArrowsElement){this._selectorArrowsElement.remove();this._selectorArrowsElement=null;}
this._element.classList.toggle("show-selector-arrows",!!this._selectorArrows);}
get previousSibling(){return this._previousSibling;}
set previousSibling(newSlibling){this._previousSibling=newSlibling||null;}
get nextSibling(){return this._nextSibling;}
set nextSibling(newSlibling){this._nextSibling=newSlibling||null;}
_updateElementTitleAndText()
{let truncatedDisplayName=this._displayName;if(this._truncatedDisplayNameLength&&truncatedDisplayName.length>this._truncatedDisplayNameLength)
truncatedDisplayName=truncatedDisplayName.substring(0,this._truncatedDisplayNameLength)+ellipsis;this._element.title=this._displayName;this._titleContentElement.textContent=truncatedDisplayName;}
_updateSelectElement()
{this._selectElement.removeChildren();function createOption(component)
{let optionElement=document.createElement("option");let maxPopupMenuLength=130; optionElement.textContent=component.displayName.length<=maxPopupMenuLength?component.displayName:component.displayName.substring(0,maxPopupMenuLength)+ellipsis;optionElement._pathComponent=component;return optionElement;}
let previousSiblingCount=0;let sibling=this.previousSibling;while(sibling){this._selectElement.insertBefore(createOption(sibling),this._selectElement.firstChild);sibling=sibling.previousSibling;++previousSiblingCount;}
this._selectElement.appendChild(createOption(this));sibling=this.nextSibling;while(sibling){this._selectElement.appendChild(createOption(sibling));sibling=sibling.nextSibling;}
if(this._selectElement.options.length===1)
this._selectElement.selectedIndex=-1;else
this._selectElement.selectedIndex=previousSiblingCount;}
_selectElementMouseOver(event)
{if(typeof this.mouseOver==="function")
this.mouseOver();}
_selectElementMouseOut(event)
{if(typeof this.mouseOut==="function")
this.mouseOut();}
_selectElementMouseDown(event)
{this._updateSelectElement();}
_selectElementMouseUp(event)
{this.dispatchEventToListeners(WebInspector.HierarchicalPathComponent.Event.Clicked,{pathComponent:this.selectedPathComponent});}
_selectElementSelectionChanged(event)
{this.dispatchEventToListeners(WebInspector.HierarchicalPathComponent.Event.SiblingWasSelected,{pathComponent:this.selectedPathComponent});}};WebInspector.HierarchicalPathComponent.MinimumWidth=32;WebInspector.HierarchicalPathComponent.MinimumWidthCollapsed=24;WebInspector.HierarchicalPathComponent.MinimumWidthForOneCharacterTruncatedTitle=54;WebInspector.HierarchicalPathComponent.SelectorArrowsWidth=12;WebInspector.HierarchicalPathComponent.Event={SiblingWasSelected:"hierarchical-path-component-sibling-was-selected",Clicked:"hierarchical-path-component-clicked"};WebInspector.NavigationItem=class NavigationItem extends WebInspector.Object
{constructor(identifier,role,label)
{super();this._identifier=identifier||null;this._element=document.createElement("div");this._hidden=false;this._parentNavigationBar=null;if(role)
this._element.setAttribute("role",role);if(label)
this._element.setAttribute("aria-label",label);this._element.classList.add(...this._classNames);this._element.navigationItem=this;}
get identifier(){return this._identifier;}
get element(){return this._element;}
get minimumWidth(){return this._element.realOffsetWidth;}
get parentNavigationBar(){return this._parentNavigationBar;}
updateLayout(expandOnly)
{}
get hidden()
{return this._hidden;}
set hidden(flag)
{if(this._hidden===flag)
return;this._hidden=flag;this._element.classList.toggle("hidden",flag);if(this._parentNavigationBar)
this._parentNavigationBar.needsLayout();}
get _classNames()
{var classNames=["item"];if(this._identifier)
classNames.push(this._identifier);if(this.additionalClassNames instanceof Array)
classNames=classNames.concat(this.additionalClassNames);return classNames;}};WebInspector.Popover=class Popover extends WebInspector.Object
{constructor(delegate)
{super();this.delegate=delegate;this._edge=null;this._frame=new WebInspector.Rect;this._content=null;this._targetFrame=new WebInspector.Rect;this._anchorPoint=new WebInspector.Point;this._preferredEdges=null;this._resizeHandler=null;this._contentNeedsUpdate=false;this._dismissing=false;this._element=document.createElement("div");this._element.className="popover";this._element.addEventListener("transitionend",this,true);this._container=this._element.appendChild(document.createElement("div"));this._container.className="container";}
get element()
{return this._element;}
get frame()
{return this._frame;}
get visible()
{return this._element.parentNode===document.body&&!this._element.classList.contains(WebInspector.Popover.FadeOutClassName);}
set frame(frame)
{this._element.style.left=frame.minX()+"px";this._element.style.top=frame.minY()+"px";this._element.style.width=frame.size.width+"px";this._element.style.height=frame.size.height+"px";this._element.style.backgroundSize=frame.size.width+"px "+frame.size.height+"px";this._frame=frame;}
set content(content)
{if(content===this._content)
return;this._content=content;this._contentNeedsUpdate=true;if(this.visible)
this._update(true);}
set windowResizeHandler(resizeHandler)
{this._resizeHandler=resizeHandler;}
update(shouldAnimate=true)
{if(!this.visible)
return;var previouslyFocusedElement=document.activeElement;this._contentNeedsUpdate=true;this._update(shouldAnimate);if(previouslyFocusedElement)
previouslyFocusedElement.focus();}
present(targetFrame,preferredEdges)
{this._targetFrame=targetFrame;this._preferredEdges=preferredEdges;if(!this._content)
return;this._addListenersIfNeeded();this._update();}
presentNewContentWithFrame(content,targetFrame,preferredEdges)
{this._content=content;this._contentNeedsUpdate=true;this._targetFrame=targetFrame;this._preferredEdges=preferredEdges;this._addListenersIfNeeded();var shouldAnimate=this.visible;this._update(shouldAnimate);}
dismiss()
{if(this._dismissing||this._element.parentNode!==document.body)
return;this._dismissing=true;this._isListeningForPopoverEvents=false;window.removeEventListener("mousedown",this,true);window.removeEventListener("scroll",this,true);window.removeEventListener("resize",this,true);window.removeEventListener("keypress",this,true);WebInspector.quickConsole.keyboardShortcutDisabled=false;this._element.classList.add(WebInspector.Popover.FadeOutClassName);if(this.delegate&&typeof this.delegate.willDismissPopover==="function")
this.delegate.willDismissPopover(this);}
handleEvent(event)
{switch(event.type){case"mousedown":case"scroll":if(!this._element.contains(event.target)&&!event.target.enclosingNodeOrSelfWithClass(WebInspector.Popover.IgnoreAutoDismissClassName)&&!event[WebInspector.Popover.EventPreventDismissSymbol]){this.dismiss();}
break;case"resize":if(this._resizeHandler)
this._resizeHandler();break;case"keypress":if(event.keyCode===WebInspector.KeyboardShortcut.Key.Escape.keyCode)
this.dismiss();break;case"transitionend":if(event.target===this._element){document.body.removeChild(this._element);this._element.classList.remove(WebInspector.Popover.FadeOutClassName);this._container.textContent="";if(this.delegate&&typeof this.delegate.didDismissPopover==="function")
this.delegate.didDismissPopover(this);this._dismissing=false;break;}
break;}}
_update(shouldAnimate)
{if(shouldAnimate)
var previousEdge=this._edge;var targetFrame=this._targetFrame;var preferredEdges=this._preferredEdges;
if(this._element.parentNode!==document.body)
document.body.appendChild(this._element);else
this._element.classList.remove(WebInspector.Popover.FadeOutClassName);this._dismissing=false;if(this._contentNeedsUpdate){this._element.style.removeProperty("left");this._element.style.removeProperty("top");this._element.style.removeProperty("width");this._element.style.removeProperty("height");if(this._edge!==null)
this._element.classList.remove(this._cssClassNameForEdge());this._container.replaceWith(this._content);var popoverBounds=this._element.getBoundingClientRect();this._preferredSize=new WebInspector.Size(Math.ceil(popoverBounds.width),Math.ceil(popoverBounds.height));}
var titleBarOffset=WebInspector.Platform.name==="mac"&&WebInspector.Platform.version.release>=10?22:0;var containerFrame=new WebInspector.Rect(0,titleBarOffset,window.innerWidth,window.innerHeight-titleBarOffset);containerFrame=containerFrame.inset(WebInspector.Popover.ShadowEdgeInsets);var metrics=new Array(preferredEdges.length);for(var edgeName in WebInspector.RectEdge){var edge=WebInspector.RectEdge[edgeName];var item={edge,metrics:this._bestMetricsForEdge(this._preferredSize,targetFrame,containerFrame,edge)};var preferredIndex=preferredEdges.indexOf(edge);if(preferredIndex!==-1)
metrics[preferredIndex]=item;else
metrics.push(item);}
function area(size)
{return size.width*size.height;}
var bestEdge=metrics[0].edge;var bestMetrics=metrics[0].metrics;for(var i=1;i<metrics.length;i++){var itemMetrics=metrics[i].metrics;if(area(itemMetrics.contentSize)>area(bestMetrics.contentSize)){bestEdge=metrics[i].edge;bestMetrics=itemMetrics;}}
var anchorPoint;var bestFrame=bestMetrics.frame.round();this._edge=bestEdge;if(bestFrame===WebInspector.Rect.ZERO_RECT){this.dismiss();}else{switch(bestEdge){case WebInspector.RectEdge.MIN_X:anchorPoint=new WebInspector.Point(bestFrame.size.width-WebInspector.Popover.ShadowPadding,targetFrame.midY()-bestFrame.minY());break;case WebInspector.RectEdge.MAX_X:anchorPoint=new WebInspector.Point(WebInspector.Popover.ShadowPadding,targetFrame.midY()-bestFrame.minY());break;case WebInspector.RectEdge.MIN_Y:anchorPoint=new WebInspector.Point(targetFrame.midX()-bestFrame.minX(),bestFrame.size.height-WebInspector.Popover.ShadowPadding);break;case WebInspector.RectEdge.MAX_Y:anchorPoint=new WebInspector.Point(targetFrame.midX()-bestFrame.minX(),WebInspector.Popover.ShadowPadding);break;}
this._element.classList.add(this._cssClassNameForEdge());if(shouldAnimate&&this._edge===previousEdge)
this._animateFrame(bestFrame,anchorPoint);else{this.frame=bestFrame;this._setAnchorPoint(anchorPoint);this._drawBackground();}
if(this._preferredSize.width<WebInspector.Popover.MinWidth||this._preferredSize.height<WebInspector.Popover.MinHeight)
this._container.classList.add("center");else
this._container.classList.remove("center");}
if(this._contentNeedsUpdate){this._container.textContent="";this._content.replaceWith(this._container);this._container.appendChild(this._content);}
this._contentNeedsUpdate=false;}
_cssClassNameForEdge()
{switch(this._edge){case WebInspector.RectEdge.MIN_X:return"arrow-right";case WebInspector.RectEdge.MAX_X:return"arrow-left";case WebInspector.RectEdge.MIN_Y:return"arrow-down";case WebInspector.RectEdge.MAX_Y:return"arrow-up";}
console.error("Unknown edge.");return"arrow-up";}
_setAnchorPoint(anchorPoint)
{anchorPoint.x=Math.floor(anchorPoint.x);anchorPoint.y=Math.floor(anchorPoint.y);this._anchorPoint=anchorPoint;}
_animateFrame(toFrame,toAnchor)
{var startTime=Date.now();var duration=350;var epsilon=1/(200*duration);var spline=new WebInspector.CubicBezier(0.25,0.1,0.25,1);var fromFrame=this._frame.copy();var fromAnchor=this._anchorPoint.copy();function animatedValue(from,to,progress)
{return from+(to-from)*progress;}
function drawBackground()
{var progress=spline.solve(Math.min((Date.now()-startTime)/duration,1),epsilon);this.frame=new WebInspector.Rect(animatedValue(fromFrame.minX(),toFrame.minX(),progress),animatedValue(fromFrame.minY(),toFrame.minY(),progress),animatedValue(fromFrame.size.width,toFrame.size.width,progress),animatedValue(fromFrame.size.height,toFrame.size.height,progress)).round();this._setAnchorPoint(new WebInspector.Point(animatedValue(fromAnchor.x,toAnchor.x,progress),animatedValue(fromAnchor.y,toAnchor.y,progress)));this._drawBackground();if(progress<1)
requestAnimationFrame(drawBackground.bind(this));}
drawBackground.call(this);}
_drawBackground()
{var scaleFactor=window.devicePixelRatio;var width=this._frame.size.width;var height=this._frame.size.height;var scaledWidth=width*scaleFactor;var scaledHeight=height*scaleFactor;
var scratchCanvas=document.createElement("canvas");scratchCanvas.width=scaledWidth;scratchCanvas.height=scaledHeight;var ctx=scratchCanvas.getContext("2d");ctx.scale(scaleFactor,scaleFactor);
var bounds;var arrowHeight=WebInspector.Popover.AnchorSize.height;switch(this._edge){case WebInspector.RectEdge.MIN_X:bounds=new WebInspector.Rect(0,0,width-arrowHeight,height);break;case WebInspector.RectEdge.MAX_X:bounds=new WebInspector.Rect(arrowHeight,0,width-arrowHeight,height);break;case WebInspector.RectEdge.MIN_Y:bounds=new WebInspector.Rect(0,0,width,height-arrowHeight);break;case WebInspector.RectEdge.MAX_Y:bounds=new WebInspector.Rect(0,arrowHeight,width,height-arrowHeight);break;}
bounds=bounds.inset(WebInspector.Popover.ShadowEdgeInsets);ctx.fillStyle="black";this._drawFrame(ctx,bounds,this._edge,this._anchorPoint);ctx.clip();var fillGradient=ctx.createLinearGradient(0,0,0,height);fillGradient.addColorStop(0,"rgba(255, 255, 255, 0.95)");fillGradient.addColorStop(1,"rgba(235, 235, 235, 0.95)");ctx.fillStyle=fillGradient;ctx.fillRect(0,0,width,height);ctx.strokeStyle="rgba(0, 0, 0, 0.25)";ctx.lineWidth=2;this._drawFrame(ctx,bounds,this._edge,this._anchorPoint);ctx.stroke();let finalContext=document.getCSSCanvasContext("2d","popover",scaledWidth,scaledHeight);finalContext.clearRect(0,0,scaledWidth,scaledHeight);finalContext.shadowOffsetX=1;finalContext.shadowOffsetY=1;finalContext.shadowBlur=5;finalContext.shadowColor="rgba(0, 0, 0, 0.5)";finalContext.drawImage(scratchCanvas,0,0,scaledWidth,scaledHeight);}
_bestMetricsForEdge(preferredSize,targetFrame,containerFrame,edge)
{var x,y;var width=preferredSize.width+(WebInspector.Popover.ShadowPadding*2)+(WebInspector.Popover.ContentPadding*2);var height=preferredSize.height+(WebInspector.Popover.ShadowPadding*2)+(WebInspector.Popover.ContentPadding*2);var arrowLength=WebInspector.Popover.AnchorSize.height;switch(edge){case WebInspector.RectEdge.MIN_X:width+=arrowLength;x=targetFrame.origin.x-width+WebInspector.Popover.ShadowPadding;y=targetFrame.origin.y-(height-targetFrame.size.height)/2;break;case WebInspector.RectEdge.MAX_X:width+=arrowLength;x=targetFrame.origin.x+targetFrame.size.width-WebInspector.Popover.ShadowPadding;y=targetFrame.origin.y-(height-targetFrame.size.height)/2;break;case WebInspector.RectEdge.MIN_Y:height+=arrowLength;x=targetFrame.origin.x-(width-targetFrame.size.width)/2;y=targetFrame.origin.y-height+WebInspector.Popover.ShadowPadding;break;case WebInspector.RectEdge.MAX_Y:height+=arrowLength;x=targetFrame.origin.x-(width-targetFrame.size.width)/2;y=targetFrame.origin.y+targetFrame.size.height-WebInspector.Popover.ShadowPadding;break;}
if(edge===WebInspector.RectEdge.MIN_X||edge===WebInspector.RectEdge.MAX_X){if(y<containerFrame.minY())
y=containerFrame.minY();if(y+height>containerFrame.maxY())
y=containerFrame.maxY()-height;}else{if(x<containerFrame.minX())
x=containerFrame.minX();if(x+width>containerFrame.maxX())
x=containerFrame.maxX()-width;}
var preferredFrame=new WebInspector.Rect(x,y,width,height);var bestFrame=preferredFrame.intersectionWithRect(containerFrame);width=bestFrame.size.width-(WebInspector.Popover.ShadowPadding*2);height=bestFrame.size.height-(WebInspector.Popover.ShadowPadding*2);switch(edge){case WebInspector.RectEdge.MIN_X:case WebInspector.RectEdge.MAX_X:width-=arrowLength;break;case WebInspector.RectEdge.MIN_Y:case WebInspector.RectEdge.MAX_Y:height-=arrowLength;break;}
return{frame:bestFrame,contentSize:new WebInspector.Size(width,height)};}
_drawFrame(ctx,bounds,anchorEdge)
{let cornerRadius=WebInspector.Popover.CornerRadius;let arrowHalfLength=WebInspector.Popover.AnchorSize.width*0.5;let anchorPoint=this._anchorPoint;let arrowPadding=cornerRadius+arrowHalfLength;if(anchorEdge===WebInspector.RectEdge.MIN_Y||anchorEdge===WebInspector.RectEdge.MAX_Y)
anchorPoint.x=Number.constrain(anchorPoint.x,bounds.minX()+arrowPadding,bounds.maxX()-arrowPadding);else
anchorPoint.y=Number.constrain(anchorPoint.y,bounds.minY()+arrowPadding,bounds.maxY()-arrowPadding);ctx.beginPath();switch(anchorEdge){case WebInspector.RectEdge.MIN_X:ctx.moveTo(bounds.maxX(),bounds.minY()+cornerRadius);ctx.lineTo(bounds.maxX(),anchorPoint.y-arrowHalfLength);ctx.lineTo(anchorPoint.x,anchorPoint.y);ctx.lineTo(bounds.maxX(),anchorPoint.y+arrowHalfLength);ctx.arcTo(bounds.maxX(),bounds.maxY(),bounds.minX(),bounds.maxY(),cornerRadius);ctx.arcTo(bounds.minX(),bounds.maxY(),bounds.minX(),bounds.minY(),cornerRadius);ctx.arcTo(bounds.minX(),bounds.minY(),bounds.maxX(),bounds.minY(),cornerRadius);ctx.arcTo(bounds.maxX(),bounds.minY(),bounds.maxX(),bounds.maxY(),cornerRadius);break;case WebInspector.RectEdge.MAX_X:ctx.moveTo(bounds.minX(),bounds.maxY()-cornerRadius);ctx.lineTo(bounds.minX(),anchorPoint.y+arrowHalfLength);ctx.lineTo(anchorPoint.x,anchorPoint.y);ctx.lineTo(bounds.minX(),anchorPoint.y-arrowHalfLength);ctx.arcTo(bounds.minX(),bounds.minY(),bounds.maxX(),bounds.minY(),cornerRadius);ctx.arcTo(bounds.maxX(),bounds.minY(),bounds.maxX(),bounds.maxY(),cornerRadius);ctx.arcTo(bounds.maxX(),bounds.maxY(),bounds.minX(),bounds.maxY(),cornerRadius);ctx.arcTo(bounds.minX(),bounds.maxY(),bounds.minX(),bounds.minY(),cornerRadius);break;case WebInspector.RectEdge.MIN_Y:ctx.moveTo(bounds.maxX()-cornerRadius,bounds.maxY());ctx.lineTo(anchorPoint.x+arrowHalfLength,bounds.maxY());ctx.lineTo(anchorPoint.x,anchorPoint.y);ctx.lineTo(anchorPoint.x-arrowHalfLength,bounds.maxY());ctx.arcTo(bounds.minX(),bounds.maxY(),bounds.minX(),bounds.minY(),cornerRadius);ctx.arcTo(bounds.minX(),bounds.minY(),bounds.maxX(),bounds.minY(),cornerRadius);ctx.arcTo(bounds.maxX(),bounds.minY(),bounds.maxX(),bounds.maxY(),cornerRadius);ctx.arcTo(bounds.maxX(),bounds.maxY(),bounds.minX(),bounds.maxY(),cornerRadius);break;case WebInspector.RectEdge.MAX_Y:ctx.moveTo(bounds.minX()+cornerRadius,bounds.minY());ctx.lineTo(anchorPoint.x-arrowHalfLength,bounds.minY());ctx.lineTo(anchorPoint.x,anchorPoint.y);ctx.lineTo(anchorPoint.x+arrowHalfLength,bounds.minY());ctx.arcTo(bounds.maxX(),bounds.minY(),bounds.maxX(),bounds.maxY(),cornerRadius);ctx.arcTo(bounds.maxX(),bounds.maxY(),bounds.minX(),bounds.maxY(),cornerRadius);ctx.arcTo(bounds.minX(),bounds.maxY(),bounds.minX(),bounds.minY(),cornerRadius);ctx.arcTo(bounds.minX(),bounds.minY(),bounds.maxX(),bounds.minY(),cornerRadius);break;}
ctx.closePath();}
_addListenersIfNeeded()
{if(!this._isListeningForPopoverEvents){this._isListeningForPopoverEvents=true;window.addEventListener("mousedown",this,true);window.addEventListener("scroll",this,true);window.addEventListener("resize",this,true);window.addEventListener("keypress",this,true);WebInspector.quickConsole.keyboardShortcutDisabled=true;}}};WebInspector.Popover.FadeOutClassName="fade-out";WebInspector.Popover.CornerRadius=5;WebInspector.Popover.MinWidth=40;WebInspector.Popover.MinHeight=40;WebInspector.Popover.ShadowPadding=5;WebInspector.Popover.ContentPadding=5;WebInspector.Popover.AnchorSize=new WebInspector.Size(22,11);WebInspector.Popover.ShadowEdgeInsets=new WebInspector.EdgeInsets(WebInspector.Popover.ShadowPadding);WebInspector.Popover.IgnoreAutoDismissClassName="popover-ignore-auto-dismiss";WebInspector.Popover.EventPreventDismissSymbol=Symbol("popover-event-prevent-dismiss");WebInspector.SidebarPanel=class SidebarPanel extends WebInspector.View
{constructor(identifier,displayName)
{super();this._identifier=identifier;this._displayName=displayName;this._selected=false;this._savedScrollPosition=0;this.element.classList.add("panel",identifier);this.element.setAttribute("role","group");this.element.setAttribute("aria-label",displayName);this._contentView=new WebInspector.View;this._contentView.element.classList.add("content");this.addSubview(this._contentView);}
get identifier()
{return this._identifier;}
get contentView()
{return this._contentView;}
get displayName()
{return this._displayName;}
get visible()
{return this.selected&&this.parentSidebar&&!this.parentSidebar.collapsed;}
get selected()
{return this._selected;}
set selected(flag)
{if(flag===this._selected)
return;this._selected=flag||false;this.element.classList.toggle("selected",this._selected);}
get parentSidebar()
{return this.parentView;}
get minimumWidth()
{return 0;}
show()
{if(!this.parentSidebar)
return;this.parentSidebar.collapsed=false;this.parentSidebar.selectedSidebarPanel=this;}
hide()
{if(!this.parentSidebar)
return;this.parentSidebar.collapsed=true;this.parentSidebar.selectedSidebarPanel=null;}
added()
{}
removed()
{}
shown()
{this._contentView.element.scrollTop=this._savedScrollPosition;this.updateLayoutIfNeeded();}
hidden()
{this._savedScrollPosition=this._contentView.element.scrollTop;}
visibilityDidChange()
{}};WebInspector.StyleDetailsPanel=class StyleDetailsPanel extends WebInspector.View
{constructor(delegate,className,identifier,label)
{super();this._delegate=delegate||null;this.element.classList.add(className,"offset-sections");this._navigationInfo={identifier,label};this._nodeStyles=null;this._visible=false;}
get navigationInfo()
{return this._navigationInfo;}
get nodeStyles()
{return this._nodeStyles;}
shown()
{if(this._visible)
return;this._visible=true;this._refreshNodeStyles();this.updateLayoutIfNeeded();}
hidden()
{this._visible=false;this.cancelLayout();}
markAsNeedsRefresh(domNode)
{if(!domNode)
return;if(!this._nodeStyles||this._nodeStyles.node!==domNode){if(this._nodeStyles){this._nodeStyles.removeEventListener(WebInspector.DOMNodeStyles.Event.Refreshed,this.nodeStylesRefreshed,this);this._nodeStyles.removeEventListener(WebInspector.DOMNodeStyles.Event.NeedsRefresh,this._nodeStylesNeedsRefreshed,this);}
this._nodeStyles=WebInspector.cssStyleManager.stylesForNode(domNode);if(!this._nodeStyles)
return;this._nodeStyles.addEventListener(WebInspector.DOMNodeStyles.Event.Refreshed,this.nodeStylesRefreshed,this);this._nodeStyles.addEventListener(WebInspector.DOMNodeStyles.Event.NeedsRefresh,this._nodeStylesNeedsRefreshed,this);this._forceSignificantChange=true;}
if(this._visible)
this._refreshNodeStyles();}
refresh(significantChange)
{this.dispatchEventToListeners(WebInspector.StyleDetailsPanel.Event.Refreshed);}
nodeStylesRefreshed(event)
{if(this._visible)
this._refreshPreservingScrollPosition(event.data.significantChange);}
get _initialScrollOffset()
{if(!WebInspector.cssStyleManager.canForcePseudoClasses())
return 0;return this.nodeStyles.node.enabledPseudoClasses.length?0:WebInspector.CSSStyleDetailsSidebarPanel.NoForcedPseudoClassesScrollOffset;}
_refreshNodeStyles()
{if(!this._nodeStyles)
return;this._nodeStyles.refresh();}
_refreshPreservingScrollPosition(significantChange)
{significantChange=this._forceSignificantChange||significantChange||false;var previousScrollTop=this._initialScrollOffset;if(this.element.parentNode&&this._previousRefreshNodeIdentifier===this._nodeStyles.node.id)
previousScrollTop=this.element.parentNode.scrollTop;this.refresh(significantChange);this._previousRefreshNodeIdentifier=this._nodeStyles.node.id;if(this.element.parentNode)
this.element.parentNode.scrollTop=previousScrollTop;this._forceSignificantChange=false;}
_nodeStylesNeedsRefreshed(event)
{if(this._visible)
this._refreshNodeStyles();}};WebInspector.StyleDetailsPanel.Event={Refreshed:"style-details-panel-refreshed"};WebInspector.TabBar=class TabBar extends WebInspector.View
{constructor(element,tabBarItems)
{super(element);this.element.classList.add("tab-bar");this.element.setAttribute("role","tablist");this.element.addEventListener("mousedown",this._handleMouseDown.bind(this));this.element.addEventListener("click",this._handleClick.bind(this));this.element.addEventListener("mouseleave",this._handleMouseLeave.bind(this));this.element.createChild("div","top-border");this._tabBarItems=[];if(tabBarItems){for(let tabBarItem in tabBarItems)
this.addTabBarItem(tabBarItem);}
this.addTabBarItem(WebInspector.settingsTabContentView.tabBarItem,{suppressAnimations:true});this._newTabTabBarItem=new WebInspector.PinnedTabBarItem("Images/NewTabPlus.svg",WebInspector.UIString("Create a new tab"));this._newTabTabBarItem.element.addEventListener("mouseenter",this._handleNewTabMouseEnter.bind(this));this._newTabTabBarItem.element.addEventListener("click",this._handleNewTabClick.bind(this));this.addTabBarItem(this._newTabTabBarItem,{suppressAnimations:true});}
get newTabTabBarItem(){return this._newTabTabBarItem;}
updateNewTabTabBarItemState()
{let newTabExists=!WebInspector.isNewTabWithTypeAllowed(WebInspector.NewTabContentView.Type);this._newTabTabBarItem.disabled=newTabExists;}
addTabBarItem(tabBarItem,options={})
{return this.insertTabBarItem(tabBarItem,this._tabBarItems.length,options);}
insertTabBarItem(tabBarItem,index,options={})
{if(!(tabBarItem instanceof WebInspector.TabBarItem))
return null;if(tabBarItem.parentTabBar===this)
return null;if(this._tabAnimatedClosedSinceMouseEnter){this._finishExpandingTabsAfterClose().then(()=>{this.insertTabBarItem(tabBarItem,index,options);});return null;}
if(tabBarItem.parentTabBar)
tabBarItem.parentTabBar.removeTabBarItem(tabBarItem);tabBarItem.parentTabBar=this;index=Number.constrain(index,0,this.normalTabCount);if(this.element.classList.contains("animating")){requestAnimationFrame(removeStyles.bind(this));options.suppressAnimations=true;}
var beforeTabSizesAndPositions;if(!options.suppressAnimations)
beforeTabSizesAndPositions=this._recordTabBarItemSizesAndPositions();this._tabBarItems.splice(index,0,tabBarItem);var nextSibling=this._tabBarItems[index+1];let nextSiblingElement=nextSibling?nextSibling.element:this._tabBarItems.lastValue.element;if(this.element.isAncestor(nextSiblingElement))
this.element.insertBefore(tabBarItem.element,nextSiblingElement);else
this.element.appendChild(tabBarItem.element);this.element.classList.toggle("single-tab",!this._hasMoreThanOneNormalTab());tabBarItem.element.style.left=null;tabBarItem.element.style.width=null;function animateTabs()
{this.element.classList.add("animating");this.element.classList.add("inserting-tab");this._applyTabBarItemSizesAndPositions(afterTabSizesAndPositions);this.element.addEventListener("webkitTransitionEnd",removeStylesListener);}
function removeStyles()
{this.element.classList.remove("static-layout");this.element.classList.remove("animating");this.element.classList.remove("inserting-tab");tabBarItem.element.classList.remove("being-inserted");this._clearTabBarItemSizesAndPositions();this.element.removeEventListener("webkitTransitionEnd",removeStylesListener);}
if(!options.suppressAnimations){var afterTabSizesAndPositions=this._recordTabBarItemSizesAndPositions();this.updateLayout();let tabBarItems=this._tabBarItemsFromLeftToRight();let previousTabBarItem=tabBarItems[tabBarItems.indexOf(tabBarItem)-1]||null;let previousTabBarItemSizeAndPosition=previousTabBarItem?beforeTabSizesAndPositions.get(previousTabBarItem):null;if(previousTabBarItemSizeAndPosition)
beforeTabSizesAndPositions.set(tabBarItem,{left:previousTabBarItemSizeAndPosition.left+previousTabBarItemSizeAndPosition.width,width:0});else
beforeTabSizesAndPositions.set(tabBarItem,{left:0,width:0});this.element.classList.add("static-layout");tabBarItem.element.classList.add("being-inserted");this._applyTabBarItemSizesAndPositions(beforeTabSizesAndPositions);var removeStylesListener=removeStyles.bind(this);requestAnimationFrame(animateTabs.bind(this));}else
this.needsLayout();if(!(tabBarItem instanceof WebInspector.PinnedTabBarItem))
this.updateNewTabTabBarItemState();this.dispatchEventToListeners(WebInspector.TabBar.Event.TabBarItemAdded,{tabBarItem});return tabBarItem;}
removeTabBarItem(tabBarItemOrIndex,options={})
{let tabBarItem=this._findTabBarItem(tabBarItemOrIndex);if(!tabBarItem||tabBarItem instanceof WebInspector.PinnedTabBarItem)
return null;tabBarItem.parentTabBar=null;if(this._selectedTabBarItem===tabBarItem){var index=this._tabBarItems.indexOf(tabBarItem);var nextTabBarItem=this._tabBarItems[index+1];if(!nextTabBarItem||nextTabBarItem instanceof WebInspector.PinnedTabBarItem)
nextTabBarItem=this._tabBarItems[index-1];this.selectedTabBarItem=nextTabBarItem;}
if(this.element.classList.contains("animating")){requestAnimationFrame(removeStyles.bind(this));options.suppressAnimations=true;}
var beforeTabSizesAndPositions;if(!options.suppressAnimations)
beforeTabSizesAndPositions=this._recordTabBarItemSizesAndPositions();let wasLastNormalTab=this._tabBarItems.indexOf(tabBarItem)===this.normalTabCount-1;this._tabBarItems.remove(tabBarItem);tabBarItem.element.remove();var hasMoreThanOneNormalTab=this._hasMoreThanOneNormalTab();this.element.classList.toggle("single-tab",!hasMoreThanOneNormalTab);const shouldOpenDefaultTab=!tabBarItem.isDefaultTab&&!this.normalTabCount;if(shouldOpenDefaultTab)
options.suppressAnimations=true;if(!hasMoreThanOneNormalTab||wasLastNormalTab||!options.suppressExpansion){if(!options.suppressAnimations){this._tabAnimatedClosedSinceMouseEnter=true;this._finishExpandingTabsAfterClose(beforeTabSizesAndPositions);}else
this.needsLayout();this.updateNewTabTabBarItemState();this.dispatchEventToListeners(WebInspector.TabBar.Event.TabBarItemRemoved,{tabBarItem});if(shouldOpenDefaultTab)
this._openDefaultTab();return tabBarItem;}
var lastNormalTabBarItem;function animateTabs()
{this.element.classList.add("animating");this.element.classList.add("closing-tab");
let extraSpaceBetweenNormalAndPinnedTabs=0;if(WebInspector.resolvedLayoutDirection()===WebInspector.LayoutDirection.RTL){extraSpaceBetweenNormalAndPinnedTabs=this.element.getBoundingClientRect().width;for(let currentTabBarItem of this._tabBarItemsFromLeftToRight())
extraSpaceBetweenNormalAndPinnedTabs-=currentTabBarItem.element.getBoundingClientRect().width;}
let left=0;for(let currentTabBarItem of this._tabBarItemsFromLeftToRight()){let sizeAndPosition=beforeTabSizesAndPositions.get(currentTabBarItem);if(!(currentTabBarItem instanceof WebInspector.PinnedTabBarItem)){currentTabBarItem.element.style.left=extraSpaceBetweenNormalAndPinnedTabs+left+"px";left+=sizeAndPosition.width;lastNormalTabBarItem=currentTabBarItem;}else
left=sizeAndPosition.left+sizeAndPosition.width;}
if(this._selectedTabBarItem)
this._selectedTabBarItem.element.style.width=(parseFloat(this._selectedTabBarItem.element.style.width)+1)+"px";if(lastNormalTabBarItem!==this._selectedTabBarItem)
lastNormalTabBarItem.element.style.width=(parseFloat(lastNormalTabBarItem.element.style.width)+1)+"px";this.element.addEventListener("webkitTransitionEnd",removeStylesListener);}
function removeStyles()
{if(this._selectedTabBarItem&&this._selectedTabBarItem!==lastNormalTabBarItem)
this._selectedTabBarItem.element.style.width=(parseFloat(this._selectedTabBarItem.element.style.width)-1)+"px";this.element.classList.remove("animating");this.element.classList.remove("closing-tab");this.updateLayout();this.element.removeEventListener("webkitTransitionEnd",removeStylesListener);}
if(!options.suppressAnimations){this.element.classList.add("static-layout");this._tabAnimatedClosedSinceMouseEnter=true;this._applyTabBarItemSizesAndPositions(beforeTabSizesAndPositions);var removeStylesListener=removeStyles.bind(this);requestAnimationFrame(animateTabs.bind(this));}else
this.needsLayout();this.updateNewTabTabBarItemState();this.dispatchEventToListeners(WebInspector.TabBar.Event.TabBarItemRemoved,{tabBarItem});if(shouldOpenDefaultTab)
this._openDefaultTab();return tabBarItem;}
selectPreviousTab()
{if(this._tabBarItems.length<=1)
return;var startIndex=this._tabBarItems.indexOf(this._selectedTabBarItem);var newIndex=startIndex;do{if(newIndex===0)
newIndex=this._tabBarItems.length-1;else
newIndex--;if(!(this._tabBarItems[newIndex]instanceof WebInspector.PinnedTabBarItem))
break;}while(newIndex!==startIndex);if(newIndex===startIndex)
return;this.selectedTabBarItem=this._tabBarItems[newIndex];}
selectNextTab()
{if(this._tabBarItems.length<=1)
return;var startIndex=this._tabBarItems.indexOf(this._selectedTabBarItem);var newIndex=startIndex;do{if(newIndex===this._tabBarItems.length-1)
newIndex=0;else
newIndex++;if(!(this._tabBarItems[newIndex]instanceof WebInspector.PinnedTabBarItem))
break;}while(newIndex!==startIndex);if(newIndex===startIndex)
return;this.selectedTabBarItem=this._tabBarItems[newIndex];}
get selectedTabBarItem()
{return this._selectedTabBarItem;}
set selectedTabBarItem(tabBarItemOrIndex)
{let tabBarItem=this._findTabBarItem(tabBarItemOrIndex);if(tabBarItem===this._newTabTabBarItem){tabBarItem=this._tabBarItems[this.normalTabCount-1];}
if(this._selectedTabBarItem===tabBarItem)
return;if(this._selectedTabBarItem)
this._selectedTabBarItem.selected=false;this._selectedTabBarItem=tabBarItem||null;if(this._selectedTabBarItem)
this._selectedTabBarItem.selected=true;this.dispatchEventToListeners(WebInspector.TabBar.Event.TabBarItemSelected);}
get tabBarItems()
{return this._tabBarItems;}
get normalTabCount()
{return this._tabBarItems.filter((item)=>!(item instanceof WebInspector.PinnedTabBarItem)).length;}
layout()
{if(this.element.classList.contains("static-layout"))
return;this.element.classList.remove("hide-titles");this.element.classList.remove("collapsed");let firstNormalTabItem=null;for(let tabItem of this._tabBarItems){if(tabItem instanceof WebInspector.PinnedTabBarItem)
continue;firstNormalTabItem=tabItem;break;}
if(!firstNormalTabItem)
return;if(firstNormalTabItem.element.offsetWidth>=120)
return;this.element.classList.add("collapsed");if(firstNormalTabItem.element.offsetWidth>=75)
return;this.element.classList.add("hide-titles");}
_tabBarItemsFromLeftToRight()
{return WebInspector.resolvedLayoutDirection()===WebInspector.LayoutDirection.LTR?this._tabBarItems:this._tabBarItems.slice().reverse();}
_findTabBarItem(tabBarItemOrIndex)
{if(typeof tabBarItemOrIndex==="number")
return this._tabBarItems[tabBarItemOrIndex]||null;if(tabBarItemOrIndex instanceof WebInspector.TabBarItem){if(this._tabBarItems.includes(tabBarItemOrIndex))
return tabBarItemOrIndex;}
return null;}
_hasMoreThanOneNormalTab()
{let normalTabCount=0;for(let tabBarItem of this._tabBarItems){if(tabBarItem instanceof WebInspector.PinnedTabBarItem)
continue;++normalTabCount;if(normalTabCount>=2)
return true;}
return false;}
_openDefaultTab()
{this.dispatchEventToListeners(WebInspector.TabBar.Event.OpenDefaultTab);}
_recordTabBarItemSizesAndPositions()
{var tabBarItemSizesAndPositions=new Map;const barRect=this.element.getBoundingClientRect();for(var tabBarItem of this._tabBarItems){var boundingRect=tabBarItem.element.getBoundingClientRect();tabBarItemSizesAndPositions.set(tabBarItem,{left:boundingRect.left-barRect.left,width:boundingRect.width});}
return tabBarItemSizesAndPositions;}
_applyTabBarItemSizesAndPositions(tabBarItemSizesAndPositions,skipTabBarItem)
{for(var[tabBarItem,sizeAndPosition]of tabBarItemSizesAndPositions){if(skipTabBarItem&&tabBarItem===skipTabBarItem)
continue;tabBarItem.element.style.left=sizeAndPosition.left+"px";tabBarItem.element.style.width=sizeAndPosition.width+"px";}}
_clearTabBarItemSizesAndPositions(skipTabBarItem)
{for(var tabBarItem of this._tabBarItems){if(skipTabBarItem&&tabBarItem===skipTabBarItem)
continue;tabBarItem.element.style.left=null;tabBarItem.element.style.width=null;}}
_finishExpandingTabsAfterClose(beforeTabSizesAndPositions)
{return new Promise(function(resolve,reject){this._tabAnimatedClosedSinceMouseEnter=false;if(!beforeTabSizesAndPositions)
beforeTabSizesAndPositions=this._recordTabBarItemSizesAndPositions();this.element.classList.remove("static-layout");this._clearTabBarItemSizesAndPositions();var afterTabSizesAndPositions=this._recordTabBarItemSizesAndPositions();this._applyTabBarItemSizesAndPositions(beforeTabSizesAndPositions);this.element.classList.add("static-layout");function animateTabs()
{this.element.classList.add("static-layout");this.element.classList.add("animating");this.element.classList.add("expanding-tabs");this._applyTabBarItemSizesAndPositions(afterTabSizesAndPositions);this.element.addEventListener("webkitTransitionEnd",removeStylesListener);}
function removeStyles()
{this.element.classList.remove("static-layout");this.element.classList.remove("animating");this.element.classList.remove("expanding-tabs");this._clearTabBarItemSizesAndPositions();this.updateLayout();this.element.removeEventListener("webkitTransitionEnd",removeStylesListener);resolve();}
var removeStylesListener=removeStyles.bind(this);requestAnimationFrame(animateTabs.bind(this));}.bind(this));}
_handleMouseDown(event)
{if(event.button!==0||event.ctrlKey)
return;let itemElement=event.target.enclosingNodeOrSelfWithClass(WebInspector.TabBarItem.StyleClassName);if(!itemElement)
return;let tabBarItem=itemElement[WebInspector.TabBarItem.ElementReferenceSymbol];if(!tabBarItem)
return;if(tabBarItem.disabled)
return;if(tabBarItem===this._newTabTabBarItem)
return;let closeButtonElement=event.target.enclosingNodeOrSelfWithClass(WebInspector.TabBarItem.CloseButtonStyleClassName);if(closeButtonElement)
return;this.selectedTabBarItem=tabBarItem;if(tabBarItem instanceof WebInspector.PinnedTabBarItem||!this._hasMoreThanOneNormalTab())
return;this._firstNormalTabItemIndex=0;for(let i=0;i<this._tabBarItems.length;++i){if(this._tabBarItems[i]instanceof WebInspector.PinnedTabBarItem)
continue;this._firstNormalTabItemIndex=i;break;}
this._mouseIsDown=true;this._mouseMovedEventListener=this._handleMouseMoved.bind(this);this._mouseUpEventListener=this._handleMouseUp.bind(this);document.addEventListener("mousemove",this._mouseMovedEventListener,true);document.addEventListener("mouseup",this._mouseUpEventListener,true);event.preventDefault();event.stopPropagation();}
_handleClick(event)
{var itemElement=event.target.enclosingNodeOrSelfWithClass(WebInspector.TabBarItem.StyleClassName);if(!itemElement)
return;var tabBarItem=itemElement[WebInspector.TabBarItem.ElementReferenceSymbol];if(!tabBarItem)
return;if(tabBarItem.disabled)
return;const clickedMiddleButton=event.button===1;var closeButtonElement=event.target.enclosingNodeOrSelfWithClass(WebInspector.TabBarItem.CloseButtonStyleClassName);if(closeButtonElement||clickedMiddleButton){if(tabBarItem.isDefaultTab&&this.element.classList.contains("single-tab"))
return;if(!event.altKey){this.removeTabBarItem(tabBarItem,{suppressExpansion:true});return;}
for(let i=this._tabBarItems.length-1;i>=0;--i){let item=this._tabBarItems[i];if(item===tabBarItem||item instanceof WebInspector.PinnedTabBarItem)
continue;this.removeTabBarItem(item);}}}
_handleMouseMoved(event)
{if(!this._mouseIsDown)
return;if(!this._selectedTabBarItem)
return;event.preventDefault();event.stopPropagation();if(!this.element.classList.contains("static-layout")){this._applyTabBarItemSizesAndPositions(this._recordTabBarItemSizesAndPositions());this.element.classList.add("static-layout");this.element.classList.add("dragging-tab");}
if(this._mouseOffset===undefined)
this._mouseOffset=event.pageX-this._selectedTabBarItem.element.totalOffsetLeft;var tabBarMouseOffset=event.pageX-this.element.totalOffsetLeft;var newLeft=tabBarMouseOffset-this._mouseOffset;this._selectedTabBarItem.element.style.left=newLeft+"px";var selectedTabMidX=newLeft+(this._selectedTabBarItem.element.realOffsetWidth/2);var currentIndex=this._tabBarItems.indexOf(this._selectedTabBarItem);var newIndex=currentIndex;for(let tabBarItem of this._tabBarItems){if(tabBarItem===this._selectedTabBarItem)
continue;var tabBarItemRect=tabBarItem.element.getBoundingClientRect();if(selectedTabMidX<tabBarItemRect.left||selectedTabMidX>tabBarItemRect.right)
continue;newIndex=this._tabBarItems.indexOf(tabBarItem);break;}
newIndex=Number.constrain(newIndex,this._firstNormalTabItemIndex,this.normalTabCount-1);if(currentIndex===newIndex)
return;this._tabBarItems.splice(currentIndex,1);this._tabBarItems.splice(newIndex,0,this._selectedTabBarItem);let nextSibling=this._tabBarItems[newIndex+1];let nextSiblingElement=nextSibling?nextSibling.element:this._newTabTabBarItem.element;this.element.insertBefore(this._selectedTabBarItem.element,nextSiblingElement);let left=0;for(let tabBarItem of this._tabBarItemsFromLeftToRight()){if(tabBarItem!==this._selectedTabBarItem&&tabBarItem!==this._newTabTabBarItem&&parseFloat(tabBarItem.element.style.left)!==left)
tabBarItem.element.style.left=left+"px";left+=parseFloat(tabBarItem.element.style.width);}}
_handleMouseUp(event)
{if(!this._mouseIsDown)
return;this.element.classList.remove("dragging-tab");if(!this._tabAnimatedClosedSinceMouseEnter){this.element.classList.remove("static-layout");this._clearTabBarItemSizesAndPositions();}else{let left=0;for(let tabBarItem of this._tabBarItemsFromLeftToRight()){if(tabBarItem===this._selectedTabBarItem)
tabBarItem.element.style.left=left+"px";left+=parseFloat(tabBarItem.element.style.width);}}
this._mouseIsDown=false;this._mouseOffset=undefined;document.removeEventListener("mousemove",this._mouseMovedEventListener,true);document.removeEventListener("mouseup",this._mouseUpEventListener,true);this._mouseMovedEventListener=null;this._mouseUpEventListener=null;event.preventDefault();event.stopPropagation();this.dispatchEventToListeners(WebInspector.TabBar.Event.TabBarItemsReordered);}
_handleMouseLeave(event)
{if(this._mouseIsDown||!this._tabAnimatedClosedSinceMouseEnter||!this.element.classList.contains("static-layout")||this.element.classList.contains("animating"))
return;const barRect=this.element.getBoundingClientRect();const newTabItemRect=this._newTabTabBarItem.element.getBoundingClientRect();if(event.pageY>barRect.top&&event.pageY<barRect.bottom&&event.pageX>barRect.left&&event.pageX<(newTabItemRect?newTabItemRect.right:barRect.right))
return;this._finishExpandingTabsAfterClose();}
_handleNewTabClick(event)
{WebInspector.showNewTabTab();}
_handleNewTabMouseEnter(event)
{if(!this._tabAnimatedClosedSinceMouseEnter||!this.element.classList.contains("static-layout")||this.element.classList.contains("animating"))
return;this._finishExpandingTabsAfterClose();}};WebInspector.TabBar.Event={TabBarItemSelected:"tab-bar-tab-bar-item-selected",TabBarItemAdded:"tab-bar-tab-bar-item-added",TabBarItemRemoved:"tab-bar-tab-bar-item-removed",TabBarItemsReordered:"tab-bar-tab-bar-items-reordered",OpenDefaultTab:"tab-bar-open-default-tab"};WebInspector.TabBarItem=class TabBarItem extends WebInspector.Object
{constructor(image,title,representedObject)
{super();this._parentTabBar=null;this._element=document.createElement("div");this._element.classList.add(WebInspector.TabBarItem.StyleClassName);this._element.setAttribute("role","tab");this._element.tabIndex=0;this._element[WebInspector.TabBarItem.ElementReferenceSymbol]=this;this._element.createChild("div","flex-space");this._iconElement=document.createElement("img");this._iconElement.classList.add("icon");this._element.appendChild(this._iconElement);this._element.createChild("div","flex-space");this.title=title;this.image=image;this.representedObject=representedObject;}
get element(){return this._element;}
get representedObject(){return this._representedObject;}
set representedObject(representedObject){this._representedObject=representedObject||null;}
get parentTabBar(){return this._parentTabBar;}
set parentTabBar(tabBar){this._parentTabBar=tabBar||null;}
get selected()
{return this._element.classList.contains("selected");}
set selected(selected)
{this._element.classList.toggle("selected",selected);if(selected)
this._element.setAttribute("aria-selected","true");else
this._element.removeAttribute("aria-selected");}
get disabled()
{return this._element.classList.contains("disabled");}
set disabled(disabled)
{this._element.classList.toggle("disabled",disabled);}
get isDefaultTab()
{return this._element.classList.contains("default-tab");}
set isDefaultTab(isDefaultTab)
{this._element.classList.toggle("default-tab",isDefaultTab);}
get image(){return this._iconElement.src;}
set image(url){this._iconElement.src=url||"";}
get title(){return this._element.title||"";}
set title(title){this._element.title=title||"";}};WebInspector.TabBarItem.StyleClassName="item";WebInspector.TabBarItem.CloseButtonStyleClassName="close";WebInspector.TabBarItem.ElementReferenceSymbol=Symbol("tab-bar-item");WebInspector.TabBrowser=class TabBrowser extends WebInspector.View
{constructor(element,tabBar,navigationSidebar,detailsSidebar)
{super(element);this.element.classList.add("tab-browser");this._tabBar=tabBar;this._navigationSidebar=navigationSidebar||null;this._detailsSidebar=detailsSidebar||null;if(this._navigationSidebar){this._navigationSidebar.addEventListener(WebInspector.Sidebar.Event.CollapsedStateDidChange,this._sidebarCollapsedStateDidChange,this);this._navigationSidebar.addEventListener(WebInspector.Sidebar.Event.WidthDidChange,this._sidebarWidthDidChange,this);}
if(this._detailsSidebar){this._detailsSidebar.addEventListener(WebInspector.Sidebar.Event.CollapsedStateDidChange,this._sidebarCollapsedStateDidChange,this);this._detailsSidebar.addEventListener(WebInspector.Sidebar.Event.SidebarPanelSelected,this._sidebarPanelSelected,this);this._detailsSidebar.addEventListener(WebInspector.Sidebar.Event.WidthDidChange,this._sidebarWidthDidChange,this);}
this._contentViewContainer=new WebInspector.ContentViewContainer;this.addSubview(this._contentViewContainer);let showNextTab=()=>{this._showNextTab();};let showPreviousTab=()=>{this._showPreviousTab();};let isRTL=WebInspector.resolvedLayoutDirection()===WebInspector.LayoutDirection.RTL;let nextKey1=isRTL?WebInspector.KeyboardShortcut.Key.LeftCurlyBrace:WebInspector.KeyboardShortcut.Key.RightCurlyBrace;let previousKey1=isRTL?WebInspector.KeyboardShortcut.Key.RightCurlyBrace:WebInspector.KeyboardShortcut.Key.LeftCurlyBrace;this._showNextTabKeyboardShortcut1=new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl|WebInspector.KeyboardShortcut.Modifier.Shift,nextKey1,showNextTab);this._showPreviousTabKeyboardShortcut1=new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl|WebInspector.KeyboardShortcut.Modifier.Shift,previousKey1,showPreviousTab);let nextModifier2=isRTL?WebInspector.KeyboardShortcut.Modifier.Shift:0;let previousModifier2=isRTL?0:WebInspector.KeyboardShortcut.Modifier.Shift;this._showNextTabKeyboardShortcut2=new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.Control|nextModifier2,WebInspector.KeyboardShortcut.Key.Tab,showNextTab);this._showPreviousTabKeyboardShortcut2=new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.Control|previousModifier2,WebInspector.KeyboardShortcut.Key.Tab,showPreviousTab);let previousTabKey=isRTL?WebInspector.KeyboardShortcut.Key.Right:WebInspector.KeyboardShortcut.Key.Left;let nextTabKey=isRTL?WebInspector.KeyboardShortcut.Key.Left:WebInspector.KeyboardShortcut.Key.Right;this._previousTabKeyboardShortcut=new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl|WebInspector.KeyboardShortcut.Modifier.Shift,previousTabKey,this._showPreviousTabCheckingForEditableField.bind(this));this._previousTabKeyboardShortcut.implicitlyPreventsDefault=false;this._nextTabKeyboardShortcut=new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl|WebInspector.KeyboardShortcut.Modifier.Shift,nextTabKey,this._showNextTabCheckingForEditableField.bind(this));this._nextTabKeyboardShortcut.implicitlyPreventsDefault=false;this._tabBar.addEventListener(WebInspector.TabBar.Event.TabBarItemSelected,this._tabBarItemSelected,this);this._tabBar.addEventListener(WebInspector.TabBar.Event.TabBarItemAdded,this._tabBarItemAdded,this);this._tabBar.addEventListener(WebInspector.TabBar.Event.TabBarItemRemoved,this._tabBarItemRemoved,this);this._tabBar.newTabTabBarItem.addEventListener(WebInspector.PinnedTabBarItem.Event.ContextMenu,this._handleNewTabContextMenu,this);this._recentTabContentViews=[];this._closedTabClasses=new Set;}
get tabBar()
{return this._tabBar;}
get navigationSidebar()
{return this._navigationSidebar;}
get detailsSidebar()
{return this._detailsSidebar;}
get selectedTabContentView()
{return this._contentViewContainer.currentContentView;}
bestTabContentViewForClass(constructor)
{for(var tabContentView of this._recentTabContentViews){if(tabContentView instanceof constructor)
return tabContentView;}
return null;}
bestTabContentViewForRepresentedObject(representedObject,options={})
{for(var tabContentView of this._recentTabContentViews){if(options.ignoreSearchTab&&tabContentView instanceof WebInspector.SearchTabContentView)
continue;if(options.ignoreNetworkTab&&tabContentView instanceof WebInspector.NetworkTabContentView)
continue;if(tabContentView.canShowRepresentedObject(representedObject))
return tabContentView;}
return null;}
addTabForContentView(tabContentView,options={})
{if(!(tabContentView instanceof WebInspector.TabContentView))
return false;let tabBarItem=tabContentView.tabBarItem;if(!(tabBarItem instanceof WebInspector.TabBarItem))
return false;if(tabBarItem.representedObject!==tabContentView)
tabBarItem.representedObject=tabContentView;tabContentView.parentTabBrowser=this;if(tabBarItem.parentTabBar===this._tabBar)
return true;
if(this._recentTabContentViews.length&&this.selectedTabContentView)
this._recentTabContentViews.splice(1,0,tabContentView);else
this._recentTabContentViews.push(tabContentView);if(typeof options.insertionIndex==="number")
this._tabBar.insertTabBarItem(tabBarItem,options.insertionIndex,options);else
this._tabBar.addTabBarItem(tabBarItem,options);return true;}
showTabForContentView(tabContentView,options={})
{if(!this.addTabForContentView(tabContentView,options))
return false;if(!options.suppressSelection)
this._tabBar.selectedTabBarItem=tabContentView.tabBarItem;
this.needsLayout();return true;}
closeTabForContentView(tabContentView,options={})
{if(!(tabContentView instanceof WebInspector.TabContentView))
return false;if(!(tabContentView.tabBarItem instanceof WebInspector.TabBarItem))
return false;if(tabContentView.tabBarItem.parentTabBar!==this._tabBar)
return false;this._tabBar.removeTabBarItem(tabContentView.tabBarItem,options);return true;}
layout()
{if(this.layoutReason!==WebInspector.View.LayoutReason.Resize)
return;for(let tabContentView of this._recentTabContentViews)
tabContentView[WebInspector.TabBrowser.NeedsResizeLayoutSymbol]=tabContentView!==this.selectedTabContentView;}
_tabBarItemSelected(event)
{let tabContentView=this._tabBar.selectedTabBarItem?this._tabBar.selectedTabBarItem.representedObject:null;if(tabContentView){let isSettingsTab=tabContentView instanceof WebInspector.SettingsTabContentView;if(!isSettingsTab){this._recentTabContentViews.remove(tabContentView);this._recentTabContentViews.unshift(tabContentView);}
this._contentViewContainer.showContentView(tabContentView);}else{this._contentViewContainer.closeAllContentViews();}
this._showNavigationSidebarPanelForTabContentView(tabContentView);this._showDetailsSidebarPanelsForTabContentView(tabContentView);if(tabContentView&&tabContentView[WebInspector.TabBrowser.NeedsResizeLayoutSymbol]){tabContentView[WebInspector.TabBrowser.NeedsResizeLayoutSymbol]=false;tabContentView.updateLayout(WebInspector.View.LayoutReason.Resize);}
this.dispatchEventToListeners(WebInspector.TabBrowser.Event.SelectedTabContentViewDidChange);}
_tabBarItemAdded(event)
{let tabContentView=event.data.tabBarItem.representedObject;if(!tabContentView)
return;this._closedTabClasses.delete(tabContentView.constructor);}
_tabBarItemRemoved(event)
{let tabContentView=event.data.tabBarItem.representedObject;if(!tabContentView)
return;this._recentTabContentViews.remove(tabContentView);if(!tabContentView.constructor.isEphemeral())
this._closedTabClasses.add(tabContentView.constructor);this._contentViewContainer.closeContentView(tabContentView);tabContentView.parentTabBrowser=null;}
_handleNewTabContextMenu(event)
{
let closedTabClasses=Array.from(this._closedTabClasses).reverse();let allTabClasses=Array.from(WebInspector.knownTabClasses());let tabClassesToDisplay=closedTabClasses.concat(allTabClasses.filter((tabClass)=>{if(closedTabClasses.includes(tabClass))
return false;if(tabClass.isEphemeral())
return false;return WebInspector.isNewTabWithTypeAllowed(tabClass.Type);}));if(!tabClassesToDisplay.length)
return;let contextMenu=event.data.contextMenu;contextMenu.appendItem(WebInspector.UIString("Recently Closed Tabs"),null,true);for(let tabClass of tabClassesToDisplay){contextMenu.appendItem(tabClass.tabInfo().title,()=>{WebInspector.createNewTabWithType(tabClass.Type,{shouldShowNewTab:true});});}}
_sidebarPanelSelected(event)
{if(this._ignoreSidebarEvents)
return;var tabContentView=this.selectedTabContentView;if(!tabContentView)
return;if(tabContentView.managesDetailsSidebarPanels)
return;var selectedSidebarPanel=this._detailsSidebar.selectedSidebarPanel;tabContentView.detailsSidebarSelectedPanelSetting.value=selectedSidebarPanel?selectedSidebarPanel.identifier:null;}
_sidebarCollapsedStateDidChange(event)
{if(this._ignoreSidebarEvents)
return;var tabContentView=this.selectedTabContentView;if(!tabContentView)
return;if(event.target===this._navigationSidebar)
tabContentView.navigationSidebarCollapsedSetting.value=this._navigationSidebar.collapsed;else if(event.target===this._detailsSidebar&&!tabContentView.managesDetailsSidebarPanels)
tabContentView.detailsSidebarCollapsedSetting.value=this._detailsSidebar.collapsed;}
_sidebarWidthDidChange(event)
{if(this._ignoreSidebarEvents||!event.data)
return;let tabContentView=this.selectedTabContentView;if(!tabContentView)
return;switch(event.target){case this._navigationSidebar:tabContentView.navigationSidebarWidthSetting.value=event.data.newWidth;break;case this._detailsSidebar:tabContentView.detailsSidebarWidthSetting.value=event.data.newWidth;break;}}
_showNavigationSidebarPanelForTabContentView(tabContentView)
{if(!this._navigationSidebar)
return;this._ignoreSidebarEvents=true;this._navigationSidebar.removeSidebarPanel(0);if(!tabContentView){this._ignoreSidebarEvents=false;return;}
if(tabContentView.navigationSidebarWidthSetting.value)
this._navigationSidebar.width=tabContentView.navigationSidebarWidthSetting.value;var navigationSidebarPanel=tabContentView.navigationSidebarPanel;if(!navigationSidebarPanel){this._navigationSidebar.collapsed=true;this._ignoreSidebarEvents=false;return;}
this._navigationSidebar.addSidebarPanel(navigationSidebarPanel);this._navigationSidebar.selectedSidebarPanel=navigationSidebarPanel;this._navigationSidebar.collapsed=tabContentView.navigationSidebarCollapsedSetting.value;this._ignoreSidebarEvents=false;}
_showDetailsSidebarPanelsForTabContentView(tabContentView)
{if(!this._detailsSidebar)
return;this._ignoreSidebarEvents=true;for(var i=this._detailsSidebar.sidebarPanels.length-1;i>=0;--i)
this._detailsSidebar.removeSidebarPanel(i);if(!tabContentView){this._ignoreSidebarEvents=false;return;}
if(tabContentView.detailsSidebarWidthSetting.value)
this._detailsSidebar.width=tabContentView.detailsSidebarWidthSetting.value;if(tabContentView.managesDetailsSidebarPanels){tabContentView.showDetailsSidebarPanels();this._ignoreSidebarEvents=false;return;}
var detailsSidebarPanels=tabContentView.detailsSidebarPanels;if(!detailsSidebarPanels){this._detailsSidebar.collapsed=true;this._ignoreSidebarEvents=false;return;}
for(var detailsSidebarPanel of detailsSidebarPanels)
this._detailsSidebar.addSidebarPanel(detailsSidebarPanel);this._detailsSidebar.selectedSidebarPanel=tabContentView.detailsSidebarSelectedPanelSetting.value||detailsSidebarPanels[0];this._detailsSidebar.collapsed=tabContentView.detailsSidebarCollapsedSetting.value||!detailsSidebarPanels.length;this._ignoreSidebarEvents=false;}
_showPreviousTab(event)
{this._tabBar.selectPreviousTab();}
_showNextTab(event)
{this._tabBar.selectNextTab();}
_showNextTabCheckingForEditableField(event)
{if(WebInspector.isEventTargetAnEditableField(event))
return;this._showNextTab(event);event.preventDefault();}
_showPreviousTabCheckingForEditableField(event)
{if(WebInspector.isEventTargetAnEditableField(event))
return;this._showPreviousTab(event);event.preventDefault();}};WebInspector.TabBrowser.NeedsResizeLayoutSymbol=Symbol("needs-resize-layout");WebInspector.TabBrowser.Event={SelectedTabContentViewDidChange:"tab-browser-selected-tab-content-view-did-change"};WebInspector.TextEditor=class TextEditor extends WebInspector.View
{constructor(element,mimeType,delegate)
{super(element);this.element.classList.add("text-editor",WebInspector.SyntaxHighlightedStyleClassName);this._codeMirror=WebInspector.CodeMirrorEditor.create(this.element,{readOnly:true,indentWithTabs:WebInspector.settings.indentWithTabs.value,indentUnit:WebInspector.settings.indentUnit.value,tabSize:WebInspector.settings.tabSize.value,lineNumbers:true,lineWrapping:WebInspector.settings.enableLineWrapping.value,matchBrackets:true,autoCloseBrackets:true,showWhitespaceCharacters:WebInspector.settings.showWhitespaceCharacters.value,styleSelectedText:true,});WebInspector.settings.indentWithTabs.addEventListener(WebInspector.Setting.Event.Changed,(event)=>{this._codeMirror.setOption("indentWithTabs",WebInspector.settings.indentWithTabs.value);});WebInspector.settings.indentUnit.addEventListener(WebInspector.Setting.Event.Changed,(event)=>{this._codeMirror.setOption("indentUnit",WebInspector.settings.indentUnit.value);});WebInspector.settings.tabSize.addEventListener(WebInspector.Setting.Event.Changed,(event)=>{this._codeMirror.setOption("tabSize",WebInspector.settings.tabSize.value);});WebInspector.settings.enableLineWrapping.addEventListener(WebInspector.Setting.Event.Changed,(event)=>{this._codeMirror.setOption("lineWrapping",WebInspector.settings.enableLineWrapping.value);});WebInspector.settings.showWhitespaceCharacters.addEventListener(WebInspector.Setting.Event.Changed,(event)=>{this._codeMirror.setOption("showWhitespaceCharacters",WebInspector.settings.showWhitespaceCharacters.value);});this._codeMirror.on("change",this._contentChanged.bind(this));this._codeMirror.on("gutterClick",this._gutterMouseDown.bind(this));this._codeMirror.on("gutterContextMenu",this._gutterContextMenu.bind(this));this._codeMirror.getScrollerElement().addEventListener("click",this._openClickedLinks.bind(this),true);this._completionController=new WebInspector.CodeMirrorCompletionController(this._codeMirror,this);this._tokenTrackingController=new WebInspector.CodeMirrorTokenTrackingController(this._codeMirror,this);this._initialStringNotSet=true;this.mimeType=mimeType;this._breakpoints={};this._executionLineNumber=NaN;this._executionColumnNumber=NaN;this._executionLineHandle=null;this._executionMultilineHandles=[];this._executionRangeHighlightMarker=null;this._searchQuery=null;this._searchResults=[];this._currentSearchResultIndex=-1;this._ignoreCodeMirrorContentDidChangeEvent=0;this._formatted=false;this._formattingPromise=null;this._formatterSourceMap=null;this._deferReveal=false;this._delegate=delegate||null;}
get visible()
{return this._visible;}
get string()
{return this._codeMirror.getValue();}
set string(newString)
{function update()
{if(this._initialStringNotSet)
this._codeMirror.removeLineClass(0,"wrap");if(this._codeMirror.getValue()!==newString){this._codeMirror.setValue(newString);}else{this.layout();}
if(this._initialStringNotSet){this._codeMirror.clearHistory();this._codeMirror.markClean();this._initialStringNotSet=false;}
this._updateExecutionLine();this._updateExecutionRangeHighlight();for(var lineNumber in this._breakpoints)
this._setBreakpointStylesOnLine(lineNumber);this._revealPendingPositionIfPossible();}
this._ignoreCodeMirrorContentDidChangeEvent++;this._codeMirror.operation(update.bind(this));this._ignoreCodeMirrorContentDidChangeEvent--;}
get readOnly()
{return this._codeMirror.getOption("readOnly")||false;}
set readOnly(readOnly)
{this._codeMirror.setOption("readOnly",readOnly);}
get formatted()
{return this._formatted;}
get hasModified()
{let historySize=this._codeMirror.historySize().undo;if(this._formatted)
historySize--;return historySize>0;}
updateFormattedState(formatted)
{return this._format(formatted).catch(handlePromiseException);}
hasFormatter()
{let mode=this._codeMirror.getMode().name;return mode==="javascript"||mode==="css";}
canBeFormatted()
{return this.hasFormatter();}
canShowTypeAnnotations()
{return false;}
canShowCoverageHints()
{return false;}
get selectedTextRange()
{var start=this._codeMirror.getCursor(true);var end=this._codeMirror.getCursor(false);return this._textRangeFromCodeMirrorPosition(start,end);}
set selectedTextRange(textRange)
{var position=this._codeMirrorPositionFromTextRange(textRange);this._codeMirror.setSelection(position.start,position.end);}
get mimeType()
{return this._mimeType;}
set mimeType(newMIMEType)
{newMIMEType=parseMIMEType(newMIMEType).type;this._mimeType=newMIMEType;this._codeMirror.setOption("mode",{name:newMIMEType,globalVars:true});}
get executionLineNumber()
{return this._executionLineNumber;}
get executionColumnNumber()
{return this._executionColumnNumber;}
get formatterSourceMap()
{return this._formatterSourceMap;}
get tokenTrackingController()
{return this._tokenTrackingController;}
get delegate()
{return this._delegate;}
set delegate(newDelegate)
{this._delegate=newDelegate||null;}
get numberOfSearchResults()
{return this._searchResults.length;}
get currentSearchQuery()
{return this._searchQuery;}
set automaticallyRevealFirstSearchResult(reveal)
{this._automaticallyRevealFirstSearchResult=reveal;if(this._automaticallyRevealFirstSearchResult&&this._searchResults.length>0){if(this._currentSearchResultIndex===-1)
this._revealFirstSearchResultAfterCursor();}}
set deferReveal(defer)
{this._deferReveal=defer;}
performSearch(query)
{if(this._searchQuery===query)
return;this.searchCleared();this._searchQuery=query;if(typeof this.customPerformSearch==="function"&&!this.formatted){if(this.customPerformSearch(query))
return;}
var queryRegex=new RegExp(query.escapeForRegExp(),"gi");var searchCursor=this._codeMirror.getSearchCursor(queryRegex,{line:0,ch:0},false);var boundBatchSearch=batchSearch.bind(this);var numberOfSearchResultsDidChangeTimeout=null;function reportNumberOfSearchResultsDidChange()
{if(numberOfSearchResultsDidChangeTimeout){clearTimeout(numberOfSearchResultsDidChangeTimeout);numberOfSearchResultsDidChangeTimeout=null;}
this.dispatchEventToListeners(WebInspector.TextEditor.Event.NumberOfSearchResultsDidChange);}
function batchSearch()
{if(this._searchQuery!==query)
return;var newSearchResults=[];var foundResult=false;for(var i=0;i<WebInspector.TextEditor.NumberOfFindsPerSearchBatch&&(foundResult=searchCursor.findNext());++i){var textRange=this._textRangeFromCodeMirrorPosition(searchCursor.from(),searchCursor.to());newSearchResults.push(textRange);}
this.addSearchResults(newSearchResults);if(!numberOfSearchResultsDidChangeTimeout)
numberOfSearchResultsDidChangeTimeout=setTimeout(reportNumberOfSearchResultsDidChange.bind(this),500);if(foundResult){setTimeout(boundBatchSearch,50);}else{reportNumberOfSearchResultsDidChange.call(this);}}
boundBatchSearch();}
setExecutionLineAndColumn(lineNumber,columnNumber)
{if(!this._executionLineHandle&&isNaN(lineNumber))
return;this._executionLineNumber=lineNumber;this._executionColumnNumber=columnNumber;if(!this._initialStringNotSet){this._updateExecutionLine();this._updateExecutionRangeHighlight();}
this.dispatchEventToListeners(WebInspector.TextEditor.Event.ExecutionLineNumberDidChange);}
addSearchResults(textRanges)
{if(!textRanges||!textRanges.length)
return;function markRanges()
{for(var i=0;i<textRanges.length;++i){var position=this._codeMirrorPositionFromTextRange(textRanges[i]);var mark=this._codeMirror.markText(position.start,position.end,{className:WebInspector.TextEditor.SearchResultStyleClassName});this._searchResults.push(mark);}
if(this._automaticallyRevealFirstSearchResult){if(this._currentSearchResultIndex===-1)
this._revealFirstSearchResultAfterCursor();}}
this._codeMirror.operation(markRanges.bind(this));}
searchCleared()
{function clearResults(){for(var i=0;i<this._searchResults.length;++i)
this._searchResults[i].clear();}
this._codeMirror.operation(clearResults.bind(this));this._searchQuery=null;this._searchResults=[];this._currentSearchResultIndex=-1;}
searchQueryWithSelection()
{if(!this._codeMirror.somethingSelected())
return null;return this._codeMirror.getSelection();}
revealPreviousSearchResult(changeFocus)
{if(!this._searchResults.length)
return;if(this._currentSearchResultIndex===-1||this._cursorDoesNotMatchLastRevealedSearchResult()){this._revealFirstSearchResultBeforeCursor(changeFocus);return;}
if(this._currentSearchResultIndex>0)
--this._currentSearchResultIndex;else
this._currentSearchResultIndex=this._searchResults.length-1;this._revealSearchResult(this._searchResults[this._currentSearchResultIndex],changeFocus,-1);}
revealNextSearchResult(changeFocus)
{if(!this._searchResults.length)
return;if(this._currentSearchResultIndex===-1||this._cursorDoesNotMatchLastRevealedSearchResult()){this._revealFirstSearchResultAfterCursor(changeFocus);return;}
if(this._currentSearchResultIndex+1<this._searchResults.length)
++this._currentSearchResultIndex;else
this._currentSearchResultIndex=0;this._revealSearchResult(this._searchResults[this._currentSearchResultIndex],changeFocus,1);}
line(lineNumber)
{return this._codeMirror.getLine(lineNumber);}
getTextInRange(startPosition,endPosition)
{return this._codeMirror.getRange(startPosition,endPosition);}
addStyleToTextRange(startPosition,endPosition,styleClassName)
{endPosition.ch+=1;return this._codeMirror.getDoc().markText(startPosition,endPosition,{className:styleClassName,inclusiveLeft:true,inclusiveRight:true});}
revealPosition(position,textRangeToSelect,forceUnformatted,noHighlight)
{if(!(position instanceof WebInspector.SourceCodePosition))
return;if(!this._visible||this._initialStringNotSet||this._deferReveal){this._positionToReveal=position;this._textRangeToSelect=textRangeToSelect;this._forceUnformatted=forceUnformatted;return;}
delete this._positionToReveal;delete this._textRangeToSelect;delete this._forceUnformatted;if(this._formatted&&forceUnformatted){this.updateFormattedState(false).then(()=>{setTimeout(this.revealPosition.bind(this),0,position,textRangeToSelect);});return;}
let line=Number.constrain(position.lineNumber,0,this._codeMirror.lineCount()-1);let lineHandle=this._codeMirror.getLineHandle(line);if(!textRangeToSelect){let column=Number.constrain(position.columnNumber,0,this._codeMirror.getLine(line).length-1);textRangeToSelect=new WebInspector.TextRange(line,column,line,column);}
function removeStyleClass()
{this._codeMirror.removeLineClass(lineHandle,"wrap",WebInspector.TextEditor.HighlightedStyleClassName);}
function revealAndHighlightLine()
{var position=this._codeMirrorPositionFromTextRange(textRangeToSelect);if(!this._isPositionVisible(position.start))
this._scrollIntoViewCentered(position.start);this.selectedTextRange=textRangeToSelect;if(noHighlight)
return;if(WebInspector.debuggerManager.paused&&line===this._executionLineNumber)
return;this._codeMirror.addLineClass(lineHandle,"wrap",WebInspector.TextEditor.HighlightedStyleClassName);
setTimeout(removeStyleClass.bind(this),WebInspector.TextEditor.HighlightAnimationDuration);}
this._codeMirror.operation(revealAndHighlightLine.bind(this));}
shown()
{this._visible=true;this._codeMirror.refresh();
this._revealPendingPositionIfPossible();}
hidden()
{this._visible=false;}
close()
{WebInspector.settings.indentWithTabs.removeEventListener(null,null,this);WebInspector.settings.indentUnit.removeEventListener(null,null,this);WebInspector.settings.tabSize.removeEventListener(null,null,this);WebInspector.settings.enableLineWrapping.removeEventListener(null,null,this);WebInspector.settings.showWhitespaceCharacters.removeEventListener(null,null,this);}
setBreakpointInfoForLineAndColumn(lineNumber,columnNumber,breakpointInfo)
{if(this._ignoreSetBreakpointInfoCalls)
return;if(breakpointInfo)
this._addBreakpointToLineAndColumnWithInfo(lineNumber,columnNumber,breakpointInfo);else
this._removeBreakpointFromLineAndColumn(lineNumber,columnNumber);}
updateBreakpointLineAndColumn(oldLineNumber,oldColumnNumber,newLineNumber,newColumnNumber)
{if(!this._breakpoints[oldLineNumber])
return;if(!this._breakpoints[oldLineNumber][oldColumnNumber])
return;var breakpointInfo=this._breakpoints[oldLineNumber][oldColumnNumber];this._removeBreakpointFromLineAndColumn(oldLineNumber,oldColumnNumber);this._addBreakpointToLineAndColumnWithInfo(newLineNumber,newColumnNumber,breakpointInfo);}
addStyleClassToLine(lineNumber,styleClassName)
{var lineHandle=this._codeMirror.getLineHandle(lineNumber);if(!lineHandle)
return null;return this._codeMirror.addLineClass(lineHandle,"wrap",styleClassName);}
removeStyleClassFromLine(lineNumber,styleClassName)
{var lineHandle=this._codeMirror.getLineHandle(lineNumber);if(!lineHandle)
return null;return this._codeMirror.removeLineClass(lineHandle,"wrap",styleClassName);}
toggleStyleClassForLine(lineNumber,styleClassName)
{var lineHandle=this._codeMirror.getLineHandle(lineNumber);if(!lineHandle)
return false;return this._codeMirror.toggleLineClass(lineHandle,"wrap",styleClassName);}
createWidgetForLine(lineNumber)
{var lineHandle=this._codeMirror.getLineHandle(lineNumber);if(!lineHandle)
return null;var widgetElement=document.createElement("div");var lineWidget=this._codeMirror.addLineWidget(lineHandle,widgetElement,{coverGutter:false,noHScroll:true});return new WebInspector.LineWidget(lineWidget,widgetElement);}
get lineCount()
{return this._codeMirror.lineCount();}
focus()
{this._codeMirror.focus();}
contentDidChange(replacedRanges,newRanges)
{}
rectsForRange(range)
{return this._codeMirror.rectsForRange(range);}
get markers()
{return this._codeMirror.getAllMarks().map(WebInspector.TextMarker.textMarkerForCodeMirrorTextMarker);}
markersAtPosition(position)
{return this._codeMirror.findMarksAt(position).map(WebInspector.TextMarker.textMarkerForCodeMirrorTextMarker);}
createColorMarkers(range)
{return createCodeMirrorColorTextMarkers(this._codeMirror,range);}
createGradientMarkers(range)
{return createCodeMirrorGradientTextMarkers(this._codeMirror,range);}
createCubicBezierMarkers(range)
{return createCodeMirrorCubicBezierTextMarkers(this._codeMirror,range);}
createSpringMarkers(range)
{return createCodeMirrorSpringTextMarkers(this._codeMirror,range);}
editingControllerForMarker(editableMarker)
{switch(editableMarker.type){case WebInspector.TextMarker.Type.Color:return new WebInspector.CodeMirrorColorEditingController(this._codeMirror,editableMarker);case WebInspector.TextMarker.Type.Gradient:return new WebInspector.CodeMirrorGradientEditingController(this._codeMirror,editableMarker);case WebInspector.TextMarker.Type.CubicBezier:return new WebInspector.CodeMirrorBezierEditingController(this._codeMirror,editableMarker);case WebInspector.TextMarker.Type.Spring:return new WebInspector.CodeMirrorSpringEditingController(this._codeMirror,editableMarker);default:return new WebInspector.CodeMirrorEditingController(this._codeMirror,editableMarker);}}
visibleRangeOffsets()
{var startOffset=null;var endOffset=null;var visibleRange=this._codeMirror.getViewport();if(this._formatterSourceMap){startOffset=this._formatterSourceMap.formattedToOriginalOffset(Math.max(visibleRange.from-1,0),0);endOffset=this._formatterSourceMap.formattedToOriginalOffset(visibleRange.to-1,0);}else{startOffset=this._codeMirror.getDoc().indexFromPos({line:visibleRange.from,ch:0});endOffset=this._codeMirror.getDoc().indexFromPos({line:visibleRange.to,ch:0});}
return{startOffset,endOffset};}
originalOffsetToCurrentPosition(offset)
{var position=null;if(this._formatterSourceMap){var location=this._formatterSourceMap.originalPositionToFormatted(offset);position={line:location.lineNumber,ch:location.columnNumber};}else
position=this._codeMirror.getDoc().posFromIndex(offset);return position;}
currentOffsetToCurrentPosition(offset)
{return this._codeMirror.getDoc().posFromIndex(offset);}
currentPositionToOriginalOffset(position)
{let offset=null;if(this._formatterSourceMap)
offset=this._formatterSourceMap.formattedToOriginalOffset(position.line,position.ch);else
offset=this._codeMirror.getDoc().indexFromPos(position);return offset;}
currentPositionToOriginalPosition(position)
{if(!this._formatterSourceMap)
return position;let location=this._formatterSourceMap.formattedToOriginal(position.line,position.ch);return{line:location.lineNumber,ch:location.columnNumber};}
currentPositionToCurrentOffset(position)
{return this._codeMirror.getDoc().indexFromPos(position);}
setInlineWidget(position,inlineElement)
{return this._codeMirror.setUniqueBookmark(position,{widget:inlineElement});}
addScrollHandler(handler)
{this._codeMirror.on("scroll",handler);}
removeScrollHandler(handler)
{this._codeMirror.off("scroll",handler);}
layout()
{
if(this._visible)
this._codeMirror.refresh();}
_format(formatted)
{if(this._formatted===formatted)
return Promise.resolve(this._formatted);if(formatted&&!this.canBeFormatted())
return Promise.resolve(this._formatted);if(this._formattingPromise)
return this._formattingPromise;this._ignoreCodeMirrorContentDidChangeEvent++;this._formattingPromise=this.prettyPrint(formatted).then(()=>{this._ignoreCodeMirrorContentDidChangeEvent--;this._formattingPromise=null;let originalFormatted=this._formatted;this._formatted=!!this._formatterSourceMap;if(this._formatted!==originalFormatted)
this.dispatchEventToListeners(WebInspector.TextEditor.Event.FormattingDidChange);return this._formatted;});return this._formattingPromise;}
prettyPrint(pretty)
{return new Promise((resolve,reject)=>{let beforePrettyPrintState={selectionAnchor:this._codeMirror.getCursor("anchor"),selectionHead:this._codeMirror.getCursor("head"),};if(!pretty)
this._undoFormatting(beforePrettyPrintState,resolve);else if(this._canUseFormatterWorker())
this._startWorkerPrettyPrint(beforePrettyPrintState,resolve);else
this._startCodeMirrorPrettyPrint(beforePrettyPrintState,resolve);});}
_canUseFormatterWorker()
{return this._codeMirror.getMode().name==="javascript";}
_startWorkerPrettyPrint(beforePrettyPrintState,callback)
{let sourceText=this._codeMirror.getValue();let indentString=WebInspector.indentString();const includeSourceMapData=true;let sourceType=this._delegate?this._delegate.textEditorScriptSourceType(this):WebInspector.Script.SourceType.Program;const isModule=sourceType===WebInspector.Script.SourceType.Module;let workerProxy=WebInspector.FormatterWorkerProxy.singleton();workerProxy.formatJavaScript(sourceText,isModule,indentString,includeSourceMapData,({formattedText,sourceMapData})=>{if(formattedText===null){callback();return;}
this._finishPrettyPrint(beforePrettyPrintState,formattedText,sourceMapData,callback);});}
_startCodeMirrorPrettyPrint(beforePrettyPrintState,callback)
{let indentString=WebInspector.indentString();let start={line:0,ch:0};let end={line:this._codeMirror.lineCount()-1};let builder=new FormatterContentBuilder(indentString);let formatter=new WebInspector.Formatter(this._codeMirror,builder);formatter.format(start,end);let formattedText=builder.formattedContent;let sourceMapData=builder.sourceMapData;this._finishPrettyPrint(beforePrettyPrintState,formattedText,sourceMapData,callback);}
_finishPrettyPrint(beforePrettyPrintState,formattedText,sourceMapData,callback)
{this._codeMirror.operation(()=>{this._formatterSourceMap=WebInspector.FormatterSourceMap.fromSourceMapData(sourceMapData);this._codeMirror.setValue(formattedText);this._updateAfterFormatting(true,beforePrettyPrintState);});callback();}
_undoFormatting(beforePrettyPrintState,callback)
{this._codeMirror.operation(()=>{this._codeMirror.undo();this._updateAfterFormatting(false,beforePrettyPrintState);});callback();}
_updateAfterFormatting(pretty,beforePrettyPrintState)
{let oldSelectionAnchor=beforePrettyPrintState.selectionAnchor;let oldSelectionHead=beforePrettyPrintState.selectionHead;let newSelectionAnchor,newSelectionHead;let newExecutionLocation=null;if(pretty){if(this._positionToReveal){let newRevealPosition=this._formatterSourceMap.originalToFormatted(this._positionToReveal.lineNumber,this._positionToReveal.columnNumber);this._positionToReveal=new WebInspector.SourceCodePosition(newRevealPosition.lineNumber,newRevealPosition.columnNumber);}
if(this._textRangeToSelect){let mappedRevealSelectionStart=this._formatterSourceMap.originalToFormatted(this._textRangeToSelect.startLine,this._textRangeToSelect.startColumn);let mappedRevealSelectionEnd=this._formatterSourceMap.originalToFormatted(this._textRangeToSelect.endLine,this._textRangeToSelect.endColumn);this._textRangeToSelect=new WebInspector.TextRange(mappedRevealSelectionStart.lineNumber,mappedRevealSelectionStart.columnNumber,mappedRevealSelectionEnd.lineNumber,mappedRevealSelectionEnd.columnNumber);}
if(!isNaN(this._executionLineNumber)){newExecutionLocation=this._formatterSourceMap.originalToFormatted(this._executionLineNumber,this._executionColumnNumber);}
let mappedAnchorLocation=this._formatterSourceMap.originalToFormatted(oldSelectionAnchor.line,oldSelectionAnchor.ch);let mappedHeadLocation=this._formatterSourceMap.originalToFormatted(oldSelectionHead.line,oldSelectionHead.ch);newSelectionAnchor={line:mappedAnchorLocation.lineNumber,ch:mappedAnchorLocation.columnNumber};newSelectionHead={line:mappedHeadLocation.lineNumber,ch:mappedHeadLocation.columnNumber};}else{if(this._positionToReveal){let newRevealPosition=this._formatterSourceMap.formattedToOriginal(this._positionToReveal.lineNumber,this._positionToReveal.columnNumber);this._positionToReveal=new WebInspector.SourceCodePosition(newRevealPosition.lineNumber,newRevealPosition.columnNumber);}
if(this._textRangeToSelect){let mappedRevealSelectionStart=this._formatterSourceMap.formattedToOriginal(this._textRangeToSelect.startLine,this._textRangeToSelect.startColumn);let mappedRevealSelectionEnd=this._formatterSourceMap.formattedToOriginal(this._textRangeToSelect.endLine,this._textRangeToSelect.endColumn);this._textRangeToSelect=new WebInspector.TextRange(mappedRevealSelectionStart.lineNumber,mappedRevealSelectionStart.columnNumber,mappedRevealSelectionEnd.lineNumber,mappedRevealSelectionEnd.columnNumber);}
if(!isNaN(this._executionLineNumber)){newExecutionLocation=this._formatterSourceMap.formattedToOriginal(this._executionLineNumber,this._executionColumnNumber);}
let mappedAnchorLocation=this._formatterSourceMap.formattedToOriginal(oldSelectionAnchor.line,oldSelectionAnchor.ch);let mappedHeadLocation=this._formatterSourceMap.formattedToOriginal(oldSelectionHead.line,oldSelectionHead.ch);newSelectionAnchor={line:mappedAnchorLocation.lineNumber,ch:mappedAnchorLocation.columnNumber};newSelectionHead={line:mappedHeadLocation.lineNumber,ch:mappedHeadLocation.columnNumber};this._formatterSourceMap=null;}
this._scrollIntoViewCentered(newSelectionAnchor);this._codeMirror.setSelection(newSelectionAnchor,newSelectionHead);if(newExecutionLocation){this._executionLineHandle=null;this._executionMultilineHandles=[];this.setExecutionLineAndColumn(newExecutionLocation.lineNumber,newExecutionLocation.columnNumber);}
if(this.currentSearchQuery){let searchQuery=this.currentSearchQuery;this.searchCleared();setTimeout(()=>{this.performSearch(searchQuery);},0);}
if(this._delegate&&typeof this._delegate.textEditorUpdatedFormatting==="function")
this._delegate.textEditorUpdatedFormatting(this);}
hasEdits()
{return!this._codeMirror.isClean();}
_contentChanged(codeMirror,change)
{if(this._ignoreCodeMirrorContentDidChangeEvent>0)
return;var replacedRanges=[];var newRanges=[];while(change){replacedRanges.push(new WebInspector.TextRange(change.from.line,change.from.ch,change.to.line,change.to.ch));newRanges.push(new WebInspector.TextRange(change.from.line,change.from.ch,change.from.line+change.text.length-1,change.text.length===1?change.from.ch+change.text[0].length:change.text.lastValue.length));change=change.next;}
this.contentDidChange(replacedRanges,newRanges);if(this._formatted){this._formatterSourceMap=null;this._formatted=false;if(this._delegate&&typeof this._delegate.textEditorUpdatedFormatting==="function")
this._delegate.textEditorUpdatedFormatting(this);this.dispatchEventToListeners(WebInspector.TextEditor.Event.FormattingDidChange);}
this.dispatchEventToListeners(WebInspector.TextEditor.Event.ContentDidChange);}
_textRangeFromCodeMirrorPosition(start,end)
{return new WebInspector.TextRange(start.line,start.ch,end.line,end.ch);}
_codeMirrorPositionFromTextRange(textRange)
{var start={line:textRange.startLine,ch:textRange.startColumn};var end={line:textRange.endLine,ch:textRange.endColumn};return{start,end};}
_revealPendingPositionIfPossible()
{if(!this._positionToReveal)
return;if(!this._visible)
return;this.revealPosition(this._positionToReveal,this._textRangeToSelect,this._forceUnformatted);}
_revealSearchResult(result,changeFocus,directionInCaseOfRevalidation)
{var position=result.find();if(!position){this._revalidateSearchResults(directionInCaseOfRevalidation);return;}
if(!this._isPositionVisible(position.from))
this._scrollIntoViewCentered(position.from);this.selectedTextRange=this._textRangeFromCodeMirrorPosition(position.from,position.to);this._automaticallyRevealFirstSearchResult=false;if(changeFocus)
this._codeMirror.focus();
if(this._bouncyHighlightElement)
this._bouncyHighlightElement.remove();this._bouncyHighlightElement=document.createElement("div");this._bouncyHighlightElement.className=WebInspector.TextEditor.BouncyHighlightStyleClassName;var textContent=this._codeMirror.getSelection();var coordinates=this._codeMirror.cursorCoords(true,"page");let textEditorRect=this.element.getBoundingClientRect();coordinates.top-=textEditorRect.top;coordinates.left-=textEditorRect.left;this._bouncyHighlightElement.textContent=textContent;this._bouncyHighlightElement.style.top=coordinates.top+"px";this._bouncyHighlightElement.style.left=coordinates.left+"px";this.element.appendChild(this._bouncyHighlightElement);let scrollHandler=()=>{if(this._bouncyHighlightElement)
this._bouncyHighlightElement.remove();};this.addScrollHandler(scrollHandler);function animationEnded()
{if(!this._bouncyHighlightElement)
return;this._bouncyHighlightElement.remove();delete this._bouncyHighlightElement;this.removeScrollHandler(scrollHandler);}
this._bouncyHighlightElement.addEventListener("animationend",animationEnded.bind(this));}
_binarySearchInsertionIndexInSearchResults(object,comparator)
{
var array=this._searchResults;var first=0;var last=array.length-1;while(first<=last){var mid=(first+last)>>1;var c=comparator(object,array[mid]);if(c===null)
return null;if(c>0)
first=mid+1;else if(c<0)
last=mid-1;else
return mid;}
return first-1;}
_revealFirstSearchResultBeforeCursor(changeFocus)
{var currentCursorPosition=this._codeMirror.getCursor("start");if(currentCursorPosition.line===0&&currentCursorPosition.ch===0){this._currentSearchResultIndex=this._searchResults.length-1;this._revealSearchResult(this._searchResults[this._currentSearchResultIndex],changeFocus,-1);return;}
var index=this._binarySearchInsertionIndexInSearchResults(currentCursorPosition,function(current,searchResult){var searchResultMarker=searchResult.find();if(!searchResultMarker)
return null;return WebInspector.compareCodeMirrorPositions(current,searchResultMarker.from);});if(index===null){this._revalidateSearchResults(-1);return;}
this._currentSearchResultIndex=index;this._revealSearchResult(this._searchResults[this._currentSearchResultIndex],changeFocus);}
_revealFirstSearchResultAfterCursor(changeFocus)
{var currentCursorPosition=this._codeMirror.getCursor("start");if(currentCursorPosition.line===0&&currentCursorPosition.ch===0){this._currentSearchResultIndex=0;this._revealSearchResult(this._searchResults[this._currentSearchResultIndex],changeFocus,1);return;}
var index=this._binarySearchInsertionIndexInSearchResults(currentCursorPosition,function(current,searchResult){var searchResultMarker=searchResult.find();if(!searchResultMarker)
return null;return WebInspector.compareCodeMirrorPositions(current,searchResultMarker.from);});if(index===null){this._revalidateSearchResults(1);return;}
if(index+1<this._searchResults.length)
++index;else
index=0;this._currentSearchResultIndex=index;this._revealSearchResult(this._searchResults[this._currentSearchResultIndex],changeFocus);}
_cursorDoesNotMatchLastRevealedSearchResult()
{var lastRevealedSearchResultMarker=this._searchResults[this._currentSearchResultIndex].find();if(!lastRevealedSearchResultMarker)
return true;var currentCursorPosition=this._codeMirror.getCursor("start");var lastRevealedSearchResultPosition=lastRevealedSearchResultMarker.from;return WebInspector.compareCodeMirrorPositions(currentCursorPosition,lastRevealedSearchResultPosition)!==0;}
_revalidateSearchResults(direction)
{this._currentSearchResultIndex=-1;var updatedSearchResults=[];for(var i=0;i<this._searchResults.length;++i){if(this._searchResults[i].find())
updatedSearchResults.push(this._searchResults[i]);}
this._searchResults=updatedSearchResults;this.dispatchEventToListeners(WebInspector.TextEditor.Event.NumberOfSearchResultsDidChange);if(this._searchResults.length){if(direction>0)
this._revealFirstSearchResultAfterCursor();else
this._revealFirstSearchResultBeforeCursor();}}
_clearMultilineExecutionLineHighlights()
{if(this._executionMultilineHandles.length){for(let lineHandle of this._executionMultilineHandles)
this._codeMirror.removeLineClass(lineHandle,"wrap",WebInspector.TextEditor.ExecutionLineStyleClassName);this._executionMultilineHandles=[];}}
_updateExecutionLine()
{this._codeMirror.operation(()=>{if(this._executionLineHandle){this._codeMirror.removeLineClass(this._executionLineHandle,"wrap",WebInspector.TextEditor.ExecutionLineStyleClassName);this._codeMirror.removeLineClass(this._executionLineHandle,"wrap","primary");}
this._clearMultilineExecutionLineHighlights();this._executionLineHandle=!isNaN(this._executionLineNumber)?this._codeMirror.getLineHandle(this._executionLineNumber):null;if(this._executionLineHandle){this._codeMirror.addLineClass(this._executionLineHandle,"wrap",WebInspector.TextEditor.ExecutionLineStyleClassName);this._codeMirror.addLineClass(this._executionLineHandle,"wrap","primary");this._codeMirror.removeLineClass(this._executionLineHandle,"wrap",WebInspector.TextEditor.HighlightedStyleClassName);}});}
_updateExecutionRangeHighlight()
{if(this._executionRangeHighlightMarker){this._executionRangeHighlightMarker.clear();this._executionRangeHighlightMarker=null;}
if(isNaN(this._executionLineNumber))
return;let currentPosition={line:this._executionLineNumber,ch:this._executionColumnNumber};let originalOffset=this.currentPositionToOriginalOffset(currentPosition);let originalCodeMirrorPosition=this.currentPositionToOriginalPosition(currentPosition);let originalPosition=new WebInspector.SourceCodePosition(originalCodeMirrorPosition.line,originalCodeMirrorPosition.ch);let characterAtOffset=this._codeMirror.getRange(currentPosition,{line:this._executionLineNumber,ch:this._executionColumnNumber+1});this._delegate.textEditorExecutionHighlightRange(originalOffset,originalPosition,characterAtOffset,(range)=>{let start,end;if(!range){start={line:this._executionLineNumber,ch:this._executionColumnNumber};end={line:this._executionLineNumber};}else{start=this.originalOffsetToCurrentPosition(range[0]);end=this.originalOffsetToCurrentPosition(range[1]);}
if(this._executionRangeHighlightMarker){this._executionRangeHighlightMarker.clear();this._executionRangeHighlightMarker=null;}
let text=this._codeMirror.getRange(start,end);let trailingWhitespace=text.match(/\s+$/);if(trailingWhitespace)
end.ch=Math.max(0,end.ch-trailingWhitespace[0].length);this._clearMultilineExecutionLineHighlights();if(start.line!==end.line){for(let line=start.line;line<end.line;++line){let lineHandle=this._codeMirror.getLineHandle(line);this._codeMirror.addLineClass(lineHandle,"wrap",WebInspector.TextEditor.ExecutionLineStyleClassName);this._executionMultilineHandles.push(lineHandle);}}
this._executionRangeHighlightMarker=this._codeMirror.markText(start,end,{className:"execution-range-highlight"});});}
_setBreakpointStylesOnLine(lineNumber)
{var columnBreakpoints=this._breakpoints[lineNumber];if(!columnBreakpoints)
return;var allDisabled=true;var allResolved=true;var allAutoContinue=true;var multiple=Object.keys(columnBreakpoints).length>1;for(var columnNumber in columnBreakpoints){var breakpointInfo=columnBreakpoints[columnNumber];if(!breakpointInfo.disabled)
allDisabled=false;if(!breakpointInfo.resolved)
allResolved=false;if(!breakpointInfo.autoContinue)
allAutoContinue=false;}
allResolved=allResolved&&WebInspector.debuggerManager.breakpointsEnabled;function updateStyles()
{var lineHandle=this._codeMirror.getLineHandle(lineNumber);if(!lineHandle)
return;this._codeMirror.addLineClass(lineHandle,"wrap",WebInspector.TextEditor.HasBreakpointStyleClassName);if(allResolved)
this._codeMirror.addLineClass(lineHandle,"wrap",WebInspector.TextEditor.BreakpointResolvedStyleClassName);else
this._codeMirror.removeLineClass(lineHandle,"wrap",WebInspector.TextEditor.BreakpointResolvedStyleClassName);if(allDisabled)
this._codeMirror.addLineClass(lineHandle,"wrap",WebInspector.TextEditor.BreakpointDisabledStyleClassName);else
this._codeMirror.removeLineClass(lineHandle,"wrap",WebInspector.TextEditor.BreakpointDisabledStyleClassName);if(allAutoContinue)
this._codeMirror.addLineClass(lineHandle,"wrap",WebInspector.TextEditor.BreakpointAutoContinueStyleClassName);else
this._codeMirror.removeLineClass(lineHandle,"wrap",WebInspector.TextEditor.BreakpointAutoContinueStyleClassName);if(multiple)
this._codeMirror.addLineClass(lineHandle,"wrap",WebInspector.TextEditor.MultipleBreakpointsStyleClassName);else
this._codeMirror.removeLineClass(lineHandle,"wrap",WebInspector.TextEditor.MultipleBreakpointsStyleClassName);}
this._codeMirror.operation(updateStyles.bind(this));}
_addBreakpointToLineAndColumnWithInfo(lineNumber,columnNumber,breakpointInfo)
{if(!this._breakpoints[lineNumber])
this._breakpoints[lineNumber]={};this._breakpoints[lineNumber][columnNumber]=breakpointInfo;this._setBreakpointStylesOnLine(lineNumber);}
_removeBreakpointFromLineAndColumn(lineNumber,columnNumber)
{delete this._breakpoints[lineNumber][columnNumber];if(!isEmptyObject(this._breakpoints[lineNumber])){this._setBreakpointStylesOnLine(lineNumber);return;}
delete this._breakpoints[lineNumber];function updateStyles()
{var lineHandle=this._codeMirror.getLineHandle(lineNumber);if(!lineHandle)
return;this._codeMirror.removeLineClass(lineHandle,"wrap",WebInspector.TextEditor.HasBreakpointStyleClassName);this._codeMirror.removeLineClass(lineHandle,"wrap",WebInspector.TextEditor.BreakpointResolvedStyleClassName);this._codeMirror.removeLineClass(lineHandle,"wrap",WebInspector.TextEditor.BreakpointDisabledStyleClassName);this._codeMirror.removeLineClass(lineHandle,"wrap",WebInspector.TextEditor.BreakpointAutoContinueStyleClassName);this._codeMirror.removeLineClass(lineHandle,"wrap",WebInspector.TextEditor.MultipleBreakpointsStyleClassName);}
this._codeMirror.operation(updateStyles.bind(this));}
_allColumnBreakpointInfoForLine(lineNumber)
{return this._breakpoints[lineNumber];}
_setColumnBreakpointInfoForLine(lineNumber,columnBreakpointInfo)
{this._breakpoints[lineNumber]=columnBreakpointInfo;this._setBreakpointStylesOnLine(lineNumber);}
_gutterMouseDown(codeMirror,lineNumber,gutterElement,event)
{if(event.button!==0||event.ctrlKey)
return;if(!this._codeMirror.hasLineClass(lineNumber,"wrap",WebInspector.TextEditor.HasBreakpointStyleClassName)){if(this._delegate&&typeof this._delegate.textEditorBreakpointAdded==="function"){var data=this._delegate.textEditorBreakpointAdded(this,lineNumber,0);if(data){var breakpointInfo=data.breakpointInfo;if(breakpointInfo)
this._addBreakpointToLineAndColumnWithInfo(data.lineNumber,data.columnNumber,breakpointInfo);}}
return;}
if(this._codeMirror.hasLineClass(lineNumber,"wrap",WebInspector.TextEditor.MultipleBreakpointsStyleClassName)){return;}
var columnNumber=Object.keys(this._breakpoints[lineNumber])[0];this._draggingBreakpointInfo=this._breakpoints[lineNumber][columnNumber];this._lineNumberWithMousedDownBreakpoint=lineNumber;this._lineNumberWithDraggedBreakpoint=lineNumber;this._columnNumberWithMousedDownBreakpoint=columnNumber;this._columnNumberWithDraggedBreakpoint=columnNumber;this._documentMouseMovedEventListener=this._documentMouseMoved.bind(this);this._documentMouseUpEventListener=this._documentMouseUp.bind(this);document.addEventListener("mousemove",this._documentMouseMovedEventListener,true);document.addEventListener("mouseup",this._documentMouseUpEventListener,true);}
_gutterContextMenu(codeMirror,lineNumber,gutterElement,event)
{if(this._delegate&&typeof this._delegate.textEditorGutterContextMenu==="function"){var breakpoints=[];for(var columnNumber in this._breakpoints[lineNumber])
breakpoints.push({lineNumber,columnNumber});this._delegate.textEditorGutterContextMenu(this,lineNumber,0,breakpoints,event);}}
_documentMouseMoved(event)
{if(!("_lineNumberWithMousedDownBreakpoint"in this))
return;event.preventDefault();var lineNumber;var position=this._codeMirror.coordsChar({left:event.pageX,top:event.pageY});
var gutterBounds=this._codeMirror.getGutterElement().getBoundingClientRect();if(event.pageX<gutterBounds.left||event.pageX>gutterBounds.right||event.pageY<gutterBounds.top||event.pageY>gutterBounds.bottom)
position=null;if(position&&"line"in position)
lineNumber=position.line;
if(lineNumber===this._lineNumberWithDraggedBreakpoint)
return;
this._mouseDragged=true;if("_lineNumberWithDraggedBreakpoint"in this){
if(this._previousColumnBreakpointInfo)
this._setColumnBreakpointInfoForLine(this._lineNumberWithDraggedBreakpoint,this._previousColumnBreakpointInfo);else
this._removeBreakpointFromLineAndColumn(this._lineNumberWithDraggedBreakpoint,this._columnNumberWithDraggedBreakpoint);delete this._previousColumnBreakpointInfo;delete this._lineNumberWithDraggedBreakpoint;delete this._columnNumberWithDraggedBreakpoint;}
if(lineNumber!==undefined){var newColumnBreakpoints={};var columnNumber=(lineNumber===this._lineNumberWithMousedDownBreakpoint?this._columnNumberWithDraggedBreakpoint:0);newColumnBreakpoints[columnNumber]=this._draggingBreakpointInfo;this._previousColumnBreakpointInfo=this._allColumnBreakpointInfoForLine(lineNumber);this._setColumnBreakpointInfoForLine(lineNumber,newColumnBreakpoints);this._lineNumberWithDraggedBreakpoint=lineNumber;this._columnNumberWithDraggedBreakpoint=columnNumber;}}
_documentMouseUp(event)
{if(!("_lineNumberWithMousedDownBreakpoint"in this))
return;event.preventDefault();document.removeEventListener("mousemove",this._documentMouseMovedEventListener,true);document.removeEventListener("mouseup",this._documentMouseUpEventListener,true);var delegateImplementsBreakpointClicked=this._delegate&&typeof this._delegate.textEditorBreakpointClicked==="function";var delegateImplementsBreakpointRemoved=this._delegate&&typeof this._delegate.textEditorBreakpointRemoved==="function";var delegateImplementsBreakpointMoved=this._delegate&&typeof this._delegate.textEditorBreakpointMoved==="function";if(this._mouseDragged){if(!("_lineNumberWithDraggedBreakpoint"in this)){if(delegateImplementsBreakpointRemoved){this._ignoreSetBreakpointInfoCalls=true;this._delegate.textEditorBreakpointRemoved(this,this._lineNumberWithMousedDownBreakpoint,this._columnNumberWithMousedDownBreakpoint);delete this._ignoreSetBreakpointInfoCalls;}}else if(this._lineNumberWithMousedDownBreakpoint!==this._lineNumberWithDraggedBreakpoint){
if(this._previousColumnBreakpointInfo&&delegateImplementsBreakpointRemoved){this._ignoreSetBreakpointInfoCalls=true;for(var columnNumber in this._previousColumnBreakpointInfo)
this._delegate.textEditorBreakpointRemoved(this,this._lineNumberWithDraggedBreakpoint,columnNumber);delete this._ignoreSetBreakpointInfoCalls;}
if(delegateImplementsBreakpointMoved){this._ignoreSetBreakpointInfoCalls=true;this._delegate.textEditorBreakpointMoved(this,this._lineNumberWithMousedDownBreakpoint,this._columnNumberWithMousedDownBreakpoint,this._lineNumberWithDraggedBreakpoint,this._columnNumberWithDraggedBreakpoint);delete this._ignoreSetBreakpointInfoCalls;}}}else{if(this._lineNumberWithMousedDownBreakpoint in this._breakpoints&&this._columnNumberWithMousedDownBreakpoint in this._breakpoints[this._lineNumberWithMousedDownBreakpoint]&&delegateImplementsBreakpointClicked)
this._delegate.textEditorBreakpointClicked(this,this._lineNumberWithMousedDownBreakpoint,this._columnNumberWithMousedDownBreakpoint);}
delete this._documentMouseMovedEventListener;delete this._documentMouseUpEventListener;delete this._lineNumberWithMousedDownBreakpoint;delete this._lineNumberWithDraggedBreakpoint;delete this._columnNumberWithMousedDownBreakpoint;delete this._columnNumberWithDraggedBreakpoint;delete this._previousColumnBreakpointInfo;delete this._mouseDragged;}
_openClickedLinks(event)
{var position=this._codeMirror.coordsChar({left:event.pageX,top:event.pageY});var tokenInfo=this._codeMirror.getTokenAt(position);if(!tokenInfo||!tokenInfo.type||!tokenInfo.string)
return;if(!/\blink\b/.test(tokenInfo.type))
return;var url=tokenInfo.string;var baseURL="";if(this._delegate&&typeof this._delegate.textEditorBaseURL==="function")
baseURL=this._delegate.textEditorBaseURL(this);WebInspector.openURL(absoluteURL(url,baseURL));event.preventDefault();event.stopPropagation();}
_isPositionVisible(position)
{var scrollInfo=this._codeMirror.getScrollInfo();var visibleRangeStart=scrollInfo.top;var visibleRangeEnd=visibleRangeStart+scrollInfo.clientHeight;var coords=this._codeMirror.charCoords(position,"local");return coords.top>=visibleRangeStart&&coords.bottom<=visibleRangeEnd;}
_scrollIntoViewCentered(position)
{var scrollInfo=this._codeMirror.getScrollInfo();var lineHeight=Math.ceil(this._codeMirror.defaultTextHeight());var margin=Math.floor((scrollInfo.clientHeight-lineHeight)/2);this._codeMirror.scrollIntoView(position,margin);}};WebInspector.TextEditor.HighlightedStyleClassName="highlighted";WebInspector.TextEditor.SearchResultStyleClassName="search-result";WebInspector.TextEditor.HasBreakpointStyleClassName="has-breakpoint";WebInspector.TextEditor.BreakpointResolvedStyleClassName="breakpoint-resolved";WebInspector.TextEditor.BreakpointAutoContinueStyleClassName="breakpoint-auto-continue";WebInspector.TextEditor.BreakpointDisabledStyleClassName="breakpoint-disabled";WebInspector.TextEditor.MultipleBreakpointsStyleClassName="multiple-breakpoints";WebInspector.TextEditor.ExecutionLineStyleClassName="execution-line";WebInspector.TextEditor.BouncyHighlightStyleClassName="bouncy-highlight";WebInspector.TextEditor.NumberOfFindsPerSearchBatch=10;WebInspector.TextEditor.HighlightAnimationDuration=2000;WebInspector.TextEditor.Event={ExecutionLineNumberDidChange:"text-editor-execution-line-number-did-change",NumberOfSearchResultsDidChange:"text-editor-number-of-search-results-did-change",ContentDidChange:"text-editor-content-did-change",FormattingDidChange:"text-editor-formatting-did-change"};WebInspector.TimelineOverviewGraph=class TimelineOverviewGraph extends WebInspector.View
{constructor(timelineOverview)
{super();this.element.classList.add("timeline-overview-graph");this._zeroTime=0;this._startTime=0;this._endTime=5;this._currentTime=0;this._timelineOverview=timelineOverview;this._selectedRecord=null;this._selectedRecordChanged=false;this._scheduledSelectedRecordLayoutUpdateIdentifier=undefined;this._selected=false;this._visible=true;}
static createForTimeline(timeline,timelineOverview)
{var timelineType=timeline.type;if(timelineType===WebInspector.TimelineRecord.Type.Network)
return new WebInspector.NetworkTimelineOverviewGraph(timeline,timelineOverview);if(timelineType===WebInspector.TimelineRecord.Type.Layout)
return new WebInspector.LayoutTimelineOverviewGraph(timeline,timelineOverview);if(timelineType===WebInspector.TimelineRecord.Type.Script)
return new WebInspector.ScriptTimelineOverviewGraph(timeline,timelineOverview);if(timelineType===WebInspector.TimelineRecord.Type.RenderingFrame)
return new WebInspector.RenderingFrameTimelineOverviewGraph(timeline,timelineOverview);if(timelineType===WebInspector.TimelineRecord.Type.Memory)
return new WebInspector.MemoryTimelineOverviewGraph(timeline,timelineOverview);if(timelineType===WebInspector.TimelineRecord.Type.HeapAllocations)
return new WebInspector.HeapAllocationsTimelineOverviewGraph(timeline,timelineOverview);throw new Error("Can't make a graph for an unknown timeline.");}
get zeroTime()
{return this._zeroTime;}
set zeroTime(x)
{x=x||0;if(this._zeroTime===x)
return;this._zeroTime=x;this.needsLayout();}
get startTime()
{return this._startTime;}
set startTime(x)
{x=x||0;if(this._startTime===x)
return;this._startTime=x;this.needsLayout();}
get endTime()
{return this._endTime;}
set endTime(x)
{x=x||0;if(this._endTime===x)
return;this._endTime=x;this.needsLayout();}
get currentTime()
{return this._currentTime;}
set currentTime(x)
{x=x||0;if(this._currentTime===x)
return;let oldCurrentTime=this._currentTime;this._currentTime=x;if((this._startTime<=oldCurrentTime&&oldCurrentTime<=this._endTime)||(this._startTime<=this._currentTime&&this._currentTime<=this._endTime))
this.needsLayout();}
get timelineOverview()
{return this._timelineOverview;}
get secondsPerPixel(){return this._timelineOverview.secondsPerPixel;}
get visible()
{return this._visible;}
get selectedRecord()
{return this._selectedRecord;}
set selectedRecord(x)
{if(this._selectedRecord===x)
return;this._selectedRecord=x;this._selectedRecordChanged=true;this._needsSelectedRecordLayout();}
get height()
{return 36;}
get selected(){return this._selected;}
set selected(x)
{if(this._selected===x)
return;this._selected=x;this.element.classList.toggle("selected",this._selected);}
shown()
{if(this._visible)
return;this._visible=true;this.element.classList.toggle("hidden",!this._visible);this.updateLayout();}
hidden()
{if(!this._visible)
return;this._visible=false;this.element.classList.toggle("hidden",!this._visible);}
reset()
{}
recordWasFiltered(record,filtered)
{}
needsLayout()
{if(!this._visible)
return;super.needsLayout();}
updateSelectedRecord()
{}
_needsSelectedRecordLayout()
{if(this.layoutPending)
return;if(this._scheduledSelectedRecordLayoutUpdateIdentifier)
return;this._scheduledSelectedRecordLayoutUpdateIdentifier=requestAnimationFrame(()=>{this._scheduledSelectedRecordLayoutUpdateIdentifier=undefined;this.updateSelectedRecord();this.dispatchEventToListeners(WebInspector.TimelineOverviewGraph.Event.RecordSelected,{record:this.selectedRecord});});}};WebInspector.TimelineOverviewGraph.Event={RecordSelected:"timeline-overview-graph-record-selected"};WebInspector.TimelineView=class TimelineView extends WebInspector.ContentView
{constructor(representedObject)
{super(representedObject);this.element.classList.add("timeline-view");this._zeroTime=0;this._startTime=0;this._endTime=5;this._currentTime=0;}
get scrollableElements()
{if(!this._timelineDataGrid)
return[];return[this._timelineDataGrid.scrollContainer];}
get showsLiveRecordingData()
{return true;}
get showsFilterBar()
{return true;}
get navigationItems()
{return this._scopeBar?[this._scopeBar]:[];}
get selectionPathComponents()
{return null;}
get zeroTime()
{return this._zeroTime;}
set zeroTime(x)
{x=x||0;if(this._zeroTime===x)
return;this._zeroTime=x;this._timesDidChange();}
get startTime()
{return this._startTime;}
set startTime(x)
{x=x||0;if(this._startTime===x)
return;this._startTime=x;this._timesDidChange();this._scheduleFilterDidChange();}
get endTime()
{return this._endTime;}
set endTime(x)
{x=x||0;if(this._endTime===x)
return;this._endTime=x;this._timesDidChange();this._scheduleFilterDidChange();}
get currentTime()
{return this._currentTime;}
set currentTime(x)
{x=x||0;if(this._currentTime===x)
return;let oldCurrentTime=this._currentTime;this._currentTime=x;function checkIfLayoutIsNeeded(currentTime)
{const wiggleTime=0.05; return this._startTime-wiggleTime<=currentTime&&currentTime<=this._endTime+wiggleTime;}
if(checkIfLayoutIsNeeded.call(this,oldCurrentTime)||checkIfLayoutIsNeeded.call(this,this._currentTime))
this._timesDidChange();}
get filterStartTime()
{return this.startTime;}
get filterEndTime()
{return this.endTime;}
setupDataGrid(dataGrid)
{if(this._timelineDataGrid){this._timelineDataGrid.filterDelegate=null;this._timelineDataGrid.removeEventListener(WebInspector.DataGrid.Event.SelectedNodeChanged,this._timelineDataGridSelectedNodeChanged,this);this._timelineDataGrid.removeEventListener(WebInspector.DataGrid.Event.NodeWasFiltered,this._timelineDataGridNodeWasFiltered,this);this._timelineDataGrid.removeEventListener(WebInspector.DataGrid.Event.FilterDidChange,this.filterDidChange,this);}
this._timelineDataGrid=dataGrid;this._timelineDataGrid.filterDelegate=this;this._timelineDataGrid.addEventListener(WebInspector.DataGrid.Event.SelectedNodeChanged,this._timelineDataGridSelectedNodeChanged,this);this._timelineDataGrid.addEventListener(WebInspector.DataGrid.Event.NodeWasFiltered,this._timelineDataGridNodeWasFiltered,this);this._timelineDataGrid.addEventListener(WebInspector.DataGrid.Event.FilterDidChange,this.filterDidChange,this);}
selectRecord(record)
{if(!this._timelineDataGrid)
return;let selectedDataGridNode=this._timelineDataGrid.selectedNode;if(!record){if(selectedDataGridNode)
selectedDataGridNode.deselect();return;}
let dataGridNode=this._timelineDataGrid.findNode((node)=>node.record===record);if(!dataGridNode||dataGridNode.selected)
return;if(selectedDataGridNode&&selectedDataGridNode.hasAncestor(dataGridNode))
return;dataGridNode.revealAndSelect();}
reset()
{}
updateFilter(filters)
{if(!this._timelineDataGrid)
return;this._timelineDataGrid.filterText=filters?filters.text:"";}
matchDataGridNodeAgainstCustomFilters(node)
{return true;}
needsLayout()
{if(!this.visible)
return;super.needsLayout();}
dataGridMatchNodeAgainstCustomFilters(node)
{if(!this.matchDataGridNodeAgainstCustomFilters(node))
return false;let startTime=this.filterStartTime;let endTime=this.filterEndTime;let currentTime=this.currentTime;function checkTimeBounds(itemStartTime,itemEndTime)
{itemStartTime=itemStartTime||currentTime;itemEndTime=itemEndTime||currentTime;return startTime<=itemEndTime&&itemStartTime<=endTime;}
if(node instanceof WebInspector.ResourceTimelineDataGridNode){let resource=node.resource;return checkTimeBounds(resource.requestSentTimestamp,resource.finishedOrFailedTimestamp);}
if(node instanceof WebInspector.SourceCodeTimelineTimelineDataGridNode){let sourceCodeTimeline=node.sourceCodeTimeline;if(!checkTimeBounds(sourceCodeTimeline.startTime,sourceCodeTimeline.endTime))
return false;for(let record of sourceCodeTimeline.records){if(checkTimeBounds(record.startTime,record.endTime))
return true;}
return false;}
if(node instanceof WebInspector.ProfileNodeDataGridNode){let profileNode=node.profileNode;if(checkTimeBounds(profileNode.startTime,profileNode.endTime))
return true;return false;}
if(node instanceof WebInspector.TimelineDataGridNode){let record=node.record;return checkTimeBounds(record.startTime,record.endTime);}
if(node instanceof WebInspector.ProfileDataGridNode)
return node.callingContextTreeNode.hasStackTraceInTimeRange(startTime,endTime);console.error("Unknown DataGridNode, can't filter by time.");return true;}
userSelectedRecordFromOverview(timelineRecord)
{}
filterDidChange()
{}
_timelineDataGridSelectedNodeChanged(event)
{this.dispatchEventToListeners(WebInspector.ContentView.Event.SelectionPathComponentsDidChange);}
_timelineDataGridNodeWasFiltered(event)
{let node=event.data.node;if(!(node instanceof WebInspector.TimelineDataGridNode))
return;this.dispatchEventToListeners(WebInspector.TimelineView.Event.RecordWasFiltered,{record:node.record,filtered:node.hidden});}
_timesDidChange()
{if(!WebInspector.timelineManager.isCapturing()||this.showsLiveRecordingData)
this.needsLayout();}
_scheduleFilterDidChange()
{if(!this._timelineDataGrid||this._updateFilterTimeout)
return;this._updateFilterTimeout=setTimeout(()=>{this._updateFilterTimeout=undefined;this._timelineDataGrid.filterDidChange();},0);}};WebInspector.TimelineView.Event={RecordWasFiltered:"record-was-filtered"};WebInspector.TreeElement=class TreeElement extends WebInspector.Object
{constructor(title,representedObject,hasChildren)
{super();this._title=title;this.representedObject=(representedObject||{});if(this.representedObject.__treeElementIdentifier)
this.identifier=this.representedObject.__treeElementIdentifier;else{this.identifier=WebInspector.TreeOutline._knownTreeElementNextIdentifier++;this.representedObject.__treeElementIdentifier=this.identifier;}
this._hidden=false;this._selectable=true;this.expanded=false;this.selected=false;this.hasChildren=hasChildren;this.children=[];this.treeOutline=null;this.parent=null;this.previousSibling=null;this.nextSibling=null;this._listItemNode=null;}
appendChild(){return WebInspector.TreeOutline.prototype.appendChild.apply(this,arguments);}
insertChild(){return WebInspector.TreeOutline.prototype.insertChild.apply(this,arguments);}
removeChild(){return WebInspector.TreeOutline.prototype.removeChild.apply(this,arguments);}
removeChildAtIndex(){return WebInspector.TreeOutline.prototype.removeChildAtIndex.apply(this,arguments);}
removeChildren(){return WebInspector.TreeOutline.prototype.removeChildren.apply(this,arguments);}
removeChildrenRecursive(){return WebInspector.TreeOutline.prototype.removeChildrenRecursive.apply(this,arguments);}
selfOrDescendant(){return WebInspector.TreeOutline.prototype.selfOrDescendant.apply(this,arguments);}
get arrowToggleWidth()
{return 10;}
get selectable()
{if(this._hidden)
return false;return this._selectable;}
set selectable(x)
{this._selectable=x;}
get listItemElement()
{return this._listItemNode;}
get title()
{return this._title;}
set title(x)
{this._title=x;this._setListItemNodeContent();this.didChange();}
get titleHTML()
{return this._titleHTML;}
set titleHTML(x)
{this._titleHTML=x;this._setListItemNodeContent();this.didChange();}
get tooltip()
{return this._tooltip;}
set tooltip(x)
{this._tooltip=x;if(this._listItemNode)
this._listItemNode.title=x?x:"";}
get hasChildren()
{return this._hasChildren;}
set hasChildren(x)
{if(this._hasChildren===x)
return;this._hasChildren=x;if(!this._listItemNode)
return;if(x)
this._listItemNode.classList.add("parent");else{this._listItemNode.classList.remove("parent");this.collapse();}
this.didChange();}
get hidden()
{return this._hidden;}
set hidden(x)
{if(this._hidden===x)
return;this._hidden=x;if(this._listItemNode)
this._listItemNode.hidden=this._hidden;if(this._childrenListNode)
this._childrenListNode.hidden=this._hidden;if(this.treeOutline)
this.treeOutline.dispatchEventToListeners(WebInspector.TreeOutline.Event.ElementVisibilityDidChange,{element:this});}
get shouldRefreshChildren()
{return this._shouldRefreshChildren;}
set shouldRefreshChildren(x)
{this._shouldRefreshChildren=x;if(x&&this.expanded)
this.expand();}
_fireDidChange()
{if(this.treeOutline)
this.treeOutline._treeElementDidChange(this);}
didChange()
{if(!this.treeOutline)
return;this.onNextFrame._fireDidChange();}
_setListItemNodeContent()
{if(!this._listItemNode)
return;if(!this._titleHTML&&!this._title)
this._listItemNode.removeChildren();else if(typeof this._titleHTML==="string")
this._listItemNode.innerHTML=this._titleHTML;else if(typeof this._title==="string")
this._listItemNode.textContent=this._title;else{this._listItemNode.removeChildren();if(this._title.parentNode)
this._title.parentNode.removeChild(this._title);this._listItemNode.appendChild(this._title);}}
_attach()
{if(!this._listItemNode||this.parent._shouldRefreshChildren){if(this._listItemNode&&this._listItemNode.parentNode)
this._listItemNode.parentNode.removeChild(this._listItemNode);this._listItemNode=this.treeOutline._childrenListNode.ownerDocument.createElement("li");this._listItemNode.treeElement=this;this._setListItemNodeContent();this._listItemNode.title=this._tooltip?this._tooltip:"";this._listItemNode.hidden=this.hidden;if(this.hasChildren)
this._listItemNode.classList.add("parent");if(this.expanded)
this._listItemNode.classList.add("expanded");if(this.selected)
this._listItemNode.classList.add("selected");this._listItemNode.addEventListener("mousedown",WebInspector.TreeElement.treeElementMouseDown);this._listItemNode.addEventListener("click",WebInspector.TreeElement.treeElementToggled);this._listItemNode.addEventListener("dblclick",WebInspector.TreeElement.treeElementDoubleClicked);if(this.onattach)
this.onattach(this);}
var nextSibling=null;if(this.nextSibling&&this.nextSibling._listItemNode&&this.nextSibling._listItemNode.parentNode===this.parent._childrenListNode)
nextSibling=this.nextSibling._listItemNode;this.parent._childrenListNode.insertBefore(this._listItemNode,nextSibling);if(this._childrenListNode)
this.parent._childrenListNode.insertBefore(this._childrenListNode,this._listItemNode.nextSibling);if(this.selected)
this.select();if(this.expanded)
this.expand();}
_detach()
{if(this.ondetach)
this.ondetach(this);if(this._listItemNode&&this._listItemNode.parentNode)
this._listItemNode.parentNode.removeChild(this._listItemNode);if(this._childrenListNode&&this._childrenListNode.parentNode)
this._childrenListNode.parentNode.removeChild(this._childrenListNode);}
static treeElementMouseDown(event)
{var element=event.currentTarget;if(!element||!element.treeElement||!element.treeElement.selectable)
return;if(element.treeElement.isEventWithinDisclosureTriangle(event)){event.preventDefault();return;}
element.treeElement.selectOnMouseDown(event);}
static treeElementToggled(event)
{var element=event.currentTarget;if(!element||!element.treeElement)
return;var toggleOnClick=element.treeElement.toggleOnClick&&!element.treeElement.selectable;var isInTriangle=element.treeElement.isEventWithinDisclosureTriangle(event);if(!toggleOnClick&&!isInTriangle)
return;if(element.treeElement.expanded){if(event.altKey)
element.treeElement.collapseRecursively();else
element.treeElement.collapse();}else{if(event.altKey)
element.treeElement.expandRecursively();else
element.treeElement.expand();}
event.stopPropagation();}
static treeElementDoubleClicked(event)
{var element=event.currentTarget;if(!element||!element.treeElement)
return;if(element.treeElement.isEventWithinDisclosureTriangle(event))
return;if(element.treeElement.dispatchEventToListeners(WebInspector.TreeElement.Event.DoubleClick))
return;if(element.treeElement.ondblclick)
element.treeElement.ondblclick.call(element.treeElement,event);else if(element.treeElement.hasChildren&&!element.treeElement.expanded)
element.treeElement.expand();}
collapse()
{if(this._listItemNode)
this._listItemNode.classList.remove("expanded");if(this._childrenListNode)
this._childrenListNode.classList.remove("expanded");this.expanded=false;if(this.treeOutline)
this.treeOutline._treeElementsExpandedState[this.identifier]=false;if(this.oncollapse)
this.oncollapse(this);if(this.treeOutline)
this.treeOutline.dispatchEventToListeners(WebInspector.TreeOutline.Event.ElementDisclosureDidChanged,{element:this});}
collapseRecursively()
{var item=this;while(item){if(item.expanded)
item.collapse();item=item.traverseNextTreeElement(false,this,true);}}
expand()
{if(this.expanded&&!this._shouldRefreshChildren&&this._childrenListNode)
return;
this.expanded=true;if(this.treeOutline)
this.treeOutline._treeElementsExpandedState[this.identifier]=true;if(!this.hasChildren)
return;if(this.treeOutline&&(!this._childrenListNode||this._shouldRefreshChildren)){if(this._childrenListNode&&this._childrenListNode.parentNode)
this._childrenListNode.parentNode.removeChild(this._childrenListNode);this._childrenListNode=this.treeOutline._childrenListNode.ownerDocument.createElement("ol");this._childrenListNode.parentTreeElement=this;this._childrenListNode.classList.add("children");this._childrenListNode.hidden=this.hidden;this.onpopulate();
this.expanded=true;for(var i=0;i<this.children.length;++i)
this.children[i]._attach();this._shouldRefreshChildren=false;}
if(this._listItemNode){this._listItemNode.classList.add("expanded");if(this._childrenListNode&&this._childrenListNode.parentNode!==this._listItemNode.parentNode)
this.parent._childrenListNode.insertBefore(this._childrenListNode,this._listItemNode.nextSibling);}
if(this._childrenListNode)
this._childrenListNode.classList.add("expanded");if(this.onexpand)
this.onexpand(this);if(this.treeOutline)
this.treeOutline.dispatchEventToListeners(WebInspector.TreeOutline.Event.ElementDisclosureDidChanged,{element:this});}
expandRecursively(maxDepth)
{var item=this;var info={};var depth=0;
if(maxDepth===undefined)
maxDepth=3;while(item){if(depth<maxDepth)
item.expand();item=item.traverseNextTreeElement(false,this,(depth>=maxDepth),info);depth+=info.depthChange;}}
hasAncestor(ancestor)
{if(!ancestor)
return false;var currentNode=this.parent;while(currentNode){if(ancestor===currentNode)
return true;currentNode=currentNode.parent;}
return false;}
reveal()
{var currentAncestor=this.parent;while(currentAncestor&&!currentAncestor.root){if(!currentAncestor.expanded)
currentAncestor.expand();currentAncestor=currentAncestor.parent;}
if(this.onreveal)
this.onreveal(this);}
revealed(ignoreHidden)
{if(!ignoreHidden&&this.hidden)
return false;var currentAncestor=this.parent;while(currentAncestor&&!currentAncestor.root){if(!currentAncestor.expanded)
return false;if(!ignoreHidden&&currentAncestor.hidden)
return false;currentAncestor=currentAncestor.parent;}
return true;}
selectOnMouseDown(event)
{this.select(false,true);}
select(omitFocus,selectedByUser,suppressOnSelect,suppressOnDeselect)
{if(!this.treeOutline||!this.selectable)
return;if(this.selected&&!this.treeOutline.allowsRepeatSelection)
return;if(!omitFocus)
this.treeOutline._childrenListNode.focus();let treeOutline=this.treeOutline;if(!treeOutline)
return;treeOutline.processingSelectionChange=true;
if(!suppressOnSelect)
suppressOnDeselect=true;let deselectedElement=treeOutline.selectedTreeElement;if(!this.selected){if(treeOutline.selectedTreeElement)
treeOutline.selectedTreeElement.deselect(suppressOnDeselect);this.selected=true;treeOutline.selectedTreeElement=this;if(this._listItemNode)
this._listItemNode.classList.add("selected");}
if(!suppressOnSelect){if(this.onselect)
this.onselect(this,selectedByUser);treeOutline.dispatchEventToListeners(WebInspector.TreeOutline.Event.SelectionDidChange,{selectedElement:this,deselectedElement,selectedByUser});}
treeOutline.processingSelectionChange=false;let treeOutlineGroup=WebInspector.TreeOutlineGroup.groupForTreeOutline(treeOutline);if(!treeOutlineGroup)
return;treeOutlineGroup.didSelectTreeElement(this);}
revealAndSelect(omitFocus,selectedByUser,suppressOnSelect,suppressOnDeselect)
{this.reveal();this.select(omitFocus,selectedByUser,suppressOnSelect,suppressOnDeselect);}
deselect(suppressOnDeselect)
{if(!this.treeOutline||this.treeOutline.selectedTreeElement!==this||!this.selected)
return false;this.selected=false;this.treeOutline.selectedTreeElement=null;if(this._listItemNode)
this._listItemNode.classList.remove("selected");if(!suppressOnDeselect){if(this.ondeselect)
this.ondeselect(this);this.treeOutline.dispatchEventToListeners(WebInspector.TreeOutline.Event.SelectionDidChange,{deselectedElement:this});}
return true;}
onpopulate()
{}
traverseNextTreeElement(skipUnrevealed,stayWithin,dontPopulate,info)
{function shouldSkip(element){return skipUnrevealed&&!element.revealed(true);}
var depthChange=0;var element=this;if(!dontPopulate)
element.onpopulate();do{if(element.hasChildren&&element.children[0]&&(!skipUnrevealed||element.expanded)){element=element.children[0];depthChange+=1;}else{while(element&&!element.nextSibling&&element.parent&&!element.parent.root&&element.parent!==stayWithin){element=element.parent;depthChange-=1;}
if(element)
element=element.nextSibling;}}while(element&&shouldSkip(element));if(info)
info.depthChange=depthChange;return element;}
traversePreviousTreeElement(skipUnrevealed,dontPopulate)
{function shouldSkip(element){return skipUnrevealed&&!element.revealed(true);}
var element=this;do{if(element.previousSibling){element=element.previousSibling;while(element&&element.hasChildren&&element.expanded&&!shouldSkip(element)){if(!dontPopulate)
element.onpopulate();element=element.children.lastValue;}}else
element=element.parent&&element.parent.root?null:element.parent;}while(element&&shouldSkip(element));return element;}
isEventWithinDisclosureTriangle(event)
{if(!document.contains(this._listItemNode))
return false;let computedStyle=window.getComputedStyle(this._listItemNode);let start=0;if(WebInspector.resolvedLayoutDirection()===WebInspector.LayoutDirection.RTL)
start+=this._listItemNode.totalOffsetRight-computedStyle.getPropertyCSSValue("padding-right").getFloatValue(CSSPrimitiveValue.CSS_PX)-this.arrowToggleWidth;else
start+=this._listItemNode.totalOffsetLeft+computedStyle.getPropertyCSSValue("padding-left").getFloatValue(CSSPrimitiveValue.CSS_PX);return event.pageX>=start&&event.pageX<=start+this.arrowToggleWidth&&this.hasChildren;}
populateContextMenu(contextMenu,event)
{if(this.children.some((child)=>child.hasChildren)||(this.hasChildren&&!this.children.length)){contextMenu.appendSeparator();contextMenu.appendItem(WebInspector.UIString("Expand All"),this.expandRecursively.bind(this));contextMenu.appendItem(WebInspector.UIString("Collapse All"),this.collapseRecursively.bind(this));}}};WebInspector.TreeElement.Event={DoubleClick:"tree-element-double-click",};WebInspector.TreeOutline=class TreeOutline extends WebInspector.Object
{constructor(element)
{super();this.element=element||document.createElement("ol");this.element.classList.add(WebInspector.TreeOutline.ElementStyleClassName);this.element.addEventListener("contextmenu",this._handleContextmenu.bind(this));this.children=[];this.selectedTreeElement=null;this._childrenListNode=this.element;this._childrenListNode.removeChildren();this._knownTreeElements=[];this._treeElementsExpandedState=[];this.allowsRepeatSelection=false;this.root=true;this.hasChildren=false;this.expanded=true;this.selected=false;this.treeOutline=this;this._hidden=false;this._compact=false;this._large=false;this._disclosureButtons=true;this._customIndent=false;this._childrenListNode.tabIndex=0;this._childrenListNode.addEventListener("keydown",this._treeKeyDown.bind(this),true);WebInspector.TreeOutline._generateStyleRulesIfNeeded();}
get hidden()
{return this._hidden;}
set hidden(x)
{if(this._hidden===x)
return;this._hidden=x;this.element.hidden=this._hidden;}
get compact()
{return this._compact;}
set compact(x)
{if(this._compact===x)
return;this._compact=x;if(this._compact)
this.large=false;this.element.classList.toggle("compact",this._compact);}
get large()
{return this._large;}
set large(x)
{if(this._large===x)
return;this._large=x;if(this._large)
this.compact=false;this.element.classList.toggle("large",this._large);}
get disclosureButtons()
{return this._disclosureButtons;}
set disclosureButtons(x)
{if(this._disclosureButtons===x)
return;this._disclosureButtons=x;this.element.classList.toggle("hide-disclosure-buttons",!this._disclosureButtons);}
get customIndent()
{return this._customIndent;}
set customIndent(x)
{if(this._customIndent===x)
return;this._customIndent=x;this.element.classList.toggle(WebInspector.TreeOutline.CustomIndentStyleClassName,this._customIndent);}
appendChild(child)
{if(!child)
return;var lastChild=this.children[this.children.length-1];if(lastChild){lastChild.nextSibling=child;child.previousSibling=lastChild;}else{child.previousSibling=null;child.nextSibling=null;}
var isFirstChild=!this.children.length;this.children.push(child);this.hasChildren=true;child.parent=this;child.treeOutline=this.treeOutline;child.treeOutline._rememberTreeElement(child);var current=child.children[0];while(current){current.treeOutline=this.treeOutline;current.treeOutline._rememberTreeElement(current);current=current.traverseNextTreeElement(false,child,true);}
if(child.hasChildren&&child.treeOutline._treeElementsExpandedState[child.identifier]!==undefined)
child.expanded=child.treeOutline._treeElementsExpandedState[child.identifier];if(this._childrenListNode)
child._attach();if(this.treeOutline)
this.treeOutline.dispatchEventToListeners(WebInspector.TreeOutline.Event.ElementAdded,{element:child});if(isFirstChild&&this.expanded)
this.expand();}
insertChild(child,index)
{if(!child)
return;var previousChild=(index>0?this.children[index-1]:null);if(previousChild){previousChild.nextSibling=child;child.previousSibling=previousChild;}else{child.previousSibling=null;}
var nextChild=this.children[index];if(nextChild){nextChild.previousSibling=child;child.nextSibling=nextChild;}else{child.nextSibling=null;}
var isFirstChild=!this.children.length;this.children.splice(index,0,child);this.hasChildren=true;child.parent=this;child.treeOutline=this.treeOutline;child.treeOutline._rememberTreeElement(child);var current=child.children[0];while(current){current.treeOutline=this.treeOutline;current.treeOutline._rememberTreeElement(current);current=current.traverseNextTreeElement(false,child,true);}
if(child.hasChildren&&child.treeOutline._treeElementsExpandedState[child.identifier]!==undefined)
child.expanded=child.treeOutline._treeElementsExpandedState[child.identifier];if(this._childrenListNode)
child._attach();if(this.treeOutline)
this.treeOutline.dispatchEventToListeners(WebInspector.TreeOutline.Event.ElementAdded,{element:child});if(isFirstChild&&this.expanded)
this.expand();}
removeChildAtIndex(childIndex,suppressOnDeselect,suppressSelectSibling)
{if(childIndex<0||childIndex>=this.children.length)
return;let child=this.children[childIndex];this.children.splice(childIndex,1);let parent=child.parent;if(child.deselect(suppressOnDeselect)){if(child.previousSibling&&!suppressSelectSibling)
child.previousSibling.select(true,false);else if(child.nextSibling&&!suppressSelectSibling)
child.nextSibling.select(true,false);else if(!suppressSelectSibling)
parent.select(true,false);}
if(child.previousSibling)
child.previousSibling.nextSibling=child.nextSibling;if(child.nextSibling)
child.nextSibling.previousSibling=child.previousSibling;let treeOutline=child.treeOutline;if(treeOutline){treeOutline._forgetTreeElement(child);treeOutline._forgetChildrenRecursive(child);}
child._detach();child.treeOutline=null;child.parent=null;child.nextSibling=null;child.previousSibling=null;if(treeOutline)
treeOutline.dispatchEventToListeners(WebInspector.TreeOutline.Event.ElementRemoved,{element:child});}
removeChild(child,suppressOnDeselect,suppressSelectSibling)
{if(!child)
return;var childIndex=this.children.indexOf(child);if(childIndex===-1)
return;this.removeChildAtIndex(childIndex,suppressOnDeselect,suppressSelectSibling);if(!this.children.length){if(this._listItemNode)
this._listItemNode.classList.remove("parent");this.hasChildren=false;}}
removeChildren(suppressOnDeselect)
{for(let child of this.children){child.deselect(suppressOnDeselect);let treeOutline=child.treeOutline;if(treeOutline){treeOutline._forgetTreeElement(child);treeOutline._forgetChildrenRecursive(child);}
child._detach();child.treeOutline=null;child.parent=null;child.nextSibling=null;child.previousSibling=null;if(treeOutline)
treeOutline.dispatchEventToListeners(WebInspector.TreeOutline.Event.ElementRemoved,{element:child});}
this.children=[];}
removeChildrenRecursive(suppressOnDeselect)
{let childrenToRemove=this.children;let child=this.children[0];while(child){if(child.children.length)
childrenToRemove=childrenToRemove.concat(child.children);child=child.traverseNextTreeElement(false,this,true);}
for(let child of childrenToRemove){child.deselect(suppressOnDeselect);let treeOutline=child.treeOutline;if(treeOutline)
treeOutline._forgetTreeElement(child);child._detach();child.children=[];child.treeOutline=null;child.parent=null;child.nextSibling=null;child.previousSibling=null;if(treeOutline)
treeOutline.dispatchEventToListeners(WebInspector.TreeOutline.Event.ElementRemoved,{element:child});}
this.children=[];}
reattachIfIndexChanged(treeElement,insertionIndex)
{if(this.children[insertionIndex]===treeElement)
return;let wasSelected=treeElement.selected;if(treeElement.parent===this)
this.removeChild(treeElement);this.insertChild(treeElement,insertionIndex);if(wasSelected)
treeElement.select();}
_rememberTreeElement(element)
{if(!this._knownTreeElements[element.identifier])
this._knownTreeElements[element.identifier]=[]; var elements=this._knownTreeElements[element.identifier];if(elements.indexOf(element)!==-1)
return; elements.push(element);}
_forgetTreeElement(element)
{if(this.selectedTreeElement===element){element.deselect(true);this.selectedTreeElement=null;}
if(this._knownTreeElements[element.identifier])
this._knownTreeElements[element.identifier].remove(element,true);}
_forgetChildrenRecursive(parentElement)
{var child=parentElement.children[0];while(child){this._forgetTreeElement(child);child=child.traverseNextTreeElement(false,parentElement,true);}}
getCachedTreeElement(representedObject)
{if(!representedObject)
return null;if(representedObject.__treeElementIdentifier){
var elements=this._knownTreeElements[representedObject.__treeElementIdentifier];if(elements){for(var i=0;i<elements.length;++i)
if(elements[i].representedObject===representedObject)
return elements[i];}}
return null;}
selfOrDescendant(predicate)
{let treeElements=[this];while(treeElements.length){let treeElement=treeElements.shift();if(predicate(treeElement))
return treeElement;treeElements=treeElements.concat(treeElement.children);}
return false;}
findTreeElement(representedObject,isAncestor,getParent)
{if(!representedObject)
return null;var cachedElement=this.getCachedTreeElement(representedObject);if(cachedElement)
return cachedElement;
var item;var found=false;for(var i=0;i<this.children.length;++i){item=this.children[i];if(item.representedObject===representedObject||(isAncestor&&isAncestor(item.representedObject,representedObject))){found=true;break;}}
if(!found)
return null;var ancestors=[];var currentObject=representedObject;while(currentObject){ancestors.unshift(currentObject);if(currentObject===item.representedObject)
break;currentObject=getParent(currentObject);}
for(var i=0;i<ancestors.length;++i){
if(ancestors[i]===representedObject)
continue;
item=this.findTreeElement(ancestors[i],isAncestor,getParent);if(item)
item.onpopulate();}
return this.getCachedTreeElement(representedObject);}
_treeElementDidChange(treeElement)
{if(treeElement.treeOutline!==this)
return;this.dispatchEventToListeners(WebInspector.TreeOutline.Event.ElementDidChange,{element:treeElement});}
treeElementFromNode(node)
{var listNode=node.enclosingNodeOrSelfWithNodeNameInArray(["ol","li"]);if(listNode)
return listNode.parentTreeElement||listNode.treeElement;return null;}
treeElementFromPoint(x,y)
{var node=this._childrenListNode.ownerDocument.elementFromPoint(x,y);if(!node)
return null;return this.treeElementFromNode(node);}
_treeKeyDown(event)
{if(event.target!==this._childrenListNode)
return;if(!this.selectedTreeElement||event.shiftKey||event.metaKey||event.ctrlKey)
return;let isRTL=WebInspector.resolvedLayoutDirection()===WebInspector.LayoutDirection.RTL;var handled=false;var nextSelectedElement;if(event.keyIdentifier==="Up"&&!event.altKey){nextSelectedElement=this.selectedTreeElement.traversePreviousTreeElement(true);while(nextSelectedElement&&!nextSelectedElement.selectable)
nextSelectedElement=nextSelectedElement.traversePreviousTreeElement(true);handled=nextSelectedElement?true:false;}else if(event.keyIdentifier==="Down"&&!event.altKey){nextSelectedElement=this.selectedTreeElement.traverseNextTreeElement(true);while(nextSelectedElement&&!nextSelectedElement.selectable)
nextSelectedElement=nextSelectedElement.traverseNextTreeElement(true);handled=nextSelectedElement?true:false;}else if((!isRTL&&event.keyIdentifier==="Left")||(isRTL&&event.keyIdentifier==="Right")){if(this.selectedTreeElement.expanded){if(event.altKey)
this.selectedTreeElement.collapseRecursively();else
this.selectedTreeElement.collapse();handled=true;}else if(this.selectedTreeElement.parent&&!this.selectedTreeElement.parent.root){handled=true;if(this.selectedTreeElement.parent.selectable){nextSelectedElement=this.selectedTreeElement.parent;while(nextSelectedElement&&!nextSelectedElement.selectable)
nextSelectedElement=nextSelectedElement.parent;handled=nextSelectedElement?true:false;}else if(this.selectedTreeElement.parent)
this.selectedTreeElement.parent.collapse();}}else if((!isRTL&&event.keyIdentifier==="Right")||(isRTL&&event.keyIdentifier==="Left")){if(!this.selectedTreeElement.revealed()){this.selectedTreeElement.reveal();handled=true;}else if(this.selectedTreeElement.hasChildren){handled=true;if(this.selectedTreeElement.expanded){nextSelectedElement=this.selectedTreeElement.children[0];while(nextSelectedElement&&!nextSelectedElement.selectable)
nextSelectedElement=nextSelectedElement.nextSibling;handled=nextSelectedElement?true:false;}else{if(event.altKey)
this.selectedTreeElement.expandRecursively();else
this.selectedTreeElement.expand();}}}else if(event.keyCode===8||event.keyCode===46){if(this.selectedTreeElement.ondelete)
handled=this.selectedTreeElement.ondelete();if(!handled&&this.treeOutline.ondelete)
handled=this.treeOutline.ondelete(this.selectedTreeElement);}else if(isEnterKey(event)){if(this.selectedTreeElement.onenter)
handled=this.selectedTreeElement.onenter();if(!handled&&this.treeOutline.onenter)
handled=this.treeOutline.onenter(this.selectedTreeElement);}else if(event.keyIdentifier==="U+0020"){if(this.selectedTreeElement.onspace)
handled=this.selectedTreeElement.onspace();if(!handled&&this.treeOutline.onspace)
handled=this.treeOutline.onspace(this.selectedTreeElement);}
if(nextSelectedElement){nextSelectedElement.reveal();nextSelectedElement.select(false,true);}
if(handled){event.preventDefault();event.stopPropagation();}}
expand()
{}
collapse()
{}
revealed()
{return true;}
reveal()
{}
select()
{}
revealAndSelect(omitFocus)
{}
get selectedTreeElementIndex()
{if(!this.hasChildren||!this.selectedTreeElement)
return;for(var i=0;i<this.children.length;++i){if(this.children[i]===this.selectedTreeElement)
return i;}
return false;}
treeElementFromEvent(event)
{let scrollContainer=this.element.parentElement;
let x=scrollContainer.totalOffsetLeft+scrollContainer.offsetWidth-36;let y=event.pageY;
let elementUnderMouse=this.treeElementFromPoint(x,y);let elementAboveMouse=this.treeElementFromPoint(x,y-2);let element=null;if(elementUnderMouse===elementAboveMouse)
element=elementUnderMouse;else
element=this.treeElementFromPoint(x,y+2);return element;}
populateContextMenu(contextMenu,event,treeElement)
{treeElement.populateContextMenu(contextMenu,event);}
static _generateStyleRulesIfNeeded()
{if(WebInspector.TreeOutline._styleElement)
return;WebInspector.TreeOutline._styleElement=document.createElement("style");let maximumTreeDepth=32;let baseLeftPadding=5;let depthPadding=10;let styleText="";let childrenSubstring="";for(let i=1;i<=maximumTreeDepth;++i){childrenSubstring+=i===maximumTreeDepth?" .children":" > .children";styleText+=`.${WebInspector.TreeOutline.ElementStyleClassName}:not(.${WebInspector.TreeOutline.CustomIndentStyleClassName})${childrenSubstring} > .item { `;if(WebInspector.resolvedLayoutDirection()===WebInspector.LayoutDirection.RTL)
styleText+="padding-right: ";else
styleText+="padding-left: ";styleText+=(baseLeftPadding+(depthPadding*i))+"px; }\n";}
WebInspector.TreeOutline._styleElement.textContent=styleText;document.head.appendChild(WebInspector.TreeOutline._styleElement);}
_handleContextmenu(event)
{let treeElement=this.treeElementFromEvent(event);if(!treeElement)
return;let contextMenu=WebInspector.ContextMenu.createFromEvent(event);this.populateContextMenu(contextMenu,event,treeElement);}};WebInspector.TreeOutline._styleElement=null;WebInspector.TreeOutline.ElementStyleClassName="tree-outline";WebInspector.TreeOutline.CustomIndentStyleClassName="custom-indent";WebInspector.TreeOutline.Event={ElementAdded:Symbol("element-added"),ElementDidChange:Symbol("element-did-change"),ElementRemoved:Symbol("element-removed"),ElementDisclosureDidChanged:Symbol("element-disclosure-did-change"),ElementVisibilityDidChange:Symbol("element-visbility-did-change"),SelectionDidChange:Symbol("selection-did-change")};WebInspector.TreeOutline._knownTreeElementNextIdentifier=1;WebInspector.TreeOutlineGroup=class TreeOutlineGroup extends WebInspector.Collection
{constructor()
{super((object)=>object instanceof WebInspector.TreeOutline);}
static groupForTreeOutline(treeOutline)
{return treeOutline[WebInspector.TreeOutlineGroup.GroupForTreeOutlineSymbol]||null;}
get selectedTreeElement()
{for(let treeOutline of this.items){if(treeOutline.selectedTreeElement)
return treeOutline.selectedTreeElement;}
return null;}
itemAdded(treeOutline)
{treeOutline[WebInspector.TreeOutlineGroup.GroupForTreeOutlineSymbol]=this;if(treeOutline.selectedTreeElement)
this._removeConflictingTreeSelections(treeOutline.selectedTreeElement);}
itemRemoved(treeOutline)
{treeOutline[WebInspector.TreeOutlineGroup.GroupForTreeOutlineSymbol]=null;}
didSelectTreeElement(treeElement)
{if(!treeElement)
return;this._removeConflictingTreeSelections(treeElement);}
_removeConflictingTreeSelections(treeElement)
{let selectedTreeOutline=treeElement.treeOutline;for(let treeOutline of this.items){if(selectedTreeOutline===treeOutline)
continue;if(treeOutline.selectedTreeElement)
treeOutline.selectedTreeElement.deselect();}}};WebInspector.TreeOutlineGroup.GroupForTreeOutlineSymbol=Symbol("group-for-tree-outline");WebInspector.ButtonNavigationItem=class ButtonNavigationItem extends WebInspector.NavigationItem
{constructor(identifier,toolTipOrLabel,image,imageWidth,imageHeight,role,label)
{super(identifier);this.toolTip=toolTipOrLabel;this._element.addEventListener("click",this._mouseClicked.bind(this));this._element.setAttribute("role",role||"button");if(label)
this._element.setAttribute("aria-label",label);this._imageWidth=imageWidth||16;this._imageHeight=imageHeight||16;if(image)
this.image=image;else
this.label=toolTipOrLabel;}
get toolTip()
{return this._element.title;}
set toolTip(newToolTip)
{if(!newToolTip)
return;this._element.title=newToolTip;}
get label()
{return this._element.textContent;}
set label(newLabel)
{this._element.classList.add(WebInspector.ButtonNavigationItem.TextOnlyClassName);this._element.textContent=newLabel||"";if(this.parentNavigationBar)
this.parentNavigationBar.needsLayout();}
get image()
{return this._image;}
set image(newImage)
{if(!newImage){this._element.removeChildren();return;}
this._element.removeChildren();this._element.classList.remove(WebInspector.ButtonNavigationItem.TextOnlyClassName);this._image=newImage;this._glyphElement=useSVGSymbol(this._image,"glyph");this._glyphElement.style.width=this._imageWidth+"px";this._glyphElement.style.height=this._imageHeight+"px";this._element.appendChild(this._glyphElement);}
get enabled()
{return!this._element.classList.contains(WebInspector.ButtonNavigationItem.DisabledStyleClassName);}
set enabled(flag)
{if(flag)
this._element.classList.remove(WebInspector.ButtonNavigationItem.DisabledStyleClassName);else
this._element.classList.add(WebInspector.ButtonNavigationItem.DisabledStyleClassName);}
get additionalClassNames()
{return["button"];}
_mouseClicked(event)
{if(!this.enabled)
return;this.dispatchEventToListeners(WebInspector.ButtonNavigationItem.Event.Clicked);}};WebInspector.ButtonNavigationItem.DisabledStyleClassName="disabled";WebInspector.ButtonNavigationItem.TextOnlyClassName="text-only";WebInspector.ButtonNavigationItem.Event={Clicked:"button-navigation-item-clicked"};WebInspector.DatabaseUserQueryViewBase=class DatabaseUserQueryViewBase extends WebInspector.View
{constructor(query)
{super();this.element.className="database-user-query";let commandTextElement=document.createElement("span");commandTextElement.className="database-query-text";commandTextElement.textContent=query;this.element.appendChild(commandTextElement);this._resultElement=document.createElement("div");this._resultElement.className="database-query-result";this.element.appendChild(this._resultElement);}
get resultElement()
{return this._resultElement;}};WebInspector.DatabaseUserQueryErrorView=class DatabaseUserQueryErrorView extends WebInspector.DatabaseUserQueryViewBase
{constructor(query,message)
{super(query);this.resultElement.classList.add("error");this.resultElement.textContent=message;}};WebInspector.DatabaseUserQuerySuccessView=class DatabaseUserQuerySuccessView extends WebInspector.DatabaseUserQueryViewBase
{constructor(query,columnNames,values)
{super(query);this._dataGrid=WebInspector.DataGrid.createSortableDataGrid(columnNames,values);if(this._dataGrid){this._dataGrid.inline=true;this.resultElement.appendChild(this._dataGrid.element);this._dataGrid.updateLayoutIfNeeded();}else{this.resultElement.classList.add("no-results");this.resultElement.textContent=WebInspector.UIString("Query returned no results.");}}
get dataGrid()
{return this._dataGrid;}
layout()
{if(this._dataGrid)
this._dataGrid.updateLayout();}};WebInspector.DOMTreeContentView=class DOMTreeContentView extends WebInspector.ContentView
{constructor(representedObject)
{super(representedObject);this._compositingBordersButtonNavigationItem=new WebInspector.ActivateButtonNavigationItem("layer-borders",WebInspector.UIString("Show compositing borders"),WebInspector.UIString("Hide compositing borders"),"Images/LayerBorders.svg",13,13);this._compositingBordersButtonNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,this._toggleCompositingBorders,this);this._compositingBordersButtonNavigationItem.enabled=!!PageAgent.getCompositingBordersVisible;WebInspector.showPaintRectsSetting.addEventListener(WebInspector.Setting.Event.Changed,this._showPaintRectsSettingChanged,this);this._paintFlashingButtonNavigationItem=new WebInspector.ActivateButtonNavigationItem("paint-flashing",WebInspector.UIString("Enable paint flashing"),WebInspector.UIString("Disable paint flashing"),"Images/PaintFlashing.svg",16,16);this._paintFlashingButtonNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,this._togglePaintFlashing,this);this._paintFlashingButtonNavigationItem.enabled=!!PageAgent.setShowPaintRects;this._paintFlashingButtonNavigationItem.activated=PageAgent.setShowPaintRects&&WebInspector.showPaintRectsSetting.value;WebInspector.showShadowDOMSetting.addEventListener(WebInspector.Setting.Event.Changed,this._showShadowDOMSettingChanged,this);this._showsShadowDOMButtonNavigationItem=new WebInspector.ActivateButtonNavigationItem("shows-shadow-DOM",WebInspector.UIString("Show shadow DOM nodes"),WebInspector.UIString("Hide shadow DOM nodes"),"Images/ShadowDOM.svg",13,13);this._showsShadowDOMButtonNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,this._toggleShowsShadowDOMSetting,this);this._showShadowDOMSettingChanged();WebInspector.showPrintStylesSetting.addEventListener(WebInspector.Setting.Event.Changed,this._showPrintStylesSettingChanged,this);this._showPrintStylesButtonNavigationItem=new WebInspector.ActivateButtonNavigationItem("print-styles",WebInspector.UIString("Force Print Media Styles"),WebInspector.UIString("Use Default Media Styles"),"Images/Printer.svg",16,16);this._showPrintStylesButtonNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,this._togglePrintStylesSetting,this);this._showPrintStylesSettingChanged();this.element.classList.add("dom-tree");this.element.addEventListener("click",this._mouseWasClicked.bind(this),false);this._domTreeOutline=new WebInspector.DOMTreeOutline(true,true,true);this._domTreeOutline.addEventListener(WebInspector.TreeOutline.Event.ElementAdded,this._domTreeElementAdded,this);this._domTreeOutline.addEventListener(WebInspector.DOMTreeOutline.Event.SelectedNodeChanged,this._selectedNodeDidChange,this);this._domTreeOutline.wireToDomAgent();this._domTreeOutline.editable=true;this.element.appendChild(this._domTreeOutline.element);WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.AttributeModified,this._domNodeChanged,this);WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.AttributeRemoved,this._domNodeChanged,this);WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.CharacterDataModified,this._domNodeChanged,this);this._lastSelectedNodePathSetting=new WebInspector.Setting("last-selected-node-path",null);this._numberOfSearchResults=null;this._breakpointGutterEnabled=false;this._pendingBreakpointNodeIdentifiers=new Set;if(WebInspector.domDebuggerManager.supported){WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.BreakpointsEnabledDidChange,this._breakpointsEnabledDidChange,this);WebInspector.domDebuggerManager.addEventListener(WebInspector.DOMDebuggerManager.Event.DOMBreakpointAdded,this._domBreakpointAddedOrRemoved,this);WebInspector.domDebuggerManager.addEventListener(WebInspector.DOMDebuggerManager.Event.DOMBreakpointRemoved,this._domBreakpointAddedOrRemoved,this);WebInspector.DOMBreakpoint.addEventListener(WebInspector.DOMBreakpoint.Event.DisabledStateDidChange,this._domBreakpointDisabledStateDidChange,this);WebInspector.DOMBreakpoint.addEventListener(WebInspector.DOMBreakpoint.Event.ResolvedStateDidChange,this._domBreakpointResolvedStateDidChange,this);this._breakpointsEnabledDidChange();}}
get navigationItems()
{return[this._showPrintStylesButtonNavigationItem,this._showsShadowDOMButtonNavigationItem,this._compositingBordersButtonNavigationItem,this._paintFlashingButtonNavigationItem];}
get domTreeOutline()
{return this._domTreeOutline;}
get scrollableElements()
{return[this.element];}
get breakpointGutterEnabled()
{return this._breakpointGutterEnabled;}
set breakpointGutterEnabled(flag)
{if(this._breakpointGutterEnabled===flag)
return;this._breakpointGutterEnabled=flag;this.element.classList.toggle("show-gutter",this._breakpointGutterEnabled);}
shown()
{super.shown();this._domTreeOutline.setVisible(true,WebInspector.isConsoleFocused());this._updateCompositingBordersButtonToMatchPageSettings();if(!this._domTreeOutline.rootDOMNode)
return;this._restoreBreakpointsAfterUpdate();}
hidden()
{super.hidden();WebInspector.domTreeManager.hideDOMNodeHighlight();this._domTreeOutline.setVisible(false);}
closed()
{super.closed();WebInspector.showPaintRectsSetting.removeEventListener(null,null,this);WebInspector.showShadowDOMSetting.removeEventListener(null,null,this);WebInspector.debuggerManager.removeEventListener(null,null,this);WebInspector.domTreeManager.removeEventListener(null,null,this);WebInspector.domDebuggerManager.removeEventListener(null,null,this);WebInspector.DOMBreakpoint.removeEventListener(null,null,this);this._domTreeOutline.close();this._pendingBreakpointNodeIdentifiers.clear();}
get selectionPathComponents()
{var treeElement=this._domTreeOutline.selectedTreeElement;var pathComponents=[];while(treeElement&&!treeElement.root){
if(treeElement.isCloseTag()){treeElement=treeElement.parent;continue;}
var pathComponent=new WebInspector.DOMTreeElementPathComponent(treeElement,treeElement.representedObject);pathComponent.addEventListener(WebInspector.HierarchicalPathComponent.Event.Clicked,this._pathComponentSelected,this);pathComponents.unshift(pathComponent);treeElement=treeElement.parent;}
return pathComponents;}
restoreFromCookie(cookie)
{if(!cookie||!cookie.nodeToSelect)
return;this.selectAndRevealDOMNode(cookie.nodeToSelect);
cookie.nodeToSelect=undefined;}
selectAndRevealDOMNode(domNode,preventFocusChange)
{this._domTreeOutline.selectDOMNode(domNode,!preventFocusChange);}
handleCopyEvent(event)
{var selectedDOMNode=this._domTreeOutline.selectedDOMNode();if(!selectedDOMNode)
return;event.clipboardData.clearData();event.preventDefault();selectedDOMNode.copyNode();}
get supportsSave()
{return WebInspector.canArchiveMainFrame();}
get saveData()
{function saveHandler(forceSaveAs)
{WebInspector.archiveMainFrame();}
return{customSaveHandler:saveHandler};}
get supportsSearch()
{return true;}
get numberOfSearchResults()
{return this._numberOfSearchResults;}
get hasPerformedSearch()
{return this._numberOfSearchResults!==null;}
set automaticallyRevealFirstSearchResult(reveal)
{this._automaticallyRevealFirstSearchResult=reveal;if(this._automaticallyRevealFirstSearchResult&&this._numberOfSearchResults>0){if(this._currentSearchResultIndex===-1)
this.revealNextSearchResult();}}
performSearch(query)
{if(this._searchQuery===query)
return;if(this._searchIdentifier){DOMAgent.discardSearchResults(this._searchIdentifier);this._hideSearchHighlights();}
this._searchQuery=query;this._searchIdentifier=null;this._numberOfSearchResults=null;this._currentSearchResultIndex=-1;function searchResultsReady(error,searchIdentifier,resultsCount)
{if(error)
return;this._searchIdentifier=searchIdentifier;this._numberOfSearchResults=resultsCount;this.dispatchEventToListeners(WebInspector.ContentView.Event.NumberOfSearchResultsDidChange);this._showSearchHighlights();if(this._automaticallyRevealFirstSearchResult)
this.revealNextSearchResult();}
function contextNodesReady(nodeIds)
{DOMAgent.performSearch(query,nodeIds,searchResultsReady.bind(this));}
this.getSearchContextNodes(contextNodesReady.bind(this));}
getSearchContextNodes(callback)
{callback(undefined);}
searchCleared()
{if(this._searchIdentifier){DOMAgent.discardSearchResults(this._searchIdentifier);this._hideSearchHighlights();}
this._searchQuery=null;this._searchIdentifier=null;this._numberOfSearchResults=null;this._currentSearchResultIndex=-1;}
revealPreviousSearchResult(changeFocus)
{if(!this._numberOfSearchResults)
return;if(this._currentSearchResultIndex>0)
--this._currentSearchResultIndex;else
this._currentSearchResultIndex=this._numberOfSearchResults-1;this._revealSearchResult(this._currentSearchResultIndex,changeFocus);}
revealNextSearchResult(changeFocus)
{if(!this._numberOfSearchResults)
return;if(this._currentSearchResultIndex+1<this._numberOfSearchResults)
++this._currentSearchResultIndex;else
this._currentSearchResultIndex=0;this._revealSearchResult(this._currentSearchResultIndex,changeFocus);}
layout()
{this._domTreeOutline.updateSelection();}
_revealSearchResult(index,changeFocus)
{var searchIdentifier=this._searchIdentifier;function revealResult(error,nodeIdentifiers)
{if(error)
return;if(this._searchIdentifier!==searchIdentifier)
return;var domNode=WebInspector.domTreeManager.nodeForId(nodeIdentifiers[0]);if(!domNode)
return;this._domTreeOutline.selectDOMNode(domNode,changeFocus);var selectedTreeElement=this._domTreeOutline.selectedTreeElement;if(selectedTreeElement)
selectedTreeElement.emphasizeSearchHighlight();}
DOMAgent.getSearchResults(this._searchIdentifier,index,index+1,revealResult.bind(this));}
_restoreSelectedNodeAfterUpdate(documentURL,defaultNode)
{if(!WebInspector.domTreeManager.restoreSelectedNodeIsAllowed)
return;function selectNode(lastSelectedNode)
{var nodeToFocus=lastSelectedNode;if(!nodeToFocus)
nodeToFocus=defaultNode;if(!nodeToFocus)
return;this._dontSetLastSelectedNodePath=true;this.selectAndRevealDOMNode(nodeToFocus,WebInspector.isConsoleFocused());this._dontSetLastSelectedNodePath=false;if(!lastSelectedNode&&this._domTreeOutline.selectedTreeElement)
this._domTreeOutline.selectedTreeElement.expand();}
function selectLastSelectedNode(nodeId)
{if(!WebInspector.domTreeManager.restoreSelectedNodeIsAllowed)
return;selectNode.call(this,WebInspector.domTreeManager.nodeForId(nodeId));}
if(documentURL&&this._lastSelectedNodePathSetting.value&&this._lastSelectedNodePathSetting.value.path&&this._lastSelectedNodePathSetting.value.url===documentURL.hash)
WebInspector.domTreeManager.pushNodeByPathToFrontend(this._lastSelectedNodePathSetting.value.path,selectLastSelectedNode.bind(this));else
selectNode.call(this);}
_domTreeElementAdded(event)
{if(!this._pendingBreakpointNodeIdentifiers.size)
return;let treeElement=event.data.element;let node=treeElement.representedObject;if(!(node instanceof WebInspector.DOMNode))
return;if(!this._pendingBreakpointNodeIdentifiers.delete(node.id))
return;this._updateBreakpointStatus(node.id);}
_selectedNodeDidChange(event)
{var selectedDOMNode=this._domTreeOutline.selectedDOMNode();if(selectedDOMNode&&!this._dontSetLastSelectedNodePath)
this._lastSelectedNodePathSetting.value={url:WebInspector.frameResourceManager.mainFrame.url.hash,path:selectedDOMNode.path()};if(selectedDOMNode)
ConsoleAgent.addInspectedNode(selectedDOMNode.id);this.dispatchEventToListeners(WebInspector.ContentView.Event.SelectionPathComponentsDidChange);}
_pathComponentSelected(event)
{if(!event.data.pathComponent)
return;this._domTreeOutline.selectDOMNode(event.data.pathComponent.domTreeElement.representedObject,true);}
_domNodeChanged(event)
{var selectedDOMNode=this._domTreeOutline.selectedDOMNode();if(selectedDOMNode!==event.data.node)
return;this.dispatchEventToListeners(WebInspector.ContentView.Event.SelectionPathComponentsDidChange);}
_mouseWasClicked(event)
{var anchorElement=event.target.enclosingNodeOrSelfWithNodeName("a");if(!anchorElement||!anchorElement.href)
return;event.preventDefault();event.stopPropagation();if(WebInspector.isBeingEdited(anchorElement)){return;}
if(this._followLinkTimeoutIdentifier){clearTimeout(this._followLinkTimeoutIdentifier);delete this._followLinkTimeoutIdentifier;}
if(event.detail>1)
return;function followLink()
{
const options={alwaysOpenExternally:event?event.metaKey:false,lineNumber:anchorElement.lineNumber,ignoreNetworkTab:true,ignoreSearchTab:true,};WebInspector.openURL(anchorElement.href,this._frame,options);}
this._followLinkTimeoutIdentifier=setTimeout(followLink.bind(this),333);}
_toggleCompositingBorders(event)
{var activated=!this._compositingBordersButtonNavigationItem.activated;this._compositingBordersButtonNavigationItem.activated=activated;PageAgent.setCompositingBordersVisible(activated);}
_togglePaintFlashing(event)
{WebInspector.showPaintRectsSetting.value=!WebInspector.showPaintRectsSetting.value;}
_updateCompositingBordersButtonToMatchPageSettings()
{var button=this._compositingBordersButtonNavigationItem;
PageAgent.getCompositingBordersVisible(function(error,compositingBordersVisible){button.activated=error?false:compositingBordersVisible;button.enabled=error!=="unsupported";});}
_showPaintRectsSettingChanged(event)
{this._paintFlashingButtonNavigationItem.activated=WebInspector.showPaintRectsSetting.value;PageAgent.setShowPaintRects(this._paintFlashingButtonNavigationItem.activated);}
_showShadowDOMSettingChanged(event)
{this._showsShadowDOMButtonNavigationItem.activated=WebInspector.showShadowDOMSetting.value;}
_toggleShowsShadowDOMSetting(event)
{WebInspector.showShadowDOMSetting.value=!WebInspector.showShadowDOMSetting.value;}
_showPrintStylesSettingChanged(event)
{this._showPrintStylesButtonNavigationItem.activated=WebInspector.showPrintStylesSetting.value;}
_togglePrintStylesSetting(event)
{WebInspector.showPrintStylesSetting.value=!WebInspector.showPrintStylesSetting.value;let mediaType=WebInspector.showPrintStylesSetting.value?"print":"";PageAgent.setEmulatedMedia(mediaType);WebInspector.cssStyleManager.mediaTypeChanged();}
_showSearchHighlights()
{this._searchResultNodes=[];var searchIdentifier=this._searchIdentifier;DOMAgent.getSearchResults(this._searchIdentifier,0,this._numberOfSearchResults,function(error,nodeIdentifiers){if(error)
return;if(this._searchIdentifier!==searchIdentifier)
return;for(var i=0;i<nodeIdentifiers.length;++i){var domNode=WebInspector.domTreeManager.nodeForId(nodeIdentifiers[i]);if(!domNode)
continue;this._searchResultNodes.push(domNode);var treeElement=this._domTreeOutline.findTreeElement(domNode);if(treeElement)
treeElement.highlightSearchResults(this._searchQuery);}}.bind(this));}
_hideSearchHighlights()
{if(!this._searchResultNodes)
return;for(var domNode of this._searchResultNodes){var treeElement=this._domTreeOutline.findTreeElement(domNode);if(treeElement)
treeElement.hideSearchHighlights();}
delete this._searchResultNodes;}
_domBreakpointAddedOrRemoved(event)
{let breakpoint=event.data.breakpoint;this._updateBreakpointStatus(breakpoint.domNodeIdentifier);}
_domBreakpointDisabledStateDidChange(event)
{let breakpoint=event.target;this._updateBreakpointStatus(breakpoint.domNodeIdentifier);}
_domBreakpointResolvedStateDidChange(event)
{let breakpoint=event.target;let nodeIdentifier=breakpoint.domNodeIdentifier||event.data.oldNodeIdentifier;this._updateBreakpointStatus(nodeIdentifier);}
_updateBreakpointStatus(nodeIdentifier)
{let domNode=WebInspector.domTreeManager.nodeForId(nodeIdentifier);if(!domNode)
return;let treeElement=this._domTreeOutline.findTreeElement(domNode);if(!treeElement){this._pendingBreakpointNodeIdentifiers.add(nodeIdentifier);return;}
let breakpoints=WebInspector.domDebuggerManager.domBreakpointsForNode(domNode);if(!breakpoints.length){treeElement.breakpointStatus=WebInspector.DOMTreeElement.BreakpointStatus.None;return;}
this.breakpointGutterEnabled=true;let disabled=breakpoints.some((item)=>item.disabled);treeElement.breakpointStatus=disabled?WebInspector.DOMTreeElement.BreakpointStatus.DisabledBreakpoint:WebInspector.DOMTreeElement.BreakpointStatus.Breakpoint;}
_restoreBreakpointsAfterUpdate()
{this._pendingBreakpointNodeIdentifiers.clear();this.breakpointGutterEnabled=false;let updatedNodes=new Set;for(let breakpoint of WebInspector.domDebuggerManager.domBreakpoints){if(updatedNodes.has(breakpoint.domNodeIdentifier))
continue;this._updateBreakpointStatus(breakpoint.domNodeIdentifier);}}
_breakpointsEnabledDidChange(event)
{this._domTreeOutline.element.classList.toggle("breakpoints-disabled",!WebInspector.debuggerManager.breakpointsEnabled);}};WebInspector.DetailsSidebarPanel=class DetailsSidebarPanel extends WebInspector.SidebarPanel
{constructor(identifier,displayName,dontCreateNavigationItem)
{super(identifier,displayName);this.element.classList.add("details");if(!dontCreateNavigationItem)
this._navigationItem=new WebInspector.RadioButtonNavigationItem(identifier,displayName);}
get navigationItem()
{return this._navigationItem;}
inspect(objects)
{return false;}};WebInspector.GeneralTabBarItem=class GeneralTabBarItem extends WebInspector.TabBarItem
{constructor(image,title,representedObject)
{super(image,title,representedObject);let closeButtonElement=document.createElement("div");closeButtonElement.classList.add(WebInspector.TabBarItem.CloseButtonStyleClassName);closeButtonElement.title=WebInspector.UIString("Click to close this tab; Option-click to close all tabs except this one");this.element.insertBefore(closeButtonElement,this.element.firstChild);this.element.addEventListener("contextmenu",this._handleContextMenuEvent.bind(this));}
set title(title)
{if(title){this._titleElement=document.createElement("span");this._titleElement.classList.add("title");let titleContentElement=document.createElement("span");titleContentElement.classList.add("content");titleContentElement.textContent=title;this._titleElement.appendChild(titleContentElement);this.element.insertBefore(this._titleElement,this.element.lastChild);}else{if(this._titleElement)
this._titleElement.remove();this._titleElement=null;}
super.title=title;}
_handleContextMenuEvent(event)
{if(!this._parentTabBar)
return;let closeTab=()=>{this._parentTabBar.removeTabBarItem(this);};let closeOtherTabs=()=>{let tabBarItems=this._parentTabBar.tabBarItems;for(let i=tabBarItems.length-1;i>=0;--i){let item=tabBarItems[i];if(item===this||item instanceof WebInspector.PinnedTabBarItem)
continue;this._parentTabBar.removeTabBarItem(item);}};let hasOtherNonPinnedTabs=this._parentTabBar.tabBarItems.some((item)=>item!==this&&!(item instanceof WebInspector.PinnedTabBarItem));let contextMenu=WebInspector.ContextMenu.createFromEvent(event);contextMenu.appendItem(WebInspector.UIString("Close Tab"),closeTab,this.isDefaultTab);contextMenu.appendItem(WebInspector.UIString("Close Other Tabs"),closeOtherTabs,!hasOtherNonPinnedTabs);}};WebInspector.GeneralTreeElement=class GeneralTreeElement extends WebInspector.TreeElement
{constructor(classNames,title,subtitle,representedObject,hasChildren)
{super("",representedObject,hasChildren);this.classNames=classNames;this._tooltipHandledSeparately=false;this._mainTitle=title||"";this._subtitle=subtitle||"";this._status="";}
get element()
{return this._listItemNode;}
get iconElement()
{this._createElementsIfNeeded();return this._iconElement;}
get titlesElement()
{this._createElementsIfNeeded();return this._titlesElement;}
get mainTitleElement()
{this._createElementsIfNeeded();return this._mainTitleElement;}
get subtitleElement()
{this._createElementsIfNeeded();this._createSubtitleElementIfNeeded();return this._subtitleElement;}
get classNames()
{return this._classNames;}
set classNames(x)
{x=x||[];if(typeof x==="string")
x=[x];if(Array.shallowEqual(this._classNames,x))
return;if(this._listItemNode&&this._classNames)
this._listItemNode.classList.remove(...this._classNames);this._classNames=x;if(this._listItemNode)
this._listItemNode.classList.add(...this._classNames);}
addClassName(className)
{if(this._classNames.includes(className))
return;this._classNames.push(className);if(this._listItemNode)
this._listItemNode.classList.add(className);}
removeClassName(className)
{if(!this._classNames.includes(className))
return;this._classNames.remove(className);if(this._listItemNode)
this._listItemNode.classList.remove(className);}
get mainTitle()
{return this._mainTitle;}
set mainTitle(x)
{x=x||"";if(this._mainTitle===x)
return;this._mainTitle=x;this._updateTitleElements();this.didChange();this.dispatchEventToListeners(WebInspector.GeneralTreeElement.Event.MainTitleDidChange);}
get subtitle()
{return this._subtitle;}
set subtitle(x)
{x=x||"";if(this._subtitle===x)
return;this._subtitle=x;this._updateTitleElements();this.didChange();}
get status()
{return this._status;}
set status(x)
{x=x||"";if(this._status===x)
return;if(!this._statusElement){this._statusElement=document.createElement("div");this._statusElement.className=WebInspector.GeneralTreeElement.StatusElementStyleClassName;}
this._status=x;this._updateStatusElement();}
get filterableData()
{return{text:[this.mainTitle,this.subtitle]};}
get tooltipHandledSeparately()
{return this._tooltipHandledSeparately;}
set tooltipHandledSeparately(x)
{this._tooltipHandledSeparately=!!x;}
isEventWithinDisclosureTriangle(event)
{return event.target===this._disclosureButton;}
onattach()
{this._createElementsIfNeeded();this._updateTitleElements();this._listItemNode.classList.add("item");if(this._classNames)
this._listItemNode.classList.add(...this._classNames);this._listItemNode.appendChild(this._disclosureButton);this._listItemNode.appendChild(this._iconElement);if(this._statusElement)
this._listItemNode.appendChild(this._statusElement);this._listItemNode.appendChild(this._titlesElement);}
ondetach()
{}
onreveal()
{if(this._listItemNode)
this._listItemNode.scrollIntoViewIfNeeded(false);}
callFirstAncestorFunction(functionName,args)
{var currentNode=this.parent;while(currentNode){if(typeof currentNode[functionName]==="function"){currentNode[functionName].apply(currentNode,args);break;}
currentNode=currentNode.parent;}}
_createElementsIfNeeded()
{if(this._createdElements)
return;this._disclosureButton=document.createElement("button");this._disclosureButton.className=WebInspector.GeneralTreeElement.DisclosureButtonStyleClassName;
this._disclosureButton.tabIndex=-1;this._iconElement=document.createElement("img");this._iconElement.className=WebInspector.GeneralTreeElement.IconElementStyleClassName;this._titlesElement=document.createElement("div");this._titlesElement.className=WebInspector.GeneralTreeElement.TitlesElementStyleClassName;this._mainTitleElement=document.createElement("span");this._mainTitleElement.className=WebInspector.GeneralTreeElement.MainTitleElementStyleClassName;this._titlesElement.appendChild(this._mainTitleElement);this._createdElements=true;}
_createSubtitleElementIfNeeded()
{if(this._subtitleElement)
return;this._subtitleElement=document.createElement("span");this._subtitleElement.className=WebInspector.GeneralTreeElement.SubtitleElementStyleClassName;this._titlesElement.appendChild(this._subtitleElement);}
_updateTitleElements()
{if(!this._createdElements)
return;if(typeof this._mainTitle==="string"){if(this._mainTitleElement.textContent!==this._mainTitle)
this._mainTitleElement.textContent=this._mainTitle;}else if(this._mainTitle instanceof Node){this._mainTitleElement.removeChildren();this._mainTitleElement.appendChild(this._mainTitle);}
if(typeof this._subtitle==="string"&&this._subtitle){this._createSubtitleElementIfNeeded();if(this._subtitleElement.textContent!==this._subtitle)
this._subtitleElement.textContent=this._subtitle;this._titlesElement.classList.remove(WebInspector.GeneralTreeElement.NoSubtitleStyleClassName);}else if(this._subtitle instanceof Node){this._createSubtitleElementIfNeeded();this._subtitleElement.removeChildren();this._subtitleElement.appendChild(this._subtitle);}else{if(this._subtitleElement)
this._subtitleElement.textContent="";this._titlesElement.classList.add(WebInspector.GeneralTreeElement.NoSubtitleStyleClassName);}
if(!this.tooltip&&!this._tooltipHandledSeparately)
this._updateTitleTooltip();}
_updateTitleTooltip()
{if(!this._listItemNode)
return;let mainTitleText=this._mainTitleElement.textContent;let subtitleText=this._subtitleElement?this._subtitleElement.textContent:"";let large=this.treeOutline&&this.treeOutline.large;if(mainTitleText&&subtitleText)
this._listItemNode.title=mainTitleText+(large?"\n":" \u2014 ")+subtitleText;else if(mainTitleText)
this._listItemNode.title=mainTitleText;else
this._listItemNode.title=subtitleText;}
_updateStatusElement()
{if(!this._statusElement)
return;if(!this._statusElement.parentNode&&this._listItemNode)
this._listItemNode.insertBefore(this._statusElement,this._titlesElement);if(this._status instanceof Node){this._statusElement.removeChildren();this._statusElement.appendChild(this._status);}else
this._statusElement.textContent=this._status;}};WebInspector.GeneralTreeElement.DisclosureButtonStyleClassName="disclosure-button";WebInspector.GeneralTreeElement.IconElementStyleClassName="icon";WebInspector.GeneralTreeElement.StatusElementStyleClassName="status";WebInspector.GeneralTreeElement.TitlesElementStyleClassName="titles";WebInspector.GeneralTreeElement.MainTitleElementStyleClassName="title";WebInspector.GeneralTreeElement.SubtitleElementStyleClassName="subtitle";WebInspector.GeneralTreeElement.NoSubtitleStyleClassName="no-subtitle";WebInspector.GeneralTreeElement.Event={MainTitleDidChange:"general-tree-element-main-title-did-change"};WebInspector.NavigationSidebarPanel=class NavigationSidebarPanel extends WebInspector.SidebarPanel
{constructor(identifier,displayName,shouldAutoPruneStaleTopLevelResourceTreeElements)
{super(identifier,displayName);this.element.classList.add("navigation");this.contentView.element.addEventListener("scroll",this.soon._updateContentOverflowShadowVisibility);this._contentTreeOutlineGroup=new WebInspector.TreeOutlineGroup;this._contentTreeOutline=this.createContentTreeOutline();this._filterBar=new WebInspector.FilterBar;this._filterBar.addEventListener(WebInspector.FilterBar.Event.FilterDidChange,this._filterDidChange,this);this.element.appendChild(this._filterBar.element);this._bottomOverflowShadowElement=document.createElement("div");this._bottomOverflowShadowElement.className=WebInspector.NavigationSidebarPanel.OverflowShadowElementStyleClassName;this.element.appendChild(this._bottomOverflowShadowElement);this._boundUpdateContentOverflowShadowVisibility=this.soon._updateContentOverflowShadowVisibility;window.addEventListener("resize",this._boundUpdateContentOverflowShadowVisibility);this._filtersSetting=new WebInspector.Setting(identifier+"-navigation-sidebar-filters",{});this._filterBar.filters=this._filtersSetting.value;this._emptyContentPlaceholderElements=new Map;this._emptyFilterResults=new Map;this._shouldAutoPruneStaleTopLevelResourceTreeElements=shouldAutoPruneStaleTopLevelResourceTreeElements||false;if(this._shouldAutoPruneStaleTopLevelResourceTreeElements){WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange,this._checkForStaleResources,this);WebInspector.Frame.addEventListener(WebInspector.Frame.Event.ChildFrameWasRemoved,this._checkForStaleResources,this);WebInspector.Frame.addEventListener(WebInspector.Frame.Event.ResourceWasRemoved,this._checkForStaleResources,this);}
this._pendingViewStateCookie=null;this._restoringState=false;}
closed()
{window.removeEventListener("resize",this._boundUpdateContentOverflowShadowVisibility);WebInspector.Frame.removeEventListener(null,null,this);}
get contentBrowser()
{return this._contentBrowser;}
set contentBrowser(contentBrowser)
{this._contentBrowser=contentBrowser||null;}
get contentTreeOutline()
{return this._contentTreeOutline;}
get contentTreeOutlines()
{return this._contentTreeOutlineGroup.items;}
get currentRepresentedObject()
{if(!this._contentBrowser)
return null;return this._contentBrowser.currentRepresentedObjects[0]||null;}
get filterBar()
{return this._filterBar;}
get restoringState()
{return this._restoringState;}
cancelRestoringState()
{if(!this._finalAttemptToRestoreViewStateTimeout)
return;clearTimeout(this._finalAttemptToRestoreViewStateTimeout);this._finalAttemptToRestoreViewStateTimeout=undefined;}
createContentTreeOutline(suppressFiltering)
{let contentTreeOutline=new WebInspector.TreeOutline;contentTreeOutline.allowsRepeatSelection=true;contentTreeOutline.element.classList.add(WebInspector.NavigationSidebarPanel.ContentTreeOutlineElementStyleClassName);this._contentTreeOutlineGroup.add(contentTreeOutline);this.contentView.element.appendChild(contentTreeOutline.element);if(!suppressFiltering){contentTreeOutline.addEventListener(WebInspector.TreeOutline.Event.ElementAdded,this._treeElementAddedOrChanged,this);contentTreeOutline.addEventListener(WebInspector.TreeOutline.Event.ElementDidChange,this._treeElementAddedOrChanged,this);contentTreeOutline.addEventListener(WebInspector.TreeOutline.Event.ElementDisclosureDidChanged,this._treeElementDisclosureDidChange,this);}
contentTreeOutline[WebInspector.NavigationSidebarPanel.SuppressFilteringSymbol]=suppressFiltering;return contentTreeOutline;}
suppressFilteringOnTreeElements(treeElements)
{for(let treeElement of treeElements)
treeElement[WebInspector.NavigationSidebarPanel.SuppressFilteringSymbol]=true;this._updateFilter();}
treeElementForRepresentedObject(representedObject)
{let treeElement=null;for(let treeOutline of this.contentTreeOutlines){treeElement=treeOutline.getCachedTreeElement(representedObject);if(treeElement)
break;}
return treeElement;}
showDefaultContentView()
{}
showDefaultContentViewForTreeElement(treeElement)
{if(!treeElement||!treeElement.representedObject)
return false;
if(!this.selected){let contentView=this.contentBrowser.contentViewForRepresentedObject(treeElement.representedObject);if(contentView&&contentView.parentContainer&&contentView.parentContainer!==this.contentBrowser.contentViewContainer)
return false;let selectedTabContentView=WebInspector.tabBrowser.selectedTabContentView;if(selectedTabContentView&&selectedTabContentView.contentBrowser!==this.contentBrowser)
return false;}
let contentView=this.contentBrowser.showContentViewForRepresentedObject(treeElement.representedObject);if(!contentView)
return false;treeElement.revealAndSelect(true,false,true,true);return true;}
saveStateToCookie(cookie)
{if(!this._contentBrowser)
return;let representedObject=this.currentRepresentedObject;if(!representedObject)
return;cookie[WebInspector.TypeIdentifierCookieKey]=representedObject.constructor.TypeIdentifier;if(representedObject.saveIdentityToCookie){representedObject.saveIdentityToCookie(cookie);return;}
console.error("NavigationSidebarPanel representedObject is missing a saveIdentityToCookie implementation.",representedObject);}
restoreStateFromCookie(cookie,relaxedMatchDelay)
{this._pendingViewStateCookie=cookie;this._restoringState=true;this._checkOutlinesForPendingViewStateCookie();if(this._finalAttemptToRestoreViewStateTimeout)
clearTimeout(this._finalAttemptToRestoreViewStateTimeout);if(relaxedMatchDelay===0)
return;function finalAttemptToRestoreViewStateFromCookie()
{this._finalAttemptToRestoreViewStateTimeout=undefined;this._checkOutlinesForPendingViewStateCookie(true);this._pendingViewStateCookie=null;this._restoringState=false;}
this._finalAttemptToRestoreViewStateTimeout=setTimeout(finalAttemptToRestoreViewStateFromCookie.bind(this),relaxedMatchDelay);}
showEmptyContentPlaceholder(message,treeOutline)
{treeOutline=treeOutline||this._contentTreeOutline;let emptyContentPlaceholderElement=this._createEmptyContentPlaceholderIfNeeded(treeOutline);if(emptyContentPlaceholderElement.parentNode&&emptyContentPlaceholderElement.children[0].textContent===message)
return;emptyContentPlaceholderElement.children[0].textContent=message;let emptyContentPlaceholderParentElement=treeOutline.element.parentNode;emptyContentPlaceholderParentElement.appendChild(emptyContentPlaceholderElement);this._updateContentOverflowShadowVisibility();}
hideEmptyContentPlaceholder(treeOutline)
{treeOutline=treeOutline||this._contentTreeOutline;let emptyContentPlaceholderElement=this._emptyContentPlaceholderElements.get(treeOutline);if(!emptyContentPlaceholderElement||!emptyContentPlaceholderElement.parentNode)
return;emptyContentPlaceholderElement.remove();this._updateContentOverflowShadowVisibility();}
updateEmptyContentPlaceholder(message,treeOutline)
{treeOutline=treeOutline||this._contentTreeOutline;if(!treeOutline.children.length){this.showEmptyContentPlaceholder(message,treeOutline);}else if(!this._emptyFilterResults.get(treeOutline)){this.hideEmptyContentPlaceholder(treeOutline);}}
updateFilter()
{this._updateFilter();}
shouldFilterPopulate()
{return this.hasCustomFilters();}
hasCustomFilters()
{return false;}
matchTreeElementAgainstCustomFilters(treeElement)
{return true;}
matchTreeElementAgainstFilterFunctions(treeElement)
{if(!this._filterFunctions||!this._filterFunctions.length)
return true;for(var filterFunction of this._filterFunctions){if(filterFunction(treeElement))
return true;}
return false;}
applyFiltersToTreeElement(treeElement)
{if(!this._filterBar.hasActiveFilters()&&!this.hasCustomFilters()){treeElement.hidden=false;if(treeElement.expanded&&treeElement[WebInspector.NavigationSidebarPanel.WasExpandedDuringFilteringSymbol]){treeElement[WebInspector.NavigationSidebarPanel.WasExpandedDuringFilteringSymbol]=false;treeElement.collapse();}
return;}
var filterableData=treeElement.filterableData||{};var flags={expandTreeElement:false};var filterRegex=this._textFilterRegex;function matchTextFilter(inputs)
{if(!inputs||!filterRegex)
return true;for(var input of inputs){if(!input)
continue;if(filterRegex.test(input)){flags.expandTreeElement=true;return true;}}
return false;}
function makeVisible()
{treeElement.hidden=false;var currentAncestor=treeElement.parent;while(currentAncestor&&!currentAncestor.root){currentAncestor.hidden=false;if(flags.expandTreeElement&&!currentAncestor.expanded){currentAncestor.__wasExpandedDuringFiltering=true;currentAncestor.expand();}
currentAncestor=currentAncestor.parent;}}
let suppressFiltering=treeElement[WebInspector.NavigationSidebarPanel.SuppressFilteringSymbol];if(suppressFiltering||(matchTextFilter(filterableData.text)&&this.matchTreeElementAgainstFilterFunctions(treeElement,flags)&&this.matchTreeElementAgainstCustomFilters(treeElement,flags))){makeVisible();if(!flags.expandTreeElement&&treeElement.expanded&&treeElement[WebInspector.NavigationSidebarPanel.WasExpandedDuringFilteringSymbol]){treeElement[WebInspector.NavigationSidebarPanel.WasExpandedDuringFilteringSymbol]=false;treeElement.collapse();}
return;}
treeElement.hidden=true;}
shown()
{super.shown();this._updateContentOverflowShadowVisibility();}
pruneStaleResourceTreeElements()
{if(this._checkForStaleResourcesTimeoutIdentifier){clearTimeout(this._checkForStaleResourcesTimeoutIdentifier);this._checkForStaleResourcesTimeoutIdentifier=undefined;}
for(let contentTreeOutline of this.contentTreeOutlines){
for(var i=contentTreeOutline.children.length-1;i>=0;--i){var treeElement=contentTreeOutline.children[i];if(!(treeElement instanceof WebInspector.ResourceTreeElement))
continue;var resource=treeElement.resource;if(!resource.parentFrame||resource.parentFrame.isDetached())
contentTreeOutline.removeChildAtIndex(i,true,true);}}}
treeElementAddedOrChanged(treeElement)
{}
_updateContentOverflowShadowVisibility()
{if(!this.visible)
return;this._updateContentOverflowShadowVisibility.cancelDebounce();let scrollHeight=this.contentView.element.scrollHeight;let offsetHeight=this.contentView.element.offsetHeight;if(scrollHeight<offsetHeight){if(this._topOverflowShadowElement)
this._topOverflowShadowElement.style.opacity=0;this._bottomOverflowShadowElement.style.opacity=0;return;}
let edgeThreshold=1;let scrollTop=this.contentView.element.scrollTop;let topCoverage=Math.min(scrollTop,edgeThreshold);let bottomCoverage=Math.max(0,(offsetHeight+scrollTop)-(scrollHeight-edgeThreshold));if(this._topOverflowShadowElement)
this._topOverflowShadowElement.style.opacity=(topCoverage/edgeThreshold).toFixed(1);this._bottomOverflowShadowElement.style.opacity=(1-(bottomCoverage/edgeThreshold)).toFixed(1);}
_checkForEmptyFilterResults()
{function checkTreeOutlineForEmptyFilterResults(treeOutline)
{if(!treeOutline.children.length)
return;let filterableTreeElementFound=false;let unfilteredTreeElementFound=false;let currentTreeElement=treeOutline.children[0];while(currentTreeElement){let suppressFilteringForTreeElement=currentTreeElement[WebInspector.NavigationSidebarPanel.SuppressFilteringSymbol];if(!suppressFilteringForTreeElement){filterableTreeElementFound=true;if(!currentTreeElement.hidden){unfilteredTreeElementFound=true;break;}}
currentTreeElement=currentTreeElement.nextSibling;}
if(unfilteredTreeElementFound||!filterableTreeElementFound){this.hideEmptyContentPlaceholder(treeOutline);this._emptyFilterResults.set(treeOutline,false);return;}
this.showEmptyContentPlaceholder(WebInspector.UIString("No Filter Results"),treeOutline);this._emptyFilterResults.set(treeOutline,true);}
for(let treeOutline of this.contentTreeOutlines){if(treeOutline[WebInspector.NavigationSidebarPanel.SuppressFilteringSymbol])
continue;checkTreeOutlineForEmptyFilterResults.call(this,treeOutline);}}
_filterDidChange()
{this._updateFilter();}
_updateFilter()
{let selectedTreeElement;for(let treeOutline of this.contentTreeOutlines){if(treeOutline.hidden||treeOutline[WebInspector.NavigationSidebarPanel.SuppressFilteringSymbol])
continue;selectedTreeElement=treeOutline.selectedTreeElement;if(selectedTreeElement)
break;}
let filters=this._filterBar.filters;this._textFilterRegex=simpleGlobStringToRegExp(filters.text,"i");this._filtersSetting.value=filters;this._filterFunctions=filters.functions;let dontPopulate=!this._filterBar.hasActiveFilters()&&!this.shouldFilterPopulate();for(let treeOutline of this.contentTreeOutlines){if(treeOutline.hidden||treeOutline[WebInspector.NavigationSidebarPanel.SuppressFilteringSymbol])
continue;let currentTreeElement=treeOutline.children[0];while(currentTreeElement&&!currentTreeElement.root){if(!currentTreeElement[WebInspector.NavigationSidebarPanel.SuppressFilteringSymbol]){const currentTreeElementWasHidden=currentTreeElement.hidden;this.applyFiltersToTreeElement(currentTreeElement);if(currentTreeElementWasHidden!==currentTreeElement.hidden)
this._treeElementWasFiltered(currentTreeElement);}
currentTreeElement=currentTreeElement.traverseNextTreeElement(false,null,dontPopulate);}}
this._checkForEmptyFilterResults();this._updateContentOverflowShadowVisibility();}
_treeElementAddedOrChanged(event)
{var dontPopulate=!this._filterBar.hasActiveFilters()&&!this.shouldFilterPopulate();let treeElement=event.data.element;let currentTreeElement=treeElement;while(currentTreeElement&&!currentTreeElement.root){if(!currentTreeElement[WebInspector.NavigationSidebarPanel.SuppressFilteringSymbol]){const currentTreeElementWasHidden=currentTreeElement.hidden;this.applyFiltersToTreeElement(currentTreeElement);if(currentTreeElementWasHidden!==currentTreeElement.hidden)
this._treeElementWasFiltered(currentTreeElement);}
currentTreeElement=currentTreeElement.traverseNextTreeElement(false,treeElement,dontPopulate);}
this._checkForEmptyFilterResults();if(this.visible)
this.soon._updateContentOverflowShadowVisibility();if(this.selected)
this._checkElementsForPendingViewStateCookie([treeElement]);this.treeElementAddedOrChanged(treeElement);}
_treeElementDisclosureDidChange(event)
{this.soon._updateContentOverflowShadowVisibility();}
_checkForStaleResourcesIfNeeded()
{if(!this._checkForStaleResourcesTimeoutIdentifier||!this._shouldAutoPruneStaleTopLevelResourceTreeElements)
return;this.pruneStaleResourceTreeElements();}
_checkForStaleResources(event)
{if(this._checkForStaleResourcesTimeoutIdentifier)
return;this._checkForStaleResourcesTimeoutIdentifier=setTimeout(this.pruneStaleResourceTreeElements.bind(this));}
_isTreeElementWithoutRepresentedObject(treeElement)
{return treeElement instanceof WebInspector.FolderTreeElement||treeElement instanceof WebInspector.DatabaseHostTreeElement||treeElement instanceof WebInspector.IndexedDatabaseHostTreeElement||treeElement instanceof WebInspector.ApplicationCacheManifestTreeElement||treeElement instanceof WebInspector.ThreadTreeElement||treeElement instanceof WebInspector.IdleTreeElement||treeElement instanceof WebInspector.DOMBreakpointTreeElement||treeElement instanceof WebInspector.XHRBreakpointTreeElement||treeElement instanceof WebInspector.CSSStyleSheetTreeElement||typeof treeElement.representedObject==="string"||treeElement.representedObject instanceof String;}
_checkOutlinesForPendingViewStateCookie(matchTypeOnly)
{if(!this._pendingViewStateCookie)
return;this._checkForStaleResourcesIfNeeded();var visibleTreeElements=[];this.contentTreeOutlines.forEach(function(outline){var currentTreeElement=outline.hasChildren?outline.children[0]:null;while(currentTreeElement){visibleTreeElements.push(currentTreeElement);currentTreeElement=currentTreeElement.traverseNextTreeElement(false,null,false);}});return this._checkElementsForPendingViewStateCookie(visibleTreeElements,matchTypeOnly);}
_checkElementsForPendingViewStateCookie(treeElements,matchTypeOnly)
{if(!this._pendingViewStateCookie)
return;var cookie=this._pendingViewStateCookie;function treeElementMatchesCookie(treeElement)
{if(this._isTreeElementWithoutRepresentedObject(treeElement))
return false;var representedObject=treeElement.representedObject;if(!representedObject)
return false;var typeIdentifier=cookie[WebInspector.TypeIdentifierCookieKey];if(typeIdentifier!==representedObject.constructor.TypeIdentifier)
return false;if(matchTypeOnly)
return true;var candidateObjectCookie={};if(representedObject.saveIdentityToCookie)
representedObject.saveIdentityToCookie(candidateObjectCookie);var candidateCookieKeys=Object.keys(candidateObjectCookie);return candidateCookieKeys.length&&candidateCookieKeys.every((key)=>candidateObjectCookie[key]===cookie[key]);}
var matchedElement=null;treeElements.some((element)=>{if(treeElementMatchesCookie.call(this,element)){matchedElement=element;return true;}
return false;});if(matchedElement){let didShowContentView=this.showDefaultContentViewForTreeElement(matchedElement);if(!didShowContentView)
return;this._pendingViewStateCookie=null;
setTimeout(()=>{this._restoringState=false;},0);if(this._finalAttemptToRestoreViewStateTimeout){clearTimeout(this._finalAttemptToRestoreViewStateTimeout);this._finalAttemptToRestoreViewStateTimeout=undefined;}}}
_createEmptyContentPlaceholderIfNeeded(treeOutline)
{let emptyContentPlaceholderElement=this._emptyContentPlaceholderElements.get(treeOutline);if(emptyContentPlaceholderElement)
return emptyContentPlaceholderElement;emptyContentPlaceholderElement=document.createElement("div");emptyContentPlaceholderElement.classList.add(WebInspector.NavigationSidebarPanel.EmptyContentPlaceholderElementStyleClassName);this._emptyContentPlaceholderElements.set(treeOutline,emptyContentPlaceholderElement);let emptyContentPlaceholderMessageElement=document.createElement("div");emptyContentPlaceholderMessageElement.className=WebInspector.NavigationSidebarPanel.EmptyContentPlaceholderMessageElementStyleClassName;emptyContentPlaceholderElement.appendChild(emptyContentPlaceholderMessageElement);return emptyContentPlaceholderElement;}
_treeElementWasFiltered(treeElement)
{if(treeElement.selected||treeElement.hidden)
return;let representedObject=this.currentRepresentedObject;if(!representedObject||treeElement.representedObject!==representedObject)
return;const omitFocus=true;const selectedByUser=false;const suppressOnSelect=true;const suppressOnDeselect=true;treeElement.revealAndSelect(omitFocus,selectedByUser,suppressOnSelect,suppressOnDeselect);}};WebInspector.NavigationSidebarPanel.SuppressFilteringSymbol=Symbol("suppress-filtering");WebInspector.NavigationSidebarPanel.WasExpandedDuringFilteringSymbol=Symbol("was-expanded-during-filtering");WebInspector.NavigationSidebarPanel.OverflowShadowElementStyleClassName="overflow-shadow";WebInspector.NavigationSidebarPanel.ContentTreeOutlineElementStyleClassName="navigation-sidebar-panel-content-tree-outline";WebInspector.NavigationSidebarPanel.EmptyContentPlaceholderElementStyleClassName="empty-content-placeholder";WebInspector.NavigationSidebarPanel.EmptyContentPlaceholderMessageElementStyleClassName="message";WebInspector.PinnedTabBarItem=class PinnedTabBarItem extends WebInspector.TabBarItem
{constructor(image,title,representedObject)
{super(image,title,representedObject);this.element.classList.add("pinned");this.element.addEventListener("contextmenu",this._handleContextMenuEvent.bind(this));}
_handleContextMenuEvent(event)
{event.preventDefault();let contextMenu=WebInspector.ContextMenu.createFromEvent(event);this.dispatchEventToListeners(WebInspector.PinnedTabBarItem.Event.ContextMenu,{contextMenu});}};WebInspector.PinnedTabBarItem.Event={ContextMenu:"pinned-tab-bar-item-context-menu",};WebInspector.ResourceContentView=class ResourceContentView extends WebInspector.ContentView
{constructor(resource,styleClassName)
{super(resource);this._resource=resource;this.element.classList.add(styleClassName,"resource");this._spinnerTimeout=setTimeout(()=>{
let spinner=new WebInspector.IndeterminateProgressSpinner;this.element.appendChild(spinner.element);this._spinnerTimeout=undefined;},100);this.element.addEventListener("click",this._mouseWasClicked.bind(this),false);resource.requestContent().then(this._contentAvailable.bind(this)).catch(this.showGenericErrorMessage.bind(this));if(!this.managesOwnIssues){WebInspector.issueManager.addEventListener(WebInspector.IssueManager.Event.IssueWasAdded,this._issueWasAdded,this);var issues=WebInspector.issueManager.issuesForSourceCode(resource);for(var i=0;i<issues.length;++i)
this.addIssue(issues[i]);}}
get resource()
{return this._resource;}
get supportsSave()
{return this._resource.finished;}
get saveData()
{return{url:this._resource.url,content:this._resource.content};}
contentAvailable(content,base64Encoded)
{}
showGenericErrorMessage()
{this._contentError(WebInspector.UIString("An error occurred trying to load the resource."));}
addIssue(issue)
{this.element.removeChildren();this.element.appendChild(WebInspector.createMessageTextView(issue.text,issue.level===WebInspector.IssueMessage.Level.Error));}
closed()
{super.closed();if(!this.managesOwnIssues)
WebInspector.issueManager.removeEventListener(null,null,this);}
removeLoadingIndicator()
{if(this._spinnerTimeout){clearTimeout(this._spinnerTimeout);this._spinnerTimeout=undefined;}
this.element.removeChildren();}
_contentAvailable(parameters)
{if(parameters.error){this._contentError(parameters.error);return;}
this.contentAvailable(parameters.sourceCode.content,parameters.base64Encoded);}
_contentError(error)
{if(this._hasContent())
return;this.removeLoadingIndicator();this.element.appendChild(WebInspector.createMessageTextView(error,true));this.dispatchEventToListeners(WebInspector.ResourceContentView.Event.ContentError);}
_hasContent()
{return this.element.hasChildNodes()&&!this.element.querySelector(".indeterminate-progress-spinner");}
_issueWasAdded(event)
{var issue=event.data.issue;if(!WebInspector.IssueManager.issueMatchSourceCode(issue,this.resource))
return;this.addIssue(issue);}
_mouseWasClicked(event)
{WebInspector.handlePossibleLinkClick(event,this.resource.parentFrame);}};WebInspector.ResourceContentView.Event={ContentError:"resource-content-view-content-error",};WebInspector.TabContentView=class TabContentView extends WebInspector.ContentView
{constructor(identifier,styleClassNames,tabBarItem,navigationSidebarPanelConstructor,detailsSidebarPanelConstructors)
{super(null);this.element.classList.add("tab");if(typeof styleClassNames==="string")
styleClassNames=[styleClassNames];this.element.classList.add(...styleClassNames);this._identifier=identifier;this._tabBarItem=tabBarItem;this._navigationSidebarPanelConstructor=navigationSidebarPanelConstructor||null;this._detailsSidebarPanelConstructors=detailsSidebarPanelConstructors||[];const defaultSidebarWidth=300;this._navigationSidebarCollapsedSetting=new WebInspector.Setting(identifier+"-navigation-sidebar-collapsed",false);this._navigationSidebarWidthSetting=new WebInspector.Setting(identifier+"-navigation-sidebar-width",defaultSidebarWidth);this._detailsSidebarCollapsedSetting=new WebInspector.Setting(identifier+"-details-sidebar-collapsed",true);this._detailsSidebarSelectedPanelSetting=new WebInspector.Setting(identifier+"-details-sidebar-selected-panel",null);this._detailsSidebarWidthSetting=new WebInspector.Setting(identifier+"-details-sidebar-width",defaultSidebarWidth);this._cookieSetting=new WebInspector.Setting(identifier+"-tab-cookie",{});}
static isTabAllowed()
{return true;}
static isEphemeral()
{return false;}
static shouldSaveTab()
{return true;}
get type()
{return null;}
get parentTabBrowser()
{return this._parentTabBrowser;}
set parentTabBrowser(tabBrowser)
{this._parentTabBrowser=tabBrowser||null;}
get identifier()
{return this._identifier;}
get tabBarItem()
{return this._tabBarItem;}
get managesDetailsSidebarPanels()
{return false;}
showDetailsSidebarPanels()
{}
showRepresentedObject(representedObject,cookie)
{}
canShowRepresentedObject(representedObject)
{return false;}
shown()
{super.shown();if(this._shouldRestoreStateWhenShown)
this.restoreStateFromCookie(WebInspector.StateRestorationType.Delayed);}
restoreStateFromCookie(restorationType)
{if(!this.visible){this._shouldRestoreStateWhenShown=true;return;}
this._shouldRestoreStateWhenShown=false;var relaxMatchDelay=0;if(restorationType===WebInspector.StateRestorationType.Load)
relaxMatchDelay=1000;else if(restorationType===WebInspector.StateRestorationType.Navigation)
relaxMatchDelay=2000;let cookie=this._cookieSetting.value||{};if(this.navigationSidebarPanel)
this.navigationSidebarPanel.restoreStateFromCookie(cookie,relaxMatchDelay);this.restoreFromCookie(cookie);}
saveStateToCookie(cookie)
{if(this._shouldRestoreStateWhenShown)
return;cookie=cookie||{};if(this.navigationSidebarPanel)
this.navigationSidebarPanel.saveStateToCookie(cookie);this.saveToCookie(cookie);this._cookieSetting.value=cookie;}
get navigationSidebarPanel()
{if(!this._navigationSidebarPanelConstructor)
return null;return WebInspector.instanceForClass(this._navigationSidebarPanelConstructor);}
get navigationSidebarCollapsedSetting(){return this._navigationSidebarCollapsedSetting;}
get navigationSidebarWidthSetting(){return this._navigationSidebarWidthSetting;}
get detailsSidebarPanels()
{if(!this._detailsSidebarPanels)
this._detailsSidebarPanels=this._detailsSidebarPanelConstructors.map(constructor=>WebInspector.instanceForClass(constructor));return this._detailsSidebarPanels;}
get detailsSidebarCollapsedSetting(){return this._detailsSidebarCollapsedSetting;}
get detailsSidebarSelectedPanelSetting(){return this._detailsSidebarSelectedPanelSetting;}
get detailsSidebarWidthSetting(){return this._detailsSidebarWidthSetting;}};WebInspector.TimelineDataGrid=class TimelineDataGrid extends WebInspector.DataGrid
{constructor(columns,treeOutline,synchronizerDelegate,editCallback,deleteCallback)
{super(columns,editCallback,deleteCallback);if(treeOutline)
this._treeOutlineDataGridSynchronizer=new WebInspector.TreeOutlineDataGridSynchronizer(treeOutline,this,synchronizerDelegate);this.element.classList.add("timeline");this._sortDelegate=null;this._scopeBarColumns=[];for(var[identifier,column]of this.columns){var scopeBar=column.scopeBar;if(!scopeBar)
continue;this._scopeBarColumns.push(identifier);scopeBar.columnIdentifier=identifier;scopeBar.addEventListener(WebInspector.ScopeBar.Event.SelectionChanged,this._scopeBarSelectedItemsDidChange,this);}
if(this._scopeBarColumns.length>1){console.error("Creating a TimelineDataGrid with more than one filterable column is not yet supported.");return;}
this.addEventListener(WebInspector.DataGrid.Event.SelectedNodeChanged,this._dataGridSelectedNodeChanged,this);this.addEventListener(WebInspector.DataGrid.Event.SortChanged,this._sort,this);this.columnChooserEnabled=true;}
static createColumnScopeBar(prefix,map)
{prefix=prefix+"-timeline-data-grid-";var scopeBarItems=[];for(var[key,value]of map){var id=prefix+key;var item=new WebInspector.ScopeBarItem(id,value);item.value=key;scopeBarItems.push(item);}
var allItem=new WebInspector.ScopeBarItem(prefix+"type-all",WebInspector.UIString("All"));scopeBarItems.unshift(allItem);return new WebInspector.ScopeBar(prefix+"scope-bar",scopeBarItems,allItem,true);}
get sortDelegate()
{return this._sortDelegate;}
set sortDelegate(delegate)
{delegate=delegate||null;if(this._sortDelegate===delegate)
return;this._sortDelegate=delegate;if(this.sortOrder!==WebInspector.DataGrid.SortOrder.Indeterminate)
this.dispatchEventToListeners(WebInspector.DataGrid.Event.SortChanged);}
reset()
{if(!this._treeOutlineDataGridSynchronizer)
this.removeChildren();this._hidePopover();}
shown()
{if(this._treeOutlineDataGridSynchronizer)
this._treeOutlineDataGridSynchronizer.synchronize();}
hidden()
{this._hidePopover();}
treeElementForDataGridNode(dataGridNode)
{if(!this._treeOutlineDataGridSynchronizer)
return null;return this._treeOutlineDataGridSynchronizer.treeElementForDataGridNode(dataGridNode);}
dataGridNodeForTreeElement(treeElement)
{if(!this._treeOutlineDataGridSynchronizer)
return null;return this._treeOutlineDataGridSynchronizer.dataGridNodeForTreeElement(treeElement);}
callFramePopoverAnchorElement()
{return null;}
addRowInSortOrder(treeElement,dataGridNode,parentTreeElementOrDataGridNode)
{let parentDataGridNode;let childElement=dataGridNode;if(treeElement){if(!this._treeOutlineDataGridSynchronizer)
return;this._treeOutlineDataGridSynchronizer.associate(treeElement,dataGridNode);let parentTreeElement=parentTreeElementOrDataGridNode||this._treeOutlineDataGridSynchronizer.treeOutline;parentDataGridNode=parentTreeElement.root?this:this._treeOutlineDataGridSynchronizer.dataGridNodeForTreeElement(parentTreeElement);parentTreeElementOrDataGridNode=parentTreeElement;childElement=treeElement;}else{parentTreeElementOrDataGridNode=parentTreeElementOrDataGridNode||this;parentDataGridNode=parentTreeElementOrDataGridNode;}
if(this.sortColumnIdentifier){let insertionIndex=insertionIndexForObjectInListSortedByFunction(dataGridNode,parentDataGridNode.children,this._sortComparator.bind(this));parentTreeElementOrDataGridNode.insertChild(childElement,insertionIndex);}else{parentTreeElementOrDataGridNode.appendChild(childElement);}}
shouldIgnoreSelectionEvent()
{return this._ignoreSelectionEvent||false;}
dataGridNodeNeedsRefresh(dataGridNode)
{if(!this._dirtyDataGridNodes)
this._dirtyDataGridNodes=new Set;this._dirtyDataGridNodes.add(dataGridNode);if(this._scheduledDataGridNodeRefreshIdentifier)
return;this._scheduledDataGridNodeRefreshIdentifier=requestAnimationFrame(this._refreshDirtyDataGridNodes.bind(this));}
hasCustomFilters()
{return true;}
matchNodeAgainstCustomFilters(node)
{if(!super.matchNodeAgainstCustomFilters(node))
return false;for(let identifier of this._scopeBarColumns){let scopeBar=this.columns.get(identifier).scopeBar;if(!scopeBar||scopeBar.defaultItem.selected)
continue;let value=node.data[identifier];if(!scopeBar.selectedItems.some((scopeBarItem)=>scopeBarItem.value===value))
return false;}
return true;}
_refreshDirtyDataGridNodes()
{if(this._scheduledDataGridNodeRefreshIdentifier){cancelAnimationFrame(this._scheduledDataGridNodeRefreshIdentifier);this._scheduledDataGridNodeRefreshIdentifier=undefined;}
if(!this._dirtyDataGridNodes)
return;let selectedNode=this.selectedNode;let sortComparator=this._sortComparator.bind(this);if(this._treeOutlineDataGridSynchronizer)
this._treeOutlineDataGridSynchronizer.enabled=false;for(let dataGridNode of this._dirtyDataGridNodes){dataGridNode.refresh();if(!this.sortColumnIdentifier)
continue;if(dataGridNode===selectedNode)
this._ignoreSelectionEvent=true;if(dataGridNode.parent===this)
this.removeChild(dataGridNode);let insertionIndex=insertionIndexForObjectInListSortedByFunction(dataGridNode,this.children,sortComparator);this.insertChild(dataGridNode,insertionIndex);if(dataGridNode===selectedNode){selectedNode.revealAndSelect();this._ignoreSelectionEvent=false;}
if(!this._treeOutlineDataGridSynchronizer)
continue;let treeOutline=this._treeOutlineDataGridSynchronizer.treeOutline;let treeElement=this._treeOutlineDataGridSynchronizer.treeElementForDataGridNode(dataGridNode);treeOutline.reattachIfIndexChanged(treeElement,insertionIndex);dataGridNode.element.classList.toggle("hidden",treeElement.hidden);}
if(this._treeOutlineDataGridSynchronizer)
this._treeOutlineDataGridSynchronizer.enabled=true;this._dirtyDataGridNodes=null;}
_sort()
{if(!this.children.length)
return;let sortColumnIdentifier=this.sortColumnIdentifier;if(!sortColumnIdentifier)
return;let selectedNode=this.selectedNode;this._ignoreSelectionEvent=true;let treeOutline;if(this._treeOutlineDataGridSynchronizer){this._treeOutlineDataGridSynchronizer.enabled=false;treeOutline=this._treeOutlineDataGridSynchronizer.treeOutline;if(treeOutline.selectedTreeElement)
treeOutline.selectedTreeElement.deselect(true);}
let parentDataGridNodes=[this];let currentDataGridNode=this.children[0];while(currentDataGridNode){if(currentDataGridNode.children.length)
parentDataGridNodes.push(currentDataGridNode);currentDataGridNode=currentDataGridNode.traverseNextNode(false,null,true);}
for(let parentDataGridNode of parentDataGridNodes){let childDataGridNodes=parentDataGridNode.children.slice();parentDataGridNode.removeChildren();let parentTreeElement;if(this._treeOutlineDataGridSynchronizer){parentTreeElement=parentDataGridNode===this?treeOutline:this._treeOutlineDataGridSynchronizer.treeElementForDataGridNode(parentDataGridNode);parentTreeElement.removeChildren();}
childDataGridNodes.sort(this._sortComparator.bind(this));for(let dataGridNode of childDataGridNodes){if(this._treeOutlineDataGridSynchronizer){let treeElement=this._treeOutlineDataGridSynchronizer.treeElementForDataGridNode(dataGridNode);if(parentTreeElement)
parentTreeElement.appendChild(treeElement);dataGridNode.element.classList.toggle("hidden",treeElement.hidden);}
parentDataGridNode.appendChild(dataGridNode);}}
if(this._treeOutlineDataGridSynchronizer)
this._treeOutlineDataGridSynchronizer.enabled=true;if(selectedNode)
selectedNode.revealAndSelect();this._ignoreSelectionEvent=false;}
_sortComparator(node1,node2)
{var sortColumnIdentifier=this.sortColumnIdentifier;if(!sortColumnIdentifier)
return 0;var sortDirection=this.sortOrder===WebInspector.DataGrid.SortOrder.Ascending?1:-1;if(this._sortDelegate&&typeof this._sortDelegate.dataGridSortComparator==="function"){let result=this._sortDelegate.dataGridSortComparator(sortColumnIdentifier,sortDirection,node1,node2);if(typeof result==="number")
return result;}
var value1=node1.data[sortColumnIdentifier];var value2=node2.data[sortColumnIdentifier];if(typeof value1==="number"&&typeof value2==="number"){if(isNaN(value1)&&isNaN(value2))
return 0;if(isNaN(value1))
return-sortDirection;if(isNaN(value2))
return sortDirection;return(value1-value2)*sortDirection;}
if(typeof value1==="string"&&typeof value2==="string")
return value1.extendedLocaleCompare(value2)*sortDirection;if(value1 instanceof WebInspector.CallFrame||value2 instanceof WebInspector.CallFrame){value1=value1&&value1.functionName?value1.functionName:(value1&&value1.sourceCodeLocation?value1.sourceCodeLocation.sourceCode:"");value2=value2&&value2.functionName?value2.functionName:(value2&&value2.sourceCodeLocation?value2.sourceCodeLocation.sourceCode:"");}
if(value1 instanceof WebInspector.SourceCode||value2 instanceof WebInspector.SourceCode){value1=value1?value1.displayName||"":"";value2=value2?value2.displayName||"":"";}
if(value1 instanceof WebInspector.SourceCodeLocation||value2 instanceof WebInspector.SourceCodeLocation){value1=value1?value1.displayLocationString()||"":"";value2=value2?value2.displayLocationString()||"":"";}
return(value1<value2?-1:(value1>value2?1:0))*sortDirection;}
_scopeBarSelectedItemsDidChange(event)
{this.filterDidChange();}
_dataGridSelectedNodeChanged(event)
{if(!this.selectedNode){this._hidePopover();return;}
var record=this.selectedNode.record;if(!record||!record.callFrames||!record.callFrames.length){this._hidePopover();return;}
this._showPopoverForSelectedNodeSoon();}
_showPopoverForSelectedNodeSoon()
{if(this._showPopoverTimeout)
return;this._showPopoverTimeout=setTimeout(()=>{if(!this._popover){this._popover=new WebInspector.Popover;this._popover.windowResizeHandler=()=>{this._updatePopoverForSelectedNode(false);};}
this._updatePopoverForSelectedNode(true);this._showPopoverTimeout=undefined;},WebInspector.TimelineDataGrid.DelayedPopoverShowTimeout);}
_hidePopover()
{if(this._showPopoverTimeout){clearTimeout(this._showPopoverTimeout);this._showPopoverTimeout=undefined;}
if(this._popover)
this._popover.dismiss();if(this._hidePopoverContentClearTimeout)
clearTimeout(this._hidePopoverContentClearTimeout);this._hidePopoverContentClearTimeout=setTimeout(()=>{if(this._popoverCallStackTreeOutline)
this._popoverCallStackTreeOutline.removeChildren();},WebInspector.TimelineDataGrid.DelayedPopoverHideContentClearTimeout);}
_updatePopoverForSelectedNode(updateContent)
{if(!this._popover||!this.selectedNode)
return;let targetPopoverElement=this.callFramePopoverAnchorElement();if(!targetPopoverElement)
return;let rect=WebInspector.Rect.rectFromClientRect(targetPopoverElement.getBoundingClientRect());if(!rect.size.width&&!rect.size.height)
return;if(this._hidePopoverContentClearTimeout){clearTimeout(this._hidePopoverContentClearTimeout);this._hidePopoverContentClearTimeout=undefined;}
let targetFrame=rect.pad(2);let preferredEdges=[WebInspector.RectEdge.MAX_Y,WebInspector.RectEdge.MIN_Y,WebInspector.RectEdge.MAX_X];if(updateContent)
this._popover.presentNewContentWithFrame(this._createPopoverContent(),targetFrame,preferredEdges);else
this._popover.present(targetFrame,preferredEdges);}
_createPopoverContent()
{if(!this._popoverCallStackTreeOutline){this._popoverCallStackTreeOutline=new WebInspector.TreeOutline;this._popoverCallStackTreeOutline.disclosureButtons=false;this._popoverCallStackTreeOutline.element.classList.add("timeline-data-grid");this._popoverCallStackTreeOutline.addEventListener(WebInspector.TreeOutline.Event.SelectionDidChange,this._popoverCallStackTreeSelectionDidChange,this);}else
this._popoverCallStackTreeOutline.removeChildren();var callFrames=this.selectedNode.record.callFrames;for(var i=0;i<callFrames.length;++i){var callFrameTreeElement=new WebInspector.CallFrameTreeElement(callFrames[i]);this._popoverCallStackTreeOutline.appendChild(callFrameTreeElement);}
var content=document.createElement("div");content.className="timeline-data-grid-popover";content.appendChild(this._popoverCallStackTreeOutline.element);return content;}
_popoverCallStackTreeSelectionDidChange(event)
{let treeElement=event.data.selectedElement;if(!treeElement)
return;this._popover.dismiss();var callFrame=treeElement.callFrame;if(!callFrame.sourceCodeLocation)
return;WebInspector.showSourceCodeLocation(callFrame.sourceCodeLocation,{ignoreNetworkTab:true,ignoreSearchTab:true,});}};WebInspector.TimelineDataGrid.HasNonDefaultFilterStyleClassName="has-non-default-filter";WebInspector.TimelineDataGrid.DelayedPopoverShowTimeout=250;WebInspector.TimelineDataGrid.DelayedPopoverHideContentClearTimeout=500;WebInspector.TimelineDataGridNode=class TimelineDataGridNode extends WebInspector.DataGridNode
{constructor(includesGraph,graphDataSource,hasChildren)
{super({},hasChildren);this.copyable=false;this._includesGraph=includesGraph||false;this._graphDataSource=graphDataSource||null;if(graphDataSource){this._graphContainerElement=document.createElement("div");this._timelineRecordBars=[];}}
get record()
{return this.records&&this.records.length?this.records[0]:null;}
get records()
{return[];}
get graphDataSource()
{return this._graphDataSource;}
get data()
{if(!this._graphDataSource)
return{};var records=this.records||[];return{graph:records.length?records[0].startTime:0};}
collapse()
{super.collapse();if(!this._graphDataSource||!this.revealed)
return;this.refreshGraph();}
expand()
{super.expand();if(!this._graphDataSource||!this.revealed)
return;this.refreshGraph();var childNode=this.children[0];while(childNode){if(childNode instanceof WebInspector.TimelineDataGridNode)
childNode.refreshGraph();childNode=childNode.traverseNextNode(true,this);}}
createCellContent(columnIdentifier,cell)
{if(columnIdentifier==="graph"&&this._graphDataSource){this.needsGraphRefresh();return this._graphContainerElement;}
var value=this.data[columnIdentifier];if(!value)
return emDash;const options={useGoToArrowButton:true,ignoreNetworkTab:true,ignoreSearchTab:true,};if(value instanceof WebInspector.SourceCodeLocation){if(value.sourceCode instanceof WebInspector.Resource){cell.classList.add(WebInspector.ResourceTreeElement.ResourceIconStyleClassName);cell.classList.add(value.sourceCode.type);}else if(value.sourceCode instanceof WebInspector.Script){if(value.sourceCode.url){cell.classList.add(WebInspector.ResourceTreeElement.ResourceIconStyleClassName);cell.classList.add(WebInspector.Resource.Type.Script);}else
cell.classList.add(WebInspector.ScriptTreeElement.AnonymousScriptIconStyleClassName);}else
console.error("Unknown SourceCode subclass.");value.populateLiveDisplayLocationTooltip(cell);var fragment=document.createDocumentFragment();fragment.appendChild(WebInspector.createSourceCodeLocationLink(value,options));var titleElement=document.createElement("span");value.populateLiveDisplayLocationString(titleElement,"textContent");fragment.appendChild(titleElement);return fragment;}
if(value instanceof WebInspector.CallFrame){var callFrame=value;var isAnonymousFunction=false;var functionName=callFrame.functionName;if(!functionName){functionName=WebInspector.UIString("(anonymous function)");isAnonymousFunction=true;}
cell.classList.add(WebInspector.CallFrameView.FunctionIconStyleClassName);var fragment=document.createDocumentFragment();if(callFrame.sourceCodeLocation&&callFrame.sourceCodeLocation.sourceCode){callFrame.sourceCodeLocation.populateLiveDisplayLocationTooltip(cell);fragment.appendChild(WebInspector.createSourceCodeLocationLink(callFrame.sourceCodeLocation,options));if(isAnonymousFunction){if(callFrame.sourceCodeLocation.sourceCode instanceof WebInspector.Resource){cell.classList.add(WebInspector.ResourceTreeElement.ResourceIconStyleClassName);cell.classList.add(callFrame.sourceCodeLocation.sourceCode.type);}else if(callFrame.sourceCodeLocation.sourceCode instanceof WebInspector.Script){if(callFrame.sourceCodeLocation.sourceCode.url){cell.classList.add(WebInspector.ResourceTreeElement.ResourceIconStyleClassName);cell.classList.add(WebInspector.Resource.Type.Script);}else
cell.classList.add(WebInspector.ScriptTreeElement.AnonymousScriptIconStyleClassName);}else
console.error("Unknown SourceCode subclass.");var titleElement=document.createElement("span");callFrame.sourceCodeLocation.populateLiveDisplayLocationString(titleElement,"textContent");fragment.appendChild(titleElement);}else{cell.classList.add(WebInspector.CallFrameView.FunctionIconStyleClassName);fragment.append(functionName);var subtitleElement=document.createElement("span");subtitleElement.classList.add("subtitle");callFrame.sourceCodeLocation.populateLiveDisplayLocationString(subtitleElement,"textContent");fragment.appendChild(subtitleElement);}
return fragment;}
var icon=document.createElement("div");icon.classList.add("icon");fragment.append(icon,functionName);return fragment;}
return super.createCellContent(columnIdentifier,cell);}
refresh()
{if(this._graphDataSource&&this._includesGraph)
this.needsGraphRefresh();super.refresh();}
refreshGraph()
{if(!this._graphDataSource)
return;if(this._scheduledGraphRefreshIdentifier){cancelAnimationFrame(this._scheduledGraphRefreshIdentifier);this._scheduledGraphRefreshIdentifier=undefined;}
if(!this.revealed)
return;let secondsPerPixel=this._graphDataSource.secondsPerPixel;if(isNaN(secondsPerPixel))
return;var recordBarIndex=0;function createBar(records,renderMode)
{var timelineRecordBar=this._timelineRecordBars[recordBarIndex];if(!timelineRecordBar)
timelineRecordBar=this._timelineRecordBars[recordBarIndex]=new WebInspector.TimelineRecordBar(records,renderMode);else{timelineRecordBar.renderMode=renderMode;timelineRecordBar.records=records;}
timelineRecordBar.refresh(this._graphDataSource);if(!timelineRecordBar.element.parentNode){this._graphContainerElement.appendChild(timelineRecordBar.element);this.didAddRecordBar(timelineRecordBar);}
++recordBarIndex;}
function collectRecordsByType(records,recordsByTypeMap)
{for(var record of records){var typedRecords=recordsByTypeMap.get(record.type);if(!typedRecords){typedRecords=[];recordsByTypeMap.set(record.type,typedRecords);}
typedRecords.push(record);}}
var boundCreateBar=createBar.bind(this);if(this.expanded){WebInspector.TimelineRecordBar.createCombinedBars(this.records,secondsPerPixel,this._graphDataSource,boundCreateBar);}else{var recordTypeMap=new Map;collectRecordsByType(this.records,recordTypeMap);var childNode=this.children[0];while(childNode){if(childNode instanceof WebInspector.TimelineDataGridNode)
collectRecordsByType(childNode.records,recordTypeMap);childNode=childNode.traverseNextNode(false,this);}
for(var records of recordTypeMap.values())
WebInspector.TimelineRecordBar.createCombinedBars(records,secondsPerPixel,this._graphDataSource,boundCreateBar);}
for(;recordBarIndex<this._timelineRecordBars.length;++recordBarIndex){this._timelineRecordBars[recordBarIndex].element.remove();this.didRemoveRecordBar(this._timelineRecordBars[recordBarIndex]);this._timelineRecordBars[recordBarIndex].records=null;}}
needsGraphRefresh()
{if(!this.revealed){var ancestor=this;while(ancestor&&!ancestor.root){if(ancestor.revealed&&ancestor instanceof WebInspector.TimelineDataGridNode){ancestor.needsGraphRefresh();return;}
ancestor=ancestor.parent;}
return;}
if(!this._graphDataSource||this._scheduledGraphRefreshIdentifier)
return;this._scheduledGraphRefreshIdentifier=requestAnimationFrame(this.refreshGraph.bind(this));}
displayName()
{const includeDetails=true;return WebInspector.TimelineTabContentView.displayNameForRecord(this.record,true);}
iconClassNames()
{return[WebInspector.TimelineTabContentView.iconClassNameForRecord(this.record)];}
createGoToArrowButton(cellElement,callback)
{function buttonClicked(event)
{if(this.hidden||!this.revealed)
return;event.stopPropagation();callback(this,cellElement.__columnIdentifier);}
let button=WebInspector.createGoToArrowButton();button.addEventListener("click",buttonClicked.bind(this));let contentElement=cellElement.firstChild;contentElement.appendChild(button);}
isRecordVisible(record)
{if(!this._graphDataSource)
return false;if(isNaN(record.startTime))
return false;if(record.endTime<this.graphDataSource.startTime)
return false;if(record.startTime>this.graphDataSource.currentTime||record.startTime>this.graphDataSource.endTime)
return false;return true;}
filterableDataForColumn(columnIdentifier)
{let value=this.data[columnIdentifier];if(value instanceof WebInspector.SourceCodeLocation)
return value.displayLocationString();if(value instanceof WebInspector.CallFrame)
return[value.functionName,value.sourceCodeLocation.displayLocationString()];return super.filterableDataForColumn(columnIdentifier);}
didAddRecordBar(recordBar)
{}
didRemoveRecordBar(recordBar)
{}
didResizeColumn(columnIdentifier)
{if(columnIdentifier!=="graph")
return;this.needsGraphRefresh();}};WebInspector.ContentBrowserTabContentView=class ContentBrowserTabContentView extends WebInspector.TabContentView
{constructor(identifier,styleClassNames,tabBarItem,navigationSidebarPanelConstructor,detailsSidebarPanelConstructors,disableBackForward)
{if(typeof styleClassNames==="string")
styleClassNames=[styleClassNames];styleClassNames.push("content-browser");var contentBrowser=new WebInspector.ContentBrowser(null,null,disableBackForward);super(identifier,styleClassNames,tabBarItem,navigationSidebarPanelConstructor,detailsSidebarPanelConstructors);this._contentBrowser=contentBrowser;this._contentBrowser.delegate=this;this._lastSelectedDetailsSidebarPanelSetting=new WebInspector.Setting(identifier+"-last-selected-details-sidebar-panel",null);this._contentBrowser.addEventListener(WebInspector.ContentBrowser.Event.CurrentRepresentedObjectsDidChange,this.showDetailsSidebarPanels,this);this._contentBrowser.addEventListener(WebInspector.ContentBrowser.Event.CurrentContentViewDidChange,this._contentBrowserCurrentContentViewDidChange,this);this._contentBrowser.updateHierarchicalPathForCurrentContentView();if(navigationSidebarPanelConstructor){let showToolTip=WebInspector.UIString("Show the navigation sidebar (%s)").format(WebInspector.navigationSidebarKeyboardShortcut.displayName);let hideToolTip=WebInspector.UIString("Hide the navigation sidebar (%s)").format(WebInspector.navigationSidebarKeyboardShortcut.displayName);let image=WebInspector.resolvedLayoutDirection()==WebInspector.LayoutDirection.RTL?"Images/ToggleRightSidebar.svg":"Images/ToggleLeftSidebar.svg";this._showNavigationSidebarItem=new WebInspector.ActivateButtonNavigationItem("toggle-navigation-sidebar",showToolTip,hideToolTip,image,16,16);this._showNavigationSidebarItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,WebInspector.toggleNavigationSidebar,WebInspector);this._showNavigationSidebarItem.activated=!WebInspector.navigationSidebar.collapsed;this._contentBrowser.navigationBar.insertNavigationItem(this._showNavigationSidebarItem,0);this._contentBrowser.navigationBar.insertNavigationItem(new WebInspector.DividerNavigationItem,1);WebInspector.navigationSidebar.addEventListener(WebInspector.Sidebar.Event.CollapsedStateDidChange,this._navigationSidebarCollapsedStateDidChange,this);}
if(detailsSidebarPanelConstructors&&detailsSidebarPanelConstructors.length){let showToolTip=WebInspector.UIString("Show the details sidebar (%s)").format(WebInspector.detailsSidebarKeyboardShortcut.displayName);let hideToolTip=WebInspector.UIString("Hide the details sidebar (%s)").format(WebInspector.detailsSidebarKeyboardShortcut.displayName);let image=WebInspector.resolvedLayoutDirection()==WebInspector.LayoutDirection.RTL?"Images/ToggleLeftSidebar.svg":"Images/ToggleRightSidebar.svg";this._showDetailsSidebarItem=new WebInspector.ActivateButtonNavigationItem("toggle-details-sidebar",showToolTip,hideToolTip,image,16,16);this._showDetailsSidebarItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,WebInspector.toggleDetailsSidebar,WebInspector);this._showDetailsSidebarItem.activated=!WebInspector.detailsSidebar.collapsed;this._showDetailsSidebarItem.enabled=false;this._contentBrowser.navigationBar.addNavigationItem(new WebInspector.DividerNavigationItem);this._contentBrowser.navigationBar.addNavigationItem(this._showDetailsSidebarItem);WebInspector.detailsSidebar.addEventListener(WebInspector.Sidebar.Event.CollapsedStateDidChange,this._detailsSidebarCollapsedStateDidChange,this);WebInspector.detailsSidebar.addEventListener(WebInspector.Sidebar.Event.SidebarPanelSelected,this._detailsSidebarPanelSelected,this);}
this.addSubview(this._contentBrowser);}
get contentBrowser()
{return this._contentBrowser;}
shown()
{if(this.navigationSidebarPanel){if(!this.navigationSidebarPanel.contentBrowser)
this.navigationSidebarPanel.contentBrowser=this._contentBrowser;}
super.shown();this._contentBrowser.shown();if(this.navigationSidebarPanel){if(!this._contentBrowser.currentContentView)
this.navigationSidebarPanel.showDefaultContentView();}}
hidden()
{super.hidden();this._contentBrowser.hidden();}
closed()
{super.closed();WebInspector.navigationSidebar.removeEventListener(null,null,this);WebInspector.detailsSidebar.removeEventListener(null,null,this);if(this.navigationSidebarPanel&&typeof this.navigationSidebarPanel.closed==="function")
this.navigationSidebarPanel.closed();this._contentBrowser.contentViewContainer.closeAllContentViews();}
get managesDetailsSidebarPanels()
{return true;}
showDetailsSidebarPanels()
{if(!this.visible)
return;var currentRepresentedObjects=this._contentBrowser.currentRepresentedObjects;var currentSidebarPanels=WebInspector.detailsSidebar.sidebarPanels;var wasSidebarEmpty=!currentSidebarPanels.length;
this._ignoreDetailsSidebarPanelSelectedEvent=true;this._ignoreDetailsSidebarPanelCollapsedEvent=true;let hiddenSidebarPanels=0;for(var i=0;i<this.detailsSidebarPanels.length;++i){var sidebarPanel=this.detailsSidebarPanels[i];if(sidebarPanel.inspect(currentRepresentedObjects)){if(currentSidebarPanels.includes(sidebarPanel)){continue;}
let index=i-hiddenSidebarPanels;WebInspector.detailsSidebar.insertSidebarPanel(sidebarPanel,index);if(this._lastSelectedDetailsSidebarPanelSetting.value===sidebarPanel.identifier){WebInspector.detailsSidebar.selectedSidebarPanel=sidebarPanel;}}else{WebInspector.detailsSidebar.removeSidebarPanel(sidebarPanel);hiddenSidebarPanels++;}}
if(!WebInspector.detailsSidebar.selectedSidebarPanel&&currentSidebarPanels.length)
WebInspector.detailsSidebar.selectedSidebarPanel=currentSidebarPanels[0];if(!WebInspector.detailsSidebar.sidebarPanels.length)
WebInspector.detailsSidebar.collapsed=true;else if(wasSidebarEmpty)
WebInspector.detailsSidebar.collapsed=this.detailsSidebarCollapsedSetting.value;this._ignoreDetailsSidebarPanelCollapsedEvent=false;this._ignoreDetailsSidebarPanelSelectedEvent=false;if(!this.detailsSidebarPanels.length)
return;this._showDetailsSidebarItem.enabled=WebInspector.detailsSidebar.sidebarPanels.length;}
showRepresentedObject(representedObject,cookie)
{if(this.navigationSidebarPanel)
this.navigationSidebarPanel.cancelRestoringState();this.contentBrowser.showContentViewForRepresentedObject(representedObject,cookie);}
contentBrowserTreeElementForRepresentedObject(contentBrowser,representedObject)
{return this.treeElementForRepresentedObject(representedObject);}
treeElementForRepresentedObject(representedObject)
{if(!this.navigationSidebarPanel)
return null;return this.navigationSidebarPanel.treeElementForRepresentedObject(representedObject);}
_navigationSidebarCollapsedStateDidChange(event)
{this._showNavigationSidebarItem.activated=!WebInspector.navigationSidebar.collapsed;}
_detailsSidebarCollapsedStateDidChange(event)
{if(!this.visible)
return;this._showDetailsSidebarItem.activated=!WebInspector.detailsSidebar.collapsed;this._showDetailsSidebarItem.enabled=WebInspector.detailsSidebar.sidebarPanels.length;if(this._ignoreDetailsSidebarPanelCollapsedEvent)
return;this.detailsSidebarCollapsedSetting.value=WebInspector.detailsSidebar.collapsed;}
_detailsSidebarPanelSelected(event)
{if(!this.visible)
return;this._showDetailsSidebarItem.activated=!WebInspector.detailsSidebar.collapsed;this._showDetailsSidebarItem.enabled=WebInspector.detailsSidebar.sidebarPanels.length;if(!WebInspector.detailsSidebar.selectedSidebarPanel||this._ignoreDetailsSidebarPanelSelectedEvent)
return;this._lastSelectedDetailsSidebarPanelSetting.value=WebInspector.detailsSidebar.selectedSidebarPanel.identifier;}
_contentBrowserCurrentContentViewDidChange(event)
{let currentContentView=this._contentBrowser.currentContentView;if(!currentContentView)
return;this._revealAndSelectRepresentedObject(currentContentView.representedObject);}
_revealAndSelectRepresentedObject(representedObject)
{if(this.navigationSidebarPanel){
for(let contentTreeOutline of this.navigationSidebarPanel.contentTreeOutlines){if(contentTreeOutline.processingSelectionChange)
return;}}
let treeElement=this.treeElementForRepresentedObject(representedObject);if(treeElement)
treeElement.revealAndSelect(true,false,true,true);else if(this.navigationSidebarPanel&&this.navigationSidebarPanel.contentTreeOutline.selectedTreeElement)
this.navigationSidebarPanel.contentTreeOutline.selectedTreeElement.deselect(true);}};WebInspector.DOMDetailsSidebarPanel=class DOMDetailsSidebarPanel extends WebInspector.DetailsSidebarPanel
{constructor(identifier,displayName,dontCreateNavigationItem)
{super(identifier,displayName,dontCreateNavigationItem);this.element.addEventListener("click",this._mouseWasClicked.bind(this),true);this._domNode=null;}
inspect(objects)
{if(!(objects instanceof Array))
objects=[objects];var nodeToInspect=null;for(var i=0;i<objects.length;++i){if(objects[i]instanceof WebInspector.DOMNode){nodeToInspect=objects[i];break;}}
if(nodeToInspect&&!this.supportsDOMNode(nodeToInspect))
nodeToInspect=null;this.domNode=nodeToInspect;return!!this._domNode;}
get domNode()
{return this._domNode;}
set domNode(domNode)
{if(domNode===this._domNode)
return;if(this._domNode)
this.removeEventListeners();this._domNode=domNode;if(this._domNode)
this.addEventListeners();this.needsLayout();}
supportsDOMNode(nodeToInspect)
{return true;}
addEventListeners()
{}
removeEventListeners()
{}
_mouseWasClicked(event)
{if(this._domNode&&this._domNode.ownerDocument){var mainResource=WebInspector.frameResourceManager.resourceForURL(this._domNode.ownerDocument.documentURL);if(mainResource)
var parentFrame=mainResource.parentFrame;}
const options={ignoreNetworkTab:true,ignoreSearchTab:true,};WebInspector.handlePossibleLinkClick(event,parentFrame,options);}};WebInspector.FolderTreeElement=class FolderTreeElement extends WebInspector.GeneralTreeElement
{constructor(title,representedObject)
{const classNames=[WebInspector.FolderTreeElement.FolderIconStyleClassName];const subtitle=null;const hasChildren=true;super(classNames,title,subtitle,representedObject,hasChildren);}};WebInspector.FolderTreeElement.FolderIconStyleClassName="folder-icon";WebInspector.FolderizedTreeElement=class FolderizedTreeElement extends WebInspector.GeneralTreeElement
{constructor(classNames,title,subtitle,representedObject,hasChildren)
{super(classNames,title,subtitle,representedObject,hasChildren);this.shouldRefreshChildren=true;this._folderExpandedSettingMap=new Map;this._folderSettingsKey="";this._folderTypeMap=new Map;this._folderizeSettingsMap=new Map;this._groupedIntoFolders=false;this._clearNewChildQueue();}
get groupedIntoFolders()
{return this._groupedIntoFolders;}
set folderSettingsKey(x)
{this._folderSettingsKey=x;}
registerFolderizeSettings(type,displayName,representedObject,treeElementConstructor)
{let settings={type,displayName,topLevel:displayName===null,representedObject,treeElementConstructor,};this._folderizeSettingsMap.set(type,settings);}
removeChildren()
{super.removeChildren();this._clearNewChildQueue();for(var folder of this._folderTypeMap.values())
folder.removeChildren();this._folderExpandedSettingMap.clear();this._folderTypeMap.clear();this._groupedIntoFolders=false;}
addChildForRepresentedObject(representedObject)
{var settings=this._settingsForRepresentedObject(representedObject);if(!settings){console.error("No settings for represented object",representedObject);return;}
if(!this.treeOutline){this.shouldRefreshChildren=true;return;}
var childTreeElement=this.treeOutline.getCachedTreeElement(representedObject);if(!childTreeElement)
childTreeElement=new settings.treeElementConstructor(representedObject);this._addTreeElement(childTreeElement);}
addRepresentedObjectToNewChildQueue(representedObject)
{this._newChildQueue.push(representedObject);if(!this._newChildQueueTimeoutIdentifier)
this._newChildQueueTimeoutIdentifier=setTimeout(this._populateFromNewChildQueue.bind(this),WebInspector.FolderizedTreeElement.NewChildQueueUpdateInterval);}
removeChildForRepresentedObject(representedObject)
{this._removeRepresentedObjectFromNewChildQueue(representedObject);this.updateParentStatus();if(!this.treeOutline){this.shouldRefreshChildren=true;return;}
var childTreeElement=this.treeOutline.getCachedTreeElement(representedObject);if(!childTreeElement||!childTreeElement.parent)
return;this._removeTreeElement(childTreeElement);}
compareChildTreeElements(a,b)
{return this._compareTreeElementsByMainTitle(a,b);}
updateParentStatus()
{let hasChildren=false;for(let settings of this._folderizeSettingsMap.values()){if(settings.representedObject.items.size){hasChildren=true;break;}}
this.hasChildren=hasChildren;if(!this.hasChildren)
this.removeChildren();}
prepareToPopulate()
{if(!this._groupedIntoFolders&&this._shouldGroupIntoFolders()){this._groupedIntoFolders=true;return true;}
return false;}
_clearNewChildQueue()
{this._newChildQueue=[];if(this._newChildQueueTimeoutIdentifier){clearTimeout(this._newChildQueueTimeoutIdentifier);this._newChildQueueTimeoutIdentifier=null;}}
_populateFromNewChildQueue()
{if(!this.children.length){this.updateParentStatus();this.shouldRefreshChildren=true;return;}
if(this.prepareToPopulate()){this._clearNewChildQueue();this.shouldRefreshChildren=true;return;}
for(var i=0;i<this._newChildQueue.length;++i)
this.addChildForRepresentedObject(this._newChildQueue[i]);this._clearNewChildQueue();}
_removeRepresentedObjectFromNewChildQueue(representedObject)
{this._newChildQueue.remove(representedObject);}
_addTreeElement(childTreeElement)
{if(!childTreeElement)
return;var wasSelected=childTreeElement.selected;this._removeTreeElement(childTreeElement,true,true);var parentTreeElement=this._parentTreeElementForRepresentedObject(childTreeElement.representedObject);if(parentTreeElement!==this&&!parentTreeElement.parent)
this._insertFolderTreeElement(parentTreeElement);this._insertChildTreeElement(parentTreeElement,childTreeElement);if(wasSelected)
childTreeElement.revealAndSelect(true,false,true,true);}
_compareTreeElementsByMainTitle(a,b)
{let aIsFolder=a instanceof WebInspector.FolderTreeElement;let bIsFolder=b instanceof WebInspector.FolderTreeElement;if(aIsFolder&&!bIsFolder)
return-1;if(bIsFolder&&!aIsFolder)
return 1;return a.mainTitle.extendedLocaleCompare(b.mainTitle);}
_insertFolderTreeElement(folderTreeElement)
{this.insertChild(folderTreeElement,insertionIndexForObjectInListSortedByFunction(folderTreeElement,this.children,this._compareTreeElementsByMainTitle));}
_insertChildTreeElement(parentTreeElement,childTreeElement)
{parentTreeElement.insertChild(childTreeElement,insertionIndexForObjectInListSortedByFunction(childTreeElement,parentTreeElement.children,this.compareChildTreeElements.bind(this)));}
_removeTreeElement(childTreeElement,suppressOnDeselect,suppressSelectSibling)
{var oldParent=childTreeElement.parent;if(!oldParent)
return;oldParent.removeChild(childTreeElement,suppressOnDeselect,suppressSelectSibling);if(oldParent===this)
return;if(!(oldParent instanceof WebInspector.FolderTreeElement))
return;if(!oldParent.children.length)
oldParent.parent.removeChild(oldParent);}
_parentTreeElementForRepresentedObject(representedObject)
{if(!this._groupedIntoFolders)
return this;function createFolderTreeElement(settings)
{let folderTreeElement=new WebInspector.FolderTreeElement(settings.displayName,settings.representedObject);let folderExpandedSetting=new WebInspector.Setting(settings.type+"-folder-expanded-"+this._folderSettingsKey,false);this._folderExpandedSettingMap.set(folderTreeElement,folderExpandedSetting);if(folderExpandedSetting.value)
folderTreeElement.expand();folderTreeElement.onexpand=this._folderTreeElementExpandedStateChange.bind(this);folderTreeElement.oncollapse=this._folderTreeElementExpandedStateChange.bind(this);return folderTreeElement;}
var settings=this._settingsForRepresentedObject(representedObject);if(!settings){console.error("Unknown representedObject",representedObject);return this;}
if(settings.topLevel)
return this;var folder=this._folderTypeMap.get(settings.type);if(folder)
return folder;folder=createFolderTreeElement.call(this,settings);this._folderTypeMap.set(settings.type,folder);return folder;}
_folderTreeElementExpandedStateChange(folderTreeElement)
{let expandedSetting=this._folderExpandedSettingMap.get(folderTreeElement);if(!expandedSetting)
return;expandedSetting.value=folderTreeElement.expanded;}
_settingsForRepresentedObject(representedObject)
{for(let settings of this._folderizeSettingsMap.values()){if(settings.representedObject.typeVerifier(representedObject))
return settings;}
return null;}
_shouldGroupIntoFolders()
{if(this._groupedIntoFolders)
return true;
var numberOfSmallCategories=0;var numberOfMediumCategories=0;var foundLargeCategory=false;function pushCategory(childCount)
{if(!childCount)
return false;if(foundLargeCategory)
return true;if(childCount>=WebInspector.FolderizedTreeElement.LargeChildCountThreshold){if(numberOfSmallCategories||numberOfMediumCategories)
return true;foundLargeCategory=true;return false;}
if(childCount>=WebInspector.FolderizedTreeElement.MediumChildCountThreshold){return++numberOfMediumCategories>=WebInspector.FolderizedTreeElement.NumberOfMediumCategoriesThreshold;}
++numberOfSmallCategories;return false;}
for(var settings of this._folderizeSettingsMap.values()){if(pushCategory(settings.representedObject.items.size))
return true;}
return false;}};WebInspector.FolderizedTreeElement.MediumChildCountThreshold=5;WebInspector.FolderizedTreeElement.LargeChildCountThreshold=15;WebInspector.FolderizedTreeElement.NumberOfMediumCategoriesThreshold=2;WebInspector.FolderizedTreeElement.NewChildQueueUpdateInterval=500;WebInspector.NetworkTabContentView=class NetworkTabContentView extends WebInspector.ContentBrowserTabContentView
{constructor(identifier)
{let{image,title}=WebInspector.NetworkTabContentView.tabInfo();let tabBarItem=new WebInspector.GeneralTabBarItem(image,title);let detailsSidebarPanelConstructors=[WebInspector.ResourceDetailsSidebarPanel,WebInspector.ProbeDetailsSidebarPanel];super(identifier||"network","network",tabBarItem,WebInspector.NetworkSidebarPanel,detailsSidebarPanelConstructors);}
static tabInfo()
{return{image:"Images/Network.svg",title:WebInspector.UIString("Network"),};}
static isTabAllowed()
{return!!window.NetworkAgent&&!!window.PageAgent;}
get type()
{return WebInspector.NetworkTabContentView.Type;}
canShowRepresentedObject(representedObject)
{if(!(representedObject instanceof WebInspector.Resource))
return false;return!!this.navigationSidebarPanel.contentTreeOutline.getCachedTreeElement(representedObject);}
get supportsSplitContentBrowser()
{
return false;}};WebInspector.NetworkTabContentView.Type="network";WebInspector.NewTabContentView=class NewTabContentView extends WebInspector.TabContentView
{constructor(identifier)
{let{image,title}=WebInspector.NewTabContentView.tabInfo();let tabBarItem=new WebInspector.GeneralTabBarItem(image,title);tabBarItem.isDefaultTab=true;super(identifier||"new-tab","new-tab",tabBarItem);WebInspector.notifications.addEventListener(WebInspector.Notification.TabTypesChanged,this._updateShownTabs.bind(this));this._tabElementsByTabClass=new Map;this._updateShownTabs();}
static tabInfo()
{return{image:"Images/NewTab.svg",title:WebInspector.UIString("New Tab"),};}
static isEphemeral()
{return true;}
static shouldSaveTab()
{return false;}
get type()
{return WebInspector.NewTabContentView.Type;}
shown()
{WebInspector.tabBrowser.tabBar.addEventListener(WebInspector.TabBar.Event.TabBarItemAdded,this._updateTabItems,this);WebInspector.tabBrowser.tabBar.addEventListener(WebInspector.TabBar.Event.TabBarItemRemoved,this._updateTabItems,this);this._updateTabItems();}
hidden()
{WebInspector.tabBrowser.tabBar.removeEventListener(null,null,this);}
get supportsSplitContentBrowser()
{
return false;}
layout()
{this._tabElementsByTabClass.clear();this.element.removeChildren();for(let tabClass of this._shownTabClasses){let tabItemElement=document.createElement("div");tabItemElement.classList.add("tab-item");tabItemElement.addEventListener("click",this._createNewTabWithType.bind(this,tabClass.Type));tabItemElement[WebInspector.NewTabContentView.TypeSymbol]=tabClass.Type;let boxElement=tabItemElement.appendChild(document.createElement("div"));boxElement.classList.add("box");let info=tabClass.tabInfo();let imageElement=boxElement.appendChild(document.createElement("img"));imageElement.src=info.image;let labelElement=tabItemElement.appendChild(document.createElement("label"));labelElement.textContent=info.title;this.element.appendChild(tabItemElement);this._tabElementsByTabClass.set(tabClass,tabItemElement);}
this._updateTabItems();}
_createNewTabWithType(tabType,event)
{if(!WebInspector.isNewTabWithTypeAllowed(tabType))
return;const canCreateAdditionalTabs=this._allowableTabTypes().length>1;const options={referencedView:this,shouldReplaceTab:!canCreateAdditionalTabs||!WebInspector.modifierKeys.metaKey,shouldShowNewTab:!WebInspector.modifierKeys.metaKey};WebInspector.createNewTabWithType(tabType,options);}
_updateShownTabs()
{let allTabClasses=Array.from(WebInspector.knownTabClasses());let allowedTabClasses=allTabClasses.filter((tabClass)=>tabClass.isTabAllowed()&&!tabClass.isEphemeral());allowedTabClasses.sort((a,b)=>a.tabInfo().title.extendedLocaleCompare(b.tabInfo().title));if(Array.shallowEqual(this._shownTabClasses,allowedTabClasses))
return;this._shownTabClasses=allowedTabClasses;this.needsLayout();}
_allowableTabTypes()
{let tabTypes=this._shownTabClasses.map((tabClass)=>tabClass.Type);return tabTypes.filter((type)=>WebInspector.isNewTabWithTypeAllowed(type));}
_updateTabItems()
{for(let[tabClass,tabItemElement]of this._tabElementsByTabClass.entries()){let allowed=WebInspector.isNewTabWithTypeAllowed(tabClass.Type);tabItemElement.classList.toggle(WebInspector.NewTabContentView.DisabledStyleClassName,!allowed);}}};WebInspector.NewTabContentView.Type="new-tab";WebInspector.NewTabContentView.TypeSymbol=Symbol("type");WebInspector.NewTabContentView.TabItemStyleClassName="tab-item";WebInspector.NewTabContentView.DisabledStyleClassName="disabled";WebInspector.ObjectTreeBaseTreeElement=class ObjectTreeBaseTreeElement extends WebInspector.GeneralTreeElement
{constructor(representedObject,propertyPath,property)
{super(null,null,null,representedObject,false);this._property=property;this._propertyPath=propertyPath;this.toggleOnClick=true;this.selectable=false;this.tooltipHandledSeparately=true;}
get property()
{return this._property;}
get propertyPath()
{return this._propertyPath;}
resolvedValue()
{if(this._getterValue)
return this._getterValue;if(this._property.hasValue())
return this._property.value;return null;}
resolvedValuePropertyPath()
{if(this._getterValue)
return this._propertyPath.appendPropertyDescriptor(this._getterValue,this._property,WebInspector.PropertyPath.Type.Value);if(this._property.hasValue())
return this._propertyPath.appendPropertyDescriptor(this._property.value,this._property,WebInspector.PropertyPath.Type.Value);return null;}
thisPropertyPath()
{return this._propertyPath.appendPropertyDescriptor(null,this._property,this.propertyPathType());}
hadError()
{return this._property.wasThrown||this._getterHadError;}
propertyPathType()
{if(this._getterValue||this._property.hasValue())
return WebInspector.PropertyPath.Type.Value;if(this._property.hasGetter())
return WebInspector.PropertyPath.Type.Getter;if(this._property.hasSetter())
return WebInspector.PropertyPath.Type.Setter;return WebInspector.PropertyPath.Type.Value;}
propertyPathString(propertyPath)
{if(propertyPath.isFullPathImpossible())
return WebInspector.UIString("Unable to determine path to property from root");return propertyPath.displayPath(this.propertyPathType());}
createGetterElement(interactive)
{var getterElement=document.createElement("img");getterElement.className="getter";if(!interactive){getterElement.classList.add("disabled");getterElement.title=WebInspector.UIString("Getter");return getterElement;}
getterElement.title=WebInspector.UIString("Invoke getter");getterElement.addEventListener("click",(event)=>{event.stopPropagation();var lastNonPrototypeObject=this._propertyPath.lastNonPrototypeObject;var getterObject=this._property.get;lastNonPrototypeObject.invokeGetter(getterObject,(error,result,wasThrown)=>{this._getterHadError=!!(error||wasThrown);this._getterValue=result;if(this.invokedGetter&&typeof this.invokedGetter==="function")
this.invokedGetter();});});return getterElement;}
createSetterElement(interactive)
{var setterElement=document.createElement("img");setterElement.className="setter";setterElement.title=WebInspector.UIString("Setter");if(!interactive)
setterElement.classList.add("disabled");return setterElement;}
populateContextMenu(contextMenu,event)
{if(event.__addedObjectPreviewContextMenuItems)
return;if(event.__addedObjectTreeContextMenuItems)
return;event.__addedObjectTreeContextMenuItems=true;if(typeof this.treeOutline.objectTreeElementAddContextMenuItems==="function"){this.treeOutline.objectTreeElementAddContextMenuItems(this,contextMenu);if(!contextMenu.isEmpty())
contextMenu.appendSeparator();}
let resolvedValue=this.resolvedValue();if(!resolvedValue)
return;if(this._property&&this._property.symbol)
contextMenu.appendItem(WebInspector.UIString("Log Symbol"),this._logSymbolProperty.bind(this));contextMenu.appendItem(WebInspector.UIString("Log Value"),this._logValue.bind(this));let propertyPath=this.resolvedValuePropertyPath();if(propertyPath&&!propertyPath.isFullPathImpossible()){contextMenu.appendItem(WebInspector.UIString("Copy Path to Property"),()=>{InspectorFrontendHost.copyText(propertyPath.displayPath(WebInspector.PropertyPath.Type.Value));});}
contextMenu.appendSeparator();this._appendMenusItemsForObject(contextMenu,resolvedValue);super.populateContextMenu(contextMenu,event);}
_logSymbolProperty()
{var symbol=this._property.symbol;if(!symbol)
return;var text=WebInspector.UIString("Selected Symbol");WebInspector.consoleLogViewController.appendImmediateExecutionWithResult(text,symbol,true);}
_logValue(value)
{var resolvedValue=value||this.resolvedValue();if(!resolvedValue)
return;var propertyPath=this.resolvedValuePropertyPath();var isImpossible=propertyPath.isFullPathImpossible();var text=isImpossible?WebInspector.UIString("Selected Value"):propertyPath.displayPath(this.propertyPathType());if(!isImpossible)
WebInspector.quickConsole.prompt.pushHistoryItem(text);WebInspector.consoleLogViewController.appendImmediateExecutionWithResult(text,resolvedValue,isImpossible);}
_appendMenusItemsForObject(contextMenu,resolvedValue)
{if(resolvedValue.type==="function"){if(!isFunctionStringNativeCode(resolvedValue.description)){contextMenu.appendItem(WebInspector.UIString("Jump to Definition"),function(){resolvedValue.target.DebuggerAgent.getFunctionDetails(resolvedValue.objectId,function(error,response){if(error)
return;let location=response.location;let sourceCode=WebInspector.debuggerManager.scriptForIdentifier(location.scriptId,resolvedValue.target);if(!sourceCode)
return;let sourceCodeLocation=sourceCode.createSourceCodeLocation(location.lineNumber,location.columnNumber||0);const options={ignoreNetworkTab:true,ignoreSearchTab:true,};WebInspector.showSourceCodeLocation(sourceCodeLocation,options);});});}
return;}
if(resolvedValue.subtype==="node"){contextMenu.appendItem(WebInspector.UIString("Copy as HTML"),function(){resolvedValue.pushNodeToFrontend(function(nodeId){WebInspector.domTreeManager.nodeForId(nodeId).copyNode();});});contextMenu.appendItem(WebInspector.UIString("Scroll Into View"),function(){function scrollIntoView(){this.scrollIntoViewIfNeeded(true);}
resolvedValue.callFunction(scrollIntoView,undefined,false,function(){});});contextMenu.appendSeparator();contextMenu.appendItem(WebInspector.UIString("Reveal in DOM Tree"),function(){resolvedValue.pushNodeToFrontend(function(nodeId){WebInspector.domTreeManager.inspectElement(nodeId);});});return;}}};WebInspector.SourceCodeTreeElement=class SourceCodeTreeElement extends WebInspector.FolderizedTreeElement
{constructor(sourceCode,classNames,title,subtitle,representedObject,hasChildren)
{super(classNames,title,subtitle,representedObject||sourceCode,hasChildren);this._updateSourceCode(sourceCode);}
updateSourceMapResources()
{if(!this.treeOutline||!this.treeOutline.includeSourceMapResourceChildren)
return;this.hasChildren=!!this._sourceCode.sourceMaps.length;this.shouldRefreshChildren=this.hasChildren;if(!this.hasChildren)
this.removeChildren();}
onattach()
{super.onattach();this.updateSourceMapResources();}
onpopulate()
{if(!this.treeOutline||!this.treeOutline.includeSourceMapResourceChildren)
return;if(!this.hasChildren||!this.shouldRefreshChildren)
return;this.shouldRefreshChildren=false;this.removeChildren();function combineFolderChain(topFolder,bottomFolder)
{var components=[];for(var currentFolder=bottomFolder;currentFolder!==topFolder;currentFolder=currentFolder.parent)
components.push(currentFolder.mainTitle);components.push(topFolder.mainTitle);var folderName=components.reverse().join("/");var newFolder=new WebInspector.FolderTreeElement(folderName);var folderIndex=topFolder.parent.children.indexOf(topFolder);topFolder.parent.insertChild(newFolder,folderIndex);topFolder.parent.removeChild(topFolder);var children=bottomFolder.children;bottomFolder.removeChildren();for(var i=0;i<children.length;++i)
newFolder.appendChild(children[i]);}
function findAndCombineFolderChains(treeElement,previousSingleTreeElement)
{if(!(treeElement instanceof WebInspector.FolderTreeElement)){if(previousSingleTreeElement&&previousSingleTreeElement!==treeElement.parent)
combineFolderChain(previousSingleTreeElement,treeElement.parent);return;}
if(previousSingleTreeElement&&treeElement.children.length!==1){combineFolderChain(previousSingleTreeElement,treeElement);previousSingleTreeElement=null;}
if(!previousSingleTreeElement&&treeElement.children.length===1)
previousSingleTreeElement=treeElement;for(var i=0;i<treeElement.children.length;++i)
findAndCombineFolderChains(treeElement.children[i],previousSingleTreeElement);}
var sourceMaps=this._sourceCode.sourceMaps;for(var i=0;i<sourceMaps.length;++i){var sourceMap=sourceMaps[i];for(var j=0;j<sourceMap.resources.length;++j){var sourceMapResource=sourceMap.resources[j];var relativeSubpath=sourceMapResource.sourceMapDisplaySubpath;var folderTreeElement=this.createFoldersAsNeededForSubpath(relativeSubpath);var sourceMapTreeElement=new WebInspector.SourceMapResourceTreeElement(sourceMapResource);folderTreeElement.insertChild(sourceMapTreeElement,insertionIndexForObjectInListSortedByFunction(sourceMapTreeElement,folderTreeElement.children,WebInspector.ResourceTreeElement.compareFolderAndResourceTreeElements));}}
for(var i=0;i<this.children.length;++i)
findAndCombineFolderChains(this.children[i],null);}
createFoldersAsNeededForSubpath(subpath)
{if(!subpath)
return this;var components=subpath.split("/");if(components.length===1)
return this;if(!this._subpathFolderTreeElementMap)
this._subpathFolderTreeElementMap={};var currentPath="";var currentFolderTreeElement=this;for(var i=0;i<components.length-1;++i){var componentName=components[i];currentPath+=(i?"/":"")+componentName;var cachedFolder=this._subpathFolderTreeElementMap[currentPath];if(cachedFolder){currentFolderTreeElement=cachedFolder;continue;}
var newFolder=new WebInspector.FolderTreeElement(componentName);newFolder.__path=currentPath;this._subpathFolderTreeElementMap[currentPath]=newFolder;var index=insertionIndexForObjectInListSortedByFunction(newFolder,currentFolderTreeElement.children,WebInspector.ResourceTreeElement.compareFolderAndResourceTreeElements);currentFolderTreeElement.insertChild(newFolder,index);currentFolderTreeElement=newFolder;}
return currentFolderTreeElement;}
descendantResourceTreeElementTypeDidChange(childTreeElement,oldType)
{let parentTreeElement=childTreeElement.parent;let wasParentExpanded=parentTreeElement.expanded;let wasSelected=childTreeElement.selected;parentTreeElement.removeChild(childTreeElement,true,true);parentTreeElement.insertChild(childTreeElement,insertionIndexForObjectInListSortedByFunction(childTreeElement,parentTreeElement.children,WebInspector.ResourceTreeElement.compareFolderAndResourceTreeElements));if(wasParentExpanded)
parentTreeElement.expand();if(wasSelected)
childTreeElement.revealAndSelect(true,false,true,true);}
_updateSourceCode(sourceCode)
{if(this._sourceCode===sourceCode)
return;if(this._sourceCode)
this._sourceCode.removeEventListener(WebInspector.SourceCode.Event.SourceMapAdded,this.updateSourceMapResources,this);this._sourceCode=sourceCode;this._sourceCode.addEventListener(WebInspector.SourceCode.Event.SourceMapAdded,this.updateSourceMapResources,this);this.updateSourceMapResources();}};WebInspector.StorageTreeElement=class StorageTreeElement extends WebInspector.GeneralTreeElement
{constructor(classNames,title,representedObject)
{super(classNames,title,null,representedObject,false);this.flattened=false;}
get flattened()
{return this._flattened;}
set flattened(flattened)
{if(this._flattened===flattened)
return;this._flattened=flattened;if(!this._flattened){this.mainTitle=this.name;this.subtitle=this.secondaryName;this._updateChildrenTitles();return;}
this.mainTitle=this.categoryName;this.subtitle=this.name;this._updateChildrenTitles();}
_updateChildrenTitles()
{for(var i=0;i<this.children.length;++i){if(typeof this.children[i].updateTitles==="function")
this.children[i].updateTitles();}}};WebInspector.TimelineDataGridNodePathComponent=class TimelineDataGridNodePathComponent extends WebInspector.HierarchicalPathComponent
{constructor(timelineDataGridNode,representedObject)
{super(timelineDataGridNode.displayName(),timelineDataGridNode.iconClassNames(),representedObject||timelineDataGridNode.record);this._timelineDataGridNode=timelineDataGridNode;}
get timelineDataGridNode()
{return this._timelineDataGridNode;}
get previousSibling()
{let previousSibling=this._timelineDataGridNode.previousSibling;while(previousSibling&&previousSibling.hidden)
previousSibling=previousSibling.previousSibling;if(!previousSibling)
return null;return new WebInspector.TimelineDataGridNodePathComponent(previousSibling);}
get nextSibling()
{let nextSibling=this._timelineDataGridNode.nextSibling;while(nextSibling&&nextSibling.hidden)
nextSibling=nextSibling.nextSibling;if(!nextSibling)
return null;return new WebInspector.TimelineDataGridNodePathComponent(nextSibling);}};WebInspector.TimelineOverview=class TimelineOverview extends WebInspector.View
{constructor(timelineRecording,delegate)
{super();this._timelinesViewModeSettings=this._createViewModeSettings(WebInspector.TimelineOverview.ViewMode.Timelines,WebInspector.TimelineOverview.MinimumDurationPerPixel,WebInspector.TimelineOverview.MaximumDurationPerPixel,0.01,0,15);this._instrumentTypes=WebInspector.TimelineManager.availableTimelineTypes();if(WebInspector.FPSInstrument.supported()){let minimumDurationPerPixel=1/WebInspector.TimelineRecordFrame.MaximumWidthPixels;let maximumDurationPerPixel=1/WebInspector.TimelineRecordFrame.MinimumWidthPixels;this._renderingFramesViewModeSettings=this._createViewModeSettings(WebInspector.TimelineOverview.ViewMode.RenderingFrames,minimumDurationPerPixel,maximumDurationPerPixel,minimumDurationPerPixel,0,100);}
this._recording=timelineRecording;this._recording.addEventListener(WebInspector.TimelineRecording.Event.InstrumentAdded,this._instrumentAdded,this);this._recording.addEventListener(WebInspector.TimelineRecording.Event.InstrumentRemoved,this._instrumentRemoved,this);this._recording.addEventListener(WebInspector.TimelineRecording.Event.MarkerAdded,this._markerAdded,this);this._recording.addEventListener(WebInspector.TimelineRecording.Event.Reset,this._recordingReset,this);this._delegate=delegate;this.element.classList.add("timeline-overview");this._updateWheelAndGestureHandlers();this._graphsContainerView=new WebInspector.View;this._graphsContainerView.element.classList.add("graphs-container");this.addSubview(this._graphsContainerView);this._overviewGraphsByTypeMap=new Map;this._editInstrumentsButton=new WebInspector.ActivateButtonNavigationItem("toggle-edit-instruments",WebInspector.UIString("Edit configuration"),WebInspector.UIString("Save configuration"));this._editInstrumentsButton.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,this._toggleEditingInstruments,this);this._editingInstruments=false;this._updateEditInstrumentsButton();let instrumentsNavigationBar=new WebInspector.NavigationBar;instrumentsNavigationBar.element.classList.add("timelines");instrumentsNavigationBar.addNavigationItem(new WebInspector.FlexibleSpaceNavigationItem);instrumentsNavigationBar.addNavigationItem(this._editInstrumentsButton);this.addSubview(instrumentsNavigationBar);this._timelinesTreeOutline=new WebInspector.TreeOutline;this._timelinesTreeOutline.element.classList.add("timelines");this._timelinesTreeOutline.disclosureButtons=false;this._timelinesTreeOutline.large=true;this._timelinesTreeOutline.addEventListener(WebInspector.TreeOutline.Event.SelectionDidChange,this._timelinesTreeSelectionDidChange,this);this.element.appendChild(this._timelinesTreeOutline.element);this._treeElementsByTypeMap=new Map;this._timelineRuler=new WebInspector.TimelineRuler;this._timelineRuler.allowsClippedLabels=true;this._timelineRuler.allowsTimeRangeSelection=true;this._timelineRuler.element.addEventListener("mousedown",this._timelineRulerMouseDown.bind(this));this._timelineRuler.element.addEventListener("click",this._timelineRulerMouseClicked.bind(this));this._timelineRuler.addEventListener(WebInspector.TimelineRuler.Event.TimeRangeSelectionChanged,this._timeRangeSelectionChanged,this);this.addSubview(this._timelineRuler);this._currentTimeMarker=new WebInspector.TimelineMarker(0,WebInspector.TimelineMarker.Type.CurrentTime);this._timelineRuler.addMarker(this._currentTimeMarker);this._scrollContainerElement=document.createElement("div");this._scrollContainerElement.classList.add("scroll-container");this._scrollContainerElement.addEventListener("scroll",this._handleScrollEvent.bind(this));this.element.appendChild(this._scrollContainerElement);this._scrollWidthSizer=document.createElement("div");this._scrollWidthSizer.classList.add("scroll-width-sizer");this._scrollContainerElement.appendChild(this._scrollWidthSizer);this._startTime=0;this._currentTime=0;this._revealCurrentTime=false;this._endTime=0;this._pixelAlignDuration=false;this._mouseWheelDelta=0;this._cachedScrollContainerWidth=NaN;this._timelineRulerSelectionChanged=false;this._viewMode=WebInspector.TimelineOverview.ViewMode.Timelines;this._selectedTimeline=null;for(let instrument of this._recording.instruments)
this._instrumentAdded(instrument);if(!WebInspector.timelineManager.isCapturingPageReload())
this._resetSelection();this._viewModeDidChange();WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.Event.CapturingStarted,this._capturingStarted,this);WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.Event.CapturingStopped,this._capturingStopped,this);}
get selectedTimeline()
{return this._selectedTimeline;}
set selectedTimeline(x)
{if(this._editingInstruments)
return;if(this._selectedTimeline===x)
return;this._selectedTimeline=x;if(this._selectedTimeline){let treeElement=this._treeElementsByTypeMap.get(this._selectedTimeline.type);let omitFocus=true;let wasSelectedByUser=false;treeElement.select(omitFocus,wasSelectedByUser);}else if(this._timelinesTreeOutline.selectedTreeElement)
this._timelinesTreeOutline.selectedTreeElement.deselect();}
get editingInstruments()
{return this._editingInstruments;}
get viewMode()
{return this._viewMode;}
set viewMode(x)
{if(this._editingInstruments)
return;if(this._viewMode===x)
return;this._viewMode=x;this._viewModeDidChange();}
get startTime()
{return this._startTime;}
set startTime(x)
{x=x||0;if(this._startTime===x)
return;if(this._viewMode!==WebInspector.TimelineOverview.ViewMode.RenderingFrames){let selectionOffset=this.selectionStartTime-this._startTime;this.selectionStartTime=selectionOffset+x;}
this._startTime=x;this.needsLayout();}
get currentTime()
{return this._currentTime;}
set currentTime(x)
{x=x||0;if(this._currentTime===x)
return;this._currentTime=x;this._revealCurrentTime=true;this.needsLayout();}
get secondsPerPixel()
{return this._currentSettings.durationPerPixelSetting.value;}
set secondsPerPixel(x)
{x=Math.min(this._currentSettings.maximumDurationPerPixel,Math.max(this._currentSettings.minimumDurationPerPixel,x));if(this.secondsPerPixel===x)
return;if(this._pixelAlignDuration){x=1/Math.round(1/x);if(this.secondsPerPixel===x)
return;}
this._currentSettings.durationPerPixelSetting.value=x;this.needsLayout();}
get pixelAlignDuration()
{return this._pixelAlignDuration;}
set pixelAlignDuration(x)
{if(this._pixelAlignDuration===x)
return;this._mouseWheelDelta=0;this._pixelAlignDuration=x;if(this._pixelAlignDuration)
this.secondsPerPixel=1/Math.round(1/this.secondsPerPixel);}
get endTime()
{return this._endTime;}
set endTime(x)
{x=x||0;if(this._endTime===x)
return;this._endTime=x;this.needsLayout();}
get scrollStartTime()
{return this._currentSettings.scrollStartTime;}
set scrollStartTime(x)
{x=x||0;if(this.scrollStartTime===x)
return;this._currentSettings.scrollStartTime=x;this.needsLayout();}
get scrollContainerWidth()
{return this._cachedScrollContainerWidth;}
get visibleDuration()
{if(isNaN(this._cachedScrollContainerWidth)){this._cachedScrollContainerWidth=this._scrollContainerElement.offsetWidth;if(!this._cachedScrollContainerWidth)
this._cachedScrollContainerWidth=NaN;}
return this._cachedScrollContainerWidth*this.secondsPerPixel;}
get selectionStartTime()
{return this._timelineRuler.selectionStartTime;}
set selectionStartTime(x)
{x=x||0;if(this._timelineRuler.selectionStartTime===x)
return;let selectionDuration=this.selectionDuration;this._timelineRuler.selectionStartTime=x;this._timelineRuler.selectionEndTime=x+selectionDuration;}
get selectionDuration()
{return this._timelineRuler.selectionEndTime-this._timelineRuler.selectionStartTime;}
set selectionDuration(x)
{x=Math.max(this._timelineRuler.minimumSelectionDuration,x);this._timelineRuler.selectionEndTime=this._timelineRuler.selectionStartTime+x;}
get height()
{let height=0;for(let overviewGraph of this._overviewGraphsByTypeMap.values()){if(overviewGraph.visible)
height+=overviewGraph.height;}
return height;}
get visible()
{return this._visible;}
shown()
{this._visible=true;for(let[type,overviewGraph]of this._overviewGraphsByTypeMap){if(this._canShowTimelineType(type))
overviewGraph.shown();}
this.updateLayout(WebInspector.View.LayoutReason.Resize);}
hidden()
{this._visible=false;for(let overviewGraph of this._overviewGraphsByTypeMap.values())
overviewGraph.hidden();}
reset()
{for(let overviewGraph of this._overviewGraphsByTypeMap.values())
overviewGraph.reset();this._mouseWheelDelta=0;this._resetSelection();}
revealMarker(marker)
{this.scrollStartTime=marker.time-(this.visibleDuration/2);}
recordWasFiltered(timeline,record,filtered)
{let overviewGraph=this._overviewGraphsByTypeMap.get(timeline.type);if(!overviewGraph)
return;overviewGraph.recordWasFiltered(record,filtered);}
selectRecord(timeline,record)
{let overviewGraph=this._overviewGraphsByTypeMap.get(timeline.type);if(!overviewGraph)
return;overviewGraph.selectedRecord=record;}
userSelectedRecord(record)
{if(this._delegate&&this._delegate.timelineOverviewUserSelectedRecord)
this._delegate.timelineOverviewUserSelectedRecord(this,record);}
updateLayoutIfNeeded(layoutReason)
{if(this.layoutPending){super.updateLayoutIfNeeded(layoutReason);return;}
this._timelineRuler.updateLayoutIfNeeded(layoutReason);for(let overviewGraph of this._overviewGraphsByTypeMap.values()){if(overviewGraph.visible)
overviewGraph.updateLayoutIfNeeded(layoutReason);}}
discontinuitiesInTimeRange(startTime,endTime)
{return this._recording.discontinuitiesInTimeRange(startTime,endTime);}
get timelineRuler()
{return this._timelineRuler;}
layout()
{let startTime=this._startTime;let endTime=this._endTime;let currentTime=this._currentTime;if(this._viewMode===WebInspector.TimelineOverview.ViewMode.RenderingFrames){let renderingFramesTimeline=this._recording.timelines.get(WebInspector.TimelineRecord.Type.RenderingFrame);startTime=0;endTime=renderingFramesTimeline.records.length;currentTime=endTime;}
let duration=endTime-startTime;let newWidth=Math.ceil(duration/this.secondsPerPixel);this._updateElementWidth(this._scrollWidthSizer,newWidth);this._currentTimeMarker.time=currentTime;if(this._revealCurrentTime){this.revealMarker(this._currentTimeMarker);this._revealCurrentTime=false;}
const visibleDuration=this.visibleDuration;let scrollStartTime=Math.min(this.scrollStartTime,endTime-visibleDuration);scrollStartTime=Math.max(startTime,scrollStartTime);this._timelineRuler.zeroTime=startTime;this._timelineRuler.startTime=scrollStartTime;this._timelineRuler.secondsPerPixel=this.secondsPerPixel;if(!this._dontUpdateScrollLeft){this._ignoreNextScrollEvent=true;let scrollLeft=Math.ceil((scrollStartTime-startTime)/this.secondsPerPixel);if(scrollLeft)
this._scrollContainerElement.scrollLeft=scrollLeft;}
for(let overviewGraph of this._overviewGraphsByTypeMap.values()){if(!overviewGraph.visible)
continue;overviewGraph.zeroTime=startTime;overviewGraph.startTime=scrollStartTime;overviewGraph.currentTime=currentTime;overviewGraph.endTime=scrollStartTime+visibleDuration;}}
sizeDidChange()
{this._cachedScrollContainerWidth=NaN;}
_updateElementWidth(element,newWidth)
{var currentWidth=parseInt(element.style.width);if(currentWidth!==newWidth)
element.style.width=newWidth+"px";}
_handleScrollEvent(event)
{if(this._ignoreNextScrollEvent){this._ignoreNextScrollEvent=false;return;}
this._dontUpdateScrollLeft=true;let scrollOffset=this._scrollContainerElement.scrollLeft;if(WebInspector.resolvedLayoutDirection()===WebInspector.LayoutDirection.RTL)
this.scrollStartTime=this._startTime-(scrollOffset*this.secondsPerPixel);else
this.scrollStartTime=this._startTime+(scrollOffset*this.secondsPerPixel);this.updateLayoutIfNeeded();this._dontUpdateScrollLeft=false;}
_handleWheelEvent(event)
{if(event.__cloned)
return;if(this._handlingGesture)
return;
if(Math.abs(event.deltaX)>=Math.abs(event.deltaY)*0.5){let newWheelEvent=new event.constructor(event.type,event);newWheelEvent.__cloned=true;this._scrollContainerElement.dispatchEvent(newWheelEvent);return;}
let mouseOffset=event.pageX-this._graphsContainerView.element.totalOffsetLeft;let mousePositionTime=this._currentSettings.scrollStartTime+(mouseOffset*this.secondsPerPixel);let deviceDirection=event.webkitDirectionInvertedFromDevice?1:-1;let delta=event.deltaY*(this.secondsPerPixel/WebInspector.TimelineOverview.ScrollDeltaDenominator)*deviceDirection;if(this._pixelAlignDuration&&(delta<0&&this._mouseWheelDelta>=0||delta>=0&&this._mouseWheelDelta<0))
this._mouseWheelDelta=0;let previousDurationPerPixel=this.secondsPerPixel;this._mouseWheelDelta+=delta;this.secondsPerPixel+=this._mouseWheelDelta;if(this.secondsPerPixel===this._currentSettings.minimumDurationPerPixel&&delta<0||this.secondsPerPixel===this._currentSettings.maximumDurationPerPixel&&delta>=0)
this._mouseWheelDelta=0;else
this._mouseWheelDelta=previousDurationPerPixel+this._mouseWheelDelta-this.secondsPerPixel;this.scrollStartTime=mousePositionTime-(mouseOffset*this.secondsPerPixel);event.preventDefault();event.stopPropagation();}
_handleGestureStart(event)
{if(this._handlingGesture){ return;}
let mouseOffset=event.pageX-this._graphsContainerView.element.totalOffsetLeft;let mousePositionTime=this._currentSettings.scrollStartTime+(mouseOffset*this.secondsPerPixel);this._handlingGesture=true;this._gestureStartStartTime=mousePositionTime;this._gestureStartDurationPerPixel=this.secondsPerPixel;event.preventDefault();event.stopPropagation();}
_handleGestureChange(event)
{let scale=Math.max(1/5,event.scale);let mouseOffset=event.pageX-this._graphsContainerView.element.totalOffsetLeft;let newSecondsPerPixel=this._gestureStartDurationPerPixel/scale;this.secondsPerPixel=newSecondsPerPixel;this.scrollStartTime=this._gestureStartStartTime-(mouseOffset*this.secondsPerPixel);event.preventDefault();event.stopPropagation();}
_handleGestureEnd(event)
{this._handlingGesture=false;this._gestureStartStartTime=NaN;this._gestureStartDurationPerPixel=NaN;}
_instrumentAdded(instrumentOrEvent)
{let instrument=instrumentOrEvent instanceof WebInspector.Instrument?instrumentOrEvent:instrumentOrEvent.data.instrument;let timeline=this._recording.timelineForInstrument(instrument);let treeElement=new WebInspector.TimelineTreeElement(timeline);let insertionIndex=insertionIndexForObjectInListSortedByFunction(treeElement,this._timelinesTreeOutline.children,this._compareTimelineTreeElements.bind(this));this._timelinesTreeOutline.insertChild(treeElement,insertionIndex);this._treeElementsByTypeMap.set(timeline.type,treeElement);let overviewGraph=WebInspector.TimelineOverviewGraph.createForTimeline(timeline,this);overviewGraph.addEventListener(WebInspector.TimelineOverviewGraph.Event.RecordSelected,this._recordSelected,this);this._overviewGraphsByTypeMap.set(timeline.type,overviewGraph);this._graphsContainerView.insertSubviewBefore(overviewGraph,this._graphsContainerView.subviews[insertionIndex]);treeElement.element.style.height=overviewGraph.height+"px";if(!this._canShowTimelineType(timeline.type)){overviewGraph.hidden();treeElement.hidden=true;}}
_instrumentRemoved(event)
{let instrument=event.data.instrument;let timeline=this._recording.timelineForInstrument(instrument);let overviewGraph=this._overviewGraphsByTypeMap.get(timeline.type);let treeElement=this._treeElementsByTypeMap.get(timeline.type);let shouldSuppressOnDeselect=false;let shouldSuppressSelectSibling=true;this._timelinesTreeOutline.removeChild(treeElement,shouldSuppressOnDeselect,shouldSuppressSelectSibling);overviewGraph.removeEventListener(WebInspector.TimelineOverviewGraph.Event.RecordSelected,this._recordSelected,this);this._graphsContainerView.removeSubview(overviewGraph);this._overviewGraphsByTypeMap.delete(timeline.type);this._treeElementsByTypeMap.delete(timeline.type);}
_markerAdded(event)
{this._timelineRuler.addMarker(event.data.marker);}
_timelineRulerMouseDown(event)
{this._timelineRulerSelectionChanged=false;}
_timelineRulerMouseClicked(event)
{if(this._timelineRulerSelectionChanged)
return;for(let overviewGraph of this._overviewGraphsByTypeMap.values()){let graphRect=overviewGraph.element.getBoundingClientRect();if(!(event.pageX>=graphRect.left&&event.pageX<=graphRect.right&&event.pageY>=graphRect.top&&event.pageY<=graphRect.bottom))
continue;let newClickEvent=new event.constructor(event.type,event);overviewGraph.element.dispatchEvent(newClickEvent);return;}}
_timeRangeSelectionChanged(event)
{this._timelineRulerSelectionChanged=true;let startTime=this._viewMode===WebInspector.TimelineOverview.ViewMode.Timelines?this._startTime:0;this._currentSettings.selectionStartValueSetting.value=this.selectionStartTime-startTime;this._currentSettings.selectionDurationSetting.value=this.selectionDuration;this.dispatchEventToListeners(WebInspector.TimelineOverview.Event.TimeRangeSelectionChanged);}
_recordSelected(event)
{for(let[type,overviewGraph]of this._overviewGraphsByTypeMap){if(overviewGraph!==event.target)
continue;let timeline=this._recording.timelines.get(type);this.dispatchEventToListeners(WebInspector.TimelineOverview.Event.RecordSelected,{timeline,record:event.data.record});return;}}
_resetSelection()
{function reset(settings)
{settings.durationPerPixelSetting.reset();settings.selectionStartValueSetting.reset();settings.selectionDurationSetting.reset();}
reset(this._timelinesViewModeSettings);if(this._renderingFramesViewModeSettings)
reset(this._renderingFramesViewModeSettings);this.secondsPerPixel=this._currentSettings.durationPerPixelSetting.value;this.selectionStartTime=this._currentSettings.selectionStartValueSetting.value;this.selectionDuration=this._currentSettings.selectionDurationSetting.value;}
_recordingReset(event)
{this._timelineRuler.clearMarkers();this._timelineRuler.addMarker(this._currentTimeMarker);}
_canShowTimelineType(type)
{let timelineViewMode=WebInspector.TimelineOverview.ViewMode.Timelines;if(type===WebInspector.TimelineRecord.Type.RenderingFrame)
timelineViewMode=WebInspector.TimelineOverview.ViewMode.RenderingFrames;return timelineViewMode===this._viewMode;}
_viewModeDidChange()
{let startTime=0;let isRenderingFramesMode=this._viewMode===WebInspector.TimelineOverview.ViewMode.RenderingFrames;if(isRenderingFramesMode){this._timelineRuler.minimumSelectionDuration=1;this._timelineRuler.snapInterval=1;this._timelineRuler.formatLabelCallback=(value)=>value.maxDecimals(0).toLocaleString();}else{this._timelineRuler.minimumSelectionDuration=0.01;this._timelineRuler.snapInterval=NaN;this._timelineRuler.formatLabelCallback=null;startTime=this._startTime;}
this.pixelAlignDuration=isRenderingFramesMode;this.selectionStartTime=this._currentSettings.selectionStartValueSetting.value+startTime;this.selectionDuration=this._currentSettings.selectionDurationSetting.value;for(let[type,overviewGraph]of this._overviewGraphsByTypeMap){let treeElement=this._treeElementsByTypeMap.get(type);treeElement.hidden=!this._canShowTimelineType(type);if(treeElement.hidden)
overviewGraph.hidden();else
overviewGraph.shown();}
this.element.classList.toggle("frames",isRenderingFramesMode);this.updateLayout(WebInspector.View.LayoutReason.Resize);}
_createViewModeSettings(viewMode,minimumDurationPerPixel,maximumDurationPerPixel,durationPerPixel,selectionStartValue,selectionDuration)
{durationPerPixel=Math.min(maximumDurationPerPixel,Math.max(minimumDurationPerPixel,durationPerPixel));let durationPerPixelSetting=new WebInspector.Setting(viewMode+"-duration-per-pixel",durationPerPixel);let selectionStartValueSetting=new WebInspector.Setting(viewMode+"-selection-start-value",selectionStartValue);let selectionDurationSetting=new WebInspector.Setting(viewMode+"-selection-duration",selectionDuration);return{scrollStartTime:0,minimumDurationPerPixel,maximumDurationPerPixel,durationPerPixelSetting,selectionStartValueSetting,selectionDurationSetting};}
get _currentSettings()
{return this._viewMode===WebInspector.TimelineOverview.ViewMode.Timelines?this._timelinesViewModeSettings:this._renderingFramesViewModeSettings;}
_timelinesTreeSelectionDidChange(event)
{function updateGraphSelectedState(timeline,selected)
{let overviewGraph=this._overviewGraphsByTypeMap.get(timeline.type);overviewGraph.selected=selected;}
let selectedTreeElement=event.data.selectedElement;let deselectedTreeElement=event.data.deselectedElement;let timeline=null;if(selectedTreeElement){timeline=selectedTreeElement.representedObject;updateGraphSelectedState.call(this,timeline,true);}
if(deselectedTreeElement)
updateGraphSelectedState.call(this,deselectedTreeElement.representedObject,false);this._selectedTimeline=timeline;this.dispatchEventToListeners(WebInspector.TimelineOverview.Event.TimelineSelected);}
_toggleEditingInstruments(event)
{if(this._editingInstruments)
this._stopEditingInstruments();else
this._startEditingInstruments();}
_editingInstrumentsDidChange()
{this.element.classList.toggle(WebInspector.TimelineOverview.EditInstrumentsStyleClassName,this._editingInstruments);this._timelineRuler.enabled=!this._editingInstruments;this._updateWheelAndGestureHandlers();this._updateEditInstrumentsButton();this.dispatchEventToListeners(WebInspector.TimelineOverview.Event.EditingInstrumentsDidChange);}
_updateEditInstrumentsButton()
{let newLabel=this._editingInstruments?WebInspector.UIString("Done"):WebInspector.UIString("Edit");this._editInstrumentsButton.label=newLabel;this._editInstrumentsButton.activated=this._editingInstruments;this._editInstrumentsButton.enabled=!WebInspector.timelineManager.isCapturing();}
_updateWheelAndGestureHandlers()
{if(this._editingInstruments){this.element.removeEventListener("wheel",this._handleWheelEventListener);this.element.removeEventListener("gesturestart",this._handleGestureStartEventListener);this.element.removeEventListener("gesturechange",this._handleGestureChangeEventListener);this.element.removeEventListener("gestureend",this._handleGestureEndEventListener);this._handleWheelEventListener=null;this._handleGestureStartEventListener=null;this._handleGestureChangeEventListener=null;this._handleGestureEndEventListener=null;}else{this._handleWheelEventListener=this._handleWheelEvent.bind(this);this._handleGestureStartEventListener=this._handleGestureStart.bind(this);this._handleGestureChangeEventListener=this._handleGestureChange.bind(this);this._handleGestureEndEventListener=this._handleGestureEnd.bind(this);this.element.addEventListener("wheel",this._handleWheelEventListener);this.element.addEventListener("gesturestart",this._handleGestureStartEventListener);this.element.addEventListener("gesturechange",this._handleGestureChangeEventListener);this.element.addEventListener("gestureend",this._handleGestureEndEventListener);}}
_startEditingInstruments()
{if(this._editingInstruments)
return;this._editingInstruments=true;for(let type of this._instrumentTypes){let treeElement=this._treeElementsByTypeMap.get(type);if(!treeElement){let timeline=this._recording.timelines.get(type);const placeholder=true;treeElement=new WebInspector.TimelineTreeElement(timeline,placeholder);let insertionIndex=insertionIndexForObjectInListSortedByFunction(treeElement,this._timelinesTreeOutline.children,this._compareTimelineTreeElements.bind(this));this._timelinesTreeOutline.insertChild(treeElement,insertionIndex);let placeholderGraph=new WebInspector.View;placeholderGraph.element.classList.add("timeline-overview-graph");treeElement[WebInspector.TimelineOverview.PlaceholderOverviewGraph]=placeholderGraph;this._graphsContainerView.insertSubviewBefore(placeholderGraph,this._graphsContainerView.subviews[insertionIndex]);}
treeElement.editing=true;treeElement.addEventListener(WebInspector.TimelineTreeElement.Event.EnabledDidChange,this._timelineTreeElementEnabledDidChange,this);}
this._editingInstrumentsDidChange();}
_stopEditingInstruments()
{if(!this._editingInstruments)
return;this._editingInstruments=false;let instruments=this._recording.instruments;for(let treeElement of this._treeElementsByTypeMap.values()){if(treeElement.status.checked){treeElement.editing=false;treeElement.removeEventListener(WebInspector.TimelineTreeElement.Event.EnabledDidChange,this._timelineTreeElementEnabledDidChange,this);continue;}
let timelineInstrument=instruments.find((instrument)=>instrument.timelineRecordType===treeElement.representedObject.type);this._recording.removeInstrument(timelineInstrument);}
let placeholderTreeElements=this._timelinesTreeOutline.children.filter((treeElement)=>treeElement.placeholder);for(let treeElement of placeholderTreeElements){this._timelinesTreeOutline.removeChild(treeElement);let placeholderGraph=treeElement[WebInspector.TimelineOverview.PlaceholderOverviewGraph];this._graphsContainerView.removeSubview(placeholderGraph);if(treeElement.status.checked){let instrument=WebInspector.Instrument.createForTimelineType(treeElement.representedObject.type);this._recording.addInstrument(instrument);}}
let instrumentTypes=instruments.map((instrument)=>instrument.timelineRecordType);WebInspector.timelineManager.enabledTimelineTypes=instrumentTypes;this._editingInstrumentsDidChange();}
_capturingStarted()
{this._editInstrumentsButton.enabled=false;this._stopEditingInstruments();}
_capturingStopped()
{this._editInstrumentsButton.enabled=true;}
_compareTimelineTreeElements(a,b)
{let aTimelineType=a.representedObject.type;let bTimelineType=b.representedObject.type;if(aTimelineType===WebInspector.TimelineRecord.Type.RenderingFrame)
return 1;if(bTimelineType===WebInspector.TimelineRecord.Type.RenderingFrame)
return-1;if(a.placeholder!==b.placeholder)
return a.placeholder?1:-1;let aTimelineIndex=this._instrumentTypes.indexOf(aTimelineType);let bTimelineIndex=this._instrumentTypes.indexOf(bTimelineType);return aTimelineIndex-bTimelineIndex;}
_timelineTreeElementEnabledDidChange(event)
{let enabled=this._timelinesTreeOutline.children.some((treeElement)=>{let timelineType=treeElement.representedObject.type;return this._canShowTimelineType(timelineType)&&treeElement.status.checked;});this._editInstrumentsButton.enabled=enabled;}};WebInspector.TimelineOverview.PlaceholderOverviewGraph=Symbol("placeholder-overview-graph");WebInspector.TimelineOverview.ScrollDeltaDenominator=500;WebInspector.TimelineOverview.EditInstrumentsStyleClassName="edit-instruments";WebInspector.TimelineOverview.MinimumDurationPerPixel=0.0001;WebInspector.TimelineOverview.MaximumDurationPerPixel=60;WebInspector.TimelineOverview.ViewMode={Timelines:"timeline-overview-view-mode-timelines",RenderingFrames:"timeline-overview-view-mode-rendering-frames"};WebInspector.TimelineOverview.Event={EditingInstrumentsDidChange:"editing-instruments-did-change",RecordSelected:"timeline-overview-record-selected",TimelineSelected:"timeline-overview-timeline-selected",TimeRangeSelectionChanged:"timeline-overview-time-range-selection-changed"};WebInspector.TimelineRecordTreeElement=class TimelineRecordTreeElement extends WebInspector.GeneralTreeElement
{constructor(timelineRecord,subtitleNameStyle,includeDetailsInMainTitle,sourceCodeLocation,representedObject)
{sourceCodeLocation=sourceCodeLocation||timelineRecord.sourceCodeLocation||null;let alternateSubtitle=null;if(includeDetailsInMainTitle&&timelineRecord.type===WebInspector.TimelineRecord.Type.Script&&timelineRecord.eventType===WebInspector.ScriptTimelineRecord.EventType.TimerInstalled){let timeoutString=Number.secondsToString(timelineRecord.details.timeout/1000);alternateSubtitle=document.createElement("span");alternateSubtitle.classList.add("alternate-subtitle");if(timelineRecord.details.repeating)
alternateSubtitle.textContent=WebInspector.UIString("%s interval").format(timeoutString);else
alternateSubtitle.textContent=WebInspector.UIString("%s delay").format(timeoutString);}
let subtitle=null;if(sourceCodeLocation){subtitle=document.createElement("span");if(subtitleNameStyle!==WebInspector.SourceCodeLocation.NameStyle.None)
sourceCodeLocation.populateLiveDisplayLocationString(subtitle,"textContent",null,subtitleNameStyle);else
sourceCodeLocation.populateLiveDisplayLocationString(subtitle,"textContent",null,WebInspector.SourceCodeLocation.NameStyle.None,WebInspector.UIString("line "));}
let iconStyleClass=WebInspector.TimelineTabContentView.iconClassNameForRecord(timelineRecord);let title=WebInspector.TimelineTabContentView.displayNameForRecord(timelineRecord);super([iconStyleClass],title,subtitle,representedObject||timelineRecord,false);this._record=timelineRecord;this._sourceCodeLocation=sourceCodeLocation;if(this._sourceCodeLocation)
this.tooltipHandledSeparately=true;if(alternateSubtitle)
this.titlesElement.appendChild(alternateSubtitle);}
get record()
{return this._record;}
get filterableData()
{var url=this._sourceCodeLocation?this._sourceCodeLocation.sourceCode.url:"";return{text:[this.mainTitle,url||"",this._record.details||""]};}
get sourceCodeLocation()
{return this._sourceCodeLocation;}
onattach()
{super.onattach();if(!this.tooltipHandledSeparately)
return;var tooltipPrefix=this.mainTitle+"\n";this._sourceCodeLocation.populateLiveDisplayLocationTooltip(this.element,tooltipPrefix);}};WebInspector.TimelineRecordTreeElement.StyleRecordIconStyleClass="style-record";WebInspector.TimelineRecordTreeElement.LayoutRecordIconStyleClass="layout-record";WebInspector.TimelineRecordTreeElement.PaintRecordIconStyleClass="paint-record";WebInspector.TimelineRecordTreeElement.CompositeRecordIconStyleClass="composite-record";WebInspector.TimelineRecordTreeElement.RenderingFrameRecordIconStyleClass="rendering-frame-record";WebInspector.TimelineRecordTreeElement.APIRecordIconStyleClass="api-record";WebInspector.TimelineRecordTreeElement.EvaluatedRecordIconStyleClass="evaluated-record";WebInspector.TimelineRecordTreeElement.EventRecordIconStyleClass="event-record";WebInspector.TimelineRecordTreeElement.TimerRecordIconStyleClass="timer-record";WebInspector.TimelineRecordTreeElement.AnimationRecordIconStyleClass="animation-record";WebInspector.TimelineRecordTreeElement.ProbeRecordIconStyleClass="probe-record";WebInspector.TimelineRecordTreeElement.ConsoleProfileIconStyleClass="console-profile-record";WebInspector.TimelineRecordTreeElement.GarbageCollectionIconStyleClass="garbage-collection-profile-record";WebInspector.TimelineTreeElement=class TimelineTreeElement extends WebInspector.GeneralTreeElement
{constructor(timeline,placeholder)
{let displayName=WebInspector.TimelineTabContentView.displayNameForTimelineType(timeline.type);let iconClassName=WebInspector.TimelineTabContentView.iconClassNameForTimelineType(timeline.type);let genericClassName=WebInspector.TimelineTabContentView.genericClassNameForTimelineType(timeline.type);super([iconClassName,genericClassName],displayName,"",timeline);this._placeholder=placeholder||false;this.editing=this._placeholder;}
get placeholder()
{return this._placeholder;}
get editing()
{return this._editing;}
set editing(x)
{if(this._editing===x)
return;this._editing=x;this.selectable=!this._editing;this._updateStatusButton();}
onattach()
{super.onattach();this.listItemElement.addEventListener("click",this._clickHandler.bind(this));}
_showCloseButton()
{let tooltip=WebInspector.UIString("Close %s timeline view").format(this.mainTitle);let button=new WebInspector.TreeElementStatusButton(useSVGSymbol("Images/CloseLarge.svg","close-button",tooltip));button.addEventListener(WebInspector.TreeElementStatusButton.Event.Clicked,()=>{this.deselect();});this.status=button.element;}
_showCheckbox()
{let checkboxElement=document.createElement("input");checkboxElement.type="checkbox";checkboxElement.checked=!this._placeholder;let button=new WebInspector.TreeElementStatusButton(checkboxElement);checkboxElement.addEventListener("change",()=>{this._dispatchEnabledDidChangeEvent();});this.status=checkboxElement;}
_updateStatusButton()
{if(this._editing)
this._showCheckbox();else
this._showCloseButton();}
_clickHandler()
{if(!this._editing)
return;this.status.checked=!this.status.checked;this._dispatchEnabledDidChangeEvent();}
_dispatchEnabledDidChangeEvent()
{this.dispatchEventToListeners(WebInspector.TimelineTreeElement.Event.EnabledDidChange);}};WebInspector.TimelineTreeElement.Event={EnabledDidChange:"timeline-tree-element-enabled-did-change"};WebInspector.ConsoleTabContentView=class ConsoleTabContentView extends WebInspector.ContentBrowserTabContentView
{constructor(identifier)
{let{image,title}=WebInspector.ConsoleTabContentView.tabInfo();let tabBarItem=new WebInspector.GeneralTabBarItem(image,title);super(identifier||"console","console",tabBarItem,null,null,true);}
static tabInfo()
{return{image:"Images/Console.svg",title:WebInspector.UIString("Console"),};}
get type()
{return WebInspector.ConsoleTabContentView.Type;}
shown()
{super.shown();WebInspector.consoleContentView.prompt.focus();if(this.contentBrowser.currentContentView===WebInspector.consoleContentView)
return;
if(WebInspector.consoleContentView.parentContainer)
WebInspector.consoleContentView.parentContainer.closeContentView(WebInspector.consoleContentView);this.contentBrowser.showContentView(WebInspector.consoleContentView);}
showRepresentedObject(representedObject,cookie)
{
}
canShowRepresentedObject(representedObject)
{return representedObject instanceof WebInspector.LogObject;}
get supportsSplitContentBrowser()
{return false;}};WebInspector.ConsoleTabContentView.Type="console";WebInspector.DebuggerTabContentView=class DebuggerTabContentView extends WebInspector.ContentBrowserTabContentView
{constructor(identifier)
{let{image,title}=WebInspector.DebuggerTabContentView.tabInfo();let tabBarItem=new WebInspector.GeneralTabBarItem(image,title);let detailsSidebarPanelConstructors=[WebInspector.ScopeChainDetailsSidebarPanel,WebInspector.ResourceDetailsSidebarPanel,WebInspector.ProbeDetailsSidebarPanel];super(identifier||"debugger","debugger",tabBarItem,WebInspector.DebuggerSidebarPanel,detailsSidebarPanelConstructors);}
static tabInfo()
{return{image:"Images/Debugger.svg",title:WebInspector.UIString("Debugger"),};}
get type()
{return WebInspector.DebuggerTabContentView.Type;}
get supportsSplitContentBrowser()
{return true;}
canShowRepresentedObject(representedObject)
{if(representedObject instanceof WebInspector.Script)
return true;if(!(representedObject instanceof WebInspector.Resource))
return false;return representedObject.type===WebInspector.Resource.Type.Document||representedObject.type===WebInspector.Resource.Type.Script;}
showDetailsSidebarPanels()
{super.showDetailsSidebarPanels();if(!this._showScopeChainDetailsSidebarPanel)
return;let scopeChainDetailsSidebarPanel=WebInspector.instanceForClass(WebInspector.ScopeChainDetailsSidebarPanel);if(!scopeChainDetailsSidebarPanel.parentSidebar)
return;scopeChainDetailsSidebarPanel.show();this._showScopeChainDetailsSidebarPanel=false;}
showScopeChainDetailsSidebarPanel()
{this._showScopeChainDetailsSidebarPanel=true;}
revealAndSelectBreakpoint(breakpoint)
{var treeElement=this.navigationSidebarPanel.treeElementForRepresentedObject(breakpoint);if(treeElement)
treeElement.revealAndSelect();}};WebInspector.DebuggerTabContentView.Type="debugger";WebInspector.ElementsTabContentView=class ElementsTabContentView extends WebInspector.ContentBrowserTabContentView
{constructor(identifier)
{let{image,title}=WebInspector.ElementsTabContentView.tabInfo();let tabBarItem=new WebInspector.GeneralTabBarItem(image,title);let detailsSidebarPanelConstructors=[WebInspector.DOMNodeDetailsSidebarPanel,WebInspector.CSSStyleDetailsSidebarPanel];if(window.LayerTreeAgent)
detailsSidebarPanelConstructors.push(WebInspector.LayerTreeDetailsSidebarPanel);super(identifier||"elements","elements",tabBarItem,null,detailsSidebarPanelConstructors,true);WebInspector.frameResourceManager.addEventListener(WebInspector.FrameResourceManager.Event.MainFrameDidChange,this._mainFrameDidChange,this);WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange,this._mainResourceDidChange,this);}
static tabInfo()
{return{image:"Images/Elements.svg",title:WebInspector.UIString("Elements"),};}
static isTabAllowed()
{return!!window.DOMAgent;}
get type()
{return WebInspector.ElementsTabContentView.Type;}
get supportsSplitContentBrowser()
{return true;}
canShowRepresentedObject(representedObject)
{return representedObject instanceof WebInspector.DOMTree;}
showRepresentedObject(representedObject,cookie)
{if(!this.contentBrowser.currentContentView)
this._showDOMTreeContentView();if(!cookie||!cookie.nodeToSelect)
return;let domTreeContentView=this.contentBrowser.currentContentView;domTreeContentView.selectAndRevealDOMNode(cookie.nodeToSelect);
cookie.nodeToSelect=undefined;}
shown()
{super.shown();if(!this.contentBrowser.currentContentView)
this._showDOMTreeContentView();}
closed()
{super.closed();WebInspector.frameResourceManager.removeEventListener(null,null,this);WebInspector.Frame.removeEventListener(null,null,this);}
_showDOMTreeContentView()
{this.contentBrowser.contentViewContainer.closeAllContentViews();var mainFrame=WebInspector.frameResourceManager.mainFrame;if(mainFrame)
this.contentBrowser.showContentViewForRepresentedObject(mainFrame.domTree);}
_mainFrameDidChange(event)
{this._showDOMTreeContentView();}
_mainResourceDidChange(event)
{if(!event.target.isMainFrame())
return;this._showDOMTreeContentView();}};WebInspector.ElementsTabContentView.Type="elements";WebInspector.ResourceTreeElement=class ResourceTreeElement extends WebInspector.SourceCodeTreeElement
{constructor(resource,representedObject)
{super(resource,["resource",WebInspector.ResourceTreeElement.ResourceIconStyleClassName,resource.type],"","",representedObject||resource,false);this._updateResource(resource);}
static compareResourceTreeElements(a,b)
{var comparisonResult=a.resource.type.extendedLocaleCompare(b.resource.type);if(comparisonResult!==0)
return comparisonResult;if(a.resource.type===WebInspector.Resource.Type.XHR||a.resource.type===WebInspector.Resource.Type.Fetch||a.resource.type===WebInspector.Resource.Type.WebSocket)
return a.resource.firstTimestamp-b.resource.firstTimestamp||0;
comparisonResult=a.subtitle.extendedLocaleCompare(b.subtitle);if(comparisonResult!==0)
return comparisonResult;return a.mainTitle.extendedLocaleCompare(b.mainTitle);}
static compareFolderAndResourceTreeElements(a,b)
{var aIsFolder=a instanceof WebInspector.FolderTreeElement;var bIsFolder=b instanceof WebInspector.FolderTreeElement;if(aIsFolder&&!bIsFolder)
return-1;if(!aIsFolder&&bIsFolder)
return 1;if(aIsFolder&&bIsFolder)
return a.mainTitle.extendedLocaleCompare(b.mainTitle);return WebInspector.ResourceTreeElement.compareResourceTreeElements(a,b);}
get resource()
{return this._resource;}
get filterableData()
{let urlComponents=this._resource.urlComponents;return{text:[urlComponents.lastPathComponent,urlComponents.path,this._resource.url]};}
ondblclick()
{if(this._resource.type===WebInspector.Resource.Type.WebSocket)
return;InspectorFrontendHost.openInNewTab(this._resource.url);}
_updateResource(resource)
{
if(this._resource){this._resource.removeEventListener(WebInspector.Resource.Event.URLDidChange,this._urlDidChange,this);this._resource.removeEventListener(WebInspector.Resource.Event.TypeDidChange,this._typeDidChange,this);this._resource.removeEventListener(WebInspector.Resource.Event.LoadingDidFinish,this._updateStatus,this);this._resource.removeEventListener(WebInspector.Resource.Event.LoadingDidFail,this._updateStatus,this);}
this._updateSourceCode(resource);this._resource=resource;resource.addEventListener(WebInspector.Resource.Event.URLDidChange,this._urlDidChange,this);resource.addEventListener(WebInspector.Resource.Event.TypeDidChange,this._typeDidChange,this);resource.addEventListener(WebInspector.Resource.Event.LoadingDidFinish,this._updateStatus,this);resource.addEventListener(WebInspector.Resource.Event.LoadingDidFail,this._updateStatus,this);this._updateTitles();this._updateStatus();this._updateToolTip();}
_updateTitles()
{var frame=this._resource.parentFrame;var target=this._resource.target;var isMainResource=this._resource.isMainResource();var parentResourceHost=target.mainResource?target.mainResource.urlComponents.host:null;if(isMainResource&&frame){parentResourceHost=frame.parentFrame?frame.parentFrame.mainResource.urlComponents.host:null;}else if(frame){parentResourceHost=frame.mainResource.urlComponents.host;}
var urlComponents=this._resource.urlComponents;var oldMainTitle=this.mainTitle;this.mainTitle=WebInspector.displayNameForURL(this._resource.url,urlComponents);var subtitle=parentResourceHost!==urlComponents.host||frame&&frame.isMainFrame()&&isMainResource?WebInspector.displayNameForHost(urlComponents.host):null;this.subtitle=this.mainTitle!==subtitle?subtitle:null;if(oldMainTitle!==this.mainTitle)
this.callFirstAncestorFunction("descendantResourceTreeElementMainTitleDidChange",[this,oldMainTitle]);}
populateContextMenu(contextMenu,event)
{WebInspector.appendContextMenuItemsForSourceCode(contextMenu,this._resource);super.populateContextMenu(contextMenu,event);}
_updateStatus()
{if(this._resource.hadLoadingError())
this.addClassName(WebInspector.ResourceTreeElement.FailedStyleClassName);else
this.removeClassName(WebInspector.ResourceTreeElement.FailedStyleClassName);if(this._resource.finished||this._resource.failed){if(this.status&&this.status[WebInspector.ResourceTreeElement.SpinnerSymbol])
this.status="";}else{let spinner=new WebInspector.IndeterminateProgressSpinner;this.status=spinner.element;this.status[WebInspector.ResourceTreeElement.SpinnerSymbol]=true;}}
_updateToolTip()
{this.tooltip=this._resource.displayURL;}
_urlDidChange(event)
{this._updateTitles();this._updateToolTip();}
_typeDidChange(event)
{this.removeClassName(event.data.oldType);this.addClassName(this._resource.type);this.callFirstAncestorFunction("descendantResourceTreeElementTypeDidChange",[this,event.data.oldType]);}};WebInspector.ResourceTreeElement.ResourceIconStyleClassName="resource-icon";WebInspector.ResourceTreeElement.FailedStyleClassName="failed";WebInspector.ResourceTreeElement.SpinnerSymbol=Symbol("spinner");WebInspector.ResourcesTabContentView=class ResourcesTabContentView extends WebInspector.ContentBrowserTabContentView
{constructor(identifier)
{let{image,title}=WebInspector.ResourcesTabContentView.tabInfo();let tabBarItem=new WebInspector.GeneralTabBarItem(image,title);let detailsSidebarPanelConstructors=[WebInspector.ResourceDetailsSidebarPanel,WebInspector.ProbeDetailsSidebarPanel];if(window.CanvasAgent&&WebInspector.settings.experimentalShowCanvasContextsInResources.value)
detailsSidebarPanelConstructors.push(WebInspector.CanvasDetailsSidebarPanel);detailsSidebarPanelConstructors=detailsSidebarPanelConstructors.concat([WebInspector.DOMNodeDetailsSidebarPanel,WebInspector.CSSStyleDetailsSidebarPanel]);if(window.LayerTreeAgent)
detailsSidebarPanelConstructors.push(WebInspector.LayerTreeDetailsSidebarPanel);super(identifier||"resources","resources",tabBarItem,WebInspector.ResourceSidebarPanel,detailsSidebarPanelConstructors);}
static tabInfo()
{return{image:"Images/Resources.svg",title:WebInspector.UIString("Resources"),};}
get type()
{return WebInspector.ResourcesTabContentView.Type;}
get supportsSplitContentBrowser()
{return true;}
canShowRepresentedObject(representedObject)
{return representedObject instanceof WebInspector.Frame||representedObject instanceof WebInspector.Resource||representedObject instanceof WebInspector.Script||representedObject instanceof WebInspector.CSSStyleSheet||representedObject instanceof WebInspector.ContentFlow||representedObject instanceof WebInspector.Canvas||representedObject instanceof WebInspector.Collection;}};WebInspector.ResourcesTabContentView.Type="resources";WebInspector.SearchTabContentView=class SearchTabContentView extends WebInspector.ContentBrowserTabContentView
{constructor(identifier)
{let{image,title}=WebInspector.SearchTabContentView.tabInfo();let tabBarItem=new WebInspector.GeneralTabBarItem(image,title);let detailsSidebarPanelConstructors=[WebInspector.ResourceDetailsSidebarPanel,WebInspector.ProbeDetailsSidebarPanel,WebInspector.DOMNodeDetailsSidebarPanel,WebInspector.CSSStyleDetailsSidebarPanel];if(window.LayerTreeAgent)
detailsSidebarPanelConstructors.push(WebInspector.LayerTreeDetailsSidebarPanel);super(identifier||"search","search",tabBarItem,WebInspector.SearchSidebarPanel,detailsSidebarPanelConstructors);this._forcePerformSearch=false;}
static tabInfo()
{return{image:"Images/SearchResults.svg",title:WebInspector.UIString("Search"),};}
static isEphemeral()
{return true;}
get type()
{return WebInspector.SearchTabContentView.Type;}
shown()
{super.shown();setTimeout(this.focusSearchField.bind(this));}
canShowRepresentedObject(representedObject)
{if(!(representedObject instanceof WebInspector.Resource)&&!(representedObject instanceof WebInspector.Script)&&!(representedObject instanceof WebInspector.DOMTree))
return false;return!!this.navigationSidebarPanel.contentTreeOutline.getCachedTreeElement(representedObject);}
focusSearchField()
{this.navigationSidebarPanel.focusSearchField(this._forcePerformSearch);this._forcePerformSearch=false;}
performSearch(searchQuery)
{this.navigationSidebarPanel.performSearch(searchQuery);this._forcePerformSearch=false;}
handleCopyEvent(event)
{let selectedTreeElement=this.navigationSidebarPanel.contentTreeOutline.selectedTreeElement;if(!selectedTreeElement)
return;event.clipboardData.setData("text/plain",selectedTreeElement.synthesizedTextValue);event.stopPropagation();event.preventDefault();}
initialLayout()
{super.initialLayout();this._forcePerformSearch=true;}};WebInspector.SearchTabContentView.Type="search";WebInspector.SettingsTabContentView=class SettingsTabContentView extends WebInspector.TabContentView
{constructor(identifier)
{let tabBarItem=new WebInspector.PinnedTabBarItem("Images/Gear.svg",WebInspector.UIString("Open Settings"));super(identifier||"settings","settings",tabBarItem);tabBarItem.representedObject=this;this._selectedSettingsView=null;this._settingsViews=[];}
static tabInfo()
{return{image:"Images/Gear.svg",title:WebInspector.UIString("Settings"),};}
static isEphemeral()
{return true;}
static shouldSaveTab()
{return false;}
get type(){return WebInspector.SettingsTabContentView.Type;}
get selectedSettingsView()
{return this._selectedSettingsView;}
set selectedSettingsView(settingsView)
{if(this._selectedSettingsView===settingsView)
return;if(this._selectedSettingsView)
this.replaceSubview(this._selectedSettingsView,settingsView);else
this.addSubview(settingsView);this._selectedSettingsView=settingsView;this._selectedSettingsView.updateLayout();let navigationItem=this._navigationBar.findNavigationItem(settingsView.identifier);console.assert(navigationItem,"Missing navigation item for settings view.",settingsView)
if(!navigationItem)
return;this._navigationBar.selectedNavigationItem=navigationItem;}
addSettingsView(settingsView)
{if(this._settingsViews.includes(settingsView)){return;}
this._settingsViews.push(settingsView);this._navigationBar.addNavigationItem(new WebInspector.RadioButtonNavigationItem(settingsView.identifier,settingsView.displayName));this._updateNavigationBarVisibility();}
setSettingsViewVisible(settingsView,visible)
{let navigationItem=this._navigationBar.findNavigationItem(settingsView.identifier);if(!navigationItem)
return;if(navigationItem.hidden===!visible)
return;navigationItem.hidden=!visible;settingsView.element.classList.toggle("hidden",!visible);this._updateNavigationBarVisibility();if(!this.selectedSettingsView){if(visible)
this.selectedSettingsView=settingsView;return;}
if(this.selectedSettingsView!==settingsView)
return;let index=this._settingsViews.indexOf(settingsView);console.assert(index!==-1,"SettingsView not found.",settingsView)
if(index===-1)
return;let previousIndex=index;while(--previousIndex>=0){let previousNavigationItem=this._navigationBar.navigationItems[previousIndex];if(!previousNavigationItem||previousNavigationItem.hidden)
continue;this.selectedSettingsView=this._settingsViews[previousIndex];return;}
let nextIndex=index;while(++nextIndex<this._settingsViews.length){let nextNavigationItem=this._navigationBar.navigationItems[nextIndex];if(!nextNavigationItem||nextNavigationItem.hidden)
continue;this.selectedSettingsView=this._settingsViews[nextIndex];return;}}
initialLayout()
{this._navigationBar=new WebInspector.NavigationBar;this._navigationBar.addEventListener(WebInspector.NavigationBar.Event.NavigationItemSelected,this._navigationItemSelected,this);this.addSubview(this._navigationBar);this._createGeneralSettingsView();WebInspector.notifications.addEventListener(WebInspector.Notification.DebugUIEnabledDidChange,this._updateDebugSettingsViewVisibility,this);this._updateDebugSettingsViewVisibility();this.selectedSettingsView=this._settingsViews[0];}
_createGeneralSettingsView()
{let generalSettingsView=new WebInspector.SettingsView("general",WebInspector.UIString("General"));const indentValues=[WebInspector.UIString("Tabs"),WebInspector.UIString("Spaces")];let indentEditor=generalSettingsView.addGroupWithCustomSetting(WebInspector.UIString("Prefer indent using:"),WebInspector.SettingEditor.Type.Select,{values:indentValues});indentEditor.value=indentValues[WebInspector.settings.indentWithTabs.value?0:1];indentEditor.addEventListener(WebInspector.SettingEditor.Event.ValueDidChange,()=>{WebInspector.settings.indentWithTabs.value=indentEditor.value===indentValues[0];});const widthLabel=WebInspector.UIString("spaces");const widthOptions={min:1};generalSettingsView.addSetting(WebInspector.UIString("Tab width:"),WebInspector.settings.tabSize,widthLabel,widthOptions);generalSettingsView.addSetting(WebInspector.UIString("Indent width:"),WebInspector.settings.indentUnit,widthLabel,widthOptions);generalSettingsView.addSetting(WebInspector.UIString("Line wrapping:"),WebInspector.settings.enableLineWrapping,WebInspector.UIString("Wrap lines to editor width"));let showGroup=generalSettingsView.addGroup(WebInspector.UIString("Show:"));showGroup.addSetting(WebInspector.settings.showWhitespaceCharacters,WebInspector.UIString("Whitespace characters"));showGroup.addSetting(WebInspector.settings.showInvalidCharacters,WebInspector.UIString("Invalid characters"));generalSettingsView.addSeparator();let stylesEditingGroup=generalSettingsView.addGroup(WebInspector.UIString("Styles Editing:"));stylesEditingGroup.addSetting(WebInspector.settings.stylesShowInlineWarnings,WebInspector.UIString("Show inline warnings"));stylesEditingGroup.addSetting(WebInspector.settings.stylesInsertNewline,WebInspector.UIString("Automatically insert newline"));stylesEditingGroup.addSetting(WebInspector.settings.stylesSelectOnFirstClick,WebInspector.UIString("Select text on first click"));generalSettingsView.addSeparator();generalSettingsView.addSetting(WebInspector.UIString("Network:"),WebInspector.settings.clearNetworkOnNavigate,WebInspector.UIString("Clear when page navigates"));generalSettingsView.addSeparator();generalSettingsView.addSetting(WebInspector.UIString("Console:"),WebInspector.settings.clearLogOnNavigate,WebInspector.UIString("Clear when page navigates"));generalSettingsView.addSeparator();generalSettingsView.addSetting(WebInspector.UIString("Debugger:"),WebInspector.settings.showScopeChainOnPause,WebInspector.UIString("Show Scope Chain on pause"));generalSettingsView.addSeparator();const zoomLevels=[0.6,0.8,1,1.2,1.4,1.6,1.8,2,2.2,2.4];const zoomValues=zoomLevels.map((level)=>[level,Number.percentageString(level,0)]);let zoomEditor=generalSettingsView.addGroupWithCustomSetting(WebInspector.UIString("Zoom:"),WebInspector.SettingEditor.Type.Select,{values:zoomValues});zoomEditor.value=WebInspector.getZoomFactor();zoomEditor.addEventListener(WebInspector.SettingEditor.Event.ValueDidChange,()=>{WebInspector.setZoomFactor(zoomEditor.value);});WebInspector.settings.zoomFactor.addEventListener(WebInspector.Setting.Event.Changed,()=>{zoomEditor.value=WebInspector.getZoomFactor().maxDecimals(2);});this.addSettingsView(generalSettingsView);}
_createDebugSettingsView()
{if(this._debugSettingsView)
return;this._debugSettingsView=new WebInspector.SettingsView("debug",WebInspector.unlocalizedString("Debug"));let protocolMessagesGroup=this._debugSettingsView.addGroup(WebInspector.unlocalizedString("Protocol Logging:"));let autoLogProtocolMessagesEditor=protocolMessagesGroup.addSetting(WebInspector.settings.autoLogProtocolMessages,WebInspector.unlocalizedString("Messages"));WebInspector.settings.autoLogProtocolMessages.addEventListener(WebInspector.Setting.Event.Changed,()=>{autoLogProtocolMessagesEditor.value=InspectorBackend.dumpInspectorProtocolMessages;});protocolMessagesGroup.addSetting(WebInspector.settings.autoLogTimeStats,WebInspector.unlocalizedString("Time Stats"));this._debugSettingsView.addSeparator();this._debugSettingsView.addSetting(WebInspector.unlocalizedString("Uncaught Exception Reporter:"),WebInspector.settings.enableUncaughtExceptionReporter,WebInspector.unlocalizedString("Enabled"));this._debugSettingsView.addSeparator();const layoutDirectionValues=[[WebInspector.LayoutDirection.System,WebInspector.unlocalizedString("System Default")],[WebInspector.LayoutDirection.LTR,WebInspector.unlocalizedString("Left to Right (LTR)")],[WebInspector.LayoutDirection.RTL,WebInspector.unlocalizedString("Right to Left (RTL)")],];let layoutDirectionEditor=this._debugSettingsView.addGroupWithCustomSetting(WebInspector.unlocalizedString("Layout Direction:"),WebInspector.SettingEditor.Type.Select,{values:layoutDirectionValues});layoutDirectionEditor.value=WebInspector.settings.layoutDirection.value;layoutDirectionEditor.addEventListener(WebInspector.SettingEditor.Event.ValueDidChange,()=>{WebInspector.setLayoutDirection(layoutDirectionEditor.value);});if(window.CanvasAgent){this._debugSettingsView.addSeparator();this._debugSettingsView.addSetting(WebInspector.UIString("Canvas:"),WebInspector.settings.experimentalShowCanvasContextsInResources,WebInspector.UIString("Show Contexts in Resources Tab"));}
this.addSettingsView(this._debugSettingsView);}
_updateNavigationBarVisibility()
{let visibleItems=0;for(let item of this._navigationBar.navigationItems){if(!item.hidden&&++visibleItems>1){this._navigationBar.element.classList.remove("invisible");return;}}
this._navigationBar.element.classList.add("invisible");}
_navigationItemSelected(event)
{let navigationItem=event.target.selectedNavigationItem;if(!navigationItem)
return;let settingsView=this._settingsViews.find((view)=>view.identifier===navigationItem.identifier);if(!settingsView)
return;this.selectedSettingsView=settingsView;}
_updateDebugSettingsViewVisibility()
{if(WebInspector.isDebugUIEnabled())
this._createDebugSettingsView();if(!this._debugSettingsView)
return;this.setSettingsViewVisible(this._debugSettingsView,WebInspector.isDebugUIEnabled());this.needsLayout();}};WebInspector.SettingsTabContentView.Type="settings";WebInspector.StorageTabContentView=class StorageTabContentView extends WebInspector.ContentBrowserTabContentView
{constructor(identifier)
{let{image,title}=WebInspector.StorageTabContentView.tabInfo();let tabBarItem=new WebInspector.GeneralTabBarItem(image,title);let detailsSidebarPanelConstructors=[WebInspector.ApplicationCacheDetailsSidebarPanel,WebInspector.IndexedDatabaseDetailsSidebarPanel];super(identifier||"storage","storage",tabBarItem,WebInspector.StorageSidebarPanel,detailsSidebarPanelConstructors);}
static tabInfo()
{return{image:"Images/Storage.svg",title:WebInspector.UIString("Storage"),};}
static isTabAllowed()
{return!!window.DOMStorageAgent||!!window.DatabaseAgent||!!window.IndexedDBAgent;}
get type()
{return WebInspector.StorageTabContentView.Type;}
get supportsSplitContentBrowser()
{return true;}
canShowRepresentedObject(representedObject)
{return representedObject instanceof WebInspector.DOMStorageObject||representedObject instanceof WebInspector.CookieStorageObject||representedObject instanceof WebInspector.DatabaseTableObject||representedObject instanceof WebInspector.DatabaseObject||representedObject instanceof WebInspector.ApplicationCacheFrame||representedObject instanceof WebInspector.IndexedDatabaseObjectStore||representedObject instanceof WebInspector.IndexedDatabase||representedObject instanceof WebInspector.IndexedDatabaseObjectStoreIndex;}};WebInspector.StorageTabContentView.Type="storage";WebInspector.TimelineTabContentView=class TimelineTabContentView extends WebInspector.ContentBrowserTabContentView
{constructor(identifier)
{let{image,title}=WebInspector.TimelineTabContentView.tabInfo();let tabBarItem=new WebInspector.GeneralTabBarItem(image,title);let detailsSidebarPanelConstructors=[WebInspector.ResourceDetailsSidebarPanel,WebInspector.ProbeDetailsSidebarPanel];super(identifier||"timeline","timeline",tabBarItem,null,detailsSidebarPanelConstructors);this._recordingTreeElementMap=new Map;this._recordingsTreeOutline=new WebInspector.TreeOutline;this._recordingsTreeOutline.addEventListener(WebInspector.TreeOutline.Event.SelectionDidChange,this._recordingsTreeSelectionDidChange,this);this._toggleRecordingShortcut=new WebInspector.KeyboardShortcut(null,WebInspector.KeyboardShortcut.Key.Space,this._toggleRecordingOnSpacebar.bind(this));this._toggleRecordingShortcut.implicitlyPreventsDefault=false;this._toggleRecordingShortcut.disabled=true;this._toggleNewRecordingShortcut=new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.Shift,WebInspector.KeyboardShortcut.Key.Space,this._toggleNewRecordingOnSpacebar.bind(this));this._toggleNewRecordingShortcut.implicitlyPreventsDefault=false;this._toggleNewRecordingShortcut.disabled=true;let toolTip=WebInspector.UIString("Start recording (%s)\nCreate new recording (%s)").format(this._toggleRecordingShortcut.displayName,this._toggleNewRecordingShortcut.displayName);let altToolTip=WebInspector.UIString("Stop recording (%s)").format(this._toggleRecordingShortcut.displayName);this._recordButton=new WebInspector.ToggleButtonNavigationItem("record-start-stop",toolTip,altToolTip,"Images/Record.svg","Images/Stop.svg",13,13);this._recordButton.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,this._recordButtonClicked,this);this.contentBrowser.navigationBar.insertNavigationItem(this._recordButton,0);if(WebInspector.FPSInstrument.supported()){let timelinesNavigationItem=new WebInspector.RadioButtonNavigationItem(WebInspector.TimelineOverview.ViewMode.Timelines,WebInspector.UIString("Events"));let renderingFramesNavigationItem=new WebInspector.RadioButtonNavigationItem(WebInspector.TimelineOverview.ViewMode.RenderingFrames,WebInspector.UIString("Frames"));this.contentBrowser.navigationBar.insertNavigationItem(timelinesNavigationItem,1);this.contentBrowser.navigationBar.insertNavigationItem(renderingFramesNavigationItem,2);this.contentBrowser.navigationBar.addEventListener(WebInspector.NavigationBar.Event.NavigationItemSelected,this._viewModeSelected,this);}
WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.Event.RecordingCreated,this._recordingCreated,this);WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.Event.RecordingLoaded,this._recordingLoaded,this);WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.Event.CapturingStarted,this._capturingStartedOrStopped,this);WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.Event.CapturingStopped,this._capturingStartedOrStopped,this);WebInspector.notifications.addEventListener(WebInspector.Notification.VisibilityStateDidChange,this._inspectorVisibilityChanged,this);this._displayedRecording=null;this._displayedContentView=null;this._viewMode=null;this._previousSelectedTimelineType=null;const selectedByUser=false;this._changeViewMode(WebInspector.TimelineOverview.ViewMode.Timelines,selectedByUser);for(let recording of WebInspector.timelineManager.recordings)
this._addRecording(recording);this._recordingCountChanged();this.contentBrowser.updateHierarchicalPathForCurrentContentView();}
static tabInfo()
{return{image:"Images/Timeline.svg",title:WebInspector.UIString("Timelines"),};}
static isTabAllowed()
{return!!window.TimelineAgent||!!window.ScriptProfilerAgent;}
static displayNameForTimelineType(timelineType)
{switch(timelineType){case WebInspector.TimelineRecord.Type.Network:return WebInspector.UIString("Network Requests");case WebInspector.TimelineRecord.Type.Layout:return WebInspector.UIString("Layout & Rendering");case WebInspector.TimelineRecord.Type.Script:return WebInspector.UIString("JavaScript & Events");case WebInspector.TimelineRecord.Type.RenderingFrame:return WebInspector.UIString("Rendering Frames");case WebInspector.TimelineRecord.Type.Memory:return WebInspector.UIString("Memory");case WebInspector.TimelineRecord.Type.HeapAllocations:return WebInspector.UIString("JavaScript Allocations");default:console.error("Unknown Timeline type:",timelineType);}
return null;}
static iconClassNameForTimelineType(timelineType)
{switch(timelineType){case WebInspector.TimelineRecord.Type.Network:return"network-icon";case WebInspector.TimelineRecord.Type.Layout:return"layout-icon";case WebInspector.TimelineRecord.Type.Memory:return"memory-icon";case WebInspector.TimelineRecord.Type.HeapAllocations:return"heap-allocations-icon";case WebInspector.TimelineRecord.Type.Script:return"script-icon";case WebInspector.TimelineRecord.Type.RenderingFrame:return"rendering-frame-icon";default:console.error("Unknown Timeline type:",timelineType);}
return null;}
static genericClassNameForTimelineType(timelineType)
{switch(timelineType){case WebInspector.TimelineRecord.Type.Network:return"network";case WebInspector.TimelineRecord.Type.Layout:return"colors";case WebInspector.TimelineRecord.Type.Memory:return"memory";case WebInspector.TimelineRecord.Type.HeapAllocations:return"heap-allocations";case WebInspector.TimelineRecord.Type.Script:return"script";case WebInspector.TimelineRecord.Type.RenderingFrame:return"rendering-frame";default:console.error("Unknown Timeline type:",timelineType);}
return null;}
static iconClassNameForRecord(timelineRecord)
{switch(timelineRecord.type){case WebInspector.TimelineRecord.Type.Layout:switch(timelineRecord.eventType){case WebInspector.LayoutTimelineRecord.EventType.InvalidateStyles:case WebInspector.LayoutTimelineRecord.EventType.RecalculateStyles:return WebInspector.TimelineRecordTreeElement.StyleRecordIconStyleClass;case WebInspector.LayoutTimelineRecord.EventType.InvalidateLayout:case WebInspector.LayoutTimelineRecord.EventType.ForcedLayout:case WebInspector.LayoutTimelineRecord.EventType.Layout:return WebInspector.TimelineRecordTreeElement.LayoutRecordIconStyleClass;case WebInspector.LayoutTimelineRecord.EventType.Paint:return WebInspector.TimelineRecordTreeElement.PaintRecordIconStyleClass;case WebInspector.LayoutTimelineRecord.EventType.Composite:return WebInspector.TimelineRecordTreeElement.CompositeRecordIconStyleClass;default:console.error("Unknown LayoutTimelineRecord eventType: "+timelineRecord.eventType,timelineRecord);}
break;case WebInspector.TimelineRecord.Type.Script:switch(timelineRecord.eventType){case WebInspector.ScriptTimelineRecord.EventType.APIScriptEvaluated:return WebInspector.TimelineRecordTreeElement.APIRecordIconStyleClass;case WebInspector.ScriptTimelineRecord.EventType.ScriptEvaluated:return WebInspector.TimelineRecordTreeElement.EvaluatedRecordIconStyleClass;case WebInspector.ScriptTimelineRecord.EventType.MicrotaskDispatched:case WebInspector.ScriptTimelineRecord.EventType.EventDispatched:return WebInspector.TimelineRecordTreeElement.EventRecordIconStyleClass;case WebInspector.ScriptTimelineRecord.EventType.ProbeSampleRecorded:return WebInspector.TimelineRecordTreeElement.ProbeRecordIconStyleClass;case WebInspector.ScriptTimelineRecord.EventType.ConsoleProfileRecorded:return WebInspector.TimelineRecordTreeElement.ConsoleProfileIconStyleClass;case WebInspector.ScriptTimelineRecord.EventType.GarbageCollected:return WebInspector.TimelineRecordTreeElement.GarbageCollectionIconStyleClass;case WebInspector.ScriptTimelineRecord.EventType.TimerInstalled:return WebInspector.TimelineRecordTreeElement.TimerRecordIconStyleClass;case WebInspector.ScriptTimelineRecord.EventType.TimerFired:case WebInspector.ScriptTimelineRecord.EventType.TimerRemoved:return WebInspector.TimelineRecordTreeElement.TimerRecordIconStyleClass;case WebInspector.ScriptTimelineRecord.EventType.AnimationFrameFired:case WebInspector.ScriptTimelineRecord.EventType.AnimationFrameRequested:case WebInspector.ScriptTimelineRecord.EventType.AnimationFrameCanceled:return WebInspector.TimelineRecordTreeElement.AnimationRecordIconStyleClass;default:console.error("Unknown ScriptTimelineRecord eventType: "+timelineRecord.eventType,timelineRecord);}
break;case WebInspector.TimelineRecord.Type.RenderingFrame:return WebInspector.TimelineRecordTreeElement.RenderingFrameRecordIconStyleClass;case WebInspector.TimelineRecord.Type.HeapAllocations:return"heap-snapshot-record";case WebInspector.TimelineRecord.Type.Memory:default:console.error("Unknown TimelineRecord type: "+timelineRecord.type,timelineRecord);}
return null;}
static displayNameForRecord(timelineRecord,includeDetailsInMainTitle)
{switch(timelineRecord.type){case WebInspector.TimelineRecord.Type.Network:return WebInspector.displayNameForURL(timelineRecord.resource.url,timelineRecord.resource.urlComponents);case WebInspector.TimelineRecord.Type.Layout:return WebInspector.LayoutTimelineRecord.displayNameForEventType(timelineRecord.eventType);case WebInspector.TimelineRecord.Type.Script:return WebInspector.ScriptTimelineRecord.EventType.displayName(timelineRecord.eventType,timelineRecord.details,includeDetailsInMainTitle);case WebInspector.TimelineRecord.Type.RenderingFrame:return WebInspector.UIString("Frame %d").format(timelineRecord.frameNumber);case WebInspector.TimelineRecord.Type.HeapAllocations:if(timelineRecord.heapSnapshot.title)
return WebInspector.UIString("Snapshot %d \u2014 %s").format(timelineRecord.heapSnapshot.identifier,timelineRecord.heapSnapshot.title);return WebInspector.UIString("Snapshot %d").format(timelineRecord.heapSnapshot.identifier);case WebInspector.TimelineRecord.Type.Memory:default:console.error("Unknown TimelineRecord type: "+timelineRecord.type,timelineRecord);}
return null;}
get type()
{return WebInspector.TimelineTabContentView.Type;}
shown()
{super.shown();this._toggleRecordingShortcut.disabled=false;this._toggleNewRecordingShortcut.disabled=false;if(WebInspector.visible)
WebInspector.timelineManager.autoCaptureOnPageLoad=true;}
hidden()
{super.hidden();this._toggleRecordingShortcut.disabled=true;this._toggleNewRecordingShortcut.disabled=true;WebInspector.timelineManager.autoCaptureOnPageLoad=false;}
closed()
{super.closed();if(WebInspector.FPSInstrument.supported())
this.contentBrowser.navigationBar.removeEventListener(null,null,this);WebInspector.timelineManager.removeEventListener(null,null,this);WebInspector.notifications.removeEventListener(null,null,this);}
canShowRepresentedObject(representedObject)
{return representedObject instanceof WebInspector.TimelineRecording;}
restoreFromCookie(cookie)
{this._restoredShowingTimelineRecordingContentView=cookie[WebInspector.TimelineTabContentView.ShowingTimelineRecordingContentViewCookieKey];if(!this._restoredShowingTimelineRecordingContentView){if(!this.contentBrowser.currentContentView){if(!this._displayedRecording&&WebInspector.timelineManager.activeRecording)
this._recordingLoaded();this._showTimelineViewForType(WebInspector.TimelineTabContentView.OverviewTimelineIdentifierCookieValue);}
return;}
let selectedTimelineViewIdentifier=cookie[WebInspector.TimelineTabContentView.SelectedTimelineViewIdentifierCookieKey];if(selectedTimelineViewIdentifier===WebInspector.TimelineRecord.Type.RenderingFrame&&!WebInspector.FPSInstrument.supported())
selectedTimelineViewIdentifier=null;this._showTimelineViewForType(selectedTimelineViewIdentifier);super.restoreFromCookie(cookie);}
saveToCookie(cookie)
{cookie[WebInspector.TimelineTabContentView.ShowingTimelineRecordingContentViewCookieKey]=this.contentBrowser.currentContentView instanceof WebInspector.TimelineRecordingContentView;if(this._viewMode===WebInspector.TimelineOverview.ViewMode.RenderingFrames)
cookie[WebInspector.TimelineTabContentView.SelectedTimelineViewIdentifierCookieKey]=WebInspector.TimelineRecord.Type.RenderingFrame;else{let selectedTimeline=this._getTimelineForCurrentContentView();if(selectedTimeline)
cookie[WebInspector.TimelineTabContentView.SelectedTimelineViewIdentifierCookieKey]=selectedTimeline.type;else
cookie[WebInspector.TimelineTabContentView.SelectedTimelineViewIdentifierCookieKey]=WebInspector.TimelineTabContentView.OverviewTimelineIdentifierCookieValue;}
super.saveToCookie(cookie);}
treeElementForRepresentedObject(representedObject)
{if(!this._recordingTreeElementMap)
return null;if(representedObject instanceof WebInspector.TimelineRecording)
return this._recordingTreeElementMap.get(representedObject);return null;}
_capturingStartedOrStopped(event)
{let isCapturing=WebInspector.timelineManager.isCapturing();this._recordButton.toggled=isCapturing;}
_inspectorVisibilityChanged(event)
{WebInspector.timelineManager.autoCaptureOnPageLoad=!!this.visible&&!!WebInspector.visible;}
_toggleRecordingOnSpacebar(event)
{if(WebInspector.isEventTargetAnEditableField(event))
return;this._toggleRecording();event.preventDefault();}
_toggleNewRecordingOnSpacebar(event)
{if(WebInspector.isEventTargetAnEditableField(event))
return;this._toggleRecording(true);event.preventDefault();}
_toggleRecording(shouldCreateRecording)
{let isCapturing=WebInspector.timelineManager.isCapturing();this._recordButton.toggled=isCapturing;if(isCapturing)
WebInspector.timelineManager.stopCapturing();else{WebInspector.timelineManager.startCapturing(shouldCreateRecording);this._recordingLoaded();}}
_recordButtonClicked(event)
{let shouldCreateNewRecording=window.event?window.event.shiftKey:false;this._recordButton.toggled=!WebInspector.timelineManager.isCapturing();this._toggleRecording(shouldCreateNewRecording);}
_recordingsTreeSelectionDidChange(event)
{let treeElement=event.data.selectedElement;if(!treeElement)
return;this._recordingSelected(treeElement.representedObject);}
_recordingCreated(event)
{this._addRecording(event.data.recording);this._recordingCountChanged();}
_addRecording(recording)
{let recordingTreeElement=new WebInspector.GeneralTreeElement(WebInspector.TimelineTabContentView.StopwatchIconStyleClass,recording.displayName,null,recording);this._recordingTreeElementMap.set(recording,recordingTreeElement);this._recordingsTreeOutline.appendChild(recordingTreeElement);}
_recordingCountChanged()
{let previousTreeElement=null;for(let treeElement of this._recordingTreeElementMap.values()){if(previousTreeElement){previousTreeElement.nextSibling=treeElement;treeElement.previousSibling=previousTreeElement;}
previousTreeElement=treeElement;}}
_recordingSelected(recording)
{this._displayedRecording=recording;let cookie={};this.saveToCookie(cookie);if(this._displayedContentView)
this._displayedContentView.removeEventListener(WebInspector.ContentView.Event.NavigationItemsDidChange,this._displayedContentViewNavigationItemsDidChange,this);let onlyExisting=true;this._displayedContentView=this.contentBrowser.contentViewForRepresentedObject(this._displayedRecording,onlyExisting);if(this._displayedContentView){this._displayedContentView.addEventListener(WebInspector.ContentView.Event.NavigationItemsDidChange,this._displayedContentViewNavigationItemsDidChange,this);let currentTimelineView=this._displayedContentView.currentTimelineView;let timelineType=currentTimelineView&&currentTimelineView.representedObject instanceof WebInspector.Timeline?currentTimelineView.representedObject.type:null;this._showTimelineViewForType(timelineType);return;}
onlyExisting=false;this._displayedContentView=this.contentBrowser.contentViewForRepresentedObject(this._displayedRecording,onlyExisting);if(this._displayedContentView)
this._displayedContentView.addEventListener(WebInspector.ContentView.Event.NavigationItemsDidChange,this._displayedContentViewNavigationItemsDidChange,this);this.restoreFromCookie(cookie);}
_recordingLoaded(event)
{this._recordingSelected(WebInspector.timelineManager.activeRecording);}
_viewModeSelected(event)
{let selectedNavigationItem=event.target.selectedNavigationItem;if(!selectedNavigationItem)
return;const selectedByUser=true;this._changeViewMode(selectedNavigationItem.identifier,selectedByUser);}
_changeViewMode(mode,selectedByUser)
{if(this._viewMode===mode)
return;let navigationItemForViewMode=this.contentBrowser.navigationBar.findNavigationItem(mode);if(!navigationItemForViewMode)
return;this._viewMode=mode;this.contentBrowser.navigationBar.selectedNavigationItem=navigationItemForViewMode;if(!selectedByUser)
return;let timelineType=this._previousSelectedTimelineType;if(this._viewMode===WebInspector.TimelineOverview.ViewMode.RenderingFrames){let timeline=this._getTimelineForCurrentContentView();this._previousSelectedTimelineType=timeline?timeline.type:null;timelineType=WebInspector.TimelineRecord.Type.RenderingFrame;}
this._showTimelineViewForType(timelineType);}
_showTimelineViewForType(timelineType)
{let timeline=timelineType?this._displayedRecording.timelines.get(timelineType):null;if(timeline)
this._displayedContentView.showTimelineViewForTimeline(timeline);else
this._displayedContentView.showOverviewTimelineView();if(this.contentBrowser.currentContentView!==this._displayedContentView)
this.contentBrowser.showContentView(this._displayedContentView);}
_displayedContentViewNavigationItemsDidChange(event)
{let timeline=this._getTimelineForCurrentContentView();let newViewMode=WebInspector.TimelineOverview.ViewMode.Timelines;if(timeline&&timeline.type===WebInspector.TimelineRecord.Type.RenderingFrame)
newViewMode=WebInspector.TimelineOverview.ViewMode.RenderingFrames;const selectedByUser=false;this._changeViewMode(newViewMode,selectedByUser);}
_getTimelineForCurrentContentView()
{let currentContentView=this.contentBrowser.currentContentView;if(!(currentContentView instanceof WebInspector.TimelineRecordingContentView))
return null;let timelineView=currentContentView.currentTimelineView;return(timelineView&&timelineView.representedObject instanceof WebInspector.Timeline)?timelineView.representedObject:null;}};WebInspector.TimelineTabContentView.Type="timeline";WebInspector.TimelineTabContentView.ShowingTimelineRecordingContentViewCookieKey="timeline-sidebar-panel-showing-timeline-recording-content-view";WebInspector.TimelineTabContentView.SelectedTimelineViewIdentifierCookieKey="timeline-sidebar-panel-selected-timeline-view-identifier";WebInspector.TimelineTabContentView.OverviewTimelineIdentifierCookieValue="overview";WebInspector.TimelineTabContentView.StopwatchIconStyleClass="stopwatch-icon";WebInspector.DetailsSection=class DetailsSection extends WebInspector.Object
{constructor(identifier,title,groups,optionsElement,defaultCollapsedSettingValue)
{super();this._element=document.createElement("div");this._element.classList.add(identifier,"details-section");this._headerElement=document.createElement("div");this._headerElement.addEventListener("click",this._headerElementClicked.bind(this));this._headerElement.className="header";this._element.appendChild(this._headerElement);if(optionsElement instanceof HTMLElement){this._optionsElement=optionsElement;this._optionsElement.classList.add("options");this._optionsElement.addEventListener("mousedown",this._optionsElementMouseDown.bind(this));this._optionsElement.addEventListener("mouseup",this._optionsElementMouseUp.bind(this));this._headerElement.appendChild(this._optionsElement);}
this._titleElement=document.createElement("span");this._headerElement.appendChild(this._titleElement);this._contentElement=document.createElement("div");this._contentElement.className="content";this._element.appendChild(this._contentElement);this._identifier=identifier;this.title=title;this.groups=groups||[new WebInspector.DetailsSectionGroup];this._collapsedSetting=new WebInspector.Setting(identifier+"-details-section-collapsed",!!defaultCollapsedSettingValue);this.collapsed=this._collapsedSetting.value;this._expandedByUser=false;}
get element()
{return this._element;}
get identifier()
{return this._identifier;}
get title()
{return this._titleElement.textContent;}
set title(title)
{this._titleElement.textContent=title;}
get titleElement()
{return this._titleElement;}
set titleElement(element)
{this._headerElement.replaceChild(element,this._titleElement);this._titleElement=element;}
get collapsed()
{return this._element.classList.contains(WebInspector.DetailsSection.CollapsedStyleClassName);}
set collapsed(flag)
{if(flag)
this._element.classList.add(WebInspector.DetailsSection.CollapsedStyleClassName);else
this._element.classList.remove(WebInspector.DetailsSection.CollapsedStyleClassName);this._collapsedSetting.value=flag||false;this.dispatchEventToListeners(WebInspector.DetailsSection.Event.CollapsedStateChanged,{collapsed:this._collapsedSetting.value});}
get groups()
{return this._groups;}
set groups(groups)
{this._contentElement.removeChildren();this._groups=groups||[];for(var i=0;i<this._groups.length;++i)
this._contentElement.appendChild(this._groups[i].element);}
get expandedByUser()
{return this._expandedByUser;}
_headerElementClicked(event)
{if(event.target.isSelfOrDescendant(this._optionsElement))
return;var collapsed=this.collapsed;this.collapsed=!collapsed;this._expandedByUser=collapsed;this._element.scrollIntoViewIfNeeded(false);}
_optionsElementMouseDown(event)
{this._headerElement.classList.add(WebInspector.DetailsSection.MouseOverOptionsElementStyleClassName);}
_optionsElementMouseUp(event)
{this._headerElement.classList.remove(WebInspector.DetailsSection.MouseOverOptionsElementStyleClassName);}};WebInspector.DetailsSection.CollapsedStyleClassName="collapsed";WebInspector.DetailsSection.MouseOverOptionsElementStyleClassName="mouse-over-options-element";WebInspector.DetailsSection.Event={CollapsedStateChanged:"details-section-collapsed-state-changed"};WebInspector.DetailsSectionDataGridRow=class DetailsSectionDataGridRow extends WebInspector.DetailsSectionRow
{constructor(dataGrid,emptyMessage)
{super(emptyMessage);this.element.classList.add("data-grid");this.dataGrid=dataGrid;}
get dataGrid()
{return this._dataGrid;}
set dataGrid(dataGrid)
{if(this._dataGrid===dataGrid)
return;this._dataGrid=dataGrid||null;if(dataGrid){dataGrid.inline=true;dataGrid.variableHeightRows=true;this.hideEmptyMessage();this.element.appendChild(dataGrid.element);dataGrid.updateLayoutIfNeeded();}else
this.showEmptyMessage();}
sizeDidChange()
{ if(this._dataGrid)
this._dataGrid.sizeDidChange();}};WebInspector.DetailsSectionGroup=class DetailsSectionGroup extends WebInspector.Object
{constructor(rows)
{super();this._element=document.createElement("div");this._element.className="group";this.rows=rows||[];}
get element()
{return this._element;}
get rows()
{return this._rows;}
set rows(rows)
{this._element.removeChildren();this._rows=rows||[];for(var i=0;i<this._rows.length;++i)
this._element.appendChild(this._rows[i].element);}};WebInspector.DetailsSectionSimpleRow=class DetailsSectionSimpleRow extends WebInspector.DetailsSectionRow
{constructor(label,value)
{super();this.element.classList.add("simple");this._labelElement=document.createElement("div");this._labelElement.className="label";this.element.appendChild(this._labelElement);this._valueElement=document.createElement("div");this._valueElement.className="value";this.element.appendChild(this._valueElement);
var valueElementClicked=function(event){event.stopPropagation();if(event.detail<3)
return;var currentSelection=window.getSelection();if(!currentSelection)
return;var currentRange=currentSelection.getRangeAt(0);if(!currentRange||currentRange.startContainer===currentRange.endContainer)
return;var correctedRange=document.createRange();correctedRange.selectNodeContents(event.currentTarget);currentSelection.removeAllRanges();currentSelection.addRange(correctedRange);};this._valueElement.addEventListener("click",valueElementClicked);this.label=label;this.value=value;}
get label()
{return this._labelElement.textContent;}
set label(label)
{this._labelElement.textContent=label;}
get value()
{return this._value;}
set value(value)
{this._value=value||"";if(this._value){this.element.classList.remove(WebInspector.DetailsSectionSimpleRow.EmptyStyleClassName);if(/[\s\u200b]/.test(this._value))
this.element.classList.remove(WebInspector.DetailsSectionSimpleRow.DataStyleClassName);else
this.element.classList.add(WebInspector.DetailsSectionSimpleRow.DataStyleClassName);}else{this.element.classList.add(WebInspector.DetailsSectionSimpleRow.EmptyStyleClassName);this.element.classList.remove(WebInspector.DetailsSectionSimpleRow.DataStyleClassName);}
if(value instanceof Node){this._valueElement.removeChildren();this._valueElement.appendChild(this._value);}else
this._valueElement.textContent=this._value;}
get tooltip()
{return this._valueElement.title;}
set tooltip(x)
{this._valueElement.title=x;}};WebInspector.DetailsSectionSimpleRow.DataStyleClassName="data";WebInspector.DetailsSectionSimpleRow.EmptyStyleClassName="empty";WebInspector.DetailsSectionTextRow=class DetailsSectionTextRow extends WebInspector.DetailsSectionRow
{constructor(text)
{super();this.element.classList.add("text");this.element.textContent=text;}
get text()
{return this.element.textContent;}
set text(text)
{this.element.textContent=text;}};WebInspector.SettingEditor=class SettingEditor extends WebInspector.Object
{constructor(type,label,options)
{super();this._type=type;this._label=label;this._value=null;this._editorElement=this._createEditorElement(options);this._element=document.createElement("div");this._element.classList.add("editor");this._element.append(this._editorElement);if(this._label){this._editorElement.id="setting-editor-"+WebInspector.SettingEditor._nextEditorIdentifier++;let labelElement=document.createElement("label");labelElement.setAttribute("for",this._editorElement.id);labelElement.textContent=label;this._element.append(labelElement);}}
static createForSetting(setting,label,options)
{let type;if(typeof setting.value==="boolean")
type=WebInspector.SettingEditor.Type.Checkbox;else if(typeof setting.value==="number")
type=WebInspector.SettingEditor.Type.Numeric;if(!type)
return null;let editor=new WebInspector.SettingEditor(type,label,options);editor.value=setting.value;editor.addEventListener(WebInspector.SettingEditor.Event.ValueDidChange,()=>{setting.value=editor.value;});return editor;}
get element(){return this._element;}
get type(){return this._type;}
get label(){return this._label;}
get value()
{return this._value;}
set value(value)
{if(this._value===value)
return;let oldValue=this._value;this._value=value;if(this._type==WebInspector.SettingEditor.Type.Checkbox)
this._editorElement.checked=!!this._value;else
this._editorElement.value=this._value;this.dispatchEventToListeners(WebInspector.SettingEditor.Event.ValueDidChange,{oldValue});}
_createEditorElement(options)
{let editorElement;switch(this._type){case WebInspector.SettingEditor.Type.Checkbox:editorElement=document.createElement("input");editorElement.type="checkbox";editorElement.addEventListener("change",(event)=>{this.value=event.target.checked;});break;case WebInspector.SettingEditor.Type.Numeric:editorElement=document.createElement("input");editorElement.type="number";if(options.min!==undefined)
editorElement.min=options.min;if(options.max!==undefined)
editorElement.max=options.max;editorElement.addEventListener("change",(event)=>{let currentValue=this._value;let newValue=parseInt(event.target.value);this.value=isNaN(newValue)?currentValue:newValue;});break;case WebInspector.SettingEditor.Type.Select:editorElement=document.createElement("select");var keyValuePairs=[];if(Array.isArray(options.values[0]))
keyValuePairs=options.values;else
keyValuePairs=options.values.map((value)=>[value,value]);for(let[key,value]of keyValuePairs){let optionElement=editorElement.appendChild(document.createElement("option"));optionElement.value=key;optionElement.textContent=value;}
editorElement.addEventListener("change",(event)=>{this.value=event.target.value;});break;default:console.error("Unknown editor type: "+this._type);}
return editorElement;}};WebInspector.SettingEditor._nextEditorIdentifier=1;WebInspector.SettingEditor.Type={Checkbox:"setting-editor-type-checkbox",Numeric:"setting-editor-type-numeric",Select:"setting-editor-type-select",};WebInspector.SettingEditor.Event={ValueDidChange:"value-did-change",};WebInspector.SettingsGroup=class SettingsGroup extends WebInspector.Object
{constructor(title)
{super();this._element=document.createElement("div");this._element.classList.add("container");let titleElement=this._element.appendChild(document.createElement("div"));titleElement.classList.add("title");titleElement.textContent=title;this._editorGroupElement=this._element.appendChild(document.createElement("div"));this._editorGroupElement.classList.add("editor-group");}
get element(){return this._element;}
addSetting(setting,label,options)
{let editor=WebInspector.SettingEditor.createForSetting(setting,label,options);if(!editor)
return null;this._editorGroupElement.append(editor.element);return editor;}
addCustomSetting(editorType,options)
{let editor=new WebInspector.SettingEditor(editorType,options.label,options);if(!editor)
return null;this._editorGroupElement.append(editor.element);return editor;}};WebInspector.SettingsView=class SettingsView extends WebInspector.View
{constructor(identifier,displayName)
{super();this._identifier=identifier;this._displayName=displayName;this.element.classList.add("settings-view",identifier);}
get identifier(){return this._identifier;}
get displayName(){return this._displayName;}
addSetting(title,setting,label,options)
{let settingsGroup=this.addGroup(title);return settingsGroup.addSetting(setting,label,options);}
addGroupWithCustomSetting(title,editorType,options)
{let settingsGroup=this.addGroup(title);return settingsGroup.addCustomSetting(editorType,options);}
addGroup(title)
{let settingsGroup=new WebInspector.SettingsGroup(title);this.element.append(settingsGroup.element);return settingsGroup;}
addSeparator()
{if(this.element.lastChild&&this.element.lastChild.classList.contains("separator"))
return;let separatorElement=this.element.appendChild(document.createElement("div"));separatorElement.classList.add("separator");}};WebInspector.SettingsView.EditorType={Checkbox:"settings-view-editor-type-checkbox",Numeric:"settings-view-editor-type-numeric",Select:"settings-view-editor-type-select",};WebInspector.ActivateButtonNavigationItem=class ActivateButtonNavigationItem extends WebInspector.ButtonNavigationItem
{constructor(identifier,defaultToolTip,activatedToolTip,image,imageWidth,imageHeight,role)
{super(identifier,defaultToolTip,image,imageWidth,imageHeight,role);this._defaultToolTip=defaultToolTip;this._activatedToolTip=activatedToolTip||defaultToolTip;this._role=role;}
get defaultToolTip()
{return this._defaultToolTip;}
get activatedToolTip()
{return this._activatedToolTip;}
get activated()
{return this.element.classList.contains(WebInspector.ActivateButtonNavigationItem.ActivatedStyleClassName);}
set activated(flag)
{this.element.classList.toggle(WebInspector.ActivateButtonNavigationItem.ActivatedStyleClassName,flag);if(flag){this.toolTip=this._activatedToolTip;if(this._role==="tab")
this.element.setAttribute("aria-selected","true");}else{this.toolTip=this._defaultToolTip;if(this._role==="tab")
this.element.removeAttribute("aria-selected");}}
get additionalClassNames()
{return["activate","button"];}};WebInspector.ActivateButtonNavigationItem.ActivatedStyleClassName="activated";WebInspector.ActivateButtonToolbarItem=class ActivateButtonToolbarItem extends WebInspector.ActivateButtonNavigationItem
{constructor(identifier,defaultToolTip,activatedToolTip,label,image,role)
{super(identifier,defaultToolTip,activatedToolTip,image,16,16,role);if(typeof label==="string"){this._labelElement=document.createElement("div");this._labelElement.className=WebInspector.ButtonToolbarItem.LabelStyleClassName;this._element.appendChild(this._labelElement);this.label=label;}}
get label()
{return this._labelElement.textContent;}
set label(newLabel)
{if(!newLabel||!this._labelElement)
return;this._labelElement.textContent=newLabel;}};WebInspector.ApplicationCacheDetailsSidebarPanel=class ApplicationCacheDetailsSidebarPanel extends WebInspector.DetailsSidebarPanel
{constructor()
{super("application-cache-details",WebInspector.UIString("Storage"));this.element.classList.add("application-cache");this._applicationCacheFrame=null;}
inspect(objects)
{if(!(objects instanceof Array))
objects=[objects];var applicationCacheFrameToInspect=null;for(var i=0;i<objects.length;++i){if(objects[i]instanceof WebInspector.ApplicationCacheFrame){applicationCacheFrameToInspect=objects[i];break;}}
this.applicationCacheFrame=applicationCacheFrameToInspect;return!!this.applicationCacheFrame;}
get applicationCacheFrame()
{return this._applicationCacheFrame;}
set applicationCacheFrame(applicationCacheFrame)
{if(this._applicationCacheFrame===applicationCacheFrame)
return;this._applicationCacheFrame=applicationCacheFrame;this.needsLayout();}
initialLayout()
{super.initialLayout();this._locationManifestURLRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Manifest URL"));this._locationFrameURLRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Frame URL"));let locationGroup=new WebInspector.DetailsSectionGroup([this._locationManifestURLRow,this._locationFrameURLRow]);let locationSection=new WebInspector.DetailsSection("application-cache-location",WebInspector.UIString("Location"),[locationGroup]);this._onlineRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Online"));this._statusRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Status"));let statusGroup=new WebInspector.DetailsSectionGroup([this._onlineRow,this._statusRow]);let statusSection=new WebInspector.DetailsSection("application-cache-status",WebInspector.UIString("Status"),[statusGroup]);this.contentView.element.appendChild(locationSection.element);this.contentView.element.appendChild(statusSection.element);WebInspector.applicationCacheManager.addEventListener(WebInspector.ApplicationCacheManager.Event.NetworkStateUpdated,this._networkStateUpdated,this);WebInspector.applicationCacheManager.addEventListener(WebInspector.ApplicationCacheManager.Event.FrameManifestStatusChanged,this._frameManifestStatusChanged,this);}
layout()
{super.layout();if(!this.applicationCacheFrame)
return;this._locationFrameURLRow.value=this.applicationCacheFrame.frame.url;this._locationManifestURLRow.value=this.applicationCacheFrame.manifest.manifestURL;this._refreshOnlineRow();this._refreshStatusRow();}
_networkStateUpdated(event)
{if(!this.applicationCacheFrame)
return;this._refreshOnlineRow();}
_frameManifestStatusChanged(event)
{if(!this.applicationCacheFrame)
return;if(event.data.frameManifest!==this.applicationCacheFrame)
return;this._refreshStatusRow();}
_refreshOnlineRow()
{this._onlineRow.value=WebInspector.applicationCacheManager.online?WebInspector.UIString("Yes"):WebInspector.UIString("No");}
_refreshStatusRow()
{this._statusRow.value=WebInspector.ApplicationCacheDetailsSidebarPanel.Status[this.applicationCacheFrame.status];}};WebInspector.ApplicationCacheDetailsSidebarPanel.Status={0:"Uncached",1:"Idle",2:"Checking",3:"Downloading",4:"UpdateReady",5:"Obsolete"};WebInspector.ApplicationCacheFrameContentView=class ApplicationCacheFrameContentView extends WebInspector.ContentView
{constructor(representedObject)
{super(representedObject);this.element.classList.add("application-cache-frame");this._frame=representedObject.frame;this._emptyView=WebInspector.createMessageTextView(WebInspector.UIString("No Application Cache information available"),false);this._emptyView.classList.add("hidden");this.element.appendChild(this._emptyView);this._markDirty();var status=representedObject.status;this.updateStatus(status);WebInspector.applicationCacheManager.addEventListener(WebInspector.ApplicationCacheManager.Event.FrameManifestStatusChanged,this._updateStatus,this);}
shown()
{super.shown();this._maybeUpdate();}
closed()
{WebInspector.applicationCacheManager.removeEventListener(null,null,this);super.closed();}
saveToCookie(cookie)
{cookie.type=WebInspector.ContentViewCookieType.ApplicationCache;cookie.frame=this.representedObject.frame.url;cookie.manifest=this.representedObject.manifest.manifestURL;}
get scrollableElements()
{if(!this._dataGrid)
return[];return[this._dataGrid.scrollContainer];}
_maybeUpdate()
{if(!this.visible||!this._viewDirty)
return;this._update();this._viewDirty=false;}
_markDirty()
{this._viewDirty=true;}
_updateStatus(event)
{var frameManifest=event.data.frameManifest;if(frameManifest!==this.representedObject)
return;this.updateStatus(frameManifest.status);}
updateStatus(status)
{var oldStatus=this._status;this._status=status;if(this.visible&&this._status===WebInspector.ApplicationCacheManager.Status.Idle&&(oldStatus===WebInspector.ApplicationCacheManager.Status.UpdateReady||!this._resources))
this._markDirty();this._maybeUpdate();}
_update()
{WebInspector.applicationCacheManager.requestApplicationCache(this._frame,this._updateCallback.bind(this));}
_updateCallback(applicationCache)
{if(!applicationCache||!applicationCache.manifestURL){delete this._manifest;delete this._creationTime;delete this._updateTime;delete this._size;delete this._resources;this._emptyView.classList.remove("hidden");if(this._dataGrid)
this._dataGrid.element.classList.add("hidden");return;}
this._manifest=applicationCache.manifestURL;this._creationTime=applicationCache.creationTime;this._updateTime=applicationCache.updateTime;this._size=applicationCache.size;this._resources=applicationCache.resources;if(!this._dataGrid)
this._createDataGrid();this._populateDataGrid();this._dataGrid.autoSizeColumns(20,80);this._dataGrid.element.classList.remove("hidden");this._emptyView.classList.add("hidden");}
_createDataGrid()
{var columns={url:{},type:{},size:{}};columns.url.title=WebInspector.UIString("Resource");columns.url.sortable=true;columns.type.title=WebInspector.UIString("Type");columns.type.sortable=true;columns.size.title=WebInspector.UIString("Size");columns.size.aligned="right";columns.size.sortable=true;this._dataGrid=new WebInspector.DataGrid(columns);this._dataGrid.addEventListener(WebInspector.DataGrid.Event.SortChanged,this._sortDataGrid,this);this._dataGrid.sortColumnIdentifier="url";this._dataGrid.sortOrder=WebInspector.DataGrid.SortOrder.Ascending;this._dataGrid.createSettings("application-cache-frame-content-view");this.addSubview(this._dataGrid);this._dataGrid.updateLayout();}
_sortDataGrid()
{function numberCompare(columnIdentifier,nodeA,nodeB)
{return nodeA.data[columnIdentifier]-nodeB.data[columnIdentifier];}
function localeCompare(columnIdentifier,nodeA,nodeB)
{return(nodeA.data[columnIdentifier]+"").extendedLocaleCompare(nodeB.data[columnIdentifier]+"");}
var comparator;switch(this._dataGrid.sortColumnIdentifier){case"type":comparator=localeCompare.bind(this,"type");break;case"size":comparator=numberCompare.bind(this,"size");break;case"url":default:comparator=localeCompare.bind(this,"url");break;}
this._dataGrid.sortNodes(comparator);}
_populateDataGrid()
{this._dataGrid.removeChildren();for(var resource of this._resources){var data={url:resource.url,type:resource.type,size:Number.bytesToString(resource.size)};var node=new WebInspector.DataGridNode(data);this._dataGrid.appendChild(node);}}
_deleteButtonClicked(event)
{if(!this._dataGrid||!this._dataGrid.selectedNode)
return;this._deleteCallback(this._dataGrid.selectedNode);}
_deleteCallback(node)
{
}};WebInspector.ApplicationCacheFrameTreeElement=class ApplicationCacheFrameTreeElement extends WebInspector.GeneralTreeElement
{constructor(representedObject)
{super("application-cache-frame","","",representedObject,false);this.updateTitles();}
updateTitles()
{var url=this.representedObject.frame.url;var parsedURL=parseURL(url);this.mainTitle=WebInspector.displayNameForURL(url,parsedURL);var subtitle=WebInspector.displayNameForHost(parsedURL.host);var manifestTreeElement=null;var currentAncestor=this.parent;while(currentAncestor&&!currentAncestor.root){if(currentAncestor instanceof WebInspector.ApplicationCacheManifestTreeElement){manifestTreeElement=currentAncestor;break;}
currentAncestor=currentAncestor.parent;}
var subtitleIsDuplicate=subtitle===this._mainTitle||(manifestTreeElement&&manifestTreeElement.subtitle===subtitle);this.subtitle=subtitleIsDuplicate?null:subtitle;}};WebInspector.ApplicationCacheManifestTreeElement=class ApplicationCacheManifestTreeElement extends WebInspector.StorageTreeElement
{constructor(representedObject)
{super("application-cache-manifest","",representedObject);this.hasChildren=true;this.expanded=true;}
get name()
{if(!this._name)
this._generateTitles();return this._name;}
get secondaryName()
{if(!this._secondaryName)
this._generateTitles();return this._secondaryName;}
get categoryName()
{return WebInspector.UIString("Application Cache");}
_generateTitles()
{var parsedURL=parseURL(this.representedObject.manifestURL);this._name=WebInspector.displayNameForURL(this.representedObject.manifestURL,parsedURL);var secondaryName=WebInspector.displayNameForHost(parsedURL.host);this._secondaryName=this._name!==secondaryName?secondaryName:null;}};WebInspector.BezierEditor=class BezierEditor extends WebInspector.Object
{constructor()
{super();this._element=document.createElement("div");this._element.classList.add("bezier-editor");var editorWidth=184;var editorHeight=200;this._padding=25;this._controlHandleRadius=7;this._bezierWidth=editorWidth-(this._controlHandleRadius*2);this._bezierHeight=editorHeight-(this._controlHandleRadius*2)-(this._padding*2);this._bezierPreviewContainer=this._element.createChild("div","bezier-preview");this._bezierPreviewContainer.title=WebInspector.UIString("Restart animation");this._bezierPreviewContainer.addEventListener("mousedown",this._resetPreviewAnimation.bind(this));this._bezierPreview=this._bezierPreviewContainer.createChild("div");this._bezierPreviewTiming=this._element.createChild("div","bezier-preview-timing");this._bezierContainer=this._element.appendChild(createSVGElement("svg"));this._bezierContainer.setAttribute("width",editorWidth);this._bezierContainer.setAttribute("height",editorHeight);this._bezierContainer.classList.add("bezier-container");let svgGroup=this._bezierContainer.appendChild(createSVGElement("g"));svgGroup.setAttribute("transform","translate(0, "+this._padding+")");let linearCurve=svgGroup.appendChild(createSVGElement("line"));linearCurve.classList.add("linear-curve");linearCurve.setAttribute("x1",this._controlHandleRadius);linearCurve.setAttribute("y1",this._bezierHeight+this._controlHandleRadius);linearCurve.setAttribute("x2",this._bezierWidth+this._controlHandleRadius);linearCurve.setAttribute("y2",this._controlHandleRadius);this._bezierCurve=svgGroup.appendChild(createSVGElement("path"));this._bezierCurve.classList.add("bezier-curve");function createControl(x1,y1)
{x1+=this._controlHandleRadius;y1+=this._controlHandleRadius;let line=svgGroup.appendChild(createSVGElement("line"));line.classList.add("control-line");line.setAttribute("x1",x1);line.setAttribute("y1",y1);line.setAttribute("x2",x1);line.setAttribute("y2",y1);let handle=svgGroup.appendChild(createSVGElement("circle"));handle.classList.add("control-handle");return{point:null,line,handle};}
this._inControl=createControl.call(this,0,this._bezierHeight);this._outControl=createControl.call(this,this._bezierWidth,0);this._numberInputContainer=this._element.createChild("div","number-input-container");function createBezierInput(id,{min,max}={})
{let key="_bezier"+id+"Input";this[key]=this._numberInputContainer.createChild("input");this[key].type="number";this[key].step=0.01;if(!isNaN(min))
this[key].min=min;if(!isNaN(max))
this[key].max=max;this[key].addEventListener("input",this.debounce(250)._handleNumberInputInput);this[key].addEventListener("keydown",this._handleNumberInputKeydown.bind(this));}
createBezierInput.call(this,"InX",{min:0,max:1});createBezierInput.call(this,"InY");createBezierInput.call(this,"OutX",{min:0,max:1});createBezierInput.call(this,"OutY");this._selectedControl=null;this._mouseDownPosition=null;this._bezierContainer.addEventListener("mousedown",this);WebInspector.addWindowKeydownListener(this);}
get element()
{return this._element;}
set bezier(bezier)
{if(!bezier)
return;var isCubicBezier=bezier instanceof WebInspector.CubicBezier;if(!isCubicBezier)
return;this._bezier=bezier;this._updateBezierPreview();}
get bezier()
{return this._bezier;}
removeListeners()
{WebInspector.removeWindowKeydownListener(this);}
handleEvent(event)
{switch(event.type){case"mousedown":this._handleMousedown(event);break;case"mousemove":this._handleMousemove(event);break;case"mouseup":this._handleMouseup(event);break;}}
handleKeydownEvent(event)
{if(!this._selectedControl||!this._element.parentNode)
return false;let horizontal=0;let vertical=0;switch(event.keyCode){case WebInspector.KeyboardShortcut.Key.Up.keyCode:vertical=-1;break;case WebInspector.KeyboardShortcut.Key.Right.keyCode:horizontal=1;break;case WebInspector.KeyboardShortcut.Key.Down.keyCode:vertical=1;break;case WebInspector.KeyboardShortcut.Key.Left.keyCode:horizontal=-1;break;default:return false;}
if(event.shiftKey){horizontal*=10;vertical*=10;}
vertical*=this._bezierWidth/100;horizontal*=this._bezierHeight/100;this._selectedControl.point.x=Number.constrain(this._selectedControl.point.x+horizontal,0,this._bezierWidth);this._selectedControl.point.y+=vertical;this._updateControl(this._selectedControl);this._updateValue();return true;}
_handleMousedown(event)
{if(event.button!==0)
return;window.addEventListener("mousemove",this,true);window.addEventListener("mouseup",this,true);this._bezierPreviewContainer.classList.remove("animate");this._bezierPreviewTiming.classList.remove("animate");this._updateControlPointsForMouseEvent(event,true);}
_handleMousemove(event)
{this._updateControlPointsForMouseEvent(event);}
_handleMouseup(event)
{this._selectedControl.handle.classList.remove("selected");this._mouseDownPosition=null;this._triggerPreviewAnimation();window.removeEventListener("mousemove",this,true);window.removeEventListener("mouseup",this,true);}
_updateControlPointsForMouseEvent(event,calculateSelectedControlPoint)
{var point=WebInspector.Point.fromEventInElement(event,this._bezierContainer);point.x=Number.constrain(point.x-this._controlHandleRadius,0,this._bezierWidth);point.y-=this._controlHandleRadius+this._padding;if(calculateSelectedControlPoint){this._mouseDownPosition=point;if(this._inControl.point.distance(point)<this._outControl.point.distance(point))
this._selectedControl=this._inControl;else
this._selectedControl=this._outControl;}
if(event.shiftKey&&this._mouseDownPosition){if(Math.abs(this._mouseDownPosition.x-point.x)>Math.abs(this._mouseDownPosition.y-point.y))
point.y=this._mouseDownPosition.y;else
point.x=this._mouseDownPosition.x;}
this._selectedControl.point=point;this._selectedControl.handle.classList.add("selected");this._updateValue();}
_updateValue()
{function round(num)
{return Math.round(num*100)/100;}
var inValueX=round(this._inControl.point.x/this._bezierWidth);var inValueY=round(1-(this._inControl.point.y/this._bezierHeight));var outValueX=round(this._outControl.point.x/this._bezierWidth);var outValueY=round(1-(this._outControl.point.y/this._bezierHeight));this._bezier=new WebInspector.CubicBezier(inValueX,inValueY,outValueX,outValueY);this._updateBezier();this.dispatchEventToListeners(WebInspector.BezierEditor.Event.BezierChanged,{bezier:this._bezier});}
_updateBezier()
{var r=this._controlHandleRadius;var inControlX=this._inControl.point.x+r;var inControlY=this._inControl.point.y+r;var outControlX=this._outControl.point.x+r;var outControlY=this._outControl.point.y+r;var path=`M ${r} ${this._bezierHeight + r} C ${inControlX} ${inControlY} ${outControlX} ${outControlY} ${this._bezierWidth + r} ${r}`;this._bezierCurve.setAttribute("d",path);this._updateControl(this._inControl);this._updateControl(this._outControl);this._bezierInXInput.value=this._bezier.inPoint.x;this._bezierInYInput.value=this._bezier.inPoint.y;this._bezierOutXInput.value=this._bezier.outPoint.x;this._bezierOutYInput.value=this._bezier.outPoint.y;}
_updateControl(control)
{control.handle.setAttribute("cx",control.point.x+this._controlHandleRadius);control.handle.setAttribute("cy",control.point.y+this._controlHandleRadius);control.line.setAttribute("x2",control.point.x+this._controlHandleRadius);control.line.setAttribute("y2",control.point.y+this._controlHandleRadius);}
_updateBezierPreview()
{this._inControl.point=new WebInspector.Point(this._bezier.inPoint.x*this._bezierWidth,(1-this._bezier.inPoint.y)*this._bezierHeight);this._outControl.point=new WebInspector.Point(this._bezier.outPoint.x*this._bezierWidth,(1-this._bezier.outPoint.y)*this._bezierHeight);this._updateBezier();this._triggerPreviewAnimation();}
_triggerPreviewAnimation()
{this._bezierPreview.style.animationTimingFunction=this._bezier.toString();this._bezierPreviewContainer.classList.add("animate");this._bezierPreviewTiming.classList.add("animate");}
_resetPreviewAnimation()
{var parent=this._bezierPreview.parentNode;parent.removeChild(this._bezierPreview);parent.appendChild(this._bezierPreview);this._element.removeChild(this._bezierPreviewTiming);this._element.appendChild(this._bezierPreviewTiming);}
_handleNumberInputInput(event)
{this._changeBezierForInput(event.target,event.target.value);}
_handleNumberInputKeydown(event)
{let shift=0;if(event.keyIdentifier==="Up")
shift=0.01;else if(event.keyIdentifier==="Down")
shift=-0.01;if(!shift)
return;if(event.shiftKey)
shift*=10;event.preventDefault();this._changeBezierForInput(event.target,parseFloat(event.target.value)+shift);}
_changeBezierForInput(target,value)
{value=Math.round(value*100)/100;switch(target){case this._bezierInXInput:this._bezier.inPoint.x=Number.constrain(value,0,1);break;case this._bezierInYInput:this._bezier.inPoint.y=value;break;case this._bezierOutXInput:this._bezier.outPoint.x=Number.constrain(value,0,1);break;case this._bezierOutYInput:this._bezier.outPoint.y=value;break;default:return;}
this._updateBezierPreview();this.dispatchEventToListeners(WebInspector.BezierEditor.Event.BezierChanged,{bezier:this._bezier});}};WebInspector.BezierEditor.Event={BezierChanged:"bezier-editor-bezier-changed"};WebInspector.BoxModelDetailsSectionRow=class BoxModelDetailsSectionRow extends WebInspector.DetailsSectionRow
{constructor()
{super(WebInspector.UIString("No Box Model Information"));this.element.classList.add("box-model");this._nodeStyles=null;}
get nodeStyles()
{return this._nodeStyles;}
set nodeStyles(nodeStyles)
{if(this._nodeStyles&&this._nodeStyles.computedStyle)
this._nodeStyles.computedStyle.removeEventListener(WebInspector.CSSStyleDeclaration.Event.PropertiesChanged,this._refresh,this);this._nodeStyles=nodeStyles;if(this._nodeStyles&&this._nodeStyles.computedStyle)
this._nodeStyles.computedStyle.addEventListener(WebInspector.CSSStyleDeclaration.Event.PropertiesChanged,this._refresh,this);this._refresh();}
_refresh()
{if(this._ignoreNextRefresh){this._ignoreNextRefresh=false;return;}
this._updateMetrics();}
_getPropertyValueAsPx(style,propertyName)
{return Number(style.propertyForName(propertyName).value.replace(/px$/,"")||0);}
_getBox(computedStyle,componentName)
{var suffix=this._getComponentSuffix(componentName);var left=this._getPropertyValueAsPx(computedStyle,componentName+"-left"+suffix);var top=this._getPropertyValueAsPx(computedStyle,componentName+"-top"+suffix);var right=this._getPropertyValueAsPx(computedStyle,componentName+"-right"+suffix);var bottom=this._getPropertyValueAsPx(computedStyle,componentName+"-bottom"+suffix);return{left,top,right,bottom};}
_getComponentSuffix(componentName)
{return componentName==="border"?"-width":"";}
_highlightDOMNode(showHighlight,mode,event)
{event.stopPropagation();var nodeId=showHighlight?this.nodeStyles.node.id:0;if(nodeId){if(this._highlightMode===mode)
return;this._highlightMode=mode;WebInspector.domTreeManager.highlightDOMNode(nodeId,mode);}else{this._highlightMode=null;WebInspector.domTreeManager.hideDOMNodeHighlight();}
for(var i=0;this._boxElements&&i<this._boxElements.length;++i){var element=this._boxElements[i];if(nodeId&&(mode==="all"||element._name===mode))
element.classList.add("active");else
element.classList.remove("active");}
this.element.classList.toggle("hovered",showHighlight);}
_updateMetrics()
{var metricsElement=document.createElement("div");var style=this._nodeStyles.computedStyle;function createValueElement(type,value,name,propertyName)
{let floatValue=parseFloat(value);let shouldRoundValue=!isNaN(floatValue)&&(floatValue%1!==0);if(isNaN(floatValue))
value=figureDash;let element=document.createElement(type);element.textContent=shouldRoundValue?("~"+Math.round(floatValue*100)/100):value;if(shouldRoundValue)
element.title=value;element.addEventListener("dblclick",this._startEditing.bind(this,element,name,propertyName,style),false);return element;}
function createBoxPartElement(name,side)
{let suffix=this._getComponentSuffix(name);let propertyName=(name!=="position"?name+"-":"")+side+suffix;let value=style.propertyForName(propertyName).value;if(value===""||(name!=="position"&&value==="0px")||(name==="position"&&value==="auto"))
value="";else
value=value.replace(/px$/,"");let element=createValueElement.call(this,"div",value,name,propertyName);element.className=side;return element;}
function createContentAreaElement(name)
{let size=style.propertyForName(name).value.replace(/px$/,"");if(style.propertyForName("box-sizing").value==="border-box"){let borderBox=this._getBox(style,"border");let paddingBox=this._getBox(style,"padding");let[side,oppositeSide]=name==="width"?["left","right"]:["top","bottom"];size=size-borderBox[side]-borderBox[oppositeSide]-paddingBox[side]-paddingBox[oppositeSide];}
return createValueElement.call(this,"span",size,name,name);}
var noMarginDisplayType={"table-cell":true,"table-column":true,"table-column-group":true,"table-footer-group":true,"table-header-group":true,"table-row":true,"table-row-group":true};var noPaddingDisplayType={"table-column":true,"table-column-group":true,"table-footer-group":true,"table-header-group":true,"table-row":true,"table-row-group":true};var noPositionType={"static":true};this._boxElements=[];if(!style.hasProperties()){this.showEmptyMessage();return;}
var previousBox=null;for(let name of["content","padding","border","margin","position"]){if(name==="margin"&&noMarginDisplayType[style.propertyForName("display").value])
continue;if(name==="padding"&&noPaddingDisplayType[style.propertyForName("display").value])
continue;if(name==="position"&&noPositionType[style.propertyForName("position").value])
continue;var boxElement=document.createElement("div");boxElement.className=name;boxElement._name=name;boxElement.addEventListener("mouseover",this._highlightDOMNode.bind(this,true,name==="position"?"all":name),false);this._boxElements.push(boxElement);if(name==="content"){let widthElement=createContentAreaElement.call(this,"width");let heightElement=createContentAreaElement.call(this,"height");boxElement.append(widthElement," \u00D7 ",heightElement);}else{var labelElement=document.createElement("div");labelElement.className="label";labelElement.textContent=name;boxElement.appendChild(labelElement);boxElement.appendChild(createBoxPartElement.call(this,name,"top"));boxElement.appendChild(document.createElement("br"));boxElement.appendChild(createBoxPartElement.call(this,name,"left"));if(previousBox)
boxElement.appendChild(previousBox);boxElement.appendChild(createBoxPartElement.call(this,name,"right"));boxElement.appendChild(document.createElement("br"));boxElement.appendChild(createBoxPartElement.call(this,name,"bottom"));}
previousBox=boxElement;}
metricsElement.appendChild(previousBox);metricsElement.addEventListener("mouseover",this._highlightDOMNode.bind(this,false,""),false);this.hideEmptyMessage();this.element.appendChild(metricsElement);}
_startEditing(targetElement,box,styleProperty,computedStyle)
{if(WebInspector.isBeingEdited(targetElement))
return;
if(targetElement.title)
targetElement.textContent=targetElement.title;var context={box,styleProperty};var boundKeyDown=this._handleKeyDown.bind(this,context,styleProperty);context.keyDownHandler=boundKeyDown;targetElement.addEventListener("keydown",boundKeyDown,false);this._isEditingMetrics=true;var config=new WebInspector.EditingConfig(this._editingCommitted.bind(this),this._editingCancelled.bind(this),context);WebInspector.startEditing(targetElement,config);window.getSelection().setBaseAndExtent(targetElement,0,targetElement,1);}
_alteredFloatNumber(number,event)
{var arrowKeyPressed=event.keyIdentifier==="Up"||event.keyIdentifier==="Down";var changeAmount=1;if(event.shiftKey&&!arrowKeyPressed)
changeAmount=100;else if(event.shiftKey||!arrowKeyPressed)
changeAmount=10;else if(event.altKey)
changeAmount=0.1;if(event.keyIdentifier==="Down"||event.keyIdentifier==="PageDown")
changeAmount*=-1;var result=Number((number+changeAmount).toFixed(6));if(!String(result).match(WebInspector.EditingSupport.NumberRegex))
return null;return result;}
_handleKeyDown(context,styleProperty,event)
{if(!/^(?:Page)?(?:Up|Down)$/.test(event.keyIdentifier))
return;var element=event.currentTarget;var selection=window.getSelection();if(!selection.rangeCount)
return;var selectionRange=selection.getRangeAt(0);if(!selectionRange.commonAncestorContainer.isSelfOrDescendant(element))
return;var originalValue=element.textContent;var wordRange=selectionRange.startContainer.rangeOfWord(selectionRange.startOffset,WebInspector.EditingSupport.StyleValueDelimiters,element);var wordString=wordRange.toString();var matches=WebInspector.EditingSupport.NumberRegex.exec(wordString);var replacementString;if(matches&&matches.length){var prefix=matches[1];var suffix=matches[3];var number=this._alteredFloatNumber(parseFloat(matches[2]),event);if(number===null){return;}
if(styleProperty!=="margin"&&number<0)
number=0;replacementString=prefix+number+suffix;}
if(!replacementString)
return;var replacementTextNode=document.createTextNode(replacementString);wordRange.deleteContents();wordRange.insertNode(replacementTextNode);var finalSelectionRange=document.createRange();finalSelectionRange.setStart(replacementTextNode,0);finalSelectionRange.setEnd(replacementTextNode,replacementString.length);selection.removeAllRanges();selection.addRange(finalSelectionRange);event.handled=true;event.preventDefault();this._ignoreNextRefresh=true;this._applyUserInput(element,replacementString,originalValue,context,false);}
_editingEnded(element,context)
{element.removeEventListener("keydown",context.keyDownHandler,false);this._isEditingMetrics=false;}
_editingCancelled(element,context)
{this._editingEnded(element,context);this._refresh();}
_applyUserInput(element,userInput,previousContent,context,commitEditor)
{if(commitEditor&&userInput===previousContent){this._editingCancelled(element,context);return;}
if(context.box!=="position"&&(!userInput||userInput===figureDash))
userInput="0px";else if(context.box==="position"&&(!userInput||userInput===figureDash))
userInput="auto";userInput=userInput.toLowerCase();if(/^-?(?:\d+(?:\.\d+)?|\.\d+)$/.test(userInput))
userInput+="px";var styleProperty=context.styleProperty;var computedStyle=this._nodeStyles.computedStyle;if(computedStyle.propertyForName("box-sizing").value==="border-box"&&(styleProperty==="width"||styleProperty==="height")){if(!userInput.match(/px$/)){console.error("For elements with box-sizing: border-box, only absolute content area dimensions can be applied");return;}
var borderBox=this._getBox(computedStyle,"border");var paddingBox=this._getBox(computedStyle,"padding");var userValuePx=Number(userInput.replace(/px$/,""));if(isNaN(userValuePx))
return;if(styleProperty==="width")
userValuePx+=borderBox.left+borderBox.right+paddingBox.left+paddingBox.right;else
userValuePx+=borderBox.top+borderBox.bottom+paddingBox.top+paddingBox.bottom;userInput=userValuePx+"px";}
function resolvedNode(object)
{if(!object)
return;function toggleInlineStyleProperty(property,value)
{this.style.setProperty(property,value,"important");}
function didToggle()
{this._nodeStyles.refresh();}
object.callFunction(toggleInlineStyleProperty,[styleProperty,userInput],false,didToggle.bind(this));object.release();}
WebInspector.RemoteObject.resolveNode(this._nodeStyles.node,"",resolvedNode.bind(this));}
_editingCommitted(element,userInput,previousContent,context)
{this._editingEnded(element,context);this._applyUserInput(element,userInput,previousContent,context,true);}};WebInspector.BreakpointActionView=class BreakpointActionView extends WebInspector.Object
{constructor(action,delegate,omitFocus)
{super();this._action=action;this._delegate=delegate;this._element=document.createElement("div");this._element.className="breakpoint-action-block";var header=this._element.appendChild(document.createElement("div"));header.className="breakpoint-action-block-header";var picker=header.appendChild(document.createElement("select"));picker.addEventListener("change",this._pickerChanged.bind(this));for(var key in WebInspector.BreakpointAction.Type){var type=WebInspector.BreakpointAction.Type[key];var option=document.createElement("option");option.textContent=WebInspector.BreakpointActionView.displayStringForType(type);option.selected=this._action.type===type;option.value=type;picker.add(option);}
let buttonContainerElement=header.appendChild(document.createElement("div"));buttonContainerElement.classList.add("breakpoint-action-button-container");let appendActionButton=buttonContainerElement.appendChild(document.createElement("button"));appendActionButton.className="breakpoint-action-append-button";appendActionButton.addEventListener("click",this._appendActionButtonClicked.bind(this));appendActionButton.title=WebInspector.UIString("Add new breakpoint action after this action");let removeActionButton=buttonContainerElement.appendChild(document.createElement("button"));removeActionButton.className="breakpoint-action-remove-button";removeActionButton.addEventListener("click",this._removeAction.bind(this));removeActionButton.title=WebInspector.UIString("Remove this breakpoint action");this._bodyElement=this._element.appendChild(document.createElement("div"));this._bodyElement.className="breakpoint-action-block-body";this._updateBody(omitFocus);}
static displayStringForType(type)
{switch(type){case WebInspector.BreakpointAction.Type.Log:return WebInspector.UIString("Log Message");case WebInspector.BreakpointAction.Type.Evaluate:return WebInspector.UIString("Evaluate JavaScript");case WebInspector.BreakpointAction.Type.Sound:return WebInspector.UIString("Play Sound");case WebInspector.BreakpointAction.Type.Probe:return WebInspector.UIString("Probe Expression");default:return"";}}
get action()
{return this._action;}
get element()
{return this._element;}
_pickerChanged(event)
{var newType=event.target.value;this._action=this._action.breakpoint.recreateAction(newType,this._action);this._updateBody();this._delegate.breakpointActionViewResized(this);}
_appendActionButtonClicked(event)
{var newAction=this._action.breakpoint.createAction(this._action.type,this._action);this._delegate.breakpointActionViewAppendActionView(this,newAction);}
_removeAction()
{this._action.breakpoint.removeAction(this._action);this._delegate.breakpointActionViewRemoveActionView(this);}
_updateBody(omitFocus)
{this._bodyElement.removeChildren();switch(this._action.type){case WebInspector.BreakpointAction.Type.Log:this._bodyElement.hidden=false;var input=this._bodyElement.appendChild(document.createElement("input"));input.placeholder=WebInspector.UIString("Message");input.addEventListener("change",this._logInputChanged.bind(this));input.value=this._action.data||"";input.spellcheck=false;if(!omitFocus)
setTimeout(function(){input.focus();},0);var descriptionElement=this._bodyElement.appendChild(document.createElement("div"));descriptionElement.classList.add("description");descriptionElement.setAttribute("dir","ltr");descriptionElement.textContent=WebInspector.UIString("${expr} = expression");break;case WebInspector.BreakpointAction.Type.Evaluate:case WebInspector.BreakpointAction.Type.Probe:this._bodyElement.hidden=false;var editorElement=this._bodyElement.appendChild(document.createElement("div"));editorElement.classList.add("breakpoint-action-eval-editor");editorElement.classList.add(WebInspector.SyntaxHighlightedStyleClassName);this._codeMirror=WebInspector.CodeMirrorEditor.create(editorElement,{lineWrapping:true,mode:"text/javascript",indentWithTabs:true,indentUnit:4,matchBrackets:true,value:this._action.data||"",});this._codeMirror.on("viewportChange",this._codeMirrorViewportChanged.bind(this));this._codeMirror.on("blur",this._codeMirrorBlurred.bind(this));this._codeMirrorViewport={from:null,to:null};var completionController=new WebInspector.CodeMirrorCompletionController(this._codeMirror);completionController.addExtendedCompletionProvider("javascript",WebInspector.javaScriptRuntimeCompletionProvider);setTimeout(()=>{this._codeMirror.refresh();if(!omitFocus)
this._codeMirror.focus();},0);break;case WebInspector.BreakpointAction.Type.Sound:this._bodyElement.hidden=true;break;default:this._bodyElement.hidden=true;break;}}
_logInputChanged(event)
{this._action.data=event.target.value;}
_codeMirrorBlurred(event)
{this._action.data=(this._codeMirror.getValue()||"").trim();}
_codeMirrorViewportChanged(event,from,to)
{if(this._codeMirrorViewport.from===from&&this._codeMirrorViewport.to===to)
return;this._codeMirrorViewport.from=from;this._codeMirrorViewport.to=to;this._delegate.breakpointActionViewResized(this);}};WebInspector.BreakpointTreeElement=class BreakpointTreeElement extends WebInspector.GeneralTreeElement
{constructor(breakpoint,className,title)
{if(!className)
className=WebInspector.BreakpointTreeElement.GenericLineIconStyleClassName;super(["breakpoint",className],title,null,breakpoint,false);this._breakpoint=breakpoint;this._probeSet=null;this._listenerSet=new WebInspector.EventListenerSet(this,"BreakpointTreeElement listeners");if(!title)
this._listenerSet.register(breakpoint,WebInspector.Breakpoint.Event.LocationDidChange,this._breakpointLocationDidChange);this._listenerSet.register(breakpoint,WebInspector.Breakpoint.Event.DisabledStateDidChange,this._updateStatus);this._listenerSet.register(breakpoint,WebInspector.Breakpoint.Event.AutoContinueDidChange,this._updateStatus);this._listenerSet.register(breakpoint,WebInspector.Breakpoint.Event.ResolvedStateDidChange,this._updateStatus);this._listenerSet.register(WebInspector.debuggerManager,WebInspector.DebuggerManager.Event.BreakpointsEnabledDidChange,this._updateStatus);this._listenerSet.register(WebInspector.probeManager,WebInspector.ProbeManager.Event.ProbeSetAdded,this._probeSetAdded);this._listenerSet.register(WebInspector.probeManager,WebInspector.ProbeManager.Event.ProbeSetRemoved,this._probeSetRemoved);this._statusImageElement=document.createElement("img");this._statusImageElement.className=WebInspector.BreakpointTreeElement.StatusImageElementStyleClassName;this._listenerSet.register(this._statusImageElement,"mousedown",this._statusImageElementMouseDown);this._listenerSet.register(this._statusImageElement,"click",this._statusImageElementClicked);if(!title)
this._updateTitles();this._updateStatus();this.status=this._statusImageElement;this._iconAnimationLayerElement=document.createElement("span");this.iconElement.appendChild(this._iconAnimationLayerElement);}
get breakpoint()
{return this._breakpoint;}
get filterableData()
{return{text:[this.breakpoint.contentIdentifier]};}
ondelete()
{if(!WebInspector.debuggerManager.isBreakpointRemovable(this._breakpoint))
return false;
this.__deletedViaDeleteKeyboardShortcut=true;WebInspector.debuggerManager.removeBreakpoint(this._breakpoint);return true;}
onenter()
{this._breakpoint.cycleToNextMode();return true;}
onspace()
{this._breakpoint.cycleToNextMode();return true;}
onattach()
{super.onattach();this._listenerSet.install();for(var probeSet of WebInspector.probeManager.probeSets)
if(probeSet.breakpoint===this._breakpoint)
this._addProbeSet(probeSet);}
ondetach()
{super.ondetach();this._listenerSet.uninstall();if(this._probeSet)
this._removeProbeSet(this._probeSet);}
populateContextMenu(contextMenu,event)
{WebInspector.breakpointPopoverController.appendContextMenuItems(contextMenu,this._breakpoint,this._statusImageElement);super.populateContextMenu(contextMenu,event);}
removeStatusImage()
{this._statusImageElement.remove();this._statusImageElement=null;}
_updateTitles()
{var sourceCodeLocation=this._breakpoint.sourceCodeLocation;var displayLineNumber=sourceCodeLocation.displayLineNumber;var displayColumnNumber=sourceCodeLocation.displayColumnNumber;if(displayColumnNumber>0)
this.mainTitle=WebInspector.UIString("Line %d:%d").format(displayLineNumber+1,displayColumnNumber+1);else
this.mainTitle=WebInspector.UIString("Line %d").format(displayLineNumber+1);if(sourceCodeLocation.hasMappedLocation()){this.subtitle=sourceCodeLocation.formattedLocationString();if(sourceCodeLocation.hasFormattedLocation())
this.subtitleElement.classList.add(WebInspector.BreakpointTreeElement.FormattedLocationStyleClassName);else
this.subtitleElement.classList.remove(WebInspector.BreakpointTreeElement.FormattedLocationStyleClassName);this.tooltip=this.mainTitle+" \u2014 "+WebInspector.UIString("originally %s").format(sourceCodeLocation.originalLocationString());}}
_updateStatus()
{if(!this._statusImageElement)
return;if(this._breakpoint.disabled)
this._statusImageElement.classList.add(WebInspector.BreakpointTreeElement.StatusImageDisabledStyleClassName);else
this._statusImageElement.classList.remove(WebInspector.BreakpointTreeElement.StatusImageDisabledStyleClassName);if(this._breakpoint.autoContinue)
this._statusImageElement.classList.add(WebInspector.BreakpointTreeElement.StatusImageAutoContinueStyleClassName);else
this._statusImageElement.classList.remove(WebInspector.BreakpointTreeElement.StatusImageAutoContinueStyleClassName);if(this._breakpoint.resolved&&WebInspector.debuggerManager.breakpointsEnabled)
this._statusImageElement.classList.add(WebInspector.BreakpointTreeElement.StatusImageResolvedStyleClassName);else
this._statusImageElement.classList.remove(WebInspector.BreakpointTreeElement.StatusImageResolvedStyleClassName);}
_addProbeSet(probeSet)
{this._probeSet=probeSet;probeSet.addEventListener(WebInspector.ProbeSet.Event.SamplesCleared,this._samplesCleared,this);probeSet.dataTable.addEventListener(WebInspector.ProbeSetDataTable.Event.FrameInserted,this._dataUpdated,this);}
_removeProbeSet(probeSet)
{probeSet.removeEventListener(WebInspector.ProbeSet.Event.SamplesCleared,this._samplesCleared,this);probeSet.dataTable.removeEventListener(WebInspector.ProbeSetDataTable.Event.FrameInserted,this._dataUpdated,this);this._probeSet=null;}
_probeSetAdded(event)
{var probeSet=event.data.probeSet;if(probeSet.breakpoint===this._breakpoint)
this._addProbeSet(probeSet);}
_probeSetRemoved(event)
{var probeSet=event.data.probeSet;if(probeSet.breakpoint===this._breakpoint)
this._removeProbeSet(probeSet);}
_samplesCleared(event)
{var oldTable=event.data.oldTable;oldTable.removeEventListener(WebInspector.ProbeSetDataTable.Event.FrameInserted,this._dataUpdated,this);this._probeSet.dataTable.addEventListener(WebInspector.ProbeSetDataTable.Event.FrameInserted,this._dataUpdated,this);}
_dataUpdated()
{if(this.element.classList.contains(WebInspector.BreakpointTreeElement.ProbeDataUpdatedStyleClassName)){clearTimeout(this._removeIconAnimationTimeoutIdentifier);this.element.classList.remove(WebInspector.BreakpointTreeElement.ProbeDataUpdatedStyleClassName);window.requestAnimationFrame(this._dataUpdated.bind(this));return;}
this.element.classList.add(WebInspector.BreakpointTreeElement.ProbeDataUpdatedStyleClassName);this._removeIconAnimationTimeoutIdentifier=setTimeout(()=>{this.element.classList.remove(WebInspector.BreakpointTreeElement.ProbeDataUpdatedStyleClassName);},WebInspector.BreakpointTreeElement.ProbeDataUpdatedAnimationDuration);}
_breakpointLocationDidChange(event)
{if(event.data.oldDisplaySourceCode===this._breakpoint.displaySourceCode)
return;this._updateTitles();}
_statusImageElementMouseDown(event)
{event.stopPropagation();}
_statusImageElementClicked(event)
{this._breakpoint.cycleToNextMode();}};WebInspector.BreakpointTreeElement.GenericLineIconStyleClassName="breakpoint-generic-line-icon";WebInspector.BreakpointTreeElement.StatusImageElementStyleClassName="status-image";WebInspector.BreakpointTreeElement.StatusImageResolvedStyleClassName="resolved";WebInspector.BreakpointTreeElement.StatusImageAutoContinueStyleClassName="auto-continue";WebInspector.BreakpointTreeElement.StatusImageDisabledStyleClassName="disabled";WebInspector.BreakpointTreeElement.FormattedLocationStyleClassName="formatted-location";WebInspector.BreakpointTreeElement.ProbeDataUpdatedStyleClassName="data-updated";WebInspector.BreakpointTreeElement.ProbeDataUpdatedAnimationDuration=400;WebInspector.ButtonToolbarItem=class ButtonToolbarItem extends WebInspector.ButtonNavigationItem
{constructor(identifier,toolTip,label,image,role)
{super(identifier,toolTip,image,16,16,role);if(typeof label==="string"){this._labelElement=document.createElement("div");this._labelElement.className=WebInspector.ButtonToolbarItem.LabelStyleClassName;this._element.appendChild(this._labelElement);this.label=label;}}
get label()
{return this._labelElement.textContent;}
set label(newLabel)
{if(!newLabel||!this._labelElement)
return;this._labelElement.textContent=newLabel;}};WebInspector.ButtonToolbarItem.LabelStyleClassName="label";WebInspector.CSSStyleDeclarationSection=class CSSStyleDeclarationSection extends WebInspector.Object
{constructor(delegate,style)
{super();this._delegate=delegate||null;this._style=style||null;this._selectorElements=[];this._ruleDisabled=false;this._hasInvalidSelector=false;this._element=document.createElement("div");this._element.classList.add("style-declaration-section");new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl,"S",this._save.bind(this),this._element);new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl|WebInspector.KeyboardShortcut.Modifier.Shift,"S",this._save.bind(this),this._element);this._headerElement=document.createElement("div");this._headerElement.classList.add("header");if(!style.editable){let lockedIconElement=this._headerElement.createChild("img","locked-icon");let styleLabel;if(style.ownerRule&&style.ownerRule.type===WebInspector.CSSStyleSheet.Type.UserAgent)
styleLabel=WebInspector.UIString("User Agent Stylesheet");else
styleLabel=WebInspector.UIString("Style rule");lockedIconElement.title=WebInspector.UIString("%s cannot be modified").format(styleLabel);}
this._iconElement=this._headerElement.createChild("img","icon");if(this.selectorEditable){this._selectorInput=this._headerElement.createChild("textarea");this._selectorInput.spellcheck=false;this._selectorInput.dir="ltr";this._selectorInput.tabIndex=-1;this._selectorInput.addEventListener("mouseover",this._handleMouseOver.bind(this));this._selectorInput.addEventListener("mousemove",this._handleMouseMove.bind(this));this._selectorInput.addEventListener("mouseout",this._handleMouseOut.bind(this));this._selectorInput.addEventListener("keydown",this._handleKeyDown.bind(this));this._selectorInput.addEventListener("keypress",this._handleKeyPress.bind(this));this._selectorInput.addEventListener("input",this._handleInput.bind(this));this._selectorInput.addEventListener("paste",this._handleSelectorPaste.bind(this));this._selectorInput.addEventListener("blur",this._handleBlur.bind(this));}
this._selectorElement=this._headerElement.createChild("span","selector");if(!this.selectorEditable){this._selectorElement.addEventListener("mouseover",this._handleMouseOver.bind(this));this._selectorElement.addEventListener("mouseout",this._handleMouseOut.bind(this));}
this._originElement=this._headerElement.createChild("span","origin");this._propertiesElement=document.createElement("div");this._propertiesElement.classList.add("properties");this._editorActive=false;this._propertiesTextEditor=new WebInspector.CSSStyleDeclarationTextEditor(this,style);this._propertiesTextEditor.addEventListener(WebInspector.CSSStyleDeclarationTextEditor.Event.ContentChanged,this._editorContentChanged.bind(this));this._propertiesTextEditor.addEventListener(WebInspector.CSSStyleDeclarationTextEditor.Event.Blurred,this._editorBlurred.bind(this));this._propertiesElement.appendChild(this._propertiesTextEditor.element);this._element.appendChild(this._headerElement);this._element.appendChild(this._propertiesElement);let iconClassName=null;switch(style.type){case WebInspector.CSSStyleDeclaration.Type.Rule:if(style.inherited)
iconClassName=WebInspector.CSSStyleDeclarationSection.InheritedStyleRuleIconStyleClassName;else if(style.ownerRule.type===WebInspector.CSSStyleSheet.Type.Author)
iconClassName=WebInspector.CSSStyleDeclarationSection.AuthorStyleRuleIconStyleClassName;else if(style.ownerRule.type===WebInspector.CSSStyleSheet.Type.User)
iconClassName=WebInspector.CSSStyleDeclarationSection.UserStyleRuleIconStyleClassName;else if(style.ownerRule.type===WebInspector.CSSStyleSheet.Type.UserAgent)
iconClassName=WebInspector.CSSStyleDeclarationSection.UserAgentStyleRuleIconStyleClassName;else if(style.ownerRule.type===WebInspector.CSSStyleSheet.Type.Inspector)
iconClassName=WebInspector.CSSStyleDeclarationSection.InspectorStyleRuleIconStyleClassName;break;case WebInspector.CSSStyleDeclaration.Type.Inline:case WebInspector.CSSStyleDeclaration.Type.Attribute:if(style.inherited)
iconClassName=WebInspector.CSSStyleDeclarationSection.InheritedElementStyleRuleIconStyleClassName;else
iconClassName=WebInspector.DOMTreeElementPathComponent.DOMElementIconStyleClassName;break;}
if(style.editable){this._iconElement.classList.add("toggle-able");this._iconElement.title=WebInspector.UIString("Comment All Properties");this._iconElement.addEventListener("click",this._handleIconElementClicked.bind(this));}
this._element.classList.add(iconClassName);if(!style.editable)
this._element.classList.add(WebInspector.CSSStyleDeclarationSection.LockedStyleClassName);else if(style.ownerRule)
this._style.ownerRule.addEventListener(WebInspector.CSSRule.Event.SelectorChanged,this._updateSelectorIcon.bind(this));else
this._element.classList.add(WebInspector.CSSStyleDeclarationSection.SelectorLockedStyleClassName);this.refresh();this._headerElement.addEventListener("contextmenu",this._handleContextMenuEvent.bind(this));}
get element()
{return this._element;}
get style()
{return this._style;}
get lastInGroup()
{return this._element.classList.contains(WebInspector.CSSStyleDeclarationSection.LastInGroupStyleClassName);}
set lastInGroup(last)
{if(last)
this._element.classList.add(WebInspector.CSSStyleDeclarationSection.LastInGroupStyleClassName);else
this._element.classList.remove(WebInspector.CSSStyleDeclarationSection.LastInGroupStyleClassName);}
get focused()
{return this._propertiesTextEditor.focused;}
focus()
{this._propertiesTextEditor.focus();}
refresh()
{this._selectorElement.removeChildren();this._originElement.removeChildren();this._selectorElements=[];this._originElement.append(` ${emDash} `);function appendSelector(selector,matched)
{let selectorElement=document.createElement("span");selectorElement.textContent=selector.text;if(matched)
selectorElement.classList.add(WebInspector.CSSStyleDeclarationSection.MatchedSelectorElementStyleClassName);let specificity=selector.specificity;if(specificity){let tooltip=WebInspector.UIString("Specificity: (%d, %d, %d)").format(specificity[0],specificity[1],specificity[2]);if(selector.dynamic){tooltip+="\n";if(this._style.inherited)
tooltip+=WebInspector.UIString("Dynamically calculated for the parent element");else
tooltip+=WebInspector.UIString("Dynamically calculated for the selected element");}
selectorElement.title=tooltip;}else if(selector.dynamic){let tooltip=WebInspector.UIString("Specificity: No value for selected element");tooltip+="\n";tooltip+=WebInspector.UIString("Dynamically calculated for the selected element and did not match");selectorElement.title=tooltip;}
this._selectorElement.appendChild(selectorElement);this._selectorElements.push(selectorElement);}
function appendSelectorTextKnownToMatch(selectorText)
{let selectorElement=document.createElement("span");selectorElement.textContent=selectorText;selectorElement.classList.add(WebInspector.CSSStyleDeclarationSection.MatchedSelectorElementStyleClassName);this._selectorElement.appendChild(selectorElement);}
switch(this._style.type){case WebInspector.CSSStyleDeclaration.Type.Rule:let selectors=this._style.ownerRule.selectors;let matchedSelectorIndices=this._style.ownerRule.matchedSelectorIndices;let alwaysMatch=!matchedSelectorIndices.length;if(selectors.length){let hasMatchingPseudoElementSelector=false;for(let i=0;i<selectors.length;++i){appendSelector.call(this,selectors[i],alwaysMatch||matchedSelectorIndices.includes(i));if(i<selectors.length-1)
this._selectorElement.append(", ");if(matchedSelectorIndices.includes(i)&&selectors[i].isPseudoElementSelector())
hasMatchingPseudoElementSelector=true;}
this._element.classList.toggle(WebInspector.CSSStyleDeclarationSection.PseudoElementSelectorStyleClassName,hasMatchingPseudoElementSelector);}else
appendSelectorTextKnownToMatch.call(this,this._style.ownerRule.selectorText);if(this._style.ownerRule.sourceCodeLocation){let options={dontFloat:true,ignoreNetworkTab:true,ignoreSearchTab:true,};if(this._style.ownerStyleSheet.isInspectorStyleSheet()){options.nameStyle=WebInspector.SourceCodeLocation.NameStyle.None;options.prefix=WebInspector.UIString("Inspector Style Sheet")+":";}
let sourceCodeLink=WebInspector.createSourceCodeLocationLink(this._style.ownerRule.sourceCodeLocation,options);this._originElement.appendChild(sourceCodeLink);}else{let originString;switch(this._style.ownerRule.type){case WebInspector.CSSStyleSheet.Type.Author:originString=WebInspector.UIString("Author Stylesheet");break;case WebInspector.CSSStyleSheet.Type.User:originString=WebInspector.UIString("User Stylesheet");break;case WebInspector.CSSStyleSheet.Type.UserAgent:originString=WebInspector.UIString("User Agent Stylesheet");break;case WebInspector.CSSStyleSheet.Type.Inspector:originString=WebInspector.UIString("Web Inspector");break;}
if(originString)
this._originElement.append(originString);}
break;case WebInspector.CSSStyleDeclaration.Type.Inline:appendSelectorTextKnownToMatch.call(this,this._style.node.displayName);this._originElement.append(WebInspector.UIString("Style Attribute"));break;case WebInspector.CSSStyleDeclaration.Type.Attribute:appendSelectorTextKnownToMatch.call(this,this._style.node.displayName);this._originElement.append(WebInspector.UIString("HTML Attributes"));break;}
this._updateSelectorIcon();if(this._selectorInput)
this._selectorInput.value=this._selectorElement.textContent;}
refreshEditor()
{this._propertiesTextEditor.refresh();}
highlightProperty(property)
{if(this._propertiesTextEditor.highlightProperty(property)){this._element.scrollIntoView();return true;}
return false;}
findMatchingPropertiesAndSelectors(needle)
{this._element.classList.remove(WebInspector.CSSStyleDetailsSidebarPanel.NoFilterMatchInSectionClassName,WebInspector.CSSStyleDetailsSidebarPanel.FilterMatchingSectionHasLabelClassName);var hasMatchingSelector=false;for(var selectorElement of this._selectorElements){selectorElement.classList.remove(WebInspector.CSSStyleDetailsSidebarPanel.FilterMatchSectionClassName);if(needle&&selectorElement.textContent.includes(needle)){selectorElement.classList.add(WebInspector.CSSStyleDetailsSidebarPanel.FilterMatchSectionClassName);hasMatchingSelector=true;}}
if(!needle){this._propertiesTextEditor.resetFilteredProperties();return false;}
var hasMatchingProperty=this._propertiesTextEditor.findMatchingProperties(needle);if(!hasMatchingProperty&&!hasMatchingSelector){this._element.classList.add(WebInspector.CSSStyleDetailsSidebarPanel.NoFilterMatchInSectionClassName);return false;}
return true;}
updateLayout()
{this._propertiesTextEditor.updateLayout();}
clearSelection()
{this._propertiesTextEditor.clearSelection();}
cssStyleDeclarationTextEditorFocused()
{if(typeof this._delegate.cssStyleDeclarationSectionEditorFocused==="function")
this._delegate.cssStyleDeclarationSectionEditorFocused(this);}
cssStyleDeclarationTextEditorSwitchRule(reverse)
{if(!this._delegate)
return;if(reverse&&typeof this._delegate.cssStyleDeclarationSectionEditorPreviousRule==="function")
this._delegate.cssStyleDeclarationSectionEditorPreviousRule(this);else if(!reverse&&typeof this._delegate.cssStyleDeclarationSectionEditorNextRule==="function")
this._delegate.cssStyleDeclarationSectionEditorNextRule(this);}
focusRuleSelector(reverse)
{if(!this.selectorEditable&&!this.locked){this.focus();return;}
if(this.locked){this.cssStyleDeclarationTextEditorSwitchRule(reverse);return;}
let selection=window.getSelection();selection.removeAllRanges();this._element.scrollIntoViewIfNeeded();if(this._selectorInput){this._selectorInput.focus();this._selectorInput.selectionStart=0;this._selectorInput.selectionEnd=this._selectorInput.value.length;}else{let range=document.createRange();range.selectNodeContents(this._selectorElement);selection.addRange(range);}}
selectLastProperty()
{this._propertiesTextEditor.selectLastProperty();}
get selectorEditable()
{return!this.locked&&this._style.ownerRule;}
get locked()
{return!this._style.editable;}
get editorActive()
{return this._editorActive;}
get _currentSelectorText()
{let selectorText=this.selectorEditable?this._selectorInput.value:this._selectorElement.textContent;if(!selectorText||!selectorText.length){if(!this._style.ownerRule)
return"";selectorText=this._style.ownerRule.selectorText;}
return selectorText.trim();}
_handleSelectorPaste(event)
{if(this._style.type===WebInspector.CSSStyleDeclaration.Type.Inline||!this._style.ownerRule)
return;if(!event||!event.clipboardData)
return;let data=event.clipboardData.getData("text/plain");if(!data)
return;function parseTextForRule(text)
{let containsBraces=/[\{\}]/;if(!containsBraces.test(text))
return[];let match=text.match(/([^{]+){([\s\S]*)}/);if(!match)
return[];return containsBraces.test(match[2])?parseTextForRule(match[2]):match;}
let[selector,value]=parseTextForRule(data);if(!selector||!value)
return;this._style.nodeStyles.changeRule(this._style.ownerRule,selector.trim(),value);event.preventDefault();}
_handleContextMenuEvent(event)
{if(window.getSelection().toString().length)
return;let contextMenu=WebInspector.ContextMenu.createFromEvent(event);contextMenu.appendItem(WebInspector.UIString("Copy Rule"),()=>{InspectorFrontendHost.copyText(this._style.generateCSSRuleString());});if(this._style.inherited)
return;contextMenu.appendItem(WebInspector.UIString("Duplicate Selector"),()=>{if(this._delegate&&typeof this._delegate.focusEmptySectionWithStyle==="function"){let existingRules=this._style.nodeStyles.rulesForSelector(this._currentSelectorText);for(let rule of existingRules){if(this._delegate.focusEmptySectionWithStyle(rule.style))
return;}}
this._style.nodeStyles.addRule(this._currentSelectorText);});if(WebInspector.CSSStyleManager.PseudoElementNames.some((className)=>this._style.selectorText.includes(":"+className)))
return;if(WebInspector.CSSStyleManager.ForceablePseudoClasses.every((className)=>!this._style.selectorText.includes(":"+className))){contextMenu.appendSeparator();for(let pseudoClass of WebInspector.CSSStyleManager.ForceablePseudoClasses){if(pseudoClass==="visited"&&this._style.node.nodeName()!=="A")
continue;let pseudoClassSelector=":"+pseudoClass;contextMenu.appendItem(WebInspector.UIString("Add %s Rule").format(pseudoClassSelector),()=>{this._style.node.setPseudoClassEnabled(pseudoClass,true);let selector;if(this._style.ownerRule)
selector=this._style.ownerRule.selectors.map((selector)=>selector.text+pseudoClassSelector).join(", ");else
selector=this._currentSelectorText+pseudoClassSelector;this._style.nodeStyles.addRule(selector);});}}
contextMenu.appendSeparator();for(let pseudoElement of WebInspector.CSSStyleManager.PseudoElementNames){let pseudoElementSelector="::"+pseudoElement;const styleText="content: \"\";";let existingSection=null;if(this._delegate&&typeof this._delegate.sectionForStyle==="function"){let existingRules=this._style.nodeStyles.rulesForSelector(this._currentSelectorText+pseudoElementSelector);if(existingRules.length){
existingSection=this._delegate.sectionForStyle(existingRules[0].style);}}
let title=existingSection?WebInspector.UIString("Focus %s Rule"):WebInspector.UIString("Create %s Rule");contextMenu.appendItem(title.format(pseudoElementSelector),()=>{if(existingSection){existingSection.focus();return;}
let selector;if(this._style.ownerRule)
selector=this._style.ownerRule.selectors.map((selector)=>selector.text+pseudoElementSelector).join(", ");else
selector=this._currentSelectorText+pseudoElementSelector;this._style.nodeStyles.addRule(selector,styleText);});}}
_handleIconElementClicked()
{if(this._hasInvalidSelector){this.refresh();return;}
this._ruleDisabled=this._ruleDisabled?!this._propertiesTextEditor.uncommentAllProperties():this._propertiesTextEditor.commentAllProperties();this._iconElement.title=this._ruleDisabled?WebInspector.UIString("Uncomment All Properties"):WebInspector.UIString("Comment All Properties");this._element.classList.toggle("rule-disabled",this._ruleDisabled);}
_highlightNodesWithSelector()
{if(!this._style.ownerRule){WebInspector.domTreeManager.highlightDOMNode(this._style.node.id);return;}
WebInspector.domTreeManager.highlightSelector(this._currentSelectorText,this._style.node.ownerDocument.frameIdentifier);}
_hideDOMNodeHighlight()
{WebInspector.domTreeManager.hideDOMNodeHighlight();}
_handleMouseOver(event)
{this._highlightNodesWithSelector();}
_handleMouseMove(event)
{if(this._hasInvalidSelector)
return;
for(let element of this._selectorElements){let{top,right,bottom,left}=element.getBoundingClientRect();if(event.clientX>=left&&event.clientX<=right&&event.clientY>=top&&event.clientY<=bottom){this._selectorInput.title=element.title;return;}}
this._selectorInput.title="";}
_handleMouseOut(event)
{this._hideDOMNodeHighlight();}
_save(event)
{event.preventDefault();event.stopPropagation();if(this._style.type!==WebInspector.CSSStyleDeclaration.Type.Rule){InspectorFrontendHost.beep();return;}
let sourceCode=this._style.ownerRule.sourceCodeLocation.sourceCode;if(sourceCode.type!==WebInspector.Resource.Type.Stylesheet){InspectorFrontendHost.beep();return;}
var url;if(sourceCode.urlComponents.scheme==="data"){let mainResource=WebInspector.frameResourceManager.mainFrame.mainResource;let pathDirectory=mainResource.url.slice(0,-mainResource.urlComponents.lastPathComponent.length);url=pathDirectory+"base64.css";}else
url=sourceCode.url;const saveAs=event.shiftKey;WebInspector.saveDataToFile({url:url,content:sourceCode.content},saveAs);}
_handleKeyDown(event)
{if(event.keyCode===WebInspector.KeyboardShortcut.Key.Enter.keyCode){event.preventDefault();this.focus();return;}
if(event.keyCode!==WebInspector.KeyboardShortcut.Key.Tab.keyCode){this._highlightNodesWithSelector();return;}
if(event.shiftKey&&this._delegate&&typeof this._delegate.cssStyleDeclarationSectionEditorPreviousRule==="function"){event.preventDefault();this._delegate.cssStyleDeclarationSectionEditorPreviousRule(this,true);return;}
if(!event.metaKey){event.preventDefault();this.focus();this._propertiesTextEditor.selectFirstProperty();return;}}
_handleKeyPress(event)
{if(!event.altGraphKey&&!event.altKey&&!event.ctrlKey&&!event.metaKey){
this._selectorElement.append(String.fromCharCode(event.keyCode));}}
_handleInput(event)
{this._selectorElement.textContent=this._selectorInput.value;this._highlightNodesWithSelector();}
_handleBlur(event)
{this._hideDOMNodeHighlight();let newSelectorText=this._currentSelectorText.trim();if(!newSelectorText){this.refresh();return;}
if(event.relatedTarget&&event.relatedTarget.isDescendant(this.element)){this._editorActive=true;this.focus();}
this._style.ownerRule.selectorText=newSelectorText;}
_updateSelectorIcon(event)
{if(!this._style.ownerRule||!this._style.editable)
return;this._hasInvalidSelector=event&&event.data&&!event.data.valid;this._element.classList.toggle("invalid-selector",!!this._hasInvalidSelector);if(this._hasInvalidSelector){this._iconElement.title=WebInspector.UIString("The selector “%s” is invalid.\nClick to revert to the previous selector.").format(this._selectorElement.textContent.trim());this._selectorInput.title=WebInspector.UIString("Using previous selector “%s”").format(this._style.ownerRule.selectorText);return;}
this._iconElement.title=this._ruleDisabled?WebInspector.UIString("Uncomment All Properties"):WebInspector.UIString("Comment All Properties");this._selectorInput.title="";}
_editorContentChanged(event)
{this._editorActive=true;}
_editorBlurred(event)
{this._editorActive=false;this.dispatchEventToListeners(WebInspector.CSSStyleDeclarationSection.Event.Blurred);}};WebInspector.CSSStyleDeclarationSection.Event={Blurred:"css-style-declaration-sections-blurred"};WebInspector.CSSStyleDeclarationSection.LockedStyleClassName="locked";WebInspector.CSSStyleDeclarationSection.SelectorLockedStyleClassName="selector-locked";WebInspector.CSSStyleDeclarationSection.LastInGroupStyleClassName="last-in-group";WebInspector.CSSStyleDeclarationSection.MatchedSelectorElementStyleClassName="matched";WebInspector.CSSStyleDeclarationSection.PseudoElementSelectorStyleClassName="pseudo-element-selector";WebInspector.CSSStyleDeclarationSection.AuthorStyleRuleIconStyleClassName="author-style-rule-icon";WebInspector.CSSStyleDeclarationSection.UserStyleRuleIconStyleClassName="user-style-rule-icon";WebInspector.CSSStyleDeclarationSection.UserAgentStyleRuleIconStyleClassName="user-agent-style-rule-icon";WebInspector.CSSStyleDeclarationSection.InspectorStyleRuleIconStyleClassName="inspector-style-rule-icon";WebInspector.CSSStyleDeclarationSection.InheritedStyleRuleIconStyleClassName="inherited-style-rule-icon";WebInspector.CSSStyleDeclarationSection.InheritedElementStyleRuleIconStyleClassName="inherited-element-style-rule-icon";WebInspector.CSSStyleDeclarationTextEditor=class CSSStyleDeclarationTextEditor extends WebInspector.View
{constructor(delegate,style)
{super();this.element.classList.add(WebInspector.CSSStyleDeclarationTextEditor.StyleClassName);this.element.classList.add(WebInspector.SyntaxHighlightedStyleClassName);this.element.addEventListener("mousedown",this._handleMouseDown.bind(this),true);this.element.addEventListener("mouseup",this._handleMouseUp.bind(this));this._mouseDownCursorPosition=null;this._propertyVisibilityMode=WebInspector.CSSStyleDeclarationTextEditor.PropertyVisibilityMode.ShowAll;this._showsImplicitProperties=true;this._alwaysShowPropertyNames={};this._filterResultPropertyNames=null;this._sortProperties=false;this._hasActiveInlineSwatchEditor=false;this._linePrefixWhitespace="";this._delegate=delegate||null;this._codeMirror=WebInspector.CodeMirrorEditor.create(this.element,{readOnly:true,lineWrapping:true,mode:"css-rule",electricChars:false,indentWithTabs:false,indentUnit:4,smartIndent:false,matchBrackets:true,autoCloseBrackets:true});this._codeMirror.addKeyMap({"Enter":this._handleEnterKey.bind(this),"Shift-Enter":this._insertNewlineAfterCurrentLine.bind(this),"Shift-Tab":this._handleShiftTabKey.bind(this),"Tab":this._handleTabKey.bind(this)});this._completionController=new WebInspector.CodeMirrorCompletionController(this._codeMirror,this);this._tokenTrackingController=new WebInspector.CodeMirrorTokenTrackingController(this._codeMirror,this);this._completionController.noEndingSemicolon=true;this._jumpToSymbolTrackingModeEnabled=false;this._tokenTrackingController.classNameForHighlightedRange=WebInspector.CodeMirrorTokenTrackingController.JumpToSymbolHighlightStyleClassName;this._tokenTrackingController.mouseOverDelayDuration=0;this._tokenTrackingController.mouseOutReleaseDelayDuration=0;this._tokenTrackingController.mode=WebInspector.CodeMirrorTokenTrackingController.Mode.NonSymbolTokens;this._codeMirror.on("change",this._contentChanged.bind(this));this._codeMirror.on("blur",this._editorBlured.bind(this));this._codeMirror.on("beforeChange",this._handleBeforeChange.bind(this));if(typeof this._delegate.cssStyleDeclarationTextEditorFocused==="function")
this._codeMirror.on("focus",this._editorFocused.bind(this));this.style=style;this._shownProperties=[];WebInspector.settings.stylesShowInlineWarnings.addEventListener(WebInspector.Setting.Event.Changed,this.refresh,this);}
get delegate(){return this._delegate;}
set delegate(delegate)
{this._delegate=delegate||null;}
get style(){return this._style;}
set style(style)
{if(this._style===style)
return;if(this._style){this._style.removeEventListener(WebInspector.CSSStyleDeclaration.Event.PropertiesChanged,this._propertiesChanged,this);WebInspector.notifications.removeEventListener(WebInspector.Notification.GlobalModifierKeysDidChange,this._updateJumpToSymbolTrackingMode,this);}
this._style=style||null;if(this._style){this._style.addEventListener(WebInspector.CSSStyleDeclaration.Event.PropertiesChanged,this._propertiesChanged,this);WebInspector.notifications.addEventListener(WebInspector.Notification.GlobalModifierKeysDidChange,this._updateJumpToSymbolTrackingMode,this);}
this._updateJumpToSymbolTrackingMode();this._resetContent();}
get shownProperties(){return this._shownProperties;}
get focused()
{return this._codeMirror.getWrapperElement().classList.contains("CodeMirror-focused");}
get alwaysShowPropertyNames(){return Object.keys(this._alwaysShowPropertyNames);}
set alwaysShowPropertyNames(alwaysShowPropertyNames)
{this._alwaysShowPropertyNames=(alwaysShowPropertyNames||[]).keySet();this._resetContent();}
get propertyVisibilityMode(){return this._propertyVisibilityMode;}
set propertyVisibilityMode(propertyVisibilityMode)
{if(this._propertyVisibilityMode===propertyVisibilityMode)
return;this._propertyVisibilityMode=propertyVisibilityMode;this._resetContent();}
get showsImplicitProperties(){return this._showsImplicitProperties;}
set showsImplicitProperties(showsImplicitProperties)
{if(this._showsImplicitProperties===showsImplicitProperties)
return;this._showsImplicitProperties=showsImplicitProperties;this._resetContent();}
get sortProperties(){return this._sortProperties;}
set sortProperties(sortProperties)
{if(this._sortProperties===sortProperties)
return;this._sortProperties=sortProperties;this._resetContent();}
focus()
{this._codeMirror.focus();}
refresh()
{this._resetContent();}
highlightProperty(property)
{function propertiesMatch(cssProperty)
{if(cssProperty.enabled&&!cssProperty.overridden){if(cssProperty.canonicalName===property.canonicalName||hasMatchingLonghandProperty(cssProperty))
return true;}
return false;}
function hasMatchingLonghandProperty(cssProperty)
{var cssProperties=cssProperty.relatedLonghandProperties;if(!cssProperties.length)
return false;for(var property of cssProperties){if(propertiesMatch(property))
return true;}
return false;}
for(var cssProperty of this.style.properties){if(propertiesMatch(cssProperty)){var selection=cssProperty.__propertyTextMarker.find();this._codeMirror.setSelection(selection.from,selection.to);this.focus();return true;}}
return false;}
clearSelection()
{this._codeMirror.setCursor({line:0,ch:0});}
findMatchingProperties(needle)
{if(!needle){this.resetFilteredProperties();return false;}
var propertiesList=this._style.visibleProperties.length?this._style.visibleProperties:this._style.properties;var matchingProperties=[];for(var property of propertiesList)
matchingProperties.push(property.text.includes(needle));if(!matchingProperties.includes(true)){this.resetFilteredProperties();return false;}
for(var i=0;i<matchingProperties.length;++i){var property=propertiesList[i];if(matchingProperties[i])
property.__filterResultClassName=WebInspector.CSSStyleDetailsSidebarPanel.FilterMatchSectionClassName;else
property.__filterResultClassName=WebInspector.CSSStyleDetailsSidebarPanel.NoFilterMatchInPropertyClassName;this._updateTextMarkerForPropertyIfNeeded(property);}
return true;}
resetFilteredProperties()
{var propertiesList=this._style.visibleProperties.length?this._style.visibleProperties:this._style.properties;for(var property of propertiesList){if(property.__filterResultClassName){property.__filterResultClassName=null;this._updateTextMarkerForPropertyIfNeeded(property);}}}
removeNonMatchingProperties(needle)
{this._filterResultPropertyNames=null;if(!needle){this._resetContent();return false;}
var matchingPropertyNames=[];for(var property of this._style.properties){var indexesOfNeedle=property.text.getMatchingIndexes(needle);if(indexesOfNeedle.length){matchingPropertyNames.push(property.name);property.__filterResultClassName=WebInspector.CSSStyleDetailsSidebarPanel.FilterMatchSectionClassName;property.__filterResultNeedlePosition={start:indexesOfNeedle,length:needle.length};}}
this._filterResultPropertyNames=matchingPropertyNames.length?matchingPropertyNames.keySet():{};this._resetContent();return matchingPropertyNames.length>0;}
uncommentAllProperties()
{function uncommentProperties(properties)
{if(!properties.length)
return false;for(var property of properties){if(property._commentRange){this._uncommentRange(property._commentRange);property._commentRange=null;}}
return true;}
return uncommentProperties.call(this,this._style.pendingProperties)||uncommentProperties.call(this,this._style.properties);}
commentAllProperties()
{if(!this._style.hasProperties())
return false;for(var property of this._style.properties){if(property.__propertyTextMarker)
this._commentProperty(property);}
return true;}
selectFirstProperty()
{var line=this._codeMirror.getLine(0);var trimmedLine=line.trimRight();if(!line||!trimmedLine.trimLeft().length)
this.clearSelection();var index=line.indexOf(":");var cursor={line:0,ch:0};this._codeMirror.setSelection(cursor,{line:0,ch:index<0||this._textAtCursorIsComment(this._codeMirror,cursor)?trimmedLine.length:index});}
selectLastProperty()
{var line=this._codeMirror.lineCount()-1;var lineText=this._codeMirror.getLine(line);var trimmedLine=lineText.trimRight();var lastAnchor;var lastHead;if(this._textAtCursorIsComment(this._codeMirror,{line,ch:line.length})){lastAnchor=0;lastHead=line.length;}else{var colon=/(?::\s*)/.exec(lineText);lastAnchor=colon?colon.index+colon[0].length:0;lastHead=trimmedLine.length-trimmedLine.endsWith(";");}
this._codeMirror.setSelection({line,ch:lastAnchor},{line,ch:lastHead});}
completionControllerCompletionsHidden(completionController)
{var styleText=this._style.text;var currentText=this._formattedContent();
if(styleText!==currentText)
this._commitChanges();else
this._propertiesChanged();}
completionControllerCompletionsNeeded(completionController,prefix,defaultCompletions,base,suffix,forced)
{let properties=this._style.nodeStyles.computedStyle.properties;let variables=properties.filter((property)=>property.variable&&property.name.startsWith(prefix));let variableNames=variables.map((property)=>property.name);completionController.updateCompletions(defaultCompletions.concat(variableNames));}
layout()
{this._codeMirror.refresh();}
_textAtCursorIsComment(codeMirror,cursor)
{var token=codeMirror.getTokenTypeAt(cursor);return token&&token.includes("comment");}
_highlightNextNameOrValue(codeMirror,cursor,text)
{let range=this._rangeForNextNameOrValue(codeMirror,cursor,text);codeMirror.setSelection(range.from,range.to);}
_rangeForNextNameOrValue(codeMirror,cursor,text)
{let nextAnchor=0;let nextHead=0;if(this._textAtCursorIsComment(codeMirror,cursor))
nextHead=text.length;else{let range=WebInspector.rangeForNextCSSNameOrValue(text,cursor.ch);nextAnchor=range.from;nextHead=range.to;}
return{from:{line:cursor.line,ch:nextAnchor},to:{line:cursor.line,ch:nextHead},};}
_handleMouseDown(event)
{if(this._codeMirror.options.readOnly)
return;let cursor=this._codeMirror.coordsChar({left:event.x,top:event.y});let line=this._codeMirror.getLine(cursor.line);if(!line.trim().length)
return;this._mouseDownCursorPosition=cursor;this._mouseDownCursorPosition.previousRange={from:this._codeMirror.getCursor("from"),to:this._codeMirror.getCursor("to")};}
_handleMouseUp(event)
{if(this._codeMirror.options.readOnly||!this._mouseDownCursorPosition)
return;let cursor=this._codeMirror.coordsChar({left:event.x,top:event.y});let clickedBookmark=false;for(let marker of this._codeMirror.findMarksAt(cursor)){if(marker.type!=="bookmark"||marker.replacedWith!==event.target)
continue;let pos=marker.find();if(pos.line===cursor.line&&Math.abs(pos.ch-cursor.ch)<=1){clickedBookmark=true;break;}}
if(!clickedBookmark&&this._mouseDownCursorPosition.line===cursor.line&&this._mouseDownCursorPosition.ch===cursor.ch){let line=this._codeMirror.getLine(cursor.line);if(cursor.ch===line.trimRight().length){let nextLine=this._codeMirror.getLine(cursor.line+1);if(WebInspector.settings.stylesInsertNewline.value&&cursor.line<this._codeMirror.lineCount()-1&&(!nextLine||!nextLine.trim().length)){this._codeMirror.setCursor({line:cursor.line+1,ch:0});}else{let line=this._codeMirror.getLine(cursor.line);let replacement=WebInspector.settings.stylesInsertNewline.value?"\n":"";if(!line.trimRight().endsWith(";")&&!this._textAtCursorIsComment(this._codeMirror,cursor))
replacement=";"+replacement;this._codeMirror.replaceRange(replacement,cursor);}}else if(WebInspector.settings.stylesSelectOnFirstClick.value&&this._mouseDownCursorPosition.previousRange){let range=this._rangeForNextNameOrValue(this._codeMirror,cursor,line);let clickedDifferentLine=this._mouseDownCursorPosition.previousRange.from.line!==cursor.line||this._mouseDownCursorPosition.previousRange.to.line!==cursor.line;let cursorInPreviousRange=cursor.ch>=this._mouseDownCursorPosition.previousRange.from.ch&&cursor.ch<=this._mouseDownCursorPosition.previousRange.to.ch;let previousInNewRange=this._mouseDownCursorPosition.previousRange.from.ch>=range.from.ch&&this._mouseDownCursorPosition.previousRange.to.ch<=range.to.ch;
if(!this._codeMirror.hasFocus()||clickedDifferentLine||(!cursorInPreviousRange&&!previousInNewRange))
this._codeMirror.setSelection(range.from,range.to);}}
this._mouseDownCursorPosition=null;}
_handleBeforeChange(codeMirror,change)
{if(change.origin!=="+delete"||this._completionController.isShowingCompletions())
return CodeMirror.Pass;if(!change.to.line&&!change.to.ch){if(codeMirror.lineCount()===1)
return CodeMirror.Pass;var line=codeMirror.getLine(change.to.line);if(line&&line.trim().length)
return CodeMirror.Pass;codeMirror.execCommand("deleteLine");return;}
var marks=codeMirror.findMarksAt(change.to);if(!marks.length)
return CodeMirror.Pass;for(var mark of marks)
mark.clear();}
_handleEnterKey(codeMirror)
{var cursor=codeMirror.getCursor();var line=codeMirror.getLine(cursor.line);var trimmedLine=line.trimRight();var hasEndingSemicolon=trimmedLine.endsWith(";");if(!trimmedLine.trimLeft().length)
return CodeMirror.Pass;if(hasEndingSemicolon&&cursor.ch===trimmedLine.length-1)
++cursor.ch;if(cursor.ch===trimmedLine.length){var replacement="\n";if(!hasEndingSemicolon&&!this._textAtCursorIsComment(this._codeMirror,cursor))
replacement=";"+replacement;this._codeMirror.replaceRange(replacement,cursor);return;}
return CodeMirror.Pass;}
_insertNewlineAfterCurrentLine(codeMirror)
{var cursor=codeMirror.getCursor();var line=codeMirror.getLine(cursor.line);var trimmedLine=line.trimRight();cursor.ch=trimmedLine.length;if(cursor.ch){var replacement="\n";if(!trimmedLine.endsWith(";")&&!this._textAtCursorIsComment(this._codeMirror,cursor))
replacement=";"+replacement;this._codeMirror.replaceRange(replacement,cursor);return;}
return CodeMirror.Pass;}
_handleShiftTabKey(codeMirror)
{function switchRule()
{if(this._delegate&&typeof this._delegate.cssStyleDeclarationTextEditorSwitchRule==="function"){this._delegate.cssStyleDeclarationTextEditorSwitchRule(true);return;}
return CodeMirror.Pass;}
let cursor=codeMirror.getCursor();let line=codeMirror.getLine(cursor.line);let previousLine=codeMirror.getLine(cursor.line-1);if(!line&&!previousLine&&!cursor.line)
return switchRule.call(this);let trimmedPreviousLine=previousLine?previousLine.trimRight():"";let previousAnchor=0;let previousHead=line.length;let isComment=this._textAtCursorIsComment(codeMirror,cursor);if(cursor.ch===line.indexOf(":")||line.indexOf(":")<0||isComment){if(previousLine){--cursor.line;previousHead=trimmedPreviousLine.length;if(!this._textAtCursorIsComment(codeMirror,cursor)){let colon=/(?::\s*)/.exec(previousLine);previousAnchor=colon?colon.index+colon[0].length:0;if(trimmedPreviousLine.includes(";"))
previousHead=trimmedPreviousLine.lastIndexOf(";");}
codeMirror.setSelection({line:cursor.line,ch:previousAnchor},{line:cursor.line,ch:previousHead});return;}
if(cursor.line){codeMirror.setCursor(cursor.line-1,0);return;}
return switchRule.call(this);}
if(!isComment){let match=/(?:[^:;\s]\s*)+/.exec(line);previousAnchor=match.index;previousHead=previousAnchor+match[0].length;}
codeMirror.setSelection({line:cursor.line,ch:previousAnchor},{line:cursor.line,ch:previousHead});}
_handleTabKey(codeMirror)
{function switchRule(){if(this._delegate&&typeof this._delegate.cssStyleDeclarationTextEditorSwitchRule==="function"){this._delegate.cssStyleDeclarationTextEditorSwitchRule();return;}
return CodeMirror.Pass;}
let cursor=codeMirror.getCursor();let line=codeMirror.getLine(cursor.line);let trimmedLine=line.trimRight();let lastLine=cursor.line===codeMirror.lineCount()-1;let nextLine=codeMirror.getLine(cursor.line+1);let trimmedNextLine=nextLine?nextLine.trimRight():"";if(!trimmedLine.trimLeft().length){if(lastLine)
return switchRule.call(this);if(!trimmedNextLine.trimLeft().length){codeMirror.setCursor(cursor.line+1,0);return;}
++cursor.line;this._highlightNextNameOrValue(codeMirror,cursor,nextLine);return;}
if(trimmedLine.endsWith(":")){codeMirror.setCursor(cursor.line,line.length);this._completionController._completeAtCurrentPosition(true);return;}
let hasEndingSemicolon=trimmedLine.endsWith(";");let pastLastSemicolon=line.includes(";")&&cursor.ch>=line.lastIndexOf(";");if(cursor.ch>=line.trimRight().length-hasEndingSemicolon||pastLastSemicolon){this._completionController.completeAtCurrentPositionIfNeeded().then(function(result){if(result!==WebInspector.CodeMirrorCompletionController.UpdatePromise.NoCompletionsFound)
return;let replacement="";if(!hasEndingSemicolon&&!pastLastSemicolon&&!this._textAtCursorIsComment(codeMirror,cursor))
replacement+=";";if(lastLine)
replacement+="\n";if(replacement.length)
codeMirror.replaceRange(replacement,{line:cursor.line,ch:trimmedLine.length});if(!nextLine){codeMirror.setCursor(cursor.line+1,0);return;}
this._highlightNextNameOrValue(codeMirror,{line:cursor.line+1,ch:0},nextLine);}.bind(this));return;}
this._highlightNextNameOrValue(codeMirror,cursor,line);}
_clearRemoveEditingLineClassesTimeout()
{if(!this._removeEditingLineClassesTimeout)
return;clearTimeout(this._removeEditingLineClassesTimeout);delete this._removeEditingLineClassesTimeout;}
_removeEditingLineClasses()
{this._clearRemoveEditingLineClassesTimeout();function removeEditingLineClasses()
{var lineCount=this._codeMirror.lineCount();for(var i=0;i<lineCount;++i)
this._codeMirror.removeLineClass(i,"wrap",WebInspector.CSSStyleDeclarationTextEditor.EditingLineStyleClassName);}
this._codeMirror.operation(removeEditingLineClasses.bind(this));}
_removeEditingLineClassesSoon()
{if(this._removeEditingLineClassesTimeout)
return;this._removeEditingLineClassesTimeout=setTimeout(this._removeEditingLineClasses.bind(this),WebInspector.CSSStyleDeclarationTextEditor.RemoveEditingLineClassesDelay);}
_formattedContent()
{var content=WebInspector.CSSStyleDeclarationTextEditor.PrefixWhitespace;var lineCount=this._codeMirror.lineCount();for(var i=0;i<lineCount;++i){var lineContent=this._codeMirror.getLine(i);content+=this._linePrefixWhitespace+lineContent;if(i!==lineCount-1)
content+="\n";}
content+=WebInspector.CSSStyleDeclarationTextEditor.SuffixWhitespace;
return content.replace(/\s*\n\s*\n(\s*)/g,"\n$1");}
_commitChanges()
{if(this._commitChangesTimeout){clearTimeout(this._commitChangesTimeout);delete this._commitChangesTimeout;}
this._style.text=this._formattedContent();}
_editorBlured(codeMirror)
{if(this._completionController.isHandlingClickEvent())
return;this._resetContent();this.dispatchEventToListeners(WebInspector.CSSStyleDeclarationTextEditor.Event.Blurred);}
_editorFocused(codeMirror)
{if(typeof this._delegate.cssStyleDeclarationTextEditorFocused==="function")
this._delegate.cssStyleDeclarationTextEditorFocused();}
_contentChanged(codeMirror,change)
{
if(!this._style||!this._style.editable||this._ignoreCodeMirrorContentDidChangeEvent)
return;this._markLinesWithCheckboxPlaceholder();this._clearRemoveEditingLineClassesTimeout();this._codeMirror.addLineClass(change.from.line,"wrap",WebInspector.CSSStyleDeclarationTextEditor.EditingLineStyleClassName);
if(this._completionController.isCompletionChange(change))
this._createInlineSwatches(false,change.from.line);
var delay=change.origin&&change.origin.charAt(0)==="+"?WebInspector.CSSStyleDeclarationTextEditor.CommitCoalesceDelay:0;if(this._commitChangesTimeout)
clearTimeout(this._commitChangesTimeout);this._commitChangesTimeout=setTimeout(this._commitChanges.bind(this),delay);this.dispatchEventToListeners(WebInspector.CSSStyleDeclarationTextEditor.Event.ContentChanged);}
_updateTextMarkers(nonatomic)
{function update()
{this._clearTextMarkers(true);this._iterateOverProperties(true,function(property){var styleTextRange=property.styleDeclarationTextRange;if(!styleTextRange)
return;var from={line:styleTextRange.startLine,ch:styleTextRange.startColumn};var to={line:styleTextRange.endLine,ch:styleTextRange.endColumn};from.line--;to.line--;from.ch-=this._linePrefixWhitespace.length;to.ch-=this._linePrefixWhitespace.length;this._createTextMarkerForPropertyIfNeeded(from,to,property);});if(!this._codeMirror.getOption("readOnly")){this._codeMirror.eachLine((lineHandler)=>{this._createCommentedCheckboxMarker(lineHandler);});}
this._createInlineSwatches(true);this._markLinesWithCheckboxPlaceholder();}
if(nonatomic)
update.call(this);else
this._codeMirror.operation(update.bind(this));}
_createCommentedCheckboxMarker(lineHandle)
{var lineNumber=lineHandle.lineNo();if(!lineNumber&&isNaN(lineNumber))
return;let commentedPropertyRegex=/\/\*\s*[-\w]+\s*\:\s*(?:(?:\".*\"|url\(.+\)|[^;])\s*)+;?\s*\*\//g;var match=commentedPropertyRegex.exec(lineHandle.text);if(!match)
return;while(match){var checkboxElement=document.createElement("input");checkboxElement.type="checkbox";checkboxElement.checked=false;checkboxElement.addEventListener("change",this._propertyCommentCheckboxChanged.bind(this));var from={line:lineNumber,ch:match.index};var to={line:lineNumber,ch:match.index+match[0].length};var checkboxMarker=this._codeMirror.setUniqueBookmark(from,checkboxElement);checkboxMarker.__propertyCheckbox=true;var commentTextMarker=this._codeMirror.markText(from,to);checkboxElement.__commentTextMarker=commentTextMarker;match=commentedPropertyRegex.exec(lineHandle.text);}}
_createInlineSwatches(nonatomic,lineNumber)
{function createSwatch(swatch,marker,valueObject,valueString)
{swatch.addEventListener(WebInspector.InlineSwatch.Event.ValueChanged,this._inlineSwatchValueChanged,this);swatch.addEventListener(WebInspector.InlineSwatch.Event.Activated,this._inlineSwatchActivated,this);swatch.addEventListener(WebInspector.InlineSwatch.Event.Deactivated,this._inlineSwatchDeactivated,this);let codeMirrorTextMarker=marker.codeMirrorTextMarker;let codeMirrorTextMarkerRange=codeMirrorTextMarker.find();this._codeMirror.setUniqueBookmark(codeMirrorTextMarkerRange.from,swatch.element);swatch.__textMarker=codeMirrorTextMarker;swatch.__textMarkerRange=codeMirrorTextMarkerRange;}
function update()
{let range=typeof lineNumber==="number"?new WebInspector.TextRange(lineNumber,0,lineNumber+1,0):null;createCodeMirrorColorTextMarkers(this._codeMirror,range,(marker,color,colorString)=>{let swatch=new WebInspector.InlineSwatch(WebInspector.InlineSwatch.Type.Color,color,this._codeMirror.getOption("readOnly"));createSwatch.call(this,swatch,marker,color,colorString);});createCodeMirrorGradientTextMarkers(this._codeMirror,range,(marker,gradient,gradientString)=>{let swatch=new WebInspector.InlineSwatch(WebInspector.InlineSwatch.Type.Gradient,gradient,this._codeMirror.getOption("readOnly"));createSwatch.call(this,swatch,marker,gradient,gradientString);});createCodeMirrorCubicBezierTextMarkers(this._codeMirror,range,(marker,bezier,bezierString)=>{let swatch=new WebInspector.InlineSwatch(WebInspector.InlineSwatch.Type.Bezier,bezier,this._codeMirror.getOption("readOnly"));createSwatch.call(this,swatch,marker,bezier,bezierString);});createCodeMirrorSpringTextMarkers(this._codeMirror,range,(marker,spring,springString)=>{let swatch=new WebInspector.InlineSwatch(WebInspector.InlineSwatch.Type.Spring,spring,this._codeMirror.getOption("readOnly"));createSwatch.call(this,swatch,marker,spring,springString);});createCodeMirrorVariableTextMarkers(this._codeMirror,range,(marker,variable,variableString)=>{const dontCreateIfMissing=true;let variableProperty=this._style.nodeStyles.computedStyle.propertyForName(variableString,dontCreateIfMissing);if(!variableProperty){let from={line:marker.range.startLine,ch:marker.range.startColumn};let to={line:marker.range.endLine,ch:marker.range.endColumn};this._codeMirror.markText(from,to,{className:"invalid"});if(WebInspector.settings.stylesShowInlineWarnings.value){let invalidMarker=document.createElement("button");invalidMarker.classList.add("invalid-warning-marker","clickable");invalidMarker.title=WebInspector.UIString("The variable “%s” does not exist.\nClick to delete and open autocomplete.").format(variableString);invalidMarker.addEventListener("click",(event)=>{this._codeMirror.replaceRange("",from,to);this._codeMirror.setCursor(from);this._completionController.completeAtCurrentPositionIfNeeded(true);});this._codeMirror.setBookmark(from,invalidMarker);}
return;}
let trimmedValue=variableProperty.value.trim();let swatch=new WebInspector.InlineSwatch(WebInspector.InlineSwatch.Type.Variable,trimmedValue,this._codeMirror.getOption("readOnly"));createSwatch.call(this,swatch,marker,variableProperty,trimmedValue);});}
if(nonatomic)
update.call(this);else
this._codeMirror.operation(update.bind(this));}
_updateTextMarkerForPropertyIfNeeded(property)
{var textMarker=property.__propertyTextMarker;if(!textMarker)
return;var range=textMarker.find();if(!range)
return;this._createTextMarkerForPropertyIfNeeded(range.from,range.to,property);}
_createTextMarkerForPropertyIfNeeded(from,to,property)
{if(!this._codeMirror.getOption("readOnly")){var checkboxElement=document.createElement("input");checkboxElement.type="checkbox";checkboxElement.checked=true;checkboxElement.addEventListener("change",this._propertyCheckboxChanged.bind(this));checkboxElement.__cssProperty=property;var checkboxMarker=this._codeMirror.setUniqueBookmark(from,checkboxElement);checkboxMarker.__propertyCheckbox=true;}else if(this._delegate.cssStyleDeclarationTextEditorShouldAddPropertyGoToArrows&&!property.implicit&&typeof this._delegate.cssStyleDeclarationTextEditorShowProperty==="function"){let arrowElement=WebInspector.createGoToArrowButton();arrowElement.title=WebInspector.UIString("Option-click to show source");let delegate=this._delegate;arrowElement.addEventListener("click",function(event){delegate.cssStyleDeclarationTextEditorShowProperty(property,event.altKey);});this._codeMirror.setUniqueBookmark(to,arrowElement);}
function duplicatePropertyExistsBelow(cssProperty)
{var propertyFound=false;for(var property of this._style.properties){if(property===cssProperty)
propertyFound=true;else if(property.name===cssProperty.name&&propertyFound)
return true;}
return false;}
var propertyNameIsValid=false;if(WebInspector.CSSCompletions.cssNameCompletions)
propertyNameIsValid=WebInspector.CSSCompletions.cssNameCompletions.isValidPropertyName(property.name);var classNames=["css-style-declaration-property"];if(property.overridden)
classNames.push("overridden");if(property.implicit)
classNames.push("implicit");if(this._style.inherited&&!property.inherited)
classNames.push("not-inherited");if(!property.valid&&property.hasOtherVendorNameOrKeyword())
classNames.push("other-vendor");else if(!property.valid&&(!propertyNameIsValid||duplicatePropertyExistsBelow.call(this,property)))
classNames.push("invalid");if(!property.enabled)
classNames.push("disabled");if(property.__filterResultClassName&&!property.__filterResultNeedlePosition)
classNames.push(property.__filterResultClassName);var classNamesString=classNames.join(" ");
if(property.__propertyTextMarker&&property.__propertyTextMarker.doc.cm===this._codeMirror&&property.__propertyTextMarker.find()){if(property.__propertyTextMarker.className===classNamesString)
return;property.__propertyTextMarker.clear();}
var propertyTextMarker=this._codeMirror.markText(from,to,{className:classNamesString});propertyTextMarker.__cssProperty=property;property.__propertyTextMarker=propertyTextMarker;property.addEventListener(WebInspector.CSSProperty.Event.OverriddenStatusChanged,this._propertyOverriddenStatusChanged,this);this._removeCheckboxPlaceholder(from.line);if(property.__filterResultClassName&&property.__filterResultNeedlePosition){for(var needlePosition of property.__filterResultNeedlePosition.start){var start={line:from.line,ch:needlePosition};var end={line:to.line,ch:start.ch+property.__filterResultNeedlePosition.length};this._codeMirror.markText(start,end,{className:property.__filterResultClassName});}}
if(this._codeMirror.getOption("readOnly")||property.hasOtherVendorNameOrKeyword()||property.text.trim().endsWith(":")||!WebInspector.settings.stylesShowInlineWarnings.value)
return;var propertyHasUnnecessaryPrefix=property.name.startsWith("-webkit-")&&WebInspector.CSSCompletions.cssNameCompletions.isValidPropertyName(property.canonicalName);function generateInvalidMarker(options)
{var invalidMarker=document.createElement("button");invalidMarker.className="invalid-warning-marker";invalidMarker.title=options.title;if(typeof options.correction==="string"){ invalidMarker.classList.add("clickable");invalidMarker.addEventListener("click",function(){this._codeMirror.replaceRange(options.correction,from,to);if(options.autocomplete){this._codeMirror.setCursor(to);this.focus();this._completionController._completeAtCurrentPosition(true);}}.bind(this));}
this._codeMirror.setBookmark(options.position,invalidMarker);}
function instancesOfProperty(propertyName)
{var count=0;for(var property of this._style.properties){if(property.name===propertyName)
++count;}
return count;}
var instances=instancesOfProperty.call(this,property.name);var invalidMarkerInfo;if(propertyHasUnnecessaryPrefix&&!instancesOfProperty.call(this,property.canonicalName)){generateInvalidMarker.call(this,{position:from,title:WebInspector.UIString("The “webkit” prefix is not necessary.\nClick to insert a duplicate without the prefix."),correction:property.text+"\n"+property.text.replace("-webkit-",""),autocomplete:false});}else if(instances>1){invalidMarkerInfo={position:from,title:WebInspector.UIString("Duplicate property “%s”.\nClick to delete this property.").format(property.name),correction:"",autocomplete:false};}
if(property.valid){if(invalidMarkerInfo)
generateInvalidMarker.call(this,invalidMarkerInfo);return;}
if(propertyNameIsValid){let start={line:from.line,ch:from.ch+property.name.length+2};let end={line:to.line,ch:start.ch+property.value.length};this._codeMirror.markText(start,end,{className:"invalid"});if(/^(?:\d+)$/.test(property.value)){invalidMarkerInfo={position:from,title:WebInspector.UIString("The value “%s” needs units.\nClick to add “px” to the value.").format(property.value),correction:property.name+": "+property.value+"px;",autocomplete:false};}else{var valueReplacement=property.value.length?WebInspector.UIString("The value “%s” is not supported for this property.\nClick to delete and open autocomplete.").format(property.value):WebInspector.UIString("This property needs a value.\nClick to open autocomplete.");invalidMarkerInfo={position:from,title:valueReplacement,correction:property.name+": ",autocomplete:true};}}else if(!instancesOfProperty.call(this,"-webkit-"+property.name)&&WebInspector.CSSCompletions.cssNameCompletions.propertyRequiresWebkitPrefix(property.name)){invalidMarkerInfo={position:from,title:WebInspector.UIString("The “webkit” prefix is needed for this property.\nClick to insert a duplicate with the prefix."),correction:"-webkit-"+property.text+"\n"+property.text,autocomplete:false};}else if(!propertyHasUnnecessaryPrefix&&!WebInspector.CSSCompletions.cssNameCompletions.isValidPropertyName("-webkit-"+property.name)){var closestPropertyName=WebInspector.CSSCompletions.cssNameCompletions.getClosestPropertyName(property.name);if(closestPropertyName){invalidMarkerInfo={position:from,title:WebInspector.UIString("Did you mean “%s”?\nClick to replace.").format(closestPropertyName),correction:property.text.replace(property.name,closestPropertyName),autocomplete:true};}else if(property.name.startsWith("-webkit-")&&(closestPropertyName=WebInspector.CSSCompletions.cssNameCompletions.getClosestPropertyName(property.canonicalName))){invalidMarkerInfo={position:from,title:WebInspector.UIString("Did you mean “%s”?\nClick to replace.").format("-webkit-"+closestPropertyName),correction:property.text.replace(property.canonicalName,closestPropertyName),autocomplete:true};}else{invalidMarkerInfo={position:from,title:WebInspector.UIString("Unsupported property “%s”").format(property.name),correction:false,autocomplete:false};}}
if(!invalidMarkerInfo)
return;generateInvalidMarker.call(this,invalidMarkerInfo);}
_clearTextMarkers(nonatomic,all)
{function clear()
{var markers=this._codeMirror.getAllMarks();for(var i=0;i<markers.length;++i){var textMarker=markers[i];if(!all&&textMarker.__checkboxPlaceholder){var position=textMarker.find();if(position&&!position.ch)
continue;}
if(textMarker.__cssProperty){textMarker.__cssProperty.removeEventListener(null,null,this);delete textMarker.__cssProperty.__propertyTextMarker;delete textMarker.__cssProperty;}
textMarker.clear();}}
if(nonatomic)
clear.call(this);else
this._codeMirror.operation(clear.bind(this));}
_iterateOverProperties(onlyVisibleProperties,callback)
{let properties=onlyVisibleProperties?this._style.visibleProperties:this._style.properties;let filterFunction=(property)=>property;if(this._filterResultPropertyNames){filterFunction=(property)=>{if(!property.variable&&this._propertyVisibilityMode===WebInspector.CSSStyleDeclarationTextEditor.PropertyVisibilityMode.HideNonVariables)
return false;if(property.variable&&this._propertyVisibilityMode===WebInspector.CSSStyleDeclarationTextEditor.PropertyVisibilityMode.HideVariables)
return false;if(property.implicit&&!this._showsImplicitProperties)
return false;if(!(property.name in this._filterResultPropertyNames))
return false;return true;};}else if(!onlyVisibleProperties){filterFunction=(property)=>{switch(this._propertyVisibilityMode){case WebInspector.CSSStyleDeclarationTextEditor.PropertyVisibilityMode.HideNonVariables:if(!property.variable)
return false;break;case WebInspector.CSSStyleDeclarationTextEditor.PropertyVisibilityMode.HideVariables:if(property.variable)
return false;break;case WebInspector.CSSStyleDeclarationTextEditor.PropertyVisibilityMode.ShowAll:break;default:console.error("Invalid property visibility mode");break;}
return!property.implicit||this._showsImplicitProperties||property.canonicalName in this._alwaysShowPropertyNames;};}
properties=properties.filter(filterFunction);if(this._sortProperties)
properties.sort((a,b)=>a.name.extendedLocaleCompare(b.name));this._shownProperties=properties;for(var i=0;i<properties.length;++i){if(callback.call(this,properties[i],i===properties.length-1))
break;}}
_propertyCheckboxChanged(event)
{var property=event.target.__cssProperty;if(!property)
return;this._commentProperty(property);}
_commentProperty(property)
{var textMarker=property.__propertyTextMarker;if(!textMarker)
return;
var range=textMarker.find();if(!range)
return;property._commentRange=range;property._commentRange.to.ch+=6;var text=this._codeMirror.getRange(range.from,range.to);function update()
{this._codeMirror.replaceRange("/* "+text+" */",range.from,range.to);this._createInlineSwatches(true,range.from.line);}
this._codeMirror.operation(update.bind(this));}
_propertyCommentCheckboxChanged(event)
{var commentTextMarker=event.target.__commentTextMarker;if(!commentTextMarker)
return;
var range=commentTextMarker.find();if(!range)
return;this._uncommentRange(range);}
_uncommentRange(range)
{var text=this._codeMirror.getRange(range.from,range.to);text=text.replace(/^\/\*\s*/,"").replace(/\s*\*\/$/,"");if(text.length&&text.charAt(text.length-1)!==";")
text+=";";function update()
{this._codeMirror.addLineClass(range.from.line,"wrap",WebInspector.CSSStyleDeclarationTextEditor.EditingLineStyleClassName);this._codeMirror.replaceRange(text,range.from,range.to);this._createInlineSwatches(true,range.from.line);}
this._codeMirror.operation(update.bind(this));}
_inlineSwatchValueChanged(event)
{let swatch=event&&event.target;if(!swatch)
return;let value=event.data&&event.data.value&&event.data.value.toString();if(!value)
return;let textMarker=swatch.__textMarker;let range=swatch.__textMarkerRange;if(!range)
return;function update()
{range=textMarker.find();if(!range)
return;textMarker.clear();this._codeMirror.replaceRange(value,range.from,range.to);range.to.ch=range.from.ch+value.length;textMarker=this._codeMirror.markText(range.from,range.to);swatch.__textMarker=textMarker;}
this._codeMirror.operation(update.bind(this));}
_inlineSwatchActivated()
{this._hasActiveInlineSwatchEditor=true;}
_inlineSwatchDeactivated()
{this._hasActiveInlineSwatchEditor=false;}
_propertyOverriddenStatusChanged(event)
{this._updateTextMarkerForPropertyIfNeeded(event.target);}
_propertiesChanged(event)
{
if(this._completionController.isShowingCompletions())
return;if(this._hasActiveInlineSwatchEditor)
return;if(this._ignoreNextPropertiesChanged){this._ignoreNextPropertiesChanged=false;return;}
if(!this.focused&&(!this._style.text||this._style.text!==this._formattedContent())){this._resetContent();return;}
this._removeEditingLineClassesSoon();this._updateTextMarkers();}
_markLinesWithCheckboxPlaceholder()
{if(this._codeMirror.getOption("readOnly"))
return;var linesWithPropertyCheckboxes={};var linesWithCheckboxPlaceholders={};var markers=this._codeMirror.getAllMarks();for(var i=0;i<markers.length;++i){var textMarker=markers[i];if(textMarker.__propertyCheckbox){var position=textMarker.find();if(position)
linesWithPropertyCheckboxes[position.line]=true;}else if(textMarker.__checkboxPlaceholder){var position=textMarker.find();if(position)
linesWithCheckboxPlaceholders[position.line]=true;}}
var lineCount=this._codeMirror.lineCount();for(var i=0;i<lineCount;++i){if(i in linesWithPropertyCheckboxes||i in linesWithCheckboxPlaceholders)
continue;var position={line:i,ch:0};var placeholderElement=document.createElement("div");placeholderElement.className=WebInspector.CSSStyleDeclarationTextEditor.CheckboxPlaceholderElementStyleClassName;var placeholderMark=this._codeMirror.setUniqueBookmark(position,placeholderElement);placeholderMark.__checkboxPlaceholder=true;}}
_removeCheckboxPlaceholder(lineNumber)
{var marks=this._codeMirror.findMarksAt({line:lineNumber,ch:0});for(var i=0;i<marks.length;++i){var mark=marks[i];if(!mark.__checkboxPlaceholder)
continue;mark.clear();return;}}
_formattedContentFromEditor()
{let indentString=WebInspector.indentString();let builder=new FormatterContentBuilder(indentString);let formatter=new WebInspector.Formatter(this._codeMirror,builder);let start={line:0,ch:0};let end={line:this._codeMirror.lineCount()-1};formatter.format(start,end);return builder.formattedContent.trim();}
_resetContent()
{if(this._commitChangesTimeout){clearTimeout(this._commitChangesTimeout);this._commitChangesTimeout=null;}
this._removeEditingLineClasses();const readOnly=!this._style||!this._style.editable||!this._style.styleSheetTextRange;this._codeMirror.setOption("readOnly",readOnly);if(readOnly){this.element.classList.add(WebInspector.CSSStyleDeclarationTextEditor.ReadOnlyStyleClassName);this._codeMirror.setOption("placeholder",WebInspector.UIString("No Properties"));}else{this.element.classList.remove(WebInspector.CSSStyleDeclarationTextEditor.ReadOnlyStyleClassName);this._codeMirror.setOption("placeholder",WebInspector.UIString("No Properties \u2014 Click to Edit"));}
if(!this._style){this._ignoreCodeMirrorContentDidChangeEvent=true;this._clearTextMarkers(false,true);this._codeMirror.setValue("");this._codeMirror.clearHistory();this._codeMirror.markClean();this._ignoreCodeMirrorContentDidChangeEvent=false;return;}
function update()
{let isEditorReadOnly=this._codeMirror.getOption("readOnly");let styleText=this._style.text;let trimmedStyleText=styleText.trim();
if(!trimmedStyleText&&!isEditorReadOnly){this._markLinesWithCheckboxPlaceholder();return;}
if(isEditorReadOnly){this._codeMirror.setValue("");let lineNumber=0;this._iterateOverProperties(false,function(property){let from={line:lineNumber,ch:0};let to={line:lineNumber};this._codeMirror.replaceRange((lineNumber?"\n":"")+property.synthesizedText,from);this._createTextMarkerForPropertyIfNeeded(from,to,property);lineNumber++;});return;}
let selectionAnchor=this._codeMirror.getCursor("anchor");let selectionHead=this._codeMirror.getCursor("head");let whitespaceRegex=/\s+/g;this._linePrefixWhitespace=WebInspector.indentString();let styleTextPrefixWhitespace=styleText.match(/^\s*/);
if(styleTextPrefixWhitespace&&trimmedStyleText.includes("\n")){let linePrefixWhitespaceMatch=styleTextPrefixWhitespace[0].match(/[^\S\n]+$/);if(linePrefixWhitespaceMatch)
this._linePrefixWhitespace=linePrefixWhitespaceMatch[0];}
this._codeMirror.setValue(trimmedStyleText);this._codeMirror.setValue(this._formattedContentFromEditor());
let cssPropertiesMap=new Map();this._iterateOverProperties(false,function(cssProperty){cssProperty.__refreshedAfterBlur=false;let propertyTextSansWhitespace=cssProperty.text.replace(whitespaceRegex,"");let existingProperties=cssPropertiesMap.get(propertyTextSansWhitespace)||[];existingProperties.push(cssProperty);cssPropertiesMap.set(propertyTextSansWhitespace,existingProperties);});
this._codeMirror.eachLine(function(lineHandler){let lineNumber=lineHandler.lineNo();let lineContentSansWhitespace=lineHandler.text.replace(whitespaceRegex,"");let properties=cssPropertiesMap.get(lineContentSansWhitespace);if(!properties){this._createCommentedCheckboxMarker(lineHandler);return;}
for(let property of properties){if(property.__refreshedAfterBlur)
continue;let from={line:lineNumber,ch:0};let to={line:lineNumber};this._createTextMarkerForPropertyIfNeeded(from,to,property);property.__refreshedAfterBlur=true;break;}}.bind(this));this._createInlineSwatches(true);this._codeMirror.setSelection(selectionAnchor,selectionHead);
this._codeMirror.clearHistory();this._codeMirror.markClean();this._markLinesWithCheckboxPlaceholder();}
this._clearTextMarkers(false,true);this._ignoreCodeMirrorContentDidChangeEvent=true;this._codeMirror.operation(update.bind(this));this._ignoreCodeMirrorContentDidChangeEvent=false;}
_updateJumpToSymbolTrackingMode()
{var oldJumpToSymbolTrackingModeEnabled=this._jumpToSymbolTrackingModeEnabled;if(!this._style)
this._jumpToSymbolTrackingModeEnabled=false;else
this._jumpToSymbolTrackingModeEnabled=WebInspector.modifierKeys.altKey&&!WebInspector.modifierKeys.metaKey&&!WebInspector.modifierKeys.shiftKey;if(oldJumpToSymbolTrackingModeEnabled!==this._jumpToSymbolTrackingModeEnabled){if(this._jumpToSymbolTrackingModeEnabled){this._tokenTrackingController.highlightLastHoveredRange();this._tokenTrackingController.enabled=true;}else{this._tokenTrackingController.removeHighlightedRange();this._tokenTrackingController.enabled=false;}}}
tokenTrackingControllerHighlightedRangeWasClicked(tokenTrackingController)
{let candidate=tokenTrackingController.candidate;if(!candidate)
return;let sourceCodeLocation=null;if(this._style.ownerRule)
sourceCodeLocation=this._style.ownerRule.sourceCodeLocation;let token=candidate.hoveredToken;const options={ignoreNetworkTab:true,ignoreSearchTab:true,};if(token&&/\blink\b/.test(token.type)){let url=token.string;let baseURL=sourceCodeLocation?sourceCodeLocation.sourceCode.url:this._style.node.ownerDocument.documentURL;const frame=null;WebInspector.openURL(absoluteURL(url,baseURL),frame,options);return;}
if(!this._style.ownerRule||!this._style.ownerRule.sourceCodeLocation)
return;if(!sourceCodeLocation)
return;function showRangeInSourceCode(sourceCode,range)
{if(!sourceCode||!range)
return false;WebInspector.showSourceCodeLocation(sourceCode.createSourceCodeLocation(range.startLine,range.startColumn),options);return true;}
if(token&&/\bvariable-2\b/.test(token.type)){let property=this._style.nodeStyles.effectivePropertyForName(token.string);if(property&&showRangeInSourceCode(property.ownerStyle.ownerRule.sourceCodeLocation.sourceCode,property.styleSheetTextRange))
return;}
let marks=this._codeMirror.findMarksAt(candidate.hoveredTokenRange.start);for(let mark of marks){let property=mark.__cssProperty;if(property&&showRangeInSourceCode(sourceCodeLocation.sourceCode,property.styleSheetTextRange))
return;}}
tokenTrackingControllerNewHighlightCandidate(tokenTrackingController,candidate)
{if(!this._style.ownerRule||!this._style.ownerRule.sourceCodeLocation){if(!candidate.hoveredToken||!/\blink\b/.test(candidate.hoveredToken.type))
return;}
this._tokenTrackingController.highlightRange(candidate.hoveredTokenRange);}};WebInspector.CSSStyleDeclarationTextEditor.Event={ContentChanged:"css-style-declaration-text-editor-content-changed",Blurred:"css-style-declaration-text-editor-blurred"};WebInspector.CSSStyleDeclarationTextEditor.PropertyVisibilityMode={ShowAll:Symbol("variable-visibility-show-all"),HideVariables:Symbol("variable-visibility-hide-variables"),HideNonVariables:Symbol("variable-visibility-hide-non-variables"),};WebInspector.CSSStyleDeclarationTextEditor.PrefixWhitespace="\n";WebInspector.CSSStyleDeclarationTextEditor.SuffixWhitespace="\n";WebInspector.CSSStyleDeclarationTextEditor.StyleClassName="css-style-text-editor";WebInspector.CSSStyleDeclarationTextEditor.ReadOnlyStyleClassName="read-only";WebInspector.CSSStyleDeclarationTextEditor.CheckboxPlaceholderElementStyleClassName="checkbox-placeholder";WebInspector.CSSStyleDeclarationTextEditor.EditingLineStyleClassName="editing-line";WebInspector.CSSStyleDeclarationTextEditor.CommitCoalesceDelay=250;WebInspector.CSSStyleDeclarationTextEditor.RemoveEditingLineClassesDelay=2000;WebInspector.CSSStyleDetailsSidebarPanel=class CSSStyleDetailsSidebarPanel extends WebInspector.DOMDetailsSidebarPanel
{constructor()
{const dontCreateNavigationItem=true;super("css-style",WebInspector.UIString("Styles"),dontCreateNavigationItem);this._selectedPanel=null;this._computedStyleDetailsPanel=new WebInspector.ComputedStyleDetailsPanel(this);this._rulesStyleDetailsPanel=new WebInspector.RulesStyleDetailsPanel(this);this._visualStyleDetailsPanel=new WebInspector.VisualStyleDetailsPanel(this);this._panels=[this._computedStyleDetailsPanel,this._rulesStyleDetailsPanel,this._visualStyleDetailsPanel];this._panelNavigationInfo=[this._computedStyleDetailsPanel.navigationInfo,this._rulesStyleDetailsPanel.navigationInfo,this._visualStyleDetailsPanel.navigationInfo];this._lastSelectedPanelSetting=new WebInspector.Setting("last-selected-style-details-panel",this._rulesStyleDetailsPanel.navigationInfo.identifier);this._classListContainerToggledSetting=new WebInspector.Setting("class-list-container-toggled",false);this._initiallySelectedPanel=this._panelMatchingIdentifier(this._lastSelectedPanelSetting.value)||this._rulesStyleDetailsPanel;this._navigationItem=new WebInspector.ScopeRadioButtonNavigationItem(this.identifier,this.displayName,this._panelNavigationInfo,this._initiallySelectedPanel.navigationInfo);this._navigationItem.addEventListener(WebInspector.ScopeRadioButtonNavigationItem.Event.SelectedItemChanged,this._handleSelectedItemChanged,this);this._forcedPseudoClassCheckboxes={};}
supportsDOMNode(nodeToInspect)
{return nodeToInspect.nodeType()===Node.ELEMENT_NODE;}
visibilityDidChange()
{super.visibilityDidChange();if(!this._selectedPanel)
return;if(!this.visible){this._selectedPanel.hidden();return;}
this._updateNoForcedPseudoClassesScrollOffset();this._selectedPanel.shown();this._selectedPanel.markAsNeedsRefresh(this.domNode);}
computedStyleDetailsPanelShowProperty(property)
{this._rulesStyleDetailsPanel.scrollToSectionAndHighlightProperty(property);this._switchPanels(this._rulesStyleDetailsPanel);this._navigationItem.selectedItemIdentifier=this._lastSelectedPanelSetting.value;}
layout()
{let domNode=this.domNode;if(!domNode)
return;this.contentView.element.scrollTop=this._initialScrollOffset;for(let panel of this._panels){panel.element._savedScrollTop=undefined;panel.markAsNeedsRefresh(domNode);}
this._updatePseudoClassCheckboxes();if(!this._classListContainer.hidden)
this._populateClassToggles();}
addEventListeners()
{let effectiveDOMNode=this.domNode.isPseudoElement()?this.domNode.parentNode:this.domNode;if(!effectiveDOMNode)
return;effectiveDOMNode.addEventListener(WebInspector.DOMNode.Event.EnabledPseudoClassesChanged,this._updatePseudoClassCheckboxes,this);effectiveDOMNode.addEventListener(WebInspector.DOMNode.Event.AttributeModified,this._handleNodeAttributeModified,this);effectiveDOMNode.addEventListener(WebInspector.DOMNode.Event.AttributeRemoved,this._handleNodeAttributeRemoved,this);}
removeEventListeners()
{let effectiveDOMNode=this.domNode.isPseudoElement()?this.domNode.parentNode:this.domNode;if(!effectiveDOMNode)
return;effectiveDOMNode.removeEventListener(null,null,this);}
initialLayout()
{if(WebInspector.cssStyleManager.canForcePseudoClasses()){this._forcedPseudoClassContainer=document.createElement("div");this._forcedPseudoClassContainer.className="pseudo-classes";let groupElement=null;WebInspector.CSSStyleManager.ForceablePseudoClasses.forEach(function(pseudoClass){let label=pseudoClass.capitalize();let labelElement=document.createElement("label");let checkboxElement=document.createElement("input");checkboxElement.addEventListener("change",this._forcedPseudoClassCheckboxChanged.bind(this,pseudoClass));checkboxElement.type="checkbox";this._forcedPseudoClassCheckboxes[pseudoClass]=checkboxElement;labelElement.appendChild(checkboxElement);labelElement.append(label);if(!groupElement||groupElement.children.length===2){groupElement=document.createElement("div");groupElement.className="group";this._forcedPseudoClassContainer.appendChild(groupElement);}
groupElement.appendChild(labelElement);},this);this.contentView.element.appendChild(this._forcedPseudoClassContainer);}
this._computedStyleDetailsPanel.addEventListener(WebInspector.StyleDetailsPanel.Event.Refreshed,this._filterDidChange,this);this._rulesStyleDetailsPanel.addEventListener(WebInspector.StyleDetailsPanel.Event.Refreshed,this._filterDidChange,this);this._switchPanels(this._initiallySelectedPanel);this._initiallySelectedPanel=null;let optionsContainer=this.element.createChild("div","options-container");let newRuleButton=optionsContainer.createChild("img","new-rule");newRuleButton.title=WebInspector.UIString("Add new rule");newRuleButton.addEventListener("click",this._newRuleButtonClicked.bind(this));newRuleButton.addEventListener("contextmenu",this._newRuleButtonContextMenu.bind(this));this._filterBar=new WebInspector.FilterBar;this._filterBar.placeholder=WebInspector.UIString("Filter Styles");this._filterBar.addEventListener(WebInspector.FilterBar.Event.FilterDidChange,this._filterDidChange,this);optionsContainer.appendChild(this._filterBar.element);this._classToggleButton=optionsContainer.createChild("button","toggle-class-toggle");this._classToggleButton.textContent=WebInspector.UIString("Classes");this._classToggleButton.title=WebInspector.UIString("Toggle Classes");this._classToggleButton.addEventListener("click",this._classToggleButtonClicked.bind(this));this._classListContainer=this.element.createChild("div","class-list-container");this._classListContainer.hidden=true;this._addClassContainer=this._classListContainer.createChild("div","new-class");this._addClassContainer.title=WebInspector.UIString("Add a Class");this._addClassContainer.addEventListener("click",this._addClassContainerClicked.bind(this));this._addClassInput=this._addClassContainer.createChild("input","class-name-input");this._addClassInput.setAttribute("placeholder",WebInspector.UIString("Enter Class Name"));this._addClassInput.addEventListener("keypress",this._addClassInputKeyPressed.bind(this));this._addClassInput.addEventListener("blur",this._addClassInputBlur.bind(this));WebInspector.cssStyleManager.addEventListener(WebInspector.CSSStyleManager.Event.StyleSheetAdded,this._styleSheetAddedOrRemoved,this);WebInspector.cssStyleManager.addEventListener(WebInspector.CSSStyleManager.Event.StyleSheetRemoved,this._styleSheetAddedOrRemoved,this);if(this._classListContainerToggledSetting.value)
this._classToggleButtonClicked();}
sizeDidChange()
{super.sizeDidChange();this._updateNoForcedPseudoClassesScrollOffset();if(this._selectedPanel)
this._selectedPanel.sizeDidChange();}
get _initialScrollOffset()
{if(!WebInspector.cssStyleManager.canForcePseudoClasses())
return 0;return this.domNode&&this.domNode.enabledPseudoClasses.length?0:WebInspector.CSSStyleDetailsSidebarPanel.NoForcedPseudoClassesScrollOffset;}
_updateNoForcedPseudoClassesScrollOffset()
{if(this._forcedPseudoClassContainer)
WebInspector.CSSStyleDetailsSidebarPanel.NoForcedPseudoClassesScrollOffset=this._forcedPseudoClassContainer.offsetHeight;}
_panelMatchingIdentifier(identifier)
{let selectedPanel=null;for(let panel of this._panels){if(panel.navigationInfo.identifier!==identifier)
continue;selectedPanel=panel;break;}
return selectedPanel;}
_handleSelectedItemChanged()
{let selectedIdentifier=this._navigationItem.selectedItemIdentifier;let selectedPanel=this._panelMatchingIdentifier(selectedIdentifier);this._switchPanels(selectedPanel);}
_switchPanels(selectedPanel)
{if(this._selectedPanel){this._selectedPanel.hidden();this._selectedPanel.element._savedScrollTop=this.contentView.element.scrollTop;this.contentView.removeSubview(this._selectedPanel);}
this._selectedPanel=selectedPanel;if(!this._selectedPanel)
return;this.contentView.addSubview(this._selectedPanel);if(typeof this._selectedPanel.element._savedScrollTop==="number")
this.contentView.element.scrollTop=this._selectedPanel.element._savedScrollTop;else
this.contentView.element.scrollTop=this._initialScrollOffset;let hasFilter=typeof this._selectedPanel.filterDidChange==="function";this.contentView.element.classList.toggle("has-filter-bar",hasFilter);if(this._filterBar)
this.contentView.element.classList.toggle(WebInspector.CSSStyleDetailsSidebarPanel.FilterInProgressClassName,hasFilter&&this._filterBar.hasActiveFilters());this.contentView.element.classList.toggle("supports-new-rule",typeof this._selectedPanel.newRuleButtonClicked==="function");this._selectedPanel.shown();this._lastSelectedPanelSetting.value=selectedPanel.navigationInfo.identifier;}
_forcedPseudoClassCheckboxChanged(pseudoClass,event)
{if(!this.domNode)
return;let effectiveDOMNode=this.domNode.isPseudoElement()?this.domNode.parentNode:this.domNode;effectiveDOMNode.setPseudoClassEnabled(pseudoClass,event.target.checked);}
_updatePseudoClassCheckboxes()
{if(!this.domNode)
return;let effectiveDOMNode=this.domNode.isPseudoElement()?this.domNode.parentNode:this.domNode;let enabledPseudoClasses=effectiveDOMNode.enabledPseudoClasses;for(let pseudoClass in this._forcedPseudoClassCheckboxes){let checkboxElement=this._forcedPseudoClassCheckboxes[pseudoClass];checkboxElement.checked=enabledPseudoClasses.includes(pseudoClass);}}
_handleNodeAttributeModified(event)
{if(event&&event.data&&event.data.name==="class")
this._populateClassToggles();}
_handleNodeAttributeRemoved(event)
{if(event&&event.data&&event.data.name==="class")
this._populateClassToggles();}
_newRuleButtonClicked()
{if(this._selectedPanel&&typeof this._selectedPanel.newRuleButtonClicked==="function")
this._selectedPanel.newRuleButtonClicked();}
_newRuleButtonContextMenu(event)
{if(this._selectedPanel&&typeof this._selectedPanel.newRuleButtonContextMenu==="function")
this._selectedPanel.newRuleButtonContextMenu(event);}
_classToggleButtonClicked(event)
{this._classToggleButton.classList.toggle("selected");this._classListContainer.hidden=!this._classListContainer.hidden;this._classListContainerToggledSetting.value=!this._classListContainer.hidden;if(this._classListContainer.hidden)
return;this._populateClassToggles();}
_addClassContainerClicked(event)
{this._addClassContainer.classList.add("active");this._addClassInput.focus();}
_addClassInputKeyPressed(event)
{if(event.keyCode!==WebInspector.KeyboardShortcut.Key.Enter.keyCode)
return;this._addClassInput.blur();}
_addClassInputBlur(event)
{this.domNode.toggleClass(this._addClassInput.value,true);this._addClassContainer.classList.remove("active");this._addClassInput.value=null;}
_populateClassToggles()
{while(this._classListContainer.children.length>1)
this._classListContainer.children[1].remove();let classes=this.domNode.getAttribute("class");let classToggledMap=this.domNode[WebInspector.CSSStyleDetailsSidebarPanel.ToggledClassesSymbol];if(!classToggledMap)
classToggledMap=this.domNode[WebInspector.CSSStyleDetailsSidebarPanel.ToggledClassesSymbol]=new Map;if(classes&&classes.length){for(let className of classes.split(/\s+/))
classToggledMap.set(className,true);}
for(let[className,toggled]of classToggledMap){if((toggled&&!classes.includes(className))||(!toggled&&classes.includes(className))){toggled=!toggled;classToggledMap.set(className,toggled);}
this._createToggleForClassName(className);}}
_createToggleForClassName(className)
{if(!className||!className.length)
return;let classToggledMap=this.domNode[WebInspector.CSSStyleDetailsSidebarPanel.ToggledClassesSymbol];if(!classToggledMap)
return;if(!classToggledMap.has(className))
classToggledMap.set(className,true);let toggled=classToggledMap.get(className);let classNameContainer=document.createElement("div");classNameContainer.classList.add("class-toggle");let classNameToggle=classNameContainer.createChild("input");classNameToggle.type="checkbox";classNameToggle.checked=toggled;let classNameTitle=classNameContainer.createChild("span");classNameTitle.textContent=className;classNameTitle.draggable=true;classNameTitle.addEventListener("dragstart",(event)=>{event.dataTransfer.setData(WebInspector.CSSStyleDetailsSidebarPanel.ToggledClassesDragType,className);event.dataTransfer.effectAllowed="copy";});let classNameToggleChanged=(event)=>{this.domNode.toggleClass(className,classNameToggle.checked);classToggledMap.set(className,classNameToggle.checked);};classNameToggle.addEventListener("click",classNameToggleChanged);classNameTitle.addEventListener("click",(event)=>{classNameToggle.checked=!classNameToggle.checked;classNameToggleChanged();});this._classListContainer.appendChild(classNameContainer);}
_filterDidChange()
{this.contentView.element.classList.toggle(WebInspector.CSSStyleDetailsSidebarPanel.FilterInProgressClassName,this._filterBar.hasActiveFilters());this._selectedPanel.filterDidChange(this._filterBar);}
_styleSheetAddedOrRemoved()
{this.needsLayout();}};WebInspector.CSSStyleDetailsSidebarPanel.NoForcedPseudoClassesScrollOffset=30;WebInspector.CSSStyleDetailsSidebarPanel.FilterInProgressClassName="filter-in-progress";WebInspector.CSSStyleDetailsSidebarPanel.FilterMatchingSectionHasLabelClassName="filter-section-has-label";WebInspector.CSSStyleDetailsSidebarPanel.FilterMatchSectionClassName="filter-matching";WebInspector.CSSStyleDetailsSidebarPanel.NoFilterMatchInSectionClassName="filter-section-non-matching";WebInspector.CSSStyleDetailsSidebarPanel.NoFilterMatchInPropertyClassName="filter-property-non-matching";WebInspector.CSSStyleDetailsSidebarPanel.ToggledClassesSymbol=Symbol("css-style-details-sidebar-panel-toggled-classes-symbol");WebInspector.CSSStyleDetailsSidebarPanel.ToggledClassesDragType="text/classname";WebInspector.CSSStyleSheetTreeElement=class CSSStyleSheetTreeElement extends WebInspector.SourceCodeTreeElement
{constructor(styleSheet)
{const classNames=["stylesheet","stylesheet-icon"];const title=WebInspector.UIString("Inspector Style Sheet");const subtitle=null;const hasChildren=false;super(styleSheet,classNames,title,subtitle,styleSheet,hasChildren);}};WebInspector.CallFrameTreeElement=class CallFrameTreeElement extends WebInspector.GeneralTreeElement
{constructor(callFrame,isAsyncBoundaryCallFrame)
{let className=WebInspector.CallFrameView.iconClassNameForCallFrame(callFrame);let title=callFrame.functionName||WebInspector.UIString("(anonymous function)");super(["call-frame",className],title,null,callFrame,false);this._callFrame=callFrame;this._isActiveCallFrame=false;if(isAsyncBoundaryCallFrame){this.addClassName("async-boundary");this.selectable=false;}
if(this._callFrame.nativeCode||!this._callFrame.sourceCodeLocation){this.subtitle="";return;}
let displayScriptURL=this._callFrame.sourceCodeLocation.displaySourceCode.url;if(displayScriptURL){this.subtitle=document.createElement("span");this._callFrame.sourceCodeLocation.populateLiveDisplayLocationString(this.subtitle,"textContent");this.tooltipHandledSeparately=true;}}
get callFrame(){return this._callFrame;}
get isActiveCallFrame(){return this._isActiveCallFrame;}
set isActiveCallFrame(x)
{if(this._isActiveCallFrame===x)
return;this._isActiveCallFrame=x;this._updateStatus();}
onattach()
{super.onattach();if(this.tooltipHandledSeparately){let tailCallSuffix="";if(this._callFrame.isTailDeleted)
tailCallSuffix=" "+WebInspector.UIString("(Tail Call)");let tooltipPrefix=this.mainTitle+tailCallSuffix+"\n";this._callFrame.sourceCodeLocation.populateLiveDisplayLocationTooltip(this.element,tooltipPrefix);}
this._updateStatus();}
_updateStatus()
{if(!this.element)
return;if(!this._isActiveCallFrame){this.status=null;return;}
if(!this._statusImageElement)
this._statusImageElement=useSVGSymbol("Images/ActiveCallFrame.svg","status-image");this.status=this._statusImageElement;}};WebInspector.CallFrameView=class CallFrameView extends WebInspector.Object
{constructor(callFrame,showFunctionName)
{var callFrameElement=document.createElement("div");callFrameElement.classList.add("call-frame",WebInspector.CallFrameView.iconClassNameForCallFrame(callFrame));var subtitleElement=document.createElement("span");subtitleElement.classList.add("subtitle");var sourceCodeLocation=callFrame.sourceCodeLocation;if(sourceCodeLocation){WebInspector.linkifyElement(callFrameElement,sourceCodeLocation);var linkElement=document.createElement("a");linkElement.classList.add("source-link");linkElement.href=sourceCodeLocation.sourceCode.url;if(showFunctionName){var separatorElement=document.createElement("span");separatorElement.classList.add("separator");separatorElement.textContent=" — ";subtitleElement.append(separatorElement);}
subtitleElement.append(linkElement);sourceCodeLocation.populateLiveDisplayLocationTooltip(linkElement);sourceCodeLocation.populateLiveDisplayLocationString(linkElement,"textContent");}
var titleElement=document.createElement("span");titleElement.classList.add("title");if(showFunctionName){var imgElement=document.createElement("img");imgElement.classList.add("icon");titleElement.append(imgElement,callFrame.functionName||WebInspector.UIString("(anonymous function)"));}
callFrameElement.append(titleElement,subtitleElement);return callFrameElement;}
static iconClassNameForCallFrame(callFrame)
{if(callFrame.isTailDeleted)
return WebInspector.CallFrameView.TailDeletedIcon;if(callFrame.programCode)
return WebInspector.CallFrameView.ProgramIconStyleClassName;
if(callFrame.functionName&&callFrame.functionName.startsWith("on")&&callFrame.functionName.length>=5)
return WebInspector.CallFrameView.EventListenerIconStyleClassName;if(callFrame.nativeCode)
return WebInspector.CallFrameView.NativeIconStyleClassName;return WebInspector.CallFrameView.FunctionIconStyleClassName;}};WebInspector.CallFrameView.ProgramIconStyleClassName="program-icon";WebInspector.CallFrameView.FunctionIconStyleClassName="function-icon";WebInspector.CallFrameView.EventListenerIconStyleClassName="event-listener-icon";WebInspector.CallFrameView.NativeIconStyleClassName="native-icon";WebInspector.CallFrameView.TailDeletedIcon="tail-deleted";WebInspector.CanvasContentView=class CanvasContentView extends WebInspector.ContentView
{constructor(representedObject)
{super(representedObject);this.element.classList.add("canvas");this._previewContainerElement=null;this._previewImageElement=null;this._errorElement=null;this._refreshButtonNavigationItem=new WebInspector.ButtonNavigationItem("canvas-refresh",WebInspector.UIString("Refresh"),"Images/ReloadFull.svg",13,13);this._refreshButtonNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,this._showPreview,this);this._showGridButtonNavigationItem=new WebInspector.ActivateButtonNavigationItem("show-grid",WebInspector.UIString("Show Grid"),WebInspector.UIString("Hide Grid"),"Images/NavigationItemCheckers.svg",13,13);this._showGridButtonNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,this._showGridButtonClicked,this);this._showGridButtonNavigationItem.activated=!!WebInspector.settings.showImageGrid.value;}
get navigationItems()
{return[this._refreshButtonNavigationItem,this._showGridButtonNavigationItem];}
shown()
{super.shown();this._showPreview();WebInspector.settings.showImageGrid.addEventListener(WebInspector.Setting.Event.Changed,this._updateImageGrid,this);}
hidden()
{WebInspector.settings.showImageGrid.removeEventListener(WebInspector.Setting.Event.Changed,this._updateImageGrid,this);super.hidden();}
_showPreview()
{let showError=()=>{if(this._previewContainerElement)
this._previewContainerElement.remove();if(!this._errorElement){const isError=true;this._errorElement=WebInspector.createMessageTextView(WebInspector.UIString("No Preview Available"),isError);}
this.element.appendChild(this._errorElement);};if(!this._previewContainerElement){this._previewContainerElement=this.element.appendChild(document.createElement("div"));this._previewContainerElement.classList.add("preview");}
this.representedObject.requestContent((content)=>{if(!content){showError();return;}
if(this._errorElement)
this._errorElement.remove();if(!this._previewImageElement){this._previewImageElement=document.createElement("img");this._previewImageElement.addEventListener("error",showError);}
this._previewImageElement.src=content;this._previewContainerElement.appendChild(this._previewImageElement);this._updateImageGrid();});}
_updateImageGrid()
{if(!this._previewImageElement)
return;let activated=WebInspector.settings.showImageGrid.value;this._showGridButtonNavigationItem.activated=activated;this._previewImageElement.classList.toggle("show-grid",activated);}
_showGridButtonClicked(event)
{WebInspector.settings.showImageGrid.value=!this._showGridButtonNavigationItem.activated;this._updateImageGrid();}};WebInspector.CanvasDetailsSidebarPanel=class CanvasDetailsSidebarPanel extends WebInspector.DetailsSidebarPanel
{constructor()
{super("canvas",WebInspector.UIString("Canvas"));this.element.classList.add("canvas");this._canvas=null;this._node=null;}
inspect(objects)
{if(!(objects instanceof Array))
objects=[objects];this.canvas=objects.find((object)=>object instanceof WebInspector.Canvas);return!!this._canvas;}
get canvas()
{return this._canvas;}
set canvas(canvas)
{if(canvas===this._canvas)
return;if(this._node){this._node.removeEventListener(WebInspector.DOMNode.Event.AttributeModified,this._refreshSourceSection,this);this._node.removeEventListener(WebInspector.DOMNode.Event.AttributeRemoved,this._refreshSourceSection,this);this._node=null;}
if(this._canvas){this._canvas.removeEventListener(WebInspector.Canvas.Event.MemoryChanged,this._canvasMemoryChanged,this);this._canvas.removeEventListener(WebInspector.Canvas.Event.CSSCanvasClientNodesChanged,this._refreshCSSCanvasSection,this);}
this._canvas=canvas||null;if(this._canvas){this._canvas.addEventListener(WebInspector.Canvas.Event.MemoryChanged,this._canvasMemoryChanged,this);this._canvas.addEventListener(WebInspector.Canvas.Event.CSSCanvasClientNodesChanged,this._refreshCSSCanvasSection,this);}
this.needsLayout();}
initialLayout()
{super.initialLayout();this._nameRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Name"));this._typeRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Type"));this._memoryRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Memory"));this._memoryRow.tooltip=WebInspector.UIString("Memory usage of this canvas");let identitySection=new WebInspector.DetailsSection("canvas-details",WebInspector.UIString("Identity"));identitySection.groups=[new WebInspector.DetailsSectionGroup([this._nameRow,this._typeRow,this._memoryRow])];this.contentView.element.appendChild(identitySection.element);this._nodeRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Node"));this._cssCanvasRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("CSS Canvas"));this._widthRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Width"));this._heightRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Height"));this._datachedRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Detached"));let sourceSection=new WebInspector.DetailsSection("canvas-source",WebInspector.UIString("Source"));sourceSection.groups=[new WebInspector.DetailsSectionGroup([this._nodeRow,this._cssCanvasRow,this._widthRow,this._heightRow,this._datachedRow])];this.contentView.element.appendChild(sourceSection.element);this._attributesDataGridRow=new WebInspector.DetailsSectionDataGridRow(null,WebInspector.UIString("No Attributes"));let attributesSection=new WebInspector.DetailsSection("canvas-attributes",WebInspector.UIString("Attributes"));attributesSection.groups=[new WebInspector.DetailsSectionGroup([this._attributesDataGridRow])];this.contentView.element.appendChild(attributesSection.element);this._cssCanvasClientsRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Nodes"));this._cssCanvasSection=new WebInspector.DetailsSection("canvas-css",WebInspector.UIString("CSS"));this._cssCanvasSection.groups=[new WebInspector.DetailsSectionGroup([this._cssCanvasClientsRow])];this._cssCanvasSection.element.hidden=true;this.contentView.element.appendChild(this._cssCanvasSection.element);}
layout()
{super.layout();if(!this._canvas)
return;this._refreshIdentitySection();this._refreshSourceSection();this._refreshAttributesSection();this._refreshCSSCanvasSection();}
sizeDidChange()
{super.sizeDidChange(); this._attributesDataGridRow.sizeDidChange();}
_refreshIdentitySection()
{if(!this._canvas)
return;this._nameRow.value=this._canvas.displayName;this._typeRow.value=WebInspector.Canvas.displayNameForContextType(this._canvas.contextType);this._formatMemoryRow();}
_refreshSourceSection()
{if(!this._canvas)
return;this._nodeRow.value=this._canvas.cssCanvasName?null:emDash;this._cssCanvasRow.value=this._canvas.cssCanvasName||null;this._widthRow.value=emDash;this._heightRow.value=emDash;this._datachedRow.value=null;this._canvas.requestNode((node)=>{if(!node)
return;if(node!==this._node){if(this._node){this._node.removeEventListener(WebInspector.DOMNode.Event.AttributeModified,this._refreshSourceSection,this);this._node.removeEventListener(WebInspector.DOMNode.Event.AttributeRemoved,this._refreshSourceSection,this);this._node=null;}
this._node=node;this._node.addEventListener(WebInspector.DOMNode.Event.AttributeModified,this._refreshSourceSection,this);this._node.addEventListener(WebInspector.DOMNode.Event.AttributeRemoved,this._refreshSourceSection,this);}
if(!this._canvas.cssCanvasName)
this._nodeRow.value=WebInspector.linkifyNodeReference(this._node);let setRowValueIfValidAttributeValue=(row,attribute)=>{let value=Number(this._node.getAttribute(attribute));if(!Number.isInteger(value)||value<0)
return false;row.value=value;return true;};let validWidth=setRowValueIfValidAttributeValue(this._widthRow,"width");let validHeight=setRowValueIfValidAttributeValue(this._heightRow,"height");if(!validWidth||!validHeight){
WebInspector.RemoteObject.resolveNode(node,"",(remoteObject)=>{if(!remoteObject)
return;function setRowValueToPropertyValue(row,property){remoteObject.getProperty(property,(error,result,wasThrown)=>{if(!error&&result.type==="number")
row.value=`${result.value}px`;});}
setRowValueToPropertyValue(this._widthRow,"width");setRowValueToPropertyValue(this._heightRow,"height");remoteObject.release();});}
if(!this._canvas.cssCanvasName&&!this._node.parentNode)
this._datachedRow.value=WebInspector.UIString("Yes");});}
_refreshAttributesSection()
{if(!this._canvas)
return;if(isEmptyObject(this._canvas.contextAttributes)){this._attributesDataGridRow.dataGrid=null;return;}
let dataGrid=this._attributesDataGridRow.dataGrid;if(!dataGrid){dataGrid=this._attributesDataGridRow.dataGrid=new WebInspector.DataGrid({name:{title:WebInspector.UIString("Name")},value:{title:WebInspector.UIString("Value"),width:"30%"},});}
dataGrid.removeChildren();for(let attribute in this._canvas.contextAttributes){let data={name:attribute,value:this._canvas.contextAttributes[attribute]};let dataGridNode=new WebInspector.DataGridNode(data);dataGrid.appendChild(dataGridNode);}
dataGrid.updateLayoutIfNeeded();}
_refreshCSSCanvasSection()
{if(!this._canvas)
return;if(!this._canvas.cssCanvasName){this._cssCanvasSection.element.hidden=true;return;}
this._cssCanvasClientsRow.value=emDash;this._cssCanvasSection.element.hidden=false;this._canvas.requestCSSCanvasClientNodes((cssCanvasClientNodes)=>{if(!cssCanvasClientNodes.length)
return;let fragment=document.createDocumentFragment();for(let clientNode of cssCanvasClientNodes)
fragment.appendChild(WebInspector.linkifyNodeReference(clientNode));this._cssCanvasClientsRow.value=fragment;});}
_formatMemoryRow()
{if(!this._canvas.memoryCost||isNaN(this._canvas.memoryCost)){this._memoryRow.value=emDash;return;}
this._memoryRow.value=Number.bytesToString(this._canvas.memoryCost);}
_canvasMemoryChanged(event)
{this._formatMemoryRow();}};WebInspector.CanvasTreeElement=class CanvasTreeElement extends WebInspector.GeneralTreeElement
{constructor(representedObject)
{const subtitle=null;super(["canvas",representedObject.contextType],representedObject.displayName,subtitle,representedObject);}
onattach()
{super.onattach();this.element.addEventListener("mouseover",this._handleMouseOver.bind(this));this.element.addEventListener("mouseout",this._handleMouseOut.bind(this));}
populateContextMenu(contextMenu,event)
{super.populateContextMenu(contextMenu,event);contextMenu.appendItem(WebInspector.UIString("Log Canvas Context"),()=>{WebInspector.RemoteObject.resolveCanvasContext(this.representedObject,WebInspector.RuntimeManager.ConsoleObjectGroup,(remoteObject)=>{if(!remoteObject)
return;const text=WebInspector.UIString("Selected Canvas Context");const addSpecialUserLogClass=true;WebInspector.consoleLogViewController.appendImmediateExecutionWithResult(text,remoteObject,addSpecialUserLogClass);});});contextMenu.appendSeparator();}
_handleMouseOver(event)
{if(this.representedObject.cssCanvasName){this.representedObject.requestCSSCanvasClientNodes((cssCanvasClientNodes)=>{WebInspector.domTreeManager.highlightDOMNodeList(cssCanvasClientNodes.map((node)=>node.id),"all");});}else{this.representedObject.requestNode((node)=>{if(!node||!node.ownerDocument)
return;WebInspector.domTreeManager.highlightDOMNode(node.id,"all");});}}
_handleMouseOut(event)
{WebInspector.domTreeManager.hideDOMNodeHighlight();}};WebInspector.ChartDetailsSectionRow=class ChartDetailsSectionRow extends WebInspector.DetailsSectionRow
{constructor(delegate,chartSize,innerRadiusRatio)
{super(WebInspector.UIString("No Chart Available"));innerRadiusRatio=innerRadiusRatio||0;this.element.classList.add("chart");this._titleElement=document.createElement("div");this._titleElement.className="title";this.element.appendChild(this._titleElement);let chartContentElement=document.createElement("div");chartContentElement.className="chart-content";this.element.appendChild(chartContentElement);this._chartElement=createSVGElement("svg");chartContentElement.appendChild(this._chartElement);this._legendElement=document.createElement("div");this._legendElement.className="legend";chartContentElement.appendChild(this._legendElement);this._delegate=delegate;this._items=new Map;this._title="";this._chartSize=chartSize;this._radius=(this._chartSize/2)-1;this._innerRadius=innerRadiusRatio?Math.floor(this._radius*innerRadiusRatio):0;this._total=0;this._svgFiltersElement=document.createElement("svg");this._svgFiltersElement.classList.add("defs-only");this.element.append(this._svgFiltersElement);this._checkboxStyleElement=document.createElement("style");this._checkboxStyleElement.id="checkbox-styles";document.getElementsByTagName("head")[0].append(this._checkboxStyleElement);function createEmptyChartPathData(c,r1,r2)
{const a1=0;const a2=Math.PI*1.9999;let x1=c+Math.cos(a1)*r1,y1=c+Math.sin(a1)*r1,x2=c+Math.cos(a2)*r1,y2=c+Math.sin(a2)*r1,x3=c+Math.cos(a2)*r2,y3=c+Math.sin(a2)*r2,x4=c+Math.cos(a1)*r2,y4=c+Math.sin(a1)*r2;return["M",x1,y1,"A",r1,r1,0,1,1,x2,y2,"Z","M",x3,y3,"A",r2,r2,0,1,0,x4,y4,"Z"].join(" ");}
this._emptyChartPath=createSVGElement("path");this._emptyChartPath.setAttribute("d",createEmptyChartPathData(this._chartSize/2,this._radius,this._innerRadius));this._emptyChartPath.classList.add("empty-chart");this._chartElement.appendChild(this._emptyChartPath);}
get chartSize()
{return this._chartSize;}
set title(title)
{if(this._title===title)
return;this._title=title;this._titleElement.textContent=title;}
get total()
{return this._total;}
addItem(id,label,value,color,checkbox,checked)
{if(this._items.has(id))
return;if(value<0)
return;this._items.set(id,{label,value,color,checkbox,checked});this._total+=value;this._needsLayout();}
setItemValue(id,value)
{let item=this._items.get(id);if(!item)
return;if(value<0)
return;if(item.value===value)
return;this._total+=value-item.value;item.value=value;this._needsLayout();}
clearItems()
{for(let item of this._items.values()){let path=item[WebInspector.ChartDetailsSectionRow.ChartSegmentPathSymbol];if(path)
path.remove();}
this._total=0;this._items.clear();this._needsLayout();}
_addCheckboxColorFilter(id,r,g,b)
{for(let i=0;i<this._svgFiltersElement.childNodes.length;++i){if(this._svgFiltersElement.childNodes[i].id===id)
return;}
r/=255;b/=255;g/=255;let filterElement=createSVGElement("filter");filterElement.id=id;filterElement.setAttribute("color-interpolation-filters","sRGB");let values=[1-r,0,0,0,r,1-g,0,0,0,g,1-b,0,0,0,b,0,0,0,1,0];let colorMatrixPrimitive=createSVGElement("feColorMatrix");colorMatrixPrimitive.setAttribute("type","matrix");colorMatrixPrimitive.setAttribute("values",values.join(" "));function createGammaPrimitive(tagName,value)
{let gammaPrimitive=createSVGElement(tagName);gammaPrimitive.setAttribute("type","gamma");gammaPrimitive.setAttribute("exponent",value);return gammaPrimitive;}
let componentTransferPrimitive=createSVGElement("feComponentTransfer");componentTransferPrimitive.append(createGammaPrimitive("feFuncR",1.4),createGammaPrimitive("feFuncG",1.4),createGammaPrimitive("feFuncB",1.4));filterElement.append(colorMatrixPrimitive,componentTransferPrimitive);this._svgFiltersElement.append(filterElement);let styleSheet=this._checkboxStyleElement.sheet;styleSheet.insertRule(".details-section > .content > .group > .row.chart > .chart-content > .legend > .legend-item > label > input[type=checkbox]."+id+" { filter: grayscale(1) url(#"+id+") }",0);}
_updateLegend()
{if(!this._items.size){this._legendElement.removeChildren();return;}
function formatItemValue(item)
{if(this._delegate&&typeof this._delegate.formatChartValue==="function")
return this._delegate.formatChartValue(item.value);return item.value;}
for(let[id,item]of this._items){if(item[WebInspector.ChartDetailsSectionRow.LegendItemValueElementSymbol]){let valueElement=item[WebInspector.ChartDetailsSectionRow.LegendItemValueElementSymbol];valueElement.textContent=formatItemValue.call(this,item);continue;}
let labelElement=document.createElement("label");let keyElement;if(item.checkbox){let className=id.toLowerCase();let rgb=item.color.substring(4,item.color.length-1).replace(/ /g,"").split(",");if(rgb[0]===rgb[1]&&rgb[1]===rgb[2])
rgb[0]=rgb[1]=rgb[2]=Math.min(160,rgb[0]);keyElement=document.createElement("input");keyElement.type="checkbox";keyElement.classList.add(className);keyElement.checked=item.checked;keyElement[WebInspector.ChartDetailsSectionRow.DataItemIdSymbol]=id;keyElement.addEventListener("change",this._legendItemCheckboxValueChanged.bind(this));this._addCheckboxColorFilter(className,rgb[0],rgb[1],rgb[2]);}else{keyElement=document.createElement("div");keyElement.classList.add("color-key");keyElement.style.backgroundColor=item.color;}
labelElement.append(keyElement,item.label);let valueElement=document.createElement("div");valueElement.classList.add("value");valueElement.textContent=formatItemValue.call(this,item);item[WebInspector.ChartDetailsSectionRow.LegendItemValueElementSymbol]=valueElement;let legendItemElement=document.createElement("div");legendItemElement.classList.add("legend-item");legendItemElement.append(labelElement,valueElement);this._legendElement.append(legendItemElement);}}
_legendItemCheckboxValueChanged(event)
{let checkbox=event.target;let id=checkbox[WebInspector.ChartDetailsSectionRow.DataItemIdSymbol];this.dispatchEventToListeners(WebInspector.ChartDetailsSectionRow.Event.LegendItemChecked,{id,checked:checkbox.checked});}
_needsLayout()
{if(this._scheduledLayoutUpdateIdentifier)
return;this._scheduledLayoutUpdateIdentifier=requestAnimationFrame(this._updateLayout.bind(this));}
_updateLayout()
{if(this._scheduledLayoutUpdateIdentifier){cancelAnimationFrame(this._scheduledLayoutUpdateIdentifier);this._scheduledLayoutUpdateIdentifier=undefined;}
this._updateLegend();this._chartElement.setAttribute("width",this._chartSize);this._chartElement.setAttribute("height",this._chartSize);this._chartElement.setAttribute("viewbox","0 0 "+this._chartSize+" "+this._chartSize);function createSegmentPathData(c,a1,a2,r1,r2)
{const largeArcFlag=((a2-a1)%(Math.PI*2))>Math.PI?1:0;let x1=c+Math.cos(a1)*r1,y1=c+Math.sin(a1)*r1,x2=c+Math.cos(a2)*r1,y2=c+Math.sin(a2)*r1,x3=c+Math.cos(a2)*r2,y3=c+Math.sin(a2)*r2,x4=c+Math.cos(a1)*r2,y4=c+Math.sin(a1)*r2;return["M",x1,y1,"A",r1,r1,0,largeArcFlag,1,x2,y2,"L",x3,y3,"A",r2,r2,0,largeArcFlag,0,x4,y4,"Z"].join(" ");}
const minimumDisplayValue=this._total*0.015;let items=[];for(let item of this._items.values()){item.displayValue=item.value?Math.max(minimumDisplayValue,item.value):0;if(item.displayValue)
items.push(item);}
if(items.length>1){items.sort(function(a,b){return a.value-b.value;});let largeItemCount=items.length;let totalAdjustedValue=0;for(let item of items){if(item.value<minimumDisplayValue){totalAdjustedValue+=minimumDisplayValue-item.value;largeItemCount--;continue;}
if(!totalAdjustedValue||!largeItemCount)
break;const donatedValue=totalAdjustedValue/largeItemCount;if(item.displayValue-donatedValue>=minimumDisplayValue){item.displayValue-=donatedValue;totalAdjustedValue-=donatedValue;}
largeItemCount--;}}
const center=this._chartSize/2;let startAngle=-Math.PI/2;let endAngle=0;for(let[id,item]of this._items){let path=item[WebInspector.ChartDetailsSectionRow.ChartSegmentPathSymbol];if(!path){path=createSVGElement("path");path.classList.add("chart-segment");path.setAttribute("fill",item.color);this._chartElement.appendChild(path);item[WebInspector.ChartDetailsSectionRow.ChartSegmentPathSymbol]=path;}
if(!item.value){path.classList.add("hidden");continue;}
const angle=(item.displayValue/this._total)*Math.PI*2;endAngle=startAngle+angle;path.setAttribute("d",createSegmentPathData(center,startAngle,endAngle,this._radius,this._innerRadius));path.classList.remove("hidden");startAngle=endAngle;}}};WebInspector.ChartDetailsSectionRow.DataItemIdSymbol=Symbol("chart-details-section-row-data-item-id");WebInspector.ChartDetailsSectionRow.ChartSegmentPathSymbol=Symbol("chart-details-section-row-chart-segment-path");WebInspector.ChartDetailsSectionRow.LegendItemValueElementSymbol=Symbol("chart-details-section-row-legend-item-value-element");WebInspector.ChartDetailsSectionRow.Event={LegendItemChecked:"chart-details-section-row-legend-item-checked"};
WebInspector.CircleChart=class CircleChart
{constructor({size,innerRadiusRatio})
{this._data=[];this._size=size;this._radius=(size/2)-1;this._innerRadius=innerRadiusRatio?Math.floor(this._radius*innerRadiusRatio):0;this._element=document.createElement("div");this._element.classList.add("circle-chart");this._chartElement=this._element.appendChild(createSVGElement("svg"));this._chartElement.setAttribute("width",size);this._chartElement.setAttribute("height",size);this._chartElement.setAttribute("viewbox",`0 0 ${size} ${size}`);this._pathElements=[];this._values=[];this._total=0;let backgroundPath=this._chartElement.appendChild(createSVGElement("path"));backgroundPath.setAttribute("d",this._createCompleteCirclePathData(this.size/2,this._radius,this._innerRadius));backgroundPath.classList.add("background");}
get element(){return this._element;}
get points(){return this._points;}
get size(){return this._size;}
get centerElement()
{if(!this._centerElement){this._centerElement=this._element.appendChild(document.createElement("div"));this._centerElement.classList.add("center");this._centerElement.style.width=this._centerElement.style.height=this._radius+"px";this._centerElement.style.top=this._centerElement.style.left=(this._radius-this._innerRadius)+"px";}
return this._centerElement;}
get segments()
{return this._segments;}
set segments(segmentClassNames)
{for(let pathElement of this._pathElements)
pathElement.remove();this._pathElements=[];for(let className of segmentClassNames){let pathElement=this._chartElement.appendChild(createSVGElement("path"));pathElement.classList.add("segment",className);this._pathElements.push(pathElement);}}
get values()
{return this._values;}
set values(values)
{this._values=values;this._total=0;for(let value of values)
this._total+=value;}
clear()
{this.values=new Array(this._values.length).fill(0);}
needsLayout()
{if(this._scheduledLayoutUpdateIdentifier)
return;this._scheduledLayoutUpdateIdentifier=requestAnimationFrame(this.updateLayout.bind(this));}
updateLayout()
{if(this._scheduledLayoutUpdateIdentifier){cancelAnimationFrame(this._scheduledLayoutUpdateIdentifier);this._scheduledLayoutUpdateIdentifier=undefined;}
if(!this._values.length)
return;const center=this._size/2;let startAngle=-Math.PI/2;let endAngle=0;for(let i=0;i<this._values.length;++i){let value=this._values[i];let pathElement=this._pathElements[i];if(value===0)
pathElement.removeAttribute("d");else if(value===this._total)
pathElement.setAttribute("d",this._createCompleteCirclePathData(center,this._radius,this._innerRadius));else{let angle=(value/this._total)*Math.PI*2;endAngle=startAngle+angle;pathElement.setAttribute("d",this._createSegmentPathData(center,startAngle,endAngle,this._radius,this._innerRadius));startAngle=endAngle;}}}
_createCompleteCirclePathData(c,r1,r2)
{const a1=0;const a2=Math.PI*1.9999;let x1=c+Math.cos(a1)*r1,y1=c+Math.sin(a1)*r1,x2=c+Math.cos(a2)*r1,y2=c+Math.sin(a2)*r1,x3=c+Math.cos(a2)*r2,y3=c+Math.sin(a2)*r2,x4=c+Math.cos(a1)*r2,y4=c+Math.sin(a1)*r2;return["M",x1,y1,"A",r1,r1,0,1,1,x2,y2,"Z","M",x3,y3,"A",r2,r2,0,1,0,x4,y4,"Z"].join(" ");}
_createSegmentPathData(c,a1,a2,r1,r2)
{const largeArcFlag=((a2-a1)%(Math.PI*2))>Math.PI?1:0;let x1=c+Math.cos(a1)*r1,y1=c+Math.sin(a1)*r1,x2=c+Math.cos(a2)*r1,y2=c+Math.sin(a2)*r1,x3=c+Math.cos(a2)*r2,y3=c+Math.sin(a2)*r2,x4=c+Math.cos(a1)*r2,y4=c+Math.sin(a1)*r2;return["M",x1,y1,"A",r1,r1,0,largeArcFlag,1,x2,y2,"L",x3,y3,"A",r2,r2,0,largeArcFlag,0,x4,y4,"Z"].join(" ");}};WebInspector.ClusterContentView=class ClusterContentView extends WebInspector.ContentView
{constructor(representedObject)
{super(representedObject);this.element.classList.add("cluster");this._contentViewContainer=new WebInspector.ContentViewContainer;this._contentViewContainer.addEventListener(WebInspector.ContentViewContainer.Event.CurrentContentViewDidChange,this._currentContentViewDidChange,this);this.addSubview(this._contentViewContainer);WebInspector.ContentView.addEventListener(WebInspector.ContentView.Event.SelectionPathComponentsDidChange,this._contentViewSelectionPathComponentDidChange,this);WebInspector.ContentView.addEventListener(WebInspector.ContentView.Event.SupplementalRepresentedObjectsDidChange,this._contentViewSupplementalRepresentedObjectsDidChange,this);WebInspector.ContentView.addEventListener(WebInspector.ContentView.Event.NumberOfSearchResultsDidChange,this._contentViewNumberOfSearchResultsDidChange,this);}
get navigationItems()
{var currentContentView=this._contentViewContainer.currentContentView;return currentContentView?currentContentView.navigationItems:[];}
get contentViewContainer()
{return this._contentViewContainer;}
get supportsSplitContentBrowser()
{if(this._contentViewContainer.currentContentView)
return this._contentViewContainer.currentContentView.supportsSplitContentBrowser;return super.supportsSplitContentBrowser;}
shown()
{super.shown();this._contentViewContainer.shown();}
hidden()
{super.hidden();this._contentViewContainer.hidden();}
closed()
{super.closed();this._contentViewContainer.closeAllContentViews();WebInspector.ContentView.removeEventListener(null,null,this);}
canGoBack()
{return this._contentViewContainer.canGoBack();}
canGoForward()
{return this._contentViewContainer.canGoForward();}
goBack()
{this._contentViewContainer.goBack();}
goForward()
{this._contentViewContainer.goForward();}
get scrollableElements()
{if(!this._contentViewContainer.currentContentView)
return[];return this._contentViewContainer.currentContentView.scrollableElements;}
get selectionPathComponents()
{if(!this._contentViewContainer.currentContentView)
return[];return this._contentViewContainer.currentContentView.selectionPathComponents;}
get supplementalRepresentedObjects()
{if(!this._contentViewContainer.currentContentView)
return[];return this._contentViewContainer.currentContentView.supplementalRepresentedObjects;}
get handleCopyEvent()
{var currentContentView=this._contentViewContainer.currentContentView;return currentContentView&&typeof currentContentView.handleCopyEvent==="function"?currentContentView.handleCopyEvent.bind(currentContentView):null;}
get supportsSave()
{var currentContentView=this._contentViewContainer.currentContentView;return currentContentView&&currentContentView.supportsSave;}
get saveData()
{var currentContentView=this._contentViewContainer.currentContentView;return currentContentView&&currentContentView.saveData||null;}
get supportsSearch()
{return true;}
get numberOfSearchResults()
{var currentContentView=this._contentViewContainer.currentContentView;if(!currentContentView||!currentContentView.supportsSearch)
return null;return currentContentView.numberOfSearchResults;}
get hasPerformedSearch()
{var currentContentView=this._contentViewContainer.currentContentView;if(!currentContentView||!currentContentView.supportsSearch)
return false;return currentContentView.hasPerformedSearch;}
set automaticallyRevealFirstSearchResult(reveal)
{var currentContentView=this._contentViewContainer.currentContentView;if(!currentContentView||!currentContentView.supportsSearch)
return;currentContentView.automaticallyRevealFirstSearchResult=reveal;}
performSearch(query)
{this._searchQuery=query;var currentContentView=this._contentViewContainer.currentContentView;if(!currentContentView||!currentContentView.supportsSearch)
return;currentContentView.performSearch(query);}
searchCleared()
{this._searchQuery=null;var currentContentView=this._contentViewContainer.currentContentView;if(!currentContentView||!currentContentView.supportsSearch)
return;currentContentView.searchCleared();}
searchQueryWithSelection()
{var currentContentView=this._contentViewContainer.currentContentView;if(!currentContentView||!currentContentView.supportsSearch)
return null;return currentContentView.searchQueryWithSelection();}
revealPreviousSearchResult(changeFocus)
{var currentContentView=this._contentViewContainer.currentContentView;if(!currentContentView||!currentContentView.supportsSearch)
return;currentContentView.revealPreviousSearchResult(changeFocus);}
revealNextSearchResult(changeFocus)
{var currentContentView=this._contentViewContainer.currentContentView;if(!currentContentView||!currentContentView.supportsSearch)
return;currentContentView.revealNextSearchResult(changeFocus);}
_currentContentViewDidChange(event)
{var currentContentView=this._contentViewContainer.currentContentView;if(currentContentView&&currentContentView.supportsSearch){if(this._searchQuery)
currentContentView.performSearch(this._searchQuery);else
currentContentView.searchCleared();}
this.dispatchEventToListeners(WebInspector.ContentView.Event.SelectionPathComponentsDidChange);this.dispatchEventToListeners(WebInspector.ContentView.Event.NumberOfSearchResultsDidChange);this.dispatchEventToListeners(WebInspector.ContentView.Event.NavigationItemsDidChange);}
_contentViewSelectionPathComponentDidChange(event)
{if(event.target!==this._contentViewContainer.currentContentView)
return;this.dispatchEventToListeners(WebInspector.ContentView.Event.SelectionPathComponentsDidChange);}
_contentViewSupplementalRepresentedObjectsDidChange(event)
{if(event.target!==this._contentViewContainer.currentContentView)
return;this.dispatchEventToListeners(WebInspector.ContentView.Event.SupplementalRepresentedObjectsDidChange);}
_contentViewNumberOfSearchResultsDidChange(event)
{if(event.target!==this._contentViewContainer.currentContentView)
return;this.dispatchEventToListeners(WebInspector.ContentView.Event.NumberOfSearchResultsDidChange);}};(function(){
function tokenizeLinkString(stream,state)
{if(state._linkQuoteCharacter)
stream.eatWhile(new RegExp("[^"+state._linkQuoteCharacter+"]"));else
stream.eatWhile(/[^\s\u00a0=<>\"\']/);if(!stream.eol())
state._linkTokenize=tokenizeEndOfLinkString;return"link";}
function tokenizeEndOfLinkString(stream,state)
{if(state._linkQuoteCharacter)
stream.eat(state._linkQuoteCharacter);var style=state._linkBaseStyle;delete state._linkTokenize;delete state._linkQuoteCharacter;delete state._linkBaseStyle;delete state._srcSetTokenizeState;return style;}
function tokenizeSrcSetString(stream,state)
{if(state._srcSetTokenizeState==="link"){if(state._linkQuoteCharacter)
stream.eatWhile(new RegExp("[^\\s,"+state._linkQuoteCharacter+"]"));else
stream.eatWhile(/[^\s,\u00a0=<>\"\']/);}else{stream.eatSpace();if(state._linkQuoteCharacter)
stream.eatWhile(new RegExp("[^,"+state._linkQuoteCharacter+"]"));else
stream.eatWhile(/[^\s\u00a0=<>\"\']/);stream.eatWhile(/[\s,]/);}
if(stream.eol()||(!state._linkQuoteCharacter||stream.peek()===state._linkQuoteCharacter))
state._linkTokenize=tokenizeEndOfLinkString;if(state._srcSetTokenizeState==="link"){state._srcSetTokenizeState="descriptor";return"link";}
state._srcSetTokenizeState="link";return state._linkBaseStyle;}
function extendedXMLToken(stream,state)
{if(state._linkTokenize){var style=state._linkTokenize(stream,state);return style&&(style+" m-"+this.name);}
var startPosition=stream.pos;var style=this._token(stream,state);if(style==="attribute"){
var text=stream.current().toLowerCase();if(text==="src"||/\bhref\b/.test(text))
state._expectLink=true;else if(text==="srcset")
state._expectSrcSet=true;else{delete state._expectLink;delete state._expectSrcSet;}}else if(state._expectLink&&style==="string"){var current=stream.current();
if(current!=="\"\""&&current!=="''"){delete state._expectLink;state._linkTokenize=tokenizeLinkString;state._linkBaseStyle=style;var quote=current[0];state._linkQuoteCharacter=quote==="'"||quote==="\""?quote:null;stream.pos=startPosition;
if(state._linkQuoteCharacter)
stream.eat(state._linkQuoteCharacter);}}else if(state._expectSrcSet&&style==="string"){var current=stream.current();
if(current!=="\"\""&&current!=="''"){delete state._expectSrcSet;state._srcSetTokenizeState="link";state._linkTokenize=tokenizeSrcSetString;state._linkBaseStyle=style;var quote=current[0];state._linkQuoteCharacter=quote==="'"||quote==="\""?quote:null;stream.pos=startPosition;
if(state._linkQuoteCharacter)
stream.eat(state._linkQuoteCharacter);}}else if(style){
delete state._expectLink;delete state._expectSrcSet;}
return style&&(style+" m-"+this.name);}
function tokenizeCSSURLString(stream,state)
{if(state._unquotedURLString&&stream.eatSpace())
return null;var ch=null;var escaped=false;var reachedEndOfURL=false;var lastNonWhitespace=stream.pos;var quote=state._urlQuoteCharacter;while((ch=stream.next())!=null){if(ch===quote&&!escaped){reachedEndOfURL=true;break;}
escaped=!escaped&&ch==="\\";if(!/[\s\u00a0]/.test(ch))
lastNonWhitespace=stream.pos;}
if(state._unquotedURLString)
stream.pos=lastNonWhitespace;if(reachedEndOfURL){if(!state._unquotedURLString)
stream.backUp(1);this._urlTokenize=tokenizeEndOfCSSURLString;}
return"link";}
function tokenizeEndOfCSSURLString(stream,state)
{if(!state._unquotedURLString)
stream.eat(state._urlQuoteCharacter);var style=state._urlBaseStyle;delete state._urlTokenize;delete state._urlQuoteCharacter;delete state._urlBaseStyle;return style;}
function extendedCSSToken(stream,state)
{var hexColorRegex=/#(?:[0-9a-fA-F]{8}|[0-9a-fA-F]{6}|[0-9a-fA-F]{3,4})\b/g;if(state._urlTokenize){var style=state._urlTokenize(stream,state);return style&&(style+" m-"+(this.alternateName||this.name));}
var startPosition=stream.pos;var style=this._token(stream,state);if(style){if(style==="atom"){if(stream.current()==="url"){state._expectLink=true;}else if(hexColorRegex.test(stream.current()))
style=style+" hex-color";}else if(state._expectLink){delete state._expectLink;if(style==="string"){state._urlTokenize=tokenizeCSSURLString;state._urlBaseStyle=style;var quote=stream.current()[0];state._urlQuoteCharacter=quote==="'"||quote==="\""?quote:")";state._unquotedURLString=state._urlQuoteCharacter===")";stream.pos=startPosition;
if(!state._unquotedURLString)
stream.eat(state._urlQuoteCharacter);}}}
return style&&(style+" m-"+(this.alternateName||this.name));}
function extendedToken(stream,state)
{var style=this._token(stream,state);return style&&(style+" m-"+(this.alternateName||this.name));}
function extendedCSSRuleStartState(base)
{var state=this._startState(base);
state.state="block";state.context.type="block";return state;}
function scrollCursorIntoView(codeMirror,event)
{
event.preventDefault();function delayedWork()
{if(!codeMirror.getWrapperElement().classList.contains("CodeMirror-focused"))
return;var cursorElement=codeMirror.getScrollerElement().getElementsByClassName("CodeMirror-cursor")[0];if(cursorElement)
cursorElement.scrollIntoViewIfNeeded(false);}
setTimeout(delayedWork,0);}
CodeMirror.extendMode("css",{token:extendedCSSToken});CodeMirror.extendMode("xml",{token:extendedXMLToken});CodeMirror.extendMode("javascript",{token:extendedToken});CodeMirror.defineMode("css-rule",CodeMirror.modes.css);CodeMirror.extendMode("css-rule",{token:extendedCSSToken,startState:extendedCSSRuleStartState,alternateName:"css"});CodeMirror.defineInitHook(function(codeMirror){codeMirror.on("scrollCursorIntoView",scrollCursorIntoView);});const maximumNeighboringWhitespaceCharacters=16;CodeMirror.defineOption("showWhitespaceCharacters",false,function(cm,value,old){if(!value||(old&&old!==CodeMirror.Init)){cm.removeOverlay("whitespace");return;}
cm.addOverlay({name:"whitespace",token(stream){if(stream.peek()===" "){let count=0;while(count<maximumNeighboringWhitespaceCharacters&&stream.peek()===" "){++count;stream.next();}
return`whitespace whitespace-${count}`;}
while(!stream.eol()&&stream.peek()!==" ")
stream.next();return null;}});});CodeMirror.defineExtension("hasLineClass",function(line,where,className){var classProperty=(where==="text"?"textClass":(where==="background"?"bgClass":"wrapClass"));var lineInfo=this.lineInfo(line);if(!lineInfo)
return false;if(!lineInfo[classProperty])
return false;if(lineInfo[classProperty]===className)
return true;var index=lineInfo[classProperty].indexOf(className);if(index===-1)
return false;var paddedClass=" "+lineInfo[classProperty]+" ";return paddedClass.indexOf(" "+className+" ",index)!==-1;});CodeMirror.defineExtension("setUniqueBookmark",function(position,options){var marks=this.findMarksAt(position);for(var i=0;i<marks.length;++i){if(marks[i].__uniqueBookmark){marks[i].clear();break;}}
var uniqueBookmark=this.setBookmark(position,options);uniqueBookmark.__uniqueBookmark=true;return uniqueBookmark;});CodeMirror.defineExtension("toggleLineClass",function(line,where,className){if(this.hasLineClass(line,where,className)){this.removeLineClass(line,where,className);return false;}
this.addLineClass(line,where,className);return true;});CodeMirror.defineExtension("alterNumberInRange",function(amount,startPosition,endPosition,updateSelection){if(startPosition.line!==endPosition.line)
return false;if(updateSelection){var selectionStart=this.getCursor("start");var selectionEnd=this.getCursor("end");}
var line=this.getLine(startPosition.line);var foundPeriod=false;var start=NaN;var end=NaN;for(var i=startPosition.ch;i>=0;--i){var character=line.charAt(i);if(character==="."){if(foundPeriod)
break;foundPeriod=true;}else if(character!=="-"&&character!=="+"&&isNaN(parseInt(character))){if(i===startPosition.ch){end=i;continue;}
break;}
start=i;}
if(isNaN(end)){for(var i=startPosition.ch+1;i<line.length;++i){var character=line.charAt(i);if(character==="."){if(foundPeriod){end=i;break;}
foundPeriod=true;}else if(isNaN(parseInt(character))){end=i;break;}
end=i+1;}}
if(isNaN(start)||isNaN(end))
return false;var number=parseFloat(line.substring(start,end));var alteredNumber=Number((number+amount).toFixed(6));var alteredNumberString=alteredNumber.toString();var from={line:startPosition.line,ch:start};var to={line:startPosition.line,ch:end};this.replaceRange(alteredNumberString,from,to);if(updateSelection){var previousLength=to.ch-from.ch;var newLength=alteredNumberString.length;
let diff=newLength-previousLength;if(selectionStart===selectionEnd)
selectionStart.ch+=diff;else{if(selectionStart.ch>from.ch)
selectionStart.ch+=diff;if(selectionEnd.ch>from.ch)
selectionEnd.ch+=diff;}
this.setSelection(selectionStart,selectionEnd);}
return true;});function alterNumber(amount,codeMirror)
{function findNumberToken(position)
{
var token=codeMirror.getTokenAt(position);if(token&&token.type&&/\bnumber\b/.test(token.type))
return token;return null;}
var position=codeMirror.getCursor("head");var token=findNumberToken(position);if(!token){
position.ch+=1;token=findNumberToken(position);}
if(!token)
return CodeMirror.Pass;var foundNumber=codeMirror.alterNumberInRange(amount,{ch:token.start,line:position.line},{ch:token.end,line:position.line},true);if(!foundNumber)
return CodeMirror.Pass;}
CodeMirror.defineExtension("rectsForRange",function(range){var lineRects=[];for(var line=range.start.line;line<=range.end.line;++line){var lineContent=this.getLine(line);var startChar=line===range.start.line?range.start.ch:(lineContent.length-lineContent.trimLeft().length);var endChar=line===range.end.line?range.end.ch:lineContent.length;var firstCharCoords=this.cursorCoords({ch:startChar,line});var endCharCoords=this.cursorCoords({ch:endChar,line});if(firstCharCoords.bottom!==endCharCoords.bottom){var maxY=-Number.MAX_VALUE;for(var ch=startChar;ch<=endChar;++ch){var coords=this.cursorCoords({ch,line});if(coords.bottom>maxY){if(ch>startChar){var maxX=Math.ceil(this.cursorCoords({ch:ch-1,line}).right);lineRects.push(new WebInspector.Rect(minX,minY,maxX-minX,maxY-minY));}
var minX=Math.floor(coords.left);var minY=Math.floor(coords.top);maxY=Math.ceil(coords.bottom);}}
maxX=Math.ceil(coords.right);lineRects.push(new WebInspector.Rect(minX,minY,maxX-minX,maxY-minY));}else{var minX=Math.floor(firstCharCoords.left);var minY=Math.floor(firstCharCoords.top);var maxX=Math.ceil(endCharCoords.right);var maxY=Math.ceil(endCharCoords.bottom);lineRects.push(new WebInspector.Rect(minX,minY,maxX-minX,maxY-minY));}}
return lineRects;});let mac=WebInspector.Platform.name==="mac";CodeMirror.keyMap["default"]={"Alt-Up":alterNumber.bind(null,1),"Ctrl-Alt-Up":alterNumber.bind(null,0.1),"Shift-Alt-Up":alterNumber.bind(null,10),"Alt-PageUp":alterNumber.bind(null,10),"Shift-Alt-PageUp":alterNumber.bind(null,100),"Alt-Down":alterNumber.bind(null,-1),"Ctrl-Alt-Down":alterNumber.bind(null,-0.1),"Shift-Alt-Down":alterNumber.bind(null,-10),"Alt-PageDown":alterNumber.bind(null,-10),"Shift-Alt-PageDown":alterNumber.bind(null,-100),"Cmd-/":"toggleComment","Cmd-D":"selectNextOccurrence","Shift-Tab":"indentLess",fallthrough:mac?"macDefault":"pcDefault"};
var extraXMLTypes=["text/xml","text/xsl"];extraXMLTypes.forEach(function(type){CodeMirror.defineMIME(type,"xml");});var extraHTMLTypes=["application/xhtml+xml","image/svg+xml"];extraHTMLTypes.forEach(function(type){CodeMirror.defineMIME(type,"htmlmixed");});var extraJavaScriptTypes=["text/ecmascript","application/javascript","application/ecmascript","application/x-javascript","text/x-javascript","text/javascript1.1","text/javascript1.2","text/javascript1.3","text/jscript","text/livescript"];extraJavaScriptTypes.forEach(function(type){CodeMirror.defineMIME(type,"javascript");});var extraJSONTypes=["application/x-json","text/x-json","application/vnd.api+json"];extraJSONTypes.forEach(function(type){CodeMirror.defineMIME(type,{name:"javascript",json:true});});})();WebInspector.compareCodeMirrorPositions=function(a,b)
{var lineCompare=a.line-b.line;if(lineCompare!==0)
return lineCompare;var aColumn="ch"in a?a.ch:Number.MAX_VALUE;var bColumn="ch"in b?b.ch:Number.MAX_VALUE;return aColumn-bColumn;};WebInspector.walkTokens=function(cm,mode,initialPosition,callback)
{let state=CodeMirror.copyState(mode,cm.getTokenAt(initialPosition).state);if(state.localState)
state=state.localState;let lineCount=cm.lineCount();let abort=false;for(let lineNumber=initialPosition.line;!abort&&lineNumber<lineCount;++lineNumber){let line=cm.getLine(lineNumber);let stream=new CodeMirror.StringStream(line);if(lineNumber===initialPosition.line)
stream.start=stream.pos=initialPosition.ch;while(!stream.eol()){let tokenType=mode.token(stream,state);if(!callback(tokenType,stream.current())){abort=true;break;}
stream.start=stream.pos;}}
if(!abort)
callback(null);};WebInspector.CodeMirrorEditor=class CodeMirrorEditor
{static create(element,options)
{if(options.lineSeparator===undefined)
options.lineSeparator="\n";element.setAttribute("dir","ltr");let codeMirror=new CodeMirror(element,options);if(WebInspector.Platform.name==="mac"){codeMirror.addKeyMap({"Home":()=>{codeMirror.scrollIntoView({line:0,ch:0});},"End":()=>{codeMirror.scrollIntoView({line:codeMirror.lineCount()-1,ch:null});},});}
new WebInspector.CodeMirrorTextKillController(codeMirror);return codeMirror;}};
CodeMirror.extendMode("javascript",{shouldHaveSpaceBeforeToken:function(lastToken,lastContent,token,state,content,isComment)
{if(!token){if(content==="(")
return lastToken&&/\bkeyword\b/.test(lastToken)&&(lastContent!=="function"&&lastContent!=="typeof"&&lastContent!=="instanceof");if(content===":")
return state.lexical.type==="stat"||state.lexical.type===")"||state.lexical.type==="]";return false;}
if(isComment)
return true;if(/\boperator\b/.test(token)){if(!lastToken&&(content==="+"||content==="-"||content==="~")&&(lastContent!==")"&&lastContent!=="]"))
return false;if(content==="!")
return false;return"+-/*%&&||!===+=-=>=<=?".indexOf(content)>=0;}
if(/\bkeyword\b/.test(token)){if(content==="else"||content==="catch"||content==="finally")
return lastContent==="}";if(content==="while"&&lastContent==="}")
return state._jsPrettyPrint.lastContentBeforeBlock==="do";return false;}
return false;},shouldHaveSpaceAfterLastToken:function(lastToken,lastContent,token,state,content,isComment)
{if(lastToken&&/\bkeyword\b/.test(lastToken)){if(lastContent==="else")
return true;if(lastContent==="catch")
return true;if(lastContent==="return")
return content!==";";if(lastContent==="throw")
return true;if(lastContent==="try")
return true;if(lastContent==="finally")
return true;if(lastContent==="do")
return true;return false;}
if(lastToken&&/\bcomment\b/.test(lastToken))
return true;if(lastContent===")")
return content==="{";if(lastContent===";")
return state.lexical.type===")";if(lastContent==="!")
return false;if((lastContent==="+"||lastContent==="-"||lastContent==="~")&&!state._jsPrettyPrint.unaryOperatorHadLeadingExpr)
return false;return",+-/*%&&||:!===+=-=>=<=?".indexOf(lastContent)>=0;},newlinesAfterToken:function(lastToken,lastContent,token,state,content,isComment)
{if(!token){if(content===",")
return state.lexical.type==="}"?1:0;if(content===";")
return state.lexical.type!==")"?1:0;if(content===":"&&state.lexical.type==="}"&&state.lexical.prev&&state.lexical.prev.type==="form")
return 1;return content.length===1&&"{}".indexOf(content)>=0?1:0;}
if(isComment)
return 1;return 0;},removeLastWhitespace:function(lastToken,lastContent,token,state,content,isComment)
{return false;},removeLastNewline:function(lastToken,lastContent,token,state,content,isComment,firstTokenOnLine)
{if(!token){if(content==="}")
return lastContent==="{";if(content===";")
return"};".indexOf(lastContent)>=0;if(content===":")
return lastContent==="}"&&(state.lexical.type==="stat"||state.lexical.type===")"||state.lexical.type==="]");if(",().".indexOf(content)>=0)
return lastContent==="}";return false;}
if(isComment){if(!firstTokenOnLine&&lastContent===";")
return true;return false;}
if(/\bkeyword\b/.test(token)){if(content==="else"||content==="catch"||content==="finally")
return lastContent==="}";if(content==="while"&&lastContent==="}")
return state._jsPrettyPrint.lastContentBeforeBlock==="do";return false;}
return false;},indentAfterToken:function(lastToken,lastContent,token,state,content,isComment)
{if(content==="{")
return true;if(content==="case"||content==="default")
return state.lexical.type==="}"&&state.lexical.prev&&state.lexical.prev.type==="form";return false;},newlineBeforeToken:function(lastToken,lastContent,token,state,content,isComment)
{if(state._jsPrettyPrint.shouldIndent)
return true;return content==="}"&&lastContent!=="{";},indentBeforeToken:function(lastToken,lastContent,token,state,content,isComment)
{if(state._jsPrettyPrint.shouldIndent)
return true;return false;},dedentsBeforeToken:function(lastToken,lastContent,token,state,content,isComment)
{var dedent=0;if(state._jsPrettyPrint.shouldDedent)
dedent+=state._jsPrettyPrint.dedentSize;if(!token&&content==="}")
dedent+=1;else if(token&&/\bkeyword\b/.test(token)&&(content==="case"||content==="default"))
dedent+=1;return dedent;},modifyStateForTokenPre:function(lastToken,lastContent,token,state,content,isComment)
{if(!state._jsPrettyPrint){state._jsPrettyPrint={indentCount:0,shouldIndent:false,shouldDedent:false,dedentSize:0,lastIfIndentCount:0,openBraceStartMarkers:[],openBraceTrackingCount:-1,unaryOperatorHadLeadingExpr:false,lastContentBeforeBlock:undefined,};}
if(!isComment&&state.lexical.prev&&state.lexical.prev.type==="form"&&!state.lexical.prev._jsPrettyPrintMarker&&(lastContent===")"||lastContent==="else"||lastContent==="do")&&(state.lexical.type!==")")){if(content==="{"){var savedState={indentCount:state._jsPrettyPrint.indentCount,openBraceTrackingCount:state._jsPrettyPrint.openBraceTrackingCount,lastContentBeforeBlock:lastContent};state._jsPrettyPrint.openBraceStartMarkers.push(savedState);state._jsPrettyPrint.openBraceTrackingCount=1;}else if(state.lexical.type!=="}"){if(!(lastContent==="else"&&content==="if")){state._jsPrettyPrint.indentCount++;state._jsPrettyPrint.shouldIndent=true;}
state.lexical.prev._jsPrettyPrintMarker=true;if(state._jsPrettyPrint.enteringIf)
state._jsPrettyPrint.lastIfIndentCount=state._jsPrettyPrint.indentCount-1;}}
else{if(!isComment){if(content==="{")
state._jsPrettyPrint.openBraceTrackingCount++;else if(content==="}")
state._jsPrettyPrint.openBraceTrackingCount--;}
if(content===";"){}else if(content==="else"){if(lastContent!=="}"){state._jsPrettyPrint.shouldDedent=true;state._jsPrettyPrint.dedentSize=state._jsPrettyPrint.indentCount-state._jsPrettyPrint.lastIfIndentCount;state._jsPrettyPrint.lastIfIndentCount=0;}}else if(content==="}"&&!state._jsPrettyPrint.openBraceTrackingCount&&state._jsPrettyPrint.openBraceStartMarkers.length){var savedState=state._jsPrettyPrint.openBraceStartMarkers.pop();state._jsPrettyPrint.shouldDedent=true;state._jsPrettyPrint.dedentSize=state._jsPrettyPrint.indentCount-savedState.indentCount;state._jsPrettyPrint.openBraceTrackingCount=savedState.openBraceTrackingCount;state._jsPrettyPrint.lastContentBeforeBlock=savedState.lastContentBeforeBlock;}else{var shouldDedent=true;var lexical=state.lexical.prev;while(lexical){if(lexical._jsPrettyPrintMarker){shouldDedent=false;break;}
lexical=lexical.prev;}
if(shouldDedent){state._jsPrettyPrint.shouldDedent=true;state._jsPrettyPrint.dedentSize=state._jsPrettyPrint.indentCount;}}}
if(token&&state.lexical.type==="form"&&state.lexical.prev&&state.lexical.prev!=="form"&&/\bkeyword\b/.test(token))
state._jsPrettyPrint.enteringIf=(content==="if");},modifyStateForTokenPost:function(lastToken,lastContent,token,state,content,isComment)
{if(state._jsPrettyPrint.shouldIndent)
state._jsPrettyPrint.shouldIndent=false;if(state._jsPrettyPrint.shouldDedent){state._jsPrettyPrint.indentCount-=state._jsPrettyPrint.dedentSize;state._jsPrettyPrint.dedentSize=0;state._jsPrettyPrint.shouldDedent=false;}
if((content==="+"||content==="-"||content==="~")&&(lastContent===")"||lastContent==="]"||/\b(?:variable|number)\b/.test(lastToken)))
state._jsPrettyPrint.unaryOperatorHadLeadingExpr=true;else
state._jsPrettyPrint.unaryOperatorHadLeadingExpr=false;}});CodeMirror.extendMode("css",{shouldHaveSpaceBeforeToken:function(lastToken,lastContent,token,state,content,isComment)
{if(!token){if(content==="{")
return true;return">+~-*/".indexOf(content)>=0;}
if(isComment)
return true;if(/\bkeyword\b/.test(token)){if(content.charAt(0)==="!")
return true;return false;}
return false;},shouldHaveSpaceAfterLastToken:function(lastToken,lastContent,token,state,content,isComment)
{if(!lastToken){if(lastContent===",")
return true;if(lastContent===":")
return state.state==="prop";if(lastContent===")"&&(content!==")"&&content!==",")){if(/\bnumber\b/.test(token))
return true;if(state.state==="prop")
return true;if(state.state==="media"||state.state==="atBlock_parens")
return true;return false;}
return">+~-*/".indexOf(lastContent)>=0;}
if(/\bcomment\b/.test(lastToken))
return true;if(/\bkeyword\b/.test(lastToken))
return state.state==="media"||(state.state==="atBlock_parens"&&content!==")");return false;},newlinesAfterToken:function(lastToken,lastContent,token,state,content,isComment)
{if(!token){if(content===";")
return 1;if(content===","){if((state.state==="top"||state.state==="media")&&state._cssPrettyPrint.lineLength>60){state._cssPrettyPrint.lineLength=0;return 1;}
return 0;}
if(content==="{")
return 1;if(content==="}")
return 2;return 0;}
if(isComment)
return 1;return 0;},removeLastWhitespace:function(lastToken,lastContent,token,state,content,isComment)
{return false;},removeLastNewline:function(lastToken,lastContent,token,state,content,isComment,firstTokenOnLine)
{if(isComment){if(!firstTokenOnLine&&lastContent===";")
return true;return false;}
return content==="}"&&(lastContent==="{"||lastContent==="}");},indentAfterToken:function(lastToken,lastContent,token,state,content,isComment)
{return content==="{";},newlineBeforeToken:function(lastToken,lastContent,token,state,content,isComment)
{return content==="}"&&(lastContent!=="{"&&lastContent!=="}");},indentBeforeToken:function(lastToken,lastContent,token,state,content,isComment)
{return false;},dedentsBeforeToken:function(lastToken,lastContent,token,state,content,isComment)
{return content==="}"?1:0;},modifyStateForTokenPost:function(lastToken,lastContent,token,state,content,isComment)
{if(!state._cssPrettyPrint)
state._cssPrettyPrint={lineLength:0};if(!isComment&&(state.state==="top"||state.state==="media"||state.state==="pseudo"))
state._cssPrettyPrint.lineLength+=content.length;else
state._cssPrettyPrint.lineLength=0;}});CodeMirror.extendMode("css-rule",{shouldHaveSpaceBeforeToken:function(lastToken,lastContent,token,state,content,isComment)
{if(lastContent===":"&&!lastToken)
return true;var tokenRegExp=/\b(?:keyword|atom|number)\b/;if(tokenRegExp.test(lastToken)&&tokenRegExp.test(token))
return true;return false;},shouldHaveSpaceAfterLastToken:function(lastToken,lastContent,token,state,content,isComment)
{return lastContent===","&&!lastToken;},newlinesAfterToken:function(lastToken,lastContent,token,state,content,isComment)
{return 0;},removeLastWhitespace:function(lastToken,lastContent,token,state,content,isComment)
{if(isComment)
return true;if(!lastToken)
return lastContent===";";if(!token)
return content===";"||content===":";if(/\bcomment\b/.test(lastToken))
return true;return false;},removeLastNewline:function(lastToken,lastContent,token,state,content,isComment,firstTokenOnLine)
{return true;},indentAfterToken:function(lastToken,lastContent,token,state,content,isComment)
{return false;},newlineBeforeToken:function(lastToken,lastContent,token,state,content,isComment)
{if(isComment)
return true;if(state.state==="block")
return/\bmeta\b/.test(token); if(/\bcomment\b/.test(lastToken))
return true;if(/\bproperty\b/.test(token))
return!(/\bmeta\b/.test(lastToken));if(state.state==="maybeprop"&&/\bvariable-2\b/.test(token))
return true;return false;},indentBeforeToken:function(lastToken,lastContent,token,state,content,isComment)
{return false;},dedentsBeforeToken:function(lastToken,lastContent,token,state,content,isComment)
{return 0;}});CodeMirror.defineMode("regex",function(){function characterSetTokenizer(stream,state){let context=state.currentContext();if(context.negatedCharacterSet===undefined){context.negatedCharacterSet=stream.eat("^");if(context.negatedCharacterSet)
return"regex-character-set-negate";}
while(stream.peek()){if(stream.eat("\\"))
return consumeEscapeSequence(stream);if(stream.eat("]")){state.tokenize=tokenBase;return state.popContext();}
stream.next();}
return"error";}
function consumeEscapeSequence(stream){if(stream.match(/[bBdDwWsStrnvf0]/))
return"regex-special";if(stream.eat("x")){if(stream.match(/[0-9a-fA-F]{2}/))
return"regex-escape";return"error";}
if(stream.eat("u")){if(stream.match(/[0-9a-fA-F]{4}/))
return"regex-escape-2";return"error";}
if(stream.eat("c")){if(stream.match(/[A-Z]/))
return"regex-escape-3";return"error";}
if(stream.match(/[1-9]/))
return"regex-backreference";if(stream.next())
return"regex-literal";return"error";}
function tokenBase(stream,state){let ch=stream.next();if(ch==="\\")
return consumeEscapeSequence(stream);if(ch==="("){let style;if(stream.match(/\?[=!]/))
style="regex-lookahead";else{stream.match(/\?:/);style="regex-group";}
return state.pushContext(stream,style,")");}
let context=state.currentContext();if(context&&context.type===ch)
return state.popContext();if(/[*+?]/.test(ch))
return"regex-quantifier";if(ch==="{"){if(stream.match(/\d+}/))
return"regex-quantifier";let matches=stream.match(/(\d+),(\d+)?}/);if(!matches)
return"error";let minimum=parseInt(matches[1]);let maximum=parseInt(matches[2]);if(minimum>maximum)
return"error";return"regex-quantifier";}
if(ch==="["){state.tokenize=characterSetTokenizer;return state.pushContext(stream,"regex-character-set");}
if(/[.^$|]/.test(ch))
return"regex-special";return null;}
return{startState:function(){let contextStack=[];return{currentContext:function(){return contextStack.length?contextStack[contextStack.length-1]:null;},pushContext:function(stream,data,type){let context={data,type};contextStack.push(context);return data;},popContext:function(){return contextStack.pop().data;},tokenize:tokenBase,};},token:function(stream,state){return state.tokenize(stream,state);}};});CodeMirror.defineMIME("text/x-regex","regex");function createCodeMirrorTextMarkers(type,pattern,matchFunction,codeMirror,range,callback)
{var createdMarkers=[];var start=range instanceof WebInspector.TextRange?range.startLine:0;var end=range instanceof WebInspector.TextRange?range.endLine+1:codeMirror.lineCount();for(var lineNumber=start;lineNumber<end;++lineNumber){var lineContent=codeMirror.getLine(lineNumber);var match=pattern.exec(lineContent);while(match){if(typeof matchFunction==="function"&&!matchFunction(lineContent,match)){match=pattern.exec(lineContent);continue;}
var from={line:lineNumber,ch:match.index};var to={line:lineNumber,ch:match.index+match[0].length};var foundMarker=false;var markers=codeMirror.findMarksAt(to);for(var j=0;j<markers.length;++j){if(WebInspector.TextMarker.textMarkerForCodeMirrorTextMarker(markers[j]).type===WebInspector.TextMarker.Type[type]){foundMarker=true;break;}}
if(foundMarker){match=pattern.exec(lineContent);continue;}
var tokenType=codeMirror.getTokenTypeAt(from);if(tokenType&&!tokenType.includes("keyword")){match=pattern.exec(lineContent);continue;}
let valueString=match[1];let value=WebInspector[type]?WebInspector[type].fromString(valueString):null;if(WebInspector[type]&&!value){match=pattern.exec(lineContent);continue;}
var marker=codeMirror.markText(from,to);marker=new WebInspector.TextMarker(marker,WebInspector.TextMarker.Type[type]);createdMarkers.push(marker);if(typeof callback==="function")
callback(marker,value,valueString);match=pattern.exec(lineContent);}}
return createdMarkers;}
function createCodeMirrorColorTextMarkers(codeMirror,range,callback)
{ let colorRegex=/((?:rgb|hsl)a?\([^)]+\)|#[0-9a-fA-F]{8}|#[0-9a-fA-F]{6}|#[0-9a-fA-F]{3,4}|\b\w+\b(?![-.]))/g;function matchFunction(lineContent,match){if(!lineContent||!lineContent.length)
return false;
let openParenthesis=0;let index=match.index;let c=null;while(c=lineContent[index]){if(c==="(")
++openParenthesis;if(c===")")
--openParenthesis;if(openParenthesis>0)
break;--index;if(index<0)
break;}
if(/(repeating-)?(linear|radial)-gradient$/.test(lineContent.substring(0,index)))
return false;return!(match.index>0&&/[-.\"\']/.test(lineContent[match.index-1]));}
return createCodeMirrorTextMarkers("Color",colorRegex,matchFunction,codeMirror,range,callback);}
function createCodeMirrorGradientTextMarkers(codeMirror,range,callback)
{var createdMarkers=[];var start=range instanceof WebInspector.TextRange?range.startLine:0;var end=range instanceof WebInspector.TextRange?range.endLine+1:codeMirror.lineCount();var gradientRegex=/(repeating-)?(linear|radial)-gradient\s*\(\s*/g;for(var lineNumber=start;lineNumber<end;++lineNumber){var lineContent=codeMirror.getLine(lineNumber);var match=gradientRegex.exec(lineContent);while(match){var startLine=lineNumber;var startChar=match.index;var endChar=match.index+match[0].length;var openParentheses=0;var c=null;while(c=lineContent[endChar]){if(c==="(")
openParentheses++;if(c===")")
openParentheses--;if(openParentheses===-1){endChar++;break;}
endChar++;if(endChar>=lineContent.length){lineNumber++;endChar=0;lineContent=codeMirror.getLine(lineNumber);if(!lineContent)
break;}}
if(openParentheses!==-1){match=gradientRegex.exec(lineContent);continue;}
var from={line:startLine,ch:startChar};var to={line:lineNumber,ch:endChar};var gradientString=codeMirror.getRange(from,to);var gradient=WebInspector.Gradient.fromString(gradientString);if(!gradient){match=gradientRegex.exec(lineContent);continue;}
var marker=new WebInspector.TextMarker(codeMirror.markText(from,to),WebInspector.TextMarker.Type.Gradient);createdMarkers.push(marker);if(typeof callback==="function")
callback(marker,gradient,gradientString);match=gradientRegex.exec(lineContent);}}
return createdMarkers;}
function createCodeMirrorCubicBezierTextMarkers(codeMirror,range,callback)
{var cubicBezierRegex=/(cubic-bezier\([^)]+\)|\b\w+\b(?:-\b\w+\b){0,2})/g;return createCodeMirrorTextMarkers("CubicBezier",cubicBezierRegex,null,codeMirror,range,callback);}
function createCodeMirrorSpringTextMarkers(codeMirror,range,callback)
{const springRegex=/(spring\([^)]+\))/g;return createCodeMirrorTextMarkers("Spring",springRegex,null,codeMirror,range,callback);}
function createCodeMirrorVariableTextMarkers(codeMirror,range,callback)
{const variableRegex=/var\((--[\w-]+)\)/g;return createCodeMirrorTextMarkers("Variable",variableRegex,null,codeMirror,range,callback);}
WebInspector.CollectionContentView=class CollectionContentView extends WebInspector.ContentView
{constructor(collection)
{super(collection);this.representedObject.addEventListener(WebInspector.Collection.Event.ItemAdded,this._handleItemAdded,this);this.representedObject.addEventListener(WebInspector.Collection.Event.ItemRemoved,this._handleItemRemoved,this);this._contentViewMap=new WeakMap;this._handleClickMap=new WeakMap;this._contentViewConstructor=null;let title="";switch(this.representedObject.typeVerifier){case WebInspector.Collection.TypeVerifier.Frame:title=WebInspector.UIString("Frames");break;case WebInspector.Collection.TypeVerifier.ContentFlow:title=WebInspector.UIString("Flows");break;case WebInspector.Collection.TypeVerifier.Script:title=WebInspector.UIString("Extra Scripts");break;case WebInspector.Collection.TypeVerifier.Resource:title=WebInspector.UIString("Resource");break;case WebInspector.ResourceCollection.TypeVerifier.Document:title=WebInspector.Resource.displayNameForType(WebInspector.Resource.Type.Document,true);break;case WebInspector.ResourceCollection.TypeVerifier.Stylesheet:title=WebInspector.Resource.displayNameForType(WebInspector.Resource.Type.Stylesheet,true);break;case WebInspector.ResourceCollection.TypeVerifier.Image:this._contentViewConstructor=WebInspector.ImageResourceContentView;title=WebInspector.Resource.displayNameForType(WebInspector.Resource.Type.Image,true);break;case WebInspector.ResourceCollection.TypeVerifier.Font:title=WebInspector.Resource.displayNameForType(WebInspector.Resource.Type.Font,true);break;case WebInspector.ResourceCollection.TypeVerifier.Script:title=WebInspector.Resource.displayNameForType(WebInspector.Resource.Type.Script,true);break;case WebInspector.ResourceCollection.TypeVerifier.XHR:title=WebInspector.Resource.displayNameForType(WebInspector.Resource.Type.XHR,true);break;case WebInspector.ResourceCollection.TypeVerifier.Fetch:title=WebInspector.Resource.displayNameForType(WebInspector.Resource.Type.Fetch,true);break;case WebInspector.ResourceCollection.TypeVerifier.WebSocket:title=WebInspector.Resource.displayNameForType(WebInspector.Resource.Type.WebSocket,true);break;case WebInspector.ResourceCollection.TypeVerifier.Other:title=WebInspector.Resource.displayNameForType(WebInspector.Resource.Type.Other,true);break;}
this._contentPlaceholder=new WebInspector.TitleView(title);this.element.classList.add("collection");}
initialLayout()
{let items=this.representedObject.items;if(this._contentViewConstructor&&items.size){for(let item of items)
this._addContentViewForItem(item);}else
this.addSubview(this._contentPlaceholder);}
_addContentViewForItem(item)
{if(!this._contentViewConstructor)
return;if(this._contentPlaceholder.parentView)
this.removeSubview(this._contentPlaceholder);let contentView=new this._contentViewConstructor(item);contentView.addEventListener(WebInspector.ResourceContentView.Event.ContentError,this._handleContentError,this);let handleClick=(event)=>{if(event.button!==0||event.ctrlKey)
return;WebInspector.showRepresentedObject(item);};this._handleClickMap.set(item,handleClick);contentView.element.addEventListener("click",handleClick);contentView.element.title=WebInspector.displayNameForURL(item.url,item.urlComponents);this.addSubview(contentView);this._contentViewMap.set(item,contentView);}
_removeContentViewForItem(item)
{if(!this._contentViewConstructor)
return;let contentView=this._contentViewMap.get(item);if(!contentView)
return;this.removeSubview(contentView);this._contentViewMap.delete(item);contentView.removeEventListener(null,null,this);let handleClick=this._handleClickMap.get(item);if(handleClick){contentView.element.removeEventListener("click",handleClick);this._handleClickMap.delete(item);}
if(!this.representedObject.resources.length)
this.addSubview(this._contentPlaceholder);}
_handleItemAdded(event)
{let item=event.data.item;if(!item)
return;this._addContentViewForItem(item);}
_handleItemRemoved(event)
{let item=event.data.item;if(!item)
return;this._removeContentViewForItem(item);}
_handleContentError(event)
{if(event&&event.target)
this._removeContentViewForItem(event.target.representedObject);}};WebInspector.ColorPicker=class ColorPicker extends WebInspector.Object
{constructor()
{super();this._colorWheel=new WebInspector.ColorWheel;this._colorWheel.delegate=this;this._colorWheel.dimension=200;this._brightnessSlider=new WebInspector.Slider;this._brightnessSlider.delegate=this;this._brightnessSlider.element.classList.add("brightness");this._opacitySlider=new WebInspector.Slider;this._opacitySlider.delegate=this;this._opacitySlider.element.classList.add("opacity");let colorInputsContainerElement=document.createElement("div");colorInputsContainerElement.classList.add("color-inputs");function createColorInput(label,{min:min=0,max:max=100,step:step=1,units}={}){let containerElement=colorInputsContainerElement.createChild("div");containerElement.append(label);let numberInputElement=containerElement.createChild("input");numberInputElement.type="number";numberInputElement.min=min;numberInputElement.max=max;numberInputElement.step=step;numberInputElement.addEventListener("input",this._handleColorInputInput.bind(this));if(units&&units.length)
containerElement.append(units);return{containerElement,numberInputElement};}
this._colorInputs=new Map([["R",createColorInput.call(this,"R",{max:255})],["G",createColorInput.call(this,"G",{max:255})],["B",createColorInput.call(this,"B",{max:255})],["H",createColorInput.call(this,"H",{max:360})],["S",createColorInput.call(this,"S",{units:"%"})],["L",createColorInput.call(this,"L",{units:"%"})],["A",createColorInput.call(this,"A"),{max:1,step:0.01}]]);this._element=document.createElement("div");this._element.classList.add("color-picker");this._element.appendChild(this._colorWheel.element);this._element.appendChild(this._brightnessSlider.element);this._element.appendChild(this._opacitySlider.element);this._element.appendChild(colorInputsContainerElement);this._opacity=0;this._opacityPattern="url(Images/Checkers.svg)";this._color=WebInspector.Color.fromString("white");this._dontUpdateColor=false;this._enableColorComponentInputs=true;}
get element()
{return this._element;}
set brightness(brightness)
{if(brightness===this._brightness)
return;this._colorWheel.brightness=brightness;this._updateColor();this._updateSliders(this._colorWheel.rawColor,this._colorWheel.tintedColor);}
set opacity(opacity)
{if(opacity===this._opacity)
return;this._opacity=opacity;this._updateColor();}
get colorWheel()
{return this._colorWheel;}
get color()
{return this._color;}
set color(color)
{this._dontUpdateColor=true;let formatChanged=!this._color||this._color.format!==color.format;this._color=color;this._colorWheel.tintedColor=this._color;this._brightnessSlider.value=this._colorWheel.brightness;this._opacitySlider.value=this._color.alpha;this._updateSliders(this._colorWheel.rawColor,this._color);this._showColorComponentInputs();if(formatChanged)
this._handleFormatChange();this._dontUpdateColor=false;}
set enableColorComponentInputs(value)
{this._enableColorComponentInputs=value;this._showColorComponentInputs();}
colorWheelColorDidChange(colorWheel)
{this._updateColor();this._updateSliders(this._colorWheel.rawColor,this._colorWheel.tintedColor);}
sliderValueDidChange(slider,value)
{if(slider===this._opacitySlider)
this.opacity=value;else if(slider===this._brightnessSlider)
this.brightness=value;}
_updateColor()
{if(this._dontUpdateColor)
return;let opacity=Math.round(this._opacity*100)/100;let format=this._color.format;let components=null;if(format===WebInspector.Color.Format.HSL||format===WebInspector.Color.Format.HSLA){components=this._colorWheel.tintedColor.hsl.concat(opacity);if(opacity!==1)
format=WebInspector.Color.Format.HSLA;}else{components=this._colorWheel.tintedColor.rgb.concat(opacity);if(opacity!==1&&format===WebInspector.Color.Format.RGB)
format=WebInspector.Color.Format.RGBA;}
let formatChanged=this._color.format===format;this._color=new WebInspector.Color(format,components);this._showColorComponentInputs();this.dispatchEventToListeners(WebInspector.ColorPicker.Event.ColorChanged,{color:this._color});if(formatChanged)
this._handleFormatChange();}
_updateSliders(rawColor,tintedColor)
{var rgb=this._colorWheel.tintedColor.rgb;var opaque=new WebInspector.Color(WebInspector.Color.Format.RGBA,rgb.concat(1)).toString();var transparent=new WebInspector.Color(WebInspector.Color.Format.RGBA,rgb.concat(0)).toString();this._opacitySlider.element.style.backgroundImage="linear-gradient(90deg, "+transparent+", "+opaque+"), "+this._opacityPattern;this._brightnessSlider.element.style.backgroundImage="linear-gradient(90deg, black, "+rawColor+")";}
_handleFormatChange()
{this._element.classList.toggle("hide-inputs",this._color.format!==WebInspector.Color.Format.Keyword&&this._color.format!==WebInspector.Color.Format.RGB&&this._color.format!==WebInspector.Color.Format.RGBA&&this._color.format!==WebInspector.Color.Format.HEX&&this._color.format!==WebInspector.Color.Format.ShortHEX&&this._color.format!==WebInspector.Color.Format.HEXAlpha&&this._color.format!==WebInspector.Color.Format.ShortHEXAlpha&&this._color.format!==WebInspector.Color.Format.HSL&&this._color.format!==WebInspector.Color.Format.HSLA);this.dispatchEventToListeners(WebInspector.ColorPicker.Event.FormatChanged);}
_showColorComponentInputs()
{for(let{containerElement}of this._colorInputs.values())
containerElement.hidden=true;if(!this._enableColorComponentInputs)
return;function updateColorInput(key,value){let{containerElement,numberInputElement}=this._colorInputs.get(key);numberInputElement.value=value;containerElement.hidden=false;}
switch(this._color.format){case WebInspector.Color.Format.RGB:case WebInspector.Color.Format.RGBA:case WebInspector.Color.Format.HEX:case WebInspector.Color.Format.ShortHEX:case WebInspector.Color.Format.HEXAlpha:case WebInspector.Color.Format.ShortHEXAlpha:case WebInspector.Color.Format.Keyword:var[r,g,b]=this._color.rgb;updateColorInput.call(this,"R",r);updateColorInput.call(this,"G",g);updateColorInput.call(this,"B",b);break;case WebInspector.Color.Format.HSL:case WebInspector.Color.Format.HSLA:var[h,s,l]=this._color.hsl;updateColorInput.call(this,"H",h);updateColorInput.call(this,"S",s);updateColorInput.call(this,"L",l);break;default:return;}
if((this._color.format===WebInspector.Color.Format.Keyword&&this._color.alpha!==1)||this._color.format===WebInspector.Color.Format.RGBA||this._color.format===WebInspector.Color.Format.HSLA||this._color.format===WebInspector.Color.Format.HEXAlpha||this._color.format===WebInspector.Color.Format.ShortHEXAlpha){updateColorInput.call(this,"A",this._color.alpha);}}
_handleColorInputInput(event)
{if(!this._enableColorComponentInputs){WebInspector.reportInternalError("Input event fired for disabled color component input");return;}
let r=this._colorInputs.get("R").numberInputElement.value;let g=this._colorInputs.get("G").numberInputElement.value;let b=this._colorInputs.get("B").numberInputElement.value;let h=this._colorInputs.get("H").numberInputElement.value;let s=this._colorInputs.get("S").numberInputElement.value;let l=this._colorInputs.get("L").numberInputElement.value;let a=this._colorInputs.get("A").numberInputElement.value;let colorString="";let oldFormat=this._color.format;switch(oldFormat){case WebInspector.Color.Format.RGB:case WebInspector.Color.Format.HEX:case WebInspector.Color.Format.ShortHEX:case WebInspector.Color.Format.Keyword:colorString=`rgb(${r}, ${g}, ${b})`;break;case WebInspector.Color.Format.RGBA:case WebInspector.Color.Format.HEXAlpha:case WebInspector.Color.Format.ShortHEXAlpha:colorString=`rgba(${r}, ${g}, ${b}, ${a})`;break;case WebInspector.Color.Format.HSL:colorString=`hsl(${h}, ${s}%, ${l}%)`;break;case WebInspector.Color.Format.HSLA:colorString=`hsla(${h}, ${s}%, ${l}%, ${a})`;break;default:WebInspector.reportInternalError(`Input event fired for invalid color format "${this._color.format}"`);return;}
this.color=WebInspector.Color.fromString(colorString);this._color.format=oldFormat;this.dispatchEventToListeners(WebInspector.ColorPicker.Event.ColorChanged,{color:this._color});}};WebInspector.ColorPicker.Event={ColorChanged:"css-color-picker-color-changed",FormatChanged:"css-color-picker-format-changed",};WebInspector.ColorWheel=class ColorWheel extends WebInspector.Object
{constructor()
{super();this._rawCanvas=document.createElement("canvas");this._tintedCanvas=document.createElement("canvas");this._finalCanvas=document.createElement("canvas");this._crosshair=document.createElement("div");this._crosshair.className="crosshair";this._element=document.createElement("div");this._element.className="color-wheel";this._element.appendChild(this._finalCanvas);this._element.appendChild(this._crosshair);this._finalCanvas.addEventListener("mousedown",this);}
set dimension(dimension)
{this._element.style.width=this.element.style.height=`${dimension}px`;this._finalCanvas.width=this._tintedCanvas.width=this._rawCanvas.width=dimension*window.devicePixelRatio;this._finalCanvas.height=this._tintedCanvas.height=this._rawCanvas.height=dimension*window.devicePixelRatio;this._finalCanvas.style.width=this._finalCanvas.style.height=dimension+"px";this._dimension=dimension;this._radius=dimension/2-2;this._setCrosshairPosition(new WebInspector.Point(dimension/2,dimension/2));this._drawRawCanvas();this._draw();}
get element()
{return this._element;}
get brightness()
{return this._brightness;}
set brightness(brightness)
{this._brightness=brightness;this._draw();}
get tintedColor()
{if(this._crosshairPosition)
return this._colorAtPointWithBrightness(this._crosshairPosition.x*window.devicePixelRatio,this._crosshairPosition.y*window.devicePixelRatio,this._brightness);return new WebInspector.Color(WebInspector.Color.Format.RGBA,[0,0,0,0]);}
set tintedColor(tintedColor)
{var data=this._tintedColorToPointAndBrightness(tintedColor);this._setCrosshairPosition(data.point);this.brightness=data.brightness;}
get rawColor()
{if(this._crosshairPosition)
return this._colorAtPointWithBrightness(this._crosshairPosition.x*window.devicePixelRatio,this._crosshairPosition.y*window.devicePixelRatio,1);return new WebInspector.Color(WebInspector.Color.Format.RGBA,[0,0,0,0]);}
handleEvent(event)
{switch(event.type){case"mousedown":this._handleMousedown(event);break;case"mousemove":this._handleMousemove(event);break;case"mouseup":this._handleMouseup(event);break;}}
_handleMousedown(event)
{window.addEventListener("mousemove",this,true);window.addEventListener("mouseup",this,true);this._updateColorForMouseEvent(event);}
_handleMousemove(event)
{this._updateColorForMouseEvent(event);}
_handleMouseup(event)
{window.removeEventListener("mousemove",this,true);window.removeEventListener("mouseup",this,true);}
_pointInCircleForEvent(event)
{function distance(a,b)
{return Math.sqrt(Math.pow(a.x-b.x,2)+Math.pow(a.y-b.y,2));}
function angleFromCenterToPoint(center,point)
{return Math.atan2(point.y-center.y,point.x-center.x);}
function pointOnCircumference(c,r,a)
{return new WebInspector.Point(c.x+r*Math.cos(a),c.y+r*Math.sin(a));}
var dimension=this._dimension;var point=window.webkitConvertPointFromPageToNode(this._finalCanvas,new WebKitPoint(event.pageX,event.pageY));var center=new WebInspector.Point(dimension/2,dimension/2);if(distance(point,center)>this._radius){var angle=angleFromCenterToPoint(center,point);point=pointOnCircumference(center,this._radius,angle);}
return point;}
_updateColorForMouseEvent(event)
{var point=this._pointInCircleForEvent(event);this._setCrosshairPosition(point);if(this.delegate&&typeof this.delegate.colorWheelColorDidChange==="function")
this.delegate.colorWheelColorDidChange(this);}
_setCrosshairPosition(point)
{this._crosshairPosition=point;this._crosshair.style.webkitTransform="translate("+Math.round(point.x)+"px, "+Math.round(point.y)+"px)";}
_tintedColorToPointAndBrightness(color)
{var rgb=color.rgb;var hsv=WebInspector.Color.rgb2hsv(rgb[0],rgb[1],rgb[2]);var cosHue=Math.cos(hsv[0]*Math.PI/180);var sinHue=Math.sin(hsv[0]*Math.PI/180);var center=this._dimension/2;var x=center+(center*cosHue*hsv[1]);var y=center-(center*sinHue*hsv[1]);return{point:new WebInspector.Point(x,y),brightness:hsv[2]};}
_drawRawCanvas(){var ctx=this._rawCanvas.getContext("2d");var dimension=this._dimension*window.devicePixelRatio;ctx.fillStyle="white";ctx.fillRect(0,0,dimension,dimension);var imageData=ctx.getImageData(0,0,dimension,dimension);var data=imageData.data;for(var j=0;j<dimension;++j){for(var i=0;i<dimension;++i){var color=this._colorAtPointWithBrightness(i,j,1);if(!color)
continue;var pos=(j*dimension+i)*4;data[pos]=color.rgb[0];data[pos+1]=color.rgb[1];data[pos+2]=color.rgb[2];}}
ctx.putImageData(imageData,0,0);}
_colorAtPointWithBrightness(x,y,brightness)
{var center=this._dimension/2*window.devicePixelRatio;var xDis=x-center;var yDis=y-center;var distance=Math.sqrt(xDis*xDis+yDis*yDis);if(distance-center>0.001)
return new WebInspector.Color(WebInspector.Color.Format.RGBA,[0,0,0,0]);var h=Math.atan2(y-center,center-x)*180/Math.PI;h=(h+180)%360;var v=brightness;var s=Math.max(0,distance)/center;var rgb=WebInspector.Color.hsv2rgb(h,s,v);return new WebInspector.Color(WebInspector.Color.Format.RGBA,[Math.round(rgb[0]*255),Math.round(rgb[1]*255),Math.round(rgb[2]*255),1]);}
_drawTintedCanvas()
{var ctx=this._tintedCanvas.getContext("2d");var dimension=this._dimension*window.devicePixelRatio;ctx.save();ctx.drawImage(this._rawCanvas,0,0,dimension,dimension);if(this._brightness!==1){ctx.globalAlpha=1-this._brightness;ctx.fillStyle="black";ctx.fillRect(0,0,dimension,dimension);}
ctx.restore();}
_draw()
{this._drawTintedCanvas();var ctx=this._finalCanvas.getContext("2d");var dimension=this._dimension*window.devicePixelRatio;var radius=this._radius*window.devicePixelRatio;ctx.save();ctx.clearRect(0,0,dimension,dimension);ctx.beginPath();ctx.arc(dimension/2,dimension/2,radius+1,0,Math.PI*2,true);ctx.closePath();ctx.clip();ctx.drawImage(this._tintedCanvas,0,0,dimension,dimension);ctx.restore();}};WebInspector.CompletionSuggestionsView=class CompletionSuggestionsView extends WebInspector.Object
{constructor(delegate)
{super();this._delegate=delegate||null;this._selectedIndex=NaN;this._element=document.createElement("div");this._element.classList.add("completion-suggestions",WebInspector.Popover.IgnoreAutoDismissClassName);this._containerElement=document.createElement("div");this._containerElement.classList.add("completion-suggestions-container");this._containerElement.addEventListener("mousedown",this._mouseDown.bind(this));this._containerElement.addEventListener("mouseup",this._mouseUp.bind(this));this._containerElement.addEventListener("click",this._itemClicked.bind(this));this._element.appendChild(this._containerElement);}
get delegate()
{return this._delegate;}
get visible()
{return!!this._element.parentNode;}
get selectedIndex()
{return this._selectedIndex;}
set selectedIndex(index)
{var selectedItemElement=this._selectedItemElement;if(selectedItemElement)
selectedItemElement.classList.remove(WebInspector.CompletionSuggestionsView.SelectedItemStyleClassName);this._selectedIndex=index;selectedItemElement=this._selectedItemElement;if(!selectedItemElement)
return;selectedItemElement.classList.add(WebInspector.CompletionSuggestionsView.SelectedItemStyleClassName);selectedItemElement.scrollIntoViewIfNeeded(false);}
selectNext()
{var count=this._containerElement.children.length;if(isNaN(this._selectedIndex)||this._selectedIndex===count-1)
this.selectedIndex=0;else
++this.selectedIndex;var selectedItemElement=this._selectedItemElement;if(selectedItemElement&&this._delegate&&typeof this._delegate.completionSuggestionsSelectedCompletion==="function")
this._delegate.completionSuggestionsSelectedCompletion(this,selectedItemElement.textContent);}
selectPrevious()
{if(isNaN(this._selectedIndex)||this._selectedIndex===0)
this.selectedIndex=this._containerElement.children.length-1;else
--this.selectedIndex;var selectedItemElement=this._selectedItemElement;if(selectedItemElement&&this._delegate&&typeof this._delegate.completionSuggestionsSelectedCompletion==="function")
this._delegate.completionSuggestionsSelectedCompletion(this,selectedItemElement.textContent);}
isHandlingClickEvent()
{return this._mouseIsDown;}
show(anchorBounds)
{this._containerElement.style.position="absolute";document.body.appendChild(this._containerElement);var containerWidth=this._containerElement.offsetWidth;var containerHeight=this._containerElement.offsetHeight;this._containerElement.removeAttribute("style");this._element.appendChild(this._containerElement);var margin=10;var horizontalPadding=22;var absoluteMaximumHeight=160;var x=anchorBounds.origin.x;var y=anchorBounds.origin.y+anchorBounds.size.height;var maximumWidth=window.innerWidth-anchorBounds.origin.x-margin;var width=Math.min(containerWidth,maximumWidth-horizontalPadding)+horizontalPadding;var paddedWidth=containerWidth+horizontalPadding;if(width<paddedWidth){maximumWidth=window.innerWidth-margin;width=Math.min(containerWidth,maximumWidth-horizontalPadding)+horizontalPadding;x=document.body.offsetWidth-width;}
var aboveHeight=anchorBounds.origin.y;var underHeight=window.innerHeight-anchorBounds.origin.y-anchorBounds.size.height;var maximumHeight=Math.min(absoluteMaximumHeight,Math.max(underHeight,aboveHeight)-margin);var height=Math.min(containerHeight,maximumHeight);if(underHeight-height<0)
y=aboveHeight-height;this._element.style.left=x+"px";this._element.style.top=y+"px";this._element.style.width=width+"px";this._element.style.height=height+"px";document.body.appendChild(this._element);}
hide()
{this._element.remove();}
update(completions,selectedIndex)
{this._containerElement.removeChildren();if(typeof selectedIndex==="number")
this._selectedIndex=selectedIndex;for(var i=0;i<completions.length;++i){var itemElement=document.createElement("div");itemElement.className=WebInspector.CompletionSuggestionsView.ItemElementStyleClassName;itemElement.textContent=completions[i];if(i===this._selectedIndex)
itemElement.classList.add(WebInspector.CompletionSuggestionsView.SelectedItemStyleClassName);this._containerElement.appendChild(itemElement);if(this._delegate&&typeof this._delegate.completionSuggestionsViewCustomizeCompletionElement==="function")
this._delegate.completionSuggestionsViewCustomizeCompletionElement(this,itemElement,completions[i]);}}
get _selectedItemElement()
{if(isNaN(this._selectedIndex))
return null;var element=this._containerElement.children[this._selectedIndex]||null;return element;}
_mouseDown(event)
{if(event.button!==0)
return;this._mouseIsDown=true;}
_mouseUp(event)
{if(event.button!==0)
return;this._mouseIsDown=false;}
_itemClicked(event)
{if(event.button!==0)
return;var itemElement=event.target.enclosingNodeOrSelfWithClass(WebInspector.CompletionSuggestionsView.ItemElementStyleClassName);if(!itemElement)
return;if(this._delegate&&typeof this._delegate.completionSuggestionsClickedCompletion==="function")
this._delegate.completionSuggestionsClickedCompletion(this,itemElement.textContent);}};WebInspector.CompletionSuggestionsView.ItemElementStyleClassName="item";WebInspector.CompletionSuggestionsView.SelectedItemStyleClassName="selected";WebInspector.ComputedStyleDetailsPanel=class ComputedStyleDetailsPanel extends WebInspector.StyleDetailsPanel
{constructor(delegate)
{super(delegate,WebInspector.ComputedStyleDetailsPanel.StyleClassName,"computed",WebInspector.UIString("Styles \u2014 Computed"));this._computedStyleShowAllSetting=new WebInspector.Setting("computed-style-show-all",false);this.cssStyleDeclarationTextEditorShouldAddPropertyGoToArrows=true;}
get regionFlow(){return this._regionFlow;}
set regionFlow(regionFlow)
{this._regionFlow=regionFlow;this._regionFlowNameLabelValue.textContent=regionFlow?regionFlow.name:"";this._regionFlowNameRow.value=regionFlow?this._regionFlowFragment:null;this._updateFlowNamesSectionVisibility();}
get contentFlow(){return this._contentFlow;}
set contentFlow(contentFlow)
{this._contentFlow=contentFlow;this._contentFlowNameLabelValue.textContent=contentFlow?contentFlow.name:"";this._contentFlowNameRow.value=contentFlow?this._contentFlowFragment:null;this._updateFlowNamesSectionVisibility();}
get containerRegions(){return this._containerRegions;}
set containerRegions(regions)
{this._containerRegions=regions;if(!regions||!regions.length){this._containerRegionsFlowSection.element.classList.add("hidden");return;}
this._containerRegionsDataGrid.removeChildren();for(var regionNode of regions)
this._containerRegionsDataGrid.appendChild(new WebInspector.DOMTreeDataGridNode(regionNode));this._containerRegionsFlowSection.element.classList.remove("hidden");this._containerRegionsDataGrid.updateLayoutIfNeeded();}
cssStyleDeclarationTextEditorShowProperty(property,showSource)
{function delegateShowProperty(){if(typeof this._delegate.computedStyleDetailsPanelShowProperty==="function")
this._delegate.computedStyleDetailsPanelShowProperty(property);}
if(!showSource){delegateShowProperty.call(this);return;}
let effectiveProperty=this._nodeStyles.effectivePropertyForName(property.name);if(!effectiveProperty||!effectiveProperty.styleSheetTextRange){if(!effectiveProperty.relatedShorthandProperty){delegateShowProperty.call(this);return;}
effectiveProperty=effectiveProperty.relatedShorthandProperty;}
let ownerRule=effectiveProperty.ownerStyle.ownerRule;if(!ownerRule){delegateShowProperty.call(this);return;}
let sourceCode=ownerRule.sourceCodeLocation.sourceCode;let{startLine,startColumn}=effectiveProperty.styleSheetTextRange;const options={ignoreNetworkTab:true,ignoreSearchTab:true,};WebInspector.showSourceCodeLocation(sourceCode.createSourceCodeLocation(startLine,startColumn),options);}
refresh(significantChange)
{
if(!significantChange){super.refresh();return;}
this._propertiesTextEditor.style=this.nodeStyles.computedStyle;this._variablesTextEditor.style=this.nodeStyles.computedStyle;this._refreshFlowDetails(this.nodeStyles.node);this._boxModelDiagramRow.nodeStyles=this.nodeStyles;super.refresh();this._variablesSection.element.classList.toggle("hidden",!this._variablesTextEditor.shownProperties.length);}
filterDidChange(filterBar)
{let filterText=filterBar.filters.text;this._propertiesTextEditor.removeNonMatchingProperties(filterText);this._variablesTextEditor.removeNonMatchingProperties(filterText);}
initialLayout()
{let computedStyleShowAllLabel=document.createElement("label");computedStyleShowAllLabel.textContent=WebInspector.UIString("Show All");this._computedStyleShowAllCheckbox=document.createElement("input");this._computedStyleShowAllCheckbox.type="checkbox";this._computedStyleShowAllCheckbox.checked=this._computedStyleShowAllSetting.value;this._computedStyleShowAllCheckbox.addEventListener("change",this._computedStyleShowAllCheckboxValueChanged.bind(this));computedStyleShowAllLabel.appendChild(this._computedStyleShowAllCheckbox);this._propertiesTextEditor=new WebInspector.CSSStyleDeclarationTextEditor(this);this._propertiesTextEditor.propertyVisibilityMode=WebInspector.CSSStyleDeclarationTextEditor.PropertyVisibilityMode.HideVariables;this._propertiesTextEditor.showsImplicitProperties=this._computedStyleShowAllSetting.value;this._propertiesTextEditor.alwaysShowPropertyNames=["display","width","height"];this._propertiesTextEditor.sortProperties=true;let propertiesRow=new WebInspector.DetailsSectionRow;let propertiesGroup=new WebInspector.DetailsSectionGroup([propertiesRow]);let propertiesSection=new WebInspector.DetailsSection("computed-style-properties",WebInspector.UIString("Properties"),[propertiesGroup],computedStyleShowAllLabel);propertiesSection.addEventListener(WebInspector.DetailsSection.Event.CollapsedStateChanged,this._handlePropertiesSectionCollapsedStateChanged,this);this.addSubview(this._propertiesTextEditor);propertiesRow.element.appendChild(this._propertiesTextEditor.element);this._variablesTextEditor=new WebInspector.CSSStyleDeclarationTextEditor(this);this._variablesTextEditor.propertyVisibilityMode=WebInspector.CSSStyleDeclarationTextEditor.PropertyVisibilityMode.HideNonVariables;this._variablesTextEditor.sortProperties=true;let variablesRow=new WebInspector.DetailsSectionRow;let variablesGroup=new WebInspector.DetailsSectionGroup([variablesRow]);this._variablesSection=new WebInspector.DetailsSection("computed-style-properties",WebInspector.UIString("Variables"),[variablesGroup]);this._variablesSection.addEventListener(WebInspector.DetailsSection.Event.CollapsedStateChanged,this._handleVariablesSectionCollapsedStateChanged,this);this.addSubview(this._variablesTextEditor);variablesRow.element.appendChild(this._variablesTextEditor.element);this._regionFlowFragment=document.createElement("span");this._regionFlowFragment.appendChild(document.createElement("img")).className="icon";this._regionFlowNameLabelValue=this._regionFlowFragment.appendChild(document.createElement("span"));let goToRegionFlowButton=this._regionFlowFragment.appendChild(WebInspector.createGoToArrowButton());goToRegionFlowButton.addEventListener("click",this._goToRegionFlowArrowWasClicked.bind(this));this._regionFlowNameRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Region Flow"));this._regionFlowNameRow.element.classList.add("content-flow-link");this._contentFlowFragment=document.createElement("span");this._contentFlowFragment.appendChild(document.createElement("img")).className="icon";this._contentFlowNameLabelValue=this._contentFlowFragment.appendChild(document.createElement("span"));let goToContentFlowButton=this._contentFlowFragment.appendChild(WebInspector.createGoToArrowButton());goToContentFlowButton.addEventListener("click",this._goToContentFlowArrowWasClicked.bind(this));this._contentFlowNameRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Content Flow"));this._contentFlowNameRow.element.classList.add("content-flow-link");let flowNamesGroup=new WebInspector.DetailsSectionGroup([this._regionFlowNameRow,this._contentFlowNameRow]);this._flowNamesSection=new WebInspector.DetailsSection("content-flow",WebInspector.UIString("Flows"),[flowNamesGroup]);this._containerRegionsDataGrid=new WebInspector.DOMTreeDataGrid;this._containerRegionsDataGrid.headerVisible=false;this._containerRegionsRow=new WebInspector.DetailsSectionDataGridRow(this._containerRegionsDataGrid);let containerRegionsGroup=new WebInspector.DetailsSectionGroup([this._containerRegionsRow]);this._containerRegionsFlowSection=new WebInspector.DetailsSection("container-regions",WebInspector.UIString("Container Regions"),[containerRegionsGroup]);this.element.appendChild(propertiesSection.element);this.element.appendChild(this._variablesSection.element);this.element.appendChild(this._flowNamesSection.element);this.element.appendChild(this._containerRegionsFlowSection.element);this._resetFlowDetails();this._boxModelDiagramRow=new WebInspector.BoxModelDetailsSectionRow;let boxModelGroup=new WebInspector.DetailsSectionGroup([this._boxModelDiagramRow]);let boxModelSection=new WebInspector.DetailsSection("style-box-model",WebInspector.UIString("Box Model"),[boxModelGroup]);this.element.appendChild(boxModelSection.element);}
sizeDidChange()
{super.sizeDidChange(); this._containerRegionsRow.sizeDidChange();}
_computedStyleShowAllCheckboxValueChanged(event)
{let checked=this._computedStyleShowAllCheckbox.checked;this._computedStyleShowAllSetting.value=checked;this._propertiesTextEditor.showsImplicitProperties=checked;this._propertiesTextEditor.updateLayout();}
_handlePropertiesSectionCollapsedStateChanged(event)
{if(event&&event.data&&!event.data.collapsed)
this._propertiesTextEditor.refresh();}
_handleVariablesSectionCollapsedStateChanged(event)
{if(event&&event.data&&!event.data.collapsed)
this._variablesTextEditor.refresh();}
_updateFlowNamesSectionVisibility()
{this._flowNamesSection.element.classList.toggle("hidden",!this._contentFlow&&!this._regionFlow);}
_resetFlowDetails()
{this.regionFlow=null;this.contentFlow=null;this.containerRegions=null;}
_refreshFlowDetails(domNode)
{this._resetFlowDetails();if(!domNode)
return;function contentFlowInfoReady(error,flowData)
{if(error||!flowData){this._resetFlowDetails();return;}
this.regionFlow=flowData.regionFlow;this.contentFlow=flowData.contentFlow;this.containerRegions=flowData.regions;}
WebInspector.domTreeManager.getNodeContentFlowInfo(domNode,contentFlowInfoReady.bind(this));}
_goToRegionFlowArrowWasClicked()
{WebInspector.showRepresentedObject(this._regionFlow);}
_goToContentFlowArrowWasClicked()
{WebInspector.showRepresentedObject(this._contentFlow,{nodeToSelect:this.nodeStyles.node});}};WebInspector.ComputedStyleDetailsPanel.StyleClassName="computed";WebInspector.ConsoleDrawer=class ConsoleDrawer extends WebInspector.ContentBrowser
{constructor(element)
{const delegate=null;const disableBackForward=true;const disableFindBanner=false;super(element,delegate,disableBackForward,disableFindBanner);this.element.classList.add("console-drawer");this._drawerHeightSetting=new WebInspector.Setting("console-drawer-height",150);this.navigationBar.element.addEventListener("mousedown",this._consoleResizerMouseDown.bind(this));this._toggleDrawerButton=new WebInspector.ToggleButtonNavigationItem("toggle-drawer",WebInspector.UIString("Hide Console"),WebInspector.UIString("Show Console"),"Images/HideConsoleDrawer.svg","Images/ShowConsoleDrawer.svg");this._toggleDrawerButton.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,()=>{WebInspector.toggleSplitConsole();});this.navigationBar.insertNavigationItem(this._toggleDrawerButton,0);this.collapsed=true;WebInspector.TabBrowser.addEventListener(WebInspector.TabBrowser.Event.SelectedTabContentViewDidChange,this._selectedTabContentViewDidChange,this);}
get collapsed()
{return this._collapsed;}
set collapsed(flag)
{if(flag===this._collapsed)
return;this._collapsed=flag||false;this._toggleDrawerButton.toggled=this._collapsed;this.element.classList.toggle("hidden",this._collapsed);if(this._collapsed)
this.hidden();else
this.shown();this.dispatchEventToListeners(WebInspector.ConsoleDrawer.Event.CollapsedStateChanged);}
get height()
{return this.element.offsetHeight;}
shown()
{super.shown();this._restoreDrawerHeight();}
layout()
{if(this._collapsed)
return;if(this.layoutReason!==WebInspector.View.LayoutReason.Resize)
return;super.layout();let height=this.height;this._restoreDrawerHeight();if(height!==this.height)
this.dispatchEventToListeners(WebInspector.ConsoleDrawer.Event.Resized);}
_consoleResizerMouseDown(event)
{if(event.button!==0||event.ctrlKey)
return;if(event.target!==this.navigationBar.element&&!event.target.classList.contains("flexible-space"))
return;let resizerElement=event.target;let mouseOffset=resizerElement.offsetHeight-(event.pageY-resizerElement.totalOffsetTop);function dockedResizerDrag(event)
{let height=window.innerHeight-event.pageY-mouseOffset;this._drawerHeightSetting.value=height;this._updateDrawerHeight(height);this.collapsed=false;}
function dockedResizerDragEnd(event)
{if(event.button!==0)
return;WebInspector.elementDragEnd(event);}
WebInspector.elementDragStart(resizerElement,dockedResizerDrag.bind(this),dockedResizerDragEnd.bind(this),event,"row-resize");}
_restoreDrawerHeight()
{this._updateDrawerHeight(this._drawerHeightSetting.value);}
_updateDrawerHeight(height)
{const minimumHeight=64;const maximumHeight=this.element.parentNode.offsetHeight-100;height=Number.constrain(height,minimumHeight,maximumHeight);if(height===this.element.style.height)
return;this.element.style.height=height+"px";this.dispatchEventToListeners(WebInspector.ConsoleDrawer.Event.Resized);}
_selectedTabContentViewDidChange()
{if(WebInspector.doesCurrentTabSupportSplitContentBrowser())
return;this.element.classList.add("hidden");}};WebInspector.ConsoleDrawer.Event={CollapsedStateChanged:"console-drawer-collapsed-state-changed",Resized:"console-drawer-resized",};WebInspector.ConsoleGroup=class ConsoleGroup extends WebInspector.Object
{constructor(parentGroup)
{super();this._parentGroup=parentGroup;}
get parentGroup()
{return this._parentGroup;}
render(messageView)
{var groupElement=document.createElement("div");groupElement.className="console-group";groupElement.group=this;this.element=groupElement;var titleElement=messageView.element;titleElement.classList.add(WebInspector.LogContentView.ItemWrapperStyleClassName);titleElement.addEventListener("click",this._titleClicked.bind(this));titleElement.addEventListener("mousedown",this._titleMouseDown.bind(this));if(groupElement&&messageView.message.type===WebInspector.ConsoleMessage.MessageType.StartGroupCollapsed)
groupElement.classList.add("collapsed");groupElement.appendChild(titleElement);var messagesElement=document.createElement("div");this._messagesElement=messagesElement;messagesElement.className="console-group-messages";groupElement.appendChild(messagesElement);return groupElement;}
addMessageView(messageView)
{var element=messageView.element;element.classList.add(WebInspector.LogContentView.ItemWrapperStyleClassName);this.append(element);}
append(messageOrGroupElement)
{this._messagesElement.appendChild(messageOrGroupElement);}
_titleMouseDown(event)
{event.preventDefault();}
_titleClicked(event)
{var groupTitleElement=event.target.enclosingNodeOrSelfWithClass("console-group-title");if(groupTitleElement){var groupElement=groupTitleElement.enclosingNodeOrSelfWithClass("console-group");if(groupElement)
if(groupElement.classList.contains("collapsed"))
groupElement.classList.remove("collapsed");else
groupElement.classList.add("collapsed");groupTitleElement.scrollIntoViewIfNeeded(true);}}};WebInspector.ConsolePrompt=class ConsolePrompt extends WebInspector.View
{constructor(delegate,mimeType)
{super();mimeType=parseMIMEType(mimeType).type;this.element.classList.add("console-prompt",WebInspector.SyntaxHighlightedStyleClassName);this._delegate=delegate||null;this._codeMirror=WebInspector.CodeMirrorEditor.create(this.element,{lineWrapping:true,mode:{name:mimeType,globalVars:true},indentWithTabs:true,indentUnit:4,matchBrackets:true});var keyMap={"Up":this._handlePreviousKey.bind(this),"Down":this._handleNextKey.bind(this),"Ctrl-P":this._handlePreviousKey.bind(this),"Ctrl-N":this._handleNextKey.bind(this),"Enter":this._handleEnterKey.bind(this),"Cmd-Enter":this._handleCommandEnterKey.bind(this),"Tab":this._handleTabKey.bind(this),"Esc":this._handleEscapeKey.bind(this)};this._codeMirror.addKeyMap(keyMap);this._completionController=new WebInspector.CodeMirrorCompletionController(this._codeMirror,this);this._completionController.addExtendedCompletionProvider("javascript",WebInspector.javaScriptRuntimeCompletionProvider);this._history=[{}];this._historyIndex=0;}
get delegate()
{return this._delegate;}
set delegate(delegate)
{this._delegate=delegate||null;}
set escapeKeyHandlerWhenEmpty(handler)
{this._escapeKeyHandlerWhenEmpty=handler;}
get text()
{return this._codeMirror.getValue();}
set text(text)
{this._codeMirror.setValue(text||"");this._codeMirror.clearHistory();this._codeMirror.markClean();}
get history()
{this._history[this._historyIndex]=this._historyEntryForCurrentText();return this._history;}
set history(history)
{this._history=history instanceof Array?history.slice(0,WebInspector.ConsolePrompt.MaximumHistorySize):[{}];this._historyIndex=0;this._restoreHistoryEntry(0);}
get focused()
{return this._codeMirror.getWrapperElement().classList.contains("CodeMirror-focused");}
focus()
{this._codeMirror.focus();}
updateCompletions(completions,implicitSuffix)
{this._completionController.updateCompletions(completions,implicitSuffix);}
pushHistoryItem(text)
{this._commitHistoryEntry({text});}
completionControllerCompletionsNeeded(completionController,prefix,defaultCompletions,base,suffix,forced)
{if(this.delegate&&typeof this.delegate.consolePromptCompletionsNeeded==="function")
this.delegate.consolePromptCompletionsNeeded(this,defaultCompletions,base,prefix,suffix,forced);else
this._completionController.updateCompletions(defaultCompletions);}
completionControllerShouldAllowEscapeCompletion(completionController)
{
return!!this.text;}
layout()
{this._codeMirror.refresh();}
_handleTabKey(codeMirror)
{var cursor=codeMirror.getCursor();var line=codeMirror.getLine(cursor.line);if(!line.trim().length)
return CodeMirror.Pass;var firstNonSpace=line.search(/[^\s]/);if(cursor.ch<=firstNonSpace)
return CodeMirror.Pass;this._completionController.completeAtCurrentPositionIfNeeded().then(function(result){if(result===WebInspector.CodeMirrorCompletionController.UpdatePromise.NoCompletionsFound)
InspectorFrontendHost.beep();});}
_handleEscapeKey(codeMirror)
{if(this.text)
return CodeMirror.Pass;if(!this._escapeKeyHandlerWhenEmpty)
return CodeMirror.Pass;this._escapeKeyHandlerWhenEmpty();}
_handlePreviousKey(codeMirror)
{if(this._codeMirror.somethingSelected())
return CodeMirror.Pass;if(this._codeMirror.getCursor().line)
return CodeMirror.Pass;var historyEntry=this._history[this._historyIndex+1];if(!historyEntry)
return CodeMirror.Pass;this._rememberCurrentTextInHistory();++this._historyIndex;this._restoreHistoryEntry(this._historyIndex);}
_handleNextKey(codeMirror)
{if(this._codeMirror.somethingSelected())
return CodeMirror.Pass;if(this._codeMirror.getCursor().line!==this._codeMirror.lastLine())
return CodeMirror.Pass;var historyEntry=this._history[this._historyIndex-1];if(!historyEntry)
return CodeMirror.Pass;this._rememberCurrentTextInHistory();--this._historyIndex;this._restoreHistoryEntry(this._historyIndex);}
_handleEnterKey(codeMirror,forceCommit,keepCurrentText)
{var currentText=this.text;if(!currentText.trim())
return;var cursor=this._codeMirror.getCursor();var lastLine=this._codeMirror.lastLine();var lastLineLength=this._codeMirror.getLine(lastLine).length;var cursorIsAtLastPosition=positionsEqual(cursor,{line:lastLine,ch:lastLineLength});function positionsEqual(a,b)
{return a.line===b.line&&a.ch===b.ch;}
function commitTextOrInsertNewLine(commit)
{if(!commit){if(positionsEqual(cursor,this._codeMirror.getCursor()))
CodeMirror.commands.newlineAndIndent(this._codeMirror);return;}
this._commitHistoryEntry(this._historyEntryForCurrentText());if(!keepCurrentText){this._codeMirror.setValue("");this._codeMirror.clearHistory();}
if(this.delegate&&typeof this.delegate.consolePromptHistoryDidChange==="function")
this.delegate.consolePromptHistoryDidChange(this);if(this.delegate&&typeof this.delegate.consolePromptTextCommitted==="function")
this.delegate.consolePromptTextCommitted(this,currentText);}
if(!forceCommit&&this.delegate&&typeof this.delegate.consolePromptShouldCommitText==="function"){this.delegate.consolePromptShouldCommitText(this,currentText,cursorIsAtLastPosition,commitTextOrInsertNewLine.bind(this));return;}
commitTextOrInsertNewLine.call(this,true);}
_commitHistoryEntry(historyEntry)
{if(this._history[1]&&(!this._history[1].text||this._history[1].text===historyEntry.text)){this._history[1]=historyEntry;this._history[0]={};}else{this._history[0]=historyEntry;this._history.unshift({});if(this._history.length>WebInspector.ConsolePrompt.MaximumHistorySize)
this._history=this._history.slice(0,WebInspector.ConsolePrompt.MaximumHistorySize);}
this._historyIndex=0;}
_handleCommandEnterKey(codeMirror)
{this._handleEnterKey(codeMirror,true,true);}
_restoreHistoryEntry(index)
{var historyEntry=this._history[index];this._codeMirror.setValue(historyEntry.text||"");if(historyEntry.undoHistory)
this._codeMirror.setHistory(historyEntry.undoHistory);else
this._codeMirror.clearHistory();this._codeMirror.setCursor(historyEntry.cursor||{line:0});}
_historyEntryForCurrentText()
{return{text:this.text,undoHistory:this._codeMirror.getHistory(),cursor:this._codeMirror.getCursor()};}
_rememberCurrentTextInHistory()
{this._history[this._historyIndex]=this._historyEntryForCurrentText();if(this.delegate&&typeof this.delegate.consolePromptHistoryDidChange==="function")
this.delegate.consolePromptHistoryDidChange(this);}};WebInspector.ConsolePrompt.MaximumHistorySize=30;WebInspector.ConsoleSession=class ConsoleSession extends WebInspector.Object
{constructor(data)
{super();this._hasMessages=false;let element=document.createElement("div");element.className="console-session";let header=document.createElement("div");header.classList.add("console-session-header");let headerText="";switch(data.newSessionReason){case WebInspector.ConsoleSession.NewSessionReason.PageReloaded:headerText=WebInspector.UIString("Page reloaded at %s");break;case WebInspector.ConsoleSession.NewSessionReason.PageNavigated:headerText=WebInspector.UIString("Page navigated at %s");break;case WebInspector.ConsoleSession.NewSessionReason.ConsoleCleared:headerText=WebInspector.UIString("Console cleared at %s");break;default:headerText=WebInspector.UIString("Console opened at %s");break;}
let timestamp=data.timestamp||Date.now();header.textContent=headerText.format(new Date(timestamp).toLocaleTimeString());element.append(header);this.element=element;this._messagesElement=element;}
addMessageView(messageView)
{var messageElement=messageView.element;messageElement.classList.add(WebInspector.LogContentView.ItemWrapperStyleClassName);this.append(messageElement);}
append(messageOrGroupElement)
{this._hasMessages=true;this._messagesElement.append(messageOrGroupElement);}
hasMessages()
{return this._hasMessages;}};WebInspector.ConsoleSession.NewSessionReason={PageReloaded:Symbol("Page reloaded"),PageNavigated:Symbol("Page navigated"),ConsoleCleared:Symbol("Console cleared"),};WebInspector.ContentFlowDOMTreeContentView=class ContentFlowDOMTreeContentView extends WebInspector.DOMTreeContentView
{constructor(contentFlow)
{super(contentFlow);contentFlow.addEventListener(WebInspector.ContentFlow.Event.ContentNodeWasAdded,this._contentNodeWasAdded,this);contentFlow.addEventListener(WebInspector.ContentFlow.Event.ContentNodeWasRemoved,this._contentNodeWasRemoved,this);this._createContentTrees();}
closed()
{this.representedObject.removeEventListener(null,null,this);super.closed();}
getSearchContextNodes(callback)
{callback(this.domTreeOutline.children.map(function(treeOutline){return treeOutline.representedObject.id;}));}
_createContentTrees()
{var contentNodes=this.representedObject.contentNodes;for(var contentNode of contentNodes)
this.domTreeOutline.appendChild(new WebInspector.DOMTreeElement(contentNode));var documentURL=contentNodes.length?contentNodes[0].ownerDocument.documentURL:null;this._restoreSelectedNodeAfterUpdate(documentURL,contentNodes[0]);}
_contentNodeWasAdded(event)
{var treeElement=new WebInspector.DOMTreeElement(event.data.node);if(!event.data.before){this.domTreeOutline.appendChild(treeElement);return;}
var beforeElement=this.domTreeOutline.findTreeElement(event.data.before);var index=this.domTreeOutline.children.indexOf(beforeElement);this.domTreeOutline.insertChild(treeElement,index);}
_contentNodeWasRemoved(event)
{var treeElement=this.domTreeOutline.findTreeElement(event.data.node);this.domTreeOutline.removeChild(treeElement);}};WebInspector.ContentFlowTreeElement=class ContentFlowTreeElement extends WebInspector.GeneralTreeElement
{constructor(representedObject)
{super("content-flow-icon",representedObject.name,null,representedObject,false);}};WebInspector.ContentViewContainer=class ContentViewContainer extends WebInspector.View
{constructor()
{super();this.element.classList.add("content-view-container");this._backForwardList=[];this._currentIndex=-1;}
get currentIndex()
{return this._currentIndex;}
get backForwardList()
{return this._backForwardList;}
get currentContentView()
{if(this._currentIndex<0||this._currentIndex>this._backForwardList.length-1)
return null;return this._backForwardList[this._currentIndex].contentView;}
get currentBackForwardEntry()
{if(this._currentIndex<0||this._currentIndex>this._backForwardList.length-1)
return null;return this._backForwardList[this._currentIndex];}
contentViewForRepresentedObject(representedObject,onlyExisting,extraArguments)
{return WebInspector.ContentView.contentViewForRepresentedObject(representedObject,onlyExisting,extraArguments);}
showContentViewForRepresentedObject(representedObject,extraArguments)
{var contentView=this.contentViewForRepresentedObject(representedObject,false,extraArguments);if(!contentView)
return null;this.showContentView(contentView);return contentView;}
showContentView(contentView,cookie)
{if(!(contentView instanceof WebInspector.ContentView))
return null;
if(contentView.parentContainer!==this)
this._takeOwnershipOfContentView(contentView);let currentEntry=this.currentBackForwardEntry;
let provisionalEntry=null;for(let i=this._backForwardList.length-1;i>=0;--i){if(this._backForwardList[i].contentView===contentView){provisionalEntry=this._backForwardList[i].makeCopy(cookie);break;}}
if(!provisionalEntry)
provisionalEntry=new WebInspector.BackForwardEntry(contentView,cookie);if(provisionalEntry.isEqual(currentEntry)){const shouldCallShown=false;currentEntry.prepareToShow(shouldCallShown);return currentEntry.contentView;}
let newIndex=this._currentIndex+1;let removedEntries=this._backForwardList.splice(newIndex,this._backForwardList.length-newIndex,provisionalEntry);for(let i=0;i<removedEntries.length;++i){let shouldDissociateContentView=!this._backForwardList.some((existingEntry)=>existingEntry.contentView===removedEntries[i].contentView);if(shouldDissociateContentView)
this._disassociateFromContentView(removedEntries[i].contentView,removedEntries[i].tombstone);}
contentView._parentContainer=this;this.showBackForwardEntryForIndex(newIndex);return contentView;}
showBackForwardEntryForIndex(index)
{if(index<0||index>this._backForwardList.length-1)
return;if(this._currentIndex===index)
return;var previousEntry=this.currentBackForwardEntry;this._currentIndex=index;var currentEntry=this.currentBackForwardEntry;var isNewContentView=!previousEntry||!currentEntry.contentView.visible;if(isNewContentView){if(previousEntry)
this._hideEntry(previousEntry);this._showEntry(currentEntry,true);}else
this._showEntry(currentEntry,false);this.dispatchEventToListeners(WebInspector.ContentViewContainer.Event.CurrentContentViewDidChange);}
replaceContentView(oldContentView,newContentView)
{if(!(oldContentView instanceof WebInspector.ContentView))
return;if(!(newContentView instanceof WebInspector.ContentView))
return;if(oldContentView.parentContainer!==this)
return;if(newContentView.parentContainer&&newContentView.parentContainer!==this)
return;var currentlyShowing=this.currentContentView===oldContentView;if(currentlyShowing)
this._hideEntry(this.currentBackForwardEntry);this._disassociateFromContentView(oldContentView,false);newContentView._parentContainer=this;for(var i=0;i<this._backForwardList.length;++i){if(this._backForwardList[i].contentView===oldContentView){let currentCookie=this._backForwardList[i].cookie;this._backForwardList[i]=new WebInspector.BackForwardEntry(newContentView,currentCookie);}}
this._removeIdenticalAdjacentBackForwardEntries();if(currentlyShowing){this._showEntry(this.currentBackForwardEntry,true);this.dispatchEventToListeners(WebInspector.ContentViewContainer.Event.CurrentContentViewDidChange);}}
closeContentView(contentViewToClose)
{if(!this._backForwardList.length){return;}
var allSameContentView=true;for(var i=this._backForwardList.length-1;i>=0;--i){if(this._backForwardList[i].contentView!==contentViewToClose){allSameContentView=false;break;}}
if(allSameContentView){this.closeAllContentViews();return;}
var visibleContentView=this.currentContentView;var backForwardListDidChange=false;for(var i=this._backForwardList.length-1;i>=0;--i){var entry=this._backForwardList[i];if(entry.contentView!==contentViewToClose)
continue;if(entry.contentView===visibleContentView)
this._hideEntry(entry);if(this._currentIndex>=i){
--this._currentIndex;}
this._disassociateFromContentView(entry.contentView,entry.tombstone);this._backForwardList.splice(i,1);backForwardListDidChange=true;}
if(backForwardListDidChange)
this._removeIdenticalAdjacentBackForwardEntries();var currentEntry=this.currentBackForwardEntry;if(currentEntry&&currentEntry.contentView!==visibleContentView||backForwardListDidChange){this._showEntry(currentEntry,true);this.dispatchEventToListeners(WebInspector.ContentViewContainer.Event.CurrentContentViewDidChange);}}
closeAllContentViews()
{if(!this._backForwardList.length){return;}
var visibleContentView=this.currentContentView;for(var i=0;i<this._backForwardList.length;++i){var entry=this._backForwardList[i];if(entry.contentView===visibleContentView)
this._hideEntry(entry);this._disassociateFromContentView(entry.contentView,entry.tombstone);}
this._backForwardList=[];this._currentIndex=-1;this.dispatchEventToListeners(WebInspector.ContentViewContainer.Event.CurrentContentViewDidChange);}
canGoBack()
{return this._currentIndex>0;}
canGoForward()
{return this._currentIndex<this._backForwardList.length-1;}
goBack()
{if(!this.canGoBack())
return;this.showBackForwardEntryForIndex(this._currentIndex-1);}
goForward()
{if(!this.canGoForward())
return;this.showBackForwardEntryForIndex(this._currentIndex+1);}
shown()
{var currentEntry=this.currentBackForwardEntry;if(!currentEntry)
return;this._showEntry(currentEntry,true);}
hidden()
{var currentEntry=this.currentBackForwardEntry;if(!currentEntry)
return;this._hideEntry(currentEntry);}
_takeOwnershipOfContentView(contentView)
{if(contentView.parentContainer===this)
return;if(contentView.parentContainer)
contentView.parentContainer._placeTombstonesForContentView(contentView);contentView._parentContainer=this;this._clearTombstonesForContentView(contentView);contentView.dispatchEventToListeners(WebInspector.ContentView.Event.NavigationItemsDidChange);}
_placeTombstonesForContentView(contentView)
{let tombstoneContentViewContainers=this._tombstoneContentViewContainersForContentView(contentView);let visibleContentView=this.currentContentView;for(let entry of this._backForwardList){if(entry.contentView!==contentView)
continue;if(entry.contentView===visibleContentView){this._hideEntry(entry);visibleContentView=null;}
entry.tombstone=true;tombstoneContentViewContainers.push(this);}}
_clearTombstonesForContentView(contentView)
{let tombstoneContentViewContainers=this._tombstoneContentViewContainersForContentView(contentView);const onlyFirst=false;tombstoneContentViewContainers.remove(this,onlyFirst);for(let entry of this._backForwardList){if(entry.contentView!==contentView)
continue;entry.tombstone=false;}}
_disassociateFromContentView(contentView,isTombstone)
{if(isTombstone){let tombstoneContentViewContainers=this._tombstoneContentViewContainersForContentView(contentView);const onlyFirst=true;tombstoneContentViewContainers.remove(this,onlyFirst);return;}
if(!contentView._parentContainer)
return;contentView._parentContainer=null;
let tombstoneContentViewContainers=this._tombstoneContentViewContainersForContentView(contentView);if(tombstoneContentViewContainers&&tombstoneContentViewContainers.length){tombstoneContentViewContainers[0]._takeOwnershipOfContentView(contentView);return;}
contentView.closed();if(contentView.representedObject)
WebInspector.ContentView.closedContentViewForRepresentedObject(contentView.representedObject);}
_showEntry(entry,shouldCallShown)
{
if(entry.tombstone){this._takeOwnershipOfContentView(entry.contentView);}
if(!this.subviews.includes(entry.contentView))
this.addSubview(entry.contentView);entry.prepareToShow(shouldCallShown);}
_hideEntry(entry)
{
if(entry.tombstone)
return;entry.prepareToHide();if(this.subviews.includes(entry.contentView))
this.removeSubview(entry.contentView);}
_tombstoneContentViewContainersForContentView(contentView)
{let tombstoneContentViewContainers=contentView[WebInspector.ContentViewContainer.TombstoneContentViewContainersSymbol];if(!tombstoneContentViewContainers)
tombstoneContentViewContainers=contentView[WebInspector.ContentViewContainer.TombstoneContentViewContainersSymbol]=[];return tombstoneContentViewContainers;}
_removeIdenticalAdjacentBackForwardEntries()
{if(this._backForwardList.length<2)
return;let previousEntry;for(let i=this._backForwardList.length-1;i>=0;--i){let entry=this._backForwardList[i];if(!entry.isEqual(previousEntry)){previousEntry=entry;continue;}
if(this._currentIndex>=i){
--this._currentIndex;}
this._backForwardList.splice(i,1);}}};WebInspector.ContentViewContainer.Event={CurrentContentViewDidChange:"content-view-container-current-content-view-did-change"};WebInspector.ContentViewContainer.TombstoneContentViewContainersSymbol=Symbol("content-view-container-tombstone-content-view-containers");WebInspector.ContextMenuItem=class ContextMenuItem extends WebInspector.Object
{constructor(topLevelMenu,type,label,disabled,checked)
{super();this._type=type;this._label=label;this._disabled=disabled;this._checked=checked;this._contextMenu=topLevelMenu||this;if(type==="item"||type==="checkbox")
this._id=topLevelMenu.nextId();}
id()
{return this._id;}
type()
{return this._type;}
isEnabled()
{return!this._disabled;}
setEnabled(enabled)
{this._disabled=!enabled;}
_buildDescriptor()
{switch(this._type){case"item":return{type:"item",id:this._id,label:this._label,enabled:!this._disabled};case"separator":return{type:"separator"};case"checkbox":return{type:"checkbox",id:this._id,label:this._label,checked:!!this._checked,enabled:!this._disabled};}}};WebInspector.ContextSubMenuItem=class ContextSubMenuItem extends WebInspector.ContextMenuItem
{constructor(topLevelMenu,label,disabled)
{super(topLevelMenu,"subMenu",label,disabled);this._items=[];}
appendItem(label,handler,disabled)
{let item=new WebInspector.ContextMenuItem(this._contextMenu,"item",label,disabled);this._pushItem(item);this._contextMenu._setHandler(item.id(),handler);return item;}
appendSubMenuItem(label,disabled)
{let item=new WebInspector.ContextSubMenuItem(this._contextMenu,label,disabled);this._pushItem(item);return item;}
appendCheckboxItem(label,handler,checked,disabled)
{let item=new WebInspector.ContextMenuItem(this._contextMenu,"checkbox",label,disabled,checked);this._pushItem(item);this._contextMenu._setHandler(item.id(),handler);return item;}
appendSeparator()
{if(this._items.length)
this._pendingSeparator=true;}
_pushItem(item)
{if(this._pendingSeparator){this._items.push(new WebInspector.ContextMenuItem(this._contextMenu,"separator"));this._pendingSeparator=null;}
this._items.push(item);}
isEmpty()
{return!this._items.length;}
_buildDescriptor()
{let subItems=this._items.map((item)=>item._buildDescriptor());return{type:"subMenu",label:this._label,enabled:!this._disabled,subItems};}};WebInspector.ContextMenu=class ContextMenu extends WebInspector.ContextSubMenuItem
{constructor(event)
{super(null,"");this._event=event;this._handlers={};this._id=0;}
static createFromEvent(event,onlyExisting=false)
{if(!event[WebInspector.ContextMenu.ProposedMenuSymbol]&&!onlyExisting)
event[WebInspector.ContextMenu.ProposedMenuSymbol]=new WebInspector.ContextMenu(event);return event[WebInspector.ContextMenu.ProposedMenuSymbol]||null;}
static contextMenuItemSelected(id)
{if(WebInspector.ContextMenu._lastContextMenu)
WebInspector.ContextMenu._lastContextMenu._itemSelected(id);}
static contextMenuCleared()
{
}
nextId()
{return this._id++;}
show()
{let menuObject=this._buildDescriptor();if(menuObject.length){WebInspector.ContextMenu._lastContextMenu=this;if(this._event.type!=="contextmenu"&&typeof InspectorFrontendHost.dispatchEventAsContextMenuEvent==="function"){this._menuObject=menuObject;this._event.target.addEventListener("contextmenu",this,true);InspectorFrontendHost.dispatchEventAsContextMenuEvent(this._event);}else
InspectorFrontendHost.showContextMenu(this._event,menuObject);}
if(this._event)
this._event.stopImmediatePropagation();}
handleEvent(event)
{this._event.target.removeEventListener("contextmenu",this,true);InspectorFrontendHost.showContextMenu(event,this._menuObject);this._menuObject=null;event.stopImmediatePropagation();}
_setHandler(id,handler)
{if(handler)
this._handlers[id]=handler;}
_buildDescriptor()
{return this._items.map((item)=>item._buildDescriptor());}
_itemSelected(id)
{if(this._handlers[id])
this._handlers[id].call(this);}};WebInspector.ContextMenu.ProposedMenuSymbol=Symbol("context-menu-proposed-menu");WebInspector.appendContextMenuItemsForSourceCode=function(contextMenu,sourceCodeOrLocation)
{if(!(contextMenu instanceof WebInspector.ContextMenu))
return;let sourceCode=sourceCodeOrLocation;let location=null;if(sourceCodeOrLocation instanceof WebInspector.SourceCodeLocation){sourceCode=sourceCodeOrLocation.sourceCode;location=sourceCodeOrLocation;}
if(!(sourceCode instanceof WebInspector.SourceCode))
return;contextMenu.appendSeparator();if(sourceCode.url){contextMenu.appendItem(WebInspector.UIString("Open in New Tab"),()=>{const frame=null;WebInspector.openURL(sourceCode.url,frame,{alwaysOpenExternally:true});});if(WebInspector.frameResourceManager.resourceForURL(sourceCode.url)&&!WebInspector.isShowingResourcesTab()){contextMenu.appendItem(WebInspector.UIString("Reveal in Resources Tab"),()=>{const options={ignoreNetworkTab:true};if(location)
WebInspector.showSourceCodeLocation(location,options);else
WebInspector.showSourceCode(sourceCode,options);});}
contextMenu.appendItem(WebInspector.UIString("Copy Link Address"),()=>{InspectorFrontendHost.copyText(sourceCode.url);});}
if(sourceCode instanceof WebInspector.Resource){if(sourceCode.urlComponents.scheme!=="data"){contextMenu.appendItem(WebInspector.UIString("Copy as cURL"),()=>{sourceCode.generateCURLCommand();});}}
contextMenu.appendItem(WebInspector.UIString("Save File"),()=>{sourceCode.requestContent().then(()=>{const forceSaveAs=true;WebInspector.saveDataToFile({url:sourceCode.url||"",content:sourceCode.content},forceSaveAs);});});contextMenu.appendSeparator();if(location&&(sourceCode instanceof WebInspector.Script||(sourceCode instanceof WebInspector.Resource&&sourceCode.type===WebInspector.Resource.Type.Script))){let existingBreakpoint=WebInspector.debuggerManager.breakpointForSourceCodeLocation(location);if(existingBreakpoint){contextMenu.appendItem(WebInspector.UIString("Delete Breakpoint"),()=>{WebInspector.debuggerManager.removeBreakpoint(existingBreakpoint);});}else{contextMenu.appendItem(WebInspector.UIString("Add Breakpoint"),()=>{WebInspector.debuggerManager.addBreakpoint(new WebInspector.Breakpoint(location));});}
contextMenu.appendSeparator();}};WebInspector.appendContextMenuItemsForDOMNode=function(contextMenu,domNode,options={})
{if(!(contextMenu instanceof WebInspector.ContextMenu))
return;if(!(domNode instanceof WebInspector.DOMNode))
return;let isElement=domNode.nodeType()===Node.ELEMENT_NODE;contextMenu.appendSeparator();if(domNode.ownerDocument&&isElement){contextMenu.appendItem(WebInspector.UIString("Copy Selector Path"),()=>{let cssPath=WebInspector.cssPath(domNode);InspectorFrontendHost.copyText(cssPath);});}
if(domNode.ownerDocument&&!domNode.isPseudoElement()){contextMenu.appendItem(WebInspector.UIString("Copy XPath"),()=>{let xpath=WebInspector.xpath(domNode);InspectorFrontendHost.copyText(xpath);});}
if(domNode.isCustomElement()){contextMenu.appendSeparator();contextMenu.appendItem(WebInspector.UIString("Jump to Definition"),()=>{function didGetFunctionDetails(error,response){if(error)
return;let location=response.location;let sourceCode=WebInspector.debuggerManager.scriptForIdentifier(location.scriptId,WebInspector.mainTarget);if(!sourceCode)
return;let sourceCodeLocation=sourceCode.createSourceCodeLocation(location.lineNumber,location.columnNumber||0);WebInspector.showSourceCodeLocation(sourceCodeLocation,{ignoreNetworkTab:true,ignoreSearchTab:true,});}
function didGetProperty(error,result,wasThrown){if(error||result.type!=="function")
return;DebuggerAgent.getFunctionDetails(result.objectId,didGetFunctionDetails);result.release();}
function didResolveNode(remoteObject){if(!remoteObject)
return;remoteObject.getProperty("constructor",didGetProperty);remoteObject.release();}
WebInspector.RemoteObject.resolveNode(domNode,"",didResolveNode);});}
if(WebInspector.domDebuggerManager.supported&&isElement&&!domNode.isPseudoElement()&&domNode.ownerDocument){contextMenu.appendSeparator();const allowEditing=false;WebInspector.DOMBreakpointTreeController.appendBreakpointContextMenuItems(contextMenu,domNode,allowEditing);}
contextMenu.appendSeparator();if(!options.excludeRevealElement&&domNode.ownerDocument){contextMenu.appendItem(WebInspector.UIString("Reveal in DOM Tree"),()=>{WebInspector.domTreeManager.inspectElement(domNode.id);});}
if(!options.excludeLogElement&&!domNode.isInUserAgentShadowTree()&&!domNode.isPseudoElement()){let label=isElement?WebInspector.UIString("Log Element"):WebInspector.UIString("Log Node");contextMenu.appendItem(label,()=>{WebInspector.RemoteObject.resolveNode(domNode,WebInspector.RuntimeManager.ConsoleObjectGroup,(remoteObject)=>{if(!remoteObject)
return;let text=isElement?WebInspector.UIString("Selected Element"):WebInspector.UIString("Selected Node");const addSpecialUserLogClass=true;WebInspector.consoleLogViewController.appendImmediateExecutionWithResult(text,remoteObject,addSpecialUserLogClass);});});}};WebInspector.ControlToolbarItem=class ControlToolbarItem extends WebInspector.ButtonNavigationItem
{constructor(identifier,toolTip,image,imageWidth,imageHeight)
{super(identifier,toolTip,image,imageWidth,imageHeight,false);}
get additionalClassNames()
{return["control"];}};WebInspector.CookieStorageContentView=class CookieStorageContentView extends WebInspector.ContentView
{constructor(representedObject)
{super(representedObject);this.element.classList.add("cookie-storage");this._refreshButtonNavigationItem=new WebInspector.ButtonNavigationItem("cookie-storage-refresh",WebInspector.UIString("Refresh"),"Images/ReloadFull.svg",13,13);this._refreshButtonNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,this._refreshButtonClicked,this);this.update();}
get navigationItems()
{return[this._refreshButtonNavigationItem];}
update()
{PageAgent.getCookies().then((payload)=>{this._cookies=this._filterCookies(payload.cookies);this._rebuildTable();}).catch((error)=>{console.error("Could not fetch cookies: ",error);});}
saveToCookie(cookie)
{cookie.type=WebInspector.ContentViewCookieType.CookieStorage;cookie.host=this.representedObject.host;}
get scrollableElements()
{if(!this._dataGrid)
return[];return[this._dataGrid.scrollContainer];}
_rebuildTable()
{if(!this._dataGrid){var columns={name:{},value:{},domain:{},path:{},expires:{},size:{},http:{},secure:{}};columns.name.title=WebInspector.UIString("Name");columns.name.sortable=true;columns.name.width="24%";columns.name.locked=true;columns.value.title=WebInspector.UIString("Value");columns.value.sortable=true;columns.value.width="34%";columns.value.locked=true;columns.domain.title=WebInspector.UIString("Domain");columns.domain.sortable=true;columns.domain.width="7%";columns.path.title=WebInspector.UIString("Path");columns.path.sortable=true;columns.path.width="7%";columns.expires.title=WebInspector.UIString("Expires");columns.expires.sortable=true;columns.expires.width="7%";columns.size.title=WebInspector.UIString("Size");columns.size.aligned="right";columns.size.sortable=true;columns.size.width="7%";columns.http.title=WebInspector.UIString("HTTP");columns.http.aligned="centered";columns.http.sortable=true;columns.http.width="7%";columns.secure.title=WebInspector.UIString("Secure");columns.secure.aligned="centered";columns.secure.sortable=true;columns.secure.width="7%";this._dataGrid=new WebInspector.DataGrid(columns,null,this._deleteCallback.bind(this));this._dataGrid.columnChooserEnabled=true;this._dataGrid.addEventListener(WebInspector.DataGrid.Event.SortChanged,this._sortDataGrid,this);this.addSubview(this._dataGrid);this._dataGrid.updateLayout();}
this._dataGrid.removeChildren();for(var cookie of this._cookies){const checkmark="\u2713";var data={"name":cookie.name,"value":cookie.value,"domain":cookie.domain||"","path":cookie.path||"","expires":"","size":Number.bytesToString(cookie.size),"http":cookie.httpOnly?checkmark:"","secure":cookie.secure?checkmark:"",};if(cookie.type!==WebInspector.CookieType.Request)
data["expires"]=cookie.session?WebInspector.UIString("Session"):new Date(cookie.expires).toLocaleString();var node=new WebInspector.DataGridNode(data);node.cookie=cookie;this._dataGrid.appendChild(node);}
this._dataGrid.sortColumnIdentifier="name";this._dataGrid.createSettings("cookie-storage-content-view");}
_filterCookies(cookies)
{let resourceMatchesStorageDomain=(resource)=>{let urlComponents=resource.urlComponents;return urlComponents&&urlComponents.host&&urlComponents.host===this.representedObject.host;};let allResources=[];for(let frame of WebInspector.frameResourceManager.frames){allResources.push(frame.mainResource);allResources=allResources.concat(frame.resourceCollection.toArray());}
let resourcesForDomain=allResources.filter(resourceMatchesStorageDomain);let cookiesForDomain=cookies.filter((cookie)=>{return resourcesForDomain.some((resource)=>{return WebInspector.CookieStorageObject.cookieMatchesResourceURL(cookie,resource.url);});});return cookiesForDomain;}
_sortDataGrid()
{function localeCompare(field,nodeA,nodeB)
{return(nodeA.data[field]+"").extendedLocaleCompare(nodeB.data[field]+"");}
function numberCompare(field,nodeA,nodeB)
{return nodeA.cookie[field]-nodeB.cookie[field];}
function expiresCompare(nodeA,nodeB)
{if(nodeA.cookie.session!==nodeB.cookie.session)
return nodeA.cookie.session?-1:1;if(nodeA.cookie.session)
return 0;return nodeA.cookie.expires-nodeB.cookie.expires;}
var comparator;switch(this._dataGrid.sortColumnIdentifier){case"value":comparator=localeCompare.bind(this,"value");break;case"domain":comparator=localeCompare.bind(this,"domain");break;case"path":comparator=localeCompare.bind(this,"path");break;case"expires":comparator=expiresCompare;break;case"size":comparator=numberCompare.bind(this,"size");break;case"http":comparator=localeCompare.bind(this,"http");break;case"secure":comparator=localeCompare.bind(this,"secure");break;case"name":default:comparator=localeCompare.bind(this,"name");break;}
this._dataGrid.sortNodes(comparator);}
_deleteCallback(node)
{if(!node||!node.cookie)
return;var cookie=node.cookie;var cookieURL=(cookie.secure?"https://":"http://")+cookie.domain+cookie.path;PageAgent.deleteCookie(cookie.name,cookieURL);this.update();}
_refreshButtonClicked(event)
{this.update();}};WebInspector.CookieType={Request:0,Response:1};WebInspector.CookieStorageTreeElement=class CookieStorageTreeElement extends WebInspector.StorageTreeElement
{constructor(representedObject)
{super("cookie-icon",WebInspector.displayNameForHost(representedObject.host),representedObject);}
get name()
{return this.representedObject.host;}
get categoryName()
{return WebInspector.UIString("Cookies");}};WebInspector.DOMBreakpointTreeElement=class DOMBreakpointTreeElement extends WebInspector.GeneralTreeElement
{constructor(breakpoint,className,title)
{if(!className)
className=WebInspector.BreakpointTreeElement.GenericLineIconStyleClassName;if(!title)
title=WebInspector.DOMBreakpointTreeElement.displayNameForType(breakpoint.type);super(["breakpoint",className],title,null,breakpoint);this._statusImageElement=document.createElement("img");this._statusImageElement.classList.add("status-image","resolved");this.status=this._statusImageElement;breakpoint.addEventListener(WebInspector.DOMBreakpoint.Event.DisabledStateDidChange,this._updateStatus,this);this._updateStatus();}
static displayNameForType(type)
{switch(type){case WebInspector.DOMBreakpoint.Type.SubtreeModified:return WebInspector.UIString("Subtree Modified");case WebInspector.DOMBreakpoint.Type.AttributeModified:return WebInspector.UIString("Attribute Modified");case WebInspector.DOMBreakpoint.Type.NodeRemoved:return WebInspector.UIString("Node Removed");default:console.error("Unexpected DOM breakpoint type: "+type);return null;}}
onattach()
{super.onattach();this._boundStatusImageElementClicked=this._statusImageElementClicked.bind(this);this._boundStatusImageElementFocused=this._statusImageElementFocused.bind(this);this._boundStatusImageElementMouseDown=this._statusImageElementMouseDown.bind(this);this._statusImageElement.addEventListener("click",this._boundStatusImageElementClicked);this._statusImageElement.addEventListener("focus",this._boundStatusImageElementFocused);this._statusImageElement.addEventListener("mousedown",this._boundStatusImageElementMouseDown);}
ondetach()
{super.ondetach();this._statusImageElement.removeEventListener("click",this._boundStatusImageElementClicked);this._statusImageElement.removeEventListener("focus",this._boundStatusImageElementFocused);this._statusImageElement.removeEventListener("mousedown",this._boundStatusImageElementMouseDown);this._boundStatusImageElementClicked=null;this._boundStatusImageElementFocused=null;this._boundStatusImageElementMouseDown=null;}
ondelete()
{WebInspector.domDebuggerManager.removeDOMBreakpoint(this.representedObject);return true;}
onenter()
{this._toggleBreakpoint();return true;}
onspace()
{this._toggleBreakpoint();return true;}
populateContextMenu(contextMenu,event)
{let breakpoint=this.representedObject;let label=breakpoint.disabled?WebInspector.UIString("Enable Breakpoint"):WebInspector.UIString("Disable Breakpoint");contextMenu.appendItem(label,this._toggleBreakpoint.bind(this));contextMenu.appendSeparator();contextMenu.appendItem(WebInspector.UIString("Delete Breakpoint"),function(){WebInspector.domDebuggerManager.removeDOMBreakpoint(breakpoint);});}
_statusImageElementClicked(event)
{this._toggleBreakpoint();}
_statusImageElementFocused(event)
{event.stopPropagation();}
_statusImageElementMouseDown(event)
{event.stopPropagation();}
_toggleBreakpoint()
{this.representedObject.disabled=!this.representedObject.disabled;}
_updateStatus()
{this._statusImageElement.classList.toggle("disabled",this.representedObject.disabled);}};WebInspector.DOMNodeDetailsSidebarPanel=class DOMNodeDetailsSidebarPanel extends WebInspector.DOMDetailsSidebarPanel
{constructor()
{super("dom-node-details",WebInspector.UIString("Node"));this._eventListenerGroupingMethodSetting=new WebInspector.Setting("dom-node-event-listener-grouping-method",WebInspector.DOMNodeDetailsSidebarPanel.EventListenerGroupingMethod.Event);this.element.classList.add("dom-node");this._nodeRemoteObject=null;}
initialLayout()
{super.initialLayout();WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.AttributeModified,this._attributesChanged,this);WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.AttributeRemoved,this._attributesChanged,this);WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.CharacterDataModified,this._characterDataModified,this);WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.CustomElementStateChanged,this._customElementStateChanged,this);this._identityNodeTypeRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Type"));this._identityNodeNameRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Name"));this._identityNodeValueRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Value"));this._identityNodeContentSecurityPolicyHashRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("CSP Hash"));var identityGroup=new WebInspector.DetailsSectionGroup([this._identityNodeTypeRow,this._identityNodeNameRow,this._identityNodeValueRow,this._identityNodeContentSecurityPolicyHashRow]);var identitySection=new WebInspector.DetailsSection("dom-node-identity",WebInspector.UIString("Identity"),[identityGroup]);this._attributesDataGridRow=new WebInspector.DetailsSectionDataGridRow(null,WebInspector.UIString("No Attributes"));var attributesGroup=new WebInspector.DetailsSectionGroup([this._attributesDataGridRow]);var attributesSection=new WebInspector.DetailsSection("dom-node-attributes",WebInspector.UIString("Attributes"),[attributesGroup]);this._propertiesRow=new WebInspector.DetailsSectionRow;var propertiesGroup=new WebInspector.DetailsSectionGroup([this._propertiesRow]);var propertiesSection=new WebInspector.DetailsSection("dom-node-properties",WebInspector.UIString("Properties"),[propertiesGroup]);let eventListenersFilterElement=useSVGSymbol("Images/FilterFieldGlyph.svg","filter",WebInspector.UIString("Grouping Method"));let eventListenersGroupMethodSelectElement=eventListenersFilterElement.appendChild(document.createElement("select"));eventListenersGroupMethodSelectElement.addEventListener("change",(event)=>{this._eventListenerGroupingMethodSetting.value=eventListenersGroupMethodSelectElement.value;this._refreshEventListeners();});function createOption(text,value){let optionElement=eventListenersGroupMethodSelectElement.appendChild(document.createElement("option"));optionElement.value=value;optionElement.textContent=text;}
createOption(WebInspector.UIString("Group by Event"),WebInspector.DOMNodeDetailsSidebarPanel.EventListenerGroupingMethod.Event);createOption(WebInspector.UIString("Group by Node"),WebInspector.DOMNodeDetailsSidebarPanel.EventListenerGroupingMethod.Node);eventListenersGroupMethodSelectElement.value=this._eventListenerGroupingMethodSetting.value;this._eventListenersSectionGroup=new WebInspector.DetailsSectionGroup;let eventListenersSection=new WebInspector.DetailsSection("dom-node-event-listeners",WebInspector.UIString("Event Listeners"),[this._eventListenersSectionGroup],eventListenersFilterElement);this.contentView.element.appendChild(identitySection.element);this.contentView.element.appendChild(attributesSection.element);this.contentView.element.appendChild(propertiesSection.element);this.contentView.element.appendChild(eventListenersSection.element);if(this._accessibilitySupported()){this._accessibilityEmptyRow=new WebInspector.DetailsSectionRow(WebInspector.UIString("No Accessibility Information"));this._accessibilityNodeActiveDescendantRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Shared Focus"));this._accessibilityNodeBusyRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Busy"));this._accessibilityNodeCheckedRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Checked"));this._accessibilityNodeChildrenRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Children"));this._accessibilityNodeControlsRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Controls"));this._accessibilityNodeCurrentRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Current"));this._accessibilityNodeDisabledRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Disabled"));this._accessibilityNodeExpandedRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Expanded"));this._accessibilityNodeFlowsRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Flows"));this._accessibilityNodeFocusedRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Focused"));this._accessibilityNodeHeadingLevelRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Heading Level"));this._accessibilityNodehierarchyLevelRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Hierarchy Level"));this._accessibilityNodeIgnoredRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Ignored"));this._accessibilityNodeInvalidRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Invalid"));this._accessibilityNodeLiveRegionStatusRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Live"));this._accessibilityNodeMouseEventRow=new WebInspector.DetailsSectionSimpleRow("");this._accessibilityNodeLabelRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Label"));this._accessibilityNodeOwnsRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Owns"));this._accessibilityNodeParentRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Parent"));this._accessibilityNodePressedRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Pressed"));this._accessibilityNodeReadonlyRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Readonly"));this._accessibilityNodeRequiredRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Required"));this._accessibilityNodeRoleRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Role"));this._accessibilityNodeSelectedRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Selected"));this._accessibilityNodeSelectedChildrenRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Selected Items"));this._accessibilityGroup=new WebInspector.DetailsSectionGroup([this._accessibilityEmptyRow]);var accessibilitySection=new WebInspector.DetailsSection("dom-node-accessibility",WebInspector.UIString("Accessibility"),[this._accessibilityGroup]);this.contentView.element.appendChild(accessibilitySection.element);}}
layout()
{super.layout();if(!this.domNode)
return;this._refreshIdentity();this._refreshAttributes();this._refreshProperties();this._refreshEventListeners();this._refreshAccessibility();}
sizeDidChange()
{super.sizeDidChange(); this._attributesDataGridRow.sizeDidChange();}
_accessibilitySupported()
{return window.DOMAgent&&DOMAgent.getAccessibilityPropertiesForNode;}
_refreshIdentity()
{const domNode=this.domNode;this._identityNodeTypeRow.value=this._nodeTypeDisplayName();this._identityNodeNameRow.value=domNode.nodeNameInCorrectCase();this._identityNodeValueRow.value=domNode.nodeValue();this._identityNodeContentSecurityPolicyHashRow.value=domNode.contentSecurityPolicyHash();}
_refreshAttributes()
{let domNode=this.domNode;if(!domNode||!domNode.hasAttributes()){this._attributesDataGridRow.dataGrid=null;return;}
let dataGrid=this._attributesDataGridRow.dataGrid;if(!dataGrid){const columns={name:{title:WebInspector.UIString("Name"),width:"30%"},value:{title:WebInspector.UIString("Value")},};dataGrid=this._attributesDataGridRow.dataGrid=new WebInspector.DataGrid(columns);}
dataGrid.removeChildren();let attributes=domNode.attributes();attributes.sort((a,b)=>a.name.extendedLocaleCompare(b.name));for(let attribute of attributes){let dataGridNode=new WebInspector.EditableDataGridNode(attribute);dataGridNode.addEventListener(WebInspector.EditableDataGridNode.Event.ValueChanged,this._attributeNodeValueChanged,this);dataGrid.appendChild(dataGridNode);}
dataGrid.updateLayoutIfNeeded();}
_refreshProperties()
{if(this._nodeRemoteObject){this._nodeRemoteObject.release();this._nodeRemoteObject=null;}
let domNode=this.domNode;RuntimeAgent.releaseObjectGroup(WebInspector.DOMNodeDetailsSidebarPanel.PropertiesObjectGroupName);WebInspector.RemoteObject.resolveNode(domNode,WebInspector.DOMNodeDetailsSidebarPanel.PropertiesObjectGroupName,nodeResolved.bind(this));function nodeResolved(object)
{if(!object)
return;if(this.domNode!==domNode)
return;this._nodeRemoteObject=object;function inspectedPage_node_collectPrototypes()
{
var prototype=this;var result=[];var counter=1;while(prototype){result[counter++]=prototype;prototype=prototype.__proto__;}
return result;}
const args=undefined;const generatePreview=false;object.callFunction(inspectedPage_node_collectPrototypes,args,generatePreview,nodePrototypesReady.bind(this));}
function nodePrototypesReady(error,object,wasThrown)
{if(error||wasThrown||!object)
return;if(this.domNode!==domNode)
return;object.deprecatedGetOwnProperties(fillSection.bind(this));}
function fillSection(prototypes)
{if(!prototypes)
return;if(this.domNode!==domNode)
return;let element=this._propertiesRow.element;element.removeChildren();let propertyPath=new WebInspector.PropertyPath(this._nodeRemoteObject,"node");let initialSection=true;for(let i=0;i<prototypes.length;++i){if(!parseInt(prototypes[i].name,10))
continue;let prototype=prototypes[i].value;let prototypeName=prototype.description;let title=prototypeName;if(/Prototype$/.test(title)){prototypeName=prototypeName.replace(/Prototype$/,"");title=prototypeName+WebInspector.UIString(" (Prototype)");}else if(title==="Object")
title=title+WebInspector.UIString(" (Prototype)");let mode=initialSection?WebInspector.ObjectTreeView.Mode.Properties:WebInspector.ObjectTreeView.Mode.PureAPI;let objectTree=new WebInspector.ObjectTreeView(prototype,mode,propertyPath);objectTree.showOnlyProperties();objectTree.setPrototypeNameOverride(prototypeName);let detailsSection=new WebInspector.DetailsSection(prototype.description.hash+"-prototype-properties",title,null,null,true);detailsSection.groups[0].rows=[new WebInspector.ObjectPropertiesDetailSectionRow(objectTree,detailsSection)];element.appendChild(detailsSection.element);initialSection=false;}}}
_refreshEventListeners()
{var domNode=this.domNode;if(!domNode)
return;function createEventListenerSection(title,eventListeners,options={}){let groups=eventListeners.map((eventListener)=>new WebInspector.EventListenerSectionGroup(eventListener,options));const optionsElement=null;const defaultCollapsedSettingValue=true;let section=new WebInspector.DetailsSection(`${title}-event-listener-section`,title,groups,optionsElement,defaultCollapsedSettingValue);section.element.classList.add("event-listener-section");return section;}
function generateGroupsByEvent(eventListeners){let eventListenerTypes=new Map;for(let eventListener of eventListeners){eventListener.node=WebInspector.domTreeManager.nodeForId(eventListener.nodeId);let eventListenersForType=eventListenerTypes.get(eventListener.type);if(!eventListenersForType)
eventListenerTypes.set(eventListener.type,eventListenersForType=[]);eventListenersForType.push(eventListener);}
let rows=[];let types=Array.from(eventListenerTypes.keys());types.sort();for(let type of types)
rows.push(createEventListenerSection(type,eventListenerTypes.get(type),{hideType:true}));return rows;}
function generateGroupsByNode(eventListeners){let eventListenerNodes=new Map;for(let eventListener of eventListeners){eventListener.node=WebInspector.domTreeManager.nodeForId(eventListener.nodeId);let eventListenersForNode=eventListenerNodes.get(eventListener.node);if(!eventListenersForNode)
eventListenerNodes.set(eventListener.node,eventListenersForNode=[]);eventListenersForNode.push(eventListener);}
let rows=[];let currentNode=domNode;do{let eventListenersForNode=eventListenerNodes.get(currentNode);if(!eventListenersForNode)
continue;eventListenersForNode.sort((a,b)=>a.type.toLowerCase().extendedLocaleCompare(b.type.toLowerCase()));rows.push(createEventListenerSection(currentNode.displayName,eventListenersForNode,{hideNode:true}));}while(currentNode=currentNode.parentNode);return rows;}
function eventListenersCallback(error,eventListeners)
{if(error)
return;if(this.domNode!==domNode)
return;if(!eventListeners.length){var emptyRow=new WebInspector.DetailsSectionRow(WebInspector.UIString("No Event Listeners"));emptyRow.showEmptyMessage();this._eventListenersSectionGroup.rows=[emptyRow];return;}
switch(this._eventListenerGroupingMethodSetting.value){case WebInspector.DOMNodeDetailsSidebarPanel.EventListenerGroupingMethod.Event:this._eventListenersSectionGroup.rows=generateGroupsByEvent.call(this,eventListeners);break;case WebInspector.DOMNodeDetailsSidebarPanel.EventListenerGroupingMethod.Node:this._eventListenersSectionGroup.rows=generateGroupsByNode.call(this,eventListeners);break;}}
domNode.getEventListeners(eventListenersCallback.bind(this));}
_refreshAccessibility()
{if(!this._accessibilitySupported())
return;var domNode=this.domNode;if(!domNode)
return;var properties={};function booleanValueToLocalizedStringIfTrue(property){if(properties[property])
return WebInspector.UIString("Yes");return"";}
function booleanValueToLocalizedStringIfPropertyDefined(property){if(properties[property]!==undefined){if(properties[property])
return WebInspector.UIString("Yes");else
return WebInspector.UIString("No");}
return"";}
function linkForNodeId(nodeId){var link=null;if(nodeId!==undefined&&typeof nodeId==="number"){var node=WebInspector.domTreeManager.nodeForId(nodeId);if(node)
link=WebInspector.linkifyAccessibilityNodeReference(node);}
return link;}
function linkListForNodeIds(nodeIds){if(!nodeIds)
return null;const itemsToShow=5;let hasLinks=false;let listItemCount=0;let container=document.createElement("div");container.classList.add("list-container");let linkList=container.createChild("ul","node-link-list");let initiallyHiddenItems=[];for(let nodeId of nodeIds){let node=WebInspector.domTreeManager.nodeForId(nodeId);if(!node)
continue;let link=WebInspector.linkifyAccessibilityNodeReference(node);hasLinks=true;let li=linkList.createChild("li");li.appendChild(link);if(listItemCount>=itemsToShow){li.hidden=true;initiallyHiddenItems.push(li);}
listItemCount++;}
container.appendChild(linkList);if(listItemCount>itemsToShow){let moreNodesButton=container.createChild("button","expand-list-button");moreNodesButton.textContent=WebInspector.UIString("%d More\u2026").format(listItemCount-itemsToShow);moreNodesButton.addEventListener("click",()=>{initiallyHiddenItems.forEach((element)=>{element.hidden=false;});moreNodesButton.remove();});}
if(hasLinks)
return container;return null;}
function accessibilityPropertiesCallback(accessibilityProperties){if(this.domNode!==domNode)
return;properties=accessibilityProperties;if(accessibilityProperties&&accessibilityProperties.exists){var activeDescendantLink=linkForNodeId(accessibilityProperties.activeDescendantNodeId);var busy=booleanValueToLocalizedStringIfPropertyDefined("busy");var checked="";if(accessibilityProperties.checked!==undefined){if(accessibilityProperties.checked===DOMAgent.AccessibilityPropertiesChecked.True)
checked=WebInspector.UIString("Yes");else if(accessibilityProperties.checked===DOMAgent.AccessibilityPropertiesChecked.Mixed)
checked=WebInspector.UIString("Mixed");else
checked=WebInspector.UIString("No");}
var childNodeLinkList=linkListForNodeIds(accessibilityProperties.childNodeIds);var controlledNodeLinkList=linkListForNodeIds(accessibilityProperties.controlledNodeIds);var current="";switch(accessibilityProperties.current){case DOMAgent.AccessibilityPropertiesCurrent.True:current=WebInspector.UIString("True");break;case DOMAgent.AccessibilityPropertiesCurrent.Page:current=WebInspector.UIString("Page");break;case DOMAgent.AccessibilityPropertiesCurrent.Location:current=WebInspector.UIString("Location");break;case DOMAgent.AccessibilityPropertiesCurrent.Step:current=WebInspector.UIString("Step");break;case DOMAgent.AccessibilityPropertiesCurrent.Date:current=WebInspector.UIString("Date");break;case DOMAgent.AccessibilityPropertiesCurrent.Time:current=WebInspector.UIString("Time");break;default:current="";}
var disabled=booleanValueToLocalizedStringIfTrue("disabled");var expanded=booleanValueToLocalizedStringIfPropertyDefined("expanded");var flowedNodeLinkList=linkListForNodeIds(accessibilityProperties.flowedNodeIds);var focused=booleanValueToLocalizedStringIfPropertyDefined("focused");var ignored="";if(accessibilityProperties.ignored){ignored=WebInspector.UIString("Yes");if(accessibilityProperties.hidden)
ignored=WebInspector.UIString("%s (hidden)").format(ignored);else if(accessibilityProperties.ignoredByDefault)
ignored=WebInspector.UIString("%s (default)").format(ignored);}
var invalid="";if(accessibilityProperties.invalid===DOMAgent.AccessibilityPropertiesInvalid.True)
invalid=WebInspector.UIString("Yes");else if(accessibilityProperties.invalid===DOMAgent.AccessibilityPropertiesInvalid.Grammar)
invalid=WebInspector.UIString("Grammar");else if(accessibilityProperties.invalid===DOMAgent.AccessibilityPropertiesInvalid.Spelling)
invalid=WebInspector.UIString("Spelling");var label=accessibilityProperties.label;var liveRegionStatus="";var liveRegionStatusNode=null;var liveRegionStatusToken=accessibilityProperties.liveRegionStatus;switch(liveRegionStatusToken){case DOMAgent.AccessibilityPropertiesLiveRegionStatus.Assertive:liveRegionStatus=WebInspector.UIString("Assertive");break;case DOMAgent.AccessibilityPropertiesLiveRegionStatus.Polite:liveRegionStatus=WebInspector.UIString("Polite");break;default:liveRegionStatus="";}
if(liveRegionStatus){var liveRegionRelevant=accessibilityProperties.liveRegionRelevant;if(liveRegionRelevant&&liveRegionRelevant.length){if(liveRegionRelevant.length===3&&liveRegionRelevant[0]===DOMAgent.LiveRegionRelevant.Additions&&liveRegionRelevant[1]===DOMAgent.LiveRegionRelevant.Removals&&liveRegionRelevant[2]===DOMAgent.LiveRegionRelevant.Text)
liveRegionRelevant=[WebInspector.UIString("All Changes")];else{liveRegionRelevant=liveRegionRelevant.map(function(value){switch(value){case DOMAgent.LiveRegionRelevant.Additions:return WebInspector.UIString("Additions");case DOMAgent.LiveRegionRelevant.Removals:return WebInspector.UIString("Removals");case DOMAgent.LiveRegionRelevant.Text:return WebInspector.UIString("Text");default:return"\""+value+"\"";}});}
liveRegionStatus+=" ("+liveRegionRelevant.join(", ")+")";}
if(accessibilityProperties.liveRegionAtomic){liveRegionStatusNode=document.createElement("div");liveRegionStatusNode.className="value-with-clarification";liveRegionStatusNode.setAttribute("role","text");liveRegionStatusNode.append(liveRegionStatus);var clarificationNode=document.createElement("div");clarificationNode.className="clarification";clarificationNode.append(WebInspector.UIString("Region announced in its entirety."));liveRegionStatusNode.appendChild(clarificationNode);}}
var mouseEventNodeId=accessibilityProperties.mouseEventNodeId;var mouseEventTextValue="";var mouseEventNodeLink=null;if(mouseEventNodeId){if(mouseEventNodeId===accessibilityProperties.nodeId)
mouseEventTextValue=WebInspector.UIString("Yes");else
mouseEventNodeLink=linkForNodeId(mouseEventNodeId);}
var ownedNodeLinkList=linkListForNodeIds(accessibilityProperties.ownedNodeIds);var parentNodeLink=linkForNodeId(accessibilityProperties.parentNodeId);var pressed=booleanValueToLocalizedStringIfPropertyDefined("pressed");var readonly=booleanValueToLocalizedStringIfTrue("readonly");var required=booleanValueToLocalizedStringIfPropertyDefined("required");var role=accessibilityProperties.role;let hasPopup=accessibilityProperties.isPopupButton;let roleType=null;let buttonType=null;let buttonTypePopupString=WebInspector.UIString("popup");let buttonTypeToggleString=WebInspector.UIString("toggle");let buttonTypePopupToggleString=WebInspector.UIString("popup, toggle");if(role===""||role==="unknown")
role=WebInspector.UIString("No matching ARIA role");else if(role){if(role==="button"){if(pressed)
buttonType=buttonTypeToggleString;
if(hasPopup)
buttonType=buttonType?buttonTypePopupToggleString:buttonTypePopupString;}
if(!domNode.getAttribute("role"))
roleType=WebInspector.UIString("default");else if(buttonType||domNode.getAttribute("role")!==role)
roleType=WebInspector.UIString("computed");if(buttonType&&roleType)
role=WebInspector.UIString("%s (%s, %s)").format(role,buttonType,roleType);else if(roleType||buttonType){let extraInfo=roleType||buttonType;role=WebInspector.UIString("%s (%s)").format(role,extraInfo);}}
var selected=booleanValueToLocalizedStringIfTrue("selected");var selectedChildNodeLinkList=linkListForNodeIds(accessibilityProperties.selectedChildNodeIds);var headingLevel=accessibilityProperties.headingLevel;var hierarchyLevel=accessibilityProperties.hierarchyLevel;this._accessibilityNodeActiveDescendantRow.value=activeDescendantLink||"";this._accessibilityNodeBusyRow.value=busy;this._accessibilityNodeCheckedRow.value=checked;this._accessibilityNodeChildrenRow.value=childNodeLinkList||"";this._accessibilityNodeControlsRow.value=controlledNodeLinkList||"";this._accessibilityNodeCurrentRow.value=current;this._accessibilityNodeDisabledRow.value=disabled;this._accessibilityNodeExpandedRow.value=expanded;this._accessibilityNodeFlowsRow.value=flowedNodeLinkList||"";this._accessibilityNodeFocusedRow.value=focused;this._accessibilityNodeHeadingLevelRow.value=headingLevel||"";this._accessibilityNodehierarchyLevelRow.value=hierarchyLevel||"";this._accessibilityNodeIgnoredRow.value=ignored;this._accessibilityNodeInvalidRow.value=invalid;this._accessibilityNodeLabelRow.value=label;this._accessibilityNodeLiveRegionStatusRow.value=liveRegionStatusNode||liveRegionStatus;this._accessibilityNodeMouseEventRow.label=mouseEventNodeLink?WebInspector.UIString("Click Listener"):WebInspector.UIString("Clickable");this._accessibilityNodeMouseEventRow.value=mouseEventNodeLink||mouseEventTextValue;this._accessibilityNodeOwnsRow.value=ownedNodeLinkList||"";this._accessibilityNodeParentRow.value=parentNodeLink||"";this._accessibilityNodePressedRow.value=pressed;this._accessibilityNodeReadonlyRow.value=readonly;this._accessibilityNodeRequiredRow.value=required;this._accessibilityNodeRoleRow.value=role;this._accessibilityNodeSelectedRow.value=selected;this._accessibilityNodeSelectedChildrenRow.label=WebInspector.UIString("Selected Items");this._accessibilityNodeSelectedChildrenRow.value=selectedChildNodeLinkList||"";if(selectedChildNodeLinkList&&accessibilityProperties.selectedChildNodeIds.length===1)
this._accessibilityNodeSelectedChildrenRow.label=WebInspector.UIString("Selected Item");this._accessibilityGroup.rows=[this._accessibilityNodeIgnoredRow,this._accessibilityNodeRoleRow,this._accessibilityNodeLabelRow,this._accessibilityNodeParentRow,this._accessibilityNodeActiveDescendantRow,this._accessibilityNodeSelectedChildrenRow,this._accessibilityNodeChildrenRow,this._accessibilityNodeOwnsRow,this._accessibilityNodeControlsRow,this._accessibilityNodeFlowsRow,this._accessibilityNodeMouseEventRow,this._accessibilityNodeFocusedRow,this._accessibilityNodeHeadingLevelRow,this._accessibilityNodehierarchyLevelRow,this._accessibilityNodeBusyRow,this._accessibilityNodeLiveRegionStatusRow,this._accessibilityNodeCurrentRow,this._accessibilityNodeDisabledRow,this._accessibilityNodeInvalidRow,this._accessibilityNodeRequiredRow,this._accessibilityNodeCheckedRow,this._accessibilityNodeExpandedRow,this._accessibilityNodePressedRow,this._accessibilityNodeReadonlyRow,this._accessibilityNodeSelectedRow];this._accessibilityEmptyRow.hideEmptyMessage();}else{this._accessibilityGroup.rows=[this._accessibilityEmptyRow];this._accessibilityEmptyRow.showEmptyMessage();}}
domNode.accessibilityProperties(accessibilityPropertiesCallback.bind(this));}
_attributesChanged(event)
{if(event.data.node!==this.domNode)
return;this._refreshAttributes();this._refreshAccessibility();}
_attributeNodeValueChanged(event)
{let change=event.data;let data=event.target.data;if(change.columnIdentifier==="name"){this.domNode.removeAttribute(data[change.columnIdentifier],(error)=>{this.domNode.setAttribute(change.value,`${change.value}="${data.value}"`);});}else if(change.columnIdentifier==="value")
this.domNode.setAttributeValue(data.name,change.value);}
_characterDataModified(event)
{if(event.data.node!==this.domNode)
return;this._identityNodeValueRow.value=this.domNode.nodeValue();}
_customElementStateChanged(event)
{if(event.data.node!==this.domNode)
return;this._refreshIdentity();}
_nodeTypeDisplayName()
{switch(this.domNode.nodeType()){case Node.ELEMENT_NODE:{const nodeName=WebInspector.UIString("Element");const state=this._customElementState();return state===null?nodeName:`${nodeName} (${state})`;}
case Node.TEXT_NODE:return WebInspector.UIString("Text Node");case Node.COMMENT_NODE:return WebInspector.UIString("Comment");case Node.DOCUMENT_NODE:return WebInspector.UIString("Document");case Node.DOCUMENT_TYPE_NODE:return WebInspector.UIString("Document Type");case Node.DOCUMENT_FRAGMENT_NODE:return WebInspector.UIString("Document Fragment");case Node.CDATA_SECTION_NODE:return WebInspector.UIString("Character Data");case Node.PROCESSING_INSTRUCTION_NODE:return WebInspector.UIString("Processing Instruction");default:console.error("Unknown DOM node type: ",this.domNode.nodeType());return this.domNode.nodeType();}}
_customElementState()
{const state=this.domNode.customElementState();switch(state){case WebInspector.DOMNode.CustomElementState.Builtin:return null;case WebInspector.DOMNode.CustomElementState.Custom:return WebInspector.UIString("Custom");case WebInspector.DOMNode.CustomElementState.Waiting:return WebInspector.UIString("Undefined custom element");case WebInspector.DOMNode.CustomElementState.Failed:return WebInspector.UIString("Failed to upgrade");}
console.error("Unknown DOM custom element state: ",state);return null;}};WebInspector.DOMNodeDetailsSidebarPanel.EventListenerGroupingMethod={Event:"event",Node:"node",};WebInspector.DOMNodeDetailsSidebarPanel.PropertiesObjectGroupName="dom-node-details-sidebar-properties-object-group";WebInspector.DOMNodeTreeElement=class DOMNodeTreeElement extends WebInspector.GeneralTreeElement
{constructor(domNode)
{super("dom-node",domNode.displayName,null,domNode,true);this.status=WebInspector.linkifyNodeReferenceElement(domNode,WebInspector.createGoToArrowButton());}
ondelete()
{WebInspector.domDebuggerManager.removeDOMBreakpointsForNode(this.representedObject);return true;}
populateContextMenu(contextMenu,event)
{contextMenu.appendSeparator();const allowEditing=true;WebInspector.DOMBreakpointTreeController.appendBreakpointContextMenuItems(contextMenu,this.representedObject,allowEditing);contextMenu.appendSeparator();contextMenu.appendItem(WebInspector.UIString("Reveal in DOM Tree"),()=>{WebInspector.domTreeManager.inspectElement(this.representedObject.id);});}};WebInspector.DOMStorageContentView=class DOMStorageContentView extends WebInspector.ContentView
{constructor(representedObject)
{super(representedObject);this.element.classList.add("dom-storage");representedObject.addEventListener(WebInspector.DOMStorageObject.Event.ItemsCleared,this.itemsCleared,this);representedObject.addEventListener(WebInspector.DOMStorageObject.Event.ItemAdded,this.itemAdded,this);representedObject.addEventListener(WebInspector.DOMStorageObject.Event.ItemRemoved,this.itemRemoved,this);representedObject.addEventListener(WebInspector.DOMStorageObject.Event.ItemUpdated,this.itemUpdated,this);let columns={};columns.key={title:WebInspector.UIString("Key"),sortable:true};columns.value={title:WebInspector.UIString("Value"),sortable:true};this._dataGrid=new WebInspector.DataGrid(columns,this._editingCallback.bind(this),this._deleteCallback.bind(this));this._dataGrid.sortOrder=WebInspector.DataGrid.SortOrder.Ascending;this._dataGrid.sortColumnIdentifier="key";this._dataGrid.createSettings("dom-storage-content-view");this._dataGrid.addEventListener(WebInspector.DataGrid.Event.SortChanged,this._sortDataGrid,this);this.addSubview(this._dataGrid);this._populate();}
saveToCookie(cookie)
{cookie.type=WebInspector.ContentViewCookieType.DOMStorage;cookie.isLocalStorage=this.representedObject.isLocalStorage();cookie.host=this.representedObject.host;}
get scrollableElements()
{return[this._dataGrid.scrollContainer];}
itemsCleared(event)
{this._dataGrid.removeChildren();this._dataGrid.addPlaceholderNode();}
itemRemoved(event)
{for(let node of this._dataGrid.children){if(node.data.key===event.data.key)
return this._dataGrid.removeChild(node);}
return null;}
itemAdded(event)
{let{key,value}=event.data;value=this._truncateValue(value);for(let node of this._dataGrid.children){if(node.data.key===key)
return;}
this._dataGrid.appendChild(new WebInspector.DataGridNode({key,value},false));this._sortDataGrid();}
itemUpdated(event)
{let{key,value}=event.data;value=this._truncateValue(value);let keyFound=false;for(let childNode of this._dataGrid.children){if(childNode.data.key===key){if(keyFound){this._dataGrid.removeChild(childNode);continue;}
keyFound=true;childNode.data.value=value;childNode.refresh();}}
this._sortDataGrid();}
_truncateValue(value)
{return value.truncate(200);}
_populate()
{this.representedObject.getEntries(function(error,entries){if(error)
return;for(let[key,value]of entries){if(!key||!value)
continue;value=this._truncateValue(value);let node=new WebInspector.DataGridNode({key,value},false);this._dataGrid.appendChild(node);}
this._sortDataGrid();this._dataGrid.addPlaceholderNode();this._dataGrid.updateLayout();}.bind(this));}
_sortDataGrid()
{let sortColumnIdentifier=this._dataGrid.sortColumnIdentifier||"key";function comparator(a,b)
{return a.data[sortColumnIdentifier].extendedLocaleCompare(b.data[sortColumnIdentifier]);}
this._dataGrid.sortNodesImmediately(comparator);}
_deleteCallback(node)
{if(!node||node.isPlaceholderNode)
return;this._dataGrid.removeChild(node);this.representedObject.removeItem(node.data["key"]);}
_editingCallback(editingNode,columnIdentifier,oldText,newText,moveDirection)
{var key=editingNode.data["key"].trim().removeWordBreakCharacters();var value=editingNode.data["value"].trim().removeWordBreakCharacters();var previousValue=oldText.trim().removeWordBreakCharacters();var enteredValue=newText.trim().removeWordBreakCharacters();var hasUncommittedEdits=editingNode.__hasUncommittedEdits;var hasChange=previousValue!==enteredValue;var isEditingKey=columnIdentifier==="key";var isEditingValue=!isEditingKey;var domStorage=this.representedObject;if(!hasChange&&!hasUncommittedEdits)
return;if(hasChange&&!editingNode.__hasUncommittedEdits){editingNode.__hasUncommittedEdits=true;editingNode.__originalKey=isEditingKey?previousValue:key;editingNode.__originalValue=isEditingValue?previousValue:value;}
function cleanup()
{editingNode.element.classList.remove(WebInspector.DOMStorageContentView.MissingKeyStyleClassName);editingNode.element.classList.remove(WebInspector.DOMStorageContentView.MissingValueStyleClassName);editingNode.element.classList.remove(WebInspector.DOMStorageContentView.DuplicateKeyStyleClassName);editingNode.__hasUncommittedEdits=undefined;editingNode.__originalKey=undefined;editingNode.__originalValue=undefined;}
if(isEditingKey){if(key.length)
editingNode.element.classList.remove(WebInspector.DOMStorageContentView.MissingKeyStyleClassName);else
editingNode.element.classList.add(WebInspector.DOMStorageContentView.MissingKeyStyleClassName);}else if(isEditingValue){if(value.length)
editingNode.element.classList.remove(WebInspector.DOMStorageContentView.MissingValueStyleClassName);else
editingNode.element.classList.add(WebInspector.DOMStorageContentView.MissingValueStyleClassName);}
var keyChanged=key!==editingNode.__originalKey;if(keyChanged){if(domStorage.entries.has(key))
editingNode.element.classList.add(WebInspector.DOMStorageContentView.DuplicateKeyStyleClassName);else
editingNode.element.classList.remove(WebInspector.DOMStorageContentView.DuplicateKeyStyleClassName);}
var columnIndex=this._dataGrid.orderedColumns.indexOf(columnIdentifier);var mayMoveToNextRow=moveDirection==="forward"&&columnIndex===this._dataGrid.orderedColumns.length-1;var mayMoveToPreviousRow=moveDirection==="backward"&&columnIndex===0;var doneEditing=mayMoveToNextRow||mayMoveToPreviousRow||!moveDirection;if(!doneEditing)
return;if(!key.length&&!value.length&&!editingNode.isPlaceholderNode){this._dataGrid.removeChild(editingNode);domStorage.removeItem(editingNode.__originalKey);return;}
var isDuplicate=editingNode.element.classList.contains(WebInspector.DOMStorageContentView.DuplicateKeyStyleClassName);if(!key.length||!value.length||isDuplicate)
return;if(keyChanged&&!editingNode.isPlaceholderNode)
domStorage.removeItem(editingNode.__originalKey);if(editingNode.isPlaceholderNode)
this._dataGrid.addPlaceholderNode();cleanup();domStorage.setItem(key,value);}};WebInspector.DOMStorageContentView.DuplicateKeyStyleClassName="duplicate-key";WebInspector.DOMStorageContentView.MissingKeyStyleClassName="missing-key";WebInspector.DOMStorageContentView.MissingValueStyleClassName="missing-value";WebInspector.DOMStorageTreeElement=class DOMStorageTreeElement extends WebInspector.StorageTreeElement
{constructor(representedObject)
{if(representedObject.isLocalStorage())
var className=WebInspector.DOMStorageTreeElement.LocalStorageIconStyleClassName;else
var className=WebInspector.DOMStorageTreeElement.SessionStorageIconStyleClassName;super(className,WebInspector.displayNameForHost(representedObject.host),representedObject);}
get name()
{return WebInspector.displayNameForHost(this.representedObject.host);}
get categoryName()
{if(this.representedObject.isLocalStorage())
return WebInspector.UIString("Local Storage");return WebInspector.UIString("Session Storage");}};WebInspector.DOMStorageTreeElement.LocalStorageIconStyleClassName="local-storage-icon";WebInspector.DOMStorageTreeElement.SessionStorageIconStyleClassName="session-storage-icon";WebInspector.DOMTreeDataGrid=class DOMTreeDataGrid extends WebInspector.DataGrid
{constructor()
{super({name:{title:WebInspector.UIString("Node"),sortable:false,icon:true}});this._previousHoveredElement=null;this.inline=true;this.element.classList.add("dom-tree-data-grid");this.element.addEventListener("mousemove",this._onmousemove.bind(this),false);this.element.addEventListener("mouseout",this._onmouseout.bind(this),false);}
_onmousemove(event)
{var gridNode=this.dataGridNodeFromNode(event.target);if(!gridNode||this._previousHoveredElement===gridNode.domNode)
return;this._previousHoveredElement=gridNode.domNode;WebInspector.domTreeManager.highlightDOMNode(gridNode.domNode.id);}
_onmouseout(event){if(!this._previousHoveredElement)
return;WebInspector.domTreeManager.hideDOMNodeHighlight();this._previousHoveredElement=null;}};WebInspector.DOMTreeDataGridNode=class DOMTreeDataGridNode extends WebInspector.DataGridNode
{constructor(domNode)
{super();this._domNode=domNode;}
get domNode()
{return this._domNode;}
createCellContent(columnIdentifier,cell)
{if(columnIdentifier!=="name")
return super.createCellContent(columnIdentifier,cell);return this._createNameCellDocumentFragment();}
_createNameCellDocumentFragment()
{let fragment=document.createDocumentFragment();let mainTitle=this._domNode.displayName;fragment.append(mainTitle);let goToButton=fragment.appendChild(WebInspector.createGoToArrowButton());goToButton.addEventListener("click",this._goToArrowWasClicked.bind(this),false);return fragment;}
_goToArrowWasClicked()
{WebInspector.showMainFrameDOMTree(this._domNode);}};WebInspector.DOMTreeElement=class DOMTreeElement extends WebInspector.TreeElement
{constructor(node,elementCloseTag)
{super("",node);this._elementCloseTag=elementCloseTag;this.hasChildren=!elementCloseTag&&this._hasVisibleChildren();if(this.representedObject.nodeType()===Node.ELEMENT_NODE&&!elementCloseTag)
this._canAddAttributes=true;this._searchQuery=null;this._expandedChildrenLimit=WebInspector.DOMTreeElement.InitialChildrenLimit;this._breakpointStatus=WebInspector.DOMTreeElement.BreakpointStatus.None;this._animatingHighlight=false;this._shouldHighlightAfterReveal=false;this._boundHighlightAnimationEnd=this._highlightAnimationEnd.bind(this);this._subtreeBreakpointCount=0;this._recentlyModifiedAttributes=[];this._boundNodeChangedAnimationEnd=this._nodeChangedAnimationEnd.bind(this);node.addEventListener(WebInspector.DOMNode.Event.EnabledPseudoClassesChanged,this._nodePseudoClassesDidChange,this);}
static shadowRootTypeDisplayName(type)
{switch(type){case WebInspector.DOMNode.ShadowRootType.UserAgent:return WebInspector.UIString("User Agent");case WebInspector.DOMNode.ShadowRootType.Open:return WebInspector.UIString("Open");case WebInspector.DOMNode.ShadowRootType.Closed:return WebInspector.UIString("Closed");}}
get breakpointStatus()
{return this._breakpointStatus;}
set breakpointStatus(status)
{if(this._breakpointStatus===status)
return;let increment;if(this._breakpointStatus===WebInspector.DOMTreeElement.BreakpointStatus.None)
increment=1;else if(status===WebInspector.DOMTreeElement.BreakpointStatus.None)
increment=-1;this._breakpointStatus=status;this._updateBreakpointStatus();if(!increment)
return;let parentElement=this.parent;while(parentElement&&!parentElement.root){parentElement.subtreeBreakpointCountDidChange(increment);parentElement=parentElement.parent;}}
revealAndHighlight()
{if(this._animatingHighlight)
return;this._shouldHighlightAfterReveal=true;this.reveal();}
subtreeBreakpointCountDidChange(increment)
{this._subtreeBreakpointCount+=increment;this._updateBreakpointStatus();}
isCloseTag()
{return this._elementCloseTag;}
highlightSearchResults(searchQuery)
{if(this._searchQuery!==searchQuery){this._updateSearchHighlight(false);this._highlightResult=undefined;}
this._searchQuery=searchQuery;this._searchHighlightsVisible=true;this.updateTitle(true);}
hideSearchHighlights()
{this._searchHighlightsVisible=false;this._updateSearchHighlight(false);}
emphasizeSearchHighlight()
{var highlightElement=this.title.querySelector("."+WebInspector.DOMTreeElement.SearchHighlightStyleClassName);if(!highlightElement)
return;if(this._bouncyHighlightElement)
this._bouncyHighlightElement.remove();this._bouncyHighlightElement=document.createElement("div");this._bouncyHighlightElement.className=WebInspector.DOMTreeElement.BouncyHighlightStyleClassName;this._bouncyHighlightElement.textContent=highlightElement.textContent;var highlightElementRect=highlightElement.getBoundingClientRect();var treeOutlineRect=this.treeOutline.element.getBoundingClientRect();this._bouncyHighlightElement.style.top=(highlightElementRect.top-treeOutlineRect.top)+"px";this._bouncyHighlightElement.style.left=(highlightElementRect.left-treeOutlineRect.left)+"px";this.title.appendChild(this._bouncyHighlightElement);function animationEnded()
{if(!this._bouncyHighlightElement)
return;this._bouncyHighlightElement.remove();this._bouncyHighlightElement=null;}
this._bouncyHighlightElement.addEventListener("animationend",animationEnded.bind(this));}
_updateSearchHighlight(show)
{if(!this._highlightResult)
return;function updateEntryShow(entry)
{switch(entry.type){case"added":entry.parent.insertBefore(entry.node,entry.nextSibling);break;case"changed":entry.node.textContent=entry.newText;break;}}
function updateEntryHide(entry)
{switch(entry.type){case"added":entry.node.remove();break;case"changed":entry.node.textContent=entry.oldText;break;}}
var updater=show?updateEntryShow:updateEntryHide;for(var i=0,size=this._highlightResult.length;i<size;++i)
updater(this._highlightResult[i]);}
get hovered()
{return this._hovered;}
set hovered(value)
{if(this._hovered===value)
return;this._hovered=value;if(this.listItemElement){this.listItemElement.classList.toggle("hovered",this._hovered);this.updateSelectionArea();}}
get editable()
{let node=this.representedObject;if(node.isShadowRoot()||node.isInUserAgentShadowTree())
return false;if(node.isPseudoElement())
return false;return this.treeOutline.editable;}
get expandedChildrenLimit()
{return this._expandedChildrenLimit;}
set expandedChildrenLimit(x)
{if(this._expandedChildrenLimit===x)
return;this._expandedChildrenLimit=x;if(this.treeOutline&&!this._updateChildrenInProgress)
this._updateChildren(true);}
get expandedChildCount()
{var count=this.children.length;if(count&&this.children[count-1]._elementCloseTag)
count--;if(count&&this.children[count-1].expandAllButton)
count--;return count;}
attributeDidChange(name)
{this._recentlyModifiedAttributes.push({name});}
showChildNode(node)
{if(this._elementCloseTag)
return null;var index=this._visibleChildren().indexOf(node);if(index===-1)
return null;if(index>=this.expandedChildrenLimit){this._expandedChildrenLimit=index+1;this._updateChildren(true);}
return this.children[index];}
_createTooltipForNode()
{var node=this.representedObject;if(!node.nodeName()||node.nodeName().toLowerCase()!=="img")
return;function setTooltip(error,result,wasThrown)
{if(error||wasThrown||!result||result.type!=="string")
return;try{var properties=JSON.parse(result.description);var offsetWidth=properties[0];var offsetHeight=properties[1];var naturalWidth=properties[2];var naturalHeight=properties[3];if(offsetHeight===naturalHeight&&offsetWidth===naturalWidth)
this.tooltip=WebInspector.UIString("%d \xd7 %d pixels").format(offsetWidth,offsetHeight);else
this.tooltip=WebInspector.UIString("%d \xd7 %d pixels (Natural: %d \xd7 %d pixels)").format(offsetWidth,offsetHeight,naturalWidth,naturalHeight);}catch(e){console.error(e);}}
function resolvedNode(object)
{if(!object)
return;function dimensions()
{return"["+this.offsetWidth+","+this.offsetHeight+","+this.naturalWidth+","+this.naturalHeight+"]";}
object.callFunction(dimensions,undefined,false,setTooltip.bind(this));object.release();}
WebInspector.RemoteObject.resolveNode(node,"",resolvedNode.bind(this));}
updateSelectionArea()
{let listItemElement=this.listItemElement;if(!listItemElement)
return;let indicatesTreeOutlineState=this.treeOutline&&(this.treeOutline.dragOverTreeElement===this||this.treeOutline.selectedTreeElement===this||this._animatingHighlight);if(!this.hovered&&!this.pseudoClassesEnabled&&!indicatesTreeOutlineState){if(this._selectionElement){this._selectionElement.remove();this._selectionElement=null;}
return;}
if(!this._selectionElement){this._selectionElement=document.createElement("div");this._selectionElement.className="selection-area";listItemElement.insertBefore(this._selectionElement,listItemElement.firstChild);}
this._selectionElement.style.height=listItemElement.offsetHeight+"px";}
onattach()
{if(this.hovered)
this.listItemElement.classList.add("hovered");this.updateTitle();if(this.editable){this.listItemElement.draggable=true;this.listItemElement.addEventListener("dragstart",this);}}
onpopulate()
{if(this.children.length||!this._hasVisibleChildren()||this._elementCloseTag)
return;this.updateChildren();}
expandRecursively()
{this.representedObject.getSubtree(-1,super.expandRecursively.bind(this,Number.MAX_VALUE));}
updateChildren(fullRefresh)
{if(this._elementCloseTag)
return;this.representedObject.getChildNodes(this._updateChildren.bind(this,fullRefresh));}
insertChildElement(child,index,closingTag)
{var newElement=new WebInspector.DOMTreeElement(child,closingTag);newElement.selectable=this.treeOutline._selectEnabled;this.insertChild(newElement,index);return newElement;}
moveChild(child,targetIndex)
{if(this.children[targetIndex]===child)
return;var originalSelectedChild=this.treeOutline.selectedTreeElement;this.removeChild(child);this.insertChild(child,targetIndex);if(originalSelectedChild!==this.treeOutline.selectedTreeElement)
originalSelectedChild.select();}
_updateChildren(fullRefresh)
{if(this._updateChildrenInProgress||!this.treeOutline._visible)
return;this._updateChildrenInProgress=true;var node=this.representedObject;var selectedNode=this.treeOutline.selectedDOMNode();var originalScrollTop=0;var hasVisibleChildren=this._hasVisibleChildren();if(fullRefresh||!hasVisibleChildren){var treeOutlineContainerElement=this.treeOutline.element.parentNode;originalScrollTop=treeOutlineContainerElement.scrollTop;var selectedTreeElement=this.treeOutline.selectedTreeElement;if(selectedTreeElement&&selectedTreeElement.hasAncestor(this))
this.select();this.removeChildren();if(!hasVisibleChildren){this.hasChildren=false;this.updateTitle();this._updateChildrenInProgress=false;return;}}
if(!this.hasChildren){this.hasChildren=true;this.updateTitle();}
var existingChildTreeElements=new Map;for(var i=this.children.length-1;i>=0;--i){var currentChildTreeElement=this.children[i];var currentNode=currentChildTreeElement.representedObject;var currentParentNode=currentNode.parentNode;if(currentParentNode===node){existingChildTreeElements.set(currentNode,currentChildTreeElement);continue;}
this.removeChildAtIndex(i);}
var elementToSelect=null;var visibleChildren=this._visibleChildren();for(var i=0;i<visibleChildren.length&&i<this.expandedChildrenLimit;++i){var childNode=visibleChildren[i];var existingChildTreeElement=existingChildTreeElements.get(childNode);if(existingChildTreeElement){this.moveChild(existingChildTreeElement,i);continue;}
var newChildTreeElement=this.insertChildElement(childNode,i);if(childNode===selectedNode)
elementToSelect=newChildTreeElement;if(this.expandedChildCount>this.expandedChildrenLimit)
this.expandedChildrenLimit++;}
this.adjustCollapsedRange();var lastChild=this.children.lastValue;if(node.nodeType()===Node.ELEMENT_NODE&&(!lastChild||!lastChild._elementCloseTag))
this.insertChildElement(this.representedObject,this.children.length,true);if(fullRefresh&&elementToSelect){elementToSelect.select();if(treeOutlineContainerElement&&originalScrollTop<=treeOutlineContainerElement.scrollHeight)
treeOutlineContainerElement.scrollTop=originalScrollTop;}
this._updateChildrenInProgress=false;}
adjustCollapsedRange()
{
if(this.expandAllButtonElement&&this.expandAllButtonElement.__treeElement.parent)
this.removeChild(this.expandAllButtonElement.__treeElement);if(!this._hasVisibleChildren())
return;var visibleChildren=this._visibleChildren();var totalChildrenCount=visibleChildren.length;for(var i=this.expandedChildCount,limit=Math.min(this.expandedChildrenLimit,totalChildrenCount);i<limit;++i)
this.insertChildElement(visibleChildren[i],i);var expandedChildCount=this.expandedChildCount;if(totalChildrenCount>this.expandedChildCount){var targetButtonIndex=expandedChildCount;if(!this.expandAllButtonElement){var button=document.createElement("button");button.className="show-all-nodes";button.value="";var item=new WebInspector.TreeElement(button,null,false);item.selectable=false;item.expandAllButton=true;this.insertChild(item,targetButtonIndex);this.expandAllButtonElement=button;this.expandAllButtonElement.__treeElement=item;this.expandAllButtonElement.addEventListener("click",this.handleLoadAllChildren.bind(this),false);}else if(!this.expandAllButtonElement.__treeElement.parent)
this.insertChild(this.expandAllButtonElement.__treeElement,targetButtonIndex);this.expandAllButtonElement.textContent=WebInspector.UIString("Show All Nodes (%d More)").format(totalChildrenCount-expandedChildCount);}else if(this.expandAllButtonElement)
this.expandAllButtonElement=null;}
handleLoadAllChildren()
{var visibleChildren=this._visibleChildren();this.expandedChildrenLimit=Math.max(visibleChildren.length,this.expandedChildrenLimit+WebInspector.DOMTreeElement.InitialChildrenLimit);}
onexpand()
{if(this._elementCloseTag)
return;if(!this.listItemElement)
return;this.updateTitle();}
oncollapse()
{if(this._elementCloseTag)
return;this.updateTitle();}
onreveal()
{let listItemElement=this.listItemElement;if(!listItemElement)
return;let tagSpans=listItemElement.getElementsByClassName("html-tag-name");if(tagSpans.length)
tagSpans[0].scrollIntoViewIfNeeded(false);else
listItemElement.scrollIntoViewIfNeeded(false);if(!this._shouldHighlightAfterReveal)
return;this._shouldHighlightAfterReveal=false;this._animatingHighlight=true;this.updateSelectionArea();listItemElement.addEventListener("animationend",this._boundHighlightAnimationEnd);listItemElement.classList.add(WebInspector.DOMTreeElement.HighlightStyleClassName);}
onselect(treeElement,selectedByUser)
{this.treeOutline.suppressRevealAndSelect=true;this.treeOutline.selectDOMNode(this.representedObject,selectedByUser);if(selectedByUser)
WebInspector.domTreeManager.highlightDOMNode(this.representedObject.id);this.treeOutline.updateSelection();this.treeOutline.suppressRevealAndSelect=false;}
ondeselect(treeElement)
{this.treeOutline.selectDOMNode(null);}
ondelete()
{if(!this.editable)
return false;var startTagTreeElement=this.treeOutline.findTreeElement(this.representedObject);if(startTagTreeElement)
startTagTreeElement.remove();else
this.remove();return true;}
onenter()
{if(!this.editable)
return false;
if(this.treeOutline.editing)
return false;this._startEditing(); return true;}
selectOnMouseDown(event)
{super.selectOnMouseDown(event);if(this._editing)
return;if(event.detail>=2)
event.preventDefault();}
ondblclick(event)
{if(!this.editable)
return false;if(this._editing||this._elementCloseTag)
return;if(this._startEditingTarget(event.target))
return;if(this.hasChildren&&!this.expanded)
this.expand();}
_insertInLastAttributePosition(tag,node)
{if(tag.getElementsByClassName("html-attribute").length>0)
tag.insertBefore(node,tag.lastChild);else{var nodeName=tag.textContent.match(/^<(.*?)>$/)[1];tag.textContent="";tag.append("<"+nodeName,node,">");}
this.updateSelectionArea();}
_startEditingTarget(eventTarget)
{if(this.treeOutline.selectedDOMNode()!==this.representedObject)
return false;if(this.representedObject.isShadowRoot()||this.representedObject.isInUserAgentShadowTree())
return false;if(this.representedObject.isPseudoElement())
return false;if(this.representedObject.nodeType()!==Node.ELEMENT_NODE&&this.representedObject.nodeType()!==Node.TEXT_NODE)
return false;var textNode=eventTarget.enclosingNodeOrSelfWithClass("html-text-node");if(textNode)
return this._startEditingTextNode(textNode);var attribute=eventTarget.enclosingNodeOrSelfWithClass("html-attribute");if(attribute)
return this._startEditingAttribute(attribute,eventTarget);var tagName=eventTarget.enclosingNodeOrSelfWithClass("html-tag-name");if(tagName)
return this._startEditingTagName(tagName);return false;}
_populateTagContextMenu(contextMenu,event)
{let node=this.representedObject;if(!node.isInUserAgentShadowTree()){let attribute=event.target.enclosingNodeOrSelfWithClass("html-attribute");if(event.target&&event.target.tagName==="A"){let url=event.target.href;contextMenu.appendItem(WebInspector.UIString("Open in New Tab"),()=>{const frame=null;WebInspector.openURL(url,frame,{alwaysOpenExternally:true});});if(WebInspector.frameResourceManager.resourceForURL(url)){contextMenu.appendItem(WebInspector.UIString("Reveal in Resources Tab"),()=>{let frame=WebInspector.frameResourceManager.frameForIdentifier(node.frameIdentifier);const options={ignoreNetworkTab:true,ignoreSearchTab:true,};WebInspector.openURL(url,frame,options);});}
contextMenu.appendItem(WebInspector.UIString("Copy Link Address"),()=>{InspectorFrontendHost.copyText(url);});contextMenu.appendSeparator();}
if(this.editable){contextMenu.appendItem(WebInspector.UIString("Add Attribute"),this._addNewAttribute.bind(this));if(attribute)
contextMenu.appendItem(WebInspector.UIString("Edit Attribute"),this._startEditingAttribute.bind(this,attribute,event.target));contextMenu.appendSeparator();}
if(WebInspector.cssStyleManager.canForcePseudoClasses()){let pseudoSubMenu=contextMenu.appendSubMenuItem(WebInspector.UIString("Forced Pseudo-Classes"));this._populateForcedPseudoStateItems(pseudoSubMenu);contextMenu.appendSeparator();}}
this._populateNodeContextMenu(contextMenu);}
_populateForcedPseudoStateItems(subMenu)
{var node=this.representedObject;var enabledPseudoClasses=node.enabledPseudoClasses;WebInspector.CSSStyleManager.ForceablePseudoClasses.forEach(function(pseudoClass){var label=pseudoClass.capitalize();var enabled=enabledPseudoClasses.includes(pseudoClass);subMenu.appendCheckboxItem(label,function(){node.setPseudoClassEnabled(pseudoClass,!enabled);},enabled,false);});}
_populateTextContextMenu(contextMenu,textNode)
{if(this.editable)
contextMenu.appendItem(WebInspector.UIString("Edit Text"),this._startEditingTextNode.bind(this,textNode));this._populateNodeContextMenu(contextMenu);}
_populateNodeContextMenu(contextMenu)
{let node=this.representedObject;if(this.editable)
contextMenu.appendItem(WebInspector.UIString("Edit as HTML"),this._editAsHTML.bind(this));if(!node.isPseudoElement())
contextMenu.appendItem(WebInspector.UIString("Copy as HTML"),this._copyHTML.bind(this));if(this.editable)
contextMenu.appendItem(WebInspector.UIString("Delete Node"),this.remove.bind(this));if(node.nodeType()===Node.ELEMENT_NODE)
contextMenu.appendItem(WebInspector.UIString("Scroll Into View"),this._scrollIntoView.bind(this));}
_startEditing()
{if(this.treeOutline.selectedDOMNode()!==this.representedObject)
return false;if(!this.editable)
return false;var listItem=this.listItemElement;if(this._canAddAttributes){var attribute=listItem.getElementsByClassName("html-attribute")[0];if(attribute)
return this._startEditingAttribute(attribute,attribute.getElementsByClassName("html-attribute-value")[0]);return this._addNewAttribute();}
if(this.representedObject.nodeType()===Node.TEXT_NODE){var textNode=listItem.getElementsByClassName("html-text-node")[0];if(textNode)
return this._startEditingTextNode(textNode);return false;}}
_addNewAttribute()
{
var container=document.createElement("span");this._buildAttributeDOM(container," ","");var attr=container.firstChild;attr.style.marginLeft="2px"; attr.style.marginRight="2px"; var tag=this.listItemElement.getElementsByClassName("html-tag")[0];this._insertInLastAttributePosition(tag,attr);return this._startEditingAttribute(attr,attr);}
_triggerEditAttribute(attributeName)
{var attributeElements=this.listItemElement.getElementsByClassName("html-attribute-name");for(var i=0,len=attributeElements.length;i<len;++i){if(attributeElements[i].textContent===attributeName){for(var elem=attributeElements[i].nextSibling;elem;elem=elem.nextSibling){if(elem.nodeType!==Node.ELEMENT_NODE)
continue;if(elem.classList.contains("html-attribute-value"))
return this._startEditingAttribute(elem.parentNode,elem);}}}}
_startEditingAttribute(attribute,elementForSelection)
{if(WebInspector.isBeingEdited(attribute))
return true;var attributeNameElement=attribute.getElementsByClassName("html-attribute-name")[0];if(!attributeNameElement)
return false;var attributeName=attributeNameElement.textContent;function removeZeroWidthSpaceRecursive(node)
{if(node.nodeType===Node.TEXT_NODE){node.nodeValue=node.nodeValue.replace(/\u200B/g,"");return;}
if(node.nodeType!==Node.ELEMENT_NODE)
return;for(var child=node.firstChild;child;child=child.nextSibling)
removeZeroWidthSpaceRecursive(child);}
removeZeroWidthSpaceRecursive(attribute);var config=new WebInspector.EditingConfig(this._attributeEditingCommitted.bind(this),this._editingCancelled.bind(this),attributeName);config.setNumberCommitHandler(this._attributeNumberEditingCommitted.bind(this));this._editing=WebInspector.startEditing(attribute,config);window.getSelection().setBaseAndExtent(elementForSelection,0,elementForSelection,1);return true;}
_startEditingTextNode(textNode)
{if(WebInspector.isBeingEdited(textNode))
return true;var config=new WebInspector.EditingConfig(this._textNodeEditingCommitted.bind(this),this._editingCancelled.bind(this));config.spellcheck=true;this._editing=WebInspector.startEditing(textNode,config);window.getSelection().setBaseAndExtent(textNode,0,textNode,1);return true;}
_startEditingTagName(tagNameElement)
{if(!tagNameElement){tagNameElement=this.listItemElement.getElementsByClassName("html-tag-name")[0];if(!tagNameElement)
return false;}
var tagName=tagNameElement.textContent;if(WebInspector.DOMTreeElement.EditTagBlacklist[tagName.toLowerCase()])
return false;if(WebInspector.isBeingEdited(tagNameElement))
return true;let closingTagElement=this._distinctClosingTagElement();let originalClosingTagTextContent=closingTagElement?closingTagElement.textContent:"";function keyupListener(event)
{if(closingTagElement)
closingTagElement.textContent="</"+tagNameElement.textContent+">";}
function editingComitted(element,newTagName)
{tagNameElement.removeEventListener("keyup",keyupListener,false);this._tagNameEditingCommitted.apply(this,arguments);}
function editingCancelled()
{if(closingTagElement)
closingTagElement.textContent=originalClosingTagTextContent;tagNameElement.removeEventListener("keyup",keyupListener,false);this._editingCancelled.apply(this,arguments);}
tagNameElement.addEventListener("keyup",keyupListener,false);var config=new WebInspector.EditingConfig(editingComitted.bind(this),editingCancelled.bind(this),tagName);this._editing=WebInspector.startEditing(tagNameElement,config);window.getSelection().setBaseAndExtent(tagNameElement,0,tagNameElement,1);return true;}
_startEditingAsHTML(commitCallback,error,initialValue)
{if(error)
return;if(this._htmlEditElement&&WebInspector.isBeingEdited(this._htmlEditElement))
return;this._htmlEditElement=document.createElement("div");this._htmlEditElement.textContent=initialValue;var child=this.listItemElement.firstChild;while(child){child.style.display="none";child=child.nextSibling;}
if(this._childrenListNode)
this._childrenListNode.style.display="none";this.listItemElement.appendChild(this._htmlEditElement);this.updateSelectionArea();function commit()
{commitCallback(this._htmlEditElement.textContent);dispose.call(this);}
function dispose()
{this._editing=false;this.listItemElement.removeChild(this._htmlEditElement);this._htmlEditElement=null;if(this._childrenListNode)
this._childrenListNode.style.removeProperty("display");var child=this.listItemElement.firstChild;while(child){child.style.removeProperty("display");child=child.nextSibling;}
this.updateSelectionArea();}
var config=new WebInspector.EditingConfig(commit.bind(this),dispose.bind(this));config.setMultiline(true);this._editing=WebInspector.startEditing(this._htmlEditElement,config);}
_attributeEditingCommitted(element,newText,oldText,attributeName,moveDirection)
{this._editing=false;if(!newText.trim())
element.remove();if(!moveDirection&&newText===oldText)
return;var treeOutline=this.treeOutline;function moveToNextAttributeIfNeeded(error)
{if(error)
this._editingCancelled(element,attributeName);if(!moveDirection)
return;treeOutline._updateModifiedNodes();var attributes=this.representedObject.attributes();for(var i=0;i<attributes.length;++i){if(attributes[i].name!==attributeName)
continue;if(moveDirection==="backward"){if(i===0)
this._startEditingTagName();else
this._triggerEditAttribute(attributes[i-1].name);}else{if(i===attributes.length-1)
this._addNewAttribute();else
this._triggerEditAttribute(attributes[i+1].name);}
return;}
if(moveDirection==="backward"){if(newText===" "){ if(attributes.length)
this._triggerEditAttribute(attributes.lastValue.name);}else{ if(attributes.length>1)
this._triggerEditAttribute(attributes[attributes.length-2].name);}}else if(moveDirection==="forward"){if(!/^\s*$/.test(newText))
this._addNewAttribute();else
this._startEditingTagName();}}
this.representedObject.setAttribute(attributeName,newText,moveToNextAttributeIfNeeded.bind(this));}
_attributeNumberEditingCommitted(element,newText,oldText,attributeName,moveDirection)
{if(newText===oldText)
return;this.representedObject.setAttribute(attributeName,newText);}
_tagNameEditingCommitted(element,newText,oldText,tagName,moveDirection)
{this._editing=false;var self=this;function cancel()
{var closingTagElement=self._distinctClosingTagElement();if(closingTagElement)
closingTagElement.textContent="</"+tagName+">";self._editingCancelled(element,tagName);moveToNextAttributeIfNeeded.call(self);}
function moveToNextAttributeIfNeeded()
{if(moveDirection!=="forward"){this._addNewAttribute();return;}
var attributes=this.representedObject.attributes();if(attributes.length>0)
this._triggerEditAttribute(attributes[0].name);else
this._addNewAttribute();}
newText=newText.trim();if(newText===oldText){cancel();return;}
var treeOutline=this.treeOutline;var wasExpanded=this.expanded;function changeTagNameCallback(error,nodeId)
{if(error||!nodeId){cancel();return;}
var node=WebInspector.domTreeManager.nodeForId(nodeId);treeOutline._updateModifiedNodes();treeOutline.selectDOMNode(node,true);var newTreeItem=treeOutline.findTreeElement(node);if(wasExpanded)
newTreeItem.expand();moveToNextAttributeIfNeeded.call(newTreeItem);}
this.representedObject.setNodeName(newText,changeTagNameCallback);}
_textNodeEditingCommitted(element,newText)
{this._editing=false;var textNode;if(this.representedObject.nodeType()===Node.ELEMENT_NODE){
textNode=this.representedObject.firstChild;}else if(this.representedObject.nodeType()===Node.TEXT_NODE)
textNode=this.representedObject;textNode.setNodeValue(newText,this.updateTitle.bind(this));}
_editingCancelled(element,context)
{this._editing=false;this.updateTitle();}
_distinctClosingTagElement()
{
if(this.expanded){var closers=this._childrenListNode.querySelectorAll(".close");return closers[closers.length-1];}
var tags=this.listItemElement.getElementsByClassName("html-tag");return tags.length===1?null:tags[tags.length-1];}
updateTitle(onlySearchQueryChanged)
{if(this._editing)
return;if(onlySearchQueryChanged){if(this._highlightResult)
this._updateSearchHighlight(false);}else{this.title=document.createElement("span");this.title.appendChild(this._nodeTitleInfo().titleDOM);this._highlightResult=undefined;}
this._selectionElement=null;this.updateSelectionArea();this._highlightSearchResults();this._updateBreakpointStatus();}
_buildAttributeDOM(parentElement,name,value,node)
{let hasText=value.length>0;let attrSpanElement=parentElement.createChild("span","html-attribute");let attrNameElement=attrSpanElement.createChild("span","html-attribute-name");attrNameElement.textContent=name;let attrValueElement=null;if(hasText)
attrSpanElement.append("=\u200B\"");if(name==="src"||/\bhref\b/.test(name)){let baseURL=node.ownerDocument?node.ownerDocument.documentURL:null;let rewrittenURL=absoluteURL(value,baseURL);value=value.insertWordBreakCharacters();if(!rewrittenURL){attrValueElement=attrSpanElement.createChild("span","html-attribute-value");attrValueElement.textContent=value;}else{if(value.startsWith("data:"))
value=value.trimMiddle(60);attrValueElement=document.createElement("a");attrValueElement.href=rewrittenURL;attrValueElement.textContent=value;attrSpanElement.appendChild(attrValueElement);}}else if(name==="srcset"){let baseURL=node.ownerDocument?node.ownerDocument.documentURL:null;attrValueElement=attrSpanElement.createChild("span","html-attribute-value");let groups=value.split(/\s*,\s*/);for(let i=0;i<groups.length;++i){let string=groups[i].trim();let spaceIndex=string.search(/\s/);if(spaceIndex===-1){let linkText=string;let rewrittenURL=absoluteURL(string,baseURL);let linkElement=attrValueElement.appendChild(document.createElement("a"));linkElement.href=rewrittenURL;linkElement.textContent=linkText.insertWordBreakCharacters();}else{let linkText=string.substring(0,spaceIndex);let descriptorText=string.substring(spaceIndex).insertWordBreakCharacters();let rewrittenURL=absoluteURL(linkText,baseURL);let linkElement=attrValueElement.appendChild(document.createElement("a"));linkElement.href=rewrittenURL;linkElement.textContent=linkText.insertWordBreakCharacters();let descriptorElement=attrValueElement.appendChild(document.createElement("span"));descriptorElement.textContent=descriptorText;}
if(i<groups.length-1){let commaElement=attrValueElement.appendChild(document.createElement("span"));commaElement.textContent=", ";}}}else{value=value.insertWordBreakCharacters();attrValueElement=attrSpanElement.createChild("span","html-attribute-value");attrValueElement.textContent=value;}
if(hasText)
attrSpanElement.append("\"");for(let attribute of this._recentlyModifiedAttributes){if(attribute.name===name)
attribute.element=hasText?attrValueElement:attrNameElement;}}
_buildTagDOM(parentElement,tagName,isClosingTag,isDistinctTreeElement)
{var node=this.representedObject;var classes=["html-tag"];if(isClosingTag&&isDistinctTreeElement)
classes.push("close");var tagElement=parentElement.createChild("span",classes.join(" "));tagElement.append("<");var tagNameElement=tagElement.createChild("span",isClosingTag?"":"html-tag-name");tagNameElement.textContent=(isClosingTag?"/":"")+tagName;if(!isClosingTag&&node.hasAttributes()){var attributes=node.attributes();for(var i=0;i<attributes.length;++i){var attr=attributes[i];tagElement.append(" ");this._buildAttributeDOM(tagElement,attr.name,attr.value,node);}}
tagElement.append(">");parentElement.append("\u200B");}
_nodeTitleInfo()
{var node=this.representedObject;var info={titleDOM:document.createDocumentFragment(),hasChildren:this.hasChildren};function trimedNodeValue()
{
return node.nodeValue().replace(/^[\n\r]*/,"").replace(/\s*$/,"");}
switch(node.nodeType()){case Node.DOCUMENT_FRAGMENT_NODE:var fragmentElement=info.titleDOM.createChild("span","html-fragment");if(node.shadowRootType()){fragmentElement.textContent=WebInspector.UIString("Shadow Content (%s)").format(WebInspector.DOMTreeElement.shadowRootTypeDisplayName(node.shadowRootType()));this.listItemElement.classList.add("shadow");}else if(node.parentNode&&node.parentNode.templateContent()===node){fragmentElement.textContent=WebInspector.UIString("Template Content");this.listItemElement.classList.add("template");}else{fragmentElement.textContent=WebInspector.UIString("Document Fragment");this.listItemElement.classList.add("fragment");}
break;case Node.ATTRIBUTE_NODE:var value=node.value||"\u200B";this._buildAttributeDOM(info.titleDOM,node.name,value);break;case Node.ELEMENT_NODE:if(node.isPseudoElement()){var pseudoElement=info.titleDOM.createChild("span","html-pseudo-element");pseudoElement.textContent="::"+node.pseudoType();info.titleDOM.appendChild(document.createTextNode("\u200B"));info.hasChildren=false;break;}
var tagName=node.nodeNameInCorrectCase();if(this._elementCloseTag){this._buildTagDOM(info.titleDOM,tagName,true,true);info.hasChildren=false;break;}
this._buildTagDOM(info.titleDOM,tagName,false,false);var textChild=this._singleTextChild(node);var showInlineText=textChild&&textChild.nodeValue().length<WebInspector.DOMTreeElement.MaximumInlineTextChildLength;if(!this.expanded&&(!showInlineText&&(this.treeOutline.isXMLMimeType||!WebInspector.DOMTreeElement.ForbiddenClosingTagElements[tagName]))){if(this.hasChildren){var textNodeElement=info.titleDOM.createChild("span","html-text-node");textNodeElement.textContent=ellipsis;info.titleDOM.append("\u200B");}
this._buildTagDOM(info.titleDOM,tagName,true,false);}
if(showInlineText){var textNodeElement=info.titleDOM.createChild("span","html-text-node");var nodeNameLowerCase=node.nodeName().toLowerCase();if(nodeNameLowerCase==="script")
textNodeElement.appendChild(WebInspector.syntaxHighlightStringAsDocumentFragment(textChild.nodeValue().trim(),"text/javascript"));else if(nodeNameLowerCase==="style")
textNodeElement.appendChild(WebInspector.syntaxHighlightStringAsDocumentFragment(textChild.nodeValue().trim(),"text/css"));else
textNodeElement.textContent=textChild.nodeValue();info.titleDOM.append("\u200B");this._buildTagDOM(info.titleDOM,tagName,true,false);info.hasChildren=false;}
break;case Node.TEXT_NODE:if(node.parentNode&&node.parentNode.nodeName().toLowerCase()==="script"){var newNode=info.titleDOM.createChild("span","html-text-node large");newNode.appendChild(WebInspector.syntaxHighlightStringAsDocumentFragment(trimedNodeValue(),"text/javascript"));}else if(node.parentNode&&node.parentNode.nodeName().toLowerCase()==="style"){var newNode=info.titleDOM.createChild("span","html-text-node large");newNode.appendChild(WebInspector.syntaxHighlightStringAsDocumentFragment(trimedNodeValue(),"text/css"));}else{info.titleDOM.append("\"");var textNodeElement=info.titleDOM.createChild("span","html-text-node");textNodeElement.textContent=node.nodeValue();info.titleDOM.append("\"");}
break;case Node.COMMENT_NODE:var commentElement=info.titleDOM.createChild("span","html-comment");commentElement.append("<!--"+node.nodeValue()+"-->");break;case Node.DOCUMENT_TYPE_NODE:var docTypeElement=info.titleDOM.createChild("span","html-doctype");docTypeElement.append("<!DOCTYPE "+node.nodeName());if(node.publicId){docTypeElement.append(" PUBLIC \""+node.publicId+"\"");if(node.systemId)
docTypeElement.append(" \""+node.systemId+"\"");}else if(node.systemId)
docTypeElement.append(" SYSTEM \""+node.systemId+"\"");docTypeElement.append(">");break;case Node.CDATA_SECTION_NODE:var cdataElement=info.titleDOM.createChild("span","html-text-node");cdataElement.append("<![CDATA["+node.nodeValue()+"]]>");break;case Node.PROCESSING_INSTRUCTION_NODE:var processingInstructionElement=info.titleDOM.createChild("span","html-processing-instruction");var data=node.nodeValue();var dataString=data.length?" "+data:"";var title="<?"+node.nodeNameInCorrectCase()+dataString+"?>";processingInstructionElement.append(title);break;default:info.titleDOM.append(node.nodeNameInCorrectCase().collapseWhitespace());}
return info;}
_singleTextChild(node)
{if(!node)
return null;var firstChild=node.firstChild;if(!firstChild||firstChild.nodeType()!==Node.TEXT_NODE)
return null;if(node.hasShadowRoots())
return null;if(node.templateContent())
return null;if(node.hasPseudoElements())
return null;var sibling=firstChild.nextSibling;return sibling?null:firstChild;}
_showInlineText(node)
{if(node.nodeType()===Node.ELEMENT_NODE){var textChild=this._singleTextChild(node);if(textChild&&textChild.nodeValue().length<WebInspector.DOMTreeElement.MaximumInlineTextChildLength)
return true;}
return false;}
_hasVisibleChildren()
{var node=this.representedObject;if(this._showInlineText(node))
return false;if(node.hasChildNodes())
return true;if(node.templateContent())
return true;if(node.hasPseudoElements())
return true;return false;}
_visibleChildren()
{var node=this.representedObject;var visibleChildren=[];var templateContent=node.templateContent();if(templateContent)
visibleChildren.push(templateContent);var beforePseudoElement=node.beforePseudoElement();if(beforePseudoElement)
visibleChildren.push(beforePseudoElement);if(node.childNodeCount&&node.children)
visibleChildren=visibleChildren.concat(node.children);var afterPseudoElement=node.afterPseudoElement();if(afterPseudoElement)
visibleChildren.push(afterPseudoElement);return visibleChildren;}
remove()
{var parentElement=this.parent;if(!parentElement)
return;var self=this;function removeNodeCallback(error,removedNodeId)
{if(error)
return;if(!self.parent)
return;parentElement.removeChild(self);parentElement.adjustCollapsedRange();}
this.representedObject.removeNode(removeNodeCallback);}
_scrollIntoView()
{function resolvedNode(object)
{if(!object)
return;function scrollIntoView()
{this.scrollIntoViewIfNeeded(true);}
object.callFunction(scrollIntoView,undefined,false,function(){});object.release();}
let node=this.representedObject;WebInspector.RemoteObject.resolveNode(node,"",resolvedNode);}
_editAsHTML()
{var treeOutline=this.treeOutline;var node=this.representedObject;var parentNode=node.parentNode;var index=node.index;var wasExpanded=this.expanded;function selectNode(error,nodeId)
{if(error)
return;treeOutline._updateModifiedNodes();var newNode=parentNode?parentNode.children[index]||parentNode:null;if(!newNode)
return;treeOutline.selectDOMNode(newNode,true);if(wasExpanded){var newTreeItem=treeOutline.findTreeElement(newNode);if(newTreeItem)
newTreeItem.expand();}}
function commitChange(value)
{node.setOuterHTML(value,selectNode);}
node.getOuterHTML(this._startEditingAsHTML.bind(this,commitChange));}
_copyHTML()
{this.representedObject.copyNode();}
_highlightSearchResults()
{if(!this.title||!this._searchQuery||!this._searchHighlightsVisible)
return;if(this._highlightResult){this._updateSearchHighlight(true);return;}
var text=this.title.textContent;var searchRegex=new RegExp(this._searchQuery.escapeForRegExp(),"gi");var match=searchRegex.exec(text);var matchRanges=[];while(match){matchRanges.push({offset:match.index,length:match[0].length});match=searchRegex.exec(text);}
if(!matchRanges.length)
matchRanges.push({offset:0,length:text.length});this._highlightResult=[];WebInspector.highlightRangesWithStyleClass(this.title,matchRanges,WebInspector.DOMTreeElement.SearchHighlightStyleClassName,this._highlightResult);}
_markNodeChanged()
{for(let attribute of this._recentlyModifiedAttributes){let element=attribute.element;if(!element)
continue;element.classList.remove("node-state-changed");element.addEventListener("animationend",this._boundNodeChangedAnimationEnd);element.classList.add("node-state-changed");}}
_nodeChangedAnimationEnd(event)
{let element=event.target;element.classList.remove("node-state-changed");element.removeEventListener("animationend",this._boundNodeChangedAnimationEnd);for(let i=this._recentlyModifiedAttributes.length-1;i>=0;--i){if(this._recentlyModifiedAttributes[i].element===element)
this._recentlyModifiedAttributes.splice(i,1);}}
get pseudoClassesEnabled()
{return!!this.representedObject.enabledPseudoClasses.length;}
_nodePseudoClassesDidChange(event)
{if(this._elementCloseTag)
return;this.updateSelectionArea();this.listItemElement.classList.toggle("pseudo-class-enabled",!!this.representedObject.enabledPseudoClasses.length);}
_fireDidChange()
{super._fireDidChange();this._markNodeChanged();}
handleEvent(event)
{if(event.type==="dragstart"&&this._editing)
event.preventDefault();}
_updateBreakpointStatus()
{let listItemElement=this.listItemElement;if(!listItemElement)
return;let hasBreakpoint=this._breakpointStatus!==WebInspector.DOMTreeElement.BreakpointStatus.None;let hasSubtreeBreakpoints=!!this._subtreeBreakpointCount;if(!hasBreakpoint&&!hasSubtreeBreakpoints){if(this._statusImageElement)
this._statusImageElement.remove();return;}
if(!this._statusImageElement){this._statusImageElement=useSVGSymbol("Images/DOMBreakpoint.svg","status-image");this._statusImageElement.classList.add("breakpoint");this._statusImageElement.addEventListener("click",this._statusImageClicked.bind(this));this._statusImageElement.addEventListener("contextmenu",this._statusImageContextmenu.bind(this));this._statusImageElement.addEventListener("mousedown",(event)=>{event.stopPropagation();});}
this._statusImageElement.classList.toggle("subtree",!hasBreakpoint&&hasSubtreeBreakpoints);this.listItemElement.insertBefore(this._statusImageElement,this.listItemElement.firstChild);let disabled=this._breakpointStatus===WebInspector.DOMTreeElement.BreakpointStatus.DisabledBreakpoint;this._statusImageElement.classList.toggle("disabled",disabled);}
_statusImageClicked(event)
{if(this._breakpointStatus===WebInspector.DOMTreeElement.BreakpointStatus.None)
return;if(event.button!==0||event.ctrlKey)
return;let breakpoints=WebInspector.domDebuggerManager.domBreakpointsForNode(this.representedObject);if(!breakpoints||!breakpoints.length)
return;let shouldEnable=breakpoints.some((breakpoint)=>breakpoint.disabled);breakpoints.forEach((breakpoint)=>breakpoint.disabled=!shouldEnable);}
_statusImageContextmenu(event)
{let hasBreakpoint=this._breakpointStatus!==WebInspector.DOMTreeElement.BreakpointStatus.None;let hasSubtreeBreakpoints=!!this._subtreeBreakpointCount;if(!hasBreakpoint&&!hasSubtreeBreakpoints)
return;let contextMenu=WebInspector.ContextMenu.createFromEvent(event);if(hasBreakpoint){const allowEditing=true;WebInspector.DOMBreakpointTreeController.appendBreakpointContextMenuItems(contextMenu,this.representedObject,allowEditing);return;}
contextMenu.appendItem(WebInspector.UIString("Reveal Breakpoint"),()=>{let breakpointTreeElement=this.selfOrDescendant((treeElement)=>treeElement.breakpointStatus&&treeElement.breakpointStatus!==WebInspector.DOMTreeElement.BreakpointStatus.None);if(!breakpointTreeElement)
return;breakpointTreeElement.revealAndHighlight();});}
_highlightAnimationEnd()
{let listItemElement=this.listItemElement;if(!listItemElement)
return;listItemElement.removeEventListener("animationend",this._boundHighlightAnimationEnd);listItemElement.classList.remove(WebInspector.DOMTreeElement.HighlightStyleClassName);this._animatingHighlight=false;}};WebInspector.DOMTreeElement.InitialChildrenLimit=500;WebInspector.DOMTreeElement.MaximumInlineTextChildLength=80;
WebInspector.DOMTreeElement.ForbiddenClosingTagElements=["area","base","basefont","br","canvas","col","command","embed","frame","hr","img","input","keygen","link","meta","param","source","wbr","track","menuitem"].keySet();WebInspector.DOMTreeElement.EditTagBlacklist=["html","head","body"].keySet();WebInspector.DOMTreeElement.ChangeType={Attribute:"dom-tree-element-change-type-attribute"};WebInspector.DOMTreeElement.BreakpointStatus={None:Symbol("none"),Breakpoint:Symbol("breakpoint"),DisabledBreakpoint:Symbol("disabled-breakpoint"),};WebInspector.DOMTreeElement.HighlightStyleClassName="highlight";WebInspector.DOMTreeElement.SearchHighlightStyleClassName="search-highlight";WebInspector.DOMTreeElement.BouncyHighlightStyleClassName="bouncy-highlight";WebInspector.DOMTreeElementPathComponent=class DOMTreeElementPathComponent extends WebInspector.HierarchicalPathComponent
{constructor(domTreeElement,representedObject)
{var node=domTreeElement.representedObject;var title=null;var className=null;switch(node.nodeType()){case Node.ELEMENT_NODE:if(node.isPseudoElement()){className=WebInspector.DOMTreeElementPathComponent.DOMPseudoElementIconStyleClassName;title="::"+node.pseudoType();}else{className=WebInspector.DOMTreeElementPathComponent.DOMElementIconStyleClassName;title=node.displayName;}
break;case Node.TEXT_NODE:className=WebInspector.DOMTreeElementPathComponent.DOMTextNodeIconStyleClassName;title="\""+node.nodeValue().trimEnd(32)+"\"";break;case Node.COMMENT_NODE:className=WebInspector.DOMTreeElementPathComponent.DOMCommentIconStyleClassName;title="<!--"+node.nodeValue().trimEnd(32)+"-->";break;case Node.DOCUMENT_TYPE_NODE:className=WebInspector.DOMTreeElementPathComponent.DOMDocumentTypeIconStyleClassName;title="<!DOCTYPE>";break;case Node.DOCUMENT_NODE:className=WebInspector.DOMTreeElementPathComponent.DOMDocumentIconStyleClassName;title=node.nodeNameInCorrectCase();break;case Node.CDATA_SECTION_NODE:className=WebInspector.DOMTreeElementPathComponent.DOMCharacterDataIconStyleClassName;title="<![CDATA["+node.trimEnd(32)+"]]>";break;case Node.DOCUMENT_FRAGMENT_NODE: className=WebInspector.DOMTreeElementPathComponent.DOMDocumentTypeIconStyleClassName;if(node.shadowRootType())
title=WebInspector.UIString("Shadow Content");else
title=node.displayName;break;case Node.PROCESSING_INSTRUCTION_NODE:className=WebInspector.DOMTreeElementPathComponent.DOMDocumentTypeIconStyleClassName;title=node.nodeNameInCorrectCase();break;default:console.error("Unknown DOM node type: ",node.nodeType());className=WebInspector.DOMTreeElementPathComponent.DOMNodeIconStyleClassName;title=node.nodeNameInCorrectCase();}
super(title,className,representedObject||domTreeElement.representedObject);this._domTreeElement=domTreeElement;}
get domTreeElement()
{return this._domTreeElement;}
get previousSibling()
{if(!this._domTreeElement.previousSibling)
return null;return new WebInspector.DOMTreeElementPathComponent(this._domTreeElement.previousSibling);}
get nextSibling()
{if(!this._domTreeElement.nextSibling)
return null;if(this._domTreeElement.nextSibling.isCloseTag())
return null;return new WebInspector.DOMTreeElementPathComponent(this._domTreeElement.nextSibling);}
mouseOver()
{var nodeId=this._domTreeElement.representedObject.id;WebInspector.domTreeManager.highlightDOMNode(nodeId);}
mouseOut()
{WebInspector.domTreeManager.hideDOMNodeHighlight();}};WebInspector.DOMTreeElementPathComponent.DOMElementIconStyleClassName="dom-element-icon";WebInspector.DOMTreeElementPathComponent.DOMPseudoElementIconStyleClassName="dom-pseudo-element-icon";WebInspector.DOMTreeElementPathComponent.DOMTextNodeIconStyleClassName="dom-text-node-icon";WebInspector.DOMTreeElementPathComponent.DOMCommentIconStyleClassName="dom-comment-icon";WebInspector.DOMTreeElementPathComponent.DOMDocumentTypeIconStyleClassName="dom-document-type-icon";WebInspector.DOMTreeElementPathComponent.DOMDocumentIconStyleClassName="dom-document-icon";WebInspector.DOMTreeElementPathComponent.DOMCharacterDataIconStyleClassName="dom-character-data-icon";WebInspector.DOMTreeElementPathComponent.DOMNodeIconStyleClassName="dom-node-icon";WebInspector.DOMTreeOutline=class DOMTreeOutline extends WebInspector.TreeOutline
{constructor(omitRootDOMNode,selectEnabled,excludeRevealElementContextMenu)
{super();this.element.addEventListener("mousedown",this._onmousedown.bind(this),false);this.element.addEventListener("mousemove",this._onmousemove.bind(this),false);this.element.addEventListener("mouseout",this._onmouseout.bind(this),false);this.element.addEventListener("dragstart",this._ondragstart.bind(this),false);this.element.addEventListener("dragover",this._ondragover.bind(this),false);this.element.addEventListener("dragleave",this._ondragleave.bind(this),false);this.element.addEventListener("drop",this._ondrop.bind(this),false);this.element.addEventListener("dragend",this._ondragend.bind(this),false);this.element.classList.add("dom",WebInspector.SyntaxHighlightedStyleClassName);this._includeRootDOMNode=!omitRootDOMNode;this._selectEnabled=selectEnabled;this._excludeRevealElementContextMenu=excludeRevealElementContextMenu;this._rootDOMNode=null;this._selectedDOMNode=null;this._editable=false;this._editing=false;this._visible=false;this._hideElementKeyboardShortcut=new WebInspector.KeyboardShortcut(null,"H",this._hideElement.bind(this),this.element);this._hideElementKeyboardShortcut.implicitlyPreventsDefault=false;WebInspector.showShadowDOMSetting.addEventListener(WebInspector.Setting.Event.Changed,this._showShadowDOMSettingChanged,this);}
wireToDomAgent()
{this._elementsTreeUpdater=new WebInspector.DOMTreeUpdater(this);}
close()
{WebInspector.showShadowDOMSetting.removeEventListener(null,null,this);if(this._elementsTreeUpdater){this._elementsTreeUpdater.close();this._elementsTreeUpdater=null;}}
setVisible(visible,omitFocus)
{this._visible=visible;if(!this._visible)
return;this._updateModifiedNodes();if(this._selectedDOMNode)
this._revealAndSelectNode(this._selectedDOMNode,omitFocus);this.update();}
get rootDOMNode()
{return this._rootDOMNode;}
set rootDOMNode(x)
{if(this._rootDOMNode===x)
return;this._rootDOMNode=x;this._isXMLMimeType=x&&x.isXMLNode();this.update();}
get isXMLMimeType()
{return this._isXMLMimeType;}
selectedDOMNode()
{return this._selectedDOMNode;}
selectDOMNode(node,focus)
{if(this._selectedDOMNode===node){this._revealAndSelectNode(node,!focus);return;}
this._selectedDOMNode=node;this._revealAndSelectNode(node,!focus);
if(!node||this._selectedDOMNode===node)
this._selectedNodeChanged();}
get editable()
{return this._editable;}
set editable(x)
{this._editable=x;}
get editing()
{return this._editing;}
update()
{if(!this.rootDOMNode)
return;let selectedNode=this.selectedTreeElement?this.selectedTreeElement.representedObject:null;this.removeChildren();var treeElement;if(this._includeRootDOMNode){treeElement=new WebInspector.DOMTreeElement(this.rootDOMNode);treeElement.selectable=this._selectEnabled;this.appendChild(treeElement);}else{ var node=this.rootDOMNode.firstChild;while(node){treeElement=new WebInspector.DOMTreeElement(node);treeElement.selectable=this._selectEnabled;this.appendChild(treeElement);node=node.nextSibling;if(treeElement.hasChildren&&!treeElement.expanded)
treeElement.expand();}}
if(selectedNode)
this._revealAndSelectNode(selectedNode,true);}
updateSelection()
{
if(this.selectedTreeElement)
this.selectedTreeElement.updateSelectionArea();}
_selectedNodeChanged()
{this.dispatchEventToListeners(WebInspector.DOMTreeOutline.Event.SelectedNodeChanged);}
findTreeElement(node)
{let isAncestorNode=(ancestor,node)=>ancestor.isAncestor(node);let parentNode=(node)=>node.parentNode;let treeElement=super.findTreeElement(node,isAncestorNode,parentNode);if(!treeElement&&node.nodeType()===Node.TEXT_NODE){treeElement=super.findTreeElement(node.parentNode,isAncestorNode,parentNode);}
return treeElement;}
createTreeElementFor(node)
{var treeElement=this.findTreeElement(node);if(treeElement)
return treeElement;if(!node.parentNode)
return null;treeElement=this.createTreeElementFor(node.parentNode);if(!treeElement)
return null;return treeElement.showChildNode(node);}
set suppressRevealAndSelect(x)
{if(this._suppressRevealAndSelect===x)
return;this._suppressRevealAndSelect=x;}
populateContextMenu(contextMenu,event,treeElement)
{let tag=event.target.enclosingNodeOrSelfWithClass("html-tag");let textNode=event.target.enclosingNodeOrSelfWithClass("html-text-node");let commentNode=event.target.enclosingNodeOrSelfWithClass("html-comment");let pseudoElement=event.target.enclosingNodeOrSelfWithClass("html-pseudo-element");if(tag&&treeElement._populateTagContextMenu){contextMenu.appendSeparator();treeElement._populateTagContextMenu(contextMenu,event);}else if(textNode&&treeElement._populateTextContextMenu){contextMenu.appendSeparator();treeElement._populateTextContextMenu(contextMenu,textNode);}else if((commentNode||pseudoElement)&&treeElement._populateNodeContextMenu){contextMenu.appendSeparator();treeElement._populateNodeContextMenu(contextMenu);}
const options={excludeRevealElement:this._excludeRevealElementContextMenu};WebInspector.appendContextMenuItemsForDOMNode(contextMenu,treeElement.representedObject,options);super.populateContextMenu(contextMenu,event,treeElement);}
adjustCollapsedRange()
{}
_revealAndSelectNode(node,omitFocus)
{if(!node||this._suppressRevealAndSelect)
return;if(!WebInspector.showShadowDOMSetting.value){while(node&&node.isInShadowTree())
node=node.parentNode;if(!node)
return;}
var treeElement=this.createTreeElementFor(node);if(!treeElement)
return;treeElement.revealAndSelect(omitFocus);}
_onmousedown(event)
{let element=this.treeElementFromEvent(event);if(!element||element.isEventWithinDisclosureTriangle(event)){event.preventDefault();return;}
element.select();}
_onmousemove(event)
{let element=this.treeElementFromEvent(event);if(element&&this._previousHoveredElement===element)
return;if(this._previousHoveredElement){this._previousHoveredElement.hovered=false;this._previousHoveredElement=null;}
if(element){element.hovered=true;this._previousHoveredElement=element;if(element.representedObject&&!element.tooltip&&element._createTooltipForNode)
element._createTooltipForNode();}
WebInspector.domTreeManager.highlightDOMNode(element?element.representedObject.id:0);}
_onmouseout(event)
{var nodeUnderMouse=document.elementFromPoint(event.pageX,event.pageY);if(nodeUnderMouse&&nodeUnderMouse.isDescendant(this.element))
return;if(this._previousHoveredElement){this._previousHoveredElement.hovered=false;this._previousHoveredElement=null;}
WebInspector.domTreeManager.hideDOMNodeHighlight();}
_ondragstart(event)
{let treeElement=this.treeElementFromEvent(event);if(!treeElement)
return false;if(!this._isValidDragSourceOrTarget(treeElement))
return false;if(treeElement.representedObject.nodeName()==="BODY"||treeElement.representedObject.nodeName()==="HEAD")
return false;event.dataTransfer.setData("text/plain",treeElement.listItemElement.textContent);event.dataTransfer.effectAllowed="copyMove";this._nodeBeingDragged=treeElement.representedObject;WebInspector.domTreeManager.hideDOMNodeHighlight();return true;}
_ondragover(event)
{if(event.dataTransfer.types.includes(WebInspector.CSSStyleDetailsSidebarPanel.ToggledClassesDragType)){event.preventDefault();event.dataTransfer.dropEffect="copy";return false;}
if(!this._nodeBeingDragged)
return false;let treeElement=this.treeElementFromEvent(event);if(!this._isValidDragSourceOrTarget(treeElement))
return false;let node=treeElement.representedObject;while(node){if(node===this._nodeBeingDragged)
return false;node=node.parentNode;}
this.dragOverTreeElement=treeElement;treeElement.listItemElement.classList.add("elements-drag-over");treeElement.updateSelectionArea();event.preventDefault();event.dataTransfer.dropEffect="move";return false;}
_ondragleave(event)
{this._clearDragOverTreeElementMarker();event.preventDefault();return false;}
_isValidDragSourceOrTarget(treeElement)
{if(!treeElement)
return false;var node=treeElement.representedObject;if(!(node instanceof WebInspector.DOMNode))
return false;if(!node.parentNode||node.parentNode.nodeType()!==Node.ELEMENT_NODE)
return false;return true;}
_ondrop(event)
{event.preventDefault();function callback(error,newNodeId)
{if(error)
return;this._updateModifiedNodes();var newNode=WebInspector.domTreeManager.nodeForId(newNodeId);if(newNode)
this.selectDOMNode(newNode,true);}
let treeElement=this.treeElementFromEvent(event);if(this._nodeBeingDragged&&treeElement){let parentNode=null;let anchorNode=null;if(treeElement._elementCloseTag){parentNode=treeElement.representedObject;}else{let dragTargetNode=treeElement.representedObject;parentNode=dragTargetNode.parentNode;anchorNode=dragTargetNode;}
this._nodeBeingDragged.moveTo(parentNode,anchorNode,callback.bind(this));}else{let className=event.dataTransfer.getData(WebInspector.CSSStyleDetailsSidebarPanel.ToggledClassesDragType);if(className&&treeElement)
treeElement.representedObject.toggleClass(className,true);}
delete this._nodeBeingDragged;}
_ondragend(event)
{event.preventDefault();this._clearDragOverTreeElementMarker();delete this._nodeBeingDragged;}
_clearDragOverTreeElementMarker()
{if(this.dragOverTreeElement){let element=this.dragOverTreeElement;this.dragOverTreeElement=null;element.listItemElement.classList.remove("elements-drag-over");element.updateSelectionArea();}}
_updateModifiedNodes()
{if(this._elementsTreeUpdater)
this._elementsTreeUpdater._updateModifiedNodes();}
_showShadowDOMSettingChanged(event)
{var nodeToSelect=this.selectedTreeElement?this.selectedTreeElement.representedObject:null;while(nodeToSelect){if(!nodeToSelect.isInShadowTree())
break;nodeToSelect=nodeToSelect.parentNode;}
this.children.forEach(function(child){child.updateChildren(true);});if(nodeToSelect)
this.selectDOMNode(nodeToSelect);}
_hideElement(event,keyboardShortcut)
{if(!this.selectedTreeElement||WebInspector.isEditingAnyField())
return;event.preventDefault();var effectiveNode=this.selectedTreeElement.representedObject;if(!effectiveNode)
return;if(effectiveNode.isPseudoElement()){effectiveNode=effectiveNode.parentNode;if(!effectiveNode)
return;}
if(effectiveNode.nodeType()!==Node.ELEMENT_NODE)
return;function resolvedNode(object)
{if(!object)
return;function injectStyleAndToggleClass()
{var hideElementStyleSheetIdOrClassName="__WebInspectorHideElement__";var styleElement=document.getElementById(hideElementStyleSheetIdOrClassName);if(!styleElement){styleElement=document.createElement("style");styleElement.id=hideElementStyleSheetIdOrClassName;styleElement.textContent="."+hideElementStyleSheetIdOrClassName+" { visibility: hidden !important; }";document.head.appendChild(styleElement);}
this.classList.toggle(hideElementStyleSheetIdOrClassName);}
object.callFunction(injectStyleAndToggleClass,undefined,false,function(){});object.release();}
WebInspector.RemoteObject.resolveNode(effectiveNode,"",resolvedNode);}};WebInspector.DOMTreeOutline.Event={SelectedNodeChanged:"dom-tree-outline-selected-node-changed"};WebInspector.DOMTreeUpdater=function(treeOutline)
{WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.NodeInserted,this._nodeInserted,this);WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.NodeRemoved,this._nodeRemoved,this);WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.AttributeModified,this._attributesUpdated,this);WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.AttributeRemoved,this._attributesUpdated,this);WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.CharacterDataModified,this._characterDataModified,this);WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.DocumentUpdated,this._documentUpdated,this);WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.ChildNodeCountUpdated,this._childNodeCountUpdated,this);this._treeOutline=treeOutline;this._recentlyInsertedNodes=new Map;this._recentlyDeletedNodes=new Map;this._recentlyModifiedNodes=new Set;this._recentlyModifiedAttributes=new Map;this._textContentAttributeSymbol=Symbol("text-content-attribute");};WebInspector.DOMTreeUpdater.prototype={close:function()
{WebInspector.domTreeManager.removeEventListener(null,null,this);},_documentUpdated:function(event)
{this._reset();},_attributesUpdated:function(event)
{let{node,name}=event.data;this._nodeAttributeModified(node,name);},_characterDataModified:function(event)
{let{node}=event.data;this._nodeAttributeModified(node,this._textContentAttributeSymbol);},_nodeAttributeModified:function(node,attribute)
{if(!this._recentlyModifiedAttributes.has(attribute))
this._recentlyModifiedAttributes.set(attribute,new Set);this._recentlyModifiedAttributes.get(attribute).add(node);this._recentlyModifiedNodes.add(node);if(this._treeOutline._visible)
this.onNextFrame._updateModifiedNodes();},_nodeInserted:function(event)
{this._recentlyInsertedNodes.set(event.data.node,{parent:event.data.parent});if(this._treeOutline._visible)
this.onNextFrame._updateModifiedNodes();},_nodeRemoved:function(event)
{this._recentlyDeletedNodes.set(event.data.node,{parent:event.data.parent});if(this._treeOutline._visible)
this.onNextFrame._updateModifiedNodes();},_childNodeCountUpdated:function(event)
{var treeElement=this._treeOutline.findTreeElement(event.data);if(treeElement)
treeElement.hasChildren=event.data.hasChildNodes();},_updateModifiedNodes:function()
{
let parentElementsToUpdate=new Set;let markNodeParentForUpdate=(value,key,map)=>{let parentNode=value.parent;let parentTreeElement=this._treeOutline.findTreeElement(parentNode);if(parentTreeElement)
parentElementsToUpdate.add(parentTreeElement);};this._recentlyInsertedNodes.forEach(markNodeParentForUpdate);this._recentlyDeletedNodes.forEach(markNodeParentForUpdate);for(let parentTreeElement of parentElementsToUpdate){parentTreeElement.updateTitle();parentTreeElement.updateChildren();}
for(let node of this._recentlyModifiedNodes.values()){let nodeTreeElement=this._treeOutline.findTreeElement(node);if(!nodeTreeElement)
return;for(let[attribute,nodes]of this._recentlyModifiedAttributes.entries()){if(attribute===this._textContentAttributeSymbol)
continue;if(nodes.has(node))
nodeTreeElement.attributeDidChange(attribute);}
nodeTreeElement.updateTitle();}
this._recentlyInsertedNodes.clear();this._recentlyDeletedNodes.clear();this._recentlyModifiedNodes.clear();this._recentlyModifiedAttributes.clear();},_reset:function()
{WebInspector.domTreeManager.hideDOMNodeHighlight();this._recentlyInsertedNodes.clear();this._recentlyDeletedNodes.clear();this._recentlyModifiedNodes.clear();this._recentlyModifiedAttributes.clear();}};WebInspector.DashboardContainerView=class DashboardContainerView extends WebInspector.Object
{constructor()
{super();this._toolbarItem=new WebInspector.NavigationItem("dashboard-container","group",WebInspector.UIString("Activity Viewer"));this._advanceForwardArrowElement=this._toolbarItem.element.appendChild(document.createElement("div"));this._advanceForwardArrowElement.className="advance-arrow advance-forward";this._advanceBackwardArrowElement=this._toolbarItem.element.appendChild(document.createElement("div"));this._advanceBackwardArrowElement.className="advance-arrow advance-backward";this._advanceForwardArrowElement.addEventListener("click",this._advanceForwardArrowClicked.bind(this));this._advanceBackwardArrowElement.addEventListener("click",this._advanceBackwardArrowClicked.bind(this));this._dashboardStack=[];this._currentIndex=-1;this._updateAdvanceArrowVisibility();}
get toolbarItem()
{return this._toolbarItem;}
get currentDashboardView()
{if(this._currentIndex===-1)
return null;return this._dashboardStack[this._currentIndex];}
showDashboardViewForRepresentedObject(representedObject)
{var dashboardView=this._dashboardViewForRepresentedObject(representedObject);if(!dashboardView)
return null;if(this.currentDashboardView===dashboardView)
return dashboardView;var index=this._dashboardStack.indexOf(dashboardView);this._showDashboardAtIndex(index);return dashboardView;}
hideDashboardViewForRepresentedObject(representedObject)
{var onlyReturnExistingViews=true;var dashboardView=this._dashboardViewForRepresentedObject(representedObject,onlyReturnExistingViews);if(this.currentDashboardView!==dashboardView)
return;this._showDashboardAtIndex(this._currentIndex-1);}
closeDashboardViewForRepresentedObject(representedObject)
{var onlyReturnExistingViews=true;var dashboardView=this._dashboardViewForRepresentedObject(representedObject,onlyReturnExistingViews);if(!dashboardView)
return;this._closeDashboardView(dashboardView);}
_advanceForwardArrowClicked()
{this._showDashboardAtIndex(this._currentIndex+1);}
_advanceBackwardArrowClicked()
{this._showDashboardAtIndex(this._currentIndex-1);}
_dismissAdvanceArrows()
{this._advanceForwardArrowElement.classList.add(WebInspector.DashboardContainerView.InactiveStyleClassName);this._advanceBackwardArrowElement.classList.add(WebInspector.DashboardContainerView.InactiveStyleClassName);}
_updateAdvanceArrowVisibility()
{var canAdvanceForward=this._currentIndex<this._dashboardStack.length-1;var canAdvanceBackward=this._currentIndex>0;this._advanceForwardArrowElement.classList.toggle(WebInspector.DashboardContainerView.InactiveStyleClassName,!canAdvanceForward);this._advanceBackwardArrowElement.classList.toggle(WebInspector.DashboardContainerView.InactiveStyleClassName,!canAdvanceBackward);}
_dashboardViewForRepresentedObject(representedObject,onlyReturnExistingViews)
{for(var dashboardView of this._dashboardStack){if(dashboardView.representedObject===representedObject)
return dashboardView;}
if(onlyReturnExistingViews)
return null;dashboardView=WebInspector.DashboardView.create(representedObject);if(!dashboardView)
return null;this._dashboardStack.push(dashboardView);this._toolbarItem.element.appendChild(dashboardView.element);return dashboardView;}
_showDashboardAtIndex(index)
{if(this._currentIndex===index)
return;var advanceDirection=null;if(this._currentIndex<index)
advanceDirection=WebInspector.DashboardContainerView.AdvanceDirection.Forward;else
advanceDirection=WebInspector.DashboardContainerView.AdvanceDirection.Backward;var initialDirection=WebInspector.DashboardContainerView.AdvanceDirection.None;var isInitialDashboard=this._currentIndex===-1;if(!isInitialDashboard)
this._hideDashboardView(this.currentDashboardView,advanceDirection);this._currentIndex=index;this._showDashboardView(this.currentDashboardView,isInitialDashboard?initialDirection:advanceDirection);}
_showDashboardView(dashboardView,advanceDirection)
{dashboardView.shown();this._dismissAdvanceArrows();var animationClass=null;if(advanceDirection===WebInspector.DashboardContainerView.AdvanceDirection.Forward)
animationClass=WebInspector.DashboardContainerView.ForwardIncomingDashboardStyleClassName;if(advanceDirection===WebInspector.DashboardContainerView.AdvanceDirection.Backward)
animationClass=WebInspector.DashboardContainerView.BackwardIncomingDashboardStyleClassName;var container=this;dashboardView.element.classList.add(WebInspector.DashboardContainerView.VisibleDashboardStyleClassName);function animationEnded(event){if(event.target!==dashboardView.element)
return;dashboardView.element.removeEventListener("animationend",animationEnded);dashboardView.element.classList.remove(animationClass);container._updateAdvanceArrowVisibility();}
if(animationClass){dashboardView.element.classList.add(animationClass);dashboardView.element.addEventListener("animationend",animationEnded);}
return dashboardView;}
_hideDashboardView(dashboardView,advanceDirection,callback)
{dashboardView.hidden();this._dismissAdvanceArrows();var animationClass=null;if(advanceDirection===WebInspector.DashboardContainerView.AdvanceDirection.Forward)
animationClass=WebInspector.DashboardContainerView.ForwardOutgoingDashboardStyleClassName;if(advanceDirection===WebInspector.DashboardContainerView.AdvanceDirection.Backward)
animationClass=WebInspector.DashboardContainerView.BackwardOutgoingDashboardStyleClassName;var container=this;function animationEnded(event){if(event.target!==dashboardView.element)
return;dashboardView.element.removeEventListener("animationend",animationEnded);dashboardView.element.classList.remove(animationClass);dashboardView.element.classList.remove(WebInspector.DashboardContainerView.VisibleDashboardStyleClassName);container._updateAdvanceArrowVisibility();if(typeof callback==="function")
callback();}
if(animationClass){dashboardView.element.classList.add(animationClass);dashboardView.element.addEventListener("animationend",animationEnded);}else
dashboardView.element.classList.remove(WebInspector.DashboardContainerView.VisibleDashboardStyleClassName);}
_closeDashboardView(dashboardView)
{function dissociateDashboardView(){dashboardView.closed();dashboardView.element.parentNode.removeChild(dashboardView.element);}
var index=this._dashboardStack.indexOf(dashboardView);if(this.currentDashboardView===dashboardView){var direction=WebInspector.DashboardContainerView.AdvanceDirection.Backward;this._hideDashboardView(this.currentDashboardView,direction,dissociateDashboardView);this._dashboardStack.splice(index,1);--this._currentIndex;this._showDashboardView(this.currentDashboardView,direction);return;}
this._dashboardStack.splice(index,1);if(this._currentIndex>index)
--this._currentIndex;dissociateDashboardView.call(this);this._updateAdvanceArrowVisibility();}};WebInspector.DashboardContainerView.VisibleDashboardStyleClassName="visible";WebInspector.DashboardContainerView.InactiveStyleClassName="inactive";WebInspector.DashboardContainerView.AdvanceDirection={Forward:Symbol("dashboard-container-view-advance-direction-forward"),Backward:Symbol("dashboard-container-view-advance-direction-backward"),None:Symbol("dashboard-container-view-advance-direction-none")};WebInspector.DashboardContainerView.ForwardIncomingDashboardStyleClassName="slide-in-down";WebInspector.DashboardContainerView.BackwardIncomingDashboardStyleClassName="slide-in-up";WebInspector.DashboardContainerView.ForwardOutgoingDashboardStyleClassName="slide-out-down";WebInspector.DashboardContainerView.BackwardOutgoingDashboardStyleClassName="slide-out-up";WebInspector.DashboardView=class DashboardView extends WebInspector.Object
{constructor(representedObject,identifier)
{super();this._representedObject=representedObject;this._element=document.createElement("div");this._element.classList.add("dashboard");this._element.classList.add(identifier);}
static create(representedObject)
{if(representedObject instanceof WebInspector.DefaultDashboard)
return new WebInspector.DefaultDashboardView(representedObject);if(representedObject instanceof WebInspector.DebuggerDashboard)
return new WebInspector.DebuggerDashboardView(representedObject);throw"Can't make a DashboardView for an unknown representedObject.";}
get element()
{return this._element;}
get representedObject()
{return this._representedObject;}
shown()
{}
hidden()
{}
closed()
{}};WebInspector.DatabaseContentView=class DatabaseContentView extends WebInspector.ContentView
{constructor(representedObject)
{super(representedObject);this.database=representedObject;this.element.classList.add("storage-view","query","monospace");this._prompt=new WebInspector.ConsolePrompt(this,"text/x-sql");this.addSubview(this._prompt);this.element.addEventListener("click",this._messagesClicked.bind(this),true);}
saveToCookie(cookie)
{cookie.type=WebInspector.ContentViewCookieType.Database;cookie.host=this.representedObject.host;cookie.name=this.representedObject.name;}
consolePromptCompletionsNeeded(prompt,defaultCompletions,base,prefix,suffix)
{let results=[];prefix=prefix.toLowerCase();function accumulateMatches(textArray)
{for(let text of textArray){if(text.toLowerCase().startsWith(prefix))
results.push(text);}}
function tableNamesCallback(tableNames)
{accumulateMatches(tableNames);accumulateMatches(["SELECT","FROM","WHERE","LIMIT","DELETE FROM","CREATE","DROP","TABLE","INDEX","UPDATE","INSERT INTO","VALUES"]);this._prompt.updateCompletions(results," ");}
this.database.getTableNames(tableNamesCallback.bind(this));}
consolePromptTextCommitted(prompt,query)
{this.database.executeSQL(query,this._queryFinished.bind(this,query),this._queryError.bind(this,query));}
_messagesClicked()
{this._prompt.focus();}
_queryFinished(query,columnNames,values)
{let trimmedQuery=query.trim();let queryView=new WebInspector.DatabaseUserQuerySuccessView(trimmedQuery,columnNames,values);this.insertSubviewBefore(queryView,this._prompt);if(queryView.dataGrid)
queryView.dataGrid.autoSizeColumns(5);this._prompt.element.scrollIntoView(false);if(trimmedQuery.match(/^create /i)||trimmedQuery.match(/^drop table /i))
this.dispatchEventToListeners(WebInspector.DatabaseContentView.Event.SchemaUpdated,this.database);}
_queryError(query,error)
{let message;if(error.message)
message=error.message;else if(error.code===2)
message=WebInspector.UIString("Database no longer has expected version.");else
message=WebInspector.UIString("An unexpected error %s occurred.").format(error.code);let queryView=new WebInspector.DatabaseUserQueryErrorView(query,message);this.insertSubviewBefore(queryView,this._prompt);this._prompt.element.scrollIntoView(false);}};WebInspector.DatabaseContentView.Event={SchemaUpdated:"SchemaUpdated"};WebInspector.DatabaseHostTreeElement=class DatabaseHostTreeElement extends WebInspector.StorageTreeElement
{constructor(host)
{super(WebInspector.FolderTreeElement.FolderIconStyleClassName,WebInspector.displayNameForHost(host),null);this._host=host;this.hasChildren=true;this.expanded=true;}
get name()
{return WebInspector.displayNameForHost(this._host);}
get categoryName()
{return WebInspector.UIString("Databases");}};WebInspector.DatabaseTableContentView=class DatabaseTableContentView extends WebInspector.ContentView
{constructor(representedObject)
{super(representedObject);this.element.classList.add("database-table");this._refreshButtonNavigationItem=new WebInspector.ButtonNavigationItem("database-table-refresh",WebInspector.UIString("Refresh"),"Images/ReloadFull.svg",13,13);this._refreshButtonNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,this._refreshButtonClicked,this);this._messageTextViewElement=null;this.update();}
get navigationItems()
{return[this._refreshButtonNavigationItem];}
update()
{this.representedObject.database.executeSQL("SELECT * FROM \""+this._escapeTableName(this.representedObject.name)+"\"",this._queryFinished.bind(this),this._queryError.bind(this));}
saveToCookie(cookie)
{cookie.type=WebInspector.ContentViewCookieType.DatabaseTable;cookie.host=this.representedObject.host;cookie.name=this.representedObject.name;cookie.database=this.representedObject.database.name;}
get scrollableElements()
{if(!this._dataGrid)
return[];return[this._dataGrid.scrollContainer];}
_escapeTableName(name)
{return name.replace(/\"/g,"\"\"");}
_queryFinished(columnNames,values)
{
if(this._dataGrid){this.removeSubview(this._dataGrid);this._dataGrid=null;}
if(this._messageTextViewElement)
this._messageTextViewElement.remove();if(columnNames.length){this._dataGrid=WebInspector.DataGrid.createSortableDataGrid(columnNames,values);this.addSubview(this._dataGrid);this._dataGrid.updateLayout();return;}
this._messageTextViewElement=WebInspector.createMessageTextView(WebInspector.UIString("The “%s”\ntable is empty.").format(this.representedObject.name),false);this.element.appendChild(this._messageTextViewElement);}
_queryError(error)
{if(this._dataGrid){this.removeSubview(this._dataGrid);this._dataGrid=null;}
if(this._messageTextViewElement)
this._messageTextViewElement.remove();this._messageTextViewElement=WebInspector.createMessageTextView(WebInspector.UIString("An error occurred trying to read the “%s” table.").format(this.representedObject.name),true);this.element.appendChild(this._messageTextViewElement);}
_refreshButtonClicked()
{this.update();}};WebInspector.DatabaseTableTreeElement=class DatabaseTableTreeElement extends WebInspector.GeneralTreeElement
{constructor(representedObject)
{super("database-table-icon",representedObject.name,null,representedObject,false);}};WebInspector.DatabaseTreeElement=class DatabaseTreeElement extends WebInspector.GeneralTreeElement
{constructor(representedObject)
{super("database-icon",representedObject.name,null,representedObject,true);this.hasChildren=false;
this.onpopulate();}
oncollapse()
{this.shouldRefreshChildren=true;}
onpopulate()
{if(this.children.length&&!this.shouldRefreshChildren)
return;this.shouldRefreshChildren=false;this.removeChildren();function tableNamesCallback(tableNames)
{for(var i=0;i<tableNames.length;++i){var databaseTable=new WebInspector.DatabaseTableObject(tableNames[i],this.representedObject);this.appendChild(new WebInspector.DatabaseTableTreeElement(databaseTable));}
this.hasChildren=tableNames.length;}
this.representedObject.getTableNames(tableNamesCallback.bind(this));}};WebInspector.DebuggerDashboardView=class DebuggerDashboardView extends WebInspector.DashboardView
{constructor(representedObject)
{super(representedObject,"debugger");WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ActiveCallFrameDidChange,this._rebuildLocation,this);this._navigationBar=new WebInspector.NavigationBar;this.element.appendChild(this._navigationBar.element);var tooltip=WebInspector.UIString("Continue script execution (%s or %s)").format(WebInspector.pauseOrResumeKeyboardShortcut.displayName,WebInspector.pauseOrResumeAlternateKeyboardShortcut.displayName);this._debuggerResumeButtonItem=new WebInspector.ActivateButtonNavigationItem("debugger-dashboard-pause",tooltip,tooltip,"Images/Resume.svg",15,15);this._debuggerResumeButtonItem.activated=true;this._debuggerResumeButtonItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,this._resumeButtonClicked,this);this._navigationBar.addNavigationItem(this._debuggerResumeButtonItem);var message=this._messageElement=document.createElement("div");message.classList.add("message");message.title=message.textContent=WebInspector.UIString("Debugger Paused");this.element.appendChild(message);var dividerElement=document.createElement("div");dividerElement.classList.add("divider");this.element.appendChild(dividerElement);var locationElement=this._locationElement=document.createElement("div");locationElement.classList.add("location");this.element.appendChild(locationElement);this._rebuildLocation();}
_rebuildLocation()
{if(!WebInspector.debuggerManager.activeCallFrame)
return;this._locationElement.removeChildren();var callFrame=WebInspector.debuggerManager.activeCallFrame;var functionName=callFrame.functionName||WebInspector.UIString("(anonymous function)");var iconClassName=WebInspector.DebuggerDashboardView.FunctionIconStyleClassName;
if(callFrame.functionName&&callFrame.functionName.startsWith("on")&&callFrame.functionName.length>=5)
iconClassName=WebInspector.DebuggerDashboardView.EventListenerIconStyleClassName;var iconElement=document.createElement("div");iconElement.classList.add(iconClassName);this._locationElement.appendChild(iconElement);var iconImageElement=document.createElement("img");iconImageElement.className="icon";iconElement.appendChild(iconImageElement);var nameElement=document.createElement("div");nameElement.append(functionName);nameElement.classList.add("function-name");this._locationElement.appendChild(nameElement);const options={dontFloat:true,ignoreNetworkTab:true,ignoreSearchTab:true,};let linkElement=WebInspector.createSourceCodeLocationLink(WebInspector.debuggerManager.activeCallFrame.sourceCodeLocation,options);this._locationElement.appendChild(linkElement);}
_resumeButtonClicked()
{WebInspector.debuggerManager.resume();}};WebInspector.DebuggerDashboardView.FunctionIconStyleClassName=WebInspector.CallFrameView.FunctionIconStyleClassName;WebInspector.DebuggerDashboardView.EventListenerIconStyleClassName=WebInspector.CallFrameView.EventListenerIconStyleClassName;WebInspector.DebuggerSidebarPanel=class DebuggerSidebarPanel extends WebInspector.NavigationSidebarPanel
{constructor(contentBrowser)
{super("debugger",WebInspector.UIString("Debugger"),true);this.contentBrowser=contentBrowser;WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange,this._mainResourceDidChange,this);WebInspector.Frame.addEventListener(WebInspector.Frame.Event.ResourceWasAdded,this._resourceAdded,this);WebInspector.Target.addEventListener(WebInspector.Target.Event.ResourceAdded,this._resourceAdded,this);WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.BreakpointsEnabledDidChange,this._breakpointsEnabledDidChange,this);WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.BreakpointAdded,this._breakpointAdded,this);WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.BreakpointRemoved,this._breakpointRemoved,this);WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ScriptAdded,this._scriptAdded,this);WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ScriptRemoved,this._scriptRemoved,this);WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ScriptsCleared,this._scriptsCleared,this);WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.Paused,this._debuggerDidPause,this);WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.Resumed,this._debuggerDidResume,this);WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.CallFramesDidChange,this._debuggerCallFramesDidChange,this);WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ActiveCallFrameDidChange,this._debuggerActiveCallFrameDidChange,this);WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.WaitingToPause,this._debuggerWaitingToPause,this);WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.Event.CapturingWillStart,this._timelineCapturingWillStart,this);WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.Event.CapturingStopped,this._timelineCapturingStopped,this);WebInspector.targetManager.addEventListener(WebInspector.TargetManager.Event.TargetAdded,this._targetAdded,this);WebInspector.targetManager.addEventListener(WebInspector.TargetManager.Event.TargetRemoved,this._targetRemoved,this);this._timelineRecordingWarningElement=document.createElement("div");this._timelineRecordingWarningElement.classList.add("warning-banner");this._timelineRecordingWarningElement.append(WebInspector.UIString("Debugger disabled during Timeline recording")," ");let stopRecordingLink=this._timelineRecordingWarningElement.appendChild(document.createElement("a"));stopRecordingLink.textContent=WebInspector.UIString("Stop recording");stopRecordingLink.addEventListener("click",()=>{WebInspector.timelineManager.stopCapturing();});this._breakpointsDisabledWarningElement=document.createElement("div");this._breakpointsDisabledWarningElement.classList.add("warning-banner");this._breakpointsDisabledWarningElement.append(WebInspector.UIString("Breakpoints disabled"),document.createElement("br"));let enableBreakpointsLink=this._breakpointsDisabledWarningElement.appendChild(document.createElement("a"));enableBreakpointsLink.textContent=WebInspector.UIString("Enable breakpoints");enableBreakpointsLink.addEventListener("click",()=>{WebInspector.debuggerToggleBreakpoints();});this._navigationBar=new WebInspector.NavigationBar;this.addSubview(this._navigationBar);var breakpointsImage={src:"Images/Breakpoints.svg",width:15,height:15};var pauseImage={src:"Images/Pause.svg",width:15,height:15};var resumeImage={src:"Images/Resume.svg",width:15,height:15};var stepOverImage={src:"Images/StepOver.svg",width:15,height:15};var stepIntoImage={src:"Images/StepInto.svg",width:15,height:15};var stepOutImage={src:"Images/StepOut.svg",width:15,height:15};var toolTip=WebInspector.UIString("Enable all breakpoints (%s)").format(WebInspector.toggleBreakpointsKeyboardShortcut.displayName);var altToolTip=WebInspector.UIString("Disable all breakpoints (%s)").format(WebInspector.toggleBreakpointsKeyboardShortcut.displayName);this._debuggerBreakpointsButtonItem=new WebInspector.ActivateButtonNavigationItem("debugger-breakpoints",toolTip,altToolTip,breakpointsImage.src,breakpointsImage.width,breakpointsImage.height);this._debuggerBreakpointsButtonItem.activated=WebInspector.debuggerManager.breakpointsEnabled;this._debuggerBreakpointsButtonItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,WebInspector.debuggerToggleBreakpoints,this);this._navigationBar.addNavigationItem(this._debuggerBreakpointsButtonItem);toolTip=WebInspector.UIString("Pause script execution (%s or %s)").format(WebInspector.pauseOrResumeKeyboardShortcut.displayName,WebInspector.pauseOrResumeAlternateKeyboardShortcut.displayName);altToolTip=WebInspector.UIString("Continue script execution (%s or %s)").format(WebInspector.pauseOrResumeKeyboardShortcut.displayName,WebInspector.pauseOrResumeAlternateKeyboardShortcut.displayName);this._debuggerPauseResumeButtonItem=new WebInspector.ToggleButtonNavigationItem("debugger-pause-resume",toolTip,altToolTip,pauseImage.src,resumeImage.src,pauseImage.width,pauseImage.height);this._debuggerPauseResumeButtonItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,WebInspector.debuggerPauseResumeToggle,this);this._navigationBar.addNavigationItem(this._debuggerPauseResumeButtonItem);this._debuggerStepOverButtonItem=new WebInspector.ButtonNavigationItem("debugger-step-over",WebInspector.UIString("Step over (%s or %s)").format(WebInspector.stepOverKeyboardShortcut.displayName,WebInspector.stepOverAlternateKeyboardShortcut.displayName),stepOverImage.src,stepOverImage.width,stepOverImage.height);this._debuggerStepOverButtonItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,WebInspector.debuggerStepOver,this);this._debuggerStepOverButtonItem.enabled=false;this._navigationBar.addNavigationItem(this._debuggerStepOverButtonItem);this._debuggerStepIntoButtonItem=new WebInspector.ButtonNavigationItem("debugger-step-into",WebInspector.UIString("Step into (%s or %s)").format(WebInspector.stepIntoKeyboardShortcut.displayName,WebInspector.stepIntoAlternateKeyboardShortcut.displayName),stepIntoImage.src,stepIntoImage.width,stepIntoImage.height);this._debuggerStepIntoButtonItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,WebInspector.debuggerStepInto,this);this._debuggerStepIntoButtonItem.enabled=false;this._navigationBar.addNavigationItem(this._debuggerStepIntoButtonItem);this._debuggerStepOutButtonItem=new WebInspector.ButtonNavigationItem("debugger-step-out",WebInspector.UIString("Step out (%s or %s)").format(WebInspector.stepOutKeyboardShortcut.displayName,WebInspector.stepOutAlternateKeyboardShortcut.displayName),stepOutImage.src,stepOutImage.width,stepOutImage.height);this._debuggerStepOutButtonItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,WebInspector.debuggerStepOut,this);this._debuggerStepOutButtonItem.enabled=false;this._navigationBar.addNavigationItem(this._debuggerStepOutButtonItem);this.element.classList.add(WebInspector.DebuggerSidebarPanel.OffsetSectionsStyleClassName);this._allExceptionsBreakpointTreeElement=new WebInspector.BreakpointTreeElement(WebInspector.debuggerManager.allExceptionsBreakpoint,WebInspector.DebuggerSidebarPanel.ExceptionIconStyleClassName,WebInspector.UIString("All Exceptions"));this._allUncaughtExceptionsBreakpointTreeElement=new WebInspector.BreakpointTreeElement(WebInspector.debuggerManager.allUncaughtExceptionsBreakpoint,WebInspector.DebuggerSidebarPanel.ExceptionIconStyleClassName,WebInspector.UIString("Uncaught Exceptions"));this._assertionsBreakpointTreeElement=new WebInspector.BreakpointTreeElement(WebInspector.debuggerManager.assertionsBreakpoint,WebInspector.DebuggerSidebarPanel.AssertionIconStyleClassName,WebInspector.UIString("Assertion Failures"));this.suppressFilteringOnTreeElements([this._allExceptionsBreakpointTreeElement,this._allUncaughtExceptionsBreakpointTreeElement,this._assertionsBreakpointTreeElement]);this.filterBar.placeholder=WebInspector.UIString("Filter List");function showResourcesWithIssuesOnlyFilterFunction(treeElement)
{if(treeElement.treeOutline!==this._scriptsContentTreeOutline)
return true;if(treeElement instanceof WebInspector.IssueTreeElement)
return true;if(treeElement.hasChildren){for(let child of treeElement.children){if(child instanceof WebInspector.IssueTreeElement)
return true;}}
return false;}
this.filterBar.addFilterBarButton("debugger-show-resources-with-issues-only",showResourcesWithIssuesOnlyFilterFunction.bind(this),false,WebInspector.UIString("Only show resources with issues"),WebInspector.UIString("Show all resources"),"Images/Errors.svg",15,15);this._breakpointsContentTreeOutline=this.contentTreeOutline;let breakpointsRow=new WebInspector.DetailsSectionRow;breakpointsRow.element.appendChild(this._breakpointsContentTreeOutline.element);let breakpointsGroup=new WebInspector.DetailsSectionGroup([breakpointsRow]);let breakpointsSection=new WebInspector.DetailsSection("breakpoints",WebInspector.UIString("Breakpoints"),[breakpointsGroup]);this.contentView.element.appendChild(breakpointsSection.element);this._breakpointSectionElement=breakpointsSection.element;this._breakpointsContentTreeOutline.addEventListener(WebInspector.TreeOutline.Event.SelectionDidChange,this._treeSelectionDidChange,this);this._breakpointsContentTreeOutline.ondelete=this._breakpointTreeOutlineDeleteTreeElement.bind(this);this._breakpointsContentTreeOutline.populateContextMenu=function(contextMenu,event,treeElement){this._breakpointTreeOutlineContextMenuTreeElement(contextMenu,event,treeElement);WebInspector.TreeOutline.prototype.populateContextMenu(contextMenu,event,treeElement);}.bind(this);this._breakpointsContentTreeOutline.appendChild(this._allExceptionsBreakpointTreeElement);this._breakpointsContentTreeOutline.appendChild(this._allUncaughtExceptionsBreakpointTreeElement);if(DebuggerAgent.setPauseOnAssertions)
this._breakpointsContentTreeOutline.appendChild(this._assertionsBreakpointTreeElement);if(WebInspector.domDebuggerManager.supported){this._domBreakpointsContentTreeOutline=this.createContentTreeOutline(true);this._domBreakpointsContentTreeOutline.addEventListener(WebInspector.TreeOutline.Event.ElementAdded,this._domBreakpointAddedOrRemoved,this);this._domBreakpointsContentTreeOutline.addEventListener(WebInspector.TreeOutline.Event.ElementRemoved,this._domBreakpointAddedOrRemoved,this);this._domBreakpointTreeController=new WebInspector.DOMBreakpointTreeController(this._domBreakpointsContentTreeOutline);this._domBreakpointsRow=new WebInspector.DetailsSectionRow(WebInspector.UIString("No Breakpoints"));this._domBreakpointsRow.element.appendChild(this._domBreakpointsContentTreeOutline.element);this._domBreakpointsRow.showEmptyMessage();const defaultCollapsed=true;let domBreakpointsGroup=new WebInspector.DetailsSectionGroup([this._domBreakpointsRow]);this._domBreakpointsSection=new WebInspector.DetailsSection("dom-breakpoints",WebInspector.UIString("DOM Breakpoints"),[domBreakpointsGroup],null,defaultCollapsed);this.contentView.element.appendChild(this._domBreakpointsSection.element);this._xhrBreakpointsContentTreeOutline=this.createContentTreeOutline(true);this._xhrBreakpointTreeController=new WebInspector.XHRBreakpointTreeController(this._xhrBreakpointsContentTreeOutline);this._xhrBreakpointsRow=new WebInspector.DetailsSectionRow;this._xhrBreakpointsRow.element.appendChild(this._xhrBreakpointsContentTreeOutline.element);let navigationBar=new WebInspector.NavigationBar;let navigationBarWrapper=document.createElement("div");navigationBarWrapper.appendChild(navigationBar.element);let addXHRBreakpointButton=new WebInspector.ButtonNavigationItem("add-xhr-breakpoint",WebInspector.UIString("Add XHR Breakpoint"),"Images/Plus13.svg",13,13);addXHRBreakpointButton.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,this._addXHRBreakpointButtonClicked,this);navigationBar.addNavigationItem(addXHRBreakpointButton);let xhrBreakpointsGroup=new WebInspector.DetailsSectionGroup([this._xhrBreakpointsRow]);let xhrBreakpointsSection=new WebInspector.DetailsSection("xhr-breakpoints",WebInspector.UIString("XHR Breakpoints"),[xhrBreakpointsGroup],navigationBarWrapper,defaultCollapsed);this.contentView.element.appendChild(xhrBreakpointsSection.element);}
this._scriptsContentTreeOutline=this.createContentTreeOutline();this._scriptsContentTreeOutline.addEventListener(WebInspector.TreeOutline.Event.SelectionDidChange,this._treeSelectionDidChange,this);this._scriptsContentTreeOutline.includeSourceMapResourceChildren=true;let scriptsRow=new WebInspector.DetailsSectionRow;scriptsRow.element.appendChild(this._scriptsContentTreeOutline.element);let scriptsGroup=new WebInspector.DetailsSectionGroup([scriptsRow]);this._scriptsSection=new WebInspector.DetailsSection("scripts",WebInspector.UIString("Sources"),[scriptsGroup]);this.contentView.element.appendChild(this._scriptsSection.element);const suppressFiltering=true;this._callStackTreeOutline=this.createContentTreeOutline(suppressFiltering);this._callStackTreeOutline.addEventListener(WebInspector.TreeOutline.Event.SelectionDidChange,this._treeSelectionDidChange,this);this._mainTargetTreeElement=new WebInspector.ThreadTreeElement(WebInspector.mainTarget);this._callStackTreeOutline.appendChild(this._mainTargetTreeElement);this._updateCallStackTreeOutline();this._callStackRow=new WebInspector.DetailsSectionRow;this._callStackRow.element.appendChild(this._callStackTreeOutline.element);this._callStackGroup=new WebInspector.DetailsSectionGroup([this._callStackRow]);this._callStackSection=new WebInspector.DetailsSection("call-stack",WebInspector.UIString("Call Stack"),[this._callStackGroup]);this._showingSingleThreadCallStack=true;this._activeCallFrameTreeElement=null;this._pauseReasonTreeOutline=null;this._pauseReasonLinkContainerElement=document.createElement("span");this._pauseReasonTextRow=new WebInspector.DetailsSectionTextRow;this._pauseReasonGroup=new WebInspector.DetailsSectionGroup([this._pauseReasonTextRow]);this._pauseReasonSection=new WebInspector.DetailsSection("paused-reason",WebInspector.UIString("Pause Reason"),[this._pauseReasonGroup],this._pauseReasonLinkContainerElement);WebInspector.Breakpoint.addEventListener(WebInspector.Breakpoint.Event.DisplayLocationDidChange,this._handleDebuggerObjectDisplayLocationDidChange,this);WebInspector.IssueMessage.addEventListener(WebInspector.IssueMessage.Event.DisplayLocationDidChange,this._handleDebuggerObjectDisplayLocationDidChange,this);WebInspector.issueManager.addEventListener(WebInspector.IssueManager.Event.IssueWasAdded,this._handleIssueAdded,this);WebInspector.issueManager.addEventListener(WebInspector.IssueManager.Event.Cleared,this._handleIssuesCleared,this);if(WebInspector.frameResourceManager.mainFrame)
this._addResourcesRecursivelyForFrame(WebInspector.frameResourceManager.mainFrame);for(var script of WebInspector.debuggerManager.knownNonResourceScripts)
this._addScript(script);if(WebInspector.debuggerManager.paused)
this._debuggerDidPause(null);if(WebInspector.timelineManager.isCapturing()&&WebInspector.debuggerManager.breakpointsDisabledTemporarily)
this._timelineCapturingWillStart(null);this._updateBreakpointsDisabledBanner();}
get minimumWidth()
{return this._navigationBar.minimumWidth;}
closed()
{super.closed();this._domBreakpointTreeController.disconnect();this._domBreakpointTreeController=null;WebInspector.Frame.removeEventListener(null,null,this);WebInspector.debuggerManager.removeEventListener(null,null,this);WebInspector.Breakpoint.removeEventListener(null,null,this);WebInspector.IssueMessage.removeEventListener(null,null,this);}
showDefaultContentView()
{if(WebInspector.frameResourceManager.mainFrame){let mainTreeElement=this._scriptsContentTreeOutline.findTreeElement(WebInspector.frameResourceManager.mainFrame.mainResource);if(mainTreeElement&&this.showDefaultContentViewForTreeElement(mainTreeElement))
return;}
let currentTreeElement=this._scriptsContentTreeOutline.children[0];while(currentTreeElement&&!currentTreeElement.root){if(currentTreeElement instanceof WebInspector.ResourceTreeElement||currentTreeElement instanceof WebInspector.ScriptTreeElement){if(this.showDefaultContentViewForTreeElement(currentTreeElement))
return;}
currentTreeElement=currentTreeElement.traverseNextTreeElement(false,null,true);}}
treeElementForRepresentedObject(representedObject)
{if(representedObject instanceof WebInspector.Frame)
representedObject=representedObject.mainResource;let treeElement=this._breakpointsContentTreeOutline.findTreeElement(representedObject);if(!treeElement)
treeElement=this._scriptsContentTreeOutline.findTreeElement(representedObject);if(treeElement)
return treeElement;if(!(representedObject instanceof WebInspector.Script)){console.error("Didn't find a TreeElement for representedObject",representedObject);return null;}
if(representedObject.url){console.error("Didn't find a ScriptTreeElement for a Script with a URL.");return null;}
return this._addScript(representedObject);}
saveStateToCookie(cookie)
{var selectedTreeElement=this._breakpointsContentTreeOutline.selectedTreeElement;if(!selectedTreeElement){super.saveStateToCookie(cookie);return;}
var representedObject=selectedTreeElement.representedObject;if(representedObject===WebInspector.debuggerManager.allExceptionsBreakpoint){cookie[WebInspector.DebuggerSidebarPanel.SelectedAllExceptionsCookieKey]=true;return;}
if(representedObject===WebInspector.debuggerManager.allUncaughtExceptionsBreakpoint){cookie[WebInspector.DebuggerSidebarPanel.SelectedAllUncaughtExceptionsCookieKey]=true;return;}
if(representedObject===WebInspector.debuggerManager.assertionsBreakpoint){cookie[WebInspector.DebuggerSidebarPanel.SelectedAssertionsCookieKey]=true;return;}
if(representedObject===WebInspector.domDebuggerManager.allRequestsBreakpoint){cookie[WebInspector.DebuggerSidebarPanel.SelectedAllRequestsCookieKey]=true;return;}
super.saveStateToCookie(cookie);}
restoreStateFromCookie(cookie,relaxedMatchDelay)
{if(cookie[WebInspector.DebuggerSidebarPanel.SelectedAllExceptionsCookieKey])
this._allExceptionsBreakpointTreeElement.revealAndSelect();else if(cookie[WebInspector.DebuggerSidebarPanel.SelectedAllUncaughtExceptionsCookieKey])
this._allUncaughtExceptionsBreakpointTreeElement.revealAndSelect();else if(cookie[WebInspector.DebuggerSidebarPanel.SelectedAssertionsCookieKey])
this._assertionsBreakpointTreeElement.revealAndSelect();else if(cookie[WebInspector.DebuggerSidebarPanel.SelectedAllRequestsCookieKey])
this._xhrBreakpointTreeController.revealAndSelect(WebInspector.domDebuggerManager.allRequestsBreakpoint);else
super.restoreStateFromCookie(cookie,relaxedMatchDelay);}
_debuggerWaitingToPause(event)
{this._debuggerPauseResumeButtonItem.enabled=false;}
_debuggerDidPause(event)
{this.contentView.element.insertBefore(this._callStackSection.element,this.contentView.element.firstChild);if(this._updatePauseReason())
this.contentView.element.insertBefore(this._pauseReasonSection.element,this.contentView.element.firstChild);this._debuggerPauseResumeButtonItem.enabled=true;this._debuggerPauseResumeButtonItem.toggled=true;this._debuggerStepOverButtonItem.enabled=true;this._debuggerStepIntoButtonItem.enabled=true;this._debuggerStepOutButtonItem.enabled=true;this.element.classList.add(WebInspector.DebuggerSidebarPanel.DebuggerPausedStyleClassName);}
_debuggerDidResume(event)
{this._callStackSection.element.remove();this._pauseReasonSection.element.remove();this._debuggerPauseResumeButtonItem.enabled=true;this._debuggerPauseResumeButtonItem.toggled=false;this._debuggerStepOverButtonItem.enabled=false;this._debuggerStepIntoButtonItem.enabled=false;this._debuggerStepOutButtonItem.enabled=false;this.element.classList.remove(WebInspector.DebuggerSidebarPanel.DebuggerPausedStyleClassName);}
_breakpointsEnabledDidChange(event)
{this._debuggerBreakpointsButtonItem.activated=WebInspector.debuggerManager.breakpointsEnabled;this._updateBreakpointsDisabledBanner();}
_addBreakpoint(breakpoint)
{let sourceCode=breakpoint.sourceCodeLocation.displaySourceCode;if(!sourceCode)
return null;if(this._breakpointsContentTreeOutline.findTreeElement(breakpoint))
return;let parentTreeElement=this._addTreeElementForSourceCodeToTreeOutline(sourceCode,this._breakpointsContentTreeOutline);
if(breakpoint.disabled)
breakpoint.resolved=true;let breakpointTreeElement=new WebInspector.BreakpointTreeElement(breakpoint);parentTreeElement.insertChild(breakpointTreeElement,insertionIndexForObjectInListSortedByFunction(breakpointTreeElement,parentTreeElement.children,this._compareTreeElements));if(parentTreeElement.children.length===1)
parentTreeElement.expand();return breakpointTreeElement;}
_addBreakpointsForSourceCode(sourceCode)
{var breakpoints=WebInspector.debuggerManager.breakpointsForSourceCode(sourceCode);for(var i=0;i<breakpoints.length;++i)
this._addBreakpoint(breakpoints[i],sourceCode);}
_addIssuesForSourceCode(sourceCode)
{var issues=WebInspector.issueManager.issuesForSourceCode(sourceCode);for(var issue of issues)
this._addIssue(issue);}
_addTreeElementForSourceCodeToTreeOutline(sourceCode,treeOutline)
{let treeElement=treeOutline.getCachedTreeElement(sourceCode);if(!treeElement){if(sourceCode instanceof WebInspector.SourceMapResource)
treeElement=new WebInspector.SourceMapResourceTreeElement(sourceCode);else if(sourceCode instanceof WebInspector.Resource)
treeElement=new WebInspector.ResourceTreeElement(sourceCode);else if(sourceCode instanceof WebInspector.Script)
treeElement=new WebInspector.ScriptTreeElement(sourceCode);}
if(!treeElement){console.error("Unknown sourceCode instance",sourceCode);return null;}
if(!treeElement.parent){treeElement.hasChildren=false;treeElement.expand();treeOutline.insertChild(treeElement,insertionIndexForObjectInListSortedByFunction(treeElement,treeOutline.children,this._compareTopLevelTreeElements.bind(this)));}
return treeElement;}
_addResourcesRecursivelyForFrame(frame)
{this._addResource(frame.mainResource);for(let resource of frame.resourceCollection.items)
this._addResource(resource);for(let childFrame of frame.childFrameCollection.items)
this._addResourcesRecursivelyForFrame(childFrame);}
_resourceAdded(event)
{this._addResource(event.data.resource);}
_addResource(resource)
{if(![WebInspector.Resource.Type.Document,WebInspector.Resource.Type.Script].includes(resource.type))
return;let treeElement=this._addTreeElementForSourceCodeToTreeOutline(resource,this._scriptsContentTreeOutline);this._addBreakpointsForSourceCode(resource);this._addIssuesForSourceCode(resource);if(this.parentSidebar&&!this.contentBrowser.currentContentView)
this.showDefaultContentViewForTreeElement(treeElement);}
_mainResourceDidChange(event)
{if(event.target.isMainFrame()){
this.pruneStaleResourceTreeElements();this.contentBrowser.contentViewContainer.closeAllContentViews();}
if(!event.data.oldMainResource){var resource=event.target.mainResource;this._addTreeElementForSourceCodeToTreeOutline(resource,this._scriptsContentTreeOutline);this._addBreakpointsForSourceCode(resource);this._addIssuesForSourceCode(resource);}}
_timelineCapturingWillStart(event)
{this._debuggerBreakpointsButtonItem.enabled=false;this._debuggerPauseResumeButtonItem.enabled=false;this.contentView.element.insertBefore(this._timelineRecordingWarningElement,this.contentView.element.firstChild);this._updateBreakpointsDisabledBanner();}
_timelineCapturingStopped(event)
{this._debuggerBreakpointsButtonItem.enabled=true;this._debuggerPauseResumeButtonItem.enabled=true;this._timelineRecordingWarningElement.remove();this._updateBreakpointsDisabledBanner();}
_updateBreakpointsDisabledBanner()
{let breakpointsEnabled=WebInspector.debuggerManager.breakpointsEnabled;let timelineWarningShowing=!!this._timelineRecordingWarningElement.parentElement;if(!breakpointsEnabled&&!timelineWarningShowing)
this.contentView.element.insertBefore(this._breakpointsDisabledWarningElement,this.contentView.element.firstChild);else
this._breakpointsDisabledWarningElement.remove();}
_scriptAdded(event)
{this._addScript(event.data.script);}
_addScript(script)
{if(!script.url&&!script.sourceURL)
return null;if(script.dynamicallyAddedScriptElement&&!script.sourceURL)
return null;
if(script.resource)
return null;let treeElement=this._addTreeElementForSourceCodeToTreeOutline(script,this._scriptsContentTreeOutline);this._addBreakpointsForSourceCode(script);this._addIssuesForSourceCode(script);if(this.parentSidebar&&!this.contentBrowser.currentContentView)
this.showDefaultContentViewForTreeElement(treeElement);return treeElement;}
_scriptRemoved(event)
{function removeScript(script,treeOutline)
{let scriptTreeElement=treeOutline.getCachedTreeElement(script);if(scriptTreeElement)
scriptTreeElement.parent.removeChild(scriptTreeElement);}
let script=event.data.script;removeScript(script,this._breakpointsContentTreeOutline);removeScript(script,this._scriptsContentTreeOutline);}
_scriptsCleared(event)
{for(var i=this._breakpointsContentTreeOutline.children.length-1;i>=0;--i){var treeElement=this._breakpointsContentTreeOutline.children[i];if(!(treeElement instanceof WebInspector.ScriptTreeElement))
continue;this._breakpointsContentTreeOutline.removeChildAtIndex(i,true,true);}
this._scriptsContentTreeOutline.removeChildren();this._addResourcesRecursivelyForFrame(WebInspector.frameResourceManager.mainFrame);}
_breakpointAdded(event)
{var breakpoint=event.data.breakpoint;this._addBreakpoint(breakpoint);}
_breakpointRemoved(event)
{var breakpoint=event.data.breakpoint;if(this._pauseReasonTreeOutline){var pauseReasonBreakpointTreeElement=this._pauseReasonTreeOutline.getCachedTreeElement(breakpoint);if(pauseReasonBreakpointTreeElement)
pauseReasonBreakpointTreeElement.removeStatusImage();}
var breakpointTreeElement=this._breakpointsContentTreeOutline.getCachedTreeElement(breakpoint);if(!breakpointTreeElement)
return;this._removeDebuggerTreeElement(breakpointTreeElement);}
_findThreadTreeElementForTarget(target)
{for(let child of this._callStackTreeOutline.children){if(child.target===target)
return child;}
return null;}
_targetAdded(event)
{let target=event.data.target;let treeElement=new WebInspector.ThreadTreeElement(target);this._callStackTreeOutline.appendChild(treeElement);this._updateCallStackTreeOutline();}
_targetRemoved(event)
{let target=event.data.target;let treeElement=this._findThreadTreeElementForTarget(target);this._callStackTreeOutline.removeChild(treeElement);this._updateCallStackTreeOutline();}
_updateCallStackTreeOutline()
{let singleThreadShowing=WebInspector.targets.size===1;this._callStackTreeOutline.element.classList.toggle("single-thread",singleThreadShowing);this._mainTargetTreeElement.selectable=!singleThreadShowing;}
_handleDebuggerObjectDisplayLocationDidChange(event)
{var debuggerObject=event.target;if(event.data.oldDisplaySourceCode===debuggerObject.sourceCodeLocation.displaySourceCode)
return;var debuggerTreeElement=this._breakpointsContentTreeOutline.getCachedTreeElement(debuggerObject);if(!debuggerTreeElement)
return;
var wasSelected=debuggerTreeElement.selected;this._removeDebuggerTreeElement(debuggerTreeElement);var newDebuggerTreeElement=this._addDebuggerObject(debuggerObject);if(newDebuggerTreeElement&&wasSelected)
newDebuggerTreeElement.revealAndSelect(true,false,true,true);}
_removeDebuggerTreeElement(debuggerTreeElement)
{
if(!debuggerTreeElement.__deletedViaDeleteKeyboardShortcut)
debuggerTreeElement.deselect();let parentTreeElement=debuggerTreeElement.parent;parentTreeElement.removeChild(debuggerTreeElement);if(parentTreeElement.children.length)
return;parentTreeElement.treeOutline.removeChild(parentTreeElement);}
_debuggerCallFramesDidChange(event)
{let target=event.data.target;let treeElement=this._findThreadTreeElementForTarget(target);treeElement.refresh();}
_debuggerActiveCallFrameDidChange()
{if(this._activeCallFrameTreeElement){this._activeCallFrameTreeElement.isActiveCallFrame=false;this._activeCallFrameTreeElement=null;}
if(!WebInspector.debuggerManager.activeCallFrame)
return;this._activeCallFrameTreeElement=this._callStackTreeOutline.findTreeElement(WebInspector.debuggerManager.activeCallFrame);if(this._activeCallFrameTreeElement)
this._activeCallFrameTreeElement.isActiveCallFrame=true;}
_breakpointsBeneathTreeElement(treeElement)
{if(!(treeElement instanceof WebInspector.ResourceTreeElement)&&!(treeElement instanceof WebInspector.ScriptTreeElement))
return[];var breakpoints=[];var breakpointTreeElements=treeElement.children;for(var i=0;i<breakpointTreeElements.length;++i){var breakpoint=breakpointTreeElements[i].breakpoint;if(breakpoint)
breakpoints.push(breakpoint);}
return breakpoints;}
_removeAllBreakpoints(breakpoints)
{for(var i=0;i<breakpoints.length;++i){var breakpoint=breakpoints[i];if(WebInspector.debuggerManager.isBreakpointRemovable(breakpoint))
WebInspector.debuggerManager.removeBreakpoint(breakpoint);}}
_toggleAllBreakpoints(breakpoints,disabled)
{for(var i=0;i<breakpoints.length;++i)
breakpoints[i].disabled=disabled;}
_breakpointTreeOutlineDeleteTreeElement(treeElement)
{if(!(treeElement instanceof WebInspector.ResourceTreeElement)&&!(treeElement instanceof WebInspector.ScriptTreeElement))
return false;var wasTopResourceTreeElement=treeElement.previousSibling===this._assertionsBreakpointTreeElement||treeElement.previousSibling===this._allUncaughtExceptionsBreakpointTreeElement;var nextSibling=treeElement.nextSibling;var breakpoints=this._breakpointsBeneathTreeElement(treeElement);this._removeAllBreakpoints(breakpoints);if(wasTopResourceTreeElement&&nextSibling)
nextSibling.select(true,true);return true;}
_breakpointTreeOutlineContextMenuTreeElement(contextMenu,event,treeElement)
{
if(!(treeElement instanceof WebInspector.ResourceTreeElement)&&!(treeElement instanceof WebInspector.ScriptTreeElement))
return;let breakpoints=this._breakpointsBeneathTreeElement(treeElement);let shouldDisable=breakpoints.some((breakpoint)=>!breakpoint.disabled);let removeAllResourceBreakpoints=()=>{this._removeAllBreakpoints(breakpoints);};let toggleAllResourceBreakpoints=()=>{this._toggleAllBreakpoints(breakpoints,shouldDisable);};if(shouldDisable)
contextMenu.appendItem(WebInspector.UIString("Disable Breakpoints"),toggleAllResourceBreakpoints);else
contextMenu.appendItem(WebInspector.UIString("Enable Breakpoints"),toggleAllResourceBreakpoints);contextMenu.appendItem(WebInspector.UIString("Delete Breakpoints"),removeAllResourceBreakpoints);}
_treeSelectionDidChange(event)
{if(!this.visible)
return;let treeElement=event.data.selectedElement;if(!treeElement)
return;const options={ignoreNetworkTab:true,ignoreSearchTab:true,};if(treeElement instanceof WebInspector.ResourceTreeElement||treeElement instanceof WebInspector.ScriptTreeElement){WebInspector.showSourceCode(treeElement.representedObject,options);return;}
if(treeElement instanceof WebInspector.CallFrameTreeElement){let callFrame=treeElement.callFrame;if(callFrame.id)
WebInspector.debuggerManager.activeCallFrame=callFrame;if(callFrame.sourceCodeLocation)
WebInspector.showSourceCodeLocation(callFrame.sourceCodeLocation,options);return;}
if(treeElement instanceof WebInspector.IssueTreeElement){WebInspector.showSourceCodeLocation(treeElement.issueMessage.sourceCodeLocation,options);return;}
if(!(treeElement instanceof WebInspector.BreakpointTreeElement))
return;let breakpoint=treeElement.breakpoint;if(treeElement.treeOutline===this._pauseReasonTreeOutline){WebInspector.showSourceCodeLocation(breakpoint.sourceCodeLocation,options);return;}
if(!treeElement.parent.representedObject)
return;if(!(treeElement.parent.representedObject instanceof WebInspector.SourceCode))
return;WebInspector.showSourceCodeLocation(breakpoint.sourceCodeLocation,options);}
_compareTopLevelTreeElements(a,b)
{function isSpecialBreakpoint(treeElement)
{return treeElement.representedObject===WebInspector.debuggerManager.allExceptionsBreakpoint||treeElement.representedObject===WebInspector.debuggerManager.allUncaughtExceptionsBreakpoint||treeElement.representedObject===WebInspector.debuggerManager.assertionsBreakpoint;}
if(isSpecialBreakpoint(a))
return-1;if(isSpecialBreakpoint(b))
return 1;return a.mainTitle.extendedLocaleCompare(b.mainTitle);}
_compareTreeElements(a,b)
{if(!a.representedObject||!b.representedObject)
return 0;let aLocation=a.representedObject.sourceCodeLocation;let bLocation=b.representedObject.sourceCodeLocation;if(!aLocation||!bLocation)
return 0;var comparisonResult=aLocation.displayLineNumber-bLocation.displayLineNumber;if(comparisonResult!==0)
return comparisonResult;return aLocation.displayColumnNumber-bLocation.displayColumnNumber;}
_updatePauseReason()
{this._pauseReasonTreeOutline=null;this._updatePauseReasonGotoArrow();return this._updatePauseReasonSection();}
_updatePauseReasonSection()
{let target=WebInspector.debuggerManager.activeCallFrame.target;let targetData=WebInspector.debuggerManager.dataForTarget(target);let{pauseReason,pauseData}=targetData;switch(pauseReason){case WebInspector.DebuggerManager.PauseReason.Assertion:if(pauseData&&pauseData.message){this._pauseReasonTextRow.text=WebInspector.UIString("Assertion with message: %s").format(pauseData.message);return true;}
this._pauseReasonTextRow.text=WebInspector.UIString("Assertion Failed");this._pauseReasonGroup.rows=[this._pauseReasonTextRow];return true;case WebInspector.DebuggerManager.PauseReason.Breakpoint:if(pauseData&&pauseData.breakpointId){const suppressFiltering=true;this._pauseReasonTreeOutline=this.createContentTreeOutline(suppressFiltering);this._pauseReasonTreeOutline.addEventListener(WebInspector.TreeOutline.Event.SelectionDidChange,this._treeSelectionDidChange,this);let breakpoint=WebInspector.debuggerManager.breakpointForIdentifier(pauseData.breakpointId);let breakpointTreeElement=new WebInspector.BreakpointTreeElement(breakpoint,WebInspector.DebuggerSidebarPanel.PausedBreakpointIconStyleClassName,WebInspector.UIString("Triggered Breakpoint"));let breakpointDetailsSection=new WebInspector.DetailsSectionRow;this._pauseReasonTreeOutline.appendChild(breakpointTreeElement);breakpointDetailsSection.element.appendChild(this._pauseReasonTreeOutline.element);this._pauseReasonGroup.rows=[breakpointDetailsSection];return true;}
break;case WebInspector.DebuggerManager.PauseReason.CSPViolation:if(pauseData){this._pauseReasonTextRow.text=WebInspector.UIString("Content Security Policy violation of directive: %s").format(pauseData.directive||pauseData.directiveText);this._pauseReasonGroup.rows=[this._pauseReasonTextRow];return true;}
break;case WebInspector.DebuggerManager.PauseReason.DebuggerStatement:this._pauseReasonTextRow.text=WebInspector.UIString("Debugger Statement");this._pauseReasonGroup.rows=[this._pauseReasonTextRow];return true;case WebInspector.DebuggerManager.PauseReason.DOM:if(pauseData&&pauseData.nodeId){let domNode=WebInspector.domTreeManager.nodeForId(pauseData.nodeId);let domBreakpoints=WebInspector.domDebuggerManager.domBreakpointsForNode(domNode);let domBreakpoint;for(let breakpoint of domBreakpoints){if(breakpoint.type===pauseData.type){domBreakpoint=breakpoint;break;}}
if(!domBreakpoint)
return;const suppressFiltering=true;this._pauseReasonTreeOutline=this.createContentTreeOutline(suppressFiltering);let type=WebInspector.DOMBreakpointTreeElement.displayNameForType(domBreakpoint.type);let domBreakpointTreeElement=new WebInspector.DOMBreakpointTreeElement(domBreakpoint,WebInspector.DebuggerSidebarPanel.PausedBreakpointIconStyleClassName,type);let domBreakpointRow=new WebInspector.DetailsSectionRow;this._pauseReasonTreeOutline.appendChild(domBreakpointTreeElement);domBreakpointRow.element.appendChild(this._pauseReasonTreeOutline.element);let ownerElementRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Element"),WebInspector.linkifyNodeReference(domNode));this._pauseReasonGroup.rows=[domBreakpointRow,ownerElementRow];if(domBreakpoint.type!==WebInspector.DOMBreakpoint.Type.SubtreeModified)
return true;let remoteObject=WebInspector.RemoteObject.fromPayload(pauseData.targetNode,target);remoteObject.pushNodeToFrontend((nodeId)=>{if(!nodeId)
return;let node=WebInspector.domTreeManager.nodeForId(nodeId);if(!node)
return;let fragment=document.createDocumentFragment();let description=pauseData.insertion?WebInspector.UIString("Child added to "):WebInspector.UIString("Removed descendant ");fragment.append(description,WebInspector.linkifyNodeReference(node));let targetDescriptionRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Details"),fragment);targetDescriptionRow.element.classList.add("target-description");this._pauseReasonGroup.rows=this._pauseReasonGroup.rows.concat(targetDescriptionRow);});return true;}
break;case WebInspector.DebuggerManager.PauseReason.Exception:if(pauseData){var data=WebInspector.RemoteObject.fromPayload(pauseData,target);this._pauseReasonTextRow.text=WebInspector.UIString("Exception with thrown value: %s").format(data.description);this._pauseReasonGroup.rows=[this._pauseReasonTextRow];return true;}
break;case WebInspector.DebuggerManager.PauseReason.PauseOnNextStatement:this._pauseReasonTextRow.text=WebInspector.UIString("Immediate Pause Requested");this._pauseReasonGroup.rows=[this._pauseReasonTextRow];return true;case WebInspector.DebuggerManager.PauseReason.XHR:if(pauseData){if(pauseData.breakpointURL){let xhrBreakpoint=WebInspector.domDebuggerManager.xhrBreakpointForURL(pauseData.breakpointURL);this._pauseReasonTreeOutline=this.createContentTreeOutline(true);let xhrBreakpointTreeElement=new WebInspector.XHRBreakpointTreeElement(xhrBreakpoint,WebInspector.DebuggerSidebarPanel.PausedBreakpointIconStyleClassName,WebInspector.UIString("Triggered XHR Breakpoint"));let xhrBreakpointRow=new WebInspector.DetailsSectionRow;this._pauseReasonTreeOutline.appendChild(xhrBreakpointTreeElement);xhrBreakpointRow.element.appendChild(this._pauseReasonTreeOutline.element);this._pauseReasonTextRow.text=pauseData.url;this._pauseReasonGroup.rows=[xhrBreakpointRow,this._pauseReasonTextRow];}else{this._pauseReasonTextRow.text=WebInspector.UIString("Requesting: %s").format(pauseData.url);this._pauseReasonGroup.rows=[this._pauseReasonTextRow];}
this._pauseReasonTextRow.element.title=pauseData.url;return true;}
break;case WebInspector.DebuggerManager.PauseReason.Other:console.error("Paused for unknown reason. We should always have a reason.");break;}
return false;}
_updatePauseReasonGotoArrow()
{this._pauseReasonLinkContainerElement.removeChildren();var activeCallFrame=WebInspector.debuggerManager.activeCallFrame;if(!activeCallFrame)
return;var sourceCodeLocation=activeCallFrame.sourceCodeLocation;if(!sourceCodeLocation)
return;const options={useGoToArrowButton:true,ignoreNetworkTab:true,ignoreSearchTab:true,};let linkElement=WebInspector.createSourceCodeLocationLink(sourceCodeLocation,options);this._pauseReasonLinkContainerElement.appendChild(linkElement);}
_addDebuggerObject(debuggerObject)
{if(debuggerObject instanceof WebInspector.Breakpoint)
return this._addBreakpoint(debuggerObject);if(debuggerObject instanceof WebInspector.IssueMessage)
return this._addIssue(debuggerObject);return null;}
_addIssue(issueMessage)
{let issueTreeElement=this._scriptsContentTreeOutline.findTreeElement(issueMessage);if(issueTreeElement)
return issueTreeElement;let parentTreeElement=this._addTreeElementForSourceCodeToTreeOutline(issueMessage.sourceCodeLocation.sourceCode,this._scriptsContentTreeOutline);if(!parentTreeElement)
return null;issueTreeElement=new WebInspector.IssueTreeElement(issueMessage);parentTreeElement.insertChild(issueTreeElement,insertionIndexForObjectInListSortedByFunction(issueTreeElement,parentTreeElement.children,this._compareTreeElements));if(parentTreeElement.children.length===1)
parentTreeElement.expand();return issueTreeElement;}
_handleIssueAdded(event)
{var issue=event.data.issue;if(!issue.sourceCodeLocation||!issue.sourceCodeLocation.sourceCode||(issue.source!=="javascript"&&issue.source!=="console-api"))
return;this._addIssue(issue);}
_handleIssuesCleared(event)
{let currentTreeElement=this._scriptsContentTreeOutline.children[0];let issueTreeElements=[];while(currentTreeElement&&!currentTreeElement.root){if(currentTreeElement instanceof WebInspector.IssueTreeElement)
issueTreeElements.push(currentTreeElement);currentTreeElement=currentTreeElement.traverseNextTreeElement(false,null,true);}
issueTreeElements.forEach((treeElement)=>treeElement.parent.removeChild(treeElement));}
_domBreakpointAddedOrRemoved(event)
{if(!this._domBreakpointsContentTreeOutline.children.length){this._domBreakpointsRow.showEmptyMessage();return;}
if(this._domBreakpointsContentTreeOutline.element.parent)
return;this._domBreakpointsRow.hideEmptyMessage();this._domBreakpointsRow.element.append(this._domBreakpointsContentTreeOutline.element);this._domBreakpointsSection.collapsed=false;}
_addXHRBreakpointButtonClicked(event)
{let popover=new WebInspector.XHRBreakpointPopover(this);popover.show(event.target.element,[WebInspector.RectEdge.MAX_Y,WebInspector.RectEdge.MIN_Y,WebInspector.RectEdge.MAX_X]);}
willDismissPopover(popover)
{if(popover.result!==WebInspector.InputPopover.Result.Committed)
return;let url=popover.value;if(!url)
return;WebInspector.domDebuggerManager.addXHRBreakpoint(new WebInspector.XHRBreakpoint(popover.type,url));}};WebInspector.DebuggerSidebarPanel.DebuggerPausedStyleClassName="paused";WebInspector.DebuggerSidebarPanel.ExceptionIconStyleClassName="breakpoint-exception-icon";WebInspector.DebuggerSidebarPanel.AssertionIconStyleClassName="breakpoint-assertion-icon";WebInspector.DebuggerSidebarPanel.PausedBreakpointIconStyleClassName="breakpoint-paused-icon";WebInspector.DebuggerSidebarPanel.SelectedAllExceptionsCookieKey="debugger-sidebar-panel-all-exceptions-breakpoint";WebInspector.DebuggerSidebarPanel.SelectedAllUncaughtExceptionsCookieKey="debugger-sidebar-panel-all-uncaught-exceptions-breakpoint";WebInspector.DebuggerSidebarPanel.SelectedAssertionsCookieKey="debugger-sidebar-panel-assertions-breakpoint";WebInspector.DebuggerSidebarPanel.SelectedAllRequestsCookieKey="debugger-sidebar-panel-all-requests-breakpoint";WebInspector.DefaultDashboardView=class DefaultDashboardView extends WebInspector.DashboardView
{constructor(representedObject)
{super(representedObject,"default");representedObject.addEventListener(WebInspector.DefaultDashboard.Event.DataDidChange,()=>{this._updateDisplaySoon();});this._scheduledUpdateIdentifier=undefined;this._items={resourcesCount:{tooltip:WebInspector.UIString("Show page resources"),handler:this._resourcesItemWasClicked},resourcesSize:{tooltip:WebInspector.UIString("Show network information"),handler:this._networkItemWasClicked},time:{tooltip:WebInspector.UIString("Show page load timing"),handler:this._timelineItemWasClicked},logs:{tooltip:WebInspector.UIString("Show messages logged to the Console"),handler:this._consoleItemWasClicked.bind(this,WebInspector.LogContentView.Scopes.Logs)},errors:{tooltip:WebInspector.UIString("Show errors logged to the Console"),handler:this._consoleItemWasClicked.bind(this,WebInspector.LogContentView.Scopes.Errors)},issues:{tooltip:WebInspector.UIString("Show warnings logged to the Console"),handler:this._consoleItemWasClicked.bind(this,WebInspector.LogContentView.Scopes.Warnings)}};for(var name in this._items)
this._appendElementForNamedItem(name);}
_updateDisplaySoon()
{if(this._scheduledUpdateIdentifier)
return;this._scheduledUpdateIdentifier=requestAnimationFrame(this._updateDisplay.bind(this));}
_updateDisplay()
{this._scheduledUpdateIdentifier=undefined;var dashboard=this.representedObject;for(var category of["logs","issues","errors"])
this._setConsoleItemValue(category,dashboard[category]);var timeItem=this._items.time;timeItem.text=dashboard.time?Number.secondsToString(dashboard.time):emDash;this._setItemEnabled(timeItem,dashboard.time>0);var countItem=this._items.resourcesCount;countItem.text=Number.abbreviate(dashboard.resourcesCount);this._setItemEnabled(countItem,dashboard.resourcesCount>0);var sizeItem=this._items.resourcesSize;sizeItem.text=dashboard.resourcesSize?Number.bytesToString(dashboard.resourcesSize,false):emDash;this._setItemEnabled(sizeItem,dashboard.resourcesSize>0);}
_appendElementForNamedItem(name)
{var item=this._items[name];item.container=this._element.appendChild(document.createElement("div"));item.container.className="item "+name;item.container.appendChild(document.createElement("img"));item.outlet=item.container.appendChild(document.createElement("div"));Object.defineProperty(item,"text",{set:function(newText)
{newText=newText.toString();if(newText===item.outlet.textContent)
return;item.outlet.textContent=newText;}});item.container.addEventListener("click",(event)=>{this._itemWasClicked(name);});}
_itemWasClicked(name)
{var item=this._items[name];if(!item.container.classList.contains(WebInspector.DefaultDashboardView.EnabledItemStyleClassName))
return;if(item.handler)
item.handler.call(this);}
_resourcesItemWasClicked()
{WebInspector.showResourcesTab();}
_networkItemWasClicked()
{WebInspector.showNetworkTab();}
_timelineItemWasClicked()
{WebInspector.showTimelineTab();}
_consoleItemWasClicked(scope)
{WebInspector.showConsoleTab(scope);}
_setConsoleItemValue(itemName,newValue)
{var iVarName="_"+itemName;var previousValue=this[iVarName];this[iVarName]=newValue;var item=this._items[itemName];item.text=Number.abbreviate(newValue);this._setItemEnabled(item,newValue>0);if(newValue<=previousValue)
return;var container=item.container;function animationEnded(event)
{if(event.target===container){container.classList.remove("pulsing");container.removeEventListener("animationend",animationEnded);}}
if(container.classList.contains("pulsing")){container.classList.remove("pulsing");container.recalculateStyles();}else
container.addEventListener("animationend",animationEnded);container.classList.add("pulsing");}
_setItemEnabled(item,enabled)
{if(enabled){item.container.title=item.tooltip;item.container.classList.add(WebInspector.DefaultDashboardView.EnabledItemStyleClassName);}else{item.container.title="";item.container.classList.remove(WebInspector.DefaultDashboardView.EnabledItemStyleClassName);}}};WebInspector.DefaultDashboardView.EnabledItemStyleClassName="enabled";WebInspector.DividerNavigationItem=class DividerNavigationItem extends WebInspector.NavigationItem
{ get additionalClassNames()
{return["divider"];}};WebInspector.EditableDataGridNode=class EditableDataGridNode extends WebInspector.DataGridNode
{constructor(data)
{const hasChildren=false;super(data,hasChildren);}
get element()
{let element=super.element;if(element)
element.classList.add("editable");return element;}
createCellContent(columnIdentifier,cell)
{let content=super.createCellContent(columnIdentifier,cell);if(typeof content!=="string")
return content;let inputElement=document.createElement("input");inputElement.value=content;inputElement.addEventListener("keypress",this._handleKeyPress.bind(this,columnIdentifier));inputElement.addEventListener("blur",this._handleBlur.bind(this,columnIdentifier));return inputElement;}
_handleKeyPress(columnIdentifier,event)
{if(event.keyCode===WebInspector.KeyboardShortcut.Key.Escape.keyCode)
this.dataGrid.element.focus();if(event.keyCode===WebInspector.KeyboardShortcut.Key.Enter.keyCode)
this._notifyInputElementValueChanged(columnIdentifier,event.target.value);}
_handleBlur(columnIdentifier,event)
{this._notifyInputElementValueChanged(columnIdentifier,event.target.value);}
_notifyInputElementValueChanged(columnIdentifier,value)
{if(value!==this.data[columnIdentifier])
this.dispatchEventToListeners(WebInspector.EditableDataGridNode.Event.ValueChanged,{value,columnIdentifier});}};WebInspector.EditableDataGridNode.Event={ValueChanged:"editable-data-grid-node-value-changed",};WebInspector.isBeingEdited=function(element)
{while(element){if(element.__editing)
return true;element=element.parentNode;}
return false;};WebInspector.markBeingEdited=function(element,value)
{if(value){if(element.__editing)
return false;element.__editing=true;WebInspector.__editingCount=(WebInspector.__editingCount||0)+1;}else{if(!element.__editing)
return false;delete element.__editing;--WebInspector.__editingCount;}
return true;};WebInspector.isEditingAnyField=function()
{return!!WebInspector.__editingCount;};WebInspector.isEventTargetAnEditableField=function(event)
{var textInputTypes={"text":true,"search":true,"tel":true,"url":true,"email":true,"password":true};if(event.target instanceof HTMLInputElement)
return event.target.type in textInputTypes;var codeMirrorEditorElement=event.target.enclosingNodeOrSelfWithClass("CodeMirror");if(codeMirrorEditorElement&&codeMirrorEditorElement.CodeMirror)
return!codeMirrorEditorElement.CodeMirror.getOption("readOnly");if(event.target instanceof HTMLTextAreaElement)
return true;if(event.target.enclosingNodeOrSelfWithClass("text-prompt"))
return true;if(WebInspector.isBeingEdited(event.target))
return true;return false;};WebInspector.EditingConfig=class EditingConfig
{constructor(commitHandler,cancelHandler,context)
{this.commitHandler=commitHandler;this.cancelHandler=cancelHandler;this.context=context;this.spellcheck=false;}
setPasteHandler(pasteHandler)
{this.pasteHandler=pasteHandler;}
setMultiline(multiline)
{this.multiline=multiline;}
setCustomFinishHandler(customFinishHandler)
{this.customFinishHandler=customFinishHandler;}
setNumberCommitHandler(numberCommitHandler)
{this.numberCommitHandler=numberCommitHandler;}};WebInspector.startEditing=function(element,config)
{if(!WebInspector.markBeingEdited(element,true))
return null;config=config||new WebInspector.EditingConfig(function(){},function(){});var committedCallback=config.commitHandler;var cancelledCallback=config.cancelHandler;var pasteCallback=config.pasteHandler;var context=config.context;var oldText=getContent(element);var moveDirection="";element.classList.add("editing");element.contentEditable="plaintext-only";var oldSpellCheck=element.hasAttribute("spellcheck")?element.spellcheck:undefined;element.spellcheck=config.spellcheck;if(config.multiline)
element.classList.add("multiline");var oldTabIndex=element.tabIndex;if(element.tabIndex<0)
element.tabIndex=0;function blurEventListener(){editingCommitted.call(element);}
function getContent(element){if(element.tagName==="INPUT"&&element.type==="text")
return element.value;else
return element.textContent;}
function cleanUpAfterEditing()
{WebInspector.markBeingEdited(element,false);this.classList.remove("editing");this.contentEditable=false;this.scrollTop=0;this.scrollLeft=0;if(oldSpellCheck===undefined)
element.removeAttribute("spellcheck");else
element.spellcheck=oldSpellCheck;if(oldTabIndex===-1)
this.removeAttribute("tabindex");else
this.tabIndex=oldTabIndex;element.removeEventListener("blur",blurEventListener,false);element.removeEventListener("keydown",keyDownEventListener,true);if(pasteCallback)
element.removeEventListener("paste",pasteEventListener,true);WebInspector.restoreFocusFromElement(element);}
function editingCancelled()
{if(this.tagName==="INPUT"&&this.type==="text")
this.value=oldText;else
this.textContent=oldText;cleanUpAfterEditing.call(this);cancelledCallback(this,context);}
function editingCommitted()
{cleanUpAfterEditing.call(this);committedCallback(this,getContent(this),oldText,context,moveDirection);}
function defaultFinishHandler(event)
{var hasOnlyMetaModifierKey=event.metaKey&&!event.shiftKey&&!event.ctrlKey&&!event.altKey;if(isEnterKey(event)&&(!config.multiline||hasOnlyMetaModifierKey))
return"commit";else if(event.keyCode===WebInspector.KeyboardShortcut.Key.Escape.keyCode||event.keyIdentifier==="U+001B")
return"cancel";else if(event.keyIdentifier==="U+0009")
return"move-"+(event.shiftKey?"backward":"forward");else if(event.altKey){if(event.keyIdentifier==="Up"||event.keyIdentifier==="Down")
return"modify-"+(event.keyIdentifier==="Up"?"up":"down");if(event.keyIdentifier==="PageUp"||event.keyIdentifier==="PageDown")
return"modify-"+(event.keyIdentifier==="PageUp"?"up-big":"down-big");}}
function handleEditingResult(result,event)
{if(result==="commit"){editingCommitted.call(element);event.preventDefault();event.stopPropagation();}else if(result==="cancel"){editingCancelled.call(element);event.preventDefault();event.stopPropagation();}else if(result&&result.startsWith("move-")){moveDirection=result.substring(5);if(event.keyIdentifier!=="U+0009")
blurEventListener();}else if(result&&result.startsWith("modify-")){let direction=result.substring(7);let modifyValue=direction.startsWith("up")?1:-1;if(direction.endsWith("big"))
modifyValue*=10;if(event.shiftKey)
modifyValue*=10;else if(event.ctrlKey)
modifyValue/=10;let selection=element.ownerDocument.defaultView.getSelection();if(!selection.rangeCount)
return;let range=selection.getRangeAt(0);if(!range.commonAncestorContainer.isSelfOrDescendant(element))
return false;let wordRange=range.startContainer.rangeOfWord(range.startOffset,WebInspector.EditingSupport.StyleValueDelimiters,element);let word=wordRange.toString();let wordPrefix="";let wordSuffix="";let nonNumberInWord=/[^\d-\.]+/.exec(word);if(nonNumberInWord){let nonNumberEndOffset=nonNumberInWord.index+nonNumberInWord[0].length;if(range.startOffset>wordRange.startOffset+nonNumberInWord.index&&nonNumberEndOffset<word.length&&range.startOffset!==wordRange.startOffset){wordPrefix=word.substring(0,nonNumberEndOffset);word=word.substring(nonNumberEndOffset);}else{wordSuffix=word.substring(nonNumberInWord.index);word=word.substring(0,nonNumberInWord.index);}}
let matches=WebInspector.EditingSupport.CSSNumberRegex.exec(word);if(!matches||matches.length!==4)
return;let replacement=matches[1]+(Math.round((parseFloat(matches[2])+modifyValue)*100)/100)+matches[3];selection.removeAllRanges();selection.addRange(wordRange);document.execCommand("insertText",false,wordPrefix+replacement+wordSuffix);let container=range.commonAncestorContainer;let startOffset=range.startOffset;
if(container.parentNode.classList.contains("editing")){container=container.nextSibling.firstChild;startOffset=0;}
startOffset+=wordPrefix.length;if(!container)
return;let replacementSelectionRange=document.createRange();replacementSelectionRange.setStart(container,startOffset);replacementSelectionRange.setEnd(container,startOffset+replacement.length);selection.removeAllRanges();selection.addRange(replacementSelectionRange);if(typeof config.numberCommitHandler==="function")
config.numberCommitHandler(element,getContent(element),oldText,context,moveDirection);event.preventDefault();}}
function pasteEventListener(event)
{var result=pasteCallback(event);handleEditingResult(result,event);}
function keyDownEventListener(event)
{var handler=config.customFinishHandler||defaultFinishHandler;var result=handler(event);handleEditingResult(result,event);}
element.addEventListener("blur",blurEventListener,false);element.addEventListener("keydown",keyDownEventListener,true);if(pasteCallback)
element.addEventListener("paste",pasteEventListener,true);element.focus();return{cancel:editingCancelled.bind(element),commit:editingCommitted.bind(element)};};WebInspector.EditingSupport={StyleValueDelimiters:" \xA0\t\n\"':;,/()",CSSNumberRegex:/(.*?)(-?(?:\d+(?:\.\d+)?|\.\d+))(.*)/,NumberRegex:/^(-?(?:\d+(?:\.\d+)?|\.\d+))$/};WebInspector.ErrorObjectView=class ErrorObjectView extends WebInspector.Object
{constructor(object)
{super();this._object=object;this._expanded=false;this._hasStackTrace=false;this._element=document.createElement("div");this._element.classList.add("error-object");var previewElement=WebInspector.FormattedValue.createElementForError(this._object);this._element.append(previewElement);previewElement.addEventListener("click",this._handlePreviewOrTitleElementClick.bind(this));this._outlineElement=this._element.appendChild(document.createElement("div"));this._outline=new WebInspector.TreeOutline(this._outlineElement);}
static makeSourceLinkWithPrefix(sourceURL,lineNumber,columnNumber)
{if(!sourceURL)
return null;var span=document.createElement("span");span.classList.add("error-object-link-container");span.textContent=" — ";const options={ignoreNetworkTab:true,ignoreSearchTab:true,};let a=WebInspector.linkifyLocation(sourceURL,new WebInspector.SourceCodePosition(parseInt(lineNumber)-1,parseInt(columnNumber)),options);a.classList.add("error-object-link");span.appendChild(a);return span;}
get object()
{return this._object;}
get element()
{return this._element;}
get treeOutline()
{return this._outline;}
get expanded()
{return this._expanded;}
update()
{this._object.getOwnPropertyDescriptorsAsObject((properties)=>{if(!this._hasStackTrace)
this._buildStackTrace(properties.stack.value.value);this._hasStackTrace=true;});}
expand()
{if(this._expanded)
return;this._expanded=true;this._element.classList.add("expanded");this.update();}
collapse()
{if(!this._expanded)
return;this._expanded=false;this._element.classList.remove("expanded");}
appendTitleSuffix(suffixElement)
{this._element.insertBefore(suffixElement,this._outlineElement);}
_handlePreviewOrTitleElementClick(event)
{if(!this._expanded)
this.expand();else
this.collapse();event.stopPropagation();}
_buildStackTrace(stackString)
{let stackTrace=WebInspector.StackTrace.fromString(this._object.target,stackString);let stackTraceElement=new WebInspector.StackTraceView(stackTrace).element;this._outlineElement.appendChild(stackTraceElement);}};WebInspector.EventListenerSectionGroup=class EventListenerSectionGroup extends WebInspector.DetailsSectionGroup
{constructor(eventListener,options={})
{super();this._eventListener=eventListener;var rows=[];if(!options.hideType)
rows.push(new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Event"),this._eventListener.type));if(!options.hideNode)
rows.push(new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Node"),this._nodeTextOrLink()));rows.push(new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Function"),this._functionTextOrLink()));if(this._eventListener.useCapture)
rows.push(new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Capturing"),WebInspector.UIString("Yes")));else
rows.push(new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Bubbling"),WebInspector.UIString("Yes")));if(this._eventListener.isAttribute)
rows.push(new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Attribute"),WebInspector.UIString("Yes")));if(this._eventListener.passive)
rows.push(new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Passive"),WebInspector.UIString("Yes")));if(this._eventListener.once)
rows.push(new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Once"),WebInspector.UIString("Yes")));this.rows=rows;}
_nodeTextOrLink()
{var node=this._eventListener.node;if(!node)
return"";if(node.nodeType()===Node.DOCUMENT_NODE)
return"document";return WebInspector.linkifyNodeReference(node);}
_functionTextOrLink()
{var match=this._eventListener.handlerBody.match(/function ([^\(]+?)\(/);if(match){var anonymous=false;var functionName=match[1];}else{var anonymous=true;var functionName=WebInspector.UIString("(anonymous function)");}
if(!this._eventListener.location)
return functionName;var sourceCode=WebInspector.debuggerManager.scriptForIdentifier(this._eventListener.location.scriptId,WebInspector.mainTarget);if(!sourceCode)
return functionName;var sourceCodeLocation=sourceCode.createSourceCodeLocation(this._eventListener.location.lineNumber,this._eventListener.location.columnNumber||0);const options={dontFloat:anonymous,ignoreNetworkTab:true,ignoreSearchTab:true,};let linkElement=WebInspector.createSourceCodeLocationLink(sourceCodeLocation,options);if(anonymous)
return linkElement;var fragment=document.createDocumentFragment();fragment.append(linkElement,functionName);return fragment;}};WebInspector.FilterBar=class FilterBar extends WebInspector.Object
{constructor(element)
{super();this._element=element||document.createElement("div");this._element.classList.add("filter-bar");this._filtersNavigationBar=new WebInspector.NavigationBar;this._element.appendChild(this._filtersNavigationBar.element);this._filterFunctionsMap=new Map;this._inputField=document.createElement("input");this._inputField.type="search";this._inputField.spellcheck=false;this._inputField.incremental=true;this._inputField.addEventListener("search",this._handleFilterChanged.bind(this),false);this._element.appendChild(this._inputField);this._lastFilterValue=this.filters;}
get element()
{return this._element;}
get placeholder()
{return this._inputField.getAttribute("placeholder");}
set placeholder(text)
{this._inputField.setAttribute("placeholder",text);}
get inputField()
{return this._inputField;}
get filters()
{return{text:this._inputField.value,functions:[...this._filterFunctionsMap.values()]};}
set filters(filters)
{filters=filters||{};var oldTextValue=this._inputField.value;this._inputField.value=filters.text||"";if(oldTextValue!==this._inputField.value)
this._handleFilterChanged();}
addFilterBarButton(identifier,filterFunction,activatedByDefault,defaultToolTip,activatedToolTip,image,imageWidth,imageHeight)
{var filterBarButton=new WebInspector.FilterBarButton(identifier,filterFunction,activatedByDefault,defaultToolTip,activatedToolTip,image,imageWidth,imageHeight);filterBarButton.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,this._handleFilterBarButtonClicked,this);filterBarButton.addEventListener(WebInspector.FilterBarButton.Event.ActivatedStateToggled,this._handleFilterButtonToggled,this);this._filtersNavigationBar.addNavigationItem(filterBarButton);if(filterBarButton.activated){this._filterFunctionsMap.set(filterBarButton.identifier,filterBarButton.filterFunction);this._handleFilterChanged();}}
hasActiveFilters()
{return!!this._inputField.value||!!this._filterFunctionsMap.size;}
hasFilterChanged()
{var currentFunctions=this.filters.functions;if(this._lastFilterValue.text!==this._inputField.value||this._lastFilterValue.functions.length!==currentFunctions.length)
return true;for(var i=0;i<currentFunctions.length;++i){if(this._lastFilterValue.functions[i]!==currentFunctions[i])
return true;}
return false;}
_handleFilterBarButtonClicked(event)
{var filterBarButton=event.target;filterBarButton.toggle();}
_handleFilterButtonToggled(event)
{var filterBarButton=event.target;if(filterBarButton.activated)
this._filterFunctionsMap.set(filterBarButton.identifier,filterBarButton.filterFunction);else
this._filterFunctionsMap.delete(filterBarButton.identifier);this._handleFilterChanged();}
_handleFilterChanged()
{if(this.hasFilterChanged()){this._lastFilterValue=this.filters;this.dispatchEventToListeners(WebInspector.FilterBar.Event.FilterDidChange);}}};WebInspector.FilterBar.Event={FilterDidChange:"filter-bar-text-filter-did-change"};WebInspector.FilterBarButton=class FilterBarButton extends WebInspector.ActivateButtonNavigationItem
{constructor(identifier,filterFunction,activatedByDefault,defaultToolTip,activatedToolTip,image,imageWidth,imageHeight,role)
{super(identifier,defaultToolTip,activatedToolTip,image,imageWidth,imageHeight,role);this._filterFunction=filterFunction;this._activatedSetting=new WebInspector.Setting(identifier,activatedByDefault);this.activated=!!this._activatedSetting.value;}
get filterFunction()
{return this._filterFunction;}
toggle()
{this.activated=!this.activated;this._activatedSetting.value=this.activated;this.dispatchEventToListeners(WebInspector.FilterBarButton.Event.ActivatedStateToggled);}};WebInspector.FilterBarButton.Event={ActivatedStateToggled:"filter-bar-activated-state-toggled"};WebInspector.FilterBarNavigationItem=class FilterBarNavigationItem extends WebInspector.NavigationItem
{constructor()
{super();this._filterBar=new WebInspector.FilterBar(this.element);}
get filterBar()
{return this._filterBar;}};WebInspector.FindBanner=class FindBanner extends WebInspector.NavigationItem
{constructor(delegate,className,fixed=false)
{super();this._delegate=delegate||null;this.element.classList.add("find-banner");if(className)
this.element.classList.add(className);this._resultCountLabel=document.createElement("label");this.element.appendChild(this._resultCountLabel);this._inputField=document.createElement("input");this._inputField.type="search";this._inputField.spellcheck=false;this._inputField.incremental=true;this._inputField.setAttribute("results",5);this._inputField.setAttribute("autosave","inspector-search");this._inputField.addEventListener("keydown",this._inputFieldKeyDown.bind(this),false);this._inputField.addEventListener("keyup",this._inputFieldKeyUp.bind(this),false);this._inputField.addEventListener("search",this._inputFieldSearch.bind(this),false);this.element.appendChild(this._inputField);this._previousResultButton=document.createElement("button");this._previousResultButton.classList.add("segmented","previous-result");this._previousResultButton.disabled=true;this._previousResultButton.addEventListener("click",this._previousResultButtonClicked.bind(this));this.element.appendChild(this._previousResultButton);let previousResultButtonGlyphElement=document.createElement("div");previousResultButtonGlyphElement.classList.add(WebInspector.FindBanner.SegmentGlyphStyleClassName);this._previousResultButton.appendChild(previousResultButtonGlyphElement);this._nextResultButton=document.createElement("button");this._nextResultButton.classList.add("segmented","next-result");this._nextResultButton.disabled=true;this._nextResultButton.addEventListener("click",this._nextResultButtonClicked.bind(this));this.element.appendChild(this._nextResultButton);let nextResultButtonGlyphElement=document.createElement("div");nextResultButtonGlyphElement.classList.add(WebInspector.FindBanner.SegmentGlyphStyleClassName);this._nextResultButton.appendChild(nextResultButtonGlyphElement);if(fixed)
this._clearAndBlurKeyboardShortcut=new WebInspector.KeyboardShortcut(null,WebInspector.KeyboardShortcut.Key.Escape,this._clearAndBlur.bind(this),this.element);else{let doneButtonElement=document.createElement("button");doneButtonElement.textContent=WebInspector.UIString("Done");doneButtonElement.addEventListener("click",this._doneButtonClicked.bind(this));this.element.appendChild(doneButtonElement);this._hideKeyboardShortcut=new WebInspector.KeyboardShortcut(null,WebInspector.KeyboardShortcut.Key.Escape,this.hide.bind(this),this.element);}
this._numberOfResults=null;this._searchBackwards=false;this._searchKeyPressed=false;this._previousSearchValue="";this._populateFindKeyboardShortcut=new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl,"E",this._populateSearchQueryFromSelection.bind(this));this._populateFindKeyboardShortcut.implicitlyPreventsDefault=false;this._findNextKeyboardShortcut=new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl,"G",this._nextResultButtonClicked.bind(this));this._findPreviousKeyboardShortcut=new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.Shift|WebInspector.KeyboardShortcut.Modifier.CommandOrControl,"G",this._previousResultButtonClicked.bind(this));this.disableKeyboardShortcuts();}
get delegate(){return this._delegate;}
set delegate(newDelegate){this._delegate=newDelegate||null;}
get inputField(){return this._inputField;}
get searchQuery(){return this._inputField.value||"";}
set searchQuery(query){this._inputField.value=query||"";}
get numberOfResults(){return this._numberOfResults;}
set numberOfResults(numberOfResults)
{if(numberOfResults===undefined||isNaN(numberOfResults))
numberOfResults=null;this._numberOfResults=numberOfResults;this._previousResultButton.disabled=this._nextResultButton.disabled=(numberOfResults<=0);if(numberOfResults===null)
this._resultCountLabel.textContent="";else if(numberOfResults<=0)
this._resultCountLabel.textContent=WebInspector.UIString("Not found");else if(numberOfResults===1)
this._resultCountLabel.textContent=WebInspector.UIString("1 match");else if(numberOfResults>1)
this._resultCountLabel.textContent=WebInspector.UIString("%d matches").format(numberOfResults);}
get targetElement()
{return this._targetElement;}
set targetElement(element)
{function delayedWork()
{oldTargetElement.classList.remove(WebInspector.FindBanner.NoTransitionStyleClassName);this.element.classList.remove(WebInspector.FindBanner.NoTransitionStyleClassName);}
if(this._targetElement){var oldTargetElement=this._targetElement;this._targetElement.classList.add(WebInspector.FindBanner.NoTransitionStyleClassName);this._targetElement.classList.remove(WebInspector.FindBanner.SupportsFindBannerStyleClassName);this._targetElement.classList.remove(WebInspector.FindBanner.ShowingFindBannerStyleClassName);this.element.classList.add(WebInspector.FindBanner.NoTransitionStyleClassName);this.element.classList.remove(WebInspector.FindBanner.ShowingStyleClassName);setTimeout(delayedWork.bind(this),0);}
this._targetElement=element||null;if(this._targetElement)
this._targetElement.classList.add(WebInspector.FindBanner.SupportsFindBannerStyleClassName);}
get showing()
{return this.element.classList.contains(WebInspector.FindBanner.ShowingStyleClassName);}
focus()
{if(!this._inputField.value.length)
this._inputField.focus();else
this._inputField.select();}
_clearAndBlur()
{this.numberOfResults=null;this._inputField.value="";this._previousSearchValue="";if(this._delegate.findBannerSearchCleared)
this._delegate.findBannerSearchCleared();if(this._delegate.findBannerWantsToClearAndBlur)
this._delegate.findBannerWantsToClearAndBlur();}
show()
{if(!this._targetElement)
return;if(!this._targetElement.parentNode)
return;if(this.element.parentNode!==this._targetElement.parentNode)
this._targetElement.parentNode.insertBefore(this.element,this._targetElement);function delayedWork()
{this._targetElement.classList.add(WebInspector.FindBanner.ShowingFindBannerStyleClassName);this.element.classList.add(WebInspector.FindBanner.ShowingStyleClassName);this._inputField.select();}
setTimeout(delayedWork.bind(this),0);this.dispatchEventToListeners(WebInspector.FindBanner.Event.DidShow);}
hide()
{if(!this._targetElement)
return;this._inputField.blur();this._targetElement.classList.remove(WebInspector.FindBanner.ShowingFindBannerStyleClassName);this.element.classList.remove(WebInspector.FindBanner.ShowingStyleClassName);this.dispatchEventToListeners(WebInspector.FindBanner.Event.DidHide);}
enableKeyboardShortcuts()
{this._populateFindKeyboardShortcut.disabled=false;this._findNextKeyboardShortcut.disabled=false;this._findPreviousKeyboardShortcut.disabled=false;}
disableKeyboardShortcuts()
{this._populateFindKeyboardShortcut.disabled=true;this._findNextKeyboardShortcut.disabled=true;this._findPreviousKeyboardShortcut.disabled=true;}
_inputFieldKeyDown(event)
{if(event.keyIdentifier==="Shift")
this._searchBackwards=true;else if(event.keyIdentifier==="Enter")
this._searchKeyPressed=true;}
_inputFieldKeyUp(event)
{if(event.keyIdentifier==="Shift")
this._searchBackwards=false;else if(event.keyIdentifier==="Enter")
this._searchKeyPressed=false;}
_inputFieldSearch(event)
{if(this._inputField.value){if(this._previousSearchValue!==this.searchQuery){if(this._delegate&&typeof this._delegate.findBannerPerformSearch==="function")
this._delegate.findBannerPerformSearch(this,this.searchQuery);}else if(this._searchKeyPressed&&this._numberOfResults>0){if(this._searchBackwards){if(this._delegate&&typeof this._delegate.findBannerRevealPreviousResult==="function")
this._delegate.findBannerRevealPreviousResult(this);}else{if(this._delegate&&typeof this._delegate.findBannerRevealNextResult==="function")
this._delegate.findBannerRevealNextResult(this);}}}else{this.numberOfResults=null;if(this._delegate&&typeof this._delegate.findBannerSearchCleared==="function")
this._delegate.findBannerSearchCleared(this);}
this._previousSearchValue=this.searchQuery;}
_populateSearchQueryFromSelection(event)
{if(this._delegate&&typeof this._delegate.findBannerSearchQueryForSelection==="function"){var query=this._delegate.findBannerSearchQueryForSelection(this);if(query){this.searchQuery=query;if(this._delegate&&typeof this._delegate.findBannerPerformSearch==="function")
this._delegate.findBannerPerformSearch(this,this.searchQuery);}}}
_previousResultButtonClicked(event)
{if(this._delegate&&typeof this._delegate.findBannerRevealPreviousResult==="function")
this._delegate.findBannerRevealPreviousResult(this);}
_nextResultButtonClicked(event)
{if(this._delegate&&typeof this._delegate.findBannerRevealNextResult==="function")
this._delegate.findBannerRevealNextResult(this);}
_doneButtonClicked(event)
{this.hide();}};WebInspector.FindBanner.SupportsFindBannerStyleClassName="supports-find-banner";WebInspector.FindBanner.ShowingFindBannerStyleClassName="showing-find-banner";WebInspector.FindBanner.NoTransitionStyleClassName="no-find-banner-transition";WebInspector.FindBanner.ShowingStyleClassName="showing";WebInspector.FindBanner.SegmentGlyphStyleClassName="glyph";WebInspector.FindBanner.Event={DidShow:"find-banner-did-show",DidHide:"find-banner-did-hide"};WebInspector.FlexibleSpaceNavigationItem=class FlexibleSpaceNavigationItem extends WebInspector.NavigationItem
{ get additionalClassNames()
{return["flexible-space"];}};WebInspector.FontResourceContentView=class FontResourceContentView extends WebInspector.ResourceContentView
{constructor(resource)
{super(resource,"font");this._styleElement=null;this._previewElement=null;}
get previewElement()
{return this._previewElement;}
sizeToFit()
{if(!this._previewElement)
return;for(var fontSize=WebInspector.FontResourceContentView.MaximumFontSize;fontSize>=WebInspector.FontResourceContentView.MinimumFontSize;fontSize-=5){this._previewElement.style.fontSize=fontSize+"px";if(this._previewElement.offsetWidth<=this.element.offsetWidth)
break;}}
contentAvailable(content,base64Encoded)
{this._fontObjectURL=this.resource.createObjectURL();if(!this._fontObjectURL){this.showGenericErrorMessage();return;}
const uniqueFontName="WebInspectorFontPreview"+(++WebInspector.FontResourceContentView._uniqueFontIdentifier);var format="";if(this.resource.mimeTypeComponents.type==="image/svg+xml")
format=" format(\"svg\")";if(this._styleElement&&this._styleElement.parentNode)
this._styleElement.parentNode.removeChild(this._styleElement);this.removeLoadingIndicator();this._styleElement=document.createElement("style");this._styleElement.textContent="@font-face { font-family: \""+uniqueFontName+"\"; src: url("+this._fontObjectURL+")"+format+"; }";if(this.visible)
document.head.appendChild(this._styleElement);this._previewElement=document.createElement("div");this._previewElement.className="preview";this._previewElement.style.fontFamily=uniqueFontName;function createMetricElement(className)
{var metricElement=document.createElement("div");metricElement.className="metric "+className;return metricElement;}
var lines=WebInspector.FontResourceContentView.PreviewLines;for(var i=0;i<lines.length;++i){var lineElement=document.createElement("div");lineElement.className="line";lineElement.appendChild(createMetricElement("top"));lineElement.appendChild(createMetricElement("xheight"));lineElement.appendChild(createMetricElement("middle"));lineElement.appendChild(createMetricElement("baseline"));lineElement.appendChild(createMetricElement("bottom"));var contentElement=document.createElement("div");contentElement.className="content";contentElement.textContent=lines[i];lineElement.appendChild(contentElement);this._previewElement.appendChild(lineElement);}
this.element.appendChild(this._previewElement);this.sizeToFit();}
shown()
{if(this._styleElement)
document.head.appendChild(this._styleElement);}
hidden()
{if(this._styleElement&&this._styleElement.parentNode)
this._styleElement.parentNode.removeChild(this._styleElement);}
closed()
{
if(this._fontObjectURL)
URL.revokeObjectURL(this._fontObjectURL);}
layout()
{this.sizeToFit();}};WebInspector.FontResourceContentView._uniqueFontIdentifier=0;WebInspector.FontResourceContentView.PreviewLines=["ABCDEFGHIJKLM","NOPQRSTUVWXYZ","abcdefghijklm","nopqrstuvwxyz","1234567890"];WebInspector.FontResourceContentView.MaximumFontSize=72;WebInspector.FontResourceContentView.MinimumFontSize=12;WebInspector.FormattedValue={};WebInspector.FormattedValue.classNameForTypes=function(type,subtype)
{return"formatted-"+(subtype?subtype:type);};WebInspector.FormattedValue.classNameForObject=function(object)
{return WebInspector.FormattedValue.classNameForTypes(object.type,object.subtype);};WebInspector.FormattedValue.createLinkifiedElementString=function(string)
{var span=document.createElement("span");span.className="formatted-string";span.append("\"",WebInspector.linkifyStringAsFragment(string.replace(/\\/g,"\\\\").replace(/"/g,"\\\"")),"\"");return span;};WebInspector.FormattedValue.createElementForNode=function(object)
{var span=document.createElement("span");span.className="formatted-node";object.pushNodeToFrontend(function(nodeId){if(!nodeId){span.textContent=object.description;return;}
var treeOutline=new WebInspector.DOMTreeOutline;treeOutline.setVisible(true);treeOutline.rootDOMNode=WebInspector.domTreeManager.nodeForId(nodeId);if(!treeOutline.children[0].hasChildren)
treeOutline.element.classList.add("single-node");span.appendChild(treeOutline.element);});return span;};WebInspector.FormattedValue.createElementForError=function(object)
{var span=document.createElement("span");span.classList.add("formatted-error");span.textContent=object.description;if(!object.preview)
return span;function previewToObject(preview)
{var result={};for(var property of preview.propertyPreviews)
result[property.name]=property.value;return result;}
var preview=previewToObject(object.preview);if(!preview.sourceURL)
return span;var sourceLinkWithPrefix=WebInspector.ErrorObjectView.makeSourceLinkWithPrefix(preview.sourceURL,preview.line,preview.column);span.append(sourceLinkWithPrefix);return span;};WebInspector.FormattedValue.createElementForNodePreview=function(preview)
{var value=preview.value||preview.description;var span=document.createElement("span");span.className="formatted-node-preview syntax-highlighted";if(value.startsWith("<!--")){var comment=span.appendChild(document.createElement("span"));comment.className="html-comment";comment.textContent=value;return span;}
if(value.startsWith("<!DOCTYPE")){var doctype=span.appendChild(document.createElement("span"));doctype.className="html-doctype";doctype.textContent=value;return span;}
var matches=value.match(/^<(\S+?)(?: (\S+?)="(.*?)")?>$/);if(!matches){span.textContent=value;return span;}
var tag=document.createElement("span");tag.className="html-tag";tag.append("<");var tagName=tag.appendChild(document.createElement("span"));tagName.className="html-tag-name";tagName.textContent=matches[1];if(matches[2]){tag.append(" ");var attribute=tag.appendChild(document.createElement("span"));attribute.className="html-attribute";var attributeName=attribute.appendChild(document.createElement("span"));attributeName.className="html-attribute-name";attributeName.textContent=matches[2];attribute.append("=\"");var attributeValue=attribute.appendChild(document.createElement("span"));attributeValue.className="html-attribute-value";attributeValue.textContent=matches[3];attribute.append("\"");}
tag.append(">");span.appendChild(tag);return span;};WebInspector.FormattedValue.createElementForFunctionWithName=function(description)
{var span=document.createElement("span");span.classList.add("formatted-function");span.textContent=description.substring(0,description.indexOf("("));return span;};WebInspector.FormattedValue.createElementForTypesAndValue=function(type,subtype,displayString,size,isPreview,hadException)
{var span=document.createElement("span");span.classList.add(WebInspector.FormattedValue.classNameForTypes(type,subtype));if(hadException){span.textContent="[Exception: "+displayString+"]";return span;}
if(type==="string"){displayString=displayString.truncate(WebInspector.FormattedValue.MAX_PREVIEW_STRING_LENGTH);span.textContent=doubleQuotedString(displayString.replace(/\n/g,"\u21B5"));return span;}
if(type==="function"){if(subtype==="class")
span.textContent=displayString;else
span.textContent=isPreview?"function":displayString;return span;}
span.textContent=displayString;if(size!==undefined&&(subtype==="array"||subtype==="set"||subtype==="map"||subtype==="weakmap"||subtype==="weakset")){var sizeElement=span.appendChild(document.createElement("span"));sizeElement.className="size";sizeElement.textContent=" ("+size+")";}
return span;};WebInspector.FormattedValue.createElementForRemoteObject=function(object,hadException)
{return WebInspector.FormattedValue.createElementForTypesAndValue(object.type,object.subtype,object.description,object.size,false,hadException);};WebInspector.FormattedValue.createElementForObjectPreview=function(objectPreview)
{return WebInspector.FormattedValue.createElementForTypesAndValue(objectPreview.type,objectPreview.subtype,objectPreview.description,objectPreview.size,true,false);};WebInspector.FormattedValue.createElementForPropertyPreview=function(propertyPreview)
{return WebInspector.FormattedValue.createElementForTypesAndValue(propertyPreview.type,propertyPreview.subtype,propertyPreview.value,undefined,true,false);};WebInspector.FormattedValue.createObjectPreviewOrFormattedValueForObjectPreview=function(objectPreview,previewViewMode)
{if(objectPreview.subtype==="node")
return WebInspector.FormattedValue.createElementForNodePreview(objectPreview);if(objectPreview.type==="function")
return WebInspector.FormattedValue.createElementForFunctionWithName(objectPreview.description);return new WebInspector.ObjectPreviewView(objectPreview,previewViewMode).element;};WebInspector.FormattedValue.createObjectPreviewOrFormattedValueForRemoteObject=function(object,previewViewMode)
{if(object.subtype==="node")
return WebInspector.FormattedValue.createElementForNode(object);if(object.subtype==="error")
return WebInspector.FormattedValue.createElementForError(object);if(object.preview)
return new WebInspector.ObjectPreviewView(object.preview,previewViewMode);return WebInspector.FormattedValue.createElementForRemoteObject(object);};WebInspector.FormattedValue.createObjectTreeOrFormattedValueForRemoteObject=function(object,propertyPath,forceExpanding)
{if(object.subtype==="node")
return WebInspector.FormattedValue.createElementForNode(object);if(object.subtype==="null")
return WebInspector.FormattedValue.createElementForRemoteObject(object);if(object.type==="object"||object.subtype==="class"){var objectTree=new WebInspector.ObjectTreeView(object,null,propertyPath,forceExpanding);return objectTree.element;}
return WebInspector.FormattedValue.createElementForRemoteObject(object);};WebInspector.FormattedValue.MAX_PREVIEW_STRING_LENGTH=140;WebInspector.FrameDOMTreeContentView=class FrameDOMTreeContentView extends WebInspector.DOMTreeContentView
{constructor(domTree)
{super(domTree);this._domTree=domTree;this._domTree.addEventListener(WebInspector.DOMTree.Event.RootDOMNodeInvalidated,this._rootDOMNodeInvalidated,this);this._requestRootDOMNode();}
get domTree()
{return this._domTree;}
closed()
{this._domTree.removeEventListener(null,null,this);super.closed();}
getSearchContextNodes(callback)
{this._domTree.requestRootDOMNode(function(rootDOMNode){callback([rootDOMNode.id]);});}
_rootDOMNodeAvailable(rootDOMNode)
{this.domTreeOutline.rootDOMNode=rootDOMNode;if(!rootDOMNode){this.domTreeOutline.selectDOMNode(null,false);return;}
this._restoreBreakpointsAfterUpdate();this._restoreSelectedNodeAfterUpdate(this._domTree.frame.url,rootDOMNode.body||rootDOMNode.documentElement||rootDOMNode.firstChild);}
_rootDOMNodeInvalidated(event)
{this._requestRootDOMNode();}
_requestRootDOMNode()
{this._domTree.requestRootDOMNode(this._rootDOMNodeAvailable.bind(this));}};WebInspector.FrameTreeElement=class FrameTreeElement extends WebInspector.ResourceTreeElement
{constructor(frame,representedObject)
{super(frame.mainResource,representedObject||frame);this._frame=frame;this._updateExpandedSetting();frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange,this._mainResourceDidChange,this);frame.addEventListener(WebInspector.Frame.Event.ResourceWasAdded,this._resourceWasAdded,this);frame.addEventListener(WebInspector.Frame.Event.ResourceWasRemoved,this._resourceWasRemoved,this);frame.addEventListener(WebInspector.Frame.Event.ExtraScriptAdded,this._extraScriptAdded,this);frame.addEventListener(WebInspector.Frame.Event.ChildFrameWasAdded,this._childFrameWasAdded,this);frame.addEventListener(WebInspector.Frame.Event.ChildFrameWasRemoved,this._childFrameWasRemoved,this);frame.domTree.addEventListener(WebInspector.DOMTree.Event.ContentFlowWasAdded,this._childContentFlowWasAdded,this);frame.domTree.addEventListener(WebInspector.DOMTree.Event.ContentFlowWasRemoved,this._childContentFlowWasRemoved,this);frame.domTree.addEventListener(WebInspector.DOMTree.Event.RootDOMNodeInvalidated,this._rootDOMNodeInvalidated,this);this.shouldRefreshChildren=true;this.folderSettingsKey=this._frame.url.hash;this.registerFolderizeSettings("frames",WebInspector.UIString("Frames"),this._frame.childFrameCollection,WebInspector.FrameTreeElement);this.registerFolderizeSettings("flows",WebInspector.UIString("Flows"),this._frame.domTree.contentFlowCollection,WebInspector.ContentFlowTreeElement);this.registerFolderizeSettings("extra-scripts",WebInspector.UIString("Extra Scripts"),this._frame.extraScriptCollection,WebInspector.ScriptTreeElement);if(window.CanvasAgent&&WebInspector.settings.experimentalShowCanvasContextsInResources.value)
this.registerFolderizeSettings("canvases",WebInspector.UIString("Canvases"),this._frame.canvasCollection,WebInspector.CanvasTreeElement);function forwardingConstructor(representedObject,...extraArguments){if(representedObject instanceof WebInspector.CSSStyleSheet)
return new WebInspector.CSSStyleSheetTreeElement(representedObject,...extraArguments);return new WebInspector.ResourceTreeElement(representedObject,...extraArguments);}
for(let[key,value]of Object.entries(WebInspector.Resource.Type)){let folderName=WebInspector.Resource.displayNameForType(value,true);let treeElementConstructor=forwardingConstructor;if(value===WebInspector.Resource.Type.WebSocket)
treeElementConstructor=WebInspector.WebSocketResourceTreeElement;this.registerFolderizeSettings(key,folderName,this._frame.resourceCollectionForType(value),treeElementConstructor);}
this.updateParentStatus();}
get frame()
{return this._frame;}
descendantResourceTreeElementTypeDidChange(resourceTreeElement,oldType)
{
this._addTreeElement(resourceTreeElement);}
descendantResourceTreeElementMainTitleDidChange(resourceTreeElement,oldMainTitle)
{
this._addTreeElement(resourceTreeElement);}
updateSourceMapResources()
{if(!this.treeOutline||!this.treeOutline.includeSourceMapResourceChildren)
return;if(!this._frame)
return;this.updateParentStatus();if(this.resource&&this.resource.sourceMaps.length)
this.shouldRefreshChildren=true;}
onattach()
{WebInspector.GeneralTreeElement.prototype.onattach.call(this);WebInspector.cssStyleManager.addEventListener(WebInspector.CSSStyleManager.Event.StyleSheetAdded,this._styleSheetAdded,this);if(window.CanvasAgent&&WebInspector.settings.experimentalShowCanvasContextsInResources.value){this._frame.canvasCollection.addEventListener(WebInspector.Collection.Event.ItemAdded,this._canvasWasAdded,this);this._frame.canvasCollection.addEventListener(WebInspector.Collection.Event.ItemRemoved,this._canvasWasRemoved,this);}}
ondetach()
{WebInspector.cssStyleManager.removeEventListener(WebInspector.CSSStyleManager.Event.StyleSheetAdded,this._styleSheetAdded,this);if(window.CanvasAgent&&WebInspector.settings.experimentalShowCanvasContextsInResources.value){this._frame.canvasCollection.removeEventListener(WebInspector.Collection.Event.ItemAdded,this._canvasWasAdded,this);this._frame.canvasCollection.removeEventListener(WebInspector.Collection.Event.ItemRemoved,this._canvasWasRemoved,this);}
super.ondetach();}
compareChildTreeElements(a,b)
{if(a===b)
return 0;var aIsResource=a instanceof WebInspector.ResourceTreeElement;var bIsResource=b instanceof WebInspector.ResourceTreeElement;if(aIsResource&&bIsResource)
return WebInspector.ResourceTreeElement.compareResourceTreeElements(a,b);if(!aIsResource&&!bIsResource){return super.compareChildTreeElements(a,b);}
return aIsResource?1:-1;}
onpopulate()
{if(this.children.length&&!this.shouldRefreshChildren)
return;this.shouldRefreshChildren=false;this.removeChildren();this.updateParentStatus();this.prepareToPopulate();for(let frame of this._frame.childFrameCollection.items)
this.addChildForRepresentedObject(frame);for(let resource of this._frame.resourceCollection.items)
this.addChildForRepresentedObject(resource);var sourceMaps=this.resource&&this.resource.sourceMaps;for(var i=0;i<sourceMaps.length;++i){var sourceMap=sourceMaps[i];for(var j=0;j<sourceMap.resources.length;++j)
this.addChildForRepresentedObject(sourceMap.resources[j]);}
for(let contentFlow of this._frame.domTree.contentFlowCollection.items)
this.addChildForRepresentedObject(contentFlow);for(let extraScript of this._frame.extraScriptCollection.items){if(extraScript.sourceURL||extraScript.sourceMappingURL)
this.addChildForRepresentedObject(extraScript);}
if(window.CanvasAgent&&WebInspector.settings.experimentalShowCanvasContextsInResources.value){for(let canvas of this._frame.canvasCollection.items)
this.addChildForRepresentedObject(canvas);}
const doNotCreateIfMissing=true;WebInspector.cssStyleManager.preferredInspectorStyleSheetForFrame(this._frame,this.addRepresentedObjectToNewChildQueue.bind(this),doNotCreateIfMissing);}
onexpand()
{this._expandedSetting.value=true;this._frame.domTree.requestContentFlowList();}
oncollapse()
{if(this.hasChildren)
this._expandedSetting.value=false;}
_updateExpandedSetting()
{this._expandedSetting=new WebInspector.Setting("frame-expanded-"+this._frame.url.hash,this._frame.isMainFrame()?true:false);if(this._expandedSetting.value)
this.expand();else
this.collapse();}
_mainResourceDidChange(event)
{this._updateResource(this._frame.mainResource);this.updateParentStatus();this.removeChildren();
this._updateExpandedSetting();this.shouldRefreshChildren=true;}
_resourceWasAdded(event)
{this.addRepresentedObjectToNewChildQueue(event.data.resource);}
_resourceWasRemoved(event)
{this.removeChildForRepresentedObject(event.data.resource);}
_extraScriptAdded(event)
{let extraScript=event.data.script;if(extraScript.sourceURL||extraScript.sourceMappingURL)
this.addRepresentedObjectToNewChildQueue(extraScript);}
_childFrameWasAdded(event)
{this.addRepresentedObjectToNewChildQueue(event.data.childFrame);}
_childFrameWasRemoved(event)
{this.removeChildForRepresentedObject(event.data.childFrame);}
_childContentFlowWasAdded(event)
{this.addRepresentedObjectToNewChildQueue(event.data.flow);}
_childContentFlowWasRemoved(event)
{this.removeChildForRepresentedObject(event.data.flow);}
_rootDOMNodeInvalidated()
{if(this.expanded)
this._frame.domTree.requestContentFlowList();}
_styleSheetAdded(event)
{if(!event.data.styleSheet.isInspectorStyleSheet())
return;this.addRepresentedObjectToNewChildQueue(event.data.styleSheet);}
_canvasWasAdded(event)
{this.addRepresentedObjectToNewChildQueue(event.data.item);}
_canvasWasRemoved(event)
{this.removeChildForRepresentedObject(event.data.item);}};WebInspector.GeneralTreeElementPathComponent=class GeneralTreeElementPathComponent extends WebInspector.HierarchicalPathComponent
{constructor(generalTreeElement,representedObject)
{super(generalTreeElement.mainTitle,generalTreeElement.classNames,representedObject||generalTreeElement.representedObject);this._generalTreeElement=generalTreeElement;generalTreeElement.addEventListener(WebInspector.GeneralTreeElement.Event.MainTitleDidChange,this._mainTitleDidChange,this);}
get generalTreeElement()
{return this._generalTreeElement;}
get previousSibling()
{var previousSibling=this._generalTreeElement.previousSibling;while(previousSibling&&previousSibling.hidden)
previousSibling=previousSibling.previousSibling;if(!previousSibling)
return null;return new WebInspector.GeneralTreeElementPathComponent(previousSibling);}
get nextSibling()
{var nextSibling=this._generalTreeElement.nextSibling;while(nextSibling&&nextSibling.hidden)
nextSibling=nextSibling.nextSibling;if(!nextSibling)
return null;return new WebInspector.GeneralTreeElementPathComponent(nextSibling);}
_mainTitleDidChange(event)
{this.displayName=this._generalTreeElement.mainTitle;}};WebInspector.GenericResourceContentView=class GenericResourceContentView extends WebInspector.ResourceContentView
{constructor(resource)
{super(resource,"generic");}};WebInspector.GoToLineDialog=class GoToLineDialog extends WebInspector.Dialog
{constructor(delegate)
{super(delegate);this.element.classList.add("go-to-line-dialog");let field=this.element.appendChild(document.createElement("div"));this._input=field.appendChild(document.createElement("input"));this._input.type="text";this._input.placeholder=WebInspector.UIString("Line Number");this._input.spellcheck=false;this._clearIcon=field.appendChild(document.createElement("img"));this._input.addEventListener("input",this);this._input.addEventListener("keydown",this);this._input.addEventListener("blur",this);this._clearIcon.addEventListener("mousedown",this);this._clearIcon.addEventListener("click",this);this._dismissing=false;}
handleEvent(event)
{switch(event.type){case"input":this._handleInputEvent(event);break;case"keydown":this._handleKeydownEvent(event);break;case"blur":this._handleBlurEvent(event);break;case"mousedown":this._handleMousedownEvent(event);break;case"click":this._handleClickEvent(event);break;}}
didPresentDialog()
{this._input.focus();this._clear();}
_handleInputEvent(event)
{let force=this._input.value!=="";this.element.classList.toggle(WebInspector.GoToLineDialog.NonEmptyClassName,force);}
_handleKeydownEvent(event)
{if(event.keyCode===WebInspector.KeyboardShortcut.Key.Escape.keyCode){if(this._input.value==="")
this.dismiss();else
this._clear();event.preventDefault();}else if(event.keyCode===WebInspector.KeyboardShortcut.Key.Enter.keyCode){let value=parseInt(this._input.value,10);if(this.representedObjectIsValid(value)){this.dismiss(value);return;}
this._inputElement.select();InspectorFrontendHost.beep();}}
_handleBlurEvent(event)
{this.dismiss();}
_handleMousedownEvent(event)
{this._input.select();
event.preventDefault();}
_handleClickEvent(event)
{this._clear();}
_clear()
{this._input.value="";this.element.classList.remove(WebInspector.GoToLineDialog.NonEmptyClassName);}};WebInspector.GoToLineDialog.NonEmptyClassName="non-empty";WebInspector.GradientEditor=class GradientEditor extends WebInspector.Object
{constructor()
{super();this._element=document.createElement("div");this._element.classList.add("gradient-editor");this._gradient=null;this._gradientTypes={"linear-gradient":{type:WebInspector.LinearGradient,label:WebInspector.UIString("Linear Gradient"),repeats:false},"radial-gradient":{type:WebInspector.RadialGradient,label:WebInspector.UIString("Radial Gradient"),repeats:false},"repeating-linear-gradient":{type:WebInspector.LinearGradient,label:WebInspector.UIString("Repeating Linear Gradient"),repeats:true},"repeating-radial-gradient":{type:WebInspector.RadialGradient,label:WebInspector.UIString("Repeating Radial Gradient"),repeats:true}};this._editingColor=false;this._gradientTypePicker=this._element.appendChild(document.createElement("select"));this._gradientTypePicker.classList.add("gradient-type-select");for(let type in this._gradientTypes){let option=this._gradientTypePicker.appendChild(document.createElement("option"));option.value=type;option.text=this._gradientTypes[type].label;}
this._gradientTypePicker.addEventListener("change",this._gradientTypeChanged.bind(this));this._gradientSlider=new WebInspector.GradientSlider(this);this._element.appendChild(this._gradientSlider.element);this._colorPicker=new WebInspector.ColorPicker;this._colorPicker.colorWheel.dimension=190;this._colorPicker.enableColorComponentInputs=false;this._colorPicker.addEventListener(WebInspector.ColorPicker.Event.ColorChanged,this._colorPickerColorChanged,this);let angleContainerElement=this._element.appendChild(document.createElement("div"));angleContainerElement.classList.add("gradient-angle");angleContainerElement.append(WebInspector.UIString("Angle"));let boundAngleValueChanged=this._angleValueChanged.bind(this);this._angleSliderElement=angleContainerElement.appendChild(document.createElement("input"));this._angleSliderElement.type="range";this._angleSliderElement.addEventListener("input",boundAngleValueChanged);this._angleInputElement=angleContainerElement.appendChild(document.createElement("input"));this._angleInputElement.type="number";this._angleInputElement.addEventListener("input",boundAngleValueChanged);this._angleUnitsSelectElement=angleContainerElement.appendChild(document.createElement("select"));this._angleUnitsSelectElement.addEventListener("change",this._angleUnitsChanged.bind(this));const angleUnitsData=[{name:WebInspector.LinearGradient.AngleUnits.DEG,min:0,max:360,step:1},{name:WebInspector.LinearGradient.AngleUnits.RAD,min:0,max:2*Math.PI,step:0.01},{name:WebInspector.LinearGradient.AngleUnits.GRAD,min:0,max:400,step:1},{name:WebInspector.LinearGradient.AngleUnits.TURN,min:0,max:1,step:0.01}];this._angleUnitsConfiguration=new Map(angleUnitsData.map(({name,min,max,step})=>{let optionElement=this._angleUnitsSelectElement.appendChild(document.createElement("option"));optionElement.value=optionElement.textContent=name;return[name,{element:optionElement,min,max,step}];}));}
get element()
{return this._element;}
set gradient(gradient)
{if(!gradient)
return;const isLinear=gradient instanceof WebInspector.LinearGradient;const isRadial=gradient instanceof WebInspector.RadialGradient;if(!isLinear&&!isRadial)
return;this._gradient=gradient;this._gradientSlider.stops=this._gradient.stops;if(isLinear){this._gradientTypePicker.value=this._gradient.repeats?"repeating-linear-gradient":"linear-gradient";this._angleUnitsChanged();}else
this._gradientTypePicker.value=this._gradient.repeats?"repeating-radial-gradient":"radial-gradient";this._updateCSSClassForGradientType();}
get gradient()
{return this._gradient;}
gradientSliderStopsDidChange(gradientSlider)
{this._gradient.stops=gradientSlider.stops;this.dispatchEventToListeners(WebInspector.GradientEditor.Event.GradientChanged,{gradient:this._gradient});}
gradientSliderStopWasSelected(gradientSlider,stop)
{const selectedStop=gradientSlider.selectedStop;if(selectedStop&&!this._editingColor){this._element.appendChild(this._colorPicker.element);this._element.classList.add("editing-color");this._colorPicker.color=selectedStop.color;this._editingColor=true;}else if(!selectedStop){this._colorPicker.element.remove();this._element.classList.remove("editing-color");this._editingColor=false;}
this._angleInputElement.blur();this.dispatchEventToListeners(WebInspector.GradientEditor.Event.ColorPickerToggled);this.dispatchEventToListeners(WebInspector.GradientEditor.Event.GradientChanged,{gradient:this._gradient});}
_updateCSSClassForGradientType()
{const isRadial=this._gradient instanceof WebInspector.RadialGradient;this._element.classList.toggle("radial-gradient",isRadial);this.dispatchEventToListeners(WebInspector.GradientEditor.Event.ColorPickerToggled);}
_gradientTypeChanged(event)
{const descriptor=this._gradientTypes[this._gradientTypePicker.value];if(!(this._gradient instanceof descriptor.type)){if(descriptor.type===WebInspector.LinearGradient){this._gradient=new WebInspector.LinearGradient({value:180,units:WebInspector.LinearGradient.AngleUnits.DEG},this._gradient.stops);this._angleUnitsChanged();}else
this._gradient=new WebInspector.RadialGradient("",this._gradient.stops);this._updateCSSClassForGradientType();}
this._gradient.repeats=descriptor.repeats;this.dispatchEventToListeners(WebInspector.GradientEditor.Event.GradientChanged,{gradient:this._gradient});}
_colorPickerColorChanged(event)
{this._gradientSlider.selectedStop.color=event.target.color;this._gradientSlider.stops=this._gradient.stops;this.dispatchEventToListeners(WebInspector.GradientEditor.Event.GradientChanged,{gradient:this._gradient});}
_angleValueChanged(event)
{switch(event.target){case this._angleInputElement:this._gradient.angleValue=this._angleSliderElement.value=parseFloat(this._angleInputElement.value)||0;break;case this._angleSliderElement:this._gradient.angleValue=this._angleInputElement.value=parseFloat(this._angleSliderElement.value)||0;break;default:WebInspector.reportInternalError("Input event fired for disabled color component input");return;}
this.dispatchEventToListeners(WebInspector.GradientEditor.Event.GradientChanged,{gradient:this._gradient});}
_angleUnitsChanged(event)
{let units=this._angleUnitsSelectElement.value;let configuration=this._angleUnitsConfiguration.get(units);if(!configuration){WebInspector.reportInternalError(`Missing configuration data for selected angle units "${units}"`);return;}
this._gradient.angleUnits=units;this._angleInputElement.min=this._angleSliderElement.min=configuration.min;this._angleInputElement.max=this._angleSliderElement.max=configuration.max;this._angleInputElement.step=this._angleSliderElement.step=configuration.step;this._angleInputElement.value=this._angleSliderElement.value=this._gradient.angleValue;this.dispatchEventToListeners(WebInspector.GradientEditor.Event.GradientChanged,{gradient:this._gradient});}};WebInspector.GradientEditor.Event={GradientChanged:"gradient-editor-gradient-changed",ColorPickerToggled:"gradient-editor-color-picker-toggled"};WebInspector.GradientSlider=class GradientSlider extends WebInspector.Object
{constructor(delegate)
{super();this.delegate=delegate;this._element=null;this._stops=[];this._knobs=[];this._selectedKnob=null;this._canvas=document.createElement("canvas");this._keyboardShortcutEsc=new WebInspector.KeyboardShortcut(null,WebInspector.KeyboardShortcut.Key.Escape);}
get element()
{if(!this._element){this._element=document.createElement("div");this._element.className="gradient-slider";this._element.appendChild(this._canvas);this._addArea=this._element.appendChild(document.createElement("div"));this._addArea.addEventListener("mouseover",this);this._addArea.addEventListener("mousemove",this);this._addArea.addEventListener("mouseout",this);this._addArea.addEventListener("click",this);this._addArea.className=WebInspector.GradientSlider.AddAreaClassName;}
return this._element;}
get stops()
{return this._stops;}
set stops(stops)
{this._stops=stops;this._updateStops();}
get selectedStop()
{return this._selectedKnob?this._selectedKnob.stop:null;}
handleEvent(event)
{switch(event.type){case"mouseover":this._handleMouseover(event);break;case"mousemove":this._handleMousemove(event);break;case"mouseout":this._handleMouseout(event);break;case"click":this._handleClick(event);break;}}
handleKeydownEvent(event)
{if(!this._keyboardShortcutEsc.matchesEvent(event)||!this._selectedKnob||!this._selectedKnob.selected)
return false;this._selectedKnob.selected=false;return true;}
knobXDidChange(knob)
{knob.stop.offset=knob.x/WebInspector.GradientSlider.Width;this._sortStops();this._updateCanvas();}
knobCanDetach(knob)
{return this._knobs.length>2;}
knobWillDetach(knob)
{knob.element.classList.add(WebInspector.GradientSlider.DetachingClassName);this._stops.remove(knob.stop);this._knobs.remove(knob);this._sortStops();this._updateCanvas();}
knobSelectionChanged(knob)
{if(this._selectedKnob&&this._selectedKnob!==knob&&knob.selected)
this._selectedKnob.selected=false;this._selectedKnob=knob.selected?knob:null;if(this.delegate&&typeof this.delegate.gradientSliderStopWasSelected==="function")
this.delegate.gradientSliderStopWasSelected(this,knob.stop);if(this._selectedKnob)
WebInspector.addWindowKeydownListener(this);else
WebInspector.removeWindowKeydownListener(this);}
_handleMouseover(event)
{this._updateShadowKnob(event);}
_handleMousemove(event)
{this._updateShadowKnob(event);}
_handleMouseout(event)
{if(!this._shadowKnob)
return;this._shadowKnob.element.remove();delete this._shadowKnob;}
_handleClick(event)
{this._updateShadowKnob(event);this._knobs.push(this._shadowKnob);this._shadowKnob.element.classList.remove(WebInspector.GradientSlider.ShadowClassName);var stop={offset:this._shadowKnob.x/WebInspector.GradientSlider.Width,color:this._shadowKnob.wellColor};this._stops.push(stop);this._sortStops();this._updateStops();this._knobs[this._stops.indexOf(stop)].selected=true;delete this._shadowKnob;}
_updateShadowKnob(event)
{if(!this._shadowKnob){this._shadowKnob=new WebInspector.GradientSliderKnob(this);this._shadowKnob.element.classList.add(WebInspector.GradientSlider.ShadowClassName);this.element.appendChild(this._shadowKnob.element);}
this._shadowKnob.x=window.webkitConvertPointFromPageToNode(this.element,new WebKitPoint(event.pageX,event.pageY)).x;var colorData=this._canvas.getContext("2d").getImageData(this._shadowKnob.x-1,0,1,1).data;this._shadowKnob.wellColor=new WebInspector.Color(WebInspector.Color.Format.RGB,[colorData[0],colorData[1],colorData[2],colorData[3]/255]);}
_sortStops()
{this._stops.sort(function(a,b){return a.offset-b.offset;});}
_updateStops()
{this._updateCanvas();this._updateKnobs();}
_updateCanvas()
{var w=WebInspector.GradientSlider.Width;var h=WebInspector.GradientSlider.Height;this._canvas.width=w;this._canvas.height=h;var ctx=this._canvas.getContext("2d");var gradient=ctx.createLinearGradient(0,0,w,0);for(var stop of this._stops)
gradient.addColorStop(stop.offset,stop.color);ctx.clearRect(0,0,w,h);ctx.fillStyle=gradient;ctx.fillRect(0,0,w,h);if(this.delegate&&typeof this.delegate.gradientSliderStopsDidChange==="function")
this.delegate.gradientSliderStopsDidChange(this);}
_updateKnobs()
{var selectedStop=this._selectedKnob?this._selectedKnob.stop:null;while(this._knobs.length>this._stops.length)
this._knobs.pop().element.remove();while(this._knobs.length<this._stops.length){var knob=new WebInspector.GradientSliderKnob(this);this.element.appendChild(knob.element);this._knobs.push(knob);}
for(var i=0;i<this._stops.length;++i){var stop=this._stops[i];var knob=this._knobs[i];knob.stop=stop;knob.x=Math.round(stop.offset*WebInspector.GradientSlider.Width);knob.selected=stop===selectedStop;}}};WebInspector.GradientSlider.Width=238;WebInspector.GradientSlider.Height=19;WebInspector.GradientSlider.AddAreaClassName="add-area";WebInspector.GradientSlider.DetachingClassName="detaching";WebInspector.GradientSlider.ShadowClassName="shadow";WebInspector.GradientSliderKnob=class GradientSliderKnob extends WebInspector.Object
{constructor(delegate)
{super();this._x=0;this._y=0;this._stop=null;this.delegate=delegate;this._element=document.createElement("div");this._element.className="gradient-slider-knob";this._element.appendChild(document.createElement("img"));this._well=this._element.appendChild(document.createElement("div"));this._element.addEventListener("mousedown",this);}
get element()
{return this._element;}
get stop()
{return this._stop;}
set stop(stop)
{this.wellColor=stop.color;this._stop=stop;}
get x()
{return this._x;}
set x(x){this._x=x;this._updateTransform();}
get y()
{return this._x;}
set y(y){this._y=y;this._updateTransform();}
get wellColor()
{return this._wellColor;}
set wellColor(color)
{this._wellColor=color;this._well.style.backgroundColor=color;}
get selected()
{return this._element.classList.contains(WebInspector.GradientSliderKnob.SelectedClassName);}
set selected(selected)
{if(this.selected===selected)
return;this._element.classList.toggle(WebInspector.GradientSliderKnob.SelectedClassName,selected);if(this.delegate&&typeof this.delegate.knobSelectionChanged==="function")
this.delegate.knobSelectionChanged(this);}
handleEvent(event)
{event.preventDefault();event.stopPropagation();switch(event.type){case"mousedown":this._handleMousedown(event);break;case"mousemove":this._handleMousemove(event);break;case"mouseup":this._handleMouseup(event);break;case"transitionend":this._handleTransitionEnd(event);break;}}
_handleMousedown(event)
{this._moved=false;this._detaching=false;window.addEventListener("mousemove",this,true);window.addEventListener("mouseup",this,true);this._startX=this.x;this._startMouseX=event.pageX;this._startMouseY=event.pageY;}
_handleMousemove(event)
{var w=WebInspector.GradientSlider.Width;this._moved=true;if(!this._detaching&&Math.abs(event.pageY-this._startMouseY)>50){this._detaching=this.delegate&&typeof this.delegate.knobCanDetach==="function"&&this.delegate.knobCanDetach(this);if(this._detaching&&this.delegate&&typeof this.delegate.knobWillDetach==="function"){var translationFromParentToBody=window.webkitConvertPointFromNodeToPage(this.element.parentNode,new WebKitPoint(0,0));this._startMouseX-=translationFromParentToBody.x;this._startMouseY-=translationFromParentToBody.y;document.body.appendChild(this.element);this.delegate.knobWillDetach(this);}}
var x=this._startX+event.pageX-this._startMouseX;if(!this._detaching)
x=Math.min(Math.max(0,x),w);this.x=x;if(this._detaching)
this.y=event.pageY-this._startMouseY;else if(this.delegate&&typeof this.delegate.knobXDidChange==="function")
this.delegate.knobXDidChange(this);}
_handleMouseup(event)
{window.removeEventListener("mousemove",this,true);window.removeEventListener("mouseup",this,true);if(this._detaching){this.element.addEventListener("transitionend",this);this.element.classList.add(WebInspector.GradientSliderKnob.FadeOutClassName);this.selected=false;}else if(!this._moved)
this.selected=!this.selected;}
_handleTransitionEnd(event)
{this.element.removeEventListener("transitionend",this);this.element.classList.remove(WebInspector.GradientSliderKnob.FadeOutClassName);this.element.remove();}
_updateTransform()
{this.element.style.webkitTransform="translate3d("+this._x+"px, "+this._y+"px, 0)";}};WebInspector.GradientSliderKnob.SelectedClassName="selected";WebInspector.GradientSliderKnob.FadeOutClassName="fade-out";WebInspector.HeapAllocationsTimelineDataGridNode=class HeapAllocationsTimelineDataGridNode extends WebInspector.TimelineDataGridNode
{constructor(heapAllocationsTimelineRecord,zeroTime,heapAllocationsView)
{super(false,null);this._record=heapAllocationsTimelineRecord;this._heapAllocationsView=heapAllocationsView;this._data={name:this.displayName(),timestamp:zeroTime?this._record.timestamp-zeroTime:NaN,size:this._record.heapSnapshot.totalSize,liveSize:this._record.heapSnapshot.liveSize,};this._record.heapSnapshot.addEventListener(WebInspector.HeapSnapshotProxy.Event.CollectedNodes,this._heapSnapshotCollectedNodes,this);this._record.heapSnapshot.addEventListener(WebInspector.HeapSnapshotProxy.Event.Invalidated,this._heapSnapshotInvalidated,this);}
get record(){return this._record;}
get data(){return this._data;}
createCellContent(columnIdentifier,cell)
{switch(columnIdentifier){case"name":cell.classList.add(...this.iconClassNames());var fragment=document.createDocumentFragment();var titleElement=fragment.appendChild(document.createElement("span"));titleElement.textContent=this._data.name;if(!this._record.heapSnapshot.invalid){var goToButton=fragment.appendChild(WebInspector.createGoToArrowButton());goToButton.addEventListener("click",(event)=>{this._heapAllocationsView.showHeapSnapshotTimelineRecord(this._record);});}
return fragment;case"timestamp":return isNaN(this._data.timestamp)?emDash:Number.secondsToString(this._data.timestamp,true);case"size":return Number.bytesToString(this._data.size);case"liveSize":return Number.bytesToString(this._data.liveSize);}
return super.createCellContent(columnIdentifier,cell);}
markAsBaseline()
{this.element.classList.add("baseline");}
clearBaseline()
{this.element.classList.remove("baseline");}
updateTimestamp(zeroTime)
{this._data.timestamp=this._record.timestamp-zeroTime;this.needsRefresh();}
createCells()
{super.createCells();if(this._record.heapSnapshot.invalid)
this.element.classList.add("invalid");}
_heapSnapshotCollectedNodes()
{let oldSize=this._data.liveSize;let newSize=this._record.heapSnapshot.liveSize;if(oldSize===newSize)
return;this._data.liveSize=newSize;this.needsRefresh();}
_heapSnapshotInvalidated()
{this._data.liveSize=0;this.needsRefresh();}};WebInspector.HeapAllocationsTimelineDataGridNodePathComponent=class HeapAllocationsTimelineDataGridNodePathComponent extends WebInspector.TimelineDataGridNodePathComponent
{ get previousSibling()
{let previousSibling=this.timelineDataGridNode.previousSibling;while(previousSibling&&(previousSibling.hidden||previousSibling.record.heapSnapshot.invalid))
previousSibling=previousSibling.previousSibling;if(!previousSibling)
return null;return new WebInspector.HeapAllocationsTimelineDataGridNodePathComponent(previousSibling);}
get nextSibling()
{let nextSibling=this.timelineDataGridNode.nextSibling;while(nextSibling&&(nextSibling.hidden||nextSibling.record.heapSnapshot.invalid))
nextSibling=nextSibling.nextSibling;if(!nextSibling)
return null;return new WebInspector.HeapAllocationsTimelineDataGridNodePathComponent(nextSibling);}};WebInspector.HeapAllocationsTimelineOverviewGraph=class HeapAllocationsTimelineOverviewGraph extends WebInspector.TimelineOverviewGraph
{constructor(timeline,timelineOverview)
{super(timelineOverview);this.element.classList.add("heap-allocations");this._heapAllocationsTimeline=timeline;this._heapAllocationsTimeline.addEventListener(WebInspector.Timeline.Event.RecordAdded,this._heapAllocationTimelineRecordAdded,this);this._selectedImageElement=null;this.reset();}
reset()
{super.reset();this.element.removeChildren();}
layout()
{if(!this.visible)
return;this.element.removeChildren();if(this._selectedImageElement){this._selectedImageElement.classList.remove("selected");this._selectedImageElement=null;}
let visibleRecords=this._heapAllocationsTimeline.recordsInTimeRange(this.startTime,this.endTime);if(!visibleRecords.length)
return;let graphStartTime=this.startTime;let secondsPerPixel=this.timelineOverview.secondsPerPixel;function xScale(time){return(time-graphStartTime)/secondsPerPixel;}
for(let record of visibleRecords){const halfImageWidth=8;let x=xScale(record.timestamp)-halfImageWidth;if(x<=1)
x=1;let imageElement=record[WebInspector.HeapAllocationsTimelineOverviewGraph.RecordElementAssociationSymbol];if(!imageElement){imageElement=record[WebInspector.HeapAllocationsTimelineOverviewGraph.RecordElementAssociationSymbol]=document.createElement("img");imageElement.classList.add("snapshot");imageElement.addEventListener("click",()=>{if(record.heapSnapshot.invalid)
return;this.selectedRecord=record;});}
imageElement.style.setProperty(WebInspector.resolvedLayoutDirection()===WebInspector.LayoutDirection.RTL?"right":"left",`${x}px`);if(record.heapSnapshot.invalid)
imageElement.classList.add("invalid");this.element.appendChild(imageElement);}
this._updateSnapshotMarkers();}
updateSelectedRecord()
{this._updateSnapshotMarkers();}
_updateSnapshotMarkers()
{if(this._selectedImageElement)
this._selectedImageElement.classList.remove("selected");if(!this.selectedRecord){this._selectedImageElement=null;return;}
let imageElement=this.selectedRecord[WebInspector.HeapAllocationsTimelineOverviewGraph.RecordElementAssociationSymbol];if(!imageElement)
return;imageElement.classList.add("selected");this._selectedImageElement=imageElement;}
_heapAllocationTimelineRecordAdded(event)
{this.needsLayout();}};WebInspector.HeapAllocationsTimelineOverviewGraph.RecordElementAssociationSymbol=Symbol("record-element-association");WebInspector.HeapAllocationsTimelineView=class HeapAllocationsTimelineView extends WebInspector.TimelineView
{constructor(timeline,extraArguments)
{super(timeline,extraArguments);this.element.classList.add("heap-allocations");let columns={name:{title:WebInspector.UIString("Name"),width:"150px",icon:true,},timestamp:{title:WebInspector.UIString("Time"),width:"80px",sortable:true,aligned:"right",},size:{title:WebInspector.UIString("Size"),width:"80px",sortable:true,aligned:"right",},liveSize:{title:WebInspector.UIString("Live Size"),width:"80px",sortable:true,aligned:"right",},};let snapshotTooltip=WebInspector.UIString("Take snapshot");this._takeHeapSnapshotButtonItem=new WebInspector.ButtonNavigationItem("take-snapshot",snapshotTooltip,"Images/Camera.svg",16,16);this._takeHeapSnapshotButtonItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,this._takeHeapSnapshotClicked,this);let defaultToolTip=WebInspector.UIString("Compare snapshots");let activatedToolTip=WebInspector.UIString("Cancel comparison");this._compareHeapSnapshotsButtonItem=new WebInspector.ActivateButtonNavigationItem("compare-heap-snapshots",defaultToolTip,activatedToolTip,"Images/Compare.svg",16,16);this._compareHeapSnapshotsButtonItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,this._compareHeapSnapshotsClicked,this);this._compareHeapSnapshotsButtonItem.enabled=false;this._compareHeapSnapshotsButtonItem.activated=false;this._compareHeapSnapshotHelpTextItem=new WebInspector.TextNavigationItem("compare-heap-snapshot-help-text","");this._selectingComparisonHeapSnapshots=false;this._baselineDataGridNode=null;this._baselineHeapSnapshotTimelineRecord=null;this._heapSnapshotDiff=null;this._snapshotListScrollTop=0;this._showingSnapshotList=true;this._snapshotListPathComponent=new WebInspector.HierarchicalPathComponent(WebInspector.UIString("Snapshot List"),"snapshot-list-icon","snapshot-list",false,false);this._snapshotListPathComponent.addEventListener(WebInspector.HierarchicalPathComponent.Event.Clicked,this._snapshotListPathComponentClicked,this);this._dataGrid=new WebInspector.TimelineDataGrid(columns);this._dataGrid.sortColumnIdentifier="timestamp";this._dataGrid.sortOrder=WebInspector.DataGrid.SortOrder.Ascending;this._dataGrid.createSettings("heap-allocations-timeline-view");this._dataGrid.addEventListener(WebInspector.DataGrid.Event.SelectedNodeChanged,this._dataGridNodeSelected,this);this.addSubview(this._dataGrid);this._contentViewContainer=new WebInspector.ContentViewContainer;this._contentViewContainer.addEventListener(WebInspector.ContentViewContainer.Event.CurrentContentViewDidChange,this._currentContentViewDidChange,this);WebInspector.ContentView.addEventListener(WebInspector.ContentView.Event.SelectionPathComponentsDidChange,this._contentViewSelectionPathComponentDidChange,this);this._pendingRecords=[];this._pendingZeroTimeDataGridNodes=[];timeline.addEventListener(WebInspector.Timeline.Event.RecordAdded,this._heapAllocationsTimelineRecordAdded,this);WebInspector.HeapSnapshotProxy.addEventListener(WebInspector.HeapSnapshotProxy.Event.Invalidated,this._heapSnapshotInvalidated,this);WebInspector.HeapSnapshotWorkerProxy.singleton().addEventListener("HeapSnapshot.CollectionEvent",this._heapSnapshotCollectionEvent,this);}
get scrollableElements()
{if(this._showingSnapshotList)
return[this._dataGrid.scrollContainer];if(this._contentViewContainer.currentContentView)
return this._contentViewContainer.currentContentView.scrollableElements;return[];}
showHeapSnapshotList()
{if(this._showingSnapshotList)
return;this._showingSnapshotList=true;this._heapSnapshotDiff=null;this._cancelSelectComparisonHeapSnapshots();this._contentViewContainer.hidden();this.removeSubview(this._contentViewContainer);this.addSubview(this._dataGrid);this._dataGrid.scrollContainer.scrollTop=this._snapshotListScrollTop;this.dispatchEventToListeners(WebInspector.ContentView.Event.SelectionPathComponentsDidChange);this.dispatchEventToListeners(WebInspector.ContentView.Event.NavigationItemsDidChange);}
showHeapSnapshotTimelineRecord(heapSnapshotTimelineRecord)
{if(this._showingSnapshotList){this._snapshotListScrollTop=this._dataGrid.scrollContainer.scrollTop;this.removeSubview(this._dataGrid);this.addSubview(this._contentViewContainer);this._contentViewContainer.shown();}
this._showingSnapshotList=false;this._heapSnapshotDiff=null;this._cancelSelectComparisonHeapSnapshots();for(let dataGridNode of this._dataGrid.children){if(dataGridNode.record===heapSnapshotTimelineRecord){dataGridNode.select();break;}}
let shouldTriggerContentViewUpdate=this._contentViewContainer.currentContentView&&this._contentViewContainer.currentContentView.representedObject===heapSnapshotTimelineRecord.heapSnapshot;this._contentViewContainer.showContentViewForRepresentedObject(heapSnapshotTimelineRecord.heapSnapshot);if(shouldTriggerContentViewUpdate)
this._currentContentViewDidChange();}
showHeapSnapshotDiff(heapSnapshotDiff)
{if(this._showingSnapshotList){this.removeSubview(this._dataGrid);this.addSubview(this._contentViewContainer);this._contentViewContainer.shown();}
this._showingSnapshotList=false;this._heapSnapshotDiff=heapSnapshotDiff;this._contentViewContainer.showContentViewForRepresentedObject(heapSnapshotDiff);}
get showsFilterBar(){return this._showingSnapshotList;}
get navigationItems()
{if(this._showingSnapshotList){let items=[this._takeHeapSnapshotButtonItem,this._compareHeapSnapshotsButtonItem];if(this._selectingComparisonHeapSnapshots)
items.push(this._compareHeapSnapshotHelpTextItem);return items;}
return this._contentViewContainer.currentContentView.navigationItems;}
get selectionPathComponents()
{let components=[this._snapshotListPathComponent];if(this._showingSnapshotList)
return components;if(this._heapSnapshotDiff){let firstSnapshotIdentifier=this._heapSnapshotDiff.snapshot1.identifier;let secondSnapshotIdentifier=this._heapSnapshotDiff.snapshot2.identifier;let diffComponent=new WebInspector.HierarchicalPathComponent(WebInspector.UIString("Snapshot Comparison (%d and %d)").format(firstSnapshotIdentifier,secondSnapshotIdentifier),"snapshot-diff-icon","snapshot-diff");components.push(diffComponent);}else if(this._dataGrid.selectedNode){let heapSnapshotPathComponent=new WebInspector.HeapAllocationsTimelineDataGridNodePathComponent(this._dataGrid.selectedNode);heapSnapshotPathComponent.addEventListener(WebInspector.HierarchicalPathComponent.Event.SiblingWasSelected,this._snapshotPathComponentSelected,this);components.push(heapSnapshotPathComponent);}
return components.concat(this._contentViewContainer.currentContentView.selectionPathComponents);}
selectRecord(record)
{if(record)
this.showHeapSnapshotTimelineRecord(record);else
this.showHeapSnapshotList();}
shown()
{super.shown();this._dataGrid.shown();if(!this._showingSnapshotList)
this._contentViewContainer.shown();}
hidden()
{super.hidden();this._dataGrid.hidden();if(!this._showingSnapshotList)
this._contentViewContainer.hidden();}
closed()
{this.representedObject.removeEventListener(null,null,this);this._dataGrid.closed();this._contentViewContainer.closeAllContentViews();WebInspector.ContentView.removeEventListener(null,null,this);WebInspector.HeapSnapshotProxy.removeEventListener(null,null,this);WebInspector.HeapSnapshotWorkerProxy.singleton().removeEventListener("HeapSnapshot.CollectionEvent",this._heapSnapshotCollectionEvent,this);}
layout()
{if(this._pendingZeroTimeDataGridNodes.length&&this.zeroTime){for(let dataGridNode of this._pendingZeroTimeDataGridNodes)
dataGridNode.updateTimestamp(this.zeroTime);this._pendingZeroTimeDataGridNodes=[];this._dataGrid._sort();}
if(this._pendingRecords.length){for(let heapAllocationsTimelineRecord of this._pendingRecords){let dataGridNode=new WebInspector.HeapAllocationsTimelineDataGridNode(heapAllocationsTimelineRecord,this.zeroTime,this);this._dataGrid.addRowInSortOrder(null,dataGridNode);if(!this.zeroTime)
this._pendingZeroTimeDataGridNodes.push(dataGridNode);}
this._pendingRecords=[];this._updateCompareHeapSnapshotButton();}}
reset()
{super.reset();this._dataGrid.reset();this.showHeapSnapshotList();this._pendingRecords=[];this._pendingZeroTimeDataGridNodes=[];this._updateCompareHeapSnapshotButton();}
updateFilter(filters)
{this._dataGrid.filterText=filters?filters.text:"";}
_heapAllocationsTimelineRecordAdded(event)
{this._pendingRecords.push(event.data.record);this.needsLayout();}
_heapSnapshotCollectionEvent(event)
{function updateHeapSnapshotForEvent(heapSnapshot){if(heapSnapshot.invalid)
return;heapSnapshot.updateForCollectionEvent(event);}
for(let node of this._dataGrid.children)
updateHeapSnapshotForEvent(node.record.heapSnapshot);for(let record of this._pendingRecords)
updateHeapSnapshotForEvent(record.heapSnapshot);if(this._heapSnapshotDiff)
updateHeapSnapshotForEvent(this._heapSnapshotDiff);}
_snapshotListPathComponentClicked(event)
{this.showHeapSnapshotList();}
_snapshotPathComponentSelected(event)
{this.showHeapSnapshotTimelineRecord(event.data.pathComponent.representedObject);}
_currentContentViewDidChange(event)
{this.dispatchEventToListeners(WebInspector.ContentView.Event.SelectionPathComponentsDidChange);this.dispatchEventToListeners(WebInspector.ContentView.Event.NavigationItemsDidChange);}
_contentViewSelectionPathComponentDidChange(event)
{if(event.target!==this._contentViewContainer.currentContentView)
return;this.dispatchEventToListeners(WebInspector.ContentView.Event.SelectionPathComponentsDidChange);}
_heapSnapshotInvalidated(event)
{let heapSnapshot=event.target;if(this._baselineHeapSnapshotTimelineRecord){if(heapSnapshot===this._baselineHeapSnapshotTimelineRecord.heapSnapshot)
this._cancelSelectComparisonHeapSnapshots();}
if(this._heapSnapshotDiff){if(heapSnapshot===this._heapSnapshotDiff.snapshot1||heapSnapshot===this._heapSnapshotDiff.snapshot2)
this.showHeapSnapshotList();}else if(this._dataGrid.selectedNode){if(heapSnapshot===this._dataGrid.selectedNode.record.heapSnapshot)
this.showHeapSnapshotList();}
this._updateCompareHeapSnapshotButton();}
_updateCompareHeapSnapshotButton()
{let hasAtLeastTwoValidSnapshots=false;let count=0;for(let node of this._dataGrid.children){if(node.revealed&&!node.hidden&&!node.record.heapSnapshot.invalid){count++;if(count===2){hasAtLeastTwoValidSnapshots=true;break;}}}
this._compareHeapSnapshotsButtonItem.enabled=hasAtLeastTwoValidSnapshots;}
_takeHeapSnapshotClicked()
{HeapAgent.snapshot(function(error,timestamp,snapshotStringData){let workerProxy=WebInspector.HeapSnapshotWorkerProxy.singleton();workerProxy.createSnapshot(snapshotStringData,({objectId,snapshot:serializedSnapshot})=>{let snapshot=WebInspector.HeapSnapshotProxy.deserialize(objectId,serializedSnapshot);WebInspector.timelineManager.heapSnapshotAdded(timestamp,snapshot);});});}
_cancelSelectComparisonHeapSnapshots()
{if(!this._selectingComparisonHeapSnapshots)
return;if(this._baselineDataGridNode)
this._baselineDataGridNode.clearBaseline();this._selectingComparisonHeapSnapshots=false;this._baselineDataGridNode=null;this._baselineHeapSnapshotTimelineRecord=null;this._compareHeapSnapshotsButtonItem.activated=false;this.dispatchEventToListeners(WebInspector.ContentView.Event.NavigationItemsDidChange);}
_compareHeapSnapshotsClicked(event)
{let newActivated=!this._compareHeapSnapshotsButtonItem.activated;this._compareHeapSnapshotsButtonItem.activated=newActivated;if(!newActivated){this._cancelSelectComparisonHeapSnapshots();return;}
if(this._dataGrid.selectedNode)
this._dataGrid.selectedNode.deselect();this._selectingComparisonHeapSnapshots=true;this._baselineHeapSnapshotTimelineRecord=null;this._compareHeapSnapshotHelpTextItem.text=WebInspector.UIString("Select baseline snapshot");this.dispatchEventToListeners(WebInspector.ContentView.Event.NavigationItemsDidChange);}
_dataGridNodeSelected(event)
{if(!this._selectingComparisonHeapSnapshots)
return;let dataGridNode=this._dataGrid.selectedNode;if(!dataGridNode)
return;let heapAllocationsTimelineRecord=dataGridNode.record;if(heapAllocationsTimelineRecord.heapSnapshot.invalid||this._baselineHeapSnapshotTimelineRecord===heapAllocationsTimelineRecord){this._dataGrid.selectedNode.deselect();return;}
if(!this._baselineHeapSnapshotTimelineRecord){this._baselineDataGridNode=dataGridNode;this._baselineDataGridNode.markAsBaseline();this._baselineHeapSnapshotTimelineRecord=heapAllocationsTimelineRecord;this._dataGrid.selectedNode.deselect();this._compareHeapSnapshotHelpTextItem.text=WebInspector.UIString("Select comparison snapshot");this.dispatchEventToListeners(WebInspector.ContentView.Event.NavigationItemsDidChange);return;}
let snapshot1=this._baselineHeapSnapshotTimelineRecord.heapSnapshot;let snapshot2=heapAllocationsTimelineRecord.heapSnapshot;if(snapshot1.identifier>snapshot2.identifier)
[snapshot1,snapshot2]=[snapshot2,snapshot1];let workerProxy=WebInspector.HeapSnapshotWorkerProxy.singleton();workerProxy.createSnapshotDiff(snapshot1.proxyObjectId,snapshot2.proxyObjectId,({objectId,snapshotDiff:serializedSnapshotDiff})=>{let diff=WebInspector.HeapSnapshotDiffProxy.deserialize(objectId,serializedSnapshotDiff);this.showHeapSnapshotDiff(diff);});this._baselineDataGridNode.clearBaseline();this._baselineDataGridNode=null;this._selectingComparisonHeapSnapshots=false;this._compareHeapSnapshotsButtonItem.activated=false;}};WebInspector.HeapSnapshotClassDataGridNode=class HeapSnapshotClassDataGridNode extends WebInspector.DataGridNode
{constructor(data,tree)
{super(data,true);this._data=data;this._tree=tree;this._batched=false;this._instances=null;this.addEventListener("populate",this._populate,this);}
get data(){return this._data;}
createCellContent(columnIdentifier)
{if(columnIdentifier==="retainedSize"){let size=this._data.retainedSize;let fragment=document.createDocumentFragment();let sizeElement=fragment.appendChild(document.createElement("span"));sizeElement.classList.add("size");sizeElement.textContent=Number.bytesToString(size);let percentElement=fragment.appendChild(document.createElement("span"));percentElement.classList.add("percentage");percentElement.textContent=emDash;return fragment;}
if(columnIdentifier==="size")
return Number.bytesToString(this._data.size);if(columnIdentifier==="className"){let{className}=this._data;let fragment=document.createDocumentFragment();let iconElement=fragment.appendChild(document.createElement("img"));iconElement.classList.add("icon",WebInspector.HeapSnapshotClusterContentView.iconStyleClassNameForClassName(className));let nameElement=fragment.appendChild(document.createElement("span"));nameElement.classList.add("class-name");nameElement.textContent=className;return fragment;}
return super.createCellContent(columnIdentifier);}
sort()
{if(this._batched){this._removeFetchMoreDataGridNode();this._sortInstances();this._updateBatchedChildren();this._appendFetchMoreDataGridNode();return;}
let children=this.children;children.sort(this._tree._sortComparator);for(let i=0;i<children.length;++i){children[i]._recalculateSiblings(i);children[i].sort();}}
removeCollectedNodes(collectedNodes)
{let nodesToRemove=[];this.forEachImmediateChild((dataGridNode)=>{if(dataGridNode instanceof WebInspector.HeapSnapshotInstanceDataGridNode){let heapSnapshotNode=dataGridNode.node;if(heapSnapshotNode.id in collectedNodes)
nodesToRemove.push(dataGridNode);}});if(nodesToRemove.length){for(let dataGridNode of nodesToRemove)
this.removeChild(dataGridNode);}
if(this._instances){this._instances=this._instances.filter((instance)=>!(instance.id in collectedNodes));this._fetchBatch(nodesToRemove.length);}}
updateCount(count)
{if(count===this._data.count)
return;if(!count){this._tree.removeChild(this);return;}
this._data.count=count;this.needsRefresh();}
_populate()
{this.removeEventListener("populate",this._populate,this);this._tree.heapSnapshot.instancesWithClassName(this._data.className,(instances)=>{ this._instances=instances.filter((instance)=>!instance.dead);this._sortInstances();if(instances.length>WebInspector.HeapSnapshotClassDataGridNode.ChildrenBatchLimit){this._batched=true;this._fetchBatch(WebInspector.HeapSnapshotClassDataGridNode.ChildrenBatchLimit);return;}
for(let instance of this._instances)
this.appendChild(new WebInspector.HeapSnapshotInstanceDataGridNode(instance,this._tree));});}
_fetchBatch(batchSize)
{if(this._batched&&this.children.length)
this._removeFetchMoreDataGridNode();let oldCount=this.children.length;let newCount=oldCount+batchSize;if(newCount>=this._instances.length){newCount=this._instances.length-1;this._batched=false;}
let count=newCount-oldCount;if(count){for(let i=0;i<=count;++i){let instance=this._instances[oldCount+i];this.appendChild(new WebInspector.HeapSnapshotInstanceDataGridNode(instance,this._tree));}}
if(this._batched)
this._appendFetchMoreDataGridNode();}
_sortInstances()
{this._instances.sort((a,b)=>{let fakeDataGridNodeA={data:a};let fakeDataGridNodeB={data:b};return this._tree._sortComparator(fakeDataGridNodeA,fakeDataGridNodeB);});}
_updateBatchedChildren()
{let count=this.children.length;this.removeChildren();for(let i=0;i<count;++i)
this.appendChild(new WebInspector.HeapSnapshotInstanceDataGridNode(this._instances[i],this._tree));}
_removeFetchMoreDataGridNode()
{this.removeChild(this.children[this.children.length-1]);}
_appendFetchMoreDataGridNode()
{let count=this.children.length;let totalCount=this._instances.length;let remainingCount=totalCount-count;let batchSize=remainingCount>=WebInspector.HeapSnapshotClassDataGridNode.ChildrenBatchLimit?WebInspector.HeapSnapshotClassDataGridNode.ChildrenBatchLimit:0;this.appendChild(new WebInspector.HeapSnapshotInstanceFetchMoreDataGridNode(this._tree,batchSize,remainingCount,this._fetchBatch.bind(this)));}};WebInspector.HeapSnapshotClassDataGridNode.ChildrenBatchLimit=100;WebInspector.HeapSnapshotClusterContentView=class HeapSnapshotClusterContentView extends WebInspector.ClusterContentView
{constructor(heapSnapshot)
{super(heapSnapshot);this._heapSnapshot=heapSnapshot;function createPathComponent(displayName,className,identifier)
{let pathComponent=new WebInspector.HierarchicalPathComponent(displayName,className,identifier,false,true);pathComponent.addEventListener(WebInspector.HierarchicalPathComponent.Event.SiblingWasSelected,this._pathComponentSelected,this);pathComponent.comparisonData=heapSnapshot;return pathComponent;}
this._shownInitialContent=false;this._instancesContentView=null;this._objectGraphContentView=null;this._instancesPathComponent=createPathComponent.call(this,WebInspector.UIString("Instances"),"heap-snapshot-instances-icon",WebInspector.HeapSnapshotClusterContentView.InstancesIdentifier);this._objectGraphPathComponent=createPathComponent.call(this,WebInspector.UIString("Object Graph"),"heap-snapshot-object-graph-icon",WebInspector.HeapSnapshotClusterContentView.ObjectGraphIdentifier);if(this._supportsObjectGraph()){this._instancesPathComponent.nextSibling=this._objectGraphPathComponent;this._objectGraphPathComponent.previousSibling=this._instancesPathComponent;}
this._currentContentViewSetting=new WebInspector.Setting("heap-snapshot-cluster-current-view",WebInspector.HeapSnapshotClusterContentView.InstancesIdentifier);}
static iconStyleClassNameForClassName(className,internal)
{if(internal)
return"native";switch(className){case"Object":case"Array":case"Map":case"Set":case"WeakMap":case"WeakSet":case"Promise":case"Error":case"Window":case"Map Iterator":case"Set Iterator":case"Math":case"JSON":case"GlobalObject":return"object";case"Function":return"function";case"RegExp":return"regex";case"Number":return"number";case"Boolean":return"boolean";case"String":case"string":return"string";case"Symbol":case"symbol":return"symbol";}
if(className.endsWith("Prototype"))
return"object";if(className.endsWith("Element")||className==="Node"||className==="Text")
return"node";return"native";}
get heapSnapshot(){return this._heapSnapshot;}
get instancesContentView()
{if(!this._instancesContentView)
this._instancesContentView=new WebInspector.HeapSnapshotInstancesContentView(this._heapSnapshot);return this._instancesContentView;}
get objectGraphContentView()
{if(!this._supportsObjectGraph())
return null;if(!this._objectGraphContentView)
this._objectGraphContentView=new WebInspector.HeapSnapshotObjectGraphContentView(this._heapSnapshot);return this._objectGraphContentView;}
get selectionPathComponents()
{let currentContentView=this._contentViewContainer.currentContentView;if(!currentContentView)
return[];let components=[this._pathComponentForContentView(currentContentView)];return components.concat(currentContentView.selectionPathComponents);}
shown()
{super.shown();if(this._shownInitialContent)
return;this._showContentViewForIdentifier(this._currentContentViewSetting.value);}
closed()
{super.closed();this._shownInitialContent=false;}
saveToCookie(cookie)
{cookie[WebInspector.HeapSnapshotClusterContentView.ContentViewIdentifierCookieKey]=this._currentContentViewSetting.value;}
restoreFromCookie(cookie)
{this._showContentViewForIdentifier(cookie[WebInspector.HeapSnapshotClusterContentView.ContentViewIdentifierCookieKey]);}
showInstances()
{this._shownInitialContent=true;return this._showContentViewForIdentifier(WebInspector.HeapSnapshotClusterContentView.InstancesIdentifier);}
showObjectGraph()
{this._shownInitialContent=true;return this._showContentViewForIdentifier(WebInspector.HeapSnapshotClusterContentView.ObjectGraphIdentifier);}
_supportsObjectGraph()
{return this._heapSnapshot instanceof WebInspector.HeapSnapshotProxy;}
_pathComponentForContentView(contentView)
{if(!contentView)
return null;if(contentView===this._instancesContentView)
return this._instancesPathComponent;if(contentView===this._objectGraphContentView)
return this._objectGraphPathComponent;console.error("Unknown contentView.");return null;}
_identifierForContentView(contentView)
{if(!contentView)
return null;if(contentView===this._instancesContentView)
return WebInspector.HeapSnapshotClusterContentView.InstancesIdentifier;if(contentView===this._objectGraphContentView)
return WebInspector.HeapSnapshotClusterContentView.ObjectGraphIdentifier;console.error("Unknown contentView.");return null;}
_showContentViewForIdentifier(identifier)
{let contentViewToShow=null;switch(identifier){case WebInspector.HeapSnapshotClusterContentView.InstancesIdentifier:contentViewToShow=this.instancesContentView;break;case WebInspector.HeapSnapshotClusterContentView.ObjectGraphIdentifier:contentViewToShow=this.objectGraphContentView;break;}
if(!contentViewToShow)
contentViewToShow=this.instancesContentView;this._shownInitialContent=true;this._currentContentViewSetting.value=this._identifierForContentView(contentViewToShow);return this.contentViewContainer.showContentView(contentViewToShow);}
_pathComponentSelected(event)
{this._showContentViewForIdentifier(event.data.pathComponent.representedObject);}};WebInspector.HeapSnapshotClusterContentView.ContentViewIdentifierCookieKey="heap-snapshot-cluster-content-view-identifier";WebInspector.HeapSnapshotClusterContentView.InstancesIdentifier="instances";WebInspector.HeapSnapshotClusterContentView.ObjectGraphIdentifier="object-graph";WebInspector.HeapSnapshotContentView=class HeapSnapshotContentView extends WebInspector.ContentView
{constructor(representedObject,identifier,columns,heapSnapshotDataGridTreeConstructor)
{super(representedObject);this.element.classList.add("heap-snapshot");this._dataGrid=new WebInspector.DataGrid(columns);this._dataGrid.sortColumnIdentifier="retainedSize";this._dataGrid.sortOrder=WebInspector.DataGrid.SortOrder.Descending;this._dataGrid.createSettings(identifier);this._dataGrid.addEventListener(WebInspector.DataGrid.Event.SortChanged,this._sortDataGrid,this);let sortComparator=WebInspector.HeapSnapshotDataGridTree.buildSortComparator(this._dataGrid.sortColumnIdentifier,this._dataGrid.sortOrder);this._heapSnapshotDataGridTree=new heapSnapshotDataGridTreeConstructor(this.representedObject,sortComparator);this._heapSnapshotDataGridTree.addEventListener(WebInspector.HeapSnapshotDataGridTree.Event.DidPopulate,this._heapSnapshotDataGridTreeDidPopulate,this);for(let child of this._heapSnapshotDataGridTree.children)
this._dataGrid.appendChild(child);this.addSubview(this._dataGrid);this._dataGrid.updateLayout();}
shown()
{super.shown();this._heapSnapshotDataGridTree.shown();}
hidden()
{super.hidden();this._heapSnapshotDataGridTree.hidden();}
get scrollableElements()
{return[this._dataGrid.scrollContainer];}
_sortDataGrid()
{if(!this._heapSnapshotDataGridTree)
return;this._heapSnapshotDataGridTree.sortComparator=WebInspector.HeapSnapshotDataGridTree.buildSortComparator(this._dataGrid.sortColumnIdentifier,this._dataGrid.sortOrder);this._dataGrid.removeChildren();for(let child of this._heapSnapshotDataGridTree.children)
this._dataGrid.appendChild(child);}
_heapSnapshotDataGridTreeDidPopulate()
{this._dataGrid.removeChildren();for(let child of this._heapSnapshotDataGridTree.children)
this._dataGrid.appendChild(child);}};WebInspector.HeapSnapshotInstancesContentView=class HeapSnapshotInstancesContentView extends WebInspector.HeapSnapshotContentView
{constructor(representedObject)
{let columns={retainedSize:{title:WebInspector.UIString("Retained Size"),tooltip:WebInspector.UIString("Size of current object plus all objects it keeps alive"),width:"140px",aligned:"right",sortable:true,},size:{title:WebInspector.UIString("Self Size"),width:"90px",aligned:"right",sortable:true,},count:{title:WebInspector.UIString("Count"),width:"75px",aligned:"right",sortable:true,},className:{title:WebInspector.UIString("Name"),sortable:true,disclosure:true,}};super(representedObject,"heap-snapshot-instances-content-view",columns,WebInspector.HeapSnapshotInstancesDataGridTree);}};WebInspector.HeapSnapshotObjectGraphContentView=class HeapSnapshotObjectGraphContentView extends WebInspector.HeapSnapshotContentView
{constructor(representedObject)
{let columns={retainedSize:{title:WebInspector.UIString("Retained Size"),tooltip:WebInspector.UIString("Size of current object plus all objects it keeps alive"),width:"140px",aligned:"right",sortable:true,},size:{title:WebInspector.UIString("Self Size"),width:"90px",aligned:"right",sortable:true,},className:{title:WebInspector.UIString("Name"),sortable:true,disclosure:true,}};super(representedObject,"heap-snapshot-object-graph-content-view",columns,WebInspector.HeapSnapshotObjectGraphDataGridTree);}};WebInspector.HeapSnapshotDataGridTree=class HeapSnapshotDataGridTree extends WebInspector.Object
{constructor(heapSnapshot,sortComparator)
{super();this._heapSnapshot=heapSnapshot;this._heapSnapshot.addEventListener(WebInspector.HeapSnapshotProxy.Event.CollectedNodes,this._heapSnapshotCollectedNodes,this);this._children=[];this._sortComparator=sortComparator;this._visible=false;this._popover=null;this._popoverGridNode=null;this._popoverTargetElement=null;this.populateTopLevel();}
static buildSortComparator(columnIdentifier,sortOrder)
{let multiplier=sortOrder===WebInspector.DataGrid.SortOrder.Ascending?1:-1;let numberCompare=(columnIdentifier,a,b)=>multiplier*(a.data[columnIdentifier]-b.data[columnIdentifier]);let nameCompare=(a,b)=>{if(a.propertyName||b.propertyName){if(a.propertyName&&!b.propertyName)
return multiplier*-1;if(!a.propertyName&&b.propertyName)
return multiplier*1;let propertyNameCompare=a.propertyName.extendedLocaleCompare(b.propertyName);return multiplier*propertyNameCompare;}
let classNameCompare=a.data.className.extendedLocaleCompare(b.data.className);if(classNameCompare)
return multiplier*classNameCompare;if(a.data.id||b.data.id)
return multiplier*(a.data.id-b.data.id);return 0;};switch(columnIdentifier){case"retainedSize":return numberCompare.bind(this,"retainedSize");case"size":return numberCompare.bind(this,"size");case"count":return numberCompare.bind(this,"count");case"className":return nameCompare;}}
get heapSnapshot(){return this._heapSnapshot;}
get visible(){return this._visible;}
get popoverGridNode(){return this._popoverGridNode;}
set popoverGridNode(x){this._popoverGridNode=x;}
get popoverTargetElement(){return this._popoverTargetElement;}
set popoverTargetElement(x){this._popoverTargetElement=x;}
get popover()
{if(!this._popover){this._popover=new WebInspector.Popover(this);this._popover.windowResizeHandler=()=>{let bounds=WebInspector.Rect.rectFromClientRect(this._popoverTargetElement.getBoundingClientRect());this._popover.present(bounds.pad(2),[WebInspector.RectEdge.MAX_Y,WebInspector.RectEdge.MIN_Y,WebInspector.RectEdge.MAX_X]);};}
return this._popover;}
get children()
{return this._children;}
appendChild(node)
{this._children.push(node);}
insertChild(node,index)
{this._children.splice(index,0,node);}
removeChild(node)
{this._children.remove(node,true);}
removeChildren()
{this._children=[];}
set sortComparator(comparator)
{this._sortComparator=comparator;this.sort();}
sort()
{let children=this._children;children.sort(this._sortComparator);for(let i=0;i<children.length;++i){children[i]._recalculateSiblings(i);children[i].sort();}}
shown()
{this._visible=true;}
hidden()
{this._visible=false;if(this._popover&&this._popover.visible)
this._popover.dismiss();}
willDismissPopover(popover)
{this._popoverGridNode=null;this._popoverTargetElement=null;}
get alwaysShowRetainedSize()
{return false;}
populateTopLevel()
{}
removeCollectedNodes(collectedNodes)
{}
didPopulate()
{this.sort();this.dispatchEventToListeners(WebInspector.HeapSnapshotDataGridTree.Event.DidPopulate);}
_heapSnapshotCollectedNodes(event)
{this.removeCollectedNodes(event.data.collectedNodes);}};WebInspector.HeapSnapshotDataGridTree.Event={DidPopulate:"heap-snapshot-data-grid-tree-did-populate",};WebInspector.HeapSnapshotInstancesDataGridTree=class HeapSnapshotInstancesDataGridTree extends WebInspector.HeapSnapshotDataGridTree
{get alwaysShowRetainedSize()
{return false;}
populateTopLevel()
{for(let[className,{size,retainedSize,count,internalCount,deadCount}]of this.heapSnapshot.categories){if(count===internalCount)
continue; let liveCount=count-deadCount;if(!liveCount)
continue;this.appendChild(new WebInspector.HeapSnapshotClassDataGridNode({className,size,retainedSize,count:liveCount},this));}
this.didPopulate();}
removeCollectedNodes(collectedNodes)
{for(let classDataGridNode of this.children){let{count,deadCount}=this.heapSnapshot.categories.get(classDataGridNode.data.className);let liveCount=count-deadCount;classDataGridNode.updateCount(liveCount);if(liveCount)
classDataGridNode.removeCollectedNodes(collectedNodes);}
this.didPopulate();}};WebInspector.HeapSnapshotObjectGraphDataGridTree=class HeapSnapshotInstancesDataGridTree extends WebInspector.HeapSnapshotDataGridTree
{get alwaysShowRetainedSize()
{return true;}
populateTopLevel()
{this.heapSnapshot.instancesWithClassName("GlobalObject",(instances)=>{for(let instance of instances)
this.appendChild(new WebInspector.HeapSnapshotInstanceDataGridNode(instance,this));});this.heapSnapshot.instancesWithClassName("Window",(instances)=>{for(let instance of instances){
if(instance.dominatorNodeIdentifier===0)
this.appendChild(new WebInspector.HeapSnapshotInstanceDataGridNode(instance,this));}
this.didPopulate();});}};WebInspector.HeapSnapshotInstanceDataGridNode=class HeapSnapshotInstanceDataGridNode extends WebInspector.DataGridNode
{constructor(node,tree,edge,base)
{let hasChildren=node.hasChildren&&node.className!=="string";super(node,hasChildren);this._node=node;this._tree=tree;this._edge=edge||null;this._base=base||null;this.copyable=false;if(hasChildren)
this.addEventListener("populate",this._populate,this);}
static logHeapSnapshotNode(node)
{let heapObjectIdentifier=node.id;let shouldRevealConsole=true;let text=WebInspector.UIString("Heap Snapshot Object (%s)").format("@"+heapObjectIdentifier);node.shortestGCRootPath((gcRootPath)=>{if(gcRootPath.length){gcRootPath=gcRootPath.slice().reverse();let windowIndex=gcRootPath.findIndex((x)=>{return x instanceof WebInspector.HeapSnapshotNodeProxy&&x.className==="Window";});let heapSnapshotRootPath=WebInspector.HeapSnapshotRootPath.emptyPath();for(let i=windowIndex===-1?0:windowIndex;i<gcRootPath.length;++i){let component=gcRootPath[i];if(component instanceof WebInspector.HeapSnapshotNodeProxy){if(component.className==="Window")
heapSnapshotRootPath=heapSnapshotRootPath.appendGlobalScopeName(component,"window");}else if(component instanceof WebInspector.HeapSnapshotEdgeProxy)
heapSnapshotRootPath=heapSnapshotRootPath.appendEdge(component);}
if(!heapSnapshotRootPath.isFullPathImpossible())
text=heapSnapshotRootPath.fullPath;}
if(node.className==="string"){HeapAgent.getPreview(heapObjectIdentifier,function(error,string,functionDetails,objectPreviewPayload){let remoteObject=error?WebInspector.RemoteObject.fromPrimitiveValue(undefined):WebInspector.RemoteObject.fromPrimitiveValue(string);WebInspector.consoleLogViewController.appendImmediateExecutionWithResult(text,remoteObject,shouldRevealConsole);});}else{HeapAgent.getRemoteObject(heapObjectIdentifier,WebInspector.RuntimeManager.ConsoleObjectGroup,function(error,remoteObjectPayload){let remoteObject=error?WebInspector.RemoteObject.fromPrimitiveValue(undefined):WebInspector.RemoteObject.fromPayload(remoteObjectPayload,WebInspector.assumingMainTarget());WebInspector.consoleLogViewController.appendImmediateExecutionWithResult(text,remoteObject,shouldRevealConsole);});}});}
get data(){return this._node;}
get node(){return this._node;}
get propertyName()
{if(!this._edge)
return"";if(!this._propertyName)
this._propertyName=WebInspector.HeapSnapshotRootPath.pathComponentForIndividualEdge(this._edge);return this._propertyName;}
createCells()
{super.createCells();this.element.classList.add("instance");}
createCellContent(columnIdentifier)
{if(columnIdentifier==="retainedSize"){let subRetainedSize=false;if(this._base&&!this._tree.alwaysShowRetainedSize){if(this._isDominatedByNonBaseParent())
subRetainedSize=true;else if(!this._isDominatedByBase())
return emDash;}
let size=this._node.retainedSize;let fragment=document.createDocumentFragment();let sizeElement=fragment.appendChild(document.createElement("span"));sizeElement.classList.add("size");sizeElement.textContent=Number.bytesToString(size);let fraction=size/this._tree._heapSnapshot.totalSize;let percentElement=fragment.appendChild(document.createElement("span"));percentElement.classList.add("percentage");percentElement.textContent=Number.percentageString(fraction);if(subRetainedSize){sizeElement.classList.add("sub-retained");percentElement.classList.add("sub-retained");}
return fragment;}
if(columnIdentifier==="size")
return Number.bytesToString(this._node.size);if(columnIdentifier==="className"){let{className,id,internal}=this._node;let containerElement=document.createElement("span");containerElement.addEventListener("contextmenu",this._contextMenuHandler.bind(this));let iconElement=containerElement.appendChild(document.createElement("img"));iconElement.classList.add("icon",WebInspector.HeapSnapshotClusterContentView.iconStyleClassNameForClassName(className,internal));if(this._edge){let nameElement=containerElement.appendChild(document.createElement("span"));let propertyName=this.propertyName;if(propertyName)
nameElement.textContent=propertyName+": "+this._node.className+" ";else
nameElement.textContent=this._node.className+" ";}
let idElement=containerElement.appendChild(document.createElement("span"));idElement.classList.add("object-id");idElement.textContent="@"+id;idElement.addEventListener("click",WebInspector.HeapSnapshotInstanceDataGridNode.logHeapSnapshotNode.bind(null,this._node));idElement.addEventListener("mouseover",this._mouseoverHandler.bind(this));let spacerElement=containerElement.appendChild(document.createElement("span"));spacerElement.textContent=" ";if(className==="Window"&&this._node.dominatorNodeIdentifier===0){containerElement.append("Window ");this._populateWindowPreview(containerElement);}else
this._populatePreview(containerElement);return containerElement;}
return super.createCellContent(columnIdentifier);}
sort()
{let children=this.children;children.sort(this._tree._sortComparator);for(let i=0;i<children.length;++i){children[i]._recalculateSiblings(i);children[i].sort();}}
_isDominatedByBase()
{return this._node.dominatorNodeIdentifier===this._base.node.id;}
_isDominatedByNonBaseParent()
{for(let p=this.parent;p;p=p.parent){if(p===this._base)
return false;if(this._node.dominatorNodeIdentifier===p.node.id)
return true;}
return false;}
_populate()
{this.removeEventListener("populate",this._populate,this);function propertyName(edge){return edge?WebInspector.HeapSnapshotRootPath.pathComponentForIndividualEdge(edge):"";}
this._node.retainedNodes((instances,edges)=>{for(let i=0;i<instances.length;++i)
instances[i].__edge=edges[i];instances.sort((a,b)=>{let fakeDataGridNodeA={data:a,propertyName:propertyName(a.__edge)};let fakeDataGridNodeB={data:b,propertyName:propertyName(b.__edge)};return this._tree._sortComparator(fakeDataGridNodeA,fakeDataGridNodeB);});for(let instance of instances){if(instance.__edge&&instance.__edge.isPrivateSymbol())
continue;this.appendChild(new WebInspector.HeapSnapshotInstanceDataGridNode(instance,this._tree,instance.__edge,this._base||this));}});}
_contextMenuHandler(event)
{let contextMenu=WebInspector.ContextMenu.createFromEvent(event);contextMenu.appendSeparator();contextMenu.appendItem(WebInspector.UIString("Log Value"),WebInspector.HeapSnapshotInstanceDataGridNode.logHeapSnapshotNode.bind(null,this._node));}
_populateError(containerElement)
{if(this._node.internal)
return;let previewErrorElement=containerElement.appendChild(document.createElement("span"));previewErrorElement.classList.add("preview-error");previewErrorElement.textContent=WebInspector.UIString("No preview available");}
_populateWindowPreview(containerElement)
{HeapAgent.getRemoteObject(this._node.id,(error,remoteObjectPayload)=>{if(error){this._populateError(containerElement);return;}
function inspectedPage_window_getLocationHref(){return this.location.href;}
let remoteObject=WebInspector.RemoteObject.fromPayload(remoteObjectPayload,WebInspector.assumingMainTarget());remoteObject.callFunctionJSON(inspectedPage_window_getLocationHref,undefined,(href)=>{remoteObject.release();if(!href)
this._populateError(containerElement);else{let primitiveRemoteObject=WebInspector.RemoteObject.fromPrimitiveValue(href);containerElement.appendChild(WebInspector.FormattedValue.createElementForRemoteObject(primitiveRemoteObject));}});});}
_populatePreview(containerElement)
{HeapAgent.getPreview(this._node.id,(error,string,functionDetails,objectPreviewPayload)=>{if(error){this._populateError(containerElement);return;}
if(string){let primitiveRemoteObject=WebInspector.RemoteObject.fromPrimitiveValue(string);containerElement.appendChild(WebInspector.FormattedValue.createElementForRemoteObject(primitiveRemoteObject));return;}
if(functionDetails){let{location,name,displayName}=functionDetails;let functionNameElement=containerElement.appendChild(document.createElement("span"));functionNameElement.classList.add("function-name");functionNameElement.textContent=name||displayName||WebInspector.UIString("(anonymous function)");let sourceCode=WebInspector.debuggerManager.scriptForIdentifier(location.scriptId,WebInspector.assumingMainTarget());if(sourceCode){let locationElement=containerElement.appendChild(document.createElement("span"));locationElement.classList.add("location");let sourceCodeLocation=sourceCode.createSourceCodeLocation(location.lineNumber,location.columnNumber);sourceCodeLocation.populateLiveDisplayLocationString(locationElement,"textContent",WebInspector.SourceCodeLocation.ColumnStyle.Hidden,WebInspector.SourceCodeLocation.NameStyle.Short);const options={dontFloat:true,useGoToArrowButton:true,ignoreNetworkTab:true,ignoreSearchTab:true,};let goToArrowButtonLink=WebInspector.createSourceCodeLocationLink(sourceCodeLocation,options);containerElement.appendChild(goToArrowButtonLink);}
return;}
if(objectPreviewPayload){let objectPreview=WebInspector.ObjectPreview.fromPayload(objectPreviewPayload);let previewElement=WebInspector.FormattedValue.createObjectPreviewOrFormattedValueForObjectPreview(objectPreview);containerElement.appendChild(previewElement);return;}});}
_mouseoverHandler(event)
{let targetFrame=WebInspector.Rect.rectFromClientRect(event.target.getBoundingClientRect());if(!targetFrame.size.width&&!targetFrame.size.height)
return;if(this._tree.popoverGridNode===this._node)
return;this._tree.popoverGridNode=this._node;this._tree.popoverTargetElement=event.target;let popoverContentElement=document.createElement("div");popoverContentElement.classList.add("heap-snapshot","heap-snapshot-instance-popover-content");function appendTitle(node){let idElement=document.createElement("span");idElement.classList.add("object-id");idElement.textContent="@"+node.id;idElement.addEventListener("click",WebInspector.HeapSnapshotInstanceDataGridNode.logHeapSnapshotNode.bind(null,node));let title=popoverContentElement.appendChild(document.createElement("div"));title.classList.add("title");let localizedString=WebInspector.UIString("Shortest property path to %s").format("@@@");let[before,after]=localizedString.split(/\s*@@@\s*/);title.append(before+" ",idElement," "+after);}
function appendPath(path){let tableContainer=popoverContentElement.appendChild(document.createElement("div"));tableContainer.classList.add("table-container");let tableElement=tableContainer.appendChild(document.createElement("table"));path=path.slice().reverse();let windowIndex=path.findIndex((x)=>{return x instanceof WebInspector.HeapSnapshotNodeProxy&&x.className==="Window";});let edge=null;for(let i=windowIndex===-1?0:windowIndex;i<path.length;++i){let component=path[i];if(component instanceof WebInspector.HeapSnapshotEdgeProxy){edge=component;continue;}
appendPathRow(tableElement,edge,component);edge=null;}}
function appendPathRow(tableElement,edge,node){let tableRow=tableElement.appendChild(document.createElement("tr"));let pathDataElement=tableRow.appendChild(document.createElement("td"));pathDataElement.classList.add("edge-name");if(node.className==="Window")
pathDataElement.textContent="window";else if(edge){let edgeString=stringifyEdge(edge);pathDataElement.textContent=typeof edgeString==="string"?edgeString:emDash;}else
pathDataElement.textContent=emDash;if(pathDataElement.textContent.length>10)
pathDataElement.title=pathDataElement.textContent;let objectDataElement=tableRow.appendChild(document.createElement("td"));objectDataElement.classList.add("object-data");let containerElement=objectDataElement.appendChild(document.createElement("div"));containerElement.classList.add("node");let iconElement=containerElement.appendChild(document.createElement("img"));iconElement.classList.add("icon",WebInspector.HeapSnapshotClusterContentView.iconStyleClassNameForClassName(node.className,node.internal));let classNameElement=containerElement.appendChild(document.createElement("span"));classNameElement.textContent=sanitizeClassName(node.className)+" ";let idElement=containerElement.appendChild(document.createElement("span"));idElement.classList.add("object-id");idElement.textContent="@"+node.id;idElement.addEventListener("click",WebInspector.HeapSnapshotInstanceDataGridNode.logHeapSnapshotNode.bind(null,node));if(node.className==="Function"){let goToArrowPlaceHolderElement=containerElement.appendChild(document.createElement("span"));goToArrowPlaceHolderElement.style.display="inline-block";goToArrowPlaceHolderElement.style.width="10px";HeapAgent.getPreview(node.id,function(error,string,functionDetails,objectPreviewPayload){if(functionDetails){let location=functionDetails.location;let sourceCode=WebInspector.debuggerManager.scriptForIdentifier(location.scriptId,WebInspector.assumingMainTarget());if(sourceCode){let sourceCodeLocation=sourceCode.createSourceCodeLocation(location.lineNumber,location.columnNumber);const options={dontFloat:true,useGoToArrowButton:true,ignoreNetworkTab:true,ignoreSearchTab:true,};let goToArrowButtonLink=WebInspector.createSourceCodeLocationLink(sourceCodeLocation,options);containerElement.replaceChild(goToArrowButtonLink,goToArrowPlaceHolderElement);}}});}}
function sanitizeClassName(className){if(className.endsWith("LexicalEnvironment"))
return WebInspector.UIString("Scope");return className;}
function stringifyEdge(edge){switch(edge.type){case WebInspector.HeapSnapshotEdgeProxy.EdgeType.Property:case WebInspector.HeapSnapshotEdgeProxy.EdgeType.Variable:if(/^(?![0-9])\w+$/.test(edge.data))
return edge.data;return"["+doubleQuotedString(edge.data)+"]";case WebInspector.HeapSnapshotEdgeProxy.EdgeType.Index:return"["+edge.data+"]";case WebInspector.HeapSnapshotEdgeProxy.EdgeType.Internal:default:return null;}}
this._node.shortestGCRootPath((path)=>{if(!this._tree.visible)
return;if(path.length){appendTitle(this._node);appendPath(path);}else if(this._node.gcRoot){let textElement=popoverContentElement.appendChild(document.createElement("div"));textElement.textContent=WebInspector.UIString("This object is a root");}else{let emptyElement=popoverContentElement.appendChild(document.createElement("div"));emptyElement.textContent=WebInspector.UIString("This object is referenced by internal objects");}
this._tree.popover.presentNewContentWithFrame(popoverContentElement,targetFrame.pad(2),[WebInspector.RectEdge.MAX_Y,WebInspector.RectEdge.MIN_Y,WebInspector.RectEdge.MAX_X]);});}};WebInspector.HeapSnapshotInstanceFetchMoreDataGridNode=class HeapSnapshotInstanceFetchMoreDataGridNode extends WebInspector.DataGridNode
{constructor(tree,batchCount,remainingCount,fetchCallback)
{super({},false);this._tree=tree;this._batchCount=batchCount;this._remainingCount=remainingCount;this._fetchCallback=fetchCallback;}
createCellContent(columnIdentifier)
{if(columnIdentifier!=="className")
return"";let fragment=document.createDocumentFragment();if(this._batchCount){let buttonElement=fragment.appendChild(document.createElement("span"));buttonElement.classList.add("more");buttonElement.textContent=WebInspector.UIString("Show %d More").format(this._batchCount);buttonElement.addEventListener("click",(event)=>{this._fetchCallback(this._batchCount);});}
let buttonElement=fragment.appendChild(document.createElement("span"));buttonElement.classList.add("more");buttonElement.textContent=WebInspector.UIString("Show Remaining (%d)").format(this._remainingCount);buttonElement.addEventListener("click",(event)=>{this._fetchCallback(this._remainingCount);});return fragment;}
sort()
{}};WebInspector.HierarchicalPathNavigationItem=class HierarchicalPathNavigationItem extends WebInspector.NavigationItem
{constructor(identifier,components)
{super(identifier);this.components=components;}
get components()
{return this._components;}
set components(newComponents)
{if(!newComponents)
newComponents=[];let componentsEqual=function(a,b){let getRepresentedObjects=(component)=>component.representedObject;let representedObjectsA=a.map(getRepresentedObjects);let representedObjectsB=b.map(getRepresentedObjects);if(!Array.shallowEqual(representedObjectsA,representedObjectsB))
return false;let getExtraComparisonData=(component)=>component.comparisonData;let extraComparisonDataA=a.map(getExtraComparisonData);let extraComparisonDataB=b.map(getExtraComparisonData);return Array.shallowEqual(extraComparisonDataA,extraComparisonDataB);};if(this._components&&componentsEqual(this._components,newComponents))
return;for(var i=0;this._components&&i<this._components.length;++i)
this._components[i].removeEventListener(WebInspector.HierarchicalPathComponent.Event.SiblingWasSelected,this._siblingPathComponentWasSelected,this);this._components=newComponents.slice(0);for(var i=0;i<this._components.length;++i)
this._components[i].addEventListener(WebInspector.HierarchicalPathComponent.Event.SiblingWasSelected,this._siblingPathComponentWasSelected,this);this.element.removeChildren();delete this._collapsedComponent;for(var i=0;i<newComponents.length;++i)
this.element.appendChild(newComponents[i].element);if(this.parentNavigationBar)
this.parentNavigationBar.needsLayout();}
get lastComponent()
{return this._components.lastValue||null;}
get alwaysShowLastPathComponentSeparator()
{return this.element.classList.contains(WebInspector.HierarchicalPathNavigationItem.AlwaysShowLastPathComponentSeparatorStyleClassName);}
set alwaysShowLastPathComponentSeparator(flag)
{if(flag)
this.element.classList.add(WebInspector.HierarchicalPathNavigationItem.AlwaysShowLastPathComponentSeparatorStyleClassName);else
this.element.classList.remove(WebInspector.HierarchicalPathNavigationItem.AlwaysShowLastPathComponentSeparatorStyleClassName);}
updateLayout(expandOnly)
{var navigationBar=this.parentNavigationBar;if(!navigationBar)
return;if(this._collapsedComponent){this.element.removeChild(this._collapsedComponent.element);delete this._collapsedComponent;}
for(var i=0;i<this._components.length;++i){this._components[i].hidden=false;this._components[i].forcedWidth=null;}
if(expandOnly)
return;if(navigationBar.sizesToFit)
return;var totalOtherItemsWidth=0;for(var i=0;i<navigationBar.navigationItems.length;++i){if(navigationBar.navigationItems[i]===this)
continue;if(navigationBar.navigationItems[i]instanceof WebInspector.FlexibleSpaceNavigationItem)
continue;totalOtherItemsWidth+=navigationBar.navigationItems[i].element.realOffsetWidth;}
var thisItemWidth=0;var componentWidths=[];for(var i=0;i<this._components.length;++i){var componentWidth=this._components[i].element.realOffsetWidth;componentWidths.push(componentWidth);thisItemWidth+=componentWidth;}
var barWidth=navigationBar.element.realOffsetWidth;if(totalOtherItemsWidth+thisItemWidth<=barWidth)
return;
var widthToRemove=totalOtherItemsWidth+thisItemWidth-barWidth;for(var i=0;i<this._components.length;++i){var componentWidth=componentWidths[i];var forcedWidth=componentWidth-widthToRemove;this._components[i].forcedWidth=forcedWidth;
componentWidths[i]=Math.max(this._components[i].minimumWidth,forcedWidth);widthToRemove-=(componentWidth-componentWidths[i]);if(widthToRemove<=0)
break;}
if(widthToRemove<=0)
return;
if(this._components.length<=3)
return;var middle=this._components.length>>1;var distance=-1;var i=middle;this._collapsedComponent=new WebInspector.HierarchicalPathComponent(ellipsis,[]);this._collapsedComponent.collapsed=true;this.element.insertBefore(this._collapsedComponent.element,this._components[middle].element);widthToRemove+=this._collapsedComponent.minimumWidth;var hiddenDisplayNames=[];while(i>=0&&i<=this._components.length-1){if(i>0&&i<this._components.length-1){var component=this._components[i];component.hidden=true;if(distance>0)
hiddenDisplayNames.unshift(component.displayName);else
hiddenDisplayNames.push(component.displayName);widthToRemove-=componentWidths[i];if(widthToRemove<=0)
break;}
i=middle+distance;if(distance>0)
++distance;distance*=-1;}
this._collapsedComponent.element.title=hiddenDisplayNames.join("\n");}
get additionalClassNames()
{return["hierarchical-path"];}
_siblingPathComponentWasSelected(event)
{this.dispatchEventToListeners(WebInspector.HierarchicalPathNavigationItem.Event.PathComponentWasSelected,event.data);}};WebInspector.HierarchicalPathNavigationItem.AlwaysShowLastPathComponentSeparatorStyleClassName="always-show-last-path-component-separator";WebInspector.HierarchicalPathNavigationItem.Event={PathComponentWasSelected:"hierarchical-path-navigation-item-path-component-was-selected"};WebInspector.HoverMenu=class HoverMenu extends WebInspector.Object
{constructor(delegate)
{super();this.delegate=delegate;this._element=document.createElement("div");this._element.className="hover-menu";this._element.addEventListener("transitionend",this,true);this._outlineElement=this._element.appendChild(document.createElementNS("http://www.w3.org/2000/svg","svg"));this._button=this._element.appendChild(document.createElement("img"));this._button.addEventListener("click",this);}
get element()
{return this._element;}
present(rects)
{this._outlineElement.textContent="";document.body.appendChild(this._element);this._drawOutline(rects);this._element.classList.add(WebInspector.HoverMenu.VisibleClassName);window.addEventListener("scroll",this,true);}
dismiss(discrete)
{if(this._element.parentNode!==document.body)
return;if(discrete)
this._element.remove();this._element.classList.remove(WebInspector.HoverMenu.VisibleClassName);window.removeEventListener("scroll",this,true);}
handleEvent(event)
{switch(event.type){case"scroll":if(!this._element.contains(event.target))
this.dismiss(true);break;case"click":this._handleClickEvent(event);break;case"transitionend":if(!this._element.classList.contains(WebInspector.HoverMenu.VisibleClassName))
this._element.remove();break;}}
_handleClickEvent(event)
{if(this.delegate&&typeof this.delegate.hoverMenuButtonWasPressed==="function")
this.delegate.hoverMenuButtonWasPressed(this);}
_drawOutline(rects)
{var buttonWidth=this._button.width;var buttonHeight=this._button.height;var lastRect=rects.pop();lastRect.size.width+=buttonWidth;rects.push(lastRect);if(rects.length===1)
this._drawSingleLine(rects[0]);else if(rects.length===2&&rects[0].minX()>=rects[1].maxX())
this._drawTwoNonOverlappingLines(rects);else
this._drawOverlappingLines(rects);var bounds=WebInspector.Rect.unionOfRects(rects).pad(3); var style=this._element.style;style.left=bounds.minX()+"px";style.top=bounds.minY()+"px";style.width=bounds.size.width+"px";style.height=bounds.size.height+"px";this._outlineElement.style.width=bounds.size.width+"px";this._outlineElement.style.height=bounds.size.height+"px";this._button.style.left=(lastRect.maxX()-bounds.minX()-buttonWidth)+"px";this._button.style.top=(lastRect.maxY()-bounds.minY()-buttonHeight)+"px";}
_addRect(rect)
{var r=4;var svgRect=document.createElementNS("http://www.w3.org/2000/svg","rect");svgRect.setAttribute("x",1);svgRect.setAttribute("y",1);svgRect.setAttribute("width",rect.size.width);svgRect.setAttribute("height",rect.size.height);svgRect.setAttribute("rx",r);svgRect.setAttribute("ry",r);return this._outlineElement.appendChild(svgRect);}
_addPath(commands,tx,ty)
{var path=document.createElementNS("http://www.w3.org/2000/svg","path");path.setAttribute("d",commands.join(" "));path.setAttribute("transform","translate("+(tx+1)+","+(ty+1)+")");return this._outlineElement.appendChild(path);}
_drawSingleLine(rect)
{this._addRect(rect.pad(2));}
_drawTwoNonOverlappingLines(rects)
{var r=4;var firstRect=rects[0].pad(2);var secondRect=rects[1].pad(2);var tx=-secondRect.minX();var ty=-firstRect.minY();var rect=firstRect;this._addPath(["M",rect.maxX(),rect.minY(),"H",rect.minX()+r,"q",-r,0,-r,r,"V",rect.maxY()-r,"q",0,r,r,r,"H",rect.maxX()],tx,ty);rect=secondRect;this._addPath(["M",rect.minX(),rect.minY(),"H",rect.maxX()-r,"q",r,0,r,r,"V",rect.maxY()-r,"q",0,r,-r,r,"H",rect.minX()],tx,ty);}
_drawOverlappingLines(rects)
{var PADDING=2;var r=4;var minX=Number.MAX_VALUE;var maxX=-Number.MAX_VALUE;for(var rect of rects){var minX=Math.min(rect.minX(),minX);var maxX=Math.max(rect.maxX(),maxX);}
minX-=PADDING;maxX+=PADDING;var minY=rects[0].minY()-PADDING;var maxY=rects.lastValue.maxY()+PADDING;var firstLineMinX=rects[0].minX()-PADDING;var lastLineMaxX=rects.lastValue.maxX()+PADDING;if(firstLineMinX===minX&&lastLineMaxX===maxX)
return this._addRect(new WebInspector.Rect(minX,minY,maxX-minX,maxY-minY));var lastLineMinY=rects.lastValue.minY()+PADDING;if(rects[0].minX()===minX+PADDING){return this._addPath(["M",minX+r,minY,"H",maxX-r,"q",r,0,r,r,"V",lastLineMinY-r,"q",0,r,-r,r,"H",lastLineMaxX+r,"q",-r,0,-r,r,"V",maxY-r,"q",0,r,-r,r,"H",minX+r,"q",-r,0,-r,-r,"V",minY+r,"q",0,-r,r,-r],-minX,-minY);}
var firstLineMaxY=rects[0].maxY()-PADDING;if(rects.lastValue.maxX()===maxX-PADDING){return this._addPath(["M",firstLineMinX+r,minY,"H",maxX-r,"q",r,0,r,r,"V",maxY-r,"q",0,r,-r,r,"H",minX+r,"q",-r,0,-r,-r,"V",firstLineMaxY+r,"q",0,-r,r,-r,"H",firstLineMinX-r,"q",r,0,r,-r,"V",minY+r,"q",0,-r,r,-r],-minX,-minY);}
return this._addPath(["M",firstLineMinX+r,minY,"H",maxX-r,"q",r,0,r,r,"V",lastLineMinY-r,"q",0,r,-r,r,"H",lastLineMaxX+r,"q",-r,0,-r,r,"V",maxY-r,"q",0,r,-r,r,"H",minX+r,"q",-r,0,-r,-r,"V",firstLineMaxY+r,"q",0,-r,r,-r,"H",firstLineMinX-r,"q",r,0,r,-r,"V",minY+r,"q",0,-r,r,-r],-minX,-minY);}};WebInspector.HoverMenu.VisibleClassName="visible";WebInspector.IdleTreeElement=class IdleTreeElement extends WebInspector.GeneralTreeElement
{constructor()
{super("idle",WebInspector.UIString("Idle"));}};WebInspector.ImageResourceContentView=class ImageResourceContentView extends WebInspector.ResourceContentView
{constructor(resource)
{super(resource,"image");this._imageElement=null;const toolTip=WebInspector.UIString("Show Grid");const activatedToolTip=WebInspector.UIString("Hide Grid");this._showGridButtonNavigationItem=new WebInspector.ActivateButtonNavigationItem("show-grid",toolTip,activatedToolTip,"Images/NavigationItemCheckers.svg",13,13);this._showGridButtonNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,this._showGridButtonClicked,this);this._showGridButtonNavigationItem.activated=!!WebInspector.settings.showImageGrid.value;}
get navigationItems()
{return[this._showGridButtonNavigationItem];}
contentAvailable(content,base64Encoded)
{let objectURL=this.resource.createObjectURL();if(!objectURL){this.showGenericErrorMessage();return;}
this.removeLoadingIndicator();this._imageElement=document.createElement("img");this._imageElement.addEventListener("load",function(){URL.revokeObjectURL(objectURL);});this._imageElement.src=objectURL;this._imageElement.setAttribute("filename",this.resource.urlComponents.lastPathComponent||"");this._updateImageGrid();this.element.appendChild(this._imageElement);}
shown()
{super.shown();this._updateImageGrid();WebInspector.settings.showImageGrid.addEventListener(WebInspector.Setting.Event.Changed,this._updateImageGrid,this);}
hidden()
{WebInspector.settings.showImageGrid.removeEventListener(WebInspector.Setting.Event.Changed,this._updateImageGrid,this);super.hidden();}
_updateImageGrid()
{if(!this._imageElement)
return;let activated=WebInspector.settings.showImageGrid.value;this._showGridButtonNavigationItem.activated=activated;this._imageElement.classList.toggle("show-grid",activated);}
_showGridButtonClicked(event)
{WebInspector.settings.showImageGrid.value=!this._showGridButtonNavigationItem.activated;this._updateImageGrid();}};WebInspector.IndeterminateProgressSpinner=class IndeterminateProgressSpinner extends WebInspector.Object
{constructor()
{super();this._element=document.createElement("div");this._element.classList.add("indeterminate-progress-spinner");}
get element()
{return this._element;}};WebInspector.IndexedDatabaseContentView=class IndexedDatabaseContentView extends WebInspector.ContentView
{constructor(database)
{super(database);this._element.classList.add("indexed-database");this._databaseHostRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Host"));this._databaseSecurityOriginRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Security Origin"));this._databaseVersionRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Version"));this._databaseGroup=new WebInspector.DetailsSectionGroup([this._databaseHostRow,this._databaseSecurityOriginRow,this._databaseVersionRow]);this._databaseSection=new WebInspector.DetailsSection("indexed-database-details",WebInspector.UIString("Database"),[this._databaseGroup]);this.element.append(this._databaseSection.element);this._databaseHostRow.value=database.host;this._databaseSecurityOriginRow.value=database.securityOrigin;this._databaseVersionRow.value=database.version.toLocaleString();}};WebInspector.IndexedDatabaseDetailsSidebarPanel=class IndexedDatabaseDetailsSidebarPanel extends WebInspector.DetailsSidebarPanel
{constructor()
{super("indexed-database-details",WebInspector.UIString("Storage"));this.element.classList.add("indexed-database");this._database=null;this._objectStore=null;this._index=null;}
inspect(objects)
{if(!(objects instanceof Array))
objects=[objects];this._database=null;this._objectStore=null;this._index=null;for(let object of objects){if(object instanceof WebInspector.IndexedDatabaseObjectStore){this._objectStore=object;this._database=this._objectStore.parentDatabase;}else if(object instanceof WebInspector.IndexedDatabaseObjectStoreIndex){this._index=object;this._objectStore=this._index.parentObjectStore;this._database=this._objectStore.parentDatabase;}}
let hasObject=this._database||this._objectStore||this._index;if(hasObject)
this.needsLayout();return hasObject;}
initialLayout()
{super.initialLayout();this._databaseNameRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Name"));this._databaseVersionRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Version"));this._databaseSecurityOriginRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Security Origin"));let databaseGroup=new WebInspector.DetailsSectionGroup([this._databaseNameRow,this._databaseVersionRow,this._databaseSecurityOriginRow]);this._databaseSection=new WebInspector.DetailsSection("indexed-database-database",WebInspector.UIString("Database"),[databaseGroup]);this._objectStoreNameRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Name"));this._objectStoreKeyPathRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Key Path"));this._objectStoreAutoIncrementRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Auto Increment"));let objectStoreGroup=new WebInspector.DetailsSectionGroup([this._objectStoreNameRow,this._objectStoreKeyPathRow,this._objectStoreAutoIncrementRow]);this._objectStoreSection=new WebInspector.DetailsSection("indexed-database-object-store",WebInspector.UIString("Object Store"),[objectStoreGroup]);this._indexNameRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Name"));this._indexKeyPathRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Key Path"));this._indexUniqueRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Unique"));this._indexMultiEntryRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Multi-Entry"));let indexGroup=new WebInspector.DetailsSectionGroup([this._indexNameRow,this._indexKeyPathRow,this._indexUniqueRow,this._indexMultiEntryRow]);this._indexSection=new WebInspector.DetailsSection("indexed-database-index",WebInspector.UIString("Index"),[indexGroup]);this.contentView.element.appendChild(this._databaseSection.element);this.contentView.element.appendChild(this._objectStoreSection.element);this.contentView.element.appendChild(this._indexSection.element);}
layout()
{super.layout();if(!this._database)
this._databaseSection.element.hidden=true;else{this._databaseSection.element.hidden=false;this._databaseSecurityOriginRow.value=this._database.securityOrigin;this._databaseNameRow.value=this._database.name;this._databaseVersionRow.value=this._database.version.toLocaleString();}
if(!this._objectStore)
this._objectStoreSection.element.hidden=true;else{this._objectStoreSection.element.hidden=false;this._objectStoreNameRow.value=this._objectStore.name;this._objectStoreKeyPathRow.value=this._keyPathString(this._objectStore.keyPath);this._objectStoreAutoIncrementRow.value=this._objectStore.autoIncrement?WebInspector.UIString("Yes"):WebInspector.UIString("No");}
if(!this._index)
this._indexSection.element.hidden=true;else{this._indexSection.element.hidden=false;this._indexNameRow.value=this._index.name;this._indexKeyPathRow.value=this._keyPathString(this._index.keyPath);this._indexUniqueRow.value=this._index.unique?WebInspector.UIString("Yes"):WebInspector.UIString("No");if(this._index.keyPath.type!==IndexedDBAgent.KeyPathType.Array)
this._indexMultiEntryRow.value=null;else
this._indexMultiEntryRow.value=this._index.multiEntry?WebInspector.UIString("Yes"):WebInspector.UIString("No");}}
_keyPathString(keyPath)
{return keyPath?JSON.stringify(keyPath):emDash;}};WebInspector.IndexedDatabaseEntryDataGridNode=class IndexedDatabaseEntryDataGridNode extends WebInspector.DataGridNode
{constructor(entry)
{super(entry);this._entry=entry;}
get entry()
{return this._entry;}
createCellContent(columnIdentifier,cell)
{var value=this._entry[columnIdentifier];if(value instanceof WebInspector.RemoteObject)
return WebInspector.FormattedValue.createObjectTreeOrFormattedValueForRemoteObject(value,null,true);return super.createCellContent(columnIdentifier,cell);}};WebInspector.IndexedDatabaseHostTreeElement=class IndexedDatabaseHostTreeElement extends WebInspector.StorageTreeElement
{constructor(host)
{super(WebInspector.FolderTreeElement.FolderIconStyleClassName,WebInspector.displayNameForHost(host),null);this._host=host;this.hasChildren=true;this.expanded=true;}
get name()
{return WebInspector.displayNameForHost(this._host);}
get categoryName()
{return WebInspector.UIString("Indexed Databases");}};WebInspector.IndexedDatabaseObjectStoreContentView=class IndexedDatabaseObjectStoreContentView extends WebInspector.ContentView
{constructor(objectStoreOrIndex)
{super(objectStoreOrIndex);this.element.classList.add("indexed-database-object-store");if(objectStoreOrIndex instanceof WebInspector.IndexedDatabaseObjectStore){this._objectStore=objectStoreOrIndex;this._objectStoreIndex=null;}else if(objectStoreOrIndex instanceof WebInspector.IndexedDatabaseObjectStoreIndex){this._objectStore=objectStoreOrIndex.parentObjectStore;this._objectStoreIndex=objectStoreOrIndex;}
function displayKeyPath(keyPath)
{if(!keyPath)
return"";if(keyPath instanceof Array)
return keyPath.join(WebInspector.UIString(", "));return keyPath;}
var displayPrimaryKeyPath=displayKeyPath(this._objectStore.keyPath);var columnInfo={primaryKey:{title:displayPrimaryKeyPath?WebInspector.UIString("Primary Key \u2014 %s").format(displayPrimaryKeyPath):WebInspector.UIString("Primary Key")},key:{},value:{title:WebInspector.UIString("Value")}};if(this._objectStoreIndex){var displayIndexKeyPath=displayKeyPath(this._objectStoreIndex.keyPath);columnInfo.key.title=WebInspector.UIString("Index Key \u2014 %s").format(displayIndexKeyPath);}else{
delete columnInfo.key;}
this._dataGrid=new WebInspector.DataGrid(columnInfo);this._dataGrid.variableHeightRows=true;this._dataGrid.scrollContainer.addEventListener("scroll",this._dataGridScrolled.bind(this));this.addSubview(this._dataGrid);this._entries=[];this._fetchingMoreData=false;this._fetchMoreData();this._refreshButtonNavigationItem=new WebInspector.ButtonNavigationItem("indexed-database-object-store-refresh",WebInspector.UIString("Refresh"),"Images/ReloadFull.svg",13,13);this._refreshButtonNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,this._refreshButtonClicked,this);this._clearButtonNavigationItem=new WebInspector.ButtonNavigationItem("indexed-database-object-store-clear",WebInspector.UIString("Clear object store"),"Images/NavigationItemTrash.svg",15,15);this._clearButtonNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,this._clearButtonClicked,this);}
get navigationItems()
{return[this._refreshButtonNavigationItem,this._clearButtonNavigationItem];}
closed()
{super.closed();this._reset();}
saveToCookie(cookie)
{cookie.type=WebInspector.ContentViewCookieType.IndexedDatabaseObjectStore;cookie.securityOrigin=this._objectStore.parentDatabase.securityOrigin;cookie.databaseName=this._objectStore.parentDatabase.name;cookie.objectStoreName=this._objectStore.name;cookie.objectStoreIndexName=this._objectStoreIndex&&this._objectStoreIndex.name;}
get scrollableElements()
{return[this._dataGrid.scrollContainer];}
_reset()
{for(var entry of this._entries){entry.primaryKey.release();entry.key.release();entry.value.release();}
this._entries=[];this._dataGrid.removeChildren();}
_dataGridScrolled()
{if(!this._moreEntriesAvailable||!this._dataGrid.isScrolledToLastRow())
return;this._fetchMoreData();}
_fetchMoreData()
{if(this._fetchingMoreData)
return;function processEntries(entries,moreAvailable)
{this._entries=this._entries.concat(entries);this._moreEntriesAvailable=moreAvailable;for(var entry of entries){var dataGridNode=new WebInspector.IndexedDatabaseEntryDataGridNode(entry);this._dataGrid.appendChild(dataGridNode);}
this._fetchingMoreData=false;if(moreAvailable&&this._dataGrid.isScrolledToLastRow())
this._fetchMoreData();}
this._fetchingMoreData=true;WebInspector.storageManager.requestIndexedDatabaseData(this._objectStore,this._objectStoreIndex,this._entries.length,25,processEntries.bind(this));}
_refreshButtonClicked()
{this._reset();this._fetchMoreData();}
_clearButtonClicked()
{WebInspector.storageManager.clearObjectStore(this._objectStore);this._reset();}};WebInspector.IndexedDatabaseObjectStoreIndexTreeElement=class IndexedDatabaseObjectStoreIndexTreeElement extends WebInspector.GeneralTreeElement
{constructor(objectStoreIndex)
{super("database-table-icon",objectStoreIndex.name,null,objectStoreIndex,false);this._objectStoreIndex=objectStoreIndex;}
get objectStoreIndex()
{return this._objectStoreIndex;}};WebInspector.IndexedDatabaseObjectStoreTreeElement=class IndexedDatabaseObjectStoreTreeElement extends WebInspector.GeneralTreeElement
{constructor(objectStore)
{super("database-table-icon",objectStore.name,null,objectStore,!!objectStore.indexes.length);this._objectStore=objectStore;}
get objectStore()
{return this._objectStore;}
oncollapse()
{this.shouldRefreshChildren=true;}
onpopulate()
{if(this.children.length&&!this.shouldRefreshChildren)
return;this.shouldRefreshChildren=false;this.removeChildren();for(var objectStoreIndex of this._objectStore.indexes)
this.appendChild(new WebInspector.IndexedDatabaseObjectStoreIndexTreeElement(objectStoreIndex));}};WebInspector.IndexedDatabaseTreeElement=class IndexedDatabaseTreeElement extends WebInspector.GeneralTreeElement
{constructor(indexedDatabase)
{super("database-icon",indexedDatabase.name,null,indexedDatabase,!!indexedDatabase.objectStores.length);this._indexedDatabase=indexedDatabase;}
get indexedDatabase()
{return this._indexedDatabase;}
oncollapse()
{this.shouldRefreshChildren=true;}
onpopulate()
{if(this.children.length&&!this.shouldRefreshChildren)
return;this.shouldRefreshChildren=false;this.removeChildren();for(var objectStore of this._indexedDatabase.objectStores)
this.appendChild(new WebInspector.IndexedDatabaseObjectStoreTreeElement(objectStore));}};WebInspector.InlineSwatch=class InlineSwatch extends WebInspector.Object
{constructor(type,value,readOnly)
{super();this._type=type;this._swatchElement=document.createElement("span");this._swatchElement.classList.add("inline-swatch",this._type.split("-").lastValue);switch(this._type){case WebInspector.InlineSwatch.Type.Color:this._swatchElement.title=WebInspector.UIString("Click to select a color. Shift-click to switch color formats.");break;case WebInspector.InlineSwatch.Type.Gradient:this._swatchElement.title=WebInspector.UIString("Edit custom gradient");break;case WebInspector.InlineSwatch.Type.Bezier:this._swatchElement.title=WebInspector.UIString("Edit “cubic-bezier“ function");break;case WebInspector.InlineSwatch.Type.Spring:this._swatchElement.title=WebInspector.UIString("Edit “spring“ function");break;case WebInspector.InlineSwatch.Type.Variable:this._swatchElement.title=WebInspector.UIString("View variable value");break;default:WebInspector.reportInternalError(`Unknown InlineSwatch type "${type}"`);break;}
this._boundSwatchElementClicked=null;if(!readOnly){this._boundSwatchElementClicked=this._swatchElementClicked.bind(this);this._swatchElement.addEventListener("click",this._boundSwatchElementClicked);if(this._type===WebInspector.InlineSwatch.Type.Color)
this._swatchElement.addEventListener("contextmenu",this._handleContextMenuEvent.bind(this));}
this._swatchInnerElement=this._swatchElement.createChild("span");this._value=value||this._fallbackValue();this._valueEditor=null;this._updateSwatch();}
get element()
{return this._swatchElement;}
get value()
{return this._value;}
set value(value)
{this._value=value;this._updateSwatch(true);}
didDismissPopover(popover)
{if(!this._valueEditor)
return;if(typeof this._valueEditor.removeListeners==="function")
this._valueEditor.removeListeners();if(this._boundSwatchElementClicked)
this._swatchElement.addEventListener("click",this._boundSwatchElementClicked);this.dispatchEventToListeners(WebInspector.InlineSwatch.Event.Deactivated);}
_fallbackValue()
{switch(this._type){case WebInspector.InlineSwatch.Type.Bezier:return WebInspector.CubicBezier.fromString("linear");case WebInspector.InlineSwatch.Type.Gradient:return WebInspector.Gradient.fromString("linear-gradient(transparent, transparent)");case WebInspector.InlineSwatch.Type.Spring:return WebInspector.Spring.fromString("1 100 10 0");case WebInspector.InlineSwatch.Type.Color:return WebInspector.Color.fromString("white");default:return null;}}
_updateSwatch(dontFireEvents)
{if(this._type===WebInspector.InlineSwatch.Type.Color||this._type===WebInspector.InlineSwatch.Type.Gradient)
this._swatchInnerElement.style.background=this._value?this._value.toString():null;if(!dontFireEvents)
this.dispatchEventToListeners(WebInspector.InlineSwatch.Event.ValueChanged,{value:this._value});}
_swatchElementClicked(event)
{this.dispatchEventToListeners(WebInspector.InlineSwatch.Event.BeforeClicked);if(this._type===WebInspector.InlineSwatch.Type.Color&&event.shiftKey&&this._value){let nextFormat=this._value.nextFormat();if(!nextFormat)
return;this._value.format=nextFormat;this._updateSwatch();return;}
let bounds=WebInspector.Rect.rectFromClientRect(this._swatchElement.getBoundingClientRect());let popover=new WebInspector.Popover(this);popover.windowResizeHandler=()=>{let bounds=WebInspector.Rect.rectFromClientRect(this._swatchElement.getBoundingClientRect());popover.present(bounds.pad(2),[WebInspector.RectEdge.MIN_X]);};this._valueEditor=null;if(this._type===WebInspector.InlineSwatch.Type.Color){this._valueEditor=new WebInspector.ColorPicker;this._valueEditor.addEventListener(WebInspector.ColorPicker.Event.ColorChanged,this._valueEditorValueDidChange,this);this._valueEditor.addEventListener(WebInspector.ColorPicker.Event.FormatChanged,(event)=>popover.update());}else if(this._type===WebInspector.InlineSwatch.Type.Gradient){this._valueEditor=new WebInspector.GradientEditor;this._valueEditor.addEventListener(WebInspector.GradientEditor.Event.GradientChanged,this._valueEditorValueDidChange,this);this._valueEditor.addEventListener(WebInspector.GradientEditor.Event.ColorPickerToggled,(event)=>popover.update());}else if(this._type===WebInspector.InlineSwatch.Type.Bezier){this._valueEditor=new WebInspector.BezierEditor;this._valueEditor.addEventListener(WebInspector.BezierEditor.Event.BezierChanged,this._valueEditorValueDidChange,this);}else if(this._type===WebInspector.InlineSwatch.Type.Spring){this._valueEditor=new WebInspector.SpringEditor;this._valueEditor.addEventListener(WebInspector.SpringEditor.Event.SpringChanged,this._valueEditorValueDidChange,this);}else if(this._type===WebInspector.InlineSwatch.Type.Variable){this._valueEditor={};this._valueEditor.element=document.createElement("div");this._valueEditor.element.classList.add("inline-swatch-variable-popover");this._valueEditor.codeMirror=WebInspector.CodeMirrorEditor.create(this._valueEditor.element,{mode:"css",readOnly:"nocursor",});this._valueEditor.codeMirror.on("update",()=>{popover.update();});}
if(!this._valueEditor)
return;popover.content=this._valueEditor.element;popover.present(bounds.pad(2),[WebInspector.RectEdge.MIN_X]);if(this._boundSwatchElementClicked)
this._swatchElement.removeEventListener("click",this._boundSwatchElementClicked);this.dispatchEventToListeners(WebInspector.InlineSwatch.Event.Activated);let value=this._value||this._fallbackValue();if(this._type===WebInspector.InlineSwatch.Type.Color)
this._valueEditor.color=value;else if(this._type===WebInspector.InlineSwatch.Type.Gradient)
this._valueEditor.gradient=value;else if(this._type===WebInspector.InlineSwatch.Type.Bezier)
this._valueEditor.bezier=value;else if(this._type===WebInspector.InlineSwatch.Type.Spring)
this._valueEditor.spring=value;else if(this._type===WebInspector.InlineSwatch.Type.Variable)
this._valueEditor.codeMirror.setValue(value);}
_valueEditorValueDidChange(event)
{if(this._type===WebInspector.InlineSwatch.Type.Color)
this._value=event.data.color;else if(this._type===WebInspector.InlineSwatch.Type.Gradient)
this._value=event.data.gradient;else if(this._type===WebInspector.InlineSwatch.Type.Bezier)
this._value=event.data.bezier;else if(this._type===WebInspector.InlineSwatch.Type.Spring)
this._value=event.data.spring;this._updateSwatch();}
_handleContextMenuEvent(event)
{if(!this._value)
return;let contextMenu=WebInspector.ContextMenu.createFromEvent(event);if(this._value.isKeyword()&&this._value.format!==WebInspector.Color.Format.Keyword){contextMenu.appendItem(WebInspector.UIString("Format: Keyword"),()=>{this._value.format=WebInspector.Color.Format.Keyword;this._updateSwatch();});}
let hexInfo=this._getNextValidHEXFormat();if(hexInfo){contextMenu.appendItem(hexInfo.title,()=>{this._value.format=hexInfo.format;this._updateSwatch();});}
if(this._value.simple&&this._value.format!==WebInspector.Color.Format.HSL){contextMenu.appendItem(WebInspector.UIString("Format: HSL"),()=>{this._value.format=WebInspector.Color.Format.HSL;this._updateSwatch();});}else if(this._value.format!==WebInspector.Color.Format.HSLA){contextMenu.appendItem(WebInspector.UIString("Format: HSLA"),()=>{this._value.format=WebInspector.Color.Format.HSLA;this._updateSwatch();});}
if(this._value.simple&&this._value.format!==WebInspector.Color.Format.RGB){contextMenu.appendItem(WebInspector.UIString("Format: RGB"),()=>{this._value.format=WebInspector.Color.Format.RGB;this._updateSwatch();});}else if(this._value.format!==WebInspector.Color.Format.RGBA){contextMenu.appendItem(WebInspector.UIString("Format: RGBA"),()=>{this._value.format=WebInspector.Color.Format.RGBA;this._updateSwatch();});}}
_getNextValidHEXFormat()
{if(this._type!==WebInspector.InlineSwatch.Type.Color)
return false;function hexMatchesCurrentColor(hexInfo){let nextIsSimple=hexInfo.format===WebInspector.Color.Format.ShortHEX||hexInfo.format===WebInspector.Color.Format.HEX;if(nextIsSimple&&!this._value.simple)
return false;let nextIsShort=hexInfo.format===WebInspector.Color.Format.ShortHEX||hexInfo.format===WebInspector.Color.Format.ShortHEXAlpha;if(nextIsShort&&!this._value.canBeSerializedAsShortHEX())
return false;return true;}
const hexFormats=[{format:WebInspector.Color.Format.ShortHEX,title:WebInspector.UIString("Format: Short Hex")},{format:WebInspector.Color.Format.ShortHEXAlpha,title:WebInspector.UIString("Format: Short Hex with Alpha")},{format:WebInspector.Color.Format.HEX,title:WebInspector.UIString("Format: Hex")},{format:WebInspector.Color.Format.HEXAlpha,title:WebInspector.UIString("Format: Hex with Alpha")}];let currentColorIsHEX=hexFormats.some((info)=>info.format===this._value.format);for(let i=0;i<hexFormats.length;++i){if(currentColorIsHEX&&this._value.format!==hexFormats[i].format)
continue;for(let j=~~currentColorIsHEX;j<hexFormats.length;++j){let nextIndex=(i+j)%hexFormats.length;if(hexMatchesCurrentColor.call(this,hexFormats[nextIndex]))
return hexFormats[nextIndex];}
return null;}
return hexFormats[0];}};WebInspector.InlineSwatch.Type={Color:"inline-swatch-type-color",Gradient:"inline-swatch-type-gradient",Bezier:"inline-swatch-type-bezier",Spring:"inline-swatch-type-spring",Variable:"inline-swatch-type-variable",};WebInspector.InlineSwatch.Event={BeforeClicked:"inline-swatch-before-clicked",ValueChanged:"inline-swatch-value-changed",Activated:"inline-swatch-activated",Deactivated:"inline-swatch-deactivated",};WebInspector.InputPopover=class InputPopover extends WebInspector.Popover
{constructor(message,delegate)
{super(delegate);this._message=message;this._value=null;this._result=WebInspector.InputPopover.Result.None;this._targetElement=null;this._preferredEdges=null;this.windowResizeHandler=this._presentOverTargetElement.bind(this);}
get value(){return this._value;}
get result(){return this._result;}
show(targetElement,preferredEdges)
{this._targetElement=targetElement;this._preferredEdges=preferredEdges;let contentElement=document.createElement("div");contentElement.classList.add("input-popover-content");if(this._message){let label=document.createElement("div");label.classList.add("label");label.textContent=this._message;contentElement.appendChild(label);}
this._inputElement=document.createElement("input");this._inputElement.type="text";this._inputElement.addEventListener("keydown",(event)=>{if(!isEnterKey(event))
return;this._result=WebInspector.InputPopover.Result.Committed;this._value=event.target.value;this.dismiss();});contentElement.appendChild(this._inputElement);this.content=contentElement;this._presentOverTargetElement();}
_presentOverTargetElement()
{if(!this._targetElement)
return;let targetFrame=WebInspector.Rect.rectFromClientRect(this._targetElement.getBoundingClientRect());this.present(targetFrame,this._preferredEdges);this._inputElement.select();}};WebInspector.InputPopover.Result={None:Symbol("result-none"),Cancelled:Symbol("result-cancelled"),Committed:Symbol("result-committed"),};WebInspector.IssueTreeElement=class IssueTreeElement extends WebInspector.GeneralTreeElement
{constructor(issueMessage)
{var levelStyleClassName;switch(issueMessage.level){case"error":levelStyleClassName=WebInspector.IssueTreeElement.ErrorStyleClassName;break;case"warning":levelStyleClassName=WebInspector.IssueTreeElement.WarningStyleClassName;break;}
super([WebInspector.IssueTreeElement.StyleClassName,levelStyleClassName],null,null,issueMessage,false);this._issueMessage=issueMessage;this._updateTitles();this._issueMessage.addEventListener(WebInspector.IssueMessage.Event.DisplayLocationDidChange,this._updateTitles,this);}
get issueMessage()
{return this._issueMessage;}
_updateTitles()
{var displayLineNumber=this._issueMessage.sourceCodeLocation.displayLineNumber;var displayColumnNumber=this._issueMessage.sourceCodeLocation.displayColumnNumber;var title;if(displayColumnNumber>0)
title=WebInspector.UIString("Line %d:%d").format(displayLineNumber+1,displayColumnNumber+1);else
title=WebInspector.UIString("Line %d").format(displayLineNumber+1);this.mainTitle=title+" "+this._issueMessage.text;}};WebInspector.IssueTreeElement.StyleClassName="issue";WebInspector.IssueTreeElement.ErrorStyleClassName="error";WebInspector.IssueTreeElement.WarningStyleClassName="warning";WebInspector.LayerTreeDataGridNode=class LayerTreeDataGridNode extends WebInspector.DataGridNode
{constructor(layer)
{super();this._outlets={};this.layer=layer;}
createCells()
{super.createCells();this._cellsWereCreated=true;}
createCellContent(columnIdentifier,cell)
{cell=columnIdentifier==="name"?this._makeNameCell():this._makeOutlet(columnIdentifier,document.createTextNode("–"));this._updateCell(columnIdentifier);return cell;}
get layer()
{return this._layer;}
set layer(layer)
{this._layer=layer;var domNode=WebInspector.domTreeManager.nodeForId(layer.nodeId);this.data={name:domNode?domNode.displayName:WebInspector.UIString("Unknown node"),paintCount:layer.paintCount||emDash,memory:Number.bytesToString(layer.memory||0)};}
get data()
{return this._data;}
set data(data)
{Object.keys(data).forEach(function(columnIdentifier){if(this._data[columnIdentifier]===data[columnIdentifier])
return;this._data[columnIdentifier]=data[columnIdentifier];if(this._cellsWereCreated)
this._updateCell(columnIdentifier);},this);}
_makeOutlet(name,element)
{this._outlets[name]=element;return element;}
_makeNameCell()
{var fragment=document.createDocumentFragment();fragment.appendChild(document.createElement("img")).className="icon";var goToButton=this._makeOutlet("goToButton",fragment.appendChild(WebInspector.createGoToArrowButton()));goToButton.addEventListener("click",this._goToArrowWasClicked.bind(this),false);var label=this._makeOutlet("label",fragment.appendChild(document.createElement("span")));label.className="label";var nameLabel=this._makeOutlet("nameLabel",label.appendChild(document.createElement("span")));nameLabel.className="name";var pseudoLabel=this._makeOutlet("pseudoLabel",document.createElement("span"));pseudoLabel.className="pseudo-element";var reflectionLabel=this._makeOutlet("reflectionLabel",document.createElement("span"));reflectionLabel.className="reflection";reflectionLabel.textContent=" \u2014 "+WebInspector.UIString("Reflection");return fragment;}
_updateCell(columnIdentifier)
{var data=this._data[columnIdentifier];if(columnIdentifier==="name")
this._updateNameCellData(data);else
this._outlets[columnIdentifier].textContent=data;}
_updateNameCellData(data)
{var layer=this._layer;var label=this._outlets.label;this._outlets.nameLabel.textContent=data;if(WebInspector.domTreeManager.nodeForId(layer.nodeId))
label.parentNode.insertBefore(this._outlets.goToButton,label.parentNode.firstChild);else if(this._outlets.goToButton.parentNode)
label.parentNode.removeChild(this._outlets.goToButton);if(layer.pseudoElement)
label.appendChild(this._outlets.pseudoLabel).textContent="::"+layer.pseudoElement;else if(this._outlets.pseudoLabel.parentNode)
label.removeChild(this._outlets.pseudoLabel);if(layer.isReflection)
label.appendChild(this._outlets.reflectionLabel);else if(this._outlets.reflectionLabel.parentNode)
label.removeChild(this._outlets.reflectionLabel);var element=this.element;if(layer.isReflection)
element.classList.add("reflection");else if(layer.pseudoElement)
element.classList.add("pseudo-element");}
_goToArrowWasClicked()
{var domNode=WebInspector.domTreeManager.nodeForId(this._layer.nodeId);WebInspector.showMainFrameDOMTree(domNode);}};WebInspector.LayerTreeDetailsSidebarPanel=class LayerTreeDetailsSidebarPanel extends WebInspector.DOMDetailsSidebarPanel
{constructor()
{super("layer-tree",WebInspector.UIString("Layers"));this._dataGridNodesByLayerId=new Map;this.element.classList.add("layer-tree");}
shown()
{WebInspector.layerTreeManager.addEventListener(WebInspector.LayerTreeManager.Event.LayerTreeDidChange,this._layerTreeDidChange,this);super.shown();}
hidden()
{WebInspector.layerTreeManager.removeEventListener(WebInspector.LayerTreeManager.Event.LayerTreeDidChange,this._layerTreeDidChange,this);super.hidden();}
supportsDOMNode(nodeToInspect)
{return WebInspector.layerTreeManager.supported&&nodeToInspect.nodeType()===Node.ELEMENT_NODE;}
initialLayout()
{super.initialLayout();WebInspector.showShadowDOMSetting.addEventListener(WebInspector.Setting.Event.Changed,this._showShadowDOMSettingChanged,this);this._buildLayerInfoSection();this._buildDataGridSection();this._buildBottomBar();}
layout()
{super.layout();if(!this.domNode)
return;WebInspector.layerTreeManager.layersForNode(this.domNode,(layerForNode,childLayers)=>{this._unfilteredChildLayers=childLayers;this._updateDisplayWithLayers(layerForNode,childLayers);});}
sizeDidChange()
{super.sizeDidChange(); this._childLayersRow.sizeDidChange();}
_layerTreeDidChange(event)
{this.needsLayout();}
_showShadowDOMSettingChanged(event)
{if(this.selected)
this._updateDisplayWithLayers(this._layerForNode,this._unfilteredChildLayers);}
_buildLayerInfoSection()
{var rows=this._layerInfoRows={};var rowsArray=[];rowsArray.push(rows["Width"]=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Width")));rowsArray.push(rows["Height"]=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Height")));rowsArray.push(rows["Paints"]=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Paints")));rowsArray.push(rows["Memory"]=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Memory")));this._layerInfoGroup=new WebInspector.DetailsSectionGroup(rowsArray);var emptyRow=new WebInspector.DetailsSectionRow(WebInspector.UIString("No Layer Available"));emptyRow.showEmptyMessage();this._noLayerInformationGroup=new WebInspector.DetailsSectionGroup([emptyRow]);this._layerInfoSection=new WebInspector.DetailsSection("layer-info",WebInspector.UIString("Layer Info"),[this._noLayerInformationGroup]);this.contentView.element.appendChild(this._layerInfoSection.element);}
_buildDataGridSection()
{var columns={name:{},paintCount:{},memory:{}};columns.name.title=WebInspector.UIString("Node");columns.name.sortable=false;columns.paintCount.title=WebInspector.UIString("Paints");columns.paintCount.sortable=true;columns.paintCount.aligned="right";columns.paintCount.width="50px";columns.memory.title=WebInspector.UIString("Memory");columns.memory.sortable=true;columns.memory.aligned="right";columns.memory.width="70px";this._dataGrid=new WebInspector.DataGrid(columns);this._dataGrid.inline=true;this._dataGrid.addEventListener(WebInspector.DataGrid.Event.SortChanged,this._sortDataGrid,this);this._dataGrid.addEventListener(WebInspector.DataGrid.Event.SelectedNodeChanged,this._selectedDataGridNodeChanged,this);this._dataGrid.sortColumnIdentifier="memory";this._dataGrid.sortOrder=WebInspector.DataGrid.SortOrder.Descending;this._dataGrid.createSettings("layer-tree-details-sidebar-panel");var element=this._dataGrid.element;element.addEventListener("focus",this._dataGridGainedFocus.bind(this),false);element.addEventListener("blur",this._dataGridLostFocus.bind(this),false);element.addEventListener("click",this._dataGridWasClicked.bind(this),false);this._childLayersRow=new WebInspector.DetailsSectionDataGridRow(null,WebInspector.UIString("No Child Layers"));var group=new WebInspector.DetailsSectionGroup([this._childLayersRow]);var section=new WebInspector.DetailsSection("layer-children",WebInspector.UIString("Child Layers"),[group],null,true);this.contentView.element.appendChild(section.element);}
_buildBottomBar()
{var bottomBar=this.element.appendChild(document.createElement("div"));bottomBar.className="bottom-bar";this._layersCountLabel=bottomBar.appendChild(document.createElement("div"));this._layersCountLabel.className="layers-count-label";this._layersMemoryLabel=bottomBar.appendChild(document.createElement("div"));this._layersMemoryLabel.className="layers-memory-label";}
_sortDataGrid()
{var sortColumnIdentifier=this._dataGrid.sortColumnIdentifier;function comparator(a,b)
{var item1=a.layer[sortColumnIdentifier]||0;var item2=b.layer[sortColumnIdentifier]||0;return item1-item2;}
this._dataGrid.sortNodes(comparator);this._updatePopoverForSelectedNode();}
_selectedDataGridNodeChanged()
{if(this._dataGrid.selectedNode){this._highlightSelectedNode();this._showPopoverForSelectedNode();}else{WebInspector.domTreeManager.hideDOMNodeHighlight();this._hidePopover();}}
_dataGridGainedFocus(event)
{this._highlightSelectedNode();this._showPopoverForSelectedNode();}
_dataGridLostFocus(event)
{WebInspector.domTreeManager.hideDOMNodeHighlight();this._hidePopover();}
_dataGridWasClicked(event)
{if(this._dataGrid.selectedNode&&event.target.parentNode.classList.contains("filler"))
this._dataGrid.selectedNode.deselect();}
_highlightSelectedNode()
{var dataGridNode=this._dataGrid.selectedNode;if(!dataGridNode)
return;var layer=dataGridNode.layer;if(layer.isGeneratedContent||layer.isReflection||layer.isAnonymous)
WebInspector.domTreeManager.highlightRect(layer.bounds,true);else
WebInspector.domTreeManager.highlightDOMNode(layer.nodeId);}
_updateDisplayWithLayers(layerForNode,childLayers)
{if(!WebInspector.showShadowDOMSetting.value){childLayers=childLayers.filter(function(layer){return!layer.isInShadowTree;});}
this._updateLayerInfoSection(layerForNode);this._updateDataGrid(layerForNode,childLayers);this._updateMetrics(layerForNode,childLayers);this._layerForNode=layerForNode;this._childLayers=childLayers;}
_updateLayerInfoSection(layer)
{this._layerInfoSection.groups=layer?[this._layerInfoGroup]:[this._noLayerInformationGroup];if(!layer)
return;this._layerInfoRows["Memory"].value=Number.bytesToString(layer.memory);this._layerInfoRows["Width"].value=layer.compositedBounds.width+"px";this._layerInfoRows["Height"].value=layer.compositedBounds.height+"px";this._layerInfoRows["Paints"].value=layer.paintCount+"";}
_updateDataGrid(layerForNode,childLayers)
{let dataGrid=this._dataGrid;let mutations=WebInspector.layerTreeManager.layerTreeMutations(this._childLayers,childLayers);mutations.removals.forEach(function(layer){let node=this._dataGridNodesByLayerId.get(layer.layerId);if(node){dataGrid.removeChild(node);this._dataGridNodesByLayerId.delete(layer.layerId);}},this);mutations.additions.forEach(function(layer){let node=this._dataGridNodeForLayer(layer);if(node)
dataGrid.appendChild(node);},this);mutations.preserved.forEach(function(layer){let node=this._dataGridNodesByLayerId.get(layer.layerId);if(node)
node.layer=layer;},this);this._sortDataGrid();this._childLayersRow.dataGrid=!isEmptyObject(childLayers)?this._dataGrid:null;}
_dataGridNodeForLayer(layer)
{let node=new WebInspector.LayerTreeDataGridNode(layer);this._dataGridNodesByLayerId.set(layer.layerId,node);return node;}
_updateMetrics(layerForNode,childLayers)
{var layerCount=0;var totalMemory=0;if(layerForNode){layerCount++;totalMemory+=layerForNode.memory||0;}
childLayers.forEach(function(layer){layerCount++;totalMemory+=layer.memory||0;});this._layersCountLabel.textContent=WebInspector.UIString("Layer Count: %d").format(layerCount);this._layersMemoryLabel.textContent=WebInspector.UIString("Memory: %s").format(Number.bytesToString(totalMemory));}
_showPopoverForSelectedNode()
{var dataGridNode=this._dataGrid.selectedNode;if(!dataGridNode)
return;this._contentForPopover(dataGridNode.layer,(content)=>{if(dataGridNode===this._dataGrid.selectedNode)
this._updatePopoverForSelectedNode(content);});}
_updatePopoverForSelectedNode(content)
{var dataGridNode=this._dataGrid.selectedNode;if(!dataGridNode)
return;var popover=this._popover;if(!popover){popover=this._popover=new WebInspector.Popover;popover.windowResizeHandler=()=>{this._updatePopoverForSelectedNode();};}
var targetFrame=WebInspector.Rect.rectFromClientRect(dataGridNode.element.getBoundingClientRect());if(content)
popover.content=content;popover.present(targetFrame.pad(2),[WebInspector.RectEdge.MIN_X]);}
_hidePopover()
{if(this._popover)
this._popover.dismiss();}
_contentForPopover(layer,callback)
{var content=document.createElement("div");content.className="layer-tree-popover";content.appendChild(document.createElement("p")).textContent=WebInspector.UIString("Reasons for compositing:");var list=content.appendChild(document.createElement("ul"));WebInspector.layerTreeManager.reasonsForCompositingLayer(layer,(compositingReasons)=>{if(isEmptyObject(compositingReasons)){callback(content);return;}
this._populateListOfCompositingReasons(list,compositingReasons);callback(content);});return content;}
_populateListOfCompositingReasons(list,compositingReasons)
{function addReason(reason)
{list.appendChild(document.createElement("li")).textContent=reason;}
if(compositingReasons.transform3D)
addReason(WebInspector.UIString("Element has a 3D transform"));if(compositingReasons.video)
addReason(WebInspector.UIString("Element is <video>"));if(compositingReasons.canvas)
addReason(WebInspector.UIString("Element is <canvas>"));if(compositingReasons.plugin)
addReason(WebInspector.UIString("Element is a plug-in"));if(compositingReasons.iFrame)
addReason(WebInspector.UIString("Element is <iframe>"));if(compositingReasons.backfaceVisibilityHidden)
addReason(WebInspector.UIString("Element has “backface-visibility: hidden” style"));if(compositingReasons.clipsCompositingDescendants)
addReason(WebInspector.UIString("Element clips compositing descendants"));if(compositingReasons.animation)
addReason(WebInspector.UIString("Element is animated"));if(compositingReasons.filters)
addReason(WebInspector.UIString("Element has CSS filters applied"));if(compositingReasons.positionFixed)
addReason(WebInspector.UIString("Element has “position: fixed” style"));if(compositingReasons.positionSticky)
addReason(WebInspector.UIString("Element has “position: sticky” style"));if(compositingReasons.overflowScrollingTouch)
addReason(WebInspector.UIString("Element has “-webkit-overflow-scrolling: touch” style"));if(compositingReasons.stacking)
addReason(WebInspector.UIString("Element may overlap another compositing element"));if(compositingReasons.overlap)
addReason(WebInspector.UIString("Element overlaps other compositing element"));if(compositingReasons.negativeZIndexChildren)
addReason(WebInspector.UIString("Element has children with a negative z-index"));if(compositingReasons.transformWithCompositedDescendants)
addReason(WebInspector.UIString("Element has a 2D transform and composited descendants"));if(compositingReasons.opacityWithCompositedDescendants)
addReason(WebInspector.UIString("Element has opacity applied and composited descendants"));if(compositingReasons.maskWithCompositedDescendants)
addReason(WebInspector.UIString("Element is masked and composited descendants"));if(compositingReasons.reflectionWithCompositedDescendants)
addReason(WebInspector.UIString("Element has a reflection and composited descendants"));if(compositingReasons.filterWithCompositedDescendants)
addReason(WebInspector.UIString("Element has CSS filters applied and composited descendants"));if(compositingReasons.blendingWithCompositedDescendants)
addReason(WebInspector.UIString("Element has CSS blending applied and composited descendants"));if(compositingReasons.isolatesCompositedBlendingDescendants)
addReason(WebInspector.UIString("Element is a stacking context and has composited descendants with CSS blending applied"));if(compositingReasons.perspective)
addReason(WebInspector.UIString("Element has perspective applied"));if(compositingReasons.preserve3D)
addReason(WebInspector.UIString("Element has “transform-style: preserve-3d” style"));if(compositingReasons.willChange)
addReason(WebInspector.UIString("Element has “will-change” style with includes opacity, transform, transform-style, perspective, filter or backdrop-filter"));if(compositingReasons.root)
addReason(WebInspector.UIString("Element is the root element"));if(compositingReasons.blending)
addReason(WebInspector.UIString("Element has “blend-mode” style"));}};WebInspector.LayoutTimelineDataGrid=class LayoutTimelineDataGrid extends WebInspector.TimelineDataGrid
{ callFramePopoverAnchorElement()
{return this.selectedNode.elementWithColumnIdentifier("location");}};WebInspector.LayoutTimelineDataGridNode=class LayoutTimelineDataGridNode extends WebInspector.TimelineDataGridNode
{constructor(layoutTimelineRecord,baseStartTime)
{super(false,null);this._record=layoutTimelineRecord;this._baseStartTime=baseStartTime||0;}
get records()
{return[this._record];}
get data()
{if(!this._cachedData){this._cachedData={type:this._record.eventType,name:this.displayName(),width:this._record.width,height:this._record.height,area:this._record.width*this._record.height,startTime:this._record.startTime,totalTime:this._record.duration,location:this._record.initiatorCallFrame,};}
return this._cachedData;}
createCellContent(columnIdentifier,cell)
{var value=this.data[columnIdentifier];switch(columnIdentifier){case"name":cell.classList.add(...this.iconClassNames());return value;case"width":case"height":return isNaN(value)?emDash:WebInspector.UIString("%dpx").format(value);case"area":return isNaN(value)?emDash:WebInspector.UIString("%dpx²").format(value);case"startTime":return isNaN(value)?emDash:Number.secondsToString(value-this._baseStartTime,true);case"totalTime":return isNaN(value)?emDash:Number.secondsToString(value,true);}
return super.createCellContent(columnIdentifier,cell);}};WebInspector.LayoutTimelineOverviewGraph=class LayoutTimelineOverviewGraph extends WebInspector.TimelineOverviewGraph
{constructor(timeline,timelineOverview)
{super(timelineOverview);this.element.classList.add("layout");this._layoutTimeline=timeline;this._layoutTimeline.addEventListener(WebInspector.Timeline.Event.RecordAdded,this._layoutTimelineRecordAdded,this);this.reset();}
reset()
{super.reset();function createRecordRow()
{var element=document.createElement("div");element.className="graph-row";this.element.appendChild(element);return{element,recordBars:[],records:[]};}
this.element.removeChildren();this._timelineLayoutRecordRow=createRecordRow.call(this);this._timelinePaintRecordRow=createRecordRow.call(this);}
layout()
{if(!this.visible)
return;this._updateRowLayout(this._timelinePaintRecordRow);this._updateRowLayout(this._timelineLayoutRecordRow);}
_updateRowLayout(row)
{var secondsPerPixel=this.timelineOverview.secondsPerPixel;var recordBarIndex=0;function createBar(records,renderMode)
{var timelineRecordBar=row.recordBars[recordBarIndex];if(!timelineRecordBar)
timelineRecordBar=row.recordBars[recordBarIndex]=new WebInspector.TimelineRecordBar(records,renderMode);else{timelineRecordBar.renderMode=renderMode;timelineRecordBar.records=records;}
timelineRecordBar.refresh(this);if(!timelineRecordBar.element.parentNode)
row.element.appendChild(timelineRecordBar.element);++recordBarIndex;}
WebInspector.TimelineRecordBar.createCombinedBars(row.records,secondsPerPixel,this,createBar.bind(this));for(;recordBarIndex<row.recordBars.length;++recordBarIndex){row.recordBars[recordBarIndex].records=null;row.recordBars[recordBarIndex].element.remove();}}
_layoutTimelineRecordAdded(event)
{var layoutTimelineRecord=event.data.record;if(layoutTimelineRecord.eventType===WebInspector.LayoutTimelineRecord.EventType.Paint||layoutTimelineRecord.eventType===WebInspector.LayoutTimelineRecord.EventType.Composite)
this._timelinePaintRecordRow.records.push(layoutTimelineRecord);else
this._timelineLayoutRecordRow.records.push(layoutTimelineRecord);this.needsLayout();}};WebInspector.LayoutTimelineView=class LayoutTimelineView extends WebInspector.TimelineView
{constructor(timeline,extraArguments)
{super(timeline,extraArguments);let columns={type:{},name:{},location:{},area:{},width:{},height:{},startTime:{},totalTime:{}};columns.name.title=WebInspector.UIString("Type");columns.name.width="15%";var typeToLabelMap=new Map;for(var key in WebInspector.LayoutTimelineRecord.EventType){var value=WebInspector.LayoutTimelineRecord.EventType[key];typeToLabelMap.set(value,WebInspector.LayoutTimelineRecord.displayNameForEventType(value));}
columns.type.scopeBar=WebInspector.TimelineDataGrid.createColumnScopeBar("layout",typeToLabelMap);columns.type.hidden=true;columns.type.locked=true;columns.name.disclosure=true;columns.name.icon=true;columns.name.locked=true;this._scopeBar=columns.type.scopeBar;columns.location.title=WebInspector.UIString("Initiator");columns.location.width="25%";columns.area.title=WebInspector.UIString("Area");columns.area.width="8%";columns.width.title=WebInspector.UIString("Width");columns.width.width="8%";columns.height.title=WebInspector.UIString("Height");columns.height.width="8%";columns.startTime.title=WebInspector.UIString("Start Time");columns.startTime.width="8%";columns.startTime.aligned="right";columns.totalTime.title=WebInspector.UIString("Duration");columns.totalTime.width="8%";columns.totalTime.aligned="right";for(var column in columns)
columns[column].sortable=true;this._dataGrid=new WebInspector.LayoutTimelineDataGrid(columns);this._dataGrid.addEventListener(WebInspector.DataGrid.Event.SelectedNodeChanged,this._dataGridSelectedNodeChanged,this);this.setupDataGrid(this._dataGrid);this._dataGrid.sortColumnIdentifier="startTime";this._dataGrid.sortOrder=WebInspector.DataGrid.SortOrder.Ascending;this._dataGrid.createSettings("layout-timeline-view");this._hoveredTreeElement=null;this._hoveredDataGridNode=null;this._showingHighlight=false;this._showingHighlightForRecord=null;this._dataGrid.element.addEventListener("mouseover",this._mouseOverDataGrid.bind(this));this._dataGrid.element.addEventListener("mouseleave",this._mouseLeaveDataGrid.bind(this));this.element.classList.add("layout");this.addSubview(this._dataGrid);timeline.addEventListener(WebInspector.Timeline.Event.RecordAdded,this._layoutTimelineRecordAdded,this);this._pendingRecords=[];}
get selectionPathComponents()
{let dataGridNode=this._dataGrid.selectedNode;if(!dataGridNode||dataGridNode.hidden)
return null;let pathComponents=[];while(dataGridNode&&!dataGridNode.root){if(dataGridNode.hidden)
return null;let pathComponent=new WebInspector.TimelineDataGridNodePathComponent(dataGridNode);pathComponent.addEventListener(WebInspector.HierarchicalPathComponent.Event.SiblingWasSelected,this.dataGridNodePathComponentSelected,this);pathComponents.unshift(pathComponent);dataGridNode=dataGridNode.parent;}
return pathComponents;}
shown()
{super.shown();this._updateHighlight();this._dataGrid.shown();}
hidden()
{this._hideHighlightIfNeeded();this._dataGrid.hidden();super.hidden();}
closed()
{this.representedObject.removeEventListener(null,null,this);this._dataGrid.closed();}
reset()
{super.reset();this._hideHighlightIfNeeded();this._dataGrid.reset();this._pendingRecords=[];}
dataGridNodePathComponentSelected(event)
{let dataGridNode=event.data.pathComponent.timelineDataGridNode;dataGridNode.revealAndSelect();}
filterDidChange()
{super.filterDidChange();this._updateHighlight();}
treeElementSelected(treeElement,selectedByUser)
{if(this._dataGrid.shouldIgnoreSelectionEvent())
return;super.treeElementSelected(treeElement,selectedByUser);this._updateHighlight();}
layout()
{this._processPendingRecords();}
_processPendingRecords()
{if(!this._pendingRecords.length)
return;for(var layoutTimelineRecord of this._pendingRecords){let dataGridNode=new WebInspector.LayoutTimelineDataGridNode(layoutTimelineRecord,this.zeroTime);this._dataGrid.addRowInSortOrder(null,dataGridNode);let stack=[{children:layoutTimelineRecord.children,parentDataGridNode:dataGridNode,index:0}];while(stack.length){let entry=stack.lastValue;if(entry.index>=entry.children.length){stack.pop();continue;}
let childRecord=entry.children[entry.index];let childDataGridNode=new WebInspector.LayoutTimelineDataGridNode(childRecord,this.zeroTime);this._dataGrid.addRowInSortOrder(null,childDataGridNode,entry.parentDataGridNode);if(childDataGridNode&&childRecord.children.length)
stack.push({children:childRecord.children,parentDataGridNode:childDataGridNode,index:0});++entry.index;}}
this._pendingRecords=[];}
_layoutTimelineRecordAdded(event)
{var layoutTimelineRecord=event.data.record;if(layoutTimelineRecord.parent instanceof WebInspector.LayoutTimelineRecord)
return;this._pendingRecords.push(layoutTimelineRecord);this.needsLayout();}
_updateHighlight()
{var record=this._hoveredOrSelectedRecord();if(!record){this._hideHighlightIfNeeded();return;}
this._showHighlightForRecord(record);}
_showHighlightForRecord(record)
{if(this._showingHighlightForRecord===record)
return;this._showingHighlightForRecord=record;const contentColor={r:111,g:168,b:220,a:0.66};const outlineColor={r:255,g:229,b:153,a:0.66};var quad=record.quad;if(quad){DOMAgent.highlightQuad(quad.toProtocol(),contentColor,outlineColor);this._showingHighlight=true;return;}
if(this._showingHighlight){this._showingHighlight=false;DOMAgent.hideHighlight();}}
_hideHighlightIfNeeded()
{this._showingHighlightForRecord=null;if(this._showingHighlight){this._showingHighlight=false;DOMAgent.hideHighlight();}}
_hoveredOrSelectedRecord()
{if(this._hoveredDataGridNode)
return this._hoveredDataGridNode.record;if(this._dataGrid.selectedNode&&this._dataGrid.selectedNode.revealed)
return this._dataGrid.selectedNode.record;return null;}
_mouseOverDataGrid(event)
{var hoveredDataGridNode=this._dataGrid.dataGridNodeFromNode(event.target);if(!hoveredDataGridNode)
return;this._hoveredDataGridNode=hoveredDataGridNode;this._updateHighlight();}
_mouseLeaveDataGrid(event)
{this._hoveredDataGridNode=null;this._updateHighlight();}
_dataGridSelectedNodeChanged(event)
{this._updateHighlight();}};
WebInspector.LineChart=class LineChart
{constructor(size)
{this._element=document.createElement("div");this._element.classList.add("line-chart");this._chartElement=this._element.appendChild(createSVGElement("svg"));this._pathElement=this._chartElement.appendChild(createSVGElement("path"));this._points=[];this.size=size;}
get element(){return this._element;}
get points(){return this._points;}
get size()
{return this._size;}
set size(size)
{this._size=size;this._chartElement.setAttribute("width",size.width);this._chartElement.setAttribute("height",size.height);this._chartElement.setAttribute("viewbox",`0 0 ${size.width} ${size.height}`);}
addPoint(x,y)
{this._points.push({x,y});}
clear()
{this._points=[];}
needsLayout()
{if(this._scheduledLayoutUpdateIdentifier)
return;this._scheduledLayoutUpdateIdentifier=requestAnimationFrame(this.updateLayout.bind(this));}
updateLayout()
{if(this._scheduledLayoutUpdateIdentifier){cancelAnimationFrame(this._scheduledLayoutUpdateIdentifier);this._scheduledLayoutUpdateIdentifier=undefined;}
let pathComponents=[];pathComponents.push(`M 0 ${this._size.height}`);for(let point of this._points)
pathComponents.push(`L ${point.x} ${point.y}`);let lastX=this._points.length?this._points.lastValue.x:0;pathComponents.push(`L ${lastX} ${this._size.height}`);pathComponents.push("Z");let pathString=pathComponents.join(" ");this._pathElement.setAttribute("d",pathString);}};WebInspector.LogContentView=class LogContentView extends WebInspector.ContentView
{constructor(representedObject)
{super(representedObject);this._nestingLevel=0;this._selectedMessages=[];this._provisionalMessages=[];this.element.classList.add("log");this.messagesElement=document.createElement("div");this.messagesElement.classList.add("console-messages");this.messagesElement.tabIndex=0;this.messagesElement.setAttribute("role","log");this.messagesElement.addEventListener("mousedown",this._mousedown.bind(this));this.messagesElement.addEventListener("keydown",this._keyDown.bind(this));this.messagesElement.addEventListener("keypress",this._keyPress.bind(this));this.messagesElement.addEventListener("dragstart",this._ondragstart.bind(this),true);this.element.appendChild(this.messagesElement);this.prompt=WebInspector.quickConsole.prompt;this._keyboardShortcutCommandA=new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl,"A");this._keyboardShortcutEsc=new WebInspector.KeyboardShortcut(null,WebInspector.KeyboardShortcut.Key.Escape);this._logViewController=new WebInspector.JavaScriptLogViewController(this.messagesElement,this.element,this.prompt,this,"console-prompt-history");this._lastMessageView=null;const fixed=true;this._findBanner=new WebInspector.FindBanner(this,"console-find-banner",fixed);this._findBanner.inputField.placeholder=WebInspector.UIString("Filter Console Log");this._findBanner.targetElement=this.element;this._currentSearchQuery="";this._searchMatches=[];this._selectedSearchMatch=null;this._selectedSearchMatchIsValid=false;var scopeBarItems=[new WebInspector.ScopeBarItem(WebInspector.LogContentView.Scopes.All,WebInspector.UIString("All"),true),new WebInspector.ScopeBarItem(WebInspector.LogContentView.Scopes.Errors,WebInspector.UIString("Errors"),false,"errors"),new WebInspector.ScopeBarItem(WebInspector.LogContentView.Scopes.Warnings,WebInspector.UIString("Warnings"),false,"warnings"),new WebInspector.ScopeBarItem(WebInspector.LogContentView.Scopes.Logs,WebInspector.UIString("Logs"),false,"logs")];this._scopeBar=new WebInspector.ScopeBar("log-scope-bar",scopeBarItems,scopeBarItems[0]);this._scopeBar.addEventListener(WebInspector.ScopeBar.Event.SelectionChanged,this._scopeBarSelectionDidChange,this);this._garbageCollectNavigationItem=new WebInspector.ButtonNavigationItem("clear-log",WebInspector.UIString("Collect garbage"),"Images/NavigationItemGarbageCollect.svg",16,16);this._garbageCollectNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,this._garbageCollect,this);this._clearLogNavigationItem=new WebInspector.ButtonNavigationItem("clear-log",WebInspector.UIString("Clear log (%s or %s)").format(WebInspector.clearKeyboardShortcut.displayName,this._logViewController.messagesAlternateClearKeyboardShortcut.displayName),"Images/NavigationItemClear.svg",16,16);this._clearLogNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,this._clearLog,this);this._showConsoleTabNavigationItem=new WebInspector.ButtonNavigationItem("show-tab",WebInspector.UIString("Show Console tab"),"Images/SplitToggleUp.svg",16,16);this._showConsoleTabNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,this._showConsoleTab,this);this.messagesElement.addEventListener("contextmenu",this._handleContextMenuEvent.bind(this),false);WebInspector.logManager.addEventListener(WebInspector.LogManager.Event.SessionStarted,this._sessionStarted,this);WebInspector.logManager.addEventListener(WebInspector.LogManager.Event.MessageAdded,this._messageAdded,this);WebInspector.logManager.addEventListener(WebInspector.LogManager.Event.PreviousMessageRepeatCountUpdated,this._previousMessageRepeatCountUpdated,this);WebInspector.logManager.addEventListener(WebInspector.LogManager.Event.Cleared,this._logCleared,this);WebInspector.Frame.addEventListener(WebInspector.Frame.Event.ProvisionalLoadStarted,this._provisionalLoadStarted,this);}
get navigationItems()
{let navigationItems=[this._scopeBar];if(HeapAgent.gc)
navigationItems.push(this._garbageCollectNavigationItem);navigationItems.push(this._clearLogNavigationItem);if(WebInspector.isShowingSplitConsole())
navigationItems.push(this._showConsoleTabNavigationItem);else if(WebInspector.isShowingConsoleTab())
navigationItems.unshift(this._findBanner);return navigationItems;}
get scopeBar()
{return this._scopeBar;}
get logViewController()
{return this._logViewController;}
get scrollableElements()
{return[this.element];}
get shouldKeepElementsScrolledToBottom()
{return true;}
shown()
{super.shown();this._logViewController.renderPendingMessages();}
didAppendConsoleMessageView(messageView)
{var type=messageView instanceof WebInspector.ConsoleCommandView?null:messageView.message.type;if(this._nestingLevel&&type!==WebInspector.ConsoleMessage.MessageType.EndGroup){var x=16*this._nestingLevel;var messageElement=messageView.element;messageElement.style.left=x+"px";messageElement.style.width="calc(100% - "+x+"px)";}
switch(type){case WebInspector.ConsoleMessage.MessageType.StartGroup:case WebInspector.ConsoleMessage.MessageType.StartGroupCollapsed:++this._nestingLevel;break;case WebInspector.ConsoleMessage.MessageType.EndGroup:if(this._nestingLevel>0)
--this._nestingLevel;break;}
this._clearFocusableChildren();let target=messageView.message?messageView.message.target:WebInspector.runtimeManager.activeExecutionContext.target;target.connection.runAfterPendingDispatches(this._clearFocusableChildren.bind(this));if(type&&type!==WebInspector.ConsoleMessage.MessageType.EndGroup){if(!(messageView.message instanceof WebInspector.ConsoleCommandResultMessage))
this._markScopeBarItemUnread(messageView.message.level);this._filterMessageElements([messageView.element]);}}
get supportsSearch(){return true;}
get numberOfSearchResults(){return this.hasPerformedSearch?this._searchMatches.length:null;}
get hasPerformedSearch(){return this._currentSearchQuery!=="";}
get supportsCustomFindBanner()
{return WebInspector.isShowingConsoleTab();}
showCustomFindBanner()
{if(!this.visible)
return;this._findBanner.focus();}
get supportsSave()
{if(!this.visible)
return false;if(WebInspector.isShowingSplitConsole())
return false;return true;}
get saveData()
{return{url:"web-inspector:///Console.txt",content:this._formatMessagesAsData(false),forceSaveAs:true};}
handleCopyEvent(event)
{if(!this._selectedMessages.length)
return;event.clipboardData.setData("text/plain",this._formatMessagesAsData(true));event.stopPropagation();event.preventDefault();}
handleClearShortcut(event)
{this._logViewController.requestClearMessages();}
findBannerRevealPreviousResult()
{this.highlightPreviousSearchMatch();}
highlightPreviousSearchMatch()
{if(!this.hasPerformedSearch||isEmptyObject(this._searchMatches))
return;var index=this._selectedSearchMatch?this._searchMatches.indexOf(this._selectedSearchMatch):this._searchMatches.length;this._highlightSearchMatchAtIndex(index-1);}
findBannerRevealNextResult()
{this.highlightNextSearchMatch();}
highlightNextSearchMatch()
{if(!this.hasPerformedSearch||isEmptyObject(this._searchMatches))
return;var index=this._selectedSearchMatch?this._searchMatches.indexOf(this._selectedSearchMatch)+1:0;this._highlightSearchMatchAtIndex(index);}
findBannerWantsToClearAndBlur(findBanner)
{if(this._selectedMessages.length)
this.messagesElement.focus();else
this.prompt.focus();}
layout()
{this._scrollElementHeight=this.messagesElement.getBoundingClientRect().height;}
_formatMessagesAsData(onlySelected)
{var messages=this._allMessageElements();if(onlySelected){messages=messages.filter(function(message){return message.classList.contains(WebInspector.LogContentView.SelectedStyleClassName);});}
var data="";var isPrefixOptional=messages.length<=1&&onlySelected;messages.forEach(function(messageElement,index){var messageView=messageElement.__messageView||messageElement.__commandView;if(!messageView)
return;if(index>0)
data+="\n";data+=messageView.toClipboardString(isPrefixOptional);});return data;}
_sessionStarted(event)
{if(WebInspector.settings.clearLogOnNavigate.value){this._reappendProvisionalMessages();return;}
const isFirstSession=false;const newSessionReason=event.data.wasReloaded?WebInspector.ConsoleSession.NewSessionReason.PageReloaded:WebInspector.ConsoleSession.NewSessionReason.PageNavigated;this._logViewController.startNewSession(isFirstSession,{newSessionReason,timestamp:event.data.timestamp});this._clearProvisionalState();}
_scopeFromMessageLevel(level)
{var messageLevel;switch(level){case WebInspector.ConsoleMessage.MessageLevel.Warning:messageLevel=WebInspector.LogContentView.Scopes.Warnings;break;case WebInspector.ConsoleMessage.MessageLevel.Error:messageLevel=WebInspector.LogContentView.Scopes.Errors;break;case WebInspector.ConsoleMessage.MessageLevel.Log:case WebInspector.ConsoleMessage.MessageLevel.Info:case WebInspector.ConsoleMessage.MessageLevel.Debug:messageLevel=WebInspector.LogContentView.Scopes.Logs;break;}
return messageLevel;}
_markScopeBarItemUnread(level)
{let messageLevel=this._scopeFromMessageLevel(level);if(!messageLevel)
return;let item=this._scopeBar.item(messageLevel);if(item&&!item.selected&&!this._scopeBar.item(WebInspector.LogContentView.Scopes.All).selected)
item.element.classList.add("unread");}
_messageAdded(event)
{if(this._startedProvisionalLoad)
this._provisionalMessages.push(event.data.message);this._logViewController.appendConsoleMessage(event.data.message);}
_previousMessageRepeatCountUpdated(event)
{if(this._logViewController.updatePreviousMessageRepeatCount(event.data.count)&&this._lastMessageView)
this._markScopeBarItemUnread(this._lastMessageView.message.level);}
_handleContextMenuEvent(event)
{if(!window.getSelection().isCollapsed){
return;}
if(this._selectedMessages.length&&!this._selectedMessages.some(element=>event.target.isSelfOrDescendant(element))){this._clearMessagesSelection();this._mousedown(event);}
if(!this._selectedMessages.length)
this._mouseup(event);if(event.target.enclosingNodeOrSelfWithNodeName("a"))
return;let contextMenu=WebInspector.ContextMenu.createFromEvent(event);if(this._selectedMessages.length){contextMenu.appendItem(WebInspector.UIString("Copy Selected"),()=>{InspectorFrontendHost.copyText(this._formatMessagesAsData(true));});contextMenu.appendItem(WebInspector.UIString("Save Selected"),()=>{const forceSaveAs=true;WebInspector.saveDataToFile({url:"web-inspector:///Console.txt",content:this._formatMessagesAsData(true),},forceSaveAs);});contextMenu.appendSeparator();}
contextMenu.appendItem(WebInspector.UIString("Clear Log"),this._clearLog.bind(this));contextMenu.appendSeparator();}
_mousedown(event)
{if(this._selectedMessages.length&&(event.button!==0||event.ctrlKey))
return;if(event.defaultPrevented){
this._clearMessagesSelection();return;}
this._mouseDownWrapper=event.target.enclosingNodeOrSelfWithClass(WebInspector.LogContentView.ItemWrapperStyleClassName);this._mouseDownShiftKey=event.shiftKey;this._mouseDownCommandKey=event.metaKey;this._mouseMoveIsRowSelection=false;window.addEventListener("mousemove",this);window.addEventListener("mouseup",this);}
_targetInMessageCanBeSelected(target,message)
{if(target.enclosingNodeOrSelfWithNodeName("a"))
return false;return true;}
_mousemove(event)
{var selection=window.getSelection();var wrapper=event.target.enclosingNodeOrSelfWithClass(WebInspector.LogContentView.ItemWrapperStyleClassName);if(!wrapper){if(!selection.isCollapsed){wrapper=selection.focusNode.parentNode.enclosingNodeOrSelfWithClass(WebInspector.LogContentView.ItemWrapperStyleClassName);selection.removeAllRanges();}
if(!wrapper)
return;}
if(!selection.isCollapsed)
this._clearMessagesSelection();if(wrapper===this._mouseDownWrapper&&!this._mouseMoveIsRowSelection)
return;selection.removeAllRanges();if(!this._mouseMoveIsRowSelection)
this._updateMessagesSelection(this._mouseDownWrapper,this._mouseDownCommandKey,this._mouseDownShiftKey,false);this._updateMessagesSelection(wrapper,false,true,false);this._mouseMoveIsRowSelection=true;event.preventDefault();event.stopPropagation();}
_mouseup(event)
{window.removeEventListener("mousemove",this);window.removeEventListener("mouseup",this);var selection=window.getSelection();var wrapper=event.target.enclosingNodeOrSelfWithClass(WebInspector.LogContentView.ItemWrapperStyleClassName);if(wrapper&&(selection.isCollapsed||event.shiftKey)){selection.removeAllRanges();if(this._targetInMessageCanBeSelected(event.target,wrapper)){var sameWrapper=wrapper===this._mouseDownWrapper;this._updateMessagesSelection(wrapper,sameWrapper?this._mouseDownCommandKey:false,sameWrapper?this._mouseDownShiftKey:true,false);}}else if(!selection.isCollapsed){this._clearMessagesSelection();}else if(!this._mouseDownWrapper){this._clearMessagesSelection();setTimeout(()=>{this.prompt.focus();},0);}
delete this._mouseMoveIsRowSelection;delete this._mouseDownWrapper;delete this._mouseDownShiftKey;delete this._mouseDownCommandKey;}
_ondragstart(event)
{if(event.target.enclosingNodeOrSelfWithClass(WebInspector.DOMTreeOutline.StyleClassName)){event.stopPropagation();event.preventDefault();}}
handleEvent(event)
{switch(event.type){case"mousemove":this._mousemove(event);break;case"mouseup":this._mouseup(event);break;}}
_updateMessagesSelection(message,multipleSelection,rangeSelection,shouldScrollIntoView)
{if(!message)
return;var alreadySelectedMessage=this._selectedMessages.includes(message);if(alreadySelectedMessage&&this._selectedMessages.length&&multipleSelection){message.classList.remove(WebInspector.LogContentView.SelectedStyleClassName);this._selectedMessages.remove(message);return;}
if(!multipleSelection&&!rangeSelection)
this._clearMessagesSelection();if(rangeSelection){var messages=this._visibleMessageElements();var refIndex=this._referenceMessageForRangeSelection?messages.indexOf(this._referenceMessageForRangeSelection):0;var targetIndex=messages.indexOf(message);var newRange=[Math.min(refIndex,targetIndex),Math.max(refIndex,targetIndex)];if(this._selectionRange&&this._selectionRange[0]===newRange[0]&&this._selectionRange[1]===newRange[1])
return;var startIndex=this._selectionRange?Math.min(this._selectionRange[0],newRange[0]):newRange[0];var endIndex=this._selectionRange?Math.max(this._selectionRange[1],newRange[1]):newRange[1];for(var i=startIndex;i<=endIndex;++i){var messageInRange=messages[i];if(i>=newRange[0]&&i<=newRange[1]&&!messageInRange.classList.contains(WebInspector.LogContentView.SelectedStyleClassName)){messageInRange.classList.add(WebInspector.LogContentView.SelectedStyleClassName);this._selectedMessages.push(messageInRange);}else if(i<newRange[0]||i>newRange[1]&&messageInRange.classList.contains(WebInspector.LogContentView.SelectedStyleClassName)){messageInRange.classList.remove(WebInspector.LogContentView.SelectedStyleClassName);this._selectedMessages.remove(messageInRange);}}
this._selectionRange=newRange;}else{message.classList.add(WebInspector.LogContentView.SelectedStyleClassName);this._selectedMessages.push(message);}
if(!rangeSelection)
this._referenceMessageForRangeSelection=message;if(shouldScrollIntoView&&!alreadySelectedMessage)
this._ensureMessageIsVisible(this._selectedMessages.lastValue);}
_ensureMessageIsVisible(message)
{if(!message)
return;var y=this._positionForMessage(message).y;if(y<0){this.element.scrollTop+=y;return;}
var nextMessage=this._nextMessage(message);if(nextMessage){y=this._positionForMessage(nextMessage).y;if(y>this._scrollElementHeight)
this.element.scrollTop+=y-this._scrollElementHeight;}else{y+=message.getBoundingClientRect().height;if(y>this._scrollElementHeight)
this.element.scrollTop+=y-this._scrollElementHeight;}}
_positionForMessage(message)
{var pagePoint=window.webkitConvertPointFromNodeToPage(message,new WebKitPoint(0,0));return window.webkitConvertPointFromPageToNode(this.element,pagePoint);}
_isMessageVisible(message)
{var node=message;if(node.classList.contains(WebInspector.LogContentView.FilteredOutStyleClassName))
return false;if(this.hasPerformedSearch&&node.classList.contains(WebInspector.LogContentView.FilteredOutBySearchStyleClassName))
return false;if(message.classList.contains("console-group-title"))
node=node.parentNode.parentNode;while(node&&node!==this.messagesElement){if(node.classList.contains("collapsed"))
return false;node=node.parentNode;}
return true;}
_isMessageSelected(message)
{return message.classList.contains(WebInspector.LogContentView.SelectedStyleClassName);}
_clearMessagesSelection()
{this._selectedMessages.forEach(function(message){message.classList.remove(WebInspector.LogContentView.SelectedStyleClassName);});this._selectedMessages=[];delete this._referenceMessageForRangeSelection;}
_selectAllMessages()
{this._clearMessagesSelection();var messages=this._visibleMessageElements();for(var i=0;i<messages.length;++i){var message=messages[i];message.classList.add(WebInspector.LogContentView.SelectedStyleClassName);this._selectedMessages.push(message);}}
_allMessageElements()
{return Array.from(this.messagesElement.querySelectorAll(".console-message, .console-user-command"));}
_unfilteredMessageElements()
{return this._allMessageElements().filter(function(message){return!message.classList.contains(WebInspector.LogContentView.FilteredOutStyleClassName);});}
_visibleMessageElements()
{var unfilteredMessages=this._unfilteredMessageElements();if(!this.hasPerformedSearch)
return unfilteredMessages;return unfilteredMessages.filter(function(message){return!message.classList.contains(WebInspector.LogContentView.FilteredOutBySearchStyleClassName);});}
_logCleared(event)
{for(let item of this._scopeBar.items)
item.element.classList.remove("unread");this._logViewController.clear();this._nestingLevel=0;if(this._currentSearchQuery)
this.performSearch(this._currentSearchQuery);}
_showConsoleTab()
{WebInspector.showConsoleTab();}
_clearLog()
{WebInspector.logManager.requestClearMessages();}
_garbageCollect()
{for(let target of WebInspector.targets){if(target.HeapAgent)
target.HeapAgent.gc();}}
_scopeBarSelectionDidChange(event)
{var item=this._scopeBar.selectedItems[0];if(item.id===WebInspector.LogContentView.Scopes.All){for(var item of this._scopeBar.items)
item.element.classList.remove("unread");}else
item.element.classList.remove("unread");this._filterMessageElements(this._allMessageElements());}
_filterMessageElements(messageElements)
{var showsAll=this._scopeBar.item(WebInspector.LogContentView.Scopes.All).selected;messageElements.forEach(function(messageElement){var visible=showsAll||messageElement.__commandView instanceof WebInspector.ConsoleCommandView||messageElement.__message instanceof WebInspector.ConsoleCommandResultMessage;if(!visible){var messageLevel=this._scopeFromMessageLevel(messageElement.__message.level);if(messageLevel)
visible=this._scopeBar.item(messageLevel).selected;}
var classList=messageElement.classList;if(visible)
classList.remove(WebInspector.LogContentView.FilteredOutStyleClassName);else{this._selectedMessages.remove(messageElement);classList.remove(WebInspector.LogContentView.SelectedStyleClassName);classList.add(WebInspector.LogContentView.FilteredOutStyleClassName);}},this);this.performSearch(this._currentSearchQuery);}
_keyDown(event)
{let isRTL=WebInspector.resolvedLayoutDirection()===WebInspector.LayoutDirection.RTL;if(this._keyboardShortcutCommandA.matchesEvent(event))
this._commandAWasPressed(event);else if(this._keyboardShortcutEsc.matchesEvent(event))
this._escapeWasPressed(event);else if(event.keyIdentifier==="Up")
this._upArrowWasPressed(event);else if(event.keyIdentifier==="Down")
this._downArrowWasPressed(event);else if((!isRTL&&event.keyIdentifier==="Left")||(isRTL&&event.keyIdentifier==="Right"))
this._leftArrowWasPressed(event);else if((!isRTL&&event.keyIdentifier==="Right")||(isRTL&&event.keyIdentifier==="Left"))
this._rightArrowWasPressed(event);else if(event.keyIdentifier==="Enter"&&event.metaKey)
this._commandEnterWasPressed(event);}
_keyPress(event)
{const isCommandC=event.metaKey&&event.keyCode===99;if(!isCommandC)
this.prompt.focus();}
_commandAWasPressed(event)
{this._selectAllMessages();event.preventDefault();}
_escapeWasPressed(event)
{if(this._selectedMessages.length)
this._clearMessagesSelection();else
this.prompt.focus();event.preventDefault();}
_upArrowWasPressed(event)
{var messages=this._visibleMessageElements();if(!this._selectedMessages.length){if(messages.length)
this._updateMessagesSelection(messages.lastValue,false,false,true);return;}
var lastMessage=this._selectedMessages.lastValue;var previousMessage=this._previousMessage(lastMessage);if(previousMessage)
this._updateMessagesSelection(previousMessage,false,event.shiftKey,true);else if(!event.shiftKey){this._clearMessagesSelection();this._updateMessagesSelection(messages[0],false,false,true);}
event.preventDefault();}
_downArrowWasPressed(event)
{var messages=this._visibleMessageElements();if(!this._selectedMessages.length){if(messages.length)
this._updateMessagesSelection(messages[0],false,false,true);return;}
var lastMessage=this._selectedMessages.lastValue;var nextMessage=this._nextMessage(lastMessage);if(nextMessage)
this._updateMessagesSelection(nextMessage,false,event.shiftKey,true);else if(!event.shiftKey){this._clearMessagesSelection();this._updateMessagesSelection(messages.lastValue,false,false,true);}
event.preventDefault();}
_leftArrowWasPressed(event)
{if(this._selectedMessages.length!==1)
return;var currentMessage=this._selectedMessages[0];if(currentMessage.classList.contains("console-group-title")){currentMessage.parentNode.classList.add("collapsed");event.preventDefault();}else if(currentMessage.__messageView&&currentMessage.__messageView.expandable){currentMessage.__messageView.collapse();event.preventDefault();}}
_rightArrowWasPressed(event)
{if(this._selectedMessages.length!==1)
return;var currentMessage=this._selectedMessages[0];if(currentMessage.classList.contains("console-group-title")){currentMessage.parentNode.classList.remove("collapsed");event.preventDefault();}else if(currentMessage.__messageView&&currentMessage.__messageView.expandable){currentMessage.__messageView.expand();event.preventDefault();}}
_commandEnterWasPressed(event)
{if(this._selectedMessages.length!==1)
return;let message=this._selectedMessages[0];if(message.__commandView&&message.__commandView.commandText){this._logViewController.consolePromptTextCommitted(null,message.__commandView.commandText);event.preventDefault();}}
_previousMessage(message)
{var messages=this._visibleMessageElements();for(var i=messages.indexOf(message)-1;i>=0;--i){if(this._isMessageVisible(messages[i]))
return messages[i];}
return null;}
_nextMessage(message)
{var messages=this._visibleMessageElements();for(var i=messages.indexOf(message)+1;i<messages.length;++i){if(this._isMessageVisible(messages[i]))
return messages[i];}
return null;}
_clearFocusableChildren()
{var focusableElements=this.messagesElement.querySelectorAll("[tabindex]");for(var i=0,count=focusableElements.length;i<count;++i)
focusableElements[i].removeAttribute("tabindex");}
findBannerPerformSearch(findBanner,searchQuery)
{this.performSearch(searchQuery);}
findBannerSearchCleared()
{this.searchCleared();}
revealNextSearchResult()
{this.findBannerRevealNextResult();}
revealPreviousSearchResult()
{this.findBannerRevealPreviousResult();}
performSearch(searchQuery)
{if(!isEmptyObject(this._searchHighlightDOMChanges))
WebInspector.revertDomChanges(this._searchHighlightDOMChanges);this._currentSearchQuery=searchQuery;this._searchHighlightDOMChanges=[];this._searchMatches=[];this._selectedSearchMatchIsValid=false;this._selectedSearchMatch=null;let numberOfResults=0;if(this._currentSearchQuery===""){this.element.classList.remove(WebInspector.LogContentView.SearchInProgressStyleClassName);this.dispatchEventToListeners(WebInspector.ContentView.Event.NumberOfSearchResultsDidChange);return;}
this.element.classList.add(WebInspector.LogContentView.SearchInProgressStyleClassName);let searchRegex=new RegExp(this._currentSearchQuery.escapeForRegExp(),"gi");this._unfilteredMessageElements().forEach(function(message){let matchRanges=[];let text=message.textContent;let match=searchRegex.exec(text);while(match){numberOfResults++;matchRanges.push({offset:match.index,length:match[0].length});match=searchRegex.exec(text);}
if(!isEmptyObject(matchRanges))
this._highlightRanges(message,matchRanges);let classList=message.classList;if(!isEmptyObject(matchRanges)||message.__commandView instanceof WebInspector.ConsoleCommandView||message.__message instanceof WebInspector.ConsoleCommandResultMessage)
classList.remove(WebInspector.LogContentView.FilteredOutBySearchStyleClassName);else
classList.add(WebInspector.LogContentView.FilteredOutBySearchStyleClassName);},this);this.dispatchEventToListeners(WebInspector.ContentView.Event.NumberOfSearchResultsDidChange);this._findBanner.numberOfResults=numberOfResults;if(!this._selectedSearchMatchIsValid&&this._selectedSearchMatch){this._selectedSearchMatch.highlight.classList.remove(WebInspector.LogContentView.SelectedStyleClassName);this._selectedSearchMatch=null;}}
searchCleared()
{this.performSearch("");}
_highlightRanges(message,matchRanges)
{var highlightedElements=WebInspector.highlightRangesWithStyleClass(message,matchRanges,WebInspector.LogContentView.HighlightedStyleClassName,this._searchHighlightDOMChanges);matchRanges.forEach(function(range,index){this._searchMatches.push({message,range,highlight:highlightedElements[index]});if(this._selectedSearchMatch&&!this._selectedSearchMatchIsValid&&this._selectedSearchMatch.message===message){this._selectedSearchMatchIsValid=this._rangesOverlap(this._selectedSearchMatch.range,range);if(this._selectedSearchMatchIsValid){delete this._selectedSearchMatch;this._highlightSearchMatchAtIndex(this._searchMatches.length-1);}}},this);}
_rangesOverlap(range1,range2)
{return range1.offset<=range2.offset+range2.length&&range2.offset<=range1.offset+range1.length;}
_highlightSearchMatchAtIndex(index)
{if(index>=this._searchMatches.length)
index=0;else if(index<0)
index=this._searchMatches.length-1;if(this._selectedSearchMatch)
this._selectedSearchMatch.highlight.classList.remove(WebInspector.LogContentView.SelectedStyleClassName);this._selectedSearchMatch=this._searchMatches[index];this._selectedSearchMatch.highlight.classList.add(WebInspector.LogContentView.SelectedStyleClassName);this._ensureMessageIsVisible(this._selectedSearchMatch.message);}
_provisionalLoadStarted()
{this._startedProvisionalLoad=true;}
_reappendProvisionalMessages()
{if(!this._startedProvisionalLoad)
return;this._startedProvisionalLoad=false;for(let provisionalMessage of this._provisionalMessages)
this._logViewController.appendConsoleMessage(provisionalMessage);this._provisionalMessages=[];}
_clearProvisionalState()
{this._startedProvisionalLoad=false;this._provisionalMessages=[];}};WebInspector.LogContentView.Scopes={All:"log-all",Errors:"log-errors",Warnings:"log-warnings",Logs:"log-logs"};WebInspector.LogContentView.ItemWrapperStyleClassName="console-item";WebInspector.LogContentView.FilteredOutStyleClassName="filtered-out";WebInspector.LogContentView.SelectedStyleClassName="selected";WebInspector.LogContentView.SearchInProgressStyleClassName="search-in-progress";WebInspector.LogContentView.FilteredOutBySearchStyleClassName="filtered-out-by-search";WebInspector.LogContentView.HighlightedStyleClassName="highlighted";WebInspector.MemoryCategoryView=class MemoryCategoryView extends WebInspector.Object
{constructor(category,displayName)
{super();this._category=category;this._element=document.createElement("div");this._element.classList.add("memory-category-view",category);this._detailsElement=this._element.appendChild(document.createElement("div"));this._detailsElement.classList.add("details");let detailsNameElement=this._detailsElement.appendChild(document.createElement("span"));detailsNameElement.classList.add("name");detailsNameElement.textContent=displayName;this._detailsElement.appendChild(document.createElement("br"));this._detailsMaxElement=this._detailsElement.appendChild(document.createElement("span"));this._detailsElement.appendChild(document.createElement("br"));this._detailsMinElement=this._detailsElement.appendChild(document.createElement("span"));this._updateDetails(NaN,NaN);this._graphElement=this._element.appendChild(document.createElement("div"));this._graphElement.classList.add("graph"); let size=new WebInspector.Size(800,75);this._chart=new WebInspector.LineChart(size);this._graphElement.appendChild(this._chart.element);}
get element(){return this._element;}
get category(){return this._category;}
clear()
{this._cachedMinSize=undefined;this._cachedMaxSize=undefined;this._chart.clear();this._chart.needsLayout();}
layoutWithDataPoints(dataPoints,lastTime,minSize,maxSize,xScale,yScale)
{this._updateDetails(minSize,maxSize);this._chart.clear();if(!dataPoints.length)
return;if(!maxSize)
return;let firstX=0;let firstY=yScale(dataPoints[0].size);this._chart.addPoint(firstX,firstY);for(let dataPoint of dataPoints){let x=xScale(dataPoint.time);let y=yScale(dataPoint.size);this._chart.addPoint(x,y);}
let lastDataPoint=dataPoints.lastValue;let lastX=Math.floor(xScale(lastTime));let lastY=yScale(lastDataPoint.size);this._chart.addPoint(lastX,lastY);this._chart.updateLayout();}
_updateDetails(minSize,maxSize)
{if(this._cachedMinSize===minSize&&this._cachedMaxSize===maxSize)
return;this._cachedMinSize=minSize;this._cachedMaxSize=maxSize;this._detailsMaxElement.textContent=WebInspector.UIString("Highest: %s").format(Number.isFinite(maxSize)?Number.bytesToString(maxSize):emDash);this._detailsMinElement.textContent=WebInspector.UIString("Lowest: %s").format(Number.isFinite(minSize)?Number.bytesToString(minSize):emDash);}};WebInspector.MemoryTimelineOverviewGraph=class MemoryTimelineOverviewGraph extends WebInspector.TimelineOverviewGraph
{constructor(timeline,timelineOverview)
{super(timelineOverview);this.element.classList.add("memory");this._memoryTimeline=timeline;this._memoryTimeline.addEventListener(WebInspector.Timeline.Event.RecordAdded,this._memoryTimelineRecordAdded,this);this._memoryTimeline.addEventListener(WebInspector.MemoryTimeline.Event.MemoryPressureEventAdded,this._memoryTimelineMemoryPressureEventAdded,this);this._didInitializeCategories=false;let size=new WebInspector.Size(0,this.height);this._chart=new WebInspector.StackedLineChart(size);this.element.appendChild(this._chart.element);this._legendElement=this.element.appendChild(document.createElement("div"));this._legendElement.classList.add("legend");this._memoryPressureMarkersContainerElement=this.element.appendChild(document.createElement("div"));this._memoryPressureMarkersContainerElement.classList.add("memory-pressure-markers-container");this._memoryPressureMarkerElements=[];this.reset();}
get height()
{return 108;}
reset()
{super.reset();this._maxSize=0;this._cachedMaxSize=undefined;this._updateLegend();this._chart.clear();this._chart.needsLayout();this._memoryPressureMarkersContainerElement.removeChildren();this._memoryPressureMarkerElements=[];}
layout()
{if(!this.visible)
return;this._updateLegend();this._chart.clear();if(!this._didInitializeCategories)
return;let graphWidth=this.timelineOverview.scrollContainerWidth;if(isNaN(graphWidth))
return;if(this._chart.size.width!==graphWidth||this._chart.size.height!==this.height)
this._chart.size=new WebInspector.Size(graphWidth,this.height);let graphStartTime=this.startTime;let visibleEndTime=Math.min(this.endTime,this.currentTime);let secondsPerPixel=this.timelineOverview.secondsPerPixel;let maxCapacity=this._maxSize*1.05;function xScale(time){return(time-graphStartTime)/secondsPerPixel;}
let height=this.height;function yScale(size){return height-((size/maxCapacity)*height);}
let visibleMemoryPressureEventMarkers=this._visibleMemoryPressureEvents(graphStartTime,visibleEndTime);for(let i=0;i<visibleMemoryPressureEventMarkers.length;++i){let markerElement=this._memoryPressureMarkerElements[i];if(!markerElement){markerElement=this._memoryPressureMarkersContainerElement.appendChild(document.createElement("div"));markerElement.classList.add("memory-pressure-event");this._memoryPressureMarkerElements[i]=markerElement;}
let memoryPressureEvent=visibleMemoryPressureEventMarkers[i];let property=WebInspector.resolvedLayoutDirection()===WebInspector.LayoutDirection.RTL?"right":"left";markerElement.style.setProperty(property,`${xScale(memoryPressureEvent.timestamp)}px`);}
let excess=this._memoryPressureMarkerElements.length-visibleMemoryPressureEventMarkers.length;if(excess){let elementsToRemove=this._memoryPressureMarkerElements.splice(visibleMemoryPressureEventMarkers.length);for(let element of elementsToRemove)
element.remove();}
let discontinuities=this.timelineOverview.discontinuitiesInTimeRange(graphStartTime,visibleEndTime);let includeRecordBeforeStart=!discontinuities.length||discontinuities[0].startTime>graphStartTime; let visibleRecords=this._memoryTimeline.recordsInTimeRange(graphStartTime,visibleEndTime,includeRecordBeforeStart);if(!visibleRecords.length)
return;function pointSetForRecord(record){let size=0;let ys=[];for(let i=0;i<record.categories.length;++i){size+=record.categories[i].size;ys[i]=yScale(size);}
return ys;}
if(visibleRecords[0]===this._memoryTimeline.records[0]&&(!discontinuities.length||discontinuities[0].startTime>visibleRecords[0].startTime))
this._chart.addPointSet(0,pointSetForRecord(visibleRecords[0]));function insertDiscontinuity(previousRecord,discontinuity,nextRecord)
{if(!(previousRecord||nextRecord))
return;let xStart=xScale(discontinuity.startTime);let xEnd=xScale(discontinuity.endTime);if(previousRecord)
this._chart.addPointSet(xStart,pointSetForRecord(previousRecord));let zeroValues=Array((previousRecord||nextRecord).categories.length).fill(yScale(0));this._chart.addPointSet(xStart,zeroValues);if(nextRecord){this._chart.addPointSet(xEnd,zeroValues);this._chart.addPointSet(xEnd,pointSetForRecord(nextRecord));}else{
this._chart.addPointSet(xScale(visibleEndTime),zeroValues);}}
let previousRecord=null;for(let record of visibleRecords){if(discontinuities.length&&discontinuities[0].endTime<record.startTime){let discontinuity=discontinuities.shift();insertDiscontinuity.call(this,previousRecord,discontinuity,record);}
let x=xScale(record.startTime);this._chart.addPointSet(x,pointSetForRecord(record));previousRecord=record;}
if(discontinuities.length)
insertDiscontinuity.call(this,previousRecord,discontinuities[0],null);else{let lastRecord=visibleRecords.lastValue;if(lastRecord.startTime<=visibleEndTime){let x=Math.floor(xScale(visibleEndTime));this._chart.addPointSet(x,pointSetForRecord(lastRecord));}}
this._chart.updateLayout();}
_updateLegend()
{if(this._cachedMaxSize===this._maxSize)
return;this._cachedMaxSize=this._maxSize;if(!this._maxSize){this._legendElement.hidden=true;this._legendElement.textContent="";}else{this._legendElement.hidden=false;this._legendElement.textContent=WebInspector.UIString("Maximum Size: %s").format(Number.bytesToString(this._maxSize));}}
_visibleMemoryPressureEvents(startTime,endTime)
{let events=this._memoryTimeline.memoryPressureEvents;if(!events.length)
return[];let lowerIndex=events.lowerBound(startTime,(time,event)=>time-event.timestamp);let upperIndex=events.upperBound(endTime,(time,event)=>time-event.timestamp);return events.slice(lowerIndex,upperIndex);}
_memoryTimelineRecordAdded(event)
{let memoryTimelineRecord=event.data.record;this._maxSize=Math.max(this._maxSize,memoryTimelineRecord.totalSize);if(!this._didInitializeCategories){this._didInitializeCategories=true;let types=[];for(let category of memoryTimelineRecord.categories)
types.push(category.type);this._chart.initializeSections(types);}
this.needsLayout();}
_memoryTimelineMemoryPressureEventAdded(event)
{this.needsLayout();}};WebInspector.MemoryTimelineView=class MemoryTimelineView extends WebInspector.TimelineView
{constructor(timeline,extraArguments)
{super(timeline,extraArguments);this._recording=extraArguments.recording;this.element.classList.add("memory");let contentElement=this.element.appendChild(document.createElement("div"));contentElement.classList.add("content");let overviewElement=contentElement.appendChild(document.createElement("div"));overviewElement.classList.add("overview");function createChartContainer(parentElement,subtitle,tooltip)
{let chartElement=parentElement.appendChild(document.createElement("div"));chartElement.classList.add("chart");let chartSubtitleElement=chartElement.appendChild(document.createElement("div"));chartSubtitleElement.classList.add("subtitle");chartSubtitleElement.textContent=subtitle;chartSubtitleElement.title=tooltip;let chartFlexContainerElement=chartElement.appendChild(document.createElement("div"));chartFlexContainerElement.classList.add("container");return chartFlexContainerElement;}
let usageTooltip=WebInspector.UIString("Breakdown of each memory category at the end of the selected time range");let usageChartContainerElement=createChartContainer(overviewElement,WebInspector.UIString("Breakdown"),usageTooltip);this._usageCircleChart=new WebInspector.CircleChart({size:120,innerRadiusRatio:0.5});usageChartContainerElement.appendChild(this._usageCircleChart.element);this._usageLegendElement=usageChartContainerElement.appendChild(document.createElement("div"));this._usageLegendElement.classList.add("legend","usage");let dividerElement=overviewElement.appendChild(document.createElement("div"));dividerElement.classList.add("divider");let maxComparisonTooltip=WebInspector.UIString("Comparison of total memory size at the end of the selected time range to the maximum memory size in this recording");let maxComparisonChartContainerElement=createChartContainer(overviewElement,WebInspector.UIString("Max Comparison"),maxComparisonTooltip);this._maxComparisonCircleChart=new WebInspector.CircleChart({size:120,innerRadiusRatio:0.5});maxComparisonChartContainerElement.appendChild(this._maxComparisonCircleChart.element);this._maxComparisonLegendElement=maxComparisonChartContainerElement.appendChild(document.createElement("div"));this._maxComparisonLegendElement.classList.add("legend","maximum");let detailsContainerElement=this._detailsContainerElement=contentElement.appendChild(document.createElement("div"));detailsContainerElement.classList.add("details");this._timelineRuler=new WebInspector.TimelineRuler;this.addSubview(this._timelineRuler);detailsContainerElement.appendChild(this._timelineRuler.element);let detailsSubtitleElement=detailsContainerElement.appendChild(document.createElement("div"));detailsSubtitleElement.classList.add("subtitle");detailsSubtitleElement.textContent=WebInspector.UIString("Categories");this._didInitializeCategories=false;this._categoryViews=[];this._usageLegendSizeElementMap=new Map;this._maxSize=0;this._maxComparisonMaximumSizeElement=null;this._maxComparisonCurrentSizeElement=null;timeline.addEventListener(WebInspector.Timeline.Event.RecordAdded,this._memoryTimelineRecordAdded,this);}
static displayNameForCategory(category)
{switch(category){case WebInspector.MemoryCategory.Type.JavaScript:return WebInspector.UIString("JavaScript");case WebInspector.MemoryCategory.Type.Images:return WebInspector.UIString("Images");case WebInspector.MemoryCategory.Type.Layers:return WebInspector.UIString("Layers");case WebInspector.MemoryCategory.Type.Page:return WebInspector.UIString("Page");}}
shown()
{super.shown();this._timelineRuler.updateLayout(WebInspector.View.LayoutReason.Resize);}
hidden()
{super.hidden();}
closed()
{this.representedObject.removeEventListener(null,null,this);}
reset()
{super.reset();this._maxSize=0;this._cachedLegendRecord=null;this._cachedLegendMaxSize=undefined;this._cachedLegendCurrentSize=undefined;this._usageCircleChart.clear();this._usageCircleChart.needsLayout();this._clearUsageLegend();this._maxComparisonCircleChart.clear();this._maxComparisonCircleChart.needsLayout();this._clearMaxComparisonLegend();for(let categoryView of this._categoryViews)
categoryView.clear();}
get scrollableElements()
{return[this.element];}
get showsFilterBar(){return false;}
layout()
{this._timelineRuler.zeroTime=this.zeroTime;this._timelineRuler.startTime=this.startTime;this._timelineRuler.endTime=this.endTime;if(!this._didInitializeCategories)
return;let graphStartTime=this.startTime;let graphEndTime=this.endTime;let visibleEndTime=Math.min(this.endTime,this.currentTime);let discontinuities=this._recording.discontinuitiesInTimeRange(graphStartTime,visibleEndTime);let includeRecordBeforeStart=!discontinuities.length||discontinuities[0].startTime>graphStartTime; let visibleRecords=this.representedObject.recordsInTimeRange(graphStartTime,visibleEndTime,includeRecordBeforeStart);if(!visibleRecords.length)
return;let lastRecord=visibleRecords.lastValue;let values=[];for(let{size}of lastRecord.categories)
values.push(size);this._usageCircleChart.values=values;this._usageCircleChart.updateLayout();this._updateUsageLegend(lastRecord);this._maxComparisonCircleChart.values=[lastRecord.totalSize,this._maxSize-lastRecord.totalSize];this._maxComparisonCircleChart.updateLayout();this._updateMaxComparisonLegend(lastRecord.totalSize); const categoryViewWidth=800;const categoryViewHeight=75;let secondsPerPixel=(graphEndTime-graphStartTime)/categoryViewWidth;let categoryDataMap={};for(let categoryView of this._categoryViews)
categoryDataMap[categoryView.category]={dataPoints:[],max:-Infinity,min:Infinity};for(let record of visibleRecords){let time=record.startTime;let discontinuity=null;if(discontinuities.length&&discontinuities[0].endTime<time)
discontinuity=discontinuities.shift();for(let category of record.categories){let categoryData=categoryDataMap[category.type];if(discontinuity){if(categoryData.dataPoints.length){let previousDataPoint=categoryData.dataPoints.lastValue;categoryData.dataPoints.push({time:discontinuity.startTime,size:previousDataPoint.size});}
categoryData.dataPoints.push({time:discontinuity.startTime,size:0});categoryData.dataPoints.push({time:discontinuity.endTime,size:0});categoryData.dataPoints.push({time:discontinuity.endTime,size:category.size});}
categoryData.dataPoints.push({time,size:category.size});categoryData.max=Math.max(categoryData.max,category.size);categoryData.min=Math.min(categoryData.min,category.size);}}
if(discontinuities.length)
visibleEndTime=discontinuities[0].startTime;function layoutCategoryView(categoryView,categoryData){let{dataPoints,min,max}=categoryData;if(min===Infinity)
min=0;if(max===-Infinity)
max=0;let graphMin=min*0.95;let graphMax=(max*1.05)-graphMin;function xScale(time){return(time-graphStartTime)/secondsPerPixel;}
function yScale(size){return categoryViewHeight-(((size-graphMin)/graphMax)*categoryViewHeight);}
categoryView.layoutWithDataPoints(dataPoints,visibleEndTime,min,max,xScale,yScale);}
for(let categoryView of this._categoryViews)
layoutCategoryView(categoryView,categoryDataMap[categoryView.category]);}
_clearUsageLegend()
{for(let sizeElement of this._usageLegendSizeElementMap.values())
sizeElement.textContent=emDash;let totalElement=this._usageCircleChart.centerElement.firstChild;if(totalElement){totalElement.firstChild.textContent="";totalElement.lastChild.textContent="";}}
_updateUsageLegend(record)
{if(this._cachedLegendRecord===record)
return;this._cachedLegendRecord=record;for(let{type,size}of record.categories){let sizeElement=this._usageLegendSizeElementMap.get(type);sizeElement.textContent=Number.isFinite(size)?Number.bytesToString(size):emDash;}
let centerElement=this._usageCircleChart.centerElement;let totalElement=centerElement.firstChild;if(!totalElement){totalElement=centerElement.appendChild(document.createElement("div"));totalElement.classList.add("total-usage");totalElement.appendChild(document.createElement("span")); totalElement.appendChild(document.createElement("br"));totalElement.appendChild(document.createElement("span"));}
let totalSize=Number.bytesToString(record.totalSize).split(/\s+/);totalElement.firstChild.textContent=totalSize[0];totalElement.lastChild.textContent=totalSize[1];}
_clearMaxComparisonLegend()
{this._maxComparisonMaximumSizeElement.textContent=emDash;this._maxComparisonCurrentSizeElement.textContent=emDash;let totalElement=this._maxComparisonCircleChart.centerElement.firstChild;if(totalElement)
totalElement.textContent="";}
_updateMaxComparisonLegend(currentSize)
{if(this._cachedLegendMaxSize===this._maxSize&&this._cachedLegendCurrentSize===currentSize)
return;this._cachedLegendMaxSize=this._maxSize;this._cachedLegendCurrentSize=currentSize;this._maxComparisonMaximumSizeElement.textContent=Number.isFinite(this._maxSize)?Number.bytesToString(this._maxSize):emDash;this._maxComparisonCurrentSizeElement.textContent=Number.isFinite(currentSize)?Number.bytesToString(currentSize):emDash;let centerElement=this._maxComparisonCircleChart.centerElement;let totalElement=centerElement.firstChild;if(!totalElement){totalElement=centerElement.appendChild(document.createElement("div"));totalElement.classList.add("max-percentage");}
let percent=currentSize/this._maxSize;totalElement.textContent=Number.percentageString(percent===1?percent:(percent-0.0005));}
_initializeCategoryViews(record)
{this._didInitializeCategories=true;let segments=[];let lastCategoryViewElement=null;function appendLegendRow(legendElement,swatchClass,label,tooltip){let rowElement=legendElement.appendChild(document.createElement("div"));rowElement.classList.add("row");let swatchElement=rowElement.appendChild(document.createElement("div"));swatchElement.classList.add("swatch",swatchClass);let labelElement=rowElement.appendChild(document.createElement("p"));labelElement.classList.add("label");labelElement.textContent=label;let sizeElement=rowElement.appendChild(document.createElement("p"));sizeElement.classList.add("size");if(tooltip)
rowElement.title=tooltip;return sizeElement;}
for(let{type}of record.categories){segments.push(type);let categoryView=new WebInspector.MemoryCategoryView(type,WebInspector.MemoryTimelineView.displayNameForCategory(type));this._categoryViews.push(categoryView);if(!lastCategoryViewElement)
this._detailsContainerElement.appendChild(categoryView.element);else
this._detailsContainerElement.insertBefore(categoryView.element,lastCategoryViewElement);lastCategoryViewElement=categoryView.element;let sizeElement=appendLegendRow.call(this,this._usageLegendElement,type,WebInspector.MemoryTimelineView.displayNameForCategory(type));this._usageLegendSizeElementMap.set(type,sizeElement);}
this._usageCircleChart.segments=segments;this._maxComparisonCircleChart.segments=["current","remainder"];this._maxComparisonMaximumSizeElement=appendLegendRow.call(this,this._maxComparisonLegendElement,"remainder",WebInspector.UIString("Maximum"),WebInspector.UIString("Maximum maximum memory size in this recording"));this._maxComparisonCurrentSizeElement=appendLegendRow.call(this,this._maxComparisonLegendElement,"current",WebInspector.UIString("Current"),WebInspector.UIString("Total memory size at the end of the selected time range"));}
_memoryTimelineRecordAdded(event)
{let memoryTimelineRecord=event.data.record;if(!this._didInitializeCategories)
this._initializeCategoryViews(memoryTimelineRecord);this._maxSize=Math.max(this._maxSize,memoryTimelineRecord.totalSize);if(memoryTimelineRecord.startTime>=this.startTime&&memoryTimelineRecord.endTime<=this.endTime)
this.needsLayout();}};WebInspector.MultipleScopeBarItem=class MultipleScopeBarItem extends WebInspector.Object
{constructor(scopeBarItems)
{super();this._element=document.createElement("li");this._element.classList.add("multiple");this._titleElement=document.createElement("span");this._element.appendChild(this._titleElement);this._element.addEventListener("mousedown",this._handleMouseDown.bind(this));this._selectElement=document.createElement("select");this._selectElement.addEventListener("change",this._selectElementSelectionChanged.bind(this));this._element.appendChild(this._selectElement);this._element.appendChild(useSVGSymbol("Images/UpDownArrows.svg","arrows"));this.scopeBarItems=scopeBarItems;}
get element()
{return this._element;}
get exclusive()
{return false;}
get scopeBarItems()
{return this._scopeBarItems;}
set scopeBarItems(scopeBarItems)
{if(this._scopeBarItems){for(var scopeBarItem of this._scopeBarItems)
scopeBarItem.removeEventListener(null,null,this);}
this._scopeBarItems=scopeBarItems||[];this._selectedScopeBarItem=null;this._selectElement.removeChildren();function createOption(scopeBarItem)
{var optionElement=document.createElement("option");var maxPopupMenuLength=130; optionElement.textContent=scopeBarItem.label.length<=maxPopupMenuLength?scopeBarItem.label:scopeBarItem.label.substring(0,maxPopupMenuLength)+ellipsis;return optionElement;}
for(var scopeBarItem of this._scopeBarItems){if(scopeBarItem.selected&&!this._selectedScopeBarItem)
this._selectedScopeBarItem=scopeBarItem;else if(scopeBarItem.selected){scopeBarItem.selected=false;}
scopeBarItem.addEventListener(WebInspector.ScopeBarItem.Event.SelectionChanged,this._itemSelectionDidChange,this);this._selectElement.appendChild(createOption(scopeBarItem));}
this._lastSelectedScopeBarItem=this._selectedScopeBarItem||this._scopeBarItems[0]||null;this._titleElement.textContent=this._lastSelectedScopeBarItem?this._lastSelectedScopeBarItem.label:"";this._element.classList.toggle("selected",!!this._selectedScopeBarItem);this._selectElement.selectedIndex=this._scopeBarItems.indexOf(this._selectedScopeBarItem);}
get selected()
{return!!this._selectedScopeBarItem;}
set selected(selected)
{this.selectedScopeBarItem=selected?this._lastSelectedScopeBarItem:null;}
get selectedScopeBarItem()
{return this._selectedScopeBarItem;}
set selectedScopeBarItem(selectedScopeBarItem)
{this._ignoreItemSelectedEvent=true;if(this._selectedScopeBarItem){this._selectedScopeBarItem.selected=false;this._lastSelectedScopeBarItem=this._selectedScopeBarItem;}else if(!this._lastSelectedScopeBarItem)
this._lastSelectedScopeBarItem=selectedScopeBarItem;this._element.classList.toggle("selected",!!selectedScopeBarItem);this._selectedScopeBarItem=selectedScopeBarItem||null;this._selectElement.selectedIndex=this._scopeBarItems.indexOf(this._selectedScopeBarItem);if(this._selectedScopeBarItem){this.displaySelectedItem();this._selectedScopeBarItem.selected=true;}
var withModifier=WebInspector.modifierKeys.metaKey&&!WebInspector.modifierKeys.ctrlKey&&!WebInspector.modifierKeys.altKey&&!WebInspector.modifierKeys.shiftKey;this.dispatchEventToListeners(WebInspector.ScopeBarItem.Event.SelectionChanged,{withModifier});this._ignoreItemSelectedEvent=false;}
displaySelectedItem()
{this._titleElement.textContent=(this._selectedScopeBarItem||this._scopeBarItems[0]).label;}
displayWidestItem()
{let widestLabel=null;let widestSize=0;for(let option of Array.from(this._selectElement.options)){this._titleElement.textContent=option.label;if(this._titleElement.realOffsetWidth>widestSize){widestSize=this._titleElement.realOffsetWidth;widestLabel=option.label;}}
this._titleElement.textContent=widestLabel;}
_handleMouseDown(event)
{if(event.button!==0)
return;if(this._element.classList.contains("selected"))
return;this.selected=true;}
_selectElementSelectionChanged(event)
{this.selectedScopeBarItem=this._scopeBarItems[this._selectElement.selectedIndex];}
_itemSelectionDidChange(event)
{if(this._ignoreItemSelectedEvent)
return;this.selectedScopeBarItem=event.target.selected?event.target:null;}};WebInspector.NavigationBar=class NavigationBar extends WebInspector.View
{constructor(element,navigationItems,role,label)
{super(element);this.element.classList.add(this.constructor.StyleClassName||"navigation-bar");this.element.tabIndex=0;if(role)
this.element.setAttribute("role",role);if(label)
this.element.setAttribute("aria-label",label);this.element.addEventListener("focus",this._focus.bind(this),false);this.element.addEventListener("blur",this._blur.bind(this),false);this.element.addEventListener("keydown",this._keyDown.bind(this),false);this.element.addEventListener("mousedown",this._mouseDown.bind(this),false);this._forceLayout=false;this._minimumWidth=NaN;this._navigationItems=[];this._selectedNavigationItem=null;if(navigationItems){for(var i=0;i<navigationItems.length;++i)
this.addNavigationItem(navigationItems[i]);}}
addNavigationItem(navigationItem,parentElement)
{return this.insertNavigationItem(navigationItem,this._navigationItems.length,parentElement);}
insertNavigationItem(navigationItem,index,parentElement)
{if(!(navigationItem instanceof WebInspector.NavigationItem))
return null;if(navigationItem.parentNavigationBar)
navigationItem.parentNavigationBar.removeNavigationItem(navigationItem);navigationItem._parentNavigationBar=this;index=Math.max(0,Math.min(index,this._navigationItems.length));this._navigationItems.splice(index,0,navigationItem);if(!parentElement)
parentElement=this.element;var nextSibling=this._navigationItems[index+1];var nextSiblingElement=nextSibling?nextSibling.element:null;if(nextSiblingElement&&nextSiblingElement.parentNode!==parentElement)
nextSiblingElement=null;parentElement.insertBefore(navigationItem.element,nextSiblingElement);this._minimumWidth=NaN;this.needsLayout();return navigationItem;}
removeNavigationItem(navigationItem)
{if(!(navigationItem instanceof WebInspector.NavigationItem))
return null;if(!navigationItem._parentNavigationBar)
return null;if(navigationItem._parentNavigationBar!==this)
return null;navigationItem._parentNavigationBar=null;if(this._selectedNavigationItem===navigationItem)
this.selectedNavigationItem=null;this._navigationItems.remove(navigationItem);navigationItem.element.remove();this._minimumWidth=NaN;this.needsLayout();return navigationItem;}
get selectedNavigationItem()
{return this._selectedNavigationItem;}
set selectedNavigationItem(navigationItem)
{let navigationItemHasOtherParent=navigationItem&&navigationItem.parentNavigationBar!==this;if(navigationItemHasOtherParent)
return;if(!(navigationItem instanceof WebInspector.RadioButtonNavigationItem))
navigationItem=null;if(this._selectedNavigationItem===navigationItem)
return;if(this._selectedNavigationItem)
this._selectedNavigationItem.selected=false;this._selectedNavigationItem=navigationItem||null;if(this._selectedNavigationItem)
this._selectedNavigationItem.selected=true;if(!this._mouseIsDown)
this.dispatchEventToListeners(WebInspector.NavigationBar.Event.NavigationItemSelected);}
get navigationItems()
{return this._navigationItems;}
get minimumWidth()
{if(isNaN(this._minimumWidth))
this._minimumWidth=this._calculateMinimumWidth();return this._minimumWidth;}
get sizesToFit()
{return false;}
findNavigationItem(identifier)
{return this._navigationItems.find((item)=>item.identifier===identifier)||null;}
needsLayout()
{this._forceLayout=true;super.needsLayout();}
layout()
{if(this.layoutReason!==WebInspector.View.LayoutReason.Resize&&!this._forceLayout)
return;this._forceLayout=false;this.element.classList.remove(WebInspector.NavigationBar.CollapsedStyleClassName);for(let navigationItem of this._navigationItems)
navigationItem.updateLayout(true);let totalItemWidth=0;for(let navigationItem of this._navigationItems){if(navigationItem instanceof WebInspector.FlexibleSpaceNavigationItem)
continue;totalItemWidth+=navigationItem.element.realOffsetWidth;}
const barWidth=this.element.realOffsetWidth;if(totalItemWidth>barWidth)
this.element.classList.add(WebInspector.NavigationBar.CollapsedStyleClassName);for(let navigationItem of this._navigationItems)
navigationItem.updateLayout(false);}
_mouseDown(event)
{if(event.button!==0)
return;if(!this._focused)
this.element.removeAttribute("tabindex");var itemElement=event.target.enclosingNodeOrSelfWithClass(WebInspector.RadioButtonNavigationItem.StyleClassName);if(!itemElement||!itemElement.navigationItem)
return;this._previousSelectedNavigationItem=this.selectedNavigationItem;this.selectedNavigationItem=itemElement.navigationItem;this._mouseIsDown=true;this._mouseMovedEventListener=this._mouseMoved.bind(this);this._mouseUpEventListener=this._mouseUp.bind(this);if(typeof this.selectedNavigationItem.dontPreventDefaultOnNavigationBarMouseDown==="function"&&this.selectedNavigationItem.dontPreventDefaultOnNavigationBarMouseDown()&&this._previousSelectedNavigationItem===this.selectedNavigationItem)
return;document.addEventListener("mousemove",this._mouseMovedEventListener,false);document.addEventListener("mouseup",this._mouseUpEventListener,false);event.preventDefault();event.stopPropagation();}
_mouseMoved(event)
{if(!this._mouseIsDown)
return;event.preventDefault();event.stopPropagation();var itemElement=event.target.enclosingNodeOrSelfWithClass(WebInspector.RadioButtonNavigationItem.StyleClassName);if(!itemElement||!itemElement.navigationItem||!this.element.contains(itemElement)){
var element=document.elementFromPoint(event.pageX,this.element.totalOffsetTop+(this.element.offsetHeight/2));if(!element)
return;itemElement=element.enclosingNodeOrSelfWithClass(WebInspector.RadioButtonNavigationItem.StyleClassName);if(!itemElement||!itemElement.navigationItem||!this.element.contains(itemElement))
return;}
if(this.selectedNavigationItem)
this.selectedNavigationItem.active=false;this.selectedNavigationItem=itemElement.navigationItem;this.selectedNavigationItem.active=true;}
_mouseUp(event)
{if(!this._mouseIsDown)
return;if(this.selectedNavigationItem)
this.selectedNavigationItem.active=false;this._mouseIsDown=false;document.removeEventListener("mousemove",this._mouseMovedEventListener,false);document.removeEventListener("mouseup",this._mouseUpEventListener,false);delete this._mouseMovedEventListener;delete this._mouseUpEventListener;this.element.tabIndex=0;
if(this._previousSelectedNavigationItem!==this.selectedNavigationItem)
this.dispatchEventToListeners(WebInspector.NavigationBar.Event.NavigationItemSelected);delete this._previousSelectedNavigationItem;event.preventDefault();event.stopPropagation();}
_keyDown(event)
{if(!this._focused)
return;if(event.keyIdentifier!=="Left"&&event.keyIdentifier!=="Right")
return;event.preventDefault();event.stopPropagation();var selectedNavigationItemIndex=this._navigationItems.indexOf(this._selectedNavigationItem);if(event.keyIdentifier==="Left"){if(selectedNavigationItemIndex===-1)
selectedNavigationItemIndex=this._navigationItems.length;do{selectedNavigationItemIndex=Math.max(0,selectedNavigationItemIndex-1);}while(selectedNavigationItemIndex&&!(this._navigationItems[selectedNavigationItemIndex]instanceof WebInspector.RadioButtonNavigationItem));}else if(event.keyIdentifier==="Right"){do{selectedNavigationItemIndex=Math.min(selectedNavigationItemIndex+1,this._navigationItems.length-1);}while(selectedNavigationItemIndex<this._navigationItems.length-1&&!(this._navigationItems[selectedNavigationItemIndex]instanceof WebInspector.RadioButtonNavigationItem));}
if(!(this._navigationItems[selectedNavigationItemIndex]instanceof WebInspector.RadioButtonNavigationItem))
return;this.selectedNavigationItem=this._navigationItems[selectedNavigationItemIndex];}
_focus(event)
{this._focused=true;}
_blur(event)
{this._focused=false;}
_calculateMinimumWidth()
{const wasCollapsed=this.element.classList.contains(WebInspector.NavigationBar.CollapsedStyleClassName);if(!wasCollapsed)
this.element.classList.add(WebInspector.NavigationBar.CollapsedStyleClassName);let totalItemWidth=0;for(let item of this._navigationItems){if(item instanceof WebInspector.FlexibleSpaceNavigationItem)
continue;totalItemWidth+=item.minimumWidth;}
if(!wasCollapsed)
this.element.classList.remove(WebInspector.NavigationBar.CollapsedStyleClassName);return totalItemWidth;}};WebInspector.NavigationBar.CollapsedStyleClassName="collapsed";WebInspector.NavigationBar.Event={NavigationItemSelected:"navigation-bar-navigation-item-selected"};WebInspector.NetworkGridContentView=class NetworkGridContentView extends WebInspector.ContentView
{constructor(representedObject,extraArguments)
{super(representedObject);WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange,this._mainResourceDidChange,this);this._networkSidebarPanel=extraArguments.networkSidebarPanel;this._contentTreeOutline=this._networkSidebarPanel.contentTreeOutline;this._contentTreeOutline.addEventListener(WebInspector.TreeOutline.Event.SelectionDidChange,this._treeSelectionDidChange,this);let columns={domain:{},type:{},method:{},scheme:{},statusCode:{},cached:{},protocol:{},priority:{},remoteAddress:{},connectionIdentifier:{},size:{},transferSize:{},requestSent:{},latency:{},duration:{},graph:{}};columns.domain.title=columns.domain.tooltip=WebInspector.UIString("Domain");columns.domain.width="10%";columns.type.title=columns.type.tooltip=WebInspector.UIString("Type");columns.type.width="6%";columns.method.title=columns.method.tooltip=WebInspector.UIString("Method");columns.method.width="5%";columns.scheme.title=columns.scheme.tooltip=WebInspector.UIString("Scheme");columns.scheme.width="5%";columns.statusCode.title=columns.statusCode.tooltip=WebInspector.UIString("Status");columns.statusCode.width="5%";columns.cached.title=columns.cached.tooltip=WebInspector.UIString("Cached");columns.cached.width="8%";columns.protocol.title=columns.protocol.tooltip=WebInspector.UIString("Protocol");columns.protocol.width="5%";columns.protocol.hidden=true;columns.priority.title=columns.priority.tooltip=WebInspector.UIString("Priority");columns.priority.width="5%";columns.priority.hidden=true;columns.remoteAddress.title=columns.remoteAddress.tooltip=WebInspector.UIString("IP Address");columns.remoteAddress.width="8%";columns.remoteAddress.hidden=true;columns.connectionIdentifier.title=columns.connectionIdentifier.tooltip=WebInspector.UIString("Connection ID");columns.connectionIdentifier.width="5%";columns.connectionIdentifier.hidden=true;columns.connectionIdentifier.aligned="right";columns.size.title=columns.size.tooltip=WebInspector.UIString("Size");columns.size.width="6%";columns.size.aligned="right";columns.transferSize.title=columns.transferSize.tooltip=WebInspector.UIString("Transferred");columns.transferSize.width="8%";columns.transferSize.aligned="right";columns.requestSent.title=columns.requestSent.tooltip=WebInspector.UIString("Start Time");columns.requestSent.width="9%";columns.requestSent.aligned="right";columns.latency.title=columns.latency.tooltip=WebInspector.UIString("Latency");columns.latency.width="9%";columns.latency.aligned="right";columns.duration.title=columns.duration.tooltip=WebInspector.UIString("Duration");columns.duration.width="9%";columns.duration.aligned="right";for(let column in columns)
columns[column].sortable=true;this._timelineRuler=new WebInspector.TimelineRuler;this._timelineRuler.allowsClippedLabels=true;columns.graph.title=WebInspector.UIString("Timeline");columns.graph.width="20%";columns.graph.headerView=this._timelineRuler;columns.graph.sortable=false;if(!NetworkAgent.hasEventParameter("loadingFinished","metrics")){delete columns.protocol;delete columns.priority;delete columns.remoteAddress;delete columns.connectionIdentifier;}
this._dataGrid=new WebInspector.TimelineDataGrid(columns,this._contentTreeOutline);this._dataGrid.addEventListener(WebInspector.DataGrid.Event.SelectedNodeChanged,this._dataGridNodeSelected,this);this._dataGrid.sortDelegate=this;this._dataGrid.sortColumnIdentifier="requestSent";this._dataGrid.sortOrder=WebInspector.DataGrid.SortOrder.Ascending;this._dataGrid.createSettings("network-grid-content-view");this.element.classList.add("network-grid");this.addSubview(this._dataGrid);let networkTimeline=WebInspector.timelineManager.persistentNetworkTimeline;networkTimeline.addEventListener(WebInspector.Timeline.Event.RecordAdded,this._networkTimelineRecordAdded,this);networkTimeline.addEventListener(WebInspector.Timeline.Event.Reset,this._networkTimelineReset,this);if(window.NetworkAgent&&NetworkAgent.setResourceCachingDisabled){let toolTipForDisableResourceCache=WebInspector.UIString("Ignore the resource cache when loading resources");let activatedToolTipForDisableResourceCache=WebInspector.UIString("Use the resource cache when loading resources");this._disableResourceCacheNavigationItem=new WebInspector.ActivateButtonNavigationItem("disable-resource-cache",toolTipForDisableResourceCache,activatedToolTipForDisableResourceCache,"Images/IgnoreCaches.svg",16,16);this._disableResourceCacheNavigationItem.activated=WebInspector.resourceCachingDisabledSetting.value;this._disableResourceCacheNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,this._toggleDisableResourceCache,this);WebInspector.resourceCachingDisabledSetting.addEventListener(WebInspector.Setting.Event.Changed,this._resourceCachingDisabledSettingChanged,this);}
this._clearNetworkItemsNavigationItem=new WebInspector.ButtonNavigationItem("clear-network-items",WebInspector.UIString("Clear Network Items (%s)").format(WebInspector.clearKeyboardShortcut.displayName),"Images/NavigationItemClear.svg",16,16);this._clearNetworkItemsNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,()=>this.reset());this._pendingRecords=[];this._loadingResourceCount=0;this._lastRecordEndTime=NaN;this._lastUpdateTimestamp=NaN;this._startTime=NaN;this._endTime=NaN;this._scheduledCurrentTimeUpdateIdentifier=undefined;}
get secondsPerPixel(){return this._timelineRuler.secondsPerPixel;}
get startTime(){return this._startTime;}
get currentTime(){return this.endTime||this.startTime;}
get endTime(){return this._endTime;}
get zeroTime(){return this.startTime;}
get selectionPathComponents()
{if(!this._contentTreeOutline.selectedTreeElement||this._contentTreeOutline.selectedTreeElement.hidden)
return null;var pathComponent=new WebInspector.GeneralTreeElementPathComponent(this._contentTreeOutline.selectedTreeElement);pathComponent.addEventListener(WebInspector.HierarchicalPathComponent.Event.SiblingWasSelected,this._treeElementPathComponentSelected,this);return[pathComponent];}
get navigationItems()
{let items=[];if(this._disableResourceCacheNavigationItem)
items.push(this._disableResourceCacheNavigationItem);items.push(this._clearNetworkItemsNavigationItem);return items;}
shown()
{super.shown();this._dataGrid.shown();this._dataGrid.updateLayout(WebInspector.View.LayoutReason.Resize);if(this._loadingResourceCount&&!this._scheduledCurrentTimeUpdateIdentifier)
this._startUpdatingCurrentTime();}
hidden()
{this._dataGrid.hidden();if(this._scheduledCurrentTimeUpdateIdentifier)
this._stopUpdatingCurrentTime();super.hidden();}
closed()
{super.closed();this._dataGrid.closed();}
reset()
{this._contentTreeOutline.removeChildren();this._dataGrid.reset();if(this._scheduledCurrentTimeUpdateIdentifier)
this._stopUpdatingCurrentTime();this._pendingRecords=[];this._loadingResourceCount=0;this._lastRecordEndTime=NaN;this._lastUpdateTimestamp=NaN;this._startTime=NaN;this._endTime=NaN;this._timelineRuler.startTime=0;this._timelineRuler.endTime=0;}
layout()
{if(isNaN(this.startTime)||isNaN(this.endTime))
return;let oldZeroTime=this._timelineRuler.zeroTime;let oldStartTime=this._timelineRuler.startTime;let oldEndTime=this._timelineRuler.endTime;this._timelineRuler.zeroTime=this.zeroTime;this._timelineRuler.startTime=this.startTime;if(this.startTime>=this.endTime)
return;if(!this._scheduledCurrentTimeUpdateIdentifier){this._timelineRuler.endTime=this.endTime;this._endTime=this._lastRecordEndTime+WebInspector.TimelineRecordBar.MinimumWidthPixels*this.secondsPerPixel;}
this._timelineRuler.endTime=this.endTime;if(this.zeroTime!==oldZeroTime||this.startTime!==oldStartTime||this.endTime!==oldEndTime){for(let dataGridNode of this._dataGrid.children)
dataGridNode.refreshGraph();}
this._processPendingRecords();}
handleClearShortcut(event)
{this.reset();}
dataGridSortComparator(sortColumnIdentifier,sortDirection,node1,node2)
{if(sortColumnIdentifier==="priority")
return WebInspector.Resource.comparePriority(node1.data.priority,node2.data.priority)*sortDirection;return null;}
_resourceCachingDisabledSettingChanged()
{this._disableResourceCacheNavigationItem.activated=WebInspector.resourceCachingDisabledSetting.value;}
_toggleDisableResourceCache()
{WebInspector.resourceCachingDisabledSetting.value=!WebInspector.resourceCachingDisabledSetting.value;}
_processPendingRecords()
{if(!this._pendingRecords.length)
return;for(var resourceTimelineRecord of this._pendingRecords){var treeElement=this._contentTreeOutline.findTreeElement(resourceTimelineRecord.resource);if(treeElement)
continue;treeElement=new WebInspector.ResourceTreeElement(resourceTimelineRecord.resource);const includesGraph=false;const shouldShowPopover=true;let dataGridNode=new WebInspector.ResourceTimelineDataGridNode(resourceTimelineRecord,includesGraph,this,shouldShowPopover);this._dataGrid.addRowInSortOrder(treeElement,dataGridNode);}
this._pendingRecords=[];}
_mainResourceDidChange(event)
{let frame=event.target;if(!frame.isMainFrame()||WebInspector.settings.clearNetworkOnNavigate.value)
return;for(let dataGridNode of this._dataGrid.children)
dataGridNode.element.classList.add("preserved");}
_networkTimelineReset(event)
{this.reset();}
_networkTimelineRecordAdded(event)
{let resourceTimelineRecord=event.data.record;let update=(event)=>{if(event.target[WebInspector.NetworkGridContentView.ResourceDidFinishOrFail])
return;event.target.removeEventListener(null,null,this);event.target[WebInspector.NetworkGridContentView.ResourceDidFinishOrFail]=true;this._loadingResourceCount--;if(this._loadingResourceCount)
return;this._lastRecordEndTime=resourceTimelineRecord.endTime;this._endTime=Math.max(this._lastRecordEndTime,this._endTime);if(this._scheduledCurrentTimeUpdateIdentifier)
this.debounce(150)._stopUpdatingCurrentTime();};this._pendingRecords.push(resourceTimelineRecord);this.needsLayout();let resource=resourceTimelineRecord.resource;if(resource.finished||resource.failed||resource.canceled)
return;resource[WebInspector.NetworkGridContentView.ResourceDidFinishOrFail]=false;resource.addEventListener(WebInspector.Resource.Event.LoadingDidFinish,update,this);resource.addEventListener(WebInspector.Resource.Event.LoadingDidFail,update,this);this._loadingResourceCount++;if(this._scheduledCurrentTimeUpdateIdentifier)
return;if(isNaN(this._startTime))
this._startTime=this._endTime=resourceTimelineRecord.startTime; if(!(WebInspector.tabBrowser.selectedTabContentView instanceof WebInspector.NetworkTabContentView))
return;this._startUpdatingCurrentTime();}
_treeElementPathComponentSelected(event)
{var dataGridNode=this._dataGrid.dataGridNodeForTreeElement(event.data.pathComponent.generalTreeElement);if(!dataGridNode)
return;dataGridNode.revealAndSelect();}
_treeSelectionDidChange(event)
{this.dispatchEventToListeners(WebInspector.ContentView.Event.SelectionPathComponentsDidChange);if(!this._networkSidebarPanel.canShowDifferentContentView())
return;let treeElement=event.data.selectedElement;if(treeElement instanceof WebInspector.ResourceTreeElement){WebInspector.showRepresentedObject(treeElement.representedObject);return;}
console.error("Unknown tree element",treeElement);}
_dataGridNodeSelected(event)
{this.dispatchEventToListeners(WebInspector.ContentView.Event.SelectionPathComponentsDidChange);}
_update(timestamp)
{if(!isNaN(this._lastUpdateTimestamp)){let timespanSinceLastUpdate=(timestamp-this._lastUpdateTimestamp)/1000||0;this._endTime+=timespanSinceLastUpdate;this.updateLayout();}
this._lastUpdateTimestamp=timestamp;this._scheduledCurrentTimeUpdateIdentifier=requestAnimationFrame(this._updateCallback);}
_startUpdatingCurrentTime()
{if(this._scheduledCurrentTimeUpdateIdentifier)
return;if(!WebInspector.visible)
return;if(!this._updateCallback)
this._updateCallback=this._update.bind(this);this._scheduledCurrentTimeUpdateIdentifier=requestAnimationFrame(this._updateCallback);}
_stopUpdatingCurrentTime()
{if(!this._scheduledCurrentTimeUpdateIdentifier)
return;this._stopUpdatingCurrentTime.cancelDebounce();cancelAnimationFrame(this._scheduledCurrentTimeUpdateIdentifier);this._scheduledCurrentTimeUpdateIdentifier=undefined;this.needsLayout();}};WebInspector.NetworkGridContentView.ResourceDidFinishOrFail=Symbol("ResourceDidFinishOrFail");WebInspector.NetworkSidebarPanel=class NetworkSidebarPanel extends WebInspector.NavigationSidebarPanel
{constructor(contentBrowser)
{super("network",WebInspector.UIString("Network"),false);WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange,this._mainResourceDidChange,this);this.contentBrowser=contentBrowser;this.filterBar.placeholder=WebInspector.UIString("Filter Resource List");this.contentTreeOutline.element.classList.add("network-grid");this.contentTreeOutline.disclosureButtons=false;}
get minimumWidth()
{return this._navigationBar.minimumWidth;}
showDefaultContentView()
{if(!this._networkGridView)
this._networkGridView=new WebInspector.NetworkGridContentView(null,{networkSidebarPanel:this});this.contentBrowser.showContentView(this._networkGridView);}
canShowDifferentContentView()
{if(this._clickedTreeElementGoToArrow)
return true;if(this.contentBrowser.currentContentView instanceof WebInspector.NetworkGridContentView)
return false;return!this.restoringState;}
initialLayout()
{this._navigationBar=new WebInspector.NavigationBar;this.addSubview(this._navigationBar);this._resourcesTitleBarElement=document.createElement("div");this._resourcesTitleBarElement.textContent=WebInspector.UIString("Name");this._resourcesTitleBarElement.classList.add("title-bar");this.element.appendChild(this._resourcesTitleBarElement);let scopeItemPrefix="network-sidebar-";let scopeBarItems=[];scopeBarItems.push(new WebInspector.ScopeBarItem(scopeItemPrefix+"type-all",WebInspector.UIString("All Resources"),true));for(let key in WebInspector.Resource.Type){let value=WebInspector.Resource.Type[key];let scopeBarItem=new WebInspector.ScopeBarItem(scopeItemPrefix+value,WebInspector.Resource.displayNameForType(value,true));scopeBarItem[WebInspector.NetworkSidebarPanel.ResourceTypeSymbol]=value;scopeBarItems.push(scopeBarItem);}
this._scopeBar=new WebInspector.ScopeBar("network-sidebar-scope-bar",scopeBarItems,scopeBarItems[0],true);this._scopeBar.addEventListener(WebInspector.ScopeBar.Event.SelectionChanged,this._scopeBarSelectionDidChange,this);this._navigationBar.addNavigationItem(this._scopeBar);WebInspector.timelineManager.persistentNetworkTimeline.addEventListener(WebInspector.Timeline.Event.Reset,this._networkTimelineReset,this);this.contentBrowser.addEventListener(WebInspector.ContentBrowser.Event.CurrentContentViewDidChange,this._contentBrowserCurrentContentViewDidChange,this);this._contentBrowserCurrentContentViewDidChange();}
saveStateToCookie(cookie)
{cookie[WebInspector.NetworkSidebarPanel.ShowingNetworkGridContentViewCookieKey]=this.contentBrowser.currentContentView instanceof WebInspector.NetworkGridContentView;super.saveStateToCookie(cookie);}
restoreStateFromCookie(cookie,relaxedMatchDelay)
{
if(cookie[WebInspector.NetworkSidebarPanel.ShowingNetworkGridContentViewCookieKey])
return;super.restoreStateFromCookie(cookie,relaxedMatchDelay);}
hasCustomFilters()
{var selectedScopeBarItem=this._scopeBar.selectedItems[0];return selectedScopeBarItem&&!selectedScopeBarItem.exclusive;}
matchTreeElementAgainstCustomFilters(treeElement,flags)
{var selectedScopeBarItem=this._scopeBar.selectedItems[0];if(!selectedScopeBarItem||selectedScopeBarItem.exclusive)
return true;function match()
{if(treeElement instanceof WebInspector.FrameTreeElement)
return selectedScopeBarItem[WebInspector.NetworkSidebarPanel.ResourceTypeSymbol]===WebInspector.Resource.Type.Document;if(!(treeElement instanceof WebInspector.ResourceTreeElement))
return false;return treeElement.resource.type===selectedScopeBarItem[WebInspector.NetworkSidebarPanel.ResourceTypeSymbol];}
var matched=match();if(matched)
flags.expandTreeElement=true;return matched;}
treeElementAddedOrChanged(treeElement)
{if(treeElement.status&&treeElement.status[WebInspector.NetworkSidebarPanel.TreeElementStatusButtonSymbol]||!treeElement.treeOutline)
return;var fragment=document.createDocumentFragment();var closeButton=new WebInspector.TreeElementStatusButton(useSVGSymbol("Images/Close.svg",null,WebInspector.UIString("Close resource view")));closeButton.element.classList.add("close");closeButton.addEventListener(WebInspector.TreeElementStatusButton.Event.Clicked,this._treeElementCloseButtonClicked,this);fragment.appendChild(closeButton.element);let goToButton=new WebInspector.TreeElementStatusButton(WebInspector.createGoToArrowButton());goToButton[WebInspector.NetworkSidebarPanel.TreeElementSymbol]=treeElement;goToButton.addEventListener(WebInspector.TreeElementStatusButton.Event.Clicked,this._treeElementGoToArrowWasClicked,this);fragment.appendChild(goToButton.element);treeElement.status=fragment;treeElement.status[WebInspector.NetworkSidebarPanel.TreeElementStatusButtonSymbol]=true;}
_mainResourceDidChange(event)
{let frame=event.target;if(!frame.isMainFrame()||WebInspector.settings.clearNetworkOnNavigate.value)
return;for(let treeElement of this.contentTreeOutline.children)
treeElement.element.classList.add("preserved");}
_networkTimelineReset(event)
{this.contentBrowser.contentViewContainer.closeAllContentViews();this.showDefaultContentView();}
_contentBrowserCurrentContentViewDidChange(event)
{var didShowNetworkGridContentView=this.contentBrowser.currentContentView instanceof WebInspector.NetworkGridContentView;this.element.classList.toggle("network-grid-content-view-showing",didShowNetworkGridContentView);}
_treeElementGoToArrowWasClicked(event)
{this._clickedTreeElementGoToArrow=true;let treeElement=event.target[WebInspector.NetworkSidebarPanel.TreeElementSymbol];treeElement.select(true,true);this._clickedTreeElementGoToArrow=false;}
_treeElementCloseButtonClicked(event)
{
this.contentTreeOutline.processingSelectionChange=true;this.showDefaultContentView();this.contentTreeOutline.processingSelectionChange=false;}
_scopeBarSelectionDidChange(event)
{this.updateFilter();}};WebInspector.NetworkSidebarPanel.ResourceTypeSymbol=Symbol("resource-type");WebInspector.NetworkSidebarPanel.TreeElementSymbol=Symbol("tree-element");WebInspector.NetworkSidebarPanel.TreeElementStatusButtonSymbol=Symbol("tree-element-status-button");WebInspector.NetworkSidebarPanel.ShowingNetworkGridContentViewCookieKey="network-sidebar-panel-showing-network-grid-content-view";WebInspector.NetworkTimelineOverviewGraph=class NetworkTimelineOverviewGraph extends WebInspector.TimelineOverviewGraph
{constructor(timeline,timelineOverview)
{super(timelineOverview);this.element.classList.add("network");timeline.addEventListener(WebInspector.Timeline.Event.RecordAdded,this._networkTimelineRecordAdded,this);timeline.addEventListener(WebInspector.Timeline.Event.TimesUpdated,this.needsLayout,this);this.reset();}
reset()
{super.reset();this._nextDumpRow=0;this._timelineRecordGridRows=[];for(var i=0;i<WebInspector.NetworkTimelineOverviewGraph.MaximumRowCount;++i)
this._timelineRecordGridRows.push([]);this.element.removeChildren();for(var rowRecords of this._timelineRecordGridRows){rowRecords.__element=document.createElement("div");rowRecords.__element.classList.add("graph-row");this.element.appendChild(rowRecords.__element);rowRecords.__recordBars=[];}}
layout()
{if(!this.visible)
return;let secondsPerPixel=this.timelineOverview.secondsPerPixel;let recordBarIndex=0;function createBar(rowElement,rowRecordBars,records,renderMode)
{let timelineRecordBar=rowRecordBars[recordBarIndex];if(!timelineRecordBar)
timelineRecordBar=rowRecordBars[recordBarIndex]=new WebInspector.TimelineRecordBar(records,renderMode);else{timelineRecordBar.renderMode=renderMode;timelineRecordBar.records=records;}
timelineRecordBar.refresh(this);if(!timelineRecordBar.element.parentNode)
rowElement.appendChild(timelineRecordBar.element);++recordBarIndex;}
for(let rowRecords of this._timelineRecordGridRows){let rowElement=rowRecords.__element;let rowRecordBars=rowRecords.__recordBars;recordBarIndex=0;WebInspector.TimelineRecordBar.createCombinedBars(rowRecords,secondsPerPixel,this,createBar.bind(this,rowElement,rowRecordBars));for(;recordBarIndex<rowRecordBars.length;++recordBarIndex){rowRecordBars[recordBarIndex].records=null;rowRecordBars[recordBarIndex].element.remove();}}}
_networkTimelineRecordAdded(event)
{var resourceTimelineRecord=event.data.record;function compareByStartTime(a,b)
{return a.startTime-b.startTime;}
let minimumBarPaddingTime=WebInspector.TimelineOverview.MinimumDurationPerPixel*(WebInspector.TimelineRecordBar.MinimumWidthPixels+WebInspector.TimelineRecordBar.MinimumMarginPixels);var foundRowForRecord=false;for(var i=0;i<this._timelineRecordGridRows.length;++i){var rowRecords=this._timelineRecordGridRows[i];var lastRecord=rowRecords.lastValue;if(!lastRecord||lastRecord.endTime+minimumBarPaddingTime<=resourceTimelineRecord.startTime){insertObjectIntoSortedArray(resourceTimelineRecord,rowRecords,compareByStartTime);this._nextDumpRow=i+1;foundRowForRecord=true;break;}}
if(!foundRowForRecord){for(var i=0;i<this._timelineRecordGridRows.length;++i){var rowRecords=this._timelineRecordGridRows[i];var lastRecord=rowRecords.lastValue;if(lastRecord.activeStartTime+minimumBarPaddingTime<=resourceTimelineRecord.startTime){insertObjectIntoSortedArray(resourceTimelineRecord,rowRecords,compareByStartTime);this._nextDumpRow=i+1;foundRowForRecord=true;break;}}}
if(!foundRowForRecord){if(this._nextDumpRow>=WebInspector.NetworkTimelineOverviewGraph.MaximumRowCount)
this._nextDumpRow=0;insertObjectIntoSortedArray(resourceTimelineRecord,this._timelineRecordGridRows[this._nextDumpRow++],compareByStartTime);}
this.needsLayout();}};WebInspector.NetworkTimelineOverviewGraph.MaximumRowCount=6;WebInspector.NetworkTimelineView=class NetworkTimelineView extends WebInspector.TimelineView
{constructor(timeline,extraArguments)
{super(timeline,extraArguments);let columns={name:{},domain:{},type:{},method:{},scheme:{},statusCode:{},cached:{},protocol:{},priority:{},remoteAddress:{},connectionIdentifier:{},size:{},transferSize:{},requestSent:{},latency:{},duration:{},graph:{}};columns.name.title=WebInspector.UIString("Name");columns.name.icon=true;columns.name.width="10%";columns.name.locked=true;columns.domain.title=WebInspector.UIString("Domain");columns.domain.width="8%";columns.type.title=WebInspector.UIString("Type");columns.type.width="7%";let typeToLabelMap=new Map;for(let key in WebInspector.Resource.Type){let value=WebInspector.Resource.Type[key];typeToLabelMap.set(value,WebInspector.Resource.displayNameForType(value,true));}
columns.type.scopeBar=WebInspector.TimelineDataGrid.createColumnScopeBar("network",typeToLabelMap);this._scopeBar=columns.type.scopeBar;columns.method.title=WebInspector.UIString("Method");columns.method.width="4%";columns.scheme.title=WebInspector.UIString("Scheme");columns.scheme.width="4%";columns.statusCode.title=WebInspector.UIString("Status");columns.statusCode.width="4%";columns.cached.title=WebInspector.UIString("Cached");columns.cached.width="6%";columns.protocol.title=WebInspector.UIString("Protocol");columns.protocol.width="5%";columns.protocol.hidden=true;columns.priority.title=WebInspector.UIString("Priority");columns.priority.width="5%";columns.priority.hidden=true;columns.remoteAddress.title=WebInspector.UIString("IP Address");columns.remoteAddress.width="8%";columns.remoteAddress.hidden=true;columns.connectionIdentifier.title=WebInspector.UIString("Connection ID");columns.connectionIdentifier.width="5%";columns.connectionIdentifier.hidden=true;columns.connectionIdentifier.aligned="right";columns.size.title=WebInspector.UIString("Size");columns.size.width="6%";columns.size.aligned="right";columns.transferSize.title=WebInspector.UIString("Transferred");columns.transferSize.width="8%";columns.transferSize.aligned="right";columns.requestSent.title=WebInspector.UIString("Start Time");columns.requestSent.width="9%";columns.requestSent.aligned="right";columns.latency.title=WebInspector.UIString("Latency");columns.latency.width="9%";columns.latency.aligned="right";columns.duration.title=WebInspector.UIString("Duration");columns.duration.width="9%";columns.duration.aligned="right";for(let column in columns)
columns[column].sortable=true;this._timelineRuler=new WebInspector.TimelineRuler;this._timelineRuler.allowsClippedLabels=true;columns.graph.title=WebInspector.UIString("Timeline");columns.graph.width="15%";columns.graph.headerView=this._timelineRuler;columns.graph.sortable=false;if(!NetworkAgent.hasEventParameter("loadingFinished","metrics")){delete columns.protocol;delete columns.priority;delete columns.remoteAddress;delete columns.connectionIdentifier;}
this._dataGrid=new WebInspector.TimelineDataGrid(columns);this._dataGrid.sortDelegate=this;this._dataGrid.sortColumnIdentifier="requestSent";this._dataGrid.sortOrder=WebInspector.DataGrid.SortOrder.Ascending;this._dataGrid.createSettings("network-timeline-view");this.setupDataGrid(this._dataGrid);this.element.classList.add("network");this.addSubview(this._dataGrid);timeline.addEventListener(WebInspector.Timeline.Event.RecordAdded,this._networkTimelineRecordAdded,this);this._pendingRecords=[];this._resourceDataGridNodeMap=new Map;}
get secondsPerPixel(){return this._timelineRuler.secondsPerPixel;}
get selectionPathComponents()
{if(!this._dataGrid.selectedNode||this._dataGrid.selectedNode.hidden)
return null;let pathComponent=new WebInspector.TimelineDataGridNodePathComponent(this._dataGrid.selectedNode,this._dataGrid.selectedNode.resource);pathComponent.addEventListener(WebInspector.HierarchicalPathComponent.Event.SiblingWasSelected,this.dataGridNodePathComponentSelected,this);return[pathComponent];}
shown()
{super.shown();this._dataGrid.shown();}
hidden()
{this._dataGrid.hidden();super.hidden();}
closed()
{this.representedObject.removeEventListener(null,null,this);this._dataGrid.closed();}
reset()
{super.reset();this._dataGrid.reset();this._pendingRecords=[];this._resourceDataGridNodeMap.clear();}
dataGridSortComparator(sortColumnIdentifier,sortDirection,node1,node2)
{if(sortColumnIdentifier==="priority")
return WebInspector.Resource.comparePriority(node1.data.priority,node2.data.priority)*sortDirection;if(sortColumnIdentifier=="name"){let displayName1=node1.displayName();let displayName2=node2.displayName();if(displayName1!==displayName2)
return displayName1.extendedLocaleCompare(displayName2)*sortDirection;return node1.resource.url.extendedLocaleCompare(node2.resource.url)*sortDirection;}
return null;}
dataGridNodePathComponentSelected(event)
{let pathComponent=event.data.pathComponent;let dataGridNode=pathComponent.timelineDataGridNode;dataGridNode.revealAndSelect();}
layout()
{this.endTime=Math.min(this.endTime,this.currentTime);let oldZeroTime=this._timelineRuler.zeroTime;let oldStartTime=this._timelineRuler.startTime;let oldEndTime=this._timelineRuler.endTime;this._timelineRuler.zeroTime=this.zeroTime;this._timelineRuler.startTime=this.startTime;this._timelineRuler.endTime=this.endTime;if(this.zeroTime!==oldZeroTime||this.startTime!==oldStartTime||this.endTime!==oldEndTime){for(let dataGridNode of this._resourceDataGridNodeMap.values())
dataGridNode.refreshGraph();}
this._processPendingRecords();}
_processPendingRecords()
{if(!this._pendingRecords.length)
return;for(let resourceTimelineRecord of this._pendingRecords){let dataGridNode=this._resourceDataGridNodeMap.get(resourceTimelineRecord.resource);if(dataGridNode)
continue;const includesGraph=false;const shouldShowPopover=true;dataGridNode=new WebInspector.ResourceTimelineDataGridNode(resourceTimelineRecord,includesGraph,this,shouldShowPopover);this._resourceDataGridNodeMap.set(resourceTimelineRecord.resource,dataGridNode);this._dataGrid.addRowInSortOrder(null,dataGridNode);}
this._pendingRecords=[];}
_networkTimelineRecordAdded(event)
{var resourceTimelineRecord=event.data.record;this._pendingRecords.push(resourceTimelineRecord);this.needsLayout();}};WebInspector.ObjectPreviewView=class ObjectPreviewView extends WebInspector.Object
{constructor(preview,mode)
{super();this._preview=preview;this._mode=mode||WebInspector.ObjectPreviewView.Mode.Full;this._element=document.createElement("span");this._element.className="object-preview";this._previewElement=this._element.appendChild(document.createElement("span"));this._previewElement.className="preview";this._lossless=this._appendPreview(this._previewElement,this._preview);this._titleElement=this._element.appendChild(document.createElement("span"));this._titleElement.className="title";this._titleElement.hidden=true;this._initTitleElement();if(this._preview.hasSize()){var sizeElement=this._element.appendChild(document.createElement("span"));sizeElement.className="size";sizeElement.textContent=" ("+this._preview.size+")";}
if(this._lossless)
this._element.classList.add("lossless");}
get preview()
{return this._preview;}
get element()
{return this._element;}
get mode()
{return this._mode;}
get lossless()
{return this._lossless;}
showTitle()
{this._titleElement.hidden=false;this._previewElement.hidden=true;}
showPreview()
{this._titleElement.hidden=true;this._previewElement.hidden=false;}
setOriginatingObjectInfo(remoteObject,propertyPath)
{this._remoteObject=remoteObject;this._propertyPath=propertyPath||null;this.element.addEventListener("contextmenu",this._contextMenuHandler.bind(this));}
_initTitleElement()
{if(this._preview.subtype==="regexp"||this._preview.subtype==="null")
this._titleElement.appendChild(WebInspector.FormattedValue.createElementForObjectPreview(this._preview));else if(this._preview.subtype==="node")
this._titleElement.appendChild(WebInspector.FormattedValue.createElementForNodePreview(this._preview));else
this._titleElement.textContent=this._preview.description||"";}
_numberOfPropertiesToShowInMode()
{return this._mode===WebInspector.ObjectPreviewView.Mode.Brief?3:Infinity;}
_appendPreview(element,preview)
{var displayObjectAsValue=false;if(preview.type==="object"){if(preview.subtype==="regexp"||preview.subtype==="null"||preview.subtype==="node"){displayObjectAsValue=true;}else if((preview.subtype==="array"&&preview.description!=="Array")||(preview.subtype!=="array"&&preview.description!=="Object")){var nameElement=element.appendChild(document.createElement("span"));nameElement.className="object-preview-name";nameElement.textContent=preview.description+" ";}}
var bodyElement=element.appendChild(document.createElement("span"));bodyElement.className="object-preview-body";if(!displayObjectAsValue){if(preview.collectionEntryPreviews)
return this._appendEntryPreviews(bodyElement,preview);if(preview.propertyPreviews)
return this._appendPropertyPreviews(bodyElement,preview);}
return this._appendValuePreview(bodyElement,preview);}
_appendEntryPreviews(element,preview)
{var lossless=preview.lossless&&!preview.propertyPreviews.length;var overflow=preview.overflow;var isIterator=preview.subtype==="iterator";element.append(isIterator?"[":"{");var limit=Math.min(preview.collectionEntryPreviews.length,this._numberOfPropertiesToShowInMode());for(var i=0;i<limit;++i){if(i>0)
element.append(", ");var keyPreviewLossless=true;var entry=preview.collectionEntryPreviews[i];if(entry.keyPreview){keyPreviewLossless=this._appendPreview(element,entry.keyPreview);element.append(" => ");}
var valuePreviewLossless=this._appendPreview(element,entry.valuePreview);if(!keyPreviewLossless||!valuePreviewLossless)
lossless=false;}
if(preview.collectionEntryPreviews.length>limit){lossless=false;overflow=true;}
if(overflow){if(limit>0)
element.append(", ");element.append(ellipsis);}
element.append(isIterator?"]":"}");return lossless;}
_appendPropertyPreviews(element,preview)
{if(preview.subtype==="error")
return false;if(preview.subtype==="date")
return!preview.propertyPreviews.length;var lossless=preview.lossless;var overflow=preview.overflow;var isArray=preview.subtype==="array";element.append(isArray?"[":"{");var numberAdded=0;var limit=this._numberOfPropertiesToShowInMode();for(var i=0;i<preview.propertyPreviews.length&&numberAdded<limit;++i){var property=preview.propertyPreviews[i];if(property.type==="accessor")
continue;if(property.name==="constructor")
continue;if(numberAdded++>0)
element.append(", ");if(!isArray||property.name!=i){var nameElement=element.appendChild(document.createElement("span"));nameElement.className="name";nameElement.textContent=property.name;element.append(": ");}
if(property.valuePreview)
this._appendPreview(element,property.valuePreview);else if(property.subtype==="node")
element.appendChild(WebInspector.FormattedValue.createElementForNodePreview(property));else
element.appendChild(WebInspector.FormattedValue.createElementForPropertyPreview(property));}
if(numberAdded===limit&&preview.propertyPreviews.length>limit){lossless=false;overflow=true;}
if(overflow){if(limit>0)
element.append(", ");element.append(ellipsis);}
element.append(isArray?"]":"}");return lossless;}
_appendValuePreview(element,preview)
{if(preview.subtype==="node"){element.appendChild(WebInspector.FormattedValue.createElementForNodePreview(preview));return false;}
element.appendChild(WebInspector.FormattedValue.createElementForObjectPreview(preview));return true;}
_contextMenuHandler(event)
{let contextMenu=WebInspector.ContextMenu.createFromEvent(event);event.__addedObjectPreviewContextMenuItems=true;contextMenu.appendItem(WebInspector.UIString("Log Value"),()=>{let isImpossible=!this._propertyPath||this._propertyPath.isFullPathImpossible();let text=isImpossible?WebInspector.UIString("Selected Value"):this._propertyPath.displayPath(WebInspector.PropertyPath.Type.Value);if(!isImpossible)
WebInspector.quickConsole.prompt.pushHistoryItem(text);WebInspector.consoleLogViewController.appendImmediateExecutionWithResult(text,this._remoteObject,isImpossible);});}};WebInspector.ObjectPreviewView.Mode={Brief:Symbol("object-preview-brief"),Full:Symbol("object-preview-full"),};WebInspector.ObjectPropertiesDetailSectionRow=class ObjectPropertiesDetailSectionRow extends WebInspector.DetailsSectionRow
{constructor(objectTree,sectionForDeferredExpand)
{super();this._objectTree=objectTree;this.hideEmptyMessage();this.element.classList.add("properties",WebInspector.SyntaxHighlightedStyleClassName);this.element.appendChild(objectTree.element);if(sectionForDeferredExpand&&sectionForDeferredExpand.collapsed)
sectionForDeferredExpand.addEventListener(WebInspector.DetailsSection.Event.CollapsedStateChanged,this._detailsSectionCollapsedStateChanged,this);else
this._objectTree.expand();}
get objectTree(){return this._objectTree;}
_detailsSectionCollapsedStateChanged(event)
{this._objectTree.expand();event.target.removeEventListener(WebInspector.DetailsSection.Event.CollapsedStateChanged,this._detailsSectionCollapsedStateChanged,this);}};WebInspector.ObjectTreeArrayIndexTreeElement=class ObjectTreeArrayIndexTreeElement extends WebInspector.ObjectTreeBaseTreeElement
{constructor(property,propertyPath)
{super(property,propertyPath,property);this.mainTitle=this._titleFragment();this.addClassName("object-tree-property");this.addClassName("object-tree-array-index");if(!this.property.hasValue())
this.addClassName("accessor");}
invokedGetter()
{this.mainTitle=this._titleFragment();this.removeClassName("accessor");}
_titleFragment()
{var container=document.createDocumentFragment();var nameElement=container.appendChild(document.createElement("span"));nameElement.className="index-name";nameElement.textContent=this.property.name;nameElement.title=this.propertyPathString(this.thisPropertyPath());container.append(" ");var valueElement=container.appendChild(document.createElement("span"));valueElement.className="index-value";var resolvedValue=this.resolvedValue();if(resolvedValue)
valueElement.appendChild(WebInspector.FormattedValue.createObjectTreeOrFormattedValueForRemoteObject(resolvedValue,this.resolvedValuePropertyPath()));else{if(this.property.hasGetter())
container.appendChild(this.createGetterElement(true));if(this.property.hasSetter())
container.appendChild(this.createSetterElement());}
valueElement.classList.add("value");if(this.hadError())
valueElement.classList.add("error");return container;}};WebInspector.ObjectTreeMapEntryTreeElement=class ObjectTreeMapEntryTreeElement extends WebInspector.ObjectTreeBaseTreeElement
{constructor(object,propertyPath)
{super(object,propertyPath);this._object=object;this.addClassName("object-tree-array-index");this.addClassName("object-tree-map-entry");}
get object()
{return this._object;}
resolvedValue()
{return this._object;}
propertyPathType()
{return WebInspector.PropertyPath.Type.Value;}
titleFragment()
{var container=document.createDocumentFragment();var propertyPath=this.resolvedValuePropertyPath();var nameElement=container.appendChild(document.createElement("span"));nameElement.className="index-name";nameElement.textContent=this.displayPropertyName();nameElement.title=this.propertyPathString(propertyPath);container.append(" ");var valueElement=container.appendChild(document.createElement("span"));valueElement.className="index-value";valueElement.appendChild(WebInspector.FormattedValue.createObjectTreeOrFormattedValueForRemoteObject(this._object,propertyPath));return container;}};WebInspector.ObjectTreeMapKeyTreeElement=class ObjectTreeMapKeyTreeElement extends WebInspector.ObjectTreeMapEntryTreeElement
{constructor(object,propertyPath)
{super(object,propertyPath);this.mainTitle=this.titleFragment();this.addClassName("key");}
displayPropertyName()
{return WebInspector.UIString("key");}
resolvedValuePropertyPath()
{return this._propertyPath.appendMapKey(this._object);}};WebInspector.ObjectTreeMapValueTreeElement=class ObjectTreeMapValueTreeElement extends WebInspector.ObjectTreeMapEntryTreeElement
{constructor(object,propertyPath,key)
{super(object,propertyPath);this._key=key;this.mainTitle=this.titleFragment();this.addClassName("value");}
displayPropertyName()
{return WebInspector.UIString("value");}
resolvedValuePropertyPath()
{return this._propertyPath.appendMapValue(this._object,this._key);}};WebInspector.ObjectTreePropertyTreeElement=class ObjectTreePropertyTreeElement extends WebInspector.ObjectTreeBaseTreeElement
{constructor(property,propertyPath,mode,prototypeName)
{super(property,propertyPath,property);this._mode=mode||WebInspector.ObjectTreeView.Mode.Properties;this._prototypeName=prototypeName;this.mainTitle=this._titleFragment();this.addClassName("object-tree-property");if(this.property.hasValue()){this.addClassName(this.property.value.type);if(this.property.value.subtype)
this.addClassName(this.property.value.subtype);}else
this.addClassName("accessor");if(this.property.wasThrown)
this.addClassName("had-error");if(this.property.name==="__proto__")
this.addClassName("prototype-property");this._updateTooltips();this._updateHasChildren();}
onpopulate()
{this._updateChildren();}
onexpand()
{if(this._previewView)
this._previewView.showTitle();}
oncollapse()
{if(this._previewView)
this._previewView.showPreview();}
invokedGetter()
{this.mainTitle=this._titleFragment();var resolvedValue=this.resolvedValue();this.addClassName(resolvedValue.type);if(resolvedValue.subtype)
this.addClassName(resolvedValue.subtype);if(this.hadError())
this.addClassName("had-error");this.removeClassName("accessor");this._updateHasChildren();}
_updateHasChildren()
{var resolvedValue=this.resolvedValue();var valueHasChildren=(resolvedValue&&resolvedValue.hasChildren);var wasThrown=this.hadError();if(this._mode===WebInspector.ObjectTreeView.Mode.Properties)
this.hasChildren=!wasThrown&&valueHasChildren;else
this.hasChildren=!wasThrown&&valueHasChildren&&(this.property.name==="__proto__"||this._alwaysDisplayAsProperty());}
_updateTooltips()
{var attributes=[];if(this.property.configurable)
attributes.push("configurable");if(this.property.enumerable)
attributes.push("enumerable");if(this.property.writable)
attributes.push("writable");this.iconElement.title=attributes.join(" ");}
_titleFragment()
{if(this.property.name==="__proto__")
return this._createTitlePrototype();if(this._mode===WebInspector.ObjectTreeView.Mode.Properties)
return this._createTitlePropertyStyle();else
return this._createTitleAPIStyle();}
_createTitlePrototype()
{var nameElement=document.createElement("span");nameElement.className="prototype-name";nameElement.textContent=WebInspector.UIString("%s Prototype").format(this._sanitizedPrototypeString(this.property.value));nameElement.title=this.propertyPathString(this.thisPropertyPath());return nameElement;}
_createTitlePropertyStyle()
{var container=document.createDocumentFragment();var nameElement=document.createElement("span");nameElement.className="property-name";nameElement.textContent=this.property.name+": ";nameElement.title=this.propertyPathString(this.thisPropertyPath());if(this._mode===WebInspector.ObjectTreeView.Mode.Properties){if(!this.property.enumerable)
nameElement.classList.add("not-enumerable");}
var valueOrGetterElement;var resolvedValue=this.resolvedValue();if(resolvedValue){if(resolvedValue.preview){this._previewView=new WebInspector.ObjectPreviewView(resolvedValue.preview);valueOrGetterElement=this._previewView.element;}else{this._loadPreviewLazilyIfNeeded();valueOrGetterElement=WebInspector.FormattedValue.createElementForRemoteObject(resolvedValue,this.hadError());if(resolvedValue.type==="function")
valueOrGetterElement.textContent=this._functionPropertyString();}}else{valueOrGetterElement=document.createElement("span");if(this.property.hasGetter())
valueOrGetterElement.appendChild(this.createGetterElement(this._mode!==WebInspector.ObjectTreeView.Mode.ClassAPI));if(this.property.hasSetter())
valueOrGetterElement.appendChild(this.createSetterElement());}
valueOrGetterElement.classList.add("value");if(this.hadError())
valueOrGetterElement.classList.add("error");container.appendChild(nameElement);container.appendChild(valueOrGetterElement);return container;}
_createTitleAPIStyle()
{if(this._alwaysDisplayAsProperty())
return this._createTitlePropertyStyle();var isFunction=this.property.hasValue()&&this.property.value.type==="function";if(!isFunction&&!this.property.hasGetter()&&!this.property.hasSetter())
return null;var container=document.createDocumentFragment();var nameElement=document.createElement("span");nameElement.className="property-name";nameElement.textContent=this.property.name;nameElement.title=this.propertyPathString(this.thisPropertyPath());container.appendChild(nameElement);if(isFunction){var paramElement=document.createElement("span");paramElement.className="function-parameters";paramElement.textContent=this._functionParameterString();container.appendChild(paramElement);}else{var spacer=container.appendChild(document.createElement("span"));spacer.className="spacer";if(this.property.hasGetter())
container.appendChild(this.createGetterElement(this._mode!==WebInspector.ObjectTreeView.Mode.ClassAPI));if(this.property.hasSetter())
container.appendChild(this.createSetterElement());}
return container;}
_loadPreviewLazilyIfNeeded()
{let resolvedValue=this.resolvedValue();if(!resolvedValue.canLoadPreview())
return;resolvedValue.updatePreview((preview)=>{if(preview){this.mainTitle=this._titleFragment();if(this.expanded)
this._previewView.showTitle();}});}
_alwaysDisplayAsProperty()
{if(this.property.name==="constructor")
return true;if(this.property.hasValue()&&this.property.value.type!=="function")
return true;if(this._getterValue)
return true;return false;}
_functionPropertyString()
{return"function"+this._functionParameterString();}
_functionParameterString()
{var resolvedValue=this.resolvedValue();if(isFunctionStringNativeCode(resolvedValue.description)){if(this._prototypeName){if(WebInspector.NativePrototypeFunctionParameters[this._prototypeName]){var params=WebInspector.NativePrototypeFunctionParameters[this._prototypeName][this._property.name];return params?"("+params+")":"()";}}
var parentDescription=this._propertyPath.object.description;if(isFunctionStringNativeCode(parentDescription)){var match=parentDescription.match(/^function\s+([^)]+?)\(/);if(match){var name=match[1];if(WebInspector.NativeConstructorFunctionParameters[name]){var params=WebInspector.NativeConstructorFunctionParameters[name][this._property.name];return params?"("+params+")":"()";}}}
if(parentDescription.endsWith("Constructor")||["Math","JSON","Reflect","Console"].includes(parentDescription)){var name=parentDescription;if(WebInspector.NativeConstructorFunctionParameters[name]){var params=WebInspector.NativeConstructorFunctionParameters[name][this._property.name];return params?"("+params+")":"()";}}}
var match=resolvedValue.functionDescription.match(/^function.*?(\([^)]*?\))/);return match?match[1]:"()";}
_sanitizedPrototypeString(value)
{ if(value.type==="function")
return"Function";if(value.subtype==="date")
return"Date";if(value.subtype==="regexp")
return"RegExp";return value.description.replace(/Prototype$/,"");}
_updateChildren()
{if(this.children.length&&!this.shouldRefreshChildren)
return;var resolvedValue=this.resolvedValue();if(resolvedValue.isCollectionType()&&this._mode===WebInspector.ObjectTreeView.Mode.Properties)
resolvedValue.getCollectionEntries(0,100,this._updateChildrenInternal.bind(this,this._updateEntries,this._mode));else if(this._mode===WebInspector.ObjectTreeView.Mode.ClassAPI||this._mode===WebInspector.ObjectTreeView.Mode.PureAPI)
resolvedValue.getOwnPropertyDescriptors(this._updateChildrenInternal.bind(this,this._updateProperties,WebInspector.ObjectTreeView.Mode.ClassAPI));else if(this.property.name==="__proto__")
resolvedValue.getOwnPropertyDescriptors(this._updateChildrenInternal.bind(this,this._updateProperties,WebInspector.ObjectTreeView.Mode.PrototypeAPI));else
resolvedValue.getDisplayablePropertyDescriptors(this._updateChildrenInternal.bind(this,this._updateProperties,this._mode));}
_updateChildrenInternal(handler,mode,list)
{this.removeChildren();if(!list){var errorMessageElement=WebInspector.ObjectTreeView.createEmptyMessageElement(WebInspector.UIString("Could not fetch properties. Object may no longer exist."));this.appendChild(new WebInspector.TreeElement(errorMessageElement,null,false));return;}
handler.call(this,list,this.resolvedValuePropertyPath(),mode);}
_updateEntries(entries,propertyPath,mode)
{for(var entry of entries){if(entry.key){this.appendChild(new WebInspector.ObjectTreeMapKeyTreeElement(entry.key,propertyPath));this.appendChild(new WebInspector.ObjectTreeMapValueTreeElement(entry.value,propertyPath,entry.key));}else
this.appendChild(new WebInspector.ObjectTreeSetIndexTreeElement(entry.value,propertyPath));}
if(!this.children.length){var emptyMessageElement=WebInspector.ObjectTreeView.createEmptyMessageElement(WebInspector.UIString("No Entries"));this.appendChild(new WebInspector.TreeElement(emptyMessageElement,null,false));}
var resolvedValue=this.resolvedValue();resolvedValue.getOwnPropertyDescriptor("__proto__",(propertyDescriptor)=>{if(propertyDescriptor)
this.appendChild(new WebInspector.ObjectTreePropertyTreeElement(propertyDescriptor,propertyPath,mode));});}
_updateProperties(properties,propertyPath,mode)
{properties.sort(WebInspector.ObjectTreeView.comparePropertyDescriptors);var resolvedValue=this.resolvedValue();var isArray=resolvedValue.isArray();var isPropertyMode=mode===WebInspector.ObjectTreeView.Mode.Properties||this._getterValue;var isAPI=mode!==WebInspector.ObjectTreeView.Mode.Properties;var prototypeName;if(this.property.name==="__proto__"){if(resolvedValue.description)
prototypeName=this._sanitizedPrototypeString(resolvedValue);}
var hadProto=false;for(var propertyDescriptor of properties){
if(isAPI&&propertyDescriptor.nativeGetter)
continue;if(propertyDescriptor.name==="__proto__"&&!propertyDescriptor.hasValue())
continue;if(isArray&&isPropertyMode){if(propertyDescriptor.isIndexProperty())
this.appendChild(new WebInspector.ObjectTreeArrayIndexTreeElement(propertyDescriptor,propertyPath));else if(propertyDescriptor.name==="__proto__")
this.appendChild(new WebInspector.ObjectTreePropertyTreeElement(propertyDescriptor,propertyPath,mode,prototypeName));}else
this.appendChild(new WebInspector.ObjectTreePropertyTreeElement(propertyDescriptor,propertyPath,mode,prototypeName));if(propertyDescriptor.name==="__proto__")
hadProto=true;}
if(!this.children.length||(hadProto&&this.children.length===1)){var emptyMessageElement=WebInspector.ObjectTreeView.createEmptyMessageElement(WebInspector.UIString("No Properties"));this.insertChild(new WebInspector.TreeElement(emptyMessageElement,null,false),0);}}};WebInspector.ObjectTreeSetIndexTreeElement=class ObjectTreeSetIndexTreeElement extends WebInspector.ObjectTreeBaseTreeElement
{constructor(object,propertyPath)
{super(object,propertyPath);this._object=object;this.mainTitle=this._titleFragment();this.addClassName("object-tree-array-index");}
get object()
{return this._object;}
resolvedValue()
{return this._object;}
resolvedValuePropertyPath()
{return this.propertyPath.appendSetIndex(this._object);}
_titleFragment()
{var container=document.createDocumentFragment();var propertyPath=this.resolvedValuePropertyPath();var nameElement=container.appendChild(document.createElement("span"));nameElement.className="index-name";nameElement.textContent="\u2022";nameElement.title=WebInspector.UIString("Unable to determine path to property from root");container.append(" ");var valueElement=container.appendChild(document.createElement("span"));valueElement.className="index-value";valueElement.appendChild(WebInspector.FormattedValue.createObjectTreeOrFormattedValueForRemoteObject(this._object,propertyPath));return container;}};WebInspector.ObjectTreeView=class ObjectTreeView extends WebInspector.Object
{constructor(object,mode,propertyPath,forceExpanding)
{super();var providedPropertyPath=propertyPath instanceof WebInspector.PropertyPath;this._object=object;this._mode=mode||WebInspector.ObjectTreeView.defaultModeForObject(object);this._propertyPath=propertyPath||new WebInspector.PropertyPath(this._object,"this");this._expanded=false;this._hasLosslessPreview=false;this._includeProtoProperty=true;
this._inConsole=true;if(this._object.isClass())
forceExpanding=true;this._element=document.createElement("div");this._element.className="object-tree";if(this._object.preview){this._previewView=new WebInspector.ObjectPreviewView(this._object.preview);this._previewView.setOriginatingObjectInfo(this._object,providedPropertyPath?propertyPath:null);this._previewView.element.addEventListener("click",this._handlePreviewOrTitleElementClick.bind(this));this._element.appendChild(this._previewView.element);if(this._previewView.lossless&&!this._propertyPath.parent&&!forceExpanding){this._hasLosslessPreview=true;this.element.classList.add("lossless-preview");}}else{this._titleElement=document.createElement("span");this._titleElement.className="title";this._titleElement.appendChild(WebInspector.FormattedValue.createElementForRemoteObject(this._object));this._titleElement.addEventListener("click",this._handlePreviewOrTitleElementClick.bind(this));this._element.appendChild(this._titleElement);}
this._outline=new WebInspector.TreeOutline;this._outline.compact=true;this._outline.customIndent=true;this._outline.element.classList.add("object");this._element.appendChild(this._outline.element);}
static defaultModeForObject(object)
{if(object.subtype==="class")
return WebInspector.ObjectTreeView.Mode.ClassAPI;return WebInspector.ObjectTreeView.Mode.Properties;}
static createEmptyMessageElement(message)
{var emptyMessageElement=document.createElement("div");emptyMessageElement.className="empty-message";emptyMessageElement.textContent=message;return emptyMessageElement;}
static comparePropertyDescriptors(propertyA,propertyB)
{var a=propertyA.name;var b=propertyB.name;if(a==="__proto__")
return 1;if(b==="__proto__")
return-1;if(propertyA.isInternalProperty&&!propertyB.isInternalProperty)
return-1;if(propertyB.isInternalProperty&&!propertyA.isInternalProperty)
return 1;if(propertyA.symbol&&!propertyB.symbol)
return 1;if(propertyB.symbol&&!propertyA.symbol)
return-1;if(a===b)
return 0;var diff=0;var chunk=/^\d+|^\D+/;var chunka,chunkb,anum,bnum;while(diff===0){if(!a&&b)
return-1;if(!b&&a)
return 1;chunka=a.match(chunk)[0];chunkb=b.match(chunk)[0];anum=!isNaN(chunka);bnum=!isNaN(chunkb);if(anum&&!bnum)
return-1;if(bnum&&!anum)
return 1;if(anum&&bnum){diff=chunka-chunkb;if(diff===0&&chunka.length!==chunkb.length){if(!+chunka&&!+chunkb)
return chunka.length-chunkb.length;else
return chunkb.length-chunka.length;}}else if(chunka!==chunkb)
return(chunka<chunkb)?-1:1;a=a.substring(chunka.length);b=b.substring(chunkb.length);}
return diff;}
get object()
{return this._object;}
get element()
{return this._element;}
get treeOutline()
{return this._outline;}
get expanded()
{return this._expanded;}
expand()
{if(this._expanded)
return;if(this._hasLosslessPreview)
return;this._expanded=true;this._element.classList.add("expanded");if(this._previewView)
this._previewView.showTitle();this._trackWeakEntries();this.update();}
collapse()
{if(!this._expanded)
return;this._expanded=false;this._element.classList.remove("expanded");if(this._previewView)
this._previewView.showPreview();this._untrackWeakEntries();}
showOnlyProperties()
{this._inConsole=false;this._element.classList.add("properties-only");this._includeProtoProperty=false;}
appendTitleSuffix(suffixElement)
{if(this._previewView)
this._previewView.element.appendChild(suffixElement);else
this._titleElement.appendChild(suffixElement);}
appendExtraPropertyDescriptor(propertyDescriptor)
{if(!this._extraProperties)
this._extraProperties=[];this._extraProperties.push(propertyDescriptor);}
setPrototypeNameOverride(override)
{this._prototypeNameOverride=override;}
update()
{if(this._object.isCollectionType()&&this._mode===WebInspector.ObjectTreeView.Mode.Properties)
this._object.getCollectionEntries(0,100,this._updateChildren.bind(this,this._updateEntries));else if(this._object.isClass())
this._object.classPrototype.getDisplayablePropertyDescriptors(this._updateChildren.bind(this,this._updateProperties));else if(this._mode===WebInspector.ObjectTreeView.Mode.PureAPI)
this._object.getOwnPropertyDescriptors(this._updateChildren.bind(this,this._updateProperties));else
this._object.getDisplayablePropertyDescriptors(this._updateChildren.bind(this,this._updateProperties));}
_updateChildren(handler,list)
{this._outline.removeChildren();if(!list){var errorMessageElement=WebInspector.ObjectTreeView.createEmptyMessageElement(WebInspector.UIString("Could not fetch properties. Object may no longer exist."));this._outline.appendChild(new WebInspector.TreeElement(errorMessageElement,null,false));return;}
handler.call(this,list,this._propertyPath);this.dispatchEventToListeners(WebInspector.ObjectTreeView.Event.Updated);}
_updateEntries(entries,propertyPath)
{for(var entry of entries){if(entry.key){this._outline.appendChild(new WebInspector.ObjectTreeMapKeyTreeElement(entry.key,propertyPath));this._outline.appendChild(new WebInspector.ObjectTreeMapValueTreeElement(entry.value,propertyPath,entry.key));}else
this._outline.appendChild(new WebInspector.ObjectTreeSetIndexTreeElement(entry.value,propertyPath));}
if(!this._outline.children.length){var emptyMessageElement=WebInspector.ObjectTreeView.createEmptyMessageElement(WebInspector.UIString("No Entries"));this._outline.appendChild(new WebInspector.TreeElement(emptyMessageElement,null,false));}
this._object.getOwnPropertyDescriptor("__proto__",(propertyDescriptor)=>{if(propertyDescriptor)
this._outline.appendChild(new WebInspector.ObjectTreePropertyTreeElement(propertyDescriptor,propertyPath,this._mode));});}
_updateProperties(properties,propertyPath)
{if(this._extraProperties)
properties=properties.concat(this._extraProperties);properties.sort(WebInspector.ObjectTreeView.comparePropertyDescriptors);var isArray=this._object.isArray();var isPropertyMode=this._mode===WebInspector.ObjectTreeView.Mode.Properties;var hadProto=false;for(var propertyDescriptor of properties){if(propertyDescriptor.name==="__proto__"){if(!propertyDescriptor.hasValue())
continue;if(!this._includeProtoProperty)
continue;hadProto=true;}
if(isArray&&isPropertyMode){if(propertyDescriptor.isIndexProperty())
this._outline.appendChild(new WebInspector.ObjectTreeArrayIndexTreeElement(propertyDescriptor,propertyPath));else if(propertyDescriptor.name==="__proto__")
this._outline.appendChild(new WebInspector.ObjectTreePropertyTreeElement(propertyDescriptor,propertyPath,this._mode,this._prototypeNameOverride));}else
this._outline.appendChild(new WebInspector.ObjectTreePropertyTreeElement(propertyDescriptor,propertyPath,this._mode,this._prototypeNameOverride));}
if(!this._outline.children.length||(hadProto&&this._outline.children.length===1)){var emptyMessageElement=WebInspector.ObjectTreeView.createEmptyMessageElement(WebInspector.UIString("No Properties"));this._outline.insertChild(new WebInspector.TreeElement(emptyMessageElement,null,false),0);}}
_handlePreviewOrTitleElementClick(event)
{if(this._hasLosslessPreview)
return;if(!this._expanded)
this.expand();else
this.collapse();event.stopPropagation();}
_trackWeakEntries()
{if(this._trackingEntries)
return;if(!this._object.isWeakCollection())
return;this._trackingEntries=true;if(this._inConsole){WebInspector.logManager.addEventListener(WebInspector.LogManager.Event.Cleared,this._untrackWeakEntries,this);WebInspector.logManager.addEventListener(WebInspector.LogManager.Event.SessionStarted,this._untrackWeakEntries,this);}}
_untrackWeakEntries()
{if(!this._trackingEntries)
return;if(!this._object.isWeakCollection())
return;this._trackingEntries=false;this._object.releaseWeakCollectionEntries();if(this._inConsole){WebInspector.logManager.removeEventListener(WebInspector.LogManager.Event.Cleared,this._untrackWeakEntries,this);WebInspector.logManager.removeEventListener(WebInspector.LogManager.Event.SessionStarted,this._untrackWeakEntries,this);}
}};WebInspector.ObjectTreeView.Mode={Properties:Symbol("object-tree-properties"), PrototypeAPI:Symbol("object-tree-prototype-api"),ClassAPI:Symbol("object-tree-class-api"),PureAPI:Symbol("object-tree-pure-api"),};WebInspector.ObjectTreeView.Event={Updated:"object-tree-updated",};WebInspector.OpenResourceDialog=class OpenResourceDialog extends WebInspector.Dialog
{constructor(delegate)
{super(delegate);this.element.classList.add("open-resource-dialog");let fieldElement=this.element.appendChild(document.createElement("div"));fieldElement.classList.add("field");this._inputElement=fieldElement.appendChild(document.createElement("input"));this._inputElement.type="text";this._inputElement.placeholder=WebInspector.UIString("File or Resource");this._inputElement.spellcheck=false;this._clearIconElement=fieldElement.appendChild(document.createElement("img"));this._inputElement.addEventListener("keydown",this._handleKeydownEvent.bind(this));this._inputElement.addEventListener("keyup",this._handleKeyupEvent.bind(this));this._inputElement.addEventListener("blur",this._handleBlurEvent.bind(this));this._clearIconElement.addEventListener("mousedown",this._handleMousedownEvent.bind(this));this._clearIconElement.addEventListener("click",this._handleClickEvent.bind(this));this._treeOutline=new WebInspector.TreeOutline;this._treeOutline.allowsRepeatSelection=true;this._treeOutline.disclosureButtons=false;this._treeOutline.large=true;this._treeOutline.addEventListener(WebInspector.TreeOutline.Event.SelectionDidChange,this._treeSelectionDidChange,this);this._treeOutline.element.addEventListener("focus",()=>{this._inputElement.focus();});this.element.appendChild(this._treeOutline.element);this._queryController=new WebInspector.ResourceQueryController;this._filteredResults=[];}
_populateResourceTreeOutline()
{function createHighlightedTitleFragment(title,highlightTextRanges)
{let titleFragment=document.createDocumentFragment();let lastIndex=0;for(let textRange of highlightTextRanges){if(textRange.startColumn>lastIndex)
titleFragment.append(title.substring(lastIndex,textRange.startColumn));let highlightSpan=document.createElement("span");highlightSpan.classList.add("highlighted");highlightSpan.append(title.substring(textRange.startColumn,textRange.endColumn));titleFragment.append(highlightSpan);lastIndex=textRange.endColumn;}
if(lastIndex<title.length)
titleFragment.append(title.substring(lastIndex,title.length));return titleFragment;}
function createTreeElement(representedObject)
{let treeElement=null;if(representedObject instanceof WebInspector.SourceMapResource)
treeElement=new WebInspector.SourceMapResourceTreeElement(representedObject);else if(representedObject instanceof WebInspector.Resource)
treeElement=new WebInspector.ResourceTreeElement(representedObject);else if(representedObject instanceof WebInspector.Script)
treeElement=new WebInspector.ScriptTreeElement(representedObject);return treeElement;}
for(let result of this._filteredResults){let resource=result.resource;if(this._treeOutline.findTreeElement(resource))
continue;let treeElement=createTreeElement(resource);if(!treeElement)
continue;treeElement.mainTitle=createHighlightedTitleFragment(resource.displayName,result.matchingTextRanges);treeElement[WebInspector.OpenResourceDialog.ResourceMatchCookieDataSymbol]=result.cookie;this._treeOutline.appendChild(treeElement);}
if(this._treeOutline.children.length)
this._treeOutline.children[0].select(true,false,true,true);}
didDismissDialog()
{WebInspector.Frame.removeEventListener(WebInspector.Frame.Event.MainResourceDidChange,this._mainResourceDidChange,this);WebInspector.Frame.removeEventListener(WebInspector.Frame.Event.ResourceWasAdded,this._resourceWasAdded,this);WebInspector.Target.removeEventListener(WebInspector.Target.Event.ResourceAdded,this._resourceWasAdded,this);WebInspector.debuggerManager.removeEventListener(WebInspector.DebuggerManager.Event.ScriptAdded,this._scriptAdded,this);this._queryController.reset();}
didPresentDialog()
{WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange,this._mainResourceDidChange,this);WebInspector.Frame.addEventListener(WebInspector.Frame.Event.ResourceWasAdded,this._resourceWasAdded,this);WebInspector.Target.addEventListener(WebInspector.Target.Event.ResourceAdded,this._resourceWasAdded,this);WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ScriptAdded,this._scriptAdded,this);if(WebInspector.frameResourceManager.mainFrame)
this._addResourcesForFrame(WebInspector.frameResourceManager.mainFrame);for(let target of WebInspector.targets){if(target!==WebInspector.mainTarget)
this._addResourcesForTarget(target);}
this._updateFilter();this._inputElement.focus();this._clear();}
_handleKeydownEvent(event)
{if(event.keyCode===WebInspector.KeyboardShortcut.Key.Escape.keyCode){if(this._inputElement.value==="")
this.dismiss();else
this._clear();event.preventDefault();}else if(event.keyCode===WebInspector.KeyboardShortcut.Key.Enter.keyCode){if(this._treeOutline.selectedTreeElement){this.dismiss(this._treeOutline.selectedTreeElement.representedObject,this._treeOutline.selectedTreeElement[WebInspector.OpenResourceDialog.ResourceMatchCookieDataSymbol]);event.preventDefault();return;}
if(/^:\d/.test(this._inputElement.value)){let visibleContentView=WebInspector.focusedOrVisibleContentView();let representedObject=visibleContentView?visibleContentView.representedObject:null;if(representedObject&&representedObject instanceof WebInspector.SourceCode){let[,lineNumber,columnNumber]=this._inputElement.value.split(":");lineNumber=lineNumber?parseInt(lineNumber,10)-1:0;columnNumber=columnNumber?parseInt(columnNumber,10)-1:0;this.dismiss(representedObject,{lineNumber,columnNumber});event.preventDefault();return;}}
this._inputElement.select();}else if(event.keyCode===WebInspector.KeyboardShortcut.Key.Up.keyCode||event.keyCode===WebInspector.KeyboardShortcut.Key.Down.keyCode){let treeElement=this._treeOutline.selectedTreeElement;if(!treeElement)
return;let adjacentSiblingProperty=event.keyCode===WebInspector.KeyboardShortcut.Key.Up.keyCode?"previousSibling":"nextSibling";treeElement=treeElement[adjacentSiblingProperty];if(treeElement)
treeElement.revealAndSelect(true,false,true,true);event.preventDefault();}}
_handleKeyupEvent(event)
{if(event.keyCode===WebInspector.KeyboardShortcut.Key.Up.keyCode||event.keyCode===WebInspector.KeyboardShortcut.Key.Down.keyCode)
return;this._updateFilter();}
_handleBlurEvent(event)
{if(event.relatedTarget===this._treeOutline.element)
return;this.dismiss();}
_handleMousedownEvent(event)
{this._inputElement.select();
event.preventDefault();}
_handleClickEvent(event)
{this._clear();}
_clear()
{this._inputElement.value="";this._updateFilter();}
_updateFilter()
{this._filteredResults=[];this._treeOutline.removeChildren();let filterText=this._inputElement.value.trim();if(filterText){this._filteredResults=this._queryController.executeQuery(filterText);this._populateResourceTreeOutline();}
this.element.classList.toggle("non-empty",this._inputElement.value!=="");this.element.classList.toggle("has-results",this._treeOutline.children.length);}
_treeSelectionDidChange(event)
{let treeElement=event.data.selectedElement;if(!treeElement)
return;if(!event.data.selectedByUser)
return;this.dismiss(treeElement.representedObject,treeElement[WebInspector.OpenResourceDialog.ResourceMatchCookieDataSymbol]);}
_addResource(resource,suppressFilterUpdate)
{if(!this.representedObjectIsValid(resource))
return;this._queryController.addResource(resource);if(suppressFilterUpdate)
return;this._updateFilter();}
_addResourcesForFrame(frame)
{const suppressFilterUpdate=true;let frames=[frame];while(frames.length){let currentFrame=frames.shift();let resources=[currentFrame.mainResource].concat(Array.from(currentFrame.resourceCollection.items));for(let resource of resources)
this._addResource(resource,suppressFilterUpdate);frames=frames.concat(currentFrame.childFrameCollection.toArray());}}
_addResourcesForTarget(target)
{const suppressFilterUpdate=true;this._addResource(target.mainResource);for(let resource of target.resourceCollection.items)
this._addResource(resource,suppressFilterUpdate);let targetData=WebInspector.debuggerManager.dataForTarget(target);for(let script of targetData.scripts){if(script.resource)
continue;if(isWebKitInternalScript(script.sourceURL)||isWebInspectorConsoleEvaluationScript(script.sourceURL))
continue;this._addResource(script,suppressFilterUpdate);}}
_mainResourceDidChange(event)
{if(event.target.isMainFrame())
this._queryController.reset();this._addResource(event.target.mainResource);}
_resourceWasAdded(event)
{this._addResource(event.data.resource);}
_scriptAdded(event)
{let script=event.data.script;if(script.resource)
return;if(script.target===WebInspector.mainTarget)
return;this._addResource(script);}};WebInspector.OpenResourceDialog.ResourceMatchCookieDataSymbol=Symbol("open-resource-dialog-resource-match-cookie-data");WebInspector.OverviewTimelineView=class OverviewTimelineView extends WebInspector.TimelineView
{constructor(recording,extraArguments)
{super(recording,extraArguments);this._recording=recording;let columns={name:{},graph:{}};columns.name.title=WebInspector.UIString("Name");columns.name.width="20%";columns.name.icon=true;columns.name.disclosure=true;this._timelineRuler=new WebInspector.TimelineRuler;this._timelineRuler.allowsClippedLabels=true;columns.graph.width="80%";columns.graph.headerView=this._timelineRuler;this._dataGrid=new WebInspector.DataGrid(columns);this.setupDataGrid(this._dataGrid);this._currentTimeMarker=new WebInspector.TimelineMarker(0,WebInspector.TimelineMarker.Type.CurrentTime);this._timelineRuler.addMarker(this._currentTimeMarker);this.element.classList.add("overview");this.addSubview(this._dataGrid);this._networkTimeline=recording.timelines.get(WebInspector.TimelineRecord.Type.Network);if(this._networkTimeline)
this._networkTimeline.addEventListener(WebInspector.Timeline.Event.RecordAdded,this._networkTimelineRecordAdded,this);recording.addEventListener(WebInspector.TimelineRecording.Event.SourceCodeTimelineAdded,this._sourceCodeTimelineAdded,this);recording.addEventListener(WebInspector.TimelineRecording.Event.MarkerAdded,this._markerAdded,this);recording.addEventListener(WebInspector.TimelineRecording.Event.Reset,this._recordingReset,this);this._pendingRepresentedObjects=[];this._resourceDataGridNodeMap=new Map;}
get secondsPerPixel()
{return this._timelineRuler.secondsPerPixel;}
set secondsPerPixel(x)
{this._timelineRuler.secondsPerPixel=x;}
shown()
{super.shown();this._timelineRuler.updateLayout(WebInspector.View.LayoutReason.Resize);}
closed()
{if(this._networkTimeline)
this._networkTimeline.removeEventListener(null,null,this);this._recording.removeEventListener(null,null,this);}
get selectionPathComponents()
{let dataGridNode=this._dataGrid.selectedNode;if(!dataGridNode||dataGridNode.hidden)
return null;let pathComponents=[];while(dataGridNode&&!dataGridNode.root){if(dataGridNode.hidden)
return null;let pathComponent=new WebInspector.TimelineDataGridNodePathComponent(dataGridNode);pathComponent.addEventListener(WebInspector.HierarchicalPathComponent.Event.SiblingWasSelected,this.dataGridNodePathComponentSelected,this);pathComponents.unshift(pathComponent);dataGridNode=dataGridNode.parent;}
return pathComponents;}
reset()
{super.reset();this._dataGrid.removeChildren();this._pendingRepresentedObjects=[];}
dataGridNodePathComponentSelected(event)
{let dataGridNode=event.data.pathComponent.timelineDataGridNode;dataGridNode.revealAndSelect();}
layout()
{let oldZeroTime=this._timelineRuler.zeroTime;let oldStartTime=this._timelineRuler.startTime;let oldEndTime=this._timelineRuler.endTime;let oldCurrentTime=this._currentTimeMarker.time;this._timelineRuler.zeroTime=this.zeroTime;this._timelineRuler.startTime=this.startTime;this._timelineRuler.endTime=this.endTime;this._currentTimeMarker.time=this.currentTime;if(this.zeroTime!==oldZeroTime||this.startTime!==oldStartTime||this.endTime!==oldEndTime||this.currentTime!==oldCurrentTime){let dataGridNode=this._dataGrid.children[0];while(dataGridNode){dataGridNode.refreshGraph();dataGridNode=dataGridNode.traverseNextNode(true,null,true);}}
this._processPendingRepresentedObjects();}
_compareDataGridNodesByStartTime(a,b)
{function getStartTime(dataGridNode)
{if(dataGridNode instanceof WebInspector.ResourceTimelineDataGridNode)
return dataGridNode.resource.firstTimestamp;if(dataGridNode instanceof WebInspector.SourceCodeTimelineTimelineDataGridNode)
return dataGridNode.sourceCodeTimeline.startTime;console.error("Unknown data grid node.",dataGridNode);return 0;}
let result=getStartTime(a)-getStartTime(b);if(result)
return result;return a.displayName().extendedLocaleCompare(b.displayName());}
_insertDataGridNode(dataGridNode,parentDataGridNode)
{if(parentDataGridNode)
parentDataGridNode.insertChild(dataGridNode,insertionIndexForObjectInListSortedByFunction(dataGridNode,parentDataGridNode.children,this._compareDataGridNodesByStartTime.bind(this)));else
this._dataGrid.appendChild(dataGridNode);}
_addResourceToDataGridIfNeeded(resource)
{if(!resource)
return null;let dataGridNode=this._resourceDataGridNodeMap.get(resource);if(dataGridNode)
return dataGridNode;let parentFrame=resource.parentFrame;if(!parentFrame)
return null;let resourceTimelineRecord=this._networkTimeline?this._networkTimeline.recordForResource(resource):null;if(!resourceTimelineRecord)
resourceTimelineRecord=new WebInspector.ResourceTimelineRecord(resource);const includesGraph=true;const shouldShowPopover=false;let resourceDataGridNode=new WebInspector.ResourceTimelineDataGridNode(resourceTimelineRecord,includesGraph,this,shouldShowPopover);this._resourceDataGridNodeMap.set(resource,resourceDataGridNode);let expandedByDefault=false;if(parentFrame.mainResource===resource||parentFrame.provisionalMainResource===resource){parentFrame=parentFrame.parentFrame;expandedByDefault=!parentFrame;}
if(expandedByDefault)
resourceDataGridNode.expand();let parentDataGridNode=null;if(parentFrame){let parentResource=parentFrame.provisionalMainResource||parentFrame.mainResource;parentDataGridNode=this._addResourceToDataGridIfNeeded(parentResource);if(!parentDataGridNode)
return null;}
this._insertDataGridNode(resourceDataGridNode,parentDataGridNode);return resourceDataGridNode;}
_addSourceCodeTimeline(sourceCodeTimeline)
{let parentDataGridNode=sourceCodeTimeline.sourceCodeLocation?this._addResourceToDataGridIfNeeded(sourceCodeTimeline.sourceCode):null;let sourceCodeTimelineDataGridNode=new WebInspector.SourceCodeTimelineTimelineDataGridNode(sourceCodeTimeline,this);this._resourceDataGridNodeMap.set(sourceCodeTimeline,sourceCodeTimelineDataGridNode);this._insertDataGridNode(sourceCodeTimelineDataGridNode,parentDataGridNode);}
_processPendingRepresentedObjects()
{if(!this._pendingRepresentedObjects.length)
return;for(var representedObject of this._pendingRepresentedObjects){if(representedObject instanceof WebInspector.Resource)
this._addResourceToDataGridIfNeeded(representedObject);else if(representedObject instanceof WebInspector.SourceCodeTimeline)
this._addSourceCodeTimeline(representedObject);else
console.error("Unknown represented object");}
this._pendingRepresentedObjects=[];}
_networkTimelineRecordAdded(event)
{var resourceTimelineRecord=event.data.record;this._pendingRepresentedObjects.push(resourceTimelineRecord.resource);this.needsLayout();}
_sourceCodeTimelineAdded(event)
{var sourceCodeTimeline=event.data.sourceCodeTimeline;if(!sourceCodeTimeline)
return;this._pendingRepresentedObjects.push(sourceCodeTimeline);this.needsLayout();}
_markerAdded(event)
{this._timelineRuler.addMarker(event.data.marker);}
_recordingReset(event)
{this._timelineRuler.clearMarkers();this._timelineRuler.addMarker(this._currentTimeMarker);}};WebInspector.ProbeDetailsSidebarPanel=class ProbeDetailsSidebarPanel extends WebInspector.DetailsSidebarPanel
{constructor()
{super("probe",WebInspector.UIString("Probes"));this._probeSetSections=new Map;this._inspectedProbeSets=[];}
get inspectedProbeSets()
{return this._inspectedProbeSets.slice();}
set inspectedProbeSets(newProbeSets)
{for(let probeSet of this._inspectedProbeSets){let removedSection=this._probeSetSections.get(probeSet);removedSection.element.remove();}
this._inspectedProbeSets=newProbeSets;for(let probeSet of newProbeSets){let shownSection=this._probeSetSections.get(probeSet);this.contentView.element.appendChild(shownSection.element);}}
inspect(objects)
{if(!(objects instanceof Array))
objects=[objects];var inspectedProbeSets=objects.filter(function(object){return object instanceof WebInspector.ProbeSet;});inspectedProbeSets.sort(function sortBySourceLocation(aProbeSet,bProbeSet){var aLocation=aProbeSet.breakpoint.sourceCodeLocation;var bLocation=bProbeSet.breakpoint.sourceCodeLocation;var comparisonResult=aLocation.sourceCode.displayName.extendedLocaleCompare(bLocation.sourceCode.displayName);if(comparisonResult!==0)
return comparisonResult;comparisonResult=aLocation.displayLineNumber-bLocation.displayLineNumber;if(comparisonResult!==0)
return comparisonResult;return aLocation.displayColumnNumber-bLocation.displayColumnNumber;});this.inspectedProbeSets=inspectedProbeSets;return!!this._inspectedProbeSets.length;}
initialLayout()
{super.initialLayout();WebInspector.probeManager.addEventListener(WebInspector.ProbeManager.Event.ProbeSetAdded,this._probeSetAdded,this);WebInspector.probeManager.addEventListener(WebInspector.ProbeManager.Event.ProbeSetRemoved,this._probeSetRemoved,this);for(var probeSet of WebInspector.probeManager.probeSets)
this._probeSetAdded(probeSet);}
sizeDidChange()
{super.sizeDidChange(); for(let detailsSection of this._probeSetSections.values())
detailsSection.sizeDidChange();}
_probeSetAdded(probeSetOrEvent)
{var probeSet;if(probeSetOrEvent instanceof WebInspector.ProbeSet)
probeSet=probeSetOrEvent;else
probeSet=probeSetOrEvent.data.probeSet;var newSection=new WebInspector.ProbeSetDetailsSection(probeSet);this._probeSetSections.set(probeSet,newSection);}
_probeSetRemoved(event)
{var probeSet=event.data.probeSet;var inspectedProbeSets=this.inspectedProbeSets;var index=inspectedProbeSets.indexOf(probeSet);if(index!==-1){inspectedProbeSets.splice(index,1);this.inspectedProbeSets=inspectedProbeSets;}
var removedSection=this._probeSetSections.get(probeSet);this._probeSetSections.delete(probeSet);removedSection.closed();}};WebInspector.ProbeSetDataGrid=class ProbeSetDataGrid extends WebInspector.DataGrid
{constructor(probeSet)
{var columns={};for(var probe of probeSet.probes){var title=probe.expression||WebInspector.UIString("(uninitialized)");columns[probe.id]={title};}
super(columns);this.probeSet=probeSet;this.inline=true;this._frameNodes=new Map;this._lastUpdatedFrame=null;this._nodesSinceLastNavigation=[];this._listenerSet=new WebInspector.EventListenerSet(this,"ProbeSetDataGrid instance listeners");this._listenerSet.register(probeSet,WebInspector.ProbeSet.Event.ProbeAdded,this._setupProbe);this._listenerSet.register(probeSet,WebInspector.ProbeSet.Event.ProbeRemoved,this._teardownProbe);this._listenerSet.register(probeSet,WebInspector.ProbeSet.Event.SamplesCleared,this._setupData);this._listenerSet.register(WebInspector.Probe,WebInspector.Probe.Event.ExpressionChanged,this._probeExpressionChanged);this._listenerSet.install();this._setupData();}
closed()
{for(var probe of this.probeSet)
this._teardownProbe(probe);this._listenerSet.uninstall(true);}
_setupProbe(event)
{var probe=event.data;this.insertColumn(probe.id,{title:probe.expression});for(var frame of this._data.frames)
this._updateNodeForFrame(frame);}
_teardownProbe(event)
{var probe=event.data;this.removeColumn(probe.id);for(var frame of this._data.frames)
this._updateNodeForFrame(frame);}
_setupData()
{this._data=this.probeSet.dataTable;for(var frame of this._data.frames)
this._updateNodeForFrame(frame);this._dataListeners=new WebInspector.EventListenerSet(this,"ProbeSetDataGrid data table listeners");this._dataListeners.register(this._data,WebInspector.ProbeSetDataTable.Event.FrameInserted,this._dataFrameInserted);this._dataListeners.register(this._data,WebInspector.ProbeSetDataTable.Event.SeparatorInserted,this._dataSeparatorInserted);this._dataListeners.register(this._data,WebInspector.ProbeSetDataTable.Event.WillRemove,this._teardownData);this._dataListeners.install();}
_teardownData()
{this._dataListeners.uninstall(true);this.removeChildren();this._frameNodes=new Map;this._lastUpdatedFrame=null;}
_updateNodeForFrame(frame)
{var node=null;if(this._frameNodes.has(frame)){node=this._frameNodes.get(frame);node.frame=frame;node.refresh();}else{node=new WebInspector.ProbeSetDataGridNode(this);node.frame=frame;this._frameNodes.set(frame,node);node.createCells();var sortFunction=function(a,b){return WebInspector.ProbeSetDataFrame.compare(a.frame,b.frame);};var insertionIndex=insertionIndexForObjectInListSortedByFunction(node,this.children,sortFunction);if(insertionIndex===this.children.length)
this.appendChild(node);else if(this.children[insertionIndex].frame.key===frame.key){this.removeChild(this.children[insertionIndex]);this.insertChild(node,insertionIndex);}else
this.insertChild(node,insertionIndex);}
this.updateLayoutIfNeeded();node.element.classList.add("data-updated");window.setTimeout(function(){node.element.classList.remove("data-updated");},WebInspector.ProbeSetDataGrid.DataUpdatedAnimationDuration);this._nodesSinceLastNavigation.push(node);}
_updateNodeForSeparator(frame)
{this._frameNodes.get(frame).updateCellsForSeparator(frame,this.probeSet);for(var node of this._nodesSinceLastNavigation)
node.element.classList.add("past-value");this._nodesSinceLastNavigation=[];}
_dataFrameInserted(event)
{var frame=event.data;this._lastUpdatedFrame=frame;this._updateNodeForFrame(frame);}
_dataSeparatorInserted(event)
{var frame=event.data;this._updateNodeForSeparator(frame);}
_probeExpressionChanged(event)
{var probe=event.target;if(probe.breakpoint!==this.probeSet.breakpoint)
return;if(!this.columns.has(probe.id))
return;var oldColumn=this.columns.get(probe.id);this.removeColumn(probe.id);var ordinal=oldColumn["ordinal"];var newColumn={title:event.data.newValue};this.insertColumn(probe.id,newColumn,ordinal);for(var frame of this._data.frames)
this._updateNodeForFrame(frame);}};WebInspector.ProbeSetDataGrid.DataUpdatedAnimationDuration=300;WebInspector.ProbeSetDataGridNode=class ProbeSetDataGridNode extends WebInspector.DataGridNode
{constructor(dataGrid)
{super();this.dataGrid=dataGrid;this._data={};this._element=document.createElement("tr");this._element.dataGridNode=this;this._element.classList.add("revealed");}
get element()
{return this._element;}
get data()
{return this._data;}
set frame(value)
{this._frame=value;var data={};for(var probe of this.dataGrid.probeSet.probes){var sample=this.frame[probe.id];if(!sample||!sample.object)
data[probe.id]=WebInspector.ProbeSetDataFrame.MissingValue;else
data[probe.id]=sample.object;}
this._data=data;}
get frame()
{return this._frame;}
createCellContent(columnIdentifier,cell)
{var sample=this.data[columnIdentifier];if(sample===WebInspector.ProbeSetDataFrame.MissingValue){cell.classList.add("unknown-value");return sample;}
if(sample instanceof WebInspector.RemoteObject)
return WebInspector.FormattedValue.createObjectTreeOrFormattedValueForRemoteObject(sample,null);return sample;}
updateCellsFromFrame(frame,probeSet)
{}
updateCellsForSeparator(frame,probeSet)
{this._element.classList.add("separator");}};WebInspector.ProbeSetDetailsSection=class ProbeSetDetailsSection extends WebInspector.DetailsSection
{constructor(probeSet)
{var optionsElement=document.createElement("div");var dataGrid=new WebInspector.ProbeSetDataGrid(probeSet);var singletonRow=new WebInspector.DetailsSectionRow;singletonRow.element.appendChild(dataGrid.element);var probeSectionGroup=new WebInspector.DetailsSectionGroup([singletonRow]);super("probe","",[probeSectionGroup],optionsElement);this.element.classList.add("probe-set");this._listenerSet=new WebInspector.EventListenerSet(this,"ProbeSetDetailsSection UI listeners");this._probeSet=probeSet;this._dataGrid=dataGrid;this._navigationBar=new WebInspector.NavigationBar;this._optionsElement.appendChild(this._navigationBar.element);this._addProbeButtonItem=new WebInspector.ButtonNavigationItem("add-probe",WebInspector.UIString("Add probe expression"),"Images/Plus13.svg",13,13);this._addProbeButtonItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,this._addProbeButtonClicked,this);this._navigationBar.addNavigationItem(this._addProbeButtonItem);this._clearSamplesButtonItem=new WebInspector.ButtonNavigationItem("clear-samples",WebInspector.UIString("Clear samples"),"Images/NavigationItemTrash.svg",14,14);this._clearSamplesButtonItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,this._clearSamplesButtonClicked,this);this._clearSamplesButtonItem.enabled=this._probeSetHasSamples();this._navigationBar.addNavigationItem(this._clearSamplesButtonItem);this._removeProbeButtonItem=new WebInspector.ButtonNavigationItem("remove-probe",WebInspector.UIString("Remove probe"),"Images/CloseLarge.svg",12,12);this._removeProbeButtonItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,this._removeProbeButtonClicked,this);this._navigationBar.addNavigationItem(this._removeProbeButtonItem);this._listenerSet.register(this._probeSet,WebInspector.ProbeSet.Event.SampleAdded,this._probeSetSamplesChanged);this._listenerSet.register(this._probeSet,WebInspector.ProbeSet.Event.SamplesCleared,this._probeSetSamplesChanged);this._updateLinkElement();this._listenerSet.register(this._probeSet.breakpoint,WebInspector.Breakpoint.Event.ResolvedStateDidChange,this._updateLinkElement);this._listenerSet.install();}
closed()
{this._listenerSet.uninstall(true);this.element.remove();}
sizeDidChange()
{ this._dataGrid.sizeDidChange();}
_updateLinkElement()
{const options={ignoreNetworkTab:true,ignoreSearchTab:true,};var breakpoint=this._probeSet.breakpoint;if(breakpoint.sourceCodeLocation.sourceCode)
this.titleElement=WebInspector.createSourceCodeLocationLink(breakpoint.sourceCodeLocation,options);else{this.titleElement=WebInspector.linkifyLocation(breakpoint.contentIdentifier,breakpoint.sourceCodeLocation.position,options);}
this.titleElement.classList.add(WebInspector.ProbeSetDetailsSection.DontFloatLinkStyleClassName);}
_addProbeButtonClicked(event)
{function createProbeFromEnteredExpression(visiblePopover,event)
{if(event.keyCode!==13)
return;let expression=event.target.value;this._probeSet.createProbe(expression);visiblePopover.dismiss();}
let popover=new WebInspector.Popover;let content=document.createElement("div");content.classList.add(WebInspector.ProbeSetDetailsSection.ProbePopoverElementStyleClassName);content.createChild("div").textContent=WebInspector.UIString("Add New Probe Expression");let textBox=content.createChild("input");textBox.addEventListener("keypress",createProbeFromEnteredExpression.bind(this,popover));textBox.addEventListener("click",function(event){event.target.select();});textBox.type="text";textBox.placeholder=WebInspector.UIString("Expression");popover.content=content;let target=WebInspector.Rect.rectFromClientRect(event.target.element.getBoundingClientRect());popover.present(target,[WebInspector.RectEdge.MAX_Y,WebInspector.RectEdge.MIN_Y,WebInspector.RectEdge.MAX_X]);popover.windowResizeHandler=()=>{let target=WebInspector.Rect.rectFromClientRect(event.target.element.getBoundingClientRect());popover.present(target,[WebInspector.RectEdge.MAX_Y,WebInspector.RectEdge.MIN_Y,WebInspector.RectEdge.MAX_X]);};textBox.select();}
_clearSamplesButtonClicked(event)
{this._probeSet.clearSamples();}
_removeProbeButtonClicked(event)
{this._probeSet.clear();}
_probeSetSamplesChanged(event)
{this._clearSamplesButtonItem.enabled=this._probeSetHasSamples();}
_probeSetHasSamples()
{return this._probeSet.probes.some((probe)=>probe.samples.length);}};WebInspector.ProbeSetDetailsSection.DontFloatLinkStyleClassName="dont-float";WebInspector.ProbeSetDetailsSection.ProbePopoverElementStyleClassName="probe-popover";WebInspector.ProfileDataGridNode=class ProfileDataGridNode extends WebInspector.DataGridNode
{constructor(callingContextTreeNode,tree)
{super(callingContextTreeNode,false);this._node=callingContextTreeNode;this._tree=tree;this._childrenToChargeToSelf=new Set;this._extraSelfTimeFromChargedChildren=0;this.copyable=false;this.addEventListener("populate",this._populate,this);this._updateChildrenForModifiers();this._recalculateData();}
get callingContextTreeNode(){return this._node;}
displayName()
{let title=this._node.name;if(!title)
return WebInspector.UIString("(anonymous function)");if(title==="(program)")
return WebInspector.UIString("(program)");return title;}
iconClassName()
{let script=WebInspector.debuggerManager.scriptForIdentifier(this._node.sourceID,WebInspector.assumingMainTarget());if(!script||!script.url)
return"native-icon";if(this._node.name==="(program)")
return"program-icon";return"function-icon";}
get data()
{return this._data;}
createCellContent(columnIdentifier,cell)
{switch(columnIdentifier){case"totalTime":return this._totalTimeContent();case"selfTime":return Number.secondsToMillisecondsString(this._data.selfTime);case"function":return this._displayContent();}
return super.createCellContent(columnIdentifier,cell);}
sort()
{let children=this.children;children.sort(this._tree._sortComparator);for(let i=0;i<children.length;++i){children[i]._recalculateSiblings(i);children[i].sort();}}
refresh()
{this._updateChildrenForModifiers();this._recalculateData();super.refresh();}
appendContextMenuItems(contextMenu)
{let disableFocus=this===this._tree.currentFocusNode;contextMenu.appendItem(WebInspector.UIString("Focus on Subtree"),()=>{this._tree.addFocusNode(this);},disableFocus); let disableChargeToCaller=this._tree.callingContextTree.type===WebInspector.CallingContextTree.Type.BottomUp;contextMenu.appendItem(WebInspector.UIString("Charge ‘%s’ to Callers").format(this.displayName()),()=>{this._tree.addModifier({type:WebInspector.ProfileDataGridTree.ModifierType.ChargeToCaller,source:this._node});},disableChargeToCaller);contextMenu.appendSeparator();}
filterableDataForColumn(columnIdentifier)
{if(columnIdentifier==="function"){let filterableData=[this.displayName()];let script=WebInspector.debuggerManager.scriptForIdentifier(this._node.sourceID,WebInspector.assumingMainTarget());if(script&&script.url&&this._node.line>=0&&this._node.column>=0)
filterableData.push(script.url);return filterableData;}
return super.filterableDataForColumn(columnIdentifier);}
_updateChildrenForModifiers()
{ let isBottomUp=this._tree.callingContextTree.type===WebInspector.CallingContextTree.Type.BottomUp;if(!this._tree.hasModifiers()||isBottomUp){if(!this.shouldRefreshChildren&&this._childrenToChargeToSelf.size){for(let child of this._childrenToChargeToSelf){this.appendChild(new WebInspector.ProfileDataGridNode(child,this._tree));}
this.sort();}
this._extraSelfTimeFromChargedChildren=0;this._childrenToChargeToSelf.clear();this.hasChildren=this._node.hasChildrenInTimeRange(this._tree.startTime,this._tree.endTime);return;}
this._extraSelfTimeFromChargedChildren=0;this._childrenToChargeToSelf.clear();let hasNonChargedChild=false;this._node.forEachChild((child)=>{if(child.hasStackTraceInTimeRange(this._tree.startTime,this._tree.endTime)){for(let{type,source}of this._tree.modifiers){if(type===WebInspector.ProfileDataGridTree.ModifierType.ChargeToCaller){if(child.equals(source)){this._childrenToChargeToSelf.add(child);this._extraSelfTimeFromChargedChildren+=child.filteredTimestampsAndDuration(this._tree.startTime,this._tree.endTime).duration;continue;}}
hasNonChargedChild=true;}}});this.hasChildren=hasNonChargedChild;if(!this.shouldRefreshChildren&&this._childrenToChargeToSelf.size){for(let childDataGridNode of this.children){if(this._childrenToChargeToSelf.has(childDataGridNode.callingContextTreeNode))
this.removeChild(childDataGridNode);}}}
_recalculateData()
{let{timestamps,duration}=this._node.filteredTimestampsAndDuration(this._tree.startTime,this._tree.endTime);let{leafTimestamps,leafDuration}=this._node.filteredLeafTimestampsAndDuration(this._tree.startTime,this._tree.endTime);let totalTime=duration;let selfTime=leafDuration+this._extraSelfTimeFromChargedChildren;let fraction=totalTime/this._tree.totalSampleTime;this._data={totalTime,selfTime,fraction};}
_totalTimeContent()
{let{totalTime,fraction}=this._data;let fragment=document.createDocumentFragment();let timeElement=fragment.appendChild(document.createElement("span"));timeElement.classList.add("time");timeElement.textContent=Number.secondsToMillisecondsString(totalTime);let percentElement=fragment.appendChild(document.createElement("span"));percentElement.classList.add("percentage");percentElement.textContent=Number.percentageString(fraction);return fragment;}
_displayContent()
{let title=this.displayName();let iconClassName=this.iconClassName();let fragment=document.createDocumentFragment();let iconElement=fragment.appendChild(document.createElement("img"));iconElement.classList.add("icon",iconClassName);let titleElement=fragment.appendChild(document.createElement("span"));titleElement.textContent=title;let script=WebInspector.debuggerManager.scriptForIdentifier(this._node.sourceID,WebInspector.assumingMainTarget());if(script&&script.url&&this._node.line>=0&&this._node.column>=0){let sourceCodeLocation=script.createSourceCodeLocation(this._node.line-1,this._node.column-1);let locationElement=fragment.appendChild(document.createElement("span"));locationElement.classList.add("location");sourceCodeLocation.populateLiveDisplayLocationString(locationElement,"textContent",WebInspector.SourceCodeLocation.ColumnStyle.Hidden,WebInspector.SourceCodeLocation.NameStyle.Short);const options={dontFloat:true,useGoToArrowButton:true,ignoreNetworkTab:true,ignoreSearchTab:true,};fragment.appendChild(WebInspector.createSourceCodeLocationLink(sourceCodeLocation,options));}
return fragment;}
_populate()
{if(!this.shouldRefreshChildren)
return;this.removeEventListener("populate",this._populate,this);this._node.forEachChild((child)=>{if(!this._childrenToChargeToSelf.has(child)){if(child.hasStackTraceInTimeRange(this._tree.startTime,this._tree.endTime))
this.appendChild(new WebInspector.ProfileDataGridNode(child,this._tree));}});this.sort();}};WebInspector.ProfileDataGridTree=class ProfileDataGridTree extends WebInspector.Object
{constructor(callingContextTree,startTime,endTime,sortComparator)
{super();this._children=[];this._sortComparator=sortComparator;this._callingContextTree=callingContextTree;this._startTime=startTime;this._endTime=endTime;this._totalSampleTime=this._callingContextTree.totalDurationInTimeRange(startTime,endTime);this._focusNodes=[];this._modifiers=[];this._repopulate();}
static buildSortComparator(columnIdentifier,sortOrder)
{let ascending=sortOrder===WebInspector.DataGrid.SortOrder.Ascending;return function(a,b){let result=a.data[columnIdentifier]-b.data[columnIdentifier];return ascending?result:-result;};}
get callingContextTree(){return this._callingContextTree;}
get focusNodes()
{return this._focusNodes;}
get currentFocusNode()
{return this._focusNodes.lastValue;}
get modifiers()
{return this._modifiers;}
get startTime()
{if(this._focusNodes.length)
return this._currentFocusStartTime;return this._startTime;}
get endTime()
{if(this._focusNodes.length)
return this._currentFocusEndTime;return this._endTime;}
get totalSampleTime()
{if(this._focusNodes.length)
return this._currentFocusTotalSampleTime;return this._totalSampleTime;}
get children()
{return this._children;}
appendChild(node)
{this._children.push(node);}
insertChild(node,index)
{this._children.splice(index,0,node);}
removeChildren()
{this._children=[];}
set sortComparator(comparator)
{this._sortComparator=comparator;this.sort();}
sort()
{let children=this._children;children.sort(this._sortComparator);for(let i=0;i<children.length;++i){children[i]._recalculateSiblings(i);children[i].sort();}}
refresh()
{for(let child of this._children)
child.refreshRecursively();}
addFocusNode(profileDataGridNode)
{this._saveFocusedNodeOriginalParent(profileDataGridNode);this._focusNodes.push(profileDataGridNode);this._focusChanged();}
rollbackFocusNode(profileDataGridNode)
{let index=this._focusNodes.indexOf(profileDataGridNode);if(index===-1)
return;this._focusParentsToExpand=[];for(let i=index+1;i<this._focusNodes.length;++i)
this._restoreFocusedNodeToOriginalParent(this._focusNodes[i]);this._focusNodes.splice(index+1);this._focusChanged();}
clearFocusNodes()
{this._focusParentsToExpand=[];for(let profileDataGridNode of this._focusNodes)
this._restoreFocusedNodeToOriginalParent(profileDataGridNode);this._focusNodes=[];this._focusChanged();}
hasModifiers()
{return this._modifiers.length>0;}
addModifier(modifier)
{this._modifiers.push(modifier);this._modifiersChanged();}
clearModifiers()
{this._modifiers=[];this._modifiersChanged();}
_repopulate()
{this.removeChildren();if(this._focusNodes.length){this.appendChild(this.currentFocusNode);}else{this._callingContextTree.forEachChild((child)=>{if(child.hasStackTraceInTimeRange(this._startTime,this._endTime))
this.appendChild(new WebInspector.ProfileDataGridNode(child,this));});}
this.sort();}
_focusChanged()
{let profileDataGridNode=this.currentFocusNode;if(profileDataGridNode)
this._updateCurrentFocusDetails(profileDataGridNode);this._repopulate();this.dispatchEventToListeners(WebInspector.ProfileDataGridTree.Event.FocusChanged);if(this._focusParentsToExpand){for(let profileDataGridNode of this._focusParentsToExpand)
profileDataGridNode.expand();this._focusParentsToExpand=null;}}
_updateCurrentFocusDetails(focusDataGridNode)
{let{timestamps,duration}=focusDataGridNode.callingContextTreeNode.filteredTimestampsAndDuration(this._startTime,this._endTime);this._currentFocusStartTime=timestamps[0];this._currentFocusEndTime=timestamps.lastValue;this._currentFocusTotalSampleTime=duration;}
_saveFocusedNodeOriginalParent(focusDataGridNode)
{focusDataGridNode.__previousParent=focusDataGridNode.parent;focusDataGridNode.__previousParent.removeChild(focusDataGridNode);}
_restoreFocusedNodeToOriginalParent(focusDataGridNode)
{
focusDataGridNode.__previousParent.collapse();this._focusParentsToExpand.push(focusDataGridNode.__previousParent);focusDataGridNode.__previousParent.appendChild(focusDataGridNode);focusDataGridNode.__previousParent=undefined;}
_modifiersChanged()
{this.dispatchEventToListeners(WebInspector.ProfileDataGridTree.Event.ModifiersChanged);}};WebInspector.ProfileDataGridTree.Event={FocusChanged:"profile-data-grid-tree-focus-changed",ModifiersChanged:"profile-data-grid-tree-modifiers-changed",};WebInspector.ProfileDataGridTree.ModifierType={ChargeToCaller:"charge",};WebInspector.ProfileNodeDataGridNode=class ProfileNodeDataGridNode extends WebInspector.TimelineDataGridNode
{constructor(profileNode,baseStartTime,rangeStartTime,rangeEndTime)
{var hasChildren=!!profileNode.childNodes.length;super(false,null,hasChildren);this._profileNode=profileNode;this._baseStartTime=baseStartTime||0;this._rangeStartTime=rangeStartTime||0;this._rangeEndTime=typeof rangeEndTime==="number"?rangeEndTime:Infinity;this._cachedData=null;this.addEventListener("populate",this._populate,this);}
get profileNode()
{return this._profileNode;}
get records()
{return null;}
get baseStartTime()
{return this._baseStartTime;}
get rangeStartTime()
{return this._rangeStartTime;}
get rangeEndTime()
{return this._rangeEndTime;}
get data()
{if(!this._cachedData){this._cachedData=this._profileNode.computeCallInfoForTimeRange(this._rangeStartTime,this._rangeEndTime);this._cachedData.name=this.displayName();this._cachedData.location=this._profileNode.sourceCodeLocation;}
return this._cachedData;}
updateRangeTimes(startTime,endTime)
{var oldRangeStartTime=this._rangeStartTime;var oldRangeEndTime=this._rangeEndTime;if(oldRangeStartTime===startTime&&oldRangeEndTime===endTime)
return;this._rangeStartTime=startTime;this._rangeEndTime=endTime;var profileStart=this._profileNode.startTime;var profileEnd=this._profileNode.endTime;var oldStartBoundary=Number.constrain(oldRangeStartTime,profileStart,profileEnd);var oldEndBoundary=Number.constrain(oldRangeEndTime,profileStart,profileEnd);var newStartBoundary=Number.constrain(startTime,profileStart,profileEnd);var newEndBoundary=Number.constrain(endTime,profileStart,profileEnd);if(oldStartBoundary!==newStartBoundary||oldEndBoundary!==newEndBoundary)
this.needsRefresh();}
refresh()
{this._data=this._profileNode.computeCallInfoForTimeRange(this._rangeStartTime,this._rangeEndTime);this._data.location=this._profileNode.sourceCodeLocation;super.refresh();}
createCellContent(columnIdentifier,cell)
{var value=this.data[columnIdentifier];switch(columnIdentifier){case"name":cell.classList.add(...this.iconClassNames());return value;case"startTime":return isNaN(value)?emDash:Number.secondsToString(value-this._baseStartTime,true);case"selfTime":case"totalTime":case"averageTime":return isNaN(value)?emDash:Number.secondsToString(value,true);}
return super.createCellContent(columnIdentifier,cell);}
displayName()
{let title=this._profileNode.functionName;if(!title){switch(this._profileNode.type){case WebInspector.ProfileNode.Type.Function:title=WebInspector.UIString("(anonymous function)");break;case WebInspector.ProfileNode.Type.Program:title=WebInspector.UIString("(program)");break;default:title=WebInspector.UIString("(anonymous function)");console.error("Unknown ProfileNode type: "+this._profileNode.type);}}
return title;}
iconClassNames()
{let className;switch(this._profileNode.type){case WebInspector.ProfileNode.Type.Function:className=WebInspector.CallFrameView.FunctionIconStyleClassName;if(!this._profileNode.sourceCodeLocation)
className=WebInspector.CallFrameView.NativeIconStyleClassName;break;case WebInspector.ProfileNode.Type.Program:className=WebInspector.TimelineRecordTreeElement.EvaluatedRecordIconStyleClass;break;}
if(this._profileNode.functionName&&this._profileNode.functionName.startsWith("on")&&this._profileNode.functionName.length>=5)
className=WebInspector.CallFrameView.EventListenerIconStyleClassName;return[className];}
_populate()
{if(!this.shouldRefreshChildren)
return;this.removeEventListener("populate",this._populate,this);this.removeChildren();for(let node of this._profileNode.childNodes)
this.appendChild(new WebInspector.ProfileNodeDataGridNode(node,this.baseStartTime,this.rangeStartTime,this.rangeEndTime));}};WebInspector.ProfileNodeTreeElement=class ProfileNodeTreeElement extends WebInspector.GeneralTreeElement
{constructor(profileNode,delegate)
{var title=profileNode.functionName;var subtitle="";if(!title){switch(profileNode.type){case WebInspector.ProfileNode.Type.Function:title=WebInspector.UIString("(anonymous function)");break;case WebInspector.ProfileNode.Type.Program:title=WebInspector.UIString("(program)");break;default:title=WebInspector.UIString("(anonymous function)");console.error("Unknown ProfileNode type: "+profileNode.type);}}
var sourceCodeLocation=profileNode.sourceCodeLocation;if(sourceCodeLocation){subtitle=document.createElement("span");sourceCodeLocation.populateLiveDisplayLocationString(subtitle,"textContent");}
var className;switch(profileNode.type){case WebInspector.ProfileNode.Type.Function:className=WebInspector.CallFrameView.FunctionIconStyleClassName;if(!sourceCodeLocation)
className=WebInspector.CallFrameView.NativeIconStyleClassName;break;case WebInspector.ProfileNode.Type.Program:className=WebInspector.TimelineRecordTreeElement.EvaluatedRecordIconStyleClass;break;}
if(profileNode.functionName&&profileNode.functionName.startsWith("on")&&profileNode.functionName.length>=5)
className=WebInspector.CallFrameView.EventListenerIconStyleClassName;var hasChildren=!!profileNode.childNodes.length;super([className],title,subtitle,profileNode,hasChildren);this._profileNode=profileNode;this._delegate=delegate||null;this.shouldRefreshChildren=true;if(sourceCodeLocation)
this.tooltipHandledSeparately=true;}
get profileNode()
{return this._profileNode;}
get filterableData()
{var url=this._profileNode.sourceCodeLocation?this._profileNode.sourceCodeLocation.sourceCode.url:"";return{text:[this.mainTitle,url||""]};}
onattach()
{super.onattach();if(!this.tooltipHandledSeparately)
return;var tooltipPrefix=this.mainTitle+"\n";this._profileNode.sourceCodeLocation.populateLiveDisplayLocationTooltip(this.element,tooltipPrefix);}
onpopulate()
{if(!this.hasChildren||!this.shouldRefreshChildren)
return;this.shouldRefreshChildren=false;this.removeChildren();if(this._delegate&&typeof this._delegate.populateProfileNodeTreeElement==="function"){this._delegate.populateProfileNodeTreeElement(this);return;}
for(var childProfileNode of this._profileNode.childNodes){var childTreeElement=new WebInspector.ProfileNodeTreeElement(childProfileNode);this.appendChild(childTreeElement);}}};WebInspector.ProfileView=class ProfileView extends WebInspector.ContentView
{constructor(callingContextTree,extraArguments)
{super(callingContextTree);this._startTime=0;this._endTime=Infinity;this._callingContextTree=callingContextTree;this._hoveredDataGridNode=null;this.element.classList.add("profile");let columns={totalTime:{title:WebInspector.UIString("Total Time"),width:"120px",sortable:true,aligned:"right",},selfTime:{title:WebInspector.UIString("Self Time"),width:"75px",sortable:true,aligned:"right",},function:{title:WebInspector.UIString("Function"),disclosure:true,},};this._dataGrid=new WebInspector.DataGrid(columns);this._dataGrid.addEventListener(WebInspector.DataGrid.Event.SortChanged,this._dataGridSortChanged,this);this._dataGrid.addEventListener(WebInspector.DataGrid.Event.SelectedNodeChanged,this._dataGridNodeSelected,this);this._dataGrid.addEventListener(WebInspector.DataGrid.Event.ExpandedNode,this._dataGridNodeExpanded,this);this._dataGrid.element.addEventListener("mouseover",this._mouseOverDataGrid.bind(this));this._dataGrid.element.addEventListener("mouseleave",this._mouseLeaveDataGrid.bind(this));this._dataGrid.indentWidth=20;this._dataGrid.sortColumnIdentifier="totalTime";this._dataGrid.sortOrder=WebInspector.DataGrid.SortOrder.Descending;this._dataGrid.createSettings("profile-view");
this._sharedData=extraArguments;this.addSubview(this._dataGrid);}
get callingContextTree(){return this._callingContextTree;}
get startTime(){return this._startTime;}
get endTime(){return this._endTime;}
get dataGrid(){return this._dataGrid;}
setStartAndEndTime(startTime,endTime)
{this._startTime=startTime;this._endTime=endTime;this._recreate();}
hasFocusNodes()
{if(!this._profileDataGridTree)
return false;return this._profileDataGridTree.focusNodes.length>0;}
clearFocusNodes()
{if(!this._profileDataGridTree)
return;this._profileDataGridTree.clearFocusNodes();}
get scrollableElements()
{return[this._dataGrid.scrollContainer];}
get selectionPathComponents()
{let pathComponents=[];if(this._profileDataGridTree){for(let profileDataGridNode of this._profileDataGridTree.focusNodes){let displayName=profileDataGridNode.displayName();let className=profileDataGridNode.iconClassName();let pathComponent=new WebInspector.HierarchicalPathComponent(displayName,className,profileDataGridNode);pathComponent.addEventListener(WebInspector.HierarchicalPathComponent.Event.Clicked,this._pathComponentClicked,this);pathComponents.push(pathComponent);}}
return pathComponents;}
_recreate()
{let hadFocusNodes=this.hasFocusNodes();let sortComparator=WebInspector.ProfileDataGridTree.buildSortComparator(this._dataGrid.sortColumnIdentifier,this._dataGrid.sortOrder);this._profileDataGridTree=new WebInspector.ProfileDataGridTree(this._callingContextTree,this._startTime,this._endTime,sortComparator);this._profileDataGridTree.addEventListener(WebInspector.ProfileDataGridTree.Event.FocusChanged,this._dataGridTreeFocusChanged,this);this._profileDataGridTree.addEventListener(WebInspector.ProfileDataGridTree.Event.ModifiersChanged,this._dataGridTreeModifiersChanged,this);this._repopulateDataGridFromTree();if(hadFocusNodes)
this.dispatchEventToListeners(WebInspector.ContentView.Event.SelectionPathComponentsDidChange);}
_repopulateDataGridFromTree()
{this._dataGrid.removeChildren();for(let child of this._profileDataGridTree.children)
this._dataGrid.appendChild(child);this._restoreSharedState();}
_restoreSharedState()
{const skipHidden=false;const stayWithin=this._dataGrid;const dontPopulate=true;if(this._sharedData.selectedNodeHash){let nodeToSelect=this._dataGrid.findNode((node)=>node.callingContextTreeNode.hash===this._sharedData.selectedNodeHash,skipHidden,stayWithin,dontPopulate);if(nodeToSelect)
nodeToSelect.revealAndSelect();}}
_pathComponentClicked(event)
{if(!event.data.pathComponent)
return;let profileDataGridNode=event.data.pathComponent.representedObject;if(profileDataGridNode===this._profileDataGridTree.currentFocusNode)
return;this._profileDataGridTree.rollbackFocusNode(event.data.pathComponent.representedObject);}
_dataGridTreeFocusChanged(event)
{this._repopulateDataGridFromTree();this._profileDataGridTree.refresh();this.dispatchEventToListeners(WebInspector.ContentView.Event.SelectionPathComponentsDidChange);}
_dataGridTreeModifiersChanged(event)
{this._profileDataGridTree.refresh();}
_dataGridSortChanged()
{if(!this._profileDataGridTree)
return;this._profileDataGridTree.sortComparator=WebInspector.ProfileDataGridTree.buildSortComparator(this._dataGrid.sortColumnIdentifier,this._dataGrid.sortOrder);this._repopulateDataGridFromTree();}
_dataGridNodeSelected(event)
{let oldSelectedNode=event.data.oldSelectedNode;if(oldSelectedNode){this._removeGuidanceElement(WebInspector.ProfileView.GuidanceType.Selected,oldSelectedNode);oldSelectedNode.forEachChildInSubtree((node)=>this._removeGuidanceElement(WebInspector.ProfileView.GuidanceType.Selected,node));}
let newSelectedNode=this._dataGrid.selectedNode;if(newSelectedNode){this._removeGuidanceElement(WebInspector.ProfileView.GuidanceType.Selected,newSelectedNode);newSelectedNode.forEachChildInSubtree((node)=>this._appendGuidanceElement(WebInspector.ProfileView.GuidanceType.Selected,node,newSelectedNode));this._sharedData.selectedNodeHash=newSelectedNode.callingContextTreeNode.hash;}}
_dataGridNodeExpanded(event)
{let expandedNode=event.data.dataGridNode;if(this._dataGrid.selectedNode){if(expandedNode.isInSubtreeOfNode(this._dataGrid.selectedNode))
expandedNode.forEachImmediateChild((node)=>this._appendGuidanceElement(WebInspector.ProfileView.GuidanceType.Selected,node,this._dataGrid.selectedNode));}
if(this._hoveredDataGridNode){if(expandedNode.isInSubtreeOfNode(this._hoveredDataGridNode))
expandedNode.forEachImmediateChild((node)=>this._appendGuidanceElement(WebInspector.ProfileView.GuidanceType.Hover,node,this._hoveredDataGridNode));}}
_mouseOverDataGrid(event)
{let hoveredDataGridNode=this._dataGrid.dataGridNodeFromNode(event.target);if(hoveredDataGridNode===this._hoveredDataGridNode)
return;if(this._hoveredDataGridNode){this._removeGuidanceElement(WebInspector.ProfileView.GuidanceType.Hover,this._hoveredDataGridNode);this._hoveredDataGridNode.forEachChildInSubtree((node)=>this._removeGuidanceElement(WebInspector.ProfileView.GuidanceType.Hover,node));}
this._hoveredDataGridNode=hoveredDataGridNode;if(this._hoveredDataGridNode){this._appendGuidanceElement(WebInspector.ProfileView.GuidanceType.Hover,this._hoveredDataGridNode,this._hoveredDataGridNode);this._hoveredDataGridNode.forEachChildInSubtree((node)=>this._appendGuidanceElement(WebInspector.ProfileView.GuidanceType.Hover,node,this._hoveredDataGridNode));}}
_mouseLeaveDataGrid(event)
{if(!this._hoveredDataGridNode)
return;this._removeGuidanceElement(WebInspector.ProfileView.GuidanceType.Hover,this._hoveredDataGridNode);this._hoveredDataGridNode.forEachChildInSubtree((node)=>this._removeGuidanceElement(WebInspector.ProfileView.GuidanceType.Hover,node));this._hoveredDataGridNode=null;}
_guidanceElementKey(type)
{return"guidance-element-"+type;}
_removeGuidanceElement(type,node)
{let key=this._guidanceElementKey(type);let element=node.elementWithColumnIdentifier("function");if(!element||!element[key])
return;element[key].remove();element[key]=null;}
_appendGuidanceElement(type,node,baseElement)
{let depth=baseElement.depth;let guidanceMarkerLeft=depth?(depth*this._dataGrid.indentWidth)+1.5:7.5;let key=this._guidanceElementKey(type);let element=node.elementWithColumnIdentifier("function");let guidanceElement=element[key]||element.appendChild(document.createElement("div"));element[key]=guidanceElement;guidanceElement.classList.add("guidance",type);guidanceElement.classList.toggle("base",node===baseElement);guidanceElement.style.left=guidanceMarkerLeft+"px";}};WebInspector.ProfileView.GuidanceType={Selected:"selected",Hover:"hover",};WebInspector.QuickConsole=class QuickConsole extends WebInspector.View
{constructor(element)
{super(element);this._toggleOrFocusKeyboardShortcut=new WebInspector.KeyboardShortcut(null,WebInspector.KeyboardShortcut.Key.Escape,this._toggleOrFocus.bind(this));this._mainExecutionContextPathComponent=this._createExecutionContextPathComponent(WebInspector.mainTarget.executionContext);this._otherExecutionContextPathComponents=[];this._frameToPathComponent=new Map;this._targetToPathComponent=new Map;this._restoreSelectedExecutionContextForFrame=false;this.element.classList.add("quick-console");this.element.addEventListener("mousedown",this._handleMouseDown.bind(this));this.prompt=new WebInspector.ConsolePrompt(null,"text/javascript");this.prompt.element.classList.add("text-prompt");this.addSubview(this.prompt);
this.prompt.escapeKeyHandlerWhenEmpty=function(){WebInspector.toggleSplitConsole();};this._navigationBar=new WebInspector.QuickConsoleNavigationBar;this.addSubview(this._navigationBar);this._executionContextSelectorItem=new WebInspector.HierarchicalPathNavigationItem;this._executionContextSelectorItem.showSelectorArrows=true;this._navigationBar.addNavigationItem(this._executionContextSelectorItem);this._executionContextSelectorDivider=new WebInspector.DividerNavigationItem;this._navigationBar.addNavigationItem(this._executionContextSelectorDivider);this._rebuildExecutionContextPathComponents();WebInspector.Frame.addEventListener(WebInspector.Frame.Event.PageExecutionContextChanged,this._framePageExecutionContextsChanged,this);WebInspector.Frame.addEventListener(WebInspector.Frame.Event.ExecutionContextsCleared,this._frameExecutionContextsCleared,this);WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ActiveCallFrameDidChange,this._debuggerActiveCallFrameDidChange,this);WebInspector.runtimeManager.addEventListener(WebInspector.RuntimeManager.Event.ActiveExecutionContextChanged,this._activeExecutionContextChanged,this);WebInspector.targetManager.addEventListener(WebInspector.TargetManager.Event.TargetAdded,this._targetAdded,this);WebInspector.targetManager.addEventListener(WebInspector.TargetManager.Event.TargetRemoved,this._targetRemoved,this);WebInspector.consoleDrawer.addEventListener(WebInspector.ConsoleDrawer.Event.CollapsedStateChanged,this._updateStyles,this);WebInspector.TabBrowser.addEventListener(WebInspector.TabBrowser.Event.SelectedTabContentViewDidChange,this._updateStyles,this);}
get navigationBar()
{return this._navigationBar;}
get selectedExecutionContext()
{return WebInspector.runtimeManager.activeExecutionContext;}
set selectedExecutionContext(executionContext)
{WebInspector.runtimeManager.activeExecutionContext=executionContext;}
layout()
{let maximumAllowedHeight=Math.round(window.innerHeight*0.33);this.prompt.element.style.maxHeight=maximumAllowedHeight+"px";}
_handleMouseDown(event)
{if(event.target!==this.element)
return;event.preventDefault();this.prompt.focus();}
_executionContextPathComponentsToDisplay()
{if(WebInspector.debuggerManager.activeCallFrame)
return[];if(!this._otherExecutionContextPathComponents.length)
return[];if(this.selectedExecutionContext===WebInspector.mainTarget.executionContext)
return[this._mainExecutionContextPathComponent];return this._otherExecutionContextPathComponents.filter((component)=>component.representedObject===this.selectedExecutionContext);}
_rebuildExecutionContextPathComponents()
{let components=this._executionContextPathComponentsToDisplay();let isEmpty=!components.length;this._executionContextSelectorItem.components=components;this._executionContextSelectorItem.hidden=isEmpty;this._executionContextSelectorDivider.hidden=isEmpty;}
_framePageExecutionContextsChanged(event)
{let frame=event.target;let shouldAutomaticallySelect=this._restoreSelectedExecutionContextForFrame===frame;let newExecutionContextPathComponent=this._insertExecutionContextPathComponentForFrame(frame,shouldAutomaticallySelect);if(shouldAutomaticallySelect){this._restoreSelectedExecutionContextForFrame=null;this.selectedExecutionContext=newExecutionContextPathComponent.representedObject;}}
_frameExecutionContextsCleared(event)
{let frame=event.target;if(event.data.committingProvisionalLoad&&!this._restoreSelectedExecutionContextForFrame){let executionContextPathComponent=this._frameToPathComponent.get(frame);if(executionContextPathComponent&&executionContextPathComponent.representedObject===this.selectedExecutionContext){this._restoreSelectedExecutionContextForFrame=frame;setTimeout(()=>{this._restoreSelectedExecutionContextForFrame=false;},10);}}
this._removeExecutionContextPathComponentForFrame(frame);}
_activeExecutionContextChanged(event)
{this._rebuildExecutionContextPathComponents();}
_createExecutionContextPathComponent(executionContext,preferredName)
{let pathComponent=new WebInspector.HierarchicalPathComponent(preferredName||executionContext.name,"execution-context",executionContext,true,true);pathComponent.addEventListener(WebInspector.HierarchicalPathComponent.Event.SiblingWasSelected,this._pathComponentSelected,this);pathComponent.addEventListener(WebInspector.HierarchicalPathComponent.Event.Clicked,this._pathComponentClicked,this);pathComponent.truncatedDisplayNameLength=50;return pathComponent;}
_createExecutionContextPathComponentFromFrame(frame)
{let preferredName=frame.name?frame.name+" \u2014 "+frame.mainResource.displayName:frame.mainResource.displayName;return this._createExecutionContextPathComponent(frame.pageExecutionContext,preferredName);}
_compareExecutionContextPathComponents(a,b)
{let aExecutionContext=a.representedObject;let bExecutionContext=b.representedObject;let aNonMainTarget=aExecutionContext.target!==WebInspector.mainTarget;let bNonMainTarget=bExecutionContext.target!==WebInspector.mainTarget;if(aNonMainTarget&&!bNonMainTarget)
return-1;if(bNonMainTarget&&!aNonMainTarget)
return 1;if(aNonMainTarget&&bNonMainTarget)
return a.displayName.extendedLocaleCompare(b.displayName);if(aExecutionContext===WebInspector.mainTarget.executionContext)
return-1;if(bExecutionContext===WebInspector.mainTarget.executionContext)
return 1;if(aExecutionContext.frame.name&&!bExecutionContext.frame.name)
return-1;if(!aExecutionContext.frame.name&&bExecutionContext.frame.name)
return 1;return a.displayName.extendedLocaleCompare(b.displayName);}
_insertOtherExecutionContextPathComponent(executionContextPathComponent,skipRebuild)
{let index=insertionIndexForObjectInListSortedByFunction(executionContextPathComponent,this._otherExecutionContextPathComponents,this._compareExecutionContextPathComponents);let prev=index>0?this._otherExecutionContextPathComponents[index-1]:this._mainExecutionContextPathComponent;let next=this._otherExecutionContextPathComponents[index]||null;if(prev){prev.nextSibling=executionContextPathComponent;executionContextPathComponent.previousSibling=prev;}
if(next){next.previousSibling=executionContextPathComponent;executionContextPathComponent.nextSibling=next;}
this._otherExecutionContextPathComponents.splice(index,0,executionContextPathComponent);if(!skipRebuild)
this._rebuildExecutionContextPathComponents();}
_removeOtherExecutionContextPathComponent(executionContextPathComponent,skipRebuild)
{executionContextPathComponent.removeEventListener(WebInspector.HierarchicalPathComponent.Event.SiblingWasSelected,this._pathComponentSelected,this);executionContextPathComponent.removeEventListener(WebInspector.HierarchicalPathComponent.Event.Clicked,this._pathComponentClicked,this);let prev=executionContextPathComponent.previousSibling;let next=executionContextPathComponent.nextSibling;if(prev)
prev.nextSibling=next;if(next)
next.previousSibling=prev;this._otherExecutionContextPathComponents.remove(executionContextPathComponent,true);if(!skipRebuild)
this._rebuildExecutionContextPathComponents();}
_insertExecutionContextPathComponentForFrame(frame,skipRebuild)
{if(frame.isMainFrame())
return this._mainExecutionContextPathComponent;let executionContextPathComponent=this._createExecutionContextPathComponentFromFrame(frame);this._insertOtherExecutionContextPathComponent(executionContextPathComponent,skipRebuild);this._frameToPathComponent.set(frame,executionContextPathComponent);return executionContextPathComponent;}
_removeExecutionContextPathComponentForFrame(frame,skipRebuild)
{if(frame.isMainFrame())
return;let executionContextPathComponent=this._frameToPathComponent.take(frame);this._removeOtherExecutionContextPathComponent(executionContextPathComponent,skipRebuild);}
_targetAdded(event)
{let target=event.data.target;let preferredName=WebInspector.UIString("Worker \u2014 %s").format(target.displayName);let executionContextPathComponent=this._createExecutionContextPathComponent(target.executionContext,preferredName);this._targetToPathComponent.set(target,executionContextPathComponent);this._insertOtherExecutionContextPathComponent(executionContextPathComponent);}
_targetRemoved(event)
{let target=event.data.target;let executionContextPathComponent=this._targetToPathComponent.take(target);this._removeOtherExecutionContextPathComponent(executionContextPathComponent);if(this.selectedExecutionContext===executionContextPathComponent.representedObject)
this.selectedExecutionContext=WebInspector.mainTarget.executionContext;}
_pathComponentSelected(event)
{let executionContext=event.data.pathComponent.representedObject;this.selectedExecutionContext=executionContext;}
_pathComponentClicked(event)
{this.prompt.focus();}
_debuggerActiveCallFrameDidChange(event)
{this._rebuildExecutionContextPathComponents();}
_toggleOrFocus(event)
{if(this.prompt.focused)
WebInspector.toggleSplitConsole();else if(!WebInspector.isEditingAnyField()&&!WebInspector.isEventTargetAnEditableField(event))
this.prompt.focus();}
_updateStyles()
{this.element.classList.toggle("showing-log",WebInspector.isShowingConsoleTab()||WebInspector.isShowingSplitConsole());}};WebInspector.QuickConsoleNavigationBar=class QuickConsoleNavigationBar extends WebInspector.NavigationBar
{get sizesToFit()
{return true;}
addNavigationItem(navigationItem)
{return this.insertNavigationItem(navigationItem,0);}};WebInspector.RadioButtonNavigationItem=class RadioButtonNavigationItem extends WebInspector.ButtonNavigationItem
{constructor(identifier,toolTip,image,imageWidth,imageHeight)
{super(identifier,toolTip,image,imageWidth,imageHeight,null,"tab");this._initializedMinWidth=false;}
get selected()
{return this.element.classList.contains(WebInspector.RadioButtonNavigationItem.SelectedStyleClassName);}
set selected(flag)
{if(flag){this.element.classList.add(WebInspector.RadioButtonNavigationItem.SelectedStyleClassName);this.element.setAttribute("aria-selected","true");}else{this.element.classList.remove(WebInspector.RadioButtonNavigationItem.SelectedStyleClassName);this.element.setAttribute("aria-selected","false");}}
get active()
{return this.element.classList.contains(WebInspector.RadioButtonNavigationItem.ActiveStyleClassName);}
set active(flag)
{this.element.classList.toggle(WebInspector.RadioButtonNavigationItem.ActiveStyleClassName,flag);}
updateLayout(expandOnly)
{if(expandOnly)
return;var isSelected=this.selected;if(!isSelected){this.element.classList.add(WebInspector.RadioButtonNavigationItem.SelectedStyleClassName);this.element.setAttribute("aria-selected","true");}
if(!this._initializedMinWidth){var width=this.element.offsetWidth;if(width){this._initializedMinWidth=true;this.element.style.minWidth=width+"px";}}
if(!isSelected){this.element.classList.remove(WebInspector.RadioButtonNavigationItem.SelectedStyleClassName);this.element.setAttribute("aria-selected","false");}}
get additionalClassNames()
{return["radio","button"];}};WebInspector.RadioButtonNavigationItem.StyleClassName="radio";WebInspector.RadioButtonNavigationItem.ActiveStyleClassName="active";WebInspector.RadioButtonNavigationItem.SelectedStyleClassName="selected";WebInspector.RenderingFrameTimelineDataGridNode=class RenderingFrameTimelineDataGridNode extends WebInspector.TimelineDataGridNode
{constructor(renderingFrameTimelineRecord,baseStartTime)
{super(false,null);this._record=renderingFrameTimelineRecord;this._baseStartTime=baseStartTime||0;}
get records()
{return[this._record];}
get data()
{if(!this._cachedData){let name=WebInspector.TimelineTabContentView.displayNameForRecord(this._record);let scriptTime=this._record.durationForTask(WebInspector.RenderingFrameTimelineRecord.TaskType.Script);let layoutTime=this._record.durationForTask(WebInspector.RenderingFrameTimelineRecord.TaskType.Layout);let paintTime=this._record.durationForTask(WebInspector.RenderingFrameTimelineRecord.TaskType.Paint);let otherTime=this._record.durationForTask(WebInspector.RenderingFrameTimelineRecord.TaskType.Other);this._cachedData={name,startTime:this._record.startTime,totalTime:this._record.duration,scriptTime,layoutTime,paintTime,otherTime,};}
return this._cachedData;}
createCellContent(columnIdentifier,cell)
{var value=this.data[columnIdentifier];switch(columnIdentifier){case"name":cell.classList.add(...this.iconClassNames());return value;case"startTime":return isNaN(value)?emDash:Number.secondsToString(value-this._baseStartTime,true);case"scriptTime":case"layoutTime":case"paintTime":case"otherTime":case"totalTime":return(isNaN(value)||value===0)?emDash:Number.secondsToString(value,true);}
return super.createCellContent(columnIdentifier,cell);}};WebInspector.RenderingFrameTimelineOverviewGraph=class RenderingFrameTimelineOverviewGraph extends WebInspector.TimelineOverviewGraph
{constructor(timeline,timelineOverview)
{super(timelineOverview);this.element.classList.add("rendering-frame");this.element.addEventListener("click",this._mouseClicked.bind(this));this._renderingFrameTimeline=timeline;this._renderingFrameTimeline.addEventListener(WebInspector.Timeline.Event.RecordAdded,this._timelineRecordAdded,this);this._selectedFrameMarker=document.createElement("div");this._selectedFrameMarker.classList.add("frame-marker");this._timelineRecordFrames=[];this._selectedTimelineRecordFrame=null;this._graphHeightSeconds=NaN;this._framesPerSecondDividerMap=new Map;this.reset();}
get graphHeightSeconds()
{if(!isNaN(this._graphHeightSeconds))
return this._graphHeightSeconds;var maximumFrameDuration=this._renderingFrameTimeline.records.reduce(function(previousValue,currentValue){return Math.max(previousValue,currentValue.duration);},0);this._graphHeightSeconds=maximumFrameDuration*1.1;this._graphHeightSeconds=Math.min(this._graphHeightSeconds,WebInspector.RenderingFrameTimelineOverviewGraph.MaximumGraphHeightSeconds);this._graphHeightSeconds=Math.max(this._graphHeightSeconds,WebInspector.RenderingFrameTimelineOverviewGraph.MinimumGraphHeightSeconds);return this._graphHeightSeconds;}
reset()
{super.reset();this.element.removeChildren();this.selectedRecord=null;this._framesPerSecondDividerMap.clear();}
recordWasFiltered(record,filtered)
{super.recordWasFiltered(record,filtered);if(!(record instanceof WebInspector.RenderingFrameTimelineRecord))
return;record[WebInspector.RenderingFrameTimelineOverviewGraph.RecordWasFilteredSymbol]=filtered;const startIndex=Math.floor(this.startTime);const endIndex=Math.min(Math.floor(this.endTime),this._renderingFrameTimeline.records.length-1);if(record.frameIndex<startIndex||record.frameIndex>endIndex)
return;const frameIndex=record.frameIndex-startIndex;this._timelineRecordFrames[frameIndex].filtered=filtered;}
get height()
{return 108;}
layout()
{if(!this.visible)
return;if(!this._renderingFrameTimeline.records.length)
return;let records=this._renderingFrameTimeline.records;let startIndex=Math.floor(this.startTime);let endIndex=Math.min(Math.floor(this.endTime),records.length-1);let recordFrameIndex=0;for(let i=startIndex;i<=endIndex;++i){let record=records[i];let timelineRecordFrame=this._timelineRecordFrames[recordFrameIndex];if(!timelineRecordFrame)
timelineRecordFrame=this._timelineRecordFrames[recordFrameIndex]=new WebInspector.TimelineRecordFrame(this,record);else
timelineRecordFrame.record=record;timelineRecordFrame.refresh(this);if(!timelineRecordFrame.element.parentNode)
this.element.appendChild(timelineRecordFrame.element);timelineRecordFrame.filtered=record[WebInspector.RenderingFrameTimelineOverviewGraph.RecordWasFilteredSymbol]||false;++recordFrameIndex;}
for(;recordFrameIndex<this._timelineRecordFrames.length;++recordFrameIndex){this._timelineRecordFrames[recordFrameIndex].record=null;this._timelineRecordFrames[recordFrameIndex].element.remove();}
this._updateDividers();this._updateFrameMarker();}
updateSelectedRecord()
{if(!this.selectedRecord){this._updateFrameMarker();return;}
const visibleDuration=this.timelineOverview.visibleDuration;const frameIndex=this.selectedRecord.frameIndex;if(frameIndex<Math.ceil(this.timelineOverview.scrollStartTime)||frameIndex>=this.timelineOverview.scrollStartTime+visibleDuration){var scrollStartTime=frameIndex;if(!this._selectedTimelineRecordFrame||Math.abs(this._selectedTimelineRecordFrame.record.frameIndex-this.selectedRecord.frameIndex)>1){scrollStartTime-=Math.floor(visibleDuration/2);scrollStartTime=Math.max(Math.min(scrollStartTime,this.timelineOverview.endTime),this.timelineOverview.startTime);}
this.timelineOverview.scrollStartTime=scrollStartTime;return;}
this._updateFrameMarker();}
_timelineRecordAdded(event)
{this._graphHeightSeconds=NaN;this.needsLayout();}
_updateDividers()
{if(this.graphHeightSeconds===0)
return;let overviewGraphHeight=this.height;function createDividerAtPosition(framesPerSecond)
{var secondsPerFrame=1/framesPerSecond;var dividerTop=1-secondsPerFrame/this.graphHeightSeconds;if(dividerTop<0.01||dividerTop>=1)
return;var divider=this._framesPerSecondDividerMap.get(framesPerSecond);if(!divider){divider=document.createElement("div");divider.classList.add("divider");var label=document.createElement("div");label.classList.add("label");label.innerText=WebInspector.UIString("%d fps").format(framesPerSecond);divider.appendChild(label);this.element.appendChild(divider);this._framesPerSecondDividerMap.set(framesPerSecond,divider);}
divider.style.marginTop=(dividerTop*overviewGraphHeight).toFixed(2)+"px";}
createDividerAtPosition.call(this,60);createDividerAtPosition.call(this,30);}
_updateFrameMarker()
{if(this._selectedTimelineRecordFrame){this._selectedTimelineRecordFrame.selected=false;this._selectedTimelineRecordFrame=null;}
if(!this.selectedRecord){if(this._selectedFrameMarker.parentElement)
this.element.removeChild(this._selectedFrameMarker);return;}
var frameWidth=(1/this.timelineOverview.secondsPerPixel);this._selectedFrameMarker.style.width=frameWidth+"px";var markerLeftPosition=this.selectedRecord.frameIndex-this.startTime;let property=WebInspector.resolvedLayoutDirection()===WebInspector.LayoutDirection.RTL?"right":"left";this._selectedFrameMarker.style.setProperty(property,((markerLeftPosition/this.timelineOverview.visibleDuration)*100).toFixed(2)+"%");if(!this._selectedFrameMarker.parentElement)
this.element.appendChild(this._selectedFrameMarker);var index=this._timelineRecordFrames.binaryIndexOf(this.selectedRecord,function(record,frame){return frame.record?record.frameIndex-frame.record.frameIndex:-1;});if(index<0||index>=this._timelineRecordFrames.length)
return;this._selectedTimelineRecordFrame=this._timelineRecordFrames[index];this._selectedTimelineRecordFrame.selected=true;}
_mouseClicked(event)
{let position=0;if(WebInspector.resolvedLayoutDirection()===WebInspector.LayoutDirection.RTL)
position=this.element.totalOffsetRight-event.pageX;else
position=event.pageX-this.element.totalOffsetLeft;var frameIndex=Math.floor(position*this.timelineOverview.secondsPerPixel+this.startTime);if(frameIndex<0||frameIndex>=this._renderingFrameTimeline.records.length)
return;var newSelectedRecord=this._renderingFrameTimeline.records[frameIndex];if(newSelectedRecord[WebInspector.RenderingFrameTimelineOverviewGraph.RecordWasFilteredSymbol])
return;if(this.selectedRecord===newSelectedRecord)
return;if(frameIndex>=this.timelineOverview.selectionStartTime&&frameIndex<this.timelineOverview.selectionStartTime+this.timelineOverview.selectionDuration){this.selectedRecord=newSelectedRecord;return;}
this.selectedRecord=newSelectedRecord;this.timelineOverview.selectionStartTime=frameIndex;this.timelineOverview.selectionDuration=1;}};WebInspector.RenderingFrameTimelineOverviewGraph.RecordWasFilteredSymbol=Symbol("rendering-frame-overview-graph-record-was-filtered");WebInspector.RenderingFrameTimelineOverviewGraph.MaximumGraphHeightSeconds=0.037;WebInspector.RenderingFrameTimelineOverviewGraph.MinimumGraphHeightSeconds=0.0185;WebInspector.RenderingFrameTimelineView=class RenderingFrameTimelineView extends WebInspector.TimelineView
{constructor(timeline,extraArguments)
{super(timeline,extraArguments);var scopeBarItems=[];for(var key in WebInspector.RenderingFrameTimelineView.DurationFilter){var value=WebInspector.RenderingFrameTimelineView.DurationFilter[key];scopeBarItems.push(new WebInspector.ScopeBarItem(value,WebInspector.RenderingFrameTimelineView.displayNameForDurationFilter(value)));}
this._scopeBar=new WebInspector.ScopeBar("rendering-frame-scope-bar",scopeBarItems,scopeBarItems[0],true);this._scopeBar.addEventListener(WebInspector.ScopeBar.Event.SelectionChanged,this._scopeBarSelectionDidChange,this);let columns={name:{},totalTime:{},scriptTime:{},layoutTime:{},paintTime:{},otherTime:{},startTime:{},location:{}};columns.name.title=WebInspector.UIString("Name");columns.name.width="20%";columns.name.icon=true;columns.name.disclosure=true;columns.name.locked=true;columns.totalTime.title=WebInspector.UIString("Total Time");columns.totalTime.width="15%";columns.totalTime.aligned="right";columns.scriptTime.title=WebInspector.RenderingFrameTimelineRecord.displayNameForTaskType(WebInspector.RenderingFrameTimelineRecord.TaskType.Script);columns.scriptTime.width="10%";columns.scriptTime.aligned="right";columns.layoutTime.title=WebInspector.RenderingFrameTimelineRecord.displayNameForTaskType(WebInspector.RenderingFrameTimelineRecord.TaskType.Layout);columns.layoutTime.width="10%";columns.layoutTime.aligned="right";columns.paintTime.title=WebInspector.RenderingFrameTimelineRecord.displayNameForTaskType(WebInspector.RenderingFrameTimelineRecord.TaskType.Paint);columns.paintTime.width="10%";columns.paintTime.aligned="right";columns.otherTime.title=WebInspector.RenderingFrameTimelineRecord.displayNameForTaskType(WebInspector.RenderingFrameTimelineRecord.TaskType.Other);columns.otherTime.width="10%";columns.otherTime.aligned="right";columns.startTime.title=WebInspector.UIString("Start Time");columns.startTime.width="15%";columns.startTime.aligned="right";columns.location.title=WebInspector.UIString("Location");for(var column in columns)
columns[column].sortable=true;this._dataGrid=new WebInspector.TimelineDataGrid(columns);this._dataGrid.sortColumnIdentifier="startTime";this._dataGrid.sortOrder=WebInspector.DataGrid.SortOrder.Ascending;this._dataGrid.createSettings("rendering-frame-timeline-view");this.setupDataGrid(this._dataGrid);this.element.classList.add("rendering-frame");this.addSubview(this._dataGrid);timeline.addEventListener(WebInspector.Timeline.Event.RecordAdded,this._renderingFrameTimelineRecordAdded,this);this._pendingRecords=[];}
static displayNameForDurationFilter(filter)
{switch(filter){case WebInspector.RenderingFrameTimelineView.DurationFilter.All:return WebInspector.UIString("All");case WebInspector.RenderingFrameTimelineView.DurationFilter.OverOneMillisecond:return WebInspector.UIString("Over 1 ms");case WebInspector.RenderingFrameTimelineView.DurationFilter.OverFifteenMilliseconds:return WebInspector.UIString("Over 15 ms");default:console.error("Unknown filter type",filter);}
return null;}
get showsLiveRecordingData(){return false;}
shown()
{super.shown();this._dataGrid.shown();}
hidden()
{this._dataGrid.hidden();super.hidden();}
closed()
{this.representedObject.removeEventListener(null,null,this);this._dataGrid.closed();}
get selectionPathComponents()
{let dataGridNode=this._dataGrid.selectedNode;if(!dataGridNode||dataGridNode.hidden)
return null;let pathComponents=[];while(dataGridNode&&!dataGridNode.root){if(dataGridNode.hidden)
return null;let pathComponent=new WebInspector.TimelineDataGridNodePathComponent(dataGridNode);pathComponent.addEventListener(WebInspector.HierarchicalPathComponent.Event.SiblingWasSelected,this.dataGridNodePathComponentSelected,this);pathComponents.unshift(pathComponent);dataGridNode=dataGridNode.parent;}
return pathComponents;}
get filterStartTime()
{let records=this.representedObject.records;let startIndex=this.startTime;if(startIndex>=records.length)
return Infinity;return records[startIndex].startTime;}
get filterEndTime()
{let records=this.representedObject.records;let endIndex=this.endTime-1;if(endIndex>=records.length)
return Infinity;return records[endIndex].endTime;}
reset()
{super.reset();this._dataGrid.reset();this._pendingRecords=[];}
dataGridNodePathComponentSelected(event)
{let dataGridNode=event.data.pathComponent.timelineDataGridNode;dataGridNode.revealAndSelect();}
dataGridNodeForTreeElement(treeElement)
{if(treeElement instanceof WebInspector.ProfileNodeTreeElement)
return new WebInspector.ProfileNodeDataGridNode(treeElement.profileNode,this.zeroTime,this.startTime,this.endTime);return null;}
matchDataGridNodeAgainstCustomFilters(node)
{if(!super.matchDataGridNodeAgainstCustomFilters(node))
return false;let selectedScopeBarItem=this._scopeBar.selectedItems[0];if(!selectedScopeBarItem||selectedScopeBarItem.id===WebInspector.RenderingFrameTimelineView.DurationFilter.All)
return true;while(node&&!(node.record instanceof WebInspector.RenderingFrameTimelineRecord))
node=node.parent;if(!node)
return false;let minimumDuration=selectedScopeBarItem.id===WebInspector.RenderingFrameTimelineView.DurationFilter.OverOneMillisecond?0.001:0.015;return node.record.duration>minimumDuration;}
layout()
{this._processPendingRecords();}
_processPendingRecords()
{if(!this._pendingRecords.length)
return;for(let renderingFrameTimelineRecord of this._pendingRecords){let dataGridNode=new WebInspector.RenderingFrameTimelineDataGridNode(renderingFrameTimelineRecord,this.zeroTime);this._dataGrid.addRowInSortOrder(null,dataGridNode);let stack=[{children:renderingFrameTimelineRecord.children,parentDataGridNode:dataGridNode,index:0}];while(stack.length){let entry=stack.lastValue;if(entry.index>=entry.children.length){stack.pop();continue;}
let childRecord=entry.children[entry.index];let childDataGridNode=null;if(childRecord.type===WebInspector.TimelineRecord.Type.Layout){childDataGridNode=new WebInspector.LayoutTimelineDataGridNode(childRecord,this.zeroTime);this._dataGrid.addRowInSortOrder(null,childDataGridNode,entry.parentDataGridNode);}else if(childRecord.type===WebInspector.TimelineRecord.Type.Script){let rootNodes=[];if(childRecord.profile){rootNodes=childRecord.profile.topDownRootNodes;}
childDataGridNode=new WebInspector.ScriptTimelineDataGridNode(childRecord,this.zeroTime);this._dataGrid.addRowInSortOrder(null,childDataGridNode,entry.parentDataGridNode);for(let profileNode of rootNodes){let profileNodeDataGridNode=new WebInspector.ProfileNodeDataGridNode(profileNode,this.zeroTime,this.startTime,this.endTime);this._dataGrid.addRowInSortOrder(null,profileNodeDataGridNode,childDataGridNode);}}
if(childDataGridNode&&childRecord.children.length)
stack.push({children:childRecord.children,parentDataGridNode:childDataGridNode,index:0});++entry.index;}}
this._pendingRecords=[];}
_renderingFrameTimelineRecordAdded(event)
{var renderingFrameTimelineRecord=event.data.record;this._pendingRecords.push(renderingFrameTimelineRecord);this.needsLayout();}
_scopeBarSelectionDidChange()
{this._dataGrid.filterDidChange();}};WebInspector.RenderingFrameTimelineView.DurationFilter={All:"rendering-frame-timeline-view-duration-filter-all",OverOneMillisecond:"rendering-frame-timeline-view-duration-filter-over-1-ms",OverFifteenMilliseconds:"rendering-frame-timeline-view-duration-filter-over-15-ms"};WebInspector.Resizer=class Resizer extends WebInspector.Object
{constructor(ruleOrientation,delegate)
{super();this._delegate=delegate;this._orientation=ruleOrientation;this._element=document.createElement("div");this._element.classList.add("resizer");if(this._orientation===WebInspector.Resizer.RuleOrientation.Horizontal)
this._element.classList.add("horizontal-rule");else if(this._orientation===WebInspector.Resizer.RuleOrientation.Vertical)
this._element.classList.add("vertical-rule");this._element.addEventListener("mousedown",this._resizerMouseDown.bind(this),false);this._resizerMouseMovedEventListener=this._resizerMouseMoved.bind(this);this._resizerMouseUpEventListener=this._resizerMouseUp.bind(this);}
get element()
{return this._element;}
get orientation()
{return this._orientation;}
get initialPosition()
{return this._resizerMouseDownPosition||NaN;}
_currentPosition()
{if(this._orientation===WebInspector.Resizer.RuleOrientation.Vertical)
return event.pageX;if(this._orientation===WebInspector.Resizer.RuleOrientation.Horizontal)
return event.pageY;}
_resizerMouseDown(event)
{if(event.button!==0||event.ctrlKey)
return;this._resizerMouseDownPosition=this._currentPosition();var delegateRequestedAbort=false;if(typeof this._delegate.resizerDragStarted==="function")
delegateRequestedAbort=this._delegate.resizerDragStarted(this,event.target);if(delegateRequestedAbort){delete this._resizerMouseDownPosition;return;}
if(this._orientation===WebInspector.Resizer.RuleOrientation.Vertical)
document.body.style.cursor="col-resize";else{document.body.style.cursor="row-resize";}
document.addEventListener("mousemove",this._resizerMouseMovedEventListener,false);document.addEventListener("mouseup",this._resizerMouseUpEventListener,false);event.preventDefault();event.stopPropagation();if(WebInspector._elementDraggingGlassPane)
WebInspector._elementDraggingGlassPane.remove();var glassPaneElement=document.createElement("div");glassPaneElement.className="glass-pane-for-drag";document.body.appendChild(glassPaneElement);WebInspector._elementDraggingGlassPane=glassPaneElement;}
_resizerMouseMoved(event)
{event.preventDefault();event.stopPropagation();if(typeof this._delegate.resizerDragging==="function")
this._delegate.resizerDragging(this,this._resizerMouseDownPosition-this._currentPosition());}
_resizerMouseUp(event)
{if(event.button!==0||event.ctrlKey)
return;document.body.style.removeProperty("cursor");if(WebInspector._elementDraggingGlassPane){WebInspector._elementDraggingGlassPane.remove();delete WebInspector._elementDraggingGlassPane;}
document.removeEventListener("mousemove",this._resizerMouseMovedEventListener,false);document.removeEventListener("mouseup",this._resizerMouseUpEventListener,false);event.preventDefault();event.stopPropagation();if(typeof this._delegate.resizerDragEnded==="function")
this._delegate.resizerDragEnded(this);delete this._resizerMouseDownPosition;}};WebInspector.Resizer.RuleOrientation={Horizontal:Symbol("resizer-rule-orientation-horizontal"),Vertical:Symbol("resizer-rule-orientation-vertical"),};WebInspector.ResourceClusterContentView=class ResourceClusterContentView extends WebInspector.ClusterContentView
{constructor(resource)
{super(resource);this._resource=resource;this._resource.addEventListener(WebInspector.Resource.Event.TypeDidChange,this._resourceTypeDidChange,this);this._resource.addEventListener(WebInspector.Resource.Event.LoadingDidFinish,this._resourceLoadingDidFinish,this);function createPathComponent(displayName,className,identifier)
{let pathComponent=new WebInspector.HierarchicalPathComponent(displayName,className,identifier,false,true);pathComponent.addEventListener(WebInspector.HierarchicalPathComponent.Event.SiblingWasSelected,this._pathComponentSelected,this);pathComponent.comparisonData=resource;return pathComponent;}
this._requestPathComponent=createPathComponent.call(this,WebInspector.UIString("Request"),WebInspector.ResourceClusterContentView.RequestIconStyleClassName,WebInspector.ResourceClusterContentView.RequestIdentifier);this._responsePathComponent=createPathComponent.call(this,WebInspector.UIString("Response"),WebInspector.ResourceClusterContentView.ResponseIconStyleClassName,WebInspector.ResourceClusterContentView.ResponseIdentifier);this._requestPathComponent.nextSibling=this._responsePathComponent;this._responsePathComponent.previousSibling=this._requestPathComponent;this._currentContentViewSetting=new WebInspector.Setting("resource-current-view-"+this._resource.url.hash,WebInspector.ResourceClusterContentView.ResponseIdentifier);}
get resource()
{return this._resource;}
get responseContentView()
{if(this._responseContentView)
return this._responseContentView;switch(this._resource.type){case WebInspector.Resource.Type.Document:case WebInspector.Resource.Type.Script:case WebInspector.Resource.Type.Stylesheet:this._responseContentView=new WebInspector.TextResourceContentView(this._resource);break;case WebInspector.Resource.Type.XHR:case WebInspector.Resource.Type.Fetch:
this._responseContentView=new WebInspector.TextResourceContentView(this._resource);break;case WebInspector.Resource.Type.Image:if(this._resource.mimeTypeComponents.type==="image/svg+xml")
this._responseContentView=new WebInspector.SVGImageResourceClusterContentView(this._resource);else
this._responseContentView=new WebInspector.ImageResourceContentView(this._resource);break;case WebInspector.Resource.Type.Font:this._responseContentView=new WebInspector.FontResourceContentView(this._resource);break;case WebInspector.Resource.Type.WebSocket:this._responseContentView=new WebInspector.WebSocketContentView(this._resource);break;default:this._responseContentView=new WebInspector.GenericResourceContentView(this._resource);break;}
return this._responseContentView;}
get requestContentView()
{if(!this._canShowRequestContentView())
return null;if(this._requestContentView)
return this._requestContentView;this._requestContentView=new WebInspector.TextContentView(this._resource.requestData||"",this._resource.requestDataContentType);return this._requestContentView;}
get selectionPathComponents()
{var currentContentView=this._contentViewContainer.currentContentView;if(!currentContentView)
return[];if(!this._canShowRequestContentView())
return currentContentView.selectionPathComponents;var components=[this._pathComponentForContentView(currentContentView)];return components.concat(currentContentView.selectionPathComponents);}
shown()
{super.shown();if(this._shownInitialContent)
return;this._showContentViewForIdentifier(this._currentContentViewSetting.value);}
closed()
{super.closed();this._shownInitialContent=false;}
saveToCookie(cookie)
{cookie[WebInspector.ResourceClusterContentView.ContentViewIdentifierCookieKey]=this._currentContentViewSetting.value;}
restoreFromCookie(cookie)
{var contentView=this._showContentViewForIdentifier(cookie[WebInspector.ResourceClusterContentView.ContentViewIdentifierCookieKey]);if(typeof contentView.revealPosition==="function"&&"lineNumber"in cookie&&"columnNumber"in cookie)
contentView.revealPosition(new WebInspector.SourceCodePosition(cookie.lineNumber,cookie.columnNumber));}
showRequest()
{this._shownInitialContent=true;return this._showContentViewForIdentifier(WebInspector.ResourceClusterContentView.RequestIdentifier);}
showResponse(positionToReveal,textRangeToSelect,forceUnformatted)
{this._shownInitialContent=true;if(!this._resource.finished){this._positionToReveal=positionToReveal;this._textRangeToSelect=textRangeToSelect;this._forceUnformatted=forceUnformatted;}
var responseContentView=this._showContentViewForIdentifier(WebInspector.ResourceClusterContentView.ResponseIdentifier);if(typeof responseContentView.revealPosition==="function")
responseContentView.revealPosition(positionToReveal,textRangeToSelect,forceUnformatted);return responseContentView;}
_canShowRequestContentView()
{var requestData=this._resource.requestData;if(!requestData)
return false;var requestDataContentType=this._resource.requestDataContentType;if(requestDataContentType&&requestDataContentType.match(/^application\/x-www-form-urlencoded\s*(;.*)?$/i))
return false;return true;}
_pathComponentForContentView(contentView)
{if(!contentView)
return null;if(contentView===this._requestContentView)
return this._requestPathComponent;if(contentView===this._responseContentView)
return this._responsePathComponent;console.error("Unknown contentView.");return null;}
_identifierForContentView(contentView)
{if(!contentView)
return null;if(contentView===this._requestContentView)
return WebInspector.ResourceClusterContentView.RequestIdentifier;if(contentView===this._responseContentView)
return WebInspector.ResourceClusterContentView.ResponseIdentifier;console.error("Unknown contentView.");return null;}
_showContentViewForIdentifier(identifier)
{var contentViewToShow=null;switch(identifier){case WebInspector.ResourceClusterContentView.RequestIdentifier:contentViewToShow=this._canShowRequestContentView()?this.requestContentView:null;break;case WebInspector.ResourceClusterContentView.ResponseIdentifier:contentViewToShow=this.responseContentView;break;}
if(!contentViewToShow)
contentViewToShow=this.responseContentView;this._currentContentViewSetting.value=this._identifierForContentView(contentViewToShow);return this.contentViewContainer.showContentView(contentViewToShow);}
_pathComponentSelected(event)
{this._showContentViewForIdentifier(event.data.pathComponent.representedObject);}
_resourceTypeDidChange(event)
{
var currentResponseContentView=this._responseContentView;if(!currentResponseContentView)
return;this._responseContentView=null;this.contentViewContainer.replaceContentView(currentResponseContentView,this.responseContentView);}
_resourceLoadingDidFinish(event)
{if("_positionToReveal"in this){if(this._contentViewContainer.currentContentView===this._responseContentView)
this._responseContentView.revealPosition(this._positionToReveal,this._textRangeToSelect,this._forceUnformatted);delete this._positionToReveal;delete this._textRangeToSelect;delete this._forceUnformatted;}}};WebInspector.ResourceClusterContentView.ContentViewIdentifierCookieKey="resource-cluster-content-view-identifier";WebInspector.ResourceClusterContentView.RequestIconStyleClassName="request-icon";WebInspector.ResourceClusterContentView.ResponseIconStyleClassName="response-icon";WebInspector.ResourceClusterContentView.RequestIdentifier="request";WebInspector.ResourceClusterContentView.ResponseIdentifier="response";WebInspector.ResourceDetailsSidebarPanel=class ResourceDetailsSidebarPanel extends WebInspector.DetailsSidebarPanel
{constructor()
{super("resource-details",WebInspector.UIString("Resource"));this.element.classList.add("resource");this._resource=null;this._needsToApplyResourceEventListeners=false;this._needsToRemoveResourceEventListeners=false;}
inspect(objects)
{if(!(objects instanceof Array))
objects=[objects];var resourceToInspect=null;for(let object of objects){if(object instanceof WebInspector.Resource){resourceToInspect=object;break;}
if(object instanceof WebInspector.Frame){resourceToInspect=object.mainResource;break;}
if(object instanceof WebInspector.Script&&object.isMainResource()&&object.resource){resourceToInspect=object.resource;break;}}
this.resource=resourceToInspect;return!!this._resource;}
get resource()
{return this._resource;}
set resource(resource)
{if(resource===this._resource)
return;if(this._resource&&this._needsToRemoveResourceEventListeners){this._resource.removeEventListener(WebInspector.Resource.Event.URLDidChange,this._refreshURL,this);this._resource.removeEventListener(WebInspector.Resource.Event.MIMETypeDidChange,this._refreshMIMEType,this);this._resource.removeEventListener(WebInspector.Resource.Event.TypeDidChange,this._refreshResourceType,this);this._resource.removeEventListener(WebInspector.Resource.Event.LoadingDidFail,this._refreshErrorReason,this);this._resource.removeEventListener(WebInspector.Resource.Event.RequestHeadersDidChange,this._refreshRequestHeaders,this);this._resource.removeEventListener(WebInspector.Resource.Event.ResponseReceived,this._refreshRequestAndResponse,this);this._resource.removeEventListener(WebInspector.Resource.Event.CacheStatusDidChange,this._refreshRequestAndResponse,this);this._resource.removeEventListener(WebInspector.Resource.Event.SizeDidChange,this._refreshDecodedSize,this);this._resource.removeEventListener(WebInspector.Resource.Event.TransferSizeDidChange,this._refreshTransferSize,this);this._resource.removeEventListener(WebInspector.Resource.Event.InitiatedResourcesDidChange,this._refreshRelatedResourcesSection,this);this._needsToRemoveResourceEventListeners=false;}
this._resource=resource;if(this._resource){if(this.parentSidebar)
this._applyResourceEventListeners();else
this._needsToApplyResourceEventListeners=true;}
this.needsLayout();}
initialLayout()
{super.initialLayout();this._typeMIMETypeRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("MIME Type"));this._typeResourceTypeRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Resource Type"));this._typeSection=new WebInspector.DetailsSection("resource-type",WebInspector.UIString("Type"));this._typeSection.groups=[new WebInspector.DetailsSectionGroup([this._typeMIMETypeRow,this._typeResourceTypeRow])];this._locationFullURLRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Full URL"));this._locationSchemeRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Scheme"));this._locationHostRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Host"));this._locationPortRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Port"));this._locationPathRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Path"));this._locationQueryStringRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Query String"));this._locationFragmentRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Fragment"));this._locationFilenameRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Filename"));this._initiatorRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Initiator"));this._initiatedRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Initiated"));var firstGroup=[this._locationFullURLRow];var secondGroup=[this._locationSchemeRow,this._locationHostRow,this._locationPortRow,this._locationPathRow,this._locationQueryStringRow,this._locationFragmentRow,this._locationFilenameRow];var thirdGroup=[this._initiatorRow,this._initiatedRow];this._fullURLGroup=new WebInspector.DetailsSectionGroup(firstGroup);this._locationURLComponentsGroup=new WebInspector.DetailsSectionGroup(secondGroup);this._relatedResourcesGroup=new WebInspector.DetailsSectionGroup(thirdGroup);this._locationSection=new WebInspector.DetailsSection("resource-location",WebInspector.UIString("Location"),[this._fullURLGroup,this._locationURLComponentsGroup,this._relatedResourcesGroup]);this._queryParametersRow=new WebInspector.DetailsSectionDataGridRow(null,WebInspector.UIString("No Query Parameters"));this._queryParametersSection=new WebInspector.DetailsSection("resource-query-parameters",WebInspector.UIString("Query Parameters"));this._queryParametersSection.groups=[new WebInspector.DetailsSectionGroup([this._queryParametersRow])];this._requestDataSection=new WebInspector.DetailsSection("resource-request-data",WebInspector.UIString("Request Data"));this._requestMethodRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Method"));this._protocolRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Protocol"));this._priorityRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Priority"));this._cachedRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Cached"));this._statusTextRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Status"));this._statusCodeRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Code"));this._errorReasonRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Error"));this._remoteAddressRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("IP Address"));this._connectionIdentifierRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Connection ID"));this._encodedSizeRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Encoded"));this._decodedSizeRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Decoded"));this._transferSizeRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Transferred"));this._compressedRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Compressed"));this._compressionRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Compression"));let requestGroup=new WebInspector.DetailsSectionGroup([this._requestMethodRow,this._protocolRow,this._priorityRow,this._cachedRow]);let statusGroup=new WebInspector.DetailsSectionGroup([this._statusTextRow,this._statusCodeRow,this._errorReasonRow]);let connectionGroup=new WebInspector.DetailsSectionGroup([this._remoteAddressRow,this._connectionIdentifierRow]);let sizeGroup=new WebInspector.DetailsSectionGroup([this._encodedSizeRow,this._decodedSizeRow,this._transferSizeRow]);let compressionGroup=new WebInspector.DetailsSectionGroup([this._compressedRow,this._compressionRow]);this._requestAndResponseSection=new WebInspector.DetailsSection("resource-request-response",WebInspector.UIString("Request & Response"));this._requestAndResponseSection.groups=[requestGroup,statusGroup,connectionGroup,sizeGroup,compressionGroup];this._requestHeadersRow=new WebInspector.DetailsSectionDataGridRow(null,WebInspector.UIString("No Request Headers"));this._requestHeadersSection=new WebInspector.DetailsSection("resource-request-headers",WebInspector.UIString("Request Headers"));this._requestHeadersSection.groups=[new WebInspector.DetailsSectionGroup([this._requestHeadersRow])];this._responseHeadersRow=new WebInspector.DetailsSectionDataGridRow(null,WebInspector.UIString("No Response Headers"));this._responseHeadersSection=new WebInspector.DetailsSection("resource-response-headers",WebInspector.UIString("Response Headers"));this._responseHeadersSection.groups=[new WebInspector.DetailsSectionGroup([this._responseHeadersRow])];this._imageWidthRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Width"));this._imageHeightRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Height"));this._imageSizeSection=new WebInspector.DetailsSection("resource-type",WebInspector.UIString("Image Size"));this._imageSizeSection.groups=[new WebInspector.DetailsSectionGroup([this._imageWidthRow,this._imageHeightRow])];this.contentView.element.appendChild(this._typeSection.element);this.contentView.element.appendChild(this._locationSection.element);this.contentView.element.appendChild(this._requestAndResponseSection.element);this.contentView.element.appendChild(this._requestHeadersSection.element);this.contentView.element.appendChild(this._responseHeadersSection.element);if(this._needsToApplyResourceEventListeners){this._applyResourceEventListeners();this._needsToApplyResourceEventListeners=false;}}
layout()
{super.layout();if(!this._resource)
return;this._refreshURL();this._refreshMIMEType();this._refreshResourceType();this._refreshRequestAndResponse();this._refreshDecodedSize();this._refreshTransferSize();this._refreshRequestHeaders();this._refreshImageSizeSection();this._refreshRequestDataSection();this._refreshRelatedResourcesSection();}
sizeDidChange()
{super.sizeDidChange(); this._queryParametersRow.sizeDidChange();this._requestHeadersRow.sizeDidChange();this._responseHeadersRow.sizeDidChange();}
_refreshURL()
{if(!this._resource)
return;this._locationFullURLRow.value=this._resource.url.insertWordBreakCharacters();var urlComponents=this._resource.urlComponents;if(urlComponents.scheme){this._locationSection.groups=[this._fullURLGroup,this._locationURLComponentsGroup,this._relatedResourcesGroup];this._locationSchemeRow.value=urlComponents.scheme?urlComponents.scheme:null;this._locationHostRow.value=urlComponents.host?urlComponents.host:null;this._locationPortRow.value=urlComponents.port?urlComponents.port:null;this._locationPathRow.value=urlComponents.path?urlComponents.path.insertWordBreakCharacters():null;this._locationQueryStringRow.value=urlComponents.queryString?urlComponents.queryString.insertWordBreakCharacters():null;this._locationFragmentRow.value=urlComponents.fragment?urlComponents.fragment.insertWordBreakCharacters():null;this._locationFilenameRow.value=urlComponents.lastPathComponent?urlComponents.lastPathComponent.insertWordBreakCharacters():null;}else{this._locationSection.groups=[this._fullURLGroup,this._relatedResourcesGroup];}
if(urlComponents.queryString){this.contentView.element.insertBefore(this._queryParametersSection.element,this._requestAndResponseSection.element.nextSibling);this._queryParametersRow.dataGrid=this._createNameValueDataGrid(parseQueryString(urlComponents.queryString,true));}else{var queryParametersSectionElement=this._queryParametersSection.element;if(queryParametersSectionElement.parentNode)
queryParametersSectionElement.parentNode.removeChild(queryParametersSectionElement);}}
_refreshRelatedResourcesSection()
{let groups=this._locationSection.groups;let isSectionVisible=groups.includes(this._relatedResourcesGroup);if(!this._resource.initiatorSourceCodeLocation&&!this._resource.initiatedResources.length){if(isSectionVisible){groups.remove(this._relatedResourcesGroup);this._locationSection.groups=groups;}
return;}
if(!isSectionVisible){groups.push(this._relatedResourcesGroup);this._locationSection.groups=groups;}
let initiatorLocation=this._resource.initiatorSourceCodeLocation;if(initiatorLocation){const options={dontFloat:true,ignoreSearchTab:true,};this._initiatorRow.value=WebInspector.createSourceCodeLocationLink(initiatorLocation,options);}else
this._initiatorRow.value=null;let initiatedResources=this._resource.initiatedResources;if(initiatedResources.length){let resourceLinkContainer=document.createElement("div");for(let resource of initiatedResources)
resourceLinkContainer.appendChild(WebInspector.createResourceLink(resource));this._initiatedRow.value=resourceLinkContainer;}else
this._initiatedRow.value=null;}
_refreshResourceType()
{if(!this._resource)
return;this._typeResourceTypeRow.value=WebInspector.Resource.displayNameForType(this._resource.type);}
_refreshMIMEType()
{if(!this._resource)
return;this._typeMIMETypeRow.value=this._resource.mimeType;}
_refreshErrorReason()
{if(!this._resource)
return;if(!this._resource.hadLoadingError()){this._errorReasonRow.value=null;return;}
if(this._resource.failureReasonText)
this._errorReasonRow.value=this._resource.failureReasonText;else if(this._resource.statusCode>=400)
this._errorReasonRow.value=WebInspector.UIString("Failure status code");else if(this._resource.canceled)
this._errorReasonRow.value=WebInspector.UIString("Load cancelled");else
this._errorReasonRow.value=WebInspector.UIString("Unknown error");}
_refreshRequestAndResponse()
{if(!this._resource)
return;this._requestMethodRow.value=this._resource.requestMethod||emDash;if(window.NetworkAgent&&NetworkAgent.hasEventParameter("loadingFinished","metrics")){let protocolDisplayName=WebInspector.Resource.displayNameForProtocol(this._resource.protocol);this._protocolRow.value=protocolDisplayName||emDash;this._protocolRow.tooltip=protocolDisplayName?this._resource.protocol:"";this._priorityRow.value=WebInspector.Resource.displayNameForPriority(this._resource.priority)||emDash;this._remoteAddressRow.value=this._resource.remoteAddress||emDash;this._connectionIdentifierRow.value=this._resource.connectionIdentifier||emDash;}
this._cachedRow.value=this._cachedRowValue();this._statusCodeRow.value=this._resource.statusCode||emDash;this._statusTextRow.value=this._resource.statusText||emDash;this._refreshErrorReason();this._refreshResponseHeaders();this._refreshCompressed();}
_valueForSize(size)
{return size>0?Number.bytesToString(size):emDash;}
_refreshCompressed()
{if(this._resource.compressed){this._compressedRow.value=WebInspector.UIString("Yes");if(!this._resource.size)
this._compressionRow.value=emDash;else if(!isNaN(this._resource.networkEncodedSize))
this._compressionRow.value=this._resource.networkEncodedSize?WebInspector.UIString("%.2f\u00d7").format(this._resource.size/this._resource.networkEncodedSize):emDash;else
this._compressionRow.value=this._resource.estimatedNetworkEncodedSize?WebInspector.UIString("%.2f\u00d7").format(this._resource.size/this._resource.estimatedNetworkEncodedSize):emDash;}else{this._compressedRow.value=WebInspector.UIString("No");this._compressionRow.value=null;}}
_refreshDecodedSize()
{if(!this._resource)
return;let encodedSize=!isNaN(this._resource.networkEncodedSize)?this._resource.networkEncodedSize:this._resource.estimatedNetworkEncodedSize;let decodedSize=!isNaN(this._resource.networkDecodedSize)?this._resource.networkDecodedSize:this._resource.size;this._encodedSizeRow.value=this._valueForSize(encodedSize);this._decodedSizeRow.value=this._valueForSize(decodedSize);this._refreshCompressed();}
_refreshTransferSize()
{if(!this._resource)
return;let encodedSize=!isNaN(this._resource.networkEncodedSize)?this._resource.networkEncodedSize:this._resource.estimatedNetworkEncodedSize;let transferSize=!isNaN(this._resource.networkTotalTransferSize)?this._resource.networkTotalTransferSize:this._resource.estimatedTotalTransferSize;this._encodedSizeRow.value=this._valueForSize(encodedSize);this._transferSizeRow.value=this._valueForSize(transferSize);this._refreshCompressed();}
_refreshRequestHeaders()
{if(!this._resource)
return;this._requestHeadersRow.dataGrid=this._createNameValueDataGrid(this._resource.requestHeaders);}
_refreshResponseHeaders()
{if(!this._resource)
return;this._responseHeadersRow.dataGrid=this._createNameValueDataGrid(this._resource.responseHeaders);}
_createNameValueDataGrid(data)
{if(!data||data instanceof Array?!data.length:isEmptyObject(data))
return null;var dataGrid=new WebInspector.DataGrid({name:{title:WebInspector.UIString("Name"),width:"30%",sortable:true},value:{title:WebInspector.UIString("Value"),sortable:true}});dataGrid.copyTextDelimiter=": ";function addDataGridNode(nodeValue)
{var node=new WebInspector.DataGridNode({name:nodeValue.name,value:nodeValue.value||""},false);dataGrid.appendChild(node);}
if(data instanceof Array){for(var i=0;i<data.length;++i)
addDataGridNode(data[i]);}else{for(var name in data)
addDataGridNode({name,value:data[name]||""});}
dataGrid.addEventListener(WebInspector.DataGrid.Event.SortChanged,sortDataGrid,this);function sortDataGrid()
{var sortColumnIdentifier=dataGrid.sortColumnIdentifier;function comparator(a,b)
{var item1=a.data[sortColumnIdentifier];var item2=b.data[sortColumnIdentifier];return item1.extendedLocaleCompare(item2);}
dataGrid.sortNodes(comparator);}
return dataGrid;}
_refreshImageSizeSection()
{var resource=this._resource;if(!resource)
return;function hideImageSection(){this._imageSizeSection.element.remove();}
if(resource.type!==WebInspector.Resource.Type.Image||resource.failed){hideImageSection.call(this);return;}
this.contentView.element.insertBefore(this._imageSizeSection.element,this._locationSection.element);resource.getImageSize((size)=>{if(size){this._imageWidthRow.value=WebInspector.UIString("%dpx").format(size.width);this._imageHeightRow.value=WebInspector.UIString("%dpx").format(size.height);}else
hideImageSection.call(this);});}
_cachedRowValue()
{let responseSource=this._resource.responseSource;if(responseSource===WebInspector.Resource.ResponseSource.MemoryCache||responseSource===WebInspector.Resource.ResponseSource.DiskCache){let span=document.createElement("span");let cacheType=document.createElement("span");cacheType.classList="cache-type";cacheType.textContent=responseSource===WebInspector.Resource.ResponseSource.MemoryCache?WebInspector.UIString("(Memory)"):WebInspector.UIString("(Disk)");span.append(WebInspector.UIString("Yes")," ",cacheType);return span;}
return this._resource.cached?WebInspector.UIString("Yes"):WebInspector.UIString("No");}
_goToRequestDataClicked()
{const options={ignoreSearchTab:true,};WebInspector.showResourceRequest(this._resource,options);}
_refreshRequestDataSection()
{var resource=this._resource;if(!resource)
return;var requestData=resource.requestData;if(!requestData){this._requestDataSection.element.remove();return;}
this.contentView.element.insertBefore(this._requestDataSection.element,this._requestHeadersSection.element);var requestDataContentType=resource.requestDataContentType||"";if(requestDataContentType&&requestDataContentType.match(/^application\/x-www-form-urlencoded\s*(;.*)?$/i)){var parametersRow=new WebInspector.DetailsSectionDataGridRow(null,WebInspector.UIString("No Parameters"));parametersRow.dataGrid=this._createNameValueDataGrid(parseQueryString(requestData,true));this._requestDataSection.groups=[new WebInspector.DetailsSectionGroup([parametersRow])];return;}
var mimeTypeComponents=parseMIMEType(requestDataContentType);var mimeType=mimeTypeComponents.type;var boundary=mimeTypeComponents.boundary;var encoding=mimeTypeComponents.encoding;var rows=[];var mimeTypeRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("MIME Type"));mimeTypeRow.value=mimeType;rows.push(mimeTypeRow);if(boundary){var boundryRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Boundary"));boundryRow.value=boundary;rows.push(boundryRow);}
if(encoding){var encodingRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Encoding"));encodingRow.value=encoding;rows.push(encodingRow);}
var sizeValue=Number.bytesToString(requestData.length);var dataValue=document.createDocumentFragment();dataValue.append(sizeValue);var goToButton=dataValue.appendChild(WebInspector.createGoToArrowButton());goToButton.addEventListener("click",this._goToRequestDataClicked.bind(this));var dataRow=new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Data"));dataRow.value=dataValue;rows.push(dataRow);this._requestDataSection.groups=[new WebInspector.DetailsSectionGroup(rows)];}
_applyResourceEventListeners()
{this._resource.addEventListener(WebInspector.Resource.Event.URLDidChange,this._refreshURL,this);this._resource.addEventListener(WebInspector.Resource.Event.MIMETypeDidChange,this._refreshMIMEType,this);this._resource.addEventListener(WebInspector.Resource.Event.TypeDidChange,this._refreshResourceType,this);this._resource.addEventListener(WebInspector.Resource.Event.LoadingDidFail,this._refreshErrorReason,this);this._resource.addEventListener(WebInspector.Resource.Event.RequestHeadersDidChange,this._refreshRequestHeaders,this);this._resource.addEventListener(WebInspector.Resource.Event.ResponseReceived,this._refreshRequestAndResponse,this);this._resource.addEventListener(WebInspector.Resource.Event.CacheStatusDidChange,this._refreshRequestAndResponse,this);this._resource.addEventListener(WebInspector.Resource.Event.SizeDidChange,this._refreshDecodedSize,this);this._resource.addEventListener(WebInspector.Resource.Event.TransferSizeDidChange,this._refreshTransferSize,this);this._resource.addEventListener(WebInspector.Resource.Event.InitiatedResourcesDidChange,this._refreshRelatedResourcesSection,this);this._needsToRemoveResourceEventListeners=true;}};WebInspector.ResourceSidebarPanel=class ResourceSidebarPanel extends WebInspector.NavigationSidebarPanel
{constructor(contentBrowser)
{super("resource",WebInspector.UIString("Resources"),true);this.contentBrowser=contentBrowser;this.filterBar.placeholder=WebInspector.UIString("Filter Resource List");this._navigationBar=new WebInspector.NavigationBar;this.addSubview(this._navigationBar);this._targetTreeElementMap=new Map;var scopeItemPrefix="resource-sidebar-";var scopeBarItems=[];scopeBarItems.push(new WebInspector.ScopeBarItem(scopeItemPrefix+"type-all",WebInspector.UIString("All Resources"),true));for(var key in WebInspector.Resource.Type){var value=WebInspector.Resource.Type[key];var scopeBarItem=new WebInspector.ScopeBarItem(scopeItemPrefix+value,WebInspector.Resource.displayNameForType(value,true));scopeBarItem[WebInspector.ResourceSidebarPanel.ResourceTypeSymbol]=value;scopeBarItems.push(scopeBarItem);}
let canvasesScopeBarItem=new WebInspector.ScopeBarItem(scopeItemPrefix+WebInspector.Canvas.ResourceSidebarType,WebInspector.UIString("Canvases"));canvasesScopeBarItem[WebInspector.ResourceSidebarPanel.ResourceTypeSymbol]=WebInspector.Canvas.ResourceSidebarType;scopeBarItems.insertAtIndex(canvasesScopeBarItem,scopeBarItems.length-1);this._scopeBar=new WebInspector.ScopeBar("resource-sidebar-scope-bar",scopeBarItems,scopeBarItems[0],true);this._scopeBar.addEventListener(WebInspector.ScopeBar.Event.SelectionChanged,this._scopeBarSelectionDidChange,this);this._navigationBar.addNavigationItem(this._scopeBar);WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange,this._mainResourceDidChange,this);WebInspector.frameResourceManager.addEventListener(WebInspector.FrameResourceManager.Event.MainFrameDidChange,this._mainFrameDidChange,this);WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ScriptAdded,this._scriptWasAdded,this);WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ScriptRemoved,this._scriptWasRemoved,this);WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ScriptsCleared,this._scriptsCleared,this);WebInspector.cssStyleManager.addEventListener(WebInspector.CSSStyleManager.Event.StyleSheetAdded,this._styleSheetAdded,this);WebInspector.targetManager.addEventListener(WebInspector.TargetManager.Event.TargetRemoved,this._targetRemoved,this);WebInspector.notifications.addEventListener(WebInspector.Notification.ExtraDomainsActivated,this._extraDomainsActivated,this);this.contentTreeOutline.addEventListener(WebInspector.TreeOutline.Event.SelectionDidChange,this._treeSelectionDidChange,this);this.contentTreeOutline.includeSourceMapResourceChildren=true;if(WebInspector.debuggableType===WebInspector.DebuggableType.JavaScript){this.contentTreeOutline.disclosureButtons=false;WebInspector.SourceCode.addEventListener(WebInspector.SourceCode.Event.SourceMapAdded,()=>{this.contentTreeOutline.disclosureButtons=true;},this);}}
get minimumWidth()
{return this._navigationBar.minimumWidth;}
closed()
{super.closed();WebInspector.Frame.removeEventListener(null,null,this);WebInspector.frameResourceManager.removeEventListener(null,null,this);WebInspector.debuggerManager.removeEventListener(null,null,this);WebInspector.notifications.removeEventListener(null,null,this);}
showDefaultContentView()
{if(WebInspector.frameResourceManager.mainFrame){this.contentBrowser.showContentViewForRepresentedObject(WebInspector.frameResourceManager.mainFrame);return;}
var firstTreeElement=this.contentTreeOutline.children[0];if(firstTreeElement)
this.showDefaultContentViewForTreeElement(firstTreeElement);}
treeElementForRepresentedObject(representedObject)
{if(!this._mainFrameTreeElement&&(representedObject instanceof WebInspector.Resource||representedObject instanceof WebInspector.Frame||representedObject instanceof WebInspector.Collection)){return null;}
if(representedObject instanceof WebInspector.Resource&&representedObject.parentFrame&&representedObject.parentFrame.mainResource===representedObject)
representedObject=representedObject.parentFrame;function isAncestor(ancestor,resourceOrFrame)
{if(resourceOrFrame instanceof WebInspector.SourceMapResource){if(resourceOrFrame.sourceMap.originalSourceCode===ancestor)
return true;resourceOrFrame=resourceOrFrame.sourceMap.originalSourceCode;}
var currentFrame=resourceOrFrame.parentFrame;while(currentFrame){if(currentFrame===ancestor)
return true;currentFrame=currentFrame.parentFrame;}
return false;}
function getParent(resourceOrFrame)
{if(resourceOrFrame instanceof WebInspector.SourceMapResource)
return resourceOrFrame.sourceMap.originalSourceCode;return resourceOrFrame.parentFrame;}
var treeElement=this.contentTreeOutline.findTreeElement(representedObject,isAncestor,getParent);if(treeElement)
return treeElement;if(!(representedObject instanceof WebInspector.Script)){console.error("Didn't find a TreeElement for representedObject",representedObject);return null;}
if(representedObject.url){console.error("Didn't find a ScriptTreeElement for a Script with a URL.");return null;}
if(!this._anonymousScriptsFolderTreeElement){let collection=new WebInspector.Collection(WebInspector.Collection.TypeVerifier.Script);this._anonymousScriptsFolderTreeElement=new WebInspector.FolderTreeElement(WebInspector.UIString("Anonymous Scripts"),collection);}
if(!this._anonymousScriptsFolderTreeElement.parent){var index=insertionIndexForObjectInListSortedByFunction(this._anonymousScriptsFolderTreeElement,this.contentTreeOutline.children,this._compareTreeElements);this.contentTreeOutline.insertChild(this._anonymousScriptsFolderTreeElement,index);}
this._anonymousScriptsFolderTreeElement.representedObject.add(representedObject);var scriptTreeElement=new WebInspector.ScriptTreeElement(representedObject);this._anonymousScriptsFolderTreeElement.appendChild(scriptTreeElement);return scriptTreeElement;}
initialLayout()
{super.initialLayout();if(WebInspector.frameResourceManager.mainFrame)
this._mainFrameMainResourceDidChange(WebInspector.frameResourceManager.mainFrame);}
hasCustomFilters()
{var selectedScopeBarItem=this._scopeBar.selectedItems[0];return selectedScopeBarItem&&!selectedScopeBarItem.exclusive;}
matchTreeElementAgainstCustomFilters(treeElement,flags)
{var selectedScopeBarItem=this._scopeBar.selectedItems[0];if(!selectedScopeBarItem||selectedScopeBarItem.exclusive)
return true;if(treeElement instanceof WebInspector.FolderTreeElement)
return false;function match()
{if(treeElement instanceof WebInspector.FrameTreeElement)
return selectedScopeBarItem[WebInspector.ResourceSidebarPanel.ResourceTypeSymbol]===WebInspector.Resource.Type.Document;if(treeElement instanceof WebInspector.ScriptTreeElement)
return selectedScopeBarItem[WebInspector.ResourceSidebarPanel.ResourceTypeSymbol]===WebInspector.Resource.Type.Script;if(treeElement instanceof WebInspector.CanvasTreeElement)
return selectedScopeBarItem[WebInspector.ResourceSidebarPanel.ResourceTypeSymbol]===WebInspector.Canvas.ResourceSidebarType;if(treeElement instanceof WebInspector.CSSStyleSheetTreeElement)
return selectedScopeBarItem[WebInspector.ResourceSidebarPanel.ResourceTypeSymbol]===WebInspector.Resource.Type.Stylesheet;if(!(treeElement instanceof WebInspector.ResourceTreeElement))
return false;return treeElement.resource.type===selectedScopeBarItem[WebInspector.ResourceSidebarPanel.ResourceTypeSymbol];}
var matched=match();if(matched)
flags.expandTreeElement=true;return matched;}
_mainResourceDidChange(event)
{if(!event.target.isMainFrame())
return;this._mainFrameMainResourceDidChange(event.target);}
_mainFrameDidChange(event)
{this._mainFrameMainResourceDidChange(WebInspector.frameResourceManager.mainFrame);}
_mainFrameMainResourceDidChange(mainFrame)
{this.contentBrowser.contentViewContainer.closeAllContentViews();if(this._mainFrameTreeElement){this.contentTreeOutline.removeChild(this._mainFrameTreeElement);this._mainFrameTreeElement=null;}
if(!mainFrame)
return;this._mainFrameTreeElement=new WebInspector.FrameTreeElement(mainFrame);this.contentTreeOutline.insertChild(this._mainFrameTreeElement,0);function delayedWork()
{if(!this.contentTreeOutline.selectedTreeElement){var currentContentView=this.contentBrowser.currentContentView;var treeElement=currentContentView?this.treeElementForRepresentedObject(currentContentView.representedObject):null;if(!treeElement)
treeElement=this._mainFrameTreeElement;this.showDefaultContentViewForTreeElement(treeElement);}}
setTimeout(delayedWork.bind(this));}
_scriptWasAdded(event)
{var script=event.data.script;
if(!script.url&&!script.sourceURL)
return;if(script.target!==WebInspector.mainTarget){if(script.isMainResource())
this._addTargetWithMainResource(script.target);return;}
if(script.resource||script.dynamicallyAddedScriptElement)
return;let insertIntoTopLevel=false;let parentFolderTreeElement=null;if(script.injected){if(!this._extensionScriptsFolderTreeElement){let collection=new WebInspector.Collection(WebInspector.Collection.TypeVerifier.Script);this._extensionScriptsFolderTreeElement=new WebInspector.FolderTreeElement(WebInspector.UIString("Extension Scripts"),collection);}
parentFolderTreeElement=this._extensionScriptsFolderTreeElement;}else{if(WebInspector.debuggableType===WebInspector.DebuggableType.JavaScript&&!WebInspector.hasExtraDomains)
insertIntoTopLevel=true;else{if(!this._extraScriptsFolderTreeElement){let collection=new WebInspector.Collection(WebInspector.Collection.TypeVerifier.Script);this._extraScriptsFolderTreeElement=new WebInspector.FolderTreeElement(WebInspector.UIString("Extra Scripts"),collection);}
parentFolderTreeElement=this._extraScriptsFolderTreeElement;}}
if(parentFolderTreeElement)
parentFolderTreeElement.representedObject.add(script);var scriptTreeElement=new WebInspector.ScriptTreeElement(script);if(insertIntoTopLevel){var index=insertionIndexForObjectInListSortedByFunction(scriptTreeElement,this.contentTreeOutline.children,this._compareTreeElements);this.contentTreeOutline.insertChild(scriptTreeElement,index);}else{if(!parentFolderTreeElement.parent){var index=insertionIndexForObjectInListSortedByFunction(parentFolderTreeElement,this.contentTreeOutline.children,this._compareTreeElements);this.contentTreeOutline.insertChild(parentFolderTreeElement,index);}
parentFolderTreeElement.appendChild(scriptTreeElement);}}
_scriptWasRemoved(event)
{let script=event.data.script;let scriptTreeElement=this.contentTreeOutline.getCachedTreeElement(script);if(!scriptTreeElement)
return;let parentTreeElement=scriptTreeElement.parent;parentTreeElement.removeChild(scriptTreeElement);if(parentTreeElement instanceof WebInspector.FolderTreeElement){parentTreeElement.representedObject.remove(script);if(!parentTreeElement.children.length)
parentTreeElement.parent.removeChild(parentTreeElement);}}
_scriptsCleared(event)
{const suppressOnDeselect=true;const suppressSelectSibling=true;if(this._extensionScriptsFolderTreeElement){if(this._extensionScriptsFolderTreeElement.parent)
this._extensionScriptsFolderTreeElement.parent.removeChild(this._extensionScriptsFolderTreeElement,suppressOnDeselect,suppressSelectSibling);this._extensionScriptsFolderTreeElement.representedObject.clear();this._extensionScriptsFolderTreeElement=null;}
if(this._extraScriptsFolderTreeElement){if(this._extraScriptsFolderTreeElement.parent)
this._extraScriptsFolderTreeElement.parent.removeChild(this._extraScriptsFolderTreeElement,suppressOnDeselect,suppressSelectSibling);this._extraScriptsFolderTreeElement.representedObject.clear();this._extraScriptsFolderTreeElement=null;}
if(this._anonymousScriptsFolderTreeElement){if(this._anonymousScriptsFolderTreeElement.parent)
this._anonymousScriptsFolderTreeElement.parent.removeChild(this._anonymousScriptsFolderTreeElement,suppressOnDeselect,suppressSelectSibling);this._anonymousScriptsFolderTreeElement.representedObject.clear();this._anonymousScriptsFolderTreeElement=null;}
if(this._targetTreeElementMap.size){for(let treeElement of this._targetTreeElementMap)
treeElement.parent.removeChild(treeElement,suppressOnDeselect,suppressSelectSibling);this._targetTreeElementMap.clear();}}
_styleSheetAdded(event)
{let styleSheet=event.data.styleSheet;if(!styleSheet.isInspectorStyleSheet())
return;let frameTreeElement=this.treeElementForRepresentedObject(styleSheet.parentFrame);if(!frameTreeElement)
return;frameTreeElement.addRepresentedObjectToNewChildQueue(styleSheet);}
_addTargetWithMainResource(target)
{let targetTreeElement=new WebInspector.WorkerTreeElement(target);this._targetTreeElementMap.set(target,targetTreeElement);let index=insertionIndexForObjectInListSortedByFunction(targetTreeElement,this.contentTreeOutline.children,this._compareTreeElements);this.contentTreeOutline.insertChild(targetTreeElement,index);}
_targetRemoved(event)
{let removedTarget=event.data.target;let targetTreeElement=this._targetTreeElementMap.take(removedTarget);if(targetTreeElement)
targetTreeElement.parent.removeChild(targetTreeElement);}
_treeSelectionDidChange(event)
{if(!this.visible)
return;let treeElement=event.data.selectedElement;if(!treeElement)
return;if(treeElement instanceof WebInspector.FolderTreeElement||treeElement instanceof WebInspector.ResourceTreeElement||treeElement instanceof WebInspector.ScriptTreeElement||treeElement instanceof WebInspector.CSSStyleSheetTreeElement||treeElement instanceof WebInspector.ContentFlowTreeElement||treeElement instanceof WebInspector.CanvasTreeElement){const cookie=null;const options={ignoreNetworkTab:true,ignoreSearchTab:true,};WebInspector.showRepresentedObject(treeElement.representedObject,cookie,options);return;}
console.error("Unknown tree element",treeElement);}
_compareTreeElements(a,b)
{if(a instanceof WebInspector.FrameTreeElement)
return-1;if(b instanceof WebInspector.FrameTreeElement)
return 1;return(a.mainTitle||"").extendedLocaleCompare(b.mainTitle||"");}
_extraDomainsActivated()
{if(WebInspector.debuggableType===WebInspector.DebuggableType.JavaScript)
this.contentTreeOutline.disclosureButtons=true;}
_scopeBarSelectionDidChange(event)
{this.updateFilter();}};WebInspector.ResourceSidebarPanel.ResourceTypeSymbol=Symbol("resource-type");WebInspector.ResourceTimelineDataGridNode=class ResourceTimelineDataGridNode extends WebInspector.TimelineDataGridNode
{constructor(resourceTimelineRecord,includesGraph,graphDataSource,shouldShowPopover)
{super(includesGraph,graphDataSource);this._resource=resourceTimelineRecord.resource;this._record=resourceTimelineRecord;this._shouldShowPopover=shouldShowPopover;this._resource.addEventListener(WebInspector.Resource.Event.LoadingDidFinish,this._needsRefresh,this);this._resource.addEventListener(WebInspector.Resource.Event.LoadingDidFail,this._needsRefresh,this);this._resource.addEventListener(WebInspector.Resource.Event.URLDidChange,this._needsRefresh,this);if(includesGraph)
this._record.addEventListener(WebInspector.TimelineRecord.Event.Updated,this._timelineRecordUpdated,this);else{this._resource.addEventListener(WebInspector.Resource.Event.TypeDidChange,this._needsRefresh,this);this._resource.addEventListener(WebInspector.Resource.Event.SizeDidChange,this._needsRefresh,this);this._resource.addEventListener(WebInspector.Resource.Event.TransferSizeDidChange,this._needsRefresh,this);}}
get records()
{return[this._record];}
get resource()
{return this._resource;}
get data()
{if(this._cachedData)
return this._cachedData;var resource=this._resource;var data={};if(!this._includesGraph){var zeroTime=this.graphDataSource?this.graphDataSource.zeroTime:0;data.domain=WebInspector.displayNameForHost(resource.urlComponents.host);data.scheme=resource.urlComponents.scheme?resource.urlComponents.scheme.toUpperCase():"";data.method=resource.requestMethod;data.type=resource.type;data.statusCode=resource.statusCode;data.cached=resource.cached;data.size=resource.size;data.transferSize=!isNaN(resource.networkTotalTransferSize)?resource.networkTotalTransferSize:resource.estimatedTotalTransferSize;data.requestSent=resource.requestSentTimestamp-zeroTime;data.duration=resource.receiveDuration;data.latency=resource.latency;data.protocol=resource.protocol;data.priority=resource.priority;data.remoteAddress=resource.remoteAddress;data.connectionIdentifier=resource.connectionIdentifier;}
data.graph=this._record.startTime;this._cachedData=data;return data;}
createCellContent(columnIdentifier,cell)
{let resource=this._resource;if(resource.hadLoadingError())
cell.classList.add("error");let value=this.data[columnIdentifier];switch(columnIdentifier){case"name":cell.classList.add(...this.iconClassNames());cell.title=resource.displayURL;this._updateStatus(cell);return this._createNameCellDocumentFragment();case"type":var text=WebInspector.Resource.displayNameForType(value);cell.title=text;return text;case"statusCode":cell.title=resource.statusText||"";return value||emDash;case"cached":var fragment=this._cachedCellContent();cell.title=fragment.textContent;return fragment;case"size":case"transferSize":var text=emDash;if(!isNaN(value)){text=Number.bytesToString(value,true);cell.title=text;}
return text;case"requestSent":case"latency":case"duration":var text=emDash;if(!isNaN(value)){text=Number.secondsToString(value,true);cell.title=text;}
return text;case"domain":case"method":case"scheme":case"protocol":case"remoteAddress":case"connectionIdentifier":if(value)
cell.title=value;return value||emDash;case"priority":var title=WebInspector.Resource.displayNameForPriority(value);if(title)
cell.title=title;return title||emDash;}
return super.createCellContent(columnIdentifier,cell);}
refresh()
{if(this._scheduledRefreshIdentifier){cancelAnimationFrame(this._scheduledRefreshIdentifier);this._scheduledRefreshIdentifier=undefined;}
this._cachedData=null;super.refresh();}
iconClassNames()
{return[WebInspector.ResourceTreeElement.ResourceIconStyleClassName,this.resource.type];}
appendContextMenuItems(contextMenu)
{WebInspector.appendContextMenuItemsForSourceCode(contextMenu,this._resource);}
didAddRecordBar(recordBar)
{if(!this._shouldShowPopover)
return;if(!recordBar.records.length||recordBar.records[0].type!==WebInspector.TimelineRecord.Type.Network)
return;this._mouseEnterRecordBarListener=this._mouseoverRecordBar.bind(this);recordBar.element.addEventListener("mouseenter",this._mouseEnterRecordBarListener);}
didRemoveRecordBar(recordBar)
{if(!this._shouldShowPopover)
return;if(!recordBar.records.length||recordBar.records[0].type!==WebInspector.TimelineRecord.Type.Network)
return;recordBar.element.removeEventListener("mouseenter",this._mouseEnterRecordBarListener);this._mouseEnterRecordBarListener=null;}
filterableDataForColumn(columnIdentifier)
{if(columnIdentifier==="name")
return this._resource.url;return super.filterableDataForColumn(columnIdentifier);}
_createNameCellDocumentFragment()
{let fragment=document.createDocumentFragment();let mainTitle=this.displayName();fragment.append(mainTitle);let frame=this._resource.parentFrame;let isMainResource=this._resource.isMainResource();let parentResourceHost;if(frame&&isMainResource){parentResourceHost=frame.parentFrame?frame.parentFrame.mainResource.urlComponents.host:null;}else if(frame){parentResourceHost=frame.mainResource.urlComponents.host;}
if(parentResourceHost!==this._resource.urlComponents.host||frame.isMainFrame()&&isMainResource){let subtitle=WebInspector.displayNameForHost(this._resource.urlComponents.host);if(mainTitle!==subtitle){let subtitleElement=document.createElement("span");subtitleElement.classList.add("subtitle");subtitleElement.textContent=subtitle;fragment.append(subtitleElement);}}
return fragment;}
_cachedCellContent()
{if(!this._resource.hasResponse())
return emDash;let responseSource=this._resource.responseSource;if(responseSource===WebInspector.Resource.ResponseSource.MemoryCache||responseSource===WebInspector.Resource.ResponseSource.DiskCache){let span=document.createElement("span");let cacheType=document.createElement("span");cacheType.classList="cache-type";cacheType.textContent=responseSource===WebInspector.Resource.ResponseSource.MemoryCache?WebInspector.UIString("(Memory)"):WebInspector.UIString("(Disk)");span.append(WebInspector.UIString("Yes")," ",cacheType);return span;}
let fragment=document.createDocumentFragment();fragment.append(this._resource.cached?WebInspector.UIString("Yes"):WebInspector.UIString("No"));return fragment;}
_needsRefresh()
{if(this.dataGrid instanceof WebInspector.TimelineDataGrid){this.dataGrid.dataGridNodeNeedsRefresh(this);return;}
if(this._scheduledRefreshIdentifier)
return;this._scheduledRefreshIdentifier=requestAnimationFrame(this.refresh.bind(this));}
_timelineRecordUpdated(event)
{if(this.isRecordVisible(this._record))
this.needsGraphRefresh();}
_dataGridNodeGoToArrowClicked()
{const options={ignoreNetworkTab:true,ignoreSearchTab:true,};WebInspector.showSourceCode(this._resource,options);}
_updateStatus(cell)
{if(this._resource.failed)
cell.classList.add("error");else{cell.classList.remove("error");if(this._resource.finished)
this.createGoToArrowButton(cell,this._dataGridNodeGoToArrowClicked.bind(this));}
if(this._spinner)
this._spinner.element.remove();if(this._resource.finished||this._resource.failed)
return;if(!this._spinner)
this._spinner=new WebInspector.IndeterminateProgressSpinner;let contentElement=cell.firstChild;contentElement.appendChild(this._spinner.element);}
_mouseoverRecordBar(event)
{let recordBar=WebInspector.TimelineRecordBar.fromElement(event.target);if(!recordBar)
return;let calculateTargetFrame=()=>{let columnRect=WebInspector.Rect.rectFromClientRect(this.elementWithColumnIdentifier("graph").getBoundingClientRect());let barRect=WebInspector.Rect.rectFromClientRect(event.target.getBoundingClientRect());return columnRect.intersectionWithRect(barRect);};let targetFrame=calculateTargetFrame();if(!targetFrame.size.width&&!targetFrame.size.height)
return;let resource=recordBar.records[0].resource;if(!resource.timingData)
return;if(!resource.timingData.responseEnd)
return;if(this.dataGrid._dismissPopoverTimeout){clearTimeout(this.dataGrid._dismissPopoverTimeout);this.dataGrid._dismissPopoverTimeout=undefined;}
let popoverContentElement=document.createElement("div");popoverContentElement.classList.add("resource-timing-popover-content");if(resource.failed||resource.urlComponents.scheme==="data"||(resource.cached&&resource.statusCode!==304)){let descriptionElement=document.createElement("span");descriptionElement.classList.add("description");if(resource.failed)
descriptionElement.textContent=WebInspector.UIString("Resource failed to load.");else if(resource.urlComponents.scheme==="data")
descriptionElement.textContent=WebInspector.UIString("Resource was loaded with the “data“ scheme.");else
descriptionElement.textContent=WebInspector.UIString("Resource was served from the cache.");popoverContentElement.appendChild(descriptionElement);}else{let columns={description:{width:"80px"},graph:{width:`${WebInspector.ResourceTimelineDataGridNode.PopoverGraphColumnWidthPixels}px`},duration:{width:"70px",aligned:"right"}};let popoverDataGrid=new WebInspector.DataGrid(columns);popoverDataGrid.inline=true;popoverDataGrid.headerVisible=false;popoverContentElement.appendChild(popoverDataGrid.element);let graphDataSource={get secondsPerPixel(){return resource.duration/WebInspector.ResourceTimelineDataGridNode.PopoverGraphColumnWidthPixels;},get zeroTime(){return resource.firstTimestamp;},get startTime(){return resource.firstTimestamp;},get currentTime(){return this.endTime;},get endTime()
{let endTimePadding=this.secondsPerPixel*WebInspector.TimelineRecordBar.MinimumWidthPixels;return resource.lastTimestamp+endTimePadding;}};let secondTimestamp=resource.timingData.domainLookupStart||resource.timingData.connectStart||resource.timingData.requestStart;if(secondTimestamp-resource.timingData.startTime)
popoverDataGrid.appendChild(new WebInspector.ResourceTimingPopoverDataGridNode(WebInspector.UIString("Stalled"),resource.timingData.startTime,secondTimestamp,graphDataSource));if(resource.timingData.domainLookupStart)
popoverDataGrid.appendChild(new WebInspector.ResourceTimingPopoverDataGridNode(WebInspector.UIString("DNS"),resource.timingData.domainLookupStart,resource.timingData.domainLookupEnd,graphDataSource));if(resource.timingData.connectStart)
popoverDataGrid.appendChild(new WebInspector.ResourceTimingPopoverDataGridNode(WebInspector.UIString("Connection"),resource.timingData.connectStart,resource.timingData.connectEnd,graphDataSource));if(resource.timingData.secureConnectionStart)
popoverDataGrid.appendChild(new WebInspector.ResourceTimingPopoverDataGridNode(WebInspector.UIString("Secure"),resource.timingData.secureConnectionStart,resource.timingData.connectEnd,graphDataSource));popoverDataGrid.appendChild(new WebInspector.ResourceTimingPopoverDataGridNode(WebInspector.UIString("Request"),resource.timingData.requestStart,resource.timingData.responseStart,graphDataSource));popoverDataGrid.appendChild(new WebInspector.ResourceTimingPopoverDataGridNode(WebInspector.UIString("Response"),resource.timingData.responseStart,resource.timingData.responseEnd,graphDataSource));const higherResolution=true;let totalData={description:WebInspector.UIString("Total time"),duration:Number.secondsToMillisecondsString(resource.timingData.responseEnd-resource.timingData.startTime,higherResolution)};popoverDataGrid.appendChild(new WebInspector.DataGridNode(totalData));popoverDataGrid.updateLayout();}
if(!this.dataGrid._popover)
this.dataGrid._popover=new WebInspector.Popover;let preferredEdges=[WebInspector.RectEdge.MAX_Y,WebInspector.RectEdge.MIN_Y,WebInspector.RectEdge.MIN_X];this.dataGrid._popover.windowResizeHandler=()=>{let bounds=calculateTargetFrame();this.dataGrid._popover.present(bounds.pad(2),preferredEdges);};recordBar.element.addEventListener("mouseleave",()=>{if(!this.dataGrid)
return;this.dataGrid._dismissPopoverTimeout=setTimeout(()=>{if(this.dataGrid)
this.dataGrid._popover.dismiss();},WebInspector.ResourceTimelineDataGridNode.DelayedPopoverDismissalTimeout);},{once:true});this.dataGrid._popover.presentNewContentWithFrame(popoverContentElement,targetFrame.pad(2),preferredEdges);}};WebInspector.ResourceTimelineDataGridNode.PopoverGraphColumnWidthPixels=110;WebInspector.ResourceTimelineDataGridNode.DelayedPopoverDismissalTimeout=500;WebInspector.ResourceTimingPopoverDataGridNode=class ResourceTimingPopoverDataGridNode extends WebInspector.TimelineDataGridNode
{constructor(description,startTime,endTime,graphDataSource)
{super(true,graphDataSource);const higherResolution=true;let duration=Number.secondsToMillisecondsString(endTime-startTime,higherResolution);this._data={description,duration};this._record=new WebInspector.TimelineRecord(WebInspector.TimelineRecord.Type.Network,startTime,endTime);}
get records(){return[this._record];}
get data(){return this._data;}
get selectable(){return false;}
createCellContent(columnIdentifier,cell)
{let value=this.data[columnIdentifier];switch(columnIdentifier){case"description":case"duration":return value||emDash;}
return super.createCellContent(columnIdentifier,cell);}};WebInspector.RulesStyleDetailsPanel=class RulesStyleDetailsPanel extends WebInspector.StyleDetailsPanel
{constructor(delegate)
{super(delegate,"rules","rules",WebInspector.UIString("Styles \u2014 Rules"));this._sections=[];this._inspectorSection=null;this._isInspectorSectionPendingFocus=false;this._ruleMediaAndInherticanceList=[];this._propertyToSelectAndHighlight=null;this._emptyFilterResultsElement=document.createElement("div");this._emptyFilterResultsElement.classList.add("no-filter-results");this._emptyFilterResultsMessage=document.createElement("div");this._emptyFilterResultsMessage.classList.add("no-filter-results-message");this._emptyFilterResultsMessage.textContent=WebInspector.UIString("No Results Found");this._emptyFilterResultsElement.appendChild(this._emptyFilterResultsMessage);this._boundRemoveSectionWithActiveEditor=this._removeSectionWithActiveEditor.bind(this);}
refresh(significantChange)
{
if(!significantChange){super.refresh();return;}
if(!this._forceSignificantChange){this._sectionWithActiveEditor=null;for(var section of this._sections){if(!section.editorActive)
continue;this._sectionWithActiveEditor=section;break;}
if(this._sectionWithActiveEditor){this._sectionWithActiveEditor.addEventListener(WebInspector.CSSStyleDeclarationSection.Event.Blurred,this._boundRemoveSectionWithActiveEditor);return;}}
var newSections=[];var newDOMFragment=document.createDocumentFragment();var previousMediaList=[];var previousSection=null;var pseudoElements=this.nodeStyles.pseudoElements;var pseudoElementsStyle=[];for(var pseudoIdentifier in pseudoElements)
pseudoElementsStyle=pseudoElementsStyle.concat(pseudoElements[pseudoIdentifier].orderedStyles);var orderedPseudoStyles=uniqueOrderedStyles(pseudoElementsStyle);if(orderedPseudoStyles.length)
orderedPseudoStyles.reverse();function mediaListsEqual(a,b)
{a=a||[];b=b||[];if(a.length!==b.length)
return false;for(var i=0;i<a.length;++i){var aMedia=a[i];var bMedia=b[i];if(aMedia.type!==bMedia.type)
return false;if(aMedia.text!==bMedia.text)
return false;if(!aMedia.sourceCodeLocation&&bMedia.sourceCodeLocation)
return false;if(aMedia.sourceCodeLocation&&!aMedia.sourceCodeLocation.isEqual(bMedia.sourceCodeLocation))
return false;}
return true;}
function uniqueOrderedStyles(orderedStyles)
{var uniqueStyles=[];for(var style of orderedStyles){var rule=style.ownerRule;if(!rule){uniqueStyles.push(style);continue;}
var found=false;for(var existingStyle of uniqueStyles){if(rule.isEqualTo(existingStyle.ownerRule)){found=true;break;}}
if(!found)
uniqueStyles.push(style);}
return uniqueStyles;}
function appendStyleSection(style)
{var section=style.__rulesSection;if(!section){section=new WebInspector.CSSStyleDeclarationSection(this,style);style.__rulesSection=section;}else
section.refresh();if(this._isInspectorSectionPendingFocus&&style.isInspectorRule())
this._inspectorSection=section;section.lastInGroup=false;newDOMFragment.appendChild(section.element);newSections.push(section);previousSection=section;}
function insertMediaOrInheritanceLabel(style)
{if(previousSection&&previousSection.style.type===WebInspector.CSSStyleDeclaration.Type.Inline)
previousSection.lastInGroup=true;var hasMediaOrInherited=[];if(previousSection&&previousSection.style.node!==style.node){previousSection.lastInGroup=true;var prefixElement=document.createElement("strong");prefixElement.textContent=WebInspector.UIString("Inherited From: ");let inheritedLabel=newDOMFragment.appendChild(document.createElement("div"));inheritedLabel.className="label";inheritedLabel.appendChild(prefixElement);inheritedLabel.appendChild(WebInspector.linkifyNodeReference(style.node,{maxLength:100,excludeRevealElement:true,}));hasMediaOrInherited.push(inheritedLabel);}
var currentMediaList=(style.ownerRule&&style.ownerRule.mediaList)||[];if(!mediaListsEqual(previousMediaList,currentMediaList)){previousMediaList=currentMediaList;
if(previousSection)
previousSection.lastInGroup=true;for(var media of currentMediaList){var prefixElement=document.createElement("strong");prefixElement.textContent=WebInspector.UIString("Media: ");var mediaLabel=document.createElement("div");mediaLabel.className="label";mediaLabel.append(prefixElement,media.text);if(media.sourceCodeLocation){const options={dontFloat:true,ignoreNetworkTab:true,ignoreSearchTab:true,};mediaLabel.append(" \u2014 ",WebInspector.createSourceCodeLocationLink(media.sourceCodeLocation,options));}
newDOMFragment.appendChild(mediaLabel);hasMediaOrInherited.push(mediaLabel);}}
if(!hasMediaOrInherited.length&&style.type!==WebInspector.CSSStyleDeclaration.Type.Inline){if(previousSection&&!previousSection.lastInGroup)
hasMediaOrInherited=this._ruleMediaAndInherticanceList.lastValue;else{var prefixElement=document.createElement("strong");prefixElement.textContent=WebInspector.UIString("Media: ");var mediaLabel=document.createElement("div");mediaLabel.className="label";mediaLabel.append(prefixElement,"all");newDOMFragment.appendChild(mediaLabel);hasMediaOrInherited.push(mediaLabel);}}
this._ruleMediaAndInherticanceList.push(hasMediaOrInherited);}
function insertAllMatchingPseudoStyles(force)
{if(!orderedPseudoStyles.length)
return;if(force){for(var j=orderedPseudoStyles.length-1;j>=0;--j){var pseudoStyle=orderedPseudoStyles[j];insertMediaOrInheritanceLabel.call(this,pseudoStyle);appendStyleSection.call(this,pseudoStyle);}
orderedPseudoStyles=[];}
if(!previousSection)
return;var ownerRule=previousSection.style.ownerRule;if(!ownerRule)
return;for(var j=orderedPseudoStyles.length-1;j>=0;--j){var pseudoStyle=orderedPseudoStyles[j];if(!pseudoStyle.ownerRule.selectorIsGreater(ownerRule.mostSpecificSelector))
continue;insertMediaOrInheritanceLabel.call(this,pseudoStyle);appendStyleSection.call(this,pseudoStyle);ownerRule=pseudoStyle.ownerRule;orderedPseudoStyles.splice(j,1);}}
this._ruleMediaAndInherticanceList=[];var orderedStyles=uniqueOrderedStyles(this.nodeStyles.orderedStyles);for(var style of orderedStyles){var isUserAgentStyle=style.ownerRule&&style.ownerRule.type===WebInspector.CSSStyleSheet.Type.UserAgent;insertAllMatchingPseudoStyles.call(this,isUserAgentStyle||style.inherited);insertMediaOrInheritanceLabel.call(this,style);appendStyleSection.call(this,style);}
insertAllMatchingPseudoStyles.call(this,true);if(previousSection)
previousSection.lastInGroup=true;this.element.removeChildren();this.element.appendChild(newDOMFragment);this.element.appendChild(this._emptyFilterResultsElement);this._sections=newSections;for(var i=0;i<this._sections.length;++i)
this._sections[i].updateLayout();super.refresh();}
scrollToSectionAndHighlightProperty(property)
{if(!this._visible){this._propertyToSelectAndHighlight=property;return false;}
for(var section of this._sections){if(section.highlightProperty(property))
return true;}
return false;}
cssStyleDeclarationSectionEditorFocused(focusedSection)
{for(let section of this._sections){if(section!==focusedSection)
section.clearSelection();}
this._sectionWithActiveEditor=focusedSection;}
cssStyleDeclarationSectionEditorNextRule(currentSection)
{currentSection.clearSelection();var index=this._sections.indexOf(currentSection);this._sections[index<this._sections.length-1?index+1:0].focusRuleSelector();}
cssStyleDeclarationSectionEditorPreviousRule(currentSection,selectLastProperty){currentSection.clearSelection();if(selectLastProperty||!currentSection.selectorEditable){var index=this._sections.indexOf(currentSection);index=index>0?index-1:this._sections.length-1;var section=this._sections[index];while(section.locked){index=index>0?index-1:this._sections.length-1;section=this._sections[index];}
section.focus();section.selectLastProperty();return;}
currentSection.focusRuleSelector(true);}
filterDidChange(filterBar)
{for(var labels of this._ruleMediaAndInherticanceList){for(var i=0;i<labels.length;++i){labels[i].classList.toggle(WebInspector.CSSStyleDetailsSidebarPanel.NoFilterMatchInSectionClassName,filterBar.hasActiveFilters());if(i===labels.length-1)
labels[i].classList.toggle("filter-matching-label",filterBar.hasActiveFilters());}}
var matchFound=!filterBar.hasActiveFilters();for(var i=0;i<this._sections.length;++i){var section=this._sections[i];if(section.findMatchingPropertiesAndSelectors(filterBar.filters.text)&&filterBar.hasActiveFilters()){if(this._ruleMediaAndInherticanceList[i].length){for(var label of this._ruleMediaAndInherticanceList[i])
label.classList.remove(WebInspector.CSSStyleDetailsSidebarPanel.NoFilterMatchInSectionClassName);}else
section.element.classList.add(WebInspector.CSSStyleDetailsSidebarPanel.FilterMatchingSectionHasLabelClassName);matchFound=true;}}
this.element.classList.toggle("filter-non-matching",!matchFound);}
newRuleButtonClicked()
{if(this.nodeStyles.node.isInUserAgentShadowTree())
return;for(let existingRule of this.nodeStyles.rulesForSelector()){if(this.focusEmptySectionWithStyle(existingRule.style))
return;}
this._isInspectorSectionPendingFocus=true;let newInspectorRuleSelector=this.nodeStyles.node.appropriateSelectorFor(true);this.nodeStyles.addRule(newInspectorRuleSelector);}
newRuleButtonContextMenu(event)
{if(this.nodeStyles.node.isInUserAgentShadowTree())
return;let styleSheets=WebInspector.cssStyleManager.styleSheets.filter(styleSheet=>styleSheet.hasInfo()&&!styleSheet.isInlineStyleTag()&&!styleSheet.isInlineStyleAttributeStyleSheet());if(!styleSheets.length)
return;const justSelector=true;let selector=this.nodeStyles.node.appropriateSelectorFor(justSelector);let contextMenu=WebInspector.ContextMenu.createFromEvent(event);const handler=null;const disabled=true;contextMenu.appendItem(WebInspector.UIString("Available Style Sheets"),handler,disabled);for(let styleSheet of styleSheets){contextMenu.appendItem(styleSheet.displayName,()=>{const text="";this.nodeStyles.addRule(selector,text,styleSheet.id);});}}
sectionForStyle(style)
{if(style.__rulesSection)
return style.__rulesSection;for(let section of this._sections){if(section.style===style)
return section;}
return null;}
focusEmptySectionWithStyle(style)
{if(style.hasProperties())
return false;let section=this.sectionForStyle(style);if(!section)
return false;section.focus();return true;}
shown()
{super.shown();for(var i=0;i<this._sections.length;++i){var section=this._sections[i];section.style.__rulesSection=section;section.updateLayout();}
if(this._sectionWithActiveEditor)
this._sectionWithActiveEditor.refreshEditor();}
hidden()
{super.hidden();
for(var i=0;i<this._sections.length;++i)
delete this._sections[i].style.__rulesSection;}
sizeDidChange()
{for(var i=0;i<this._sections.length;++i)
this._sections[i].updateLayout();}
nodeStylesRefreshed(event)
{super.nodeStylesRefreshed(event);if(this._propertyToSelectAndHighlight){this.scrollToSectionAndHighlightProperty(this._propertyToSelectAndHighlight);this._propertyToSelectAndHighlight=null;}
if(this._isInspectorSectionPendingFocus){this._isInspectorSectionPendingFocus=false;if(this._inspectorSection){this._inspectorSection.focus();this._inspectorSection=null;}}}
_removeSectionWithActiveEditor(event)
{this._sectionWithActiveEditor.removeEventListener(WebInspector.CSSStyleDeclarationSection.Event.Blurred,this._boundRemoveSectionWithActiveEditor);this.refresh(true);}};WebInspector.ScopeBar=class ScopeBar extends WebInspector.NavigationItem
{constructor(identifier,items,defaultItem,shouldGroupNonExclusiveItems)
{super(identifier);this._element.classList.add("scope-bar");this._items=items;this._defaultItem=defaultItem;this._shouldGroupNonExclusiveItems=shouldGroupNonExclusiveItems||false;this._minimumWidth=0;this._populate();}
get minimumWidth()
{if(!this._minimumWidth){
this.element.style.flexWrap="initial !important";if(this._multipleItem)
this._multipleItem.displayWidestItem();this._minimumWidth=this.element.realOffsetWidth;this.element.style.flexWrap=null;if(this._multipleItem)
this._multipleItem.displaySelectedItem();}
return this._minimumWidth;}
get defaultItem()
{return this._defaultItem;}
get items()
{return this._items;}
item(id)
{return this._itemsById.get(id);}
get selectedItems()
{return this._items.filter((item)=>item.selected);}
hasNonDefaultItemSelected()
{return this._items.some((item)=>item.selected&&item!==this._defaultItem);}
_populate()
{this._itemsById=new Map;if(this._shouldGroupNonExclusiveItems){var nonExclusiveItems=[];for(var item of this._items){this._itemsById.set(item.id,item);if(item.exclusive)
this._element.appendChild(item.element);else
nonExclusiveItems.push(item);item.addEventListener(WebInspector.ScopeBarItem.Event.SelectionChanged,this._itemSelectionDidChange,this);}
this._multipleItem=new WebInspector.MultipleScopeBarItem(nonExclusiveItems);this._element.appendChild(this._multipleItem.element);}else{for(var item of this._items){this._itemsById.set(item.id,item);this._element.appendChild(item.element);item.addEventListener(WebInspector.ScopeBarItem.Event.SelectionChanged,this._itemSelectionDidChange,this);}}
if(!this.selectedItems.length&&this._defaultItem)
this._defaultItem.selected=true;this._element.classList.toggle("default-item-selected",this._defaultItem.selected);}
_itemSelectionDidChange(event)
{var sender=event.target;var item;if(sender.exclusive&&sender.selected){for(var i=0;i<this._items.length;++i){item=this._items[i];if(item!==sender)
item.selected=false;}}else{var replacesCurrentSelection=this._shouldGroupNonExclusiveItems||!event.data.withModifier;for(var i=0;i<this._items.length;++i){item=this._items[i];if(item.exclusive&&item!==sender&&sender.selected)
item.selected=false;else if(sender.selected&&replacesCurrentSelection&&sender!==item)
item.selected=false;}}
if(!this.selectedItems.length&&this._defaultItem)
this._defaultItem.selected=true;this._element.classList.toggle("default-item-selected",this._defaultItem.selected);this.dispatchEventToListeners(WebInspector.ScopeBar.Event.SelectionChanged);}};WebInspector.ScopeBar.Event={SelectionChanged:"scopebar-selection-did-change"};WebInspector.ScopeBarItem=class ScopeBarItem extends WebInspector.Object
{constructor(id,label,exclusive,className)
{super();this._element=document.createElement("li");this._element.classList.toggle("exclusive",!!exclusive);if(className)
this._element.classList.add(className);this._element.textContent=label;this._element.addEventListener("mousedown",this._handleMouseDown.bind(this));this._id=id;this._label=label;this._exclusive=exclusive;this._selectedSetting=new WebInspector.Setting("scopebaritem-"+id,false);this._element.classList.toggle("selected",this._selectedSetting.value);}
get element()
{return this._element;}
get id()
{return this._id;}
get label()
{return this._label;}
get exclusive()
{return this._exclusive;}
get selected()
{return this._selectedSetting.value;}
set selected(selected)
{this.setSelected(selected,false);}
setSelected(selected,withModifier)
{if(this._selectedSetting.value===selected)
return;this._element.classList.toggle("selected",selected);this._selectedSetting.value=selected;this.dispatchEventToListeners(WebInspector.ScopeBarItem.Event.SelectionChanged,{withModifier});}
_handleMouseDown(event)
{if(event.button!==0)
return;this.setSelected(!this.selected,event.metaKey&&!event.ctrlKey&&!event.altKey&&!event.shiftKey);}};WebInspector.ScopeBarItem.Event={SelectionChanged:"scope-bar-item-selection-did-change"};WebInspector.ScopeChainDetailsSidebarPanel=class ScopeChainDetailsSidebarPanel extends WebInspector.DetailsSidebarPanel
{constructor()
{super("scope-chain",WebInspector.UIString("Scope Chain"));this._callFrame=null;this._watchExpressionsSetting=new WebInspector.Setting("watch-expressions",[]);this._watchExpressionsSetting.addEventListener(WebInspector.Setting.Event.Changed,this._updateWatchExpressionsNavigationBar,this);this._watchExpressionOptionsElement=document.createElement("div");this._watchExpressionOptionsElement.classList.add("options");this._navigationBar=new WebInspector.NavigationBar;this._watchExpressionOptionsElement.appendChild(this._navigationBar.element);let addWatchExpressionButton=new WebInspector.ButtonNavigationItem("add-watch-expression",WebInspector.UIString("Add watch expression"),"Images/Plus13.svg",13,13);addWatchExpressionButton.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,this._addWatchExpressionButtonClicked,this);this._navigationBar.addNavigationItem(addWatchExpressionButton);this._clearAllWatchExpressionButton=new WebInspector.ButtonNavigationItem("clear-watch-expressions",WebInspector.UIString("Clear watch expressions"),"Images/NavigationItemTrash.svg",14,14);this._clearAllWatchExpressionButton.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,this._clearAllWatchExpressionsButtonClicked,this);this._navigationBar.addNavigationItem(this._clearAllWatchExpressionButton);this._refreshAllWatchExpressionButton=new WebInspector.ButtonNavigationItem("refresh-watch-expressions",WebInspector.UIString("Refresh watch expressions"),"Images/ReloadFull.svg",13,13);this._refreshAllWatchExpressionButton.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,this._refreshAllWatchExpressionsButtonClicked,this);this._navigationBar.addNavigationItem(this._refreshAllWatchExpressionButton);this._watchExpressionsSectionGroup=new WebInspector.DetailsSectionGroup;this._watchExpressionsSection=new WebInspector.DetailsSection("watch-expressions",WebInspector.UIString("Watch Expressions"),[this._watchExpressionsSectionGroup],this._watchExpressionOptionsElement);this.contentView.element.appendChild(this._watchExpressionsSection.element);this._updateWatchExpressionsNavigationBar();this.needsLayout();WebInspector.runtimeManager.addEventListener(WebInspector.RuntimeManager.Event.DidEvaluate,this._didEvaluateExpression,this);WebInspector.runtimeManager.addEventListener(WebInspector.RuntimeManager.Event.ActiveExecutionContextChanged,this._activeExecutionContextChanged,this);WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange,this._mainResourceDidChange,this);WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ActiveCallFrameDidChange,this._activeCallFrameDidChange,this);}
inspect(objects)
{if(!(objects instanceof Array))
objects=[objects];var callFrameToInspect=null;for(var i=0;i<objects.length;++i){if(!(objects[i]instanceof WebInspector.CallFrame))
continue;callFrameToInspect=objects[i];break;}
this.callFrame=callFrameToInspect;return true;}
get callFrame()
{return this._callFrame;}
set callFrame(callFrame)
{if(callFrame===this._callFrame)
return;this._callFrame=callFrame;this.needsLayout();}
layout()
{let callFrame=this._callFrame;Promise.all([this._generateWatchExpressionsSection(),this._generateCallFramesSection()]).then(function(sections){let[watchExpressionsSection,callFrameSections]=sections;function delayedWork()
{clearTimeout(timeout);if(watchExpressionsSection)
this._watchExpressionsSectionGroup.rows=[watchExpressionsSection];else{let emptyRow=new WebInspector.DetailsSectionRow(WebInspector.UIString("No Watch Expressions"));this._watchExpressionsSectionGroup.rows=[emptyRow];emptyRow.showEmptyMessage();}
this.contentView.element.removeChildren();this.contentView.element.appendChild(this._watchExpressionsSection.element);if(this._callFrame!==callFrame)
return;if(!callFrameSections)
return;for(let callFrameSection of callFrameSections)
this.contentView.element.appendChild(callFrameSection.element);}
let delay=WebInspector.ScopeChainDetailsSidebarPanel._autoExpandProperties.size===0?50:250;let timeout=setTimeout(delayedWork.bind(this),delay);
InspectorBackend.runAfterPendingDispatches(delayedWork.bind(this));}.bind(this)).catch(function(e){console.error(e);});}
_generateCallFramesSection()
{let callFrame=this._callFrame;if(!callFrame)
return Promise.resolve(null);let detailsSections=[];let foundLocalScope=false;let sectionCountByType=new Map;for(let type in WebInspector.ScopeChainNode.Type)
sectionCountByType.set(WebInspector.ScopeChainNode.Type[type],0);let scopeChain=callFrame.mergedScopeChain();for(let scope of scopeChain){if(scope.empty&&scope.type!==WebInspector.ScopeChainNode.Type.Local)
continue;let title=null;let extraPropertyDescriptor=null;let collapsedByDefault=false;let count=sectionCountByType.get(scope.type);sectionCountByType.set(scope.type,++count);switch(scope.type){case WebInspector.ScopeChainNode.Type.Local:foundLocalScope=true;collapsedByDefault=false;title=WebInspector.UIString("Local Variables");if(callFrame.thisObject)
extraPropertyDescriptor=new WebInspector.PropertyDescriptor({name:"this",value:callFrame.thisObject});break;case WebInspector.ScopeChainNode.Type.Closure:if(scope.__baseClosureScope&&scope.name)
title=WebInspector.UIString("Closure Variables (%s)").format(scope.name);else
title=WebInspector.UIString("Closure Variables");collapsedByDefault=false;break;case WebInspector.ScopeChainNode.Type.Block:title=WebInspector.UIString("Block Variables");collapsedByDefault=false;break;case WebInspector.ScopeChainNode.Type.Catch:title=WebInspector.UIString("Catch Variables");collapsedByDefault=false;break;case WebInspector.ScopeChainNode.Type.FunctionName:title=WebInspector.UIString("Function Name Variable");collapsedByDefault=true;break;case WebInspector.ScopeChainNode.Type.With:title=WebInspector.UIString("With Object Properties");collapsedByDefault=foundLocalScope;break;case WebInspector.ScopeChainNode.Type.Global:title=WebInspector.UIString("Global Variables");collapsedByDefault=true;break;case WebInspector.ScopeChainNode.Type.GlobalLexicalEnvironment:title=WebInspector.UIString("Global Lexical Environment");collapsedByDefault=true;break;}
let detailsSectionIdentifier=scope.type+"-"+sectionCountByType.get(scope.type);let detailsSection=new WebInspector.DetailsSection(detailsSectionIdentifier,title,null,null,collapsedByDefault);
let rows=[];for(let object of scope.objects){let scopePropertyPath=WebInspector.PropertyPath.emptyPropertyPathForScope(object);let objectTree=new WebInspector.ObjectTreeView(object,WebInspector.ObjectTreeView.Mode.Properties,scopePropertyPath);objectTree.showOnlyProperties();if(extraPropertyDescriptor){objectTree.appendExtraPropertyDescriptor(extraPropertyDescriptor);extraPropertyDescriptor=null;}
let treeOutline=objectTree.treeOutline;treeOutline.addEventListener(WebInspector.TreeOutline.Event.ElementAdded,this._treeElementAdded.bind(this,detailsSectionIdentifier),this);treeOutline.addEventListener(WebInspector.TreeOutline.Event.ElementDisclosureDidChanged,this._treeElementDisclosureDidChange.bind(this,detailsSectionIdentifier),this);rows.push(new WebInspector.ObjectPropertiesDetailSectionRow(objectTree,detailsSection));}
detailsSection.groups[0].rows=rows;detailsSections.push(detailsSection);}
return Promise.resolve(detailsSections);}
_generateWatchExpressionsSection()
{let watchExpressions=this._watchExpressionsSetting.value;if(!watchExpressions.length){if(this._usedWatchExpressionsObjectGroup){this._usedWatchExpressionsObjectGroup=false;for(let target of WebInspector.targets)
target.RuntimeAgent.releaseObjectGroup(WebInspector.ScopeChainDetailsSidebarPanel.WatchExpressionsObjectGroupName);}
return Promise.resolve(null);}
for(let target of WebInspector.targets)
target.RuntimeAgent.releaseObjectGroup(WebInspector.ScopeChainDetailsSidebarPanel.WatchExpressionsObjectGroupName);this._usedWatchExpressionsObjectGroup=true;let watchExpressionsRemoteObject=WebInspector.RemoteObject.createFakeRemoteObject();let fakePropertyPath=WebInspector.PropertyPath.emptyPropertyPathForScope(watchExpressionsRemoteObject);let objectTree=new WebInspector.ObjectTreeView(watchExpressionsRemoteObject,WebInspector.ObjectTreeView.Mode.Properties,fakePropertyPath);objectTree.showOnlyProperties();let treeOutline=objectTree.treeOutline;const watchExpressionSectionIdentifier="watch-expressions";treeOutline.addEventListener(WebInspector.TreeOutline.Event.ElementAdded,this._treeElementAdded.bind(this,watchExpressionSectionIdentifier),this);treeOutline.addEventListener(WebInspector.TreeOutline.Event.ElementDisclosureDidChanged,this._treeElementDisclosureDidChange.bind(this,watchExpressionSectionIdentifier),this);treeOutline.objectTreeElementAddContextMenuItems=this._objectTreeElementAddContextMenuItems.bind(this);let promises=[];for(let expression of watchExpressions){promises.push(new Promise(function(resolve,reject){let options={objectGroup:WebInspector.ScopeChainDetailsSidebarPanel.WatchExpressionsObjectGroupName,includeCommandLineAPI:false,doNotPauseOnExceptionsAndMuteConsole:true,returnByValue:false,generatePreview:true,saveResult:false};WebInspector.runtimeManager.evaluateInInspectedWindow(expression,options,function(object,wasThrown){if(!object)
return;let propertyDescriptor=new WebInspector.PropertyDescriptor({name:expression,value:object},undefined,undefined,wasThrown);objectTree.appendExtraPropertyDescriptor(propertyDescriptor);resolve(propertyDescriptor);});}));}
return Promise.all(promises).then(function(){return Promise.resolve(new WebInspector.ObjectPropertiesDetailSectionRow(objectTree));});}
_addWatchExpression(expression)
{let watchExpressions=this._watchExpressionsSetting.value.slice(0);watchExpressions.push(expression);this._watchExpressionsSetting.value=watchExpressions;this.needsLayout();}
_removeWatchExpression(expression)
{let watchExpressions=this._watchExpressionsSetting.value.slice(0);watchExpressions.remove(expression,true);this._watchExpressionsSetting.value=watchExpressions;this.needsLayout();}
_clearAllWatchExpressions()
{this._watchExpressionsSetting.value=[];this.needsLayout();}
_addWatchExpressionButtonClicked(event)
{function presentPopoverOverTargetElement()
{let target=WebInspector.Rect.rectFromClientRect(event.target.element.getBoundingClientRect());popover.present(target,[WebInspector.RectEdge.MAX_Y,WebInspector.RectEdge.MIN_Y,WebInspector.RectEdge.MAX_X]);}
let popover=new WebInspector.Popover(this);let content=document.createElement("div");content.classList.add("watch-expression");content.appendChild(document.createElement("div")).textContent=WebInspector.UIString("Add New Watch Expression");let editorElement=content.appendChild(document.createElement("div"));editorElement.classList.add("watch-expression-editor",WebInspector.SyntaxHighlightedStyleClassName);this._codeMirror=WebInspector.CodeMirrorEditor.create(editorElement,{lineWrapping:true,mode:"text/javascript",indentWithTabs:true,indentUnit:4,matchBrackets:true,value:"",});this._popoverCommitted=false;this._codeMirror.addKeyMap({"Enter":()=>{this._popoverCommitted=true;popover.dismiss();},});let completionController=new WebInspector.CodeMirrorCompletionController(this._codeMirror);completionController.addExtendedCompletionProvider("javascript",WebInspector.javaScriptRuntimeCompletionProvider);let previousHeight=0;this._codeMirror.on("changes",function(cm,event){let height=cm.getScrollInfo().height;if(previousHeight!==height){previousHeight=height;popover.update(false);}});popover.content=content;popover.windowResizeHandler=presentPopoverOverTargetElement;presentPopoverOverTargetElement();setTimeout(()=>{this._codeMirror.refresh();this._codeMirror.focus();popover.update();},0);}
willDismissPopover(popover)
{if(this._popoverCommitted){let expression=this._codeMirror.getValue().trim();if(expression)
this._addWatchExpression(expression);}
this._codeMirror=null;}
_refreshAllWatchExpressionsButtonClicked(event)
{this.needsLayout();}
_clearAllWatchExpressionsButtonClicked(event)
{this._clearAllWatchExpressions();}
_didEvaluateExpression(event)
{if(event.data.objectGroup===WebInspector.ScopeChainDetailsSidebarPanel.WatchExpressionsObjectGroupName)
return;this.needsLayout();}
_activeExecutionContextChanged()
{this.needsLayout();}
_activeCallFrameDidChange()
{this.needsLayout();}
_mainResourceDidChange(event)
{if(!event.target.isMainFrame())
return;this.needsLayout();}
_objectTreeElementAddContextMenuItems(objectTreeElement,contextMenu)
{if(objectTreeElement.parent!==objectTreeElement.treeOutline)
return;contextMenu.appendItem(WebInspector.UIString("Remove Watch Expression"),()=>{let expression=objectTreeElement.property.name;this._removeWatchExpression(expression);});}
_propertyPathIdentifierForTreeElement(identifier,objectPropertyTreeElement)
{if(!objectPropertyTreeElement.property)
return null;let propertyPath=objectPropertyTreeElement.thisPropertyPath();if(propertyPath.isFullPathImpossible())
return null;return identifier+"-"+propertyPath.fullPath;}
_treeElementAdded(identifier,event)
{let treeElement=event.data.element;let propertyPathIdentifier=this._propertyPathIdentifierForTreeElement(identifier,treeElement);if(!propertyPathIdentifier)
return;if(WebInspector.ScopeChainDetailsSidebarPanel._autoExpandProperties.has(propertyPathIdentifier))
treeElement.expand();}
_treeElementDisclosureDidChange(identifier,event)
{let treeElement=event.data.element;let propertyPathIdentifier=this._propertyPathIdentifierForTreeElement(identifier,treeElement);if(!propertyPathIdentifier)
return;if(treeElement.expanded)
WebInspector.ScopeChainDetailsSidebarPanel._autoExpandProperties.add(propertyPathIdentifier);else
WebInspector.ScopeChainDetailsSidebarPanel._autoExpandProperties.delete(propertyPathIdentifier);}
_updateWatchExpressionsNavigationBar()
{let enabled=this._watchExpressionsSetting.value.length;this._refreshAllWatchExpressionButton.enabled=enabled;this._clearAllWatchExpressionButton.enabled=enabled;}};WebInspector.ScopeChainDetailsSidebarPanel._autoExpandProperties=new Set;WebInspector.ScopeChainDetailsSidebarPanel.WatchExpressionsObjectGroupName="watch-expressions";WebInspector.ScopeRadioButtonNavigationItem=class ScopeRadioButtonNavigationItem extends WebInspector.RadioButtonNavigationItem
{constructor(identifier,toolTip,scopeItems,defaultScopeItem)
{super(identifier,toolTip);this._scopeItems=scopeItems||[];this._element.classList.add("scope-radio-button-navigation-item");this._element.title=defaultScopeItem?defaultScopeItem.label:this._scopeItems[0].label;this._scopeItemSelect=document.createElement("select");this._scopeItemSelect.classList.add("scope-radio-button-item-select");for(var item of this._scopeItems){var option=document.createElement("option");option.value=item.identifier;option.text=item.label;this._scopeItemSelect.appendChild(option);}
this.selectedItemIdentifier=defaultScopeItem?defaultScopeItem.identifier:this._scopeItems[0].identifier;this._scopeItemSelect.addEventListener("change",this._handleItemChanged.bind(this));this._element.appendChild(this._scopeItemSelect);this._element.appendChild(useSVGSymbol("Images/UpDownArrows.svg","arrows"));}
set selectedItemIdentifier(identifier)
{if(!identifier)
return;this._scopeItemSelect.value=identifier;}
get selectedItemIdentifier()
{return this._scopeItemSelect.value;}
dontPreventDefaultOnNavigationBarMouseDown()
{return true;}
_handleItemChanged()
{var selectedItemIdentifier;for(var item of this._scopeItems){if(item.identifier!==this.selectedItemIdentifier)
continue;selectedItemIdentifier=item;break;}
this._element.title=selectedItemIdentifier.label;this.dispatchEventToListeners(WebInspector.ScopeRadioButtonNavigationItem.Event.SelectedItemChanged);}};WebInspector.ScopeRadioButtonNavigationItem.Event={SelectedItemChanged:"scope-radio-button-navigation-item-selected-item-changed"};WebInspector.ScriptClusterTimelineView=class ScriptClusterTimelineView extends WebInspector.ClusterContentView
{constructor(timeline,extraArguments)
{super(timeline);this._currentContentViewSetting=new WebInspector.Setting("script-cluster-timeline-view-current-view",WebInspector.ScriptClusterTimelineView.EventsIdentifier);let showSelectorArrows=this._canShowProfileView();function createPathComponent(displayName,className,identifier)
{let pathComponent=new WebInspector.HierarchicalPathComponent(displayName,className,identifier,false,showSelectorArrows);pathComponent.addEventListener(WebInspector.HierarchicalPathComponent.Event.SiblingWasSelected,this._pathComponentSelected,this);pathComponent.comparisonData=timeline;return pathComponent;}
this._eventsPathComponent=createPathComponent.call(this,WebInspector.UIString("Events"),"events-icon",WebInspector.ScriptClusterTimelineView.EventsIdentifier);this._profilePathComponent=createPathComponent.call(this,WebInspector.UIString("Call Trees"),"call-trees-icon",WebInspector.ScriptClusterTimelineView.ProfileIdentifier);if(this._canShowProfileView()){this._eventsPathComponent.nextSibling=this._profilePathComponent;this._profilePathComponent.previousSibling=this._eventsPathComponent;}
this._eventsContentView=new WebInspector.ScriptDetailsTimelineView(this.representedObject,extraArguments);this._profileContentView=this._canShowProfileView()?new WebInspector.ScriptProfileTimelineView(this.representedObject,extraArguments):null;this._showContentViewForIdentifier(this._currentContentViewSetting.value);this.contentViewContainer.addEventListener(WebInspector.ContentViewContainer.Event.CurrentContentViewDidChange,this._scriptClusterViewCurrentContentViewDidChange,this);}
get showsLiveRecordingData(){return this._contentViewContainer.currentContentView.showsLiveRecordingData;}
get showsFilterBar(){return this._contentViewContainer.currentContentView.showsFilterBar;}
get zeroTime(){return this._contentViewContainer.currentContentView.zeroTime;}
set zeroTime(x){this._contentViewContainer.currentContentView.zeroTime=x;}
get startTime(){return this._contentViewContainer.currentContentView.startTime;}
set startTime(x){this._contentViewContainer.currentContentView.startTime=x;}
get endTime(){return this._contentViewContainer.currentContentView.endTime;}
set endTime(x){this._contentViewContainer.currentContentView.endTime=x;}
get currentTime(){return this._contentViewContainer.currentContentView.currentTime;}
set currentTime(x){this._contentViewContainer.currentContentView.currentTime=x;}
selectRecord(record){this._contentViewContainer.currentContentView.selectRecord(record);}
updateFilter(filters){return this._contentViewContainer.currentContentView.updateFilter(filters);}
filterDidChange(){return this._contentViewContainer.currentContentView.filterDidChange();}
matchDataGridNodeAgainstCustomFilters(node){return this._contentViewContainer.currentContentView.matchDataGridNodeAgainstCustomFilters(node);}
reset()
{this._eventsContentView.reset();if(this._profileContentView)
this._profileContentView.reset();}
get eventsContentView()
{return this._eventsContentView;}
get profileContentView()
{return this._profileContentView;}
get selectionPathComponents()
{let currentContentView=this._contentViewContainer.currentContentView;if(!currentContentView)
return[];let components=[this._pathComponentForContentView(currentContentView)];let subComponents=currentContentView.selectionPathComponents;if(subComponents)
return components.concat(subComponents);return components;}
saveToCookie(cookie)
{cookie[WebInspector.ScriptClusterTimelineView.ContentViewIdentifierCookieKey]=this._currentContentViewSetting.value;}
restoreFromCookie(cookie)
{this._showContentViewForIdentifier(cookie[WebInspector.ScriptClusterTimelineView.ContentViewIdentifierCookieKey]);}
showEvents()
{return this._showContentViewForIdentifier(WebInspector.ScriptClusterTimelineView.EventsIdentifier);}
showProfile()
{if(!this._canShowProfileView())
return this.showEvents();return this._showContentViewForIdentifier(WebInspector.ScriptClusterTimelineView.ProfileIdentifier);}
_canShowProfileView()
{return window.ScriptProfilerAgent;}
_pathComponentForContentView(contentView)
{if(!contentView)
return null;if(contentView===this._eventsContentView)
return this._eventsPathComponent;if(contentView===this._profileContentView)
return this._profilePathComponent;console.error("Unknown contentView.");return null;}
_identifierForContentView(contentView)
{if(!contentView)
return null;if(contentView===this._eventsContentView)
return WebInspector.ScriptClusterTimelineView.EventsIdentifier;if(contentView===this._profileContentView)
return WebInspector.ScriptClusterTimelineView.ProfileIdentifier;console.error("Unknown contentView.");return null;}
_showContentViewForIdentifier(identifier)
{let contentViewToShow=null;switch(identifier){case WebInspector.ScriptClusterTimelineView.EventsIdentifier:contentViewToShow=this.eventsContentView;break;case WebInspector.ScriptClusterTimelineView.ProfileIdentifier:contentViewToShow=this.profileContentView;break;}
if(!contentViewToShow)
contentViewToShow=this.eventsContentView;this._currentContentViewSetting.value=this._identifierForContentView(contentViewToShow);return this.contentViewContainer.showContentView(contentViewToShow);}
_pathComponentSelected(event)
{this._showContentViewForIdentifier(event.data.pathComponent.representedObject);}
_scriptClusterViewCurrentContentViewDidChange(event)
{let currentContentView=this._contentViewContainer.currentContentView;if(!currentContentView)
return;let previousContentView=currentContentView===this._eventsContentView?this._profileContentView:this._eventsContentView;currentContentView.zeroTime=previousContentView.zeroTime;currentContentView.startTime=previousContentView.startTime;currentContentView.endTime=previousContentView.endTime;currentContentView.currentTime=previousContentView.currentTime;}};WebInspector.ScriptClusterTimelineView.ContentViewIdentifierCookieKey="script-cluster-timeline-view-identifier";WebInspector.ScriptClusterTimelineView.EventsIdentifier="events";WebInspector.ScriptClusterTimelineView.ProfileIdentifier="profile";WebInspector.ScriptContentView=class ScriptContentView extends WebInspector.ContentView
{constructor(script)
{super(script);this.element.classList.add("script");var spinner=new WebInspector.IndeterminateProgressSpinner;this.element.appendChild(spinner.element);this._script=script;
this._textEditor=new WebInspector.SourceCodeTextEditor(script);this._textEditor.addEventListener(WebInspector.TextEditor.Event.ExecutionLineNumberDidChange,this._executionLineNumberDidChange,this);this._textEditor.addEventListener(WebInspector.TextEditor.Event.NumberOfSearchResultsDidChange,this._numberOfSearchResultsDidChange,this);this._textEditor.addEventListener(WebInspector.TextEditor.Event.FormattingDidChange,this._textEditorFormattingDidChange,this);this._textEditor.addEventListener(WebInspector.SourceCodeTextEditor.Event.ContentWillPopulate,this._contentWillPopulate,this);this._textEditor.addEventListener(WebInspector.SourceCodeTextEditor.Event.ContentDidPopulate,this._contentDidPopulate,this);var toolTip=WebInspector.UIString("Pretty print");var activatedToolTip=WebInspector.UIString("Original formatting");this._prettyPrintButtonNavigationItem=new WebInspector.ActivateButtonNavigationItem("pretty-print",toolTip,activatedToolTip,"Images/NavigationItemCurleyBraces.svg",13,13);this._prettyPrintButtonNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,this._togglePrettyPrint,this);this._prettyPrintButtonNavigationItem.enabled=false;var toolTipTypes=WebInspector.UIString("Show type information");var activatedToolTipTypes=WebInspector.UIString("Hide type information");this._showTypesButtonNavigationItem=new WebInspector.ActivateButtonNavigationItem("show-types",toolTipTypes,activatedToolTipTypes,"Images/NavigationItemTypes.svg",13,14);this._showTypesButtonNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,this._toggleTypeAnnotations,this);this._showTypesButtonNavigationItem.enabled=false;WebInspector.showJavaScriptTypeInformationSetting.addEventListener(WebInspector.Setting.Event.Changed,this._showJavaScriptTypeInformationSettingChanged,this);let toolTipCodeCoverage=WebInspector.UIString("Fade unexecuted code");let activatedToolTipCodeCoverage=WebInspector.UIString("Do not fade unexecuted code");this._codeCoverageButtonNavigationItem=new WebInspector.ActivateButtonNavigationItem("code-coverage",toolTipCodeCoverage,activatedToolTipCodeCoverage,"Images/NavigationItemCodeCoverage.svg",13,14);this._codeCoverageButtonNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,this._toggleUnexecutedCodeHighlights,this);this._codeCoverageButtonNavigationItem.enabled=false;WebInspector.enableControlFlowProfilerSetting.addEventListener(WebInspector.Setting.Event.Changed,this._enableControlFlowProfilerSettingChanged,this);}
get navigationItems()
{return[this._prettyPrintButtonNavigationItem,this._showTypesButtonNavigationItem,this._codeCoverageButtonNavigationItem];}
get script()
{return this._script;}
get textEditor()
{return this._textEditor;}
get supplementalRepresentedObjects()
{if(isNaN(this._textEditor.executionLineNumber))
return[];
return[WebInspector.debuggerManager.activeCallFrame];}
revealPosition(position,textRangeToSelect,forceUnformatted)
{this._textEditor.revealPosition(position,textRangeToSelect,forceUnformatted);}
shown()
{super.shown();this._textEditor.shown();}
hidden()
{super.hidden();this._textEditor.hidden();}
closed()
{super.closed();WebInspector.showJavaScriptTypeInformationSetting.removeEventListener(null,null,this);WebInspector.enableControlFlowProfilerSetting.removeEventListener(null,null,this);this._textEditor.close();}
saveToCookie(cookie)
{cookie.type=WebInspector.ContentViewCookieType.Resource;cookie.url=this.representedObject.url;}
restoreFromCookie(cookie)
{if("lineNumber"in cookie&&"columnNumber"in cookie)
this.revealPosition(new WebInspector.SourceCodePosition(cookie.lineNumber,cookie.columnNumber));}
get supportsSave()
{return true;}
get saveData()
{var url=this._script.url||"web-inspector:///"+encodeURI(this._script.displayName)+".js";return{url,content:this._textEditor.string};}
get supportsSearch()
{return true;}
get numberOfSearchResults()
{return this._textEditor.numberOfSearchResults;}
get hasPerformedSearch()
{return this._textEditor.currentSearchQuery!==null;}
set automaticallyRevealFirstSearchResult(reveal)
{this._textEditor.automaticallyRevealFirstSearchResult=reveal;}
performSearch(query)
{this._textEditor.performSearch(query);}
searchCleared()
{this._textEditor.searchCleared();}
searchQueryWithSelection()
{return this._textEditor.searchQueryWithSelection();}
revealPreviousSearchResult(changeFocus)
{this._textEditor.revealPreviousSearchResult(changeFocus);}
revealNextSearchResult(changeFocus)
{this._textEditor.revealNextSearchResult(changeFocus);}
_contentWillPopulate(event)
{if(this._textEditor.element.parentNode===this.element)
return;if(this._script.urlComponents.scheme==="file")
this._textEditor.readOnly=false;this.element.removeChildren();this.addSubview(this._textEditor);}
_contentDidPopulate(event)
{this._prettyPrintButtonNavigationItem.enabled=this._textEditor.canBeFormatted();this._showTypesButtonNavigationItem.enabled=this._textEditor.canShowTypeAnnotations();this._showTypesButtonNavigationItem.activated=WebInspector.showJavaScriptTypeInformationSetting.value;this._codeCoverageButtonNavigationItem.enabled=this._textEditor.canShowCoverageHints();this._codeCoverageButtonNavigationItem.activated=WebInspector.enableControlFlowProfilerSetting.value;}
_togglePrettyPrint(event)
{var activated=!this._prettyPrintButtonNavigationItem.activated;this._textEditor.updateFormattedState(activated);}
_toggleTypeAnnotations(event)
{this._showTypesButtonNavigationItem.enabled=false;this._textEditor.toggleTypeAnnotations().then(()=>{this._showTypesButtonNavigationItem.enabled=true;});}
_toggleUnexecutedCodeHighlights(event)
{this._codeCoverageButtonNavigationItem.enabled=false;this._textEditor.toggleUnexecutedCodeHighlights().then(()=>{this._codeCoverageButtonNavigationItem.enabled=true;});}
_showJavaScriptTypeInformationSettingChanged(event)
{this._showTypesButtonNavigationItem.activated=WebInspector.showJavaScriptTypeInformationSetting.value;}
_enableControlFlowProfilerSettingChanged(event)
{this._codeCoverageButtonNavigationItem.activated=WebInspector.enableControlFlowProfilerSetting.value;}
_textEditorFormattingDidChange(event)
{this._prettyPrintButtonNavigationItem.activated=this._textEditor.formatted;}
_executionLineNumberDidChange(event)
{this.dispatchEventToListeners(WebInspector.ContentView.Event.SupplementalRepresentedObjectsDidChange);}
_numberOfSearchResultsDidChange(event)
{this.dispatchEventToListeners(WebInspector.ContentView.Event.NumberOfSearchResultsDidChange);}};WebInspector.ScriptDetailsTimelineView=class ScriptDetailsTimelineView extends WebInspector.TimelineView
{constructor(timeline,extraArguments)
{super(timeline,extraArguments);let columns={name:{},location:{},callCount:{},startTime:{},totalTime:{},selfTime:{},averageTime:{}};columns.name.title=WebInspector.UIString("Name");columns.name.width="10%";columns.name.icon=true;columns.name.disclosure=true;columns.name.locked=true;columns.location.title=WebInspector.UIString("Location");columns.location.icon=true;columns.location.width="15%";let isSamplingProfiler=!!window.ScriptProfilerAgent;if(isSamplingProfiler)
columns.callCount.title=WebInspector.UIString("Samples");else{columns.callCount.title=WebInspector.UIString("Calls");}
columns.callCount.width="5%";columns.callCount.aligned="right";columns.startTime.title=WebInspector.UIString("Start Time");columns.startTime.width="10%";columns.startTime.aligned="right";columns.totalTime.title=WebInspector.UIString("Total Time");columns.totalTime.width="10%";columns.totalTime.aligned="right";columns.selfTime.title=WebInspector.UIString("Self Time");columns.selfTime.width="10%";columns.selfTime.aligned="right";columns.averageTime.title=WebInspector.UIString("Average Time");columns.averageTime.width="10%";columns.averageTime.aligned="right";for(var column in columns)
columns[column].sortable=true;this._dataGrid=new WebInspector.ScriptTimelineDataGrid(columns);this._dataGrid.sortDelegate=this;this._dataGrid.sortColumnIdentifier="startTime";this._dataGrid.sortOrder=WebInspector.DataGrid.SortOrder.Ascending;this._dataGrid.createSettings("script-timeline-view");this.setupDataGrid(this._dataGrid);this.element.classList.add("script");this.addSubview(this._dataGrid);timeline.addEventListener(WebInspector.Timeline.Event.RecordAdded,this._scriptTimelineRecordAdded,this);timeline.addEventListener(WebInspector.Timeline.Event.Refreshed,this._scriptTimelineRecordRefreshed,this);this._pendingRecords=[];}
get showsLiveRecordingData(){return false;}
shown()
{super.shown();this._dataGrid.shown();}
hidden()
{this._dataGrid.hidden();super.hidden();}
closed()
{this.representedObject.removeEventListener(null,null,this);this._dataGrid.closed();}
get selectionPathComponents()
{var dataGridNode=this._dataGrid.selectedNode;if(!dataGridNode)
return null;var pathComponents=[];while(dataGridNode&&!dataGridNode.root){if(dataGridNode.hidden)
return null;let pathComponent=new WebInspector.TimelineDataGridNodePathComponent(dataGridNode);pathComponent.addEventListener(WebInspector.HierarchicalPathComponent.Event.SiblingWasSelected,this.dataGridNodePathComponentSelected,this);pathComponents.unshift(pathComponent);dataGridNode=dataGridNode.parent;}
return pathComponents;}
reset()
{super.reset();this._dataGrid.reset();this._pendingRecords=[];}
dataGridSortComparator(sortColumnIdentifier,sortDirection,node1,node2)
{if(sortColumnIdentifier!=="name")
return null;let displayName1=node1.displayName();let displayName2=node2.displayName();if(displayName1!==displayName2)
return displayName1.extendedLocaleCompare(displayName2)*sortDirection;return node1.subtitle.extendedLocaleCompare(node2.subtitle)*sortDirection;}
dataGridNodePathComponentSelected(event)
{let dataGridNode=event.data.pathComponent.timelineDataGridNode;dataGridNode.revealAndSelect();}
layout()
{if(this.startTime!==this._oldStartTime||this.endTime!==this._oldEndTime){let dataGridNode=this._dataGrid.children[0];while(dataGridNode){dataGridNode.updateRangeTimes(this.startTime,this.endTime);if(dataGridNode.revealed)
dataGridNode.refreshIfNeeded();dataGridNode=dataGridNode.traverseNextNode(false,null,true);}
this._oldStartTime=this.startTime;this._oldEndTime=this.endTime;}
this._processPendingRecords();}
_processPendingRecords()
{if(WebInspector.timelineManager.scriptProfilerIsTracking())
return;if(!this._pendingRecords.length)
return;let zeroTime=this.zeroTime;let startTime=this.startTime;let endTime=this.endTime;for(let scriptTimelineRecord of this._pendingRecords){let rootNodes=[];if(scriptTimelineRecord.profile){rootNodes=scriptTimelineRecord.profile.topDownRootNodes;}
let dataGridNode=new WebInspector.ScriptTimelineDataGridNode(scriptTimelineRecord,zeroTime);this._dataGrid.addRowInSortOrder(null,dataGridNode);for(let profileNode of rootNodes){let profileNodeDataGridNode=new WebInspector.ProfileNodeDataGridNode(profileNode,zeroTime,startTime,endTime);this._dataGrid.addRowInSortOrder(null,profileNodeDataGridNode,dataGridNode);}}
this._pendingRecords=[];}
_scriptTimelineRecordAdded(event)
{var scriptTimelineRecord=event.data.record;this._pendingRecords.push(scriptTimelineRecord);this.needsLayout();}
_scriptTimelineRecordRefreshed(event)
{this.needsLayout();}};WebInspector.ScriptProfileTimelineView=class ScriptProfileTimelineView extends WebInspector.TimelineView
{constructor(timeline,extraArguments)
{super(timeline,extraArguments);this.element.classList.add("script");this._recording=extraArguments.recording;this._forceNextLayout=false;this._lastLayoutStartTime=undefined;this._lastLayoutEndTime=undefined;this._sharedProfileViewData={selectedNodeHash:null,};if(!WebInspector.ScriptProfileTimelineView.profileOrientationSetting)
WebInspector.ScriptProfileTimelineView.profileOrientationSetting=new WebInspector.Setting("script-profile-timeline-view-profile-orientation-setting",WebInspector.ScriptProfileTimelineView.ProfileOrientation.TopDown);if(!WebInspector.ScriptProfileTimelineView.profileTypeSetting)
WebInspector.ScriptProfileTimelineView.profileTypeSetting=new WebInspector.Setting("script-profile-timeline-view-profile-type-setting",WebInspector.ScriptProfileTimelineView.ProfileViewType.Hierarchy);this._showProfileViewForOrientation(WebInspector.ScriptProfileTimelineView.profileOrientationSetting.value,WebInspector.ScriptProfileTimelineView.profileTypeSetting.value);let clearTooltip=WebInspector.UIString("Clear focus");this._clearFocusNodesButtonItem=new WebInspector.ButtonNavigationItem("clear-profile-focus",clearTooltip,"Images/Close.svg",16,16);this._clearFocusNodesButtonItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,this._clearFocusNodes,this);this._updateClearFocusNodesButtonItem();this._profileOrientationButton=new WebInspector.TextToggleButtonNavigationItem("profile-orientation",WebInspector.UIString("Inverted"));this._profileOrientationButton.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,this._profileOrientationButtonClicked,this);if(WebInspector.ScriptProfileTimelineView.profileOrientationSetting.value===WebInspector.ScriptProfileTimelineView.ProfileOrientation.TopDown)
this._profileOrientationButton.activated=false;else
this._profileOrientationButton.activated=true;this._topFunctionsButton=new WebInspector.TextToggleButtonNavigationItem("top-functions",WebInspector.UIString("Top Functions"));this._topFunctionsButton.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,this._topFunctionsButtonClicked,this);if(WebInspector.ScriptProfileTimelineView.profileTypeSetting.value===WebInspector.ScriptProfileTimelineView.ProfileViewType.Hierarchy)
this._topFunctionsButton.activated=false;else
this._topFunctionsButton.activated=true;timeline.addEventListener(WebInspector.Timeline.Event.Refreshed,this._scriptTimelineRecordRefreshed,this);}
get scrollableElements(){return this._profileView.scrollableElements;}
get showsLiveRecordingData(){return false;}
closed()
{this.representedObject.removeEventListener(null,null,this);}
get navigationItems()
{return[this._clearFocusNodesButtonItem,this._profileOrientationButton,this._topFunctionsButton];}
get selectionPathComponents()
{return this._profileView.selectionPathComponents;}
layout()
{if(!this._forceNextLayout&&(this._lastLayoutStartTime===this.startTime&&this._lastLayoutEndTime===this.endTime))
return;this._forceNextLayout=false;this._lastLayoutStartTime=this.startTime;this._lastLayoutEndTime=this.endTime;this._profileView.setStartAndEndTime(this.startTime,this.endTime);}
_callingContextTreeForOrientation(profileOrientation,profileViewType)
{switch(profileOrientation){case WebInspector.ScriptProfileTimelineView.ProfileOrientation.TopDown:return profileViewType===WebInspector.ScriptProfileTimelineView.ProfileViewType.Hierarchy?this._recording.topDownCallingContextTree:this._recording.topFunctionsTopDownCallingContextTree;case WebInspector.ScriptProfileTimelineView.ProfileOrientation.BottomUp:return profileViewType===WebInspector.ScriptProfileTimelineView.ProfileViewType.Hierarchy?this._recording.bottomUpCallingContextTree:this._recording.topFunctionsBottomUpCallingContextTree;}
return this._recording.topDownCallingContextTree;}
_profileViewSelectionPathComponentsDidChange(event)
{this._updateClearFocusNodesButtonItem();this.dispatchEventToListeners(WebInspector.ContentView.Event.SelectionPathComponentsDidChange);}
_scriptTimelineRecordRefreshed(event)
{this._forceNextLayout=true;this.needsLayout();}
_profileOrientationButtonClicked()
{this._profileOrientationButton.activated=!this._profileOrientationButton.activated;let isInverted=this._profileOrientationButton.activated;let newOrientation;if(isInverted)
newOrientation=WebInspector.ScriptProfileTimelineView.ProfileOrientation.BottomUp;else
newOrientation=WebInspector.ScriptProfileTimelineView.ProfileOrientation.TopDown;WebInspector.ScriptProfileTimelineView.profileOrientationSetting.value=newOrientation;this._showProfileViewForOrientation(newOrientation,WebInspector.ScriptProfileTimelineView.profileTypeSetting.value);this.dispatchEventToListeners(WebInspector.ContentView.Event.SelectionPathComponentsDidChange);this._forceNextLayout=true;this.needsLayout();}
_topFunctionsButtonClicked()
{this._topFunctionsButton.activated=!this._topFunctionsButton.activated;let isTopFunctionsEnabled=this._topFunctionsButton.activated;let newOrientation;if(isTopFunctionsEnabled)
newOrientation=WebInspector.ScriptProfileTimelineView.ProfileViewType.TopFunctions;else
newOrientation=WebInspector.ScriptProfileTimelineView.ProfileViewType.Hierarchy;WebInspector.ScriptProfileTimelineView.profileTypeSetting.value=newOrientation;this._showProfileViewForOrientation(WebInspector.ScriptProfileTimelineView.profileOrientationSetting.value,newOrientation);this.dispatchEventToListeners(WebInspector.ContentView.Event.SelectionPathComponentsDidChange);this._forceNextLayout=true;this.needsLayout();}
_showProfileViewForOrientation(profileOrientation,profileViewType)
{let filterText;if(this._profileView){this._profileView.removeEventListener(WebInspector.ContentView.Event.SelectionPathComponentsDidChange,this._profileViewSelectionPathComponentsDidChange,this);this.removeSubview(this._profileView);filterText=this._profileView.dataGrid.filterText;}
let callingContextTree=this._callingContextTreeForOrientation(profileOrientation,profileViewType);this._profileView=new WebInspector.ProfileView(callingContextTree,this._sharedProfileViewData);this._profileView.addEventListener(WebInspector.ContentView.Event.SelectionPathComponentsDidChange,this._profileViewSelectionPathComponentsDidChange,this);this.addSubview(this._profileView);this.setupDataGrid(this._profileView.dataGrid);if(filterText)
this._profileView.dataGrid.filterText=filterText;}
_updateClearFocusNodesButtonItem()
{this._clearFocusNodesButtonItem.enabled=this._profileView.hasFocusNodes();}
_clearFocusNodes()
{this._profileView.clearFocusNodes();}};WebInspector.ScriptProfileTimelineView.ProfileOrientation={BottomUp:"bottom-up",TopDown:"top-down",};WebInspector.ScriptProfileTimelineView.ProfileViewType={Hierarchy:"hierarchy",TopFunctions:"top-functions",};WebInspector.ScriptTimelineDataGrid=class ScriptTimelineDataGrid extends WebInspector.TimelineDataGrid
{ callFramePopoverAnchorElement()
{return this.selectedNode.elementWithColumnIdentifier("location");}};WebInspector.ScriptTimelineDataGridNode=class ScriptTimelineDataGridNode extends WebInspector.TimelineDataGridNode
{constructor(scriptTimelineRecord,baseStartTime,rangeStartTime,rangeEndTime)
{super(false,null);this._record=scriptTimelineRecord;this._baseStartTime=baseStartTime||0;this._rangeStartTime=rangeStartTime||0;this._rangeEndTime=typeof rangeEndTime==="number"?rangeEndTime:Infinity;}
get records()
{return[this._record];}
get baseStartTime()
{return this._baseStartTime;}
get rangeStartTime()
{return this._rangeStartTime;}
get rangeEndTime()
{return this._rangeEndTime;}
get data()
{if(!this._cachedData){var startTime=this._record.startTime;var duration=this._record.startTime+this._record.duration-startTime;var callFrameOrSourceCodeLocation=this._record.initiatorCallFrame||this._record.sourceCodeLocation;if(this._record.profile){var oneRootNode=this._record.profile.topDownRootNodes[0];if(oneRootNode&&oneRootNode.calls){startTime=Math.max(this._rangeStartTime,this._record.startTime);duration=Math.min(this._record.startTime+this._record.duration,this._rangeEndTime)-startTime;}}
this._cachedData={eventType:this._record.eventType,startTime,selfTime:duration,totalTime:duration,averageTime:duration,callCount:this._record.callCountOrSamples,location:callFrameOrSourceCodeLocation,};}
return this._cachedData;}
get subtitle()
{if(this._subtitle!==undefined)
return this._subtitle;this._subtitle="";if(this._record.eventType===WebInspector.ScriptTimelineRecord.EventType.TimerInstalled){let timeoutString=Number.secondsToString(this._record.details.timeout/1000);if(this._record.details.repeating)
this._subtitle=WebInspector.UIString("%s interval").format(timeoutString);else
this._subtitle=WebInspector.UIString("%s delay").format(timeoutString);}
return this._subtitle;}
updateRangeTimes(startTime,endTime)
{var oldRangeStartTime=this._rangeStartTime;var oldRangeEndTime=this._rangeEndTime;if(oldRangeStartTime===startTime&&oldRangeEndTime===endTime)
return;this._rangeStartTime=startTime;this._rangeEndTime=endTime;if(!this._record.duration)
return;var recordStart=this._record.startTime;var recordEnd=this._record.startTime+this._record.duration;var oldStartBoundary=Number.constrain(oldRangeStartTime,recordStart,recordEnd);var oldEndBoundary=Number.constrain(oldRangeEndTime,recordStart,recordEnd);var newStartBoundary=Number.constrain(startTime,recordStart,recordEnd);var newEndBoundary=Number.constrain(endTime,recordStart,recordEnd);if(oldStartBoundary!==newStartBoundary||oldEndBoundary!==newEndBoundary)
this.needsRefresh();}
createCellContent(columnIdentifier,cell)
{var value=this.data[columnIdentifier];switch(columnIdentifier){case"name":cell.classList.add(...this.iconClassNames());return this._createNameCellDocumentFragment();case"startTime":return isNaN(value)?emDash:Number.secondsToString(value-this._baseStartTime,true);case"selfTime":case"totalTime":case"averageTime":return isNaN(value)?emDash:Number.secondsToString(value,true);case"callCount":return isNaN(value)?emDash:value.toLocaleString();}
return super.createCellContent(columnIdentifier,cell);}
filterableDataForColumn(columnIdentifier)
{if(columnIdentifier==="name")
return[this.displayName(),this.subtitle];return super.filterableDataForColumn(columnIdentifier);}
_createNameCellDocumentFragment(cellElement)
{let fragment=document.createDocumentFragment();fragment.append(this.displayName());if(this.subtitle){let subtitleElement=document.createElement("span");subtitleElement.classList.add("subtitle");subtitleElement.textContent=this.subtitle;fragment.append(subtitleElement);}
return fragment;}};WebInspector.ScriptTimelineOverviewGraph=class ScriptTimelineOverviewGraph extends WebInspector.TimelineOverviewGraph
{constructor(timeline,timelineOverview)
{super(timelineOverview);this.element.classList.add("script");this._scriptTimeline=timeline;this._scriptTimeline.addEventListener(WebInspector.Timeline.Event.RecordAdded,this._scriptTimelineRecordAdded,this);this._timelineRecordBars=[];this.reset();}
reset()
{super.reset();this.element.removeChildren();}
layout()
{if(!this.visible)
return;let secondsPerPixel=this.timelineOverview.secondsPerPixel;let recordBarIndex=0;function createBar(records,renderMode)
{let timelineRecordBar=this._timelineRecordBars[recordBarIndex];if(!timelineRecordBar)
timelineRecordBar=this._timelineRecordBars[recordBarIndex]=new WebInspector.TimelineRecordBar(records,renderMode);else{timelineRecordBar.renderMode=renderMode;timelineRecordBar.records=records;}
timelineRecordBar.refresh(this);if(!timelineRecordBar.element.parentNode)
this.element.appendChild(timelineRecordBar.element);++recordBarIndex;}
let[gcRecords,nonGCRecords]=this._scriptTimeline.records.partition((x)=>x.isGarbageCollection());let boundCreateBar=createBar.bind(this);WebInspector.TimelineRecordBar.createCombinedBars(nonGCRecords,secondsPerPixel,this,boundCreateBar);WebInspector.TimelineRecordBar.createCombinedBars(gcRecords,secondsPerPixel,this,boundCreateBar);for(;recordBarIndex<this._timelineRecordBars.length;++recordBarIndex){this._timelineRecordBars[recordBarIndex].records=null;this._timelineRecordBars[recordBarIndex].element.remove();}}
_scriptTimelineRecordAdded(event)
{this.needsLayout();}};WebInspector.ScriptTreeElement=class ScriptTreeElement extends WebInspector.SourceCodeTreeElement
{constructor(script)
{super(script,"script",null,null,script,false);this.mainTitle=script.displayName;if(script.url&&!script.dynamicallyAddedScriptElement){var subtitle=WebInspector.displayNameForHost(script.urlComponents.host);this.subtitle=this.mainTitle!==subtitle?subtitle:null;this.tooltip=script.url;this.addClassName(WebInspector.ResourceTreeElement.ResourceIconStyleClassName);this.addClassName(WebInspector.Resource.Type.Script);}else
this.addClassName(WebInspector.ScriptTreeElement.AnonymousScriptIconStyleClassName);if(script.isMainResource()){this.addClassName("worker-icon");}
this._script=script;}
get script()
{return this._script;}};WebInspector.ScriptTreeElement.AnonymousScriptIconStyleClassName="anonymous-script-icon";WebInspector.SearchBar=class SearchBar extends WebInspector.NavigationItem
{constructor(identifier,placeholder,delegate,suppressIncremental)
{super(identifier);this.delegate=delegate;this._element.classList.add("search-bar");this._keyboardShortcutEsc=new WebInspector.KeyboardShortcut(null,WebInspector.KeyboardShortcut.Key.Escape);this._keyboardShortcutEnter=new WebInspector.KeyboardShortcut(null,WebInspector.KeyboardShortcut.Key.Enter);this._searchInput=this._element.appendChild(document.createElement("input"));this._searchInput.type="search";this._searchInput.spellcheck=false;this._searchInput.incremental=!suppressIncremental;this._searchInput.setAttribute("results",5);this._searchInput.setAttribute("autosave",identifier+"-autosave");this._searchInput.setAttribute("placeholder",placeholder);this._searchInput.addEventListener("search",this._handleSearchEvent.bind(this));this._searchInput.addEventListener("keydown",this._handleKeydownEvent.bind(this));}
get text()
{return this._searchInput.value;}
set text(newText)
{this._searchInput.value=newText;}
focus()
{if(!this._searchInput.value.length)
this._searchInput.focus();else
this._searchInput.select();}
_handleSearchEvent(event)
{this.dispatchEventToListeners(WebInspector.SearchBar.Event.TextChanged);}
_handleKeydownEvent(event)
{if(this._keyboardShortcutEsc.matchesEvent(event)){if(this.delegate&&typeof this.delegate.searchBarWantsToLoseFocus==="function"){this.delegate.searchBarWantsToLoseFocus(this);event.stopPropagation();event.preventDefault();}}else if(this._keyboardShortcutEnter.matchesEvent(event)){if(this.delegate&&typeof this.delegate.searchBarDidActivate==="function"){this.delegate.searchBarDidActivate(this);event.stopPropagation();event.preventDefault();}}}};WebInspector.SearchBar.Event={TextChanged:"searchbar-text-did-change"};WebInspector.SearchResultTreeElement=class SearchResultTreeElement extends WebInspector.GeneralTreeElement
{constructor(representedObject)
{var title=WebInspector.SearchResultTreeElement.truncateAndHighlightTitle(representedObject.title,representedObject.searchTerm,representedObject.sourceCodeTextRange);super(representedObject.className,title,null,representedObject,false);}
static truncateAndHighlightTitle(title,searchTerm,sourceCodeTextRange)
{let isRTL=WebInspector.resolvedLayoutDirection()===WebInspector.LayoutDirection.RTL;const charactersToShowBeforeSearchMatch=isRTL?20:15;const charactersToShowAfterSearchMatch=isRTL?15:50;var textRange=sourceCodeTextRange.textRange;var searchTermIndex=textRange.startColumn;
var modifiedTitle=null;if(searchTermIndex>charactersToShowBeforeSearchMatch){modifiedTitle=ellipsis+title.substring(searchTermIndex-charactersToShowBeforeSearchMatch);searchTermIndex=charactersToShowBeforeSearchMatch+1;}else
modifiedTitle=title;modifiedTitle=modifiedTitle.trimEnd(searchTermIndex+searchTerm.length+charactersToShowAfterSearchMatch);var highlightedTitle=document.createDocumentFragment();highlightedTitle.append(modifiedTitle.substring(0,searchTermIndex));var highlightSpan=document.createElement("span");highlightSpan.className="highlighted";highlightSpan.append(modifiedTitle.substring(searchTermIndex,searchTermIndex+searchTerm.length));highlightedTitle.appendChild(highlightSpan);highlightedTitle.append(modifiedTitle.substring(searchTermIndex+searchTerm.length));return highlightedTitle;}
get filterableData()
{return{text:[this.representedObject.title]};}
get synthesizedTextValue()
{return this.representedObject.sourceCodeTextRange.synthesizedTextValue+":"+this.representedObject.title;}};WebInspector.SearchSidebarPanel=class SearchSidebarPanel extends WebInspector.NavigationSidebarPanel
{constructor(contentBrowser)
{super("search",WebInspector.UIString("Search"),true,true);this.contentBrowser=contentBrowser;var searchElement=document.createElement("div");searchElement.classList.add("search-bar");this.element.appendChild(searchElement);this._inputElement=document.createElement("input");this._inputElement.type="search";this._inputElement.spellcheck=false;this._inputElement.addEventListener("search",this._searchFieldChanged.bind(this));this._inputElement.addEventListener("input",this._searchFieldInput.bind(this));this._inputElement.setAttribute("results",5);this._inputElement.setAttribute("autosave","inspector-search-autosave");this._inputElement.setAttribute("placeholder",WebInspector.UIString("Search Resource Content"));searchElement.appendChild(this._inputElement);this.filterBar.placeholder=WebInspector.UIString("Filter Search Results");this._searchQuerySetting=new WebInspector.Setting("search-sidebar-query","");this._inputElement.value=this._searchQuerySetting.value;WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange,this._mainResourceDidChange,this);this.contentTreeOutline.addEventListener(WebInspector.TreeOutline.Event.SelectionDidChange,this._treeSelectionDidChange,this);}
closed()
{super.closed();WebInspector.Frame.removeEventListener(null,null,this);}
focusSearchField(performSearch)
{this.show();this._inputElement.select();if(performSearch)
this.performSearch(this._inputElement.value);}
performSearch(searchQuery)
{this.contentTreeOutline.removeChildren();this.contentBrowser.contentViewContainer.closeAllContentViews();this._inputElement.value=searchQuery;this._searchQuerySetting.value=searchQuery;this.hideEmptyContentPlaceholder();this.element.classList.remove("changed");if(this._changedBanner)
this._changedBanner.remove();searchQuery=searchQuery.trim();if(!searchQuery.length)
return;var isCaseSensitive=false;var isRegex=false;var updateEmptyContentPlaceholderTimeout=null;function createTreeElementForMatchObject(matchObject,parentTreeElement)
{let matchTreeElement=new WebInspector.SearchResultTreeElement(matchObject);matchTreeElement.addEventListener(WebInspector.TreeElement.Event.DoubleClick,this._treeElementDoubleClick,this);parentTreeElement.appendChild(matchTreeElement);if(!this.contentTreeOutline.selectedTreeElement)
matchTreeElement.revealAndSelect(false,true);}
function updateEmptyContentPlaceholderSoon()
{if(updateEmptyContentPlaceholderTimeout)
return;updateEmptyContentPlaceholderTimeout=setTimeout(updateEmptyContentPlaceholder.bind(this),100);}
function updateEmptyContentPlaceholder()
{if(updateEmptyContentPlaceholderTimeout){clearTimeout(updateEmptyContentPlaceholderTimeout);updateEmptyContentPlaceholderTimeout=null;}
this.updateEmptyContentPlaceholder(WebInspector.UIString("No Search Results"));}
function forEachMatch(searchQuery,lineContent,callback)
{var lineMatch;var searchRegex=new RegExp(searchQuery.escapeForRegExp(),"gi");while((searchRegex.lastIndex<lineContent.length)&&(lineMatch=searchRegex.exec(lineContent)))
callback(lineMatch,searchRegex.lastIndex);}
function resourcesCallback(error,result)
{updateEmptyContentPlaceholderSoon.call(this);if(error)
return;function resourceCallback(frameId,url,error,resourceMatches)
{updateEmptyContentPlaceholderSoon.call(this);if(error||!resourceMatches||!resourceMatches.length)
return;var frame=WebInspector.frameResourceManager.frameForIdentifier(frameId);if(!frame)
return;var resource=frame.url===url?frame.mainResource:frame.resourceForURL(url);if(!resource)
return;var resourceTreeElement=this._searchTreeElementForResource(resource);for(var i=0;i<resourceMatches.length;++i){var match=resourceMatches[i];forEachMatch(searchQuery,match.lineContent,(lineMatch,lastIndex)=>{var matchObject=new WebInspector.SourceCodeSearchMatchObject(resource,match.lineContent,searchQuery,new WebInspector.TextRange(match.lineNumber,lineMatch.index,match.lineNumber,lastIndex));createTreeElementForMatchObject.call(this,matchObject,resourceTreeElement);});}
updateEmptyContentPlaceholder.call(this);}
for(var i=0;i<result.length;++i){var searchResult=result[i];if(!searchResult.url||!searchResult.frameId)
continue;PageAgent.searchInResource(searchResult.frameId,searchResult.url,searchQuery,isCaseSensitive,isRegex,searchResult.requestId,resourceCallback.bind(this,searchResult.frameId,searchResult.url));}
let promises=[WebInspector.Frame.awaitEvent(WebInspector.Frame.Event.ResourceWasAdded),WebInspector.Target.awaitEvent(WebInspector.Target.Event.ResourceAdded)];Promise.race(promises).then(this._contentChanged.bind(this));}
function searchScripts(scriptsToSearch)
{updateEmptyContentPlaceholderSoon.call(this);if(!scriptsToSearch.length)
return;function scriptCallback(script,error,scriptMatches)
{updateEmptyContentPlaceholderSoon.call(this);if(error||!scriptMatches||!scriptMatches.length)
return;var scriptTreeElement=this._searchTreeElementForScript(script);for(var i=0;i<scriptMatches.length;++i){var match=scriptMatches[i];forEachMatch(searchQuery,match.lineContent,(lineMatch,lastIndex)=>{var matchObject=new WebInspector.SourceCodeSearchMatchObject(script,match.lineContent,searchQuery,new WebInspector.TextRange(match.lineNumber,lineMatch.index,match.lineNumber,lastIndex));createTreeElementForMatchObject.call(this,matchObject,scriptTreeElement);});}
updateEmptyContentPlaceholder.call(this);}
for(let script of scriptsToSearch)
script.target.DebuggerAgent.searchInContent(script.id,searchQuery,isCaseSensitive,isRegex,scriptCallback.bind(this,script));}
function domCallback(error,searchId,resultsCount)
{updateEmptyContentPlaceholderSoon.call(this);if(error||!resultsCount)
return;this._domSearchIdentifier=searchId;function domSearchResults(error,nodeIds)
{updateEmptyContentPlaceholderSoon.call(this);if(error)
return;for(var i=0;i<nodeIds.length;++i){if(this._domSearchIdentifier!==searchId)
return;var domNode=WebInspector.domTreeManager.nodeForId(nodeIds[i]);if(!domNode||!domNode.ownerDocument)
continue;if(domNode.nodeType()===Node.DOCUMENT_NODE)
continue;var resource=WebInspector.frameResourceManager.resourceForURL(domNode.ownerDocument.documentURL);if(!resource)
continue;var resourceTreeElement=this._searchTreeElementForResource(resource);var domNodeTitle=WebInspector.DOMSearchMatchObject.titleForDOMNode(domNode);var didFindTextualMatch=false;forEachMatch(searchQuery,domNodeTitle,(lineMatch,lastIndex)=>{var matchObject=new WebInspector.DOMSearchMatchObject(resource,domNode,domNodeTitle,searchQuery,new WebInspector.TextRange(0,lineMatch.index,0,lastIndex));createTreeElementForMatchObject.call(this,matchObject,resourceTreeElement);didFindTextualMatch=true;});if(!didFindTextualMatch){var matchObject=new WebInspector.DOMSearchMatchObject(resource,domNode,domNodeTitle,domNodeTitle,new WebInspector.TextRange(0,0,0,domNodeTitle.length));createTreeElementForMatchObject.call(this,matchObject,resourceTreeElement);}
updateEmptyContentPlaceholder.call(this);}}
DOMAgent.getSearchResults(searchId,0,resultsCount,domSearchResults.bind(this));}
if(window.DOMAgent)
WebInspector.domTreeManager.ensureDocument();if(window.PageAgent)
PageAgent.searchInResources(searchQuery,isCaseSensitive,isRegex,resourcesCallback.bind(this));setTimeout(searchScripts.bind(this,WebInspector.debuggerManager.searchableScripts),0);if(window.DOMAgent){if(this._domSearchIdentifier){DOMAgent.discardSearchResults(this._domSearchIdentifier);this._domSearchIdentifier=undefined;}
DOMAgent.performSearch(searchQuery,domCallback.bind(this));}
if(!window.DOMAgent&&!window.PageAgent)
updateEmptyContentPlaceholderSoon.call(this);}
_searchFieldChanged(event)
{this.performSearch(event.target.value);}
_searchFieldInput(event)
{if(!event.target.value.length)
this.performSearch("");}
_searchTreeElementForResource(resource)
{var resourceTreeElement=this.contentTreeOutline.getCachedTreeElement(resource);if(!resourceTreeElement){resourceTreeElement=new WebInspector.ResourceTreeElement(resource);resourceTreeElement.hasChildren=true;resourceTreeElement.expand();this.contentTreeOutline.appendChild(resourceTreeElement);}
return resourceTreeElement;}
_searchTreeElementForScript(script)
{var scriptTreeElement=this.contentTreeOutline.getCachedTreeElement(script);if(!scriptTreeElement){scriptTreeElement=new WebInspector.ScriptTreeElement(script);scriptTreeElement.hasChildren=true;scriptTreeElement.expand();this.contentTreeOutline.appendChild(scriptTreeElement);}
return scriptTreeElement;}
_mainResourceDidChange(event)
{if(!event.target.isMainFrame())
return;if(this._delayedSearchTimeout){clearTimeout(this._delayedSearchTimeout);this._delayedSearchTimeout=undefined;}
this.contentTreeOutline.removeChildren();this.contentBrowser.contentViewContainer.closeAllContentViews();if(this.visible){const performSearch=true;this.focusSearchField(performSearch);}}
_treeSelectionDidChange(event)
{if(!this.visible)
return;let treeElement=event.data.selectedElement;if(!treeElement||treeElement instanceof WebInspector.FolderTreeElement)
return;const options={ignoreNetworkTab:true,};if(treeElement instanceof WebInspector.ResourceTreeElement||treeElement instanceof WebInspector.ScriptTreeElement){const cookie=null;WebInspector.showRepresentedObject(treeElement.representedObject,cookie,options);return;}
if(!(treeElement instanceof WebInspector.SearchResultTreeElement))
return;if(treeElement.representedObject instanceof WebInspector.DOMSearchMatchObject)
WebInspector.showMainFrameDOMTree(treeElement.representedObject.domNode);else if(treeElement.representedObject instanceof WebInspector.SourceCodeSearchMatchObject)
WebInspector.showOriginalOrFormattedSourceCodeTextRange(treeElement.representedObject.sourceCodeTextRange,options);}
_treeElementDoubleClick(event)
{let treeElement=event.target;if(!treeElement)
return;if(treeElement.representedObject instanceof WebInspector.DOMSearchMatchObject){WebInspector.showMainFrameDOMTree(treeElement.representedObject.domNode,{ignoreSearchTab:true,});}else if(treeElement.representedObject instanceof WebInspector.SourceCodeSearchMatchObject){WebInspector.showOriginalOrFormattedSourceCodeTextRange(treeElement.representedObject.sourceCodeTextRange,{ignoreNetworkTab:true,ignoreSearchTab:true,});}}
_contentChanged(event)
{this.element.classList.add("changed");if(!this._changedBanner){this._changedBanner=document.createElement("div");this._changedBanner.classList.add("banner");this._changedBanner.append(WebInspector.UIString("The page's content has changed"),document.createElement("br"));let performSearchLink=this._changedBanner.appendChild(document.createElement("a"));performSearchLink.textContent=WebInspector.UIString("Search Again");performSearchLink.addEventListener("click",()=>{const performSearch=true;this.focusSearchField(performSearch);});}
this.element.appendChild(this._changedBanner);}};WebInspector.Sidebar=class Sidebar extends WebInspector.View
{constructor(element,side,sidebarPanels,role,label,hasNavigationBar)
{super(element);this._side=side||WebInspector.Sidebar.Sides.Left;this._collapsed=true;this.element.classList.add("sidebar",this._side,WebInspector.Sidebar.CollapsedStyleClassName);this.element.setAttribute("role",role||"group");if(label)
this.element.setAttribute("aria-label",label);if(hasNavigationBar){this.element.classList.add("has-navigation-bar");this._navigationBar=new WebInspector.NavigationBar(null,null,"tablist");this._navigationBar.addEventListener(WebInspector.NavigationBar.Event.NavigationItemSelected,this._navigationItemSelected,this);this.addSubview(this._navigationBar);}
this._resizer=new WebInspector.Resizer(WebInspector.Resizer.RuleOrientation.Vertical,this);this.element.insertBefore(this._resizer.element,this.element.firstChild);this._sidebarPanels=[];if(sidebarPanels){for(let sidebarPanel of sidebarPanels)
this.addSidebarPanel(sidebarPanel);}}
addSidebarPanel(sidebarPanel)
{this.insertSidebarPanel(sidebarPanel,this._sidebarPanels.length);}
insertSidebarPanel(sidebarPanel,index)
{if(!(sidebarPanel instanceof WebInspector.SidebarPanel))
return;if(sidebarPanel.parentSidebar)
return;this._sidebarPanels.splice(index,0,sidebarPanel);let referenceView=this._sidebarPanels[index+1]||null;this.insertSubviewBefore(sidebarPanel,referenceView);if(this._navigationBar){this._navigationBar.insertNavigationItem(sidebarPanel.navigationItem,index);}
sidebarPanel.added();}
removeSidebarPanel(sidebarPanelOrIdentifierOrIndex)
{var sidebarPanel=this.findSidebarPanel(sidebarPanelOrIdentifierOrIndex);if(!sidebarPanel)
return;sidebarPanel.selected=false;if(sidebarPanel.visible){sidebarPanel.hidden();sidebarPanel.visibilityDidChange();}
if(this._selectedSidebarPanel===sidebarPanel){var index=this._sidebarPanels.indexOf(sidebarPanel);this.selectedSidebarPanel=this._sidebarPanels[index-1]||this._sidebarPanels[index+1]||null;}
this._sidebarPanels.remove(sidebarPanel);this.removeSubview(sidebarPanel);if(this._navigationBar){this._navigationBar.removeNavigationItem(sidebarPanel.navigationItem);}
sidebarPanel.removed();}
get selectedSidebarPanel()
{return this._selectedSidebarPanel||null;}
set selectedSidebarPanel(sidebarPanelOrIdentifierOrIndex)
{var sidebarPanel=this.findSidebarPanel(sidebarPanelOrIdentifierOrIndex);if(this._selectedSidebarPanel===sidebarPanel)
return;if(this._selectedSidebarPanel){var wasVisible=this._selectedSidebarPanel.visible;this._selectedSidebarPanel.selected=false;if(wasVisible){this._selectedSidebarPanel.hidden();this._selectedSidebarPanel.visibilityDidChange();}}
this._selectedSidebarPanel=sidebarPanel||null;if(this._navigationBar)
this._navigationBar.selectedNavigationItem=sidebarPanel?sidebarPanel.navigationItem:null;if(this._selectedSidebarPanel){this._selectedSidebarPanel.selected=true;if(this._selectedSidebarPanel.visible){this._selectedSidebarPanel.shown();this._selectedSidebarPanel.visibilityDidChange();}}
this.dispatchEventToListeners(WebInspector.Sidebar.Event.SidebarPanelSelected);}
get minimumWidth()
{if(this._navigationBar)
return Math.max(WebInspector.Sidebar.AbsoluteMinimumWidth,this._navigationBar.minimumWidth);if(this._selectedSidebarPanel)
return Math.max(WebInspector.Sidebar.AbsoluteMinimumWidth,this._selectedSidebarPanel.minimumWidth);return WebInspector.Sidebar.AbsoluteMinimumWidth;}
get maximumWidth()
{
return Math.round(window.innerWidth/3);}
get width()
{return this.element.offsetWidth;}
set width(newWidth)
{if(newWidth===this.width)
return;this._recalculateWidth(newWidth);}
get collapsed()
{return this._collapsed;}
set collapsed(flag)
{if(flag===this._collapsed)
return;this._collapsed=flag||false;this.element.classList.toggle(WebInspector.Sidebar.CollapsedStyleClassName);if(!this._collapsed&&this._navigationBar)
this._navigationBar.needsLayout();if(this._selectedSidebarPanel){if(this._selectedSidebarPanel.visible)
this._selectedSidebarPanel.shown();else
this._selectedSidebarPanel.hidden();this._selectedSidebarPanel.visibilityDidChange();}
this.dispatchEventToListeners(WebInspector.Sidebar.Event.CollapsedStateDidChange);this.dispatchEventToListeners(WebInspector.Sidebar.Event.WidthDidChange);}
get sidebarPanels()
{return this._sidebarPanels;}
get side()
{return this._side;}
findSidebarPanel(sidebarPanelOrIdentifierOrIndex)
{var sidebarPanel=null;if(sidebarPanelOrIdentifierOrIndex instanceof WebInspector.SidebarPanel){if(this._sidebarPanels.includes(sidebarPanelOrIdentifierOrIndex))
sidebarPanel=sidebarPanelOrIdentifierOrIndex;}else if(typeof sidebarPanelOrIdentifierOrIndex==="number"){sidebarPanel=this._sidebarPanels[sidebarPanelOrIdentifierOrIndex];}else if(typeof sidebarPanelOrIdentifierOrIndex==="string"){for(var i=0;i<this._sidebarPanels.length;++i){if(this._sidebarPanels[i].identifier===sidebarPanelOrIdentifierOrIndex){sidebarPanel=this._sidebarPanels[i];break;}}}
return sidebarPanel;}
resizerDragStarted(resizer)
{this._widthBeforeResize=this.width;}
resizerDragging(resizer,positionDelta)
{if(this._side===WebInspector.Sidebar.Sides.Left)
positionDelta*=-1;if(WebInspector.resolvedLayoutDirection()===WebInspector.LayoutDirection.RTL)
positionDelta*=-1;var newWidth=positionDelta+this._widthBeforeResize;this.width=newWidth;this.collapsed=(newWidth<(this.minimumWidth/2));}
resizerDragEnded(resizer)
{if(this._widthBeforeResize===this.width)
return;if(!this.collapsed&&this._navigationBar)
this._navigationBar.sizeDidChange();if(!this.collapsed&&this._selectedSidebarPanel)
this._selectedSidebarPanel.sizeDidChange();}
_recalculateWidth(newWidth=this.width)
{newWidth=Math.ceil(Number.constrain(newWidth,this.minimumWidth+1,this.maximumWidth));this.element.style.width=`${newWidth}px`;if(this.collapsed)
return;if(this._navigationBar)
this._navigationBar.updateLayoutIfNeeded(WebInspector.View.LayoutReason.Resize);if(this._selectedSidebarPanel)
this._selectedSidebarPanel.updateLayoutIfNeeded(WebInspector.View.LayoutReason.Resize);this.dispatchEventToListeners(WebInspector.Sidebar.Event.WidthDidChange,{newWidth});}
_navigationItemSelected(event)
{this.selectedSidebarPanel=event.target.selectedNavigationItem?event.target.selectedNavigationItem.identifier:null;}};WebInspector.Sidebar.CollapsedStyleClassName="collapsed";WebInspector.Sidebar.AbsoluteMinimumWidth=200;WebInspector.Sidebar.Sides={Right:"right",Left:"left"};WebInspector.Sidebar.Event={SidebarPanelSelected:"sidebar-panel-selected",CollapsedStateDidChange:"sidebar-collapsed-state-did-change",WidthDidChange:"sidebar-width-did-change",};WebInspector.Slider=class Slider extends WebInspector.Object
{constructor()
{super();this._element=document.createElement("div");this._element.className="slider";this._knob=this._element.appendChild(document.createElement("img"));this._value=0;this._knobX=0;this._maxX=0;this._element.addEventListener("mousedown",this);}
get element()
{return this._element;}
get value()
{return this._value;}
set value(value)
{value=Math.max(Math.min(value,1),0);if(value===this._value)
return;this.knobX=value;if(this.delegate&&typeof this.delegate.sliderValueDidChange==="function")
this.delegate.sliderValueDidChange(this,value);}
set knobX(value)
{this._value=value;this._knobX=Math.round(value*this.maxX);this._knob.style.webkitTransform="translate3d("+this._knobX+"px, 0, 0)";}
get maxX()
{if(this._maxX<=0&&document.body.contains(this._element))
this._maxX=Math.max(this._element.offsetWidth-Math.ceil(WebInspector.Slider.KnobWidth/2),0);return this._maxX;}
recalculateKnobX()
{this._maxX=0;this.knobX=this._value;}
handleEvent(event)
{switch(event.type){case"mousedown":this._handleMousedown(event);break;case"mousemove":this._handleMousemove(event);break;case"mouseup":this._handleMouseup(event);break;}}
_handleMousedown(event)
{if(event.target!==this._knob)
this.value=(this._localPointForEvent(event).x-3)/this.maxX;this._startKnobX=this._knobX;this._startMouseX=this._localPointForEvent(event).x;this._element.classList.add("dragging");window.addEventListener("mousemove",this,true);window.addEventListener("mouseup",this,true);}
_handleMousemove(event)
{var dx=this._localPointForEvent(event).x-this._startMouseX;var x=Math.max(Math.min(this._startKnobX+dx,this.maxX),0);this.value=x/this.maxX;}
_handleMouseup(event)
{this._element.classList.remove("dragging");window.removeEventListener("mousemove",this,true);window.removeEventListener("mouseup",this,true);}
_localPointForEvent(event)
{
return window.webkitConvertPointFromPageToNode(this._element,new WebKitPoint(event.pageX,event.pageY));}};WebInspector.Slider.KnobWidth=13;WebInspector.SoftContextMenu=class SoftContextMenu
{constructor(items,parentMenu)
{this._items=items;this._parentMenu=parentMenu;}
show(event)
{const isSubMenu=!!this._parentMenu;this._contextMenuElement=document.createElement("div");this._contextMenuElement.className="soft-context-menu";this._contextMenuElement.style.left=event.pageX+"px";this._contextMenuElement.style.top=event.pageY+"px";this._contextMenuElement.tabIndex=0;this._contextMenuElement.addEventListener("keydown",this._menuKeyDown.bind(this),false);for(let item of this._items)
this._contextMenuElement.appendChild(this._createMenuItem(item));if(!isSubMenu){this._glassPaneElement=document.createElement("div");this._glassPaneElement.className="soft-context-menu-glass-pane";this._glassPaneElement.addEventListener("mousedown",this._glassPaneMouseDown.bind(this),false);this._glassPaneElement.appendChild(this._contextMenuElement);document.body.appendChild(this._glassPaneElement);this._focus();this._consumeEvent(event,true);}else
this._parentGlassPaneElement().appendChild(this._contextMenuElement);this._repositionMenuOnScreen(isSubMenu);}
_consumeEvent(event,preventDefault)
{event.stopImmediatePropagation();if(preventDefault)
event.preventDefault();event.handled=true;}
_parentGlassPaneElement()
{if(!this._parentMenu)
return null;if(this._parentMenu._glassPaneElement)
return this._parentMenu._glassPaneElement;return this._parentMenu._parentGlassPaneElement();}
_createMenuItem(item)
{if(item.type==="separator")
return this._createSeparator();const checkmark="\u2713";const blackRightPointingTriangle="\u25b6";const menuItemElement=document.createElement("div");menuItemElement.className="item";if(!item.enabled)
menuItemElement.classList.add("disabled");const checkMarkElement=document.createElement("span");checkMarkElement.textContent=item.checked?checkmark:"";checkMarkElement.className="checkmark";menuItemElement.appendChild(checkMarkElement);const labelElement=document.createElement("span");labelElement.textContent=item.label;labelElement.className="label";menuItemElement.appendChild(labelElement);if(item.type==="subMenu"){const subMenuArrowElement=document.createElement("span");subMenuArrowElement.textContent=blackRightPointingTriangle;subMenuArrowElement.className="submenu-arrow";menuItemElement.appendChild(subMenuArrowElement);menuItemElement._subItems=item.subItems;}else
menuItemElement._actionId=item.id;menuItemElement.addEventListener("contextmenu",this._menuItemContextMenu.bind(this),false);menuItemElement.addEventListener("mousedown",this._menuItemMouseDown.bind(this),false);menuItemElement.addEventListener("mouseup",this._menuItemMouseUp.bind(this),false);menuItemElement.addEventListener("mouseover",this._menuItemMouseOver.bind(this),false);menuItemElement.addEventListener("mouseout",this._menuItemMouseOut.bind(this),false);return menuItemElement;}
_createSeparator()
{const separatorElement=document.createElement("div");separatorElement.className="separator";separatorElement._isSeparator=true;separatorElement.createChild("div","line");separatorElement.addEventListener("contextmenu",this._menuItemContextMenu.bind(this),false);separatorElement.addEventListener("mousedown",this._menuItemMouseDown.bind(this),false);separatorElement.addEventListener("mouseup",this._menuItemMouseUp.bind(this),false);separatorElement.addEventListener("mouseover",this._menuItemMouseOver.bind(this),false);return separatorElement;}
_repositionMenuOnScreen(isSubMenu)
{if(this._contextMenuElement.offsetLeft+this._contextMenuElement.offsetWidth>document.body.offsetWidth){if(isSubMenu){const parentContextMenuElement=this._parentMenu._contextMenuElement;const leftOfParent=parentContextMenuElement.offsetLeft-this._contextMenuElement.offsetWidth+2;const fromParentRight=this._contextMenuElement.offsetLeft-this._contextMenuElement.offsetWidth+2;this._contextMenuElement.style.left=(leftOfParent>=0?leftOfParent:fromParentRight)+"px";}else{const leftOfCursor=this._contextMenuElement.offsetLeft-this._contextMenuElement.offsetWidth;const fromRightEdge=document.body.offsetWidth-this._contextMenuElement.offsetWidth;this._contextMenuElement.style.left=(leftOfCursor>=0?leftOfCursor:fromRightEdge)+"px";}}
if(this._contextMenuElement.offsetTop+this._contextMenuElement.offsetHeight>document.body.offsetHeight){const aboveCursor=this._contextMenuElement.offsetTop-this._contextMenuElement.offsetHeight;const fromBottomEdge=document.body.offsetHeight-this._contextMenuElement.offsetHeight;this._contextMenuElement.style.top=(!isSubMenu&&aboveCursor>=0?aboveCursor:fromBottomEdge)+"px";}}
_showSubMenu(menuItemElement)
{if(menuItemElement._subMenuTimer){clearTimeout(menuItemElement._subMenuTimer);menuItemElement._subMenuTimer=0;}
if(this._subMenu)
return;this._subMenu=new WebInspector.SoftContextMenu(menuItemElement._subItems,this);this._subMenu.show({pageX:this._contextMenuElement.offsetLeft+menuItemElement.offsetWidth,pageY:this._contextMenuElement.offsetTop+menuItemElement.offsetTop-4});}
_hideSubMenu()
{if(!this._subMenu)
return;this._subMenu._discardSubMenus();this._focus();}
_menuItemContextMenu(event)
{this._consumeEvent(event,true);}
_menuItemMouseDown(event)
{this._consumeEvent(event,true);}
_menuItemMouseUp(event)
{this._triggerAction(event.target,event);this._consumeEvent(event);}
_menuItemMouseOver(event)
{this._highlightMenuItem(event.target._isSeparator?null:event.target);}
_menuItemMouseOut(event)
{const shouldUnhighlight=!this._subMenu||!event.relatedTarget||this._contextMenuElement.isSelfOrAncestor(event.relatedTarget)||event.relatedTarget.classList.contains("soft-context-menu-glass-pane");if(shouldUnhighlight)
this._highlightMenuItem(null);}
_menuKeyDown(event)
{switch(event.keyIdentifier){case"Up":this._highlightPrevious();break;case"Down":this._highlightNext();break;case"Left":if(this._parentMenu){this._highlightMenuItem(null);this._parentMenu._hideSubMenu();}
break;case"Enter":if(!isEnterKey(event))
break; case"U+0020": if(this._highlightedMenuItemElement&&!this._highlightedMenuItemElement._subItems)
this._triggerAction(this._highlightedMenuItemElement,event); case"Right":if(this._highlightedMenuItemElement&&this._highlightedMenuItemElement._subItems){this._showSubMenu(this._highlightedMenuItemElement);this._subMenu._focus();this._subMenu._highlightNext();}
break;case"U+001B": this._discardMenu(true,event);break;}
this._consumeEvent(event,true);}
_glassPaneMouseDown(event)
{this._discardMenu(true,event);this._consumeEvent(event);}
_focus()
{this._contextMenuElement.focus();}
_triggerAction(menuItemElement,event)
{if(!menuItemElement._subItems){this._discardMenu(true,event);if(typeof menuItemElement._actionId==="number"){WebInspector.ContextMenu.contextMenuItemSelected(menuItemElement._actionId);menuItemElement._actionId=null;}
return;}
this._showSubMenu(menuItemElement);this._consumeEvent(event);}
_highlightMenuItem(menuItemElement,skipSubMenuExpansion)
{if(this._highlightedMenuItemElement===menuItemElement)
return;this._hideSubMenu();if(this._highlightedMenuItemElement){this._highlightedMenuItemElement.classList.remove("highlighted");if(this._highlightedMenuItemElement._subItems&&this._highlightedMenuItemElement._subMenuTimer){clearTimeout(this._highlightedMenuItemElement._subMenuTimer);this._highlightedMenuItemElement._subMenuTimer=0;}}
this._highlightedMenuItemElement=menuItemElement;if(this._highlightedMenuItemElement){this._highlightedMenuItemElement.classList.add("highlighted");this._contextMenuElement.focus();if(!skipSubMenuExpansion&&this._highlightedMenuItemElement._subItems&&!this._highlightedMenuItemElement._subMenuTimer)
this._highlightedMenuItemElement._subMenuTimer=setTimeout(this._showSubMenu.bind(this,this._highlightedMenuItemElement),150);}}
_highlightPrevious()
{let menuItemElement=this._highlightedMenuItemElement?this._highlightedMenuItemElement.previousSibling:this._contextMenuElement.lastChild;while(menuItemElement&&menuItemElement._isSeparator)
menuItemElement=menuItemElement.previousSibling;if(menuItemElement)
this._highlightMenuItem(menuItemElement,true);}
_highlightNext()
{let menuItemElement=this._highlightedMenuItemElement?this._highlightedMenuItemElement.nextSibling:this._contextMenuElement.firstChild;while(menuItemElement&&menuItemElement._isSeparator)
menuItemElement=menuItemElement.nextSibling;if(menuItemElement)
this._highlightMenuItem(menuItemElement,true);}
_discardMenu(closeParentMenus,event)
{if(this._subMenu&&!closeParentMenus)
return;if(this._glassPaneElement){const glassPane=this._glassPaneElement;this._glassPaneElement=null;document.body.removeChild(glassPane);if(this._parentMenu){this._parentMenu._subMenu=null;if(closeParentMenus)
this._parentMenu._discardMenu(closeParentMenus,event);}
if(event)
this._consumeEvent(event,true);}else if(this._parentMenu&&this._contextMenuElement.parentElement){this._discardSubMenus();if(closeParentMenus)
this._parentMenu._discardMenu(closeParentMenus,event);if(event)
this._consumeEvent(event,true);}}
_discardSubMenus()
{if(this._subMenu)
this._subMenu._discardSubMenus();if(this._contextMenuElement.parentElement)
this._contextMenuElement.parentElement.removeChild(this._contextMenuElement);if(this._parentMenu)
this._parentMenu._subMenu=null;}};WebInspector.SourceCodeTextEditor=class SourceCodeTextEditor extends WebInspector.TextEditor
{constructor(sourceCode)
{super();this.delegate=this;this._sourceCode=sourceCode;this._breakpointMap={};this._issuesLineNumberMap=new Map;this._widgetMap=new Map;this._contentPopulated=false;this._invalidLineNumbers={0:true};this._requestingScriptContent=false;this._activeCallFrameSourceCodeLocation=null;this._threadLineNumberMap=new Map;this._threadWidgetMap=new Map; this._threadTargetMap=new Map; this._typeTokenScrollHandler=null;this._typeTokenAnnotator=null;this._basicBlockAnnotator=null;this._editingController=null;this._autoFormat=false;this._isProbablyMinified=false;this._ignoreContentDidChange=0;this._ignoreLocationUpdateBreakpoint=null;this._ignoreBreakpointAddedBreakpoint=null;this._ignoreBreakpointRemovedBreakpoint=null;this._ignoreAllBreakpointLocationUpdates=false;this._updateTokenTrackingControllerState();this.element.classList.add("source-code");if(this._supportsDebugging){WebInspector.Breakpoint.addEventListener(WebInspector.Breakpoint.Event.DisabledStateDidChange,this._breakpointStatusDidChange,this);WebInspector.Breakpoint.addEventListener(WebInspector.Breakpoint.Event.AutoContinueDidChange,this._breakpointStatusDidChange,this);WebInspector.Breakpoint.addEventListener(WebInspector.Breakpoint.Event.ResolvedStateDidChange,this._breakpointStatusDidChange,this);WebInspector.Breakpoint.addEventListener(WebInspector.Breakpoint.Event.LocationDidChange,this._updateBreakpointLocation,this);WebInspector.targetManager.addEventListener(WebInspector.TargetManager.Event.TargetAdded,this._targetAdded,this);WebInspector.targetManager.addEventListener(WebInspector.TargetManager.Event.TargetRemoved,this._targetRemoved,this);WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.BreakpointsEnabledDidChange,this._breakpointsEnabledDidChange,this);WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.BreakpointAdded,this._breakpointAdded,this);WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.BreakpointRemoved,this._breakpointRemoved,this);WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.CallFramesDidChange,this._callFramesDidChange,this);WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ActiveCallFrameDidChange,this._activeCallFrameDidChange,this);WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.Paused,this._debuggerDidPause,this);WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.Resumed,this._debuggerDidResume,this);if(WebInspector.debuggerManager.activeCallFrame)
this._debuggerDidPause();this._activeCallFrameDidChange();}
WebInspector.issueManager.addEventListener(WebInspector.IssueManager.Event.IssueWasAdded,this._issueWasAdded,this);if(this._sourceCode instanceof WebInspector.SourceMapResource||this._sourceCode.sourceMaps.length>0)
WebInspector.notifications.addEventListener(WebInspector.Notification.GlobalModifierKeysDidChange,this._updateTokenTrackingControllerState,this);else
this._sourceCode.addEventListener(WebInspector.SourceCode.Event.SourceMapAdded,this._sourceCodeSourceMapAdded,this);sourceCode.requestContent().then(this._contentAvailable.bind(this));new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.Control,"G",this.showGoToLineDialog.bind(this),this.element);WebInspector.logManager.addEventListener(WebInspector.LogManager.Event.Cleared,this._logCleared,this);}
get sourceCode()
{return this._sourceCode;}
get target()
{if(this._sourceCode instanceof WebInspector.SourceMapResource){if(this._sourceCode.sourceMap.originalSourceCode instanceof WebInspector.Script)
return this._sourceCode.sourceMap.originalSourceCode.target;}
if(this._sourceCode instanceof WebInspector.Script)
return this._sourceCode.target;return WebInspector.mainTarget;}
shown()
{super.shown();if(WebInspector.showJavaScriptTypeInformationSetting.value){if(this._typeTokenAnnotator)
this._typeTokenAnnotator.resume();if(!this._typeTokenScrollHandler&&this._typeTokenAnnotator)
this._enableScrollEventsForTypeTokenAnnotator();}else{if(this._typeTokenAnnotator)
this._setTypeTokenAnnotatorEnabledState(false);}
if(WebInspector.enableControlFlowProfilerSetting.value){if(this._basicBlockAnnotator)
this._basicBlockAnnotator.resume();if(!this._controlFlowScrollHandler&&this._basicBlockAnnotator)
this._enableScrollEventsForControlFlowAnnotator();}else{this._basicBlockAnnotatorEnabled=false;}}
hidden()
{super.hidden();this.tokenTrackingController.removeHighlightedRange();this._dismissPopover();this._dismissEditingController(true);if(this._typeTokenAnnotator)
this._typeTokenAnnotator.pause();if(this._basicBlockAnnotator)
this._basicBlockAnnotator.pause();}
close()
{super.close();if(this._supportsDebugging){WebInspector.Breakpoint.removeEventListener(null,null,this);WebInspector.debuggerManager.removeEventListener(null,null,this);WebInspector.targetManager.removeEventListener(null,null,this);if(this._activeCallFrameSourceCodeLocation){this._activeCallFrameSourceCodeLocation.removeEventListener(WebInspector.SourceCodeLocation.Event.LocationChanged,this._activeCallFrameSourceCodeLocationChanged,this);this._activeCallFrameSourceCodeLocation=null;}}
WebInspector.issueManager.removeEventListener(WebInspector.IssueManager.Event.IssueWasAdded,this._issueWasAdded,this);if(this._sourceCode instanceof WebInspector.SourceMapResource||this._sourceCode.sourceMaps.length>0)
WebInspector.notifications.removeEventListener(WebInspector.Notification.GlobalModifierKeysDidChange,this._updateTokenTrackingControllerState,this);else
this._sourceCode.removeEventListener(WebInspector.SourceCode.Event.SourceMapAdded,this._sourceCodeSourceMapAdded,this);}
canBeFormatted()
{
if(this._sourceCode instanceof WebInspector.SourceMapResource)
return false;return super.canBeFormatted();}
canShowTypeAnnotations()
{return!!this._getAssociatedScript()&&!this.hasModified;}
canShowCoverageHints()
{return!!this._getAssociatedScript()&&!this.hasModified;}
customPerformSearch(query)
{function searchResultCallback(error,matches)
{if(this.currentSearchQuery!==query)
return;if(error||!matches||!matches.length){this.dispatchEventToListeners(WebInspector.TextEditor.Event.NumberOfSearchResultsDidChange);return;}
var queryRegex=new RegExp(query.escapeForRegExp(),"gi");var searchResults=[];for(var i=0;i<matches.length;++i){var matchLineNumber=matches[i].lineNumber;var line=this.line(matchLineNumber);if(!line)
return;queryRegex.lastIndex=0;var lineMatch=null;while(queryRegex.lastIndex+query.length<=line.length&&(lineMatch=queryRegex.exec(line))){var resultTextRange=new WebInspector.TextRange(matchLineNumber,lineMatch.index,matchLineNumber,queryRegex.lastIndex);searchResults.push(resultTextRange);}}
this.addSearchResults(searchResults);this.dispatchEventToListeners(WebInspector.TextEditor.Event.NumberOfSearchResultsDidChange);}
if(this.hasEdits())
return false;if(this._sourceCode instanceof WebInspector.SourceMapResource)
return false;if(this._sourceCode instanceof WebInspector.Resource)
PageAgent.searchInResource(this._sourceCode.parentFrame.id,this._sourceCode.url,query,false,false,searchResultCallback.bind(this));else if(this._sourceCode instanceof WebInspector.Script)
this._sourceCode.target.DebuggerAgent.searchInContent(this._sourceCode.id,query,false,false,searchResultCallback.bind(this));return true;}
showGoToLineDialog()
{if(!this._goToLineDialog)
this._goToLineDialog=new WebInspector.GoToLineDialog(this);this._goToLineDialog.present(this.element);}
isDialogRepresentedObjectValid(goToLineDialog,lineNumber)
{return!isNaN(lineNumber)&&lineNumber>0&&lineNumber<=this.lineCount;}
dialogWasDismissed(goToLineDialog)
{let lineNumber=goToLineDialog.representedObject;let position=new WebInspector.SourceCodePosition(lineNumber-1,0);let range=new WebInspector.TextRange(lineNumber-1,0,lineNumber,0);this.revealPosition(position,range,false,true);this.focus();}
contentDidChange(replacedRanges,newRanges)
{super.contentDidChange(replacedRanges,newRanges);if(this._ignoreContentDidChange>0)
return;for(var range of newRanges)
this._updateEditableMarkers(range);if(this._basicBlockAnnotator){this._basicBlockAnnotatorEnabled=false;this._basicBlockAnnotator=null;}
if(this._typeTokenAnnotator){this._setTypeTokenAnnotatorEnabledState(false);this._typeTokenAnnotator=null;}}
toggleTypeAnnotations()
{if(!this._typeTokenAnnotator)
return false;var newActivatedState=!this._typeTokenAnnotator.isActive();if(newActivatedState&&this._isProbablyMinified&&!this.formatted){return this.updateFormattedState(true).then(()=>{this._setTypeTokenAnnotatorEnabledState(newActivatedState);});}
this._setTypeTokenAnnotatorEnabledState(newActivatedState);return Promise.resolve();}
toggleUnexecutedCodeHighlights()
{if(!this._basicBlockAnnotator)
return false;let newActivatedState=!this._basicBlockAnnotator.isActive();if(newActivatedState&&this._isProbablyMinified&&!this.formatted){return this.updateFormattedState(true).then(()=>{this._basicBlockAnnotatorEnabled=newActivatedState;});}
this._basicBlockAnnotatorEnabled=newActivatedState;return Promise.resolve();}
showPopoverForTypes(typeDescription,bounds,title)
{var content=document.createElement("div");content.className="object expandable";var titleElement=document.createElement("div");titleElement.className="title";titleElement.textContent=title;content.appendChild(titleElement);var bodyElement=content.appendChild(document.createElement("div"));bodyElement.className="body";var typeTreeView=new WebInspector.TypeTreeView(typeDescription);bodyElement.appendChild(typeTreeView.element);this._showPopover(content,bounds);}
prettyPrint(pretty)
{
var shouldResumeBasicBlockAnnotator=this._basicBlockAnnotator&&this._basicBlockAnnotator.isActive();if(shouldResumeBasicBlockAnnotator)
this._basicBlockAnnotatorEnabled=false;let shouldResumeTypeTokenAnnotator=this._typeTokenAnnotator&&this._typeTokenAnnotator.isActive();if(shouldResumeTypeTokenAnnotator)
this._setTypeTokenAnnotatorEnabledState(false);return super.prettyPrint(pretty).then(()=>{if(pretty||!this._isProbablyMinified){if(shouldResumeBasicBlockAnnotator)
this._basicBlockAnnotatorEnabled=true;if(shouldResumeTypeTokenAnnotator)
this._setTypeTokenAnnotatorEnabledState(true);}else{if(this._basicBlockAnnotator)
this._basicBlockAnnotatorEnabled=false;this._setTypeTokenAnnotatorEnabledState(false);}});}
_unformattedLineInfoForEditorLineInfo(lineInfo)
{if(this.formatterSourceMap)
return this.formatterSourceMap.formattedToOriginal(lineInfo.lineNumber,lineInfo.columnNumber);return lineInfo;}
_sourceCodeLocationForEditorPosition(position)
{var lineInfo={lineNumber:position.line,columnNumber:position.ch};var unformattedLineInfo=this._unformattedLineInfoForEditorLineInfo(lineInfo);return this.sourceCode.createSourceCodeLocation(unformattedLineInfo.lineNumber,unformattedLineInfo.columnNumber);}
_editorLineInfoForSourceCodeLocation(sourceCodeLocation)
{if(this._sourceCode instanceof WebInspector.SourceMapResource)
return{lineNumber:sourceCodeLocation.displayLineNumber,columnNumber:sourceCodeLocation.displayColumnNumber};return{lineNumber:sourceCodeLocation.formattedLineNumber,columnNumber:sourceCodeLocation.formattedColumnNumber};}
_breakpointForEditorLineInfo(lineInfo)
{if(!this._breakpointMap[lineInfo.lineNumber])
return null;return this._breakpointMap[lineInfo.lineNumber][lineInfo.columnNumber];}
_addBreakpointWithEditorLineInfo(breakpoint,lineInfo)
{if(!this._breakpointMap[lineInfo.lineNumber])
this._breakpointMap[lineInfo.lineNumber]={};this._breakpointMap[lineInfo.lineNumber][lineInfo.columnNumber]=breakpoint;}
_removeBreakpointWithEditorLineInfo(breakpoint,lineInfo)
{delete this._breakpointMap[lineInfo.lineNumber][lineInfo.columnNumber];if(isEmptyObject(this._breakpointMap[lineInfo.lineNumber]))
delete this._breakpointMap[lineInfo.lineNumber];}
_populateWithContent(content)
{content=content||"";this._prepareEditorForInitialContent(content);if(this._autoFormat){this._autoFormat=false;this.deferReveal=true;this.string=content;this.deferReveal=false;this.updateFormattedState(true).then(()=>{this._proceedPopulateWithContent(this.string);});return;}
this._proceedPopulateWithContent(content);}
_proceedPopulateWithContent(content)
{this.dispatchEventToListeners(WebInspector.SourceCodeTextEditor.Event.ContentWillPopulate);this.string=content;this._createBasicBlockAnnotator();if(WebInspector.enableControlFlowProfilerSetting.value&&this._basicBlockAnnotator)
this._basicBlockAnnotatorEnabled=true;this._createTypeTokenAnnotator();if(WebInspector.showJavaScriptTypeInformationSetting.value)
this._setTypeTokenAnnotatorEnabledState(true);this._contentDidPopulate();}
_contentDidPopulate()
{this._contentPopulated=true;this.dispatchEventToListeners(WebInspector.SourceCodeTextEditor.Event.ContentDidPopulate);
this._reinsertAllIssues();this._reinsertAllThreadIndicators();this._updateEditableMarkers();}
_prepareEditorForInitialContent(content)
{if(this._contentPopulated)
return;if(this._supportsDebugging){this._breakpointMap={};var breakpoints=WebInspector.debuggerManager.breakpointsForSourceCode(this._sourceCode);for(var i=0;i<breakpoints.length;++i){var breakpoint=breakpoints[i];var lineInfo=this._editorLineInfoForSourceCodeLocation(breakpoint.sourceCodeLocation);this._addBreakpointWithEditorLineInfo(breakpoint,lineInfo);this.setBreakpointInfoForLineAndColumn(lineInfo.lineNumber,lineInfo.columnNumber,this._breakpointInfoForBreakpoint(breakpoint));}}
if(this._sourceCode instanceof WebInspector.Resource)
this.mimeType=this._sourceCode.syntheticMIMEType;else if(this._sourceCode instanceof WebInspector.Script)
this.mimeType="text/javascript";else if(this._sourceCode instanceof WebInspector.CSSStyleSheet)
this.mimeType="text/css";if(this.canBeFormatted()&&isTextLikelyMinified(content)){this._autoFormat=true;this._isProbablyMinified=true;}}
_contentAvailable(parameters)
{if(parameters.error)
return;var sourceCode=parameters.sourceCode;var content=sourceCode.content;var base64Encoded=parameters.base64Encoded;if(this._fullContentPopulated)
return;this._fullContentPopulated=true;this._invalidLineNumbers={};this._populateWithContent(content);}
_breakpointStatusDidChange(event)
{this._updateBreakpointStatus(event.target);}
_breakpointsEnabledDidChange()
{var breakpoints=WebInspector.debuggerManager.breakpointsForSourceCode(this._sourceCode);for(var breakpoint of breakpoints)
this._updateBreakpointStatus(breakpoint);}
_updateBreakpointStatus(breakpoint)
{if(!this._contentPopulated)
return;if(!this._matchesBreakpoint(breakpoint))
return;var lineInfo=this._editorLineInfoForSourceCodeLocation(breakpoint.sourceCodeLocation);this.setBreakpointInfoForLineAndColumn(lineInfo.lineNumber,lineInfo.columnNumber,this._breakpointInfoForBreakpoint(breakpoint));}
_updateBreakpointLocation(event)
{if(!this._contentPopulated)
return;var breakpoint=event.target;if(!this._matchesBreakpoint(breakpoint))
return;if(this._ignoreAllBreakpointLocationUpdates)
return;if(breakpoint===this._ignoreLocationUpdateBreakpoint)
return;var sourceCodeLocation=breakpoint.sourceCodeLocation;if(this._sourceCode instanceof WebInspector.SourceMapResource){if(sourceCodeLocation.displaySourceCode!==this._sourceCode)
return;var oldLineInfo={lineNumber:event.data.oldDisplayLineNumber,columnNumber:event.data.oldDisplayColumnNumber};var newLineInfo={lineNumber:sourceCodeLocation.displayLineNumber,columnNumber:sourceCodeLocation.displayColumnNumber};}else{if(sourceCodeLocation.sourceCode!==this._sourceCode)
return;var oldLineInfo={lineNumber:event.data.oldFormattedLineNumber,columnNumber:event.data.oldFormattedColumnNumber};var newLineInfo={lineNumber:sourceCodeLocation.formattedLineNumber,columnNumber:sourceCodeLocation.formattedColumnNumber};}
var existingBreakpoint=this._breakpointForEditorLineInfo(oldLineInfo);if(!existingBreakpoint)
return;this.setBreakpointInfoForLineAndColumn(oldLineInfo.lineNumber,oldLineInfo.columnNumber,null);this.setBreakpointInfoForLineAndColumn(newLineInfo.lineNumber,newLineInfo.columnNumber,this._breakpointInfoForBreakpoint(breakpoint));this._removeBreakpointWithEditorLineInfo(breakpoint,oldLineInfo);this._addBreakpointWithEditorLineInfo(breakpoint,newLineInfo);}
_breakpointAdded(event)
{if(!this._contentPopulated)
return;var breakpoint=event.data.breakpoint;if(!this._matchesBreakpoint(breakpoint))
return;if(breakpoint===this._ignoreBreakpointAddedBreakpoint)
return;var lineInfo=this._editorLineInfoForSourceCodeLocation(breakpoint.sourceCodeLocation);this._addBreakpointWithEditorLineInfo(breakpoint,lineInfo);this.setBreakpointInfoForLineAndColumn(lineInfo.lineNumber,lineInfo.columnNumber,this._breakpointInfoForBreakpoint(breakpoint));}
_breakpointRemoved(event)
{if(!this._contentPopulated)
return;var breakpoint=event.data.breakpoint;if(!this._matchesBreakpoint(breakpoint))
return;if(breakpoint===this._ignoreBreakpointRemovedBreakpoint)
return;var lineInfo=this._editorLineInfoForSourceCodeLocation(breakpoint.sourceCodeLocation);this._removeBreakpointWithEditorLineInfo(breakpoint,lineInfo);this.setBreakpointInfoForLineAndColumn(lineInfo.lineNumber,lineInfo.columnNumber,null);}
_targetAdded(event)
{if(WebInspector.targets.size===2)
this._reinsertAllThreadIndicators();}
_targetRemoved(event)
{if(WebInspector.targets.size===1){this._reinsertAllThreadIndicators();return;}
let target=event.data.target;this._removeThreadIndicatorForTarget(target);}
_callFramesDidChange(event)
{if(WebInspector.targets.size===1)
return;let target=event.data.target;this._removeThreadIndicatorForTarget(target);this._addThreadIndicatorForTarget(target);}
_addThreadIndicatorForTarget(target)
{let targetData=WebInspector.debuggerManager.dataForTarget(target);let topCallFrame=targetData.callFrames[0];if(!topCallFrame)
return;let sourceCodeLocation=topCallFrame.sourceCodeLocation;if(!sourceCodeLocation)
return;if(!this._looselyMatchesSourceCodeLocation(sourceCodeLocation))
return;let lineNumberWithIndicator=sourceCodeLocation.formattedLineNumber;this._threadTargetMap.set(target,lineNumberWithIndicator);let threads=this._threadLineNumberMap.get(lineNumberWithIndicator);if(!threads){threads=[];this._threadLineNumberMap.set(lineNumberWithIndicator,threads);}
threads.push(target);let widget=this._threadIndicatorWidgetForLine(target,lineNumberWithIndicator);this._updateThreadIndicatorWidget(widget,threads);this.addStyleClassToLine(lineNumberWithIndicator,"thread-indicator");}
_removeThreadIndicatorForTarget(target)
{let lineNumberWithIndicator=this._threadTargetMap.take(target);if(lineNumberWithIndicator===undefined)
return;let threads=this._threadLineNumberMap.get(lineNumberWithIndicator);threads.remove(target);if(threads.length){let widget=this._threadWidgetMap.get(lineNumberWithIndicator);this._updateThreadIndicatorWidget(widget,threads);return;}
this._threadLineNumberMap.delete(lineNumberWithIndicator);let widget=this._threadWidgetMap.take(lineNumberWithIndicator);if(widget)
widget.clear();this.removeStyleClassFromLine(lineNumberWithIndicator,"thread-indicator");}
_threadIndicatorWidgetForLine(target,lineNumber)
{let widget=this._threadWidgetMap.get(lineNumber);if(widget)
return widget;widget=this.createWidgetForLine(lineNumber);if(!widget)
return null;let widgetElement=widget.widgetElement;widgetElement.classList.add("line-indicator-widget","thread-widget","inline");widgetElement.addEventListener("click",this._handleThreadIndicatorWidgetClick.bind(this,widget,lineNumber));this._threadWidgetMap.set(lineNumber,widget);return widget;}
_updateThreadIndicatorWidget(widget,threads)
{if(!widget)
return;let widgetElement=widget.widgetElement;widgetElement.removeChildren();widget[WebInspector.SourceCodeTextEditor.WidgetContainsMultipleThreadsSymbol]=threads.length>1;if(widgetElement.classList.contains("inline")||threads.length===1){let arrowElement=widgetElement.appendChild(document.createElement("span"));arrowElement.className="arrow";let textElement=widgetElement.appendChild(document.createElement("span"));textElement.className="text";textElement.textContent=threads.length===1?threads[0].displayName:WebInspector.UIString("%d Threads").format(threads.length);}else{for(let target of threads){let textElement=widgetElement.appendChild(document.createElement("span"));textElement.className="text";textElement.textContent=target.displayName;widgetElement.appendChild(document.createElement("br"));}}
widget.update();}
_handleThreadIndicatorWidgetClick(widget,lineNumber,event)
{if(!this._isWidgetToggleable(widget))
return;widget.widgetElement.classList.toggle("inline");let threads=this._threadLineNumberMap.get(lineNumber);this._updateThreadIndicatorWidget(widget,threads);}
_activeCallFrameDidChange()
{if(this._activeCallFrameSourceCodeLocation){this._activeCallFrameSourceCodeLocation.removeEventListener(WebInspector.SourceCodeLocation.Event.LocationChanged,this._activeCallFrameSourceCodeLocationChanged,this);this._activeCallFrameSourceCodeLocation=null;}
let activeCallFrame=WebInspector.debuggerManager.activeCallFrame;if(!activeCallFrame||!this._matchesSourceCodeLocation(activeCallFrame.sourceCodeLocation)){this.setExecutionLineAndColumn(NaN,NaN);return;}
this._dismissPopover();this._activeCallFrameSourceCodeLocation=activeCallFrame.sourceCodeLocation;this._activeCallFrameSourceCodeLocation.addEventListener(WebInspector.SourceCodeLocation.Event.LocationChanged,this._activeCallFrameSourceCodeLocationChanged,this);
let lineInfo=this._editorLineInfoForSourceCodeLocation(activeCallFrame.sourceCodeLocation);this.setExecutionLineAndColumn(lineInfo.lineNumber,lineInfo.columnNumber);if(this._fullContentPopulated||!(this._sourceCode instanceof WebInspector.Resource)||this._requestingScriptContent)
return;
if(this._sourceCode.type===WebInspector.Resource.Type.Document)
this._populateWithInlineScriptContent();else
this._populateWithScriptContent();}
_activeCallFrameSourceCodeLocationChanged(event)
{if(isNaN(this.executionLineNumber))
return;var lineInfo=this._editorLineInfoForSourceCodeLocation(this._activeCallFrameSourceCodeLocation);this.setExecutionLineAndColumn(lineInfo.lineNumber,lineInfo.columnNumber);}
_populateWithInlineScriptContent()
{var scripts=this._sourceCode.scripts;if(!scripts.length)
return;var pendingRequestCount=scripts.length;if(this._inlineScriptContentPopulated===pendingRequestCount)
return;this._inlineScriptContentPopulated=pendingRequestCount;function scriptContentAvailable(parameters)
{if(--pendingRequestCount)
return;this._requestingScriptContent=false;if(this._fullContentPopulated)
return;var scriptOpenTag="<script>";var scriptCloseTag="</script>";var content="";var lineNumber=0;var columnNumber=0;this._invalidLineNumbers={};for(var i=0;i<scripts.length;++i){for(var newLinesCount=scripts[i].range.startLine-lineNumber;newLinesCount>0;--newLinesCount){if(!columnNumber)
this._invalidLineNumbers[scripts[i].range.startLine-newLinesCount]=true;columnNumber=0;content+="\n";}
for(var spacesCount=scripts[i].range.startColumn-columnNumber-scriptOpenTag.length;spacesCount>0;--spacesCount)
content+=" ";content+=scriptOpenTag;content+=scripts[i].content;content+=scriptCloseTag;lineNumber=scripts[i].range.endLine;columnNumber=scripts[i].range.endColumn+scriptCloseTag.length;}
this._populateWithContent(content);}
this._requestingScriptContent=true;var boundScriptContentAvailable=scriptContentAvailable.bind(this);for(var i=0;i<scripts.length;++i)
scripts[i].requestContent().then(boundScriptContentAvailable);}
_populateWithScriptContent()
{var scripts=this._sourceCode.scripts;if(!scripts.length)
return;function scriptContentAvailable(parameters)
{var content=parameters.content;this._requestingScriptContent=false;if(this._fullContentPopulated)
return;this._fullContentPopulated=true;this._populateWithContent(content);}
this._requestingScriptContent=true;scripts[0].requestContent().then(scriptContentAvailable.bind(this));}
_looselyMatchesSourceCodeLocation(sourceCodeLocation)
{if(this._sourceCode instanceof WebInspector.SourceMapResource)
return sourceCodeLocation.displaySourceCode===this._sourceCode;if(this._sourceCode instanceof WebInspector.Resource||this._sourceCode instanceof WebInspector.Script||this._sourceCode instanceof WebInspector.CSSStyleSheet)
return sourceCodeLocation.sourceCode.url===this._sourceCode.url;return false;}
_matchesSourceCodeLocation(sourceCodeLocation)
{if(this._sourceCode instanceof WebInspector.SourceMapResource)
return sourceCodeLocation.displaySourceCode===this._sourceCode;if(this._sourceCode instanceof WebInspector.Resource||this._sourceCode instanceof WebInspector.CSSStyleSheet)
return sourceCodeLocation.sourceCode.url===this._sourceCode.url;if(this._sourceCode instanceof WebInspector.Script)
return sourceCodeLocation.sourceCode===this._sourceCode;return false;}
_matchesBreakpoint(breakpoint)
{if(this._sourceCode instanceof WebInspector.SourceMapResource)
return breakpoint.sourceCodeLocation.displaySourceCode===this._sourceCode;if(this._sourceCode instanceof WebInspector.Resource)
return breakpoint.contentIdentifier===this._sourceCode.contentIdentifier;if(this._sourceCode instanceof WebInspector.Script)
return breakpoint.contentIdentifier===this._sourceCode.contentIdentifier||breakpoint.scriptIdentifier===this._sourceCode.id;return false;}
_issueWasAdded(event)
{var issue=event.data.issue;if(!WebInspector.IssueManager.issueMatchSourceCode(issue,this._sourceCode))
return;this._addIssue(issue);}
_addIssue(issue)
{var sourceCodeLocation=issue.sourceCodeLocation;if(!sourceCodeLocation)
return;var lineNumber=sourceCodeLocation.formattedLineNumber;var lineNumberIssues=this._issuesLineNumberMap.get(lineNumber);if(!lineNumberIssues){lineNumberIssues=[];this._issuesLineNumberMap.set(lineNumber,lineNumberIssues);}
for(var existingIssue of lineNumberIssues){if(existingIssue.sourceCodeLocation.columnNumber===sourceCodeLocation.columnNumber&&existingIssue.text===issue.text)
return;}
lineNumberIssues.push(issue);if(issue.level===WebInspector.IssueMessage.Level.Error)
this.addStyleClassToLine(lineNumber,WebInspector.SourceCodeTextEditor.LineErrorStyleClassName);else if(issue.level===WebInspector.IssueMessage.Level.Warning)
this.addStyleClassToLine(lineNumber,WebInspector.SourceCodeTextEditor.LineWarningStyleClassName);else
console.error("Unknown issue level");var widget=this._issueWidgetForLine(lineNumber);if(widget){if(issue.level===WebInspector.IssueMessage.Level.Error)
widget.widgetElement.classList.add(WebInspector.SourceCodeTextEditor.LineErrorStyleClassName);else if(issue.level===WebInspector.IssueMessage.Level.Warning)
widget.widgetElement.classList.add(WebInspector.SourceCodeTextEditor.LineWarningStyleClassName);this._updateIssueWidgetForIssues(widget,lineNumberIssues);}}
_issueWidgetForLine(lineNumber)
{var widget=this._widgetMap.get(lineNumber);if(widget)
return widget;widget=this.createWidgetForLine(lineNumber);if(!widget)
return null;var widgetElement=widget.widgetElement;widgetElement.classList.add("line-indicator-widget","issue-widget","inline");widgetElement.addEventListener("click",this._handleWidgetClick.bind(this,widget,lineNumber));this._widgetMap.set(lineNumber,widget);return widget;}
_iconClassNameForIssueLevel(level)
{if(level===WebInspector.IssueMessage.Level.Warning)
return"icon-warning";return"icon-error";}
_updateIssueWidgetForIssues(widget,issues)
{var widgetElement=widget.widgetElement;widgetElement.removeChildren();if(widgetElement.classList.contains("inline")||issues.length===1){var arrowElement=widgetElement.appendChild(document.createElement("span"));arrowElement.className="arrow";var iconElement=widgetElement.appendChild(document.createElement("span"));iconElement.className="icon";var textElement=widgetElement.appendChild(document.createElement("span"));textElement.className="text";if(issues.length===1){iconElement.classList.add(this._iconClassNameForIssueLevel(issues[0].level));textElement.textContent=issues[0].text;}else{var errorsCount=0;var warningsCount=0;for(var issue of issues){if(issue.level===WebInspector.IssueMessage.Level.Error)
++errorsCount;else if(issue.level===WebInspector.IssueMessage.Level.Warning)
++warningsCount;}
if(warningsCount&&errorsCount){iconElement.classList.add(this._iconClassNameForIssueLevel(issue.level));textElement.textContent=WebInspector.UIString("%d Errors, %d Warnings").format(errorsCount,warningsCount);}else if(errorsCount){iconElement.classList.add(this._iconClassNameForIssueLevel(issue.level));textElement.textContent=WebInspector.UIString("%d Errors").format(errorsCount);}else if(warningsCount){iconElement.classList.add(this._iconClassNameForIssueLevel(issue.level));textElement.textContent=WebInspector.UIString("%d Warnings").format(warningsCount);}
widget[WebInspector.SourceCodeTextEditor.WidgetContainsMultipleIssuesSymbol]=true;}}else{for(var issue of issues){var iconElement=widgetElement.appendChild(document.createElement("span"));iconElement.className="icon";iconElement.classList.add(this._iconClassNameForIssueLevel(issue.level));var textElement=widgetElement.appendChild(document.createElement("span"));textElement.className="text";textElement.textContent=issue.text;widgetElement.appendChild(document.createElement("br"));}}
widget.update();}
_isWidgetToggleable(widget)
{if(widget[WebInspector.SourceCodeTextEditor.WidgetContainsMultipleIssuesSymbol])
return true;if(widget[WebInspector.SourceCodeTextEditor.WidgetContainsMultipleThreadsSymbol])
return true;if(!widget.widgetElement.classList.contains("inline"))
return true;var textElement=widget.widgetElement.lastChild;if(textElement.offsetWidth!==textElement.scrollWidth)
return true;return false;}
_handleWidgetClick(widget,lineNumber,event)
{if(!this._isWidgetToggleable(widget))
return;widget.widgetElement.classList.toggle("inline");var lineNumberIssues=this._issuesLineNumberMap.get(lineNumber);this._updateIssueWidgetForIssues(widget,lineNumberIssues);}
_breakpointInfoForBreakpoint(breakpoint)
{return{resolved:breakpoint.resolved,disabled:breakpoint.disabled,autoContinue:breakpoint.autoContinue};}
get _supportsDebugging()
{if(this._sourceCode instanceof WebInspector.Resource)
return this._sourceCode.type===WebInspector.Resource.Type.Document||this._sourceCode.type===WebInspector.Resource.Type.Script;if(this._sourceCode instanceof WebInspector.Script)
return true;return false;}
textEditorBaseURL(textEditor)
{return this._sourceCode.url;}
textEditorScriptSourceType(textEditor)
{let script=this._getAssociatedScript();return script?script.sourceType:WebInspector.Script.SourceType.Program;}
textEditorShouldHideLineNumber(textEditor,lineNumber)
{return lineNumber in this._invalidLineNumbers;}
textEditorGutterContextMenu(textEditor,lineNumber,columnNumber,editorBreakpoints,event)
{if(!this._supportsDebugging)
return;event.preventDefault();let addBreakpoint=()=>{let data=this.textEditorBreakpointAdded(this,lineNumber,columnNumber);this.setBreakpointInfoForLineAndColumn(data.lineNumber,data.columnNumber,data.breakpointInfo);};let contextMenu=WebInspector.ContextMenu.createFromEvent(event);if(WebInspector.debuggerManager.paused){let editorLineInfo={lineNumber,columnNumber};let unformattedLineInfo=this._unformattedLineInfoForEditorLineInfo(editorLineInfo);let sourceCodeLocation=this._sourceCode.createSourceCodeLocation(unformattedLineInfo.lineNumber,unformattedLineInfo.columnNumber);let script;if(sourceCodeLocation.sourceCode instanceof WebInspector.Script)
script=sourceCodeLocation.sourceCode;else if(sourceCodeLocation.sourceCode instanceof WebInspector.Resource)
script=sourceCodeLocation.sourceCode.scriptForLocation(sourceCodeLocation);if(script){contextMenu.appendItem(WebInspector.UIString("Continue to Here"),()=>{WebInspector.debuggerManager.continueToLocation(script,sourceCodeLocation.lineNumber,sourceCodeLocation.columnNumber);});contextMenu.appendSeparator();}}
let breakpoints=[];for(let lineInfo of editorBreakpoints){let breakpoint=this._breakpointForEditorLineInfo(lineInfo);if(breakpoint)
breakpoints.push(breakpoint);}
if(!breakpoints.length){contextMenu.appendItem(WebInspector.UIString("Add Breakpoint"),addBreakpoint.bind(this));return;}
if(breakpoints.length===1){WebInspector.breakpointPopoverController.appendContextMenuItems(contextMenu,breakpoints[0],event.target);if(!WebInspector.isShowingDebuggerTab()){contextMenu.appendSeparator();contextMenu.appendItem(WebInspector.UIString("Reveal in Debugger Tab"),()=>{WebInspector.showDebuggerTab({breakpointToSelect:breakpoints[0]});});}
return;}
let removeBreakpoints=()=>{for(let breakpoint of breakpoints){if(WebInspector.debuggerManager.isBreakpointRemovable(breakpoint))
WebInspector.debuggerManager.removeBreakpoint(breakpoint);}};let shouldDisable=breakpoints.some((breakpoint)=>!breakpoint.disabled);let toggleBreakpoints=(shouldDisable)=>{for(let breakpoint of breakpoints)
breakpoint.disabled=shouldDisable;};if(shouldDisable)
contextMenu.appendItem(WebInspector.UIString("Disable Breakpoints"),toggleBreakpoints);else
contextMenu.appendItem(WebInspector.UIString("Enable Breakpoints"),toggleBreakpoints);contextMenu.appendItem(WebInspector.UIString("Delete Breakpoints"),removeBreakpoints);}
textEditorBreakpointAdded(textEditor,lineNumber,columnNumber)
{if(!this._supportsDebugging)
return null;var editorLineInfo={lineNumber,columnNumber};var unformattedLineInfo=this._unformattedLineInfoForEditorLineInfo(editorLineInfo);var sourceCodeLocation=this._sourceCode.createSourceCodeLocation(unformattedLineInfo.lineNumber,unformattedLineInfo.columnNumber);var breakpoint=new WebInspector.Breakpoint(sourceCodeLocation);var lineInfo=this._editorLineInfoForSourceCodeLocation(breakpoint.sourceCodeLocation);this._addBreakpointWithEditorLineInfo(breakpoint,lineInfo);this._ignoreBreakpointAddedBreakpoint=breakpoint;const shouldSpeculativelyResolveBreakpoint=true;WebInspector.debuggerManager.addBreakpoint(breakpoint,shouldSpeculativelyResolveBreakpoint);this._ignoreBreakpointAddedBreakpoint=null;return{breakpointInfo:this._breakpointInfoForBreakpoint(breakpoint),lineNumber:lineInfo.lineNumber,columnNumber:lineInfo.columnNumber};}
textEditorBreakpointRemoved(textEditor,lineNumber,columnNumber)
{if(!this._supportsDebugging)
return;var lineInfo={lineNumber,columnNumber};var breakpoint=this._breakpointForEditorLineInfo(lineInfo);if(!breakpoint)
return;this._removeBreakpointWithEditorLineInfo(breakpoint,lineInfo);this._ignoreBreakpointRemovedBreakpoint=breakpoint;WebInspector.debuggerManager.removeBreakpoint(breakpoint);this._ignoreBreakpointRemovedBreakpoint=null;}
textEditorBreakpointMoved(textEditor,oldLineNumber,oldColumnNumber,newLineNumber,newColumnNumber)
{if(!this._supportsDebugging)
return;var oldLineInfo={lineNumber:oldLineNumber,columnNumber:oldColumnNumber};var breakpoint=this._breakpointForEditorLineInfo(oldLineInfo);if(!breakpoint)
return;this._removeBreakpointWithEditorLineInfo(breakpoint,oldLineInfo);var newLineInfo={lineNumber:newLineNumber,columnNumber:newColumnNumber};var unformattedNewLineInfo=this._unformattedLineInfoForEditorLineInfo(newLineInfo);this._ignoreLocationUpdateBreakpoint=breakpoint;breakpoint.sourceCodeLocation.update(this._sourceCode,unformattedNewLineInfo.lineNumber,unformattedNewLineInfo.columnNumber);this._ignoreLocationUpdateBreakpoint=null;var accurateNewLineInfo=this._editorLineInfoForSourceCodeLocation(breakpoint.sourceCodeLocation);this._addBreakpointWithEditorLineInfo(breakpoint,accurateNewLineInfo);if(accurateNewLineInfo.lineNumber!==newLineInfo.lineNumber||accurateNewLineInfo.columnNumber!==newLineInfo.columnNumber)
this.updateBreakpointLineAndColumn(newLineInfo.lineNumber,newLineInfo.columnNumber,accurateNewLineInfo.lineNumber,accurateNewLineInfo.columnNumber);}
textEditorBreakpointClicked(textEditor,lineNumber,columnNumber)
{if(!this._supportsDebugging)
return;var breakpoint=this._breakpointForEditorLineInfo({lineNumber,columnNumber});if(!breakpoint)
return;breakpoint.cycleToNextMode();}
textEditorUpdatedFormatting(textEditor)
{this._ignoreAllBreakpointLocationUpdates=true;this._sourceCode.formatterSourceMap=this.formatterSourceMap;this._ignoreAllBreakpointLocationUpdates=false;
if(this._sourceCode instanceof WebInspector.Resource&&!(this._sourceCode instanceof WebInspector.SourceMapResource)){var scripts=this._sourceCode.scripts;for(var i=0;i<scripts.length;++i)
scripts[i].formatterSourceMap=this.formatterSourceMap;}else if(this._sourceCode instanceof WebInspector.Script){if(this._sourceCode.resource)
this._sourceCode.resource.formatterSourceMap=this.formatterSourceMap;}
var oldBreakpointMap=this._breakpointMap;this._breakpointMap={};for(var lineNumber in oldBreakpointMap){for(var columnNumber in oldBreakpointMap[lineNumber]){var breakpoint=oldBreakpointMap[lineNumber][columnNumber];var newLineInfo=this._editorLineInfoForSourceCodeLocation(breakpoint.sourceCodeLocation);this._addBreakpointWithEditorLineInfo(breakpoint,newLineInfo);this.setBreakpointInfoForLineAndColumn(lineNumber,columnNumber,null);this.setBreakpointInfoForLineAndColumn(newLineInfo.lineNumber,newLineInfo.columnNumber,this._breakpointInfoForBreakpoint(breakpoint));}}
this._reinsertAllIssues();this._reinsertAllThreadIndicators();}
textEditorExecutionHighlightRange(offset,position,characterAtOffset,callback)
{let script=this._getAssociatedScript(position);if(!script){callback(null);return;}
let adjustment=script.range.startOffset||0;offset=offset-adjustment;function convertRangeOffsetsToSourceCodeOffsets(range){return range.map((offset)=>offset+adjustment);}
script.requestScriptSyntaxTree((syntaxTree)=>{let nodes=syntaxTree.containersOfOffset(offset);if(!nodes.length){callback(null);return;}
for(let node of nodes){let startOffset=node.range[0];if(startOffset===offset&&node.type!==WebInspector.ScriptSyntaxTree.NodeType.Program){callback(convertRangeOffsetsToSourceCodeOffsets(node.range));return;}
if(node.type===WebInspector.ScriptSyntaxTree.NodeType.ForInStatement||node.type===WebInspector.ScriptSyntaxTree.NodeType.ForOfStatement){if(node.left.range[0]===offset){callback(convertRangeOffsetsToSourceCodeOffsets([node.left.range[0],node.right.range[1]]));return;}}
if(startOffset>offset)
break;}
for(let node of nodes){let startOffset=node.range[0];let endOffset=node.range[1];if(endOffset===offset){if(node.type===WebInspector.ScriptSyntaxTree.NodeType.BlockStatement){callback(convertRangeOffsetsToSourceCodeOffsets([offset-1,offset]));return;}}
if(startOffset>offset)
break;}
nodes.sort((a,b)=>{let aLength=a.range[1]-a.range[0];let bLength=b.range[1]-b.range[0];return aLength-bLength;});let characterAtOffsetIsDotOrBracket=characterAtOffset==="."||characterAtOffset==="[";for(let i=0;i<nodes.length;++i){let node=nodes[i];if(node.type===WebInspector.ScriptSyntaxTree.NodeType.CallExpression||node.type===WebInspector.ScriptSyntaxTree.NodeType.NewExpression||node.type===WebInspector.ScriptSyntaxTree.NodeType.ThrowStatement){callback(convertRangeOffsetsToSourceCodeOffsets(node.range));return;}
if(node.type===WebInspector.ScriptSyntaxTree.NodeType.ThisExpression||(characterAtOffsetIsDotOrBracket&&(node.type===WebInspector.ScriptSyntaxTree.NodeType.Identifier||node.type===WebInspector.ScriptSyntaxTree.NodeType.MemberExpression))){let memberExpressionNode=null;for(let j=i+1;j<nodes.length;++j){let nextNode=nodes[j];if(nextNode.type===WebInspector.ScriptSyntaxTree.NodeType.MemberExpression){memberExpressionNode=nextNode;if(offset===memberExpressionNode.range[1])
continue;}
break;}
if(memberExpressionNode){callback(convertRangeOffsetsToSourceCodeOffsets(memberExpressionNode.range));return;}
callback(convertRangeOffsetsToSourceCodeOffsets(node.range));return;}}
callback(null);});}
_clearIssueWidgets()
{for(var widget of this._widgetMap.values())
widget.clear();this._widgetMap.clear();}
_reinsertAllIssues()
{this._issuesLineNumberMap.clear();this._clearIssueWidgets();let issues=WebInspector.issueManager.issuesForSourceCode(this._sourceCode);for(let issue of issues)
this._addIssue(issue);}
_reinsertAllThreadIndicators()
{for(let lineNumber of this._threadLineNumberMap.keys())
this.removeStyleClassFromLine(lineNumber,"thread-indicator");this._threadLineNumberMap.clear();for(let widget of this._threadWidgetMap.values())
widget.clear();this._threadWidgetMap.clear();this._threadTargetMap.clear();if(WebInspector.targets.size>1){for(let target of WebInspector.targets)
this._addThreadIndicatorForTarget(target);}}
_debuggerDidPause(event)
{this._updateTokenTrackingControllerState();if(this._typeTokenAnnotator&&this._typeTokenAnnotator.isActive())
this._typeTokenAnnotator.refresh();if(this._basicBlockAnnotator&&this._basicBlockAnnotator.isActive())
this._basicBlockAnnotator.refresh();}
_debuggerDidResume(event)
{this._updateTokenTrackingControllerState();this._dismissPopover();if(this._typeTokenAnnotator&&this._typeTokenAnnotator.isActive())
this._typeTokenAnnotator.refresh();if(this._basicBlockAnnotator&&this._basicBlockAnnotator.isActive())
this._basicBlockAnnotator.refresh();}
_sourceCodeSourceMapAdded(event)
{WebInspector.notifications.addEventListener(WebInspector.Notification.GlobalModifierKeysDidChange,this._updateTokenTrackingControllerState,this);this._sourceCode.removeEventListener(WebInspector.SourceCode.Event.SourceMapAdded,this._sourceCodeSourceMapAdded,this);this._updateTokenTrackingControllerState();}
_updateTokenTrackingControllerState()
{var mode=WebInspector.CodeMirrorTokenTrackingController.Mode.None;if(WebInspector.debuggerManager.paused)
mode=WebInspector.CodeMirrorTokenTrackingController.Mode.JavaScriptExpression;else if(this._typeTokenAnnotator&&this._typeTokenAnnotator.isActive())
mode=WebInspector.CodeMirrorTokenTrackingController.Mode.JavaScriptTypeInformation;else if(this._hasColorMarkers())
mode=WebInspector.CodeMirrorTokenTrackingController.Mode.MarkedTokens;else if((this._sourceCode instanceof WebInspector.SourceMapResource||this._sourceCode.sourceMaps.length!==0)&&WebInspector.modifierKeys.metaKey&&!WebInspector.modifierKeys.altKey&&!WebInspector.modifierKeys.shiftKey)
mode=WebInspector.CodeMirrorTokenTrackingController.Mode.NonSymbolTokens;this.tokenTrackingController.enabled=mode!==WebInspector.CodeMirrorTokenTrackingController.Mode.None;if(mode===this.tokenTrackingController.mode)
return;switch(mode){case WebInspector.CodeMirrorTokenTrackingController.Mode.MarkedTokens:this.tokenTrackingController.mouseOverDelayDuration=0;this.tokenTrackingController.mouseOutReleaseDelayDuration=0;break;case WebInspector.CodeMirrorTokenTrackingController.Mode.NonSymbolTokens:this.tokenTrackingController.mouseOverDelayDuration=0;this.tokenTrackingController.mouseOutReleaseDelayDuration=0;this.tokenTrackingController.classNameForHighlightedRange=WebInspector.CodeMirrorTokenTrackingController.JumpToSymbolHighlightStyleClassName;this._dismissPopover();break;case WebInspector.CodeMirrorTokenTrackingController.Mode.JavaScriptExpression:case WebInspector.CodeMirrorTokenTrackingController.Mode.JavaScriptTypeInformation:this.tokenTrackingController.mouseOverDelayDuration=WebInspector.SourceCodeTextEditor.DurationToMouseOverTokenToMakeHoveredToken;this.tokenTrackingController.mouseOutReleaseDelayDuration=WebInspector.SourceCodeTextEditor.DurationToMouseOutOfHoveredTokenToRelease;this.tokenTrackingController.classNameForHighlightedRange=WebInspector.SourceCodeTextEditor.HoveredExpressionHighlightStyleClassName;break;}
this.tokenTrackingController.mode=mode;}
_hasColorMarkers()
{for(var marker of this.markers){if(marker.type===WebInspector.TextMarker.Type.Color)
return true;}
return false;}
tokenTrackingControllerCanReleaseHighlightedRange(tokenTrackingController,element)
{if(!this._popover)
return true;if(!window.getSelection().isCollapsed&&this._popover.element.contains(window.getSelection().anchorNode))
return false;return true;}
tokenTrackingControllerHighlightedRangeReleased(tokenTrackingController,forceHide=false)
{if(forceHide||!this._mouseIsOverPopover)
this._dismissPopover();}
tokenTrackingControllerHighlightedRangeWasClicked(tokenTrackingController)
{if(this.tokenTrackingController.mode!==WebInspector.CodeMirrorTokenTrackingController.Mode.NonSymbolTokens)
return;if(/\blink\b/.test(this.tokenTrackingController.candidate.hoveredToken.type))
return;const options={ignoreNetworkTab:true,ignoreSearchTab:true,};var sourceCodeLocation=this._sourceCodeLocationForEditorPosition(this.tokenTrackingController.candidate.hoveredTokenRange.start);if(this.sourceCode instanceof WebInspector.SourceMapResource)
WebInspector.showOriginalOrFormattedSourceCodeLocation(sourceCodeLocation,options);else
WebInspector.showSourceCodeLocation(sourceCodeLocation,options);}
tokenTrackingControllerNewHighlightCandidate(tokenTrackingController,candidate)
{if(this.tokenTrackingController.mode===WebInspector.CodeMirrorTokenTrackingController.Mode.NonSymbolTokens){this.tokenTrackingController.highlightRange(candidate.hoveredTokenRange);return;}
if(this.tokenTrackingController.mode===WebInspector.CodeMirrorTokenTrackingController.Mode.JavaScriptExpression){this._tokenTrackingControllerHighlightedJavaScriptExpression(candidate);return;}
if(this.tokenTrackingController.mode===WebInspector.CodeMirrorTokenTrackingController.Mode.JavaScriptTypeInformation){this._tokenTrackingControllerHighlightedJavaScriptTypeInformation(candidate);return;}
if(this.tokenTrackingController.mode===WebInspector.CodeMirrorTokenTrackingController.Mode.MarkedTokens){var markers=this.markersAtPosition(candidate.hoveredTokenRange.start);if(markers.length>0)
this._tokenTrackingControllerHighlightedMarkedExpression(candidate,markers);else
this._dismissEditingController();}}
tokenTrackingControllerMouseOutOfHoveredMarker(tokenTrackingController,hoveredMarker)
{this._dismissEditingController();}
_tokenTrackingControllerHighlightedJavaScriptExpression(candidate)
{function populate(error,result,wasThrown)
{if(error||wasThrown)
return;if(candidate!==this.tokenTrackingController.candidate)
return;let data=WebInspector.RemoteObject.fromPayload(result,this.target);switch(data.type){case"function":this._showPopoverForFunction(data);break;case"object":if(data.subtype==="null"||data.subtype==="regexp")
this._showPopoverWithFormattedValue(data);else
this._showPopoverForObject(data);break;case"string":case"number":case"boolean":case"undefined":case"symbol":this._showPopoverWithFormattedValue(data);break;}}
let target=WebInspector.debuggerManager.activeCallFrame?WebInspector.debuggerManager.activeCallFrame.target:this.target;let expression=appendWebInspectorSourceURL(candidate.expression);if(WebInspector.debuggerManager.activeCallFrame){target.DebuggerAgent.evaluateOnCallFrame.invoke({callFrameId:WebInspector.debuggerManager.activeCallFrame.id,expression,objectGroup:"popover",doNotPauseOnExceptionsAndMuteConsole:true},populate.bind(this),target.DebuggerAgent);return;}
target.RuntimeAgent.evaluate.invoke({expression,objectGroup:"popover",doNotPauseOnExceptionsAndMuteConsole:true},populate.bind(this),target.RuntimeAgent);}
_tokenTrackingControllerHighlightedJavaScriptTypeInformation(candidate)
{var sourceCode=this._sourceCode;var sourceID=sourceCode instanceof WebInspector.Script?sourceCode.id:sourceCode.scripts[0].id;var range=candidate.hoveredTokenRange;var offset=this.currentPositionToOriginalOffset(range.start);var allRequests=[{typeInformationDescriptor:WebInspector.ScriptSyntaxTree.TypeProfilerSearchDescriptor.NormalExpression,sourceID,divot:offset}];function handler(error,allTypes){if(error)
return;if(candidate!==this.tokenTrackingController.candidate)
return;if(!allTypes.length)
return;var typeDescription=WebInspector.TypeDescription.fromPayload(allTypes[0]);if(typeDescription.valid){var popoverTitle=WebInspector.TypeTokenView.titleForPopover(WebInspector.TypeTokenView.TitleType.Variable,candidate.expression);this.showPopoverForTypes(typeDescription,null,popoverTitle);}}
this.target.RuntimeAgent.getRuntimeTypesForVariablesAtOffsets(allRequests,handler.bind(this));}
_showPopover(content,bounds)
{var shouldHighlightRange=false;var candidate=this.tokenTrackingController.candidate;if(!bounds){if(!candidate)
return;var rects=this.rectsForRange(candidate.hoveredTokenRange);bounds=WebInspector.Rect.unionOfRects(rects);shouldHighlightRange=true;}
content.classList.add(WebInspector.SourceCodeTextEditor.PopoverDebuggerContentStyleClassName);this._popover=this._popover||new WebInspector.Popover(this);this._popover.presentNewContentWithFrame(content,bounds.pad(5),[WebInspector.RectEdge.MIN_Y,WebInspector.RectEdge.MAX_Y,WebInspector.RectEdge.MAX_X]);if(shouldHighlightRange)
this.tokenTrackingController.highlightRange(candidate.expressionRange);this._trackPopoverEvents();}
_showPopoverForFunction(data)
{let candidate=this.tokenTrackingController.candidate;function didGetDetails(error,response)
{if(error){console.error(error);this._dismissPopover();return;}
if(candidate!==this.tokenTrackingController.candidate)
return;let content=document.createElement("div");content.classList.add("function");let title=document.createElement("div");title.classList.add("title");title.textContent=response.name||response.displayName||WebInspector.UIString("(anonymous function)");content.appendChild(title);let location=response.location;let sourceCode=WebInspector.debuggerManager.scriptForIdentifier(location.scriptId,this.target);let sourceCodeLocation=sourceCode.createSourceCodeLocation(location.lineNumber,location.columnNumber);let functionSourceCodeLink=WebInspector.createSourceCodeLocationLink(sourceCodeLocation);title.appendChild(functionSourceCodeLink);let wrapper=document.createElement("div");wrapper.classList.add("body");content.appendChild(wrapper);let codeMirror=WebInspector.CodeMirrorEditor.create(wrapper,{mode:"text/javascript",readOnly:"nocursor",});codeMirror.on("update",()=>{this._popover.update();});const isModule=false;const indentString=WebInspector.indentString();const includeSourceMapData=false;let workerProxy=WebInspector.FormatterWorkerProxy.singleton();workerProxy.formatJavaScript(data.description,isModule,indentString,includeSourceMapData,({formattedText})=>{codeMirror.setValue(formattedText||data.description);});this._showPopover(content);}
data.target.DebuggerAgent.getFunctionDetails(data.objectId,didGetDetails.bind(this));}
_showPopoverForObject(data)
{var content=document.createElement("div");content.className="object expandable";var titleElement=document.createElement("div");titleElement.className="title";titleElement.textContent=data.description;content.appendChild(titleElement);if(data.subtype==="node"){data.pushNodeToFrontend(function(nodeId){if(!nodeId)
return;var domNode=WebInspector.domTreeManager.nodeForId(nodeId);if(!domNode.ownerDocument)
return;var goToButton=titleElement.appendChild(WebInspector.createGoToArrowButton());goToButton.addEventListener("click",function(){WebInspector.domTreeManager.inspectElement(nodeId);});});}
var objectTree=new WebInspector.ObjectTreeView(data);objectTree.showOnlyProperties();objectTree.expand();var bodyElement=content.appendChild(document.createElement("div"));bodyElement.className="body";bodyElement.appendChild(objectTree.element);var candidate=this.tokenTrackingController.candidate;objectTree.addEventListener(WebInspector.ObjectTreeView.Event.Updated,function(){if(candidate===this.tokenTrackingController.candidate)
this._showPopover(content);objectTree.removeEventListener(null,null,this);},this);}
_showPopoverWithFormattedValue(remoteObject)
{var content=WebInspector.FormattedValue.createElementForRemoteObject(remoteObject);this._showPopover(content);}
willDismissPopover(popover)
{this.tokenTrackingController.removeHighlightedRange();this.target.RuntimeAgent.releaseObjectGroup("popover");}
_dismissPopover()
{if(!this._popover)
return;this._popover.dismiss();if(this._popoverEventListeners&&this._popoverEventListenersAreRegistered){this._popoverEventListenersAreRegistered=false;this._popoverEventListeners.unregister();}}
_trackPopoverEvents()
{if(!this._popoverEventListeners)
this._popoverEventListeners=new WebInspector.EventListenerSet(this,"Popover listeners");if(!this._popoverEventListenersAreRegistered){this._popoverEventListenersAreRegistered=true;this._popoverEventListeners.register(this._popover.element,"mouseover",this._popoverMouseover);this._popoverEventListeners.register(this._popover.element,"mouseout",this._popoverMouseout);this._popoverEventListeners.install();}}
_popoverMouseover(event)
{this._mouseIsOverPopover=true;}
_popoverMouseout(event)
{this._mouseIsOverPopover=this._popover.element.contains(event.relatedTarget);}
_hasStyleSheetContents()
{let mimeType=this.mimeType;return mimeType==="text/css"||mimeType==="text/x-less"||mimeType==="text/x-sass"||mimeType==="text/x-scss";}
_updateEditableMarkers(range)
{if(this._hasStyleSheetContents()){this.createColorMarkers(range);this.createGradientMarkers(range);this.createCubicBezierMarkers(range);this.createSpringMarkers(range);}
this._updateTokenTrackingControllerState();}
_tokenTrackingControllerHighlightedMarkedExpression(candidate,markers)
{var editableMarker;for(var marker of markers){if(!marker.range||!Object.values(WebInspector.TextMarker.Type).includes(marker.type))
continue;if(!editableMarker||(marker.range.startLine<editableMarker.range.startLine||(marker.range.startLine===editableMarker.range.startLine&&marker.range.startColumn<editableMarker.range.startColumn)))
editableMarker=marker;}
if(!editableMarker){this.tokenTrackingController.hoveredMarker=null;return;}
if(this.tokenTrackingController.hoveredMarker===editableMarker)
return;this._dismissEditingController();this.tokenTrackingController.hoveredMarker=editableMarker;this._editingController=this.editingControllerForMarker(editableMarker);if(marker.type===WebInspector.TextMarker.Type.Color){var color=this._editingController.value;if(!color||!color.valid){editableMarker.clear();this._editingController=null;return;}}
this._editingController.delegate=this;this._editingController.presentHoverMenu();}
_dismissEditingController(discrete)
{if(this._editingController)
this._editingController.dismissHoverMenu(discrete);this.tokenTrackingController.hoveredMarker=null;this._editingController=null;}
editingControllerDidStartEditing(editingController)
{
this.tokenTrackingController.enabled=false;editingController.marker.clear();this._ignoreContentDidChange++;}
editingControllerDidFinishEditing(editingController)
{this._updateEditableMarkers(editingController.range);this._ignoreContentDidChange--;this._editingController=null;}
_setTypeTokenAnnotatorEnabledState(shouldActivate)
{if(!this._typeTokenAnnotator)
return;if(shouldActivate){this._typeTokenAnnotator.reset();if(!this._typeTokenScrollHandler)
this._enableScrollEventsForTypeTokenAnnotator();}else{this._typeTokenAnnotator.clear();if(this._typeTokenScrollHandler)
this._disableScrollEventsForTypeTokenAnnotator();}
WebInspector.showJavaScriptTypeInformationSetting.value=shouldActivate;this._updateTokenTrackingControllerState();}
set _basicBlockAnnotatorEnabled(shouldActivate)
{if(!this._basicBlockAnnotator)
return;if(shouldActivate){this._basicBlockAnnotator.reset();if(!this._controlFlowScrollHandler)
this._enableScrollEventsForControlFlowAnnotator();}else{this._basicBlockAnnotator.clear();if(this._controlFlowScrollHandler)
this._disableScrollEventsForControlFlowAnnotator();}
WebInspector.enableControlFlowProfilerSetting.value=shouldActivate;}
_getAssociatedScript(position)
{let script=null;if(this._sourceCode instanceof WebInspector.Script)
script=this._sourceCode;else if(this._sourceCode instanceof WebInspector.Resource&&this._sourceCode.scripts.length){if(this._sourceCode.type===WebInspector.Resource.Type.Script)
script=this._sourceCode.scripts[0];else if(this._sourceCode.type===WebInspector.Resource.Type.Document&&position){for(let inlineScript of this._sourceCode.scripts){if(inlineScript.range.contains(position.lineNumber,position.columnNumber)){if(isNaN(inlineScript.range.startOffset))
inlineScript.range.resolveOffsets(this._sourceCode.content);script=inlineScript;break;}}}}
return script;}
_createTypeTokenAnnotator()
{if(!RuntimeAgent.getRuntimeTypesForVariablesAtOffsets)
return;var script=this._getAssociatedScript();if(!script)
return;this._typeTokenAnnotator=new WebInspector.TypeTokenAnnotator(this,script);}
_createBasicBlockAnnotator()
{if(!RuntimeAgent.getBasicBlocks)
return;var script=this._getAssociatedScript();if(!script)
return;this._basicBlockAnnotator=new WebInspector.BasicBlockAnnotator(this,script);}
_enableScrollEventsForTypeTokenAnnotator()
{this._typeTokenScrollHandler=this._createTypeTokenScrollEventHandler();this.addScrollHandler(this._typeTokenScrollHandler);}
_enableScrollEventsForControlFlowAnnotator()
{this._controlFlowScrollHandler=this._createControlFlowScrollEventHandler();this.addScrollHandler(this._controlFlowScrollHandler);}
_disableScrollEventsForTypeTokenAnnotator()
{this.removeScrollHandler(this._typeTokenScrollHandler);this._typeTokenScrollHandler=null;}
_disableScrollEventsForControlFlowAnnotator()
{this.removeScrollHandler(this._controlFlowScrollHandler);this._controlFlowScrollHandler=null;}
_createTypeTokenScrollEventHandler()
{let timeoutIdentifier=null;let scrollHandler=()=>{if(timeoutIdentifier)
clearTimeout(timeoutIdentifier);else{if(this._typeTokenAnnotator)
this._typeTokenAnnotator.pause();}
timeoutIdentifier=setTimeout(()=>{timeoutIdentifier=null;if(this._typeTokenAnnotator)
this._typeTokenAnnotator.resume();},WebInspector.SourceCodeTextEditor.DurationToUpdateTypeTokensAfterScrolling);};return scrollHandler;}
_createControlFlowScrollEventHandler()
{let timeoutIdentifier=null;let scrollHandler=()=>{if(timeoutIdentifier)
clearTimeout(timeoutIdentifier);else if(this._basicBlockAnnotator)
this._basicBlockAnnotator.pause();timeoutIdentifier=setTimeout(()=>{timeoutIdentifier=null;if(this._basicBlockAnnotator)
this._basicBlockAnnotator.resume();},WebInspector.SourceCodeTextEditor.DurationToUpdateTypeTokensAfterScrolling);};return scrollHandler;}
_logCleared(event)
{for(let lineNumber of this._issuesLineNumberMap.keys()){this.removeStyleClassFromLine(lineNumber,WebInspector.SourceCodeTextEditor.LineErrorStyleClassName);this.removeStyleClassFromLine(lineNumber,WebInspector.SourceCodeTextEditor.LineWarningStyleClassName);}
this._issuesLineNumberMap.clear();this._clearIssueWidgets();}};WebInspector.SourceCodeTextEditor.LineErrorStyleClassName="error";WebInspector.SourceCodeTextEditor.LineWarningStyleClassName="warning";WebInspector.SourceCodeTextEditor.PopoverDebuggerContentStyleClassName="debugger-popover-content";WebInspector.SourceCodeTextEditor.HoveredExpressionHighlightStyleClassName="hovered-expression-highlight";WebInspector.SourceCodeTextEditor.DurationToMouseOverTokenToMakeHoveredToken=500;WebInspector.SourceCodeTextEditor.DurationToMouseOutOfHoveredTokenToRelease=1000;WebInspector.SourceCodeTextEditor.DurationToUpdateTypeTokensAfterScrolling=100;WebInspector.SourceCodeTextEditor.WidgetContainsMultipleIssuesSymbol=Symbol("source-code-widget-contains-multiple-issues");WebInspector.SourceCodeTextEditor.WidgetContainsMultipleThreadsSymbol=Symbol("source-code-widget-contains-multiple-threads");WebInspector.SourceCodeTextEditor.Event={ContentWillPopulate:"source-code-text-editor-content-will-populate",ContentDidPopulate:"source-code-text-editor-content-did-populate"};WebInspector.SourceCodeTimelineTimelineDataGridNode=class SourceCodeTimelineTimelineDataGridNode extends WebInspector.TimelineDataGridNode
{constructor(sourceCodeTimeline,graphDataSource)
{super(true,graphDataSource);this._sourceCodeTimeline=sourceCodeTimeline;this._sourceCodeTimeline.addEventListener(WebInspector.Timeline.Event.RecordAdded,this._timelineRecordAdded,this);}
get records()
{return this._sourceCodeTimeline.records;}
get sourceCodeTimeline()
{return this._sourceCodeTimeline;}
get data()
{return{graph:this._sourceCodeTimeline.startTime};}
createCellContent(columnIdentifier,cell)
{if(columnIdentifier==="name"&&this.records.length){cell.classList.add(...this.iconClassNames());return this._createNameCellContent(cell);}
return super.createCellContent(columnIdentifier,cell);}
filterableDataForColumn(columnIdentifier)
{if(columnIdentifier==="name")
return this.displayName();return super.filterableDataForColumn(columnIdentifier);}
_createNameCellContent(cellElement)
{if(!this.records.length)
return null;let fragment=document.createDocumentFragment();let mainTitle=this.displayName();fragment.append(mainTitle);let sourceCodeLocation=this._sourceCodeTimeline.sourceCodeLocation;if(sourceCodeLocation){let subtitleElement=document.createElement("span");subtitleElement.classList.add("subtitle");sourceCodeLocation.populateLiveDisplayLocationString(subtitleElement,"textContent",null,WebInspector.SourceCodeLocation.NameStyle.None,WebInspector.UIString("line "));const options={useGoToArrowButton:true,ignoreNetworkTab:true,ignoreSearchTab:true,};let goToArrowButtonLink=WebInspector.createSourceCodeLocationLink(sourceCodeLocation,options);fragment.append(goToArrowButtonLink,subtitleElement);sourceCodeLocation.populateLiveDisplayLocationTooltip(cellElement,mainTitle+"\n");}else
cellElement.title=mainTitle;return fragment;}
_timelineRecordAdded(event)
{if(this.isRecordVisible(event.data.record))
this.needsGraphRefresh();}};WebInspector.SourceCodeTimelineTreeElement=class SourceCodeTimelineTreeElement extends WebInspector.TimelineRecordTreeElement
{constructor(sourceCodeTimeline,subtitleNameStyle,includeDetailsInMainTitle)
{subtitleNameStyle=subtitleNameStyle||WebInspector.SourceCodeLocation.NameStyle.None;super(sourceCodeTimeline.records[0],subtitleNameStyle,includeDetailsInMainTitle,sourceCodeTimeline.sourceCodeLocation,sourceCodeTimeline);this._sourceCodeTimeline=sourceCodeTimeline;}
get record()
{return undefined;}
get sourceCodeTimeline()
{return this._sourceCodeTimeline;}};WebInspector.SourceMapResourceTreeElement=class SourceMapResourceTreeElement extends WebInspector.ResourceTreeElement
{constructor(sourceMapResource,representedObject)
{super(sourceMapResource);this.addClassName("source-map-resource");}
_updateTitles()
{var oldMainTitle=this.mainTitle;this.mainTitle=this.resource.displayName;var sourceMapHost=this.resource.urlComponents.host;var originalHost=this.resource.sourceMap.originalSourceCode.urlComponents.host;var subtitle=sourceMapHost!==originalHost?WebInspector.displayNameForHost(sourceMapHost):null;this.subtitle=this.mainTitle!==subtitle?subtitle:null;if(oldMainTitle!==this.mainTitle)
this.callFirstAncestorFunction("descendantResourceTreeElementMainTitleDidChange",[this,oldMainTitle]);}};WebInspector.SpanningDataGridNode=class SpanningDataGridNode extends WebInspector.DataGridNode
{constructor(text)
{super({[WebInspector.SpanningDataGridNode.ColumnIdentifier]:text});}
createCells()
{let cellElement=this.createCell(WebInspector.SpanningDataGridNode.ColumnIdentifier);cellElement.classList.add("spanning");cellElement.setAttribute("colspan",this.dataGrid.columns.size);this.element.appendChild(cellElement);}};WebInspector.SpanningDataGridNode.ColumnIdentifier="spanning-text";WebInspector.SpringEditor=class SpringEditor extends WebInspector.Object
{constructor()
{super();this._element=document.createElement("div");this._element.classList.add("spring-editor");this._previewContainer=this._element.createChild("div","spring-preview");this._previewContainer.title=WebInspector.UIString("Restart animation");this._previewContainer.addEventListener("mousedown",this._resetPreviewAnimation.bind(this));this._previewElement=this._previewContainer.createChild("div");this._previewElement.addEventListener("transitionend",this.debounce(500)._resetPreviewAnimation);this._timingContainer=this._element.createChild("div","spring-timing");this._timingElement=this._timingContainer.createChild("div");this._numberInputContainer=this._element.createChild("div","number-input-container");function createInputsForParameter(id,title)
{let row=this._numberInputContainer.createChild("div",`number-input-row ${id}`);row.createChild("div","number-input-row-title").textContent=title;let sliderKey=`_${id}Slider`;this[sliderKey]=row.createChild("input");this[sliderKey].type="range";this[sliderKey].addEventListener("input",this._handleNumberSliderInput.bind(this));this[sliderKey].addEventListener("mousedown",this._handleNumberSliderMousedown.bind(this));this[sliderKey].addEventListener("mouseup",this._handleNumberSliderMouseup.bind(this));let inputKey=`_${id}Input`;this[inputKey]=row.createChild("input");this[inputKey].type="number";this[inputKey].addEventListener("input",this._handleNumberInputInput.bind(this));this[inputKey].addEventListener("keydown",this._handleNumberInputKeydown.bind(this));}
createInputsForParameter.call(this,"mass",WebInspector.UIString("Mass"));this._massInput.min=this._massSlider.min=1;createInputsForParameter.call(this,"stiffness",WebInspector.UIString("Stiffness"));this._stiffnessInput.min=this._stiffnessSlider.min=1;createInputsForParameter.call(this,"damping",WebInspector.UIString("Damping"));this._dampingInput.min=this._dampingSlider.min=0;createInputsForParameter.call(this,"initialVelocity",WebInspector.UIString("Initial Velocity"));this._spring=new WebInspector.Spring(1,100,10,0);}
get element()
{return this._element;}
get spring()
{return this._spring;}
set spring(spring)
{if(!spring)
return;let isSpring=spring instanceof WebInspector.Spring;if(!isSpring)
return;this._spring=spring;this._massInput.value=this._massSlider.value=this._spring.mass;this._stiffnessInput.value=this._stiffnessSlider.value=this._spring.stiffness;this._dampingInput.value=this._dampingSlider.value=this._spring.damping;this._initialVelocityInput.value=this._initialVelocitySlider.value=this._spring.initialVelocity;this._resetPreviewAnimation();}
_handleNumberInputInput(event)
{this._changeSpringForInput(event.target,event.target.value);}
_handleNumberInputKeydown(event)
{let shift=0;if(event.keyIdentifier==="Up")
shift=1;else if(event.keyIdentifier==="Down")
shift=-1;if(!shift)
return;if(event.shiftKey)
shift*=10;else if(event.altKey)
shift/=10;let value=parseFloat(event.target.value)||0;this._changeSpringForInput(event.target,value+shift);event.preventDefault();}
_handleNumberSliderInput(event)
{this._changeSpringForInput(event.target,event.target.value);}
_handleNumberSliderMousedown(event)
{this._changeSpringForInput(event.target,event.target.value);}
_handleNumberSliderMouseup(event)
{this._changeSpringForInput(event.target,event.target.value);}
_changeSpringForInput(target,value)
{value=parseFloat(value)||0;switch(target){case this._massInput:case this._massSlider:if(this._spring.mass===value)
return;this._spring.mass=Math.max(1,value);this._massInput.value=this._massSlider.value=this._spring.mass.maxDecimals(3);break;case this._stiffnessInput:case this._stiffnessSlider:if(this._spring.stiffness===value)
return;this._spring.stiffness=Math.max(1,value);this._stiffnessInput.value=this._stiffnessSlider.value=this._spring.stiffness.maxDecimals(3);break;case this._dampingInput:case this._dampingSlider:if(this._spring.damping===value)
return;this._spring.damping=Math.max(0,value);this._dampingInput.value=this._dampingSlider.value=this._spring.damping.maxDecimals(3);break;case this._initialVelocityInput:case this._initialVelocitySlider:if(this._spring.initialVelocity===value)
return;this._spring.initialVelocity=value;this._initialVelocityInput.value=this._initialVelocitySlider.value=this._spring.initialVelocity.maxDecimals(3);break;default:WebInspector.reportInternalError("Input event fired for unrecognized element");return;}
this.dispatchEventToListeners(WebInspector.SpringEditor.Event.SpringChanged,{spring:this._spring});this._resetPreviewAnimation();}
_resetPreviewAnimation(event)
{this._previewContainer.classList.remove("animate");this._previewElement.style.transitionTimingFunction=null;this._previewElement.style.transform=null;this._timingContainer.classList.remove("animate");this._timingElement.style.transform=null;if(!event)
this._timingContainer.dataset.duration="0";this.debounce(500)._updatePreviewAnimation(event);}
_updatePreviewAnimation(event)
{this._previewContainer.classList.add("animate");this._previewElement.style.transitionTimingFunction=this._spring.toString();this._timingContainer.classList.add("animate");if(WebInspector.resolvedLayoutDirection()===WebInspector.LayoutDirection.RTL){this._previewElement.style.transform="translateX(-85px)";this._timingElement.style.transform="translateX(-170px)";}else{this._previewElement.style.transform="translateX(85px)";this._timingElement.style.transform="translateX(170px)";}
if(!event){let duration=this._spring.calculateDuration();this._timingContainer.dataset.duration=duration.toFixed(2);this._timingElement.style.transitionDuration=`${duration}s`;this._previewElement.style.transitionDuration=`${duration}s`;}}};WebInspector.SpringEditor.Event={SpringChanged:"spring-editor-spring-changed"};WebInspector.SVGImageResourceClusterContentView=class SVGImageResourceClusterContentView extends WebInspector.ClusterContentView
{constructor(resource)
{super(resource);this._resource=resource;let createPathComponent=(displayName,className,identifier)=>{const textOnly=false;const showSelectorArrows=true;let pathComponent=new WebInspector.HierarchicalPathComponent(displayName,className,identifier,textOnly,showSelectorArrows);pathComponent.addEventListener(WebInspector.HierarchicalPathComponent.Event.SiblingWasSelected,this._pathComponentSelected,this);pathComponent.comparisonData=resource;return pathComponent;};this._imagePathComponent=createPathComponent(WebInspector.UIString("Image"),"image-icon",WebInspector.SVGImageResourceClusterContentView.Identifier.Image);this._sourcePathComponent=createPathComponent(WebInspector.UIString("Source"),"source-icon",WebInspector.SVGImageResourceClusterContentView.Identifier.Source);this._imagePathComponent.nextSibling=this._sourcePathComponent;this._sourcePathComponent.previousSibling=this._imagePathComponent;this._currentContentViewSetting=new WebInspector.Setting("svg-image-resource-cluster-current-view-"+this._resource.url.hash,WebInspector.SVGImageResourceClusterContentView.Identifier.Image);}
get resource(){return this._resource;}
get selectionPathComponents()
{let currentContentView=this._contentViewContainer.currentContentView;if(!currentContentView)
return[];let components=[this._pathComponentForContentView(currentContentView)];return components.concat(currentContentView.selectionPathComponents);}
shown()
{super.shown();if(this._shownInitialContent)
return;this._showContentViewForIdentifier(this._currentContentViewSetting.value);}
closed()
{super.closed();this._shownInitialContent=false;}
saveToCookie(cookie)
{cookie[WebInspector.SVGImageResourceClusterContentView.ContentViewIdentifierCookieKey]=this._currentContentViewSetting.value;}
restoreFromCookie(cookie)
{let contentView=this._showContentViewForIdentifier(cookie[WebInspector.SVGImageResourceClusterContentView.ContentViewIdentifierCookieKey]);if(typeof contentView.revealPosition==="function"&&"lineNumber"in cookie&&"columnNumber"in cookie)
contentView.revealPosition(new WebInspector.SourceCodePosition(cookie.lineNumber,cookie.columnNumber));}
_pathComponentForContentView(contentView)
{if(!contentView)
return null;if(contentView instanceof WebInspector.ImageResourceContentView)
return this._imagePathComponent;if(contentView instanceof WebInspector.TextContentView)
return this._sourcePathComponent;console.error("Unknown contentView.");return null;}
_identifierForContentView(contentView)
{if(!contentView)
return null;if(contentView instanceof WebInspector.ImageResourceContentView)
return WebInspector.SVGImageResourceClusterContentView.Identifier.Image;if(contentView instanceof WebInspector.TextContentView)
return WebInspector.SVGImageResourceClusterContentView.Identifier.Source;console.error("Unknown contentView.");return null;}
_showContentViewForIdentifier(identifier)
{let contentViewToShow=null;switch(identifier){case WebInspector.SVGImageResourceClusterContentView.Identifier.Image:contentViewToShow=new WebInspector.ImageResourceContentView(this._resource);break;case WebInspector.SVGImageResourceClusterContentView.Identifier.Source:contentViewToShow=new WebInspector.TextContentView("",this._resource.mimeType);this._resource.requestContent().then((result)=>{let fileReader=new FileReader;fileReader.addEventListener("loadend",()=>{contentViewToShow.textEditor.string=fileReader.result;});fileReader.readAsText(result.content);});break;default:contentViewToShow=new WebInspector.ImageResourceContentView(this._resource);break;}
this._currentContentViewSetting.value=this._identifierForContentView(contentViewToShow);return this.contentViewContainer.showContentView(contentViewToShow);}
_pathComponentSelected(event)
{this._showContentViewForIdentifier(event.data.pathComponent.representedObject);}};WebInspector.SVGImageResourceClusterContentView.ContentViewIdentifierCookieKey="svg-image-resource-cluster-content-view-identifier";WebInspector.SVGImageResourceClusterContentView.Identifier={Image:"image",Source:"source",};WebInspector.StackTraceView=class StackTraceView extends WebInspector.Object
{constructor(stackTrace)
{super();var element=this._element=document.createElement("div");element.classList.add("stack-trace");for(var callFrame of stackTrace.callFrames){if(!callFrame.sourceCodeLocation&&callFrame.functionName===null)
continue;if(callFrame.isConsoleEvaluation&&!WebInspector.isDebugUIEnabled())
continue;var callFrameElement=new WebInspector.CallFrameView(callFrame,true);element.appendChild(callFrameElement);}}
get element()
{return this._element;}};
WebInspector.StackedLineChart=class StackedLineChart
{constructor(size)
{this._element=document.createElement("div");this._element.classList.add("stacked-line-chart");this._chartElement=this._element.appendChild(createSVGElement("svg"));this._pathElements=[];this._points=[];this.size=size;}
get element()
{return this._element;}
get points()
{return this._points;}
get size()
{return this._size;}
set size(size)
{this._size=size;this._chartElement.setAttribute("width",size.width);this._chartElement.setAttribute("height",size.height);this._chartElement.setAttribute("viewbox",`0 0 ${size.width} ${size.height}`);}
initializeSections(sectionClassNames)
{sectionClassNames.reverse();for(let i=0;i<sectionClassNames.length;++i){let pathElement=this._chartElement.appendChild(createSVGElement("path"));pathElement.classList.add(sectionClassNames[i]);this._pathElements.push(pathElement);}
this._pathElements.reverse();}
addPointSet(x,ys)
{this._points.push({x,ys});}
clear()
{this._points=[];}
needsLayout()
{if(this._scheduledLayoutUpdateIdentifier)
return;this._scheduledLayoutUpdateIdentifier=requestAnimationFrame(this.updateLayout.bind(this));}
updateLayout()
{if(this._scheduledLayoutUpdateIdentifier){cancelAnimationFrame(this._scheduledLayoutUpdateIdentifier);this._scheduledLayoutUpdateIdentifier=undefined;}
let pathComponents=[];let length=this._pathElements.length;for(let i=0;i<length;++i)
pathComponents[i]=[`M 0 ${this._size.height}`];for(let{x,ys}of this._points){for(let i=0;i<length;++i)
pathComponents[i].push(`L ${x} ${ys[i]}`);}
let lastX=this._points.length?this._points.lastValue.x:0;for(let i=0;i<length;++i){pathComponents[i].push(`L ${lastX} ${this._size.height}`);pathComponents[i].push("Z");let pathString=pathComponents[i].join(" ");this._pathElements[i].setAttribute("d",pathString);}}};WebInspector.StorageSidebarPanel=class StorageSidebarPanel extends WebInspector.NavigationSidebarPanel
{constructor(contentBrowser)
{super("storage",WebInspector.UIString("Storage"));this.contentBrowser=contentBrowser;this.filterBar.placeholder=WebInspector.UIString("Filter Storage List");this._navigationBar=new WebInspector.NavigationBar;this.addSubview(this._navigationBar);var scopeItemPrefix="storage-sidebar-";var scopeBarItems=[];scopeBarItems.push(new WebInspector.ScopeBarItem(scopeItemPrefix+"type-all",WebInspector.UIString("All Storage"),true));var storageTypes=[{identifier:"application-cache",title:WebInspector.UIString("Application Cache"),classes:[WebInspector.ApplicationCacheFrameTreeElement,WebInspector.ApplicationCacheManifestTreeElement]},{identifier:"cookies",title:WebInspector.UIString("Cookies"),classes:[WebInspector.CookieStorageTreeElement]},{identifier:"database",title:WebInspector.UIString("Databases"),classes:[WebInspector.DatabaseHostTreeElement,WebInspector.DatabaseTableTreeElement,WebInspector.DatabaseTreeElement]},{identifier:"indexed-database",title:WebInspector.UIString("Indexed Databases"),classes:[WebInspector.IndexedDatabaseHostTreeElement,WebInspector.IndexedDatabaseObjectStoreTreeElement,WebInspector.IndexedDatabaseTreeElement]},{identifier:"local-storage",title:WebInspector.UIString("Local Storage"),classes:[WebInspector.DOMStorageTreeElement],localStorage:true},{identifier:"session-storage",title:WebInspector.UIString("Session Storage"),classes:[WebInspector.DOMStorageTreeElement],localStorage:false}];storageTypes.sort(function(a,b){return a.title.extendedLocaleCompare(b.title);});for(var info of storageTypes){var scopeBarItem=new WebInspector.ScopeBarItem(scopeItemPrefix+info.identifier,info.title);scopeBarItem.__storageTypeInfo=info;scopeBarItems.push(scopeBarItem);}
this._scopeBar=new WebInspector.ScopeBar("storage-sidebar-scope-bar",scopeBarItems,scopeBarItems[0],true);this._scopeBar.addEventListener(WebInspector.ScopeBar.Event.SelectionChanged,this._scopeBarSelectionDidChange,this);this._navigationBar.addNavigationItem(this._scopeBar);this._localStorageRootTreeElement=null;this._sessionStorageRootTreeElement=null;this._databaseRootTreeElement=null;this._databaseHostTreeElementMap=new Map;this._indexedDatabaseRootTreeElement=null;this._indexedDatabaseHostTreeElementMap=new Map;this._cookieStorageRootTreeElement=null;this._applicationCacheRootTreeElement=null;this._applicationCacheURLTreeElementMap=new Map;WebInspector.storageManager.addEventListener(WebInspector.StorageManager.Event.CookieStorageObjectWasAdded,this._cookieStorageObjectWasAdded,this);WebInspector.storageManager.addEventListener(WebInspector.StorageManager.Event.DOMStorageObjectWasAdded,this._domStorageObjectWasAdded,this);WebInspector.storageManager.addEventListener(WebInspector.StorageManager.Event.DOMStorageObjectWasInspected,this._domStorageObjectWasInspected,this);WebInspector.storageManager.addEventListener(WebInspector.StorageManager.Event.DatabaseWasAdded,this._databaseWasAdded,this);WebInspector.storageManager.addEventListener(WebInspector.StorageManager.Event.DatabaseWasInspected,this._databaseWasInspected,this);WebInspector.storageManager.addEventListener(WebInspector.StorageManager.Event.IndexedDatabaseWasAdded,this._indexedDatabaseWasAdded,this);WebInspector.storageManager.addEventListener(WebInspector.StorageManager.Event.Cleared,this._storageCleared,this);WebInspector.applicationCacheManager.addEventListener(WebInspector.ApplicationCacheManager.Event.FrameManifestAdded,this._frameManifestAdded,this);WebInspector.applicationCacheManager.addEventListener(WebInspector.ApplicationCacheManager.Event.FrameManifestRemoved,this._frameManifestRemoved,this);this.contentTreeOutline.addEventListener(WebInspector.TreeOutline.Event.SelectionDidChange,this._treeSelectionDidChange,this);for(var domStorageObject of WebInspector.storageManager.domStorageObjects)
this._addDOMStorageObject(domStorageObject);for(var cookieStorageObject of WebInspector.storageManager.cookieStorageObjects)
this._addCookieStorageObject(cookieStorageObject);for(var database of WebInspector.storageManager.databases)
this._addDatabase(database);for(var indexedDatabase of WebInspector.storageManager.indexedDatabases)
this._addIndexedDatabase(indexedDatabase);for(var applicationCacheObject of WebInspector.applicationCacheManager.applicationCacheObjects)
this._addFrameManifest(applicationCacheObject);}
get minimumWidth()
{return this._navigationBar.minimumWidth;}
showDefaultContentView()
{}
closed()
{super.closed();WebInspector.storageManager.removeEventListener(null,null,this);WebInspector.applicationCacheManager.removeEventListener(null,null,this);}
hasCustomFilters()
{var selectedScopeBarItem=this._scopeBar.selectedItems[0];return selectedScopeBarItem&&!selectedScopeBarItem.exclusive;}
matchTreeElementAgainstCustomFilters(treeElement,flags)
{var selectedScopeBarItem=this._scopeBar.selectedItems[0];if(!selectedScopeBarItem||selectedScopeBarItem.exclusive)
return true;if(treeElement instanceof WebInspector.FolderTreeElement)
return false;function match()
{for(var constructor of selectedScopeBarItem.__storageTypeInfo.classes){if(constructor===WebInspector.DOMStorageTreeElement&&treeElement instanceof constructor)
return treeElement.representedObject.isLocalStorage()===selectedScopeBarItem.__storageTypeInfo.localStorage;if(treeElement instanceof constructor)
return true;}
return false;}
var matched=match();if(matched)
flags.expandTreeElement=true;return matched;}
_treeSelectionDidChange(event)
{if(!this.visible)
return;let treeElement=event.data.selectedElement;if(!treeElement)
return;if(treeElement instanceof WebInspector.FolderTreeElement||treeElement instanceof WebInspector.DatabaseHostTreeElement||treeElement instanceof WebInspector.IndexedDatabaseHostTreeElement||treeElement instanceof WebInspector.ApplicationCacheManifestTreeElement)
return;if(treeElement instanceof WebInspector.StorageTreeElement||treeElement instanceof WebInspector.DatabaseTableTreeElement||treeElement instanceof WebInspector.DatabaseTreeElement||treeElement instanceof WebInspector.ApplicationCacheFrameTreeElement||treeElement instanceof WebInspector.IndexedDatabaseTreeElement||treeElement instanceof WebInspector.IndexedDatabaseObjectStoreTreeElement||treeElement instanceof WebInspector.IndexedDatabaseObjectStoreIndexTreeElement){WebInspector.showRepresentedObject(treeElement.representedObject);return;}
console.error("Unknown tree element",treeElement);}
_domStorageObjectWasAdded(event)
{this._addDOMStorageObject(event.data.domStorage);}
_addDOMStorageObject(domStorage)
{var storageElement=new WebInspector.DOMStorageTreeElement(domStorage);if(domStorage.isLocalStorage())
this._localStorageRootTreeElement=this._addStorageChild(storageElement,this._localStorageRootTreeElement,WebInspector.UIString("Local Storage"));else
this._sessionStorageRootTreeElement=this._addStorageChild(storageElement,this._sessionStorageRootTreeElement,WebInspector.UIString("Session Storage"));}
_domStorageObjectWasInspected(event)
{var domStorage=event.data.domStorage;var treeElement=this.treeElementForRepresentedObject(domStorage);treeElement.revealAndSelect(true);}
_databaseWasAdded(event)
{this._addDatabase(event.data.database);}
_addDatabase(database)
{let databaseHostElement=this._databaseHostTreeElementMap.get(database.host);if(!databaseHostElement){databaseHostElement=new WebInspector.DatabaseHostTreeElement(database.host);this._databaseHostTreeElementMap.set(database.host,databaseHostElement);this._databaseRootTreeElement=this._addStorageChild(databaseHostElement,this._databaseRootTreeElement,WebInspector.UIString("Databases"));}
let databaseElement=new WebInspector.DatabaseTreeElement(database);databaseHostElement.appendChild(databaseElement);}
_databaseWasInspected(event)
{var database=event.data.database;var treeElement=this.treeElementForRepresentedObject(database);treeElement.revealAndSelect(true);}
_indexedDatabaseWasAdded(event)
{this._addIndexedDatabase(event.data.indexedDatabase);}
_addIndexedDatabase(indexedDatabase)
{let indexedDatabaseHostElement=this._indexedDatabaseHostTreeElementMap.get(indexedDatabase.host);if(!indexedDatabaseHostElement){indexedDatabaseHostElement=new WebInspector.IndexedDatabaseHostTreeElement(indexedDatabase.host);this._indexedDatabaseHostTreeElementMap.set(indexedDatabase.host,indexedDatabaseHostElement);this._indexedDatabaseRootTreeElement=this._addStorageChild(indexedDatabaseHostElement,this._indexedDatabaseRootTreeElement,WebInspector.UIString("Indexed Databases"));}
let indexedDatabaseElement=new WebInspector.IndexedDatabaseTreeElement(indexedDatabase);indexedDatabaseHostElement.appendChild(indexedDatabaseElement);}
_cookieStorageObjectWasAdded(event)
{this._addCookieStorageObject(event.data.cookieStorage);}
_addCookieStorageObject(cookieStorage)
{var cookieElement=new WebInspector.CookieStorageTreeElement(cookieStorage);this._cookieStorageRootTreeElement=this._addStorageChild(cookieElement,this._cookieStorageRootTreeElement,WebInspector.UIString("Cookies"));}
_frameManifestAdded(event)
{this._addFrameManifest(event.data.frameManifest);}
_addFrameManifest(frameManifest)
{let manifest=frameManifest.manifest;let manifestURL=manifest.manifestURL;let applicationCacheManifestElement=this._applicationCacheURLTreeElementMap.get(manifestURL);if(!applicationCacheManifestElement){applicationCacheManifestElement=new WebInspector.ApplicationCacheManifestTreeElement(manifest);this._applicationCacheURLTreeElementMap.set(manifestURL,applicationCacheManifestElement);this._applicationCacheRootTreeElement=this._addStorageChild(applicationCacheManifestElement,this._applicationCacheRootTreeElement,WebInspector.UIString("Application Cache"));}
let frameCacheElement=new WebInspector.ApplicationCacheFrameTreeElement(frameManifest);applicationCacheManifestElement.appendChild(frameCacheElement);}
_frameManifestRemoved(event)
{}
_compareTreeElements(a,b)
{return(a.mainTitle||"").extendedLocaleCompare(b.mainTitle||"");}
_addStorageChild(childElement,parentElement,folderName)
{if(!parentElement){childElement.flattened=true;this.contentTreeOutline.insertChild(childElement,insertionIndexForObjectInListSortedByFunction(childElement,this.contentTreeOutline.children,this._compareTreeElements));return childElement;}
if(parentElement instanceof WebInspector.StorageTreeElement){var previousOnlyChild=parentElement;previousOnlyChild.flattened=false;this.contentTreeOutline.removeChild(previousOnlyChild);var folderElement=new WebInspector.FolderTreeElement(folderName);this.contentTreeOutline.insertChild(folderElement,insertionIndexForObjectInListSortedByFunction(folderElement,this.contentTreeOutline.children,this._compareTreeElements));folderElement.appendChild(previousOnlyChild);folderElement.insertChild(childElement,insertionIndexForObjectInListSortedByFunction(childElement,folderElement.children,this._compareTreeElements));return folderElement;}
parentElement.insertChild(childElement,insertionIndexForObjectInListSortedByFunction(childElement,parentElement.children,this._compareTreeElements));return parentElement;}
_storageCleared(event)
{this.contentBrowser.contentViewContainer.closeAllContentViews();if(this._localStorageRootTreeElement&&this._localStorageRootTreeElement.parent)
this._localStorageRootTreeElement.parent.removeChild(this._localStorageRootTreeElement);if(this._sessionStorageRootTreeElement&&this._sessionStorageRootTreeElement.parent)
this._sessionStorageRootTreeElement.parent.removeChild(this._sessionStorageRootTreeElement);if(this._databaseRootTreeElement&&this._databaseRootTreeElement.parent)
this._databaseRootTreeElement.parent.removeChild(this._databaseRootTreeElement);if(this._indexedDatabaseRootTreeElement&&this._indexedDatabaseRootTreeElement.parent)
this._indexedDatabaseRootTreeElement.parent.removeChild(this._indexedDatabaseRootTreeElement);if(this._cookieStorageRootTreeElement&&this._cookieStorageRootTreeElement.parent)
this._cookieStorageRootTreeElement.parent.removeChild(this._cookieStorageRootTreeElement);if(this._applicationCacheRootTreeElement&&this._applicationCacheRootTreeElement.parent)
this._applicationCacheRootTreeElement.parent.removeChild(this._applicationCacheRootTreeElement);this._localStorageRootTreeElement=null;this._sessionStorageRootTreeElement=null;this._databaseRootTreeElement=null;this._databaseHostTreeElementMap.clear();this._indexedDatabaseRootTreeElement=null;this._indexedDatabaseHostTreeElementMap.clear();this._cookieStorageRootTreeElement=null;this._applicationCacheRootTreeElement=null;this._applicationCacheURLTreeElementMap.clear();}
_scopeBarSelectionDidChange(event)
{this.updateFilter();}};WebInspector.SyntaxHighlightedStyleClassName="syntax-highlighted";WebInspector.syntaxHighlightStringAsDocumentFragment=function(string,mimeType,baseURL)
{var resultFragment=document.createDocumentFragment();function appendText(text,style)
{if(!style){resultFragment.append(text);return;}
var span=document.createElement("span");span.className="cm-"+style;span.textContent=text;resultFragment.appendChild(span);}
mimeType=parseMIMEType(mimeType).type;CodeMirror.runMode(string,mimeType,appendText);return resultFragment;};WebInspector.TextContentView=class TextContentView extends WebInspector.ContentView
{constructor(string,mimeType)
{super(string);this.element.classList.add("text");this._textEditor=new WebInspector.TextEditor;this._textEditor.addEventListener(WebInspector.TextEditor.Event.NumberOfSearchResultsDidChange,this._numberOfSearchResultsDidChange,this);this._textEditor.addEventListener(WebInspector.TextEditor.Event.FormattingDidChange,this._textEditorFormattingDidChange,this);this.addSubview(this._textEditor);this._textEditor.readOnly=true;this._textEditor.mimeType=mimeType;this._textEditor.string=string;var toolTip=WebInspector.UIString("Pretty print");var activatedToolTip=WebInspector.UIString("Original formatting");this._prettyPrintButtonNavigationItem=new WebInspector.ActivateButtonNavigationItem("pretty-print",toolTip,activatedToolTip,"Images/NavigationItemCurleyBraces.svg",13,13);this._prettyPrintButtonNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,this._togglePrettyPrint,this);this._prettyPrintButtonNavigationItem.enabled=this._textEditor.canBeFormatted();var toolTipTypes=WebInspector.UIString("Show type information");var activatedToolTipTypes=WebInspector.UIString("Hide type information");this._showTypesButtonNavigationItem=new WebInspector.ActivateButtonNavigationItem("show-types",toolTipTypes,activatedToolTipTypes,"Images/NavigationItemTypes.svg",13,14);this._showTypesButtonNavigationItem.enabled=false;let toolTipCodeCoverage=WebInspector.UIString("Fade unexecuted code");let activatedToolTipCodeCoverage=WebInspector.UIString("Do not fade unexecuted code");this._codeCoverageButtonNavigationItem=new WebInspector.ActivateButtonNavigationItem("code-coverage",toolTipCodeCoverage,activatedToolTipCodeCoverage,"Images/NavigationItemCodeCoverage.svg",13,14);this._codeCoverageButtonNavigationItem.enabled=false;}
get textEditor()
{return this._textEditor;}
get navigationItems()
{return[this._prettyPrintButtonNavigationItem,this._showTypesButtonNavigationItem,this._codeCoverageButtonNavigationItem];}
revealPosition(position,textRangeToSelect,forceUnformatted)
{this._textEditor.revealPosition(position,textRangeToSelect,forceUnformatted);}
shown()
{super.shown();this._textEditor.shown();}
hidden()
{super.hidden();this._textEditor.hidden();}
closed()
{super.closed();this._textEditor.close();}
get supportsSave()
{return true;}
get saveData()
{var url="web-inspector:///"+encodeURI(WebInspector.UIString("Untitled"))+".txt";return{url,content:this._textEditor.string,forceSaveAs:true};}
get supportsSearch()
{return true;}
get numberOfSearchResults()
{return this._textEditor.numberOfSearchResults;}
get hasPerformedSearch()
{return this._textEditor.currentSearchQuery!==null;}
set automaticallyRevealFirstSearchResult(reveal)
{this._textEditor.automaticallyRevealFirstSearchResult=reveal;}
performSearch(query)
{this._textEditor.performSearch(query);}
searchCleared()
{this._textEditor.searchCleared();}
searchQueryWithSelection()
{return this._textEditor.searchQueryWithSelection();}
revealPreviousSearchResult(changeFocus)
{this._textEditor.revealPreviousSearchResult(changeFocus);}
revealNextSearchResult(changeFocus)
{this._textEditor.revealNextSearchResult(changeFocus);}
_togglePrettyPrint(event)
{var activated=!this._prettyPrintButtonNavigationItem.activated;this._textEditor.updateFormattedState(activated);}
_textEditorFormattingDidChange(event)
{this._prettyPrintButtonNavigationItem.activated=this._textEditor.formatted;}
_numberOfSearchResultsDidChange(event)
{this.dispatchEventToListeners(WebInspector.ContentView.Event.NumberOfSearchResultsDidChange);}};WebInspector.TextNavigationItem=class TextNavigationItem extends WebInspector.NavigationItem
{constructor(identifier,label)
{super(identifier);this._element.classList.add("text");this._element.textContent=label||"";}
get text()
{return this._element.textContent;}
set text(x)
{this._element.textContent=x||"";}};WebInspector.TextResourceContentView=class TextResourceContentView extends WebInspector.ResourceContentView
{constructor(resource)
{super(resource,"text");resource.addEventListener(WebInspector.SourceCode.Event.ContentDidChange,this._sourceCodeContentDidChange,this);this._textEditor=new WebInspector.SourceCodeTextEditor(resource);this._textEditor.addEventListener(WebInspector.TextEditor.Event.ExecutionLineNumberDidChange,this._executionLineNumberDidChange,this);this._textEditor.addEventListener(WebInspector.TextEditor.Event.NumberOfSearchResultsDidChange,this._numberOfSearchResultsDidChange,this);this._textEditor.addEventListener(WebInspector.TextEditor.Event.ContentDidChange,this._textEditorContentDidChange,this);this._textEditor.addEventListener(WebInspector.TextEditor.Event.FormattingDidChange,this._textEditorFormattingDidChange,this);this._textEditor.addEventListener(WebInspector.SourceCodeTextEditor.Event.ContentWillPopulate,this._contentWillPopulate,this);this._textEditor.addEventListener(WebInspector.SourceCodeTextEditor.Event.ContentDidPopulate,this._contentDidPopulate,this);this._textEditor.readOnly=!this._shouldBeEditable();WebInspector.probeManager.addEventListener(WebInspector.ProbeManager.Event.ProbeSetAdded,this._probeSetsChanged,this);WebInspector.probeManager.addEventListener(WebInspector.ProbeManager.Event.ProbeSetRemoved,this._probeSetsChanged,this);var toolTip=WebInspector.UIString("Pretty print");var activatedToolTip=WebInspector.UIString("Original formatting");this._prettyPrintButtonNavigationItem=new WebInspector.ActivateButtonNavigationItem("pretty-print",toolTip,activatedToolTip,"Images/NavigationItemCurleyBraces.svg",13,13);this._prettyPrintButtonNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,this._togglePrettyPrint,this);this._prettyPrintButtonNavigationItem.enabled=false;var toolTipTypes=WebInspector.UIString("Show type information");var activatedToolTipTypes=WebInspector.UIString("Hide type information");this._showTypesButtonNavigationItem=new WebInspector.ActivateButtonNavigationItem("show-types",toolTipTypes,activatedToolTipTypes,"Images/NavigationItemTypes.svg",13,14);this._showTypesButtonNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,this._toggleTypeAnnotations,this);this._showTypesButtonNavigationItem.enabled=false;WebInspector.showJavaScriptTypeInformationSetting.addEventListener(WebInspector.Setting.Event.Changed,this._showJavaScriptTypeInformationSettingChanged,this);let toolTipCodeCoverage=WebInspector.UIString("Fade unexecuted code");let activatedToolTipCodeCoverage=WebInspector.UIString("Do not fade unexecuted code");this._codeCoverageButtonNavigationItem=new WebInspector.ActivateButtonNavigationItem("code-coverage",toolTipCodeCoverage,activatedToolTipCodeCoverage,"Images/NavigationItemCodeCoverage.svg",13,14);this._codeCoverageButtonNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,this._toggleUnexecutedCodeHighlights,this);this._codeCoverageButtonNavigationItem.enabled=false;WebInspector.enableControlFlowProfilerSetting.addEventListener(WebInspector.Setting.Event.Changed,this._enableControlFlowProfilerSettingChanged,this);}
get navigationItems()
{return[this._prettyPrintButtonNavigationItem,this._showTypesButtonNavigationItem,this._codeCoverageButtonNavigationItem];}
get managesOwnIssues()
{return true;}
get textEditor()
{return this._textEditor;}
get supplementalRepresentedObjects()
{var objects=WebInspector.probeManager.probeSets.filter(function(probeSet){return this._resource.contentIdentifier===probeSet.breakpoint.contentIdentifier;},this);
if(!isNaN(this._textEditor.executionLineNumber))
objects.push(WebInspector.debuggerManager.activeCallFrame);return objects;}
revealPosition(position,textRangeToSelect,forceUnformatted)
{this._textEditor.revealPosition(position,textRangeToSelect,forceUnformatted);}
shown()
{super.shown();this._textEditor.shown();}
hidden()
{super.hidden();this._textEditor.hidden();}
closed()
{super.closed();this.resource.removeEventListener(null,null,this);WebInspector.probeManager.removeEventListener(null,null,this);WebInspector.showJavaScriptTypeInformationSetting.removeEventListener(null,null,this);WebInspector.enableControlFlowProfilerSetting.removeEventListener(null,null,this);this._textEditor.close();}
get supportsSave()
{return super.supportsSave||this.resource instanceof WebInspector.CSSStyleSheet;}
get saveData()
{if(this.resource instanceof WebInspector.CSSStyleSheet)
return{url:"web-inspector:///InspectorStyleSheet.css",content:this._textEditor.string,forceSaveAs:true};return{url:this.resource.url,content:this._textEditor.string};}
get supportsSearch()
{return true;}
get numberOfSearchResults()
{return this._textEditor.numberOfSearchResults;}
get hasPerformedSearch()
{return this._textEditor.currentSearchQuery!==null;}
set automaticallyRevealFirstSearchResult(reveal)
{this._textEditor.automaticallyRevealFirstSearchResult=reveal;}
performSearch(query)
{this._textEditor.performSearch(query);}
searchCleared()
{this._textEditor.searchCleared();}
searchQueryWithSelection()
{return this._textEditor.searchQueryWithSelection();}
revealPreviousSearchResult(changeFocus)
{this._textEditor.revealPreviousSearchResult(changeFocus);}
revealNextSearchResult(changeFocus)
{this._textEditor.revealNextSearchResult(changeFocus);}
_contentWillPopulate(event)
{if(this._textEditor.parentView===this)
return;this.removeLoadingIndicator();this.addSubview(this._textEditor);}
_contentDidPopulate(event)
{this._prettyPrintButtonNavigationItem.enabled=this._textEditor.canBeFormatted();this._showTypesButtonNavigationItem.enabled=this._textEditor.canShowTypeAnnotations();this._showTypesButtonNavigationItem.activated=WebInspector.showJavaScriptTypeInformationSetting.value;this._codeCoverageButtonNavigationItem.enabled=this._textEditor.canShowCoverageHints();this._codeCoverageButtonNavigationItem.activated=WebInspector.enableControlFlowProfilerSetting.value;}
_togglePrettyPrint(event)
{var activated=!this._prettyPrintButtonNavigationItem.activated;this._textEditor.updateFormattedState(activated);}
_toggleTypeAnnotations(event)
{this._showTypesButtonNavigationItem.enabled=false;this._textEditor.toggleTypeAnnotations().then(()=>{this._showTypesButtonNavigationItem.enabled=true;});}
_toggleUnexecutedCodeHighlights(event)
{this._codeCoverageButtonNavigationItem.enabled=false;this._textEditor.toggleUnexecutedCodeHighlights().then(()=>{this._codeCoverageButtonNavigationItem.enabled=true;});}
_showJavaScriptTypeInformationSettingChanged(event)
{this._showTypesButtonNavigationItem.activated=WebInspector.showJavaScriptTypeInformationSetting.value;}
_enableControlFlowProfilerSettingChanged(event)
{this._codeCoverageButtonNavigationItem.activated=WebInspector.enableControlFlowProfilerSetting.value;}
_textEditorFormattingDidChange(event)
{this._prettyPrintButtonNavigationItem.activated=this._textEditor.formatted;}
_sourceCodeContentDidChange(event)
{if(this._ignoreSourceCodeContentDidChangeEvent)
return;this._textEditor.string=this.resource.currentRevision.content;}
_textEditorContentDidChange(event)
{this._ignoreSourceCodeContentDidChangeEvent=true;WebInspector.branchManager.currentBranch.revisionForRepresentedObject(this.resource).content=this._textEditor.string;delete this._ignoreSourceCodeContentDidChangeEvent;}
_executionLineNumberDidChange(event)
{this.dispatchEventToListeners(WebInspector.ContentView.Event.SupplementalRepresentedObjectsDidChange);}
_numberOfSearchResultsDidChange(event)
{this.dispatchEventToListeners(WebInspector.ContentView.Event.NumberOfSearchResultsDidChange);}
_probeSetsChanged(event)
{var breakpoint=event.data.probeSet.breakpoint;if(breakpoint.sourceCodeLocation.sourceCode===this.resource)
this.dispatchEventToListeners(WebInspector.ContentView.Event.SupplementalRepresentedObjectsDidChange);}
_shouldBeEditable()
{if(this.resource instanceof WebInspector.CSSStyleSheet)
return true;if(this.resource.type===WebInspector.Resource.Type.Stylesheet&&this.resource.syntheticMIMEType==="text/css")
return true;if(this.resource.urlComponents.scheme==="file")
return true;return false;}};{const selectedStyleClassName="selected";WebInspector.TextToggleButtonNavigationItem=class TextToggleButtonNavigationItem extends WebInspector.ButtonNavigationItem
{constructor(identifier,title)
{super(identifier,title);this._title=title;}
get title()
{return this._title;}
get activated()
{return this.element.classList.contains(selectedStyleClassName);}
set activated(flag)
{this.element.classList.toggle(selectedStyleClassName,flag);}
get additionalClassNames()
{return["text-toggle","button"];}};}
WebInspector.ThreadTreeElement=class ThreadTreeElement extends WebInspector.GeneralTreeElement
{constructor(target)
{super("thread",target.displayName);this._target=target;this._idleTreeElement=new WebInspector.IdleTreeElement;}
get target(){return this._target;}
refresh()
{this.removeChildren();this._updateStatus();let targetData=WebInspector.debuggerManager.dataForTarget(this._target);let callFrames=targetData.callFrames;if(targetData.pausing||!callFrames.length){this.appendChild(this._idleTreeElement);this.expand();return;}
let activeCallFrame=WebInspector.debuggerManager.activeCallFrame;let activeCallFrameTreeElement=null;for(let callFrame of callFrames){let callFrameTreeElement=new WebInspector.CallFrameTreeElement(callFrame);if(callFrame===activeCallFrame)
activeCallFrameTreeElement=callFrameTreeElement;this.appendChild(callFrameTreeElement);}
if(activeCallFrameTreeElement){activeCallFrameTreeElement.select(true,true);activeCallFrameTreeElement.isActiveCallFrame=true;}
let currentStackTrace=targetData.asyncStackTrace;while(currentStackTrace){if(!currentStackTrace.callFrames.length)
break;let boundaryCallFrame;if(currentStackTrace.topCallFrameIsBoundary){boundaryCallFrame=currentStackTrace.callFrames[0];}else{const functionName=WebInspector.UIString("(async)");const nativeCode=true;boundaryCallFrame=new WebInspector.CallFrame(null,null,null,functionName,null,null,nativeCode);}
const isAsyncBoundaryCallFrame=true;this.appendChild(new WebInspector.CallFrameTreeElement(boundaryCallFrame,isAsyncBoundaryCallFrame));let startIndex=currentStackTrace.topCallFrameIsBoundary?1:0;for(let i=startIndex;i<currentStackTrace.callFrames.length;++i)
this.appendChild(new WebInspector.CallFrameTreeElement(currentStackTrace.callFrames[i]));if(currentStackTrace.truncated){let truncatedTreeElement=new WebInspector.GeneralTreeElement("truncated-call-frames",WebInspector.UIString("Call Frames Truncated"));truncatedTreeElement.selectable=false;this.appendChild(truncatedTreeElement);}
currentStackTrace=currentStackTrace.parentStackTrace;}
this.expand();}
onattach()
{super.onattach();this.refresh();this.expand();}
populateContextMenu(contextMenu,event)
{let targetData=WebInspector.debuggerManager.dataForTarget(this._target);contextMenu.appendItem(WebInspector.UIString("Resume Thread"),()=>{WebInspector.debuggerManager.continueUntilNextRunLoop(this._target);},!targetData.paused);super.populateContextMenu(contextMenu,event);}
_updateStatus()
{this.status=null;if(!this.element)
return;let targetData=WebInspector.debuggerManager.dataForTarget(this._target);if(!targetData.paused)
return;if(!this._statusButton){let tooltip=WebInspector.UIString("Resume Thread");this._statusButton=new WebInspector.TreeElementStatusButton(useSVGSymbol("Images/Resume.svg","resume",tooltip));this._statusButton.addEventListener(WebInspector.TreeElementStatusButton.Event.Clicked,()=>{WebInspector.debuggerManager.continueUntilNextRunLoop(this._target);});this._statusButton.element.addEventListener("mousedown",(event)=>{event.stopPropagation();});}
this.status=this._statusButton.element;}};WebInspector.TimelineRecordBar=class TimelineRecordBar extends WebInspector.Object
{constructor(records,renderMode)
{super();this._element=document.createElement("div");this._element.classList.add("timeline-record-bar");this._element[WebInspector.TimelineRecordBar.ElementReferenceSymbol]=this;this.renderMode=renderMode;this.records=records;}
static createCombinedBars(records,secondsPerPixel,graphDataSource,createBarCallback)
{if(!records.length)
return;var startTime=graphDataSource.startTime;var currentTime=graphDataSource.currentTime;var endTime=graphDataSource.endTime;var visibleRecords=[];var usesActiveStartTime=false;var lastRecordType=null;for(var i=0;i<records.length;++i){var record=records[i];if(isNaN(record.startTime))
continue;if(record.endTime<startTime)
continue;if(record.startTime>currentTime||record.startTime>endTime)
break;if(record.usesActiveStartTime)
usesActiveStartTime=true;visibleRecords.push(record);lastRecordType=record.type;}
if(!visibleRecords.length)
return;if(visibleRecords.length===1){createBarCallback(visibleRecords,WebInspector.TimelineRecordBar.RenderMode.Normal);return;}
function compareByActiveStartTime(a,b)
{return a.activeStartTime-b.activeStartTime;}
var minimumDuration=secondsPerPixel*WebInspector.TimelineRecordBar.MinimumWidthPixels;var minimumMargin=secondsPerPixel*WebInspector.TimelineRecordBar.MinimumMarginPixels;if(usesActiveStartTime){var inactiveStartTime=NaN;var inactiveEndTime=NaN;var inactiveRecords=[];for(var i=0;i<visibleRecords.length;++i){var record=visibleRecords[i];if(!isNaN(inactiveStartTime)&&inactiveStartTime+Math.max(inactiveEndTime-inactiveStartTime,minimumDuration)+minimumMargin<=record.startTime){createBarCallback(inactiveRecords,WebInspector.TimelineRecordBar.RenderMode.InactiveOnly);inactiveRecords=[];inactiveStartTime=NaN;inactiveEndTime=NaN;}
if(isNaN(inactiveStartTime))
inactiveStartTime=record.startTime;inactiveEndTime=Math.max(inactiveEndTime||0,record.activeStartTime);inactiveRecords.push(record);}
if(!isNaN(inactiveStartTime))
createBarCallback(inactiveRecords,WebInspector.TimelineRecordBar.RenderMode.InactiveOnly);visibleRecords.sort(compareByActiveStartTime);}
var activeStartTime=NaN;var activeEndTime=NaN;var activeRecords=[];var startTimeProperty=usesActiveStartTime?"activeStartTime":"startTime";for(var i=0;i<visibleRecords.length;++i){var record=visibleRecords[i];var startTime=record[startTimeProperty];if(!isNaN(activeStartTime)&&(activeStartTime+Math.max(activeEndTime-activeStartTime,minimumDuration)+minimumMargin<=startTime||(isNaN(startTime)&&!isNaN(activeEndTime)))){createBarCallback(activeRecords,WebInspector.TimelineRecordBar.RenderMode.ActiveOnly);activeRecords=[];activeStartTime=NaN;activeEndTime=NaN;}
if(isNaN(startTime))
continue;if(isNaN(activeStartTime))
activeStartTime=startTime;if(!isNaN(record.endTime))
activeEndTime=Math.max(activeEndTime||0,record.endTime);activeRecords.push(record);}
if(!isNaN(activeStartTime))
createBarCallback(activeRecords,WebInspector.TimelineRecordBar.RenderMode.ActiveOnly);}
static fromElement(element)
{return element[WebInspector.TimelineRecordBar.ElementReferenceSymbol]||null;}
get element()
{return this._element;}
get renderMode()
{return this._renderMode;}
set renderMode(renderMode)
{this._renderMode=renderMode||WebInspector.TimelineRecordBar.RenderMode.Normal;}
get records()
{return this._records;}
set records(records)
{let oldRecordType;let oldRecordEventType;let oldRecordUsesActiveStartTime=false;if(this._records&&this._records.length){let oldRecord=this._records[0];oldRecordType=oldRecord.type;oldRecordEventType=oldRecord.eventType;oldRecordUsesActiveStartTime=oldRecord.usesActiveStartTime;}
records=records||[];this._records=records;if(this._records.length){let newRecord=this._records[0];if(newRecord.type!==oldRecordType){this._element.classList.remove(oldRecordType);this._element.classList.add(newRecord.type);}
if(newRecord.eventType!==oldRecordEventType){this._element.classList.remove(oldRecordEventType);this._element.classList.add(newRecord.eventType);}
if(newRecord.usesActiveStartTime!==oldRecordUsesActiveStartTime)
this._element.classList.toggle("has-inactive-segment",newRecord.usesActiveStartTime);}else
this._element.classList.remove(oldRecordType,oldRecordEventType,"has-inactive-segment");}
refresh(graphDataSource)
{if(isNaN(graphDataSource.secondsPerPixel))
return;if(!this._records||!this._records.length)
return false;var firstRecord=this._records[0];var barStartTime=firstRecord.startTime;if(isNaN(barStartTime))
return false;var graphStartTime=graphDataSource.startTime;var graphEndTime=graphDataSource.endTime;var graphCurrentTime=graphDataSource.currentTime;var barEndTime=this._records.reduce(function(previousValue,currentValue){return Math.max(previousValue,currentValue.endTime);},0);if(barStartTime>graphCurrentTime)
return false;if(barEndTime<graphStartTime||barStartTime>graphEndTime)
return false;var barUnfinished=isNaN(barEndTime)||barEndTime>=graphCurrentTime;if(barUnfinished)
barEndTime=graphCurrentTime;var graphDuration=graphEndTime-graphStartTime;let newBarPosition=(barStartTime-graphStartTime)/graphDuration;let property=WebInspector.resolvedLayoutDirection()===WebInspector.LayoutDirection.RTL?"right":"left";this._updateElementPosition(this._element,newBarPosition,property);var newBarWidth=((barEndTime-graphStartTime)/graphDuration)-newBarPosition;this._updateElementPosition(this._element,newBarWidth,"width");if(!this._activeBarElement&&this._renderMode!==WebInspector.TimelineRecordBar.RenderMode.InactiveOnly){this._activeBarElement=document.createElement("div");this._activeBarElement.classList.add("segment");}
if(!firstRecord.usesActiveStartTime){this._element.classList.toggle("unfinished",barUnfinished);if(this._inactiveBarElement)
this._inactiveBarElement.remove();if(this._renderMode===WebInspector.TimelineRecordBar.RenderMode.InactiveOnly){if(this._activeBarElement)
this._activeBarElement.remove();return false;}
this._activeBarElement.style.removeProperty(WebInspector.resolvedLayoutDirection()===WebInspector.LayoutDirection.RTL?"right":"left");this._activeBarElement.style.removeProperty("width");if(!this._activeBarElement.parentNode)
this._element.appendChild(this._activeBarElement);return true;}
if(this._renderMode===WebInspector.TimelineRecordBar.RenderMode.ActiveOnly)
var barActiveStartTime=this._records.reduce(function(previousValue,currentValue){return Math.min(previousValue,currentValue.activeStartTime);},Infinity);else
var barActiveStartTime=this._records.reduce(function(previousValue,currentValue){return Math.max(previousValue,currentValue.activeStartTime);},0);var barDuration=barEndTime-barStartTime;var inactiveUnfinished=isNaN(barActiveStartTime)||barActiveStartTime>=graphCurrentTime;this._element.classList.toggle("unfinished",inactiveUnfinished);if(inactiveUnfinished)
barActiveStartTime=graphCurrentTime;else if(this._renderMode===WebInspector.TimelineRecordBar.RenderMode.Normal){let minimumSegmentDuration=graphDataSource.secondsPerPixel*WebInspector.TimelineRecordBar.MinimumWidthPixels;if(barActiveStartTime-barStartTime<minimumSegmentDuration){barActiveStartTime=barStartTime;if(this._inactiveBarElement)
this._inactiveBarElement.remove();}}
let showInactiveSegment=barActiveStartTime>barStartTime;this._element.classList.toggle("has-inactive-segment",showInactiveSegment);let middlePercentage=(barActiveStartTime-barStartTime)/barDuration;if(showInactiveSegment&&this._renderMode!==WebInspector.TimelineRecordBar.RenderMode.ActiveOnly){if(!this._inactiveBarElement){this._inactiveBarElement=document.createElement("div");this._inactiveBarElement.classList.add("segment");this._inactiveBarElement.classList.add("inactive");}
let property=WebInspector.resolvedLayoutDirection()===WebInspector.LayoutDirection.RTL?"left":"right";this._updateElementPosition(this._inactiveBarElement,1-middlePercentage,property);this._updateElementPosition(this._inactiveBarElement,middlePercentage,"width");if(!this._inactiveBarElement.parentNode)
this._element.insertBefore(this._inactiveBarElement,this._element.firstChild);}
if(!inactiveUnfinished&&this._renderMode!==WebInspector.TimelineRecordBar.RenderMode.InactiveOnly){let property=WebInspector.resolvedLayoutDirection()===WebInspector.LayoutDirection.RTL?"right":"left";this._updateElementPosition(this._activeBarElement,middlePercentage,property);this._updateElementPosition(this._activeBarElement,1-middlePercentage,"width");if(!this._activeBarElement.parentNode)
this._element.appendChild(this._activeBarElement);}else if(this._activeBarElement)
this._activeBarElement.remove();return true;}
_updateElementPosition(element,newPosition,property)
{newPosition*=100;let newPositionAprox=Math.round(newPosition*100);let currentPositionAprox=Math.round(parseFloat(element.style[property])*100);if(currentPositionAprox!==newPositionAprox)
element.style[property]=(newPositionAprox/100)+"%";}};WebInspector.TimelineRecordBar.ElementReferenceSymbol=Symbol("timeline-record-bar");WebInspector.TimelineRecordBar.MinimumWidthPixels=4;WebInspector.TimelineRecordBar.MinimumMarginPixels=1;WebInspector.TimelineRecordBar.RenderMode={Normal:"timeline-record-bar-normal-render-mode",InactiveOnly:"timeline-record-bar-inactive-only-render-mode",ActiveOnly:"timeline-record-bar-active-only-render-mode"};WebInspector.TimelineRecordFrame=class TimelineRecordFrame extends WebInspector.Object
{constructor(graphDataSource,record)
{super();this._element=document.createElement("div");this._element.classList.add("timeline-record-frame");this._graphDataSource=graphDataSource;this._record=record||null;this._filtered=false;}
get element()
{return this._element;}
get record()
{return this._record;}
set record(record)
{this._record=record;}
get selected()
{return this._element.classList.contains("selected");}
set selected(x)
{if(this.selected===x)
return;this._element.classList.toggle("selected");}
get filtered()
{return this._filtered;}
set filtered(x)
{if(this._filtered===x)
return;this._filtered=x;this._element.classList.toggle("filtered");}
refresh(graphDataSource)
{if(!this._record)
return false;var frameIndex=this._record.frameIndex;var graphStartFrameIndex=Math.floor(graphDataSource.startTime);var graphEndFrameIndex=graphDataSource.endTime;if(frameIndex<graphStartFrameIndex||frameIndex>graphEndFrameIndex)
return false;this._element.style.width=(1/graphDataSource.timelineOverview.secondsPerPixel)+"px";var graphDuration=graphDataSource.endTime-graphDataSource.startTime;let recordPosition=(frameIndex-graphDataSource.startTime)/graphDuration;let property=WebInspector.resolvedLayoutDirection()===WebInspector.LayoutDirection.RTL?"right":"left";this._updateElementPosition(this._element,recordPosition,property);this._updateChildElements(graphDataSource);return true;}
_calculateFrameDisplayData(graphDataSource)
{var secondsPerBlock=(graphDataSource.graphHeightSeconds/graphDataSource.height)*WebInspector.TimelineRecordFrame.MinimumHeightPixels;var segments=[];var invisibleSegments=[];var currentSegment=null;function updateDurationRemainder(segment)
{if(segment.duration<=secondsPerBlock){segment.remainder=0;return;}
var roundedDuration=Math.roundTo(segment.duration,secondsPerBlock);segment.remainder=Math.max(segment.duration-roundedDuration,0);}
function pushCurrentSegment()
{updateDurationRemainder(currentSegment);segments.push(currentSegment);if(currentSegment.duration<secondsPerBlock)
invisibleSegments.push({segment:currentSegment,index:segments.length-1});currentSegment=null;}
for(var key in WebInspector.RenderingFrameTimelineRecord.TaskType){var taskType=WebInspector.RenderingFrameTimelineRecord.TaskType[key];var duration=this._record.durationForTask(taskType);if(duration===0)
continue;if(currentSegment&&duration>=secondsPerBlock)
pushCurrentSegment();if(!currentSegment)
currentSegment={taskType:null,longestTaskDuration:0,duration:0,remainder:0};currentSegment.duration+=duration;if(duration>currentSegment.longestTaskDuration){currentSegment.taskType=taskType;currentSegment.longestTaskDuration=duration;}
if(currentSegment.duration>=secondsPerBlock)
pushCurrentSegment();}
if(currentSegment)
pushCurrentSegment();if(segments.length===1){segments[0].duration=Math.max(segments[0].duration,secondsPerBlock);invisibleSegments=[];}
invisibleSegments.sort(function(a,b){return a.segment.duration-b.segment.duration;});for(var item of invisibleSegments){var segment=item.segment;var previousSegment=item.index>0?segments[item.index-1]:null;var nextSegment=item.index<segments.length-1?segments[item.index+1]:null;var adjacentSegments;var availableDuration;if(previousSegment&&nextSegment){adjacentSegments=previousSegment.remainder>nextSegment.remainder?[previousSegment,nextSegment]:[nextSegment,previousSegment];availableDuration=previousSegment.remainder+nextSegment.remainder;}else{adjacentSegments=[previousSegment||nextSegment];availableDuration=adjacentSegments[0].remainder;}
if(availableDuration<(secondsPerBlock-segment.duration)){var targetSegment;if(previousSegment&&nextSegment)
targetSegment=previousSegment.duration>nextSegment.duration?previousSegment:nextSegment;else
targetSegment=previousSegment||nextSegment;targetSegment.duration+=segment.duration;updateDurationRemainder(targetSegment);continue;}
adjacentSegments.forEach(function(adjacentSegment){if(segment.duration>=secondsPerBlock)
return;var remainder=Math.min(secondsPerBlock-segment.duration,adjacentSegment.remainder);segment.duration+=remainder;adjacentSegment.remainder-=remainder;});}
var frameDuration=0;segments=segments.filter(function(segment){if(segment.duration<secondsPerBlock)
return false;segment.duration=Math.roundTo(segment.duration,secondsPerBlock);frameDuration+=segment.duration;return true;});return{frameDuration,segments};}
_updateChildElements(graphDataSource)
{this._element.removeChildren();if(!this._record)
return;if(graphDataSource.graphHeightSeconds===0)
return;var frameElement=document.createElement("div");frameElement.classList.add("frame");this._element.appendChild(frameElement);if(this._record.__displayData&&this._record.__displayData.graphHeightSeconds!==graphDataSource.graphHeightSeconds)
this._record.__displayData=null;if(!this._record.__displayData){this._record.__displayData=this._calculateFrameDisplayData(graphDataSource);this._record.__displayData.graphHeightSeconds=graphDataSource.graphHeightSeconds;}
var frameHeight=this._record.__displayData.frameDuration/graphDataSource.graphHeightSeconds;if(frameHeight>=0.95)
this._element.classList.add("tall");else
this._element.classList.remove("tall");this._updateElementPosition(frameElement,frameHeight,"height");for(var segment of this._record.__displayData.segments){var element=document.createElement("div");this._updateElementPosition(element,segment.duration/this._record.__displayData.frameDuration,"height");element.classList.add("duration",segment.taskType);frameElement.insertBefore(element,frameElement.firstChild);}}
_updateElementPosition(element,newPosition,property)
{newPosition*=100;let newPositionAprox=Math.round(newPosition*100);let currentPositionAprox=Math.round(parseFloat(element.style[property])*100);if(currentPositionAprox!==newPositionAprox)
element.style[property]=(newPositionAprox/100)+"%";}};WebInspector.TimelineRecordFrame.MinimumHeightPixels=3;WebInspector.TimelineRecordFrame.MaximumWidthPixels=14;WebInspector.TimelineRecordFrame.MinimumWidthPixels=4;WebInspector.TimelineRecordingContentView=class TimelineRecordingContentView extends WebInspector.ContentView
{constructor(recording)
{super(recording);this._recording=recording;this.element.classList.add("timeline-recording");this._timelineOverview=new WebInspector.TimelineOverview(this._recording,this);this._timelineOverview.addEventListener(WebInspector.TimelineOverview.Event.TimeRangeSelectionChanged,this._timeRangeSelectionChanged,this);this._timelineOverview.addEventListener(WebInspector.TimelineOverview.Event.RecordSelected,this._recordSelected,this);this._timelineOverview.addEventListener(WebInspector.TimelineOverview.Event.TimelineSelected,this._timelineSelected,this);this._timelineOverview.addEventListener(WebInspector.TimelineOverview.Event.EditingInstrumentsDidChange,this._editingInstrumentsDidChange,this);this.addSubview(this._timelineOverview);const disableBackForward=true;const disableFindBanner=true;this._timelineContentBrowser=new WebInspector.ContentBrowser(null,this,disableBackForward,disableFindBanner);this._timelineContentBrowser.addEventListener(WebInspector.ContentBrowser.Event.CurrentContentViewDidChange,this._currentContentViewDidChange,this);this._entireRecordingPathComponent=this._createTimelineRangePathComponent(WebInspector.UIString("Entire Recording"));this._timelineSelectionPathComponent=this._createTimelineRangePathComponent();this._timelineSelectionPathComponent.previousSibling=this._entireRecordingPathComponent;this._selectedTimeRangePathComponent=this._entireRecordingPathComponent;this._filterBarNavigationItem=new WebInspector.FilterBarNavigationItem;this._filterBarNavigationItem.filterBar.placeholder=WebInspector.UIString("Filter Records");this._filterBarNavigationItem.filterBar.addEventListener(WebInspector.FilterBar.Event.FilterDidChange,this._filterDidChange,this);this._timelineContentBrowser.navigationBar.addNavigationItem(this._filterBarNavigationItem);this.addSubview(this._timelineContentBrowser);this._clearTimelineNavigationItem=new WebInspector.ButtonNavigationItem("clear-timeline",WebInspector.UIString("Clear Timeline (%s)").format(WebInspector.clearKeyboardShortcut.displayName),"Images/NavigationItemClear.svg",16,16);this._clearTimelineNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,this._clearTimeline,this);this._overviewTimelineView=new WebInspector.OverviewTimelineView(recording);this._overviewTimelineView.secondsPerPixel=this._timelineOverview.secondsPerPixel;this._progressView=new WebInspector.TimelineRecordingProgressView;this._timelineContentBrowser.addSubview(this._progressView);this._timelineViewMap=new Map;this._pathComponentMap=new Map;this._updating=false;this._currentTime=NaN;this._discontinuityStartTime=NaN;this._lastUpdateTimestamp=NaN;this._startTimeNeedsReset=true;this._renderingFrameTimeline=null;this._recording.addEventListener(WebInspector.TimelineRecording.Event.InstrumentAdded,this._instrumentAdded,this);this._recording.addEventListener(WebInspector.TimelineRecording.Event.InstrumentRemoved,this._instrumentRemoved,this);this._recording.addEventListener(WebInspector.TimelineRecording.Event.Reset,this._recordingReset,this);this._recording.addEventListener(WebInspector.TimelineRecording.Event.Unloaded,this._recordingUnloaded,this);WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.Event.CapturingStarted,this._capturingStarted,this);WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.Event.CapturingStopped,this._capturingStopped,this);WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.Paused,this._debuggerPaused,this);WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.Resumed,this._debuggerResumed,this);WebInspector.ContentView.addEventListener(WebInspector.ContentView.Event.SelectionPathComponentsDidChange,this._contentViewSelectionPathComponentDidChange,this);WebInspector.ContentView.addEventListener(WebInspector.ContentView.Event.SupplementalRepresentedObjectsDidChange,this._contentViewSupplementalRepresentedObjectsDidChange,this);WebInspector.TimelineView.addEventListener(WebInspector.TimelineView.Event.RecordWasFiltered,this._recordWasFiltered,this);WebInspector.notifications.addEventListener(WebInspector.Notification.VisibilityStateDidChange,this._inspectorVisibilityStateChanged,this);for(let instrument of this._recording.instruments)
this._instrumentAdded(instrument);this.showOverviewTimelineView();}
showOverviewTimelineView()
{this._timelineContentBrowser.showContentView(this._overviewTimelineView);}
showTimelineViewForTimeline(timeline)
{if(!this._timelineViewMap.has(timeline))
return;this._timelineContentBrowser.showContentView(this._timelineViewMap.get(timeline));}
get supportsSplitContentBrowser()
{return false;}
get selectionPathComponents()
{if(!this._timelineContentBrowser.currentContentView)
return[];let pathComponents=[];let representedObject=this._timelineContentBrowser.currentContentView.representedObject;if(representedObject instanceof WebInspector.Timeline)
pathComponents.push(this._pathComponentMap.get(representedObject));pathComponents.push(this._selectedTimeRangePathComponent);return pathComponents;}
get supplementalRepresentedObjects()
{if(!this._timelineContentBrowser.currentContentView)
return[];return this._timelineContentBrowser.currentContentView.supplementalRepresentedObjects;}
get navigationItems()
{return[this._clearTimelineNavigationItem];}
get handleCopyEvent()
{let currentContentView=this._timelineContentBrowser.currentContentView;return currentContentView&&typeof currentContentView.handleCopyEvent==="function"?currentContentView.handleCopyEvent.bind(currentContentView):null;}
get supportsSave()
{let currentContentView=this._timelineContentBrowser.currentContentView;return currentContentView&&currentContentView.supportsSave;}
get saveData()
{let currentContentView=this._timelineContentBrowser.currentContentView;return currentContentView&&currentContentView.saveData||null;}
get currentTimelineView()
{return this._timelineContentBrowser.currentContentView;}
shown()
{super.shown();this._timelineOverview.shown();this._timelineContentBrowser.shown();this._clearTimelineNavigationItem.enabled=!this._recording.readonly&&!isNaN(this._recording.startTime);this._currentContentViewDidChange();if(!this._updating&&WebInspector.timelineManager.activeRecording===this._recording&&WebInspector.timelineManager.isCapturing())
this._startUpdatingCurrentTime(this._currentTime);}
hidden()
{super.hidden();this._timelineOverview.hidden();this._timelineContentBrowser.hidden();if(this._updating)
this._stopUpdatingCurrentTime();}
closed()
{super.closed();this._timelineContentBrowser.contentViewContainer.closeAllContentViews();this._recording.removeEventListener(null,null,this);WebInspector.timelineManager.removeEventListener(null,null,this);WebInspector.debuggerManager.removeEventListener(null,null,this);WebInspector.ContentView.removeEventListener(null,null,this);}
canGoBack()
{return this._timelineContentBrowser.canGoBack();}
canGoForward()
{return this._timelineContentBrowser.canGoForward();}
goBack()
{this._timelineContentBrowser.goBack();}
goForward()
{this._timelineContentBrowser.goForward();}
handleClearShortcut(event)
{this._clearTimeline();}
contentBrowserTreeElementForRepresentedObject(contentBrowser,representedObject)
{if(!(representedObject instanceof WebInspector.Timeline)&&!(representedObject instanceof WebInspector.TimelineRecording))
return null;let iconClassName;let title;if(representedObject instanceof WebInspector.Timeline){iconClassName=WebInspector.TimelineTabContentView.iconClassNameForTimelineType(representedObject.type);title=WebInspector.UIString("Details");}else{iconClassName=WebInspector.TimelineTabContentView.StopwatchIconStyleClass;title=WebInspector.UIString("Overview");}
const hasChildren=false;return new WebInspector.GeneralTreeElement(iconClassName,title,representedObject,hasChildren);}
timelineOverviewUserSelectedRecord(timelineOverview,timelineRecord)
{let timelineViewForRecord=null;for(let timelineView of this._timelineViewMap.values()){if(timelineView.representedObject.type===timelineRecord.type){timelineViewForRecord=timelineView;break;}}
if(!timelineViewForRecord)
return;this._timelineContentBrowser.showContentView(timelineViewForRecord);timelineViewForRecord.userSelectedRecordFromOverview(timelineRecord);}
_currentContentViewDidChange(event)
{let newViewMode;let timelineView=this.currentTimelineView;if(timelineView&&timelineView.representedObject.type===WebInspector.TimelineRecord.Type.RenderingFrame)
newViewMode=WebInspector.TimelineOverview.ViewMode.RenderingFrames;else
newViewMode=WebInspector.TimelineOverview.ViewMode.Timelines;this._timelineOverview.viewMode=newViewMode;this._updateTimelineOverviewHeight();this._updateProgressView();this._updateFilterBar();if(timelineView){this._updateTimelineViewTimes(timelineView);this._filterDidChange();let timeline=null;if(timelineView.representedObject instanceof WebInspector.Timeline)
timeline=timelineView.representedObject;this._timelineOverview.selectedTimeline=timeline;}
this.dispatchEventToListeners(WebInspector.ContentView.Event.SelectionPathComponentsDidChange);this.dispatchEventToListeners(WebInspector.ContentView.Event.NavigationItemsDidChange);}
_timelinePathComponentSelected(event)
{let selectedTimeline=event.data.pathComponent.representedObject;this.showTimelineViewForTimeline(selectedTimeline);}
_timeRangePathComponentSelected(event)
{let selectedPathComponent=event.data.pathComponent;if(selectedPathComponent===this._selectedTimeRangePathComponent)
return;let timelineRuler=this._timelineOverview.timelineRuler;if(selectedPathComponent===this._entireRecordingPathComponent)
timelineRuler.selectEntireRange();else{let timelineRange=selectedPathComponent.representedObject;timelineRuler.selectionStartTime=timelineRuler.zeroTime+timelineRange.startValue;timelineRuler.selectionEndTime=timelineRuler.zeroTime+timelineRange.endValue;}}
_contentViewSelectionPathComponentDidChange(event)
{if(!this.visible)
return;if(event.target!==this._timelineContentBrowser.currentContentView)
return;this._updateFilterBar();this.dispatchEventToListeners(WebInspector.ContentView.Event.SelectionPathComponentsDidChange);if(this.currentTimelineView===this._overviewTimelineView)
return;let record=null;if(this.currentTimelineView.selectionPathComponents){let recordPathComponent=this.currentTimelineView.selectionPathComponents.find((element)=>element.representedObject instanceof WebInspector.TimelineRecord);record=recordPathComponent?recordPathComponent.representedObject:null;}
this._timelineOverview.selectRecord(event.target.representedObject,record);}
_contentViewSupplementalRepresentedObjectsDidChange(event)
{if(event.target!==this._timelineContentBrowser.currentContentView)
return;this.dispatchEventToListeners(WebInspector.ContentView.Event.SupplementalRepresentedObjectsDidChange);}
_inspectorVisibilityStateChanged()
{if(WebInspector.timelineManager.activeRecording!==this._recording)
return;if(!WebInspector.visible&&this._updating){this._stopUpdatingCurrentTime();return;}
if(!WebInspector.visible)
return;let{startTime,endTime}=this.representedObject;if(!WebInspector.timelineManager.isCapturing()){
this._updateTimes(startTime,endTime,endTime);return;}
this._startUpdatingCurrentTime(endTime);}
_update(timestamp)
{ if(!(WebInspector.tabBrowser.selectedTabContentView instanceof WebInspector.TimelineTabContentView))
return;if(this._waitingToResetCurrentTime){requestAnimationFrame(this._updateCallback);return;}
var startTime=this._recording.startTime;var currentTime=this._currentTime||startTime;var endTime=this._recording.endTime;var timespanSinceLastUpdate=(timestamp-this._lastUpdateTimestamp)/1000||0;currentTime+=timespanSinceLastUpdate;this._updateTimes(startTime,currentTime,endTime);if(!this._updating&&(currentTime>=endTime||isNaN(endTime))){if(this.visible)
this._lastUpdateTimestamp=NaN;return;}
this._lastUpdateTimestamp=timestamp;requestAnimationFrame(this._updateCallback);}
_updateTimes(startTime,currentTime,endTime)
{if(this._startTimeNeedsReset&&!isNaN(startTime)){this._timelineOverview.startTime=startTime;this._overviewTimelineView.zeroTime=startTime;for(let timelineView of this._timelineViewMap.values())
timelineView.zeroTime=startTime;this._startTimeNeedsReset=false;}
this._timelineOverview.endTime=Math.max(endTime,currentTime);this._currentTime=currentTime;this._timelineOverview.currentTime=currentTime;if(this.currentTimelineView)
this._updateTimelineViewTimes(this.currentTimelineView);this._timelineOverview.updateLayoutIfNeeded();if(this.currentTimelineView)
this.currentTimelineView.updateLayoutIfNeeded();}
_startUpdatingCurrentTime(startTime)
{if(this._updating)
return;if(!WebInspector.visible)
return;if(typeof startTime==="number")
this._currentTime=startTime;else if(!isNaN(this._currentTime)){
this._waitingToResetCurrentTime=true;this._recording.addEventListener(WebInspector.TimelineRecording.Event.TimesUpdated,this._recordingTimesUpdated,this);}
this._updating=true;if(!this._updateCallback)
this._updateCallback=this._update.bind(this);requestAnimationFrame(this._updateCallback);}
_stopUpdatingCurrentTime()
{this._updating=false;if(this._waitingToResetCurrentTime){this._recording.removeEventListener(WebInspector.TimelineRecording.Event.TimesUpdated,this._recordingTimesUpdated,this);this._waitingToResetCurrentTime=false;}}
_capturingStarted(event)
{this._updateProgressView();let startTime=event.data.startTime;if(!this._updating)
this._startUpdatingCurrentTime(startTime);this._clearTimelineNavigationItem.enabled=!this._recording.readonly;
if(!isNaN(this._discontinuityStartTime)){this._recording.addDiscontinuity(this._discontinuityStartTime,startTime);this._discontinuityStartTime=NaN;}}
_capturingStopped(event)
{this._updateProgressView();if(this._updating)
this._stopUpdatingCurrentTime();if(this.currentTimelineView)
this._updateTimelineViewTimes(this.currentTimelineView);this._discontinuityStartTime=event.data.endTime||this._currentTime;}
_debuggerPaused(event)
{if(this._updating)
this._stopUpdatingCurrentTime();}
_debuggerResumed(event)
{if(!this._updating)
this._startUpdatingCurrentTime();}
_recordingTimesUpdated(event)
{if(!this._waitingToResetCurrentTime)
return;
for(var timeline of this._recording.timelines.values()){var lastRecord=timeline.records.lastValue;if(!lastRecord)
continue;this._currentTime=Math.max(this._currentTime,lastRecord.startTime);}
this._recording.removeEventListener(WebInspector.TimelineRecording.Event.TimesUpdated,this._recordingTimesUpdated,this);this._waitingToResetCurrentTime=false;}
_clearTimeline(event)
{if(WebInspector.timelineManager.activeRecording===this._recording&&WebInspector.timelineManager.isCapturing())
WebInspector.timelineManager.stopCapturing();this._recording.reset();}
_updateTimelineOverviewHeight()
{if(this._timelineOverview.editingInstruments)
this._timelineOverview.element.style.height="";else{const rulerHeight=23;let styleValue=(rulerHeight+this._timelineOverview.height)+"px";this._timelineOverview.element.style.height=styleValue;this._timelineContentBrowser.element.style.top=styleValue;}}
_instrumentAdded(instrumentOrEvent)
{let instrument=instrumentOrEvent instanceof WebInspector.Instrument?instrumentOrEvent:instrumentOrEvent.data.instrument;let timeline=this._recording.timelineForInstrument(instrument);this._timelineViewMap.set(timeline,WebInspector.ContentView.createFromRepresentedObject(timeline,{recording:this._recording}));if(timeline.type===WebInspector.TimelineRecord.Type.RenderingFrame)
this._renderingFrameTimeline=timeline;let displayName=WebInspector.TimelineTabContentView.displayNameForTimelineType(timeline.type);let iconClassName=WebInspector.TimelineTabContentView.iconClassNameForTimelineType(timeline.type);let pathComponent=new WebInspector.HierarchicalPathComponent(displayName,iconClassName,timeline);pathComponent.addEventListener(WebInspector.HierarchicalPathComponent.Event.SiblingWasSelected,this._timelinePathComponentSelected,this);this._pathComponentMap.set(timeline,pathComponent);this._timelineCountChanged();}
_instrumentRemoved(event)
{let instrument=event.data.instrument;let timeline=this._recording.timelineForInstrument(instrument);let timelineView=this._timelineViewMap.take(timeline);if(this.currentTimelineView===timelineView)
this.showOverviewTimelineView();if(timeline.type===WebInspector.TimelineRecord.Type.RenderingFrame)
this._renderingFrameTimeline=null;this._pathComponentMap.delete(timeline);this._timelineCountChanged();}
_timelineCountChanged()
{var previousPathComponent=null;for(var pathComponent of this._pathComponentMap.values()){if(previousPathComponent){previousPathComponent.nextSibling=pathComponent;pathComponent.previousSibling=previousPathComponent;}
previousPathComponent=pathComponent;}
this._updateTimelineOverviewHeight();}
_recordingReset(event)
{for(let timelineView of this._timelineViewMap.values())
timelineView.reset();this._currentTime=NaN;this._discontinuityStartTime=NaN;if(!this._updating){this._startTimeNeedsReset=true;this._updateTimes(0,0,0);}
this._lastUpdateTimestamp=NaN;this._startTimeNeedsReset=true;this._recording.removeEventListener(WebInspector.TimelineRecording.Event.TimesUpdated,this._recordingTimesUpdated,this);this._waitingToResetCurrentTime=false;this._timelineOverview.reset();this._overviewTimelineView.reset();this._clearTimelineNavigationItem.enabled=false;}
_recordingUnloaded(event)
{WebInspector.timelineManager.removeEventListener(WebInspector.TimelineManager.Event.CapturingStarted,this._capturingStarted,this);WebInspector.timelineManager.removeEventListener(WebInspector.TimelineManager.Event.CapturingStopped,this._capturingStopped,this);}
_timeRangeSelectionChanged(event)
{if(!this.currentTimelineView)
return;this._updateTimelineViewTimes(this.currentTimelineView);let selectedPathComponent;if(this._timelineOverview.timelineRuler.entireRangeSelected)
selectedPathComponent=this._entireRecordingPathComponent;else{let timelineRange=this._timelineSelectionPathComponent.representedObject;timelineRange.startValue=this.currentTimelineView.startTime;timelineRange.endValue=this.currentTimelineView.endTime;if(!(this.currentTimelineView instanceof WebInspector.RenderingFrameTimelineView)){timelineRange.startValue-=this.currentTimelineView.zeroTime;timelineRange.endValue-=this.currentTimelineView.zeroTime;}
this._updateTimeRangePathComponents();selectedPathComponent=this._timelineSelectionPathComponent;}
if(this._selectedTimeRangePathComponent!==selectedPathComponent){this._selectedTimeRangePathComponent=selectedPathComponent;this.dispatchEventToListeners(WebInspector.ContentView.Event.SelectionPathComponentsDidChange);}}
_recordSelected(event)
{let{record,timeline}=event.data;let timelineView=this._timelineViewMap.get(timeline);if(record&&timelineView!==this.currentTimelineView)
this.showTimelineViewForTimeline(timeline);timelineView.selectRecord(record);}
_timelineSelected()
{let timeline=this._timelineOverview.selectedTimeline;if(timeline)
this.showTimelineViewForTimeline(timeline);else
this.showOverviewTimelineView();}
_updateTimeRangePathComponents()
{let timelineRange=this._timelineSelectionPathComponent.representedObject;let startValue=timelineRange.startValue;let endValue=timelineRange.endValue;if(isNaN(startValue)||isNaN(endValue)){this._entireRecordingPathComponent.nextSibling=null;return;}
this._entireRecordingPathComponent.nextSibling=this._timelineSelectionPathComponent;let displayName;if(this._timelineOverview.viewMode===WebInspector.TimelineOverview.ViewMode.Timelines){let selectionStart=Number.secondsToString(startValue,true);let selectionEnd=Number.secondsToString(endValue,true);displayName=WebInspector.UIString("%s \u2013 %s").format(selectionStart,selectionEnd);}else{startValue+=1;if(startValue===endValue)
displayName=WebInspector.UIString("Frame %d").format(startValue);else
displayName=WebInspector.UIString("Frames %d \u2013 %d").format(startValue,endValue);}
this._timelineSelectionPathComponent.displayName=displayName;this._timelineSelectionPathComponent.title=displayName;}
_createTimelineRangePathComponent(title)
{let range=new WebInspector.TimelineRange(NaN,NaN);let pathComponent=new WebInspector.HierarchicalPathComponent(title||enDash,"time-icon",range);pathComponent.addEventListener(WebInspector.HierarchicalPathComponent.Event.SiblingWasSelected,this._timeRangePathComponentSelected,this);return pathComponent;}
_updateTimelineViewTimes(timelineView)
{let timelineRuler=this._timelineOverview.timelineRuler;let entireRangeSelected=timelineRuler.entireRangeSelected;let endTime=this._timelineOverview.selectionStartTime+this._timelineOverview.selectionDuration;if(entireRangeSelected){if(timelineView instanceof WebInspector.RenderingFrameTimelineView){endTime=this._renderingFrameTimeline.records.length;}else{
endTime=isNaN(this._recording.endTime)?this._recording.currentTime:this._recording.endTime;endTime+=timelineRuler.minimumSelectionDuration;}}
timelineView.startTime=this._timelineOverview.selectionStartTime;timelineView.currentTime=this._currentTime;timelineView.endTime=endTime;}
_editingInstrumentsDidChange(event)
{let editingInstruments=this._timelineOverview.editingInstruments;this.element.classList.toggle(WebInspector.TimelineOverview.EditInstrumentsStyleClassName,editingInstruments);this._updateTimelineOverviewHeight();}
_filterDidChange()
{if(!this.currentTimelineView)
return;this.currentTimelineView.updateFilter(this._filterBarNavigationItem.filterBar.filters);}
_recordWasFiltered(event)
{if(event.target!==this.currentTimelineView)
return;let timeline=this.currentTimelineView.representedObject;if(!(timeline instanceof WebInspector.Timeline))
return;let record=event.data.record;let filtered=event.data.filtered;this._timelineOverview.recordWasFiltered(timeline,record,filtered);}
_updateProgressView()
{let isCapturing=WebInspector.timelineManager.isCapturing();this._progressView.visible=isCapturing&&this.currentTimelineView&&!this.currentTimelineView.showsLiveRecordingData;}
_updateFilterBar()
{this._filterBarNavigationItem.hidden=!this.currentTimelineView||!this.currentTimelineView.showsFilterBar;}};WebInspector.TimelineRecordingProgressView=class TimelineRecordingProgressView extends WebInspector.View
{constructor()
{super();this.element.classList.add("recording-progress");let statusElement=document.createElement("div");statusElement.classList.add("status");statusElement.textContent=WebInspector.UIString("Recording Timeline Data");this.element.append(statusElement);let spinner=new WebInspector.IndeterminateProgressSpinner;statusElement.append(spinner.element);this._stopRecordingButtonElement=document.createElement("button");this._stopRecordingButtonElement.textContent=WebInspector.UIString("Stop Recording");this._stopRecordingButtonElement.addEventListener("click",()=>WebInspector.timelineManager.stopCapturing());this.element.append(this._stopRecordingButtonElement);}
get visible(){return this._visible;}
set visible(x)
{if(this._visible===x)
return;this._visible=x;this.element.classList.toggle("hidden",!this._visible);}};WebInspector.TimelineRuler=class TimelineRuler extends WebInspector.View
{constructor()
{super();this.element.classList.add("timeline-ruler");this._headerElement=document.createElement("div");this._headerElement.classList.add("header");this.element.appendChild(this._headerElement);this._markersElement=document.createElement("div");this._markersElement.classList.add("markers");this.element.appendChild(this._markersElement);this._zeroTime=0;this._startTime=0;this._endTime=0;this._duration=NaN;this._secondsPerPixel=0;this._selectionStartTime=0;this._selectionEndTime=Number.MAX_VALUE;this._endTimePinned=false;this._snapInterval=0;this._allowsClippedLabels=false;this._allowsTimeRangeSelection=false;this._minimumSelectionDuration=0.01;this._formatLabelCallback=null;this._timeRangeSelectionChanged=false;this._enabled=true;this._markerElementMap=new Map;}
get enabled()
{return this._enabled;}
set enabled(x)
{if(this._enabled===x)
return;this._enabled=x;this.element.classList.toggle(WebInspector.TreeElementStatusButton.DisabledStyleClassName,!this._enabled);}
get allowsClippedLabels()
{return this._allowsClippedLabels;}
set allowsClippedLabels(x)
{x=!!x;if(this._allowsClippedLabels===x)
return;this._allowsClippedLabels=x;this.needsLayout();}
set formatLabelCallback(x)
{x=x||null;if(this._formatLabelCallback===x)
return;this._formatLabelCallback=x;this.needsLayout();}
get allowsTimeRangeSelection()
{return this._allowsTimeRangeSelection;}
set allowsTimeRangeSelection(x)
{x=!!x;if(this._allowsTimeRangeSelection===x)
return;this._allowsTimeRangeSelection=x;if(x){this._clickEventListener=this._handleClick.bind(this);this._doubleClickEventListener=this._handleDoubleClick.bind(this);this._mouseDownEventListener=this._handleMouseDown.bind(this);this.element.addEventListener("click",this._clickEventListener);this.element.addEventListener("dblclick",this._doubleClickEventListener);this.element.addEventListener("mousedown",this._mouseDownEventListener);this._leftShadedAreaElement=document.createElement("div");this._leftShadedAreaElement.classList.add("shaded-area");this._leftShadedAreaElement.classList.add("left");this._rightShadedAreaElement=document.createElement("div");this._rightShadedAreaElement.classList.add("shaded-area");this._rightShadedAreaElement.classList.add("right");this._leftSelectionHandleElement=document.createElement("div");this._leftSelectionHandleElement.classList.add("selection-handle");this._leftSelectionHandleElement.classList.add("left");this._leftSelectionHandleElement.addEventListener("mousedown",this._handleSelectionHandleMouseDown.bind(this));this._rightSelectionHandleElement=document.createElement("div");this._rightSelectionHandleElement.classList.add("selection-handle");this._rightSelectionHandleElement.classList.add("right");this._rightSelectionHandleElement.addEventListener("mousedown",this._handleSelectionHandleMouseDown.bind(this));this._selectionDragElement=document.createElement("div");this._selectionDragElement.classList.add("selection-drag");this._needsSelectionLayout();}else{this.element.removeEventListener("click",this._clickEventListener);this.element.removeEventListener("dblclick",this._doubleClickEventListener);this.element.removeEventListener("mousedown",this._mouseDownEventListener);this._clickEventListener=null;this._doubleClickEventListener=null;this._mouseDownEventListener=null;this._leftShadedAreaElement.remove();this._rightShadedAreaElement.remove();this._leftSelectionHandleElement.remove();this._rightSelectionHandleElement.remove();this._selectionDragElement.remove();delete this._leftShadedAreaElement;delete this._rightShadedAreaElement;delete this._leftSelectionHandleElement;delete this._rightSelectionHandleElement;delete this._selectionDragElement;}}
get minimumSelectionDuration()
{return this._minimumSelectionDuration;}
set minimumSelectionDuration(x)
{this._minimumSelectionDuration=x;}
get zeroTime()
{return this._zeroTime;}
set zeroTime(x)
{x=x||0;if(this._zeroTime===x)
return;if(this.entireRangeSelected)
this.selectionStartTime=x;this._zeroTime=x;this.needsLayout();}
get startTime()
{return this._startTime;}
set startTime(x)
{x=x||0;if(this._startTime===x)
return;this._startTime=x;if(!isNaN(this._duration))
this._endTime=this._startTime+this._duration;this._currentDividers=null;this.needsLayout();}
get duration()
{if(!isNaN(this._duration))
return this._duration;return this.endTime-this.startTime;}
get endTime()
{if(!this._endTimePinned&&this.layoutPending)
this._recalculate();return this._endTime;}
set endTime(x)
{x=x||0;if(this._endTime===x)
return;this._endTime=x;this._endTimePinned=true;this.needsLayout();}
get secondsPerPixel()
{if(this.layoutPending)
this._recalculate();return this._secondsPerPixel;}
set secondsPerPixel(x)
{x=x||0;if(this._secondsPerPixel===x)
return;this._secondsPerPixel=x;this._endTimePinned=false;this._currentDividers=null;this._currentSliceTime=0;this.needsLayout();}
get snapInterval()
{return this._snapInterval;}
set snapInterval(x)
{if(this._snapInterval===x)
return;this._snapInterval=x;}
get selectionStartTime()
{return this._selectionStartTime;}
set selectionStartTime(x)
{x=this._snapValue(x)||0;if(this._selectionStartTime===x)
return;this._selectionStartTime=x;this._timeRangeSelectionChanged=true;this._needsSelectionLayout();}
get selectionEndTime()
{return this._selectionEndTime;}
set selectionEndTime(x)
{x=this._snapValue(x)||0;if(this._selectionEndTime===x)
return;this._selectionEndTime=x;this._timeRangeSelectionChanged=true;this._needsSelectionLayout();}
get entireRangeSelected()
{return this._selectionStartTime===this._zeroTime&&this._selectionEndTime===Number.MAX_VALUE;}
selectEntireRange()
{this.selectionStartTime=this._zeroTime;this.selectionEndTime=Number.MAX_VALUE;}
addMarker(marker)
{if(this._markerElementMap.has(marker))
return;marker.addEventListener(WebInspector.TimelineMarker.Event.TimeChanged,this._timelineMarkerTimeChanged,this);let markerTime=marker.time-this._startTime;let markerElement=document.createElement("div");markerElement.classList.add(marker.type,"marker");switch(marker.type){case WebInspector.TimelineMarker.Type.LoadEvent:markerElement.title=WebInspector.UIString("Load \u2014 %s").format(Number.secondsToString(markerTime));break;case WebInspector.TimelineMarker.Type.DOMContentEvent:markerElement.title=WebInspector.UIString("DOM Content Loaded \u2014 %s").format(Number.secondsToString(markerTime));break;case WebInspector.TimelineMarker.Type.TimeStamp:if(marker.details)
markerElement.title=WebInspector.UIString("%s \u2014 %s").format(marker.details,Number.secondsToString(markerTime));else
markerElement.title=WebInspector.UIString("Timestamp \u2014 %s").format(Number.secondsToString(markerTime));break;}
this._markerElementMap.set(marker,markerElement);this._needsMarkerLayout();}
clearMarkers()
{for(let markerElement of this._markerElementMap.values())
markerElement.remove();this._markerElementMap.clear();}
elementForMarker(marker)
{return this._markerElementMap.get(marker)||null;}
updateLayoutIfNeeded(layoutReason)
{
if(this.layoutPending){super.updateLayoutIfNeeded(layoutReason);return;}
let visibleWidth=this._recalculate();if(visibleWidth<=0)
return;if(this._scheduledMarkerLayoutUpdateIdentifier)
this._updateMarkers(visibleWidth,this.duration);if(this._scheduledSelectionLayoutUpdateIdentifier)
this._updateSelection(visibleWidth,this.duration);}
needsLayout(layoutReason)
{if(this.layoutPending)
return;if(this._scheduledMarkerLayoutUpdateIdentifier){cancelAnimationFrame(this._scheduledMarkerLayoutUpdateIdentifier);this._scheduledMarkerLayoutUpdateIdentifier=undefined;}
if(this._scheduledSelectionLayoutUpdateIdentifier){cancelAnimationFrame(this._scheduledSelectionLayoutUpdateIdentifier);this._scheduledSelectionLayoutUpdateIdentifier=undefined;}
super.needsLayout(layoutReason);}
layout()
{let visibleWidth=this._recalculate();if(visibleWidth<=0)
return;let duration=this.duration;let pixelsPerSecond=visibleWidth/duration;let dividerCount=Math.round(visibleWidth/WebInspector.TimelineRuler.MinimumDividerSpacing);let sliceTime;if(this._endTimePinned||!this._currentSliceTime){sliceTime=duration/dividerCount;sliceTime=Math.pow(10,Math.ceil(Math.log(sliceTime)/Math.LN10));if(sliceTime*pixelsPerSecond>=5*WebInspector.TimelineRuler.MinimumDividerSpacing)
sliceTime=sliceTime/5;if(sliceTime*pixelsPerSecond>=2*WebInspector.TimelineRuler.MinimumDividerSpacing)
sliceTime=sliceTime/2;this._currentSliceTime=sliceTime;}else{sliceTime=this._currentSliceTime;}
dividerCount=Math.floor(visibleWidth*this.secondsPerPixel/sliceTime);let firstDividerTime=(Math.ceil((this._startTime-this._zeroTime)/sliceTime)*sliceTime)+this._zeroTime;let lastDividerTime=firstDividerTime+sliceTime*dividerCount;if(!this._endTimePinned)
++dividerCount;let dividerData={count:dividerCount,firstTime:firstDividerTime,lastTime:lastDividerTime,};if(Object.shallowEqual(dividerData,this._currentDividers)){this._updateMarkers(visibleWidth,duration);this._updateSelection(visibleWidth,duration);return;}
this._currentDividers=dividerData;let markerDividers=this._markersElement.querySelectorAll("."+WebInspector.TimelineRuler.DividerElementStyleClassName);let dividerElement=this._headerElement.firstChild;for(var i=0;i<=dividerCount;++i){if(!dividerElement){dividerElement=document.createElement("div");dividerElement.className=WebInspector.TimelineRuler.DividerElementStyleClassName;this._headerElement.appendChild(dividerElement);let labelElement=document.createElement("div");labelElement.className=WebInspector.TimelineRuler.DividerLabelElementStyleClassName;dividerElement.appendChild(labelElement);}
let markerDividerElement=markerDividers[i];if(!markerDividerElement){markerDividerElement=document.createElement("div");markerDividerElement.className=WebInspector.TimelineRuler.DividerElementStyleClassName;this._markersElement.appendChild(markerDividerElement);}
let dividerTime=firstDividerTime+(sliceTime*i);let newPosition=(dividerTime-this._startTime)/duration;if(!this._allowsClippedLabels){if(newPosition<0)
continue;if(newPosition>1)
break;if((newPosition*visibleWidth)<WebInspector.TimelineRuler.MinimumLeftDividerSpacing)
continue;}
let property=WebInspector.resolvedLayoutDirection()===WebInspector.LayoutDirection.RTL?"right":"left";this._updatePositionOfElement(dividerElement,newPosition,visibleWidth,property);this._updatePositionOfElement(markerDividerElement,newPosition,visibleWidth,property);dividerElement.firstChild.textContent=isNaN(dividerTime)?"":this._formatDividerLabelText(dividerTime-this._zeroTime);dividerElement=dividerElement.nextSibling;}
while(dividerElement){let nextDividerElement=dividerElement.nextSibling;dividerElement.remove();dividerElement=nextDividerElement;}
for(;i<markerDividers.length;++i)
markerDividers[i].remove();this._updateMarkers(visibleWidth,duration);this._updateSelection(visibleWidth,duration);}
sizeDidChange()
{this._cachedClientWidth=this.element.clientWidth;}
_needsMarkerLayout()
{if(this.layoutPending)
return;if(this._scheduledMarkerLayoutUpdateIdentifier)
return;this._scheduledMarkerLayoutUpdateIdentifier=requestAnimationFrame(()=>{this._scheduledMarkerLayoutUpdateIdentifier=undefined;let visibleWidth=this._cachedClientWidth;if(visibleWidth<=0)
return;this._updateMarkers(visibleWidth,this.duration);});}
_needsSelectionLayout()
{if(!this._allowsTimeRangeSelection)
return;if(this.layoutPending)
return;if(this._scheduledSelectionLayoutUpdateIdentifier)
return;this._scheduledSelectionLayoutUpdateIdentifier=requestAnimationFrame(()=>{this._scheduledSelectionLayoutUpdateIdentifier=undefined;let visibleWidth=this._cachedClientWidth;if(visibleWidth<=0)
return;this._updateSelection(visibleWidth,this.duration);});}
_recalculate()
{let visibleWidth=this._cachedClientWidth;if(visibleWidth<=0)
return 0;let duration;if(this._endTimePinned)
duration=this._endTime-this._startTime;else
duration=visibleWidth*this._secondsPerPixel;this._secondsPerPixel=duration/visibleWidth;if(!this._endTimePinned)
this._endTime=this._startTime+(visibleWidth*this._secondsPerPixel);return visibleWidth;}
_updatePositionOfElement(element,newPosition,visibleWidth,property)
{newPosition*=this._endTimePinned?100:visibleWidth;let newPositionAprox=Math.round(newPosition*100);let currentPositionAprox=Math.round(parseFloat(element.style[property])*100);if(currentPositionAprox!==newPositionAprox)
element.style[property]=(newPositionAprox/100)+(this._endTimePinned?"%":"px");}
_updateMarkers(visibleWidth,duration)
{if(this._scheduledMarkerLayoutUpdateIdentifier){cancelAnimationFrame(this._scheduledMarkerLayoutUpdateIdentifier);this._scheduledMarkerLayoutUpdateIdentifier=undefined;}
for(let[marker,markerElement]of this._markerElementMap){let newPosition=(marker.time-this._startTime)/duration;let property=WebInspector.resolvedLayoutDirection()===WebInspector.LayoutDirection.RTL?"right":"left";this._updatePositionOfElement(markerElement,newPosition,visibleWidth,property);if(!markerElement.parentNode)
this._markersElement.appendChild(markerElement);}}
_updateSelection(visibleWidth,duration)
{if(this._scheduledSelectionLayoutUpdateIdentifier){cancelAnimationFrame(this._scheduledSelectionLayoutUpdateIdentifier);this._scheduledSelectionLayoutUpdateIdentifier=undefined;}
this.element.classList.toggle("allows-time-range-selection",this._allowsTimeRangeSelection);if(!this._allowsTimeRangeSelection)
return;this.element.classList.toggle("selection-hidden",this.entireRangeSelected);if(this.entireRangeSelected){this._dispatchTimeRangeSelectionChangedEvent();return;}
let startTimeClamped=this._selectionStartTime<this._startTime||this._selectionStartTime>this._endTime;let endTimeClamped=this._selectionEndTime<this._startTime||this._selectionEndTime>this._endTime;this.element.classList.toggle("both-handles-clamped",startTimeClamped&&endTimeClamped);let formattedStartTimeText=this._formatDividerLabelText(this._selectionStartTime-this._zeroTime);let formattedEndTimeText=this._formatDividerLabelText(this._selectionEndTime-this._zeroTime);let startProperty=WebInspector.resolvedLayoutDirection()===WebInspector.LayoutDirection.RTL?"right":"left";let newStartPosition=Number.constrain((this._selectionStartTime-this._startTime)/duration,0,1);this._updatePositionOfElement(this._leftShadedAreaElement,newStartPosition,visibleWidth,"width");this._updatePositionOfElement(this._leftSelectionHandleElement,newStartPosition,visibleWidth,startProperty);this._updatePositionOfElement(this._selectionDragElement,newStartPosition,visibleWidth,startProperty);this._leftSelectionHandleElement.classList.toggle("clamped",startTimeClamped);this._leftSelectionHandleElement.classList.toggle("hidden",startTimeClamped&&endTimeClamped&&this._selectionStartTime<this._startTime);this._leftSelectionHandleElement.title=formattedStartTimeText;let endProperty=WebInspector.resolvedLayoutDirection()===WebInspector.LayoutDirection.RTL?"left":"right";let newEndPosition=1-Number.constrain((this._selectionEndTime-this._startTime)/duration,0,1);this._updatePositionOfElement(this._rightShadedAreaElement,newEndPosition,visibleWidth,"width");this._updatePositionOfElement(this._rightSelectionHandleElement,newEndPosition,visibleWidth,endProperty);this._updatePositionOfElement(this._selectionDragElement,newEndPosition,visibleWidth,endProperty);this._rightSelectionHandleElement.classList.toggle("clamped",endTimeClamped);this._rightSelectionHandleElement.classList.toggle("hidden",startTimeClamped&&endTimeClamped&&this._selectionEndTime>this._endTime);this._rightSelectionHandleElement.title=formattedEndTimeText;if(!this._selectionDragElement.parentNode){this.element.appendChild(this._selectionDragElement);this.element.appendChild(this._leftShadedAreaElement);this.element.appendChild(this._leftSelectionHandleElement);this.element.appendChild(this._rightShadedAreaElement);this.element.appendChild(this._rightSelectionHandleElement);}
this._dispatchTimeRangeSelectionChangedEvent();}
_formatDividerLabelText(value)
{if(this._formatLabelCallback)
return this._formatLabelCallback(value);return Number.secondsToString(value,true);}
_snapValue(value)
{if(!value||!this.snapInterval)
return value;return Math.round(value/this.snapInterval)*this.snapInterval;}
_dispatchTimeRangeSelectionChangedEvent()
{if(!this._timeRangeSelectionChanged)
return;this._timeRangeSelectionChanged=false;this.dispatchEventToListeners(WebInspector.TimelineRuler.Event.TimeRangeSelectionChanged);}
_timelineMarkerTimeChanged()
{this._needsMarkerLayout();}
_handleClick(event)
{if(!this._enabled)
return;if(this._mouseMoved)
return;this.element.style.pointerEvents="none";let newTarget=document.elementFromPoint(event.pageX,event.pageY);this.element.style.pointerEvents=null;if(newTarget&&newTarget.click)
newTarget.click();}
_handleDoubleClick(event)
{if(this.entireRangeSelected)
return;this.selectEntireRange();}
_handleMouseDown(event)
{if(event.button!==0||event.ctrlKey)
return;this._selectionIsMove=event.target===this._selectionDragElement;this._rulerBoundingClientRect=this.element.getBoundingClientRect();if(this._selectionIsMove){this._lastMousePosition=event.pageX;var selectionDragElementRect=this._selectionDragElement.getBoundingClientRect();this._moveSelectionMaximumLeftOffset=this._rulerBoundingClientRect.left+(event.pageX-selectionDragElementRect.left);this._moveSelectionMaximumRightOffset=this._rulerBoundingClientRect.right-(selectionDragElementRect.right-event.pageX);}else{if(WebInspector.resolvedLayoutDirection()===WebInspector.LayoutDirection.RTL)
this._mouseDownPosition=this._rulerBoundingClientRect.right-event.pageX;else
this._mouseDownPosition=event.pageX-this._rulerBoundingClientRect.left;}
this._mouseMoved=false;this._mouseMoveEventListener=this._handleMouseMove.bind(this);this._mouseUpEventListener=this._handleMouseUp.bind(this);document.addEventListener("mousemove",this._mouseMoveEventListener);document.addEventListener("mouseup",this._mouseUpEventListener);event.preventDefault();event.stopPropagation();}
_handleMouseMove(event)
{this._mouseMoved=true;let isRTL=WebInspector.resolvedLayoutDirection()===WebInspector.LayoutDirection.RTL;let currentMousePosition;if(this._selectionIsMove){currentMousePosition=Math.max(this._moveSelectionMaximumLeftOffset,Math.min(this._moveSelectionMaximumRightOffset,event.pageX));let positionDelta=0;if(isRTL)
positionDelta=this._lastMousePosition-currentMousePosition;else
positionDelta=currentMousePosition-this._lastMousePosition;let offsetTime=positionDelta*this.secondsPerPixel;let selectionDuration=this.selectionEndTime-this.selectionStartTime;let oldSelectionStartTime=this.selectionStartTime;this.selectionStartTime=Math.max(this.startTime,Math.min(this.selectionStartTime+offsetTime,this.endTime-selectionDuration));this.selectionEndTime=this.selectionStartTime+selectionDuration;if(this.snapInterval){
let snapOffset=this.selectionStartTime-oldSelectionStartTime;if(!snapOffset)
return;let positionDrift=(offsetTime-snapOffset*this.snapInterval)/this.secondsPerPixel;currentMousePosition-=positionDrift;}
this._lastMousePosition=currentMousePosition;}else{if(isRTL)
currentMousePosition=this._rulerBoundingClientRect.right-event.pageX;else
currentMousePosition=event.pageX-this._rulerBoundingClientRect.left;this.selectionStartTime=Math.max(this.startTime,this.startTime+(Math.min(currentMousePosition,this._mouseDownPosition)*this.secondsPerPixel));this.selectionEndTime=Math.min(this.startTime+(Math.max(currentMousePosition,this._mouseDownPosition)*this.secondsPerPixel),this.endTime);this.element.classList.add(WebInspector.TimelineRuler.ResizingSelectionStyleClassName);}
this._updateSelection(this._cachedClientWidth,this.duration);event.preventDefault();event.stopPropagation();}
_handleMouseUp(event)
{if(!this._selectionIsMove){this.element.classList.remove(WebInspector.TimelineRuler.ResizingSelectionStyleClassName);if(this.selectionEndTime-this.selectionStartTime<this.minimumSelectionDuration){let currentMousePosition=0;if(WebInspector.resolvedLayoutDirection()===WebInspector.LayoutDirection.RTL)
currentMousePosition=this._rulerBoundingClientRect.right-event.pageX;else
currentMousePosition=event.pageX-this._rulerBoundingClientRect.left;if(currentMousePosition>this._mouseDownPosition){this.selectionEndTime=Math.min(this.selectionStartTime+this.minimumSelectionDuration,this.endTime);this.selectionStartTime=this.selectionEndTime-this.minimumSelectionDuration;}else{this.selectionStartTime=Math.max(this.startTime,this.selectionEndTime-this.minimumSelectionDuration);this.selectionEndTime=this.selectionStartTime+this.minimumSelectionDuration;}}}
this._dispatchTimeRangeSelectionChangedEvent();document.removeEventListener("mousemove",this._mouseMoveEventListener);document.removeEventListener("mouseup",this._mouseUpEventListener);delete this._mouseMoveEventListener;delete this._mouseUpEventListener;delete this._mouseDownPosition;delete this._lastMousePosition;delete this._selectionIsMove;delete this._rulerBoundingClientRect;delete this._moveSelectionMaximumLeftOffset;delete this._moveSelectionMaximumRightOffset;event.preventDefault();event.stopPropagation();}
_handleSelectionHandleMouseDown(event)
{if(event.button!==0||event.ctrlKey)
return;this._dragHandleIsStartTime=event.target===this._leftSelectionHandleElement;if(WebInspector.resolvedLayoutDirection()===WebInspector.LayoutDirection.RTL)
this._mouseDownPosition=this.element.totalOffsetRight-event.pageX;else
this._mouseDownPosition=event.pageX-this.element.totalOffsetLeft;this._selectionHandleMouseMoveEventListener=this._handleSelectionHandleMouseMove.bind(this);this._selectionHandleMouseUpEventListener=this._handleSelectionHandleMouseUp.bind(this);document.addEventListener("mousemove",this._selectionHandleMouseMoveEventListener);document.addEventListener("mouseup",this._selectionHandleMouseUpEventListener);this.element.classList.add(WebInspector.TimelineRuler.ResizingSelectionStyleClassName);event.preventDefault();event.stopPropagation();}
_handleSelectionHandleMouseMove(event)
{let currentMousePosition=0;if(WebInspector.resolvedLayoutDirection()===WebInspector.LayoutDirection.RTL)
currentMousePosition=this.element.totalOffsetRight-event.pageX;else
currentMousePosition=event.pageX-this.element.totalOffsetLeft;let currentTime=this.startTime+(currentMousePosition*this.secondsPerPixel);if(this.snapInterval)
currentTime=this._snapValue(currentTime);if(event.altKey&&!event.ctrlKey&&!event.metaKey&&!event.shiftKey){if(this._dragHandleIsStartTime){let timeDifference=currentTime-this.selectionStartTime;this.selectionStartTime=Math.max(this.startTime,Math.min(currentTime,this.selectionEndTime-this.minimumSelectionDuration));this.selectionEndTime=Math.min(Math.max(this.selectionStartTime+this.minimumSelectionDuration,this.selectionEndTime-timeDifference),this.endTime);}else{let timeDifference=currentTime-this.selectionEndTime;this.selectionEndTime=Math.min(Math.max(this.selectionStartTime+this.minimumSelectionDuration,currentTime),this.endTime);this.selectionStartTime=Math.max(this.startTime,Math.min(this.selectionStartTime-timeDifference,this.selectionEndTime-this.minimumSelectionDuration));}}else{if(this._dragHandleIsStartTime)
this.selectionStartTime=Math.max(this.startTime,Math.min(currentTime,this.selectionEndTime-this.minimumSelectionDuration));else
this.selectionEndTime=Math.min(Math.max(this.selectionStartTime+this.minimumSelectionDuration,currentTime),this.endTime);}
this._updateSelection(this._cachedClientWidth,this.duration);event.preventDefault();event.stopPropagation();}
_handleSelectionHandleMouseUp(event)
{this.element.classList.remove(WebInspector.TimelineRuler.ResizingSelectionStyleClassName);document.removeEventListener("mousemove",this._selectionHandleMouseMoveEventListener);document.removeEventListener("mouseup",this._selectionHandleMouseUpEventListener);delete this._selectionHandleMouseMoveEventListener;delete this._selectionHandleMouseUpEventListener;delete this._dragHandleIsStartTime;delete this._mouseDownPosition;event.preventDefault();event.stopPropagation();}};WebInspector.TimelineRuler.MinimumLeftDividerSpacing=48;WebInspector.TimelineRuler.MinimumDividerSpacing=64;WebInspector.TimelineRuler.ResizingSelectionStyleClassName="resizing-selection";WebInspector.TimelineRuler.DividerElementStyleClassName="divider";WebInspector.TimelineRuler.DividerLabelElementStyleClassName="label";WebInspector.TimelineRuler.Event={TimeRangeSelectionChanged:"time-ruler-time-range-selection-changed"};WebInspector.TitleView=class TitleView extends WebInspector.View
{constructor(title)
{super();this.element.classList.add("title-view");this.element.textContent=title;}};WebInspector.ToggleButtonNavigationItem=class ToggleButtonNavigationItem extends WebInspector.ButtonNavigationItem
{constructor(identifier,defaultToolTip,alternateToolTip,defaultImage,alternateImage,imageWidth,imageHeight)
{super(identifier,defaultToolTip,defaultImage,imageWidth,imageHeight);this._toggled=false;this._defaultImage=defaultImage;this._alternateImage=alternateImage;this._defaultToolTip=defaultToolTip;this._alternateToolTip=alternateToolTip||defaultToolTip;}
get defaultToolTip()
{return this._defaultToolTip;}
get alternateToolTip()
{return this._alternateToolTip;}
set alternateToolTip(toolTip)
{this._alternateToolTip=toolTip;if(this._toggled)
this.toolTip=this._alternateToolTip;}
get defaultImage()
{return this._defaultImage;}
get alternateImage()
{return this._alternateImage;}
set alternateImage(image)
{this._alternateImage=image;if(this._toggled)
this.image=this._alternateImage;}
get toggled()
{return this._toggled;}
set toggled(flag)
{flag=flag||false;if(this._toggled===flag)
return;this._toggled=flag;if(this._toggled){this.toolTip=this._alternateToolTip;this.image=this._alternateImage;}else{this.toolTip=this._defaultToolTip;this.image=this._defaultImage;}}
get additionalClassNames()
{return["toggle","button"];}};WebInspector.Toolbar=class Toolbar extends WebInspector.NavigationBar
{constructor(element)
{super(element,null,"toolbar");this._controlSectionElement=document.createElement("div");this._controlSectionElement.className=WebInspector.Toolbar.ControlSectionStyleClassName;this.element.appendChild(this._controlSectionElement);this._leftSectionElement=document.createElement("div");this._leftSectionElement.className=WebInspector.Toolbar.ItemSectionStyleClassName+" "+WebInspector.Toolbar.LeftItemSectionStyleClassName;this.element.appendChild(this._leftSectionElement);this._centerLeftSectionElement=document.createElement("div");this._centerLeftSectionElement.className=WebInspector.Toolbar.ItemSectionStyleClassName+" "+WebInspector.Toolbar.CenterLeftItemSectionStyleClassName;this.element.appendChild(this._centerLeftSectionElement);this._centerSectionElement=document.createElement("div");this._centerSectionElement.className=WebInspector.Toolbar.ItemSectionStyleClassName+" "+WebInspector.Toolbar.CenterItemSectionStyleClassName;this.element.appendChild(this._centerSectionElement);this._centerRightSectionElement=document.createElement("div");this._centerRightSectionElement.className=WebInspector.Toolbar.ItemSectionStyleClassName+" "+WebInspector.Toolbar.CenterRightItemSectionStyleClassName;this.element.appendChild(this._centerRightSectionElement);this._rightSectionElement=document.createElement("div");this._rightSectionElement.className=WebInspector.Toolbar.ItemSectionStyleClassName+" "+WebInspector.Toolbar.RightItemSectionStyleClassName;this.element.appendChild(this._rightSectionElement);}
addToolbarItem(toolbarItem,sectionIdentifier)
{var sectionElement;switch(sectionIdentifier){case WebInspector.Toolbar.Section.Control:sectionElement=this._controlSectionElement;break;case WebInspector.Toolbar.Section.Left:sectionElement=this._leftSectionElement;break;case WebInspector.Toolbar.Section.CenterLeft:sectionElement=this._centerLeftSectionElement;break;default:case WebInspector.Toolbar.Section.Center:sectionElement=this._centerSectionElement;break;case WebInspector.Toolbar.Section.CenterRight:sectionElement=this._centerRightSectionElement;break;case WebInspector.Toolbar.Section.Right:sectionElement=this._rightSectionElement;break;}
this.addNavigationItem(toolbarItem,sectionElement);}
layout()
{if(!this._leftSectionElement||!this._centerSectionElement||!this._rightSectionElement)
return;if(WebInspector.debuggableType===WebInspector.DebuggableType.JavaScript){this.element.classList.add(WebInspector.NavigationBar.CollapsedStyleClassName);return;}
this.element.classList.remove(WebInspector.NavigationBar.CollapsedStyleClassName);function isOverflowingToolbar()
{var controlSectionWidth=this._controlSectionElement.realOffsetWidth;var leftSectionWidth=this._leftSectionElement.realOffsetWidth;var centerLeftSectionWidth=this._centerLeftSectionElement.realOffsetWidth;var centerSectionWidth=this._centerSectionElement.realOffsetWidth;var centerRightSectionWidth=this._centerRightSectionElement.realOffsetWidth;var rightSectionWidth=this._rightSectionElement.realOffsetWidth;var toolbarWidth=Math.round(this.element.realOffsetWidth);return Math.round(controlSectionWidth+leftSectionWidth+centerLeftSectionWidth+centerSectionWidth+centerRightSectionWidth+rightSectionWidth)>toolbarWidth;}
if(!isOverflowingToolbar.call(this))
return;this.element.classList.add(WebInspector.NavigationBar.CollapsedStyleClassName);}};WebInspector.Toolbar.StyleClassName="toolbar";WebInspector.Toolbar.ControlSectionStyleClassName="control-section";WebInspector.Toolbar.ItemSectionStyleClassName="item-section";WebInspector.Toolbar.LeftItemSectionStyleClassName="left";WebInspector.Toolbar.CenterLeftItemSectionStyleClassName="center-left";WebInspector.Toolbar.CenterItemSectionStyleClassName="center";WebInspector.Toolbar.CenterRightItemSectionStyleClassName="center-right";WebInspector.Toolbar.RightItemSectionStyleClassName="right";WebInspector.Toolbar.Section={Control:"control",Left:"left",CenterLeft:"center-left",Center:"center",CenterRight:"center-right",Right:"right"};WebInspector.TreeElementStatusButton=class TreeElementStatusButton extends WebInspector.Object
{constructor(element)
{super();this._element=element;this._element.classList.add("status-button");this._element.addEventListener("click",this._clicked.bind(this));}
get element()
{return this._element;}
get hidden()
{return!this._element.classList.contains(WebInspector.TreeElementStatusButton.DisabledStyleClassName);}
set hidden(flag)
{this._element.classList.toggle("hidden",flag);}
get enabled()
{return!this._element.classList.contains(WebInspector.TreeElementStatusButton.DisabledStyleClassName);}
set enabled(flag)
{if(flag)
this._element.classList.remove(WebInspector.TreeElementStatusButton.DisabledStyleClassName);else
this._element.classList.add(WebInspector.TreeElementStatusButton.DisabledStyleClassName);}
_clicked(event)
{if(!this.enabled)
return;event.stopPropagation();this.dispatchEventToListeners(WebInspector.TreeElementStatusButton.Event.Clicked,event);}};WebInspector.TreeElementStatusButton.DisabledStyleClassName="disabled";WebInspector.TreeElementStatusButton.Event={Clicked:"status-button-clicked"};WebInspector.TreeOutlineDataGridSynchronizer=class TreeOutlineDataGridSynchronizer extends WebInspector.Object
{constructor(treeOutline,dataGrid,delegate)
{super();this._treeOutline=treeOutline;this._dataGrid=dataGrid;this._delegate=delegate||null;this._enabled=true;this._treeOutline.element.parentNode.addEventListener("scroll",this._treeOutlineScrolled.bind(this));this._dataGrid.scrollContainer.addEventListener("scroll",this._dataGridScrolled.bind(this));this._treeOutline.__dataGridNode=this._dataGrid;this._dataGrid.addEventListener(WebInspector.DataGrid.Event.ExpandedNode,this._dataGridNodeExpanded,this);this._dataGrid.addEventListener(WebInspector.DataGrid.Event.CollapsedNode,this._dataGridNodeCollapsed,this);this._dataGrid.addEventListener(WebInspector.DataGrid.Event.SelectedNodeChanged,this._dataGridNodeSelected,this);this._dataGrid.element.addEventListener("focus",this._dataGridGainedFocus.bind(this));this._dataGrid.element.addEventListener("blur",this._dataGridLostFocus.bind(this));this._treeOutline.element.addEventListener("focus",this._treeOutlineGainedFocus.bind(this));this._treeOutline.element.addEventListener("blur",this._treeOutlineLostFocus.bind(this));treeOutline.addEventListener(WebInspector.TreeOutline.Event.ElementAdded,this._treeElementAdded,this);treeOutline.addEventListener(WebInspector.TreeOutline.Event.ElementRemoved,this._treeElementRemoved,this);treeOutline.addEventListener(WebInspector.TreeOutline.Event.ElementDisclosureDidChanged,this._treeElementDisclosureDidChange,this);treeOutline.addEventListener(WebInspector.TreeOutline.Event.ElementVisibilityDidChange,this._treeElementVisibilityDidChange,this);treeOutline.addEventListener(WebInspector.TreeOutline.Event.SelectionDidChange,this._treeSelectionDidChange,this);}
get treeOutline()
{return this._treeOutline;}
get dataGrid()
{return this._dataGrid;}
get delegate()
{return this._delegate;}
get enabled()
{return this._enabled;}
set enabled(x)
{this._enabled=x||false;}
associate(treeElement,dataGridNode)
{treeElement.__dataGridNode=dataGridNode;dataGridNode.__treeElement=treeElement;}
synchronize()
{this._dataGrid.scrollContainer.scrollTop=this._treeOutline.element.parentNode.scrollTop;if(this._treeOutline.selectedTreeElement)
this._treeOutline.selectedTreeElement.__dataGridNode.select(true);else if(this._dataGrid.selectedNode)
this._dataGrid.selectedNode.deselect(true);}
treeElementForDataGridNode(dataGridNode)
{return dataGridNode.__treeElement||null;}
dataGridNodeForTreeElement(treeElement)
{if(treeElement.__dataGridNode)
return treeElement.__dataGridNode;if(typeof this._delegate.dataGridNodeForTreeElement==="function"){var dataGridNode=this._delegate.dataGridNodeForTreeElement(treeElement);if(dataGridNode)
this.associate(treeElement,dataGridNode);return dataGridNode;}
return null;}
_treeOutlineScrolled(event)
{if(!this._enabled)
return;if(this._ignoreNextTreeOutlineScrollEvent){this._ignoreNextTreeOutlineScrollEvent=false;return;}
this._ignoreNextDataGridScrollEvent=true;this._dataGrid.scrollContainer.scrollTop=this._treeOutline.element.parentNode.scrollTop;}
_dataGridGainedFocus(event)
{this._treeOutline.element.classList.add("force-focus");}
_dataGridLostFocus(event)
{this._treeOutline.element.classList.remove("force-focus");}
_dataGridScrolled(event)
{if(!this._enabled)
return;if(this._ignoreNextDataGridScrollEvent){this._ignoreNextDataGridScrollEvent=false;return;}
this._ignoreNextTreeOutlineScrollEvent=true;this._treeOutline.element.parentNode.scrollTop=this._dataGrid.scrollContainer.scrollTop;}
_dataGridNodeSelected(event)
{if(!this._enabled)
return;var dataGridNode=this._dataGrid.selectedNode;if(dataGridNode)
dataGridNode.__treeElement.select(true,true,true,true);}
_dataGridNodeExpanded(event)
{if(!this._enabled)
return;var dataGridNode=event.data.dataGridNode;if(!dataGridNode.__treeElement.expanded)
dataGridNode.__treeElement.expand();}
_dataGridNodeCollapsed(event)
{if(!this._enabled)
return;var dataGridNode=event.data.dataGridNode;if(dataGridNode.__treeElement.expanded)
dataGridNode.__treeElement.collapse();}
_treeOutlineGainedFocus(event)
{this._dataGrid.element.classList.add("force-focus");}
_treeOutlineLostFocus(event)
{this._dataGrid.element.classList.remove("force-focus");}
_treeSelectionDidChange(event)
{if(!this._enabled)
return;let treeElement=event.data.selectedElement||event.data.deselectedElement;if(!treeElement)
return;let dataGridNode=treeElement.__dataGridNode;if(event.data.selectedElement)
dataGridNode.select();else
dataGridNode.deselect();}
_treeElementAdded(event)
{if(!this._enabled)
return;let treeElement=event.data.element;let dataGridNode=this.dataGridNodeForTreeElement(treeElement);var parentDataGridNode=treeElement.parent.__dataGridNode;var childIndex=treeElement.parent.children.indexOf(treeElement);parentDataGridNode.insertChild(dataGridNode,childIndex);}
_treeElementRemoved(event)
{if(!this._enabled)
return;let treeElement=event.data.element;let dataGridNode=treeElement.__dataGridNode;if(dataGridNode.parent)
dataGridNode.parent.removeChild(dataGridNode);}
_treeElementDisclosureDidChange(event)
{if(!this._enabled)
return;let treeElement=event.data.element;let dataGridNode=treeElement.__dataGridNode;if(treeElement.expanded)
dataGridNode.expand();else
dataGridNode.collapse();}
_treeElementVisibilityDidChange(event)
{if(!this._enabled)
return;let treeElement=event.data.element;let dataGridNode=treeElement.__dataGridNode;dataGridNode.hidden=treeElement.hidden;}};WebInspector.TypeTokenView=class TypeTokenView extends WebInspector.Object
{constructor(tokenAnnotator,shouldHaveRightMargin,shouldHaveLeftMargin,titleType,functionOrVariableName)
{super();var span=document.createElement("span");span.classList.add("type-token");if(shouldHaveRightMargin)
span.classList.add("type-token-right-spacing");if(shouldHaveLeftMargin)
span.classList.add("type-token-left-spacing");this.element=span;this._tokenAnnotator=tokenAnnotator;this._typeDescription=null;this._colorClass=null;this._popoverTitle=WebInspector.TypeTokenView.titleForPopover(titleType,functionOrVariableName);this._setUpMouseoverHandlers();}
static titleForPopover(titleType,functionOrVariableName)
{if(titleType===WebInspector.TypeTokenView.TitleType.Variable)
return WebInspector.UIString("Type information for variable: %s").format(functionOrVariableName);if(functionOrVariableName)
return WebInspector.UIString("Return type for function: %s").format(functionOrVariableName);return WebInspector.UIString("Return type for anonymous function");}
update(typeDescription)
{this._typeDescription=typeDescription;var title=this._displayTypeName();if(title===this.element.textContent)
return;this.element.textContent=title;var hashString=title[title.length-1]==="?"?title.slice(0,title.length-1):title;if(this._colorClass)
this.element.classList.remove(this._colorClass);this._colorClass=WebInspector.TypeTokenView.ColorClassForType[hashString]||"type-token-default";this.element.classList.add(this._colorClass);}
_setUpMouseoverHandlers()
{var timeoutID=null;this.element.addEventListener("mouseover",function(){function showPopoverAfterDelay()
{timeoutID=null;var domRect=this.element.getBoundingClientRect();var bounds=new WebInspector.Rect(domRect.left,domRect.top,domRect.width,domRect.height);this._tokenAnnotator.sourceCodeTextEditor.showPopoverForTypes(this._typeDescription,bounds,this._popoverTitle);}
if(this._shouldShowPopover())
timeoutID=setTimeout(showPopoverAfterDelay.bind(this),WebInspector.TypeTokenView.DelayHoverTime);}.bind(this));this.element.addEventListener("mouseout",function(){if(timeoutID)
clearTimeout(timeoutID);});}
_shouldShowPopover()
{if(!this._typeDescription.valid)
return false;if(this._typeDescription.typeSet.primitiveTypeNames.length>1)
return true;if(this._typeDescription.structures&&this._typeDescription.structures.length)
return true;return false;}
_displayTypeName()
{if(!this._typeDescription.valid)
return"";var typeSet=this._typeDescription.typeSet;if(this._typeDescription.leastCommonAncestor){if(typeSet.isContainedIn(WebInspector.TypeSet.TypeBit.Object))
return this._typeDescription.leastCommonAncestor;if(typeSet.isContainedIn(WebInspector.TypeSet.TypeBit.Object|WebInspector.TypeSet.NullOrUndefinedTypeBits))
return this._typeDescription.leastCommonAncestor+"?";}
if(typeSet.isContainedIn(WebInspector.TypeSet.TypeBit.Function))
return"Function";if(typeSet.isContainedIn(WebInspector.TypeSet.TypeBit.Undefined))
return"Undefined";if(typeSet.isContainedIn(WebInspector.TypeSet.TypeBit.Null))
return"Null";if(typeSet.isContainedIn(WebInspector.TypeSet.TypeBit.Boolean))
return"Boolean";if(typeSet.isContainedIn(WebInspector.TypeSet.TypeBit.Integer))
return"Integer";if(typeSet.isContainedIn(WebInspector.TypeSet.TypeBit.Number|WebInspector.TypeSet.TypeBit.Integer))
return"Number";if(typeSet.isContainedIn(WebInspector.TypeSet.TypeBit.String))
return"String";if(typeSet.isContainedIn(WebInspector.TypeSet.TypeBit.Symbol))
return"Symbol";if(typeSet.isContainedIn(WebInspector.TypeSet.NullOrUndefinedTypeBits))
return"(?)";if(typeSet.isContainedIn(WebInspector.TypeSet.TypeBit.Function|WebInspector.TypeSet.NullOrUndefinedTypeBits))
return"Function?";if(typeSet.isContainedIn(WebInspector.TypeSet.TypeBit.Boolean|WebInspector.TypeSet.NullOrUndefinedTypeBits))
return"Boolean?";if(typeSet.isContainedIn(WebInspector.TypeSet.TypeBit.Integer|WebInspector.TypeSet.NullOrUndefinedTypeBits))
return"Integer?";if(typeSet.isContainedIn(WebInspector.TypeSet.TypeBit.Number|WebInspector.TypeSet.TypeBit.Integer|WebInspector.TypeSet.NullOrUndefinedTypeBits))
return"Number?";if(typeSet.isContainedIn(WebInspector.TypeSet.TypeBit.String|WebInspector.TypeSet.NullOrUndefinedTypeBits))
return"String?";if(typeSet.isContainedIn(WebInspector.TypeSet.TypeBit.Symbol|WebInspector.TypeSet.NullOrUndefinedTypeBits))
return"Symbol?";if(typeSet.isContainedIn(WebInspector.TypeSet.TypeBit.Object|WebInspector.TypeSet.TypeBit.Function|WebInspector.TypeSet.TypeBit.String))
return"Object";if(typeSet.isContainedIn(WebInspector.TypeSet.TypeBit.Object|WebInspector.TypeSet.TypeBit.Function|WebInspector.TypeSet.TypeBit.String|WebInspector.TypeSet.NullOrUndefinedTypeBits))
return"Object?";return WebInspector.UIString("(many)");}};WebInspector.TypeTokenView.TitleType={Variable:Symbol("title-type-variable"),ReturnStatement:Symbol("title-type-return-statement")};WebInspector.TypeTokenView.ColorClassForType={"String":"type-token-string","Symbol":"type-token-symbol","Function":"type-token-function","Number":"type-token-number","Integer":"type-token-number","Undefined":"type-token-empty","Null":"type-token-empty","(?)":"type-token-empty","Boolean":"type-token-boolean","(many)":"type-token-many"};WebInspector.TypeTokenView.DelayHoverTime=350;WebInspector.TypeTreeElement=class TypeTreeElement extends WebInspector.GeneralTreeElement
{constructor(name,structureDescription,isPrototype)
{super(null,null,null,structureDescription||null,false);this._name=name;this._structureDescription=structureDescription||null;this._isPrototype=isPrototype;this._populated=false;this._autoExpandedChildren=false;this.toggleOnClick=true;this.selectable=false;this.tooltipHandledSeparately=true;this.hasChildren=structureDescription;var displayName=this._isPrototype?WebInspector.UIString("%s Prototype").format(name.replace(/Prototype$/,"")):name;var nameElement=document.createElement("span");nameElement.classList.add("type-name");nameElement.textContent=displayName;this.mainTitle=nameElement;this.addClassName("type-tree-element");if(this._isPrototype)
this.addClassName("prototype");}
get name()
{return this._name;}
get isPrototype()
{return this._isPrototype;}
onpopulate()
{if(this._populated)
return;this._populated=true;var properties=[];for(var name of this._structureDescription.fields){if(name==="")
continue;properties.push({name});}
properties.sort(WebInspector.ObjectTreeView.comparePropertyDescriptors);var optionalProperties=[];for(var name of this._structureDescription.optionalFields){if(name==="")
continue;optionalProperties.push({name:name+"?"});}
optionalProperties.sort(WebInspector.ObjectTreeView.comparePropertyDescriptors);for(var property of properties)
this.appendChild(new WebInspector.TypeTreeElement(property.name,null));for(var property of optionalProperties)
this.appendChild(new WebInspector.TypeTreeElement(property.name,null));if(this._structureDescription.imprecise){var truncatedMessageElement=WebInspector.ObjectTreeView.createEmptyMessageElement(ellipsis);this.appendChild(new WebInspector.TreeElement(truncatedMessageElement,null,false));}
if(!this.children.length){var emptyMessageElement=WebInspector.ObjectTreeView.createEmptyMessageElement(WebInspector.UIString("No Properties"));this.appendChild(new WebInspector.TreeElement(emptyMessageElement,null,false));}
var prototypeStructure=this._structureDescription.prototypeStructure;if(prototypeStructure)
this.appendChild(new WebInspector.TypeTreeElement(prototypeStructure.constructorName,prototypeStructure,true));}
onexpand()
{if(this._autoExpandedChildren)
return;this._autoExpandedChildren=true;var lastChild=this.children[this.children.length-1];if(lastChild&&lastChild.hasChildren&&lastChild.isPrototype&&lastChild.name!=="Object")
lastChild.expand();}};WebInspector.TypeTreeView=class TypeTreeView extends WebInspector.Object
{constructor(typeDescription)
{super();this._typeDescription=typeDescription;this._element=document.createElement("div");this._element.className="type-tree";this._outline=new WebInspector.TreeOutline;this._outline.customIndent=true;this._outline.element.classList.add("type");this._element.appendChild(this._outline.element);this._populate();if(this._outline.children.length===1)
this._outline.children[0].expand();}
get typeDescription()
{return this._typeDescription;}
get element()
{return this._element;}
get treeOutline()
{return this._outline;}
_populate()
{var types=[];for(var structure of this._typeDescription.structures)
types.push({name:structure.constructorName,structure});for(var primitiveName of this._typeDescription.typeSet.primitiveTypeNames)
types.push({name:primitiveName});types.sort(WebInspector.ObjectTreeView.comparePropertyDescriptors);for(var type of types)
this._outline.appendChild(new WebInspector.TypeTreeElement(type.name,type.structure,false));if(this._typeDescription.truncated){var truncatedMessageElement=WebInspector.ObjectTreeView.createEmptyMessageElement(ellipsis);this._outline.appendChild(new WebInspector.TreeElement(truncatedMessageElement,null,false));}
if(!this._outline.children.length){var errorMessageElement=WebInspector.ObjectTreeView.createEmptyMessageElement(WebInspector.UIString("No Properties"));this._outline.appendChild(new WebInspector.TreeElement(errorMessageElement,null,false));}}};WebInspector.WebSocketContentView=class WebSocketContentView extends WebInspector.ContentView
{constructor(resource)
{super(resource);this._resource=resource;this._framesRendered=0;this._lastRenderedReadyState=null;this._showTimeColumn=NetworkAgent.hasEventParameter("webSocketWillSendHandshakeRequest","walltime");this.element.classList.add("web-socket","resource");let columns={data:{}};columns.data.title=WebInspector.UIString("Data");columns.data.sortable=false;columns.data.width="85%";if(this._showTimeColumn)
columns.time={title:WebInspector.UIString("Time"),sortable:true};this._dataGrid=new WebInspector.DataGrid(columns);this._dataGrid.variableHeightRows=true;this.addSubview(this._dataGrid);this._addRow(WebInspector.UIString("WebSocket Connection Established"),this._resource.walltime);this._dataGrid.updateLayout();}
static textForOpcode(opcode)
{switch(opcode){case WebInspector.WebSocketResource.OpCodes.ContinuationFrame:return WebInspector.UIString("Continuation Frame");case WebInspector.WebSocketResource.OpCodes.TextFrame:return WebInspector.UIString("Text Frame");case WebInspector.WebSocketResource.OpCodes.BinaryFrame:return WebInspector.UIString("Binary Frame");case WebInspector.WebSocketResource.OpCodes.ConnectionCloseFrame:return WebInspector.UIString("Connection Close Frame");case WebInspector.WebSocketResource.OpCodes.PingFrame:return WebInspector.UIString("Ping Frame");case WebInspector.WebSocketResource.OpCodes.PongFrame:return WebInspector.UIString("Pong Frame");}}
shown()
{this._updateFrames();this._resource.addEventListener(WebInspector.WebSocketResource.Event.FrameAdded,this._updateFramesSoon,this);this._resource.addEventListener(WebInspector.WebSocketResource.Event.ReadyStateChanged,this._updateFramesSoon,this);}
hidden()
{this._resource.removeEventListener(WebInspector.WebSocketResource.Event.FrameAdded,this._updateFramesSoon,this);this._resource.removeEventListener(WebInspector.WebSocketResource.Event.ReadyStateChanged,this._updateFramesSoon,this);}
_updateFramesSoon()
{this.onNextFrame._updateFrames();}
_updateFrames()
{let shouldScrollToBottom=this._dataGrid.isScrolledToLastRow();let framesLength=this._resource.frames.length;for(let index=this._framesRendered;index<framesLength;index++){let frame=this._resource.frames[index];let{data,isOutgoing,opcode,walltime}=frame;this._addFrame(data,isOutgoing,opcode,walltime);}
this._framesRendered=framesLength;if(this._lastRenderedReadyState!==this._resource.readyState){if(this._resource.readyState===WebInspector.WebSocketResource.ReadyState.Closed)
this._dataGrid.appendChild(new WebInspector.SpanningDataGridNode(WebInspector.UIString("Connection Closed")));this._lastRenderedReadyState=this._resource.readyState;}
if(shouldScrollToBottom)
this._dataGrid.onNextFrame.scrollToLastRow();}
_addFrame(data,isOutgoing,opcode,time)
{let nodeText;let isText=opcode===WebInspector.WebSocketResource.OpCodes.TextFrame;if(isText)
nodeText=data;else
nodeText=WebInspector.WebSocketContentView.textForOpcode(opcode);this._addRow(nodeText,time,{isOutgoing,isText});}
_addRow(data,time,attributes={})
{let node;if(this._showTimeColumn)
node=new WebInspector.WebSocketDataGridNode(Object.shallowMerge({data,time},attributes));else
node=new WebInspector.WebSocketDataGridNode(Object.shallowMerge({data},attributes));this._dataGrid.appendChild(node);if(attributes.isText)
node.element.classList.add("text-frame");else
node.element.classList.add("non-text-frame");if(attributes.isOutgoing)
node.element.classList.add("outgoing");else
node.element.classList.add("incoming");}};WebInspector.WebSocketDataGridNode=class WebSocketDataGridNode extends WebInspector.DataGridNode
{ createCellContent(columnIdentifier)
{if(columnIdentifier==="data"){let fragment=document.createDocumentFragment();if(this._data.isOutgoing){let iconElement=useSVGSymbol("Images/ArrowUp.svg","icon",WebInspector.UIString("Outgoing message"));fragment.appendChild(iconElement);}
fragment.appendChild(document.createTextNode(this._data.data));return fragment;}
if(columnIdentifier==="time")
return this._timeStringFromTimestamp(this._data.time);return super.createCellContent(columnIdentifier);}
appendContextMenuItems(contextMenu)
{let logResult=(result,wasThrown,savedResultIndex)=>{const title=WebInspector.UIString("Selected Frame");const addSpecialUserLogClass=true;const shouldRevealConsole=true;WebInspector.consoleLogViewController.appendImmediateExecutionWithResult(title,result,addSpecialUserLogClass,shouldRevealConsole);};if(this._data.isText){let remoteObject=WebInspector.RemoteObject.fromPrimitiveValue(this._data.data);contextMenu.appendItem(WebInspector.UIString("Log Frame Text"),()=>{WebInspector.runtimeManager.saveResult(remoteObject,(savedResultIndex)=>{logResult(remoteObject,false,savedResultIndex);});});try{JSON.parse(this._data.data);contextMenu.appendItem(WebInspector.UIString("Log Frame Value"),()=>{const options={objectGroup:WebInspector.RuntimeManager.ConsoleObjectGroup,generatePreview:true,saveResult:true,doNotPauseOnExceptionsAndMuteConsole:true,};let expression="("+this._data.data+")";WebInspector.runtimeManager.evaluateInInspectedWindow(expression,options,logResult);});}catch(error){}
contextMenu.appendSeparator();}
return super.appendContextMenuItems(contextMenu);}
_timeStringFromTimestamp(timestamp)
{return new Date(timestamp*1000).toLocaleTimeString();}};WebInspector.WebSocketResourceTreeElement=class WebSocketResourceTreeElement extends WebInspector.ResourceTreeElement
{ onattach()
{super.onattach();this._updateConnectionStatus();this.resource.addEventListener(WebInspector.WebSocketResource.Event.ReadyStateChanged,this._updateConnectionStatus,this);}
ondetach()
{super.ondetach();this.resource.removeEventListener(WebInspector.WebSocketResource.Event.ReadyStateChanged,this._updateConnectionStatus,this);}
populateContextMenu(contextMenu,event)
{contextMenu.appendItem(WebInspector.UIString("Log WebSocket"),()=>{WebInspector.RemoteObject.resolveWebSocket(this._resource,WebInspector.RuntimeManager.ConsoleObjectGroup,(remoteObject)=>{if(!remoteObject)
return;const text=WebInspector.UIString("Selected WebSocket");const addSpecialUserLogClass=true;WebInspector.consoleLogViewController.appendImmediateExecutionWithResult(text,remoteObject,addSpecialUserLogClass);});});contextMenu.appendSeparator();super.populateContextMenu(contextMenu,event);}
_updateConnectionStatus()
{switch(this.resource.readyState){case WebInspector.WebSocketResource.ReadyState.Closed:this.status="";break;case WebInspector.WebSocketResource.ReadyState.Connecting:var connectionIndicatorElement=document.createElement("div");connectionIndicatorElement.classList.add("ready-state","connecting");connectionIndicatorElement.title=WebInspector.UIString("Connecting");this.status=connectionIndicatorElement;break;case WebInspector.WebSocketResource.ReadyState.Open:var connectionIndicatorElement=document.createElement("div");connectionIndicatorElement.classList.add("ready-state","open");connectionIndicatorElement.title=WebInspector.UIString("Open");this.status=connectionIndicatorElement;break;}}};
WebInspector.WorkerTreeElement=class WorkerTreeElement extends WebInspector.ScriptTreeElement
{constructor(target)
{super(target.mainResource);this._target=target;this._target.addEventListener(WebInspector.Target.Event.ResourceAdded,this._resourceAdded,this);this._target.addEventListener(WebInspector.Target.Event.ScriptAdded,this._scriptAdded,this);this._expandedSetting=new WebInspector.Setting("worker-expanded-"+this._target.name.hash,true);this.registerFolderizeSettings("scripts",null,this._target.resourceCollection.resourceCollectionForType(WebInspector.Resource.Type.Script),WebInspector.ResourceTreeElement);this.registerFolderizeSettings("extra-scripts",null,this._target.extraScriptCollection,WebInspector.ScriptTreeElement);for(let[key,value]of Object.entries(WebInspector.Resource.Type)){if(value===WebInspector.Resource.Type.Script)
continue;let folderName=WebInspector.Resource.displayNameForType(value,true);this.registerFolderizeSettings(key,folderName,this._target.resourceCollection.resourceCollectionForType(value),WebInspector.ResourceTreeElement);}
this.updateParentStatus();if(this._expandedSetting.value)
this.expand();}
get target(){return this._target;}
onexpand()
{this._expandedSetting.value=true;}
oncollapse()
{if(this.hasChildren)
this._expandedSetting.value=false;}
onpopulate()
{if(this.children.length&&!this.shouldRefreshChildren)
return;this.shouldRefreshChildren=false;this.removeChildren();this.prepareToPopulate();for(let resource of this._target.resourceCollection.items)
this.addChildForRepresentedObject(resource);for(let script of this._target.extraScriptCollection.items)
this.addChildForRepresentedObject(script);let sourceMaps=this._target.mainResource.sourceMaps;for(let sourceMap of sourceMaps){for(let resource of sourceMap.resources)
this.addChildForRepresentedObject(resource);}}
populateContextMenu(contextMenu,event)
{ WebInspector.appendContextMenuItemsForSourceCode(contextMenu,this.script.resource?this.script.resource:this.script);super.populateContextMenu(contextMenu,event);}
updateSourceMapResources()
{if(!this.treeOutline||!this.treeOutline.includeSourceMapResourceChildren)
return;this.updateParentStatus();if(this._target.mainResource.sourceMaps.length){this.hasChildren=true;this.shouldRefreshChildren=true;}}
onattach()
{WebInspector.GeneralTreeElement.prototype.onattach.call(this);}
compareChildTreeElements(a,b)
{let aIsResource=a instanceof WebInspector.ResourceTreeElement;let bIsResource=b instanceof WebInspector.ResourceTreeElement;if(aIsResource&&bIsResource)
return WebInspector.ResourceTreeElement.compareResourceTreeElements(a,b);if(!aIsResource&&!bIsResource)
return super.compareChildTreeElements(a,b);return aIsResource?1:-1;}
_scriptAdded(event)
{let script=event.data.script;if(!script.url&&!script.sourceURL)
return;this.addRepresentedObjectToNewChildQueue(script);}
_resourceAdded(event)
{this.addRepresentedObjectToNewChildQueue(event.data.resource);}};WebInspector.XHRBreakpointPopover=class XHRBreakpointPopover extends WebInspector.Popover
{constructor(delegate)
{super(delegate);this._result=WebInspector.InputPopover.Result.None;this._type=WebInspector.XHRBreakpoint.Type.Text;this._value=null;this._codeMirror=null;this._targetElement=null;this._preferredEdges=null;this.windowResizeHandler=this._presentOverTargetElement.bind(this);}
get result(){return this._result;}
get type(){return this._type;}
get value(){return this._value;}
show(targetElement,preferredEdges)
{this._targetElement=targetElement;this._preferredEdges=preferredEdges;let contentElement=document.createElement("div");contentElement.classList.add("xhr-breakpoint-content");let label=document.createElement("div");label.classList.add("label");label.textContent=WebInspector.UIString("Break on request with URL:");let editorWrapper=document.createElement("div");editorWrapper.classList.add("editor-wrapper");let selectElement=document.createElement("select");function addOption(text,value)
{let optionElement=document.createElement("option");optionElement.textContent=text;optionElement.value=value;selectElement.append(optionElement);}
addOption(WebInspector.UIString("Containing"),WebInspector.XHRBreakpoint.Type.Text);addOption(WebInspector.UIString("Matching"),WebInspector.XHRBreakpoint.Type.RegularExpression);selectElement.value=this._type;selectElement.addEventListener("change",(event)=>{this._type=event.target.value;this._updateEditor();this._codeMirror.focus();});editorWrapper.append(selectElement,this._createEditor());contentElement.append(label,editorWrapper);this.content=contentElement;this._presentOverTargetElement();}
_createEditor()
{let editorElement=document.createElement("div");editorElement.classList.add("editor");this._codeMirror=WebInspector.CodeMirrorEditor.create(editorElement,{lineWrapping:false,matchBrackets:false,scrollbarStyle:null,value:"",});this._codeMirror.addKeyMap({"Enter":()=>{this._result=WebInspector.InputPopover.Result.Committed;this._value=this._codeMirror.getValue().trim();this.dismiss();},});this._updateEditor();return editorElement;}
_updateEditor()
{let placeholder;let mimeType;if(this._type===WebInspector.XHRBreakpoint.Type.Text){placeholder=WebInspector.UIString("Text");mimeType="text/plain";}else{placeholder=WebInspector.UIString("Regular Expression");mimeType="text/x-regex";}
this._codeMirror.setOption("mode",mimeType);this._codeMirror.setOption("placeholder",placeholder);}
_presentOverTargetElement()
{if(!this._targetElement)
return;let targetFrame=WebInspector.Rect.rectFromClientRect(this._targetElement.getBoundingClientRect());this.present(targetFrame,this._preferredEdges);setTimeout(()=>{this._codeMirror.refresh();this._codeMirror.focus();this.update();},0);}};WebInspector.XHRBreakpointTreeElement=class XHRBreakpointTreeElement extends WebInspector.GeneralTreeElement
{constructor(breakpoint,className,title)
{if(!className)
className=WebInspector.BreakpointTreeElement.GenericLineIconStyleClassName;let subtitle;if(!title){title=WebInspector.UIString("URL");if(breakpoint.type===WebInspector.XHRBreakpoint.Type.Text)
subtitle=doubleQuotedString(breakpoint.url);else
subtitle="/"+breakpoint.url+"/";}
super(["breakpoint",className],title,subtitle,breakpoint);this._statusImageElement=document.createElement("img");this._statusImageElement.classList.add("status-image","resolved");this.status=this._statusImageElement;breakpoint.addEventListener(WebInspector.XHRBreakpoint.Event.DisabledStateDidChange,this._updateStatus,this);this._updateStatus();}
onattach()
{super.onattach();this._boundStatusImageElementClicked=this._statusImageElementClicked.bind(this);this._boundStatusImageElementFocused=this._statusImageElementFocused.bind(this);this._boundStatusImageElementMouseDown=this._statusImageElementMouseDown.bind(this);this._statusImageElement.addEventListener("click",this._boundStatusImageElementClicked);this._statusImageElement.addEventListener("focus",this._boundStatusImageElementFocused);this._statusImageElement.addEventListener("mousedown",this._boundStatusImageElementMouseDown);}
ondetach()
{super.ondetach();this._statusImageElement.removeEventListener("click",this._boundStatusImageElementClicked);this._statusImageElement.removeEventListener("focus",this._boundStatusImageElementFocused);this._statusImageElement.removeEventListener("mousedown",this._boundStatusImageElementMouseDown);this._boundStatusImageElementClicked=null;this._boundStatusImageElementFocused=null;this._boundStatusImageElementMouseDown=null;}
ondelete()
{WebInspector.domDebuggerManager.removeXHRBreakpoint(this.representedObject);return true;}
onenter()
{this._toggleBreakpoint();return true;}
onspace()
{this._toggleBreakpoint();return true;}
populateContextMenu(contextMenu,event)
{let breakpoint=this.representedObject;let label=breakpoint.disabled?WebInspector.UIString("Enable Breakpoint"):WebInspector.UIString("Disable Breakpoint");contextMenu.appendItem(label,this._toggleBreakpoint.bind(this));if(WebInspector.domDebuggerManager.isBreakpointRemovable(breakpoint)){contextMenu.appendSeparator();contextMenu.appendItem(WebInspector.UIString("Delete Breakpoint"),function(){WebInspector.domDebuggerManager.removeXHRBreakpoint(breakpoint);});}}
_statusImageElementClicked(event)
{this._toggleBreakpoint();}
_statusImageElementFocused(event)
{event.stopPropagation();}
_statusImageElementMouseDown(event)
{event.stopPropagation();}
_toggleBreakpoint()
{this.representedObject.disabled=!this.representedObject.disabled;}
_updateStatus()
{this._statusImageElement.classList.toggle("disabled",this.representedObject.disabled);}};WebInspector.VisualStyleDetailsPanel=class VisualStyleDetailsPanel extends WebInspector.StyleDetailsPanel
{constructor(delegate)
{super(delegate,"visual","visual",WebInspector.UIString("Styles \u2014 Visual"));this._currentStyle=null;this._sections={};this._groups={};this._keywords={};this._units={};this._keywords.defaults=["Inherit","Initial","Unset","Revert"];this._keywords.normal=this._keywords.defaults.concat(["Normal"]);this._keywords.boxModel=this._keywords.defaults.concat(["Auto"]);this._keywords.borderStyle={basic:this._keywords.defaults.concat(["None","Hidden","Solid"]),advanced:["Dashed","Dotted","Double","Groove","Inset","Outset","Ridge"]};this._keywords.borderWidth=this._keywords.defaults.concat(["Medium","Thick","Thin"]);this._units.defaultsSansPercent={basic:["px","em"],advanced:["ch","cm","ex","in","mm","pc","pt","rem","vh","vw","vmax","vmin"]};this._units.defaults={basic:["%"].concat(this._units.defaultsSansPercent.basic),advanced:this._units.defaultsSansPercent.advanced};}
refresh(significantChange)
{if(significantChange)
this._selectorSection.update(this._nodeStyles);else
this._updateSections();super.refresh();}
initialLayout()
{ this._selectorSection=new WebInspector.VisualStyleSelectorSection;this._selectorSection.addEventListener(WebInspector.VisualStyleSelectorSection.Event.SelectorChanged,this._updateSections,this);this.element.appendChild(this._selectorSection.element); this._generateSection("display",WebInspector.UIString("Display"));this._generateSection("position",WebInspector.UIString("Position"));this._generateSection("float",WebInspector.UIString("Float and Clear"));this._generateSection("dimensions",WebInspector.UIString("Dimensions"));this._generateSection("margin",WebInspector.UIString("Margin"));this._generateSection("padding",WebInspector.UIString("Padding"));this._generateSection("flexbox",WebInspector.UIString("Flexbox"));this._generateSection("alignment",WebInspector.UIString("Alignment"));this._sections.layout=new WebInspector.DetailsSection("layout",WebInspector.UIString("Layout"),[this._groups.display.section,this._groups.position.section,this._groups.float.section,this._groups.dimensions.section,this._groups.margin.section,this._groups.padding.section,this._groups.flexbox.section,this._groups.alignment.section]);this.element.appendChild(this._sections.layout.element); this._generateSection("content",WebInspector.UIString("Content"));this._generateSection("text-style",WebInspector.UIString("Style"));this._generateSection("font",WebInspector.UIString("Font"));this._generateSection("font-variants",WebInspector.UIString("Variants"));this._generateSection("text-spacing",WebInspector.UIString("Spacing"));this._generateSection("text-shadow",WebInspector.UIString("Shadow"));this._sections.text=new WebInspector.DetailsSection("text",WebInspector.UIString("Text"),[this._groups.content.section,this._groups.textStyle.section,this._groups.font.section,this._groups.fontVariants.section,this._groups.textSpacing.section,this._groups.textShadow.section]);this.element.appendChild(this._sections.text.element); this._generateSection("fill",WebInspector.UIString("Fill"));this._generateSection("stroke",WebInspector.UIString("Stroke"));this._generateSection("background-style",WebInspector.UIString("Style"));this._generateSection("border",WebInspector.UIString("Border"));this._generateSection("outline",WebInspector.UIString("Outline"));this._generateSection("box-shadow",WebInspector.UIString("Box Shadow"));this._generateSection("list-style",WebInspector.UIString("List Styles"));this._sections.background=new WebInspector.DetailsSection("background",WebInspector.UIString("Background"),[this._groups.fill.section,this._groups.stroke.section,this._groups.backgroundStyle.section,this._groups.border.section,this._groups.outline.section,this._groups.boxShadow.section,this._groups.listStyle.section]);this.element.appendChild(this._sections.background.element); this._generateSection("transition",WebInspector.UIString("Transition"));this._generateSection("animation",WebInspector.UIString("Animation"));this._sections.effects=new WebInspector.DetailsSection("effects",WebInspector.UIString("Effects"),[this._groups.transition.section,this._groups.animation.section]);this.element.appendChild(this._sections.effects.element);}
sizeDidChange()
{super.sizeDidChange();let sidebarWidth=this.element.realOffsetWidth;for(let key in this._groups){let group=this._groups[key];if(!group.specifiedWidthProperties)
continue;for(let editor of group.specifiedWidthProperties)
editor.recalculateWidth(sidebarWidth);}}
_generateSection(id,displayName)
{if(!id||!displayName)
return;let camelCaseId=id.toCamelCase();function createOptionsElement(){let container=document.createElement("div");container.title=WebInspector.UIString("Clear modified properties");container.addEventListener("click",this._clearModifiedSection.bind(this,camelCaseId));return container;}
this._groups[camelCaseId]={section:new WebInspector.DetailsSection(id,displayName,[],createOptionsElement.call(this)),properties:{}};let populateFunction=this["_populate"+camelCaseId.capitalize()+"Section"];populateFunction.call(this);}
_updateSections(event)
{this._currentStyle=this._selectorSection.currentStyle();if(!this._currentStyle)
return;let disabled=this._currentStyle[WebInspector.VisualStyleDetailsPanel.StyleDisabledSymbol];this.element.classList.toggle("disabled",!!disabled);if(disabled)
return;for(let key in this._groups)
this._updateProperties(this._groups[key],!!event);if(event){for(let key in this._sections){let section=this._sections[key];let oneSectionExpanded=false;for(let group of section.groups){let camelCaseId=group.identifier.toCamelCase();group.collapsed=!group.expandedByUser&&!this._groupHasSetProperty(this._groups[camelCaseId]);if(!group.collapsed)
oneSectionExpanded=true;}
if(oneSectionExpanded)
section.collapsed=false;}}
let hasMatchedElementPseudoSelector=this._currentStyle.ownerRule&&this._currentStyle.ownerRule.hasMatchedPseudoElementSelector();this._groups.content.section.element.classList.toggle("inactive",!hasMatchedElementPseudoSelector);this._groups.listStyle.section.element.classList.toggle("inactive",hasMatchedElementPseudoSelector);let node=this._nodeStyles.node;let isSVGElement=node.isSVGElement();this._groups.float.section.element.classList.toggle("inactive",isSVGElement);this._groups.border.section.element.classList.toggle("inactive",isSVGElement);this._groups.boxShadow.section.element.classList.toggle("inactive",isSVGElement);this._groups.listStyle.section.element.classList.toggle("inactive",isSVGElement);this._groups.fill.section.element.classList.toggle("inactive",!isSVGElement);this._groups.stroke.section.element.classList.toggle("inactive",!isSVGElement);let isSVGCircle=node.nodeName()==="circle";let isSVGEllipse=node.nodeName()==="ellipse";let isSVGRadialGradient=node.nodeName()==="radialGradient";let isSVGRect=node.nodeName()==="rect";let isSVGLine=node.nodeName()==="line";let isSVGLinearGradient=node.nodeName()==="linearGradient";this._groups.dimensions.section.element.classList.toggle("inactive",!(!isSVGElement||isSVGEllipse||isSVGRect||isSVGCircle||isSVGRadialGradient));this._groups.dimensions.defaultGroup.element.classList.toggle("inactive",!(!isSVGElement||isSVGRect));this._groups.dimensions.svgGroup.element.classList.toggle("inactive",!(isSVGEllipse||isSVGRect||isSVGCircle||isSVGRadialGradient));this._groups.dimensions.properties.r.element.classList.toggle("inactive",!(isSVGCircle||isSVGRadialGradient));this._groups.dimensions.properties.rx.element.classList.toggle("inactive",!(isSVGEllipse||isSVGRect));this._groups.dimensions.properties.ry.element.classList.toggle("inactive",!(isSVGEllipse||isSVGRect));this._groups.position.svgGroup.element.classList.toggle("inactive",!(isSVGRect||isSVGCircle||isSVGEllipse||isSVGLine||isSVGRadialGradient||isSVGLinearGradient));this._groups.position.properties.x.element.classList.toggle("inactive",!isSVGRect);this._groups.position.properties.y.element.classList.toggle("inactive",!isSVGRect);this._groups.position.properties.x1.element.classList.toggle("inactive",!(isSVGLine||isSVGLinearGradient));this._groups.position.properties.y1.element.classList.toggle("inactive",!(isSVGLine||isSVGLinearGradient));this._groups.position.properties.x2.element.classList.toggle("inactive",!(isSVGLine||isSVGLinearGradient));this._groups.position.properties.y2.element.classList.toggle("inactive",!(isSVGLine||isSVGLinearGradient));this._groups.position.properties.cx.element.classList.toggle("inactive",!(isSVGCircle||isSVGEllipse||isSVGRadialGradient));this._groups.position.properties.cy.element.classList.toggle("inactive",!(isSVGCircle||isSVGEllipse||isSVGRadialGradient));}
_updateProperties(group,forceStyleUpdate)
{if(!group.section)
return;if(forceStyleUpdate&&group.links){for(let key in group.links)
group.links[key].linked=false;}
let initialTextList=this._initialTextList;if(!initialTextList)
this._currentStyle[WebInspector.VisualStyleDetailsPanel.InitialPropertySectionTextListSymbol]=initialTextList=new WeakMap;let initialPropertyText={};let initialPropertyTextMissing=!initialTextList.has(group);for(let key in group.properties){let propertyEditor=group.properties[key];propertyEditor.update(!propertyEditor.style||forceStyleUpdate?this._currentStyle:null);let value=propertyEditor.synthesizedValue;if(value&&!propertyEditor.propertyMissing&&initialPropertyTextMissing)
initialPropertyText[key]=value;}
if(initialPropertyTextMissing)
initialTextList.set(group,initialPropertyText);this._sectionModified(group);if(group.autocompleteCompatibleProperties){for(let editor of group.autocompleteCompatibleProperties)
this._updateAutocompleteCompatiblePropertyEditor(editor,forceStyleUpdate);}
if(group.specifiedWidthProperties){let sidebarWidth=this.element.realOffsetWidth;for(let editor of group.specifiedWidthProperties)
editor.recalculateWidth(sidebarWidth);}}
_updateAutocompleteCompatiblePropertyEditor(editor,force)
{if(!editor||(editor.hasCompletions&&!force))
return;editor.completions=WebInspector.CSSKeywordCompletions.forProperty(editor.propertyReferenceName);}
_sectionModified(group)
{group.section.element.classList.toggle("modified",this._initialPropertyTextModified(group));group.section.element.classList.toggle("has-set-property",this._groupHasSetProperty(group));}
_clearModifiedSection(groupId)
{let group=this._groups[groupId];group.section.element.classList.remove("modified");let initialPropertyTextList=this._currentStyle[WebInspector.VisualStyleDetailsPanel.InitialPropertySectionTextListSymbol].get(group);if(!initialPropertyTextList)
return;let newStyleText=this._currentStyle.text;for(let key in group.properties){let propertyEditor=group.properties[key];let initialValue=initialPropertyTextList[key]||null;newStyleText=propertyEditor.modifyPropertyText(newStyleText,initialValue);propertyEditor.resetEditorValues(initialValue);}
this._currentStyle.text=newStyleText;group.section.element.classList.toggle("has-set-property",this._groupHasSetProperty(group));}
get _initialTextList()
{return this._currentStyle[WebInspector.VisualStyleDetailsPanel.InitialPropertySectionTextListSymbol];}
_initialPropertyTextModified(group)
{if(!group.properties)
return false;let initialPropertyTextList=this._initialTextList.get(group);if(!initialPropertyTextList)
return false;for(let key in group.properties){let propertyEditor=group.properties[key];if(propertyEditor.propertyMissing)
continue;let value=propertyEditor.synthesizedValue;if(value&&initialPropertyTextList[key]!==value)
return true;}
return false;}
_groupHasSetProperty(group)
{for(let key in group.properties){let propertyEditor=group.properties[key];let value=propertyEditor.synthesizedValue;if(value&&!propertyEditor.propertyMissing)
return true;}
return false;}
_populateSection(group,groups)
{if(!group||!groups)
return;group.section.groups=groups;for(let key in group.properties)
group.properties[key].addEventListener(WebInspector.VisualStylePropertyEditor.Event.ValueDidChange,this._sectionModified.bind(this,group));}
_populateDisplaySection()
{let group=this._groups.display;let properties=group.properties;let displayRow=new WebInspector.DetailsSectionRow;properties.display=new WebInspector.VisualStyleKeywordPicker("display",WebInspector.UIString("Type"),{basic:["None","Block","Flex","Inline","Inline Block"],advanced:["Compact","Inline Flex","Inline Table","List Item","Table","Table Caption","Table Cell","Table Column","Table Column Group","Table Footer Group","Table Header Group","Table Row","Table Row Group"," WAP Marquee"," WebKit Box"," WebKit Grid"," WebKit Inline Box"," WebKit Inline Grid"]});properties.visibility=new WebInspector.VisualStyleKeywordPicker("visibility",WebInspector.UIString("Visibility"),{basic:["Hidden","Visible"],advanced:["Collapse"]});displayRow.element.appendChild(properties.display.element);displayRow.element.appendChild(properties.visibility.element);let sizingRow=new WebInspector.DetailsSectionRow;properties.boxSizing=new WebInspector.VisualStyleKeywordPicker("box-sizing",WebInspector.UIString("Sizing"),this._keywords.defaults.concat(["Border Box","Content Box"]));properties.cursor=new WebInspector.VisualStyleKeywordPicker("cursor",WebInspector.UIString("Cursor"),{basic:["Auto","Default","None","Pointer","Crosshair","Text"],advanced:["Context Menu","Help","Progress","Wait","Cell","Vertical Text","Alias","Copy","Move","No Drop","Not Allowed","All Scroll","Col Resize","Row Resize","N Resize","E Resize","S Resize","W Resize","NS Resize","EW Resize","NE Resize","NW Resize","SE Resize","sW Resize","NESW Resize","NWSE Resize"]});sizingRow.element.appendChild(properties.boxSizing.element);sizingRow.element.appendChild(properties.cursor.element);let overflowRow=new WebInspector.DetailsSectionRow;properties.opacity=new WebInspector.VisualStyleUnitSlider("opacity",WebInspector.UIString("Opacity"));properties.overflow=new WebInspector.VisualStyleKeywordPicker(["overflow-x","overflow-y"],WebInspector.UIString("Overflow"),{basic:["Initial","Unset","Revert","Auto","Hidden","Scroll","Visible"],advanced:["Marquee","Overlay"," WebKit Paged X"," WebKit Paged Y"]});overflowRow.element.appendChild(properties.opacity.element);overflowRow.element.appendChild(properties.overflow.element);group.specifiedWidthProperties=[properties.opacity];let displayGroup=new WebInspector.DetailsSectionGroup([displayRow,sizingRow,overflowRow]);this._populateSection(group,[displayGroup]);}
_addMetricsMouseListeners(editor,mode)
{function editorMouseover(){if(!this._currentStyle)
return;if(!this._currentStyle.ownerRule){WebInspector.domTreeManager.highlightDOMNode(this._currentStyle.node.id,mode);return;}
WebInspector.domTreeManager.highlightSelector(this._currentStyle.ownerRule.selectorText,this._currentStyle.node.ownerDocument.frameIdentifier,mode);}
function editorMouseout(){WebInspector.domTreeManager.hideDOMNodeHighlight();}
editor.element.addEventListener("mouseover",editorMouseover.bind(this));editor.element.addEventListener("mouseout",editorMouseout);}
_generateMetricSectionRows(group,prefix,allowNegatives,highlightOnHover)
{let properties=group.properties;let links=group.links={};let hasPrefix=prefix&&prefix.length;let propertyNamePrefix=hasPrefix?prefix+"-":"";let top=hasPrefix?prefix+"Top":"top";let bottom=hasPrefix?prefix+"Bottom":"bottom";let left=hasPrefix?prefix+"Left":"left";let right=hasPrefix?prefix+"Right":"right";let vertical=new WebInspector.DetailsSectionRow;properties[top]=new WebInspector.VisualStyleNumberInputBox(propertyNamePrefix+"top",WebInspector.UIString("Top"),this._keywords.boxModel,this._units.defaults,allowNegatives);properties[bottom]=new WebInspector.VisualStyleNumberInputBox(propertyNamePrefix+"bottom",WebInspector.UIString("Bottom"),this._keywords.boxModel,this._units.defaults,allowNegatives,true);links["vertical"]=new WebInspector.VisualStylePropertyEditorLink([properties[top],properties[bottom]],"link-vertical");vertical.element.appendChild(properties[top].element);vertical.element.appendChild(links["vertical"].element);vertical.element.appendChild(properties[bottom].element);let horizontal=new WebInspector.DetailsSectionRow;properties[left]=new WebInspector.VisualStyleNumberInputBox(propertyNamePrefix+"left",WebInspector.UIString("Left"),this._keywords.boxModel,this._units.defaults,allowNegatives);properties[right]=new WebInspector.VisualStyleNumberInputBox(propertyNamePrefix+"right",WebInspector.UIString("Right"),this._keywords.boxModel,this._units.defaults,allowNegatives,true);links["horizontal"]=new WebInspector.VisualStylePropertyEditorLink([properties[left],properties[right]],"link-horizontal");horizontal.element.appendChild(properties[left].element);horizontal.element.appendChild(links["horizontal"].element);horizontal.element.appendChild(properties[right].element);let allLinkRow=new WebInspector.DetailsSectionRow;links["all"]=new WebInspector.VisualStylePropertyEditorLink([properties[top],properties[bottom],properties[left],properties[right]],"link-all",[links["vertical"],links["horizontal"]]);allLinkRow.element.appendChild(links["all"].element);if(highlightOnHover){this._addMetricsMouseListeners(properties[top],prefix);this._addMetricsMouseListeners(links["vertical"],prefix);this._addMetricsMouseListeners(properties[bottom],prefix);this._addMetricsMouseListeners(links["all"],prefix);this._addMetricsMouseListeners(properties[left],prefix);this._addMetricsMouseListeners(links["horizontal"],prefix);this._addMetricsMouseListeners(properties[right],prefix);}
vertical.element.classList.add("metric-section-row");horizontal.element.classList.add("metric-section-row");allLinkRow.element.classList.add("metric-section-row");return[vertical,allLinkRow,horizontal];}
_populatePositionSection()
{let group=this._groups.position;let rows=this._generateMetricSectionRows(group,null,true);let properties=group.properties;let positionType=new WebInspector.DetailsSectionRow;properties.position=new WebInspector.VisualStyleKeywordPicker("position",WebInspector.UIString("Type"),{basic:["Static","Relative","Absolute","Fixed"],advanced:[" WebKit Sticky"]});properties.zIndex=new WebInspector.VisualStyleNumberInputBox("z-index",WebInspector.UIString("Z-Index"),this._keywords.boxModel,null,true);positionType.element.appendChild(properties.position.element);positionType.element.appendChild(properties.zIndex.element);positionType.element.classList.add("visual-style-separated-row");rows.unshift(positionType);group.defaultGroup=new WebInspector.DetailsSectionGroup(rows);let xyRow=new WebInspector.DetailsSectionRow;properties.x=new WebInspector.VisualStyleNumberInputBox("x",WebInspector.UIString("X"),this._keywords.boxModel,this._units.defaults,true);properties.y=new WebInspector.VisualStyleNumberInputBox("y",WebInspector.UIString("Y"),this._keywords.boxModel,this._units.defaults,true);xyRow.element.appendChild(properties.x.element);xyRow.element.appendChild(properties.y.element);let x1y1Row=new WebInspector.DetailsSectionRow;properties.x1=new WebInspector.VisualStyleNumberInputBox("x1",WebInspector.UIString("X1"),this._keywords.boxModel,this._units.defaults,true);properties.y1=new WebInspector.VisualStyleNumberInputBox("y1",WebInspector.UIString("Y1"),this._keywords.boxModel,this._units.defaults,true);x1y1Row.element.appendChild(properties.x1.element);x1y1Row.element.appendChild(properties.y1.element);let x2y2Row=new WebInspector.DetailsSectionRow;properties.x2=new WebInspector.VisualStyleNumberInputBox("x2",WebInspector.UIString("X2"),this._keywords.boxModel,this._units.defaults,true);properties.y2=new WebInspector.VisualStyleNumberInputBox("y2",WebInspector.UIString("Y2"),this._keywords.boxModel,this._units.defaults,true);x2y2Row.element.appendChild(properties.x2.element);x2y2Row.element.appendChild(properties.y2.element);let cxcyRow=new WebInspector.DetailsSectionRow;properties.cx=new WebInspector.VisualStyleNumberInputBox("cx",WebInspector.UIString("Center X"),this._keywords.boxModel,this._units.defaults,true);properties.cy=new WebInspector.VisualStyleNumberInputBox("cy",WebInspector.UIString("Center Y"),this._keywords.boxModel,this._units.defaults,true);cxcyRow.element.appendChild(properties.cx.element);cxcyRow.element.appendChild(properties.cy.element);group.svgGroup=new WebInspector.DetailsSectionGroup([xyRow,x1y1Row,x2y2Row,cxcyRow]);this._populateSection(group,[group.defaultGroup,group.svgGroup]);let allowedPositionValues=["relative","absolute","fixed","-webkit-sticky"];properties.zIndex.addDependency("position",allowedPositionValues);properties.top.addDependency("position",allowedPositionValues);properties.right.addDependency("position",allowedPositionValues);properties.bottom.addDependency("position",allowedPositionValues);properties.left.addDependency("position",allowedPositionValues);}
_populateFloatSection()
{let group=this._groups.float;let properties=group.properties;let floatRow=new WebInspector.DetailsSectionRow;properties.float=new WebInspector.VisualStyleKeywordIconList("float",WebInspector.UIString("Float"),["Left","Right","None"]);floatRow.element.appendChild(properties.float.element);let clearRow=new WebInspector.DetailsSectionRow;properties.clear=new WebInspector.VisualStyleKeywordIconList("clear",WebInspector.UIString("Clear"),["Left","Right","Both","None"]);clearRow.element.appendChild(properties.clear.element);let floatGroup=new WebInspector.DetailsSectionGroup([floatRow,clearRow]);this._populateSection(group,[floatGroup]);}
_populateDimensionsSection()
{let group=this._groups.dimensions;let properties=group.properties;let dimensionsWidth=new WebInspector.DetailsSectionRow;properties.width=new WebInspector.VisualStyleRelativeNumberSlider("width",WebInspector.UIString("Width"),this._keywords.boxModel,this._units.defaults);dimensionsWidth.element.appendChild(properties.width.element);let dimensionsHeight=new WebInspector.DetailsSectionRow;properties.height=new WebInspector.VisualStyleRelativeNumberSlider("height",WebInspector.UIString("Height"),this._keywords.boxModel,this._units.defaults,true);dimensionsHeight.element.appendChild(properties.height.element);let dimensionsProperties=[properties.width,properties.height];let dimensionsRegularGroup=new WebInspector.DetailsSectionGroup([dimensionsWidth,dimensionsHeight]);let dimensionsMinWidth=new WebInspector.DetailsSectionRow;properties.minWidth=new WebInspector.VisualStyleRelativeNumberSlider("min-width",WebInspector.UIString("Width"),this._keywords.boxModel,this._units.defaults);dimensionsMinWidth.element.appendChild(properties.minWidth.element);let dimensionsMinHeight=new WebInspector.DetailsSectionRow;properties.minHeight=new WebInspector.VisualStyleRelativeNumberSlider("min-height",WebInspector.UIString("Height"),this._keywords.boxModel,this._units.defaults);dimensionsMinHeight.element.appendChild(properties.minHeight.element);let dimensionsMinProperties=[properties.minWidth,properties.minHeight];let dimensionsMinGroup=new WebInspector.DetailsSectionGroup([dimensionsMinWidth,dimensionsMinHeight]);let dimensionsMaxKeywords=this._keywords.defaults.concat("None");let dimensionsMaxWidth=new WebInspector.DetailsSectionRow;properties.maxWidth=new WebInspector.VisualStyleRelativeNumberSlider("max-width",WebInspector.UIString("Width"),dimensionsMaxKeywords,this._units.defaults);dimensionsMaxWidth.element.appendChild(properties.maxWidth.element);let dimensionsMaxHeight=new WebInspector.DetailsSectionRow;properties.maxHeight=new WebInspector.VisualStyleRelativeNumberSlider("max-height",WebInspector.UIString("Height"),dimensionsMaxKeywords,this._units.defaults);dimensionsMaxHeight.element.appendChild(properties.maxHeight.element);let dimensionsMaxProperties=[properties.maxWidth,properties.maxHeight];let dimensionsMaxGroup=new WebInspector.DetailsSectionGroup([dimensionsMaxWidth,dimensionsMaxHeight]);let dimensionsTabController=new WebInspector.VisualStyleTabbedPropertiesRow({"default":{title:WebInspector.UIString("Default"),element:dimensionsRegularGroup.element,properties:dimensionsProperties},"min":{title:WebInspector.UIString("Min"),element:dimensionsMinGroup.element,properties:dimensionsMinProperties},"max":{title:WebInspector.UIString("Max"),element:dimensionsMaxGroup.element,properties:dimensionsMaxProperties}});let highlightMode="content";this._addMetricsMouseListeners(group.properties.width,highlightMode);this._addMetricsMouseListeners(group.properties.height,highlightMode);this._addMetricsMouseListeners(group.properties.minWidth,highlightMode);this._addMetricsMouseListeners(group.properties.minHeight,highlightMode);this._addMetricsMouseListeners(group.properties.maxWidth,highlightMode);this._addMetricsMouseListeners(group.properties.maxHeight,highlightMode);group.defaultGroup=new WebInspector.DetailsSectionGroup([dimensionsTabController,dimensionsRegularGroup,dimensionsMinGroup,dimensionsMaxGroup]);let rRow=new WebInspector.DetailsSectionRow;properties.r=new WebInspector.VisualStyleRelativeNumberSlider("r",WebInspector.UIString("Radius"),this._keywords.boxModel,this._units.defaults);rRow.element.appendChild(properties.r.element);let rxRow=new WebInspector.DetailsSectionRow;properties.rx=new WebInspector.VisualStyleRelativeNumberSlider("rx",WebInspector.UIString("Radius X"),this._keywords.boxModel,this._units.defaults);rxRow.element.appendChild(properties.rx.element);let ryRow=new WebInspector.DetailsSectionRow;properties.ry=new WebInspector.VisualStyleRelativeNumberSlider("ry",WebInspector.UIString("Radius Y"),this._keywords.boxModel,this._units.defaults);ryRow.element.appendChild(properties.ry.element);group.svgGroup=new WebInspector.DetailsSectionGroup([rRow,rxRow,ryRow]);this._populateSection(group,[group.defaultGroup,group.svgGroup]);}
_populateMarginSection()
{let group=this._groups.margin;let rows=this._generateMetricSectionRows(group,"margin",true,true);let marginGroup=new WebInspector.DetailsSectionGroup(rows);this._populateSection(group,[marginGroup]);}
_populatePaddingSection()
{let group=this._groups.padding;let rows=this._generateMetricSectionRows(group,"padding",false,true);let paddingGroup=new WebInspector.DetailsSectionGroup(rows);this._populateSection(group,[paddingGroup]);}
_populateFlexboxSection()
{let group=this._groups.flexbox;let properties=group.properties;let flexOrderRow=new WebInspector.DetailsSectionRow;properties.order=new WebInspector.VisualStyleNumberInputBox("order",WebInspector.UIString("Order"),this._keywords.defaults);properties.flexBasis=new WebInspector.VisualStyleNumberInputBox("flex-basis",WebInspector.UIString("Basis"),this._keywords.boxModel,this._units.defaults,true);flexOrderRow.element.appendChild(properties.order.element);flexOrderRow.element.appendChild(properties.flexBasis.element);let flexSizeRow=new WebInspector.DetailsSectionRow;properties.flexGrow=new WebInspector.VisualStyleNumberInputBox("flex-grow",WebInspector.UIString("Grow"),this._keywords.defaults);properties.flexShrink=new WebInspector.VisualStyleNumberInputBox("flex-shrink",WebInspector.UIString("Shrink"),this._keywords.defaults);flexSizeRow.element.appendChild(properties.flexGrow.element);flexSizeRow.element.appendChild(properties.flexShrink.element);let flexFlowRow=new WebInspector.DetailsSectionRow;properties.flexDirection=new WebInspector.VisualStyleKeywordPicker("flex-direction",WebInspector.UIString("Direction"),this._keywords.defaults.concat(["Row","Row Reverse","Column","Column Reverse"]));properties.flexWrap=new WebInspector.VisualStyleKeywordPicker("flex-wrap",WebInspector.UIString("Wrap"),this._keywords.defaults.concat(["Wrap","Wrap Reverse","Nowrap"]));flexFlowRow.element.appendChild(properties.flexDirection.element);flexFlowRow.element.appendChild(properties.flexWrap.element);let flexboxGroup=new WebInspector.DetailsSectionGroup([flexOrderRow,flexSizeRow,flexFlowRow]);this._populateSection(group,[flexboxGroup]);let allowedDisplayValues=["flex","inline-flex","-webkit-box","-webkit-inline-box"];properties.order.addDependency("display",allowedDisplayValues);properties.flexBasis.addDependency("display",allowedDisplayValues);properties.flexGrow.addDependency("display",allowedDisplayValues);properties.flexShrink.addDependency("display",allowedDisplayValues);properties.flexDirection.addDependency("display",allowedDisplayValues);properties.flexWrap.addDependency("display",allowedDisplayValues);}
_populateAlignmentSection()
{let group=this._groups.alignment;let properties=group.properties;let alignmentKeywords=["Initial","Unset","Revert","Auto","Flex Start","Flex End","Center","Stretch"];let advancedAlignmentKeywords=["Start","End","Left","Right","Baseline","Last Baseline"];let contentRow=new WebInspector.DetailsSectionRow;let contentKeywords={basic:alignmentKeywords.concat(["Space Between","Space Around"]),advanced:advancedAlignmentKeywords.concat(["Space Evenly"])};properties.justifyContent=new WebInspector.VisualStyleKeywordPicker("justify-content",WebInspector.UIString("Horizontal"),contentKeywords);properties.alignContent=new WebInspector.VisualStyleKeywordPicker("align-content",WebInspector.UIString("Vertical"),contentKeywords);contentRow.element.appendChild(properties.justifyContent.element);contentRow.element.appendChild(properties.alignContent.element);let itemsRow=new WebInspector.DetailsSectionRow;let itemKeywords={basic:alignmentKeywords,advanced:["Self Start","Self End"].concat(advancedAlignmentKeywords)};properties.alignItems=new WebInspector.VisualStyleKeywordPicker("align-items",WebInspector.UIString("Children"),itemKeywords);properties.alignSelf=new WebInspector.VisualStyleKeywordPicker("align-self",WebInspector.UIString("Self"),itemKeywords);itemsRow.element.appendChild(properties.alignItems.element);itemsRow.element.appendChild(properties.alignSelf.element);let alignmentGroup=new WebInspector.DetailsSectionGroup([contentRow,itemsRow]);this._populateSection(group,[alignmentGroup]);let allowedDisplayValues=["flex","inline-flex","-webkit-box","-webkit-inline-box"];properties.justifyContent.addDependency("display",allowedDisplayValues);properties.alignContent.addDependency("display",allowedDisplayValues);properties.alignItems.addDependency("display",allowedDisplayValues);properties.alignSelf.addDependency("display",allowedDisplayValues);}
_populateContentSection()
{let group=this._groups.content;let properties=group.properties;let contentRow=new WebInspector.DetailsSectionRow;properties.content=new WebInspector.VisualStyleBasicInput("content",null,WebInspector.UIString("Enter value"));contentRow.element.appendChild(properties.content.element);let contentGroup=new WebInspector.DetailsSectionGroup([contentRow]);this._populateSection(group,[contentGroup]);}
_populateTextStyleSection()
{let group=this._groups.textStyle;let properties=group.properties;let textAppearanceRow=new WebInspector.DetailsSectionRow;properties.color=new WebInspector.VisualStyleColorPicker("color",WebInspector.UIString("Color"));properties.textDirection=new WebInspector.VisualStyleKeywordPicker("direction",WebInspector.UIString("Direction"),this._keywords.defaults.concat(["LTR","RTL"]));textAppearanceRow.element.appendChild(properties.color.element);textAppearanceRow.element.appendChild(properties.textDirection.element);let textAlignRow=new WebInspector.DetailsSectionRow;properties.textAlign=new WebInspector.VisualStyleKeywordIconList("text-align",WebInspector.UIString("Align"),["Left","Center","Right","Justify"]);textAlignRow.element.appendChild(properties.textAlign.element);let textTransformRow=new WebInspector.DetailsSectionRow;properties.textTransform=new WebInspector.VisualStyleKeywordIconList("text-transform",WebInspector.UIString("Transform"),["Capitalize","Uppercase","Lowercase","None"]);textTransformRow.element.appendChild(properties.textTransform.element);let textDecorationRow=new WebInspector.DetailsSectionRow;properties.textDecoration=new WebInspector.VisualStyleKeywordIconList("text-decoration",WebInspector.UIString("Decoration"),["Underline","Line Through","Overline","None"]);textDecorationRow.element.appendChild(properties.textDecoration.element);group.autocompleteCompatibleProperties=[properties.color];let textStyleGroup=new WebInspector.DetailsSectionGroup([textAppearanceRow,textAlignRow,textTransformRow,textDecorationRow]);this._populateSection(group,[textStyleGroup]);}
_populateFontSection()
{let group=this._groups.font;let properties=group.properties;let fontFamilyRow=new WebInspector.DetailsSectionRow;properties.fontFamily=new WebInspector.VisualStyleFontFamilyListEditor("font-family",WebInspector.UIString("Family"));fontFamilyRow.element.appendChild(properties.fontFamily.element);let fontSizeRow=new WebInspector.DetailsSectionRow;properties.fontSize=new WebInspector.VisualStyleNumberInputBox("font-size",WebInspector.UIString("Size"),this._keywords.defaults.concat(["Larger","XX Large","X Large","Large","Medium","Small","X Small","XX Small","Smaller"]),this._units.defaults);properties.fontWeight=new WebInspector.VisualStyleKeywordPicker("font-weight",WebInspector.UIString("Weight"),{basic:this._keywords.defaults.concat(["Bolder","Bold","Normal","Lighter"]),advanced:["100","200","300","400","500","600","700","800","900"]});fontSizeRow.element.appendChild(properties.fontSize.element);fontSizeRow.element.appendChild(properties.fontWeight.element);let fontStyleRow=new WebInspector.DetailsSectionRow;properties.fontStyle=new WebInspector.VisualStyleKeywordIconList("font-style",WebInspector.UIString("Style"),["Italic","Normal"]);properties.fontFeatureSettings=new WebInspector.VisualStyleBasicInput("font-feature-settings",WebInspector.UIString("Features"),WebInspector.UIString("Enter Tag"));fontStyleRow.element.appendChild(properties.fontStyle.element);fontStyleRow.element.appendChild(properties.fontFeatureSettings.element);group.autocompleteCompatibleProperties=[properties.fontFamily];group.specifiedWidthProperties=[properties.fontFamily];let fontGroup=new WebInspector.DetailsSectionGroup([fontFamilyRow,fontSizeRow,fontStyleRow]);this._populateSection(group,[fontGroup]);}
_populateFontVariantsSection()
{let group=this._groups.fontVariants;let properties=group.properties;let alternatesRow=new WebInspector.DetailsSectionRow;properties.fontVariantAlternates=new WebInspector.VisualStyleBasicInput("font-variant-alternates",WebInspector.UIString("Alternates"),WebInspector.UIString("Enter Value"));alternatesRow.element.appendChild(properties.fontVariantAlternates.element);let positionRow=new WebInspector.DetailsSectionRow;properties.fontVariantPosition=new WebInspector.VisualStyleKeywordPicker("font-variant-position",WebInspector.UIString("Position"),this._keywords.normal.concat(["Sub","Super"]));positionRow.element.appendChild(properties.fontVariantPosition.element);properties.fontVariantCaps=new WebInspector.VisualStyleKeywordPicker("font-variant-caps",WebInspector.UIString("Caps"),this._keywords.normal.concat(["None","Small Caps","All Small Caps","Petite Caps","All Petite Caps","Unicase","Titling Caps"]));positionRow.element.appendChild(properties.fontVariantCaps.element);let ligaturesRow=new WebInspector.DetailsSectionRow; properties.fontVariantLigatures=new WebInspector.VisualStyleKeywordPicker("font-variant-ligatures",WebInspector.UIString("Ligatures"),this._keywords.normal.concat(["None","Common Ligatures","No Common Ligatures","Discretionary Ligatures","No Discretionary Ligatures","Historical Ligatures","No Historical Ligatures","Contextual","No Contextual"]));ligaturesRow.element.appendChild(properties.fontVariantLigatures.element);properties.fontVariantNumeric=new WebInspector.VisualStyleKeywordPicker("font-variant-numeric",WebInspector.UIString("Numeric"),this._keywords.normal.concat(["None","Ordinal","Slashed Zero","Lining Nums","Oldstyle Nums","Proportional Nums","Tabular Nums","Diagonal Fractions","Stacked Fractions"]));ligaturesRow.element.appendChild(properties.fontVariantNumeric.element);let variantsGroup=new WebInspector.DetailsSectionGroup([alternatesRow,positionRow,ligaturesRow]);this._populateSection(group,[variantsGroup]);}
_populateTextSpacingSection()
{let group=this._groups.textSpacing;let properties=group.properties;let textLayoutRow=new WebInspector.DetailsSectionRow;properties.lineHeight=new WebInspector.VisualStyleNumberInputBox("line-height",WebInspector.UIString("Height"),this._keywords.normal,this._units.defaults);properties.verticalAlign=new WebInspector.VisualStyleNumberInputBox("vertical-align",WebInspector.UIString("Align"),["Baseline","Bottom"].concat(this._keywords.defaults,["Middle","Sub","Super","Text Bottom","Text Top","Top"]),this._units.defaults);textLayoutRow.element.appendChild(properties.lineHeight.element);textLayoutRow.element.appendChild(properties.verticalAlign.element);let textSpacingRow=new WebInspector.DetailsSectionRow;properties.letterSpacing=new WebInspector.VisualStyleNumberInputBox("letter-spacing",WebInspector.UIString("Letter"),this._keywords.normal,this._units.defaults);properties.wordSpacing=new WebInspector.VisualStyleNumberInputBox("word-spacing",WebInspector.UIString("Word"),this._keywords.normal,this._units.defaults);textSpacingRow.element.appendChild(properties.letterSpacing.element);textSpacingRow.element.appendChild(properties.wordSpacing.element);let textWhitespaceRow=new WebInspector.DetailsSectionRow;properties.textIndent=new WebInspector.VisualStyleNumberInputBox("text-indent",WebInspector.UIString("Indent"),this._keywords.defaults,this._units.defaults);properties.whiteSpace=new WebInspector.VisualStyleKeywordPicker("white-space",WebInspector.UIString("Whitespace"),this._keywords.defaults.concat(["Normal","Nowrap","Pre","Pre Line","Pre Wrap"]));textWhitespaceRow.element.appendChild(properties.textIndent.element);textWhitespaceRow.element.appendChild(properties.whiteSpace.element);let textSpacingGroup=new WebInspector.DetailsSectionGroup([textLayoutRow,textSpacingRow,textWhitespaceRow]);this._populateSection(group,[textSpacingGroup]);}
_populateTextShadowSection()
{let group=this._groups.textShadow;let properties=group.properties;let textShadowSizing=new WebInspector.DetailsSectionRow;let textShadowH=new WebInspector.VisualStyleNumberInputBox("text-shadow",WebInspector.UIString("Horizontal"),null,this._units.defaultsSansPercent);let textShadowV=new WebInspector.VisualStyleNumberInputBox("text-shadow",WebInspector.UIString("Vertical"),null,this._units.defaultsSansPercent);textShadowSizing.element.appendChild(textShadowH.element);textShadowSizing.element.appendChild(textShadowV.element);let textShadowStyle=new WebInspector.DetailsSectionRow;let textShadowColor=new WebInspector.VisualStyleColorPicker("text-shadow",WebInspector.UIString("Color"));let textShadowBlur=new WebInspector.VisualStyleNumberInputBox("text-shadow",WebInspector.UIString("Blur"),null,this._units.defaultsSansPercent);textShadowBlur.optionalProperty=true;textShadowStyle.element.appendChild(textShadowColor.element);textShadowStyle.element.appendChild(textShadowBlur.element);properties.textShadow=new WebInspector.VisualStylePropertyCombiner("text-shadow",[textShadowH,textShadowV,textShadowBlur,textShadowColor]);group.autocompleteCompatibleProperties=[textShadowColor];let textShadowGroup=new WebInspector.DetailsSectionGroup([textShadowSizing,textShadowStyle]);this._populateSection(group,[textShadowGroup]);}
_populateFillSection()
{let group=this._groups.fill;let properties=group.properties;let fillRow=new WebInspector.DetailsSectionRow;properties.fill=new WebInspector.VisualStyleColorPicker("fill",WebInspector.UIString("Color"));properties.fillRule=new WebInspector.VisualStyleKeywordPicker("fill-rule",WebInspector.UIString("Rule"),this._keywords.defaults.concat(["Nonzero","Evenodd"]));fillRow.element.appendChild(properties.fill.element);fillRow.element.appendChild(properties.fillRule.element);let fillOpacityRow=new WebInspector.DetailsSectionRow;properties.fillOpacity=new WebInspector.VisualStyleUnitSlider("fill-opacity",WebInspector.UIString("Opacity"));fillOpacityRow.element.appendChild(properties.fillOpacity.element);group.specifiedWidthProperties=[properties.fillOpacity];let fillGroup=new WebInspector.DetailsSectionGroup([fillRow,fillOpacityRow]);this._populateSection(group,[fillGroup]);}
_populateStrokeSection()
{let group=this._groups.stroke;let properties=group.properties;let strokeRow=new WebInspector.DetailsSectionRow;properties.stroke=new WebInspector.VisualStyleColorPicker("stroke",WebInspector.UIString("Color"));properties.strokeWidth=new WebInspector.VisualStyleNumberInputBox("stroke-width",WebInspector.UIString("Width"),this._keywords.defaults,this._units.defaults);strokeRow.element.appendChild(properties.stroke.element);strokeRow.element.appendChild(properties.strokeWidth.element);let strokeOpacity=new WebInspector.DetailsSectionRow;properties.strokeOpacity=new WebInspector.VisualStyleUnitSlider("stroke-opacity",WebInspector.UIString("Opacity"));strokeOpacity.element.appendChild(properties.strokeOpacity.element);let strokeDasharrayRow=new WebInspector.DetailsSectionRow;properties.strokeDasharray=new WebInspector.VisualStyleBasicInput("stroke-dasharray",WebInspector.UIString("Dash Array"),WebInspector.UIString("Enter an array value"));strokeDasharrayRow.element.appendChild(properties.strokeDasharray.element);let strokeDasharrayOptionsRow=new WebInspector.DetailsSectionRow;properties.strokeDashoffset=new WebInspector.VisualStyleNumberInputBox("stroke-dashoffset",WebInspector.UIString("Offset"),this._keywords.defaults,this._units.defaults);properties.strokeMiterlimit=new WebInspector.VisualStyleNumberInputBox("stroke-miterlimit",WebInspector.UIString("Miter"),this._keywords.defaults);strokeDasharrayOptionsRow.element.appendChild(properties.strokeDashoffset.element);strokeDasharrayOptionsRow.element.appendChild(properties.strokeMiterlimit.element);let strokeLineOptionsRow=new WebInspector.DetailsSectionRow;properties.strokeLinecap=new WebInspector.VisualStyleKeywordPicker("stroke-linecap",WebInspector.UIString("Cap"),this._keywords.defaults.concat(["Butt","Round","Square"]));properties.strokeLinejoin=new WebInspector.VisualStyleKeywordPicker("stroke-linejoin",WebInspector.UIString("Join"),this._keywords.defaults.concat(["Miter","Round","Bevel"]));strokeLineOptionsRow.element.appendChild(properties.strokeLinecap.element);strokeLineOptionsRow.element.appendChild(properties.strokeLinejoin.element);group.specifiedWidthProperties=[properties.strokeOpacity];let strokeGroup=new WebInspector.DetailsSectionGroup([strokeRow,strokeOpacity,strokeDasharrayRow,strokeDasharrayOptionsRow,strokeLineOptionsRow]);this._populateSection(group,[strokeGroup]);}
_populateBackgroundStyleSection()
{let group=this._groups.backgroundStyle;let properties=group.properties;let backgroundStyleRow=new WebInspector.DetailsSectionRow;properties.backgroundColor=new WebInspector.VisualStyleColorPicker("background-color",WebInspector.UIString("Color"));properties.backgroundBlendMode=new WebInspector.VisualStyleKeywordPicker("background-blend-mode",WebInspector.UIString("Blend"),["Normal","Multiply","Screen","Overlay","Darken","Lighten","Color","Color Dodge","Saturation","Luminosity"]);backgroundStyleRow.element.appendChild(properties.backgroundColor.element);backgroundStyleRow.element.appendChild(properties.backgroundBlendMode.element);let backgroundClipRow=new WebInspector.DetailsSectionRow;let backgroundClipKeywords=["Initial","Border Box","Padding Box","Content Box"];properties.backgroundClip=new WebInspector.VisualStyleKeywordPicker("background-clip",WebInspector.UIString("Clip"),backgroundClipKeywords);properties.backgroundOrigin=new WebInspector.VisualStyleKeywordPicker("background-origin",WebInspector.UIString("Origin"),backgroundClipKeywords);backgroundClipRow.element.appendChild(properties.backgroundClip.element);backgroundClipRow.element.appendChild(properties.backgroundOrigin.element);let backgroundSizeRow=new WebInspector.DetailsSectionRow;let backgroundSizeKeywords=this._keywords.boxModel.concat(["Contain","Cover"]);let backgroundSizeX=new WebInspector.VisualStyleNumberInputBox("background-size",WebInspector.UIString("Width"),backgroundSizeKeywords,this._units.defaults);backgroundSizeX.masterProperty=true;let backgroundSizeY=new WebInspector.VisualStyleNumberInputBox("background-size",WebInspector.UIString("Height"),backgroundSizeKeywords,this._units.defaults);backgroundSizeY.masterProperty=true;properties.backgroundSize=new WebInspector.VisualStylePropertyCombiner("background-size",[backgroundSizeX,backgroundSizeY]);backgroundSizeRow.element.appendChild(backgroundSizeX.element);backgroundSizeRow.element.appendChild(backgroundSizeY.element);let backgroundRow=new WebInspector.DetailsSectionRow;properties.background=new WebInspector.VisualStyleCommaSeparatedKeywordEditor("background",null,{"background-image":"none","background-position":"0% 0%","background-repeat":"repeat","background-attachment":"scroll",});backgroundRow.element.appendChild(properties.background.element);let backgroundImageRow=new WebInspector.DetailsSectionRow;let backgroundImage=new WebInspector.VisualStyleBackgroundPicker("background-image",WebInspector.UIString("Type"),this._keywords.defaults.concat(["None"]));backgroundImageRow.element.appendChild(backgroundImage.element);let backgroundPositionRow=new WebInspector.DetailsSectionRow;let backgroundPositionX=new WebInspector.VisualStyleNumberInputBox("background-position",WebInspector.UIString("Position X"),["Center","Left","Right"],this._units.defaults);backgroundPositionX.optionalProperty=true;let backgroundPositionY=new WebInspector.VisualStyleNumberInputBox("background-position",WebInspector.UIString("Position Y"),["Bottom","Center","Top"],this._units.defaults);backgroundPositionY.optionalProperty=true;backgroundPositionRow.element.appendChild(backgroundPositionX.element);backgroundPositionRow.element.appendChild(backgroundPositionY.element);let backgroundRepeatRow=new WebInspector.DetailsSectionRow;let backgroundRepeat=new WebInspector.VisualStyleKeywordPicker("background-repeat",WebInspector.UIString("Repeat"),this._keywords.defaults.concat(["No Repeat","Repeat","Repeat X","Repeat Y"]));backgroundRepeat.optionalProperty=true;let backgroundAttachment=new WebInspector.VisualStyleKeywordPicker("background-attachment",WebInspector.UIString("Attach"),this._keywords.defaults.concat(["Fixed","Local","Scroll"]));backgroundAttachment.optionalProperty=true;backgroundRepeatRow.element.appendChild(backgroundRepeat.element);backgroundRepeatRow.element.appendChild(backgroundAttachment.element);let backgroundProperties=[backgroundImage,backgroundPositionX,backgroundPositionY,backgroundRepeat,backgroundAttachment];let backgroundPropertyCombiner=new WebInspector.VisualStylePropertyCombiner("background",backgroundProperties);let noRemainingCommaSeparatedEditorItems=this._noRemainingCommaSeparatedEditorItems.bind(this,backgroundPropertyCombiner,backgroundProperties);properties.background.addEventListener(WebInspector.VisualStyleCommaSeparatedKeywordEditor.Event.NoRemainingTreeItems,noRemainingCommaSeparatedEditorItems,this);let selectedCommaSeparatedEditorItemValueChanged=this._selectedCommaSeparatedEditorItemValueChanged.bind(this,properties.background,backgroundPropertyCombiner);backgroundPropertyCombiner.addEventListener(WebInspector.VisualStylePropertyEditor.Event.ValueDidChange,selectedCommaSeparatedEditorItemValueChanged,this);let commaSeparatedEditorTreeItemSelected=this._commaSeparatedEditorTreeItemSelected.bind(backgroundPropertyCombiner);properties.background.addEventListener(WebInspector.VisualStyleCommaSeparatedKeywordEditor.Event.TreeItemSelected,commaSeparatedEditorTreeItemSelected,this);group.autocompleteCompatibleProperties=[properties.backgroundColor];group.specifiedWidthProperties=[properties.background];let backgroundStyleGroup=new WebInspector.DetailsSectionGroup([backgroundStyleRow,backgroundClipRow,backgroundSizeRow,backgroundRow,backgroundImageRow,backgroundPositionRow,backgroundRepeatRow]);this._populateSection(group,[backgroundStyleGroup]);}
_populateBorderSection()
{let group=this._groups.border;let properties=group.properties;let borderAllSize=new WebInspector.DetailsSectionRow;properties.borderStyle=new WebInspector.VisualStyleKeywordPicker(["border-top-style","border-right-style","border-bottom-style","border-left-style"],WebInspector.UIString("Style"),this._keywords.borderStyle);properties.borderStyle.propertyReferenceName="border-style";properties.borderWidth=new WebInspector.VisualStyleNumberInputBox(["border-top-width","border-right-width","border-bottom-width","border-left-width"],WebInspector.UIString("Width"),this._keywords.borderWidth,this._units.defaults);properties.borderWidth.propertyReferenceName="border-width";borderAllSize.element.appendChild(properties.borderStyle.element);borderAllSize.element.appendChild(properties.borderWidth.element);let borderAllStyle=new WebInspector.DetailsSectionRow;properties.borderColor=new WebInspector.VisualStyleColorPicker(["border-top-color","border-right-color","border-bottom-color","border-left-color"],WebInspector.UIString("Color"));properties.borderColor.propertyReferenceName="border-color";properties.borderRadius=new WebInspector.VisualStyleNumberInputBox(["border-top-left-radius","border-top-right-radius","border-bottom-left-radius","border-bottom-right-radius"],WebInspector.UIString("Radius"),this._keywords.defaults,this._units.defaults);properties.borderRadius.propertyReferenceName="border-radius";borderAllStyle.element.appendChild(properties.borderColor.element);borderAllStyle.element.appendChild(properties.borderRadius.element);let borderAllProperties=[properties.borderStyle,properties.borderWidth,properties.borderColor,properties.borderRadius];let borderAllGroup=new WebInspector.DetailsSectionGroup([borderAllSize,borderAllStyle]);let borderTopSize=new WebInspector.DetailsSectionRow;properties.borderTopStyle=new WebInspector.VisualStyleKeywordPicker("border-top-style",WebInspector.UIString("Style"),this._keywords.borderStyle);properties.borderTopWidth=new WebInspector.VisualStyleNumberInputBox("border-top-width",WebInspector.UIString("Width"),this._keywords.borderWidth,this._units.defaults);borderTopSize.element.appendChild(properties.borderTopStyle.element);borderTopSize.element.appendChild(properties.borderTopWidth.element);let borderTopStyle=new WebInspector.DetailsSectionRow;properties.borderTopColor=new WebInspector.VisualStyleColorPicker("border-top-color",WebInspector.UIString("Color"));properties.borderTopRadius=new WebInspector.VisualStyleNumberInputBox(["border-top-left-radius","border-top-right-radius"],WebInspector.UIString("Radius"),this._keywords.defaults,this._units.defaults);borderTopStyle.element.appendChild(properties.borderTopColor.element);borderTopStyle.element.appendChild(properties.borderTopRadius.element);let borderTopProperties=[properties.borderTopStyle,properties.borderTopWidth,properties.borderTopColor,properties.borderTopRadius];let borderTopGroup=new WebInspector.DetailsSectionGroup([borderTopSize,borderTopStyle]);let borderRightSize=new WebInspector.DetailsSectionRow;properties.borderRightStyle=new WebInspector.VisualStyleKeywordPicker("border-right-style",WebInspector.UIString("Style"),this._keywords.borderStyle);properties.borderRightWidth=new WebInspector.VisualStyleNumberInputBox("border-right-width",WebInspector.UIString("Width"),this._keywords.borderWidth,this._units.defaults);borderRightSize.element.appendChild(properties.borderRightStyle.element);borderRightSize.element.appendChild(properties.borderRightWidth.element);let borderRightStyle=new WebInspector.DetailsSectionRow;properties.borderRightColor=new WebInspector.VisualStyleColorPicker("border-right-color",WebInspector.UIString("Color"));properties.borderRightRadius=new WebInspector.VisualStyleNumberInputBox(["border-top-right-radius","border-bottom-right-radius"],WebInspector.UIString("Radius"),this._keywords.defaults,this._units.defaults);borderRightStyle.element.appendChild(properties.borderRightColor.element);borderRightStyle.element.appendChild(properties.borderRightRadius.element);let borderRightProperties=[properties.borderRightStyle,properties.borderRightWidth,properties.borderRightColor,properties.borderRightRadius];let borderRightGroup=new WebInspector.DetailsSectionGroup([borderRightSize,borderRightStyle]);let borderBottomSize=new WebInspector.DetailsSectionRow;properties.borderBottomStyle=new WebInspector.VisualStyleKeywordPicker("border-bottom-style",WebInspector.UIString("Style"),this._keywords.borderStyle);properties.borderBottomWidth=new WebInspector.VisualStyleNumberInputBox("border-bottom-width",WebInspector.UIString("Width"),this._keywords.borderWidth,this._units.defaults);borderBottomSize.element.appendChild(properties.borderBottomStyle.element);borderBottomSize.element.appendChild(properties.borderBottomWidth.element);let borderBottomStyle=new WebInspector.DetailsSectionRow;properties.borderBottomColor=new WebInspector.VisualStyleColorPicker("border-bottom-color",WebInspector.UIString("Color"));properties.borderBottomRadius=new WebInspector.VisualStyleNumberInputBox(["border-bottom-left-radius","border-bottom-right-radius"],WebInspector.UIString("Radius"),this._keywords.defaults,this._units.defaults);borderBottomStyle.element.appendChild(properties.borderBottomColor.element);borderBottomStyle.element.appendChild(properties.borderBottomRadius.element);let borderBottomProperties=[properties.borderBottomStyle,properties.borderBottomWidth,properties.borderBottomColor,properties.borderBottomRadius];let borderBottomGroup=new WebInspector.DetailsSectionGroup([borderBottomSize,borderBottomStyle]);let borderLeftSize=new WebInspector.DetailsSectionRow;properties.borderLeftStyle=new WebInspector.VisualStyleKeywordPicker("border-left-style",WebInspector.UIString("Style"),this._keywords.borderStyle);properties.borderLeftWidth=new WebInspector.VisualStyleNumberInputBox("border-left-width",WebInspector.UIString("Width"),this._keywords.borderWidth,this._units.defaults);borderLeftSize.element.appendChild(properties.borderLeftStyle.element);borderLeftSize.element.appendChild(properties.borderLeftWidth.element);let borderLeftStyle=new WebInspector.DetailsSectionRow;properties.borderLeftColor=new WebInspector.VisualStyleColorPicker("border-left-color",WebInspector.UIString("Color"));properties.borderLeftRadius=new WebInspector.VisualStyleNumberInputBox(["border-top-left-radius","border-bottom-left-radius"],WebInspector.UIString("Radius"),this._keywords.defaults,this._units.defaults);borderLeftStyle.element.appendChild(properties.borderLeftColor.element);borderLeftStyle.element.appendChild(properties.borderLeftRadius.element);let borderLeftProperties=[properties.borderLeftStyle,properties.borderLeftWidth,properties.borderLeftColor,properties.borderLeftRadius];let borderLeftGroup=new WebInspector.DetailsSectionGroup([borderLeftSize,borderLeftStyle]);let borderTabController=new WebInspector.VisualStyleTabbedPropertiesRow({"all":{title:WebInspector.UIString("All"),element:borderAllGroup.element,properties:borderAllProperties},"top":{title:WebInspector.UIString("Top"),element:borderTopGroup.element,properties:borderTopProperties},"right":{title:WebInspector.UIString("Right"),element:borderRightGroup.element,properties:borderRightProperties},"bottom":{title:WebInspector.UIString("Bottom"),element:borderBottomGroup.element,properties:borderBottomProperties},"left":{title:WebInspector.UIString("Left"),element:borderLeftGroup.element,properties:borderLeftProperties}});let highlightMode="border";this._addMetricsMouseListeners(group.properties.borderWidth,highlightMode);this._addMetricsMouseListeners(group.properties.borderTopWidth,highlightMode);this._addMetricsMouseListeners(group.properties.borderBottomWidth,highlightMode);this._addMetricsMouseListeners(group.properties.borderLeftWidth,highlightMode);this._addMetricsMouseListeners(group.properties.borderRightWidth,highlightMode);let borderGroup=new WebInspector.DetailsSectionGroup([borderTabController,borderAllGroup,borderTopGroup,borderRightGroup,borderBottomGroup,borderLeftGroup]);let borderImageSourceRow=new WebInspector.DetailsSectionRow;properties.borderImageSource=new WebInspector.VisualStyleURLInput("border-image-source",WebInspector.UIString("Image"),this._keywords.defaults.concat(["None"]));borderImageSourceRow.element.appendChild(properties.borderImageSource.element);let borderImageRepeatRow=new WebInspector.DetailsSectionRow;let borderImageSliceFill=new WebInspector.VisualStyleKeywordCheckbox("border-image-slice",WebInspector.UIString("Fill"),"Fill");borderImageSliceFill.optionalProperty=true;properties.borderImageRepeat=new WebInspector.VisualStyleKeywordPicker("border-image-repeat",WebInspector.UIString("Repeat"),this._keywords.defaults.concat(["Stretch","Repeat","Round","Space"]));borderImageRepeatRow.element.appendChild(borderImageSliceFill.element);borderImageRepeatRow.element.appendChild(properties.borderImageRepeat.element);function generateBorderImagePropertyEditors(propertyName,keywords,units){let vertical=new WebInspector.DetailsSectionRow;let top=new WebInspector.VisualStyleNumberInputBox(propertyName,WebInspector.UIString("Top"),keywords,units);top.masterProperty=true;let bottom=new WebInspector.VisualStyleNumberInputBox(propertyName,WebInspector.UIString("Bottom"),keywords,units);bottom.masterProperty=true;vertical.element.appendChild(top.element);vertical.element.appendChild(bottom.element);let horizontal=new WebInspector.DetailsSectionRow;let left=new WebInspector.VisualStyleNumberInputBox(propertyName,WebInspector.UIString("Left"),keywords,units);left.masterProperty=true;let right=new WebInspector.VisualStyleNumberInputBox(propertyName,WebInspector.UIString("Right"),keywords,units);right.masterProperty=true;horizontal.element.appendChild(left.element);horizontal.element.appendChild(right.element);return{group:new WebInspector.DetailsSectionGroup([vertical,horizontal]),properties:[top,bottom,left,right]};}
let nonKeywordUnits=[WebInspector.UIString("Number")];let borderImageUnits=Object.shallowCopy(this._units.defaults);borderImageUnits.basic=nonKeywordUnits.concat(borderImageUnits.basic);let borderImageWidth=generateBorderImagePropertyEditors("border-image-width",this._keywords.boxModel,borderImageUnits);properties.borderImageWidth=new WebInspector.VisualStylePropertyCombiner("border-image-width",borderImageWidth.properties,true);let borderOutsetUnits=Object.shallowCopy(this._units.defaultsSansPercent);borderOutsetUnits.basic=nonKeywordUnits.concat(borderOutsetUnits.basic);let borderImageOutset=generateBorderImagePropertyEditors("border-image-outset",this._keywords.defaults,borderOutsetUnits);properties.borderImageOutset=new WebInspector.VisualStylePropertyCombiner("border-image-outset",borderImageOutset.properties,true);let borderImageSlice=generateBorderImagePropertyEditors("border-image-slice",this._keywords.defaults,["%"].concat(nonKeywordUnits));borderImageSlice.properties.push(borderImageSliceFill);properties.borderImageSlice=new WebInspector.VisualStylePropertyCombiner("border-image-slice",borderImageSlice.properties,true);let borderImagePropertiesTabController=new WebInspector.VisualStyleTabbedPropertiesRow({"width":{title:WebInspector.UIString("Width"),element:borderImageWidth.group.element,properties:[properties.borderImageWidth]},"outset":{title:WebInspector.UIString("Outset"),element:borderImageOutset.group.element,properties:[properties.borderImageOutset]},"slice":{title:WebInspector.UIString("Slice"),element:borderImageSlice.group.element,properties:[properties.borderImageSlice]}});let borderImageGroup=new WebInspector.DetailsSectionGroup([borderImageSourceRow,borderImageRepeatRow,borderImagePropertiesTabController,borderImageWidth.group,borderImageOutset.group,borderImageSlice.group]);group.autocompleteCompatibleProperties=[properties.borderColor,properties.borderTopColor,properties.borderBottomColor,properties.borderLeftColor,properties.borderRightColor];this._populateSection(group,[borderGroup,borderImageGroup]);let allowedBorderValues=["solid","dashed","dotted","double","groove","inset","outset","ridge"];properties.borderWidth.addDependency(["border-top-style","border-right-style","border-bottom-style","border-left-style"],allowedBorderValues);properties.borderColor.addDependency(["border-top-style","border-right-style","border-bottom-style","border-left-style"],allowedBorderValues);properties.borderTopWidth.addDependency("border-top-style",allowedBorderValues);properties.borderTopColor.addDependency("border-top-style",allowedBorderValues);properties.borderRightWidth.addDependency("border-right-style",allowedBorderValues);properties.borderRightColor.addDependency("border-right-style",allowedBorderValues);properties.borderBottomWidth.addDependency("border-bottom-style",allowedBorderValues);properties.borderBottomColor.addDependency("border-bottom-style",allowedBorderValues);properties.borderLeftWidth.addDependency("border-left-style",allowedBorderValues);properties.borderLeftColor.addDependency("border-left-style",allowedBorderValues);}
_populateOutlineSection()
{let group=this._groups.outline;let properties=group.properties;let outlineSizeRow=new WebInspector.DetailsSectionRow;properties.outlineStyle=new WebInspector.VisualStyleKeywordPicker("outline-style",WebInspector.UIString("Style"),this._keywords.borderStyle);properties.outlineWidth=new WebInspector.VisualStyleNumberInputBox("outline-width",WebInspector.UIString("Width"),this._keywords.borderWidth,this._units.defaults);outlineSizeRow.element.appendChild(properties.outlineStyle.element);outlineSizeRow.element.appendChild(properties.outlineWidth.element);let outlineStyleRow=new WebInspector.DetailsSectionRow;properties.outlineColor=new WebInspector.VisualStyleColorPicker("outline-color",WebInspector.UIString("Color"));properties.outlineOffset=new WebInspector.VisualStyleNumberInputBox("outline-offset",WebInspector.UIString("Offset"),this._keywords.defaults,this._units.defaults,true);outlineStyleRow.element.appendChild(properties.outlineColor.element);outlineStyleRow.element.appendChild(properties.outlineOffset.element);group.autocompleteCompatibleProperties=[properties.outlineColor];let outlineGroup=new WebInspector.DetailsSectionGroup([outlineSizeRow,outlineStyleRow]);this._populateSection(group,[outlineGroup]);let allowedOutlineValues=["solid","dashed","dotted","double","groove","inset","outset","ridge"];properties.outlineWidth.addDependency("outline-style",allowedOutlineValues);properties.outlineColor.addDependency("outline-style",allowedOutlineValues);}
_populateBoxShadowSection()
{let group=this._groups.boxShadow;let properties=group.properties;let boxShadowRow=new WebInspector.DetailsSectionRow;properties.boxShadow=new WebInspector.VisualStyleCommaSeparatedKeywordEditor("box-shadow");boxShadowRow.element.appendChild(properties.boxShadow.element);let boxShadowHRow=new WebInspector.DetailsSectionRow;let boxShadowH=new WebInspector.VisualStyleRelativeNumberSlider("box-shadow",WebInspector.UIString("Left"),null,this._units.defaultsSansPercent,true);boxShadowHRow.element.appendChild(boxShadowH.element);let boxShadowVRow=new WebInspector.DetailsSectionRow;let boxShadowV=new WebInspector.VisualStyleRelativeNumberSlider("box-shadow",WebInspector.UIString("Top"),null,this._units.defaultsSansPercent,true);boxShadowVRow.element.appendChild(boxShadowV.element);let boxShadowBlurRow=new WebInspector.DetailsSectionRow;let boxShadowBlur=new WebInspector.VisualStyleNumberInputBox("box-shadow",WebInspector.UIString("Blur"),null,this._units.defaultsSansPercent);boxShadowBlur.optionalProperty=true;let boxShadowSpread=new WebInspector.VisualStyleNumberInputBox("box-shadow",WebInspector.UIString("Spread"),null,this._units.defaultsSansPercent,true);boxShadowSpread.optionalProperty=true;boxShadowBlurRow.element.appendChild(boxShadowBlur.element);boxShadowBlurRow.element.appendChild(boxShadowSpread.element);let boxShadowColorRow=new WebInspector.DetailsSectionRow;let boxShadowColor=new WebInspector.VisualStyleColorPicker("box-shadow",WebInspector.UIString("Color"));let boxShadowInset=new WebInspector.VisualStyleKeywordCheckbox("box-shadow",WebInspector.UIString("Inset"),"Inset");boxShadowInset.optionalProperty=true;boxShadowColorRow.element.appendChild(boxShadowColor.element);boxShadowColorRow.element.appendChild(boxShadowInset.element);let boxShadowProperties=[boxShadowH,boxShadowV,boxShadowBlur,boxShadowSpread,boxShadowColor,boxShadowInset];let boxShadowPropertyCombiner=new WebInspector.VisualStylePropertyCombiner("box-shadow",boxShadowProperties);let noRemainingCommaSeparatedEditorItems=this._noRemainingCommaSeparatedEditorItems.bind(this,boxShadowPropertyCombiner,boxShadowProperties);properties.boxShadow.addEventListener(WebInspector.VisualStyleCommaSeparatedKeywordEditor.Event.NoRemainingTreeItems,noRemainingCommaSeparatedEditorItems,this);let selectedCommaSeparatedEditorItemValueChanged=this._selectedCommaSeparatedEditorItemValueChanged.bind(this,properties.boxShadow,boxShadowPropertyCombiner);boxShadowPropertyCombiner.addEventListener(WebInspector.VisualStylePropertyEditor.Event.ValueDidChange,selectedCommaSeparatedEditorItemValueChanged,this);let commaSeparatedEditorTreeItemSelected=this._commaSeparatedEditorTreeItemSelected.bind(boxShadowPropertyCombiner);properties.boxShadow.addEventListener(WebInspector.VisualStyleCommaSeparatedKeywordEditor.Event.TreeItemSelected,commaSeparatedEditorTreeItemSelected,this);group.autocompleteCompatibleProperties=[boxShadowColor];group.specifiedWidthProperties=[properties.boxShadow];let boxShadow=new WebInspector.DetailsSectionGroup([boxShadowRow,boxShadowHRow,boxShadowVRow,boxShadowBlurRow,boxShadowColorRow]);this._populateSection(group,[boxShadow]);}
_populateListStyleSection()
{let group=this._groups.listStyle;let properties=group.properties;let listStyleTypeRow=new WebInspector.DetailsSectionRow;properties.listStyleType=new WebInspector.VisualStyleKeywordPicker("list-style-type",WebInspector.UIString("Type"),{basic:this._keywords.defaults.concat(["None","Circle","Disc","Square","Decimal","Lower Alpha","Upper Alpha","Lower Roman","Upper Roman"]),advanced:["Decimal Leading Zero","Asterisks","Footnotes","Binary","Octal","Lower Hexadecimal","Upper Hexadecimal","Lower Latin","Upper Latin","Lower Greek","Upper Greek","Arabic Indic","Hebrew","Hiragana","Katakana","Hiragana Iroha","Katakana Iroha","CJK Earthly Branch","CJK Heavenly Stem","CJK Ideographic","Bengali","Cambodian","Khmer","Devanagari","Gujarati","Gurmukhi","Kannada","Lao","Malayalam","Mongolian","Myanmar","Oriya","Persian","Urdu","Telugu","Armenian","Lower Armenian","Upper Armenian","Georgian","Tibetan","Thai","Afar","Hangul Consonant","Hangul","Lower Norwegian","Upper Norwegian","Ethiopic","Ethiopic Halehame Gez","Ethiopic Halehame Aa Et","Ethiopic Halehame Aa Er","Oromo","Ethiopic Halehame Om Et","Sidama","Ethiopic Halehame Sid Et","Somali","Ethiopic Halehame So Et","Amharic","Ethiopic Halehame Am Et","Tigre","Ethiopic Halehame Tig","Tigrinya Er","Ethiopic Halehame Ti Er","Tigrinya Et","Ethiopic Halehame Ti Et","Ethiopic Abegede","Ethiopic Abegede Gez","Amharic Abegede","Ethiopic Abegede Am Et","Tigrinya Er Abegede","Ethiopic Abegede Ti Er","Tigrinya Et Abegede","Ethiopic Abegede Ti Et"]});properties.listStylePosition=new WebInspector.VisualStyleKeywordIconList("list-style-position",WebInspector.UIString("Position"),["Outside","Inside","Initial"]);listStyleTypeRow.element.appendChild(properties.listStyleType.element);listStyleTypeRow.element.appendChild(properties.listStylePosition.element);let listStyleImageRow=new WebInspector.DetailsSectionRow;properties.listStyleImage=new WebInspector.VisualStyleURLInput("list-style-image",WebInspector.UIString("Image"),this._keywords.defaults.concat(["None"]));listStyleImageRow.element.appendChild(properties.listStyleImage.element);let listStyle=new WebInspector.DetailsSectionGroup([listStyleTypeRow,listStyleImageRow]);this._populateSection(group,[listStyle]);}
_populateTransitionSection()
{let group=this._groups.transition;let properties=group.properties;let transitionRow=new WebInspector.DetailsSectionRow;properties.transition=new WebInspector.VisualStyleCommaSeparatedKeywordEditor("transition",null,{"transition-property":"all","transition-timing-function":"ease","transition-duration":"0","transition-delay":"0"});transitionRow.element.appendChild(properties.transition.element);let transitionPropertyRow=new WebInspector.DetailsSectionRow;let transitionProperty=new WebInspector.VisualStylePropertyNameInput("transition-property",WebInspector.UIString("Property"));transitionProperty.masterProperty=true;let transitionTiming=new WebInspector.VisualStyleTimingEditor("transition-timing-function",WebInspector.UIString("Timing"),["Linear","Ease","Ease In","Ease Out","Ease In Out"]);transitionTiming.optionalProperty=true;transitionPropertyRow.element.appendChild(transitionProperty.element);transitionPropertyRow.element.appendChild(transitionTiming.element);let transitionDurationRow=new WebInspector.DetailsSectionRow;let transitionTimeKeywords=["s","ms"];let transitionDuration=new WebInspector.VisualStyleNumberInputBox("transition-duration",WebInspector.UIString("Duration"),null,transitionTimeKeywords);transitionDuration.optionalProperty=true;let transitionDelay=new WebInspector.VisualStyleNumberInputBox("transition-delay",WebInspector.UIString("Delay"),null,transitionTimeKeywords);transitionDelay.optionalProperty=true;transitionDurationRow.element.appendChild(transitionDuration.element);transitionDurationRow.element.appendChild(transitionDelay.element);let transitionProperties=[transitionProperty,transitionDuration,transitionTiming,transitionDelay];let transitionPropertyCombiner=new WebInspector.VisualStylePropertyCombiner("transition",transitionProperties);let noRemainingCommaSeparatedEditorItems=this._noRemainingCommaSeparatedEditorItems.bind(this,transitionPropertyCombiner,transitionProperties);properties.transition.addEventListener(WebInspector.VisualStyleCommaSeparatedKeywordEditor.Event.NoRemainingTreeItems,noRemainingCommaSeparatedEditorItems,this);let selectedCommaSeparatedEditorItemValueChanged=this._selectedCommaSeparatedEditorItemValueChanged.bind(this,properties.transition,transitionPropertyCombiner);transitionPropertyCombiner.addEventListener(WebInspector.VisualStylePropertyEditor.Event.ValueDidChange,selectedCommaSeparatedEditorItemValueChanged,this);let commaSeparatedEditorTreeItemSelected=this._commaSeparatedEditorTreeItemSelected.bind(transitionPropertyCombiner);properties.transition.addEventListener(WebInspector.VisualStyleCommaSeparatedKeywordEditor.Event.TreeItemSelected,commaSeparatedEditorTreeItemSelected,this);group.autocompleteCompatibleProperties=[transitionProperty];group.specifiedWidthProperties=[properties.transition];let transitionGroup=new WebInspector.DetailsSectionGroup([transitionRow,transitionPropertyRow,transitionDurationRow]);this._populateSection(group,[transitionGroup]);}
_populateAnimationSection()
{let group=this._groups.animation;let properties=group.properties;let animationRow=new WebInspector.DetailsSectionRow;properties.animation=new WebInspector.VisualStyleCommaSeparatedKeywordEditor("animation",null,{"animation-name":"none","animation-timing-function":"ease","animation-iteration-count":"1","animation-duration":"0","animation-delay":"0","animation-direction":"normal","animation-fill-mode":"none","animation-play-state":"running"});animationRow.element.appendChild(properties.animation.element);let animationNameRow=new WebInspector.DetailsSectionRow;let animationName=new WebInspector.VisualStyleBasicInput("animation-name",WebInspector.UIString("Name"),WebInspector.UIString("Enter the name of a Keyframe"));animationName.masterProperty=true;animationNameRow.element.appendChild(animationName.element);let animationTimingRow=new WebInspector.DetailsSectionRow;let animationTiming=new WebInspector.VisualStyleTimingEditor("animation-timing-function",WebInspector.UIString("Timing"),["Linear","Ease","Ease In","Ease Out","Ease In Out"]);animationTiming.optionalProperty=true;let animationIterationCount=new WebInspector.VisualStyleNumberInputBox("animation-iteration-count",WebInspector.UIString("Iterations"),this._keywords.defaults.concat(["Infinite"]),null);animationIterationCount.optionalProperty=true;animationTimingRow.element.appendChild(animationTiming.element);animationTimingRow.element.appendChild(animationIterationCount.element);let animationDurationRow=new WebInspector.DetailsSectionRow;let animationTimeKeywords=["s","ms"];let animationDuration=new WebInspector.VisualStyleNumberInputBox("animation-duration",WebInspector.UIString("Duration"),null,animationTimeKeywords);animationDuration.optionalProperty=true;let animationDelay=new WebInspector.VisualStyleNumberInputBox("animation-delay",WebInspector.UIString("Delay"),null,animationTimeKeywords);animationDelay.optionalProperty=true;animationDurationRow.element.appendChild(animationDuration.element);animationDurationRow.element.appendChild(animationDelay.element);let animationDirectionRow=new WebInspector.DetailsSectionRow;let animationDirection=new WebInspector.VisualStyleKeywordPicker("animation-direction",WebInspector.UIString("Direction"),{basic:this._keywords.normal.concat(["Reverse"]),advanced:["Alternate","Alternate Reverse"]});animationDirection.optionalProperty=true;let animationFillMode=new WebInspector.VisualStyleKeywordPicker("animation-fill-mode",WebInspector.UIString("Fill Mode"),this._keywords.defaults.concat(["None","Forwards","Backwards","Both"]));animationFillMode.optionalProperty=true;animationDirectionRow.element.appendChild(animationDirection.element);animationDirectionRow.element.appendChild(animationFillMode.element);let animationStateRow=new WebInspector.DetailsSectionRow;let animationPlayState=new WebInspector.VisualStyleKeywordIconList("animation-play-state",WebInspector.UIString("State"),["Running","Paused","Initial"]);animationPlayState.optionalProperty=true;animationStateRow.element.appendChild(animationPlayState.element);let animationProperties=[animationName,animationDuration,animationTiming,animationDelay,animationIterationCount,animationDirection,animationFillMode,animationPlayState];let animationPropertyCombiner=new WebInspector.VisualStylePropertyCombiner("animation",animationProperties);let noRemainingCommaSeparatedEditorItems=this._noRemainingCommaSeparatedEditorItems.bind(this,animationPropertyCombiner,animationProperties);properties.animation.addEventListener(WebInspector.VisualStyleCommaSeparatedKeywordEditor.Event.NoRemainingTreeItems,noRemainingCommaSeparatedEditorItems,this);let selectedCommaSeparatedEditorItemValueChanged=this._selectedCommaSeparatedEditorItemValueChanged.bind(this,properties.animation,animationPropertyCombiner);animationPropertyCombiner.addEventListener(WebInspector.VisualStylePropertyEditor.Event.ValueDidChange,selectedCommaSeparatedEditorItemValueChanged,this);let commaSeparatedEditorTreeItemSelected=this._commaSeparatedEditorTreeItemSelected.bind(animationPropertyCombiner);properties.animation.addEventListener(WebInspector.VisualStyleCommaSeparatedKeywordEditor.Event.TreeItemSelected,commaSeparatedEditorTreeItemSelected,this);group.specifiedWidthProperties=[properties.animation];let animationGroup=new WebInspector.DetailsSectionGroup([animationRow,animationNameRow,animationTimingRow,animationDurationRow,animationDirectionRow,animationStateRow]);this._populateSection(group,[animationGroup]);}
_noRemainingCommaSeparatedEditorItems(propertyCombiner,propertyEditors)
{if(!propertyCombiner||!propertyEditors)
return;propertyCombiner.updateValuesFromText("");for(let editor of propertyEditors)
editor.disabled=true;}
_selectedCommaSeparatedEditorItemValueChanged(propertyEditor,propertyCombiner)
{propertyEditor.selectedTreeElementValue=propertyCombiner.synthesizedValue;}
_commaSeparatedEditorTreeItemSelected(event)
{if(typeof this.updateValuesFromText==="function")
this.updateValuesFromText(event.data.text||"");}};WebInspector.VisualStyleDetailsPanel.StyleDisabledSymbol=Symbol("visual-style-style-disabled");WebInspector.VisualStyleDetailsPanel.InitialPropertySectionTextListSymbol=Symbol("visual-style-initial-property-section-text");
WebInspector.VisualStyleDetailsPanel.propertyReferenceInfo={};WebInspector.VisualStylePropertyEditor=class VisualStylePropertyEditor extends WebInspector.Object
{constructor(propertyNames,label,possibleValues,possibleUnits,className,layoutReversed)
{super();this._propertyInfoList=[];this._style=null;function canonicalizeValues(values)
{if(!values)
return;let canonicalizedValues={};for(let value of values)
canonicalizedValues[value.toLowerCase().replace(/\s/g,"-")]=value;return canonicalizedValues;}
this._possibleValues=null;if(possibleValues){this._possibleValues={};if(Array.isArray(possibleValues))
this._possibleValues.basic=canonicalizeValues(possibleValues);else{this._possibleValues.basic=canonicalizeValues(possibleValues.basic);this._possibleValues.advanced=canonicalizeValues(possibleValues.advanced);}}
this._possibleUnits=null;if(possibleUnits){this._possibleUnits={};if(Array.isArray(possibleUnits))
this._possibleUnits.basic=possibleUnits;else
this._possibleUnits=possibleUnits;}
this._dependencies=new Map;this._element=document.createElement("div");this._element.classList.add("visual-style-property-container",className);this._element.classList.toggle("layout-reversed",!!layoutReversed);if(label&&label.length){let titleContainer=this._element.createChild("div","visual-style-property-title");this._titleElement=titleContainer.createChild("span");this._titleElement.append(label);this._titleElement.title=label;this._titleElement.addEventListener("mouseover",this._titleElementMouseOver.bind(this));this._titleElement.addEventListener("mouseout",this._titleElementMouseOut.bind(this));this._titleElement.addEventListener("click",this._titleElementClick.bind(this));this._boundTitleElementPrepareForClick=this._titleElementPrepareForClick.bind(this);}
this._contentElement=this._element.createChild("div","visual-style-property-value-container");this._specialPropertyPlaceholderElement=this._contentElement.createChild("span","visual-style-special-property-placeholder");this._specialPropertyPlaceholderElement.hidden=true;this._warningElement=this._element.createChild("div","visual-style-property-editor-warning");this._updatedValues={};this._lastValue=null;this._propertyMissing=false;if(typeof propertyNames==="string")
propertyNames=[propertyNames];else{this._hasMultipleProperties=true;this._element.classList.add("multiple");}
for(let name of propertyNames){this._element.classList.add(name);this._propertyInfoList.push({name,textContainsNameRegExp:new RegExp("(?:(?:^|;)\\s*"+name+"\\s*:)"),replacementRegExp:new RegExp("((?:^|;)\\s*)("+name+")(.+?(?:;|$))")});}
this._propertyReferenceName=propertyNames[0];this._propertyReferenceText=WebInspector.VisualStyleDetailsPanel.propertyReferenceInfo[this._propertyReferenceName];this._hasPropertyReference=this._propertyReferenceText&&!!this._propertyReferenceText.trim().length;this._representedProperty=null;}
static generateFormattedTextForNewProperty(styleText,propertyName,propertyValue){if(!propertyName||!propertyValue)
return"";styleText=styleText||"";let linePrefixText=WebInspector.indentString();let lineSuffixWhitespace="\n";let trimmedText=styleText.trimRight();let textHasNewlines=trimmedText.includes("\n");if(trimmedText.trimLeft().length){let styleTextPrefixWhitespace=trimmedText.match(/^\s*/);if(styleTextPrefixWhitespace){let linePrefixWhitespaceMatch=styleTextPrefixWhitespace[0].match(/[^\S\n]+$/);if(linePrefixWhitespaceMatch&&textHasNewlines)
linePrefixText=linePrefixWhitespaceMatch[0];else{linePrefixText="";lineSuffixWhitespace=styleTextPrefixWhitespace[0];}}
if(!trimmedText.endsWith(";"))
linePrefixText=";"+linePrefixText;}else
linePrefixText="\n"+linePrefixText;return linePrefixText+propertyName+": "+propertyValue+";"+lineSuffixWhitespace;}
get element()
{return this._element;}
get style()
{return this._style;}
get value()
{}
set value(value)
{}
get units()
{}
set units(unit)
{}
get placeholder()
{}
set placeholder(text)
{}
get synthesizedValue()
{}
set suppressStyleTextUpdate(flag)
{this._suppressStyleTextUpdate=flag;}
set masterProperty(flag)
{this._masterProperty=flag;}
get masterProperty()
{return this._masterProperty;}
set optionalProperty(flag)
{this._optionalProperty=flag;}
get optionalProperty()
{return this._optionalProperty;}
set colorProperty(flag)
{this._colorProperty=flag;}
get colorProperty()
{return this._colorProperty;}
get propertyReferenceName()
{return this._propertyReferenceName;}
set propertyReferenceName(name)
{if(!name||!name.length)
return;this._propertyReferenceName=name;}
set disabled(flag)
{this._disabled=flag;this._element.classList.toggle("disabled",this._disabled);this._toggleTabbingOfSelectableElements(this._disabled);}
get disabled()
{return this._disabled;}
update(style)
{if(style)
this._style=style;else if(this._ignoreNextUpdate){this._ignoreNextUpdate=false;return;}
if(!this._style)
return;this._updatedValues={};let propertyValuesConflict=false;let propertyMissing=false;for(let propertyInfo of this._propertyInfoList){let property=this._style.propertyForName(propertyInfo.name,true);propertyMissing=!property;if(propertyMissing&&this._style.nodeStyles)
property=this._style.nodeStyles.computedStyle.propertyForName(propertyInfo.name);let longhandPropertyValue=null;if(typeof this._generateTextFromLonghandProperties==="function")
longhandPropertyValue=this._generateTextFromLonghandProperties();if(longhandPropertyValue)
propertyMissing=false;let propertyText=(property&&property.value)||longhandPropertyValue;if(!propertyText||!propertyText.length)
continue;if(!propertyMissing&&property&&property.anonymous)
this._representedProperty=property;if(!propertyMissing&&property&&!property.valid){this._element.classList.add("invalid-value");this._warningElement.title=WebInspector.UIString("The value “%s” is not supported for this property.").format(propertyText);this.specialPropertyPlaceholderElementText=propertyText;return;}
let newValues=this.getValuesFromText(propertyText,propertyMissing);if(this._updatedValues.placeholder&&this._updatedValues.placeholder!==newValues.placeholder)
propertyValuesConflict=true;if(!this._updatedValues.placeholder)
this._updatedValues=newValues;if(propertyValuesConflict){this._updatedValues.conflictingValues=true;this.specialPropertyPlaceholderElementText=WebInspector.UIString("(multiple)");break;}}
if(this._hasMultipleProperties)
this._specialPropertyPlaceholderElement.hidden=!propertyValuesConflict;this.updateEditorValues(this._updatedValues);}
updateEditorValues(updatedValues)
{this.value=updatedValues.value;this.units=updatedValues.units;this.placeholder=updatedValues.placeholder;this._lastValue=this.synthesizedValue;this.disabled=false;this._element.classList.remove("invalid-value");this._checkDependencies();}
resetEditorValues(value)
{this._ignoreNextUpdate=false;if(!value||!value.length){this.value=null;this._specialPropertyPlaceholderElement.hidden=false;return;}
let updatedValues=this.getValuesFromText(value);this.updateEditorValues(updatedValues);}
modifyPropertyText(text,value)
{for(let property of this._propertyInfoList){if(property.textContainsNameRegExp.test(text))
text=text.replace(property.replacementRegExp,value!==null?"$1$2: "+value+";":"$1");else if(value!==null)
text+=WebInspector.VisualStylePropertyEditor.generateFormattedTextForNewProperty(text,property.name,value);}
return text;}
getValuesFromText(text,propertyMissing)
{let match=this.parseValue(text);let placeholder=match?match[1]:text;let units=match?match[2]:null;let value=placeholder;if(propertyMissing)
value=this.valueIsSupportedKeyword(text)?text:null;this._propertyMissing=propertyMissing||false;return{value,units,placeholder};}
get propertyMissing()
{return this._updatedValues&&this._propertyMissing;}
valueIsCompatible(value)
{if(!value||!value.length)
return false;return this.valueIsSupportedKeyword(value)||!!this.parseValue(value);}
valueIsSupportedKeyword(value){if(!this._possibleValues)
return false;if(Object.keys(this._possibleValues.basic).includes(value))
return true;return this._valueIsSupportedAdvancedKeyword(value);}
valueIsSupportedUnit(unit)
{if(!this._possibleUnits)
return false;if(this._possibleUnits.basic.includes(unit))
return true;return this._valueIsSupportedAdvancedUnit(unit);}
addDependency(propertyNames,propertyValues)
{if(!propertyNames||!propertyNames.length||!propertyValues||!propertyValues.length)
return;if(!Array.isArray(propertyNames))
propertyNames=[propertyNames];for(let property of propertyNames)
this._dependencies.set(property,propertyValues);}
get contentElement()
{return this._contentElement;}
get specialPropertyPlaceholderElement()
{return this._specialPropertyPlaceholderElement;}
set specialPropertyPlaceholderElementText(text)
{if(!text||!text.length)
return;this._specialPropertyPlaceholderElement.hidden=false;this._specialPropertyPlaceholderElement.textContent=text;}
parseValue(text)
{return/^([^;]+)\s*;?$/.exec(text);}
_valueIsSupportedAdvancedKeyword(value)
{return this._possibleValues.advanced&&Object.keys(this._possibleValues.advanced).includes(value);}
_valueIsSupportedAdvancedUnit(unit)
{return this._possibleUnits.advanced&&this._possibleUnits.advanced.includes(unit);}
_canonicalizedKeywordForKey(value)
{if(!value||!this._possibleValues)
return null;return this._possibleValues.basic[value]||(this._possibleValues.advanced&&this._possibleValues.advanced[value])||null;}
_keyForKeyword(keyword)
{if(!keyword||!keyword.length||!this._possibleValues)
return null;for(let basicKey in this._possibleValues.basic){if(this._possibleValues.basic[basicKey]===keyword)
return basicKey;}
if(!this._possibleValues.advanced)
return null;for(let advancedKey in this._possibleValues.advanced){if(this._possibleValues.advanced[advancedKey]===keyword)
return advancedKey;}
return null;}
_valueDidChange()
{let value=this.synthesizedValue;if(value===this._lastValue)
return false;if(this._style&&!this._suppressStyleTextUpdate){let newText=this._style.text;newText=this._replaceShorthandPropertyWithLonghandProperties(newText);newText=this.modifyPropertyText(newText,value);this._style.text=newText;if(!newText.length)
this._style.update(null,null,this._style.styleSheetTextRange);}
this._lastValue=value;this._propertyMissing=!value;this._ignoreNextUpdate=true;this._specialPropertyPlaceholderElement.hidden=true;this._checkDependencies();this._element.classList.remove("invalid-value");this.dispatchEventToListeners(WebInspector.VisualStylePropertyEditor.Event.ValueDidChange);return true;}
_replaceShorthandPropertyWithLonghandProperties(text)
{if(!this._representedProperty)
return text;let shorthand=this._representedProperty.relatedShorthandProperty;if(!shorthand)
return text;let longhandText="";for(let longhandProperty of shorthand.relatedLonghandProperties){if(longhandProperty.anonymous)
longhandText+=longhandProperty.synthesizedText;}
return longhandText?text.replace(shorthand.text,longhandText):text;}
_hasMultipleConflictingValues()
{return this._hasMultipleProperties&&!this._specialPropertyPlaceholderElement.hidden;}
_checkDependencies()
{if(!this._dependencies.size||!this._style||!this.synthesizedValue){this._element.classList.remove("missing-dependency");return;}
let title="";let dependencies=this._style.nodeStyles.computedStyle.properties.filter((property)=>{return this._dependencies.has(property.name)||this._dependencies.has(property.canonicalName);});for(let property of dependencies){let dependencyValues=this._dependencies.get(property.name);if(!dependencyValues.includes(property.value))
title+="\n "+property.name+": "+dependencyValues.join("/");}
this._element.classList.toggle("missing-dependency",!!title.length);this._warningElement.title=title.length?WebInspector.UIString("Missing Dependencies:%s").format(title):null;}
_titleElementPrepareForClick(event)
{this._titleElement.classList.toggle("property-reference-info",event.type==="keydown"&&event.altKey);}
_titleElementMouseOver(event)
{if(!this._hasPropertyReference)
return;this._titleElement.classList.toggle("property-reference-info",event.altKey);document.addEventListener("keydown",this._boundTitleElementPrepareForClick);document.addEventListener("keyup",this._boundTitleElementPrepareForClick);}
_titleElementMouseOut()
{if(!this._hasPropertyReference)
return;this._titleElement.classList.remove("property-reference-info");document.removeEventListener("keydown",this._boundTitleElementPrepareForClick);document.removeEventListener("keyup",this._boundTitleElementPrepareForClick);}
_titleElementClick(event)
{if(event.altKey)
this._showPropertyInfoPopover();}
_showPropertyInfoPopover()
{if(!this._hasPropertyReference)
return;let propertyInfoElement=document.createElement("p");propertyInfoElement.classList.add("visual-style-property-info-popover");let propertyInfoTitleElement=document.createElement("h3");propertyInfoTitleElement.appendChild(document.createTextNode(this._propertyReferenceName));propertyInfoElement.appendChild(propertyInfoTitleElement);propertyInfoElement.appendChild(document.createTextNode(this._propertyReferenceText));let bounds=WebInspector.Rect.rectFromClientRect(this._titleElement.getBoundingClientRect());let popover=new WebInspector.Popover(this);popover.content=propertyInfoElement;popover.present(bounds.pad(2),[WebInspector.RectEdge.MIN_Y]);popover.windowResizeHandler=()=>{let bounds=WebInspector.Rect.rectFromClientRect(this._titleElement.getBoundingClientRect());popover.present(bounds.pad(2),[WebInspector.RectEdge.MIN_Y]);};}
_toggleTabbingOfSelectableElements(disabled)
{}};WebInspector.VisualStylePropertyEditor.Event={ValueDidChange:"visual-style-property-editor-value-changed"};WebInspector.VisualStyleBackgroundPicker=class VisualStyleBackgroundPicker extends WebInspector.VisualStylePropertyEditor
{constructor(propertyNames,text,possibleValues,layoutReversed)
{super(propertyNames,text,possibleValues,null,"background-picker",layoutReversed);this._gradientSwatch=new WebInspector.InlineSwatch(WebInspector.InlineSwatch.Type.Gradient);this._gradientSwatch.addEventListener(WebInspector.InlineSwatch.Event.ValueChanged,this._gradientSwatchColorChanged,this);this.contentElement.appendChild(this._gradientSwatch.element);this._valueInputElement=document.createElement("input");this._valueInputElement.classList.add("value-input");this._valueInputElement.type="url";this._valueInputElement.placeholder=WebInspector.UIString("Enter a URL");this._valueInputElement.addEventListener("input",this.debounce(250)._valueInputValueChanged);this.contentElement.appendChild(this._valueInputElement);this._valueTypePickerElement=document.createElement("select");this._valueTypePickerElement.classList.add("value-type-picker-select");if(this._possibleValues.advanced)
this._valueTypePickerElement.title=WebInspector.UIString("Option-click to show all values");let imageOption=document.createElement("option");imageOption.value="url";imageOption.text=WebInspector.UIString("Image");this._valueTypePickerElement.appendChild(imageOption);let linearGradientOption=document.createElement("option");linearGradientOption.value="linear-gradient";linearGradientOption.text=WebInspector.UIString("Linear Gradient");this._valueTypePickerElement.appendChild(linearGradientOption);let radialGradientOption=document.createElement("option");radialGradientOption.value="radial-gradient";radialGradientOption.text=WebInspector.UIString("Radial Gradient");this._valueTypePickerElement.appendChild(radialGradientOption);let repeatingLinearGradientOption=document.createElement("option");repeatingLinearGradientOption.value="repeating-linear-gradient";repeatingLinearGradientOption.text=WebInspector.UIString("Repeating Linear Gradient");this._valueTypePickerElement.appendChild(repeatingLinearGradientOption);let repeatingRadialGradientOption=document.createElement("option");repeatingRadialGradientOption.value="repeating-radial-gradient";repeatingRadialGradientOption.text=WebInspector.UIString("Repeating Radial Gradient");this._valueTypePickerElement.appendChild(repeatingRadialGradientOption);this._valueTypePickerElement.appendChild(document.createElement("hr"));this._createValueOptions(this._possibleValues.basic);this._advancedValuesElements=null;this._valueTypePickerElement.addEventListener("mousedown",this._keywordSelectMouseDown.bind(this));this._valueTypePickerElement.addEventListener("change",this._handleKeywordChanged.bind(this));this.contentElement.appendChild(this._valueTypePickerElement);this._currentType="url";}
get value()
{return this._valueInputElement.value;}
set value(value)
{if(!value||!value.length||value===this.value)
return;const isKeyword=this.valueIsSupportedKeyword(value);this._currentType=isKeyword?value:value.substring(0,value.indexOf("("));this._updateValueInput();if(!isKeyword)
this._valueInputElement.value=value.substring(value.indexOf("(")+1,value.length-1);this._valueTypePickerElement.value=this._currentType;if(!this._currentType.includes("gradient"))
return;this._updateGradient();}
get synthesizedValue()
{if(this.valueIsSupportedKeyword(this._currentType))
return this._currentType;return this._currentType+"("+this.value+")";}
parseValue(text)
{const validPrefixes=["url","linear-gradient","radial-gradient","repeating-linear-gradient","repeating-radial-gradient"];return validPrefixes.some((item)=>text.startsWith(item))?[text,text]:null;}
_updateValueInput()
{const supportedKeyword=this.valueIsSupportedKeyword(this._currentType);const gradientValue=this._currentType.includes("gradient");this.contentElement.classList.toggle("gradient-value",!supportedKeyword&&gradientValue);this._valueInputElement.disabled=supportedKeyword;if(supportedKeyword){this._valueInputElement.value="";this._valueInputElement.placeholder=WebInspector.UIString("Using Keyword Value");}else{if(this._currentType==="image"){this._valueInputElement.type="url";this._valueInputElement.placeholder=WebInspector.UIString("Enter a URL");}else if(gradientValue){this._valueInputElement.type="text";this._valueInputElement.placeholder=WebInspector.UIString("Enter a Gradient");}}}
_updateGradient()
{const value=this.synthesizedValue;if(!value||value===this._currentType)
return;this._gradientSwatch.value=WebInspector.Gradient.fromString(value);}
_gradientSwatchColorChanged(event)
{this.value=event.data.value.toString();this._valueDidChange();}
_valueInputValueChanged(event)
{this._updateGradient();this._valueDidChange();}
_keywordSelectMouseDown(event)
{if(event.altKey)
this._addAdvancedValues();else if(!this._valueIsSupportedAdvancedKeyword(this.value))
this._removeAdvancedValues();}
_handleKeywordChanged(event)
{this._currentType=this._valueTypePickerElement.value;this._updateValueInput();this._updateGradient();this._valueDidChange();}
_createValueOptions(values)
{let addedElements=[];for(let key in values){let option=document.createElement("option");option.value=key;option.text=values[key];this._valueTypePickerElement.appendChild(option);addedElements.push(option);}
return addedElements;}
_addAdvancedValues()
{if(this._advancedValuesElements)
return;this._valueTypePickerElement.appendChild(document.createElement("hr"));this._advancedValuesElements=this._createValueOptions(this._possibleValues.advanced);}
_removeAdvancedValues()
{if(!this._advancedValuesElements)
return;this._valueTypePickerElement.removeChild(this._advancedValuesElements[0].previousSibling);for(let element of this._advancedValuesElements)
this._valueTypePickerElement.removeChild(element);this._advancedValuesElements=null;}
_toggleTabbingOfSelectableElements(disabled)
{let tabIndex=disabled?"-1":null;this._valueInputElement.tabIndex=tabIndex;this._valueTypePickerElement.tabIndex=tabIndex;}};WebInspector.VisualStyleBasicInput=class VisualStyleBasicInput extends WebInspector.VisualStylePropertyEditor
{constructor(propertyNames,text,placeholder,layoutReversed)
{super(propertyNames,text,null,null,"basic-input",layoutReversed);this._inputElement=this.contentElement.createChild("input");this._inputElement.spellcheck=false;this._inputElement.setAttribute("placeholder",placeholder||"");this._inputElement.addEventListener("input",this.debounce(250)._handleInputElementInput);}
get value()
{return this._inputElement.value||null;}
set value(value)
{if(value&&value===this.value)
return;this._inputElement.value=value||"";}
get synthesizedValue()
{return this.value;}
_handleInputElementInput(event)
{let value=this.value;if(value&&value.trim().length){let validItems=[];for(let item of value.split(/([^\"\'\s]+|\"[^\"]*\"|\'[^\']*\')/)){if(!item.length||(!item.hasMatchingEscapedQuotes()&&!/^[\w\s\-\.\(\)]+$/.test(item)))
continue;validItems.push(item);}
this.value=validItems.filter(item=>item.trim().length).join(" ");}
this._valueDidChange();}};WebInspector.VisualStyleColorPicker=class VisualStyleColorPicker extends WebInspector.VisualStylePropertyEditor
{constructor(propertyNames,text,layoutReversed)
{super(propertyNames,text,null,null,"input-color-picker",layoutReversed);this._colorSwatch=new WebInspector.InlineSwatch(WebInspector.InlineSwatch.Type.Color);this._colorSwatch.addEventListener(WebInspector.InlineSwatch.Event.ValueChanged,this._colorSwatchColorChanged,this);this.contentElement.appendChild(this._colorSwatch.element);this._textInputElement=document.createElement("input");this._textInputElement.spellcheck=false;this._textInputElement.addEventListener("keydown",this._textInputKeyDown.bind(this));this._textInputElement.addEventListener("keyup",this.debounce(250)._textInputKeyUp);this._textInputElement.addEventListener("blur",this._hideCompletions.bind(this));this.contentElement.appendChild(this._textInputElement);this._completionController=new WebInspector.VisualStyleCompletionsController(this);this._completionController.addEventListener(WebInspector.VisualStyleCompletionsController.Event.CompletionSelected,this._completionClicked,this);this._formatChanged=false;this._updateColorSwatch();this._colorProperty=true;}
get value()
{return this._textInputElement.value;}
set value(value)
{if(value&&value===this.value)
return;this._textInputElement.value=this._hasMultipleConflictingValues()?null:value;this._updateColorSwatch();}
get placeholder()
{return this._textInputElement.getAttribute("placeholder");}
set placeholder(text)
{if(text&&text===this.placeholder)
return;if(this._hasMultipleConflictingValues())
text=this.specialPropertyPlaceholderElement.textContent;this._textInputElement.setAttribute("placeholder",text||"transparent");}
get synthesizedValue()
{return this.value||null;}
get hasCompletions()
{return this._completionController.hasCompletions;}
set completions(completions)
{this._completionController.completions=completions;}
_colorSwatchColorChanged(event)
{let colorString=event&&event.data&&event.data.value&&event.data.value.toString();if(!colorString)
return;this.value=colorString;this._valueDidChange();}
_updateColorSwatch()
{let value=this._textInputElement.value;this._colorSwatch.value=WebInspector.Color.fromString(value);}
_completionClicked(event)
{this.value=event.data.text;this._valueDidChange();}
_textInputKeyDown(event)
{if(!this._completionController.visible)
return;let keyCode=event.keyCode;let enterKeyCode=WebInspector.KeyboardShortcut.Key.Enter.keyCode;let tabKeyCode=WebInspector.KeyboardShortcut.Key.Tab.keyCode;if(keyCode===enterKeyCode||keyCode===tabKeyCode){this.value=this._completionController.currentCompletion;this._hideCompletions();this._valueDidChange();return;}
let escapeKeyCode=WebInspector.KeyboardShortcut.Key.Escape.keyCode;if(keyCode===escapeKeyCode){this._hideCompletions();return;}
let key=event.keyIdentifier;if(key==="Up"){this._completionController.previous();return;}
if(key==="Down"){this._completionController.next();return;}}
_textInputKeyUp()
{this._showCompletionsIfAble();this._updateColorSwatch();this._valueDidChange();}
_showCompletionsIfAble()
{if(!this.hasCompletions)
return;let result=this._valueDidChange();if(!result)
return;if(this._completionController.update(this.value)){let bounds=WebInspector.Rect.rectFromClientRect(this._textInputElement.getBoundingClientRect());if(!bounds)
return;this._completionController.show(bounds,2);}}
_hideCompletions()
{this._completionController.hide();}
_toggleTabbingOfSelectableElements(disabled)
{this._textInputElement.tabIndex=disabled?"-1":null;}};WebInspector.VisualStyleCommaSeparatedKeywordEditor=class VisualStyleCommaSeparatedKeywordEditor extends WebInspector.VisualStylePropertyEditor
{constructor(propertyNames,text,longhandProperties,insertNewItemsBeforeSelected,layoutReversed)
{super(propertyNames,text,null,null,"comma-separated-keyword-editor",layoutReversed);this._insertNewItemsBeforeSelected=insertNewItemsBeforeSelected||false;this._longhandProperties=longhandProperties||{};let listElement=document.createElement("ol");listElement.classList.add("visual-style-comma-separated-keyword-list");listElement.addEventListener("keydown",this._listElementKeyDown.bind(this));this.contentElement.appendChild(listElement);this._commaSeparatedKeywords=new WebInspector.TreeOutline(listElement);this._commaSeparatedKeywords.addEventListener(WebInspector.TreeOutline.Event.SelectionDidChange,this._treeSelectionDidChange,this);let controlContainer=document.createElement("div");controlContainer.classList.add("visual-style-comma-separated-keyword-controls");this.contentElement.appendChild(controlContainer);let addGlyphElement=useSVGSymbol("Images/Plus13.svg","visual-style-add-comma-separated-keyword");addGlyphElement.addEventListener("click",this._addEmptyCommaSeparatedKeyword.bind(this));controlContainer.appendChild(addGlyphElement);let removeGlyphElement=useSVGSymbol("Images/Minus.svg","visual-style-remove-comma-separated-keyword",WebInspector.UIString("Remove selected item"));removeGlyphElement.addEventListener("click",this._removeSelectedCommaSeparatedKeyword.bind(this));controlContainer.appendChild(removeGlyphElement);}
set selectedTreeElementValue(text)
{let selectedTreeElement=this._commaSeparatedKeywords.selectedTreeElement;if(!selectedTreeElement)
return;selectedTreeElement.element.classList.toggle("no-value",!text||!text.length);selectedTreeElement.mainTitle=text;this._valueDidChange();}
get value()
{if(!this._commaSeparatedKeywords.hasChildren)
return"";let value="";for(let treeItem of this._commaSeparatedKeywords.children){if(this._treeElementIsEmpty(treeItem))
continue;if(value.length)
value+=", ";let text=treeItem.mainTitle;if(typeof this._modifyCommaSeparatedKeyword==="function")
text=this._modifyCommaSeparatedKeyword(text);value+=text;}
return value;}
set value(commaSeparatedValue)
{if(commaSeparatedValue&&commaSeparatedValue===this.value)
return;this._commaSeparatedKeywords.removeChildren();if(!commaSeparatedValue||!commaSeparatedValue.length){this.dispatchEventToListeners(WebInspector.VisualStyleCommaSeparatedKeywordEditor.Event.NoRemainingTreeItems);return;}
let values=commaSeparatedValue.split(/\)\s*,\s*(?![^\(\)]*\))/);for(let i=0;i<values.length;++i){if(!values[i].includes(","))
continue;let openParentheses=values[i].getMatchingIndexes("(").length;let closedParenthesis=values[i].getMatchingIndexes(")").length;values[i]+=(openParentheses-closedParenthesis===1)?")":"";}
let hasParenthesis=values[0]&&(values[0].includes("(")||values[0].includes(")"));if(values.length===1&&(!hasParenthesis||!/\([^\)]*,[^\)]*\)/.test(values[0])))
values=values[0].split(/\s*,\s*/);for(let value of values)
this._addCommaSeparatedKeyword(value);this._commaSeparatedKeywords.children[0].select(true);}
get synthesizedValue()
{return this.value||null;}
recalculateWidth(value)
{if(this._titleElement){ value-=74;}else{ value-=22;}
this.contentElement.style.width=Math.max(value,0)+"px";}
_generateTextFromLonghandProperties()
{let text="";if(!this._style)
return text;function propertyValue(existingProperty,propertyName){if(existingProperty)
return existingProperty.value;if(propertyName)
return this._longhandProperties[propertyName];return"";}
let onePropertyExists=false;let valueLists=[];let valuesCount=0;for(let propertyName in this._longhandProperties){let existingProperty=this._style.propertyForName(propertyName,true);if(existingProperty)
onePropertyExists=true;let matches=propertyValue.call(this,existingProperty,propertyName).split(/\s*,\s*(?![^\(]*\))/);valuesCount=Math.max(valuesCount,matches.length);valueLists.push(matches);}
if(!onePropertyExists)
return text;let count=0;while(count<valuesCount){if(count>0)
text+=", ";for(let valueList of valueLists)
text+=valueList[count>valueList.length-1?valueList.length-1:count]+" ";++count;}
return text;}
modifyPropertyText(text,value)
{for(let property in this._longhandProperties){let replacementRegExp=new RegExp(property+"\s*:\s*[^;]*(;|$)");text=text.replace(replacementRegExp,"");}
return super.modifyPropertyText(text,value);}
_listElementKeyDown(event)
{let selectedTreeElement=this._commaSeparatedKeywords.selectedTreeElement;if(!selectedTreeElement)
return;if(selectedTreeElement.currentlyEditing)
return;let keyCode=event.keyCode;let backspaceKeyCode=WebInspector.KeyboardShortcut.Key.Backspace.keyCode;let deleteKeyCode=WebInspector.KeyboardShortcut.Key.Delete.keyCode;if(keyCode===backspaceKeyCode||keyCode===deleteKeyCode)
this._removeSelectedCommaSeparatedKeyword();}
_treeSelectionDidChange(event)
{let treeElement=event.data.selectedElement;if(!treeElement)
return;this._removeEmptyCommaSeparatedKeywords();this.dispatchEventToListeners(WebInspector.VisualStyleCommaSeparatedKeywordEditor.Event.TreeItemSelected,{text:treeElement.mainTitle});}
_treeElementIsEmpty(item)
{return!item._mainTitle||!item._mainTitle.length;}
_addEmptyCommaSeparatedKeyword()
{let newTreeElement=this._addCommaSeparatedKeyword(null,this._commaSeparatedKeywords.selectedTreeElementIndex);newTreeElement.subtitle=WebInspector.UIString("(modify the boxes below to add a value)");newTreeElement.element.classList.add("no-value");newTreeElement.select(true,true);return newTreeElement;}
_removeSelectedCommaSeparatedKeyword()
{let selectedTreeElement=this._commaSeparatedKeywords.selectedTreeElement;this._removeCommaSeparatedKeyword(selectedTreeElement);}
_removeEmptyCommaSeparatedKeywords()
{for(let treeElement of this._commaSeparatedKeywords.children){if(!this._treeElementIsEmpty(treeElement)||treeElement.selected)
continue;treeElement.deselect();this._removeCommaSeparatedKeyword(treeElement);}}
_addCommaSeparatedKeyword(value,index)
{let valueElement=this._createNewTreeElement(value);if(!isNaN(index))
this._commaSeparatedKeywords.insertChild(valueElement,index+!this._insertNewItemsBeforeSelected);else
this._commaSeparatedKeywords.appendChild(valueElement);return valueElement;}
_removeCommaSeparatedKeyword(treeElement)
{if(!treeElement)
return;this._commaSeparatedKeywords.removeChild(treeElement);if(!this._commaSeparatedKeywords.children.length)
this.dispatchEventToListeners(WebInspector.VisualStyleCommaSeparatedKeywordEditor.Event.NoRemainingTreeItems);this._valueDidChange();}
_createNewTreeElement(value)
{return new WebInspector.GeneralTreeElement(WebInspector.VisualStyleCommaSeparatedKeywordEditor.ListItemClassName,value);}};WebInspector.VisualStyleCommaSeparatedKeywordEditor.ListItemClassName="visual-style-comma-separated-keyword-item";WebInspector.VisualStyleCommaSeparatedKeywordEditor.Event={TreeItemSelected:"visual-style-comma-separated-keyword-editor-tree-item-selected",NoRemainingTreeItems:"visual-style-comma-separated-keyword-editor-no-remaining-tree-items"};WebInspector.VisualStyleFontFamilyListEditor=class VisualStyleFontFamilyListEditor extends WebInspector.VisualStyleCommaSeparatedKeywordEditor
{constructor(propertyNames,text,longhandProperties,layoutReversed)
{super(propertyNames,text,longhandProperties,true,layoutReversed);this._commaSeparatedKeywords.element.addEventListener("scroll",this._hideCompletions.bind(this));this._completionController=new WebInspector.VisualStyleCompletionsController(this);this._completionController.addEventListener(WebInspector.VisualStyleCompletionsController.Event.CompletionSelected,this._completionClicked,this);this._wrapWithQuotesRegExp=/^[a-zA-Z\-]+$/;this._removeWrappedQuotesRegExp=/[\"\']/g;}
visualStyleCompletionsControllerCustomizeCompletionElement(suggestionsView,element,item)
{element.style.fontFamily=item;}
get hasCompletions()
{return this._completionController.hasCompletions;}
set completions(completions)
{this._completionController.completions=completions;}
_modifyCommaSeparatedKeyword(text)
{if(!this._wrapWithQuotesRegExp.test(text))
text="\""+text+"\"";return text;}
_addCommaSeparatedKeyword(value,index)
{if(value)
value=value.replace(this._removeWrappedQuotesRegExp,"");let valueElement=super._addCommaSeparatedKeyword(value,index);valueElement.addEventListener(WebInspector.VisualStyleFontFamilyTreeElement.Event.EditorKeyDown,this._treeElementKeyDown,this);valueElement.addEventListener(WebInspector.VisualStyleFontFamilyTreeElement.Event.KeywordChanged,this._treeElementKeywordChanged,this);valueElement.addEventListener(WebInspector.VisualStyleFontFamilyTreeElement.Event.EditorBlurred,this._hideCompletions,this);return valueElement;}
_addEmptyCommaSeparatedKeyword()
{let newItem=super._addEmptyCommaSeparatedKeyword();newItem.showKeywordEditor();}
_completionClicked(event)
{this.value=event.data.text;this._valueDidChange();}
_treeElementKeyDown(event)
{if(!this._completionController.visible)
return;let key=event&&event.data&&event.data.key;if(!key)
return;if(key==="Enter"||key==="Tab"){let selectedTreeElement=this._commaSeparatedKeywords.selectedTreeElement;if(!selectedTreeElement)
return;selectedTreeElement.updateMainTitle(this._completionController.currentCompletion);this._completionController.hide();return;}
if(key==="Escape"){this._hideCompletions();return;}
if(key==="Up"){this._completionController.previous();return;}
if(key==="Down"){this._completionController.next();return;}}
_treeElementKeywordChanged()
{if(!this.hasCompletions)
return;let result=this._valueDidChange();if(!result)
return;let treeElement=this._commaSeparatedKeywords.selectedTreeElement;if(!treeElement)
return;if(this._completionController.update(treeElement.mainTitle)){let bounds=treeElement.editorBounds(2);if(!bounds)
return;this._completionController.show(bounds);}}
_hideCompletions()
{this._completionController.hide();}
_createNewTreeElement(value)
{return new WebInspector.VisualStyleFontFamilyTreeElement(value);}};WebInspector.VisualStyleFontFamilyTreeElement=class VisualStyleFontFamilyTreeElement extends WebInspector.GeneralTreeElement
{constructor(text)
{super([WebInspector.VisualStyleCommaSeparatedKeywordEditor.ListItemClassName,"visual-style-font-family-list-item"],text);this._keywordEditor=document.createElement("input");this._keywordEditor.classList.add("visual-style-comma-separated-keyword-item-editor");this._keywordEditor.placeholder=WebInspector.UIString("(modify the boxes below to add a value)");this._keywordEditor.spellcheck=false;this._keywordEditor.addEventListener("keydown",this._keywordEditorKeyDown.bind(this));this._keywordEditor.addEventListener("keyup",this._keywordEditorKeyUp.bind(this));this._keywordEditor.addEventListener("blur",this._keywordEditorBlurred.bind(this));}
editorBounds(padding)
{if(this.keywordEditorHidden)
return;let bounds=WebInspector.Rect.rectFromClientRect(this._keywordEditor.getBoundingClientRect());return bounds.pad(padding||0);}
updateMainTitle(text)
{this.mainTitle=this._keywordEditor.value=text;this._listItemNode.style.fontFamily=text+", "+WebInspector.VisualStyleFontFamilyTreeElement.FontFamilyFallback;let hasText=text&&text.length;this._listItemNode.classList.toggle("no-value",!hasText);if(!hasText)
this.subtitle=this._keywordEditor.placeholder;this.dispatchEventToListeners(WebInspector.VisualStyleFontFamilyTreeElement.Event.KeywordChanged);}
get currentlyEditing()
{return!this.keywordEditorHidden;}
showKeywordEditor()
{if(!this.keywordEditorHidden)
return;this.subtitle="";this._listItemNode.classList.remove("editor-hidden");this._listItemNode.scrollIntoViewIfNeeded();this._keywordEditor.value=this._mainTitle;this._keywordEditor.select();}
hideKeywordEditor()
{if(this.keywordEditorHidden)
return;this.updateMainTitle(this._keywordEditor.value);this._listItemNode.classList.add("editor-hidden");}
get keywordEditorHidden()
{return this._listItemNode.classList.contains("editor-hidden");}
onattach()
{super.onattach();this._listItemNode.style.fontFamily=this._mainTitle;this._listItemNode.classList.add("editor-hidden");this._listItemNode.appendChild(this._keywordEditor);this._listItemNode.addEventListener("click",this.showKeywordEditor.bind(this));}
ondeselect()
{this.hideKeywordEditor();}
_keywordEditorKeyDown(event)
{if(this.keywordEditorHidden)
return;let keyCode=event.keyCode;let enterKeyCode=WebInspector.KeyboardShortcut.Key.Enter.keyCode;if(keyCode===enterKeyCode){this._listItemNode.classList.add("editor-hidden");this.dispatchEventToListeners(WebInspector.VisualStyleFontFamilyTreeElement.Event.EditorKeyDown,{key:"Enter"});return;}
let escapeKeyCode=WebInspector.KeyboardShortcut.Key.Escape.keyCode;if(keyCode===escapeKeyCode){this.dispatchEventToListeners(WebInspector.VisualStyleFontFamilyTreeElement.Event.EditorKeyDown,{key:"Escape"});return;}
let tabKeyCode=WebInspector.KeyboardShortcut.Key.Tab.keyCode;if(keyCode===tabKeyCode){event.preventDefault();this._dontFireKeyUp=true;this.dispatchEventToListeners(WebInspector.VisualStyleFontFamilyTreeElement.Event.EditorKeyDown,{key:"Tab"});return;}
let key=event.keyIdentifier;if(key==="Up"||key==="Down"){event.preventDefault();this._dontFireKeyUp=true;this.dispatchEventToListeners(WebInspector.VisualStyleFontFamilyTreeElement.Event.EditorKeyDown,{key});return;}
this.dispatchEventToListeners(WebInspector.VisualStyleFontFamilyTreeElement.Event.EditorKeyDown);}
_keywordEditorKeyUp()
{if(this.keywordEditorHidden||this._dontFireKeyUp)
return;this.updateMainTitle(this._keywordEditor.value);}
_keywordEditorBlurred()
{this.hideKeywordEditor();this.dispatchEventToListeners(WebInspector.VisualStyleFontFamilyTreeElement.Event.EditorBlurred);}};WebInspector.VisualStyleFontFamilyTreeElement.FontFamilyFallback="-apple-system, sans-serif";WebInspector.VisualStyleFontFamilyTreeElement.Event={KeywordChanged:"visual-style-font-family-tree-element-keyword-changed",EditorKeyDown:"visual-style-font-family-tree-element-editor-key-down",EditorBlurred:"visual-style-font-family-tree-element-editor-blurred"};WebInspector.VisualStyleKeywordCheckbox=class VisualStyleKeywordCheckbox extends WebInspector.VisualStylePropertyEditor
{constructor(propertyNames,text,value,layoutReversed)
{super(propertyNames,text,null,null,"keyword-checkbox",layoutReversed);this._checkboxElement=document.createElement("input");this._checkboxElement.type="checkbox";this._checkboxElement.addEventListener("change",this._valueDidChange.bind(this));this.contentElement.appendChild(this._checkboxElement);this._value=value.toLowerCase().replace(/\s/g,"-")||null;}
get value()
{return this._checkboxElement.checked?this._value:null;}
set value(value)
{this._checkboxElement.checked=value===this._value;}
get synthesizedValue()
{return this.value;}
_toggleTabbingOfSelectableElements(disabled)
{this._checkboxElement.tabIndex=disabled?"-1":null;}};WebInspector.VisualStyleKeywordIconList=class VisualStyleKeywordIconList extends WebInspector.VisualStylePropertyEditor
{constructor(propertyNames,text,possibleValues,layoutReversed)
{super(propertyNames,text,possibleValues,null,"keyword-icon-list",layoutReversed);this._iconListContainer=document.createElement("div");this._iconListContainer.classList.add("keyword-icon-list-container");this._iconElements=[];this._computedIcon=null;this._selectedIcon=null;let prettyPropertyReferenceName=this._propertyReferenceName.capitalize().replace(/(-.)/g,(match)=>match[1].toUpperCase());function createListItem(value,title){let iconButtonElement=document.createElement("button");iconButtonElement.id=value;iconButtonElement.title=title;iconButtonElement.classList.add("keyword-icon");iconButtonElement.addEventListener("click",this._handleKeywordChanged.bind(this));let imageName=(value==="none"||value==="initial")?"VisualStyleNone":prettyPropertyReferenceName+title.replace(/\s/g,"");iconButtonElement.appendChild(useSVGSymbol("Images/"+imageName+".svg"));return iconButtonElement;}
for(let key in this._possibleValues.basic){let iconElement=createListItem.call(this,key,this._possibleValues.basic[key]);this._iconListContainer.appendChild(iconElement);this._iconElements.push(iconElement);}
this.contentElement.appendChild(this._iconListContainer);}
get value()
{if(!this._selectedIcon)
return null;return this._selectedIcon.id;}
set value(value)
{this._computedIcon=null;this._selectedIcon=null;for(let icon of this._iconElements){icon.classList.remove("selected","computed");if(icon.id===this._updatedValues.placeholder)
this._computedIcon=icon;if(icon.id===value&&!this._propertyMissing)
this._selectedIcon=icon;}
if(!this._computedIcon)
this._computedIcon=this._iconElements[0];if(this._selectedIcon)
this._selectedIcon.classList.add("selected");else
this._computedIcon.classList.add("computed");}
get synthesizedValue()
{return this.value;}
_handleKeywordChanged(event)
{let toggleOff=this.value===event.target.id;this._propertyMissing=toggleOff;this.value=toggleOff?null:event.target.id;this._valueDidChange();}};WebInspector.VisualStyleKeywordPicker=class VisualStyleKeywordPicker extends WebInspector.VisualStylePropertyEditor
{constructor(propertyNames,text,possibleValues,layoutReversed)
{super(propertyNames,text,possibleValues,null,"keyword-picker",layoutReversed);this._keywordSelectElement=document.createElement("select");this._keywordSelectElement.classList.add("keyword-picker-select");if(this._possibleValues.advanced)
this._keywordSelectElement.title=WebInspector.UIString("Option-click to show all values");this._unchangedOptionElement=document.createElement("option");this._unchangedOptionElement.value="";this._unchangedOptionElement.text=WebInspector.UIString("Unchanged");this._keywordSelectElement.appendChild(this._unchangedOptionElement);this._keywordSelectElement.appendChild(document.createElement("hr"));this._createValueOptions(this._possibleValues.basic);this._advancedValuesElements=null;this._keywordSelectElement.addEventListener("mousedown",this._keywordSelectMouseDown.bind(this));this._keywordSelectElement.addEventListener("change",this._handleKeywordChanged.bind(this));this.contentElement.appendChild(this._keywordSelectElement);}
get value()
{return this._keywordSelectElement.value;}
set value(value)
{if(!value||!value.length){this._unchangedOptionElement.selected=true;this.specialPropertyPlaceholderElement.hidden=false;return;}
if(this._propertyMissing||!this.valueIsSupportedKeyword(value))
return;if(value===this._keywordSelectElement.value)
return;if(this._valueIsSupportedAdvancedKeyword(value))
this._addAdvancedValues();this._keywordSelectElement.value=value;}
set placeholder(placeholder)
{if(this._updatedValues.conflictingValues)
return;this.specialPropertyPlaceholderElement.textContent=this._canonicalizedKeywordForKey(placeholder)||placeholder;}
get synthesizedValue()
{return this._unchangedOptionElement.selected?null:this._keywordSelectElement.value;}
updateEditorValues(updatedValues)
{if(!updatedValues.conflictingValues){let missing=this._propertyMissing||!updatedValues.value;this._unchangedOptionElement.selected=missing;this.specialPropertyPlaceholderElement.hidden=!missing;}
super.updateEditorValues(updatedValues);}
_handleKeywordChanged()
{this._valueDidChange();this.specialPropertyPlaceholderElement.hidden=!this._unchangedOptionElement.selected;}
_keywordSelectMouseDown(event)
{if(event.altKey)
this._addAdvancedValues();else if(!this._valueIsSupportedAdvancedKeyword(this.value))
this._removeAdvancedValues();}
_createValueOptions(values)
{let addedElements=[];for(let key in values){let option=document.createElement("option");option.value=key;option.text=values[key];this._keywordSelectElement.appendChild(option);addedElements.push(option);}
return addedElements;}
_addAdvancedValues()
{if(this._advancedValuesElements)
return;this._keywordSelectElement.appendChild(document.createElement("hr"));this._advancedValuesElements=this._createValueOptions(this._possibleValues.advanced);}
_removeAdvancedValues()
{if(!this._advancedValuesElements)
return;this._keywordSelectElement.removeChild(this._advancedValuesElements[0].previousSibling);for(let element of this._advancedValuesElements)
this._keywordSelectElement.removeChild(element);this._advancedValuesElements=null;}
_toggleTabbingOfSelectableElements(disabled)
{this._keywordSelectElement.tabIndex=disabled?"-1":null;}};WebInspector.VisualStyleNumberInputBox=class VisualStyleNumberInputBox extends WebInspector.VisualStylePropertyEditor
{constructor(propertyNames,text,possibleValues,possibleUnits,allowNegativeValues,layoutReversed)
{let unitlessNumberUnit=WebInspector.UIString("Number");super(propertyNames,text,possibleValues,possibleUnits||[unitlessNumberUnit],"number-input-box",layoutReversed);this._unitlessNumberUnit=unitlessNumberUnit;this._hasUnits=this._possibleUnits.basic.some((unit)=>unit!==unitlessNumberUnit);this._allowNegativeValues=!!allowNegativeValues||false;this.contentElement.classList.toggle("no-values",!possibleValues||!possibleValues.length);this.contentElement.classList.toggle("no-units",!this._hasUnits);let focusRingElement=document.createElement("div");focusRingElement.classList.add("focus-ring");this.contentElement.appendChild(focusRingElement);this._keywordSelectElement=document.createElement("select");this._keywordSelectElement.classList.add("number-input-keyword-select");if(this._possibleUnits.advanced)
this._keywordSelectElement.title=WebInspector.UIString("Option-click to show all units");this._unchangedOptionElement=document.createElement("option");this._unchangedOptionElement.value="";this._unchangedOptionElement.text=WebInspector.UIString("Unchanged");this._keywordSelectElement.appendChild(this._unchangedOptionElement);this._keywordSelectElement.appendChild(document.createElement("hr"));if(this._possibleValues){this._createValueOptions(this._possibleValues.basic);this._keywordSelectElement.appendChild(document.createElement("hr"));}
if(this._possibleUnits)
this._createUnitOptions(this._possibleUnits.basic);this._advancedUnitsElements=null;this._keywordSelectElement.addEventListener("focus",this._focusContentElement.bind(this));this._keywordSelectElement.addEventListener("mousedown",this._keywordSelectMouseDown.bind(this));this._keywordSelectElement.addEventListener("change",this._keywordChanged.bind(this));this._keywordSelectElement.addEventListener("blur",this._blurContentElement.bind(this));this.contentElement.appendChild(this._keywordSelectElement);this._numberUnitsContainer=document.createElement("div");this._numberUnitsContainer.classList.add("number-input-container");this._valueNumberInputElement=document.createElement("input");this._valueNumberInputElement.classList.add("number-input-value");this._valueNumberInputElement.spellcheck=false;this._valueNumberInputElement.addEventListener("focus",this._focusContentElement.bind(this));this._valueNumberInputElement.addEventListener("keydown",this._valueNumberInputKeyDown.bind(this));this._valueNumberInputElement.addEventListener("keyup",this.debounce(250)._valueNumberInputKeyUp);this._valueNumberInputElement.addEventListener("blur",this._blurContentElement.bind(this));this._valueNumberInputElement.addEventListener("change",this.debounce(250)._valueNumberInputChanged);this._numberUnitsContainer.appendChild(this._valueNumberInputElement);this._unitsElement=document.createElement("span");this._numberUnitsContainer.appendChild(this._unitsElement);this.contentElement.appendChild(this._numberUnitsContainer);this._setNumberInputIsEditable(true);this._valueNumberInputElement.value=null;this._valueNumberInputElement.setAttribute("placeholder",0);this._unitsElementTextContent=this._keywordSelectElement.value=this.valueIsSupportedUnit("px")?"px":this._possibleUnits.basic[0];}
get value()
{if(this._numberInputIsEditable)
return parseFloat(this._valueNumberInputElement.value);return this._keywordSelectElement.value||null;}
set value(value)
{if(value&&value===this.value)
return;if(this._propertyMissing){if(value||this._updatedValues.placeholder)
this.specialPropertyPlaceholderElement.textContent=(value||this._updatedValues.placeholder)+(this._updatedValues.units||"");if(isNaN(value)){this._unchangedOptionElement.selected=true;this._setNumberInputIsEditable();this.specialPropertyPlaceholderElement.hidden=false;return;}}
this.specialPropertyPlaceholderElement.hidden=true;if(!value){this._valueNumberInputElement.value=null;this._markUnitsContainerIfInputHasValue();return;}
if(!isNaN(value)){this._setNumberInputIsEditable(true);this._valueNumberInputElement.value=Math.round(value*100)/100;this._markUnitsContainerIfInputHasValue();return;}
if(this.valueIsSupportedKeyword(value)){this._setNumberInputIsEditable();this._keywordSelectElement.value=value;return;}}
get units()
{if(this._unchangedOptionElement.selected)
return null;let keyword=this._keywordSelectElement.value;if(!this.valueIsSupportedUnit(keyword))
return null;return keyword;}
set units(unit)
{if(this._unchangedOptionElement.selected||unit===this.units)
return;if(!unit&&!this._possibleUnits.basic.includes(this._unitlessNumberUnit)&&!this.valueIsSupportedUnit(unit))
return;if(this._valueIsSupportedAdvancedUnit(unit))
this._addAdvancedUnits();this._setNumberInputIsEditable(true);this._keywordSelectElement.value=unit||this._unitlessNumberUnit;this._unitsElementTextContent=unit;}
get placeholder()
{return this._valueNumberInputElement.getAttribute("placeholder");}
set placeholder(text)
{if(text===this.placeholder)
return;let onlyNumericalText=text&&!isNaN(text)&&(Math.round(text*100)/100);this._valueNumberInputElement.setAttribute("placeholder",onlyNumericalText||0);if(!onlyNumericalText)
this.specialPropertyPlaceholderElement.textContent=this._canonicalizedKeywordForKey(text)||text;}
get synthesizedValue()
{if(this._unchangedOptionElement.selected)
return null;let value=this._valueNumberInputElement.value;if(this._numberInputIsEditable&&!value)
return null;let keyword=this._keywordSelectElement.value;return this.valueIsSupportedUnit(keyword)?value+(keyword===this._unitlessNumberUnit?"":keyword):keyword;}
updateValueFromText(text,value)
{let match=this.parseValue(value);this.value=match?match[1]:value;this.units=match?match[2]:null;return this.modifyPropertyText(text,value);}
set specialPropertyPlaceholderElementText(text)
{this._unchangedOptionElement.selected=true;super.specialPropertyPlaceholderElementText=text;}
parseValue(text)
{return/^(-?[\d.]+)([^\s\d]{0,4})(?:\s*;?)$/.exec(text);}
set _unitsElementTextContent(text)
{if(!this._hasUnits)
return;this._unitsElement.textContent=text===this._unitlessNumberUnit?"":text;this._markUnitsContainerIfInputHasValue();}
_setNumberInputIsEditable(flag)
{this._numberInputIsEditable=flag||false;this.contentElement.classList.toggle("number-input-editable",this._numberInputIsEditable);}
_markUnitsContainerIfInputHasValue()
{let numberInputValue=this._valueNumberInputElement.value;this._numberUnitsContainer.classList.toggle("has-value",numberInputValue&&numberInputValue.length);}
_keywordChanged()
{let unchangedOptionSelected=this._unchangedOptionElement.selected;if(!unchangedOptionSelected){let selectedKeywordIsUnit=this.valueIsSupportedUnit(this._keywordSelectElement.value);if(!this._numberInputIsEditable&&selectedKeywordIsUnit)
this._valueNumberInputElement.value=null;this._unitsElementTextContent=this._keywordSelectElement.value;this._setNumberInputIsEditable(selectedKeywordIsUnit);}else
this._setNumberInputIsEditable(false);this._valueDidChange();this.specialPropertyPlaceholderElement.hidden=!unchangedOptionSelected;}
_valueNumberInputKeyDown(event)
{if(!this._numberInputIsEditable)
return;function adjustValue(delta)
{let newValue;let value=this.value;if(!value&&isNaN(value)){let placeholderValue=this.placeholder&&!isNaN(this.placeholder)?parseFloat(this.placeholder):0;newValue=placeholderValue+delta;}else
newValue=value+delta;if(!this._allowNegativeValues&&newValue<0)
newValue=0;this._propertyMissing=false;this.value=Math.round(newValue*100)/100;this._valueDidChange();}
let shift=1;if(event.ctrlKey)
shift/=10;else if(event.shiftKey)
shift*=10;let key=event.keyIdentifier;if(key.startsWith("Page"))
shift*=10;if(key==="Up"||key==="PageUp"){event.preventDefault();adjustValue.call(this,shift);return;}
if(key==="Down"||key==="PageDown"){event.preventDefault();adjustValue.call(this,-shift);return;}
this._markUnitsContainerIfInputHasValue();this.debounce(250)._valueDidChange();}
_valueNumberInputKeyUp(event)
{if(!this._numberInputIsEditable)
return;this._markUnitsContainerIfInputHasValue();this._valueDidChange();}
_keywordSelectMouseDown(event)
{if(event.altKey)
this._addAdvancedUnits();else if(!this._valueIsSupportedAdvancedUnit(this._keywordSelectElement.value))
this._removeAdvancedUnits();}
_createValueOptions(values)
{let addedElements=[];for(let key in values){let option=document.createElement("option");option.value=key;option.text=values[key];this._keywordSelectElement.appendChild(option);addedElements.push(option);}
return addedElements;}
_createUnitOptions(units)
{let addedElements=[];for(let unit of units){let option=document.createElement("option");option.text=unit;this._keywordSelectElement.appendChild(option);addedElements.push(option);}
return addedElements;}
_addAdvancedUnits()
{if(this._advancedUnitsElements)
return;this._keywordSelectElement.appendChild(document.createElement("hr"));this._advancedUnitsElements=this._createUnitOptions(this._possibleUnits.advanced);}
_removeAdvancedUnits()
{if(!this._advancedUnitsElements)
return;this._keywordSelectElement.removeChild(this._advancedUnitsElements[0].previousSibling);for(let element of this._advancedUnitsElements)
this._keywordSelectElement.removeChild(element);this._advancedUnitsElements=null;}
_focusContentElement(event)
{this.contentElement.classList.add("focused");}
_blurContentElement(event)
{this.contentElement.classList.remove("focused");}
_valueNumberInputChanged(event)
{let newValue=this.value;if(!newValue&&isNaN(newValue))
newValue=this.placeholder&&!isNaN(this.placeholder)?parseFloat(this.placeholder):0;if(!this._allowNegativeValues&&newValue<0)
newValue=0;this.value=Math.round(newValue*100)/100;this._valueDidChange();}
_toggleTabbingOfSelectableElements(disabled)
{this._keywordSelectElement.tabIndex=disabled?"-1":null;this._valueNumberInputElement.tabIndex=disabled?"-1":null;}};WebInspector.VisualStylePropertyCombiner=class VisualStylePropertyCombiner extends WebInspector.Object
{constructor(propertyName,propertyEditors,spreadNumberValues)
{super();this._style=null;this._propertyName=propertyName;this._propertyMissing=false;this._propertyEditors=propertyEditors||[];this._spreadNumberValues=!!spreadNumberValues&&this._propertyEditors.length>=4;for(let editor of this._propertyEditors){editor.addEventListener(WebInspector.VisualStylePropertyEditor.Event.ValueDidChange,this._handlePropertyEditorValueChanged,this);editor.suppressStyleTextUpdate=true;}
this._textContainsNameRegExp=new RegExp("(?:(?:^|;)\\s*"+this._propertyName+"\\s*:)");this._replacementRegExp=new RegExp("((?:^|;)\\s*)("+this._propertyName+")(.+?(?:;|$))");this._valueRegExp=/([^\s]+\(.+\)|[^\s]+)(?:;?)/g;}
get style()
{return this._style;}
get synthesizedValue()
{let value="";let oneEditorHasValue=false;for(let editor of this._propertyEditors){let editorValue=editor.synthesizedValue;if(editorValue&&editorValue.length)
oneEditorHasValue=true;else if(editor.optionalProperty)
continue;if(editor.masterProperty&&editor.valueIsSupportedKeyword(editor.value)){this._markEditors(editor,true);return editorValue;}
if(editor!==this._propertyEditors[0])
value+=" ";value+=editorValue||(editor.colorProperty?"transparent":0);}
this._markEditors();return value.length&&oneEditorHasValue?value:null;}
modifyPropertyText(text,value)
{if(this._textContainsNameRegExp.test(text))
text=text.replace(this._replacementRegExp,value!==null?"$1$2: "+value+";":"$1");else if(value!==null)
text+=WebInspector.VisualStylePropertyEditor.generateFormattedTextForNewProperty(text,this._propertyName,value);return text;}
update(style)
{if(style)
this._style=style;else if(this._ignoreNextUpdate){this._ignoreNextUpdate=false;return;}
if(!this._style||!this._valueRegExp)
return;let property=this._style.propertyForName(this._propertyName,true);let propertyMissing=!property;if(propertyMissing&&this._style.nodeStyles)
property=this._style.nodeStyles.computedStyle.propertyForName(this._propertyName);if(!property)
return;this.updateValuesFromText(property.value,propertyMissing);this._propertyMissing=propertyMissing;}
updateValuesFromText(styleText,propertyMissing)
{if(styleText===this.synthesizedValue)
return;for(let editor of this._propertyEditors)
editor[WebInspector.VisualStylePropertyCombiner.EditorUpdatedSymbol]=false;function updateEditor(editor,value){let updatedValues=editor.getValuesFromText(value||"",propertyMissing);if(!updatedValues)
return;editor.updateEditorValues(updatedValues);editor[WebInspector.VisualStylePropertyCombiner.EditorUpdatedSymbol]=true;}
if(this._spreadNumberValues){let numberValues=styleText.match(/\d+[\w%]*/g);let count=numberValues&&numberValues.length;if(count===1){for(let editor of this._propertyEditors)
updateEditor(editor,numberValues[0]);}else if(count===2){for(let i=0;i<count;++i){updateEditor(this._propertyEditors[i],numberValues[i]);updateEditor(this._propertyEditors[i+2],numberValues[i]);}}else if(count===3){updateEditor(this._propertyEditors[0],numberValues[0]);updateEditor(this._propertyEditors[1],numberValues[1]);updateEditor(this._propertyEditors[2],numberValues[2]);updateEditor(this._propertyEditors[3],numberValues[1]);}}
function updateCompatibleEditor(value){for(let editor of this._propertyEditors){if(value&&!editor.valueIsCompatible(value)||editor[WebInspector.VisualStylePropertyCombiner.EditorUpdatedSymbol])
continue;if(this._currentValueIsKeyword&&editor.disabled)
continue;updateEditor(editor,value);if(value)
return;}}
let matches=styleText.match(this._valueRegExp);for(let i=0;i<this._propertyEditors.length;++i)
updateCompatibleEditor.call(this,matches&&matches[i]);}
get propertyMissing()
{return this._propertyMissing;}
resetEditorValues(value)
{this._ignoreNextUpdate=false;this.updateValuesFromText(value||"");}
_markEditors(ignoredEditor,disabled)
{this._currentValueIsKeyword=disabled||false;for(let editor of this._propertyEditors){if(ignoredEditor&&editor===ignoredEditor)
continue;editor.disabled=this._currentValueIsKeyword;}}
_handlePropertyEditorValueChanged()
{this._ignoreNextUpdate=true;let value=this.synthesizedValue;if(this._style)
this._style.text=this.modifyPropertyText(this._style.text,value);this._propertyMissing=!value;this.dispatchEventToListeners(WebInspector.VisualStylePropertyEditor.Event.ValueDidChange);}};WebInspector.VisualStylePropertyCombiner.EditorUpdatedSymbol=Symbol("visual-style-property-combiner-editor-updated");WebInspector.VisualStylePropertyEditorLink=class VisualStylePropertyEditorLink extends WebInspector.Object
{constructor(linkedProperties,className,linksToHideWhenLinked)
{super();this._linkedProperties=linkedProperties||[];this._linksToHideWhenLinked=linksToHideWhenLinked||[];this._lastPropertyEdited=null;for(let property of this._linkedProperties)
property.addEventListener(WebInspector.VisualStylePropertyEditor.Event.ValueDidChange,this._linkedPropertyValueChanged,this);this._element=document.createElement("div");this._element.classList.add("visual-style-property-editor-link",className||"");let leftLineElement=document.createElement("div");leftLineElement.classList.add("visual-style-property-editor-link-border","left");this._element.appendChild(leftLineElement);this._iconElement=document.createElement("div");this._iconElement.classList.add("visual-style-property-editor-link-icon");this._iconElement.title=WebInspector.UIString("Click to link property values");this._iconElement.addEventListener("mouseover",this._iconMouseover.bind(this));this._iconElement.addEventListener("mouseout",this._iconMouseout.bind(this));this._iconElement.addEventListener("click",this._iconClicked.bind(this));this._unlinkedIcon=useSVGSymbol("Images/VisualStylePropertyUnlinked.svg","unlinked-icon");this._iconElement.appendChild(this._unlinkedIcon);this._linkedIcon=useSVGSymbol("Images/VisualStylePropertyLinked.svg","linked-icon");this._linkedIcon.hidden=true;this._iconElement.appendChild(this._linkedIcon);this._element.appendChild(this._iconElement);let rightLineElement=document.createElement("div");rightLineElement.classList.add("visual-style-property-editor-link-border","right");this._element.appendChild(rightLineElement);this._linked=false;this._disabled=false;}
get element()
{return this._element;}
set linked(flag)
{this._linked=flag;this._element.classList.toggle("linked",this._linked);if(this._linkedIcon)
this._linkedIcon.hidden=!this._linked;if(this._unlinkedIcon)
this._unlinkedIcon.hidden=this._linked;this._iconElement.title=this._linked?WebInspector.UIString("Remove link"):WebInspector.UIString("Link property values");for(let linkToHide of this._linksToHideWhenLinked)
linkToHide.disabled=this._linked;}
set disabled(flag)
{this._disabled=flag;this._element.classList.toggle("disabled",this._disabled);}
_linkedPropertyValueChanged(event)
{if(!event)
return;let property=event.target;if(!property)
return;this._lastPropertyEdited=property;if(!this._linked)
return;this._updateLinkedEditors(property);}
_updateLinkedEditors(property)
{let style=property.style;let text=style.text;let value=property.synthesizedValue||null;for(let linkedProperty of this._linkedProperties)
text=linkedProperty.updateValueFromText(text,value);style.text=text;}
_iconMouseover()
{this._linkedIcon.hidden=this._linked;this._unlinkedIcon.hidden=!this._linked;}
_iconMouseout()
{this._linkedIcon.hidden=!this._linked;this._unlinkedIcon.hidden=this._linked;}
_iconClicked()
{this.linked=!this._linked;this._updateLinkedEditors(this._lastPropertyEdited||this._linkedProperties[0]);}};WebInspector.VisualStylePropertyNameInput=class VisualStylePropertyNameInput extends WebInspector.VisualStylePropertyEditor
{constructor(propertyNames,text,layoutReversed)
{super(propertyNames,text,null,null,"property-name-input",layoutReversed);this._propertyNameInputElement=document.createElement("input");this._propertyNameInputElement.placeholder=WebInspector.UIString("Enter property name");this._propertyNameInputElement.addEventListener("keydown",this._inputKeyDown.bind(this));this._propertyNameInputElement.addEventListener("keyup",this.debounce(250)._inputKeyUp);this._propertyNameInputElement.addEventListener("blur",this._hideCompletions.bind(this));this.contentElement.appendChild(this._propertyNameInputElement);this._completionController=new WebInspector.VisualStyleCompletionsController(this);this._completionController.addEventListener(WebInspector.VisualStyleCompletionsController.Event.CompletionSelected,this._completionClicked,this);}
get value()
{return this._propertyNameInputElement.value;}
set value(value)
{if(value&&value===this.value)
return;this._propertyNameInputElement.value=value;}
get synthesizedValue()
{return this.value||null;}
get hasCompletions()
{return this._completionController.hasCompletions;}
set completions(completions)
{this._completionController.completions=completions;}
_completionClicked(event)
{this.value=event.data.text;this._valueDidChange();}
_inputKeyDown(event)
{if(!this._completionController.visible)
return;let keyCode=event.keyCode;let enterKeyCode=WebInspector.KeyboardShortcut.Key.Enter.keyCode;let tabKeyCode=WebInspector.KeyboardShortcut.Key.Tab.keyCode;if(keyCode===enterKeyCode||keyCode===tabKeyCode){this.value=this._completionController.currentCompletion;this._hideCompletions();this._valueDidChange();return;}
let escapeKeyCode=WebInspector.KeyboardShortcut.Key.Escape.keyCode;if(keyCode===escapeKeyCode){this._hideCompletions();return;}
let key=event.keyIdentifier;if(key==="Up"){this._completionController.previous();return;}
if(key==="Down"){this._completionController.next();return;}}
_inputKeyUp()
{if(!this.hasCompletions)
return;let result=this._valueDidChange();if(!result)
return;if(this._completionController.update(this.value)){let bounds=WebInspector.Rect.rectFromClientRect(this._propertyNameInputElement.getBoundingClientRect());if(!bounds)
return;this._completionController.show(bounds,2);}}
_hideCompletions()
{this._completionController.hide();}
_toggleTabbingOfSelectableElements(disabled)
{this._propertyNameInputElement.tabIndex=disabled?"-1":null;}};WebInspector.VisualStyleRelativeNumberSlider=class VisualStyleRelativeNumberSlider extends WebInspector.VisualStyleNumberInputBox
{constructor(propertyNames,text,possibleValues,possibleUnits,allowNegativeValues,layoutReversed)
{super(propertyNames,text,possibleValues,possibleUnits,allowNegativeValues,layoutReversed);this._element.classList.add("relative-number-slider");this._sliderElement=document.createElement("input");this._sliderElement.classList.add("relative-slider");this._sliderElement.type="range";this._sliderElement.addEventListener("input",this._sliderChanged.bind(this));this._element.appendChild(this._sliderElement);this._startingValue=0;this._scale=200;}
set scale(scale)
{this._scale=scale||1;}
updateEditorValues(updatedValues)
{super.updateEditorValues(updatedValues);this._resetSlider();}
_resetSlider()
{this._startingValue=parseFloat(this._valueNumberInputElement.value);if(isNaN(this._startingValue))
this._startingValue=parseFloat(this.placeholder)||0;let midpoint=this._scale/2;if(this._allowNegativeValues||this._startingValue>midpoint){this._sliderElement.min=-midpoint;this._sliderElement.max=midpoint;this._sliderElement.value=0;}else{this._sliderElement.min=0;this._sliderElement.max=this._scale;this._sliderElement.value=this._startingValue;this._startingValue=0;}}
_sliderChanged()
{this.value=this._startingValue+Math.round(parseFloat(this._sliderElement.value)*100)/100;this._valueDidChange();}
_numberInputChanged()
{super._numberInputChanged();this._resetSlider();}};WebInspector.VisualStyleSelectorSection=class VisualStyleSelectorSection extends WebInspector.DetailsSection
{constructor()
{let selectorSection={element:document.createElement("div")};selectorSection.element.classList.add("selectors");let controlElement=document.createElement("div");controlElement.classList.add("controls");super("visual-style-selector-section",WebInspector.UIString("Style Rules"),[selectorSection],controlElement);this._nodeStyles=null;this._currentSelectorElement=document.createElement("div");this._currentSelectorElement.classList.add("current-selector");let currentSelectorIconElement=document.createElement("img");currentSelectorIconElement.classList.add("icon");this._currentSelectorElement.appendChild(currentSelectorIconElement);this._currentSelectorText=document.createElement("span");this._currentSelectorElement.appendChild(this._currentSelectorText);this._headerElement.appendChild(this._currentSelectorElement);let selectorListElement=document.createElement("ol");selectorListElement.classList.add("selector-list");selectorSection.element.appendChild(selectorListElement);this._selectors=new WebInspector.TreeOutline(selectorListElement);this._selectors.disclosureButtons=false;this._selectors.addEventListener(WebInspector.TreeOutline.Event.SelectionDidChange,this._selectorChanged,this);this._newInspectorRuleSelector=null;let addGlyphElement=useSVGSymbol("Images/Plus13.svg","visual-style-selector-section-add-rule",WebInspector.UIString("Add new rule"));addGlyphElement.addEventListener("click",this._addNewRuleClick.bind(this));addGlyphElement.addEventListener("contextmenu",this._addNewRuleContextMenu.bind(this));controlElement.appendChild(addGlyphElement);this._headerElement.addEventListener("mouseover",this._handleMouseOver.bind(this));this._headerElement.addEventListener("mouseout",this._handleMouseOut.bind(this));}
update(nodeStyles)
{let style=this.currentStyle();if(style)
this._nodeStyles[WebInspector.VisualStyleSelectorSection.LastSelectedRuleSymbol]=style;if(nodeStyles)
this._nodeStyles=nodeStyles;if(!this._nodeStyles)
return;this._selectors.removeChildren();let previousRule=null; let pseudoRules=[];let pseudoElements=this._nodeStyles.pseudoElements;for(let pseudoIdentifier in pseudoElements)
pseudoRules=pseudoRules.concat(pseudoElements[pseudoIdentifier].matchedRules);let orderedPseudoRules=uniqueOrderedRules(pseudoRules);if(orderedPseudoRules.length)
orderedPseudoRules.reverse();function createSelectorItem(style,title,subtitle){let selector=new WebInspector.VisualStyleSelectorTreeItem(this,style,title,subtitle);selector.addEventListener(WebInspector.VisualStyleSelectorTreeItem.Event.CheckboxChanged,this._treeElementCheckboxToggled,this);this._selectors.appendChild(selector);if(style.isInspectorRule()&&this._newInspectorRuleSelector===style.selectorText&&!style.hasProperties()){selector.select(true);selector.element.scrollIntoView();this._nodeStyles[WebInspector.VisualStyleSelectorSection.LastSelectedRuleSymbol]=style;this._newInspectorRuleSelector=null;return;}
if(this._nodeStyles[WebInspector.VisualStyleSelectorSection.LastSelectedRuleSymbol]===style){selector.select(true);selector.element.scrollIntoView();}}
function uniqueOrderedRules(orderedRules)
{if(!orderedRules||!orderedRules.length)
return new Array;let uniqueRules=new Map;for(let rule of orderedRules){if(!uniqueRules.has(rule.id))
uniqueRules.set(rule.id,rule);}
return Array.from(uniqueRules.values());}
function insertAllMatchingPseudoRules(force)
{if(!orderedPseudoRules.length)
return;if(force){for(let i=orderedPseudoRules.length-1;i>=0;--i){let pseudoRule=orderedPseudoRules[i];createSelectorItem.call(this,pseudoRule.style,pseudoRule.selectorText,pseudoRule.mediaText);}
orderedPseudoRules=[];}
if(!previousRule)
return;for(let i=orderedPseudoRules.length-1;i>=0;--i){let pseudoRule=orderedPseudoRules[i];if(!pseudoRule.selectorIsGreater(previousRule.mostSpecificSelector))
continue;createSelectorItem.call(this,pseudoRule.style,pseudoRule.selectorText,pseudoRule.mediaText);previousRule=pseudoRule;orderedPseudoRules.splice(i,1);}}
if(this._nodeStyles.inlineStyle){if(!this._nodeStyles[WebInspector.VisualStyleSelectorSection.LastSelectedRuleSymbol])
this._nodeStyles[WebInspector.VisualStyleSelectorSection.LastSelectedRuleSymbol]=this._nodeStyles.inlineStyle; createSelectorItem.call(this,this._nodeStyles.inlineStyle,WebInspector.UIString("This Element"));}else if(!this._nodeStyles[WebInspector.VisualStyleSelectorSection.LastSelectedRuleSymbol])
this._nodeStyles[WebInspector.VisualStyleSelectorSection.LastSelectedRuleSymbol]=this._nodeStyles.matchedRules[0].style; for(let rule of uniqueOrderedRules(this._nodeStyles.matchedRules)){if(rule.type===WebInspector.CSSStyleSheet.Type.UserAgent){insertAllMatchingPseudoRules.call(this,true);continue;}
insertAllMatchingPseudoRules.call(this);createSelectorItem.call(this,rule.style,rule.selectorText,rule.mediaText);previousRule=rule;}
insertAllMatchingPseudoRules.call(this,true); for(let inherited of this._nodeStyles.inheritedRules){if(!inherited.matchedRules||!inherited.matchedRules.length)
continue;let divider=null;for(let rule of uniqueOrderedRules(inherited.matchedRules)){if(rule.type===WebInspector.CSSStyleSheet.Type.UserAgent)
continue;if(!divider){let dividerText=WebInspector.UIString("Inherited from %s").format(inherited.node.displayName);divider=new WebInspector.GeneralTreeElement("section-divider",dividerText);divider.selectable=false;this._selectors.appendChild(divider);}
createSelectorItem.call(this,rule.style,rule.selectorText,rule.mediaText);}}
this._newInspectorRuleSelector=null;}
currentStyle()
{if(!this._nodeStyles||!this._selectors.selectedTreeElement)
return null;return this._selectors.selectedTreeElement.representedObject;}
treeItemForStyle(style)
{for(let item of this._selectors.children){if(item.representedObject===style)
return item;}
return null;}
selectEmptyStyleTreeItem(style)
{if(style.hasProperties())
return false;let treeItem=this.treeItemForStyle(style);if(!treeItem)
return false;treeItem.select(true,true);return true;}
_selectorChanged(event)
{let selectedTreeElement=event.data.selectedElement;if(!selectedTreeElement)
return;
this._currentSelectorElement.className="current-selector "+selectedTreeElement.iconClassName;let selectorText=selectedTreeElement.mainTitle;let mediaText=selectedTreeElement.subtitle;if(mediaText&&mediaText.length)
selectorText+=" \u2014 "+mediaText; this._currentSelectorText.textContent=selectorText;this.dispatchEventToListeners(WebInspector.VisualStyleSelectorSection.Event.SelectorChanged);}
_addNewRuleClick(event)
{if(!this._nodeStyles||this._nodeStyles.node.isInUserAgentShadowTree())
return;let selector=this.currentStyle().selectorText;let existingRules=this._nodeStyles.rulesForSelector(selector);for(let rule of existingRules){if(this.selectEmptyStyleTreeItem(rule.style))
return;}
this._newInspectorRuleSelector=selector;this._nodeStyles.addRule(selector);}
_addNewRuleContextMenu(event)
{if(!this._nodeStyles||this._nodeStyles.node.isInUserAgentShadowTree())
return;let styleSheets=WebInspector.cssStyleManager.styleSheets.filter(styleSheet=>styleSheet.hasInfo()&&!styleSheet.isInlineStyleTag()&&!styleSheet.isInlineStyleAttributeStyleSheet());if(!styleSheets.length)
return;let contextMenu=WebInspector.ContextMenu.createFromEvent(event);const handler=null;const disabled=true;contextMenu.appendItem(WebInspector.UIString("Available Style Sheets"),handler,disabled);for(let styleSheet of styleSheets){contextMenu.appendItem(styleSheet.displayName,()=>{const text="";this._nodeStyles.addRule(this.currentStyle().selectorText,text,styleSheet.id);});}}
_treeElementCheckboxToggled(event)
{let style=this.currentStyle();if(!style)
return;let styleText=style.text;if(!styleText||!styleText.length)
return;let newStyleText="";let styleEnabled=event&&event.data&&event.data.enabled;if(styleEnabled)
newStyleText=styleText.replace(/\s*(\/\*|\*\/)\s*/g,"");else
newStyleText="/* "+styleText.replace(/(\s*;(?!$)\s*)/g,"$1 *//* ")+" */";style.text=newStyleText;style[WebInspector.VisualStyleDetailsPanel.StyleDisabledSymbol]=!styleEnabled;this.dispatchEventToListeners(WebInspector.VisualStyleSelectorSection.Event.SelectorChanged);}
_handleMouseOver()
{if(!this.collapsed)
return;let style=this.currentStyle();if(!style)
return;if(!style.ownerRule){WebInspector.domTreeManager.highlightDOMNode(style.node.id);return;}
WebInspector.domTreeManager.highlightSelector(style.ownerRule.selectorText,style.node.ownerDocument.frameIdentifier);}
_handleMouseOut()
{if(!this.collapsed)
return;WebInspector.domTreeManager.hideDOMNodeHighlight();}};WebInspector.VisualStyleSelectorSection.LastSelectedRuleSymbol=Symbol("visual-style-selector-section-last-selected-rule");WebInspector.VisualStyleSelectorSection.Event={SelectorChanged:"visual-style-selector-section-selector-changed"};WebInspector.VisualStyleSelectorTreeItem=class VisualStyleSelectorTreeItem extends WebInspector.GeneralTreeElement
{constructor(delegate,style,title,subtitle)
{let iconClassName;switch(style.type){case WebInspector.CSSStyleDeclaration.Type.Rule:if(style.inherited)
iconClassName=WebInspector.CSSStyleDeclarationSection.InheritedStyleRuleIconStyleClassName;else if(style.ownerRule.type===WebInspector.CSSStyleSheet.Type.Author)
iconClassName=WebInspector.CSSStyleDeclarationSection.AuthorStyleRuleIconStyleClassName;else if(style.ownerRule.type===WebInspector.CSSStyleSheet.Type.User)
iconClassName=WebInspector.CSSStyleDeclarationSection.UserStyleRuleIconStyleClassName;else if(style.ownerRule.type===WebInspector.CSSStyleSheet.Type.UserAgent)
iconClassName=WebInspector.CSSStyleDeclarationSection.UserAgentStyleRuleIconStyleClassName;else if(style.ownerRule.type===WebInspector.CSSStyleSheet.Type.Inspector)
iconClassName=WebInspector.CSSStyleDeclarationSection.InspectorStyleRuleIconStyleClassName;break;case WebInspector.CSSStyleDeclaration.Type.Inline:case WebInspector.CSSStyleDeclaration.Type.Attribute:if(style.inherited)
iconClassName=WebInspector.CSSStyleDeclarationSection.InheritedElementStyleRuleIconStyleClassName;else
iconClassName=WebInspector.DOMTreeElementPathComponent.DOMElementIconStyleClassName;break;}
let iconClasses=[iconClassName];if(style.ownerRule&&style.ownerRule.hasMatchedPseudoElementSelector())
iconClasses.push(WebInspector.CSSStyleDeclarationSection.PseudoElementSelectorStyleClassName);title=title.trim();super(["visual-style-selector-item",...iconClasses],title,subtitle,style);this._delegate=delegate;this._iconClasses=iconClasses;this._lastValue=title;this._enableEditing=true;this._hasInvalidSelector=false;}
get iconClassName()
{return this._iconClasses.join(" ");}
get selectorText()
{let titleText=this._mainTitleElement.textContent;if(!titleText||!titleText.length)
titleText=this._mainTitle;return titleText.trim();}
onattach()
{super.onattach();this._listItemNode.addEventListener("mouseover",this._highlightNodesWithSelector.bind(this));this._listItemNode.addEventListener("mouseout",this._hideDOMNodeHighlight.bind(this));this._checkboxElement=document.createElement("input");this._checkboxElement.type="checkbox";this._checkboxElement.checked=!this.representedObject[WebInspector.VisualStyleDetailsPanel.StyleDisabledSymbol];this._updateCheckboxTitle();this._checkboxElement.addEventListener("change",this._handleCheckboxChanged.bind(this));this._listItemNode.insertBefore(this._checkboxElement,this._iconElement);this._iconElement.addEventListener("click",this._handleIconElementClicked.bind(this));this._mainTitleElement.spellcheck=false;this._mainTitleElement.addEventListener("mousedown",this._handleMainTitleMouseDown.bind(this));this._mainTitleElement.addEventListener("keydown",this._handleMainTitleKeyDown.bind(this));this._mainTitleElement.addEventListener("keyup",this._highlightNodesWithSelector.bind(this));this._mainTitleElement.addEventListener("blur",this._commitSelector.bind(this));this.representedObject.addEventListener(WebInspector.CSSStyleDeclaration.Event.InitialTextModified,this._styleTextModified,this);if(this.representedObject.ownerRule)
this.representedObject.ownerRule.addEventListener(WebInspector.CSSRule.Event.SelectorChanged,this._updateSelectorIcon,this);this._styleTextModified();}
ondeselect()
{this._listItemNode.classList.remove("editable");this._mainTitleElement.contentEditable=false;}
populateContextMenu(contextMenu,event)
{contextMenu.appendItem(WebInspector.UIString("Copy Rule"),()=>{InspectorFrontendHost.copyText(this.representedObject.generateCSSRuleString());});if(this.representedObject.modified){contextMenu.appendItem(WebInspector.UIString("Reset"),()=>{this.representedObject.resetText();});}
if(!this.representedObject.ownerRule)
return;contextMenu.appendItem(WebInspector.UIString("Show Source"),()=>{const options={ignoreNetworkTab:true,ignoreSearchTab:true,};if(event.metaKey)
WebInspector.showOriginalUnformattedSourceCodeLocation(this.representedObject.ownerRule.sourceCodeLocation,options);else
WebInspector.showSourceCodeLocation(this.representedObject.ownerRule.sourceCodeLocation,options);});if(WebInspector.CSSStyleManager.PseudoElementNames.some((className)=>this.representedObject.selectorText.includes(":"+className)))
return;if(WebInspector.CSSStyleManager.ForceablePseudoClasses.every((className)=>!this.representedObject.selectorText.includes(":"+className))){contextMenu.appendSeparator();for(let pseudoClass of WebInspector.CSSStyleManager.ForceablePseudoClasses){if(pseudoClass==="visited"&&this.representedObject.node.nodeName()!=="A")
continue;let pseudoClassSelector=":"+pseudoClass;contextMenu.appendItem(WebInspector.UIString("Add %s Rule").format(pseudoClassSelector),()=>{this.representedObject.node.setPseudoClassEnabled(pseudoClass,true);let pseudoSelectors=this.representedObject.ownerRule.selectors.map((selector)=>selector.text+pseudoClassSelector);this.representedObject.nodeStyles.addRule(pseudoSelectors.join(", "));});}}
contextMenu.appendSeparator();for(let pseudoElement of WebInspector.CSSStyleManager.PseudoElementNames){let pseudoElementSelector="::"+pseudoElement;const styleText="content: \"\";";let existingTreeItem=null;if(this._delegate&&typeof this._delegate.treeItemForStyle==="function"){let selectorText=this.representedObject.ownerRule.selectorText;let existingRules=this.representedObject.nodeStyles.rulesForSelector(selectorText+pseudoElementSelector);if(existingRules.length){
existingTreeItem=this._delegate.treeItemForStyle(existingRules[0].style);}}
let title=existingTreeItem?WebInspector.UIString("Select %s Rule"):WebInspector.UIString("Create %s Rule");contextMenu.appendItem(title.format(pseudoElementSelector),()=>{if(existingTreeItem){existingTreeItem.select(true,true);return;}
let pseudoSelectors=this.representedObject.ownerRule.selectors.map((selector)=>selector.text+pseudoElementSelector);this.representedObject.nodeStyles.addRule(pseudoSelectors.join(", "),styleText);});}
super.populateContextMenu(contextMenu,event);}
_highlightNodesWithSelector()
{if(!this.representedObject.ownerRule){WebInspector.domTreeManager.highlightDOMNode(this.representedObject.node.id);return;}
WebInspector.domTreeManager.highlightSelector(this.selectorText,this.representedObject.node.ownerDocument.frameIdentifier);}
_hideDOMNodeHighlight()
{WebInspector.domTreeManager.hideDOMNodeHighlight();}
_handleCheckboxChanged(event)
{this._updateCheckboxTitle();this.dispatchEventToListeners(WebInspector.VisualStyleSelectorTreeItem.Event.CheckboxChanged,{enabled:this._checkboxElement.checked});}
_updateCheckboxTitle()
{if(this._checkboxElement.checked)
this._checkboxElement.title=WebInspector.UIString("Comment out rule");else
this._checkboxElement.title=WebInspector.UIString("Uncomment rule");}
_handleMainTitleMouseDown(event)
{if(event.button!==0||event.ctrlKey)
return;this._listItemNode.classList.toggle("editable",this.selected);this._mainTitleElement.contentEditable=this.selected?"plaintext-only":false;}
_handleMainTitleKeyDown(event)
{this._highlightNodesWithSelector();let enterKeyCode=WebInspector.KeyboardShortcut.Key.Enter.keyCode;if(event.keyCode===enterKeyCode)
this._mainTitleElement.blur();}
_commitSelector()
{this._hideDOMNodeHighlight();this._listItemNode.classList.remove("editable");this._mainTitleElement.contentEditable=false;this._updateTitleTooltip();let value=this.selectorText;if(value===this._lastValue&&!this._hasInvalidSelector)
return;this.representedObject.ownerRule.selectorText=value;}
_styleTextModified()
{this._listItemNode.classList.toggle("modified",this.representedObject.modified);}
_updateSelectorIcon(event)
{this._hasInvalidSelector=event&&event.data&&!event.data.valid;this._listItemNode.classList.toggle("selector-invalid",!!this._hasInvalidSelector);if(this._hasInvalidSelector){this._iconElement.title=WebInspector.UIString("The selector “%s” is invalid.\nClick to revert to the previous selector.").format(this.selectorText);this.mainTitleElement.title=WebInspector.UIString("Using previous selector “%s”").format(this.representedObject.ownerRule.selectorText);return;}
this._iconElement.title=null;this.mainTitleElement.title=null;let hasMatchedPseudoElementSelector=this.representedObject.ownerRule&&this.representedObject.ownerRule.hasMatchedPseudoElementSelector();this._iconClasses.toggleIncludes(WebInspector.CSSStyleDeclarationSection.PseudoElementSelectorStyleClassName,hasMatchedPseudoElementSelector);}
_handleIconElementClicked(event)
{if(this._hasInvalidSelector&&this.representedObject.ownerRule){this.mainTitleElement.textContent=this._lastValue=this.representedObject.ownerRule.selectorText;this._updateSelectorIcon();return;}}};WebInspector.VisualStyleSelectorTreeItem.Event={CheckboxChanged:"visual-style-selector-item-checkbox-changed"};WebInspector.VisualStyleTabbedPropertiesRow=class VisualStyleTabbedPropertiesRow extends WebInspector.DetailsSectionRow
{constructor(tabMap)
{super();this._element.classList.add("visual-style-tabbed-properties-row");let containerElement=document.createElement("div");containerElement.classList.add("visual-style-tabbed-properties-row-container");this._tabButtons=[];this._tabMap=tabMap;for(let key in this._tabMap){let button=document.createElement("button");button.id=key;button.textContent=this._tabMap[key].title;button.addEventListener("click",this._handleButtonClicked.bind(this));containerElement.appendChild(button);this._tabButtons.push(button);}
let firstButton=this._tabButtons[0];firstButton.classList.add("selected");this._tabMap[firstButton.id].element.classList.add("visible");this._element.appendChild(containerElement);}
_handleButtonClicked(event)
{for(let item of this._tabButtons){let tab=this._tabMap[item.id];let selected=item===event.target;item.classList.toggle("selected",selected);tab.element.classList.toggle("visible",selected);for(let propertyEditor of tab.properties)
propertyEditor.update();}}};WebInspector.VisualStyleTimingEditor=class VisualStyleTimingEditor extends WebInspector.VisualStyleKeywordPicker
{constructor(propertyNames,text,possibleValues,layoutReversed)
{super(propertyNames,text,possibleValues,layoutReversed);this.element.classList.add("timing-editor");this._keywordSelectElement.createChild("hr");this._customBezierOptionElement=this._keywordSelectElement.createChild("option");this._customBezierOptionElement.value="bezier";this._customBezierOptionElement.text=WebInspector.UIString("Bezier");this._customSpringOptionElement=this._keywordSelectElement.createChild("option");this._customSpringOptionElement.value="spring";this._customSpringOptionElement.text=WebInspector.UIString("Spring");this._bezierSwatch=new WebInspector.InlineSwatch(WebInspector.InlineSwatch.Type.Bezier);this._bezierSwatch.addEventListener(WebInspector.InlineSwatch.Event.ValueChanged,this._bezierSwatchValueChanged,this);this.contentElement.appendChild(this._bezierSwatch.element);this._springSwatch=new WebInspector.InlineSwatch(WebInspector.InlineSwatch.Type.Spring);this._springSwatch.addEventListener(WebInspector.InlineSwatch.Event.ValueChanged,this._springSwatchValueChanged,this);this.contentElement.appendChild(this._springSwatch.element);}
get value()
{if(this._customBezierOptionElement.selected)
return this._bezierValue;if(this._customSpringOptionElement.selected)
return this._springValue;return super.value;}
set value(value)
{this._bezierValue=value;this._springValue=value;if(this.valueIsSupportedKeyword(value)){super.value=value;this.contentElement.classList.remove("bezier-value","spring-value");return;}
let bezier=this._bezierValue;this._customBezierOptionElement.selected=!!bezier;this.contentElement.classList.toggle("bezier-value",!!bezier);let spring=this._springValue;this._customSpringOptionElement.selected=!!spring;this.contentElement.classList.toggle("spring-value",!!spring);this.specialPropertyPlaceholderElement.hidden=!!bezier||!!spring;if(!bezier&&!spring)
super.value=value;}
get synthesizedValue()
{if(this._customBezierOptionElement.selected)
return this._bezierValue;if(this._customSpringOptionElement.selected)
return this._springValue;return super.synthesizedValue;}
parseValue(text)
{return/((?:cubic-bezier|spring)\(.+\))/.exec(text);}
get _bezierValue()
{let bezier=this._bezierSwatch.value;if(!bezier)
return null;return bezier.toString();}
set _bezierValue(text)
{this._bezierSwatch.value=WebInspector.CubicBezier.fromString(text);}
get _springValue()
{let spring=this._springSwatch.value;if(!spring)
return null;return spring.toString();}
set _springValue(text)
{this._springSwatch.value=WebInspector.Spring.fromString(text);}
_handleKeywordChanged()
{super._handleKeywordChanged();let customBezierOptionSelected=this._customBezierOptionElement.selected;this.contentElement.classList.toggle("bezier-value",!!customBezierOptionSelected);if(customBezierOptionSelected)
this._bezierValue="linear";let customSpringOptionSelected=this._customSpringOptionElement.selected;this.contentElement.classList.toggle("spring-value",!!customSpringOptionSelected);if(customSpringOptionSelected)
this._springValue="1 100 10 0";this.specialPropertyPlaceholderElement.hidden=!!customBezierOptionSelected||!!customSpringOptionSelected;}
_bezierSwatchValueChanged(event)
{this._valueDidChange();}
_springSwatchValueChanged(event)
{this._valueDidChange();}};WebInspector.VisualStyleURLInput=class VisualStyleURLInput extends WebInspector.VisualStylePropertyEditor
{constructor(propertyNames,text,possibleValues,layoutReversed)
{super(propertyNames,text,possibleValues,null,"url-input",layoutReversed);this._urlInputElement=document.createElement("input");this._urlInputElement.type="url";this._urlInputElement.placeholder=WebInspector.UIString("Enter a URL");this._urlInputElement.addEventListener("keyup",this.debounce(250)._valueDidChange);this.contentElement.appendChild(this._urlInputElement);}
get value()
{return this._urlInputElement.value;}
set value(value)
{if((value&&value===this.value)||this._propertyMissing)
return;this._urlInputElement.value=value;}
get synthesizedValue()
{let value=this.value;if(!value||!value.length)
return null;if(this.valueIsSupportedKeyword(value))
return value;return"url("+value+")";}
parseValue(text)
{if(this.valueIsSupportedKeyword(text))
return[text,text];return/^(?:url\(\s*)([^\)]*)(?:\s*\)\s*;?)$/.exec(text);}};WebInspector.VisualStyleUnitSlider=class VisualStyleUnitSlider extends WebInspector.VisualStylePropertyEditor
{constructor(propertyNames,label,layoutReversed)
{super(propertyNames,label,null,null,"unit-slider",layoutReversed);this._slider=new WebInspector.Slider;this._slider.delegate=this;this.contentElement.appendChild(this._slider.element);}
set value(value)
{let knobX=parseFloat(value);if(isNaN(knobX))
knobX=parseFloat(this._updatedValues.placeholder)||0;this._slider.knobX=knobX;}
get value()
{return Math.round(this._slider.value*100)/100;}
get synthesizedValue()
{return this.value;}
recalculateWidth(value)
{this._slider.recalculateKnobX();}
sliderValueDidChange(slider,value)
{this._valueDidChange();}};WebInspector.Annotator=class Annotator extends WebInspector.Object
{constructor(sourceCodeTextEditor)
{super();this._sourceCodeTextEditor=sourceCodeTextEditor;this._timeoutIdentifier=null;this._isActive=false;}
get sourceCodeTextEditor()
{return this._sourceCodeTextEditor;}
isActive()
{return this._isActive;}
pause()
{this._clearTimeoutIfNeeded();this._isActive=false;}
resume()
{this._clearTimeoutIfNeeded();this._isActive=true;this.insertAnnotations();}
refresh()
{if(!this._isActive)
return;this._clearTimeoutIfNeeded();this.insertAnnotations();}
reset()
{this._clearTimeoutIfNeeded();this._isActive=true;this.clearAnnotations();this.insertAnnotations();}
clear()
{this.pause();this.clearAnnotations();}
insertAnnotations()
{}
clearAnnotations()
{}
_clearTimeoutIfNeeded()
{if(this._timeoutIdentifier){clearTimeout(this._timeoutIdentifier);this._timeoutIdentifier=null;}}};WebInspector.CodeMirrorEditingController=class CodeMirrorEditingController extends WebInspector.Object
{constructor(codeMirror,marker)
{super();this._codeMirror=codeMirror;this._marker=marker;this._delegate=null;this._range=marker.range;this._value=this.initialValue;this._keyboardShortcutEsc=new WebInspector.KeyboardShortcut(null,WebInspector.KeyboardShortcut.Key.Escape);}
get marker()
{return this._marker;}
get range()
{return this._range;}
get value()
{return this._value;}
set value(value)
{this.text=value.toString();this._value=value;}
get delegate()
{return this._delegate;}
set delegate(delegate)
{this._delegate=delegate;}
get text()
{var from={line:this._range.startLine,ch:this._range.startColumn};var to={line:this._range.endLine,ch:this._range.endColumn};return this._codeMirror.getRange(from,to);}
set text(text)
{var from={line:this._range.startLine,ch:this._range.startColumn};var to={line:this._range.endLine,ch:this._range.endColumn};this._codeMirror.replaceRange(text,from,to);var lines=text.split("\n");var endLine=this._range.startLine+lines.length-1;var endColumn=lines.length>1?lines.lastValue.length:this._range.startColumn+text.length;this._range=new WebInspector.TextRange(this._range.startLine,this._range.startColumn,endLine,endColumn);}
get initialValue()
{return this.text;}
get cssClassName()
{return"";}
get popover()
{return this._popover;}
get popoverPreferredEdges()
{
return[WebInspector.RectEdge.MIN_X,WebInspector.RectEdge.MIN_Y,WebInspector.RectEdge.MAX_Y,WebInspector.RectEdge.MAX_X];}
popoverTargetFrameWithRects(rects)
{return WebInspector.Rect.unionOfRects(rects);}
presentHoverMenu()
{if(!this.cssClassName)
return;this._hoverMenu=new WebInspector.HoverMenu(this);this._hoverMenu.element.classList.add(this.cssClassName);this._rects=this._marker.rects;this._hoverMenu.present(this._rects);}
dismissHoverMenu(discrete)
{if(!this._hoverMenu)
return;this._hoverMenu.dismiss(discrete);}
popoverWillPresent(popover)
{}
popoverDidPresent(popover)
{}
popoverDidDismiss(popover)
{}
handleKeydownEvent(event)
{if(!this._keyboardShortcutEsc.matchesEvent(event)||!this._popover.visible)
return false;this.value=this._originalValue;this._popover.dismiss();return true;}
hoverMenuButtonWasPressed(hoverMenu)
{this._popover=new WebInspector.Popover(this);this.popoverWillPresent(this._popover);this._popover.present(this.popoverTargetFrameWithRects(this._rects).pad(2),this.popoverPreferredEdges);this.popoverDidPresent(this._popover);WebInspector.addWindowKeydownListener(this);hoverMenu.dismiss();if(this._delegate&&typeof this._delegate.editingControllerDidStartEditing==="function")
this._delegate.editingControllerDidStartEditing(this);this._originalValue=this._value.copy();}
didDismissPopover(popover)
{delete this._popover;delete this._originalValue;WebInspector.removeWindowKeydownListener(this);this.popoverDidDismiss();if(this._delegate&&typeof this._delegate.editingControllerDidFinishEditing==="function")
this._delegate.editingControllerDidFinishEditing(this);}};WebInspector.AnalyzerManager=class AnalyzerManager extends WebInspector.Object
{constructor()
{super();this._eslintConfig={env:{"browser":true,"node":false},globals:{"document":true},rules:{"consistent-return":2,"curly":0,"eqeqeq":0,"new-parens":0,"no-comma-dangle":0,"no-console":0,"no-constant-condition":0,"no-extra-bind":2,"no-extra-semi":2,"no-proto":0,"no-return-assign":2,"no-trailing-spaces":2,"no-underscore-dangle":0,"no-unused-expressions":2,"no-wrap-func":2,"semi":2,"space-infix-ops":2,"space-return-throw-case":2,"strict":0,"valid-typeof":2}};this._sourceCodeMessagesMap=new WeakMap;WebInspector.SourceCode.addEventListener(WebInspector.SourceCode.Event.ContentDidChange,this._handleSourceCodeContentDidChange,this);}
getAnalyzerMessagesForSourceCode(sourceCode)
{return new Promise(function(resolve,reject){var analyzer=WebInspector.AnalyzerManager._typeAnalyzerMap.get(sourceCode.type);if(!analyzer){reject(new Error("This resource type cannot be analyzed."));return;}
if(this._sourceCodeMessagesMap.has(sourceCode)){resolve(this._sourceCodeMessagesMap.get(sourceCode));return;}
function retrieveAnalyzerMessages(properties)
{var analyzerMessages=[];var rawAnalyzerMessages=analyzer.verify(sourceCode.content,this._eslintConfig);for(var rawAnalyzerMessage of rawAnalyzerMessages)
analyzerMessages.push(new WebInspector.AnalyzerMessage(new WebInspector.SourceCodeLocation(sourceCode,rawAnalyzerMessage.line-1,rawAnalyzerMessage.column-1),rawAnalyzerMessage.message,rawAnalyzerMessage.ruleId));this._sourceCodeMessagesMap.set(sourceCode,analyzerMessages);resolve(analyzerMessages);}
sourceCode.requestContent().then(retrieveAnalyzerMessages.bind(this)).catch(handlePromiseException);}.bind(this));}
sourceCodeCanBeAnalyzed(sourceCode)
{return sourceCode.type===WebInspector.Resource.Type.Script;}
_handleSourceCodeContentDidChange(event)
{var sourceCode=event.target;this._sourceCodeMessagesMap.delete(sourceCode);}};WebInspector.AnalyzerManager._typeAnalyzerMap=new Map;
WebInspector.ApplicationCacheManager=class ApplicationCacheManager extends WebInspector.Object
{constructor()
{super();if(window.ApplicationCacheAgent)
ApplicationCacheAgent.enable();WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange,this._mainResourceDidChange,this);WebInspector.Frame.addEventListener(WebInspector.Frame.Event.ChildFrameWasRemoved,this._childFrameWasRemoved,this);this._online=true;this.initialize();}
initialize()
{this._applicationCacheObjects={};if(window.ApplicationCacheAgent)
ApplicationCacheAgent.getFramesWithManifests(this._framesWithManifestsLoaded.bind(this));}
get applicationCacheObjects()
{var applicationCacheObjects=[];for(var id in this._applicationCacheObjects)
applicationCacheObjects.push(this._applicationCacheObjects[id]);return applicationCacheObjects;}
networkStateUpdated(isNowOnline)
{this._online=isNowOnline;this.dispatchEventToListeners(WebInspector.ApplicationCacheManager.Event.NetworkStateUpdated,{online:this._online});}
get online()
{return this._online;}
applicationCacheStatusUpdated(frameId,manifestURL,status)
{var frame=WebInspector.frameResourceManager.frameForIdentifier(frameId);if(!frame)
return;this._frameManifestUpdated(frame,manifestURL,status);}
requestApplicationCache(frame,callback)
{function callbackWrapper(error,applicationCache)
{if(error){callback(null);return;}
callback(applicationCache);}
ApplicationCacheAgent.getApplicationCacheForFrame(frame.id,callbackWrapper);}
_mainResourceDidChange(event)
{if(event.target.isMainFrame()){this.initialize();this.dispatchEventToListeners(WebInspector.ApplicationCacheManager.Event.Cleared);return;}
if(window.ApplicationCacheAgent)
ApplicationCacheAgent.getManifestForFrame(event.target.id,this._manifestForFrameLoaded.bind(this,event.target.id));}
_childFrameWasRemoved(event)
{this._frameManifestRemoved(event.data.childFrame);}
_manifestForFrameLoaded(frameId,error,manifestURL)
{if(error)
return;var frame=WebInspector.frameResourceManager.frameForIdentifier(frameId);if(!frame)
return;if(!manifestURL)
this._frameManifestRemoved(frame);}
_framesWithManifestsLoaded(error,framesWithManifests)
{if(error)
return;for(var i=0;i<framesWithManifests.length;++i){var frame=WebInspector.frameResourceManager.frameForIdentifier(framesWithManifests[i].frameId);if(!frame)
continue;this._frameManifestUpdated(frame,framesWithManifests[i].manifestURL,framesWithManifests[i].status);}}
_frameManifestUpdated(frame,manifestURL,status)
{if(status===WebInspector.ApplicationCacheManager.Status.Uncached){this._frameManifestRemoved(frame);return;}
if(!manifestURL)
return;var manifestFrame=this._applicationCacheObjects[frame.id];if(manifestFrame&&manifestURL!==manifestFrame.manifest.manifestURL)
this._frameManifestRemoved(frame);var oldStatus=manifestFrame?manifestFrame.status:-1;var statusChanged=manifestFrame&&status!==oldStatus;if(manifestFrame)
manifestFrame.status=status;if(!this._applicationCacheObjects[frame.id]){var cacheManifest=new WebInspector.ApplicationCacheManifest(manifestURL);this._applicationCacheObjects[frame.id]=new WebInspector.ApplicationCacheFrame(frame,cacheManifest,status);this.dispatchEventToListeners(WebInspector.ApplicationCacheManager.Event.FrameManifestAdded,{frameManifest:this._applicationCacheObjects[frame.id]});}
if(statusChanged)
this.dispatchEventToListeners(WebInspector.ApplicationCacheManager.Event.FrameManifestStatusChanged,{frameManifest:this._applicationCacheObjects[frame.id]});}
_frameManifestRemoved(frame)
{if(!this._applicationCacheObjects[frame.id])
return;delete this._applicationCacheObjects[frame.id];this.dispatchEventToListeners(WebInspector.ApplicationCacheManager.Event.FrameManifestRemoved,{frame});}};WebInspector.ApplicationCacheManager.Event={Cleared:"application-cache-manager-cleared",FrameManifestAdded:"application-cache-manager-frame-manifest-added",FrameManifestRemoved:"application-cache-manager-frame-manifest-removed",FrameManifestStatusChanged:"application-cache-manager-frame-manifest-status-changed",NetworkStateUpdated:"application-cache-manager-network-state-updated"};WebInspector.ApplicationCacheManager.Status={Uncached:0,Idle:1,Checking:2,Downloading:3,UpdateReady:4,Obsolete:5};WebInspector.BasicBlockAnnotator=class BasicBlockAnnotator extends WebInspector.Annotator
{constructor(sourceCodeTextEditor,script)
{super(sourceCodeTextEditor);this._script=script;this._basicBlockMarkers=new Map;}
clearAnnotations()
{for(var key of this._basicBlockMarkers.keys())
this._clearRangeForBasicBlockMarker(key);}
insertAnnotations()
{if(!this.isActive())
return;this._annotateBasicBlockExecutionRanges();}
_annotateBasicBlockExecutionRanges()
{var sourceID=this._script.id;var startTime=Date.now();this._script.target.RuntimeAgent.getBasicBlocks(sourceID,function(error,basicBlocks){if(error){console.error("Error in getting basic block locations: "+error);return;}
if(!this.isActive())
return;var{startOffset,endOffset}=this.sourceCodeTextEditor.visibleRangeOffsets();basicBlocks=basicBlocks.filter(function(block){
if(block.startOffset>endOffset)
return false;
if(block.endOffset<startOffset)
return false;return true;});for(var block of basicBlocks){var key=block.startOffset+":"+block.endOffset;var hasKey=this._basicBlockMarkers.has(key);var hasExecuted=block.hasExecuted;if(hasKey&&hasExecuted)
this._clearRangeForBasicBlockMarker(key);else if(!hasKey&&!hasExecuted){var marker=this._highlightTextForBasicBlock(block);this._basicBlockMarkers.set(key,marker);}}
var totalTime=Date.now()-startTime;var timeoutTime=Number.constrain(30*totalTime,500,5000);this._timeoutIdentifier=setTimeout(this.insertAnnotations.bind(this),timeoutTime);}.bind(this));}
_highlightTextForBasicBlock(basicBlock)
{var startPosition=this.sourceCodeTextEditor.originalOffsetToCurrentPosition(basicBlock.startOffset);var endPosition=this.sourceCodeTextEditor.originalOffsetToCurrentPosition(basicBlock.endOffset);if(this._isTextRangeOnlyClosingBrace(startPosition,endPosition))
return null;var marker=this.sourceCodeTextEditor.addStyleToTextRange(startPosition,endPosition,WebInspector.BasicBlockAnnotator.HasNotExecutedClassName);return marker;}
_isTextRangeOnlyClosingBrace(startPosition,endPosition)
{var isOnlyClosingBrace=/^\s*\}$/;return isOnlyClosingBrace.test(this.sourceCodeTextEditor.getTextInRange(startPosition,endPosition));}
_clearRangeForBasicBlockMarker(key)
{var marker=this._basicBlockMarkers.get(key);if(marker)
marker.clear();this._basicBlockMarkers.delete(key);}};WebInspector.BasicBlockAnnotator.HasNotExecutedClassName="basic-block-has-not-executed";WebInspector.BranchManager=class BranchManager extends WebInspector.Object
{constructor()
{super();WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange,this._mainResourceDidChange,this);this.initialize();}
initialize()
{this._originalBranch=new WebInspector.Branch(WebInspector.UIString("Original"),null,true);this._currentBranch=this._originalBranch.fork(WebInspector.UIString("Working Copy"));this._branches=[this._originalBranch,this._currentBranch];}
get branches()
{return this._branches;}
get currentBranch()
{return this._currentBranch;}
set currentBranch(branch)
{if(!(branch instanceof WebInspector.Branch))
return;this._currentBranch.revert();this._currentBranch=branch;this._currentBranch.apply();}
createBranch(displayName,fromBranch)
{if(!fromBranch)
fromBranch=this._originalBranch;if(!(fromBranch instanceof WebInspector.Branch))
return null;var newBranch=fromBranch.fork(displayName);this._branches.push(newBranch);return newBranch;}
deleteBranch(branch)
{if(!(branch instanceof WebInspector.Branch))
return;if(branch===this._originalBranch)
return;this._branches.remove(branch);if(branch===this._currentBranch)
this._currentBranch=this._originalBranch;}
_mainResourceDidChange(event)
{if(!event.target.isMainFrame())
return;this.initialize();}};WebInspector.BreakpointLogMessageLexer=class BreakpointLogMessageLexer extends WebInspector.Object
{constructor()
{super();this._stateFunctions={[WebInspector.BreakpointLogMessageLexer.State.Expression]:this._expression,[WebInspector.BreakpointLogMessageLexer.State.PlainText]:this._plainText,[WebInspector.BreakpointLogMessageLexer.State.PossiblePlaceholder]:this._possiblePlaceholder,[WebInspector.BreakpointLogMessageLexer.State.RegExpOrStringLiteral]:this._regExpOrStringLiteral,};this.reset();}
tokenize(input)
{this.reset();this._input=input;while(this._index<this._input.length){let stateFunction=this._stateFunctions[this._states.lastValue];if(!stateFunction){this.reset();return null;}
stateFunction.call(this);}
this._finishPlainText();return this._tokens;}
reset()
{this._input="";this._buffer="";this._index=0;this._states=[WebInspector.BreakpointLogMessageLexer.State.PlainText];this._literalStartCharacter="";this._curlyBraceDepth=0;this._tokens=[];}
_finishPlainText()
{this._appendToken(WebInspector.BreakpointLogMessageLexer.TokenType.PlainText);}
_finishExpression()
{this._appendToken(WebInspector.BreakpointLogMessageLexer.TokenType.Expression);}
_appendToken(type)
{if(!this._buffer)
return;this._tokens.push({type,data:this._buffer});this._buffer="";}
_consume()
{let character=this._peek();this._index++;return character;}
_peek()
{return this._input[this._index]||null;}
_expression()
{let character=this._consume();if(character==="}"){if(this._curlyBraceDepth===0){this._finishExpression();this._states.pop();return;}
this._curlyBraceDepth--;}
this._buffer+=character;if(character==="/"||character==="\""||character==="'"){this._literalStartCharacter=character;this._states.push(WebInspector.BreakpointLogMessageLexer.State.RegExpOrStringLiteral);}else if(character==="{")
this._curlyBraceDepth++;}
_plainText()
{let character=this._peek();if(character==="$")
this._states.push(WebInspector.BreakpointLogMessageLexer.State.PossiblePlaceholder);else{this._buffer+=character;this._consume();}}
_possiblePlaceholder()
{let character=this._consume();let nextCharacter=this._peek();this._states.pop();if(nextCharacter==="{"){this._finishPlainText();this._consume();this._states.push(WebInspector.BreakpointLogMessageLexer.State.Expression);}else
this._buffer+=character;}
_regExpOrStringLiteral()
{let character=this._consume();this._buffer+=character;if(character==="\\"){if(this._peek()!==null)
this._buffer+=this._consume();return;}
if(character===this._literalStartCharacter){this._states.pop();}}};WebInspector.BreakpointLogMessageLexer.State={Expression:Symbol("expression"),PlainText:Symbol("plain-text"),PossiblePlaceholder:Symbol("possible-placeholder"),RegExpOrStringLiteral:Symbol("regexp-or-string-literal"),};WebInspector.BreakpointLogMessageLexer.TokenType={PlainText:"token-type-plain-text",Expression:"token-type-expression",};WebInspector.BreakpointPopoverController=class BreakpointPopoverController extends WebInspector.Object
{constructor()
{super();this._breakpoint=null;this._popover=null;this._popoverContentElement=null;}
appendContextMenuItems(contextMenu,breakpoint,breakpointDisplayElement)
{const editBreakpoint=()=>{if(this._popover)
return;this._createPopoverContent(breakpoint);this._popover=new WebInspector.Popover(this);this._popover.content=this._popoverContentElement;let bounds=WebInspector.Rect.rectFromClientRect(breakpointDisplayElement.getBoundingClientRect());bounds.origin.x-=1;this._popover.present(bounds.pad(2),[WebInspector.RectEdge.MAX_Y]);};const removeBreakpoint=()=>{WebInspector.debuggerManager.removeBreakpoint(breakpoint);};const toggleBreakpoint=()=>{breakpoint.disabled=!breakpoint.disabled;};const toggleAutoContinue=()=>{breakpoint.autoContinue=!breakpoint.autoContinue;};const revealOriginalSourceCodeLocation=()=>{const options={ignoreNetworkTab:true,ignoreSearchTab:true,};WebInspector.showOriginalOrFormattedSourceCodeLocation(breakpoint.sourceCodeLocation,options);};if(WebInspector.debuggerManager.isBreakpointEditable(breakpoint))
contextMenu.appendItem(WebInspector.UIString("Edit Breakpoint…"),editBreakpoint);if(breakpoint.autoContinue&&!breakpoint.disabled){contextMenu.appendItem(WebInspector.UIString("Disable Breakpoint"),toggleBreakpoint);contextMenu.appendItem(WebInspector.UIString("Cancel Automatic Continue"),toggleAutoContinue);}else if(!breakpoint.disabled)
contextMenu.appendItem(WebInspector.UIString("Disable Breakpoint"),toggleBreakpoint);else
contextMenu.appendItem(WebInspector.UIString("Enable Breakpoint"),toggleBreakpoint);if(!breakpoint.autoContinue&&!breakpoint.disabled&&breakpoint.actions.length)
contextMenu.appendItem(WebInspector.UIString("Set to Automatically Continue"),toggleAutoContinue);if(WebInspector.debuggerManager.isBreakpointRemovable(breakpoint)){contextMenu.appendSeparator();contextMenu.appendItem(WebInspector.UIString("Delete Breakpoint"),removeBreakpoint);}
if(breakpoint._sourceCodeLocation.hasMappedLocation()){contextMenu.appendSeparator();contextMenu.appendItem(WebInspector.UIString("Reveal in Original Resource"),revealOriginalSourceCodeLocation);}}
completionControllerShouldAllowEscapeCompletion()
{return false;}
_createPopoverContent(breakpoint)
{if(this._popoverContentElement)
return;this._breakpoint=breakpoint;this._popoverContentElement=document.createElement("div");this._popoverContentElement.className="edit-breakpoint-popover-content";let checkboxElement=document.createElement("input");checkboxElement.type="checkbox";checkboxElement.checked=!this._breakpoint.disabled;checkboxElement.addEventListener("change",this._popoverToggleEnabledCheckboxChanged.bind(this));let checkboxLabel=document.createElement("label");checkboxLabel.className="toggle";checkboxLabel.appendChild(checkboxElement);checkboxLabel.append(this._breakpoint.sourceCodeLocation.displayLocationString());let table=document.createElement("table");let conditionRow=table.appendChild(document.createElement("tr"));let conditionHeader=conditionRow.appendChild(document.createElement("th"));let conditionData=conditionRow.appendChild(document.createElement("td"));let conditionLabel=conditionHeader.appendChild(document.createElement("label"));conditionLabel.textContent=WebInspector.UIString("Condition");let conditionEditorElement=conditionData.appendChild(document.createElement("div"));conditionEditorElement.classList.add("edit-breakpoint-popover-condition",WebInspector.SyntaxHighlightedStyleClassName);this._conditionCodeMirror=WebInspector.CodeMirrorEditor.create(conditionEditorElement,{extraKeys:{Tab:false},lineWrapping:false,mode:"text/javascript",matchBrackets:true,placeholder:WebInspector.UIString("Conditional expression"),scrollbarStyle:null,value:this._breakpoint.condition||"",});let conditionCodeMirrorInputField=this._conditionCodeMirror.getInputField();conditionCodeMirrorInputField.id="codemirror-condition-input-field";conditionLabel.setAttribute("for",conditionCodeMirrorInputField.id);this._conditionCodeMirrorEscapeOrEnterKeyHandler=this._conditionCodeMirrorEscapeOrEnterKey.bind(this);this._conditionCodeMirror.addKeyMap({"Esc":this._conditionCodeMirrorEscapeOrEnterKeyHandler,"Enter":this._conditionCodeMirrorEscapeOrEnterKeyHandler,});this._conditionCodeMirror.on("change",this._conditionCodeMirrorChanged.bind(this));this._conditionCodeMirror.on("beforeChange",this._conditionCodeMirrorBeforeChange.bind(this));let completionController=new WebInspector.CodeMirrorCompletionController(this._conditionCodeMirror,this);completionController.addExtendedCompletionProvider("javascript",WebInspector.javaScriptRuntimeCompletionProvider);setTimeout(()=>{this._conditionCodeMirror.refresh();this._conditionCodeMirror.focus();},0);if(DebuggerAgent.setBreakpoint.supports("options")){
if(CSSAgent.getSupportedSystemFontFamilyNames){let ignoreCountRow=table.appendChild(document.createElement("tr"));let ignoreCountHeader=ignoreCountRow.appendChild(document.createElement("th"));let ignoreCountLabel=ignoreCountHeader.appendChild(document.createElement("label"));let ignoreCountData=ignoreCountRow.appendChild(document.createElement("td"));this._ignoreCountInput=ignoreCountData.appendChild(document.createElement("input"));this._ignoreCountInput.id="edit-breakpoint-popover-ignore";this._ignoreCountInput.type="number";this._ignoreCountInput.min=0;this._ignoreCountInput.value=0;this._ignoreCountInput.addEventListener("change",this._popoverIgnoreInputChanged.bind(this));ignoreCountLabel.setAttribute("for",this._ignoreCountInput.id);ignoreCountLabel.textContent=WebInspector.UIString("Ignore");this._ignoreCountText=ignoreCountData.appendChild(document.createElement("span"));this._updateIgnoreCountText();}
let actionRow=table.appendChild(document.createElement("tr"));let actionHeader=actionRow.appendChild(document.createElement("th"));let actionData=this._actionsContainer=actionRow.appendChild(document.createElement("td"));let actionLabel=actionHeader.appendChild(document.createElement("label"));actionLabel.textContent=WebInspector.UIString("Action");if(!this._breakpoint.actions.length)
this._popoverActionsCreateAddActionButton();else{this._popoverContentElement.classList.add(WebInspector.BreakpointPopoverController.WidePopoverClassName);for(let i=0;i<this._breakpoint.actions.length;++i){let breakpointActionView=new WebInspector.BreakpointActionView(this._breakpoint.actions[i],this,true);this._popoverActionsInsertBreakpointActionView(breakpointActionView,i);}}
let optionsRow=this._popoverOptionsRowElement=table.appendChild(document.createElement("tr"));if(!this._breakpoint.actions.length)
optionsRow.classList.add(WebInspector.BreakpointPopoverController.HiddenStyleClassName);let optionsHeader=optionsRow.appendChild(document.createElement("th"));let optionsData=optionsRow.appendChild(document.createElement("td"));let optionsLabel=optionsHeader.appendChild(document.createElement("label"));let optionsCheckbox=this._popoverOptionsCheckboxElement=optionsData.appendChild(document.createElement("input"));let optionsCheckboxLabel=optionsData.appendChild(document.createElement("label"));optionsCheckbox.id="edit-breakpoint-popover-auto-continue";optionsCheckbox.type="checkbox";optionsCheckbox.checked=this._breakpoint.autoContinue;optionsCheckbox.addEventListener("change",this._popoverToggleAutoContinueCheckboxChanged.bind(this));optionsLabel.textContent=WebInspector.UIString("Options");optionsCheckboxLabel.setAttribute("for",optionsCheckbox.id);optionsCheckboxLabel.textContent=WebInspector.UIString("Automatically continue after evaluating");}
this._popoverContentElement.appendChild(checkboxLabel);this._popoverContentElement.appendChild(table);}
_popoverToggleEnabledCheckboxChanged(event)
{this._breakpoint.disabled=!event.target.checked;}
_conditionCodeMirrorChanged(codeMirror,change)
{this._breakpoint.condition=(codeMirror.getValue()||"").trim();}
_conditionCodeMirrorBeforeChange(codeMirror,change)
{if(change.update){let newText=change.text.join("").replace(/\n/g,"");change.update(change.from,change.to,[newText]);}
return true;}
_conditionCodeMirrorEscapeOrEnterKey()
{if(!this._popover)
return;this._popover.dismiss();}
_popoverIgnoreInputChanged(event)
{let ignoreCount=0;if(event.target.value){ignoreCount=parseInt(event.target.value,10);if(isNaN(ignoreCount)||ignoreCount<0)
ignoreCount=0;}
this._ignoreCountInput.value=ignoreCount;this._breakpoint.ignoreCount=ignoreCount;this._updateIgnoreCountText();}
_popoverToggleAutoContinueCheckboxChanged(event)
{this._breakpoint.autoContinue=event.target.checked;}
_popoverActionsCreateAddActionButton()
{this._popoverContentElement.classList.remove(WebInspector.BreakpointPopoverController.WidePopoverClassName);this._actionsContainer.removeChildren();let addActionButton=this._actionsContainer.appendChild(document.createElement("button"));addActionButton.textContent=WebInspector.UIString("Add Action");addActionButton.addEventListener("click",this._popoverActionsAddActionButtonClicked.bind(this));}
_popoverActionsAddActionButtonClicked(event)
{this._popoverContentElement.classList.add(WebInspector.BreakpointPopoverController.WidePopoverClassName);this._actionsContainer.removeChildren();let newAction=this._breakpoint.createAction(WebInspector.Breakpoint.DefaultBreakpointActionType);let newBreakpointActionView=new WebInspector.BreakpointActionView(newAction,this);this._popoverActionsInsertBreakpointActionView(newBreakpointActionView,-1);this._popoverOptionsRowElement.classList.remove(WebInspector.BreakpointPopoverController.HiddenStyleClassName);this._popover.update();}
_popoverActionsInsertBreakpointActionView(breakpointActionView,index)
{if(index===-1)
this._actionsContainer.appendChild(breakpointActionView.element);else{let nextElement=this._actionsContainer.children[index+1]||null;this._actionsContainer.insertBefore(breakpointActionView.element,nextElement);}}
_updateIgnoreCountText()
{if(this._breakpoint.ignoreCount===1)
this._ignoreCountText.textContent=WebInspector.UIString("time before stopping");else
this._ignoreCountText.textContent=WebInspector.UIString("times before stopping");}
breakpointActionViewAppendActionView(breakpointActionView,newAction)
{let newBreakpointActionView=new WebInspector.BreakpointActionView(newAction,this);let index=0;let children=this._actionsContainer.children;for(let i=0;children.length;++i){if(children[i]===breakpointActionView.element){index=i;break;}}
this._popoverActionsInsertBreakpointActionView(newBreakpointActionView,index);this._popoverOptionsRowElement.classList.remove(WebInspector.BreakpointPopoverController.HiddenStyleClassName);this._popover.update();}
breakpointActionViewRemoveActionView(breakpointActionView)
{breakpointActionView.element.remove();if(!this._actionsContainer.children.length){this._popoverActionsCreateAddActionButton();this._popoverOptionsRowElement.classList.add(WebInspector.BreakpointPopoverController.HiddenStyleClassName);this._popoverOptionsCheckboxElement.checked=false;}
this._popover.update();}
breakpointActionViewResized(breakpointActionView)
{this._popover.update();}
willDismissPopover(popover)
{this._popoverContentElement=null;this._popoverOptionsRowElement=null;this._popoverOptionsCheckboxElement=null;this._actionsContainer=null;this._popover=null;}
didDismissPopover(popover)
{let emptyActions=this._breakpoint.actions.filter(function(action){if(action.type!==WebInspector.BreakpointAction.Type.Evaluate&&action.type!==WebInspector.BreakpointAction.Type.Probe)
return false;return!(action.data&&action.data.trim());});for(let action of emptyActions)
this._breakpoint.removeAction(action);this._breakpoint=null;}};WebInspector.BreakpointPopoverController.WidePopoverClassName="wide";WebInspector.BreakpointPopoverController.HiddenStyleClassName="hidden";WebInspector.CSSStyleManager=class CSSStyleManager extends WebInspector.Object
{constructor()
{super();if(window.CSSAgent)
CSSAgent.enable();WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange,this._mainResourceDidChange,this);WebInspector.Frame.addEventListener(WebInspector.Frame.Event.ResourceWasAdded,this._resourceAdded,this);WebInspector.Resource.addEventListener(WebInspector.SourceCode.Event.ContentDidChange,this._resourceContentDidChange,this);WebInspector.Resource.addEventListener(WebInspector.Resource.Event.TypeDidChange,this._resourceTypeDidChange,this);WebInspector.DOMNode.addEventListener(WebInspector.DOMNode.Event.AttributeModified,this._nodeAttributesDidChange,this);WebInspector.DOMNode.addEventListener(WebInspector.DOMNode.Event.AttributeRemoved,this._nodeAttributesDidChange,this);WebInspector.DOMNode.addEventListener(WebInspector.DOMNode.Event.EnabledPseudoClassesChanged,this._nodePseudoClassesDidChange,this);this._colorFormatSetting=new WebInspector.Setting("default-color-format",WebInspector.Color.Format.Original);this._styleSheetIdentifierMap=new Map;this._styleSheetFrameURLMap=new Map;this._nodeStylesMap={};
this._fetchedInitialStyleSheets=window.CSSAgent&&window.CSSAgent.hasEvent("styleSheetAdded");}
static protocolStyleSheetOriginToEnum(origin)
{switch(origin){case CSSAgent.StyleSheetOrigin.Regular:return WebInspector.CSSStyleSheet.Type.Author;case CSSAgent.StyleSheetOrigin.User:return WebInspector.CSSStyleSheet.Type.User;case CSSAgent.StyleSheetOrigin.UserAgent:return WebInspector.CSSStyleSheet.Type.UserAgent;case CSSAgent.StyleSheetOrigin.Inspector:return WebInspector.CSSStyleSheet.Type.Inspector;default:return CSSAgent.StyleSheetOrigin.Regular;}}
static protocolMediaSourceToEnum(source)
{switch(source){case CSSAgent.CSSMediaSource.MediaRule:return WebInspector.CSSMedia.Type.MediaRule;case CSSAgent.CSSMediaSource.ImportRule:return WebInspector.CSSMedia.Type.ImportRule;case CSSAgent.CSSMediaSource.LinkedSheet:return WebInspector.CSSMedia.Type.LinkedStyleSheet;case CSSAgent.CSSMediaSource.InlineSheet:return WebInspector.CSSMedia.Type.InlineStyleSheet;default:return WebInspector.CSSMedia.Type.MediaRule;}}
get preferredColorFormat()
{return this._colorFormatSetting.value;}
get styleSheets()
{return[...this._styleSheetIdentifierMap.values()];}
canForcePseudoClasses()
{return window.CSSAgent&&!!CSSAgent.forcePseudoState;}
propertyNameHasOtherVendorPrefix(name)
{if(!name||name.length<4||name.charAt(0)!=="-")
return false;var match=name.match(/^(?:-moz-|-ms-|-o-|-epub-)/);if(!match)
return false;return true;}
propertyValueHasOtherVendorKeyword(value)
{var match=value.match(/(?:-moz-|-ms-|-o-|-epub-)[-\w]+/);if(!match)
return false;return true;}
canonicalNameForPropertyName(name)
{if(!name||name.length<8||name.charAt(0)!=="-")
return name;var match=name.match(/^(?:-webkit-|-khtml-|-apple-)(.+)/);if(!match)
return name;return match[1];}
fetchStyleSheetsIfNeeded()
{if(this._fetchedInitialStyleSheets)
return;this._fetchInfoForAllStyleSheets(function(){});}
styleSheetForIdentifier(id)
{let styleSheet=this._styleSheetIdentifierMap.get(id);if(styleSheet)
return styleSheet;styleSheet=new WebInspector.CSSStyleSheet(id);this._styleSheetIdentifierMap.set(id,styleSheet);return styleSheet;}
stylesForNode(node)
{if(node.id in this._nodeStylesMap)
return this._nodeStylesMap[node.id];var styles=new WebInspector.DOMNodeStyles(node);this._nodeStylesMap[node.id]=styles;return styles;}
preferredInspectorStyleSheetForFrame(frame,callback,doNotCreateIfMissing)
{var inspectorStyleSheets=this._inspectorStyleSheetsForFrame(frame);for(let styleSheet of inspectorStyleSheets){if(styleSheet[WebInspector.CSSStyleManager.PreferredInspectorStyleSheetSymbol]){callback(styleSheet);return;}}
if(doNotCreateIfMissing)
return;if(CSSAgent.createStyleSheet){CSSAgent.createStyleSheet(frame.id,function(error,styleSheetId){let styleSheet=WebInspector.cssStyleManager.styleSheetForIdentifier(styleSheetId);styleSheet[WebInspector.CSSStyleManager.PreferredInspectorStyleSheetSymbol]=true;callback(styleSheet);});return;}
let expression=appendWebInspectorSourceURL("document");let contextId=frame.pageExecutionContext.id;RuntimeAgent.evaluate.invoke({expression,objectGroup:"",includeCommandLineAPI:false,doNotPauseOnExceptionsAndMuteConsole:true,contextId,returnByValue:false,generatePreview:false},documentAvailable);function documentAvailable(error,documentRemoteObjectPayload)
{if(error){callback(null);return;}
let remoteObject=WebInspector.RemoteObject.fromPayload(documentRemoteObjectPayload);remoteObject.pushNodeToFrontend(documentNodeAvailable.bind(null,remoteObject));}
function documentNodeAvailable(remoteObject,documentNodeId)
{remoteObject.release();if(!documentNodeId){callback(null);return;}
DOMAgent.querySelector(documentNodeId,"body",bodyNodeAvailable);}
function bodyNodeAvailable(error,bodyNodeId)
{if(error){console.error(error);callback(null);return;}
let selector="";CSSAgent.addRule(bodyNodeId,selector,cssRuleAvailable);}
function cssRuleAvailable(error,payload)
{if(error||!payload.ruleId){callback(null);return;}
let styleSheetId=payload.ruleId.styleSheetId;let styleSheet=WebInspector.cssStyleManager.styleSheetForIdentifier(styleSheetId);if(!styleSheet){callback(null);return;}
styleSheet[WebInspector.CSSStyleManager.PreferredInspectorStyleSheetSymbol]=true;callback(styleSheet);}}
mediaTypeChanged()
{this.mediaQueryResultChanged();}
mediaQueryResultChanged()
{for(var key in this._nodeStylesMap)
this._nodeStylesMap[key].mediaQueryResultDidChange();}
styleSheetChanged(styleSheetIdentifier)
{var styleSheet=this.styleSheetForIdentifier(styleSheetIdentifier); if(styleSheet.isInlineStyleAttributeStyleSheet())
return;styleSheet.noteContentDidChange();this._updateResourceContent(styleSheet);}
styleSheetAdded(styleSheetInfo)
{let styleSheet=this.styleSheetForIdentifier(styleSheetInfo.styleSheetId);let parentFrame=WebInspector.frameResourceManager.frameForIdentifier(styleSheetInfo.frameId);let origin=WebInspector.CSSStyleManager.protocolStyleSheetOriginToEnum(styleSheetInfo.origin);styleSheet.updateInfo(styleSheetInfo.sourceURL,parentFrame,origin,styleSheetInfo.isInline,styleSheetInfo.startLine,styleSheetInfo.startColumn);this.dispatchEventToListeners(WebInspector.CSSStyleManager.Event.StyleSheetAdded,{styleSheet});}
styleSheetRemoved(styleSheetIdentifier)
{let styleSheet=this._styleSheetIdentifierMap.get(styleSheetIdentifier);if(!styleSheet)
return;this._styleSheetIdentifierMap.delete(styleSheetIdentifier);this.dispatchEventToListeners(WebInspector.CSSStyleManager.Event.StyleSheetRemoved,{styleSheet});}
_inspectorStyleSheetsForFrame(frame)
{let styleSheets=[];for(let styleSheet of this.styleSheets){if(styleSheet.isInspectorStyleSheet()&&styleSheet.parentFrame===frame)
styleSheets.push(styleSheet);}
return styleSheets;}
_nodePseudoClassesDidChange(event)
{var node=event.target;for(var key in this._nodeStylesMap){var nodeStyles=this._nodeStylesMap[key];if(nodeStyles.node!==node&&!nodeStyles.node.isDescendant(node))
continue;nodeStyles.pseudoClassesDidChange(node);}}
_nodeAttributesDidChange(event)
{var node=event.target;for(var key in this._nodeStylesMap){var nodeStyles=this._nodeStylesMap[key];if(nodeStyles.node!==node&&!nodeStyles.node.isDescendant(node))
continue;nodeStyles.attributeDidChange(node,event.data.name);}}
_mainResourceDidChange(event)
{if(!event.target.isMainFrame())
return;this._fetchedInitialStyleSheets=window.CSSAgent&&window.CSSAgent.hasEvent("styleSheetAdded");this._styleSheetIdentifierMap.clear();this._styleSheetFrameURLMap.clear();this._nodeStylesMap={};}
_resourceAdded(event)
{var resource=event.data.resource;if(resource.type!==WebInspector.Resource.Type.Stylesheet)
return;this._clearStyleSheetsForResource(resource);}
_resourceTypeDidChange(event)
{var resource=event.target;if(resource.type!==WebInspector.Resource.Type.Stylesheet)
return;this._clearStyleSheetsForResource(resource);}
_clearStyleSheetsForResource(resource)
{
this._styleSheetIdentifierMap.delete(this._frameURLMapKey(resource.parentFrame,resource.url));}
_frameURLMapKey(frame,url)
{return frame.id+":"+url;}
_lookupStyleSheetForResource(resource,callback)
{this._lookupStyleSheet(resource.parentFrame,resource.url,callback);}
_lookupStyleSheet(frame,url,callback)
{let key=this._frameURLMapKey(frame,url);function styleSheetsFetched()
{callback(this._styleSheetFrameURLMap.get(key)||null);}
let styleSheet=this._styleSheetFrameURLMap.get(key)||null;if(styleSheet)
callback(styleSheet);else
this._fetchInfoForAllStyleSheets(styleSheetsFetched.bind(this));}
_fetchInfoForAllStyleSheets(callback)
{function processStyleSheets(error,styleSheets)
{this._styleSheetFrameURLMap.clear();if(error){callback();return;}
for(let styleSheetInfo of styleSheets){let parentFrame=WebInspector.frameResourceManager.frameForIdentifier(styleSheetInfo.frameId);let origin=WebInspector.CSSStyleManager.protocolStyleSheetOriginToEnum(styleSheetInfo.origin);let isInline=styleSheetInfo.isInline||false;let startLine=styleSheetInfo.startLine||0;let startColumn=styleSheetInfo.startColumn||0;let styleSheet=this.styleSheetForIdentifier(styleSheetInfo.styleSheetId);styleSheet.updateInfo(styleSheetInfo.sourceURL,parentFrame,origin,isInline,startLine,startColumn);let key=this._frameURLMapKey(parentFrame,styleSheetInfo.sourceURL);this._styleSheetFrameURLMap.set(key,styleSheet);}
callback();}
CSSAgent.getAllStyleSheets(processStyleSheets.bind(this));}
_resourceContentDidChange(event)
{var resource=event.target;if(resource===this._ignoreResourceContentDidChangeEventForResource)
return;if(resource.type!==WebInspector.Resource.Type.Stylesheet||resource.syntheticMIMEType!=="text/css")
return;function applyStyleSheetChanges()
{function styleSheetFound(styleSheet)
{resource.__pendingChangeTimeout=undefined;if(!styleSheet)
return;
resource.__ignoreNextUpdateResourceContent=true;WebInspector.branchManager.currentBranch.revisionForRepresentedObject(styleSheet).content=resource.content;}
this._lookupStyleSheetForResource(resource,styleSheetFound.bind(this));}
if(resource.__pendingChangeTimeout)
clearTimeout(resource.__pendingChangeTimeout);resource.__pendingChangeTimeout=setTimeout(applyStyleSheetChanges.bind(this),500);}
_updateResourceContent(styleSheet)
{function fetchedStyleSheetContent(parameters)
{let representedObject=parameters.sourceCode;representedObject.__pendingChangeTimeout=undefined;if(!representedObject.url)
return;if(!styleSheet.isInspectorStyleSheet()){representedObject=representedObject.parentFrame.resourceForURL(representedObject.url);if(!representedObject)
return;
if(representedObject.type!==WebInspector.Resource.Type.Stylesheet)
return;}
if(representedObject.__ignoreNextUpdateResourceContent){representedObject.__ignoreNextUpdateResourceContent=false;return;}
this._ignoreResourceContentDidChangeEventForResource=representedObject;let revision=WebInspector.branchManager.currentBranch.revisionForRepresentedObject(representedObject);if(styleSheet.isInspectorStyleSheet()){revision.content=representedObject.content;styleSheet.dispatchEventToListeners(WebInspector.SourceCode.Event.ContentDidChange);}else
revision.content=parameters.content;this._ignoreResourceContentDidChangeEventForResource=null;}
function styleSheetReady()
{styleSheet.requestContent().then(fetchedStyleSheetContent.bind(this));}
function applyStyleSheetChanges()
{if(styleSheet.url)
styleSheetReady.call(this);else
this._fetchInfoForAllStyleSheets(styleSheetReady.bind(this));}
if(styleSheet.__pendingChangeTimeout)
clearTimeout(styleSheet.__pendingChangeTimeout);styleSheet.__pendingChangeTimeout=setTimeout(applyStyleSheetChanges.bind(this),500);}};WebInspector.CSSStyleManager.Event={StyleSheetAdded:"css-style-manager-style-sheet-added",StyleSheetRemoved:"css-style-manager-style-sheet-removed",};WebInspector.CSSStyleManager.PseudoElementNames=["before","after"];WebInspector.CSSStyleManager.ForceablePseudoClasses=["active","focus","hover","visited"];WebInspector.CSSStyleManager.PreferredInspectorStyleSheetSymbol=Symbol("css-style-manager-preferred-inspector-stylesheet");WebInspector.CanvasManager=class CanvasManager extends WebInspector.Object
{constructor()
{super();WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange,this._mainResourceDidChange,this);this._canvasIdentifierMap=new Map;if(window.CanvasAgent)
CanvasAgent.enable();}
get canvases()
{return[...this._canvasIdentifierMap.values()];}
canvasAdded(canvasPayload)
{let canvas=WebInspector.Canvas.fromPayload(canvasPayload);this._canvasIdentifierMap.set(canvas.identifier,canvas);canvas.frame.canvasCollection.add(canvas);this.dispatchEventToListeners(WebInspector.CanvasManager.Event.CanvasWasAdded,{canvas});}
canvasRemoved(canvasIdentifier)
{let canvas=this._canvasIdentifierMap.take(canvasIdentifier);if(!canvas)
return;canvas.frame.canvasCollection.remove(canvas);this.dispatchEventToListeners(WebInspector.CanvasManager.Event.CanvasWasRemoved,{canvas});}
canvasMemoryChanged(canvasIdentifier,memoryCost)
{let canvas=this._canvasIdentifierMap.get(canvasIdentifier);if(!canvas)
return;canvas.memoryCost=memoryCost;}
cssCanvasClientNodesChanged(canvasIdentifier)
{let canvas=this._canvasIdentifierMap.get(canvasIdentifier);if(!canvas)
return;canvas.cssCanvasClientNodesChanged();}
_mainResourceDidChange(event)
{if(!event.target.isMainFrame())
return;WebInspector.Canvas.resetUniqueDisplayNameNumbers();if(this._canvasIdentifierMap.size){this._canvasIdentifierMap.clear();this.dispatchEventToListeners(WebInspector.CanvasManager.Event.Cleared);}}};WebInspector.CanvasManager.Event={Cleared:"canvas-manager-cleared",CanvasWasAdded:"canvas-manager-canvas-was-added",CanvasWasRemoved:"canvas-manager-canvas-was-removed",};WebInspector.CodeMirrorColorEditingController=class CodeMirrorColorEditingController extends WebInspector.CodeMirrorEditingController
{ get initialValue()
{return WebInspector.Color.fromString(this.text);}
get cssClassName()
{return"color";}
popoverWillPresent(popover)
{this._colorPicker=new WebInspector.ColorPicker;this._colorPicker.addEventListener(WebInspector.ColorPicker.Event.ColorChanged,this._colorPickerColorChanged,this);this._colorPicker.addEventListener(WebInspector.ColorPicker.Event.FormatChanged,(event)=>popover.update());popover.content=this._colorPicker.element;}
popoverDidPresent(popover)
{this._colorPicker.color=this._value;}
_colorPickerColorChanged(event)
{this.value=event.target.color;}};WebInspector.CodeMirrorCompletionController=class CodeMirrorCompletionController extends WebInspector.Object
{constructor(codeMirror,delegate,stopCharactersRegex)
{super();this._codeMirror=codeMirror;this._stopCharactersRegex=stopCharactersRegex||null;this._delegate=delegate||null;this._startOffset=NaN;this._endOffset=NaN;this._lineNumber=NaN;this._prefix="";this._noEndingSemicolon=false;this._completions=[];this._extendedCompletionProviders={};this._suggestionsView=new WebInspector.CompletionSuggestionsView(this);this._keyMap={"Up":this._handleUpKey.bind(this),"Down":this._handleDownKey.bind(this),"Right":this._handleRightOrEnterKey.bind(this),"Esc":this._handleEscapeKey.bind(this),"Enter":this._handleRightOrEnterKey.bind(this),"Tab":this._handleTabKey.bind(this),"Cmd-A":this._handleHideKey.bind(this),"Cmd-Z":this._handleHideKey.bind(this),"Shift-Cmd-Z":this._handleHideKey.bind(this),"Cmd-Y":this._handleHideKey.bind(this)};this._handleChangeListener=this._handleChange.bind(this);this._handleCursorActivityListener=this._handleCursorActivity.bind(this);this._handleHideActionListener=this._handleHideAction.bind(this);this._codeMirror.addKeyMap(this._keyMap);this._codeMirror.on("change",this._handleChangeListener);this._codeMirror.on("cursorActivity",this._handleCursorActivityListener);this._codeMirror.on("blur",this._handleHideActionListener);this._codeMirror.on("scroll",this._handleHideActionListener);this._updatePromise=null;}
get delegate()
{return this._delegate;}
addExtendedCompletionProvider(modeName,provider)
{this._extendedCompletionProviders[modeName]=provider;}
updateCompletions(completions,implicitSuffix)
{if(isNaN(this._startOffset)||isNaN(this._endOffset)||isNaN(this._lineNumber))
return;if(!completions||!completions.length){this.hideCompletions();return;}
this._completions=completions;if(typeof implicitSuffix==="string")
this._implicitSuffix=implicitSuffix;var from={line:this._lineNumber,ch:this._startOffset};var to={line:this._lineNumber,ch:this._endOffset};var firstCharCoords=this._codeMirror.cursorCoords(from);var lastCharCoords=this._codeMirror.cursorCoords(to);var bounds=new WebInspector.Rect(firstCharCoords.left,firstCharCoords.top,lastCharCoords.right-firstCharCoords.left,firstCharCoords.bottom-firstCharCoords.top);var index=this._currentCompletion?completions.indexOf(this._currentCompletion):0;if(index===-1)
index=0;if(this._forced||completions.length>1||completions[index]!==this._prefix){this._suggestionsView.update(completions,index);this._suggestionsView.show(bounds);}else if(this._implicitSuffix){this._suggestionsView.hide();}else{
this.hideCompletions();return;}
this._applyCompletionHint(completions[index]);this._resolveUpdatePromise(WebInspector.CodeMirrorCompletionController.UpdatePromise.CompletionsFound);}
isCompletionChange(change)
{return this._ignoreChange||change.origin===WebInspector.CodeMirrorCompletionController.CompletionOrigin||change.origin===WebInspector.CodeMirrorCompletionController.DeleteCompletionOrigin;}
isShowingCompletions()
{return this._suggestionsView.visible||(this._completionHintMarker&&this._completionHintMarker.find());}
isHandlingClickEvent()
{return this._suggestionsView.isHandlingClickEvent();}
hideCompletions()
{this._suggestionsView.hide();this._removeCompletionHint();this._startOffset=NaN;this._endOffset=NaN;this._lineNumber=NaN;this._prefix="";this._completions=[];this._implicitSuffix="";this._forced=false;delete this._currentCompletion;delete this._ignoreNextCursorActivity;this._resolveUpdatePromise(WebInspector.CodeMirrorCompletionController.UpdatePromise.NoCompletionsFound);}
close()
{this._codeMirror.removeKeyMap(this._keyMap);this._codeMirror.off("change",this._handleChangeListener);this._codeMirror.off("cursorActivity",this._handleCursorActivityListener);this._codeMirror.off("blur",this._handleHideActionListener);this._codeMirror.off("scroll",this._handleHideActionListener);}
completeAtCurrentPositionIfNeeded(force)
{this._resolveUpdatePromise(WebInspector.CodeMirrorCompletionController.UpdatePromise.Canceled);var update=this._updatePromise=new WebInspector.WrappedPromise;this._completeAtCurrentPosition(force);return update.promise;}
completionSuggestionsSelectedCompletion(suggestionsView,completionText)
{this._applyCompletionHint(completionText);}
completionSuggestionsClickedCompletion(suggestionsView,completionText)
{this._codeMirror.focus();this._applyCompletionHint(completionText);this._commitCompletionHint();}
set noEndingSemicolon(noEndingSemicolon)
{this._noEndingSemicolon=noEndingSemicolon;}
_resolveUpdatePromise(message)
{if(!this._updatePromise)
return;this._updatePromise.resolve(message);this._updatePromise=null;}
get _currentReplacementText()
{return this._currentCompletion+this._implicitSuffix;}
_hasPendingCompletion()
{return!isNaN(this._startOffset)&&!isNaN(this._endOffset)&&!isNaN(this._lineNumber);}
_notifyCompletionsHiddenSoon()
{function notify()
{if(this._completionHintMarker)
return;if(this._delegate&&typeof this._delegate.completionControllerCompletionsHidden==="function")
this._delegate.completionControllerCompletionsHidden(this);}
if(this._notifyCompletionsHiddenIfNeededTimeout)
clearTimeout(this._notifyCompletionsHiddenIfNeededTimeout);this._notifyCompletionsHiddenIfNeededTimeout=setTimeout(notify.bind(this),WebInspector.CodeMirrorCompletionController.CompletionsHiddenDelay);}
_createCompletionHintMarker(position,text)
{var container=document.createElement("span");container.classList.add(WebInspector.CodeMirrorCompletionController.CompletionHintStyleClassName);container.textContent=text;this._completionHintMarker=this._codeMirror.setUniqueBookmark(position,{widget:container,insertLeft:true});}
_applyCompletionHint(completionText)
{if(!completionText)
return;function update()
{this._currentCompletion=completionText;this._removeCompletionHint(true,true);var replacementText=this._currentReplacementText;var from={line:this._lineNumber,ch:this._startOffset};var cursor={line:this._lineNumber,ch:this._endOffset};var currentText=this._codeMirror.getRange(from,cursor);this._createCompletionHintMarker(cursor,replacementText.replace(currentText,""));}
this._ignoreChange=true;this._ignoreNextCursorActivity=true;this._codeMirror.operation(update.bind(this));delete this._ignoreChange;}
_commitCompletionHint()
{function update()
{this._removeCompletionHint(true,true);var replacementText=this._currentReplacementText;var from={line:this._lineNumber,ch:this._startOffset};var cursor={line:this._lineNumber,ch:this._endOffset};var to={line:this._lineNumber,ch:this._startOffset+replacementText.length};var lastChar=this._currentCompletion.charAt(this._currentCompletion.length-1);var isClosing=")]}".indexOf(lastChar);if(isClosing!==-1)
to.ch-=1+this._implicitSuffix.length;this._codeMirror.replaceRange(replacementText,from,cursor,WebInspector.CodeMirrorCompletionController.CompletionOrigin);this._codeMirror.setCursor(to);this.hideCompletions();}
this._ignoreChange=true;this._ignoreNextCursorActivity=true;this._codeMirror.operation(update.bind(this));delete this._ignoreChange;}
_removeLastChangeFromHistory()
{var history=this._codeMirror.getHistory();history.undone=[];history.done.pop();this._codeMirror.setHistory(history);}
_removeCompletionHint(nonatomic,dontRestorePrefix)
{if(!this._completionHintMarker)
return;this._notifyCompletionsHiddenSoon();function clearMarker(marker)
{if(!marker)
return;var range=marker.find();if(range)
marker.clear();return null;}
function update()
{this._completionHintMarker=clearMarker(this._completionHintMarker);if(dontRestorePrefix)
return;var from={line:this._lineNumber,ch:this._startOffset};var to={line:this._lineNumber,ch:this._endOffset};this._codeMirror.replaceRange(this._prefix,from,to,WebInspector.CodeMirrorCompletionController.DeleteCompletionOrigin);this._removeLastChangeFromHistory();}
if(nonatomic){update.call(this);return;}
this._ignoreChange=true;this._codeMirror.operation(update.bind(this));delete this._ignoreChange;}
_scanStringForExpression(modeName,string,startOffset,direction,allowMiddleAndEmpty,includeStopCharacter,ignoreInitialUnmatchedOpenBracket,stopCharactersRegex)
{var stopCharactersRegex=stopCharactersRegex||this._stopCharactersRegex||WebInspector.CodeMirrorCompletionController.DefaultStopCharactersRegexModeMap[modeName]||WebInspector.CodeMirrorCompletionController.GenericStopCharactersRegex;function isStopCharacter(character)
{return stopCharactersRegex.test(character);}
function isOpenBracketCharacter(character)
{return WebInspector.CodeMirrorCompletionController.OpenBracketCharactersRegex.test(character);}
function isCloseBracketCharacter(character)
{return WebInspector.CodeMirrorCompletionController.CloseBracketCharactersRegex.test(character);}
function matchingBracketCharacter(character)
{return WebInspector.CodeMirrorCompletionController.MatchingBrackets[character];}
var endOffset=Math.min(startOffset,string.length);var endOfLineOrWord=endOffset===string.length||isStopCharacter(string.charAt(endOffset));if(!endOfLineOrWord&&!allowMiddleAndEmpty)
return null;var bracketStack=[];var bracketOffsetStack=[];var startOffset=endOffset;var firstOffset=endOffset+direction;for(var i=firstOffset;direction>0?i<string.length:i>=0;i+=direction){var character=string.charAt(i);if(isStopCharacter(character)&&!bracketStack.length)
break;if(isCloseBracketCharacter(character)){bracketStack.push(character);bracketOffsetStack.push(i);}else if(isOpenBracketCharacter(character)){if((!ignoreInitialUnmatchedOpenBracket||i!==firstOffset)&&(!bracketStack.length||matchingBracketCharacter(character)!==bracketStack.lastValue))
break;bracketOffsetStack.pop();bracketStack.pop();}
startOffset=i+(direction>0?1:0);}
if(bracketOffsetStack.length)
startOffset=bracketOffsetStack.pop()+1;if(includeStopCharacter&&startOffset>0&&startOffset<string.length)
startOffset+=direction;if(direction>0){var tempEndOffset=endOffset;endOffset=startOffset;startOffset=tempEndOffset;}
return{string:string.substring(startOffset,endOffset),startOffset,endOffset};}
_completeAtCurrentPosition(force)
{if(this._codeMirror.somethingSelected()){this.hideCompletions();return;}
this._removeCompletionHint(true,true);var cursor=this._codeMirror.getCursor();var token=this._codeMirror.getTokenAt(cursor);if(token.type&&/\bcomment\b/.test(token.type)){this.hideCompletions();return;}
var mode=this._codeMirror.getMode();var innerMode=CodeMirror.innerMode(mode,token.state).mode;var modeName=innerMode.alternateName||innerMode.name;var lineNumber=cursor.line;var lineString=this._codeMirror.getLine(lineNumber);var backwardScanResult=this._scanStringForExpression(modeName,lineString,cursor.ch,-1,force);if(!backwardScanResult){this.hideCompletions();return;}
var forwardScanResult=this._scanStringForExpression(modeName,lineString,cursor.ch,1,true,true);var suffix=forwardScanResult.string;this._ignoreNextCursorActivity=true;this._startOffset=backwardScanResult.startOffset;this._endOffset=backwardScanResult.endOffset;this._lineNumber=lineNumber;this._prefix=backwardScanResult.string;this._completions=[];this._implicitSuffix="";this._forced=force;var baseExpressionStopCharactersRegex=WebInspector.CodeMirrorCompletionController.BaseExpressionStopCharactersRegexModeMap[modeName];if(baseExpressionStopCharactersRegex)
var baseScanResult=this._scanStringForExpression(modeName,lineString,this._startOffset,-1,true,false,true,baseExpressionStopCharactersRegex);if(!force&&!backwardScanResult.string&&(!baseScanResult||!baseScanResult.string)){this.hideCompletions();return;}
var defaultCompletions=[];switch(modeName){case"css":defaultCompletions=this._generateCSSCompletions(token,baseScanResult?baseScanResult.string:null,suffix);break;case"javascript":defaultCompletions=this._generateJavaScriptCompletions(token,baseScanResult?baseScanResult.string:null,suffix);break;}
var extendedCompletionsProvider=this._extendedCompletionProviders[modeName];if(extendedCompletionsProvider){extendedCompletionsProvider.completionControllerCompletionsNeeded(this,defaultCompletions,baseScanResult?baseScanResult.string:null,this._prefix,suffix,force);return;}
if(this._delegate&&typeof this._delegate.completionControllerCompletionsNeeded==="function")
this._delegate.completionControllerCompletionsNeeded(this,this._prefix,defaultCompletions,baseScanResult?baseScanResult.string:null,suffix,force);else
this.updateCompletions(defaultCompletions);}
_generateCSSCompletions(mainToken,base,suffix)
{if(mainToken.state.state==="media"||mainToken.state.state==="top"||mainToken.state.state==="parens")
return[];if(/^[a-z]/i.test(suffix))
return[];var token=mainToken;var lineNumber=this._lineNumber;while(token.state.state==="prop"){if(!token.start){--lineNumber;if(lineNumber<0)
break;}
token=this._codeMirror.getTokenAt({line:lineNumber,ch:token.start?token.start:Number.MAX_VALUE});}
if(mainToken!==token&&token.type&&/\bproperty\b/.test(token.type)){var propertyName=token.string;
this._implicitSuffix=" ";if(suffix===";")
this._implicitSuffix=this._noEndingSemicolon?"":";";else if(suffix.startsWith("("))
this._implicitSuffix="";if(this._implicitSuffix===suffix)
this._implicitSuffix="";let completions=WebInspector.CSSKeywordCompletions.forProperty(propertyName).startsWith(this._prefix);if(suffix.startsWith("("))
completions=completions.map((x)=>x.replace(/\(\)$/,""));return completions;}
this._implicitSuffix=suffix!==":"?": ":"";return WebInspector.CSSCompletions.cssNameCompletions.startsWith(this._prefix);}
_generateJavaScriptCompletions(mainToken,base,suffix)
{
if(base&&!/[({[]$/.test(base))
return[];var matchingWords=[];var prefix=this._prefix;var localState=mainToken.state.localState?mainToken.state.localState:mainToken.state;var declaringVariable=localState.lexical.type==="vardef";var insideSwitch=localState.lexical.prev?localState.lexical.prev.info==="switch":false;var insideBlock=localState.lexical.prev?localState.lexical.prev.type==="}":false;var insideParenthesis=localState.lexical.type===")";var insideBrackets=localState.lexical.type==="]";var allKeywords=["break","case","catch","class","const","continue","debugger","default","delete","do","else","extends","false","finally","for","function","if","in","Infinity","instanceof","let","NaN","new","null","of","return","static","super","switch","this","throw","true","try","typeof","undefined","var","void","while","with","yield"];var valueKeywords=["false","Infinity","NaN","null","this","true","undefined"];var allowedKeywordsInsideBlocks=allKeywords.keySet();var allowedKeywordsWhenDeclaringVariable=valueKeywords.keySet();var allowedKeywordsInsideParenthesis=valueKeywords.concat(["class","function"]).keySet();var allowedKeywordsInsideBrackets=allowedKeywordsInsideParenthesis;var allowedKeywordsOnlyInsideSwitch=["case","default"].keySet();function matchKeywords(keywords)
{matchingWords=matchingWords.concat(keywords.filter(function(word){if(!insideSwitch&&word in allowedKeywordsOnlyInsideSwitch)
return false;if(insideBlock&&!(word in allowedKeywordsInsideBlocks))
return false;if(insideBrackets&&!(word in allowedKeywordsInsideBrackets))
return false;if(insideParenthesis&&!(word in allowedKeywordsInsideParenthesis))
return false;if(declaringVariable&&!(word in allowedKeywordsWhenDeclaringVariable))
return false;return word.startsWith(prefix);}));}
function matchVariables()
{function filterVariables(variables)
{for(var variable=variables;variable;variable=variable.next){if(declaringVariable&&variable.name===prefix)
continue;if(variable.name.startsWith(prefix)&&!matchingWords.includes(variable.name))
matchingWords.push(variable.name);}}
var context=localState.context;while(context){if(context.vars)
filterVariables(context.vars);context=context.prev;}
if(localState.localVars)
filterVariables(localState.localVars);if(localState.globalVars)
filterVariables(localState.globalVars);}
switch(suffix.substring(0,1)){case"":case" ":matchVariables();matchKeywords(allKeywords);break;case".":case"[":matchVariables();matchKeywords(["false","Infinity","NaN","this","true"]);break;case"(":matchVariables();matchKeywords(["catch","else","for","function","if","return","switch","throw","while","with","yield"]);break;case"{":matchKeywords(["do","else","finally","return","try","yield"]);break;case":":if(insideSwitch)
matchKeywords(["case","default"]);break;case";":matchVariables();matchKeywords(valueKeywords);matchKeywords(["break","continue","debugger","return","void"]);break;}
return matchingWords;}
_handleUpKey(codeMirror)
{if(!this._hasPendingCompletion())
return CodeMirror.Pass;if(!this.isShowingCompletions())
return;this._suggestionsView.selectPrevious();}
_handleDownKey(codeMirror)
{if(!this._hasPendingCompletion())
return CodeMirror.Pass;if(!this.isShowingCompletions())
return;this._suggestionsView.selectNext();}
_handleRightOrEnterKey(codeMirror)
{if(!this._hasPendingCompletion())
return CodeMirror.Pass;if(!this.isShowingCompletions())
return;this._commitCompletionHint();}
_handleEscapeKey(codeMirror)
{var delegateImplementsShouldAllowEscapeCompletion=this._delegate&&typeof this._delegate.completionControllerShouldAllowEscapeCompletion==="function";if(this._hasPendingCompletion())
this.hideCompletions();else if(this._codeMirror.getOption("readOnly"))
return CodeMirror.Pass;else if(!delegateImplementsShouldAllowEscapeCompletion||this._delegate.completionControllerShouldAllowEscapeCompletion(this))
this._completeAtCurrentPosition(true);else
return CodeMirror.Pass;}
_handleTabKey(codeMirror)
{if(!this._hasPendingCompletion())
return CodeMirror.Pass;if(!this.isShowingCompletions())
return;if(!this._completions.length)
return;if(!this._currentCompletion)
return;if(this._completions.length===1){this._commitCompletionHint();return;}
var prefixLength=this._prefix.length;var commonPrefix=this._completions[0];for(var i=1;i<this._completions.length;++i){var completion=this._completions[i];var lastIndex=Math.min(commonPrefix.length,completion.length);for(var j=prefixLength;j<lastIndex;++j){if(commonPrefix[j]!==completion[j]){commonPrefix=commonPrefix.substr(0,j);break;}}}
if(commonPrefix===this._prefix){this._commitCompletionHint();return;}
this._prefix=commonPrefix;this._endOffset=this._startOffset+commonPrefix.length;this._applyCompletionHint(this._currentCompletion);}
_handleChange(codeMirror,change)
{if(this.isCompletionChange(change))
return;this._ignoreNextCursorActivity=true;if(!change.origin||change.origin.charAt(0)!=="+"){this.hideCompletions();return;}
if(change.origin==="+delete"&&!this._hasPendingCompletion())
return;this._completeAtCurrentPosition(false);}
_handleCursorActivity(codeMirror)
{if(this._ignoreChange)
return;if(this._ignoreNextCursorActivity){delete this._ignoreNextCursorActivity;return;}
this.hideCompletions();}
_handleHideKey(codeMirror)
{this.hideCompletions();return CodeMirror.Pass;}
_handleHideAction(codeMirror)
{if(this.isHandlingClickEvent())
return;this.hideCompletions();}};WebInspector.CodeMirrorCompletionController.UpdatePromise={Canceled:"code-mirror-completion-controller-canceled",CompletionsFound:"code-mirror-completion-controller-completions-found",NoCompletionsFound:"code-mirror-completion-controller-no-completions-found"};WebInspector.CodeMirrorCompletionController.GenericStopCharactersRegex=/[\s=:;,]/;WebInspector.CodeMirrorCompletionController.DefaultStopCharactersRegexModeMap={"css":/[\s:;,{}()]/,"javascript":/[\s=:;,!+\-*/%&|^~?<>.{}()[\]]/};WebInspector.CodeMirrorCompletionController.BaseExpressionStopCharactersRegexModeMap={"javascript":/[\s=:;,!+\-*/%&|^~?<>]/};WebInspector.CodeMirrorCompletionController.OpenBracketCharactersRegex=/[({[]/;WebInspector.CodeMirrorCompletionController.CloseBracketCharactersRegex=/[)}\]]/;WebInspector.CodeMirrorCompletionController.MatchingBrackets={"{":"}","(":")","[":"]","}":"{",")":"(","]":"["};WebInspector.CodeMirrorCompletionController.CompletionHintStyleClassName="completion-hint";WebInspector.CodeMirrorCompletionController.CompletionsHiddenDelay=250;WebInspector.CodeMirrorCompletionController.CompletionTypingDelay=250;WebInspector.CodeMirrorCompletionController.CompletionOrigin="+completion";WebInspector.CodeMirrorCompletionController.DeleteCompletionOrigin="+delete-completion";WebInspector.CodeMirrorBezierEditingController=class CodeMirrorBezierEditingController extends WebInspector.CodeMirrorEditingController
{ get initialValue()
{return WebInspector.CubicBezier.fromString(this.text);}
get cssClassName()
{return"cubic-bezier";}
popoverWillPresent(popover)
{this._bezierEditor=new WebInspector.BezierEditor;this._bezierEditor.addEventListener(WebInspector.BezierEditor.Event.BezierChanged,this._bezierEditorBezierChanged,this);popover.content=this._bezierEditor.element;}
popoverDidPresent(popover)
{this._bezierEditor.bezier=this.value;}
popoverDidDismiss(popover)
{this._bezierEditor.removeListeners();}
_bezierEditorBezierChanged(event)
{this.value=event.data.bezier;}};WebInspector.CodeMirrorDragToAdjustNumberController=class CodeMirrorDragToAdjustNumberController extends WebInspector.Object
{constructor(codeMirror)
{super();this._codeMirror=codeMirror;this._dragToAdjustController=new WebInspector.DragToAdjustController(this);}
get enabled()
{return this._dragToAdjustController.enabled;}
set enabled(enabled)
{if(this.enabled===enabled)
return;this._dragToAdjustController.element=this._codeMirror.getWrapperElement();this._dragToAdjustController.enabled=enabled;}
dragToAdjustControllerActiveStateChanged(dragToAdjustController)
{if(!dragToAdjustController.active)
this._hoveredTokenInfo=null;}
dragToAdjustControllerCanBeActivated(dragToAdjustController)
{return!this._codeMirror.getOption("readOnly");}
dragToAdjustControllerCanBeAdjusted(dragToAdjustController)
{return this._hoveredTokenInfo&&this._hoveredTokenInfo.containsNumber;}
dragToAdjustControllerWasAdjustedByAmount(dragToAdjustController,amount)
{this._codeMirror.alterNumberInRange(amount,this._hoveredTokenInfo.startPosition,this._hoveredTokenInfo.endPosition,false);}
dragToAdjustControllerDidReset(dragToAdjustController)
{this._hoveredTokenInfo=null;}
dragToAdjustControllerCanAdjustObjectAtPoint(dragToAdjustController,point)
{var position=this._codeMirror.coordsChar({left:point.x,top:point.y});var token=this._codeMirror.getTokenAt(position);if(!token||!token.type||!token.string){if(this._hoveredTokenInfo)
dragToAdjustController.reset();return false;}
if(this._hoveredTokenInfo&&this._hoveredTokenInfo.line===position.line&&this._hoveredTokenInfo.token.start===token.start&&this._hoveredTokenInfo.token.end===token.end)
return this._hoveredTokenInfo.token.type.indexOf("number")!==-1;var containsNumber=token.type.indexOf("number")!==-1;this._hoveredTokenInfo={token,line:position.line,containsNumber,startPosition:{ch:token.start,line:position.line},endPosition:{ch:token.end,line:position.line}};return containsNumber;}};CodeMirror.defineOption("dragToAdjustNumbers",true,function(codeMirror,value,oldValue){if(!codeMirror.dragToAdjustNumberController)
codeMirror.dragToAdjustNumberController=new WebInspector.CodeMirrorDragToAdjustNumberController(codeMirror);codeMirror.dragToAdjustNumberController.enabled=value;});WebInspector.CodeMirrorGradientEditingController=class CodeMirrorGradientEditingController extends WebInspector.CodeMirrorEditingController
{ get initialValue()
{return WebInspector.Gradient.fromString(this.text);}
get cssClassName()
{return"gradient";}
get popoverPreferredEdges()
{
return[WebInspector.RectEdge.MIN_X,WebInspector.RectEdge.MAX_Y,WebInspector.RectEdge.MAX_X];}
popoverTargetFrameWithRects(rects)
{
return rects[0];}
popoverWillPresent(popover)
{function handleColorPickerToggled(event)
{popover.update();}
this._gradientEditor=new WebInspector.GradientEditor;this._gradientEditor.addEventListener(WebInspector.GradientEditor.Event.GradientChanged,this._gradientEditorGradientChanged,this);this._gradientEditor.addEventListener(WebInspector.GradientEditor.Event.ColorPickerToggled,handleColorPickerToggled,this);popover.content=this._gradientEditor.element;}
popoverDidPresent(popover)
{this._gradientEditor.gradient=this.value;}
_gradientEditorGradientChanged(event)
{this.value=event.data.gradient;}};WebInspector.CodeMirrorSpringEditingController=class CodeMirrorSpringEditingController extends WebInspector.CodeMirrorEditingController
{ get initialValue()
{return WebInspector.Spring.fromString(this.text);}
get cssClassName()
{return"spring";}
popoverWillPresent(popover)
{this._springEditor=new WebInspector.SpringEditor;this._springEditor.addEventListener(WebInspector.SpringEditor.Event.SpringChanged,this._springEditorSpringChanged,this);popover.content=this._springEditor.element;}
popoverDidPresent(popover)
{this._springEditor.spring=this.value;}
popoverDidDismiss(popover)
{this._springEditor.removeListeners();}
_springEditorSpringChanged(event)
{this.value=event.data.spring;}};WebInspector.CodeMirrorTokenTrackingController=class CodeMirrorTokenTrackingController extends WebInspector.Object
{constructor(codeMirror,delegate)
{super();this._codeMirror=codeMirror;this._delegate=delegate||null;this._mode=WebInspector.CodeMirrorTokenTrackingController.Mode.None;this._mouseOverDelayDuration=0;this._mouseOutReleaseDelayDuration=0;this._classNameForHighlightedRange=null;this._enabled=false;this._tracking=false;this._previousTokenInfo=null;this._hoveredMarker=null;const hidePopover=this._hidePopover.bind(this);this._codeMirror.addKeyMap({"Cmd-Enter":this._handleCommandEnterKey.bind(this),"Esc":hidePopover});this._codeMirror.on("cursorActivity",hidePopover);}
get delegate()
{return this._delegate;}
set delegate(x)
{this._delegate=x;}
get enabled()
{return this._enabled;}
set enabled(enabled)
{if(this._enabled===enabled)
return;this._enabled=enabled;var wrapper=this._codeMirror.getWrapperElement();if(enabled){wrapper.addEventListener("mouseenter",this);wrapper.addEventListener("mouseleave",this);this._updateHoveredTokenInfo({left:WebInspector.mouseCoords.x,top:WebInspector.mouseCoords.y});this._startTracking();}else{wrapper.removeEventListener("mouseenter",this);wrapper.removeEventListener("mouseleave",this);this._stopTracking();}}
get mode()
{return this._mode;}
set mode(mode)
{var oldMode=this._mode;this._mode=mode||WebInspector.CodeMirrorTokenTrackingController.Mode.None;if(oldMode!==this._mode&&this._tracking&&this._previousTokenInfo)
this._processNewHoveredToken(this._previousTokenInfo);}
get mouseOverDelayDuration()
{return this._mouseOverDelayDuration;}
set mouseOverDelayDuration(x)
{this._mouseOverDelayDuration=Math.max(x,0);}
get mouseOutReleaseDelayDuration()
{return this._mouseOutReleaseDelayDuration;}
set mouseOutReleaseDelayDuration(x)
{this._mouseOutReleaseDelayDuration=Math.max(x,0);}
get classNameForHighlightedRange()
{return this._classNameForHighlightedRange;}
set classNameForHighlightedRange(x)
{this._classNameForHighlightedRange=x||null;}
get candidate()
{return this._candidate;}
get hoveredMarker()
{return this._hoveredMarker;}
set hoveredMarker(hoveredMarker)
{this._hoveredMarker=hoveredMarker;}
highlightLastHoveredRange()
{if(this._candidate)
this.highlightRange(this._candidate.hoveredTokenRange);}
highlightRange(range)
{if(this._codeMirrorMarkedText&&this._codeMirrorMarkedText.className===this._classNameForHighlightedRange){var highlightedRange=this._codeMirrorMarkedText.find();if(!highlightedRange)
return;if(WebInspector.compareCodeMirrorPositions(highlightedRange.from,range.start)===0&&WebInspector.compareCodeMirrorPositions(highlightedRange.to,range.end)===0)
return;}
this.removeHighlightedRange();var className=this._classNameForHighlightedRange||"";this._codeMirrorMarkedText=this._codeMirror.markText(range.start,range.end,{className});window.addEventListener("mousemove",this,true);}
removeHighlightedRange()
{if(!this._codeMirrorMarkedText)
return;this._codeMirrorMarkedText.clear();this._codeMirrorMarkedText=null;window.removeEventListener("mousemove",this,true);}
_startTracking()
{if(this._tracking)
return;this._tracking=true;var wrapper=this._codeMirror.getWrapperElement();wrapper.addEventListener("mousemove",this,true);wrapper.addEventListener("mouseout",this,false);wrapper.addEventListener("mousedown",this,false);wrapper.addEventListener("mouseup",this,false);window.addEventListener("blur",this,true);}
_stopTracking()
{if(!this._tracking)
return;this._tracking=false;this._candidate=null;var wrapper=this._codeMirror.getWrapperElement();wrapper.removeEventListener("mousemove",this,true);wrapper.removeEventListener("mouseout",this,false);wrapper.removeEventListener("mousedown",this,false);wrapper.removeEventListener("mouseup",this,false);window.removeEventListener("blur",this,true);window.removeEventListener("mousemove",this,true);this._resetTrackingStates();}
handleEvent(event)
{switch(event.type){case"mouseenter":this._mouseEntered(event);break;case"mouseleave":this._mouseLeft(event);break;case"mousemove":if(event.currentTarget===window)
this._mouseMovedWithMarkedText(event);else
this._mouseMovedOverEditor(event);break;case"mouseout":if(!event.currentTarget.contains(event.relatedTarget))
this._mouseMovedOutOfEditor(event);break;case"mousedown":this._mouseButtonWasPressedOverEditor(event);break;case"mouseup":this._mouseButtonWasReleasedOverEditor(event);break;case"blur":this._windowLostFocus(event);break;}}
_handleCommandEnterKey(codeMirror)
{const tokenInfo=this._getTokenInfoForPosition(codeMirror.getCursor("head"));tokenInfo.triggeredBy=WebInspector.CodeMirrorTokenTrackingController.TriggeredBy.Keyboard;this._processNewHoveredToken(tokenInfo);}
_hidePopover()
{if(!this._candidate)
return CodeMirror.Pass;if(this._delegate&&typeof this._delegate.tokenTrackingControllerHighlightedRangeReleased==="function"){const forceHidePopover=true;this._delegate.tokenTrackingControllerHighlightedRangeReleased(this,forceHidePopover);}}
_mouseEntered(event)
{if(!this._tracking)
this._startTracking();}
_mouseLeft(event)
{this._stopTracking();}
_mouseMovedWithMarkedText(event)
{if(this._candidate&&this._candidate.triggeredBy===WebInspector.CodeMirrorTokenTrackingController.TriggeredBy.Keyboard)
return;var shouldRelease=!event.target.classList.contains(this._classNameForHighlightedRange);if(shouldRelease&&this._delegate&&typeof this._delegate.tokenTrackingControllerCanReleaseHighlightedRange==="function")
shouldRelease=this._delegate.tokenTrackingControllerCanReleaseHighlightedRange(this,event.target);if(shouldRelease){if(!this._markedTextMouseoutTimer)
this._markedTextMouseoutTimer=setTimeout(this._markedTextIsNoLongerHovered.bind(this),this._mouseOutReleaseDelayDuration);return;}
if(this._markedTextMouseoutTimer)
clearTimeout(this._markedTextMouseoutTimer);this._markedTextMouseoutTimer=0;}
_markedTextIsNoLongerHovered()
{if(this._delegate&&typeof this._delegate.tokenTrackingControllerHighlightedRangeReleased==="function")
this._delegate.tokenTrackingControllerHighlightedRangeReleased(this);this._markedTextMouseoutTimer=0;}
_mouseMovedOverEditor(event)
{this._updateHoveredTokenInfo({left:event.pageX,top:event.pageY});}
_updateHoveredTokenInfo(mouseCoords)
{var position=this._codeMirror.coordsChar(mouseCoords);var token=this._codeMirror.getTokenAt(position);if(!token||!token.type||!token.string){if(this._hoveredMarker&&this._delegate&&typeof this._delegate.tokenTrackingControllerMouseOutOfHoveredMarker==="function"){if(!this._codeMirror.findMarksAt(position).includes(this._hoveredMarker.codeMirrorTextMarker))
this._delegate.tokenTrackingControllerMouseOutOfHoveredMarker(this,this._hoveredMarker);}
this._resetTrackingStates();return;}
if(this._previousTokenInfo&&this._previousTokenInfo.position.line===position.line&&this._previousTokenInfo.token.start===token.start&&this._previousTokenInfo.token.end===token.end)
return;var tokenInfo=this._previousTokenInfo=this._getTokenInfoForPosition(position);if(/\bmeta\b/.test(token.type)){let nextTokenPosition=Object.shallowCopy(position);nextTokenPosition.ch=tokenInfo.token.end+1;let nextToken=this._codeMirror.getTokenAt(nextTokenPosition);if(nextToken&&nextToken.type&&!/\bmeta\b/.test(nextToken.type)){tokenInfo.token.type=nextToken.type;tokenInfo.token.string=tokenInfo.token.string+nextToken.string;tokenInfo.token.end=nextToken.end;}}else{let previousTokenPosition=Object.shallowCopy(position);previousTokenPosition.ch=tokenInfo.token.start-1;let previousToken=this._codeMirror.getTokenAt(previousTokenPosition);if(previousToken&&previousToken.type&&/\bmeta\b/.test(previousToken.type)){tokenInfo.token.string=previousToken.string+tokenInfo.token.string;tokenInfo.token.start=previousToken.start;}}
if(this._tokenHoverTimer)
clearTimeout(this._tokenHoverTimer);this._tokenHoverTimer=0;if(this._codeMirrorMarkedText||!this._mouseOverDelayDuration)
this._processNewHoveredToken(tokenInfo);else
this._tokenHoverTimer=setTimeout(this._processNewHoveredToken.bind(this,tokenInfo),this._mouseOverDelayDuration);}
_getTokenInfoForPosition(position)
{var token=this._codeMirror.getTokenAt(position);var innerMode=CodeMirror.innerMode(this._codeMirror.getMode(),token.state);var codeMirrorModeName=innerMode.mode.alternateName||innerMode.mode.name;return{token,position,innerMode,modeName:codeMirrorModeName};}
_mouseMovedOutOfEditor(event)
{if(this._tokenHoverTimer)
clearTimeout(this._tokenHoverTimer);this._tokenHoverTimer=0;this._previousTokenInfo=null;this._selectionMayBeInProgress=false;}
_mouseButtonWasPressedOverEditor(event)
{this._selectionMayBeInProgress=true;}
_mouseButtonWasReleasedOverEditor(event)
{this._selectionMayBeInProgress=false;this._mouseMovedOverEditor(event);if(this._codeMirrorMarkedText&&this._previousTokenInfo){var position=this._codeMirror.coordsChar({left:event.pageX,top:event.pageY});var marks=this._codeMirror.findMarksAt(position);for(var i=0;i<marks.length;++i){if(marks[i]===this._codeMirrorMarkedText){if(this._delegate&&typeof this._delegate.tokenTrackingControllerHighlightedRangeWasClicked==="function")
this._delegate.tokenTrackingControllerHighlightedRangeWasClicked(this);break;}}}}
_windowLostFocus(event)
{this._resetTrackingStates();}
_processNewHoveredToken(tokenInfo)
{if(this._selectionMayBeInProgress)
return;this._candidate=null;switch(this._mode){case WebInspector.CodeMirrorTokenTrackingController.Mode.NonSymbolTokens:this._candidate=this._processNonSymbolToken(tokenInfo);break;case WebInspector.CodeMirrorTokenTrackingController.Mode.JavaScriptExpression:case WebInspector.CodeMirrorTokenTrackingController.Mode.JavaScriptTypeInformation:this._candidate=this._processJavaScriptExpression(tokenInfo);break;case WebInspector.CodeMirrorTokenTrackingController.Mode.MarkedTokens:this._candidate=this._processMarkedToken(tokenInfo);break;}
if(!this._candidate)
return;this._candidate.triggeredBy=tokenInfo.triggeredBy;if(this._markedTextMouseoutTimer)
clearTimeout(this._markedTextMouseoutTimer);this._markedTextMouseoutTimer=0;if(this._delegate&&typeof this._delegate.tokenTrackingControllerNewHighlightCandidate==="function")
this._delegate.tokenTrackingControllerNewHighlightCandidate(this,this._candidate);}
_processNonSymbolToken(tokenInfo)
{var type=tokenInfo.token.type;if(!type)
return null;var startPosition={line:tokenInfo.position.line,ch:tokenInfo.token.start};var endPosition={line:tokenInfo.position.line,ch:tokenInfo.token.end};return{hoveredToken:tokenInfo.token,hoveredTokenRange:{start:startPosition,end:endPosition},};}
_processJavaScriptExpression(tokenInfo)
{if(tokenInfo.modeName!=="javascript")
return null;var startPosition={line:tokenInfo.position.line,ch:tokenInfo.token.start};var endPosition={line:tokenInfo.position.line,ch:tokenInfo.token.end};function tokenIsInRange(token,range)
{return token.line>=range.start.line&&token.ch>=range.start.ch&&token.line<=range.end.line&&token.ch<=range.end.ch;}
if(this._codeMirror.somethingSelected()){var selectionRange={start:this._codeMirror.getCursor("start"),end:this._codeMirror.getCursor("end")};if(tokenIsInRange(startPosition,selectionRange)||tokenIsInRange(endPosition,selectionRange)){return{hoveredToken:tokenInfo.token,hoveredTokenRange:selectionRange,expression:this._codeMirror.getSelection(),expressionRange:selectionRange,};}}
var type=tokenInfo.token.type;var isProperty=type.indexOf("property")!==-1;var isKeyword=type.indexOf("keyword")!==-1;if(!isProperty&&!isKeyword&&type.indexOf("variable")===-1&&type.indexOf("def")===-1)
return null;let state=tokenInfo.innerMode.state;if(isProperty&&state.lexical&&state.lexical.type==="}"){let shorthand=false;let mode=tokenInfo.innerMode.mode;let position={line:tokenInfo.position.line,ch:tokenInfo.token.end};WebInspector.walkTokens(this._codeMirror,mode,position,function(tokenType,string){if(tokenType)
return false;if(string==="(")
return false;if(string===","||string==="}"){shorthand=true;return false;}
return true;});if(!shorthand)
return null;}
if(isKeyword&&tokenInfo.token.string!=="this")
return null;var expression=tokenInfo.token.string;var expressionStartPosition={line:tokenInfo.position.line,ch:tokenInfo.token.start};while(true){var token=this._codeMirror.getTokenAt(expressionStartPosition);if(!token)
break;var isDot=!token.type&&token.string===".";var isExpression=token.type&&token.type.includes("m-javascript");if(!isDot&&!isExpression)
break;if(isExpression&&token.type.includes("operator"))
break;expression=token.string+expression;expressionStartPosition.ch=token.start;}
return{hoveredToken:tokenInfo.token,hoveredTokenRange:{start:startPosition,end:endPosition},expression,expressionRange:{start:expressionStartPosition,end:endPosition},};}
_processMarkedToken(tokenInfo)
{return this._processNonSymbolToken(tokenInfo);}
_resetTrackingStates()
{if(this._tokenHoverTimer)
clearTimeout(this._tokenHoverTimer);this._tokenHoverTimer=0;this._selectionMayBeInProgress=false;this._previousTokenInfo=null;this.removeHighlightedRange();}};WebInspector.CodeMirrorTokenTrackingController.JumpToSymbolHighlightStyleClassName="jump-to-symbol-highlight";WebInspector.CodeMirrorTokenTrackingController.Mode={None:"none",NonSymbolTokens:"non-symbol-tokens",JavaScriptExpression:"javascript-expression",JavaScriptTypeInformation:"javascript-type-information",MarkedTokens:"marked-tokens"};WebInspector.CodeMirrorTokenTrackingController.TriggeredBy={Keyboard:"keyboard",Hover:"hover"};WebInspector.CodeMirrorTextKillController=class CodeMirrorTextKillController extends WebInspector.Object
{constructor(codeMirror)
{super();this._codeMirror=codeMirror;this._expectingChangeEventForKill=false;this._nextKillStartsNewSequence=true;this._shouldPrependToKillRing=false;this._handleTextChangeListener=this._handleTextChange.bind(this);this._handleEditorBlurListener=this._handleEditorBlur.bind(this);this._handleSelectionOrCaretChangeListener=this._handleSelectionOrCaretChange.bind(this);this._codeMirror.addKeyMap({"Ctrl-K":this._handleTextKillCommand.bind(this,"killLine",false),"Alt-D":this._handleTextKillCommand.bind(this,"delWordAfter",false),"Alt-Delete":this._handleTextKillCommand.bind(this,"delGroupAfter",false),"Cmd-Backspace":this._handleTextKillCommand.bind(this,"delWrappedLineLeft",true),"Cmd-Delete":this._handleTextKillCommand.bind(this,"delWrappedLineRight",false),"Alt-Backspace":this._handleTextKillCommand.bind(this,"delGroupBefore",true),"Ctrl-Alt-Backspace":this._handleTextKillCommand.bind(this,"delGroupAfter",false),});}
_handleTextKillCommand(command,prependsToKillRing,codeMirror)
{
if(this._codeMirror.getOption("readOnly"))
return;this._shouldPrependToKillRing=prependsToKillRing;
if(!this._expectingChangeEventForKill)
this._codeMirror.on("changes",this._handleTextChangeListener);this._expectingChangeEventForKill=true;this._codeMirror.execCommand(command);}
_handleTextChange(codeMirror,changes)
{this._codeMirror.off("changes",this._handleTextChangeListener);
if(!this._expectingChangeEventForKill)
return;this._expectingChangeEventForKill=false;let change=changes[0];
if(change.origin!=="+delete")
return;
let killedText;if(change.to.line===change.from.line+1&&change.removed.length===2){if(change.removed[0].length&&!change.removed[1].length)
killedText=change.removed[0]+"\n";else
killedText="\n";}else{killedText=change.removed[0];}
InspectorFrontendHost.killText(killedText,this._shouldPrependToKillRing,this._nextKillStartsNewSequence);
this._nextKillStartsNewSequence=false;this._codeMirror.on("blur",this._handleEditorBlurListener);this._codeMirror.on("cursorActivity",this._handleSelectionOrCaretChangeListener);}
_handleEditorBlur(codeMirror)
{this._nextKillStartsNewSequence=true;this._codeMirror.off("blur",this._handleEditorBlurListener);this._codeMirror.off("cursorActivity",this._handleSelectionOrCaretChangeListener);}
_handleSelectionOrCaretChange(codeMirror)
{if(this._expectingChangeEventForKill)
return;this._nextKillStartsNewSequence=true;this._codeMirror.off("blur",this._handleEditorBlurListener);this._codeMirror.off("cursorActivity",this._handleSelectionOrCaretChangeListener);}};WebInspector.DOMDebuggerManager=class DOMDebuggerManager extends WebInspector.Object
{constructor()
{super();this._domBreakpointsSetting=new WebInspector.Setting("dom-breakpoints",[]);this._domBreakpointURLMap=new Map;this._domBreakpointFrameIdentifierMap=new Map;this._xhrBreakpointsSetting=new WebInspector.Setting("xhr-breakpoints",[]);this._xhrBreakpoints=[];this._allRequestsBreakpointEnabledSetting=new WebInspector.Setting("break-on-all-requests",false);this._allRequestsBreakpoint=new WebInspector.XHRBreakpoint(null,null,!this._allRequestsBreakpointEnabledSetting.value);WebInspector.DOMBreakpoint.addEventListener(WebInspector.DOMBreakpoint.Event.DisabledStateDidChange,this._domBreakpointDisabledStateDidChange,this);WebInspector.XHRBreakpoint.addEventListener(WebInspector.XHRBreakpoint.Event.DisabledStateDidChange,this._xhrBreakpointDisabledStateDidChange,this);WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.NodeRemoved,this._nodeRemoved,this);WebInspector.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.NodeInserted,this._nodeInserted,this);WebInspector.frameResourceManager.addEventListener(WebInspector.FrameResourceManager.Event.MainFrameDidChange,this._mainFrameDidChange,this);WebInspector.Frame.addEventListener(WebInspector.Frame.Event.ChildFrameWasRemoved,this._childFrameWasRemoved,this);WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange,this._mainResourceDidChange,this);if(this.supported){this._restoringBreakpoints=true;for(let cookie of this._domBreakpointsSetting.value){let breakpoint=new WebInspector.DOMBreakpoint(cookie,cookie.type,cookie.disabled);this.addDOMBreakpoint(breakpoint);}
for(let cookie of this._xhrBreakpointsSetting.value){let breakpoint=new WebInspector.XHRBreakpoint(cookie.type,cookie.url,cookie.disabled);this.addXHRBreakpoint(breakpoint);}
this._restoringBreakpoints=false;this._speculativelyResolveBreakpoints();if(!this._allRequestsBreakpoint.disabled)
this._updateXHRBreakpoint(this._allRequestsBreakpoint);}}
get supported()
{return!!window.DOMDebuggerAgent;}
get allRequestsBreakpoint(){return this._allRequestsBreakpoint;}
get domBreakpoints()
{let mainFrame=WebInspector.frameResourceManager.mainFrame;if(!mainFrame)
return[];let resolvedBreakpoints=[];let frames=[mainFrame];while(frames.length){let frame=frames.shift();let domBreakpointNodeIdentifierMap=this._domBreakpointFrameIdentifierMap.get(frame.id);if(domBreakpointNodeIdentifierMap){for(let breakpoints of domBreakpointNodeIdentifierMap.values())
resolvedBreakpoints=resolvedBreakpoints.concat(breakpoints);}
frames=frames.concat(frame.childFrameCollection.toArray());}
return resolvedBreakpoints;}
get xhrBreakpoints(){return this._xhrBreakpoints;}
isBreakpointRemovable(breakpoint)
{return breakpoint!==this._allRequestsBreakpoint;}
domBreakpointsForNode(node)
{if(!node)
return[];let domBreakpointNodeIdentifierMap=this._domBreakpointFrameIdentifierMap.get(node.frameIdentifier);if(!domBreakpointNodeIdentifierMap)
return[];let breakpoints=domBreakpointNodeIdentifierMap.get(node.id);return breakpoints?breakpoints.slice():[];}
addDOMBreakpoint(breakpoint)
{if(!breakpoint||!breakpoint.url)
return;let breakpoints=this._domBreakpointURLMap.get(breakpoint.url);if(!breakpoints){breakpoints=[breakpoint];this._domBreakpointURLMap.set(breakpoint.url,breakpoints);}else
breakpoints.push(breakpoint);if(breakpoint.domNodeIdentifier)
this._resolveDOMBreakpoint(breakpoint,breakpoint.domNodeIdentifier);this.dispatchEventToListeners(WebInspector.DOMDebuggerManager.Event.DOMBreakpointAdded,{breakpoint});this._saveDOMBreakpoints();}
removeDOMBreakpoint(breakpoint)
{if(!breakpoint)
return;let nodeIdentifier=breakpoint.domNodeIdentifier;if(!nodeIdentifier)
return;this._detachDOMBreakpoint(breakpoint);let urlBreakpoints=this._domBreakpointURLMap.get(breakpoint.url);urlBreakpoints.remove(breakpoint,true);if(!breakpoint.disabled)
DOMDebuggerAgent.removeDOMBreakpoint(nodeIdentifier,breakpoint.type);if(!urlBreakpoints.length)
this._domBreakpointURLMap.delete(breakpoint.url);this.dispatchEventToListeners(WebInspector.DOMDebuggerManager.Event.DOMBreakpointRemoved,{breakpoint});breakpoint.domNodeIdentifier=null;this._saveDOMBreakpoints();}
removeDOMBreakpointsForNode(node)
{this._restoringBreakpoints=true;this.domBreakpointsForNode(node).forEach(this.removeDOMBreakpoint,this);this._restoringBreakpoints=false;this._saveDOMBreakpoints();}
xhrBreakpointForURL(url)
{return this._xhrBreakpoints.find((breakpoint)=>breakpoint.url===url)||null;}
addXHRBreakpoint(breakpoint)
{if(!breakpoint)
return;if(this._xhrBreakpoints.includes(breakpoint))
return;if(this._xhrBreakpoints.some((entry)=>entry.type===breakpoint.type&&entry.url===breakpoint.url))
return;this._xhrBreakpoints.push(breakpoint);this.dispatchEventToListeners(WebInspector.DOMDebuggerManager.Event.XHRBreakpointAdded,{breakpoint});this._resolveXHRBreakpoint(breakpoint);this._saveXHRBreakpoints();}
removeXHRBreakpoint(breakpoint)
{if(!breakpoint)
return;if(!this._xhrBreakpoints.includes(breakpoint))
return;this._xhrBreakpoints.remove(breakpoint,true);this._saveXHRBreakpoints();this.dispatchEventToListeners(WebInspector.DOMDebuggerManager.Event.XHRBreakpointRemoved,{breakpoint});if(breakpoint.disabled)
return;DOMDebuggerAgent.removeXHRBreakpoint(breakpoint.url,(error)=>{if(error)
console.error(error);});}
_detachDOMBreakpoint(breakpoint)
{let nodeIdentifier=breakpoint.domNodeIdentifier;let node=WebInspector.domTreeManager.nodeForId(nodeIdentifier);if(!node)
return;let frameIdentifier=node.frameIdentifier;let domBreakpointNodeIdentifierMap=this._domBreakpointFrameIdentifierMap.get(frameIdentifier);if(!domBreakpointNodeIdentifierMap)
return;let breakpoints=domBreakpointNodeIdentifierMap.get(nodeIdentifier);if(!breakpoints)
return;breakpoints.remove(breakpoint,true);if(breakpoints.length)
return;domBreakpointNodeIdentifierMap.delete(nodeIdentifier);if(!domBreakpointNodeIdentifierMap.size)
this._domBreakpointFrameIdentifierMap.delete(frameIdentifier)}
_detachBreakpointsForFrame(frame)
{let domBreakpointNodeIdentifierMap=this._domBreakpointFrameIdentifierMap.get(frame.id);if(!domBreakpointNodeIdentifierMap)
return;this._domBreakpointFrameIdentifierMap.delete(frame.id);for(let breakpoints of domBreakpointNodeIdentifierMap.values()){for(let breakpoint of breakpoints)
breakpoint.domNodeIdentifier=null;}}
_speculativelyResolveBreakpoints()
{let mainFrame=WebInspector.frameResourceManager.mainFrame;if(!mainFrame)
return;let domBreakpoints=this._domBreakpointURLMap.get(mainFrame.url);if(domBreakpoints){for(let breakpoint of domBreakpoints){if(breakpoint.domNodeIdentifier)
continue;WebInspector.domTreeManager.pushNodeByPathToFrontend(breakpoint.path,(nodeIdentifier)=>{if(!nodeIdentifier)
return;this._resolveDOMBreakpoint(breakpoint,nodeIdentifier);});}}
for(let breakpoint of this._xhrBreakpoints)
this._resolveXHRBreakpoint(breakpoint);}
_resolveDOMBreakpoint(breakpoint,nodeIdentifier)
{let node=WebInspector.domTreeManager.nodeForId(nodeIdentifier);if(!node)
return;let frameIdentifier=node.frameIdentifier;let domBreakpointNodeIdentifierMap=this._domBreakpointFrameIdentifierMap.get(frameIdentifier);if(!domBreakpointNodeIdentifierMap){domBreakpointNodeIdentifierMap=new Map;this._domBreakpointFrameIdentifierMap.set(frameIdentifier,domBreakpointNodeIdentifierMap);}
let breakpoints=domBreakpointNodeIdentifierMap.get(nodeIdentifier);if(breakpoints)
breakpoints.push(breakpoint);else
domBreakpointNodeIdentifierMap.set(nodeIdentifier,[breakpoint]);breakpoint.domNodeIdentifier=nodeIdentifier;this._updateDOMBreakpoint(breakpoint);}
_updateDOMBreakpoint(breakpoint)
{let nodeIdentifier=breakpoint.domNodeIdentifier;if(!nodeIdentifier)
return;function breakpointUpdated(error)
{if(error)
console.error(error);}
if(breakpoint.disabled)
DOMDebuggerAgent.removeDOMBreakpoint(nodeIdentifier,breakpoint.type,breakpointUpdated);else
DOMDebuggerAgent.setDOMBreakpoint(nodeIdentifier,breakpoint.type,breakpointUpdated);}
_updateXHRBreakpoint(breakpoint,callback)
{function breakpointUpdated(error)
{if(error)
console.error(error);if(callback&&typeof callback==="function")
callback(error);}
if(breakpoint.disabled)
DOMDebuggerAgent.removeXHRBreakpoint(breakpoint.url,breakpointUpdated);else{let isRegex=breakpoint.type===WebInspector.XHRBreakpoint.Type.RegularExpression;DOMDebuggerAgent.setXHRBreakpoint(breakpoint.url,isRegex,breakpointUpdated);}}
_resolveXHRBreakpoint(breakpoint)
{if(breakpoint.disabled)
return;this._updateXHRBreakpoint(breakpoint,()=>{breakpoint.dispatchEventToListeners(WebInspector.XHRBreakpoint.Event.ResolvedStateDidChange);});}
_saveDOMBreakpoints()
{if(this._restoringBreakpoints)
return;let breakpointsToSave=[];for(let breakpoints of this._domBreakpointURLMap.values())
breakpointsToSave=breakpointsToSave.concat(breakpoints);this._domBreakpointsSetting.value=breakpointsToSave.map((breakpoint)=>breakpoint.serializableInfo);}
_saveXHRBreakpoints()
{if(this._restoringBreakpoints)
return;this._xhrBreakpointsSetting.value=this._xhrBreakpoints.map((breakpoint)=>breakpoint.serializableInfo);}
_domBreakpointDisabledStateDidChange(event)
{let breakpoint=event.target;this._updateDOMBreakpoint(breakpoint);this._saveDOMBreakpoints();}
_xhrBreakpointDisabledStateDidChange(event)
{let breakpoint=event.target;if(breakpoint===this._allRequestsBreakpoint)
this._allRequestsBreakpointEnabledSetting.value=!breakpoint.disabled;this._updateXHRBreakpoint(breakpoint);this._saveXHRBreakpoints();}
_childFrameWasRemoved(event)
{let frame=event.data.childFrame;this._detachBreakpointsForFrame(frame);}
_mainFrameDidChange()
{this._speculativelyResolveBreakpoints();}
_mainResourceDidChange(event)
{let frame=event.target;if(frame.isMainFrame()){for(let breakpoints of this._domBreakpointURLMap.values())
breakpoints.forEach((breakpoint)=>{breakpoint.domNodeIdentifier=null;});this._domBreakpointFrameIdentifierMap.clear();}else
this._detachBreakpointsForFrame(frame);this._speculativelyResolveBreakpoints();}
_nodeInserted(event)
{let node=event.data.node;if(node.nodeType()!==Node.ELEMENT_NODE||!node.ownerDocument)
return;let url=node.ownerDocument.documentURL;let breakpoints=this._domBreakpointURLMap.get(url);if(!breakpoints)
return;for(let breakpoint of breakpoints){if(breakpoint.domNodeIdentifier)
continue;if(breakpoint.path!==node.path())
continue;this._resolveDOMBreakpoint(breakpoint,node.id);}}
_nodeRemoved(event)
{let node=event.data.node;if(node.nodeType()!==Node.ELEMENT_NODE||!node.ownerDocument)
return;let domBreakpointNodeIdentifierMap=this._domBreakpointFrameIdentifierMap.get(node.frameIdentifier);if(!domBreakpointNodeIdentifierMap)
return;let breakpoints=domBreakpointNodeIdentifierMap.get(node.id);if(!breakpoints)
return;domBreakpointNodeIdentifierMap.delete(node.id);if(!domBreakpointNodeIdentifierMap.size)
this._domBreakpointFrameIdentifierMap.delete(node.frameIdentifier);for(let breakpoint of breakpoints)
breakpoint.domNodeIdentifier=null;}};WebInspector.DOMDebuggerManager.Event={DOMBreakpointAdded:"dom-debugger-manager-dom-breakpoint-added",DOMBreakpointRemoved:"dom-debugger-manager-dom-breakpoint-removed",XHRBreakpointAdded:"dom-debugger-manager-xhr-breakpoint-added",XHRBreakpointRemoved:"dom-debugger-manager-xhr-breakpoint-removed",};WebInspector.DOMTreeManager=class DOMTreeManager extends WebInspector.Object
{constructor()
{super();this._idToDOMNode={};this._document=null;this._attributeLoadNodeIds={};this._flows=new Map;this._contentNodesToFlowsMap=new Map;this._restoreSelectedNodeIsAllowed=true;this._loadNodeAttributesTimeout=0;WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange,this._mainResourceDidChange,this);}
static _flowPayloadHashKey(flowPayload)
{return flowPayload.documentNodeId+":"+flowPayload.name;}
requestDocument(callback)
{if(this._document){callback(this._document);return;}
if(this._pendingDocumentRequestCallbacks){this._pendingDocumentRequestCallbacks.push(callback);return;}
this._pendingDocumentRequestCallbacks=[callback];function onDocumentAvailable(error,root)
{if(!error)
this._setDocument(root);for(let callback of this._pendingDocumentRequestCallbacks)
callback(this._document);this._pendingDocumentRequestCallbacks=null;}
DOMAgent.getDocument(onDocumentAvailable.bind(this));}
ensureDocument()
{this.requestDocument(function(){});}
pushNodeToFrontend(objectId,callback)
{this._dispatchWhenDocumentAvailable(DOMAgent.requestNode.bind(DOMAgent,objectId),callback);}
pushNodeByPathToFrontend(path,callback)
{this._dispatchWhenDocumentAvailable(DOMAgent.pushNodeByPathToFrontend.bind(DOMAgent,path),callback);}
_wrapClientCallback(callback)
{if(!callback)
return null;return function(error,result){if(error)
console.error("Error during DOMAgent operation: "+error);callback(error?null:result);};}
_dispatchWhenDocumentAvailable(func,callback)
{var callbackWrapper=this._wrapClientCallback(callback);function onDocumentAvailable()
{if(this._document)
func(callbackWrapper);else{if(callbackWrapper)
callbackWrapper("No document");}}
this.requestDocument(onDocumentAvailable.bind(this));}
_attributeModified(nodeId,name,value)
{var node=this._idToDOMNode[nodeId];if(!node)
return;node._setAttribute(name,value);this.dispatchEventToListeners(WebInspector.DOMTreeManager.Event.AttributeModified,{node,name});node.dispatchEventToListeners(WebInspector.DOMNode.Event.AttributeModified,{name});}
_attributeRemoved(nodeId,name)
{var node=this._idToDOMNode[nodeId];if(!node)
return;node._removeAttribute(name);this.dispatchEventToListeners(WebInspector.DOMTreeManager.Event.AttributeRemoved,{node,name});node.dispatchEventToListeners(WebInspector.DOMNode.Event.AttributeRemoved,{name});}
_inlineStyleInvalidated(nodeIds)
{for(var nodeId of nodeIds)
this._attributeLoadNodeIds[nodeId]=true;if(this._loadNodeAttributesTimeout)
return;this._loadNodeAttributesTimeout=setTimeout(this._loadNodeAttributes.bind(this),0);}
_loadNodeAttributes()
{function callback(nodeId,error,attributes)
{if(error){console.error("Error during DOMAgent operation: "+error);return;}
var node=this._idToDOMNode[nodeId];if(node){node._setAttributesPayload(attributes);this.dispatchEventToListeners(WebInspector.DOMTreeManager.Event.AttributeModified,{node,name:"style"});node.dispatchEventToListeners(WebInspector.DOMNode.Event.AttributeModified,{name:"style"});}}
this._loadNodeAttributesTimeout=0;for(var nodeId in this._attributeLoadNodeIds){var nodeIdAsNumber=parseInt(nodeId);DOMAgent.getAttributes(nodeIdAsNumber,callback.bind(this,nodeIdAsNumber));}
this._attributeLoadNodeIds={};}
_characterDataModified(nodeId,newValue)
{var node=this._idToDOMNode[nodeId];node._nodeValue=newValue;this.dispatchEventToListeners(WebInspector.DOMTreeManager.Event.CharacterDataModified,{node});}
nodeForId(nodeId)
{return this._idToDOMNode[nodeId];}
_documentUpdated()
{this._setDocument(null);}
_setDocument(payload)
{this._idToDOMNode={};let newDocument=null;if(payload&&"nodeId"in payload)
newDocument=new WebInspector.DOMNode(this,null,false,payload);if(this._document===newDocument)
return;this._document=newDocument;this.dispatchEventToListeners(WebInspector.DOMTreeManager.Event.DocumentUpdated,{document:this._document});}
_setDetachedRoot(payload)
{new WebInspector.DOMNode(this,null,false,payload);}
_setChildNodes(parentId,payloads)
{if(!parentId&&payloads.length){this._setDetachedRoot(payloads[0]);return;}
var parent=this._idToDOMNode[parentId];parent._setChildrenPayload(payloads);}
_childNodeCountUpdated(nodeId,newValue)
{var node=this._idToDOMNode[nodeId];node.childNodeCount=newValue;this.dispatchEventToListeners(WebInspector.DOMTreeManager.Event.ChildNodeCountUpdated,node);}
_childNodeInserted(parentId,prevId,payload)
{var parent=this._idToDOMNode[parentId];var prev=this._idToDOMNode[prevId];var node=parent._insertChild(prev,payload);this._idToDOMNode[node.id]=node;this.dispatchEventToListeners(WebInspector.DOMTreeManager.Event.NodeInserted,{node,parent});}
_childNodeRemoved(parentId,nodeId)
{var parent=this._idToDOMNode[parentId];var node=this._idToDOMNode[nodeId];parent._removeChild(node);this._unbind(node);this.dispatchEventToListeners(WebInspector.DOMTreeManager.Event.NodeRemoved,{node,parent});}
_customElementStateChanged(elementId,newState)
{const node=this._idToDOMNode[elementId];node._customElementState=newState;this.dispatchEventToListeners(WebInspector.DOMTreeManager.Event.CustomElementStateChanged,{node});}
_pseudoElementAdded(parentId,pseudoElement)
{var parent=this._idToDOMNode[parentId];if(!parent)
return;var node=new WebInspector.DOMNode(this,parent.ownerDocument,false,pseudoElement);node.parentNode=parent;this._idToDOMNode[node.id]=node;parent.pseudoElements().set(node.pseudoType(),node);this.dispatchEventToListeners(WebInspector.DOMTreeManager.Event.NodeInserted,{node,parent});}
_pseudoElementRemoved(parentId,pseudoElementId)
{var pseudoElement=this._idToDOMNode[pseudoElementId];if(!pseudoElement)
return;var parent=pseudoElement.parentNode;if(!parent)
return;parent._removeChild(pseudoElement);this._unbind(pseudoElement);this.dispatchEventToListeners(WebInspector.DOMTreeManager.Event.NodeRemoved,{node:pseudoElement,parent});}
_unbind(node)
{this._removeContentNodeFromFlowIfNeeded(node);delete this._idToDOMNode[node.id];for(let i=0;node.children&&i<node.children.length;++i)
this._unbind(node.children[i]);let templateContent=node.templateContent();if(templateContent)
this._unbind(templateContent);for(let pseudoElement of node.pseudoElements().values())
this._unbind(pseudoElement);}
get restoreSelectedNodeIsAllowed()
{return this._restoreSelectedNodeIsAllowed;}
inspectElement(nodeId)
{var node=this._idToDOMNode[nodeId];if(!node||!node.ownerDocument)
return;this.dispatchEventToListeners(WebInspector.DOMTreeManager.Event.DOMNodeWasInspected,{node});this._inspectModeEnabled=false;this.dispatchEventToListeners(WebInspector.DOMTreeManager.Event.InspectModeStateChanged);}
inspectNodeObject(remoteObject)
{this._restoreSelectedNodeIsAllowed=false;function nodeAvailable(nodeId)
{remoteObject.release();if(!nodeId)
return;this.inspectElement(nodeId);let domNode=this.nodeForId(nodeId);WebInspector.RemoteObject.resolveNode(domNode,WebInspector.RuntimeManager.ConsoleObjectGroup,function(remoteObject){if(!remoteObject)
return;let specialLogStyles=true;let shouldRevealConsole=false;WebInspector.consoleLogViewController.appendImmediateExecutionWithResult(WebInspector.UIString("Selected Element"),remoteObject,specialLogStyles,shouldRevealConsole);});}
remoteObject.pushNodeToFrontend(nodeAvailable.bind(this));}
performSearch(query,searchCallback)
{this.cancelSearch();function callback(error,searchId,resultsCount)
{this._searchId=searchId;searchCallback(resultsCount);}
DOMAgent.performSearch(query,callback.bind(this));}
searchResult(index,callback)
{function mycallback(error,nodeIds)
{if(error){console.error(error);callback(null);return;}
if(nodeIds.length!==1)
return;callback(this._idToDOMNode[nodeIds[0]]);}
if(this._searchId)
DOMAgent.getSearchResults(this._searchId,index,index+1,mycallback.bind(this));else
callback(null);}
cancelSearch()
{if(this._searchId){DOMAgent.discardSearchResults(this._searchId);this._searchId=undefined;}}
querySelector(nodeId,selectors,callback)
{DOMAgent.querySelector(nodeId,selectors,this._wrapClientCallback(callback));}
querySelectorAll(nodeId,selectors,callback)
{DOMAgent.querySelectorAll(nodeId,selectors,this._wrapClientCallback(callback));}
highlightDOMNode(nodeId,mode)
{if(this._hideDOMNodeHighlightTimeout){clearTimeout(this._hideDOMNodeHighlightTimeout);this._hideDOMNodeHighlightTimeout=undefined;}
this._highlightedDOMNodeId=nodeId;if(nodeId)
DOMAgent.highlightNode.invoke({nodeId,highlightConfig:this._buildHighlightConfig(mode)});else
DOMAgent.hideHighlight();}
highlightDOMNodeList(nodeIds,mode)
{if(!DOMAgent.highlightNodeList)
return;if(this._hideDOMNodeHighlightTimeout){clearTimeout(this._hideDOMNodeHighlightTimeout);this._hideDOMNodeHighlightTimeout=undefined;}
DOMAgent.highlightNodeList(nodeIds,this._buildHighlightConfig(mode));}
highlightSelector(selectorText,frameId,mode)
{if(!DOMAgent.highlightSelector)
return;if(this._hideDOMNodeHighlightTimeout){clearTimeout(this._hideDOMNodeHighlightTimeout);this._hideDOMNodeHighlightTimeout=undefined;}
DOMAgent.highlightSelector(this._buildHighlightConfig(mode),selectorText,frameId);}
highlightRect(rect,usePageCoordinates)
{DOMAgent.highlightRect.invoke({x:rect.x,y:rect.y,width:rect.width,height:rect.height,color:{r:111,g:168,b:220,a:0.66},outlineColor:{r:255,g:229,b:153,a:0.66},usePageCoordinates});}
hideDOMNodeHighlight()
{this.highlightDOMNode(0);}
highlightDOMNodeForTwoSeconds(nodeId)
{this.highlightDOMNode(nodeId);this._hideDOMNodeHighlightTimeout=setTimeout(this.hideDOMNodeHighlight.bind(this),2000);}
get inspectModeEnabled()
{return this._inspectModeEnabled;}
set inspectModeEnabled(enabled)
{if(enabled===this._inspectModeEnabled)
return;DOMAgent.setInspectModeEnabled(enabled,this._buildHighlightConfig(),(error)=>{this._inspectModeEnabled=error?false:enabled;this.dispatchEventToListeners(WebInspector.DOMTreeManager.Event.InspectModeStateChanged);});}
_buildHighlightConfig(mode="all")
{let highlightConfig={showInfo:mode==="all"};if(mode==="all"||mode==="content")
highlightConfig.contentColor={r:111,g:168,b:220,a:0.66};if(mode==="all"||mode==="padding")
highlightConfig.paddingColor={r:147,g:196,b:125,a:0.66};if(mode==="all"||mode==="border")
highlightConfig.borderColor={r:255,g:229,b:153,a:0.66};if(mode==="all"||mode==="margin")
highlightConfig.marginColor={r:246,g:178,b:107,a:0.66};return highlightConfig;}
_createContentFlowFromPayload(flowPayload)
{var flow=new WebInspector.ContentFlow(flowPayload.documentNodeId,flowPayload.name,flowPayload.overset,flowPayload.content.map(this.nodeForId.bind(this)));for(var contentNode of flow.contentNodes){this._contentNodesToFlowsMap.set(contentNode.id,flow);}
return flow;}
_updateContentFlowFromPayload(contentFlow,flowPayload)
{contentFlow.overset=flowPayload.overset;}
getNamedFlowCollection(documentNodeIdentifier)
{function onNamedFlowCollectionAvailable(error,flows)
{if(error)
return;this._contentNodesToFlowsMap.clear();var contentFlows=[];for(var i=0;i<flows.length;++i){var flowPayload=flows[i];var flowKey=WebInspector.DOMTreeManager._flowPayloadHashKey(flowPayload);var contentFlow=this._flows.get(flowKey);if(contentFlow)
this._updateContentFlowFromPayload(contentFlow,flowPayload);else{contentFlow=this._createContentFlowFromPayload(flowPayload);this._flows.set(flowKey,contentFlow);}
contentFlows.push(contentFlow);}
this.dispatchEventToListeners(WebInspector.DOMTreeManager.Event.ContentFlowListWasUpdated,{documentNodeIdentifier,flows:contentFlows});}
if(window.CSSAgent)
CSSAgent.getNamedFlowCollection(documentNodeIdentifier,onNamedFlowCollectionAvailable.bind(this));}
namedFlowCreated(flowPayload)
{var flowKey=WebInspector.DOMTreeManager._flowPayloadHashKey(flowPayload);var contentFlow=this._createContentFlowFromPayload(flowPayload);this._flows.set(flowKey,contentFlow);this.dispatchEventToListeners(WebInspector.DOMTreeManager.Event.ContentFlowWasAdded,{flow:contentFlow});}
namedFlowRemoved(documentNodeIdentifier,flowName)
{var flowKey=WebInspector.DOMTreeManager._flowPayloadHashKey({documentNodeId:documentNodeIdentifier,name:flowName});var contentFlow=this._flows.get(flowKey);this._flows.delete(flowKey);for(var contentNode of contentFlow.contentNodes)
this._contentNodesToFlowsMap.delete(contentNode.id);this.dispatchEventToListeners(WebInspector.DOMTreeManager.Event.ContentFlowWasRemoved,{flow:contentFlow});}
_sendNamedFlowUpdateEvents(flowPayload)
{var flowKey=WebInspector.DOMTreeManager._flowPayloadHashKey(flowPayload);this._updateContentFlowFromPayload(this._flows.get(flowKey),flowPayload);}
regionOversetChanged(flowPayload)
{this._sendNamedFlowUpdateEvents(flowPayload);}
registeredNamedFlowContentElement(documentNodeIdentifier,flowName,contentNodeId,nextContentElementNodeId)
{var flowKey=WebInspector.DOMTreeManager._flowPayloadHashKey({documentNodeId:documentNodeIdentifier,name:flowName});var flow=this._flows.get(flowKey);var contentNode=this.nodeForId(contentNodeId);this._contentNodesToFlowsMap.set(contentNode.id,flow);if(nextContentElementNodeId)
flow.insertContentNodeBefore(contentNode,this.nodeForId(nextContentElementNodeId));else
flow.appendContentNode(contentNode);}
_removeContentNodeFromFlowIfNeeded(node)
{if(!this._contentNodesToFlowsMap.has(node.id))
return;var flow=this._contentNodesToFlowsMap.get(node.id);this._contentNodesToFlowsMap.delete(node.id);flow.removeContentNode(node);}
unregisteredNamedFlowContentElement(documentNodeIdentifier,flowName,contentNodeId)
{var flow=this._contentNodesToFlowsMap.get(contentNodeId);this._contentNodesToFlowsMap.delete(contentNodeId);flow.removeContentNode(this.nodeForId(contentNodeId));}
_coerceRemoteArrayOfDOMNodes(remoteObject,callback)
{let length=remoteObject.size;if(!length){callback(null,[]);return;}
let nodes;let received=0;let lastError=null;let domTreeManager=this;function nodeRequested(index,error,nodeId)
{if(error)
lastError=error;else
nodes[index]=domTreeManager._idToDOMNode[nodeId];if(++received===length)
callback(lastError,nodes);}
WebInspector.runtimeManager.getPropertiesForRemoteObject(remoteObject.objectId,function(error,properties){if(error){callback(error);return;}
nodes=new Array(length);for(let i=0;i<length;++i){let nodeProperty=properties.get(String(i));DOMAgent.requestNode(nodeProperty.value.objectId,nodeRequested.bind(null,i));}});}
getNodeContentFlowInfo(domNode,resultReadyCallback)
{DOMAgent.resolveNode(domNode.id,domNodeResolved.bind(this));function domNodeResolved(error,remoteObject)
{if(error){resultReadyCallback(error);return;}
var evalParameters={objectId:remoteObject.objectId,functionDeclaration:appendWebInspectorSourceURL(inspectedPage_node_getFlowInfo.toString()),doNotPauseOnExceptionsAndMuteConsole:true,returnByValue:false,generatePreview:false};RuntimeAgent.callFunctionOn.invoke(evalParameters,regionNodesAvailable.bind(this));}
function regionNodesAvailable(error,remoteObject,wasThrown)
{if(error){resultReadyCallback(error);return;}
if(wasThrown){console.error("Error while executing backend function:",JSON.stringify(remoteObject));resultReadyCallback(null);return;}
WebInspector.runtimeManager.getPropertiesForRemoteObject(remoteObject.objectId,remoteObjectPropertiesAvailable.bind(this));}
function remoteObjectPropertiesAvailable(error,properties){if(error){resultReadyCallback(error);return;}
var result={regionFlow:null,contentFlow:null,regions:null};var regionFlowNameProperty=properties.get("regionFlowName");if(regionFlowNameProperty&&regionFlowNameProperty.value&&regionFlowNameProperty.value.value){var regionFlowKey=WebInspector.DOMTreeManager._flowPayloadHashKey({documentNodeId:domNode.ownerDocument.id,name:regionFlowNameProperty.value.value});result.regionFlow=this._flows.get(regionFlowKey);}
var contentFlowNameProperty=properties.get("contentFlowName");if(contentFlowNameProperty&&contentFlowNameProperty.value&&contentFlowNameProperty.value.value){var contentFlowKey=WebInspector.DOMTreeManager._flowPayloadHashKey({documentNodeId:domNode.ownerDocument.id,name:contentFlowNameProperty.value.value});result.contentFlow=this._flows.get(contentFlowKey);}
var regionsProperty=properties.get("regions");if(!regionsProperty||!regionsProperty.value.objectId){resultReadyCallback(null,result);return;}
this._coerceRemoteArrayOfDOMNodes(regionsProperty.value,function(error,nodes){result.regions=nodes;resultReadyCallback(error,result);});}
function inspectedPage_node_getFlowInfo()
{function getComputedProperty(node,propertyName)
{if(!node.ownerDocument||!node.ownerDocument.defaultView)
return null;var computedStyle=node.ownerDocument.defaultView.getComputedStyle(node);return computedStyle?computedStyle[propertyName]:null;}
function getContentFlowName(node)
{for(;node;node=node.parentNode){var flowName=getComputedProperty(node,"webkitFlowInto");if(flowName&&flowName!=="none")
return flowName;}
return null;}
var node=this;var result={regionFlowName:getComputedProperty(node,"webkitFlowFrom"),contentFlowName:getContentFlowName(node),regions:null};if(result.contentFlowName){var flowThread=node.ownerDocument.webkitGetNamedFlows().namedItem(result.contentFlowName);if(flowThread)
result.regions=Array.from(flowThread.getRegionsByContent(node));}
return result;}}
_mainResourceDidChange(event)
{if(event.target.isMainFrame())
this._restoreSelectedNodeIsAllowed=true;}};WebInspector.DOMTreeManager.Event={AttributeModified:"dom-tree-manager-attribute-modified",AttributeRemoved:"dom-tree-manager-attribute-removed",CharacterDataModified:"dom-tree-manager-character-data-modified",NodeInserted:"dom-tree-manager-node-inserted",NodeRemoved:"dom-tree-manager-node-removed",CustomElementStateChanged:"dom-tree-manager-custom-element-state-changed",DocumentUpdated:"dom-tree-manager-document-updated",ChildNodeCountUpdated:"dom-tree-manager-child-node-count-updated",DOMNodeWasInspected:"dom-tree-manager-dom-node-was-inspected",InspectModeStateChanged:"dom-tree-manager-inspect-mode-state-changed",ContentFlowListWasUpdated:"dom-tree-manager-content-flow-list-was-updated",ContentFlowWasAdded:"dom-tree-manager-content-flow-was-added",ContentFlowWasRemoved:"dom-tree-manager-content-flow-was-removed",RegionOversetChanged:"dom-tree-manager-region-overset-changed"};WebInspector.DashboardManager=class DashboardManager extends WebInspector.Object
{constructor()
{super();this._dashboards={};this._dashboards.default=new WebInspector.DefaultDashboard;this._dashboards.debugger=new WebInspector.DebuggerDashboard;}
get dashboards()
{return this._dashboards;}};WebInspector.DebuggerManager=class DebuggerManager extends WebInspector.Object
{constructor()
{super();DebuggerAgent.enable();WebInspector.notifications.addEventListener(WebInspector.Notification.DebugUIEnabledDidChange,this._debugUIEnabledDidChange,this);WebInspector.Breakpoint.addEventListener(WebInspector.Breakpoint.Event.DisplayLocationDidChange,this._breakpointDisplayLocationDidChange,this);WebInspector.Breakpoint.addEventListener(WebInspector.Breakpoint.Event.DisabledStateDidChange,this._breakpointDisabledStateDidChange,this);WebInspector.Breakpoint.addEventListener(WebInspector.Breakpoint.Event.ConditionDidChange,this._breakpointEditablePropertyDidChange,this);WebInspector.Breakpoint.addEventListener(WebInspector.Breakpoint.Event.IgnoreCountDidChange,this._breakpointEditablePropertyDidChange,this);WebInspector.Breakpoint.addEventListener(WebInspector.Breakpoint.Event.AutoContinueDidChange,this._breakpointEditablePropertyDidChange,this);WebInspector.Breakpoint.addEventListener(WebInspector.Breakpoint.Event.ActionsDidChange,this._breakpointEditablePropertyDidChange,this);WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.Event.CapturingWillStart,this._timelineCapturingWillStart,this);WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.Event.CapturingStopped,this._timelineCapturingStopped,this);WebInspector.targetManager.addEventListener(WebInspector.TargetManager.Event.TargetRemoved,this._targetRemoved,this);WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange,this._mainResourceDidChange,this);this._breakpointsSetting=new WebInspector.Setting("breakpoints",[]);this._breakpointsEnabledSetting=new WebInspector.Setting("breakpoints-enabled",true);this._allExceptionsBreakpointEnabledSetting=new WebInspector.Setting("break-on-all-exceptions",false);this._allUncaughtExceptionsBreakpointEnabledSetting=new WebInspector.Setting("break-on-all-uncaught-exceptions",false);this._assertionsBreakpointEnabledSetting=new WebInspector.Setting("break-on-assertions",false);this._asyncStackTraceDepthSetting=new WebInspector.Setting("async-stack-trace-depth",200);let specialBreakpointLocation=new WebInspector.SourceCodeLocation(null,Infinity,Infinity);this._allExceptionsBreakpoint=new WebInspector.Breakpoint(specialBreakpointLocation,!this._allExceptionsBreakpointEnabledSetting.value);this._allExceptionsBreakpoint.resolved=true;this._allUncaughtExceptionsBreakpoint=new WebInspector.Breakpoint(specialBreakpointLocation,!this._allUncaughtExceptionsBreakpointEnabledSetting.value);this._assertionsBreakpoint=new WebInspector.Breakpoint(specialBreakpointLocation,!this._assertionsBreakpointEnabledSetting.value);this._assertionsBreakpoint.resolved=true;this._breakpoints=[];this._breakpointContentIdentifierMap=new Map;this._breakpointScriptIdentifierMap=new Map;this._breakpointIdMap=new Map;this._breakOnExceptionsState="none";this._updateBreakOnExceptionsState();this._nextBreakpointActionIdentifier=1;this._activeCallFrame=null;this._internalWebKitScripts=[];this._targetDebuggerDataMap=new Map;this._targetDebuggerDataMap.set(WebInspector.mainTarget,new WebInspector.DebuggerData(WebInspector.mainTarget));
this._temporarilyDisabledBreakpointsRestoreSetting=new WebInspector.Setting("temporarily-disabled-breakpoints-restore",null);if(this._temporarilyDisabledBreakpointsRestoreSetting.value!==null){this._breakpointsEnabledSetting.value=this._temporarilyDisabledBreakpointsRestoreSetting.value;this._temporarilyDisabledBreakpointsRestoreSetting.value=null;}
DebuggerAgent.setBreakpointsActive(this._breakpointsEnabledSetting.value);DebuggerAgent.setPauseOnExceptions(this._breakOnExceptionsState);if(DebuggerAgent.setPauseOnAssertions)
DebuggerAgent.setPauseOnAssertions(this._assertionsBreakpointEnabledSetting.value);if(DebuggerAgent.setAsyncStackTraceDepth)
DebuggerAgent.setAsyncStackTraceDepth(this._asyncStackTraceDepthSetting.value);this._ignoreBreakpointDisplayLocationDidChangeEvent=false;function restoreBreakpointsSoon(){this._restoringBreakpoints=true;for(let cookie of this._breakpointsSetting.value)
this.addBreakpoint(new WebInspector.Breakpoint(cookie));this._restoringBreakpoints=false;}
setTimeout(restoreBreakpointsSoon.bind(this),0);}
get paused()
{for(let[target,targetData]of this._targetDebuggerDataMap){if(targetData.paused)
return true;}
return false;}
get activeCallFrame()
{return this._activeCallFrame;}
set activeCallFrame(callFrame)
{if(callFrame===this._activeCallFrame)
return;this._activeCallFrame=callFrame||null;this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.ActiveCallFrameDidChange);}
dataForTarget(target)
{let targetData=this._targetDebuggerDataMap.get(target);if(targetData)
return targetData;targetData=new WebInspector.DebuggerData(target);this._targetDebuggerDataMap.set(target,targetData);return targetData;}
get allExceptionsBreakpoint()
{return this._allExceptionsBreakpoint;}
get allUncaughtExceptionsBreakpoint()
{return this._allUncaughtExceptionsBreakpoint;}
get assertionsBreakpoint()
{return this._assertionsBreakpoint;}
get breakpoints()
{return this._breakpoints;}
breakpointForIdentifier(id)
{return this._breakpointIdMap.get(id)||null;}
breakpointsForSourceCode(sourceCode)
{if(sourceCode instanceof WebInspector.SourceMapResource){let originalSourceCodeBreakpoints=this.breakpointsForSourceCode(sourceCode.sourceMap.originalSourceCode);return originalSourceCodeBreakpoints.filter(function(breakpoint){return breakpoint.sourceCodeLocation.displaySourceCode===sourceCode;});}
let contentIdentifierBreakpoints=this._breakpointContentIdentifierMap.get(sourceCode.contentIdentifier);if(contentIdentifierBreakpoints){this._associateBreakpointsWithSourceCode(contentIdentifierBreakpoints,sourceCode);return contentIdentifierBreakpoints;}
if(sourceCode instanceof WebInspector.Script){let scriptIdentifierBreakpoints=this._breakpointScriptIdentifierMap.get(sourceCode.id);if(scriptIdentifierBreakpoints){this._associateBreakpointsWithSourceCode(scriptIdentifierBreakpoints,sourceCode);return scriptIdentifierBreakpoints;}}
return[];}
breakpointForSourceCodeLocation(sourceCodeLocation)
{for(let breakpoint of this.breakpointsForSourceCode(sourceCodeLocation.sourceCode)){if(breakpoint.sourceCodeLocation.isEqual(sourceCodeLocation))
return breakpoint;}
return null;}
isBreakpointRemovable(breakpoint)
{return breakpoint!==this._allExceptionsBreakpoint&&breakpoint!==this._allUncaughtExceptionsBreakpoint&&breakpoint!==this._assertionsBreakpoint;}
isBreakpointEditable(breakpoint)
{return this.isBreakpointRemovable(breakpoint);}
get breakpointsEnabled()
{return this._breakpointsEnabledSetting.value;}
set breakpointsEnabled(enabled)
{if(this._breakpointsEnabledSetting.value===enabled)
return;if(enabled&&this.breakpointsDisabledTemporarily)
return;this._breakpointsEnabledSetting.value=enabled;this._updateBreakOnExceptionsState();for(let target of WebInspector.targets){target.DebuggerAgent.setBreakpointsActive(enabled);target.DebuggerAgent.setPauseOnExceptions(this._breakOnExceptionsState);}
this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.BreakpointsEnabledDidChange);}
get breakpointsDisabledTemporarily()
{return this._temporarilyDisabledBreakpointsRestoreSetting.value!==null;}
scriptForIdentifier(id,target)
{return this.dataForTarget(target).scriptForIdentifier(id);}
scriptsForURL(url,target)
{return this.dataForTarget(target).scriptsForURL(url);}
get searchableScripts()
{return this.knownNonResourceScripts.filter((script)=>!!script.contentIdentifier);}
get knownNonResourceScripts()
{let knownScripts=[];for(let[target,targetData]of this._targetDebuggerDataMap){for(let script of targetData.scripts){if(script.resource)
continue;if(!WebInspector.isDebugUIEnabled()&&isWebKitInternalScript(script.sourceURL))
continue;knownScripts.push(script);}}
return knownScripts;}
get asyncStackTraceDepth()
{return this._asyncStackTraceDepthSetting.value;}
set asyncStackTraceDepth(x)
{if(this._asyncStackTraceDepthSetting.value===x)
return;this._asyncStackTraceDepthSetting.value=x;for(let target of WebInspector.targets)
target.DebuggerAgent.setAsyncStackTraceDepth(this._asyncStackTraceDepthSetting.value);}
pause()
{if(this.paused)
return Promise.resolve();this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.WaitingToPause);let listener=new WebInspector.EventListener(this,true);let managerResult=new Promise(function(resolve,reject){listener.connect(WebInspector.debuggerManager,WebInspector.DebuggerManager.Event.Paused,resolve);});let promises=[];for(let[target,targetData]of this._targetDebuggerDataMap)
promises.push(targetData.pauseIfNeeded());return Promise.all([managerResult,...promises]);}
resume()
{if(!this.paused)
return Promise.resolve();let listener=new WebInspector.EventListener(this,true);let managerResult=new Promise(function(resolve,reject){listener.connect(WebInspector.debuggerManager,WebInspector.DebuggerManager.Event.Resumed,resolve);});let promises=[];for(let[target,targetData]of this._targetDebuggerDataMap)
promises.push(targetData.resumeIfNeeded());return Promise.all([managerResult,...promises]);}
stepOver()
{if(!this.paused)
return Promise.reject(new Error("Cannot step over because debugger is not paused."));let listener=new WebInspector.EventListener(this,true);let managerResult=new Promise(function(resolve,reject){listener.connect(WebInspector.debuggerManager,WebInspector.DebuggerManager.Event.ActiveCallFrameDidChange,resolve);});let protocolResult=this._activeCallFrame.target.DebuggerAgent.stepOver().catch(function(error){listener.disconnect();console.error("DebuggerManager.stepOver failed: ",error);throw error;});return Promise.all([managerResult,protocolResult]);}
stepInto()
{if(!this.paused)
return Promise.reject(new Error("Cannot step into because debugger is not paused."));let listener=new WebInspector.EventListener(this,true);let managerResult=new Promise(function(resolve,reject){listener.connect(WebInspector.debuggerManager,WebInspector.DebuggerManager.Event.ActiveCallFrameDidChange,resolve);});let protocolResult=this._activeCallFrame.target.DebuggerAgent.stepInto().catch(function(error){listener.disconnect();console.error("DebuggerManager.stepInto failed: ",error);throw error;});return Promise.all([managerResult,protocolResult]);}
stepOut()
{if(!this.paused)
return Promise.reject(new Error("Cannot step out because debugger is not paused."));let listener=new WebInspector.EventListener(this,true);let managerResult=new Promise(function(resolve,reject){listener.connect(WebInspector.debuggerManager,WebInspector.DebuggerManager.Event.ActiveCallFrameDidChange,resolve);});let protocolResult=this._activeCallFrame.target.DebuggerAgent.stepOut().catch(function(error){listener.disconnect();console.error("DebuggerManager.stepOut failed: ",error);throw error;});return Promise.all([managerResult,protocolResult]);}
continueUntilNextRunLoop(target)
{return this.dataForTarget(target).continueUntilNextRunLoop();}
continueToLocation(script,lineNumber,columnNumber)
{return script.target.DebuggerAgent.continueToLocation({scriptId:script.id,lineNumber,columnNumber});}
addBreakpoint(breakpoint,shouldSpeculativelyResolve)
{if(!breakpoint)
return;if(breakpoint.contentIdentifier){let contentIdentifierBreakpoints=this._breakpointContentIdentifierMap.get(breakpoint.contentIdentifier);if(!contentIdentifierBreakpoints){contentIdentifierBreakpoints=[];this._breakpointContentIdentifierMap.set(breakpoint.contentIdentifier,contentIdentifierBreakpoints);}
contentIdentifierBreakpoints.push(breakpoint);}
if(breakpoint.scriptIdentifier){let scriptIdentifierBreakpoints=this._breakpointScriptIdentifierMap.get(breakpoint.scriptIdentifier);if(!scriptIdentifierBreakpoints){scriptIdentifierBreakpoints=[];this._breakpointScriptIdentifierMap.set(breakpoint.scriptIdentifier,scriptIdentifierBreakpoints);}
scriptIdentifierBreakpoints.push(breakpoint);}
this._breakpoints.push(breakpoint);if(!breakpoint.disabled){const specificTarget=undefined;this._setBreakpoint(breakpoint,specificTarget,()=>{if(shouldSpeculativelyResolve)
breakpoint.resolved=true;});}
this._saveBreakpoints();this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.BreakpointAdded,{breakpoint});}
removeBreakpoint(breakpoint)
{if(!breakpoint)
return;if(!this.isBreakpointRemovable(breakpoint))
return;this._breakpoints.remove(breakpoint);if(breakpoint.identifier)
this._removeBreakpoint(breakpoint);if(breakpoint.contentIdentifier){let contentIdentifierBreakpoints=this._breakpointContentIdentifierMap.get(breakpoint.contentIdentifier);if(contentIdentifierBreakpoints){contentIdentifierBreakpoints.remove(breakpoint);if(!contentIdentifierBreakpoints.length)
this._breakpointContentIdentifierMap.delete(breakpoint.contentIdentifier);}}
if(breakpoint.scriptIdentifier){let scriptIdentifierBreakpoints=this._breakpointScriptIdentifierMap.get(breakpoint.scriptIdentifier);if(scriptIdentifierBreakpoints){scriptIdentifierBreakpoints.remove(breakpoint);if(!scriptIdentifierBreakpoints.length)
this._breakpointScriptIdentifierMap.delete(breakpoint.scriptIdentifier);}}
breakpoint.disabled=true;breakpoint.clearActions();this._saveBreakpoints();this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.BreakpointRemoved,{breakpoint});}
nextBreakpointActionIdentifier()
{return this._nextBreakpointActionIdentifier++;}
initializeTarget(target)
{let DebuggerAgent=target.DebuggerAgent;let targetData=this.dataForTarget(target);DebuggerAgent.enable();DebuggerAgent.setBreakpointsActive(this._breakpointsEnabledSetting.value);DebuggerAgent.setPauseOnAssertions(this._assertionsBreakpointEnabledSetting.value);DebuggerAgent.setPauseOnExceptions(this._breakOnExceptionsState);DebuggerAgent.setAsyncStackTraceDepth(this._asyncStackTraceDepthSetting.value);if(this.paused)
targetData.pauseIfNeeded();this._restoringBreakpoints=true;for(let breakpoint of this._breakpoints){if(breakpoint.disabled)
continue;if(!breakpoint.contentIdentifier)
continue;this._setBreakpoint(breakpoint,target);}
this._restoringBreakpoints=false;}
breakpointResolved(target,breakpointIdentifier,location)
{let breakpoint=this._breakpointIdMap.get(breakpointIdentifier);if(!breakpoint)
return;if(!breakpoint.sourceCodeLocation.sourceCode){let sourceCodeLocation=this._sourceCodeLocationFromPayload(target,location);breakpoint.sourceCodeLocation.sourceCode=sourceCodeLocation.sourceCode;}
breakpoint.resolved=true;}
reset()
{let wasPaused=this.paused;WebInspector.Script.resetUniqueDisplayNameNumbers();this._internalWebKitScripts=[];this._targetDebuggerDataMap.clear();this._ignoreBreakpointDisplayLocationDidChangeEvent=true;
for(let breakpoint of this._breakpoints){breakpoint.resolved=false;if(breakpoint.sourceCodeLocation.sourceCode)
breakpoint.sourceCodeLocation.sourceCode=null;}
this._ignoreBreakpointDisplayLocationDidChangeEvent=false;this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.ScriptsCleared);if(wasPaused)
this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.Resumed);}
debuggerDidPause(target,callFramesPayload,reason,data,asyncStackTracePayload)
{if(this._delayedResumeTimeout){clearTimeout(this._delayedResumeTimeout);this._delayedResumeTimeout=undefined;}
let wasPaused=this.paused;let targetData=this._targetDebuggerDataMap.get(target);let callFrames=[];let pauseReason=this._pauseReasonFromPayload(reason);let pauseData=data||null;for(var i=0;i<callFramesPayload.length;++i){var callFramePayload=callFramesPayload[i];var sourceCodeLocation=this._sourceCodeLocationFromPayload(target,callFramePayload.location);if(!sourceCodeLocation)
continue;if(!sourceCodeLocation.sourceCode)
continue;if(!WebInspector.isDebugUIEnabled()&&isWebKitInternalScript(sourceCodeLocation.sourceCode.sourceURL))
continue;let scopeChain=this._scopeChainFromPayload(target,callFramePayload.scopeChain);let callFrame=WebInspector.CallFrame.fromDebuggerPayload(target,callFramePayload,scopeChain,sourceCodeLocation);callFrames.push(callFrame);}
let activeCallFrame=callFrames[0];if(!activeCallFrame){
if(wasPaused)
target.DebuggerAgent.continueUntilNextRunLoop();else
target.DebuggerAgent.resume();this._didResumeInternal(target);return;}
let asyncStackTrace=WebInspector.StackTrace.fromPayload(target,asyncStackTracePayload);targetData.updateForPause(callFrames,pauseReason,pauseData,asyncStackTrace);for(let[otherTarget,otherTargetData]of this._targetDebuggerDataMap)
otherTargetData.pauseIfNeeded();let activeCallFrameDidChange=this._activeCallFrame&&this._activeCallFrame.target===target;if(activeCallFrameDidChange)
this._activeCallFrame=activeCallFrame;else if(!wasPaused){this._activeCallFrame=activeCallFrame;activeCallFrameDidChange=true;}
if(!wasPaused)
this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.Paused);this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.CallFramesDidChange,{target});if(activeCallFrameDidChange)
this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.ActiveCallFrameDidChange);}
debuggerDidResume(target)
{
if(!DebuggerAgent.setPauseOnAssertions){this._delayedResumeTimeout=setTimeout(this._didResumeInternal.bind(this,target),50);return;}
this._didResumeInternal(target);}
playBreakpointActionSound(breakpointActionIdentifier)
{InspectorFrontendHost.beep();}
scriptDidParse(target,scriptIdentifier,url,startLine,startColumn,endLine,endColumn,isModule,isContentScript,sourceURL,sourceMapURL)
{let targetData=this.dataForTarget(target);let existingScript=targetData.scriptForIdentifier(scriptIdentifier);if(existingScript){return;}
if(!WebInspector.isDebugUIEnabled()&&isWebKitInternalScript(sourceURL))
return;let range=new WebInspector.TextRange(startLine,startColumn,endLine,endColumn);let sourceType=isModule?WebInspector.Script.SourceType.Module:WebInspector.Script.SourceType.Program;let script=new WebInspector.Script(target,scriptIdentifier,range,url,sourceType,isContentScript,sourceURL,sourceMapURL);targetData.addScript(script);if(target!==WebInspector.mainTarget&&!target.mainResource){
if(script.url===target.name){target.mainResource=script;if(script.resource)
target.resourceCollection.remove(script.resource);}}
if(isWebKitInternalScript(script.sourceURL)){this._internalWebKitScripts.push(script);if(!WebInspector.isDebugUIEnabled())
return;}
if(isWebInspectorConsoleEvaluationScript(script.sourceURL))
return;this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.ScriptAdded,{script});if(target!==WebInspector.mainTarget&&!script.isMainResource()&&!script.resource)
target.addScript(script);}
_sourceCodeLocationFromPayload(target,payload)
{let targetData=this.dataForTarget(target);let script=targetData.scriptForIdentifier(payload.scriptId);if(!script)
return null;return script.createSourceCodeLocation(payload.lineNumber,payload.columnNumber);}
_scopeChainFromPayload(target,payload)
{let scopeChain=[];for(let i=0;i<payload.length;++i)
scopeChain.push(this._scopeChainNodeFromPayload(target,payload[i]));return scopeChain;}
_scopeChainNodeFromPayload(target,payload)
{var type=null;switch(payload.type){case DebuggerAgent.ScopeType.Global:type=WebInspector.ScopeChainNode.Type.Global;break;case DebuggerAgent.ScopeType.With:type=WebInspector.ScopeChainNode.Type.With;break;case DebuggerAgent.ScopeType.Closure:type=WebInspector.ScopeChainNode.Type.Closure;break;case DebuggerAgent.ScopeType.Catch:type=WebInspector.ScopeChainNode.Type.Catch;break;case DebuggerAgent.ScopeType.FunctionName:type=WebInspector.ScopeChainNode.Type.FunctionName;break;case DebuggerAgent.ScopeType.NestedLexical:type=WebInspector.ScopeChainNode.Type.Block;break;case DebuggerAgent.ScopeType.GlobalLexicalEnvironment:type=WebInspector.ScopeChainNode.Type.GlobalLexicalEnvironment;break;case DebuggerAgent.ScopeType.Local:type=WebInspector.ScopeChainNode.Type.Closure;break;default:console.error("Unknown type: "+payload.type);}
let object=WebInspector.RemoteObject.fromPayload(payload.object,target);return new WebInspector.ScopeChainNode(type,[object],payload.name,payload.location,payload.empty);}
_pauseReasonFromPayload(payload)
{switch(payload){case DebuggerAgent.PausedReason.Assert:return WebInspector.DebuggerManager.PauseReason.Assertion;case DebuggerAgent.PausedReason.Breakpoint:return WebInspector.DebuggerManager.PauseReason.Breakpoint;case DebuggerAgent.PausedReason.CSPViolation:return WebInspector.DebuggerManager.PauseReason.CSPViolation;case DebuggerAgent.PausedReason.DOM:return WebInspector.DebuggerManager.PauseReason.DOM;case DebuggerAgent.PausedReason.DebuggerStatement:return WebInspector.DebuggerManager.PauseReason.DebuggerStatement;case DebuggerAgent.PausedReason.Exception:return WebInspector.DebuggerManager.PauseReason.Exception;case DebuggerAgent.PausedReason.PauseOnNextStatement:return WebInspector.DebuggerManager.PauseReason.PauseOnNextStatement;case DebuggerAgent.PausedReason.XHR:return WebInspector.DebuggerManager.PauseReason.XHR;default:return WebInspector.DebuggerManager.PauseReason.Other;}}
_debuggerBreakpointActionType(type)
{switch(type){case WebInspector.BreakpointAction.Type.Log:return DebuggerAgent.BreakpointActionType.Log;case WebInspector.BreakpointAction.Type.Evaluate:return DebuggerAgent.BreakpointActionType.Evaluate;case WebInspector.BreakpointAction.Type.Sound:return DebuggerAgent.BreakpointActionType.Sound;case WebInspector.BreakpointAction.Type.Probe:return DebuggerAgent.BreakpointActionType.Probe;default:return DebuggerAgent.BreakpointActionType.Log;}}
_debuggerBreakpointOptions(breakpoint)
{const templatePlaceholderRegex=/\$\{.*?\}/;let options=breakpoint.options;let invalidActions=[];for(let action of options.actions){if(action.type!==WebInspector.BreakpointAction.Type.Log)
continue;if(!templatePlaceholderRegex.test(action.data))
continue;let lexer=new WebInspector.BreakpointLogMessageLexer;let tokens=lexer.tokenize(action.data);if(!tokens){invalidActions.push(action);continue;}
let templateLiteral=tokens.reduce((text,token)=>{if(token.type===WebInspector.BreakpointLogMessageLexer.TokenType.PlainText)
return text+token.data.escapeCharacters("`\\");if(token.type===WebInspector.BreakpointLogMessageLexer.TokenType.Expression)
return text+"${"+token.data+"}";return text;},"");action.data="console.log(`"+templateLiteral+"`)";action.type=WebInspector.BreakpointAction.Type.Evaluate;}
const onlyFirst=true;for(let invalidAction of invalidActions)
options.actions.remove(invalidAction,onlyFirst);return options;}
_setBreakpoint(breakpoint,specificTarget,callback)
{if(breakpoint.disabled)
return;if(!this._restoringBreakpoints&&!this.breakpointsDisabledTemporarily){
this.breakpointsEnabled=true;}
function didSetBreakpoint(target,error,breakpointIdentifier,locations)
{if(error)
return;this._breakpointIdMap.set(breakpointIdentifier,breakpoint);breakpoint.identifier=breakpointIdentifier;if(!(locations instanceof Array))
locations=[locations];for(let location of locations)
this.breakpointResolved(target,breakpointIdentifier,location);if(typeof callback==="function")
callback();}
if(!specificTarget)
breakpoint.resolved=false;let options;if(DebuggerAgent.BreakpointActionType){options=this._debuggerBreakpointOptions(breakpoint);if(options.actions.length){for(let action of options.actions)
action.type=this._debuggerBreakpointActionType(action.type);}}
if(breakpoint.contentIdentifier){let targets=specificTarget?[specificTarget]:WebInspector.targets;for(let target of targets){target.DebuggerAgent.setBreakpointByUrl.invoke({lineNumber:breakpoint.sourceCodeLocation.lineNumber,url:breakpoint.contentIdentifier,urlRegex:undefined,columnNumber:breakpoint.sourceCodeLocation.columnNumber,condition:breakpoint.condition,options},didSetBreakpoint.bind(this,target),target.DebuggerAgent);}}else if(breakpoint.scriptIdentifier){let target=breakpoint.target;target.DebuggerAgent.setBreakpoint.invoke({location:{scriptId:breakpoint.scriptIdentifier,lineNumber:breakpoint.sourceCodeLocation.lineNumber,columnNumber:breakpoint.sourceCodeLocation.columnNumber},condition:breakpoint.condition,options},didSetBreakpoint.bind(this,target),target.DebuggerAgent);}}
_removeBreakpoint(breakpoint,callback)
{if(!breakpoint.identifier)
return;function didRemoveBreakpoint(error)
{if(error)
console.error(error);this._breakpointIdMap.delete(breakpoint.identifier);breakpoint.identifier=null;
if(typeof callback==="function")
callback();}
if(breakpoint.contentIdentifier){for(let target of WebInspector.targets)
target.DebuggerAgent.removeBreakpoint(breakpoint.identifier,didRemoveBreakpoint.bind(this));}else if(breakpoint.scriptIdentifier){let target=breakpoint.target;target.DebuggerAgent.removeBreakpoint(breakpoint.identifier,didRemoveBreakpoint.bind(this));}}
_breakpointDisplayLocationDidChange(event)
{if(this._ignoreBreakpointDisplayLocationDidChangeEvent)
return;let breakpoint=event.target;if(!breakpoint.identifier||breakpoint.disabled)
return;this._removeBreakpoint(breakpoint,breakpointRemoved.bind(this));function breakpointRemoved()
{this._setBreakpoint(breakpoint);this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.BreakpointMoved,{breakpoint});}}
_breakpointDisabledStateDidChange(event)
{this._saveBreakpoints();let breakpoint=event.target;if(breakpoint===this._allExceptionsBreakpoint){if(!breakpoint.disabled&&!this.breakpointsDisabledTemporarily)
this.breakpointsEnabled=true;this._allExceptionsBreakpointEnabledSetting.value=!breakpoint.disabled;this._updateBreakOnExceptionsState();for(let target of WebInspector.targets)
target.DebuggerAgent.setPauseOnExceptions(this._breakOnExceptionsState);return;}
if(breakpoint===this._allUncaughtExceptionsBreakpoint){if(!breakpoint.disabled&&!this.breakpointsDisabledTemporarily)
this.breakpointsEnabled=true;this._allUncaughtExceptionsBreakpointEnabledSetting.value=!breakpoint.disabled;this._updateBreakOnExceptionsState();for(let target of WebInspector.targets)
target.DebuggerAgent.setPauseOnExceptions(this._breakOnExceptionsState);return;}
if(breakpoint===this._assertionsBreakpoint){if(!breakpoint.disabled&&!this.breakpointsDisabledTemporarily)
this.breakpointsEnabled=true;this._assertionsBreakpointEnabledSetting.value=!breakpoint.disabled;for(let target of WebInspector.targets)
target.DebuggerAgent.setPauseOnAssertions(this._assertionsBreakpointEnabledSetting.value);return;}
if(breakpoint.disabled)
this._removeBreakpoint(breakpoint);else
this._setBreakpoint(breakpoint);}
_breakpointEditablePropertyDidChange(event)
{this._saveBreakpoints();let breakpoint=event.target;if(breakpoint.disabled)
return;if(!this.isBreakpointEditable(breakpoint))
return;this._removeBreakpoint(breakpoint,breakpointRemoved.bind(this));function breakpointRemoved()
{this._setBreakpoint(breakpoint);}}
_startDisablingBreakpointsTemporarily()
{if(this.breakpointsDisabledTemporarily)
return;this._temporarilyDisabledBreakpointsRestoreSetting.value=this._breakpointsEnabledSetting.value;this.breakpointsEnabled=false;}
_stopDisablingBreakpointsTemporarily()
{if(!this.breakpointsDisabledTemporarily)
return;let restoreState=this._temporarilyDisabledBreakpointsRestoreSetting.value;this._temporarilyDisabledBreakpointsRestoreSetting.value=null;this.breakpointsEnabled=restoreState;}
_timelineCapturingWillStart(event)
{this._startDisablingBreakpointsTemporarily();if(this.paused)
this.resume();}
_timelineCapturingStopped(event)
{this._stopDisablingBreakpointsTemporarily();}
_targetRemoved(event)
{let wasPaused=this.paused;this._targetDebuggerDataMap.delete(event.data.target);if(!this.paused&&wasPaused)
this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.Resumed);}
_mainResourceDidChange(event)
{if(!event.target.isMainFrame())
return;this._didResumeInternal(WebInspector.mainTarget);}
_didResumeInternal(target)
{if(!this.paused)
return;if(this._delayedResumeTimeout){clearTimeout(this._delayedResumeTimeout);this._delayedResumeTimeout=undefined;}
let activeCallFrameDidChange=false;if(this._activeCallFrame&&this._activeCallFrame.target===target){this._activeCallFrame=null;activeCallFrameDidChange=true;}
this.dataForTarget(target).updateForResume();if(!this.paused)
this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.Resumed);this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.CallFramesDidChange,{target});if(activeCallFrameDidChange)
this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.ActiveCallFrameDidChange);}
_updateBreakOnExceptionsState()
{let state="none";if(this._breakpointsEnabledSetting.value){if(!this._allExceptionsBreakpoint.disabled)
state="all";else if(!this._allUncaughtExceptionsBreakpoint.disabled)
state="uncaught";}
this._breakOnExceptionsState=state;switch(state){case"all":this._allUncaughtExceptionsBreakpoint.resolved=false;break;case"uncaught":case"none":this._allUncaughtExceptionsBreakpoint.resolved=true;break;}}
_saveBreakpoints()
{if(this._restoringBreakpoints)
return;let breakpointsToSave=this._breakpoints.filter((breakpoint)=>!!breakpoint.contentIdentifier);let serializedBreakpoints=breakpointsToSave.map((breakpoint)=>breakpoint.info);this._breakpointsSetting.value=serializedBreakpoints;}
_associateBreakpointsWithSourceCode(breakpoints,sourceCode)
{this._ignoreBreakpointDisplayLocationDidChangeEvent=true;for(let breakpoint of breakpoints){if(!breakpoint.sourceCodeLocation.sourceCode)
breakpoint.sourceCodeLocation.sourceCode=sourceCode;}
this._ignoreBreakpointDisplayLocationDidChangeEvent=false;}
_debugUIEnabledDidChange()
{let eventType=WebInspector.isDebugUIEnabled()?WebInspector.DebuggerManager.Event.ScriptAdded:WebInspector.DebuggerManager.Event.ScriptRemoved;for(let script of this._internalWebKitScripts)
this.dispatchEventToListeners(eventType,{script});}};WebInspector.DebuggerManager.Event={BreakpointAdded:"debugger-manager-breakpoint-added",BreakpointRemoved:"debugger-manager-breakpoint-removed",BreakpointMoved:"debugger-manager-breakpoint-moved",WaitingToPause:"debugger-manager-waiting-to-pause",Paused:"debugger-manager-paused",Resumed:"debugger-manager-resumed",CallFramesDidChange:"debugger-manager-call-frames-did-change",ActiveCallFrameDidChange:"debugger-manager-active-call-frame-did-change",ScriptAdded:"debugger-manager-script-added",ScriptRemoved:"debugger-manager-script-removed",ScriptsCleared:"debugger-manager-scripts-cleared",BreakpointsEnabledDidChange:"debugger-manager-breakpoints-enabled-did-change"};WebInspector.DebuggerManager.PauseReason={Assertion:"assertion",Breakpoint:"breakpoint",CSPViolation:"CSP-violation",DebuggerStatement:"debugger-statement",DOM:"DOM",Exception:"exception",PauseOnNextStatement:"pause-on-next-statement",XHR:"xhr",Other:"other",};WebInspector.DOMBreakpointTreeController=class DOMBreakpointsTreeController extends WebInspector.Object
{constructor(treeOutline)
{super();this._treeOutline=treeOutline;this._breakpointTreeElements=new Map;this._domNodeTreeElements=new Map;WebInspector.DOMBreakpoint.addEventListener(WebInspector.DOMBreakpoint.Event.ResolvedStateDidChange,this._domBreakpointResolvedStateDidChange,this);WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange,this._mainResourceDidChange,this);WebInspector.domDebuggerManager.addEventListener(WebInspector.DOMDebuggerManager.Event.DOMBreakpointAdded,this._domBreakpointAdded,this);WebInspector.domDebuggerManager.addEventListener(WebInspector.DOMDebuggerManager.Event.DOMBreakpointRemoved,this._domBreakpointRemoved,this);}
static appendBreakpointContextMenuItems(contextMenu,domNode,allowEditing)
{let subMenu=contextMenu.appendSubMenuItem(WebInspector.UIString("Break on…"));let breakpoints=WebInspector.domDebuggerManager.domBreakpointsForNode(domNode);let keyValuePairs=breakpoints.map((breakpoint)=>[breakpoint.type,breakpoint]);let breakpointsByType=new Map(keyValuePairs);for(let type of Object.values(WebInspector.DOMBreakpoint.Type)){let label=WebInspector.DOMBreakpointTreeElement.displayNameForType(type);let breakpoint=breakpointsByType.get(type);subMenu.appendCheckboxItem(label,function(){if(breakpoint)
WebInspector.domDebuggerManager.removeDOMBreakpoint(breakpoint);else
WebInspector.domDebuggerManager.addDOMBreakpoint(new WebInspector.DOMBreakpoint(domNode,type));},!!breakpoint,false);}
if(allowEditing){contextMenu.appendSeparator();let shouldEnable=breakpoints.some((breakpoint)=>breakpoint.disabled);let label=shouldEnable?WebInspector.UIString("Enable Breakpoints"):WebInspector.UIString("Disable Breakpoints");contextMenu.appendItem(label,()=>{breakpoints.forEach((breakpoint)=>breakpoint.disabled=!shouldEnable);});contextMenu.appendItem(WebInspector.UIString("Delete Breakpoints"),function(){WebInspector.domDebuggerManager.removeDOMBreakpointsForNode(domNode);});}}
disconnect()
{WebInspector.DOMBreakpoint.removeEventListener(null,null,this);WebInspector.Frame.removeEventListener(null,null,this);WebInspector.domDebuggerManager.removeEventListener(null,null,this);}
_addBreakpointTreeElement(breakpoint)
{let nodeIdentifier=breakpoint.domNodeIdentifier;let parentTreeElement=this._domNodeTreeElements.get(nodeIdentifier);let shouldExpandParent=false;if(!parentTreeElement){let domNode=WebInspector.domTreeManager.nodeForId(nodeIdentifier);parentTreeElement=new WebInspector.DOMNodeTreeElement(domNode);this._treeOutline.appendChild(parentTreeElement);this._domNodeTreeElements.set(nodeIdentifier,parentTreeElement);shouldExpandParent=true;}
let treeElement=new WebInspector.DOMBreakpointTreeElement(breakpoint);parentTreeElement.appendChild(treeElement);if(shouldExpandParent)
parentTreeElement.expand();this._breakpointTreeElements.set(breakpoint,treeElement);}
_removeBreakpointTreeElement(breakpoint)
{let breakpointTreeElement=this._breakpointTreeElements.get(breakpoint);if(!breakpointTreeElement)
return;let domNodeTreeElement=breakpointTreeElement.parent;domNodeTreeElement.removeChild(breakpointTreeElement);this._breakpointTreeElements.delete(breakpoint);if(domNodeTreeElement.hasChildren)
return;this._treeOutline.removeChild(domNodeTreeElement);this._domNodeTreeElements.delete(breakpoint.domNodeIdentifier);}
_domBreakpointAdded(event)
{let breakpoint=event.data.breakpoint;if(!breakpoint.domNodeIdentifier)
return;this._addBreakpointTreeElement(breakpoint);}
_domBreakpointRemoved(event)
{this._removeBreakpointTreeElement(event.data.breakpoint);}
_domBreakpointResolvedStateDidChange(event)
{let breakpoint=event.target;if(breakpoint.domNodeIdentifier)
this._addBreakpointTreeElement(breakpoint);else
this._removeBreakpointTreeElement(breakpoint);}
_mainResourceDidChange(event)
{if(!event.target.isMainFrame())
return;this._treeOutline.removeChildren();this._breakpointTreeElements.clear();this._domNodeTreeElements.clear();}};WebInspector.DragToAdjustController=class DragToAdjustController
{constructor(delegate)
{this._delegate=delegate;this._element=null;this._active=false;this._enabled=false;this._dragging=false;this._tracksMouseClickAndDrag=false;}
get element()
{return this._element;}
set element(element)
{this._element=element;}
get enabled()
{return this._enabled;}
set enabled(enabled)
{if(this._enabled===enabled)
return;if(enabled){this._element.addEventListener("mouseenter",this);this._element.addEventListener("mouseleave",this);}else{this._element.removeEventListener("mouseenter",this);this._element.removeEventListener("mouseleave",this);}}
get active()
{return this._active;}
set active(active)
{if(!this._element)
return;if(this._active===active)
return;if(active){WebInspector.notifications.addEventListener(WebInspector.Notification.GlobalModifierKeysDidChange,this._modifiersDidChange,this);this._element.addEventListener("mousemove",this);}else{WebInspector.notifications.removeEventListener(WebInspector.Notification.GlobalModifierKeysDidChange,this._modifiersDidChange,this);this._element.removeEventListener("mousemove",this);this._setTracksMouseClickAndDrag(false);}
this._active=active;if(this._delegate&&typeof this._delegate.dragToAdjustControllerActiveStateChanged==="function")
this._delegate.dragToAdjustControllerActiveStateChanged(this);}
reset()
{this._setTracksMouseClickAndDrag(false);this._element.classList.remove(WebInspector.DragToAdjustController.StyleClassName);if(this._delegate&&typeof this._delegate.dragToAdjustControllerDidReset==="function")
this._delegate.dragToAdjustControllerDidReset(this);}
handleEvent(event)
{switch(event.type){case"mouseenter":if(!this._dragging){if(this._delegate&&typeof this._delegate.dragToAdjustControllerCanBeActivated==="function")
this.active=this._delegate.dragToAdjustControllerCanBeActivated(this);else
this.active=true;}
break;case"mouseleave":if(!this._dragging)
this.active=false;break;case"mousemove":if(this._dragging)
this._mouseWasDragged(event);else
this._mouseMoved(event);break;case"mousedown":this._mouseWasPressed(event);break;case"mouseup":this._mouseWasReleased(event);break;case"contextmenu":event.preventDefault();break;}}
_setDragging(dragging)
{if(this._dragging===dragging)
return;if(dragging)
WebInspector.elementDragStart(this._element,this,this,window.event,"col-resize",window);else
WebInspector.elementDragEnd(window.event);this._dragging=dragging;}
_setTracksMouseClickAndDrag(tracksMouseClickAndDrag)
{if(this._tracksMouseClickAndDrag===tracksMouseClickAndDrag)
return;if(tracksMouseClickAndDrag){this._element.classList.add(WebInspector.DragToAdjustController.StyleClassName);window.addEventListener("mousedown",this,true);window.addEventListener("contextmenu",this,true);}else{this._element.classList.remove(WebInspector.DragToAdjustController.StyleClassName);window.removeEventListener("mousedown",this,true);window.removeEventListener("contextmenu",this,true);this._setDragging(false);}
this._tracksMouseClickAndDrag=tracksMouseClickAndDrag;}
_modifiersDidChange(event)
{var canBeAdjusted=WebInspector.modifierKeys.altKey;if(canBeAdjusted&&this._delegate&&typeof this._delegate.dragToAdjustControllerCanBeAdjusted==="function")
canBeAdjusted=this._delegate.dragToAdjustControllerCanBeAdjusted(this);this._setTracksMouseClickAndDrag(canBeAdjusted);}
_mouseMoved(event)
{var canBeAdjusted=event.altKey;if(canBeAdjusted&&this._delegate&&typeof this._delegate.dragToAdjustControllerCanAdjustObjectAtPoint==="function")
canBeAdjusted=this._delegate.dragToAdjustControllerCanAdjustObjectAtPoint(this,WebInspector.Point.fromEvent(event));this._setTracksMouseClickAndDrag(canBeAdjusted);}
_mouseWasPressed(event)
{this._lastX=event.screenX;this._setDragging(true);event.preventDefault();event.stopPropagation();}
_mouseWasDragged(event)
{var x=event.screenX;var amount=x-this._lastX;if(Math.abs(amount)<1)
return;this._lastX=x;if(event.ctrlKey)
amount/=10;else if(event.shiftKey)
amount*=10;if(this._delegate&&typeof this._delegate.dragToAdjustControllerWasAdjustedByAmount==="function")
this._delegate.dragToAdjustControllerWasAdjustedByAmount(this,amount);event.preventDefault();event.stopPropagation();}
_mouseWasReleased(event)
{this._setDragging(false);event.preventDefault();event.stopPropagation();this.reset();}};WebInspector.DragToAdjustController.StyleClassName="drag-to-adjust";WebInspector.Formatter=class Formatter
{constructor(codeMirror,builder)
{this._codeMirror=codeMirror;this._builder=builder;this._lastToken=null;this._lastContent="";}
format(from,to)
{if(this._builder.originalContent!==null)
return;var outerMode=this._codeMirror.getMode();var content=this._codeMirror.getRange(from,to);var state=CodeMirror.copyState(outerMode,this._codeMirror.getTokenAt(from).state);this._builder.setOriginalContent(content);var lineOffset=0;var lines=content.split("\n");for(var i=0;i<lines.length;++i){var line=lines[i];var startOfNewLine=true;var firstTokenOnLine=true;var stream=new CodeMirror.StringStream(line);while(!stream.eol()){var innerMode=CodeMirror.innerMode(outerMode,state);var token=outerMode.token(stream,state);var isWhiteSpace=token===null&&/^\s*$/.test(stream.current());this._handleToken(innerMode.mode,token,state,stream,lineOffset+stream.start,isWhiteSpace,startOfNewLine,firstTokenOnLine);stream.start=stream.pos;startOfNewLine=false;if(firstTokenOnLine&&!isWhiteSpace)
firstTokenOnLine=false;}
if(firstTokenOnLine)
this._handleEmptyLine();lineOffset+=line.length+1;this._handleLineEnding(lineOffset-1);}
this._builder.finish();}
_handleToken(mode,token,state,stream,originalPosition,isWhiteSpace,startOfNewLine,firstTokenOnLine)
{var content=stream.current();if(startOfNewLine)
this._builder.appendNewline();if(isWhiteSpace){this._builder.appendSpace();return;}
var isComment=token&&/\bcomment\b/.test(token);if(mode.modifyStateForTokenPre)
mode.modifyStateForTokenPre(this._lastToken,this._lastContent,token,state,content,isComment);if(this._builder.lastTokenWasWhitespace&&mode.removeLastWhitespace(this._lastToken,this._lastContent,token,state,content,isComment))
this._builder.removeLastWhitespace();if(this._builder.lastTokenWasNewline&&mode.removeLastNewline(this._lastToken,this._lastContent,token,state,content,isComment,firstTokenOnLine))
this._builder.removeLastNewline();if(!this._builder.lastTokenWasWhitespace&&mode.shouldHaveSpaceAfterLastToken(this._lastToken,this._lastContent,token,state,content,isComment))
this._builder.appendSpace();if(!this._builder.lastTokenWasWhitespace&&mode.shouldHaveSpaceBeforeToken(this._lastToken,this._lastContent,token,state,content,isComment))
this._builder.appendSpace();var dedents=mode.dedentsBeforeToken(this._lastToken,this._lastContent,token,state,content,isComment);while(dedents-->0)
this._builder.dedent();if(mode.newlineBeforeToken(this._lastToken,this._lastContent,token,state,content,isComment))
this._builder.appendNewline();if(mode.indentBeforeToken(this._lastToken,this._lastContent,token,state,content,isComment))
this._builder.indent();this._builder.appendToken(content,originalPosition);if(mode.modifyStateForTokenPost)
mode.modifyStateForTokenPost(this._lastToken,this._lastContent,token,state,content,isComment);if(!isComment&&mode.indentAfterToken(this._lastToken,this._lastContent,token,state,content,isComment))
this._builder.indent();var newlines=mode.newlinesAfterToken(this._lastToken,this._lastContent,token,state,content,isComment);if(newlines)
this._builder.appendMultipleNewlines(newlines);this._lastToken=token;this._lastContent=content;}
_handleEmptyLine()
{if(!(this._builder.lastTokenWasNewline&&this._builder.lastNewlineAppendWasMultiple))
this._builder.appendNewline(true);}
_handleLineEnding(originalNewLinePosition)
{this._builder.addOriginalLineEnding(originalNewLinePosition);}};WebInspector.FormatterSourceMap=class FormatterSourceMap extends WebInspector.Object
{constructor(originalLineEndings,formattedLineEndings,mapping)
{super();this._originalLineEndings=originalLineEndings;this._formattedLineEndings=formattedLineEndings;this._mapping=mapping;}
static fromSourceMapData({originalLineEndings,formattedLineEndings,mapping})
{return new WebInspector.FormatterSourceMap(originalLineEndings,formattedLineEndings,mapping);}
originalToFormatted(lineNumber,columnNumber)
{var originalPosition=this._locationToPosition(this._originalLineEndings,lineNumber||0,columnNumber||0);return this.originalPositionToFormatted(originalPosition);}
originalPositionToFormatted(originalPosition)
{var formattedPosition=this._convertPosition(this._mapping.original,this._mapping.formatted,originalPosition);return this._positionToLocation(this._formattedLineEndings,formattedPosition);}
formattedToOriginal(lineNumber,columnNumber)
{var originalPosition=this.formattedToOriginalOffset(lineNumber,columnNumber);return this._positionToLocation(this._originalLineEndings,originalPosition);}
formattedToOriginalOffset(lineNumber,columnNumber)
{var formattedPosition=this._locationToPosition(this._formattedLineEndings,lineNumber||0,columnNumber||0);var originalPosition=this._convertPosition(this._mapping.formatted,this._mapping.original,formattedPosition);return originalPosition;}
_locationToPosition(lineEndings,lineNumber,columnNumber)
{var lineOffset=lineNumber?lineEndings[lineNumber-1]+1:0;return lineOffset+columnNumber;}
_positionToLocation(lineEndings,position)
{var lineNumber=lineEndings.upperBound(position-1);if(!lineNumber)
var columnNumber=position;else
var columnNumber=position-lineEndings[lineNumber-1]-1;return{lineNumber,columnNumber};}
_convertPosition(positions1,positions2,positionInPosition1)
{var index=positions1.upperBound(positionInPosition1)-1;var convertedPosition=positions2[index]+positionInPosition1-positions1[index];if(index<positions2.length-1&&convertedPosition>positions2[index+1])
convertedPosition=positions2[index+1];return convertedPosition;}};WebInspector.FrameResourceManager=class FrameResourceManager extends WebInspector.Object
{constructor()
{super();this._frameIdentifierMap=new Map;this._mainFrame=null;this._resourceRequestIdentifierMap=new Map;this._orphanedResources=new Map;this._webSocketIdentifierToURL=new Map;this._waitingForMainFrameResourceTreePayload=true;if(window.PageAgent){PageAgent.enable();PageAgent.getResourceTree(this._processMainFrameResourceTreePayload.bind(this));}
if(window.NetworkAgent)
NetworkAgent.enable();WebInspector.notifications.addEventListener(WebInspector.Notification.ExtraDomainsActivated,this._extraDomainsActivated,this);}
get mainFrame()
{return this._mainFrame;}
get frames()
{return[...this._frameIdentifierMap.values()];}
frameForIdentifier(frameId)
{return this._frameIdentifierMap.get(frameId)||null;}
frameDidNavigate(framePayload)
{if(this._waitingForMainFrameResourceTreePayload)
return;var frameWasLoadedInstantly=false;var frame=this.frameForIdentifier(framePayload.id);if(!frame){
var frameResource=this._addNewResourceToFrameOrTarget(null,framePayload.id,framePayload.loaderId,framePayload.url,null,null,null,null,null,framePayload.name,framePayload.securityOrigin);frame=frameResource.parentFrame;frameWasLoadedInstantly=true;if(!frame)
return;}
if(framePayload.loaderId===frame.provisionalLoaderIdentifier){frame.commitProvisionalLoad(framePayload.securityOrigin);}else{if(frame.mainResource.url!==framePayload.url||frame.loaderIdentifier!==framePayload.loaderId){var mainResource=new WebInspector.Resource(framePayload.url,framePayload.mimeType,null,framePayload.loaderId);}else{var mainResource=frame.mainResource;}
frame.initialize(framePayload.name,framePayload.securityOrigin,framePayload.loaderId,mainResource);}
var oldMainFrame=this._mainFrame;if(framePayload.parentId){var parentFrame=this.frameForIdentifier(framePayload.parentId);if(frame===this._mainFrame)
this._mainFrame=null;if(frame.parentFrame!==parentFrame)
parentFrame.addChildFrame(frame);}else{if(frame.parentFrame)
frame.parentFrame.removeChildFrame(frame);this._mainFrame=frame;}
if(this._mainFrame!==oldMainFrame)
this._mainFrameDidChange(oldMainFrame);if(frameWasLoadedInstantly)
frame.mainResource.markAsFinished();}
frameDidDetach(frameId)
{if(this._waitingForMainFrameResourceTreePayload)
return;var frame=this.frameForIdentifier(frameId);if(!frame)
return;if(frame.parentFrame)
frame.parentFrame.removeChildFrame(frame);this._frameIdentifierMap.delete(frame.id);var oldMainFrame=this._mainFrame;if(frame===this._mainFrame)
this._mainFrame=null;frame.clearExecutionContexts();this.dispatchEventToListeners(WebInspector.FrameResourceManager.Event.FrameWasRemoved,{frame});if(this._mainFrame!==oldMainFrame)
this._mainFrameDidChange(oldMainFrame);}
resourceRequestWillBeSent(requestIdentifier,frameIdentifier,loaderIdentifier,request,type,redirectResponse,timestamp,initiator,targetId)
{if(this._waitingForMainFrameResourceTreePayload)
return;
var originalRequestWillBeSentTimestamp=timestamp;var elapsedTime=WebInspector.timelineManager.computeElapsedTime(timestamp);let resource=this._resourceRequestIdentifierMap.get(requestIdentifier);if(resource){resource.updateForRedirectResponse(request.url,request.headers,elapsedTime);return;}
var initiatorSourceCodeLocation=this._initiatorSourceCodeLocationFromPayload(initiator);resource=this._addNewResourceToFrameOrTarget(requestIdentifier,frameIdentifier,loaderIdentifier,request.url,type,request.method,request.headers,request.postData,elapsedTime,null,null,initiatorSourceCodeLocation,originalRequestWillBeSentTimestamp,targetId);this._resourceRequestIdentifierMap.set(requestIdentifier,resource);}
webSocketCreated(requestId,url)
{this._webSocketIdentifierToURL.set(requestId,url);}
webSocketWillSendHandshakeRequest(requestId,timestamp,walltime,request)
{let url=this._webSocketIdentifierToURL.get(requestId);if(!url)
return;if(!NetworkAgent.hasEventParameter("webSocketWillSendHandshakeRequest","walltime")){request=arguments[2];walltime=NaN;}
let frameIdentifier=WebInspector.frameResourceManager.mainFrame.id;let loaderIdentifier=WebInspector.frameResourceManager.mainFrame.id;let targetId;let frame=this.frameForIdentifier(frameIdentifier);let requestData=null;let elapsedTime=WebInspector.timelineManager.computeElapsedTime(timestamp);let initiatorSourceCodeLocation=null;let resource=new WebInspector.WebSocketResource(url,loaderIdentifier,targetId,requestId,request.headers,requestData,timestamp,walltime,elapsedTime,initiatorSourceCodeLocation);frame.addResource(resource);this._resourceRequestIdentifierMap.set(requestId,resource);}
webSocketHandshakeResponseReceived(requestId,timestamp,response)
{let resource=this._resourceRequestIdentifierMap.get(requestId);if(!resource)
return;resource.readyState=WebInspector.WebSocketResource.ReadyState.Open;let elapsedTime=WebInspector.timelineManager.computeElapsedTime(timestamp); let responseTiming=response.timing||null;resource.updateForResponse(resource.url,resource.mimeType,resource.type,response.headers,response.status,response.statusText,elapsedTime,responseTiming);resource.markAsFinished(elapsedTime);}
webSocketFrameReceived(requestId,timestamp,response)
{this._webSocketFrameReceivedOrSent(requestId,timestamp,response);}
webSocketFrameSent(requestId,timestamp,response)
{this._webSocketFrameReceivedOrSent(requestId,timestamp,response);}
webSocketClosed(requestId,timestamp)
{let resource=this._resourceRequestIdentifierMap.get(requestId);if(!resource)
return;resource.readyState=WebInspector.WebSocketResource.ReadyState.Closed;let elapsedTime=WebInspector.timelineManager.computeElapsedTime(timestamp);resource.markAsFinished(elapsedTime);this._webSocketIdentifierToURL.delete(requestId);this._resourceRequestIdentifierMap.delete(requestId);}
_webSocketFrameReceivedOrSent(requestId,timestamp,response)
{let resource=this._resourceRequestIdentifierMap.get(requestId);if(!resource)
return;let isOutgoing=!!response.mask;let{payloadData,payloadLength,opcode}=response;let elapsedTime=WebInspector.timelineManager.computeElapsedTime(timestamp);resource.addFrame(payloadData,payloadLength,isOutgoing,opcode,timestamp,elapsedTime);}
markResourceRequestAsServedFromMemoryCache(requestIdentifier)
{if(this._waitingForMainFrameResourceTreePayload)
return;let resource=this._resourceRequestIdentifierMap.get(requestIdentifier);
if(!resource)
return;resource.legacyMarkServedFromMemoryCache();}
resourceRequestWasServedFromMemoryCache(requestIdentifier,frameIdentifier,loaderIdentifier,cachedResourcePayload,timestamp,initiator)
{if(this._waitingForMainFrameResourceTreePayload)
return;let elapsedTime=WebInspector.timelineManager.computeElapsedTime(timestamp);let initiatorSourceCodeLocation=this._initiatorSourceCodeLocationFromPayload(initiator);let response=cachedResourcePayload.response;const responseSource=NetworkAgent.ResponseSource.MemoryCache;let resource=this._addNewResourceToFrameOrTarget(requestIdentifier,frameIdentifier,loaderIdentifier,cachedResourcePayload.url,cachedResourcePayload.type,"GET",null,null,elapsedTime,null,null,initiatorSourceCodeLocation);resource.updateForResponse(cachedResourcePayload.url,response.mimeType,cachedResourcePayload.type,response.headers,response.status,response.statusText,elapsedTime,response.timing,responseSource);resource.increaseSize(cachedResourcePayload.bodySize,elapsedTime);resource.increaseTransferSize(cachedResourcePayload.bodySize);resource.setCachedResponseBodySize(cachedResourcePayload.bodySize);resource.markAsFinished(elapsedTime);if(cachedResourcePayload.sourceMapURL)
WebInspector.sourceMapManager.downloadSourceMap(cachedResourcePayload.sourceMapURL,resource.url,resource);
}
resourceRequestDidReceiveResponse(requestIdentifier,frameIdentifier,loaderIdentifier,type,response,timestamp)
{if(this._waitingForMainFrameResourceTreePayload)
return;var elapsedTime=WebInspector.timelineManager.computeElapsedTime(timestamp);let resource=this._resourceRequestIdentifierMap.get(requestIdentifier);
if(!resource){var frame=this.frameForIdentifier(frameIdentifier);if(frame)
resource=frame.resourceForURL(response.url);if(resource){this._resourceRequestIdentifierMap.set(requestIdentifier,resource);resource.revertMarkAsFinished();}}
if(!resource){resource=this._addNewResourceToFrameOrTarget(requestIdentifier,frameIdentifier,loaderIdentifier,response.url,type,null,response.requestHeaders,null,elapsedTime,null,null,null);this._resourceRequestIdentifierMap.set(requestIdentifier,resource);}
if(response.fromDiskCache)
resource.legacyMarkServedFromDiskCache();resource.updateForResponse(response.url,response.mimeType,type,response.headers,response.status,response.statusText,elapsedTime,response.timing,response.source);}
resourceRequestDidReceiveData(requestIdentifier,dataLength,encodedDataLength,timestamp)
{if(this._waitingForMainFrameResourceTreePayload)
return;let resource=this._resourceRequestIdentifierMap.get(requestIdentifier);var elapsedTime=WebInspector.timelineManager.computeElapsedTime(timestamp);
if(!resource)
return;resource.increaseSize(dataLength,elapsedTime);if(encodedDataLength!==-1)
resource.increaseTransferSize(encodedDataLength);}
resourceRequestDidFinishLoading(requestIdentifier,timestamp,sourceMapURL,metrics)
{if(this._waitingForMainFrameResourceTreePayload)
return;
let resource=this._resourceRequestIdentifierMap.get(requestIdentifier);if(!resource)
return;if(metrics)
resource.updateWithMetrics(metrics);let elapsedTime=WebInspector.timelineManager.computeElapsedTime(timestamp);resource.markAsFinished(elapsedTime);if(sourceMapURL)
WebInspector.sourceMapManager.downloadSourceMap(sourceMapURL,resource.url,resource);this._resourceRequestIdentifierMap.delete(requestIdentifier);}
resourceRequestDidFailLoading(requestIdentifier,canceled,timestamp,errorText)
{if(this._waitingForMainFrameResourceTreePayload)
return;
let resource=this._resourceRequestIdentifierMap.get(requestIdentifier);if(!resource)
return;let elapsedTime=WebInspector.timelineManager.computeElapsedTime(timestamp);resource.markAsFailed(canceled,elapsedTime,errorText);if(resource===resource.parentFrame.provisionalMainResource)
resource.parentFrame.clearProvisionalLoad();this._resourceRequestIdentifierMap.delete(requestIdentifier);}
executionContextCreated(contextPayload)
{var frame=this.frameForIdentifier(contextPayload.frameId);if(!frame)
return;var displayName=contextPayload.name||frame.mainResource.displayName;var executionContext=new WebInspector.ExecutionContext(WebInspector.mainTarget,contextPayload.id,displayName,contextPayload.isPageContext,frame);frame.addExecutionContext(executionContext);}
resourceForURL(url)
{if(!this._mainFrame)
return null;if(this._mainFrame.mainResource.url===url)
return this._mainFrame.mainResource;return this._mainFrame.resourceForURL(url,true);}
adoptOrphanedResourcesForTarget(target)
{let resources=this._orphanedResources.take(target.identifier);if(!resources)
return;for(let resource of resources)
target.adoptResource(resource);}
_addNewResourceToFrameOrTarget(requestIdentifier,frameIdentifier,loaderIdentifier,url,type,requestMethod,requestHeaders,requestData,elapsedTime,frameName,frameSecurityOrigin,initiatorSourceCodeLocation,originalRequestWillBeSentTimestamp,targetId)
{let resource=null;let frame=this.frameForIdentifier(frameIdentifier);if(frame){if(frame.mainResource.url===url&&frame.loaderIdentifier===loaderIdentifier)
resource=frame.mainResource;else if(frame.provisionalMainResource&&frame.provisionalMainResource.url===url&&frame.provisionalLoaderIdentifier===loaderIdentifier)
resource=frame.provisionalMainResource;else{resource=new WebInspector.Resource(url,null,type,loaderIdentifier,targetId,requestIdentifier,requestMethod,requestHeaders,requestData,elapsedTime,initiatorSourceCodeLocation,originalRequestWillBeSentTimestamp);if(resource.target===WebInspector.mainTarget)
this._addResourceToFrame(frame,resource);else if(resource.target)
resource.target.addResource(resource);else
this._addOrphanedResource(resource,targetId);}}else{resource=new WebInspector.Resource(url,null,type,loaderIdentifier,targetId,requestIdentifier,requestMethod,requestHeaders,requestData,elapsedTime,initiatorSourceCodeLocation,originalRequestWillBeSentTimestamp);frame=new WebInspector.Frame(frameIdentifier,frameName,frameSecurityOrigin,loaderIdentifier,resource);this._frameIdentifierMap.set(frame.id,frame);
if(!this._mainFrame){this._mainFrame=frame;this._mainFrameDidChange(null);}
this._dispatchFrameWasAddedEvent(frame);}
return resource;}
_addResourceToFrame(frame,resource)
{if(this._waitingForMainFrameResourceTreePayload)
return;if(resource.loaderIdentifier!==frame.loaderIdentifier&&!frame.provisionalLoaderIdentifier){frame.startProvisionalLoad(resource);return;}
frame.addResource(resource);}
_addResourceToTarget(target,resource)
{target.addResource(resource);}
_initiatorSourceCodeLocationFromPayload(initiatorPayload)
{if(!initiatorPayload)
return null;var url=null;var lineNumber=NaN;var columnNumber=0;if(initiatorPayload.stackTrace&&initiatorPayload.stackTrace.length){var stackTracePayload=initiatorPayload.stackTrace;for(var i=0;i<stackTracePayload.length;++i){var callFramePayload=stackTracePayload[i];if(!callFramePayload.url||callFramePayload.url==="[native code]")
continue;url=callFramePayload.url;lineNumber=callFramePayload.lineNumber-1;columnNumber=callFramePayload.columnNumber;break;}}else if(initiatorPayload.url){url=initiatorPayload.url;lineNumber=initiatorPayload.lineNumber-1;}
if(!url||isNaN(lineNumber)||lineNumber<0)
return null;var sourceCode=WebInspector.frameResourceManager.resourceForURL(url);if(!sourceCode)
sourceCode=WebInspector.debuggerManager.scriptsForURL(url,WebInspector.mainTarget)[0];if(!sourceCode)
return null;return sourceCode.createSourceCodeLocation(lineNumber,columnNumber);}
_processMainFrameResourceTreePayload(error,mainFramePayload)
{delete this._waitingForMainFrameResourceTreePayload;if(error){console.error(JSON.stringify(error));return;}
this._resourceRequestIdentifierMap=new Map;this._frameIdentifierMap=new Map;var oldMainFrame=this._mainFrame;this._mainFrame=this._addFrameTreeFromFrameResourceTreePayload(mainFramePayload,true);if(this._mainFrame!==oldMainFrame)
this._mainFrameDidChange(oldMainFrame);}
_createFrame(payload)
{
var mainResource=new WebInspector.Resource(payload.url||"about:blank",payload.mimeType,null,payload.loaderId);var frame=new WebInspector.Frame(payload.id,payload.name,payload.securityOrigin,payload.loaderId,mainResource);this._frameIdentifierMap.set(frame.id,frame);mainResource.markAsFinished();return frame;}
_createResource(payload,framePayload)
{var resource=new WebInspector.Resource(payload.url,payload.mimeType,payload.type,framePayload.loaderId,payload.targetId);if(payload.sourceMapURL)
WebInspector.sourceMapManager.downloadSourceMap(payload.sourceMapURL,resource.url,resource);return resource;}
_addFrameTreeFromFrameResourceTreePayload(payload,isMainFrame)
{var frame=this._createFrame(payload.frame);if(isMainFrame)
frame.markAsMainFrame();for(var i=0;payload.childFrames&&i<payload.childFrames.length;++i)
frame.addChildFrame(this._addFrameTreeFromFrameResourceTreePayload(payload.childFrames[i],false));for(var i=0;payload.resources&&i<payload.resources.length;++i){var resourcePayload=payload.resources[i];
if(resourcePayload.type==="Document"&&resourcePayload.url===payload.frame.url)
continue;var resource=this._createResource(resourcePayload,payload);if(resource.target===WebInspector.mainTarget)
frame.addResource(resource);else if(resource.target)
resource.target.addResource(resource);else
this._addOrphanedResource(resource,resourcePayload.targetId);if(resourcePayload.failed||resourcePayload.canceled)
resource.markAsFailed(resourcePayload.canceled);else
resource.markAsFinished();}
this._dispatchFrameWasAddedEvent(frame);return frame;}
_addOrphanedResource(resource,targetId)
{let resources=this._orphanedResources.get(targetId);if(!resources){resources=[];this._orphanedResources.set(targetId,resources);}
resources.push(resource);}
_dispatchFrameWasAddedEvent(frame)
{this.dispatchEventToListeners(WebInspector.FrameResourceManager.Event.FrameWasAdded,{frame});}
_mainFrameDidChange(oldMainFrame)
{if(oldMainFrame)
oldMainFrame.unmarkAsMainFrame();if(this._mainFrame)
this._mainFrame.markAsMainFrame();this.dispatchEventToListeners(WebInspector.FrameResourceManager.Event.MainFrameDidChange,{oldMainFrame});}
_extraDomainsActivated(event)
{if(event.data.domains.includes("Page")&&window.PageAgent)
PageAgent.getResourceTree(this._processMainFrameResourceTreePayload.bind(this));}};WebInspector.FrameResourceManager.Event={FrameWasAdded:"frame-resource-manager-frame-was-added",FrameWasRemoved:"frame-resource-manager-frame-was-removed",MainFrameDidChange:"frame-resource-manager-main-frame-did-change",};WebInspector.HeapManager=class HeapManager extends WebInspector.Object
{constructor()
{super();if(window.HeapAgent)
HeapAgent.enable();}
garbageCollected(target,payload)
{ if(target!==WebInspector.mainTarget)
return;let collection=WebInspector.GarbageCollection.fromPayload(payload);this.dispatchEventToListeners(WebInspector.HeapManager.Event.GarbageCollected,{collection});}};WebInspector.HeapManager.Event={GarbageCollected:"heap-manager-garbage-collected"};WebInspector.IssueManager=class IssueManager extends WebInspector.Object
{constructor()
{super();WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange,this._mainResourceDidChange,this);WebInspector.logManager.addEventListener(WebInspector.LogManager.Event.Cleared,this._logCleared,this);this.initialize();}
static issueMatchSourceCode(issue,sourceCode)
{if(sourceCode instanceof WebInspector.SourceMapResource)
return issue.sourceCodeLocation&&issue.sourceCodeLocation.displaySourceCode===sourceCode;if(sourceCode instanceof WebInspector.Resource)
return issue.url===sourceCode.url&&(!issue.sourceCodeLocation||issue.sourceCodeLocation.sourceCode===sourceCode);if(sourceCode instanceof WebInspector.Script)
return issue.sourceCodeLocation&&issue.sourceCodeLocation.sourceCode===sourceCode;return false;}
initialize()
{this._issues=[];this.dispatchEventToListeners(WebInspector.IssueManager.Event.Cleared);}
issueWasAdded(consoleMessage)
{let issue=new WebInspector.IssueMessage(consoleMessage);this._issues.push(issue);this.dispatchEventToListeners(WebInspector.IssueManager.Event.IssueWasAdded,{issue});}
issuesForSourceCode(sourceCode)
{var issues=[];for(var i=0;i<this._issues.length;++i){var issue=this._issues[i];if(WebInspector.IssueManager.issueMatchSourceCode(issue,sourceCode))
issues.push(issue);}
return issues;}
_logCleared(event)
{this.initialize();}
_mainResourceDidChange(event)
{if(!event.target.isMainFrame())
return;this.initialize();}};WebInspector.IssueManager.Event={IssueWasAdded:"issue-manager-issue-was-added",Cleared:"issue-manager-cleared"};WebInspector.JavaScriptLogViewController=class JavaScriptLogViewController extends WebInspector.Object
{constructor(element,scrollElement,textPrompt,delegate,historySettingIdentifier)
{super();this._element=element;this._scrollElement=scrollElement;this._promptHistorySetting=new WebInspector.Setting(historySettingIdentifier,null);this._prompt=textPrompt;this._prompt.delegate=this;this._prompt.history=this._promptHistorySetting.value;this.delegate=delegate;this._cleared=true;this._previousMessageView=null;this._lastCommitted="";this._repeatCountWasInterrupted=false;this._sessions=[];this.messagesAlternateClearKeyboardShortcut=new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.Control,"L",this.requestClearMessages.bind(this),this._element);this._messagesFindNextKeyboardShortcut=new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl,"G",this._handleFindNextShortcut.bind(this),this._element);this._messagesFindPreviousKeyboardShortcut=new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl|WebInspector.KeyboardShortcut.Modifier.Shift,"G",this._handleFindPreviousShortcut.bind(this),this._element);this._promptAlternateClearKeyboardShortcut=new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.Control,"L",this.requestClearMessages.bind(this),this._prompt.element);this._promptFindNextKeyboardShortcut=new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl,"G",this._handleFindNextShortcut.bind(this),this._prompt.element);this._promptFindPreviousKeyboardShortcut=new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl|WebInspector.KeyboardShortcut.Modifier.Shift,"G",this._handleFindPreviousShortcut.bind(this),this._prompt.element);this._pendingMessages=[];this._scheduledRenderIdentifier=0;this.startNewSession();}
get prompt()
{return this._prompt;}
get currentConsoleGroup()
{return this._currentConsoleGroup;}
clear()
{this._cleared=true;const clearPreviousSessions=true;this.startNewSession(clearPreviousSessions,{newSessionReason:WebInspector.ConsoleSession.NewSessionReason.ConsoleCleared});}
startNewSession(clearPreviousSessions=false,data={})
{if(this._sessions.length&&clearPreviousSessions){for(var i=0;i<this._sessions.length;++i)
this._element.removeChild(this._sessions[i].element);this._sessions=[];this._currentConsoleGroup=null;}
if(!this._sessions.length)
data.timestamp=Date.now();let lastSession=this._sessions.lastValue;if(lastSession&&!lastSession.hasMessages()){this._sessions.pop();lastSession.element.remove();}
let consoleSession=new WebInspector.ConsoleSession(data);this._previousMessageView=null;this._lastCommitted="";this._repeatCountWasInterrupted=false;this._sessions.push(consoleSession);this._currentConsoleGroup=consoleSession;this._element.appendChild(consoleSession.element);consoleSession.element.scrollIntoView();}
appendImmediateExecutionWithResult(text,result,addSpecialUserLogClass,shouldRevealConsole)
{var commandMessageView=new WebInspector.ConsoleCommandView(text,addSpecialUserLogClass?"special-user-log":null);this._appendConsoleMessageView(commandMessageView,true);function saveResultCallback(savedResultIndex)
{let commandResultMessage=new WebInspector.ConsoleCommandResultMessage(result.target,result,false,savedResultIndex,shouldRevealConsole);let commandResultMessageView=new WebInspector.ConsoleMessageView(commandResultMessage);this._appendConsoleMessageView(commandResultMessageView,true);}
WebInspector.runtimeManager.saveResult(result,saveResultCallback.bind(this));}
appendConsoleMessage(consoleMessage)
{var consoleMessageView=new WebInspector.ConsoleMessageView(consoleMessage);this._appendConsoleMessageView(consoleMessageView);return consoleMessageView;}
updatePreviousMessageRepeatCount(count)
{if(!this._previousMessageView)
return false;var previousIgnoredCount=this._previousMessageView[WebInspector.JavaScriptLogViewController.IgnoredRepeatCount]||0;var previousVisibleCount=this._previousMessageView.repeatCount;if(!this._repeatCountWasInterrupted){this._previousMessageView.repeatCount=count-previousIgnoredCount;return true;}
var consoleMessage=this._previousMessageView.message;var duplicatedConsoleMessageView=new WebInspector.ConsoleMessageView(consoleMessage);duplicatedConsoleMessageView[WebInspector.JavaScriptLogViewController.IgnoredRepeatCount]=previousIgnoredCount+previousVisibleCount;duplicatedConsoleMessageView.repeatCount=1;this._appendConsoleMessageView(duplicatedConsoleMessageView);return true;}
isScrolledToBottom()
{return this._scrollToBottomTimeout||this._scrollElement.isScrolledToBottom();}
scrollToBottom()
{if(this._scrollToBottomTimeout)
return;function delayedWork()
{this._scrollToBottomTimeout=null;this._scrollElement.scrollTop=this._scrollElement.scrollHeight;}
this._scrollToBottomTimeout=setTimeout(delayedWork.bind(this),0);}
requestClearMessages()
{WebInspector.logManager.requestClearMessages();}
consolePromptHistoryDidChange(prompt)
{this._promptHistorySetting.value=this.prompt.history;}
consolePromptShouldCommitText(prompt,text,cursorIsAtLastPosition,handler)
{if(!cursorIsAtLastPosition){handler(true);return;}
function parseFinished(error,result,message,range)
{handler(result!==RuntimeAgent.SyntaxErrorType.Recoverable);}
WebInspector.runtimeManager.activeExecutionContext.target.RuntimeAgent.parse(text,parseFinished.bind(this));}
consolePromptTextCommitted(prompt,text)
{if(this._lastCommitted!==text){let commandMessageView=new WebInspector.ConsoleCommandView(text);this._appendConsoleMessageView(commandMessageView,true);this._lastCommitted=text;}
function printResult(result,wasThrown,savedResultIndex)
{if(!result||this._cleared)
return;let shouldRevealConsole=true;let commandResultMessage=new WebInspector.ConsoleCommandResultMessage(result.target,result,wasThrown,savedResultIndex,shouldRevealConsole);let commandResultMessageView=new WebInspector.ConsoleMessageView(commandResultMessage);this._appendConsoleMessageView(commandResultMessageView,true);}
let options={objectGroup:WebInspector.RuntimeManager.ConsoleObjectGroup,includeCommandLineAPI:true,doNotPauseOnExceptionsAndMuteConsole:false,returnByValue:false,generatePreview:true,saveResult:true,sourceURLAppender:appendWebInspectorConsoleEvaluationSourceURL,};WebInspector.runtimeManager.evaluateInInspectedWindow(text,options,printResult.bind(this));}
_handleFindNextShortcut()
{this.delegate.highlightNextSearchMatch();}
_handleFindPreviousShortcut()
{this.delegate.highlightPreviousSearchMatch();}
_appendConsoleMessageView(messageView,repeatCountWasInterrupted)
{this._pendingMessages.push(messageView);this._cleared=false;this._repeatCountWasInterrupted=repeatCountWasInterrupted||false;if(!repeatCountWasInterrupted)
this._previousMessageView=messageView;if(messageView.message&&messageView.message.source!==WebInspector.ConsoleMessage.MessageSource.JS)
this._lastCommitted="";if(WebInspector.consoleContentView.visible)
this.renderPendingMessagesSoon();if(!WebInspector.isShowingConsoleTab()&&messageView.message&&messageView.message.shouldRevealConsole)
WebInspector.showSplitConsole();}
renderPendingMessages()
{if(this._scheduledRenderIdentifier){cancelAnimationFrame(this._scheduledRenderIdentifier);this._scheduledRenderIdentifier=0;}
if(this._pendingMessages.length===0)
return;const maxMessagesPerFrame=100;let messages=this._pendingMessages.splice(0,maxMessagesPerFrame);let lastMessageView=messages.lastValue;let isCommandView=lastMessageView instanceof WebInspector.ConsoleCommandView;let shouldScrollToBottom=isCommandView||lastMessageView.message.type===WebInspector.ConsoleMessage.MessageType.Result||this.isScrolledToBottom();for(let messageView of messages){messageView.render();this._didRenderConsoleMessageView(messageView);}
if(shouldScrollToBottom)
this.scrollToBottom();WebInspector.quickConsole.needsLayout();if(this._pendingMessages.length>0)
this.renderPendingMessagesSoon();}
renderPendingMessagesSoon()
{if(this._scheduledRenderIdentifier)
return;this._scheduledRenderIdentifier=requestAnimationFrame(()=>this.renderPendingMessages());}
_didRenderConsoleMessageView(messageView)
{var type=messageView instanceof WebInspector.ConsoleCommandView?null:messageView.message.type;if(type===WebInspector.ConsoleMessage.MessageType.EndGroup){var parentGroup=this._currentConsoleGroup.parentGroup;if(parentGroup)
this._currentConsoleGroup=parentGroup;}else{if(type===WebInspector.ConsoleMessage.MessageType.StartGroup||type===WebInspector.ConsoleMessage.MessageType.StartGroupCollapsed){var group=new WebInspector.ConsoleGroup(this._currentConsoleGroup);var groupElement=group.render(messageView);this._currentConsoleGroup.append(groupElement);this._currentConsoleGroup=group;}else
this._currentConsoleGroup.addMessageView(messageView);}
if(this.delegate&&typeof this.delegate.didAppendConsoleMessageView==="function")
this.delegate.didAppendConsoleMessageView(messageView);}};WebInspector.JavaScriptLogViewController.CachedPropertiesDuration=30000;WebInspector.JavaScriptLogViewController.IgnoredRepeatCount=Symbol("ignored-repeat-count");Object.defineProperty(WebInspector,"javaScriptRuntimeCompletionProvider",{get:function()
{if(!WebInspector.JavaScriptRuntimeCompletionProvider._instance)
WebInspector.JavaScriptRuntimeCompletionProvider._instance=new WebInspector.JavaScriptRuntimeCompletionProvider;return WebInspector.JavaScriptRuntimeCompletionProvider._instance;}});WebInspector.JavaScriptRuntimeCompletionProvider=class JavaScriptRuntimeCompletionProvider extends WebInspector.Object
{constructor()
{super();WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ActiveCallFrameDidChange,this._clearLastProperties,this);}
completionControllerCompletionsNeeded(completionController,defaultCompletions,base,prefix,suffix,forced)
{if(!forced&&!prefix&&!/[.[]$/.test(base)){completionController.updateCompletions(null);return;}
if(/[({]$/.test(base))
base="";var lastBaseIndex=base.length-1;var dotNotation=base[lastBaseIndex]===".";var bracketNotation=base[lastBaseIndex]==="[";if(dotNotation||bracketNotation){base=base.substring(0,lastBaseIndex);if(!base&&dotNotation){completionController.updateCompletions(defaultCompletions);return;}
if(!forced&&!prefix&&dotNotation&&base.indexOf(".")===-1&&parseInt(base,10)==base){completionController.updateCompletions(null);return;}
if(!base&&bracketNotation)
bracketNotation=false;}
if(this._lastBase===base&&this._lastPropertyNames){receivedPropertyNames.call(this,this._lastPropertyNames);return;}
this._lastBase=base;this._lastPropertyNames=null;var activeCallFrame=WebInspector.debuggerManager.activeCallFrame;if(!base&&activeCallFrame&&!this._alwaysEvaluateInWindowContext)
activeCallFrame.collectScopeChainVariableNames(receivedPropertyNames.bind(this));else{let options={objectGroup:"completion",includeCommandLineAPI:true,doNotPauseOnExceptionsAndMuteConsole:true,returnByValue:false,generatePreview:false,saveResult:false};WebInspector.runtimeManager.evaluateInInspectedWindow(base,options,evaluated.bind(this));}
function updateLastPropertyNames(propertyNames)
{if(this._clearLastPropertiesTimeout)
clearTimeout(this._clearLastPropertiesTimeout);this._clearLastPropertiesTimeout=setTimeout(this._clearLastProperties.bind(this),WebInspector.JavaScriptLogViewController.CachedPropertiesDuration);this._lastPropertyNames=propertyNames||{};}
function evaluated(result,wasThrown)
{if(wasThrown||!result||result.type==="undefined"||(result.type==="object"&&result.subtype==="null")){WebInspector.runtimeManager.activeExecutionContext.target.RuntimeAgent.releaseObjectGroup("completion");updateLastPropertyNames.call(this,{});completionController.updateCompletions(defaultCompletions);return;}
function inspectedPage_evalResult_getArrayCompletions(primitiveType)
{var array=this;var arrayLength;var resultSet={};for(var o=array;o;o=o.__proto__){try{if(o===array&&o.length){arrayLength=o.length;}else{var names=Object.getOwnPropertyNames(o);for(var i=0;i<names.length;++i)
resultSet[names[i]]=true;}}catch(e){}}
if(arrayLength)
resultSet["length"]=arrayLength;return resultSet;}
function inspectedPage_evalResult_getCompletions(primitiveType)
{var object;if(primitiveType==="string")
object=new String("");else if(primitiveType==="number")
object=new Number(0);else if(primitiveType==="boolean")
object=new Boolean(false);else if(primitiveType==="symbol")
object=Symbol();else
object=this;var resultSet={};for(var o=object;o;o=o.__proto__){try{var names=Object.getOwnPropertyNames(o);for(var i=0;i<names.length;++i)
resultSet[names[i]]=true;}catch(e){}}
return resultSet;}
if(result.subtype==="array")
result.callFunctionJSON(inspectedPage_evalResult_getArrayCompletions,undefined,receivedArrayPropertyNames.bind(this));else if(result.type==="object"||result.type==="function")
result.callFunctionJSON(inspectedPage_evalResult_getCompletions,undefined,receivedPropertyNames.bind(this));else if(result.type==="string"||result.type==="number"||result.type==="boolean"||result.type==="symbol"){let options={objectGroup:"completion",includeCommandLineAPI:false,doNotPauseOnExceptionsAndMuteConsole:true,returnByValue:false,generatePreview:false,saveResult:false};WebInspector.runtimeManager.evaluateInInspectedWindow("("+inspectedPage_evalResult_getCompletions+")(\""+result.type+"\")",options,receivedPropertyNamesFromEvaluate.bind(this));}else
console.error("Unknown result type: "+result.type);}
function receivedPropertyNamesFromEvaluate(object,wasThrown,result)
{receivedPropertyNames.call(this,result&&!wasThrown?result.value:null);}
function receivedArrayPropertyNames(propertyNames)
{
if(propertyNames&&typeof propertyNames.length==="number"){var max=Math.min(propertyNames.length,1000);for(var i=0;i<max;++i)
propertyNames[i]=true;}
receivedPropertyNames.call(this,propertyNames);}
function receivedPropertyNames(propertyNames)
{propertyNames=propertyNames||{};updateLastPropertyNames.call(this,propertyNames);WebInspector.runtimeManager.activeExecutionContext.target.RuntimeAgent.releaseObjectGroup("completion");if(!base){var commandLineAPI=["$","$$","$x","dir","dirxml","keys","values","profile","profileEnd","monitorEvents","unmonitorEvents","inspect","copy","clear","getEventListeners","$0","$_"];if(WebInspector.debuggerManager.paused){let targetData=WebInspector.debuggerManager.dataForTarget(WebInspector.runtimeManager.activeExecutionContext.target);if(targetData.pauseReason===WebInspector.DebuggerManager.PauseReason.Exception)
commandLineAPI.push("$exception");}
for(var i=0;i<commandLineAPI.length;++i)
propertyNames[commandLineAPI[i]]=true;for(var i=1;i<=WebInspector.ConsoleCommandResultMessage.maximumSavedResultIndex;++i)
propertyNames["$"+i]=true;}
propertyNames=Object.keys(propertyNames);var implicitSuffix="";if(bracketNotation){var quoteUsed=prefix[0]==="'"?"'":"\"";if(suffix!=="]"&&suffix!==quoteUsed)
implicitSuffix="]";}
var completions=defaultCompletions;var knownCompletions=completions.keySet();for(var i=0;i<propertyNames.length;++i){var property=propertyNames[i];if(dotNotation&&!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(property))
continue;if(bracketNotation){if(parseInt(property)!=property)
property=quoteUsed+property.escapeCharacters(quoteUsed+"\\")+(suffix!==quoteUsed?quoteUsed:"");}
if(!property.startsWith(prefix)||property in knownCompletions)
continue;completions.push(property);knownCompletions[property]=true;}
function compare(a,b)
{let numericCompareResult=a-b;if(!isNaN(numericCompareResult))
return numericCompareResult;let aRareProperty=a.startsWith("__")&&a.endsWith("__");let bRareProperty=b.startsWith("__")&&b.endsWith("__");if(aRareProperty&&!bRareProperty)
return 1;if(!aRareProperty&&bRareProperty)
return-1;return a.extendedLocaleCompare(b);}
completions.sort(compare);completionController.updateCompletions(completions,implicitSuffix);}}
_clearLastProperties()
{if(this._clearLastPropertiesTimeout){clearTimeout(this._clearLastPropertiesTimeout);delete this._clearLastPropertiesTimeout;}
this._lastPropertyNames=null;}};WebInspector.LayerTreeManager=class LayerTreeManager extends WebInspector.Object
{constructor()
{super();this._supported=!!window.LayerTreeAgent;if(this._supported)
LayerTreeAgent.enable();}
get supported()
{return this._supported;}
layerTreeMutations(previousLayers,newLayers)
{if(isEmptyObject(previousLayers)){return{preserved:[],additions:newLayers,removals:[]};}
function nodeIdForLayer(layer)
{return layer.isGeneratedContent?layer.pseudoElementId:layer.nodeId;}
var layerIdsInPreviousLayers=[];var nodeIdsInPreviousLayers=[];var nodeIdsForReflectionsInPreviousLayers=[];previousLayers.forEach(function(layer){layerIdsInPreviousLayers.push(layer.layerId);var nodeId=nodeIdForLayer(layer);if(!nodeId)
return;if(layer.isReflection)
nodeIdsForReflectionsInPreviousLayers.push(nodeId);else
nodeIdsInPreviousLayers.push(nodeId);});var preserved=[];var additions=[];var layerIdsInNewLayers=[];var nodeIdsInNewLayers=[];var nodeIdsForReflectionsInNewLayers=[];newLayers.forEach(function(layer){layerIdsInNewLayers.push(layer.layerId);var existed=layerIdsInPreviousLayers.includes(layer.layerId);var nodeId=nodeIdForLayer(layer);if(!nodeId)
return;if(layer.isReflection){nodeIdsForReflectionsInNewLayers.push(nodeId);existed=existed||nodeIdsForReflectionsInPreviousLayers.includes(nodeId);}else{nodeIdsInNewLayers.push(nodeId);existed=existed||nodeIdsInPreviousLayers.includes(nodeId);}
if(existed)
preserved.push(layer);else
additions.push(layer);});var removals=previousLayers.filter(function(layer){var nodeId=nodeIdForLayer(layer);if(layer.isReflection)
return!nodeIdsForReflectionsInNewLayers.includes(nodeId);else
return!nodeIdsInNewLayers.includes(nodeId)&&!layerIdsInNewLayers.includes(layer.layerId);});return{preserved,additions,removals};}
layersForNode(node,callback)
{LayerTreeAgent.layersForNode(node.id,function(error,layers){if(error||isEmptyObject(layers)){callback(null,[]);return;}
var firstLayer=layers[0];var layerForNode=firstLayer.nodeId===node.id&&!firstLayer.isGeneratedContent?layers.shift():null;callback(layerForNode,layers);});}
reasonsForCompositingLayer(layer,callback)
{LayerTreeAgent.reasonsForCompositingLayer(layer.layerId,function(error,reasons){callback(error?0:reasons);});}
layerTreeDidChange()
{this.dispatchEventToListeners(WebInspector.LayerTreeManager.Event.LayerTreeDidChange);}};WebInspector.LayerTreeManager.Event={LayerTreeDidChange:"layer-tree-did-change"};WebInspector.LogManager=class LogManager extends WebInspector.Object
{constructor()
{super();this._clearMessagesRequested=false;this._isNewPageOrReload=false;WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange,this._mainResourceDidChange,this);}
messageWasAdded(target,source,level,text,type,url,line,column,repeatCount,parameters,stackTrace,requestId)
{if(parameters)
parameters=parameters.map((x)=>WebInspector.RemoteObject.fromPayload(x,target));let message=new WebInspector.ConsoleMessage(target,source,level,text,type,url,line,column,repeatCount,parameters,stackTrace,null);this.dispatchEventToListeners(WebInspector.LogManager.Event.MessageAdded,{message});if(message.level==="warning"||message.level==="error")
WebInspector.issueManager.issueWasAdded(message);}
messagesCleared()
{WebInspector.ConsoleCommandResultMessage.clearMaximumSavedResultIndex();if(this._clearMessagesRequested){this._clearMessagesRequested=false;this.dispatchEventToListeners(WebInspector.LogManager.Event.Cleared);}else{setTimeout(this._delayedMessagesCleared.bind(this),0);}}
_delayedMessagesCleared()
{if(this._isNewPageOrReload){this._isNewPageOrReload=false;if(!WebInspector.settings.clearLogOnNavigate.value)
return;}
this.dispatchEventToListeners(WebInspector.LogManager.Event.Cleared);}
messageRepeatCountUpdated(count)
{this.dispatchEventToListeners(WebInspector.LogManager.Event.PreviousMessageRepeatCountUpdated,{count});}
requestClearMessages()
{this._clearMessagesRequested=true;for(let target of WebInspector.targets)
target.ConsoleAgent.clearMessages();}
_mainResourceDidChange(event)
{if(!event.target.isMainFrame())
return;this._isNewPageOrReload=true;let timestamp=Date.now();let wasReloaded=event.data.oldMainResource&&event.data.oldMainResource.url===event.target.mainResource.url;this.dispatchEventToListeners(WebInspector.LogManager.Event.SessionStarted,{timestamp,wasReloaded});WebInspector.ConsoleCommandResultMessage.clearMaximumSavedResultIndex();}};WebInspector.LogManager.Event={SessionStarted:"log-manager-session-was-started",Cleared:"log-manager-cleared",MessageAdded:"log-manager-message-added",PreviousMessageRepeatCountUpdated:"log-manager-previous-message-repeat-count-updated"};WebInspector.MemoryManager=class MemoryManager extends WebInspector.Object
{constructor()
{super();if(window.MemoryAgent)
MemoryAgent.enable();}
memoryPressure(timestamp,protocolSeverity)
{let memoryPressureEvent=WebInspector.MemoryPressureEvent.fromPayload(timestamp,protocolSeverity);this.dispatchEventToListeners(WebInspector.MemoryManager.Event.MemoryPressure,{memoryPressureEvent});}};WebInspector.MemoryManager.Event={MemoryPressure:"memory-manager-memory-pressure",};WebInspector.ProbeManager=class ProbeManager extends WebInspector.Object
{constructor()
{super();this._knownProbeIdentifiersForBreakpoint=new Map;this._probesByIdentifier=new Map;this._probeSetsByBreakpoint=new Map;WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.BreakpointAdded,this._breakpointAdded,this);WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.BreakpointRemoved,this._breakpointRemoved,this);WebInspector.Breakpoint.addEventListener(WebInspector.Breakpoint.Event.ActionsDidChange,this._breakpointActionsChanged,this);
}
get probeSets()
{return[...this._probeSetsByBreakpoint.values()];}
probeForIdentifier(identifier)
{return this._probesByIdentifier.get(identifier);}
didSampleProbe(target,sample)
{let probe=this._probesByIdentifier.get(sample.probeId);let elapsedTime=WebInspector.timelineManager.computeElapsedTime(sample.timestamp);let object=WebInspector.RemoteObject.fromPayload(sample.payload,target);probe.addSample(new WebInspector.ProbeSample(sample.sampleId,sample.batchId,elapsedTime,object));}
_breakpointAdded(breakpointOrEvent)
{var breakpoint;if(breakpointOrEvent instanceof WebInspector.Breakpoint)
breakpoint=breakpointOrEvent;else
breakpoint=breakpointOrEvent.data.breakpoint;if(this._knownProbeIdentifiersForBreakpoint.has(breakpoint))
return;this._knownProbeIdentifiersForBreakpoint.set(breakpoint,new Set);this._breakpointActionsChanged(breakpoint);}
_breakpointRemoved(event)
{var breakpoint=event.data.breakpoint;this._breakpointActionsChanged(breakpoint);this._knownProbeIdentifiersForBreakpoint.delete(breakpoint);}
_breakpointActionsChanged(breakpointOrEvent)
{var breakpoint;if(breakpointOrEvent instanceof WebInspector.Breakpoint)
breakpoint=breakpointOrEvent;else
breakpoint=breakpointOrEvent.target;if(!this._knownProbeIdentifiersForBreakpoint.has(breakpoint)){this._breakpointAdded(breakpoint);return;}
var knownProbeIdentifiers=this._knownProbeIdentifiersForBreakpoint.get(breakpoint);var seenProbeIdentifiers=new Set;breakpoint.probeActions.forEach(function(probeAction){var probeIdentifier=probeAction.id;seenProbeIdentifiers.add(probeIdentifier);if(!knownProbeIdentifiers.has(probeIdentifier)){knownProbeIdentifiers.add(probeIdentifier);var probeSet=this._probeSetForBreakpoint(breakpoint);var newProbe=new WebInspector.Probe(probeIdentifier,breakpoint,probeAction.data);this._probesByIdentifier.set(probeIdentifier,newProbe);probeSet.addProbe(newProbe);return;}
var probe=this._probesByIdentifier.get(probeIdentifier);probe.expression=probeAction.data;},this);knownProbeIdentifiers.forEach(function(probeIdentifier){if(seenProbeIdentifiers.has(probeIdentifier))
return;var probeSet=this._probeSetForBreakpoint(breakpoint);var probe=this._probesByIdentifier.get(probeIdentifier);this._probesByIdentifier.delete(probeIdentifier);knownProbeIdentifiers.delete(probeIdentifier);probeSet.removeProbe(probe);if(!probeSet.probes.length){this._probeSetsByBreakpoint.delete(probeSet.breakpoint);probeSet.willRemove();this.dispatchEventToListeners(WebInspector.ProbeManager.Event.ProbeSetRemoved,{probeSet});}},this);}
_probeSetForBreakpoint(breakpoint)
{if(this._probeSetsByBreakpoint.has(breakpoint))
return this._probeSetsByBreakpoint.get(breakpoint);var newProbeSet=new WebInspector.ProbeSet(breakpoint);this._probeSetsByBreakpoint.set(breakpoint,newProbeSet);this.dispatchEventToListeners(WebInspector.ProbeManager.Event.ProbeSetAdded,{probeSet:newProbeSet});return newProbeSet;}};WebInspector.ProbeManager.Event={ProbeSetAdded:"probe-manager-probe-set-added",ProbeSetRemoved:"probe-manager-probe-set-removed",};WebInspector.ResourceQueryController=class ResourceQueryController extends WebInspector.Object
{constructor()
{super();this._resourceDataMap=new Map;}
addResource(resource)
{this._resourceDataMap.set(resource,{});}
removeResource(resource)
{this._resourceDataMap.delete(resource);}
reset()
{this._resourceDataMap.clear();}
executeQuery(query)
{if(!query||!this._resourceDataMap.size)
return[];query=query.removeWhitespace().toLowerCase();let cookie=null;if(query.includes(":")){let[newQuery,lineNumber,columnNumber]=query.split(":");query=newQuery;lineNumber=lineNumber?parseInt(lineNumber,10)-1:0;columnNumber=columnNumber?parseInt(columnNumber,10)-1:0;cookie={lineNumber,columnNumber};}
let results=[];for(let[resource,cachedData]of this._resourceDataMap){if(!cachedData.searchString){let displayName=resource.displayName;cachedData.searchString=displayName.toLowerCase();cachedData.specialCharacterIndices=this._findSpecialCharacterIndices(displayName);}
let matches=this._findQueryMatches(query,cachedData.searchString,cachedData.specialCharacterIndices);if(matches.length)
results.push(new WebInspector.ResourceQueryResult(resource,matches,cookie));}
return results.sort((a,b)=>{if(a.rank===b.rank)
return a.resource.displayName.extendedLocaleCompare(b.resource.displayName);return b.rank-a.rank;});}
_findQueryMatches(query,searchString,specialCharacterIndices)
{let matches=[];let queryIndex=0;let searchIndex=0;let specialIndex=0;let deadBranches=new Array(query.length).fill(Infinity);let type=WebInspector.ResourceQueryMatch.Type.Special;function pushMatch(index)
{matches.push(new WebInspector.ResourceQueryMatch(type,index,queryIndex));searchIndex=index+1;queryIndex++;}
function matchNextSpecialCharacter()
{if(specialIndex>=specialCharacterIndices.length)
return false;let originalSpecialIndex=specialIndex;while(specialIndex<specialCharacterIndices.length){
let index=specialCharacterIndices[specialIndex++];if(index<searchIndex)
continue;if(query[queryIndex]===searchString[index]){pushMatch(index);return true;}}
specialIndex=originalSpecialIndex;return false;}
function backtrack()
{while(matches.length){queryIndex--;let lastMatch=matches.pop();if(lastMatch.type!==WebInspector.ResourceQueryMatch.Type.Special)
continue;deadBranches[lastMatch.queryIndex]=lastMatch.index;searchIndex=matches.lastValue?matches.lastValue.index+1:0;return true;}
return false;}
while(queryIndex<query.length&&searchIndex<searchString.length){if(type===WebInspector.ResourceQueryMatch.Type.Special&&!matchNextSpecialCharacter())
type=WebInspector.ResourceQueryMatch.Type.Normal;if(type===WebInspector.ResourceQueryMatch.Type.Normal){let index=searchString.indexOf(query[queryIndex],searchIndex);if(index>=0&&index<deadBranches[queryIndex]){pushMatch(index);type=WebInspector.ResourceQueryMatch.Type.Special;}else if(!backtrack())
return[];}}
if(queryIndex<query.length)
return[];return matches;}
_findSpecialCharacterIndices(string)
{if(!string.length)
return[];const filenameSeparators="_.-";let indices=[0];for(let i=1;i<string.length;++i){let character=string[i];let isSpecial=false;if(filenameSeparators.includes(character))
isSpecial=true;else{let previousCharacter=string[i-1];let previousCharacterIsSeparator=filenameSeparators.includes(previousCharacter);if(previousCharacterIsSeparator)
isSpecial=true;else if(character.isUpperCase()&&previousCharacter.isLowerCase())
isSpecial=true;}
if(isSpecial)
indices.push(i);}
return indices;}};WebInspector.RuntimeManager=class RuntimeManager extends WebInspector.Object
{constructor()
{super();RuntimeAgent.enable();this._activeExecutionContext=WebInspector.mainTarget.executionContext;WebInspector.Frame.addEventListener(WebInspector.Frame.Event.ExecutionContextsCleared,this._frameExecutionContextsCleared,this);}
get activeExecutionContext()
{return this._activeExecutionContext;}
set activeExecutionContext(executionContext)
{if(this._activeExecutionContext===executionContext)
return;this._activeExecutionContext=executionContext;this.dispatchEventToListeners(WebInspector.RuntimeManager.Event.ActiveExecutionContextChanged);}
evaluateInInspectedWindow(expression,options,callback)
{let{objectGroup,includeCommandLineAPI,doNotPauseOnExceptionsAndMuteConsole,returnByValue,generatePreview,saveResult,sourceURLAppender}=options;includeCommandLineAPI=includeCommandLineAPI||false;doNotPauseOnExceptionsAndMuteConsole=doNotPauseOnExceptionsAndMuteConsole||false;returnByValue=returnByValue||false;generatePreview=generatePreview||false;saveResult=saveResult||false;sourceURLAppender=sourceURLAppender||appendWebInspectorSourceURL;if(!expression){expression="this";}else if(/^\s*\{/.test(expression)&&/\}\s*$/.test(expression)){expression="("+expression+")";}else if(/\bawait\b/.test(expression)){expression=this._tryApplyAwaitConvenience(expression);}
expression=sourceURLAppender(expression);let target=this._activeExecutionContext.target;let executionContextId=this._activeExecutionContext.id;if(WebInspector.debuggerManager.activeCallFrame){target=WebInspector.debuggerManager.activeCallFrame.target;executionContextId=target.executionContext.id;}
function evalCallback(error,result,wasThrown,savedResultIndex)
{this.dispatchEventToListeners(WebInspector.RuntimeManager.Event.DidEvaluate,{objectGroup});if(error){console.error(error);callback(null,false);return;}
if(returnByValue)
callback(null,wasThrown,wasThrown?null:result,savedResultIndex);else
callback(WebInspector.RemoteObject.fromPayload(result,target),wasThrown,savedResultIndex);}
if(WebInspector.debuggerManager.activeCallFrame){target.DebuggerAgent.evaluateOnCallFrame.invoke({callFrameId:WebInspector.debuggerManager.activeCallFrame.id,expression,objectGroup,includeCommandLineAPI,doNotPauseOnExceptionsAndMuteConsole,returnByValue,generatePreview,saveResult},evalCallback.bind(this),target.DebuggerAgent);return;}
target.RuntimeAgent.evaluate.invoke({expression,objectGroup,includeCommandLineAPI,doNotPauseOnExceptionsAndMuteConsole,contextId:executionContextId,returnByValue,generatePreview,saveResult},evalCallback.bind(this),target.RuntimeAgent);}
saveResult(remoteObject,callback)
{if(!RuntimeAgent.saveResult){callback(undefined);return;}
function mycallback(error,savedResultIndex)
{callback(savedResultIndex);}
let target=this._activeExecutionContext.target;let executionContextId=this._activeExecutionContext.id;if(remoteObject.objectId)
target.RuntimeAgent.saveResult(remoteObject.asCallArgument(),mycallback);else
target.RuntimeAgent.saveResult(remoteObject.asCallArgument(),executionContextId,mycallback);}
getPropertiesForRemoteObject(objectId,callback)
{this._activeExecutionContext.target.RuntimeAgent.getProperties(objectId,function(error,result){if(error){callback(error);return;}
let properties=new Map;for(let property of result)
properties.set(property.name,property);callback(null,properties);});}
_frameExecutionContextsCleared(event)
{let contexts=event.data.contexts||[];let currentContextWasDestroyed=contexts.some((context)=>context.id===this._activeExecutionContext.id);if(currentContextWasDestroyed)
this.activeExecutionContext=WebInspector.mainTarget.executionContext;}
_tryApplyAwaitConvenience(originalExpression)
{let esprimaSyntaxTree;try{esprima.parse(originalExpression);return originalExpression;}catch(error){}
try{esprimaSyntaxTree=esprima.parse("(async function(){"+originalExpression+"})");}catch(error){return originalExpression;}
let asyncFunctionBlock=esprimaSyntaxTree.body[0].expression.body;if(asyncFunctionBlock.body.length!==1)
return originalExpression;let variableName;let anonymous=false;let declarationKind="var";let awaitPortion;let statement=asyncFunctionBlock.body[0];if(statement.type==="ExpressionStatement"&&statement.expression.type==="AwaitExpression"){anonymous=true;}else if(statement.type==="ExpressionStatement"&&statement.expression.type==="AssignmentExpression"&&statement.expression.right.type==="AwaitExpression"&&statement.expression.left.type==="Identifier"){variableName=statement.expression.left.name;awaitPortion=originalExpression.substring(originalExpression.indexOf("await"));}else if(statement.type==="VariableDeclaration"&&statement.declarations.length===1&&statement.declarations[0].init.type==="AwaitExpression"&&statement.declarations[0].id.type==="Identifier"){variableName=statement.declarations[0].id.name;declarationKind=statement.kind;awaitPortion=originalExpression.substring(originalExpression.indexOf("await"));}else{return originalExpression;}
if(anonymous){return`
(async function() {
try {
let result = ${originalExpression};
console.info("%o", result);
} catch (e) {
console.error(e);
}
})();
undefined`;}
return`${declarationKind} ${variableName};
(async function() {
try {
${variableName} = ${awaitPortion};
console.info("%o", ${variableName});
} catch (e) {
console.error(e);
}
})();
undefined;`;}};WebInspector.RuntimeManager.ConsoleObjectGroup="console";WebInspector.RuntimeManager.TopLevelExecutionContextIdentifier=undefined;WebInspector.RuntimeManager.Event={DidEvaluate:Symbol("runtime-manager-did-evaluate"),DefaultExecutionContextChanged:Symbol("runtime-manager-default-execution-context-changed"),ActiveExecutionContextChanged:Symbol("runtime-manager-active-execution-context-changed"),};WebInspector.SourceMapManager=class SourceMapManager extends WebInspector.Object
{constructor()
{super();this._sourceMapURLMap={};this._downloadingSourceMaps={};WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange,this._mainResourceDidChange,this);}
sourceMapForURL(sourceMapURL)
{return this._sourceMapURLMap[sourceMapURL];}
downloadSourceMap(sourceMapURL,baseURL,originalSourceCode)
{
if(WebInspector.frameResourceManager.mainFrame)
baseURL=absoluteURL(baseURL,WebInspector.frameResourceManager.mainFrame.url);if(sourceMapURL.startsWith("data:")){this._loadAndParseSourceMap(sourceMapURL,baseURL,originalSourceCode);return;}
sourceMapURL=absoluteURL(sourceMapURL,baseURL);if(!sourceMapURL)
return;if(!originalSourceCode.url)
return; if(sourceMapURL in this._sourceMapURLMap)
return;if(sourceMapURL in this._downloadingSourceMaps)
return;function loadAndParseSourceMap()
{this._loadAndParseSourceMap(sourceMapURL,baseURL,originalSourceCode);}
if(!WebInspector.frameResourceManager.mainFrame){setTimeout(loadAndParseSourceMap.bind(this),0);return;}
loadAndParseSourceMap.call(this);}
_loadAndParseSourceMap(sourceMapURL,baseURL,originalSourceCode)
{this._downloadingSourceMaps[sourceMapURL]=true;function sourceMapLoaded(error,content,mimeType,statusCode)
{if(error||statusCode>=400){this._loadAndParseFailed(sourceMapURL);return;}
if(content.slice(0,3)===")]}"){var firstNewlineIndex=content.indexOf("\n");if(firstNewlineIndex===-1){this._loadAndParseFailed(sourceMapURL);return;}
content=content.substring(firstNewlineIndex);}
try{var payload=JSON.parse(content);var baseURL=sourceMapURL.startsWith("data:")?originalSourceCode.url:sourceMapURL;var sourceMap=new WebInspector.SourceMap(baseURL,payload,originalSourceCode);this._loadAndParseSucceeded(sourceMapURL,sourceMap);}catch(e){this._loadAndParseFailed(sourceMapURL);}}
if(sourceMapURL.startsWith("data:")){let{mimeType,base64,data}=parseDataURL(sourceMapURL);let content=base64?atob(data):data;sourceMapLoaded.call(this,null,content,mimeType,0);return;}
if(!window.NetworkAgent||!NetworkAgent.loadResource){this._loadAndParseFailed(sourceMapURL);return;}
var frameIdentifier=null;if(originalSourceCode instanceof WebInspector.Resource&&originalSourceCode.parentFrame)
frameIdentifier=originalSourceCode.parentFrame.id;if(!frameIdentifier)
frameIdentifier=WebInspector.frameResourceManager.mainFrame.id;NetworkAgent.loadResource(frameIdentifier,sourceMapURL,sourceMapLoaded.bind(this));}
_loadAndParseFailed(sourceMapURL)
{delete this._downloadingSourceMaps[sourceMapURL];}
_loadAndParseSucceeded(sourceMapURL,sourceMap)
{if(!(sourceMapURL in this._downloadingSourceMaps))
return;delete this._downloadingSourceMaps[sourceMapURL];this._sourceMapURLMap[sourceMapURL]=sourceMap;var sources=sourceMap.sources();for(var i=0;i<sources.length;++i){var sourceMapResource=new WebInspector.SourceMapResource(sources[i],sourceMap);sourceMap.addResource(sourceMapResource);}
sourceMap.originalSourceCode.addSourceMap(sourceMap);if(!(sourceMap.originalSourceCode instanceof WebInspector.Resource)){var resource=sourceMap.originalSourceCode.resource;if(resource)
resource.addSourceMap(sourceMap);}}
_mainResourceDidChange(event)
{if(!event.target.isMainFrame())
return;this._sourceMapURLMap={};this._downloadingSourceMaps={};}};WebInspector.StorageManager=class StorageManager extends WebInspector.Object
{constructor()
{super();if(window.DOMStorageAgent)
DOMStorageAgent.enable();if(window.DatabaseAgent)
DatabaseAgent.enable();if(window.IndexedDBAgent)
IndexedDBAgent.enable();WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange,this._mainResourceDidChange,this);WebInspector.Frame.addEventListener(WebInspector.Frame.Event.SecurityOriginDidChange,this._securityOriginDidChange,this);this.initialize();}
initialize()
{this._domStorageObjects=[];this._databaseObjects=[];this._indexedDatabases=[];this._cookieStorageObjects={};}
get domStorageObjects()
{return this._domStorageObjects;}
get databases()
{return this._databaseObjects;}
get indexedDatabases()
{return this._indexedDatabases;}
get cookieStorageObjects()
{var cookieStorageObjects=[];for(var host in this._cookieStorageObjects)
cookieStorageObjects.push(this._cookieStorageObjects[host]);return cookieStorageObjects;}
domStorageWasAdded(id,host,isLocalStorage)
{var domStorage=new WebInspector.DOMStorageObject(id,host,isLocalStorage);this._domStorageObjects.push(domStorage);this.dispatchEventToListeners(WebInspector.StorageManager.Event.DOMStorageObjectWasAdded,{domStorage});}
databaseWasAdded(id,host,name,version)
{var database=new WebInspector.DatabaseObject(id,host,name,version);this._databaseObjects.push(database);this.dispatchEventToListeners(WebInspector.StorageManager.Event.DatabaseWasAdded,{database});}
itemsCleared(storageId)
{let domStorage=this._domStorageForIdentifier(storageId);if(domStorage)
domStorage.itemsCleared(storageId);}
itemRemoved(storageId,key)
{let domStorage=this._domStorageForIdentifier(storageId);if(domStorage)
domStorage.itemRemoved(key);}
itemAdded(storageId,key,value)
{let domStorage=this._domStorageForIdentifier(storageId);if(domStorage)
domStorage.itemAdded(key,value);}
itemUpdated(storageId,key,oldValue,value)
{let domStorage=this._domStorageForIdentifier(storageId);if(domStorage)
domStorage.itemUpdated(key,oldValue,value);}
inspectDatabase(id)
{var database=this._databaseForIdentifier(id);if(!database)
return;this.dispatchEventToListeners(WebInspector.StorageManager.Event.DatabaseWasInspected,{database});}
inspectDOMStorage(id)
{var domStorage=this._domStorageForIdentifier(id);if(!domStorage)
return;this.dispatchEventToListeners(WebInspector.StorageManager.Event.DOMStorageObjectWasInspected,{domStorage});}
requestIndexedDatabaseData(objectStore,objectStoreIndex,startEntryIndex,maximumEntryCount,callback)
{function processData(error,entryPayloads,moreAvailable)
{if(error){callback(null,false);return;}
var entries=[];for(var entryPayload of entryPayloads){var entry={};entry.primaryKey=WebInspector.RemoteObject.fromPayload(entryPayload.primaryKey);entry.key=WebInspector.RemoteObject.fromPayload(entryPayload.key);entry.value=WebInspector.RemoteObject.fromPayload(entryPayload.value);entries.push(entry);}
callback(entries,moreAvailable);}
var requestArguments={securityOrigin:objectStore.parentDatabase.securityOrigin,databaseName:objectStore.parentDatabase.name,objectStoreName:objectStore.name,indexName:objectStoreIndex&&objectStoreIndex.name||"",skipCount:startEntryIndex||0,pageSize:maximumEntryCount||100};IndexedDBAgent.requestData.invoke(requestArguments,processData);}
clearObjectStore(objectStore)
{let securityOrigin=objectStore.parentDatabase.securityOrigin;let databaseName=objectStore.parentDatabase.name;let objectStoreName=objectStore.name;IndexedDBAgent.clearObjectStore(securityOrigin,databaseName,objectStoreName);}
_domStorageForIdentifier(id)
{for(var storageObject of this._domStorageObjects){if(Object.shallowEqual(storageObject.id,id))
return storageObject;}
return null;}
_mainResourceDidChange(event)
{if(event.target.isMainFrame()){this.initialize();this.dispatchEventToListeners(WebInspector.StorageManager.Event.Cleared);this._addDOMStorageIfNeeded(event.target);this._addIndexedDBDatabasesIfNeeded(event.target);}
var host=parseURL(event.target.url).host;if(!host)
return;if(this._cookieStorageObjects[host])
return;this._cookieStorageObjects[host]=new WebInspector.CookieStorageObject(host);this.dispatchEventToListeners(WebInspector.StorageManager.Event.CookieStorageObjectWasAdded,{cookieStorage:this._cookieStorageObjects[host]});}
_addDOMStorageIfNeeded(frame)
{if(!window.DOMStorageAgent)
return;if(!frame.securityOrigin||frame.securityOrigin==="://")
return;var localStorageIdentifier={securityOrigin:frame.securityOrigin,isLocalStorage:true};if(!this._domStorageForIdentifier(localStorageIdentifier))
this.domStorageWasAdded(localStorageIdentifier,frame.mainResource.urlComponents.host,true);var sessionStorageIdentifier={securityOrigin:frame.securityOrigin,isLocalStorage:false};if(!this._domStorageForIdentifier(sessionStorageIdentifier))
this.domStorageWasAdded(sessionStorageIdentifier,frame.mainResource.urlComponents.host,false);}
_addIndexedDBDatabasesIfNeeded(frame)
{if(!window.IndexedDBAgent)
return;var securityOrigin=frame.securityOrigin;if(!securityOrigin||securityOrigin==="://")
return;function processDatabaseNames(error,names)
{if(error||!names)
return;for(var name of names)
IndexedDBAgent.requestDatabase(securityOrigin,name,processDatabase.bind(this));}
function processDatabase(error,databasePayload)
{if(error||!databasePayload)
return;var objectStores=databasePayload.objectStores.map(processObjectStore);var indexedDatabase=new WebInspector.IndexedDatabase(databasePayload.name,securityOrigin,databasePayload.version,objectStores);this._indexedDatabases.push(indexedDatabase);this.dispatchEventToListeners(WebInspector.StorageManager.Event.IndexedDatabaseWasAdded,{indexedDatabase});}
function processKeyPath(keyPathPayload)
{switch(keyPathPayload.type){case IndexedDBAgent.KeyPathType.Null:return null;case IndexedDBAgent.KeyPathType.String:return keyPathPayload.string;case IndexedDBAgent.KeyPathType.Array:return keyPathPayload.array;default:console.error("Unknown KeyPath type:",keyPathPayload.type);return null;}}
function processObjectStore(objectStorePayload)
{var keyPath=processKeyPath(objectStorePayload.keyPath);var indexes=objectStorePayload.indexes.map(processObjectStoreIndex);return new WebInspector.IndexedDatabaseObjectStore(objectStorePayload.name,keyPath,objectStorePayload.autoIncrement,indexes);}
function processObjectStoreIndex(objectStoreIndexPayload)
{var keyPath=processKeyPath(objectStoreIndexPayload.keyPath);return new WebInspector.IndexedDatabaseObjectStoreIndex(objectStoreIndexPayload.name,keyPath,objectStoreIndexPayload.unique,objectStoreIndexPayload.multiEntry);}
IndexedDBAgent.requestDatabaseNames(securityOrigin,processDatabaseNames.bind(this));}
_securityOriginDidChange(event)
{this._addDOMStorageIfNeeded(event.target);this._addIndexedDBDatabasesIfNeeded(event.target);}
_databaseForIdentifier(id)
{for(var i=0;i<this._databaseObjects.length;++i){if(this._databaseObjects[i].id===id)
return this._databaseObjects[i];}
return null;}};WebInspector.StorageManager.Event={CookieStorageObjectWasAdded:"storage-manager-cookie-storage-object-was-added",DOMStorageObjectWasAdded:"storage-manager-dom-storage-object-was-added",DOMStorageObjectWasInspected:"storage-dom-object-was-inspected",DatabaseWasAdded:"storage-manager-database-was-added",DatabaseWasInspected:"storage-object-was-inspected",IndexedDatabaseWasAdded:"storage-manager-indexed-database-was-added",Cleared:"storage-manager-cleared"};WebInspector.TargetManager=class TargetManager extends WebInspector.Object
{constructor()
{super();this._targets=new Set([WebInspector.mainTarget]);}
get targets()
{return this._targets;}
targetForIdentifier(targetId)
{if(!targetId)
return null;for(let target of this._targets){if(target.identifier===targetId)
return target;}
return null;}
addTarget(target)
{this._targets.add(target);this.dispatchEventToListeners(WebInspector.TargetManager.Event.TargetAdded,{target});}
removeTarget(target)
{this._targets.delete(target);this.dispatchEventToListeners(WebInspector.TargetManager.Event.TargetRemoved,{target});}};WebInspector.TargetManager.Event={TargetAdded:Symbol("target-manager-target-added"),TargetRemoved:Symbol("target-manager-target-removed"),};WebInspector.TimelineManager=class TimelineManager extends WebInspector.Object
{constructor()
{super();WebInspector.Frame.addEventListener(WebInspector.Frame.Event.ProvisionalLoadStarted,this._provisionalLoadStarted,this);WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange,this._mainResourceDidChange,this);WebInspector.Frame.addEventListener(WebInspector.Frame.Event.ResourceWasAdded,this._resourceWasAdded,this);WebInspector.Target.addEventListener(WebInspector.Target.Event.ResourceAdded,this._resourceWasAdded,this);WebInspector.heapManager.addEventListener(WebInspector.HeapManager.Event.GarbageCollected,this._garbageCollected,this);WebInspector.memoryManager.addEventListener(WebInspector.MemoryManager.Event.MemoryPressure,this._memoryPressure,this);this._enabledTimelineTypesSetting=new WebInspector.Setting("enabled-instrument-types",WebInspector.TimelineManager.defaultTimelineTypes());this._updateAutoCaptureInstruments();this._persistentNetworkTimeline=new WebInspector.NetworkTimeline;this._isCapturing=false;this._initiatedByBackendStart=false;this._initiatedByBackendStop=false;this._waitingForCapturingStartedEvent=false;this._isCapturingPageReload=false;this._autoCaptureOnPageLoad=false;this._mainResourceForAutoCapturing=null;this._shouldSetAutoCapturingMainResource=false;this._boundStopCapturing=this.stopCapturing.bind(this);this._webTimelineScriptRecordsExpectingScriptProfilerEvents=null;this._scriptProfilerRecords=null;this._stopCapturingTimeout=undefined;this._deadTimeTimeout=undefined;this._lastDeadTimeTickle=0;this.reset();}
static defaultTimelineTypes()
{if(WebInspector.debuggableType===WebInspector.DebuggableType.JavaScript){let defaultTypes=[WebInspector.TimelineRecord.Type.Script];if(WebInspector.HeapAllocationsInstrument.supported())
defaultTypes.push(WebInspector.TimelineRecord.Type.HeapAllocations);return defaultTypes;}
let defaultTypes=[WebInspector.TimelineRecord.Type.Network,WebInspector.TimelineRecord.Type.Layout,WebInspector.TimelineRecord.Type.Script,];if(WebInspector.FPSInstrument.supported())
defaultTypes.push(WebInspector.TimelineRecord.Type.RenderingFrame);return defaultTypes;}
static availableTimelineTypes()
{let types=WebInspector.TimelineManager.defaultTimelineTypes();if(WebInspector.debuggableType===WebInspector.DebuggableType.JavaScript)
return types;if(WebInspector.MemoryInstrument.supported())
types.push(WebInspector.TimelineRecord.Type.Memory);if(WebInspector.HeapAllocationsInstrument.supported())
types.push(WebInspector.TimelineRecord.Type.HeapAllocations);return types;}
reset()
{if(this._isCapturing)
this.stopCapturing();this._recordings=[];this._activeRecording=null;this._nextRecordingIdentifier=1;this._loadNewRecording();}
get activeRecording()
{return this._activeRecording;}
get persistentNetworkTimeline()
{return this._persistentNetworkTimeline;}
get recordings()
{return this._recordings.slice();}
get autoCaptureOnPageLoad()
{return this._autoCaptureOnPageLoad;}
set autoCaptureOnPageLoad(autoCapture)
{autoCapture=!!autoCapture;if(this._autoCaptureOnPageLoad===autoCapture)
return;this._autoCaptureOnPageLoad=autoCapture;if(window.TimelineAgent&&TimelineAgent.setAutoCaptureEnabled)
TimelineAgent.setAutoCaptureEnabled(this._autoCaptureOnPageLoad);}
get enabledTimelineTypes()
{let availableTimelineTypes=WebInspector.TimelineManager.availableTimelineTypes();return this._enabledTimelineTypesSetting.value.filter((type)=>availableTimelineTypes.includes(type));}
set enabledTimelineTypes(x)
{this._enabledTimelineTypesSetting.value=x||[];this._updateAutoCaptureInstruments();}
isCapturing()
{return this._isCapturing;}
isCapturingPageReload()
{return this._isCapturingPageReload;}
startCapturing(shouldCreateRecording)
{if(!this._activeRecording||shouldCreateRecording)
this._loadNewRecording();this._waitingForCapturingStartedEvent=true;this.dispatchEventToListeners(WebInspector.TimelineManager.Event.CapturingWillStart);this._activeRecording.start(this._initiatedByBackendStart);}
stopCapturing()
{this._activeRecording.stop(this._initiatedByBackendStop); this.capturingStopped();}
unloadRecording()
{if(!this._activeRecording)
return;if(this._isCapturing)
this.stopCapturing();this._activeRecording.unloaded();this._activeRecording=null;}
computeElapsedTime(timestamp)
{if(!this._activeRecording)
return 0;return this._activeRecording.computeElapsedTime(timestamp);}
scriptProfilerIsTracking()
{return this._scriptProfilerRecords!==null;}
capturingStarted(startTime)
{if(this._isCapturing)
return;this._waitingForCapturingStartedEvent=false;this._isCapturing=true;this._lastDeadTimeTickle=0;if(startTime)
this.activeRecording.initializeTimeBoundsIfNecessary(startTime);this._webTimelineScriptRecordsExpectingScriptProfilerEvents=[];this.dispatchEventToListeners(WebInspector.TimelineManager.Event.CapturingStarted,{startTime});}
capturingStopped(endTime)
{if(!this._isCapturing)
return;if(this._stopCapturingTimeout){clearTimeout(this._stopCapturingTimeout);this._stopCapturingTimeout=undefined;}
if(this._deadTimeTimeout){clearTimeout(this._deadTimeTimeout);this._deadTimeTimeout=undefined;}
this._isCapturing=false;this._isCapturingPageReload=false;this._shouldSetAutoCapturingMainResource=false;this._mainResourceForAutoCapturing=null;this._initiatedByBackendStart=false;this._initiatedByBackendStop=false;this.dispatchEventToListeners(WebInspector.TimelineManager.Event.CapturingStopped,{endTime});}
autoCaptureStarted()
{if(this._isCapturing)
this.stopCapturing();this._initiatedByBackendStart=true;
if(!this._waitingForCapturingStartedEvent){const createNewRecording=true;this.startCapturing(createNewRecording);}
this._shouldSetAutoCapturingMainResource=true;}
programmaticCaptureStarted()
{this._initiatedByBackendStart=true;this._activeRecording.addScriptInstrumentForProgrammaticCapture();const createNewRecording=false;this.startCapturing(createNewRecording);}
programmaticCaptureStopped()
{this._initiatedByBackendStop=true;
this._isCapturing=true;this.stopCapturing();}
eventRecorded(recordPayload)
{if(!this._isCapturing)
return;var records=[];
var stack=[{array:[recordPayload],parent:null,parentRecord:null,index:0}];while(stack.length){var entry=stack.lastValue;var recordPayloads=entry.array;if(entry.index<recordPayloads.length){var recordPayload=recordPayloads[entry.index];var record=this._processEvent(recordPayload,entry.parent);if(record){record.parent=entry.parentRecord;records.push(record);if(entry.parentRecord)
entry.parentRecord.children.push(record);}
if(recordPayload.children&&recordPayload.children.length)
stack.push({array:recordPayload.children,parent:recordPayload,parentRecord:record||entry.parentRecord,index:0});++entry.index;}else
stack.pop();}
for(var record of records){if(record.type===WebInspector.TimelineRecord.Type.RenderingFrame){if(!record.children.length)
continue;record.setupFrameIndex();}
this._addRecord(record);}}
pageDOMContentLoadedEventFired(timestamp)
{let computedTimestamp=this.activeRecording.computeElapsedTime(timestamp);WebInspector.frameResourceManager.mainFrame.markDOMContentReadyEvent(computedTimestamp);let eventMarker=new WebInspector.TimelineMarker(computedTimestamp,WebInspector.TimelineMarker.Type.DOMContentEvent);this._activeRecording.addEventMarker(eventMarker);}
pageLoadEventFired(timestamp)
{let computedTimestamp=this.activeRecording.computeElapsedTime(timestamp);WebInspector.frameResourceManager.mainFrame.markLoadEvent(computedTimestamp);let eventMarker=new WebInspector.TimelineMarker(computedTimestamp,WebInspector.TimelineMarker.Type.LoadEvent);this._activeRecording.addEventMarker(eventMarker);this._stopAutoRecordingSoon();}
memoryTrackingStart(timestamp)
{this.capturingStarted(timestamp);}
memoryTrackingUpdate(event)
{if(!this._isCapturing)
return;this._addRecord(new WebInspector.MemoryTimelineRecord(event.timestamp,event.categories));}
memoryTrackingComplete()
{}
heapTrackingStarted(timestamp,snapshot)
{this._addRecord(new WebInspector.HeapAllocationsTimelineRecord(timestamp,snapshot));this.capturingStarted(timestamp);}
heapTrackingCompleted(timestamp,snapshot)
{this._addRecord(new WebInspector.HeapAllocationsTimelineRecord(timestamp,snapshot));}
heapSnapshotAdded(timestamp,snapshot)
{this._addRecord(new WebInspector.HeapAllocationsTimelineRecord(timestamp,snapshot));}
_processRecord(recordPayload,parentRecordPayload)
{var startTime=this.activeRecording.computeElapsedTime(recordPayload.startTime);var endTime=this.activeRecording.computeElapsedTime(recordPayload.endTime);var callFrames=this._callFramesFromPayload(recordPayload.stackTrace);var significantCallFrame=null;if(callFrames){for(var i=0;i<callFrames.length;++i){if(callFrames[i].nativeCode)
continue;significantCallFrame=callFrames[i];break;}}
var sourceCodeLocation=significantCallFrame&&significantCallFrame.sourceCodeLocation;switch(recordPayload.type){case TimelineAgent.EventType.ScheduleStyleRecalculation:return new WebInspector.LayoutTimelineRecord(WebInspector.LayoutTimelineRecord.EventType.InvalidateStyles,startTime,startTime,callFrames,sourceCodeLocation);case TimelineAgent.EventType.RecalculateStyles:return new WebInspector.LayoutTimelineRecord(WebInspector.LayoutTimelineRecord.EventType.RecalculateStyles,startTime,endTime,callFrames,sourceCodeLocation);case TimelineAgent.EventType.InvalidateLayout:return new WebInspector.LayoutTimelineRecord(WebInspector.LayoutTimelineRecord.EventType.InvalidateLayout,startTime,startTime,callFrames,sourceCodeLocation);case TimelineAgent.EventType.Layout:var layoutRecordType=sourceCodeLocation?WebInspector.LayoutTimelineRecord.EventType.ForcedLayout:WebInspector.LayoutTimelineRecord.EventType.Layout;var quad=new WebInspector.Quad(recordPayload.data.root);return new WebInspector.LayoutTimelineRecord(layoutRecordType,startTime,endTime,callFrames,sourceCodeLocation,quad);case TimelineAgent.EventType.Paint:var quad=new WebInspector.Quad(recordPayload.data.clip);return new WebInspector.LayoutTimelineRecord(WebInspector.LayoutTimelineRecord.EventType.Paint,startTime,endTime,callFrames,sourceCodeLocation,quad);case TimelineAgent.EventType.Composite:return new WebInspector.LayoutTimelineRecord(WebInspector.LayoutTimelineRecord.EventType.Composite,startTime,endTime,callFrames,sourceCodeLocation);case TimelineAgent.EventType.RenderingFrame:if(!recordPayload.children||!recordPayload.children.length)
return null;return new WebInspector.RenderingFrameTimelineRecord(startTime,endTime);case TimelineAgent.EventType.EvaluateScript:if(!sourceCodeLocation){var mainFrame=WebInspector.frameResourceManager.mainFrame;var scriptResource=mainFrame.url===recordPayload.data.url?mainFrame.mainResource:mainFrame.resourceForURL(recordPayload.data.url,true);if(scriptResource){var lineNumber=recordPayload.data.lineNumber-1;sourceCodeLocation=scriptResource.createSourceCodeLocation(lineNumber,0);}}
var profileData=recordPayload.data.profile;var record;switch(parentRecordPayload&&parentRecordPayload.type){case TimelineAgent.EventType.TimerFire:record=new WebInspector.ScriptTimelineRecord(WebInspector.ScriptTimelineRecord.EventType.TimerFired,startTime,endTime,callFrames,sourceCodeLocation,parentRecordPayload.data.timerId,profileData);break;default:record=new WebInspector.ScriptTimelineRecord(WebInspector.ScriptTimelineRecord.EventType.ScriptEvaluated,startTime,endTime,callFrames,sourceCodeLocation,null,profileData);break;}
this._webTimelineScriptRecordsExpectingScriptProfilerEvents.push(record);return record;case TimelineAgent.EventType.ConsoleProfile:var profileData=recordPayload.data.profile;return new WebInspector.ScriptTimelineRecord(WebInspector.ScriptTimelineRecord.EventType.ConsoleProfileRecorded,startTime,endTime,callFrames,sourceCodeLocation,recordPayload.data.title,profileData);case TimelineAgent.EventType.TimerFire:case TimelineAgent.EventType.EventDispatch:case TimelineAgent.EventType.FireAnimationFrame:break;case TimelineAgent.EventType.FunctionCall:
if(!parentRecordPayload){console.warn("Unexpectedly received a FunctionCall timeline record without a parent record");break;}
if(!sourceCodeLocation){var mainFrame=WebInspector.frameResourceManager.mainFrame;var scriptResource=mainFrame.url===recordPayload.data.scriptName?mainFrame.mainResource:mainFrame.resourceForURL(recordPayload.data.scriptName,true);if(scriptResource){var lineNumber=recordPayload.data.scriptLine-1;sourceCodeLocation=scriptResource.createSourceCodeLocation(lineNumber,0);}}
var profileData=recordPayload.data.profile;var record;switch(parentRecordPayload.type){case TimelineAgent.EventType.TimerFire:record=new WebInspector.ScriptTimelineRecord(WebInspector.ScriptTimelineRecord.EventType.TimerFired,startTime,endTime,callFrames,sourceCodeLocation,parentRecordPayload.data.timerId,profileData);break;case TimelineAgent.EventType.EventDispatch:record=new WebInspector.ScriptTimelineRecord(WebInspector.ScriptTimelineRecord.EventType.EventDispatched,startTime,endTime,callFrames,sourceCodeLocation,parentRecordPayload.data.type,profileData);break;case TimelineAgent.EventType.FireAnimationFrame:record=new WebInspector.ScriptTimelineRecord(WebInspector.ScriptTimelineRecord.EventType.AnimationFrameFired,startTime,endTime,callFrames,sourceCodeLocation,parentRecordPayload.data.id,profileData);break;case TimelineAgent.EventType.FunctionCall:record=new WebInspector.ScriptTimelineRecord(WebInspector.ScriptTimelineRecord.EventType.ScriptEvaluated,startTime,endTime,callFrames,sourceCodeLocation,parentRecordPayload.data.id,profileData);break;case TimelineAgent.EventType.RenderingFrame:record=new WebInspector.ScriptTimelineRecord(WebInspector.ScriptTimelineRecord.EventType.ScriptEvaluated,startTime,endTime,callFrames,sourceCodeLocation,parentRecordPayload.data.id,profileData);break;default:break;}
if(record){this._webTimelineScriptRecordsExpectingScriptProfilerEvents.push(record);return record;}
break;case TimelineAgent.EventType.ProbeSample:sourceCodeLocation=WebInspector.probeManager.probeForIdentifier(recordPayload.data.probeId).breakpoint.sourceCodeLocation;return new WebInspector.ScriptTimelineRecord(WebInspector.ScriptTimelineRecord.EventType.ProbeSampleRecorded,startTime,startTime,callFrames,sourceCodeLocation,recordPayload.data.probeId);case TimelineAgent.EventType.TimerInstall:var timerDetails={timerId:recordPayload.data.timerId,timeout:recordPayload.data.timeout,repeating:!recordPayload.data.singleShot};return new WebInspector.ScriptTimelineRecord(WebInspector.ScriptTimelineRecord.EventType.TimerInstalled,startTime,startTime,callFrames,sourceCodeLocation,timerDetails);case TimelineAgent.EventType.TimerRemove:return new WebInspector.ScriptTimelineRecord(WebInspector.ScriptTimelineRecord.EventType.TimerRemoved,startTime,startTime,callFrames,sourceCodeLocation,recordPayload.data.timerId);case TimelineAgent.EventType.RequestAnimationFrame:return new WebInspector.ScriptTimelineRecord(WebInspector.ScriptTimelineRecord.EventType.AnimationFrameRequested,startTime,startTime,callFrames,sourceCodeLocation,recordPayload.data.id);case TimelineAgent.EventType.CancelAnimationFrame:return new WebInspector.ScriptTimelineRecord(WebInspector.ScriptTimelineRecord.EventType.AnimationFrameCanceled,startTime,startTime,callFrames,sourceCodeLocation,recordPayload.data.id);default:console.error("Missing handling of Timeline Event Type: "+recordPayload.type);}
return null;}
_processEvent(recordPayload,parentRecordPayload)
{switch(recordPayload.type){case TimelineAgent.EventType.TimeStamp:var timestamp=this.activeRecording.computeElapsedTime(recordPayload.startTime);var eventMarker=new WebInspector.TimelineMarker(timestamp,WebInspector.TimelineMarker.Type.TimeStamp,recordPayload.data.message);this._activeRecording.addEventMarker(eventMarker);break;case TimelineAgent.EventType.Time:case TimelineAgent.EventType.TimeEnd:
break;default:return this._processRecord(recordPayload,parentRecordPayload);}
return null;}
_loadNewRecording()
{if(this._activeRecording&&this._activeRecording.isEmpty())
return;let instruments=this.enabledTimelineTypes.map((type)=>WebInspector.Instrument.createForTimelineType(type));let identifier=this._nextRecordingIdentifier++;let newRecording=new WebInspector.TimelineRecording(identifier,WebInspector.UIString("Timeline Recording %d").format(identifier),instruments);this._recordings.push(newRecording);this.dispatchEventToListeners(WebInspector.TimelineManager.Event.RecordingCreated,{recording:newRecording});if(this._isCapturing)
this.stopCapturing();var oldRecording=this._activeRecording;if(oldRecording)
oldRecording.unloaded();this._activeRecording=newRecording;
if(this._mainResourceForAutoCapturing&&WebInspector.TimelineRecording.isLegacy){this._activeRecording.setLegacyBaseTimestamp(this._mainResourceForAutoCapturing.originalRequestWillBeSentTimestamp);this._mainResourceForAutoCapturing._requestSentTimestamp=0;}
this.dispatchEventToListeners(WebInspector.TimelineManager.Event.RecordingLoaded,{oldRecording});}
_callFramesFromPayload(payload)
{if(!payload)
return null;return payload.map((x)=>WebInspector.CallFrame.fromPayload(WebInspector.assumingMainTarget(),x));}
_addRecord(record)
{this._activeRecording.addRecord(record);if(WebInspector.frameResourceManager.mainFrame&&isNaN(WebInspector.frameResourceManager.mainFrame.loadEventTimestamp))
this._resetAutoRecordingDeadTimeTimeout();}
_attemptAutoCapturingForFrame(frame)
{if(!this._autoCaptureOnPageLoad)
return false;if(!frame.isMainFrame())
return false;if(!TimelineAgent.setAutoCaptureEnabled)
return this._legacyAttemptStartAutoCapturingForFrame(frame);if(!this._shouldSetAutoCapturingMainResource)
return false;let mainResource=frame.provisionalMainResource||frame.mainResource;if(mainResource===this._mainResourceForAutoCapturing)
return false;let oldMainResource=frame.mainResource||null;this._isCapturingPageReload=oldMainResource!==null&&oldMainResource.url===mainResource.url;this._mainResourceForAutoCapturing=mainResource;this._addRecord(new WebInspector.ResourceTimelineRecord(mainResource));this._resetAutoRecordingMaxTimeTimeout();this._shouldSetAutoCapturingMainResource=false;return true;}
_legacyAttemptStartAutoCapturingForFrame(frame)
{if(this._isCapturing&&!this._mainResourceForAutoCapturing)
return false;let mainResource=frame.provisionalMainResource||frame.mainResource;if(mainResource===this._mainResourceForAutoCapturing)
return false;let oldMainResource=frame.mainResource||null;this._isCapturingPageReload=oldMainResource!==null&&oldMainResource.url===mainResource.url;if(this._isCapturing)
this.stopCapturing();this._mainResourceForAutoCapturing=mainResource;this._loadNewRecording();this.startCapturing();this._addRecord(new WebInspector.ResourceTimelineRecord(mainResource));this._resetAutoRecordingMaxTimeTimeout();return true;}
_stopAutoRecordingSoon()
{if(!this._isCapturing||!this._mainResourceForAutoCapturing)
return;if(this._stopCapturingTimeout)
clearTimeout(this._stopCapturingTimeout);this._stopCapturingTimeout=setTimeout(this._boundStopCapturing,WebInspector.TimelineManager.MaximumAutoRecordDurationAfterLoadEvent);}
_resetAutoRecordingMaxTimeTimeout()
{if(this._stopCapturingTimeout)
clearTimeout(this._stopCapturingTimeout);this._stopCapturingTimeout=setTimeout(this._boundStopCapturing,WebInspector.TimelineManager.MaximumAutoRecordDuration);}
_resetAutoRecordingDeadTimeTimeout()
{if(!this._isCapturing||!this._mainResourceForAutoCapturing)
return;let now=Date.now();if(now<=this._lastDeadTimeTickle)
return;this._lastDeadTimeTickle=now+10;if(this._deadTimeTimeout)
clearTimeout(this._deadTimeTimeout);this._deadTimeTimeout=setTimeout(this._boundStopCapturing,WebInspector.TimelineManager.DeadTimeRequiredToStopAutoRecordingEarly);}
_provisionalLoadStarted(event)
{this._attemptAutoCapturingForFrame(event.target);}
_mainResourceDidChange(event)
{let frame=event.target;if(frame.isMainFrame()&&WebInspector.settings.clearNetworkOnNavigate.value)
this._persistentNetworkTimeline.reset();let mainResource=frame.mainResource;let record=new WebInspector.ResourceTimelineRecord(mainResource);if(!isNaN(record.startTime))
this._persistentNetworkTimeline.addRecord(record);
if(!WebInspector.frameResourceManager.mainFrame)
return;if(this._attemptAutoCapturingForFrame(frame))
return;if(!this._isCapturing)
return;if(mainResource===this._mainResourceForAutoCapturing)
return;this._addRecord(record);}
_resourceWasAdded(event)
{var record=new WebInspector.ResourceTimelineRecord(event.data.resource);if(!isNaN(record.startTime))
this._persistentNetworkTimeline.addRecord(record);
if(!WebInspector.frameResourceManager.mainFrame)
return;if(!this._isCapturing)
return;this._addRecord(record);}
_garbageCollected(event)
{if(!this._isCapturing)
return;let collection=event.data.collection;this._addRecord(new WebInspector.ScriptTimelineRecord(WebInspector.ScriptTimelineRecord.EventType.GarbageCollected,collection.startTime,collection.endTime,null,null,collection));}
_memoryPressure(event)
{if(!this._isCapturing)
return;this.activeRecording.addMemoryPressureEvent(event.data.memoryPressureEvent);}
_scriptProfilerTypeToScriptTimelineRecordType(type)
{switch(type){case ScriptProfilerAgent.EventType.API:return WebInspector.ScriptTimelineRecord.EventType.APIScriptEvaluated;case ScriptProfilerAgent.EventType.Microtask:return WebInspector.ScriptTimelineRecord.EventType.MicrotaskDispatched;case ScriptProfilerAgent.EventType.Other:return WebInspector.ScriptTimelineRecord.EventType.ScriptEvaluated;}}
scriptProfilerProgrammaticCaptureStarted()
{ this.programmaticCaptureStarted();}
scriptProfilerProgrammaticCaptureStopped()
{ this.programmaticCaptureStopped();}
scriptProfilerTrackingStarted(timestamp)
{this._scriptProfilerRecords=[];this.capturingStarted(timestamp);}
scriptProfilerTrackingUpdated(event)
{let{startTime,endTime,type}=event;let scriptRecordType=this._scriptProfilerTypeToScriptTimelineRecordType(type);let record=new WebInspector.ScriptTimelineRecord(scriptRecordType,startTime,endTime,null,null,null,null);record.__scriptProfilerType=type;this._scriptProfilerRecords.push(record);
if(type!==ScriptProfilerAgent.EventType.Other)
this._addRecord(record);}
scriptProfilerTrackingCompleted(samples)
{if(samples){let{stackTraces}=samples;let topDownCallingContextTree=this.activeRecording.topDownCallingContextTree;let bottomUpCallingContextTree=this.activeRecording.bottomUpCallingContextTree;let topFunctionsTopDownCallingContextTree=this.activeRecording.topFunctionsTopDownCallingContextTree;let topFunctionsBottomUpCallingContextTree=this.activeRecording.topFunctionsBottomUpCallingContextTree;let timestampIndex=0;let timestampCount=stackTraces.length;let sampleDurations=new Array(timestampCount);let sampleDurationIndex=0;const defaultDuration=1/1000;for(let i=0;i<this._scriptProfilerRecords.length;++i){let record=this._scriptProfilerRecords[i];while(timestampIndex<timestampCount&&stackTraces[timestampIndex].timestamp<record.startTime){sampleDurations[sampleDurationIndex++]=defaultDuration;timestampIndex++;}
let samplesInRecord=0;while(timestampIndex<timestampCount&&stackTraces[timestampIndex].timestamp<record.endTime){timestampIndex++;samplesInRecord++;}
if(samplesInRecord){let averageDuration=(record.endTime-record.startTime)/samplesInRecord;sampleDurations.fill(averageDuration,sampleDurationIndex,sampleDurationIndex+samplesInRecord);sampleDurationIndex+=samplesInRecord;}}
if(timestampIndex<timestampCount)
sampleDurations.fill(defaultDuration,sampleDurationIndex);for(let i=0;i<stackTraces.length;i++){topDownCallingContextTree.updateTreeWithStackTrace(stackTraces[i],sampleDurations[i]);bottomUpCallingContextTree.updateTreeWithStackTrace(stackTraces[i],sampleDurations[i]);topFunctionsTopDownCallingContextTree.updateTreeWithStackTrace(stackTraces[i],sampleDurations[i]);topFunctionsBottomUpCallingContextTree.updateTreeWithStackTrace(stackTraces[i],sampleDurations[i]);}
for(let i=0;i<this._scriptProfilerRecords.length;++i){let record=this._scriptProfilerRecords[i];record.profilePayload=topDownCallingContextTree.toCPUProfilePayload(record.startTime,record.endTime);}}
if(WebInspector.debuggableType!==WebInspector.DebuggableType.JavaScript){this._scriptProfilerRecords=this._scriptProfilerRecords.filter((x)=>x.__scriptProfilerType===ScriptProfilerAgent.EventType.Other);this._mergeScriptProfileRecords();}
this._scriptProfilerRecords=null;let timeline=this.activeRecording.timelineForRecordType(WebInspector.TimelineRecord.Type.Script);timeline.refresh();}
_mergeScriptProfileRecords()
{let nextRecord=function(list){return list.shift()||null;};let nextWebTimelineRecord=nextRecord.bind(null,this._webTimelineScriptRecordsExpectingScriptProfilerEvents);let nextScriptProfilerRecord=nextRecord.bind(null,this._scriptProfilerRecords);let recordEnclosesRecord=function(record1,record2){return record1.startTime<=record2.startTime&&record1.endTime>=record2.endTime;};let webRecord=nextWebTimelineRecord();let profilerRecord=nextScriptProfilerRecord();while(webRecord&&profilerRecord){if(webRecord.parent instanceof WebInspector.ScriptTimelineRecord){webRecord=nextWebTimelineRecord();continue;}
if(recordEnclosesRecord(webRecord,profilerRecord)){webRecord.profilePayload=profilerRecord.profilePayload;profilerRecord=nextScriptProfilerRecord();
while(profilerRecord&&recordEnclosesRecord(webRecord,profilerRecord)){this._addRecord(profilerRecord);profilerRecord=nextScriptProfilerRecord();}
webRecord=nextWebTimelineRecord();continue;}
if(profilerRecord.startTime>webRecord.endTime){console.warn("Unexpected case of a Timeline record not containing a ScriptProfiler event and profile data");webRecord=nextWebTimelineRecord();continue;}
console.warn("Unexpected case of a ScriptProfiler event not being contained by a Timeline record");this._addRecord(profilerRecord);profilerRecord=nextScriptProfilerRecord();}
}
_updateAutoCaptureInstruments()
{if(!window.TimelineAgent)
return;if(!TimelineAgent.setInstruments)
return;let instrumentSet=new Set;let enabledTimelineTypes=this._enabledTimelineTypesSetting.value;for(let timelineType of enabledTimelineTypes){switch(timelineType){case WebInspector.TimelineRecord.Type.Script:instrumentSet.add(TimelineAgent.Instrument.ScriptProfiler);break;case WebInspector.TimelineRecord.Type.HeapAllocations:instrumentSet.add(TimelineAgent.Instrument.Heap);break;case WebInspector.TimelineRecord.Type.Network:case WebInspector.TimelineRecord.Type.RenderingFrame:case WebInspector.TimelineRecord.Type.Layout:instrumentSet.add(TimelineAgent.Instrument.Timeline);break;case WebInspector.TimelineRecord.Type.Memory:instrumentSet.add(TimelineAgent.Instrument.Memory);break;}}
TimelineAgent.setInstruments([...instrumentSet]);}};WebInspector.TimelineManager.Event={RecordingCreated:"timeline-manager-recording-created",RecordingLoaded:"timeline-manager-recording-loaded",CapturingWillStart:"timeline-manager-capturing-will-start",CapturingStarted:"timeline-manager-capturing-started",CapturingStopped:"timeline-manager-capturing-stopped"};WebInspector.TimelineManager.MaximumAutoRecordDuration=90000;WebInspector.TimelineManager.MaximumAutoRecordDurationAfterLoadEvent=10000;WebInspector.TimelineManager.DeadTimeRequiredToStopAutoRecordingEarly=2000;WebInspector.TypeTokenAnnotator=class TypeTokenAnnotator extends WebInspector.Annotator
{constructor(sourceCodeTextEditor,script)
{super(sourceCodeTextEditor);this._script=script;this._typeTokenNodes=[];this._typeTokenBookmarks=[];}
insertAnnotations()
{if(!this.isActive())
return;var scriptSyntaxTree=this._script.scriptSyntaxTree;if(!scriptSyntaxTree){this._script.requestScriptSyntaxTree((syntaxTree)=>{if(syntaxTree)
this.insertAnnotations();});return;}
if(!scriptSyntaxTree.parsedSuccessfully)
return;var{startOffset,endOffset}=this.sourceCodeTextEditor.visibleRangeOffsets();var startTime=Date.now();var allNodesInRange=scriptSyntaxTree.filterByRange(startOffset,endOffset);scriptSyntaxTree.updateTypes(allNodesInRange,(nodesWithUpdatedTypes)=>{if(!this.isActive())
return;nodesWithUpdatedTypes.forEach(this._insertTypeToken,this);let totalTime=Date.now()-startTime;let timeoutTime=Number.constrain(8*totalTime,500,2000);this._timeoutIdentifier=setTimeout(()=>{this._timeoutIdentifier=null;this.insertAnnotations();},timeoutTime);});}
clearAnnotations()
{this._clearTypeTokens();}
_insertTypeToken(node)
{if(node.type===WebInspector.ScriptSyntaxTree.NodeType.Identifier){if(!node.attachments.__typeToken&&node.attachments.types&&node.attachments.types.valid)
this._insertToken(node.range[0],node,false,WebInspector.TypeTokenView.TitleType.Variable,node.name);if(node.attachments.__typeToken)
node.attachments.__typeToken.update(node.attachments.types);return;}
var functionReturnType=node.attachments.returnTypes;if(!functionReturnType||!functionReturnType.valid)
return;
var scriptSyntaxTree=this._script._scriptSyntaxTree;if(!node.attachments.__typeToken&&(scriptSyntaxTree.containsNonEmptyReturnStatement(node.body)||!functionReturnType.typeSet.isContainedIn(WebInspector.TypeSet.TypeBit.Undefined))){var functionName=node.id?node.id.name:null;this._insertToken(node.typeProfilingReturnDivot,node,true,WebInspector.TypeTokenView.TitleType.ReturnStatement,functionName);}
if(node.attachments.__typeToken)
node.attachments.__typeToken.update(node.attachments.returnTypes);}
_insertToken(originalOffset,node,shouldTranslateOffsetToAfterParameterList,typeTokenTitleType,functionOrVariableName)
{var tokenPosition=this.sourceCodeTextEditor.originalOffsetToCurrentPosition(originalOffset);var currentOffset=this.sourceCodeTextEditor.currentPositionToCurrentOffset(tokenPosition);var sourceString=this.sourceCodeTextEditor.string;if(shouldTranslateOffsetToAfterParameterList){currentOffset=this._translateToOffsetAfterFunctionParameterList(node,currentOffset,sourceString);tokenPosition=this.sourceCodeTextEditor.currentOffsetToCurrentPosition(currentOffset);}
var isSpaceRegexp=/\s/;var shouldHaveLeftMargin=currentOffset!==0&&!isSpaceRegexp.test(sourceString[currentOffset-1]);var shouldHaveRightMargin=!isSpaceRegexp.test(sourceString[currentOffset]);var typeToken=new WebInspector.TypeTokenView(this,shouldHaveRightMargin,shouldHaveLeftMargin,typeTokenTitleType,functionOrVariableName);var bookmark=this.sourceCodeTextEditor.setInlineWidget(tokenPosition,typeToken.element);node.attachments.__typeToken=typeToken;this._typeTokenNodes.push(node);this._typeTokenBookmarks.push(bookmark);}
_translateToOffsetAfterFunctionParameterList(node,offset,sourceString)
{var isMultiLineComment=false;var isSingleLineComment=false;var shouldIgnore=false;const isArrowFunction=node.type===WebInspector.ScriptSyntaxTree.NodeType.ArrowFunctionExpression;function isLineTerminator(char)
{
return char==="\n"||char==="\r"||char==="\u2028"||char==="\u2029";}
while(((!isArrowFunction&&sourceString[offset]!==")")||(isArrowFunction&&sourceString[offset]!==">")||shouldIgnore)&&offset<sourceString.length){if(isSingleLineComment&&isLineTerminator(sourceString[offset])){isSingleLineComment=false;shouldIgnore=false;}else if(isMultiLineComment&&sourceString[offset]==="*"&&sourceString[offset+1]==="/"){isMultiLineComment=false;shouldIgnore=false;offset++;}else if(!shouldIgnore&&sourceString[offset]==="/"){offset++;if(sourceString[offset]==="*")
isMultiLineComment=true;else if(sourceString[offset]==="/")
isSingleLineComment=true;else
throw new Error("Bad parsing. Couldn't parse comment preamble.");shouldIgnore=true;}
offset++;}
return offset+1;}
_clearTypeTokens()
{this._typeTokenNodes.forEach(function(node){node.attachments.__typeToken=null;});this._typeTokenBookmarks.forEach(function(bookmark){bookmark.clear();});this._typeTokenNodes=[];this._typeTokenBookmarks=[];}};WebInspector.VisualStyleCompletionsController=class VisualStyleCompletionsController extends WebInspector.Object
{constructor(delegate)
{super();this._delegate=delegate||null;this._suggestionsView=new WebInspector.CompletionSuggestionsView(this);this._completions=null;this._currentCompletions=[];this._selectedCompletionIndex=0;}
get visible()
{return this._completions&&this._currentCompletions.length&&this._suggestionsView.visible;}
get hasCompletions()
{return!!this._completions;}
get currentCompletion()
{if(!this.hasCompletions)
return null;return this._currentCompletions[this._selectedCompletionIndex]||null;}
set completions(completions)
{this._completions=completions||null;}
completionSuggestionsViewCustomizeCompletionElement(suggestionsView,element,item)
{if(this._delegate&&typeof this._delegate.visualStyleCompletionsControllerCustomizeCompletionElement==="function")
this._delegate.visualStyleCompletionsControllerCustomizeCompletionElement(suggestionsView,element,item);}
completionSuggestionsClickedCompletion(suggestionsView,text)
{suggestionsView.hide();this.dispatchEventToListeners(WebInspector.VisualStyleCompletionsController.Event.CompletionSelected,{text});}
previous()
{this._suggestionsView.selectPrevious();this._selectedCompletionIndex=this._suggestionsView.selectedIndex;}
next()
{this._suggestionsView.selectNext();this._selectedCompletionIndex=this._suggestionsView.selectedIndex;}
update(value)
{if(!this.hasCompletions)
return false;this._currentCompletions=this._completions.startsWith(value);var currentCompletionsLength=this._currentCompletions.length;if(currentCompletionsLength){if(currentCompletionsLength===1&&this._currentCompletions[0]===value){this.hide();return false;}
if(this._selectedCompletionIndex>=currentCompletionsLength)
this._selectedCompletionIndex=0;this._suggestionsView.update(this._currentCompletions,this._selectedCompletionIndex);return true;}
this.hide();return false;}
show(bounds,padding)
{if(!bounds)
return;this._suggestionsView.show(bounds.pad(padding||0));}
hide()
{if(this._suggestionsView.isHandlingClickEvent())
return;this._suggestionsView.hide();}};WebInspector.VisualStyleCompletionsController.Event={CompletionSelected:"visual-style-completions-controller-completion-selected"};WebInspector.WorkerManager=class WorkerManager extends WebInspector.Object
{constructor()
{super();this._connections=new Map;if(window.WorkerAgent)
WorkerAgent.enable();}
workerCreated(workerId,url)
{let connection=new InspectorBackend.WorkerConnection(workerId);let workerTarget=new WebInspector.WorkerTarget(workerId,url,connection);WebInspector.targetManager.addTarget(workerTarget);this._connections.set(workerId,connection);WorkerAgent.initialized(workerId);}
workerTerminated(workerId)
{let connection=this._connections.take(workerId);WebInspector.targetManager.removeTarget(connection.target);}
dispatchMessageFromWorker(workerId,message)
{let connection=this._connections.get(workerId);if(!connection)
return;connection.dispatch(message);}};WebInspector.XHRBreakpointTreeController=class XHRBreakpointsTreeController extends WebInspector.Object
{constructor(treeOutline)
{super();this._treeOutline=treeOutline;WebInspector.domDebuggerManager.addEventListener(WebInspector.DOMDebuggerManager.Event.XHRBreakpointAdded,this._xhrBreakpointAdded,this);WebInspector.domDebuggerManager.addEventListener(WebInspector.DOMDebuggerManager.Event.XHRBreakpointRemoved,this._xhrBreakpointRemoved,this);this._allReqestsBreakpointTreeElement=new WebInspector.XHRBreakpointTreeElement(WebInspector.domDebuggerManager.allRequestsBreakpoint,WebInspector.DebuggerSidebarPanel.AssertionIconStyleClassName,WebInspector.UIString("All Requests"));this._treeOutline.appendChild(this._allReqestsBreakpointTreeElement);for(let breakpoint of WebInspector.domDebuggerManager.xhrBreakpoints)
this._addTreeElement(breakpoint);}
revealAndSelect(breakpoint)
{let treeElement=this._treeOutline.findTreeElement(breakpoint);if(!treeElement)
return;treeElement.revealAndSelect();}
disconnect()
{WebInspector.Frame.removeEventListener(null,null,this);WebInspector.domDebuggerManager.removeEventListener(null,null,this);}
_xhrBreakpointAdded(event)
{this._addTreeElement(event.data.breakpoint);}
_xhrBreakpointRemoved(event)
{let breakpoint=event.data.breakpoint;let treeElement=this._treeOutline.findTreeElement(breakpoint);if(!treeElement)
return;this._treeOutline.removeChild(treeElement);}
_addTreeElement(breakpoint)
{let treeElement=this._treeOutline.findTreeElement(breakpoint);if(treeElement)
return;this._treeOutline.appendChild(new WebInspector.XHRBreakpointTreeElement(breakpoint));}};WebInspector.ContentViewCookieType={ApplicationCache:"application-cache",CookieStorage:"cookie-storage",Database:"database",DatabaseTable:"database-table",DOMStorage:"dom-storage",Resource:"resource",Timelines:"timelines"};WebInspector.DebuggableType={Web:"web",JavaScript:"javascript"};WebInspector.SelectedSidebarPanelCookieKey="selected-sidebar-panel";WebInspector.TypeIdentifierCookieKey="represented-object-type";WebInspector.StateRestorationType={Load:"state-restoration-load",Navigation:"state-restoration-navigation",Delayed:"state-restoration-delayed",};WebInspector.LayoutDirection={System:"system",LTR:"ltr",RTL:"rtl",};WebInspector.loaded=function()
{this.debuggableType=InspectorFrontendHost.debuggableType()==="web"?WebInspector.DebuggableType.Web:WebInspector.DebuggableType.JavaScript;this.hasExtraDomains=false;if(InspectorBackend.registerInspectorDispatcher)
InspectorBackend.registerInspectorDispatcher(new WebInspector.InspectorObserver);if(InspectorBackend.registerPageDispatcher)
InspectorBackend.registerPageDispatcher(new WebInspector.PageObserver);if(InspectorBackend.registerConsoleDispatcher)
InspectorBackend.registerConsoleDispatcher(new WebInspector.ConsoleObserver);if(InspectorBackend.registerNetworkDispatcher)
InspectorBackend.registerNetworkDispatcher(new WebInspector.NetworkObserver);if(InspectorBackend.registerDOMDispatcher)
InspectorBackend.registerDOMDispatcher(new WebInspector.DOMObserver);if(InspectorBackend.registerDebuggerDispatcher)
InspectorBackend.registerDebuggerDispatcher(new WebInspector.DebuggerObserver);if(InspectorBackend.registerHeapDispatcher)
InspectorBackend.registerHeapDispatcher(new WebInspector.HeapObserver);if(InspectorBackend.registerMemoryDispatcher)
InspectorBackend.registerMemoryDispatcher(new WebInspector.MemoryObserver);if(InspectorBackend.registerDatabaseDispatcher)
InspectorBackend.registerDatabaseDispatcher(new WebInspector.DatabaseObserver);if(InspectorBackend.registerDOMStorageDispatcher)
InspectorBackend.registerDOMStorageDispatcher(new WebInspector.DOMStorageObserver);if(InspectorBackend.registerApplicationCacheDispatcher)
InspectorBackend.registerApplicationCacheDispatcher(new WebInspector.ApplicationCacheObserver);if(InspectorBackend.registerScriptProfilerDispatcher)
InspectorBackend.registerScriptProfilerDispatcher(new WebInspector.ScriptProfilerObserver);if(InspectorBackend.registerTimelineDispatcher)
InspectorBackend.registerTimelineDispatcher(new WebInspector.TimelineObserver);if(InspectorBackend.registerCSSDispatcher)
InspectorBackend.registerCSSDispatcher(new WebInspector.CSSObserver);if(InspectorBackend.registerLayerTreeDispatcher)
InspectorBackend.registerLayerTreeDispatcher(new WebInspector.LayerTreeObserver);if(InspectorBackend.registerRuntimeDispatcher)
InspectorBackend.registerRuntimeDispatcher(new WebInspector.RuntimeObserver);if(InspectorBackend.registerWorkerDispatcher)
InspectorBackend.registerWorkerDispatcher(new WebInspector.WorkerObserver);if(InspectorBackend.registerCanvasDispatcher)
InspectorBackend.registerCanvasDispatcher(new WebInspector.CanvasObserver);WebInspector.mainTarget=new WebInspector.MainTarget;InspectorAgent.enable();WebInspector.CSSCompletions.requestCSSCompletions();WebInspector.Frame.addEventListener(WebInspector.Frame.Event.ProvisionalLoadStarted,this._provisionalLoadStarted,this);WebInspector.KeyboardShortcut.Key.Space._displayName=WebInspector.UIString("Space");
this.targetManager=new WebInspector.TargetManager;this.branchManager=new WebInspector.BranchManager;this.frameResourceManager=new WebInspector.FrameResourceManager;this.storageManager=new WebInspector.StorageManager;this.domTreeManager=new WebInspector.DOMTreeManager;this.cssStyleManager=new WebInspector.CSSStyleManager;this.logManager=new WebInspector.LogManager;this.issueManager=new WebInspector.IssueManager;this.analyzerManager=new WebInspector.AnalyzerManager;this.runtimeManager=new WebInspector.RuntimeManager;this.heapManager=new WebInspector.HeapManager;this.memoryManager=new WebInspector.MemoryManager;this.applicationCacheManager=new WebInspector.ApplicationCacheManager;this.timelineManager=new WebInspector.TimelineManager;this.debuggerManager=new WebInspector.DebuggerManager;this.sourceMapManager=new WebInspector.SourceMapManager;this.layerTreeManager=new WebInspector.LayerTreeManager;this.dashboardManager=new WebInspector.DashboardManager;this.probeManager=new WebInspector.ProbeManager;this.workerManager=new WebInspector.WorkerManager;this.domDebuggerManager=new WebInspector.DOMDebuggerManager;this.canvasManager=new WebInspector.CanvasManager;ConsoleAgent.enable();setTimeout(function(){if(InspectorAgent.initialized)
InspectorAgent.initialized();},0);this.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.Paused,this._debuggerDidPause,this);this.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.Resumed,this._debuggerDidResume,this);this.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.InspectModeStateChanged,this._inspectModeStateChanged,this);this.domTreeManager.addEventListener(WebInspector.DOMTreeManager.Event.DOMNodeWasInspected,this._domNodeWasInspected,this);this.storageManager.addEventListener(WebInspector.StorageManager.Event.DOMStorageObjectWasInspected,this._storageWasInspected,this);this.storageManager.addEventListener(WebInspector.StorageManager.Event.DatabaseWasInspected,this._storageWasInspected,this);this.frameResourceManager.addEventListener(WebInspector.FrameResourceManager.Event.MainFrameDidChange,this._mainFrameDidChange,this);this.frameResourceManager.addEventListener(WebInspector.FrameResourceManager.Event.FrameWasAdded,this._frameWasAdded,this);WebInspector.Frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange,this._mainResourceDidChange,this);document.addEventListener("DOMContentLoaded",this.contentLoaded.bind(this));this._showingSplitConsoleSetting=new WebInspector.Setting("showing-split-console",false);this._openTabsSetting=new WebInspector.Setting("open-tab-types",["elements","network","resources","timeline","debugger","storage","console"]);this._selectedTabIndexSetting=new WebInspector.Setting("selected-tab-index",0);this.showShadowDOMSetting=new WebInspector.Setting("show-shadow-dom",false);this.showJavaScriptTypeInformationSetting=new WebInspector.Setting("show-javascript-type-information",false);this.showJavaScriptTypeInformationSetting.addEventListener(WebInspector.Setting.Event.Changed,this._showJavaScriptTypeInformationSettingChanged,this);if(this.showJavaScriptTypeInformationSetting.value&&window.RuntimeAgent&&RuntimeAgent.enableTypeProfiler)
RuntimeAgent.enableTypeProfiler();this.enableControlFlowProfilerSetting=new WebInspector.Setting("enable-control-flow-profiler",false);this.enableControlFlowProfilerSetting.addEventListener(WebInspector.Setting.Event.Changed,this._enableControlFlowProfilerSettingChanged,this);if(this.enableControlFlowProfilerSetting.value&&window.RuntimeAgent&&RuntimeAgent.enableControlFlowProfiler)
RuntimeAgent.enableControlFlowProfiler();this.showPaintRectsSetting=new WebInspector.Setting("show-paint-rects",false);if(this.showPaintRectsSetting.value&&window.PageAgent&&PageAgent.setShowPaintRects)
PageAgent.setShowPaintRects(true);this.showPrintStylesSetting=new WebInspector.Setting("show-print-styles",false);if(this.showPrintStylesSetting.value&&window.PageAgent)
PageAgent.setEmulatedMedia("print");this.resourceCachingDisabledSetting=new WebInspector.Setting("disable-resource-caching",false);if(window.NetworkAgent&&NetworkAgent.setResourceCachingDisabled&&this.resourceCachingDisabledSetting.value){NetworkAgent.setResourceCachingDisabled(true);this.resourceCachingDisabledSetting.addEventListener(WebInspector.Setting.Event.Changed,this._resourceCachingDisabledSettingChanged,this);}
this.setZoomFactor(WebInspector.settings.zoomFactor.value);this.mouseCoords={x:0,y:0};this.visible=false;this._windowKeydownListeners=[];};WebInspector.contentLoaded=function()
{
if(window.__uncaughtExceptions)
return;document.addEventListener("beforecopy",this._beforecopy.bind(this));document.addEventListener("copy",this._copy.bind(this));document.addEventListener("click",this._mouseWasClicked.bind(this));document.addEventListener("dragover",this._dragOver.bind(this));document.addEventListener("focus",WebInspector._focusChanged.bind(this),true);window.addEventListener("focus",this._windowFocused.bind(this));window.addEventListener("blur",this._windowBlurred.bind(this));window.addEventListener("resize",this._windowResized.bind(this));window.addEventListener("keydown",this._windowKeyDown.bind(this));window.addEventListener("keyup",this._windowKeyUp.bind(this));window.addEventListener("mousedown",this._mouseDown.bind(this),true);window.addEventListener("mousemove",this._mouseMoved.bind(this),true);window.addEventListener("pagehide",this._pageHidden.bind(this));window.addEventListener("contextmenu",this._contextMenuRequested.bind(this));document.body.classList.add(WebInspector.Platform.name+"-platform");if(WebInspector.Platform.isNightlyBuild)
document.body.classList.add("nightly-build");if(WebInspector.Platform.name==="mac"){document.body.classList.add(WebInspector.Platform.version.name);if(WebInspector.Platform.version.release>=11)
document.body.classList.add("latest-mac");else
document.body.classList.add("legacy-mac");}
document.body.classList.add(this.debuggableType);document.body.setAttribute("dir",this.resolvedLayoutDirection());function setTabSize(){document.body.style.tabSize=WebInspector.settings.tabSize.value;}
WebInspector.settings.tabSize.addEventListener(WebInspector.Setting.Event.Changed,setTabSize);setTabSize();function setInvalidCharacterClassName(){document.body.classList.toggle("show-invalid-characters",WebInspector.settings.showInvalidCharacters.value);}
WebInspector.settings.showInvalidCharacters.addEventListener(WebInspector.Setting.Event.Changed,setInvalidCharacterClassName);setInvalidCharacterClassName();function setWhitespaceCharacterClassName(){document.body.classList.toggle("show-whitespace-characters",WebInspector.settings.showWhitespaceCharacters.value);}
WebInspector.settings.showWhitespaceCharacters.addEventListener(WebInspector.Setting.Event.Changed,setWhitespaceCharacterClassName);setWhitespaceCharacterClassName();this.settingsTabContentView=new WebInspector.SettingsTabContentView;this._settingsKeyboardShortcut=new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl,WebInspector.KeyboardShortcut.Key.Comma,this._showSettingsTab.bind(this));this.toolbar=new WebInspector.Toolbar(document.getElementById("toolbar"));this.tabBar=new WebInspector.TabBar(document.getElementById("tab-bar"));this.tabBar.addEventListener(WebInspector.TabBar.Event.OpenDefaultTab,this._openDefaultTab,this);this._contentElement=document.getElementById("content");this._contentElement.setAttribute("role","main");this._contentElement.setAttribute("aria-label",WebInspector.UIString("Content"));this.consoleDrawer=new WebInspector.ConsoleDrawer(document.getElementById("console-drawer"));this.consoleDrawer.addEventListener(WebInspector.ConsoleDrawer.Event.CollapsedStateChanged,this._consoleDrawerCollapsedStateDidChange,this);this.consoleDrawer.addEventListener(WebInspector.ConsoleDrawer.Event.Resized,this._consoleDrawerDidResize,this);this.clearKeyboardShortcut=new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl,"K",this._clear.bind(this));this.quickConsole=new WebInspector.QuickConsole(document.getElementById("quick-console"));this._consoleRepresentedObject=new WebInspector.LogObject;this.consoleContentView=this.consoleDrawer.contentViewForRepresentedObject(this._consoleRepresentedObject);this.consoleLogViewController=this.consoleContentView.logViewController;this.breakpointPopoverController=new WebInspector.BreakpointPopoverController;this.navigationSidebar=new WebInspector.Sidebar(document.getElementById("navigation-sidebar"),WebInspector.Sidebar.Sides.Left);this.navigationSidebar.addEventListener(WebInspector.Sidebar.Event.WidthDidChange,this._sidebarWidthDidChange,this);this.detailsSidebar=new WebInspector.Sidebar(document.getElementById("details-sidebar"),WebInspector.Sidebar.Sides.Right,null,null,WebInspector.UIString("Details"),true);this.detailsSidebar.addEventListener(WebInspector.Sidebar.Event.WidthDidChange,this._sidebarWidthDidChange,this);this.searchKeyboardShortcut=new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl|WebInspector.KeyboardShortcut.Modifier.Shift,"F",this._focusSearchField.bind(this));this._findKeyboardShortcut=new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl,"F",this._find.bind(this));this._saveKeyboardShortcut=new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl,"S",this._save.bind(this));this._saveAsKeyboardShortcut=new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.Shift|WebInspector.KeyboardShortcut.Modifier.CommandOrControl,"S",this._saveAs.bind(this));this.openResourceKeyboardShortcut=new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl|WebInspector.KeyboardShortcut.Modifier.Shift,"O",this._showOpenResourceDialog.bind(this));new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl,"P",this._showOpenResourceDialog.bind(this));this.navigationSidebarKeyboardShortcut=new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl|WebInspector.KeyboardShortcut.Modifier.Shift,"0",this.toggleNavigationSidebar.bind(this));this.detailsSidebarKeyboardShortcut=new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl|WebInspector.KeyboardShortcut.Modifier.Option,"0",this.toggleDetailsSidebar.bind(this));let boundIncreaseZoom=this._increaseZoom.bind(this);let boundDecreaseZoom=this._decreaseZoom.bind(this);this._increaseZoomKeyboardShortcut=new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl,WebInspector.KeyboardShortcut.Key.Plus,boundIncreaseZoom);this._decreaseZoomKeyboardShortcut=new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl,WebInspector.KeyboardShortcut.Key.Minus,boundDecreaseZoom);this._increaseZoomKeyboardShortcut2=new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl|WebInspector.KeyboardShortcut.Modifier.Shift,WebInspector.KeyboardShortcut.Key.Plus,boundIncreaseZoom);this._decreaseZoomKeyboardShortcut2=new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl|WebInspector.KeyboardShortcut.Modifier.Shift,WebInspector.KeyboardShortcut.Key.Minus,boundDecreaseZoom);this._resetZoomKeyboardShortcut=new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl,"0",this._resetZoom.bind(this));this._showTabAtIndexKeyboardShortcuts=[1,2,3,4,5,6,7,8,9].map((i)=>new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl|WebInspector.KeyboardShortcut.Modifier.Option,`${i}`,this._showTabAtIndex.bind(this,i)));this._openNewTabKeyboardShortcut=new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl|WebInspector.KeyboardShortcut.Modifier.Option,"T",this.showNewTabTab.bind(this));this.tabBrowser=new WebInspector.TabBrowser(document.getElementById("tab-browser"),this.tabBar,this.navigationSidebar,this.detailsSidebar);this.tabBrowser.addEventListener(WebInspector.TabBrowser.Event.SelectedTabContentViewDidChange,this._tabBrowserSelectedTabContentViewDidChange,this);this._reloadPageKeyboardShortcut=new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl,"R",this._reloadPage.bind(this));this._reloadPageIgnoringCacheKeyboardShortcut=new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl|WebInspector.KeyboardShortcut.Modifier.Shift,"R",this._reloadPageIgnoringCache.bind(this));this._reloadPageKeyboardShortcut.implicitlyPreventsDefault=this._reloadPageIgnoringCacheKeyboardShortcut.implicitlyPreventsDefault=false;this._consoleTabKeyboardShortcut=new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.Option|WebInspector.KeyboardShortcut.Modifier.CommandOrControl,"C",this._showConsoleTab.bind(this));this._quickConsoleKeyboardShortcut=new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.Control,WebInspector.KeyboardShortcut.Key.Apostrophe,this._focusConsolePrompt.bind(this));this._inspectModeKeyboardShortcut=new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl|WebInspector.KeyboardShortcut.Modifier.Shift,"C",this._toggleInspectMode.bind(this));this._undoKeyboardShortcut=new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl,"Z",this._undoKeyboardShortcut.bind(this));this._redoKeyboardShortcut=new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl|WebInspector.KeyboardShortcut.Modifier.Shift,"Z",this._redoKeyboardShortcut.bind(this));this._undoKeyboardShortcut.implicitlyPreventsDefault=this._redoKeyboardShortcut.implicitlyPreventsDefault=false;this.toggleBreakpointsKeyboardShortcut=new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl,"Y",this.debuggerToggleBreakpoints.bind(this));this.pauseOrResumeKeyboardShortcut=new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.Control|WebInspector.KeyboardShortcut.Modifier.CommandOrControl,"Y",this.debuggerPauseResumeToggle.bind(this));this.stepOverKeyboardShortcut=new WebInspector.KeyboardShortcut(null,WebInspector.KeyboardShortcut.Key.F6,this.debuggerStepOver.bind(this));this.stepIntoKeyboardShortcut=new WebInspector.KeyboardShortcut(null,WebInspector.KeyboardShortcut.Key.F7,this.debuggerStepInto.bind(this));this.stepOutKeyboardShortcut=new WebInspector.KeyboardShortcut(null,WebInspector.KeyboardShortcut.Key.F8,this.debuggerStepOut.bind(this));this.pauseOrResumeAlternateKeyboardShortcut=new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl,WebInspector.KeyboardShortcut.Key.Backslash,this.debuggerPauseResumeToggle.bind(this));this.stepOverAlternateKeyboardShortcut=new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl,WebInspector.KeyboardShortcut.Key.SingleQuote,this.debuggerStepOver.bind(this));this.stepIntoAlternateKeyboardShortcut=new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl,WebInspector.KeyboardShortcut.Key.Semicolon,this.debuggerStepInto.bind(this));this.stepOutAlternateKeyboardShortcut=new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.Shift|WebInspector.KeyboardShortcut.Modifier.CommandOrControl,WebInspector.KeyboardShortcut.Key.Semicolon,this.debuggerStepOut.bind(this));this._closeToolbarButton=new WebInspector.ControlToolbarItem("dock-close",WebInspector.UIString("Close"),"Images/Close.svg",16,14);this._closeToolbarButton.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,this.close,this);this._undockToolbarButton=new WebInspector.ButtonToolbarItem("undock",WebInspector.UIString("Detach into separate window"),null,"Images/Undock.svg");this._undockToolbarButton.element.classList.add(WebInspector.Popover.IgnoreAutoDismissClassName);this._undockToolbarButton.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,this._undock,this);let dockImage=WebInspector.resolvedLayoutDirection()===WebInspector.LayoutDirection.RTL?"Images/DockLeft.svg":"Images/DockRight.svg";this._dockToSideToolbarButton=new WebInspector.ButtonToolbarItem("dock-right",WebInspector.UIString("Dock to side of window"),null,dockImage);this._dockToSideToolbarButton.element.classList.add(WebInspector.Popover.IgnoreAutoDismissClassName);let dockToSideCallback=WebInspector.resolvedLayoutDirection()===WebInspector.LayoutDirection.RTL?this._dockLeft:this._dockRight;this._dockToSideToolbarButton.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,dockToSideCallback,this);this._dockBottomToolbarButton=new WebInspector.ButtonToolbarItem("dock-bottom",WebInspector.UIString("Dock to bottom of window"),null,"Images/DockBottom.svg");this._dockBottomToolbarButton.element.classList.add(WebInspector.Popover.IgnoreAutoDismissClassName);this._dockBottomToolbarButton.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,this._dockBottom,this);this._togglePreviousDockConfigurationKeyboardShortcut=new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.CommandOrControl|WebInspector.KeyboardShortcut.Modifier.Shift,"D",this._togglePreviousDockConfiguration.bind(this));var toolTip;if(WebInspector.debuggableType===WebInspector.DebuggableType.JavaScript)
toolTip=WebInspector.UIString("Restart (%s)").format(this._reloadPageKeyboardShortcut.displayName);else
toolTip=WebInspector.UIString("Reload this page (%s)\nReload ignoring cache (%s)").format(this._reloadPageKeyboardShortcut.displayName,this._reloadPageIgnoringCacheKeyboardShortcut.displayName);this._reloadToolbarButton=new WebInspector.ButtonToolbarItem("reload",toolTip,null,"Images/ReloadToolbar.svg");this._reloadToolbarButton.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,this._reloadPageClicked,this);this._downloadToolbarButton=new WebInspector.ButtonToolbarItem("download",WebInspector.UIString("Download Web Archive"),null,"Images/DownloadArrow.svg");this._downloadToolbarButton.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,this._downloadWebArchive,this);this._updateReloadToolbarButton();this._updateDownloadToolbarButton();if(this.debuggableType===WebInspector.DebuggableType.Web){var toolTip=WebInspector.UIString("Start element selection (%s)").format(WebInspector._inspectModeKeyboardShortcut.displayName);var activatedToolTip=WebInspector.UIString("Stop element selection (%s)").format(WebInspector._inspectModeKeyboardShortcut.displayName);this._inspectModeToolbarButton=new WebInspector.ActivateButtonToolbarItem("inspect",toolTip,activatedToolTip,null,"Images/Crosshair.svg");this._inspectModeToolbarButton.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked,this._toggleInspectMode,this);}
this._dashboardContainer=new WebInspector.DashboardContainerView;this._dashboardContainer.showDashboardViewForRepresentedObject(this.dashboardManager.dashboards.default);this._searchToolbarItem=new WebInspector.SearchBar("inspector-search",WebInspector.UIString("Search"),null,true);this._searchToolbarItem.addEventListener(WebInspector.SearchBar.Event.TextChanged,this._searchTextDidChange,this);this.toolbar.addToolbarItem(this._closeToolbarButton,WebInspector.Toolbar.Section.Control);this.toolbar.addToolbarItem(this._undockToolbarButton,WebInspector.Toolbar.Section.Left);this.toolbar.addToolbarItem(this._dockToSideToolbarButton,WebInspector.Toolbar.Section.Left);this.toolbar.addToolbarItem(this._dockBottomToolbarButton,WebInspector.Toolbar.Section.Left);this.toolbar.addToolbarItem(this._reloadToolbarButton,WebInspector.Toolbar.Section.CenterLeft);this.toolbar.addToolbarItem(this._downloadToolbarButton,WebInspector.Toolbar.Section.CenterLeft);this.toolbar.addToolbarItem(this._dashboardContainer.toolbarItem,WebInspector.Toolbar.Section.Center);if(this._inspectModeToolbarButton)
this.toolbar.addToolbarItem(this._inspectModeToolbarButton,WebInspector.Toolbar.Section.CenterRight);this.toolbar.addToolbarItem(this._searchToolbarItem,WebInspector.Toolbar.Section.Right);this.modifierKeys={altKey:false,metaKey:false,shiftKey:false};let dockedResizerElement=document.getElementById("docked-resizer");dockedResizerElement.classList.add(WebInspector.Popover.IgnoreAutoDismissClassName);dockedResizerElement.addEventListener("mousedown",this._dockedResizerMouseDown.bind(this));this._dockingAvailable=false;this._updateDockNavigationItems();this._setupViewHierarchy();let productionTabClasses=[WebInspector.ConsoleTabContentView,WebInspector.DebuggerTabContentView,WebInspector.ElementsTabContentView,WebInspector.NetworkTabContentView,WebInspector.NewTabContentView,WebInspector.ResourcesTabContentView,WebInspector.SearchTabContentView,WebInspector.SettingsTabContentView,WebInspector.StorageTabContentView,WebInspector.TimelineTabContentView,];this._knownTabClassesByType=new Map;
for(let tabClass of productionTabClasses)
this._knownTabClassesByType.set(tabClass.Type,tabClass);this._pendingOpenTabs=[];let openTabTypes=this._openTabsSetting.value;let seenTabTypes=new Set;for(let i=0;i<openTabTypes.length;++i){let tabType=openTabTypes[i];if(seenTabTypes.has(tabType))
continue;seenTabTypes.add(tabType);if(!this.isTabTypeAllowed(tabType)){this._pendingOpenTabs.push({tabType,index:i});continue;}
let tabContentView=this._createTabContentViewForType(tabType);if(!tabContentView)
continue;this.tabBrowser.addTabForContentView(tabContentView,{suppressAnimations:true});}
this._restoreCookieForOpenTabs(WebInspector.StateRestorationType.Load);this.tabBar.selectedTabBarItem=this._selectedTabIndexSetting.value;if(!this.tabBar.selectedTabBarItem)
this.tabBar.selectedTabBarItem=0;if(!this.tabBar.normalTabCount)
this.showNewTabTab({suppressAnimations:true});this.tabBar.addEventListener(WebInspector.TabBar.Event.TabBarItemAdded,this._rememberOpenTabs,this);this.tabBar.addEventListener(WebInspector.TabBar.Event.TabBarItemRemoved,this._rememberOpenTabs,this);this.tabBar.addEventListener(WebInspector.TabBar.Event.TabBarItemsReordered,this._rememberOpenTabs,this);InspectorFrontendAPI.loadCompleted();
InspectorFrontendHost.loaded();if(this._showingSplitConsoleSetting.value)
this.showSplitConsole();window.__frontendCompletedLoad=true;if(this.runBootstrapOperations)
this.runBootstrapOperations();};
WebInspector.instanceForClass=function(constructor)
{let key=`__${constructor.name}`;if(!WebInspector[key])
WebInspector[key]=new constructor;return WebInspector[key];};WebInspector.isTabTypeAllowed=function(tabType)
{let tabClass=this._knownTabClassesByType.get(tabType);if(!tabClass)
return false;return tabClass.isTabAllowed();};WebInspector.knownTabClasses=function()
{return new Set(this._knownTabClassesByType.values());};WebInspector._showOpenResourceDialog=function()
{if(!this._openResourceDialog)
this._openResourceDialog=new WebInspector.OpenResourceDialog(this);if(this._openResourceDialog.visible)
return;this._openResourceDialog.present(this._contentElement);};WebInspector._createTabContentViewForType=function(tabType)
{let tabClass=this._knownTabClassesByType.get(tabType);if(!tabClass){console.error("Unknown tab type",tabType);return null;}
return new tabClass;};WebInspector._rememberOpenTabs=function()
{let seenTabTypes=new Set;let openTabs=[];for(let tabBarItem of this.tabBar.tabBarItems){let tabContentView=tabBarItem.representedObject;if(!(tabContentView instanceof WebInspector.TabContentView))
continue;if(!tabContentView.constructor.shouldSaveTab())
continue;openTabs.push(tabContentView.type);seenTabTypes.add(tabContentView.type);}
for(let{tabType,index}of this._pendingOpenTabs){if(seenTabTypes.has(tabType))
continue;openTabs.insertAtIndex(tabType,index);seenTabTypes.add(tabType);}
this._openTabsSetting.value=openTabs;};WebInspector._openDefaultTab=function(event)
{this.showNewTabTab({suppressAnimations:true});};WebInspector._showSettingsTab=function(event)
{this.tabBrowser.showTabForContentView(this.settingsTabContentView);};WebInspector._tryToRestorePendingTabs=function()
{let stillPendingOpenTabs=[];for(let{tabType,index}of this._pendingOpenTabs){if(!this.isTabTypeAllowed(tabType)){stillPendingOpenTabs.push({tabType,index});continue;}
let tabContentView=this._createTabContentViewForType(tabType);if(!tabContentView)
continue;this.tabBrowser.addTabForContentView(tabContentView,{suppressAnimations:true,insertionIndex:index,});tabContentView.restoreStateFromCookie(WebInspector.StateRestorationType.Load);}
this._pendingOpenTabs=stillPendingOpenTabs;this.tabBrowser.tabBar.updateNewTabTabBarItemState();};WebInspector.showNewTabTab=function(options)
{if(!this.isNewTabWithTypeAllowed(WebInspector.NewTabContentView.Type))
return;let tabContentView=this.tabBrowser.bestTabContentViewForClass(WebInspector.NewTabContentView);if(!tabContentView)
tabContentView=new WebInspector.NewTabContentView;this.tabBrowser.showTabForContentView(tabContentView,options);};WebInspector.isNewTabWithTypeAllowed=function(tabType)
{let tabClass=this._knownTabClassesByType.get(tabType);if(!tabClass||!tabClass.isTabAllowed())
return false;for(let tabBarItem of this.tabBar.tabBarItems){let tabContentView=tabBarItem.representedObject;if(!(tabContentView instanceof WebInspector.TabContentView))
continue;if(tabContentView.constructor===tabClass)
return false;}
if(tabClass===WebInspector.NewTabContentView){let allTabs=Array.from(this.knownTabClasses());let addableTabs=allTabs.filter((tabClass)=>!tabClass.isEphemeral());let canMakeNewTab=addableTabs.some((tabClass)=>WebInspector.isNewTabWithTypeAllowed(tabClass.Type));return canMakeNewTab;}
return true;};WebInspector.createNewTabWithType=function(tabType,options={})
{let{referencedView,shouldReplaceTab,shouldShowNewTab}=options;let tabContentView=this._createTabContentViewForType(tabType);const suppressAnimations=true;this.tabBrowser.addTabForContentView(tabContentView,{suppressAnimations,insertionIndex:referencedView?this.tabBar.tabBarItems.indexOf(referencedView.tabBarItem):undefined,});if(shouldReplaceTab)
this.tabBrowser.closeTabForContentView(referencedView,{suppressAnimations});if(shouldShowNewTab)
this.tabBrowser.showTabForContentView(tabContentView);};WebInspector.registerTabClass=function(tabClass)
{if(!WebInspector.TabContentView.isPrototypeOf(tabClass))
return;if(this._knownTabClassesByType.has(tabClass.Type))
return;this._knownTabClassesByType.set(tabClass.Type,tabClass);this._tryToRestorePendingTabs();this.notifications.dispatchEventToListeners(WebInspector.Notification.TabTypesChanged);};WebInspector.activateExtraDomains=function(domains)
{this.hasExtraDomains=true;for(var domain of domains){var agent=InspectorBackend.activateDomain(domain);if(agent.enable)
agent.enable();}
this.notifications.dispatchEventToListeners(WebInspector.Notification.ExtraDomainsActivated,{"domains":domains});WebInspector.CSSCompletions.requestCSSCompletions();this._updateReloadToolbarButton();this._updateDownloadToolbarButton();this._tryToRestorePendingTabs();};WebInspector.updateWindowTitle=function()
{var mainFrame=this.frameResourceManager.mainFrame;if(!mainFrame)
return;var urlComponents=mainFrame.mainResource.urlComponents;var lastPathComponent;try{lastPathComponent=decodeURIComponent(urlComponents.lastPathComponent||"");}catch(e){lastPathComponent=urlComponents.lastPathComponent;}
if(urlComponents.host&&lastPathComponent)
var title=this.displayNameForHost(urlComponents.host)+" \u2014 "+lastPathComponent;else if(urlComponents.host)
var title=this.displayNameForHost(urlComponents.host);else if(lastPathComponent)
var title=lastPathComponent;else
var title=mainFrame.url;
InspectorFrontendHost.inspectedURLChanged(title);};WebInspector.updateDockingAvailability=function(available)
{this._dockingAvailable=available;this._updateDockNavigationItems();};WebInspector.updateDockedState=function(side)
{if(this._dockConfiguration===side)
return;this._previousDockConfiguration=this._dockConfiguration;if(!this._previousDockConfiguration){if(side===WebInspector.DockConfiguration.Right||side===WebInspector.DockConfiguration.Left)
this._previousDockConfiguration=WebInspector.DockConfiguration.Bottom;else
this._previousDockConfiguration=WebInspector.resolvedLayoutDirection()===WebInspector.LayoutDirection.RTL?WebInspector.DockConfiguration.Left:WebInspector.DockConfiguration.Right;}
this._dockConfiguration=side;this.docked=side!==WebInspector.DockConfiguration.Undocked;this._ignoreToolbarModeDidChangeEvents=true;if(side===WebInspector.DockConfiguration.Bottom){document.body.classList.add("docked",WebInspector.DockConfiguration.Bottom);document.body.classList.remove("window-inactive",WebInspector.DockConfiguration.Right,WebInspector.DockConfiguration.Left);}else if(side===WebInspector.DockConfiguration.Right){document.body.classList.add("docked",WebInspector.DockConfiguration.Right);document.body.classList.remove("window-inactive",WebInspector.DockConfiguration.Bottom,WebInspector.DockConfiguration.Left);}else if(side===WebInspector.DockConfiguration.Left){document.body.classList.add("docked",WebInspector.DockConfiguration.Left);document.body.classList.remove("window-inactive",WebInspector.DockConfiguration.Bottom,WebInspector.DockConfiguration.Right);}else
document.body.classList.remove("docked",WebInspector.DockConfiguration.Right,WebInspector.DockConfiguration.Left,WebInspector.DockConfiguration.Bottom);this._ignoreToolbarModeDidChangeEvents=false;this._updateDockNavigationItems();if(!this.dockedConfigurationSupportsSplitContentBrowser()&&!this.doesCurrentTabSupportSplitContentBrowser())
this.hideSplitConsole();};WebInspector.updateVisibilityState=function(visible)
{this.visible=visible;this.notifications.dispatchEventToListeners(WebInspector.Notification.VisibilityStateDidChange);};WebInspector.handlePossibleLinkClick=function(event,frame,options={})
{var anchorElement=event.target.enclosingNodeOrSelfWithNodeName("a");if(!anchorElement||!anchorElement.href)
return false;if(WebInspector.isBeingEdited(anchorElement)){return false;}
event.preventDefault();event.stopPropagation();this.openURL(anchorElement.href,frame,Object.shallowMerge(options,{lineNumber:anchorElement.lineNumber}));return true;};WebInspector.openURL=function(url,frame,options={})
{if(!url)
return;if(options.alwaysOpenExternally===undefined||options.alwaysOpenExternally===null)
options.alwaysOpenExternally=window.event?window.event.metaKey:false;if(options.alwaysOpenExternally){InspectorFrontendHost.openInNewTab(url);return;}
var searchChildFrames=false;if(!frame){frame=this.frameResourceManager.mainFrame;searchChildFrames=true;}
let simplifiedURL=removeURLFragment(url);var resource=frame.url===simplifiedURL?frame.mainResource:frame.resourceForURL(simplifiedURL,searchChildFrames);if(resource){let positionToReveal=new WebInspector.SourceCodePosition(options.lineNumber,0);this.showSourceCode(resource,Object.shallowMerge(options,{positionToReveal}));return;}
InspectorFrontendHost.openInNewTab(url);};WebInspector.close=function()
{if(this._isClosing)
return;this._isClosing=true;InspectorFrontendHost.closeWindow();};WebInspector.saveDataToFile=function(saveData,forceSaveAs)
{if(!saveData)
return;if(typeof saveData.customSaveHandler==="function"){saveData.customSaveHandler(forceSaveAs);return;}
if(!saveData.content)
return;let url=saveData.url||"";let suggestedName=parseURL(url).lastPathComponent;if(!suggestedName){suggestedName=WebInspector.UIString("Untitled");let dataURLTypeMatch=/^data:([^;]+)/.exec(url);if(dataURLTypeMatch)
suggestedName+=WebInspector.fileExtensionForMIMEType(dataURLTypeMatch[1])||"";}
if(typeof saveData.content==="string"){const base64Encoded=false;InspectorFrontendHost.save(suggestedName,saveData.content,base64Encoded,forceSaveAs||saveData.forceSaveAs);return;}
let fileReader=new FileReader;fileReader.readAsDataURL(saveData.content);fileReader.addEventListener("loadend",()=>{let dataURLComponents=parseDataURL(fileReader.result);const base64Encoded=true;InspectorFrontendHost.save(suggestedName,dataURLComponents.data,base64Encoded,forceSaveAs||saveData.forceSaveAs);});};WebInspector.isConsoleFocused=function()
{return this.quickConsole.prompt.focused;};WebInspector.isShowingSplitConsole=function()
{return!this.consoleDrawer.collapsed;};WebInspector.dockedConfigurationSupportsSplitContentBrowser=function()
{return this._dockConfiguration!==WebInspector.DockConfiguration.Bottom;};WebInspector.doesCurrentTabSupportSplitContentBrowser=function()
{var currentContentView=this.tabBrowser.selectedTabContentView;return!currentContentView||currentContentView.supportsSplitContentBrowser;};WebInspector.toggleSplitConsole=function()
{if(!this.doesCurrentTabSupportSplitContentBrowser()){this.showConsoleTab();return;}
if(this.isShowingSplitConsole())
this.hideSplitConsole();else
this.showSplitConsole();};WebInspector.showSplitConsole=function()
{if(!this.doesCurrentTabSupportSplitContentBrowser()){this.showConsoleTab();return;}
this.consoleDrawer.collapsed=false;if(this.consoleDrawer.currentContentView===this.consoleContentView)
return;
if(this.consoleContentView.parentContainer)
this.consoleContentView.parentContainer.closeContentView(this.consoleContentView);this.consoleDrawer.showContentView(this.consoleContentView);};WebInspector.hideSplitConsole=function()
{if(!this.isShowingSplitConsole())
return;this.consoleDrawer.collapsed=true;};WebInspector.showConsoleTab=function(requestedScope)
{requestedScope=requestedScope||WebInspector.LogContentView.Scopes.All;this.hideSplitConsole();this.consoleContentView.scopeBar.item(requestedScope).selected=true;this.showRepresentedObject(this._consoleRepresentedObject);};WebInspector.isShowingConsoleTab=function()
{return this.tabBrowser.selectedTabContentView instanceof WebInspector.ConsoleTabContentView;};WebInspector.showElementsTab=function()
{var tabContentView=this.tabBrowser.bestTabContentViewForClass(WebInspector.ElementsTabContentView);if(!tabContentView)
tabContentView=new WebInspector.ElementsTabContentView;this.tabBrowser.showTabForContentView(tabContentView);};WebInspector.showDebuggerTab=function(options)
{var tabContentView=this.tabBrowser.bestTabContentViewForClass(WebInspector.DebuggerTabContentView);if(!tabContentView)
tabContentView=new WebInspector.DebuggerTabContentView;if(options.breakpointToSelect instanceof WebInspector.Breakpoint)
tabContentView.revealAndSelectBreakpoint(options.breakpointToSelect);if(options.showScopeChainSidebar)
tabContentView.showScopeChainDetailsSidebarPanel();this.tabBrowser.showTabForContentView(tabContentView);};WebInspector.isShowingDebuggerTab=function()
{return this.tabBrowser.selectedTabContentView instanceof WebInspector.DebuggerTabContentView;};WebInspector.showResourcesTab=function()
{var tabContentView=this.tabBrowser.bestTabContentViewForClass(WebInspector.ResourcesTabContentView);if(!tabContentView)
tabContentView=new WebInspector.ResourcesTabContentView;this.tabBrowser.showTabForContentView(tabContentView);};WebInspector.isShowingResourcesTab=function()
{return this.tabBrowser.selectedTabContentView instanceof WebInspector.ResourcesTabContentView;};WebInspector.showStorageTab=function()
{var tabContentView=this.tabBrowser.bestTabContentViewForClass(WebInspector.StorageTabContentView);if(!tabContentView)
tabContentView=new WebInspector.StorageTabContentView;this.tabBrowser.showTabForContentView(tabContentView);};WebInspector.showNetworkTab=function()
{var tabContentView=this.tabBrowser.bestTabContentViewForClass(WebInspector.NetworkTabContentView);if(!tabContentView)
tabContentView=new WebInspector.NetworkTabContentView;this.tabBrowser.showTabForContentView(tabContentView);};WebInspector.showTimelineTab=function()
{var tabContentView=this.tabBrowser.bestTabContentViewForClass(WebInspector.TimelineTabContentView);if(!tabContentView)
tabContentView=new WebInspector.TimelineTabContentView;this.tabBrowser.showTabForContentView(tabContentView);};WebInspector.indentString=function()
{if(WebInspector.settings.indentWithTabs.value)
return"\t";return" ".repeat(WebInspector.settings.indentUnit.value);};WebInspector.restoreFocusFromElement=function(element)
{if(element&&element.isSelfOrAncestor(this.currentFocusElement))
this.previousFocusElement.focus();};WebInspector.toggleNavigationSidebar=function(event)
{if(!this.navigationSidebar.collapsed||!this.navigationSidebar.sidebarPanels.length){this.navigationSidebar.collapsed=true;return;}
if(!this.navigationSidebar.selectedSidebarPanel)
this.navigationSidebar.selectedSidebarPanel=this.navigationSidebar.sidebarPanels[0];this.navigationSidebar.collapsed=false;};WebInspector.toggleDetailsSidebar=function(event)
{if(!this.detailsSidebar.collapsed||!this.detailsSidebar.sidebarPanels.length){this.detailsSidebar.collapsed=true;return;}
if(!this.detailsSidebar.selectedSidebarPanel)
this.detailsSidebar.selectedSidebarPanel=this.detailsSidebar.sidebarPanels[0];this.detailsSidebar.collapsed=false;};WebInspector.tabContentViewClassForRepresentedObject=function(representedObject)
{if(representedObject instanceof WebInspector.DOMTree)
return WebInspector.ElementsTabContentView;if(representedObject instanceof WebInspector.TimelineRecording)
return WebInspector.TimelineTabContentView;if(representedObject===this._consoleRepresentedObject)
return WebInspector.ConsoleTabContentView;if(WebInspector.debuggerManager.paused){if(representedObject instanceof WebInspector.Script)
return WebInspector.DebuggerTabContentView;if(representedObject instanceof WebInspector.Resource&&(representedObject.type===WebInspector.Resource.Type.Document||representedObject.type===WebInspector.Resource.Type.Script))
return WebInspector.DebuggerTabContentView;}
if(representedObject instanceof WebInspector.Frame||representedObject instanceof WebInspector.Resource||representedObject instanceof WebInspector.Script||representedObject instanceof WebInspector.CSSStyleSheet||representedObject instanceof WebInspector.Canvas)
return WebInspector.ResourcesTabContentView;if(representedObject instanceof WebInspector.ContentFlow)
return WebInspector.ResourcesTabContentView;if(representedObject instanceof WebInspector.DOMStorageObject||representedObject instanceof WebInspector.CookieStorageObject||representedObject instanceof WebInspector.DatabaseTableObject||representedObject instanceof WebInspector.DatabaseObject||representedObject instanceof WebInspector.ApplicationCacheFrame||representedObject instanceof WebInspector.IndexedDatabaseObjectStore||representedObject instanceof WebInspector.IndexedDatabaseObjectStoreIndex)
return WebInspector.ResourcesTabContentView;return null;};WebInspector.tabContentViewForRepresentedObject=function(representedObject,options={})
{let tabContentView=this.tabBrowser.bestTabContentViewForRepresentedObject(representedObject,options);if(tabContentView)
return tabContentView;var tabContentViewClass=this.tabContentViewClassForRepresentedObject(representedObject);if(!tabContentViewClass){console.error("Unknown representedObject, couldn't create TabContentView.",representedObject);return null;}
tabContentView=new tabContentViewClass;this.tabBrowser.addTabForContentView(tabContentView);return tabContentView;};WebInspector.showRepresentedObject=function(representedObject,cookie,options={})
{let tabContentView=this.tabContentViewForRepresentedObject(representedObject,options);if(!tabContentView)
return;this.tabBrowser.showTabForContentView(tabContentView,options);tabContentView.showRepresentedObject(representedObject,cookie);};WebInspector.showMainFrameDOMTree=function(nodeToSelect,options={})
{if(!WebInspector.frameResourceManager.mainFrame)
return;this.showRepresentedObject(WebInspector.frameResourceManager.mainFrame.domTree,{nodeToSelect},options);};WebInspector.showSourceCodeForFrame=function(frameIdentifier,options={})
{var frame=WebInspector.frameResourceManager.frameForIdentifier(frameIdentifier);if(!frame){this._frameIdentifierToShowSourceCodeWhenAvailable=frameIdentifier;return;}
this._frameIdentifierToShowSourceCodeWhenAvailable=undefined;this.showRepresentedObject(frame,null,options);};WebInspector.showSourceCode=function(sourceCode,options={})
{const positionToReveal=options.positionToReveal;var representedObject=sourceCode;if(representedObject instanceof WebInspector.Script){representedObject=representedObject.resource||representedObject;}
var cookie=positionToReveal?{lineNumber:positionToReveal.lineNumber,columnNumber:positionToReveal.columnNumber}:{};this.showRepresentedObject(representedObject,cookie,options);};WebInspector.showSourceCodeLocation=function(sourceCodeLocation,options={})
{this.showSourceCode(sourceCodeLocation.displaySourceCode,Object.shallowMerge(options,{positionToReveal:sourceCodeLocation.displayPosition(),}));};WebInspector.showOriginalUnformattedSourceCodeLocation=function(sourceCodeLocation,options={})
{this.showSourceCode(sourceCodeLocation.sourceCode,Object.shallowMerge(options,{positionToReveal:sourceCodeLocation.position(),forceUnformatted:true,}));};WebInspector.showOriginalOrFormattedSourceCodeLocation=function(sourceCodeLocation,options={})
{this.showSourceCode(sourceCodeLocation.sourceCode,Object.shallowMerge(options,{positionToReveal:sourceCodeLocation.formattedPosition(),}));};WebInspector.showOriginalOrFormattedSourceCodeTextRange=function(sourceCodeTextRange,options={})
{var textRangeToSelect=sourceCodeTextRange.formattedTextRange;this.showSourceCode(sourceCodeTextRange.sourceCode,Object.shallowMerge(options,{positionToReveal:textRangeToSelect.startPosition(),textRangeToSelect,}));};WebInspector.showResourceRequest=function(resource,options={})
{this.showRepresentedObject(resource,{[WebInspector.ResourceClusterContentView.ContentViewIdentifierCookieKey]:WebInspector.ResourceClusterContentView.RequestIdentifier},options);};WebInspector.debuggerToggleBreakpoints=function(event)
{WebInspector.debuggerManager.breakpointsEnabled=!WebInspector.debuggerManager.breakpointsEnabled;};WebInspector.debuggerPauseResumeToggle=function(event)
{if(WebInspector.debuggerManager.paused)
WebInspector.debuggerManager.resume();else
WebInspector.debuggerManager.pause();};WebInspector.debuggerStepOver=function(event)
{WebInspector.debuggerManager.stepOver();};WebInspector.debuggerStepInto=function(event)
{WebInspector.debuggerManager.stepInto();};WebInspector.debuggerStepOut=function(event)
{WebInspector.debuggerManager.stepOut();};WebInspector._searchTextDidChange=function(event)
{var tabContentView=this.tabBrowser.bestTabContentViewForClass(WebInspector.SearchTabContentView);if(!tabContentView)
tabContentView=new WebInspector.SearchTabContentView;var searchQuery=this._searchToolbarItem.text;this._searchToolbarItem.text="";this.tabBrowser.showTabForContentView(tabContentView);tabContentView.performSearch(searchQuery);};WebInspector._focusSearchField=function(event)
{if(this.tabBrowser.selectedTabContentView instanceof WebInspector.SearchTabContentView){this.tabBrowser.selectedTabContentView.focusSearchField();return;}
this._searchToolbarItem.focus();};WebInspector._focusChanged=function(event)
{
if(WebInspector.isEventTargetAnEditableField(event)){var codeMirrorEditorElement=event.target.enclosingNodeOrSelfWithClass("CodeMirror");if(codeMirrorEditorElement&&codeMirrorEditorElement!==this.currentFocusElement){this.previousFocusElement=this.currentFocusElement;this.currentFocusElement=codeMirrorEditorElement;}
if(!WebInspector.isBeingEdited(event.target))
return;}
var selection=window.getSelection();if(!selection.isCollapsed)
return;var element=event.target;if(element!==this.currentFocusElement){this.previousFocusElement=this.currentFocusElement;this.currentFocusElement=element;}
if(element.isInsertionCaretInside())
return;var selectionRange=element.ownerDocument.createRange();selectionRange.setStart(element,0);selectionRange.setEnd(element,0);selection.removeAllRanges();selection.addRange(selectionRange);};WebInspector._mouseWasClicked=function(event)
{this.handlePossibleLinkClick(event);};WebInspector._dragOver=function(event)
{if(event.defaultPrevented)
return;if(WebInspector.isEventTargetAnEditableField(event))
return;event.dataTransfer.dropEffect="none";event.preventDefault();};WebInspector._debuggerDidPause=function(event)
{this.showDebuggerTab({showScopeChainSidebar:WebInspector.settings.showScopeChainOnPause.value});this._dashboardContainer.showDashboardViewForRepresentedObject(this.dashboardManager.dashboards.debugger);InspectorFrontendHost.bringToFront();};WebInspector._debuggerDidResume=function(event)
{this._dashboardContainer.closeDashboardViewForRepresentedObject(this.dashboardManager.dashboards.debugger);};WebInspector._frameWasAdded=function(event)
{if(!this._frameIdentifierToShowSourceCodeWhenAvailable)
return;var frame=event.data.frame;if(frame.id!==this._frameIdentifierToShowSourceCodeWhenAvailable)
return;function delayedWork()
{const options={ignoreNetworkTab:true,ignoreSearchTab:true,};this.showSourceCodeForFrame(frame.id,options);}
setTimeout(delayedWork.bind(this));};WebInspector._mainFrameDidChange=function(event)
{this._updateDownloadToolbarButton();this.updateWindowTitle();};WebInspector._mainResourceDidChange=function(event)
{if(!event.target.isMainFrame())
return;this._inProvisionalLoad=false;
setTimeout(this._restoreCookieForOpenTabs.bind(this,WebInspector.StateRestorationType.Navigation));this._updateDownloadToolbarButton();this.updateWindowTitle();};WebInspector._provisionalLoadStarted=function(event)
{if(!event.target.isMainFrame())
return;this._saveCookieForOpenTabs();this._inProvisionalLoad=true;};WebInspector._restoreCookieForOpenTabs=function(restorationType)
{for(var tabBarItem of this.tabBar.tabBarItems){var tabContentView=tabBarItem.representedObject;if(!(tabContentView instanceof WebInspector.TabContentView))
continue;tabContentView.restoreStateFromCookie(restorationType);}};WebInspector._saveCookieForOpenTabs=function()
{for(var tabBarItem of this.tabBar.tabBarItems){var tabContentView=tabBarItem.representedObject;if(!(tabContentView instanceof WebInspector.TabContentView))
continue;tabContentView.saveStateToCookie();}};WebInspector._windowFocused=function(event)
{if(event.target.document.nodeType!==Node.DOCUMENT_NODE)
return;document.body.classList.remove(this.docked?"window-docked-inactive":"window-inactive");};WebInspector._windowBlurred=function(event)
{if(event.target.document.nodeType!==Node.DOCUMENT_NODE)
return;document.body.classList.add(this.docked?"window-docked-inactive":"window-inactive");};WebInspector._windowResized=function(event)
{this.toolbar.updateLayout(WebInspector.View.LayoutReason.Resize);this.tabBar.updateLayout(WebInspector.View.LayoutReason.Resize);this._tabBrowserSizeDidChange();};WebInspector._updateModifierKeys=function(event)
{var didChange=this.modifierKeys.altKey!==event.altKey||this.modifierKeys.metaKey!==event.metaKey||this.modifierKeys.shiftKey!==event.shiftKey;this.modifierKeys={altKey:event.altKey,metaKey:event.metaKey,shiftKey:event.shiftKey};if(didChange)
this.notifications.dispatchEventToListeners(WebInspector.Notification.GlobalModifierKeysDidChange,event);};WebInspector._windowKeyDown=function(event)
{this._updateModifierKeys(event);};WebInspector._windowKeyUp=function(event)
{this._updateModifierKeys(event);};WebInspector._mouseDown=function(event)
{if(this.toolbar.element.isSelfOrAncestor(event.target))
this._toolbarMouseDown(event);};WebInspector._mouseMoved=function(event)
{this._updateModifierKeys(event);this.mouseCoords={x:event.pageX,y:event.pageY};};WebInspector._pageHidden=function(event)
{this._saveCookieForOpenTabs();};WebInspector._contextMenuRequested=function(event)
{let proposedContextMenu;if(WebInspector.isDebugUIEnabled()){proposedContextMenu=WebInspector.ContextMenu.createFromEvent(event);proposedContextMenu.appendSeparator();proposedContextMenu.appendItem(WebInspector.unlocalizedString("Reload Web Inspector"),()=>{window.location.reload();});let protocolSubMenu=proposedContextMenu.appendSubMenuItem(WebInspector.unlocalizedString("Protocol Debugging"),null,false);let isCapturingTraffic=InspectorBackend.activeTracer instanceof WebInspector.CapturingProtocolTracer;protocolSubMenu.appendCheckboxItem(WebInspector.unlocalizedString("Capture Trace"),()=>{if(isCapturingTraffic)
InspectorBackend.activeTracer=null;else
InspectorBackend.activeTracer=new WebInspector.CapturingProtocolTracer;},isCapturingTraffic);protocolSubMenu.appendSeparator();protocolSubMenu.appendItem(WebInspector.unlocalizedString("Export Trace\u2026"),()=>{const forceSaveAs=true;WebInspector.saveDataToFile(InspectorBackend.activeTracer.trace.saveData,forceSaveAs);},!isCapturingTraffic);}else{const onlyExisting=true;proposedContextMenu=WebInspector.ContextMenu.createFromEvent(event,onlyExisting);}
if(proposedContextMenu)
proposedContextMenu.show();};WebInspector.isDebugUIEnabled=function()
{return WebInspector.showDebugUISetting&&WebInspector.showDebugUISetting.value;};WebInspector._undock=function(event)
{InspectorFrontendHost.requestSetDockSide(WebInspector.DockConfiguration.Undocked);};WebInspector._dockBottom=function(event)
{InspectorFrontendHost.requestSetDockSide(WebInspector.DockConfiguration.Bottom);};WebInspector._dockRight=function(event)
{InspectorFrontendHost.requestSetDockSide(WebInspector.DockConfiguration.Right);};WebInspector._dockLeft=function(event)
{InspectorFrontendHost.requestSetDockSide(WebInspector.DockConfiguration.Left);};WebInspector._togglePreviousDockConfiguration=function(event)
{InspectorFrontendHost.requestSetDockSide(this._previousDockConfiguration);};WebInspector._updateDockNavigationItems=function()
{if(this._dockingAvailable||this.docked){this._closeToolbarButton.hidden=!this.docked;this._undockToolbarButton.hidden=this._dockConfiguration===WebInspector.DockConfiguration.Undocked;this._dockBottomToolbarButton.hidden=this._dockConfiguration===WebInspector.DockConfiguration.Bottom;this._dockToSideToolbarButton.hidden=this._dockConfiguration===WebInspector.DockConfiguration.Right||this._dockConfiguration===WebInspector.DockConfiguration.Left;}else{this._closeToolbarButton.hidden=true;this._undockToolbarButton.hidden=true;this._dockBottomToolbarButton.hidden=true;this._dockToSideToolbarButton.hidden=true;}};WebInspector._tabBrowserSizeDidChange=function()
{this.tabBrowser.updateLayout(WebInspector.View.LayoutReason.Resize);this.consoleDrawer.updateLayout(WebInspector.View.LayoutReason.Resize);this.quickConsole.updateLayout(WebInspector.View.LayoutReason.Resize);};WebInspector._consoleDrawerCollapsedStateDidChange=function(event)
{this._showingSplitConsoleSetting.value=WebInspector.isShowingSplitConsole();WebInspector._consoleDrawerDidResize();};WebInspector._consoleDrawerDidResize=function(event)
{this.tabBrowser.updateLayout(WebInspector.View.LayoutReason.Resize);};WebInspector._sidebarWidthDidChange=function(event)
{this._tabBrowserSizeDidChange();};WebInspector._setupViewHierarchy=function()
{let rootView=WebInspector.View.rootView();rootView.addSubview(this.toolbar);rootView.addSubview(this.tabBar);rootView.addSubview(this.navigationSidebar);rootView.addSubview(this.tabBrowser);rootView.addSubview(this.consoleDrawer);rootView.addSubview(this.quickConsole);rootView.addSubview(this.detailsSidebar);};WebInspector._tabBrowserSelectedTabContentViewDidChange=function(event)
{if(this.tabBar.selectedTabBarItem&&this.tabBar.selectedTabBarItem.representedObject.constructor.shouldSaveTab())
this._selectedTabIndexSetting.value=this.tabBar.tabBarItems.indexOf(this.tabBar.selectedTabBarItem);if(this.doesCurrentTabSupportSplitContentBrowser()){if(this._shouldRevealSpitConsoleIfSupported){this._shouldRevealSpitConsoleIfSupported=false;this.showSplitConsole();}
return;}
this._shouldRevealSpitConsoleIfSupported=this.isShowingSplitConsole();this.hideSplitConsole();};WebInspector._toolbarMouseDown=function(event)
{if(event.ctrlKey)
return;if(this._dockConfiguration===WebInspector.DockConfiguration.Right||this._dockConfiguration===WebInspector.DockConfiguration.Left)
return;if(this.docked)
this._dockedResizerMouseDown(event);else
this._moveWindowMouseDown(event);};WebInspector._dockedResizerMouseDown=function(event)
{if(event.button!==0||event.ctrlKey)
return;if(!this.docked)
return;if(event.target.id!=="docked-resizer"&&!event.target.classList.contains("toolbar")&&!event.target.classList.contains("flexible-space")&&!event.target.classList.contains("item-section"))
return;event[WebInspector.Popover.EventPreventDismissSymbol]=true;let windowProperty=this._dockConfiguration===WebInspector.DockConfiguration.Bottom?"innerHeight":"innerWidth";let eventScreenProperty=this._dockConfiguration===WebInspector.DockConfiguration.Bottom?"screenY":"screenX";let eventClientProperty=this._dockConfiguration===WebInspector.DockConfiguration.Bottom?"clientY":"clientX";var resizerElement=event.target;var firstClientPosition=event[eventClientProperty];var lastScreenPosition=event[eventScreenProperty];function dockedResizerDrag(event)
{if(event.button!==0)
return;var position=event[eventScreenProperty];var delta=position-lastScreenPosition;var clientPosition=event[eventClientProperty];lastScreenPosition=position;if(this._dockConfiguration===WebInspector.DockConfiguration.Left){if(delta>0&&clientPosition<firstClientPosition)
return;if(delta<0&&clientPosition>window[windowProperty])
return;
delta*=-1;}else{if(delta>0&&clientPosition<firstClientPosition)
return;if(delta<0&&clientPosition>firstClientPosition)
return;}
let dimension=Math.max(0,window[windowProperty]-delta);
dimension*=this.getZoomFactor();if(this._dockConfiguration===WebInspector.DockConfiguration.Bottom)
InspectorFrontendHost.setAttachedWindowHeight(dimension);else
InspectorFrontendHost.setAttachedWindowWidth(dimension);}
function dockedResizerDragEnd(event)
{if(event.button!==0)
return;WebInspector.elementDragEnd(event);}
WebInspector.elementDragStart(resizerElement,dockedResizerDrag.bind(this),dockedResizerDragEnd.bind(this),event,this._dockConfiguration===WebInspector.DockConfiguration.Bottom?"row-resize":"col-resize");};WebInspector._moveWindowMouseDown=function(event)
{if(event.button!==0||event.ctrlKey)
return;if(!event.target.classList.contains("toolbar")&&!event.target.classList.contains("flexible-space")&&!event.target.classList.contains("item-section"))
return;event[WebInspector.Popover.EventPreventDismissSymbol]=true;if(WebInspector.Platform.name==="mac"){if(WebInspector.Platform.version.release>=11){InspectorFrontendHost.startWindowDrag();event.preventDefault();return;}
if(WebInspector.Platform.version.release===10){const windowDragHandledTitleBarHeight=22;if(event.pageY<windowDragHandledTitleBarHeight){event.preventDefault();return;}}}
var lastScreenX=event.screenX;var lastScreenY=event.screenY;function toolbarDrag(event)
{if(event.button!==0)
return;var x=event.screenX-lastScreenX;var y=event.screenY-lastScreenY;InspectorFrontendHost.moveWindowBy(x,y);lastScreenX=event.screenX;lastScreenY=event.screenY;}
function toolbarDragEnd(event)
{if(event.button!==0)
return;WebInspector.elementDragEnd(event);}
WebInspector.elementDragStart(event.target,toolbarDrag,toolbarDragEnd,event,"default");};WebInspector._storageWasInspected=function(event)
{this.showStorageTab();};WebInspector._domNodeWasInspected=function(event)
{this.domTreeManager.highlightDOMNodeForTwoSeconds(event.data.node.id);InspectorFrontendHost.bringToFront();this.showElementsTab();this.showMainFrameDOMTree(event.data.node);};WebInspector._inspectModeStateChanged=function(event)
{this._inspectModeToolbarButton.activated=this.domTreeManager.inspectModeEnabled;};WebInspector._toggleInspectMode=function(event)
{this.domTreeManager.inspectModeEnabled=!this.domTreeManager.inspectModeEnabled;};WebInspector._downloadWebArchive=function(event)
{this.archiveMainFrame();};WebInspector._reloadPage=function(event)
{if(!window.PageAgent)
return;PageAgent.reload();event.preventDefault();};WebInspector._reloadPageClicked=function(event)
{PageAgent.reload.invoke({shouldIgnoreCache:window.event?window.event.shiftKey:false});};WebInspector._reloadPageIgnoringCache=function(event)
{if(!window.PageAgent)
return;PageAgent.reload(true);event.preventDefault();};WebInspector._updateReloadToolbarButton=function()
{if(!window.PageAgent){this._reloadToolbarButton.hidden=true;return;}
this._reloadToolbarButton.hidden=false;};WebInspector._updateDownloadToolbarButton=function()
{if(!window.PageAgent||!PageAgent.archive||this.debuggableType!==WebInspector.DebuggableType.Web){this._downloadToolbarButton.hidden=true;return;}
if(this._downloadingPage){this._downloadToolbarButton.enabled=false;return;}
this._downloadToolbarButton.enabled=this.canArchiveMainFrame();};WebInspector._toggleInspectMode=function(event)
{this.domTreeManager.inspectModeEnabled=!this.domTreeManager.inspectModeEnabled;};WebInspector._showConsoleTab=function(event)
{this.showConsoleTab();};WebInspector._focusConsolePrompt=function(event)
{this.quickConsole.prompt.focus();};WebInspector._focusedContentBrowser=function()
{if(this.tabBrowser.element.isSelfOrAncestor(this.currentFocusElement)||document.activeElement===document.body){var tabContentView=this.tabBrowser.selectedTabContentView;if(tabContentView instanceof WebInspector.ContentBrowserTabContentView)
return tabContentView.contentBrowser;return null;}
if(this.consoleDrawer.element.isSelfOrAncestor(this.currentFocusElement)||(WebInspector.isShowingSplitConsole()&&this.quickConsole.element.isSelfOrAncestor(this.currentFocusElement)))
return this.consoleDrawer;return null;};WebInspector._focusedContentView=function()
{if(this.tabBrowser.element.isSelfOrAncestor(this.currentFocusElement)||document.activeElement===document.body){var tabContentView=this.tabBrowser.selectedTabContentView;if(tabContentView instanceof WebInspector.ContentBrowserTabContentView)
return tabContentView.contentBrowser.currentContentView;return tabContentView;}
if(this.consoleDrawer.element.isSelfOrAncestor(this.currentFocusElement)||(WebInspector.isShowingSplitConsole()&&this.quickConsole.element.isSelfOrAncestor(this.currentFocusElement)))
return this.consoleDrawer.currentContentView;return null;};WebInspector._focusedOrVisibleContentBrowser=function()
{let focusedContentBrowser=this._focusedContentBrowser();if(focusedContentBrowser)
return focusedContentBrowser;var tabContentView=this.tabBrowser.selectedTabContentView;if(tabContentView instanceof WebInspector.ContentBrowserTabContentView)
return tabContentView.contentBrowser;return null;};WebInspector.focusedOrVisibleContentView=function()
{let focusedContentView=this._focusedContentView();if(focusedContentView)
return focusedContentView;var tabContentView=this.tabBrowser.selectedTabContentView;if(tabContentView instanceof WebInspector.ContentBrowserTabContentView)
return tabContentView.contentBrowser.currentContentView;return tabContentView;};WebInspector._beforecopy=function(event)
{var selection=window.getSelection();if(selection.isCollapsed&&!WebInspector.isEventTargetAnEditableField(event)){var focusedCopyHandler=this.currentFocusElement&&this.currentFocusElement.copyHandler;if(focusedCopyHandler&&typeof focusedCopyHandler.handleBeforeCopyEvent==="function"){focusedCopyHandler.handleBeforeCopyEvent(event);if(event.defaultPrevented)
return;}
var focusedContentView=this._focusedContentView();if(focusedContentView&&typeof focusedContentView.handleCopyEvent==="function"){event.preventDefault();return;}
return;}
if(selection.isCollapsed)
return;event.preventDefault();};WebInspector._find=function(event)
{let contentBrowser=this._focusedOrVisibleContentBrowser();if(!contentBrowser)
return;contentBrowser.showFindBanner();};WebInspector._save=function(event)
{var contentView=this.focusedOrVisibleContentView();if(!contentView||!contentView.supportsSave)
return;WebInspector.saveDataToFile(contentView.saveData);};WebInspector._saveAs=function(event)
{var contentView=this.focusedOrVisibleContentView();if(!contentView||!contentView.supportsSave)
return;WebInspector.saveDataToFile(contentView.saveData,true);};WebInspector._clear=function(event)
{let contentView=this.focusedOrVisibleContentView();if(!contentView||typeof contentView.handleClearShortcut!=="function"){
this.logManager.requestClearMessages();return;}
contentView.handleClearShortcut(event);};WebInspector._copy=function(event)
{var selection=window.getSelection();if(selection.isCollapsed&&!WebInspector.isEventTargetAnEditableField(event)){var focusedCopyHandler=this.currentFocusElement&&this.currentFocusElement.copyHandler;if(focusedCopyHandler&&typeof focusedCopyHandler.handleCopyEvent==="function"){focusedCopyHandler.handleCopyEvent(event);if(event.defaultPrevented)
return;}
var focusedContentView=this._focusedContentView();if(focusedContentView&&typeof focusedContentView.handleCopyEvent==="function"){focusedContentView.handleCopyEvent(event);return;}
let tabContentView=this.tabBrowser.selectedTabContentView;if(tabContentView&&typeof tabContentView.handleCopyEvent==="function"){tabContentView.handleCopyEvent(event);return;}
return;}
if(selection.isCollapsed)
return;var selectionString=selection.toString().removeWordBreakCharacters();event.clipboardData.setData("text/plain",selectionString);event.preventDefault();};WebInspector._increaseZoom=function(event)
{const epsilon=0.0001;const maximumZoom=2.4;let currentZoom=this.getZoomFactor();if(currentZoom+epsilon>=maximumZoom){InspectorFrontendHost.beep();return;}
this.setZoomFactor(Math.min(maximumZoom,currentZoom+0.2));};WebInspector._decreaseZoom=function(event)
{const epsilon=0.0001;const minimumZoom=0.6;let currentZoom=this.getZoomFactor();if(currentZoom-epsilon<=minimumZoom){InspectorFrontendHost.beep();return;}
this.setZoomFactor(Math.max(minimumZoom,currentZoom-0.2));};WebInspector._resetZoom=function(event)
{this.setZoomFactor(1);};WebInspector.getZoomFactor=function()
{return WebInspector.settings.zoomFactor.value;};WebInspector.setZoomFactor=function(factor)
{InspectorFrontendHost.setZoomFactor(factor);WebInspector.settings.zoomFactor.value=InspectorFrontendHost.zoomFactor();};WebInspector.resolvedLayoutDirection=function()
{let layoutDirection=WebInspector.settings.layoutDirection.value;if(layoutDirection===WebInspector.LayoutDirection.System)
layoutDirection=InspectorFrontendHost.userInterfaceLayoutDirection();return layoutDirection;};WebInspector.setLayoutDirection=function(value)
{if(!Object.values(WebInspector.LayoutDirection).includes(value))
WebInspector.reportInternalError("Unknown layout direction requested: "+value);if(value===WebInspector.settings.layoutDirection.value)
return;WebInspector.settings.layoutDirection.value=value;if(WebInspector.resolvedLayoutDirection()===WebInspector.LayoutDirection.RTL&&this._dockConfiguration===WebInspector.DockConfiguration.Right)
this._dockLeft();if(WebInspector.resolvedLayoutDirection()===WebInspector.LayoutDirection.LTR&&this._dockConfiguration===WebInspector.DockConfiguration.Left)
this._dockRight();window.location.reload();};WebInspector._showTabAtIndex=function(i,event)
{if(i<=WebInspector.tabBar.tabBarItems.length)
WebInspector.tabBar.selectedTabBarItem=i-1;};WebInspector._showJavaScriptTypeInformationSettingChanged=function(event)
{if(this.showJavaScriptTypeInformationSetting.value){for(let target of WebInspector.targets)
target.RuntimeAgent.enableTypeProfiler();}else{for(let target of WebInspector.targets)
target.RuntimeAgent.disableTypeProfiler();}};WebInspector._enableControlFlowProfilerSettingChanged=function(event)
{if(this.enableControlFlowProfilerSetting.value){for(let target of WebInspector.targets)
target.RuntimeAgent.enableControlFlowProfiler();}else{for(let target of WebInspector.targets)
target.RuntimeAgent.disableControlFlowProfiler();}};WebInspector._resourceCachingDisabledSettingChanged=function(event)
{NetworkAgent.setResourceCachingDisabled(this.resourceCachingDisabledSetting.value);}
WebInspector.elementDragStart=function(element,dividerDrag,elementDragEnd,event,cursor,eventTarget)
{if(WebInspector._elementDraggingEventListener||WebInspector._elementEndDraggingEventListener)
WebInspector.elementDragEnd(event);if(element){ if(WebInspector._elementDraggingGlassPane)
WebInspector._elementDraggingGlassPane.remove();var glassPane=document.createElement("div");glassPane.style.cssText="position:absolute;top:0;bottom:0;left:0;right:0;opacity:0;z-index:1";glassPane.id="glass-pane-for-drag";element.ownerDocument.body.appendChild(glassPane);WebInspector._elementDraggingGlassPane=glassPane;}
WebInspector._elementDraggingEventListener=dividerDrag;WebInspector._elementEndDraggingEventListener=elementDragEnd;var targetDocument=event.target.ownerDocument;WebInspector._elementDraggingEventTarget=eventTarget||targetDocument;WebInspector._elementDraggingEventTarget.addEventListener("mousemove",dividerDrag,true);WebInspector._elementDraggingEventTarget.addEventListener("mouseup",elementDragEnd,true);targetDocument.body.style.cursor=cursor;event.preventDefault();};WebInspector.elementDragEnd=function(event)
{WebInspector._elementDraggingEventTarget.removeEventListener("mousemove",WebInspector._elementDraggingEventListener,true);WebInspector._elementDraggingEventTarget.removeEventListener("mouseup",WebInspector._elementEndDraggingEventListener,true);event.target.ownerDocument.body.style.removeProperty("cursor");if(WebInspector._elementDraggingGlassPane)
WebInspector._elementDraggingGlassPane.remove();delete WebInspector._elementDraggingGlassPane;delete WebInspector._elementDraggingEventTarget;delete WebInspector._elementDraggingEventListener;delete WebInspector._elementEndDraggingEventListener;event.preventDefault();};WebInspector.createMessageTextView=function(message,isError)
{var messageElement=document.createElement("div");messageElement.className="message-text-view";if(isError)
messageElement.classList.add("error");messageElement.textContent=message;return messageElement;};WebInspector.createGoToArrowButton=function()
{var button=document.createElement("button");button.addEventListener("mousedown",(event)=>{event.stopPropagation();},true);button.className="go-to-arrow";button.tabIndex=-1;return button;};WebInspector.createSourceCodeLocationLink=function(sourceCodeLocation,options={})
{if(!sourceCodeLocation)
return null;var linkElement=document.createElement("a");linkElement.className="go-to-link";WebInspector.linkifyElement(linkElement,sourceCodeLocation,options);sourceCodeLocation.populateLiveDisplayLocationTooltip(linkElement);if(options.useGoToArrowButton)
linkElement.appendChild(WebInspector.createGoToArrowButton());else
sourceCodeLocation.populateLiveDisplayLocationString(linkElement,"textContent",options.columnStyle,options.nameStyle,options.prefix);if(options.dontFloat)
linkElement.classList.add("dont-float");return linkElement;};WebInspector.linkifyLocation=function(url,sourceCodePosition,options={})
{var sourceCode=WebInspector.sourceCodeForURL(url);if(!sourceCode){var anchor=document.createElement("a");anchor.href=url;anchor.lineNumber=sourceCodePosition.lineNumber;if(options.className)
anchor.className=options.className;anchor.append(WebInspector.displayNameForURL(url)+":"+sourceCodePosition.lineNumber);return anchor;}
let sourceCodeLocation=sourceCode.createSourceCodeLocation(sourceCodePosition.lineNumber,sourceCodePosition.columnNumber);let linkElement=WebInspector.createSourceCodeLocationLink(sourceCodeLocation,Object.shallowMerge(options,{dontFloat:true}));if(options.className)
linkElement.classList.add(options.className);return linkElement;};WebInspector.linkifyElement=function(linkElement,sourceCodeLocation,options={}){function showSourceCodeLocation(event)
{event.stopPropagation();event.preventDefault();if(event.metaKey)
this.showOriginalUnformattedSourceCodeLocation(sourceCodeLocation,options);else
this.showSourceCodeLocation(sourceCodeLocation,options);}
linkElement.addEventListener("click",showSourceCodeLocation.bind(this));linkElement.addEventListener("contextmenu",(event)=>{let contextMenu=WebInspector.ContextMenu.createFromEvent(event);WebInspector.appendContextMenuItemsForSourceCode(contextMenu,sourceCodeLocation);});};WebInspector.sourceCodeForURL=function(url)
{var sourceCode=WebInspector.frameResourceManager.resourceForURL(url);if(!sourceCode){sourceCode=WebInspector.debuggerManager.scriptsForURL(url,WebInspector.assumingMainTarget())[0];if(sourceCode)
sourceCode=sourceCode.resource||sourceCode;}
return sourceCode||null;};WebInspector.linkifyURLAsNode=function(url,linkText,classes)
{if(!linkText)
linkText=url;classes=(classes?classes+" ":"");var a=document.createElement("a");a.href=url;a.className=classes;a.textContent=linkText;a.style.maxWidth="100%";return a;};WebInspector.linkifyStringAsFragmentWithCustomLinkifier=function(string,linkifier)
{var container=document.createDocumentFragment();var linkStringRegEx=/(?:[a-zA-Z][a-zA-Z0-9+.-]{2,}:\/\/|www\.)[\w$\-_+*'=\|\/\\(){}[\]%@&#~,:;.!?]{2,}[\w$\-_+*=\|\/\\({%@&#~]/;var lineColumnRegEx=/:(\d+)(:(\d+))?$/;while(string){var linkString=linkStringRegEx.exec(string);if(!linkString)
break;linkString=linkString[0];var linkIndex=string.indexOf(linkString);var nonLink=string.substring(0,linkIndex);container.append(nonLink);if(linkString.startsWith("data:")||linkString.startsWith("javascript:")||linkString.startsWith("mailto:")){container.append(linkString);string=string.substring(linkIndex+linkString.length,string.length);continue;}
var title=linkString;var realURL=linkString.startsWith("www.")?"http://"+linkString:linkString;var lineColumnMatch=lineColumnRegEx.exec(realURL);if(lineColumnMatch)
realURL=realURL.substring(0,realURL.length-lineColumnMatch[0].length);var lineNumber;if(lineColumnMatch)
lineNumber=parseInt(lineColumnMatch[1])-1;var linkNode=linkifier(title,realURL,lineNumber);container.appendChild(linkNode);string=string.substring(linkIndex+linkString.length,string.length);}
if(string)
container.append(string);return container;};WebInspector.linkifyStringAsFragment=function(string)
{function linkifier(title,url,lineNumber)
{var urlNode=WebInspector.linkifyURLAsNode(url,title,undefined);if(lineNumber!==undefined)
urlNode.lineNumber=lineNumber;return urlNode;}
return WebInspector.linkifyStringAsFragmentWithCustomLinkifier(string,linkifier);};WebInspector.createResourceLink=function(resource,className)
{function handleClick(event)
{event.stopPropagation();event.preventDefault();WebInspector.showRepresentedObject(resource);}
let linkNode=document.createElement("a");linkNode.classList.add("resource-link",className);linkNode.title=resource.url;linkNode.textContent=(resource.urlComponents.lastPathComponent||resource.url).insertWordBreakCharacters();linkNode.addEventListener("click",handleClick.bind(this));return linkNode;};WebInspector._undoKeyboardShortcut=function(event)
{if(!this.isEditingAnyField()&&!this.isEventTargetAnEditableField(event)){this.undo();event.preventDefault();}};WebInspector._redoKeyboardShortcut=function(event)
{if(!this.isEditingAnyField()&&!this.isEventTargetAnEditableField(event)){this.redo();event.preventDefault();}};WebInspector.undo=function()
{DOMAgent.undo();};WebInspector.redo=function()
{DOMAgent.redo();};WebInspector.highlightRangesWithStyleClass=function(element,resultRanges,styleClass,changes)
{changes=changes||[];var highlightNodes=[];var lineText=element.textContent;var ownerDocument=element.ownerDocument;var textNodeSnapshot=ownerDocument.evaluate(".//text()",element,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);var snapshotLength=textNodeSnapshot.snapshotLength;if(snapshotLength===0)
return highlightNodes;var nodeRanges=[];var rangeEndOffset=0;for(var i=0;i<snapshotLength;++i){var range={};range.offset=rangeEndOffset;range.length=textNodeSnapshot.snapshotItem(i).textContent.length;rangeEndOffset=range.offset+range.length;nodeRanges.push(range);}
var startIndex=0;for(var i=0;i<resultRanges.length;++i){var startOffset=resultRanges[i].offset;var endOffset=startOffset+resultRanges[i].length;while(startIndex<snapshotLength&&nodeRanges[startIndex].offset+nodeRanges[startIndex].length<=startOffset)
startIndex++;var endIndex=startIndex;while(endIndex<snapshotLength&&nodeRanges[endIndex].offset+nodeRanges[endIndex].length<endOffset)
endIndex++;if(endIndex===snapshotLength)
break;var highlightNode=ownerDocument.createElement("span");highlightNode.className=styleClass;highlightNode.textContent=lineText.substring(startOffset,endOffset);var lastTextNode=textNodeSnapshot.snapshotItem(endIndex);var lastText=lastTextNode.textContent;lastTextNode.textContent=lastText.substring(endOffset-nodeRanges[endIndex].offset);changes.push({node:lastTextNode,type:"changed",oldText:lastText,newText:lastTextNode.textContent});if(startIndex===endIndex){lastTextNode.parentElement.insertBefore(highlightNode,lastTextNode);changes.push({node:highlightNode,type:"added",nextSibling:lastTextNode,parent:lastTextNode.parentElement});highlightNodes.push(highlightNode);var prefixNode=ownerDocument.createTextNode(lastText.substring(0,startOffset-nodeRanges[startIndex].offset));lastTextNode.parentElement.insertBefore(prefixNode,highlightNode);changes.push({node:prefixNode,type:"added",nextSibling:highlightNode,parent:lastTextNode.parentElement});}else{var firstTextNode=textNodeSnapshot.snapshotItem(startIndex);var firstText=firstTextNode.textContent;var anchorElement=firstTextNode.nextSibling;firstTextNode.parentElement.insertBefore(highlightNode,anchorElement);changes.push({node:highlightNode,type:"added",nextSibling:anchorElement,parent:firstTextNode.parentElement});highlightNodes.push(highlightNode);firstTextNode.textContent=firstText.substring(0,startOffset-nodeRanges[startIndex].offset);changes.push({node:firstTextNode,type:"changed",oldText:firstText,newText:firstTextNode.textContent});for(var j=startIndex+1;j<endIndex;j++){var textNode=textNodeSnapshot.snapshotItem(j);var text=textNode.textContent;textNode.textContent="";changes.push({node:textNode,type:"changed",oldText:text,newText:textNode.textContent});}}
startIndex=endIndex;nodeRanges[startIndex].offset=endOffset;nodeRanges[startIndex].length=lastTextNode.textContent.length;}
return highlightNodes;};WebInspector.revertDomChanges=function(domChanges)
{for(var i=domChanges.length-1;i>=0;--i){var entry=domChanges[i];switch(entry.type){case"added":entry.node.remove();break;case"changed":entry.node.textContent=entry.oldText;break;}}};WebInspector.archiveMainFrame=function()
{this._downloadingPage=true;this._updateDownloadToolbarButton();PageAgent.archive((error,data)=>{this._downloadingPage=false;this._updateDownloadToolbarButton();if(error)
return;let mainFrame=WebInspector.frameResourceManager.mainFrame;let archiveName=mainFrame.mainResource.urlComponents.host||mainFrame.mainResource.displayName||"Archive";let url="web-inspector:///"+encodeURI(archiveName)+".webarchive";InspectorFrontendHost.save(url,data,true,true);});};WebInspector.canArchiveMainFrame=function()
{if(!PageAgent.archive||this.debuggableType!==WebInspector.DebuggableType.Web)
return false;if(!WebInspector.frameResourceManager.mainFrame||!WebInspector.frameResourceManager.mainFrame.mainResource)
return false;return WebInspector.Resource.typeFromMIMEType(WebInspector.frameResourceManager.mainFrame.mainResource.mimeType)===WebInspector.Resource.Type.Document;};WebInspector.addWindowKeydownListener=function(listener)
{if(typeof listener.handleKeydownEvent!=="function")
return;this._windowKeydownListeners.push(listener);this._updateWindowKeydownListener();};WebInspector.removeWindowKeydownListener=function(listener)
{this._windowKeydownListeners.remove(listener);this._updateWindowKeydownListener();};WebInspector._updateWindowKeydownListener=function()
{if(this._windowKeydownListeners.length===1)
window.addEventListener("keydown",WebInspector._sharedWindowKeydownListener,true);else if(!this._windowKeydownListeners.length)
window.removeEventListener("keydown",WebInspector._sharedWindowKeydownListener,true);};WebInspector._sharedWindowKeydownListener=function(event)
{for(var i=WebInspector._windowKeydownListeners.length-1;i>=0;--i){if(WebInspector._windowKeydownListeners[i].handleKeydownEvent(event)){event.stopImmediatePropagation();event.preventDefault();break;}}};WebInspector.reportInternalError=function(errorOrString,details={})
{
let error=(errorOrString instanceof Error)?errorOrString:new Error(errorOrString);error.details=details;if(WebInspector.isDebugUIEnabled()){
handleInternalException(error);}else
console.error(error);};Object.defineProperty(WebInspector,"targets",{get(){return this.targetManager.targets;}});
WebInspector.assumingMainTarget=function()
{return WebInspector.mainTarget;};WebInspector.dialogWasDismissed=function(dialog)
{let representedObject=dialog.representedObject;if(!representedObject)
return;WebInspector.showRepresentedObject(representedObject,dialog.cookie);};WebInspector.DockConfiguration={Right:"right",Left:"left",Bottom:"bottom",Undocked:"undocked",};